@rebuy/rebuy 3.55.0 → 3.56.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.
Files changed (31) hide show
  1. package/dist/index.cjs +317 -273
  2. package/dist/index.mjs +317 -273
  3. package/dist/schema/index.d.ts +1 -0
  4. package/dist/schema/postPurchaseAdmission.d.ts +5 -5
  5. package/dist/schema/postPurchaseLedger.d.ts +56 -0
  6. package/dist/schema/postPurchaseProduct.d.ts +2 -0
  7. package/dist/schema/postPurchaseProductCollectionView.d.ts +3 -0
  8. package/dist/schema/postPurchaseProductView.d.ts +5 -1
  9. package/dist/schema/postPurchaseSession.d.ts +14 -0
  10. package/dist/schema/postPurchaseSubscription.d.ts +1 -0
  11. package/dist/schema/postPurchaseSubscriptionProduct.d.ts +2 -0
  12. package/dist/server/index.cjs +69 -23
  13. package/dist/server/index.mjs +69 -23
  14. package/dist/server/normalizePostPurchaseProduct.d.ts +16 -1
  15. package/dist/server/postPurchaseCardSections.d.ts +2 -2
  16. package/dist/server/postPurchaseSts.d.ts +6 -0
  17. package/dist/server/prepareNormalizedSubscription.d.ts +2 -1
  18. package/dist/server/preparePostPurchaseAdmissionView.d.ts +3 -0
  19. package/dist/server/preparePostPurchaseCollectionGroup.d.ts +3 -0
  20. package/dist/server/preparePostPurchaseCollectionView.d.ts +3 -0
  21. package/dist/server/preparePostPurchaseGroupAdmissionView.d.ts +3 -0
  22. package/dist/server/preparePostPurchaseGroupDefault.d.ts +3 -0
  23. package/dist/server/preparePostPurchaseGroupView.d.ts +3 -0
  24. package/dist/server/preparePostPurchaseMemberView.d.ts +12 -0
  25. package/dist/server/preparePostPurchaseQuantityAdmissionView.d.ts +3 -0
  26. package/dist/server/preparePostPurchaseQuantityView.d.ts +3 -0
  27. package/dist/server/preparePostPurchaseStsMember.d.ts +3 -0
  28. package/dist/server/preparePostPurchaseSubscription.d.ts +1 -0
  29. package/dist/transforms/index.cjs +17 -11
  30. package/dist/transforms/index.mjs +17 -11
  31. package/package.json +1 -1
@@ -257,7 +257,22 @@ export declare const normalizePostPurchaseSource: (settings: unknown, response:
257
257
  productIndex: number;
258
258
  }[];
259
259
  };
260
- /** Both prepared purchase terms and display structure consume this one effective configuration. */
260
+ /**
261
+ * `productLimit` caps raw positions: keep only the entries whose raw `productIndex` sits under the cap, so a
262
+ * product the schema dropped leaves its slot empty rather than promoting a survivor past the cap.
263
+ */
264
+ export declare const underPostPurchaseCap: <T extends {
265
+ productIndex: number;
266
+ }>(entries: T[], cap: number) => T[];
267
+ /**
268
+ * Both prepared purchase terms and display structure consume this one effective configuration. A product past
269
+ * the effective `productLimit` is never the one prepared: when no product under the cap survived salvage, `data`
270
+ * is empty (as the collection keeps no member), so `[bad, good]` with a limit of 1 prepares nothing. Otherwise
271
+ * `data` keeps every survivor, so a source with more than one readable product still reads as ambiguous rather
272
+ * than having products discarded. Each dropped product, past the cap or not, was already reported as drift.
273
+ * A limit under 1 is a configuration fault, not a cap: `data` stays whole so eligibility rejects it with the
274
+ * configuration reason instead of the catalog reporting drift for a readable product.
275
+ */
261
276
  export declare const normalizePostPurchaseProduct: (settings: unknown, response: unknown, report?: Reporter) => {
262
277
  data: {
263
278
  title: string;
@@ -2,9 +2,9 @@ import { normalizePostPurchaseProduct } from '../server/normalizePostPurchasePro
2
2
  import type { Reporter } from '../server/shared';
3
3
  /**
4
4
  * The product's section tree from the effective settings snapshot, or `null` unless it holds exactly one product
5
- * card. No product values enter the tree; the client resolves its tokens.
5
+ * card. No product values enter the tree; the client resolves its tokens. An STS card (`sts`) gets STS copy.
6
6
  */
7
- export declare const postPurchaseCardSections: (widgetId: number, { effective, metadata }: Pick<ReturnType<typeof normalizePostPurchaseProduct>, "effective" | "metadata">, report?: Reporter) => import("..").CABRootSection | null;
7
+ export declare const postPurchaseCardSections: (widgetId: number, { effective: configured, metadata, }: Pick<ReturnType<typeof normalizePostPurchaseProduct>, "effective" | "metadata">, report?: Reporter, sts?: boolean) => import("..").CABRootSection | null;
8
8
  /**
9
9
  * The same tree from the raw settings and data-source response, for a caller's own choice-level fallback — rebuy-api's
10
10
  * group default that resolves no available merchandise.
@@ -143,6 +143,7 @@ export declare const preparePostPurchaseStsView: (widgetId: number, normalized:
143
143
  amount: number;
144
144
  type: "price" | "fixed_amount" | "percentage";
145
145
  } | undefined;
146
+ sts?: true | undefined;
146
147
  } | undefined;
147
148
  };
148
149
  display: {
@@ -452,6 +453,7 @@ export declare const preparePostPurchaseStsView: (widgetId: number, normalized:
452
453
  modes: ("one-time" | "subscription")[];
453
454
  selector: "radio" | "dropdown";
454
455
  } | undefined;
456
+ sts?: true | undefined;
455
457
  variantCatalog?: {
456
458
  displayMode: "single" | "separate";
457
459
  options: {
@@ -660,6 +662,7 @@ export declare const preparePostPurchaseStsView: (widgetId: number, normalized:
660
662
  modes: ("one-time" | "subscription")[];
661
663
  selector: "radio" | "dropdown";
662
664
  } | undefined;
665
+ sts?: true | undefined;
663
666
  variantCatalog?: {
664
667
  displayMode: "single" | "separate";
665
668
  options: {
@@ -751,6 +754,7 @@ export declare const prepareStsCollectionMember: (widgetId: number, normalized:
751
754
  amount: number;
752
755
  type: "price" | "fixed_amount" | "percentage";
753
756
  } | undefined;
757
+ sts?: true | undefined;
754
758
  } | undefined;
755
759
  };
756
760
  display: {
@@ -1060,6 +1064,7 @@ export declare const prepareStsCollectionMember: (widgetId: number, normalized:
1060
1064
  modes: ("one-time" | "subscription")[];
1061
1065
  selector: "radio" | "dropdown";
1062
1066
  } | undefined;
1067
+ sts?: true | undefined;
1063
1068
  variantCatalog?: {
1064
1069
  displayMode: "single" | "separate";
1065
1070
  options: {
@@ -1268,6 +1273,7 @@ export declare const prepareStsCollectionMember: (widgetId: number, normalized:
1268
1273
  modes: ("one-time" | "subscription")[];
1269
1274
  selector: "radio" | "dropdown";
1270
1275
  } | undefined;
1276
+ sts?: true | undefined;
1271
1277
  variantCatalog?: {
1272
1278
  displayMode: "single" | "separate";
1273
1279
  options: {
@@ -5,6 +5,7 @@ import type { PostPurchaseQuantity } from '../server/readPostPurchaseQuantity';
5
5
  import type { Reporter } from '../server/shared';
6
6
  /**
7
7
  * Preparation for one allocated plan with validated configured shipping and discount; `report` receives
8
- * unreadable-review drift.
8
+ * unreadable-review drift. A switch to subscription (STS) charges no initial shipping, only the recurring
9
+ * shipping (legacy `useSubscriptionPurchaseOptions`, L112/L122).
9
10
  */
10
11
  export declare const prepareNormalizedSubscription: (normalized: ReturnType<typeof normalizePostPurchaseProduct>, report: Reporter | undefined, plan: PostPurchasePlanOption | undefined, quantity?: PostPurchaseQuantity, allowCollection?: boolean) => PostPurchasePreparation;
@@ -64,6 +64,7 @@ export declare const preparePostPurchaseAdmissionView: (widgetId: number, settin
64
64
  amount: number;
65
65
  type: "price" | "fixed_amount" | "percentage";
66
66
  } | undefined;
67
+ sts?: true | undefined;
67
68
  } | undefined;
68
69
  };
69
70
  display: {
@@ -373,6 +374,7 @@ export declare const preparePostPurchaseAdmissionView: (widgetId: number, settin
373
374
  modes: ("one-time" | "subscription")[];
374
375
  selector: "radio" | "dropdown";
375
376
  } | undefined;
377
+ sts?: true | undefined;
376
378
  variantCatalog?: {
377
379
  displayMode: "single" | "separate";
378
380
  options: {
@@ -581,6 +583,7 @@ export declare const preparePostPurchaseAdmissionView: (widgetId: number, settin
581
583
  modes: ("one-time" | "subscription")[];
582
584
  selector: "radio" | "dropdown";
583
585
  } | undefined;
586
+ sts?: true | undefined;
584
587
  variantCatalog?: {
585
588
  displayMode: "single" | "separate";
586
589
  options: {
@@ -104,6 +104,7 @@ export declare const preparePostPurchaseCollectionGroup: (widgetId: number, sett
104
104
  amount: number;
105
105
  type: "price" | "fixed_amount" | "percentage";
106
106
  } | undefined;
107
+ sts?: true | undefined;
107
108
  } | undefined;
108
109
  };
109
110
  display: {
@@ -383,6 +384,7 @@ export declare const preparePostPurchaseCollectionGroup: (widgetId: number, sett
383
384
  modes: ("one-time" | "subscription")[];
384
385
  selector: "radio" | "dropdown";
385
386
  } | undefined;
387
+ sts?: true | undefined;
386
388
  variantCatalog?: {
387
389
  displayMode: "single" | "separate";
388
390
  options: {
@@ -592,6 +594,7 @@ export declare const preparePostPurchaseCollectionGroup: (widgetId: number, sett
592
594
  modes: ("one-time" | "subscription")[];
593
595
  selector: "radio" | "dropdown";
594
596
  } | undefined;
597
+ sts?: true | undefined;
595
598
  variantCatalog?: {
596
599
  displayMode: "single" | "separate";
597
600
  options: {
@@ -89,6 +89,7 @@ sts?: PostPurchaseStsContext) => {
89
89
  amount: number;
90
90
  type: "price" | "fixed_amount" | "percentage";
91
91
  } | undefined;
92
+ sts?: true | undefined;
92
93
  } | undefined;
93
94
  };
94
95
  display: {
@@ -398,6 +399,7 @@ sts?: PostPurchaseStsContext) => {
398
399
  modes: ("one-time" | "subscription")[];
399
400
  selector: "radio" | "dropdown";
400
401
  } | undefined;
402
+ sts?: true | undefined;
401
403
  variantCatalog?: {
402
404
  displayMode: "single" | "separate";
403
405
  options: {
@@ -606,6 +608,7 @@ sts?: PostPurchaseStsContext) => {
606
608
  modes: ("one-time" | "subscription")[];
607
609
  selector: "radio" | "dropdown";
608
610
  } | undefined;
611
+ sts?: true | undefined;
609
612
  variantCatalog?: {
610
613
  displayMode: "single" | "separate";
611
614
  options: {
@@ -112,6 +112,7 @@ export declare const preparePostPurchaseGroupAdmissionView: (widgetId: number, s
112
112
  amount: number;
113
113
  type: "price" | "fixed_amount" | "percentage";
114
114
  } | undefined;
115
+ sts?: true | undefined;
115
116
  } | undefined;
116
117
  };
117
118
  display: {
@@ -421,6 +422,7 @@ export declare const preparePostPurchaseGroupAdmissionView: (widgetId: number, s
421
422
  modes: ("one-time" | "subscription")[];
422
423
  selector: "radio" | "dropdown";
423
424
  } | undefined;
425
+ sts?: true | undefined;
424
426
  variantCatalog?: {
425
427
  displayMode: "single" | "separate";
426
428
  options: {
@@ -629,6 +631,7 @@ export declare const preparePostPurchaseGroupAdmissionView: (widgetId: number, s
629
631
  modes: ("one-time" | "subscription")[];
630
632
  selector: "radio" | "dropdown";
631
633
  } | undefined;
634
+ sts?: true | undefined;
632
635
  variantCatalog?: {
633
636
  displayMode: "single" | "separate";
634
637
  options: {
@@ -68,6 +68,7 @@ export declare const preparePostPurchaseGroupDefault: (widgetId: number, setting
68
68
  amount: number;
69
69
  type: "price" | "fixed_amount" | "percentage";
70
70
  } | undefined;
71
+ sts?: true | undefined;
71
72
  } | undefined;
72
73
  };
73
74
  display: {
@@ -374,6 +375,7 @@ export declare const preparePostPurchaseGroupDefault: (widgetId: number, setting
374
375
  modes: ("one-time" | "subscription")[];
375
376
  selector: "radio" | "dropdown";
376
377
  } | undefined;
378
+ sts?: true | undefined;
377
379
  variantCatalog?: {
378
380
  displayMode: "single" | "separate";
379
381
  options: {
@@ -582,6 +584,7 @@ export declare const preparePostPurchaseGroupDefault: (widgetId: number, setting
582
584
  modes: ("one-time" | "subscription")[];
583
585
  selector: "radio" | "dropdown";
584
586
  } | undefined;
587
+ sts?: true | undefined;
585
588
  variantCatalog?: {
586
589
  displayMode: "single" | "separate";
587
590
  options: {
@@ -111,6 +111,7 @@ export declare const preparePostPurchaseGroupView: (widgetId: number, settings:
111
111
  amount: number;
112
112
  type: "price" | "fixed_amount" | "percentage";
113
113
  } | undefined;
114
+ sts?: true | undefined;
114
115
  } | undefined;
115
116
  };
116
117
  display: {
@@ -420,6 +421,7 @@ export declare const preparePostPurchaseGroupView: (widgetId: number, settings:
420
421
  modes: ("one-time" | "subscription")[];
421
422
  selector: "radio" | "dropdown";
422
423
  } | undefined;
424
+ sts?: true | undefined;
423
425
  variantCatalog?: {
424
426
  displayMode: "single" | "separate";
425
427
  options: {
@@ -628,6 +630,7 @@ export declare const preparePostPurchaseGroupView: (widgetId: number, settings:
628
630
  modes: ("one-time" | "subscription")[];
629
631
  selector: "radio" | "dropdown";
630
632
  } | undefined;
633
+ sts?: true | undefined;
631
634
  variantCatalog?: {
632
635
  displayMode: "single" | "separate";
633
636
  options: {
@@ -68,6 +68,7 @@ export declare const prepareMember: (widgetId: number, settings: unknown, respon
68
68
  amount: number;
69
69
  type: "price" | "fixed_amount" | "percentage";
70
70
  } | undefined;
71
+ sts?: true | undefined;
71
72
  } | undefined;
72
73
  };
73
74
  display: {
@@ -377,6 +378,7 @@ export declare const prepareMember: (widgetId: number, settings: unknown, respon
377
378
  modes: ("one-time" | "subscription")[];
378
379
  selector: "radio" | "dropdown";
379
380
  } | undefined;
381
+ sts?: true | undefined;
380
382
  variantCatalog?: {
381
383
  displayMode: "single" | "separate";
382
384
  options: {
@@ -585,6 +587,7 @@ export declare const prepareMember: (widgetId: number, settings: unknown, respon
585
587
  modes: ("one-time" | "subscription")[];
586
588
  selector: "radio" | "dropdown";
587
589
  } | undefined;
590
+ sts?: true | undefined;
588
591
  variantCatalog?: {
589
592
  displayMode: "single" | "separate";
590
593
  options: {
@@ -881,6 +884,7 @@ export declare const prepareMember: (widgetId: number, settings: unknown, respon
881
884
  amount: number;
882
885
  type: "price" | "fixed_amount" | "percentage";
883
886
  } | undefined;
887
+ sts?: true | undefined;
884
888
  } | undefined;
885
889
  };
886
890
  display: {
@@ -1190,6 +1194,7 @@ export declare const prepareMember: (widgetId: number, settings: unknown, respon
1190
1194
  modes: ("one-time" | "subscription")[];
1191
1195
  selector: "radio" | "dropdown";
1192
1196
  } | undefined;
1197
+ sts?: true | undefined;
1193
1198
  variantCatalog?: {
1194
1199
  displayMode: "single" | "separate";
1195
1200
  options: {
@@ -1398,6 +1403,7 @@ export declare const prepareMember: (widgetId: number, settings: unknown, respon
1398
1403
  modes: ("one-time" | "subscription")[];
1399
1404
  selector: "radio" | "dropdown";
1400
1405
  } | undefined;
1406
+ sts?: true | undefined;
1401
1407
  variantCatalog?: {
1402
1408
  displayMode: "single" | "separate";
1403
1409
  options: {
@@ -1695,6 +1701,7 @@ export declare const preparePostPurchaseMemberView: (widgetId: number, settings:
1695
1701
  amount: number;
1696
1702
  type: "price" | "fixed_amount" | "percentage";
1697
1703
  } | undefined;
1704
+ sts?: true | undefined;
1698
1705
  } | undefined;
1699
1706
  };
1700
1707
  display: {
@@ -2004,6 +2011,7 @@ export declare const preparePostPurchaseMemberView: (widgetId: number, settings:
2004
2011
  modes: ("one-time" | "subscription")[];
2005
2012
  selector: "radio" | "dropdown";
2006
2013
  } | undefined;
2014
+ sts?: true | undefined;
2007
2015
  variantCatalog?: {
2008
2016
  displayMode: "single" | "separate";
2009
2017
  options: {
@@ -2212,6 +2220,7 @@ export declare const preparePostPurchaseMemberView: (widgetId: number, settings:
2212
2220
  modes: ("one-time" | "subscription")[];
2213
2221
  selector: "radio" | "dropdown";
2214
2222
  } | undefined;
2223
+ sts?: true | undefined;
2215
2224
  variantCatalog?: {
2216
2225
  displayMode: "single" | "separate";
2217
2226
  options: {
@@ -2300,6 +2309,7 @@ export declare const preparePostPurchaseMemberAdmissionView: (widgetId: number,
2300
2309
  amount: number;
2301
2310
  type: "price" | "fixed_amount" | "percentage";
2302
2311
  } | undefined;
2312
+ sts?: true | undefined;
2303
2313
  } | undefined;
2304
2314
  };
2305
2315
  display: {
@@ -2609,6 +2619,7 @@ export declare const preparePostPurchaseMemberAdmissionView: (widgetId: number,
2609
2619
  modes: ("one-time" | "subscription")[];
2610
2620
  selector: "radio" | "dropdown";
2611
2621
  } | undefined;
2622
+ sts?: true | undefined;
2612
2623
  variantCatalog?: {
2613
2624
  displayMode: "single" | "separate";
2614
2625
  options: {
@@ -2817,6 +2828,7 @@ export declare const preparePostPurchaseMemberAdmissionView: (widgetId: number,
2817
2828
  modes: ("one-time" | "subscription")[];
2818
2829
  selector: "radio" | "dropdown";
2819
2830
  } | undefined;
2831
+ sts?: true | undefined;
2820
2832
  variantCatalog?: {
2821
2833
  displayMode: "single" | "separate";
2822
2834
  options: {
@@ -95,6 +95,7 @@ sts?: PostPurchaseStsContext) => {
95
95
  amount: number;
96
96
  type: "price" | "fixed_amount" | "percentage";
97
97
  } | undefined;
98
+ sts?: true | undefined;
98
99
  } | undefined;
99
100
  };
100
101
  display: {
@@ -404,6 +405,7 @@ sts?: PostPurchaseStsContext) => {
404
405
  modes: ("one-time" | "subscription")[];
405
406
  selector: "radio" | "dropdown";
406
407
  } | undefined;
408
+ sts?: true | undefined;
407
409
  variantCatalog?: {
408
410
  displayMode: "single" | "separate";
409
411
  options: {
@@ -612,6 +614,7 @@ sts?: PostPurchaseStsContext) => {
612
614
  modes: ("one-time" | "subscription")[];
613
615
  selector: "radio" | "dropdown";
614
616
  } | undefined;
617
+ sts?: true | undefined;
615
618
  variantCatalog?: {
616
619
  displayMode: "single" | "separate";
617
620
  options: {
@@ -83,6 +83,7 @@ sts?: PostPurchaseStsContext) => {
83
83
  amount: number;
84
84
  type: "price" | "fixed_amount" | "percentage";
85
85
  } | undefined;
86
+ sts?: true | undefined;
86
87
  } | undefined;
87
88
  };
88
89
  display: {
@@ -392,6 +393,7 @@ sts?: PostPurchaseStsContext) => {
392
393
  modes: ("one-time" | "subscription")[];
393
394
  selector: "radio" | "dropdown";
394
395
  } | undefined;
396
+ sts?: true | undefined;
395
397
  variantCatalog?: {
396
398
  displayMode: "single" | "separate";
397
399
  options: {
@@ -600,6 +602,7 @@ sts?: PostPurchaseStsContext) => {
600
602
  modes: ("one-time" | "subscription")[];
601
603
  selector: "radio" | "dropdown";
602
604
  } | undefined;
605
+ sts?: true | undefined;
603
606
  variantCatalog?: {
604
607
  displayMode: "single" | "separate";
605
608
  options: {
@@ -73,6 +73,7 @@ export declare const preparePostPurchaseStsMember: (widgetId: number, settings:
73
73
  amount: number;
74
74
  type: "price" | "fixed_amount" | "percentage";
75
75
  } | undefined;
76
+ sts?: true | undefined;
76
77
  } | undefined;
77
78
  };
78
79
  display: {
@@ -382,6 +383,7 @@ export declare const preparePostPurchaseStsMember: (widgetId: number, settings:
382
383
  modes: ("one-time" | "subscription")[];
383
384
  selector: "radio" | "dropdown";
384
385
  } | undefined;
386
+ sts?: true | undefined;
385
387
  variantCatalog?: {
386
388
  displayMode: "single" | "separate";
387
389
  options: {
@@ -590,6 +592,7 @@ export declare const preparePostPurchaseStsMember: (widgetId: number, settings:
590
592
  modes: ("one-time" | "subscription")[];
591
593
  selector: "radio" | "dropdown";
592
594
  } | undefined;
595
+ sts?: true | undefined;
593
596
  variantCatalog?: {
594
597
  displayMode: "single" | "separate";
595
598
  options: {
@@ -138,6 +138,7 @@ export declare const preparePostPurchaseSubscription: (settings: unknown, respon
138
138
  amount: number;
139
139
  type: "price" | "fixed_amount" | "percentage";
140
140
  } | undefined;
141
+ sts?: true | undefined;
141
142
  } | undefined;
142
143
  };
143
144
  } | {
@@ -4441,9 +4441,11 @@ var HAS_RECURRING_TOTAL = "hasRecurringTotal";
4441
4441
  var HAS_RECURRING_SHIPPING = "hasRecurringShipping";
4442
4442
  var small = { color: "subdued", fontSize: "small" };
4443
4443
  var FOOTNOTES = ["Doesn't include tax, duties, or any applicable discounts.", "Auto-renews, skip or cancel anytime"];
4444
+ var countsRecurringShipping = ({ productType, upgradeToSubscription }) => productType === "subscription" && upgradeToSubscription.allow;
4444
4445
  var recurringSummary = (settings) => {
4445
4446
  if (!sellsSubscription(settings)) return [];
4446
4447
  const { global } = settings.language;
4448
+ const shipping = countsRecurringShipping(settings);
4447
4449
  return [
4448
4450
  {
4449
4451
  direction: "rows",
@@ -4454,18 +4456,20 @@ var recurringSummary = (settings) => {
4454
4456
  columns: ["fill", "auto", "auto"],
4455
4457
  label: merchantLabel(global.recurringSubtotal, "Recurring subtotal"),
4456
4458
  spacing: "extraTight",
4457
- token: "{{recurringTotal}}",
4459
+ token: shipping ? "{{recurringTotal}}" : "{{recurringSubtotal}}",
4458
4460
  variable: HAS_RECURRING_TOTAL
4459
4461
  }),
4460
- earnedRow({
4461
- after: "(included)",
4462
- columns: ["auto", "auto", "auto"],
4463
- label: { en: `${merchantLabel(global.recurringShipping, "Recurring shipping").en}:` },
4464
- look: small,
4465
- spacing: "extraTight",
4466
- token: "{{recurringShipping}}",
4467
- variable: HAS_RECURRING_SHIPPING
4468
- }),
4462
+ ...shipping ? [
4463
+ earnedRow({
4464
+ after: "(included)",
4465
+ columns: ["auto", "auto", "auto"],
4466
+ label: { en: `${merchantLabel(global.recurringShipping, "Recurring shipping").en}:` },
4467
+ look: small,
4468
+ spacing: "extraTight",
4469
+ token: "{{recurringShipping}}",
4470
+ variable: HAS_RECURRING_SHIPPING
4471
+ })
4472
+ ] : [],
4469
4473
  ...FOOTNOTES.map((text) => ({
4470
4474
  content: { en: styledCopy(text, small) },
4471
4475
  sectionType: "text",
@@ -4474,7 +4478,9 @@ var recurringSummary = (settings) => {
4474
4478
  ],
4475
4479
  sectionType: "layout",
4476
4480
  spacing: "tight",
4477
- variables: earnedVariables([HAS_RECURRING_TOTAL, HAS_RECURRING_SHIPPING])
4481
+ variables: earnedVariables(
4482
+ shipping ? [HAS_RECURRING_TOTAL, HAS_RECURRING_SHIPPING] : [HAS_RECURRING_TOTAL]
4483
+ )
4478
4484
  }
4479
4485
  ];
4480
4486
  };
@@ -4380,9 +4380,11 @@ var HAS_RECURRING_TOTAL = "hasRecurringTotal";
4380
4380
  var HAS_RECURRING_SHIPPING = "hasRecurringShipping";
4381
4381
  var small = { color: "subdued", fontSize: "small" };
4382
4382
  var FOOTNOTES = ["Doesn't include tax, duties, or any applicable discounts.", "Auto-renews, skip or cancel anytime"];
4383
+ var countsRecurringShipping = ({ productType, upgradeToSubscription }) => productType === "subscription" && upgradeToSubscription.allow;
4383
4384
  var recurringSummary = (settings) => {
4384
4385
  if (!sellsSubscription(settings)) return [];
4385
4386
  const { global } = settings.language;
4387
+ const shipping = countsRecurringShipping(settings);
4386
4388
  return [
4387
4389
  {
4388
4390
  direction: "rows",
@@ -4393,18 +4395,20 @@ var recurringSummary = (settings) => {
4393
4395
  columns: ["fill", "auto", "auto"],
4394
4396
  label: merchantLabel(global.recurringSubtotal, "Recurring subtotal"),
4395
4397
  spacing: "extraTight",
4396
- token: "{{recurringTotal}}",
4398
+ token: shipping ? "{{recurringTotal}}" : "{{recurringSubtotal}}",
4397
4399
  variable: HAS_RECURRING_TOTAL
4398
4400
  }),
4399
- earnedRow({
4400
- after: "(included)",
4401
- columns: ["auto", "auto", "auto"],
4402
- label: { en: `${merchantLabel(global.recurringShipping, "Recurring shipping").en}:` },
4403
- look: small,
4404
- spacing: "extraTight",
4405
- token: "{{recurringShipping}}",
4406
- variable: HAS_RECURRING_SHIPPING
4407
- }),
4401
+ ...shipping ? [
4402
+ earnedRow({
4403
+ after: "(included)",
4404
+ columns: ["auto", "auto", "auto"],
4405
+ label: { en: `${merchantLabel(global.recurringShipping, "Recurring shipping").en}:` },
4406
+ look: small,
4407
+ spacing: "extraTight",
4408
+ token: "{{recurringShipping}}",
4409
+ variable: HAS_RECURRING_SHIPPING
4410
+ })
4411
+ ] : [],
4408
4412
  ...FOOTNOTES.map((text) => ({
4409
4413
  content: { en: styledCopy(text, small) },
4410
4414
  sectionType: "text",
@@ -4413,7 +4417,9 @@ var recurringSummary = (settings) => {
4413
4417
  ],
4414
4418
  sectionType: "layout",
4415
4419
  spacing: "tight",
4416
- variables: earnedVariables([HAS_RECURRING_TOTAL, HAS_RECURRING_SHIPPING])
4420
+ variables: earnedVariables(
4421
+ shipping ? [HAS_RECURRING_TOTAL, HAS_RECURRING_SHIPPING] : [HAS_RECURRING_TOTAL]
4422
+ )
4417
4423
  }
4418
4424
  ];
4419
4425
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rebuy/rebuy",
3
- "version": "3.55.0",
3
+ "version": "3.56.0",
4
4
  "description": "Shared zod schemas, legacy-to-CAB widget transforms, and server orchestrators for Rebuy's Shopify consumers (rebuy-api, admin-nextjs, rebuy-shopify-extensions)",
5
5
  "license": "MIT",
6
6
  "author": "Rebuy, Inc.",