@chordcommerce/analytics 1.17.1 → 1.18.0
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/README.md +8 -0
- package/dist/cjs/client/cdp.d.ts +3 -0
- package/dist/cjs/client/cdp.js +123 -0
- package/dist/cjs/client/consent/index.d.ts +11 -0
- package/dist/cjs/client/consent/index.js +241 -0
- package/dist/cjs/client/consent/ketch.d.ts +16 -0
- package/dist/cjs/client/consent/ketch.js +53 -0
- package/dist/cjs/client/consent/onetrust.d.ts +22 -0
- package/dist/cjs/client/consent/onetrust.js +61 -0
- package/dist/cjs/client/consent/segment.d.ts +17 -0
- package/dist/cjs/client/consent/segment.js +155 -0
- package/dist/cjs/client/consent/shopify.d.ts +21 -0
- package/dist/cjs/client/consent/shopify.js +51 -0
- package/dist/cjs/client/index.d.ts +111 -0
- package/dist/cjs/client/index.js +861 -0
- package/dist/cjs/client/utils.d.ts +1 -0
- package/dist/cjs/client/utils.js +12 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/setupTests.d.ts +1 -0
- package/dist/cjs/setupTests.js +6 -0
- package/dist/cjs/types/client.d.ts +96 -0
- package/dist/cjs/types/client.js +2 -0
- package/dist/cjs/types/consent.d.ts +11 -0
- package/dist/cjs/types/consent.js +2 -0
- package/dist/cjs/types/formatters.d.ts +114 -0
- package/dist/cjs/types/formatters.js +2 -0
- package/dist/cjs/types/index.d.ts +7 -0
- package/dist/cjs/types/index.js +22 -0
- package/dist/cjs/types/input.d.ts +396 -0
- package/dist/cjs/types/input.js +2 -0
- package/dist/cjs/types/objects.d.ts +379 -0
- package/dist/cjs/types/objects.js +2 -0
- package/dist/cjs/types/typewriter.d.ts +6502 -0
- package/dist/cjs/types/typewriter.js +5 -0
- package/dist/cjs/utils.d.ts +2 -0
- package/dist/cjs/utils.js +25 -0
- package/dist/cjs/validators/custom.d.ts +43 -0
- package/dist/cjs/validators/custom.js +18 -0
- package/dist/cjs/validators/index.d.ts +4 -0
- package/dist/cjs/validators/index.js +20 -0
- package/dist/cjs/validators/objects.d.ts +696 -0
- package/dist/cjs/validators/objects.js +128 -0
- package/dist/cjs/validators/tracking-plan-map.d.ts +6603 -0
- package/dist/cjs/validators/tracking-plan-map.js +72 -0
- package/dist/cjs/validators/tracking-plan.d.ts +9275 -0
- package/dist/cjs/validators/tracking-plan.js +1682 -0
- package/package.json +4 -2
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import type { AnyId, ObjectTypes } from './client.js';
|
|
2
|
+
import type { Filter, Sort, SubscriptionCancelledAddress } from './typewriter.js';
|
|
3
|
+
export interface ProductInput<ProductType extends ObjectTypes['Product'] = ObjectTypes['Product']> {
|
|
4
|
+
/**
|
|
5
|
+
* The position in a list of the product that was added, if relevant.
|
|
6
|
+
*/
|
|
7
|
+
position?: number;
|
|
8
|
+
/**
|
|
9
|
+
* Product and variant details, like product name and variant SKUs.
|
|
10
|
+
*/
|
|
11
|
+
product: ProductType;
|
|
12
|
+
/**
|
|
13
|
+
* The quantity of the product involved in the tracking event. Sometimes quantity might
|
|
14
|
+
* not be relevant to an event, and can be either omitted or defaulted to `1`.
|
|
15
|
+
*/
|
|
16
|
+
quantity?: number;
|
|
17
|
+
/**
|
|
18
|
+
* The unique identifier of the product variant. This should allow you to look up the
|
|
19
|
+
* selected variant details from the `product` object. If not provided, it's typical
|
|
20
|
+
* to default to the first product variant, or default product variant if that's a concept
|
|
21
|
+
* that exists in your product catalog.
|
|
22
|
+
*/
|
|
23
|
+
variantId?: AnyId;
|
|
24
|
+
}
|
|
25
|
+
export interface CartInput<CartType extends ObjectTypes['Cart'] = ObjectTypes['Cart']> {
|
|
26
|
+
/**
|
|
27
|
+
* The current cart.
|
|
28
|
+
*/
|
|
29
|
+
cart: CartType;
|
|
30
|
+
}
|
|
31
|
+
export interface CheckoutInput<CheckoutType extends ObjectTypes['Checkout'] = ObjectTypes['Checkout']> {
|
|
32
|
+
/**
|
|
33
|
+
* The current checkout.
|
|
34
|
+
*/
|
|
35
|
+
checkout: CheckoutType;
|
|
36
|
+
}
|
|
37
|
+
export interface LineItemInput<LineItemType extends ObjectTypes['LineItem'] = ObjectTypes['LineItem']> {
|
|
38
|
+
/**
|
|
39
|
+
* The line item before it was removed.
|
|
40
|
+
*/
|
|
41
|
+
lineItem: LineItemType;
|
|
42
|
+
}
|
|
43
|
+
export interface CartViewedInput<T extends ObjectTypes = ObjectTypes> {
|
|
44
|
+
/**
|
|
45
|
+
* The current cart.
|
|
46
|
+
*/
|
|
47
|
+
cart: T['Cart'];
|
|
48
|
+
}
|
|
49
|
+
export interface CheckoutStartedInput<T extends ObjectTypes = ObjectTypes> {
|
|
50
|
+
/**
|
|
51
|
+
* The current checkout.
|
|
52
|
+
*/
|
|
53
|
+
checkout: T['Checkout'];
|
|
54
|
+
}
|
|
55
|
+
export interface CheckoutStepCompletedInput {
|
|
56
|
+
/**
|
|
57
|
+
* The current checkout.
|
|
58
|
+
*/
|
|
59
|
+
checkoutId: string;
|
|
60
|
+
/**
|
|
61
|
+
* The step that was completed.
|
|
62
|
+
*/
|
|
63
|
+
step: number;
|
|
64
|
+
/**
|
|
65
|
+
* String representing the payment method chosen
|
|
66
|
+
*/
|
|
67
|
+
paymentMethod?: string;
|
|
68
|
+
/**
|
|
69
|
+
* String representing the shipping the method chosen
|
|
70
|
+
*/
|
|
71
|
+
shippingMethod?: string;
|
|
72
|
+
}
|
|
73
|
+
export interface CheckoutStepViewedInput {
|
|
74
|
+
/**
|
|
75
|
+
* The current checkout.
|
|
76
|
+
*/
|
|
77
|
+
checkoutId: string;
|
|
78
|
+
/**
|
|
79
|
+
* The step that was completed.
|
|
80
|
+
*/
|
|
81
|
+
step: number;
|
|
82
|
+
/**
|
|
83
|
+
* String representing the payment method chosen
|
|
84
|
+
*/
|
|
85
|
+
paymentMethod?: string;
|
|
86
|
+
/**
|
|
87
|
+
* String representing the shipping the method chosen
|
|
88
|
+
*/
|
|
89
|
+
shippingMethod?: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Coupon was applied on a user's shopping cart or order
|
|
93
|
+
*/
|
|
94
|
+
export interface CouponAppliedInput {
|
|
95
|
+
/**
|
|
96
|
+
* Cart ID, if applicable
|
|
97
|
+
*/
|
|
98
|
+
cartId?: string;
|
|
99
|
+
/**
|
|
100
|
+
* Coupon ID
|
|
101
|
+
*/
|
|
102
|
+
couponId?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Coupon name
|
|
105
|
+
*/
|
|
106
|
+
couponName?: string;
|
|
107
|
+
/**
|
|
108
|
+
* Monetary discount applied through the coupon
|
|
109
|
+
*/
|
|
110
|
+
discount?: number;
|
|
111
|
+
/**
|
|
112
|
+
* Order/transaction ID, if applicable
|
|
113
|
+
*/
|
|
114
|
+
orderId?: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Coupon was denied from a user's shopping cart or order
|
|
118
|
+
*/
|
|
119
|
+
export interface CouponDeniedInput {
|
|
120
|
+
/**
|
|
121
|
+
* Cart ID, if applicable
|
|
122
|
+
*/
|
|
123
|
+
cartId?: string;
|
|
124
|
+
/**
|
|
125
|
+
* Coupon ID
|
|
126
|
+
*/
|
|
127
|
+
couponId?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Coupon name
|
|
130
|
+
*/
|
|
131
|
+
couponName?: string;
|
|
132
|
+
/**
|
|
133
|
+
* Order/transaction ID, if applicable
|
|
134
|
+
*/
|
|
135
|
+
orderId?: string;
|
|
136
|
+
/**
|
|
137
|
+
* Reason the coupon was denied
|
|
138
|
+
*/
|
|
139
|
+
reason?: string;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* User entered a coupon on a shopping cart or order
|
|
143
|
+
*/
|
|
144
|
+
export interface CouponEnteredInput {
|
|
145
|
+
/**
|
|
146
|
+
* Cart ID, if applicable
|
|
147
|
+
*/
|
|
148
|
+
cartId?: string;
|
|
149
|
+
/**
|
|
150
|
+
* Coupon ID
|
|
151
|
+
*/
|
|
152
|
+
couponId?: string;
|
|
153
|
+
/**
|
|
154
|
+
* Coupon name
|
|
155
|
+
*/
|
|
156
|
+
couponName?: string;
|
|
157
|
+
/**
|
|
158
|
+
* Order/transaction ID, if applicable
|
|
159
|
+
*/
|
|
160
|
+
orderId?: string;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* User removed a coupon from a cart or order
|
|
164
|
+
*/
|
|
165
|
+
export interface CouponRemovedInput {
|
|
166
|
+
/**
|
|
167
|
+
* Cart ID, if applicable
|
|
168
|
+
*/
|
|
169
|
+
cartId?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Coupon ID
|
|
172
|
+
*/
|
|
173
|
+
couponId?: string;
|
|
174
|
+
/**
|
|
175
|
+
* Coupon name
|
|
176
|
+
*/
|
|
177
|
+
couponName?: string;
|
|
178
|
+
/**
|
|
179
|
+
* Monetary discount applied through the coupon
|
|
180
|
+
*/
|
|
181
|
+
discount?: number;
|
|
182
|
+
/**
|
|
183
|
+
* Order/transaction ID, if applicable
|
|
184
|
+
*/
|
|
185
|
+
orderId?: string;
|
|
186
|
+
[property: string]: any;
|
|
187
|
+
}
|
|
188
|
+
export interface EmailCapturedInput {
|
|
189
|
+
email?: string;
|
|
190
|
+
placementComponent?: string;
|
|
191
|
+
placementPage?: string;
|
|
192
|
+
}
|
|
193
|
+
export interface ProductAddedInput<T extends ObjectTypes = ObjectTypes> {
|
|
194
|
+
/**
|
|
195
|
+
* The current cart, after the product is added.
|
|
196
|
+
*/
|
|
197
|
+
cart: T['Cart'];
|
|
198
|
+
product: ProductInput<T['Product']>;
|
|
199
|
+
}
|
|
200
|
+
export interface ProductClickedInput<T extends ObjectTypes = ObjectTypes> {
|
|
201
|
+
/**
|
|
202
|
+
* The current cart.
|
|
203
|
+
*/
|
|
204
|
+
cart: T['Cart'];
|
|
205
|
+
listId?: AnyId;
|
|
206
|
+
listName?: string;
|
|
207
|
+
product: ProductInput<T['Product']>;
|
|
208
|
+
}
|
|
209
|
+
export interface VariantClickedInput<T extends ObjectTypes = ObjectTypes> {
|
|
210
|
+
/**
|
|
211
|
+
* The current cart.
|
|
212
|
+
*/
|
|
213
|
+
cart: T['Cart'];
|
|
214
|
+
coupon?: string;
|
|
215
|
+
lineItemId?: string;
|
|
216
|
+
product: ProductInput<T['Product']>;
|
|
217
|
+
couponId?: string;
|
|
218
|
+
}
|
|
219
|
+
export interface ProductListFilteredInput {
|
|
220
|
+
category?: string;
|
|
221
|
+
listId?: string;
|
|
222
|
+
listName?: string;
|
|
223
|
+
filters?: Filter[];
|
|
224
|
+
sorts?: Sort[];
|
|
225
|
+
}
|
|
226
|
+
export interface ProductListViewedInput<T extends ObjectTypes = ObjectTypes> {
|
|
227
|
+
category?: string;
|
|
228
|
+
listId?: string;
|
|
229
|
+
listName?: string;
|
|
230
|
+
products: ProductInput<T['Product']>[];
|
|
231
|
+
}
|
|
232
|
+
export interface ProductRemovedInput<T extends ObjectTypes = ObjectTypes> {
|
|
233
|
+
/**
|
|
234
|
+
* The current cart.
|
|
235
|
+
*/
|
|
236
|
+
cart: T['Cart'];
|
|
237
|
+
/**
|
|
238
|
+
* The line item before it was removed.
|
|
239
|
+
*/
|
|
240
|
+
lineItem: T['LineItem'];
|
|
241
|
+
}
|
|
242
|
+
export interface ProductViewedInput<T extends ObjectTypes = ObjectTypes> {
|
|
243
|
+
/**
|
|
244
|
+
* The current cart.
|
|
245
|
+
*/
|
|
246
|
+
cart: T['Cart'];
|
|
247
|
+
/**
|
|
248
|
+
* The product being viewed.
|
|
249
|
+
*/
|
|
250
|
+
product: ProductInput<T['Product']>;
|
|
251
|
+
}
|
|
252
|
+
export interface ProductsSearchedInput {
|
|
253
|
+
currency?: string;
|
|
254
|
+
price?: number;
|
|
255
|
+
productId?: AnyId;
|
|
256
|
+
quantity?: number;
|
|
257
|
+
query?: string;
|
|
258
|
+
}
|
|
259
|
+
export interface SignedInInput {
|
|
260
|
+
/**
|
|
261
|
+
* The email of the user
|
|
262
|
+
*/
|
|
263
|
+
email?: string;
|
|
264
|
+
/**
|
|
265
|
+
* The method used to login
|
|
266
|
+
*/
|
|
267
|
+
method?: string;
|
|
268
|
+
}
|
|
269
|
+
export interface SignedOutInput {
|
|
270
|
+
/**
|
|
271
|
+
* The email of the user
|
|
272
|
+
*/
|
|
273
|
+
email?: string;
|
|
274
|
+
}
|
|
275
|
+
export interface SignedUpInput {
|
|
276
|
+
/**
|
|
277
|
+
* The email of the user
|
|
278
|
+
*/
|
|
279
|
+
email?: string;
|
|
280
|
+
/**
|
|
281
|
+
* The method used to login
|
|
282
|
+
*/
|
|
283
|
+
method?: string;
|
|
284
|
+
}
|
|
285
|
+
export interface LoginStartedInput {
|
|
286
|
+
/**
|
|
287
|
+
* The email of the user
|
|
288
|
+
*/
|
|
289
|
+
email?: string;
|
|
290
|
+
}
|
|
291
|
+
export interface SubscriptionCancelledInput<T extends ObjectTypes = ObjectTypes> {
|
|
292
|
+
/**
|
|
293
|
+
* Next date when this subscription will be actionable (renewed, expired, etc.)
|
|
294
|
+
*/
|
|
295
|
+
actionableDate?: string;
|
|
296
|
+
/**
|
|
297
|
+
* Shipping address for the subscription
|
|
298
|
+
*/
|
|
299
|
+
address?: SubscriptionCancelledAddress;
|
|
300
|
+
/**
|
|
301
|
+
* Brand associated with the subscription
|
|
302
|
+
*/
|
|
303
|
+
brand?: string;
|
|
304
|
+
/**
|
|
305
|
+
* Currency code of the transaction (for example, "USD")
|
|
306
|
+
*/
|
|
307
|
+
currency?: string;
|
|
308
|
+
/**
|
|
309
|
+
* Email address associated with the subscription
|
|
310
|
+
*/
|
|
311
|
+
email?: string;
|
|
312
|
+
/**
|
|
313
|
+
* Subscription will stop auto-renewing after this date
|
|
314
|
+
*/
|
|
315
|
+
endDate?: string;
|
|
316
|
+
/**
|
|
317
|
+
* Interval number at which the subscription renews
|
|
318
|
+
*/
|
|
319
|
+
intervalLength?: number;
|
|
320
|
+
/**
|
|
321
|
+
* Interval unit at which the subscription renews (for example, "month")
|
|
322
|
+
*/
|
|
323
|
+
intervalUnits?: string;
|
|
324
|
+
/**
|
|
325
|
+
* Products in the subscription
|
|
326
|
+
*/
|
|
327
|
+
products?: ProductInput<T['Product']>[];
|
|
328
|
+
/**
|
|
329
|
+
* The state of the subscription (for example, "active")
|
|
330
|
+
*/
|
|
331
|
+
state?: string;
|
|
332
|
+
/**
|
|
333
|
+
* ID of the subscription
|
|
334
|
+
*/
|
|
335
|
+
subscriptionId?: string;
|
|
336
|
+
}
|
|
337
|
+
export interface NavigationClickedInput {
|
|
338
|
+
/**
|
|
339
|
+
* Name of menu or category where navigation link was clicked (for example, "Support")
|
|
340
|
+
*/
|
|
341
|
+
category?: string;
|
|
342
|
+
/**
|
|
343
|
+
* Navigation label clicked (for example, "Contact")
|
|
344
|
+
*/
|
|
345
|
+
label?: string;
|
|
346
|
+
/**
|
|
347
|
+
* Navigation HTML component within the UX (for example, "footer")
|
|
348
|
+
*/
|
|
349
|
+
navigationPlacement?: string;
|
|
350
|
+
/**
|
|
351
|
+
* Navigation label clicked (for example, "Contact")
|
|
352
|
+
*/
|
|
353
|
+
navigationTitle?: string;
|
|
354
|
+
/**
|
|
355
|
+
* URL of navigation link destination
|
|
356
|
+
*/
|
|
357
|
+
navigationUrl?: string;
|
|
358
|
+
}
|
|
359
|
+
export interface PaymentInfoEnteredInput<T extends ObjectTypes = ObjectTypes> {
|
|
360
|
+
/**
|
|
361
|
+
* Checkout transaction ID
|
|
362
|
+
*/
|
|
363
|
+
checkoutId?: string;
|
|
364
|
+
/**
|
|
365
|
+
* Transaction coupon redeemed with the transaction
|
|
366
|
+
*/
|
|
367
|
+
coupon?: string;
|
|
368
|
+
/**
|
|
369
|
+
* Currency code of the transaction (for example, "USD")
|
|
370
|
+
*/
|
|
371
|
+
currency?: string;
|
|
372
|
+
/**
|
|
373
|
+
* Order ID
|
|
374
|
+
*/
|
|
375
|
+
orderId?: string;
|
|
376
|
+
/**
|
|
377
|
+
* String representing the payment method chosen
|
|
378
|
+
*/
|
|
379
|
+
paymentMethod?: string;
|
|
380
|
+
/**
|
|
381
|
+
* Products in the order
|
|
382
|
+
*/
|
|
383
|
+
products: ProductInput<T['Product']>[];
|
|
384
|
+
/**
|
|
385
|
+
* String representing the shipping the method chosen
|
|
386
|
+
*/
|
|
387
|
+
shippingMethod?: string;
|
|
388
|
+
/**
|
|
389
|
+
* Number representing a step in the checkout process
|
|
390
|
+
*/
|
|
391
|
+
step: number;
|
|
392
|
+
/**
|
|
393
|
+
* Revenue ($) with discounts and coupons added in
|
|
394
|
+
*/
|
|
395
|
+
value?: number;
|
|
396
|
+
}
|