@rebuy/rebuy 3.55.0 → 3.56.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 (33) 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 +71 -24
  13. package/dist/server/index.mjs +71 -24
  14. package/dist/server/normalizePostPurchaseCollection.d.ts +1 -0
  15. package/dist/server/normalizePostPurchaseProduct.d.ts +21 -2
  16. package/dist/server/postPurchaseCardSections.d.ts +2 -2
  17. package/dist/server/postPurchasePlanCatalog.d.ts +2 -1
  18. package/dist/server/postPurchaseSts.d.ts +6 -0
  19. package/dist/server/prepareNormalizedSubscription.d.ts +2 -1
  20. package/dist/server/preparePostPurchaseAdmissionView.d.ts +3 -0
  21. package/dist/server/preparePostPurchaseCollectionGroup.d.ts +3 -0
  22. package/dist/server/preparePostPurchaseCollectionView.d.ts +3 -0
  23. package/dist/server/preparePostPurchaseGroupAdmissionView.d.ts +3 -0
  24. package/dist/server/preparePostPurchaseGroupDefault.d.ts +3 -0
  25. package/dist/server/preparePostPurchaseGroupView.d.ts +3 -0
  26. package/dist/server/preparePostPurchaseMemberView.d.ts +14 -0
  27. package/dist/server/preparePostPurchaseQuantityAdmissionView.d.ts +3 -0
  28. package/dist/server/preparePostPurchaseQuantityView.d.ts +3 -0
  29. package/dist/server/preparePostPurchaseStsMember.d.ts +4 -0
  30. package/dist/server/preparePostPurchaseSubscription.d.ts +1 -0
  31. package/dist/transforms/index.cjs +17 -11
  32. package/dist/transforms/index.mjs +17 -11
  33. package/package.json +1 -1
@@ -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: {
@@ -732,6 +735,7 @@ export declare const preparePostPurchaseStsMember: (widgetId: number, settings:
732
735
  subscriptionIsDefault?: boolean | undefined;
733
736
  blocks?: unknown[] | undefined;
734
737
  };
738
+ emptiedByDrop: boolean;
735
739
  metadata: {
736
740
  widget: Record<string, unknown>;
737
741
  };
@@ -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.1",
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.",