cryptique-sdk 1.2.23 → 1.2.24

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.
@@ -1,250 +1,284 @@
1
- /**
2
- * Cryptique Analytics SDK - TypeScript Definitions
3
- */
4
-
5
- export interface CryptiqueOptions {
6
- siteId: string;
7
- autoEvents?: boolean;
8
- disabledPaths?: string[];
9
- disabledEvents?: string[];
10
- }
11
-
12
- export interface AutoEventsConfig {
13
- enabled: boolean;
14
- disabledPaths: string[];
15
- disabledEvents: string[];
16
- availableEvents: string[];
17
- currentPath: string;
18
- shouldTrack: boolean;
19
- }
20
-
21
- export interface SessionData {
22
- sessionId: string | null;
23
- siteId: string;
24
- userId: string | null;
25
- startTime: string | null;
26
- endTime: string | null;
27
- lastActivity: number | null;
28
- duration: number;
29
- pagesViewed: number;
30
- isBounce: boolean;
31
- [key: string]: any;
32
- }
33
-
34
- export interface Interaction {
35
- timestamp: string;
36
- category: string;
37
- originalCategory: string;
38
- [key: string]: any;
39
- }
40
-
41
- export interface PeopleResult {
42
- success: boolean;
43
- error?: string;
44
- [key: string]: any;
45
- }
46
-
47
- export interface PeopleManager {
48
- /**
49
- * Set custom properties (merge at top level)
50
- */
51
- set(properties: Record<string, any>): Promise<PeopleResult>;
52
-
53
- /**
54
- * Set custom properties only if they don't exist
55
- */
56
- setOnce(properties: Record<string, any>): Promise<PeopleResult>;
57
-
58
- /**
59
- * Remove custom properties
60
- */
61
- unset(properties: string | string[]): Promise<PeopleResult>;
62
-
63
- /**
64
- * Increment numeric properties
65
- */
66
- increment(properties: Record<string, number>): Promise<PeopleResult>;
67
-
68
- /**
69
- * Append values to list properties
70
- */
71
- append(properties: Record<string, any>): Promise<PeopleResult>;
72
-
73
- /**
74
- * Union values with list properties (add unique values)
75
- */
76
- union(properties: Record<string, any[]>): Promise<PeopleResult>;
77
-
78
- /**
79
- * Remove values from list properties
80
- */
81
- remove(properties: Record<string, any>): Promise<PeopleResult>;
82
-
83
- /**
84
- * Track a charge/revenue event
85
- */
86
- trackCharge(amount: number, properties?: Record<string, any>): Promise<PeopleResult>;
87
-
88
- /**
89
- * Clear all charges
90
- */
91
- clearCharges(): Promise<PeopleResult>;
92
-
93
- /**
94
- * Delete user and all associated data
95
- */
96
- deleteUser(): Promise<PeopleResult>;
97
- }
98
-
99
- export default class CryptiqueSDK {
100
- /**
101
- * Initialize the SDK programmatically
102
- * Returns a Promise that resolves when the SDK is fully initialized
103
- */
104
- init(options: CryptiqueOptions): Promise<any>;
105
-
106
- /**
107
- * Get the SDK instance
108
- */
109
- getInstance(): any | null;
110
-
111
- /**
112
- * Wait for SDK to be fully initialized
113
- */
114
- ready(): Promise<void>;
115
-
116
- /**
117
- * Track a custom event
118
- */
119
- track(eventName: string, properties?: object, options?: object): Promise<void>;
120
-
121
- /**
122
- * Track a custom event (alias for track)
123
- */
124
- trackEvent(eventName: string, properties?: object, options?: object): Promise<void>;
125
-
126
- /**
127
- * Track an auto event
128
- */
129
- trackAutoEvent(eventName: string, autoEventData?: object, elementData?: object): Promise<void>;
130
-
131
- /**
132
- * Connect wallet
133
- */
134
- connectWallet(): Promise<string | null>;
135
-
136
- /**
137
- * Check if wallet is connected
138
- */
139
- isWalletConnected(): Promise<boolean>;
140
-
141
- /**
142
- * Update wallet info
143
- */
144
- updateWalletInfo(): Promise<any>;
145
-
146
- /**
147
- * Identify a user with a unique identifier
148
- * Merges identities if the identifier already exists for another user
149
- */
150
- identify(identifyId: string): Promise<{ success: boolean; merged?: boolean; newUserId?: string; error?: string }>;
151
-
152
- /**
153
- * Set wallet address for current user
154
- * Merges identities if wallet address already exists for another user
155
- */
156
- walletAddress(walletAddress: string): Promise<{ success: boolean; merged?: boolean; newUserId?: string; error?: string }>;
157
-
158
- /**
159
- * Reset user identity to anonymous
160
- * Generates a new anonymous distinct_id and clears identification
161
- */
162
- reset(): Promise<{ success: boolean; distinctId?: string; error?: string }>;
163
-
164
- /**
165
- * Set tracking consent
166
- */
167
- setTrackingConsent(consent: boolean): void;
168
-
169
- /**
170
- * Get tracking consent
171
- */
172
- getTrackingConsent(): boolean;
173
-
174
- /**
175
- * Get session data
176
- */
177
- getSessionData(): SessionData;
178
-
179
- /**
180
- * Get chronological interactions
181
- */
182
- getChronologicalInteractions(): Interaction[];
183
-
184
- /**
185
- * Sort interactions chronologically (alias)
186
- */
187
- sortInteractionsChronologically(): Interaction[];
188
-
189
- /**
190
- * Enable auto events
191
- */
192
- enableAutoEvents(): void;
193
-
194
- /**
195
- * Disable auto events
196
- */
197
- disableAutoEvents(): void;
198
-
199
- /**
200
- * Set auto events disabled paths
201
- */
202
- setAutoEventsDisabledPaths(paths: string | string[]): void;
203
-
204
- /**
205
- * Disable specific auto events
206
- */
207
- disableAutoEvent(events: string | string[]): void;
208
-
209
- /**
210
- * Enable specific auto events
211
- */
212
- enableAutoEvent(events: string | string[]): void;
213
-
214
- /**
215
- * Set auto events disabled events
216
- */
217
- setAutoEventsDisabledEvents(events: string[]): void;
218
-
219
- /**
220
- * Get available auto events
221
- */
222
- getAvailableAutoEvents(): string[];
223
-
224
- /**
225
- * Get auto events configuration
226
- */
227
- getAutoEventsConfig(): AutoEventsConfig;
228
-
229
- /**
230
- * People manager for custom user properties
231
- */
232
- people: PeopleManager;
233
-
234
- /**
235
- * SDK version
236
- */
237
- version: string;
238
-
239
- /**
240
- * Site ID
241
- */
242
- siteId: string;
243
-
244
- /**
245
- * Session data
246
- */
247
- sessionData: SessionData;
248
- }
249
-
250
- export { CryptiqueSDK };
1
+ /**
2
+ * Cryptique Analytics SDK - TypeScript Definitions
3
+ */
4
+
5
+ export interface CryptiqueOptions {
6
+ siteId: string;
7
+ autoEvents?: boolean;
8
+ disabledPaths?: string[];
9
+ disabledEvents?: string[];
10
+ }
11
+
12
+ export interface AutoEventsConfig {
13
+ enabled: boolean;
14
+ disabledPaths: string[];
15
+ disabledEvents: string[];
16
+ availableEvents: string[];
17
+ currentPath: string;
18
+ shouldTrack: boolean;
19
+ }
20
+
21
+ export interface SessionData {
22
+ sessionId: string | null;
23
+ siteId: string;
24
+ userId: string | null;
25
+ startTime: string | null;
26
+ endTime: string | null;
27
+ lastActivity: number | null;
28
+ duration: number;
29
+ pagesViewed: number;
30
+ isBounce: boolean;
31
+ [key: string]: any;
32
+ }
33
+
34
+ export interface Interaction {
35
+ timestamp: string;
36
+ category: string;
37
+ originalCategory: string;
38
+ [key: string]: any;
39
+ }
40
+
41
+ export interface PeopleResult {
42
+ success: boolean;
43
+ error?: string;
44
+ [key: string]: any;
45
+ }
46
+
47
+ export interface PeopleManager {
48
+ /**
49
+ * Set custom properties (merge at top level)
50
+ */
51
+ set(properties: Record<string, any>): Promise<PeopleResult>;
52
+
53
+ /**
54
+ * Set custom properties only if they don't exist
55
+ */
56
+ setOnce(properties: Record<string, any>): Promise<PeopleResult>;
57
+
58
+ /**
59
+ * Remove custom properties
60
+ */
61
+ unset(keys: string | string[]): Promise<PeopleResult>;
62
+
63
+ /**
64
+ * Increment a numeric property by key
65
+ */
66
+ increment(key: string, amount?: number): Promise<PeopleResult>;
67
+
68
+ /**
69
+ * Append values to an array property
70
+ */
71
+ append(key: string, values: any[]): Promise<PeopleResult>;
72
+
73
+ /**
74
+ * Union values with an array property (deduplicate)
75
+ */
76
+ union(key: string, values: any[]): Promise<PeopleResult>;
77
+
78
+ /**
79
+ * Remove values from an array property
80
+ */
81
+ remove(key: string, values: any[]): Promise<PeopleResult>;
82
+
83
+ /**
84
+ * Track a charge/revenue event
85
+ */
86
+ trackCharge(amount: number, properties?: Record<string, any>): Promise<PeopleResult>;
87
+
88
+ /**
89
+ * Clear all charges
90
+ */
91
+ clearCharges(): Promise<PeopleResult>;
92
+
93
+ /**
94
+ * Delete user and all associated data
95
+ */
96
+ deleteUser(): Promise<PeopleResult>;
97
+ }
98
+
99
+ /**
100
+ * Returned by get_group(); profile calls hit the groups profile API.
101
+ */
102
+ export interface GroupProfileRef {
103
+ set(properties: Record<string, any>): Promise<PeopleResult>;
104
+ set_once(properties: Record<string, any>): Promise<PeopleResult>;
105
+ union(listName: string, values: any[]): Promise<PeopleResult>;
106
+ remove(listName: string, value: any): Promise<PeopleResult>;
107
+ unset(property: string): Promise<PeopleResult>;
108
+ increment(property: string, value?: number): Promise<PeopleResult>;
109
+ append(property: string, value: any): Promise<PeopleResult>;
110
+ delete(): Promise<PeopleResult>;
111
+ }
112
+
113
+ export default class CryptiqueSDK {
114
+ /**
115
+ * Initialize the SDK programmatically
116
+ * Returns a Promise that resolves when the SDK is fully initialized
117
+ */
118
+ init(options: CryptiqueOptions): Promise<any>;
119
+
120
+ /**
121
+ * Get the SDK instance
122
+ */
123
+ getInstance(): any | null;
124
+
125
+ /**
126
+ * Wait for SDK to be fully initialized
127
+ */
128
+ ready(): Promise<void>;
129
+
130
+ /**
131
+ * Track a custom event
132
+ */
133
+ track(eventName: string, properties?: object, options?: object): Promise<void>;
134
+
135
+ /**
136
+ * Track a custom event (alias for track)
137
+ */
138
+ trackEvent(eventName: string, properties?: object, options?: object): Promise<void>;
139
+
140
+ /**
141
+ * Track an auto event
142
+ */
143
+ trackAutoEvent(eventName: string, autoEventData?: object, elementData?: object): Promise<void>;
144
+
145
+ /**
146
+ * Connect wallet
147
+ */
148
+ connectWallet(): Promise<string | null>;
149
+
150
+ /**
151
+ * Check if wallet is connected
152
+ */
153
+ isWalletConnected(): Promise<boolean>;
154
+
155
+ /**
156
+ * Update wallet info
157
+ */
158
+ updateWalletInfo(): Promise<any>;
159
+
160
+ /**
161
+ * Identify a user with a unique identifier
162
+ * Merges identities if the identifier already exists for another user
163
+ */
164
+ identify(identifyId: string): Promise<{ success: boolean; merged?: boolean; newUserId?: string; error?: string }>;
165
+
166
+ /**
167
+ * Set wallet address for current user
168
+ * Merges identities if wallet address already exists for another user
169
+ */
170
+ walletAddress(walletAddress: string): Promise<{ success: boolean; merged?: boolean; newUserId?: string; error?: string }>;
171
+
172
+ /**
173
+ * Reset user identity to anonymous
174
+ * Generates a new anonymous distinct_id and clears identification
175
+ */
176
+ reset(): Promise<{ success: boolean; distinctId?: string; error?: string }>;
177
+
178
+ /**
179
+ * Set tracking consent
180
+ */
181
+ setTrackingConsent(consent: boolean): void;
182
+
183
+ /**
184
+ * Get tracking consent
185
+ */
186
+ getTrackingConsent(): boolean;
187
+
188
+ /**
189
+ * Get session data
190
+ */
191
+ getSessionData(): SessionData;
192
+
193
+ /**
194
+ * Get chronological interactions
195
+ */
196
+ getChronologicalInteractions(): Interaction[];
197
+
198
+ /**
199
+ * Sort interactions chronologically (alias)
200
+ */
201
+ sortInteractionsChronologically(): Interaction[];
202
+
203
+ /**
204
+ * Enable auto events
205
+ */
206
+ enableAutoEvents(): void;
207
+
208
+ /**
209
+ * Disable auto events
210
+ */
211
+ disableAutoEvents(): void;
212
+
213
+ /**
214
+ * Set auto events disabled paths
215
+ */
216
+ setAutoEventsDisabledPaths(paths: string | string[]): void;
217
+
218
+ /**
219
+ * Disable specific auto events
220
+ */
221
+ disableAutoEvent(events: string | string[]): void;
222
+
223
+ /**
224
+ * Enable specific auto events
225
+ */
226
+ enableAutoEvent(events: string | string[]): void;
227
+
228
+ /**
229
+ * Set auto events disabled events
230
+ */
231
+ setAutoEventsDisabledEvents(events: string[]): void;
232
+
233
+ /**
234
+ * Get available auto events
235
+ */
236
+ getAvailableAutoEvents(): string[];
237
+
238
+ /**
239
+ * Get auto events configuration
240
+ */
241
+ getAutoEventsConfig(): AutoEventsConfig;
242
+
243
+ /**
244
+ * People manager for custom user properties
245
+ */
246
+ people: PeopleManager;
247
+
248
+ /**
249
+ * Set (overwrite) group membership for a key
250
+ */
251
+ set_group(groupKey: string, groupId: string | string[]): Promise<PeopleResult>;
252
+
253
+ /**
254
+ * Add a group id to a key without removing existing memberships
255
+ */
256
+ add_group(groupKey: string, groupId: string): Promise<PeopleResult>;
257
+
258
+ /**
259
+ * Remove a specific group id from a key
260
+ */
261
+ remove_group(groupKey: string, groupId: string): Promise<PeopleResult>;
262
+
263
+ /**
264
+ * Group profile operations for a specific (groupKey, groupId)
265
+ */
266
+ get_group(groupKey: string, groupId: string): GroupProfileRef;
267
+
268
+ /**
269
+ * SDK version
270
+ */
271
+ version: string;
272
+
273
+ /**
274
+ * Site ID
275
+ */
276
+ siteId: string;
277
+
278
+ /**
279
+ * Session data
280
+ */
281
+ sessionData: SessionData;
282
+ }
283
+
284
+ export { CryptiqueSDK };