@chordcommerce/analytics 1.6.0 → 1.8.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 +30 -0
- package/dist/client/index.d.ts +19 -12
- package/dist/client/index.js +171 -50
- package/dist/types/client.d.ts +9 -31
- package/dist/types/formatters.d.ts +114 -0
- package/dist/types/formatters.js +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/input.d.ts +201 -28
- package/dist/validators/objects.d.ts +30 -27
- package/dist/validators/objects.js +12 -9
- package/dist/validators/tracking-plan-map.d.ts +226 -9
- package/dist/validators/tracking-plan.d.ts +361 -28
- package/dist/validators/tracking-plan.js +61 -12
- package/package.json +1 -1
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { CartViewed, CheckoutStarted, CheckoutStepCompleted, CheckoutStepViewed, ProductAdded, ProductClicked, VariantClicked, ProductViewed, ProductListViewed, CouponApplied, CouponDenied, CouponEntered, CouponRemoved, EmailCaptured, ProductListFiltered, ProductRemoved, ProductsSearched, SignedIn, SignedOut, SignedUp, LoginStarted, SubscriptionCancelled, NavigationClicked, PaymentInfoEntered } from './typewriter.js';
|
|
2
|
+
import type { Cart, Checkout, LineItem, Product } from './objects.js';
|
|
3
|
+
import type { CartInput, CheckoutInput, CheckoutStepCompletedInput, CheckoutStepViewedInput, LineItemInput, ProductInput, CartViewedInput, CheckoutStartedInput, ProductAddedInput, ProductClickedInput, VariantClickedInput, ProductViewedInput, ProductListViewedInput, ProductListFilteredInput, ProductRemovedInput, CouponAppliedInput, CouponDeniedInput, CouponEnteredInput, CouponRemovedInput, EmailCapturedInput, ProductsSearchedInput, SignedInInput, SignedOutInput, SignedUpInput, LoginStartedInput, SubscriptionCancelledInput, NavigationClickedInput, PaymentInfoEnteredInput } from './input.js';
|
|
4
|
+
import type { ObjectTypes } from './client.js';
|
|
5
|
+
export type CartFormatter<T = ObjectTypes['Cart']> = (props: CartInput<T>) => Cart;
|
|
6
|
+
export type CheckoutFormatter<T = ObjectTypes['Checkout']> = (props: CheckoutInput<T>) => Checkout;
|
|
7
|
+
export type LineItemFormatter<T = ObjectTypes['LineItem']> = (props: LineItemInput<T>) => LineItem;
|
|
8
|
+
export type ProductFormatter<T = ObjectTypes['Product']> = (props: ProductInput<T>) => Product;
|
|
9
|
+
export interface CartViewedFormatter<T extends ObjectTypes = ObjectTypes> {
|
|
10
|
+
(props: CartViewedInput<T>, event: CartViewed): CartViewed;
|
|
11
|
+
}
|
|
12
|
+
export interface CheckoutStartedFormatter<T extends ObjectTypes = ObjectTypes> {
|
|
13
|
+
(props: CheckoutStartedInput<T>, event: CheckoutStarted): CheckoutStarted;
|
|
14
|
+
}
|
|
15
|
+
export interface CheckoutStepCompletedFormatter {
|
|
16
|
+
(props: CheckoutStepCompletedInput, event: CheckoutStepCompleted): CheckoutStepCompleted;
|
|
17
|
+
}
|
|
18
|
+
export interface CheckoutStepViewedFormatter {
|
|
19
|
+
(props: CheckoutStepViewedInput, event: CheckoutStepViewed): CheckoutStepViewed;
|
|
20
|
+
}
|
|
21
|
+
export interface CouponAppliedFormatter {
|
|
22
|
+
(props: CouponAppliedInput, event: CouponApplied): CouponApplied;
|
|
23
|
+
}
|
|
24
|
+
export interface CouponDeniedFormatter {
|
|
25
|
+
(props: CouponDeniedInput, event: CouponDenied): CouponDenied;
|
|
26
|
+
}
|
|
27
|
+
export interface CouponEnteredFormatter {
|
|
28
|
+
(props: CouponEnteredInput, event: CouponEntered): CouponEntered;
|
|
29
|
+
}
|
|
30
|
+
export interface CouponRemovedFormatter {
|
|
31
|
+
(props: CouponRemovedInput, event: CouponRemoved): CouponRemoved;
|
|
32
|
+
}
|
|
33
|
+
export interface EmailCapturedFormatter {
|
|
34
|
+
(props: EmailCapturedInput, event: EmailCaptured): EmailCaptured;
|
|
35
|
+
}
|
|
36
|
+
export interface ProductAddedFormatter<T extends ObjectTypes = ObjectTypes> {
|
|
37
|
+
(props: ProductAddedInput<T>, event: ProductAdded): ProductAdded;
|
|
38
|
+
}
|
|
39
|
+
export interface ProductClickedFormatter<T extends ObjectTypes = ObjectTypes> {
|
|
40
|
+
(props: ProductClickedInput<T>, event: ProductClicked): ProductClicked;
|
|
41
|
+
}
|
|
42
|
+
export interface VariantClickedFormatter<T extends ObjectTypes = ObjectTypes> {
|
|
43
|
+
(props: VariantClickedInput<T>, event: VariantClicked): VariantClicked;
|
|
44
|
+
}
|
|
45
|
+
export interface ProductListFilteredFormatter {
|
|
46
|
+
(props: ProductListFilteredInput, event: ProductListFiltered): ProductListFiltered;
|
|
47
|
+
}
|
|
48
|
+
export interface ProductListViewedFormatter<T extends ObjectTypes = ObjectTypes> {
|
|
49
|
+
(props: ProductListViewedInput<T>, event: ProductListViewed): ProductListViewed;
|
|
50
|
+
}
|
|
51
|
+
export interface ProductRemovedFormatter<T extends ObjectTypes = ObjectTypes> {
|
|
52
|
+
(props: ProductRemovedInput<T>, event: ProductRemoved): ProductRemoved;
|
|
53
|
+
}
|
|
54
|
+
export interface ProductViewedFormatter<T extends ObjectTypes = ObjectTypes> {
|
|
55
|
+
(props: ProductViewedInput<T>, event: ProductViewed): ProductViewed;
|
|
56
|
+
}
|
|
57
|
+
export interface ProductsSearchedFormatter {
|
|
58
|
+
(props: ProductsSearchedInput, event: ProductsSearched): ProductsSearched;
|
|
59
|
+
}
|
|
60
|
+
export interface SignedInFormatter {
|
|
61
|
+
(props: SignedInInput, event: SignedIn): SignedIn;
|
|
62
|
+
}
|
|
63
|
+
export interface SignedOutFormatter {
|
|
64
|
+
(props: SignedOutInput, event: SignedOut): SignedOut;
|
|
65
|
+
}
|
|
66
|
+
export interface SignedUpFormatter {
|
|
67
|
+
(props: SignedUpInput, event: SignedUp): SignedUp;
|
|
68
|
+
}
|
|
69
|
+
export interface LoginStartedFormatter {
|
|
70
|
+
(props: LoginStartedInput, event: LoginStarted): LoginStarted;
|
|
71
|
+
}
|
|
72
|
+
export interface SubscriptionCancelledFormatter {
|
|
73
|
+
(props: SubscriptionCancelledInput, event: SubscriptionCancelled): SubscriptionCancelled;
|
|
74
|
+
}
|
|
75
|
+
export interface NavigationClickedFormatter {
|
|
76
|
+
(props: NavigationClickedInput, event: NavigationClicked): NavigationClicked;
|
|
77
|
+
}
|
|
78
|
+
export interface PaymentInfoEnteredFormatter {
|
|
79
|
+
(props: PaymentInfoEnteredInput, event: PaymentInfoEntered): PaymentInfoEntered;
|
|
80
|
+
}
|
|
81
|
+
export interface ChordAnalyticsFormatters<T extends ObjectTypes = ObjectTypes> {
|
|
82
|
+
events?: {
|
|
83
|
+
cartViewed?: CartViewedFormatter<T>;
|
|
84
|
+
checkoutStarted?: CheckoutStartedFormatter<T>;
|
|
85
|
+
checkoutStepCompleted?: CheckoutStepCompletedFormatter;
|
|
86
|
+
checkoutStepViewed?: CheckoutStepViewedFormatter;
|
|
87
|
+
couponApplied?: CouponAppliedFormatter;
|
|
88
|
+
couponDenied?: CouponDeniedFormatter;
|
|
89
|
+
couponEntered?: CouponEnteredFormatter;
|
|
90
|
+
couponRemoved?: CouponRemovedFormatter;
|
|
91
|
+
emailCaptured?: EmailCapturedFormatter;
|
|
92
|
+
productAdded?: ProductAddedFormatter<T>;
|
|
93
|
+
productClicked?: ProductClickedFormatter<T>;
|
|
94
|
+
variantClicked?: VariantClickedFormatter<T>;
|
|
95
|
+
productListFiltered?: ProductListFilteredFormatter;
|
|
96
|
+
productListViewed?: ProductListViewedFormatter<T>;
|
|
97
|
+
productRemoved?: ProductRemovedFormatter<T>;
|
|
98
|
+
productViewed?: ProductViewedFormatter<T>;
|
|
99
|
+
productsSearched?: ProductsSearchedFormatter;
|
|
100
|
+
signedIn?: SignedInFormatter;
|
|
101
|
+
signedOut?: SignedOutFormatter;
|
|
102
|
+
signedUp?: SignedUpFormatter;
|
|
103
|
+
loginStarted?: LoginStartedFormatter;
|
|
104
|
+
subscriptionCancelled?: SubscriptionCancelledFormatter;
|
|
105
|
+
navigationClicked?: NavigationClickedFormatter;
|
|
106
|
+
paymentInfoEntered?: PaymentInfoEnteredFormatter;
|
|
107
|
+
};
|
|
108
|
+
objects: {
|
|
109
|
+
cart: CartFormatter<T['Cart']>;
|
|
110
|
+
checkout: CheckoutFormatter<T['Checkout']>;
|
|
111
|
+
lineItem: LineItemFormatter<T['LineItem']>;
|
|
112
|
+
product: ProductFormatter<T['Product']>;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
package/dist/types/index.js
CHANGED
package/dist/types/input.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Filter, Sort } from './typewriter.js';
|
|
3
|
-
export interface ProductInput {
|
|
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
4
|
/**
|
|
5
5
|
* The position in a list of the product that was added, if relevant.
|
|
6
6
|
*/
|
|
@@ -8,7 +8,7 @@ export interface ProductInput {
|
|
|
8
8
|
/**
|
|
9
9
|
* Product and variant details, like product name and variant SKUs.
|
|
10
10
|
*/
|
|
11
|
-
product:
|
|
11
|
+
product: ProductType;
|
|
12
12
|
/**
|
|
13
13
|
* The quantity of the product involved in the tracking event. Sometimes quantity might
|
|
14
14
|
* not be relevant to an event, and can be either omitted or defaulted to `1`.
|
|
@@ -22,35 +22,71 @@ export interface ProductInput {
|
|
|
22
22
|
*/
|
|
23
23
|
variantId?: AnyId;
|
|
24
24
|
}
|
|
25
|
-
export interface CartInput {
|
|
25
|
+
export interface CartInput<CartType extends ObjectTypes['Cart'] = ObjectTypes['Cart']> {
|
|
26
26
|
/**
|
|
27
27
|
* The current cart.
|
|
28
28
|
*/
|
|
29
|
-
cart:
|
|
29
|
+
cart: CartType;
|
|
30
30
|
}
|
|
31
|
-
export interface CheckoutInput {
|
|
31
|
+
export interface CheckoutInput<CheckoutType extends ObjectTypes['Checkout'] = ObjectTypes['Checkout']> {
|
|
32
32
|
/**
|
|
33
33
|
* The current checkout.
|
|
34
34
|
*/
|
|
35
|
-
checkout:
|
|
35
|
+
checkout: CheckoutType;
|
|
36
36
|
}
|
|
37
|
-
export interface LineItemInput {
|
|
37
|
+
export interface LineItemInput<LineItemType extends ObjectTypes['LineItem'] = ObjectTypes['LineItem']> {
|
|
38
38
|
/**
|
|
39
39
|
* The line item before it was removed.
|
|
40
40
|
*/
|
|
41
|
-
lineItem:
|
|
41
|
+
lineItem: LineItemType;
|
|
42
42
|
}
|
|
43
|
-
export interface CartViewedInput {
|
|
43
|
+
export interface CartViewedInput<T extends ObjectTypes = ObjectTypes> {
|
|
44
44
|
/**
|
|
45
45
|
* The current cart.
|
|
46
46
|
*/
|
|
47
|
-
cart:
|
|
47
|
+
cart: T['Cart'];
|
|
48
48
|
}
|
|
49
|
-
export interface CheckoutStartedInput {
|
|
49
|
+
export interface CheckoutStartedInput<T extends ObjectTypes = ObjectTypes> {
|
|
50
50
|
/**
|
|
51
51
|
* The current checkout.
|
|
52
52
|
*/
|
|
53
|
-
checkout:
|
|
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;
|
|
54
90
|
}
|
|
55
91
|
/**
|
|
56
92
|
* Coupon was applied on a user's shopping cart or order
|
|
@@ -154,21 +190,31 @@ export interface EmailCapturedInput {
|
|
|
154
190
|
placementComponent?: string;
|
|
155
191
|
placementPage?: string;
|
|
156
192
|
}
|
|
157
|
-
export interface ProductAddedInput {
|
|
193
|
+
export interface ProductAddedInput<T extends ObjectTypes = ObjectTypes> {
|
|
158
194
|
/**
|
|
159
195
|
* The current cart, after the product is added.
|
|
160
196
|
*/
|
|
161
|
-
cart:
|
|
162
|
-
product: ProductInput
|
|
197
|
+
cart: T['Cart'];
|
|
198
|
+
product: ProductInput<T['Product']>;
|
|
163
199
|
}
|
|
164
|
-
export interface ProductClickedInput {
|
|
200
|
+
export interface ProductClickedInput<T extends ObjectTypes = ObjectTypes> {
|
|
165
201
|
/**
|
|
166
202
|
* The current cart.
|
|
167
203
|
*/
|
|
168
|
-
cart:
|
|
204
|
+
cart: T['Cart'];
|
|
169
205
|
listId?: AnyId;
|
|
170
206
|
listName?: string;
|
|
171
|
-
product: ProductInput
|
|
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;
|
|
172
218
|
}
|
|
173
219
|
export interface ProductListFilteredInput {
|
|
174
220
|
category?: string;
|
|
@@ -177,31 +223,31 @@ export interface ProductListFilteredInput {
|
|
|
177
223
|
filters?: Filter[];
|
|
178
224
|
sorts?: Sort[];
|
|
179
225
|
}
|
|
180
|
-
export interface ProductListViewedInput {
|
|
226
|
+
export interface ProductListViewedInput<T extends ObjectTypes = ObjectTypes> {
|
|
181
227
|
category?: string;
|
|
182
228
|
listId?: string;
|
|
183
229
|
listName?: string;
|
|
184
|
-
products: ProductInput[];
|
|
230
|
+
products: ProductInput<T['Product']>[];
|
|
185
231
|
}
|
|
186
|
-
export interface ProductRemovedInput {
|
|
232
|
+
export interface ProductRemovedInput<T extends ObjectTypes = ObjectTypes> {
|
|
187
233
|
/**
|
|
188
234
|
* The current cart.
|
|
189
235
|
*/
|
|
190
|
-
cart:
|
|
236
|
+
cart: T['Cart'];
|
|
191
237
|
/**
|
|
192
238
|
* The line item before it was removed.
|
|
193
239
|
*/
|
|
194
|
-
lineItem:
|
|
240
|
+
lineItem: T['LineItem'];
|
|
195
241
|
}
|
|
196
|
-
export interface ProductViewedInput {
|
|
242
|
+
export interface ProductViewedInput<T extends ObjectTypes = ObjectTypes> {
|
|
197
243
|
/**
|
|
198
244
|
* The current cart.
|
|
199
245
|
*/
|
|
200
|
-
cart:
|
|
246
|
+
cart: T['Cart'];
|
|
201
247
|
/**
|
|
202
248
|
* The product being viewed.
|
|
203
249
|
*/
|
|
204
|
-
product: ProductInput
|
|
250
|
+
product: ProductInput<T['Product']>;
|
|
205
251
|
}
|
|
206
252
|
export interface ProductsSearchedInput {
|
|
207
253
|
currency?: string;
|
|
@@ -211,13 +257,140 @@ export interface ProductsSearchedInput {
|
|
|
211
257
|
query?: string;
|
|
212
258
|
}
|
|
213
259
|
export interface SignedInInput {
|
|
260
|
+
/**
|
|
261
|
+
* The email of the user
|
|
262
|
+
*/
|
|
214
263
|
email?: string;
|
|
264
|
+
/**
|
|
265
|
+
* The method used to login
|
|
266
|
+
*/
|
|
215
267
|
method?: string;
|
|
216
268
|
}
|
|
217
269
|
export interface SignedOutInput {
|
|
270
|
+
/**
|
|
271
|
+
* The email of the user
|
|
272
|
+
*/
|
|
218
273
|
email?: string;
|
|
219
274
|
}
|
|
220
275
|
export interface SignedUpInput {
|
|
276
|
+
/**
|
|
277
|
+
* The email of the user
|
|
278
|
+
*/
|
|
221
279
|
email?: string;
|
|
280
|
+
/**
|
|
281
|
+
* The method used to login
|
|
282
|
+
*/
|
|
222
283
|
method?: string;
|
|
223
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
|
+
}
|
|
@@ -1,113 +1,113 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const identifyTraitsSchema: z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodObject<{
|
|
3
|
-
address: z.ZodOptional<z.ZodObject<{
|
|
3
|
+
address: z.ZodOptional<z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodObject<{
|
|
4
4
|
city: z.ZodOptional<z.ZodString>;
|
|
5
5
|
country: z.ZodOptional<z.ZodString>;
|
|
6
|
-
|
|
6
|
+
postalCode: z.ZodOptional<z.ZodString>;
|
|
7
7
|
state: z.ZodOptional<z.ZodString>;
|
|
8
8
|
street: z.ZodOptional<z.ZodString>;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
10
|
city?: string;
|
|
11
11
|
country?: string;
|
|
12
|
-
|
|
12
|
+
postalCode?: string;
|
|
13
13
|
state?: string;
|
|
14
14
|
street?: string;
|
|
15
15
|
}, {
|
|
16
16
|
city?: string;
|
|
17
17
|
country?: string;
|
|
18
|
-
|
|
18
|
+
postalCode?: string;
|
|
19
19
|
state?: string;
|
|
20
20
|
street?: string;
|
|
21
|
-
}
|
|
21
|
+
}>>>;
|
|
22
22
|
age: z.ZodOptional<z.ZodNumber>;
|
|
23
23
|
avatar: z.ZodOptional<z.ZodString>;
|
|
24
24
|
birthday: z.ZodOptional<z.ZodString>;
|
|
25
|
-
company: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
company: z.ZodOptional<z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodObject<{
|
|
26
26
|
name: z.ZodOptional<z.ZodString>;
|
|
27
27
|
id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
28
28
|
industry: z.ZodOptional<z.ZodString>;
|
|
29
|
-
|
|
29
|
+
employeeCount: z.ZodOptional<z.ZodNumber>;
|
|
30
30
|
plan: z.ZodOptional<z.ZodString>;
|
|
31
31
|
}, "strip", z.ZodTypeAny, {
|
|
32
32
|
name?: string;
|
|
33
33
|
id?: string | number;
|
|
34
34
|
industry?: string;
|
|
35
|
-
|
|
35
|
+
employeeCount?: number;
|
|
36
36
|
plan?: string;
|
|
37
37
|
}, {
|
|
38
38
|
name?: string;
|
|
39
39
|
id?: string | number;
|
|
40
40
|
industry?: string;
|
|
41
|
-
|
|
41
|
+
employeeCount?: number;
|
|
42
42
|
plan?: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
43
|
+
}>>>;
|
|
44
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
45
45
|
description: z.ZodOptional<z.ZodString>;
|
|
46
46
|
email: z.ZodOptional<z.ZodString>;
|
|
47
|
-
|
|
47
|
+
firstName: z.ZodOptional<z.ZodString>;
|
|
48
48
|
gender: z.ZodOptional<z.ZodString>;
|
|
49
49
|
id: z.ZodOptional<z.ZodString>;
|
|
50
|
-
|
|
50
|
+
lastName: z.ZodOptional<z.ZodString>;
|
|
51
51
|
name: z.ZodOptional<z.ZodString>;
|
|
52
52
|
phone: z.ZodOptional<z.ZodString>;
|
|
53
53
|
title: z.ZodOptional<z.ZodString>;
|
|
54
54
|
username: z.ZodOptional<z.ZodString>;
|
|
55
55
|
website: z.ZodOptional<z.ZodString>;
|
|
56
56
|
}, "strip", z.ZodTypeAny, {
|
|
57
|
-
address?: {
|
|
57
|
+
address?: Record<string, any> & {
|
|
58
58
|
city?: string;
|
|
59
59
|
country?: string;
|
|
60
|
-
|
|
60
|
+
postalCode?: string;
|
|
61
61
|
state?: string;
|
|
62
62
|
street?: string;
|
|
63
63
|
};
|
|
64
64
|
age?: number;
|
|
65
65
|
avatar?: string;
|
|
66
66
|
birthday?: string;
|
|
67
|
-
company?: {
|
|
67
|
+
company?: Record<string, any> & {
|
|
68
68
|
name?: string;
|
|
69
69
|
id?: string | number;
|
|
70
70
|
industry?: string;
|
|
71
|
-
|
|
71
|
+
employeeCount?: number;
|
|
72
72
|
plan?: string;
|
|
73
73
|
};
|
|
74
|
-
|
|
74
|
+
createdAt?: string;
|
|
75
75
|
description?: string;
|
|
76
76
|
email?: string;
|
|
77
|
-
|
|
77
|
+
firstName?: string;
|
|
78
78
|
gender?: string;
|
|
79
79
|
id?: string;
|
|
80
|
-
|
|
80
|
+
lastName?: string;
|
|
81
81
|
name?: string;
|
|
82
82
|
phone?: string;
|
|
83
83
|
title?: string;
|
|
84
84
|
username?: string;
|
|
85
85
|
website?: string;
|
|
86
86
|
}, {
|
|
87
|
-
address?: {
|
|
87
|
+
address?: Record<string, any> & {
|
|
88
88
|
city?: string;
|
|
89
89
|
country?: string;
|
|
90
|
-
|
|
90
|
+
postalCode?: string;
|
|
91
91
|
state?: string;
|
|
92
92
|
street?: string;
|
|
93
93
|
};
|
|
94
94
|
age?: number;
|
|
95
95
|
avatar?: string;
|
|
96
96
|
birthday?: string;
|
|
97
|
-
company?: {
|
|
97
|
+
company?: Record<string, any> & {
|
|
98
98
|
name?: string;
|
|
99
99
|
id?: string | number;
|
|
100
100
|
industry?: string;
|
|
101
|
-
|
|
101
|
+
employeeCount?: number;
|
|
102
102
|
plan?: string;
|
|
103
103
|
};
|
|
104
|
-
|
|
104
|
+
createdAt?: string;
|
|
105
105
|
description?: string;
|
|
106
106
|
email?: string;
|
|
107
|
-
|
|
107
|
+
firstName?: string;
|
|
108
108
|
gender?: string;
|
|
109
109
|
id?: string;
|
|
110
|
-
|
|
110
|
+
lastName?: string;
|
|
111
111
|
name?: string;
|
|
112
112
|
phone?: string;
|
|
113
113
|
title?: string;
|
|
@@ -515,6 +515,7 @@ export declare const checkoutSchema: z.ZodObject<{
|
|
|
515
515
|
shipping: z.ZodOptional<z.ZodNumber>;
|
|
516
516
|
tax: z.ZodOptional<z.ZodNumber>;
|
|
517
517
|
value: z.ZodOptional<z.ZodNumber>;
|
|
518
|
+
step: z.ZodOptional<z.ZodNumber>;
|
|
518
519
|
}, "strip", z.ZodTypeAny, {
|
|
519
520
|
affiliation?: string;
|
|
520
521
|
checkout_type?: string;
|
|
@@ -547,6 +548,7 @@ export declare const checkoutSchema: z.ZodObject<{
|
|
|
547
548
|
shipping?: number;
|
|
548
549
|
tax?: number;
|
|
549
550
|
value?: number;
|
|
551
|
+
step?: number;
|
|
550
552
|
}, {
|
|
551
553
|
affiliation?: string;
|
|
552
554
|
checkout_type?: string;
|
|
@@ -579,6 +581,7 @@ export declare const checkoutSchema: z.ZodObject<{
|
|
|
579
581
|
shipping?: number;
|
|
580
582
|
tax?: number;
|
|
581
583
|
value?: number;
|
|
584
|
+
step?: number;
|
|
582
585
|
}>;
|
|
583
586
|
export declare const cartSchema: z.ZodObject<{
|
|
584
587
|
cart_id: z.ZodOptional<z.ZodString>;
|
|
@@ -2,33 +2,35 @@
|
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
export const identifyTraitsSchema = z.record(z.any()).and(z.object({
|
|
4
4
|
address: z
|
|
5
|
-
.
|
|
5
|
+
.record(z.any())
|
|
6
|
+
.and(z.object({
|
|
6
7
|
city: z.string().optional(),
|
|
7
8
|
country: z.string().optional(),
|
|
8
|
-
|
|
9
|
+
postalCode: z.string().optional(),
|
|
9
10
|
state: z.string().optional(),
|
|
10
11
|
street: z.string().optional(),
|
|
11
|
-
})
|
|
12
|
+
}))
|
|
12
13
|
.optional(),
|
|
13
14
|
age: z.number().optional(),
|
|
14
15
|
avatar: z.string().optional(),
|
|
15
16
|
birthday: z.string().optional(),
|
|
16
17
|
company: z
|
|
17
|
-
.
|
|
18
|
+
.record(z.any())
|
|
19
|
+
.and(z.object({
|
|
18
20
|
name: z.string().optional(),
|
|
19
21
|
id: z.union([z.string(), z.number()]).optional(),
|
|
20
22
|
industry: z.string().optional(),
|
|
21
|
-
|
|
23
|
+
employeeCount: z.number().optional(),
|
|
22
24
|
plan: z.string().optional(),
|
|
23
|
-
})
|
|
25
|
+
}))
|
|
24
26
|
.optional(),
|
|
25
|
-
|
|
27
|
+
createdAt: z.string().optional(),
|
|
26
28
|
description: z.string().optional(),
|
|
27
29
|
email: z.string().optional(),
|
|
28
|
-
|
|
30
|
+
firstName: z.string().optional(),
|
|
29
31
|
gender: z.string().optional(),
|
|
30
32
|
id: z.string().optional(),
|
|
31
|
-
|
|
33
|
+
lastName: z.string().optional(),
|
|
32
34
|
name: z.string().optional(),
|
|
33
35
|
phone: z.string().optional(),
|
|
34
36
|
title: z.string().optional(),
|
|
@@ -113,6 +115,7 @@ export const checkoutSchema = z.object({
|
|
|
113
115
|
shipping: z.number().optional(),
|
|
114
116
|
tax: z.number().optional(),
|
|
115
117
|
value: z.number().optional(),
|
|
118
|
+
step: z.number().optional(),
|
|
116
119
|
});
|
|
117
120
|
export const cartSchema = z.object({
|
|
118
121
|
cart_id: z.string().optional(),
|