@nu-art/analytics-frontend 0.401.9 → 0.500.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,43 @@
1
- import { ApiStruct_Analytics } from '@nu-art/analytics-shared';
2
- import { ApiDefCaller } from '@nu-art/thunderstorm-shared';
3
1
  import { Module } from '@nu-art/ts-common';
4
2
  type Config = {
5
3
  baseURL: string;
6
4
  };
5
+ type Analytics_SendEvent = {
6
+ request: {
7
+ event: unknown;
8
+ };
9
+ response: void;
10
+ };
11
+ type Analytics_UpdateUser = {
12
+ request: {
13
+ mode: 'set' | 'set_once';
14
+ userData: Record<string, unknown>;
15
+ };
16
+ response: void;
17
+ };
18
+ type Analytics_UpdateLexicon = {
19
+ request: {
20
+ mode: 'set' | 'set_once';
21
+ lexiconMap: Record<string, {
22
+ id: string;
23
+ label: string;
24
+ }>;
25
+ };
26
+ response: void;
27
+ };
7
28
  declare class ModuleFE_Analytics_Class extends Module<Config> {
8
- readonly _v1: ApiDefCaller<ApiStruct_Analytics>['_v1'];
9
- init(): void;
29
+ sendEvent(payload: Analytics_SendEvent['request']): {
30
+ executeSync: () => Promise<Analytics_SendEvent['response']>;
31
+ };
32
+ updateUser(payload: Analytics_UpdateUser['request']): {
33
+ executeSync: () => Promise<Analytics_UpdateUser['response']>;
34
+ };
35
+ updateLexicon(payload: Analytics_UpdateLexicon['request']): {
36
+ executeSync: () => Promise<Analytics_UpdateLexicon['response']>;
37
+ };
38
+ private runSendEvent;
39
+ private runUpdateUser;
40
+ private runUpdateLexicon;
10
41
  }
11
42
  export declare const ModuleFE_Analytics: ModuleFE_Analytics_Class;
12
43
  export {};
@@ -1,13 +1,79 @@
1
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
2
+ var useValue = arguments.length > 2;
3
+ for (var i = 0; i < initializers.length; i++) {
4
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
5
+ }
6
+ return useValue ? value : void 0;
7
+ };
8
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
9
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
10
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
11
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
12
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
13
+ var _, done = false;
14
+ for (var i = decorators.length - 1; i >= 0; i--) {
15
+ var context = {};
16
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
17
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
18
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
19
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
20
+ if (kind === "accessor") {
21
+ if (result === void 0) continue;
22
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
23
+ if (_ = accept(result.get)) descriptor.get = _;
24
+ if (_ = accept(result.set)) descriptor.set = _;
25
+ if (_ = accept(result.init)) initializers.unshift(_);
26
+ }
27
+ else if (_ = accept(result)) {
28
+ if (kind === "field") initializers.unshift(_);
29
+ else descriptor[key] = _;
30
+ }
31
+ }
32
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
33
+ done = true;
34
+ };
35
+ import { ApiCaller } from '@nu-art/http-client';
1
36
  import { ApiDef_Analytics } from '@nu-art/analytics-shared';
2
- import { apiWithBody } from '@nu-art/thunderstorm-frontend/index';
3
37
  import { Module } from '@nu-art/ts-common';
4
- class ModuleFE_Analytics_Class extends Module {
5
- _v1 = {};
6
- init() {
7
- const apiDef = ApiDef_Analytics(this.config.baseURL);
8
- this._v1.sendEvent = apiWithBody(apiDef._v1.sendEvent);
9
- this._v1.updateUser = apiWithBody(apiDef._v1.updateUser);
10
- this._v1.updateLexicon = apiWithBody(apiDef._v1.updateLexicon);
11
- }
12
- }
38
+ let ModuleFE_Analytics_Class = (() => {
39
+ let _classSuper = Module;
40
+ let _instanceExtraInitializers = [];
41
+ let _runSendEvent_decorators;
42
+ let _runUpdateUser_decorators;
43
+ let _runUpdateLexicon_decorators;
44
+ return class ModuleFE_Analytics_Class extends _classSuper {
45
+ static {
46
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
47
+ _runSendEvent_decorators = [ApiCaller((m) => ApiDef_Analytics(m.config.baseURL).sendEvent)];
48
+ _runUpdateUser_decorators = [ApiCaller((m) => ApiDef_Analytics(m.config.baseURL).updateUser)];
49
+ _runUpdateLexicon_decorators = [ApiCaller((m) => ApiDef_Analytics(m.config.baseURL).updateLexicon)];
50
+ __esDecorate(this, null, _runSendEvent_decorators, { kind: "method", name: "runSendEvent", static: false, private: false, access: { has: obj => "runSendEvent" in obj, get: obj => obj.runSendEvent }, metadata: _metadata }, null, _instanceExtraInitializers);
51
+ __esDecorate(this, null, _runUpdateUser_decorators, { kind: "method", name: "runUpdateUser", static: false, private: false, access: { has: obj => "runUpdateUser" in obj, get: obj => obj.runUpdateUser }, metadata: _metadata }, null, _instanceExtraInitializers);
52
+ __esDecorate(this, null, _runUpdateLexicon_decorators, { kind: "method", name: "runUpdateLexicon", static: false, private: false, access: { has: obj => "runUpdateLexicon" in obj, get: obj => obj.runUpdateLexicon }, metadata: _metadata }, null, _instanceExtraInitializers);
53
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
54
+ }
55
+ sendEvent(payload) {
56
+ return { executeSync: () => this.runSendEvent(payload) };
57
+ }
58
+ updateUser(payload) {
59
+ return { executeSync: () => this.runUpdateUser(payload) };
60
+ }
61
+ updateLexicon(payload) {
62
+ return { executeSync: () => this.runUpdateLexicon(payload) };
63
+ }
64
+ async runSendEvent(_p) {
65
+ return undefined;
66
+ }
67
+ async runUpdateUser(_p) {
68
+ return undefined;
69
+ }
70
+ async runUpdateLexicon(_p) {
71
+ return undefined;
72
+ }
73
+ constructor() {
74
+ super(...arguments);
75
+ __runInitializers(this, _instanceExtraInitializers);
76
+ }
77
+ };
78
+ })();
13
79
  export const ModuleFE_Analytics = new ModuleFE_Analytics_Class();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nu-art/analytics-frontend",
3
- "version": "0.401.9",
3
+ "version": "0.500.0",
4
4
  "description": "Analytics Frontend",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
@@ -11,10 +11,13 @@
11
11
  "linkDirectory": true
12
12
  },
13
13
  "dependencies": {
14
- "@nu-art/analytics-shared": "0.401.9",
15
- "@nu-art/ts-common": "0.401.9",
16
- "@nu-art/thunderstorm-frontend": "0.401.9",
17
- "@nu-art/thunderstorm-shared": "0.401.9"
14
+ "@nu-art/analytics-shared": "0.500.0",
15
+ "@nu-art/db-api-frontend": "0.500.0",
16
+ "@nu-art/db-api-shared": "0.500.0",
17
+ "@nu-art/http-client": "{{THUNDERSTORM_VERSION}}",
18
+ "@nu-art/thunder-core": "{{THUNDERSTORM_VERSION}}",
19
+ "@nu-art/thunder-widgets": "{{THUNDERSTORM_VERSION}}",
20
+ "@nu-art/ts-common": "0.500.0"
18
21
  },
19
22
  "devDependencies": {},
20
23
  "private": false,
@@ -1,2 +0,0 @@
1
- import { TSAnalyticsEventMetadata } from '@nu-art/analytics-shared';
2
- export declare function getBaseAnalyticsMetadata(): TSAnalyticsEventMetadata;
@@ -1,6 +0,0 @@
1
- import { Thunder } from '@nu-art/thunderstorm-frontend/index';
2
- export function getBaseAnalyticsMetadata() {
3
- return {
4
- env: Thunder.getInstance().getConfig().label,
5
- };
6
- }