update to support latest pubapi
This commit is contained in:
parent
511b7ee143
commit
05b80b618b
10
dist/smartanalytics.classes.analytics.d.ts
vendored
10
dist/smartanalytics.classes.analytics.d.ts
vendored
@ -4,10 +4,10 @@ export declare class Analytics {
|
|||||||
apiEndPoint: string;
|
apiEndPoint: string;
|
||||||
secretKey: string;
|
secretKey: string;
|
||||||
constructor(optionsArg: {
|
constructor(optionsArg: {
|
||||||
projectIdArg: string;
|
projectId: string;
|
||||||
appNameArg: string;
|
appName: string;
|
||||||
apiEndPointArg: string;
|
apiEndPoint: string;
|
||||||
secretKeyArg?: string;
|
secretKey?: string;
|
||||||
});
|
});
|
||||||
recordEvent(eventIdentifierArg: string, analyticsDataArg: any): Promise<void>;
|
recordEvent(eventIdArg: string, analyticsDataArg: any): Promise<void>;
|
||||||
}
|
}
|
||||||
|
16
dist/smartanalytics.classes.analytics.js
vendored
16
dist/smartanalytics.classes.analytics.js
vendored
@ -12,19 +12,19 @@ const plugins = require("./smartanalytics.plugins");
|
|||||||
class Analytics {
|
class Analytics {
|
||||||
constructor(optionsArg) {
|
constructor(optionsArg) {
|
||||||
this.secretKey = '';
|
this.secretKey = '';
|
||||||
this.projectId = optionsArg.projectIdArg;
|
this.projectId = optionsArg.projectId;
|
||||||
this.appName = optionsArg.appNameArg;
|
this.appName = optionsArg.appName;
|
||||||
this.apiEndPoint = optionsArg.apiEndPointArg;
|
this.apiEndPoint = optionsArg.apiEndPoint;
|
||||||
if (optionsArg.secretKeyArg) {
|
if (optionsArg.secretKey) {
|
||||||
this.secretKey = optionsArg.secretKeyArg;
|
this.secretKey = optionsArg.secretKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
recordEvent(eventIdentifierArg, analyticsDataArg) {
|
recordEvent(eventIdArg, analyticsDataArg) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let dataToSend = {
|
let dataToSend = {
|
||||||
projectId: this.projectId,
|
projectId: this.projectId,
|
||||||
appName: this.appName,
|
appName: this.appName,
|
||||||
eventIdentifier: eventIdentifierArg,
|
eventId: eventIdArg,
|
||||||
analyticsData: analyticsDataArg
|
analyticsData: analyticsDataArg
|
||||||
};
|
};
|
||||||
yield plugins.smartrequest.post(this.apiEndPoint, {
|
yield plugins.smartrequest.post(this.apiEndPoint, {
|
||||||
@ -40,4 +40,4 @@ class Analytics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.Analytics = Analytics;
|
exports.Analytics = Analytics;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRhbmFseXRpY3MuY2xhc3Nlcy5hbmFseXRpY3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGFuYWx5dGljcy5jbGFzc2VzLmFuYWx5dGljcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsb0RBQW1EO0FBRW5EO0lBS0UsWUFBYSxVQUtaO1FBTkQsY0FBUyxHQUFXLEVBQUUsQ0FBQTtRQU9wQixJQUFJLENBQUMsU0FBUyxHQUFHLFVBQVUsQ0FBQyxZQUFZLENBQUE7UUFDeEMsSUFBSSxDQUFDLE9BQU8sR0FBRyxVQUFVLENBQUMsVUFBVSxDQUFBO1FBQ3BDLElBQUksQ0FBQyxXQUFXLEdBQUcsVUFBVSxDQUFDLGNBQWMsQ0FBQTtRQUM1QyxFQUFFLENBQUMsQ0FBQyxVQUFVLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQztZQUM1QixJQUFJLENBQUMsU0FBUyxHQUFHLFVBQVUsQ0FBQyxZQUFZLENBQUE7UUFDMUMsQ0FBQztJQUNILENBQUM7SUFFSyxXQUFXLENBQUUsa0JBQTBCLEVBQUUsZ0JBQXFCOztZQUNsRSxJQUFJLFVBQVUsR0FBRztnQkFDZixTQUFTLEVBQUUsSUFBSSxDQUFDLFNBQVM7Z0JBQ3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FDLENBQUMsQ0FBQztZQUN6QixJQUFJLENBQUMsU0FBUyxHQUFHLFVBQVUsQ0FBQyxTQUFTLENBQUE7UUFDdkMsQ0FBQztJQUNILENBQUM7SUFFSyxXQUFXLENBQUUsVUFBa0IsRUFBRSxnQkFBcUI7O1lBQzFELElBQUksVUFBVSxHQUFHO2dCQUNmLFNBQVMsRUFBRSxJQUFJLENBQUMsU0FBUztnQkFDekIsT0FBTyxFQUFFLElBQUksQ0FBQyxPQUFPO2dCQUNyQixPQUFPLEVBQUUsVUFBVTtnQkFDbkIsYUFBYSxFQUFFLGdCQUFnQjthQUNoQyxDQUFBO1lBQ0QsTUFBTSxPQUFPLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsV0FBVyxFQUFFO2dCQUNoRCxPQUFPLEVBQUU7b0JBQ1AsY0FBYyxFQUFFLElBQUksQ0FBQyxTQUFTO29CQUM5QixjQUFjLEVBQUUsa0JBQWtCO2lCQUNuQztnQkFDRCxXQUFXLEVBQUUsVUFBVTthQUN4QixDQUFDLENBQUMsS0FBSyxDQUFDLEdBQUc7Z0JBQ1YsT0FBTyxDQUFDLEdBQUcsQ0FBQyxHQUFHLENBQUMsQ0FBQTtZQUNsQixDQUFDLENBQUMsQ0FBQTtRQUNKLENBQUM7S0FBQTtDQUNGO0FBcENELDhCQW9DQyJ9
|
@ -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({
|
||||||
projectIdArg: 'sandbox',
|
projectId: 'sandbox',
|
||||||
appNameArg: 'smartanalytics',
|
appName: 'smartanalytics',
|
||||||
apiEndPointArg: 'https://pubapi-1.lossless.one/analytics'
|
apiEndPoint: 'https://pubapi-1.lossless.one/analytics'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -6,24 +6,24 @@ export class Analytics {
|
|||||||
apiEndPoint: string
|
apiEndPoint: string
|
||||||
secretKey: string = ''
|
secretKey: string = ''
|
||||||
constructor (optionsArg: {
|
constructor (optionsArg: {
|
||||||
projectIdArg: string
|
projectId: string
|
||||||
appNameArg: string
|
appName: string
|
||||||
apiEndPointArg: string
|
apiEndPoint: string
|
||||||
secretKeyArg?: string
|
secretKey?: string
|
||||||
}) {
|
}) {
|
||||||
this.projectId = optionsArg.projectIdArg
|
this.projectId = optionsArg.projectId
|
||||||
this.appName = optionsArg.appNameArg
|
this.appName = optionsArg.appName
|
||||||
this.apiEndPoint = optionsArg.apiEndPointArg
|
this.apiEndPoint = optionsArg.apiEndPoint
|
||||||
if (optionsArg.secretKeyArg) {
|
if (optionsArg.secretKey) {
|
||||||
this.secretKey = optionsArg.secretKeyArg
|
this.secretKey = optionsArg.secretKey
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async recordEvent (eventIdentifierArg: string, analyticsDataArg: any) {
|
async recordEvent (eventIdArg: string, analyticsDataArg: any) {
|
||||||
let dataToSend = {
|
let dataToSend = {
|
||||||
projectId: this.projectId,
|
projectId: this.projectId,
|
||||||
appName: this.appName,
|
appName: this.appName,
|
||||||
eventIdentifier: eventIdentifierArg,
|
eventId: eventIdArg,
|
||||||
analyticsData: analyticsDataArg
|
analyticsData: analyticsDataArg
|
||||||
}
|
}
|
||||||
await plugins.smartrequest.post(this.apiEndPoint, {
|
await plugins.smartrequest.post(this.apiEndPoint, {
|
||||||
|
Loading…
Reference in New Issue
Block a user