@metamask-previews/profile-sync-controller 19.0.0-preview-48b44963 → 19.0.0-preview-bfad74b0

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 CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ### Added
11
+
12
+ - Add MetaMetrics event library to standardize event properties across clients ([#6044](https://github.com/MetaMask/core/pull/6044))
13
+
10
14
  ## [19.0.0]
11
15
 
12
16
  ### Changed
package/dist/index.cjs CHANGED
@@ -23,8 +23,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.UserStorageController = exports.AuthenticationController = exports.SDK = void 0;
26
+ exports.MetaMetrics = exports.UserStorageController = exports.AuthenticationController = exports.SDK = void 0;
27
27
  exports.SDK = __importStar(require("./sdk/index.cjs"));
28
28
  exports.AuthenticationController = __importStar(require("./controllers/authentication/index.cjs"));
29
29
  exports.UserStorageController = __importStar(require("./controllers/user-storage/index.cjs"));
30
+ exports.MetaMetrics = __importStar(require("./shared/metametrics.cjs"));
30
31
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAA6B;AAC7B,mGAAyE;AACzE,8FAAoE","sourcesContent":["export * as SDK from './sdk';\nexport * as AuthenticationController from './controllers/authentication';\nexport * as UserStorageController from './controllers/user-storage';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAA6B;AAC7B,mGAAyE;AACzE,8FAAoE;AACpE,wEAAoD","sourcesContent":["export * as SDK from './sdk';\nexport * as AuthenticationController from './controllers/authentication';\nexport * as UserStorageController from './controllers/user-storage';\nexport * as MetaMetrics from './shared/metametrics';\n"]}
package/dist/index.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * as SDK from "./sdk/index.cjs";
2
2
  export * as AuthenticationController from "./controllers/authentication/index.cjs";
3
3
  export * as UserStorageController from "./controllers/user-storage/index.cjs";
4
+ export * as MetaMetrics from "./shared/metametrics.cjs";
4
5
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,wBAAc;AAC7B,OAAO,KAAK,wBAAwB,+CAAqC;AACzE,OAAO,KAAK,qBAAqB,6CAAmC"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,wBAAc;AAC7B,OAAO,KAAK,wBAAwB,+CAAqC;AACzE,OAAO,KAAK,qBAAqB,6CAAmC;AACpE,OAAO,KAAK,WAAW,iCAA6B"}
package/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * as SDK from "./sdk/index.mjs";
2
2
  export * as AuthenticationController from "./controllers/authentication/index.mjs";
3
3
  export * as UserStorageController from "./controllers/user-storage/index.mjs";
4
+ export * as MetaMetrics from "./shared/metametrics.mjs";
4
5
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,wBAAc;AAC7B,OAAO,KAAK,wBAAwB,+CAAqC;AACzE,OAAO,KAAK,qBAAqB,6CAAmC"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,wBAAc;AAC7B,OAAO,KAAK,wBAAwB,+CAAqC;AACzE,OAAO,KAAK,qBAAqB,6CAAmC;AACpE,OAAO,KAAK,WAAW,iCAA6B"}
package/dist/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  export * as SDK from "./sdk/index.mjs";
2
2
  export * as AuthenticationController from "./controllers/authentication/index.mjs";
3
3
  export * as UserStorageController from "./controllers/user-storage/index.mjs";
4
+ export * as MetaMetrics from "./shared/metametrics.mjs";
4
5
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,wBAAc;AAC7B,OAAO,KAAK,wBAAwB,+CAAqC;AACzE,OAAO,KAAK,qBAAqB,6CAAmC","sourcesContent":["export * as SDK from './sdk';\nexport * as AuthenticationController from './controllers/authentication';\nexport * as UserStorageController from './controllers/user-storage';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,wBAAc;AAC7B,OAAO,KAAK,wBAAwB,+CAAqC;AACzE,OAAO,KAAK,qBAAqB,6CAAmC;AACpE,OAAO,KAAK,WAAW,iCAA6B","sourcesContent":["export * as SDK from './sdk';\nexport * as AuthenticationController from './controllers/authentication';\nexport * as UserStorageController from './controllers/user-storage';\nexport * as MetaMetrics from './shared/metametrics';\n"]}
@@ -0,0 +1,157 @@
1
+ "use strict";
2
+ /**
3
+ * MetaMetrics events library for profile-sync-controller
4
+ *
5
+ * This library provides type-safe event definitions that mirror the segment schema,
6
+ * ensuring consistency and providing compile-time validation for event properties.
7
+ */
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.buildIdentityEvent = exports.IDENTITY_EVENTS = void 0;
10
+ /**
11
+ * Identity events definitions matching the segment schema
12
+ */
13
+ exports.IDENTITY_EVENTS = {
14
+ ACCOUNT_SYNCING: {
15
+ ACCOUNTS_SYNC_ADDED: {
16
+ name: 'Accounts Sync Added',
17
+ properties: {
18
+ profile_id: {
19
+ required: true,
20
+ type: 'string',
21
+ },
22
+ },
23
+ },
24
+ ACCOUNTS_SYNC_NAME_UPDATED: {
25
+ name: 'Accounts Sync Name Updated',
26
+ properties: {
27
+ profile_id: {
28
+ required: true,
29
+ type: 'string',
30
+ },
31
+ },
32
+ },
33
+ ACCOUNTS_SYNC_ERRONEOUS_SITUATION: {
34
+ name: 'Accounts Sync Erroneous Situation',
35
+ properties: {
36
+ profile_id: {
37
+ required: true,
38
+ type: 'string',
39
+ },
40
+ situation_message: {
41
+ required: true,
42
+ type: 'string',
43
+ },
44
+ },
45
+ },
46
+ },
47
+ NETWORK_SYNCING: {
48
+ NETWORK_SYNC_ADDED: {
49
+ name: 'Network Sync Added',
50
+ properties: {
51
+ profile_id: {
52
+ required: true,
53
+ type: 'string',
54
+ },
55
+ chain_id: {
56
+ required: true,
57
+ type: 'string',
58
+ },
59
+ },
60
+ },
61
+ NETWORK_SYNC_UPDATED: {
62
+ name: 'Network Sync Updated',
63
+ properties: {
64
+ profile_id: {
65
+ required: true,
66
+ type: 'string',
67
+ },
68
+ chain_id: {
69
+ required: true,
70
+ type: 'string',
71
+ },
72
+ },
73
+ },
74
+ NETWORK_SYNC_REMOVED: {
75
+ name: 'Network Sync Removed',
76
+ properties: {
77
+ profile_id: {
78
+ required: true,
79
+ type: 'string',
80
+ },
81
+ chain_id: {
82
+ required: true,
83
+ type: 'string',
84
+ },
85
+ },
86
+ },
87
+ },
88
+ PROFILE: {
89
+ ACTIVITY_UPDATED: {
90
+ name: 'Profile Activity Updated',
91
+ properties: {
92
+ profile_id: {
93
+ required: false,
94
+ type: 'string',
95
+ },
96
+ feature_name: {
97
+ required: true,
98
+ type: 'string',
99
+ fromObject: {
100
+ BACKUP_AND_SYNC: 'Backup And Sync',
101
+ AUTHENTICATION: 'Authentication',
102
+ },
103
+ },
104
+ action: {
105
+ required: true,
106
+ type: 'string',
107
+ fromObject: {
108
+ CONTACTS_SYNC_CONTACT_UPDATED: 'Contacts Sync Contact Updated',
109
+ CONTACTS_SYNC_CONTACT_DELETED: 'Contacts Sync Contact Deleted',
110
+ CONTACTS_SYNC_ERRONEOUS_SITUATION: 'Contacts Sync Erroneous Situation',
111
+ SETTINGS_TOGGLE_ENABLED: 'settings_toggle_enabled',
112
+ SETTINGS_TOGGLE_DISABLED: 'settings_toggle_disabled',
113
+ SIGN_IN: 'Sign In',
114
+ SIGN_OUT: 'Sign Out',
115
+ AUTHENTICATION_FAILED: 'Authentication Failed',
116
+ },
117
+ },
118
+ additional_description: {
119
+ required: false,
120
+ type: 'string',
121
+ },
122
+ },
123
+ },
124
+ BACKUP_AND_SYNC_INTRODUCTION_MODAL_INTERACTION: {
125
+ name: 'Backup And Sync Introduction Modal Interaction',
126
+ properties: {
127
+ profile_id: {
128
+ required: false,
129
+ type: 'string',
130
+ },
131
+ action: {
132
+ required: true,
133
+ type: 'string',
134
+ fromObject: {
135
+ MODAL_OPENED: 'modal_opened',
136
+ MODAL_CLOSED: 'modal_closed',
137
+ ENABLE_CLICKED: 'enable_clicked',
138
+ DISMISS_CLICKED: 'dismiss_clicked',
139
+ },
140
+ },
141
+ },
142
+ },
143
+ },
144
+ };
145
+ /**
146
+ * Type-safe event builder function
147
+ *
148
+ * @param event - The event definition
149
+ * @param properties - The event properties (type-checked)
150
+ * @returns An object with the event name and properties
151
+ */
152
+ const buildIdentityEvent = (event, properties) => ({
153
+ name: event.name,
154
+ properties,
155
+ });
156
+ exports.buildIdentityEvent = buildIdentityEvent;
157
+ //# sourceMappingURL=metametrics.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metametrics.cjs","sourceRoot":"","sources":["../../src/shared/metametrics.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAiDH;;GAEG;AACU,QAAA,eAAe,GAAG;IAC7B,eAAe,EAAE;QACf,mBAAmB,EAAE;YACnB,IAAI,EAAE,qBAAqB;YAC3B,UAAU,EAAE;gBACV,UAAU,EAAE;oBACV,QAAQ,EAAE,IAAI;oB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,KAAK;oBACf,IAAI,EAAE,QAAQ;iBACf;gBACD,YAAY,EAAE;oBACZ,QAAQ,EAAE,IAAI;oBACd,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,eAAe,EAAE,iBAAiB;wBAClC,cAAc,EAAE,gBAAgB;qBACjC;iBACF;gBACD,MAAM,EAAE;oBACN,QAAQ,EAAE,IAAI;oBACd,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,6BAA6B,EAAE,+BAA+B;wBAC9D,6BAA6B,EAAE,+BAA+B;wBAC9D,iCAAiC,EAC/B,mCAAmC;wBACrC,uBAAuB,EAAE,yBAAyB;wBAClD,wBAAwB,EAAE,0BAA0B;wBACpD,OAAO,EAAE,SAAS;wBAClB,QAAQ,EAAE,UAAU;wBACpB,qBAAqB,EAAE,uBAAuB;qBAC/C;iBACF;gBACD,sBAAsB,EAAE;oBACtB,QAAQ,EAAE,KAAK;oBACf,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;QACD,8CAA8C,EAAE;YAC9C,IAAI,EAAE,gDAAgD;YACtD,UAAU,EAAE;gBACV,UAAU,EAAE;oBACV,QAAQ,EAAE,KAAK;oBACf,IAAI,EAAE,QAAQ;iBACf;gBACD,MAAM,EAAE;oBACN,QAAQ,EAAE,IAAI;oBACd,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,YAAY,EAAE,cAAc;wBAC5B,YAAY,EAAE,cAAc;wBAC5B,cAAc,EAAE,gBAAgB;wBAChC,eAAe,EAAE,iBAAiB;qBACnC;iBACF;aACF;SACF;KACF;CAC+D,CAAC;AAEnE;;;;;;GAMG;AACI,MAAM,kBAAkB,GAAG,CAChC,KAAQ,EACR,UAA8B,EACmC,EAAE,CAAC,CAAC;IACrE,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,UAAU;CACX,CAAC,CAAC;AANU,QAAA,kBAAkB,sBAM5B","sourcesContent":["/**\n * MetaMetrics events library for profile-sync-controller\n *\n * This library provides type-safe event definitions that mirror the segment schema,\n * ensuring consistency and providing compile-time validation for event properties.\n */\n\n/**\n * Interface defining the structure of an identity event\n */\nexport type IdentityEvent = {\n name: string;\n properties: {\n [key: string]: {\n required: boolean;\n type: 'string' | 'number' | 'boolean';\n fromObject?: Record<string, string>;\n };\n };\n};\n\n/**\n * Type utility to extract property types from event definitions\n */\ntype PropertyType<T, FromObject> =\n FromObject extends Record<string, string>\n ? FromObject[keyof FromObject]\n : T extends 'string'\n ? string\n : T extends 'number'\n ? number\n : T extends 'boolean'\n ? boolean\n : never;\n\n/**\n * Type utility to generate event properties with proper required/optional handling\n */\ntype EventProperties<T extends IdentityEvent> = {\n [K in keyof T['properties'] as T['properties'][K]['required'] extends true\n ? K\n : never]: PropertyType<\n T['properties'][K]['type'],\n T['properties'][K]['fromObject']\n >;\n} & {\n [K in keyof T['properties'] as T['properties'][K]['required'] extends false\n ? K\n : never]?: PropertyType<\n T['properties'][K]['type'],\n T['properties'][K]['fromObject']\n >;\n};\n\n/**\n * Identity events definitions matching the segment schema\n */\nexport const IDENTITY_EVENTS = {\n ACCOUNT_SYNCING: {\n ACCOUNTS_SYNC_ADDED: {\n name: 'Accounts Sync Added',\n properties: {\n profile_id: {\n required: true,\n type: 'string',\n },\n },\n },\n ACCOUNTS_SYNC_NAME_UPDATED: {\n name: 'Accounts Sync Name Updated',\n properties: {\n profile_id: {\n required: true,\n type: 'string',\n },\n },\n },\n ACCOUNTS_SYNC_ERRONEOUS_SITUATION: {\n name: 'Accounts Sync Erroneous Situation',\n properties: {\n profile_id: {\n required: true,\n type: 'string',\n },\n situation_message: {\n required: true,\n type: 'string',\n },\n },\n },\n },\n NETWORK_SYNCING: {\n NETWORK_SYNC_ADDED: {\n name: 'Network Sync Added',\n properties: {\n profile_id: {\n required: true,\n type: 'string',\n },\n chain_id: {\n required: true,\n type: 'string',\n },\n },\n },\n NETWORK_SYNC_UPDATED: {\n name: 'Network Sync Updated',\n properties: {\n profile_id: {\n required: true,\n type: 'string',\n },\n chain_id: {\n required: true,\n type: 'string',\n },\n },\n },\n NETWORK_SYNC_REMOVED: {\n name: 'Network Sync Removed',\n properties: {\n profile_id: {\n required: true,\n type: 'string',\n },\n chain_id: {\n required: true,\n type: 'string',\n },\n },\n },\n },\n PROFILE: {\n ACTIVITY_UPDATED: {\n name: 'Profile Activity Updated',\n properties: {\n profile_id: {\n required: false,\n type: 'string',\n },\n feature_name: {\n required: true,\n type: 'string',\n fromObject: {\n BACKUP_AND_SYNC: 'Backup And Sync',\n AUTHENTICATION: 'Authentication',\n },\n },\n action: {\n required: true,\n type: 'string',\n fromObject: {\n CONTACTS_SYNC_CONTACT_UPDATED: 'Contacts Sync Contact Updated',\n CONTACTS_SYNC_CONTACT_DELETED: 'Contacts Sync Contact Deleted',\n CONTACTS_SYNC_ERRONEOUS_SITUATION:\n 'Contacts Sync Erroneous Situation',\n SETTINGS_TOGGLE_ENABLED: 'settings_toggle_enabled',\n SETTINGS_TOGGLE_DISABLED: 'settings_toggle_disabled',\n SIGN_IN: 'Sign In',\n SIGN_OUT: 'Sign Out',\n AUTHENTICATION_FAILED: 'Authentication Failed',\n },\n },\n additional_description: {\n required: false,\n type: 'string',\n },\n },\n },\n BACKUP_AND_SYNC_INTRODUCTION_MODAL_INTERACTION: {\n name: 'Backup And Sync Introduction Modal Interaction',\n properties: {\n profile_id: {\n required: false,\n type: 'string',\n },\n action: {\n required: true,\n type: 'string',\n fromObject: {\n MODAL_OPENED: 'modal_opened',\n MODAL_CLOSED: 'modal_closed',\n ENABLE_CLICKED: 'enable_clicked',\n DISMISS_CLICKED: 'dismiss_clicked',\n },\n },\n },\n },\n },\n} as const satisfies Record<string, Record<string, IdentityEvent>>;\n\n/**\n * Type-safe event builder function\n *\n * @param event - The event definition\n * @param properties - The event properties (type-checked)\n * @returns An object with the event name and properties\n */\nexport const buildIdentityEvent = <T extends IdentityEvent>(\n event: T,\n properties: EventProperties<T>,\n): { name: (typeof event)['name']; properties: typeof properties } => ({\n name: event.name,\n properties,\n});\n\n// Export types for external use\nexport type IdentityEventBuilder = typeof buildIdentityEvent;\nexport type IdentityEventDefinitions = typeof IDENTITY_EVENTS;\n"]}
@@ -0,0 +1,181 @@
1
+ /**
2
+ * MetaMetrics events library for profile-sync-controller
3
+ *
4
+ * This library provides type-safe event definitions that mirror the segment schema,
5
+ * ensuring consistency and providing compile-time validation for event properties.
6
+ */
7
+ /**
8
+ * Interface defining the structure of an identity event
9
+ */
10
+ export type IdentityEvent = {
11
+ name: string;
12
+ properties: {
13
+ [key: string]: {
14
+ required: boolean;
15
+ type: 'string' | 'number' | 'boolean';
16
+ fromObject?: Record<string, string>;
17
+ };
18
+ };
19
+ };
20
+ /**
21
+ * Type utility to extract property types from event definitions
22
+ */
23
+ type PropertyType<T, FromObject> = FromObject extends Record<string, string> ? FromObject[keyof FromObject] : T extends 'string' ? string : T extends 'number' ? number : T extends 'boolean' ? boolean : never;
24
+ /**
25
+ * Type utility to generate event properties with proper required/optional handling
26
+ */
27
+ type EventProperties<T extends IdentityEvent> = {
28
+ [K in keyof T['properties'] as T['properties'][K]['required'] extends true ? K : never]: PropertyType<T['properties'][K]['type'], T['properties'][K]['fromObject']>;
29
+ } & {
30
+ [K in keyof T['properties'] as T['properties'][K]['required'] extends false ? K : never]?: PropertyType<T['properties'][K]['type'], T['properties'][K]['fromObject']>;
31
+ };
32
+ /**
33
+ * Identity events definitions matching the segment schema
34
+ */
35
+ export declare const IDENTITY_EVENTS: {
36
+ readonly ACCOUNT_SYNCING: {
37
+ readonly ACCOUNTS_SYNC_ADDED: {
38
+ readonly name: "Accounts Sync Added";
39
+ readonly properties: {
40
+ readonly profile_id: {
41
+ readonly required: true;
42
+ readonly type: "string";
43
+ };
44
+ };
45
+ };
46
+ readonly ACCOUNTS_SYNC_NAME_UPDATED: {
47
+ readonly name: "Accounts Sync Name Updated";
48
+ readonly properties: {
49
+ readonly profile_id: {
50
+ readonly required: true;
51
+ readonly type: "string";
52
+ };
53
+ };
54
+ };
55
+ readonly ACCOUNTS_SYNC_ERRONEOUS_SITUATION: {
56
+ readonly name: "Accounts Sync Erroneous Situation";
57
+ readonly properties: {
58
+ readonly profile_id: {
59
+ readonly required: true;
60
+ readonly type: "string";
61
+ };
62
+ readonly situation_message: {
63
+ readonly required: true;
64
+ readonly type: "string";
65
+ };
66
+ };
67
+ };
68
+ };
69
+ readonly NETWORK_SYNCING: {
70
+ readonly NETWORK_SYNC_ADDED: {
71
+ readonly name: "Network Sync Added";
72
+ readonly properties: {
73
+ readonly profile_id: {
74
+ readonly required: true;
75
+ readonly type: "string";
76
+ };
77
+ readonly chain_id: {
78
+ readonly required: true;
79
+ readonly type: "string";
80
+ };
81
+ };
82
+ };
83
+ readonly NETWORK_SYNC_UPDATED: {
84
+ readonly name: "Network Sync Updated";
85
+ readonly properties: {
86
+ readonly profile_id: {
87
+ readonly required: true;
88
+ readonly type: "string";
89
+ };
90
+ readonly chain_id: {
91
+ readonly required: true;
92
+ readonly type: "string";
93
+ };
94
+ };
95
+ };
96
+ readonly NETWORK_SYNC_REMOVED: {
97
+ readonly name: "Network Sync Removed";
98
+ readonly properties: {
99
+ readonly profile_id: {
100
+ readonly required: true;
101
+ readonly type: "string";
102
+ };
103
+ readonly chain_id: {
104
+ readonly required: true;
105
+ readonly type: "string";
106
+ };
107
+ };
108
+ };
109
+ };
110
+ readonly PROFILE: {
111
+ readonly ACTIVITY_UPDATED: {
112
+ readonly name: "Profile Activity Updated";
113
+ readonly properties: {
114
+ readonly profile_id: {
115
+ readonly required: false;
116
+ readonly type: "string";
117
+ };
118
+ readonly feature_name: {
119
+ readonly required: true;
120
+ readonly type: "string";
121
+ readonly fromObject: {
122
+ readonly BACKUP_AND_SYNC: "Backup And Sync";
123
+ readonly AUTHENTICATION: "Authentication";
124
+ };
125
+ };
126
+ readonly action: {
127
+ readonly required: true;
128
+ readonly type: "string";
129
+ readonly fromObject: {
130
+ readonly CONTACTS_SYNC_CONTACT_UPDATED: "Contacts Sync Contact Updated";
131
+ readonly CONTACTS_SYNC_CONTACT_DELETED: "Contacts Sync Contact Deleted";
132
+ readonly CONTACTS_SYNC_ERRONEOUS_SITUATION: "Contacts Sync Erroneous Situation";
133
+ readonly SETTINGS_TOGGLE_ENABLED: "settings_toggle_enabled";
134
+ readonly SETTINGS_TOGGLE_DISABLED: "settings_toggle_disabled";
135
+ readonly SIGN_IN: "Sign In";
136
+ readonly SIGN_OUT: "Sign Out";
137
+ readonly AUTHENTICATION_FAILED: "Authentication Failed";
138
+ };
139
+ };
140
+ readonly additional_description: {
141
+ readonly required: false;
142
+ readonly type: "string";
143
+ };
144
+ };
145
+ };
146
+ readonly BACKUP_AND_SYNC_INTRODUCTION_MODAL_INTERACTION: {
147
+ readonly name: "Backup And Sync Introduction Modal Interaction";
148
+ readonly properties: {
149
+ readonly profile_id: {
150
+ readonly required: false;
151
+ readonly type: "string";
152
+ };
153
+ readonly action: {
154
+ readonly required: true;
155
+ readonly type: "string";
156
+ readonly fromObject: {
157
+ readonly MODAL_OPENED: "modal_opened";
158
+ readonly MODAL_CLOSED: "modal_closed";
159
+ readonly ENABLE_CLICKED: "enable_clicked";
160
+ readonly DISMISS_CLICKED: "dismiss_clicked";
161
+ };
162
+ };
163
+ };
164
+ };
165
+ };
166
+ };
167
+ /**
168
+ * Type-safe event builder function
169
+ *
170
+ * @param event - The event definition
171
+ * @param properties - The event properties (type-checked)
172
+ * @returns An object with the event name and properties
173
+ */
174
+ export declare const buildIdentityEvent: <T extends IdentityEvent>(event: T, properties: EventProperties<T>) => {
175
+ name: T["name"];
176
+ properties: EventProperties<T>;
177
+ };
178
+ export type IdentityEventBuilder = typeof buildIdentityEvent;
179
+ export type IdentityEventDefinitions = typeof IDENTITY_EVENTS;
180
+ export {};
181
+ //# sourceMappingURL=metametrics.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metametrics.d.cts","sourceRoot":"","sources":["../../src/shared/metametrics.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,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YAAY,CAAC,CACjC;CACF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoIsC,CAAC;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;CAM7B,CAAC;AAGH,MAAM,MAAM,oBAAoB,GAAG,OAAO,kBAAkB,CAAC;AAC7D,MAAM,MAAM,wBAAwB,GAAG,OAAO,eAAe,CAAC"}
@@ -0,0 +1,181 @@
1
+ /**
2
+ * MetaMetrics events library for profile-sync-controller
3
+ *
4
+ * This library provides type-safe event definitions that mirror the segment schema,
5
+ * ensuring consistency and providing compile-time validation for event properties.
6
+ */
7
+ /**
8
+ * Interface defining the structure of an identity event
9
+ */
10
+ export type IdentityEvent = {
11
+ name: string;
12
+ properties: {
13
+ [key: string]: {
14
+ required: boolean;
15
+ type: 'string' | 'number' | 'boolean';
16
+ fromObject?: Record<string, string>;
17
+ };
18
+ };
19
+ };
20
+ /**
21
+ * Type utility to extract property types from event definitions
22
+ */
23
+ type PropertyType<T, FromObject> = FromObject extends Record<string, string> ? FromObject[keyof FromObject] : T extends 'string' ? string : T extends 'number' ? number : T extends 'boolean' ? boolean : never;
24
+ /**
25
+ * Type utility to generate event properties with proper required/optional handling
26
+ */
27
+ type EventProperties<T extends IdentityEvent> = {
28
+ [K in keyof T['properties'] as T['properties'][K]['required'] extends true ? K : never]: PropertyType<T['properties'][K]['type'], T['properties'][K]['fromObject']>;
29
+ } & {
30
+ [K in keyof T['properties'] as T['properties'][K]['required'] extends false ? K : never]?: PropertyType<T['properties'][K]['type'], T['properties'][K]['fromObject']>;
31
+ };
32
+ /**
33
+ * Identity events definitions matching the segment schema
34
+ */
35
+ export declare const IDENTITY_EVENTS: {
36
+ readonly ACCOUNT_SYNCING: {
37
+ readonly ACCOUNTS_SYNC_ADDED: {
38
+ readonly name: "Accounts Sync Added";
39
+ readonly properties: {
40
+ readonly profile_id: {
41
+ readonly required: true;
42
+ readonly type: "string";
43
+ };
44
+ };
45
+ };
46
+ readonly ACCOUNTS_SYNC_NAME_UPDATED: {
47
+ readonly name: "Accounts Sync Name Updated";
48
+ readonly properties: {
49
+ readonly profile_id: {
50
+ readonly required: true;
51
+ readonly type: "string";
52
+ };
53
+ };
54
+ };
55
+ readonly ACCOUNTS_SYNC_ERRONEOUS_SITUATION: {
56
+ readonly name: "Accounts Sync Erroneous Situation";
57
+ readonly properties: {
58
+ readonly profile_id: {
59
+ readonly required: true;
60
+ readonly type: "string";
61
+ };
62
+ readonly situation_message: {
63
+ readonly required: true;
64
+ readonly type: "string";
65
+ };
66
+ };
67
+ };
68
+ };
69
+ readonly NETWORK_SYNCING: {
70
+ readonly NETWORK_SYNC_ADDED: {
71
+ readonly name: "Network Sync Added";
72
+ readonly properties: {
73
+ readonly profile_id: {
74
+ readonly required: true;
75
+ readonly type: "string";
76
+ };
77
+ readonly chain_id: {
78
+ readonly required: true;
79
+ readonly type: "string";
80
+ };
81
+ };
82
+ };
83
+ readonly NETWORK_SYNC_UPDATED: {
84
+ readonly name: "Network Sync Updated";
85
+ readonly properties: {
86
+ readonly profile_id: {
87
+ readonly required: true;
88
+ readonly type: "string";
89
+ };
90
+ readonly chain_id: {
91
+ readonly required: true;
92
+ readonly type: "string";
93
+ };
94
+ };
95
+ };
96
+ readonly NETWORK_SYNC_REMOVED: {
97
+ readonly name: "Network Sync Removed";
98
+ readonly properties: {
99
+ readonly profile_id: {
100
+ readonly required: true;
101
+ readonly type: "string";
102
+ };
103
+ readonly chain_id: {
104
+ readonly required: true;
105
+ readonly type: "string";
106
+ };
107
+ };
108
+ };
109
+ };
110
+ readonly PROFILE: {
111
+ readonly ACTIVITY_UPDATED: {
112
+ readonly name: "Profile Activity Updated";
113
+ readonly properties: {
114
+ readonly profile_id: {
115
+ readonly required: false;
116
+ readonly type: "string";
117
+ };
118
+ readonly feature_name: {
119
+ readonly required: true;
120
+ readonly type: "string";
121
+ readonly fromObject: {
122
+ readonly BACKUP_AND_SYNC: "Backup And Sync";
123
+ readonly AUTHENTICATION: "Authentication";
124
+ };
125
+ };
126
+ readonly action: {
127
+ readonly required: true;
128
+ readonly type: "string";
129
+ readonly fromObject: {
130
+ readonly CONTACTS_SYNC_CONTACT_UPDATED: "Contacts Sync Contact Updated";
131
+ readonly CONTACTS_SYNC_CONTACT_DELETED: "Contacts Sync Contact Deleted";
132
+ readonly CONTACTS_SYNC_ERRONEOUS_SITUATION: "Contacts Sync Erroneous Situation";
133
+ readonly SETTINGS_TOGGLE_ENABLED: "settings_toggle_enabled";
134
+ readonly SETTINGS_TOGGLE_DISABLED: "settings_toggle_disabled";
135
+ readonly SIGN_IN: "Sign In";
136
+ readonly SIGN_OUT: "Sign Out";
137
+ readonly AUTHENTICATION_FAILED: "Authentication Failed";
138
+ };
139
+ };
140
+ readonly additional_description: {
141
+ readonly required: false;
142
+ readonly type: "string";
143
+ };
144
+ };
145
+ };
146
+ readonly BACKUP_AND_SYNC_INTRODUCTION_MODAL_INTERACTION: {
147
+ readonly name: "Backup And Sync Introduction Modal Interaction";
148
+ readonly properties: {
149
+ readonly profile_id: {
150
+ readonly required: false;
151
+ readonly type: "string";
152
+ };
153
+ readonly action: {
154
+ readonly required: true;
155
+ readonly type: "string";
156
+ readonly fromObject: {
157
+ readonly MODAL_OPENED: "modal_opened";
158
+ readonly MODAL_CLOSED: "modal_closed";
159
+ readonly ENABLE_CLICKED: "enable_clicked";
160
+ readonly DISMISS_CLICKED: "dismiss_clicked";
161
+ };
162
+ };
163
+ };
164
+ };
165
+ };
166
+ };
167
+ /**
168
+ * Type-safe event builder function
169
+ *
170
+ * @param event - The event definition
171
+ * @param properties - The event properties (type-checked)
172
+ * @returns An object with the event name and properties
173
+ */
174
+ export declare const buildIdentityEvent: <T extends IdentityEvent>(event: T, properties: EventProperties<T>) => {
175
+ name: T["name"];
176
+ properties: EventProperties<T>;
177
+ };
178
+ export type IdentityEventBuilder = typeof buildIdentityEvent;
179
+ export type IdentityEventDefinitions = typeof IDENTITY_EVENTS;
180
+ export {};
181
+ //# sourceMappingURL=metametrics.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metametrics.d.mts","sourceRoot":"","sources":["../../src/shared/metametrics.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE;QACV,CAAC,GAAG,EAAE,MAAM,GAAG;YACb,QAAQ,EAAE,OAAO,CAAC;YAClB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;YACtC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;SACrC,CAAC;KACH,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,KAAK,YAAY,CAAC,CAAC,EAAE,UAAU,IAC7B,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACrC,UAAU,CAAC,MAAM,UAAU,CAAC,GAC5B,CAAC,SAAS,QAAQ,GAChB,MAAM,GACN,CAAC,SAAS,QAAQ,GAChB,MAAM,GACN,CAAC,SAAS,SAAS,GACjB,OAAO,GACP,KAAK,CAAC;AAElB;;GAEG;AACH,KAAK,eAAe,CAAC,CAAC,SAAS,aAAa,IAAI;KAC7C,CAAC,IAAI,MAAM,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,IAAI,GACtE,CAAC,GACD,KAAK,GAAG,YAAY,CACtB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAC1B,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CACjC;CACF,GAAG;KACD,CAAC,IAAI,MAAM,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,SAAS,KAAK,GACvE,CAAC,GACD,KAAK,CAAC,CAAC,EAAE,YAAY,CACvB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAC1B,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CACjC;CACF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoIsC,CAAC;AAEnE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;CAM7B,CAAC;AAGH,MAAM,MAAM,oBAAoB,GAAG,OAAO,kBAAkB,CAAC;AAC7D,MAAM,MAAM,wBAAwB,GAAG,OAAO,eAAe,CAAC"}
@@ -0,0 +1,153 @@
1
+ /**
2
+ * MetaMetrics events library for profile-sync-controller
3
+ *
4
+ * This library provides type-safe event definitions that mirror the segment schema,
5
+ * ensuring consistency and providing compile-time validation for event properties.
6
+ */
7
+ /**
8
+ * Identity events definitions matching the segment schema
9
+ */
10
+ export const IDENTITY_EVENTS = {
11
+ ACCOUNT_SYNCING: {
12
+ ACCOUNTS_SYNC_ADDED: {
13
+ name: 'Accounts Sync Added',
14
+ properties: {
15
+ profile_id: {
16
+ required: true,
17
+ type: 'string',
18
+ },
19
+ },
20
+ },
21
+ ACCOUNTS_SYNC_NAME_UPDATED: {
22
+ name: 'Accounts Sync Name Updated',
23
+ properties: {
24
+ profile_id: {
25
+ required: true,
26
+ type: 'string',
27
+ },
28
+ },
29
+ },
30
+ ACCOUNTS_SYNC_ERRONEOUS_SITUATION: {
31
+ name: 'Accounts Sync Erroneous Situation',
32
+ properties: {
33
+ profile_id: {
34
+ required: true,
35
+ type: 'string',
36
+ },
37
+ situation_message: {
38
+ required: true,
39
+ type: 'string',
40
+ },
41
+ },
42
+ },
43
+ },
44
+ NETWORK_SYNCING: {
45
+ NETWORK_SYNC_ADDED: {
46
+ name: 'Network Sync Added',
47
+ properties: {
48
+ profile_id: {
49
+ required: true,
50
+ type: 'string',
51
+ },
52
+ chain_id: {
53
+ required: true,
54
+ type: 'string',
55
+ },
56
+ },
57
+ },
58
+ NETWORK_SYNC_UPDATED: {
59
+ name: 'Network Sync Updated',
60
+ properties: {
61
+ profile_id: {
62
+ required: true,
63
+ type: 'string',
64
+ },
65
+ chain_id: {
66
+ required: true,
67
+ type: 'string',
68
+ },
69
+ },
70
+ },
71
+ NETWORK_SYNC_REMOVED: {
72
+ name: 'Network Sync Removed',
73
+ properties: {
74
+ profile_id: {
75
+ required: true,
76
+ type: 'string',
77
+ },
78
+ chain_id: {
79
+ required: true,
80
+ type: 'string',
81
+ },
82
+ },
83
+ },
84
+ },
85
+ PROFILE: {
86
+ ACTIVITY_UPDATED: {
87
+ name: 'Profile Activity Updated',
88
+ properties: {
89
+ profile_id: {
90
+ required: false,
91
+ type: 'string',
92
+ },
93
+ feature_name: {
94
+ required: true,
95
+ type: 'string',
96
+ fromObject: {
97
+ BACKUP_AND_SYNC: 'Backup And Sync',
98
+ AUTHENTICATION: 'Authentication',
99
+ },
100
+ },
101
+ action: {
102
+ required: true,
103
+ type: 'string',
104
+ fromObject: {
105
+ CONTACTS_SYNC_CONTACT_UPDATED: 'Contacts Sync Contact Updated',
106
+ CONTACTS_SYNC_CONTACT_DELETED: 'Contacts Sync Contact Deleted',
107
+ CONTACTS_SYNC_ERRONEOUS_SITUATION: 'Contacts Sync Erroneous Situation',
108
+ SETTINGS_TOGGLE_ENABLED: 'settings_toggle_enabled',
109
+ SETTINGS_TOGGLE_DISABLED: 'settings_toggle_disabled',
110
+ SIGN_IN: 'Sign In',
111
+ SIGN_OUT: 'Sign Out',
112
+ AUTHENTICATION_FAILED: 'Authentication Failed',
113
+ },
114
+ },
115
+ additional_description: {
116
+ required: false,
117
+ type: 'string',
118
+ },
119
+ },
120
+ },
121
+ BACKUP_AND_SYNC_INTRODUCTION_MODAL_INTERACTION: {
122
+ name: 'Backup And Sync Introduction Modal Interaction',
123
+ properties: {
124
+ profile_id: {
125
+ required: false,
126
+ type: 'string',
127
+ },
128
+ action: {
129
+ required: true,
130
+ type: 'string',
131
+ fromObject: {
132
+ MODAL_OPENED: 'modal_opened',
133
+ MODAL_CLOSED: 'modal_closed',
134
+ ENABLE_CLICKED: 'enable_clicked',
135
+ DISMISS_CLICKED: 'dismiss_clicked',
136
+ },
137
+ },
138
+ },
139
+ },
140
+ },
141
+ };
142
+ /**
143
+ * Type-safe event builder function
144
+ *
145
+ * @param event - The event definition
146
+ * @param properties - The event properties (type-checked)
147
+ * @returns An object with the event name and properties
148
+ */
149
+ export const buildIdentityEvent = (event, properties) => ({
150
+ name: event.name,
151
+ properties,
152
+ });
153
+ //# sourceMappingURL=metametrics.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metametrics.mjs","sourceRoot":"","sources":["../../src/shared/metametrics.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiDH;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,eAAe,EAAE;QACf,mBAAmB,EAAE;YACnB,IAAI,EAAE,qBAAqB;YAC3B,UAAU,EAAE;gBACV,UAAU,EAAE;oBACV,QAAQ,EAAE,IAAI;oBACd,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;QACD,0BAA0B,EAAE;YAC1B,IAAI,EAAE,4BAA4B;YAClC,UAAU,EAAE;gBACV,UAAU,EAAE;oBACV,QAAQ,EAAE,IAAI;oBACd,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;QACD,iCAAiC,EAAE;YACjC,IAAI,EAAE,mCAAmC;YACzC,UAAU,EAAE;g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E,QAAQ;oBACd,UAAU,EAAE;wBACV,6BAA6B,EAAE,+BAA+B;wBAC9D,6BAA6B,EAAE,+BAA+B;wBAC9D,iCAAiC,EAC/B,mCAAmC;wBACrC,uBAAuB,EAAE,yBAAyB;wBAClD,wBAAwB,EAAE,0BAA0B;wBACpD,OAAO,EAAE,SAAS;wBAClB,QAAQ,EAAE,UAAU;wBACpB,qBAAqB,EAAE,uBAAuB;qBAC/C;iBACF;gBACD,sBAAsB,EAAE;oBACtB,QAAQ,EAAE,KAAK;oBACf,IAAI,EAAE,QAAQ;iBACf;aACF;SACF;QACD,8CAA8C,EAAE;YAC9C,IAAI,EAAE,gDAAgD;YACtD,UAAU,EAAE;gBACV,UAAU,EAAE;oBACV,QAAQ,EAAE,KAAK;oBACf,IAAI,EAAE,QAAQ;iBACf;gBACD,MAAM,EAAE;oBACN,QAAQ,EAAE,IAAI;oBACd,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE;wBACV,YAAY,EAAE,cAAc;wBAC5B,YAAY,EAAE,cAAc;wBAC5B,cAAc,EAAE,gBAAgB;wBAChC,eAAe,EAAE,iBAAiB;qBACnC;iBACF;aACF;SACF;KACF;CAC+D,CAAC;AAEnE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,KAAQ,EACR,UAA8B,EACmC,EAAE,CAAC,CAAC;IACrE,IAAI,EAAE,KAAK,CAAC,IAAI;IAChB,UAAU;CACX,CAAC,CAAC","sourcesContent":["/**\n * MetaMetrics events library for profile-sync-controller\n *\n * This library provides type-safe event definitions that mirror the segment schema,\n * ensuring consistency and providing compile-time validation for event properties.\n */\n\n/**\n * Interface defining the structure of an identity event\n */\nexport type IdentityEvent = {\n name: string;\n properties: {\n [key: string]: {\n required: boolean;\n type: 'string' | 'number' | 'boolean';\n fromObject?: Record<string, string>;\n };\n };\n};\n\n/**\n * Type utility to extract property types from event definitions\n */\ntype PropertyType<T, FromObject> =\n FromObject extends Record<string, string>\n ? FromObject[keyof FromObject]\n : T extends 'string'\n ? string\n : T extends 'number'\n ? number\n : T extends 'boolean'\n ? boolean\n : never;\n\n/**\n * Type utility to generate event properties with proper required/optional handling\n */\ntype EventProperties<T extends IdentityEvent> = {\n [K in keyof T['properties'] as T['properties'][K]['required'] extends true\n ? K\n : never]: PropertyType<\n T['properties'][K]['type'],\n T['properties'][K]['fromObject']\n >;\n} & {\n [K in keyof T['properties'] as T['properties'][K]['required'] extends false\n ? K\n : never]?: PropertyType<\n T['properties'][K]['type'],\n T['properties'][K]['fromObject']\n >;\n};\n\n/**\n * Identity events definitions matching the segment schema\n */\nexport const IDENTITY_EVENTS = {\n ACCOUNT_SYNCING: {\n ACCOUNTS_SYNC_ADDED: {\n name: 'Accounts Sync Added',\n properties: {\n profile_id: {\n required: true,\n type: 'string',\n },\n },\n },\n ACCOUNTS_SYNC_NAME_UPDATED: {\n name: 'Accounts Sync Name Updated',\n properties: {\n profile_id: {\n required: true,\n type: 'string',\n },\n },\n },\n ACCOUNTS_SYNC_ERRONEOUS_SITUATION: {\n name: 'Accounts Sync Erroneous Situation',\n properties: {\n profile_id: {\n required: true,\n type: 'string',\n },\n situation_message: {\n required: true,\n type: 'string',\n },\n },\n },\n },\n NETWORK_SYNCING: {\n NETWORK_SYNC_ADDED: {\n name: 'Network Sync Added',\n properties: {\n profile_id: {\n required: true,\n type: 'string',\n },\n chain_id: {\n required: true,\n type: 'string',\n },\n },\n },\n NETWORK_SYNC_UPDATED: {\n name: 'Network Sync Updated',\n properties: {\n profile_id: {\n required: true,\n type: 'string',\n },\n chain_id: {\n required: true,\n type: 'string',\n },\n },\n },\n NETWORK_SYNC_REMOVED: {\n name: 'Network Sync Removed',\n properties: {\n profile_id: {\n required: true,\n type: 'string',\n },\n chain_id: {\n required: true,\n type: 'string',\n },\n },\n },\n },\n PROFILE: {\n ACTIVITY_UPDATED: {\n name: 'Profile Activity Updated',\n properties: {\n profile_id: {\n required: false,\n type: 'string',\n },\n feature_name: {\n required: true,\n type: 'string',\n fromObject: {\n BACKUP_AND_SYNC: 'Backup And Sync',\n AUTHENTICATION: 'Authentication',\n },\n },\n action: {\n required: true,\n type: 'string',\n fromObject: {\n CONTACTS_SYNC_CONTACT_UPDATED: 'Contacts Sync Contact Updated',\n CONTACTS_SYNC_CONTACT_DELETED: 'Contacts Sync Contact Deleted',\n CONTACTS_SYNC_ERRONEOUS_SITUATION:\n 'Contacts Sync Erroneous Situation',\n SETTINGS_TOGGLE_ENABLED: 'settings_toggle_enabled',\n SETTINGS_TOGGLE_DISABLED: 'settings_toggle_disabled',\n SIGN_IN: 'Sign In',\n SIGN_OUT: 'Sign Out',\n AUTHENTICATION_FAILED: 'Authentication Failed',\n },\n },\n additional_description: {\n required: false,\n type: 'string',\n },\n },\n },\n BACKUP_AND_SYNC_INTRODUCTION_MODAL_INTERACTION: {\n name: 'Backup And Sync Introduction Modal Interaction',\n properties: {\n profile_id: {\n required: false,\n type: 'string',\n },\n action: {\n required: true,\n type: 'string',\n fromObject: {\n MODAL_OPENED: 'modal_opened',\n MODAL_CLOSED: 'modal_closed',\n ENABLE_CLICKED: 'enable_clicked',\n DISMISS_CLICKED: 'dismiss_clicked',\n },\n },\n },\n },\n },\n} as const satisfies Record<string, Record<string, IdentityEvent>>;\n\n/**\n * Type-safe event builder function\n *\n * @param event - The event definition\n * @param properties - The event properties (type-checked)\n * @returns An object with the event name and properties\n */\nexport const buildIdentityEvent = <T extends IdentityEvent>(\n event: T,\n properties: EventProperties<T>,\n): { name: (typeof event)['name']; properties: typeof properties } => ({\n name: event.name,\n properties,\n});\n\n// Export types for external use\nexport type IdentityEventBuilder = typeof buildIdentityEvent;\nexport type IdentityEventDefinitions = typeof IDENTITY_EVENTS;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/profile-sync-controller",
3
- "version": "19.0.0-preview-48b44963",
3
+ "version": "19.0.0-preview-bfad74b0",
4
4
  "description": "The profile sync helps developers synchronize data across multiple clients and devices in a privacy-preserving way. All data saved in the user storage database is encrypted client-side to preserve privacy. The user storage provides a modular design, giving developers the flexibility to construct and manage their storage spaces in a way that best suits their needs",
5
5
  "keywords": [
6
6
  "MetaMask",