@rebuy/rebuy 3.42.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.
- package/dist/index.cjs +899 -781
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +899 -781
- package/dist/pricing/index.cjs +58 -1
- package/dist/pricing/index.d.ts +2 -0
- package/dist/pricing/index.mjs +58 -1
- package/dist/pricing/postPurchaseDisplayFacts.d.ts +36 -0
- package/dist/pricing/postPurchaseDisplayPrice.d.ts +8 -0
- package/dist/pricing/postPurchaseReduction.d.ts +17 -0
- package/dist/schema/checkout-and-beyond/constants.cjs +4 -0
- package/dist/schema/checkout-and-beyond/constants.mjs +4 -0
- package/dist/schema/checkout-and-beyond/index.cjs +388 -374
- package/dist/schema/checkout-and-beyond/index.mjs +388 -374
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/postPurchaseDisplayPrice.d.ts +31 -0
- package/dist/schema/postPurchaseHealth.d.ts +5 -0
- package/dist/schema/postPurchasePlanCatalog.d.ts +2 -0
- package/dist/schema/postPurchaseProduct.d.ts +2 -0
- package/dist/schema/postPurchaseProductCollectionView.d.ts +24 -0
- package/dist/schema/postPurchaseProductView.d.ts +26 -1
- package/dist/schema/postPurchaseSubscriptionProduct.d.ts +2 -0
- package/dist/schema/widget-data.cjs +452 -441
- package/dist/schema/widget-data.mjs +452 -441
- package/dist/schema/widgets/checkout-and-beyond/common.d.ts +14 -0
- package/dist/schema/widgets/checkout-and-beyond/image.d.ts +8 -0
- package/dist/schema/widgets/checkout-and-beyond/imageThumbnails.d.ts +13 -0
- package/dist/schema/widgets/checkout-and-beyond/index.d.ts +1 -0
- package/dist/schema/widgets/checkout-and-beyond/variants.d.ts +1 -0
- package/dist/server/index.cjs +1653 -1364
- package/dist/server/index.mjs +1575 -1286
- package/dist/server/postPurchasePlanCatalog.d.ts +4 -1
- package/dist/server/preparePostPurchaseAdmissionView.d.ts +21 -0
- package/dist/server/preparePostPurchaseCollectionGroup.d.ts +25 -0
- package/dist/server/preparePostPurchaseCollectionView.d.ts +21 -0
- package/dist/server/preparePostPurchaseGroupAdmissionView.d.ts +21 -0
- package/dist/server/preparePostPurchaseGroupDefault.d.ts +21 -0
- package/dist/server/preparePostPurchaseGroupView.d.ts +21 -0
- package/dist/server/preparePostPurchaseMemberView.d.ts +63 -0
- package/dist/server/preparePostPurchaseQuantityAdmissionView.d.ts +21 -0
- package/dist/server/preparePostPurchaseQuantityView.d.ts +21 -0
- package/dist/server/preparePostPurchaseSubscription.d.ts +1 -0
- package/dist/server/selectPostPurchaseChoice.d.ts +1 -0
- package/dist/transforms/index.cjs +980 -581
- package/dist/transforms/index.mjs +980 -581
- package/dist/transforms/postPurchase/convertProductInformation.d.ts +6 -2
- package/dist/transforms/postPurchase/productCardControls.d.ts +7 -0
- package/dist/transforms/postPurchase/productCardCosts.d.ts +3 -0
- package/dist/transforms/postPurchase/productCardPricing.d.ts +3 -0
- package/dist/transforms/postPurchase/productCardRows.d.ts +63 -0
- package/dist/transforms/postPurchase/productCardSettings.d.ts +103 -0
- package/dist/transforms/postPurchase/types.d.ts +2 -2
- package/dist/transforms/productCard/earnedText.d.ts +25 -0
- package/dist/transforms/productCard/priceText.d.ts +2 -0
- package/dist/transforms/productCard/quantitySection.d.ts +28 -0
- package/dist/transforms/productCard/subscriptionToggle.d.ts +18 -0
- package/package.json +1 -1
package/dist/schema/index.d.ts
CHANGED
|
@@ -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';
|
|
@@ -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>;
|
|
@@ -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>>;
|
|
@@ -43,6 +43,24 @@ export declare const PostPurchaseProductCollectionView: z.ZodObject<{
|
|
|
43
43
|
variantId: z.ZodNumber;
|
|
44
44
|
}, z.core.$strip>]>>;
|
|
45
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>>;
|
|
46
64
|
groupCatalog: z.ZodOptional<z.ZodObject<{
|
|
47
65
|
memberProductId: z.ZodNumber;
|
|
48
66
|
options: z.ZodArray<z.ZodObject<{
|
|
@@ -86,6 +104,7 @@ export declare const PostPurchaseProductCollectionView: z.ZodObject<{
|
|
|
86
104
|
percentage: "percentage";
|
|
87
105
|
}>;
|
|
88
106
|
}, z.core.$strip>>;
|
|
107
|
+
discountPercentage: z.ZodOptional<z.ZodNumber>;
|
|
89
108
|
id: z.ZodNumber;
|
|
90
109
|
intervalFrequency: z.ZodOptional<z.ZodString>;
|
|
91
110
|
intervalLabel: z.ZodString;
|
|
@@ -99,6 +118,7 @@ export declare const PostPurchaseProductCollectionView: z.ZodObject<{
|
|
|
99
118
|
labels: z.ZodObject<{
|
|
100
119
|
declineAll: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
101
120
|
free: z.ZodString;
|
|
121
|
+
notAvailable: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
102
122
|
payNow: z.ZodString;
|
|
103
123
|
quantity: z.ZodString;
|
|
104
124
|
recurringShipping: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -694,6 +714,9 @@ export declare const PostPurchaseProductCollectionView: z.ZodObject<{
|
|
|
694
714
|
initialVariant: z.ZodOptional<z.ZodObject<{
|
|
695
715
|
variantId: z.ZodNumber;
|
|
696
716
|
}, z.core.$strict>>;
|
|
717
|
+
labels: z.ZodOptional<z.ZodObject<{
|
|
718
|
+
notAvailable: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
719
|
+
}, z.core.$strip>>;
|
|
697
720
|
planCatalog: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
698
721
|
plans: z.ZodArray<z.ZodObject<{
|
|
699
722
|
adjustment: z.ZodOptional<z.ZodObject<{
|
|
@@ -704,6 +727,7 @@ export declare const PostPurchaseProductCollectionView: z.ZodObject<{
|
|
|
704
727
|
percentage: "percentage";
|
|
705
728
|
}>;
|
|
706
729
|
}, z.core.$strip>>;
|
|
730
|
+
discountPercentage: z.ZodOptional<z.ZodNumber>;
|
|
707
731
|
id: z.ZodNumber;
|
|
708
732
|
intervalFrequency: z.ZodOptional<z.ZodString>;
|
|
709
733
|
intervalLabel: z.ZodString;
|
|
@@ -3,7 +3,8 @@ import { z } from 'zod';
|
|
|
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
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
|
|
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.
|
|
7
8
|
*/
|
|
8
9
|
export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
|
|
9
10
|
changeset: z.ZodOptional<z.ZodObject<{
|
|
@@ -44,6 +45,24 @@ export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
44
45
|
variantId: z.ZodNumber;
|
|
45
46
|
}, z.core.$strip>]>>;
|
|
46
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>>;
|
|
47
66
|
groupCatalog: z.ZodOptional<z.ZodObject<{
|
|
48
67
|
memberProductId: z.ZodNumber;
|
|
49
68
|
options: z.ZodArray<z.ZodObject<{
|
|
@@ -87,6 +106,7 @@ export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
87
106
|
percentage: "percentage";
|
|
88
107
|
}>;
|
|
89
108
|
}, z.core.$strip>>;
|
|
109
|
+
discountPercentage: z.ZodOptional<z.ZodNumber>;
|
|
90
110
|
id: z.ZodNumber;
|
|
91
111
|
intervalFrequency: z.ZodOptional<z.ZodString>;
|
|
92
112
|
intervalLabel: z.ZodString;
|
|
@@ -100,6 +120,7 @@ export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
100
120
|
labels: z.ZodObject<{
|
|
101
121
|
declineAll: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
102
122
|
free: z.ZodString;
|
|
123
|
+
notAvailable: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
103
124
|
payNow: z.ZodString;
|
|
104
125
|
quantity: z.ZodString;
|
|
105
126
|
recurringShipping: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
@@ -695,6 +716,9 @@ export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
695
716
|
initialVariant: z.ZodOptional<z.ZodObject<{
|
|
696
717
|
variantId: z.ZodNumber;
|
|
697
718
|
}, z.core.$strict>>;
|
|
719
|
+
labels: z.ZodOptional<z.ZodObject<{
|
|
720
|
+
notAvailable: z.ZodDefault<z.ZodOptional<z.ZodString>>;
|
|
721
|
+
}, z.core.$strip>>;
|
|
698
722
|
planCatalog: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
699
723
|
plans: z.ZodArray<z.ZodObject<{
|
|
700
724
|
adjustment: z.ZodOptional<z.ZodObject<{
|
|
@@ -705,6 +729,7 @@ export declare const PostPurchaseProductView: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
705
729
|
percentage: "percentage";
|
|
706
730
|
}>;
|
|
707
731
|
}, z.core.$strip>>;
|
|
732
|
+
discountPercentage: z.ZodOptional<z.ZodNumber>;
|
|
708
733
|
id: z.ZodNumber;
|
|
709
734
|
intervalFrequency: z.ZodOptional<z.ZodString>;
|
|
710
735
|
intervalLabel: z.ZodString;
|
|
@@ -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;
|