@thg-agentic/hyper-personalisation-web 0.0.0-stage → 3.17.1

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.
Files changed (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +825 -2
  3. package/dist/hp.min.js +3 -0
  4. package/dist/snippet.min.js +1 -0
  5. package/package.json +83 -3
  6. package/src/assignment.js +75 -0
  7. package/src/auto/attributes.js +16 -0
  8. package/src/auto/exposures.js +45 -0
  9. package/src/auto/lists.js +136 -0
  10. package/src/auto/promotions.js +104 -0
  11. package/src/auto/rails.js +217 -0
  12. package/src/auto/viewability.js +150 -0
  13. package/src/auto.js +13 -0
  14. package/src/bootstrap.js +476 -0
  15. package/src/carry.js +74 -0
  16. package/src/conformance.js +530 -0
  17. package/src/consent-gate.js +324 -0
  18. package/src/consent.js +604 -0
  19. package/src/context.js +439 -0
  20. package/src/datalayer.js +411 -0
  21. package/src/decisions.js +90 -0
  22. package/src/device-storage.js +201 -0
  23. package/src/experiments.js +220 -0
  24. package/src/ga4.js +124 -0
  25. package/src/hash.js +138 -0
  26. package/src/hp.js +135 -0
  27. package/src/index.js +818 -0
  28. package/src/preview.js +44 -0
  29. package/src/recommendation-context.js +101 -0
  30. package/src/segment.js +375 -0
  31. package/src/session/category.js +40 -0
  32. package/src/session/record.js +163 -0
  33. package/src/session/rules.js +195 -0
  34. package/src/session/signals.js +146 -0
  35. package/src/session-id.js +62 -0
  36. package/src/session.js +28 -0
  37. package/src/settings.js +211 -0
  38. package/src/shape.js +111 -0
  39. package/src/social-proof.js +139 -0
  40. package/src/spec-version.js +4 -0
  41. package/src/storage-scope.js +159 -0
  42. package/src/transport.js +436 -0
  43. package/src/version.js +2 -0
  44. package/types/auto.d.ts +51 -0
  45. package/types/bootstrap.d.ts +154 -0
  46. package/types/consent.d.ts +126 -0
  47. package/types/datalayer.d.ts +76 -0
  48. package/types/events.d.ts +680 -0
  49. package/types/hp.d.ts +64 -0
  50. package/types/index.d.ts +610 -0
  51. package/types/segment.d.ts +68 -0
@@ -0,0 +1,680 @@
1
+ // Generated from spec/registry.json by scripts/generate-sdk-models.mjs.
2
+ // DO NOT EDIT. Change the schema and regenerate — the schema is the contract,
3
+ // and a hand-edit here is an SDK that disagrees with the ingest.
4
+ // Spec version: 1.8
5
+
6
+ /** The product shape shared by every commerce event. */
7
+ export interface CdpProduct {
8
+ product_id: string;
9
+ sku?: string | null;
10
+ displayed_sku?: string | null;
11
+ variant?: string | null;
12
+ name?: string | null;
13
+ brand?: string | null;
14
+ category?: string | null;
15
+ price?: number | null;
16
+ discount?: number | null;
17
+ list_price?: number | null;
18
+ inventory_status?: 'in_stock' | 'low_stock' | 'out_of_stock' | 'preorder' | 'discontinued' | null;
19
+ quantity?: number | null;
20
+ coupon?: string | null;
21
+ position?: number | null;
22
+ url?: string | null;
23
+ image_url?: string | null;
24
+ recommendation_source?: string | null;
25
+ recommendation_seed?: string | null;
26
+ subscription?: Record<string, unknown> | null;
27
+ }
28
+
29
+ /** SERVER-SIDE ONLY. */
30
+ export interface DecisionMade {
31
+ decision_id: string;
32
+ slot: string;
33
+ policy_id: string;
34
+ policy_version: string;
35
+ candidates: Record<string, unknown>[];
36
+ propensity: number;
37
+ arm: string;
38
+ kind?: 'recommendation' | 'search_rank' | 'banner' | 'offer' | 'layout' | 'copy' | 'price' | 'other' | null;
39
+ explored?: boolean | null;
40
+ context_features?: Record<string, unknown> | null;
41
+ context_key?: string | null;
42
+ decided_at?: string | null;
43
+ latency_ms?: number | null;
44
+ }
45
+
46
+ /** A visitor interacted with a personalised surface — clicked the hero, opened a recommended product from a rail, dismissed an offer. */
47
+ export interface SlotEngaged {
48
+ decision_id: string;
49
+ slot: string;
50
+ engagement: 'view' | 'click' | 'dismiss';
51
+ arm?: string | null;
52
+ position?: number | null;
53
+ products?: CdpProduct[] | null;
54
+ }
55
+
56
+ /** A recommendation rail was on screen. */
57
+ export interface RecommendationsViewed {
58
+ recommendation_request_id: string;
59
+ placement: string;
60
+ recipe?: string | null;
61
+ strategy?: string | null;
62
+ algorithm_version?: string | null;
63
+ experiment?: string | null;
64
+ variant?: string | null;
65
+ holdout?: boolean | null;
66
+ assignment_unit_kind?: 'anonymous_id' | 'customer_id' | 'session_id' | 'other' | null;
67
+ assignment_bucket?: number | null;
68
+ candidate_set_fingerprint?: string | null;
69
+ candidate_set_size?: number | null;
70
+ ranked_by?: 'ranker' | 'blend' | 'session' | 'manual' | 'other' | null;
71
+ served_at?: string | null;
72
+ products?: CdpProduct[] | null;
73
+ viewable?: Record<string, unknown>[] | null;
74
+ }
75
+
76
+ /** A merchandising slot — a hero banner, a strip banner, an editorial block — was actually on screen. */
77
+ export interface PromotionViewed {
78
+ promotion_id: string;
79
+ name?: string | null;
80
+ creative?: string | null;
81
+ position?: string | null;
82
+ creative_slot?: string | null;
83
+ }
84
+
85
+ /** A visitor clicked a merchandising slot. */
86
+ export interface PromotionClicked {
87
+ promotion_id: string;
88
+ name?: string | null;
89
+ creative?: string | null;
90
+ position?: string | null;
91
+ creative_slot?: string | null;
92
+ href?: string | null;
93
+ }
94
+
95
+ /** A product detail page was viewed. */
96
+ export interface ProductViewed {
97
+ products: CdpProduct[];
98
+ currency?: string | null;
99
+ value?: number | null;
100
+ }
101
+
102
+ /** A listing/category page rendered a set of products. */
103
+ export interface ProductListViewed {
104
+ products: CdpProduct[];
105
+ list_id?: string | null;
106
+ category?: string | null;
107
+ pagination?: Record<string, unknown> | null;
108
+ filters?: Record<string, unknown>[] | null;
109
+ sorts?: Record<string, unknown>[] | null;
110
+ }
111
+
112
+ /** A product tile in a list was clicked. */
113
+ export interface ProductClicked {
114
+ products: CdpProduct[];
115
+ list_id?: string | null;
116
+ recommendation_request_id?: string | null;
117
+ interaction?: 'navigate' | 'quick_buy' | null;
118
+ search_request_id?: string | null;
119
+ }
120
+
121
+ /** Facet or sort selection changed on a listing. */
122
+ export interface ProductListFiltered {
123
+ list_id?: string | null;
124
+ category?: string | null;
125
+ filters?: Record<string, unknown>[];
126
+ sorts?: Record<string, unknown>[] | null;
127
+ change?: Record<string, unknown> | null;
128
+ products?: CdpProduct[] | null;
129
+ }
130
+
131
+ /** A search was executed and its results were shown. */
132
+ export interface ProductsSearched {
133
+ query: string;
134
+ is_suggested?: boolean | null;
135
+ products?: CdpProduct[];
136
+ pagination?: Record<string, unknown> | null;
137
+ search_request_id?: string | null;
138
+ }
139
+
140
+ /** A product was added to the basket. */
141
+ export interface ProductAdded {
142
+ products: CdpProduct[];
143
+ cart_id?: string | null;
144
+ is_free_gift?: boolean | null;
145
+ gift_choice_made?: boolean | null;
146
+ recommendation_request_id?: string | null;
147
+ quantity_delta?: number | null;
148
+ surface?: 'product_page' | 'product_list' | 'search' | 'recommendation' | 'wishlist' | 'basket' | 'quick_view' | 'checkout' | 'other' | null;
149
+ wishlist_id?: string | null;
150
+ initiator?: 'shopper' | 'system' | null;
151
+ search_request_id?: string | null;
152
+ }
153
+
154
+ /** A product was removed from the basket. */
155
+ export interface ProductRemoved {
156
+ products: CdpProduct[];
157
+ cart_id?: string | null;
158
+ quantity_delta?: number | null;
159
+ removed_entire_line?: boolean | null;
160
+ surface?: 'product_page' | 'product_list' | 'search' | 'recommendation' | 'wishlist' | 'basket' | 'quick_view' | 'checkout' | 'other' | null;
161
+ initiator?: 'shopper' | 'system' | null;
162
+ }
163
+
164
+ /** The basket page was viewed. */
165
+ export interface CartViewed {
166
+ cart_id?: string | null;
167
+ value?: number | null;
168
+ currency?: string | null;
169
+ taxes_included?: boolean | null;
170
+ products?: CdpProduct[] | null;
171
+ discounts?: Record<string, unknown>[] | null;
172
+ discount?: number | null;
173
+ coupon?: string | null;
174
+ }
175
+
176
+ /** Checkout was entered. */
177
+ export interface CheckoutStarted {
178
+ products: CdpProduct[];
179
+ cart_id?: string | null;
180
+ checkout_id?: string | null;
181
+ value?: number | null;
182
+ revenue?: number | null;
183
+ shipping?: number | null;
184
+ tax?: number | null;
185
+ discount?: number | null;
186
+ currency?: string | null;
187
+ taxes_included?: boolean | null;
188
+ coupon?: string | null;
189
+ payment_method?: string | null;
190
+ is_express?: boolean | null;
191
+ is_guest?: boolean | null;
192
+ order_id?: string | null;
193
+ affiliation?: string | null;
194
+ discounts?: Record<string, unknown>[] | null;
195
+ }
196
+
197
+ /** A checkout step was shown. */
198
+ export interface CheckoutStepViewed {
199
+ step: number;
200
+ step_name: string | null;
201
+ checkout_id?: string | null;
202
+ order_id?: string | null;
203
+ shipping_method?: string | null;
204
+ payment_method?: string | null;
205
+ }
206
+
207
+ /** A checkout step was completed and the customer moved on. */
208
+ export interface CheckoutStepCompleted {
209
+ step: number;
210
+ step_name: string | null;
211
+ checkout_id?: string | null;
212
+ order_id?: string | null;
213
+ shipping_method?: string | null;
214
+ payment_method?: string | null;
215
+ }
216
+
217
+ /** Payment details were supplied. */
218
+ export interface PaymentInfoEntered {
219
+ step: number;
220
+ step_name: string | null;
221
+ checkout_id?: string | null;
222
+ order_id?: string | null;
223
+ shipping_method?: string | null;
224
+ payment_method?: string | null;
225
+ }
226
+
227
+ /** An order was placed. */
228
+ export interface OrderCompleted {
229
+ order_id: string;
230
+ revenue: number;
231
+ currency: string;
232
+ products: CdpProduct[];
233
+ customer?: Record<string, unknown> | null;
234
+ checkout_id?: string | null;
235
+ cart_id?: string | null;
236
+ subtotal?: number | null;
237
+ shipping?: number | null;
238
+ tax?: number | null;
239
+ taxes_included?: boolean | null;
240
+ discount?: number | null;
241
+ total?: number | null;
242
+ coupon?: string | null;
243
+ affiliation?: string | null;
244
+ discounts?: Record<string, unknown>[] | null;
245
+ payment_method?: string | null;
246
+ shipping_method?: string | null;
247
+ customer_type?: 'new' | 'returning' | null;
248
+ is_guest?: boolean | null;
249
+ }
250
+
251
+ /** An order changed after it was placed — a line removed, an address corrected, a substitution made. */
252
+ export interface OrderUpdated {
253
+ order_id: string;
254
+ currency: string;
255
+ affiliation?: string | null;
256
+ revenue?: number | null;
257
+ total?: number | null;
258
+ shipping?: number | null;
259
+ tax?: number | null;
260
+ taxes_included?: boolean | null;
261
+ discount?: number | null;
262
+ coupon?: string | null;
263
+ products?: CdpProduct[] | null;
264
+ reason?: 'line_added' | 'line_removed' | 'quantity_changed' | 'address_changed' | 'delivery_changed' | 'payment_changed' | 'price_adjusted' | 'partial_cancellation' | 'other' | 'status_changed' | null;
265
+ status?: 'processing' | 'despatched' | 'partially_despatched' | 'delivered' | 'collected' | 'held' | 'payment_problem' | null;
266
+ reason_detail?: string | null;
267
+ }
268
+
269
+ /** Money went back to the customer, in whole or in part. */
270
+ export interface OrderRefunded {
271
+ order_id: string;
272
+ total: number;
273
+ currency: string;
274
+ refund_id?: string | null;
275
+ revenue?: number | null;
276
+ taxes_included?: boolean | null;
277
+ products?: CdpProduct[] | null;
278
+ reason?: 'faulty' | 'not_as_described' | 'wrong_item' | 'changed_mind' | 'poor_fit' | 'late_delivery' | 'damaged_in_transit' | 'goodwill' | 'other' | null;
279
+ is_partial?: boolean | null;
280
+ reason_detail?: string | null;
281
+ }
282
+
283
+ /** An order was cancelled before it shipped. */
284
+ export interface OrderCancelled {
285
+ order_id: string;
286
+ currency: string;
287
+ affiliation?: string | null;
288
+ total?: number | null;
289
+ revenue?: number | null;
290
+ shipping?: number | null;
291
+ tax?: number | null;
292
+ taxes_included?: boolean | null;
293
+ discount?: number | null;
294
+ coupon?: string | null;
295
+ products?: CdpProduct[] | null;
296
+ reason?: 'out_of_stock' | 'fraud_suspected' | 'customer_request' | 'payment_failed' | 'delivery_failed' | 'duplicate_order' | 'pricing_error' | 'other' | null;
297
+ cancelled_by?: 'customer' | 'merchant' | 'system' | null;
298
+ reason_detail?: string | null;
299
+ }
300
+
301
+ /** A shopper submitted a discount code on a basket or an order, BEFORE anything decided whether it applies. */
302
+ export interface CouponEntered {
303
+ order_id?: string | null;
304
+ cart_id?: string | null;
305
+ coupon_id?: string | null;
306
+ coupon_name?: string;
307
+ }
308
+
309
+ /** A discount code was accepted. */
310
+ export interface CouponApplied {
311
+ coupon_name: string;
312
+ cart_id?: string | null;
313
+ order_id?: string | null;
314
+ coupon_id?: string | null;
315
+ discount?: number | null;
316
+ currency?: string | null;
317
+ source?: 'manual' | 'auto_applied' | 'url' | null;
318
+ }
319
+
320
+ /** A discount code was rejected. */
321
+ export interface CouponDenied {
322
+ coupon_name: string;
323
+ cart_id?: string | null;
324
+ reason?: 'invalid' | 'expired' | 'not_applicable' | 'minimum_spend' | 'already_used' | 'other' | null;
325
+ order_id?: string | null;
326
+ coupon_id?: string | null;
327
+ source?: 'manual' | 'auto_applied' | 'url' | null;
328
+ }
329
+
330
+ /** A discount code that was applied was taken off a basket or an order. */
331
+ export interface CouponRemoved {
332
+ order_id?: string | null;
333
+ cart_id?: string | null;
334
+ coupon_id?: string | null;
335
+ coupon_name?: string;
336
+ discount?: number | null;
337
+ currency?: string | null;
338
+ }
339
+
340
+ /** Also covers the logged-out attempt, which is a strong signup-intent signal worth keeping rather than discarding. */
341
+ export interface ProductAddedToWishlist {
342
+ products: CdpProduct[];
343
+ wishlist_id?: string | null;
344
+ wishlist_name?: string | null;
345
+ was_blocked_by_auth?: boolean | null;
346
+ }
347
+
348
+ /** Product Removed from Wishlist */
349
+ export interface ProductRemovedFromWishlist {
350
+ products: CdpProduct[];
351
+ wishlist_id?: string | null;
352
+ wishlist_name?: string | null;
353
+ }
354
+
355
+ /** A shopper moved a product from a wishlist into their basket. */
356
+ export interface WishlistProductAddedToCart {
357
+ products: CdpProduct[];
358
+ wishlist_id?: string | null;
359
+ wishlist_name?: string | null;
360
+ cart_id?: string | null;
361
+ }
362
+
363
+ /** A shopper shared a product with one or more people — mailed it, copied its link, sent it to an app. */
364
+ export interface ProductShared {
365
+ products: CdpProduct[];
366
+ share_via?: string | null;
367
+ share_message?: string | null;
368
+ recipient?: string | null;
369
+ }
370
+
371
+ /** A shopper shared their basket with one or more people — a gift list, a team order, a basket sent to whoever holds the card. */
372
+ export interface CartShared {
373
+ products: CdpProduct[];
374
+ share_via?: string | null;
375
+ share_message?: string | null;
376
+ recipient?: string | null;
377
+ cart_id?: string | null;
378
+ }
379
+
380
+ /** A customer authenticated. */
381
+ export interface SignedIn {
382
+ method?: 'password' | 'google' | 'apple' | 'facebook' | 'magic_link' | 'sso' | 'passkey' | 'other' | null;
383
+ }
384
+
385
+ /** An account was created. */
386
+ export interface SignedUp {
387
+ method?: 'password' | 'google' | 'apple' | 'facebook' | 'magic_link' | 'sso' | 'passkey' | 'other' | null;
388
+ accepts_marketing?: boolean | null;
389
+ }
390
+
391
+ /** The shopper signed out. */
392
+ export type SignedOut = Record<string, never>;
393
+
394
+ /** A marketing opt-in was captured on the site or in the app — a footer form, a modal, a checkbox at checkout or in the account. */
395
+ export interface NewsletterSubscribed {
396
+ email_sha256: string;
397
+ requires_verification?: boolean | null;
398
+ placement?: string | null;
399
+ channel?: 'email' | 'sms' | 'post' | 'push' | null;
400
+ phone_sha256?: string | null;
401
+ }
402
+
403
+ /** A review was submitted. */
404
+ export interface ProductReviewed {
405
+ products: CdpProduct[];
406
+ review_id?: string | null;
407
+ rating?: number | null;
408
+ review_body?: string | null;
409
+ has_body?: boolean | null;
410
+ }
411
+
412
+ /** The visitor changed their consent state. */
413
+ export interface ConsentUpdated {
414
+ state: Record<string, unknown> | null;
415
+ action?: 'accept_all' | 'reject_all' | 'custom' | 'withdrawn' | null;
416
+ }
417
+
418
+ /** An explicit assertion that two identifiers belong to the same person. */
419
+ export interface IdentityLinked {
420
+ trigger: 'guest_checkout' | 'signed_up' | 'signed_in' | 'account_update' | 'email_link_clicked' | 'newsletter_subscribed' | 'account_creation' | 'user_login' | 'email_click' | 'newsletter_signup';
421
+ identifiers: Record<string, unknown>[];
422
+ confidence: number;
423
+ }
424
+
425
+ /** An ESP accepted and delivered a message. */
426
+ export interface EmailDelivered {
427
+ email_sha256: string;
428
+ campaign_id?: string | null;
429
+ campaign_name?: string | null;
430
+ mailing_list_id?: string | null;
431
+ email_id?: string | null;
432
+ }
433
+
434
+ /** A tracking pixel fired. */
435
+ export interface EmailOpened {
436
+ email_sha256: string;
437
+ campaign_id?: string | null;
438
+ campaign_name?: string | null;
439
+ mailing_list_id?: string | null;
440
+ email_id?: string | null;
441
+ }
442
+
443
+ /** A link in a message was followed. */
444
+ export interface EmailLinkClicked {
445
+ email_sha256: string;
446
+ campaign_id?: string | null;
447
+ campaign_name?: string | null;
448
+ link_url?: string | null;
449
+ category?: string | null;
450
+ mailing_list_id?: string | null;
451
+ email_id?: string | null;
452
+ link_id?: string | null;
453
+ }
454
+
455
+ /** The recipient opted out. */
456
+ export interface EmailUnsubscribed {
457
+ email_sha256: string;
458
+ campaign_id?: string | null;
459
+ campaign_name?: string | null;
460
+ reason?: 'too_frequent' | 'not_relevant' | 'never_signed_up' | 'spam_complaint' | 'list_unsubscribe' | 'preference_centre' | 'other' | null;
461
+ mailing_list_id?: string | null;
462
+ email_id?: string | null;
463
+ reason_detail?: string | null;
464
+ }
465
+
466
+ /** A serving response personalised what the shopper saw, or would have if the shopper were not in the property's personalisation holdout. */
467
+ export interface PersonalisationExposed {
468
+ exposure_token: string;
469
+ surface: 'audiences' | 'decisions' | 'recommendations';
470
+ holdout: boolean;
471
+ holdout_share?: number | null;
472
+ personalised_share?: number | null;
473
+ audiences?: string[] | null;
474
+ decisions?: Record<string, unknown>[] | null;
475
+ recommendation_request_id?: string | null;
476
+ }
477
+
478
+ /** 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 dropped or repriced, a saved basket restored. */
479
+ export interface CartUpdated {
480
+ products: CdpProduct[];
481
+ cart_id?: string | null;
482
+ value?: number | null;
483
+ currency?: string | null;
484
+ taxes_included?: boolean | null;
485
+ item_count?: number | null;
486
+ coupon?: string | null;
487
+ discount?: number | null;
488
+ discounts?: Record<string, unknown>[] | null;
489
+ reason?: 'product_added' | 'product_removed' | 'quantity_changed' | 'coupon_applied' | 'coupon_removed' | 'merged_on_sign_in' | 'system_adjustment' | 'restored' | null;
490
+ initiator?: 'shopper' | 'system' | null;
491
+ merged_from_cart_id?: string | null;
492
+ }
493
+
494
+ /** The shopper picked a variant — a size, a colour, a flavour — on a product page or a quick view, and the page now shows that variant. */
495
+ export interface ProductVariantSelected {
496
+ products: CdpProduct[];
497
+ changed_attributes?: Record<string, unknown>[] | null;
498
+ previous_sku?: string | null;
499
+ surface?: 'product_page' | 'quick_view' | 'product_list' | 'basket' | 'assistant' | 'other' | null;
500
+ }
501
+
502
+ /** The shopper asked to be told when something about a product changes: it is back in stock, its price drops, or it launches. */
503
+ export interface BackInStockSubscribed {
504
+ kind: 'back_in_stock' | 'price_drop' | 'launch';
505
+ products: CdpProduct[];
506
+ channel?: 'email' | 'sms' | 'push' | null;
507
+ email_sha256?: string;
508
+ phone_sha256?: string | null;
509
+ target_price?: number | null;
510
+ currency?: string | null;
511
+ }
512
+
513
+ /** The shopper opted out of marketing ON THE SITE OR IN THE APP — a preference centre, an account settings toggle, an unsubscribe page the storefront hosts. */
514
+ export interface NewsletterUnsubscribed {
515
+ channel?: 'email' | 'sms' | 'post' | 'push' | null;
516
+ mailing_list_id?: string | null;
517
+ email_sha256?: string;
518
+ phone_sha256?: string | null;
519
+ placement?: string | null;
520
+ reason?: 'too_frequent' | 'not_relevant' | 'never_signed_up' | 'privacy' | 'other' | null;
521
+ reason_detail?: string | null;
522
+ }
523
+
524
+ /** 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 under them, a session that expired. */
525
+ export interface CheckoutFailed {
526
+ stage: 'address' | 'shipping' | 'payment' | 'review' | 'place_order';
527
+ reason_kind: 'payment_declined' | 'payment_error' | 'three_ds_failed' | 'validation' | 'stock' | 'price_changed' | 'session_expired' | 'other';
528
+ checkout_id?: string | null;
529
+ cart_id?: string | null;
530
+ order_id?: string | null;
531
+ payment_method?: string | null;
532
+ is_retryable?: boolean | null;
533
+ value?: number | null;
534
+ currency?: string | null;
535
+ taxes_included?: boolean | null;
536
+ }
537
+
538
+ /** A return moved through its lifecycle: the customer asked to return goods (`requested`), the warehouse received them (`received`), or the merchant refused the return (`rejected`). */
539
+ export interface OrderReturned {
540
+ order_id: string;
541
+ return_id: string;
542
+ status: 'requested' | 'received' | 'rejected';
543
+ products?: CdpProduct[] | null;
544
+ reason?: 'faulty' | 'not_as_described' | 'wrong_item' | 'changed_mind' | 'poor_fit' | 'late_delivery' | 'damaged_in_transit' | 'goodwill' | 'other' | null;
545
+ reason_detail?: string | null;
546
+ refund_expected?: boolean | null;
547
+ }
548
+
549
+ /** An ESP's message could not be delivered to the address. */
550
+ export interface EmailBounced {
551
+ email_sha256: string;
552
+ bounce_type: 'hard' | 'soft';
553
+ campaign_id?: string | null;
554
+ campaign_name?: string | null;
555
+ mailing_list_id?: string | null;
556
+ email_id?: string | null;
557
+ }
558
+
559
+ /** The recipient reported a message as spam — a feedback-loop complaint the ESP received from the mailbox provider. */
560
+ export interface EmailMarkedAsSpam {
561
+ email_sha256: string;
562
+ campaign_id?: string | null;
563
+ campaign_name?: string | null;
564
+ mailing_list_id?: string | null;
565
+ email_id?: string | null;
566
+ }
567
+
568
+ /** The spec version these models implement. SDKs stamp it on context.spec.version. */
569
+ export const SPEC_VERSION = '1.8';
570
+
571
+ /** Every event name the registry accepts. Anything else is rejected at the ingest. */
572
+ export type CdpEventName =
573
+ | 'Decision Made'
574
+ | 'Slot Engaged'
575
+ | 'Recommendations Viewed'
576
+ | 'Promotion Viewed'
577
+ | 'Promotion Clicked'
578
+ | 'Product Viewed'
579
+ | 'Product List Viewed'
580
+ | 'Product Clicked'
581
+ | 'Product List Filtered'
582
+ | 'Products Searched'
583
+ | 'Product Added'
584
+ | 'Product Removed'
585
+ | 'Cart Viewed'
586
+ | 'Checkout Started'
587
+ | 'Checkout Step Viewed'
588
+ | 'Checkout Step Completed'
589
+ | 'Payment Info Entered'
590
+ | 'Order Completed'
591
+ | 'Order Updated'
592
+ | 'Order Refunded'
593
+ | 'Order Cancelled'
594
+ | 'Coupon Entered'
595
+ | 'Coupon Applied'
596
+ | 'Coupon Denied'
597
+ | 'Coupon Removed'
598
+ | 'Product Added to Wishlist'
599
+ | 'Product Removed from Wishlist'
600
+ | 'Wishlist Product Added to Cart'
601
+ | 'Product Shared'
602
+ | 'Cart Shared'
603
+ | 'Signed In'
604
+ | 'Signed Up'
605
+ | 'Signed Out'
606
+ | 'Newsletter Subscribed'
607
+ | 'Product Reviewed'
608
+ | 'Consent Updated'
609
+ | 'Identity Linked'
610
+ | 'Email Delivered'
611
+ | 'Email Opened'
612
+ | 'Email Link Clicked'
613
+ | 'Email Unsubscribed'
614
+ | 'Personalisation Exposed'
615
+ | 'Cart Updated'
616
+ | 'Product Variant Selected'
617
+ | 'Back In Stock Subscribed'
618
+ | 'Newsletter Unsubscribed'
619
+ | 'Checkout Failed'
620
+ | 'Order Returned'
621
+ | 'Email Bounced'
622
+ | 'Email Marked as Spam'
623
+ ;
624
+
625
+ /** Event name -> its properties, so a generic emitter stays type-safe. */
626
+ export interface CdpEventProperties {
627
+ 'Decision Made': DecisionMade;
628
+ 'Slot Engaged': SlotEngaged;
629
+ 'Recommendations Viewed': RecommendationsViewed;
630
+ 'Promotion Viewed': PromotionViewed;
631
+ 'Promotion Clicked': PromotionClicked;
632
+ 'Product Viewed': ProductViewed;
633
+ 'Product List Viewed': ProductListViewed;
634
+ 'Product Clicked': ProductClicked;
635
+ 'Product List Filtered': ProductListFiltered;
636
+ 'Products Searched': ProductsSearched;
637
+ 'Product Added': ProductAdded;
638
+ 'Product Removed': ProductRemoved;
639
+ 'Cart Viewed': CartViewed;
640
+ 'Checkout Started': CheckoutStarted;
641
+ 'Checkout Step Viewed': CheckoutStepViewed;
642
+ 'Checkout Step Completed': CheckoutStepCompleted;
643
+ 'Payment Info Entered': PaymentInfoEntered;
644
+ 'Order Completed': OrderCompleted;
645
+ 'Order Updated': OrderUpdated;
646
+ 'Order Refunded': OrderRefunded;
647
+ 'Order Cancelled': OrderCancelled;
648
+ 'Coupon Entered': CouponEntered;
649
+ 'Coupon Applied': CouponApplied;
650
+ 'Coupon Denied': CouponDenied;
651
+ 'Coupon Removed': CouponRemoved;
652
+ 'Product Added to Wishlist': ProductAddedToWishlist;
653
+ 'Product Removed from Wishlist': ProductRemovedFromWishlist;
654
+ 'Wishlist Product Added to Cart': WishlistProductAddedToCart;
655
+ 'Product Shared': ProductShared;
656
+ 'Cart Shared': CartShared;
657
+ 'Signed In': SignedIn;
658
+ 'Signed Up': SignedUp;
659
+ 'Signed Out': SignedOut;
660
+ 'Newsletter Subscribed': NewsletterSubscribed;
661
+ 'Product Reviewed': ProductReviewed;
662
+ 'Consent Updated': ConsentUpdated;
663
+ 'Identity Linked': IdentityLinked;
664
+ 'Email Delivered': EmailDelivered;
665
+ 'Email Opened': EmailOpened;
666
+ 'Email Link Clicked': EmailLinkClicked;
667
+ 'Email Unsubscribed': EmailUnsubscribed;
668
+ 'Personalisation Exposed': PersonalisationExposed;
669
+ 'Cart Updated': CartUpdated;
670
+ 'Product Variant Selected': ProductVariantSelected;
671
+ 'Back In Stock Subscribed': BackInStockSubscribed;
672
+ 'Newsletter Unsubscribed': NewsletterUnsubscribed;
673
+ 'Checkout Failed': CheckoutFailed;
674
+ 'Order Returned': OrderReturned;
675
+ 'Email Bounced': EmailBounced;
676
+ 'Email Marked as Spam': EmailMarkedAsSpam;
677
+ }
678
+
679
+ /** Which producers the registry permits for each event. Emitting from another is refused. */
680
+ export declare const CDP_PRODUCERS: Record<CdpEventName, readonly string[]>;