@rebuy/rebuy 3.32.0 → 3.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1138 -923
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +1138 -923
- package/dist/pricing/postPurchaseSubscriptionDisplay.d.ts +5 -0
- package/dist/schema/index.d.ts +8 -0
- package/dist/schema/postPurchaseChoice.d.ts +25 -0
- package/dist/schema/postPurchaseDiscount.d.ts +22 -0
- package/dist/schema/postPurchasePlanAdjustment.d.ts +11 -0
- package/dist/schema/postPurchasePlanCatalog.d.ts +42 -0
- package/dist/schema/postPurchaseProduct.d.ts +260 -0
- package/dist/schema/postPurchaseProductSettings.d.ts +1 -1
- package/dist/schema/postPurchaseProductSource.d.ts +2 -2
- package/dist/schema/postPurchaseSubscription.d.ts +21 -0
- package/dist/schema/postPurchaseSubscriptionDisplay.d.ts +10 -0
- package/dist/schema/postPurchaseSubscriptionProduct.d.ts +224 -0
- package/dist/schema/postPurchaseSubscriptionSettings.d.ts +22 -0
- 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/common.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/dataSource.d.ts +2 -2
- package/dist/schema/widgets/checkout-and-beyond/discount.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/icons.d.ts +1 -1
- package/dist/schema/widgets/checkout-and-beyond/image.d.ts +2 -2
- 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/schema/widgets/post-purchase-offer/postPurchaseOffer.d.ts +2 -2
- package/dist/schema/widgets/post-purchase-offer/postPurchaseSettings.d.ts +2 -2
- package/dist/schema/widgets/post-purchase-offer/postPurchaseWidget.d.ts +2 -2
- package/dist/server/__fixtures__/postPurchaseLegacyPlans.d.ts +35 -0
- package/dist/server/__fixtures__/postPurchaseSubscription.d.ts +75 -0
- package/dist/server/index.cjs +802 -118
- package/dist/server/index.d.ts +3 -1
- package/dist/server/index.mjs +802 -118
- package/dist/server/normalizePostPurchaseCollection.d.ts +16 -16
- package/dist/server/normalizePostPurchaseProduct.d.ts +9 -9
- package/dist/server/postPurchaseLegacyPlans.d.ts +3 -0
- package/dist/server/postPurchaseModernPlans.d.ts +7 -0
- package/dist/server/postPurchasePlanAdjustment.d.ts +3 -0
- package/dist/server/postPurchasePlanCatalog.d.ts +5 -0
- package/dist/server/postPurchaseSubscriptionEligibility.d.ts +5 -0
- package/dist/server/prepareNormalizedSubscription.d.ts +11 -0
- package/dist/server/preparePostPurchaseSubscription.d.ts +102 -0
- package/dist/server/projectPostPurchaseProduct.d.ts +7 -7
- package/dist/server/requestSchemas.d.ts +1 -1
- package/dist/server/selectPostPurchaseChoice.d.ts +43 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -136,10 +136,17 @@ __export(src_exports, {
|
|
|
136
136
|
PostPurchaseAmount: () => PostPurchaseAmount,
|
|
137
137
|
PostPurchaseAppIdSchema: () => PostPurchaseAppIdSchema,
|
|
138
138
|
PostPurchaseBlock: () => PostPurchaseBlock,
|
|
139
|
+
PostPurchaseChoice: () => PostPurchaseChoice,
|
|
140
|
+
PostPurchaseDiscount: () => PostPurchaseDiscount,
|
|
139
141
|
PostPurchaseExcludedProductIds: () => PostPurchaseExcludedProductIds,
|
|
140
142
|
PostPurchaseOffer: () => PostPurchaseOffer,
|
|
143
|
+
PostPurchaseOptions: () => PostPurchaseOptions,
|
|
141
144
|
PostPurchaseOrderAttributes: () => PostPurchaseOrderAttributes,
|
|
142
145
|
PostPurchaseOrderIdSchema: () => PostPurchaseOrderIdSchema,
|
|
146
|
+
PostPurchasePlanAdjustment: () => PostPurchasePlanAdjustment,
|
|
147
|
+
PostPurchasePlanCatalog: () => PostPurchasePlanCatalog,
|
|
148
|
+
PostPurchasePlanOption: () => PostPurchasePlanOption,
|
|
149
|
+
PostPurchasePreparation: () => PostPurchasePreparation,
|
|
143
150
|
PostPurchasePrimaryImageSource: () => PostPurchasePrimaryImageSource,
|
|
144
151
|
PostPurchaseProductDisplay: () => PostPurchaseProductDisplay,
|
|
145
152
|
PostPurchaseProductGallery: () => PostPurchaseProductGallery,
|
|
@@ -152,7 +159,10 @@ __export(src_exports, {
|
|
|
152
159
|
PostPurchaseShadowSelectionSchema: () => PostPurchaseShadowSelectionSchema,
|
|
153
160
|
PostPurchaseSkipReasonSchema: () => PostPurchaseSkipReasonSchema,
|
|
154
161
|
PostPurchaseSkipTraceSchema: () => PostPurchaseSkipTraceSchema,
|
|
162
|
+
PostPurchaseSubscriptionDisplay: () => PostPurchaseSubscriptionDisplay,
|
|
163
|
+
PostPurchaseSubscriptionTerms: () => PostPurchaseSubscriptionTerms,
|
|
155
164
|
PostPurchaseTimestampSchema: () => PostPurchaseTimestampSchema,
|
|
165
|
+
PostPurchaseVariant: () => PostPurchaseVariant,
|
|
156
166
|
PostPurchaseVariantCatalog: () => PostPurchaseVariantCatalog,
|
|
157
167
|
PostPurchaseVariantDefaultProduct: () => PostPurchaseVariantDefaultProduct,
|
|
158
168
|
PostPurchaseVariantDefaultSettings: () => PostPurchaseVariantDefaultSettings,
|
|
@@ -162,6 +172,8 @@ __export(src_exports, {
|
|
|
162
172
|
PostPurchaseVariantValues: () => PostPurchaseVariantValues,
|
|
163
173
|
PostPurchaseWidget: () => PostPurchaseWidget,
|
|
164
174
|
PostPurchaseWidgetLinkedFlow: () => PostPurchaseWidgetLinkedFlow,
|
|
175
|
+
PreparedPostPurchaseProduct: () => PreparedPostPurchaseProduct,
|
|
176
|
+
PreparedPostPurchaseSubscription: () => PreparedPostPurchaseSubscription,
|
|
165
177
|
Product: () => Product,
|
|
166
178
|
ProductInformationBlock: () => ProductInformationBlock,
|
|
167
179
|
ProductType: () => ProductType,
|
|
@@ -301,6 +313,7 @@ __export(src_exports, {
|
|
|
301
313
|
offersDirections: () => offersDirections,
|
|
302
314
|
popoverPositionMap: () => popoverPositionMap,
|
|
303
315
|
popoverPositions: () => popoverPositions,
|
|
316
|
+
postPurchaseSubscriptionDisplay: () => postPurchaseSubscriptionDisplay,
|
|
304
317
|
productImageObject: () => productImageObject,
|
|
305
318
|
productTypes: () => productTypes,
|
|
306
319
|
progressTierExclusionTypes: () => progressTierExclusionTypes,
|
|
@@ -328,6 +341,7 @@ __export(src_exports, {
|
|
|
328
341
|
textSizeNames: () => textSizeNames,
|
|
329
342
|
utmObjectFromString: () => utmObjectFromString,
|
|
330
343
|
uuid: () => uuid,
|
|
344
|
+
validPostPurchaseDiscount: () => validPostPurchaseDiscount,
|
|
331
345
|
variableEffects: () => variableEffects,
|
|
332
346
|
variableTypes: () => variableTypes,
|
|
333
347
|
variantAvailable: () => variantAvailable,
|
|
@@ -1594,161 +1608,60 @@ var OfferProduct = import_zod5.z.object({
|
|
|
1594
1608
|
variants: import_zod5.z.array(OfferProductVariant).min(1)
|
|
1595
1609
|
});
|
|
1596
1610
|
|
|
1597
|
-
// src/schema/
|
|
1598
|
-
var
|
|
1599
|
-
var PostPurchaseSkipReasonSchema = import_zod6.z.enum(["empty", "no-eligible-subscription"]);
|
|
1600
|
-
|
|
1601
|
-
// src/schema/postPurchaseExitPolicy.ts
|
|
1602
|
-
var import_zod7 = require("zod");
|
|
1603
|
-
var EXIT_DELAY_MAX_MS = 60 * 60 * 1e3;
|
|
1604
|
-
var ExitPolicySchema = import_zod7.z.discriminatedUnion("status", [
|
|
1605
|
-
import_zod7.z.strictObject({ status: import_zod7.z.literal("unavailable") }),
|
|
1606
|
-
import_zod7.z.strictObject({
|
|
1607
|
-
delayMs: import_zod7.z.number().int().nonnegative().max(EXIT_DELAY_MAX_MS),
|
|
1608
|
-
source: import_zod7.z.enum(["admitted", "selected-flow"]),
|
|
1609
|
-
status: import_zod7.z.literal("available")
|
|
1610
|
-
})
|
|
1611
|
-
]);
|
|
1611
|
+
// src/schema/postPurchaseChoice.ts
|
|
1612
|
+
var import_zod16 = require("zod");
|
|
1612
1613
|
|
|
1613
|
-
// src/schema/
|
|
1614
|
+
// src/schema/postPurchasePlanCatalog.ts
|
|
1614
1615
|
var import_zod8 = require("zod");
|
|
1615
|
-
var POST_PURCHASE_ID_MAX = 128;
|
|
1616
|
-
var PostPurchaseTimestampSchema = import_zod8.z.number().int().nonnegative();
|
|
1617
|
-
var PostPurchaseOrderIdSchema = import_zod8.z.string().regex(/^gid:\/\/shopify\/Order\/[1-9]\d*$/);
|
|
1618
|
-
var ShopifyDomainSchema = import_zod8.z.string().max(POST_PURCHASE_ID_MAX).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?\.myshopify\.com$/);
|
|
1619
|
-
var DecideRequestSchema = import_zod8.z.object({
|
|
1620
|
-
checkoutToken: import_zod8.z.string().min(1).max(POST_PURCHASE_ID_MAX),
|
|
1621
|
-
shop: ShopifyDomainSchema
|
|
1622
|
-
});
|
|
1623
|
-
var PostPurchaseAppIdSchema = import_zod8.z.string().min(1).max(POST_PURCHASE_ID_MAX);
|
|
1624
|
-
var DecisionEntrySchema = import_zod8.z.object({
|
|
1625
|
-
blockId: import_zod8.z.number().int().positive(),
|
|
1626
|
-
blockIndex: import_zod8.z.string(),
|
|
1627
|
-
blockParentIndex: import_zod8.z.string(),
|
|
1628
|
-
flowId: import_zod8.z.number().int().positive(),
|
|
1629
|
-
sectionId: import_zod8.z.number().int().positive(),
|
|
1630
|
-
widgetId: import_zod8.z.number().int().positive(),
|
|
1631
|
-
widgetTraffic: import_zod8.z.number().min(0).max(100)
|
|
1632
|
-
});
|
|
1633
|
-
|
|
1634
|
-
// src/schema/postPurchaseOrderDecision.ts
|
|
1635
|
-
var import_zod9 = require("zod");
|
|
1636
|
-
var OrderDecisionSchema = import_zod9.z.discriminatedUnion("owner", [
|
|
1637
|
-
import_zod9.z.object({ owner: import_zod9.z.literal("session"), sessionId: import_zod9.z.string().regex(/^[a-f0-9]{64}$/) }),
|
|
1638
|
-
import_zod9.z.object({ owner: import_zod9.z.literal("release"), sessionId: import_zod9.z.null() })
|
|
1639
|
-
]);
|
|
1640
|
-
|
|
1641
|
-
// src/schema/postPurchasePolicy.ts
|
|
1642
|
-
var import_zod10 = require("zod");
|
|
1643
|
-
var HoldSettingSchema = import_zod10.z.discriminatedUnion("enabled", [
|
|
1644
|
-
import_zod10.z.object({ durationMinutes: import_zod10.z.number().int().min(1).max(60), enabled: import_zod10.z.literal(true) }),
|
|
1645
|
-
import_zod10.z.object({ durationMinutes: import_zod10.z.null(), enabled: import_zod10.z.literal(false) })
|
|
1646
|
-
]);
|
|
1647
|
-
var TimingSettingsSchema = import_zod10.z.object({ flowHold: HoldSettingSchema, shopHold: HoldSettingSchema });
|
|
1648
|
-
var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
1649
|
-
durationMinutes: import_zod10.z.number().int().min(1).max(60).nullable(),
|
|
1650
|
-
source: import_zod10.z.enum(["shop", "flow", "native"])
|
|
1651
|
-
}).refine(
|
|
1652
|
-
(policy) => {
|
|
1653
|
-
const expectedSource = policy.shopHold.enabled ? "shop" : policy.flowHold.enabled ? "flow" : "native";
|
|
1654
|
-
const expectedDuration = expectedSource === "shop" ? policy.shopHold.durationMinutes : expectedSource === "flow" ? policy.flowHold.durationMinutes : null;
|
|
1655
|
-
return policy.source === expectedSource && policy.durationMinutes === expectedDuration;
|
|
1656
|
-
},
|
|
1657
|
-
{
|
|
1658
|
-
message: "source and durationMinutes must reflect the shop-over-flow-over-native precedence",
|
|
1659
|
-
path: ["source"]
|
|
1660
|
-
}
|
|
1661
|
-
);
|
|
1662
1616
|
|
|
1663
|
-
// src/schema/
|
|
1664
|
-
var
|
|
1617
|
+
// src/schema/postPurchasePlanAdjustment.ts
|
|
1618
|
+
var import_zod7 = require("zod");
|
|
1665
1619
|
|
|
1666
|
-
// src/schema/
|
|
1667
|
-
var
|
|
1668
|
-
var
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
description: OfferProduct.shape.description.nullable(),
|
|
1673
|
-
id: PostPurchaseProductId
|
|
1674
|
-
});
|
|
1675
|
-
var SourceVariant = OfferProduct.shape.variants.element.pick({ id: true, title: true }).extend({
|
|
1676
|
-
compareAtPrice: PostPurchaseAmount.nullable(),
|
|
1677
|
-
id: PostPurchaseVariantId,
|
|
1678
|
-
imageId: import_zod11.z.number().int().nonnegative().nullish(),
|
|
1679
|
-
inventoryManagement: import_zod11.z.string().nullable(),
|
|
1680
|
-
inventoryPolicy: import_zod11.z.string(),
|
|
1681
|
-
inventoryQuantity: import_zod11.z.number(),
|
|
1682
|
-
option1: import_zod11.z.unknown().optional(),
|
|
1683
|
-
option2: import_zod11.z.unknown().optional(),
|
|
1684
|
-
option3: import_zod11.z.unknown().optional(),
|
|
1685
|
-
price: PostPurchaseAmount,
|
|
1686
|
-
productId: PostPurchaseProductId,
|
|
1687
|
-
sellingPlanAllocations: import_zod11.z.unknown().optional()
|
|
1688
|
-
});
|
|
1689
|
-
var Product2 = ProductBase.extend({
|
|
1690
|
-
images: import_zod11.z.array(
|
|
1691
|
-
import_zod11.z.object({ alt: import_zod11.z.string().optional().catch(void 0), id: import_zod11.z.number().int().positive(), src: import_zod11.z.string() })
|
|
1692
|
-
).nullish(),
|
|
1693
|
-
metadata: import_zod11.z.object({
|
|
1694
|
-
productQuantity: import_zod11.z.union([
|
|
1695
|
-
import_zod11.z.number().int().positive(),
|
|
1696
|
-
import_zod11.z.string().regex(/^[1-9]\d*$/).transform(Number)
|
|
1697
|
-
]).optional()
|
|
1698
|
-
}).optional(),
|
|
1699
|
-
metafields: import_zod11.z.unknown().optional(),
|
|
1700
|
-
options: import_zod11.z.unknown().optional(),
|
|
1701
|
-
productGroupVariants: import_zod11.z.array(import_zod11.z.unknown()).default([]),
|
|
1702
|
-
selectedVariant: import_zod11.z.unknown().optional(),
|
|
1703
|
-
sellingPlanGroups: import_zod11.z.array(
|
|
1704
|
-
OfferProduct.shape.sellingPlanGroups.unwrap().element.extend({
|
|
1705
|
-
discountAmount: import_zod11.z.unknown().optional(),
|
|
1706
|
-
discountType: import_zod11.z.unknown().optional(),
|
|
1707
|
-
id: import_zod11.z.unknown().optional(),
|
|
1708
|
-
sellingPlans: import_zod11.z.unknown().optional()
|
|
1709
|
-
})
|
|
1710
|
-
).optional(),
|
|
1711
|
-
variants: import_zod11.z.array(SourceVariant)
|
|
1712
|
-
});
|
|
1713
|
-
var PostPurchaseProductSource = import_zod11.z.object({
|
|
1714
|
-
data: import_zod11.z.array(Product2),
|
|
1715
|
-
metadata: import_zod11.z.object({ widget: import_zod11.z.record(import_zod11.z.string(), import_zod11.z.unknown()).default({}) }).default({ widget: {} })
|
|
1620
|
+
// src/schema/postPurchaseDiscount.ts
|
|
1621
|
+
var import_zod6 = require("zod");
|
|
1622
|
+
var Discount = import_zod6.z.object({
|
|
1623
|
+
amount: import_zod6.z.number().nonnegative(),
|
|
1624
|
+
title: import_zod6.z.string(),
|
|
1625
|
+
type: import_zod6.z.enum(["none", "fixed_amount", "percentage"])
|
|
1716
1626
|
});
|
|
1627
|
+
var validPostPurchaseDiscount = (discount) => discount.type !== "percentage" || discount.amount <= 100;
|
|
1628
|
+
var PostPurchaseDiscount = Discount.refine(validPostPurchaseDiscount);
|
|
1717
1629
|
|
|
1718
|
-
// src/schema/
|
|
1719
|
-
var
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1630
|
+
// src/schema/postPurchasePlanAdjustment.ts
|
|
1631
|
+
var PostPurchasePlanAdjustment = import_zod7.z.object({
|
|
1632
|
+
amount: PostPurchaseDiscount.shape.amount,
|
|
1633
|
+
type: import_zod7.z.enum(["percentage", "fixed_amount", "price"])
|
|
1634
|
+
}).refine(({ amount: amount2, type }) => type === "price" || validPostPurchaseDiscount({ amount: amount2, type }));
|
|
1723
1635
|
|
|
1724
|
-
// src/schema/
|
|
1725
|
-
var
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
),
|
|
1735
|
-
|
|
1636
|
+
// src/schema/postPurchasePlanCatalog.ts
|
|
1637
|
+
var PostPurchasePlanOption = import_zod8.z.object({
|
|
1638
|
+
adjustment: PostPurchasePlanAdjustment.optional(),
|
|
1639
|
+
id: import_zod8.z.number().int().positive(),
|
|
1640
|
+
intervalFrequency: import_zod8.z.string().regex(/^[1-9]\d*$/).optional(),
|
|
1641
|
+
intervalLabel: import_zod8.z.string().min(1),
|
|
1642
|
+
name: import_zod8.z.string().min(1)
|
|
1643
|
+
});
|
|
1644
|
+
var PostPurchasePlanCatalog = import_zod8.z.object({
|
|
1645
|
+
plans: import_zod8.z.array(PostPurchasePlanOption),
|
|
1646
|
+
productId: import_zod8.z.number().int().positive(),
|
|
1647
|
+
requiresSellingPlan: import_zod8.z.boolean(),
|
|
1648
|
+
variantId: import_zod8.z.number().int().positive()
|
|
1736
1649
|
});
|
|
1737
1650
|
|
|
1738
1651
|
// src/schema/widgets/post-purchase-offer/postPurchaseSettings.ts
|
|
1739
|
-
var
|
|
1652
|
+
var import_zod15 = require("zod");
|
|
1740
1653
|
|
|
1741
1654
|
// src/schema/widgets/post-purchase-offer/common.ts
|
|
1742
1655
|
var import_compat = require("es-toolkit/compat");
|
|
1743
|
-
var
|
|
1744
|
-
var strictNumber =
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1656
|
+
var import_zod9 = require("zod");
|
|
1657
|
+
var strictNumber = import_zod9.z.union([
|
|
1658
|
+
import_zod9.z.number(),
|
|
1659
|
+
import_zod9.z.string().transform((value) => (0, import_compat.toNumber)((0, import_compat.replace)((0, import_compat.toString)(value), /[^0-9.]/g, "")) || 0),
|
|
1660
|
+
import_zod9.z.unknown().transform(() => 0)
|
|
1748
1661
|
]);
|
|
1749
1662
|
|
|
1750
1663
|
// src/schema/widgets/post-purchase-offer/constants.ts
|
|
1751
|
-
var
|
|
1664
|
+
var import_zod10 = require("zod");
|
|
1752
1665
|
var blockTypes = [
|
|
1753
1666
|
"callout_banner",
|
|
1754
1667
|
"image",
|
|
@@ -1759,18 +1672,18 @@ var blockTypes = [
|
|
|
1759
1672
|
"text",
|
|
1760
1673
|
"timer"
|
|
1761
1674
|
];
|
|
1762
|
-
var blockType =
|
|
1675
|
+
var blockType = import_zod10.z.enum(blockTypes);
|
|
1763
1676
|
var BlockType = blockType.enum;
|
|
1764
1677
|
|
|
1765
1678
|
// src/schema/widgets/post-purchase-offer/postPurchaseBlocks.ts
|
|
1766
1679
|
var import_compat4 = require("es-toolkit/compat");
|
|
1767
1680
|
var import_uuid3 = require("uuid");
|
|
1768
|
-
var
|
|
1681
|
+
var import_zod14 = require("zod");
|
|
1769
1682
|
|
|
1770
1683
|
// src/schema/widgets/checkout-and-beyond/text.ts
|
|
1771
1684
|
var import_compat3 = require("es-toolkit/compat");
|
|
1772
1685
|
var import_uuid2 = require("uuid");
|
|
1773
|
-
var
|
|
1686
|
+
var import_zod13 = require("zod");
|
|
1774
1687
|
|
|
1775
1688
|
// src/schema/widgets/checkout-and-beyond/common.ts
|
|
1776
1689
|
var freezeEnum = (values2) => Object.freeze(Object.fromEntries(values2.map((v) => [v, v])));
|
|
@@ -2054,10 +1967,10 @@ var isTextType = isSectionType(SectionType.text);
|
|
|
2054
1967
|
var isVariantsType = isSectionType(SectionType.variants);
|
|
2055
1968
|
|
|
2056
1969
|
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
2057
|
-
var
|
|
1970
|
+
var import_zod12 = require("zod");
|
|
2058
1971
|
|
|
2059
1972
|
// src/schema/widgets/checkout-and-beyond/rule.ts
|
|
2060
|
-
var
|
|
1973
|
+
var import_zod11 = require("zod");
|
|
2061
1974
|
var ruleTypes = [
|
|
2062
1975
|
"cart",
|
|
2063
1976
|
"cart_count",
|
|
@@ -2076,7 +1989,7 @@ var ruleTypes = [
|
|
|
2076
1989
|
"product_type",
|
|
2077
1990
|
"product_vendor"
|
|
2078
1991
|
];
|
|
2079
|
-
var ruleType =
|
|
1992
|
+
var ruleType = import_zod11.z.enum(ruleTypes);
|
|
2080
1993
|
var RuleType = ruleType.enum;
|
|
2081
1994
|
var ruleOperators = [
|
|
2082
1995
|
"after",
|
|
@@ -2091,177 +2004,177 @@ var ruleOperators = [
|
|
|
2091
2004
|
"greater_than",
|
|
2092
2005
|
"less_than"
|
|
2093
2006
|
];
|
|
2094
|
-
var ruleOperator =
|
|
2007
|
+
var ruleOperator = import_zod11.z.enum(ruleOperators);
|
|
2095
2008
|
var RuleOperator = ruleOperator.enum;
|
|
2096
|
-
var RuleCondition =
|
|
2097
|
-
operator:
|
|
2098
|
-
products:
|
|
2099
|
-
type:
|
|
2100
|
-
value:
|
|
2101
|
-
});
|
|
2102
|
-
var RuleLogicBlock =
|
|
2103
|
-
rules:
|
|
2104
|
-
});
|
|
2105
|
-
var CABRulesetEntry =
|
|
2106
|
-
exitIfMatched:
|
|
2107
|
-
logic:
|
|
2108
|
-
output:
|
|
2109
|
-
|
|
2110
|
-
key:
|
|
2111
|
-
type:
|
|
2112
|
-
value:
|
|
2009
|
+
var RuleCondition = import_zod11.z.object({
|
|
2010
|
+
operator: import_zod11.z.enum(ruleOperators).default(RuleOperator.anything),
|
|
2011
|
+
products: import_zod11.z.union([import_zod11.z.array(import_zod11.z.unknown()), import_zod11.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
2012
|
+
type: import_zod11.z.enum(ruleTypes).default(RuleType.cart_subtotal),
|
|
2013
|
+
value: import_zod11.z.coerce.string().default("")
|
|
2014
|
+
});
|
|
2015
|
+
var RuleLogicBlock = import_zod11.z.object({
|
|
2016
|
+
rules: import_zod11.z.array(RuleCondition).default(() => [])
|
|
2017
|
+
});
|
|
2018
|
+
var CABRulesetEntry = import_zod11.z.object({
|
|
2019
|
+
exitIfMatched: import_zod11.z.boolean().default(true),
|
|
2020
|
+
logic: import_zod11.z.array(RuleLogicBlock).default(() => []),
|
|
2021
|
+
output: import_zod11.z.array(
|
|
2022
|
+
import_zod11.z.object({
|
|
2023
|
+
key: import_zod11.z.string().default("should_show"),
|
|
2024
|
+
type: import_zod11.z.literal("data_json").default("data_json"),
|
|
2025
|
+
value: import_zod11.z.string().default("true")
|
|
2113
2026
|
})
|
|
2114
2027
|
).default(() => [{ key: "should_show", type: "data_json", value: "true" }])
|
|
2115
2028
|
});
|
|
2116
|
-
var CABRuleset =
|
|
2029
|
+
var CABRuleset = import_zod11.z.union([import_zod11.z.array(CABRulesetEntry), import_zod11.z.strictObject({}).transform(() => [])]).default(() => []);
|
|
2117
2030
|
|
|
2118
2031
|
// src/schema/widgets/checkout-and-beyond/variables.ts
|
|
2119
|
-
var variableEffect =
|
|
2120
|
-
var CABVariableSeed =
|
|
2121
|
-
dataSourceId:
|
|
2032
|
+
var variableEffect = import_zod12.z.enum(variableEffects);
|
|
2033
|
+
var CABVariableSeed = import_zod12.z.object({
|
|
2034
|
+
dataSourceId: import_zod12.z.number().nullable().default(null),
|
|
2122
2035
|
ruleset: CABRuleset
|
|
2123
2036
|
});
|
|
2124
|
-
var CABBooleanVariable =
|
|
2037
|
+
var CABBooleanVariable = import_zod12.z.object({
|
|
2125
2038
|
/**
|
|
2126
2039
|
* Holds until the first seed verdict lands (and forever, for unseeded variables). Omitted, it derives
|
|
2127
2040
|
* from seededness — `false` with a `seed` (visibility is EARNED), `true` without — via the transform
|
|
2128
2041
|
* below; a cross-field default has no `.default()` spelling. An explicit value always wins.
|
|
2129
2042
|
*/
|
|
2130
|
-
defaultValue:
|
|
2131
|
-
name:
|
|
2043
|
+
defaultValue: import_zod12.z.boolean().optional(),
|
|
2044
|
+
name: import_zod12.z.string().min(1),
|
|
2132
2045
|
seed: CABVariableSeed.optional(),
|
|
2133
2046
|
/** Defaulted so every stored declaration (all boolean before `text` existed) parses unchanged. */
|
|
2134
|
-
type:
|
|
2047
|
+
type: import_zod12.z.literal(VariableType.boolean).default(VariableType.boolean)
|
|
2135
2048
|
});
|
|
2136
|
-
var CABTextVariable =
|
|
2137
|
-
defaultValue:
|
|
2138
|
-
name:
|
|
2139
|
-
seed:
|
|
2140
|
-
type:
|
|
2049
|
+
var CABTextVariable = import_zod12.z.object({
|
|
2050
|
+
defaultValue: import_zod12.z.string(),
|
|
2051
|
+
name: import_zod12.z.string().min(1),
|
|
2052
|
+
seed: import_zod12.z.never().optional(),
|
|
2053
|
+
type: import_zod12.z.literal(VariableType.text)
|
|
2141
2054
|
});
|
|
2142
|
-
var CABNumberVariable =
|
|
2143
|
-
defaultValue:
|
|
2144
|
-
name:
|
|
2145
|
-
seed:
|
|
2146
|
-
type:
|
|
2055
|
+
var CABNumberVariable = import_zod12.z.object({
|
|
2056
|
+
defaultValue: import_zod12.z.number(),
|
|
2057
|
+
name: import_zod12.z.string().min(1),
|
|
2058
|
+
seed: import_zod12.z.never().optional(),
|
|
2059
|
+
type: import_zod12.z.literal(VariableType.number)
|
|
2147
2060
|
});
|
|
2148
|
-
var CABVariable =
|
|
2061
|
+
var CABVariable = import_zod12.z.union([CABTextVariable, CABNumberVariable, CABBooleanVariable]).transform(
|
|
2149
2062
|
(variable) => variable.type === VariableType.boolean ? { ...variable, defaultValue: variable.defaultValue ?? variable.seed === void 0 } : variable
|
|
2150
2063
|
);
|
|
2151
|
-
var CABVariableEffect =
|
|
2064
|
+
var CABVariableEffect = import_zod12.z.object({
|
|
2152
2065
|
effect: variableEffect.default(VariableEffect.toggle),
|
|
2153
|
-
variable:
|
|
2066
|
+
variable: import_zod12.z.string().min(1)
|
|
2154
2067
|
});
|
|
2155
|
-
var CABVisibility =
|
|
2156
|
-
variable:
|
|
2157
|
-
visibleWhen:
|
|
2068
|
+
var CABVisibility = import_zod12.z.object({
|
|
2069
|
+
variable: import_zod12.z.string().min(1),
|
|
2070
|
+
visibleWhen: import_zod12.z.boolean().default(true)
|
|
2158
2071
|
});
|
|
2159
|
-
var contentOperator =
|
|
2160
|
-
var resultCountOperator =
|
|
2161
|
-
var resultTagOperator =
|
|
2162
|
-
var mutatorEvent =
|
|
2163
|
-
var CABContentTrigger =
|
|
2072
|
+
var contentOperator = import_zod12.z.enum(contentOperators);
|
|
2073
|
+
var resultCountOperator = import_zod12.z.enum(resultCountOperators);
|
|
2074
|
+
var resultTagOperator = import_zod12.z.enum(resultTagOperators);
|
|
2075
|
+
var mutatorEvent = import_zod12.z.enum(mutatorEvents);
|
|
2076
|
+
var CABContentTrigger = import_zod12.z.object({
|
|
2164
2077
|
operator: contentOperator.default(ContentOperator.is_empty),
|
|
2165
|
-
type:
|
|
2078
|
+
type: import_zod12.z.literal("content")
|
|
2166
2079
|
});
|
|
2167
|
-
var CABResultCountTrigger =
|
|
2080
|
+
var CABResultCountTrigger = import_zod12.z.object({
|
|
2168
2081
|
operator: resultCountOperator.default(ResultCountOperator.equals),
|
|
2169
|
-
type:
|
|
2170
|
-
value:
|
|
2082
|
+
type: import_zod12.z.literal("result_count"),
|
|
2083
|
+
value: import_zod12.z.number().default(0)
|
|
2171
2084
|
});
|
|
2172
|
-
var CABResultTagTrigger =
|
|
2085
|
+
var CABResultTagTrigger = import_zod12.z.object({
|
|
2173
2086
|
operator: resultTagOperator.default(ResultTagOperator.contains),
|
|
2174
|
-
type:
|
|
2175
|
-
value:
|
|
2087
|
+
type: import_zod12.z.literal("result_tag"),
|
|
2088
|
+
value: import_zod12.z.string().min(1)
|
|
2176
2089
|
});
|
|
2177
|
-
var CABEventTrigger =
|
|
2090
|
+
var CABEventTrigger = import_zod12.z.object({
|
|
2178
2091
|
event: mutatorEvent,
|
|
2179
|
-
type:
|
|
2092
|
+
type: import_zod12.z.literal("event")
|
|
2180
2093
|
});
|
|
2181
|
-
var CABVariableTrigger =
|
|
2094
|
+
var CABVariableTrigger = import_zod12.z.discriminatedUnion("type", [
|
|
2182
2095
|
CABContentTrigger,
|
|
2183
2096
|
CABEventTrigger,
|
|
2184
2097
|
CABResultCountTrigger,
|
|
2185
2098
|
CABResultTagTrigger
|
|
2186
2099
|
]);
|
|
2187
|
-
var CABVariableMutator =
|
|
2100
|
+
var CABVariableMutator = import_zod12.z.object({
|
|
2188
2101
|
effect: variableEffect.default(VariableEffect.set_false),
|
|
2189
|
-
variable:
|
|
2102
|
+
variable: import_zod12.z.string().min(1),
|
|
2190
2103
|
when: CABVariableTrigger
|
|
2191
2104
|
});
|
|
2192
2105
|
var CABVariableFields = {
|
|
2193
|
-
mutators:
|
|
2194
|
-
variables:
|
|
2106
|
+
mutators: import_zod12.z.array(CABVariableMutator).optional(),
|
|
2107
|
+
variables: import_zod12.z.array(CABVariable).refine((variables) => new Set(variables.map(({ name }) => name)).size === variables.length, {
|
|
2195
2108
|
message: "variable names must be unique within a section"
|
|
2196
2109
|
}).optional(),
|
|
2197
2110
|
visibility: CABVisibility.optional()
|
|
2198
2111
|
};
|
|
2199
2112
|
|
|
2200
2113
|
// src/schema/widgets/checkout-and-beyond/text.ts
|
|
2201
|
-
var enumOrOmit = (...vals) =>
|
|
2202
|
-
var TiptapText =
|
|
2203
|
-
marks:
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
attrs:
|
|
2210
|
-
class:
|
|
2211
|
-
href:
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2114
|
+
var enumOrOmit = (...vals) => import_zod13.z.string().transform((val) => vals.includes(val) ? val : void 0).optional();
|
|
2115
|
+
var TiptapText = import_zod13.z.object({
|
|
2116
|
+
marks: import_zod13.z.union([
|
|
2117
|
+
import_zod13.z.array(
|
|
2118
|
+
import_zod13.z.discriminatedUnion("type", [
|
|
2119
|
+
import_zod13.z.object({ type: import_zod13.z.literal("bold") }),
|
|
2120
|
+
import_zod13.z.object({ type: import_zod13.z.literal("italic") }),
|
|
2121
|
+
import_zod13.z.object({
|
|
2122
|
+
attrs: import_zod13.z.object({
|
|
2123
|
+
class: import_zod13.z.string().nullable(),
|
|
2124
|
+
href: import_zod13.z.union([
|
|
2125
|
+
import_zod13.z.url(),
|
|
2126
|
+
import_zod13.z.literal("#"),
|
|
2127
|
+
import_zod13.z.string().regex(DYNAMIC_TOKEN_REGEX),
|
|
2128
|
+
import_zod13.z.string().regex(ROOT_RELATIVE_PATH_REGEX)
|
|
2216
2129
|
]),
|
|
2217
|
-
rel:
|
|
2218
|
-
target:
|
|
2130
|
+
rel: import_zod13.z.string().default("noopener noreferrer nofollow"),
|
|
2131
|
+
target: import_zod13.z.string().default("_blank")
|
|
2219
2132
|
}),
|
|
2220
|
-
type:
|
|
2133
|
+
type: import_zod13.z.literal("link")
|
|
2221
2134
|
}),
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
attrs:
|
|
2135
|
+
import_zod13.z.object({ type: import_zod13.z.literal("strike") }),
|
|
2136
|
+
import_zod13.z.object({
|
|
2137
|
+
attrs: import_zod13.z.object({
|
|
2225
2138
|
color: enumOrOmit(...textColorNames).default(TextColorName.base),
|
|
2226
2139
|
fontSize: enumOrOmit(...textSizeNames).default(TextSizeName.base)
|
|
2227
2140
|
}),
|
|
2228
|
-
type:
|
|
2141
|
+
type: import_zod13.z.literal("textStyle")
|
|
2229
2142
|
})
|
|
2230
2143
|
])
|
|
2231
2144
|
),
|
|
2232
|
-
|
|
2145
|
+
import_zod13.z.strictObject({}).transform(() => [])
|
|
2233
2146
|
]).optional(),
|
|
2234
|
-
text:
|
|
2235
|
-
type:
|
|
2147
|
+
text: import_zod13.z.string().default(""),
|
|
2148
|
+
type: import_zod13.z.literal("text").default("text")
|
|
2236
2149
|
});
|
|
2237
|
-
var TiptapParagraph =
|
|
2238
|
-
attrs:
|
|
2150
|
+
var TiptapParagraph = import_zod13.z.object({
|
|
2151
|
+
attrs: import_zod13.z.object({
|
|
2239
2152
|
textAlign: enumOrOmit(...textAlignments)
|
|
2240
2153
|
}).default({ textAlign: TextAlignment.start }),
|
|
2241
|
-
content:
|
|
2242
|
-
type:
|
|
2154
|
+
content: import_zod13.z.union([import_zod13.z.array(TiptapText), import_zod13.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
2155
|
+
type: import_zod13.z.literal("paragraph").default("paragraph")
|
|
2243
2156
|
});
|
|
2244
|
-
var TiptapDocument =
|
|
2245
|
-
attrs:
|
|
2157
|
+
var TiptapDocument = import_zod13.z.object({
|
|
2158
|
+
attrs: import_zod13.z.object({
|
|
2246
2159
|
blockSpacing: enumOrOmit(...spacings)
|
|
2247
2160
|
}).default({ blockSpacing: Spacing.base }),
|
|
2248
|
-
content:
|
|
2249
|
-
type:
|
|
2161
|
+
content: import_zod13.z.union([import_zod13.z.array(TiptapParagraph), import_zod13.z.strictObject({}).transform(() => [])]).default(() => [TiptapParagraph.parse({})]),
|
|
2162
|
+
type: import_zod13.z.literal("doc").default("doc")
|
|
2250
2163
|
});
|
|
2251
|
-
var CABTextTier =
|
|
2252
|
-
threshold:
|
|
2253
|
-
thresholds:
|
|
2254
|
-
tierId:
|
|
2255
|
-
tierType:
|
|
2164
|
+
var CABTextTier = import_zod13.z.object({
|
|
2165
|
+
threshold: import_zod13.z.number().int().nonnegative(),
|
|
2166
|
+
thresholds: import_zod13.z.record(import_zod13.z.string(), import_zod13.z.number().int().nonnegative()).default(() => ({})),
|
|
2167
|
+
tierId: import_zod13.z.string().optional(),
|
|
2168
|
+
tierType: import_zod13.z.enum(progressTierTypes).default(ProgressTierType.shipping)
|
|
2256
2169
|
});
|
|
2257
|
-
var CABTextSection =
|
|
2170
|
+
var CABTextSection = import_zod13.z.object({
|
|
2258
2171
|
...CABVariableFields,
|
|
2259
|
-
buttonField:
|
|
2260
|
-
content:
|
|
2261
|
-
name:
|
|
2262
|
-
optionId:
|
|
2263
|
-
sectionId:
|
|
2264
|
-
sectionType:
|
|
2172
|
+
buttonField: import_zod13.z.enum(buttonFields).optional(),
|
|
2173
|
+
content: import_zod13.z.record(import_zod13.z.string(), import_zod13.z.union([import_zod13.z.string(), TiptapDocument]).refine(checkForHTML, NO_HTML).optional()).default({ en: TiptapDocument.parse({}) }).optional(),
|
|
2174
|
+
name: import_zod13.z.string().optional(),
|
|
2175
|
+
optionId: import_zod13.z.number().optional(),
|
|
2176
|
+
sectionId: import_zod13.z.uuid().default(() => (0, import_uuid2.v7)()),
|
|
2177
|
+
sectionType: import_zod13.z.literal(SectionType.text).default(SectionType.text),
|
|
2265
2178
|
tier: CABTextTier.optional()
|
|
2266
2179
|
}).superRefine(({ buttonField, content }, ctx) => {
|
|
2267
2180
|
if (buttonField === ButtonField.destinationUrl && content) {
|
|
@@ -2283,137 +2196,137 @@ var CABTextSection = import_zod18.z.object({
|
|
|
2283
2196
|
});
|
|
2284
2197
|
|
|
2285
2198
|
// src/schema/widgets/post-purchase-offer/postPurchaseBlocks.ts
|
|
2286
|
-
var TextAlignment2 =
|
|
2287
|
-
var TextSize =
|
|
2288
|
-
|
|
2289
|
-
|
|
2199
|
+
var TextAlignment2 = import_zod14.z.union([import_zod14.z.enum(["leading", "center", "trailing"]), import_zod14.z.unknown().transform(() => "leading")]);
|
|
2200
|
+
var TextSize = import_zod14.z.union([
|
|
2201
|
+
import_zod14.z.enum(["xsmall", "small", "base", "default", "medium", "large", "xlarge"]),
|
|
2202
|
+
import_zod14.z.unknown().transform(() => "medium")
|
|
2290
2203
|
]);
|
|
2291
|
-
var CalloutBannerBlock =
|
|
2292
|
-
id:
|
|
2293
|
-
name:
|
|
2294
|
-
settings:
|
|
2295
|
-
superTitle:
|
|
2296
|
-
title:
|
|
2204
|
+
var CalloutBannerBlock = import_zod14.z.object({
|
|
2205
|
+
id: import_zod14.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2206
|
+
name: import_zod14.z.string().optional(),
|
|
2207
|
+
settings: import_zod14.z.object({
|
|
2208
|
+
superTitle: import_zod14.z.union([import_zod14.z.string(), TiptapDocument]).default(() => "Limited-time Offer"),
|
|
2209
|
+
title: import_zod14.z.union([import_zod14.z.string(), TiptapDocument]).default(() => "Add this customer favorite to your order")
|
|
2297
2210
|
}),
|
|
2298
|
-
styles:
|
|
2299
|
-
superTitleEmphasized:
|
|
2211
|
+
styles: import_zod14.z.object({
|
|
2212
|
+
superTitleEmphasized: import_zod14.z.boolean().default(false),
|
|
2300
2213
|
superTitleSize: TextSize.default("large"),
|
|
2301
2214
|
textAlignment: TextAlignment2.default("center"),
|
|
2302
|
-
titleEmphasized:
|
|
2215
|
+
titleEmphasized: import_zod14.z.boolean().default(true),
|
|
2303
2216
|
titleSize: TextSize.default("large")
|
|
2304
2217
|
}),
|
|
2305
|
-
type:
|
|
2218
|
+
type: import_zod14.z.literal(BlockType.callout_banner).default(BlockType.callout_banner)
|
|
2306
2219
|
});
|
|
2307
|
-
var ImageBlock =
|
|
2308
|
-
id:
|
|
2309
|
-
name:
|
|
2310
|
-
settings:
|
|
2311
|
-
|
|
2220
|
+
var ImageBlock = import_zod14.z.object({
|
|
2221
|
+
id: import_zod14.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2222
|
+
name: import_zod14.z.string().optional(),
|
|
2223
|
+
settings: import_zod14.z.union([
|
|
2224
|
+
import_zod14.z.object({
|
|
2312
2225
|
/** This isn't used in the post-purchase offer widget */
|
|
2313
|
-
alt:
|
|
2314
|
-
image:
|
|
2315
|
-
imageSize:
|
|
2316
|
-
imageType:
|
|
2226
|
+
alt: import_zod14.z.string().optional().default(""),
|
|
2227
|
+
image: import_zod14.z.union([import_zod14.z.literal(""), import_zod14.z.url()]).default(""),
|
|
2228
|
+
imageSize: import_zod14.z.number().default(20),
|
|
2229
|
+
imageType: import_zod14.z.enum(["URL", "UPLOAD"]).default("URL")
|
|
2317
2230
|
}),
|
|
2318
|
-
|
|
2231
|
+
import_zod14.z.array(import_zod14.z.never()).transform(() => ({}))
|
|
2319
2232
|
]),
|
|
2320
|
-
type:
|
|
2321
|
-
});
|
|
2322
|
-
var ImageContentBlock =
|
|
2323
|
-
id:
|
|
2324
|
-
name:
|
|
2325
|
-
settings:
|
|
2326
|
-
alt:
|
|
2327
|
-
description:
|
|
2233
|
+
type: import_zod14.z.literal(BlockType.image).default(BlockType.image)
|
|
2234
|
+
});
|
|
2235
|
+
var ImageContentBlock = import_zod14.z.object({
|
|
2236
|
+
id: import_zod14.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2237
|
+
name: import_zod14.z.string().optional(),
|
|
2238
|
+
settings: import_zod14.z.object({
|
|
2239
|
+
alt: import_zod14.z.string().optional().default(""),
|
|
2240
|
+
description: import_zod14.z.union([import_zod14.z.string(), TiptapDocument, import_zod14.z.null()]).default(
|
|
2328
2241
|
"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."
|
|
2329
2242
|
),
|
|
2330
2243
|
descriptionSize: TextSize.default("medium"),
|
|
2331
2244
|
horizontalAlignment: TextAlignment2.default("leading"),
|
|
2332
|
-
image:
|
|
2333
|
-
imagePlacement:
|
|
2334
|
-
imageSize:
|
|
2335
|
-
superTitle:
|
|
2245
|
+
image: import_zod14.z.union([import_zod14.z.literal(""), import_zod14.z.url()]).default(""),
|
|
2246
|
+
imagePlacement: import_zod14.z.enum(["bottom", "left", "right", "top"]).optional().default("left"),
|
|
2247
|
+
imageSize: import_zod14.z.number().default(20),
|
|
2248
|
+
superTitle: import_zod14.z.union([import_zod14.z.string(), TiptapDocument]).default("Lorem Ipsum!"),
|
|
2336
2249
|
superTitleSize: TextSize.default("medium"),
|
|
2337
2250
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2338
|
-
swapContent:
|
|
2339
|
-
title:
|
|
2251
|
+
swapContent: import_zod14.z.boolean().optional().default(false),
|
|
2252
|
+
title: import_zod14.z.union([import_zod14.z.string(), TiptapDocument]).nullable().default("Lorem ipsum dolor sit amet"),
|
|
2340
2253
|
titleSize: TextSize.default("medium")
|
|
2341
2254
|
}),
|
|
2342
|
-
type:
|
|
2343
|
-
});
|
|
2344
|
-
var PayButtonBlock =
|
|
2345
|
-
id:
|
|
2346
|
-
name:
|
|
2347
|
-
settings:
|
|
2348
|
-
|
|
2349
|
-
label:
|
|
2255
|
+
type: import_zod14.z.literal(BlockType.image_content).default(BlockType.image_content)
|
|
2256
|
+
});
|
|
2257
|
+
var PayButtonBlock = import_zod14.z.object({
|
|
2258
|
+
id: import_zod14.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2259
|
+
name: import_zod14.z.string().optional(),
|
|
2260
|
+
settings: import_zod14.z.union([
|
|
2261
|
+
import_zod14.z.object({
|
|
2262
|
+
label: import_zod14.z.string().default("Pay Now")
|
|
2350
2263
|
}),
|
|
2351
|
-
|
|
2264
|
+
import_zod14.z.array(import_zod14.z.never()).transform(() => ({
|
|
2352
2265
|
label: "Pay Now"
|
|
2353
2266
|
}))
|
|
2354
2267
|
]),
|
|
2355
|
-
styles:
|
|
2356
|
-
|
|
2357
|
-
buttonWidth:
|
|
2268
|
+
styles: import_zod14.z.union([
|
|
2269
|
+
import_zod14.z.object({
|
|
2270
|
+
buttonWidth: import_zod14.z.number().min(10).max(100).default(50)
|
|
2358
2271
|
}),
|
|
2359
|
-
|
|
2272
|
+
import_zod14.z.array(import_zod14.z.never()).transform(() => ({
|
|
2360
2273
|
buttonWidth: 50
|
|
2361
2274
|
}))
|
|
2362
2275
|
]),
|
|
2363
|
-
type:
|
|
2276
|
+
type: import_zod14.z.literal(BlockType.pay_button).default(BlockType.pay_button)
|
|
2364
2277
|
});
|
|
2365
|
-
var ProductInformationBlock =
|
|
2278
|
+
var ProductInformationBlock = import_zod14.z.object({
|
|
2366
2279
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2367
|
-
hideProductImage:
|
|
2368
|
-
id:
|
|
2369
|
-
name:
|
|
2370
|
-
type:
|
|
2371
|
-
});
|
|
2372
|
-
var SeparatorBlock =
|
|
2373
|
-
id:
|
|
2374
|
-
name:
|
|
2375
|
-
type:
|
|
2376
|
-
});
|
|
2377
|
-
var TextBlock =
|
|
2378
|
-
id:
|
|
2379
|
-
name:
|
|
2380
|
-
settings:
|
|
2381
|
-
description:
|
|
2280
|
+
hideProductImage: import_zod14.z.boolean().optional().default(false),
|
|
2281
|
+
id: import_zod14.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2282
|
+
name: import_zod14.z.string().optional(),
|
|
2283
|
+
type: import_zod14.z.literal(BlockType.product_information).default(BlockType.product_information)
|
|
2284
|
+
});
|
|
2285
|
+
var SeparatorBlock = import_zod14.z.object({
|
|
2286
|
+
id: import_zod14.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2287
|
+
name: import_zod14.z.string().optional(),
|
|
2288
|
+
type: import_zod14.z.literal(BlockType.separator).default(BlockType.separator)
|
|
2289
|
+
});
|
|
2290
|
+
var TextBlock = import_zod14.z.object({
|
|
2291
|
+
id: import_zod14.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2292
|
+
name: import_zod14.z.string().optional(),
|
|
2293
|
+
settings: import_zod14.z.object({
|
|
2294
|
+
description: import_zod14.z.union([import_zod14.z.string(), TiptapDocument]).optional().default(
|
|
2382
2295
|
"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."
|
|
2383
2296
|
),
|
|
2384
2297
|
/** This isn't used in the post-purchase offer widget */
|
|
2385
2298
|
descriptionSize: TextSize.default("medium"),
|
|
2386
2299
|
horizontalAlignment: TextAlignment2.default("leading"),
|
|
2387
|
-
superTitle:
|
|
2300
|
+
superTitle: import_zod14.z.union([import_zod14.z.string(), TiptapDocument]).default("Super Title"),
|
|
2388
2301
|
/** This isn't used in the post-purchase offer widget */
|
|
2389
2302
|
superTitleSize: TextSize.default("medium"),
|
|
2390
|
-
title:
|
|
2303
|
+
title: import_zod14.z.union([import_zod14.z.string(), TiptapDocument]).nullable().default("Lorem ipsum dolor sit amet."),
|
|
2391
2304
|
/** This isn't used in the post-purchase offer widget */
|
|
2392
2305
|
titleSize: TextSize.default("medium")
|
|
2393
2306
|
}),
|
|
2394
|
-
type:
|
|
2395
|
-
});
|
|
2396
|
-
var TimerBlock =
|
|
2397
|
-
id:
|
|
2398
|
-
name:
|
|
2399
|
-
settings:
|
|
2400
|
-
durationMinutes:
|
|
2401
|
-
durationSeconds:
|
|
2402
|
-
endOffer:
|
|
2403
|
-
title:
|
|
2307
|
+
type: import_zod14.z.literal(BlockType.text).default(BlockType.text)
|
|
2308
|
+
});
|
|
2309
|
+
var TimerBlock = import_zod14.z.object({
|
|
2310
|
+
id: import_zod14.z.string().optional().default(() => (0, import_uuid3.v4)()),
|
|
2311
|
+
name: import_zod14.z.string().optional(),
|
|
2312
|
+
settings: import_zod14.z.object({
|
|
2313
|
+
durationMinutes: import_zod14.z.number().min(0).default(10),
|
|
2314
|
+
durationSeconds: import_zod14.z.union([import_zod14.z.number().min(0), import_zod14.z.unknown().transform(() => 0)]).default(0),
|
|
2315
|
+
endOffer: import_zod14.z.boolean().default(true),
|
|
2316
|
+
title: import_zod14.z.union([import_zod14.z.string(), TiptapDocument]).default("Hurry \u2014 your special offer ends in:")
|
|
2404
2317
|
}),
|
|
2405
|
-
styles:
|
|
2318
|
+
styles: import_zod14.z.object({
|
|
2406
2319
|
textAlignment: TextAlignment2.default("center"),
|
|
2407
|
-
timerBackgroundColor:
|
|
2408
|
-
timerEmphasized:
|
|
2320
|
+
timerBackgroundColor: import_zod14.z.enum(["info", "warning", "success", "critical"]).default("warning"),
|
|
2321
|
+
timerEmphasized: import_zod14.z.union([import_zod14.z.boolean(), import_zod14.z.unknown().transform(() => true)]).default(true),
|
|
2409
2322
|
timerSize: TextSize.default("medium"),
|
|
2410
|
-
timerWidth:
|
|
2411
|
-
titleEmphasized:
|
|
2323
|
+
timerWidth: import_zod14.z.number().min(10).max(100).optional().default(100),
|
|
2324
|
+
titleEmphasized: import_zod14.z.union([import_zod14.z.boolean(), import_zod14.z.unknown().transform(() => true)]).default(false),
|
|
2412
2325
|
titleSize: TextSize.default("medium")
|
|
2413
2326
|
}),
|
|
2414
|
-
type:
|
|
2327
|
+
type: import_zod14.z.literal(BlockType.timer).default(BlockType.timer)
|
|
2415
2328
|
});
|
|
2416
|
-
var PostPurchaseBlock =
|
|
2329
|
+
var PostPurchaseBlock = import_zod14.z.discriminatedUnion("type", [
|
|
2417
2330
|
CalloutBannerBlock,
|
|
2418
2331
|
ImageBlock,
|
|
2419
2332
|
ImageContentBlock,
|
|
@@ -2433,61 +2346,61 @@ var isTextBlock = (block) => (0, import_compat4.isEqual)((0, import_compat4.get)
|
|
|
2433
2346
|
var isTimerBlock = (block) => (0, import_compat4.isEqual)((0, import_compat4.get)(block, "type"), BlockType.timer);
|
|
2434
2347
|
|
|
2435
2348
|
// src/schema/widgets/post-purchase-offer/postPurchaseSettings.ts
|
|
2436
|
-
var PostPurchaseSettings =
|
|
2437
|
-
advance:
|
|
2438
|
-
blocks:
|
|
2349
|
+
var PostPurchaseSettings = import_zod15.z.object({
|
|
2350
|
+
advance: import_zod15.z.object({ removePartialOrder: import_zod15.z.boolean().default(true) }).optional().default(() => ({ removePartialOrder: true })),
|
|
2351
|
+
blocks: import_zod15.z.union([import_zod15.z.array(PostPurchaseBlock), import_zod15.z.unknown().transform(() => [])]).default(() => [
|
|
2439
2352
|
PostPurchaseBlock.parse({ settings: {}, styles: {}, type: BlockType.timer }),
|
|
2440
2353
|
PostPurchaseBlock.parse({ settings: {}, styles: {}, type: BlockType.callout_banner }),
|
|
2441
2354
|
PostPurchaseBlock.parse({ type: BlockType.product_information })
|
|
2442
2355
|
]),
|
|
2443
|
-
columnLayout:
|
|
2444
|
-
discount:
|
|
2356
|
+
columnLayout: import_zod15.z.boolean().optional(),
|
|
2357
|
+
discount: import_zod15.z.object({
|
|
2445
2358
|
amount: strictNumber.default(30),
|
|
2446
|
-
shouldShowSavingText:
|
|
2447
|
-
type:
|
|
2359
|
+
shouldShowSavingText: import_zod15.z.boolean().optional().default(true),
|
|
2360
|
+
type: import_zod15.z.enum(["none", "fixed_amount", "percentage"]).default("none")
|
|
2448
2361
|
}),
|
|
2449
|
-
discountedFrom:
|
|
2450
|
-
endpoint:
|
|
2451
|
-
integrations:
|
|
2452
|
-
judgeme:
|
|
2453
|
-
junip:
|
|
2454
|
-
klaviyo:
|
|
2455
|
-
loox:
|
|
2456
|
-
okendo:
|
|
2457
|
-
opinew:
|
|
2458
|
-
reviewsio:
|
|
2459
|
-
stamped:
|
|
2460
|
-
yotpo:
|
|
2362
|
+
discountedFrom: import_zod15.z.enum(["price", "compare_at_price"]).optional().default("price"),
|
|
2363
|
+
endpoint: import_zod15.z.string().optional(),
|
|
2364
|
+
integrations: import_zod15.z.object({
|
|
2365
|
+
judgeme: import_zod15.z.boolean().default(false),
|
|
2366
|
+
junip: import_zod15.z.boolean().optional().default(false),
|
|
2367
|
+
klaviyo: import_zod15.z.boolean().default(false),
|
|
2368
|
+
loox: import_zod15.z.boolean().default(false),
|
|
2369
|
+
okendo: import_zod15.z.boolean().default(false),
|
|
2370
|
+
opinew: import_zod15.z.boolean().optional().default(false),
|
|
2371
|
+
reviewsio: import_zod15.z.boolean().optional().default(false),
|
|
2372
|
+
stamped: import_zod15.z.boolean().default(false),
|
|
2373
|
+
yotpo: import_zod15.z.boolean().default(false)
|
|
2461
2374
|
}),
|
|
2462
|
-
key:
|
|
2463
|
-
language:
|
|
2464
|
-
description:
|
|
2465
|
-
descriptionEnabled:
|
|
2466
|
-
descriptionRte:
|
|
2467
|
-
content:
|
|
2468
|
-
type:
|
|
2375
|
+
key: import_zod15.z.string().optional(),
|
|
2376
|
+
language: import_zod15.z.object({
|
|
2377
|
+
description: import_zod15.z.union([import_zod15.z.string(), import_zod15.z.unknown().transform(() => "")]).default(""),
|
|
2378
|
+
descriptionEnabled: import_zod15.z.boolean().optional().default(false),
|
|
2379
|
+
descriptionRte: import_zod15.z.object({
|
|
2380
|
+
content: import_zod15.z.array(import_zod15.z.unknown()),
|
|
2381
|
+
type: import_zod15.z.string()
|
|
2469
2382
|
}).optional(),
|
|
2470
|
-
descriptionSpacing:
|
|
2471
|
-
displayCtaPrice:
|
|
2472
|
-
global:
|
|
2473
|
-
declineAll:
|
|
2474
|
-
declineThisOffer:
|
|
2475
|
-
free:
|
|
2476
|
-
notAvailable:
|
|
2477
|
-
payNow:
|
|
2478
|
-
payNowUpgradeToSubscription:
|
|
2479
|
-
quantity:
|
|
2383
|
+
descriptionSpacing: import_zod15.z.enum(["none", "xtight", "tight", "default", "loose", "xloose"]).optional(),
|
|
2384
|
+
displayCtaPrice: import_zod15.z.boolean().default(true),
|
|
2385
|
+
global: import_zod15.z.object({
|
|
2386
|
+
declineAll: import_zod15.z.string().optional().default("Decline All"),
|
|
2387
|
+
declineThisOffer: import_zod15.z.string().default("Decline this offer"),
|
|
2388
|
+
free: import_zod15.z.string().optional().default("Free"),
|
|
2389
|
+
notAvailable: import_zod15.z.string().optional().default("Not available"),
|
|
2390
|
+
payNow: import_zod15.z.string().default("Pay Now"),
|
|
2391
|
+
payNowUpgradeToSubscription: import_zod15.z.string().optional().default("Upgrade to Subscription"),
|
|
2392
|
+
quantity: import_zod15.z.string().default("Quantity"),
|
|
2480
2393
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2481
|
-
recurringShipping:
|
|
2482
|
-
recurringSubtotal:
|
|
2483
|
-
reviewsPlural:
|
|
2484
|
-
reviewsSingular:
|
|
2485
|
-
save:
|
|
2486
|
-
shipping:
|
|
2487
|
-
subscriptionOption:
|
|
2488
|
-
subtotal:
|
|
2489
|
-
taxes:
|
|
2490
|
-
total:
|
|
2394
|
+
recurringShipping: import_zod15.z.string().optional().default("Recurring shipping"),
|
|
2395
|
+
recurringSubtotal: import_zod15.z.string().default("Recurring subtotal"),
|
|
2396
|
+
reviewsPlural: import_zod15.z.string().optional().default("Reviews"),
|
|
2397
|
+
reviewsSingular: import_zod15.z.string().optional().default("Review"),
|
|
2398
|
+
save: import_zod15.z.union([import_zod15.z.string(), import_zod15.z.unknown().transform(() => "Save")]).optional().default("Save"),
|
|
2399
|
+
shipping: import_zod15.z.string().default("Shipping"),
|
|
2400
|
+
subscriptionOption: import_zod15.z.string().optional().default("Subscribe and Save"),
|
|
2401
|
+
subtotal: import_zod15.z.string().default("Subtotal"),
|
|
2402
|
+
taxes: import_zod15.z.string().default("Taxes"),
|
|
2403
|
+
total: import_zod15.z.string().default("Total")
|
|
2491
2404
|
}).optional().default(() => ({
|
|
2492
2405
|
declineAll: "Decline All",
|
|
2493
2406
|
declineThisOffer: "Decline this offer",
|
|
@@ -2508,70 +2421,70 @@ var PostPurchaseSettings = import_zod20.z.object({
|
|
|
2508
2421
|
taxes: "Taxes",
|
|
2509
2422
|
total: "Total"
|
|
2510
2423
|
})),
|
|
2511
|
-
globalTranslation:
|
|
2424
|
+
globalTranslation: import_zod15.z.string().optional().default("english")
|
|
2512
2425
|
}),
|
|
2513
|
-
metafields:
|
|
2426
|
+
metafields: import_zod15.z.boolean().default(false),
|
|
2514
2427
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2515
|
-
offer:
|
|
2516
|
-
count:
|
|
2428
|
+
offer: import_zod15.z.object({
|
|
2429
|
+
count: import_zod15.z.number().default(1)
|
|
2517
2430
|
}),
|
|
2518
|
-
offersLayout:
|
|
2519
|
-
itemsPerPage:
|
|
2520
|
-
type:
|
|
2431
|
+
offersLayout: import_zod15.z.object({
|
|
2432
|
+
itemsPerPage: import_zod15.z.number().optional(),
|
|
2433
|
+
type: import_zod15.z.enum(["list", "grid", "carousel"]).default("list")
|
|
2521
2434
|
}).optional().default({
|
|
2522
2435
|
type: "list"
|
|
2523
2436
|
}),
|
|
2524
2437
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2525
|
-
previewMode:
|
|
2526
|
-
productLimit:
|
|
2527
|
-
productOptions:
|
|
2438
|
+
previewMode: import_zod15.z.boolean().default(false),
|
|
2439
|
+
productLimit: import_zod15.z.number().optional().default(1),
|
|
2440
|
+
productOptions: import_zod15.z.object({
|
|
2528
2441
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2529
|
-
hideOutOfStockVariants:
|
|
2530
|
-
matchVariant:
|
|
2531
|
-
showDeclineAll:
|
|
2532
|
-
showShipping:
|
|
2533
|
-
showSubtotal:
|
|
2534
|
-
showTaxes:
|
|
2535
|
-
showTotal:
|
|
2536
|
-
showVariantSelectors:
|
|
2537
|
-
variantSelectorDisplayMode:
|
|
2442
|
+
hideOutOfStockVariants: import_zod15.z.boolean().optional().default(false),
|
|
2443
|
+
matchVariant: import_zod15.z.boolean().optional().default(true),
|
|
2444
|
+
showDeclineAll: import_zod15.z.enum(["above", "below", "both", "none"]).optional(),
|
|
2445
|
+
showShipping: import_zod15.z.boolean().optional().default(true),
|
|
2446
|
+
showSubtotal: import_zod15.z.boolean().optional().default(true),
|
|
2447
|
+
showTaxes: import_zod15.z.boolean().optional().default(true),
|
|
2448
|
+
showTotal: import_zod15.z.boolean().optional().default(true),
|
|
2449
|
+
showVariantSelectors: import_zod15.z.boolean().optional().default(true),
|
|
2450
|
+
variantSelectorDisplayMode: import_zod15.z.enum(["separate", "single"]).optional().default("separate")
|
|
2538
2451
|
}),
|
|
2539
|
-
productType:
|
|
2540
|
-
productTypeSelector:
|
|
2541
|
-
quantityInputs:
|
|
2542
|
-
defaultQuantity:
|
|
2543
|
-
enabled:
|
|
2544
|
-
maxValue:
|
|
2545
|
-
minValue:
|
|
2452
|
+
productType: import_zod15.z.union([import_zod15.z.enum(["one-time", "subscription", "both"]), import_zod15.z.literal("").transform(() => "one-time")]).default("one-time"),
|
|
2453
|
+
productTypeSelector: import_zod15.z.enum(["dropdown", "radio"]).optional().default("radio"),
|
|
2454
|
+
quantityInputs: import_zod15.z.object({
|
|
2455
|
+
defaultQuantity: import_zod15.z.union([import_zod15.z.number(), import_zod15.z.null().transform(() => 1)]).default(1),
|
|
2456
|
+
enabled: import_zod15.z.boolean().default(true),
|
|
2457
|
+
maxValue: import_zod15.z.union([import_zod15.z.number(), import_zod15.z.null().transform(() => 15)]).default(15),
|
|
2458
|
+
minValue: import_zod15.z.union([import_zod15.z.number().min(0), import_zod15.z.unknown().transform(() => 0)]).default(1)
|
|
2546
2459
|
}),
|
|
2547
|
-
shipping:
|
|
2460
|
+
shipping: import_zod15.z.object({
|
|
2548
2461
|
amount: strictNumber.default(10),
|
|
2549
2462
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2550
|
-
enabled:
|
|
2551
|
-
title:
|
|
2552
|
-
type:
|
|
2463
|
+
enabled: import_zod15.z.boolean().default(true),
|
|
2464
|
+
title: import_zod15.z.string().optional().default("Shipping Fees"),
|
|
2465
|
+
type: import_zod15.z.enum(["free", "fixed_amount"]).default("free")
|
|
2553
2466
|
}),
|
|
2554
|
-
styles:
|
|
2555
|
-
starColor:
|
|
2556
|
-
starSize:
|
|
2557
|
-
starStrokeColor:
|
|
2558
|
-
strokeWidth:
|
|
2467
|
+
styles: import_zod15.z.object({
|
|
2468
|
+
starColor: import_zod15.z.string().optional().default("#fadb14"),
|
|
2469
|
+
starSize: import_zod15.z.union([import_zod15.z.enum(["small", "medium", "large"]), import_zod15.z.unknown().transform(() => "large")]).optional().default("large"),
|
|
2470
|
+
starStrokeColor: import_zod15.z.string().optional().default("#fadb14"),
|
|
2471
|
+
strokeWidth: import_zod15.z.string().optional().default("1")
|
|
2559
2472
|
}).optional(),
|
|
2560
|
-
subImages:
|
|
2561
|
-
subscription:
|
|
2562
|
-
discount:
|
|
2473
|
+
subImages: import_zod15.z.number().nullish().default(8),
|
|
2474
|
+
subscription: import_zod15.z.object({
|
|
2475
|
+
discount: import_zod15.z.object({
|
|
2563
2476
|
amount: strictNumber.default(30),
|
|
2564
|
-
shouldShowSavingText:
|
|
2565
|
-
type:
|
|
2477
|
+
shouldShowSavingText: import_zod15.z.boolean().optional().default(true),
|
|
2478
|
+
type: import_zod15.z.enum(["none", "fixed_amount", "percentage"]).default("none")
|
|
2566
2479
|
}),
|
|
2567
|
-
shipping:
|
|
2480
|
+
shipping: import_zod15.z.object({
|
|
2568
2481
|
amount: strictNumber.default(1),
|
|
2569
2482
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2570
|
-
enabled:
|
|
2483
|
+
enabled: import_zod15.z.boolean().default(true),
|
|
2571
2484
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2572
2485
|
recurringAmount: strictNumber.default(2),
|
|
2573
|
-
shippingTitle:
|
|
2574
|
-
type:
|
|
2486
|
+
shippingTitle: import_zod15.z.string().default("Shipping Fees"),
|
|
2487
|
+
type: import_zod15.z.enum(["free", "fixed_amount"]).default("free")
|
|
2575
2488
|
})
|
|
2576
2489
|
}).optional().default({
|
|
2577
2490
|
discount: {
|
|
@@ -2589,15 +2502,15 @@ var PostPurchaseSettings = import_zod20.z.object({
|
|
|
2589
2502
|
type: "free"
|
|
2590
2503
|
}
|
|
2591
2504
|
}),
|
|
2592
|
-
subscriptionIsDefault:
|
|
2505
|
+
subscriptionIsDefault: import_zod15.z.boolean().optional(),
|
|
2593
2506
|
/** This isn't configurable in the admin-nextjs editor */
|
|
2594
|
-
template:
|
|
2595
|
-
type:
|
|
2596
|
-
upgradeToSubscription:
|
|
2597
|
-
acceptButtonText:
|
|
2598
|
-
allow:
|
|
2599
|
-
emailRefundNotice:
|
|
2600
|
-
errorBannerText:
|
|
2507
|
+
template: import_zod15.z.string().optional().default(""),
|
|
2508
|
+
type: import_zod15.z.literal("shopify_post_purchase_extension").default("shopify_post_purchase_extension"),
|
|
2509
|
+
upgradeToSubscription: import_zod15.z.object({
|
|
2510
|
+
acceptButtonText: import_zod15.z.string().optional().default("Upgrade"),
|
|
2511
|
+
allow: import_zod15.z.boolean().optional().default(false),
|
|
2512
|
+
emailRefundNotice: import_zod15.z.boolean().optional().default(false),
|
|
2513
|
+
errorBannerText: import_zod15.z.string().optional().default("This subscription cannot be added - limit one per order")
|
|
2601
2514
|
}).optional().default(() => ({
|
|
2602
2515
|
acceptButtonText: "Upgrade",
|
|
2603
2516
|
allow: false,
|
|
@@ -2606,12 +2519,109 @@ var PostPurchaseSettings = import_zod20.z.object({
|
|
|
2606
2519
|
}))
|
|
2607
2520
|
});
|
|
2608
2521
|
|
|
2522
|
+
// src/schema/postPurchaseChoice.ts
|
|
2523
|
+
var PostPurchaseChoice = import_zod16.z.discriminatedUnion("mode", [
|
|
2524
|
+
import_zod16.z.object({ mode: import_zod16.z.literal("one-time") }).strict(),
|
|
2525
|
+
import_zod16.z.object({ mode: import_zod16.z.literal("subscription"), sellingPlanId: PostPurchasePlanOption.shape.id }).strict()
|
|
2526
|
+
]);
|
|
2527
|
+
var PostPurchaseOptions = import_zod16.z.object({
|
|
2528
|
+
defaultChoice: PostPurchaseChoice,
|
|
2529
|
+
modes: import_zod16.z.array(import_zod16.z.enum(["one-time", "subscription"])).min(1).max(2),
|
|
2530
|
+
selector: PostPurchaseSettings.shape.productTypeSelector
|
|
2531
|
+
});
|
|
2532
|
+
|
|
2533
|
+
// src/schema/postPurchaseEligibility.ts
|
|
2534
|
+
var import_zod17 = require("zod");
|
|
2535
|
+
var PostPurchaseSkipReasonSchema = import_zod17.z.enum(["empty", "no-eligible-subscription"]);
|
|
2536
|
+
|
|
2537
|
+
// src/schema/postPurchaseExitPolicy.ts
|
|
2538
|
+
var import_zod18 = require("zod");
|
|
2539
|
+
var EXIT_DELAY_MAX_MS = 60 * 60 * 1e3;
|
|
2540
|
+
var ExitPolicySchema = import_zod18.z.discriminatedUnion("status", [
|
|
2541
|
+
import_zod18.z.strictObject({ status: import_zod18.z.literal("unavailable") }),
|
|
2542
|
+
import_zod18.z.strictObject({
|
|
2543
|
+
delayMs: import_zod18.z.number().int().nonnegative().max(EXIT_DELAY_MAX_MS),
|
|
2544
|
+
source: import_zod18.z.enum(["admitted", "selected-flow"]),
|
|
2545
|
+
status: import_zod18.z.literal("available")
|
|
2546
|
+
})
|
|
2547
|
+
]);
|
|
2548
|
+
|
|
2549
|
+
// src/schema/postPurchaseIdentity.ts
|
|
2550
|
+
var import_zod19 = require("zod");
|
|
2551
|
+
var POST_PURCHASE_ID_MAX = 128;
|
|
2552
|
+
var PostPurchaseTimestampSchema = import_zod19.z.number().int().nonnegative();
|
|
2553
|
+
var PostPurchaseOrderIdSchema = import_zod19.z.string().regex(/^gid:\/\/shopify\/Order\/[1-9]\d*$/);
|
|
2554
|
+
var ShopifyDomainSchema = import_zod19.z.string().max(POST_PURCHASE_ID_MAX).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?\.myshopify\.com$/);
|
|
2555
|
+
var DecideRequestSchema = import_zod19.z.object({
|
|
2556
|
+
checkoutToken: import_zod19.z.string().min(1).max(POST_PURCHASE_ID_MAX),
|
|
2557
|
+
shop: ShopifyDomainSchema
|
|
2558
|
+
});
|
|
2559
|
+
var PostPurchaseAppIdSchema = import_zod19.z.string().min(1).max(POST_PURCHASE_ID_MAX);
|
|
2560
|
+
var DecisionEntrySchema = import_zod19.z.object({
|
|
2561
|
+
blockId: import_zod19.z.number().int().positive(),
|
|
2562
|
+
blockIndex: import_zod19.z.string(),
|
|
2563
|
+
blockParentIndex: import_zod19.z.string(),
|
|
2564
|
+
flowId: import_zod19.z.number().int().positive(),
|
|
2565
|
+
sectionId: import_zod19.z.number().int().positive(),
|
|
2566
|
+
widgetId: import_zod19.z.number().int().positive(),
|
|
2567
|
+
widgetTraffic: import_zod19.z.number().min(0).max(100)
|
|
2568
|
+
});
|
|
2569
|
+
|
|
2570
|
+
// src/schema/postPurchaseOrderDecision.ts
|
|
2571
|
+
var import_zod20 = require("zod");
|
|
2572
|
+
var OrderDecisionSchema = import_zod20.z.discriminatedUnion("owner", [
|
|
2573
|
+
import_zod20.z.object({ owner: import_zod20.z.literal("session"), sessionId: import_zod20.z.string().regex(/^[a-f0-9]{64}$/) }),
|
|
2574
|
+
import_zod20.z.object({ owner: import_zod20.z.literal("release"), sessionId: import_zod20.z.null() })
|
|
2575
|
+
]);
|
|
2576
|
+
|
|
2577
|
+
// src/schema/postPurchasePolicy.ts
|
|
2578
|
+
var import_zod21 = require("zod");
|
|
2579
|
+
var HoldSettingSchema = import_zod21.z.discriminatedUnion("enabled", [
|
|
2580
|
+
import_zod21.z.object({ durationMinutes: import_zod21.z.number().int().min(1).max(60), enabled: import_zod21.z.literal(true) }),
|
|
2581
|
+
import_zod21.z.object({ durationMinutes: import_zod21.z.null(), enabled: import_zod21.z.literal(false) })
|
|
2582
|
+
]);
|
|
2583
|
+
var TimingSettingsSchema = import_zod21.z.object({ flowHold: HoldSettingSchema, shopHold: HoldSettingSchema });
|
|
2584
|
+
var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
2585
|
+
durationMinutes: import_zod21.z.number().int().min(1).max(60).nullable(),
|
|
2586
|
+
source: import_zod21.z.enum(["shop", "flow", "native"])
|
|
2587
|
+
}).refine(
|
|
2588
|
+
(policy) => {
|
|
2589
|
+
const expectedSource = policy.shopHold.enabled ? "shop" : policy.flowHold.enabled ? "flow" : "native";
|
|
2590
|
+
const expectedDuration = expectedSource === "shop" ? policy.shopHold.durationMinutes : expectedSource === "flow" ? policy.flowHold.durationMinutes : null;
|
|
2591
|
+
return policy.source === expectedSource && policy.durationMinutes === expectedDuration;
|
|
2592
|
+
},
|
|
2593
|
+
{
|
|
2594
|
+
message: "source and durationMinutes must reflect the shop-over-flow-over-native precedence",
|
|
2595
|
+
path: ["source"]
|
|
2596
|
+
}
|
|
2597
|
+
);
|
|
2598
|
+
|
|
2599
|
+
// src/schema/postPurchaseProduct.ts
|
|
2600
|
+
var import_zod26 = require("zod");
|
|
2601
|
+
|
|
2602
|
+
// src/schema/postPurchaseProductDisplay.ts
|
|
2603
|
+
var import_zod23 = require("zod");
|
|
2604
|
+
|
|
2605
|
+
// src/schema/postPurchaseProductGallery.ts
|
|
2606
|
+
var import_zod22 = require("zod");
|
|
2607
|
+
var PostPurchaseProductGallery = import_zod22.z.object({
|
|
2608
|
+
images: import_zod22.z.array(
|
|
2609
|
+
import_zod22.z.object({
|
|
2610
|
+
description: import_zod22.z.string(),
|
|
2611
|
+
id: import_zod22.z.number().int().positive(),
|
|
2612
|
+
source: import_zod22.z.string(),
|
|
2613
|
+
thumbnail: import_zod22.z.string()
|
|
2614
|
+
})
|
|
2615
|
+
),
|
|
2616
|
+
selectedImageId: import_zod22.z.number().int().positive().optional()
|
|
2617
|
+
});
|
|
2618
|
+
|
|
2609
2619
|
// src/schema/postPurchaseProductDisplay.ts
|
|
2610
2620
|
var language = PostPurchaseSettings.shape.language;
|
|
2611
|
-
var PostPurchasePrimaryImageSource =
|
|
2621
|
+
var PostPurchasePrimaryImageSource = import_zod23.z.string().default(
|
|
2612
2622
|
"https://cdn.shopify.com/shopifycloud/shopify/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c.gif"
|
|
2613
2623
|
);
|
|
2614
|
-
var PostPurchaseProductDisplay =
|
|
2624
|
+
var PostPurchaseProductDisplay = import_zod23.z.object({
|
|
2615
2625
|
discountedFrom: PostPurchaseSettings.shape.discountedFrom,
|
|
2616
2626
|
gallery: PostPurchaseProductGallery.optional(),
|
|
2617
2627
|
language: language.pick({
|
|
@@ -2620,7 +2630,7 @@ var PostPurchaseProductDisplay = import_zod21.z.object({
|
|
|
2620
2630
|
descriptionRte: true,
|
|
2621
2631
|
descriptionSpacing: true
|
|
2622
2632
|
}),
|
|
2623
|
-
primaryImage:
|
|
2633
|
+
primaryImage: import_zod23.z.object({ description: import_zod23.z.string(), source: import_zod23.z.string() }),
|
|
2624
2634
|
productOptions: PostPurchaseSettings.shape.productOptions.pick({
|
|
2625
2635
|
showDeclineAll: true,
|
|
2626
2636
|
showShipping: true,
|
|
@@ -2633,9 +2643,126 @@ var PostPurchaseProductDisplay = import_zod21.z.object({
|
|
|
2633
2643
|
shouldShowSavingText: PostPurchaseSettings.shape.discount.shape.shouldShowSavingText
|
|
2634
2644
|
});
|
|
2635
2645
|
|
|
2646
|
+
// src/schema/postPurchaseProductSource.ts
|
|
2647
|
+
var import_zod24 = require("zod");
|
|
2648
|
+
var PostPurchaseAmount = import_zod24.z.string().regex(/^\d+(?:\.\d+)?$/).refine((value) => Number.isFinite(Number(value)));
|
|
2649
|
+
var PostPurchaseProductId = import_zod24.z.number().int().positive();
|
|
2650
|
+
var PostPurchaseVariantId = import_zod24.z.number().int().positive();
|
|
2651
|
+
var ProductBase = OfferProduct.pick({ description: true, id: true, image: true, title: true }).extend({
|
|
2652
|
+
description: OfferProduct.shape.description.nullable(),
|
|
2653
|
+
id: PostPurchaseProductId
|
|
2654
|
+
});
|
|
2655
|
+
var SourceVariant = OfferProduct.shape.variants.element.pick({ id: true, title: true }).extend({
|
|
2656
|
+
compareAtPrice: PostPurchaseAmount.nullable(),
|
|
2657
|
+
id: PostPurchaseVariantId,
|
|
2658
|
+
imageId: import_zod24.z.number().int().nonnegative().nullish(),
|
|
2659
|
+
inventoryManagement: import_zod24.z.string().nullable(),
|
|
2660
|
+
inventoryPolicy: import_zod24.z.string(),
|
|
2661
|
+
inventoryQuantity: import_zod24.z.number(),
|
|
2662
|
+
option1: import_zod24.z.unknown().optional(),
|
|
2663
|
+
option2: import_zod24.z.unknown().optional(),
|
|
2664
|
+
option3: import_zod24.z.unknown().optional(),
|
|
2665
|
+
price: PostPurchaseAmount,
|
|
2666
|
+
productId: PostPurchaseProductId,
|
|
2667
|
+
sellingPlanAllocations: import_zod24.z.unknown().optional()
|
|
2668
|
+
});
|
|
2669
|
+
var Product2 = ProductBase.extend({
|
|
2670
|
+
images: import_zod24.z.array(
|
|
2671
|
+
import_zod24.z.object({ alt: import_zod24.z.string().optional().catch(void 0), id: import_zod24.z.number().int().positive(), src: import_zod24.z.string() })
|
|
2672
|
+
).nullish(),
|
|
2673
|
+
metadata: import_zod24.z.object({
|
|
2674
|
+
productQuantity: import_zod24.z.union([
|
|
2675
|
+
import_zod24.z.number().int().positive(),
|
|
2676
|
+
import_zod24.z.string().regex(/^[1-9]\d*$/).transform(Number)
|
|
2677
|
+
]).optional()
|
|
2678
|
+
}).optional(),
|
|
2679
|
+
metafields: import_zod24.z.unknown().optional(),
|
|
2680
|
+
options: import_zod24.z.unknown().optional(),
|
|
2681
|
+
productGroupVariants: import_zod24.z.array(import_zod24.z.unknown()).default([]),
|
|
2682
|
+
selectedVariant: import_zod24.z.unknown().optional(),
|
|
2683
|
+
sellingPlanGroups: import_zod24.z.array(
|
|
2684
|
+
OfferProduct.shape.sellingPlanGroups.unwrap().element.extend({
|
|
2685
|
+
discountAmount: import_zod24.z.unknown().optional(),
|
|
2686
|
+
discountType: import_zod24.z.unknown().optional(),
|
|
2687
|
+
id: import_zod24.z.unknown().optional(),
|
|
2688
|
+
requiresSellingPlan: import_zod24.z.boolean().default(false),
|
|
2689
|
+
sellingPlans: import_zod24.z.unknown().optional()
|
|
2690
|
+
})
|
|
2691
|
+
).default([]),
|
|
2692
|
+
variants: import_zod24.z.array(SourceVariant)
|
|
2693
|
+
});
|
|
2694
|
+
var PostPurchaseProductSource = import_zod24.z.object({
|
|
2695
|
+
data: import_zod24.z.array(Product2),
|
|
2696
|
+
metadata: import_zod24.z.object({ widget: import_zod24.z.record(import_zod24.z.string(), import_zod24.z.unknown()).default({}) }).default({ widget: {} })
|
|
2697
|
+
});
|
|
2698
|
+
|
|
2699
|
+
// src/schema/postPurchaseSubscription.ts
|
|
2700
|
+
var import_zod25 = require("zod");
|
|
2701
|
+
var PostPurchaseSubscriptionTerms = import_zod25.z.object({
|
|
2702
|
+
adjustment: PostPurchasePlanAdjustment.optional(),
|
|
2703
|
+
initialShippingPrice: import_zod25.z.number().nonnegative(),
|
|
2704
|
+
intervalLabel: import_zod25.z.string().min(1),
|
|
2705
|
+
name: import_zod25.z.string().min(1),
|
|
2706
|
+
recurringShippingPrice: import_zod25.z.number().nonnegative(),
|
|
2707
|
+
shippingOption: import_zod25.z.object({ presentmentTitle: import_zod25.z.string(), title: import_zod25.z.string() })
|
|
2708
|
+
});
|
|
2709
|
+
|
|
2710
|
+
// src/schema/postPurchaseProduct.ts
|
|
2711
|
+
var global = PostPurchaseSettings.shape.language.shape.global.unwrap().unwrap().shape;
|
|
2712
|
+
var PostPurchaseVariant = OfferProduct.shape.variants.element.pick({ id: true, title: true }).extend({
|
|
2713
|
+
compareAtPrice: PostPurchaseAmount.nullable(),
|
|
2714
|
+
id: PostPurchaseVariantId,
|
|
2715
|
+
price: PostPurchaseAmount
|
|
2716
|
+
});
|
|
2717
|
+
var PreparedPostPurchaseProduct = import_zod26.z.object({
|
|
2718
|
+
display: PostPurchaseProductDisplay,
|
|
2719
|
+
labels: import_zod26.z.object({
|
|
2720
|
+
declineAll: global.declineAll,
|
|
2721
|
+
free: import_zod26.z.string(),
|
|
2722
|
+
payNow: import_zod26.z.string(),
|
|
2723
|
+
quantity: import_zod26.z.string(),
|
|
2724
|
+
recurringShipping: global.recurringShipping,
|
|
2725
|
+
recurringSubtotal: global.recurringSubtotal,
|
|
2726
|
+
save: import_zod26.z.string(),
|
|
2727
|
+
shipping: import_zod26.z.string(),
|
|
2728
|
+
subtotal: import_zod26.z.string(),
|
|
2729
|
+
taxes: import_zod26.z.string(),
|
|
2730
|
+
total: import_zod26.z.string()
|
|
2731
|
+
}),
|
|
2732
|
+
product: OfferProduct.pick({ description: true, id: true, image: true, title: true }).extend({
|
|
2733
|
+
description: OfferProduct.shape.description.nullable(),
|
|
2734
|
+
id: PostPurchaseProductId,
|
|
2735
|
+
variant: PostPurchaseVariant
|
|
2736
|
+
}),
|
|
2737
|
+
selection: import_zod26.z.object({
|
|
2738
|
+
productId: PostPurchaseProductId,
|
|
2739
|
+
quantity: import_zod26.z.number().int().positive(),
|
|
2740
|
+
sellingPlanId: import_zod26.z.number().int().positive().optional(),
|
|
2741
|
+
variantId: PostPurchaseVariantId
|
|
2742
|
+
}),
|
|
2743
|
+
status: import_zod26.z.literal("prepared"),
|
|
2744
|
+
terms: import_zod26.z.object({
|
|
2745
|
+
discount: PostPurchaseDiscount,
|
|
2746
|
+
shipping: import_zod26.z.object({
|
|
2747
|
+
amount: import_zod26.z.number().nonnegative(),
|
|
2748
|
+
title: import_zod26.z.string(),
|
|
2749
|
+
type: import_zod26.z.enum(["free", "fixed_amount"])
|
|
2750
|
+
}),
|
|
2751
|
+
subscription: PostPurchaseSubscriptionTerms.optional()
|
|
2752
|
+
})
|
|
2753
|
+
});
|
|
2754
|
+
var PostPurchasePreparation = import_zod26.z.discriminatedUnion("status", [
|
|
2755
|
+
PreparedPostPurchaseProduct,
|
|
2756
|
+
import_zod26.z.object({ reason: import_zod26.z.string(), status: import_zod26.z.literal("unsupported") })
|
|
2757
|
+
]);
|
|
2758
|
+
|
|
2759
|
+
// src/schema/postPurchaseProductCollectionView.ts
|
|
2760
|
+
var import_zod27 = require("zod");
|
|
2761
|
+
var PostPurchaseExcludedProductIds = import_zod27.z.array(PostPurchaseProductId).default([]);
|
|
2762
|
+
|
|
2636
2763
|
// src/schema/postPurchaseProductSettings.ts
|
|
2637
|
-
var
|
|
2638
|
-
var amount =
|
|
2764
|
+
var import_zod28 = require("zod");
|
|
2765
|
+
var amount = import_zod28.z.union([import_zod28.z.number().nonnegative(), PostPurchaseAmount.transform(Number)]);
|
|
2639
2766
|
var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
2640
2767
|
discountedFrom: true,
|
|
2641
2768
|
language: true,
|
|
@@ -2647,36 +2774,36 @@ var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
|
2647
2774
|
subscriptionIsDefault: true,
|
|
2648
2775
|
upgradeToSubscription: true
|
|
2649
2776
|
}).extend({
|
|
2650
|
-
advance:
|
|
2651
|
-
blocks:
|
|
2777
|
+
advance: import_zod28.z.unknown().default({}),
|
|
2778
|
+
blocks: import_zod28.z.array(import_zod28.z.unknown()).optional(),
|
|
2652
2779
|
discount: PostPurchaseSettings.shape.discount.extend({ amount: amount.default(30) }),
|
|
2653
|
-
integrations:
|
|
2780
|
+
integrations: import_zod28.z.unknown().default({}),
|
|
2654
2781
|
shipping: PostPurchaseSettings.shape.shipping.extend({ amount: amount.default(10) }),
|
|
2655
|
-
styles:
|
|
2782
|
+
styles: import_zod28.z.unknown().default({}),
|
|
2656
2783
|
subImages: PostPurchaseSettings.shape.subImages.catch(null),
|
|
2657
|
-
subscription:
|
|
2784
|
+
subscription: import_zod28.z.unknown().default(PostPurchaseSettings.shape.subscription.parse(void 0))
|
|
2658
2785
|
});
|
|
2659
2786
|
|
|
2660
2787
|
// src/schema/postPurchaseSelection.ts
|
|
2661
|
-
var
|
|
2788
|
+
var import_zod29 = require("zod");
|
|
2662
2789
|
var SelectionClaimsSchema = DecideRequestSchema.extend({
|
|
2663
2790
|
appId: PostPurchaseAppIdSchema,
|
|
2664
2791
|
entry: DecisionEntrySchema,
|
|
2665
|
-
iss:
|
|
2666
|
-
purpose:
|
|
2792
|
+
iss: import_zod29.z.literal("rebuy-api"),
|
|
2793
|
+
purpose: import_zod29.z.literal("post-purchase-selection")
|
|
2667
2794
|
});
|
|
2668
2795
|
var SessionStartRequestSchema = DecideRequestSchema.extend({
|
|
2669
|
-
selectionToken:
|
|
2796
|
+
selectionToken: import_zod29.z.string().min(1).max(8192).optional()
|
|
2670
2797
|
}).strict();
|
|
2671
2798
|
|
|
2672
2799
|
// src/schema/postPurchaseSession.ts
|
|
2673
|
-
var
|
|
2800
|
+
var import_zod30 = require("zod");
|
|
2674
2801
|
var SessionIdentitySchema = DecideRequestSchema.extend({ appId: PostPurchaseAppIdSchema });
|
|
2675
|
-
var SessionOrderTimingSchema =
|
|
2802
|
+
var SessionOrderTimingSchema = import_zod30.z.object({
|
|
2676
2803
|
nativeDeadline: PostPurchaseTimestampSchema,
|
|
2677
2804
|
orderCreatedAt: PostPurchaseTimestampSchema,
|
|
2678
2805
|
orderId: PostPurchaseOrderIdSchema,
|
|
2679
|
-
timingSource:
|
|
2806
|
+
timingSource: import_zod30.z.literal("shopify-order-created-at")
|
|
2680
2807
|
});
|
|
2681
2808
|
var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
2682
2809
|
deadline: PostPurchaseTimestampSchema,
|
|
@@ -2693,39 +2820,39 @@ var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
|
2693
2820
|
message: "deadline must not exceed nativeDeadline",
|
|
2694
2821
|
path: ["deadline"]
|
|
2695
2822
|
});
|
|
2696
|
-
var SessionStartResponseSchema =
|
|
2697
|
-
data:
|
|
2698
|
-
phase:
|
|
2823
|
+
var SessionStartResponseSchema = import_zod30.z.object({
|
|
2824
|
+
data: import_zod30.z.object({
|
|
2825
|
+
phase: import_zod30.z.literal("render"),
|
|
2699
2826
|
serverNow: PostPurchaseTimestampSchema,
|
|
2700
2827
|
session: ReadySessionTimingSchema,
|
|
2701
|
-
workflowPhase:
|
|
2828
|
+
workflowPhase: import_zod30.z.literal("start")
|
|
2702
2829
|
}),
|
|
2703
|
-
successful:
|
|
2830
|
+
successful: import_zod30.z.literal(true)
|
|
2704
2831
|
});
|
|
2705
2832
|
|
|
2706
2833
|
// src/schema/postPurchaseSessionClose.ts
|
|
2707
|
-
var
|
|
2708
|
-
var SessionClosureSchema =
|
|
2834
|
+
var import_zod31 = require("zod");
|
|
2835
|
+
var SessionClosureSchema = import_zod31.z.object({ closedAt: PostPurchaseTimestampSchema, status: import_zod31.z.literal("closed") });
|
|
2709
2836
|
var SessionCloseRequestSchema = DecideRequestSchema.strict();
|
|
2710
|
-
var SessionCloseResponseSchema =
|
|
2837
|
+
var SessionCloseResponseSchema = import_zod31.z.object({ data: SessionClosureSchema, successful: import_zod31.z.literal(true) });
|
|
2711
2838
|
|
|
2712
2839
|
// src/schema/postPurchaseShadow.ts
|
|
2713
|
-
var
|
|
2714
|
-
var PostPurchaseShadowSelectionSchema =
|
|
2715
|
-
|
|
2716
|
-
|
|
2840
|
+
var import_zod32 = require("zod");
|
|
2841
|
+
var PostPurchaseShadowSelectionSchema = import_zod32.z.discriminatedUnion("verdict", [
|
|
2842
|
+
import_zod32.z.object({ entry: DecisionEntrySchema, verdict: import_zod32.z.literal("render") }),
|
|
2843
|
+
import_zod32.z.object({ verdict: import_zod32.z.literal("skip") })
|
|
2717
2844
|
]);
|
|
2718
|
-
var PostPurchaseShadowReportFields =
|
|
2719
|
-
differences:
|
|
2845
|
+
var PostPurchaseShadowReportFields = import_zod32.z.object({
|
|
2846
|
+
differences: import_zod32.z.array(import_zod32.z.enum(["verdict", "entry", "targeting", "incomplete-capture", "unsupported-configuration"])).refine((differences) => new Set(differences).size === differences.length, {
|
|
2720
2847
|
message: "differences must not contain duplicate entries"
|
|
2721
2848
|
}),
|
|
2722
2849
|
legacySelection: PostPurchaseShadowSelectionSchema,
|
|
2723
|
-
phase:
|
|
2724
|
-
sampleId:
|
|
2850
|
+
phase: import_zod32.z.literal("shouldRender"),
|
|
2851
|
+
sampleId: import_zod32.z.string(),
|
|
2725
2852
|
serverSelection: PostPurchaseShadowSelectionSchema.optional(),
|
|
2726
|
-
status:
|
|
2727
|
-
targetingFlowIds:
|
|
2728
|
-
workflowPhase:
|
|
2853
|
+
status: import_zod32.z.enum(["match", "diverged", "incomplete"]),
|
|
2854
|
+
targetingFlowIds: import_zod32.z.array(import_zod32.z.number().int().positive()),
|
|
2855
|
+
workflowPhase: import_zod32.z.literal("decide")
|
|
2729
2856
|
});
|
|
2730
2857
|
var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
2731
2858
|
(report) => report.status !== "match" || report.differences.length === 0,
|
|
@@ -2739,117 +2866,143 @@ var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
|
2739
2866
|
});
|
|
2740
2867
|
|
|
2741
2868
|
// src/schema/postPurchaseSkipTrace.ts
|
|
2742
|
-
var
|
|
2869
|
+
var import_zod33 = require("zod");
|
|
2743
2870
|
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
2744
|
-
var PostPurchaseSkipTraceSchema =
|
|
2745
|
-
|
|
2871
|
+
var PostPurchaseSkipTraceSchema = import_zod33.z.array(
|
|
2872
|
+
import_zod33.z.object({
|
|
2746
2873
|
entry: DecisionEntrySchema,
|
|
2747
2874
|
reason: PostPurchaseSkipReasonSchema
|
|
2748
2875
|
})
|
|
2749
2876
|
).max(POST_PURCHASE_SKIP_LIMIT);
|
|
2750
2877
|
|
|
2878
|
+
// src/schema/postPurchaseSubscriptionDisplay.ts
|
|
2879
|
+
var import_zod34 = require("zod");
|
|
2880
|
+
var Minor = import_zod34.z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
2881
|
+
var PostPurchaseSubscriptionDisplay = import_zod34.z.object({
|
|
2882
|
+
comparisonMinor: Minor,
|
|
2883
|
+
currencyCode: import_zod34.z.string().regex(/^[A-Z]{3}$/),
|
|
2884
|
+
priceMinor: Minor,
|
|
2885
|
+
savingMinor: Minor,
|
|
2886
|
+
savingPercent: import_zod34.z.number().int().min(0).max(100)
|
|
2887
|
+
});
|
|
2888
|
+
|
|
2889
|
+
// src/schema/postPurchaseSubscriptionProduct.ts
|
|
2890
|
+
var import_zod35 = require("zod");
|
|
2891
|
+
var PreparedPostPurchaseSubscription = PreparedPostPurchaseProduct.extend({
|
|
2892
|
+
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId: import_zod35.z.number().int().positive() }),
|
|
2893
|
+
terms: PreparedPostPurchaseProduct.shape.terms.extend({
|
|
2894
|
+
subscription: PostPurchaseSubscriptionTerms
|
|
2895
|
+
}).refine(
|
|
2896
|
+
({ discount, shipping, subscription }) => (discount.type !== "none" || discount.amount === 0) && shipping.amount === subscription.initialShippingPrice && shipping.amount === subscription.recurringShippingPrice && (shipping.type !== "free" || shipping.amount === 0)
|
|
2897
|
+
)
|
|
2898
|
+
});
|
|
2899
|
+
var readPostPurchaseSubscription = (prepared) => {
|
|
2900
|
+
if (prepared.selection.sellingPlanId === void 0 && prepared.terms.subscription === void 0) return void 0;
|
|
2901
|
+
return PreparedPostPurchaseSubscription.parse(prepared);
|
|
2902
|
+
};
|
|
2903
|
+
|
|
2751
2904
|
// src/schema/postPurchaseVariantCatalog.ts
|
|
2752
|
-
var
|
|
2753
|
-
var PostPurchaseVariantSelector =
|
|
2905
|
+
var import_zod36 = require("zod");
|
|
2906
|
+
var PostPurchaseVariantSelector = import_zod36.z.object({ variantId: PostPurchaseVariantId }).strict();
|
|
2754
2907
|
var PostPurchaseVariantOption = OfferProduct.shape.options.element.extend({
|
|
2755
|
-
id:
|
|
2756
|
-
position:
|
|
2908
|
+
id: import_zod36.z.number().int().positive(),
|
|
2909
|
+
position: import_zod36.z.number().int().min(1).max(3)
|
|
2757
2910
|
});
|
|
2758
2911
|
var PostPurchaseVariantValues = OfferProduct.shape.variants.element.pick({
|
|
2759
2912
|
option1: true,
|
|
2760
2913
|
option2: true,
|
|
2761
2914
|
option3: true
|
|
2762
2915
|
});
|
|
2763
|
-
var PostPurchaseVariantCatalog =
|
|
2916
|
+
var PostPurchaseVariantCatalog = import_zod36.z.object({
|
|
2764
2917
|
displayMode: PostPurchaseSettings.shape.productOptions.shape.variantSelectorDisplayMode,
|
|
2765
|
-
options:
|
|
2918
|
+
options: import_zod36.z.array(PostPurchaseVariantOption),
|
|
2766
2919
|
productId: PostPurchaseProductId,
|
|
2767
2920
|
showSelectors: PostPurchaseSettings.shape.productOptions.shape.showVariantSelectors,
|
|
2768
|
-
variants:
|
|
2921
|
+
variants: import_zod36.z.array(
|
|
2769
2922
|
PostPurchaseVariantValues.partial().extend({
|
|
2770
|
-
available:
|
|
2923
|
+
available: import_zod36.z.boolean(),
|
|
2771
2924
|
id: PostPurchaseVariantId,
|
|
2772
|
-
imageId:
|
|
2925
|
+
imageId: import_zod36.z.number().int().nonnegative().nullish(),
|
|
2773
2926
|
title: OfferProduct.shape.variants.element.shape.title
|
|
2774
2927
|
})
|
|
2775
2928
|
)
|
|
2776
2929
|
});
|
|
2777
2930
|
|
|
2778
2931
|
// src/schema/postPurchaseVariantDefault.ts
|
|
2779
|
-
var
|
|
2932
|
+
var import_zod37 = require("zod");
|
|
2780
2933
|
var values = PostPurchaseVariantValues.partial().extend({
|
|
2781
2934
|
option1: PostPurchaseVariantValues.shape.option1.nullish()
|
|
2782
2935
|
});
|
|
2783
2936
|
var variant = values.extend({
|
|
2784
2937
|
id: PostPurchaseVariantId,
|
|
2785
|
-
inventoryManagement:
|
|
2786
|
-
inventoryPolicy:
|
|
2787
|
-
inventoryQuantity:
|
|
2938
|
+
inventoryManagement: import_zod37.z.string().nullable(),
|
|
2939
|
+
inventoryPolicy: import_zod37.z.string(),
|
|
2940
|
+
inventoryQuantity: import_zod37.z.number()
|
|
2788
2941
|
});
|
|
2789
|
-
var options =
|
|
2790
|
-
var PostPurchaseVariantDefaultProduct =
|
|
2942
|
+
var options = import_zod37.z.array(PostPurchaseVariantOption.pick({ name: true, values: true }));
|
|
2943
|
+
var PostPurchaseVariantDefaultProduct = import_zod37.z.object({
|
|
2791
2944
|
id: PostPurchaseProductId,
|
|
2792
2945
|
options,
|
|
2793
2946
|
selectedVariant: variant.optional(),
|
|
2794
|
-
variants:
|
|
2947
|
+
variants: import_zod37.z.array(variant)
|
|
2795
2948
|
});
|
|
2796
2949
|
var PostPurchaseVariantDefaultSettings = PostPurchaseSettings.shape.productOptions.pick({
|
|
2797
2950
|
hideOutOfStockVariants: true,
|
|
2798
2951
|
matchVariant: true
|
|
2799
2952
|
});
|
|
2800
|
-
var PostPurchaseOrderAttributes =
|
|
2953
|
+
var PostPurchaseOrderAttributes = import_zod37.z.record(import_zod37.z.string(), import_zod37.z.array(import_zod37.z.string())).default({});
|
|
2801
2954
|
|
|
2802
2955
|
// src/schema/shopConfig.ts
|
|
2803
|
-
var
|
|
2804
|
-
var ShopConfig =
|
|
2805
|
-
activeExperiments:
|
|
2806
|
-
|
|
2807
|
-
data:
|
|
2808
|
-
|
|
2809
|
-
aliasName:
|
|
2810
|
-
cssInput:
|
|
2811
|
-
elementId:
|
|
2812
|
-
id:
|
|
2813
|
-
javascriptInput:
|
|
2814
|
-
traffic:
|
|
2956
|
+
var import_zod38 = require("zod");
|
|
2957
|
+
var ShopConfig = import_zod38.z.object({
|
|
2958
|
+
activeExperiments: import_zod38.z.array(
|
|
2959
|
+
import_zod38.z.object({
|
|
2960
|
+
data: import_zod38.z.array(
|
|
2961
|
+
import_zod38.z.object({
|
|
2962
|
+
aliasName: import_zod38.z.string(),
|
|
2963
|
+
cssInput: import_zod38.z.string().nullish(),
|
|
2964
|
+
elementId: import_zod38.z.coerce.number(),
|
|
2965
|
+
id: import_zod38.z.coerce.number(),
|
|
2966
|
+
javascriptInput: import_zod38.z.string().nullish(),
|
|
2967
|
+
traffic: import_zod38.z.coerce.number()
|
|
2815
2968
|
})
|
|
2816
2969
|
),
|
|
2817
|
-
id:
|
|
2818
|
-
name:
|
|
2819
|
-
pageTarget:
|
|
2820
|
-
pageTargetUrl:
|
|
2821
|
-
placeholderId:
|
|
2822
|
-
type:
|
|
2970
|
+
id: import_zod38.z.coerce.number(),
|
|
2971
|
+
name: import_zod38.z.string(),
|
|
2972
|
+
pageTarget: import_zod38.z.string().nullable(),
|
|
2973
|
+
pageTargetUrl: import_zod38.z.string().nullable(),
|
|
2974
|
+
placeholderId: import_zod38.z.coerce.number().nullable(),
|
|
2975
|
+
type: import_zod38.z.string()
|
|
2823
2976
|
})
|
|
2824
2977
|
),
|
|
2825
|
-
activePackages:
|
|
2826
|
-
|
|
2827
|
-
cancelledAt:
|
|
2828
|
-
id:
|
|
2829
|
-
installedAt:
|
|
2830
|
-
isActive:
|
|
2831
|
-
isBillable:
|
|
2832
|
-
packageId:
|
|
2833
|
-
packageName:
|
|
2834
|
-
shortName:
|
|
2835
|
-
trialDays:
|
|
2836
|
-
uninstalledAt:
|
|
2978
|
+
activePackages: import_zod38.z.array(
|
|
2979
|
+
import_zod38.z.object({
|
|
2980
|
+
cancelledAt: import_zod38.z.string().nullable(),
|
|
2981
|
+
id: import_zod38.z.number(),
|
|
2982
|
+
installedAt: import_zod38.z.string().nullable(),
|
|
2983
|
+
isActive: import_zod38.z.boolean(),
|
|
2984
|
+
isBillable: import_zod38.z.boolean(),
|
|
2985
|
+
packageId: import_zod38.z.number(),
|
|
2986
|
+
packageName: import_zod38.z.string(),
|
|
2987
|
+
shortName: import_zod38.z.string(),
|
|
2988
|
+
trialDays: import_zod38.z.number(),
|
|
2989
|
+
uninstalledAt: import_zod38.z.string().nullable()
|
|
2837
2990
|
})
|
|
2838
2991
|
),
|
|
2839
|
-
apiKey:
|
|
2840
|
-
billingVersion:
|
|
2841
|
-
cacheKey:
|
|
2842
|
-
carousel:
|
|
2843
|
-
currency:
|
|
2844
|
-
currencySymbol:
|
|
2845
|
-
domain:
|
|
2846
|
-
enabledJquery:
|
|
2847
|
-
enabledPresentmentCurrencies:
|
|
2848
|
-
hasSmartCollectionsEnabled:
|
|
2849
|
-
hasSmartSearchEnabled:
|
|
2850
|
-
id:
|
|
2851
|
-
integrations:
|
|
2852
|
-
|
|
2992
|
+
apiKey: import_zod38.z.string(),
|
|
2993
|
+
billingVersion: import_zod38.z.string().nullable(),
|
|
2994
|
+
cacheKey: import_zod38.z.coerce.number(),
|
|
2995
|
+
carousel: import_zod38.z.enum(["flickity", "splide"]),
|
|
2996
|
+
currency: import_zod38.z.string(),
|
|
2997
|
+
currencySymbol: import_zod38.z.string(),
|
|
2998
|
+
domain: import_zod38.z.string(),
|
|
2999
|
+
enabledJquery: import_zod38.z.boolean(),
|
|
3000
|
+
enabledPresentmentCurrencies: import_zod38.z.array(import_zod38.z.string()),
|
|
3001
|
+
hasSmartCollectionsEnabled: import_zod38.z.boolean(),
|
|
3002
|
+
hasSmartSearchEnabled: import_zod38.z.boolean(),
|
|
3003
|
+
id: import_zod38.z.coerce.number(),
|
|
3004
|
+
integrations: import_zod38.z.record(
|
|
3005
|
+
import_zod38.z.enum([
|
|
2853
3006
|
"attentive",
|
|
2854
3007
|
"judgeme",
|
|
2855
3008
|
"junip",
|
|
@@ -2862,46 +3015,46 @@ var ShopConfig = import_zod30.z.object({
|
|
|
2862
3015
|
"stamped",
|
|
2863
3016
|
"yotpo"
|
|
2864
3017
|
]),
|
|
2865
|
-
|
|
3018
|
+
import_zod38.z.union([import_zod38.z.boolean(), import_zod38.z.unknown()])
|
|
2866
3019
|
),
|
|
2867
|
-
markets:
|
|
2868
|
-
enabled:
|
|
3020
|
+
markets: import_zod38.z.object({
|
|
3021
|
+
enabled: import_zod38.z.boolean()
|
|
2869
3022
|
}),
|
|
2870
|
-
monetize:
|
|
2871
|
-
publisherKey:
|
|
3023
|
+
monetize: import_zod38.z.object({
|
|
3024
|
+
publisherKey: import_zod38.z.string().nullable()
|
|
2872
3025
|
}).nullish(),
|
|
2873
|
-
moneyFormat:
|
|
2874
|
-
myshopifyDomain:
|
|
2875
|
-
primaryLocale:
|
|
2876
|
-
productGroupsEnabled:
|
|
2877
|
-
rechargeCustomDomain:
|
|
2878
|
-
sellingPlansEnabled:
|
|
2879
|
-
shopId:
|
|
2880
|
-
shopifySellingPlansEnabled:
|
|
2881
|
-
shopName:
|
|
2882
|
-
storefrontAccessToken:
|
|
2883
|
-
useRebuyIcons:
|
|
3026
|
+
moneyFormat: import_zod38.z.string(),
|
|
3027
|
+
myshopifyDomain: import_zod38.z.string(),
|
|
3028
|
+
primaryLocale: import_zod38.z.string(),
|
|
3029
|
+
productGroupsEnabled: import_zod38.z.enum(["no", "yes"]).transform((value) => value === "yes"),
|
|
3030
|
+
rechargeCustomDomain: import_zod38.z.string().nullable(),
|
|
3031
|
+
sellingPlansEnabled: import_zod38.z.boolean(),
|
|
3032
|
+
shopId: import_zod38.z.number(),
|
|
3033
|
+
shopifySellingPlansEnabled: import_zod38.z.boolean(),
|
|
3034
|
+
shopName: import_zod38.z.string(),
|
|
3035
|
+
storefrontAccessToken: import_zod38.z.string().nullable(),
|
|
3036
|
+
useRebuyIcons: import_zod38.z.boolean()
|
|
2884
3037
|
});
|
|
2885
3038
|
|
|
2886
3039
|
// src/schema/userConfig.ts
|
|
2887
|
-
var
|
|
2888
|
-
var UserConfig =
|
|
3040
|
+
var import_zod39 = require("zod");
|
|
3041
|
+
var UserConfig = import_zod39.z.object({
|
|
2889
3042
|
shop: ShopConfig,
|
|
2890
3043
|
/**
|
|
2891
3044
|
* `.catch(undefined)` is the safety bar: smart-cart shape drift can NEVER fail `fetchUserConfig`,
|
|
2892
3045
|
* which resolves the apiKey for every offers/monetize/analytics/gift request.
|
|
2893
3046
|
*/
|
|
2894
3047
|
smartCart: SmartCartConfig.nullish().catch(void 0),
|
|
2895
|
-
smartFlows:
|
|
3048
|
+
smartFlows: import_zod39.z.array(import_zod39.z.unknown())
|
|
2896
3049
|
});
|
|
2897
3050
|
|
|
2898
3051
|
// src/schema/widgetData.ts
|
|
2899
|
-
var
|
|
3052
|
+
var import_zod67 = require("zod");
|
|
2900
3053
|
|
|
2901
3054
|
// src/schema/widgets/abTestingPlaceholder.ts
|
|
2902
|
-
var
|
|
2903
|
-
var ABTestingPlaceholder =
|
|
2904
|
-
type:
|
|
3055
|
+
var import_zod40 = require("zod");
|
|
3056
|
+
var ABTestingPlaceholder = import_zod40.z.looseObject({
|
|
3057
|
+
type: import_zod40.z.literal("placeholder")
|
|
2905
3058
|
});
|
|
2906
3059
|
|
|
2907
3060
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
@@ -2956,31 +3109,31 @@ var targetAreas = {
|
|
|
2956
3109
|
};
|
|
2957
3110
|
|
|
2958
3111
|
// src/schema/widgets/checkoutExtension.ts
|
|
2959
|
-
var
|
|
2960
|
-
var CheckoutExtension =
|
|
2961
|
-
type:
|
|
3112
|
+
var import_zod41 = require("zod");
|
|
3113
|
+
var CheckoutExtension = import_zod41.z.looseObject({
|
|
3114
|
+
type: import_zod41.z.literal(WidgetType.shopify_checkout_extension).default(WidgetType.shopify_checkout_extension)
|
|
2962
3115
|
});
|
|
2963
3116
|
|
|
2964
3117
|
// src/schema/widgets/contentBlock.ts
|
|
2965
|
-
var
|
|
3118
|
+
var import_zod61 = require("zod");
|
|
2966
3119
|
|
|
2967
3120
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
2968
|
-
var
|
|
3121
|
+
var import_zod60 = require("zod");
|
|
2969
3122
|
|
|
2970
3123
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
2971
3124
|
var import_uuid15 = require("uuid");
|
|
2972
|
-
var
|
|
3125
|
+
var import_zod59 = require("zod");
|
|
2973
3126
|
|
|
2974
3127
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
2975
|
-
var
|
|
3128
|
+
var import_zod58 = require("zod");
|
|
2976
3129
|
|
|
2977
3130
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
2978
|
-
var
|
|
2979
|
-
var CABBannerSection =
|
|
3131
|
+
var import_zod42 = require("zod");
|
|
3132
|
+
var CABBannerSection = import_zod42.z.lazy(
|
|
2980
3133
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
2981
|
-
buttonField:
|
|
2982
|
-
color:
|
|
2983
|
-
dismissible:
|
|
3134
|
+
buttonField: import_zod42.z.enum(buttonFields).optional(),
|
|
3135
|
+
color: import_zod42.z.enum(bannerColors).default("info"),
|
|
3136
|
+
dismissible: import_zod42.z.boolean().default(true),
|
|
2984
3137
|
/**
|
|
2985
3138
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
2986
3139
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -2996,18 +3149,18 @@ var CABBannerSection = import_zod34.z.lazy(
|
|
|
2996
3149
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
2997
3150
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
2998
3151
|
*/
|
|
2999
|
-
heading:
|
|
3000
|
-
sectionType:
|
|
3152
|
+
heading: import_zod42.z.record(import_zod42.z.string(), import_zod42.z.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
3153
|
+
sectionType: import_zod42.z.literal(SectionType.banner).default(SectionType.banner)
|
|
3001
3154
|
})
|
|
3002
3155
|
);
|
|
3003
3156
|
|
|
3004
3157
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
3005
3158
|
var import_uuid5 = require("uuid");
|
|
3006
|
-
var
|
|
3159
|
+
var import_zod44 = require("zod");
|
|
3007
3160
|
|
|
3008
3161
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
3009
3162
|
var import_uuid4 = require("uuid");
|
|
3010
|
-
var
|
|
3163
|
+
var import_zod43 = require("zod");
|
|
3011
3164
|
|
|
3012
3165
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
3013
3166
|
var iconNames = [
|
|
@@ -3094,17 +3247,17 @@ var iconTones = ["auto", "critical", "custom", "info", "neutral", "success", "wa
|
|
|
3094
3247
|
var IconTone = freezeEnum(iconTones);
|
|
3095
3248
|
|
|
3096
3249
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
3097
|
-
var CABImageSectionFields =
|
|
3250
|
+
var CABImageSectionFields = import_zod43.z.object({
|
|
3098
3251
|
...CABVariableFields,
|
|
3099
|
-
altText:
|
|
3252
|
+
altText: import_zod43.z.string().refine(checkForHTML, NO_HTML).default(""),
|
|
3100
3253
|
/**
|
|
3101
3254
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
3102
3255
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
3103
3256
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
3104
3257
|
*/
|
|
3105
|
-
aspectRatio:
|
|
3106
|
-
border:
|
|
3107
|
-
buttonField:
|
|
3258
|
+
aspectRatio: import_zod43.z.number().positive().nullable().default(null),
|
|
3259
|
+
border: import_zod43.z.lazy(() => CABBorder),
|
|
3260
|
+
buttonField: import_zod43.z.enum(buttonFields).optional(),
|
|
3108
3261
|
/**
|
|
3109
3262
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
3110
3263
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -3123,29 +3276,29 @@ var CABImageSectionFields = import_zod35.z.object({
|
|
|
3123
3276
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
3124
3277
|
* the risky half.
|
|
3125
3278
|
*/
|
|
3126
|
-
category:
|
|
3279
|
+
category: import_zod43.z.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
3127
3280
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
3128
|
-
iconSize:
|
|
3281
|
+
iconSize: import_zod43.z.enum(iconSizes).nullable().default(null),
|
|
3129
3282
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
3130
|
-
iconTone:
|
|
3131
|
-
name:
|
|
3132
|
-
naturalHeight:
|
|
3133
|
-
naturalWidth:
|
|
3283
|
+
iconTone: import_zod43.z.enum(iconTones).nullable().default(null),
|
|
3284
|
+
name: import_zod43.z.string().optional(),
|
|
3285
|
+
naturalHeight: import_zod43.z.number().default(0),
|
|
3286
|
+
naturalWidth: import_zod43.z.number().default(0),
|
|
3134
3287
|
/**
|
|
3135
3288
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
3136
3289
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
3137
3290
|
*/
|
|
3138
|
-
objectFit:
|
|
3139
|
-
sectionId:
|
|
3140
|
-
sectionType:
|
|
3291
|
+
objectFit: import_zod43.z.enum(objectFits).default(ObjectFit.contain),
|
|
3292
|
+
sectionId: import_zod43.z.uuid().default(() => (0, import_uuid4.v7)()),
|
|
3293
|
+
sectionType: import_zod43.z.literal(SectionType.image).default(SectionType.image),
|
|
3141
3294
|
/**
|
|
3142
3295
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
3143
3296
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
3144
3297
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
3145
3298
|
* server-chosen tier icon actually needs it.
|
|
3146
3299
|
*/
|
|
3147
|
-
source:
|
|
3148
|
-
width:
|
|
3300
|
+
source: import_zod43.z.union([import_zod43.z.url(), import_zod43.z.literal(""), import_zod43.z.string().regex(DYNAMIC_TOKEN_REGEX), import_zod43.z.enum(iconNames)]).default(""),
|
|
3301
|
+
width: import_zod43.z.number().default(100)
|
|
3149
3302
|
});
|
|
3150
3303
|
var iconNameSet = new Set(iconNames);
|
|
3151
3304
|
var isIconName = (source) => iconNameSet.has(source);
|
|
@@ -3165,35 +3318,35 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source }, c
|
|
|
3165
3318
|
});
|
|
3166
3319
|
|
|
3167
3320
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
3168
|
-
var CABButtonContent =
|
|
3169
|
-
() =>
|
|
3321
|
+
var CABButtonContent = import_zod44.z.lazy(
|
|
3322
|
+
() => import_zod44.z.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
3170
3323
|
);
|
|
3171
|
-
var CABButtonSection =
|
|
3324
|
+
var CABButtonSection = import_zod44.z.object({
|
|
3172
3325
|
...CABVariableFields,
|
|
3173
|
-
action:
|
|
3174
|
-
buttonStyle:
|
|
3175
|
-
custom:
|
|
3176
|
-
color:
|
|
3177
|
-
height:
|
|
3178
|
-
width:
|
|
3326
|
+
action: import_zod44.z.union([import_zod44.z.literal(""), import_zod44.z.enum(buttonActions)]).default(""),
|
|
3327
|
+
buttonStyle: import_zod44.z.enum(buttonStyles).default(ButtonStyle.primary),
|
|
3328
|
+
custom: import_zod44.z.object({
|
|
3329
|
+
color: import_zod44.z.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
3330
|
+
height: import_zod44.z.number().default(52),
|
|
3331
|
+
width: import_zod44.z.number().default(300)
|
|
3179
3332
|
}).default({
|
|
3180
3333
|
color: "#005bd3",
|
|
3181
3334
|
height: 52,
|
|
3182
3335
|
width: 300
|
|
3183
3336
|
}),
|
|
3184
|
-
disableDowngrade:
|
|
3185
|
-
name:
|
|
3186
|
-
optionId:
|
|
3187
|
-
popover:
|
|
3188
|
-
alignment:
|
|
3189
|
-
position:
|
|
3337
|
+
disableDowngrade: import_zod44.z.boolean().default(false),
|
|
3338
|
+
name: import_zod44.z.string().optional(),
|
|
3339
|
+
optionId: import_zod44.z.number().optional(),
|
|
3340
|
+
popover: import_zod44.z.object({
|
|
3341
|
+
alignment: import_zod44.z.enum(textAlignments).default(TextAlignment.center),
|
|
3342
|
+
position: import_zod44.z.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
3190
3343
|
}).optional().default(() => ({
|
|
3191
3344
|
alignment: TextAlignment.center,
|
|
3192
3345
|
position: PopoverPosition.blockStart
|
|
3193
3346
|
})),
|
|
3194
|
-
sectionId:
|
|
3195
|
-
sections:
|
|
3196
|
-
sectionType:
|
|
3347
|
+
sectionId: import_zod44.z.uuid().default(() => (0, import_uuid5.v7)()),
|
|
3348
|
+
sections: import_zod44.z.union([import_zod44.z.array(CABButtonContent), import_zod44.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
3349
|
+
sectionType: import_zod44.z.literal(SectionType.button).default(SectionType.button),
|
|
3197
3350
|
/**
|
|
3198
3351
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
3199
3352
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -3208,91 +3361,91 @@ var CABButtonSection = import_zod36.z.object({
|
|
|
3208
3361
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
3209
3362
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
3210
3363
|
*/
|
|
3211
|
-
tier:
|
|
3364
|
+
tier: import_zod44.z.object({ tierId: import_zod44.z.string().min(1) }).optional(),
|
|
3212
3365
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
3213
|
-
trackingUrl:
|
|
3366
|
+
trackingUrl: import_zod44.z.string().optional(),
|
|
3214
3367
|
/**
|
|
3215
3368
|
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
3216
3369
|
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
3217
3370
|
*/
|
|
3218
|
-
variableEffects:
|
|
3371
|
+
variableEffects: import_zod44.z.array(CABVariableEffect).optional()
|
|
3219
3372
|
});
|
|
3220
3373
|
|
|
3221
3374
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3222
|
-
var
|
|
3375
|
+
var import_zod49 = require("zod");
|
|
3223
3376
|
|
|
3224
3377
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3225
|
-
var
|
|
3378
|
+
var import_zod48 = require("zod");
|
|
3226
3379
|
|
|
3227
3380
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
3228
3381
|
var import_uuid6 = require("uuid");
|
|
3229
|
-
var
|
|
3230
|
-
var CABDiscount =
|
|
3231
|
-
amount:
|
|
3232
|
-
discountedBy:
|
|
3233
|
-
discountedFrom:
|
|
3234
|
-
type:
|
|
3235
|
-
});
|
|
3236
|
-
var CABIntegrations =
|
|
3237
|
-
judgeme:
|
|
3238
|
-
junip:
|
|
3239
|
-
klaviyo:
|
|
3240
|
-
loox:
|
|
3241
|
-
okendo:
|
|
3242
|
-
opinew:
|
|
3243
|
-
reviewsio:
|
|
3244
|
-
stamped:
|
|
3245
|
-
yotpo:
|
|
3246
|
-
});
|
|
3247
|
-
var CABDataSourceSection =
|
|
3248
|
-
dataSourceId:
|
|
3249
|
-
dataSourcePath:
|
|
3382
|
+
var import_zod45 = require("zod");
|
|
3383
|
+
var CABDiscount = import_zod45.z.object({
|
|
3384
|
+
amount: import_zod45.z.union([import_zod45.z.number(), import_zod45.z.string()]).catch(0),
|
|
3385
|
+
discountedBy: import_zod45.z.string().optional(),
|
|
3386
|
+
discountedFrom: import_zod45.z.enum(discountSources).optional().catch(void 0),
|
|
3387
|
+
type: import_zod45.z.enum(discountTypes).catch("none")
|
|
3388
|
+
});
|
|
3389
|
+
var CABIntegrations = import_zod45.z.object({
|
|
3390
|
+
judgeme: import_zod45.z.boolean().default(false),
|
|
3391
|
+
junip: import_zod45.z.boolean().default(false),
|
|
3392
|
+
klaviyo: import_zod45.z.boolean().default(false),
|
|
3393
|
+
loox: import_zod45.z.boolean().default(false),
|
|
3394
|
+
okendo: import_zod45.z.boolean().default(false),
|
|
3395
|
+
opinew: import_zod45.z.boolean().default(false),
|
|
3396
|
+
reviewsio: import_zod45.z.boolean().default(false),
|
|
3397
|
+
stamped: import_zod45.z.boolean().default(false),
|
|
3398
|
+
yotpo: import_zod45.z.boolean().default(false)
|
|
3399
|
+
});
|
|
3400
|
+
var CABDataSourceSection = import_zod45.z.object({
|
|
3401
|
+
dataSourceId: import_zod45.z.number().nullable().default(null),
|
|
3402
|
+
dataSourcePath: import_zod45.z.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
3250
3403
|
discount: CABDiscount.optional(),
|
|
3251
3404
|
integrations: CABIntegrations.optional(),
|
|
3252
|
-
limit:
|
|
3253
|
-
matchVariant:
|
|
3254
|
-
matchVariantOutOfStock:
|
|
3255
|
-
name:
|
|
3256
|
-
productType:
|
|
3257
|
-
sectionId:
|
|
3258
|
-
sectionType:
|
|
3405
|
+
limit: import_zod45.z.number().default(1),
|
|
3406
|
+
matchVariant: import_zod45.z.boolean().default(false),
|
|
3407
|
+
matchVariantOutOfStock: import_zod45.z.boolean().default(false),
|
|
3408
|
+
name: import_zod45.z.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
3409
|
+
productType: import_zod45.z.enum(productTypes).optional(),
|
|
3410
|
+
sectionId: import_zod45.z.uuid().default(() => (0, import_uuid6.v7)()),
|
|
3411
|
+
sectionType: import_zod45.z.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
3259
3412
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
3260
|
-
subscriptionIsDefault:
|
|
3261
|
-
treatAsGwp:
|
|
3413
|
+
subscriptionIsDefault: import_zod45.z.boolean().default(false),
|
|
3414
|
+
treatAsGwp: import_zod45.z.boolean().default(false)
|
|
3262
3415
|
});
|
|
3263
3416
|
|
|
3264
3417
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3265
3418
|
var import_uuid8 = require("uuid");
|
|
3266
|
-
var
|
|
3419
|
+
var import_zod47 = require("zod");
|
|
3267
3420
|
|
|
3268
3421
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
3269
3422
|
var import_uuid7 = require("uuid");
|
|
3270
|
-
var
|
|
3271
|
-
var CABVariantContent =
|
|
3272
|
-
() =>
|
|
3423
|
+
var import_zod46 = require("zod");
|
|
3424
|
+
var CABVariantContent = import_zod46.z.lazy(
|
|
3425
|
+
() => import_zod46.z.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
3273
3426
|
);
|
|
3274
|
-
var CABProductSection =
|
|
3427
|
+
var CABProductSection = import_zod46.z.object({
|
|
3275
3428
|
...CABVariableFields,
|
|
3276
|
-
name:
|
|
3277
|
-
productId:
|
|
3278
|
-
sectionId:
|
|
3279
|
-
sections:
|
|
3280
|
-
sectionType:
|
|
3281
|
-
selectors:
|
|
3282
|
-
variantMode:
|
|
3429
|
+
name: import_zod46.z.string().optional(),
|
|
3430
|
+
productId: import_zod46.z.number().nullable().default(null),
|
|
3431
|
+
sectionId: import_zod46.z.uuid().default(() => (0, import_uuid7.v7)()),
|
|
3432
|
+
sections: import_zod46.z.union([import_zod46.z.array(CABVariantContent), import_zod46.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
3433
|
+
sectionType: import_zod46.z.literal(SectionType.product).default(SectionType.product),
|
|
3434
|
+
selectors: import_zod46.z.record(import_zod46.z.string(), import_zod46.z.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
3435
|
+
variantMode: import_zod46.z.enum(variantModes).default(VariantMode.multiple)
|
|
3283
3436
|
});
|
|
3284
3437
|
|
|
3285
3438
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3286
|
-
var CABProductsSection =
|
|
3439
|
+
var CABProductsSection = import_zod47.z.object({
|
|
3287
3440
|
...CABVariableFields,
|
|
3288
|
-
name:
|
|
3289
|
-
sectionId:
|
|
3290
|
-
sections:
|
|
3291
|
-
sectionType:
|
|
3441
|
+
name: import_zod47.z.string().optional(),
|
|
3442
|
+
sectionId: import_zod47.z.uuid().default(() => (0, import_uuid8.v7)()),
|
|
3443
|
+
sections: import_zod47.z.union([import_zod47.z.array(import_zod47.z.lazy(() => CABProductSection)), import_zod47.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
3444
|
+
sectionType: import_zod47.z.literal(SectionType.products).default(SectionType.products)
|
|
3292
3445
|
});
|
|
3293
3446
|
|
|
3294
3447
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3295
|
-
var CABOffersSection =
|
|
3448
|
+
var CABOffersSection = import_zod48.z.lazy(
|
|
3296
3449
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3297
3450
|
/**
|
|
3298
3451
|
* A rule between consecutive cards in the vertical list — legacy checkout-offers' `<Divider />`,
|
|
@@ -3300,8 +3453,8 @@ var CABOffersSection = import_zod40.z.lazy(
|
|
|
3300
3453
|
* run of products). Optional, not defaulted: only the v1 converter sets it (REB-24265); a
|
|
3301
3454
|
* hand-built tree keeps React CAB's dividerless rendering.
|
|
3302
3455
|
*/
|
|
3303
|
-
divider:
|
|
3304
|
-
sections:
|
|
3456
|
+
divider: import_zod48.z.boolean().optional(),
|
|
3457
|
+
sections: import_zod48.z.union([import_zod48.z.array(import_zod48.z.lazy(() => CABSection)), import_zod48.z.strictObject({}).transform(() => [])]).default(() => [
|
|
3305
3458
|
CABBannerSection.parse({
|
|
3306
3459
|
buttonField: "undoAddToOrder",
|
|
3307
3460
|
color: "success",
|
|
@@ -3315,77 +3468,77 @@ var CABOffersSection = import_zod40.z.lazy(
|
|
|
3315
3468
|
CABDataSourceSection.parse({}),
|
|
3316
3469
|
CABProductsSection.parse({})
|
|
3317
3470
|
]),
|
|
3318
|
-
sectionType:
|
|
3471
|
+
sectionType: import_zod48.z.literal(SectionType.offers).default(SectionType.offers)
|
|
3319
3472
|
})
|
|
3320
3473
|
);
|
|
3321
3474
|
|
|
3322
3475
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3323
|
-
var CABCarouselSection =
|
|
3476
|
+
var CABCarouselSection = import_zod49.z.lazy(
|
|
3324
3477
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3325
|
-
autoAdvanceInterval:
|
|
3326
|
-
itemsAtOnce:
|
|
3478
|
+
autoAdvanceInterval: import_zod49.z.number().default(0),
|
|
3479
|
+
itemsAtOnce: import_zod49.z.number().min(1).default(1),
|
|
3327
3480
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
3328
|
-
offersDirection:
|
|
3329
|
-
sections:
|
|
3330
|
-
sectionType:
|
|
3481
|
+
offersDirection: import_zod49.z.enum(offersDirections).default("vertical"),
|
|
3482
|
+
sections: import_zod49.z.union([import_zod49.z.array(import_zod49.z.lazy(() => CABSection)), import_zod49.z.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
3483
|
+
sectionType: import_zod49.z.literal(SectionType.carousel).default(SectionType.carousel)
|
|
3331
3484
|
})
|
|
3332
3485
|
);
|
|
3333
3486
|
|
|
3334
3487
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
3335
|
-
var
|
|
3336
|
-
var CABCartLineSection =
|
|
3488
|
+
var import_zod50 = require("zod");
|
|
3489
|
+
var CABCartLineSection = import_zod50.z.lazy(
|
|
3337
3490
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3338
|
-
sections:
|
|
3339
|
-
sectionType:
|
|
3491
|
+
sections: import_zod50.z.union([import_zod50.z.array(import_zod50.z.lazy(() => CABSection)), import_zod50.z.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
3492
|
+
sectionType: import_zod50.z.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
3340
3493
|
})
|
|
3341
3494
|
);
|
|
3342
3495
|
|
|
3343
3496
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
3344
3497
|
var import_uuid9 = require("uuid");
|
|
3345
|
-
var
|
|
3346
|
-
var CABDiscountSection =
|
|
3498
|
+
var import_zod51 = require("zod");
|
|
3499
|
+
var CABDiscountSection = import_zod51.z.object({
|
|
3347
3500
|
...CABVariableFields,
|
|
3348
|
-
amount:
|
|
3349
|
-
discountedBy:
|
|
3350
|
-
discountedFrom:
|
|
3351
|
-
message:
|
|
3352
|
-
name:
|
|
3353
|
-
quantity:
|
|
3354
|
-
sectionId:
|
|
3355
|
-
sectionType:
|
|
3356
|
-
type:
|
|
3501
|
+
amount: import_zod51.z.union([import_zod51.z.number(), import_zod51.z.string()]).catch(0),
|
|
3502
|
+
discountedBy: import_zod51.z.string().optional(),
|
|
3503
|
+
discountedFrom: import_zod51.z.enum(discountSources).optional().catch(void 0),
|
|
3504
|
+
message: import_zod51.z.string().optional(),
|
|
3505
|
+
name: import_zod51.z.string().optional(),
|
|
3506
|
+
quantity: import_zod51.z.number().default(1),
|
|
3507
|
+
sectionId: import_zod51.z.uuid().default(() => (0, import_uuid9.v7)()),
|
|
3508
|
+
sectionType: import_zod51.z.literal(SectionType.discount).default(SectionType.discount),
|
|
3509
|
+
type: import_zod51.z.enum(discountTypes).catch("none")
|
|
3357
3510
|
});
|
|
3358
3511
|
|
|
3359
3512
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
3360
3513
|
var import_uuid10 = require("uuid");
|
|
3361
|
-
var
|
|
3362
|
-
var CABMonetizeAds =
|
|
3363
|
-
requestId:
|
|
3514
|
+
var import_zod52 = require("zod");
|
|
3515
|
+
var CABMonetizeAds = import_zod52.z.object({
|
|
3516
|
+
requestId: import_zod52.z.string().optional(),
|
|
3364
3517
|
/** Defaulted here, never in the beacon: absence of information is `ads` itself being absent. */
|
|
3365
|
-
testing:
|
|
3518
|
+
testing: import_zod52.z.boolean().default(false)
|
|
3366
3519
|
});
|
|
3367
|
-
var CABMonetizeSection =
|
|
3520
|
+
var CABMonetizeSection = import_zod52.z.object({
|
|
3368
3521
|
...CABVariableFields,
|
|
3369
3522
|
ads: CABMonetizeAds.optional(),
|
|
3370
|
-
name:
|
|
3523
|
+
name: import_zod52.z.string().optional(),
|
|
3371
3524
|
/**
|
|
3372
3525
|
* Server-hydrated offer cards (inline hydration): when `/cab/sections` was asked with a `monetize`
|
|
3373
3526
|
* context block, the composed cards ride the marker itself — `[]` means "hydrated, no fill" (render
|
|
3374
3527
|
* nothing, skip the fetch); ABSENT means "not hydrated" (the client fetches via `/cab/monetize`).
|
|
3375
3528
|
*/
|
|
3376
|
-
offers:
|
|
3529
|
+
offers: import_zod52.z.array(import_zod52.z.lazy(() => CABSection)).optional(),
|
|
3377
3530
|
/** 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. */
|
|
3378
|
-
privacyPolicyUrl:
|
|
3379
|
-
sectionId:
|
|
3380
|
-
sectionType:
|
|
3531
|
+
privacyPolicyUrl: import_zod52.z.string().optional(),
|
|
3532
|
+
sectionId: import_zod52.z.uuid().default(() => (0, import_uuid10.v7)()),
|
|
3533
|
+
sectionType: import_zod52.z.literal(SectionType.monetize).default(SectionType.monetize),
|
|
3381
3534
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
3382
|
-
subVertical:
|
|
3535
|
+
subVertical: import_zod52.z.string().optional(),
|
|
3383
3536
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
3384
|
-
vertical:
|
|
3537
|
+
vertical: import_zod52.z.string().optional()
|
|
3385
3538
|
});
|
|
3386
3539
|
|
|
3387
3540
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3388
|
-
var
|
|
3541
|
+
var import_zod53 = require("zod");
|
|
3389
3542
|
|
|
3390
3543
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
3391
3544
|
var GIFT_LABELS = {
|
|
@@ -3504,34 +3657,34 @@ var GIFT_LABELS = {
|
|
|
3504
3657
|
};
|
|
3505
3658
|
|
|
3506
3659
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3507
|
-
var CABProgressTierExclusion =
|
|
3508
|
-
collectionIds:
|
|
3509
|
-
productIds:
|
|
3510
|
-
tags:
|
|
3511
|
-
type:
|
|
3660
|
+
var CABProgressTierExclusion = import_zod53.z.object({
|
|
3661
|
+
collectionIds: import_zod53.z.array(import_zod53.z.number().int().positive()).default(() => []),
|
|
3662
|
+
productIds: import_zod53.z.array(import_zod53.z.number().int().positive()).default(() => []),
|
|
3663
|
+
tags: import_zod53.z.array(import_zod53.z.string().min(1)).default(() => []),
|
|
3664
|
+
type: import_zod53.z.enum(progressTierExclusionTypes)
|
|
3512
3665
|
});
|
|
3513
|
-
var CABProgressTier =
|
|
3666
|
+
var CABProgressTier = import_zod53.z.object({
|
|
3514
3667
|
/**
|
|
3515
3668
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
3516
3669
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
3517
3670
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
3518
3671
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
3519
3672
|
*/
|
|
3520
|
-
discount:
|
|
3673
|
+
discount: import_zod53.z.object({ amount: import_zod53.z.number().nonnegative(), type: import_zod53.z.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
3521
3674
|
/**
|
|
3522
3675
|
* Per-tier exclusion rules (onsite `exclusions` when `exclusions_enabled`): lines they match don't count
|
|
3523
3676
|
* toward this tier. Empty (the default, and the converter's output for a disabled or ruleless tier) means
|
|
3524
3677
|
* the tier measures the plain bar-level adjusted progress. Consumers read ONLY the list named by the rule's
|
|
3525
3678
|
* `type` — the converter leaves the other two at `[]`, so a populated off-type list never reaches the tree.
|
|
3526
3679
|
*/
|
|
3527
|
-
exclusions:
|
|
3680
|
+
exclusions: import_zod53.z.array(CABProgressTierExclusion).default(() => []),
|
|
3528
3681
|
/**
|
|
3529
3682
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
3530
3683
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
3531
3684
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
3532
3685
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
3533
3686
|
*/
|
|
3534
|
-
filterOosVariants:
|
|
3687
|
+
filterOosVariants: import_zod53.z.boolean().default(false),
|
|
3535
3688
|
/**
|
|
3536
3689
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
3537
3690
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -3539,10 +3692,10 @@ var CABProgressTier = import_zod45.z.object({
|
|
|
3539
3692
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
3540
3693
|
* tree is complete.
|
|
3541
3694
|
*/
|
|
3542
|
-
gift:
|
|
3543
|
-
productId:
|
|
3544
|
-
title:
|
|
3545
|
-
variantIds:
|
|
3695
|
+
gift: import_zod53.z.object({
|
|
3696
|
+
productId: import_zod53.z.number().int().positive(),
|
|
3697
|
+
title: import_zod53.z.string().optional(),
|
|
3698
|
+
variantIds: import_zod53.z.array(import_zod53.z.number().int().positive()).default(() => [])
|
|
3546
3699
|
}).optional(),
|
|
3547
3700
|
/**
|
|
3548
3701
|
* The step-row icon's square size in PIXELS (onsite `product_tier_element_size`, an admin px string the
|
|
@@ -3562,7 +3715,7 @@ var CABProgressTier = import_zod45.z.object({
|
|
|
3562
3715
|
* renderer never spells a fallback), which also makes a tree authored before this field render at
|
|
3563
3716
|
* React's size rather than the old hardcoded 20.
|
|
3564
3717
|
*/
|
|
3565
|
-
iconSizePx:
|
|
3718
|
+
iconSizePx: import_zod53.z.number().int().min(1).max(64).default(18),
|
|
3566
3719
|
/**
|
|
3567
3720
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
3568
3721
|
* type default — 'Free Shipping' or '{n}% Discount'. A PRODUCT tier gets NO converter label: its name is
|
|
@@ -3572,35 +3725,35 @@ var CABProgressTier = import_zod45.z.object({
|
|
|
3572
3725
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
3573
3726
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
3574
3727
|
*/
|
|
3575
|
-
label:
|
|
3728
|
+
label: import_zod53.z.record(import_zod53.z.string(), import_zod53.z.string()).optional(),
|
|
3576
3729
|
/**
|
|
3577
3730
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
3578
3731
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
3579
3732
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
3580
3733
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
3581
3734
|
*/
|
|
3582
|
-
productTierImage:
|
|
3735
|
+
productTierImage: import_zod53.z.boolean().default(false),
|
|
3583
3736
|
/**
|
|
3584
3737
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
3585
3738
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
3586
3739
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
3587
3740
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
3588
3741
|
*/
|
|
3589
|
-
threshold:
|
|
3742
|
+
threshold: import_zod53.z.number().int().nonnegative(),
|
|
3590
3743
|
/**
|
|
3591
3744
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
3592
3745
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
3593
3746
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
3594
3747
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
3595
3748
|
*/
|
|
3596
|
-
thresholds:
|
|
3749
|
+
thresholds: import_zod53.z.record(import_zod53.z.string(), import_zod53.z.number().int().nonnegative()).default(() => ({})),
|
|
3597
3750
|
/**
|
|
3598
3751
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
3599
3752
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
3600
3753
|
* shipping bar (single unlabeled tier, no gift).
|
|
3601
3754
|
*/
|
|
3602
|
-
tierId:
|
|
3603
|
-
tierType:
|
|
3755
|
+
tierId: import_zod53.z.string().optional(),
|
|
3756
|
+
tierType: import_zod53.z.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
3604
3757
|
/**
|
|
3605
3758
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
3606
3759
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -3611,9 +3764,9 @@ var CABProgressTier = import_zod45.z.object({
|
|
|
3611
3764
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
3612
3765
|
* template text supplies grammatically-neutral wording around the token.
|
|
3613
3766
|
*/
|
|
3614
|
-
unit:
|
|
3767
|
+
unit: import_zod53.z.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
3615
3768
|
});
|
|
3616
|
-
var CABProgressBarSection =
|
|
3769
|
+
var CABProgressBarSection = import_zod53.z.lazy(
|
|
3617
3770
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
3618
3771
|
/**
|
|
3619
3772
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -3622,35 +3775,35 @@ var CABProgressBarSection = import_zod45.z.lazy(
|
|
|
3622
3775
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
3623
3776
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
3624
3777
|
*/
|
|
3625
|
-
barId:
|
|
3778
|
+
barId: import_zod53.z.string().optional(),
|
|
3626
3779
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
3627
|
-
countryCodes:
|
|
3780
|
+
countryCodes: import_zod53.z.array(import_zod53.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3628
3781
|
/**
|
|
3629
3782
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
3630
3783
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
3631
3784
|
*/
|
|
3632
|
-
excludeCountryCodes:
|
|
3785
|
+
excludeCountryCodes: import_zod53.z.array(import_zod53.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3633
3786
|
/**
|
|
3634
3787
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
3635
3788
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
3636
3789
|
* adds the cart's discount allocations back to the live subtotal.
|
|
3637
3790
|
*/
|
|
3638
|
-
excludeDiscountInSubtotal:
|
|
3791
|
+
excludeDiscountInSubtotal: import_zod53.z.boolean().default(false),
|
|
3639
3792
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
3640
|
-
excludedVariantIds:
|
|
3793
|
+
excludedVariantIds: import_zod53.z.array(import_zod53.z.number().int().positive()).default(() => []),
|
|
3641
3794
|
/**
|
|
3642
3795
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
3643
3796
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
3644
3797
|
*/
|
|
3645
|
-
freeShippingOnSubscription:
|
|
3798
|
+
freeShippingOnSubscription: import_zod53.z.boolean().default(false),
|
|
3646
3799
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
3647
|
-
giftAreaTitle:
|
|
3800
|
+
giftAreaTitle: import_zod53.z.record(import_zod53.z.string(), import_zod53.z.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
3648
3801
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
3649
|
-
giftLabels:
|
|
3650
|
-
addGift:
|
|
3651
|
-
remove:
|
|
3652
|
-
selectOptions:
|
|
3653
|
-
yourGift:
|
|
3802
|
+
giftLabels: import_zod53.z.object({
|
|
3803
|
+
addGift: import_zod53.z.record(import_zod53.z.string(), import_zod53.z.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
3804
|
+
remove: import_zod53.z.record(import_zod53.z.string(), import_zod53.z.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
3805
|
+
selectOptions: import_zod53.z.record(import_zod53.z.string(), import_zod53.z.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
3806
|
+
yourGift: import_zod53.z.record(import_zod53.z.string(), import_zod53.z.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
3654
3807
|
}).default(() => ({
|
|
3655
3808
|
addGift: { ...GIFT_LABELS.addGift },
|
|
3656
3809
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -3658,38 +3811,38 @@ var CABProgressBarSection = import_zod45.z.lazy(
|
|
|
3658
3811
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
3659
3812
|
})),
|
|
3660
3813
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
3661
|
-
name:
|
|
3814
|
+
name: import_zod53.z.string().default("Order progress"),
|
|
3662
3815
|
/**
|
|
3663
3816
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
3664
3817
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
3665
3818
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
3666
3819
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
3667
3820
|
*/
|
|
3668
|
-
progressColor:
|
|
3669
|
-
sectionType:
|
|
3821
|
+
progressColor: import_zod53.z.string().optional(),
|
|
3822
|
+
sectionType: import_zod53.z.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
3670
3823
|
/**
|
|
3671
3824
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
3672
3825
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
3673
3826
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
3674
3827
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
3675
3828
|
*/
|
|
3676
|
-
tiers:
|
|
3829
|
+
tiers: import_zod53.z.union([import_zod53.z.array(CABProgressTier), import_zod53.z.strictObject({}).transform(() => [])]).default(() => [])
|
|
3677
3830
|
})
|
|
3678
3831
|
);
|
|
3679
3832
|
|
|
3680
3833
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
3681
3834
|
var import_uuid11 = require("uuid");
|
|
3682
|
-
var
|
|
3683
|
-
var CABQuantitySection =
|
|
3835
|
+
var import_zod54 = require("zod");
|
|
3836
|
+
var CABQuantitySection = import_zod54.z.object({
|
|
3684
3837
|
...CABVariableFields,
|
|
3685
|
-
errorMessages:
|
|
3686
|
-
|
|
3687
|
-
|
|
3838
|
+
errorMessages: import_zod54.z.record(
|
|
3839
|
+
import_zod54.z.string(),
|
|
3840
|
+
import_zod54.z.object({
|
|
3688
3841
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
3689
|
-
increment:
|
|
3690
|
-
max:
|
|
3691
|
-
min:
|
|
3692
|
-
neg:
|
|
3842
|
+
increment: import_zod54.z.string().optional(),
|
|
3843
|
+
max: import_zod54.z.string().optional(),
|
|
3844
|
+
min: import_zod54.z.string().optional(),
|
|
3845
|
+
neg: import_zod54.z.string().optional()
|
|
3693
3846
|
})
|
|
3694
3847
|
).default({
|
|
3695
3848
|
en: {
|
|
@@ -3699,18 +3852,18 @@ var CABQuantitySection = import_zod46.z.object({
|
|
|
3699
3852
|
neg: "Quantity cannot be negative"
|
|
3700
3853
|
}
|
|
3701
3854
|
}),
|
|
3702
|
-
inputType:
|
|
3703
|
-
max:
|
|
3704
|
-
min:
|
|
3855
|
+
inputType: import_zod54.z.enum(quantityInputs).default(QuantityInput.select),
|
|
3856
|
+
max: import_zod54.z.number().min(1).max(100).default(10),
|
|
3857
|
+
min: import_zod54.z.number().min(1).default(1),
|
|
3705
3858
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
3706
|
-
name:
|
|
3707
|
-
sectionId:
|
|
3708
|
-
sectionType:
|
|
3859
|
+
name: import_zod54.z.string().default("Quantity"),
|
|
3860
|
+
sectionId: import_zod54.z.uuid().default(() => (0, import_uuid11.v7)()),
|
|
3861
|
+
sectionType: import_zod54.z.literal(SectionType.quantity).default(SectionType.quantity)
|
|
3709
3862
|
});
|
|
3710
3863
|
|
|
3711
3864
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3712
3865
|
var import_uuid12 = require("uuid");
|
|
3713
|
-
var
|
|
3866
|
+
var import_zod55 = require("zod");
|
|
3714
3867
|
|
|
3715
3868
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
3716
3869
|
var REVIEW_LABELS = {
|
|
@@ -3773,68 +3926,68 @@ var REVIEW_LABELS = {
|
|
|
3773
3926
|
};
|
|
3774
3927
|
|
|
3775
3928
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3776
|
-
var CABReviewsSection =
|
|
3929
|
+
var CABReviewsSection = import_zod55.z.object({
|
|
3777
3930
|
...CABVariableFields,
|
|
3778
|
-
color:
|
|
3931
|
+
color: import_zod55.z.string().default("#fadb14"),
|
|
3779
3932
|
/**
|
|
3780
3933
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
3781
3934
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
3782
3935
|
* or merchant work.
|
|
3783
3936
|
*/
|
|
3784
|
-
countLabels:
|
|
3785
|
-
one:
|
|
3786
|
-
other:
|
|
3937
|
+
countLabels: import_zod55.z.object({
|
|
3938
|
+
one: import_zod55.z.record(import_zod55.z.string(), import_zod55.z.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
3939
|
+
other: import_zod55.z.record(import_zod55.z.string(), import_zod55.z.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
3787
3940
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
3788
|
-
name:
|
|
3789
|
-
sectionId:
|
|
3790
|
-
sectionType:
|
|
3791
|
-
size:
|
|
3941
|
+
name: import_zod55.z.string().optional(),
|
|
3942
|
+
sectionId: import_zod55.z.uuid().default(() => (0, import_uuid12.v7)()),
|
|
3943
|
+
sectionType: import_zod55.z.literal(SectionType.reviews).default(SectionType.reviews),
|
|
3944
|
+
size: import_zod55.z.enum(reviewsSizes).default(ReviewsSize.default),
|
|
3792
3945
|
/**
|
|
3793
3946
|
* Star outline color, interpolated into a style by the renderer, so it is hex-constrained like
|
|
3794
3947
|
* `CABButtonSection.color`. The legacy source (`PostPurchaseSettings.styles.starStrokeColor`) is a free
|
|
3795
3948
|
* string: its converter must validate and fall back to this default rather than let one odd value drop
|
|
3796
3949
|
* the whole reviews section.
|
|
3797
3950
|
*/
|
|
3798
|
-
strokeColor:
|
|
3951
|
+
strokeColor: import_zod55.z.string().regex(HEX_COLOR_REGEX).default("#fadb14"),
|
|
3799
3952
|
/** Star outline width in px; `0` draws no outline. The legacy `styles.strokeWidth` is a STRING ('1') — its converter coerces. */
|
|
3800
|
-
strokeWidth:
|
|
3953
|
+
strokeWidth: import_zod55.z.number().nonnegative().default(0)
|
|
3801
3954
|
});
|
|
3802
3955
|
|
|
3803
3956
|
// src/schema/widgets/checkout-and-beyond/separator.ts
|
|
3804
3957
|
var import_uuid13 = require("uuid");
|
|
3805
|
-
var
|
|
3806
|
-
var CABSeparatorSection =
|
|
3958
|
+
var import_zod56 = require("zod");
|
|
3959
|
+
var CABSeparatorSection = import_zod56.z.object({
|
|
3807
3960
|
...CABVariableFields,
|
|
3808
|
-
sectionId:
|
|
3809
|
-
sectionType:
|
|
3961
|
+
sectionId: import_zod56.z.uuid().default(() => (0, import_uuid13.v7)()),
|
|
3962
|
+
sectionType: import_zod56.z.literal(SectionType.separator).default(SectionType.separator)
|
|
3810
3963
|
});
|
|
3811
3964
|
|
|
3812
3965
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
3813
3966
|
var import_compat5 = require("es-toolkit/compat");
|
|
3814
3967
|
var import_uuid14 = require("uuid");
|
|
3815
|
-
var
|
|
3816
|
-
var CABVariantsSection =
|
|
3968
|
+
var import_zod57 = require("zod");
|
|
3969
|
+
var CABVariantsSection = import_zod57.z.object({
|
|
3817
3970
|
...CABVariableFields,
|
|
3818
|
-
hideOutOfStockVariants:
|
|
3819
|
-
name:
|
|
3820
|
-
sectionId:
|
|
3821
|
-
sectionType:
|
|
3822
|
-
selector:
|
|
3823
|
-
variantMode:
|
|
3971
|
+
hideOutOfStockVariants: import_zod57.z.boolean().default(false),
|
|
3972
|
+
name: import_zod57.z.string().optional(),
|
|
3973
|
+
sectionId: import_zod57.z.uuid().default(() => (0, import_uuid14.v7)()),
|
|
3974
|
+
sectionType: import_zod57.z.literal(SectionType.variants).default(SectionType.variants),
|
|
3975
|
+
selector: import_zod57.z.enum((0, import_compat5.slice)(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
3976
|
+
variantMode: import_zod57.z.enum(variantModes).default(VariantMode.multiple)
|
|
3824
3977
|
});
|
|
3825
3978
|
|
|
3826
3979
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
3827
|
-
var CABBorder =
|
|
3828
|
-
radius:
|
|
3829
|
-
style:
|
|
3830
|
-
width:
|
|
3980
|
+
var CABBorder = import_zod58.z.object({
|
|
3981
|
+
radius: import_zod58.z.enum(borderRadii).default(BorderRadius.base),
|
|
3982
|
+
style: import_zod58.z.enum(borderStyles).default(BorderStyle.none),
|
|
3983
|
+
width: import_zod58.z.enum(borderWidths).default(BorderWidth.base)
|
|
3831
3984
|
}).default({
|
|
3832
3985
|
radius: BorderRadius.base,
|
|
3833
3986
|
style: BorderStyle.none,
|
|
3834
3987
|
width: BorderWidth.base
|
|
3835
3988
|
});
|
|
3836
|
-
var CABSection =
|
|
3837
|
-
() =>
|
|
3989
|
+
var CABSection = import_zod58.z.lazy(
|
|
3990
|
+
() => import_zod58.z.discriminatedUnion("sectionType", [
|
|
3838
3991
|
CABBannerSection,
|
|
3839
3992
|
CABButtonSection,
|
|
3840
3993
|
CABCarouselSection,
|
|
@@ -3857,41 +4010,41 @@ var CABSection = import_zod50.z.lazy(
|
|
|
3857
4010
|
);
|
|
3858
4011
|
|
|
3859
4012
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
3860
|
-
var GridItem =
|
|
3861
|
-
var CABLayoutWrapping =
|
|
3862
|
-
breakAt:
|
|
3863
|
-
maxPerLine:
|
|
4013
|
+
var GridItem = import_zod59.z.union([import_zod59.z.literal("auto"), import_zod59.z.literal("fill"), import_zod59.z.string().regex(/^\d+%$/), import_zod59.z.number()]);
|
|
4014
|
+
var CABLayoutWrapping = import_zod59.z.object({
|
|
4015
|
+
breakAt: import_zod59.z.number().positive(),
|
|
4016
|
+
maxPerLine: import_zod59.z.number().int().positive()
|
|
3864
4017
|
});
|
|
3865
|
-
var CABLayoutSection =
|
|
4018
|
+
var CABLayoutSection = import_zod59.z.object({
|
|
3866
4019
|
...CABVariableFields,
|
|
3867
|
-
alignment:
|
|
3868
|
-
horizontal:
|
|
3869
|
-
vertical:
|
|
4020
|
+
alignment: import_zod59.z.object({
|
|
4021
|
+
horizontal: import_zod59.z.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
4022
|
+
vertical: import_zod59.z.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
3870
4023
|
}).default({
|
|
3871
4024
|
horizontal: HorizontalAlignment.start,
|
|
3872
4025
|
vertical: VerticalAlignment.top
|
|
3873
4026
|
}),
|
|
3874
|
-
border:
|
|
3875
|
-
buttonField:
|
|
3876
|
-
direction:
|
|
4027
|
+
border: import_zod59.z.lazy(() => CABBorder),
|
|
4028
|
+
buttonField: import_zod59.z.enum(buttonFields).optional(),
|
|
4029
|
+
direction: import_zod59.z.enum(directions).default(Direction.rows),
|
|
3877
4030
|
/**
|
|
3878
4031
|
* Platform chrome around the section, not a layout behavior: `callout` is a subdued box with block borders
|
|
3879
4032
|
* (the legacy post-purchase callout banner), `offer-content` the post-purchase offer's own content card.
|
|
3880
4033
|
*/
|
|
3881
|
-
frame:
|
|
3882
|
-
grid:
|
|
3883
|
-
columns:
|
|
3884
|
-
rows:
|
|
4034
|
+
frame: import_zod59.z.enum(layoutFrames).optional(),
|
|
4035
|
+
grid: import_zod59.z.object({
|
|
4036
|
+
columns: import_zod59.z.union([import_zod59.z.array(GridItem), import_zod59.z.undefined()]).default(() => ["auto"]),
|
|
4037
|
+
rows: import_zod59.z.union([import_zod59.z.array(GridItem), import_zod59.z.undefined()]).default(() => ["auto"])
|
|
3885
4038
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
3886
|
-
name:
|
|
3887
|
-
padding:
|
|
3888
|
-
sectionId:
|
|
3889
|
-
sections:
|
|
3890
|
-
sectionType:
|
|
3891
|
-
spacing:
|
|
4039
|
+
name: import_zod59.z.string().optional(),
|
|
4040
|
+
padding: import_zod59.z.enum(spacings).default(Spacing.none),
|
|
4041
|
+
sectionId: import_zod59.z.uuid().default(() => (0, import_uuid15.v7)()),
|
|
4042
|
+
sections: import_zod59.z.union([import_zod59.z.array(import_zod59.z.lazy(() => CABSection)), import_zod59.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
4043
|
+
sectionType: import_zod59.z.literal(SectionType.layout).default(SectionType.layout),
|
|
4044
|
+
spacing: import_zod59.z.enum(spacings).default(Spacing.base),
|
|
3892
4045
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
3893
|
-
viewUrl:
|
|
3894
|
-
width:
|
|
4046
|
+
viewUrl: import_zod59.z.string().optional(),
|
|
4047
|
+
width: import_zod59.z.number().default(100),
|
|
3895
4048
|
wrapping: CABLayoutWrapping.optional()
|
|
3896
4049
|
});
|
|
3897
4050
|
|
|
@@ -3913,8 +4066,8 @@ var UI_LABELS = {
|
|
|
3913
4066
|
};
|
|
3914
4067
|
|
|
3915
4068
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
3916
|
-
var localized = (fallback) =>
|
|
3917
|
-
var CABUILabels =
|
|
4069
|
+
var localized = (fallback) => import_zod60.z.record(import_zod60.z.string(), import_zod60.z.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
4070
|
+
var CABUILabels = import_zod60.z.object({
|
|
3918
4071
|
currentPage: localized(UI_LABELS.currentPage),
|
|
3919
4072
|
guest: localized(UI_LABELS.guest),
|
|
3920
4073
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -3939,154 +4092,154 @@ var CABUILabels = import_zod52.z.object({
|
|
|
3939
4092
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
3940
4093
|
updating: { ...UI_LABELS.updating }
|
|
3941
4094
|
}));
|
|
3942
|
-
var TargetArea =
|
|
3943
|
-
fill:
|
|
3944
|
-
flip:
|
|
3945
|
-
icon:
|
|
3946
|
-
label:
|
|
3947
|
-
width:
|
|
4095
|
+
var TargetArea = import_zod60.z.object({
|
|
4096
|
+
fill: import_zod60.z.boolean().optional(),
|
|
4097
|
+
flip: import_zod60.z.enum(["both", "horizontal", "vertical"]).optional(),
|
|
4098
|
+
icon: import_zod60.z.string(),
|
|
4099
|
+
label: import_zod60.z.string(),
|
|
4100
|
+
width: import_zod60.z.string()
|
|
3948
4101
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
3949
|
-
var CABTracking =
|
|
3950
|
-
enableAttribution:
|
|
3951
|
-
enableSource:
|
|
3952
|
-
enableWidget:
|
|
4102
|
+
var CABTracking = import_zod60.z.object({
|
|
4103
|
+
enableAttribution: import_zod60.z.boolean().nullish().transform((value) => value ?? true),
|
|
4104
|
+
enableSource: import_zod60.z.boolean().nullish().transform((value) => value ?? true),
|
|
4105
|
+
enableWidget: import_zod60.z.boolean().nullish().transform((value) => value ?? true)
|
|
3953
4106
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
3954
|
-
var CABExperiment =
|
|
3955
|
-
elementId:
|
|
3956
|
-
experimentId:
|
|
3957
|
-
experimentType:
|
|
3958
|
-
selectedId:
|
|
4107
|
+
var CABExperiment = import_zod60.z.object({
|
|
4108
|
+
elementId: import_zod60.z.number(),
|
|
4109
|
+
experimentId: import_zod60.z.number(),
|
|
4110
|
+
experimentType: import_zod60.z.string(),
|
|
4111
|
+
selectedId: import_zod60.z.number()
|
|
3959
4112
|
});
|
|
3960
4113
|
var CABRootSection = CABLayoutSection.extend({
|
|
3961
|
-
editorMode:
|
|
4114
|
+
editorMode: import_zod60.z.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
3962
4115
|
experiment: CABExperiment.optional(),
|
|
3963
4116
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
3964
4117
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
3965
|
-
previewMode:
|
|
3966
|
-
storeId:
|
|
4118
|
+
previewMode: import_zod60.z.boolean().nullish().transform((value) => value ?? false),
|
|
4119
|
+
storeId: import_zod60.z.number().nullable().default(null),
|
|
3967
4120
|
targetArea: TargetArea.nullable(),
|
|
3968
4121
|
tracking: CABTracking,
|
|
3969
|
-
type:
|
|
4122
|
+
type: import_zod60.z.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
3970
4123
|
uiLabels: CABUILabels,
|
|
3971
|
-
version:
|
|
3972
|
-
widgetId:
|
|
4124
|
+
version: import_zod60.z.literal(2).default(2),
|
|
4125
|
+
widgetId: import_zod60.z.number().nullable().default(null)
|
|
3973
4126
|
});
|
|
3974
4127
|
|
|
3975
4128
|
// src/schema/widgets/contentBlock.ts
|
|
3976
|
-
var ContentBlockV1 =
|
|
3977
|
-
blockSpacing:
|
|
3978
|
-
imageBlocks:
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
altText:
|
|
3982
|
-
description:
|
|
3983
|
-
id:
|
|
3984
|
-
imagePlacement:
|
|
3985
|
-
imageSize:
|
|
3986
|
-
imageUrl:
|
|
3987
|
-
textAlignment:
|
|
4129
|
+
var ContentBlockV1 = import_zod61.z.object({
|
|
4130
|
+
blockSpacing: import_zod61.z.enum(spacings).optional(),
|
|
4131
|
+
imageBlocks: import_zod61.z.union([
|
|
4132
|
+
import_zod61.z.array(
|
|
4133
|
+
import_zod61.z.object({
|
|
4134
|
+
altText: import_zod61.z.string().nullable(),
|
|
4135
|
+
description: import_zod61.z.string().nullable(),
|
|
4136
|
+
id: import_zod61.z.uuid(),
|
|
4137
|
+
imagePlacement: import_zod61.z.enum(["top", "right", "bottom", "left"]),
|
|
4138
|
+
imageSize: import_zod61.z.number(),
|
|
4139
|
+
imageUrl: import_zod61.z.url(),
|
|
4140
|
+
textAlignment: import_zod61.z.enum(["left", "center", "right"]),
|
|
3988
4141
|
/** Inline scale only: an image caption can never be a block-level heading. */
|
|
3989
|
-
textSize:
|
|
4142
|
+
textSize: import_zod61.z.enum(inlineTextSizeNames)
|
|
3990
4143
|
})
|
|
3991
4144
|
),
|
|
3992
|
-
|
|
4145
|
+
import_zod61.z.strictObject({}).transform(() => [])
|
|
3993
4146
|
]).optional(),
|
|
3994
|
-
imageLayout:
|
|
3995
|
-
language:
|
|
3996
|
-
description:
|
|
3997
|
-
superTitle:
|
|
3998
|
-
title:
|
|
4147
|
+
imageLayout: import_zod61.z.enum(["row", "column"]).optional(),
|
|
4148
|
+
language: import_zod61.z.object({
|
|
4149
|
+
description: import_zod61.z.string(),
|
|
4150
|
+
superTitle: import_zod61.z.string(),
|
|
4151
|
+
title: import_zod61.z.string()
|
|
3999
4152
|
}),
|
|
4000
|
-
previewMode:
|
|
4001
|
-
type:
|
|
4002
|
-
version:
|
|
4153
|
+
previewMode: import_zod61.z.boolean(),
|
|
4154
|
+
type: import_zod61.z.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block),
|
|
4155
|
+
version: import_zod61.z.literal(1)
|
|
4003
4156
|
});
|
|
4004
|
-
var ContentBlock =
|
|
4157
|
+
var ContentBlock = import_zod61.z.discriminatedUnion("version", [
|
|
4005
4158
|
ContentBlockV1,
|
|
4006
4159
|
CABRootSection.extend({
|
|
4007
|
-
type:
|
|
4160
|
+
type: import_zod61.z.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block)
|
|
4008
4161
|
})
|
|
4009
4162
|
]);
|
|
4010
4163
|
|
|
4011
4164
|
// src/schema/widgets/giftWithPurchase.ts
|
|
4012
|
-
var
|
|
4013
|
-
var GiftWithPurchase =
|
|
4014
|
-
type:
|
|
4165
|
+
var import_zod62 = require("zod");
|
|
4166
|
+
var GiftWithPurchase = import_zod62.z.looseObject({
|
|
4167
|
+
type: import_zod62.z.literal(WidgetType.gift_with_purchase).default(WidgetType.gift_with_purchase)
|
|
4015
4168
|
});
|
|
4016
4169
|
|
|
4017
4170
|
// src/schema/widgets/lineItemEditor.ts
|
|
4018
|
-
var
|
|
4019
|
-
var LineItemEditorSwitchLanguageV1 =
|
|
4020
|
-
downgradeToOneTimeLabel:
|
|
4171
|
+
var import_zod63 = require("zod");
|
|
4172
|
+
var LineItemEditorSwitchLanguageV1 = import_zod63.z.object({
|
|
4173
|
+
downgradeToOneTimeLabel: import_zod63.z.string().optional(),
|
|
4021
4174
|
/** Frequency-option template (`{{frequency}}`/`{{interval}}`) for the plan select. */
|
|
4022
|
-
subscriptionOptionLabel:
|
|
4023
|
-
upgradeToSubscriptionLabel:
|
|
4024
|
-
upgradeToSubscriptionWithoutDiscountLabel:
|
|
4175
|
+
subscriptionOptionLabel: import_zod63.z.string().optional(),
|
|
4176
|
+
upgradeToSubscriptionLabel: import_zod63.z.string().optional(),
|
|
4177
|
+
upgradeToSubscriptionWithoutDiscountLabel: import_zod63.z.string().optional()
|
|
4025
4178
|
});
|
|
4026
|
-
var LineItemEditorV1 =
|
|
4179
|
+
var LineItemEditorV1 = import_zod63.z.object({
|
|
4027
4180
|
/** Legacy `getStyles` button style; the converter carries a valid kind, defaulting to `plain`. */
|
|
4028
|
-
button:
|
|
4029
|
-
previewMode:
|
|
4030
|
-
switchToSubscription:
|
|
4031
|
-
disableDowngrade:
|
|
4181
|
+
button: import_zod63.z.object({ kind: import_zod63.z.enum(["plain", "primary", "secondary"]).optional() }).optional(),
|
|
4182
|
+
previewMode: import_zod63.z.boolean().optional(),
|
|
4183
|
+
switchToSubscription: import_zod63.z.object({
|
|
4184
|
+
disableDowngrade: import_zod63.z.boolean().optional(),
|
|
4032
4185
|
language: LineItemEditorSwitchLanguageV1.optional()
|
|
4033
4186
|
}).optional(),
|
|
4034
|
-
switchToSubscriptionEnabled:
|
|
4035
|
-
tracking:
|
|
4036
|
-
enableAttribution:
|
|
4037
|
-
enableSource:
|
|
4038
|
-
enableWidget:
|
|
4187
|
+
switchToSubscriptionEnabled: import_zod63.z.boolean().optional(),
|
|
4188
|
+
tracking: import_zod63.z.object({
|
|
4189
|
+
enableAttribution: import_zod63.z.boolean().optional(),
|
|
4190
|
+
enableSource: import_zod63.z.boolean().optional(),
|
|
4191
|
+
enableWidget: import_zod63.z.boolean().optional()
|
|
4039
4192
|
}).optional(),
|
|
4040
|
-
type:
|
|
4041
|
-
version:
|
|
4193
|
+
type: import_zod63.z.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor),
|
|
4194
|
+
version: import_zod63.z.literal(1)
|
|
4042
4195
|
});
|
|
4043
|
-
var LineItemEditor =
|
|
4196
|
+
var LineItemEditor = import_zod63.z.discriminatedUnion("version", [
|
|
4044
4197
|
LineItemEditorV1,
|
|
4045
4198
|
CABRootSection.extend({
|
|
4046
|
-
type:
|
|
4199
|
+
type: import_zod63.z.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor)
|
|
4047
4200
|
})
|
|
4048
4201
|
]);
|
|
4049
4202
|
|
|
4050
4203
|
// src/schema/widgets/progressBar.ts
|
|
4051
|
-
var
|
|
4052
|
-
var ProgressBar =
|
|
4053
|
-
type:
|
|
4204
|
+
var import_zod64 = require("zod");
|
|
4205
|
+
var ProgressBar = import_zod64.z.looseObject({
|
|
4206
|
+
type: import_zod64.z.literal(WidgetType.ui_extension_progress_bar).default(WidgetType.ui_extension_progress_bar)
|
|
4054
4207
|
});
|
|
4055
4208
|
|
|
4056
4209
|
// src/schema/widgets/rebuyButton.ts
|
|
4057
|
-
var
|
|
4058
|
-
var RebuyButtonV1 =
|
|
4059
|
-
type:
|
|
4060
|
-
version:
|
|
4210
|
+
var import_zod65 = require("zod");
|
|
4211
|
+
var RebuyButtonV1 = import_zod65.z.looseObject({
|
|
4212
|
+
type: import_zod65.z.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button),
|
|
4213
|
+
version: import_zod65.z.literal(1)
|
|
4061
4214
|
});
|
|
4062
|
-
var RebuyButton =
|
|
4215
|
+
var RebuyButton = import_zod65.z.discriminatedUnion("version", [
|
|
4063
4216
|
RebuyButtonV1,
|
|
4064
4217
|
CABRootSection.extend({
|
|
4065
|
-
type:
|
|
4218
|
+
type: import_zod65.z.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button)
|
|
4066
4219
|
})
|
|
4067
4220
|
]);
|
|
4068
4221
|
|
|
4069
4222
|
// src/schema/widgets/rebuyMonetize.ts
|
|
4070
|
-
var
|
|
4071
|
-
var RebuyMonetize =
|
|
4072
|
-
type:
|
|
4223
|
+
var import_zod66 = require("zod");
|
|
4224
|
+
var RebuyMonetize = import_zod66.z.looseObject({
|
|
4225
|
+
type: import_zod66.z.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad)
|
|
4073
4226
|
});
|
|
4074
|
-
var RebuyMonetizeV1 =
|
|
4075
|
-
name:
|
|
4076
|
-
previewMode:
|
|
4227
|
+
var RebuyMonetizeV1 = import_zod66.z.object({
|
|
4228
|
+
name: import_zod66.z.string().nullable().optional(),
|
|
4229
|
+
previewMode: import_zod66.z.boolean().optional(),
|
|
4077
4230
|
/** Privacy Policy footer href → the marker section's `privacyPolicyUrl`. */
|
|
4078
|
-
privacyPolicyUrl:
|
|
4231
|
+
privacyPolicyUrl: import_zod66.z.string().nullable().optional(),
|
|
4079
4232
|
/** Ads-taxonomy sub-vertical id — one of the admin Monetize editor's two configurables. */
|
|
4080
|
-
subVertical:
|
|
4081
|
-
tracking:
|
|
4082
|
-
enableAttribution:
|
|
4083
|
-
enableSource:
|
|
4084
|
-
enableWidget:
|
|
4233
|
+
subVertical: import_zod66.z.string().nullable().optional(),
|
|
4234
|
+
tracking: import_zod66.z.object({
|
|
4235
|
+
enableAttribution: import_zod66.z.boolean().optional(),
|
|
4236
|
+
enableSource: import_zod66.z.boolean().optional(),
|
|
4237
|
+
enableWidget: import_zod66.z.boolean().optional()
|
|
4085
4238
|
}).optional(),
|
|
4086
|
-
type:
|
|
4087
|
-
version:
|
|
4239
|
+
type: import_zod66.z.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad),
|
|
4240
|
+
version: import_zod66.z.literal(1),
|
|
4088
4241
|
/** Ads-taxonomy vertical id — one of the admin Monetize editor's two configurables. */
|
|
4089
|
-
vertical:
|
|
4242
|
+
vertical: import_zod66.z.string().nullable().optional()
|
|
4090
4243
|
});
|
|
4091
4244
|
|
|
4092
4245
|
// src/schema/widgetData.ts
|
|
@@ -4100,7 +4253,7 @@ var extensionWidgetTypes = [
|
|
|
4100
4253
|
WidgetType.ui_extension_line_item_editor,
|
|
4101
4254
|
WidgetType.ui_extension_progress_bar
|
|
4102
4255
|
];
|
|
4103
|
-
var WidgetData =
|
|
4256
|
+
var WidgetData = import_zod67.z.discriminatedUnion("type", [
|
|
4104
4257
|
ABTestingPlaceholder,
|
|
4105
4258
|
CheckoutExtension,
|
|
4106
4259
|
ContentBlock,
|
|
@@ -4460,36 +4613,36 @@ var SWITCH_LABELS = {
|
|
|
4460
4613
|
};
|
|
4461
4614
|
|
|
4462
4615
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
4463
|
-
var
|
|
4616
|
+
var import_zod69 = require("zod");
|
|
4464
4617
|
|
|
4465
4618
|
// src/schema/widgets/post-purchase-offer/postPurchaseWidget.ts
|
|
4466
|
-
var
|
|
4467
|
-
var PostPurchaseWidgetLinkedFlow =
|
|
4468
|
-
id:
|
|
4469
|
-
name:
|
|
4470
|
-
});
|
|
4471
|
-
var PostPurchaseWidget =
|
|
4472
|
-
classification:
|
|
4473
|
-
createdAtTime:
|
|
4474
|
-
customEndpointName:
|
|
4475
|
-
id:
|
|
4476
|
-
lastViewed:
|
|
4477
|
-
linkedCustomEndpointId:
|
|
4478
|
-
linkedFlows:
|
|
4479
|
-
name:
|
|
4480
|
-
owner:
|
|
4619
|
+
var import_zod68 = require("zod");
|
|
4620
|
+
var PostPurchaseWidgetLinkedFlow = import_zod68.z.object({
|
|
4621
|
+
id: import_zod68.z.number(),
|
|
4622
|
+
name: import_zod68.z.string()
|
|
4623
|
+
});
|
|
4624
|
+
var PostPurchaseWidget = import_zod68.z.object({
|
|
4625
|
+
classification: import_zod68.z.literal("post_purchase_offer_page").default("post_purchase_offer_page"),
|
|
4626
|
+
createdAtTime: import_zod68.z.iso.datetime({ offset: true }).optional(),
|
|
4627
|
+
customEndpointName: import_zod68.z.string().nullish(),
|
|
4628
|
+
id: import_zod68.z.number().default(0),
|
|
4629
|
+
lastViewed: import_zod68.z.iso.datetime({ offset: true }).nullish(),
|
|
4630
|
+
linkedCustomEndpointId: import_zod68.z.number().nullish(),
|
|
4631
|
+
linkedFlows: import_zod68.z.array(PostPurchaseWidgetLinkedFlow).optional(),
|
|
4632
|
+
name: import_zod68.z.string().default(""),
|
|
4633
|
+
owner: import_zod68.z.number().nullish(),
|
|
4481
4634
|
settings: PostPurchaseSettings
|
|
4482
4635
|
});
|
|
4483
4636
|
|
|
4484
4637
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
4485
|
-
var PostPurchaseOffer =
|
|
4486
|
-
|
|
4487
|
-
errors:
|
|
4488
|
-
message:
|
|
4489
|
-
successful:
|
|
4638
|
+
var PostPurchaseOffer = import_zod69.z.discriminatedUnion("successful", [
|
|
4639
|
+
import_zod69.z.strictObject({
|
|
4640
|
+
errors: import_zod69.z.array(import_zod69.z.object({ message: import_zod69.z.string() })),
|
|
4641
|
+
message: import_zod69.z.string(),
|
|
4642
|
+
successful: import_zod69.z.literal(false)
|
|
4490
4643
|
}),
|
|
4491
|
-
|
|
4492
|
-
successful:
|
|
4644
|
+
import_zod69.z.strictObject({
|
|
4645
|
+
successful: import_zod69.z.literal(true),
|
|
4493
4646
|
widget: PostPurchaseWidget
|
|
4494
4647
|
})
|
|
4495
4648
|
]);
|
|
@@ -5563,3 +5716,65 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
5563
5716
|
widgetId: id
|
|
5564
5717
|
});
|
|
5565
5718
|
};
|
|
5719
|
+
|
|
5720
|
+
// src/pricing/amountToCents.ts
|
|
5721
|
+
var round = (value, precision = 0) => {
|
|
5722
|
+
const factor = 10 ** precision;
|
|
5723
|
+
return Math.round(value * factor) / factor;
|
|
5724
|
+
};
|
|
5725
|
+
var amountToCents2 = (amount2, decimals = 2) => {
|
|
5726
|
+
const value = Number(amount2);
|
|
5727
|
+
return Number.isFinite(value) ? round(round(value, decimals) * 10 ** decimals) : 0;
|
|
5728
|
+
};
|
|
5729
|
+
|
|
5730
|
+
// src/pricing/currencyDecimals.ts
|
|
5731
|
+
var MINOR_UNIT_OVERRIDES = {
|
|
5732
|
+
IQD: 3
|
|
5733
|
+
};
|
|
5734
|
+
var CACHE = /* @__PURE__ */ new Map();
|
|
5735
|
+
var currencyDecimals = (currencyCode) => {
|
|
5736
|
+
if (!currencyCode) return 2;
|
|
5737
|
+
const code = currencyCode.toUpperCase();
|
|
5738
|
+
const override = MINOR_UNIT_OVERRIDES[code];
|
|
5739
|
+
if (override !== void 0) return override;
|
|
5740
|
+
const cached = CACHE.get(code);
|
|
5741
|
+
if (cached !== void 0) return cached;
|
|
5742
|
+
let decimals = 2;
|
|
5743
|
+
try {
|
|
5744
|
+
const { maximumFractionDigits } = new Intl.NumberFormat("en", {
|
|
5745
|
+
currency: code,
|
|
5746
|
+
style: "currency"
|
|
5747
|
+
}).resolvedOptions();
|
|
5748
|
+
decimals = maximumFractionDigits ?? 2;
|
|
5749
|
+
} catch {
|
|
5750
|
+
decimals = 2;
|
|
5751
|
+
}
|
|
5752
|
+
CACHE.set(code, decimals);
|
|
5753
|
+
return decimals;
|
|
5754
|
+
};
|
|
5755
|
+
|
|
5756
|
+
// src/pricing/postPurchaseSubscriptionDisplay.ts
|
|
5757
|
+
var postPurchaseSubscriptionDisplay = (prepared, currencyCode) => {
|
|
5758
|
+
const subscription = readPostPurchaseSubscription(prepared);
|
|
5759
|
+
if (!subscription) return void 0;
|
|
5760
|
+
const decimals = currencyDecimals(currencyCode);
|
|
5761
|
+
const variant2 = subscription.product.variant;
|
|
5762
|
+
const regular = amountToCents2(variant2.price, decimals);
|
|
5763
|
+
const compareAt = amountToCents2(variant2.compareAtPrice, decimals);
|
|
5764
|
+
const comparisonMinor = subscription.display.discountedFrom === "compare_at_price" && compareAt > regular ? compareAt : regular;
|
|
5765
|
+
const adjustment = subscription.terms.subscription.adjustment;
|
|
5766
|
+
const reduce = (price, discount) => {
|
|
5767
|
+
const reduction = discount.type === "percentage" ? Math.round(price * discount.amount / 100) : discount.type === "fixed_amount" ? amountToCents2(discount.amount, decimals) : 0;
|
|
5768
|
+
return Math.max(0, price - reduction);
|
|
5769
|
+
};
|
|
5770
|
+
const planPrice = adjustment?.type === "price" ? amountToCents2(adjustment.amount, decimals) : adjustment ? reduce(regular, { amount: adjustment.amount, type: adjustment.type }) : regular;
|
|
5771
|
+
const priceMinor = reduce(planPrice, subscription.terms.discount);
|
|
5772
|
+
const savingMinor = Math.max(0, comparisonMinor - priceMinor);
|
|
5773
|
+
return PostPurchaseSubscriptionDisplay.parse({
|
|
5774
|
+
comparisonMinor,
|
|
5775
|
+
currencyCode,
|
|
5776
|
+
priceMinor,
|
|
5777
|
+
savingMinor,
|
|
5778
|
+
savingPercent: comparisonMinor ? Math.round(savingMinor / comparisonMinor * 100) : 0
|
|
5779
|
+
});
|
|
5780
|
+
};
|