@rebuy/rebuy 3.32.0 → 3.34.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 (52) hide show
  1. package/README.md +1 -1
  2. package/dist/cab/index.cjs +12 -1
  3. package/dist/cab/index.d.ts +1 -0
  4. package/dist/cab/index.mjs +12 -1
  5. package/dist/cab/utf8ByteLength.d.ts +6 -0
  6. package/dist/index.cjs +1138 -923
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.mjs +1138 -923
  9. package/dist/pricing/postPurchaseSubscriptionDisplay.d.ts +5 -0
  10. package/dist/schema/index.d.ts +8 -0
  11. package/dist/schema/postPurchaseChoice.d.ts +25 -0
  12. package/dist/schema/postPurchaseDiscount.d.ts +22 -0
  13. package/dist/schema/postPurchasePlanAdjustment.d.ts +11 -0
  14. package/dist/schema/postPurchasePlanCatalog.d.ts +42 -0
  15. package/dist/schema/postPurchaseProduct.d.ts +260 -0
  16. package/dist/schema/postPurchaseProductSettings.d.ts +1 -1
  17. package/dist/schema/postPurchaseProductSource.d.ts +2 -2
  18. package/dist/schema/postPurchaseSubscription.d.ts +21 -0
  19. package/dist/schema/postPurchaseSubscriptionDisplay.d.ts +10 -0
  20. package/dist/schema/postPurchaseSubscriptionProduct.d.ts +224 -0
  21. package/dist/schema/postPurchaseSubscriptionSettings.d.ts +22 -0
  22. package/dist/schema/widgets/checkout-and-beyond/banner.d.ts +1 -1
  23. package/dist/schema/widgets/checkout-and-beyond/carousel.d.ts +1 -1
  24. package/dist/schema/widgets/checkout-and-beyond/cartLine.d.ts +1 -1
  25. package/dist/schema/widgets/checkout-and-beyond/common.d.ts +1 -1
  26. package/dist/schema/widgets/checkout-and-beyond/dataSource.d.ts +2 -2
  27. package/dist/schema/widgets/checkout-and-beyond/discount.d.ts +1 -1
  28. package/dist/schema/widgets/checkout-and-beyond/icons.d.ts +1 -1
  29. package/dist/schema/widgets/checkout-and-beyond/image.d.ts +2 -2
  30. package/dist/schema/widgets/checkout-and-beyond/offers.d.ts +1 -1
  31. package/dist/schema/widgets/checkout-and-beyond/progressBar.d.ts +1 -1
  32. package/dist/schema/widgets/post-purchase-offer/postPurchaseOffer.d.ts +2 -2
  33. package/dist/schema/widgets/post-purchase-offer/postPurchaseSettings.d.ts +2 -2
  34. package/dist/schema/widgets/post-purchase-offer/postPurchaseWidget.d.ts +2 -2
  35. package/dist/server/__fixtures__/postPurchaseLegacyPlans.d.ts +35 -0
  36. package/dist/server/__fixtures__/postPurchaseSubscription.d.ts +75 -0
  37. package/dist/server/index.cjs +802 -118
  38. package/dist/server/index.d.ts +3 -1
  39. package/dist/server/index.mjs +802 -118
  40. package/dist/server/normalizePostPurchaseCollection.d.ts +16 -16
  41. package/dist/server/normalizePostPurchaseProduct.d.ts +9 -9
  42. package/dist/server/postPurchaseLegacyPlans.d.ts +3 -0
  43. package/dist/server/postPurchaseModernPlans.d.ts +7 -0
  44. package/dist/server/postPurchasePlanAdjustment.d.ts +3 -0
  45. package/dist/server/postPurchasePlanCatalog.d.ts +5 -0
  46. package/dist/server/postPurchaseSubscriptionEligibility.d.ts +5 -0
  47. package/dist/server/prepareNormalizedSubscription.d.ts +11 -0
  48. package/dist/server/preparePostPurchaseSubscription.d.ts +102 -0
  49. package/dist/server/projectPostPurchaseProduct.d.ts +7 -7
  50. package/dist/server/requestSchemas.d.ts +1 -1
  51. package/dist/server/selectPostPurchaseChoice.d.ts +43 -0
  52. package/package.json +1 -1
@@ -0,0 +1,22 @@
1
+ /** Keep configured defaults, but do not turn malformed raw financial values into a charge. */
2
+ export declare const PostPurchaseSubscriptionSettings: import("zod").ZodObject<{
3
+ discount: import("zod").ZodObject<{
4
+ shouldShowSavingText: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodBoolean>>;
5
+ type: import("zod").ZodDefault<import("zod").ZodEnum<{
6
+ none: "none";
7
+ fixed_amount: "fixed_amount";
8
+ percentage: "percentage";
9
+ }>>;
10
+ amount: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<number, string>>]>>;
11
+ }, import("zod/v4/core").$strip>;
12
+ shipping: import("zod").ZodObject<{
13
+ enabled: import("zod").ZodDefault<import("zod").ZodBoolean>;
14
+ recurringAmount: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<number, string>>, import("zod").ZodPipe<import("zod").ZodUnknown, import("zod").ZodTransform<number, unknown>>]>>;
15
+ shippingTitle: import("zod").ZodDefault<import("zod").ZodString>;
16
+ type: import("zod").ZodDefault<import("zod").ZodEnum<{
17
+ fixed_amount: "fixed_amount";
18
+ free: "free";
19
+ }>>;
20
+ amount: import("zod").ZodDefault<import("zod").ZodUnion<readonly [import("zod").ZodNumber, import("zod").ZodPipe<import("zod").ZodString, import("zod").ZodTransform<number, string>>]>>;
21
+ }, import("zod/v4/core").$strip>;
22
+ }, import("zod/v4/core").$strip>;
@@ -5,7 +5,6 @@ import { type SectionDetails } from './shared';
5
5
  export declare const CABBannerSection: z.ZodLazy<z.ZodObject<{
6
6
  name: z.ZodOptional<z.ZodString>;
7
7
  width: z.ZodDefault<z.ZodNumber>;
8
- sectionId: z.ZodDefault<z.ZodUUID>;
9
8
  grid: z.ZodOptional<z.ZodDefault<z.ZodObject<{
10
9
  columns: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodLiteral<"fill">, z.ZodString, z.ZodNumber]>>, z.ZodUndefined]>>;
11
10
  rows: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodLiteral<"fill">, z.ZodString, z.ZodNumber]>>, z.ZodUndefined]>>;
@@ -59,6 +58,7 @@ export declare const CABBannerSection: z.ZodLazy<z.ZodObject<{
59
58
  loose: "loose";
60
59
  extraLoose: "extraLoose";
61
60
  }>>;
61
+ sectionId: z.ZodDefault<z.ZodUUID>;
62
62
  mutators: z.ZodOptional<z.ZodArray<z.ZodObject<{
63
63
  effect: z.ZodDefault<z.ZodEnum<{
64
64
  set_false: "set_false";
@@ -5,7 +5,6 @@ import { CABSection, type SectionDetails } from './shared';
5
5
  export declare const CABCarouselSection: z.ZodLazy<z.ZodObject<{
6
6
  name: z.ZodOptional<z.ZodString>;
7
7
  width: z.ZodDefault<z.ZodNumber>;
8
- sectionId: z.ZodDefault<z.ZodUUID>;
9
8
  grid: z.ZodOptional<z.ZodDefault<z.ZodObject<{
10
9
  columns: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodLiteral<"fill">, z.ZodString, z.ZodNumber]>>, z.ZodUndefined]>>;
11
10
  rows: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodLiteral<"fill">, z.ZodString, z.ZodNumber]>>, z.ZodUndefined]>>;
@@ -84,6 +83,7 @@ export declare const CABCarouselSection: z.ZodLazy<z.ZodObject<{
84
83
  loose: "loose";
85
84
  extraLoose: "extraLoose";
86
85
  }>>;
86
+ sectionId: z.ZodDefault<z.ZodUUID>;
87
87
  mutators: z.ZodOptional<z.ZodArray<z.ZodObject<{
88
88
  effect: z.ZodDefault<z.ZodEnum<{
89
89
  set_false: "set_false";
@@ -4,7 +4,6 @@ import { CABSection, type SectionDetails } from './shared';
4
4
  export declare const CABCartLineSection: z.ZodLazy<z.ZodObject<{
5
5
  name: z.ZodOptional<z.ZodString>;
6
6
  width: z.ZodDefault<z.ZodNumber>;
7
- sectionId: z.ZodDefault<z.ZodUUID>;
8
7
  grid: z.ZodOptional<z.ZodDefault<z.ZodObject<{
9
8
  columns: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodLiteral<"fill">, z.ZodString, z.ZodNumber]>>, z.ZodUndefined]>>;
10
9
  rows: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodLiteral<"fill">, z.ZodString, z.ZodNumber]>>, z.ZodUndefined]>>;
@@ -83,6 +82,7 @@ export declare const CABCartLineSection: z.ZodLazy<z.ZodObject<{
83
82
  loose: "loose";
84
83
  extraLoose: "extraLoose";
85
84
  }>>;
85
+ sectionId: z.ZodDefault<z.ZodUUID>;
86
86
  mutators: z.ZodOptional<z.ZodArray<z.ZodObject<{
87
87
  effect: z.ZodDefault<z.ZodEnum<{
88
88
  set_false: "set_false";
@@ -121,8 +121,8 @@ export declare const discountTypes: readonly ["none", "percentage", "fixed", "fi
121
121
  export declare const DiscountType: {
122
122
  readonly fixed: "fixed";
123
123
  readonly none: "none";
124
- readonly percentage: "percentage";
125
124
  readonly fixed_amount: "fixed_amount";
125
+ readonly percentage: "percentage";
126
126
  };
127
127
  export type DiscountType = (typeof discountTypes)[number];
128
128
  export declare const editorModes: readonly ["checkoutExtension", "postPurchaseOffer", "thankYouPage", "orderStatusPage", "ordersIndexPage", "customerProfilePage"];
@@ -10,8 +10,8 @@ export declare const CABDiscount: z.ZodObject<{
10
10
  type: z.ZodCatch<z.ZodEnum<{
11
11
  fixed: "fixed";
12
12
  none: "none";
13
- percentage: "percentage";
14
13
  fixed_amount: "fixed_amount";
14
+ percentage: "percentage";
15
15
  }>>;
16
16
  }, z.core.$strip>;
17
17
  export type CABDiscount = z.infer<typeof CABDiscount>;
@@ -40,8 +40,8 @@ export declare const CABDataSourceSection: z.ZodObject<{
40
40
  type: z.ZodCatch<z.ZodEnum<{
41
41
  fixed: "fixed";
42
42
  none: "none";
43
- percentage: "percentage";
44
43
  fixed_amount: "fixed_amount";
44
+ percentage: "percentage";
45
45
  }>>;
46
46
  }, z.core.$strip>>;
47
47
  integrations: z.ZodOptional<z.ZodObject<{
@@ -21,8 +21,8 @@ export declare const CABDiscountSection: z.ZodObject<{
21
21
  type: z.ZodCatch<z.ZodEnum<{
22
22
  fixed: "fixed";
23
23
  none: "none";
24
- percentage: "percentage";
25
24
  fixed_amount: "fixed_amount";
25
+ percentage: "percentage";
26
26
  }>>;
27
27
  mutators: z.ZodOptional<z.ZodArray<z.ZodObject<{
28
28
  effect: z.ZodDefault<z.ZodEnum<{
@@ -20,7 +20,6 @@ export declare const IconName: {
20
20
  readonly check: "check";
21
21
  readonly image: "image";
22
22
  readonly discount: "discount";
23
- readonly empty: "empty";
24
23
  readonly info: "info";
25
24
  readonly grid: "grid";
26
25
  readonly menu: "menu";
@@ -56,6 +55,7 @@ export declare const IconName: {
56
55
  readonly disabled: "disabled";
57
56
  readonly edit: "edit";
58
57
  readonly email: "email";
58
+ readonly empty: "empty";
59
59
  readonly external: "external";
60
60
  readonly geolocation: "geolocation";
61
61
  readonly "gift-card": "gift-card";
@@ -94,7 +94,6 @@ export declare const CABImageSectionFields: z.ZodObject<{
94
94
  check: "check";
95
95
  image: "image";
96
96
  discount: "discount";
97
- empty: "empty";
98
97
  info: "info";
99
98
  grid: "grid";
100
99
  menu: "menu";
@@ -130,6 +129,7 @@ export declare const CABImageSectionFields: z.ZodObject<{
130
129
  disabled: "disabled";
131
130
  edit: "edit";
132
131
  email: "email";
132
+ empty: "empty";
133
133
  external: "external";
134
134
  geolocation: "geolocation";
135
135
  "gift-card": "gift-card";
@@ -448,7 +448,6 @@ export declare const CABImageSection: z.ZodObject<{
448
448
  check: "check";
449
449
  image: "image";
450
450
  discount: "discount";
451
- empty: "empty";
452
451
  info: "info";
453
452
  grid: "grid";
454
453
  menu: "menu";
@@ -484,6 +483,7 @@ export declare const CABImageSection: z.ZodObject<{
484
483
  disabled: "disabled";
485
484
  edit: "edit";
486
485
  email: "email";
486
+ empty: "empty";
487
487
  external: "external";
488
488
  geolocation: "geolocation";
489
489
  "gift-card": "gift-card";
@@ -4,7 +4,6 @@ import { CABSection, type SectionDetails } from './shared';
4
4
  export declare const CABOffersSection: z.ZodLazy<z.ZodObject<{
5
5
  name: z.ZodOptional<z.ZodString>;
6
6
  width: z.ZodDefault<z.ZodNumber>;
7
- sectionId: z.ZodDefault<z.ZodUUID>;
8
7
  grid: z.ZodOptional<z.ZodDefault<z.ZodObject<{
9
8
  columns: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodLiteral<"fill">, z.ZodString, z.ZodNumber]>>, z.ZodUndefined]>>;
10
9
  rows: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodLiteral<"fill">, z.ZodString, z.ZodNumber]>>, z.ZodUndefined]>>;
@@ -83,6 +82,7 @@ export declare const CABOffersSection: z.ZodLazy<z.ZodObject<{
83
82
  loose: "loose";
84
83
  extraLoose: "extraLoose";
85
84
  }>>;
85
+ sectionId: z.ZodDefault<z.ZodUUID>;
86
86
  mutators: z.ZodOptional<z.ZodArray<z.ZodObject<{
87
87
  effect: z.ZodDefault<z.ZodEnum<{
88
88
  set_false: "set_false";
@@ -69,7 +69,6 @@ export type CABProgressTier = z.infer<typeof CABProgressTier>;
69
69
  */
70
70
  export declare const CABProgressBarSection: z.ZodLazy<z.ZodObject<{
71
71
  width: z.ZodDefault<z.ZodNumber>;
72
- sectionId: z.ZodDefault<z.ZodUUID>;
73
72
  grid: z.ZodOptional<z.ZodDefault<z.ZodObject<{
74
73
  columns: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodLiteral<"fill">, z.ZodString, z.ZodNumber]>>, z.ZodUndefined]>>;
75
74
  rows: z.ZodDefault<z.ZodUnion<readonly [z.ZodArray<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodLiteral<"fill">, z.ZodString, z.ZodNumber]>>, z.ZodUndefined]>>;
@@ -148,6 +147,7 @@ export declare const CABProgressBarSection: z.ZodLazy<z.ZodObject<{
148
147
  loose: "loose";
149
148
  extraLoose: "extraLoose";
150
149
  }>>;
150
+ sectionId: z.ZodDefault<z.ZodUUID>;
151
151
  mutators: z.ZodOptional<z.ZodArray<z.ZodObject<{
152
152
  effect: z.ZodDefault<z.ZodEnum<{
153
153
  set_false: "set_false";
@@ -562,8 +562,8 @@ export declare const PostPurchaseOffer: z.ZodDiscriminatedUnion<[z.ZodObject<{
562
562
  shouldShowSavingText: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
563
563
  type: z.ZodDefault<z.ZodEnum<{
564
564
  none: "none";
565
- percentage: "percentage";
566
565
  fixed_amount: "fixed_amount";
566
+ percentage: "percentage";
567
567
  }>>;
568
568
  }, z.core.$strip>;
569
569
  discountedFrom: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
@@ -694,8 +694,8 @@ export declare const PostPurchaseOffer: z.ZodDiscriminatedUnion<[z.ZodObject<{
694
694
  shouldShowSavingText: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
695
695
  type: z.ZodDefault<z.ZodEnum<{
696
696
  none: "none";
697
- percentage: "percentage";
698
697
  fixed_amount: "fixed_amount";
698
+ percentage: "percentage";
699
699
  }>>;
700
700
  }, z.core.$strip>;
701
701
  shipping: z.ZodObject<{
@@ -541,8 +541,8 @@ export declare const PostPurchaseSettings: z.ZodObject<{
541
541
  shouldShowSavingText: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
542
542
  type: z.ZodDefault<z.ZodEnum<{
543
543
  none: "none";
544
- percentage: "percentage";
545
544
  fixed_amount: "fixed_amount";
545
+ percentage: "percentage";
546
546
  }>>;
547
547
  }, z.core.$strip>;
548
548
  discountedFrom: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
@@ -673,8 +673,8 @@ export declare const PostPurchaseSettings: z.ZodObject<{
673
673
  shouldShowSavingText: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
674
674
  type: z.ZodDefault<z.ZodEnum<{
675
675
  none: "none";
676
- percentage: "percentage";
677
676
  fixed_amount: "fixed_amount";
677
+ percentage: "percentage";
678
678
  }>>;
679
679
  }, z.core.$strip>;
680
680
  shipping: z.ZodObject<{
@@ -559,8 +559,8 @@ export declare const PostPurchaseWidget: z.ZodObject<{
559
559
  shouldShowSavingText: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
560
560
  type: z.ZodDefault<z.ZodEnum<{
561
561
  none: "none";
562
- percentage: "percentage";
563
562
  fixed_amount: "fixed_amount";
563
+ percentage: "percentage";
564
564
  }>>;
565
565
  }, z.core.$strip>;
566
566
  discountedFrom: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
@@ -691,8 +691,8 @@ export declare const PostPurchaseWidget: z.ZodObject<{
691
691
  shouldShowSavingText: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
692
692
  type: z.ZodDefault<z.ZodEnum<{
693
693
  none: "none";
694
- percentage: "percentage";
695
694
  fixed_amount: "fixed_amount";
695
+ percentage: "percentage";
696
696
  }>>;
697
697
  }, z.core.$strip>;
698
698
  shipping: z.ZodObject<{
@@ -0,0 +1,35 @@
1
+ /** Sanitized core SellingPlans::attachRebuySellingPlans output; one row per plan/variant join. */
2
+ export declare const legacyPlanResponse: {
3
+ data: {
4
+ selling_plan_groups: {
5
+ discount_amount: string;
6
+ discount_type: string;
7
+ id: number;
8
+ requires_selling_plan: boolean;
9
+ selling_plans: {
10
+ id: number;
11
+ name: string;
12
+ order_interval_frequency: string;
13
+ order_interval_unit_type: string;
14
+ shopify_variant_id: string;
15
+ }[];
16
+ }[];
17
+ description: string;
18
+ id: number;
19
+ image: {
20
+ src: string;
21
+ };
22
+ title: string;
23
+ variants: {
24
+ compare_at_price: string;
25
+ id: number;
26
+ inventory_management: string;
27
+ inventory_policy: string;
28
+ inventory_quantity: number;
29
+ price: string;
30
+ product_id: number;
31
+ title: string;
32
+ }[];
33
+ }[];
34
+ metadata: {};
35
+ };
@@ -0,0 +1,75 @@
1
+ /** One allocation-linked plan: no upgrades, discounts, recurring fees or alternate formats. */
2
+ export declare const subscriptionSettings: {
3
+ discount: {
4
+ amount: number;
5
+ type: string;
6
+ };
7
+ product_type: string;
8
+ subscription: {
9
+ discount: {
10
+ amount: number;
11
+ type: string;
12
+ };
13
+ shipping: {
14
+ amount: number;
15
+ type: string;
16
+ };
17
+ };
18
+ blocks: {
19
+ type: string;
20
+ }[];
21
+ endpoint: string;
22
+ integrations: {};
23
+ key: string;
24
+ language: {};
25
+ product_limit: number;
26
+ product_options: {};
27
+ quantity_inputs: {
28
+ default_quantity: number;
29
+ enabled: boolean;
30
+ };
31
+ shipping: {
32
+ amount: string;
33
+ title: string;
34
+ type: string;
35
+ };
36
+ };
37
+ export declare const subscriptionResponse: {
38
+ data: {
39
+ selling_plan_groups: {
40
+ id: string;
41
+ requires_selling_plan: boolean;
42
+ selling_plans: {
43
+ id: number;
44
+ name: string;
45
+ options: {
46
+ name: string;
47
+ position: number;
48
+ value: string;
49
+ }[];
50
+ price_adjustments: never[];
51
+ }[];
52
+ }[];
53
+ variants: {
54
+ selling_plan_allocations: {
55
+ selling_plan_group_id: string;
56
+ selling_plan_id: number;
57
+ }[];
58
+ compare_at_price: string;
59
+ id: number;
60
+ inventory_management: string;
61
+ inventory_policy: string;
62
+ inventory_quantity: number;
63
+ price: string;
64
+ product_id: number;
65
+ title: string;
66
+ }[];
67
+ description: string;
68
+ id: number;
69
+ image: {
70
+ src: string;
71
+ };
72
+ title: string;
73
+ }[];
74
+ metadata: {};
75
+ };