@metamask-previews/analytics-data-regulation-controller 0.0.0-preview-52f4a2ca

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 (68) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/LICENSE +20 -0
  3. package/README.md +15 -0
  4. package/dist/AnalyticsDataRegulationController-method-action-types.cjs +7 -0
  5. package/dist/AnalyticsDataRegulationController-method-action-types.cjs.map +1 -0
  6. package/dist/AnalyticsDataRegulationController-method-action-types.d.cts +44 -0
  7. package/dist/AnalyticsDataRegulationController-method-action-types.d.cts.map +1 -0
  8. package/dist/AnalyticsDataRegulationController-method-action-types.d.mts +44 -0
  9. package/dist/AnalyticsDataRegulationController-method-action-types.d.mts.map +1 -0
  10. package/dist/AnalyticsDataRegulationController-method-action-types.mjs +6 -0
  11. package/dist/AnalyticsDataRegulationController-method-action-types.mjs.map +1 -0
  12. package/dist/AnalyticsDataRegulationController.cjs +176 -0
  13. package/dist/AnalyticsDataRegulationController.cjs.map +1 -0
  14. package/dist/AnalyticsDataRegulationController.d.cts +147 -0
  15. package/dist/AnalyticsDataRegulationController.d.cts.map +1 -0
  16. package/dist/AnalyticsDataRegulationController.d.mts +147 -0
  17. package/dist/AnalyticsDataRegulationController.d.mts.map +1 -0
  18. package/dist/AnalyticsDataRegulationController.mjs +171 -0
  19. package/dist/AnalyticsDataRegulationController.mjs.map +1 -0
  20. package/dist/AnalyticsDataRegulationService-method-action-types.cjs +7 -0
  21. package/dist/AnalyticsDataRegulationService-method-action-types.cjs.map +1 -0
  22. package/dist/AnalyticsDataRegulationService-method-action-types.d.cts +32 -0
  23. package/dist/AnalyticsDataRegulationService-method-action-types.d.cts.map +1 -0
  24. package/dist/AnalyticsDataRegulationService-method-action-types.d.mts +32 -0
  25. package/dist/AnalyticsDataRegulationService-method-action-types.d.mts.map +1 -0
  26. package/dist/AnalyticsDataRegulationService-method-action-types.mjs +6 -0
  27. package/dist/AnalyticsDataRegulationService-method-action-types.mjs.map +1 -0
  28. package/dist/AnalyticsDataRegulationService.cjs +247 -0
  29. package/dist/AnalyticsDataRegulationService.cjs.map +1 -0
  30. package/dist/AnalyticsDataRegulationService.d.cts +172 -0
  31. package/dist/AnalyticsDataRegulationService.d.cts.map +1 -0
  32. package/dist/AnalyticsDataRegulationService.d.mts +172 -0
  33. package/dist/AnalyticsDataRegulationService.d.mts.map +1 -0
  34. package/dist/AnalyticsDataRegulationService.mjs +243 -0
  35. package/dist/AnalyticsDataRegulationService.mjs.map +1 -0
  36. package/dist/index.cjs +14 -0
  37. package/dist/index.cjs.map +1 -0
  38. package/dist/index.d.cts +11 -0
  39. package/dist/index.d.cts.map +1 -0
  40. package/dist/index.d.mts +11 -0
  41. package/dist/index.d.mts.map +1 -0
  42. package/dist/index.mjs +5 -0
  43. package/dist/index.mjs.map +1 -0
  44. package/dist/logger.cjs +7 -0
  45. package/dist/logger.cjs.map +1 -0
  46. package/dist/logger.d.cts +3 -0
  47. package/dist/logger.d.cts.map +1 -0
  48. package/dist/logger.d.mts +3 -0
  49. package/dist/logger.d.mts.map +1 -0
  50. package/dist/logger.mjs +4 -0
  51. package/dist/logger.mjs.map +1 -0
  52. package/dist/selectors.cjs +34 -0
  53. package/dist/selectors.cjs.map +1 -0
  54. package/dist/selectors.d.cts +11 -0
  55. package/dist/selectors.d.cts.map +1 -0
  56. package/dist/selectors.d.mts +11 -0
  57. package/dist/selectors.d.mts.map +1 -0
  58. package/dist/selectors.mjs +31 -0
  59. package/dist/selectors.mjs.map +1 -0
  60. package/dist/types.cjs +25 -0
  61. package/dist/types.cjs.map +1 -0
  62. package/dist/types.d.cts +46 -0
  63. package/dist/types.d.cts.map +1 -0
  64. package/dist/types.d.mts +46 -0
  65. package/dist/types.d.mts.map +1 -0
  66. package/dist/types.mjs +22 -0
  67. package/dist/types.mjs.map +1 -0
  68. package/package.json +76 -0
@@ -0,0 +1,147 @@
1
+ import type { ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
2
+ import { BaseController } from "@metamask/base-controller";
3
+ import type { Messenger } from "@metamask/messenger";
4
+ import type { AnalyticsDataRegulationControllerMethodActions } from "./AnalyticsDataRegulationController-method-action-types.mjs";
5
+ import type { AnalyticsDataRegulationServiceActions } from "./AnalyticsDataRegulationService.mjs";
6
+ import { DATA_DELETE_RESPONSE_STATUSES } from "./types.mjs";
7
+ import type { DeleteRegulationResponse, DeleteRegulationStatus } from "./types.mjs";
8
+ /**
9
+ * The name of the {@link AnalyticsDataRegulationController}, used to namespace the
10
+ * controller's actions and events and to namespace the controller's state data
11
+ * when composed with other controllers.
12
+ */
13
+ export declare const controllerName = "AnalyticsDataRegulationController";
14
+ /**
15
+ * Describes the shape of the state object for {@link AnalyticsDataRegulationController}.
16
+ */
17
+ export type AnalyticsDataRegulationControllerState = {
18
+ /**
19
+ * Indicates if data has been recorded since the last deletion request.
20
+ */
21
+ hasCollectedDataSinceDeletionRequest: boolean;
22
+ /**
23
+ * Segment's data deletion regulation ID.
24
+ * The ID returned by the Segment delete API which allows checking the status of the deletion request.
25
+ */
26
+ deleteRegulationId?: string;
27
+ /**
28
+ * Segment's data deletion regulation creation timestamp.
29
+ * The timestamp (in milliseconds since epoch) when the deletion request was created.
30
+ */
31
+ deleteRegulationTimestamp?: number;
32
+ };
33
+ /**
34
+ * Returns default values for AnalyticsDataRegulationController state.
35
+ *
36
+ * @returns Default state
37
+ */
38
+ export declare function getDefaultAnalyticsDataRegulationControllerState(): AnalyticsDataRegulationControllerState;
39
+ /**
40
+ * Returns the state of the {@link AnalyticsDataRegulationController}.
41
+ */
42
+ export type AnalyticsDataRegulationControllerGetStateAction = ControllerGetStateAction<typeof controllerName, AnalyticsDataRegulationControllerState>;
43
+ /**
44
+ * Actions that {@link AnalyticsDataRegulationControllerMessenger} exposes to other consumers.
45
+ */
46
+ export type AnalyticsDataRegulationControllerActions = AnalyticsDataRegulationControllerGetStateAction | AnalyticsDataRegulationControllerMethodActions;
47
+ /**
48
+ * Actions from other messengers that {@link AnalyticsDataRegulationControllerMessenger} calls.
49
+ */
50
+ type AllowedActions = AnalyticsDataRegulationServiceActions;
51
+ /**
52
+ * Event emitted when a data deletion task is created.
53
+ */
54
+ export type DataDeletionTaskCreatedEvent = {
55
+ type: `${typeof controllerName}:dataDeletionTaskCreated`;
56
+ payload: [DeleteRegulationResponse];
57
+ };
58
+ /**
59
+ * Event emitted when the data recording flag is updated.
60
+ */
61
+ export type DataRecordingFlagUpdatedEvent = {
62
+ type: `${typeof controllerName}:dataRecordingFlagUpdated`;
63
+ payload: [boolean];
64
+ };
65
+ /**
66
+ * Event emitted when the state of the {@link AnalyticsDataRegulationController} changes.
67
+ */
68
+ export type AnalyticsDataRegulationControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, AnalyticsDataRegulationControllerState>;
69
+ /**
70
+ * Events that {@link AnalyticsDataRegulationControllerMessenger} exposes to other consumers.
71
+ */
72
+ export type AnalyticsDataRegulationControllerEvents = AnalyticsDataRegulationControllerStateChangeEvent | DataDeletionTaskCreatedEvent | DataRecordingFlagUpdatedEvent;
73
+ /**
74
+ * Events from other messengers that {@link AnalyticsDataRegulationControllerMessenger} subscribes to.
75
+ */
76
+ type AllowedEvents = never;
77
+ /**
78
+ * The messenger restricted to actions and events accessed by
79
+ * {@link AnalyticsDataRegulationController}.
80
+ */
81
+ export type AnalyticsDataRegulationControllerMessenger = Messenger<typeof controllerName, AnalyticsDataRegulationControllerActions | AllowedActions, AnalyticsDataRegulationControllerEvents | AllowedEvents>;
82
+ /**
83
+ * The options that AnalyticsDataRegulationController takes.
84
+ */
85
+ export type AnalyticsDataRegulationControllerOptions = {
86
+ /**
87
+ * Initial controller state.
88
+ */
89
+ state?: Partial<AnalyticsDataRegulationControllerState>;
90
+ /**
91
+ * Messenger used to communicate with BaseController and other controllers.
92
+ */
93
+ messenger: AnalyticsDataRegulationControllerMessenger;
94
+ /**
95
+ * Analytics ID used for data deletion requests.
96
+ */
97
+ analyticsId: string;
98
+ };
99
+ /**
100
+ * The AnalyticsDataRegulationController manages analytics privacy and GDPR/CCPA data deletion functionality.
101
+ * It communicates with Segment's Regulations API via a proxy to create and monitor data deletion requests.
102
+ *
103
+ * This controller follows the MetaMask controller pattern and integrates with the
104
+ * messenger system to allow other controllers and components to manage data deletion tasks.
105
+ */
106
+ export declare class AnalyticsDataRegulationController extends BaseController<typeof controllerName, AnalyticsDataRegulationControllerState, AnalyticsDataRegulationControllerMessenger> {
107
+ #private;
108
+ /**
109
+ * Constructs an AnalyticsDataRegulationController instance.
110
+ *
111
+ * @param options - Controller options
112
+ * @param options.state - Initial controller state. Use `getDefaultAnalyticsDataRegulationControllerState()` for defaults.
113
+ * @param options.messenger - Messenger used to communicate with BaseController
114
+ * @param options.analyticsId - Analytics ID used for data deletion requests
115
+ */
116
+ constructor({ state, messenger, analyticsId, }: AnalyticsDataRegulationControllerOptions);
117
+ /**
118
+ * Creates a new delete regulation for the user.
119
+ * This is necessary to respect the GDPR and CCPA regulations.
120
+ *
121
+ * @returns Promise containing the status of the request with regulateId
122
+ * @throws Error if analytics ID is missing or if the service call fails
123
+ */
124
+ createDataDeletionTask(): Promise<{
125
+ status: typeof DATA_DELETE_RESPONSE_STATUSES.Success;
126
+ regulateId: string;
127
+ }>;
128
+ /**
129
+ * Check the latest delete regulation status.
130
+ *
131
+ * @returns Promise containing the timestamp, delete status and collected data flag
132
+ */
133
+ checkDataDeleteStatus(): Promise<DeleteRegulationStatus>;
134
+ /**
135
+ * Update the data recording flag if needed.
136
+ * This method should be called after tracking events to ensure
137
+ * the data recording flag is properly updated for data deletion workflows.
138
+ *
139
+ * The flag can only be set to `true` (indicating data has been collected).
140
+ * It cannot be explicitly set to `false` - it is only reset to `false` when
141
+ * a new deletion task is created via `createDataDeletionTask`.
142
+ *
143
+ */
144
+ updateDataRecordingFlag(): void;
145
+ }
146
+ export {};
147
+ //# sourceMappingURL=AnalyticsDataRegulationController.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"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AAO,EAAE,CAAC,OAAO,CAAC,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iDAAiD,GAC3D,0BAA0B,CACxB,OAAO,cAAc,EACrB,sCAAsC,CACvC,CAAC;AAEJ;;GAEG;AACH,MAAM,MAAM,uCAAuC,GAC/C,iDAAiD,GACjD,4BAA4B,GAC5B,6BAA6B,CAAC;AAElC;;GAEG;AACH,KAAK,aAAa,GAAG,KAAK,CAAC;AAE3B;;;GAGG;AACH,MAAM,MAAM,0CAA0C,GAAG,SAAS,CAChE,OAAO,cAAc,EACrB,wCAAwC,GAAG,cAAc,EACzD,uCAAuC,GAAG,aAAa,CACxD,CAAC;AAIF;;GAEG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC,sCAAsC,CAAC,CAAC;IACxD;;OAEG;IACH,SAAS,EAAE,0CAA0C,CAAC;IACtD;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;;GAMG;AACH,qBAAa,iCAAkC,SAAQ,cAAc,CACnE,OAAO,cAAc,EACrB,sCAAsC,EACtC,0CAA0C,CAC3C;;IAMC;;;;;;;OAOG;gBACS,EACV,KAAU,EACV,SAAS,EACT,WAAW,GACZ,EAAE,wCAAwC;IA4B3C;;;;;;OAMG;IACG,sBAAsB,IAAI,OAAO,CAAC;QACtC,MAAM,EAAE,OAAO,6BAA6B,CAAC,OAAO,CAAC;QACrD,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IA+BF;;;;OAIG;IACG,qBAAqB,IAAI,OAAO,CAAC,sBAAsB,CAAC;IA6B9D;;;;;;;;;OASG;IACH,uBAAuB,IAAI,IAAI;CAYhC"}
@@ -0,0 +1,171 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _AnalyticsDataRegulationController_analyticsId;
13
+ import { BaseController } from "@metamask/base-controller";
14
+ import { projectLogger as log } from "./logger.mjs";
15
+ import { DATA_DELETE_RESPONSE_STATUSES, DATA_DELETE_STATUSES } from "./types.mjs";
16
+ // === GENERAL ===
17
+ /**
18
+ * The name of the {@link AnalyticsDataRegulationController}, used to namespace the
19
+ * controller's actions and events and to namespace the controller's state data
20
+ * when composed with other controllers.
21
+ */
22
+ export const controllerName = 'AnalyticsDataRegulationController';
23
+ /**
24
+ * Returns default values for AnalyticsDataRegulationController state.
25
+ *
26
+ * @returns Default state
27
+ */
28
+ export function getDefaultAnalyticsDataRegulationControllerState() {
29
+ return {
30
+ hasCollectedDataSinceDeletionRequest: false,
31
+ };
32
+ }
33
+ /**
34
+ * The metadata for each property in {@link AnalyticsDataRegulationControllerState}.
35
+ */
36
+ const analyticsDataRegulationControllerMetadata = {
37
+ hasCollectedDataSinceDeletionRequest: {
38
+ includeInStateLogs: true,
39
+ persist: true,
40
+ includeInDebugSnapshot: true,
41
+ usedInUi: true,
42
+ },
43
+ deleteRegulationId: {
44
+ includeInStateLogs: true,
45
+ persist: true,
46
+ includeInDebugSnapshot: true,
47
+ usedInUi: true,
48
+ },
49
+ deleteRegulationTimestamp: {
50
+ includeInStateLogs: true,
51
+ persist: true,
52
+ includeInDebugSnapshot: true,
53
+ usedInUi: true,
54
+ },
55
+ };
56
+ // === MESSENGER ===
57
+ const MESSENGER_EXPOSED_METHODS = [
58
+ 'createDataDeletionTask',
59
+ 'checkDataDeleteStatus',
60
+ 'updateDataRecordingFlag',
61
+ ];
62
+ /**
63
+ * The AnalyticsDataRegulationController manages analytics privacy and GDPR/CCPA data deletion functionality.
64
+ * It communicates with Segment's Regulations API via a proxy to create and monitor data deletion requests.
65
+ *
66
+ * This controller follows the MetaMask controller pattern and integrates with the
67
+ * messenger system to allow other controllers and components to manage data deletion tasks.
68
+ */
69
+ export class AnalyticsDataRegulationController extends BaseController {
70
+ /**
71
+ * Constructs an AnalyticsDataRegulationController instance.
72
+ *
73
+ * @param options - Controller options
74
+ * @param options.state - Initial controller state. Use `getDefaultAnalyticsDataRegulationControllerState()` for defaults.
75
+ * @param options.messenger - Messenger used to communicate with BaseController
76
+ * @param options.analyticsId - Analytics ID used for data deletion requests
77
+ */
78
+ constructor({ state = {}, messenger, analyticsId, }) {
79
+ const initialState = {
80
+ ...getDefaultAnalyticsDataRegulationControllerState(),
81
+ ...state,
82
+ };
83
+ super({
84
+ name: controllerName,
85
+ metadata: analyticsDataRegulationControllerMetadata,
86
+ state: initialState,
87
+ messenger,
88
+ });
89
+ /**
90
+ * Analytics ID used for data deletion requests.
91
+ */
92
+ _AnalyticsDataRegulationController_analyticsId.set(this, void 0);
93
+ __classPrivateFieldSet(this, _AnalyticsDataRegulationController_analyticsId, analyticsId, "f");
94
+ this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
95
+ log('AnalyticsDataRegulationController initialized', {
96
+ hasCollectedDataSinceDeletionRequest: this.state.hasCollectedDataSinceDeletionRequest,
97
+ hasDeleteRegulationId: Boolean(this.state.deleteRegulationId),
98
+ deleteRegulationTimestamp: this.state.deleteRegulationTimestamp,
99
+ });
100
+ }
101
+ /**
102
+ * Creates a new delete regulation for the user.
103
+ * This is necessary to respect the GDPR and CCPA regulations.
104
+ *
105
+ * @returns Promise containing the status of the request with regulateId
106
+ * @throws Error if analytics ID is missing or if the service call fails
107
+ */
108
+ async createDataDeletionTask() {
109
+ if (!__classPrivateFieldGet(this, _AnalyticsDataRegulationController_analyticsId, "f") || __classPrivateFieldGet(this, _AnalyticsDataRegulationController_analyticsId, "f").trim() === '') {
110
+ const error = new Error('Analytics ID not found. You need to provide a valid analytics ID when initializing the AnalyticsDataRegulationController.');
111
+ log('Analytics Deletion Task Error', error);
112
+ throw error;
113
+ }
114
+ const response = await this.messenger.call('AnalyticsDataRegulationService:createDataDeletionTask', __classPrivateFieldGet(this, _AnalyticsDataRegulationController_analyticsId, "f"));
115
+ const deletionTimestamp = Date.now();
116
+ // Service validates and throws on all errors, so if we reach here, the response
117
+ // is guaranteed to be a success response with regulateId present
118
+ this.update((state) => {
119
+ state.deleteRegulationId = response.regulateId;
120
+ state.deleteRegulationTimestamp = deletionTimestamp;
121
+ state.hasCollectedDataSinceDeletionRequest = false;
122
+ });
123
+ this.messenger.publish(`${controllerName}:dataDeletionTaskCreated`, response);
124
+ return response;
125
+ }
126
+ /**
127
+ * Check the latest delete regulation status.
128
+ *
129
+ * @returns Promise containing the timestamp, delete status and collected data flag
130
+ */
131
+ async checkDataDeleteStatus() {
132
+ // Capture all state values before async call to ensure consistency
133
+ // in case createDataDeletionTask() completes concurrently
134
+ const { deleteRegulationId } = this.state;
135
+ const { deleteRegulationTimestamp } = this.state;
136
+ const { hasCollectedDataSinceDeletionRequest } = this.state;
137
+ const status = {
138
+ deletionRequestTimestamp: deleteRegulationTimestamp,
139
+ dataDeletionRequestStatus: DATA_DELETE_STATUSES.Unknown,
140
+ hasCollectedDataSinceDeletionRequest,
141
+ };
142
+ if (!deleteRegulationId) {
143
+ return status;
144
+ }
145
+ // Service validates and throws on all errors, so if we reach here, the response
146
+ // is guaranteed to be a success response with dataDeleteStatus present
147
+ const dataDeletionTaskStatus = await this.messenger.call('AnalyticsDataRegulationService:checkDataDeleteStatus', deleteRegulationId);
148
+ status.dataDeletionRequestStatus = dataDeletionTaskStatus.dataDeleteStatus;
149
+ return status;
150
+ }
151
+ /**
152
+ * Update the data recording flag if needed.
153
+ * This method should be called after tracking events to ensure
154
+ * the data recording flag is properly updated for data deletion workflows.
155
+ *
156
+ * The flag can only be set to `true` (indicating data has been collected).
157
+ * It cannot be explicitly set to `false` - it is only reset to `false` when
158
+ * a new deletion task is created via `createDataDeletionTask`.
159
+ *
160
+ */
161
+ updateDataRecordingFlag() {
162
+ if (!this.state.hasCollectedDataSinceDeletionRequest) {
163
+ this.update((state) => {
164
+ state.hasCollectedDataSinceDeletionRequest = true;
165
+ });
166
+ this.messenger.publish(`${controllerName}:dataRecordingFlagUpdated`, true);
167
+ }
168
+ }
169
+ }
170
+ _AnalyticsDataRegulationController_analyticsId = new WeakMap();
171
+ //# sourceMappingURL=AnalyticsDataRegulationController.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnalyticsDataRegulationController.mjs","sourceRoot":"","sources":["../src/AnalyticsDataRegulationController.ts"],"names":[],"mappings":";;;;;;;;;;;;AAKA,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAK3D,OAAO,EAAE,aAAa,IAAI,GAAG,EAAE,qBAAiB;AAChD,OAAO,EAAE,6BAA6B,EAAE,oBAAoB,EAAE,oBAAgB;AAG9E,kBAAkB;AAElB;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,mCAAmC,CAAC;AA0BlE;;;;GAIG;AACH,MAAM,UAAU,gDAAgD;IAC9D,OAAO;QACL,oCAAoC,EAAE,KAAK;KAC5C,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,yCAAyC,GAAG;IAChD,oCAAoC,EAAE;QACpC,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,QAAQ,EAAE,IAAI;KACf;IACD,kBAAkB,EAAE;QAClB,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;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B,CAAC;QAEF,MAAM,CAAC,yBAAyB,GAAG,sBAAsB,CAAC,gBAAgB,CAAC;QAE3E,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;;;;;OASG;IACH,uBAAuB;QACrB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,oCAAoC,EAAE,CAAC;YACrD,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;gBACpB,KAAK,CAAC,oCAAoC,GAAG,IAAI,CAAC;YACpD,CAAC,CAAC,CAAC;YAEH,IAAI,CAAC,SAAS,CAAC,OAAO,CACpB,GAAG,cAAc,2BAA2B,EAC5C,IAAI,CACL,CAAC;QACJ,CAAC;IACH,CAAC;CACF","sourcesContent":["import type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n StateMetadata,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport type { Messenger } from '@metamask/messenger';\n\nimport type { AnalyticsDataRegulationControllerMethodActions } from './AnalyticsDataRegulationController-method-action-types';\nimport type { AnalyticsDataRegulationServiceActions } from './AnalyticsDataRegulationService';\nimport { projectLogger as log } from './logger';\nimport { DATA_DELETE_RESPONSE_STATUSES, DATA_DELETE_STATUSES } from './types';\nimport type { DeleteRegulationResponse, DeleteRegulationStatus } from './types';\n\n// === GENERAL ===\n\n/**\n * The name of the {@link AnalyticsDataRegulationController}, 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 = 'AnalyticsDataRegulationController';\n\n// === STATE ===\n\n/**\n * Describes the shape of the state object for {@link AnalyticsDataRegulationController}.\n */\nexport type AnalyticsDataRegulationControllerState = {\n /**\n * Indicates if data has been recorded since the last deletion request.\n */\n hasCollectedDataSinceDeletionRequest: boolean;\n\n /**\n * Segment's data deletion regulation ID.\n * The ID returned by the Segment delete API which allows checking the status of the deletion request.\n */\n deleteRegulationId?: string;\n\n /**\n * Segment's data deletion regulation creation timestamp.\n * The timestamp (in milliseconds since epoch) when the deletion request was created.\n */\n deleteRegulationTimestamp?: number;\n};\n\n/**\n * Returns default values for AnalyticsDataRegulationController state.\n *\n * @returns Default state\n */\nexport function getDefaultAnalyticsDataRegulationControllerState(): AnalyticsDataRegulationControllerState {\n return {\n hasCollectedDataSinceDeletionRequest: false,\n };\n}\n\n/**\n * The metadata for each property in {@link AnalyticsDataRegulationControllerState}.\n */\nconst analyticsDataRegulationControllerMetadata = {\n hasCollectedDataSinceDeletionRequest: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n deleteRegulationId: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n deleteRegulationTimestamp: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n} satisfies StateMetadata<AnalyticsDataRegulationControllerState>;\n\n// === MESSENGER ===\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'createDataDeletionTask',\n 'checkDataDeleteStatus',\n 'updateDataRecordingFlag',\n] as const;\n\n/**\n * Returns the state of the {@link AnalyticsDataRegulationController}.\n */\nexport type AnalyticsDataRegulationControllerGetStateAction =\n ControllerGetStateAction<\n typeof controllerName,\n AnalyticsDataRegulationControllerState\n >;\n\n/**\n * Actions that {@link AnalyticsDataRegulationControllerMessenger} exposes to other consumers.\n */\nexport type AnalyticsDataRegulationControllerActions =\n | AnalyticsDataRegulationControllerGetStateAction\n | AnalyticsDataRegulationControllerMethodActions;\n\n/**\n * Actions from other messengers that {@link AnalyticsDataRegulationControllerMessenger} calls.\n */\ntype AllowedActions = AnalyticsDataRegulationServiceActions;\n\n/**\n * Event emitted when a data deletion task is created.\n */\nexport type DataDeletionTaskCreatedEvent = {\n type: `${typeof controllerName}:dataDeletionTaskCreated`;\n payload: [DeleteRegulationResponse];\n};\n\n/**\n * Event emitted when the data recording flag is updated.\n */\nexport type DataRecordingFlagUpdatedEvent = {\n type: `${typeof controllerName}:dataRecordingFlagUpdated`;\n payload: [boolean];\n};\n\n/**\n * Event emitted when the state of the {@link AnalyticsDataRegulationController} changes.\n */\nexport type AnalyticsDataRegulationControllerStateChangeEvent =\n ControllerStateChangeEvent<\n typeof controllerName,\n AnalyticsDataRegulationControllerState\n >;\n\n/**\n * Events that {@link AnalyticsDataRegulationControllerMessenger} exposes to other consumers.\n */\nexport type AnalyticsDataRegulationControllerEvents =\n | AnalyticsDataRegulationControllerStateChangeEvent\n | DataDeletionTaskCreatedEvent\n | DataRecordingFlagUpdatedEvent;\n\n/**\n * Events from other messengers that {@link AnalyticsDataRegulationControllerMessenger} subscribes to.\n */\ntype AllowedEvents = never;\n\n/**\n * The messenger restricted to actions and events accessed by\n * {@link AnalyticsDataRegulationController}.\n */\nexport type AnalyticsDataRegulationControllerMessenger = Messenger<\n typeof controllerName,\n AnalyticsDataRegulationControllerActions | AllowedActions,\n AnalyticsDataRegulationControllerEvents | AllowedEvents\n>;\n\n// === CONTROLLER DEFINITION ===\n\n/**\n * The options that AnalyticsDataRegulationController takes.\n */\nexport type AnalyticsDataRegulationControllerOptions = {\n /**\n * Initial controller state.\n */\n state?: Partial<AnalyticsDataRegulationControllerState>;\n /**\n * Messenger used to communicate with BaseController and other controllers.\n */\n messenger: AnalyticsDataRegulationControllerMessenger;\n /**\n * Analytics ID used for data deletion requests.\n */\n analyticsId: string;\n};\n\n/**\n * The AnalyticsDataRegulationController manages analytics privacy and GDPR/CCPA data deletion functionality.\n * It communicates with Segment's Regulations API via a proxy to create and monitor data deletion requests.\n *\n * This controller follows the MetaMask controller pattern and integrates with the\n * messenger system to allow other controllers and components to manage data deletion tasks.\n */\nexport class AnalyticsDataRegulationController extends BaseController<\n typeof controllerName,\n AnalyticsDataRegulationControllerState,\n AnalyticsDataRegulationControllerMessenger\n> {\n /**\n * Analytics ID used for data deletion requests.\n */\n readonly #analyticsId: string;\n\n /**\n * Constructs an AnalyticsDataRegulationController instance.\n *\n * @param options - Controller options\n * @param options.state - Initial controller state. Use `getDefaultAnalyticsDataRegulationControllerState()` for defaults.\n * @param options.messenger - Messenger used to communicate with BaseController\n * @param options.analyticsId - Analytics ID used for data deletion requests\n */\n constructor({\n state = {},\n messenger,\n analyticsId,\n }: AnalyticsDataRegulationControllerOptions) {\n const initialState: AnalyticsDataRegulationControllerState = {\n ...getDefaultAnalyticsDataRegulationControllerState(),\n ...state,\n };\n\n super({\n name: controllerName,\n metadata: analyticsDataRegulationControllerMetadata,\n state: initialState,\n messenger,\n });\n\n this.#analyticsId = analyticsId;\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n\n log('AnalyticsDataRegulationController initialized', {\n hasCollectedDataSinceDeletionRequest:\n this.state.hasCollectedDataSinceDeletionRequest,\n hasDeleteRegulationId: Boolean(this.state.deleteRegulationId),\n deleteRegulationTimestamp: this.state.deleteRegulationTimestamp,\n });\n }\n\n /**\n * Creates a new delete regulation for the user.\n * This is necessary to respect the GDPR and CCPA regulations.\n *\n * @returns Promise containing the status of the request with regulateId\n * @throws Error if analytics ID is missing or if the service call fails\n */\n async createDataDeletionTask(): Promise<{\n status: typeof DATA_DELETE_RESPONSE_STATUSES.Success;\n regulateId: string;\n }> {\n if (!this.#analyticsId || this.#analyticsId.trim() === '') {\n const error = new Error(\n 'Analytics ID not found. You need to provide a valid analytics ID when initializing the AnalyticsDataRegulationController.',\n );\n log('Analytics Deletion Task Error', error);\n throw error;\n }\n\n const response = await this.messenger.call(\n 'AnalyticsDataRegulationService:createDataDeletionTask',\n this.#analyticsId,\n );\n\n const deletionTimestamp = Date.now();\n // Service validates and throws on all errors, so if we reach here, the response\n // is guaranteed to be a success response with regulateId present\n this.update((state) => {\n state.deleteRegulationId = response.regulateId;\n state.deleteRegulationTimestamp = deletionTimestamp;\n state.hasCollectedDataSinceDeletionRequest = false;\n });\n\n this.messenger.publish(\n `${controllerName}:dataDeletionTaskCreated`,\n response,\n );\n\n return response;\n }\n\n /**\n * Check the latest delete regulation status.\n *\n * @returns Promise containing the timestamp, delete status and collected data flag\n */\n async checkDataDeleteStatus(): Promise<DeleteRegulationStatus> {\n // Capture all state values before async call to ensure consistency\n // in case createDataDeletionTask() completes concurrently\n const { deleteRegulationId } = this.state;\n const { deleteRegulationTimestamp } = this.state;\n const { hasCollectedDataSinceDeletionRequest } = this.state;\n\n const status: DeleteRegulationStatus = {\n deletionRequestTimestamp: deleteRegulationTimestamp,\n dataDeletionRequestStatus: DATA_DELETE_STATUSES.Unknown,\n hasCollectedDataSinceDeletionRequest,\n };\n\n if (!deleteRegulationId) {\n return status;\n }\n\n // Service validates and throws on all errors, so if we reach here, the response\n // is guaranteed to be a success response with dataDeleteStatus present\n const dataDeletionTaskStatus = await this.messenger.call(\n 'AnalyticsDataRegulationService:checkDataDeleteStatus',\n deleteRegulationId,\n );\n\n status.dataDeletionRequestStatus = dataDeletionTaskStatus.dataDeleteStatus;\n\n return status;\n }\n\n /**\n * Update the data recording flag if needed.\n * This method should be called after tracking events to ensure\n * the data recording flag is properly updated for data deletion workflows.\n *\n * The flag can only be set to `true` (indicating data has been collected).\n * It cannot be explicitly set to `false` - it is only reset to `false` when\n * a new deletion task is created via `createDataDeletionTask`.\n *\n */\n updateDataRecordingFlag(): void {\n if (!this.state.hasCollectedDataSinceDeletionRequest) {\n this.update((state) => {\n state.hasCollectedDataSinceDeletionRequest = true;\n });\n\n this.messenger.publish(\n `${controllerName}:dataRecordingFlagUpdated`,\n true,\n );\n }\n }\n}\n"]}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
4
+ * Do not edit manually.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=AnalyticsDataRegulationService-method-action-types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnalyticsDataRegulationService-method-action-types.cjs","sourceRoot":"","sources":["../src/AnalyticsDataRegulationService-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { AnalyticsDataRegulationService } from './AnalyticsDataRegulationService';\n\n/**\n * Creates a DELETE_ONLY regulation for the given analyticsId.\n *\n * @param analyticsId - The analytics ID of the user for whom to create the deletion task.\n * @returns Promise resolving to a successful deletion regulation response.\n * @throws Error if the request fails or the response is invalid.\n */\nexport type AnalyticsDataRegulationServiceCreateDataDeletionTaskAction = {\n type: `AnalyticsDataRegulationService:createDataDeletionTask`;\n handler: AnalyticsDataRegulationService['createDataDeletionTask'];\n};\n\n/**\n * Checks the status of a regulation by ID.\n *\n * @param regulationId - The regulation ID to check.\n * @returns Promise resolving to a successful regulation status response.\n * @throws Error if the request fails or the response is invalid.\n */\nexport type AnalyticsDataRegulationServiceCheckDataDeleteStatusAction = {\n type: `AnalyticsDataRegulationService:checkDataDeleteStatus`;\n handler: AnalyticsDataRegulationService['checkDataDeleteStatus'];\n};\n\n/**\n * Union of all AnalyticsDataRegulationService action types.\n */\nexport type AnalyticsDataRegulationServiceMethodActions =\n | AnalyticsDataRegulationServiceCreateDataDeletionTaskAction\n | AnalyticsDataRegulationServiceCheckDataDeleteStatusAction;\n"]}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
3
+ * Do not edit manually.
4
+ */
5
+ import type { AnalyticsDataRegulationService } from "./AnalyticsDataRegulationService.cjs";
6
+ /**
7
+ * Creates a DELETE_ONLY regulation for the given analyticsId.
8
+ *
9
+ * @param analyticsId - The analytics ID of the user for whom to create the deletion task.
10
+ * @returns Promise resolving to a successful deletion regulation response.
11
+ * @throws Error if the request fails or the response is invalid.
12
+ */
13
+ export type AnalyticsDataRegulationServiceCreateDataDeletionTaskAction = {
14
+ type: `AnalyticsDataRegulationService:createDataDeletionTask`;
15
+ handler: AnalyticsDataRegulationService['createDataDeletionTask'];
16
+ };
17
+ /**
18
+ * Checks the status of a regulation by ID.
19
+ *
20
+ * @param regulationId - The regulation ID to check.
21
+ * @returns Promise resolving to a successful regulation status response.
22
+ * @throws Error if the request fails or the response is invalid.
23
+ */
24
+ export type AnalyticsDataRegulationServiceCheckDataDeleteStatusAction = {
25
+ type: `AnalyticsDataRegulationService:checkDataDeleteStatus`;
26
+ handler: AnalyticsDataRegulationService['checkDataDeleteStatus'];
27
+ };
28
+ /**
29
+ * Union of all AnalyticsDataRegulationService action types.
30
+ */
31
+ export type AnalyticsDataRegulationServiceMethodActions = AnalyticsDataRegulationServiceCreateDataDeletionTaskAction | AnalyticsDataRegulationServiceCheckDataDeleteStatusAction;
32
+ //# sourceMappingURL=AnalyticsDataRegulationService-method-action-types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnalyticsDataRegulationService-method-action-types.d.cts","sourceRoot":"","sources":["../src/AnalyticsDataRegulationService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,8BAA8B,EAAE,6CAAyC;AAEvF;;;;;;GAMG;AACH,MAAM,MAAM,0DAA0D,GAAG;IACvE,IAAI,EAAE,uDAAuD,CAAC;IAC9D,OAAO,EAAE,8BAA8B,CAAC,wBAAwB,CAAC,CAAC;CACnE,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,sDAAsD,CAAC;IAC7D,OAAO,EAAE,8BAA8B,CAAC,uBAAuB,CAAC,CAAC;CAClE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,2CAA2C,GACnD,0DAA0D,GAC1D,yDAAyD,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
3
+ * Do not edit manually.
4
+ */
5
+ import type { AnalyticsDataRegulationService } from "./AnalyticsDataRegulationService.mjs";
6
+ /**
7
+ * Creates a DELETE_ONLY regulation for the given analyticsId.
8
+ *
9
+ * @param analyticsId - The analytics ID of the user for whom to create the deletion task.
10
+ * @returns Promise resolving to a successful deletion regulation response.
11
+ * @throws Error if the request fails or the response is invalid.
12
+ */
13
+ export type AnalyticsDataRegulationServiceCreateDataDeletionTaskAction = {
14
+ type: `AnalyticsDataRegulationService:createDataDeletionTask`;
15
+ handler: AnalyticsDataRegulationService['createDataDeletionTask'];
16
+ };
17
+ /**
18
+ * Checks the status of a regulation by ID.
19
+ *
20
+ * @param regulationId - The regulation ID to check.
21
+ * @returns Promise resolving to a successful regulation status response.
22
+ * @throws Error if the request fails or the response is invalid.
23
+ */
24
+ export type AnalyticsDataRegulationServiceCheckDataDeleteStatusAction = {
25
+ type: `AnalyticsDataRegulationService:checkDataDeleteStatus`;
26
+ handler: AnalyticsDataRegulationService['checkDataDeleteStatus'];
27
+ };
28
+ /**
29
+ * Union of all AnalyticsDataRegulationService action types.
30
+ */
31
+ export type AnalyticsDataRegulationServiceMethodActions = AnalyticsDataRegulationServiceCreateDataDeletionTaskAction | AnalyticsDataRegulationServiceCheckDataDeleteStatusAction;
32
+ //# sourceMappingURL=AnalyticsDataRegulationService-method-action-types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnalyticsDataRegulationService-method-action-types.d.mts","sourceRoot":"","sources":["../src/AnalyticsDataRegulationService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,8BAA8B,EAAE,6CAAyC;AAEvF;;;;;;GAMG;AACH,MAAM,MAAM,0DAA0D,GAAG;IACvE,IAAI,EAAE,uDAAuD,CAAC;IAC9D,OAAO,EAAE,8BAA8B,CAAC,wBAAwB,CAAC,CAAC;CACnE,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,sDAAsD,CAAC;IAC7D,OAAO,EAAE,8BAA8B,CAAC,uBAAuB,CAAC,CAAC;CAClE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,2CAA2C,GACnD,0DAA0D,GAC1D,yDAAyD,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
3
+ * Do not edit manually.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=AnalyticsDataRegulationService-method-action-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AnalyticsDataRegulationService-method-action-types.mjs","sourceRoot":"","sources":["../src/AnalyticsDataRegulationService-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { AnalyticsDataRegulationService } from './AnalyticsDataRegulationService';\n\n/**\n * Creates a DELETE_ONLY regulation for the given analyticsId.\n *\n * @param analyticsId - The analytics ID of the user for whom to create the deletion task.\n * @returns Promise resolving to a successful deletion regulation response.\n * @throws Error if the request fails or the response is invalid.\n */\nexport type AnalyticsDataRegulationServiceCreateDataDeletionTaskAction = {\n type: `AnalyticsDataRegulationService:createDataDeletionTask`;\n handler: AnalyticsDataRegulationService['createDataDeletionTask'];\n};\n\n/**\n * Checks the status of a regulation by ID.\n *\n * @param regulationId - The regulation ID to check.\n * @returns Promise resolving to a successful regulation status response.\n * @throws Error if the request fails or the response is invalid.\n */\nexport type AnalyticsDataRegulationServiceCheckDataDeleteStatusAction = {\n type: `AnalyticsDataRegulationService:checkDataDeleteStatus`;\n handler: AnalyticsDataRegulationService['checkDataDeleteStatus'];\n};\n\n/**\n * Union of all AnalyticsDataRegulationService action types.\n */\nexport type AnalyticsDataRegulationServiceMethodActions =\n | AnalyticsDataRegulationServiceCreateDataDeletionTaskAction\n | AnalyticsDataRegulationServiceCheckDataDeleteStatusAction;\n"]}