@rebuy/rebuy 3.41.0 → 3.43.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 (60) hide show
  1. package/dist/index.cjs +971 -787
  2. package/dist/index.d.ts +1 -0
  3. package/dist/index.mjs +971 -787
  4. package/dist/pricing/index.cjs +58 -1
  5. package/dist/pricing/index.d.ts +2 -0
  6. package/dist/pricing/index.mjs +58 -1
  7. package/dist/pricing/postPurchaseDisplayFacts.d.ts +36 -0
  8. package/dist/pricing/postPurchaseDisplayPrice.d.ts +8 -0
  9. package/dist/pricing/postPurchaseReduction.d.ts +17 -0
  10. package/dist/schema/checkout-and-beyond/constants.cjs +4 -0
  11. package/dist/schema/checkout-and-beyond/constants.mjs +4 -0
  12. package/dist/schema/checkout-and-beyond/index.cjs +388 -374
  13. package/dist/schema/checkout-and-beyond/index.mjs +388 -374
  14. package/dist/schema/index.d.ts +2 -0
  15. package/dist/schema/postPurchaseAdmission.d.ts +33 -0
  16. package/dist/schema/postPurchaseDisplayPrice.d.ts +31 -0
  17. package/dist/schema/postPurchaseFollowups.d.ts +47 -0
  18. package/dist/schema/postPurchaseHealth.d.ts +5 -0
  19. package/dist/schema/postPurchasePlanCatalog.d.ts +2 -0
  20. package/dist/schema/postPurchaseProduct.d.ts +2 -0
  21. package/dist/schema/postPurchaseProductCollectionView.d.ts +62 -0
  22. package/dist/schema/postPurchaseProductView.d.ts +65 -0
  23. package/dist/schema/postPurchaseRecovery.d.ts +47 -0
  24. package/dist/schema/postPurchaseSubscriptionProduct.d.ts +2 -0
  25. package/dist/schema/postPurchaseUpgrade.d.ts +117 -0
  26. package/dist/schema/widget-data.cjs +452 -441
  27. package/dist/schema/widget-data.mjs +452 -441
  28. package/dist/schema/widgets/checkout-and-beyond/common.d.ts +14 -0
  29. package/dist/schema/widgets/checkout-and-beyond/image.d.ts +8 -0
  30. package/dist/schema/widgets/checkout-and-beyond/imageThumbnails.d.ts +13 -0
  31. package/dist/schema/widgets/checkout-and-beyond/index.d.ts +1 -0
  32. package/dist/schema/widgets/checkout-and-beyond/variants.d.ts +1 -0
  33. package/dist/server/index.cjs +1721 -1419
  34. package/dist/server/index.mjs +1707 -1405
  35. package/dist/server/postPurchasePlanCatalog.d.ts +4 -1
  36. package/dist/server/preparePostPurchaseAdmissionView.d.ts +53 -0
  37. package/dist/server/preparePostPurchaseCollectionGroup.d.ts +57 -0
  38. package/dist/server/preparePostPurchaseCollectionView.d.ts +53 -0
  39. package/dist/server/preparePostPurchaseGroupAdmissionView.d.ts +53 -0
  40. package/dist/server/preparePostPurchaseGroupDefault.d.ts +53 -0
  41. package/dist/server/preparePostPurchaseGroupView.d.ts +53 -0
  42. package/dist/server/preparePostPurchaseMemberView.d.ts +159 -0
  43. package/dist/server/preparePostPurchaseQuantityAdmissionView.d.ts +53 -0
  44. package/dist/server/preparePostPurchaseQuantityView.d.ts +53 -0
  45. package/dist/server/preparePostPurchaseSubscription.d.ts +1 -0
  46. package/dist/server/selectPostPurchaseChoice.d.ts +1 -0
  47. package/dist/transforms/index.cjs +980 -581
  48. package/dist/transforms/index.mjs +980 -581
  49. package/dist/transforms/postPurchase/convertProductInformation.d.ts +6 -2
  50. package/dist/transforms/postPurchase/productCardControls.d.ts +7 -0
  51. package/dist/transforms/postPurchase/productCardCosts.d.ts +3 -0
  52. package/dist/transforms/postPurchase/productCardPricing.d.ts +3 -0
  53. package/dist/transforms/postPurchase/productCardRows.d.ts +63 -0
  54. package/dist/transforms/postPurchase/productCardSettings.d.ts +103 -0
  55. package/dist/transforms/postPurchase/types.d.ts +2 -2
  56. package/dist/transforms/productCard/earnedText.d.ts +25 -0
  57. package/dist/transforms/productCard/priceText.d.ts +2 -0
  58. package/dist/transforms/productCard/quantitySection.d.ts +28 -0
  59. package/dist/transforms/productCard/subscriptionToggle.d.ts +18 -0
  60. package/package.json +1 -1
@@ -10,6 +10,7 @@ export * from './postPurchaseClassification';
10
10
  export * from './postPurchaseDecline';
11
11
  export * from './postPurchaseDeclineDelivery';
12
12
  export * from './postPurchaseDiscount';
13
+ export * from './postPurchaseDisplayPrice';
13
14
  export * from './postPurchaseEligibility';
14
15
  export * from './postPurchaseExitPolicy';
15
16
  export * from './postPurchaseFinish';
@@ -55,6 +56,7 @@ export * from './postPurchaseSubscription';
55
56
  export * from './postPurchaseSubscriptionDisplay';
56
57
  export { PreparedPostPurchaseSubscription } from './postPurchaseSubscriptionProduct';
57
58
  export * from './postPurchaseTransition';
59
+ export * from './postPurchaseUpgrade';
58
60
  export * from './postPurchaseVariantCatalog';
59
61
  export * from './postPurchaseVariantDefault';
60
62
  export * from './postPurchaseVariantDefaultContext';
@@ -1,4 +1,12 @@
1
1
  import { z } from 'zod';
2
+ /**
3
+ * Absent means `purchase`, so every pre-upgrade wire is unchanged. `upgrade` adds the selected subscription and
4
+ * refunds the buyer's original one-time line of the same variant; the server binds that line, never the client.
5
+ */
6
+ export declare const PurchaseAdmissionModeSchema: z.ZodEnum<{
7
+ purchase: "purchase";
8
+ upgrade: "upgrade";
9
+ }>;
2
10
  export declare const PurchaseExpectedSchema: z.ZodObject<{
3
11
  buyerConsentToSubscriptions: z.ZodOptional<z.ZodBoolean>;
4
12
  changeset: z.ZodObject<{
@@ -52,6 +60,10 @@ export declare const PurchaseExpectedSchema: z.ZodObject<{
52
60
  productId: z.ZodNumber;
53
61
  productIndex: z.ZodNumber;
54
62
  }, z.core.$strict>>;
63
+ mode: z.ZodOptional<z.ZodEnum<{
64
+ purchase: "purchase";
65
+ upgrade: "upgrade";
66
+ }>>;
55
67
  progressRevision: z.ZodOptional<z.ZodNumber>;
56
68
  selection: z.ZodObject<{
57
69
  productId: z.ZodNumber;
@@ -116,6 +128,10 @@ export declare const PurchaseRequestSchema: z.ZodObject<{
116
128
  productId: z.ZodNumber;
117
129
  productIndex: z.ZodNumber;
118
130
  }, z.core.$strict>>;
131
+ mode: z.ZodOptional<z.ZodEnum<{
132
+ purchase: "purchase";
133
+ upgrade: "upgrade";
134
+ }>>;
119
135
  progressRevision: z.ZodOptional<z.ZodNumber>;
120
136
  selection: z.ZodObject<{
121
137
  productId: z.ZodNumber;
@@ -129,7 +145,15 @@ export declare const PurchaseRequestSchema: z.ZodObject<{
129
145
  export declare const PurchaseReceiptSchema: z.ZodObject<{
130
146
  admittedAt: z.ZodNumber;
131
147
  changesetToken: z.ZodString;
148
+ mode: z.ZodOptional<z.ZodEnum<{
149
+ purchase: "purchase";
150
+ upgrade: "upgrade";
151
+ }>>;
132
152
  operationId: z.ZodUUID;
153
+ originalLine: z.ZodOptional<z.ZodObject<{
154
+ quantity: z.ZodNumber;
155
+ variantId: z.ZodNumber;
156
+ }, z.core.$strict>>;
133
157
  requiresSubscriptionConsent: z.ZodBoolean;
134
158
  selection: z.ZodObject<{
135
159
  productId: z.ZodNumber;
@@ -142,7 +166,15 @@ export declare const PurchaseResponseSchema: z.ZodObject<{
142
166
  data: z.ZodObject<{
143
167
  admittedAt: z.ZodNumber;
144
168
  changesetToken: z.ZodString;
169
+ mode: z.ZodOptional<z.ZodEnum<{
170
+ purchase: "purchase";
171
+ upgrade: "upgrade";
172
+ }>>;
145
173
  operationId: z.ZodUUID;
174
+ originalLine: z.ZodOptional<z.ZodObject<{
175
+ quantity: z.ZodNumber;
176
+ variantId: z.ZodNumber;
177
+ }, z.core.$strict>>;
146
178
  requiresSubscriptionConsent: z.ZodBoolean;
147
179
  selection: z.ZodObject<{
148
180
  productId: z.ZodNumber;
@@ -156,3 +188,4 @@ export declare const PurchaseResponseSchema: z.ZodObject<{
156
188
  export type PurchaseReceipt = z.infer<typeof PurchaseReceiptSchema>;
157
189
  export type PurchaseExpected = z.infer<typeof PurchaseExpectedSchema>;
158
190
  export type PurchaseRequest = z.infer<typeof PurchaseRequestSchema>;
191
+ export type PurchaseAdmissionMode = z.infer<typeof PurchaseAdmissionModeSchema>;
@@ -0,0 +1,31 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Display pricing rebuy-api works out for the current choice (legacy discount maths, L132–L140), so the client
4
+ * only formats minor units into cab-checkout's tokens: `variantPriceMinor` → `{{variantPrice}}` (× quantity →
5
+ * `{{variantTotalPrice}}`), `variantCompareAtPriceMinor` → `{{variantCompareAtPrice}}` (null: nothing struck,
6
+ * the exemplar's ''). The saving is the struck price minus the price; `savingFormat` is which of
7
+ * `savingMinor` / `savingPercent` the saving text shows (L140: currency for a fixed amount). A plan choice also
8
+ * carries `postPurchaseSubscriptionDisplay`'s unit estimate, which must restate these facts: with the saving tied
9
+ * to its own comparison, its comparison is the struck price when one is struck and at most the price when none is
10
+ * (a plan `price` above the regular price compares below it, so equality to the price would be too strict). A
11
+ * display estimate, never Shopify's charge.
12
+ */
13
+ export declare const PostPurchaseDisplayPrice: z.ZodObject<{
14
+ currencyCode: z.ZodString;
15
+ savingFormat: z.ZodEnum<{
16
+ amount: "amount";
17
+ percent: "percent";
18
+ }>;
19
+ savingMinor: z.ZodNumber;
20
+ savingPercent: z.ZodNumber;
21
+ subscriptionUnit: z.ZodOptional<z.ZodObject<{
22
+ comparisonMinor: z.ZodNumber;
23
+ currencyCode: z.ZodString;
24
+ priceMinor: z.ZodNumber;
25
+ savingMinor: z.ZodNumber;
26
+ savingPercent: z.ZodNumber;
27
+ }, z.core.$strip>>;
28
+ variantCompareAtPriceMinor: z.ZodNullable<z.ZodNumber>;
29
+ variantPriceMinor: z.ZodNumber;
30
+ }, z.core.$strip>;
31
+ export type PostPurchaseDisplayPrice = z.infer<typeof PostPurchaseDisplayPrice>;
@@ -125,6 +125,53 @@ export declare const AcceptedFollowupsResponseSchema: z.ZodObject<{
125
125
  recordedAt: z.ZodNumber;
126
126
  operationId: z.ZodUUID;
127
127
  }, z.core.$strict>;
128
+ upgrade: z.ZodOptional<z.ZodObject<{
129
+ compensation: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
130
+ attemptedAt: z.ZodNumber;
131
+ status: z.ZodLiteral<"attempted">;
132
+ }, z.core.$strict>, z.ZodObject<{
133
+ attemptedAt: z.ZodNumber;
134
+ finishedAt: z.ZodNumber;
135
+ status: z.ZodEnum<{
136
+ unknown: "unknown";
137
+ failed: "failed";
138
+ removed: "removed";
139
+ }>;
140
+ }, z.core.$strict>]>>;
141
+ operationId: z.ZodUUID;
142
+ refund: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
143
+ attemptedAt: z.ZodNumber;
144
+ status: z.ZodLiteral<"attempted">;
145
+ }, z.core.$strict>, z.ZodObject<{
146
+ attemptedAt: z.ZodNumber;
147
+ finishedAt: z.ZodNumber;
148
+ refundId: z.ZodString;
149
+ status: z.ZodLiteral<"refunded">;
150
+ }, z.core.$strict>, z.ZodObject<{
151
+ attemptedAt: z.ZodNumber;
152
+ finishedAt: z.ZodNumber;
153
+ status: z.ZodEnum<{
154
+ unknown: "unknown";
155
+ failed: "failed";
156
+ }>;
157
+ }, z.core.$strict>]>>;
158
+ review: z.ZodNullable<z.ZodObject<{
159
+ markedAt: z.ZodNumber;
160
+ marker: z.ZodUnion<readonly [z.ZodEnum<{
161
+ unknown: "unknown";
162
+ acknowledged: "acknowledged";
163
+ rejected: "rejected";
164
+ }>, z.ZodEnum<{
165
+ attempted: "attempted";
166
+ unavailable: "unavailable";
167
+ }>]>;
168
+ reason: z.ZodEnum<{
169
+ "refund-unknown": "refund-unknown";
170
+ "compensation-failed": "compensation-failed";
171
+ "compensation-unknown": "compensation-unknown";
172
+ }>;
173
+ }, z.core.$strict>>;
174
+ }, z.core.$strict>>;
128
175
  }, z.core.$strip>;
129
176
  successful: z.ZodLiteral<true>;
130
177
  }, z.core.$strip>;
@@ -15,6 +15,7 @@ export declare const HealthAttemptSchema: z.ZodObject<{
15
15
  removePartialOrder: z.ZodBoolean;
16
16
  operationId: z.ZodUUID;
17
17
  healthScheduledAt: z.ZodNumber;
18
+ checkoutToken: z.ZodOptional<z.ZodString>;
18
19
  scheduleReceipt: z.ZodOptional<z.ZodObject<{
19
20
  recordedAt: z.ZodNumber;
20
21
  taskName: z.ZodString;
@@ -28,6 +29,7 @@ export declare const HealthResultSchema: z.ZodObject<{
28
29
  removePartialOrder: z.ZodBoolean;
29
30
  operationId: z.ZodUUID;
30
31
  healthScheduledAt: z.ZodNumber;
32
+ checkoutToken: z.ZodOptional<z.ZodString>;
31
33
  scheduleReceipt: z.ZodOptional<z.ZodObject<{
32
34
  recordedAt: z.ZodNumber;
33
35
  taskName: z.ZodString;
@@ -45,6 +47,7 @@ export declare const HealthStateSchema: z.ZodUnion<readonly [z.ZodObject<{
45
47
  removePartialOrder: z.ZodBoolean;
46
48
  operationId: z.ZodUUID;
47
49
  healthScheduledAt: z.ZodNumber;
50
+ checkoutToken: z.ZodOptional<z.ZodString>;
48
51
  scheduleReceipt: z.ZodOptional<z.ZodObject<{
49
52
  recordedAt: z.ZodNumber;
50
53
  taskName: z.ZodString;
@@ -54,6 +57,7 @@ export declare const HealthStateSchema: z.ZodUnion<readonly [z.ZodObject<{
54
57
  removePartialOrder: z.ZodBoolean;
55
58
  operationId: z.ZodUUID;
56
59
  healthScheduledAt: z.ZodNumber;
60
+ checkoutToken: z.ZodOptional<z.ZodString>;
57
61
  scheduleReceipt: z.ZodOptional<z.ZodObject<{
58
62
  recordedAt: z.ZodNumber;
59
63
  taskName: z.ZodString;
@@ -65,6 +69,7 @@ export declare const HealthStateSchema: z.ZodUnion<readonly [z.ZodObject<{
65
69
  removePartialOrder: z.ZodBoolean;
66
70
  operationId: z.ZodUUID;
67
71
  healthScheduledAt: z.ZodNumber;
72
+ checkoutToken: z.ZodOptional<z.ZodString>;
68
73
  scheduleReceipt: z.ZodOptional<z.ZodObject<{
69
74
  recordedAt: z.ZodNumber;
70
75
  taskName: z.ZodString;
@@ -13,6 +13,7 @@ export declare const PostPurchasePlanOption: z.ZodObject<{
13
13
  percentage: "percentage";
14
14
  }>;
15
15
  }, z.core.$strip>>;
16
+ discountPercentage: z.ZodOptional<z.ZodNumber>;
16
17
  id: z.ZodNumber;
17
18
  intervalFrequency: z.ZodOptional<z.ZodString>;
18
19
  intervalLabel: z.ZodString;
@@ -30,6 +31,7 @@ export declare const PostPurchasePlanCatalog: z.ZodObject<{
30
31
  percentage: "percentage";
31
32
  }>;
32
33
  }, z.core.$strip>>;
34
+ discountPercentage: z.ZodOptional<z.ZodNumber>;
33
35
  id: z.ZodNumber;
34
36
  intervalFrequency: z.ZodOptional<z.ZodString>;
35
37
  intervalLabel: z.ZodString;
@@ -100,6 +100,7 @@ export declare const PreparedPostPurchaseProduct: z.ZodObject<{
100
100
  labels: z.ZodObject<{
101
101
  declineAll: z.ZodDefault<z.ZodOptional<z.ZodString>>;
102
102
  free: z.ZodString;
103
+ notAvailable: z.ZodDefault<z.ZodOptional<z.ZodString>>;
103
104
  payNow: z.ZodString;
104
105
  quantity: z.ZodString;
105
106
  recurringShipping: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -263,6 +264,7 @@ export declare const PostPurchasePreparation: z.ZodDiscriminatedUnion<[z.ZodObje
263
264
  labels: z.ZodObject<{
264
265
  declineAll: z.ZodDefault<z.ZodOptional<z.ZodString>>;
265
266
  free: z.ZodString;
267
+ notAvailable: z.ZodDefault<z.ZodOptional<z.ZodString>>;
266
268
  payNow: z.ZodString;
267
269
  quantity: z.ZodString;
268
270
  recurringShipping: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -5,6 +5,62 @@ export declare const PostPurchaseProductCollectionView: z.ZodObject<{
5
5
  productId: z.ZodNumber;
6
6
  productIndex: z.ZodNumber;
7
7
  view: z.ZodUnion<readonly [z.ZodObject<{
8
+ changeset: z.ZodOptional<z.ZodObject<{
9
+ changes: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
10
+ discount: z.ZodOptional<z.ZodObject<{
11
+ title: z.ZodString;
12
+ value: z.ZodNumber;
13
+ valueType: z.ZodEnum<{
14
+ fixed_amount: "fixed_amount";
15
+ percentage: "percentage";
16
+ }>;
17
+ }, z.core.$strip>>;
18
+ quantity: z.ZodNumber;
19
+ type: z.ZodLiteral<"add_variant">;
20
+ variantId: z.ZodNumber;
21
+ }, z.core.$strip>, z.ZodObject<{
22
+ price: z.ZodNumber;
23
+ title: z.ZodString;
24
+ type: z.ZodLiteral<"add_shipping_line">;
25
+ }, z.core.$strip>, z.ZodObject<{
26
+ initialShippingPrice: z.ZodNumber;
27
+ recurringShippingPrice: z.ZodNumber;
28
+ shippingOption: z.ZodObject<{
29
+ presentmentTitle: z.ZodString;
30
+ title: z.ZodString;
31
+ }, z.core.$strip>;
32
+ discount: z.ZodOptional<z.ZodObject<{
33
+ title: z.ZodString;
34
+ value: z.ZodNumber;
35
+ valueType: z.ZodEnum<{
36
+ fixed_amount: "fixed_amount";
37
+ percentage: "percentage";
38
+ }>;
39
+ }, z.core.$strip>>;
40
+ quantity: z.ZodNumber;
41
+ sellingPlanId: z.ZodNumber;
42
+ type: z.ZodLiteral<"add_subscription">;
43
+ variantId: z.ZodNumber;
44
+ }, z.core.$strip>]>>;
45
+ }, z.core.$strip>>;
46
+ displayPrice: z.ZodOptional<z.ZodObject<{
47
+ currencyCode: z.ZodString;
48
+ savingFormat: z.ZodEnum<{
49
+ amount: "amount";
50
+ percent: "percent";
51
+ }>;
52
+ savingMinor: z.ZodNumber;
53
+ savingPercent: z.ZodNumber;
54
+ subscriptionUnit: z.ZodOptional<z.ZodObject<{
55
+ comparisonMinor: z.ZodNumber;
56
+ currencyCode: z.ZodString;
57
+ priceMinor: z.ZodNumber;
58
+ savingMinor: z.ZodNumber;
59
+ savingPercent: z.ZodNumber;
60
+ }, z.core.$strip>>;
61
+ variantCompareAtPriceMinor: z.ZodNullable<z.ZodNumber>;
62
+ variantPriceMinor: z.ZodNumber;
63
+ }, z.core.$strip>>;
8
64
  groupCatalog: z.ZodOptional<z.ZodObject<{
9
65
  memberProductId: z.ZodNumber;
10
66
  options: z.ZodArray<z.ZodObject<{
@@ -48,6 +104,7 @@ export declare const PostPurchaseProductCollectionView: z.ZodObject<{
48
104
  percentage: "percentage";
49
105
  }>;
50
106
  }, z.core.$strip>>;
107
+ discountPercentage: z.ZodOptional<z.ZodNumber>;
51
108
  id: z.ZodNumber;
52
109
  intervalFrequency: z.ZodOptional<z.ZodString>;
53
110
  intervalLabel: z.ZodString;
@@ -61,6 +118,7 @@ export declare const PostPurchaseProductCollectionView: z.ZodObject<{
61
118
  labels: z.ZodObject<{
62
119
  declineAll: z.ZodDefault<z.ZodOptional<z.ZodString>>;
63
120
  free: z.ZodString;
121
+ notAvailable: z.ZodDefault<z.ZodOptional<z.ZodString>>;
64
122
  payNow: z.ZodString;
65
123
  quantity: z.ZodString;
66
124
  recurringShipping: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -656,6 +714,9 @@ export declare const PostPurchaseProductCollectionView: z.ZodObject<{
656
714
  initialVariant: z.ZodOptional<z.ZodObject<{
657
715
  variantId: z.ZodNumber;
658
716
  }, z.core.$strict>>;
717
+ labels: z.ZodOptional<z.ZodObject<{
718
+ notAvailable: z.ZodDefault<z.ZodOptional<z.ZodString>>;
719
+ }, z.core.$strip>>;
659
720
  planCatalog: z.ZodOptional<z.ZodNullable<z.ZodObject<{
660
721
  plans: z.ZodArray<z.ZodObject<{
661
722
  adjustment: z.ZodOptional<z.ZodObject<{
@@ -666,6 +727,7 @@ export declare const PostPurchaseProductCollectionView: z.ZodObject<{
666
727
  percentage: "percentage";
667
728
  }>;
668
729
  }, z.core.$strip>>;
730
+ discountPercentage: z.ZodOptional<z.ZodNumber>;
669
731
  id: z.ZodNumber;
670
732
  intervalFrequency: z.ZodOptional<z.ZodString>;
671
733
  intervalLabel: z.ZodString;
@@ -2,8 +2,67 @@ import { z } from 'zod';
2
2
  /**
3
3
  * A prepared view shows exactly one description: plain `description`, or — when the merchant's rich
4
4
  * description wins the precedence — `description: null` with the standard-shape `descriptionDocument`.
5
+ * Only a prepared view may carry `changeset`: the unsigned changeset the server derived from this very
6
+ * preparation (the one admission later rebuilds and signs), ready for Shopify's `calculateChangeset`, and
7
+ * `displayPrice`: the display pricing worked out from that same preparation.
5
8
  */
6
9
  export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
10
+ changeset: z.ZodOptional<z.ZodObject<{
11
+ changes: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
12
+ discount: z.ZodOptional<z.ZodObject<{
13
+ title: z.ZodString;
14
+ value: z.ZodNumber;
15
+ valueType: z.ZodEnum<{
16
+ fixed_amount: "fixed_amount";
17
+ percentage: "percentage";
18
+ }>;
19
+ }, z.core.$strip>>;
20
+ quantity: z.ZodNumber;
21
+ type: z.ZodLiteral<"add_variant">;
22
+ variantId: z.ZodNumber;
23
+ }, z.core.$strip>, z.ZodObject<{
24
+ price: z.ZodNumber;
25
+ title: z.ZodString;
26
+ type: z.ZodLiteral<"add_shipping_line">;
27
+ }, z.core.$strip>, z.ZodObject<{
28
+ initialShippingPrice: z.ZodNumber;
29
+ recurringShippingPrice: z.ZodNumber;
30
+ shippingOption: z.ZodObject<{
31
+ presentmentTitle: z.ZodString;
32
+ title: z.ZodString;
33
+ }, z.core.$strip>;
34
+ discount: z.ZodOptional<z.ZodObject<{
35
+ title: z.ZodString;
36
+ value: z.ZodNumber;
37
+ valueType: z.ZodEnum<{
38
+ fixed_amount: "fixed_amount";
39
+ percentage: "percentage";
40
+ }>;
41
+ }, z.core.$strip>>;
42
+ quantity: z.ZodNumber;
43
+ sellingPlanId: z.ZodNumber;
44
+ type: z.ZodLiteral<"add_subscription">;
45
+ variantId: z.ZodNumber;
46
+ }, z.core.$strip>]>>;
47
+ }, z.core.$strip>>;
48
+ displayPrice: z.ZodOptional<z.ZodObject<{
49
+ currencyCode: z.ZodString;
50
+ savingFormat: z.ZodEnum<{
51
+ amount: "amount";
52
+ percent: "percent";
53
+ }>;
54
+ savingMinor: z.ZodNumber;
55
+ savingPercent: z.ZodNumber;
56
+ subscriptionUnit: z.ZodOptional<z.ZodObject<{
57
+ comparisonMinor: z.ZodNumber;
58
+ currencyCode: z.ZodString;
59
+ priceMinor: z.ZodNumber;
60
+ savingMinor: z.ZodNumber;
61
+ savingPercent: z.ZodNumber;
62
+ }, z.core.$strip>>;
63
+ variantCompareAtPriceMinor: z.ZodNullable<z.ZodNumber>;
64
+ variantPriceMinor: z.ZodNumber;
65
+ }, z.core.$strip>>;
7
66
  groupCatalog: z.ZodOptional<z.ZodObject<{
8
67
  memberProductId: z.ZodNumber;
9
68
  options: z.ZodArray<z.ZodObject<{
@@ -47,6 +106,7 @@ export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
47
106
  percentage: "percentage";
48
107
  }>;
49
108
  }, z.core.$strip>>;
109
+ discountPercentage: z.ZodOptional<z.ZodNumber>;
50
110
  id: z.ZodNumber;
51
111
  intervalFrequency: z.ZodOptional<z.ZodString>;
52
112
  intervalLabel: z.ZodString;
@@ -60,6 +120,7 @@ export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
60
120
  labels: z.ZodObject<{
61
121
  declineAll: z.ZodDefault<z.ZodOptional<z.ZodString>>;
62
122
  free: z.ZodString;
123
+ notAvailable: z.ZodDefault<z.ZodOptional<z.ZodString>>;
63
124
  payNow: z.ZodString;
64
125
  quantity: z.ZodString;
65
126
  recurringShipping: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -655,6 +716,9 @@ export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
655
716
  initialVariant: z.ZodOptional<z.ZodObject<{
656
717
  variantId: z.ZodNumber;
657
718
  }, z.core.$strict>>;
719
+ labels: z.ZodOptional<z.ZodObject<{
720
+ notAvailable: z.ZodDefault<z.ZodOptional<z.ZodString>>;
721
+ }, z.core.$strip>>;
658
722
  planCatalog: z.ZodOptional<z.ZodNullable<z.ZodObject<{
659
723
  plans: z.ZodArray<z.ZodObject<{
660
724
  adjustment: z.ZodOptional<z.ZodObject<{
@@ -665,6 +729,7 @@ export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
665
729
  percentage: "percentage";
666
730
  }>;
667
731
  }, z.core.$strip>>;
732
+ discountPercentage: z.ZodOptional<z.ZodNumber>;
668
733
  id: z.ZodNumber;
669
734
  intervalFrequency: z.ZodOptional<z.ZodString>;
670
735
  intervalLabel: z.ZodString;
@@ -39,6 +39,53 @@ export declare const PurchaseRecoveryResponseSchema: z.ZodObject<{
39
39
  recordedAt: z.ZodNumber;
40
40
  }, z.core.$strict>>;
41
41
  operationId: z.ZodUUID;
42
+ upgrade: z.ZodOptional<z.ZodObject<{
43
+ compensation: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
44
+ attemptedAt: z.ZodNumber;
45
+ status: z.ZodLiteral<"attempted">;
46
+ }, z.core.$strict>, z.ZodObject<{
47
+ attemptedAt: z.ZodNumber;
48
+ finishedAt: z.ZodNumber;
49
+ status: z.ZodEnum<{
50
+ unknown: "unknown";
51
+ failed: "failed";
52
+ removed: "removed";
53
+ }>;
54
+ }, z.core.$strict>]>>;
55
+ operationId: z.ZodUUID;
56
+ refund: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
57
+ attemptedAt: z.ZodNumber;
58
+ status: z.ZodLiteral<"attempted">;
59
+ }, z.core.$strict>, z.ZodObject<{
60
+ attemptedAt: z.ZodNumber;
61
+ finishedAt: z.ZodNumber;
62
+ refundId: z.ZodString;
63
+ status: z.ZodLiteral<"refunded">;
64
+ }, z.core.$strict>, z.ZodObject<{
65
+ attemptedAt: z.ZodNumber;
66
+ finishedAt: z.ZodNumber;
67
+ status: z.ZodEnum<{
68
+ unknown: "unknown";
69
+ failed: "failed";
70
+ }>;
71
+ }, z.core.$strict>]>>;
72
+ review: z.ZodNullable<z.ZodObject<{
73
+ markedAt: z.ZodNumber;
74
+ marker: z.ZodUnion<readonly [z.ZodEnum<{
75
+ unknown: "unknown";
76
+ acknowledged: "acknowledged";
77
+ rejected: "rejected";
78
+ }>, z.ZodEnum<{
79
+ attempted: "attempted";
80
+ unavailable: "unavailable";
81
+ }>]>;
82
+ reason: z.ZodEnum<{
83
+ "refund-unknown": "refund-unknown";
84
+ "compensation-failed": "compensation-failed";
85
+ "compensation-unknown": "compensation-unknown";
86
+ }>;
87
+ }, z.core.$strict>>;
88
+ }, z.core.$strict>>;
42
89
  }, z.core.$strict>>;
43
90
  progress: z.ZodOptional<z.ZodNullable<z.ZodObject<{
44
91
  closedAt: z.ZodNullable<z.ZodNumber>;
@@ -93,6 +93,7 @@ export declare const PreparedPostPurchaseSubscription: z.ZodObject<{
93
93
  labels: z.ZodObject<{
94
94
  declineAll: z.ZodDefault<z.ZodOptional<z.ZodString>>;
95
95
  free: z.ZodString;
96
+ notAvailable: z.ZodDefault<z.ZodOptional<z.ZodString>>;
96
97
  payNow: z.ZodString;
97
98
  quantity: z.ZodString;
98
99
  recurringShipping: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -245,6 +246,7 @@ export declare const readPostPurchaseSubscription: (prepared: z.infer<typeof Pre
245
246
  labels: {
246
247
  declineAll: string;
247
248
  free: string;
249
+ notAvailable: string;
248
250
  payNow: string;
249
251
  quantity: string;
250
252
  recurringShipping: string;
@@ -0,0 +1,117 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * apiv2 `refund-product` for the upgrade's original one-time line. `failed` is a known refusal (nothing was
4
+ * refunded); `unknown` is a lost or ambiguous answer, which is never retried and never compensated blindly.
5
+ */
6
+ export declare const UpgradeRefundProgressSchema: z.ZodUnion<readonly [z.ZodObject<{
7
+ attemptedAt: z.ZodNumber;
8
+ status: z.ZodLiteral<"attempted">;
9
+ }, z.core.$strict>, z.ZodObject<{
10
+ attemptedAt: z.ZodNumber;
11
+ finishedAt: z.ZodNumber;
12
+ refundId: z.ZodString;
13
+ status: z.ZodLiteral<"refunded">;
14
+ }, z.core.$strict>, z.ZodObject<{
15
+ attemptedAt: z.ZodNumber;
16
+ finishedAt: z.ZodNumber;
17
+ status: z.ZodEnum<{
18
+ unknown: "unknown";
19
+ failed: "failed";
20
+ }>;
21
+ }, z.core.$strict>]>;
22
+ /** apiv2 `remove-subscription-product`: the rollback that runs only after a known refund failure. */
23
+ export declare const UpgradeCompensationProgressSchema: z.ZodUnion<readonly [z.ZodObject<{
24
+ attemptedAt: z.ZodNumber;
25
+ status: z.ZodLiteral<"attempted">;
26
+ }, z.core.$strict>, z.ZodObject<{
27
+ attemptedAt: z.ZodNumber;
28
+ finishedAt: z.ZodNumber;
29
+ status: z.ZodEnum<{
30
+ unknown: "unknown";
31
+ failed: "failed";
32
+ removed: "removed";
33
+ }>;
34
+ }, z.core.$strict>]>;
35
+ /**
36
+ * Why the upgrade is left for a person; `marker` is the `subscription_rollback_failed` metafield write. A
37
+ * `marker` of `unavailable` means the marker could not be written, NOT that no review is needed: the review
38
+ * stands whatever the marker status.
39
+ */
40
+ export declare const UpgradeReviewReasonSchema: z.ZodEnum<{
41
+ "refund-unknown": "refund-unknown";
42
+ "compensation-failed": "compensation-failed";
43
+ "compensation-unknown": "compensation-unknown";
44
+ }>;
45
+ export declare const UpgradeReviewProgressSchema: z.ZodObject<{
46
+ markedAt: z.ZodNumber;
47
+ marker: z.ZodUnion<readonly [z.ZodEnum<{
48
+ unknown: "unknown";
49
+ acknowledged: "acknowledged";
50
+ rejected: "rejected";
51
+ }>, z.ZodEnum<{
52
+ attempted: "attempted";
53
+ unavailable: "unavailable";
54
+ }>]>;
55
+ reason: z.ZodEnum<{
56
+ "refund-unknown": "refund-unknown";
57
+ "compensation-failed": "compensation-failed";
58
+ "compensation-unknown": "compensation-unknown";
59
+ }>;
60
+ }, z.core.$strict>;
61
+ /**
62
+ * The refund-compensation saga of one admitted upgrade, `null` steps not yet started. Compensation follows a
63
+ * known refund failure only, and a review is recorded exactly when the outcome is unresolved (an unknown
64
+ * refund, or a failed or unknown rollback), so a compensated or unresolved upgrade never reads as upgraded.
65
+ */
66
+ export declare const UpgradeProgressSchema: z.ZodObject<{
67
+ compensation: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
68
+ attemptedAt: z.ZodNumber;
69
+ status: z.ZodLiteral<"attempted">;
70
+ }, z.core.$strict>, z.ZodObject<{
71
+ attemptedAt: z.ZodNumber;
72
+ finishedAt: z.ZodNumber;
73
+ status: z.ZodEnum<{
74
+ unknown: "unknown";
75
+ failed: "failed";
76
+ removed: "removed";
77
+ }>;
78
+ }, z.core.$strict>]>>;
79
+ operationId: z.ZodUUID;
80
+ refund: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
81
+ attemptedAt: z.ZodNumber;
82
+ status: z.ZodLiteral<"attempted">;
83
+ }, z.core.$strict>, z.ZodObject<{
84
+ attemptedAt: z.ZodNumber;
85
+ finishedAt: z.ZodNumber;
86
+ refundId: z.ZodString;
87
+ status: z.ZodLiteral<"refunded">;
88
+ }, z.core.$strict>, z.ZodObject<{
89
+ attemptedAt: z.ZodNumber;
90
+ finishedAt: z.ZodNumber;
91
+ status: z.ZodEnum<{
92
+ unknown: "unknown";
93
+ failed: "failed";
94
+ }>;
95
+ }, z.core.$strict>]>>;
96
+ review: z.ZodNullable<z.ZodObject<{
97
+ markedAt: z.ZodNumber;
98
+ marker: z.ZodUnion<readonly [z.ZodEnum<{
99
+ unknown: "unknown";
100
+ acknowledged: "acknowledged";
101
+ rejected: "rejected";
102
+ }>, z.ZodEnum<{
103
+ attempted: "attempted";
104
+ unavailable: "unavailable";
105
+ }>]>;
106
+ reason: z.ZodEnum<{
107
+ "refund-unknown": "refund-unknown";
108
+ "compensation-failed": "compensation-failed";
109
+ "compensation-unknown": "compensation-unknown";
110
+ }>;
111
+ }, z.core.$strict>>;
112
+ }, z.core.$strict>;
113
+ export type UpgradeCompensationProgress = z.infer<typeof UpgradeCompensationProgressSchema>;
114
+ export type UpgradeProgress = z.infer<typeof UpgradeProgressSchema>;
115
+ export type UpgradeRefundProgress = z.infer<typeof UpgradeRefundProgressSchema>;
116
+ export type UpgradeReviewProgress = z.infer<typeof UpgradeReviewProgressSchema>;
117
+ export type UpgradeReviewReason = z.infer<typeof UpgradeReviewReasonSchema>;