@rebuy/rebuy 3.29.1 → 3.30.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 +1536 -1343
- package/dist/index.mjs +1533 -1340
- package/dist/schema/index.d.ts +7 -0
- package/dist/schema/postPurchaseProductCollectionView.d.ts +8 -0
- package/dist/schema/postPurchaseProductDisplay.d.ts +59 -0
- package/dist/schema/postPurchaseProductGallery.d.ts +11 -0
- package/dist/schema/postPurchaseProductSettings.d.ts +117 -0
- package/dist/schema/postPurchaseProductSource.d.ts +65 -0
- package/dist/schema/postPurchaseVariantCatalog.d.ts +41 -0
- package/dist/schema/postPurchaseVariantDefault.d.ts +36 -0
- package/dist/schema/shopConfig.d.ts +2 -2
- package/dist/schema/userConfig.d.ts +2 -2
- package/dist/schema/widgetData.d.ts +2 -2
- package/dist/schema/widgets/checkout-and-beyond/banner.d.ts +29 -29
- package/dist/schema/widgets/checkout-and-beyond/carousel.d.ts +29 -29
- package/dist/schema/widgets/checkout-and-beyond/cartLine.d.ts +29 -29
- package/dist/schema/widgets/checkout-and-beyond/common.d.ts +5 -5
- package/dist/schema/widgets/checkout-and-beyond/offers.d.ts +29 -29
- package/dist/schema/widgets/checkout-and-beyond/progressBar.d.ts +29 -29
- package/dist/schema/widgets/checkout-and-beyond/root.d.ts +1 -1
- package/dist/schema/widgets/contentBlock.d.ts +4 -4
- package/dist/schema/widgets/post-purchase-offer/constants.d.ts +4 -4
- package/dist/schema/widgets/post-purchase-offer/postPurchaseBlocks.d.ts +2 -2
- package/dist/schema/widgets/post-purchase-offer/postPurchaseOffer.d.ts +2 -2
- package/dist/schema/widgets/post-purchase-offer/postPurchaseSettings.d.ts +2 -2
- package/dist/schema/widgets/post-purchase-offer/postPurchaseWidget.d.ts +2 -2
- package/dist/server/__fixtures__/postPurchaseProduct.d.ts +137 -0
- package/dist/server/__fixtures__/postPurchaseVariantDefaults.d.ts +26 -0
- package/dist/server/__fixtures__/postPurchaseVariants.d.ts +47 -0
- package/dist/server/matchPostPurchaseVariantDefault.d.ts +17 -0
- package/dist/server/normalizePostPurchaseCollection.d.ts +250 -0
- package/dist/server/normalizePostPurchaseProduct.d.ts +202 -0
- package/dist/server/postPurchasePrimaryImage.d.ts +6 -0
- package/dist/server/postPurchaseProductDisplay.d.ts +41 -0
- package/dist/server/postPurchaseProductEligibility.d.ts +8 -0
- package/dist/server/postPurchaseProductGallery.d.ts +5 -0
- package/dist/server/postPurchaseVariantAvailable.d.ts +12 -0
- package/dist/server/postPurchaseVariantCatalog.d.ts +3 -0
- package/dist/server/projectPostPurchaseProduct.d.ts +127 -0
- package/dist/server/resolvePostPurchaseVariantDefault.d.ts +10 -0
- package/dist/transforms/postPurchase/imageContentSettings.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { PostPurchaseExcludedProductIds } from '../schema/postPurchaseProductCollectionView';
|
|
2
|
+
/** Preserve the original capped positions before applying product-wide exclusions. */
|
|
3
|
+
export declare const normalizePostPurchaseCollection: (settings: unknown, response: unknown, excludedProductIds?: PostPurchaseExcludedProductIds) => {
|
|
4
|
+
members: {
|
|
5
|
+
product: {
|
|
6
|
+
title: string;
|
|
7
|
+
id: number;
|
|
8
|
+
productGroupVariants: unknown[];
|
|
9
|
+
variants: {
|
|
10
|
+
title: string;
|
|
11
|
+
compareAtPrice: string | null;
|
|
12
|
+
id: number;
|
|
13
|
+
inventoryManagement: string | null;
|
|
14
|
+
inventoryPolicy: string;
|
|
15
|
+
inventoryQuantity: number;
|
|
16
|
+
price: string;
|
|
17
|
+
productId: number;
|
|
18
|
+
imageId?: number | null | undefined;
|
|
19
|
+
option1?: unknown;
|
|
20
|
+
option2?: unknown;
|
|
21
|
+
option3?: unknown;
|
|
22
|
+
sellingPlanAllocations?: unknown;
|
|
23
|
+
}[];
|
|
24
|
+
image?: {
|
|
25
|
+
src: string;
|
|
26
|
+
} | null | undefined;
|
|
27
|
+
description?: string | null | undefined;
|
|
28
|
+
images?: {
|
|
29
|
+
id: number;
|
|
30
|
+
src: string;
|
|
31
|
+
alt?: string | undefined;
|
|
32
|
+
}[] | null | undefined;
|
|
33
|
+
metadata?: {
|
|
34
|
+
productQuantity?: number | undefined;
|
|
35
|
+
} | undefined;
|
|
36
|
+
metafields?: unknown;
|
|
37
|
+
options?: unknown;
|
|
38
|
+
selectedVariant?: unknown;
|
|
39
|
+
sellingPlanGroups?: {
|
|
40
|
+
requiresSellingPlan?: boolean | undefined;
|
|
41
|
+
discountAmount?: unknown;
|
|
42
|
+
discountType?: unknown;
|
|
43
|
+
id?: unknown;
|
|
44
|
+
sellingPlans?: unknown;
|
|
45
|
+
}[] | undefined;
|
|
46
|
+
};
|
|
47
|
+
productIndex: number;
|
|
48
|
+
}[];
|
|
49
|
+
normalized: {
|
|
50
|
+
data: {
|
|
51
|
+
title: string;
|
|
52
|
+
id: number;
|
|
53
|
+
productGroupVariants: unknown[];
|
|
54
|
+
variants: {
|
|
55
|
+
title: string;
|
|
56
|
+
compareAtPrice: string | null;
|
|
57
|
+
id: number;
|
|
58
|
+
inventoryManagement: string | null;
|
|
59
|
+
inventoryPolicy: string;
|
|
60
|
+
inventoryQuantity: number;
|
|
61
|
+
price: string;
|
|
62
|
+
productId: number;
|
|
63
|
+
imageId?: number | null | undefined;
|
|
64
|
+
option1?: unknown;
|
|
65
|
+
option2?: unknown;
|
|
66
|
+
option3?: unknown;
|
|
67
|
+
sellingPlanAllocations?: unknown;
|
|
68
|
+
}[];
|
|
69
|
+
image?: {
|
|
70
|
+
src: string;
|
|
71
|
+
} | null | undefined;
|
|
72
|
+
description?: string | null | undefined;
|
|
73
|
+
images?: {
|
|
74
|
+
id: number;
|
|
75
|
+
src: string;
|
|
76
|
+
alt?: string | undefined;
|
|
77
|
+
}[] | null | undefined;
|
|
78
|
+
metadata?: {
|
|
79
|
+
productQuantity?: number | undefined;
|
|
80
|
+
} | undefined;
|
|
81
|
+
metafields?: unknown;
|
|
82
|
+
options?: unknown;
|
|
83
|
+
selectedVariant?: unknown;
|
|
84
|
+
sellingPlanGroups?: {
|
|
85
|
+
requiresSellingPlan?: boolean | undefined;
|
|
86
|
+
discountAmount?: unknown;
|
|
87
|
+
discountType?: unknown;
|
|
88
|
+
id?: unknown;
|
|
89
|
+
sellingPlans?: unknown;
|
|
90
|
+
}[] | undefined;
|
|
91
|
+
}[];
|
|
92
|
+
effective: {
|
|
93
|
+
language: {
|
|
94
|
+
description: string;
|
|
95
|
+
descriptionEnabled: boolean;
|
|
96
|
+
displayCtaPrice: boolean;
|
|
97
|
+
global: {
|
|
98
|
+
declineAll: string;
|
|
99
|
+
declineThisOffer: string;
|
|
100
|
+
free: string;
|
|
101
|
+
notAvailable: string;
|
|
102
|
+
payNow: string;
|
|
103
|
+
payNowUpgradeToSubscription: string;
|
|
104
|
+
quantity: string;
|
|
105
|
+
recurringShipping: string;
|
|
106
|
+
recurringSubtotal: string;
|
|
107
|
+
reviewsPlural: string;
|
|
108
|
+
reviewsSingular: string;
|
|
109
|
+
save: string;
|
|
110
|
+
shipping: string;
|
|
111
|
+
subscriptionOption: string;
|
|
112
|
+
subtotal: string;
|
|
113
|
+
taxes: string;
|
|
114
|
+
total: string;
|
|
115
|
+
};
|
|
116
|
+
globalTranslation: string;
|
|
117
|
+
descriptionRte?: {
|
|
118
|
+
content: unknown[];
|
|
119
|
+
type: string;
|
|
120
|
+
} | undefined;
|
|
121
|
+
descriptionSpacing?: "default" | "none" | "tight" | "loose" | "xtight" | "xloose" | undefined;
|
|
122
|
+
};
|
|
123
|
+
productType: string;
|
|
124
|
+
discountedFrom: "price" | "compare_at_price";
|
|
125
|
+
productLimit: number;
|
|
126
|
+
productOptions: {
|
|
127
|
+
hideOutOfStockVariants: boolean;
|
|
128
|
+
matchVariant: boolean;
|
|
129
|
+
showShipping: boolean;
|
|
130
|
+
showSubtotal: boolean;
|
|
131
|
+
showTaxes: boolean;
|
|
132
|
+
showTotal: boolean;
|
|
133
|
+
showVariantSelectors: boolean;
|
|
134
|
+
variantSelectorDisplayMode: "single" | "separate";
|
|
135
|
+
showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
|
|
136
|
+
};
|
|
137
|
+
productTypeSelector: "radio" | "dropdown";
|
|
138
|
+
quantityInputs: {
|
|
139
|
+
defaultQuantity: number;
|
|
140
|
+
enabled: boolean;
|
|
141
|
+
maxValue: number;
|
|
142
|
+
minValue: number;
|
|
143
|
+
};
|
|
144
|
+
upgradeToSubscription: {
|
|
145
|
+
acceptButtonText: string;
|
|
146
|
+
allow: boolean;
|
|
147
|
+
emailRefundNotice: boolean;
|
|
148
|
+
errorBannerText: string;
|
|
149
|
+
};
|
|
150
|
+
advance: unknown;
|
|
151
|
+
discount: {
|
|
152
|
+
shouldShowSavingText: boolean;
|
|
153
|
+
type: "none" | "percentage" | "fixed_amount";
|
|
154
|
+
amount: number;
|
|
155
|
+
};
|
|
156
|
+
integrations: unknown;
|
|
157
|
+
shipping: {
|
|
158
|
+
enabled: boolean;
|
|
159
|
+
title: string;
|
|
160
|
+
type: "fixed_amount" | "free";
|
|
161
|
+
amount: number;
|
|
162
|
+
};
|
|
163
|
+
styles: unknown;
|
|
164
|
+
subImages: number | null;
|
|
165
|
+
subscription: unknown;
|
|
166
|
+
subscriptionIsDefault?: boolean | undefined;
|
|
167
|
+
blocks?: unknown[] | undefined;
|
|
168
|
+
};
|
|
169
|
+
metadata: {
|
|
170
|
+
widget: Record<string, unknown>;
|
|
171
|
+
};
|
|
172
|
+
original: {
|
|
173
|
+
language: {
|
|
174
|
+
description: string;
|
|
175
|
+
descriptionEnabled: boolean;
|
|
176
|
+
displayCtaPrice: boolean;
|
|
177
|
+
global: {
|
|
178
|
+
declineAll: string;
|
|
179
|
+
declineThisOffer: string;
|
|
180
|
+
free: string;
|
|
181
|
+
notAvailable: string;
|
|
182
|
+
payNow: string;
|
|
183
|
+
payNowUpgradeToSubscription: string;
|
|
184
|
+
quantity: string;
|
|
185
|
+
recurringShipping: string;
|
|
186
|
+
recurringSubtotal: string;
|
|
187
|
+
reviewsPlural: string;
|
|
188
|
+
reviewsSingular: string;
|
|
189
|
+
save: string;
|
|
190
|
+
shipping: string;
|
|
191
|
+
subscriptionOption: string;
|
|
192
|
+
subtotal: string;
|
|
193
|
+
taxes: string;
|
|
194
|
+
total: string;
|
|
195
|
+
};
|
|
196
|
+
globalTranslation: string;
|
|
197
|
+
descriptionRte?: {
|
|
198
|
+
content: unknown[];
|
|
199
|
+
type: string;
|
|
200
|
+
} | undefined;
|
|
201
|
+
descriptionSpacing?: "default" | "none" | "tight" | "loose" | "xtight" | "xloose" | undefined;
|
|
202
|
+
};
|
|
203
|
+
productType: string;
|
|
204
|
+
discountedFrom: "price" | "compare_at_price";
|
|
205
|
+
productLimit: number;
|
|
206
|
+
productOptions: {
|
|
207
|
+
hideOutOfStockVariants: boolean;
|
|
208
|
+
matchVariant: boolean;
|
|
209
|
+
showShipping: boolean;
|
|
210
|
+
showSubtotal: boolean;
|
|
211
|
+
showTaxes: boolean;
|
|
212
|
+
showTotal: boolean;
|
|
213
|
+
showVariantSelectors: boolean;
|
|
214
|
+
variantSelectorDisplayMode: "single" | "separate";
|
|
215
|
+
showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
|
|
216
|
+
};
|
|
217
|
+
productTypeSelector: "radio" | "dropdown";
|
|
218
|
+
quantityInputs: {
|
|
219
|
+
defaultQuantity: number;
|
|
220
|
+
enabled: boolean;
|
|
221
|
+
maxValue: number;
|
|
222
|
+
minValue: number;
|
|
223
|
+
};
|
|
224
|
+
upgradeToSubscription: {
|
|
225
|
+
acceptButtonText: string;
|
|
226
|
+
allow: boolean;
|
|
227
|
+
emailRefundNotice: boolean;
|
|
228
|
+
errorBannerText: string;
|
|
229
|
+
};
|
|
230
|
+
advance: unknown;
|
|
231
|
+
discount: {
|
|
232
|
+
shouldShowSavingText: boolean;
|
|
233
|
+
type: "none" | "percentage" | "fixed_amount";
|
|
234
|
+
amount: number;
|
|
235
|
+
};
|
|
236
|
+
integrations: unknown;
|
|
237
|
+
shipping: {
|
|
238
|
+
enabled: boolean;
|
|
239
|
+
title: string;
|
|
240
|
+
type: "fixed_amount" | "free";
|
|
241
|
+
amount: number;
|
|
242
|
+
};
|
|
243
|
+
styles: unknown;
|
|
244
|
+
subImages: number | null;
|
|
245
|
+
subscription: unknown;
|
|
246
|
+
subscriptionIsDefault?: boolean | undefined;
|
|
247
|
+
blocks?: unknown[] | undefined;
|
|
248
|
+
};
|
|
249
|
+
};
|
|
250
|
+
};
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/** Both prepared purchase terms and display structure consume this one effective configuration. */
|
|
2
|
+
export declare const normalizePostPurchaseProduct: (settings: unknown, response: unknown) => {
|
|
3
|
+
data: {
|
|
4
|
+
title: string;
|
|
5
|
+
id: number;
|
|
6
|
+
productGroupVariants: unknown[];
|
|
7
|
+
variants: {
|
|
8
|
+
title: string;
|
|
9
|
+
compareAtPrice: string | null;
|
|
10
|
+
id: number;
|
|
11
|
+
inventoryManagement: string | null;
|
|
12
|
+
inventoryPolicy: string;
|
|
13
|
+
inventoryQuantity: number;
|
|
14
|
+
price: string;
|
|
15
|
+
productId: number;
|
|
16
|
+
imageId?: number | null | undefined;
|
|
17
|
+
option1?: unknown;
|
|
18
|
+
option2?: unknown;
|
|
19
|
+
option3?: unknown;
|
|
20
|
+
sellingPlanAllocations?: unknown;
|
|
21
|
+
}[];
|
|
22
|
+
image?: {
|
|
23
|
+
src: string;
|
|
24
|
+
} | null | undefined;
|
|
25
|
+
description?: string | null | undefined;
|
|
26
|
+
images?: {
|
|
27
|
+
id: number;
|
|
28
|
+
src: string;
|
|
29
|
+
alt?: string | undefined;
|
|
30
|
+
}[] | null | undefined;
|
|
31
|
+
metadata?: {
|
|
32
|
+
productQuantity?: number | undefined;
|
|
33
|
+
} | undefined;
|
|
34
|
+
metafields?: unknown;
|
|
35
|
+
options?: unknown;
|
|
36
|
+
selectedVariant?: unknown;
|
|
37
|
+
sellingPlanGroups?: {
|
|
38
|
+
requiresSellingPlan?: boolean | undefined;
|
|
39
|
+
discountAmount?: unknown;
|
|
40
|
+
discountType?: unknown;
|
|
41
|
+
id?: unknown;
|
|
42
|
+
sellingPlans?: unknown;
|
|
43
|
+
}[] | undefined;
|
|
44
|
+
}[];
|
|
45
|
+
effective: {
|
|
46
|
+
language: {
|
|
47
|
+
description: string;
|
|
48
|
+
descriptionEnabled: boolean;
|
|
49
|
+
displayCtaPrice: boolean;
|
|
50
|
+
global: {
|
|
51
|
+
declineAll: string;
|
|
52
|
+
declineThisOffer: string;
|
|
53
|
+
free: string;
|
|
54
|
+
notAvailable: string;
|
|
55
|
+
payNow: string;
|
|
56
|
+
payNowUpgradeToSubscription: string;
|
|
57
|
+
quantity: string;
|
|
58
|
+
recurringShipping: string;
|
|
59
|
+
recurringSubtotal: string;
|
|
60
|
+
reviewsPlural: string;
|
|
61
|
+
reviewsSingular: string;
|
|
62
|
+
save: string;
|
|
63
|
+
shipping: string;
|
|
64
|
+
subscriptionOption: string;
|
|
65
|
+
subtotal: string;
|
|
66
|
+
taxes: string;
|
|
67
|
+
total: string;
|
|
68
|
+
};
|
|
69
|
+
globalTranslation: string;
|
|
70
|
+
descriptionRte?: {
|
|
71
|
+
content: unknown[];
|
|
72
|
+
type: string;
|
|
73
|
+
} | undefined;
|
|
74
|
+
descriptionSpacing?: "default" | "none" | "tight" | "loose" | "xtight" | "xloose" | undefined;
|
|
75
|
+
};
|
|
76
|
+
productType: string;
|
|
77
|
+
discountedFrom: "price" | "compare_at_price";
|
|
78
|
+
productLimit: number;
|
|
79
|
+
productOptions: {
|
|
80
|
+
hideOutOfStockVariants: boolean;
|
|
81
|
+
matchVariant: boolean;
|
|
82
|
+
showShipping: boolean;
|
|
83
|
+
showSubtotal: boolean;
|
|
84
|
+
showTaxes: boolean;
|
|
85
|
+
showTotal: boolean;
|
|
86
|
+
showVariantSelectors: boolean;
|
|
87
|
+
variantSelectorDisplayMode: "single" | "separate";
|
|
88
|
+
showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
|
|
89
|
+
};
|
|
90
|
+
productTypeSelector: "radio" | "dropdown";
|
|
91
|
+
quantityInputs: {
|
|
92
|
+
defaultQuantity: number;
|
|
93
|
+
enabled: boolean;
|
|
94
|
+
maxValue: number;
|
|
95
|
+
minValue: number;
|
|
96
|
+
};
|
|
97
|
+
upgradeToSubscription: {
|
|
98
|
+
acceptButtonText: string;
|
|
99
|
+
allow: boolean;
|
|
100
|
+
emailRefundNotice: boolean;
|
|
101
|
+
errorBannerText: string;
|
|
102
|
+
};
|
|
103
|
+
advance: unknown;
|
|
104
|
+
discount: {
|
|
105
|
+
shouldShowSavingText: boolean;
|
|
106
|
+
type: "none" | "percentage" | "fixed_amount";
|
|
107
|
+
amount: number;
|
|
108
|
+
};
|
|
109
|
+
integrations: unknown;
|
|
110
|
+
shipping: {
|
|
111
|
+
enabled: boolean;
|
|
112
|
+
title: string;
|
|
113
|
+
type: "fixed_amount" | "free";
|
|
114
|
+
amount: number;
|
|
115
|
+
};
|
|
116
|
+
styles: unknown;
|
|
117
|
+
subImages: number | null;
|
|
118
|
+
subscription: unknown;
|
|
119
|
+
subscriptionIsDefault?: boolean | undefined;
|
|
120
|
+
blocks?: unknown[] | undefined;
|
|
121
|
+
};
|
|
122
|
+
metadata: {
|
|
123
|
+
widget: Record<string, unknown>;
|
|
124
|
+
};
|
|
125
|
+
original: {
|
|
126
|
+
language: {
|
|
127
|
+
description: string;
|
|
128
|
+
descriptionEnabled: boolean;
|
|
129
|
+
displayCtaPrice: boolean;
|
|
130
|
+
global: {
|
|
131
|
+
declineAll: string;
|
|
132
|
+
declineThisOffer: string;
|
|
133
|
+
free: string;
|
|
134
|
+
notAvailable: string;
|
|
135
|
+
payNow: string;
|
|
136
|
+
payNowUpgradeToSubscription: string;
|
|
137
|
+
quantity: string;
|
|
138
|
+
recurringShipping: string;
|
|
139
|
+
recurringSubtotal: string;
|
|
140
|
+
reviewsPlural: string;
|
|
141
|
+
reviewsSingular: string;
|
|
142
|
+
save: string;
|
|
143
|
+
shipping: string;
|
|
144
|
+
subscriptionOption: string;
|
|
145
|
+
subtotal: string;
|
|
146
|
+
taxes: string;
|
|
147
|
+
total: string;
|
|
148
|
+
};
|
|
149
|
+
globalTranslation: string;
|
|
150
|
+
descriptionRte?: {
|
|
151
|
+
content: unknown[];
|
|
152
|
+
type: string;
|
|
153
|
+
} | undefined;
|
|
154
|
+
descriptionSpacing?: "default" | "none" | "tight" | "loose" | "xtight" | "xloose" | undefined;
|
|
155
|
+
};
|
|
156
|
+
productType: string;
|
|
157
|
+
discountedFrom: "price" | "compare_at_price";
|
|
158
|
+
productLimit: number;
|
|
159
|
+
productOptions: {
|
|
160
|
+
hideOutOfStockVariants: boolean;
|
|
161
|
+
matchVariant: boolean;
|
|
162
|
+
showShipping: boolean;
|
|
163
|
+
showSubtotal: boolean;
|
|
164
|
+
showTaxes: boolean;
|
|
165
|
+
showTotal: boolean;
|
|
166
|
+
showVariantSelectors: boolean;
|
|
167
|
+
variantSelectorDisplayMode: "single" | "separate";
|
|
168
|
+
showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
|
|
169
|
+
};
|
|
170
|
+
productTypeSelector: "radio" | "dropdown";
|
|
171
|
+
quantityInputs: {
|
|
172
|
+
defaultQuantity: number;
|
|
173
|
+
enabled: boolean;
|
|
174
|
+
maxValue: number;
|
|
175
|
+
minValue: number;
|
|
176
|
+
};
|
|
177
|
+
upgradeToSubscription: {
|
|
178
|
+
acceptButtonText: string;
|
|
179
|
+
allow: boolean;
|
|
180
|
+
emailRefundNotice: boolean;
|
|
181
|
+
errorBannerText: string;
|
|
182
|
+
};
|
|
183
|
+
advance: unknown;
|
|
184
|
+
discount: {
|
|
185
|
+
shouldShowSavingText: boolean;
|
|
186
|
+
type: "none" | "percentage" | "fixed_amount";
|
|
187
|
+
amount: number;
|
|
188
|
+
};
|
|
189
|
+
integrations: unknown;
|
|
190
|
+
shipping: {
|
|
191
|
+
enabled: boolean;
|
|
192
|
+
title: string;
|
|
193
|
+
type: "fixed_amount" | "free";
|
|
194
|
+
amount: number;
|
|
195
|
+
};
|
|
196
|
+
styles: unknown;
|
|
197
|
+
subImages: number | null;
|
|
198
|
+
subscription: unknown;
|
|
199
|
+
subscriptionIsDefault?: boolean | undefined;
|
|
200
|
+
blocks?: unknown[] | undefined;
|
|
201
|
+
};
|
|
202
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { PostPurchaseProductSource } from '../schema/postPurchaseProductSource';
|
|
2
|
+
/** Preserve legacy sizeImage(..., '800x800') and its no-image asset at the display boundary (L92). */
|
|
3
|
+
export declare const postPurchasePrimaryImage: (product: PostPurchaseProductSource["data"][number]) => {
|
|
4
|
+
description: string;
|
|
5
|
+
source: string;
|
|
6
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { PostPurchaseProductSettings } from '../schema/postPurchaseProductSettings';
|
|
2
|
+
import type { PostPurchaseProductSource } from '../schema/postPurchaseProductSource';
|
|
3
|
+
/**
|
|
4
|
+
* Keep response-description provenance: it precedes merchant RTE even after settings are merged. Reviews
|
|
5
|
+
* are Slice 26's addition (see `postPurchaseProductDisplay` schema); nothing here computes them yet.
|
|
6
|
+
*/
|
|
7
|
+
export declare const projectPostPurchaseProductDisplay: (effective: PostPurchaseProductSettings, metadata: PostPurchaseProductSource["metadata"], product: PostPurchaseProductSource["data"][number]) => {
|
|
8
|
+
discountedFrom: "price" | "compare_at_price";
|
|
9
|
+
language: {
|
|
10
|
+
description: string;
|
|
11
|
+
descriptionEnabled: boolean;
|
|
12
|
+
descriptionRte?: {
|
|
13
|
+
content: unknown[];
|
|
14
|
+
type: string;
|
|
15
|
+
} | undefined;
|
|
16
|
+
descriptionSpacing?: "default" | "none" | "tight" | "loose" | "xtight" | "xloose" | undefined;
|
|
17
|
+
};
|
|
18
|
+
primaryImage: {
|
|
19
|
+
description: string;
|
|
20
|
+
source: string;
|
|
21
|
+
};
|
|
22
|
+
productOptions: {
|
|
23
|
+
showShipping: boolean;
|
|
24
|
+
showSubtotal: boolean;
|
|
25
|
+
showTaxes: boolean;
|
|
26
|
+
showTotal: boolean;
|
|
27
|
+
showVariantSelectors: boolean;
|
|
28
|
+
showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
|
|
29
|
+
};
|
|
30
|
+
responseDescription: string;
|
|
31
|
+
shouldShowSavingText: boolean;
|
|
32
|
+
gallery?: {
|
|
33
|
+
images: {
|
|
34
|
+
description: string;
|
|
35
|
+
id: number;
|
|
36
|
+
source: string;
|
|
37
|
+
thumbnail: string;
|
|
38
|
+
}[];
|
|
39
|
+
selectedImageId?: number | undefined;
|
|
40
|
+
} | undefined;
|
|
41
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { normalizePostPurchaseProduct } from '../server/normalizePostPurchaseProduct';
|
|
2
|
+
/**
|
|
3
|
+
* The same eligibility rule drives advertised modes and their prepared terms. `quantity` is typed
|
|
4
|
+
* structurally, matching `projectPostPurchaseProduct` (see its comment) — only truthiness is read here.
|
|
5
|
+
*/
|
|
6
|
+
export declare const oneTimeUnavailable: (normalized: ReturnType<typeof normalizePostPurchaseProduct>, allowCollection: boolean, quantity?: {
|
|
7
|
+
quantity: number;
|
|
8
|
+
}) => "Only one fixed product and variant are supported" | "Only fixed one-time configuration is supported" | "An available one-time variant without product groups is required" | undefined;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { PostPurchaseProductGallery } from '../schema/postPurchaseProductGallery';
|
|
2
|
+
import type { PostPurchaseProductSettings } from '../schema/postPurchaseProductSettings';
|
|
3
|
+
import type { PostPurchaseProductSource } from '../schema/postPurchaseProductSource';
|
|
4
|
+
/** Display-only catalog facts (L67); a selected image may lie outside the configured thumbnail limit. */
|
|
5
|
+
export declare const postPurchaseProductGallery: (product: PostPurchaseProductSource["data"][number], limit: PostPurchaseProductSettings["subImages"]) => PostPurchaseProductGallery;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PostPurchaseProductSource } from '../schema/postPurchaseProductSource';
|
|
2
|
+
type Inventory = Pick<PostPurchaseProductSource['data'][number]['variants'][number], 'inventoryManagement' | 'inventoryPolicy' | 'inventoryQuantity'>;
|
|
3
|
+
/**
|
|
4
|
+
* The single availability definition legacy split across `initializeProduct` and `getIsOutOfStock` (L83).
|
|
5
|
+
* L84 (the unguarded `inventoryPolicy.toLowerCase()` that threw on a managed variant carrying no policy) is
|
|
6
|
+
* resolved at the parse boundary, not here: `PostPurchaseProductSource` requires the policy, so such a
|
|
7
|
+
* variant is rejected cleanly — the same "dropped, not crashed on" contract as `OfferProduct` — and this
|
|
8
|
+
* helper only ever sees a string. The attribute matcher's stock filter is the one deliberate exception
|
|
9
|
+
* (see `matchPostPurchaseVariantDefault`).
|
|
10
|
+
*/
|
|
11
|
+
export declare const postPurchaseVariantAvailable: (variant: Inventory) => boolean;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { PostPurchaseVariantCatalog } from '../schema/postPurchaseVariantCatalog';
|
|
2
|
+
import type { normalizePostPurchaseProduct } from '../server/normalizePostPurchaseProduct';
|
|
3
|
+
export declare const projectPostPurchaseVariantCatalog: (product: ReturnType<typeof normalizePostPurchaseProduct>["data"][number], settings: ReturnType<typeof normalizePostPurchaseProduct>["effective"]) => PostPurchaseVariantCatalog;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { normalizePostPurchaseProduct } from '../server/normalizePostPurchaseProduct';
|
|
2
|
+
/**
|
|
3
|
+
* Both fixed purchase kinds project the same product and effective display after eligibility.
|
|
4
|
+
* `selectedQuantity` is typed structurally rather than as `ReturnType<typeof readPostPurchaseQuantity>`
|
|
5
|
+
* (Slice 25's `readPostPurchaseQuantity` is not part of this Slice) — only `.quantity` is read here, so
|
|
6
|
+
* the narrower shape is behaviourally identical and adds no forward dependency.
|
|
7
|
+
*/
|
|
8
|
+
export declare const projectPostPurchaseProduct: ({ data, effective, metadata, original }: ReturnType<typeof normalizePostPurchaseProduct>, selectedQuantity?: {
|
|
9
|
+
quantity: number;
|
|
10
|
+
}) => {
|
|
11
|
+
display: {
|
|
12
|
+
discountedFrom: "price" | "compare_at_price";
|
|
13
|
+
language: {
|
|
14
|
+
description: string;
|
|
15
|
+
descriptionEnabled: boolean;
|
|
16
|
+
descriptionRte?: {
|
|
17
|
+
content: unknown[];
|
|
18
|
+
type: string;
|
|
19
|
+
} | undefined;
|
|
20
|
+
descriptionSpacing?: "default" | "none" | "tight" | "loose" | "xtight" | "xloose" | undefined;
|
|
21
|
+
};
|
|
22
|
+
primaryImage: {
|
|
23
|
+
description: string;
|
|
24
|
+
source: string;
|
|
25
|
+
};
|
|
26
|
+
productOptions: {
|
|
27
|
+
showShipping: boolean;
|
|
28
|
+
showSubtotal: boolean;
|
|
29
|
+
showTaxes: boolean;
|
|
30
|
+
showTotal: boolean;
|
|
31
|
+
showVariantSelectors: boolean;
|
|
32
|
+
showDeclineAll?: "none" | "both" | "above" | "below" | undefined;
|
|
33
|
+
};
|
|
34
|
+
responseDescription: string;
|
|
35
|
+
shouldShowSavingText: boolean;
|
|
36
|
+
gallery?: {
|
|
37
|
+
images: {
|
|
38
|
+
description: string;
|
|
39
|
+
id: number;
|
|
40
|
+
source: string;
|
|
41
|
+
thumbnail: string;
|
|
42
|
+
}[];
|
|
43
|
+
selectedImageId?: number | undefined;
|
|
44
|
+
} | undefined;
|
|
45
|
+
};
|
|
46
|
+
labels: {
|
|
47
|
+
declineAll: string;
|
|
48
|
+
declineThisOffer: string;
|
|
49
|
+
free: string;
|
|
50
|
+
notAvailable: string;
|
|
51
|
+
payNow: string;
|
|
52
|
+
payNowUpgradeToSubscription: string;
|
|
53
|
+
quantity: string;
|
|
54
|
+
recurringShipping: string;
|
|
55
|
+
recurringSubtotal: string;
|
|
56
|
+
reviewsPlural: string;
|
|
57
|
+
reviewsSingular: string;
|
|
58
|
+
save: string;
|
|
59
|
+
shipping: string;
|
|
60
|
+
subscriptionOption: string;
|
|
61
|
+
subtotal: string;
|
|
62
|
+
taxes: string;
|
|
63
|
+
total: string;
|
|
64
|
+
};
|
|
65
|
+
product: {
|
|
66
|
+
variant: {
|
|
67
|
+
title: string;
|
|
68
|
+
compareAtPrice: string | null;
|
|
69
|
+
id: number;
|
|
70
|
+
inventoryManagement: string | null;
|
|
71
|
+
inventoryPolicy: string;
|
|
72
|
+
inventoryQuantity: number;
|
|
73
|
+
price: string;
|
|
74
|
+
productId: number;
|
|
75
|
+
imageId?: number | null | undefined;
|
|
76
|
+
option1?: unknown;
|
|
77
|
+
option2?: unknown;
|
|
78
|
+
option3?: unknown;
|
|
79
|
+
sellingPlanAllocations?: unknown;
|
|
80
|
+
};
|
|
81
|
+
title: string;
|
|
82
|
+
id: number;
|
|
83
|
+
productGroupVariants: unknown[];
|
|
84
|
+
variants: {
|
|
85
|
+
title: string;
|
|
86
|
+
compareAtPrice: string | null;
|
|
87
|
+
id: number;
|
|
88
|
+
inventoryManagement: string | null;
|
|
89
|
+
inventoryPolicy: string;
|
|
90
|
+
inventoryQuantity: number;
|
|
91
|
+
price: string;
|
|
92
|
+
productId: number;
|
|
93
|
+
imageId?: number | null | undefined;
|
|
94
|
+
option1?: unknown;
|
|
95
|
+
option2?: unknown;
|
|
96
|
+
option3?: unknown;
|
|
97
|
+
sellingPlanAllocations?: unknown;
|
|
98
|
+
}[];
|
|
99
|
+
image?: {
|
|
100
|
+
src: string;
|
|
101
|
+
} | null | undefined;
|
|
102
|
+
description?: string | null | undefined;
|
|
103
|
+
images?: {
|
|
104
|
+
id: number;
|
|
105
|
+
src: string;
|
|
106
|
+
alt?: string | undefined;
|
|
107
|
+
}[] | null | undefined;
|
|
108
|
+
metadata?: {
|
|
109
|
+
productQuantity?: number | undefined;
|
|
110
|
+
} | undefined;
|
|
111
|
+
metafields?: unknown;
|
|
112
|
+
options?: unknown;
|
|
113
|
+
selectedVariant?: unknown;
|
|
114
|
+
sellingPlanGroups?: {
|
|
115
|
+
requiresSellingPlan?: boolean | undefined;
|
|
116
|
+
discountAmount?: unknown;
|
|
117
|
+
discountType?: unknown;
|
|
118
|
+
id?: unknown;
|
|
119
|
+
sellingPlans?: unknown;
|
|
120
|
+
}[] | undefined;
|
|
121
|
+
};
|
|
122
|
+
selection: {
|
|
123
|
+
productId: number;
|
|
124
|
+
quantity: number;
|
|
125
|
+
variantId: number;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { z } from 'zod';
|
|
2
|
+
import { PostPurchaseOrderAttributes, PostPurchaseVariantDefaultProduct, PostPurchaseVariantDefaultSettings } from '../schema/postPurchaseVariantDefault';
|
|
3
|
+
/**
|
|
4
|
+
* Initial defaults only: explicit buyer selection bypasses this resolver; no purchase authority is
|
|
5
|
+
* returned. L78's order is `variants[0] → attribute match → first in stock` — its "v2 recommendation"
|
|
6
|
+
* step between the match and the fallback is not ported (decision 15): the legacy schema it read
|
|
7
|
+
* `recommendedVariantIds` through stripped the field before any reader ran, so that step never fired
|
|
8
|
+
* against real data and the observable order is unchanged by dropping it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const resolvePostPurchaseVariantDefault: (source: z.input<typeof PostPurchaseVariantDefaultProduct>, settings: z.input<typeof PostPurchaseVariantDefaultSettings>, originalAttributes?: z.input<typeof PostPurchaseOrderAttributes>) => number;
|
|
@@ -40,8 +40,8 @@ export declare const ImageContentSettings: z.ZodObject<{
|
|
|
40
40
|
imagePlacement: z.ZodNullable<z.ZodOptional<z.ZodEnum<{
|
|
41
41
|
top: "top";
|
|
42
42
|
bottom: "bottom";
|
|
43
|
-
right: "right";
|
|
44
43
|
left: "left";
|
|
44
|
+
right: "right";
|
|
45
45
|
}>>>;
|
|
46
46
|
imageSize: z.ZodPipe<z.ZodDefault<z.ZodNumber>, z.ZodNumber>;
|
|
47
47
|
superTitle: z.ZodOptional<z.ZodUnknown>;
|