update to fit in with keen.io
This commit is contained in:
parent
ca585b20e3
commit
b3023d61f3
4
dist/smartanalytics.classes.analytics.d.ts
vendored
4
dist/smartanalytics.classes.analytics.d.ts
vendored
@ -1,10 +1,10 @@
|
|||||||
export declare class Analytics {
|
export declare class Analytics {
|
||||||
project: string;
|
projectId: string;
|
||||||
appName: string;
|
appName: string;
|
||||||
apiEndPoint: string;
|
apiEndPoint: string;
|
||||||
secretKey: string;
|
secretKey: string;
|
||||||
constructor(optionsArg: {
|
constructor(optionsArg: {
|
||||||
projectArg: string;
|
projectIdArg: string;
|
||||||
appNameArg: string;
|
appNameArg: string;
|
||||||
apiEndPointArg: string;
|
apiEndPointArg: string;
|
||||||
secretKeyArg?: string;
|
secretKeyArg?: string;
|
||||||
|
7
dist/smartanalytics.classes.analytics.js
vendored
7
dist/smartanalytics.classes.analytics.js
vendored
@ -12,7 +12,7 @@ const plugins = require("./smartanalytics.plugins");
|
|||||||
class Analytics {
|
class Analytics {
|
||||||
constructor(optionsArg) {
|
constructor(optionsArg) {
|
||||||
this.secretKey = '';
|
this.secretKey = '';
|
||||||
this.project = optionsArg.projectArg;
|
this.projectId = optionsArg.projectIdArg;
|
||||||
this.appName = optionsArg.appNameArg;
|
this.appName = optionsArg.appNameArg;
|
||||||
this.apiEndPoint = optionsArg.apiEndPointArg;
|
this.apiEndPoint = optionsArg.apiEndPointArg;
|
||||||
if (optionsArg.secretKeyArg) {
|
if (optionsArg.secretKeyArg) {
|
||||||
@ -22,12 +22,11 @@ class Analytics {
|
|||||||
recordEvent(identifierArg, analyticsDataArg) {
|
recordEvent(identifierArg, analyticsDataArg) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let dataToSend = {
|
let dataToSend = {
|
||||||
project: this.project,
|
projectId: this.projectId,
|
||||||
appName: this.appName,
|
appName: this.appName,
|
||||||
identifier: identifierArg,
|
identifier: identifierArg,
|
||||||
analyticsData: analyticsDataArg
|
analyticsData: analyticsDataArg
|
||||||
};
|
};
|
||||||
console.log(dataToSend);
|
|
||||||
yield plugins.smartrequest.post(this.apiEndPoint, {
|
yield plugins.smartrequest.post(this.apiEndPoint, {
|
||||||
headers: {
|
headers: {
|
||||||
'authenticate': this.secretKey,
|
'authenticate': this.secretKey,
|
||||||
@ -41,4 +40,4 @@ class Analytics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.Analytics = Analytics;
|
exports.Analytics = Analytics;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRhbmFseXRpY3MuY2xhc3Nlcy5hbmFseXRpY3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGFuYWx5dGljcy5jbGFzc2VzLmFuYWx5dGljcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsb0RBQW1EO0FBRW5EO0lBS0UsWUFBYSxVQUtaO1FBTkQsY0FBUyxHQUFXLEVBQUUsQ0FBQTtRQU9wQixJQUFJLENBQUMsT0FBTyxHQUFHLFVBQVUsQ0FBQyxVQUFVLENBQUE7UUFDcEMsSUFBSSxDQUFDLE9BQU8sR0FBRyxVQUFVLENBQUMsVUFBVSxDQUFBO1FBQ3BDLElBQUksQ0FBQyxXQUFXLEdBQUcsVUFBVSxDQUFDLGNBQWMsQ0FBQTtRQUM1QyxFQUFFLENBQUMsQ0FBQyxVQUFVLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQztZQUM1QixJQUFJLENBQUMsU0FBUyxHQUFHLFVBQVUsQ0FBQyxZQUFZLENBQUE7UUFDMUMsQ0FBQztJQUNILENBQUM7SUFFSyxXQUFXLENBQUUsYUFBcUIsRUFBRSxnQkFBcUI7O1lBQzdELElBQUksVUFBVSxHQUFHO2dCQUNmLE9BQU8sRUFBRSxJQUFJLENBQUMsT0FBTztnQkFDckIsT0FBTyxFQUFFLElBQUksQ0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UFFLENBQUMsQ0FBQyxVQUFVLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQztZQUM1QixJQUFJLENBQUMsU0FBUyxHQUFHLFVBQVUsQ0FBQyxZQUFZLENBQUE7UUFDMUMsQ0FBQztJQUNILENBQUM7SUFFSyxXQUFXLENBQUUsYUFBcUIsRUFBRSxnQkFBcUI7O1lBQzdELElBQUksVUFBVSxHQUFHO2dCQUNmLFNBQVMsRUFBRSxJQUFJLENBQUMsU0FBUztnQkFDekIsT0FBTyxFQUFFLElBQUksQ0FBQyxPQUFPO2dCQUNyQixVQUFVLEVBQUUsYUFBYTtnQkFDekIsYUFBYSxFQUFFLGdCQUFnQjthQUNoQyxDQUFBO1lBQ0QsTUFBTSxPQUFPLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsV0FBVyxFQUFFO2dCQUNoRCxPQUFPLEVBQUU7b0JBQ1AsY0FBYyxFQUFFLElBQUksQ0FBQyxTQUFTO29CQUM5QixjQUFjLEVBQUUsa0JBQWtCO2lCQUNuQztnQkFDRCxXQUFXLEVBQUUsVUFBVTthQUN4QixDQUFDLENBQUMsS0FBSyxDQUFDLEdBQUc7Z0JBQ1YsT0FBTyxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsQ0FBQTtZQUNsQixDQUFDLENBQUMsQ0FBQTtRQUNKLENBQUM7S0FBQTtDQUNGO0FBcENELDhCQW9DQyJ9
|
@ -6,9 +6,9 @@ let testAnalytics: smartanalytics.Analytics
|
|||||||
|
|
||||||
tap.test('should create a valid AnalyticsAccount', async () => {
|
tap.test('should create a valid AnalyticsAccount', async () => {
|
||||||
testAnalytics = new smartanalytics.Analytics({
|
testAnalytics = new smartanalytics.Analytics({
|
||||||
projectArg: 'pushrocks',
|
projectIdArg: 'pushrocks',
|
||||||
appNameArg: 'smartanalytics',
|
appNameArg: 'smartanalytics',
|
||||||
apiEndPointArg: 'https://pubapi-1.herokuapp.com/analytics'
|
apiEndPointArg: 'https://pubapi-1.lossless.one/analytics'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
import * as plugins from './smartanalytics.plugins'
|
import * as plugins from './smartanalytics.plugins'
|
||||||
|
|
||||||
export class Analytics {
|
export class Analytics {
|
||||||
project: string
|
projectId: string
|
||||||
appName: string
|
appName: string
|
||||||
apiEndPoint: string
|
apiEndPoint: string
|
||||||
secretKey: string = ''
|
secretKey: string = ''
|
||||||
constructor (optionsArg: {
|
constructor (optionsArg: {
|
||||||
projectArg: string
|
projectIdArg: string
|
||||||
appNameArg: string
|
appNameArg: string
|
||||||
apiEndPointArg: string
|
apiEndPointArg: string
|
||||||
secretKeyArg?: string
|
secretKeyArg?: string
|
||||||
}) {
|
}) {
|
||||||
this.project = optionsArg.projectArg
|
this.projectId = optionsArg.projectIdArg
|
||||||
this.appName = optionsArg.appNameArg
|
this.appName = optionsArg.appNameArg
|
||||||
this.apiEndPoint = optionsArg.apiEndPointArg
|
this.apiEndPoint = optionsArg.apiEndPointArg
|
||||||
if (optionsArg.secretKeyArg) {
|
if (optionsArg.secretKeyArg) {
|
||||||
@ -21,12 +21,11 @@ export class Analytics {
|
|||||||
|
|
||||||
async recordEvent (identifierArg: string, analyticsDataArg: any) {
|
async recordEvent (identifierArg: string, analyticsDataArg: any) {
|
||||||
let dataToSend = {
|
let dataToSend = {
|
||||||
project: this.project,
|
projectId: this.projectId,
|
||||||
appName: this.appName,
|
appName: this.appName,
|
||||||
identifier: identifierArg,
|
identifier: identifierArg,
|
||||||
analyticsData: analyticsDataArg
|
analyticsData: analyticsDataArg
|
||||||
}
|
}
|
||||||
console.log(dataToSend)
|
|
||||||
await plugins.smartrequest.post(this.apiEndPoint, {
|
await plugins.smartrequest.post(this.apiEndPoint, {
|
||||||
headers: {
|
headers: {
|
||||||
'authenticate': this.secretKey,
|
'authenticate': this.secretKey,
|
||||||
|
Loading…
Reference in New Issue
Block a user