@thg-agentic/hyper-personalisation-web 3.18.0 → 3.22.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 +86 -16
- package/dist/hp.min.js +3 -3
- package/dist/snippet.min.js +1 -1
- package/package.json +2 -2
- package/src/bootstrap.js +11 -7
- package/src/consent-gate.js +8 -2
- package/src/context.js +0 -2
- package/src/device-storage.js +3 -2
- package/src/guard.js +46 -0
- package/src/identity-option.js +6 -0
- package/src/index.js +202 -30
- package/src/recommendation-context.js +10 -1
- package/src/segment.js +17 -9
- package/src/session/record.js +79 -18
- package/src/session/rules.js +26 -1
- package/src/session/signals.js +6 -0
- package/src/session.js +1 -0
- package/src/settings.js +25 -1
- package/src/spec-version.js +1 -1
- package/src/transport.js +84 -11
- package/src/version.js +1 -1
- package/types/bootstrap.d.ts +1 -1
- package/types/consent.d.ts +4 -6
- package/types/events.d.ts +84 -42
- package/types/index.d.ts +17 -18
package/types/events.d.ts
CHANGED
|
@@ -1,7 +1,39 @@
|
|
|
1
1
|
// Generated from spec/registry.json by scripts/generate-sdk-models.mjs.
|
|
2
2
|
// DO NOT EDIT. Change the schema and regenerate — the schema is the contract,
|
|
3
3
|
// and a hand-edit here is an SDK that disagrees with the ingest.
|
|
4
|
-
// Spec version: 1.
|
|
4
|
+
// Spec version: 1.15
|
|
5
|
+
|
|
6
|
+
/** context.source.environment. Environment the producer runs in. */
|
|
7
|
+
export type CdpSourceEnvironment = 'production' | 'staging' | 'development';
|
|
8
|
+
export declare const CDP_SOURCE_ENVIRONMENT_VALUES: readonly CdpSourceEnvironment[];
|
|
9
|
+
|
|
10
|
+
/** context.identity_trust. Whether `anonymousId` on this event identifies a single real visitor. */
|
|
11
|
+
export type CdpIdentityTrust = 'device' | 'shared_render' | 'none';
|
|
12
|
+
export declare const CDP_IDENTITY_TRUST_VALUES: readonly CdpIdentityTrust[];
|
|
13
|
+
|
|
14
|
+
/** context.page.type. The page's type, from a closed taxonomy every consumer groups by. */
|
|
15
|
+
export type CdpPageType = 'home' | 'list' | 'product' | 'search' | 'basket' | 'checkout' | 'order_confirmation' | 'login' | 'register' | 'account' | 'info' | 'blog' | 'other';
|
|
16
|
+
export declare const CDP_PAGE_TYPE_VALUES: readonly CdpPageType[];
|
|
17
|
+
|
|
18
|
+
/** context.device.type. The kind of device, derived by the ingest from the user agent. */
|
|
19
|
+
export type CdpDeviceType = 'desktop' | 'mobile' | 'tablet' | 'bot' | 'app';
|
|
20
|
+
export declare const CDP_DEVICE_TYPE_VALUES: readonly CdpDeviceType[];
|
|
21
|
+
|
|
22
|
+
/** context.device.network. How the device was connected when the event happened, as a native app reports it. */
|
|
23
|
+
export type CdpDeviceNetwork = 'wifi' | 'cellular' | 'wired' | 'offline' | 'other';
|
|
24
|
+
export declare const CDP_DEVICE_NETWORK_VALUES: readonly CdpDeviceNetwork[];
|
|
25
|
+
|
|
26
|
+
/** context.consent.basis. Who decided whether this event may be collected. */
|
|
27
|
+
export type CdpConsentBasis = 'visitor' | 'host';
|
|
28
|
+
export declare const CDP_CONSENT_BASIS_VALUES: readonly CdpConsentBasis[];
|
|
29
|
+
|
|
30
|
+
/** context.decisions[].kind. The kind of decision, as `Decision Made.kind` (recommendation, banner, offer, layout, price, …), copied so a reward can be rolled up by kind without joining the decision log. */
|
|
31
|
+
export type CdpDecisionKind = 'recommendation' | 'search_rank' | 'banner' | 'offer' | 'layout' | 'copy' | 'price' | 'other';
|
|
32
|
+
export declare const CDP_DECISION_KIND_VALUES: readonly CdpDecisionKind[];
|
|
33
|
+
|
|
34
|
+
/** context.consent. The purposes a visitor answers for: context.consent and Consent Updated `state`. */
|
|
35
|
+
export type CdpConsentPurpose = 'analytics' | 'marketing' | 'personalisation' | 'ad_user_data' | 'ad_personalization';
|
|
36
|
+
export declare const CDP_CONSENT_PURPOSE_VALUES: readonly CdpConsentPurpose[];
|
|
5
37
|
|
|
6
38
|
/** The product shape shared by every commerce event. */
|
|
7
39
|
export interface CdpProduct {
|
|
@@ -26,7 +58,7 @@ export interface CdpProduct {
|
|
|
26
58
|
subscription?: Record<string, unknown> | null;
|
|
27
59
|
}
|
|
28
60
|
|
|
29
|
-
/**
|
|
61
|
+
/** A personalisation decision was taken: the decision service chose `arm` for `slot` from `candidates`, with probability `propensity`, under policy `policy_id` at `policy_version`, given `context_features`. */
|
|
30
62
|
export interface DecisionMade {
|
|
31
63
|
decision_id: string;
|
|
32
64
|
slot: string;
|
|
@@ -44,7 +76,7 @@ export interface DecisionMade {
|
|
|
44
76
|
latency_ms?: number | null;
|
|
45
77
|
}
|
|
46
78
|
|
|
47
|
-
/** A visitor interacted with a personalised surface
|
|
79
|
+
/** A visitor interacted with a personalised surface: viewed it, clicked it (for example opened a product from a rail), or dismissed it. */
|
|
48
80
|
export interface SlotEngaged {
|
|
49
81
|
decision_id: string;
|
|
50
82
|
slot: string;
|
|
@@ -74,7 +106,7 @@ export interface RecommendationsViewed {
|
|
|
74
106
|
viewable?: Record<string, unknown>[] | null;
|
|
75
107
|
}
|
|
76
108
|
|
|
77
|
-
/** A
|
|
109
|
+
/** A promotion was viewable on screen. */
|
|
78
110
|
export interface PromotionViewed {
|
|
79
111
|
promotion_id: string;
|
|
80
112
|
name?: string | null;
|
|
@@ -83,7 +115,7 @@ export interface PromotionViewed {
|
|
|
83
115
|
creative_slot?: string | null;
|
|
84
116
|
}
|
|
85
117
|
|
|
86
|
-
/** A
|
|
118
|
+
/** A shopper clicked a promotion. */
|
|
87
119
|
export interface PromotionClicked {
|
|
88
120
|
promotion_id: string;
|
|
89
121
|
name?: string | null;
|
|
@@ -93,14 +125,14 @@ export interface PromotionClicked {
|
|
|
93
125
|
href?: string | null;
|
|
94
126
|
}
|
|
95
127
|
|
|
96
|
-
/** A product
|
|
128
|
+
/** A shopper saw one product's details, on its product page or in a quick-view overlay. */
|
|
97
129
|
export interface ProductViewed {
|
|
98
130
|
products: CdpProduct[];
|
|
99
131
|
currency?: string | null;
|
|
100
132
|
value?: number | null;
|
|
101
133
|
}
|
|
102
134
|
|
|
103
|
-
/** A
|
|
135
|
+
/** A shopper viewed a list of products: a category or listing page, a collection, or a page of search results. */
|
|
104
136
|
export interface ProductListViewed {
|
|
105
137
|
products: CdpProduct[];
|
|
106
138
|
list_id?: string | null;
|
|
@@ -110,7 +142,7 @@ export interface ProductListViewed {
|
|
|
110
142
|
sorts?: Record<string, unknown>[] | null;
|
|
111
143
|
}
|
|
112
144
|
|
|
113
|
-
/** A product
|
|
145
|
+
/** A shopper clicked a product in a list, search results, search suggestions or a recommendation rail. */
|
|
114
146
|
export interface ProductClicked {
|
|
115
147
|
products: CdpProduct[];
|
|
116
148
|
list_id?: string | null;
|
|
@@ -119,7 +151,7 @@ export interface ProductClicked {
|
|
|
119
151
|
search_request_id?: string | null;
|
|
120
152
|
}
|
|
121
153
|
|
|
122
|
-
/**
|
|
154
|
+
/** A shopper changed the facets or sort order of a list and a new result set loaded. */
|
|
123
155
|
export interface ProductListFiltered {
|
|
124
156
|
list_id?: string | null;
|
|
125
157
|
category?: string | null;
|
|
@@ -129,7 +161,7 @@ export interface ProductListFiltered {
|
|
|
129
161
|
products?: CdpProduct[] | null;
|
|
130
162
|
}
|
|
131
163
|
|
|
132
|
-
/** A search was
|
|
164
|
+
/** A search was submitted and its results page was shown. */
|
|
133
165
|
export interface ProductsSearched {
|
|
134
166
|
query: string;
|
|
135
167
|
is_suggested?: boolean | null;
|
|
@@ -138,6 +170,13 @@ export interface ProductsSearched {
|
|
|
138
170
|
search_request_id?: string | null;
|
|
139
171
|
}
|
|
140
172
|
|
|
173
|
+
/** A search box suggested products for a partly typed query, and they were seen: instant search, typeahead or autocomplete. */
|
|
174
|
+
export interface SearchSuggestionsViewed {
|
|
175
|
+
query: string;
|
|
176
|
+
products: CdpProduct[];
|
|
177
|
+
search_request_id?: string | null;
|
|
178
|
+
}
|
|
179
|
+
|
|
141
180
|
/** A product was added to the basket. */
|
|
142
181
|
export interface ProductAdded {
|
|
143
182
|
products: CdpProduct[];
|
|
@@ -162,7 +201,7 @@ export interface ProductRemoved {
|
|
|
162
201
|
initiator?: 'shopper' | 'system' | null;
|
|
163
202
|
}
|
|
164
203
|
|
|
165
|
-
/** The basket page
|
|
204
|
+
/** The shopper viewed the basket page. */
|
|
166
205
|
export interface CartViewed {
|
|
167
206
|
cart_id?: string | null;
|
|
168
207
|
value?: number | null;
|
|
@@ -174,7 +213,7 @@ export interface CartViewed {
|
|
|
174
213
|
coupon?: string | null;
|
|
175
214
|
}
|
|
176
215
|
|
|
177
|
-
/**
|
|
216
|
+
/** The shopper entered checkout. */
|
|
178
217
|
export interface CheckoutStarted {
|
|
179
218
|
products: CdpProduct[];
|
|
180
219
|
cart_id?: string | null;
|
|
@@ -195,7 +234,7 @@ export interface CheckoutStarted {
|
|
|
195
234
|
discounts?: Record<string, unknown>[] | null;
|
|
196
235
|
}
|
|
197
236
|
|
|
198
|
-
/** A checkout step was shown. */
|
|
237
|
+
/** A checkout step was shown to the shopper. */
|
|
199
238
|
export interface CheckoutStepViewed {
|
|
200
239
|
step: number;
|
|
201
240
|
step_name: string | null;
|
|
@@ -205,7 +244,7 @@ export interface CheckoutStepViewed {
|
|
|
205
244
|
payment_method?: string | null;
|
|
206
245
|
}
|
|
207
246
|
|
|
208
|
-
/**
|
|
247
|
+
/** The shopper completed a checkout step and moved on. */
|
|
209
248
|
export interface CheckoutStepCompleted {
|
|
210
249
|
step: number;
|
|
211
250
|
step_name: string | null;
|
|
@@ -215,7 +254,7 @@ export interface CheckoutStepCompleted {
|
|
|
215
254
|
payment_method?: string | null;
|
|
216
255
|
}
|
|
217
256
|
|
|
218
|
-
/**
|
|
257
|
+
/** The shopper supplied payment details in checkout. */
|
|
219
258
|
export interface PaymentInfoEntered {
|
|
220
259
|
step: number;
|
|
221
260
|
step_name: string | null;
|
|
@@ -249,7 +288,7 @@ export interface OrderCompleted {
|
|
|
249
288
|
is_guest?: boolean | null;
|
|
250
289
|
}
|
|
251
290
|
|
|
252
|
-
/** An order changed after it was placed
|
|
291
|
+
/** An order changed after it was placed, e.g. a line removed, an address corrected or a substitution made. */
|
|
253
292
|
export interface OrderUpdated {
|
|
254
293
|
order_id: string;
|
|
255
294
|
currency: string;
|
|
@@ -261,13 +300,14 @@ export interface OrderUpdated {
|
|
|
261
300
|
taxes_included?: boolean | null;
|
|
262
301
|
discount?: number | null;
|
|
263
302
|
coupon?: string | null;
|
|
303
|
+
payment_method?: string | null;
|
|
264
304
|
products?: CdpProduct[] | null;
|
|
265
305
|
reason?: 'line_added' | 'line_removed' | 'quantity_changed' | 'address_changed' | 'delivery_changed' | 'payment_changed' | 'price_adjusted' | 'partial_cancellation' | 'other' | 'status_changed' | null;
|
|
266
306
|
status?: 'processing' | 'despatched' | 'partially_despatched' | 'delivered' | 'collected' | 'held' | 'payment_problem' | null;
|
|
267
307
|
reason_detail?: string | null;
|
|
268
308
|
}
|
|
269
309
|
|
|
270
|
-
/** Money went back to the customer, in whole or in part. */
|
|
310
|
+
/** Money went back to the customer for an order, in whole or in part. */
|
|
271
311
|
export interface OrderRefunded {
|
|
272
312
|
order_id: string;
|
|
273
313
|
total: number;
|
|
@@ -299,7 +339,7 @@ export interface OrderCancelled {
|
|
|
299
339
|
reason_detail?: string | null;
|
|
300
340
|
}
|
|
301
341
|
|
|
302
|
-
/**
|
|
342
|
+
/** The shopper submitted a discount code on a basket or order, before anything decided whether it applies. */
|
|
303
343
|
export interface CouponEntered {
|
|
304
344
|
order_id?: string | null;
|
|
305
345
|
cart_id?: string | null;
|
|
@@ -307,7 +347,7 @@ export interface CouponEntered {
|
|
|
307
347
|
coupon_name?: string;
|
|
308
348
|
}
|
|
309
349
|
|
|
310
|
-
/** A discount code was accepted. */
|
|
350
|
+
/** A discount code was accepted on a basket or order. */
|
|
311
351
|
export interface CouponApplied {
|
|
312
352
|
coupon_name: string;
|
|
313
353
|
cart_id?: string | null;
|
|
@@ -318,7 +358,7 @@ export interface CouponApplied {
|
|
|
318
358
|
source?: 'manual' | 'auto_applied' | 'url' | null;
|
|
319
359
|
}
|
|
320
360
|
|
|
321
|
-
/** A discount code was rejected. */
|
|
361
|
+
/** A discount code was rejected on a basket or order. */
|
|
322
362
|
export interface CouponDenied {
|
|
323
363
|
coupon_name: string;
|
|
324
364
|
cart_id?: string | null;
|
|
@@ -328,7 +368,7 @@ export interface CouponDenied {
|
|
|
328
368
|
source?: 'manual' | 'auto_applied' | 'url' | null;
|
|
329
369
|
}
|
|
330
370
|
|
|
331
|
-
/** A discount code that
|
|
371
|
+
/** A discount code that had been applied was taken off a basket or order. */
|
|
332
372
|
export interface CouponRemoved {
|
|
333
373
|
order_id?: string | null;
|
|
334
374
|
cart_id?: string | null;
|
|
@@ -338,7 +378,7 @@ export interface CouponRemoved {
|
|
|
338
378
|
currency?: string | null;
|
|
339
379
|
}
|
|
340
380
|
|
|
341
|
-
/**
|
|
381
|
+
/** A shopper added a product to a wishlist. */
|
|
342
382
|
export interface ProductAddedToWishlist {
|
|
343
383
|
products: CdpProduct[];
|
|
344
384
|
wishlist_id?: string | null;
|
|
@@ -346,14 +386,14 @@ export interface ProductAddedToWishlist {
|
|
|
346
386
|
was_blocked_by_auth?: boolean | null;
|
|
347
387
|
}
|
|
348
388
|
|
|
349
|
-
/**
|
|
389
|
+
/** A shopper removed a product from a wishlist. */
|
|
350
390
|
export interface ProductRemovedFromWishlist {
|
|
351
391
|
products: CdpProduct[];
|
|
352
392
|
wishlist_id?: string | null;
|
|
353
393
|
wishlist_name?: string | null;
|
|
354
394
|
}
|
|
355
395
|
|
|
356
|
-
/** A shopper moved a product from a wishlist into
|
|
396
|
+
/** A shopper moved a product from a wishlist into the basket. */
|
|
357
397
|
export interface WishlistProductAddedToCart {
|
|
358
398
|
products: CdpProduct[];
|
|
359
399
|
wishlist_id?: string | null;
|
|
@@ -361,7 +401,7 @@ export interface WishlistProductAddedToCart {
|
|
|
361
401
|
cart_id?: string | null;
|
|
362
402
|
}
|
|
363
403
|
|
|
364
|
-
/** A shopper shared a product with one or more people
|
|
404
|
+
/** A shopper shared a product with one or more people: by email, a copied link, or another app. */
|
|
365
405
|
export interface ProductShared {
|
|
366
406
|
products: CdpProduct[];
|
|
367
407
|
share_via?: string | null;
|
|
@@ -369,7 +409,7 @@ export interface ProductShared {
|
|
|
369
409
|
recipient?: string | null;
|
|
370
410
|
}
|
|
371
411
|
|
|
372
|
-
/** A shopper shared their basket with one or more people
|
|
412
|
+
/** A shopper shared their basket with one or more people, e.g. a gift list or a basket sent to someone else to pay. */
|
|
373
413
|
export interface CartShared {
|
|
374
414
|
products: CdpProduct[];
|
|
375
415
|
share_via?: string | null;
|
|
@@ -392,7 +432,7 @@ export interface SignedUp {
|
|
|
392
432
|
/** The shopper signed out. */
|
|
393
433
|
export type SignedOut = Record<string, never>;
|
|
394
434
|
|
|
395
|
-
/**
|
|
435
|
+
/** The shopper opted in to marketing messages on the site or in the app, for example through a footer form, a modal, or a checkbox at checkout or in their account. */
|
|
396
436
|
export interface NewsletterSubscribed {
|
|
397
437
|
email_sha256: string;
|
|
398
438
|
requires_verification?: boolean | null;
|
|
@@ -401,7 +441,7 @@ export interface NewsletterSubscribed {
|
|
|
401
441
|
phone_sha256?: string | null;
|
|
402
442
|
}
|
|
403
443
|
|
|
404
|
-
/** A review
|
|
444
|
+
/** A shopper submitted a review of a product. */
|
|
405
445
|
export interface ProductReviewed {
|
|
406
446
|
products: CdpProduct[];
|
|
407
447
|
review_id?: string | null;
|
|
@@ -410,20 +450,20 @@ export interface ProductReviewed {
|
|
|
410
450
|
has_body?: boolean | null;
|
|
411
451
|
}
|
|
412
452
|
|
|
413
|
-
/** The visitor changed their consent
|
|
453
|
+
/** The visitor changed their consent: the record of what they allowed and when. */
|
|
414
454
|
export interface ConsentUpdated {
|
|
415
455
|
state: Record<string, unknown> | null;
|
|
416
456
|
action?: 'accept_all' | 'reject_all' | 'custom' | 'withdrawn' | null;
|
|
417
457
|
}
|
|
418
458
|
|
|
419
|
-
/** An explicit assertion that
|
|
459
|
+
/** An explicit assertion that several identifiers belong to the same person, for links an `identify` cannot imply: a guest checkout, an email click, a newsletter signup, a cross-device link. */
|
|
420
460
|
export interface IdentityLinked {
|
|
421
461
|
trigger: 'guest_checkout' | 'signed_up' | 'signed_in' | 'account_update' | 'email_link_clicked' | 'newsletter_subscribed' | 'account_creation' | 'user_login' | 'email_click' | 'newsletter_signup';
|
|
422
462
|
identifiers: Record<string, unknown>[];
|
|
423
463
|
confidence: number;
|
|
424
464
|
}
|
|
425
465
|
|
|
426
|
-
/**
|
|
466
|
+
/** The ESP delivered a message to the recipient's mailbox provider. */
|
|
427
467
|
export interface EmailDelivered {
|
|
428
468
|
email_sha256: string;
|
|
429
469
|
campaign_id?: string | null;
|
|
@@ -432,7 +472,7 @@ export interface EmailDelivered {
|
|
|
432
472
|
email_id?: string | null;
|
|
433
473
|
}
|
|
434
474
|
|
|
435
|
-
/**
|
|
475
|
+
/** The recipient opened a message, as detected by the ESP's tracking pixel. */
|
|
436
476
|
export interface EmailOpened {
|
|
437
477
|
email_sha256: string;
|
|
438
478
|
campaign_id?: string | null;
|
|
@@ -441,7 +481,7 @@ export interface EmailOpened {
|
|
|
441
481
|
email_id?: string | null;
|
|
442
482
|
}
|
|
443
483
|
|
|
444
|
-
/**
|
|
484
|
+
/** The recipient clicked a link in a message. */
|
|
445
485
|
export interface EmailLinkClicked {
|
|
446
486
|
email_sha256: string;
|
|
447
487
|
campaign_id?: string | null;
|
|
@@ -453,7 +493,7 @@ export interface EmailLinkClicked {
|
|
|
453
493
|
link_id?: string | null;
|
|
454
494
|
}
|
|
455
495
|
|
|
456
|
-
/** The recipient opted out. */
|
|
496
|
+
/** The recipient opted out of email from a message, for example through the ESP's unsubscribe link or a List-Unsubscribe header. */
|
|
457
497
|
export interface EmailUnsubscribed {
|
|
458
498
|
email_sha256: string;
|
|
459
499
|
campaign_id?: string | null;
|
|
@@ -476,7 +516,7 @@ export interface PersonalisationExposed {
|
|
|
476
516
|
recommendation_request_id?: string | null;
|
|
477
517
|
}
|
|
478
518
|
|
|
479
|
-
/** The basket
|
|
519
|
+
/** The basket as it now stands, sent after any change the platform has confirmed: a line added, removed or re-quantified, a code applied or removed, a basket merged at sign-in, a line the system removed or repriced, a saved basket restored. */
|
|
480
520
|
export interface CartUpdated {
|
|
481
521
|
products: CdpProduct[];
|
|
482
522
|
cart_id?: string | null;
|
|
@@ -492,7 +532,7 @@ export interface CartUpdated {
|
|
|
492
532
|
merged_from_cart_id?: string | null;
|
|
493
533
|
}
|
|
494
534
|
|
|
495
|
-
/** The shopper picked a variant
|
|
535
|
+
/** The shopper picked a variant (a size, a colour, a flavour) on a product page or a quick view, and the page now shows it. */
|
|
496
536
|
export interface ProductVariantSelected {
|
|
497
537
|
products: CdpProduct[];
|
|
498
538
|
changed_attributes?: Record<string, unknown>[] | null;
|
|
@@ -511,7 +551,7 @@ export interface BackInStockSubscribed {
|
|
|
511
551
|
currency?: string | null;
|
|
512
552
|
}
|
|
513
553
|
|
|
514
|
-
/** The shopper opted out of marketing
|
|
554
|
+
/** The shopper opted out of marketing messages on the site or in the app, for example in a preference centre, an account setting or an unsubscribe page the storefront hosts. */
|
|
515
555
|
export interface NewsletterUnsubscribed {
|
|
516
556
|
channel?: 'email' | 'sms' | 'post' | 'push' | null;
|
|
517
557
|
mailing_list_id?: string | null;
|
|
@@ -522,7 +562,7 @@ export interface NewsletterUnsubscribed {
|
|
|
522
562
|
reason_detail?: string | null;
|
|
523
563
|
}
|
|
524
564
|
|
|
525
|
-
/** A checkout attempt was stopped by an error the shopper saw: a payment declined, a 3-D Secure challenge failed, an address that would not validate, an item that went out of stock or changed price
|
|
565
|
+
/** A checkout attempt was stopped by an error the shopper saw: a payment declined, a 3-D Secure challenge failed, an address that would not validate, an item that went out of stock or changed price, or a session that expired. */
|
|
526
566
|
export interface CheckoutFailed {
|
|
527
567
|
stage: 'address' | 'shipping' | 'payment' | 'review' | 'place_order';
|
|
528
568
|
reason_kind: 'payment_declined' | 'payment_error' | 'three_ds_failed' | 'validation' | 'stock' | 'price_changed' | 'session_expired' | 'other';
|
|
@@ -536,7 +576,7 @@ export interface CheckoutFailed {
|
|
|
536
576
|
taxes_included?: boolean | null;
|
|
537
577
|
}
|
|
538
578
|
|
|
539
|
-
/** A return moved through its lifecycle: the customer asked to return goods (`requested`), the
|
|
579
|
+
/** A return moved through its lifecycle: the customer asked to return goods (`requested`), the merchant received them (`received`), or the merchant refused the return (`rejected`). */
|
|
540
580
|
export interface OrderReturned {
|
|
541
581
|
order_id: string;
|
|
542
582
|
return_id: string;
|
|
@@ -547,7 +587,7 @@ export interface OrderReturned {
|
|
|
547
587
|
refund_expected?: boolean | null;
|
|
548
588
|
}
|
|
549
589
|
|
|
550
|
-
/**
|
|
590
|
+
/** The ESP could not deliver a message to the address. */
|
|
551
591
|
export interface EmailBounced {
|
|
552
592
|
email_sha256: string;
|
|
553
593
|
bounce_type: 'hard' | 'soft';
|
|
@@ -557,7 +597,7 @@ export interface EmailBounced {
|
|
|
557
597
|
email_id?: string | null;
|
|
558
598
|
}
|
|
559
599
|
|
|
560
|
-
/** The recipient reported a message as spam
|
|
600
|
+
/** The recipient reported a message as spam, as received by the ESP through the mailbox provider's feedback loop. */
|
|
561
601
|
export interface EmailMarkedAsSpam {
|
|
562
602
|
email_sha256: string;
|
|
563
603
|
campaign_id?: string | null;
|
|
@@ -591,7 +631,7 @@ export interface ApplicationUpdated {
|
|
|
591
631
|
}
|
|
592
632
|
|
|
593
633
|
/** The spec version these models implement. SDKs stamp it on context.spec.version. */
|
|
594
|
-
export const SPEC_VERSION = '1.
|
|
634
|
+
export const SPEC_VERSION = '1.15';
|
|
595
635
|
|
|
596
636
|
/** Every event name the registry accepts. Anything else is rejected at the ingest. */
|
|
597
637
|
export type CdpEventName =
|
|
@@ -605,6 +645,7 @@ export type CdpEventName =
|
|
|
605
645
|
| 'Product Clicked'
|
|
606
646
|
| 'Product List Filtered'
|
|
607
647
|
| 'Products Searched'
|
|
648
|
+
| 'Search Suggestions Viewed'
|
|
608
649
|
| 'Product Added'
|
|
609
650
|
| 'Product Removed'
|
|
610
651
|
| 'Cart Viewed'
|
|
@@ -663,6 +704,7 @@ export interface CdpEventProperties {
|
|
|
663
704
|
'Product Clicked': ProductClicked;
|
|
664
705
|
'Product List Filtered': ProductListFiltered;
|
|
665
706
|
'Products Searched': ProductsSearched;
|
|
707
|
+
'Search Suggestions Viewed': SearchSuggestionsViewed;
|
|
666
708
|
'Product Added': ProductAdded;
|
|
667
709
|
'Product Removed': ProductRemoved;
|
|
668
710
|
'Cart Viewed': CartViewed;
|
package/types/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
CartViewed,
|
|
7
7
|
CdpEventName,
|
|
8
8
|
CdpEventProperties,
|
|
9
|
+
CdpPageType,
|
|
9
10
|
CdpProduct,
|
|
10
11
|
CheckoutFailed,
|
|
11
12
|
CheckoutStarted,
|
|
@@ -36,6 +37,7 @@ import type {
|
|
|
36
37
|
PromotionClicked,
|
|
37
38
|
PromotionViewed,
|
|
38
39
|
RecommendationsViewed,
|
|
40
|
+
SearchSuggestionsViewed,
|
|
39
41
|
SignedIn,
|
|
40
42
|
SignedUp,
|
|
41
43
|
SlotEngaged,
|
|
@@ -45,20 +47,8 @@ import type {
|
|
|
45
47
|
export type { ConsentAdapter, ConsentBasis, ConsentState } from './consent';
|
|
46
48
|
export type * from './events';
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
| 'list'
|
|
51
|
-
| 'product'
|
|
52
|
-
| 'search'
|
|
53
|
-
| 'basket'
|
|
54
|
-
| 'checkout'
|
|
55
|
-
| 'order_confirmation'
|
|
56
|
-
| 'login'
|
|
57
|
-
| 'register'
|
|
58
|
-
| 'account'
|
|
59
|
-
| 'info'
|
|
60
|
-
| 'blog'
|
|
61
|
-
| 'other';
|
|
50
|
+
/** context.page.type: the spec's page taxonomy, generated. */
|
|
51
|
+
export type PageType = CdpPageType;
|
|
62
52
|
|
|
63
53
|
export interface PageProperties {
|
|
64
54
|
/** Stored as context.page.type and inherited by later events on the page. */
|
|
@@ -116,7 +106,6 @@ export interface AnalyticsContextSources {
|
|
|
116
106
|
* Given, it is the only source, even when it returns nothing.
|
|
117
107
|
*/
|
|
118
108
|
getSessionId?(): string | null | undefined;
|
|
119
|
-
getRenderId?(): string | null | undefined;
|
|
120
109
|
getExperiments?(): Record<string, unknown>[] | null | undefined;
|
|
121
110
|
getAudiences?(): Record<string, unknown>[] | null | undefined;
|
|
122
111
|
getDecisions?(): Record<string, unknown>[] | null | undefined;
|
|
@@ -252,9 +241,13 @@ export interface AnalyticsClient {
|
|
|
252
241
|
properties?: Record<string, unknown>,
|
|
253
242
|
options?: CallOptions,
|
|
254
243
|
): CdpEvent | null;
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
244
|
+
/** Null when the event is not sent: outside the sample, dropped by `beforeSend`, or failed. */
|
|
245
|
+
page(properties?: PageProperties, options?: CallOptions): CdpEvent | null;
|
|
246
|
+
identify(traits?: IdentifyTraits, options?: CallOptions): CdpEvent | null;
|
|
247
|
+
/**
|
|
248
|
+
* Sign-out on a shared device: forget the user, the page chain, the SDK's session, the decisions
|
|
249
|
+
* in force and the recommendation context. The device id stays.
|
|
250
|
+
*/
|
|
258
251
|
reset(): void;
|
|
259
252
|
|
|
260
253
|
productViewed: Emit<ProductViewed>;
|
|
@@ -293,7 +286,13 @@ export interface AnalyticsClient {
|
|
|
293
286
|
personalisationGroup(): PersonalisationGroup;
|
|
294
287
|
productClicked: Emit<ProductClicked>;
|
|
295
288
|
productListFiltered: Emit<ProductListFiltered>;
|
|
289
|
+
/** A submitted search and the results page it produced. */
|
|
296
290
|
productsSearched: Emit<ProductsSearched>;
|
|
291
|
+
/**
|
|
292
|
+
* The search box's suggested products for a partly typed query, once seen. Never productsSearched,
|
|
293
|
+
* which is a submitted search's results page.
|
|
294
|
+
*/
|
|
295
|
+
searchSuggestionsViewed: Emit<SearchSuggestionsViewed>;
|
|
297
296
|
productAdded: Emit<ProductAdded>;
|
|
298
297
|
productRemoved: Emit<ProductRemoved>;
|
|
299
298
|
/**
|