@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.mjs
CHANGED
|
@@ -650,8 +650,8 @@ var makeCall2 = async (config2, endpoint, params, format, options2 = {}) => {
|
|
|
650
650
|
if (config2.identity && config2.identity.visitorId()) {
|
|
651
651
|
query.uuid = config2.identity.visitorId();
|
|
652
652
|
}
|
|
653
|
-
const
|
|
654
|
-
const response = await config2.api[
|
|
653
|
+
const source2 = options2.cdn ? "callCdn" : options2.shield ? "callShield" : options2.static ? "callStatic" : "callApi";
|
|
654
|
+
const response = await config2.api[source2]("GET", endpoint, query, options2);
|
|
655
655
|
if (response.data && format === "storefront") {
|
|
656
656
|
for (let i = 0; i < response.data.length; i++) {
|
|
657
657
|
response.data[i] = convertProductToStorefrontFormat(response.data[i]);
|
|
@@ -2190,82 +2190,35 @@ var ExitPolicySchema = z18.discriminatedUnion("status", [
|
|
|
2190
2190
|
})
|
|
2191
2191
|
]);
|
|
2192
2192
|
|
|
2193
|
-
// src/schema/
|
|
2194
|
-
import { z as
|
|
2195
|
-
var POST_PURCHASE_ID_MAX = 128;
|
|
2196
|
-
var PostPurchaseTimestampSchema = z19.number().int().nonnegative();
|
|
2197
|
-
var PostPurchaseOrderIdSchema = z19.string().regex(/^gid:\/\/shopify\/Order\/[1-9]\d*$/);
|
|
2198
|
-
var ShopifyDomainSchema = z19.string().max(POST_PURCHASE_ID_MAX).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?\.myshopify\.com$/);
|
|
2199
|
-
var DecideRequestSchema = z19.object({
|
|
2200
|
-
checkoutToken: z19.string().min(1).max(POST_PURCHASE_ID_MAX),
|
|
2201
|
-
shop: ShopifyDomainSchema
|
|
2202
|
-
});
|
|
2203
|
-
var PostPurchaseAppIdSchema = z19.string().min(1).max(POST_PURCHASE_ID_MAX);
|
|
2204
|
-
var DecisionEntrySchema = z19.object({
|
|
2205
|
-
blockId: z19.number().int().positive(),
|
|
2206
|
-
blockIndex: z19.string(),
|
|
2207
|
-
blockParentIndex: z19.string(),
|
|
2208
|
-
flowId: z19.number().int().positive(),
|
|
2209
|
-
sectionId: z19.number().int().positive(),
|
|
2210
|
-
widgetId: z19.number().int().positive(),
|
|
2211
|
-
widgetTraffic: z19.number().min(0).max(100)
|
|
2212
|
-
});
|
|
2213
|
-
|
|
2214
|
-
// src/schema/postPurchaseOrderDecision.ts
|
|
2215
|
-
import { z as z20 } from "zod";
|
|
2216
|
-
var OrderDecisionSchema = z20.discriminatedUnion("owner", [
|
|
2217
|
-
z20.object({ owner: z20.literal("session"), sessionId: z20.string().regex(/^[a-f0-9]{64}$/) }),
|
|
2218
|
-
z20.object({ owner: z20.literal("release"), sessionId: z20.null() })
|
|
2219
|
-
]);
|
|
2220
|
-
|
|
2221
|
-
// src/schema/postPurchasePolicy.ts
|
|
2222
|
-
import { z as z21 } from "zod";
|
|
2223
|
-
var HoldSettingSchema = z21.discriminatedUnion("enabled", [
|
|
2224
|
-
z21.object({ durationMinutes: z21.number().int().min(1).max(60), enabled: z21.literal(true) }),
|
|
2225
|
-
z21.object({ durationMinutes: z21.null(), enabled: z21.literal(false) })
|
|
2226
|
-
]);
|
|
2227
|
-
var TimingSettingsSchema = z21.object({ flowHold: HoldSettingSchema, shopHold: HoldSettingSchema });
|
|
2228
|
-
var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
2229
|
-
durationMinutes: z21.number().int().min(1).max(60).nullable(),
|
|
2230
|
-
source: z21.enum(["shop", "flow", "native"])
|
|
2231
|
-
}).refine(
|
|
2232
|
-
(policy) => {
|
|
2233
|
-
const expectedSource = policy.shopHold.enabled ? "shop" : policy.flowHold.enabled ? "flow" : "native";
|
|
2234
|
-
const expectedDuration = expectedSource === "shop" ? policy.shopHold.durationMinutes : expectedSource === "flow" ? policy.flowHold.durationMinutes : null;
|
|
2235
|
-
return policy.source === expectedSource && policy.durationMinutes === expectedDuration;
|
|
2236
|
-
},
|
|
2237
|
-
{
|
|
2238
|
-
message: "source and durationMinutes must reflect the shop-over-flow-over-native precedence",
|
|
2239
|
-
path: ["source"]
|
|
2240
|
-
}
|
|
2241
|
-
);
|
|
2193
|
+
// src/schema/postPurchaseGroupCatalog.ts
|
|
2194
|
+
import { z as z25 } from "zod";
|
|
2242
2195
|
|
|
2243
2196
|
// src/schema/postPurchaseProduct.ts
|
|
2244
|
-
import { z as
|
|
2197
|
+
import { z as z23 } from "zod";
|
|
2245
2198
|
|
|
2246
2199
|
// src/schema/postPurchaseProductDisplay.ts
|
|
2247
|
-
import { z as
|
|
2200
|
+
import { z as z20 } from "zod";
|
|
2248
2201
|
|
|
2249
2202
|
// src/schema/postPurchaseProductGallery.ts
|
|
2250
|
-
import { z as
|
|
2251
|
-
var PostPurchaseProductGallery =
|
|
2252
|
-
images:
|
|
2253
|
-
|
|
2254
|
-
description:
|
|
2255
|
-
id:
|
|
2256
|
-
source:
|
|
2257
|
-
thumbnail:
|
|
2203
|
+
import { z as z19 } from "zod";
|
|
2204
|
+
var PostPurchaseProductGallery = z19.object({
|
|
2205
|
+
images: z19.array(
|
|
2206
|
+
z19.object({
|
|
2207
|
+
description: z19.string(),
|
|
2208
|
+
id: z19.number().int().positive(),
|
|
2209
|
+
source: z19.string(),
|
|
2210
|
+
thumbnail: z19.string()
|
|
2258
2211
|
})
|
|
2259
2212
|
),
|
|
2260
|
-
selectedImageId:
|
|
2213
|
+
selectedImageId: z19.number().int().positive().optional()
|
|
2261
2214
|
});
|
|
2262
2215
|
|
|
2263
2216
|
// src/schema/postPurchaseProductDisplay.ts
|
|
2264
2217
|
var language = PostPurchaseSettings.shape.language;
|
|
2265
|
-
var PostPurchasePrimaryImageSource =
|
|
2218
|
+
var PostPurchasePrimaryImageSource = z20.string().default(
|
|
2266
2219
|
"https://cdn.shopify.com/shopifycloud/shopify/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c.gif"
|
|
2267
2220
|
);
|
|
2268
|
-
var PostPurchaseProductDisplay =
|
|
2221
|
+
var PostPurchaseProductDisplay = z20.object({
|
|
2269
2222
|
discountedFrom: PostPurchaseSettings.shape.discountedFrom,
|
|
2270
2223
|
gallery: PostPurchaseProductGallery.optional(),
|
|
2271
2224
|
language: language.pick({
|
|
@@ -2274,7 +2227,7 @@ var PostPurchaseProductDisplay = z23.object({
|
|
|
2274
2227
|
descriptionRte: true,
|
|
2275
2228
|
descriptionSpacing: true
|
|
2276
2229
|
}),
|
|
2277
|
-
primaryImage:
|
|
2230
|
+
primaryImage: z20.object({ description: z20.string(), source: z20.string() }),
|
|
2278
2231
|
productOptions: PostPurchaseSettings.shape.productOptions.pick({
|
|
2279
2232
|
showDeclineAll: true,
|
|
2280
2233
|
showShipping: true,
|
|
@@ -2288,10 +2241,10 @@ var PostPurchaseProductDisplay = z23.object({
|
|
|
2288
2241
|
});
|
|
2289
2242
|
|
|
2290
2243
|
// src/schema/postPurchaseProductSource.ts
|
|
2291
|
-
import { z as
|
|
2292
|
-
var PostPurchaseAmount =
|
|
2293
|
-
var PostPurchaseProductId =
|
|
2294
|
-
var PostPurchaseVariantId =
|
|
2244
|
+
import { z as z21 } from "zod";
|
|
2245
|
+
var PostPurchaseAmount = z21.string().regex(/^\d+(?:\.\d+)?$/).refine((value) => Number.isFinite(Number(value)));
|
|
2246
|
+
var PostPurchaseProductId = z21.number().int().positive();
|
|
2247
|
+
var PostPurchaseVariantId = z21.number().int().positive();
|
|
2295
2248
|
var ProductBase = OfferProduct.pick({ description: true, id: true, image: true, title: true }).extend({
|
|
2296
2249
|
description: OfferProduct.shape.description.nullable(),
|
|
2297
2250
|
id: PostPurchaseProductId
|
|
@@ -2299,56 +2252,56 @@ var ProductBase = OfferProduct.pick({ description: true, id: true, image: true,
|
|
|
2299
2252
|
var SourceVariant = OfferProduct.shape.variants.element.pick({ id: true, title: true }).extend({
|
|
2300
2253
|
compareAtPrice: PostPurchaseAmount.nullable(),
|
|
2301
2254
|
id: PostPurchaseVariantId,
|
|
2302
|
-
imageId:
|
|
2303
|
-
inventoryManagement:
|
|
2304
|
-
inventoryPolicy:
|
|
2305
|
-
inventoryQuantity:
|
|
2306
|
-
option1:
|
|
2307
|
-
option2:
|
|
2308
|
-
option3:
|
|
2255
|
+
imageId: z21.number().int().nonnegative().nullish(),
|
|
2256
|
+
inventoryManagement: z21.string().nullable(),
|
|
2257
|
+
inventoryPolicy: z21.string(),
|
|
2258
|
+
inventoryQuantity: z21.number(),
|
|
2259
|
+
option1: z21.unknown().optional(),
|
|
2260
|
+
option2: z21.unknown().optional(),
|
|
2261
|
+
option3: z21.unknown().optional(),
|
|
2309
2262
|
price: PostPurchaseAmount,
|
|
2310
2263
|
productId: PostPurchaseProductId,
|
|
2311
|
-
sellingPlanAllocations:
|
|
2264
|
+
sellingPlanAllocations: z21.unknown().optional()
|
|
2312
2265
|
});
|
|
2313
2266
|
var Product2 = ProductBase.extend({
|
|
2314
|
-
images:
|
|
2315
|
-
|
|
2267
|
+
images: z21.array(
|
|
2268
|
+
z21.object({ alt: z21.string().optional().catch(void 0), id: z21.number().int().positive(), src: z21.string() })
|
|
2316
2269
|
).nullish(),
|
|
2317
|
-
metadata:
|
|
2318
|
-
productQuantity:
|
|
2319
|
-
|
|
2320
|
-
|
|
2270
|
+
metadata: z21.object({
|
|
2271
|
+
productQuantity: z21.union([
|
|
2272
|
+
z21.number().int().positive(),
|
|
2273
|
+
z21.string().regex(/^[1-9]\d*$/).transform(Number)
|
|
2321
2274
|
]).optional()
|
|
2322
2275
|
}).optional(),
|
|
2323
|
-
metafields:
|
|
2324
|
-
options:
|
|
2325
|
-
productGroupVariants:
|
|
2326
|
-
selectedVariant:
|
|
2327
|
-
sellingPlanGroups:
|
|
2276
|
+
metafields: z21.unknown().optional(),
|
|
2277
|
+
options: z21.unknown().optional(),
|
|
2278
|
+
productGroupVariants: z21.array(z21.unknown()).default([]),
|
|
2279
|
+
selectedVariant: z21.unknown().optional(),
|
|
2280
|
+
sellingPlanGroups: z21.array(
|
|
2328
2281
|
OfferProduct.shape.sellingPlanGroups.unwrap().element.extend({
|
|
2329
|
-
discountAmount:
|
|
2330
|
-
discountType:
|
|
2331
|
-
id:
|
|
2332
|
-
requiresSellingPlan:
|
|
2333
|
-
sellingPlans:
|
|
2282
|
+
discountAmount: z21.unknown().optional(),
|
|
2283
|
+
discountType: z21.unknown().optional(),
|
|
2284
|
+
id: z21.unknown().optional(),
|
|
2285
|
+
requiresSellingPlan: z21.boolean().default(false),
|
|
2286
|
+
sellingPlans: z21.unknown().optional()
|
|
2334
2287
|
})
|
|
2335
2288
|
).default([]),
|
|
2336
|
-
variants:
|
|
2289
|
+
variants: z21.array(SourceVariant)
|
|
2337
2290
|
});
|
|
2338
|
-
var PostPurchaseProductSource =
|
|
2339
|
-
data:
|
|
2340
|
-
metadata:
|
|
2291
|
+
var PostPurchaseProductSource = z21.object({
|
|
2292
|
+
data: z21.array(Product2),
|
|
2293
|
+
metadata: z21.object({ widget: z21.record(z21.string(), z21.unknown()).default({}) }).default({ widget: {} })
|
|
2341
2294
|
});
|
|
2342
2295
|
|
|
2343
2296
|
// src/schema/postPurchaseSubscription.ts
|
|
2344
|
-
import { z as
|
|
2345
|
-
var PostPurchaseSubscriptionTerms =
|
|
2297
|
+
import { z as z22 } from "zod";
|
|
2298
|
+
var PostPurchaseSubscriptionTerms = z22.object({
|
|
2346
2299
|
adjustment: PostPurchasePlanAdjustment.optional(),
|
|
2347
|
-
initialShippingPrice:
|
|
2348
|
-
intervalLabel:
|
|
2349
|
-
name:
|
|
2350
|
-
recurringShippingPrice:
|
|
2351
|
-
shippingOption:
|
|
2300
|
+
initialShippingPrice: z22.number().nonnegative(),
|
|
2301
|
+
intervalLabel: z22.string().min(1),
|
|
2302
|
+
name: z22.string().min(1),
|
|
2303
|
+
recurringShippingPrice: z22.number().nonnegative(),
|
|
2304
|
+
shippingOption: z22.object({ presentmentTitle: z22.string(), title: z22.string() })
|
|
2352
2305
|
});
|
|
2353
2306
|
|
|
2354
2307
|
// src/schema/postPurchaseProduct.ts
|
|
@@ -2358,348 +2311,143 @@ var PostPurchaseVariant = OfferProduct.shape.variants.element.pick({ id: true, t
|
|
|
2358
2311
|
id: PostPurchaseVariantId,
|
|
2359
2312
|
price: PostPurchaseAmount
|
|
2360
2313
|
});
|
|
2361
|
-
var PreparedPostPurchaseProduct =
|
|
2314
|
+
var PreparedPostPurchaseProduct = z23.object({
|
|
2362
2315
|
display: PostPurchaseProductDisplay,
|
|
2363
|
-
labels:
|
|
2316
|
+
labels: z23.object({
|
|
2364
2317
|
declineAll: global.declineAll,
|
|
2365
|
-
free:
|
|
2366
|
-
payNow:
|
|
2367
|
-
quantity:
|
|
2318
|
+
free: z23.string(),
|
|
2319
|
+
payNow: z23.string(),
|
|
2320
|
+
quantity: z23.string(),
|
|
2368
2321
|
recurringShipping: global.recurringShipping,
|
|
2369
2322
|
recurringSubtotal: global.recurringSubtotal,
|
|
2370
|
-
save:
|
|
2371
|
-
shipping:
|
|
2372
|
-
subtotal:
|
|
2373
|
-
taxes:
|
|
2374
|
-
total:
|
|
2323
|
+
save: z23.string(),
|
|
2324
|
+
shipping: z23.string(),
|
|
2325
|
+
subtotal: z23.string(),
|
|
2326
|
+
taxes: z23.string(),
|
|
2327
|
+
total: z23.string()
|
|
2375
2328
|
}),
|
|
2376
2329
|
product: OfferProduct.pick({ description: true, id: true, image: true, title: true }).extend({
|
|
2377
2330
|
description: OfferProduct.shape.description.nullable(),
|
|
2378
2331
|
id: PostPurchaseProductId,
|
|
2379
2332
|
variant: PostPurchaseVariant
|
|
2380
2333
|
}),
|
|
2381
|
-
selection:
|
|
2334
|
+
selection: z23.object({
|
|
2382
2335
|
productId: PostPurchaseProductId,
|
|
2383
|
-
quantity:
|
|
2384
|
-
sellingPlanId:
|
|
2336
|
+
quantity: z23.number().int().positive(),
|
|
2337
|
+
sellingPlanId: z23.number().int().positive().optional(),
|
|
2385
2338
|
variantId: PostPurchaseVariantId
|
|
2386
2339
|
}),
|
|
2387
|
-
status:
|
|
2388
|
-
terms:
|
|
2340
|
+
status: z23.literal("prepared"),
|
|
2341
|
+
terms: z23.object({
|
|
2389
2342
|
discount: PostPurchaseDiscount,
|
|
2390
|
-
shipping:
|
|
2391
|
-
amount:
|
|
2392
|
-
title:
|
|
2393
|
-
type:
|
|
2343
|
+
shipping: z23.object({
|
|
2344
|
+
amount: z23.number().nonnegative(),
|
|
2345
|
+
title: z23.string(),
|
|
2346
|
+
type: z23.enum(["free", "fixed_amount"])
|
|
2394
2347
|
}),
|
|
2395
2348
|
subscription: PostPurchaseSubscriptionTerms.optional()
|
|
2396
2349
|
})
|
|
2397
2350
|
});
|
|
2398
|
-
var PostPurchasePreparation =
|
|
2351
|
+
var PostPurchasePreparation = z23.discriminatedUnion("status", [
|
|
2399
2352
|
PreparedPostPurchaseProduct,
|
|
2400
|
-
|
|
2353
|
+
z23.object({ reason: z23.string(), status: z23.literal("unsupported") })
|
|
2401
2354
|
]);
|
|
2402
2355
|
|
|
2403
|
-
// src/schema/postPurchaseProductCollectionView.ts
|
|
2404
|
-
import { z as z27 } from "zod";
|
|
2405
|
-
var PostPurchaseExcludedProductIds = z27.array(PostPurchaseProductId).default([]);
|
|
2406
|
-
|
|
2407
|
-
// src/schema/postPurchaseProductSettings.ts
|
|
2408
|
-
import { z as z28 } from "zod";
|
|
2409
|
-
var amount = z28.union([z28.number().nonnegative(), PostPurchaseAmount.transform(Number)]);
|
|
2410
|
-
var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
2411
|
-
discountedFrom: true,
|
|
2412
|
-
language: true,
|
|
2413
|
-
productLimit: true,
|
|
2414
|
-
productOptions: true,
|
|
2415
|
-
productType: true,
|
|
2416
|
-
productTypeSelector: true,
|
|
2417
|
-
quantityInputs: true,
|
|
2418
|
-
subscriptionIsDefault: true,
|
|
2419
|
-
upgradeToSubscription: true
|
|
2420
|
-
}).extend({
|
|
2421
|
-
advance: z28.unknown().default({}),
|
|
2422
|
-
blocks: z28.array(z28.unknown()).optional(),
|
|
2423
|
-
discount: PostPurchaseSettings.shape.discount.extend({ amount: amount.default(30) }),
|
|
2424
|
-
integrations: z28.unknown().default({}),
|
|
2425
|
-
shipping: PostPurchaseSettings.shape.shipping.extend({ amount: amount.default(10) }),
|
|
2426
|
-
styles: z28.unknown().default({}),
|
|
2427
|
-
subImages: PostPurchaseSettings.shape.subImages.catch(null),
|
|
2428
|
-
subscription: z28.unknown().default(PostPurchaseSettings.shape.subscription.parse(void 0))
|
|
2429
|
-
});
|
|
2430
|
-
|
|
2431
|
-
// src/schema/postPurchaseSelection.ts
|
|
2432
|
-
import { z as z29 } from "zod";
|
|
2433
|
-
var SelectionClaimsSchema = DecideRequestSchema.extend({
|
|
2434
|
-
appId: PostPurchaseAppIdSchema,
|
|
2435
|
-
entry: DecisionEntrySchema,
|
|
2436
|
-
iss: z29.literal("rebuy-api"),
|
|
2437
|
-
purpose: z29.literal("post-purchase-selection")
|
|
2438
|
-
});
|
|
2439
|
-
var SessionStartRequestSchema = DecideRequestSchema.extend({
|
|
2440
|
-
selectionToken: z29.string().min(1).max(8192).optional()
|
|
2441
|
-
}).strict();
|
|
2442
|
-
|
|
2443
|
-
// src/schema/postPurchaseSession.ts
|
|
2444
|
-
import { z as z30 } from "zod";
|
|
2445
|
-
var SessionIdentitySchema = DecideRequestSchema.extend({ appId: PostPurchaseAppIdSchema });
|
|
2446
|
-
var SessionOrderTimingSchema = z30.object({
|
|
2447
|
-
nativeDeadline: PostPurchaseTimestampSchema,
|
|
2448
|
-
orderCreatedAt: PostPurchaseTimestampSchema,
|
|
2449
|
-
orderId: PostPurchaseOrderIdSchema,
|
|
2450
|
-
timingSource: z30.literal("shopify-order-created-at")
|
|
2451
|
-
});
|
|
2452
|
-
var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
2453
|
-
deadline: PostPurchaseTimestampSchema,
|
|
2454
|
-
entry: DecisionEntrySchema,
|
|
2455
|
-
policySnapshot: SessionPolicySchema,
|
|
2456
|
-
startedAt: PostPurchaseTimestampSchema
|
|
2457
|
-
}).refine((session) => session.orderCreatedAt <= session.startedAt, {
|
|
2458
|
-
message: "startedAt must not precede orderCreatedAt",
|
|
2459
|
-
path: ["startedAt"]
|
|
2460
|
-
}).refine((session) => session.startedAt <= session.deadline, {
|
|
2461
|
-
message: "deadline must not precede startedAt",
|
|
2462
|
-
path: ["deadline"]
|
|
2463
|
-
}).refine((session) => session.deadline <= session.nativeDeadline, {
|
|
2464
|
-
message: "deadline must not exceed nativeDeadline",
|
|
2465
|
-
path: ["deadline"]
|
|
2466
|
-
});
|
|
2467
|
-
var SessionStartResponseSchema = z30.object({
|
|
2468
|
-
data: z30.object({
|
|
2469
|
-
phase: z30.literal("render"),
|
|
2470
|
-
serverNow: PostPurchaseTimestampSchema,
|
|
2471
|
-
session: ReadySessionTimingSchema,
|
|
2472
|
-
workflowPhase: z30.literal("start")
|
|
2473
|
-
}),
|
|
2474
|
-
successful: z30.literal(true)
|
|
2475
|
-
});
|
|
2476
|
-
|
|
2477
|
-
// src/schema/postPurchaseSessionClose.ts
|
|
2478
|
-
import { z as z31 } from "zod";
|
|
2479
|
-
var SessionClosureSchema = z31.object({ closedAt: PostPurchaseTimestampSchema, status: z31.literal("closed") });
|
|
2480
|
-
var SessionCloseRequestSchema = DecideRequestSchema.strict();
|
|
2481
|
-
var SessionCloseResponseSchema = z31.object({ data: SessionClosureSchema, successful: z31.literal(true) });
|
|
2482
|
-
|
|
2483
|
-
// src/schema/postPurchaseShadow.ts
|
|
2484
|
-
import { z as z32 } from "zod";
|
|
2485
|
-
var PostPurchaseShadowSelectionSchema = z32.discriminatedUnion("verdict", [
|
|
2486
|
-
z32.object({ entry: DecisionEntrySchema, verdict: z32.literal("render") }),
|
|
2487
|
-
z32.object({ verdict: z32.literal("skip") })
|
|
2488
|
-
]);
|
|
2489
|
-
var PostPurchaseShadowReportFields = z32.object({
|
|
2490
|
-
differences: z32.array(z32.enum(["verdict", "entry", "targeting", "incomplete-capture", "unsupported-configuration"])).refine((differences) => new Set(differences).size === differences.length, {
|
|
2491
|
-
message: "differences must not contain duplicate entries"
|
|
2492
|
-
}),
|
|
2493
|
-
legacySelection: PostPurchaseShadowSelectionSchema,
|
|
2494
|
-
phase: z32.literal("shouldRender"),
|
|
2495
|
-
sampleId: z32.string(),
|
|
2496
|
-
serverSelection: PostPurchaseShadowSelectionSchema.optional(),
|
|
2497
|
-
status: z32.enum(["match", "diverged", "incomplete"]),
|
|
2498
|
-
targetingFlowIds: z32.array(z32.number().int().positive()),
|
|
2499
|
-
workflowPhase: z32.literal("decide")
|
|
2500
|
-
});
|
|
2501
|
-
var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
2502
|
-
(report) => report.status !== "match" || report.differences.length === 0,
|
|
2503
|
-
{ message: "status 'match' requires an empty differences array", path: ["status"] }
|
|
2504
|
-
).refine((report) => report.status !== "diverged" || report.differences.length > 0, {
|
|
2505
|
-
message: "status 'diverged' requires a non-empty differences array",
|
|
2506
|
-
path: ["status"]
|
|
2507
|
-
}).refine((report) => report.status !== "diverged" || report.serverSelection !== void 0, {
|
|
2508
|
-
message: "status 'diverged' requires a serverSelection to diverge from",
|
|
2509
|
-
path: ["status"]
|
|
2510
|
-
});
|
|
2511
|
-
|
|
2512
|
-
// src/schema/postPurchaseSkipTrace.ts
|
|
2513
|
-
import { z as z33 } from "zod";
|
|
2514
|
-
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
2515
|
-
var PostPurchaseSkipTraceSchema = z33.array(
|
|
2516
|
-
z33.object({
|
|
2517
|
-
entry: DecisionEntrySchema,
|
|
2518
|
-
reason: PostPurchaseSkipReasonSchema
|
|
2519
|
-
})
|
|
2520
|
-
).max(POST_PURCHASE_SKIP_LIMIT);
|
|
2521
|
-
|
|
2522
|
-
// src/schema/postPurchaseSubscriptionDisplay.ts
|
|
2523
|
-
import { z as z34 } from "zod";
|
|
2524
|
-
var Minor = z34.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
2525
|
-
var PostPurchaseSubscriptionDisplay = z34.object({
|
|
2526
|
-
comparisonMinor: Minor,
|
|
2527
|
-
currencyCode: z34.string().regex(/^[A-Z]{3}$/),
|
|
2528
|
-
priceMinor: Minor,
|
|
2529
|
-
savingMinor: Minor,
|
|
2530
|
-
savingPercent: z34.number().int().min(0).max(100)
|
|
2531
|
-
});
|
|
2532
|
-
|
|
2533
|
-
// src/schema/postPurchaseSubscriptionProduct.ts
|
|
2534
|
-
import { z as z35 } from "zod";
|
|
2535
|
-
var PreparedPostPurchaseSubscription = PreparedPostPurchaseProduct.extend({
|
|
2536
|
-
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId: z35.number().int().positive() }),
|
|
2537
|
-
terms: PreparedPostPurchaseProduct.shape.terms.extend({
|
|
2538
|
-
subscription: PostPurchaseSubscriptionTerms
|
|
2539
|
-
}).refine(
|
|
2540
|
-
({ discount, shipping, subscription }) => (discount.type !== "none" || discount.amount === 0) && shipping.amount === subscription.initialShippingPrice && shipping.amount === subscription.recurringShippingPrice && (shipping.type !== "free" || shipping.amount === 0)
|
|
2541
|
-
)
|
|
2542
|
-
});
|
|
2543
|
-
var readPostPurchaseSubscription = (prepared) => {
|
|
2544
|
-
if (prepared.selection.sellingPlanId === void 0 && prepared.terms.subscription === void 0) return void 0;
|
|
2545
|
-
return PreparedPostPurchaseSubscription.parse(prepared);
|
|
2546
|
-
};
|
|
2547
|
-
|
|
2548
2356
|
// src/schema/postPurchaseVariantCatalog.ts
|
|
2549
|
-
import { z as
|
|
2550
|
-
var PostPurchaseVariantSelector =
|
|
2357
|
+
import { z as z24 } from "zod";
|
|
2358
|
+
var PostPurchaseVariantSelector = z24.object({ variantId: PostPurchaseVariantId }).strict();
|
|
2551
2359
|
var PostPurchaseVariantOption = OfferProduct.shape.options.element.extend({
|
|
2552
|
-
id:
|
|
2553
|
-
position:
|
|
2360
|
+
id: z24.number().int().positive(),
|
|
2361
|
+
position: z24.number().int().min(1).max(3)
|
|
2554
2362
|
});
|
|
2555
2363
|
var PostPurchaseVariantValues = OfferProduct.shape.variants.element.pick({
|
|
2556
2364
|
option1: true,
|
|
2557
2365
|
option2: true,
|
|
2558
2366
|
option3: true
|
|
2559
2367
|
});
|
|
2560
|
-
var PostPurchaseVariantCatalog =
|
|
2368
|
+
var PostPurchaseVariantCatalog = z24.object({
|
|
2561
2369
|
displayMode: PostPurchaseSettings.shape.productOptions.shape.variantSelectorDisplayMode,
|
|
2562
|
-
options:
|
|
2370
|
+
options: z24.array(PostPurchaseVariantOption),
|
|
2563
2371
|
productId: PostPurchaseProductId,
|
|
2564
2372
|
showSelectors: PostPurchaseSettings.shape.productOptions.shape.showVariantSelectors,
|
|
2565
|
-
variants:
|
|
2373
|
+
variants: z24.array(
|
|
2566
2374
|
PostPurchaseVariantValues.partial().extend({
|
|
2567
|
-
available:
|
|
2375
|
+
available: z24.boolean(),
|
|
2568
2376
|
id: PostPurchaseVariantId,
|
|
2569
|
-
imageId:
|
|
2377
|
+
imageId: z24.number().int().nonnegative().nullish(),
|
|
2570
2378
|
title: OfferProduct.shape.variants.element.shape.title
|
|
2571
2379
|
})
|
|
2572
2380
|
)
|
|
2573
2381
|
});
|
|
2574
2382
|
|
|
2575
|
-
// src/schema/
|
|
2576
|
-
|
|
2577
|
-
var
|
|
2578
|
-
|
|
2383
|
+
// src/schema/postPurchaseGroupCatalog.ts
|
|
2384
|
+
var productId = PreparedPostPurchaseProduct.shape.selection.shape.productId;
|
|
2385
|
+
var source = PostPurchaseProductSource.shape.data.element;
|
|
2386
|
+
var PostPurchaseGroupDescription = source.pick({ description: true, id: true, image: true, images: true, title: true }).extend({
|
|
2387
|
+
description: source.shape.description.default(null),
|
|
2388
|
+
image: source.shape.image.default(null),
|
|
2389
|
+
options: PostPurchaseVariantCatalog.shape.options.default([])
|
|
2390
|
+
});
|
|
2391
|
+
var PostPurchaseGroupCatalog = z25.object({
|
|
2392
|
+
memberProductId: productId,
|
|
2393
|
+
options: z25.array(z25.object({ productId, title: z25.string(), variantCatalog: PostPurchaseVariantCatalog }))
|
|
2394
|
+
});
|
|
2395
|
+
var PostPurchaseGroupSelection = z25.object({
|
|
2396
|
+
memberProductId: productId,
|
|
2397
|
+
productId
|
|
2579
2398
|
});
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2399
|
+
|
|
2400
|
+
// src/schema/postPurchaseIdentity.ts
|
|
2401
|
+
import { z as z26 } from "zod";
|
|
2402
|
+
var POST_PURCHASE_ID_MAX = 128;
|
|
2403
|
+
var PostPurchaseTimestampSchema = z26.number().int().nonnegative();
|
|
2404
|
+
var PostPurchaseOrderIdSchema = z26.string().regex(/^gid:\/\/shopify\/Order\/[1-9]\d*$/);
|
|
2405
|
+
var ShopifyDomainSchema = z26.string().max(POST_PURCHASE_ID_MAX).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?\.myshopify\.com$/);
|
|
2406
|
+
var DecideRequestSchema = z26.object({
|
|
2407
|
+
checkoutToken: z26.string().min(1).max(POST_PURCHASE_ID_MAX),
|
|
2408
|
+
shop: ShopifyDomainSchema
|
|
2585
2409
|
});
|
|
2586
|
-
var
|
|
2587
|
-
var
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2410
|
+
var PostPurchaseAppIdSchema = z26.string().min(1).max(POST_PURCHASE_ID_MAX);
|
|
2411
|
+
var DecisionEntrySchema = z26.object({
|
|
2412
|
+
blockId: z26.number().int().positive(),
|
|
2413
|
+
blockIndex: z26.string(),
|
|
2414
|
+
blockParentIndex: z26.string(),
|
|
2415
|
+
flowId: z26.number().int().positive(),
|
|
2416
|
+
sectionId: z26.number().int().positive(),
|
|
2417
|
+
widgetId: z26.number().int().positive(),
|
|
2418
|
+
widgetTraffic: z26.number().min(0).max(100)
|
|
2592
2419
|
});
|
|
2593
|
-
var PostPurchaseVariantDefaultSettings = PostPurchaseSettings.shape.productOptions.pick({
|
|
2594
|
-
hideOutOfStockVariants: true,
|
|
2595
|
-
matchVariant: true
|
|
2596
|
-
});
|
|
2597
|
-
var PostPurchaseOrderAttributes = z37.record(z37.string(), z37.array(z37.string())).default({});
|
|
2598
2420
|
|
|
2599
|
-
// src/schema/
|
|
2600
|
-
import { z as
|
|
2601
|
-
var ShopConfig = z38.object({
|
|
2602
|
-
activeExperiments: z38.array(
|
|
2603
|
-
z38.object({
|
|
2604
|
-
data: z38.array(
|
|
2605
|
-
z38.object({
|
|
2606
|
-
aliasName: z38.string(),
|
|
2607
|
-
cssInput: z38.string().nullish(),
|
|
2608
|
-
elementId: z38.coerce.number(),
|
|
2609
|
-
id: z38.coerce.number(),
|
|
2610
|
-
javascriptInput: z38.string().nullish(),
|
|
2611
|
-
traffic: z38.coerce.number()
|
|
2612
|
-
})
|
|
2613
|
-
),
|
|
2614
|
-
id: z38.coerce.number(),
|
|
2615
|
-
name: z38.string(),
|
|
2616
|
-
pageTarget: z38.string().nullable(),
|
|
2617
|
-
pageTargetUrl: z38.string().nullable(),
|
|
2618
|
-
placeholderId: z38.coerce.number().nullable(),
|
|
2619
|
-
type: z38.string()
|
|
2620
|
-
})
|
|
2621
|
-
),
|
|
2622
|
-
activePackages: z38.array(
|
|
2623
|
-
z38.object({
|
|
2624
|
-
cancelledAt: z38.string().nullable(),
|
|
2625
|
-
id: z38.number(),
|
|
2626
|
-
installedAt: z38.string().nullable(),
|
|
2627
|
-
isActive: z38.boolean(),
|
|
2628
|
-
isBillable: z38.boolean(),
|
|
2629
|
-
packageId: z38.number(),
|
|
2630
|
-
packageName: z38.string(),
|
|
2631
|
-
shortName: z38.string(),
|
|
2632
|
-
trialDays: z38.number(),
|
|
2633
|
-
uninstalledAt: z38.string().nullable()
|
|
2634
|
-
})
|
|
2635
|
-
),
|
|
2636
|
-
apiKey: z38.string(),
|
|
2637
|
-
billingVersion: z38.string().nullable(),
|
|
2638
|
-
cacheKey: z38.coerce.number(),
|
|
2639
|
-
carousel: z38.enum(["flickity", "splide"]),
|
|
2640
|
-
currency: z38.string(),
|
|
2641
|
-
currencySymbol: z38.string(),
|
|
2642
|
-
domain: z38.string(),
|
|
2643
|
-
enabledJquery: z38.boolean(),
|
|
2644
|
-
enabledPresentmentCurrencies: z38.array(z38.string()),
|
|
2645
|
-
hasSmartCollectionsEnabled: z38.boolean(),
|
|
2646
|
-
hasSmartSearchEnabled: z38.boolean(),
|
|
2647
|
-
id: z38.coerce.number(),
|
|
2648
|
-
integrations: z38.record(
|
|
2649
|
-
z38.enum([
|
|
2650
|
-
"attentive",
|
|
2651
|
-
"judgeme",
|
|
2652
|
-
"junip",
|
|
2653
|
-
"klaviyo",
|
|
2654
|
-
"loox",
|
|
2655
|
-
"okendo",
|
|
2656
|
-
"opinew",
|
|
2657
|
-
"recharge",
|
|
2658
|
-
"reviewsio",
|
|
2659
|
-
"stamped",
|
|
2660
|
-
"yotpo"
|
|
2661
|
-
]),
|
|
2662
|
-
z38.union([z38.boolean(), z38.unknown()])
|
|
2663
|
-
),
|
|
2664
|
-
markets: z38.object({
|
|
2665
|
-
enabled: z38.boolean()
|
|
2666
|
-
}),
|
|
2667
|
-
monetize: z38.object({
|
|
2668
|
-
publisherKey: z38.string().nullable()
|
|
2669
|
-
}).nullish(),
|
|
2670
|
-
moneyFormat: z38.string(),
|
|
2671
|
-
myshopifyDomain: z38.string(),
|
|
2672
|
-
primaryLocale: z38.string(),
|
|
2673
|
-
productGroupsEnabled: z38.enum(["no", "yes"]).transform((value) => value === "yes"),
|
|
2674
|
-
rechargeCustomDomain: z38.string().nullable(),
|
|
2675
|
-
sellingPlansEnabled: z38.boolean(),
|
|
2676
|
-
shopId: z38.number(),
|
|
2677
|
-
shopifySellingPlansEnabled: z38.boolean(),
|
|
2678
|
-
shopName: z38.string(),
|
|
2679
|
-
storefrontAccessToken: z38.string().nullable(),
|
|
2680
|
-
useRebuyIcons: z38.boolean()
|
|
2681
|
-
});
|
|
2421
|
+
// src/schema/postPurchaseOfferEligibility.ts
|
|
2422
|
+
import { z as z28 } from "zod";
|
|
2682
2423
|
|
|
2683
|
-
// src/schema/
|
|
2684
|
-
import { z as
|
|
2685
|
-
var
|
|
2686
|
-
shop: ShopConfig,
|
|
2687
|
-
/**
|
|
2688
|
-
* `.catch(undefined)` is the safety bar: smart-cart shape drift can NEVER fail `fetchUserConfig`,
|
|
2689
|
-
* which resolves the apiKey for every offers/monetize/analytics/gift request.
|
|
2690
|
-
*/
|
|
2691
|
-
smartCart: SmartCartConfig.nullish().catch(void 0),
|
|
2692
|
-
smartFlows: z39.array(z39.unknown())
|
|
2693
|
-
});
|
|
2424
|
+
// src/schema/postPurchaseProductCollectionView.ts
|
|
2425
|
+
import { z as z27 } from "zod";
|
|
2426
|
+
var PostPurchaseExcludedProductIds = z27.array(PostPurchaseProductId).default([]);
|
|
2694
2427
|
|
|
2695
|
-
// src/schema/
|
|
2696
|
-
|
|
2428
|
+
// src/schema/postPurchaseOfferEligibility.ts
|
|
2429
|
+
var selection = PreparedPostPurchaseProduct.shape.selection;
|
|
2430
|
+
var PostPurchaseOfferSkipReason = z28.enum(["empty", "no-eligible-subscription"]);
|
|
2431
|
+
var PostPurchaseOfferEligibilityContext = z28.object({
|
|
2432
|
+
excludedProductIds: PostPurchaseExcludedProductIds,
|
|
2433
|
+
originalLineItems: z28.array(selection.pick({ productId: true, sellingPlanId: true, variantId: true }))
|
|
2434
|
+
});
|
|
2435
|
+
var PostPurchaseOfferEligibility = z28.discriminatedUnion("status", [
|
|
2436
|
+
z28.object({
|
|
2437
|
+
members: z28.array(
|
|
2438
|
+
z28.object({ productId: selection.shape.productId, productIndex: z28.number().int().nonnegative() })
|
|
2439
|
+
),
|
|
2440
|
+
status: z28.literal("retain")
|
|
2441
|
+
}),
|
|
2442
|
+
z28.object({ reason: PostPurchaseOfferSkipReason, status: z28.literal("skip") }),
|
|
2443
|
+
z28.object({ reason: z28.literal("eligible-upgrade").optional(), status: z28.literal("unavailable") })
|
|
2444
|
+
]);
|
|
2697
2445
|
|
|
2698
|
-
// src/schema/
|
|
2699
|
-
import { z as
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
}
|
|
2446
|
+
// src/schema/postPurchaseOfferPresentation.ts
|
|
2447
|
+
import { z as z48 } from "zod";
|
|
2448
|
+
|
|
2449
|
+
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
2450
|
+
import { z as z47 } from "zod";
|
|
2703
2451
|
|
|
2704
2452
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
2705
2453
|
import { uniqBy } from "es-toolkit";
|
|
@@ -2752,32 +2500,20 @@ var targetAreas = {
|
|
|
2752
2500
|
]
|
|
2753
2501
|
};
|
|
2754
2502
|
|
|
2755
|
-
// src/schema/widgets/checkoutExtension.ts
|
|
2756
|
-
import { z as z41 } from "zod";
|
|
2757
|
-
var CheckoutExtension = z41.looseObject({
|
|
2758
|
-
type: z41.literal(WidgetType.shopify_checkout_extension).default(WidgetType.shopify_checkout_extension)
|
|
2759
|
-
});
|
|
2760
|
-
|
|
2761
|
-
// src/schema/widgets/contentBlock.ts
|
|
2762
|
-
import { z as z61 } from "zod";
|
|
2763
|
-
|
|
2764
|
-
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
2765
|
-
import { z as z60 } from "zod";
|
|
2766
|
-
|
|
2767
2503
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
2768
2504
|
import { v7 as uuidv713 } from "uuid";
|
|
2769
|
-
import { z as
|
|
2505
|
+
import { z as z46 } from "zod";
|
|
2770
2506
|
|
|
2771
2507
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
2772
|
-
import { z as
|
|
2508
|
+
import { z as z45 } from "zod";
|
|
2773
2509
|
|
|
2774
2510
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
2775
|
-
import { z as
|
|
2776
|
-
var CABBannerSection =
|
|
2511
|
+
import { z as z29 } from "zod";
|
|
2512
|
+
var CABBannerSection = z29.lazy(
|
|
2777
2513
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
2778
|
-
buttonField:
|
|
2779
|
-
color:
|
|
2780
|
-
dismissible:
|
|
2514
|
+
buttonField: z29.enum(buttonFields).optional(),
|
|
2515
|
+
color: z29.enum(bannerColors).default("info"),
|
|
2516
|
+
dismissible: z29.boolean().default(true),
|
|
2781
2517
|
/**
|
|
2782
2518
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
2783
2519
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -2793,18 +2529,18 @@ var CABBannerSection = z42.lazy(
|
|
|
2793
2529
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
2794
2530
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
2795
2531
|
*/
|
|
2796
|
-
heading:
|
|
2797
|
-
sectionType:
|
|
2532
|
+
heading: z29.record(z29.string(), z29.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
2533
|
+
sectionType: z29.literal(SectionType.banner).default(SectionType.banner)
|
|
2798
2534
|
})
|
|
2799
2535
|
);
|
|
2800
2536
|
|
|
2801
2537
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
2802
2538
|
import { v7 as uuidv73 } from "uuid";
|
|
2803
|
-
import { z as
|
|
2539
|
+
import { z as z31 } from "zod";
|
|
2804
2540
|
|
|
2805
2541
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
2806
2542
|
import { v7 as uuidv72 } from "uuid";
|
|
2807
|
-
import { z as
|
|
2543
|
+
import { z as z30 } from "zod";
|
|
2808
2544
|
|
|
2809
2545
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
2810
2546
|
var iconNames = [
|
|
@@ -2891,17 +2627,17 @@ var iconTones = ["auto", "critical", "custom", "info", "neutral", "success", "wa
|
|
|
2891
2627
|
var IconTone = freezeEnum(iconTones);
|
|
2892
2628
|
|
|
2893
2629
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
2894
|
-
var CABImageSectionFields =
|
|
2630
|
+
var CABImageSectionFields = z30.object({
|
|
2895
2631
|
...CABVariableFields,
|
|
2896
|
-
altText:
|
|
2632
|
+
altText: z30.string().refine(checkForHTML, NO_HTML).default(""),
|
|
2897
2633
|
/**
|
|
2898
2634
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
2899
2635
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
2900
2636
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
2901
2637
|
*/
|
|
2902
|
-
aspectRatio:
|
|
2903
|
-
border:
|
|
2904
|
-
buttonField:
|
|
2638
|
+
aspectRatio: z30.number().positive().nullable().default(null),
|
|
2639
|
+
border: z30.lazy(() => CABBorder),
|
|
2640
|
+
buttonField: z30.enum(buttonFields).optional(),
|
|
2905
2641
|
/**
|
|
2906
2642
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
2907
2643
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -2920,40 +2656,40 @@ var CABImageSectionFields = z43.object({
|
|
|
2920
2656
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
2921
2657
|
* the risky half.
|
|
2922
2658
|
*/
|
|
2923
|
-
category:
|
|
2659
|
+
category: z30.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
2924
2660
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
2925
|
-
iconSize:
|
|
2661
|
+
iconSize: z30.enum(iconSizes).nullable().default(null),
|
|
2926
2662
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
2927
|
-
iconTone:
|
|
2928
|
-
name:
|
|
2929
|
-
naturalHeight:
|
|
2930
|
-
naturalWidth:
|
|
2663
|
+
iconTone: z30.enum(iconTones).nullable().default(null),
|
|
2664
|
+
name: z30.string().optional(),
|
|
2665
|
+
naturalHeight: z30.number().default(0),
|
|
2666
|
+
naturalWidth: z30.number().default(0),
|
|
2931
2667
|
/**
|
|
2932
2668
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
2933
2669
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
2934
2670
|
*/
|
|
2935
|
-
objectFit:
|
|
2936
|
-
sectionId:
|
|
2937
|
-
sectionType:
|
|
2671
|
+
objectFit: z30.enum(objectFits).default(ObjectFit.contain),
|
|
2672
|
+
sectionId: z30.uuid().default(() => uuidv72()),
|
|
2673
|
+
sectionType: z30.literal(SectionType.image).default(SectionType.image),
|
|
2938
2674
|
/**
|
|
2939
2675
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
2940
2676
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
2941
2677
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
2942
2678
|
* server-chosen tier icon actually needs it.
|
|
2943
2679
|
*/
|
|
2944
|
-
source:
|
|
2945
|
-
width:
|
|
2680
|
+
source: z30.union([z30.url(), z30.literal(""), z30.string().regex(DYNAMIC_TOKEN_REGEX), z30.enum(iconNames)]).default(""),
|
|
2681
|
+
width: z30.number().default(100)
|
|
2946
2682
|
});
|
|
2947
2683
|
var iconNameSet = new Set(iconNames);
|
|
2948
|
-
var isIconName = (
|
|
2949
|
-
var CABImageSection = CABImageSectionFields.superRefine(({ category, source }, ctx) => {
|
|
2950
|
-
if (category === "icon" &&
|
|
2684
|
+
var isIconName = (source2) => iconNameSet.has(source2);
|
|
2685
|
+
var CABImageSection = CABImageSectionFields.superRefine(({ category, source: source2 }, ctx) => {
|
|
2686
|
+
if (category === "icon" && source2 !== "" && !isIconName(source2))
|
|
2951
2687
|
ctx.addIssue({
|
|
2952
2688
|
code: "custom",
|
|
2953
2689
|
message: "icon-mode source must be an icon name",
|
|
2954
2690
|
path: ["source"]
|
|
2955
2691
|
});
|
|
2956
|
-
if (category !== "icon" && isIconName(
|
|
2692
|
+
if (category !== "icon" && isIconName(source2))
|
|
2957
2693
|
ctx.addIssue({
|
|
2958
2694
|
code: "custom",
|
|
2959
2695
|
message: "source must be a URL or dynamic token unless category is `icon`",
|
|
@@ -2962,35 +2698,35 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source }, c
|
|
|
2962
2698
|
});
|
|
2963
2699
|
|
|
2964
2700
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
2965
|
-
var CABButtonContent =
|
|
2966
|
-
() =>
|
|
2701
|
+
var CABButtonContent = z31.lazy(
|
|
2702
|
+
() => z31.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
2967
2703
|
);
|
|
2968
|
-
var CABButtonSection =
|
|
2704
|
+
var CABButtonSection = z31.object({
|
|
2969
2705
|
...CABVariableFields,
|
|
2970
|
-
action:
|
|
2971
|
-
buttonStyle:
|
|
2972
|
-
custom:
|
|
2973
|
-
color:
|
|
2974
|
-
height:
|
|
2975
|
-
width:
|
|
2706
|
+
action: z31.union([z31.literal(""), z31.enum(buttonActions)]).default(""),
|
|
2707
|
+
buttonStyle: z31.enum(buttonStyles).default(ButtonStyle.primary),
|
|
2708
|
+
custom: z31.object({
|
|
2709
|
+
color: z31.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
2710
|
+
height: z31.number().default(52),
|
|
2711
|
+
width: z31.number().default(300)
|
|
2976
2712
|
}).default({
|
|
2977
2713
|
color: "#005bd3",
|
|
2978
2714
|
height: 52,
|
|
2979
2715
|
width: 300
|
|
2980
2716
|
}),
|
|
2981
|
-
disableDowngrade:
|
|
2982
|
-
name:
|
|
2983
|
-
optionId:
|
|
2984
|
-
popover:
|
|
2985
|
-
alignment:
|
|
2986
|
-
position:
|
|
2717
|
+
disableDowngrade: z31.boolean().default(false),
|
|
2718
|
+
name: z31.string().optional(),
|
|
2719
|
+
optionId: z31.number().optional(),
|
|
2720
|
+
popover: z31.object({
|
|
2721
|
+
alignment: z31.enum(textAlignments).default(TextAlignment.center),
|
|
2722
|
+
position: z31.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
2987
2723
|
}).optional().default(() => ({
|
|
2988
2724
|
alignment: TextAlignment.center,
|
|
2989
2725
|
position: PopoverPosition.blockStart
|
|
2990
2726
|
})),
|
|
2991
|
-
sectionId:
|
|
2992
|
-
sections:
|
|
2993
|
-
sectionType:
|
|
2727
|
+
sectionId: z31.uuid().default(() => uuidv73()),
|
|
2728
|
+
sections: z31.union([z31.array(CABButtonContent), z31.strictObject({}).transform(() => [])]).default(() => []),
|
|
2729
|
+
sectionType: z31.literal(SectionType.button).default(SectionType.button),
|
|
2994
2730
|
/**
|
|
2995
2731
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
2996
2732
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -3005,91 +2741,91 @@ var CABButtonSection = z44.object({
|
|
|
3005
2741
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
3006
2742
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
3007
2743
|
*/
|
|
3008
|
-
tier:
|
|
2744
|
+
tier: z31.object({ tierId: z31.string().min(1) }).optional(),
|
|
3009
2745
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
3010
|
-
trackingUrl:
|
|
2746
|
+
trackingUrl: z31.string().optional(),
|
|
3011
2747
|
/**
|
|
3012
2748
|
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
3013
2749
|
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
3014
2750
|
*/
|
|
3015
|
-
variableEffects:
|
|
2751
|
+
variableEffects: z31.array(CABVariableEffect).optional()
|
|
3016
2752
|
});
|
|
3017
2753
|
|
|
3018
2754
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3019
|
-
import { z as
|
|
2755
|
+
import { z as z36 } from "zod";
|
|
3020
2756
|
|
|
3021
2757
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3022
|
-
import { z as
|
|
2758
|
+
import { z as z35 } from "zod";
|
|
3023
2759
|
|
|
3024
2760
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
3025
2761
|
import { v7 as uuidv74 } from "uuid";
|
|
3026
|
-
import { z as
|
|
3027
|
-
var CABDiscount =
|
|
3028
|
-
amount:
|
|
3029
|
-
discountedBy:
|
|
3030
|
-
discountedFrom:
|
|
3031
|
-
type:
|
|
3032
|
-
});
|
|
3033
|
-
var CABIntegrations =
|
|
3034
|
-
judgeme:
|
|
3035
|
-
junip:
|
|
3036
|
-
klaviyo:
|
|
3037
|
-
loox:
|
|
3038
|
-
okendo:
|
|
3039
|
-
opinew:
|
|
3040
|
-
reviewsio:
|
|
3041
|
-
stamped:
|
|
3042
|
-
yotpo:
|
|
3043
|
-
});
|
|
3044
|
-
var CABDataSourceSection =
|
|
3045
|
-
dataSourceId:
|
|
3046
|
-
dataSourcePath:
|
|
2762
|
+
import { z as z32 } from "zod";
|
|
2763
|
+
var CABDiscount = z32.object({
|
|
2764
|
+
amount: z32.union([z32.number(), z32.string()]).catch(0),
|
|
2765
|
+
discountedBy: z32.string().optional(),
|
|
2766
|
+
discountedFrom: z32.enum(discountSources).optional().catch(void 0),
|
|
2767
|
+
type: z32.enum(discountTypes).catch("none")
|
|
2768
|
+
});
|
|
2769
|
+
var CABIntegrations = z32.object({
|
|
2770
|
+
judgeme: z32.boolean().default(false),
|
|
2771
|
+
junip: z32.boolean().default(false),
|
|
2772
|
+
klaviyo: z32.boolean().default(false),
|
|
2773
|
+
loox: z32.boolean().default(false),
|
|
2774
|
+
okendo: z32.boolean().default(false),
|
|
2775
|
+
opinew: z32.boolean().default(false),
|
|
2776
|
+
reviewsio: z32.boolean().default(false),
|
|
2777
|
+
stamped: z32.boolean().default(false),
|
|
2778
|
+
yotpo: z32.boolean().default(false)
|
|
2779
|
+
});
|
|
2780
|
+
var CABDataSourceSection = z32.object({
|
|
2781
|
+
dataSourceId: z32.number().nullable().default(null),
|
|
2782
|
+
dataSourcePath: z32.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
3047
2783
|
discount: CABDiscount.optional(),
|
|
3048
2784
|
integrations: CABIntegrations.optional(),
|
|
3049
|
-
limit:
|
|
3050
|
-
matchVariant:
|
|
3051
|
-
matchVariantOutOfStock:
|
|
3052
|
-
name:
|
|
3053
|
-
productType:
|
|
3054
|
-
sectionId:
|
|
3055
|
-
sectionType:
|
|
2785
|
+
limit: z32.number().default(1),
|
|
2786
|
+
matchVariant: z32.boolean().default(false),
|
|
2787
|
+
matchVariantOutOfStock: z32.boolean().default(false),
|
|
2788
|
+
name: z32.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
2789
|
+
productType: z32.enum(productTypes).optional(),
|
|
2790
|
+
sectionId: z32.uuid().default(() => uuidv74()),
|
|
2791
|
+
sectionType: z32.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
3056
2792
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
3057
|
-
subscriptionIsDefault:
|
|
3058
|
-
treatAsGwp:
|
|
2793
|
+
subscriptionIsDefault: z32.boolean().default(false),
|
|
2794
|
+
treatAsGwp: z32.boolean().default(false)
|
|
3059
2795
|
});
|
|
3060
2796
|
|
|
3061
2797
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3062
2798
|
import { v7 as uuidv76 } from "uuid";
|
|
3063
|
-
import { z as
|
|
2799
|
+
import { z as z34 } from "zod";
|
|
3064
2800
|
|
|
3065
2801
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
3066
2802
|
import { v7 as uuidv75 } from "uuid";
|
|
3067
|
-
import { z as
|
|
3068
|
-
var CABVariantContent =
|
|
3069
|
-
() =>
|
|
2803
|
+
import { z as z33 } from "zod";
|
|
2804
|
+
var CABVariantContent = z33.lazy(
|
|
2805
|
+
() => z33.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
3070
2806
|
);
|
|
3071
|
-
var CABProductSection =
|
|
2807
|
+
var CABProductSection = z33.object({
|
|
3072
2808
|
...CABVariableFields,
|
|
3073
|
-
name:
|
|
3074
|
-
productId:
|
|
3075
|
-
sectionId:
|
|
3076
|
-
sections:
|
|
3077
|
-
sectionType:
|
|
3078
|
-
selectors:
|
|
3079
|
-
variantMode:
|
|
2809
|
+
name: z33.string().optional(),
|
|
2810
|
+
productId: z33.number().nullable().default(null),
|
|
2811
|
+
sectionId: z33.uuid().default(() => uuidv75()),
|
|
2812
|
+
sections: z33.union([z33.array(CABVariantContent), z33.strictObject({}).transform(() => [])]).default(() => []),
|
|
2813
|
+
sectionType: z33.literal(SectionType.product).default(SectionType.product),
|
|
2814
|
+
selectors: z33.record(z33.string(), z33.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
2815
|
+
variantMode: z33.enum(variantModes).default(VariantMode.multiple)
|
|
3080
2816
|
});
|
|
3081
2817
|
|
|
3082
2818
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3083
|
-
var CABProductsSection =
|
|
2819
|
+
var CABProductsSection = z34.object({
|
|
3084
2820
|
...CABVariableFields,
|
|
3085
|
-
name:
|
|
3086
|
-
sectionId:
|
|
3087
|
-
sections:
|
|
3088
|
-
sectionType:
|
|
2821
|
+
name: z34.string().optional(),
|
|
2822
|
+
sectionId: z34.uuid().default(() => uuidv76()),
|
|
2823
|
+
sections: z34.union([z34.array(z34.lazy(() => CABProductSection)), z34.strictObject({}).transform(() => [])]).default(() => []),
|
|
2824
|
+
sectionType: z34.literal(SectionType.products).default(SectionType.products)
|
|
3089
2825
|
});
|
|
3090
2826
|
|
|
3091
2827
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3092
|
-
var CABOffersSection =
|
|
2828
|
+
var CABOffersSection = z35.lazy(
|
|
3093
2829
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3094
2830
|
/**
|
|
3095
2831
|
* A rule between consecutive cards in the vertical list — legacy checkout-offers' `<Divider />`,
|
|
@@ -3097,8 +2833,8 @@ var CABOffersSection = z48.lazy(
|
|
|
3097
2833
|
* run of products). Optional, not defaulted: only the v1 converter sets it (REB-24265); a
|
|
3098
2834
|
* hand-built tree keeps React CAB's dividerless rendering.
|
|
3099
2835
|
*/
|
|
3100
|
-
divider:
|
|
3101
|
-
sections:
|
|
2836
|
+
divider: z35.boolean().optional(),
|
|
2837
|
+
sections: z35.union([z35.array(z35.lazy(() => CABSection)), z35.strictObject({}).transform(() => [])]).default(() => [
|
|
3102
2838
|
CABBannerSection.parse({
|
|
3103
2839
|
buttonField: "undoAddToOrder",
|
|
3104
2840
|
color: "success",
|
|
@@ -3112,77 +2848,77 @@ var CABOffersSection = z48.lazy(
|
|
|
3112
2848
|
CABDataSourceSection.parse({}),
|
|
3113
2849
|
CABProductsSection.parse({})
|
|
3114
2850
|
]),
|
|
3115
|
-
sectionType:
|
|
2851
|
+
sectionType: z35.literal(SectionType.offers).default(SectionType.offers)
|
|
3116
2852
|
})
|
|
3117
2853
|
);
|
|
3118
2854
|
|
|
3119
2855
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3120
|
-
var CABCarouselSection =
|
|
2856
|
+
var CABCarouselSection = z36.lazy(
|
|
3121
2857
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3122
|
-
autoAdvanceInterval:
|
|
3123
|
-
itemsAtOnce:
|
|
2858
|
+
autoAdvanceInterval: z36.number().default(0),
|
|
2859
|
+
itemsAtOnce: z36.number().min(1).default(1),
|
|
3124
2860
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
3125
|
-
offersDirection:
|
|
3126
|
-
sections:
|
|
3127
|
-
sectionType:
|
|
2861
|
+
offersDirection: z36.enum(offersDirections).default("vertical"),
|
|
2862
|
+
sections: z36.union([z36.array(z36.lazy(() => CABSection)), z36.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
2863
|
+
sectionType: z36.literal(SectionType.carousel).default(SectionType.carousel)
|
|
3128
2864
|
})
|
|
3129
2865
|
);
|
|
3130
2866
|
|
|
3131
2867
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
3132
|
-
import { z as
|
|
3133
|
-
var CABCartLineSection =
|
|
2868
|
+
import { z as z37 } from "zod";
|
|
2869
|
+
var CABCartLineSection = z37.lazy(
|
|
3134
2870
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3135
|
-
sections:
|
|
3136
|
-
sectionType:
|
|
2871
|
+
sections: z37.union([z37.array(z37.lazy(() => CABSection)), z37.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
2872
|
+
sectionType: z37.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
3137
2873
|
})
|
|
3138
2874
|
);
|
|
3139
2875
|
|
|
3140
2876
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
3141
2877
|
import { v7 as uuidv77 } from "uuid";
|
|
3142
|
-
import { z as
|
|
3143
|
-
var CABDiscountSection =
|
|
2878
|
+
import { z as z38 } from "zod";
|
|
2879
|
+
var CABDiscountSection = z38.object({
|
|
3144
2880
|
...CABVariableFields,
|
|
3145
|
-
amount:
|
|
3146
|
-
discountedBy:
|
|
3147
|
-
discountedFrom:
|
|
3148
|
-
message:
|
|
3149
|
-
name:
|
|
3150
|
-
quantity:
|
|
3151
|
-
sectionId:
|
|
3152
|
-
sectionType:
|
|
3153
|
-
type:
|
|
2881
|
+
amount: z38.union([z38.number(), z38.string()]).catch(0),
|
|
2882
|
+
discountedBy: z38.string().optional(),
|
|
2883
|
+
discountedFrom: z38.enum(discountSources).optional().catch(void 0),
|
|
2884
|
+
message: z38.string().optional(),
|
|
2885
|
+
name: z38.string().optional(),
|
|
2886
|
+
quantity: z38.number().default(1),
|
|
2887
|
+
sectionId: z38.uuid().default(() => uuidv77()),
|
|
2888
|
+
sectionType: z38.literal(SectionType.discount).default(SectionType.discount),
|
|
2889
|
+
type: z38.enum(discountTypes).catch("none")
|
|
3154
2890
|
});
|
|
3155
2891
|
|
|
3156
2892
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
3157
2893
|
import { v7 as uuidv78 } from "uuid";
|
|
3158
|
-
import { z as
|
|
3159
|
-
var CABMonetizeAds =
|
|
3160
|
-
requestId:
|
|
2894
|
+
import { z as z39 } from "zod";
|
|
2895
|
+
var CABMonetizeAds = z39.object({
|
|
2896
|
+
requestId: z39.string().optional(),
|
|
3161
2897
|
/** Defaulted here, never in the beacon: absence of information is `ads` itself being absent. */
|
|
3162
|
-
testing:
|
|
2898
|
+
testing: z39.boolean().default(false)
|
|
3163
2899
|
});
|
|
3164
|
-
var CABMonetizeSection =
|
|
2900
|
+
var CABMonetizeSection = z39.object({
|
|
3165
2901
|
...CABVariableFields,
|
|
3166
2902
|
ads: CABMonetizeAds.optional(),
|
|
3167
|
-
name:
|
|
2903
|
+
name: z39.string().optional(),
|
|
3168
2904
|
/**
|
|
3169
2905
|
* Server-hydrated offer cards (inline hydration): when `/cab/sections` was asked with a `monetize`
|
|
3170
2906
|
* context block, the composed cards ride the marker itself — `[]` means "hydrated, no fill" (render
|
|
3171
2907
|
* nothing, skip the fetch); ABSENT means "not hydrated" (the client fetches via `/cab/monetize`).
|
|
3172
2908
|
*/
|
|
3173
|
-
offers:
|
|
2909
|
+
offers: z39.array(z39.lazy(() => CABSection)).optional(),
|
|
3174
2910
|
/** 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. */
|
|
3175
|
-
privacyPolicyUrl:
|
|
3176
|
-
sectionId:
|
|
3177
|
-
sectionType:
|
|
2911
|
+
privacyPolicyUrl: z39.string().optional(),
|
|
2912
|
+
sectionId: z39.uuid().default(() => uuidv78()),
|
|
2913
|
+
sectionType: z39.literal(SectionType.monetize).default(SectionType.monetize),
|
|
3178
2914
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
3179
|
-
subVertical:
|
|
2915
|
+
subVertical: z39.string().optional(),
|
|
3180
2916
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
3181
|
-
vertical:
|
|
2917
|
+
vertical: z39.string().optional()
|
|
3182
2918
|
});
|
|
3183
2919
|
|
|
3184
2920
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3185
|
-
import { z as
|
|
2921
|
+
import { z as z40 } from "zod";
|
|
3186
2922
|
|
|
3187
2923
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
3188
2924
|
var GIFT_LABELS = {
|
|
@@ -3301,34 +3037,34 @@ var GIFT_LABELS = {
|
|
|
3301
3037
|
};
|
|
3302
3038
|
|
|
3303
3039
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3304
|
-
var CABProgressTierExclusion =
|
|
3305
|
-
collectionIds:
|
|
3306
|
-
productIds:
|
|
3307
|
-
tags:
|
|
3308
|
-
type:
|
|
3040
|
+
var CABProgressTierExclusion = z40.object({
|
|
3041
|
+
collectionIds: z40.array(z40.number().int().positive()).default(() => []),
|
|
3042
|
+
productIds: z40.array(z40.number().int().positive()).default(() => []),
|
|
3043
|
+
tags: z40.array(z40.string().min(1)).default(() => []),
|
|
3044
|
+
type: z40.enum(progressTierExclusionTypes)
|
|
3309
3045
|
});
|
|
3310
|
-
var CABProgressTier =
|
|
3046
|
+
var CABProgressTier = z40.object({
|
|
3311
3047
|
/**
|
|
3312
3048
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
3313
3049
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
3314
3050
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
3315
3051
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
3316
3052
|
*/
|
|
3317
|
-
discount:
|
|
3053
|
+
discount: z40.object({ amount: z40.number().nonnegative(), type: z40.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
3318
3054
|
/**
|
|
3319
3055
|
* Per-tier exclusion rules (onsite `exclusions` when `exclusions_enabled`): lines they match don't count
|
|
3320
3056
|
* toward this tier. Empty (the default, and the converter's output for a disabled or ruleless tier) means
|
|
3321
3057
|
* the tier measures the plain bar-level adjusted progress. Consumers read ONLY the list named by the rule's
|
|
3322
3058
|
* `type` — the converter leaves the other two at `[]`, so a populated off-type list never reaches the tree.
|
|
3323
3059
|
*/
|
|
3324
|
-
exclusions:
|
|
3060
|
+
exclusions: z40.array(CABProgressTierExclusion).default(() => []),
|
|
3325
3061
|
/**
|
|
3326
3062
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
3327
3063
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
3328
3064
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
3329
3065
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
3330
3066
|
*/
|
|
3331
|
-
filterOosVariants:
|
|
3067
|
+
filterOosVariants: z40.boolean().default(false),
|
|
3332
3068
|
/**
|
|
3333
3069
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
3334
3070
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -3336,10 +3072,10 @@ var CABProgressTier = z53.object({
|
|
|
3336
3072
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
3337
3073
|
* tree is complete.
|
|
3338
3074
|
*/
|
|
3339
|
-
gift:
|
|
3340
|
-
productId:
|
|
3341
|
-
title:
|
|
3342
|
-
variantIds:
|
|
3075
|
+
gift: z40.object({
|
|
3076
|
+
productId: z40.number().int().positive(),
|
|
3077
|
+
title: z40.string().optional(),
|
|
3078
|
+
variantIds: z40.array(z40.number().int().positive()).default(() => [])
|
|
3343
3079
|
}).optional(),
|
|
3344
3080
|
/**
|
|
3345
3081
|
* The step-row icon's square size in PIXELS (onsite `product_tier_element_size`, an admin px string the
|
|
@@ -3359,7 +3095,7 @@ var CABProgressTier = z53.object({
|
|
|
3359
3095
|
* renderer never spells a fallback), which also makes a tree authored before this field render at
|
|
3360
3096
|
* React's size rather than the old hardcoded 20.
|
|
3361
3097
|
*/
|
|
3362
|
-
iconSizePx:
|
|
3098
|
+
iconSizePx: z40.number().int().min(1).max(64).default(18),
|
|
3363
3099
|
/**
|
|
3364
3100
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
3365
3101
|
* type default — 'Free Shipping' or '{n}% Discount'. A PRODUCT tier gets NO converter label: its name is
|
|
@@ -3369,35 +3105,35 @@ var CABProgressTier = z53.object({
|
|
|
3369
3105
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
3370
3106
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
3371
3107
|
*/
|
|
3372
|
-
label:
|
|
3108
|
+
label: z40.record(z40.string(), z40.string()).optional(),
|
|
3373
3109
|
/**
|
|
3374
3110
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
3375
3111
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
3376
3112
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
3377
3113
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
3378
3114
|
*/
|
|
3379
|
-
productTierImage:
|
|
3115
|
+
productTierImage: z40.boolean().default(false),
|
|
3380
3116
|
/**
|
|
3381
3117
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
3382
3118
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
3383
3119
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
3384
3120
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
3385
3121
|
*/
|
|
3386
|
-
threshold:
|
|
3122
|
+
threshold: z40.number().int().nonnegative(),
|
|
3387
3123
|
/**
|
|
3388
3124
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
3389
3125
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
3390
3126
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
3391
3127
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
3392
3128
|
*/
|
|
3393
|
-
thresholds:
|
|
3129
|
+
thresholds: z40.record(z40.string(), z40.number().int().nonnegative()).default(() => ({})),
|
|
3394
3130
|
/**
|
|
3395
3131
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
3396
3132
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
3397
3133
|
* shipping bar (single unlabeled tier, no gift).
|
|
3398
3134
|
*/
|
|
3399
|
-
tierId:
|
|
3400
|
-
tierType:
|
|
3135
|
+
tierId: z40.string().optional(),
|
|
3136
|
+
tierType: z40.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
3401
3137
|
/**
|
|
3402
3138
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
3403
3139
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -3408,9 +3144,9 @@ var CABProgressTier = z53.object({
|
|
|
3408
3144
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
3409
3145
|
* template text supplies grammatically-neutral wording around the token.
|
|
3410
3146
|
*/
|
|
3411
|
-
unit:
|
|
3147
|
+
unit: z40.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
3412
3148
|
});
|
|
3413
|
-
var CABProgressBarSection =
|
|
3149
|
+
var CABProgressBarSection = z40.lazy(
|
|
3414
3150
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
3415
3151
|
/**
|
|
3416
3152
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -3419,35 +3155,35 @@ var CABProgressBarSection = z53.lazy(
|
|
|
3419
3155
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
3420
3156
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
3421
3157
|
*/
|
|
3422
|
-
barId:
|
|
3158
|
+
barId: z40.string().optional(),
|
|
3423
3159
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
3424
|
-
countryCodes:
|
|
3160
|
+
countryCodes: z40.array(z40.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3425
3161
|
/**
|
|
3426
3162
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
3427
3163
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
3428
3164
|
*/
|
|
3429
|
-
excludeCountryCodes:
|
|
3165
|
+
excludeCountryCodes: z40.array(z40.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3430
3166
|
/**
|
|
3431
3167
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
3432
3168
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
3433
3169
|
* adds the cart's discount allocations back to the live subtotal.
|
|
3434
3170
|
*/
|
|
3435
|
-
excludeDiscountInSubtotal:
|
|
3171
|
+
excludeDiscountInSubtotal: z40.boolean().default(false),
|
|
3436
3172
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
3437
|
-
excludedVariantIds:
|
|
3173
|
+
excludedVariantIds: z40.array(z40.number().int().positive()).default(() => []),
|
|
3438
3174
|
/**
|
|
3439
3175
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
3440
3176
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
3441
3177
|
*/
|
|
3442
|
-
freeShippingOnSubscription:
|
|
3178
|
+
freeShippingOnSubscription: z40.boolean().default(false),
|
|
3443
3179
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
3444
|
-
giftAreaTitle:
|
|
3180
|
+
giftAreaTitle: z40.record(z40.string(), z40.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
3445
3181
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
3446
|
-
giftLabels:
|
|
3447
|
-
addGift:
|
|
3448
|
-
remove:
|
|
3449
|
-
selectOptions:
|
|
3450
|
-
yourGift:
|
|
3182
|
+
giftLabels: z40.object({
|
|
3183
|
+
addGift: z40.record(z40.string(), z40.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
3184
|
+
remove: z40.record(z40.string(), z40.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
3185
|
+
selectOptions: z40.record(z40.string(), z40.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
3186
|
+
yourGift: z40.record(z40.string(), z40.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
3451
3187
|
}).default(() => ({
|
|
3452
3188
|
addGift: { ...GIFT_LABELS.addGift },
|
|
3453
3189
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -3455,38 +3191,38 @@ var CABProgressBarSection = z53.lazy(
|
|
|
3455
3191
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
3456
3192
|
})),
|
|
3457
3193
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
3458
|
-
name:
|
|
3194
|
+
name: z40.string().default("Order progress"),
|
|
3459
3195
|
/**
|
|
3460
3196
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
3461
3197
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
3462
3198
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
3463
3199
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
3464
3200
|
*/
|
|
3465
|
-
progressColor:
|
|
3466
|
-
sectionType:
|
|
3201
|
+
progressColor: z40.string().optional(),
|
|
3202
|
+
sectionType: z40.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
3467
3203
|
/**
|
|
3468
3204
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
3469
3205
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
3470
3206
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
3471
3207
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
3472
3208
|
*/
|
|
3473
|
-
tiers:
|
|
3209
|
+
tiers: z40.union([z40.array(CABProgressTier), z40.strictObject({}).transform(() => [])]).default(() => [])
|
|
3474
3210
|
})
|
|
3475
3211
|
);
|
|
3476
3212
|
|
|
3477
3213
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
3478
3214
|
import { v7 as uuidv79 } from "uuid";
|
|
3479
|
-
import { z as
|
|
3480
|
-
var CABQuantitySection =
|
|
3215
|
+
import { z as z41 } from "zod";
|
|
3216
|
+
var CABQuantitySection = z41.object({
|
|
3481
3217
|
...CABVariableFields,
|
|
3482
|
-
errorMessages:
|
|
3483
|
-
|
|
3484
|
-
|
|
3218
|
+
errorMessages: z41.record(
|
|
3219
|
+
z41.string(),
|
|
3220
|
+
z41.object({
|
|
3485
3221
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
3486
|
-
increment:
|
|
3487
|
-
max:
|
|
3488
|
-
min:
|
|
3489
|
-
neg:
|
|
3222
|
+
increment: z41.string().optional(),
|
|
3223
|
+
max: z41.string().optional(),
|
|
3224
|
+
min: z41.string().optional(),
|
|
3225
|
+
neg: z41.string().optional()
|
|
3490
3226
|
})
|
|
3491
3227
|
).default({
|
|
3492
3228
|
en: {
|
|
@@ -3496,18 +3232,18 @@ var CABQuantitySection = z54.object({
|
|
|
3496
3232
|
neg: "Quantity cannot be negative"
|
|
3497
3233
|
}
|
|
3498
3234
|
}),
|
|
3499
|
-
inputType:
|
|
3500
|
-
max:
|
|
3501
|
-
min:
|
|
3235
|
+
inputType: z41.enum(quantityInputs).default(QuantityInput.select),
|
|
3236
|
+
max: z41.number().min(1).max(100).default(10),
|
|
3237
|
+
min: z41.number().min(1).default(1),
|
|
3502
3238
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
3503
|
-
name:
|
|
3504
|
-
sectionId:
|
|
3505
|
-
sectionType:
|
|
3239
|
+
name: z41.string().default("Quantity"),
|
|
3240
|
+
sectionId: z41.uuid().default(() => uuidv79()),
|
|
3241
|
+
sectionType: z41.literal(SectionType.quantity).default(SectionType.quantity)
|
|
3506
3242
|
});
|
|
3507
3243
|
|
|
3508
3244
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3509
3245
|
import { v7 as uuidv710 } from "uuid";
|
|
3510
|
-
import { z as
|
|
3246
|
+
import { z as z42 } from "zod";
|
|
3511
3247
|
|
|
3512
3248
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
3513
3249
|
var REVIEW_LABELS = {
|
|
@@ -3570,68 +3306,68 @@ var REVIEW_LABELS = {
|
|
|
3570
3306
|
};
|
|
3571
3307
|
|
|
3572
3308
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3573
|
-
var CABReviewsSection =
|
|
3309
|
+
var CABReviewsSection = z42.object({
|
|
3574
3310
|
...CABVariableFields,
|
|
3575
|
-
color:
|
|
3311
|
+
color: z42.string().default("#fadb14"),
|
|
3576
3312
|
/**
|
|
3577
3313
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
3578
3314
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
3579
3315
|
* or merchant work.
|
|
3580
3316
|
*/
|
|
3581
|
-
countLabels:
|
|
3582
|
-
one:
|
|
3583
|
-
other:
|
|
3317
|
+
countLabels: z42.object({
|
|
3318
|
+
one: z42.record(z42.string(), z42.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
3319
|
+
other: z42.record(z42.string(), z42.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
3584
3320
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
3585
|
-
name:
|
|
3586
|
-
sectionId:
|
|
3587
|
-
sectionType:
|
|
3588
|
-
size:
|
|
3321
|
+
name: z42.string().optional(),
|
|
3322
|
+
sectionId: z42.uuid().default(() => uuidv710()),
|
|
3323
|
+
sectionType: z42.literal(SectionType.reviews).default(SectionType.reviews),
|
|
3324
|
+
size: z42.enum(reviewsSizes).default(ReviewsSize.default),
|
|
3589
3325
|
/**
|
|
3590
3326
|
* Star outline color, interpolated into a style by the renderer, so it is hex-constrained like
|
|
3591
3327
|
* `CABButtonSection.color`. The legacy source (`PostPurchaseSettings.styles.starStrokeColor`) is a free
|
|
3592
3328
|
* string: its converter must validate and fall back to this default rather than let one odd value drop
|
|
3593
3329
|
* the whole reviews section.
|
|
3594
3330
|
*/
|
|
3595
|
-
strokeColor:
|
|
3331
|
+
strokeColor: z42.string().regex(HEX_COLOR_REGEX).default("#fadb14"),
|
|
3596
3332
|
/** Star outline width in px; `0` draws no outline. The legacy `styles.strokeWidth` is a STRING ('1') — its converter coerces. */
|
|
3597
|
-
strokeWidth:
|
|
3333
|
+
strokeWidth: z42.number().nonnegative().default(0)
|
|
3598
3334
|
});
|
|
3599
3335
|
|
|
3600
3336
|
// src/schema/widgets/checkout-and-beyond/separator.ts
|
|
3601
3337
|
import { v7 as uuidv711 } from "uuid";
|
|
3602
|
-
import { z as
|
|
3603
|
-
var CABSeparatorSection =
|
|
3338
|
+
import { z as z43 } from "zod";
|
|
3339
|
+
var CABSeparatorSection = z43.object({
|
|
3604
3340
|
...CABVariableFields,
|
|
3605
|
-
sectionId:
|
|
3606
|
-
sectionType:
|
|
3341
|
+
sectionId: z43.uuid().default(() => uuidv711()),
|
|
3342
|
+
sectionType: z43.literal(SectionType.separator).default(SectionType.separator)
|
|
3607
3343
|
});
|
|
3608
3344
|
|
|
3609
3345
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
3610
3346
|
import { slice } from "es-toolkit/compat";
|
|
3611
3347
|
import { v7 as uuidv712 } from "uuid";
|
|
3612
|
-
import { z as
|
|
3613
|
-
var CABVariantsSection =
|
|
3348
|
+
import { z as z44 } from "zod";
|
|
3349
|
+
var CABVariantsSection = z44.object({
|
|
3614
3350
|
...CABVariableFields,
|
|
3615
|
-
hideOutOfStockVariants:
|
|
3616
|
-
name:
|
|
3617
|
-
sectionId:
|
|
3618
|
-
sectionType:
|
|
3619
|
-
selector:
|
|
3620
|
-
variantMode:
|
|
3351
|
+
hideOutOfStockVariants: z44.boolean().default(false),
|
|
3352
|
+
name: z44.string().optional(),
|
|
3353
|
+
sectionId: z44.uuid().default(() => uuidv712()),
|
|
3354
|
+
sectionType: z44.literal(SectionType.variants).default(SectionType.variants),
|
|
3355
|
+
selector: z44.enum(slice(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
3356
|
+
variantMode: z44.enum(variantModes).default(VariantMode.multiple)
|
|
3621
3357
|
});
|
|
3622
3358
|
|
|
3623
3359
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
3624
|
-
var CABBorder =
|
|
3625
|
-
radius:
|
|
3626
|
-
style:
|
|
3627
|
-
width:
|
|
3360
|
+
var CABBorder = z45.object({
|
|
3361
|
+
radius: z45.enum(borderRadii).default(BorderRadius.base),
|
|
3362
|
+
style: z45.enum(borderStyles).default(BorderStyle.none),
|
|
3363
|
+
width: z45.enum(borderWidths).default(BorderWidth.base)
|
|
3628
3364
|
}).default({
|
|
3629
3365
|
radius: BorderRadius.base,
|
|
3630
3366
|
style: BorderStyle.none,
|
|
3631
3367
|
width: BorderWidth.base
|
|
3632
3368
|
});
|
|
3633
|
-
var CABSection =
|
|
3634
|
-
() =>
|
|
3369
|
+
var CABSection = z45.lazy(
|
|
3370
|
+
() => z45.discriminatedUnion("sectionType", [
|
|
3635
3371
|
CABBannerSection,
|
|
3636
3372
|
CABButtonSection,
|
|
3637
3373
|
CABCarouselSection,
|
|
@@ -3654,41 +3390,41 @@ var CABSection = z58.lazy(
|
|
|
3654
3390
|
);
|
|
3655
3391
|
|
|
3656
3392
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
3657
|
-
var GridItem =
|
|
3658
|
-
var CABLayoutWrapping =
|
|
3659
|
-
breakAt:
|
|
3660
|
-
maxPerLine:
|
|
3393
|
+
var GridItem = z46.union([z46.literal("auto"), z46.literal("fill"), z46.string().regex(/^\d+%$/), z46.number()]);
|
|
3394
|
+
var CABLayoutWrapping = z46.object({
|
|
3395
|
+
breakAt: z46.number().positive(),
|
|
3396
|
+
maxPerLine: z46.number().int().positive()
|
|
3661
3397
|
});
|
|
3662
|
-
var CABLayoutSection =
|
|
3398
|
+
var CABLayoutSection = z46.object({
|
|
3663
3399
|
...CABVariableFields,
|
|
3664
|
-
alignment:
|
|
3665
|
-
horizontal:
|
|
3666
|
-
vertical:
|
|
3400
|
+
alignment: z46.object({
|
|
3401
|
+
horizontal: z46.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
3402
|
+
vertical: z46.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
3667
3403
|
}).default({
|
|
3668
3404
|
horizontal: HorizontalAlignment.start,
|
|
3669
3405
|
vertical: VerticalAlignment.top
|
|
3670
3406
|
}),
|
|
3671
|
-
border:
|
|
3672
|
-
buttonField:
|
|
3673
|
-
direction:
|
|
3407
|
+
border: z46.lazy(() => CABBorder),
|
|
3408
|
+
buttonField: z46.enum(buttonFields).optional(),
|
|
3409
|
+
direction: z46.enum(directions).default(Direction.rows),
|
|
3674
3410
|
/**
|
|
3675
3411
|
* Platform chrome around the section, not a layout behavior: `callout` is a subdued box with block borders
|
|
3676
3412
|
* (the legacy post-purchase callout banner), `offer-content` the post-purchase offer's own content card.
|
|
3677
3413
|
*/
|
|
3678
|
-
frame:
|
|
3679
|
-
grid:
|
|
3680
|
-
columns:
|
|
3681
|
-
rows:
|
|
3414
|
+
frame: z46.enum(layoutFrames).optional(),
|
|
3415
|
+
grid: z46.object({
|
|
3416
|
+
columns: z46.union([z46.array(GridItem), z46.undefined()]).default(() => ["auto"]),
|
|
3417
|
+
rows: z46.union([z46.array(GridItem), z46.undefined()]).default(() => ["auto"])
|
|
3682
3418
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
3683
|
-
name:
|
|
3684
|
-
padding:
|
|
3685
|
-
sectionId:
|
|
3686
|
-
sections:
|
|
3687
|
-
sectionType:
|
|
3688
|
-
spacing:
|
|
3419
|
+
name: z46.string().optional(),
|
|
3420
|
+
padding: z46.enum(spacings).default(Spacing.none),
|
|
3421
|
+
sectionId: z46.uuid().default(() => uuidv713()),
|
|
3422
|
+
sections: z46.union([z46.array(z46.lazy(() => CABSection)), z46.strictObject({}).transform(() => [])]).default(() => []),
|
|
3423
|
+
sectionType: z46.literal(SectionType.layout).default(SectionType.layout),
|
|
3424
|
+
spacing: z46.enum(spacings).default(Spacing.base),
|
|
3689
3425
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
3690
|
-
viewUrl:
|
|
3691
|
-
width:
|
|
3426
|
+
viewUrl: z46.string().optional(),
|
|
3427
|
+
width: z46.number().default(100),
|
|
3692
3428
|
wrapping: CABLayoutWrapping.optional()
|
|
3693
3429
|
});
|
|
3694
3430
|
|
|
@@ -3710,8 +3446,8 @@ var UI_LABELS = {
|
|
|
3710
3446
|
};
|
|
3711
3447
|
|
|
3712
3448
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
3713
|
-
var localized = (fallback) =>
|
|
3714
|
-
var CABUILabels =
|
|
3449
|
+
var localized = (fallback) => z47.record(z47.string(), z47.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
3450
|
+
var CABUILabels = z47.object({
|
|
3715
3451
|
currentPage: localized(UI_LABELS.currentPage),
|
|
3716
3452
|
guest: localized(UI_LABELS.guest),
|
|
3717
3453
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -3736,154 +3472,491 @@ var CABUILabels = z60.object({
|
|
|
3736
3472
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
3737
3473
|
updating: { ...UI_LABELS.updating }
|
|
3738
3474
|
}));
|
|
3739
|
-
var TargetArea =
|
|
3740
|
-
fill:
|
|
3741
|
-
flip:
|
|
3742
|
-
icon:
|
|
3743
|
-
label:
|
|
3744
|
-
width:
|
|
3475
|
+
var TargetArea = z47.object({
|
|
3476
|
+
fill: z47.boolean().optional(),
|
|
3477
|
+
flip: z47.enum(["both", "horizontal", "vertical"]).optional(),
|
|
3478
|
+
icon: z47.string(),
|
|
3479
|
+
label: z47.string(),
|
|
3480
|
+
width: z47.string()
|
|
3745
3481
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
3746
|
-
var CABTracking =
|
|
3747
|
-
enableAttribution:
|
|
3748
|
-
enableSource:
|
|
3749
|
-
enableWidget:
|
|
3482
|
+
var CABTracking = z47.object({
|
|
3483
|
+
enableAttribution: z47.boolean().nullish().transform((value) => value ?? true),
|
|
3484
|
+
enableSource: z47.boolean().nullish().transform((value) => value ?? true),
|
|
3485
|
+
enableWidget: z47.boolean().nullish().transform((value) => value ?? true)
|
|
3750
3486
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
3751
|
-
var CABExperiment =
|
|
3752
|
-
elementId:
|
|
3753
|
-
experimentId:
|
|
3754
|
-
experimentType:
|
|
3755
|
-
selectedId:
|
|
3487
|
+
var CABExperiment = z47.object({
|
|
3488
|
+
elementId: z47.number(),
|
|
3489
|
+
experimentId: z47.number(),
|
|
3490
|
+
experimentType: z47.string(),
|
|
3491
|
+
selectedId: z47.number()
|
|
3756
3492
|
});
|
|
3757
3493
|
var CABRootSection = CABLayoutSection.extend({
|
|
3758
|
-
editorMode:
|
|
3494
|
+
editorMode: z47.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
3759
3495
|
experiment: CABExperiment.optional(),
|
|
3760
3496
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
3761
3497
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
3762
|
-
previewMode:
|
|
3763
|
-
storeId:
|
|
3498
|
+
previewMode: z47.boolean().nullish().transform((value) => value ?? false),
|
|
3499
|
+
storeId: z47.number().nullable().default(null),
|
|
3764
3500
|
targetArea: TargetArea.nullable(),
|
|
3765
3501
|
tracking: CABTracking,
|
|
3766
|
-
type:
|
|
3502
|
+
type: z47.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
3767
3503
|
uiLabels: CABUILabels,
|
|
3768
|
-
version:
|
|
3769
|
-
widgetId:
|
|
3504
|
+
version: z47.literal(2).default(2),
|
|
3505
|
+
widgetId: z47.number().nullable().default(null)
|
|
3506
|
+
});
|
|
3507
|
+
|
|
3508
|
+
// src/schema/postPurchaseOfferPresentation.ts
|
|
3509
|
+
var language2 = PostPurchaseSettings.shape.language.shape.global.unwrap().unwrap();
|
|
3510
|
+
var PostPurchaseOfferPresentation = z48.strictObject({
|
|
3511
|
+
labels: language2.pick({ declineAll: true, declineThisOffer: true }),
|
|
3512
|
+
layout: PostPurchaseSettings.shape.offersLayout,
|
|
3513
|
+
sections: CABRootSection.nullable(),
|
|
3514
|
+
showDeclineAll: PostPurchaseSettings.shape.productOptions.shape.showDeclineAll
|
|
3515
|
+
});
|
|
3516
|
+
|
|
3517
|
+
// src/schema/postPurchaseOrderDecision.ts
|
|
3518
|
+
import { z as z49 } from "zod";
|
|
3519
|
+
var OrderDecisionSchema = z49.discriminatedUnion("owner", [
|
|
3520
|
+
z49.object({ owner: z49.literal("session"), sessionId: z49.string().regex(/^[a-f0-9]{64}$/) }),
|
|
3521
|
+
z49.object({ owner: z49.literal("release"), sessionId: z49.null() })
|
|
3522
|
+
]);
|
|
3523
|
+
|
|
3524
|
+
// src/schema/postPurchasePolicy.ts
|
|
3525
|
+
import { z as z50 } from "zod";
|
|
3526
|
+
var HoldSettingSchema = z50.discriminatedUnion("enabled", [
|
|
3527
|
+
z50.object({ durationMinutes: z50.number().int().min(1).max(60), enabled: z50.literal(true) }),
|
|
3528
|
+
z50.object({ durationMinutes: z50.null(), enabled: z50.literal(false) })
|
|
3529
|
+
]);
|
|
3530
|
+
var TimingSettingsSchema = z50.object({ flowHold: HoldSettingSchema, shopHold: HoldSettingSchema });
|
|
3531
|
+
var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
3532
|
+
durationMinutes: z50.number().int().min(1).max(60).nullable(),
|
|
3533
|
+
source: z50.enum(["shop", "flow", "native"])
|
|
3534
|
+
}).refine(
|
|
3535
|
+
(policy) => {
|
|
3536
|
+
const expectedSource = policy.shopHold.enabled ? "shop" : policy.flowHold.enabled ? "flow" : "native";
|
|
3537
|
+
const expectedDuration = expectedSource === "shop" ? policy.shopHold.durationMinutes : expectedSource === "flow" ? policy.flowHold.durationMinutes : null;
|
|
3538
|
+
return policy.source === expectedSource && policy.durationMinutes === expectedDuration;
|
|
3539
|
+
},
|
|
3540
|
+
{
|
|
3541
|
+
message: "source and durationMinutes must reflect the shop-over-flow-over-native precedence",
|
|
3542
|
+
path: ["source"]
|
|
3543
|
+
}
|
|
3544
|
+
);
|
|
3545
|
+
|
|
3546
|
+
// src/schema/postPurchaseProductSettings.ts
|
|
3547
|
+
import { z as z51 } from "zod";
|
|
3548
|
+
var amount = z51.union([z51.number().nonnegative(), PostPurchaseAmount.transform(Number)]);
|
|
3549
|
+
var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
3550
|
+
discountedFrom: true,
|
|
3551
|
+
language: true,
|
|
3552
|
+
productLimit: true,
|
|
3553
|
+
productOptions: true,
|
|
3554
|
+
productType: true,
|
|
3555
|
+
productTypeSelector: true,
|
|
3556
|
+
quantityInputs: true,
|
|
3557
|
+
subscriptionIsDefault: true,
|
|
3558
|
+
upgradeToSubscription: true
|
|
3559
|
+
}).extend({
|
|
3560
|
+
advance: z51.unknown().default({}),
|
|
3561
|
+
blocks: z51.array(z51.unknown()).optional(),
|
|
3562
|
+
discount: PostPurchaseSettings.shape.discount.extend({ amount: amount.default(30) }),
|
|
3563
|
+
integrations: z51.unknown().default({}),
|
|
3564
|
+
shipping: PostPurchaseSettings.shape.shipping.extend({ amount: amount.default(10) }),
|
|
3565
|
+
styles: z51.unknown().default({}),
|
|
3566
|
+
subImages: PostPurchaseSettings.shape.subImages.catch(null),
|
|
3567
|
+
subscription: z51.unknown().default(PostPurchaseSettings.shape.subscription.parse(void 0))
|
|
3568
|
+
});
|
|
3569
|
+
|
|
3570
|
+
// src/schema/postPurchaseQuantity.ts
|
|
3571
|
+
import { z as z52 } from "zod";
|
|
3572
|
+
var quantity = PreparedPostPurchaseProduct.shape.selection.shape.quantity;
|
|
3573
|
+
var PostPurchaseQuantityPolicy = PostPurchaseSettings.shape.quantityInputs.omit({ defaultQuantity: true }).extend({
|
|
3574
|
+
initialQuantity: quantity,
|
|
3575
|
+
maxValue: quantity,
|
|
3576
|
+
minValue: z52.literal(0).transform(() => 1).or(quantity)
|
|
3577
|
+
}).refine(({ maxValue, minValue }) => minValue <= maxValue, "Quantity bounds are reversed");
|
|
3578
|
+
|
|
3579
|
+
// src/schema/postPurchaseSelection.ts
|
|
3580
|
+
import { z as z53 } from "zod";
|
|
3581
|
+
var SelectionClaimsSchema = DecideRequestSchema.extend({
|
|
3582
|
+
appId: PostPurchaseAppIdSchema,
|
|
3583
|
+
entry: DecisionEntrySchema,
|
|
3584
|
+
iss: z53.literal("rebuy-api"),
|
|
3585
|
+
purpose: z53.literal("post-purchase-selection")
|
|
3586
|
+
});
|
|
3587
|
+
var SessionStartRequestSchema = DecideRequestSchema.extend({
|
|
3588
|
+
selectionToken: z53.string().min(1).max(8192).optional()
|
|
3589
|
+
}).strict();
|
|
3590
|
+
|
|
3591
|
+
// src/schema/postPurchaseSession.ts
|
|
3592
|
+
import { z as z54 } from "zod";
|
|
3593
|
+
var SessionIdentitySchema = DecideRequestSchema.extend({ appId: PostPurchaseAppIdSchema });
|
|
3594
|
+
var SessionOrderTimingSchema = z54.object({
|
|
3595
|
+
nativeDeadline: PostPurchaseTimestampSchema,
|
|
3596
|
+
orderCreatedAt: PostPurchaseTimestampSchema,
|
|
3597
|
+
orderId: PostPurchaseOrderIdSchema,
|
|
3598
|
+
timingSource: z54.literal("shopify-order-created-at")
|
|
3599
|
+
});
|
|
3600
|
+
var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
3601
|
+
deadline: PostPurchaseTimestampSchema,
|
|
3602
|
+
entry: DecisionEntrySchema,
|
|
3603
|
+
policySnapshot: SessionPolicySchema,
|
|
3604
|
+
startedAt: PostPurchaseTimestampSchema
|
|
3605
|
+
}).refine((session) => session.orderCreatedAt <= session.startedAt, {
|
|
3606
|
+
message: "startedAt must not precede orderCreatedAt",
|
|
3607
|
+
path: ["startedAt"]
|
|
3608
|
+
}).refine((session) => session.startedAt <= session.deadline, {
|
|
3609
|
+
message: "deadline must not precede startedAt",
|
|
3610
|
+
path: ["deadline"]
|
|
3611
|
+
}).refine((session) => session.deadline <= session.nativeDeadline, {
|
|
3612
|
+
message: "deadline must not exceed nativeDeadline",
|
|
3613
|
+
path: ["deadline"]
|
|
3614
|
+
});
|
|
3615
|
+
var SessionStartResponseSchema = z54.object({
|
|
3616
|
+
data: z54.object({
|
|
3617
|
+
phase: z54.literal("render"),
|
|
3618
|
+
serverNow: PostPurchaseTimestampSchema,
|
|
3619
|
+
session: ReadySessionTimingSchema,
|
|
3620
|
+
workflowPhase: z54.literal("start")
|
|
3621
|
+
}),
|
|
3622
|
+
successful: z54.literal(true)
|
|
3623
|
+
});
|
|
3624
|
+
|
|
3625
|
+
// src/schema/postPurchaseSessionClose.ts
|
|
3626
|
+
import { z as z55 } from "zod";
|
|
3627
|
+
var SessionClosureSchema = z55.object({ closedAt: PostPurchaseTimestampSchema, status: z55.literal("closed") });
|
|
3628
|
+
var SessionCloseRequestSchema = DecideRequestSchema.strict();
|
|
3629
|
+
var SessionCloseResponseSchema = z55.object({ data: SessionClosureSchema, successful: z55.literal(true) });
|
|
3630
|
+
|
|
3631
|
+
// src/schema/postPurchaseShadow.ts
|
|
3632
|
+
import { z as z56 } from "zod";
|
|
3633
|
+
var PostPurchaseShadowSelectionSchema = z56.discriminatedUnion("verdict", [
|
|
3634
|
+
z56.object({ entry: DecisionEntrySchema, verdict: z56.literal("render") }),
|
|
3635
|
+
z56.object({ verdict: z56.literal("skip") })
|
|
3636
|
+
]);
|
|
3637
|
+
var PostPurchaseShadowReportFields = z56.object({
|
|
3638
|
+
differences: z56.array(z56.enum(["verdict", "entry", "targeting", "incomplete-capture", "unsupported-configuration"])).refine((differences) => new Set(differences).size === differences.length, {
|
|
3639
|
+
message: "differences must not contain duplicate entries"
|
|
3640
|
+
}),
|
|
3641
|
+
legacySelection: PostPurchaseShadowSelectionSchema,
|
|
3642
|
+
phase: z56.literal("shouldRender"),
|
|
3643
|
+
sampleId: z56.string(),
|
|
3644
|
+
serverSelection: PostPurchaseShadowSelectionSchema.optional(),
|
|
3645
|
+
status: z56.enum(["match", "diverged", "incomplete"]),
|
|
3646
|
+
targetingFlowIds: z56.array(z56.number().int().positive()),
|
|
3647
|
+
workflowPhase: z56.literal("decide")
|
|
3648
|
+
});
|
|
3649
|
+
var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
3650
|
+
(report) => report.status !== "match" || report.differences.length === 0,
|
|
3651
|
+
{ message: "status 'match' requires an empty differences array", path: ["status"] }
|
|
3652
|
+
).refine((report) => report.status !== "diverged" || report.differences.length > 0, {
|
|
3653
|
+
message: "status 'diverged' requires a non-empty differences array",
|
|
3654
|
+
path: ["status"]
|
|
3655
|
+
}).refine((report) => report.status !== "diverged" || report.serverSelection !== void 0, {
|
|
3656
|
+
message: "status 'diverged' requires a serverSelection to diverge from",
|
|
3657
|
+
path: ["status"]
|
|
3658
|
+
});
|
|
3659
|
+
|
|
3660
|
+
// src/schema/postPurchaseSkipTrace.ts
|
|
3661
|
+
import { z as z57 } from "zod";
|
|
3662
|
+
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
3663
|
+
var PostPurchaseSkipTraceSchema = z57.array(
|
|
3664
|
+
z57.object({
|
|
3665
|
+
entry: DecisionEntrySchema,
|
|
3666
|
+
reason: PostPurchaseSkipReasonSchema
|
|
3667
|
+
})
|
|
3668
|
+
).max(POST_PURCHASE_SKIP_LIMIT);
|
|
3669
|
+
|
|
3670
|
+
// src/schema/postPurchaseSubscriptionDisplay.ts
|
|
3671
|
+
import { z as z58 } from "zod";
|
|
3672
|
+
var Minor = z58.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
3673
|
+
var PostPurchaseSubscriptionDisplay = z58.object({
|
|
3674
|
+
comparisonMinor: Minor,
|
|
3675
|
+
currencyCode: z58.string().regex(/^[A-Z]{3}$/),
|
|
3676
|
+
priceMinor: Minor,
|
|
3677
|
+
savingMinor: Minor,
|
|
3678
|
+
savingPercent: z58.number().int().min(0).max(100)
|
|
3679
|
+
});
|
|
3680
|
+
|
|
3681
|
+
// src/schema/postPurchaseSubscriptionProduct.ts
|
|
3682
|
+
import { z as z59 } from "zod";
|
|
3683
|
+
var PreparedPostPurchaseSubscription = PreparedPostPurchaseProduct.extend({
|
|
3684
|
+
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId: z59.number().int().positive() }),
|
|
3685
|
+
terms: PreparedPostPurchaseProduct.shape.terms.extend({
|
|
3686
|
+
subscription: PostPurchaseSubscriptionTerms
|
|
3687
|
+
}).refine(
|
|
3688
|
+
({ discount, shipping, subscription }) => (discount.type !== "none" || discount.amount === 0) && shipping.amount === subscription.initialShippingPrice && shipping.amount === subscription.recurringShippingPrice && (shipping.type !== "free" || shipping.amount === 0)
|
|
3689
|
+
)
|
|
3690
|
+
});
|
|
3691
|
+
var readPostPurchaseSubscription = (prepared) => {
|
|
3692
|
+
if (prepared.selection.sellingPlanId === void 0 && prepared.terms.subscription === void 0) return void 0;
|
|
3693
|
+
return PreparedPostPurchaseSubscription.parse(prepared);
|
|
3694
|
+
};
|
|
3695
|
+
|
|
3696
|
+
// src/schema/postPurchaseVariantDefault.ts
|
|
3697
|
+
import { z as z60 } from "zod";
|
|
3698
|
+
var values = PostPurchaseVariantValues.partial().extend({
|
|
3699
|
+
option1: PostPurchaseVariantValues.shape.option1.nullish()
|
|
3700
|
+
});
|
|
3701
|
+
var variant = values.extend({
|
|
3702
|
+
id: PostPurchaseVariantId,
|
|
3703
|
+
inventoryManagement: z60.string().nullable(),
|
|
3704
|
+
inventoryPolicy: z60.string(),
|
|
3705
|
+
inventoryQuantity: z60.number()
|
|
3706
|
+
});
|
|
3707
|
+
var options = z60.array(PostPurchaseVariantOption.pick({ name: true, values: true }));
|
|
3708
|
+
var PostPurchaseVariantDefaultProduct = z60.object({
|
|
3709
|
+
id: PostPurchaseProductId,
|
|
3710
|
+
options,
|
|
3711
|
+
selectedVariant: variant.optional(),
|
|
3712
|
+
variants: z60.array(variant)
|
|
3713
|
+
});
|
|
3714
|
+
var PostPurchaseVariantDefaultSettings = PostPurchaseSettings.shape.productOptions.pick({
|
|
3715
|
+
hideOutOfStockVariants: true,
|
|
3716
|
+
matchVariant: true
|
|
3717
|
+
});
|
|
3718
|
+
var PostPurchaseOrderAttributes = z60.record(z60.string(), z60.array(z60.string())).default({});
|
|
3719
|
+
var PostPurchaseOriginalVariants = z60.array(
|
|
3720
|
+
z60.object({ productId: PostPurchaseProductId, variantId: PostPurchaseVariantId })
|
|
3721
|
+
);
|
|
3722
|
+
var PostPurchaseAttributeProducts = z60.array(
|
|
3723
|
+
z60.object({ id: PostPurchaseProductId, options, variants: z60.array(values.extend({ id: PostPurchaseVariantId })) })
|
|
3724
|
+
);
|
|
3725
|
+
|
|
3726
|
+
// src/schema/postPurchaseVariantDefaultContext.ts
|
|
3727
|
+
import { z as z61 } from "zod";
|
|
3728
|
+
var PostPurchaseVariantDefaultContext = z61.object({
|
|
3729
|
+
enrichedLineItems: z61.unknown().optional(),
|
|
3730
|
+
originalVariants: PostPurchaseOriginalVariants
|
|
3731
|
+
});
|
|
3732
|
+
|
|
3733
|
+
// src/schema/shopConfig.ts
|
|
3734
|
+
import { z as z62 } from "zod";
|
|
3735
|
+
var ShopConfig = z62.object({
|
|
3736
|
+
activeExperiments: z62.array(
|
|
3737
|
+
z62.object({
|
|
3738
|
+
data: z62.array(
|
|
3739
|
+
z62.object({
|
|
3740
|
+
aliasName: z62.string(),
|
|
3741
|
+
cssInput: z62.string().nullish(),
|
|
3742
|
+
elementId: z62.coerce.number(),
|
|
3743
|
+
id: z62.coerce.number(),
|
|
3744
|
+
javascriptInput: z62.string().nullish(),
|
|
3745
|
+
traffic: z62.coerce.number()
|
|
3746
|
+
})
|
|
3747
|
+
),
|
|
3748
|
+
id: z62.coerce.number(),
|
|
3749
|
+
name: z62.string(),
|
|
3750
|
+
pageTarget: z62.string().nullable(),
|
|
3751
|
+
pageTargetUrl: z62.string().nullable(),
|
|
3752
|
+
placeholderId: z62.coerce.number().nullable(),
|
|
3753
|
+
type: z62.string()
|
|
3754
|
+
})
|
|
3755
|
+
),
|
|
3756
|
+
activePackages: z62.array(
|
|
3757
|
+
z62.object({
|
|
3758
|
+
cancelledAt: z62.string().nullable(),
|
|
3759
|
+
id: z62.number(),
|
|
3760
|
+
installedAt: z62.string().nullable(),
|
|
3761
|
+
isActive: z62.boolean(),
|
|
3762
|
+
isBillable: z62.boolean(),
|
|
3763
|
+
packageId: z62.number(),
|
|
3764
|
+
packageName: z62.string(),
|
|
3765
|
+
shortName: z62.string(),
|
|
3766
|
+
trialDays: z62.number(),
|
|
3767
|
+
uninstalledAt: z62.string().nullable()
|
|
3768
|
+
})
|
|
3769
|
+
),
|
|
3770
|
+
apiKey: z62.string(),
|
|
3771
|
+
billingVersion: z62.string().nullable(),
|
|
3772
|
+
cacheKey: z62.coerce.number(),
|
|
3773
|
+
carousel: z62.enum(["flickity", "splide"]),
|
|
3774
|
+
currency: z62.string(),
|
|
3775
|
+
currencySymbol: z62.string(),
|
|
3776
|
+
domain: z62.string(),
|
|
3777
|
+
enabledJquery: z62.boolean(),
|
|
3778
|
+
enabledPresentmentCurrencies: z62.array(z62.string()),
|
|
3779
|
+
hasSmartCollectionsEnabled: z62.boolean(),
|
|
3780
|
+
hasSmartSearchEnabled: z62.boolean(),
|
|
3781
|
+
id: z62.coerce.number(),
|
|
3782
|
+
integrations: z62.record(
|
|
3783
|
+
z62.enum([
|
|
3784
|
+
"attentive",
|
|
3785
|
+
"judgeme",
|
|
3786
|
+
"junip",
|
|
3787
|
+
"klaviyo",
|
|
3788
|
+
"loox",
|
|
3789
|
+
"okendo",
|
|
3790
|
+
"opinew",
|
|
3791
|
+
"recharge",
|
|
3792
|
+
"reviewsio",
|
|
3793
|
+
"stamped",
|
|
3794
|
+
"yotpo"
|
|
3795
|
+
]),
|
|
3796
|
+
z62.union([z62.boolean(), z62.unknown()])
|
|
3797
|
+
),
|
|
3798
|
+
markets: z62.object({
|
|
3799
|
+
enabled: z62.boolean()
|
|
3800
|
+
}),
|
|
3801
|
+
monetize: z62.object({
|
|
3802
|
+
publisherKey: z62.string().nullable()
|
|
3803
|
+
}).nullish(),
|
|
3804
|
+
moneyFormat: z62.string(),
|
|
3805
|
+
myshopifyDomain: z62.string(),
|
|
3806
|
+
primaryLocale: z62.string(),
|
|
3807
|
+
productGroupsEnabled: z62.enum(["no", "yes"]).transform((value) => value === "yes"),
|
|
3808
|
+
rechargeCustomDomain: z62.string().nullable(),
|
|
3809
|
+
sellingPlansEnabled: z62.boolean(),
|
|
3810
|
+
shopId: z62.number(),
|
|
3811
|
+
shopifySellingPlansEnabled: z62.boolean(),
|
|
3812
|
+
shopName: z62.string(),
|
|
3813
|
+
storefrontAccessToken: z62.string().nullable(),
|
|
3814
|
+
useRebuyIcons: z62.boolean()
|
|
3815
|
+
});
|
|
3816
|
+
|
|
3817
|
+
// src/schema/userConfig.ts
|
|
3818
|
+
import { z as z63 } from "zod";
|
|
3819
|
+
var UserConfig = z63.object({
|
|
3820
|
+
shop: ShopConfig,
|
|
3821
|
+
/**
|
|
3822
|
+
* `.catch(undefined)` is the safety bar: smart-cart shape drift can NEVER fail `fetchUserConfig`,
|
|
3823
|
+
* which resolves the apiKey for every offers/monetize/analytics/gift request.
|
|
3824
|
+
*/
|
|
3825
|
+
smartCart: SmartCartConfig.nullish().catch(void 0),
|
|
3826
|
+
smartFlows: z63.array(z63.unknown())
|
|
3827
|
+
});
|
|
3828
|
+
|
|
3829
|
+
// src/schema/widgetData.ts
|
|
3830
|
+
import { z as z72 } from "zod";
|
|
3831
|
+
|
|
3832
|
+
// src/schema/widgets/abTestingPlaceholder.ts
|
|
3833
|
+
import { z as z64 } from "zod";
|
|
3834
|
+
var ABTestingPlaceholder = z64.looseObject({
|
|
3835
|
+
type: z64.literal("placeholder")
|
|
3836
|
+
});
|
|
3837
|
+
|
|
3838
|
+
// src/schema/widgets/checkoutExtension.ts
|
|
3839
|
+
import { z as z65 } from "zod";
|
|
3840
|
+
var CheckoutExtension = z65.looseObject({
|
|
3841
|
+
type: z65.literal(WidgetType.shopify_checkout_extension).default(WidgetType.shopify_checkout_extension)
|
|
3770
3842
|
});
|
|
3771
3843
|
|
|
3772
3844
|
// src/schema/widgets/contentBlock.ts
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3845
|
+
import { z as z66 } from "zod";
|
|
3846
|
+
var ContentBlockV1 = z66.object({
|
|
3847
|
+
blockSpacing: z66.enum(spacings).optional(),
|
|
3848
|
+
imageBlocks: z66.union([
|
|
3849
|
+
z66.array(
|
|
3850
|
+
z66.object({
|
|
3851
|
+
altText: z66.string().nullable(),
|
|
3852
|
+
description: z66.string().nullable(),
|
|
3853
|
+
id: z66.uuid(),
|
|
3854
|
+
imagePlacement: z66.enum(["top", "right", "bottom", "left"]),
|
|
3855
|
+
imageSize: z66.number(),
|
|
3856
|
+
imageUrl: z66.url(),
|
|
3857
|
+
textAlignment: z66.enum(["left", "center", "right"]),
|
|
3785
3858
|
/** Inline scale only: an image caption can never be a block-level heading. */
|
|
3786
|
-
textSize:
|
|
3859
|
+
textSize: z66.enum(inlineTextSizeNames)
|
|
3787
3860
|
})
|
|
3788
3861
|
),
|
|
3789
|
-
|
|
3862
|
+
z66.strictObject({}).transform(() => [])
|
|
3790
3863
|
]).optional(),
|
|
3791
|
-
imageLayout:
|
|
3792
|
-
language:
|
|
3793
|
-
description:
|
|
3794
|
-
superTitle:
|
|
3795
|
-
title:
|
|
3864
|
+
imageLayout: z66.enum(["row", "column"]).optional(),
|
|
3865
|
+
language: z66.object({
|
|
3866
|
+
description: z66.string(),
|
|
3867
|
+
superTitle: z66.string(),
|
|
3868
|
+
title: z66.string()
|
|
3796
3869
|
}),
|
|
3797
|
-
previewMode:
|
|
3798
|
-
type:
|
|
3799
|
-
version:
|
|
3870
|
+
previewMode: z66.boolean(),
|
|
3871
|
+
type: z66.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block),
|
|
3872
|
+
version: z66.literal(1)
|
|
3800
3873
|
});
|
|
3801
|
-
var ContentBlock =
|
|
3874
|
+
var ContentBlock = z66.discriminatedUnion("version", [
|
|
3802
3875
|
ContentBlockV1,
|
|
3803
3876
|
CABRootSection.extend({
|
|
3804
|
-
type:
|
|
3877
|
+
type: z66.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block)
|
|
3805
3878
|
})
|
|
3806
3879
|
]);
|
|
3807
3880
|
|
|
3808
3881
|
// src/schema/widgets/giftWithPurchase.ts
|
|
3809
|
-
import { z as
|
|
3810
|
-
var GiftWithPurchase =
|
|
3811
|
-
type:
|
|
3882
|
+
import { z as z67 } from "zod";
|
|
3883
|
+
var GiftWithPurchase = z67.looseObject({
|
|
3884
|
+
type: z67.literal(WidgetType.gift_with_purchase).default(WidgetType.gift_with_purchase)
|
|
3812
3885
|
});
|
|
3813
3886
|
|
|
3814
3887
|
// src/schema/widgets/lineItemEditor.ts
|
|
3815
|
-
import { z as
|
|
3816
|
-
var LineItemEditorSwitchLanguageV1 =
|
|
3817
|
-
downgradeToOneTimeLabel:
|
|
3888
|
+
import { z as z68 } from "zod";
|
|
3889
|
+
var LineItemEditorSwitchLanguageV1 = z68.object({
|
|
3890
|
+
downgradeToOneTimeLabel: z68.string().optional(),
|
|
3818
3891
|
/** Frequency-option template (`{{frequency}}`/`{{interval}}`) for the plan select. */
|
|
3819
|
-
subscriptionOptionLabel:
|
|
3820
|
-
upgradeToSubscriptionLabel:
|
|
3821
|
-
upgradeToSubscriptionWithoutDiscountLabel:
|
|
3892
|
+
subscriptionOptionLabel: z68.string().optional(),
|
|
3893
|
+
upgradeToSubscriptionLabel: z68.string().optional(),
|
|
3894
|
+
upgradeToSubscriptionWithoutDiscountLabel: z68.string().optional()
|
|
3822
3895
|
});
|
|
3823
|
-
var LineItemEditorV1 =
|
|
3896
|
+
var LineItemEditorV1 = z68.object({
|
|
3824
3897
|
/** Legacy `getStyles` button style; the converter carries a valid kind, defaulting to `plain`. */
|
|
3825
|
-
button:
|
|
3826
|
-
previewMode:
|
|
3827
|
-
switchToSubscription:
|
|
3828
|
-
disableDowngrade:
|
|
3898
|
+
button: z68.object({ kind: z68.enum(["plain", "primary", "secondary"]).optional() }).optional(),
|
|
3899
|
+
previewMode: z68.boolean().optional(),
|
|
3900
|
+
switchToSubscription: z68.object({
|
|
3901
|
+
disableDowngrade: z68.boolean().optional(),
|
|
3829
3902
|
language: LineItemEditorSwitchLanguageV1.optional()
|
|
3830
3903
|
}).optional(),
|
|
3831
|
-
switchToSubscriptionEnabled:
|
|
3832
|
-
tracking:
|
|
3833
|
-
enableAttribution:
|
|
3834
|
-
enableSource:
|
|
3835
|
-
enableWidget:
|
|
3904
|
+
switchToSubscriptionEnabled: z68.boolean().optional(),
|
|
3905
|
+
tracking: z68.object({
|
|
3906
|
+
enableAttribution: z68.boolean().optional(),
|
|
3907
|
+
enableSource: z68.boolean().optional(),
|
|
3908
|
+
enableWidget: z68.boolean().optional()
|
|
3836
3909
|
}).optional(),
|
|
3837
|
-
type:
|
|
3838
|
-
version:
|
|
3910
|
+
type: z68.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor),
|
|
3911
|
+
version: z68.literal(1)
|
|
3839
3912
|
});
|
|
3840
|
-
var LineItemEditor =
|
|
3913
|
+
var LineItemEditor = z68.discriminatedUnion("version", [
|
|
3841
3914
|
LineItemEditorV1,
|
|
3842
3915
|
CABRootSection.extend({
|
|
3843
|
-
type:
|
|
3916
|
+
type: z68.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor)
|
|
3844
3917
|
})
|
|
3845
3918
|
]);
|
|
3846
3919
|
|
|
3847
3920
|
// src/schema/widgets/progressBar.ts
|
|
3848
|
-
import { z as
|
|
3849
|
-
var ProgressBar =
|
|
3850
|
-
type:
|
|
3921
|
+
import { z as z69 } from "zod";
|
|
3922
|
+
var ProgressBar = z69.looseObject({
|
|
3923
|
+
type: z69.literal(WidgetType.ui_extension_progress_bar).default(WidgetType.ui_extension_progress_bar)
|
|
3851
3924
|
});
|
|
3852
3925
|
|
|
3853
3926
|
// src/schema/widgets/rebuyButton.ts
|
|
3854
|
-
import { z as
|
|
3855
|
-
var RebuyButtonV1 =
|
|
3856
|
-
type:
|
|
3857
|
-
version:
|
|
3927
|
+
import { z as z70 } from "zod";
|
|
3928
|
+
var RebuyButtonV1 = z70.looseObject({
|
|
3929
|
+
type: z70.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button),
|
|
3930
|
+
version: z70.literal(1)
|
|
3858
3931
|
});
|
|
3859
|
-
var RebuyButton =
|
|
3932
|
+
var RebuyButton = z70.discriminatedUnion("version", [
|
|
3860
3933
|
RebuyButtonV1,
|
|
3861
3934
|
CABRootSection.extend({
|
|
3862
|
-
type:
|
|
3935
|
+
type: z70.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button)
|
|
3863
3936
|
})
|
|
3864
3937
|
]);
|
|
3865
3938
|
|
|
3866
3939
|
// src/schema/widgets/rebuyMonetize.ts
|
|
3867
|
-
import { z as
|
|
3868
|
-
var RebuyMonetize =
|
|
3869
|
-
type:
|
|
3940
|
+
import { z as z71 } from "zod";
|
|
3941
|
+
var RebuyMonetize = z71.looseObject({
|
|
3942
|
+
type: z71.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad)
|
|
3870
3943
|
});
|
|
3871
|
-
var RebuyMonetizeV1 =
|
|
3872
|
-
name:
|
|
3873
|
-
previewMode:
|
|
3944
|
+
var RebuyMonetizeV1 = z71.object({
|
|
3945
|
+
name: z71.string().nullable().optional(),
|
|
3946
|
+
previewMode: z71.boolean().optional(),
|
|
3874
3947
|
/** Privacy Policy footer href → the marker section's `privacyPolicyUrl`. */
|
|
3875
|
-
privacyPolicyUrl:
|
|
3948
|
+
privacyPolicyUrl: z71.string().nullable().optional(),
|
|
3876
3949
|
/** Ads-taxonomy sub-vertical id — one of the admin Monetize editor's two configurables. */
|
|
3877
|
-
subVertical:
|
|
3878
|
-
tracking:
|
|
3879
|
-
enableAttribution:
|
|
3880
|
-
enableSource:
|
|
3881
|
-
enableWidget:
|
|
3950
|
+
subVertical: z71.string().nullable().optional(),
|
|
3951
|
+
tracking: z71.object({
|
|
3952
|
+
enableAttribution: z71.boolean().optional(),
|
|
3953
|
+
enableSource: z71.boolean().optional(),
|
|
3954
|
+
enableWidget: z71.boolean().optional()
|
|
3882
3955
|
}).optional(),
|
|
3883
|
-
type:
|
|
3884
|
-
version:
|
|
3956
|
+
type: z71.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad),
|
|
3957
|
+
version: z71.literal(1),
|
|
3885
3958
|
/** Ads-taxonomy vertical id — one of the admin Monetize editor's two configurables. */
|
|
3886
|
-
vertical:
|
|
3959
|
+
vertical: z71.string().nullable().optional()
|
|
3887
3960
|
});
|
|
3888
3961
|
|
|
3889
3962
|
// src/schema/widgetData.ts
|
|
@@ -3897,7 +3970,7 @@ var extensionWidgetTypes = [
|
|
|
3897
3970
|
WidgetType.ui_extension_line_item_editor,
|
|
3898
3971
|
WidgetType.ui_extension_progress_bar
|
|
3899
3972
|
];
|
|
3900
|
-
var WidgetData =
|
|
3973
|
+
var WidgetData = z72.discriminatedUnion("type", [
|
|
3901
3974
|
ABTestingPlaceholder,
|
|
3902
3975
|
CheckoutExtension,
|
|
3903
3976
|
ContentBlock,
|
|
@@ -4257,36 +4330,36 @@ var SWITCH_LABELS = {
|
|
|
4257
4330
|
};
|
|
4258
4331
|
|
|
4259
4332
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
4260
|
-
import { z as
|
|
4333
|
+
import { z as z74 } from "zod";
|
|
4261
4334
|
|
|
4262
4335
|
// src/schema/widgets/post-purchase-offer/postPurchaseWidget.ts
|
|
4263
|
-
import { z as
|
|
4264
|
-
var PostPurchaseWidgetLinkedFlow =
|
|
4265
|
-
id:
|
|
4266
|
-
name:
|
|
4267
|
-
});
|
|
4268
|
-
var PostPurchaseWidget =
|
|
4269
|
-
classification:
|
|
4270
|
-
createdAtTime:
|
|
4271
|
-
customEndpointName:
|
|
4272
|
-
id:
|
|
4273
|
-
lastViewed:
|
|
4274
|
-
linkedCustomEndpointId:
|
|
4275
|
-
linkedFlows:
|
|
4276
|
-
name:
|
|
4277
|
-
owner:
|
|
4336
|
+
import { z as z73 } from "zod";
|
|
4337
|
+
var PostPurchaseWidgetLinkedFlow = z73.object({
|
|
4338
|
+
id: z73.number(),
|
|
4339
|
+
name: z73.string()
|
|
4340
|
+
});
|
|
4341
|
+
var PostPurchaseWidget = z73.object({
|
|
4342
|
+
classification: z73.literal("post_purchase_offer_page").default("post_purchase_offer_page"),
|
|
4343
|
+
createdAtTime: z73.iso.datetime({ offset: true }).optional(),
|
|
4344
|
+
customEndpointName: z73.string().nullish(),
|
|
4345
|
+
id: z73.number().default(0),
|
|
4346
|
+
lastViewed: z73.iso.datetime({ offset: true }).nullish(),
|
|
4347
|
+
linkedCustomEndpointId: z73.number().nullish(),
|
|
4348
|
+
linkedFlows: z73.array(PostPurchaseWidgetLinkedFlow).optional(),
|
|
4349
|
+
name: z73.string().default(""),
|
|
4350
|
+
owner: z73.number().nullish(),
|
|
4278
4351
|
settings: PostPurchaseSettings
|
|
4279
4352
|
});
|
|
4280
4353
|
|
|
4281
4354
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
4282
|
-
var PostPurchaseOffer =
|
|
4283
|
-
|
|
4284
|
-
errors:
|
|
4285
|
-
message:
|
|
4286
|
-
successful:
|
|
4355
|
+
var PostPurchaseOffer = z74.discriminatedUnion("successful", [
|
|
4356
|
+
z74.strictObject({
|
|
4357
|
+
errors: z74.array(z74.object({ message: z74.string() })),
|
|
4358
|
+
message: z74.string(),
|
|
4359
|
+
successful: z74.literal(false)
|
|
4287
4360
|
}),
|
|
4288
|
-
|
|
4289
|
-
successful:
|
|
4361
|
+
z74.strictObject({
|
|
4362
|
+
successful: z74.literal(true),
|
|
4290
4363
|
widget: PostPurchaseWidget
|
|
4291
4364
|
})
|
|
4292
4365
|
]);
|
|
@@ -4979,23 +5052,23 @@ var QUANTITY_INPUT_TYPE = {
|
|
|
4979
5052
|
"buttons-manual-input": "number",
|
|
4980
5053
|
"dropdown-select": "select"
|
|
4981
5054
|
};
|
|
4982
|
-
var buildQuantityErrors = (
|
|
5055
|
+
var buildQuantityErrors = (quantity2) => {
|
|
4983
5056
|
const en = {
|
|
4984
|
-
...
|
|
4985
|
-
...
|
|
4986
|
-
...
|
|
5057
|
+
...quantity2.maxError && { max: normalizeTokens(quantity2.maxError, QUANTITY_ERROR_TOKENS) },
|
|
5058
|
+
...quantity2.minError && { min: normalizeTokens(quantity2.minError, QUANTITY_ERROR_TOKENS) },
|
|
5059
|
+
...quantity2.negativeError && { neg: normalizeTokens(quantity2.negativeError, QUANTITY_ERROR_TOKENS) }
|
|
4987
5060
|
};
|
|
4988
5061
|
return Object.keys(en).length ? { errorMessages: { en } } : {};
|
|
4989
5062
|
};
|
|
4990
5063
|
var buildQuantity = (settings) => {
|
|
4991
|
-
const
|
|
4992
|
-
if (!
|
|
4993
|
-
const inputType =
|
|
4994
|
-
const max = Math.min(Math.max(
|
|
4995
|
-
const min = Math.min(Math.max(
|
|
5064
|
+
const quantity2 = settings.quantityInputs;
|
|
5065
|
+
if (!quantity2?.enabled) return [];
|
|
5066
|
+
const inputType = quantity2.type ? QUANTITY_INPUT_TYPE[quantity2.type] : void 0;
|
|
5067
|
+
const max = Math.min(Math.max(quantity2.maxValue ?? 10, 1), 100);
|
|
5068
|
+
const min = Math.min(Math.max(quantity2.minValue ?? 1, 1), max);
|
|
4996
5069
|
return [
|
|
4997
5070
|
{
|
|
4998
|
-
...buildQuantityErrors(
|
|
5071
|
+
...buildQuantityErrors(quantity2),
|
|
4999
5072
|
...inputType && { inputType },
|
|
5000
5073
|
max,
|
|
5001
5074
|
min,
|
|
@@ -5005,7 +5078,7 @@ var buildQuantity = (settings) => {
|
|
|
5005
5078
|
};
|
|
5006
5079
|
var buildSubscriptionButton = (settings) => {
|
|
5007
5080
|
if (settings.productType !== "both" && settings.productType !== "subscription") return [];
|
|
5008
|
-
const
|
|
5081
|
+
const language3 = settings.language;
|
|
5009
5082
|
const slot = (buttonField, override) => ({
|
|
5010
5083
|
buttonField,
|
|
5011
5084
|
content: localizedContent(SWITCH_LABELS[buttonField], override, SWITCH_LABEL_TOKENS),
|
|
@@ -5019,9 +5092,9 @@ var buildSubscriptionButton = (settings) => {
|
|
|
5019
5092
|
...settings.productType === "subscription" && { disableDowngrade: true },
|
|
5020
5093
|
sections: [
|
|
5021
5094
|
slot("subscriptionOption", void 0),
|
|
5022
|
-
slot("switchToOneTimePurchase",
|
|
5023
|
-
slot("switchToSubscriptionNoDiscount",
|
|
5024
|
-
slot("switchToSubscriptionWithDiscount",
|
|
5095
|
+
slot("switchToOneTimePurchase", language3?.cartSwitchToOnetime),
|
|
5096
|
+
slot("switchToSubscriptionNoDiscount", language3?.upgradeToSubscription),
|
|
5097
|
+
slot("switchToSubscriptionWithDiscount", language3?.upgradeToSubscription)
|
|
5025
5098
|
],
|
|
5026
5099
|
sectionType: "button"
|
|
5027
5100
|
}
|
|
@@ -5076,11 +5149,11 @@ var buildOfferCard = (settings, horizontal) => {
|
|
|
5076
5149
|
const description = buildDescription(settings);
|
|
5077
5150
|
const reviews = buildReviews(settings);
|
|
5078
5151
|
const variants = buildVariants(settings);
|
|
5079
|
-
const
|
|
5152
|
+
const quantity2 = buildQuantity(settings);
|
|
5080
5153
|
const subscription = buildSubscriptionButton(settings);
|
|
5081
5154
|
const reveal = buildRevealButton(settings);
|
|
5082
5155
|
const addButton = buildAddButton(settings);
|
|
5083
|
-
const controls = [...description, ...
|
|
5156
|
+
const controls = [...description, ...quantity2, ...variants, ...subscription];
|
|
5084
5157
|
const info = detailBlock([title, ...variantTitle, ...reviews, price], horizontal, variantTitle.length > 0);
|
|
5085
5158
|
const card = (sections) => [
|
|
5086
5159
|
{
|
|
@@ -5134,9 +5207,9 @@ var buildCarouselNav = () => ({
|
|
|
5134
5207
|
sectionType: "layout"
|
|
5135
5208
|
});
|
|
5136
5209
|
var HEADER_FIELDS = ["superTitle", "title", "description"];
|
|
5137
|
-
var sanitizedHeader = (
|
|
5210
|
+
var sanitizedHeader = (language3) => Object.fromEntries(
|
|
5138
5211
|
HEADER_FIELDS.flatMap((field) => {
|
|
5139
|
-
const value =
|
|
5212
|
+
const value = language3?.[field];
|
|
5140
5213
|
const sanitized = value ? stripContentBlockHtml(normalizeTokens(value)) : "";
|
|
5141
5214
|
return sanitized ? [[field, sanitized]] : [];
|
|
5142
5215
|
})
|
|
@@ -5233,7 +5306,7 @@ var coerceIntegrations = (integrations) => Object.fromEntries(
|
|
|
5233
5306
|
return [key, value];
|
|
5234
5307
|
})
|
|
5235
5308
|
);
|
|
5236
|
-
var buildBanner = (
|
|
5309
|
+
var buildBanner = (language3) => language3?.successBannerEnabled ? [
|
|
5237
5310
|
{
|
|
5238
5311
|
/**
|
|
5239
5312
|
* The banner-level tag is the extraction/routing key on BOTH renderers (React CAB's
|
|
@@ -5246,7 +5319,7 @@ var buildBanner = (language2) => language2?.successBannerEnabled ? [
|
|
|
5246
5319
|
dismissible: true,
|
|
5247
5320
|
sections: [
|
|
5248
5321
|
{
|
|
5249
|
-
content: bannerMessageContent(
|
|
5322
|
+
content: bannerMessageContent(language3.successBannerMessageRte),
|
|
5250
5323
|
sectionType: "text"
|
|
5251
5324
|
},
|
|
5252
5325
|
{
|
|
@@ -5538,14 +5611,23 @@ export {
|
|
|
5538
5611
|
PopoverPosition,
|
|
5539
5612
|
PostPurchaseAmount,
|
|
5540
5613
|
PostPurchaseAppIdSchema,
|
|
5614
|
+
PostPurchaseAttributeProducts,
|
|
5541
5615
|
PostPurchaseBlock,
|
|
5542
5616
|
PostPurchaseChoice,
|
|
5543
5617
|
PostPurchaseDiscount,
|
|
5544
5618
|
PostPurchaseExcludedProductIds,
|
|
5619
|
+
PostPurchaseGroupCatalog,
|
|
5620
|
+
PostPurchaseGroupDescription,
|
|
5621
|
+
PostPurchaseGroupSelection,
|
|
5545
5622
|
PostPurchaseOffer,
|
|
5623
|
+
PostPurchaseOfferEligibility,
|
|
5624
|
+
PostPurchaseOfferEligibilityContext,
|
|
5625
|
+
PostPurchaseOfferPresentation,
|
|
5626
|
+
PostPurchaseOfferSkipReason,
|
|
5546
5627
|
PostPurchaseOptions,
|
|
5547
5628
|
PostPurchaseOrderAttributes,
|
|
5548
5629
|
PostPurchaseOrderIdSchema,
|
|
5630
|
+
PostPurchaseOriginalVariants,
|
|
5549
5631
|
PostPurchasePlanAdjustment,
|
|
5550
5632
|
PostPurchasePlanCatalog,
|
|
5551
5633
|
PostPurchasePlanOption,
|
|
@@ -5556,6 +5638,7 @@ export {
|
|
|
5556
5638
|
PostPurchaseProductId,
|
|
5557
5639
|
PostPurchaseProductSettings,
|
|
5558
5640
|
PostPurchaseProductSource,
|
|
5641
|
+
PostPurchaseQuantityPolicy,
|
|
5559
5642
|
PostPurchaseSettings,
|
|
5560
5643
|
PostPurchaseShadowReportFields,
|
|
5561
5644
|
PostPurchaseShadowReportSchema,
|
|
@@ -5567,6 +5650,7 @@ export {
|
|
|
5567
5650
|
PostPurchaseTimestampSchema,
|
|
5568
5651
|
PostPurchaseVariant,
|
|
5569
5652
|
PostPurchaseVariantCatalog,
|
|
5653
|
+
PostPurchaseVariantDefaultContext,
|
|
5570
5654
|
PostPurchaseVariantDefaultProduct,
|
|
5571
5655
|
PostPurchaseVariantDefaultSettings,
|
|
5572
5656
|
PostPurchaseVariantId,
|