@metamask-previews/analytics-controller 2.0.0-preview-0d04fb622 → 2.0.0-preview-6b7c25c
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 +0 -4
- package/README.md +5 -46
- package/dist/AnalyticsController-method-action-types.cjs.map +1 -1
- package/dist/AnalyticsController-method-action-types.d.cts +2 -102
- package/dist/AnalyticsController-method-action-types.d.cts.map +1 -1
- package/dist/AnalyticsController-method-action-types.d.mts +2 -102
- 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 +13 -341
- package/dist/AnalyticsController.cjs.map +1 -1
- package/dist/AnalyticsController.d.cts +2 -105
- package/dist/AnalyticsController.d.cts.map +1 -1
- package/dist/AnalyticsController.d.mts +2 -105
- package/dist/AnalyticsController.d.mts.map +1 -1
- package/dist/AnalyticsController.mjs +13 -341
- package/dist/AnalyticsController.mjs.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +1 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/selectors.cjs +0 -19
- package/dist/selectors.cjs.map +1 -1
- package/dist/selectors.d.cts +0 -3
- package/dist/selectors.d.cts.map +1 -1
- package/dist/selectors.d.mts +0 -3
- package/dist/selectors.d.mts.map +1 -1
- package/dist/selectors.mjs +0 -19
- package/dist/selectors.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/EventFragment.types.cjs +0 -3
- package/dist/EventFragment.types.cjs.map +0 -1
- package/dist/EventFragment.types.d.cts +0 -88
- package/dist/EventFragment.types.d.cts.map +0 -1
- package/dist/EventFragment.types.d.mts +0 -88
- package/dist/EventFragment.types.d.mts.map +0 -1
- package/dist/EventFragment.types.mjs +0 -2
- package/dist/EventFragment.types.mjs.map +0 -1
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import type { AnalyticsContext, AnalyticsEventProperties } from "./AnalyticsPlatformAdapter.types.cjs";
|
|
2
|
-
/**
|
|
3
|
-
* A bag of analytics properties that accumulates across a user journey.
|
|
4
|
-
*
|
|
5
|
-
* A fragment lets several parts of a client contribute properties to the same
|
|
6
|
-
* logical journey (a signature request, a transaction confirmation) without
|
|
7
|
-
* having to re-derive them for every event, and lets the journey be closed as
|
|
8
|
-
* a success or a failure.
|
|
9
|
-
*
|
|
10
|
-
* All three event names are optional. A fragment that declares none of them
|
|
11
|
-
* never emits anything and acts purely as a property bag that the client reads
|
|
12
|
-
* back with {@link AnalyticsController.getEventFragmentById} at the moment it
|
|
13
|
-
* emits its own event.
|
|
14
|
-
*/
|
|
15
|
-
export type AnalyticsEventFragment = {
|
|
16
|
-
/**
|
|
17
|
-
* The fragment identifier, unique per client.
|
|
18
|
-
*/
|
|
19
|
-
id: string;
|
|
20
|
-
/**
|
|
21
|
-
* Properties tracked with every event this fragment emits.
|
|
22
|
-
*/
|
|
23
|
-
properties: AnalyticsEventProperties;
|
|
24
|
-
/**
|
|
25
|
-
* Properties that must not be linked to the user's analytics ID. They are
|
|
26
|
-
* delivered on a separate anonymous payload when the anonymous events
|
|
27
|
-
* feature is enabled.
|
|
28
|
-
*/
|
|
29
|
-
sensitiveProperties: AnalyticsEventProperties;
|
|
30
|
-
/**
|
|
31
|
-
* Name of an event emitted immediately when the fragment is created.
|
|
32
|
-
*/
|
|
33
|
-
initialEvent?: string;
|
|
34
|
-
/**
|
|
35
|
-
* Name of the event emitted when the fragment is finalized normally.
|
|
36
|
-
*/
|
|
37
|
-
successEvent?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Name of the event emitted when the fragment is finalized as abandoned.
|
|
40
|
-
*/
|
|
41
|
-
failureEvent?: string;
|
|
42
|
-
/**
|
|
43
|
-
* Platform-specific context forwarded with every event this fragment emits.
|
|
44
|
-
*/
|
|
45
|
-
context?: AnalyticsContext;
|
|
46
|
-
/**
|
|
47
|
-
* Whether the fragment survives {@link AnalyticsController.init}. Fragments
|
|
48
|
-
* that do not set this are discarded when the controller re-initializes,
|
|
49
|
-
* since the journey they belonged to cannot be resumed.
|
|
50
|
-
*/
|
|
51
|
-
persist?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* `Date.now()` when the fragment was created.
|
|
54
|
-
*/
|
|
55
|
-
createdAt: number;
|
|
56
|
-
/**
|
|
57
|
-
* `Date.now()` when the fragment was last written to.
|
|
58
|
-
*/
|
|
59
|
-
lastUpdated: number;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Event fragments keyed by fragment ID.
|
|
63
|
-
*/
|
|
64
|
-
export type AnalyticsEventFragments = Record<string, AnalyticsEventFragment>;
|
|
65
|
-
/**
|
|
66
|
-
* Options accepted when creating an event fragment. An `id` is generated when
|
|
67
|
-
* one is not supplied.
|
|
68
|
-
*/
|
|
69
|
-
export type AnalyticsEventFragmentOptions = Partial<Pick<AnalyticsEventFragment, 'id' | 'initialEvent' | 'successEvent' | 'failureEvent' | 'properties' | 'sensitiveProperties' | 'context' | 'persist'>>;
|
|
70
|
-
/**
|
|
71
|
-
* The fields that can be written to an existing event fragment.
|
|
72
|
-
*/
|
|
73
|
-
export type AnalyticsEventFragmentPayload = Pick<AnalyticsEventFragmentOptions, 'properties' | 'sensitiveProperties' | 'context'>;
|
|
74
|
-
/**
|
|
75
|
-
* Options accepted when finalizing an event fragment.
|
|
76
|
-
*/
|
|
77
|
-
export type AnalyticsEventFragmentFinalizeOptions = {
|
|
78
|
-
/**
|
|
79
|
-
* Whether the journey was abandoned, which selects `failureEvent` instead of
|
|
80
|
-
* `successEvent`.
|
|
81
|
-
*/
|
|
82
|
-
abandoned?: boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Context merged over the fragment's own context for the emitted event.
|
|
85
|
-
*/
|
|
86
|
-
context?: AnalyticsContext;
|
|
87
|
-
};
|
|
88
|
-
//# sourceMappingURL=EventFragment.types.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventFragment.types.d.cts","sourceRoot":"","sources":["../src/EventFragment.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACzB,6CAAyC;AAE1C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,UAAU,EAAE,wBAAwB,CAAC;IAErC;;;;OAIG;IACH,mBAAmB,EAAE,wBAAwB,CAAC;IAE9C;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAE3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;AAE7E;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GAAG,OAAO,CACjD,IAAI,CACF,sBAAsB,EACpB,IAAI,GACJ,cAAc,GACd,cAAc,GACd,cAAc,GACd,YAAY,GACZ,qBAAqB,GACrB,SAAS,GACT,SAAS,CACZ,CACF,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAC9C,6BAA6B,EAC7B,YAAY,GAAG,qBAAqB,GAAG,SAAS,CACjD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B,CAAC"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import type { AnalyticsContext, AnalyticsEventProperties } from "./AnalyticsPlatformAdapter.types.mjs";
|
|
2
|
-
/**
|
|
3
|
-
* A bag of analytics properties that accumulates across a user journey.
|
|
4
|
-
*
|
|
5
|
-
* A fragment lets several parts of a client contribute properties to the same
|
|
6
|
-
* logical journey (a signature request, a transaction confirmation) without
|
|
7
|
-
* having to re-derive them for every event, and lets the journey be closed as
|
|
8
|
-
* a success or a failure.
|
|
9
|
-
*
|
|
10
|
-
* All three event names are optional. A fragment that declares none of them
|
|
11
|
-
* never emits anything and acts purely as a property bag that the client reads
|
|
12
|
-
* back with {@link AnalyticsController.getEventFragmentById} at the moment it
|
|
13
|
-
* emits its own event.
|
|
14
|
-
*/
|
|
15
|
-
export type AnalyticsEventFragment = {
|
|
16
|
-
/**
|
|
17
|
-
* The fragment identifier, unique per client.
|
|
18
|
-
*/
|
|
19
|
-
id: string;
|
|
20
|
-
/**
|
|
21
|
-
* Properties tracked with every event this fragment emits.
|
|
22
|
-
*/
|
|
23
|
-
properties: AnalyticsEventProperties;
|
|
24
|
-
/**
|
|
25
|
-
* Properties that must not be linked to the user's analytics ID. They are
|
|
26
|
-
* delivered on a separate anonymous payload when the anonymous events
|
|
27
|
-
* feature is enabled.
|
|
28
|
-
*/
|
|
29
|
-
sensitiveProperties: AnalyticsEventProperties;
|
|
30
|
-
/**
|
|
31
|
-
* Name of an event emitted immediately when the fragment is created.
|
|
32
|
-
*/
|
|
33
|
-
initialEvent?: string;
|
|
34
|
-
/**
|
|
35
|
-
* Name of the event emitted when the fragment is finalized normally.
|
|
36
|
-
*/
|
|
37
|
-
successEvent?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Name of the event emitted when the fragment is finalized as abandoned.
|
|
40
|
-
*/
|
|
41
|
-
failureEvent?: string;
|
|
42
|
-
/**
|
|
43
|
-
* Platform-specific context forwarded with every event this fragment emits.
|
|
44
|
-
*/
|
|
45
|
-
context?: AnalyticsContext;
|
|
46
|
-
/**
|
|
47
|
-
* Whether the fragment survives {@link AnalyticsController.init}. Fragments
|
|
48
|
-
* that do not set this are discarded when the controller re-initializes,
|
|
49
|
-
* since the journey they belonged to cannot be resumed.
|
|
50
|
-
*/
|
|
51
|
-
persist?: boolean;
|
|
52
|
-
/**
|
|
53
|
-
* `Date.now()` when the fragment was created.
|
|
54
|
-
*/
|
|
55
|
-
createdAt: number;
|
|
56
|
-
/**
|
|
57
|
-
* `Date.now()` when the fragment was last written to.
|
|
58
|
-
*/
|
|
59
|
-
lastUpdated: number;
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Event fragments keyed by fragment ID.
|
|
63
|
-
*/
|
|
64
|
-
export type AnalyticsEventFragments = Record<string, AnalyticsEventFragment>;
|
|
65
|
-
/**
|
|
66
|
-
* Options accepted when creating an event fragment. An `id` is generated when
|
|
67
|
-
* one is not supplied.
|
|
68
|
-
*/
|
|
69
|
-
export type AnalyticsEventFragmentOptions = Partial<Pick<AnalyticsEventFragment, 'id' | 'initialEvent' | 'successEvent' | 'failureEvent' | 'properties' | 'sensitiveProperties' | 'context' | 'persist'>>;
|
|
70
|
-
/**
|
|
71
|
-
* The fields that can be written to an existing event fragment.
|
|
72
|
-
*/
|
|
73
|
-
export type AnalyticsEventFragmentPayload = Pick<AnalyticsEventFragmentOptions, 'properties' | 'sensitiveProperties' | 'context'>;
|
|
74
|
-
/**
|
|
75
|
-
* Options accepted when finalizing an event fragment.
|
|
76
|
-
*/
|
|
77
|
-
export type AnalyticsEventFragmentFinalizeOptions = {
|
|
78
|
-
/**
|
|
79
|
-
* Whether the journey was abandoned, which selects `failureEvent` instead of
|
|
80
|
-
* `successEvent`.
|
|
81
|
-
*/
|
|
82
|
-
abandoned?: boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Context merged over the fragment's own context for the emitted event.
|
|
85
|
-
*/
|
|
86
|
-
context?: AnalyticsContext;
|
|
87
|
-
};
|
|
88
|
-
//# sourceMappingURL=EventFragment.types.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventFragment.types.d.mts","sourceRoot":"","sources":["../src/EventFragment.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,wBAAwB,EACzB,6CAAyC;AAE1C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,UAAU,EAAE,wBAAwB,CAAC;IAErC;;;;OAIG;IACH,mBAAmB,EAAE,wBAAwB,CAAC;IAE9C;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAE3B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;AAE7E;;;GAGG;AACH,MAAM,MAAM,6BAA6B,GAAG,OAAO,CACjD,IAAI,CACF,sBAAsB,EACpB,IAAI,GACJ,cAAc,GACd,cAAc,GACd,cAAc,GACd,YAAY,GACZ,qBAAqB,GACrB,SAAS,GACT,SAAS,CACZ,CACF,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAC9C,6BAA6B,EAC7B,YAAY,GAAG,qBAAqB,GAAG,SAAS,CACjD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAAG;IAClD;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;CAC5B,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EventFragment.types.mjs","sourceRoot":"","sources":["../src/EventFragment.types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n AnalyticsContext,\n AnalyticsEventProperties,\n} from './AnalyticsPlatformAdapter.types';\n\n/**\n * A bag of analytics properties that accumulates across a user journey.\n *\n * A fragment lets several parts of a client contribute properties to the same\n * logical journey (a signature request, a transaction confirmation) without\n * having to re-derive them for every event, and lets the journey be closed as\n * a success or a failure.\n *\n * All three event names are optional. A fragment that declares none of them\n * never emits anything and acts purely as a property bag that the client reads\n * back with {@link AnalyticsController.getEventFragmentById} at the moment it\n * emits its own event.\n */\nexport type AnalyticsEventFragment = {\n /**\n * The fragment identifier, unique per client.\n */\n id: string;\n\n /**\n * Properties tracked with every event this fragment emits.\n */\n properties: AnalyticsEventProperties;\n\n /**\n * Properties that must not be linked to the user's analytics ID. They are\n * delivered on a separate anonymous payload when the anonymous events\n * feature is enabled.\n */\n sensitiveProperties: AnalyticsEventProperties;\n\n /**\n * Name of an event emitted immediately when the fragment is created.\n */\n initialEvent?: string;\n\n /**\n * Name of the event emitted when the fragment is finalized normally.\n */\n successEvent?: string;\n\n /**\n * Name of the event emitted when the fragment is finalized as abandoned.\n */\n failureEvent?: string;\n\n /**\n * Platform-specific context forwarded with every event this fragment emits.\n */\n context?: AnalyticsContext;\n\n /**\n * Whether the fragment survives {@link AnalyticsController.init}. Fragments\n * that do not set this are discarded when the controller re-initializes,\n * since the journey they belonged to cannot be resumed.\n */\n persist?: boolean;\n\n /**\n * `Date.now()` when the fragment was created.\n */\n createdAt: number;\n\n /**\n * `Date.now()` when the fragment was last written to.\n */\n lastUpdated: number;\n};\n\n/**\n * Event fragments keyed by fragment ID.\n */\nexport type AnalyticsEventFragments = Record<string, AnalyticsEventFragment>;\n\n/**\n * Options accepted when creating an event fragment. An `id` is generated when\n * one is not supplied.\n */\nexport type AnalyticsEventFragmentOptions = Partial<\n Pick<\n AnalyticsEventFragment,\n | 'id'\n | 'initialEvent'\n | 'successEvent'\n | 'failureEvent'\n | 'properties'\n | 'sensitiveProperties'\n | 'context'\n | 'persist'\n >\n>;\n\n/**\n * The fields that can be written to an existing event fragment.\n */\nexport type AnalyticsEventFragmentPayload = Pick<\n AnalyticsEventFragmentOptions,\n 'properties' | 'sensitiveProperties' | 'context'\n>;\n\n/**\n * Options accepted when finalizing an event fragment.\n */\nexport type AnalyticsEventFragmentFinalizeOptions = {\n /**\n * Whether the journey was abandoned, which selects `failureEvent` instead of\n * `successEvent`.\n */\n abandoned?: boolean;\n\n /**\n * Context merged over the fragment's own context for the emitted event.\n */\n context?: AnalyticsContext;\n};\n"]}
|