@rebuy/rebuy 3.52.0 → 3.53.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.
@@ -0,0 +1,1293 @@
1
+ import type { PostPurchaseChoice } from '../schema/postPurchaseChoice';
2
+ import { PostPurchaseStsContext } from '../schema/postPurchaseOfferEligibility';
3
+ import type { normalizePostPurchaseProduct } from '../server/normalizePostPurchaseProduct';
4
+ import { type PostPurchaseQuantity } from '../server/readPostPurchaseQuantity';
5
+ import type { Reporter } from '../server/shared';
6
+ type Normalized = ReturnType<typeof normalizePostPurchaseProduct>;
7
+ type Line = {
8
+ sellingPlanId?: number;
9
+ variantId: number;
10
+ };
11
+ /** Switch to subscription (STS; merchant setting `upgradeToSubscription`) is on when either configuration allows it. */
12
+ export declare const stsAllowed: ({ effective, original }: Pick<Normalized, "effective" | "original">) => boolean;
13
+ /**
14
+ * Legacy `getUtsEligibleProducts` plus `useShouldUpgradeToSubscriptionTrigger`: a product with selling-plan groups
15
+ * whose variant the buyer bought one-time. Four rules are deliberately stricter than legacy (Peter, 2026-10-09),
16
+ * so a Decision never names an STS it cannot prepare or refund exactly: (1) the variant is in stock and has a
17
+ * plan; (2) it sits on exactly one one-time line, since two make the refunded quantity ambiguous; (3) a grouped
18
+ * product is never an STS member; (4) the bound variant is the purchased line's, not the product's selected
19
+ * variant, and subscription is the only mode. The first such variant in catalog order wins, unless `variantId`
20
+ * names one.
21
+ */
22
+ export declare const postPurchaseStsLine: <T extends Line>(normalized: Normalized, product: Normalized["data"][number], lines: T[], variantId?: number) => {
23
+ data: {
24
+ variants: {
25
+ title: string;
26
+ compareAtPrice: string | null;
27
+ id: number;
28
+ inventoryManagement: string | null;
29
+ inventoryPolicy: string;
30
+ inventoryQuantity: number;
31
+ price: string;
32
+ productId: number;
33
+ imageId?: number | null | undefined;
34
+ option1?: unknown;
35
+ option2?: unknown;
36
+ option3?: unknown;
37
+ sellingPlanAllocations?: unknown;
38
+ }[];
39
+ title: string;
40
+ id: number;
41
+ productGroupVariants: unknown[];
42
+ sellingPlanGroups: {
43
+ requiresSellingPlan: boolean;
44
+ discountAmount?: unknown;
45
+ discountType?: unknown;
46
+ id?: unknown;
47
+ sellingPlans?: unknown;
48
+ }[];
49
+ image?: {
50
+ src: string;
51
+ } | null | undefined;
52
+ description?: string | null | undefined;
53
+ images?: {
54
+ id: number;
55
+ src: string;
56
+ alt?: string | undefined;
57
+ }[] | null | undefined;
58
+ metadata?: {
59
+ productQuantity?: number | undefined;
60
+ } | undefined;
61
+ metafields?: unknown;
62
+ options?: unknown;
63
+ selectedVariant?: unknown;
64
+ }[];
65
+ line: T;
66
+ } | undefined;
67
+ /**
68
+ * One STS member's view: the original line's variant at its whole quantity (Peter, 2026-10-01: a partial
69
+ * STS is not offered), with subscription the only mode because the one-time guard still refuses STS
70
+ * configurations. `sts` holds the server-private facts admission binds (Slice 73's `originalLine`).
71
+ */
72
+ export declare const preparePostPurchaseStsView: (widgetId: number, normalized: Normalized, product: Normalized["data"][number], context: PostPurchaseStsContext, requested: {
73
+ choice?: PostPurchaseChoice;
74
+ quantity?: number;
75
+ variantId?: number;
76
+ }, report?: Reporter) => {
77
+ quantity: PostPurchaseQuantity;
78
+ sts: {
79
+ emailRefundNotice: boolean;
80
+ originalLine: {
81
+ quantity: number;
82
+ variantId: number;
83
+ };
84
+ };
85
+ view: {
86
+ preparation: {
87
+ labels: {
88
+ declineAll: string;
89
+ free: string;
90
+ notAvailable: string;
91
+ payNow: string;
92
+ quantity: string;
93
+ recurringShipping: string;
94
+ recurringSubtotal: string;
95
+ save: string;
96
+ shipping: string;
97
+ subtotal: string;
98
+ taxes: string;
99
+ total: string;
100
+ };
101
+ product: {
102
+ title: string;
103
+ id: number;
104
+ variant: {
105
+ title: string;
106
+ compareAtPrice: string | null;
107
+ id: number;
108
+ price: string;
109
+ };
110
+ image?: {
111
+ src: string;
112
+ } | null | undefined;
113
+ description?: string | null | undefined;
114
+ };
115
+ selection: {
116
+ productId: number;
117
+ quantity: number;
118
+ variantId: number;
119
+ sellingPlanId?: number | undefined;
120
+ };
121
+ status: "prepared";
122
+ terms: {
123
+ discount: {
124
+ amount: number;
125
+ title: string;
126
+ type: "none" | "fixed_amount" | "percentage";
127
+ };
128
+ shipping: {
129
+ amount: number;
130
+ title: string;
131
+ type: "fixed_amount" | "free";
132
+ };
133
+ subscription?: {
134
+ initialShippingPrice: number;
135
+ intervalLabel: string;
136
+ name: string;
137
+ recurringShippingPrice: number;
138
+ shippingOption: {
139
+ presentmentTitle: string;
140
+ title: string;
141
+ };
142
+ adjustment?: {
143
+ amount: number;
144
+ type: "price" | "fixed_amount" | "percentage";
145
+ } | undefined;
146
+ } | undefined;
147
+ };
148
+ display: {
149
+ discountedFrom: "price" | "compare_at_price";
150
+ language: {
151
+ description: string;
152
+ descriptionEnabled: boolean;
153
+ };
154
+ primaryImage: {
155
+ description: string;
156
+ source: string;
157
+ };
158
+ productOptions: {
159
+ showShipping: boolean;
160
+ showSubtotal: boolean;
161
+ showTaxes: boolean;
162
+ showTotal: boolean;
163
+ showVariantSelectors: boolean;
164
+ showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
165
+ };
166
+ responseDescription: string;
167
+ reviews: {
168
+ color: string;
169
+ rating: number;
170
+ reviewCount: number;
171
+ reviewsPlural: string;
172
+ reviewsSingular: string;
173
+ size: "small" | "large" | "medium";
174
+ strokeColor: string;
175
+ strokeWidth: number;
176
+ } | null;
177
+ shouldShowSavingText: boolean;
178
+ description: string | null;
179
+ descriptionDocument?: {
180
+ attrs: {
181
+ blockSpacing?: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose" | undefined;
182
+ };
183
+ content: never[] | {
184
+ attrs: {
185
+ textAlign?: "start" | "center" | "end" | undefined;
186
+ };
187
+ content: never[] | {
188
+ text: string;
189
+ type: "text";
190
+ marks?: never[] | ({
191
+ type: "bold";
192
+ } | {
193
+ type: "italic";
194
+ } | {
195
+ attrs: {
196
+ class: string | null;
197
+ href: string;
198
+ rel: string;
199
+ target: string;
200
+ };
201
+ type: "link";
202
+ } | {
203
+ type: "strike";
204
+ } | {
205
+ attrs: {
206
+ color: "success" | "warning" | "critical" | "base" | "decorative" | "subdued" | "accent";
207
+ fontSize: "small" | "base" | "large" | "medium" | "extraSmall" | "extraLarge" | "heading";
208
+ };
209
+ type: "textStyle";
210
+ })[] | undefined;
211
+ }[];
212
+ type: "paragraph";
213
+ }[];
214
+ type: "doc";
215
+ } | undefined;
216
+ gallery?: {
217
+ images: {
218
+ description: string;
219
+ id: number;
220
+ source: string;
221
+ thumbnail: string;
222
+ }[];
223
+ hasMultiple?: boolean | undefined;
224
+ selectedImageId?: number | undefined;
225
+ } | undefined;
226
+ };
227
+ };
228
+ sections: {
229
+ alignment: {
230
+ horizontal: "start" | "center" | "end";
231
+ vertical: "top" | "middle" | "bottom";
232
+ };
233
+ border: {
234
+ radius: "small" | "none" | "base" | "large" | "fullyRounded";
235
+ style: "none" | "base" | "dotted" | "dashed";
236
+ width: "base" | "medium" | "thick";
237
+ };
238
+ direction: "columns" | "rows" | "grid";
239
+ padding: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose";
240
+ sectionId: string;
241
+ sections: never[] | import("..").CABSection[];
242
+ sectionType: "layout";
243
+ spacing: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose";
244
+ width: number;
245
+ editorMode: "checkoutExtension" | "postPurchaseOffer" | "thankYouPage" | "orderStatusPage" | "ordersIndexPage" | "customerProfilePage";
246
+ previewMode: boolean;
247
+ storeId: number | null;
248
+ targetArea: {
249
+ icon: string;
250
+ label: string;
251
+ width: string;
252
+ fill?: boolean | undefined;
253
+ flip?: "vertical" | "horizontal" | "both" | undefined;
254
+ } | null;
255
+ tracking: {
256
+ enableAttribution: boolean;
257
+ enableSource: boolean;
258
+ enableWidget: boolean;
259
+ };
260
+ type: "product" | "bundle_builder" | "cart" | "cart_subscription" | "dynamic_bundle" | "gift_with_purchase" | "placeholder" | "pre_purchase" | "product_addon" | "product_upsell" | "recharge_checkout" | "recharge_customer_portal" | "recharge_post_purchase" | "shopify_checkout" | "shopify_checkout_extension" | "shopify_post_purchase" | "shopify_post_purchase_extension" | "switch_to_subscription" | "ui_extension_ad" | "ui_extension_button" | "ui_extension_content_block" | "ui_extension_line_item_editor" | "ui_extension_progress_bar";
261
+ uiLabels: {
262
+ currentPage: Record<string, string>;
263
+ guest: Record<string, string>;
264
+ loadingOptions: Record<string, string>;
265
+ nextPage: Record<string, string>;
266
+ offerCarousel: Record<string, string>;
267
+ offerDialog: Record<string, string>;
268
+ page: Record<string, string>;
269
+ previousPage: Record<string, string>;
270
+ selected: Record<string, string>;
271
+ subscriptionOptions: Record<string, string>;
272
+ updating: Record<string, string>;
273
+ };
274
+ version: 2;
275
+ widgetId: number | null;
276
+ buttonField?: "declineAllOffers" | "declineOffer" | "removeFromOrder" | "undoAddToOrder" | "activePage" | "addedToCart" | "addingToCart" | "addToCart" | "buttonLabel" | "destinationUrl" | "inactivePage" | "overlayContent" | "payNow" | "progressReached" | "progressRemaining" | "redirectToCheckout" | "showVariant" | "showVariants" | "soldOut" | "subscriptionOption" | "switchToOneTimePurchase" | "switchToSubscriptionNoDiscount" | "switchToSubscriptionWithDiscount" | undefined;
277
+ frame?: "callout" | "offer-content" | undefined;
278
+ grid?: {
279
+ columns: (string | number)[];
280
+ rows: (string | number)[];
281
+ } | undefined;
282
+ name?: string | undefined;
283
+ viewUrl?: string | undefined;
284
+ wrapping?: {
285
+ breakAt: number;
286
+ maxPerLine: number;
287
+ } | undefined;
288
+ mutators?: {
289
+ effect: "set_false" | "set_true" | "toggle";
290
+ variable: string;
291
+ when: {
292
+ operator: "is_empty" | "is_not_empty";
293
+ type: "content";
294
+ } | {
295
+ operator: "equals" | "greater_than" | "less_than";
296
+ type: "result_count";
297
+ value: number;
298
+ } | {
299
+ operator: "contains" | "does_not_contain";
300
+ type: "result_tag";
301
+ value: string;
302
+ } | {
303
+ event: "item_added" | "quantity_changed" | "variant_selected";
304
+ type: "event";
305
+ };
306
+ }[] | undefined;
307
+ variables?: ({
308
+ defaultValue: string;
309
+ name: string;
310
+ type: "text";
311
+ seed?: undefined;
312
+ } | {
313
+ defaultValue: number;
314
+ name: string;
315
+ type: "number";
316
+ seed?: undefined;
317
+ } | {
318
+ defaultValue: boolean;
319
+ name: string;
320
+ type: "boolean";
321
+ seed?: {
322
+ dataSourceId: number | null;
323
+ ruleset: {
324
+ exitIfMatched: boolean;
325
+ logic: {
326
+ rules: {
327
+ operator: "equals" | "greater_than" | "less_than" | "contains" | "does_not_contain" | "after" | "anything" | "before" | "contains_any" | "does_not_contain_any" | "does_not_equal";
328
+ products: never[] | unknown[];
329
+ type: "product" | "date" | "cart" | "cart_count" | "cart_item_count" | "cart_line_count" | "cart_subtotal" | "collection" | "customer" | "customer_order_count" | "customer_tag" | "customer_total_spent" | "product_tag" | "product_title" | "product_type" | "product_vendor";
330
+ value: string;
331
+ }[];
332
+ }[];
333
+ output: {
334
+ key: string;
335
+ type: "data_json";
336
+ value: string;
337
+ }[];
338
+ }[];
339
+ } | undefined;
340
+ })[] | undefined;
341
+ visibility?: {
342
+ variable: string;
343
+ visibleWhen: boolean;
344
+ } | undefined;
345
+ experiment?: {
346
+ elementId: number;
347
+ experimentId: number;
348
+ experimentType: string;
349
+ selectedId: number;
350
+ } | undefined;
351
+ };
352
+ changeset?: {
353
+ changes: ({
354
+ quantity: number;
355
+ type: "add_variant";
356
+ variantId: number;
357
+ discount?: {
358
+ title: string;
359
+ value: number;
360
+ valueType: "fixed_amount" | "percentage";
361
+ } | undefined;
362
+ } | {
363
+ price: number;
364
+ title: string;
365
+ type: "add_shipping_line";
366
+ } | {
367
+ initialShippingPrice: number;
368
+ recurringShippingPrice: number;
369
+ shippingOption: {
370
+ presentmentTitle: string;
371
+ title: string;
372
+ };
373
+ quantity: number;
374
+ sellingPlanId: number;
375
+ type: "add_subscription";
376
+ variantId: number;
377
+ discount?: {
378
+ title: string;
379
+ value: number;
380
+ valueType: "fixed_amount" | "percentage";
381
+ } | undefined;
382
+ })[];
383
+ } | undefined;
384
+ displayPrice?: {
385
+ currencyCode: string;
386
+ savingFormat: "amount" | "percent" | null;
387
+ savingMinor: number;
388
+ savingPercent: number;
389
+ variantCompareAtPriceMinor: number | null;
390
+ variantPriceMinor: number;
391
+ subscriptionUnit?: {
392
+ comparisonMinor: number;
393
+ currencyCode: string;
394
+ priceMinor: number;
395
+ savingMinor: number;
396
+ savingPercent: number;
397
+ } | undefined;
398
+ } | undefined;
399
+ groupCatalog?: {
400
+ memberProductId: number;
401
+ options: {
402
+ productId: number;
403
+ title: string;
404
+ variantCatalog: {
405
+ displayMode: "single" | "separate";
406
+ options: {
407
+ name: string;
408
+ values: string[];
409
+ position: number;
410
+ id?: number | undefined;
411
+ }[];
412
+ productId: number;
413
+ showSelectors: boolean;
414
+ variants: {
415
+ available: boolean;
416
+ id: number;
417
+ title: string;
418
+ option1?: string | undefined;
419
+ option2?: string | null | undefined;
420
+ option3?: string | null | undefined;
421
+ imageId?: number | null | undefined;
422
+ }[];
423
+ };
424
+ }[];
425
+ } | undefined;
426
+ initialVariant?: {
427
+ variantId: number;
428
+ } | undefined;
429
+ planCatalog?: {
430
+ plans: {
431
+ id: number;
432
+ intervalLabel: string;
433
+ name: string;
434
+ adjustment?: {
435
+ amount: number;
436
+ type: "price" | "fixed_amount" | "percentage";
437
+ } | undefined;
438
+ discountPercentage?: number | undefined;
439
+ intervalFrequency?: string | undefined;
440
+ }[];
441
+ productId: number;
442
+ requiresSellingPlan: boolean;
443
+ variantId: number;
444
+ } | null | undefined;
445
+ purchaseOptions?: {
446
+ defaultChoice: {
447
+ mode: "one-time";
448
+ } | {
449
+ mode: "subscription";
450
+ sellingPlanId: number;
451
+ };
452
+ modes: ("one-time" | "subscription")[];
453
+ selector: "radio" | "dropdown";
454
+ } | undefined;
455
+ variantCatalog?: {
456
+ displayMode: "single" | "separate";
457
+ options: {
458
+ name: string;
459
+ values: string[];
460
+ position: number;
461
+ id?: number | undefined;
462
+ }[];
463
+ productId: number;
464
+ showSelectors: boolean;
465
+ variants: {
466
+ available: boolean;
467
+ id: number;
468
+ title: string;
469
+ option1?: string | undefined;
470
+ option2?: string | null | undefined;
471
+ option3?: string | null | undefined;
472
+ imageId?: number | null | undefined;
473
+ }[];
474
+ } | undefined;
475
+ } | {
476
+ preparation: {
477
+ reason: string;
478
+ status: "unsupported";
479
+ };
480
+ sections: {
481
+ alignment: {
482
+ horizontal: "start" | "center" | "end";
483
+ vertical: "top" | "middle" | "bottom";
484
+ };
485
+ border: {
486
+ radius: "small" | "none" | "base" | "large" | "fullyRounded";
487
+ style: "none" | "base" | "dotted" | "dashed";
488
+ width: "base" | "medium" | "thick";
489
+ };
490
+ direction: "columns" | "rows" | "grid";
491
+ padding: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose";
492
+ sectionId: string;
493
+ sections: never[] | import("..").CABSection[];
494
+ sectionType: "layout";
495
+ spacing: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose";
496
+ width: number;
497
+ editorMode: "checkoutExtension" | "postPurchaseOffer" | "thankYouPage" | "orderStatusPage" | "ordersIndexPage" | "customerProfilePage";
498
+ previewMode: boolean;
499
+ storeId: number | null;
500
+ targetArea: {
501
+ icon: string;
502
+ label: string;
503
+ width: string;
504
+ fill?: boolean | undefined;
505
+ flip?: "vertical" | "horizontal" | "both" | undefined;
506
+ } | null;
507
+ tracking: {
508
+ enableAttribution: boolean;
509
+ enableSource: boolean;
510
+ enableWidget: boolean;
511
+ };
512
+ type: "product" | "bundle_builder" | "cart" | "cart_subscription" | "dynamic_bundle" | "gift_with_purchase" | "placeholder" | "pre_purchase" | "product_addon" | "product_upsell" | "recharge_checkout" | "recharge_customer_portal" | "recharge_post_purchase" | "shopify_checkout" | "shopify_checkout_extension" | "shopify_post_purchase" | "shopify_post_purchase_extension" | "switch_to_subscription" | "ui_extension_ad" | "ui_extension_button" | "ui_extension_content_block" | "ui_extension_line_item_editor" | "ui_extension_progress_bar";
513
+ uiLabels: {
514
+ currentPage: Record<string, string>;
515
+ guest: Record<string, string>;
516
+ loadingOptions: Record<string, string>;
517
+ nextPage: Record<string, string>;
518
+ offerCarousel: Record<string, string>;
519
+ offerDialog: Record<string, string>;
520
+ page: Record<string, string>;
521
+ previousPage: Record<string, string>;
522
+ selected: Record<string, string>;
523
+ subscriptionOptions: Record<string, string>;
524
+ updating: Record<string, string>;
525
+ };
526
+ version: 2;
527
+ widgetId: number | null;
528
+ buttonField?: "declineAllOffers" | "declineOffer" | "removeFromOrder" | "undoAddToOrder" | "activePage" | "addedToCart" | "addingToCart" | "addToCart" | "buttonLabel" | "destinationUrl" | "inactivePage" | "overlayContent" | "payNow" | "progressReached" | "progressRemaining" | "redirectToCheckout" | "showVariant" | "showVariants" | "soldOut" | "subscriptionOption" | "switchToOneTimePurchase" | "switchToSubscriptionNoDiscount" | "switchToSubscriptionWithDiscount" | undefined;
529
+ frame?: "callout" | "offer-content" | undefined;
530
+ grid?: {
531
+ columns: (string | number)[];
532
+ rows: (string | number)[];
533
+ } | undefined;
534
+ name?: string | undefined;
535
+ viewUrl?: string | undefined;
536
+ wrapping?: {
537
+ breakAt: number;
538
+ maxPerLine: number;
539
+ } | undefined;
540
+ mutators?: {
541
+ effect: "set_false" | "set_true" | "toggle";
542
+ variable: string;
543
+ when: {
544
+ operator: "is_empty" | "is_not_empty";
545
+ type: "content";
546
+ } | {
547
+ operator: "equals" | "greater_than" | "less_than";
548
+ type: "result_count";
549
+ value: number;
550
+ } | {
551
+ operator: "contains" | "does_not_contain";
552
+ type: "result_tag";
553
+ value: string;
554
+ } | {
555
+ event: "item_added" | "quantity_changed" | "variant_selected";
556
+ type: "event";
557
+ };
558
+ }[] | undefined;
559
+ variables?: ({
560
+ defaultValue: string;
561
+ name: string;
562
+ type: "text";
563
+ seed?: undefined;
564
+ } | {
565
+ defaultValue: number;
566
+ name: string;
567
+ type: "number";
568
+ seed?: undefined;
569
+ } | {
570
+ defaultValue: boolean;
571
+ name: string;
572
+ type: "boolean";
573
+ seed?: {
574
+ dataSourceId: number | null;
575
+ ruleset: {
576
+ exitIfMatched: boolean;
577
+ logic: {
578
+ rules: {
579
+ operator: "equals" | "greater_than" | "less_than" | "contains" | "does_not_contain" | "after" | "anything" | "before" | "contains_any" | "does_not_contain_any" | "does_not_equal";
580
+ products: never[] | unknown[];
581
+ type: "product" | "date" | "cart" | "cart_count" | "cart_item_count" | "cart_line_count" | "cart_subtotal" | "collection" | "customer" | "customer_order_count" | "customer_tag" | "customer_total_spent" | "product_tag" | "product_title" | "product_type" | "product_vendor";
582
+ value: string;
583
+ }[];
584
+ }[];
585
+ output: {
586
+ key: string;
587
+ type: "data_json";
588
+ value: string;
589
+ }[];
590
+ }[];
591
+ } | undefined;
592
+ })[] | undefined;
593
+ visibility?: {
594
+ variable: string;
595
+ visibleWhen: boolean;
596
+ } | undefined;
597
+ experiment?: {
598
+ elementId: number;
599
+ experimentId: number;
600
+ experimentType: string;
601
+ selectedId: number;
602
+ } | undefined;
603
+ } | null;
604
+ groupCatalog?: {
605
+ memberProductId: number;
606
+ options: {
607
+ productId: number;
608
+ title: string;
609
+ variantCatalog: {
610
+ displayMode: "single" | "separate";
611
+ options: {
612
+ name: string;
613
+ values: string[];
614
+ position: number;
615
+ id?: number | undefined;
616
+ }[];
617
+ productId: number;
618
+ showSelectors: boolean;
619
+ variants: {
620
+ available: boolean;
621
+ id: number;
622
+ title: string;
623
+ option1?: string | undefined;
624
+ option2?: string | null | undefined;
625
+ option3?: string | null | undefined;
626
+ imageId?: number | null | undefined;
627
+ }[];
628
+ };
629
+ }[];
630
+ } | undefined;
631
+ initialVariant?: {
632
+ variantId: number;
633
+ } | undefined;
634
+ labels?: {
635
+ notAvailable: string;
636
+ } | undefined;
637
+ planCatalog?: {
638
+ plans: {
639
+ id: number;
640
+ intervalLabel: string;
641
+ name: string;
642
+ adjustment?: {
643
+ amount: number;
644
+ type: "price" | "fixed_amount" | "percentage";
645
+ } | undefined;
646
+ discountPercentage?: number | undefined;
647
+ intervalFrequency?: string | undefined;
648
+ }[];
649
+ productId: number;
650
+ requiresSellingPlan: boolean;
651
+ variantId: number;
652
+ } | null | undefined;
653
+ purchaseOptions?: {
654
+ defaultChoice: {
655
+ mode: "one-time";
656
+ } | {
657
+ mode: "subscription";
658
+ sellingPlanId: number;
659
+ };
660
+ modes: ("one-time" | "subscription")[];
661
+ selector: "radio" | "dropdown";
662
+ } | undefined;
663
+ variantCatalog?: {
664
+ displayMode: "single" | "separate";
665
+ options: {
666
+ name: string;
667
+ values: string[];
668
+ position: number;
669
+ id?: number | undefined;
670
+ }[];
671
+ productId: number;
672
+ showSelectors: boolean;
673
+ variants: {
674
+ available: boolean;
675
+ id: number;
676
+ title: string;
677
+ option1?: string | undefined;
678
+ option2?: string | null | undefined;
679
+ option3?: string | null | undefined;
680
+ imageId?: number | null | undefined;
681
+ }[];
682
+ } | undefined;
683
+ };
684
+ } | null;
685
+ /** A collection's STS member, or `null` when the product switches no original line. */
686
+ export declare const prepareStsCollectionMember: (widgetId: number, normalized: Normalized, { product, productIndex }: {
687
+ product: Normalized["data"][number];
688
+ productIndex: number;
689
+ }, context: PostPurchaseStsContext, choice?: PostPurchaseChoice, report?: Reporter) => {
690
+ productId: number;
691
+ productIndex: number;
692
+ reportingProduct: undefined;
693
+ view: {
694
+ preparation: {
695
+ labels: {
696
+ declineAll: string;
697
+ free: string;
698
+ notAvailable: string;
699
+ payNow: string;
700
+ quantity: string;
701
+ recurringShipping: string;
702
+ recurringSubtotal: string;
703
+ save: string;
704
+ shipping: string;
705
+ subtotal: string;
706
+ taxes: string;
707
+ total: string;
708
+ };
709
+ product: {
710
+ title: string;
711
+ id: number;
712
+ variant: {
713
+ title: string;
714
+ compareAtPrice: string | null;
715
+ id: number;
716
+ price: string;
717
+ };
718
+ image?: {
719
+ src: string;
720
+ } | null | undefined;
721
+ description?: string | null | undefined;
722
+ };
723
+ selection: {
724
+ productId: number;
725
+ quantity: number;
726
+ variantId: number;
727
+ sellingPlanId?: number | undefined;
728
+ };
729
+ status: "prepared";
730
+ terms: {
731
+ discount: {
732
+ amount: number;
733
+ title: string;
734
+ type: "none" | "fixed_amount" | "percentage";
735
+ };
736
+ shipping: {
737
+ amount: number;
738
+ title: string;
739
+ type: "fixed_amount" | "free";
740
+ };
741
+ subscription?: {
742
+ initialShippingPrice: number;
743
+ intervalLabel: string;
744
+ name: string;
745
+ recurringShippingPrice: number;
746
+ shippingOption: {
747
+ presentmentTitle: string;
748
+ title: string;
749
+ };
750
+ adjustment?: {
751
+ amount: number;
752
+ type: "price" | "fixed_amount" | "percentage";
753
+ } | undefined;
754
+ } | undefined;
755
+ };
756
+ display: {
757
+ discountedFrom: "price" | "compare_at_price";
758
+ language: {
759
+ description: string;
760
+ descriptionEnabled: boolean;
761
+ };
762
+ primaryImage: {
763
+ description: string;
764
+ source: string;
765
+ };
766
+ productOptions: {
767
+ showShipping: boolean;
768
+ showSubtotal: boolean;
769
+ showTaxes: boolean;
770
+ showTotal: boolean;
771
+ showVariantSelectors: boolean;
772
+ showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
773
+ };
774
+ responseDescription: string;
775
+ reviews: {
776
+ color: string;
777
+ rating: number;
778
+ reviewCount: number;
779
+ reviewsPlural: string;
780
+ reviewsSingular: string;
781
+ size: "small" | "large" | "medium";
782
+ strokeColor: string;
783
+ strokeWidth: number;
784
+ } | null;
785
+ shouldShowSavingText: boolean;
786
+ description: string | null;
787
+ descriptionDocument?: {
788
+ attrs: {
789
+ blockSpacing?: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose" | undefined;
790
+ };
791
+ content: never[] | {
792
+ attrs: {
793
+ textAlign?: "start" | "center" | "end" | undefined;
794
+ };
795
+ content: never[] | {
796
+ text: string;
797
+ type: "text";
798
+ marks?: never[] | ({
799
+ type: "bold";
800
+ } | {
801
+ type: "italic";
802
+ } | {
803
+ attrs: {
804
+ class: string | null;
805
+ href: string;
806
+ rel: string;
807
+ target: string;
808
+ };
809
+ type: "link";
810
+ } | {
811
+ type: "strike";
812
+ } | {
813
+ attrs: {
814
+ color: "success" | "warning" | "critical" | "base" | "decorative" | "subdued" | "accent";
815
+ fontSize: "small" | "base" | "large" | "medium" | "extraSmall" | "extraLarge" | "heading";
816
+ };
817
+ type: "textStyle";
818
+ })[] | undefined;
819
+ }[];
820
+ type: "paragraph";
821
+ }[];
822
+ type: "doc";
823
+ } | undefined;
824
+ gallery?: {
825
+ images: {
826
+ description: string;
827
+ id: number;
828
+ source: string;
829
+ thumbnail: string;
830
+ }[];
831
+ hasMultiple?: boolean | undefined;
832
+ selectedImageId?: number | undefined;
833
+ } | undefined;
834
+ };
835
+ };
836
+ sections: {
837
+ alignment: {
838
+ horizontal: "start" | "center" | "end";
839
+ vertical: "top" | "middle" | "bottom";
840
+ };
841
+ border: {
842
+ radius: "small" | "none" | "base" | "large" | "fullyRounded";
843
+ style: "none" | "base" | "dotted" | "dashed";
844
+ width: "base" | "medium" | "thick";
845
+ };
846
+ direction: "columns" | "rows" | "grid";
847
+ padding: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose";
848
+ sectionId: string;
849
+ sections: never[] | import("..").CABSection[];
850
+ sectionType: "layout";
851
+ spacing: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose";
852
+ width: number;
853
+ editorMode: "checkoutExtension" | "postPurchaseOffer" | "thankYouPage" | "orderStatusPage" | "ordersIndexPage" | "customerProfilePage";
854
+ previewMode: boolean;
855
+ storeId: number | null;
856
+ targetArea: {
857
+ icon: string;
858
+ label: string;
859
+ width: string;
860
+ fill?: boolean | undefined;
861
+ flip?: "vertical" | "horizontal" | "both" | undefined;
862
+ } | null;
863
+ tracking: {
864
+ enableAttribution: boolean;
865
+ enableSource: boolean;
866
+ enableWidget: boolean;
867
+ };
868
+ type: "product" | "bundle_builder" | "cart" | "cart_subscription" | "dynamic_bundle" | "gift_with_purchase" | "placeholder" | "pre_purchase" | "product_addon" | "product_upsell" | "recharge_checkout" | "recharge_customer_portal" | "recharge_post_purchase" | "shopify_checkout" | "shopify_checkout_extension" | "shopify_post_purchase" | "shopify_post_purchase_extension" | "switch_to_subscription" | "ui_extension_ad" | "ui_extension_button" | "ui_extension_content_block" | "ui_extension_line_item_editor" | "ui_extension_progress_bar";
869
+ uiLabels: {
870
+ currentPage: Record<string, string>;
871
+ guest: Record<string, string>;
872
+ loadingOptions: Record<string, string>;
873
+ nextPage: Record<string, string>;
874
+ offerCarousel: Record<string, string>;
875
+ offerDialog: Record<string, string>;
876
+ page: Record<string, string>;
877
+ previousPage: Record<string, string>;
878
+ selected: Record<string, string>;
879
+ subscriptionOptions: Record<string, string>;
880
+ updating: Record<string, string>;
881
+ };
882
+ version: 2;
883
+ widgetId: number | null;
884
+ buttonField?: "declineAllOffers" | "declineOffer" | "removeFromOrder" | "undoAddToOrder" | "activePage" | "addedToCart" | "addingToCart" | "addToCart" | "buttonLabel" | "destinationUrl" | "inactivePage" | "overlayContent" | "payNow" | "progressReached" | "progressRemaining" | "redirectToCheckout" | "showVariant" | "showVariants" | "soldOut" | "subscriptionOption" | "switchToOneTimePurchase" | "switchToSubscriptionNoDiscount" | "switchToSubscriptionWithDiscount" | undefined;
885
+ frame?: "callout" | "offer-content" | undefined;
886
+ grid?: {
887
+ columns: (string | number)[];
888
+ rows: (string | number)[];
889
+ } | undefined;
890
+ name?: string | undefined;
891
+ viewUrl?: string | undefined;
892
+ wrapping?: {
893
+ breakAt: number;
894
+ maxPerLine: number;
895
+ } | undefined;
896
+ mutators?: {
897
+ effect: "set_false" | "set_true" | "toggle";
898
+ variable: string;
899
+ when: {
900
+ operator: "is_empty" | "is_not_empty";
901
+ type: "content";
902
+ } | {
903
+ operator: "equals" | "greater_than" | "less_than";
904
+ type: "result_count";
905
+ value: number;
906
+ } | {
907
+ operator: "contains" | "does_not_contain";
908
+ type: "result_tag";
909
+ value: string;
910
+ } | {
911
+ event: "item_added" | "quantity_changed" | "variant_selected";
912
+ type: "event";
913
+ };
914
+ }[] | undefined;
915
+ variables?: ({
916
+ defaultValue: string;
917
+ name: string;
918
+ type: "text";
919
+ seed?: undefined;
920
+ } | {
921
+ defaultValue: number;
922
+ name: string;
923
+ type: "number";
924
+ seed?: undefined;
925
+ } | {
926
+ defaultValue: boolean;
927
+ name: string;
928
+ type: "boolean";
929
+ seed?: {
930
+ dataSourceId: number | null;
931
+ ruleset: {
932
+ exitIfMatched: boolean;
933
+ logic: {
934
+ rules: {
935
+ operator: "equals" | "greater_than" | "less_than" | "contains" | "does_not_contain" | "after" | "anything" | "before" | "contains_any" | "does_not_contain_any" | "does_not_equal";
936
+ products: never[] | unknown[];
937
+ type: "product" | "date" | "cart" | "cart_count" | "cart_item_count" | "cart_line_count" | "cart_subtotal" | "collection" | "customer" | "customer_order_count" | "customer_tag" | "customer_total_spent" | "product_tag" | "product_title" | "product_type" | "product_vendor";
938
+ value: string;
939
+ }[];
940
+ }[];
941
+ output: {
942
+ key: string;
943
+ type: "data_json";
944
+ value: string;
945
+ }[];
946
+ }[];
947
+ } | undefined;
948
+ })[] | undefined;
949
+ visibility?: {
950
+ variable: string;
951
+ visibleWhen: boolean;
952
+ } | undefined;
953
+ experiment?: {
954
+ elementId: number;
955
+ experimentId: number;
956
+ experimentType: string;
957
+ selectedId: number;
958
+ } | undefined;
959
+ };
960
+ changeset?: {
961
+ changes: ({
962
+ quantity: number;
963
+ type: "add_variant";
964
+ variantId: number;
965
+ discount?: {
966
+ title: string;
967
+ value: number;
968
+ valueType: "fixed_amount" | "percentage";
969
+ } | undefined;
970
+ } | {
971
+ price: number;
972
+ title: string;
973
+ type: "add_shipping_line";
974
+ } | {
975
+ initialShippingPrice: number;
976
+ recurringShippingPrice: number;
977
+ shippingOption: {
978
+ presentmentTitle: string;
979
+ title: string;
980
+ };
981
+ quantity: number;
982
+ sellingPlanId: number;
983
+ type: "add_subscription";
984
+ variantId: number;
985
+ discount?: {
986
+ title: string;
987
+ value: number;
988
+ valueType: "fixed_amount" | "percentage";
989
+ } | undefined;
990
+ })[];
991
+ } | undefined;
992
+ displayPrice?: {
993
+ currencyCode: string;
994
+ savingFormat: "amount" | "percent" | null;
995
+ savingMinor: number;
996
+ savingPercent: number;
997
+ variantCompareAtPriceMinor: number | null;
998
+ variantPriceMinor: number;
999
+ subscriptionUnit?: {
1000
+ comparisonMinor: number;
1001
+ currencyCode: string;
1002
+ priceMinor: number;
1003
+ savingMinor: number;
1004
+ savingPercent: number;
1005
+ } | undefined;
1006
+ } | undefined;
1007
+ groupCatalog?: {
1008
+ memberProductId: number;
1009
+ options: {
1010
+ productId: number;
1011
+ title: string;
1012
+ variantCatalog: {
1013
+ displayMode: "single" | "separate";
1014
+ options: {
1015
+ name: string;
1016
+ values: string[];
1017
+ position: number;
1018
+ id?: number | undefined;
1019
+ }[];
1020
+ productId: number;
1021
+ showSelectors: boolean;
1022
+ variants: {
1023
+ available: boolean;
1024
+ id: number;
1025
+ title: string;
1026
+ option1?: string | undefined;
1027
+ option2?: string | null | undefined;
1028
+ option3?: string | null | undefined;
1029
+ imageId?: number | null | undefined;
1030
+ }[];
1031
+ };
1032
+ }[];
1033
+ } | undefined;
1034
+ initialVariant?: {
1035
+ variantId: number;
1036
+ } | undefined;
1037
+ planCatalog?: {
1038
+ plans: {
1039
+ id: number;
1040
+ intervalLabel: string;
1041
+ name: string;
1042
+ adjustment?: {
1043
+ amount: number;
1044
+ type: "price" | "fixed_amount" | "percentage";
1045
+ } | undefined;
1046
+ discountPercentage?: number | undefined;
1047
+ intervalFrequency?: string | undefined;
1048
+ }[];
1049
+ productId: number;
1050
+ requiresSellingPlan: boolean;
1051
+ variantId: number;
1052
+ } | null | undefined;
1053
+ purchaseOptions?: {
1054
+ defaultChoice: {
1055
+ mode: "one-time";
1056
+ } | {
1057
+ mode: "subscription";
1058
+ sellingPlanId: number;
1059
+ };
1060
+ modes: ("one-time" | "subscription")[];
1061
+ selector: "radio" | "dropdown";
1062
+ } | undefined;
1063
+ variantCatalog?: {
1064
+ displayMode: "single" | "separate";
1065
+ options: {
1066
+ name: string;
1067
+ values: string[];
1068
+ position: number;
1069
+ id?: number | undefined;
1070
+ }[];
1071
+ productId: number;
1072
+ showSelectors: boolean;
1073
+ variants: {
1074
+ available: boolean;
1075
+ id: number;
1076
+ title: string;
1077
+ option1?: string | undefined;
1078
+ option2?: string | null | undefined;
1079
+ option3?: string | null | undefined;
1080
+ imageId?: number | null | undefined;
1081
+ }[];
1082
+ } | undefined;
1083
+ } | {
1084
+ preparation: {
1085
+ reason: string;
1086
+ status: "unsupported";
1087
+ };
1088
+ sections: {
1089
+ alignment: {
1090
+ horizontal: "start" | "center" | "end";
1091
+ vertical: "top" | "middle" | "bottom";
1092
+ };
1093
+ border: {
1094
+ radius: "small" | "none" | "base" | "large" | "fullyRounded";
1095
+ style: "none" | "base" | "dotted" | "dashed";
1096
+ width: "base" | "medium" | "thick";
1097
+ };
1098
+ direction: "columns" | "rows" | "grid";
1099
+ padding: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose";
1100
+ sectionId: string;
1101
+ sections: never[] | import("..").CABSection[];
1102
+ sectionType: "layout";
1103
+ spacing: "none" | "base" | "extraTight" | "tight" | "loose" | "extraLoose";
1104
+ width: number;
1105
+ editorMode: "checkoutExtension" | "postPurchaseOffer" | "thankYouPage" | "orderStatusPage" | "ordersIndexPage" | "customerProfilePage";
1106
+ previewMode: boolean;
1107
+ storeId: number | null;
1108
+ targetArea: {
1109
+ icon: string;
1110
+ label: string;
1111
+ width: string;
1112
+ fill?: boolean | undefined;
1113
+ flip?: "vertical" | "horizontal" | "both" | undefined;
1114
+ } | null;
1115
+ tracking: {
1116
+ enableAttribution: boolean;
1117
+ enableSource: boolean;
1118
+ enableWidget: boolean;
1119
+ };
1120
+ type: "product" | "bundle_builder" | "cart" | "cart_subscription" | "dynamic_bundle" | "gift_with_purchase" | "placeholder" | "pre_purchase" | "product_addon" | "product_upsell" | "recharge_checkout" | "recharge_customer_portal" | "recharge_post_purchase" | "shopify_checkout" | "shopify_checkout_extension" | "shopify_post_purchase" | "shopify_post_purchase_extension" | "switch_to_subscription" | "ui_extension_ad" | "ui_extension_button" | "ui_extension_content_block" | "ui_extension_line_item_editor" | "ui_extension_progress_bar";
1121
+ uiLabels: {
1122
+ currentPage: Record<string, string>;
1123
+ guest: Record<string, string>;
1124
+ loadingOptions: Record<string, string>;
1125
+ nextPage: Record<string, string>;
1126
+ offerCarousel: Record<string, string>;
1127
+ offerDialog: Record<string, string>;
1128
+ page: Record<string, string>;
1129
+ previousPage: Record<string, string>;
1130
+ selected: Record<string, string>;
1131
+ subscriptionOptions: Record<string, string>;
1132
+ updating: Record<string, string>;
1133
+ };
1134
+ version: 2;
1135
+ widgetId: number | null;
1136
+ buttonField?: "declineAllOffers" | "declineOffer" | "removeFromOrder" | "undoAddToOrder" | "activePage" | "addedToCart" | "addingToCart" | "addToCart" | "buttonLabel" | "destinationUrl" | "inactivePage" | "overlayContent" | "payNow" | "progressReached" | "progressRemaining" | "redirectToCheckout" | "showVariant" | "showVariants" | "soldOut" | "subscriptionOption" | "switchToOneTimePurchase" | "switchToSubscriptionNoDiscount" | "switchToSubscriptionWithDiscount" | undefined;
1137
+ frame?: "callout" | "offer-content" | undefined;
1138
+ grid?: {
1139
+ columns: (string | number)[];
1140
+ rows: (string | number)[];
1141
+ } | undefined;
1142
+ name?: string | undefined;
1143
+ viewUrl?: string | undefined;
1144
+ wrapping?: {
1145
+ breakAt: number;
1146
+ maxPerLine: number;
1147
+ } | undefined;
1148
+ mutators?: {
1149
+ effect: "set_false" | "set_true" | "toggle";
1150
+ variable: string;
1151
+ when: {
1152
+ operator: "is_empty" | "is_not_empty";
1153
+ type: "content";
1154
+ } | {
1155
+ operator: "equals" | "greater_than" | "less_than";
1156
+ type: "result_count";
1157
+ value: number;
1158
+ } | {
1159
+ operator: "contains" | "does_not_contain";
1160
+ type: "result_tag";
1161
+ value: string;
1162
+ } | {
1163
+ event: "item_added" | "quantity_changed" | "variant_selected";
1164
+ type: "event";
1165
+ };
1166
+ }[] | undefined;
1167
+ variables?: ({
1168
+ defaultValue: string;
1169
+ name: string;
1170
+ type: "text";
1171
+ seed?: undefined;
1172
+ } | {
1173
+ defaultValue: number;
1174
+ name: string;
1175
+ type: "number";
1176
+ seed?: undefined;
1177
+ } | {
1178
+ defaultValue: boolean;
1179
+ name: string;
1180
+ type: "boolean";
1181
+ seed?: {
1182
+ dataSourceId: number | null;
1183
+ ruleset: {
1184
+ exitIfMatched: boolean;
1185
+ logic: {
1186
+ rules: {
1187
+ operator: "equals" | "greater_than" | "less_than" | "contains" | "does_not_contain" | "after" | "anything" | "before" | "contains_any" | "does_not_contain_any" | "does_not_equal";
1188
+ products: never[] | unknown[];
1189
+ type: "product" | "date" | "cart" | "cart_count" | "cart_item_count" | "cart_line_count" | "cart_subtotal" | "collection" | "customer" | "customer_order_count" | "customer_tag" | "customer_total_spent" | "product_tag" | "product_title" | "product_type" | "product_vendor";
1190
+ value: string;
1191
+ }[];
1192
+ }[];
1193
+ output: {
1194
+ key: string;
1195
+ type: "data_json";
1196
+ value: string;
1197
+ }[];
1198
+ }[];
1199
+ } | undefined;
1200
+ })[] | undefined;
1201
+ visibility?: {
1202
+ variable: string;
1203
+ visibleWhen: boolean;
1204
+ } | undefined;
1205
+ experiment?: {
1206
+ elementId: number;
1207
+ experimentId: number;
1208
+ experimentType: string;
1209
+ selectedId: number;
1210
+ } | undefined;
1211
+ } | null;
1212
+ groupCatalog?: {
1213
+ memberProductId: number;
1214
+ options: {
1215
+ productId: number;
1216
+ title: string;
1217
+ variantCatalog: {
1218
+ displayMode: "single" | "separate";
1219
+ options: {
1220
+ name: string;
1221
+ values: string[];
1222
+ position: number;
1223
+ id?: number | undefined;
1224
+ }[];
1225
+ productId: number;
1226
+ showSelectors: boolean;
1227
+ variants: {
1228
+ available: boolean;
1229
+ id: number;
1230
+ title: string;
1231
+ option1?: string | undefined;
1232
+ option2?: string | null | undefined;
1233
+ option3?: string | null | undefined;
1234
+ imageId?: number | null | undefined;
1235
+ }[];
1236
+ };
1237
+ }[];
1238
+ } | undefined;
1239
+ initialVariant?: {
1240
+ variantId: number;
1241
+ } | undefined;
1242
+ labels?: {
1243
+ notAvailable: string;
1244
+ } | undefined;
1245
+ planCatalog?: {
1246
+ plans: {
1247
+ id: number;
1248
+ intervalLabel: string;
1249
+ name: string;
1250
+ adjustment?: {
1251
+ amount: number;
1252
+ type: "price" | "fixed_amount" | "percentage";
1253
+ } | undefined;
1254
+ discountPercentage?: number | undefined;
1255
+ intervalFrequency?: string | undefined;
1256
+ }[];
1257
+ productId: number;
1258
+ requiresSellingPlan: boolean;
1259
+ variantId: number;
1260
+ } | null | undefined;
1261
+ purchaseOptions?: {
1262
+ defaultChoice: {
1263
+ mode: "one-time";
1264
+ } | {
1265
+ mode: "subscription";
1266
+ sellingPlanId: number;
1267
+ };
1268
+ modes: ("one-time" | "subscription")[];
1269
+ selector: "radio" | "dropdown";
1270
+ } | undefined;
1271
+ variantCatalog?: {
1272
+ displayMode: "single" | "separate";
1273
+ options: {
1274
+ name: string;
1275
+ values: string[];
1276
+ position: number;
1277
+ id?: number | undefined;
1278
+ }[];
1279
+ productId: number;
1280
+ showSelectors: boolean;
1281
+ variants: {
1282
+ available: boolean;
1283
+ id: number;
1284
+ title: string;
1285
+ option1?: string | undefined;
1286
+ option2?: string | null | undefined;
1287
+ option3?: string | null | undefined;
1288
+ imageId?: number | null | undefined;
1289
+ }[];
1290
+ } | undefined;
1291
+ };
1292
+ } | null;
1293
+ export {};