@metamask-previews/analytics-controller 2.1.0-preview-abca9bcea → 3.0.0-preview-0a30e47

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 (97) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/dist/{AnalyticsController-method-action-types.d.mts → AnalyticsController-method-action-types.d.ts} +2 -2
  3. package/dist/AnalyticsController-method-action-types.d.ts.map +1 -0
  4. package/dist/{AnalyticsController-method-action-types.mjs → AnalyticsController-method-action-types.js} +1 -1
  5. package/dist/AnalyticsController-method-action-types.js.map +1 -0
  6. package/dist/{AnalyticsController.d.cts → AnalyticsController.d.ts} +9 -9
  7. package/dist/AnalyticsController.d.ts.map +1 -0
  8. package/dist/AnalyticsController.js +1193 -0
  9. package/dist/AnalyticsController.js.map +1 -0
  10. package/dist/AnalyticsLogger.d.ts +4 -0
  11. package/dist/AnalyticsLogger.d.ts.map +1 -0
  12. package/dist/{AnalyticsLogger.mjs → AnalyticsLogger.js} +2 -2
  13. package/dist/AnalyticsLogger.js.map +1 -0
  14. package/dist/{AnalyticsPlatformAdapter.types.d.mts → AnalyticsPlatformAdapter.types.d.ts} +2 -2
  15. package/dist/AnalyticsPlatformAdapter.types.d.ts.map +1 -0
  16. package/dist/AnalyticsPlatformAdapter.types.js +2 -0
  17. package/dist/AnalyticsPlatformAdapter.types.js.map +1 -0
  18. package/dist/{AnalyticsPlatformAdapterSetupError.d.cts → AnalyticsPlatformAdapterSetupError.d.ts} +1 -1
  19. package/dist/AnalyticsPlatformAdapterSetupError.d.ts.map +1 -0
  20. package/dist/{AnalyticsPlatformAdapterSetupError.mjs → AnalyticsPlatformAdapterSetupError.js} +2 -1
  21. package/dist/AnalyticsPlatformAdapterSetupError.js.map +1 -0
  22. package/dist/{EventFragment.types.d.cts → EventFragment.types.d.ts} +2 -2
  23. package/dist/EventFragment.types.d.ts.map +1 -0
  24. package/dist/EventFragment.types.js +2 -0
  25. package/dist/EventFragment.types.js.map +1 -0
  26. package/dist/{analyticsControllerStateValidator.d.mts → analyticsControllerStateValidator.d.ts} +2 -2
  27. package/dist/analyticsControllerStateValidator.d.ts.map +1 -0
  28. package/dist/{analyticsControllerStateValidator.mjs → analyticsControllerStateValidator.js} +1 -1
  29. package/dist/analyticsControllerStateValidator.js.map +1 -0
  30. package/dist/{index.d.cts → index.d.ts} +11 -11
  31. package/dist/index.d.ts.map +1 -0
  32. package/dist/index.js +7 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/{selectors.cjs → selectors.d.ts} +17 -18
  35. package/dist/selectors.d.ts.map +1 -0
  36. package/dist/{selectors.mjs → selectors.js} +1 -1
  37. package/dist/selectors.js.map +1 -0
  38. package/package.json +18 -22
  39. package/dist/AnalyticsController-method-action-types.cjs +0 -7
  40. package/dist/AnalyticsController-method-action-types.cjs.map +0 -1
  41. package/dist/AnalyticsController-method-action-types.d.cts +0 -185
  42. package/dist/AnalyticsController-method-action-types.d.cts.map +0 -1
  43. package/dist/AnalyticsController-method-action-types.d.mts.map +0 -1
  44. package/dist/AnalyticsController-method-action-types.mjs.map +0 -1
  45. package/dist/AnalyticsController.cjs +0 -991
  46. package/dist/AnalyticsController.cjs.map +0 -1
  47. package/dist/AnalyticsController.d.cts.map +0 -1
  48. package/dist/AnalyticsController.d.mts +0 -431
  49. package/dist/AnalyticsController.d.mts.map +0 -1
  50. package/dist/AnalyticsController.mjs +0 -987
  51. package/dist/AnalyticsController.mjs.map +0 -1
  52. package/dist/AnalyticsLogger.cjs +0 -8
  53. package/dist/AnalyticsLogger.cjs.map +0 -1
  54. package/dist/AnalyticsLogger.d.cts +0 -5
  55. package/dist/AnalyticsLogger.d.cts.map +0 -1
  56. package/dist/AnalyticsLogger.d.mts +0 -5
  57. package/dist/AnalyticsLogger.d.mts.map +0 -1
  58. package/dist/AnalyticsLogger.mjs.map +0 -1
  59. package/dist/AnalyticsPlatformAdapter.types.cjs +0 -3
  60. package/dist/AnalyticsPlatformAdapter.types.cjs.map +0 -1
  61. package/dist/AnalyticsPlatformAdapter.types.d.cts +0 -144
  62. package/dist/AnalyticsPlatformAdapter.types.d.cts.map +0 -1
  63. package/dist/AnalyticsPlatformAdapter.types.d.mts.map +0 -1
  64. package/dist/AnalyticsPlatformAdapter.types.mjs +0 -2
  65. package/dist/AnalyticsPlatformAdapter.types.mjs.map +0 -1
  66. package/dist/AnalyticsPlatformAdapterSetupError.cjs +0 -17
  67. package/dist/AnalyticsPlatformAdapterSetupError.cjs.map +0 -1
  68. package/dist/AnalyticsPlatformAdapterSetupError.d.cts.map +0 -1
  69. package/dist/AnalyticsPlatformAdapterSetupError.d.mts +0 -8
  70. package/dist/AnalyticsPlatformAdapterSetupError.d.mts.map +0 -1
  71. package/dist/AnalyticsPlatformAdapterSetupError.mjs.map +0 -1
  72. package/dist/EventFragment.types.cjs +0 -3
  73. package/dist/EventFragment.types.cjs.map +0 -1
  74. package/dist/EventFragment.types.d.cts.map +0 -1
  75. package/dist/EventFragment.types.d.mts +0 -111
  76. package/dist/EventFragment.types.d.mts.map +0 -1
  77. package/dist/EventFragment.types.mjs +0 -2
  78. package/dist/EventFragment.types.mjs.map +0 -1
  79. package/dist/analyticsControllerStateValidator.cjs +0 -36
  80. package/dist/analyticsControllerStateValidator.cjs.map +0 -1
  81. package/dist/analyticsControllerStateValidator.d.cts +0 -17
  82. package/dist/analyticsControllerStateValidator.d.cts.map +0 -1
  83. package/dist/analyticsControllerStateValidator.d.mts.map +0 -1
  84. package/dist/analyticsControllerStateValidator.mjs.map +0 -1
  85. package/dist/index.cjs +0 -15
  86. package/dist/index.cjs.map +0 -1
  87. package/dist/index.d.cts.map +0 -1
  88. package/dist/index.d.mts +0 -11
  89. package/dist/index.d.mts.map +0 -1
  90. package/dist/index.mjs +0 -7
  91. package/dist/index.mjs.map +0 -1
  92. package/dist/selectors.cjs.map +0 -1
  93. package/dist/selectors.d.cts +0 -15
  94. package/dist/selectors.d.cts.map +0 -1
  95. package/dist/selectors.d.mts +0 -15
  96. package/dist/selectors.d.mts.map +0 -1
  97. package/dist/selectors.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnalyticsController.cjs","sourceRoot":"","sources":["../src/AnalyticsController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAKA,+DAA2D;AAO3D,mCAAmC;AACnC,+BAAkC;AAGlC,kGAA0F;AAC1F,8DAA4D;AAkB5D,kDAA8D;AAE9D,kBAAkB;AAElB;;;;GAIG;AACU,QAAA,cAAc,GAAG,qBAAqB,CAAC;AAEpD;;;;;;;;GAQG;AACU,QAAA,sBAAsB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AA+H1D;;;;;;;GAOG;AACH,SAAgB,kCAAkC;IAIhD,OAAO;QACL,OAAO,EAAE,KAAK;QACd,mBAAmB,EAAE,KAAK;KAC3B,CAAC;AACJ,CAAC;AARD,gFAQC;AAED;;;;;GAKG;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,WAAW,EAAE;QACX,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,QAAQ,EAAE,KAAK;KAChB;IACD,UAAU,EAAE;QACV,kBAAkB,EAAE,KAAK;QACzB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,KAAK;QAC7B,QAAQ,EAAE,KAAK;KAChB;IACD,mBAAmB,EAAE;QACnB,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,QAAQ,EAAE,IAAI;KACf;IACD,oBAAoB,EAAE;QACpB,kBAAkB,EAAE,KAAK;QACzB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,KAAK;QAC7B,QAAQ,EAAE,KAAK;KAChB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CAAC;AACL,CAAC,mHAc8B,MAAc;IAC3C,IAAI,CAAC,uBAAA,IAAI,oDAAyB,EAAE,CAAC;QACnC,IAAA,kCAAG,EACD,8EAA8E,EAC9E,EAAE,MAAM,EAAE,CACX,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,uBAAA,IAAI,sFAA2B,MAA/B,IAAI,CAA6B,EAAE,CAAC;QACvC,IAAA,kCAAG,EACD,2FAA2F,EAC3F,EAAE,MAAM,EAAE,CACX,CAAC;QAEF,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,2FAcC,QAAgC,EAChC,IAAY,EACZ,OAAqC;IAErC,MAAM,UAAU,GAAG,EAAE,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC;IAC9C,MAAM,mBAAmB,GAAG,EAAE,GAAG,QAAQ,CAAC,mBAAmB,EAAE,CAAC;IAEhE,IAAI,CAAC,UAAU,CACb;QACE,IAAI;QACJ,UAAU;QACV,mBAAmB;QACnB,iBAAiB,EAAE,KAAK;QACxB,aAAa,EACX,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC;YAClC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,MAAM,GAAG,CAAC;KAC9C,EACD,OAAO,CACR,CAAC;AACJ,CAAC;IAeC,IAAI,2CAA4B,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,uBAAA,IAAI,qDAA0B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC;AAC3E,CAAC","sourcesContent":["import type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n StateMetadata,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport type {\n GeolocationControllerGetGeolocationDataAction,\n GeolocationData,\n} from '@metamask/geolocation-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type { Json } from '@metamask/utils';\nimport { cloneDeep } from 'lodash';\nimport { v4 as uuid } from 'uuid';\n\nimport type { AnalyticsControllerMethodActions } from './AnalyticsController-method-action-types.js';\nimport { validateAnalyticsControllerState } from './analyticsControllerStateValidator.js';\nimport { projectLogger as log } from './AnalyticsLogger.js';\nimport type {\n AnalyticsPlatformAdapter,\n AnalyticsDeliveryOptions,\n AnalyticsContext,\n AnalyticsEventProperties,\n AnalyticsLocationContext,\n AnalyticsUserTraits,\n AnalyticsTrackingEvent,\n} from './AnalyticsPlatformAdapter.types';\nimport type {\n AnalyticsEventFragment,\n AnalyticsEventFragmentFinalizeOptions,\n AnalyticsEventFragmentOptions,\n AnalyticsEventFragmentPayload,\n AnalyticsEventFragments,\n ReadonlyAnalyticsEventFragment,\n} from './EventFragment.types.js';\nimport { analyticsControllerSelectors } from './selectors.js';\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/**\n * Maximum age of a persisted event fragment, measured from\n * {@link AnalyticsEventFragment.lastUpdated}.\n *\n * Fragments older than this are discarded during {@link AnalyticsController.init}\n * without emitting a success or failure event. Confirmation journeys that span a\n * restart are expected to resume within this window; abandoned ones must not keep\n * `properties` or `sensitiveProperties` in storage indefinitely.\n */\nexport const EVENT_FRAGMENT_MAX_AGE = 24 * 60 * 60 * 1000;\n\n// === STATE ===\n\n/**\n * Describes the shape of the state object for {@link AnalyticsController}.\n */\nexport type AnalyticsControllerState = {\n /**\n * Whether the user has opted in to analytics.\n */\n optedIn: boolean;\n\n /**\n * User's UUIDv4 analytics identifier.\n * This is an identity (unique per user), not a preference.\n * Must be provided by the platform - the controller does not generate it.\n */\n analyticsId: string;\n\n /**\n * Persisted queue of analytics events waiting for delivery acknowledgement.\n * This is only used when event queue persistence is enabled.\n */\n eventQueue?: Record<string, Json>;\n\n /**\n * Whether the user has made a consent decision (opted in or opted out).\n *\n * This distinguishes the \"undecided\" state (e.g. during onboarding, before\n * the user has answered the analytics prompt) from an explicit opt-out.\n * Defaults to `false` and is set to `true` by {@link AnalyticsController.optIn}\n * or {@link AnalyticsController.optOut}, and back to `false` by\n * {@link AnalyticsController.resetConsentDecision}. Optional for backward\n * compatibility with persisted state that predates this field.\n */\n consentDecisionMade?: boolean;\n\n /**\n * Persisted queue of track events ({@link AnalyticsQueuedTrackEvent}) captured\n * while the user is undecided (no consent decision made yet). Replayed on\n * opt-in and cleared on opt-out.\n * Preserved across {@link AnalyticsController.resetConsentDecision} so onboarding\n * restarts do not drop install-time events.\n * This is only used when the pre-consent queue is enabled.\n */\n preConsentEventQueue?: Record<string, Json>;\n\n /**\n * Persisted event fragments ({@link AnalyticsEventFragment}) keyed by\n * fragment ID. Fragments accumulate properties across a user journey and are\n * removed when the journey is finalized or deleted. Fragments that set\n * `persist: true` can survive {@link AnalyticsController.init}, but only\n * while younger than {@link EVENT_FRAGMENT_MAX_AGE}.\n * This is only used when the event fragments feature is enabled.\n */\n eventFragments?: AnalyticsEventFragments;\n};\n\n/**\n * Event types supported by the persisted analytics event queue.\n */\nexport type AnalyticsQueuedEventType = 'track' | 'identify' | 'view';\n\n/**\n * Base persisted event queue entry.\n */\nexport type AnalyticsQueuedEventBase = {\n /**\n * Event type used to replay the payload with the platform adapter.\n */\n type: AnalyticsQueuedEventType;\n\n /**\n * Stable identifier for the analytics payload.\n */\n messageId: string;\n\n /**\n * Original payload timestamp serialized for persistence.\n */\n timestamp: string;\n};\n\n/**\n * Persisted track event queue entry.\n */\nexport type AnalyticsQueuedTrackEvent = AnalyticsQueuedEventBase & {\n type: 'track';\n eventName: string;\n properties?: AnalyticsEventProperties;\n context?: AnalyticsContext;\n};\n\n/**\n * Persisted identify event queue entry.\n */\nexport type AnalyticsQueuedIdentifyEvent = AnalyticsQueuedEventBase & {\n type: 'identify';\n userId: string;\n traits?: AnalyticsUserTraits;\n context?: AnalyticsContext;\n};\n\n/**\n * Persisted view event queue entry.\n */\nexport type AnalyticsQueuedViewEvent = AnalyticsQueuedEventBase & {\n type: 'view';\n name: string;\n properties?: AnalyticsEventProperties;\n context?: AnalyticsContext;\n};\n\n/**\n * Persisted analytics event queue entry.\n */\nexport type AnalyticsQueuedEvent =\n | AnalyticsQueuedTrackEvent\n | AnalyticsQueuedIdentifyEvent\n | AnalyticsQueuedViewEvent;\n\n/**\n * Persisted analytics event queue keyed by message ID.\n */\nexport type AnalyticsEventQueue = Record<string, AnalyticsQueuedEvent>;\n\n/**\n * Returns default values for AnalyticsController state.\n *\n * Note: analyticsId is NOT included - it's an identity that must be\n * provided by the platform (generated once on first run, then persisted).\n *\n * @returns Default state without analyticsId\n */\nexport function getDefaultAnalyticsControllerState(): Omit<\n AnalyticsControllerState,\n 'analyticsId'\n> {\n return {\n optedIn: false,\n consentDecisionMade: false,\n };\n}\n\n/**\n * The metadata for each property in {@link AnalyticsControllerState}.\n *\n * Both `optedIn` and `analyticsId` are persisted (`persist: true`).\n * The platform must supply a valid UUIDv4 `analyticsId` on first run.\n */\nconst analyticsControllerMetadata = {\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 eventQueue: {\n includeInStateLogs: false,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: false,\n },\n consentDecisionMade: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n preConsentEventQueue: {\n includeInStateLogs: false,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: false,\n },\n eventFragments: {\n includeInStateLogs: false,\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: false,\n },\n} satisfies StateMetadata<AnalyticsControllerState>;\n\n// === MESSENGER ===\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'trackEvent',\n 'identify',\n 'trackView',\n 'optIn',\n 'optOut',\n 'resetConsentDecision',\n 'createEventFragment',\n 'upsertEventFragment',\n 'updateEventFragment',\n 'getEventFragmentById',\n 'deleteEventFragment',\n 'finalizeEventFragment',\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 = GeolocationControllerGetGeolocationDataAction;\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 /**\n * Initial controller state. Must include a valid UUIDv4 `analyticsId`.\n * The platform is responsible for generating the ID on first run.\n * It is then persisted with controller state when using a persisted store.\n */\n state: AnalyticsControllerState;\n /**\n * Messenger used to communicate with BaseController and other controllers.\n */\n messenger: AnalyticsControllerMessenger;\n /**\n * Platform adapter implementation for tracking events.\n */\n platformAdapter: AnalyticsPlatformAdapter;\n\n /**\n * Whether the anonymous events feature is enabled.\n *\n * @default false\n */\n isAnonymousEventsFeatureEnabled?: boolean;\n\n /**\n * Whether analytics event queue persistence is enabled.\n *\n * When enabled, AnalyticsController persists each platform adapter payload\n * until the adapter reports successful delivery.\n *\n * @default false\n */\n isEventQueuePersistenceEnabled?: boolean;\n\n /**\n * Whether the pre-consent event queue is enabled.\n *\n * When enabled, track events received while the user is undecided\n * (no consent decision made yet) are persisted and replayed on opt-in,\n * or dropped on opt-out. When disabled, such events are dropped immediately,\n * preserving the legacy behavior.\n *\n * @default false\n */\n isPreConsentQueueEnabled?: boolean;\n\n /**\n * Whether geolocation enrichment is enabled.\n *\n * When enabled, {@link AnalyticsController.init} resolves the user's\n * country, region, and timezone via `GeolocationController:getGeolocationData`\n * and attaches them to `context.location` on non-anonymous payloads.\n * Compositions must register that action when this is enabled. When disabled,\n * the controller never calls the geolocation action and events are delivered\n * without location.\n *\n * @default false\n */\n isGeolocationEnabled?: boolean;\n\n /**\n * Whether the event fragments feature is enabled.\n *\n * When enabled, clients can accumulate analytics properties across a user\n * journey with {@link AnalyticsController.createEventFragment} and friends,\n * as long as the consent state allows analytics to be captured. When\n * disabled, every fragment method is a logged no-op and no fragment is ever\n * written to state.\n *\n * @default false\n */\n isEventFragmentsEnabled?: boolean;\n};\n\n/**\n * Returns whether a value is a non-array object.\n *\n * @param value - The value to check.\n * @returns True if the value is a record.\n */\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\n/**\n * Returns whether a JSON value is a non-array object.\n *\n * @param value - The value to check.\n * @returns True if the value is a JSON record.\n */\nfunction isJsonRecord(value: Json | undefined): value is Record<string, Json> {\n return value !== null && typeof value === 'object' && !Array.isArray(value);\n}\n\n/**\n * Builds the analytics location context from geolocation data, keeping only\n * the fields the geolocation API was able to determine.\n *\n * @param geolocation - The geolocation data to convert.\n * @returns The location context, or `undefined` when no field is known.\n */\nfunction buildLocationContext(\n geolocation: GeolocationData,\n): AnalyticsLocationContext | undefined {\n const locationContext: AnalyticsLocationContext = {\n ...(geolocation.country === null\n ? {}\n : { country_code: geolocation.country }),\n ...(geolocation.region === null ? {} : { region: geolocation.region }),\n ...(geolocation.timezone === null\n ? {}\n : { timezone: geolocation.timezone }),\n };\n\n return Object.keys(locationContext).length === 0\n ? undefined\n : locationContext;\n}\n\n/**\n * Returns whether a value is a valid persisted analytics event.\n *\n * @param value - The value to check.\n * @returns True if the value is a queued analytics event.\n */\nfunction isAnalyticsQueuedEvent(value: unknown): value is AnalyticsQueuedEvent {\n if (!isRecord(value)) {\n return false;\n }\n\n if (\n typeof value.messageId !== 'string' ||\n typeof value.timestamp !== 'string'\n ) {\n return false;\n }\n\n if (value.type === 'track') {\n return (\n typeof value.eventName === 'string' &&\n (value.properties === undefined || isRecord(value.properties)) &&\n (value.context === undefined || isRecord(value.context))\n );\n }\n\n if (value.type === 'identify') {\n return (\n typeof value.userId === 'string' &&\n (value.traits === undefined || isRecord(value.traits)) &&\n (value.context === undefined || isRecord(value.context))\n );\n }\n\n if (value.type === 'view') {\n return (\n typeof value.name === 'string' &&\n (value.properties === undefined || isRecord(value.properties)) &&\n (value.context === undefined || isRecord(value.context))\n );\n }\n\n return false;\n}\n\n/**\n * Returns whether a value is a valid persisted event fragment.\n *\n * @param value - The value to check.\n * @returns True if the value is an event fragment.\n */\nfunction isAnalyticsEventFragment(\n value: unknown,\n): value is AnalyticsEventFragment {\n if (!isRecord(value)) {\n return false;\n }\n\n return (\n typeof value.id === 'string' &&\n typeof value.createdAt === 'number' &&\n typeof value.lastUpdated === 'number' &&\n isRecord(value.properties) &&\n isRecord(value.sensitiveProperties) &&\n (value.initialEvent === undefined ||\n typeof value.initialEvent === 'string') &&\n (value.successEvent === undefined ||\n typeof value.successEvent === 'string') &&\n (value.failureEvent === undefined ||\n typeof value.failureEvent === 'string') &&\n (value.context === undefined || isRecord(value.context)) &&\n (value.persist === undefined || typeof value.persist === 'boolean')\n );\n}\n\n/**\n * Merges a payload into an event fragment.\n *\n * `properties`, `sensitiveProperties` and `context` are merged one level deep,\n * so a key written twice is replaced rather than combined. This keeps array\n * values predictable: writing a shorter array replaces the longer one instead\n * of leaving stale trailing entries behind.\n *\n * @param fragment - The fragment to merge into.\n * @param payload - The payload to merge.\n * @returns A new fragment with the payload applied.\n */\nfunction mergeEventFragment(\n fragment: AnalyticsEventFragment,\n payload: AnalyticsEventFragmentPayload,\n): AnalyticsEventFragment {\n const context = mergeEventFragmentContext(fragment.context, payload.context);\n\n return {\n ...fragment,\n properties: { ...fragment.properties, ...(payload.properties ?? {}) },\n sensitiveProperties: {\n ...fragment.sensitiveProperties,\n ...(payload.sensitiveProperties ?? {}),\n },\n ...(context === undefined ? {} : { context }),\n lastUpdated: Date.now(),\n };\n}\n\n/**\n * Merges two optional analytics contexts, preserving `undefined` when neither\n * side has one so an empty context is never sent.\n *\n * @param base - The context to merge into.\n * @param override - The context whose fields win.\n * @returns The merged context, or `undefined` when both sides are unset.\n */\nfunction mergeEventFragmentContext(\n base: AnalyticsContext | undefined,\n override: AnalyticsContext | undefined,\n): AnalyticsContext | undefined {\n if (base === undefined && override === undefined) {\n return undefined;\n }\n\n return { ...(base ?? {}), ...(override ?? {}) };\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 *\n * The controller persists `optedIn` and `analyticsId` when composed with a persisted\n * store. The platform must supply a valid `analyticsId` on first launch.\n */\nexport class AnalyticsController extends BaseController<\n 'AnalyticsController',\n AnalyticsControllerState,\n AnalyticsControllerMessenger\n> {\n readonly #platformAdapter: AnalyticsPlatformAdapter;\n\n readonly #isAnonymousEventsFeatureEnabled: boolean;\n\n readonly #isEventQueuePersistenceEnabled: boolean;\n\n readonly #isPreConsentQueueEnabled: boolean;\n\n readonly #isGeolocationEnabled: boolean;\n\n readonly #isEventFragmentsEnabled: boolean;\n\n /**\n * The in-flight (or settled) initialization promise. Set on the first\n * {@link init} call and returned by subsequent calls so overlapping callers\n * await the same work rather than observing a premature completion.\n */\n #initPromise: Promise<void> | undefined;\n\n /**\n * The in-flight (or settled) geolocation resolution, if any. Its presence\n * marks that resolution has been started, so it runs at most once.\n */\n #locationResolvePromise: Promise<void> | undefined;\n\n #locationContext: AnalyticsLocationContext | undefined;\n\n /**\n * Constructs an AnalyticsController instance.\n *\n * @param options - Controller options\n * @param options.state - Initial controller state. Must include a valid UUIDv4 `analyticsId`.\n * Use `getDefaultAnalyticsControllerState()` for default opt-in preferences.\n * @param options.messenger - Messenger used to communicate with BaseController\n * @param options.platformAdapter - Platform adapter implementation for tracking\n * @param options.isAnonymousEventsFeatureEnabled - Whether the anonymous events feature is enabled\n * @param options.isEventQueuePersistenceEnabled - Whether analytics event queue persistence is enabled\n * @param options.isPreConsentQueueEnabled - Whether the pre-consent event queue is enabled\n * @param options.isGeolocationEnabled - Whether geolocation enrichment is enabled\n * @param options.isEventFragmentsEnabled - Whether the event fragments feature is enabled\n * @throws Error if state.analyticsId is missing or not a valid UUIDv4\n * @remarks After construction, call {@link AnalyticsController.init} to complete initialization.\n */\n constructor({\n state,\n messenger,\n platformAdapter,\n isAnonymousEventsFeatureEnabled = false,\n isEventQueuePersistenceEnabled = false,\n isPreConsentQueueEnabled = false,\n isGeolocationEnabled = false,\n isEventFragmentsEnabled = false,\n }: AnalyticsControllerOptions) {\n const initialState: AnalyticsControllerState = {\n ...getDefaultAnalyticsControllerState(),\n ...state,\n };\n\n validateAnalyticsControllerState(\n initialState,\n platformAdapter.skipUUIDv4Check === true,\n );\n\n super({\n name: controllerName,\n metadata: analyticsControllerMetadata,\n state: initialState,\n messenger,\n });\n\n this.#isAnonymousEventsFeatureEnabled = isAnonymousEventsFeatureEnabled;\n this.#isEventQueuePersistenceEnabled = isEventQueuePersistenceEnabled;\n this.#isPreConsentQueueEnabled = isPreConsentQueueEnabled;\n this.#isGeolocationEnabled = isGeolocationEnabled;\n this.#isEventFragmentsEnabled = isEventFragmentsEnabled;\n this.#platformAdapter = platformAdapter;\n this.#initPromise = undefined;\n this.#locationResolvePromise = undefined;\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n\n log('AnalyticsController initialized and ready', {\n enabled: analyticsControllerSelectors.selectEnabled(this.state),\n optedIn: this.state.optedIn,\n consentDecisionMade: this.state.consentDecisionMade,\n analyticsId: this.state.analyticsId,\n eventQueuePersistenceEnabled: this.#isEventQueuePersistenceEnabled,\n preConsentQueueEnabled: this.#isPreConsentQueueEnabled,\n geolocationEnabled: this.#isGeolocationEnabled,\n eventFragmentsEnabled: this.#isEventFragmentsEnabled,\n });\n }\n\n /**\n * Initialize the controller by calling the platform adapter's\n * onSetupCompleted lifecycle hook and replaying any queued events. This\n * method must be called after construction to complete the setup process.\n *\n * When geolocation enrichment is enabled (`isGeolocationEnabled`), geolocation\n * is resolved only for a user who is already opted in; for undecided or\n * opted-out users it is deferred until they opt in (see {@link optIn}), so a\n * user's location is never requested before they consent to analytics. In\n * either case the `GeolocationController` and its\n * `GeolocationController:getGeolocationData` action must be registered before\n * resolution occurs, or enrichment is skipped for the session (a message is\n * logged, see {@link #resolveLocationContext}).\n *\n * Safe to call more than once: the first call performs initialization and\n * subsequent calls return the same in-flight (or settled) promise.\n *\n * @returns A promise that resolves once initialization has completed.\n */\n init(): Promise<void> {\n // Cache the in-flight promise so repeated or overlapping calls share a\n // single initialization and all await the same completion (rather than an\n // early call observing a finished init while work is still pending).\n this.#initPromise ??= this.#performInit();\n return this.#initPromise;\n }\n\n /**\n * Performs the one-time initialization work: resolve geolocation, run the\n * platform adapter's onSetupCompleted lifecycle hook, then replay any queued\n * and pre-consent events.\n */\n async #performInit(): Promise<void> {\n // Snapshot fragment IDs and createdAt before any awaited init work so\n // reconciliation can tell previous-session leftovers from fragments\n // created or replaced while init runs.\n const initEventFragmentSnapshot = new Map<string, number>();\n for (const [id, fragment] of Object.entries(\n this.state.eventFragments ?? {},\n )) {\n if (\n isAnalyticsEventFragment(fragment) &&\n fragment.id === id &&\n typeof fragment.createdAt === 'number'\n ) {\n initEventFragmentSnapshot.set(id, fragment.createdAt);\n }\n }\n\n // Resolve geolocation only when the user is already opted in; for undecided\n // or opted-out users it is deferred to {@link optIn}. Awaited so that an\n // already-opted-in session has location available before events replay.\n await this.#maybeResolveLocation();\n\n // Call onSetupCompleted lifecycle hook after initialization\n // State is already validated, so analyticsId is guaranteed to be a valid UUIDv4\n try {\n this.#platformAdapter.onSetupCompleted(this.state.analyticsId);\n } catch (error) {\n // Log error but don't throw - adapter setup failure shouldn't break controller\n log('Error calling platformAdapter.onSetupCompleted', error);\n }\n\n this.#replayQueuedEvents();\n this.#reconcilePreConsentEvents();\n this.#reconcileEventFragments(initEventFragmentSnapshot);\n }\n\n /**\n * Start resolving the geolocation context if warranted, and return the\n * in-flight (or settled) resolution so callers can await it. No-op unless\n * enrichment is enabled, the user is opted in, and a resolution has not\n * already been started. Deferring resolution until opt-in ensures a user's\n * location is never requested before they consent to analytics (for example,\n * during onboarding).\n *\n * Resolution runs at most once per controller session: the settled promise\n * is retained, so the outcome — including a failure (see\n * {@link #resolveLocationContext}) — is not retried, and events are delivered\n * without location for the rest of the session.\n *\n * @returns The geolocation resolution promise, or `undefined` when no\n * resolution is warranted.\n */\n #maybeResolveLocation(): Promise<void> | undefined {\n if (\n this.#isGeolocationEnabled &&\n this.#locationResolvePromise === undefined &&\n analyticsControllerSelectors.selectEnabled(this.state)\n ) {\n this.#locationResolvePromise = this.#resolveLocationContext();\n }\n\n return this.#locationResolvePromise;\n }\n\n async #resolveLocationContext(): Promise<void> {\n try {\n const geolocation = await this.messenger.call(\n 'GeolocationController:getGeolocationData',\n );\n\n this.#locationContext = buildLocationContext(geolocation);\n } catch (error) {\n // A common cause is the GeolocationController not being registered before\n // resolution runs (at init for an opted-in user, otherwise at opt-in).\n // Name it here so the failure is diagnosable, since enrichment is\n // otherwise skipped silently for the session.\n log(\n 'Failed to resolve geolocation for analytics enrichment; events will be sent without location. Ensure the GeolocationController is registered and initialized before the user opts in when geolocation is enabled.',\n error,\n );\n }\n }\n\n /**\n * Merge the resolved location context into a caller-provided context.\n *\n * Caller-provided `location` fields are preserved, but the fields the\n * controller resolves take precedence over them.\n *\n * @param context - Optional caller-provided context.\n * @returns The context enriched with location, or the original context when\n * no location is known.\n */\n #withLocationContext(\n context?: AnalyticsContext,\n ): AnalyticsContext | undefined {\n if (!this.#locationContext) {\n return context;\n }\n\n const callerLocation = context?.location;\n\n return {\n ...context,\n location: {\n ...(isJsonRecord(callerLocation) ? callerLocation : {}),\n ...this.#locationContext,\n },\n };\n }\n\n /**\n * Send final track payload through the platform adapter or queue it if persistence is enabled.\n *\n * @param eventName - The name of the event.\n * @param properties - Optional event properties.\n * @param context - Optional platform-specific context.\n */\n #sendOrQueueTrackEvent(\n eventName: string,\n properties?: AnalyticsEventProperties,\n context?: AnalyticsContext,\n ): void {\n // Direct delivery: enabled and not persisting.\n if (\n analyticsControllerSelectors.selectEnabled(this.state) &&\n !this.#isEventQueuePersistenceEnabled\n ) {\n this.#platformAdapter.track(eventName, properties, context);\n return;\n }\n\n const queuedEvent: AnalyticsQueuedTrackEvent = {\n type: 'track',\n eventName,\n messageId: uuid(),\n timestamp: new Date().toISOString(),\n ...(properties === undefined ? {} : { properties }),\n ...(context === undefined ? {} : { context }),\n };\n\n // Not yet enabled (reached only while undecided with the pre-consent queue\n // enabled): hold the event until the user opts in.\n if (!analyticsControllerSelectors.selectEnabled(this.state)) {\n this.#enqueuePreConsentEvent(queuedEvent);\n return;\n }\n\n this.#enqueueEvent(queuedEvent);\n }\n\n /**\n * Send final identify payload through the platform adapter or queue it if persistence is enabled.\n *\n * @param userId - The user ID.\n * @param traits - Optional user traits.\n * @param context - Optional platform-specific context.\n */\n #sendOrQueueIdentifyEvent(\n userId: string,\n traits?: AnalyticsUserTraits,\n context?: AnalyticsContext,\n ): void {\n if (!this.#isEventQueuePersistenceEnabled) {\n this.#platformAdapter.identify(userId, traits, context);\n return;\n }\n\n const queuedEvent: AnalyticsQueuedIdentifyEvent = {\n type: 'identify',\n userId,\n messageId: uuid(),\n timestamp: new Date().toISOString(),\n ...(traits === undefined ? {} : { traits }),\n ...(context === undefined ? {} : { context }),\n };\n\n this.#enqueueEvent(queuedEvent);\n }\n\n /**\n * Send final view payload through the platform adapter or queue it if persistence is enabled.\n *\n * @param name - The view name.\n * @param properties - Optional view properties.\n * @param context - Optional platform-specific context.\n */\n #sendOrQueueViewEvent(\n name: string,\n properties?: AnalyticsEventProperties,\n context?: AnalyticsContext,\n ): void {\n if (!this.#isEventQueuePersistenceEnabled) {\n this.#platformAdapter.view(name, properties, context);\n return;\n }\n\n const queuedEvent: AnalyticsQueuedViewEvent = {\n type: 'view',\n name,\n messageId: uuid(),\n timestamp: new Date().toISOString(),\n ...(properties === undefined ? {} : { properties }),\n ...(context === undefined ? {} : { context }),\n };\n\n this.#enqueueEvent(queuedEvent);\n }\n\n /**\n * Add an analytics event to the queue and send it.\n *\n * @param queuedEvent - The event to enqueue and deliver.\n */\n #enqueueEvent(queuedEvent: AnalyticsQueuedEvent): void {\n const eventQueue: Record<string, Json> = {\n ...(this.state.eventQueue ?? {}),\n [queuedEvent.messageId]: queuedEvent as unknown as Json,\n };\n\n this.update((state) => {\n state.eventQueue = eventQueue as never;\n });\n\n this.#sendQueuedEvent(queuedEvent);\n }\n\n /**\n * Send a queued event through the platform adapter.\n *\n * @param queuedEvent - The queued event to deliver.\n */\n #sendQueuedEvent(queuedEvent: AnalyticsQueuedEvent): void {\n const timestamp = new Date(queuedEvent.timestamp);\n\n if (Number.isNaN(timestamp.getTime())) {\n log('Dropping queued analytics event with invalid timestamp', {\n messageId: queuedEvent.messageId,\n });\n this.#removeQueuedEvent(queuedEvent.messageId);\n return;\n }\n\n const options: AnalyticsDeliveryOptions = {\n messageId: queuedEvent.messageId,\n timestamp,\n callback: (error?: unknown) => {\n if (error) {\n log('Queued analytics event delivery failed', {\n messageId: queuedEvent.messageId,\n error,\n });\n }\n\n this.#removeQueuedEvent(queuedEvent.messageId);\n },\n };\n\n try {\n if (queuedEvent.type === 'track') {\n this.#platformAdapter.track(\n queuedEvent.eventName,\n cloneDeep(queuedEvent.properties),\n cloneDeep(queuedEvent.context),\n options,\n );\n } else if (queuedEvent.type === 'identify') {\n this.#platformAdapter.identify(\n queuedEvent.userId,\n cloneDeep(queuedEvent.traits),\n cloneDeep(queuedEvent.context),\n options,\n );\n } else {\n this.#platformAdapter.view(\n queuedEvent.name,\n cloneDeep(queuedEvent.properties),\n cloneDeep(queuedEvent.context),\n options,\n );\n }\n } catch (error) {\n log('Error sending queued analytics event', {\n messageId: queuedEvent.messageId,\n error,\n });\n }\n }\n\n /**\n * Replay persisted analytics events.\n */\n #replayQueuedEvents(): void {\n if (!this.#isEventQueuePersistenceEnabled || !this.state.eventQueue) {\n return;\n }\n\n if (!analyticsControllerSelectors.selectEnabled(this.state)) {\n this.#clearQueuedEvents();\n return;\n }\n\n for (const [messageId, queuedEvent] of Object.entries(\n this.state.eventQueue,\n )) {\n if (\n !isAnalyticsQueuedEvent(queuedEvent) ||\n queuedEvent.messageId !== messageId\n ) {\n log('Dropping invalid queued analytics event', { messageId });\n this.#removeQueuedEvent(messageId);\n continue;\n }\n\n this.#sendQueuedEvent(queuedEvent);\n }\n }\n\n /**\n * Remove a queued analytics event.\n *\n * @param messageId - The queued event message ID.\n */\n #removeQueuedEvent(messageId: string): void {\n const currentEventQueue = this.state.eventQueue;\n\n if (\n !currentEventQueue ||\n !Object.prototype.hasOwnProperty.call(currentEventQueue, messageId)\n ) {\n return;\n }\n\n const { [messageId]: _deletedEvent, ...eventQueue } = currentEventQueue;\n\n this.update((state) => {\n state.eventQueue = eventQueue as never;\n });\n }\n\n /**\n * Clear all queued analytics events.\n */\n #clearQueuedEvents(): void {\n if (\n !this.state.eventQueue ||\n Object.keys(this.state.eventQueue).length === 0\n ) {\n return;\n }\n\n this.update((state) => {\n state.eventQueue = {} as never;\n });\n }\n\n /**\n * Add an event to the pre-consent queue without delivering it.\n *\n * @param queuedEvent - The event to hold until the user opts in.\n */\n #enqueuePreConsentEvent(queuedEvent: AnalyticsQueuedEvent): void {\n const preConsentEventQueue: Record<string, Json> = {\n ...(this.state.preConsentEventQueue ?? {}),\n [queuedEvent.messageId]: queuedEvent as unknown as Json,\n };\n\n this.update((state) => {\n state.preConsentEventQueue = preConsentEventQueue as never;\n });\n }\n\n /**\n * Replay queued pre-consent events through the delivery path.\n *\n * Only called by {@link #reconcilePreConsentEvents}, which guarantees the\n * pre-consent queue is enabled and that the user is opted in. The queue is\n * cleared before replaying so events cannot be re-queued or replayed twice.\n *\n * @param queue - The pre-consent event queue to replay.\n */\n #replayPreConsentEvents(queue: Record<string, Json>): void {\n this.#clearPreConsentEvents();\n\n for (const [messageId, queuedEvent] of Object.entries(queue)) {\n if (\n !isAnalyticsQueuedEvent(queuedEvent) ||\n queuedEvent.messageId !== messageId\n ) {\n log('Dropping invalid queued pre-consent analytics event', {\n messageId,\n });\n continue;\n }\n\n const eventToReplay = this.#enrichPreConsentEvent(queuedEvent);\n\n if (this.#isEventQueuePersistenceEnabled) {\n this.#enqueueEvent(eventToReplay);\n } else {\n this.#sendQueuedEvent(eventToReplay);\n }\n }\n }\n\n /**\n * Enrich a pre-consent event with the geolocation resolved on opt-in.\n *\n * Pre-consent events are captured while geolocation is not yet resolved, so\n * they are re-enriched here as they replay. Anonymous track payloads are left\n * untouched, since they must never carry location.\n *\n * @param queuedEvent - The queued pre-consent event.\n * @returns The event with its context enriched, or the event unchanged when\n * enrichment does not apply.\n */\n #enrichPreConsentEvent(\n queuedEvent: AnalyticsQueuedEvent,\n ): AnalyticsQueuedEvent {\n if (\n queuedEvent.type === 'track' &&\n queuedEvent.properties?.anonymous === true\n ) {\n return queuedEvent;\n }\n\n const context = this.#withLocationContext(queuedEvent.context);\n\n return {\n ...queuedEvent,\n ...(context === undefined ? {} : { context }),\n };\n }\n\n /**\n * Clear all queued pre-consent events.\n */\n #clearPreConsentEvents(): void {\n if (!this.state.preConsentEventQueue) {\n return;\n }\n\n this.update((state) => {\n state.preConsentEventQueue = {} as never;\n });\n }\n\n /**\n * Reconcile the pre-consent queue on initialization.\n *\n * The queue should normally be empty unless the user is still undecided. This\n * handles the rare cases where a consent decision was persisted but the queue\n * was not flushed/cleared (e.g. an interrupted shutdown): replay it if the\n * user is opted in, or clear it if they opted out.\n *\n * If the pre-consent queue is disabled, any stale persisted entries (e.g. from\n * a previous session where it was enabled) are dropped so they can never be\n * replayed.\n */\n #reconcilePreConsentEvents(): void {\n const queue = this.state.preConsentEventQueue;\n\n if (!queue) {\n return;\n }\n\n if (!this.#isPreConsentQueueEnabled) {\n this.#clearPreConsentEvents();\n return;\n }\n\n if (this.state.optedIn) {\n this.#replayPreConsentEvents(queue);\n } else if (this.state.consentDecisionMade) {\n this.#clearPreConsentEvents();\n }\n }\n\n /**\n * Reconcile persisted event fragments on initialization.\n *\n * A fragment describes a journey that was in progress when the previous\n * session ended. Only fragments that opted into `persist` and are younger\n * than {@link EVENT_FRAGMENT_MAX_AGE} can be resumed, so the rest are\n * discarded. Nothing is emitted: a journey that never reached its own\n * finalization is not a failure, just an unfinished one.\n *\n * If the feature is disabled (e.g. a previous session had it enabled), or the\n * consent state no longer allows capture (e.g. the fragments were written\n * before the user opted out), every persisted fragment is dropped so none of\n * them can linger.\n *\n * Non-persistent fragments are dropped only when their ID and `createdAt`\n * match a fragment present at the start of {@link init}. Fragments created\n * or replaced while init is in flight are kept so a slow startup path cannot\n * discard an in-progress journey, as long as they have not expired.\n *\n * @param initEventFragmentSnapshot - Fragment IDs and `createdAt` values\n * present when {@link init} began.\n */\n #reconcileEventFragments(\n initEventFragmentSnapshot: Map<string, number>,\n ): void {\n const fragments = this.state.eventFragments;\n\n if (!fragments) {\n return;\n }\n\n if (!this.#isEventFragmentsEnabled || !this.#isAnalyticsCaptureAllowed()) {\n this.#clearEventFragments();\n return;\n }\n\n this.#purgeStaleEventFragments(fragments, initEventFragmentSnapshot);\n }\n\n /**\n * Drop every persisted fragment that is invalid, expired, did not opt into\n * `persist`, or was already present with the same `createdAt` when\n * {@link init} began.\n *\n * Only called by {@link #reconcileEventFragments}, which guarantees the\n * fragments exist and that the event fragments feature is enabled.\n *\n * @param currentEventFragments - The persisted fragments to filter.\n * @param initEventFragmentSnapshot - Fragment IDs and `createdAt` values\n * present when {@link init} began.\n */\n #purgeStaleEventFragments(\n currentEventFragments: AnalyticsEventFragments,\n initEventFragmentSnapshot: Map<string, number>,\n ): void {\n const eventFragments: AnalyticsEventFragments = {};\n const now = Date.now();\n\n for (const [id, fragment] of Object.entries(currentEventFragments)) {\n if (!isAnalyticsEventFragment(fragment) || fragment.id !== id) {\n log('Dropping invalid persisted event fragment', { id });\n continue;\n }\n\n if (now - fragment.lastUpdated > EVENT_FRAGMENT_MAX_AGE) {\n log('Dropping expired persisted event fragment', { id });\n continue;\n }\n\n const snapshotCreatedAt = initEventFragmentSnapshot.get(id);\n\n if (\n fragment.persist === true ||\n snapshotCreatedAt === undefined ||\n fragment.createdAt !== snapshotCreatedAt\n ) {\n eventFragments[id] = fragment;\n }\n }\n\n if (\n Object.keys(eventFragments).length ===\n Object.keys(currentEventFragments).length\n ) {\n return;\n }\n\n this.update((state) => {\n state.eventFragments = eventFragments as never;\n });\n }\n\n /**\n * Read an event fragment from state without the feature guard.\n *\n * @param id - The fragment ID.\n * @returns The fragment, or `undefined` when no fragment has that ID.\n */\n #getEventFragment(id: string): AnalyticsEventFragment | undefined {\n return this.state.eventFragments?.[id];\n }\n\n /**\n * Write an event fragment to state, replacing any fragment with the same ID.\n *\n * @param fragment - The fragment to store.\n */\n #setEventFragment(fragment: AnalyticsEventFragment): void {\n const eventFragments: AnalyticsEventFragments = {\n ...this.state.eventFragments,\n [fragment.id]: fragment,\n };\n\n this.update((state) => {\n state.eventFragments = eventFragments as never;\n });\n }\n\n /**\n * Remove an event fragment from state.\n *\n * @param id - The fragment ID.\n */\n #removeEventFragment(id: string): void {\n const currentEventFragments = this.state.eventFragments;\n\n if (\n !currentEventFragments ||\n !Object.prototype.hasOwnProperty.call(currentEventFragments, id)\n ) {\n return;\n }\n\n const { [id]: _deletedFragment, ...eventFragments } = currentEventFragments;\n\n this.update((state) => {\n state.eventFragments = eventFragments as never;\n });\n }\n\n /**\n * Clear all event fragments.\n */\n #clearEventFragments(): void {\n if (\n !this.state.eventFragments ||\n Object.keys(this.state.eventFragments).length === 0\n ) {\n return;\n }\n\n this.update((state) => {\n state.eventFragments = {} as never;\n });\n }\n\n /**\n * Returns whether an event fragment call should be ignored, either because\n * the feature is disabled or because the consent state does not allow\n * capture. The ignored call is logged so a missing `isEventFragmentsEnabled`\n * or an unexpected consent state is diagnosable rather than silent.\n *\n * Consent is checked on every call, not just on the ones that emit, so a\n * fragment never accumulates data for an event that could not be delivered.\n *\n * @param method - The name of the method that was called.\n * @returns True when the call should be ignored.\n */\n #shouldIgnoreEventFragmentCall(method: string): boolean {\n if (!this.#isEventFragmentsEnabled) {\n log(\n 'Ignoring event fragment call because the event fragments feature is disabled',\n { method },\n );\n\n return true;\n }\n\n if (!this.#isAnalyticsCaptureAllowed()) {\n log(\n 'Ignoring event fragment call because the consent state does not allow capturing analytics',\n { method },\n );\n\n return true;\n }\n\n return false;\n }\n\n /**\n * Emit one of an event fragment's events, carrying the properties the\n * fragment has accumulated.\n *\n * Delivery goes through {@link trackEvent}, so consent gating, the anonymous\n * payload split, the pre-consent queue and geolocation enrichment all apply.\n *\n * @param fragment - The fragment supplying the properties.\n * @param name - The name of the event to emit.\n * @param context - The context to send with the event.\n */\n #emitEventFragment(\n fragment: AnalyticsEventFragment,\n name: string,\n context: AnalyticsContext | undefined,\n ): void {\n const properties = { ...fragment.properties };\n const sensitiveProperties = { ...fragment.sensitiveProperties };\n\n this.trackEvent(\n {\n name,\n properties,\n sensitiveProperties,\n saveDataRecording: false,\n hasProperties:\n Object.keys(properties).length > 0 ||\n Object.keys(sensitiveProperties).length > 0,\n },\n context,\n );\n }\n\n /**\n * Returns whether the current consent state allows analytics data to be\n * captured, either for immediate delivery or to be held until the user\n * decides.\n *\n * Capture is allowed once the user has opted in, and also while they are\n * undecided if the pre-consent queue is enabled: what is captured then is\n * replayed when they opt in (see {@link optIn}) and discarded if they opt out\n * (see {@link optOut}). An explicit opt-out never allows capture.\n *\n * @returns True when analytics data may be captured.\n */\n #isAnalyticsCaptureAllowed(): boolean {\n if (analyticsControllerSelectors.selectEnabled(this.state)) {\n return true;\n }\n\n return this.#isPreConsentQueueEnabled && !this.state.consentDecisionMade;\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 * @param context - Optional platform-specific context forwarded to the platform adapter.\n */\n trackEvent(event: AnalyticsTrackingEvent, context?: AnalyticsContext): void {\n // An event captured while the user is still undecided is held in the\n // pre-consent queue (see #sendOrQueueTrackEvent) instead of being\n // delivered, and replayed if they later opt in.\n if (!this.#isAnalyticsCaptureAllowed()) {\n return;\n }\n\n // if event does not have properties, send event without properties\n // and return to prevent any additional processing\n if (!event.hasProperties) {\n this.#sendOrQueueTrackEvent(\n event.name,\n undefined,\n this.#withLocationContext(context),\n );\n return;\n }\n\n // Track regular properties first if anonymous events feature is enabled\n if (this.#isAnonymousEventsFeatureEnabled) {\n // Note: Even if regular properties object is empty, we still send it to ensure\n // an event with user ID is tracked.\n this.#sendOrQueueTrackEvent(\n event.name,\n {\n ...event.properties,\n },\n this.#withLocationContext(context),\n );\n }\n\n const hasSensitiveProperties =\n Object.keys(event.sensitiveProperties).length > 0;\n\n if (!this.#isAnonymousEventsFeatureEnabled || hasSensitiveProperties) {\n this.#sendOrQueueTrackEvent(\n event.name,\n {\n ...event.properties,\n ...event.sensitiveProperties,\n ...(hasSensitiveProperties && { anonymous: true }),\n },\n // When the anonymous events feature is enabled, this payload is the\n // anonymous one and must carry no geolocation. When the feature is\n // disabled, this is the single identified payload, so it is enriched.\n this.#isAnonymousEventsFeatureEnabled\n ? context\n : this.#withLocationContext(context),\n );\n }\n }\n\n /**\n * Identify a user for analytics.\n *\n * @param traits - User traits/properties\n * @param context - Optional platform-specific context forwarded to the platform adapter.\n */\n identify(traits?: AnalyticsUserTraits, context?: AnalyticsContext): void {\n if (!analyticsControllerSelectors.selectEnabled(this.state)) {\n return;\n }\n\n // Delegate to platform adapter using the current analytics ID\n this.#sendOrQueueIdentifyEvent(\n this.state.analyticsId,\n traits,\n this.#withLocationContext(context),\n );\n }\n\n /**\n * Track a page or screen view.\n *\n * @param name - The identifier/name of the page or screen being viewed (e.g., \"home\", \"settings\", \"wallet\")\n * @param properties - Optional properties associated with the view\n * @param context - Optional platform-specific context forwarded to the platform adapter.\n */\n trackView(\n name: string,\n properties?: AnalyticsEventProperties,\n context?: AnalyticsContext,\n ): void {\n if (!analyticsControllerSelectors.selectEnabled(this.state)) {\n return;\n }\n\n // Delegate to platform adapter\n this.#sendOrQueueViewEvent(\n name,\n properties,\n this.#withLocationContext(context),\n );\n }\n\n /**\n * Create an event fragment.\n *\n * A fragment accumulates properties across a user journey so that several\n * parts of a client can contribute to the same set of events without\n * re-deriving them. Declaring `successEvent` and `failureEvent` turns the\n * fragment into a funnel that {@link finalizeEventFragment} closes. Declaring\n * none of the event names makes it a pure property bag that the client reads\n * back with {@link getEventFragmentById} when it emits its own events.\n *\n * Any existing fragment with the same ID is replaced, so a new journey never\n * inherits properties from a stale one.\n *\n * Nothing is created unless the user is opted in, or undecided with the\n * pre-consent queue enabled, so an opted-out user accumulates no fragment\n * data.\n *\n * @param options - The fragment definition. An ID is generated when one is\n * not supplied.\n * @returns A read-only copy of the created fragment, or `undefined` when the\n * event fragments feature is disabled or the consent state does not allow\n * capture. Mutating the returned object does not change controller state.\n * Use {@link updateEventFragment} or {@link upsertEventFragment} to write.\n */\n createEventFragment(\n options: AnalyticsEventFragmentOptions = {},\n ): ReadonlyAnalyticsEventFragment | undefined {\n if (this.#shouldIgnoreEventFragmentCall('createEventFragment')) {\n return undefined;\n }\n\n const now = Date.now();\n\n const fragment: AnalyticsEventFragment = {\n id: options.id ?? uuid(),\n properties: { ...(options.properties ?? {}) },\n sensitiveProperties: { ...(options.sensitiveProperties ?? {}) },\n createdAt: now,\n lastUpdated: now,\n ...(options.initialEvent === undefined\n ? {}\n : { initialEvent: options.initialEvent }),\n ...(options.successEvent === undefined\n ? {}\n : { successEvent: options.successEvent }),\n ...(options.failureEvent === undefined\n ? {}\n : { failureEvent: options.failureEvent }),\n ...(options.context === undefined\n ? {}\n : { context: { ...options.context } }),\n ...(options.persist === undefined ? {} : { persist: options.persist }),\n };\n\n this.#setEventFragment(fragment);\n\n if (fragment.initialEvent) {\n this.#emitEventFragment(\n fragment,\n fragment.initialEvent,\n fragment.context,\n );\n }\n\n return cloneDeep(fragment);\n }\n\n /**\n * Write to an event fragment, creating a property bag if none exists.\n *\n * This is the ergonomic entry point for contributors that do not know\n * whether the journey has been started yet, and it avoids the read then\n * write race a caller would otherwise have to implement itself.\n *\n * @param id - The fragment ID.\n * @param payload - The properties and context to merge in.\n */\n upsertEventFragment(\n id: string,\n payload: AnalyticsEventFragmentPayload = {},\n ): void {\n if (this.#shouldIgnoreEventFragmentCall('upsertEventFragment')) {\n return;\n }\n\n const fragment = this.#getEventFragment(id);\n\n if (!fragment) {\n this.createEventFragment({ id, ...payload });\n return;\n }\n\n this.#setEventFragment(mergeEventFragment(fragment, payload));\n }\n\n /**\n * Write to an existing event fragment.\n *\n * @param id - The fragment ID.\n * @param payload - The properties and context to merge in.\n * @throws Error if no fragment has that ID when the call is not ignored.\n * Use {@link upsertEventFragment} when the fragment may not exist yet.\n * When the event fragments feature is disabled or the consent state does not\n * allow capture, the call is a logged no-op and does not throw.\n */\n updateEventFragment(\n id: string,\n payload: AnalyticsEventFragmentPayload = {},\n ): void {\n if (this.#shouldIgnoreEventFragmentCall('updateEventFragment')) {\n return;\n }\n\n const fragment = this.#getEventFragment(id);\n\n if (!fragment) {\n throw new Error(`Event fragment with id ${id} does not exist.`);\n }\n\n this.#setEventFragment(mergeEventFragment(fragment, payload));\n }\n\n /**\n * Read an event fragment.\n *\n * @param id - The fragment ID.\n * @returns A read-only copy of the fragment, or `undefined` when no fragment\n * has that ID, the event fragments feature is disabled, or the consent state\n * does not allow capture. Mutating the returned object does not change\n * controller state. Use {@link updateEventFragment} or\n * {@link upsertEventFragment} to write.\n */\n getEventFragmentById(id: string): ReadonlyAnalyticsEventFragment | undefined {\n if (this.#shouldIgnoreEventFragmentCall('getEventFragmentById')) {\n return undefined;\n }\n\n const fragment = this.#getEventFragment(id);\n\n return fragment === undefined ? undefined : cloneDeep(fragment);\n }\n\n /**\n * Discard an event fragment without emitting anything.\n *\n * @param id - The fragment ID.\n */\n deleteEventFragment(id: string): void {\n if (this.#shouldIgnoreEventFragmentCall('deleteEventFragment')) {\n return;\n }\n\n this.#removeEventFragment(id);\n }\n\n /**\n * Close an event fragment, emitting its closing event and discarding it.\n *\n * The event emitted is `failureEvent` when the journey was abandoned and\n * `successEvent` otherwise. A fragment that does not declare the relevant\n * event name is discarded silently, which is what makes a pure property bag\n * possible.\n *\n * @param id - The fragment ID.\n * @param options - Finalization options.\n * @param options.abandoned - Whether the journey was abandoned.\n * @param options.context - Context merged over the fragment's own context.\n * @throws Error if no fragment has that ID when the call is not ignored.\n * When the event fragments feature is disabled or the consent state does not\n * allow capture, the call is a logged no-op and does not throw.\n */\n finalizeEventFragment(\n id: string,\n { abandoned = false, context }: AnalyticsEventFragmentFinalizeOptions = {},\n ): void {\n if (this.#shouldIgnoreEventFragmentCall('finalizeEventFragment')) {\n return;\n }\n\n const fragment = this.#getEventFragment(id);\n\n if (!fragment) {\n throw new Error(`Event fragment with id ${id} does not exist.`);\n }\n\n const eventName = abandoned ? fragment.failureEvent : fragment.successEvent;\n\n if (eventName) {\n this.#emitEventFragment(\n fragment,\n eventName,\n mergeEventFragmentContext(fragment.context, context),\n );\n }\n\n this.#removeEventFragment(id);\n }\n\n /**\n * Opt in to analytics.\n *\n * Records that a consent decision has been made and replays any events that\n * were queued while the user was undecided.\n *\n * When geolocation enrichment is enabled, geolocation is resolved here (once\n * the user has consented) and awaited before the queued events are replayed,\n * so those events are enriched with the resolved location as they are sent.\n *\n * @returns A promise that resolves once opt-in processing has completed.\n */\n async optIn(): Promise<void> {\n this.update((state) => {\n state.optedIn = true;\n state.consentDecisionMade = true;\n });\n\n // Now that the user has consented, resolve geolocation (once) and wait for\n // it so the queued pre-consent events can be enriched as they replay.\n await this.#maybeResolveLocation();\n\n // Reconcile against the current state rather than replaying blindly: the\n // consent decision may have changed while geolocation was resolving (e.g.\n // resetConsentDecision ran during the await), and preserved pre-consent\n // events must not be delivered once the user is no longer opted in.\n this.#reconcilePreConsentEvents();\n }\n\n /**\n * Opt out of analytics.\n *\n * Records that a consent decision has been made and discards any persisted\n * events and in-progress event fragments so nothing captured before the\n * decision is ever delivered.\n */\n optOut(): void {\n this.update((state) => {\n state.optedIn = false;\n state.consentDecisionMade = true;\n });\n\n this.#clearQueuedEvents();\n this.#clearPreConsentEvents();\n this.#clearEventFragments();\n }\n\n /**\n * Reset the consent decision back to undecided.\n *\n * Intended for client flows that restart onboarding. Clears the opt-in\n * preference and discards the delivery queue, but preserves any pre-consent\n * events so they can still be replayed if the user opts in again. The user is\n * treated as undecided again.\n *\n * In-progress event fragments are kept only while the undecided user can\n * still accumulate them, and discarded otherwise, so no fragment outlives the\n * consent state that allowed it.\n */\n resetConsentDecision(): void {\n this.update((state) => {\n state.optedIn = false;\n state.consentDecisionMade = false;\n });\n\n this.#clearQueuedEvents();\n\n if (!this.#isAnalyticsCaptureAllowed()) {\n this.#clearEventFragments();\n }\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnalyticsController.d.cts","sourceRoot":"","sources":["../src/AnalyticsController.ts"],"names":[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AAC,EAAE,gBAAgB,GAAG,IAAI;IAqD3E;;;;;OAKG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,IAAI;IAaxE;;;;;;OAMG;IACH,SAAS,CACP,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,wBAAwB,EACrC,OAAO,CAAC,EAAE,gBAAgB,GACzB,IAAI;IAaP;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,mBAAmB,CACjB,OAAO,GAAE,6BAAkC,GAC1C,8BAA8B,GAAG,SAAS;IAyC7C;;;;;;;;;OASG;IACH,mBAAmB,CACjB,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,6BAAkC,GAC1C,IAAI;IAeP;;;;;;;;;OASG;IACH,mBAAmB,CACjB,EAAE,EAAE,MAAM,EACV,OAAO,GAAE,6BAAkC,GAC1C,IAAI;IAcP;;;;;;;;;OASG;IACH,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,8BAA8B,GAAG,SAAS;IAU5E;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAQrC;;;;;;;;;;;;;;;OAeG;IACH,qBAAqB,CACnB,EAAE,EAAE,MAAM,EACV,EAAE,SAAiB,EAAE,OAAO,EAAE,GAAE,qCAA0C,GACzE,IAAI;IAwBP;;;;;;;;;;;OAWG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB5B;;;;;;OAMG;IACH,MAAM,IAAI,IAAI;IAWd;;;;;;;;;;;OAWG;IACH,oBAAoB,IAAI,IAAI;CAY7B"}
@@ -1,431 +0,0 @@
1
- import type { ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
2
- import { BaseController } from "@metamask/base-controller";
3
- import type { GeolocationControllerGetGeolocationDataAction } from "@metamask/geolocation-controller";
4
- import type { Messenger } from "@metamask/messenger";
5
- import type { Json } from "@metamask/utils";
6
- import type { AnalyticsControllerMethodActions } from "./AnalyticsController-method-action-types.mjs";
7
- import type { AnalyticsPlatformAdapter, AnalyticsContext, AnalyticsEventProperties, AnalyticsUserTraits, AnalyticsTrackingEvent } from "./AnalyticsPlatformAdapter.types.mjs";
8
- import type { AnalyticsEventFragmentFinalizeOptions, AnalyticsEventFragmentOptions, AnalyticsEventFragmentPayload, AnalyticsEventFragments, ReadonlyAnalyticsEventFragment } from "./EventFragment.types.mjs";
9
- /**
10
- * The name of the {@link AnalyticsController}, used to namespace the
11
- * controller's actions and events and to namespace the controller's state data
12
- * when composed with other controllers.
13
- */
14
- export declare const controllerName = "AnalyticsController";
15
- /**
16
- * Maximum age of a persisted event fragment, measured from
17
- * {@link AnalyticsEventFragment.lastUpdated}.
18
- *
19
- * Fragments older than this are discarded during {@link AnalyticsController.init}
20
- * without emitting a success or failure event. Confirmation journeys that span a
21
- * restart are expected to resume within this window; abandoned ones must not keep
22
- * `properties` or `sensitiveProperties` in storage indefinitely.
23
- */
24
- export declare const EVENT_FRAGMENT_MAX_AGE: number;
25
- /**
26
- * Describes the shape of the state object for {@link AnalyticsController}.
27
- */
28
- export type AnalyticsControllerState = {
29
- /**
30
- * Whether the user has opted in to analytics.
31
- */
32
- optedIn: boolean;
33
- /**
34
- * User's UUIDv4 analytics identifier.
35
- * This is an identity (unique per user), not a preference.
36
- * Must be provided by the platform - the controller does not generate it.
37
- */
38
- analyticsId: string;
39
- /**
40
- * Persisted queue of analytics events waiting for delivery acknowledgement.
41
- * This is only used when event queue persistence is enabled.
42
- */
43
- eventQueue?: Record<string, Json>;
44
- /**
45
- * Whether the user has made a consent decision (opted in or opted out).
46
- *
47
- * This distinguishes the "undecided" state (e.g. during onboarding, before
48
- * the user has answered the analytics prompt) from an explicit opt-out.
49
- * Defaults to `false` and is set to `true` by {@link AnalyticsController.optIn}
50
- * or {@link AnalyticsController.optOut}, and back to `false` by
51
- * {@link AnalyticsController.resetConsentDecision}. Optional for backward
52
- * compatibility with persisted state that predates this field.
53
- */
54
- consentDecisionMade?: boolean;
55
- /**
56
- * Persisted queue of track events ({@link AnalyticsQueuedTrackEvent}) captured
57
- * while the user is undecided (no consent decision made yet). Replayed on
58
- * opt-in and cleared on opt-out.
59
- * Preserved across {@link AnalyticsController.resetConsentDecision} so onboarding
60
- * restarts do not drop install-time events.
61
- * This is only used when the pre-consent queue is enabled.
62
- */
63
- preConsentEventQueue?: Record<string, Json>;
64
- /**
65
- * Persisted event fragments ({@link AnalyticsEventFragment}) keyed by
66
- * fragment ID. Fragments accumulate properties across a user journey and are
67
- * removed when the journey is finalized or deleted. Fragments that set
68
- * `persist: true` can survive {@link AnalyticsController.init}, but only
69
- * while younger than {@link EVENT_FRAGMENT_MAX_AGE}.
70
- * This is only used when the event fragments feature is enabled.
71
- */
72
- eventFragments?: AnalyticsEventFragments;
73
- };
74
- /**
75
- * Event types supported by the persisted analytics event queue.
76
- */
77
- export type AnalyticsQueuedEventType = 'track' | 'identify' | 'view';
78
- /**
79
- * Base persisted event queue entry.
80
- */
81
- export type AnalyticsQueuedEventBase = {
82
- /**
83
- * Event type used to replay the payload with the platform adapter.
84
- */
85
- type: AnalyticsQueuedEventType;
86
- /**
87
- * Stable identifier for the analytics payload.
88
- */
89
- messageId: string;
90
- /**
91
- * Original payload timestamp serialized for persistence.
92
- */
93
- timestamp: string;
94
- };
95
- /**
96
- * Persisted track event queue entry.
97
- */
98
- export type AnalyticsQueuedTrackEvent = AnalyticsQueuedEventBase & {
99
- type: 'track';
100
- eventName: string;
101
- properties?: AnalyticsEventProperties;
102
- context?: AnalyticsContext;
103
- };
104
- /**
105
- * Persisted identify event queue entry.
106
- */
107
- export type AnalyticsQueuedIdentifyEvent = AnalyticsQueuedEventBase & {
108
- type: 'identify';
109
- userId: string;
110
- traits?: AnalyticsUserTraits;
111
- context?: AnalyticsContext;
112
- };
113
- /**
114
- * Persisted view event queue entry.
115
- */
116
- export type AnalyticsQueuedViewEvent = AnalyticsQueuedEventBase & {
117
- type: 'view';
118
- name: string;
119
- properties?: AnalyticsEventProperties;
120
- context?: AnalyticsContext;
121
- };
122
- /**
123
- * Persisted analytics event queue entry.
124
- */
125
- export type AnalyticsQueuedEvent = AnalyticsQueuedTrackEvent | AnalyticsQueuedIdentifyEvent | AnalyticsQueuedViewEvent;
126
- /**
127
- * Persisted analytics event queue keyed by message ID.
128
- */
129
- export type AnalyticsEventQueue = Record<string, AnalyticsQueuedEvent>;
130
- /**
131
- * Returns default values for AnalyticsController state.
132
- *
133
- * Note: analyticsId is NOT included - it's an identity that must be
134
- * provided by the platform (generated once on first run, then persisted).
135
- *
136
- * @returns Default state without analyticsId
137
- */
138
- export declare function getDefaultAnalyticsControllerState(): Omit<AnalyticsControllerState, 'analyticsId'>;
139
- /**
140
- * Returns the state of the {@link AnalyticsController}.
141
- */
142
- export type AnalyticsControllerGetStateAction = ControllerGetStateAction<typeof controllerName, AnalyticsControllerState>;
143
- /**
144
- * Actions that {@link AnalyticsControllerMessenger} exposes to other consumers.
145
- */
146
- export type AnalyticsControllerActions = AnalyticsControllerGetStateAction | AnalyticsControllerMethodActions;
147
- /**
148
- * Actions from other messengers that {@link AnalyticsControllerMessenger} calls.
149
- */
150
- type AllowedActions = GeolocationControllerGetGeolocationDataAction;
151
- /**
152
- * Event emitted when the state of the {@link AnalyticsController} changes.
153
- */
154
- export type AnalyticsControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, AnalyticsControllerState>;
155
- /**
156
- * Events that {@link AnalyticsControllerMessenger} exposes to other consumers.
157
- */
158
- export type AnalyticsControllerEvents = AnalyticsControllerStateChangeEvent;
159
- /**
160
- * Events from other messengers that {@link AnalyticsControllerMessenger} subscribes to.
161
- */
162
- type AllowedEvents = never;
163
- /**
164
- * The messenger restricted to actions and events accessed by
165
- * {@link AnalyticsController}.
166
- */
167
- export type AnalyticsControllerMessenger = Messenger<typeof controllerName, AnalyticsControllerActions | AllowedActions, AnalyticsControllerEvents | AllowedEvents>;
168
- /**
169
- * The options that AnalyticsController takes.
170
- */
171
- export type AnalyticsControllerOptions = {
172
- /**
173
- * Initial controller state. Must include a valid UUIDv4 `analyticsId`.
174
- * The platform is responsible for generating the ID on first run.
175
- * It is then persisted with controller state when using a persisted store.
176
- */
177
- state: AnalyticsControllerState;
178
- /**
179
- * Messenger used to communicate with BaseController and other controllers.
180
- */
181
- messenger: AnalyticsControllerMessenger;
182
- /**
183
- * Platform adapter implementation for tracking events.
184
- */
185
- platformAdapter: AnalyticsPlatformAdapter;
186
- /**
187
- * Whether the anonymous events feature is enabled.
188
- *
189
- * @default false
190
- */
191
- isAnonymousEventsFeatureEnabled?: boolean;
192
- /**
193
- * Whether analytics event queue persistence is enabled.
194
- *
195
- * When enabled, AnalyticsController persists each platform adapter payload
196
- * until the adapter reports successful delivery.
197
- *
198
- * @default false
199
- */
200
- isEventQueuePersistenceEnabled?: boolean;
201
- /**
202
- * Whether the pre-consent event queue is enabled.
203
- *
204
- * When enabled, track events received while the user is undecided
205
- * (no consent decision made yet) are persisted and replayed on opt-in,
206
- * or dropped on opt-out. When disabled, such events are dropped immediately,
207
- * preserving the legacy behavior.
208
- *
209
- * @default false
210
- */
211
- isPreConsentQueueEnabled?: boolean;
212
- /**
213
- * Whether geolocation enrichment is enabled.
214
- *
215
- * When enabled, {@link AnalyticsController.init} resolves the user's
216
- * country, region, and timezone via `GeolocationController:getGeolocationData`
217
- * and attaches them to `context.location` on non-anonymous payloads.
218
- * Compositions must register that action when this is enabled. When disabled,
219
- * the controller never calls the geolocation action and events are delivered
220
- * without location.
221
- *
222
- * @default false
223
- */
224
- isGeolocationEnabled?: boolean;
225
- /**
226
- * Whether the event fragments feature is enabled.
227
- *
228
- * When enabled, clients can accumulate analytics properties across a user
229
- * journey with {@link AnalyticsController.createEventFragment} and friends,
230
- * as long as the consent state allows analytics to be captured. When
231
- * disabled, every fragment method is a logged no-op and no fragment is ever
232
- * written to state.
233
- *
234
- * @default false
235
- */
236
- isEventFragmentsEnabled?: boolean;
237
- };
238
- /**
239
- * The AnalyticsController manages analytics tracking across platforms (Mobile/Extension).
240
- * It provides a unified interface for tracking events, identifying users, and managing
241
- * analytics preferences while delegating platform-specific implementation to an
242
- * {@link AnalyticsPlatformAdapter}.
243
- *
244
- * This controller follows the MetaMask controller pattern and integrates with the
245
- * messenger system to allow other controllers and components to track analytics events.
246
- * It delegates platform-specific implementation to an {@link AnalyticsPlatformAdapter}.
247
- *
248
- * The controller persists `optedIn` and `analyticsId` when composed with a persisted
249
- * store. The platform must supply a valid `analyticsId` on first launch.
250
- */
251
- export declare class AnalyticsController extends BaseController<'AnalyticsController', AnalyticsControllerState, AnalyticsControllerMessenger> {
252
- #private;
253
- /**
254
- * Constructs an AnalyticsController instance.
255
- *
256
- * @param options - Controller options
257
- * @param options.state - Initial controller state. Must include a valid UUIDv4 `analyticsId`.
258
- * Use `getDefaultAnalyticsControllerState()` for default opt-in preferences.
259
- * @param options.messenger - Messenger used to communicate with BaseController
260
- * @param options.platformAdapter - Platform adapter implementation for tracking
261
- * @param options.isAnonymousEventsFeatureEnabled - Whether the anonymous events feature is enabled
262
- * @param options.isEventQueuePersistenceEnabled - Whether analytics event queue persistence is enabled
263
- * @param options.isPreConsentQueueEnabled - Whether the pre-consent event queue is enabled
264
- * @param options.isGeolocationEnabled - Whether geolocation enrichment is enabled
265
- * @param options.isEventFragmentsEnabled - Whether the event fragments feature is enabled
266
- * @throws Error if state.analyticsId is missing or not a valid UUIDv4
267
- * @remarks After construction, call {@link AnalyticsController.init} to complete initialization.
268
- */
269
- constructor({ state, messenger, platformAdapter, isAnonymousEventsFeatureEnabled, isEventQueuePersistenceEnabled, isPreConsentQueueEnabled, isGeolocationEnabled, isEventFragmentsEnabled, }: AnalyticsControllerOptions);
270
- /**
271
- * Initialize the controller by calling the platform adapter's
272
- * onSetupCompleted lifecycle hook and replaying any queued events. This
273
- * method must be called after construction to complete the setup process.
274
- *
275
- * When geolocation enrichment is enabled (`isGeolocationEnabled`), geolocation
276
- * is resolved only for a user who is already opted in; for undecided or
277
- * opted-out users it is deferred until they opt in (see {@link optIn}), so a
278
- * user's location is never requested before they consent to analytics. In
279
- * either case the `GeolocationController` and its
280
- * `GeolocationController:getGeolocationData` action must be registered before
281
- * resolution occurs, or enrichment is skipped for the session (a message is
282
- * logged, see {@link #resolveLocationContext}).
283
- *
284
- * Safe to call more than once: the first call performs initialization and
285
- * subsequent calls return the same in-flight (or settled) promise.
286
- *
287
- * @returns A promise that resolves once initialization has completed.
288
- */
289
- init(): Promise<void>;
290
- /**
291
- * Track an analytics event.
292
- *
293
- * Events are only tracked if analytics is enabled.
294
- *
295
- * @param event - Analytics event with properties and sensitive properties
296
- * @param context - Optional platform-specific context forwarded to the platform adapter.
297
- */
298
- trackEvent(event: AnalyticsTrackingEvent, context?: AnalyticsContext): void;
299
- /**
300
- * Identify a user for analytics.
301
- *
302
- * @param traits - User traits/properties
303
- * @param context - Optional platform-specific context forwarded to the platform adapter.
304
- */
305
- identify(traits?: AnalyticsUserTraits, context?: AnalyticsContext): void;
306
- /**
307
- * Track a page or screen view.
308
- *
309
- * @param name - The identifier/name of the page or screen being viewed (e.g., "home", "settings", "wallet")
310
- * @param properties - Optional properties associated with the view
311
- * @param context - Optional platform-specific context forwarded to the platform adapter.
312
- */
313
- trackView(name: string, properties?: AnalyticsEventProperties, context?: AnalyticsContext): void;
314
- /**
315
- * Create an event fragment.
316
- *
317
- * A fragment accumulates properties across a user journey so that several
318
- * parts of a client can contribute to the same set of events without
319
- * re-deriving them. Declaring `successEvent` and `failureEvent` turns the
320
- * fragment into a funnel that {@link finalizeEventFragment} closes. Declaring
321
- * none of the event names makes it a pure property bag that the client reads
322
- * back with {@link getEventFragmentById} when it emits its own events.
323
- *
324
- * Any existing fragment with the same ID is replaced, so a new journey never
325
- * inherits properties from a stale one.
326
- *
327
- * Nothing is created unless the user is opted in, or undecided with the
328
- * pre-consent queue enabled, so an opted-out user accumulates no fragment
329
- * data.
330
- *
331
- * @param options - The fragment definition. An ID is generated when one is
332
- * not supplied.
333
- * @returns A read-only copy of the created fragment, or `undefined` when the
334
- * event fragments feature is disabled or the consent state does not allow
335
- * capture. Mutating the returned object does not change controller state.
336
- * Use {@link updateEventFragment} or {@link upsertEventFragment} to write.
337
- */
338
- createEventFragment(options?: AnalyticsEventFragmentOptions): ReadonlyAnalyticsEventFragment | undefined;
339
- /**
340
- * Write to an event fragment, creating a property bag if none exists.
341
- *
342
- * This is the ergonomic entry point for contributors that do not know
343
- * whether the journey has been started yet, and it avoids the read then
344
- * write race a caller would otherwise have to implement itself.
345
- *
346
- * @param id - The fragment ID.
347
- * @param payload - The properties and context to merge in.
348
- */
349
- upsertEventFragment(id: string, payload?: AnalyticsEventFragmentPayload): void;
350
- /**
351
- * Write to an existing event fragment.
352
- *
353
- * @param id - The fragment ID.
354
- * @param payload - The properties and context to merge in.
355
- * @throws Error if no fragment has that ID when the call is not ignored.
356
- * Use {@link upsertEventFragment} when the fragment may not exist yet.
357
- * When the event fragments feature is disabled or the consent state does not
358
- * allow capture, the call is a logged no-op and does not throw.
359
- */
360
- updateEventFragment(id: string, payload?: AnalyticsEventFragmentPayload): void;
361
- /**
362
- * Read an event fragment.
363
- *
364
- * @param id - The fragment ID.
365
- * @returns A read-only copy of the fragment, or `undefined` when no fragment
366
- * has that ID, the event fragments feature is disabled, or the consent state
367
- * does not allow capture. Mutating the returned object does not change
368
- * controller state. Use {@link updateEventFragment} or
369
- * {@link upsertEventFragment} to write.
370
- */
371
- getEventFragmentById(id: string): ReadonlyAnalyticsEventFragment | undefined;
372
- /**
373
- * Discard an event fragment without emitting anything.
374
- *
375
- * @param id - The fragment ID.
376
- */
377
- deleteEventFragment(id: string): void;
378
- /**
379
- * Close an event fragment, emitting its closing event and discarding it.
380
- *
381
- * The event emitted is `failureEvent` when the journey was abandoned and
382
- * `successEvent` otherwise. A fragment that does not declare the relevant
383
- * event name is discarded silently, which is what makes a pure property bag
384
- * possible.
385
- *
386
- * @param id - The fragment ID.
387
- * @param options - Finalization options.
388
- * @param options.abandoned - Whether the journey was abandoned.
389
- * @param options.context - Context merged over the fragment's own context.
390
- * @throws Error if no fragment has that ID when the call is not ignored.
391
- * When the event fragments feature is disabled or the consent state does not
392
- * allow capture, the call is a logged no-op and does not throw.
393
- */
394
- finalizeEventFragment(id: string, { abandoned, context }?: AnalyticsEventFragmentFinalizeOptions): void;
395
- /**
396
- * Opt in to analytics.
397
- *
398
- * Records that a consent decision has been made and replays any events that
399
- * were queued while the user was undecided.
400
- *
401
- * When geolocation enrichment is enabled, geolocation is resolved here (once
402
- * the user has consented) and awaited before the queued events are replayed,
403
- * so those events are enriched with the resolved location as they are sent.
404
- *
405
- * @returns A promise that resolves once opt-in processing has completed.
406
- */
407
- optIn(): Promise<void>;
408
- /**
409
- * Opt out of analytics.
410
- *
411
- * Records that a consent decision has been made and discards any persisted
412
- * events and in-progress event fragments so nothing captured before the
413
- * decision is ever delivered.
414
- */
415
- optOut(): void;
416
- /**
417
- * Reset the consent decision back to undecided.
418
- *
419
- * Intended for client flows that restart onboarding. Clears the opt-in
420
- * preference and discards the delivery queue, but preserves any pre-consent
421
- * events so they can still be replayed if the user opts in again. The user is
422
- * treated as undecided again.
423
- *
424
- * In-progress event fragments are kept only while the undecided user can
425
- * still accumulate them, and discarded otherwise, so no fragment outlives the
426
- * consent state that allowed it.
427
- */
428
- resetConsentDecision(): void;
429
- }
430
- export {};
431
- //# sourceMappingURL=AnalyticsController.d.mts.map
@@ -1 +0,0 @@
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,EACV,6CAA6C,EAE9C,yCAAyC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AACrD,OAAO,KAAK,EAAE,IAAI,EAAE,wBAAwB;AAI5C,OAAO,KAAK,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