@rebuy/rebuy 3.33.0 → 3.35.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/README.md +1 -1
- package/dist/cab/index.cjs +12 -1
- package/dist/cab/index.d.ts +1 -0
- package/dist/cab/index.mjs +12 -1
- package/dist/cab/utf8ByteLength.d.ts +6 -0
- package/dist/index.cjs +878 -794
- package/dist/index.mjs +879 -795
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/postPurchaseGroupCatalog.d.ts +56 -0
- package/dist/schema/postPurchaseOfferEligibility.d.ts +32 -0
- package/dist/schema/postPurchaseOfferPresentation.d.ts +386 -0
- package/dist/schema/postPurchaseProductSource.d.ts +10 -5
- package/dist/schema/postPurchaseQuantity.d.ts +13 -0
- package/dist/schema/postPurchaseVariantDefault.d.ts +17 -0
- package/dist/schema/postPurchaseVariantDefaultContext.d.ts +10 -0
- package/dist/server/__fixtures__/postPurchaseGroup.d.ts +75 -0
- package/dist/server/classifyPostPurchaseOffer.d.ts +3 -0
- package/dist/server/createPostPurchaseOrderAttributes.d.ts +9 -0
- package/dist/server/index.cjs +605 -192
- package/dist/server/index.d.ts +8 -1
- package/dist/server/index.mjs +605 -192
- package/dist/server/postPurchaseMemberEligibility.d.ts +7 -0
- package/dist/server/postPurchaseOfferCopy.d.ts +3 -0
- package/dist/server/postPurchaseProductEligibility.d.ts +3 -7
- package/dist/server/postPurchaseSubscriptionEligibility.d.ts +2 -3
- package/dist/server/prepareNormalizedSubscription.d.ts +2 -3
- package/dist/server/preparePostPurchaseGroupDeclineDisplay.d.ts +12 -0
- package/dist/server/preparePostPurchaseOfferPresentation.d.ts +137 -0
- package/dist/server/projectPostPurchaseProduct.d.ts +5 -7
- package/dist/server/readPostPurchaseGroup.d.ts +101 -0
- package/dist/server/readPostPurchaseGroupSelection.d.ts +110 -0
- package/dist/server/readPostPurchaseQuantity.d.ts +27 -0
- package/dist/server/resolvePostPurchaseMemberDefault.d.ts +8 -0
- package/dist/server/selectPostPurchaseChoice.d.ts +2 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -135,14 +135,23 @@ __export(src_exports, {
|
|
|
135
135
|
PopoverPosition: () => PopoverPosition,
|
|
136
136
|
PostPurchaseAmount: () => PostPurchaseAmount,
|
|
137
137
|
PostPurchaseAppIdSchema: () => PostPurchaseAppIdSchema,
|
|
138
|
+
PostPurchaseAttributeProducts: () => PostPurchaseAttributeProducts,
|
|
138
139
|
PostPurchaseBlock: () => PostPurchaseBlock,
|
|
139
140
|
PostPurchaseChoice: () => PostPurchaseChoice,
|
|
140
141
|
PostPurchaseDiscount: () => PostPurchaseDiscount,
|
|
141
142
|
PostPurchaseExcludedProductIds: () => PostPurchaseExcludedProductIds,
|
|
143
|
+
PostPurchaseGroupCatalog: () => PostPurchaseGroupCatalog,
|
|
144
|
+
PostPurchaseGroupDescription: () => PostPurchaseGroupDescription,
|
|
145
|
+
PostPurchaseGroupSelection: () => PostPurchaseGroupSelection,
|
|
142
146
|
PostPurchaseOffer: () => PostPurchaseOffer,
|
|
147
|
+
PostPurchaseOfferEligibility: () => PostPurchaseOfferEligibility,
|
|
148
|
+
PostPurchaseOfferEligibilityContext: () => PostPurchaseOfferEligibilityContext,
|
|
149
|
+
PostPurchaseOfferPresentation: () => PostPurchaseOfferPresentation,
|
|
150
|
+
PostPurchaseOfferSkipReason: () => PostPurchaseOfferSkipReason,
|
|
143
151
|
PostPurchaseOptions: () => PostPurchaseOptions,
|
|
144
152
|
PostPurchaseOrderAttributes: () => PostPurchaseOrderAttributes,
|
|
145
153
|
PostPurchaseOrderIdSchema: () => PostPurchaseOrderIdSchema,
|
|
154
|
+
PostPurchaseOriginalVariants: () => PostPurchaseOriginalVariants,
|
|
146
155
|
PostPurchasePlanAdjustment: () => PostPurchasePlanAdjustment,
|
|
147
156
|
PostPurchasePlanCatalog: () => PostPurchasePlanCatalog,
|
|
148
157
|
PostPurchasePlanOption: () => PostPurchasePlanOption,
|
|
@@ -153,6 +162,7 @@ __export(src_exports, {
|
|
|
153
162
|
PostPurchaseProductId: () => PostPurchaseProductId,
|
|
154
163
|
PostPurchaseProductSettings: () => PostPurchaseProductSettings,
|
|
155
164
|
PostPurchaseProductSource: () => PostPurchaseProductSource,
|
|
165
|
+
PostPurchaseQuantityPolicy: () => PostPurchaseQuantityPolicy,
|
|
156
166
|
PostPurchaseSettings: () => PostPurchaseSettings,
|
|
157
167
|
PostPurchaseShadowReportFields: () => PostPurchaseShadowReportFields,
|
|
158
168
|
PostPurchaseShadowReportSchema: () => PostPurchaseShadowReportSchema,
|
|
@@ -164,6 +174,7 @@ __export(src_exports, {
|
|
|
164
174
|
PostPurchaseTimestampSchema: () => PostPurchaseTimestampSchema,
|
|
165
175
|
PostPurchaseVariant: () => PostPurchaseVariant,
|
|
166
176
|
PostPurchaseVariantCatalog: () => PostPurchaseVariantCatalog,
|
|
177
|
+
PostPurchaseVariantDefaultContext: () => PostPurchaseVariantDefaultContext,
|
|
167
178
|
PostPurchaseVariantDefaultProduct: () => PostPurchaseVariantDefaultProduct,
|
|
168
179
|
PostPurchaseVariantDefaultSettings: () => PostPurchaseVariantDefaultSettings,
|
|
169
180
|
PostPurchaseVariantId: () => PostPurchaseVariantId,
|
|
@@ -1006,8 +1017,8 @@ var makeCall2 = async (config2, endpoint, params, format, options2 = {}) => {
|
|
|
1006
1017
|
if (config2.identity && config2.identity.visitorId()) {
|
|
1007
1018
|
query.uuid = config2.identity.visitorId();
|
|
1008
1019
|
}
|
|
1009
|
-
const
|
|
1010
|
-
const response = await config2.api[
|
|
1020
|
+
const source2 = options2.cdn ? "callCdn" : options2.shield ? "callShield" : options2.static ? "callStatic" : "callApi";
|
|
1021
|
+
const response = await config2.api[source2]("GET", endpoint, query, options2);
|
|
1011
1022
|
if (response.data && format === "storefront") {
|
|
1012
1023
|
for (let i = 0; i < response.data.length; i++) {
|
|
1013
1024
|
response.data[i] = convertProductToStorefrontFormat(response.data[i]);
|
|
@@ -2546,82 +2557,35 @@ var ExitPolicySchema = import_zod18.z.discriminatedUnion("status", [
|
|
|
2546
2557
|
})
|
|
2547
2558
|
]);
|
|
2548
2559
|
|
|
2549
|
-
// src/schema/
|
|
2550
|
-
var
|
|
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
|
-
);
|
|
2560
|
+
// src/schema/postPurchaseGroupCatalog.ts
|
|
2561
|
+
var import_zod25 = require("zod");
|
|
2598
2562
|
|
|
2599
2563
|
// src/schema/postPurchaseProduct.ts
|
|
2600
|
-
var
|
|
2564
|
+
var import_zod23 = require("zod");
|
|
2601
2565
|
|
|
2602
2566
|
// src/schema/postPurchaseProductDisplay.ts
|
|
2603
|
-
var
|
|
2567
|
+
var import_zod20 = require("zod");
|
|
2604
2568
|
|
|
2605
2569
|
// src/schema/postPurchaseProductGallery.ts
|
|
2606
|
-
var
|
|
2607
|
-
var PostPurchaseProductGallery =
|
|
2608
|
-
images:
|
|
2609
|
-
|
|
2610
|
-
description:
|
|
2611
|
-
id:
|
|
2612
|
-
source:
|
|
2613
|
-
thumbnail:
|
|
2570
|
+
var import_zod19 = require("zod");
|
|
2571
|
+
var PostPurchaseProductGallery = import_zod19.z.object({
|
|
2572
|
+
images: import_zod19.z.array(
|
|
2573
|
+
import_zod19.z.object({
|
|
2574
|
+
description: import_zod19.z.string(),
|
|
2575
|
+
id: import_zod19.z.number().int().positive(),
|
|
2576
|
+
source: import_zod19.z.string(),
|
|
2577
|
+
thumbnail: import_zod19.z.string()
|
|
2614
2578
|
})
|
|
2615
2579
|
),
|
|
2616
|
-
selectedImageId:
|
|
2580
|
+
selectedImageId: import_zod19.z.number().int().positive().optional()
|
|
2617
2581
|
});
|
|
2618
2582
|
|
|
2619
2583
|
// src/schema/postPurchaseProductDisplay.ts
|
|
2620
2584
|
var language = PostPurchaseSettings.shape.language;
|
|
2621
|
-
var PostPurchasePrimaryImageSource =
|
|
2585
|
+
var PostPurchasePrimaryImageSource = import_zod20.z.string().default(
|
|
2622
2586
|
"https://cdn.shopify.com/shopifycloud/shopify/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c.gif"
|
|
2623
2587
|
);
|
|
2624
|
-
var PostPurchaseProductDisplay =
|
|
2588
|
+
var PostPurchaseProductDisplay = import_zod20.z.object({
|
|
2625
2589
|
discountedFrom: PostPurchaseSettings.shape.discountedFrom,
|
|
2626
2590
|
gallery: PostPurchaseProductGallery.optional(),
|
|
2627
2591
|
language: language.pick({
|
|
@@ -2630,7 +2594,7 @@ var PostPurchaseProductDisplay = import_zod23.z.object({
|
|
|
2630
2594
|
descriptionRte: true,
|
|
2631
2595
|
descriptionSpacing: true
|
|
2632
2596
|
}),
|
|
2633
|
-
primaryImage:
|
|
2597
|
+
primaryImage: import_zod20.z.object({ description: import_zod20.z.string(), source: import_zod20.z.string() }),
|
|
2634
2598
|
productOptions: PostPurchaseSettings.shape.productOptions.pick({
|
|
2635
2599
|
showDeclineAll: true,
|
|
2636
2600
|
showShipping: true,
|
|
@@ -2644,10 +2608,10 @@ var PostPurchaseProductDisplay = import_zod23.z.object({
|
|
|
2644
2608
|
});
|
|
2645
2609
|
|
|
2646
2610
|
// src/schema/postPurchaseProductSource.ts
|
|
2647
|
-
var
|
|
2648
|
-
var PostPurchaseAmount =
|
|
2649
|
-
var PostPurchaseProductId =
|
|
2650
|
-
var PostPurchaseVariantId =
|
|
2611
|
+
var import_zod21 = require("zod");
|
|
2612
|
+
var PostPurchaseAmount = import_zod21.z.string().regex(/^\d+(?:\.\d+)?$/).refine((value) => Number.isFinite(Number(value)));
|
|
2613
|
+
var PostPurchaseProductId = import_zod21.z.number().int().positive();
|
|
2614
|
+
var PostPurchaseVariantId = import_zod21.z.number().int().positive();
|
|
2651
2615
|
var ProductBase = OfferProduct.pick({ description: true, id: true, image: true, title: true }).extend({
|
|
2652
2616
|
description: OfferProduct.shape.description.nullable(),
|
|
2653
2617
|
id: PostPurchaseProductId
|
|
@@ -2655,56 +2619,56 @@ var ProductBase = OfferProduct.pick({ description: true, id: true, image: true,
|
|
|
2655
2619
|
var SourceVariant = OfferProduct.shape.variants.element.pick({ id: true, title: true }).extend({
|
|
2656
2620
|
compareAtPrice: PostPurchaseAmount.nullable(),
|
|
2657
2621
|
id: PostPurchaseVariantId,
|
|
2658
|
-
imageId:
|
|
2659
|
-
inventoryManagement:
|
|
2660
|
-
inventoryPolicy:
|
|
2661
|
-
inventoryQuantity:
|
|
2662
|
-
option1:
|
|
2663
|
-
option2:
|
|
2664
|
-
option3:
|
|
2622
|
+
imageId: import_zod21.z.number().int().nonnegative().nullish(),
|
|
2623
|
+
inventoryManagement: import_zod21.z.string().nullable(),
|
|
2624
|
+
inventoryPolicy: import_zod21.z.string(),
|
|
2625
|
+
inventoryQuantity: import_zod21.z.number(),
|
|
2626
|
+
option1: import_zod21.z.unknown().optional(),
|
|
2627
|
+
option2: import_zod21.z.unknown().optional(),
|
|
2628
|
+
option3: import_zod21.z.unknown().optional(),
|
|
2665
2629
|
price: PostPurchaseAmount,
|
|
2666
2630
|
productId: PostPurchaseProductId,
|
|
2667
|
-
sellingPlanAllocations:
|
|
2631
|
+
sellingPlanAllocations: import_zod21.z.unknown().optional()
|
|
2668
2632
|
});
|
|
2669
2633
|
var Product2 = ProductBase.extend({
|
|
2670
|
-
images:
|
|
2671
|
-
|
|
2634
|
+
images: import_zod21.z.array(
|
|
2635
|
+
import_zod21.z.object({ alt: import_zod21.z.string().optional().catch(void 0), id: import_zod21.z.number().int().positive(), src: import_zod21.z.string() })
|
|
2672
2636
|
).nullish(),
|
|
2673
|
-
metadata:
|
|
2674
|
-
productQuantity:
|
|
2675
|
-
|
|
2676
|
-
|
|
2637
|
+
metadata: import_zod21.z.object({
|
|
2638
|
+
productQuantity: import_zod21.z.union([
|
|
2639
|
+
import_zod21.z.number().int().positive(),
|
|
2640
|
+
import_zod21.z.string().regex(/^[1-9]\d*$/).transform(Number)
|
|
2677
2641
|
]).optional()
|
|
2678
2642
|
}).optional(),
|
|
2679
|
-
metafields:
|
|
2680
|
-
options:
|
|
2681
|
-
productGroupVariants:
|
|
2682
|
-
selectedVariant:
|
|
2683
|
-
sellingPlanGroups:
|
|
2643
|
+
metafields: import_zod21.z.unknown().optional(),
|
|
2644
|
+
options: import_zod21.z.unknown().optional(),
|
|
2645
|
+
productGroupVariants: import_zod21.z.array(import_zod21.z.unknown()).default([]),
|
|
2646
|
+
selectedVariant: import_zod21.z.unknown().optional(),
|
|
2647
|
+
sellingPlanGroups: import_zod21.z.array(
|
|
2684
2648
|
OfferProduct.shape.sellingPlanGroups.unwrap().element.extend({
|
|
2685
|
-
discountAmount:
|
|
2686
|
-
discountType:
|
|
2687
|
-
id:
|
|
2688
|
-
requiresSellingPlan:
|
|
2689
|
-
sellingPlans:
|
|
2649
|
+
discountAmount: import_zod21.z.unknown().optional(),
|
|
2650
|
+
discountType: import_zod21.z.unknown().optional(),
|
|
2651
|
+
id: import_zod21.z.unknown().optional(),
|
|
2652
|
+
requiresSellingPlan: import_zod21.z.boolean().default(false),
|
|
2653
|
+
sellingPlans: import_zod21.z.unknown().optional()
|
|
2690
2654
|
})
|
|
2691
2655
|
).default([]),
|
|
2692
|
-
variants:
|
|
2656
|
+
variants: import_zod21.z.array(SourceVariant)
|
|
2693
2657
|
});
|
|
2694
|
-
var PostPurchaseProductSource =
|
|
2695
|
-
data:
|
|
2696
|
-
metadata:
|
|
2658
|
+
var PostPurchaseProductSource = import_zod21.z.object({
|
|
2659
|
+
data: import_zod21.z.array(Product2),
|
|
2660
|
+
metadata: import_zod21.z.object({ widget: import_zod21.z.record(import_zod21.z.string(), import_zod21.z.unknown()).default({}) }).default({ widget: {} })
|
|
2697
2661
|
});
|
|
2698
2662
|
|
|
2699
2663
|
// src/schema/postPurchaseSubscription.ts
|
|
2700
|
-
var
|
|
2701
|
-
var PostPurchaseSubscriptionTerms =
|
|
2664
|
+
var import_zod22 = require("zod");
|
|
2665
|
+
var PostPurchaseSubscriptionTerms = import_zod22.z.object({
|
|
2702
2666
|
adjustment: PostPurchasePlanAdjustment.optional(),
|
|
2703
|
-
initialShippingPrice:
|
|
2704
|
-
intervalLabel:
|
|
2705
|
-
name:
|
|
2706
|
-
recurringShippingPrice:
|
|
2707
|
-
shippingOption:
|
|
2667
|
+
initialShippingPrice: import_zod22.z.number().nonnegative(),
|
|
2668
|
+
intervalLabel: import_zod22.z.string().min(1),
|
|
2669
|
+
name: import_zod22.z.string().min(1),
|
|
2670
|
+
recurringShippingPrice: import_zod22.z.number().nonnegative(),
|
|
2671
|
+
shippingOption: import_zod22.z.object({ presentmentTitle: import_zod22.z.string(), title: import_zod22.z.string() })
|
|
2708
2672
|
});
|
|
2709
2673
|
|
|
2710
2674
|
// src/schema/postPurchaseProduct.ts
|
|
@@ -2714,348 +2678,143 @@ var PostPurchaseVariant = OfferProduct.shape.variants.element.pick({ id: true, t
|
|
|
2714
2678
|
id: PostPurchaseVariantId,
|
|
2715
2679
|
price: PostPurchaseAmount
|
|
2716
2680
|
});
|
|
2717
|
-
var PreparedPostPurchaseProduct =
|
|
2681
|
+
var PreparedPostPurchaseProduct = import_zod23.z.object({
|
|
2718
2682
|
display: PostPurchaseProductDisplay,
|
|
2719
|
-
labels:
|
|
2683
|
+
labels: import_zod23.z.object({
|
|
2720
2684
|
declineAll: global.declineAll,
|
|
2721
|
-
free:
|
|
2722
|
-
payNow:
|
|
2723
|
-
quantity:
|
|
2685
|
+
free: import_zod23.z.string(),
|
|
2686
|
+
payNow: import_zod23.z.string(),
|
|
2687
|
+
quantity: import_zod23.z.string(),
|
|
2724
2688
|
recurringShipping: global.recurringShipping,
|
|
2725
2689
|
recurringSubtotal: global.recurringSubtotal,
|
|
2726
|
-
save:
|
|
2727
|
-
shipping:
|
|
2728
|
-
subtotal:
|
|
2729
|
-
taxes:
|
|
2730
|
-
total:
|
|
2690
|
+
save: import_zod23.z.string(),
|
|
2691
|
+
shipping: import_zod23.z.string(),
|
|
2692
|
+
subtotal: import_zod23.z.string(),
|
|
2693
|
+
taxes: import_zod23.z.string(),
|
|
2694
|
+
total: import_zod23.z.string()
|
|
2731
2695
|
}),
|
|
2732
2696
|
product: OfferProduct.pick({ description: true, id: true, image: true, title: true }).extend({
|
|
2733
2697
|
description: OfferProduct.shape.description.nullable(),
|
|
2734
2698
|
id: PostPurchaseProductId,
|
|
2735
2699
|
variant: PostPurchaseVariant
|
|
2736
2700
|
}),
|
|
2737
|
-
selection:
|
|
2701
|
+
selection: import_zod23.z.object({
|
|
2738
2702
|
productId: PostPurchaseProductId,
|
|
2739
|
-
quantity:
|
|
2740
|
-
sellingPlanId:
|
|
2703
|
+
quantity: import_zod23.z.number().int().positive(),
|
|
2704
|
+
sellingPlanId: import_zod23.z.number().int().positive().optional(),
|
|
2741
2705
|
variantId: PostPurchaseVariantId
|
|
2742
2706
|
}),
|
|
2743
|
-
status:
|
|
2744
|
-
terms:
|
|
2707
|
+
status: import_zod23.z.literal("prepared"),
|
|
2708
|
+
terms: import_zod23.z.object({
|
|
2745
2709
|
discount: PostPurchaseDiscount,
|
|
2746
|
-
shipping:
|
|
2747
|
-
amount:
|
|
2748
|
-
title:
|
|
2749
|
-
type:
|
|
2710
|
+
shipping: import_zod23.z.object({
|
|
2711
|
+
amount: import_zod23.z.number().nonnegative(),
|
|
2712
|
+
title: import_zod23.z.string(),
|
|
2713
|
+
type: import_zod23.z.enum(["free", "fixed_amount"])
|
|
2750
2714
|
}),
|
|
2751
2715
|
subscription: PostPurchaseSubscriptionTerms.optional()
|
|
2752
2716
|
})
|
|
2753
2717
|
});
|
|
2754
|
-
var PostPurchasePreparation =
|
|
2718
|
+
var PostPurchasePreparation = import_zod23.z.discriminatedUnion("status", [
|
|
2755
2719
|
PreparedPostPurchaseProduct,
|
|
2756
|
-
|
|
2720
|
+
import_zod23.z.object({ reason: import_zod23.z.string(), status: import_zod23.z.literal("unsupported") })
|
|
2757
2721
|
]);
|
|
2758
2722
|
|
|
2759
|
-
// src/schema/postPurchaseProductCollectionView.ts
|
|
2760
|
-
var import_zod27 = require("zod");
|
|
2761
|
-
var PostPurchaseExcludedProductIds = import_zod27.z.array(PostPurchaseProductId).default([]);
|
|
2762
|
-
|
|
2763
|
-
// src/schema/postPurchaseProductSettings.ts
|
|
2764
|
-
var import_zod28 = require("zod");
|
|
2765
|
-
var amount = import_zod28.z.union([import_zod28.z.number().nonnegative(), PostPurchaseAmount.transform(Number)]);
|
|
2766
|
-
var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
2767
|
-
discountedFrom: true,
|
|
2768
|
-
language: true,
|
|
2769
|
-
productLimit: true,
|
|
2770
|
-
productOptions: true,
|
|
2771
|
-
productType: true,
|
|
2772
|
-
productTypeSelector: true,
|
|
2773
|
-
quantityInputs: true,
|
|
2774
|
-
subscriptionIsDefault: true,
|
|
2775
|
-
upgradeToSubscription: true
|
|
2776
|
-
}).extend({
|
|
2777
|
-
advance: import_zod28.z.unknown().default({}),
|
|
2778
|
-
blocks: import_zod28.z.array(import_zod28.z.unknown()).optional(),
|
|
2779
|
-
discount: PostPurchaseSettings.shape.discount.extend({ amount: amount.default(30) }),
|
|
2780
|
-
integrations: import_zod28.z.unknown().default({}),
|
|
2781
|
-
shipping: PostPurchaseSettings.shape.shipping.extend({ amount: amount.default(10) }),
|
|
2782
|
-
styles: import_zod28.z.unknown().default({}),
|
|
2783
|
-
subImages: PostPurchaseSettings.shape.subImages.catch(null),
|
|
2784
|
-
subscription: import_zod28.z.unknown().default(PostPurchaseSettings.shape.subscription.parse(void 0))
|
|
2785
|
-
});
|
|
2786
|
-
|
|
2787
|
-
// src/schema/postPurchaseSelection.ts
|
|
2788
|
-
var import_zod29 = require("zod");
|
|
2789
|
-
var SelectionClaimsSchema = DecideRequestSchema.extend({
|
|
2790
|
-
appId: PostPurchaseAppIdSchema,
|
|
2791
|
-
entry: DecisionEntrySchema,
|
|
2792
|
-
iss: import_zod29.z.literal("rebuy-api"),
|
|
2793
|
-
purpose: import_zod29.z.literal("post-purchase-selection")
|
|
2794
|
-
});
|
|
2795
|
-
var SessionStartRequestSchema = DecideRequestSchema.extend({
|
|
2796
|
-
selectionToken: import_zod29.z.string().min(1).max(8192).optional()
|
|
2797
|
-
}).strict();
|
|
2798
|
-
|
|
2799
|
-
// src/schema/postPurchaseSession.ts
|
|
2800
|
-
var import_zod30 = require("zod");
|
|
2801
|
-
var SessionIdentitySchema = DecideRequestSchema.extend({ appId: PostPurchaseAppIdSchema });
|
|
2802
|
-
var SessionOrderTimingSchema = import_zod30.z.object({
|
|
2803
|
-
nativeDeadline: PostPurchaseTimestampSchema,
|
|
2804
|
-
orderCreatedAt: PostPurchaseTimestampSchema,
|
|
2805
|
-
orderId: PostPurchaseOrderIdSchema,
|
|
2806
|
-
timingSource: import_zod30.z.literal("shopify-order-created-at")
|
|
2807
|
-
});
|
|
2808
|
-
var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
2809
|
-
deadline: PostPurchaseTimestampSchema,
|
|
2810
|
-
entry: DecisionEntrySchema,
|
|
2811
|
-
policySnapshot: SessionPolicySchema,
|
|
2812
|
-
startedAt: PostPurchaseTimestampSchema
|
|
2813
|
-
}).refine((session) => session.orderCreatedAt <= session.startedAt, {
|
|
2814
|
-
message: "startedAt must not precede orderCreatedAt",
|
|
2815
|
-
path: ["startedAt"]
|
|
2816
|
-
}).refine((session) => session.startedAt <= session.deadline, {
|
|
2817
|
-
message: "deadline must not precede startedAt",
|
|
2818
|
-
path: ["deadline"]
|
|
2819
|
-
}).refine((session) => session.deadline <= session.nativeDeadline, {
|
|
2820
|
-
message: "deadline must not exceed nativeDeadline",
|
|
2821
|
-
path: ["deadline"]
|
|
2822
|
-
});
|
|
2823
|
-
var SessionStartResponseSchema = import_zod30.z.object({
|
|
2824
|
-
data: import_zod30.z.object({
|
|
2825
|
-
phase: import_zod30.z.literal("render"),
|
|
2826
|
-
serverNow: PostPurchaseTimestampSchema,
|
|
2827
|
-
session: ReadySessionTimingSchema,
|
|
2828
|
-
workflowPhase: import_zod30.z.literal("start")
|
|
2829
|
-
}),
|
|
2830
|
-
successful: import_zod30.z.literal(true)
|
|
2831
|
-
});
|
|
2832
|
-
|
|
2833
|
-
// src/schema/postPurchaseSessionClose.ts
|
|
2834
|
-
var import_zod31 = require("zod");
|
|
2835
|
-
var SessionClosureSchema = import_zod31.z.object({ closedAt: PostPurchaseTimestampSchema, status: import_zod31.z.literal("closed") });
|
|
2836
|
-
var SessionCloseRequestSchema = DecideRequestSchema.strict();
|
|
2837
|
-
var SessionCloseResponseSchema = import_zod31.z.object({ data: SessionClosureSchema, successful: import_zod31.z.literal(true) });
|
|
2838
|
-
|
|
2839
|
-
// src/schema/postPurchaseShadow.ts
|
|
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") })
|
|
2844
|
-
]);
|
|
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, {
|
|
2847
|
-
message: "differences must not contain duplicate entries"
|
|
2848
|
-
}),
|
|
2849
|
-
legacySelection: PostPurchaseShadowSelectionSchema,
|
|
2850
|
-
phase: import_zod32.z.literal("shouldRender"),
|
|
2851
|
-
sampleId: import_zod32.z.string(),
|
|
2852
|
-
serverSelection: PostPurchaseShadowSelectionSchema.optional(),
|
|
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")
|
|
2856
|
-
});
|
|
2857
|
-
var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
2858
|
-
(report) => report.status !== "match" || report.differences.length === 0,
|
|
2859
|
-
{ message: "status 'match' requires an empty differences array", path: ["status"] }
|
|
2860
|
-
).refine((report) => report.status !== "diverged" || report.differences.length > 0, {
|
|
2861
|
-
message: "status 'diverged' requires a non-empty differences array",
|
|
2862
|
-
path: ["status"]
|
|
2863
|
-
}).refine((report) => report.status !== "diverged" || report.serverSelection !== void 0, {
|
|
2864
|
-
message: "status 'diverged' requires a serverSelection to diverge from",
|
|
2865
|
-
path: ["status"]
|
|
2866
|
-
});
|
|
2867
|
-
|
|
2868
|
-
// src/schema/postPurchaseSkipTrace.ts
|
|
2869
|
-
var import_zod33 = require("zod");
|
|
2870
|
-
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
2871
|
-
var PostPurchaseSkipTraceSchema = import_zod33.z.array(
|
|
2872
|
-
import_zod33.z.object({
|
|
2873
|
-
entry: DecisionEntrySchema,
|
|
2874
|
-
reason: PostPurchaseSkipReasonSchema
|
|
2875
|
-
})
|
|
2876
|
-
).max(POST_PURCHASE_SKIP_LIMIT);
|
|
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
|
-
|
|
2904
2723
|
// src/schema/postPurchaseVariantCatalog.ts
|
|
2905
|
-
var
|
|
2906
|
-
var PostPurchaseVariantSelector =
|
|
2724
|
+
var import_zod24 = require("zod");
|
|
2725
|
+
var PostPurchaseVariantSelector = import_zod24.z.object({ variantId: PostPurchaseVariantId }).strict();
|
|
2907
2726
|
var PostPurchaseVariantOption = OfferProduct.shape.options.element.extend({
|
|
2908
|
-
id:
|
|
2909
|
-
position:
|
|
2727
|
+
id: import_zod24.z.number().int().positive(),
|
|
2728
|
+
position: import_zod24.z.number().int().min(1).max(3)
|
|
2910
2729
|
});
|
|
2911
2730
|
var PostPurchaseVariantValues = OfferProduct.shape.variants.element.pick({
|
|
2912
2731
|
option1: true,
|
|
2913
2732
|
option2: true,
|
|
2914
2733
|
option3: true
|
|
2915
2734
|
});
|
|
2916
|
-
var PostPurchaseVariantCatalog =
|
|
2735
|
+
var PostPurchaseVariantCatalog = import_zod24.z.object({
|
|
2917
2736
|
displayMode: PostPurchaseSettings.shape.productOptions.shape.variantSelectorDisplayMode,
|
|
2918
|
-
options:
|
|
2737
|
+
options: import_zod24.z.array(PostPurchaseVariantOption),
|
|
2919
2738
|
productId: PostPurchaseProductId,
|
|
2920
2739
|
showSelectors: PostPurchaseSettings.shape.productOptions.shape.showVariantSelectors,
|
|
2921
|
-
variants:
|
|
2740
|
+
variants: import_zod24.z.array(
|
|
2922
2741
|
PostPurchaseVariantValues.partial().extend({
|
|
2923
|
-
available:
|
|
2742
|
+
available: import_zod24.z.boolean(),
|
|
2924
2743
|
id: PostPurchaseVariantId,
|
|
2925
|
-
imageId:
|
|
2744
|
+
imageId: import_zod24.z.number().int().nonnegative().nullish(),
|
|
2926
2745
|
title: OfferProduct.shape.variants.element.shape.title
|
|
2927
2746
|
})
|
|
2928
2747
|
)
|
|
2929
2748
|
});
|
|
2930
2749
|
|
|
2931
|
-
// src/schema/
|
|
2932
|
-
var
|
|
2933
|
-
var
|
|
2934
|
-
|
|
2750
|
+
// src/schema/postPurchaseGroupCatalog.ts
|
|
2751
|
+
var productId = PreparedPostPurchaseProduct.shape.selection.shape.productId;
|
|
2752
|
+
var source = PostPurchaseProductSource.shape.data.element;
|
|
2753
|
+
var PostPurchaseGroupDescription = source.pick({ description: true, id: true, image: true, images: true, title: true }).extend({
|
|
2754
|
+
description: source.shape.description.default(null),
|
|
2755
|
+
image: source.shape.image.default(null),
|
|
2756
|
+
options: PostPurchaseVariantCatalog.shape.options.default([])
|
|
2935
2757
|
});
|
|
2936
|
-
var
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
inventoryPolicy: import_zod37.z.string(),
|
|
2940
|
-
inventoryQuantity: import_zod37.z.number()
|
|
2758
|
+
var PostPurchaseGroupCatalog = import_zod25.z.object({
|
|
2759
|
+
memberProductId: productId,
|
|
2760
|
+
options: import_zod25.z.array(import_zod25.z.object({ productId, title: import_zod25.z.string(), variantCatalog: PostPurchaseVariantCatalog }))
|
|
2941
2761
|
});
|
|
2942
|
-
var
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
options,
|
|
2946
|
-
selectedVariant: variant.optional(),
|
|
2947
|
-
variants: import_zod37.z.array(variant)
|
|
2762
|
+
var PostPurchaseGroupSelection = import_zod25.z.object({
|
|
2763
|
+
memberProductId: productId,
|
|
2764
|
+
productId
|
|
2948
2765
|
});
|
|
2949
|
-
var PostPurchaseVariantDefaultSettings = PostPurchaseSettings.shape.productOptions.pick({
|
|
2950
|
-
hideOutOfStockVariants: true,
|
|
2951
|
-
matchVariant: true
|
|
2952
|
-
});
|
|
2953
|
-
var PostPurchaseOrderAttributes = import_zod37.z.record(import_zod37.z.string(), import_zod37.z.array(import_zod37.z.string())).default({});
|
|
2954
2766
|
|
|
2955
|
-
// src/schema/
|
|
2956
|
-
var
|
|
2957
|
-
var
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
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()
|
|
2968
|
-
})
|
|
2969
|
-
),
|
|
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()
|
|
2976
|
-
})
|
|
2977
|
-
),
|
|
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()
|
|
2990
|
-
})
|
|
2991
|
-
),
|
|
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([
|
|
3006
|
-
"attentive",
|
|
3007
|
-
"judgeme",
|
|
3008
|
-
"junip",
|
|
3009
|
-
"klaviyo",
|
|
3010
|
-
"loox",
|
|
3011
|
-
"okendo",
|
|
3012
|
-
"opinew",
|
|
3013
|
-
"recharge",
|
|
3014
|
-
"reviewsio",
|
|
3015
|
-
"stamped",
|
|
3016
|
-
"yotpo"
|
|
3017
|
-
]),
|
|
3018
|
-
import_zod38.z.union([import_zod38.z.boolean(), import_zod38.z.unknown()])
|
|
3019
|
-
),
|
|
3020
|
-
markets: import_zod38.z.object({
|
|
3021
|
-
enabled: import_zod38.z.boolean()
|
|
3022
|
-
}),
|
|
3023
|
-
monetize: import_zod38.z.object({
|
|
3024
|
-
publisherKey: import_zod38.z.string().nullable()
|
|
3025
|
-
}).nullish(),
|
|
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()
|
|
2767
|
+
// src/schema/postPurchaseIdentity.ts
|
|
2768
|
+
var import_zod26 = require("zod");
|
|
2769
|
+
var POST_PURCHASE_ID_MAX = 128;
|
|
2770
|
+
var PostPurchaseTimestampSchema = import_zod26.z.number().int().nonnegative();
|
|
2771
|
+
var PostPurchaseOrderIdSchema = import_zod26.z.string().regex(/^gid:\/\/shopify\/Order\/[1-9]\d*$/);
|
|
2772
|
+
var ShopifyDomainSchema = import_zod26.z.string().max(POST_PURCHASE_ID_MAX).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?\.myshopify\.com$/);
|
|
2773
|
+
var DecideRequestSchema = import_zod26.z.object({
|
|
2774
|
+
checkoutToken: import_zod26.z.string().min(1).max(POST_PURCHASE_ID_MAX),
|
|
2775
|
+
shop: ShopifyDomainSchema
|
|
3037
2776
|
});
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
smartCart: SmartCartConfig.nullish().catch(void 0),
|
|
3048
|
-
smartFlows: import_zod39.z.array(import_zod39.z.unknown())
|
|
2777
|
+
var PostPurchaseAppIdSchema = import_zod26.z.string().min(1).max(POST_PURCHASE_ID_MAX);
|
|
2778
|
+
var DecisionEntrySchema = import_zod26.z.object({
|
|
2779
|
+
blockId: import_zod26.z.number().int().positive(),
|
|
2780
|
+
blockIndex: import_zod26.z.string(),
|
|
2781
|
+
blockParentIndex: import_zod26.z.string(),
|
|
2782
|
+
flowId: import_zod26.z.number().int().positive(),
|
|
2783
|
+
sectionId: import_zod26.z.number().int().positive(),
|
|
2784
|
+
widgetId: import_zod26.z.number().int().positive(),
|
|
2785
|
+
widgetTraffic: import_zod26.z.number().min(0).max(100)
|
|
3049
2786
|
});
|
|
3050
2787
|
|
|
3051
|
-
// src/schema/
|
|
3052
|
-
var
|
|
2788
|
+
// src/schema/postPurchaseOfferEligibility.ts
|
|
2789
|
+
var import_zod28 = require("zod");
|
|
3053
2790
|
|
|
3054
|
-
// src/schema/
|
|
3055
|
-
var
|
|
3056
|
-
var
|
|
3057
|
-
|
|
3058
|
-
|
|
2791
|
+
// src/schema/postPurchaseProductCollectionView.ts
|
|
2792
|
+
var import_zod27 = require("zod");
|
|
2793
|
+
var PostPurchaseExcludedProductIds = import_zod27.z.array(PostPurchaseProductId).default([]);
|
|
2794
|
+
|
|
2795
|
+
// src/schema/postPurchaseOfferEligibility.ts
|
|
2796
|
+
var selection = PreparedPostPurchaseProduct.shape.selection;
|
|
2797
|
+
var PostPurchaseOfferSkipReason = import_zod28.z.enum(["empty", "no-eligible-subscription"]);
|
|
2798
|
+
var PostPurchaseOfferEligibilityContext = import_zod28.z.object({
|
|
2799
|
+
excludedProductIds: PostPurchaseExcludedProductIds,
|
|
2800
|
+
originalLineItems: import_zod28.z.array(selection.pick({ productId: true, sellingPlanId: true, variantId: true }))
|
|
2801
|
+
});
|
|
2802
|
+
var PostPurchaseOfferEligibility = import_zod28.z.discriminatedUnion("status", [
|
|
2803
|
+
import_zod28.z.object({
|
|
2804
|
+
members: import_zod28.z.array(
|
|
2805
|
+
import_zod28.z.object({ productId: selection.shape.productId, productIndex: import_zod28.z.number().int().nonnegative() })
|
|
2806
|
+
),
|
|
2807
|
+
status: import_zod28.z.literal("retain")
|
|
2808
|
+
}),
|
|
2809
|
+
import_zod28.z.object({ reason: PostPurchaseOfferSkipReason, status: import_zod28.z.literal("skip") }),
|
|
2810
|
+
import_zod28.z.object({ reason: import_zod28.z.literal("eligible-upgrade").optional(), status: import_zod28.z.literal("unavailable") })
|
|
2811
|
+
]);
|
|
2812
|
+
|
|
2813
|
+
// src/schema/postPurchaseOfferPresentation.ts
|
|
2814
|
+
var import_zod48 = require("zod");
|
|
2815
|
+
|
|
2816
|
+
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
2817
|
+
var import_zod47 = require("zod");
|
|
3059
2818
|
|
|
3060
2819
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
3061
2820
|
var import_es_toolkit3 = require("es-toolkit");
|
|
@@ -3108,32 +2867,20 @@ var targetAreas = {
|
|
|
3108
2867
|
]
|
|
3109
2868
|
};
|
|
3110
2869
|
|
|
3111
|
-
// src/schema/widgets/checkoutExtension.ts
|
|
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)
|
|
3115
|
-
});
|
|
3116
|
-
|
|
3117
|
-
// src/schema/widgets/contentBlock.ts
|
|
3118
|
-
var import_zod61 = require("zod");
|
|
3119
|
-
|
|
3120
|
-
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
3121
|
-
var import_zod60 = require("zod");
|
|
3122
|
-
|
|
3123
2870
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
3124
2871
|
var import_uuid15 = require("uuid");
|
|
3125
|
-
var
|
|
2872
|
+
var import_zod46 = require("zod");
|
|
3126
2873
|
|
|
3127
2874
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
3128
|
-
var
|
|
2875
|
+
var import_zod45 = require("zod");
|
|
3129
2876
|
|
|
3130
2877
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
3131
|
-
var
|
|
3132
|
-
var CABBannerSection =
|
|
2878
|
+
var import_zod29 = require("zod");
|
|
2879
|
+
var CABBannerSection = import_zod29.z.lazy(
|
|
3133
2880
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
3134
|
-
buttonField:
|
|
3135
|
-
color:
|
|
3136
|
-
dismissible:
|
|
2881
|
+
buttonField: import_zod29.z.enum(buttonFields).optional(),
|
|
2882
|
+
color: import_zod29.z.enum(bannerColors).default("info"),
|
|
2883
|
+
dismissible: import_zod29.z.boolean().default(true),
|
|
3137
2884
|
/**
|
|
3138
2885
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
3139
2886
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -3149,18 +2896,18 @@ var CABBannerSection = import_zod42.z.lazy(
|
|
|
3149
2896
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
3150
2897
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
3151
2898
|
*/
|
|
3152
|
-
heading:
|
|
3153
|
-
sectionType:
|
|
2899
|
+
heading: import_zod29.z.record(import_zod29.z.string(), import_zod29.z.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
2900
|
+
sectionType: import_zod29.z.literal(SectionType.banner).default(SectionType.banner)
|
|
3154
2901
|
})
|
|
3155
2902
|
);
|
|
3156
2903
|
|
|
3157
2904
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
3158
2905
|
var import_uuid5 = require("uuid");
|
|
3159
|
-
var
|
|
2906
|
+
var import_zod31 = require("zod");
|
|
3160
2907
|
|
|
3161
2908
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
3162
2909
|
var import_uuid4 = require("uuid");
|
|
3163
|
-
var
|
|
2910
|
+
var import_zod30 = require("zod");
|
|
3164
2911
|
|
|
3165
2912
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
3166
2913
|
var iconNames = [
|
|
@@ -3247,17 +2994,17 @@ var iconTones = ["auto", "critical", "custom", "info", "neutral", "success", "wa
|
|
|
3247
2994
|
var IconTone = freezeEnum(iconTones);
|
|
3248
2995
|
|
|
3249
2996
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
3250
|
-
var CABImageSectionFields =
|
|
2997
|
+
var CABImageSectionFields = import_zod30.z.object({
|
|
3251
2998
|
...CABVariableFields,
|
|
3252
|
-
altText:
|
|
2999
|
+
altText: import_zod30.z.string().refine(checkForHTML, NO_HTML).default(""),
|
|
3253
3000
|
/**
|
|
3254
3001
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
3255
3002
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
3256
3003
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
3257
3004
|
*/
|
|
3258
|
-
aspectRatio:
|
|
3259
|
-
border:
|
|
3260
|
-
buttonField:
|
|
3005
|
+
aspectRatio: import_zod30.z.number().positive().nullable().default(null),
|
|
3006
|
+
border: import_zod30.z.lazy(() => CABBorder),
|
|
3007
|
+
buttonField: import_zod30.z.enum(buttonFields).optional(),
|
|
3261
3008
|
/**
|
|
3262
3009
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
3263
3010
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -3276,40 +3023,40 @@ var CABImageSectionFields = import_zod43.z.object({
|
|
|
3276
3023
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
3277
3024
|
* the risky half.
|
|
3278
3025
|
*/
|
|
3279
|
-
category:
|
|
3026
|
+
category: import_zod30.z.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
3280
3027
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
3281
|
-
iconSize:
|
|
3028
|
+
iconSize: import_zod30.z.enum(iconSizes).nullable().default(null),
|
|
3282
3029
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
3283
|
-
iconTone:
|
|
3284
|
-
name:
|
|
3285
|
-
naturalHeight:
|
|
3286
|
-
naturalWidth:
|
|
3030
|
+
iconTone: import_zod30.z.enum(iconTones).nullable().default(null),
|
|
3031
|
+
name: import_zod30.z.string().optional(),
|
|
3032
|
+
naturalHeight: import_zod30.z.number().default(0),
|
|
3033
|
+
naturalWidth: import_zod30.z.number().default(0),
|
|
3287
3034
|
/**
|
|
3288
3035
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
3289
3036
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
3290
3037
|
*/
|
|
3291
|
-
objectFit:
|
|
3292
|
-
sectionId:
|
|
3293
|
-
sectionType:
|
|
3038
|
+
objectFit: import_zod30.z.enum(objectFits).default(ObjectFit.contain),
|
|
3039
|
+
sectionId: import_zod30.z.uuid().default(() => (0, import_uuid4.v7)()),
|
|
3040
|
+
sectionType: import_zod30.z.literal(SectionType.image).default(SectionType.image),
|
|
3294
3041
|
/**
|
|
3295
3042
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
3296
3043
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
3297
3044
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
3298
3045
|
* server-chosen tier icon actually needs it.
|
|
3299
3046
|
*/
|
|
3300
|
-
source:
|
|
3301
|
-
width:
|
|
3047
|
+
source: import_zod30.z.union([import_zod30.z.url(), import_zod30.z.literal(""), import_zod30.z.string().regex(DYNAMIC_TOKEN_REGEX), import_zod30.z.enum(iconNames)]).default(""),
|
|
3048
|
+
width: import_zod30.z.number().default(100)
|
|
3302
3049
|
});
|
|
3303
3050
|
var iconNameSet = new Set(iconNames);
|
|
3304
|
-
var isIconName = (
|
|
3305
|
-
var CABImageSection = CABImageSectionFields.superRefine(({ category, source }, ctx) => {
|
|
3306
|
-
if (category === "icon" &&
|
|
3051
|
+
var isIconName = (source2) => iconNameSet.has(source2);
|
|
3052
|
+
var CABImageSection = CABImageSectionFields.superRefine(({ category, source: source2 }, ctx) => {
|
|
3053
|
+
if (category === "icon" && source2 !== "" && !isIconName(source2))
|
|
3307
3054
|
ctx.addIssue({
|
|
3308
3055
|
code: "custom",
|
|
3309
3056
|
message: "icon-mode source must be an icon name",
|
|
3310
3057
|
path: ["source"]
|
|
3311
3058
|
});
|
|
3312
|
-
if (category !== "icon" && isIconName(
|
|
3059
|
+
if (category !== "icon" && isIconName(source2))
|
|
3313
3060
|
ctx.addIssue({
|
|
3314
3061
|
code: "custom",
|
|
3315
3062
|
message: "source must be a URL or dynamic token unless category is `icon`",
|
|
@@ -3318,35 +3065,35 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source }, c
|
|
|
3318
3065
|
});
|
|
3319
3066
|
|
|
3320
3067
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
3321
|
-
var CABButtonContent =
|
|
3322
|
-
() =>
|
|
3068
|
+
var CABButtonContent = import_zod31.z.lazy(
|
|
3069
|
+
() => import_zod31.z.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
3323
3070
|
);
|
|
3324
|
-
var CABButtonSection =
|
|
3071
|
+
var CABButtonSection = import_zod31.z.object({
|
|
3325
3072
|
...CABVariableFields,
|
|
3326
|
-
action:
|
|
3327
|
-
buttonStyle:
|
|
3328
|
-
custom:
|
|
3329
|
-
color:
|
|
3330
|
-
height:
|
|
3331
|
-
width:
|
|
3073
|
+
action: import_zod31.z.union([import_zod31.z.literal(""), import_zod31.z.enum(buttonActions)]).default(""),
|
|
3074
|
+
buttonStyle: import_zod31.z.enum(buttonStyles).default(ButtonStyle.primary),
|
|
3075
|
+
custom: import_zod31.z.object({
|
|
3076
|
+
color: import_zod31.z.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
3077
|
+
height: import_zod31.z.number().default(52),
|
|
3078
|
+
width: import_zod31.z.number().default(300)
|
|
3332
3079
|
}).default({
|
|
3333
3080
|
color: "#005bd3",
|
|
3334
3081
|
height: 52,
|
|
3335
3082
|
width: 300
|
|
3336
3083
|
}),
|
|
3337
|
-
disableDowngrade:
|
|
3338
|
-
name:
|
|
3339
|
-
optionId:
|
|
3340
|
-
popover:
|
|
3341
|
-
alignment:
|
|
3342
|
-
position:
|
|
3084
|
+
disableDowngrade: import_zod31.z.boolean().default(false),
|
|
3085
|
+
name: import_zod31.z.string().optional(),
|
|
3086
|
+
optionId: import_zod31.z.number().optional(),
|
|
3087
|
+
popover: import_zod31.z.object({
|
|
3088
|
+
alignment: import_zod31.z.enum(textAlignments).default(TextAlignment.center),
|
|
3089
|
+
position: import_zod31.z.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
3343
3090
|
}).optional().default(() => ({
|
|
3344
3091
|
alignment: TextAlignment.center,
|
|
3345
3092
|
position: PopoverPosition.blockStart
|
|
3346
3093
|
})),
|
|
3347
|
-
sectionId:
|
|
3348
|
-
sections:
|
|
3349
|
-
sectionType:
|
|
3094
|
+
sectionId: import_zod31.z.uuid().default(() => (0, import_uuid5.v7)()),
|
|
3095
|
+
sections: import_zod31.z.union([import_zod31.z.array(CABButtonContent), import_zod31.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
3096
|
+
sectionType: import_zod31.z.literal(SectionType.button).default(SectionType.button),
|
|
3350
3097
|
/**
|
|
3351
3098
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
3352
3099
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -3361,91 +3108,91 @@ var CABButtonSection = import_zod44.z.object({
|
|
|
3361
3108
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
3362
3109
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
3363
3110
|
*/
|
|
3364
|
-
tier:
|
|
3111
|
+
tier: import_zod31.z.object({ tierId: import_zod31.z.string().min(1) }).optional(),
|
|
3365
3112
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
3366
|
-
trackingUrl:
|
|
3113
|
+
trackingUrl: import_zod31.z.string().optional(),
|
|
3367
3114
|
/**
|
|
3368
3115
|
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
3369
3116
|
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
3370
3117
|
*/
|
|
3371
|
-
variableEffects:
|
|
3118
|
+
variableEffects: import_zod31.z.array(CABVariableEffect).optional()
|
|
3372
3119
|
});
|
|
3373
3120
|
|
|
3374
3121
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3375
|
-
var
|
|
3122
|
+
var import_zod36 = require("zod");
|
|
3376
3123
|
|
|
3377
3124
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3378
|
-
var
|
|
3125
|
+
var import_zod35 = require("zod");
|
|
3379
3126
|
|
|
3380
3127
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
3381
3128
|
var import_uuid6 = require("uuid");
|
|
3382
|
-
var
|
|
3383
|
-
var CABDiscount =
|
|
3384
|
-
amount:
|
|
3385
|
-
discountedBy:
|
|
3386
|
-
discountedFrom:
|
|
3387
|
-
type:
|
|
3388
|
-
});
|
|
3389
|
-
var CABIntegrations =
|
|
3390
|
-
judgeme:
|
|
3391
|
-
junip:
|
|
3392
|
-
klaviyo:
|
|
3393
|
-
loox:
|
|
3394
|
-
okendo:
|
|
3395
|
-
opinew:
|
|
3396
|
-
reviewsio:
|
|
3397
|
-
stamped:
|
|
3398
|
-
yotpo:
|
|
3399
|
-
});
|
|
3400
|
-
var CABDataSourceSection =
|
|
3401
|
-
dataSourceId:
|
|
3402
|
-
dataSourcePath:
|
|
3129
|
+
var import_zod32 = require("zod");
|
|
3130
|
+
var CABDiscount = import_zod32.z.object({
|
|
3131
|
+
amount: import_zod32.z.union([import_zod32.z.number(), import_zod32.z.string()]).catch(0),
|
|
3132
|
+
discountedBy: import_zod32.z.string().optional(),
|
|
3133
|
+
discountedFrom: import_zod32.z.enum(discountSources).optional().catch(void 0),
|
|
3134
|
+
type: import_zod32.z.enum(discountTypes).catch("none")
|
|
3135
|
+
});
|
|
3136
|
+
var CABIntegrations = import_zod32.z.object({
|
|
3137
|
+
judgeme: import_zod32.z.boolean().default(false),
|
|
3138
|
+
junip: import_zod32.z.boolean().default(false),
|
|
3139
|
+
klaviyo: import_zod32.z.boolean().default(false),
|
|
3140
|
+
loox: import_zod32.z.boolean().default(false),
|
|
3141
|
+
okendo: import_zod32.z.boolean().default(false),
|
|
3142
|
+
opinew: import_zod32.z.boolean().default(false),
|
|
3143
|
+
reviewsio: import_zod32.z.boolean().default(false),
|
|
3144
|
+
stamped: import_zod32.z.boolean().default(false),
|
|
3145
|
+
yotpo: import_zod32.z.boolean().default(false)
|
|
3146
|
+
});
|
|
3147
|
+
var CABDataSourceSection = import_zod32.z.object({
|
|
3148
|
+
dataSourceId: import_zod32.z.number().nullable().default(null),
|
|
3149
|
+
dataSourcePath: import_zod32.z.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
3403
3150
|
discount: CABDiscount.optional(),
|
|
3404
3151
|
integrations: CABIntegrations.optional(),
|
|
3405
|
-
limit:
|
|
3406
|
-
matchVariant:
|
|
3407
|
-
matchVariantOutOfStock:
|
|
3408
|
-
name:
|
|
3409
|
-
productType:
|
|
3410
|
-
sectionId:
|
|
3411
|
-
sectionType:
|
|
3152
|
+
limit: import_zod32.z.number().default(1),
|
|
3153
|
+
matchVariant: import_zod32.z.boolean().default(false),
|
|
3154
|
+
matchVariantOutOfStock: import_zod32.z.boolean().default(false),
|
|
3155
|
+
name: import_zod32.z.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
3156
|
+
productType: import_zod32.z.enum(productTypes).optional(),
|
|
3157
|
+
sectionId: import_zod32.z.uuid().default(() => (0, import_uuid6.v7)()),
|
|
3158
|
+
sectionType: import_zod32.z.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
3412
3159
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
3413
|
-
subscriptionIsDefault:
|
|
3414
|
-
treatAsGwp:
|
|
3160
|
+
subscriptionIsDefault: import_zod32.z.boolean().default(false),
|
|
3161
|
+
treatAsGwp: import_zod32.z.boolean().default(false)
|
|
3415
3162
|
});
|
|
3416
3163
|
|
|
3417
3164
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3418
3165
|
var import_uuid8 = require("uuid");
|
|
3419
|
-
var
|
|
3166
|
+
var import_zod34 = require("zod");
|
|
3420
3167
|
|
|
3421
3168
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
3422
3169
|
var import_uuid7 = require("uuid");
|
|
3423
|
-
var
|
|
3424
|
-
var CABVariantContent =
|
|
3425
|
-
() =>
|
|
3170
|
+
var import_zod33 = require("zod");
|
|
3171
|
+
var CABVariantContent = import_zod33.z.lazy(
|
|
3172
|
+
() => import_zod33.z.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
3426
3173
|
);
|
|
3427
|
-
var CABProductSection =
|
|
3174
|
+
var CABProductSection = import_zod33.z.object({
|
|
3428
3175
|
...CABVariableFields,
|
|
3429
|
-
name:
|
|
3430
|
-
productId:
|
|
3431
|
-
sectionId:
|
|
3432
|
-
sections:
|
|
3433
|
-
sectionType:
|
|
3434
|
-
selectors:
|
|
3435
|
-
variantMode:
|
|
3176
|
+
name: import_zod33.z.string().optional(),
|
|
3177
|
+
productId: import_zod33.z.number().nullable().default(null),
|
|
3178
|
+
sectionId: import_zod33.z.uuid().default(() => (0, import_uuid7.v7)()),
|
|
3179
|
+
sections: import_zod33.z.union([import_zod33.z.array(CABVariantContent), import_zod33.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
3180
|
+
sectionType: import_zod33.z.literal(SectionType.product).default(SectionType.product),
|
|
3181
|
+
selectors: import_zod33.z.record(import_zod33.z.string(), import_zod33.z.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
3182
|
+
variantMode: import_zod33.z.enum(variantModes).default(VariantMode.multiple)
|
|
3436
3183
|
});
|
|
3437
3184
|
|
|
3438
3185
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3439
|
-
var CABProductsSection =
|
|
3186
|
+
var CABProductsSection = import_zod34.z.object({
|
|
3440
3187
|
...CABVariableFields,
|
|
3441
|
-
name:
|
|
3442
|
-
sectionId:
|
|
3443
|
-
sections:
|
|
3444
|
-
sectionType:
|
|
3188
|
+
name: import_zod34.z.string().optional(),
|
|
3189
|
+
sectionId: import_zod34.z.uuid().default(() => (0, import_uuid8.v7)()),
|
|
3190
|
+
sections: import_zod34.z.union([import_zod34.z.array(import_zod34.z.lazy(() => CABProductSection)), import_zod34.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
3191
|
+
sectionType: import_zod34.z.literal(SectionType.products).default(SectionType.products)
|
|
3445
3192
|
});
|
|
3446
3193
|
|
|
3447
3194
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3448
|
-
var CABOffersSection =
|
|
3195
|
+
var CABOffersSection = import_zod35.z.lazy(
|
|
3449
3196
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3450
3197
|
/**
|
|
3451
3198
|
* A rule between consecutive cards in the vertical list — legacy checkout-offers' `<Divider />`,
|
|
@@ -3453,8 +3200,8 @@ var CABOffersSection = import_zod48.z.lazy(
|
|
|
3453
3200
|
* run of products). Optional, not defaulted: only the v1 converter sets it (REB-24265); a
|
|
3454
3201
|
* hand-built tree keeps React CAB's dividerless rendering.
|
|
3455
3202
|
*/
|
|
3456
|
-
divider:
|
|
3457
|
-
sections:
|
|
3203
|
+
divider: import_zod35.z.boolean().optional(),
|
|
3204
|
+
sections: import_zod35.z.union([import_zod35.z.array(import_zod35.z.lazy(() => CABSection)), import_zod35.z.strictObject({}).transform(() => [])]).default(() => [
|
|
3458
3205
|
CABBannerSection.parse({
|
|
3459
3206
|
buttonField: "undoAddToOrder",
|
|
3460
3207
|
color: "success",
|
|
@@ -3468,77 +3215,77 @@ var CABOffersSection = import_zod48.z.lazy(
|
|
|
3468
3215
|
CABDataSourceSection.parse({}),
|
|
3469
3216
|
CABProductsSection.parse({})
|
|
3470
3217
|
]),
|
|
3471
|
-
sectionType:
|
|
3218
|
+
sectionType: import_zod35.z.literal(SectionType.offers).default(SectionType.offers)
|
|
3472
3219
|
})
|
|
3473
3220
|
);
|
|
3474
3221
|
|
|
3475
3222
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3476
|
-
var CABCarouselSection =
|
|
3223
|
+
var CABCarouselSection = import_zod36.z.lazy(
|
|
3477
3224
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3478
|
-
autoAdvanceInterval:
|
|
3479
|
-
itemsAtOnce:
|
|
3225
|
+
autoAdvanceInterval: import_zod36.z.number().default(0),
|
|
3226
|
+
itemsAtOnce: import_zod36.z.number().min(1).default(1),
|
|
3480
3227
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
3481
|
-
offersDirection:
|
|
3482
|
-
sections:
|
|
3483
|
-
sectionType:
|
|
3228
|
+
offersDirection: import_zod36.z.enum(offersDirections).default("vertical"),
|
|
3229
|
+
sections: import_zod36.z.union([import_zod36.z.array(import_zod36.z.lazy(() => CABSection)), import_zod36.z.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
3230
|
+
sectionType: import_zod36.z.literal(SectionType.carousel).default(SectionType.carousel)
|
|
3484
3231
|
})
|
|
3485
3232
|
);
|
|
3486
3233
|
|
|
3487
3234
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
3488
|
-
var
|
|
3489
|
-
var CABCartLineSection =
|
|
3235
|
+
var import_zod37 = require("zod");
|
|
3236
|
+
var CABCartLineSection = import_zod37.z.lazy(
|
|
3490
3237
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3491
|
-
sections:
|
|
3492
|
-
sectionType:
|
|
3238
|
+
sections: import_zod37.z.union([import_zod37.z.array(import_zod37.z.lazy(() => CABSection)), import_zod37.z.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
3239
|
+
sectionType: import_zod37.z.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
3493
3240
|
})
|
|
3494
3241
|
);
|
|
3495
3242
|
|
|
3496
3243
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
3497
3244
|
var import_uuid9 = require("uuid");
|
|
3498
|
-
var
|
|
3499
|
-
var CABDiscountSection =
|
|
3245
|
+
var import_zod38 = require("zod");
|
|
3246
|
+
var CABDiscountSection = import_zod38.z.object({
|
|
3500
3247
|
...CABVariableFields,
|
|
3501
|
-
amount:
|
|
3502
|
-
discountedBy:
|
|
3503
|
-
discountedFrom:
|
|
3504
|
-
message:
|
|
3505
|
-
name:
|
|
3506
|
-
quantity:
|
|
3507
|
-
sectionId:
|
|
3508
|
-
sectionType:
|
|
3509
|
-
type:
|
|
3248
|
+
amount: import_zod38.z.union([import_zod38.z.number(), import_zod38.z.string()]).catch(0),
|
|
3249
|
+
discountedBy: import_zod38.z.string().optional(),
|
|
3250
|
+
discountedFrom: import_zod38.z.enum(discountSources).optional().catch(void 0),
|
|
3251
|
+
message: import_zod38.z.string().optional(),
|
|
3252
|
+
name: import_zod38.z.string().optional(),
|
|
3253
|
+
quantity: import_zod38.z.number().default(1),
|
|
3254
|
+
sectionId: import_zod38.z.uuid().default(() => (0, import_uuid9.v7)()),
|
|
3255
|
+
sectionType: import_zod38.z.literal(SectionType.discount).default(SectionType.discount),
|
|
3256
|
+
type: import_zod38.z.enum(discountTypes).catch("none")
|
|
3510
3257
|
});
|
|
3511
3258
|
|
|
3512
3259
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
3513
3260
|
var import_uuid10 = require("uuid");
|
|
3514
|
-
var
|
|
3515
|
-
var CABMonetizeAds =
|
|
3516
|
-
requestId:
|
|
3261
|
+
var import_zod39 = require("zod");
|
|
3262
|
+
var CABMonetizeAds = import_zod39.z.object({
|
|
3263
|
+
requestId: import_zod39.z.string().optional(),
|
|
3517
3264
|
/** Defaulted here, never in the beacon: absence of information is `ads` itself being absent. */
|
|
3518
|
-
testing:
|
|
3265
|
+
testing: import_zod39.z.boolean().default(false)
|
|
3519
3266
|
});
|
|
3520
|
-
var CABMonetizeSection =
|
|
3267
|
+
var CABMonetizeSection = import_zod39.z.object({
|
|
3521
3268
|
...CABVariableFields,
|
|
3522
3269
|
ads: CABMonetizeAds.optional(),
|
|
3523
|
-
name:
|
|
3270
|
+
name: import_zod39.z.string().optional(),
|
|
3524
3271
|
/**
|
|
3525
3272
|
* Server-hydrated offer cards (inline hydration): when `/cab/sections` was asked with a `monetize`
|
|
3526
3273
|
* context block, the composed cards ride the marker itself — `[]` means "hydrated, no fill" (render
|
|
3527
3274
|
* nothing, skip the fetch); ABSENT means "not hydrated" (the client fetches via `/cab/monetize`).
|
|
3528
3275
|
*/
|
|
3529
|
-
offers:
|
|
3276
|
+
offers: import_zod39.z.array(import_zod39.z.lazy(() => CABSection)).optional(),
|
|
3530
3277
|
/** 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. */
|
|
3531
|
-
privacyPolicyUrl:
|
|
3532
|
-
sectionId:
|
|
3533
|
-
sectionType:
|
|
3278
|
+
privacyPolicyUrl: import_zod39.z.string().optional(),
|
|
3279
|
+
sectionId: import_zod39.z.uuid().default(() => (0, import_uuid10.v7)()),
|
|
3280
|
+
sectionType: import_zod39.z.literal(SectionType.monetize).default(SectionType.monetize),
|
|
3534
3281
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
3535
|
-
subVertical:
|
|
3282
|
+
subVertical: import_zod39.z.string().optional(),
|
|
3536
3283
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
3537
|
-
vertical:
|
|
3284
|
+
vertical: import_zod39.z.string().optional()
|
|
3538
3285
|
});
|
|
3539
3286
|
|
|
3540
3287
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3541
|
-
var
|
|
3288
|
+
var import_zod40 = require("zod");
|
|
3542
3289
|
|
|
3543
3290
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
3544
3291
|
var GIFT_LABELS = {
|
|
@@ -3657,34 +3404,34 @@ var GIFT_LABELS = {
|
|
|
3657
3404
|
};
|
|
3658
3405
|
|
|
3659
3406
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3660
|
-
var CABProgressTierExclusion =
|
|
3661
|
-
collectionIds:
|
|
3662
|
-
productIds:
|
|
3663
|
-
tags:
|
|
3664
|
-
type:
|
|
3407
|
+
var CABProgressTierExclusion = import_zod40.z.object({
|
|
3408
|
+
collectionIds: import_zod40.z.array(import_zod40.z.number().int().positive()).default(() => []),
|
|
3409
|
+
productIds: import_zod40.z.array(import_zod40.z.number().int().positive()).default(() => []),
|
|
3410
|
+
tags: import_zod40.z.array(import_zod40.z.string().min(1)).default(() => []),
|
|
3411
|
+
type: import_zod40.z.enum(progressTierExclusionTypes)
|
|
3665
3412
|
});
|
|
3666
|
-
var CABProgressTier =
|
|
3413
|
+
var CABProgressTier = import_zod40.z.object({
|
|
3667
3414
|
/**
|
|
3668
3415
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
3669
3416
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
3670
3417
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
3671
3418
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
3672
3419
|
*/
|
|
3673
|
-
discount:
|
|
3420
|
+
discount: import_zod40.z.object({ amount: import_zod40.z.number().nonnegative(), type: import_zod40.z.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
3674
3421
|
/**
|
|
3675
3422
|
* Per-tier exclusion rules (onsite `exclusions` when `exclusions_enabled`): lines they match don't count
|
|
3676
3423
|
* toward this tier. Empty (the default, and the converter's output for a disabled or ruleless tier) means
|
|
3677
3424
|
* the tier measures the plain bar-level adjusted progress. Consumers read ONLY the list named by the rule's
|
|
3678
3425
|
* `type` — the converter leaves the other two at `[]`, so a populated off-type list never reaches the tree.
|
|
3679
3426
|
*/
|
|
3680
|
-
exclusions:
|
|
3427
|
+
exclusions: import_zod40.z.array(CABProgressTierExclusion).default(() => []),
|
|
3681
3428
|
/**
|
|
3682
3429
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
3683
3430
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
3684
3431
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
3685
3432
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
3686
3433
|
*/
|
|
3687
|
-
filterOosVariants:
|
|
3434
|
+
filterOosVariants: import_zod40.z.boolean().default(false),
|
|
3688
3435
|
/**
|
|
3689
3436
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
3690
3437
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -3692,10 +3439,10 @@ var CABProgressTier = import_zod53.z.object({
|
|
|
3692
3439
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
3693
3440
|
* tree is complete.
|
|
3694
3441
|
*/
|
|
3695
|
-
gift:
|
|
3696
|
-
productId:
|
|
3697
|
-
title:
|
|
3698
|
-
variantIds:
|
|
3442
|
+
gift: import_zod40.z.object({
|
|
3443
|
+
productId: import_zod40.z.number().int().positive(),
|
|
3444
|
+
title: import_zod40.z.string().optional(),
|
|
3445
|
+
variantIds: import_zod40.z.array(import_zod40.z.number().int().positive()).default(() => [])
|
|
3699
3446
|
}).optional(),
|
|
3700
3447
|
/**
|
|
3701
3448
|
* The step-row icon's square size in PIXELS (onsite `product_tier_element_size`, an admin px string the
|
|
@@ -3715,7 +3462,7 @@ var CABProgressTier = import_zod53.z.object({
|
|
|
3715
3462
|
* renderer never spells a fallback), which also makes a tree authored before this field render at
|
|
3716
3463
|
* React's size rather than the old hardcoded 20.
|
|
3717
3464
|
*/
|
|
3718
|
-
iconSizePx:
|
|
3465
|
+
iconSizePx: import_zod40.z.number().int().min(1).max(64).default(18),
|
|
3719
3466
|
/**
|
|
3720
3467
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
3721
3468
|
* type default — 'Free Shipping' or '{n}% Discount'. A PRODUCT tier gets NO converter label: its name is
|
|
@@ -3725,35 +3472,35 @@ var CABProgressTier = import_zod53.z.object({
|
|
|
3725
3472
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
3726
3473
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
3727
3474
|
*/
|
|
3728
|
-
label:
|
|
3475
|
+
label: import_zod40.z.record(import_zod40.z.string(), import_zod40.z.string()).optional(),
|
|
3729
3476
|
/**
|
|
3730
3477
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
3731
3478
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
3732
3479
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
3733
3480
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
3734
3481
|
*/
|
|
3735
|
-
productTierImage:
|
|
3482
|
+
productTierImage: import_zod40.z.boolean().default(false),
|
|
3736
3483
|
/**
|
|
3737
3484
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
3738
3485
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
3739
3486
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
3740
3487
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
3741
3488
|
*/
|
|
3742
|
-
threshold:
|
|
3489
|
+
threshold: import_zod40.z.number().int().nonnegative(),
|
|
3743
3490
|
/**
|
|
3744
3491
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
3745
3492
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
3746
3493
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
3747
3494
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
3748
3495
|
*/
|
|
3749
|
-
thresholds:
|
|
3496
|
+
thresholds: import_zod40.z.record(import_zod40.z.string(), import_zod40.z.number().int().nonnegative()).default(() => ({})),
|
|
3750
3497
|
/**
|
|
3751
3498
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
3752
3499
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
3753
3500
|
* shipping bar (single unlabeled tier, no gift).
|
|
3754
3501
|
*/
|
|
3755
|
-
tierId:
|
|
3756
|
-
tierType:
|
|
3502
|
+
tierId: import_zod40.z.string().optional(),
|
|
3503
|
+
tierType: import_zod40.z.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
3757
3504
|
/**
|
|
3758
3505
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
3759
3506
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -3764,9 +3511,9 @@ var CABProgressTier = import_zod53.z.object({
|
|
|
3764
3511
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
3765
3512
|
* template text supplies grammatically-neutral wording around the token.
|
|
3766
3513
|
*/
|
|
3767
|
-
unit:
|
|
3514
|
+
unit: import_zod40.z.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
3768
3515
|
});
|
|
3769
|
-
var CABProgressBarSection =
|
|
3516
|
+
var CABProgressBarSection = import_zod40.z.lazy(
|
|
3770
3517
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
3771
3518
|
/**
|
|
3772
3519
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -3775,35 +3522,35 @@ var CABProgressBarSection = import_zod53.z.lazy(
|
|
|
3775
3522
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
3776
3523
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
3777
3524
|
*/
|
|
3778
|
-
barId:
|
|
3525
|
+
barId: import_zod40.z.string().optional(),
|
|
3779
3526
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
3780
|
-
countryCodes:
|
|
3527
|
+
countryCodes: import_zod40.z.array(import_zod40.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3781
3528
|
/**
|
|
3782
3529
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
3783
3530
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
3784
3531
|
*/
|
|
3785
|
-
excludeCountryCodes:
|
|
3532
|
+
excludeCountryCodes: import_zod40.z.array(import_zod40.z.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3786
3533
|
/**
|
|
3787
3534
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
3788
3535
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
3789
3536
|
* adds the cart's discount allocations back to the live subtotal.
|
|
3790
3537
|
*/
|
|
3791
|
-
excludeDiscountInSubtotal:
|
|
3538
|
+
excludeDiscountInSubtotal: import_zod40.z.boolean().default(false),
|
|
3792
3539
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
3793
|
-
excludedVariantIds:
|
|
3540
|
+
excludedVariantIds: import_zod40.z.array(import_zod40.z.number().int().positive()).default(() => []),
|
|
3794
3541
|
/**
|
|
3795
3542
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
3796
3543
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
3797
3544
|
*/
|
|
3798
|
-
freeShippingOnSubscription:
|
|
3545
|
+
freeShippingOnSubscription: import_zod40.z.boolean().default(false),
|
|
3799
3546
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
3800
|
-
giftAreaTitle:
|
|
3547
|
+
giftAreaTitle: import_zod40.z.record(import_zod40.z.string(), import_zod40.z.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
3801
3548
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
3802
|
-
giftLabels:
|
|
3803
|
-
addGift:
|
|
3804
|
-
remove:
|
|
3805
|
-
selectOptions:
|
|
3806
|
-
yourGift:
|
|
3549
|
+
giftLabels: import_zod40.z.object({
|
|
3550
|
+
addGift: import_zod40.z.record(import_zod40.z.string(), import_zod40.z.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
3551
|
+
remove: import_zod40.z.record(import_zod40.z.string(), import_zod40.z.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
3552
|
+
selectOptions: import_zod40.z.record(import_zod40.z.string(), import_zod40.z.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
3553
|
+
yourGift: import_zod40.z.record(import_zod40.z.string(), import_zod40.z.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
3807
3554
|
}).default(() => ({
|
|
3808
3555
|
addGift: { ...GIFT_LABELS.addGift },
|
|
3809
3556
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -3811,38 +3558,38 @@ var CABProgressBarSection = import_zod53.z.lazy(
|
|
|
3811
3558
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
3812
3559
|
})),
|
|
3813
3560
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
3814
|
-
name:
|
|
3561
|
+
name: import_zod40.z.string().default("Order progress"),
|
|
3815
3562
|
/**
|
|
3816
3563
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
3817
3564
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
3818
3565
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
3819
3566
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
3820
3567
|
*/
|
|
3821
|
-
progressColor:
|
|
3822
|
-
sectionType:
|
|
3568
|
+
progressColor: import_zod40.z.string().optional(),
|
|
3569
|
+
sectionType: import_zod40.z.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
3823
3570
|
/**
|
|
3824
3571
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
3825
3572
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
3826
3573
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
3827
3574
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
3828
3575
|
*/
|
|
3829
|
-
tiers:
|
|
3576
|
+
tiers: import_zod40.z.union([import_zod40.z.array(CABProgressTier), import_zod40.z.strictObject({}).transform(() => [])]).default(() => [])
|
|
3830
3577
|
})
|
|
3831
3578
|
);
|
|
3832
3579
|
|
|
3833
3580
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
3834
3581
|
var import_uuid11 = require("uuid");
|
|
3835
|
-
var
|
|
3836
|
-
var CABQuantitySection =
|
|
3582
|
+
var import_zod41 = require("zod");
|
|
3583
|
+
var CABQuantitySection = import_zod41.z.object({
|
|
3837
3584
|
...CABVariableFields,
|
|
3838
|
-
errorMessages:
|
|
3839
|
-
|
|
3840
|
-
|
|
3585
|
+
errorMessages: import_zod41.z.record(
|
|
3586
|
+
import_zod41.z.string(),
|
|
3587
|
+
import_zod41.z.object({
|
|
3841
3588
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
3842
|
-
increment:
|
|
3843
|
-
max:
|
|
3844
|
-
min:
|
|
3845
|
-
neg:
|
|
3589
|
+
increment: import_zod41.z.string().optional(),
|
|
3590
|
+
max: import_zod41.z.string().optional(),
|
|
3591
|
+
min: import_zod41.z.string().optional(),
|
|
3592
|
+
neg: import_zod41.z.string().optional()
|
|
3846
3593
|
})
|
|
3847
3594
|
).default({
|
|
3848
3595
|
en: {
|
|
@@ -3852,18 +3599,18 @@ var CABQuantitySection = import_zod54.z.object({
|
|
|
3852
3599
|
neg: "Quantity cannot be negative"
|
|
3853
3600
|
}
|
|
3854
3601
|
}),
|
|
3855
|
-
inputType:
|
|
3856
|
-
max:
|
|
3857
|
-
min:
|
|
3602
|
+
inputType: import_zod41.z.enum(quantityInputs).default(QuantityInput.select),
|
|
3603
|
+
max: import_zod41.z.number().min(1).max(100).default(10),
|
|
3604
|
+
min: import_zod41.z.number().min(1).default(1),
|
|
3858
3605
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
3859
|
-
name:
|
|
3860
|
-
sectionId:
|
|
3861
|
-
sectionType:
|
|
3606
|
+
name: import_zod41.z.string().default("Quantity"),
|
|
3607
|
+
sectionId: import_zod41.z.uuid().default(() => (0, import_uuid11.v7)()),
|
|
3608
|
+
sectionType: import_zod41.z.literal(SectionType.quantity).default(SectionType.quantity)
|
|
3862
3609
|
});
|
|
3863
3610
|
|
|
3864
3611
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3865
3612
|
var import_uuid12 = require("uuid");
|
|
3866
|
-
var
|
|
3613
|
+
var import_zod42 = require("zod");
|
|
3867
3614
|
|
|
3868
3615
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
3869
3616
|
var REVIEW_LABELS = {
|
|
@@ -3926,68 +3673,68 @@ var REVIEW_LABELS = {
|
|
|
3926
3673
|
};
|
|
3927
3674
|
|
|
3928
3675
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3929
|
-
var CABReviewsSection =
|
|
3676
|
+
var CABReviewsSection = import_zod42.z.object({
|
|
3930
3677
|
...CABVariableFields,
|
|
3931
|
-
color:
|
|
3678
|
+
color: import_zod42.z.string().default("#fadb14"),
|
|
3932
3679
|
/**
|
|
3933
3680
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
3934
3681
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
3935
3682
|
* or merchant work.
|
|
3936
3683
|
*/
|
|
3937
|
-
countLabels:
|
|
3938
|
-
one:
|
|
3939
|
-
other:
|
|
3684
|
+
countLabels: import_zod42.z.object({
|
|
3685
|
+
one: import_zod42.z.record(import_zod42.z.string(), import_zod42.z.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
3686
|
+
other: import_zod42.z.record(import_zod42.z.string(), import_zod42.z.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
3940
3687
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
3941
|
-
name:
|
|
3942
|
-
sectionId:
|
|
3943
|
-
sectionType:
|
|
3944
|
-
size:
|
|
3688
|
+
name: import_zod42.z.string().optional(),
|
|
3689
|
+
sectionId: import_zod42.z.uuid().default(() => (0, import_uuid12.v7)()),
|
|
3690
|
+
sectionType: import_zod42.z.literal(SectionType.reviews).default(SectionType.reviews),
|
|
3691
|
+
size: import_zod42.z.enum(reviewsSizes).default(ReviewsSize.default),
|
|
3945
3692
|
/**
|
|
3946
3693
|
* Star outline color, interpolated into a style by the renderer, so it is hex-constrained like
|
|
3947
3694
|
* `CABButtonSection.color`. The legacy source (`PostPurchaseSettings.styles.starStrokeColor`) is a free
|
|
3948
3695
|
* string: its converter must validate and fall back to this default rather than let one odd value drop
|
|
3949
3696
|
* the whole reviews section.
|
|
3950
3697
|
*/
|
|
3951
|
-
strokeColor:
|
|
3698
|
+
strokeColor: import_zod42.z.string().regex(HEX_COLOR_REGEX).default("#fadb14"),
|
|
3952
3699
|
/** Star outline width in px; `0` draws no outline. The legacy `styles.strokeWidth` is a STRING ('1') — its converter coerces. */
|
|
3953
|
-
strokeWidth:
|
|
3700
|
+
strokeWidth: import_zod42.z.number().nonnegative().default(0)
|
|
3954
3701
|
});
|
|
3955
3702
|
|
|
3956
3703
|
// src/schema/widgets/checkout-and-beyond/separator.ts
|
|
3957
3704
|
var import_uuid13 = require("uuid");
|
|
3958
|
-
var
|
|
3959
|
-
var CABSeparatorSection =
|
|
3705
|
+
var import_zod43 = require("zod");
|
|
3706
|
+
var CABSeparatorSection = import_zod43.z.object({
|
|
3960
3707
|
...CABVariableFields,
|
|
3961
|
-
sectionId:
|
|
3962
|
-
sectionType:
|
|
3708
|
+
sectionId: import_zod43.z.uuid().default(() => (0, import_uuid13.v7)()),
|
|
3709
|
+
sectionType: import_zod43.z.literal(SectionType.separator).default(SectionType.separator)
|
|
3963
3710
|
});
|
|
3964
3711
|
|
|
3965
3712
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
3966
3713
|
var import_compat5 = require("es-toolkit/compat");
|
|
3967
3714
|
var import_uuid14 = require("uuid");
|
|
3968
|
-
var
|
|
3969
|
-
var CABVariantsSection =
|
|
3715
|
+
var import_zod44 = require("zod");
|
|
3716
|
+
var CABVariantsSection = import_zod44.z.object({
|
|
3970
3717
|
...CABVariableFields,
|
|
3971
|
-
hideOutOfStockVariants:
|
|
3972
|
-
name:
|
|
3973
|
-
sectionId:
|
|
3974
|
-
sectionType:
|
|
3975
|
-
selector:
|
|
3976
|
-
variantMode:
|
|
3718
|
+
hideOutOfStockVariants: import_zod44.z.boolean().default(false),
|
|
3719
|
+
name: import_zod44.z.string().optional(),
|
|
3720
|
+
sectionId: import_zod44.z.uuid().default(() => (0, import_uuid14.v7)()),
|
|
3721
|
+
sectionType: import_zod44.z.literal(SectionType.variants).default(SectionType.variants),
|
|
3722
|
+
selector: import_zod44.z.enum((0, import_compat5.slice)(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
3723
|
+
variantMode: import_zod44.z.enum(variantModes).default(VariantMode.multiple)
|
|
3977
3724
|
});
|
|
3978
3725
|
|
|
3979
3726
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
3980
|
-
var CABBorder =
|
|
3981
|
-
radius:
|
|
3982
|
-
style:
|
|
3983
|
-
width:
|
|
3727
|
+
var CABBorder = import_zod45.z.object({
|
|
3728
|
+
radius: import_zod45.z.enum(borderRadii).default(BorderRadius.base),
|
|
3729
|
+
style: import_zod45.z.enum(borderStyles).default(BorderStyle.none),
|
|
3730
|
+
width: import_zod45.z.enum(borderWidths).default(BorderWidth.base)
|
|
3984
3731
|
}).default({
|
|
3985
3732
|
radius: BorderRadius.base,
|
|
3986
3733
|
style: BorderStyle.none,
|
|
3987
3734
|
width: BorderWidth.base
|
|
3988
3735
|
});
|
|
3989
|
-
var CABSection =
|
|
3990
|
-
() =>
|
|
3736
|
+
var CABSection = import_zod45.z.lazy(
|
|
3737
|
+
() => import_zod45.z.discriminatedUnion("sectionType", [
|
|
3991
3738
|
CABBannerSection,
|
|
3992
3739
|
CABButtonSection,
|
|
3993
3740
|
CABCarouselSection,
|
|
@@ -4010,41 +3757,41 @@ var CABSection = import_zod58.z.lazy(
|
|
|
4010
3757
|
);
|
|
4011
3758
|
|
|
4012
3759
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
4013
|
-
var GridItem =
|
|
4014
|
-
var CABLayoutWrapping =
|
|
4015
|
-
breakAt:
|
|
4016
|
-
maxPerLine:
|
|
3760
|
+
var GridItem = import_zod46.z.union([import_zod46.z.literal("auto"), import_zod46.z.literal("fill"), import_zod46.z.string().regex(/^\d+%$/), import_zod46.z.number()]);
|
|
3761
|
+
var CABLayoutWrapping = import_zod46.z.object({
|
|
3762
|
+
breakAt: import_zod46.z.number().positive(),
|
|
3763
|
+
maxPerLine: import_zod46.z.number().int().positive()
|
|
4017
3764
|
});
|
|
4018
|
-
var CABLayoutSection =
|
|
3765
|
+
var CABLayoutSection = import_zod46.z.object({
|
|
4019
3766
|
...CABVariableFields,
|
|
4020
|
-
alignment:
|
|
4021
|
-
horizontal:
|
|
4022
|
-
vertical:
|
|
3767
|
+
alignment: import_zod46.z.object({
|
|
3768
|
+
horizontal: import_zod46.z.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
3769
|
+
vertical: import_zod46.z.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
4023
3770
|
}).default({
|
|
4024
3771
|
horizontal: HorizontalAlignment.start,
|
|
4025
3772
|
vertical: VerticalAlignment.top
|
|
4026
3773
|
}),
|
|
4027
|
-
border:
|
|
4028
|
-
buttonField:
|
|
4029
|
-
direction:
|
|
3774
|
+
border: import_zod46.z.lazy(() => CABBorder),
|
|
3775
|
+
buttonField: import_zod46.z.enum(buttonFields).optional(),
|
|
3776
|
+
direction: import_zod46.z.enum(directions).default(Direction.rows),
|
|
4030
3777
|
/**
|
|
4031
3778
|
* Platform chrome around the section, not a layout behavior: `callout` is a subdued box with block borders
|
|
4032
3779
|
* (the legacy post-purchase callout banner), `offer-content` the post-purchase offer's own content card.
|
|
4033
3780
|
*/
|
|
4034
|
-
frame:
|
|
4035
|
-
grid:
|
|
4036
|
-
columns:
|
|
4037
|
-
rows:
|
|
3781
|
+
frame: import_zod46.z.enum(layoutFrames).optional(),
|
|
3782
|
+
grid: import_zod46.z.object({
|
|
3783
|
+
columns: import_zod46.z.union([import_zod46.z.array(GridItem), import_zod46.z.undefined()]).default(() => ["auto"]),
|
|
3784
|
+
rows: import_zod46.z.union([import_zod46.z.array(GridItem), import_zod46.z.undefined()]).default(() => ["auto"])
|
|
4038
3785
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
4039
|
-
name:
|
|
4040
|
-
padding:
|
|
4041
|
-
sectionId:
|
|
4042
|
-
sections:
|
|
4043
|
-
sectionType:
|
|
4044
|
-
spacing:
|
|
3786
|
+
name: import_zod46.z.string().optional(),
|
|
3787
|
+
padding: import_zod46.z.enum(spacings).default(Spacing.none),
|
|
3788
|
+
sectionId: import_zod46.z.uuid().default(() => (0, import_uuid15.v7)()),
|
|
3789
|
+
sections: import_zod46.z.union([import_zod46.z.array(import_zod46.z.lazy(() => CABSection)), import_zod46.z.strictObject({}).transform(() => [])]).default(() => []),
|
|
3790
|
+
sectionType: import_zod46.z.literal(SectionType.layout).default(SectionType.layout),
|
|
3791
|
+
spacing: import_zod46.z.enum(spacings).default(Spacing.base),
|
|
4045
3792
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
4046
|
-
viewUrl:
|
|
4047
|
-
width:
|
|
3793
|
+
viewUrl: import_zod46.z.string().optional(),
|
|
3794
|
+
width: import_zod46.z.number().default(100),
|
|
4048
3795
|
wrapping: CABLayoutWrapping.optional()
|
|
4049
3796
|
});
|
|
4050
3797
|
|
|
@@ -4066,8 +3813,8 @@ var UI_LABELS = {
|
|
|
4066
3813
|
};
|
|
4067
3814
|
|
|
4068
3815
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
4069
|
-
var localized = (fallback) =>
|
|
4070
|
-
var CABUILabels =
|
|
3816
|
+
var localized = (fallback) => import_zod47.z.record(import_zod47.z.string(), import_zod47.z.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
3817
|
+
var CABUILabels = import_zod47.z.object({
|
|
4071
3818
|
currentPage: localized(UI_LABELS.currentPage),
|
|
4072
3819
|
guest: localized(UI_LABELS.guest),
|
|
4073
3820
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -4092,154 +3839,491 @@ var CABUILabels = import_zod60.z.object({
|
|
|
4092
3839
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
4093
3840
|
updating: { ...UI_LABELS.updating }
|
|
4094
3841
|
}));
|
|
4095
|
-
var TargetArea =
|
|
4096
|
-
fill:
|
|
4097
|
-
flip:
|
|
4098
|
-
icon:
|
|
4099
|
-
label:
|
|
4100
|
-
width:
|
|
3842
|
+
var TargetArea = import_zod47.z.object({
|
|
3843
|
+
fill: import_zod47.z.boolean().optional(),
|
|
3844
|
+
flip: import_zod47.z.enum(["both", "horizontal", "vertical"]).optional(),
|
|
3845
|
+
icon: import_zod47.z.string(),
|
|
3846
|
+
label: import_zod47.z.string(),
|
|
3847
|
+
width: import_zod47.z.string()
|
|
4101
3848
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
4102
|
-
var CABTracking =
|
|
4103
|
-
enableAttribution:
|
|
4104
|
-
enableSource:
|
|
4105
|
-
enableWidget:
|
|
3849
|
+
var CABTracking = import_zod47.z.object({
|
|
3850
|
+
enableAttribution: import_zod47.z.boolean().nullish().transform((value) => value ?? true),
|
|
3851
|
+
enableSource: import_zod47.z.boolean().nullish().transform((value) => value ?? true),
|
|
3852
|
+
enableWidget: import_zod47.z.boolean().nullish().transform((value) => value ?? true)
|
|
4106
3853
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
4107
|
-
var CABExperiment =
|
|
4108
|
-
elementId:
|
|
4109
|
-
experimentId:
|
|
4110
|
-
experimentType:
|
|
4111
|
-
selectedId:
|
|
3854
|
+
var CABExperiment = import_zod47.z.object({
|
|
3855
|
+
elementId: import_zod47.z.number(),
|
|
3856
|
+
experimentId: import_zod47.z.number(),
|
|
3857
|
+
experimentType: import_zod47.z.string(),
|
|
3858
|
+
selectedId: import_zod47.z.number()
|
|
4112
3859
|
});
|
|
4113
3860
|
var CABRootSection = CABLayoutSection.extend({
|
|
4114
|
-
editorMode:
|
|
3861
|
+
editorMode: import_zod47.z.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
4115
3862
|
experiment: CABExperiment.optional(),
|
|
4116
3863
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
4117
3864
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
4118
|
-
previewMode:
|
|
4119
|
-
storeId:
|
|
3865
|
+
previewMode: import_zod47.z.boolean().nullish().transform((value) => value ?? false),
|
|
3866
|
+
storeId: import_zod47.z.number().nullable().default(null),
|
|
4120
3867
|
targetArea: TargetArea.nullable(),
|
|
4121
3868
|
tracking: CABTracking,
|
|
4122
|
-
type:
|
|
3869
|
+
type: import_zod47.z.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
4123
3870
|
uiLabels: CABUILabels,
|
|
4124
|
-
version:
|
|
4125
|
-
widgetId:
|
|
3871
|
+
version: import_zod47.z.literal(2).default(2),
|
|
3872
|
+
widgetId: import_zod47.z.number().nullable().default(null)
|
|
3873
|
+
});
|
|
3874
|
+
|
|
3875
|
+
// src/schema/postPurchaseOfferPresentation.ts
|
|
3876
|
+
var language2 = PostPurchaseSettings.shape.language.shape.global.unwrap().unwrap();
|
|
3877
|
+
var PostPurchaseOfferPresentation = import_zod48.z.strictObject({
|
|
3878
|
+
labels: language2.pick({ declineAll: true, declineThisOffer: true }),
|
|
3879
|
+
layout: PostPurchaseSettings.shape.offersLayout,
|
|
3880
|
+
sections: CABRootSection.nullable(),
|
|
3881
|
+
showDeclineAll: PostPurchaseSettings.shape.productOptions.shape.showDeclineAll
|
|
3882
|
+
});
|
|
3883
|
+
|
|
3884
|
+
// src/schema/postPurchaseOrderDecision.ts
|
|
3885
|
+
var import_zod49 = require("zod");
|
|
3886
|
+
var OrderDecisionSchema = import_zod49.z.discriminatedUnion("owner", [
|
|
3887
|
+
import_zod49.z.object({ owner: import_zod49.z.literal("session"), sessionId: import_zod49.z.string().regex(/^[a-f0-9]{64}$/) }),
|
|
3888
|
+
import_zod49.z.object({ owner: import_zod49.z.literal("release"), sessionId: import_zod49.z.null() })
|
|
3889
|
+
]);
|
|
3890
|
+
|
|
3891
|
+
// src/schema/postPurchasePolicy.ts
|
|
3892
|
+
var import_zod50 = require("zod");
|
|
3893
|
+
var HoldSettingSchema = import_zod50.z.discriminatedUnion("enabled", [
|
|
3894
|
+
import_zod50.z.object({ durationMinutes: import_zod50.z.number().int().min(1).max(60), enabled: import_zod50.z.literal(true) }),
|
|
3895
|
+
import_zod50.z.object({ durationMinutes: import_zod50.z.null(), enabled: import_zod50.z.literal(false) })
|
|
3896
|
+
]);
|
|
3897
|
+
var TimingSettingsSchema = import_zod50.z.object({ flowHold: HoldSettingSchema, shopHold: HoldSettingSchema });
|
|
3898
|
+
var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
3899
|
+
durationMinutes: import_zod50.z.number().int().min(1).max(60).nullable(),
|
|
3900
|
+
source: import_zod50.z.enum(["shop", "flow", "native"])
|
|
3901
|
+
}).refine(
|
|
3902
|
+
(policy) => {
|
|
3903
|
+
const expectedSource = policy.shopHold.enabled ? "shop" : policy.flowHold.enabled ? "flow" : "native";
|
|
3904
|
+
const expectedDuration = expectedSource === "shop" ? policy.shopHold.durationMinutes : expectedSource === "flow" ? policy.flowHold.durationMinutes : null;
|
|
3905
|
+
return policy.source === expectedSource && policy.durationMinutes === expectedDuration;
|
|
3906
|
+
},
|
|
3907
|
+
{
|
|
3908
|
+
message: "source and durationMinutes must reflect the shop-over-flow-over-native precedence",
|
|
3909
|
+
path: ["source"]
|
|
3910
|
+
}
|
|
3911
|
+
);
|
|
3912
|
+
|
|
3913
|
+
// src/schema/postPurchaseProductSettings.ts
|
|
3914
|
+
var import_zod51 = require("zod");
|
|
3915
|
+
var amount = import_zod51.z.union([import_zod51.z.number().nonnegative(), PostPurchaseAmount.transform(Number)]);
|
|
3916
|
+
var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
3917
|
+
discountedFrom: true,
|
|
3918
|
+
language: true,
|
|
3919
|
+
productLimit: true,
|
|
3920
|
+
productOptions: true,
|
|
3921
|
+
productType: true,
|
|
3922
|
+
productTypeSelector: true,
|
|
3923
|
+
quantityInputs: true,
|
|
3924
|
+
subscriptionIsDefault: true,
|
|
3925
|
+
upgradeToSubscription: true
|
|
3926
|
+
}).extend({
|
|
3927
|
+
advance: import_zod51.z.unknown().default({}),
|
|
3928
|
+
blocks: import_zod51.z.array(import_zod51.z.unknown()).optional(),
|
|
3929
|
+
discount: PostPurchaseSettings.shape.discount.extend({ amount: amount.default(30) }),
|
|
3930
|
+
integrations: import_zod51.z.unknown().default({}),
|
|
3931
|
+
shipping: PostPurchaseSettings.shape.shipping.extend({ amount: amount.default(10) }),
|
|
3932
|
+
styles: import_zod51.z.unknown().default({}),
|
|
3933
|
+
subImages: PostPurchaseSettings.shape.subImages.catch(null),
|
|
3934
|
+
subscription: import_zod51.z.unknown().default(PostPurchaseSettings.shape.subscription.parse(void 0))
|
|
3935
|
+
});
|
|
3936
|
+
|
|
3937
|
+
// src/schema/postPurchaseQuantity.ts
|
|
3938
|
+
var import_zod52 = require("zod");
|
|
3939
|
+
var quantity = PreparedPostPurchaseProduct.shape.selection.shape.quantity;
|
|
3940
|
+
var PostPurchaseQuantityPolicy = PostPurchaseSettings.shape.quantityInputs.omit({ defaultQuantity: true }).extend({
|
|
3941
|
+
initialQuantity: quantity,
|
|
3942
|
+
maxValue: quantity,
|
|
3943
|
+
minValue: import_zod52.z.literal(0).transform(() => 1).or(quantity)
|
|
3944
|
+
}).refine(({ maxValue, minValue }) => minValue <= maxValue, "Quantity bounds are reversed");
|
|
3945
|
+
|
|
3946
|
+
// src/schema/postPurchaseSelection.ts
|
|
3947
|
+
var import_zod53 = require("zod");
|
|
3948
|
+
var SelectionClaimsSchema = DecideRequestSchema.extend({
|
|
3949
|
+
appId: PostPurchaseAppIdSchema,
|
|
3950
|
+
entry: DecisionEntrySchema,
|
|
3951
|
+
iss: import_zod53.z.literal("rebuy-api"),
|
|
3952
|
+
purpose: import_zod53.z.literal("post-purchase-selection")
|
|
3953
|
+
});
|
|
3954
|
+
var SessionStartRequestSchema = DecideRequestSchema.extend({
|
|
3955
|
+
selectionToken: import_zod53.z.string().min(1).max(8192).optional()
|
|
3956
|
+
}).strict();
|
|
3957
|
+
|
|
3958
|
+
// src/schema/postPurchaseSession.ts
|
|
3959
|
+
var import_zod54 = require("zod");
|
|
3960
|
+
var SessionIdentitySchema = DecideRequestSchema.extend({ appId: PostPurchaseAppIdSchema });
|
|
3961
|
+
var SessionOrderTimingSchema = import_zod54.z.object({
|
|
3962
|
+
nativeDeadline: PostPurchaseTimestampSchema,
|
|
3963
|
+
orderCreatedAt: PostPurchaseTimestampSchema,
|
|
3964
|
+
orderId: PostPurchaseOrderIdSchema,
|
|
3965
|
+
timingSource: import_zod54.z.literal("shopify-order-created-at")
|
|
3966
|
+
});
|
|
3967
|
+
var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
3968
|
+
deadline: PostPurchaseTimestampSchema,
|
|
3969
|
+
entry: DecisionEntrySchema,
|
|
3970
|
+
policySnapshot: SessionPolicySchema,
|
|
3971
|
+
startedAt: PostPurchaseTimestampSchema
|
|
3972
|
+
}).refine((session) => session.orderCreatedAt <= session.startedAt, {
|
|
3973
|
+
message: "startedAt must not precede orderCreatedAt",
|
|
3974
|
+
path: ["startedAt"]
|
|
3975
|
+
}).refine((session) => session.startedAt <= session.deadline, {
|
|
3976
|
+
message: "deadline must not precede startedAt",
|
|
3977
|
+
path: ["deadline"]
|
|
3978
|
+
}).refine((session) => session.deadline <= session.nativeDeadline, {
|
|
3979
|
+
message: "deadline must not exceed nativeDeadline",
|
|
3980
|
+
path: ["deadline"]
|
|
3981
|
+
});
|
|
3982
|
+
var SessionStartResponseSchema = import_zod54.z.object({
|
|
3983
|
+
data: import_zod54.z.object({
|
|
3984
|
+
phase: import_zod54.z.literal("render"),
|
|
3985
|
+
serverNow: PostPurchaseTimestampSchema,
|
|
3986
|
+
session: ReadySessionTimingSchema,
|
|
3987
|
+
workflowPhase: import_zod54.z.literal("start")
|
|
3988
|
+
}),
|
|
3989
|
+
successful: import_zod54.z.literal(true)
|
|
3990
|
+
});
|
|
3991
|
+
|
|
3992
|
+
// src/schema/postPurchaseSessionClose.ts
|
|
3993
|
+
var import_zod55 = require("zod");
|
|
3994
|
+
var SessionClosureSchema = import_zod55.z.object({ closedAt: PostPurchaseTimestampSchema, status: import_zod55.z.literal("closed") });
|
|
3995
|
+
var SessionCloseRequestSchema = DecideRequestSchema.strict();
|
|
3996
|
+
var SessionCloseResponseSchema = import_zod55.z.object({ data: SessionClosureSchema, successful: import_zod55.z.literal(true) });
|
|
3997
|
+
|
|
3998
|
+
// src/schema/postPurchaseShadow.ts
|
|
3999
|
+
var import_zod56 = require("zod");
|
|
4000
|
+
var PostPurchaseShadowSelectionSchema = import_zod56.z.discriminatedUnion("verdict", [
|
|
4001
|
+
import_zod56.z.object({ entry: DecisionEntrySchema, verdict: import_zod56.z.literal("render") }),
|
|
4002
|
+
import_zod56.z.object({ verdict: import_zod56.z.literal("skip") })
|
|
4003
|
+
]);
|
|
4004
|
+
var PostPurchaseShadowReportFields = import_zod56.z.object({
|
|
4005
|
+
differences: import_zod56.z.array(import_zod56.z.enum(["verdict", "entry", "targeting", "incomplete-capture", "unsupported-configuration"])).refine((differences) => new Set(differences).size === differences.length, {
|
|
4006
|
+
message: "differences must not contain duplicate entries"
|
|
4007
|
+
}),
|
|
4008
|
+
legacySelection: PostPurchaseShadowSelectionSchema,
|
|
4009
|
+
phase: import_zod56.z.literal("shouldRender"),
|
|
4010
|
+
sampleId: import_zod56.z.string(),
|
|
4011
|
+
serverSelection: PostPurchaseShadowSelectionSchema.optional(),
|
|
4012
|
+
status: import_zod56.z.enum(["match", "diverged", "incomplete"]),
|
|
4013
|
+
targetingFlowIds: import_zod56.z.array(import_zod56.z.number().int().positive()),
|
|
4014
|
+
workflowPhase: import_zod56.z.literal("decide")
|
|
4015
|
+
});
|
|
4016
|
+
var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
4017
|
+
(report) => report.status !== "match" || report.differences.length === 0,
|
|
4018
|
+
{ message: "status 'match' requires an empty differences array", path: ["status"] }
|
|
4019
|
+
).refine((report) => report.status !== "diverged" || report.differences.length > 0, {
|
|
4020
|
+
message: "status 'diverged' requires a non-empty differences array",
|
|
4021
|
+
path: ["status"]
|
|
4022
|
+
}).refine((report) => report.status !== "diverged" || report.serverSelection !== void 0, {
|
|
4023
|
+
message: "status 'diverged' requires a serverSelection to diverge from",
|
|
4024
|
+
path: ["status"]
|
|
4025
|
+
});
|
|
4026
|
+
|
|
4027
|
+
// src/schema/postPurchaseSkipTrace.ts
|
|
4028
|
+
var import_zod57 = require("zod");
|
|
4029
|
+
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
4030
|
+
var PostPurchaseSkipTraceSchema = import_zod57.z.array(
|
|
4031
|
+
import_zod57.z.object({
|
|
4032
|
+
entry: DecisionEntrySchema,
|
|
4033
|
+
reason: PostPurchaseSkipReasonSchema
|
|
4034
|
+
})
|
|
4035
|
+
).max(POST_PURCHASE_SKIP_LIMIT);
|
|
4036
|
+
|
|
4037
|
+
// src/schema/postPurchaseSubscriptionDisplay.ts
|
|
4038
|
+
var import_zod58 = require("zod");
|
|
4039
|
+
var Minor = import_zod58.z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
4040
|
+
var PostPurchaseSubscriptionDisplay = import_zod58.z.object({
|
|
4041
|
+
comparisonMinor: Minor,
|
|
4042
|
+
currencyCode: import_zod58.z.string().regex(/^[A-Z]{3}$/),
|
|
4043
|
+
priceMinor: Minor,
|
|
4044
|
+
savingMinor: Minor,
|
|
4045
|
+
savingPercent: import_zod58.z.number().int().min(0).max(100)
|
|
4046
|
+
});
|
|
4047
|
+
|
|
4048
|
+
// src/schema/postPurchaseSubscriptionProduct.ts
|
|
4049
|
+
var import_zod59 = require("zod");
|
|
4050
|
+
var PreparedPostPurchaseSubscription = PreparedPostPurchaseProduct.extend({
|
|
4051
|
+
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId: import_zod59.z.number().int().positive() }),
|
|
4052
|
+
terms: PreparedPostPurchaseProduct.shape.terms.extend({
|
|
4053
|
+
subscription: PostPurchaseSubscriptionTerms
|
|
4054
|
+
}).refine(
|
|
4055
|
+
({ discount, shipping, subscription }) => (discount.type !== "none" || discount.amount === 0) && shipping.amount === subscription.initialShippingPrice && shipping.amount === subscription.recurringShippingPrice && (shipping.type !== "free" || shipping.amount === 0)
|
|
4056
|
+
)
|
|
4057
|
+
});
|
|
4058
|
+
var readPostPurchaseSubscription = (prepared) => {
|
|
4059
|
+
if (prepared.selection.sellingPlanId === void 0 && prepared.terms.subscription === void 0) return void 0;
|
|
4060
|
+
return PreparedPostPurchaseSubscription.parse(prepared);
|
|
4061
|
+
};
|
|
4062
|
+
|
|
4063
|
+
// src/schema/postPurchaseVariantDefault.ts
|
|
4064
|
+
var import_zod60 = require("zod");
|
|
4065
|
+
var values = PostPurchaseVariantValues.partial().extend({
|
|
4066
|
+
option1: PostPurchaseVariantValues.shape.option1.nullish()
|
|
4067
|
+
});
|
|
4068
|
+
var variant = values.extend({
|
|
4069
|
+
id: PostPurchaseVariantId,
|
|
4070
|
+
inventoryManagement: import_zod60.z.string().nullable(),
|
|
4071
|
+
inventoryPolicy: import_zod60.z.string(),
|
|
4072
|
+
inventoryQuantity: import_zod60.z.number()
|
|
4073
|
+
});
|
|
4074
|
+
var options = import_zod60.z.array(PostPurchaseVariantOption.pick({ name: true, values: true }));
|
|
4075
|
+
var PostPurchaseVariantDefaultProduct = import_zod60.z.object({
|
|
4076
|
+
id: PostPurchaseProductId,
|
|
4077
|
+
options,
|
|
4078
|
+
selectedVariant: variant.optional(),
|
|
4079
|
+
variants: import_zod60.z.array(variant)
|
|
4080
|
+
});
|
|
4081
|
+
var PostPurchaseVariantDefaultSettings = PostPurchaseSettings.shape.productOptions.pick({
|
|
4082
|
+
hideOutOfStockVariants: true,
|
|
4083
|
+
matchVariant: true
|
|
4084
|
+
});
|
|
4085
|
+
var PostPurchaseOrderAttributes = import_zod60.z.record(import_zod60.z.string(), import_zod60.z.array(import_zod60.z.string())).default({});
|
|
4086
|
+
var PostPurchaseOriginalVariants = import_zod60.z.array(
|
|
4087
|
+
import_zod60.z.object({ productId: PostPurchaseProductId, variantId: PostPurchaseVariantId })
|
|
4088
|
+
);
|
|
4089
|
+
var PostPurchaseAttributeProducts = import_zod60.z.array(
|
|
4090
|
+
import_zod60.z.object({ id: PostPurchaseProductId, options, variants: import_zod60.z.array(values.extend({ id: PostPurchaseVariantId })) })
|
|
4091
|
+
);
|
|
4092
|
+
|
|
4093
|
+
// src/schema/postPurchaseVariantDefaultContext.ts
|
|
4094
|
+
var import_zod61 = require("zod");
|
|
4095
|
+
var PostPurchaseVariantDefaultContext = import_zod61.z.object({
|
|
4096
|
+
enrichedLineItems: import_zod61.z.unknown().optional(),
|
|
4097
|
+
originalVariants: PostPurchaseOriginalVariants
|
|
4098
|
+
});
|
|
4099
|
+
|
|
4100
|
+
// src/schema/shopConfig.ts
|
|
4101
|
+
var import_zod62 = require("zod");
|
|
4102
|
+
var ShopConfig = import_zod62.z.object({
|
|
4103
|
+
activeExperiments: import_zod62.z.array(
|
|
4104
|
+
import_zod62.z.object({
|
|
4105
|
+
data: import_zod62.z.array(
|
|
4106
|
+
import_zod62.z.object({
|
|
4107
|
+
aliasName: import_zod62.z.string(),
|
|
4108
|
+
cssInput: import_zod62.z.string().nullish(),
|
|
4109
|
+
elementId: import_zod62.z.coerce.number(),
|
|
4110
|
+
id: import_zod62.z.coerce.number(),
|
|
4111
|
+
javascriptInput: import_zod62.z.string().nullish(),
|
|
4112
|
+
traffic: import_zod62.z.coerce.number()
|
|
4113
|
+
})
|
|
4114
|
+
),
|
|
4115
|
+
id: import_zod62.z.coerce.number(),
|
|
4116
|
+
name: import_zod62.z.string(),
|
|
4117
|
+
pageTarget: import_zod62.z.string().nullable(),
|
|
4118
|
+
pageTargetUrl: import_zod62.z.string().nullable(),
|
|
4119
|
+
placeholderId: import_zod62.z.coerce.number().nullable(),
|
|
4120
|
+
type: import_zod62.z.string()
|
|
4121
|
+
})
|
|
4122
|
+
),
|
|
4123
|
+
activePackages: import_zod62.z.array(
|
|
4124
|
+
import_zod62.z.object({
|
|
4125
|
+
cancelledAt: import_zod62.z.string().nullable(),
|
|
4126
|
+
id: import_zod62.z.number(),
|
|
4127
|
+
installedAt: import_zod62.z.string().nullable(),
|
|
4128
|
+
isActive: import_zod62.z.boolean(),
|
|
4129
|
+
isBillable: import_zod62.z.boolean(),
|
|
4130
|
+
packageId: import_zod62.z.number(),
|
|
4131
|
+
packageName: import_zod62.z.string(),
|
|
4132
|
+
shortName: import_zod62.z.string(),
|
|
4133
|
+
trialDays: import_zod62.z.number(),
|
|
4134
|
+
uninstalledAt: import_zod62.z.string().nullable()
|
|
4135
|
+
})
|
|
4136
|
+
),
|
|
4137
|
+
apiKey: import_zod62.z.string(),
|
|
4138
|
+
billingVersion: import_zod62.z.string().nullable(),
|
|
4139
|
+
cacheKey: import_zod62.z.coerce.number(),
|
|
4140
|
+
carousel: import_zod62.z.enum(["flickity", "splide"]),
|
|
4141
|
+
currency: import_zod62.z.string(),
|
|
4142
|
+
currencySymbol: import_zod62.z.string(),
|
|
4143
|
+
domain: import_zod62.z.string(),
|
|
4144
|
+
enabledJquery: import_zod62.z.boolean(),
|
|
4145
|
+
enabledPresentmentCurrencies: import_zod62.z.array(import_zod62.z.string()),
|
|
4146
|
+
hasSmartCollectionsEnabled: import_zod62.z.boolean(),
|
|
4147
|
+
hasSmartSearchEnabled: import_zod62.z.boolean(),
|
|
4148
|
+
id: import_zod62.z.coerce.number(),
|
|
4149
|
+
integrations: import_zod62.z.record(
|
|
4150
|
+
import_zod62.z.enum([
|
|
4151
|
+
"attentive",
|
|
4152
|
+
"judgeme",
|
|
4153
|
+
"junip",
|
|
4154
|
+
"klaviyo",
|
|
4155
|
+
"loox",
|
|
4156
|
+
"okendo",
|
|
4157
|
+
"opinew",
|
|
4158
|
+
"recharge",
|
|
4159
|
+
"reviewsio",
|
|
4160
|
+
"stamped",
|
|
4161
|
+
"yotpo"
|
|
4162
|
+
]),
|
|
4163
|
+
import_zod62.z.union([import_zod62.z.boolean(), import_zod62.z.unknown()])
|
|
4164
|
+
),
|
|
4165
|
+
markets: import_zod62.z.object({
|
|
4166
|
+
enabled: import_zod62.z.boolean()
|
|
4167
|
+
}),
|
|
4168
|
+
monetize: import_zod62.z.object({
|
|
4169
|
+
publisherKey: import_zod62.z.string().nullable()
|
|
4170
|
+
}).nullish(),
|
|
4171
|
+
moneyFormat: import_zod62.z.string(),
|
|
4172
|
+
myshopifyDomain: import_zod62.z.string(),
|
|
4173
|
+
primaryLocale: import_zod62.z.string(),
|
|
4174
|
+
productGroupsEnabled: import_zod62.z.enum(["no", "yes"]).transform((value) => value === "yes"),
|
|
4175
|
+
rechargeCustomDomain: import_zod62.z.string().nullable(),
|
|
4176
|
+
sellingPlansEnabled: import_zod62.z.boolean(),
|
|
4177
|
+
shopId: import_zod62.z.number(),
|
|
4178
|
+
shopifySellingPlansEnabled: import_zod62.z.boolean(),
|
|
4179
|
+
shopName: import_zod62.z.string(),
|
|
4180
|
+
storefrontAccessToken: import_zod62.z.string().nullable(),
|
|
4181
|
+
useRebuyIcons: import_zod62.z.boolean()
|
|
4182
|
+
});
|
|
4183
|
+
|
|
4184
|
+
// src/schema/userConfig.ts
|
|
4185
|
+
var import_zod63 = require("zod");
|
|
4186
|
+
var UserConfig = import_zod63.z.object({
|
|
4187
|
+
shop: ShopConfig,
|
|
4188
|
+
/**
|
|
4189
|
+
* `.catch(undefined)` is the safety bar: smart-cart shape drift can NEVER fail `fetchUserConfig`,
|
|
4190
|
+
* which resolves the apiKey for every offers/monetize/analytics/gift request.
|
|
4191
|
+
*/
|
|
4192
|
+
smartCart: SmartCartConfig.nullish().catch(void 0),
|
|
4193
|
+
smartFlows: import_zod63.z.array(import_zod63.z.unknown())
|
|
4194
|
+
});
|
|
4195
|
+
|
|
4196
|
+
// src/schema/widgetData.ts
|
|
4197
|
+
var import_zod72 = require("zod");
|
|
4198
|
+
|
|
4199
|
+
// src/schema/widgets/abTestingPlaceholder.ts
|
|
4200
|
+
var import_zod64 = require("zod");
|
|
4201
|
+
var ABTestingPlaceholder = import_zod64.z.looseObject({
|
|
4202
|
+
type: import_zod64.z.literal("placeholder")
|
|
4203
|
+
});
|
|
4204
|
+
|
|
4205
|
+
// src/schema/widgets/checkoutExtension.ts
|
|
4206
|
+
var import_zod65 = require("zod");
|
|
4207
|
+
var CheckoutExtension = import_zod65.z.looseObject({
|
|
4208
|
+
type: import_zod65.z.literal(WidgetType.shopify_checkout_extension).default(WidgetType.shopify_checkout_extension)
|
|
4126
4209
|
});
|
|
4127
4210
|
|
|
4128
4211
|
// src/schema/widgets/contentBlock.ts
|
|
4129
|
-
var
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4212
|
+
var import_zod66 = require("zod");
|
|
4213
|
+
var ContentBlockV1 = import_zod66.z.object({
|
|
4214
|
+
blockSpacing: import_zod66.z.enum(spacings).optional(),
|
|
4215
|
+
imageBlocks: import_zod66.z.union([
|
|
4216
|
+
import_zod66.z.array(
|
|
4217
|
+
import_zod66.z.object({
|
|
4218
|
+
altText: import_zod66.z.string().nullable(),
|
|
4219
|
+
description: import_zod66.z.string().nullable(),
|
|
4220
|
+
id: import_zod66.z.uuid(),
|
|
4221
|
+
imagePlacement: import_zod66.z.enum(["top", "right", "bottom", "left"]),
|
|
4222
|
+
imageSize: import_zod66.z.number(),
|
|
4223
|
+
imageUrl: import_zod66.z.url(),
|
|
4224
|
+
textAlignment: import_zod66.z.enum(["left", "center", "right"]),
|
|
4141
4225
|
/** Inline scale only: an image caption can never be a block-level heading. */
|
|
4142
|
-
textSize:
|
|
4226
|
+
textSize: import_zod66.z.enum(inlineTextSizeNames)
|
|
4143
4227
|
})
|
|
4144
4228
|
),
|
|
4145
|
-
|
|
4229
|
+
import_zod66.z.strictObject({}).transform(() => [])
|
|
4146
4230
|
]).optional(),
|
|
4147
|
-
imageLayout:
|
|
4148
|
-
language:
|
|
4149
|
-
description:
|
|
4150
|
-
superTitle:
|
|
4151
|
-
title:
|
|
4231
|
+
imageLayout: import_zod66.z.enum(["row", "column"]).optional(),
|
|
4232
|
+
language: import_zod66.z.object({
|
|
4233
|
+
description: import_zod66.z.string(),
|
|
4234
|
+
superTitle: import_zod66.z.string(),
|
|
4235
|
+
title: import_zod66.z.string()
|
|
4152
4236
|
}),
|
|
4153
|
-
previewMode:
|
|
4154
|
-
type:
|
|
4155
|
-
version:
|
|
4237
|
+
previewMode: import_zod66.z.boolean(),
|
|
4238
|
+
type: import_zod66.z.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block),
|
|
4239
|
+
version: import_zod66.z.literal(1)
|
|
4156
4240
|
});
|
|
4157
|
-
var ContentBlock =
|
|
4241
|
+
var ContentBlock = import_zod66.z.discriminatedUnion("version", [
|
|
4158
4242
|
ContentBlockV1,
|
|
4159
4243
|
CABRootSection.extend({
|
|
4160
|
-
type:
|
|
4244
|
+
type: import_zod66.z.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block)
|
|
4161
4245
|
})
|
|
4162
4246
|
]);
|
|
4163
4247
|
|
|
4164
4248
|
// src/schema/widgets/giftWithPurchase.ts
|
|
4165
|
-
var
|
|
4166
|
-
var GiftWithPurchase =
|
|
4167
|
-
type:
|
|
4249
|
+
var import_zod67 = require("zod");
|
|
4250
|
+
var GiftWithPurchase = import_zod67.z.looseObject({
|
|
4251
|
+
type: import_zod67.z.literal(WidgetType.gift_with_purchase).default(WidgetType.gift_with_purchase)
|
|
4168
4252
|
});
|
|
4169
4253
|
|
|
4170
4254
|
// src/schema/widgets/lineItemEditor.ts
|
|
4171
|
-
var
|
|
4172
|
-
var LineItemEditorSwitchLanguageV1 =
|
|
4173
|
-
downgradeToOneTimeLabel:
|
|
4255
|
+
var import_zod68 = require("zod");
|
|
4256
|
+
var LineItemEditorSwitchLanguageV1 = import_zod68.z.object({
|
|
4257
|
+
downgradeToOneTimeLabel: import_zod68.z.string().optional(),
|
|
4174
4258
|
/** Frequency-option template (`{{frequency}}`/`{{interval}}`) for the plan select. */
|
|
4175
|
-
subscriptionOptionLabel:
|
|
4176
|
-
upgradeToSubscriptionLabel:
|
|
4177
|
-
upgradeToSubscriptionWithoutDiscountLabel:
|
|
4259
|
+
subscriptionOptionLabel: import_zod68.z.string().optional(),
|
|
4260
|
+
upgradeToSubscriptionLabel: import_zod68.z.string().optional(),
|
|
4261
|
+
upgradeToSubscriptionWithoutDiscountLabel: import_zod68.z.string().optional()
|
|
4178
4262
|
});
|
|
4179
|
-
var LineItemEditorV1 =
|
|
4263
|
+
var LineItemEditorV1 = import_zod68.z.object({
|
|
4180
4264
|
/** Legacy `getStyles` button style; the converter carries a valid kind, defaulting to `plain`. */
|
|
4181
|
-
button:
|
|
4182
|
-
previewMode:
|
|
4183
|
-
switchToSubscription:
|
|
4184
|
-
disableDowngrade:
|
|
4265
|
+
button: import_zod68.z.object({ kind: import_zod68.z.enum(["plain", "primary", "secondary"]).optional() }).optional(),
|
|
4266
|
+
previewMode: import_zod68.z.boolean().optional(),
|
|
4267
|
+
switchToSubscription: import_zod68.z.object({
|
|
4268
|
+
disableDowngrade: import_zod68.z.boolean().optional(),
|
|
4185
4269
|
language: LineItemEditorSwitchLanguageV1.optional()
|
|
4186
4270
|
}).optional(),
|
|
4187
|
-
switchToSubscriptionEnabled:
|
|
4188
|
-
tracking:
|
|
4189
|
-
enableAttribution:
|
|
4190
|
-
enableSource:
|
|
4191
|
-
enableWidget:
|
|
4271
|
+
switchToSubscriptionEnabled: import_zod68.z.boolean().optional(),
|
|
4272
|
+
tracking: import_zod68.z.object({
|
|
4273
|
+
enableAttribution: import_zod68.z.boolean().optional(),
|
|
4274
|
+
enableSource: import_zod68.z.boolean().optional(),
|
|
4275
|
+
enableWidget: import_zod68.z.boolean().optional()
|
|
4192
4276
|
}).optional(),
|
|
4193
|
-
type:
|
|
4194
|
-
version:
|
|
4277
|
+
type: import_zod68.z.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor),
|
|
4278
|
+
version: import_zod68.z.literal(1)
|
|
4195
4279
|
});
|
|
4196
|
-
var LineItemEditor =
|
|
4280
|
+
var LineItemEditor = import_zod68.z.discriminatedUnion("version", [
|
|
4197
4281
|
LineItemEditorV1,
|
|
4198
4282
|
CABRootSection.extend({
|
|
4199
|
-
type:
|
|
4283
|
+
type: import_zod68.z.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor)
|
|
4200
4284
|
})
|
|
4201
4285
|
]);
|
|
4202
4286
|
|
|
4203
4287
|
// src/schema/widgets/progressBar.ts
|
|
4204
|
-
var
|
|
4205
|
-
var ProgressBar =
|
|
4206
|
-
type:
|
|
4288
|
+
var import_zod69 = require("zod");
|
|
4289
|
+
var ProgressBar = import_zod69.z.looseObject({
|
|
4290
|
+
type: import_zod69.z.literal(WidgetType.ui_extension_progress_bar).default(WidgetType.ui_extension_progress_bar)
|
|
4207
4291
|
});
|
|
4208
4292
|
|
|
4209
4293
|
// src/schema/widgets/rebuyButton.ts
|
|
4210
|
-
var
|
|
4211
|
-
var RebuyButtonV1 =
|
|
4212
|
-
type:
|
|
4213
|
-
version:
|
|
4294
|
+
var import_zod70 = require("zod");
|
|
4295
|
+
var RebuyButtonV1 = import_zod70.z.looseObject({
|
|
4296
|
+
type: import_zod70.z.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button),
|
|
4297
|
+
version: import_zod70.z.literal(1)
|
|
4214
4298
|
});
|
|
4215
|
-
var RebuyButton =
|
|
4299
|
+
var RebuyButton = import_zod70.z.discriminatedUnion("version", [
|
|
4216
4300
|
RebuyButtonV1,
|
|
4217
4301
|
CABRootSection.extend({
|
|
4218
|
-
type:
|
|
4302
|
+
type: import_zod70.z.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button)
|
|
4219
4303
|
})
|
|
4220
4304
|
]);
|
|
4221
4305
|
|
|
4222
4306
|
// src/schema/widgets/rebuyMonetize.ts
|
|
4223
|
-
var
|
|
4224
|
-
var RebuyMonetize =
|
|
4225
|
-
type:
|
|
4307
|
+
var import_zod71 = require("zod");
|
|
4308
|
+
var RebuyMonetize = import_zod71.z.looseObject({
|
|
4309
|
+
type: import_zod71.z.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad)
|
|
4226
4310
|
});
|
|
4227
|
-
var RebuyMonetizeV1 =
|
|
4228
|
-
name:
|
|
4229
|
-
previewMode:
|
|
4311
|
+
var RebuyMonetizeV1 = import_zod71.z.object({
|
|
4312
|
+
name: import_zod71.z.string().nullable().optional(),
|
|
4313
|
+
previewMode: import_zod71.z.boolean().optional(),
|
|
4230
4314
|
/** Privacy Policy footer href → the marker section's `privacyPolicyUrl`. */
|
|
4231
|
-
privacyPolicyUrl:
|
|
4315
|
+
privacyPolicyUrl: import_zod71.z.string().nullable().optional(),
|
|
4232
4316
|
/** Ads-taxonomy sub-vertical id — one of the admin Monetize editor's two configurables. */
|
|
4233
|
-
subVertical:
|
|
4234
|
-
tracking:
|
|
4235
|
-
enableAttribution:
|
|
4236
|
-
enableSource:
|
|
4237
|
-
enableWidget:
|
|
4317
|
+
subVertical: import_zod71.z.string().nullable().optional(),
|
|
4318
|
+
tracking: import_zod71.z.object({
|
|
4319
|
+
enableAttribution: import_zod71.z.boolean().optional(),
|
|
4320
|
+
enableSource: import_zod71.z.boolean().optional(),
|
|
4321
|
+
enableWidget: import_zod71.z.boolean().optional()
|
|
4238
4322
|
}).optional(),
|
|
4239
|
-
type:
|
|
4240
|
-
version:
|
|
4323
|
+
type: import_zod71.z.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad),
|
|
4324
|
+
version: import_zod71.z.literal(1),
|
|
4241
4325
|
/** Ads-taxonomy vertical id — one of the admin Monetize editor's two configurables. */
|
|
4242
|
-
vertical:
|
|
4326
|
+
vertical: import_zod71.z.string().nullable().optional()
|
|
4243
4327
|
});
|
|
4244
4328
|
|
|
4245
4329
|
// src/schema/widgetData.ts
|
|
@@ -4253,7 +4337,7 @@ var extensionWidgetTypes = [
|
|
|
4253
4337
|
WidgetType.ui_extension_line_item_editor,
|
|
4254
4338
|
WidgetType.ui_extension_progress_bar
|
|
4255
4339
|
];
|
|
4256
|
-
var WidgetData =
|
|
4340
|
+
var WidgetData = import_zod72.z.discriminatedUnion("type", [
|
|
4257
4341
|
ABTestingPlaceholder,
|
|
4258
4342
|
CheckoutExtension,
|
|
4259
4343
|
ContentBlock,
|
|
@@ -4613,36 +4697,36 @@ var SWITCH_LABELS = {
|
|
|
4613
4697
|
};
|
|
4614
4698
|
|
|
4615
4699
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
4616
|
-
var
|
|
4700
|
+
var import_zod74 = require("zod");
|
|
4617
4701
|
|
|
4618
4702
|
// src/schema/widgets/post-purchase-offer/postPurchaseWidget.ts
|
|
4619
|
-
var
|
|
4620
|
-
var PostPurchaseWidgetLinkedFlow =
|
|
4621
|
-
id:
|
|
4622
|
-
name:
|
|
4623
|
-
});
|
|
4624
|
-
var PostPurchaseWidget =
|
|
4625
|
-
classification:
|
|
4626
|
-
createdAtTime:
|
|
4627
|
-
customEndpointName:
|
|
4628
|
-
id:
|
|
4629
|
-
lastViewed:
|
|
4630
|
-
linkedCustomEndpointId:
|
|
4631
|
-
linkedFlows:
|
|
4632
|
-
name:
|
|
4633
|
-
owner:
|
|
4703
|
+
var import_zod73 = require("zod");
|
|
4704
|
+
var PostPurchaseWidgetLinkedFlow = import_zod73.z.object({
|
|
4705
|
+
id: import_zod73.z.number(),
|
|
4706
|
+
name: import_zod73.z.string()
|
|
4707
|
+
});
|
|
4708
|
+
var PostPurchaseWidget = import_zod73.z.object({
|
|
4709
|
+
classification: import_zod73.z.literal("post_purchase_offer_page").default("post_purchase_offer_page"),
|
|
4710
|
+
createdAtTime: import_zod73.z.iso.datetime({ offset: true }).optional(),
|
|
4711
|
+
customEndpointName: import_zod73.z.string().nullish(),
|
|
4712
|
+
id: import_zod73.z.number().default(0),
|
|
4713
|
+
lastViewed: import_zod73.z.iso.datetime({ offset: true }).nullish(),
|
|
4714
|
+
linkedCustomEndpointId: import_zod73.z.number().nullish(),
|
|
4715
|
+
linkedFlows: import_zod73.z.array(PostPurchaseWidgetLinkedFlow).optional(),
|
|
4716
|
+
name: import_zod73.z.string().default(""),
|
|
4717
|
+
owner: import_zod73.z.number().nullish(),
|
|
4634
4718
|
settings: PostPurchaseSettings
|
|
4635
4719
|
});
|
|
4636
4720
|
|
|
4637
4721
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
4638
|
-
var PostPurchaseOffer =
|
|
4639
|
-
|
|
4640
|
-
errors:
|
|
4641
|
-
message:
|
|
4642
|
-
successful:
|
|
4722
|
+
var PostPurchaseOffer = import_zod74.z.discriminatedUnion("successful", [
|
|
4723
|
+
import_zod74.z.strictObject({
|
|
4724
|
+
errors: import_zod74.z.array(import_zod74.z.object({ message: import_zod74.z.string() })),
|
|
4725
|
+
message: import_zod74.z.string(),
|
|
4726
|
+
successful: import_zod74.z.literal(false)
|
|
4643
4727
|
}),
|
|
4644
|
-
|
|
4645
|
-
successful:
|
|
4728
|
+
import_zod74.z.strictObject({
|
|
4729
|
+
successful: import_zod74.z.literal(true),
|
|
4646
4730
|
widget: PostPurchaseWidget
|
|
4647
4731
|
})
|
|
4648
4732
|
]);
|
|
@@ -5335,23 +5419,23 @@ var QUANTITY_INPUT_TYPE = {
|
|
|
5335
5419
|
"buttons-manual-input": "number",
|
|
5336
5420
|
"dropdown-select": "select"
|
|
5337
5421
|
};
|
|
5338
|
-
var buildQuantityErrors = (
|
|
5422
|
+
var buildQuantityErrors = (quantity2) => {
|
|
5339
5423
|
const en = {
|
|
5340
|
-
...
|
|
5341
|
-
...
|
|
5342
|
-
...
|
|
5424
|
+
...quantity2.maxError && { max: normalizeTokens(quantity2.maxError, QUANTITY_ERROR_TOKENS) },
|
|
5425
|
+
...quantity2.minError && { min: normalizeTokens(quantity2.minError, QUANTITY_ERROR_TOKENS) },
|
|
5426
|
+
...quantity2.negativeError && { neg: normalizeTokens(quantity2.negativeError, QUANTITY_ERROR_TOKENS) }
|
|
5343
5427
|
};
|
|
5344
5428
|
return Object.keys(en).length ? { errorMessages: { en } } : {};
|
|
5345
5429
|
};
|
|
5346
5430
|
var buildQuantity = (settings) => {
|
|
5347
|
-
const
|
|
5348
|
-
if (!
|
|
5349
|
-
const inputType =
|
|
5350
|
-
const max = Math.min(Math.max(
|
|
5351
|
-
const min = Math.min(Math.max(
|
|
5431
|
+
const quantity2 = settings.quantityInputs;
|
|
5432
|
+
if (!quantity2?.enabled) return [];
|
|
5433
|
+
const inputType = quantity2.type ? QUANTITY_INPUT_TYPE[quantity2.type] : void 0;
|
|
5434
|
+
const max = Math.min(Math.max(quantity2.maxValue ?? 10, 1), 100);
|
|
5435
|
+
const min = Math.min(Math.max(quantity2.minValue ?? 1, 1), max);
|
|
5352
5436
|
return [
|
|
5353
5437
|
{
|
|
5354
|
-
...buildQuantityErrors(
|
|
5438
|
+
...buildQuantityErrors(quantity2),
|
|
5355
5439
|
...inputType && { inputType },
|
|
5356
5440
|
max,
|
|
5357
5441
|
min,
|
|
@@ -5361,7 +5445,7 @@ var buildQuantity = (settings) => {
|
|
|
5361
5445
|
};
|
|
5362
5446
|
var buildSubscriptionButton = (settings) => {
|
|
5363
5447
|
if (settings.productType !== "both" && settings.productType !== "subscription") return [];
|
|
5364
|
-
const
|
|
5448
|
+
const language3 = settings.language;
|
|
5365
5449
|
const slot = (buttonField, override) => ({
|
|
5366
5450
|
buttonField,
|
|
5367
5451
|
content: localizedContent(SWITCH_LABELS[buttonField], override, SWITCH_LABEL_TOKENS),
|
|
@@ -5375,9 +5459,9 @@ var buildSubscriptionButton = (settings) => {
|
|
|
5375
5459
|
...settings.productType === "subscription" && { disableDowngrade: true },
|
|
5376
5460
|
sections: [
|
|
5377
5461
|
slot("subscriptionOption", void 0),
|
|
5378
|
-
slot("switchToOneTimePurchase",
|
|
5379
|
-
slot("switchToSubscriptionNoDiscount",
|
|
5380
|
-
slot("switchToSubscriptionWithDiscount",
|
|
5462
|
+
slot("switchToOneTimePurchase", language3?.cartSwitchToOnetime),
|
|
5463
|
+
slot("switchToSubscriptionNoDiscount", language3?.upgradeToSubscription),
|
|
5464
|
+
slot("switchToSubscriptionWithDiscount", language3?.upgradeToSubscription)
|
|
5381
5465
|
],
|
|
5382
5466
|
sectionType: "button"
|
|
5383
5467
|
}
|
|
@@ -5432,11 +5516,11 @@ var buildOfferCard = (settings, horizontal) => {
|
|
|
5432
5516
|
const description = buildDescription(settings);
|
|
5433
5517
|
const reviews = buildReviews(settings);
|
|
5434
5518
|
const variants = buildVariants(settings);
|
|
5435
|
-
const
|
|
5519
|
+
const quantity2 = buildQuantity(settings);
|
|
5436
5520
|
const subscription = buildSubscriptionButton(settings);
|
|
5437
5521
|
const reveal = buildRevealButton(settings);
|
|
5438
5522
|
const addButton = buildAddButton(settings);
|
|
5439
|
-
const controls = [...description, ...
|
|
5523
|
+
const controls = [...description, ...quantity2, ...variants, ...subscription];
|
|
5440
5524
|
const info = detailBlock([title, ...variantTitle, ...reviews, price], horizontal, variantTitle.length > 0);
|
|
5441
5525
|
const card = (sections) => [
|
|
5442
5526
|
{
|
|
@@ -5490,9 +5574,9 @@ var buildCarouselNav = () => ({
|
|
|
5490
5574
|
sectionType: "layout"
|
|
5491
5575
|
});
|
|
5492
5576
|
var HEADER_FIELDS = ["superTitle", "title", "description"];
|
|
5493
|
-
var sanitizedHeader = (
|
|
5577
|
+
var sanitizedHeader = (language3) => Object.fromEntries(
|
|
5494
5578
|
HEADER_FIELDS.flatMap((field) => {
|
|
5495
|
-
const value =
|
|
5579
|
+
const value = language3?.[field];
|
|
5496
5580
|
const sanitized = value ? stripContentBlockHtml(normalizeTokens(value)) : "";
|
|
5497
5581
|
return sanitized ? [[field, sanitized]] : [];
|
|
5498
5582
|
})
|
|
@@ -5589,7 +5673,7 @@ var coerceIntegrations = (integrations) => Object.fromEntries(
|
|
|
5589
5673
|
return [key, value];
|
|
5590
5674
|
})
|
|
5591
5675
|
);
|
|
5592
|
-
var buildBanner = (
|
|
5676
|
+
var buildBanner = (language3) => language3?.successBannerEnabled ? [
|
|
5593
5677
|
{
|
|
5594
5678
|
/**
|
|
5595
5679
|
* The banner-level tag is the extraction/routing key on BOTH renderers (React CAB's
|
|
@@ -5602,7 +5686,7 @@ var buildBanner = (language2) => language2?.successBannerEnabled ? [
|
|
|
5602
5686
|
dismissible: true,
|
|
5603
5687
|
sections: [
|
|
5604
5688
|
{
|
|
5605
|
-
content: bannerMessageContent(
|
|
5689
|
+
content: bannerMessageContent(language3.successBannerMessageRte),
|
|
5606
5690
|
sectionType: "text"
|
|
5607
5691
|
},
|
|
5608
5692
|
{
|