@rebuy/rebuy 3.38.0 → 3.39.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1607 -1097
- package/dist/index.d.ts +2 -0
- package/dist/index.mjs +1607 -1097
- package/dist/pricing/postPurchaseChangeset.d.ts +5 -0
- package/dist/pricing/postPurchaseCosts.d.ts +5 -0
- package/dist/schema/checkout-and-beyond/index.cjs +7 -1
- package/dist/schema/checkout-and-beyond/index.mjs +7 -1
- package/dist/schema/index.d.ts +18 -0
- package/dist/schema/postPurchaseAcceptedEvent.d.ts +76 -0
- package/dist/schema/postPurchaseAcceptedMetafield.d.ts +40 -0
- package/dist/schema/postPurchaseAdmission.d.ts +158 -0
- package/dist/schema/postPurchaseAnalytics.d.ts +24 -0
- package/dist/schema/postPurchaseClassification.d.ts +34 -0
- package/dist/schema/postPurchaseDecline.d.ts +87 -0
- package/dist/schema/postPurchaseDeclineDelivery.d.ts +17 -0
- package/dist/schema/postPurchaseFinish.d.ts +95 -0
- package/dist/schema/postPurchaseFollowups.d.ts +130 -0
- package/dist/schema/postPurchaseHealthProgress.d.ts +40 -0
- package/dist/schema/postPurchaseLifecycle.d.ts +36 -0
- package/dist/schema/postPurchaseMemberIdentity.d.ts +7 -0
- package/dist/schema/postPurchaseObservation.d.ts +131 -0
- package/dist/schema/postPurchaseOffer.d.ts +68 -0
- package/dist/schema/postPurchaseOfferPresentation.d.ts +437 -1
- package/dist/schema/postPurchasePreparationOptions.d.ts +20 -0
- package/dist/schema/postPurchaseProductCollectionView.d.ts +31 -5
- package/dist/schema/postPurchaseProgress.d.ts +42 -0
- package/dist/schema/postPurchaseRecovery.d.ts +85 -0
- package/dist/schema/postPurchaseTransition.d.ts +73 -0
- package/dist/schema/widget-data.cjs +6 -1
- package/dist/schema/widget-data.mjs +6 -1
- package/dist/schema/widgets/checkout-and-beyond/banner.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/carousel.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/cartLine.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/dataSource.d.ts +14 -0
- package/dist/schema/widgets/checkout-and-beyond/offers.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/progressBar.d.ts +1 -1
- package/dist/server/__fixtures__/postPurchasePurchase.d.ts +63 -0
- package/dist/server/__fixtures__/postPurchaseSubscription.d.ts +42 -0
- package/dist/server/index.cjs +403 -143
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.mjs +403 -143
- package/dist/server/preparePostPurchaseDeclineDisplay.d.ts +6 -0
- package/dist/transforms/index.cjs +18 -2
- package/dist/transforms/index.mjs +18 -2
- package/dist/transforms/offerV1/types.d.ts +4 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -22,6 +22,16 @@ var src_exports = {};
|
|
|
22
22
|
__export(src_exports, {
|
|
23
23
|
ABTestingPlaceholder: () => ABTestingPlaceholder,
|
|
24
24
|
ARRAY_INDEX_STRING: () => ARRAY_INDEX_STRING,
|
|
25
|
+
AcceptedEventAttemptProgressSchema: () => AcceptedEventAttemptProgressSchema,
|
|
26
|
+
AcceptedEventOutcomeSchema: () => AcceptedEventOutcomeSchema,
|
|
27
|
+
AcceptedEventRequestSchema: () => AcceptedEventRequestSchema,
|
|
28
|
+
AcceptedEventResponseSchema: () => AcceptedEventResponseSchema,
|
|
29
|
+
AcceptedEventResultProgressSchema: () => AcceptedEventResultProgressSchema,
|
|
30
|
+
AcceptedFollowupsResponseSchema: () => AcceptedFollowupsResponseSchema,
|
|
31
|
+
AcceptedMetafieldOutcomeSchema: () => AcceptedMetafieldOutcomeSchema,
|
|
32
|
+
AcceptedMetafieldRequestSchema: () => AcceptedMetafieldRequestSchema,
|
|
33
|
+
AcceptedMetafieldResponseSchema: () => AcceptedMetafieldResponseSchema,
|
|
34
|
+
AcceptedMetafieldResultSchema: () => AcceptedMetafieldResultSchema,
|
|
25
35
|
Api: () => Api,
|
|
26
36
|
BannerColor: () => BannerColor,
|
|
27
37
|
BlockType: () => BlockType,
|
|
@@ -79,6 +89,7 @@ __export(src_exports, {
|
|
|
79
89
|
CABVariableSeed: () => CABVariableSeed,
|
|
80
90
|
CABVariableTrigger: () => CABVariableTrigger,
|
|
81
91
|
CABVariantContent: () => CABVariantContent,
|
|
92
|
+
CABVariantLabels: () => CABVariantLabels,
|
|
82
93
|
CABVariantsSection: () => CABVariantsSection,
|
|
83
94
|
CABVisibility: () => CABVisibility,
|
|
84
95
|
COMBINED_ENDPOINTS: () => COMBINED_ENDPOINTS,
|
|
@@ -88,6 +99,9 @@ __export(src_exports, {
|
|
|
88
99
|
CacheInfo: () => CacheInfo,
|
|
89
100
|
CalloutBannerBlock: () => CalloutBannerBlock,
|
|
90
101
|
CheckoutExtension: () => CheckoutExtension,
|
|
102
|
+
ClassificationAttemptProgressSchema: () => ClassificationAttemptProgressSchema,
|
|
103
|
+
ClassificationProgressSchema: () => ClassificationProgressSchema,
|
|
104
|
+
ClassificationResultProgressSchema: () => ClassificationResultProgressSchema,
|
|
91
105
|
ContentBlock: () => ContentBlock,
|
|
92
106
|
ContentBlockV1: () => ContentBlockV1,
|
|
93
107
|
ContentOperator: () => ContentOperator,
|
|
@@ -97,17 +111,22 @@ __export(src_exports, {
|
|
|
97
111
|
DYNAMIC_TOKEN_REGEX: () => DYNAMIC_TOKEN_REGEX,
|
|
98
112
|
DecideRequestSchema: () => DecideRequestSchema,
|
|
99
113
|
DecisionEntrySchema: () => DecisionEntrySchema,
|
|
114
|
+
DeclineDeliveryProgressSchema: () => DeclineDeliveryProgressSchema,
|
|
100
115
|
Direction: () => Direction,
|
|
101
116
|
DiscountSource: () => DiscountSource,
|
|
102
117
|
DiscountType: () => DiscountType,
|
|
103
118
|
EditorMode: () => EditorMode,
|
|
119
|
+
EventCalculationSchema: () => EventCalculationSchema,
|
|
104
120
|
ExitPolicySchema: () => ExitPolicySchema,
|
|
121
|
+
FinishedPurchaseSchema: () => FinishedPurchaseSchema,
|
|
105
122
|
GIFT_LABELS: () => GIFT_LABELS,
|
|
106
123
|
Geolocation: () => Geolocation,
|
|
107
124
|
GiftWithPurchase: () => GiftWithPurchase,
|
|
108
125
|
GridItem: () => GridItem,
|
|
109
126
|
HEX_COLOR_REGEX: () => HEX_COLOR_REGEX,
|
|
110
127
|
HTML_TAGS_REGEX: () => HTML_TAGS_REGEX,
|
|
128
|
+
HealthScheduleSchema: () => HealthScheduleSchema,
|
|
129
|
+
HealthSchedulingResponseSchema: () => HealthSchedulingResponseSchema,
|
|
111
130
|
HoldSettingSchema: () => HoldSettingSchema,
|
|
112
131
|
HorizontalAlignment: () => HorizontalAlignment,
|
|
113
132
|
IconName: () => IconName,
|
|
@@ -119,6 +138,8 @@ __export(src_exports, {
|
|
|
119
138
|
InlineTextSizeName: () => InlineTextSizeName,
|
|
120
139
|
LanguageKey: () => LanguageKey,
|
|
121
140
|
LayoutFrame: () => LayoutFrame,
|
|
141
|
+
LifecycleObservationRequestSchema: () => LifecycleObservationRequestSchema,
|
|
142
|
+
LifecycleObservationResponseSchema: () => LifecycleObservationResponseSchema,
|
|
122
143
|
LineItemEditor: () => LineItemEditor,
|
|
123
144
|
LineItemEditorSwitchLanguageV1: () => LineItemEditorSwitchLanguageV1,
|
|
124
145
|
LineItemEditorV1: () => LineItemEditorV1,
|
|
@@ -127,7 +148,15 @@ __export(src_exports, {
|
|
|
127
148
|
NO_HTML: () => NO_HTML,
|
|
128
149
|
OFFER_LABELS: () => OFFER_LABELS,
|
|
129
150
|
ObjectFit: () => ObjectFit,
|
|
151
|
+
OfferDeclineRequestSchema: () => OfferDeclineRequestSchema,
|
|
152
|
+
OfferDeclineResponseSchema: () => OfferDeclineResponseSchema,
|
|
153
|
+
OfferPreparationRequestSchema: () => OfferPreparationRequestSchema,
|
|
154
|
+
OfferPreparationResponseSchema: () => OfferPreparationResponseSchema,
|
|
155
|
+
OfferPresentationRequestSchema: () => OfferPresentationRequestSchema,
|
|
156
|
+
OfferPresentationResponseSchema: () => OfferPresentationResponseSchema,
|
|
130
157
|
OfferProduct: () => OfferProduct,
|
|
158
|
+
OfferTransitionRequestSchema: () => OfferTransitionRequestSchema,
|
|
159
|
+
OfferTransitionResponseSchema: () => OfferTransitionResponseSchema,
|
|
131
160
|
OffersDirection: () => OffersDirection,
|
|
132
161
|
OrderDecisionSchema: () => OrderDecisionSchema,
|
|
133
162
|
POST_PURCHASE_SKIP_LIMIT: () => POST_PURCHASE_SKIP_LIMIT,
|
|
@@ -147,6 +176,9 @@ __export(src_exports, {
|
|
|
147
176
|
PostPurchaseGroupDescription: () => PostPurchaseGroupDescription,
|
|
148
177
|
PostPurchaseGroupSelection: () => PostPurchaseGroupSelection,
|
|
149
178
|
PostPurchaseKlaviyoReviewRating: () => PostPurchaseKlaviyoReviewRating,
|
|
179
|
+
PostPurchaseMemberIdentity: () => PostPurchaseMemberIdentity,
|
|
180
|
+
PostPurchaseMemberPointer: () => PostPurchaseMemberPointer,
|
|
181
|
+
PostPurchaseMemberSelector: () => PostPurchaseMemberSelector,
|
|
150
182
|
PostPurchaseOffer: () => PostPurchaseOffer,
|
|
151
183
|
PostPurchaseOfferEligibility: () => PostPurchaseOfferEligibility,
|
|
152
184
|
PostPurchaseOfferEligibilityContext: () => PostPurchaseOfferEligibilityContext,
|
|
@@ -160,6 +192,7 @@ __export(src_exports, {
|
|
|
160
192
|
PostPurchasePlanCatalog: () => PostPurchasePlanCatalog,
|
|
161
193
|
PostPurchasePlanOption: () => PostPurchasePlanOption,
|
|
162
194
|
PostPurchasePreparation: () => PostPurchasePreparation,
|
|
195
|
+
PostPurchasePreparationOptions: () => PostPurchasePreparationOptions,
|
|
163
196
|
PostPurchasePrimaryImageSource: () => PostPurchasePrimaryImageSource,
|
|
164
197
|
PostPurchaseProductCalculation: () => PostPurchaseProductCalculation,
|
|
165
198
|
PostPurchaseProductChangeset: () => PostPurchaseProductChangeset,
|
|
@@ -172,6 +205,7 @@ __export(src_exports, {
|
|
|
172
205
|
PostPurchaseProductSettings: () => PostPurchaseProductSettings,
|
|
173
206
|
PostPurchaseProductSource: () => PostPurchaseProductSource,
|
|
174
207
|
PostPurchaseProductView: () => PostPurchaseProductView,
|
|
208
|
+
PostPurchaseProgressSchema: () => PostPurchaseProgressSchema,
|
|
175
209
|
PostPurchaseQuantityChoice: () => PostPurchaseQuantityChoice,
|
|
176
210
|
PostPurchaseQuantityPolicy: () => PostPurchaseQuantityPolicy,
|
|
177
211
|
PostPurchaseReviewCount: () => PostPurchaseReviewCount,
|
|
@@ -205,6 +239,18 @@ __export(src_exports, {
|
|
|
205
239
|
ProgressTierExclusionType: () => ProgressTierExclusionType,
|
|
206
240
|
ProgressTierType: () => ProgressTierType,
|
|
207
241
|
ProgressTierUnit: () => ProgressTierUnit,
|
|
242
|
+
PurchaseAnalyticsRequestSchema: () => PurchaseAnalyticsRequestSchema,
|
|
243
|
+
PurchaseAnalyticsResponseSchema: () => PurchaseAnalyticsResponseSchema,
|
|
244
|
+
PurchaseAnalyticsStatusSchema: () => PurchaseAnalyticsStatusSchema,
|
|
245
|
+
PurchaseExpectedSchema: () => PurchaseExpectedSchema,
|
|
246
|
+
PurchaseObservationRequestSchema: () => PurchaseObservationRequestSchema,
|
|
247
|
+
PurchaseObservationResponseSchema: () => PurchaseObservationResponseSchema,
|
|
248
|
+
PurchaseObservationSchema: () => PurchaseObservationSchema,
|
|
249
|
+
PurchaseReceiptSchema: () => PurchaseReceiptSchema,
|
|
250
|
+
PurchaseRecoveryRequestSchema: () => PurchaseRecoveryRequestSchema,
|
|
251
|
+
PurchaseRecoveryResponseSchema: () => PurchaseRecoveryResponseSchema,
|
|
252
|
+
PurchaseRequestSchema: () => PurchaseRequestSchema,
|
|
253
|
+
PurchaseResponseSchema: () => PurchaseResponseSchema,
|
|
208
254
|
QuantityInput: () => QuantityInput,
|
|
209
255
|
REVIEW_LABELS: () => REVIEW_LABELS,
|
|
210
256
|
ROOT_RELATIVE_PATH_REGEX: () => ROOT_RELATIVE_PATH_REGEX,
|
|
@@ -214,6 +260,9 @@ __export(src_exports, {
|
|
|
214
260
|
RebuyClient: () => RebuyClient,
|
|
215
261
|
RebuyMonetize: () => RebuyMonetize,
|
|
216
262
|
RebuyMonetizeV1: () => RebuyMonetizeV1,
|
|
263
|
+
RecordedOfferDeclineSchema: () => RecordedOfferDeclineSchema,
|
|
264
|
+
RecordedPurchaseObservationSchema: () => RecordedPurchaseObservationSchema,
|
|
265
|
+
RequiredHealthSchema: () => RequiredHealthSchema,
|
|
217
266
|
ResultCountOperator: () => ResultCountOperator,
|
|
218
267
|
ResultTagOperator: () => ResultTagOperator,
|
|
219
268
|
ReviewsSize: () => ReviewsSize,
|
|
@@ -232,6 +281,8 @@ __export(src_exports, {
|
|
|
232
281
|
SessionCloseRequestSchema: () => SessionCloseRequestSchema,
|
|
233
282
|
SessionCloseResponseSchema: () => SessionCloseResponseSchema,
|
|
234
283
|
SessionClosureSchema: () => SessionClosureSchema,
|
|
284
|
+
SessionFinishRequestSchema: () => SessionFinishRequestSchema,
|
|
285
|
+
SessionFinishResponseSchema: () => SessionFinishResponseSchema,
|
|
235
286
|
SessionIdentitySchema: () => SessionIdentitySchema,
|
|
236
287
|
SessionOrderTimingSchema: () => SessionOrderTimingSchema,
|
|
237
288
|
SessionPolicySchema: () => SessionPolicySchema,
|
|
@@ -337,6 +388,8 @@ __export(src_exports, {
|
|
|
337
388
|
offersDirections: () => offersDirections,
|
|
338
389
|
popoverPositionMap: () => popoverPositionMap,
|
|
339
390
|
popoverPositions: () => popoverPositions,
|
|
391
|
+
postPurchaseChangeset: () => postPurchaseChangeset,
|
|
392
|
+
postPurchaseCosts: () => postPurchaseCosts,
|
|
340
393
|
postPurchaseSubscriptionDisplay: () => postPurchaseSubscriptionDisplay,
|
|
341
394
|
productImageObject: () => productImageObject,
|
|
342
395
|
productTypes: () => productTypes,
|
|
@@ -1632,60 +1685,87 @@ var OfferProduct = import_zod5.z.object({
|
|
|
1632
1685
|
variants: import_zod5.z.array(OfferProductVariant).min(1)
|
|
1633
1686
|
});
|
|
1634
1687
|
|
|
1635
|
-
// src/schema/
|
|
1636
|
-
var
|
|
1688
|
+
// src/schema/postPurchaseAcceptedEvent.ts
|
|
1689
|
+
var import_zod25 = require("zod");
|
|
1637
1690
|
|
|
1638
|
-
// src/schema/
|
|
1639
|
-
var
|
|
1691
|
+
// src/schema/postPurchaseAdmission.ts
|
|
1692
|
+
var import_zod24 = require("zod");
|
|
1640
1693
|
|
|
1641
|
-
// src/schema/
|
|
1694
|
+
// src/schema/postPurchaseIdentity.ts
|
|
1695
|
+
var import_zod6 = require("zod");
|
|
1696
|
+
var POST_PURCHASE_ID_MAX = 128;
|
|
1697
|
+
var PostPurchaseTimestampSchema = import_zod6.z.number().int().nonnegative();
|
|
1698
|
+
var PostPurchaseOrderIdSchema = import_zod6.z.string().regex(/^gid:\/\/shopify\/Order\/[1-9]\d*$/);
|
|
1699
|
+
var ShopifyDomainSchema = import_zod6.z.string().max(POST_PURCHASE_ID_MAX).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?\.myshopify\.com$/);
|
|
1700
|
+
var DecideRequestSchema = import_zod6.z.object({
|
|
1701
|
+
checkoutToken: import_zod6.z.string().min(1).max(POST_PURCHASE_ID_MAX),
|
|
1702
|
+
shop: ShopifyDomainSchema
|
|
1703
|
+
});
|
|
1704
|
+
var PostPurchaseAppIdSchema = import_zod6.z.string().min(1).max(POST_PURCHASE_ID_MAX);
|
|
1705
|
+
var DecisionEntrySchema = import_zod6.z.object({
|
|
1706
|
+
blockId: import_zod6.z.number().int().positive(),
|
|
1707
|
+
blockIndex: import_zod6.z.string(),
|
|
1708
|
+
blockParentIndex: import_zod6.z.string(),
|
|
1709
|
+
flowId: import_zod6.z.number().int().positive(),
|
|
1710
|
+
sectionId: import_zod6.z.number().int().positive(),
|
|
1711
|
+
widgetId: import_zod6.z.number().int().positive(),
|
|
1712
|
+
widgetTraffic: import_zod6.z.number().min(0).max(100)
|
|
1713
|
+
});
|
|
1714
|
+
|
|
1715
|
+
// src/schema/postPurchaseMemberIdentity.ts
|
|
1642
1716
|
var import_zod7 = require("zod");
|
|
1717
|
+
var PostPurchaseMemberIdentity = import_zod7.z.object({
|
|
1718
|
+
productId: import_zod7.z.number().int().positive(),
|
|
1719
|
+
productIndex: import_zod7.z.number().int().nonnegative()
|
|
1720
|
+
}).strict();
|
|
1721
|
+
|
|
1722
|
+
// src/schema/postPurchaseProduct.ts
|
|
1723
|
+
var import_zod22 = require("zod");
|
|
1643
1724
|
|
|
1644
1725
|
// src/schema/postPurchaseDiscount.ts
|
|
1645
|
-
var
|
|
1646
|
-
var Discount =
|
|
1647
|
-
amount:
|
|
1648
|
-
title:
|
|
1649
|
-
type:
|
|
1726
|
+
var import_zod8 = require("zod");
|
|
1727
|
+
var Discount = import_zod8.z.object({
|
|
1728
|
+
amount: import_zod8.z.number().nonnegative(),
|
|
1729
|
+
title: import_zod8.z.string(),
|
|
1730
|
+
type: import_zod8.z.enum(["none", "fixed_amount", "percentage"])
|
|
1650
1731
|
});
|
|
1651
1732
|
var validPostPurchaseDiscount = (discount) => discount.type !== "percentage" || discount.amount <= 100;
|
|
1652
1733
|
var PostPurchaseDiscount = Discount.refine(validPostPurchaseDiscount);
|
|
1653
1734
|
|
|
1654
|
-
// src/schema/
|
|
1655
|
-
var
|
|
1656
|
-
amount: PostPurchaseDiscount.shape.amount,
|
|
1657
|
-
type: import_zod7.z.enum(["percentage", "fixed_amount", "price"])
|
|
1658
|
-
}).refine(({ amount: amount2, type }) => type === "price" || validPostPurchaseDiscount({ amount: amount2, type }));
|
|
1735
|
+
// src/schema/postPurchaseProductDisplay.ts
|
|
1736
|
+
var import_zod18 = require("zod");
|
|
1659
1737
|
|
|
1660
|
-
// src/schema/
|
|
1661
|
-
var
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
variantId: import_zod8.z.number().int().positive()
|
|
1738
|
+
// src/schema/postPurchaseProductGallery.ts
|
|
1739
|
+
var import_zod9 = require("zod");
|
|
1740
|
+
var PostPurchaseProductGallery = import_zod9.z.object({
|
|
1741
|
+
images: import_zod9.z.array(
|
|
1742
|
+
import_zod9.z.object({
|
|
1743
|
+
description: import_zod9.z.string(),
|
|
1744
|
+
id: import_zod9.z.number().int().positive(),
|
|
1745
|
+
source: import_zod9.z.string(),
|
|
1746
|
+
thumbnail: import_zod9.z.string()
|
|
1747
|
+
})
|
|
1748
|
+
),
|
|
1749
|
+
selectedImageId: import_zod9.z.number().int().positive().optional()
|
|
1673
1750
|
});
|
|
1674
1751
|
|
|
1752
|
+
// src/schema/postPurchaseProductReviews.ts
|
|
1753
|
+
var import_zod17 = require("zod");
|
|
1754
|
+
|
|
1675
1755
|
// src/schema/widgets/post-purchase-offer/postPurchaseSettings.ts
|
|
1676
|
-
var
|
|
1756
|
+
var import_zod16 = require("zod");
|
|
1677
1757
|
|
|
1678
1758
|
// src/schema/widgets/post-purchase-offer/common.ts
|
|
1679
1759
|
var import_compat = require("es-toolkit/compat");
|
|
1680
|
-
var
|
|
1681
|
-
var strictNumber =
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1760
|
+
var import_zod10 = require("zod");
|
|
1761
|
+
var strictNumber = import_zod10.z.union([
|
|
1762
|
+
import_zod10.z.number(),
|
|
1763
|
+
import_zod10.z.string().transform((value) => (0, import_compat.toNumber)((0, import_compat.replace)((0, import_compat.toString)(value), /[^0-9.]/g, "")) || 0),
|
|
1764
|
+
import_zod10.z.unknown().transform(() => 0)
|
|
1685
1765
|
]);
|
|
1686
1766
|
|
|
1687
1767
|
// src/schema/widgets/post-purchase-offer/constants.ts
|
|
1688
|
-
var
|
|
1768
|
+
var import_zod11 = require("zod");
|
|
1689
1769
|
var blockTypes = [
|
|
1690
1770
|
"callout_banner",
|
|
1691
1771
|
"image",
|
|
@@ -1696,18 +1776,18 @@ var blockTypes = [
|
|
|
1696
1776
|
"text",
|
|
1697
1777
|
"timer"
|
|
1698
1778
|
];
|
|
1699
|
-
var blockType =
|
|
1779
|
+
var blockType = import_zod11.z.enum(blockTypes);
|
|
1700
1780
|
var BlockType = blockType.enum;
|
|
1701
1781
|
|
|
1702
1782
|
// src/schema/widgets/post-purchase-offer/postPurchaseBlocks.ts
|
|
1703
1783
|
var import_compat4 = require("es-toolkit/compat");
|
|
1704
1784
|
var import_uuid3 = require("uuid");
|
|
1705
|
-
var
|
|
1785
|
+
var import_zod15 = require("zod");
|
|
1706
1786
|
|
|
1707
1787
|
// src/schema/widgets/checkout-and-beyond/text.ts
|
|
1708
1788
|
var import_compat3 = require("es-toolkit/compat");
|
|
1709
1789
|
var import_uuid2 = require("uuid");
|
|
1710
|
-
var
|
|
1790
|
+
var import_zod14 = require("zod");
|
|
1711
1791
|
|
|
1712
1792
|
// src/schema/widgets/checkout-and-beyond/common.ts
|
|
1713
1793
|
var freezeEnum = (values2) => Object.freeze(Object.fromEntries(values2.map((v) => [v, v])));
|
|
@@ -1991,10 +2071,10 @@ var isTextType = isSectionType(SectionType.text);
|
|
|
1991
2071
|
var isVariantsType = isSectionType(SectionType.variants);
|
|
1992
2072
|
|
|
1993
2073
|
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
1994
|
-
var
|
|
2074
|
+
var import_zod13 = require("zod");
|
|
1995
2075
|
|
|
1996
2076
|
// src/schema/widgets/checkout-and-beyond/rule.ts
|
|
1997
|
-
var
|
|
2077
|
+
var import_zod12 = require("zod");
|
|
1998
2078
|
var ruleTypes = [
|
|
1999
2079
|
"cart",
|
|
2000
2080
|
"cart_count",
|
|
@@ -2013,7 +2093,7 @@ var ruleTypes = [
|
|
|
2013
2093
|
"product_type",
|
|
2014
2094
|
"product_vendor"
|
|
2015
2095
|
];
|
|
2016
|
-
var ruleType =
|
|
2096
|
+
var ruleType = import_zod12.z.enum(ruleTypes);
|
|
2017
2097
|
var RuleType = ruleType.enum;
|
|
2018
2098
|
var ruleOperators = [
|
|
2019
2099
|
"after",
|
|
@@ -2028,177 +2108,177 @@ var ruleOperators = [
|
|
|
2028
2108
|
"greater_than",
|
|
2029
2109
|
"less_than"
|
|
2030
2110
|
];
|
|
2031
|
-
var ruleOperator =
|
|
2111
|
+
var ruleOperator = import_zod12.z.enum(ruleOperators);
|
|
2032
2112
|
var RuleOperator = ruleOperator.enum;
|
|
2033
|
-
var RuleCondition =
|
|
2034
|
-
operator:
|
|
2035
|
-
products:
|
|
2036
|
-
type:
|
|
2037
|
-
value:
|
|
2038
|
-
});
|
|
2039
|
-
var RuleLogicBlock =
|
|
2040
|
-
rules:
|
|
2041
|
-
});
|
|
2042
|
-
var CABRulesetEntry =
|
|
2043
|
-
exitIfMatched:
|
|
2044
|
-
logic:
|
|
2045
|
-
output:
|
|
2046
|
-
|
|
2047
|
-
key:
|
|
2048
|
-
type:
|
|
2049
|
-
value:
|
|
2113
|
+
var RuleCondition = import_zod12.z.object({
|
|
2114
|
+
operator: import_zod12.z.enum(ruleOperators).default(RuleOperator.anything),
|
|
2115
|
+
products: import_zod12.z.union([import_zod12.z.array(import_zod12.z.unknown()), import_zod12.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
2116
|
+
type: import_zod12.z.enum(ruleTypes).default(RuleType.cart_subtotal),
|
|
2117
|
+
value: import_zod12.z.coerce.string().default("")
|
|
2118
|
+
});
|
|
2119
|
+
var RuleLogicBlock = import_zod12.z.object({
|
|
2120
|
+
rules: import_zod12.z.array(RuleCondition).default(() => [])
|
|
2121
|
+
});
|
|
2122
|
+
var CABRulesetEntry = import_zod12.z.object({
|
|
2123
|
+
exitIfMatched: import_zod12.z.boolean().default(true),
|
|
2124
|
+
logic: import_zod12.z.array(RuleLogicBlock).default(() => []),
|
|
2125
|
+
output: import_zod12.z.array(
|
|
2126
|
+
import_zod12.z.object({
|
|
2127
|
+
key: import_zod12.z.string().default("should_show"),
|
|
2128
|
+
type: import_zod12.z.literal("data_json").default("data_json"),
|
|
2129
|
+
value: import_zod12.z.string().default("true")
|
|
2050
2130
|
})
|
|
2051
2131
|
).default(() => [{ key: "should_show", type: "data_json", value: "true" }])
|
|
2052
2132
|
});
|
|
2053
|
-
var CABRuleset =
|
|
2133
|
+
var CABRuleset = import_zod12.z.union([import_zod12.z.array(CABRulesetEntry), import_zod12.z.strictObject({}).transform(() => [])]).default(() => []);
|
|
2054
2134
|
|
|
2055
2135
|
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
2056
|
-
var variableEffect =
|
|
2057
|
-
var CABVariableSeed =
|
|
2058
|
-
dataSourceId:
|
|
2136
|
+
var variableEffect = import_zod13.z.enum(variableEffects);
|
|
2137
|
+
var CABVariableSeed = import_zod13.z.object({
|
|
2138
|
+
dataSourceId: import_zod13.z.number().nullable().default(null),
|
|
2059
2139
|
ruleset: CABRuleset
|
|
2060
2140
|
});
|
|
2061
|
-
var CABBooleanVariable =
|
|
2141
|
+
var CABBooleanVariable = import_zod13.z.object({
|
|
2062
2142
|
/**
|
|
2063
2143
|
* Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
|
|
2064
2144
|
* from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
|
|
2065
2145
|
* below; a cross-field default has no `.default()` spelling. An explicit value always wins.
|
|
2066
2146
|
*/
|
|
2067
|
-
defaultValue:
|
|
2068
|
-
name:
|
|
2147
|
+
defaultValue: import_zod13.z.boolean().optional(),
|
|
2148
|
+
name: import_zod13.z.string().min(1),
|
|
2069
2149
|
seed: CABVariableSeed.optional(),
|
|
2070
2150
|
/** Defaulted so every stored declaration (all boolean before `text` existed) parses unchanged. */
|
|
2071
|
-
type:
|
|
2151
|
+
type: import_zod13.z.literal(VariableType.boolean).default(VariableType.boolean)
|
|
2072
2152
|
});
|
|
2073
|
-
var CABTextVariable =
|
|
2074
|
-
defaultValue:
|
|
2075
|
-
name:
|
|
2076
|
-
seed:
|
|
2077
|
-
type:
|
|
2153
|
+
var CABTextVariable = import_zod13.z.object({
|
|
2154
|
+
defaultValue: import_zod13.z.string(),
|
|
2155
|
+
name: import_zod13.z.string().min(1),
|
|
2156
|
+
seed: import_zod13.z.never().optional(),
|
|
2157
|
+
type: import_zod13.z.literal(VariableType.text)
|
|
2078
2158
|
});
|
|
2079
|
-
var CABNumberVariable =
|
|
2080
|
-
defaultValue:
|
|
2081
|
-
name:
|
|
2082
|
-
seed:
|
|
2083
|
-
type:
|
|
2159
|
+
var CABNumberVariable = import_zod13.z.object({
|
|
2160
|
+
defaultValue: import_zod13.z.number(),
|
|
2161
|
+
name: import_zod13.z.string().min(1),
|
|
2162
|
+
seed: import_zod13.z.never().optional(),
|
|
2163
|
+
type: import_zod13.z.literal(VariableType.number)
|
|
2084
2164
|
});
|
|
2085
|
-
var CABVariable =
|
|
2165
|
+
var CABVariable = import_zod13.z.union([CABTextVariable, CABNumberVariable, CABBooleanVariable]).transform(
|
|
2086
2166
|
(variable) => variable.type === VariableType.boolean ? { ...variable, defaultValue: variable.defaultValue ?? variable.seed === void 0 } : variable
|
|
2087
2167
|
);
|
|
2088
|
-
var CABVariableEffect =
|
|
2168
|
+
var CABVariableEffect = import_zod13.z.object({
|
|
2089
2169
|
effect: variableEffect.default(VariableEffect.toggle),
|
|
2090
|
-
variable:
|
|
2170
|
+
variable: import_zod13.z.string().min(1)
|
|
2091
2171
|
});
|
|
2092
|
-
var CABVisibility =
|
|
2093
|
-
variable:
|
|
2094
|
-
visibleWhen:
|
|
2172
|
+
var CABVisibility = import_zod13.z.object({
|
|
2173
|
+
variable: import_zod13.z.string().min(1),
|
|
2174
|
+
visibleWhen: import_zod13.z.boolean().default(true)
|
|
2095
2175
|
});
|
|
2096
|
-
var contentOperator =
|
|
2097
|
-
var resultCountOperator =
|
|
2098
|
-
var resultTagOperator =
|
|
2099
|
-
var mutatorEvent =
|
|
2100
|
-
var CABContentTrigger =
|
|
2176
|
+
var contentOperator = import_zod13.z.enum(contentOperators);
|
|
2177
|
+
var resultCountOperator = import_zod13.z.enum(resultCountOperators);
|
|
2178
|
+
var resultTagOperator = import_zod13.z.enum(resultTagOperators);
|
|
2179
|
+
var mutatorEvent = import_zod13.z.enum(mutatorEvents);
|
|
2180
|
+
var CABContentTrigger = import_zod13.z.object({
|
|
2101
2181
|
operator: contentOperator.default(ContentOperator.is_empty),
|
|
2102
|
-
type:
|
|
2182
|
+
type: import_zod13.z.literal("content")
|
|
2103
2183
|
});
|
|
2104
|
-
var CABResultCountTrigger =
|
|
2184
|
+
var CABResultCountTrigger = import_zod13.z.object({
|
|
2105
2185
|
operator: resultCountOperator.default(ResultCountOperator.equals),
|
|
2106
|
-
type:
|
|
2107
|
-
value:
|
|
2186
|
+
type: import_zod13.z.literal("result_count"),
|
|
2187
|
+
value: import_zod13.z.number().default(0)
|
|
2108
2188
|
});
|
|
2109
|
-
var CABResultTagTrigger =
|
|
2189
|
+
var CABResultTagTrigger = import_zod13.z.object({
|
|
2110
2190
|
operator: resultTagOperator.default(ResultTagOperator.contains),
|
|
2111
|
-
type:
|
|
2112
|
-
value:
|
|
2191
|
+
type: import_zod13.z.literal("result_tag"),
|
|
2192
|
+
value: import_zod13.z.string().min(1)
|
|
2113
2193
|
});
|
|
2114
|
-
var CABEventTrigger =
|
|
2194
|
+
var CABEventTrigger = import_zod13.z.object({
|
|
2115
2195
|
event: mutatorEvent,
|
|
2116
|
-
type:
|
|
2196
|
+
type: import_zod13.z.literal("event")
|
|
2117
2197
|
});
|
|
2118
|
-
var CABVariableTrigger =
|
|
2198
|
+
var CABVariableTrigger = import_zod13.z.discriminatedUnion("type", [
|
|
2119
2199
|
CABContentTrigger,
|
|
2120
2200
|
CABEventTrigger,
|
|
2121
2201
|
CABResultCountTrigger,
|
|
2122
2202
|
CABResultTagTrigger
|
|
2123
2203
|
]);
|
|
2124
|
-
var CABVariableMutator =
|
|
2204
|
+
var CABVariableMutator = import_zod13.z.object({
|
|
2125
2205
|
effect: variableEffect.default(VariableEffect.set_false),
|
|
2126
|
-
variable:
|
|
2206
|
+
variable: import_zod13.z.string().min(1),
|
|
2127
2207
|
when: CABVariableTrigger
|
|
2128
2208
|
});
|
|
2129
2209
|
var CABVariableFields = {
|
|
2130
|
-
mutators:
|
|
2131
|
-
variables:
|
|
2210
|
+
mutators: import_zod13.z.array(CABVariableMutator).optional(),
|
|
2211
|
+
variables: import_zod13.z.array(CABVariable).refine((variables) => new Set(variables.map(({ name }) => name)).size === variables.length, {
|
|
2132
2212
|
message: "variable names must be unique within a section"
|
|
2133
2213
|
}).optional(),
|
|
2134
2214
|
visibility: CABVisibility.optional()
|
|
2135
2215
|
};
|
|
2136
2216
|
|
|
2137
2217
|
// src/schema/widgets/checkout-and-beyond/text.ts
|
|
2138
|
-
var enumOrOmit = (...vals) =>
|
|
2139
|
-
var TiptapText =
|
|
2140
|
-
marks:
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
attrs:
|
|
2147
|
-
class:
|
|
2148
|
-
href:
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2218
|
+
var enumOrOmit = (...vals) => import_zod14.z.string().transform((val) => vals.includes(val) ? val : void 0).optional();
|
|
2219
|
+
var TiptapText = import_zod14.z.object({
|
|
2220
|
+
marks: import_zod14.z.union([
|
|
2221
|
+
import_zod14.z.array(
|
|
2222
|
+
import_zod14.z.discriminatedUnion("type", [
|
|
2223
|
+
import_zod14.z.object({ type: import_zod14.z.literal("bold") }),
|
|
2224
|
+
import_zod14.z.object({ type: import_zod14.z.literal("italic") }),
|
|
2225
|
+
import_zod14.z.object({
|
|
2226
|
+
attrs: import_zod14.z.object({
|
|
2227
|
+
class: import_zod14.z.string().nullable(),
|
|
2228
|
+
href: import_zod14.z.union([
|
|
2229
|
+
import_zod14.z.url(),
|
|
2230
|
+
import_zod14.z.literal("#"),
|
|
2231
|
+
import_zod14.z.string().regex(DYNAMIC_TOKEN_REGEX),
|
|
2232
|
+
import_zod14.z.string().regex(ROOT_RELATIVE_PATH_REGEX)
|
|
2153
2233
|
]),
|
|
2154
|
-
rel:
|
|
2155
|
-
target:
|
|
2234
|
+
rel: import_zod14.z.string().default("noopener noreferrer nofollow"),
|
|
2235
|
+
target: import_zod14.z.string().default("_blank")
|
|
2156
2236
|
}),
|
|
2157
|
-
type:
|
|
2237
|
+
type: import_zod14.z.literal("link")
|
|
2158
2238
|
}),
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
attrs:
|
|
2239
|
+
import_zod14.z.object({ type: import_zod14.z.literal("strike") }),
|
|
2240
|
+
import_zod14.z.object({
|
|
2241
|
+
attrs: import_zod14.z.object({
|
|
2162
2242
|
color: enumOrOmit(...textColorNames).default(TextColorName.base),
|
|
2163
2243
|
fontSize: enumOrOmit(...textSizeNames).default(TextSizeName.base)
|
|
2164
2244
|
}),
|
|
2165
|
-
type:
|
|
2245
|
+
type: import_zod14.z.literal("textStyle")
|
|
2166
2246
|
})
|
|
2167
2247
|
])
|
|
2168
2248
|
),
|
|
2169
|
-
|
|
2249
|
+
import_zod14.z.strictObject({}).transform(() => [])
|
|
2170
2250
|
]).optional(),
|
|
2171
|
-
text:
|
|
2172
|
-
type:
|
|
2251
|
+
text: import_zod14.z.string().default(""),
|
|
2252
|
+
type: import_zod14.z.literal("text").default("text")
|
|
2173
2253
|
});
|
|
2174
|
-
var TiptapParagraph =
|
|
2175
|
-
attrs:
|
|
2254
|
+
var TiptapParagraph = import_zod14.z.object({
|
|
2255
|
+
attrs: import_zod14.z.object({
|
|
2176
2256
|
textAlign: enumOrOmit(...textAlignments)
|
|
2177
2257
|
}).default({ textAlign: TextAlignment.start }),
|
|
2178
|
-
content:
|
|
2179
|
-
type:
|
|
2258
|
+
content: import_zod14.z.union([import_zod14.z.array(TiptapText), import_zod14.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
2259
|
+
type: import_zod14.z.literal("paragraph").default("paragraph")
|
|
2180
2260
|
});
|
|
2181
|
-
var TiptapDocument =
|
|
2182
|
-
attrs:
|
|
2261
|
+
var TiptapDocument = import_zod14.z.object({
|
|
2262
|
+
attrs: import_zod14.z.object({
|
|
2183
2263
|
blockSpacing: enumOrOmit(...spacings)
|
|
2184
2264
|
}).default({ blockSpacing: Spacing.base }),
|
|
2185
|
-
content:
|
|
2186
|
-
type:
|
|
2265
|
+
content: import_zod14.z.union([import_zod14.z.array(TiptapParagraph), import_zod14.z.strictObject({}).transform(() => [])]).default(() => [TiptapParagraph.parse({})]),
|
|
2266
|
+
type: import_zod14.z.literal("doc").default("doc")
|
|
2187
2267
|
});
|
|
2188
|
-
var CABTextTier =
|
|
2189
|
-
threshold:
|
|
2190
|
-
thresholds:
|
|
2191
|
-
tierId:
|
|
2192
|
-
tierType:
|
|
2268
|
+
var CABTextTier = import_zod14.z.object({
|
|
2269
|
+
threshold: import_zod14.z.number().int().nonnegative(),
|
|
2270
|
+
thresholds: import_zod14.z.record(import_zod14.z.string(), import_zod14.z.number().int().nonnegative()).default(() => ({})),
|
|
2271
|
+
tierId: import_zod14.z.string().optional(),
|
|
2272
|
+
tierType: import_zod14.z.enum(progressTierTypes).default(ProgressTierType.shipping)
|
|
2193
2273
|
});
|
|
2194
|
-
var CABTextSection =
|
|
2274
|
+
var CABTextSection = import_zod14.z.object({
|
|
2195
2275
|
...CABVariableFields,
|
|
2196
|
-
buttonField:
|
|
2197
|
-
content:
|
|
2198
|
-
name:
|
|
2199
|
-
optionId:
|
|
2200
|
-
sectionId:
|
|
2201
|
-
sectionType:
|
|
2276
|
+
buttonField: import_zod14.z.enum(buttonFields).optional(),
|
|
2277
|
+
content: import_zod14.z.record(import_zod14.z.string(), import_zod14.z.union([import_zod14.z.string(), TiptapDocument]).refine(checkForHTML, NO_HTML).optional()).default({ en: TiptapDocument.parse({}) }).optional(),
|
|
2278
|
+
name: import_zod14.z.string().optional(),
|
|
2279
|
+
optionId: import_zod14.z.number().optional(),
|
|
2280
|
+
sectionId: import_zod14.z.uuid().default(() => (0, import_uuid2.v7)()),
|
|
2281
|
+
sectionType: import_zod14.z.literal(SectionType.text).default(SectionType.text),
|
|
2202
2282
|
tier: CABTextTier.optional()
|
|
2203
2283
|
}).superRefine(({ buttonField, content }, ctx) => {
|
|
2204
2284
|
if (buttonField === ButtonField.destinationUrl && content) {
|
|
@@ -2220,137 +2300,137 @@ var CABTextSection = import_zod13.z.object({
|
|
|
2220
2300
|
});
|
|
2221
2301
|
|
|
2222
2302
|
// src/schema/widgets/post-purchase-offer/postPurchaseBlocks.ts
|
|
2223
|
-
var TextAlignment2 =
|
|
2224
|
-
var TextSize =
|
|
2225
|
-
|
|
2226
|
-
|
|
2303
|
+
var TextAlignment2 = import_zod15.z.union([import_zod15.z.enum(["leading", "center", "trailing"]), import_zod15.z.unknown().transform(() => "leading")]);
|
|
2304
|
+
var TextSize = import_zod15.z.union([
|
|
2305
|
+
import_zod15.z.enum(["xsmall", "small", "base", "default", "medium", "large", "xlarge"]),
|
|
2306
|
+
import_zod15.z.unknown().transform(() => "medium")
|
|
2227
2307
|
]);
|
|
2228
|
-
var CalloutBannerBlock =
|
|
2229
|
-
id:
|
|
2230
|
-
name:
|
|
2231
|
-
settings:
|
|
2232
|
-
superTitle:
|
|
2233
|
-
title:
|
|
2308
|
+
var CalloutBannerBlock = import_zod15.z.object({
|
|
2309
|
+
id: import_zod15.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2310
|
+
name: import_zod15.z.string().optional(),
|
|
2311
|
+
settings: import_zod15.z.object({
|
|
2312
|
+
superTitle: import_zod15.z.union([import_zod15.z.string(), TiptapDocument]).default(() => "Limited-time Offer"),
|
|
2313
|
+
title: import_zod15.z.union([import_zod15.z.string(), TiptapDocument]).default(() => "Add this customer favorite to your order")
|
|
2234
2314
|
}),
|
|
2235
|
-
styles:
|
|
2236
|
-
superTitleEmphasized:
|
|
2315
|
+
styles: import_zod15.z.object({
|
|
2316
|
+
superTitleEmphasized: import_zod15.z.boolean().default(false),
|
|
2237
2317
|
superTitleSize: TextSize.default("large"),
|
|
2238
2318
|
textAlignment: TextAlignment2.default("center"),
|
|
2239
|
-
titleEmphasized:
|
|
2319
|
+
titleEmphasized: import_zod15.z.boolean().default(true),
|
|
2240
2320
|
titleSize: TextSize.default("large")
|
|
2241
2321
|
}),
|
|
2242
|
-
type:
|
|
2322
|
+
type: import_zod15.z.literal(BlockType.callout_banner).default(BlockType.callout_banner)
|
|
2243
2323
|
});
|
|
2244
|
-
var ImageBlock =
|
|
2245
|
-
id:
|
|
2246
|
-
name:
|
|
2247
|
-
settings:
|
|
2248
|
-
|
|
2324
|
+
var ImageBlock = import_zod15.z.object({
|
|
2325
|
+
id: import_zod15.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2326
|
+
name: import_zod15.z.string().optional(),
|
|
2327
|
+
settings: import_zod15.z.union([
|
|
2328
|
+
import_zod15.z.object({
|
|
2249
2329
|
/** This isn't used in the post-purchase offer widget */
|
|
2250
|
-
alt:
|
|
2251
|
-
image:
|
|
2252
|
-
imageSize:
|
|
2253
|
-
imageType:
|
|
2330
|
+
alt: import_zod15.z.string().optional().default(""),
|
|
2331
|
+
image: import_zod15.z.union([import_zod15.z.literal(""), import_zod15.z.url()]).default(""),
|
|
2332
|
+
imageSize: import_zod15.z.number().default(20),
|
|
2333
|
+
imageType: import_zod15.z.enum(["URL", "UPLOAD"]).default("URL")
|
|
2254
2334
|
}),
|
|
2255
|
-
|
|
2335
|
+
import_zod15.z.array(import_zod15.z.never()).transform(() => ({}))
|
|
2256
2336
|
]),
|
|
2257
|
-
type:
|
|
2258
|
-
});
|
|
2259
|
-
var ImageContentBlock =
|
|
2260
|
-
id:
|
|
2261
|
-
name:
|
|
2262
|
-
settings:
|
|
2263
|
-
alt:
|
|
2264
|
-
description:
|
|
2337
|
+
type: import_zod15.z.literal(BlockType.image).default(BlockType.image)
|
|
2338
|
+
});
|
|
2339
|
+
var ImageContentBlock = import_zod15.z.object({
|
|
2340
|
+
id: import_zod15.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2341
|
+
name: import_zod15.z.string().optional(),
|
|
2342
|
+
settings: import_zod15.z.object({
|
|
2343
|
+
alt: import_zod15.z.string().optional().default(""),
|
|
2344
|
+
description: import_zod15.z.union([import_zod15.z.string(), TiptapDocument, import_zod15.z.null()]).default(
|
|
2265
2345
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
|
2266
2346
|
),
|
|
2267
2347
|
descriptionSize: TextSize.default("medium"),
|
|
2268
2348
|
horizontalAlignment: TextAlignment2.default("leading"),
|
|
2269
|
-
image:
|
|
2270
|
-
imagePlacement:
|
|
2271
|
-
imageSize:
|
|
2272
|
-
superTitle:
|
|
2349
|
+
image: import_zod15.z.union([import_zod15.z.literal(""), import_zod15.z.url()]).default(""),
|
|
2350
|
+
imagePlacement: import_zod15.z.enum(["bottom", "left", "right", "top"]).optional().default("left"),
|
|
2351
|
+
imageSize: import_zod15.z.number().default(20),
|
|
2352
|
+
superTitle: import_zod15.z.union([import_zod15.z.string(), TiptapDocument]).default("Lorem Ipsum!"),
|
|
2273
2353
|
superTitleSize: TextSize.default("medium"),
|
|
2274
2354
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2275
|
-
swapContent:
|
|
2276
|
-
title:
|
|
2355
|
+
swapContent: import_zod15.z.boolean().optional().default(false),
|
|
2356
|
+
title: import_zod15.z.union([import_zod15.z.string(), TiptapDocument]).nullable().default("Lorem ipsum dolor sit amet"),
|
|
2277
2357
|
titleSize: TextSize.default("medium")
|
|
2278
2358
|
}),
|
|
2279
|
-
type:
|
|
2280
|
-
});
|
|
2281
|
-
var PayButtonBlock =
|
|
2282
|
-
id:
|
|
2283
|
-
name:
|
|
2284
|
-
settings:
|
|
2285
|
-
|
|
2286
|
-
label:
|
|
2359
|
+
type: import_zod15.z.literal(BlockType.image_content).default(BlockType.image_content)
|
|
2360
|
+
});
|
|
2361
|
+
var PayButtonBlock = import_zod15.z.object({
|
|
2362
|
+
id: import_zod15.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2363
|
+
name: import_zod15.z.string().optional(),
|
|
2364
|
+
settings: import_zod15.z.union([
|
|
2365
|
+
import_zod15.z.object({
|
|
2366
|
+
label: import_zod15.z.string().default("Pay Now")
|
|
2287
2367
|
}),
|
|
2288
|
-
|
|
2368
|
+
import_zod15.z.array(import_zod15.z.never()).transform(() => ({
|
|
2289
2369
|
label: "Pay Now"
|
|
2290
2370
|
}))
|
|
2291
2371
|
]),
|
|
2292
|
-
styles:
|
|
2293
|
-
|
|
2294
|
-
buttonWidth:
|
|
2372
|
+
styles: import_zod15.z.union([
|
|
2373
|
+
import_zod15.z.object({
|
|
2374
|
+
buttonWidth: import_zod15.z.number().min(10).max(100).default(50)
|
|
2295
2375
|
}),
|
|
2296
|
-
|
|
2376
|
+
import_zod15.z.array(import_zod15.z.never()).transform(() => ({
|
|
2297
2377
|
buttonWidth: 50
|
|
2298
2378
|
}))
|
|
2299
2379
|
]),
|
|
2300
|
-
type:
|
|
2380
|
+
type: import_zod15.z.literal(BlockType.pay_button).default(BlockType.pay_button)
|
|
2301
2381
|
});
|
|
2302
|
-
var ProductInformationBlock =
|
|
2382
|
+
var ProductInformationBlock = import_zod15.z.object({
|
|
2303
2383
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2304
|
-
hideProductImage:
|
|
2305
|
-
id:
|
|
2306
|
-
name:
|
|
2307
|
-
type:
|
|
2308
|
-
});
|
|
2309
|
-
var SeparatorBlock =
|
|
2310
|
-
id:
|
|
2311
|
-
name:
|
|
2312
|
-
type:
|
|
2313
|
-
});
|
|
2314
|
-
var TextBlock =
|
|
2315
|
-
id:
|
|
2316
|
-
name:
|
|
2317
|
-
settings:
|
|
2318
|
-
description:
|
|
2384
|
+
hideProductImage: import_zod15.z.boolean().optional().default(false),
|
|
2385
|
+
id: import_zod15.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2386
|
+
name: import_zod15.z.string().optional(),
|
|
2387
|
+
type: import_zod15.z.literal(BlockType.product_information).default(BlockType.product_information)
|
|
2388
|
+
});
|
|
2389
|
+
var SeparatorBlock = import_zod15.z.object({
|
|
2390
|
+
id: import_zod15.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2391
|
+
name: import_zod15.z.string().optional(),
|
|
2392
|
+
type: import_zod15.z.literal(BlockType.separator).default(BlockType.separator)
|
|
2393
|
+
});
|
|
2394
|
+
var TextBlock = import_zod15.z.object({
|
|
2395
|
+
id: import_zod15.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2396
|
+
name: import_zod15.z.string().optional(),
|
|
2397
|
+
settings: import_zod15.z.object({
|
|
2398
|
+
description: import_zod15.z.union([import_zod15.z.string(), TiptapDocument]).optional().default(
|
|
2319
2399
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
|
|
2320
2400
|
),
|
|
2321
2401
|
/** This isn't used in the post-purchase offer widget */
|
|
2322
2402
|
descriptionSize: TextSize.default("medium"),
|
|
2323
2403
|
horizontalAlignment: TextAlignment2.default("leading"),
|
|
2324
|
-
superTitle:
|
|
2404
|
+
superTitle: import_zod15.z.union([import_zod15.z.string(), TiptapDocument]).default("Super Title"),
|
|
2325
2405
|
/** This isn't used in the post-purchase offer widget */
|
|
2326
2406
|
superTitleSize: TextSize.default("medium"),
|
|
2327
|
-
title:
|
|
2407
|
+
title: import_zod15.z.union([import_zod15.z.string(), TiptapDocument]).nullable().default("Lorem ipsum dolor sit amet."),
|
|
2328
2408
|
/** This isn't used in the post-purchase offer widget */
|
|
2329
2409
|
titleSize: TextSize.default("medium")
|
|
2330
2410
|
}),
|
|
2331
|
-
type:
|
|
2332
|
-
});
|
|
2333
|
-
var TimerBlock =
|
|
2334
|
-
id:
|
|
2335
|
-
name:
|
|
2336
|
-
settings:
|
|
2337
|
-
durationMinutes:
|
|
2338
|
-
durationSeconds:
|
|
2339
|
-
endOffer:
|
|
2340
|
-
title:
|
|
2411
|
+
type: import_zod15.z.literal(BlockType.text).default(BlockType.text)
|
|
2412
|
+
});
|
|
2413
|
+
var TimerBlock = import_zod15.z.object({
|
|
2414
|
+
id: import_zod15.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2415
|
+
name: import_zod15.z.string().optional(),
|
|
2416
|
+
settings: import_zod15.z.object({
|
|
2417
|
+
durationMinutes: import_zod15.z.number().min(0).default(10),
|
|
2418
|
+
durationSeconds: import_zod15.z.union([import_zod15.z.number().min(0), import_zod15.z.unknown().transform(() => 0)]).default(0),
|
|
2419
|
+
endOffer: import_zod15.z.boolean().default(true),
|
|
2420
|
+
title: import_zod15.z.union([import_zod15.z.string(), TiptapDocument]).default("Hurry \u2014 your special offer ends in:")
|
|
2341
2421
|
}),
|
|
2342
|
-
styles:
|
|
2422
|
+
styles: import_zod15.z.object({
|
|
2343
2423
|
textAlignment: TextAlignment2.default("center"),
|
|
2344
|
-
timerBackgroundColor:
|
|
2345
|
-
timerEmphasized:
|
|
2424
|
+
timerBackgroundColor: import_zod15.z.enum(["info", "warning", "success", "critical"]).default("warning"),
|
|
2425
|
+
timerEmphasized: import_zod15.z.union([import_zod15.z.boolean(), import_zod15.z.unknown().transform(() => true)]).default(true),
|
|
2346
2426
|
timerSize: TextSize.default("medium"),
|
|
2347
|
-
timerWidth:
|
|
2348
|
-
titleEmphasized:
|
|
2427
|
+
timerWidth: import_zod15.z.number().min(10).max(100).optional().default(100),
|
|
2428
|
+
titleEmphasized: import_zod15.z.union([import_zod15.z.boolean(), import_zod15.z.unknown().transform(() => true)]).default(false),
|
|
2349
2429
|
titleSize: TextSize.default("medium")
|
|
2350
2430
|
}),
|
|
2351
|
-
type:
|
|
2431
|
+
type: import_zod15.z.literal(BlockType.timer).default(BlockType.timer)
|
|
2352
2432
|
});
|
|
2353
|
-
var PostPurchaseBlock =
|
|
2433
|
+
var PostPurchaseBlock = import_zod15.z.discriminatedUnion("type", [
|
|
2354
2434
|
CalloutBannerBlock,
|
|
2355
2435
|
ImageBlock,
|
|
2356
2436
|
ImageContentBlock,
|
|
@@ -2370,61 +2450,61 @@ var isTextBlock = (block) => (0, import_compat4.isEqual)((0, import_compat4.get)
|
|
|
2370
2450
|
var isTimerBlock = (block) => (0, import_compat4.isEqual)((0, import_compat4.get)(block, "type"), BlockType.timer);
|
|
2371
2451
|
|
|
2372
2452
|
// src/schema/widgets/post-purchase-offer/postPurchaseSettings.ts
|
|
2373
|
-
var PostPurchaseSettings =
|
|
2374
|
-
advance:
|
|
2375
|
-
blocks:
|
|
2453
|
+
var PostPurchaseSettings = import_zod16.z.object({
|
|
2454
|
+
advance: import_zod16.z.object({ removePartialOrder: import_zod16.z.boolean().default(true) }).optional().default(() => ({ removePartialOrder: true })),
|
|
2455
|
+
blocks: import_zod16.z.union([import_zod16.z.array(PostPurchaseBlock), import_zod16.z.unknown().transform(() => [])]).default(() => [
|
|
2376
2456
|
PostPurchaseBlock.parse({ settings: {}, styles: {}, type: BlockType.timer }),
|
|
2377
2457
|
PostPurchaseBlock.parse({ settings: {}, styles: {}, type: BlockType.callout_banner }),
|
|
2378
2458
|
PostPurchaseBlock.parse({ type: BlockType.product_information })
|
|
2379
2459
|
]),
|
|
2380
|
-
columnLayout:
|
|
2381
|
-
discount:
|
|
2460
|
+
columnLayout: import_zod16.z.boolean().optional(),
|
|
2461
|
+
discount: import_zod16.z.object({
|
|
2382
2462
|
amount: strictNumber.default(30),
|
|
2383
|
-
shouldShowSavingText:
|
|
2384
|
-
type:
|
|
2463
|
+
shouldShowSavingText: import_zod16.z.boolean().optional().default(true),
|
|
2464
|
+
type: import_zod16.z.enum(["none", "fixed_amount", "percentage"]).default("none")
|
|
2385
2465
|
}),
|
|
2386
|
-
discountedFrom:
|
|
2387
|
-
endpoint:
|
|
2388
|
-
integrations:
|
|
2389
|
-
judgeme:
|
|
2390
|
-
junip:
|
|
2391
|
-
klaviyo:
|
|
2392
|
-
loox:
|
|
2393
|
-
okendo:
|
|
2394
|
-
opinew:
|
|
2395
|
-
reviewsio:
|
|
2396
|
-
stamped:
|
|
2397
|
-
yotpo:
|
|
2466
|
+
discountedFrom: import_zod16.z.enum(["price", "compare_at_price"]).optional().default("price"),
|
|
2467
|
+
endpoint: import_zod16.z.string().optional(),
|
|
2468
|
+
integrations: import_zod16.z.object({
|
|
2469
|
+
judgeme: import_zod16.z.boolean().default(false),
|
|
2470
|
+
junip: import_zod16.z.boolean().optional().default(false),
|
|
2471
|
+
klaviyo: import_zod16.z.boolean().default(false),
|
|
2472
|
+
loox: import_zod16.z.boolean().default(false),
|
|
2473
|
+
okendo: import_zod16.z.boolean().default(false),
|
|
2474
|
+
opinew: import_zod16.z.boolean().optional().default(false),
|
|
2475
|
+
reviewsio: import_zod16.z.boolean().optional().default(false),
|
|
2476
|
+
stamped: import_zod16.z.boolean().default(false),
|
|
2477
|
+
yotpo: import_zod16.z.boolean().default(false)
|
|
2398
2478
|
}),
|
|
2399
|
-
key:
|
|
2400
|
-
language:
|
|
2401
|
-
description:
|
|
2402
|
-
descriptionEnabled:
|
|
2403
|
-
descriptionRte:
|
|
2404
|
-
content:
|
|
2405
|
-
type:
|
|
2479
|
+
key: import_zod16.z.string().optional(),
|
|
2480
|
+
language: import_zod16.z.object({
|
|
2481
|
+
description: import_zod16.z.union([import_zod16.z.string(), import_zod16.z.unknown().transform(() => "")]).default(""),
|
|
2482
|
+
descriptionEnabled: import_zod16.z.boolean().optional().default(false),
|
|
2483
|
+
descriptionRte: import_zod16.z.object({
|
|
2484
|
+
content: import_zod16.z.array(import_zod16.z.unknown()),
|
|
2485
|
+
type: import_zod16.z.string()
|
|
2406
2486
|
}).optional(),
|
|
2407
|
-
descriptionSpacing:
|
|
2408
|
-
displayCtaPrice:
|
|
2409
|
-
global:
|
|
2410
|
-
declineAll:
|
|
2411
|
-
declineThisOffer:
|
|
2412
|
-
free:
|
|
2413
|
-
notAvailable:
|
|
2414
|
-
payNow:
|
|
2415
|
-
payNowUpgradeToSubscription:
|
|
2416
|
-
quantity:
|
|
2487
|
+
descriptionSpacing: import_zod16.z.enum(["none", "xtight", "tight", "default", "loose", "xloose"]).optional(),
|
|
2488
|
+
displayCtaPrice: import_zod16.z.boolean().default(true),
|
|
2489
|
+
global: import_zod16.z.object({
|
|
2490
|
+
declineAll: import_zod16.z.string().optional().default("Decline All"),
|
|
2491
|
+
declineThisOffer: import_zod16.z.string().default("Decline this offer"),
|
|
2492
|
+
free: import_zod16.z.string().optional().default("Free"),
|
|
2493
|
+
notAvailable: import_zod16.z.string().optional().default("Not available"),
|
|
2494
|
+
payNow: import_zod16.z.string().default("Pay Now"),
|
|
2495
|
+
payNowUpgradeToSubscription: import_zod16.z.string().optional().default("Upgrade to Subscription"),
|
|
2496
|
+
quantity: import_zod16.z.string().default("Quantity"),
|
|
2417
2497
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2418
|
-
recurringShipping:
|
|
2419
|
-
recurringSubtotal:
|
|
2420
|
-
reviewsPlural:
|
|
2421
|
-
reviewsSingular:
|
|
2422
|
-
save:
|
|
2423
|
-
shipping:
|
|
2424
|
-
subscriptionOption:
|
|
2425
|
-
subtotal:
|
|
2426
|
-
taxes:
|
|
2427
|
-
total:
|
|
2498
|
+
recurringShipping: import_zod16.z.string().optional().default("Recurring shipping"),
|
|
2499
|
+
recurringSubtotal: import_zod16.z.string().default("Recurring subtotal"),
|
|
2500
|
+
reviewsPlural: import_zod16.z.string().optional().default("Reviews"),
|
|
2501
|
+
reviewsSingular: import_zod16.z.string().optional().default("Review"),
|
|
2502
|
+
save: import_zod16.z.union([import_zod16.z.string(), import_zod16.z.unknown().transform(() => "Save")]).optional().default("Save"),
|
|
2503
|
+
shipping: import_zod16.z.string().default("Shipping"),
|
|
2504
|
+
subscriptionOption: import_zod16.z.string().optional().default("Subscribe and Save"),
|
|
2505
|
+
subtotal: import_zod16.z.string().default("Subtotal"),
|
|
2506
|
+
taxes: import_zod16.z.string().default("Taxes"),
|
|
2507
|
+
total: import_zod16.z.string().default("Total")
|
|
2428
2508
|
}).optional().default(() => ({
|
|
2429
2509
|
declineAll: "Decline All",
|
|
2430
2510
|
declineThisOffer: "Decline this offer",
|
|
@@ -2445,70 +2525,70 @@ var PostPurchaseSettings = import_zod15.z.object({
|
|
|
2445
2525
|
taxes: "Taxes",
|
|
2446
2526
|
total: "Total"
|
|
2447
2527
|
})),
|
|
2448
|
-
globalTranslation:
|
|
2528
|
+
globalTranslation: import_zod16.z.string().optional().default("english")
|
|
2449
2529
|
}),
|
|
2450
|
-
metafields:
|
|
2530
|
+
metafields: import_zod16.z.boolean().default(false),
|
|
2451
2531
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2452
|
-
offer:
|
|
2453
|
-
count:
|
|
2532
|
+
offer: import_zod16.z.object({
|
|
2533
|
+
count: import_zod16.z.number().default(1)
|
|
2454
2534
|
}),
|
|
2455
|
-
offersLayout:
|
|
2456
|
-
itemsPerPage:
|
|
2457
|
-
type:
|
|
2535
|
+
offersLayout: import_zod16.z.object({
|
|
2536
|
+
itemsPerPage: import_zod16.z.number().optional(),
|
|
2537
|
+
type: import_zod16.z.enum(["list", "grid", "carousel"]).default("list")
|
|
2458
2538
|
}).optional().default({
|
|
2459
2539
|
type: "list"
|
|
2460
2540
|
}),
|
|
2461
2541
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2462
|
-
previewMode:
|
|
2463
|
-
productLimit:
|
|
2464
|
-
productOptions:
|
|
2542
|
+
previewMode: import_zod16.z.boolean().default(false),
|
|
2543
|
+
productLimit: import_zod16.z.number().optional().default(1),
|
|
2544
|
+
productOptions: import_zod16.z.object({
|
|
2465
2545
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2466
|
-
hideOutOfStockVariants:
|
|
2467
|
-
matchVariant:
|
|
2468
|
-
showDeclineAll:
|
|
2469
|
-
showShipping:
|
|
2470
|
-
showSubtotal:
|
|
2471
|
-
showTaxes:
|
|
2472
|
-
showTotal:
|
|
2473
|
-
showVariantSelectors:
|
|
2474
|
-
variantSelectorDisplayMode:
|
|
2546
|
+
hideOutOfStockVariants: import_zod16.z.boolean().optional().default(false),
|
|
2547
|
+
matchVariant: import_zod16.z.boolean().optional().default(true),
|
|
2548
|
+
showDeclineAll: import_zod16.z.enum(["above", "below", "both", "none"]).optional(),
|
|
2549
|
+
showShipping: import_zod16.z.boolean().optional().default(true),
|
|
2550
|
+
showSubtotal: import_zod16.z.boolean().optional().default(true),
|
|
2551
|
+
showTaxes: import_zod16.z.boolean().optional().default(true),
|
|
2552
|
+
showTotal: import_zod16.z.boolean().optional().default(true),
|
|
2553
|
+
showVariantSelectors: import_zod16.z.boolean().optional().default(true),
|
|
2554
|
+
variantSelectorDisplayMode: import_zod16.z.enum(["separate", "single"]).optional().default("separate")
|
|
2475
2555
|
}),
|
|
2476
|
-
productType:
|
|
2477
|
-
productTypeSelector:
|
|
2478
|
-
quantityInputs:
|
|
2479
|
-
defaultQuantity:
|
|
2480
|
-
enabled:
|
|
2481
|
-
maxValue:
|
|
2482
|
-
minValue:
|
|
2556
|
+
productType: import_zod16.z.union([import_zod16.z.enum(["one-time", "subscription", "both"]), import_zod16.z.literal("").transform(() => "one-time")]).default("one-time"),
|
|
2557
|
+
productTypeSelector: import_zod16.z.enum(["dropdown", "radio"]).optional().default("radio"),
|
|
2558
|
+
quantityInputs: import_zod16.z.object({
|
|
2559
|
+
defaultQuantity: import_zod16.z.union([import_zod16.z.number(), import_zod16.z.null().transform(() => 1)]).default(1),
|
|
2560
|
+
enabled: import_zod16.z.boolean().default(true),
|
|
2561
|
+
maxValue: import_zod16.z.union([import_zod16.z.number(), import_zod16.z.null().transform(() => 15)]).default(15),
|
|
2562
|
+
minValue: import_zod16.z.union([import_zod16.z.number().min(0), import_zod16.z.unknown().transform(() => 0)]).default(1)
|
|
2483
2563
|
}),
|
|
2484
|
-
shipping:
|
|
2564
|
+
shipping: import_zod16.z.object({
|
|
2485
2565
|
amount: strictNumber.default(10),
|
|
2486
2566
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2487
|
-
enabled:
|
|
2488
|
-
title:
|
|
2489
|
-
type:
|
|
2567
|
+
enabled: import_zod16.z.boolean().default(true),
|
|
2568
|
+
title: import_zod16.z.string().optional().default("Shipping Fees"),
|
|
2569
|
+
type: import_zod16.z.enum(["free", "fixed_amount"]).default("free")
|
|
2490
2570
|
}),
|
|
2491
|
-
styles:
|
|
2492
|
-
starColor:
|
|
2493
|
-
starSize:
|
|
2494
|
-
starStrokeColor:
|
|
2495
|
-
strokeWidth:
|
|
2571
|
+
styles: import_zod16.z.object({
|
|
2572
|
+
starColor: import_zod16.z.string().optional().default("#fadb14"),
|
|
2573
|
+
starSize: import_zod16.z.union([import_zod16.z.enum(["small", "medium", "large"]), import_zod16.z.unknown().transform(() => "large")]).optional().default("large"),
|
|
2574
|
+
starStrokeColor: import_zod16.z.string().optional().default("#fadb14"),
|
|
2575
|
+
strokeWidth: import_zod16.z.string().optional().default("1")
|
|
2496
2576
|
}).optional(),
|
|
2497
|
-
subImages:
|
|
2498
|
-
subscription:
|
|
2499
|
-
discount:
|
|
2577
|
+
subImages: import_zod16.z.number().nullish().default(8),
|
|
2578
|
+
subscription: import_zod16.z.object({
|
|
2579
|
+
discount: import_zod16.z.object({
|
|
2500
2580
|
amount: strictNumber.default(30),
|
|
2501
|
-
shouldShowSavingText:
|
|
2502
|
-
type:
|
|
2581
|
+
shouldShowSavingText: import_zod16.z.boolean().optional().default(true),
|
|
2582
|
+
type: import_zod16.z.enum(["none", "fixed_amount", "percentage"]).default("none")
|
|
2503
2583
|
}),
|
|
2504
|
-
shipping:
|
|
2584
|
+
shipping: import_zod16.z.object({
|
|
2505
2585
|
amount: strictNumber.default(1),
|
|
2506
2586
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2507
|
-
enabled:
|
|
2587
|
+
enabled: import_zod16.z.boolean().default(true),
|
|
2508
2588
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2509
2589
|
recurringAmount: strictNumber.default(2),
|
|
2510
|
-
shippingTitle:
|
|
2511
|
-
type:
|
|
2590
|
+
shippingTitle: import_zod16.z.string().default("Shipping Fees"),
|
|
2591
|
+
type: import_zod16.z.enum(["free", "fixed_amount"]).default("free")
|
|
2512
2592
|
})
|
|
2513
2593
|
}).optional().default({
|
|
2514
2594
|
discount: {
|
|
@@ -2526,15 +2606,15 @@ var PostPurchaseSettings = import_zod15.z.object({
|
|
|
2526
2606
|
type: "free"
|
|
2527
2607
|
}
|
|
2528
2608
|
}),
|
|
2529
|
-
subscriptionIsDefault:
|
|
2609
|
+
subscriptionIsDefault: import_zod16.z.boolean().optional(),
|
|
2530
2610
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2531
|
-
template:
|
|
2532
|
-
type:
|
|
2533
|
-
upgradeToSubscription:
|
|
2534
|
-
acceptButtonText:
|
|
2535
|
-
allow:
|
|
2536
|
-
emailRefundNotice:
|
|
2537
|
-
errorBannerText:
|
|
2611
|
+
template: import_zod16.z.string().optional().default(""),
|
|
2612
|
+
type: import_zod16.z.literal("shopify_post_purchase_extension").default("shopify_post_purchase_extension"),
|
|
2613
|
+
upgradeToSubscription: import_zod16.z.object({
|
|
2614
|
+
acceptButtonText: import_zod16.z.string().optional().default("Upgrade"),
|
|
2615
|
+
allow: import_zod16.z.boolean().optional().default(false),
|
|
2616
|
+
emailRefundNotice: import_zod16.z.boolean().optional().default(false),
|
|
2617
|
+
errorBannerText: import_zod16.z.string().optional().default("This subscription cannot be added - limit one per order")
|
|
2538
2618
|
}).optional().default(() => ({
|
|
2539
2619
|
acceptButtonText: "Upgrade",
|
|
2540
2620
|
allow: false,
|
|
@@ -2543,91 +2623,43 @@ var PostPurchaseSettings = import_zod15.z.object({
|
|
|
2543
2623
|
}))
|
|
2544
2624
|
});
|
|
2545
2625
|
|
|
2546
|
-
// src/schema/postPurchaseChoice.ts
|
|
2547
|
-
var PostPurchaseChoice = import_zod16.z.discriminatedUnion("mode", [
|
|
2548
|
-
import_zod16.z.object({ mode: import_zod16.z.literal("one-time") }).strict(),
|
|
2549
|
-
import_zod16.z.object({ mode: import_zod16.z.literal("subscription"), sellingPlanId: PostPurchasePlanOption.shape.id }).strict()
|
|
2550
|
-
]);
|
|
2551
|
-
var PostPurchaseOptions = import_zod16.z.object({
|
|
2552
|
-
defaultChoice: PostPurchaseChoice,
|
|
2553
|
-
modes: import_zod16.z.array(import_zod16.z.enum(["one-time", "subscription"])).min(1).max(2),
|
|
2554
|
-
selector: PostPurchaseSettings.shape.productTypeSelector
|
|
2555
|
-
});
|
|
2556
|
-
|
|
2557
|
-
// src/schema/postPurchaseEligibility.ts
|
|
2558
|
-
var import_zod17 = require("zod");
|
|
2559
|
-
var PostPurchaseSkipReasonSchema = import_zod17.z.enum(["empty", "no-eligible-subscription"]);
|
|
2560
|
-
|
|
2561
|
-
// src/schema/postPurchaseExitPolicy.ts
|
|
2562
|
-
var import_zod18 = require("zod");
|
|
2563
|
-
var EXIT_DELAY_MAX_MS = 60 * 60 * 1e3;
|
|
2564
|
-
var ExitPolicySchema = import_zod18.z.discriminatedUnion("status", [
|
|
2565
|
-
import_zod18.z.strictObject({ status: import_zod18.z.literal("unavailable") }),
|
|
2566
|
-
import_zod18.z.strictObject({
|
|
2567
|
-
delayMs: import_zod18.z.number().int().nonnegative().max(EXIT_DELAY_MAX_MS),
|
|
2568
|
-
source: import_zod18.z.enum(["admitted", "selected-flow"]),
|
|
2569
|
-
status: import_zod18.z.literal("available")
|
|
2570
|
-
})
|
|
2571
|
-
]);
|
|
2572
|
-
|
|
2573
|
-
// src/schema/postPurchaseProduct.ts
|
|
2574
|
-
var import_zod24 = require("zod");
|
|
2575
|
-
|
|
2576
|
-
// src/schema/postPurchaseProductDisplay.ts
|
|
2577
|
-
var import_zod21 = require("zod");
|
|
2578
|
-
|
|
2579
|
-
// src/schema/postPurchaseProductGallery.ts
|
|
2580
|
-
var import_zod19 = require("zod");
|
|
2581
|
-
var PostPurchaseProductGallery = import_zod19.z.object({
|
|
2582
|
-
images: import_zod19.z.array(
|
|
2583
|
-
import_zod19.z.object({
|
|
2584
|
-
description: import_zod19.z.string(),
|
|
2585
|
-
id: import_zod19.z.number().int().positive(),
|
|
2586
|
-
source: import_zod19.z.string(),
|
|
2587
|
-
thumbnail: import_zod19.z.string()
|
|
2588
|
-
})
|
|
2589
|
-
),
|
|
2590
|
-
selectedImageId: import_zod19.z.number().int().positive().optional()
|
|
2591
|
-
});
|
|
2592
|
-
|
|
2593
2626
|
// src/schema/postPurchaseProductReviews.ts
|
|
2594
|
-
var
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
import_zod20.z.string().regex(/^\d+(?:\.\d+)?$/).transform(Number)
|
|
2627
|
+
var decimal = import_zod17.z.union([
|
|
2628
|
+
import_zod17.z.number(),
|
|
2629
|
+
import_zod17.z.string().regex(/^\d+(?:\.\d+)?$/).transform(Number)
|
|
2598
2630
|
]);
|
|
2599
|
-
var PostPurchaseCommonReviewRating =
|
|
2631
|
+
var PostPurchaseCommonReviewRating = import_zod17.z.object({ value: decimal.pipe(import_zod17.z.number().min(0).max(5)) });
|
|
2600
2632
|
var PostPurchaseKlaviyoReviewRating = PostPurchaseCommonReviewRating.extend({
|
|
2601
2633
|
// Legacy validates key presence, then displays the raw value on five stars without rescaling.
|
|
2602
|
-
scale_max:
|
|
2603
|
-
scale_min:
|
|
2634
|
+
scale_max: import_zod17.z.unknown().nonoptional(),
|
|
2635
|
+
scale_min: import_zod17.z.unknown().nonoptional()
|
|
2604
2636
|
});
|
|
2605
|
-
var PostPurchaseReviewCount =
|
|
2637
|
+
var PostPurchaseReviewCount = import_zod17.z.string().regex(/^\d+(?:\.\d+)?$/).transform(Number).pipe(import_zod17.z.number().int().nonnegative());
|
|
2606
2638
|
var PostPurchaseReviewStyles = PostPurchaseSettings.shape.styles.unwrap().extend({
|
|
2607
|
-
strokeWidth: decimal.pipe(
|
|
2639
|
+
strokeWidth: decimal.pipe(import_zod17.z.number().nonnegative()).default(1)
|
|
2608
2640
|
}).prefault({});
|
|
2609
|
-
var PostPurchaseProductReviews =
|
|
2610
|
-
color:
|
|
2611
|
-
rating:
|
|
2612
|
-
reviewCount:
|
|
2613
|
-
reviewsPlural:
|
|
2614
|
-
reviewsSingular:
|
|
2615
|
-
size:
|
|
2616
|
-
strokeColor:
|
|
2617
|
-
strokeWidth:
|
|
2641
|
+
var PostPurchaseProductReviews = import_zod17.z.object({
|
|
2642
|
+
color: import_zod17.z.string(),
|
|
2643
|
+
rating: import_zod17.z.number().positive().max(5),
|
|
2644
|
+
reviewCount: import_zod17.z.number().int().nonnegative(),
|
|
2645
|
+
reviewsPlural: import_zod17.z.string(),
|
|
2646
|
+
reviewsSingular: import_zod17.z.string(),
|
|
2647
|
+
size: import_zod17.z.enum(["small", "medium", "large"]),
|
|
2648
|
+
strokeColor: import_zod17.z.string(),
|
|
2649
|
+
strokeWidth: import_zod17.z.number().nonnegative()
|
|
2618
2650
|
});
|
|
2619
2651
|
|
|
2620
2652
|
// src/schema/postPurchaseProductDisplay.ts
|
|
2621
2653
|
var language = PostPurchaseSettings.shape.language;
|
|
2622
|
-
var PostPurchasePrimaryImageSource =
|
|
2654
|
+
var PostPurchasePrimaryImageSource = import_zod18.z.string().default(
|
|
2623
2655
|
"https://cdn.shopify.com/shopifycloud/shopify/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c.gif"
|
|
2624
2656
|
);
|
|
2625
|
-
var PostPurchaseProductDisplay =
|
|
2657
|
+
var PostPurchaseProductDisplay = import_zod18.z.object({
|
|
2626
2658
|
descriptionDocument: TiptapDocument.optional(),
|
|
2627
2659
|
discountedFrom: PostPurchaseSettings.shape.discountedFrom,
|
|
2628
2660
|
gallery: PostPurchaseProductGallery.optional(),
|
|
2629
2661
|
language: language.pick({ description: true, descriptionEnabled: true }),
|
|
2630
|
-
primaryImage:
|
|
2662
|
+
primaryImage: import_zod18.z.object({ description: import_zod18.z.string(), source: import_zod18.z.string() }),
|
|
2631
2663
|
productOptions: PostPurchaseSettings.shape.productOptions.pick({
|
|
2632
2664
|
showDeclineAll: true,
|
|
2633
2665
|
showShipping: true,
|
|
@@ -2642,10 +2674,10 @@ var PostPurchaseProductDisplay = import_zod21.z.object({
|
|
|
2642
2674
|
});
|
|
2643
2675
|
|
|
2644
2676
|
// src/schema/postPurchaseProductSource.ts
|
|
2645
|
-
var
|
|
2646
|
-
var PostPurchaseAmount =
|
|
2647
|
-
var PostPurchaseProductId =
|
|
2648
|
-
var PostPurchaseVariantId =
|
|
2677
|
+
var import_zod19 = require("zod");
|
|
2678
|
+
var PostPurchaseAmount = import_zod19.z.string().regex(/^\d+(?:\.\d+)?$/).refine((value) => Number.isFinite(Number(value)));
|
|
2679
|
+
var PostPurchaseProductId = import_zod19.z.number().int().positive();
|
|
2680
|
+
var PostPurchaseVariantId = import_zod19.z.number().int().positive();
|
|
2649
2681
|
var ProductBase = OfferProduct.pick({ description: true, id: true, image: true, title: true }).extend({
|
|
2650
2682
|
description: OfferProduct.shape.description.nullable(),
|
|
2651
2683
|
id: PostPurchaseProductId
|
|
@@ -2653,56 +2685,65 @@ var ProductBase = OfferProduct.pick({ description: true, id: true, image: true,
|
|
|
2653
2685
|
var SourceVariant = OfferProduct.shape.variants.element.pick({ id: true, title: true }).extend({
|
|
2654
2686
|
compareAtPrice: PostPurchaseAmount.nullable(),
|
|
2655
2687
|
id: PostPurchaseVariantId,
|
|
2656
|
-
imageId:
|
|
2657
|
-
inventoryManagement:
|
|
2658
|
-
inventoryPolicy:
|
|
2659
|
-
inventoryQuantity:
|
|
2660
|
-
option1:
|
|
2661
|
-
option2:
|
|
2662
|
-
option3:
|
|
2688
|
+
imageId: import_zod19.z.number().int().nonnegative().nullish(),
|
|
2689
|
+
inventoryManagement: import_zod19.z.string().nullable(),
|
|
2690
|
+
inventoryPolicy: import_zod19.z.string(),
|
|
2691
|
+
inventoryQuantity: import_zod19.z.number(),
|
|
2692
|
+
option1: import_zod19.z.unknown().optional(),
|
|
2693
|
+
option2: import_zod19.z.unknown().optional(),
|
|
2694
|
+
option3: import_zod19.z.unknown().optional(),
|
|
2663
2695
|
price: PostPurchaseAmount,
|
|
2664
2696
|
productId: PostPurchaseProductId,
|
|
2665
|
-
sellingPlanAllocations:
|
|
2697
|
+
sellingPlanAllocations: import_zod19.z.unknown().optional()
|
|
2666
2698
|
});
|
|
2667
2699
|
var Product2 = ProductBase.extend({
|
|
2668
|
-
images:
|
|
2669
|
-
|
|
2700
|
+
images: import_zod19.z.array(
|
|
2701
|
+
import_zod19.z.object({ alt: import_zod19.z.string().optional().catch(void 0), id: import_zod19.z.number().int().positive(), src: import_zod19.z.string() })
|
|
2670
2702
|
).nullish(),
|
|
2671
|
-
metadata:
|
|
2672
|
-
productQuantity:
|
|
2673
|
-
|
|
2674
|
-
|
|
2703
|
+
metadata: import_zod19.z.object({
|
|
2704
|
+
productQuantity: import_zod19.z.union([
|
|
2705
|
+
import_zod19.z.number().int().positive(),
|
|
2706
|
+
import_zod19.z.string().regex(/^[1-9]\d*$/).transform(Number)
|
|
2675
2707
|
]).optional()
|
|
2676
2708
|
}).optional(),
|
|
2677
|
-
metafields:
|
|
2678
|
-
options:
|
|
2679
|
-
productGroupVariants:
|
|
2680
|
-
selectedVariant:
|
|
2681
|
-
sellingPlanGroups:
|
|
2709
|
+
metafields: import_zod19.z.unknown().optional(),
|
|
2710
|
+
options: import_zod19.z.unknown().optional(),
|
|
2711
|
+
productGroupVariants: import_zod19.z.array(import_zod19.z.unknown()).default([]),
|
|
2712
|
+
selectedVariant: import_zod19.z.unknown().optional(),
|
|
2713
|
+
sellingPlanGroups: import_zod19.z.array(
|
|
2682
2714
|
OfferProduct.shape.sellingPlanGroups.unwrap().element.extend({
|
|
2683
|
-
discountAmount:
|
|
2684
|
-
discountType:
|
|
2685
|
-
id:
|
|
2686
|
-
requiresSellingPlan:
|
|
2687
|
-
sellingPlans:
|
|
2715
|
+
discountAmount: import_zod19.z.unknown().optional(),
|
|
2716
|
+
discountType: import_zod19.z.unknown().optional(),
|
|
2717
|
+
id: import_zod19.z.unknown().optional(),
|
|
2718
|
+
requiresSellingPlan: import_zod19.z.boolean().default(false),
|
|
2719
|
+
sellingPlans: import_zod19.z.unknown().optional()
|
|
2688
2720
|
})
|
|
2689
2721
|
).default([]),
|
|
2690
|
-
variants:
|
|
2722
|
+
variants: import_zod19.z.array(SourceVariant)
|
|
2691
2723
|
});
|
|
2692
|
-
var PostPurchaseProductSource =
|
|
2693
|
-
data:
|
|
2694
|
-
metadata:
|
|
2724
|
+
var PostPurchaseProductSource = import_zod19.z.object({
|
|
2725
|
+
data: import_zod19.z.array(Product2),
|
|
2726
|
+
metadata: import_zod19.z.object({ widget: import_zod19.z.record(import_zod19.z.string(), import_zod19.z.unknown()).default({}) }).default({ widget: {} })
|
|
2695
2727
|
});
|
|
2696
2728
|
|
|
2697
2729
|
// src/schema/postPurchaseSubscription.ts
|
|
2698
|
-
var
|
|
2699
|
-
|
|
2730
|
+
var import_zod21 = require("zod");
|
|
2731
|
+
|
|
2732
|
+
// src/schema/postPurchasePlanAdjustment.ts
|
|
2733
|
+
var import_zod20 = require("zod");
|
|
2734
|
+
var PostPurchasePlanAdjustment = import_zod20.z.object({
|
|
2735
|
+
amount: PostPurchaseDiscount.shape.amount,
|
|
2736
|
+
type: import_zod20.z.enum(["percentage", "fixed_amount", "price"])
|
|
2737
|
+
}).refine(({ amount: amount2, type }) => type === "price" || validPostPurchaseDiscount({ amount: amount2, type }));
|
|
2738
|
+
|
|
2739
|
+
// src/schema/postPurchaseSubscription.ts
|
|
2740
|
+
var PostPurchaseSubscriptionTerms = import_zod21.z.object({
|
|
2700
2741
|
adjustment: PostPurchasePlanAdjustment.optional(),
|
|
2701
|
-
initialShippingPrice:
|
|
2702
|
-
intervalLabel:
|
|
2703
|
-
name:
|
|
2704
|
-
recurringShippingPrice:
|
|
2705
|
-
shippingOption:
|
|
2742
|
+
initialShippingPrice: import_zod21.z.number().nonnegative(),
|
|
2743
|
+
intervalLabel: import_zod21.z.string().min(1),
|
|
2744
|
+
name: import_zod21.z.string().min(1),
|
|
2745
|
+
recurringShippingPrice: import_zod21.z.number().nonnegative(),
|
|
2746
|
+
shippingOption: import_zod21.z.object({ presentmentTitle: import_zod21.z.string(), title: import_zod21.z.string() })
|
|
2706
2747
|
});
|
|
2707
2748
|
|
|
2708
2749
|
// src/schema/postPurchaseProduct.ts
|
|
@@ -2712,88 +2753,464 @@ var PostPurchaseVariant = OfferProduct.shape.variants.element.pick({ id: true, t
|
|
|
2712
2753
|
id: PostPurchaseVariantId,
|
|
2713
2754
|
price: PostPurchaseAmount
|
|
2714
2755
|
});
|
|
2715
|
-
var PreparedPostPurchaseProduct =
|
|
2756
|
+
var PreparedPostPurchaseProduct = import_zod22.z.object({
|
|
2716
2757
|
display: PostPurchaseProductDisplay,
|
|
2717
|
-
labels:
|
|
2758
|
+
labels: import_zod22.z.object({
|
|
2718
2759
|
declineAll: global.declineAll,
|
|
2719
|
-
free:
|
|
2720
|
-
payNow:
|
|
2721
|
-
quantity:
|
|
2760
|
+
free: import_zod22.z.string(),
|
|
2761
|
+
payNow: import_zod22.z.string(),
|
|
2762
|
+
quantity: import_zod22.z.string(),
|
|
2722
2763
|
recurringShipping: global.recurringShipping,
|
|
2723
2764
|
recurringSubtotal: global.recurringSubtotal,
|
|
2724
|
-
save:
|
|
2725
|
-
shipping:
|
|
2726
|
-
subtotal:
|
|
2727
|
-
taxes:
|
|
2728
|
-
total:
|
|
2765
|
+
save: import_zod22.z.string(),
|
|
2766
|
+
shipping: import_zod22.z.string(),
|
|
2767
|
+
subtotal: import_zod22.z.string(),
|
|
2768
|
+
taxes: import_zod22.z.string(),
|
|
2769
|
+
total: import_zod22.z.string()
|
|
2729
2770
|
}),
|
|
2730
2771
|
product: OfferProduct.pick({ description: true, id: true, image: true, title: true }).extend({
|
|
2731
2772
|
description: OfferProduct.shape.description.nullable(),
|
|
2732
2773
|
id: PostPurchaseProductId,
|
|
2733
2774
|
variant: PostPurchaseVariant
|
|
2734
2775
|
}),
|
|
2735
|
-
selection:
|
|
2776
|
+
selection: import_zod22.z.object({
|
|
2736
2777
|
productId: PostPurchaseProductId,
|
|
2737
|
-
quantity:
|
|
2738
|
-
sellingPlanId:
|
|
2778
|
+
quantity: import_zod22.z.number().int().positive(),
|
|
2779
|
+
sellingPlanId: import_zod22.z.number().int().positive().optional(),
|
|
2739
2780
|
variantId: PostPurchaseVariantId
|
|
2740
2781
|
}),
|
|
2741
|
-
status:
|
|
2742
|
-
terms:
|
|
2782
|
+
status: import_zod22.z.literal("prepared"),
|
|
2783
|
+
terms: import_zod22.z.object({
|
|
2743
2784
|
discount: PostPurchaseDiscount,
|
|
2744
|
-
shipping:
|
|
2745
|
-
amount:
|
|
2746
|
-
title:
|
|
2747
|
-
type:
|
|
2785
|
+
shipping: import_zod22.z.object({
|
|
2786
|
+
amount: import_zod22.z.number().nonnegative(),
|
|
2787
|
+
title: import_zod22.z.string(),
|
|
2788
|
+
type: import_zod22.z.enum(["free", "fixed_amount"])
|
|
2748
2789
|
}),
|
|
2749
2790
|
subscription: PostPurchaseSubscriptionTerms.optional()
|
|
2750
2791
|
})
|
|
2751
2792
|
});
|
|
2752
|
-
var PostPurchasePreparation =
|
|
2793
|
+
var PostPurchasePreparation = import_zod22.z.discriminatedUnion("status", [
|
|
2753
2794
|
PreparedPostPurchaseProduct,
|
|
2754
|
-
|
|
2795
|
+
import_zod22.z.object({ reason: import_zod22.z.string(), status: import_zod22.z.literal("unsupported") })
|
|
2755
2796
|
]);
|
|
2756
2797
|
|
|
2757
|
-
// src/schema/
|
|
2758
|
-
var
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2798
|
+
// src/schema/postPurchaseProductCalculation.ts
|
|
2799
|
+
var import_zod23 = require("zod");
|
|
2800
|
+
var MoneyBag = import_zod23.z.object({
|
|
2801
|
+
presentmentMoney: import_zod23.z.object({
|
|
2802
|
+
amount: PostPurchaseAmount,
|
|
2803
|
+
currencyCode: import_zod23.z.string().regex(/^[A-Z]{3}$/)
|
|
2804
|
+
})
|
|
2805
|
+
});
|
|
2806
|
+
var PostPurchaseProductCalculation = import_zod23.z.object({
|
|
2807
|
+
calculatedPurchase: import_zod23.z.object({
|
|
2808
|
+
addedShippingLines: import_zod23.z.array(import_zod23.z.object({ priceSet: MoneyBag })),
|
|
2809
|
+
addedTaxLines: import_zod23.z.array(import_zod23.z.object({ priceSet: MoneyBag })),
|
|
2810
|
+
totalOutstandingSet: MoneyBag,
|
|
2811
|
+
updatedLineItems: import_zod23.z.array(
|
|
2812
|
+
import_zod23.z.object({
|
|
2813
|
+
priceSet: import_zod23.z.unknown().optional(),
|
|
2814
|
+
productId: import_zod23.z.number().int().positive(),
|
|
2815
|
+
sellingPlanId: import_zod23.z.unknown().optional(),
|
|
2816
|
+
variantId: import_zod23.z.number().int().positive()
|
|
2817
|
+
})
|
|
2818
|
+
)
|
|
2819
|
+
}),
|
|
2820
|
+
errors: import_zod23.z.array(import_zod23.z.unknown()).length(0),
|
|
2821
|
+
status: import_zod23.z.literal("processed")
|
|
2822
|
+
});
|
|
2823
|
+
var Minor = import_zod23.z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
2824
|
+
var PostPurchaseProductCosts = import_zod23.z.object({
|
|
2825
|
+
currencyCode: MoneyBag.shape.presentmentMoney.shape.currencyCode,
|
|
2826
|
+
recurringDisplay: import_zod23.z.object({ shippingMinor: Minor, subtotalMinor: Minor, totalMinor: Minor }).optional(),
|
|
2827
|
+
shippingMinor: Minor,
|
|
2828
|
+
subtotalMinor: Minor,
|
|
2829
|
+
taxesMinor: Minor,
|
|
2830
|
+
totalMinor: Minor
|
|
2831
|
+
});
|
|
2832
|
+
var ChangesetDiscount = import_zod23.z.object({
|
|
2833
|
+
title: import_zod23.z.string(),
|
|
2834
|
+
value: import_zod23.z.number().nonnegative(),
|
|
2835
|
+
valueType: import_zod23.z.enum(["percentage", "fixed_amount"])
|
|
2836
|
+
}).optional();
|
|
2837
|
+
var PostPurchaseProductChangeset = import_zod23.z.object({
|
|
2838
|
+
changes: import_zod23.z.array(
|
|
2839
|
+
import_zod23.z.union([
|
|
2840
|
+
import_zod23.z.object({
|
|
2841
|
+
discount: ChangesetDiscount,
|
|
2842
|
+
quantity: import_zod23.z.number().int().positive(),
|
|
2843
|
+
type: import_zod23.z.literal("add_variant"),
|
|
2844
|
+
variantId: import_zod23.z.number().int().positive()
|
|
2845
|
+
}),
|
|
2846
|
+
import_zod23.z.object({ price: import_zod23.z.number().nonnegative(), title: import_zod23.z.string(), type: import_zod23.z.literal("add_shipping_line") }),
|
|
2847
|
+
PostPurchaseSubscriptionTerms.pick({
|
|
2848
|
+
initialShippingPrice: true,
|
|
2849
|
+
recurringShippingPrice: true,
|
|
2850
|
+
shippingOption: true
|
|
2851
|
+
}).extend({
|
|
2852
|
+
discount: ChangesetDiscount,
|
|
2853
|
+
quantity: import_zod23.z.number().int().positive(),
|
|
2854
|
+
sellingPlanId: import_zod23.z.number().int().positive(),
|
|
2855
|
+
type: import_zod23.z.literal("add_subscription"),
|
|
2856
|
+
variantId: import_zod23.z.number().int().positive()
|
|
2857
|
+
})
|
|
2858
|
+
])
|
|
2859
|
+
)
|
|
2860
|
+
});
|
|
2762
2861
|
|
|
2763
|
-
// src/schema/
|
|
2764
|
-
var
|
|
2862
|
+
// src/schema/postPurchaseAdmission.ts
|
|
2863
|
+
var PurchaseExpectedSchema = import_zod24.z.object({
|
|
2864
|
+
buyerConsentToSubscriptions: import_zod24.z.boolean().optional(),
|
|
2865
|
+
changeset: PostPurchaseProductChangeset.extend({
|
|
2866
|
+
changes: PostPurchaseProductChangeset.shape.changes.min(1).max(2)
|
|
2867
|
+
}),
|
|
2868
|
+
entry: DecisionEntrySchema,
|
|
2869
|
+
member: PostPurchaseMemberIdentity.optional(),
|
|
2870
|
+
progressRevision: import_zod24.z.number().int().nonnegative().optional(),
|
|
2871
|
+
selection: PreparedPostPurchaseProduct.shape.selection
|
|
2872
|
+
}).refine(
|
|
2873
|
+
({ member, progressRevision }) => !member || progressRevision !== void 0,
|
|
2874
|
+
"Captured member requires progress"
|
|
2875
|
+
).refine(({ buyerConsentToSubscriptions: consent, changeset, selection: selection2 }) => {
|
|
2876
|
+
const [change, shipping] = changeset.changes;
|
|
2877
|
+
if (selection2.sellingPlanId === void 0)
|
|
2878
|
+
return consent !== true && change?.type === "add_variant" && change.variantId === selection2.variantId && change.quantity === selection2.quantity && (shipping === void 0 || shipping.type === "add_shipping_line");
|
|
2879
|
+
return consent === true && changeset.changes.length === 1 && change.type === "add_subscription" && change.sellingPlanId === selection2.sellingPlanId && change.variantId === selection2.variantId && change.quantity === selection2.quantity;
|
|
2880
|
+
}, "Selection, change and buyer consent must agree");
|
|
2881
|
+
var PurchaseRequestSchema = DecideRequestSchema.extend({
|
|
2882
|
+
expected: PurchaseExpectedSchema,
|
|
2883
|
+
requestId: import_zod24.z.uuid()
|
|
2884
|
+
}).strict();
|
|
2885
|
+
var PurchaseReceiptSchema = import_zod24.z.object({
|
|
2886
|
+
admittedAt: PostPurchaseTimestampSchema,
|
|
2887
|
+
changesetToken: import_zod24.z.string().min(1),
|
|
2888
|
+
operationId: import_zod24.z.uuid(),
|
|
2889
|
+
requiresSubscriptionConsent: import_zod24.z.boolean(),
|
|
2890
|
+
selection: PreparedPostPurchaseProduct.shape.selection
|
|
2891
|
+
}).refine(
|
|
2892
|
+
({ requiresSubscriptionConsent, selection: selection2 }) => requiresSubscriptionConsent === (selection2.sellingPlanId !== void 0),
|
|
2893
|
+
"Receipt consent must match its selected plan"
|
|
2894
|
+
);
|
|
2895
|
+
var PurchaseResponseSchema = import_zod24.z.object({ data: PurchaseReceiptSchema, successful: import_zod24.z.literal(true) });
|
|
2896
|
+
|
|
2897
|
+
// src/schema/postPurchaseAcceptedEvent.ts
|
|
2898
|
+
var EventCalculationSchema = PostPurchaseProductCosts.pick({ currencyCode: true, totalMinor: true }).strict();
|
|
2899
|
+
var AcceptedEventOutcomeSchema = import_zod25.z.enum(["acknowledged", "rejected", "skipped", "unknown"]);
|
|
2900
|
+
var AttemptProgressSchema = import_zod25.z.strictObject({
|
|
2901
|
+
attemptedAt: PostPurchaseTimestampSchema,
|
|
2902
|
+
reportedCalculation: EventCalculationSchema,
|
|
2903
|
+
status: import_zod25.z.literal("attempted")
|
|
2904
|
+
});
|
|
2905
|
+
var AcceptedEventAttemptProgressSchema = AttemptProgressSchema.extend({
|
|
2906
|
+
operationId: PurchaseReceiptSchema.shape.operationId
|
|
2907
|
+
});
|
|
2908
|
+
var AcceptedEventResultProgressSchema = AttemptProgressSchema.extend({
|
|
2909
|
+
finishedAt: PostPurchaseTimestampSchema,
|
|
2910
|
+
status: AcceptedEventOutcomeSchema
|
|
2911
|
+
}).extend({ operationId: PurchaseReceiptSchema.shape.operationId });
|
|
2912
|
+
var AcceptedEventRequestSchema = DecideRequestSchema.extend({
|
|
2913
|
+
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
2914
|
+
reportedCalculation: EventCalculationSchema
|
|
2915
|
+
}).strict();
|
|
2916
|
+
var AcceptedEventResponseSchema = import_zod25.z.object({
|
|
2917
|
+
data: import_zod25.z.union([AcceptedEventAttemptProgressSchema, AcceptedEventResultProgressSchema]),
|
|
2918
|
+
successful: import_zod25.z.literal(true)
|
|
2919
|
+
});
|
|
2765
2920
|
|
|
2766
|
-
// src/schema/
|
|
2921
|
+
// src/schema/postPurchaseAcceptedMetafield.ts
|
|
2767
2922
|
var import_zod26 = require("zod");
|
|
2923
|
+
var AcceptedMetafieldOutcomeSchema = import_zod26.z.enum(["acknowledged", "rejected", "unknown"]);
|
|
2924
|
+
var AcceptedMetafieldRequestSchema = DecideRequestSchema.extend({
|
|
2925
|
+
operationId: PurchaseReceiptSchema.shape.operationId
|
|
2926
|
+
}).strict();
|
|
2927
|
+
var AcceptedMetafieldResultSchema = import_zod26.z.strictObject({
|
|
2928
|
+
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
2929
|
+
status: import_zod26.z.union([AcceptedMetafieldOutcomeSchema, import_zod26.z.enum(["attempted", "unavailable"])])
|
|
2930
|
+
});
|
|
2931
|
+
var AcceptedMetafieldResponseSchema = import_zod26.z.strictObject({
|
|
2932
|
+
data: AcceptedMetafieldResultSchema,
|
|
2933
|
+
successful: import_zod26.z.literal(true)
|
|
2934
|
+
});
|
|
2935
|
+
|
|
2936
|
+
// src/schema/postPurchaseAnalytics.ts
|
|
2937
|
+
var import_zod27 = require("zod");
|
|
2938
|
+
var PurchaseAnalyticsRequestSchema = AcceptedEventRequestSchema;
|
|
2939
|
+
var PurchaseAnalyticsStatusSchema = import_zod27.z.enum(["http-acknowledged", "unavailable"]);
|
|
2940
|
+
var PurchaseAnalyticsResponseSchema = import_zod27.z.object({
|
|
2941
|
+
data: import_zod27.z.object({ operationId: PurchaseReceiptSchema.shape.operationId, status: PurchaseAnalyticsStatusSchema }),
|
|
2942
|
+
successful: import_zod27.z.literal(true)
|
|
2943
|
+
});
|
|
2944
|
+
|
|
2945
|
+
// src/schema/postPurchaseChoice.ts
|
|
2946
|
+
var import_zod29 = require("zod");
|
|
2947
|
+
|
|
2948
|
+
// src/schema/postPurchasePlanCatalog.ts
|
|
2949
|
+
var import_zod28 = require("zod");
|
|
2950
|
+
var PostPurchasePlanOption = import_zod28.z.object({
|
|
2951
|
+
adjustment: PostPurchasePlanAdjustment.optional(),
|
|
2952
|
+
id: import_zod28.z.number().int().positive(),
|
|
2953
|
+
intervalFrequency: import_zod28.z.string().regex(/^[1-9]\d*$/).optional(),
|
|
2954
|
+
intervalLabel: import_zod28.z.string().min(1),
|
|
2955
|
+
name: import_zod28.z.string().min(1)
|
|
2956
|
+
});
|
|
2957
|
+
var PostPurchasePlanCatalog = import_zod28.z.object({
|
|
2958
|
+
plans: import_zod28.z.array(PostPurchasePlanOption),
|
|
2959
|
+
productId: import_zod28.z.number().int().positive(),
|
|
2960
|
+
requiresSellingPlan: import_zod28.z.boolean(),
|
|
2961
|
+
variantId: import_zod28.z.number().int().positive()
|
|
2962
|
+
});
|
|
2963
|
+
|
|
2964
|
+
// src/schema/postPurchaseChoice.ts
|
|
2965
|
+
var PostPurchaseChoice = import_zod29.z.discriminatedUnion("mode", [
|
|
2966
|
+
import_zod29.z.object({ mode: import_zod29.z.literal("one-time") }).strict(),
|
|
2967
|
+
import_zod29.z.object({ mode: import_zod29.z.literal("subscription"), sellingPlanId: PostPurchasePlanOption.shape.id }).strict()
|
|
2968
|
+
]);
|
|
2969
|
+
var PostPurchaseOptions = import_zod29.z.object({
|
|
2970
|
+
defaultChoice: PostPurchaseChoice,
|
|
2971
|
+
modes: import_zod29.z.array(import_zod29.z.enum(["one-time", "subscription"])).min(1).max(2),
|
|
2972
|
+
selector: PostPurchaseSettings.shape.productTypeSelector
|
|
2973
|
+
});
|
|
2974
|
+
|
|
2975
|
+
// src/schema/postPurchaseClassification.ts
|
|
2976
|
+
var import_zod30 = require("zod");
|
|
2977
|
+
var ClassificationAttemptProgressSchema = import_zod30.z.strictObject({
|
|
2978
|
+
attemptedAt: PostPurchaseTimestampSchema,
|
|
2979
|
+
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
2980
|
+
status: import_zod30.z.literal("attempted")
|
|
2981
|
+
});
|
|
2982
|
+
var ClassificationResultProgressSchema = ClassificationAttemptProgressSchema.extend({
|
|
2983
|
+
finishedAt: PostPurchaseTimestampSchema,
|
|
2984
|
+
status: AcceptedEventOutcomeSchema
|
|
2985
|
+
});
|
|
2986
|
+
var ClassificationProgressSchema = import_zod30.z.union([
|
|
2987
|
+
ClassificationAttemptProgressSchema,
|
|
2988
|
+
ClassificationResultProgressSchema,
|
|
2989
|
+
import_zod30.z.strictObject({ status: import_zod30.z.literal("unavailable") })
|
|
2990
|
+
]).nullable();
|
|
2991
|
+
|
|
2992
|
+
// src/schema/postPurchaseDecline.ts
|
|
2993
|
+
var import_zod34 = require("zod");
|
|
2994
|
+
|
|
2995
|
+
// src/schema/postPurchaseProgress.ts
|
|
2996
|
+
var import_zod32 = require("zod");
|
|
2997
|
+
|
|
2998
|
+
// src/schema/postPurchaseDeclineDelivery.ts
|
|
2999
|
+
var import_zod31 = require("zod");
|
|
3000
|
+
var AttemptSchema = import_zod31.z.strictObject({
|
|
3001
|
+
attemptedAt: PostPurchaseTimestampSchema,
|
|
3002
|
+
status: import_zod31.z.enum(["attempted", "unavailable"])
|
|
3003
|
+
});
|
|
3004
|
+
var DeclineDeliveryProgressSchema = import_zod31.z.union([
|
|
3005
|
+
AttemptSchema,
|
|
3006
|
+
AttemptSchema.extend({
|
|
3007
|
+
finishedAt: PostPurchaseTimestampSchema,
|
|
3008
|
+
status: AcceptedEventOutcomeSchema
|
|
3009
|
+
})
|
|
3010
|
+
]);
|
|
3011
|
+
|
|
3012
|
+
// src/schema/postPurchaseProgress.ts
|
|
3013
|
+
var PostPurchaseProgressSchema = import_zod32.z.object({
|
|
3014
|
+
closedAt: PostPurchaseTimestampSchema.nullable(),
|
|
3015
|
+
deadline: PostPurchaseTimestampSchema,
|
|
3016
|
+
entry: DecisionEntrySchema,
|
|
3017
|
+
entryRevision: import_zod32.z.number().int().nonnegative(),
|
|
3018
|
+
members: import_zod32.z.array(
|
|
3019
|
+
PostPurchaseMemberIdentity.extend({
|
|
3020
|
+
declineDelivery: DeclineDeliveryProgressSchema.optional(),
|
|
3021
|
+
status: import_zod32.z.enum(["unhandled", "accepted", "declined"])
|
|
3022
|
+
}).strict()
|
|
3023
|
+
),
|
|
3024
|
+
revision: import_zod32.z.number().int().nonnegative()
|
|
3025
|
+
}).strict();
|
|
2768
3026
|
|
|
2769
3027
|
// src/schema/postPurchaseVariantCatalog.ts
|
|
2770
|
-
var
|
|
2771
|
-
var PostPurchaseVariantSelector =
|
|
3028
|
+
var import_zod33 = require("zod");
|
|
3029
|
+
var PostPurchaseVariantSelector = import_zod33.z.object({ variantId: PostPurchaseVariantId }).strict();
|
|
2772
3030
|
var PostPurchaseVariantOption = OfferProduct.shape.options.element.extend({
|
|
2773
|
-
id:
|
|
2774
|
-
position:
|
|
3031
|
+
id: import_zod33.z.number().int().positive(),
|
|
3032
|
+
position: import_zod33.z.number().int().min(1).max(3)
|
|
2775
3033
|
});
|
|
2776
3034
|
var PostPurchaseVariantValues = OfferProduct.shape.variants.element.pick({
|
|
2777
3035
|
option1: true,
|
|
2778
3036
|
option2: true,
|
|
2779
3037
|
option3: true
|
|
2780
3038
|
});
|
|
2781
|
-
var PostPurchaseVariantCatalog =
|
|
3039
|
+
var PostPurchaseVariantCatalog = import_zod33.z.object({
|
|
2782
3040
|
displayMode: PostPurchaseSettings.shape.productOptions.shape.variantSelectorDisplayMode,
|
|
2783
|
-
options:
|
|
3041
|
+
options: import_zod33.z.array(PostPurchaseVariantOption),
|
|
2784
3042
|
productId: PostPurchaseProductId,
|
|
2785
3043
|
showSelectors: PostPurchaseSettings.shape.productOptions.shape.showVariantSelectors,
|
|
2786
|
-
variants:
|
|
3044
|
+
variants: import_zod33.z.array(
|
|
2787
3045
|
PostPurchaseVariantValues.partial().extend({
|
|
2788
|
-
available:
|
|
3046
|
+
available: import_zod33.z.boolean(),
|
|
2789
3047
|
id: PostPurchaseVariantId,
|
|
2790
|
-
imageId:
|
|
3048
|
+
imageId: import_zod33.z.number().int().nonnegative().nullish(),
|
|
2791
3049
|
title: OfferProduct.shape.variants.element.shape.title
|
|
2792
3050
|
})
|
|
2793
3051
|
)
|
|
2794
3052
|
});
|
|
2795
3053
|
|
|
3054
|
+
// src/schema/postPurchaseDecline.ts
|
|
3055
|
+
var OfferDeclineRequestSchema = DecideRequestSchema.extend({
|
|
3056
|
+
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
3057
|
+
productId: PostPurchaseProgressSchema.shape.members.element.shape.productId,
|
|
3058
|
+
progressRevision: PostPurchaseProgressSchema.shape.revision,
|
|
3059
|
+
selectedProductId: PostPurchaseProgressSchema.shape.members.element.shape.productId.optional(),
|
|
3060
|
+
variant: PostPurchaseVariantSelector.optional()
|
|
3061
|
+
}).strict().refine(
|
|
3062
|
+
({ selectedProductId, variant: variant2 }) => selectedProductId === void 0 || !!variant2,
|
|
3063
|
+
"Selected merchandise requires a variant"
|
|
3064
|
+
);
|
|
3065
|
+
var RecordedOfferDeclineSchema = PostPurchaseProgressSchema.shape.members.element.omit({ declineDelivery: true, status: true }).extend({ entry: DecisionEntrySchema.strict(), entryRevision: PostPurchaseProgressSchema.shape.entryRevision }).strict();
|
|
3066
|
+
var OfferDeclineResponseSchema = import_zod34.z.object({
|
|
3067
|
+
data: import_zod34.z.object({ decline: RecordedOfferDeclineSchema, progress: PostPurchaseProgressSchema }),
|
|
3068
|
+
successful: import_zod34.z.literal(true)
|
|
3069
|
+
});
|
|
3070
|
+
|
|
3071
|
+
// src/schema/postPurchaseEligibility.ts
|
|
3072
|
+
var import_zod35 = require("zod");
|
|
3073
|
+
var PostPurchaseSkipReasonSchema = import_zod35.z.enum(["empty", "no-eligible-subscription"]);
|
|
3074
|
+
|
|
3075
|
+
// src/schema/postPurchaseExitPolicy.ts
|
|
3076
|
+
var import_zod36 = require("zod");
|
|
3077
|
+
var EXIT_DELAY_MAX_MS = 60 * 60 * 1e3;
|
|
3078
|
+
var ExitPolicySchema = import_zod36.z.discriminatedUnion("status", [
|
|
3079
|
+
import_zod36.z.strictObject({ status: import_zod36.z.literal("unavailable") }),
|
|
3080
|
+
import_zod36.z.strictObject({
|
|
3081
|
+
delayMs: import_zod36.z.number().int().nonnegative().max(EXIT_DELAY_MAX_MS),
|
|
3082
|
+
source: import_zod36.z.enum(["admitted", "selected-flow"]),
|
|
3083
|
+
status: import_zod36.z.literal("available")
|
|
3084
|
+
})
|
|
3085
|
+
]);
|
|
3086
|
+
|
|
3087
|
+
// src/schema/postPurchaseFinish.ts
|
|
3088
|
+
var import_zod41 = require("zod");
|
|
3089
|
+
|
|
3090
|
+
// src/schema/postPurchaseFollowups.ts
|
|
3091
|
+
var import_zod39 = require("zod");
|
|
3092
|
+
|
|
3093
|
+
// src/schema/postPurchaseHealthProgress.ts
|
|
3094
|
+
var import_zod37 = require("zod");
|
|
3095
|
+
var HealthScheduleSchema = import_zod37.z.strictObject({
|
|
3096
|
+
checkoutToken: DecideRequestSchema.shape.checkoutToken,
|
|
3097
|
+
healthScheduledAt: PostPurchaseTimestampSchema,
|
|
3098
|
+
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
3099
|
+
orderId: PostPurchaseOrderIdSchema,
|
|
3100
|
+
removePartialOrder: import_zod37.z.boolean(),
|
|
3101
|
+
sessionId: import_zod37.z.string().regex(/^[a-f0-9]{64}$/),
|
|
3102
|
+
shop: DecideRequestSchema.shape.shop
|
|
3103
|
+
});
|
|
3104
|
+
var HealthSchedulingResponseSchema = import_zod37.z.object({
|
|
3105
|
+
data: import_zod37.z.object({
|
|
3106
|
+
callbackStatus: import_zod37.z.enum(["pending", "attempted", "returned", "unknown"]),
|
|
3107
|
+
facts: HealthScheduleSchema,
|
|
3108
|
+
scheduling: import_zod37.z.union([
|
|
3109
|
+
import_zod37.z.strictObject({ recordedAt: PostPurchaseTimestampSchema, status: import_zod37.z.literal("verified") }),
|
|
3110
|
+
import_zod37.z.strictObject({ status: import_zod37.z.enum(["unavailable", "unverified"]) })
|
|
3111
|
+
])
|
|
3112
|
+
}),
|
|
3113
|
+
successful: import_zod37.z.literal(true)
|
|
3114
|
+
});
|
|
3115
|
+
|
|
3116
|
+
// src/schema/postPurchaseObservation.ts
|
|
3117
|
+
var import_zod38 = require("zod");
|
|
3118
|
+
var PurchaseObservationSchema = import_zod38.z.union([
|
|
3119
|
+
import_zod38.z.object({
|
|
3120
|
+
changesetApplicationsRemaining: import_zod38.z.number().int().nonnegative(),
|
|
3121
|
+
errors: import_zod38.z.array(
|
|
3122
|
+
import_zod38.z.object({
|
|
3123
|
+
code: import_zod38.z.enum([
|
|
3124
|
+
"payment_required",
|
|
3125
|
+
"insufficient_inventory",
|
|
3126
|
+
"changeset_already_applied",
|
|
3127
|
+
"unsupported_payment_method",
|
|
3128
|
+
"invalid_request",
|
|
3129
|
+
"server_error",
|
|
3130
|
+
"buyer_consent_required",
|
|
3131
|
+
"subscription_vaulting_error",
|
|
3132
|
+
"subscription_contract_creation_error",
|
|
3133
|
+
"subscription_no_shipping_address_error",
|
|
3134
|
+
"subscription_limit_error",
|
|
3135
|
+
"order_released_error"
|
|
3136
|
+
]),
|
|
3137
|
+
message: import_zod38.z.string()
|
|
3138
|
+
}).strict()
|
|
3139
|
+
),
|
|
3140
|
+
status: import_zod38.z.enum(["processed", "partially_processed", "unprocessed"])
|
|
3141
|
+
}).strict(),
|
|
3142
|
+
import_zod38.z.object({ reason: import_zod38.z.literal("application-error"), status: import_zod38.z.literal("unknown") }).strict()
|
|
3143
|
+
]);
|
|
3144
|
+
var RecordedPurchaseObservationSchema = import_zod38.z.object({
|
|
3145
|
+
observation: PurchaseObservationSchema,
|
|
3146
|
+
recordedAt: PostPurchaseTimestampSchema
|
|
3147
|
+
}).strict();
|
|
3148
|
+
var PurchaseObservationRequestSchema = DecideRequestSchema.extend({
|
|
3149
|
+
observation: PurchaseObservationSchema,
|
|
3150
|
+
operationId: import_zod38.z.uuid()
|
|
3151
|
+
}).strict();
|
|
3152
|
+
var PurchaseObservationResponseSchema = import_zod38.z.object({
|
|
3153
|
+
data: RecordedPurchaseObservationSchema.extend({ operationId: import_zod38.z.uuid() }),
|
|
3154
|
+
successful: import_zod38.z.literal(true)
|
|
3155
|
+
});
|
|
3156
|
+
|
|
3157
|
+
// src/schema/postPurchaseFollowups.ts
|
|
3158
|
+
var RequiredHealthSchema = import_zod39.z.union([
|
|
3159
|
+
HealthSchedulingResponseSchema.shape.data,
|
|
3160
|
+
import_zod39.z.strictObject({ status: import_zod39.z.literal("unavailable") })
|
|
3161
|
+
]);
|
|
3162
|
+
var AcceptedFollowupsResponseSchema = import_zod39.z.object({
|
|
3163
|
+
data: import_zod39.z.object({
|
|
3164
|
+
acceptedEvent: import_zod39.z.union([
|
|
3165
|
+
AcceptedEventResponseSchema.shape.data,
|
|
3166
|
+
import_zod39.z.strictObject({ status: import_zod39.z.literal("unavailable") })
|
|
3167
|
+
]),
|
|
3168
|
+
acceptedMetafield: AcceptedMetafieldResultSchema,
|
|
3169
|
+
health: RequiredHealthSchema,
|
|
3170
|
+
purchase: PurchaseObservationResponseSchema.shape.data
|
|
3171
|
+
}),
|
|
3172
|
+
successful: import_zod39.z.literal(true)
|
|
3173
|
+
});
|
|
3174
|
+
|
|
3175
|
+
// src/schema/postPurchaseSessionClose.ts
|
|
3176
|
+
var import_zod40 = require("zod");
|
|
3177
|
+
var SessionClosureSchema = import_zod40.z.object({ closedAt: PostPurchaseTimestampSchema, status: import_zod40.z.literal("closed") });
|
|
3178
|
+
var SessionCloseRequestSchema = DecideRequestSchema.strict();
|
|
3179
|
+
var SessionCloseResponseSchema = import_zod40.z.object({ data: SessionClosureSchema, successful: import_zod40.z.literal(true) });
|
|
3180
|
+
|
|
3181
|
+
// src/schema/postPurchaseFinish.ts
|
|
3182
|
+
var FinishedPurchaseSchema = import_zod41.z.union([
|
|
3183
|
+
import_zod41.z.strictObject({ status: import_zod41.z.literal("none") }),
|
|
3184
|
+
import_zod41.z.strictObject({
|
|
3185
|
+
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
3186
|
+
status: import_zod41.z.union([
|
|
3187
|
+
import_zod41.z.literal("pending"),
|
|
3188
|
+
...PurchaseObservationSchema.options.map((option) => option.shape.status)
|
|
3189
|
+
])
|
|
3190
|
+
})
|
|
3191
|
+
]);
|
|
3192
|
+
var SessionFinishRequestSchema = DecideRequestSchema.strict();
|
|
3193
|
+
var SessionFinishResponseSchema = import_zod41.z.object({
|
|
3194
|
+
data: SessionClosureSchema.extend({
|
|
3195
|
+
classification: ClassificationProgressSchema,
|
|
3196
|
+
exitPolicy: ExitPolicySchema,
|
|
3197
|
+
health: RequiredHealthSchema.nullable(),
|
|
3198
|
+
purchase: FinishedPurchaseSchema
|
|
3199
|
+
}),
|
|
3200
|
+
successful: import_zod41.z.literal(true)
|
|
3201
|
+
});
|
|
3202
|
+
|
|
3203
|
+
// src/schema/postPurchaseQuantity.ts
|
|
3204
|
+
var import_zod64 = require("zod");
|
|
3205
|
+
|
|
3206
|
+
// src/schema/postPurchaseProductCollectionView.ts
|
|
3207
|
+
var import_zod63 = require("zod");
|
|
3208
|
+
|
|
3209
|
+
// src/schema/postPurchaseProductView.ts
|
|
3210
|
+
var import_zod62 = require("zod");
|
|
3211
|
+
|
|
2796
3212
|
// src/schema/postPurchaseGroupCatalog.ts
|
|
3213
|
+
var import_zod42 = require("zod");
|
|
2797
3214
|
var productId = PreparedPostPurchaseProduct.shape.selection.shape.productId;
|
|
2798
3215
|
var source = PostPurchaseProductSource.shape.data.element;
|
|
2799
3216
|
var PostPurchaseGroupDescription = source.pick({ description: true, id: true, image: true, images: true, title: true }).extend({
|
|
@@ -2801,17 +3218,17 @@ var PostPurchaseGroupDescription = source.pick({ description: true, id: true, im
|
|
|
2801
3218
|
image: source.shape.image.default(null),
|
|
2802
3219
|
options: PostPurchaseVariantCatalog.shape.options.default([])
|
|
2803
3220
|
});
|
|
2804
|
-
var PostPurchaseGroupCatalog =
|
|
3221
|
+
var PostPurchaseGroupCatalog = import_zod42.z.object({
|
|
2805
3222
|
memberProductId: productId,
|
|
2806
|
-
options:
|
|
3223
|
+
options: import_zod42.z.array(import_zod42.z.object({ productId, title: import_zod42.z.string(), variantCatalog: PostPurchaseVariantCatalog }))
|
|
2807
3224
|
});
|
|
2808
|
-
var PostPurchaseGroupSelection =
|
|
3225
|
+
var PostPurchaseGroupSelection = import_zod42.z.object({
|
|
2809
3226
|
memberProductId: productId,
|
|
2810
3227
|
productId
|
|
2811
3228
|
});
|
|
2812
3229
|
|
|
2813
3230
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
2814
|
-
var
|
|
3231
|
+
var import_zod61 = require("zod");
|
|
2815
3232
|
|
|
2816
3233
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
2817
3234
|
var import_es_toolkit3 = require("es-toolkit");
|
|
@@ -2866,18 +3283,18 @@ var targetAreas = {
|
|
|
2866
3283
|
|
|
2867
3284
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
2868
3285
|
var import_uuid15 = require("uuid");
|
|
2869
|
-
var
|
|
3286
|
+
var import_zod60 = require("zod");
|
|
2870
3287
|
|
|
2871
3288
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
2872
|
-
var
|
|
3289
|
+
var import_zod59 = require("zod");
|
|
2873
3290
|
|
|
2874
3291
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
2875
|
-
var
|
|
2876
|
-
var CABBannerSection =
|
|
3292
|
+
var import_zod43 = require("zod");
|
|
3293
|
+
var CABBannerSection = import_zod43.z.lazy(
|
|
2877
3294
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
2878
|
-
buttonField:
|
|
2879
|
-
color:
|
|
2880
|
-
dismissible:
|
|
3295
|
+
buttonField: import_zod43.z.enum(buttonFields).optional(),
|
|
3296
|
+
color: import_zod43.z.enum(bannerColors).default("info"),
|
|
3297
|
+
dismissible: import_zod43.z.boolean().default(true),
|
|
2881
3298
|
/**
|
|
2882
3299
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
2883
3300
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -2893,18 +3310,18 @@ var CABBannerSection = import_zod27.z.lazy(
|
|
|
2893
3310
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
2894
3311
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
2895
3312
|
*/
|
|
2896
|
-
heading:
|
|
2897
|
-
sectionType:
|
|
3313
|
+
heading: import_zod43.z.record(import_zod43.z.string(), import_zod43.z.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
3314
|
+
sectionType: import_zod43.z.literal(SectionType.banner).default(SectionType.banner)
|
|
2898
3315
|
})
|
|
2899
3316
|
);
|
|
2900
3317
|
|
|
2901
3318
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
2902
3319
|
var import_uuid5 = require("uuid");
|
|
2903
|
-
var
|
|
3320
|
+
var import_zod45 = require("zod");
|
|
2904
3321
|
|
|
2905
3322
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
2906
3323
|
var import_uuid4 = require("uuid");
|
|
2907
|
-
var
|
|
3324
|
+
var import_zod44 = require("zod");
|
|
2908
3325
|
|
|
2909
3326
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
2910
3327
|
var iconNames = [
|
|
@@ -2991,17 +3408,17 @@ var iconTones = ["auto", "critical", "custom", "info", "neutral", "success", "wa
|
|
|
2991
3408
|
var IconTone = freezeEnum(iconTones);
|
|
2992
3409
|
|
|
2993
3410
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
2994
|
-
var CABImageSectionFields =
|
|
3411
|
+
var CABImageSectionFields = import_zod44.z.object({
|
|
2995
3412
|
...CABVariableFields,
|
|
2996
|
-
altText:
|
|
3413
|
+
altText: import_zod44.z.string().refine(checkForHTML, NO_HTML).default(""),
|
|
2997
3414
|
/**
|
|
2998
3415
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
2999
3416
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
3000
3417
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
3001
3418
|
*/
|
|
3002
|
-
aspectRatio:
|
|
3003
|
-
border:
|
|
3004
|
-
buttonField:
|
|
3419
|
+
aspectRatio: import_zod44.z.number().positive().nullable().default(null),
|
|
3420
|
+
border: import_zod44.z.lazy(() => CABBorder),
|
|
3421
|
+
buttonField: import_zod44.z.enum(buttonFields).optional(),
|
|
3005
3422
|
/**
|
|
3006
3423
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
3007
3424
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -3020,29 +3437,29 @@ var CABImageSectionFields = import_zod28.z.object({
|
|
|
3020
3437
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
3021
3438
|
* the risky half.
|
|
3022
3439
|
*/
|
|
3023
|
-
category:
|
|
3440
|
+
category: import_zod44.z.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
3024
3441
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
3025
|
-
iconSize:
|
|
3442
|
+
iconSize: import_zod44.z.enum(iconSizes).nullable().default(null),
|
|
3026
3443
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
3027
|
-
iconTone:
|
|
3028
|
-
name:
|
|
3029
|
-
naturalHeight:
|
|
3030
|
-
naturalWidth:
|
|
3444
|
+
iconTone: import_zod44.z.enum(iconTones).nullable().default(null),
|
|
3445
|
+
name: import_zod44.z.string().optional(),
|
|
3446
|
+
naturalHeight: import_zod44.z.number().default(0),
|
|
3447
|
+
naturalWidth: import_zod44.z.number().default(0),
|
|
3031
3448
|
/**
|
|
3032
3449
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
3033
3450
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
3034
3451
|
*/
|
|
3035
|
-
objectFit:
|
|
3036
|
-
sectionId:
|
|
3037
|
-
sectionType:
|
|
3452
|
+
objectFit: import_zod44.z.enum(objectFits).default(ObjectFit.contain),
|
|
3453
|
+
sectionId: import_zod44.z.uuid().default(() => (0, import_uuid4.v7)()),
|
|
3454
|
+
sectionType: import_zod44.z.literal(SectionType.image).default(SectionType.image),
|
|
3038
3455
|
/**
|
|
3039
3456
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
3040
3457
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
3041
3458
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
3042
3459
|
* server-chosen tier icon actually needs it.
|
|
3043
3460
|
*/
|
|
3044
|
-
source:
|
|
3045
|
-
width:
|
|
3461
|
+
source: import_zod44.z.union([import_zod44.z.url(), import_zod44.z.literal(""), import_zod44.z.string().regex(DYNAMIC_TOKEN_REGEX), import_zod44.z.enum(iconNames)]).default(""),
|
|
3462
|
+
width: import_zod44.z.number().default(100)
|
|
3046
3463
|
});
|
|
3047
3464
|
var iconNameSet = new Set(iconNames);
|
|
3048
3465
|
var isIconName = (source2) => iconNameSet.has(source2);
|
|
@@ -3062,35 +3479,35 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source: sou
|
|
|
3062
3479
|
});
|
|
3063
3480
|
|
|
3064
3481
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
3065
|
-
var CABButtonContent =
|
|
3066
|
-
() =>
|
|
3482
|
+
var CABButtonContent = import_zod45.z.lazy(
|
|
3483
|
+
() => import_zod45.z.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
3067
3484
|
);
|
|
3068
|
-
var CABButtonSection =
|
|
3485
|
+
var CABButtonSection = import_zod45.z.object({
|
|
3069
3486
|
...CABVariableFields,
|
|
3070
|
-
action:
|
|
3071
|
-
buttonStyle:
|
|
3072
|
-
custom:
|
|
3073
|
-
color:
|
|
3074
|
-
height:
|
|
3075
|
-
width:
|
|
3487
|
+
action: import_zod45.z.union([import_zod45.z.literal(""), import_zod45.z.enum(buttonActions)]).default(""),
|
|
3488
|
+
buttonStyle: import_zod45.z.enum(buttonStyles).default(ButtonStyle.primary),
|
|
3489
|
+
custom: import_zod45.z.object({
|
|
3490
|
+
color: import_zod45.z.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
3491
|
+
height: import_zod45.z.number().default(52),
|
|
3492
|
+
width: import_zod45.z.number().default(300)
|
|
3076
3493
|
}).default({
|
|
3077
3494
|
color: "#005bd3",
|
|
3078
3495
|
height: 52,
|
|
3079
3496
|
width: 300
|
|
3080
3497
|
}),
|
|
3081
|
-
disableDowngrade:
|
|
3082
|
-
name:
|
|
3083
|
-
optionId:
|
|
3084
|
-
popover:
|
|
3085
|
-
alignment:
|
|
3086
|
-
position:
|
|
3498
|
+
disableDowngrade: import_zod45.z.boolean().default(false),
|
|
3499
|
+
name: import_zod45.z.string().optional(),
|
|
3500
|
+
optionId: import_zod45.z.number().optional(),
|
|
3501
|
+
popover: import_zod45.z.object({
|
|
3502
|
+
alignment: import_zod45.z.enum(textAlignments).default(TextAlignment.center),
|
|
3503
|
+
position: import_zod45.z.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
3087
3504
|
}).optional().default(() => ({
|
|
3088
3505
|
alignment: TextAlignment.center,
|
|
3089
3506
|
position: PopoverPosition.blockStart
|
|
3090
3507
|
})),
|
|
3091
|
-
sectionId:
|
|
3092
|
-
sections:
|
|
3093
|
-
sectionType:
|
|
3508
|
+
sectionId: import_zod45.z.uuid().default(() => (0, import_uuid5.v7)()),
|
|
3509
|
+
sections: import_zod45.z.union([import_zod45.z.array(CABButtonContent), import_zod45.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
3510
|
+
sectionType: import_zod45.z.literal(SectionType.button).default(SectionType.button),
|
|
3094
3511
|
/**
|
|
3095
3512
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
3096
3513
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -3105,91 +3522,96 @@ var CABButtonSection = import_zod29.z.object({
|
|
|
3105
3522
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
3106
3523
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
3107
3524
|
*/
|
|
3108
|
-
tier:
|
|
3525
|
+
tier: import_zod45.z.object({ tierId: import_zod45.z.string().min(1) }).optional(),
|
|
3109
3526
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
3110
|
-
trackingUrl:
|
|
3527
|
+
trackingUrl: import_zod45.z.string().optional(),
|
|
3111
3528
|
/**
|
|
3112
3529
|
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
3113
3530
|
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
3114
3531
|
*/
|
|
3115
|
-
variableEffects:
|
|
3532
|
+
variableEffects: import_zod45.z.array(CABVariableEffect).optional()
|
|
3116
3533
|
});
|
|
3117
3534
|
|
|
3118
3535
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3119
|
-
var
|
|
3536
|
+
var import_zod50 = require("zod");
|
|
3120
3537
|
|
|
3121
3538
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3122
|
-
var
|
|
3539
|
+
var import_zod49 = require("zod");
|
|
3123
3540
|
|
|
3124
3541
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
3125
3542
|
var import_uuid6 = require("uuid");
|
|
3126
|
-
var
|
|
3127
|
-
var CABDiscount =
|
|
3128
|
-
amount:
|
|
3129
|
-
discountedBy:
|
|
3130
|
-
discountedFrom:
|
|
3131
|
-
type:
|
|
3132
|
-
});
|
|
3133
|
-
var CABIntegrations =
|
|
3134
|
-
judgeme:
|
|
3135
|
-
junip:
|
|
3136
|
-
klaviyo:
|
|
3137
|
-
loox:
|
|
3138
|
-
okendo:
|
|
3139
|
-
opinew:
|
|
3140
|
-
reviewsio:
|
|
3141
|
-
stamped:
|
|
3142
|
-
yotpo:
|
|
3143
|
-
});
|
|
3144
|
-
var
|
|
3145
|
-
|
|
3146
|
-
|
|
3543
|
+
var import_zod46 = require("zod");
|
|
3544
|
+
var CABDiscount = import_zod46.z.object({
|
|
3545
|
+
amount: import_zod46.z.union([import_zod46.z.number(), import_zod46.z.string()]).catch(0),
|
|
3546
|
+
discountedBy: import_zod46.z.string().optional(),
|
|
3547
|
+
discountedFrom: import_zod46.z.enum(discountSources).optional().catch(void 0),
|
|
3548
|
+
type: import_zod46.z.enum(discountTypes).catch("none")
|
|
3549
|
+
});
|
|
3550
|
+
var CABIntegrations = import_zod46.z.object({
|
|
3551
|
+
judgeme: import_zod46.z.boolean().default(false),
|
|
3552
|
+
junip: import_zod46.z.boolean().default(false),
|
|
3553
|
+
klaviyo: import_zod46.z.boolean().default(false),
|
|
3554
|
+
loox: import_zod46.z.boolean().default(false),
|
|
3555
|
+
okendo: import_zod46.z.boolean().default(false),
|
|
3556
|
+
opinew: import_zod46.z.boolean().default(false),
|
|
3557
|
+
reviewsio: import_zod46.z.boolean().default(false),
|
|
3558
|
+
stamped: import_zod46.z.boolean().default(false),
|
|
3559
|
+
yotpo: import_zod46.z.boolean().default(false)
|
|
3560
|
+
});
|
|
3561
|
+
var CABVariantLabels = import_zod46.z.object({
|
|
3562
|
+
variantOption: import_zod46.z.string().optional().catch(void 0),
|
|
3563
|
+
variantOptions: import_zod46.z.string().optional().catch(void 0)
|
|
3564
|
+
});
|
|
3565
|
+
var CABDataSourceSection = import_zod46.z.object({
|
|
3566
|
+
dataSourceId: import_zod46.z.number().nullable().default(null),
|
|
3567
|
+
dataSourcePath: import_zod46.z.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
3147
3568
|
discount: CABDiscount.optional(),
|
|
3148
3569
|
integrations: CABIntegrations.optional(),
|
|
3149
|
-
limit:
|
|
3150
|
-
matchVariant:
|
|
3151
|
-
matchVariantOutOfStock:
|
|
3152
|
-
name:
|
|
3153
|
-
productType:
|
|
3154
|
-
sectionId:
|
|
3155
|
-
sectionType:
|
|
3570
|
+
limit: import_zod46.z.number().default(1),
|
|
3571
|
+
matchVariant: import_zod46.z.boolean().default(false),
|
|
3572
|
+
matchVariantOutOfStock: import_zod46.z.boolean().default(false),
|
|
3573
|
+
name: import_zod46.z.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
3574
|
+
productType: import_zod46.z.enum(productTypes).optional(),
|
|
3575
|
+
sectionId: import_zod46.z.uuid().default(() => (0, import_uuid6.v7)()),
|
|
3576
|
+
sectionType: import_zod46.z.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
3156
3577
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
3157
|
-
subscriptionIsDefault:
|
|
3158
|
-
treatAsGwp:
|
|
3578
|
+
subscriptionIsDefault: import_zod46.z.boolean().default(false),
|
|
3579
|
+
treatAsGwp: import_zod46.z.boolean().default(false),
|
|
3580
|
+
variantLabels: CABVariantLabels.optional().catch(void 0)
|
|
3159
3581
|
});
|
|
3160
3582
|
|
|
3161
3583
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3162
3584
|
var import_uuid8 = require("uuid");
|
|
3163
|
-
var
|
|
3585
|
+
var import_zod48 = require("zod");
|
|
3164
3586
|
|
|
3165
3587
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
3166
3588
|
var import_uuid7 = require("uuid");
|
|
3167
|
-
var
|
|
3168
|
-
var CABVariantContent =
|
|
3169
|
-
() =>
|
|
3589
|
+
var import_zod47 = require("zod");
|
|
3590
|
+
var CABVariantContent = import_zod47.z.lazy(
|
|
3591
|
+
() => import_zod47.z.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
3170
3592
|
);
|
|
3171
|
-
var CABProductSection =
|
|
3593
|
+
var CABProductSection = import_zod47.z.object({
|
|
3172
3594
|
...CABVariableFields,
|
|
3173
|
-
name:
|
|
3174
|
-
productId:
|
|
3175
|
-
sectionId:
|
|
3176
|
-
sections:
|
|
3177
|
-
sectionType:
|
|
3178
|
-
selectors:
|
|
3179
|
-
variantMode:
|
|
3595
|
+
name: import_zod47.z.string().optional(),
|
|
3596
|
+
productId: import_zod47.z.number().nullable().default(null),
|
|
3597
|
+
sectionId: import_zod47.z.uuid().default(() => (0, import_uuid7.v7)()),
|
|
3598
|
+
sections: import_zod47.z.union([import_zod47.z.array(CABVariantContent), import_zod47.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
3599
|
+
sectionType: import_zod47.z.literal(SectionType.product).default(SectionType.product),
|
|
3600
|
+
selectors: import_zod47.z.record(import_zod47.z.string(), import_zod47.z.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
3601
|
+
variantMode: import_zod47.z.enum(variantModes).default(VariantMode.multiple)
|
|
3180
3602
|
});
|
|
3181
3603
|
|
|
3182
3604
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3183
|
-
var CABProductsSection =
|
|
3605
|
+
var CABProductsSection = import_zod48.z.object({
|
|
3184
3606
|
...CABVariableFields,
|
|
3185
|
-
name:
|
|
3186
|
-
sectionId:
|
|
3187
|
-
sections:
|
|
3188
|
-
sectionType:
|
|
3607
|
+
name: import_zod48.z.string().optional(),
|
|
3608
|
+
sectionId: import_zod48.z.uuid().default(() => (0, import_uuid8.v7)()),
|
|
3609
|
+
sections: import_zod48.z.union([import_zod48.z.array(import_zod48.z.lazy(() => CABProductSection)), import_zod48.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
3610
|
+
sectionType: import_zod48.z.literal(SectionType.products).default(SectionType.products)
|
|
3189
3611
|
});
|
|
3190
3612
|
|
|
3191
3613
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3192
|
-
var CABOffersSection =
|
|
3614
|
+
var CABOffersSection = import_zod49.z.lazy(
|
|
3193
3615
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3194
3616
|
/**
|
|
3195
3617
|
* A rule between consecutive cards in the vertical list — legacy checkout-offers' `<Divider />`,
|
|
@@ -3197,8 +3619,8 @@ var CABOffersSection = import_zod33.z.lazy(
|
|
|
3197
3619
|
* run of products). Optional, not defaulted: only the v1 converter sets it (REB-24265); a
|
|
3198
3620
|
* hand-built tree keeps React CAB's dividerless rendering.
|
|
3199
3621
|
*/
|
|
3200
|
-
divider:
|
|
3201
|
-
sections:
|
|
3622
|
+
divider: import_zod49.z.boolean().optional(),
|
|
3623
|
+
sections: import_zod49.z.union([import_zod49.z.array(import_zod49.z.lazy(() => CABSection)), import_zod49.z.strictObject({}).transform(() => [])]).default(() => [
|
|
3202
3624
|
CABBannerSection.parse({
|
|
3203
3625
|
buttonField: "undoAddToOrder",
|
|
3204
3626
|
color: "success",
|
|
@@ -3212,77 +3634,77 @@ var CABOffersSection = import_zod33.z.lazy(
|
|
|
3212
3634
|
CABDataSourceSection.parse({}),
|
|
3213
3635
|
CABProductsSection.parse({})
|
|
3214
3636
|
]),
|
|
3215
|
-
sectionType:
|
|
3637
|
+
sectionType: import_zod49.z.literal(SectionType.offers).default(SectionType.offers)
|
|
3216
3638
|
})
|
|
3217
3639
|
);
|
|
3218
3640
|
|
|
3219
3641
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3220
|
-
var CABCarouselSection =
|
|
3642
|
+
var CABCarouselSection = import_zod50.z.lazy(
|
|
3221
3643
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3222
|
-
autoAdvanceInterval:
|
|
3223
|
-
itemsAtOnce:
|
|
3644
|
+
autoAdvanceInterval: import_zod50.z.number().default(0),
|
|
3645
|
+
itemsAtOnce: import_zod50.z.number().min(1).default(1),
|
|
3224
3646
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
3225
|
-
offersDirection:
|
|
3226
|
-
sections:
|
|
3227
|
-
sectionType:
|
|
3647
|
+
offersDirection: import_zod50.z.enum(offersDirections).default("vertical"),
|
|
3648
|
+
sections: import_zod50.z.union([import_zod50.z.array(import_zod50.z.lazy(() => CABSection)), import_zod50.z.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
3649
|
+
sectionType: import_zod50.z.literal(SectionType.carousel).default(SectionType.carousel)
|
|
3228
3650
|
})
|
|
3229
3651
|
);
|
|
3230
3652
|
|
|
3231
3653
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
3232
|
-
var
|
|
3233
|
-
var CABCartLineSection =
|
|
3654
|
+
var import_zod51 = require("zod");
|
|
3655
|
+
var CABCartLineSection = import_zod51.z.lazy(
|
|
3234
3656
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3235
|
-
sections:
|
|
3236
|
-
sectionType:
|
|
3657
|
+
sections: import_zod51.z.union([import_zod51.z.array(import_zod51.z.lazy(() => CABSection)), import_zod51.z.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
3658
|
+
sectionType: import_zod51.z.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
3237
3659
|
})
|
|
3238
3660
|
);
|
|
3239
3661
|
|
|
3240
3662
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
3241
3663
|
var import_uuid9 = require("uuid");
|
|
3242
|
-
var
|
|
3243
|
-
var CABDiscountSection =
|
|
3664
|
+
var import_zod52 = require("zod");
|
|
3665
|
+
var CABDiscountSection = import_zod52.z.object({
|
|
3244
3666
|
...CABVariableFields,
|
|
3245
|
-
amount:
|
|
3246
|
-
discountedBy:
|
|
3247
|
-
discountedFrom:
|
|
3248
|
-
message:
|
|
3249
|
-
name:
|
|
3250
|
-
quantity:
|
|
3251
|
-
sectionId:
|
|
3252
|
-
sectionType:
|
|
3253
|
-
type:
|
|
3667
|
+
amount: import_zod52.z.union([import_zod52.z.number(), import_zod52.z.string()]).catch(0),
|
|
3668
|
+
discountedBy: import_zod52.z.string().optional(),
|
|
3669
|
+
discountedFrom: import_zod52.z.enum(discountSources).optional().catch(void 0),
|
|
3670
|
+
message: import_zod52.z.string().optional(),
|
|
3671
|
+
name: import_zod52.z.string().optional(),
|
|
3672
|
+
quantity: import_zod52.z.number().default(1),
|
|
3673
|
+
sectionId: import_zod52.z.uuid().default(() => (0, import_uuid9.v7)()),
|
|
3674
|
+
sectionType: import_zod52.z.literal(SectionType.discount).default(SectionType.discount),
|
|
3675
|
+
type: import_zod52.z.enum(discountTypes).catch("none")
|
|
3254
3676
|
});
|
|
3255
3677
|
|
|
3256
3678
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
3257
3679
|
var import_uuid10 = require("uuid");
|
|
3258
|
-
var
|
|
3259
|
-
var CABMonetizeAds =
|
|
3260
|
-
requestId:
|
|
3680
|
+
var import_zod53 = require("zod");
|
|
3681
|
+
var CABMonetizeAds = import_zod53.z.object({
|
|
3682
|
+
requestId: import_zod53.z.string().optional(),
|
|
3261
3683
|
/** Defaulted here, never in the beacon: absence of information is `ads` itself being absent. */
|
|
3262
|
-
testing:
|
|
3684
|
+
testing: import_zod53.z.boolean().default(false)
|
|
3263
3685
|
});
|
|
3264
|
-
var CABMonetizeSection =
|
|
3686
|
+
var CABMonetizeSection = import_zod53.z.object({
|
|
3265
3687
|
...CABVariableFields,
|
|
3266
3688
|
ads: CABMonetizeAds.optional(),
|
|
3267
|
-
name:
|
|
3689
|
+
name: import_zod53.z.string().optional(),
|
|
3268
3690
|
/**
|
|
3269
3691
|
* Server-hydrated offer cards (inline hydration): when `/cab/sections` was asked with a `monetize`
|
|
3270
3692
|
* context block, the composed cards ride the marker itself — `[]` means "hydrated, no fill" (render
|
|
3271
3693
|
* nothing, skip the fetch); ABSENT means "not hydrated" (the client fetches via `/cab/monetize`).
|
|
3272
3694
|
*/
|
|
3273
|
-
offers:
|
|
3695
|
+
offers: import_zod53.z.array(import_zod53.z.lazy(() => CABSection)).optional(),
|
|
3274
3696
|
/** Privacy Policy footer href (the widget's `privacy_policy_url` setting); read server-side for hydration, relayed by the client only on the legacy `/cab/monetize` fallback. */
|
|
3275
|
-
privacyPolicyUrl:
|
|
3276
|
-
sectionId:
|
|
3277
|
-
sectionType:
|
|
3697
|
+
privacyPolicyUrl: import_zod53.z.string().optional(),
|
|
3698
|
+
sectionId: import_zod53.z.uuid().default(() => (0, import_uuid10.v7)()),
|
|
3699
|
+
sectionType: import_zod53.z.literal(SectionType.monetize).default(SectionType.monetize),
|
|
3278
3700
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
3279
|
-
subVertical:
|
|
3701
|
+
subVertical: import_zod53.z.string().optional(),
|
|
3280
3702
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
3281
|
-
vertical:
|
|
3703
|
+
vertical: import_zod53.z.string().optional()
|
|
3282
3704
|
});
|
|
3283
3705
|
|
|
3284
3706
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3285
|
-
var
|
|
3707
|
+
var import_zod54 = require("zod");
|
|
3286
3708
|
|
|
3287
3709
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
3288
3710
|
var GIFT_LABELS = {
|
|
@@ -3401,34 +3823,34 @@ var GIFT_LABELS = {
|
|
|
3401
3823
|
};
|
|
3402
3824
|
|
|
3403
3825
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3404
|
-
var CABProgressTierExclusion =
|
|
3405
|
-
collectionIds:
|
|
3406
|
-
productIds:
|
|
3407
|
-
tags:
|
|
3408
|
-
type:
|
|
3826
|
+
var CABProgressTierExclusion = import_zod54.z.object({
|
|
3827
|
+
collectionIds: import_zod54.z.array(import_zod54.z.number().int().positive()).default(() => []),
|
|
3828
|
+
productIds: import_zod54.z.array(import_zod54.z.number().int().positive()).default(() => []),
|
|
3829
|
+
tags: import_zod54.z.array(import_zod54.z.string().min(1)).default(() => []),
|
|
3830
|
+
type: import_zod54.z.enum(progressTierExclusionTypes)
|
|
3409
3831
|
});
|
|
3410
|
-
var CABProgressTier =
|
|
3832
|
+
var CABProgressTier = import_zod54.z.object({
|
|
3411
3833
|
/**
|
|
3412
3834
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
3413
3835
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
3414
3836
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
3415
3837
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
3416
3838
|
*/
|
|
3417
|
-
discount:
|
|
3839
|
+
discount: import_zod54.z.object({ amount: import_zod54.z.number().nonnegative(), type: import_zod54.z.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
3418
3840
|
/**
|
|
3419
3841
|
* Per-tier exclusion rules (onsite `exclusions` when `exclusions_enabled`): lines they match don't count
|
|
3420
3842
|
* toward this tier. Empty (the default, and the converter's output for a disabled or ruleless tier) means
|
|
3421
3843
|
* the tier measures the plain bar-level adjusted progress. Consumers read ONLY the list named by the rule's
|
|
3422
3844
|
* `type` — the converter leaves the other two at `[]`, so a populated off-type list never reaches the tree.
|
|
3423
3845
|
*/
|
|
3424
|
-
exclusions:
|
|
3846
|
+
exclusions: import_zod54.z.array(CABProgressTierExclusion).default(() => []),
|
|
3425
3847
|
/**
|
|
3426
3848
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
3427
3849
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
3428
3850
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
3429
3851
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
3430
3852
|
*/
|
|
3431
|
-
filterOosVariants:
|
|
3853
|
+
filterOosVariants: import_zod54.z.boolean().default(false),
|
|
3432
3854
|
/**
|
|
3433
3855
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
3434
3856
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -3436,10 +3858,10 @@ var CABProgressTier = import_zod38.z.object({
|
|
|
3436
3858
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
3437
3859
|
* tree is complete.
|
|
3438
3860
|
*/
|
|
3439
|
-
gift:
|
|
3440
|
-
productId:
|
|
3441
|
-
title:
|
|
3442
|
-
variantIds:
|
|
3861
|
+
gift: import_zod54.z.object({
|
|
3862
|
+
productId: import_zod54.z.number().int().positive(),
|
|
3863
|
+
title: import_zod54.z.string().optional(),
|
|
3864
|
+
variantIds: import_zod54.z.array(import_zod54.z.number().int().positive()).default(() => [])
|
|
3443
3865
|
}).optional(),
|
|
3444
3866
|
/**
|
|
3445
3867
|
* The step-row icon's square size in PIXELS (onsite `product_tier_element_size`, an admin px string the
|
|
@@ -3459,7 +3881,7 @@ var CABProgressTier = import_zod38.z.object({
|
|
|
3459
3881
|
* renderer never spells a fallback), which also makes a tree authored before this field render at
|
|
3460
3882
|
* React's size rather than the old hardcoded 20.
|
|
3461
3883
|
*/
|
|
3462
|
-
iconSizePx:
|
|
3884
|
+
iconSizePx: import_zod54.z.number().int().min(1).max(64).default(18),
|
|
3463
3885
|
/**
|
|
3464
3886
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
3465
3887
|
* type default — 'Free Shipping' or '{n}% Discount'. A PRODUCT tier gets NO converter label: its name is
|
|
@@ -3469,35 +3891,35 @@ var CABProgressTier = import_zod38.z.object({
|
|
|
3469
3891
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
3470
3892
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
3471
3893
|
*/
|
|
3472
|
-
label:
|
|
3894
|
+
label: import_zod54.z.record(import_zod54.z.string(), import_zod54.z.string()).optional(),
|
|
3473
3895
|
/**
|
|
3474
3896
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
3475
3897
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
3476
3898
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
3477
3899
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
3478
3900
|
*/
|
|
3479
|
-
productTierImage:
|
|
3901
|
+
productTierImage: import_zod54.z.boolean().default(false),
|
|
3480
3902
|
/**
|
|
3481
3903
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
3482
3904
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
3483
3905
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
3484
3906
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
3485
3907
|
*/
|
|
3486
|
-
threshold:
|
|
3908
|
+
threshold: import_zod54.z.number().int().nonnegative(),
|
|
3487
3909
|
/**
|
|
3488
3910
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
3489
3911
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
3490
3912
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
3491
3913
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
3492
3914
|
*/
|
|
3493
|
-
thresholds:
|
|
3915
|
+
thresholds: import_zod54.z.record(import_zod54.z.string(), import_zod54.z.number().int().nonnegative()).default(() => ({})),
|
|
3494
3916
|
/**
|
|
3495
3917
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
3496
3918
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
3497
3919
|
* shipping bar (single unlabeled tier, no gift).
|
|
3498
3920
|
*/
|
|
3499
|
-
tierId:
|
|
3500
|
-
tierType:
|
|
3921
|
+
tierId: import_zod54.z.string().optional(),
|
|
3922
|
+
tierType: import_zod54.z.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
3501
3923
|
/**
|
|
3502
3924
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
3503
3925
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -3508,9 +3930,9 @@ var CABProgressTier = import_zod38.z.object({
|
|
|
3508
3930
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
3509
3931
|
* template text supplies grammatically-neutral wording around the token.
|
|
3510
3932
|
*/
|
|
3511
|
-
unit:
|
|
3933
|
+
unit: import_zod54.z.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
3512
3934
|
});
|
|
3513
|
-
var CABProgressBarSection =
|
|
3935
|
+
var CABProgressBarSection = import_zod54.z.lazy(
|
|
3514
3936
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
3515
3937
|
/**
|
|
3516
3938
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -3519,35 +3941,35 @@ var CABProgressBarSection = import_zod38.z.lazy(
|
|
|
3519
3941
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
3520
3942
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
3521
3943
|
*/
|
|
3522
|
-
barId:
|
|
3944
|
+
barId: import_zod54.z.string().optional(),
|
|
3523
3945
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
3524
|
-
countryCodes:
|
|
3946
|
+
countryCodes: import_zod54.z.array(import_zod54.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3525
3947
|
/**
|
|
3526
3948
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
3527
3949
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
3528
3950
|
*/
|
|
3529
|
-
excludeCountryCodes:
|
|
3951
|
+
excludeCountryCodes: import_zod54.z.array(import_zod54.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3530
3952
|
/**
|
|
3531
3953
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
3532
3954
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
3533
3955
|
* adds the cart's discount allocations back to the live subtotal.
|
|
3534
3956
|
*/
|
|
3535
|
-
excludeDiscountInSubtotal:
|
|
3957
|
+
excludeDiscountInSubtotal: import_zod54.z.boolean().default(false),
|
|
3536
3958
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
3537
|
-
excludedVariantIds:
|
|
3959
|
+
excludedVariantIds: import_zod54.z.array(import_zod54.z.number().int().positive()).default(() => []),
|
|
3538
3960
|
/**
|
|
3539
3961
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
3540
3962
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
3541
3963
|
*/
|
|
3542
|
-
freeShippingOnSubscription:
|
|
3964
|
+
freeShippingOnSubscription: import_zod54.z.boolean().default(false),
|
|
3543
3965
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
3544
|
-
giftAreaTitle:
|
|
3966
|
+
giftAreaTitle: import_zod54.z.record(import_zod54.z.string(), import_zod54.z.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
3545
3967
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
3546
|
-
giftLabels:
|
|
3547
|
-
addGift:
|
|
3548
|
-
remove:
|
|
3549
|
-
selectOptions:
|
|
3550
|
-
yourGift:
|
|
3968
|
+
giftLabels: import_zod54.z.object({
|
|
3969
|
+
addGift: import_zod54.z.record(import_zod54.z.string(), import_zod54.z.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
3970
|
+
remove: import_zod54.z.record(import_zod54.z.string(), import_zod54.z.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
3971
|
+
selectOptions: import_zod54.z.record(import_zod54.z.string(), import_zod54.z.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
3972
|
+
yourGift: import_zod54.z.record(import_zod54.z.string(), import_zod54.z.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
3551
3973
|
}).default(() => ({
|
|
3552
3974
|
addGift: { ...GIFT_LABELS.addGift },
|
|
3553
3975
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -3555,38 +3977,38 @@ var CABProgressBarSection = import_zod38.z.lazy(
|
|
|
3555
3977
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
3556
3978
|
})),
|
|
3557
3979
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
3558
|
-
name:
|
|
3980
|
+
name: import_zod54.z.string().default("Order progress"),
|
|
3559
3981
|
/**
|
|
3560
3982
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
3561
3983
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
3562
3984
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
3563
3985
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
3564
3986
|
*/
|
|
3565
|
-
progressColor:
|
|
3566
|
-
sectionType:
|
|
3987
|
+
progressColor: import_zod54.z.string().optional(),
|
|
3988
|
+
sectionType: import_zod54.z.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
3567
3989
|
/**
|
|
3568
3990
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
3569
3991
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
3570
3992
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
3571
3993
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
3572
3994
|
*/
|
|
3573
|
-
tiers:
|
|
3995
|
+
tiers: import_zod54.z.union([import_zod54.z.array(CABProgressTier), import_zod54.z.strictObject({}).transform(() => [])]).default(() => [])
|
|
3574
3996
|
})
|
|
3575
3997
|
);
|
|
3576
3998
|
|
|
3577
3999
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
3578
4000
|
var import_uuid11 = require("uuid");
|
|
3579
|
-
var
|
|
3580
|
-
var CABQuantitySection =
|
|
4001
|
+
var import_zod55 = require("zod");
|
|
4002
|
+
var CABQuantitySection = import_zod55.z.object({
|
|
3581
4003
|
...CABVariableFields,
|
|
3582
|
-
errorMessages:
|
|
3583
|
-
|
|
3584
|
-
|
|
4004
|
+
errorMessages: import_zod55.z.record(
|
|
4005
|
+
import_zod55.z.string(),
|
|
4006
|
+
import_zod55.z.object({
|
|
3585
4007
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
3586
|
-
increment:
|
|
3587
|
-
max:
|
|
3588
|
-
min:
|
|
3589
|
-
neg:
|
|
4008
|
+
increment: import_zod55.z.string().optional(),
|
|
4009
|
+
max: import_zod55.z.string().optional(),
|
|
4010
|
+
min: import_zod55.z.string().optional(),
|
|
4011
|
+
neg: import_zod55.z.string().optional()
|
|
3590
4012
|
})
|
|
3591
4013
|
).default({
|
|
3592
4014
|
en: {
|
|
@@ -3596,18 +4018,18 @@ var CABQuantitySection = import_zod39.z.object({
|
|
|
3596
4018
|
neg: "Quantity cannot be negative"
|
|
3597
4019
|
}
|
|
3598
4020
|
}),
|
|
3599
|
-
inputType:
|
|
3600
|
-
max:
|
|
3601
|
-
min:
|
|
4021
|
+
inputType: import_zod55.z.enum(quantityInputs).default(QuantityInput.select),
|
|
4022
|
+
max: import_zod55.z.number().min(1).max(100).default(10),
|
|
4023
|
+
min: import_zod55.z.number().min(1).default(1),
|
|
3602
4024
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
3603
|
-
name:
|
|
3604
|
-
sectionId:
|
|
3605
|
-
sectionType:
|
|
4025
|
+
name: import_zod55.z.string().default("Quantity"),
|
|
4026
|
+
sectionId: import_zod55.z.uuid().default(() => (0, import_uuid11.v7)()),
|
|
4027
|
+
sectionType: import_zod55.z.literal(SectionType.quantity).default(SectionType.quantity)
|
|
3606
4028
|
});
|
|
3607
4029
|
|
|
3608
4030
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3609
4031
|
var import_uuid12 = require("uuid");
|
|
3610
|
-
var
|
|
4032
|
+
var import_zod56 = require("zod");
|
|
3611
4033
|
|
|
3612
4034
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
3613
4035
|
var REVIEW_LABELS = {
|
|
@@ -3670,68 +4092,68 @@ var REVIEW_LABELS = {
|
|
|
3670
4092
|
};
|
|
3671
4093
|
|
|
3672
4094
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3673
|
-
var CABReviewsSection =
|
|
4095
|
+
var CABReviewsSection = import_zod56.z.object({
|
|
3674
4096
|
...CABVariableFields,
|
|
3675
|
-
color:
|
|
4097
|
+
color: import_zod56.z.string().default("#fadb14"),
|
|
3676
4098
|
/**
|
|
3677
4099
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
3678
4100
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
3679
4101
|
* or merchant work.
|
|
3680
4102
|
*/
|
|
3681
|
-
countLabels:
|
|
3682
|
-
one:
|
|
3683
|
-
other:
|
|
4103
|
+
countLabels: import_zod56.z.object({
|
|
4104
|
+
one: import_zod56.z.record(import_zod56.z.string(), import_zod56.z.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
4105
|
+
other: import_zod56.z.record(import_zod56.z.string(), import_zod56.z.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
3684
4106
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
3685
|
-
name:
|
|
3686
|
-
sectionId:
|
|
3687
|
-
sectionType:
|
|
3688
|
-
size:
|
|
4107
|
+
name: import_zod56.z.string().optional(),
|
|
4108
|
+
sectionId: import_zod56.z.uuid().default(() => (0, import_uuid12.v7)()),
|
|
4109
|
+
sectionType: import_zod56.z.literal(SectionType.reviews).default(SectionType.reviews),
|
|
4110
|
+
size: import_zod56.z.enum(reviewsSizes).default(ReviewsSize.default),
|
|
3689
4111
|
/**
|
|
3690
4112
|
* Star outline color, interpolated into a style by the renderer, so it is hex-constrained like
|
|
3691
4113
|
* `CABButtonSection.color`. The legacy source (`PostPurchaseSettings.styles.starStrokeColor`) is a free
|
|
3692
4114
|
* string: its converter must validate and fall back to this default rather than let one odd value drop
|
|
3693
4115
|
* the whole reviews section.
|
|
3694
4116
|
*/
|
|
3695
|
-
strokeColor:
|
|
4117
|
+
strokeColor: import_zod56.z.string().regex(HEX_COLOR_REGEX).default("#fadb14"),
|
|
3696
4118
|
/** Star outline width in px; `0` draws no outline. The legacy `styles.strokeWidth` is a STRING ('1') — its converter coerces. */
|
|
3697
|
-
strokeWidth:
|
|
4119
|
+
strokeWidth: import_zod56.z.number().nonnegative().default(0)
|
|
3698
4120
|
});
|
|
3699
4121
|
|
|
3700
4122
|
// src/schema/widgets/checkout-and-beyond/separator.ts
|
|
3701
4123
|
var import_uuid13 = require("uuid");
|
|
3702
|
-
var
|
|
3703
|
-
var CABSeparatorSection =
|
|
4124
|
+
var import_zod57 = require("zod");
|
|
4125
|
+
var CABSeparatorSection = import_zod57.z.object({
|
|
3704
4126
|
...CABVariableFields,
|
|
3705
|
-
sectionId:
|
|
3706
|
-
sectionType:
|
|
4127
|
+
sectionId: import_zod57.z.uuid().default(() => (0, import_uuid13.v7)()),
|
|
4128
|
+
sectionType: import_zod57.z.literal(SectionType.separator).default(SectionType.separator)
|
|
3707
4129
|
});
|
|
3708
4130
|
|
|
3709
4131
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
3710
4132
|
var import_compat5 = require("es-toolkit/compat");
|
|
3711
4133
|
var import_uuid14 = require("uuid");
|
|
3712
|
-
var
|
|
3713
|
-
var CABVariantsSection =
|
|
4134
|
+
var import_zod58 = require("zod");
|
|
4135
|
+
var CABVariantsSection = import_zod58.z.object({
|
|
3714
4136
|
...CABVariableFields,
|
|
3715
|
-
hideOutOfStockVariants:
|
|
3716
|
-
name:
|
|
3717
|
-
sectionId:
|
|
3718
|
-
sectionType:
|
|
3719
|
-
selector:
|
|
3720
|
-
variantMode:
|
|
4137
|
+
hideOutOfStockVariants: import_zod58.z.boolean().default(false),
|
|
4138
|
+
name: import_zod58.z.string().optional(),
|
|
4139
|
+
sectionId: import_zod58.z.uuid().default(() => (0, import_uuid14.v7)()),
|
|
4140
|
+
sectionType: import_zod58.z.literal(SectionType.variants).default(SectionType.variants),
|
|
4141
|
+
selector: import_zod58.z.enum((0, import_compat5.slice)(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
4142
|
+
variantMode: import_zod58.z.enum(variantModes).default(VariantMode.multiple)
|
|
3721
4143
|
});
|
|
3722
4144
|
|
|
3723
4145
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
3724
|
-
var CABBorder =
|
|
3725
|
-
radius:
|
|
3726
|
-
style:
|
|
3727
|
-
width:
|
|
4146
|
+
var CABBorder = import_zod59.z.object({
|
|
4147
|
+
radius: import_zod59.z.enum(borderRadii).default(BorderRadius.base),
|
|
4148
|
+
style: import_zod59.z.enum(borderStyles).default(BorderStyle.none),
|
|
4149
|
+
width: import_zod59.z.enum(borderWidths).default(BorderWidth.base)
|
|
3728
4150
|
}).default({
|
|
3729
4151
|
radius: BorderRadius.base,
|
|
3730
4152
|
style: BorderStyle.none,
|
|
3731
4153
|
width: BorderWidth.base
|
|
3732
4154
|
});
|
|
3733
|
-
var CABSection =
|
|
3734
|
-
() =>
|
|
4155
|
+
var CABSection = import_zod59.z.lazy(
|
|
4156
|
+
() => import_zod59.z.discriminatedUnion("sectionType", [
|
|
3735
4157
|
CABBannerSection,
|
|
3736
4158
|
CABButtonSection,
|
|
3737
4159
|
CABCarouselSection,
|
|
@@ -3754,41 +4176,41 @@ var CABSection = import_zod43.z.lazy(
|
|
|
3754
4176
|
);
|
|
3755
4177
|
|
|
3756
4178
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
3757
|
-
var GridItem =
|
|
3758
|
-
var CABLayoutWrapping =
|
|
3759
|
-
breakAt:
|
|
3760
|
-
maxPerLine:
|
|
4179
|
+
var GridItem = import_zod60.z.union([import_zod60.z.literal("auto"), import_zod60.z.literal("fill"), import_zod60.z.string().regex(/^\d+%$/), import_zod60.z.number()]);
|
|
4180
|
+
var CABLayoutWrapping = import_zod60.z.object({
|
|
4181
|
+
breakAt: import_zod60.z.number().positive(),
|
|
4182
|
+
maxPerLine: import_zod60.z.number().int().positive()
|
|
3761
4183
|
});
|
|
3762
|
-
var CABLayoutSection =
|
|
4184
|
+
var CABLayoutSection = import_zod60.z.object({
|
|
3763
4185
|
...CABVariableFields,
|
|
3764
|
-
alignment:
|
|
3765
|
-
horizontal:
|
|
3766
|
-
vertical:
|
|
4186
|
+
alignment: import_zod60.z.object({
|
|
4187
|
+
horizontal: import_zod60.z.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
4188
|
+
vertical: import_zod60.z.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
3767
4189
|
}).default({
|
|
3768
4190
|
horizontal: HorizontalAlignment.start,
|
|
3769
4191
|
vertical: VerticalAlignment.top
|
|
3770
4192
|
}),
|
|
3771
|
-
border:
|
|
3772
|
-
buttonField:
|
|
3773
|
-
direction:
|
|
4193
|
+
border: import_zod60.z.lazy(() => CABBorder),
|
|
4194
|
+
buttonField: import_zod60.z.enum(buttonFields).optional(),
|
|
4195
|
+
direction: import_zod60.z.enum(directions).default(Direction.rows),
|
|
3774
4196
|
/**
|
|
3775
4197
|
* Platform chrome around the section, not a layout behavior: `callout` is a subdued box with block borders
|
|
3776
4198
|
* (the legacy post-purchase callout banner), `offer-content` the post-purchase offer's own content card.
|
|
3777
4199
|
*/
|
|
3778
|
-
frame:
|
|
3779
|
-
grid:
|
|
3780
|
-
columns:
|
|
3781
|
-
rows:
|
|
4200
|
+
frame: import_zod60.z.enum(layoutFrames).optional(),
|
|
4201
|
+
grid: import_zod60.z.object({
|
|
4202
|
+
columns: import_zod60.z.union([import_zod60.z.array(GridItem), import_zod60.z.undefined()]).default(() => ["auto"]),
|
|
4203
|
+
rows: import_zod60.z.union([import_zod60.z.array(GridItem), import_zod60.z.undefined()]).default(() => ["auto"])
|
|
3782
4204
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
3783
|
-
name:
|
|
3784
|
-
padding:
|
|
3785
|
-
sectionId:
|
|
3786
|
-
sections:
|
|
3787
|
-
sectionType:
|
|
3788
|
-
spacing:
|
|
4205
|
+
name: import_zod60.z.string().optional(),
|
|
4206
|
+
padding: import_zod60.z.enum(spacings).default(Spacing.none),
|
|
4207
|
+
sectionId: import_zod60.z.uuid().default(() => (0, import_uuid15.v7)()),
|
|
4208
|
+
sections: import_zod60.z.union([import_zod60.z.array(import_zod60.z.lazy(() => CABSection)), import_zod60.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
4209
|
+
sectionType: import_zod60.z.literal(SectionType.layout).default(SectionType.layout),
|
|
4210
|
+
spacing: import_zod60.z.enum(spacings).default(Spacing.base),
|
|
3789
4211
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
3790
|
-
viewUrl:
|
|
3791
|
-
width:
|
|
4212
|
+
viewUrl: import_zod60.z.string().optional(),
|
|
4213
|
+
width: import_zod60.z.number().default(100),
|
|
3792
4214
|
wrapping: CABLayoutWrapping.optional()
|
|
3793
4215
|
});
|
|
3794
4216
|
|
|
@@ -3810,8 +4232,8 @@ var UI_LABELS = {
|
|
|
3810
4232
|
};
|
|
3811
4233
|
|
|
3812
4234
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
3813
|
-
var localized = (fallback) =>
|
|
3814
|
-
var CABUILabels =
|
|
4235
|
+
var localized = (fallback) => import_zod61.z.record(import_zod61.z.string(), import_zod61.z.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
4236
|
+
var CABUILabels = import_zod61.z.object({
|
|
3815
4237
|
currentPage: localized(UI_LABELS.currentPage),
|
|
3816
4238
|
guest: localized(UI_LABELS.guest),
|
|
3817
4239
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -3836,47 +4258,47 @@ var CABUILabels = import_zod45.z.object({
|
|
|
3836
4258
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
3837
4259
|
updating: { ...UI_LABELS.updating }
|
|
3838
4260
|
}));
|
|
3839
|
-
var TargetArea =
|
|
3840
|
-
fill:
|
|
3841
|
-
flip:
|
|
3842
|
-
icon:
|
|
3843
|
-
label:
|
|
3844
|
-
width:
|
|
4261
|
+
var TargetArea = import_zod61.z.object({
|
|
4262
|
+
fill: import_zod61.z.boolean().optional(),
|
|
4263
|
+
flip: import_zod61.z.enum(["both", "horizontal", "vertical"]).optional(),
|
|
4264
|
+
icon: import_zod61.z.string(),
|
|
4265
|
+
label: import_zod61.z.string(),
|
|
4266
|
+
width: import_zod61.z.string()
|
|
3845
4267
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
3846
|
-
var CABTracking =
|
|
3847
|
-
enableAttribution:
|
|
3848
|
-
enableSource:
|
|
3849
|
-
enableWidget:
|
|
4268
|
+
var CABTracking = import_zod61.z.object({
|
|
4269
|
+
enableAttribution: import_zod61.z.boolean().nullish().transform((value) => value ?? true),
|
|
4270
|
+
enableSource: import_zod61.z.boolean().nullish().transform((value) => value ?? true),
|
|
4271
|
+
enableWidget: import_zod61.z.boolean().nullish().transform((value) => value ?? true)
|
|
3850
4272
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
3851
|
-
var CABExperiment =
|
|
3852
|
-
elementId:
|
|
3853
|
-
experimentId:
|
|
3854
|
-
experimentType:
|
|
3855
|
-
selectedId:
|
|
4273
|
+
var CABExperiment = import_zod61.z.object({
|
|
4274
|
+
elementId: import_zod61.z.number(),
|
|
4275
|
+
experimentId: import_zod61.z.number(),
|
|
4276
|
+
experimentType: import_zod61.z.string(),
|
|
4277
|
+
selectedId: import_zod61.z.number()
|
|
3856
4278
|
});
|
|
3857
4279
|
var CABRootSection = CABLayoutSection.extend({
|
|
3858
|
-
editorMode:
|
|
4280
|
+
editorMode: import_zod61.z.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
3859
4281
|
experiment: CABExperiment.optional(),
|
|
3860
4282
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
3861
4283
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
3862
|
-
previewMode:
|
|
3863
|
-
storeId:
|
|
4284
|
+
previewMode: import_zod61.z.boolean().nullish().transform((value) => value ?? false),
|
|
4285
|
+
storeId: import_zod61.z.number().nullable().default(null),
|
|
3864
4286
|
targetArea: TargetArea.nullable(),
|
|
3865
4287
|
tracking: CABTracking,
|
|
3866
|
-
type:
|
|
4288
|
+
type: import_zod61.z.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
3867
4289
|
uiLabels: CABUILabels,
|
|
3868
|
-
version:
|
|
3869
|
-
widgetId:
|
|
4290
|
+
version: import_zod61.z.literal(2).default(2),
|
|
4291
|
+
widgetId: import_zod61.z.number().nullable().default(null)
|
|
3870
4292
|
});
|
|
3871
4293
|
|
|
3872
4294
|
// src/schema/postPurchaseProductView.ts
|
|
3873
|
-
var PostPurchaseProductView =
|
|
3874
|
-
|
|
4295
|
+
var PostPurchaseProductView = import_zod62.z.union([
|
|
4296
|
+
import_zod62.z.object({
|
|
3875
4297
|
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
3876
4298
|
initialVariant: PostPurchaseVariantSelector.optional(),
|
|
3877
4299
|
planCatalog: PostPurchasePlanCatalog.nullable().optional(),
|
|
3878
4300
|
preparation: PreparedPostPurchaseProduct.extend({
|
|
3879
|
-
display: PreparedPostPurchaseProduct.shape.display.extend({ description:
|
|
4301
|
+
display: PreparedPostPurchaseProduct.shape.display.extend({ description: import_zod62.z.string().nullable() }).refine(
|
|
3880
4302
|
({ description, descriptionDocument }) => description === null === (descriptionDocument !== void 0),
|
|
3881
4303
|
"Exactly one of the plain and rich descriptions is shown"
|
|
3882
4304
|
)
|
|
@@ -3885,33 +4307,38 @@ var PostPurchaseProductView = import_zod46.z.union([
|
|
|
3885
4307
|
sections: CABRootSection,
|
|
3886
4308
|
variantCatalog: PostPurchaseVariantCatalog.optional()
|
|
3887
4309
|
}),
|
|
3888
|
-
|
|
4310
|
+
import_zod62.z.object({
|
|
3889
4311
|
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
3890
4312
|
initialVariant: PostPurchaseVariantSelector.optional(),
|
|
3891
4313
|
planCatalog: PostPurchasePlanCatalog.nullable().optional(),
|
|
3892
4314
|
preparation: PostPurchasePreparation.options[1],
|
|
3893
4315
|
purchaseOptions: PostPurchaseOptions.optional(),
|
|
3894
|
-
sections:
|
|
4316
|
+
sections: import_zod62.z.null(),
|
|
3895
4317
|
variantCatalog: PostPurchaseVariantCatalog.optional()
|
|
3896
4318
|
})
|
|
3897
4319
|
]);
|
|
3898
4320
|
|
|
3899
4321
|
// src/schema/postPurchaseProductCollectionView.ts
|
|
3900
|
-
var PostPurchaseProductCollectionView =
|
|
3901
|
-
members:
|
|
3902
|
-
|
|
4322
|
+
var PostPurchaseProductCollectionView = import_zod63.z.object({
|
|
4323
|
+
members: import_zod63.z.array(
|
|
4324
|
+
import_zod63.z.object({
|
|
3903
4325
|
productId: PostPurchaseProductId,
|
|
3904
|
-
productIndex:
|
|
4326
|
+
productIndex: import_zod63.z.number().int().nonnegative(),
|
|
3905
4327
|
view: PostPurchaseProductView
|
|
3906
4328
|
})
|
|
3907
4329
|
)
|
|
3908
4330
|
});
|
|
3909
|
-
var PostPurchaseCollectionChoice =
|
|
4331
|
+
var PostPurchaseCollectionChoice = import_zod63.z.object({
|
|
3910
4332
|
choice: PostPurchaseChoice.optional(),
|
|
3911
4333
|
productId: PostPurchaseProductId,
|
|
3912
4334
|
variantId: PostPurchaseVariantSelector.shape.variantId.optional()
|
|
3913
4335
|
}).strict();
|
|
3914
|
-
var PostPurchaseExcludedProductIds =
|
|
4336
|
+
var PostPurchaseExcludedProductIds = import_zod63.z.array(PostPurchaseProductId).default([]);
|
|
4337
|
+
var PostPurchaseMemberSelector = PostPurchaseProgressSchema.shape.members.element.pick({ productId: true }).extend({ progressRevision: PostPurchaseProgressSchema.shape.revision });
|
|
4338
|
+
var PostPurchaseMemberPointer = PostPurchaseProgressSchema.shape.members.element.omit({ status: true }).extend({
|
|
4339
|
+
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
4340
|
+
progressRevision: PostPurchaseProgressSchema.shape.revision
|
|
4341
|
+
});
|
|
3915
4342
|
|
|
3916
4343
|
// src/schema/postPurchaseQuantity.ts
|
|
3917
4344
|
var quantity = PreparedPostPurchaseProduct.shape.selection.shape.quantity;
|
|
@@ -3919,7 +4346,7 @@ var PostPurchaseQuantityChoice = PostPurchaseCollectionChoice.extend({ quantity:
|
|
|
3919
4346
|
var PostPurchaseQuantityPolicy = PostPurchaseSettings.shape.quantityInputs.omit({ defaultQuantity: true }).extend({
|
|
3920
4347
|
initialQuantity: quantity,
|
|
3921
4348
|
maxValue: quantity,
|
|
3922
|
-
minValue:
|
|
4349
|
+
minValue: import_zod64.z.literal(0).transform(() => 1).or(quantity)
|
|
3923
4350
|
}).refine(({ maxValue, minValue }) => minValue <= maxValue, "Quantity bounds are reversed");
|
|
3924
4351
|
|
|
3925
4352
|
// src/schema/postPurchaseGroup.ts
|
|
@@ -3927,73 +4354,106 @@ var PostPurchaseGroupChoice = PostPurchaseQuantityChoice.extend({
|
|
|
3927
4354
|
memberProductId: PreparedPostPurchaseProduct.shape.selection.shape.productId
|
|
3928
4355
|
});
|
|
3929
4356
|
|
|
3930
|
-
// src/schema/
|
|
3931
|
-
var
|
|
3932
|
-
var
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
4357
|
+
// src/schema/postPurchaseLifecycle.ts
|
|
4358
|
+
var import_zod65 = require("zod");
|
|
4359
|
+
var Presentation = import_zod65.z.strictObject({
|
|
4360
|
+
member: PostPurchaseMemberIdentity,
|
|
4361
|
+
selectedProductId: PostPurchaseMemberIdentity.shape.productId.optional(),
|
|
4362
|
+
variant: PostPurchaseVariantSelector
|
|
4363
|
+
});
|
|
4364
|
+
var LifecycleObservationRequestSchema = DecideRequestSchema.extend({
|
|
4365
|
+
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
4366
|
+
eventType: import_zod65.z.enum(["OFFER_VIEWED", "OFFER_TIMER_EXPIRED"]),
|
|
4367
|
+
presentation: Presentation.nullable(),
|
|
4368
|
+
progressRevision: PostPurchaseProgressSchema.shape.revision,
|
|
4369
|
+
requestId: import_zod65.z.uuid()
|
|
4370
|
+
}).strict().refine(
|
|
4371
|
+
({ eventType, presentation }) => eventType !== "OFFER_VIEWED" || presentation !== null,
|
|
4372
|
+
"Viewed observations require a presented product"
|
|
4373
|
+
);
|
|
4374
|
+
var LifecycleObservationResponseSchema = import_zod65.z.object({
|
|
4375
|
+
data: import_zod65.z.strictObject({
|
|
4376
|
+
requestId: LifecycleObservationRequestSchema.shape.requestId,
|
|
4377
|
+
status: import_zod65.z.union([AcceptedEventOutcomeSchema, import_zod65.z.literal("unavailable")])
|
|
4378
|
+
}),
|
|
4379
|
+
successful: import_zod65.z.literal(true)
|
|
3939
4380
|
});
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
4381
|
+
|
|
4382
|
+
// src/schema/postPurchaseOffer.ts
|
|
4383
|
+
var import_zod67 = require("zod");
|
|
4384
|
+
|
|
4385
|
+
// src/schema/postPurchaseSkipTrace.ts
|
|
4386
|
+
var import_zod66 = require("zod");
|
|
4387
|
+
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
4388
|
+
var PostPurchaseSkipTraceSchema = import_zod66.z.array(
|
|
4389
|
+
import_zod66.z.object({
|
|
4390
|
+
entry: DecisionEntrySchema,
|
|
4391
|
+
reason: PostPurchaseSkipReasonSchema
|
|
4392
|
+
})
|
|
4393
|
+
).max(POST_PURCHASE_SKIP_LIMIT);
|
|
4394
|
+
|
|
4395
|
+
// src/schema/postPurchaseOffer.ts
|
|
4396
|
+
var OfferPreparationRequestSchema = DecideRequestSchema.strict();
|
|
4397
|
+
var OfferPreparationResponseSchema = import_zod67.z.object({
|
|
4398
|
+
data: import_zod67.z.object({ attemptedSkips: PostPurchaseSkipTraceSchema.optional(), progress: PostPurchaseProgressSchema }),
|
|
4399
|
+
successful: import_zod67.z.literal(true)
|
|
3949
4400
|
});
|
|
3950
4401
|
|
|
3951
4402
|
// src/schema/postPurchaseOfferEligibility.ts
|
|
3952
|
-
var
|
|
4403
|
+
var import_zod68 = require("zod");
|
|
3953
4404
|
var selection = PreparedPostPurchaseProduct.shape.selection;
|
|
3954
|
-
var PostPurchaseOfferSkipReason =
|
|
3955
|
-
var PostPurchaseOfferEligibilityContext =
|
|
4405
|
+
var PostPurchaseOfferSkipReason = import_zod68.z.enum(["empty", "no-eligible-subscription"]);
|
|
4406
|
+
var PostPurchaseOfferEligibilityContext = import_zod68.z.object({
|
|
3956
4407
|
excludedProductIds: PostPurchaseExcludedProductIds,
|
|
3957
|
-
originalLineItems:
|
|
4408
|
+
originalLineItems: import_zod68.z.array(selection.pick({ productId: true, sellingPlanId: true, variantId: true }))
|
|
3958
4409
|
});
|
|
3959
|
-
var PostPurchaseOfferEligibility =
|
|
3960
|
-
|
|
3961
|
-
members:
|
|
3962
|
-
|
|
4410
|
+
var PostPurchaseOfferEligibility = import_zod68.z.discriminatedUnion("status", [
|
|
4411
|
+
import_zod68.z.object({
|
|
4412
|
+
members: import_zod68.z.array(
|
|
4413
|
+
import_zod68.z.object({ productId: selection.shape.productId, productIndex: import_zod68.z.number().int().nonnegative() })
|
|
3963
4414
|
),
|
|
3964
|
-
status:
|
|
4415
|
+
status: import_zod68.z.literal("retain")
|
|
3965
4416
|
}),
|
|
3966
|
-
|
|
3967
|
-
|
|
4417
|
+
import_zod68.z.object({ reason: PostPurchaseOfferSkipReason, status: import_zod68.z.literal("skip") }),
|
|
4418
|
+
import_zod68.z.object({ reason: import_zod68.z.literal("eligible-upgrade").optional(), status: import_zod68.z.literal("unavailable") })
|
|
3968
4419
|
]);
|
|
3969
4420
|
|
|
3970
4421
|
// src/schema/postPurchaseOfferPresentation.ts
|
|
3971
|
-
var
|
|
4422
|
+
var import_zod69 = require("zod");
|
|
3972
4423
|
var language2 = PostPurchaseSettings.shape.language.shape.global.unwrap().unwrap();
|
|
3973
|
-
var PostPurchaseOfferPresentation =
|
|
4424
|
+
var PostPurchaseOfferPresentation = import_zod69.z.strictObject({
|
|
3974
4425
|
labels: language2.pick({ declineAll: true, declineThisOffer: true }),
|
|
3975
4426
|
layout: PostPurchaseSettings.shape.offersLayout,
|
|
3976
4427
|
sections: CABRootSection.nullable(),
|
|
3977
4428
|
showDeclineAll: PostPurchaseSettings.shape.productOptions.shape.showDeclineAll
|
|
3978
4429
|
});
|
|
4430
|
+
var OfferPresentationRequestSchema = DecideRequestSchema.strict();
|
|
4431
|
+
var OfferPresentationResponseSchema = import_zod69.z.object({
|
|
4432
|
+
data: import_zod69.z.strictObject({
|
|
4433
|
+
presentation: PostPurchaseOfferPresentation.nullable(),
|
|
4434
|
+
progress: PostPurchaseProgressSchema.nullable(),
|
|
4435
|
+
serverNow: PostPurchaseTimestampSchema
|
|
4436
|
+
}),
|
|
4437
|
+
successful: import_zod69.z.literal(true)
|
|
4438
|
+
});
|
|
3979
4439
|
|
|
3980
4440
|
// src/schema/postPurchaseOrderDecision.ts
|
|
3981
|
-
var
|
|
3982
|
-
var OrderDecisionSchema =
|
|
3983
|
-
|
|
3984
|
-
|
|
4441
|
+
var import_zod70 = require("zod");
|
|
4442
|
+
var OrderDecisionSchema = import_zod70.z.discriminatedUnion("owner", [
|
|
4443
|
+
import_zod70.z.object({ owner: import_zod70.z.literal("session"), sessionId: import_zod70.z.string().regex(/^[a-f0-9]{64}$/) }),
|
|
4444
|
+
import_zod70.z.object({ owner: import_zod70.z.literal("release"), sessionId: import_zod70.z.null() })
|
|
3985
4445
|
]);
|
|
3986
4446
|
|
|
3987
4447
|
// src/schema/postPurchasePolicy.ts
|
|
3988
|
-
var
|
|
3989
|
-
var HoldSettingSchema =
|
|
3990
|
-
|
|
3991
|
-
|
|
4448
|
+
var import_zod71 = require("zod");
|
|
4449
|
+
var HoldSettingSchema = import_zod71.z.discriminatedUnion("enabled", [
|
|
4450
|
+
import_zod71.z.object({ durationMinutes: import_zod71.z.number().int().min(1).max(60), enabled: import_zod71.z.literal(true) }),
|
|
4451
|
+
import_zod71.z.object({ durationMinutes: import_zod71.z.null(), enabled: import_zod71.z.literal(false) })
|
|
3992
4452
|
]);
|
|
3993
|
-
var TimingSettingsSchema =
|
|
4453
|
+
var TimingSettingsSchema = import_zod71.z.object({ flowHold: HoldSettingSchema, shopHold: HoldSettingSchema });
|
|
3994
4454
|
var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
3995
|
-
durationMinutes:
|
|
3996
|
-
source:
|
|
4455
|
+
durationMinutes: import_zod71.z.number().int().min(1).max(60).nullable(),
|
|
4456
|
+
source: import_zod71.z.enum(["shop", "flow", "native"])
|
|
3997
4457
|
}).refine(
|
|
3998
4458
|
(policy) => {
|
|
3999
4459
|
const expectedSource = policy.shopHold.enabled ? "shop" : policy.flowHold.enabled ? "flow" : "native";
|
|
@@ -4006,73 +4466,22 @@ var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
|
4006
4466
|
}
|
|
4007
4467
|
);
|
|
4008
4468
|
|
|
4009
|
-
// src/schema/
|
|
4010
|
-
var
|
|
4011
|
-
var
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
totalOutstandingSet: MoneyBag,
|
|
4022
|
-
updatedLineItems: import_zod54.z.array(
|
|
4023
|
-
import_zod54.z.object({
|
|
4024
|
-
priceSet: import_zod54.z.unknown().optional(),
|
|
4025
|
-
productId: import_zod54.z.number().int().positive(),
|
|
4026
|
-
sellingPlanId: import_zod54.z.unknown().optional(),
|
|
4027
|
-
variantId: import_zod54.z.number().int().positive()
|
|
4028
|
-
})
|
|
4029
|
-
)
|
|
4030
|
-
}),
|
|
4031
|
-
errors: import_zod54.z.array(import_zod54.z.unknown()).length(0),
|
|
4032
|
-
status: import_zod54.z.literal("processed")
|
|
4033
|
-
});
|
|
4034
|
-
var Minor = import_zod54.z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
4035
|
-
var PostPurchaseProductCosts = import_zod54.z.object({
|
|
4036
|
-
currencyCode: MoneyBag.shape.presentmentMoney.shape.currencyCode,
|
|
4037
|
-
recurringDisplay: import_zod54.z.object({ shippingMinor: Minor, subtotalMinor: Minor, totalMinor: Minor }).optional(),
|
|
4038
|
-
shippingMinor: Minor,
|
|
4039
|
-
subtotalMinor: Minor,
|
|
4040
|
-
taxesMinor: Minor,
|
|
4041
|
-
totalMinor: Minor
|
|
4042
|
-
});
|
|
4043
|
-
var ChangesetDiscount = import_zod54.z.object({
|
|
4044
|
-
title: import_zod54.z.string(),
|
|
4045
|
-
value: import_zod54.z.number().nonnegative(),
|
|
4046
|
-
valueType: import_zod54.z.enum(["percentage", "fixed_amount"])
|
|
4047
|
-
}).optional();
|
|
4048
|
-
var PostPurchaseProductChangeset = import_zod54.z.object({
|
|
4049
|
-
changes: import_zod54.z.array(
|
|
4050
|
-
import_zod54.z.union([
|
|
4051
|
-
import_zod54.z.object({
|
|
4052
|
-
discount: ChangesetDiscount,
|
|
4053
|
-
quantity: import_zod54.z.number().int().positive(),
|
|
4054
|
-
type: import_zod54.z.literal("add_variant"),
|
|
4055
|
-
variantId: import_zod54.z.number().int().positive()
|
|
4056
|
-
}),
|
|
4057
|
-
import_zod54.z.object({ price: import_zod54.z.number().nonnegative(), title: import_zod54.z.string(), type: import_zod54.z.literal("add_shipping_line") }),
|
|
4058
|
-
PostPurchaseSubscriptionTerms.pick({
|
|
4059
|
-
initialShippingPrice: true,
|
|
4060
|
-
recurringShippingPrice: true,
|
|
4061
|
-
shippingOption: true
|
|
4062
|
-
}).extend({
|
|
4063
|
-
discount: ChangesetDiscount,
|
|
4064
|
-
quantity: import_zod54.z.number().int().positive(),
|
|
4065
|
-
sellingPlanId: import_zod54.z.number().int().positive(),
|
|
4066
|
-
type: import_zod54.z.literal("add_subscription"),
|
|
4067
|
-
variantId: import_zod54.z.number().int().positive()
|
|
4068
|
-
})
|
|
4069
|
-
])
|
|
4070
|
-
)
|
|
4071
|
-
});
|
|
4469
|
+
// src/schema/postPurchasePreparationOptions.ts
|
|
4470
|
+
var import_zod72 = require("zod");
|
|
4471
|
+
var PostPurchasePreparationOptions = import_zod72.z.object({
|
|
4472
|
+
choice: PostPurchaseChoice.optional(),
|
|
4473
|
+
member: PostPurchaseMemberSelector.strict().optional(),
|
|
4474
|
+
quantity: PreparedPostPurchaseProduct.shape.selection.shape.quantity.optional(),
|
|
4475
|
+
selectedProductId: PostPurchaseProductId.optional(),
|
|
4476
|
+
variant: PostPurchaseVariantSelector.optional()
|
|
4477
|
+
}).strict().refine(
|
|
4478
|
+
({ member, quantity: quantity2, selectedProductId, variant: variant2 }) => !variant2 && quantity2 === void 0 && selectedProductId === void 0 || !!member,
|
|
4479
|
+
"Explicit selection requires a member"
|
|
4480
|
+
);
|
|
4072
4481
|
|
|
4073
4482
|
// src/schema/postPurchaseProductSettings.ts
|
|
4074
|
-
var
|
|
4075
|
-
var amount =
|
|
4483
|
+
var import_zod73 = require("zod");
|
|
4484
|
+
var amount = import_zod73.z.union([import_zod73.z.number().nonnegative(), PostPurchaseAmount.transform(Number)]);
|
|
4076
4485
|
var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
4077
4486
|
discountedFrom: true,
|
|
4078
4487
|
language: true,
|
|
@@ -4084,36 +4493,50 @@ var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
|
4084
4493
|
subscriptionIsDefault: true,
|
|
4085
4494
|
upgradeToSubscription: true
|
|
4086
4495
|
}).extend({
|
|
4087
|
-
advance:
|
|
4088
|
-
blocks:
|
|
4496
|
+
advance: import_zod73.z.unknown().default({}),
|
|
4497
|
+
blocks: import_zod73.z.array(import_zod73.z.unknown()).optional(),
|
|
4089
4498
|
discount: PostPurchaseSettings.shape.discount.extend({ amount: amount.default(30) }),
|
|
4090
|
-
integrations:
|
|
4499
|
+
integrations: import_zod73.z.unknown().default({}),
|
|
4091
4500
|
shipping: PostPurchaseSettings.shape.shipping.extend({ amount: amount.default(10) }),
|
|
4092
|
-
styles:
|
|
4501
|
+
styles: import_zod73.z.unknown().default({}),
|
|
4093
4502
|
subImages: PostPurchaseSettings.shape.subImages.catch(null),
|
|
4094
|
-
subscription:
|
|
4503
|
+
subscription: import_zod73.z.unknown().default(PostPurchaseSettings.shape.subscription.parse(void 0))
|
|
4504
|
+
});
|
|
4505
|
+
|
|
4506
|
+
// src/schema/postPurchaseRecovery.ts
|
|
4507
|
+
var import_zod74 = require("zod");
|
|
4508
|
+
var PurchaseRecoveryRequestSchema = DecideRequestSchema.strict();
|
|
4509
|
+
var PurchaseRecoveryResponseSchema = import_zod74.z.object({
|
|
4510
|
+
data: import_zod74.z.object({
|
|
4511
|
+
operation: import_zod74.z.object({
|
|
4512
|
+
observation: RecordedPurchaseObservationSchema.nullable(),
|
|
4513
|
+
operationId: PurchaseReceiptSchema.shape.operationId
|
|
4514
|
+
}).strict().nullable(),
|
|
4515
|
+
progress: PostPurchaseProgressSchema.nullable().optional()
|
|
4516
|
+
}),
|
|
4517
|
+
successful: import_zod74.z.literal(true)
|
|
4095
4518
|
});
|
|
4096
4519
|
|
|
4097
4520
|
// src/schema/postPurchaseSelection.ts
|
|
4098
|
-
var
|
|
4521
|
+
var import_zod75 = require("zod");
|
|
4099
4522
|
var SelectionClaimsSchema = DecideRequestSchema.extend({
|
|
4100
4523
|
appId: PostPurchaseAppIdSchema,
|
|
4101
4524
|
entry: DecisionEntrySchema,
|
|
4102
|
-
iss:
|
|
4103
|
-
purpose:
|
|
4525
|
+
iss: import_zod75.z.literal("rebuy-api"),
|
|
4526
|
+
purpose: import_zod75.z.literal("post-purchase-selection")
|
|
4104
4527
|
});
|
|
4105
4528
|
var SessionStartRequestSchema = DecideRequestSchema.extend({
|
|
4106
|
-
selectionToken:
|
|
4529
|
+
selectionToken: import_zod75.z.string().min(1).max(8192).optional()
|
|
4107
4530
|
}).strict();
|
|
4108
4531
|
|
|
4109
4532
|
// src/schema/postPurchaseSession.ts
|
|
4110
|
-
var
|
|
4533
|
+
var import_zod76 = require("zod");
|
|
4111
4534
|
var SessionIdentitySchema = DecideRequestSchema.extend({ appId: PostPurchaseAppIdSchema });
|
|
4112
|
-
var SessionOrderTimingSchema =
|
|
4535
|
+
var SessionOrderTimingSchema = import_zod76.z.object({
|
|
4113
4536
|
nativeDeadline: PostPurchaseTimestampSchema,
|
|
4114
4537
|
orderCreatedAt: PostPurchaseTimestampSchema,
|
|
4115
4538
|
orderId: PostPurchaseOrderIdSchema,
|
|
4116
|
-
timingSource:
|
|
4539
|
+
timingSource: import_zod76.z.literal("shopify-order-created-at")
|
|
4117
4540
|
});
|
|
4118
4541
|
var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
4119
4542
|
deadline: PostPurchaseTimestampSchema,
|
|
@@ -4130,39 +4553,33 @@ var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
|
4130
4553
|
message: "deadline must not exceed nativeDeadline",
|
|
4131
4554
|
path: ["deadline"]
|
|
4132
4555
|
});
|
|
4133
|
-
var SessionStartResponseSchema =
|
|
4134
|
-
data:
|
|
4135
|
-
phase:
|
|
4556
|
+
var SessionStartResponseSchema = import_zod76.z.object({
|
|
4557
|
+
data: import_zod76.z.object({
|
|
4558
|
+
phase: import_zod76.z.literal("render"),
|
|
4136
4559
|
serverNow: PostPurchaseTimestampSchema,
|
|
4137
4560
|
session: ReadySessionTimingSchema,
|
|
4138
|
-
workflowPhase:
|
|
4561
|
+
workflowPhase: import_zod76.z.literal("start")
|
|
4139
4562
|
}),
|
|
4140
|
-
successful:
|
|
4563
|
+
successful: import_zod76.z.literal(true)
|
|
4141
4564
|
});
|
|
4142
4565
|
|
|
4143
|
-
// src/schema/postPurchaseSessionClose.ts
|
|
4144
|
-
var import_zod58 = require("zod");
|
|
4145
|
-
var SessionClosureSchema = import_zod58.z.object({ closedAt: PostPurchaseTimestampSchema, status: import_zod58.z.literal("closed") });
|
|
4146
|
-
var SessionCloseRequestSchema = DecideRequestSchema.strict();
|
|
4147
|
-
var SessionCloseResponseSchema = import_zod58.z.object({ data: SessionClosureSchema, successful: import_zod58.z.literal(true) });
|
|
4148
|
-
|
|
4149
4566
|
// src/schema/postPurchaseShadow.ts
|
|
4150
|
-
var
|
|
4151
|
-
var PostPurchaseShadowSelectionSchema =
|
|
4152
|
-
|
|
4153
|
-
|
|
4567
|
+
var import_zod77 = require("zod");
|
|
4568
|
+
var PostPurchaseShadowSelectionSchema = import_zod77.z.discriminatedUnion("verdict", [
|
|
4569
|
+
import_zod77.z.object({ entry: DecisionEntrySchema, verdict: import_zod77.z.literal("render") }),
|
|
4570
|
+
import_zod77.z.object({ verdict: import_zod77.z.literal("skip") })
|
|
4154
4571
|
]);
|
|
4155
|
-
var PostPurchaseShadowReportFields =
|
|
4156
|
-
differences:
|
|
4572
|
+
var PostPurchaseShadowReportFields = import_zod77.z.object({
|
|
4573
|
+
differences: import_zod77.z.array(import_zod77.z.enum(["verdict", "entry", "targeting", "incomplete-capture", "unsupported-configuration"])).refine((differences) => new Set(differences).size === differences.length, {
|
|
4157
4574
|
message: "differences must not contain duplicate entries"
|
|
4158
4575
|
}),
|
|
4159
4576
|
legacySelection: PostPurchaseShadowSelectionSchema,
|
|
4160
|
-
phase:
|
|
4161
|
-
sampleId:
|
|
4577
|
+
phase: import_zod77.z.literal("shouldRender"),
|
|
4578
|
+
sampleId: import_zod77.z.string(),
|
|
4162
4579
|
serverSelection: PostPurchaseShadowSelectionSchema.optional(),
|
|
4163
|
-
status:
|
|
4164
|
-
targetingFlowIds:
|
|
4165
|
-
workflowPhase:
|
|
4580
|
+
status: import_zod77.z.enum(["match", "diverged", "incomplete"]),
|
|
4581
|
+
targetingFlowIds: import_zod77.z.array(import_zod77.z.number().int().positive()),
|
|
4582
|
+
workflowPhase: import_zod77.z.literal("decide")
|
|
4166
4583
|
});
|
|
4167
4584
|
var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
4168
4585
|
(report) => report.status !== "match" || report.differences.length === 0,
|
|
@@ -4175,31 +4592,21 @@ var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
|
4175
4592
|
path: ["status"]
|
|
4176
4593
|
});
|
|
4177
4594
|
|
|
4178
|
-
// src/schema/postPurchaseSkipTrace.ts
|
|
4179
|
-
var import_zod60 = require("zod");
|
|
4180
|
-
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
4181
|
-
var PostPurchaseSkipTraceSchema = import_zod60.z.array(
|
|
4182
|
-
import_zod60.z.object({
|
|
4183
|
-
entry: DecisionEntrySchema,
|
|
4184
|
-
reason: PostPurchaseSkipReasonSchema
|
|
4185
|
-
})
|
|
4186
|
-
).max(POST_PURCHASE_SKIP_LIMIT);
|
|
4187
|
-
|
|
4188
4595
|
// src/schema/postPurchaseSubscriptionDisplay.ts
|
|
4189
|
-
var
|
|
4190
|
-
var Minor2 =
|
|
4191
|
-
var PostPurchaseSubscriptionDisplay =
|
|
4596
|
+
var import_zod78 = require("zod");
|
|
4597
|
+
var Minor2 = import_zod78.z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
4598
|
+
var PostPurchaseSubscriptionDisplay = import_zod78.z.object({
|
|
4192
4599
|
comparisonMinor: Minor2,
|
|
4193
|
-
currencyCode:
|
|
4600
|
+
currencyCode: import_zod78.z.string().regex(/^[A-Z]{3}$/),
|
|
4194
4601
|
priceMinor: Minor2,
|
|
4195
4602
|
savingMinor: Minor2,
|
|
4196
|
-
savingPercent:
|
|
4603
|
+
savingPercent: import_zod78.z.number().int().min(0).max(100)
|
|
4197
4604
|
});
|
|
4198
4605
|
|
|
4199
4606
|
// src/schema/postPurchaseSubscriptionProduct.ts
|
|
4200
|
-
var
|
|
4607
|
+
var import_zod79 = require("zod");
|
|
4201
4608
|
var PreparedPostPurchaseSubscription = PreparedPostPurchaseProduct.extend({
|
|
4202
|
-
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId:
|
|
4609
|
+
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId: import_zod79.z.number().int().positive() }),
|
|
4203
4610
|
terms: PreparedPostPurchaseProduct.shape.terms.extend({
|
|
4204
4611
|
subscription: PostPurchaseSubscriptionTerms
|
|
4205
4612
|
}).refine(
|
|
@@ -4211,94 +4618,109 @@ var readPostPurchaseSubscription = (prepared) => {
|
|
|
4211
4618
|
return PreparedPostPurchaseSubscription.parse(prepared);
|
|
4212
4619
|
};
|
|
4213
4620
|
|
|
4621
|
+
// src/schema/postPurchaseTransition.ts
|
|
4622
|
+
var import_zod80 = require("zod");
|
|
4623
|
+
var OfferTransitionRequestSchema = DecideRequestSchema.extend({
|
|
4624
|
+
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
4625
|
+
progressRevision: PostPurchaseProgressSchema.shape.revision
|
|
4626
|
+
}).strict();
|
|
4627
|
+
var OfferTransitionResponseSchema = import_zod80.z.object({
|
|
4628
|
+
data: import_zod80.z.object({
|
|
4629
|
+
attemptedSkips: PostPurchaseSkipTraceSchema.optional(),
|
|
4630
|
+
progress: PostPurchaseProgressSchema,
|
|
4631
|
+
status: import_zod80.z.enum(["advanced", "no-child", "unavailable"])
|
|
4632
|
+
}),
|
|
4633
|
+
successful: import_zod80.z.literal(true)
|
|
4634
|
+
});
|
|
4635
|
+
|
|
4214
4636
|
// src/schema/postPurchaseVariantDefault.ts
|
|
4215
|
-
var
|
|
4637
|
+
var import_zod81 = require("zod");
|
|
4216
4638
|
var values = PostPurchaseVariantValues.partial().extend({
|
|
4217
4639
|
option1: PostPurchaseVariantValues.shape.option1.nullish()
|
|
4218
4640
|
});
|
|
4219
4641
|
var variant = values.extend({
|
|
4220
4642
|
id: PostPurchaseVariantId,
|
|
4221
|
-
inventoryManagement:
|
|
4222
|
-
inventoryPolicy:
|
|
4223
|
-
inventoryQuantity:
|
|
4643
|
+
inventoryManagement: import_zod81.z.string().nullable(),
|
|
4644
|
+
inventoryPolicy: import_zod81.z.string(),
|
|
4645
|
+
inventoryQuantity: import_zod81.z.number()
|
|
4224
4646
|
});
|
|
4225
|
-
var options =
|
|
4226
|
-
var PostPurchaseVariantDefaultProduct =
|
|
4647
|
+
var options = import_zod81.z.array(PostPurchaseVariantOption.pick({ name: true, values: true }));
|
|
4648
|
+
var PostPurchaseVariantDefaultProduct = import_zod81.z.object({
|
|
4227
4649
|
id: PostPurchaseProductId,
|
|
4228
4650
|
options,
|
|
4229
4651
|
selectedVariant: variant.optional(),
|
|
4230
|
-
variants:
|
|
4652
|
+
variants: import_zod81.z.array(variant)
|
|
4231
4653
|
});
|
|
4232
4654
|
var PostPurchaseVariantDefaultSettings = PostPurchaseSettings.shape.productOptions.pick({
|
|
4233
4655
|
hideOutOfStockVariants: true,
|
|
4234
4656
|
matchVariant: true
|
|
4235
4657
|
});
|
|
4236
|
-
var PostPurchaseOrderAttributes =
|
|
4237
|
-
var PostPurchaseOriginalVariants =
|
|
4238
|
-
|
|
4658
|
+
var PostPurchaseOrderAttributes = import_zod81.z.record(import_zod81.z.string(), import_zod81.z.array(import_zod81.z.string())).default({});
|
|
4659
|
+
var PostPurchaseOriginalVariants = import_zod81.z.array(
|
|
4660
|
+
import_zod81.z.object({ productId: PostPurchaseProductId, variantId: PostPurchaseVariantId })
|
|
4239
4661
|
);
|
|
4240
|
-
var PostPurchaseAttributeProducts =
|
|
4241
|
-
|
|
4662
|
+
var PostPurchaseAttributeProducts = import_zod81.z.array(
|
|
4663
|
+
import_zod81.z.object({ id: PostPurchaseProductId, options, variants: import_zod81.z.array(values.extend({ id: PostPurchaseVariantId })) })
|
|
4242
4664
|
);
|
|
4243
4665
|
|
|
4244
4666
|
// src/schema/postPurchaseVariantDefaultContext.ts
|
|
4245
|
-
var
|
|
4246
|
-
var PostPurchaseVariantDefaultContext =
|
|
4247
|
-
enrichedLineItems:
|
|
4667
|
+
var import_zod82 = require("zod");
|
|
4668
|
+
var PostPurchaseVariantDefaultContext = import_zod82.z.object({
|
|
4669
|
+
enrichedLineItems: import_zod82.z.unknown().optional(),
|
|
4248
4670
|
originalVariants: PostPurchaseOriginalVariants
|
|
4249
4671
|
});
|
|
4250
4672
|
|
|
4251
4673
|
// src/schema/shopConfig.ts
|
|
4252
|
-
var
|
|
4253
|
-
var ShopConfig =
|
|
4254
|
-
activeExperiments:
|
|
4255
|
-
|
|
4256
|
-
data:
|
|
4257
|
-
|
|
4258
|
-
aliasName:
|
|
4259
|
-
cssInput:
|
|
4260
|
-
elementId:
|
|
4261
|
-
id:
|
|
4262
|
-
javascriptInput:
|
|
4263
|
-
traffic:
|
|
4674
|
+
var import_zod83 = require("zod");
|
|
4675
|
+
var ShopConfig = import_zod83.z.object({
|
|
4676
|
+
activeExperiments: import_zod83.z.array(
|
|
4677
|
+
import_zod83.z.object({
|
|
4678
|
+
data: import_zod83.z.array(
|
|
4679
|
+
import_zod83.z.object({
|
|
4680
|
+
aliasName: import_zod83.z.string(),
|
|
4681
|
+
cssInput: import_zod83.z.string().nullish(),
|
|
4682
|
+
elementId: import_zod83.z.coerce.number(),
|
|
4683
|
+
id: import_zod83.z.coerce.number(),
|
|
4684
|
+
javascriptInput: import_zod83.z.string().nullish(),
|
|
4685
|
+
traffic: import_zod83.z.coerce.number()
|
|
4264
4686
|
})
|
|
4265
4687
|
),
|
|
4266
|
-
id:
|
|
4267
|
-
name:
|
|
4268
|
-
pageTarget:
|
|
4269
|
-
pageTargetUrl:
|
|
4270
|
-
placeholderId:
|
|
4271
|
-
type:
|
|
4688
|
+
id: import_zod83.z.coerce.number(),
|
|
4689
|
+
name: import_zod83.z.string(),
|
|
4690
|
+
pageTarget: import_zod83.z.string().nullable(),
|
|
4691
|
+
pageTargetUrl: import_zod83.z.string().nullable(),
|
|
4692
|
+
placeholderId: import_zod83.z.coerce.number().nullable(),
|
|
4693
|
+
type: import_zod83.z.string()
|
|
4272
4694
|
})
|
|
4273
4695
|
),
|
|
4274
|
-
activePackages:
|
|
4275
|
-
|
|
4276
|
-
cancelledAt:
|
|
4277
|
-
id:
|
|
4278
|
-
installedAt:
|
|
4279
|
-
isActive:
|
|
4280
|
-
isBillable:
|
|
4281
|
-
packageId:
|
|
4282
|
-
packageName:
|
|
4283
|
-
shortName:
|
|
4284
|
-
trialDays:
|
|
4285
|
-
uninstalledAt:
|
|
4696
|
+
activePackages: import_zod83.z.array(
|
|
4697
|
+
import_zod83.z.object({
|
|
4698
|
+
cancelledAt: import_zod83.z.string().nullable(),
|
|
4699
|
+
id: import_zod83.z.number(),
|
|
4700
|
+
installedAt: import_zod83.z.string().nullable(),
|
|
4701
|
+
isActive: import_zod83.z.boolean(),
|
|
4702
|
+
isBillable: import_zod83.z.boolean(),
|
|
4703
|
+
packageId: import_zod83.z.number(),
|
|
4704
|
+
packageName: import_zod83.z.string(),
|
|
4705
|
+
shortName: import_zod83.z.string(),
|
|
4706
|
+
trialDays: import_zod83.z.number(),
|
|
4707
|
+
uninstalledAt: import_zod83.z.string().nullable()
|
|
4286
4708
|
})
|
|
4287
4709
|
),
|
|
4288
|
-
apiKey:
|
|
4289
|
-
billingVersion:
|
|
4290
|
-
cacheKey:
|
|
4291
|
-
carousel:
|
|
4292
|
-
currency:
|
|
4293
|
-
currencySymbol:
|
|
4294
|
-
domain:
|
|
4295
|
-
enabledJquery:
|
|
4296
|
-
enabledPresentmentCurrencies:
|
|
4297
|
-
hasSmartCollectionsEnabled:
|
|
4298
|
-
hasSmartSearchEnabled:
|
|
4299
|
-
id:
|
|
4300
|
-
integrations:
|
|
4301
|
-
|
|
4710
|
+
apiKey: import_zod83.z.string(),
|
|
4711
|
+
billingVersion: import_zod83.z.string().nullable(),
|
|
4712
|
+
cacheKey: import_zod83.z.coerce.number(),
|
|
4713
|
+
carousel: import_zod83.z.enum(["flickity", "splide"]),
|
|
4714
|
+
currency: import_zod83.z.string(),
|
|
4715
|
+
currencySymbol: import_zod83.z.string(),
|
|
4716
|
+
domain: import_zod83.z.string(),
|
|
4717
|
+
enabledJquery: import_zod83.z.boolean(),
|
|
4718
|
+
enabledPresentmentCurrencies: import_zod83.z.array(import_zod83.z.string()),
|
|
4719
|
+
hasSmartCollectionsEnabled: import_zod83.z.boolean(),
|
|
4720
|
+
hasSmartSearchEnabled: import_zod83.z.boolean(),
|
|
4721
|
+
id: import_zod83.z.coerce.number(),
|
|
4722
|
+
integrations: import_zod83.z.record(
|
|
4723
|
+
import_zod83.z.enum([
|
|
4302
4724
|
"attentive",
|
|
4303
4725
|
"judgeme",
|
|
4304
4726
|
"junip",
|
|
@@ -4311,170 +4733,170 @@ var ShopConfig = import_zod65.z.object({
|
|
|
4311
4733
|
"stamped",
|
|
4312
4734
|
"yotpo"
|
|
4313
4735
|
]),
|
|
4314
|
-
|
|
4736
|
+
import_zod83.z.union([import_zod83.z.boolean(), import_zod83.z.unknown()])
|
|
4315
4737
|
),
|
|
4316
|
-
markets:
|
|
4317
|
-
enabled:
|
|
4738
|
+
markets: import_zod83.z.object({
|
|
4739
|
+
enabled: import_zod83.z.boolean()
|
|
4318
4740
|
}),
|
|
4319
|
-
monetize:
|
|
4320
|
-
publisherKey:
|
|
4741
|
+
monetize: import_zod83.z.object({
|
|
4742
|
+
publisherKey: import_zod83.z.string().nullable()
|
|
4321
4743
|
}).nullish(),
|
|
4322
|
-
moneyFormat:
|
|
4323
|
-
myshopifyDomain:
|
|
4324
|
-
primaryLocale:
|
|
4325
|
-
productGroupsEnabled:
|
|
4326
|
-
rechargeCustomDomain:
|
|
4327
|
-
sellingPlansEnabled:
|
|
4328
|
-
shopId:
|
|
4329
|
-
shopifySellingPlansEnabled:
|
|
4330
|
-
shopName:
|
|
4331
|
-
storefrontAccessToken:
|
|
4332
|
-
useRebuyIcons:
|
|
4744
|
+
moneyFormat: import_zod83.z.string(),
|
|
4745
|
+
myshopifyDomain: import_zod83.z.string(),
|
|
4746
|
+
primaryLocale: import_zod83.z.string(),
|
|
4747
|
+
productGroupsEnabled: import_zod83.z.enum(["no", "yes"]).transform((value) => value === "yes"),
|
|
4748
|
+
rechargeCustomDomain: import_zod83.z.string().nullable(),
|
|
4749
|
+
sellingPlansEnabled: import_zod83.z.boolean(),
|
|
4750
|
+
shopId: import_zod83.z.number(),
|
|
4751
|
+
shopifySellingPlansEnabled: import_zod83.z.boolean(),
|
|
4752
|
+
shopName: import_zod83.z.string(),
|
|
4753
|
+
storefrontAccessToken: import_zod83.z.string().nullable(),
|
|
4754
|
+
useRebuyIcons: import_zod83.z.boolean()
|
|
4333
4755
|
});
|
|
4334
4756
|
|
|
4335
4757
|
// src/schema/userConfig.ts
|
|
4336
|
-
var
|
|
4337
|
-
var UserConfig =
|
|
4758
|
+
var import_zod84 = require("zod");
|
|
4759
|
+
var UserConfig = import_zod84.z.object({
|
|
4338
4760
|
shop: ShopConfig,
|
|
4339
4761
|
/**
|
|
4340
4762
|
* `.catch(undefined)` is the safety bar: smart-cart shape drift can NEVER fail `fetchUserConfig`,
|
|
4341
4763
|
* which resolves the apiKey for every offers/monetize/analytics/gift request.
|
|
4342
4764
|
*/
|
|
4343
4765
|
smartCart: SmartCartConfig.nullish().catch(void 0),
|
|
4344
|
-
smartFlows:
|
|
4766
|
+
smartFlows: import_zod84.z.array(import_zod84.z.unknown())
|
|
4345
4767
|
});
|
|
4346
4768
|
|
|
4347
4769
|
// src/schema/widgetData.ts
|
|
4348
|
-
var
|
|
4770
|
+
var import_zod93 = require("zod");
|
|
4349
4771
|
|
|
4350
4772
|
// src/schema/widgets/abTestingPlaceholder.ts
|
|
4351
|
-
var
|
|
4352
|
-
var ABTestingPlaceholder =
|
|
4353
|
-
type:
|
|
4773
|
+
var import_zod85 = require("zod");
|
|
4774
|
+
var ABTestingPlaceholder = import_zod85.z.looseObject({
|
|
4775
|
+
type: import_zod85.z.literal("placeholder")
|
|
4354
4776
|
});
|
|
4355
4777
|
|
|
4356
4778
|
// src/schema/widgets/checkoutExtension.ts
|
|
4357
|
-
var
|
|
4358
|
-
var CheckoutExtension =
|
|
4359
|
-
type:
|
|
4779
|
+
var import_zod86 = require("zod");
|
|
4780
|
+
var CheckoutExtension = import_zod86.z.looseObject({
|
|
4781
|
+
type: import_zod86.z.literal(WidgetType.shopify_checkout_extension).default(WidgetType.shopify_checkout_extension)
|
|
4360
4782
|
});
|
|
4361
4783
|
|
|
4362
4784
|
// src/schema/widgets/contentBlock.ts
|
|
4363
|
-
var
|
|
4364
|
-
var ContentBlockV1 =
|
|
4365
|
-
blockSpacing:
|
|
4366
|
-
imageBlocks:
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
altText:
|
|
4370
|
-
description:
|
|
4371
|
-
id:
|
|
4372
|
-
imagePlacement:
|
|
4373
|
-
imageSize:
|
|
4374
|
-
imageUrl:
|
|
4375
|
-
textAlignment:
|
|
4785
|
+
var import_zod87 = require("zod");
|
|
4786
|
+
var ContentBlockV1 = import_zod87.z.object({
|
|
4787
|
+
blockSpacing: import_zod87.z.enum(spacings).optional(),
|
|
4788
|
+
imageBlocks: import_zod87.z.union([
|
|
4789
|
+
import_zod87.z.array(
|
|
4790
|
+
import_zod87.z.object({
|
|
4791
|
+
altText: import_zod87.z.string().nullable(),
|
|
4792
|
+
description: import_zod87.z.string().nullable(),
|
|
4793
|
+
id: import_zod87.z.uuid(),
|
|
4794
|
+
imagePlacement: import_zod87.z.enum(["top", "right", "bottom", "left"]),
|
|
4795
|
+
imageSize: import_zod87.z.number(),
|
|
4796
|
+
imageUrl: import_zod87.z.url(),
|
|
4797
|
+
textAlignment: import_zod87.z.enum(["left", "center", "right"]),
|
|
4376
4798
|
/** Inline scale only: an image caption can never be a block-level heading. */
|
|
4377
|
-
textSize:
|
|
4799
|
+
textSize: import_zod87.z.enum(inlineTextSizeNames)
|
|
4378
4800
|
})
|
|
4379
4801
|
),
|
|
4380
|
-
|
|
4802
|
+
import_zod87.z.strictObject({}).transform(() => [])
|
|
4381
4803
|
]).optional(),
|
|
4382
|
-
imageLayout:
|
|
4383
|
-
language:
|
|
4384
|
-
description:
|
|
4385
|
-
superTitle:
|
|
4386
|
-
title:
|
|
4804
|
+
imageLayout: import_zod87.z.enum(["row", "column"]).optional(),
|
|
4805
|
+
language: import_zod87.z.object({
|
|
4806
|
+
description: import_zod87.z.string(),
|
|
4807
|
+
superTitle: import_zod87.z.string(),
|
|
4808
|
+
title: import_zod87.z.string()
|
|
4387
4809
|
}),
|
|
4388
|
-
previewMode:
|
|
4389
|
-
type:
|
|
4390
|
-
version:
|
|
4810
|
+
previewMode: import_zod87.z.boolean(),
|
|
4811
|
+
type: import_zod87.z.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block),
|
|
4812
|
+
version: import_zod87.z.literal(1)
|
|
4391
4813
|
});
|
|
4392
|
-
var ContentBlock =
|
|
4814
|
+
var ContentBlock = import_zod87.z.discriminatedUnion("version", [
|
|
4393
4815
|
ContentBlockV1,
|
|
4394
4816
|
CABRootSection.extend({
|
|
4395
|
-
type:
|
|
4817
|
+
type: import_zod87.z.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block)
|
|
4396
4818
|
})
|
|
4397
4819
|
]);
|
|
4398
4820
|
|
|
4399
4821
|
// src/schema/widgets/giftWithPurchase.ts
|
|
4400
|
-
var
|
|
4401
|
-
var GiftWithPurchase =
|
|
4402
|
-
type:
|
|
4822
|
+
var import_zod88 = require("zod");
|
|
4823
|
+
var GiftWithPurchase = import_zod88.z.looseObject({
|
|
4824
|
+
type: import_zod88.z.literal(WidgetType.gift_with_purchase).default(WidgetType.gift_with_purchase)
|
|
4403
4825
|
});
|
|
4404
4826
|
|
|
4405
4827
|
// src/schema/widgets/lineItemEditor.ts
|
|
4406
|
-
var
|
|
4407
|
-
var LineItemEditorSwitchLanguageV1 =
|
|
4408
|
-
downgradeToOneTimeLabel:
|
|
4828
|
+
var import_zod89 = require("zod");
|
|
4829
|
+
var LineItemEditorSwitchLanguageV1 = import_zod89.z.object({
|
|
4830
|
+
downgradeToOneTimeLabel: import_zod89.z.string().optional(),
|
|
4409
4831
|
/** Frequency-option template (`{{frequency}}`/`{{interval}}`) for the plan select. */
|
|
4410
|
-
subscriptionOptionLabel:
|
|
4411
|
-
upgradeToSubscriptionLabel:
|
|
4412
|
-
upgradeToSubscriptionWithoutDiscountLabel:
|
|
4832
|
+
subscriptionOptionLabel: import_zod89.z.string().optional(),
|
|
4833
|
+
upgradeToSubscriptionLabel: import_zod89.z.string().optional(),
|
|
4834
|
+
upgradeToSubscriptionWithoutDiscountLabel: import_zod89.z.string().optional()
|
|
4413
4835
|
});
|
|
4414
|
-
var LineItemEditorV1 =
|
|
4836
|
+
var LineItemEditorV1 = import_zod89.z.object({
|
|
4415
4837
|
/** Legacy `getStyles` button style; the converter carries a valid kind, defaulting to `plain`. */
|
|
4416
|
-
button:
|
|
4417
|
-
previewMode:
|
|
4418
|
-
switchToSubscription:
|
|
4419
|
-
disableDowngrade:
|
|
4838
|
+
button: import_zod89.z.object({ kind: import_zod89.z.enum(["plain", "primary", "secondary"]).optional() }).optional(),
|
|
4839
|
+
previewMode: import_zod89.z.boolean().optional(),
|
|
4840
|
+
switchToSubscription: import_zod89.z.object({
|
|
4841
|
+
disableDowngrade: import_zod89.z.boolean().optional(),
|
|
4420
4842
|
language: LineItemEditorSwitchLanguageV1.optional()
|
|
4421
4843
|
}).optional(),
|
|
4422
|
-
switchToSubscriptionEnabled:
|
|
4423
|
-
tracking:
|
|
4424
|
-
enableAttribution:
|
|
4425
|
-
enableSource:
|
|
4426
|
-
enableWidget:
|
|
4844
|
+
switchToSubscriptionEnabled: import_zod89.z.boolean().optional(),
|
|
4845
|
+
tracking: import_zod89.z.object({
|
|
4846
|
+
enableAttribution: import_zod89.z.boolean().optional(),
|
|
4847
|
+
enableSource: import_zod89.z.boolean().optional(),
|
|
4848
|
+
enableWidget: import_zod89.z.boolean().optional()
|
|
4427
4849
|
}).optional(),
|
|
4428
|
-
type:
|
|
4429
|
-
version:
|
|
4850
|
+
type: import_zod89.z.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor),
|
|
4851
|
+
version: import_zod89.z.literal(1)
|
|
4430
4852
|
});
|
|
4431
|
-
var LineItemEditor =
|
|
4853
|
+
var LineItemEditor = import_zod89.z.discriminatedUnion("version", [
|
|
4432
4854
|
LineItemEditorV1,
|
|
4433
4855
|
CABRootSection.extend({
|
|
4434
|
-
type:
|
|
4856
|
+
type: import_zod89.z.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor)
|
|
4435
4857
|
})
|
|
4436
4858
|
]);
|
|
4437
4859
|
|
|
4438
4860
|
// src/schema/widgets/progressBar.ts
|
|
4439
|
-
var
|
|
4440
|
-
var ProgressBar =
|
|
4441
|
-
type:
|
|
4861
|
+
var import_zod90 = require("zod");
|
|
4862
|
+
var ProgressBar = import_zod90.z.looseObject({
|
|
4863
|
+
type: import_zod90.z.literal(WidgetType.ui_extension_progress_bar).default(WidgetType.ui_extension_progress_bar)
|
|
4442
4864
|
});
|
|
4443
4865
|
|
|
4444
4866
|
// src/schema/widgets/rebuyButton.ts
|
|
4445
|
-
var
|
|
4446
|
-
var RebuyButtonV1 =
|
|
4447
|
-
type:
|
|
4448
|
-
version:
|
|
4867
|
+
var import_zod91 = require("zod");
|
|
4868
|
+
var RebuyButtonV1 = import_zod91.z.looseObject({
|
|
4869
|
+
type: import_zod91.z.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button),
|
|
4870
|
+
version: import_zod91.z.literal(1)
|
|
4449
4871
|
});
|
|
4450
|
-
var RebuyButton =
|
|
4872
|
+
var RebuyButton = import_zod91.z.discriminatedUnion("version", [
|
|
4451
4873
|
RebuyButtonV1,
|
|
4452
4874
|
CABRootSection.extend({
|
|
4453
|
-
type:
|
|
4875
|
+
type: import_zod91.z.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button)
|
|
4454
4876
|
})
|
|
4455
4877
|
]);
|
|
4456
4878
|
|
|
4457
4879
|
// src/schema/widgets/rebuyMonetize.ts
|
|
4458
|
-
var
|
|
4459
|
-
var RebuyMonetize =
|
|
4460
|
-
type:
|
|
4880
|
+
var import_zod92 = require("zod");
|
|
4881
|
+
var RebuyMonetize = import_zod92.z.looseObject({
|
|
4882
|
+
type: import_zod92.z.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad)
|
|
4461
4883
|
});
|
|
4462
|
-
var RebuyMonetizeV1 =
|
|
4463
|
-
name:
|
|
4464
|
-
previewMode:
|
|
4884
|
+
var RebuyMonetizeV1 = import_zod92.z.object({
|
|
4885
|
+
name: import_zod92.z.string().nullable().optional(),
|
|
4886
|
+
previewMode: import_zod92.z.boolean().optional(),
|
|
4465
4887
|
/** Privacy Policy footer href → the marker section's `privacyPolicyUrl`. */
|
|
4466
|
-
privacyPolicyUrl:
|
|
4888
|
+
privacyPolicyUrl: import_zod92.z.string().nullable().optional(),
|
|
4467
4889
|
/** Ads-taxonomy sub-vertical id — one of the admin Monetize editor's two configurables. */
|
|
4468
|
-
subVertical:
|
|
4469
|
-
tracking:
|
|
4470
|
-
enableAttribution:
|
|
4471
|
-
enableSource:
|
|
4472
|
-
enableWidget:
|
|
4890
|
+
subVertical: import_zod92.z.string().nullable().optional(),
|
|
4891
|
+
tracking: import_zod92.z.object({
|
|
4892
|
+
enableAttribution: import_zod92.z.boolean().optional(),
|
|
4893
|
+
enableSource: import_zod92.z.boolean().optional(),
|
|
4894
|
+
enableWidget: import_zod92.z.boolean().optional()
|
|
4473
4895
|
}).optional(),
|
|
4474
|
-
type:
|
|
4475
|
-
version:
|
|
4896
|
+
type: import_zod92.z.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad),
|
|
4897
|
+
version: import_zod92.z.literal(1),
|
|
4476
4898
|
/** Ads-taxonomy vertical id — one of the admin Monetize editor's two configurables. */
|
|
4477
|
-
vertical:
|
|
4899
|
+
vertical: import_zod92.z.string().nullable().optional()
|
|
4478
4900
|
});
|
|
4479
4901
|
|
|
4480
4902
|
// src/schema/widgetData.ts
|
|
@@ -4488,7 +4910,7 @@ var extensionWidgetTypes = [
|
|
|
4488
4910
|
WidgetType.ui_extension_line_item_editor,
|
|
4489
4911
|
WidgetType.ui_extension_progress_bar
|
|
4490
4912
|
];
|
|
4491
|
-
var WidgetData =
|
|
4913
|
+
var WidgetData = import_zod93.z.discriminatedUnion("type", [
|
|
4492
4914
|
ABTestingPlaceholder,
|
|
4493
4915
|
CheckoutExtension,
|
|
4494
4916
|
ContentBlock,
|
|
@@ -4848,36 +5270,36 @@ var SWITCH_LABELS = {
|
|
|
4848
5270
|
};
|
|
4849
5271
|
|
|
4850
5272
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
4851
|
-
var
|
|
5273
|
+
var import_zod95 = require("zod");
|
|
4852
5274
|
|
|
4853
5275
|
// src/schema/widgets/post-purchase-offer/postPurchaseWidget.ts
|
|
4854
|
-
var
|
|
4855
|
-
var PostPurchaseWidgetLinkedFlow =
|
|
4856
|
-
id:
|
|
4857
|
-
name:
|
|
4858
|
-
});
|
|
4859
|
-
var PostPurchaseWidget =
|
|
4860
|
-
classification:
|
|
4861
|
-
createdAtTime:
|
|
4862
|
-
customEndpointName:
|
|
4863
|
-
id:
|
|
4864
|
-
lastViewed:
|
|
4865
|
-
linkedCustomEndpointId:
|
|
4866
|
-
linkedFlows:
|
|
4867
|
-
name:
|
|
4868
|
-
owner:
|
|
5276
|
+
var import_zod94 = require("zod");
|
|
5277
|
+
var PostPurchaseWidgetLinkedFlow = import_zod94.z.object({
|
|
5278
|
+
id: import_zod94.z.number(),
|
|
5279
|
+
name: import_zod94.z.string()
|
|
5280
|
+
});
|
|
5281
|
+
var PostPurchaseWidget = import_zod94.z.object({
|
|
5282
|
+
classification: import_zod94.z.literal("post_purchase_offer_page").default("post_purchase_offer_page"),
|
|
5283
|
+
createdAtTime: import_zod94.z.iso.datetime({ offset: true }).optional(),
|
|
5284
|
+
customEndpointName: import_zod94.z.string().nullish(),
|
|
5285
|
+
id: import_zod94.z.number().default(0),
|
|
5286
|
+
lastViewed: import_zod94.z.iso.datetime({ offset: true }).nullish(),
|
|
5287
|
+
linkedCustomEndpointId: import_zod94.z.number().nullish(),
|
|
5288
|
+
linkedFlows: import_zod94.z.array(PostPurchaseWidgetLinkedFlow).optional(),
|
|
5289
|
+
name: import_zod94.z.string().default(""),
|
|
5290
|
+
owner: import_zod94.z.number().nullish(),
|
|
4869
5291
|
settings: PostPurchaseSettings
|
|
4870
5292
|
});
|
|
4871
5293
|
|
|
4872
5294
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
4873
|
-
var PostPurchaseOffer =
|
|
4874
|
-
|
|
4875
|
-
errors:
|
|
4876
|
-
message:
|
|
4877
|
-
successful:
|
|
5295
|
+
var PostPurchaseOffer = import_zod95.z.discriminatedUnion("successful", [
|
|
5296
|
+
import_zod95.z.strictObject({
|
|
5297
|
+
errors: import_zod95.z.array(import_zod95.z.object({ message: import_zod95.z.string() })),
|
|
5298
|
+
message: import_zod95.z.string(),
|
|
5299
|
+
successful: import_zod95.z.literal(false)
|
|
4878
5300
|
}),
|
|
4879
|
-
|
|
4880
|
-
successful:
|
|
5301
|
+
import_zod95.z.strictObject({
|
|
5302
|
+
successful: import_zod95.z.literal(true),
|
|
4881
5303
|
widget: PostPurchaseWidget
|
|
4882
5304
|
})
|
|
4883
5305
|
]);
|
|
@@ -5790,6 +6212,15 @@ var DISCOUNTED_FROM = {
|
|
|
5790
6212
|
original_price: "price",
|
|
5791
6213
|
price: "price"
|
|
5792
6214
|
};
|
|
6215
|
+
var variantLabelsOf = (language3) => {
|
|
6216
|
+
const labels = Object.fromEntries(
|
|
6217
|
+
["variantOption", "variantOptions"].flatMap((key) => {
|
|
6218
|
+
const value = language3?.[key];
|
|
6219
|
+
return typeof value === "string" && value.trim() ? [[key, value]] : [];
|
|
6220
|
+
})
|
|
6221
|
+
);
|
|
6222
|
+
return Object.keys(labels).length ? labels : void 0;
|
|
6223
|
+
};
|
|
5793
6224
|
var dataSourceDiscount = (discount) => {
|
|
5794
6225
|
if (!discount?.type || discount.type === "none") return void 0;
|
|
5795
6226
|
const discountedFrom = discount.discountedFrom ? DISCOUNTED_FROM[discount.discountedFrom] : void 0;
|
|
@@ -5871,6 +6302,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
5871
6302
|
const listLayout = { direction: "rows", offersDirection };
|
|
5872
6303
|
const horizontalCard = offersDirection === "vertical";
|
|
5873
6304
|
const discount = dataSourceDiscount(settings.discount);
|
|
6305
|
+
const variantLabels = variantLabelsOf(settings.language);
|
|
5874
6306
|
const dataSource = {
|
|
5875
6307
|
...settings.endpoint && { dataSourcePath: settings.endpoint },
|
|
5876
6308
|
...discount && { discount },
|
|
@@ -5881,7 +6313,8 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
5881
6313
|
...settings.productType && { productType: settings.productType },
|
|
5882
6314
|
sectionType: "dataSource",
|
|
5883
6315
|
...settings.subscriptionIsDefault && { subscriptionIsDefault: true },
|
|
5884
|
-
...settings.treatAsGwp && { treatAsGwp: true }
|
|
6316
|
+
...settings.treatAsGwp && { treatAsGwp: true },
|
|
6317
|
+
...variantLabels && { variantLabels }
|
|
5885
6318
|
};
|
|
5886
6319
|
const container = settings.displaySettings?.container;
|
|
5887
6320
|
const containerBorder = {
|
|
@@ -5952,6 +6385,46 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
5952
6385
|
});
|
|
5953
6386
|
};
|
|
5954
6387
|
|
|
6388
|
+
// src/pricing/postPurchaseChangeset.ts
|
|
6389
|
+
var postPurchaseChangeset = (prepared) => {
|
|
6390
|
+
const { selection: selection2, terms } = prepared;
|
|
6391
|
+
const subscription = readPostPurchaseSubscription(prepared);
|
|
6392
|
+
const { discount, shipping } = terms;
|
|
6393
|
+
const changesetDiscount = discount.type === "none" ? void 0 : {
|
|
6394
|
+
title: discount.title,
|
|
6395
|
+
value: discount.amount,
|
|
6396
|
+
valueType: discount.type
|
|
6397
|
+
};
|
|
6398
|
+
if (subscription) {
|
|
6399
|
+
const { initialShippingPrice, recurringShippingPrice, shippingOption } = subscription.terms.subscription;
|
|
6400
|
+
return PostPurchaseProductChangeset.parse({
|
|
6401
|
+
changes: [
|
|
6402
|
+
{
|
|
6403
|
+
...changesetDiscount ? { discount: changesetDiscount } : {},
|
|
6404
|
+
initialShippingPrice,
|
|
6405
|
+
quantity: selection2.quantity,
|
|
6406
|
+
recurringShippingPrice,
|
|
6407
|
+
sellingPlanId: subscription.selection.sellingPlanId,
|
|
6408
|
+
shippingOption,
|
|
6409
|
+
type: "add_subscription",
|
|
6410
|
+
variantId: selection2.variantId
|
|
6411
|
+
}
|
|
6412
|
+
]
|
|
6413
|
+
});
|
|
6414
|
+
}
|
|
6415
|
+
const changes = [
|
|
6416
|
+
{
|
|
6417
|
+
quantity: selection2.quantity,
|
|
6418
|
+
type: "add_variant",
|
|
6419
|
+
variantId: selection2.variantId,
|
|
6420
|
+
...changesetDiscount && changesetDiscount.value > 0 ? { discount: changesetDiscount } : {}
|
|
6421
|
+
}
|
|
6422
|
+
];
|
|
6423
|
+
if (shipping.type === "fixed_amount")
|
|
6424
|
+
changes.push({ price: shipping.amount, title: shipping.title, type: "add_shipping_line" });
|
|
6425
|
+
return PostPurchaseProductChangeset.parse({ changes });
|
|
6426
|
+
};
|
|
6427
|
+
|
|
5955
6428
|
// src/pricing/amountToCents.ts
|
|
5956
6429
|
var round = (value, precision = 0) => {
|
|
5957
6430
|
const factor = 10 ** precision;
|
|
@@ -5988,6 +6461,43 @@ var currencyDecimals = (currencyCode) => {
|
|
|
5988
6461
|
return decimals;
|
|
5989
6462
|
};
|
|
5990
6463
|
|
|
6464
|
+
// src/pricing/postPurchaseCosts.ts
|
|
6465
|
+
var postPurchaseCosts = (prepared, response, currencyCode) => {
|
|
6466
|
+
const { calculatedPurchase: purchase } = PostPurchaseProductCalculation.parse(response);
|
|
6467
|
+
const subscription = readPostPurchaseSubscription(prepared);
|
|
6468
|
+
const line = purchase.updatedLineItems.find(
|
|
6469
|
+
(line2) => line2.productId === prepared.selection.productId && line2.variantId === prepared.selection.variantId && (!subscription || line2.sellingPlanId === subscription.selection.sellingPlanId)
|
|
6470
|
+
);
|
|
6471
|
+
if (!line) throw new Error("Calculated variant mismatch");
|
|
6472
|
+
const decimals = currencyDecimals(currencyCode);
|
|
6473
|
+
const minor = ({ presentmentMoney }) => {
|
|
6474
|
+
const { amount: amount2, currencyCode: actualCurrency } = presentmentMoney;
|
|
6475
|
+
if (actualCurrency !== currencyCode || Number(Number(amount2).toFixed(decimals)) !== Number(amount2))
|
|
6476
|
+
throw new Error("Inconsistent presentment money");
|
|
6477
|
+
return amountToCents2(amount2, decimals);
|
|
6478
|
+
};
|
|
6479
|
+
const totalMinor = minor(purchase.totalOutstandingSet);
|
|
6480
|
+
const shippingMinor = purchase.addedShippingLines.reduce((sum, line2) => sum + minor(line2.priceSet), 0);
|
|
6481
|
+
const taxesMinor = purchase.addedTaxLines.reduce((sum, line2) => sum + minor(line2.priceSet), 0);
|
|
6482
|
+
let recurringDisplay;
|
|
6483
|
+
if (subscription) {
|
|
6484
|
+
const price = PostPurchaseProductCalculation.shape.calculatedPurchase.shape.totalOutstandingSet.parse(
|
|
6485
|
+
line.priceSet
|
|
6486
|
+
);
|
|
6487
|
+
const subtotalMinor = minor(price) * prepared.selection.quantity;
|
|
6488
|
+
const shippingMinor2 = amountToCents2(subscription.terms.subscription.recurringShippingPrice, decimals);
|
|
6489
|
+
recurringDisplay = { shippingMinor: shippingMinor2, subtotalMinor, totalMinor: subtotalMinor + shippingMinor2 };
|
|
6490
|
+
}
|
|
6491
|
+
return PostPurchaseProductCosts.parse({
|
|
6492
|
+
...recurringDisplay && { recurringDisplay },
|
|
6493
|
+
currencyCode,
|
|
6494
|
+
shippingMinor,
|
|
6495
|
+
subtotalMinor: totalMinor - shippingMinor - taxesMinor,
|
|
6496
|
+
taxesMinor,
|
|
6497
|
+
totalMinor
|
|
6498
|
+
});
|
|
6499
|
+
};
|
|
6500
|
+
|
|
5991
6501
|
// src/pricing/postPurchaseSubscriptionDisplay.ts
|
|
5992
6502
|
var postPurchaseSubscriptionDisplay = (prepared, currencyCode) => {
|
|
5993
6503
|
const subscription = readPostPurchaseSubscription(prepared);
|