@metamask-previews/analytics-controller 2.0.0-preview-fe4b3be11 → 2.1.0-preview-2f57247
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.
- package/CHANGELOG.md +12 -1
- package/README.md +46 -5
- package/dist/AnalyticsController-method-action-types.cjs.map +1 -1
- package/dist/AnalyticsController-method-action-types.d.cts +106 -2
- package/dist/AnalyticsController-method-action-types.d.cts.map +1 -1
- package/dist/AnalyticsController-method-action-types.d.mts +106 -2
- package/dist/AnalyticsController-method-action-types.d.mts.map +1 -1
- package/dist/AnalyticsController-method-action-types.mjs.map +1 -1
- package/dist/AnalyticsController.cjs +364 -14
- package/dist/AnalyticsController.cjs.map +1 -1
- package/dist/AnalyticsController.d.cts +121 -2
- package/dist/AnalyticsController.d.cts.map +1 -1
- package/dist/AnalyticsController.d.mts +121 -2
- package/dist/AnalyticsController.d.mts.map +1 -1
- package/dist/AnalyticsController.mjs +363 -13
- package/dist/AnalyticsController.mjs.map +1 -1
- package/dist/EventFragment.types.cjs +3 -0
- package/dist/EventFragment.types.cjs.map +1 -0
- package/dist/EventFragment.types.d.cts +111 -0
- package/dist/EventFragment.types.d.cts.map +1 -0
- package/dist/EventFragment.types.d.mts +111 -0
- package/dist/EventFragment.types.d.mts.map +1 -0
- package/dist/EventFragment.types.mjs +2 -0
- package/dist/EventFragment.types.mjs.map +1 -0
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/selectors.cjs +19 -0
- package/dist/selectors.cjs.map +1 -1
- package/dist/selectors.d.cts +3 -0
- package/dist/selectors.d.cts.map +1 -1
- package/dist/selectors.d.mts +3 -0
- package/dist/selectors.d.mts.map +1 -1
- package/dist/selectors.mjs +19 -0
- package/dist/selectors.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.1.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add optional event fragments to `AnalyticsController` (disabled by default via `isEventFragmentsEnabled`), letting clients accumulate analytics properties across a user journey and optionally emit an initial, success, or failure event for it ([#10055](https://github.com/MetaMask/core/pull/10055))
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Bump `@metamask/utils` from `^11.11.0` to `^11.12.0` ([#10076](https://github.com/MetaMask/core/pull/10076))
|
|
19
|
+
|
|
10
20
|
## [2.0.0]
|
|
11
21
|
|
|
12
22
|
### Changed
|
|
@@ -68,7 +78,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
68
78
|
|
|
69
79
|
- Initial release of @metamask/analytics-controller. ([#7017](https://github.com/MetaMask/core/pull/7017), [#7202](https://github.com/MetaMask/core/pull/7202))
|
|
70
80
|
|
|
71
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/analytics-controller@2.
|
|
81
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/analytics-controller@2.1.0...HEAD
|
|
82
|
+
[2.1.0]: https://github.com/MetaMask/core/compare/@metamask/analytics-controller@2.0.0...@metamask/analytics-controller@2.1.0
|
|
72
83
|
[2.0.0]: https://github.com/MetaMask/core/compare/@metamask/analytics-controller@1.2.1...@metamask/analytics-controller@2.0.0
|
|
73
84
|
[1.2.1]: https://github.com/MetaMask/core/compare/@metamask/analytics-controller@1.2.0...@metamask/analytics-controller@1.2.1
|
|
74
85
|
[1.2.0]: https://github.com/MetaMask/core/compare/@metamask/analytics-controller@1.1.1...@metamask/analytics-controller@1.2.0
|
package/README.md
CHANGED
|
@@ -16,11 +16,12 @@ The AnalyticsController provides a unified interface for tracking analytics even
|
|
|
16
16
|
|
|
17
17
|
## State
|
|
18
18
|
|
|
19
|
-
| Field
|
|
20
|
-
|
|
|
21
|
-
| `analyticsId`
|
|
22
|
-
| `optedIn`
|
|
23
|
-
| `eventQueue`
|
|
19
|
+
| Field | Type | Description | Persisted |
|
|
20
|
+
| ---------------- | --------- | --------------------------------------------- | --------- |
|
|
21
|
+
| `analyticsId` | `string` | UUIDv4 identifier (client platform-generated) | Yes |
|
|
22
|
+
| `optedIn` | `boolean` | User opt-in status | Yes |
|
|
23
|
+
| `eventQueue` | `object` | Optional persisted delivery queue | Yes |
|
|
24
|
+
| `eventFragments` | `object` | Optional in-progress event fragments | Yes |
|
|
24
25
|
|
|
25
26
|
### Client Platform Responsibilities
|
|
26
27
|
|
|
@@ -46,6 +47,46 @@ This feature is disabled by default. Client platforms that already rely on SDK-l
|
|
|
46
47
|
|
|
47
48
|
Platforms without SDK-level persistence, such as MetaMask Extension, can enable it to replay queued payloads after restart. The queue stores the final adapter calls, so anonymous event splitting persists the identified and anonymous payloads separately.
|
|
48
49
|
|
|
50
|
+
## Event Fragments
|
|
51
|
+
|
|
52
|
+
When `isEventFragmentsEnabled` is enabled in the constructor, clients can accumulate analytics properties across a user journey instead of re-deriving them for every event in that journey.
|
|
53
|
+
|
|
54
|
+
A fragment is a persisted bag of `properties` and `sensitiveProperties` that any part of the client can contribute to while the journey is in progress. It supports two shapes, and the difference is only which event names it declares:
|
|
55
|
+
|
|
56
|
+
- **Funnel.** Declare `initialEvent`, `successEvent` and `failureEvent`. The initial event is emitted as soon as the fragment is created, and `finalizeEventFragment` emits the success event, or the failure event when called with `{ abandoned: true }`. A signature request is the canonical example: the request, approval and rejection events all carry the properties that the confirmation UI attached while the user was deciding.
|
|
57
|
+
- **Property bag.** Declare no event names. Nothing is ever emitted. The client reads the fragment back with `getEventFragmentById` at the moment it emits its own event and merges the accumulated properties in. A transaction confirmation is the canonical example.
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
controller.createEventFragment({
|
|
61
|
+
id: `signature-${requestId}`,
|
|
62
|
+
initialEvent: 'Signature Requested',
|
|
63
|
+
successEvent: 'Signature Approved',
|
|
64
|
+
failureEvent: 'Signature Rejected',
|
|
65
|
+
properties: { signature_type: 'personal_sign' },
|
|
66
|
+
context: { referrer: { url: origin } },
|
|
67
|
+
persist: true,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Any number of contributors, at any later point.
|
|
71
|
+
controller.updateEventFragment(`signature-${requestId}`, {
|
|
72
|
+
properties: { alert_triggered_count: 1 },
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Emits 'Signature Approved' with every accumulated property, then discards
|
|
76
|
+
// the fragment. Pass `{ abandoned: true }` to emit 'Signature Rejected'.
|
|
77
|
+
controller.finalizeEventFragment(`signature-${requestId}`);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Use `upsertEventFragment` when a contributor cannot know whether the journey has been started yet. It merges into an existing fragment, or creates a property bag when none exists.
|
|
81
|
+
|
|
82
|
+
Emission goes through `trackEvent`, so consent gating, anonymous event splitting, the pre-consent queue and geolocation enrichment all apply to a fragment's events exactly as they do to a direct call.
|
|
83
|
+
|
|
84
|
+
The consent gate also applies to accumulation, not just to emission, so a fragment never stores data for an event that could not be delivered. A fragment only holds data while the user is opted in, or while they are still undecided and `isPreConsentQueueEnabled` is holding their events until they decide. In any other consent state, and in particular after an explicit opt-out, every fragment method is a logged no-op.
|
|
85
|
+
|
|
86
|
+
Fragments are removed when they are finalized, deleted, or when the user opts out. `resetConsentDecision` keeps them only while the now-undecided user can still accumulate them. On `init`, any fragment that did not set `persist: true` is discarded, since the journey it belonged to cannot be resumed. Persistent fragments that have not been written to for longer than `EVENT_FRAGMENT_MAX_AGE` (24 hours, measured from `lastUpdated`) are also discarded, so abandoned journeys cannot keep `properties` or `sensitiveProperties` in storage indefinitely. All fragments are discarded when the consent state no longer allows accumulation. Nothing is emitted for a discarded fragment: a journey that never reached its own finalization is unfinished, not failed.
|
|
87
|
+
|
|
88
|
+
This feature is disabled by default. When disabled, every fragment method is a logged no-op and no fragment is written to state.
|
|
89
|
+
|
|
49
90
|
## Lifecycle Hooks
|
|
50
91
|
|
|
51
92
|
### `onSetupCompleted`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsController-method-action-types.cjs","sourceRoot":"","sources":["../src/AnalyticsController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { AnalyticsController } from './AnalyticsController.js';\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 */\nexport type AnalyticsControllerTrackEventAction = {\n type: `AnalyticsController:trackEvent`;\n handler: AnalyticsController['trackEvent'];\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 */\nexport type AnalyticsControllerIdentifyAction = {\n type: `AnalyticsController:identify`;\n handler: AnalyticsController['identify'];\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 */\nexport type AnalyticsControllerTrackViewAction = {\n type: `AnalyticsController:trackView`;\n handler: AnalyticsController['trackView'];\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 */\nexport type AnalyticsControllerOptInAction = {\n type: `AnalyticsController:optIn`;\n handler: AnalyticsController['optIn'];\n};\n\n/**\n * Opt out of analytics.\n *\n * Records that a consent decision has been made and discards any persisted\n * events so nothing captured before the decision is ever delivered.\n */\nexport type AnalyticsControllerOptOutAction = {\n type: `AnalyticsController:optOut`;\n handler: AnalyticsController['optOut'];\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 */\nexport type AnalyticsControllerResetConsentDecisionAction = {\n type: `AnalyticsController:resetConsentDecision`;\n handler: AnalyticsController['resetConsentDecision'];\n};\n\n/**\n * Union of all AnalyticsController action types.\n */\nexport type AnalyticsControllerMethodActions =\n | AnalyticsControllerTrackEventAction\n | AnalyticsControllerIdentifyAction\n | AnalyticsControllerTrackViewAction\n | AnalyticsControllerOptInAction\n | AnalyticsControllerOptOutAction\n | AnalyticsControllerResetConsentDecisionAction;\n"]}
|
|
1
|
+
{"version":3,"file":"AnalyticsController-method-action-types.cjs","sourceRoot":"","sources":["../src/AnalyticsController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { AnalyticsController } from './AnalyticsController.js';\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 */\nexport type AnalyticsControllerTrackEventAction = {\n type: `AnalyticsController:trackEvent`;\n handler: AnalyticsController['trackEvent'];\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 */\nexport type AnalyticsControllerIdentifyAction = {\n type: `AnalyticsController:identify`;\n handler: AnalyticsController['identify'];\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 */\nexport type AnalyticsControllerTrackViewAction = {\n type: `AnalyticsController:trackView`;\n handler: AnalyticsController['trackView'];\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 */\nexport type AnalyticsControllerCreateEventFragmentAction = {\n type: `AnalyticsController:createEventFragment`;\n handler: AnalyticsController['createEventFragment'];\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 */\nexport type AnalyticsControllerUpsertEventFragmentAction = {\n type: `AnalyticsController:upsertEventFragment`;\n handler: AnalyticsController['upsertEventFragment'];\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 */\nexport type AnalyticsControllerUpdateEventFragmentAction = {\n type: `AnalyticsController:updateEventFragment`;\n handler: AnalyticsController['updateEventFragment'];\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 */\nexport type AnalyticsControllerGetEventFragmentByIdAction = {\n type: `AnalyticsController:getEventFragmentById`;\n handler: AnalyticsController['getEventFragmentById'];\n};\n\n/**\n * Discard an event fragment without emitting anything.\n *\n * @param id - The fragment ID.\n */\nexport type AnalyticsControllerDeleteEventFragmentAction = {\n type: `AnalyticsController:deleteEventFragment`;\n handler: AnalyticsController['deleteEventFragment'];\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 */\nexport type AnalyticsControllerFinalizeEventFragmentAction = {\n type: `AnalyticsController:finalizeEventFragment`;\n handler: AnalyticsController['finalizeEventFragment'];\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 */\nexport type AnalyticsControllerOptInAction = {\n type: `AnalyticsController:optIn`;\n handler: AnalyticsController['optIn'];\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 */\nexport type AnalyticsControllerOptOutAction = {\n type: `AnalyticsController:optOut`;\n handler: AnalyticsController['optOut'];\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 */\nexport type AnalyticsControllerResetConsentDecisionAction = {\n type: `AnalyticsController:resetConsentDecision`;\n handler: AnalyticsController['resetConsentDecision'];\n};\n\n/**\n * Union of all AnalyticsController action types.\n */\nexport type AnalyticsControllerMethodActions =\n | AnalyticsControllerTrackEventAction\n | AnalyticsControllerIdentifyAction\n | AnalyticsControllerTrackViewAction\n | AnalyticsControllerCreateEventFragmentAction\n | AnalyticsControllerUpsertEventFragmentAction\n | AnalyticsControllerUpdateEventFragmentAction\n | AnalyticsControllerGetEventFragmentByIdAction\n | AnalyticsControllerDeleteEventFragmentAction\n | AnalyticsControllerFinalizeEventFragmentAction\n | AnalyticsControllerOptInAction\n | AnalyticsControllerOptOutAction\n | AnalyticsControllerResetConsentDecisionAction;\n"]}
|
|
@@ -36,6 +36,105 @@ export type AnalyticsControllerTrackViewAction = {
|
|
|
36
36
|
type: `AnalyticsController:trackView`;
|
|
37
37
|
handler: AnalyticsController['trackView'];
|
|
38
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Create an event fragment.
|
|
41
|
+
*
|
|
42
|
+
* A fragment accumulates properties across a user journey so that several
|
|
43
|
+
* parts of a client can contribute to the same set of events without
|
|
44
|
+
* re-deriving them. Declaring `successEvent` and `failureEvent` turns the
|
|
45
|
+
* fragment into a funnel that {@link finalizeEventFragment} closes. Declaring
|
|
46
|
+
* none of the event names makes it a pure property bag that the client reads
|
|
47
|
+
* back with {@link getEventFragmentById} when it emits its own events.
|
|
48
|
+
*
|
|
49
|
+
* Any existing fragment with the same ID is replaced, so a new journey never
|
|
50
|
+
* inherits properties from a stale one.
|
|
51
|
+
*
|
|
52
|
+
* Nothing is created unless the user is opted in, or undecided with the
|
|
53
|
+
* pre-consent queue enabled, so an opted-out user accumulates no fragment
|
|
54
|
+
* data.
|
|
55
|
+
*
|
|
56
|
+
* @param options - The fragment definition. An ID is generated when one is
|
|
57
|
+
* not supplied.
|
|
58
|
+
* @returns A read-only copy of the created fragment, or `undefined` when the
|
|
59
|
+
* event fragments feature is disabled or the consent state does not allow
|
|
60
|
+
* capture. Mutating the returned object does not change controller state.
|
|
61
|
+
* Use {@link updateEventFragment} or {@link upsertEventFragment} to write.
|
|
62
|
+
*/
|
|
63
|
+
export type AnalyticsControllerCreateEventFragmentAction = {
|
|
64
|
+
type: `AnalyticsController:createEventFragment`;
|
|
65
|
+
handler: AnalyticsController['createEventFragment'];
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Write to an event fragment, creating a property bag if none exists.
|
|
69
|
+
*
|
|
70
|
+
* This is the ergonomic entry point for contributors that do not know
|
|
71
|
+
* whether the journey has been started yet, and it avoids the read then
|
|
72
|
+
* write race a caller would otherwise have to implement itself.
|
|
73
|
+
*
|
|
74
|
+
* @param id - The fragment ID.
|
|
75
|
+
* @param payload - The properties and context to merge in.
|
|
76
|
+
*/
|
|
77
|
+
export type AnalyticsControllerUpsertEventFragmentAction = {
|
|
78
|
+
type: `AnalyticsController:upsertEventFragment`;
|
|
79
|
+
handler: AnalyticsController['upsertEventFragment'];
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Write to an existing event fragment.
|
|
83
|
+
*
|
|
84
|
+
* @param id - The fragment ID.
|
|
85
|
+
* @param payload - The properties and context to merge in.
|
|
86
|
+
* @throws Error if no fragment has that ID when the call is not ignored.
|
|
87
|
+
* Use {@link upsertEventFragment} when the fragment may not exist yet.
|
|
88
|
+
* When the event fragments feature is disabled or the consent state does not
|
|
89
|
+
* allow capture, the call is a logged no-op and does not throw.
|
|
90
|
+
*/
|
|
91
|
+
export type AnalyticsControllerUpdateEventFragmentAction = {
|
|
92
|
+
type: `AnalyticsController:updateEventFragment`;
|
|
93
|
+
handler: AnalyticsController['updateEventFragment'];
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Read an event fragment.
|
|
97
|
+
*
|
|
98
|
+
* @param id - The fragment ID.
|
|
99
|
+
* @returns A read-only copy of the fragment, or `undefined` when no fragment
|
|
100
|
+
* has that ID, the event fragments feature is disabled, or the consent state
|
|
101
|
+
* does not allow capture. Mutating the returned object does not change
|
|
102
|
+
* controller state. Use {@link updateEventFragment} or
|
|
103
|
+
* {@link upsertEventFragment} to write.
|
|
104
|
+
*/
|
|
105
|
+
export type AnalyticsControllerGetEventFragmentByIdAction = {
|
|
106
|
+
type: `AnalyticsController:getEventFragmentById`;
|
|
107
|
+
handler: AnalyticsController['getEventFragmentById'];
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Discard an event fragment without emitting anything.
|
|
111
|
+
*
|
|
112
|
+
* @param id - The fragment ID.
|
|
113
|
+
*/
|
|
114
|
+
export type AnalyticsControllerDeleteEventFragmentAction = {
|
|
115
|
+
type: `AnalyticsController:deleteEventFragment`;
|
|
116
|
+
handler: AnalyticsController['deleteEventFragment'];
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Close an event fragment, emitting its closing event and discarding it.
|
|
120
|
+
*
|
|
121
|
+
* The event emitted is `failureEvent` when the journey was abandoned and
|
|
122
|
+
* `successEvent` otherwise. A fragment that does not declare the relevant
|
|
123
|
+
* event name is discarded silently, which is what makes a pure property bag
|
|
124
|
+
* possible.
|
|
125
|
+
*
|
|
126
|
+
* @param id - The fragment ID.
|
|
127
|
+
* @param options - Finalization options.
|
|
128
|
+
* @param options.abandoned - Whether the journey was abandoned.
|
|
129
|
+
* @param options.context - Context merged over the fragment's own context.
|
|
130
|
+
* @throws Error if no fragment has that ID when the call is not ignored.
|
|
131
|
+
* When the event fragments feature is disabled or the consent state does not
|
|
132
|
+
* allow capture, the call is a logged no-op and does not throw.
|
|
133
|
+
*/
|
|
134
|
+
export type AnalyticsControllerFinalizeEventFragmentAction = {
|
|
135
|
+
type: `AnalyticsController:finalizeEventFragment`;
|
|
136
|
+
handler: AnalyticsController['finalizeEventFragment'];
|
|
137
|
+
};
|
|
39
138
|
/**
|
|
40
139
|
* Opt in to analytics.
|
|
41
140
|
*
|
|
@@ -56,7 +155,8 @@ export type AnalyticsControllerOptInAction = {
|
|
|
56
155
|
* Opt out of analytics.
|
|
57
156
|
*
|
|
58
157
|
* Records that a consent decision has been made and discards any persisted
|
|
59
|
-
* events so nothing captured before the
|
|
158
|
+
* events and in-progress event fragments so nothing captured before the
|
|
159
|
+
* decision is ever delivered.
|
|
60
160
|
*/
|
|
61
161
|
export type AnalyticsControllerOptOutAction = {
|
|
62
162
|
type: `AnalyticsController:optOut`;
|
|
@@ -69,6 +169,10 @@ export type AnalyticsControllerOptOutAction = {
|
|
|
69
169
|
* preference and discards the delivery queue, but preserves any pre-consent
|
|
70
170
|
* events so they can still be replayed if the user opts in again. The user is
|
|
71
171
|
* treated as undecided again.
|
|
172
|
+
*
|
|
173
|
+
* In-progress event fragments are kept only while the undecided user can
|
|
174
|
+
* still accumulate them, and discarded otherwise, so no fragment outlives the
|
|
175
|
+
* consent state that allowed it.
|
|
72
176
|
*/
|
|
73
177
|
export type AnalyticsControllerResetConsentDecisionAction = {
|
|
74
178
|
type: `AnalyticsController:resetConsentDecision`;
|
|
@@ -77,5 +181,5 @@ export type AnalyticsControllerResetConsentDecisionAction = {
|
|
|
77
181
|
/**
|
|
78
182
|
* Union of all AnalyticsController action types.
|
|
79
183
|
*/
|
|
80
|
-
export type AnalyticsControllerMethodActions = AnalyticsControllerTrackEventAction | AnalyticsControllerIdentifyAction | AnalyticsControllerTrackViewAction | AnalyticsControllerOptInAction | AnalyticsControllerOptOutAction | AnalyticsControllerResetConsentDecisionAction;
|
|
184
|
+
export type AnalyticsControllerMethodActions = AnalyticsControllerTrackEventAction | AnalyticsControllerIdentifyAction | AnalyticsControllerTrackViewAction | AnalyticsControllerCreateEventFragmentAction | AnalyticsControllerUpsertEventFragmentAction | AnalyticsControllerUpdateEventFragmentAction | AnalyticsControllerGetEventFragmentByIdAction | AnalyticsControllerDeleteEventFragmentAction | AnalyticsControllerFinalizeEventFragmentAction | AnalyticsControllerOptInAction | AnalyticsControllerOptOutAction | AnalyticsControllerResetConsentDecisionAction;
|
|
81
185
|
//# sourceMappingURL=AnalyticsController-method-action-types.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsController-method-action-types.d.cts","sourceRoot":"","sources":["../src/AnalyticsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,kCAAiC;AAEpE;;;;;;;GAOG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;CAC1C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;CACvC,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"AnalyticsController-method-action-types.d.cts","sourceRoot":"","sources":["../src/AnalyticsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,kCAAiC;AAEpE;;;;;;;GAOG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;CAC1C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,mBAAmB,CAAC,sBAAsB,CAAC,CAAC;CACtD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;CACvC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,mBAAmB,CAAC,sBAAsB,CAAC,CAAC;CACtD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gCAAgC,GACxC,mCAAmC,GACnC,iCAAiC,GACjC,kCAAkC,GAClC,4CAA4C,GAC5C,4CAA4C,GAC5C,4CAA4C,GAC5C,6CAA6C,GAC7C,4CAA4C,GAC5C,8CAA8C,GAC9C,8BAA8B,GAC9B,+BAA+B,GAC/B,6CAA6C,CAAC"}
|
|
@@ -36,6 +36,105 @@ export type AnalyticsControllerTrackViewAction = {
|
|
|
36
36
|
type: `AnalyticsController:trackView`;
|
|
37
37
|
handler: AnalyticsController['trackView'];
|
|
38
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* Create an event fragment.
|
|
41
|
+
*
|
|
42
|
+
* A fragment accumulates properties across a user journey so that several
|
|
43
|
+
* parts of a client can contribute to the same set of events without
|
|
44
|
+
* re-deriving them. Declaring `successEvent` and `failureEvent` turns the
|
|
45
|
+
* fragment into a funnel that {@link finalizeEventFragment} closes. Declaring
|
|
46
|
+
* none of the event names makes it a pure property bag that the client reads
|
|
47
|
+
* back with {@link getEventFragmentById} when it emits its own events.
|
|
48
|
+
*
|
|
49
|
+
* Any existing fragment with the same ID is replaced, so a new journey never
|
|
50
|
+
* inherits properties from a stale one.
|
|
51
|
+
*
|
|
52
|
+
* Nothing is created unless the user is opted in, or undecided with the
|
|
53
|
+
* pre-consent queue enabled, so an opted-out user accumulates no fragment
|
|
54
|
+
* data.
|
|
55
|
+
*
|
|
56
|
+
* @param options - The fragment definition. An ID is generated when one is
|
|
57
|
+
* not supplied.
|
|
58
|
+
* @returns A read-only copy of the created fragment, or `undefined` when the
|
|
59
|
+
* event fragments feature is disabled or the consent state does not allow
|
|
60
|
+
* capture. Mutating the returned object does not change controller state.
|
|
61
|
+
* Use {@link updateEventFragment} or {@link upsertEventFragment} to write.
|
|
62
|
+
*/
|
|
63
|
+
export type AnalyticsControllerCreateEventFragmentAction = {
|
|
64
|
+
type: `AnalyticsController:createEventFragment`;
|
|
65
|
+
handler: AnalyticsController['createEventFragment'];
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Write to an event fragment, creating a property bag if none exists.
|
|
69
|
+
*
|
|
70
|
+
* This is the ergonomic entry point for contributors that do not know
|
|
71
|
+
* whether the journey has been started yet, and it avoids the read then
|
|
72
|
+
* write race a caller would otherwise have to implement itself.
|
|
73
|
+
*
|
|
74
|
+
* @param id - The fragment ID.
|
|
75
|
+
* @param payload - The properties and context to merge in.
|
|
76
|
+
*/
|
|
77
|
+
export type AnalyticsControllerUpsertEventFragmentAction = {
|
|
78
|
+
type: `AnalyticsController:upsertEventFragment`;
|
|
79
|
+
handler: AnalyticsController['upsertEventFragment'];
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Write to an existing event fragment.
|
|
83
|
+
*
|
|
84
|
+
* @param id - The fragment ID.
|
|
85
|
+
* @param payload - The properties and context to merge in.
|
|
86
|
+
* @throws Error if no fragment has that ID when the call is not ignored.
|
|
87
|
+
* Use {@link upsertEventFragment} when the fragment may not exist yet.
|
|
88
|
+
* When the event fragments feature is disabled or the consent state does not
|
|
89
|
+
* allow capture, the call is a logged no-op and does not throw.
|
|
90
|
+
*/
|
|
91
|
+
export type AnalyticsControllerUpdateEventFragmentAction = {
|
|
92
|
+
type: `AnalyticsController:updateEventFragment`;
|
|
93
|
+
handler: AnalyticsController['updateEventFragment'];
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Read an event fragment.
|
|
97
|
+
*
|
|
98
|
+
* @param id - The fragment ID.
|
|
99
|
+
* @returns A read-only copy of the fragment, or `undefined` when no fragment
|
|
100
|
+
* has that ID, the event fragments feature is disabled, or the consent state
|
|
101
|
+
* does not allow capture. Mutating the returned object does not change
|
|
102
|
+
* controller state. Use {@link updateEventFragment} or
|
|
103
|
+
* {@link upsertEventFragment} to write.
|
|
104
|
+
*/
|
|
105
|
+
export type AnalyticsControllerGetEventFragmentByIdAction = {
|
|
106
|
+
type: `AnalyticsController:getEventFragmentById`;
|
|
107
|
+
handler: AnalyticsController['getEventFragmentById'];
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Discard an event fragment without emitting anything.
|
|
111
|
+
*
|
|
112
|
+
* @param id - The fragment ID.
|
|
113
|
+
*/
|
|
114
|
+
export type AnalyticsControllerDeleteEventFragmentAction = {
|
|
115
|
+
type: `AnalyticsController:deleteEventFragment`;
|
|
116
|
+
handler: AnalyticsController['deleteEventFragment'];
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Close an event fragment, emitting its closing event and discarding it.
|
|
120
|
+
*
|
|
121
|
+
* The event emitted is `failureEvent` when the journey was abandoned and
|
|
122
|
+
* `successEvent` otherwise. A fragment that does not declare the relevant
|
|
123
|
+
* event name is discarded silently, which is what makes a pure property bag
|
|
124
|
+
* possible.
|
|
125
|
+
*
|
|
126
|
+
* @param id - The fragment ID.
|
|
127
|
+
* @param options - Finalization options.
|
|
128
|
+
* @param options.abandoned - Whether the journey was abandoned.
|
|
129
|
+
* @param options.context - Context merged over the fragment's own context.
|
|
130
|
+
* @throws Error if no fragment has that ID when the call is not ignored.
|
|
131
|
+
* When the event fragments feature is disabled or the consent state does not
|
|
132
|
+
* allow capture, the call is a logged no-op and does not throw.
|
|
133
|
+
*/
|
|
134
|
+
export type AnalyticsControllerFinalizeEventFragmentAction = {
|
|
135
|
+
type: `AnalyticsController:finalizeEventFragment`;
|
|
136
|
+
handler: AnalyticsController['finalizeEventFragment'];
|
|
137
|
+
};
|
|
39
138
|
/**
|
|
40
139
|
* Opt in to analytics.
|
|
41
140
|
*
|
|
@@ -56,7 +155,8 @@ export type AnalyticsControllerOptInAction = {
|
|
|
56
155
|
* Opt out of analytics.
|
|
57
156
|
*
|
|
58
157
|
* Records that a consent decision has been made and discards any persisted
|
|
59
|
-
* events so nothing captured before the
|
|
158
|
+
* events and in-progress event fragments so nothing captured before the
|
|
159
|
+
* decision is ever delivered.
|
|
60
160
|
*/
|
|
61
161
|
export type AnalyticsControllerOptOutAction = {
|
|
62
162
|
type: `AnalyticsController:optOut`;
|
|
@@ -69,6 +169,10 @@ export type AnalyticsControllerOptOutAction = {
|
|
|
69
169
|
* preference and discards the delivery queue, but preserves any pre-consent
|
|
70
170
|
* events so they can still be replayed if the user opts in again. The user is
|
|
71
171
|
* treated as undecided again.
|
|
172
|
+
*
|
|
173
|
+
* In-progress event fragments are kept only while the undecided user can
|
|
174
|
+
* still accumulate them, and discarded otherwise, so no fragment outlives the
|
|
175
|
+
* consent state that allowed it.
|
|
72
176
|
*/
|
|
73
177
|
export type AnalyticsControllerResetConsentDecisionAction = {
|
|
74
178
|
type: `AnalyticsController:resetConsentDecision`;
|
|
@@ -77,5 +181,5 @@ export type AnalyticsControllerResetConsentDecisionAction = {
|
|
|
77
181
|
/**
|
|
78
182
|
* Union of all AnalyticsController action types.
|
|
79
183
|
*/
|
|
80
|
-
export type AnalyticsControllerMethodActions = AnalyticsControllerTrackEventAction | AnalyticsControllerIdentifyAction | AnalyticsControllerTrackViewAction | AnalyticsControllerOptInAction | AnalyticsControllerOptOutAction | AnalyticsControllerResetConsentDecisionAction;
|
|
184
|
+
export type AnalyticsControllerMethodActions = AnalyticsControllerTrackEventAction | AnalyticsControllerIdentifyAction | AnalyticsControllerTrackViewAction | AnalyticsControllerCreateEventFragmentAction | AnalyticsControllerUpsertEventFragmentAction | AnalyticsControllerUpdateEventFragmentAction | AnalyticsControllerGetEventFragmentByIdAction | AnalyticsControllerDeleteEventFragmentAction | AnalyticsControllerFinalizeEventFragmentAction | AnalyticsControllerOptInAction | AnalyticsControllerOptOutAction | AnalyticsControllerResetConsentDecisionAction;
|
|
81
185
|
//# sourceMappingURL=AnalyticsController-method-action-types.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsController-method-action-types.d.mts","sourceRoot":"","sources":["../src/AnalyticsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,kCAAiC;AAEpE;;;;;;;GAOG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;CAC1C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;CACvC,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"AnalyticsController-method-action-types.d.mts","sourceRoot":"","sources":["../src/AnalyticsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,kCAAiC;AAEpE;;;;;;;GAOG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,IAAI,EAAE,gCAAgC,CAAC;IACvC,OAAO,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;CAC5C,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,iCAAiC,GAAG;IAC9C,IAAI,EAAE,8BAA8B,CAAC;IACrC,OAAO,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;CAC1C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,kCAAkC,GAAG;IAC/C,IAAI,EAAE,+BAA+B,CAAC;IACtC,OAAO,EAAE,mBAAmB,CAAC,WAAW,CAAC,CAAC;CAC3C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,mBAAmB,CAAC,sBAAsB,CAAC,CAAC;CACtD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,mBAAmB,CAAC,qBAAqB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,8CAA8C,GAAG;IAC3D,IAAI,EAAE,2CAA2C,CAAC;IAClD,OAAO,EAAE,mBAAmB,CAAC,uBAAuB,CAAC,CAAC;CACvD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,2BAA2B,CAAC;IAClC,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;CACvC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,4BAA4B,CAAC;IACnC,OAAO,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;CACxC,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,mBAAmB,CAAC,sBAAsB,CAAC,CAAC;CACtD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gCAAgC,GACxC,mCAAmC,GACnC,iCAAiC,GACjC,kCAAkC,GAClC,4CAA4C,GAC5C,4CAA4C,GAC5C,4CAA4C,GAC5C,6CAA6C,GAC7C,4CAA4C,GAC5C,8CAA8C,GAC9C,8BAA8B,GAC9B,+BAA+B,GAC/B,6CAA6C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsController-method-action-types.mjs","sourceRoot":"","sources":["../src/AnalyticsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { AnalyticsController } from './AnalyticsController.js';\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 */\nexport type AnalyticsControllerTrackEventAction = {\n type: `AnalyticsController:trackEvent`;\n handler: AnalyticsController['trackEvent'];\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 */\nexport type AnalyticsControllerIdentifyAction = {\n type: `AnalyticsController:identify`;\n handler: AnalyticsController['identify'];\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 */\nexport type AnalyticsControllerTrackViewAction = {\n type: `AnalyticsController:trackView`;\n handler: AnalyticsController['trackView'];\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 */\nexport type AnalyticsControllerOptInAction = {\n type: `AnalyticsController:optIn`;\n handler: AnalyticsController['optIn'];\n};\n\n/**\n * Opt out of analytics.\n *\n * Records that a consent decision has been made and discards any persisted\n * events so nothing captured before the decision is ever delivered.\n */\nexport type AnalyticsControllerOptOutAction = {\n type: `AnalyticsController:optOut`;\n handler: AnalyticsController['optOut'];\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 */\nexport type AnalyticsControllerResetConsentDecisionAction = {\n type: `AnalyticsController:resetConsentDecision`;\n handler: AnalyticsController['resetConsentDecision'];\n};\n\n/**\n * Union of all AnalyticsController action types.\n */\nexport type AnalyticsControllerMethodActions =\n | AnalyticsControllerTrackEventAction\n | AnalyticsControllerIdentifyAction\n | AnalyticsControllerTrackViewAction\n | AnalyticsControllerOptInAction\n | AnalyticsControllerOptOutAction\n | AnalyticsControllerResetConsentDecisionAction;\n"]}
|
|
1
|
+
{"version":3,"file":"AnalyticsController-method-action-types.mjs","sourceRoot":"","sources":["../src/AnalyticsController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { AnalyticsController } from './AnalyticsController.js';\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 */\nexport type AnalyticsControllerTrackEventAction = {\n type: `AnalyticsController:trackEvent`;\n handler: AnalyticsController['trackEvent'];\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 */\nexport type AnalyticsControllerIdentifyAction = {\n type: `AnalyticsController:identify`;\n handler: AnalyticsController['identify'];\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 */\nexport type AnalyticsControllerTrackViewAction = {\n type: `AnalyticsController:trackView`;\n handler: AnalyticsController['trackView'];\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 */\nexport type AnalyticsControllerCreateEventFragmentAction = {\n type: `AnalyticsController:createEventFragment`;\n handler: AnalyticsController['createEventFragment'];\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 */\nexport type AnalyticsControllerUpsertEventFragmentAction = {\n type: `AnalyticsController:upsertEventFragment`;\n handler: AnalyticsController['upsertEventFragment'];\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 */\nexport type AnalyticsControllerUpdateEventFragmentAction = {\n type: `AnalyticsController:updateEventFragment`;\n handler: AnalyticsController['updateEventFragment'];\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 */\nexport type AnalyticsControllerGetEventFragmentByIdAction = {\n type: `AnalyticsController:getEventFragmentById`;\n handler: AnalyticsController['getEventFragmentById'];\n};\n\n/**\n * Discard an event fragment without emitting anything.\n *\n * @param id - The fragment ID.\n */\nexport type AnalyticsControllerDeleteEventFragmentAction = {\n type: `AnalyticsController:deleteEventFragment`;\n handler: AnalyticsController['deleteEventFragment'];\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 */\nexport type AnalyticsControllerFinalizeEventFragmentAction = {\n type: `AnalyticsController:finalizeEventFragment`;\n handler: AnalyticsController['finalizeEventFragment'];\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 */\nexport type AnalyticsControllerOptInAction = {\n type: `AnalyticsController:optIn`;\n handler: AnalyticsController['optIn'];\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 */\nexport type AnalyticsControllerOptOutAction = {\n type: `AnalyticsController:optOut`;\n handler: AnalyticsController['optOut'];\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 */\nexport type AnalyticsControllerResetConsentDecisionAction = {\n type: `AnalyticsController:resetConsentDecision`;\n handler: AnalyticsController['resetConsentDecision'];\n};\n\n/**\n * Union of all AnalyticsController action types.\n */\nexport type AnalyticsControllerMethodActions =\n | AnalyticsControllerTrackEventAction\n | AnalyticsControllerIdentifyAction\n | AnalyticsControllerTrackViewAction\n | AnalyticsControllerCreateEventFragmentAction\n | AnalyticsControllerUpsertEventFragmentAction\n | AnalyticsControllerUpdateEventFragmentAction\n | AnalyticsControllerGetEventFragmentByIdAction\n | AnalyticsControllerDeleteEventFragmentAction\n | AnalyticsControllerFinalizeEventFragmentAction\n | AnalyticsControllerOptInAction\n | AnalyticsControllerOptOutAction\n | AnalyticsControllerResetConsentDecisionAction;\n"]}
|