@metamask-previews/analytics-controller 0.0.0-preview-704ae19a → 0.0.0-preview-b0cb618e

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.
Files changed (46) hide show
  1. package/README.md +4 -61
  2. package/dist/AnalyticsController-method-action-types.cjs.map +1 -1
  3. package/dist/AnalyticsController-method-action-types.d.cts +23 -62
  4. package/dist/AnalyticsController-method-action-types.d.cts.map +1 -1
  5. package/dist/AnalyticsController-method-action-types.d.mts +23 -62
  6. package/dist/AnalyticsController-method-action-types.d.mts.map +1 -1
  7. package/dist/AnalyticsController-method-action-types.mjs.map +1 -1
  8. package/dist/AnalyticsController.cjs +52 -125
  9. package/dist/AnalyticsController.cjs.map +1 -1
  10. package/dist/AnalyticsController.d.cts +24 -52
  11. package/dist/AnalyticsController.d.cts.map +1 -1
  12. package/dist/AnalyticsController.d.mts +24 -52
  13. package/dist/AnalyticsController.d.mts.map +1 -1
  14. package/dist/AnalyticsController.mjs +53 -126
  15. package/dist/AnalyticsController.mjs.map +1 -1
  16. package/dist/AnalyticsPlatformAdapter.types.cjs.map +1 -1
  17. package/dist/AnalyticsPlatformAdapter.types.d.cts +13 -69
  18. package/dist/AnalyticsPlatformAdapter.types.d.cts.map +1 -1
  19. package/dist/AnalyticsPlatformAdapter.types.d.mts +13 -69
  20. package/dist/AnalyticsPlatformAdapter.types.d.mts.map +1 -1
  21. package/dist/AnalyticsPlatformAdapter.types.mjs.map +1 -1
  22. package/dist/index.cjs +1 -4
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +2 -3
  25. package/dist/index.d.cts.map +1 -1
  26. package/dist/index.d.mts +2 -3
  27. package/dist/index.d.mts.map +1 -1
  28. package/dist/index.mjs +0 -2
  29. package/dist/index.mjs.map +1 -1
  30. package/package.json +1 -1
  31. package/dist/AnalyticsPlatformAdapterSetupError.cjs +0 -17
  32. package/dist/AnalyticsPlatformAdapterSetupError.cjs.map +0 -1
  33. package/dist/AnalyticsPlatformAdapterSetupError.d.cts +0 -8
  34. package/dist/AnalyticsPlatformAdapterSetupError.d.cts.map +0 -1
  35. package/dist/AnalyticsPlatformAdapterSetupError.d.mts +0 -8
  36. package/dist/AnalyticsPlatformAdapterSetupError.d.mts.map +0 -1
  37. package/dist/AnalyticsPlatformAdapterSetupError.mjs +0 -13
  38. package/dist/AnalyticsPlatformAdapterSetupError.mjs.map +0 -1
  39. package/dist/analyticsStateComputer.cjs +0 -46
  40. package/dist/analyticsStateComputer.cjs.map +0 -1
  41. package/dist/analyticsStateComputer.d.cts +0 -35
  42. package/dist/analyticsStateComputer.d.cts.map +0 -1
  43. package/dist/analyticsStateComputer.d.mts +0 -35
  44. package/dist/analyticsStateComputer.d.mts.map +0 -1
  45. package/dist/analyticsStateComputer.mjs +0 -42
  46. package/dist/analyticsStateComputer.mjs.map +0 -1
@@ -16,7 +16,6 @@ exports.AnalyticsController = exports.getDefaultAnalyticsControllerState = expor
16
16
  const base_controller_1 = require("@metamask/base-controller");
17
17
  const uuid_1 = require("uuid");
18
18
  const AnalyticsLogger_1 = require("./AnalyticsLogger.cjs");
19
- const analyticsStateComputer_1 = require("./analyticsStateComputer.cjs");
20
19
  // === GENERAL ===
21
20
  /**
22
21
  * The name of the {@link AnalyticsController}, used to namespace the
@@ -28,19 +27,19 @@ exports.controllerName = 'AnalyticsController';
28
27
  * The metadata for each property in {@link AnalyticsControllerState}.
29
28
  */
30
29
  const analyticsControllerMetadata = {
31
- user_optedIn: {
30
+ enabled: {
32
31
  includeInStateLogs: true,
33
32
  persist: true,
34
33
  includeInDebugSnapshot: true,
35
34
  usedInUi: true,
36
35
  },
37
- user_socialOptedIn: {
36
+ optedIn: {
38
37
  includeInStateLogs: true,
39
38
  persist: true,
40
39
  includeInDebugSnapshot: true,
41
40
  usedInUi: true,
42
41
  },
43
- user_analyticsId: {
42
+ analyticsId: {
44
43
  includeInStateLogs: true,
45
44
  persist: true,
46
45
  includeInDebugSnapshot: true,
@@ -57,9 +56,9 @@ const analyticsControllerMetadata = {
57
56
  */
58
57
  function getDefaultAnalyticsControllerState() {
59
58
  return {
60
- user_optedIn: false,
61
- user_socialOptedIn: false,
62
- user_analyticsId: (0, uuid_1.v4)(),
59
+ enabled: true,
60
+ optedIn: false,
61
+ analyticsId: (0, uuid_1.v4)(),
63
62
  };
64
63
  }
65
64
  exports.getDefaultAnalyticsControllerState = getDefaultAnalyticsControllerState;
@@ -67,15 +66,11 @@ exports.getDefaultAnalyticsControllerState = getDefaultAnalyticsControllerState;
67
66
  const MESSENGER_EXPOSED_METHODS = [
68
67
  'trackEvent',
69
68
  'identify',
70
- 'trackView',
69
+ 'trackPage',
70
+ 'enable',
71
+ 'disable',
71
72
  'optIn',
72
73
  'optOut',
73
- 'socialOptIn',
74
- 'socialOptOut',
75
- 'getAnalyticsId',
76
- 'isEnabled',
77
- 'isOptedIn',
78
- 'isSocialOptedIn',
79
74
  ];
80
75
  /**
81
76
  * The AnalyticsController manages analytics tracking across platforms (Mobile/Extension).
@@ -92,179 +87,111 @@ class AnalyticsController extends base_controller_1.BaseController {
92
87
  * Constructs an AnalyticsController instance.
93
88
  *
94
89
  * @param options - Controller options
95
- * @param options.state - Initial controller state (defaults from getDefaultAnalyticsControllerState).
96
- * For migration from a previous system, pass the existing analytics ID via state.user_analyticsId.
90
+ * @param options.state - Initial controller state (defaults from getDefaultAnalyticsControllerState)
97
91
  * @param options.messenger - Messenger used to communicate with BaseController
98
92
  * @param options.platformAdapter - Platform adapter implementation for tracking
99
93
  */
100
94
  constructor({ state = {}, messenger, platformAdapter, }) {
101
- const initialState = {
102
- ...getDefaultAnalyticsControllerState(),
103
- ...state,
104
- };
105
95
  super({
106
96
  name: exports.controllerName,
107
97
  metadata: analyticsControllerMetadata,
108
- state: initialState,
98
+ state: {
99
+ ...getDefaultAnalyticsControllerState(),
100
+ ...state,
101
+ },
109
102
  messenger,
110
103
  });
111
104
  _AnalyticsController_platformAdapter.set(this, void 0);
112
105
  __classPrivateFieldSet(this, _AnalyticsController_platformAdapter, platformAdapter, "f");
113
106
  this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
114
107
  (0, AnalyticsLogger_1.projectLogger)('AnalyticsController initialized and ready', {
115
- enabled: (0, analyticsStateComputer_1.computeEnabledState)(this.state),
116
- optedIn: this.state.user_optedIn,
117
- socialOptedIn: this.state.user_socialOptedIn,
118
- analyticsId: this.state.user_analyticsId,
108
+ enabled: this.state.enabled,
109
+ optedIn: this.state.optedIn,
110
+ analyticsId: this.state.analyticsId,
119
111
  });
120
- // Call onSetupCompleted lifecycle hook after initialization
121
- // Only call if analyticsId is set and is a valid UUIDv4 (this is the definition of "completed" setup)
122
- if (this.state.user_analyticsId &&
123
- (0, uuid_1.validate)(this.state.user_analyticsId) &&
124
- (0, uuid_1.version)(this.state.user_analyticsId) === 4) {
125
- try {
126
- __classPrivateFieldGet(this, _AnalyticsController_platformAdapter, "f").onSetupCompleted(this.state.user_analyticsId);
127
- }
128
- catch (error) {
129
- // Log error but don't throw - adapter setup failure shouldn't break controller
130
- (0, AnalyticsLogger_1.projectLogger)('Error calling platformAdapter.onSetupCompleted', error);
131
- }
132
- }
133
- else {
134
- // analyticsId is undefined, null, empty string, or not a valid UUIDv4
135
- throw new Error(`Invalid analyticsId: expected a valid UUIDv4, but got ${JSON.stringify(this.state.user_analyticsId)}`);
136
- }
137
112
  }
138
113
  /**
139
114
  * Track an analytics event.
140
115
  *
141
116
  * Events are only tracked if analytics is enabled.
142
117
  *
143
- * @param event - Analytics event with properties and sensitive properties
118
+ * @param eventName - The name of the event
119
+ * @param properties - Event properties
144
120
  */
145
- trackEvent(event) {
121
+ trackEvent(eventName, properties = {}) {
146
122
  // Don't track if analytics is disabled
147
- if (!(0, analyticsStateComputer_1.computeEnabledState)(this.state)) {
123
+ if (!this.state.enabled) {
148
124
  return;
149
125
  }
150
- // if event does not have properties, only send the non-anonymous empty event
151
- // and return to prevent any additional processing
152
- if (!event.hasProperties) {
153
- __classPrivateFieldGet(this, _AnalyticsController_platformAdapter, "f").track(event.name, {
154
- anonymous: false,
155
- });
156
- return;
157
- }
158
- // Log all non-anonymous properties, or an empty event if there's no non-anon props.
159
- __classPrivateFieldGet(this, _AnalyticsController_platformAdapter, "f").track(event.name, {
160
- anonymous: false,
161
- ...event.properties,
162
- });
163
- // Track all sensitive properties in an anonymous event
164
- if (event.isAnonymous) {
165
- __classPrivateFieldGet(this, _AnalyticsController_platformAdapter, "f").track(event.name, {
166
- anonymous: true,
167
- ...event.properties,
168
- ...event.sensitiveProperties,
169
- });
170
- }
126
+ // Delegate to platform adapter
127
+ __classPrivateFieldGet(this, _AnalyticsController_platformAdapter, "f").trackEvent(eventName, properties);
171
128
  }
172
129
  /**
173
130
  * Identify a user for analytics.
174
131
  *
132
+ * @param userId - The user identifier (e.g., metametrics ID)
175
133
  * @param traits - User traits/properties
176
134
  */
177
- identify(traits) {
178
- if (!(0, analyticsStateComputer_1.computeEnabledState)(this.state)) {
135
+ identify(userId, traits) {
136
+ if (!this.state.enabled) {
179
137
  return;
180
138
  }
181
- // Delegate to platform adapter if supported, using the current analytics ID
139
+ // Update state with analytics ID
140
+ this.update((state) => {
141
+ state.analyticsId = userId;
142
+ });
143
+ // Delegate to platform adapter if supported
182
144
  if (__classPrivateFieldGet(this, _AnalyticsController_platformAdapter, "f").identify) {
183
- __classPrivateFieldGet(this, _AnalyticsController_platformAdapter, "f").identify(this.state.user_analyticsId, traits);
145
+ __classPrivateFieldGet(this, _AnalyticsController_platformAdapter, "f").identify(userId, traits);
184
146
  }
185
147
  }
186
148
  /**
187
149
  * Track a page view.
188
150
  *
189
- * @param name - The name of the UI item being viewed (pages for web, screen for mobile)
190
- * @param properties - UI item properties
151
+ * @param pageName - The name of the page
152
+ * @param properties - Page properties
191
153
  */
192
- trackView(name, properties) {
193
- if (!(0, analyticsStateComputer_1.computeEnabledState)(this.state)) {
154
+ trackPage(pageName, properties) {
155
+ if (!this.state.enabled) {
194
156
  return;
195
157
  }
196
- // Delegate to platform adapter
197
- __classPrivateFieldGet(this, _AnalyticsController_platformAdapter, "f").view(name, properties);
158
+ // Delegate to platform adapter if supported
159
+ if (__classPrivateFieldGet(this, _AnalyticsController_platformAdapter, "f").trackPage) {
160
+ __classPrivateFieldGet(this, _AnalyticsController_platformAdapter, "f").trackPage(pageName, properties);
161
+ }
198
162
  }
199
163
  /**
200
- * Opt in to analytics.
201
- * This updates the user's opt-in status.
164
+ * Enable analytics tracking.
202
165
  */
203
- optIn() {
166
+ enable() {
204
167
  this.update((state) => {
205
- state.user_optedIn = true;
168
+ state.enabled = true;
206
169
  });
207
170
  }
208
171
  /**
209
- * Opt out of analytics.
210
- * This updates the user's opt-in status.
172
+ * Disable analytics tracking.
211
173
  */
212
- optOut() {
174
+ disable() {
213
175
  this.update((state) => {
214
- state.user_optedIn = false;
176
+ state.enabled = false;
215
177
  });
216
178
  }
217
179
  /**
218
- * Opt in to analytics through social account.
219
- * This updates the user's social opt-in status.
180
+ * Opt in to analytics.
220
181
  */
221
- socialOptIn() {
182
+ optIn() {
222
183
  this.update((state) => {
223
- state.user_socialOptedIn = true;
184
+ state.optedIn = true;
224
185
  });
225
186
  }
226
187
  /**
227
- * Opt out of analytics through social account.
228
- * This updates the user's social opt-in status.
188
+ * Opt out of analytics.
229
189
  */
230
- socialOptOut() {
190
+ optOut() {
231
191
  this.update((state) => {
232
- state.user_socialOptedIn = false;
192
+ state.optedIn = false;
233
193
  });
234
194
  }
235
- /**
236
- * Get the analytics ID from the controller state.
237
- *
238
- * @returns The current analytics ID.
239
- */
240
- getAnalyticsId() {
241
- return this.state.user_analyticsId;
242
- }
243
- /**
244
- * Get the enabled status from the controller state.
245
- * This is computed from user state via the state machine.
246
- *
247
- * @returns The current enabled status.
248
- */
249
- isEnabled() {
250
- return (0, analyticsStateComputer_1.computeEnabledState)(this.state);
251
- }
252
- /**
253
- * Get the opted in status from the controller state.
254
- *
255
- * @returns The current opted in status.
256
- */
257
- isOptedIn() {
258
- return this.state.user_optedIn;
259
- }
260
- /**
261
- * Get the social opted in status from the controller state.
262
- *
263
- * @returns The current social opted in status.
264
- */
265
- isSocialOptedIn() {
266
- return this.state.user_socialOptedIn;
267
- }
268
195
  }
269
196
  exports.AnalyticsController = AnalyticsController;
270
197
  _AnalyticsController_platformAdapter = new WeakMap();
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsController.cjs","sourceRoot":"","sources":["../src/AnalyticsController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,+DAA2D;AAE3D,+BAIc;AAGd,2DAAkD;AAOlD,yEAA+D;AAE/D,kBAAkB;AAElB;;;;GAIG;AACU,QAAA,cAAc,GAAG,qBAAqB,CAAC;AAwBpD;;GAEG;AACH,MAAM,2BAA2B,GAAG;IAClC,YAAY,EAAE;QACZ,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,QAAQ,EAAE,IAAI;KACf;IACD,kBAAkB,EAAE;QAClB,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,QAAQ,EAAE,IAAI;KACf;IACD,gBAAgB,EAAE;QAChB,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,QAAQ,EAAE,KAAK;KAChB;CACgD,CAAC;AAEpD;;;;;;;GAOG;AACH,SAAgB,kCAAkC;IAChD,OAAO;QACL,YAAY,EAAE,KAAK;QACnB,kBAAkB,EAAE,KAAK;QACzB,gBAAgB,EAAE,IAAA,SAAM,GAAE;KAC3B,CAAC;AACJ,CAAC;AAND,gFAMC;AAED,oBAAoB;AAEpB,MAAM,yBAAyB,GAAG;IAChC,YAAY;IACZ,UAAU;IACV,WAAW;IACX,OAAO;IACP,QAAQ;IACR,aAAa;IACb,cAAc;IACd,gBAAgB;IAChB,WAAW;IACX,WAAW;IACX,iBAAiB;CACT,CAAC;AA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I,CAAC,KAAK,CAAC,kBAAkB,CAAC;IACvC,CAAC;CACF;AAtND,kDAsNC","sourcesContent":["import type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n StateMetadata,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport {\n v4 as uuidv4,\n validate as uuidValidate,\n version as uuidVersion,\n} from 'uuid';\n\nimport type { AnalyticsControllerMethodActions } from './AnalyticsController-method-action-types';\nimport { projectLogger } from './AnalyticsLogger';\nimport type {\n AnalyticsPlatformAdapter,\n AnalyticsEventProperties,\n AnalyticsUserTraits,\n AnalyticsTrackingEvent,\n} from './AnalyticsPlatformAdapter.types';\nimport { computeEnabledState } from './analyticsStateComputer';\n\n// === GENERAL ===\n\n/**\n * The name of the {@link AnalyticsController}, used to namespace the\n * controller's actions and events and to namespace the controller's state data\n * when composed with other controllers.\n */\nexport const controllerName = 'AnalyticsController';\n\n// === STATE ===\n\n/**\n * Describes the shape of the state object for {@link AnalyticsController}.\n */\nexport type AnalyticsControllerState = {\n /**\n * User domain: Whether the user has opted in to analytics.\n */\n user_optedIn: boolean;\n\n /**\n * User domain: Whether the user has opted in to analytics through social account.\n */\n user_socialOptedIn: boolean;\n\n /**\n * User domain: User's UUIDv4 analytics identifier.\n */\n user_analyticsId: string;\n};\n\n/**\n * The metadata for each property in {@link AnalyticsControllerState}.\n */\nconst analyticsControllerMetadata = {\n user_optedIn: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n user_socialOptedIn: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n user_analyticsId: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: false,\n },\n} satisfies StateMetadata<AnalyticsControllerState>;\n\n/**\n * Constructs the default {@link AnalyticsController} state. This allows\n * consumers to provide a partial state object when initializing the controller\n * and also helps in constructing complete state objects for this controller in\n * tests.\n *\n * @returns The default {@link AnalyticsController} state.\n */\nexport function getDefaultAnalyticsControllerState(): AnalyticsControllerState {\n return {\n user_optedIn: false,\n user_socialOptedIn: false,\n user_analyticsId: uuidv4(),\n };\n}\n\n// === MESSENGER ===\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'trackEvent',\n 'identify',\n 'trackView',\n 'optIn',\n 'optOut',\n 'socialOptIn',\n 'socialOptOut',\n 'getAnalyticsId',\n 'isEnabled',\n 'isOptedIn',\n 'isSocialOptedIn',\n] as const;\n\n/**\n * Returns the state of the {@link AnalyticsController}.\n */\nexport type AnalyticsControllerGetStateAction = ControllerGetStateAction<\n typeof controllerName,\n AnalyticsControllerState\n>;\n\n/**\n * Actions that {@link AnalyticsControllerMessenger} exposes to other consumers.\n */\nexport type AnalyticsControllerActions =\n | AnalyticsControllerGetStateAction\n | AnalyticsControllerMethodActions;\n\n/**\n * Actions from other messengers that {@link AnalyticsControllerMessenger} calls.\n */\ntype AllowedActions = never;\n\n/**\n * Event emitted when the state of the {@link AnalyticsController} changes.\n */\nexport type AnalyticsControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof controllerName,\n AnalyticsControllerState\n>;\n\n/**\n * Events that {@link AnalyticsControllerMessenger} exposes to other consumers.\n */\nexport type AnalyticsControllerEvents = AnalyticsControllerStateChangeEvent;\n\n/**\n * Events from other messengers that {@link AnalyticsControllerMessenger} subscribes to.\n */\ntype AllowedEvents = never;\n\n/**\n * The messenger restricted to actions and events accessed by\n * {@link AnalyticsController}.\n */\nexport type AnalyticsControllerMessenger = Messenger<\n typeof controllerName,\n AnalyticsControllerActions | AllowedActions,\n AnalyticsControllerEvents | AllowedEvents\n>;\n\n// === CONTROLLER DEFINITION ===\n\n/**\n * The options that AnalyticsController takes.\n */\nexport type AnalyticsControllerOptions = {\n state?: Partial<AnalyticsControllerState>;\n messenger: AnalyticsControllerMessenger;\n /**\n * Platform adapter implementation for tracking events\n */\n platformAdapter: AnalyticsPlatformAdapter;\n};\n\n/**\n * The AnalyticsController manages analytics tracking across platforms (Mobile/Extension).\n * It provides a unified interface for tracking events, identifying users, and managing\n * analytics preferences while delegating platform-specific implementation to an\n * {@link AnalyticsPlatformAdapter}.\n *\n * This controller follows the MetaMask controller pattern and integrates with the\n * messenger system to allow other controllers and components to track analytics events.\n * It delegates platform-specific implementation to an {@link AnalyticsPlatformAdapter}.\n */\nexport class AnalyticsController extends BaseController<\n 'AnalyticsController',\n AnalyticsControllerState,\n AnalyticsControllerMessenger\n> {\n readonly #platformAdapter: AnalyticsPlatformAdapter;\n\n /**\n * Constructs an AnalyticsController instance.\n *\n * @param options - Controller options\n * @param options.state - Initial controller state (defaults from getDefaultAnalyticsControllerState).\n * For migration from a previous system, pass the existing analytics ID via state.user_analyticsId.\n * @param options.messenger - Messenger used to communicate with BaseController\n * @param options.platformAdapter - Platform adapter implementation for tracking\n */\n constructor({\n state = {},\n messenger,\n platformAdapter,\n }: AnalyticsControllerOptions) {\n const initialState = {\n ...getDefaultAnalyticsControllerState(),\n ...state,\n };\n\n super({\n name: controllerName,\n metadata: analyticsControllerMetadata,\n state: initialState,\n messenger,\n });\n\n this.#platformAdapter = platformAdapter;\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n\n projectLogger('AnalyticsController initialized and ready', {\n enabled: computeEnabledState(this.state),\n optedIn: this.state.user_optedIn,\n socialOptedIn: this.state.user_socialOptedIn,\n analyticsId: this.state.user_analyticsId,\n });\n\n // Call onSetupCompleted lifecycle hook after initialization\n // Only call if analyticsId is set and is a valid UUIDv4 (this is the definition of \"completed\" setup)\n if (\n this.state.user_analyticsId &&\n uuidValidate(this.state.user_analyticsId) &&\n uuidVersion(this.state.user_analyticsId) === 4\n ) {\n try {\n this.#platformAdapter.onSetupCompleted(this.state.user_analyticsId);\n } catch (error) {\n // Log error but don't throw - adapter setup failure shouldn't break controller\n projectLogger('Error calling platformAdapter.onSetupCompleted', error);\n }\n } else {\n // analyticsId is undefined, null, empty string, or not a valid UUIDv4\n throw new Error(\n `Invalid analyticsId: expected a valid UUIDv4, but got ${JSON.stringify(this.state.user_analyticsId)}`,\n );\n }\n }\n\n /**\n * Track an analytics event.\n *\n * Events are only tracked if analytics is enabled.\n *\n * @param event - Analytics event with properties and sensitive properties\n */\n trackEvent(event: AnalyticsTrackingEvent): void {\n // Don't track if analytics is disabled\n if (!computeEnabledState(this.state)) {\n return;\n }\n\n // if event does not have properties, only send the non-anonymous empty event\n // and return to prevent any additional processing\n if (!event.hasProperties) {\n this.#platformAdapter.track(event.name, {\n anonymous: false,\n } as AnalyticsEventProperties);\n\n return;\n }\n\n // Log all non-anonymous properties, or an empty event if there's no non-anon props.\n this.#platformAdapter.track(event.name, {\n anonymous: false,\n ...event.properties,\n } as AnalyticsEventProperties);\n\n // Track all sensitive properties in an anonymous event\n if (event.isAnonymous) {\n this.#platformAdapter.track(event.name, {\n anonymous: true,\n ...event.properties,\n ...event.sensitiveProperties,\n } as AnalyticsEventProperties);\n }\n }\n\n /**\n * Identify a user for analytics.\n *\n * @param traits - User traits/properties\n */\n identify(traits?: AnalyticsUserTraits): void {\n if (!computeEnabledState(this.state)) {\n return;\n }\n\n // Delegate to platform adapter if supported, using the current analytics ID\n if (this.#platformAdapter.identify) {\n this.#platformAdapter.identify(this.state.user_analyticsId, traits);\n }\n }\n\n /**\n * Track a page view.\n *\n * @param name - The name of the UI item being viewed (pages for web, screen for mobile)\n * @param properties - UI item properties\n */\n trackView(name: string, properties?: AnalyticsEventProperties): void {\n if (!computeEnabledState(this.state)) {\n return;\n }\n\n // Delegate to platform adapter\n this.#platformAdapter.view(name, properties);\n }\n\n /**\n * Opt in to analytics.\n * This updates the user's opt-in status.\n */\n optIn(): void {\n this.update((state) => {\n state.user_optedIn = true;\n });\n }\n\n /**\n * Opt out of analytics.\n * This updates the user's opt-in status.\n */\n optOut(): void {\n this.update((state) => {\n state.user_optedIn = false;\n });\n }\n\n /**\n * Opt in to analytics through social account.\n * This updates the user's social opt-in status.\n */\n socialOptIn(): void {\n this.update((state) => {\n state.user_socialOptedIn = true;\n });\n }\n\n /**\n * Opt out of analytics through social account.\n * This updates the user's social opt-in status.\n */\n socialOptOut(): void {\n this.update((state) => {\n state.user_socialOptedIn = false;\n });\n }\n\n /**\n * Get the analytics ID from the controller state.\n *\n * @returns The current analytics ID.\n */\n getAnalyticsId(): string {\n return this.state.user_analyticsId;\n }\n\n /**\n * Get the enabled status from the controller state.\n * This is computed from user state via the state machine.\n *\n * @returns The current enabled status.\n */\n isEnabled(): boolean {\n return computeEnabledState(this.state);\n }\n\n /**\n * Get the opted in status from the controller state.\n *\n * @returns The current opted in status.\n */\n isOptedIn(): boolean {\n return this.state.user_optedIn;\n }\n\n /**\n * Get the social opted in status from the controller state.\n *\n * @returns The current social opted in status.\n */\n isSocialOptedIn(): boolean {\n return this.state.user_socialOptedIn;\n }\n}\n"]}
1
+ {"version":3,"file":"AnalyticsController.cjs","sourceRoot":"","sources":["../src/AnalyticsController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,+DAA2D;AAE3D,+BAAoC;AAGpC,2DAAkD;AAMlD,kBAAkB;AAElB;;;;GAIG;AACU,QAAA,cAAc,GAAG,qBAAqB,CAAC;AAwBpD;;GAEG;AACH,MAAM,2BAA2B,GAAG;IAClC,OAAO,EAAE;QACP,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,QAAQ,EAAE,IAAI;KACf;IACD,OAAO,EAAE;QACP,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,QAAQ,EAAE,IAAI;KACf;IACD,WAAW,EAAE;QACX,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,QAAQ,EAAE,KAAK;KAChB;CACgD,CAAC;AAEpD;;;;;;;GAOG;AACH,SAAgB,kCAAkC;IA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AE,EAAE;YACpB,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;QACxB,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AA3ID,kDA2IC","sourcesContent":["import type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n StateMetadata,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport { v4 as uuidv4 } from 'uuid';\n\nimport type { AnalyticsControllerMethodActions } from './AnalyticsController-method-action-types';\nimport { projectLogger } from './AnalyticsLogger';\nimport type {\n AnalyticsPlatformAdapter,\n AnalyticsEventProperties,\n} from './AnalyticsPlatformAdapter.types';\n\n// === GENERAL ===\n\n/**\n * The name of the {@link AnalyticsController}, used to namespace the\n * controller's actions and events and to namespace the controller's state data\n * when composed with other controllers.\n */\nexport const controllerName = 'AnalyticsController';\n\n// === STATE ===\n\n/**\n * Describes the shape of the state object for {@link AnalyticsController}.\n */\nexport type AnalyticsControllerState = {\n /**\n * Whether analytics tracking is enabled\n */\n enabled: boolean;\n\n /**\n * Whether the user has opted in to analytics\n */\n optedIn: boolean;\n\n /**\n * User's UUIDv4 analytics identifier\n */\n analyticsId: string;\n};\n\n/**\n * The metadata for each property in {@link AnalyticsControllerState}.\n */\nconst analyticsControllerMetadata = {\n enabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n optedIn: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n analyticsId: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: false,\n },\n} satisfies StateMetadata<AnalyticsControllerState>;\n\n/**\n * Constructs the default {@link AnalyticsController} state. This allows\n * consumers to provide a partial state object when initializing the controller\n * and also helps in constructing complete state objects for this controller in\n * tests.\n *\n * @returns The default {@link AnalyticsController} state.\n */\nexport function getDefaultAnalyticsControllerState(): AnalyticsControllerState {\n return {\n enabled: true,\n optedIn: false,\n analyticsId: uuidv4(),\n };\n}\n\n// === MESSENGER ===\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'trackEvent',\n 'identify',\n 'trackPage',\n 'enable',\n 'disable',\n 'optIn',\n 'optOut',\n] as const;\n\n/**\n * Returns the state of the {@link AnalyticsController}.\n */\nexport type AnalyticsControllerGetStateAction = ControllerGetStateAction<\n typeof controllerName,\n AnalyticsControllerState\n>;\n\n/**\n * Actions that {@link AnalyticsControllerMessenger} exposes to other consumers.\n */\nexport type AnalyticsControllerActions =\n | AnalyticsControllerGetStateAction\n | AnalyticsControllerMethodActions;\n\n/**\n * Actions from other messengers that {@link AnalyticsControllerMessenger} calls.\n */\ntype AllowedActions = never;\n\n/**\n * Event emitted when the state of the {@link AnalyticsController} changes.\n */\nexport type AnalyticsControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof controllerName,\n AnalyticsControllerState\n>;\n\n/**\n * Events that {@link AnalyticsControllerMessenger} exposes to other consumers.\n */\nexport type AnalyticsControllerEvents = AnalyticsControllerStateChangeEvent;\n\n/**\n * Events from other messengers that {@link AnalyticsControllerMessenger} subscribes to.\n */\ntype AllowedEvents = never;\n\n/**\n * The messenger restricted to actions and events accessed by\n * {@link AnalyticsController}.\n */\nexport type AnalyticsControllerMessenger = Messenger<\n typeof controllerName,\n AnalyticsControllerActions | AllowedActions,\n AnalyticsControllerEvents | AllowedEvents\n>;\n\n// === CONTROLLER DEFINITION ===\n\n/**\n * The options that AnalyticsController takes.\n */\nexport type AnalyticsControllerOptions = {\n state?: Partial<AnalyticsControllerState>;\n messenger: AnalyticsControllerMessenger;\n /**\n * Platform adapter implementation for tracking events\n */\n platformAdapter: AnalyticsPlatformAdapter;\n};\n\n/**\n * The AnalyticsController manages analytics tracking across platforms (Mobile/Extension).\n * It provides a unified interface for tracking events, identifying users, and managing\n * analytics preferences while delegating platform-specific implementation to an\n * {@link AnalyticsPlatformAdapter}.\n *\n * This controller follows the MetaMask controller pattern and integrates with the\n * messenger system to allow other controllers and components to track analytics events.\n * It delegates platform-specific implementation to an {@link AnalyticsPlatformAdapter}.\n */\nexport class AnalyticsController extends BaseController<\n 'AnalyticsController',\n AnalyticsControllerState,\n AnalyticsControllerMessenger\n> {\n readonly #platformAdapter: AnalyticsPlatformAdapter;\n\n /**\n * Constructs an AnalyticsController instance.\n *\n * @param options - Controller options\n * @param options.state - Initial controller state (defaults from getDefaultAnalyticsControllerState)\n * @param options.messenger - Messenger used to communicate with BaseController\n * @param options.platformAdapter - Platform adapter implementation for tracking\n */\n constructor({\n state = {},\n messenger,\n platformAdapter,\n }: AnalyticsControllerOptions) {\n super({\n name: controllerName,\n metadata: analyticsControllerMetadata,\n state: {\n ...getDefaultAnalyticsControllerState(),\n ...state,\n },\n messenger,\n });\n\n this.#platformAdapter = platformAdapter;\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n\n projectLogger('AnalyticsController initialized and ready', {\n enabled: this.state.enabled,\n optedIn: this.state.optedIn,\n analyticsId: this.state.analyticsId,\n });\n }\n\n /**\n * Track an analytics event.\n *\n * Events are only tracked if analytics is enabled.\n *\n * @param eventName - The name of the event\n * @param properties - Event properties\n */\n trackEvent(\n eventName: string,\n properties: AnalyticsEventProperties = {},\n ): void {\n // Don't track if analytics is disabled\n if (!this.state.enabled) {\n return;\n }\n\n // Delegate to platform adapter\n this.#platformAdapter.trackEvent(eventName, properties);\n }\n\n /**\n * Identify a user for analytics.\n *\n * @param userId - The user identifier (e.g., metametrics ID)\n * @param traits - User traits/properties\n */\n identify(userId: string, traits?: AnalyticsEventProperties): void {\n if (!this.state.enabled) {\n return;\n }\n\n // Update state with analytics ID\n this.update((state) => {\n state.analyticsId = userId;\n });\n\n // Delegate to platform adapter if supported\n if (this.#platformAdapter.identify) {\n this.#platformAdapter.identify(userId, traits);\n }\n }\n\n /**\n * Track a page view.\n *\n * @param pageName - The name of the page\n * @param properties - Page properties\n */\n trackPage(pageName: string, properties?: AnalyticsEventProperties): void {\n if (!this.state.enabled) {\n return;\n }\n\n // Delegate to platform adapter if supported\n if (this.#platformAdapter.trackPage) {\n this.#platformAdapter.trackPage(pageName, properties);\n }\n }\n\n /**\n * Enable analytics tracking.\n */\n enable(): void {\n this.update((state) => {\n state.enabled = true;\n });\n }\n\n /**\n * Disable analytics tracking.\n */\n disable(): void {\n this.update((state) => {\n state.enabled = false;\n });\n }\n\n /**\n * Opt in to analytics.\n */\n optIn(): void {\n this.update((state) => {\n state.optedIn = true;\n });\n }\n\n /**\n * Opt out of analytics.\n */\n optOut(): void {\n this.update((state) => {\n state.optedIn = false;\n });\n }\n}\n"]}
@@ -2,7 +2,7 @@ import type { ControllerGetStateAction, ControllerStateChangeEvent } from "@meta
2
2
  import { BaseController } from "@metamask/base-controller";
3
3
  import type { Messenger } from "@metamask/messenger";
4
4
  import type { AnalyticsControllerMethodActions } from "./AnalyticsController-method-action-types.cjs";
5
- import type { AnalyticsPlatformAdapter, AnalyticsEventProperties, AnalyticsUserTraits, AnalyticsTrackingEvent } from "./AnalyticsPlatformAdapter.types.cjs";
5
+ import type { AnalyticsPlatformAdapter, AnalyticsEventProperties } from "./AnalyticsPlatformAdapter.types.cjs";
6
6
  /**
7
7
  * The name of the {@link AnalyticsController}, used to namespace the
8
8
  * controller's actions and events and to namespace the controller's state data
@@ -14,17 +14,17 @@ export declare const controllerName = "AnalyticsController";
14
14
  */
15
15
  export type AnalyticsControllerState = {
16
16
  /**
17
- * User domain: Whether the user has opted in to analytics.
17
+ * Whether analytics tracking is enabled
18
18
  */
19
- user_optedIn: boolean;
19
+ enabled: boolean;
20
20
  /**
21
- * User domain: Whether the user has opted in to analytics through social account.
21
+ * Whether the user has opted in to analytics
22
22
  */
23
- user_socialOptedIn: boolean;
23
+ optedIn: boolean;
24
24
  /**
25
- * User domain: User's UUIDv4 analytics identifier.
25
+ * User's UUIDv4 analytics identifier
26
26
  */
27
- user_analyticsId: string;
27
+ analyticsId: string;
28
28
  };
29
29
  /**
30
30
  * Constructs the default {@link AnalyticsController} state. This allows
@@ -91,8 +91,7 @@ export declare class AnalyticsController extends BaseController<'AnalyticsContro
91
91
  * Constructs an AnalyticsController instance.
92
92
  *
93
93
  * @param options - Controller options
94
- * @param options.state - Initial controller state (defaults from getDefaultAnalyticsControllerState).
95
- * For migration from a previous system, pass the existing analytics ID via state.user_analyticsId.
94
+ * @param options.state - Initial controller state (defaults from getDefaultAnalyticsControllerState)
96
95
  * @param options.messenger - Messenger used to communicate with BaseController
97
96
  * @param options.platformAdapter - Platform adapter implementation for tracking
98
97
  */
@@ -102,67 +101,40 @@ export declare class AnalyticsController extends BaseController<'AnalyticsContro
102
101
  *
103
102
  * Events are only tracked if analytics is enabled.
104
103
  *
105
- * @param event - Analytics event with properties and sensitive properties
104
+ * @param eventName - The name of the event
105
+ * @param properties - Event properties
106
106
  */
107
- trackEvent(event: AnalyticsTrackingEvent): void;
107
+ trackEvent(eventName: string, properties?: AnalyticsEventProperties): void;
108
108
  /**
109
109
  * Identify a user for analytics.
110
110
  *
111
+ * @param userId - The user identifier (e.g., metametrics ID)
111
112
  * @param traits - User traits/properties
112
113
  */
113
- identify(traits?: AnalyticsUserTraits): void;
114
+ identify(userId: string, traits?: AnalyticsEventProperties): void;
114
115
  /**
115
116
  * Track a page view.
116
117
  *
117
- * @param name - The name of the UI item being viewed (pages for web, screen for mobile)
118
- * @param properties - UI item properties
118
+ * @param pageName - The name of the page
119
+ * @param properties - Page properties
119
120
  */
120
- trackView(name: string, properties?: AnalyticsEventProperties): void;
121
+ trackPage(pageName: string, properties?: AnalyticsEventProperties): void;
121
122
  /**
122
- * Opt in to analytics.
123
- * This updates the user's opt-in status.
124
- */
125
- optIn(): void;
126
- /**
127
- * Opt out of analytics.
128
- * This updates the user's opt-in status.
129
- */
130
- optOut(): void;
131
- /**
132
- * Opt in to analytics through social account.
133
- * This updates the user's social opt-in status.
134
- */
135
- socialOptIn(): void;
136
- /**
137
- * Opt out of analytics through social account.
138
- * This updates the user's social opt-in status.
123
+ * Enable analytics tracking.
139
124
  */
140
- socialOptOut(): void;
125
+ enable(): void;
141
126
  /**
142
- * Get the analytics ID from the controller state.
143
- *
144
- * @returns The current analytics ID.
127
+ * Disable analytics tracking.
145
128
  */
146
- getAnalyticsId(): string;
129
+ disable(): void;
147
130
  /**
148
- * Get the enabled status from the controller state.
149
- * This is computed from user state via the state machine.
150
- *
151
- * @returns The current enabled status.
152
- */
153
- isEnabled(): boolean;
154
- /**
155
- * Get the opted in status from the controller state.
156
- *
157
- * @returns The current opted in status.
131
+ * Opt in to analytics.
158
132
  */
159
- isOptedIn(): boolean;
133
+ optIn(): void;
160
134
  /**
161
- * Get the social opted in status from the controller state.
162
- *
163
- * @returns The current social opted in status.
135
+ * Opt out of analytics.
164
136
  */
165
- isSocialOptedIn(): boolean;
137
+ optOut(): void;
166
138
  }
167
139
  export {};
168
140
  //# sourceMappingURL=AnalyticsController.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsController.d.cts","sourceRoot":"","sources":["../src/AnalyticsController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AAOrD,OAAO,KAAK,EAAE,gCAAgC,EAAE,sDAAkD;AAElG,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,sBAAsB,EACvB,6CAAyC;AAK1C;;;;GAIG;AACH,eAAO,MAAM,cAAc,wBAAwB,CAAC;AAIpD;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,kBAAkB,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AA0BF;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,IAAI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wB,CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,mCAAmC,CAAC;AAE5E;;GAEG;AACH,KAAK,aAAa,GAAG,KAAK,CAAC;AAE3B;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG,SAAS,CAClD,OAAO,cAAc,EACrB,0BAA0B,GAAG,cAAc,EAC3C,yBAAyB,GAAG,aAAa,CAC1C,CAAC;AAIF;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,CAAC,EAAE,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAC1C,SAAS,EAAE,4BAA4B,CAAC;IACxC;;OAEG;IACH,eAAe,EAAE,wBAAwB,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;GASG;AACH,qBAAa,mBAAoB,SAAQ,cAAc,CACrD,qBAAqB,EACrB,wBAAwB,EACxB,4BAA4B,CAC7B;;IAGC;;;;;;;OAOG;gBACS,EACV,KAAU,EACV,SAAS,EACT,eAAe,GAChB,EAAE,0BAA0B;IAyB7B;;;;;;;OAOG;IACH,UAAU,CACR,SAAS,EAAE,MAAM,EACjB,UAAU,GAAE,wBAA6B,GACxC,IAAI;IAUP;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,wBAAwB,GAAG,IAAI;IAgBjE;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,wBAAwB,GAAG,IAAI;IAWxE;;OAEG;IACH,MAAM,IAAI,IAAI;IAMd;;OAEG;IACH,OAAO,IAAI,IAAI;IAMf;;OAEG;IACH,KAAK,IAAI,IAAI;IAMb;;OAEG;IACH,MAAM,IAAI,IAAI;CAKf"}
@@ -2,7 +2,7 @@ import type { ControllerGetStateAction, ControllerStateChangeEvent } from "@meta
2
2
  import { BaseController } from "@metamask/base-controller";
3
3
  import type { Messenger } from "@metamask/messenger";
4
4
  import type { AnalyticsControllerMethodActions } from "./AnalyticsController-method-action-types.mjs";
5
- import type { AnalyticsPlatformAdapter, AnalyticsEventProperties, AnalyticsUserTraits, AnalyticsTrackingEvent } from "./AnalyticsPlatformAdapter.types.mjs";
5
+ import type { AnalyticsPlatformAdapter, AnalyticsEventProperties } from "./AnalyticsPlatformAdapter.types.mjs";
6
6
  /**
7
7
  * The name of the {@link AnalyticsController}, used to namespace the
8
8
  * controller's actions and events and to namespace the controller's state data
@@ -14,17 +14,17 @@ export declare const controllerName = "AnalyticsController";
14
14
  */
15
15
  export type AnalyticsControllerState = {
16
16
  /**
17
- * User domain: Whether the user has opted in to analytics.
17
+ * Whether analytics tracking is enabled
18
18
  */
19
- user_optedIn: boolean;
19
+ enabled: boolean;
20
20
  /**
21
- * User domain: Whether the user has opted in to analytics through social account.
21
+ * Whether the user has opted in to analytics
22
22
  */
23
- user_socialOptedIn: boolean;
23
+ optedIn: boolean;
24
24
  /**
25
- * User domain: User's UUIDv4 analytics identifier.
25
+ * User's UUIDv4 analytics identifier
26
26
  */
27
- user_analyticsId: string;
27
+ analyticsId: string;
28
28
  };
29
29
  /**
30
30
  * Constructs the default {@link AnalyticsController} state. This allows
@@ -91,8 +91,7 @@ export declare class AnalyticsController extends BaseController<'AnalyticsContro
91
91
  * Constructs an AnalyticsController instance.
92
92
  *
93
93
  * @param options - Controller options
94
- * @param options.state - Initial controller state (defaults from getDefaultAnalyticsControllerState).
95
- * For migration from a previous system, pass the existing analytics ID via state.user_analyticsId.
94
+ * @param options.state - Initial controller state (defaults from getDefaultAnalyticsControllerState)
96
95
  * @param options.messenger - Messenger used to communicate with BaseController
97
96
  * @param options.platformAdapter - Platform adapter implementation for tracking
98
97
  */
@@ -102,67 +101,40 @@ export declare class AnalyticsController extends BaseController<'AnalyticsContro
102
101
  *
103
102
  * Events are only tracked if analytics is enabled.
104
103
  *
105
- * @param event - Analytics event with properties and sensitive properties
104
+ * @param eventName - The name of the event
105
+ * @param properties - Event properties
106
106
  */
107
- trackEvent(event: AnalyticsTrackingEvent): void;
107
+ trackEvent(eventName: string, properties?: AnalyticsEventProperties): void;
108
108
  /**
109
109
  * Identify a user for analytics.
110
110
  *
111
+ * @param userId - The user identifier (e.g., metametrics ID)
111
112
  * @param traits - User traits/properties
112
113
  */
113
- identify(traits?: AnalyticsUserTraits): void;
114
+ identify(userId: string, traits?: AnalyticsEventProperties): void;
114
115
  /**
115
116
  * Track a page view.
116
117
  *
117
- * @param name - The name of the UI item being viewed (pages for web, screen for mobile)
118
- * @param properties - UI item properties
118
+ * @param pageName - The name of the page
119
+ * @param properties - Page properties
119
120
  */
120
- trackView(name: string, properties?: AnalyticsEventProperties): void;
121
+ trackPage(pageName: string, properties?: AnalyticsEventProperties): void;
121
122
  /**
122
- * Opt in to analytics.
123
- * This updates the user's opt-in status.
124
- */
125
- optIn(): void;
126
- /**
127
- * Opt out of analytics.
128
- * This updates the user's opt-in status.
129
- */
130
- optOut(): void;
131
- /**
132
- * Opt in to analytics through social account.
133
- * This updates the user's social opt-in status.
134
- */
135
- socialOptIn(): void;
136
- /**
137
- * Opt out of analytics through social account.
138
- * This updates the user's social opt-in status.
123
+ * Enable analytics tracking.
139
124
  */
140
- socialOptOut(): void;
125
+ enable(): void;
141
126
  /**
142
- * Get the analytics ID from the controller state.
143
- *
144
- * @returns The current analytics ID.
127
+ * Disable analytics tracking.
145
128
  */
146
- getAnalyticsId(): string;
129
+ disable(): void;
147
130
  /**
148
- * Get the enabled status from the controller state.
149
- * This is computed from user state via the state machine.
150
- *
151
- * @returns The current enabled status.
152
- */
153
- isEnabled(): boolean;
154
- /**
155
- * Get the opted in status from the controller state.
156
- *
157
- * @returns The current opted in status.
131
+ * Opt in to analytics.
158
132
  */
159
- isOptedIn(): boolean;
133
+ optIn(): void;
160
134
  /**
161
- * Get the social opted in status from the controller state.
162
- *
163
- * @returns The current social opted in status.
135
+ * Opt out of analytics.
164
136
  */
165
- isSocialOptedIn(): boolean;
137
+ optOut(): void;
166
138
  }
167
139
  export {};
168
140
  //# sourceMappingURL=AnalyticsController.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsController.d.mts","sourceRoot":"","sources":["../src/AnalyticsController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AAOrD,OAAO,KAAK,EAAE,gCAAgC,EAAE,sDAAkD;AAElG,OAAO,KAAK,EACV,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,sBAAsB,EACvB,6CAAyC;AAK1C;;;;GAIG;AACH,eAAO,MAAM,cAAc,wBAAwB,CAAC;AAIpD;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG;IACrC;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,kBAAkB,EAAE,OAAO,CAAC;IAE5B;;OAEG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AA0BF;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,IAAI,wBAAwB,CAM7E;AAkBD;;GAEG;AACH,MAAM,MAAM,iCAAiC,GAAG,wBAAwB,CACtE,OAAO,cAAc,EACrB,wBAAwB,CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,0BAA0B,GAClC,iCAAiC,GACjC,gCAAgC,CAAC;AAErC;;GAEG;AACH,KAAK,cAAc,GAAG,KAAK,CAAC;AAE5B;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAAG,0BAA0B,CAC1E,OAAO,cAAc,EACrB,wBAAwB,CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,yBAAyB,GAAG,mCAAmC,CAAC;AAE5E;;GAEG;AACH,KAAK,aAAa,GAAG,KAAK,CAAC;AAE3B;;;GAGG;AACH,MAAM,MAAM,4BAA4B,GAAG,SAAS,CAClD,OAAO,cAAc,EACrB,0BAA0B,GAA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