@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
package/README.md
CHANGED
|
@@ -77,6 +77,36 @@ A formatter must be provided for each of the four core data types that are used
|
|
|
77
77
|
|
|
78
78
|
A formatter can be provided for each event. This formatter is used to transform the event properties of a specific event after Chord constructs the event, just before it's sent to the CDP. See [Chord’s documentation](https://docs.chord.co/analytics-getting-started#jquZe) for more details on event formatters.
|
|
79
79
|
|
|
80
|
+
## Using with Typescript
|
|
81
|
+
|
|
82
|
+
Optionally, you can instantiate `ChordAnalytics` with a custom type argument describing your data to improve type safety for formatters and SDK functions.
|
|
83
|
+
|
|
84
|
+
For instance, if you're working with objects like `cart`, `product`, etc., from a Shopify storefront API query, you might already have types like `StorefrontCart` defined for the response. Instantiate `ChordAnalytics` with a type argument:
|
|
85
|
+
|
|
86
|
+
```js
|
|
87
|
+
interface ObjectTypes {
|
|
88
|
+
Cart: StorefrontCart
|
|
89
|
+
Checkout: StorefrontCart
|
|
90
|
+
LineItem: StorefrontLineItem
|
|
91
|
+
Product: StorefrontProduct
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const chord = new ChordAnalytics<ObjectTypes>({ options })
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Now, when you use an SDK method like `chord.trackCartViewed({ cart })`, `cart` has the `StorefrontCart` type.
|
|
98
|
+
|
|
99
|
+
Formatter types also support an optional generic type parameter for the function argument:
|
|
100
|
+
|
|
101
|
+
```js
|
|
102
|
+
import type { CartFormatter } from '@chordcommerce/analytics'
|
|
103
|
+
|
|
104
|
+
export const cartFormatter: CartFormatter<StorefrontCart> = (props) => {
|
|
105
|
+
const { cart } = props // `cart` has type `StorefrontCart`
|
|
106
|
+
return { ... }
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
80
110
|
## API Reference
|
|
81
111
|
|
|
82
112
|
See [Chord’s documentation](https://docs.chord.co/analytics-getting-started) for a full API reference.
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AnyAnalytics, EventProperties, Options, ValidateResult, ChordAnalyticsOptions, AnyOptions, CartViewedInput, IdentifyTraits, CheckoutStartedInput, EmailCapturedInput, ProductListViewedInput, ProductListFilteredInput, ProductAddedInput, ProductClickedInput, ProductRemovedInput, ProductViewedInput, ProductsSearchedInput, CouponAppliedInput, CouponDeniedInput, CouponEnteredInput, CouponRemovedInput, SignedInInput, SignedOutInput, SignedUpInput } from '../types/index.js';
|
|
1
|
+
import type { AnyAnalytics, EventProperties, Options, ValidateResult, ChordAnalyticsOptions, AnyOptions, CartViewedInput, IdentifyTraits, CheckoutStartedInput, CheckoutStepCompletedInput, CheckoutStepViewedInput, EmailCapturedInput, ProductListViewedInput, ProductListFilteredInput, ProductAddedInput, ProductClickedInput, VariantClickedInput, ProductRemovedInput, ProductViewedInput, ProductsSearchedInput, CouponAppliedInput, CouponDeniedInput, CouponEnteredInput, CouponRemovedInput, SignedInInput, SignedOutInput, SignedUpInput, LoginStartedInput, ObjectTypes, SubscriptionCancelledInput, NavigationClickedInput, PaymentInfoEnteredInput } from '../types/index.js';
|
|
2
2
|
export interface ChordAnalyticsSnippet {
|
|
3
|
-
_loadOptions: ChordAnalyticsOptions
|
|
3
|
+
_loadOptions: ChordAnalyticsOptions<ObjectTypes>;
|
|
4
4
|
invoked: boolean;
|
|
5
5
|
methods: string[];
|
|
6
6
|
queue: any[];
|
|
@@ -8,7 +8,7 @@ export interface ChordAnalyticsSnippet {
|
|
|
8
8
|
load: () => void;
|
|
9
9
|
SNIPPET_VERSION: string;
|
|
10
10
|
}
|
|
11
|
-
export declare class ChordAnalytics {
|
|
11
|
+
export declare class ChordAnalytics<T extends ObjectTypes = ObjectTypes> {
|
|
12
12
|
/**
|
|
13
13
|
* Allows snippet.js to detect whether this library has been initialized yet.
|
|
14
14
|
*/
|
|
@@ -20,8 +20,8 @@ export declare class ChordAnalytics {
|
|
|
20
20
|
/**
|
|
21
21
|
* Options for ChordAnalytics.
|
|
22
22
|
*/
|
|
23
|
-
options: ChordAnalyticsOptions
|
|
24
|
-
constructor(options: ChordAnalyticsOptions);
|
|
23
|
+
options: ChordAnalyticsOptions<T>;
|
|
24
|
+
constructor(options: ChordAnalyticsOptions<T>);
|
|
25
25
|
cdp: () => AnyAnalytics;
|
|
26
26
|
logger: (message?: any, ...optionalParams: any[]) => void;
|
|
27
27
|
/**
|
|
@@ -64,21 +64,28 @@ export declare class ChordAnalytics {
|
|
|
64
64
|
(): void;
|
|
65
65
|
};
|
|
66
66
|
reset: () => void;
|
|
67
|
-
trackCartViewed: (props: CartViewedInput
|
|
68
|
-
trackCheckoutStarted: (props: CheckoutStartedInput
|
|
67
|
+
trackCartViewed: (props: CartViewedInput<T>, options?: AnyOptions) => Promise<void>;
|
|
68
|
+
trackCheckoutStarted: (props: CheckoutStartedInput<T>, options?: AnyOptions) => Promise<void>;
|
|
69
|
+
trackCheckoutStepCompleted: (props: CheckoutStepCompletedInput, options?: AnyOptions) => Promise<void>;
|
|
70
|
+
trackCheckoutStepViewed: (props: CheckoutStepViewedInput, options?: AnyOptions) => Promise<void>;
|
|
69
71
|
trackCouponApplied: (props: CouponAppliedInput, options?: AnyOptions) => Promise<void>;
|
|
70
72
|
trackCouponDenied: (props: CouponDeniedInput, options?: AnyOptions) => Promise<void>;
|
|
71
73
|
trackCouponEntered: (props: CouponEnteredInput, options?: AnyOptions) => Promise<void>;
|
|
72
74
|
trackCouponRemoved: (props: CouponRemovedInput, options?: AnyOptions) => Promise<void>;
|
|
73
75
|
trackEmailCaptured: (props: EmailCapturedInput, options?: AnyOptions) => Promise<void>;
|
|
74
|
-
trackProductAdded: (props: ProductAddedInput
|
|
75
|
-
trackProductClicked: (props: ProductClickedInput
|
|
76
|
+
trackProductAdded: (props: ProductAddedInput<T>, options?: AnyOptions) => Promise<void>;
|
|
77
|
+
trackProductClicked: (props: ProductClickedInput<T>, options?: AnyOptions) => Promise<void>;
|
|
78
|
+
trackVariantClicked: (props: VariantClickedInput<T>, options?: AnyOptions) => Promise<void>;
|
|
76
79
|
trackProductListFiltered: (props: ProductListFilteredInput, options?: AnyOptions) => Promise<void>;
|
|
77
|
-
trackProductListViewed: (props: ProductListViewedInput
|
|
78
|
-
trackProductRemoved: (props: ProductRemovedInput
|
|
79
|
-
trackProductViewed: (props: ProductViewedInput
|
|
80
|
+
trackProductListViewed: (props: ProductListViewedInput<T>, options?: AnyOptions) => Promise<void>;
|
|
81
|
+
trackProductRemoved: (props: ProductRemovedInput<T>, options?: AnyOptions) => Promise<void>;
|
|
82
|
+
trackProductViewed: (props: ProductViewedInput<T>, options?: AnyOptions) => Promise<void>;
|
|
80
83
|
trackProductsSearched: (props: ProductsSearchedInput, options?: AnyOptions) => Promise<void>;
|
|
81
84
|
trackSignedIn: (props: SignedInInput, options?: AnyOptions) => Promise<void>;
|
|
82
85
|
trackSignedOut: (props?: SignedOutInput, options?: AnyOptions) => Promise<void>;
|
|
83
86
|
trackSignedUp: (props?: SignedUpInput, options?: AnyOptions) => Promise<void>;
|
|
87
|
+
trackLoginStarted: (props: LoginStartedInput, options?: AnyOptions) => Promise<void>;
|
|
88
|
+
trackSubscriptionCancelled: (props: SubscriptionCancelledInput, options?: AnyOptions) => Promise<void>;
|
|
89
|
+
trackNavigationClicked: (props: NavigationClickedInput, options?: AnyOptions) => Promise<void>;
|
|
90
|
+
trackPaymentInfoEntered: (props: PaymentInfoEnteredInput, options?: AnyOptions) => Promise<void>;
|
|
84
91
|
}
|
package/dist/client/index.js
CHANGED
|
@@ -165,9 +165,39 @@ export class ChordAnalytics {
|
|
|
165
165
|
}
|
|
166
166
|
return this.track('Checkout Started', payload, options);
|
|
167
167
|
});
|
|
168
|
-
this.
|
|
168
|
+
this.trackCheckoutStepCompleted = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
169
169
|
var _t, _u, _v;
|
|
170
|
-
const formatter = (_v = (_u = (_t = this.options) === null || _t === void 0 ? void 0 : _t.formatters) === null || _u === void 0 ? void 0 : _u.events) === null || _v === void 0 ? void 0 : _v.
|
|
170
|
+
const formatter = (_v = (_u = (_t = this.options) === null || _t === void 0 ? void 0 : _t.formatters) === null || _u === void 0 ? void 0 : _u.events) === null || _v === void 0 ? void 0 : _v.checkoutStepCompleted;
|
|
171
|
+
const payload = {
|
|
172
|
+
checkout_id: props === null || props === void 0 ? void 0 : props.checkoutId,
|
|
173
|
+
payment_method: props === null || props === void 0 ? void 0 : props.paymentMethod,
|
|
174
|
+
shipping_method: props === null || props === void 0 ? void 0 : props.shippingMethod,
|
|
175
|
+
step: props === null || props === void 0 ? void 0 : props.step,
|
|
176
|
+
};
|
|
177
|
+
if (typeof formatter === 'function') {
|
|
178
|
+
const formattedPayload = formatter(props, payload);
|
|
179
|
+
return this.track('Checkout Step Completed', formattedPayload, options);
|
|
180
|
+
}
|
|
181
|
+
return this.track('Checkout Step Completed', payload, options);
|
|
182
|
+
});
|
|
183
|
+
this.trackCheckoutStepViewed = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
184
|
+
var _w, _x, _y;
|
|
185
|
+
const formatter = (_y = (_x = (_w = this.options) === null || _w === void 0 ? void 0 : _w.formatters) === null || _x === void 0 ? void 0 : _x.events) === null || _y === void 0 ? void 0 : _y.checkoutStepViewed;
|
|
186
|
+
const payload = {
|
|
187
|
+
checkout_id: props === null || props === void 0 ? void 0 : props.checkoutId,
|
|
188
|
+
payment_method: props === null || props === void 0 ? void 0 : props.paymentMethod,
|
|
189
|
+
shipping_method: props === null || props === void 0 ? void 0 : props.shippingMethod,
|
|
190
|
+
step: props === null || props === void 0 ? void 0 : props.step,
|
|
191
|
+
};
|
|
192
|
+
if (typeof formatter === 'function') {
|
|
193
|
+
const formattedPayload = formatter(props, payload);
|
|
194
|
+
return this.track('Checkout Step Viewed', formattedPayload, options);
|
|
195
|
+
}
|
|
196
|
+
return this.track('Checkout Step Viewed', payload, options);
|
|
197
|
+
});
|
|
198
|
+
this.trackCouponApplied = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
199
|
+
var _z, _0, _1;
|
|
200
|
+
const formatter = (_1 = (_0 = (_z = this.options) === null || _z === void 0 ? void 0 : _z.formatters) === null || _0 === void 0 ? void 0 : _0.events) === null || _1 === void 0 ? void 0 : _1.couponApplied;
|
|
171
201
|
const payload = {
|
|
172
202
|
cart_id: props === null || props === void 0 ? void 0 : props.cartId,
|
|
173
203
|
coupon_id: props === null || props === void 0 ? void 0 : props.couponId,
|
|
@@ -182,8 +212,8 @@ export class ChordAnalytics {
|
|
|
182
212
|
return this.track('Coupon Applied', payload, options);
|
|
183
213
|
});
|
|
184
214
|
this.trackCouponDenied = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
185
|
-
var
|
|
186
|
-
const formatter = (
|
|
215
|
+
var _2, _3, _4;
|
|
216
|
+
const formatter = (_4 = (_3 = (_2 = this.options) === null || _2 === void 0 ? void 0 : _2.formatters) === null || _3 === void 0 ? void 0 : _3.events) === null || _4 === void 0 ? void 0 : _4.couponDenied;
|
|
187
217
|
const payload = {
|
|
188
218
|
cart_id: props === null || props === void 0 ? void 0 : props.cartId,
|
|
189
219
|
coupon_id: props === null || props === void 0 ? void 0 : props.couponId,
|
|
@@ -198,8 +228,8 @@ export class ChordAnalytics {
|
|
|
198
228
|
return this.track('Coupon Denied', payload, options);
|
|
199
229
|
});
|
|
200
230
|
this.trackCouponEntered = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
201
|
-
var
|
|
202
|
-
const formatter = (
|
|
231
|
+
var _5, _6, _7;
|
|
232
|
+
const formatter = (_7 = (_6 = (_5 = this.options) === null || _5 === void 0 ? void 0 : _5.formatters) === null || _6 === void 0 ? void 0 : _6.events) === null || _7 === void 0 ? void 0 : _7.couponEntered;
|
|
203
233
|
const payload = {
|
|
204
234
|
cart_id: props === null || props === void 0 ? void 0 : props.cartId,
|
|
205
235
|
coupon_id: props === null || props === void 0 ? void 0 : props.couponId,
|
|
@@ -213,8 +243,8 @@ export class ChordAnalytics {
|
|
|
213
243
|
return this.track('Coupon Entered', payload, options);
|
|
214
244
|
});
|
|
215
245
|
this.trackCouponRemoved = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
216
|
-
var
|
|
217
|
-
const formatter = (
|
|
246
|
+
var _8, _9, _10;
|
|
247
|
+
const formatter = (_10 = (_9 = (_8 = this.options) === null || _8 === void 0 ? void 0 : _8.formatters) === null || _9 === void 0 ? void 0 : _9.events) === null || _10 === void 0 ? void 0 : _10.couponRemoved;
|
|
218
248
|
const payload = {
|
|
219
249
|
cart_id: props === null || props === void 0 ? void 0 : props.cartId,
|
|
220
250
|
coupon_id: props === null || props === void 0 ? void 0 : props.couponId,
|
|
@@ -229,8 +259,8 @@ export class ChordAnalytics {
|
|
|
229
259
|
return this.track('Coupon Removed', payload, options);
|
|
230
260
|
});
|
|
231
261
|
this.trackEmailCaptured = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
232
|
-
var
|
|
233
|
-
const formatter = (
|
|
262
|
+
var _11, _12, _13;
|
|
263
|
+
const formatter = (_13 = (_12 = (_11 = this.options) === null || _11 === void 0 ? void 0 : _11.formatters) === null || _12 === void 0 ? void 0 : _12.events) === null || _13 === void 0 ? void 0 : _13.emailCaptured;
|
|
234
264
|
const payload = {
|
|
235
265
|
email: props === null || props === void 0 ? void 0 : props.email,
|
|
236
266
|
placement_component: props === null || props === void 0 ? void 0 : props.placementComponent,
|
|
@@ -243,13 +273,13 @@ export class ChordAnalytics {
|
|
|
243
273
|
return this.track('Email Captured', payload, options);
|
|
244
274
|
});
|
|
245
275
|
this.trackProductAdded = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
246
|
-
var
|
|
247
|
-
const formatter = (
|
|
248
|
-
const product = (
|
|
249
|
-
const cart = (
|
|
276
|
+
var _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25;
|
|
277
|
+
const formatter = (_16 = (_15 = (_14 = this.options) === null || _14 === void 0 ? void 0 : _14.formatters) === null || _15 === void 0 ? void 0 : _15.events) === null || _16 === void 0 ? void 0 : _16.productAdded;
|
|
278
|
+
const product = (_20 = (_19 = (_18 = (_17 = this.options) === null || _17 === void 0 ? void 0 : _17.formatters) === null || _18 === void 0 ? void 0 : _18.objects) === null || _19 === void 0 ? void 0 : _19.product) === null || _20 === void 0 ? void 0 : _20.call(_19, props === null || props === void 0 ? void 0 : props.product);
|
|
279
|
+
const cart = (_24 = (_23 = (_22 = (_21 = this.options) === null || _21 === void 0 ? void 0 : _21.formatters) === null || _22 === void 0 ? void 0 : _22.objects) === null || _23 === void 0 ? void 0 : _23.cart) === null || _24 === void 0 ? void 0 : _24.call(_23, {
|
|
250
280
|
cart: props === null || props === void 0 ? void 0 : props.cart,
|
|
251
281
|
});
|
|
252
|
-
const quantity = ((
|
|
282
|
+
const quantity = ((_25 = props === null || props === void 0 ? void 0 : props.product) === null || _25 === void 0 ? void 0 : _25.quantity) || 1;
|
|
253
283
|
const payload = Object.assign(Object.assign({}, product), { cart_id: cart.cart_id, currency: cart.currency, products: [Object.assign(Object.assign({}, product), { quantity })], total: product.price * (quantity || 1), value: product.price * (quantity || 1) });
|
|
254
284
|
if (typeof formatter === 'function') {
|
|
255
285
|
const formattedPayload = formatter(props, payload);
|
|
@@ -258,28 +288,43 @@ export class ChordAnalytics {
|
|
|
258
288
|
return this.track('Product Added', payload, options);
|
|
259
289
|
});
|
|
260
290
|
this.trackProductClicked = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
261
|
-
var
|
|
262
|
-
const formatter = (
|
|
263
|
-
const product = (
|
|
264
|
-
const cart = (
|
|
291
|
+
var _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38;
|
|
292
|
+
const formatter = (_28 = (_27 = (_26 = this.options) === null || _26 === void 0 ? void 0 : _26.formatters) === null || _27 === void 0 ? void 0 : _27.events) === null || _28 === void 0 ? void 0 : _28.productClicked;
|
|
293
|
+
const product = (_32 = (_31 = (_30 = (_29 = this.options) === null || _29 === void 0 ? void 0 : _29.formatters) === null || _30 === void 0 ? void 0 : _30.objects) === null || _31 === void 0 ? void 0 : _31.product) === null || _32 === void 0 ? void 0 : _32.call(_31, props === null || props === void 0 ? void 0 : props.product);
|
|
294
|
+
const cart = (_36 = (_35 = (_34 = (_33 = this.options) === null || _33 === void 0 ? void 0 : _33.formatters) === null || _34 === void 0 ? void 0 : _34.objects) === null || _35 === void 0 ? void 0 : _35.cart) === null || _36 === void 0 ? void 0 : _36.call(_35, {
|
|
265
295
|
cart: props === null || props === void 0 ? void 0 : props.cart,
|
|
266
296
|
});
|
|
267
|
-
const quantity = ((
|
|
268
|
-
const payload = Object.assign(Object.assign({}, product), { cart_id: cart.cart_id, currency: cart.currency, item_list_id: (
|
|
297
|
+
const quantity = ((_37 = props === null || props === void 0 ? void 0 : props.product) === null || _37 === void 0 ? void 0 : _37.quantity) || 1;
|
|
298
|
+
const payload = Object.assign(Object.assign({}, product), { cart_id: cart.cart_id, currency: cart.currency, item_list_id: (_38 = props === null || props === void 0 ? void 0 : props.listId) === null || _38 === void 0 ? void 0 : _38.toString(), item_list_name: props === null || props === void 0 ? void 0 : props.listName, products: [Object.assign(Object.assign({}, product), { quantity })] });
|
|
269
299
|
if (typeof formatter === 'function') {
|
|
270
300
|
const formattedPayload = formatter(props, payload);
|
|
271
301
|
return this.track('Product Clicked', formattedPayload, options);
|
|
272
302
|
}
|
|
273
303
|
return this.track('Product Clicked', payload, options);
|
|
274
304
|
});
|
|
305
|
+
this.trackVariantClicked = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
306
|
+
var _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50;
|
|
307
|
+
const formatter = (_41 = (_40 = (_39 = this.options) === null || _39 === void 0 ? void 0 : _39.formatters) === null || _40 === void 0 ? void 0 : _40.events) === null || _41 === void 0 ? void 0 : _41.variantClicked;
|
|
308
|
+
const product = (_45 = (_44 = (_43 = (_42 = this.options) === null || _42 === void 0 ? void 0 : _42.formatters) === null || _43 === void 0 ? void 0 : _43.objects) === null || _44 === void 0 ? void 0 : _44.product) === null || _45 === void 0 ? void 0 : _45.call(_44, props === null || props === void 0 ? void 0 : props.product);
|
|
309
|
+
const cart = (_49 = (_48 = (_47 = (_46 = this.options) === null || _46 === void 0 ? void 0 : _46.formatters) === null || _47 === void 0 ? void 0 : _47.objects) === null || _48 === void 0 ? void 0 : _48.cart) === null || _49 === void 0 ? void 0 : _49.call(_48, {
|
|
310
|
+
cart: props === null || props === void 0 ? void 0 : props.cart,
|
|
311
|
+
});
|
|
312
|
+
const quantity = ((_50 = props === null || props === void 0 ? void 0 : props.product) === null || _50 === void 0 ? void 0 : _50.quantity) || 1;
|
|
313
|
+
const payload = Object.assign(Object.assign({}, product), { cart_id: cart.cart_id, currency: cart.currency, quantity: quantity, line_item_id: props === null || props === void 0 ? void 0 : props.lineItemId, coupon: props === null || props === void 0 ? void 0 : props.coupon });
|
|
314
|
+
if (typeof formatter === 'function') {
|
|
315
|
+
const formattedPayload = formatter(props, payload);
|
|
316
|
+
return this.track('Variant Clicked', formattedPayload, options);
|
|
317
|
+
}
|
|
318
|
+
return this.track('Variant Clicked', payload, options);
|
|
319
|
+
});
|
|
275
320
|
this.trackProductListFiltered = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
276
|
-
var
|
|
277
|
-
const formatter = (
|
|
321
|
+
var _51, _52, _53, _54, _55;
|
|
322
|
+
const formatter = (_53 = (_52 = (_51 = this.options) === null || _51 === void 0 ? void 0 : _51.formatters) === null || _52 === void 0 ? void 0 : _52.events) === null || _53 === void 0 ? void 0 : _53.productListFiltered;
|
|
278
323
|
const payload = {
|
|
279
324
|
category: props === null || props === void 0 ? void 0 : props.category,
|
|
280
325
|
filters: props === null || props === void 0 ? void 0 : props.filters,
|
|
281
|
-
list_id: (
|
|
282
|
-
item_list_id: (
|
|
326
|
+
list_id: (_54 = props === null || props === void 0 ? void 0 : props.listId) === null || _54 === void 0 ? void 0 : _54.toString(),
|
|
327
|
+
item_list_id: (_55 = props === null || props === void 0 ? void 0 : props.listId) === null || _55 === void 0 ? void 0 : _55.toString(),
|
|
283
328
|
item_list_name: props === null || props === void 0 ? void 0 : props.listName,
|
|
284
329
|
sorts: props === null || props === void 0 ? void 0 : props.sorts,
|
|
285
330
|
};
|
|
@@ -290,14 +335,14 @@ export class ChordAnalytics {
|
|
|
290
335
|
return this.track('Product List Filtered', payload, options);
|
|
291
336
|
});
|
|
292
337
|
this.trackProductListViewed = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
293
|
-
var
|
|
294
|
-
const formatter = (
|
|
338
|
+
var _56, _57, _58, _59, _60, _61;
|
|
339
|
+
const formatter = (_58 = (_57 = (_56 = this.options) === null || _56 === void 0 ? void 0 : _56.formatters) === null || _57 === void 0 ? void 0 : _57.events) === null || _58 === void 0 ? void 0 : _58.productListViewed;
|
|
295
340
|
const payload = {
|
|
296
341
|
category: props === null || props === void 0 ? void 0 : props.category,
|
|
297
|
-
list_id: (
|
|
298
|
-
item_list_id: (
|
|
342
|
+
list_id: (_59 = props === null || props === void 0 ? void 0 : props.listId) === null || _59 === void 0 ? void 0 : _59.toString(),
|
|
343
|
+
item_list_id: (_60 = props === null || props === void 0 ? void 0 : props.listId) === null || _60 === void 0 ? void 0 : _60.toString(),
|
|
299
344
|
item_list_name: props === null || props === void 0 ? void 0 : props.listName,
|
|
300
|
-
products: (
|
|
345
|
+
products: (_61 = props === null || props === void 0 ? void 0 : props.products) === null || _61 === void 0 ? void 0 : _61.map((p, i) => {
|
|
301
346
|
var _a, _b, _c, _d;
|
|
302
347
|
return (_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.formatters) === null || _b === void 0 ? void 0 : _b.objects) === null || _c === void 0 ? void 0 : _c.product) === null || _d === void 0 ? void 0 : _d.call(_c, Object.assign(Object.assign({}, p), { position: i + 1 }));
|
|
303
348
|
}),
|
|
@@ -310,8 +355,8 @@ export class ChordAnalytics {
|
|
|
310
355
|
return this.track('Product List Viewed', payload, options);
|
|
311
356
|
});
|
|
312
357
|
this.trackProductRemoved = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
313
|
-
var
|
|
314
|
-
const formatter = (
|
|
358
|
+
var _62, _63, _64, _65, _66, _67, _68, _69, _70, _71, _72, _73, _74, _75, _76;
|
|
359
|
+
const formatter = (_64 = (_63 = (_62 = this.options) === null || _62 === void 0 ? void 0 : _62.formatters) === null || _63 === void 0 ? void 0 : _63.events) === null || _64 === void 0 ? void 0 : _64.productRemoved;
|
|
315
360
|
/*
|
|
316
361
|
const product = this.options?.formatters?.objects?.product?.({
|
|
317
362
|
position: props?.position,
|
|
@@ -320,13 +365,13 @@ export class ChordAnalytics {
|
|
|
320
365
|
variantId: props?.variantId,
|
|
321
366
|
})
|
|
322
367
|
*/
|
|
323
|
-
const lineItem = (
|
|
368
|
+
const lineItem = (_68 = (_67 = (_66 = (_65 = this.options) === null || _65 === void 0 ? void 0 : _65.formatters) === null || _66 === void 0 ? void 0 : _66.objects) === null || _67 === void 0 ? void 0 : _67.lineItem) === null || _68 === void 0 ? void 0 : _68.call(_67, {
|
|
324
369
|
lineItem: props === null || props === void 0 ? void 0 : props.lineItem,
|
|
325
370
|
});
|
|
326
|
-
const cart = (
|
|
371
|
+
const cart = (_72 = (_71 = (_70 = (_69 = this.options) === null || _69 === void 0 ? void 0 : _69.formatters) === null || _70 === void 0 ? void 0 : _70.objects) === null || _71 === void 0 ? void 0 : _71.cart) === null || _72 === void 0 ? void 0 : _72.call(_71, {
|
|
327
372
|
cart: props === null || props === void 0 ? void 0 : props.cart,
|
|
328
373
|
});
|
|
329
|
-
const payload = Object.assign(Object.assign({}, lineItem), { cart_id: cart.cart_id, currency: cart.currency, products: [lineItem], total: ((
|
|
374
|
+
const payload = Object.assign(Object.assign({}, lineItem), { cart_id: cart.cart_id, currency: cart.currency, products: [lineItem], total: ((_73 = lineItem === null || lineItem === void 0 ? void 0 : lineItem.price) !== null && _73 !== void 0 ? _73 : 0) * ((_74 = lineItem === null || lineItem === void 0 ? void 0 : lineItem.quantity) !== null && _74 !== void 0 ? _74 : 1), value: ((_75 = lineItem === null || lineItem === void 0 ? void 0 : lineItem.price) !== null && _75 !== void 0 ? _75 : 0) * ((_76 = lineItem === null || lineItem === void 0 ? void 0 : lineItem.quantity) !== null && _76 !== void 0 ? _76 : 1) });
|
|
330
375
|
if (typeof formatter === 'function') {
|
|
331
376
|
const formattedPayload = formatter(props, payload);
|
|
332
377
|
return this.track('Product Removed', formattedPayload, options);
|
|
@@ -334,14 +379,14 @@ export class ChordAnalytics {
|
|
|
334
379
|
return this.track('Product Removed', payload, options);
|
|
335
380
|
});
|
|
336
381
|
this.trackProductViewed = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
337
|
-
var
|
|
338
|
-
const formatter = (
|
|
339
|
-
const product = (
|
|
340
|
-
const cart = (
|
|
382
|
+
var _77, _78, _79, _80, _81, _82, _83, _84, _85, _86, _87, _88, _89;
|
|
383
|
+
const formatter = (_79 = (_78 = (_77 = this.options) === null || _77 === void 0 ? void 0 : _77.formatters) === null || _78 === void 0 ? void 0 : _78.events) === null || _79 === void 0 ? void 0 : _79.productViewed;
|
|
384
|
+
const product = (_83 = (_82 = (_81 = (_80 = this.options) === null || _80 === void 0 ? void 0 : _80.formatters) === null || _81 === void 0 ? void 0 : _81.objects) === null || _82 === void 0 ? void 0 : _82.product) === null || _83 === void 0 ? void 0 : _83.call(_82, props === null || props === void 0 ? void 0 : props.product);
|
|
385
|
+
const cart = (_87 = (_86 = (_85 = (_84 = this.options) === null || _84 === void 0 ? void 0 : _84.formatters) === null || _85 === void 0 ? void 0 : _85.objects) === null || _86 === void 0 ? void 0 : _86.cart) === null || _87 === void 0 ? void 0 : _87.call(_86, {
|
|
341
386
|
cart: props === null || props === void 0 ? void 0 : props.cart,
|
|
342
387
|
});
|
|
343
|
-
const quantity = ((
|
|
344
|
-
const payload = Object.assign(Object.assign({}, product), { cart_id: cart.cart_id, currency: cart.currency, products: [Object.assign(Object.assign({}, product), { quantity })], value: product.price * (((
|
|
388
|
+
const quantity = ((_88 = props === null || props === void 0 ? void 0 : props.product) === null || _88 === void 0 ? void 0 : _88.quantity) || 1;
|
|
389
|
+
const payload = Object.assign(Object.assign({}, product), { cart_id: cart.cart_id, currency: cart.currency, products: [Object.assign(Object.assign({}, product), { quantity })], value: product.price * (((_89 = props === null || props === void 0 ? void 0 : props.product) === null || _89 === void 0 ? void 0 : _89.quantity) || 1) });
|
|
345
390
|
if (typeof formatter === 'function') {
|
|
346
391
|
const formattedPayload = formatter(props, payload);
|
|
347
392
|
return this.track('Product Viewed', formattedPayload, options);
|
|
@@ -349,12 +394,12 @@ export class ChordAnalytics {
|
|
|
349
394
|
return this.track('Product Viewed', payload, options);
|
|
350
395
|
});
|
|
351
396
|
this.trackProductsSearched = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
352
|
-
var
|
|
353
|
-
const formatter = (
|
|
397
|
+
var _90, _91, _92, _93;
|
|
398
|
+
const formatter = (_92 = (_91 = (_90 = this.options) === null || _90 === void 0 ? void 0 : _90.formatters) === null || _91 === void 0 ? void 0 : _91.events) === null || _92 === void 0 ? void 0 : _92.productsSearched;
|
|
354
399
|
const payload = {
|
|
355
400
|
currency: props === null || props === void 0 ? void 0 : props.currency,
|
|
356
401
|
price: typeof (props === null || props === void 0 ? void 0 : props.price) !== 'undefined' ? Number(props === null || props === void 0 ? void 0 : props.price) : undefined,
|
|
357
|
-
product_id: (
|
|
402
|
+
product_id: (_93 = props === null || props === void 0 ? void 0 : props.productId) === null || _93 === void 0 ? void 0 : _93.toString(),
|
|
358
403
|
quantity: props === null || props === void 0 ? void 0 : props.quantity,
|
|
359
404
|
query: props === null || props === void 0 ? void 0 : props.query,
|
|
360
405
|
};
|
|
@@ -365,8 +410,8 @@ export class ChordAnalytics {
|
|
|
365
410
|
return this.track('Products Searched', payload, options);
|
|
366
411
|
});
|
|
367
412
|
this.trackSignedIn = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
368
|
-
var
|
|
369
|
-
const formatter = (
|
|
413
|
+
var _94, _95, _96;
|
|
414
|
+
const formatter = (_96 = (_95 = (_94 = this.options) === null || _94 === void 0 ? void 0 : _94.formatters) === null || _95 === void 0 ? void 0 : _95.events) === null || _96 === void 0 ? void 0 : _96.signedIn;
|
|
370
415
|
const payload = {
|
|
371
416
|
email: props === null || props === void 0 ? void 0 : props.email,
|
|
372
417
|
method: props === null || props === void 0 ? void 0 : props.method,
|
|
@@ -378,8 +423,8 @@ export class ChordAnalytics {
|
|
|
378
423
|
return this.track('Signed In', payload, options);
|
|
379
424
|
});
|
|
380
425
|
this.trackSignedOut = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
381
|
-
var
|
|
382
|
-
const formatter = (
|
|
426
|
+
var _97, _98, _99;
|
|
427
|
+
const formatter = (_99 = (_98 = (_97 = this.options) === null || _97 === void 0 ? void 0 : _97.formatters) === null || _98 === void 0 ? void 0 : _98.events) === null || _99 === void 0 ? void 0 : _99.signedOut;
|
|
383
428
|
const payload = {
|
|
384
429
|
email: props === null || props === void 0 ? void 0 : props.email,
|
|
385
430
|
};
|
|
@@ -390,8 +435,8 @@ export class ChordAnalytics {
|
|
|
390
435
|
return this.track('Signed Out', payload, options);
|
|
391
436
|
});
|
|
392
437
|
this.trackSignedUp = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
393
|
-
var
|
|
394
|
-
const formatter = (
|
|
438
|
+
var _100, _101, _102;
|
|
439
|
+
const formatter = (_102 = (_101 = (_100 = this.options) === null || _100 === void 0 ? void 0 : _100.formatters) === null || _101 === void 0 ? void 0 : _101.events) === null || _102 === void 0 ? void 0 : _102.signedUp;
|
|
395
440
|
const payload = {
|
|
396
441
|
email: props === null || props === void 0 ? void 0 : props.email,
|
|
397
442
|
method: props === null || props === void 0 ? void 0 : props.method,
|
|
@@ -402,6 +447,82 @@ export class ChordAnalytics {
|
|
|
402
447
|
}
|
|
403
448
|
return this.track('Signed Up', payload, options);
|
|
404
449
|
});
|
|
450
|
+
this.trackLoginStarted = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
451
|
+
var _103, _104, _105;
|
|
452
|
+
const formatter = (_105 = (_104 = (_103 = this.options) === null || _103 === void 0 ? void 0 : _103.formatters) === null || _104 === void 0 ? void 0 : _104.events) === null || _105 === void 0 ? void 0 : _105.loginStarted;
|
|
453
|
+
const payload = {
|
|
454
|
+
email: props === null || props === void 0 ? void 0 : props.email,
|
|
455
|
+
};
|
|
456
|
+
if (typeof formatter === 'function') {
|
|
457
|
+
const formattedPayload = formatter(props, payload);
|
|
458
|
+
return this.track('Login Started', formattedPayload, options);
|
|
459
|
+
}
|
|
460
|
+
return this.track('Login Started', payload, options);
|
|
461
|
+
});
|
|
462
|
+
this.trackSubscriptionCancelled = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
463
|
+
var _106, _107, _108, _109;
|
|
464
|
+
const formatter = (_108 = (_107 = (_106 = this.options) === null || _106 === void 0 ? void 0 : _106.formatters) === null || _107 === void 0 ? void 0 : _107.events) === null || _108 === void 0 ? void 0 : _108.subscriptionCancelled;
|
|
465
|
+
const payload = {
|
|
466
|
+
actionable_date: props === null || props === void 0 ? void 0 : props.actionableDate,
|
|
467
|
+
address: props === null || props === void 0 ? void 0 : props.address,
|
|
468
|
+
brand: props === null || props === void 0 ? void 0 : props.brand,
|
|
469
|
+
email: props === null || props === void 0 ? void 0 : props.email,
|
|
470
|
+
end_date: props === null || props === void 0 ? void 0 : props.endDate,
|
|
471
|
+
interval_length: props === null || props === void 0 ? void 0 : props.intervalLength,
|
|
472
|
+
interval_units: props === null || props === void 0 ? void 0 : props.intervalUnits,
|
|
473
|
+
products: (_109 = props === null || props === void 0 ? void 0 : props.products) === null || _109 === void 0 ? void 0 : _109.map((p, i) => {
|
|
474
|
+
var _a, _b, _c, _d;
|
|
475
|
+
return (_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.formatters) === null || _b === void 0 ? void 0 : _b.objects) === null || _c === void 0 ? void 0 : _c.product) === null || _d === void 0 ? void 0 : _d.call(_c, Object.assign(Object.assign({}, p), { position: i + 1 }));
|
|
476
|
+
}),
|
|
477
|
+
state: props === null || props === void 0 ? void 0 : props.state,
|
|
478
|
+
subscription_id: props === null || props === void 0 ? void 0 : props.subscriptionId,
|
|
479
|
+
currency: props === null || props === void 0 ? void 0 : props.currency,
|
|
480
|
+
};
|
|
481
|
+
if (typeof formatter === 'function') {
|
|
482
|
+
const formattedPayload = formatter(props || {}, payload);
|
|
483
|
+
return this.track('Subscription Cancelled', formattedPayload, options);
|
|
484
|
+
}
|
|
485
|
+
return this.track('Subscription Cancelled', payload, options);
|
|
486
|
+
});
|
|
487
|
+
this.trackNavigationClicked = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
488
|
+
var _110, _111, _112;
|
|
489
|
+
const formatter = (_112 = (_111 = (_110 = this.options) === null || _110 === void 0 ? void 0 : _110.formatters) === null || _111 === void 0 ? void 0 : _111.events) === null || _112 === void 0 ? void 0 : _112.navigationClicked;
|
|
490
|
+
const payload = {
|
|
491
|
+
category: props === null || props === void 0 ? void 0 : props.category,
|
|
492
|
+
label: props === null || props === void 0 ? void 0 : props.label,
|
|
493
|
+
navigation_placement: props === null || props === void 0 ? void 0 : props.navigationPlacement,
|
|
494
|
+
navigation_title: props === null || props === void 0 ? void 0 : props.navigationTitle,
|
|
495
|
+
navigation_url: props === null || props === void 0 ? void 0 : props.navigationUrl,
|
|
496
|
+
};
|
|
497
|
+
if (typeof formatter === 'function') {
|
|
498
|
+
const formattedPayload = formatter(props, payload);
|
|
499
|
+
return this.track('Navigation Clicked', formattedPayload, options);
|
|
500
|
+
}
|
|
501
|
+
return this.track('Navigation Clicked', payload, options);
|
|
502
|
+
});
|
|
503
|
+
this.trackPaymentInfoEntered = (props, options) => __awaiter(this, void 0, void 0, function* () {
|
|
504
|
+
var _113, _114, _115, _116;
|
|
505
|
+
const formatter = (_115 = (_114 = (_113 = this.options) === null || _113 === void 0 ? void 0 : _113.formatters) === null || _114 === void 0 ? void 0 : _114.events) === null || _115 === void 0 ? void 0 : _115.paymentInfoEntered;
|
|
506
|
+
const payload = {
|
|
507
|
+
checkout_id: props === null || props === void 0 ? void 0 : props.checkoutId,
|
|
508
|
+
coupon: props === null || props === void 0 ? void 0 : props.coupon,
|
|
509
|
+
currency: props === null || props === void 0 ? void 0 : props.currency,
|
|
510
|
+
order_id: props === null || props === void 0 ? void 0 : props.orderId,
|
|
511
|
+
payment_method: props === null || props === void 0 ? void 0 : props.paymentMethod,
|
|
512
|
+
products: (_116 = props === null || props === void 0 ? void 0 : props.products) === null || _116 === void 0 ? void 0 : _116.map((p, i) => {
|
|
513
|
+
var _a, _b, _c, _d;
|
|
514
|
+
return (_d = (_c = (_b = (_a = this.options) === null || _a === void 0 ? void 0 : _a.formatters) === null || _b === void 0 ? void 0 : _b.objects) === null || _c === void 0 ? void 0 : _c.product) === null || _d === void 0 ? void 0 : _d.call(_c, Object.assign(Object.assign({}, p), { position: i + 1 }));
|
|
515
|
+
}),
|
|
516
|
+
shipping_method: props === null || props === void 0 ? void 0 : props.shippingMethod,
|
|
517
|
+
step: props === null || props === void 0 ? void 0 : props.step,
|
|
518
|
+
value: props === null || props === void 0 ? void 0 : props.value,
|
|
519
|
+
};
|
|
520
|
+
if (typeof formatter === 'function') {
|
|
521
|
+
const formattedPayload = formatter(props, payload);
|
|
522
|
+
return this.track('Payment Info Entered', formattedPayload, options);
|
|
523
|
+
}
|
|
524
|
+
return this.track('Payment Info Entered', payload, options);
|
|
525
|
+
});
|
|
405
526
|
const defaults = {
|
|
406
527
|
debug: false,
|
|
407
528
|
enableLogging: true,
|
package/dist/types/client.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { AnalyticsSnippet, Analytics, AnalyticsBrowser, Options } from '@segment/analytics-next';
|
|
2
|
-
import
|
|
3
|
-
import type { CartViewed, CheckoutStarted, CouponApplied, CouponDenied, CouponEntered, CouponRemoved, EmailCaptured, ProductAdded, ProductClicked, ProductListFiltered, ProductListViewed, ProductRemoved, ProductViewed, ProductsSearched, SignedIn, SignedOut, SignedUp } from './typewriter.js';
|
|
4
|
-
import type { CartViewedInput, CheckoutStartedInput, EmailCapturedInput, ProductAddedInput, ProductClickedInput, ProductListFilteredInput, ProductListViewedInput, ProductRemovedInput, ProductViewedInput, ProductsSearchedInput, ProductInput, CartInput, CheckoutInput, LineItemInput, CouponAppliedInput, CouponDeniedInput, CouponEnteredInput, CouponRemovedInput, SignedInInput, SignedOutInput, SignedUpInput } from './input.js';
|
|
2
|
+
import { ChordAnalyticsFormatters } from './formatters.js';
|
|
5
3
|
export interface ValidateResult {
|
|
6
4
|
success: boolean;
|
|
7
5
|
error?: any[];
|
|
8
6
|
data?: any;
|
|
9
7
|
}
|
|
8
|
+
export interface ObjectTypes {
|
|
9
|
+
Cart: any;
|
|
10
|
+
Checkout: any;
|
|
11
|
+
LineItem: any;
|
|
12
|
+
Product: any;
|
|
13
|
+
}
|
|
10
14
|
export type AnyAnalytics = AnalyticsSnippet | Analytics | AnalyticsBrowser;
|
|
11
15
|
export type AnyOptions = Options;
|
|
12
16
|
export type AnyProduct = {
|
|
@@ -22,37 +26,11 @@ export type AnyId = string | number;
|
|
|
22
26
|
export type AnyLineItem = {
|
|
23
27
|
[key: string]: unknown;
|
|
24
28
|
};
|
|
25
|
-
export interface ChordAnalyticsOptions {
|
|
29
|
+
export interface ChordAnalyticsOptions<T extends ObjectTypes = ObjectTypes> {
|
|
26
30
|
cdp?: AnyAnalytics | (() => AnyAnalytics);
|
|
27
31
|
debug?: boolean;
|
|
28
32
|
enableLogging?: boolean;
|
|
29
|
-
formatters:
|
|
30
|
-
events?: {
|
|
31
|
-
cartViewed?: (props: CartViewedInput, event: CartViewed) => CartViewed;
|
|
32
|
-
checkoutStarted?: (props: CheckoutStartedInput, event: CheckoutStarted) => CheckoutStarted;
|
|
33
|
-
couponApplied?: (props: CouponAppliedInput, event: CouponApplied) => CouponApplied;
|
|
34
|
-
couponDenied?: (props: CouponDeniedInput, event: CouponDenied) => CouponDenied;
|
|
35
|
-
couponEntered?: (props: CouponEnteredInput, event: CouponEntered) => CouponEntered;
|
|
36
|
-
couponRemoved?: (props: CouponRemovedInput, event: CouponRemoved) => CouponRemoved;
|
|
37
|
-
emailCaptured?: (props: EmailCapturedInput, event: EmailCaptured) => EmailCaptured;
|
|
38
|
-
productAdded?: (props: ProductAddedInput, event: ProductAdded) => ProductAdded;
|
|
39
|
-
productClicked?: (props: ProductClickedInput, event: ProductClicked) => ProductClicked;
|
|
40
|
-
productListFiltered?: (props: ProductListFilteredInput, event: ProductListFiltered) => ProductListFiltered;
|
|
41
|
-
productListViewed?: (props: ProductListViewedInput, event: ProductListViewed) => ProductListViewed;
|
|
42
|
-
productRemoved?: (props: ProductRemovedInput, event: ProductRemoved) => ProductRemoved;
|
|
43
|
-
productViewed?: (props: ProductViewedInput, event: ProductViewed) => ProductViewed;
|
|
44
|
-
productsSearched?: (props: ProductsSearchedInput, event: ProductsSearched) => ProductsSearched;
|
|
45
|
-
signedIn?: (props: SignedInInput, event: SignedIn) => SignedIn;
|
|
46
|
-
signedOut?: (props: SignedOutInput, event: SignedOut) => SignedOut;
|
|
47
|
-
signedUp?: (props: SignedUpInput, event: SignedUp) => SignedUp;
|
|
48
|
-
};
|
|
49
|
-
objects: {
|
|
50
|
-
cart: (props: CartInput) => Cart;
|
|
51
|
-
checkout: (props: CheckoutInput) => Checkout;
|
|
52
|
-
lineItem: (props: LineItemInput) => LineItem;
|
|
53
|
-
product: (props: ProductInput) => Product;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
33
|
+
formatters: ChordAnalyticsFormatters<T>;
|
|
56
34
|
stripNull?: boolean;
|
|
57
35
|
metadata: EventMetadata;
|
|
58
36
|
}
|