@rebuy/rebuy 3.34.0 → 3.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1003 -801
- package/dist/index.mjs +1005 -803
- package/dist/schema/index.d.ts +8 -0
- package/dist/schema/postPurchaseGroup.d.ts +15 -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/postPurchaseProduct.d.ts +74 -24
- package/dist/schema/postPurchaseProductCalculation.d.ts +87 -0
- package/dist/schema/postPurchaseProductCollectionView.d.ts +724 -3
- package/dist/schema/postPurchaseProductDisplay.d.ts +41 -12
- package/dist/schema/postPurchaseProductSource.d.ts +10 -5
- package/dist/schema/postPurchaseProductView.d.ts +708 -0
- package/dist/schema/postPurchaseQuantity.d.ts +26 -0
- package/dist/schema/postPurchaseSubscriptionProduct.d.ts +74 -17
- package/dist/schema/postPurchaseVariantDefault.d.ts +17 -0
- package/dist/schema/postPurchaseVariantDefaultContext.d.ts +10 -0
- package/dist/server/__fixtures__/postPurchaseGroup.d.ts +78 -0
- package/dist/server/classifyPostPurchaseOffer.d.ts +3 -0
- package/dist/server/createPostPurchaseOrderAttributes.d.ts +9 -0
- package/dist/server/index.cjs +1131 -210
- package/dist/server/index.d.ts +20 -2
- package/dist/server/index.mjs +1131 -210
- package/dist/server/postPurchaseMemberEligibility.d.ts +7 -0
- package/dist/server/postPurchaseOfferCopy.d.ts +3 -0
- package/dist/server/postPurchaseProductDisplay.d.ts +38 -6
- 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/preparePostPurchaseAdmissionView.d.ts +418 -0
- package/dist/server/preparePostPurchaseCollectionGroup.d.ts +458 -0
- package/dist/server/preparePostPurchaseCollectionView.d.ts +442 -0
- package/dist/server/preparePostPurchaseGroupAdmissionView.d.ts +459 -0
- package/dist/server/preparePostPurchaseGroupDeclineDisplay.d.ts +12 -0
- package/dist/server/preparePostPurchaseGroupDefault.d.ts +459 -0
- package/dist/server/preparePostPurchaseGroupView.d.ts +458 -0
- package/dist/server/preparePostPurchaseMemberView.d.ts +1466 -0
- package/dist/server/preparePostPurchaseOfferPresentation.d.ts +137 -0
- package/dist/server/preparePostPurchaseProduct.d.ts +11 -0
- package/dist/server/preparePostPurchaseQuantityAdmissionView.d.ts +440 -0
- package/dist/server/preparePostPurchaseQuantityView.d.ts +427 -0
- package/dist/server/preparePostPurchaseSubscription.d.ts +37 -5
- package/dist/server/preparePostPurchaseView.d.ts +8 -0
- package/dist/server/projectPostPurchaseProduct.d.ts +42 -12
- 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/dist/transforms/postPurchase/convertDescriptionRte.d.ts +11 -0
- 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,91 +2190,37 @@ var ExitPolicySchema = z18.discriminatedUnion("status", [
|
|
|
2190
2190
|
})
|
|
2191
2191
|
]);
|
|
2192
2192
|
|
|
2193
|
-
// src/schema/postPurchaseIdentity.ts
|
|
2194
|
-
import { z as z19 } from "zod";
|
|
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
|
-
);
|
|
2242
|
-
|
|
2243
2193
|
// src/schema/postPurchaseProduct.ts
|
|
2244
|
-
import { z as
|
|
2194
|
+
import { z as z23 } from "zod";
|
|
2245
2195
|
|
|
2246
2196
|
// src/schema/postPurchaseProductDisplay.ts
|
|
2247
|
-
import { z as
|
|
2197
|
+
import { z as z20 } from "zod";
|
|
2248
2198
|
|
|
2249
2199
|
// src/schema/postPurchaseProductGallery.ts
|
|
2250
|
-
import { z as
|
|
2251
|
-
var PostPurchaseProductGallery =
|
|
2252
|
-
images:
|
|
2253
|
-
|
|
2254
|
-
description:
|
|
2255
|
-
id:
|
|
2256
|
-
source:
|
|
2257
|
-
thumbnail:
|
|
2200
|
+
import { z as z19 } from "zod";
|
|
2201
|
+
var PostPurchaseProductGallery = z19.object({
|
|
2202
|
+
images: z19.array(
|
|
2203
|
+
z19.object({
|
|
2204
|
+
description: z19.string(),
|
|
2205
|
+
id: z19.number().int().positive(),
|
|
2206
|
+
source: z19.string(),
|
|
2207
|
+
thumbnail: z19.string()
|
|
2258
2208
|
})
|
|
2259
2209
|
),
|
|
2260
|
-
selectedImageId:
|
|
2210
|
+
selectedImageId: z19.number().int().positive().optional()
|
|
2261
2211
|
});
|
|
2262
2212
|
|
|
2263
2213
|
// src/schema/postPurchaseProductDisplay.ts
|
|
2264
2214
|
var language = PostPurchaseSettings.shape.language;
|
|
2265
|
-
var PostPurchasePrimaryImageSource =
|
|
2215
|
+
var PostPurchasePrimaryImageSource = z20.string().default(
|
|
2266
2216
|
"https://cdn.shopify.com/shopifycloud/shopify/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c.gif"
|
|
2267
2217
|
);
|
|
2268
|
-
var PostPurchaseProductDisplay =
|
|
2218
|
+
var PostPurchaseProductDisplay = z20.object({
|
|
2219
|
+
descriptionDocument: TiptapDocument.optional(),
|
|
2269
2220
|
discountedFrom: PostPurchaseSettings.shape.discountedFrom,
|
|
2270
2221
|
gallery: PostPurchaseProductGallery.optional(),
|
|
2271
|
-
language: language.pick({
|
|
2272
|
-
|
|
2273
|
-
descriptionEnabled: true,
|
|
2274
|
-
descriptionRte: true,
|
|
2275
|
-
descriptionSpacing: true
|
|
2276
|
-
}),
|
|
2277
|
-
primaryImage: z23.object({ description: z23.string(), source: z23.string() }),
|
|
2222
|
+
language: language.pick({ description: true, descriptionEnabled: true }),
|
|
2223
|
+
primaryImage: z20.object({ description: z20.string(), source: z20.string() }),
|
|
2278
2224
|
productOptions: PostPurchaseSettings.shape.productOptions.pick({
|
|
2279
2225
|
showDeclineAll: true,
|
|
2280
2226
|
showShipping: true,
|
|
@@ -2288,10 +2234,10 @@ var PostPurchaseProductDisplay = z23.object({
|
|
|
2288
2234
|
});
|
|
2289
2235
|
|
|
2290
2236
|
// src/schema/postPurchaseProductSource.ts
|
|
2291
|
-
import { z as
|
|
2292
|
-
var PostPurchaseAmount =
|
|
2293
|
-
var PostPurchaseProductId =
|
|
2294
|
-
var PostPurchaseVariantId =
|
|
2237
|
+
import { z as z21 } from "zod";
|
|
2238
|
+
var PostPurchaseAmount = z21.string().regex(/^\d+(?:\.\d+)?$/).refine((value) => Number.isFinite(Number(value)));
|
|
2239
|
+
var PostPurchaseProductId = z21.number().int().positive();
|
|
2240
|
+
var PostPurchaseVariantId = z21.number().int().positive();
|
|
2295
2241
|
var ProductBase = OfferProduct.pick({ description: true, id: true, image: true, title: true }).extend({
|
|
2296
2242
|
description: OfferProduct.shape.description.nullable(),
|
|
2297
2243
|
id: PostPurchaseProductId
|
|
@@ -2299,56 +2245,56 @@ var ProductBase = OfferProduct.pick({ description: true, id: true, image: true,
|
|
|
2299
2245
|
var SourceVariant = OfferProduct.shape.variants.element.pick({ id: true, title: true }).extend({
|
|
2300
2246
|
compareAtPrice: PostPurchaseAmount.nullable(),
|
|
2301
2247
|
id: PostPurchaseVariantId,
|
|
2302
|
-
imageId:
|
|
2303
|
-
inventoryManagement:
|
|
2304
|
-
inventoryPolicy:
|
|
2305
|
-
inventoryQuantity:
|
|
2306
|
-
option1:
|
|
2307
|
-
option2:
|
|
2308
|
-
option3:
|
|
2248
|
+
imageId: z21.number().int().nonnegative().nullish(),
|
|
2249
|
+
inventoryManagement: z21.string().nullable(),
|
|
2250
|
+
inventoryPolicy: z21.string(),
|
|
2251
|
+
inventoryQuantity: z21.number(),
|
|
2252
|
+
option1: z21.unknown().optional(),
|
|
2253
|
+
option2: z21.unknown().optional(),
|
|
2254
|
+
option3: z21.unknown().optional(),
|
|
2309
2255
|
price: PostPurchaseAmount,
|
|
2310
2256
|
productId: PostPurchaseProductId,
|
|
2311
|
-
sellingPlanAllocations:
|
|
2257
|
+
sellingPlanAllocations: z21.unknown().optional()
|
|
2312
2258
|
});
|
|
2313
2259
|
var Product2 = ProductBase.extend({
|
|
2314
|
-
images:
|
|
2315
|
-
|
|
2260
|
+
images: z21.array(
|
|
2261
|
+
z21.object({ alt: z21.string().optional().catch(void 0), id: z21.number().int().positive(), src: z21.string() })
|
|
2316
2262
|
).nullish(),
|
|
2317
|
-
metadata:
|
|
2318
|
-
productQuantity:
|
|
2319
|
-
|
|
2320
|
-
|
|
2263
|
+
metadata: z21.object({
|
|
2264
|
+
productQuantity: z21.union([
|
|
2265
|
+
z21.number().int().positive(),
|
|
2266
|
+
z21.string().regex(/^[1-9]\d*$/).transform(Number)
|
|
2321
2267
|
]).optional()
|
|
2322
2268
|
}).optional(),
|
|
2323
|
-
metafields:
|
|
2324
|
-
options:
|
|
2325
|
-
productGroupVariants:
|
|
2326
|
-
selectedVariant:
|
|
2327
|
-
sellingPlanGroups:
|
|
2269
|
+
metafields: z21.unknown().optional(),
|
|
2270
|
+
options: z21.unknown().optional(),
|
|
2271
|
+
productGroupVariants: z21.array(z21.unknown()).default([]),
|
|
2272
|
+
selectedVariant: z21.unknown().optional(),
|
|
2273
|
+
sellingPlanGroups: z21.array(
|
|
2328
2274
|
OfferProduct.shape.sellingPlanGroups.unwrap().element.extend({
|
|
2329
|
-
discountAmount:
|
|
2330
|
-
discountType:
|
|
2331
|
-
id:
|
|
2332
|
-
requiresSellingPlan:
|
|
2333
|
-
sellingPlans:
|
|
2275
|
+
discountAmount: z21.unknown().optional(),
|
|
2276
|
+
discountType: z21.unknown().optional(),
|
|
2277
|
+
id: z21.unknown().optional(),
|
|
2278
|
+
requiresSellingPlan: z21.boolean().default(false),
|
|
2279
|
+
sellingPlans: z21.unknown().optional()
|
|
2334
2280
|
})
|
|
2335
2281
|
).default([]),
|
|
2336
|
-
variants:
|
|
2282
|
+
variants: z21.array(SourceVariant)
|
|
2337
2283
|
});
|
|
2338
|
-
var PostPurchaseProductSource =
|
|
2339
|
-
data:
|
|
2340
|
-
metadata:
|
|
2284
|
+
var PostPurchaseProductSource = z21.object({
|
|
2285
|
+
data: z21.array(Product2),
|
|
2286
|
+
metadata: z21.object({ widget: z21.record(z21.string(), z21.unknown()).default({}) }).default({ widget: {} })
|
|
2341
2287
|
});
|
|
2342
2288
|
|
|
2343
2289
|
// src/schema/postPurchaseSubscription.ts
|
|
2344
|
-
import { z as
|
|
2345
|
-
var PostPurchaseSubscriptionTerms =
|
|
2290
|
+
import { z as z22 } from "zod";
|
|
2291
|
+
var PostPurchaseSubscriptionTerms = z22.object({
|
|
2346
2292
|
adjustment: PostPurchasePlanAdjustment.optional(),
|
|
2347
|
-
initialShippingPrice:
|
|
2348
|
-
intervalLabel:
|
|
2349
|
-
name:
|
|
2350
|
-
recurringShippingPrice:
|
|
2351
|
-
shippingOption:
|
|
2293
|
+
initialShippingPrice: z22.number().nonnegative(),
|
|
2294
|
+
intervalLabel: z22.string().min(1),
|
|
2295
|
+
name: z22.string().min(1),
|
|
2296
|
+
recurringShippingPrice: z22.number().nonnegative(),
|
|
2297
|
+
shippingOption: z22.object({ presentmentTitle: z22.string(), title: z22.string() })
|
|
2352
2298
|
});
|
|
2353
2299
|
|
|
2354
2300
|
// src/schema/postPurchaseProduct.ts
|
|
@@ -2358,348 +2304,106 @@ var PostPurchaseVariant = OfferProduct.shape.variants.element.pick({ id: true, t
|
|
|
2358
2304
|
id: PostPurchaseVariantId,
|
|
2359
2305
|
price: PostPurchaseAmount
|
|
2360
2306
|
});
|
|
2361
|
-
var PreparedPostPurchaseProduct =
|
|
2307
|
+
var PreparedPostPurchaseProduct = z23.object({
|
|
2362
2308
|
display: PostPurchaseProductDisplay,
|
|
2363
|
-
labels:
|
|
2309
|
+
labels: z23.object({
|
|
2364
2310
|
declineAll: global.declineAll,
|
|
2365
|
-
free:
|
|
2366
|
-
payNow:
|
|
2367
|
-
quantity:
|
|
2311
|
+
free: z23.string(),
|
|
2312
|
+
payNow: z23.string(),
|
|
2313
|
+
quantity: z23.string(),
|
|
2368
2314
|
recurringShipping: global.recurringShipping,
|
|
2369
2315
|
recurringSubtotal: global.recurringSubtotal,
|
|
2370
|
-
save:
|
|
2371
|
-
shipping:
|
|
2372
|
-
subtotal:
|
|
2373
|
-
taxes:
|
|
2374
|
-
total:
|
|
2316
|
+
save: z23.string(),
|
|
2317
|
+
shipping: z23.string(),
|
|
2318
|
+
subtotal: z23.string(),
|
|
2319
|
+
taxes: z23.string(),
|
|
2320
|
+
total: z23.string()
|
|
2375
2321
|
}),
|
|
2376
2322
|
product: OfferProduct.pick({ description: true, id: true, image: true, title: true }).extend({
|
|
2377
2323
|
description: OfferProduct.shape.description.nullable(),
|
|
2378
2324
|
id: PostPurchaseProductId,
|
|
2379
2325
|
variant: PostPurchaseVariant
|
|
2380
2326
|
}),
|
|
2381
|
-
selection:
|
|
2327
|
+
selection: z23.object({
|
|
2382
2328
|
productId: PostPurchaseProductId,
|
|
2383
|
-
quantity:
|
|
2384
|
-
sellingPlanId:
|
|
2329
|
+
quantity: z23.number().int().positive(),
|
|
2330
|
+
sellingPlanId: z23.number().int().positive().optional(),
|
|
2385
2331
|
variantId: PostPurchaseVariantId
|
|
2386
2332
|
}),
|
|
2387
|
-
status:
|
|
2388
|
-
terms:
|
|
2333
|
+
status: z23.literal("prepared"),
|
|
2334
|
+
terms: z23.object({
|
|
2389
2335
|
discount: PostPurchaseDiscount,
|
|
2390
|
-
shipping:
|
|
2391
|
-
amount:
|
|
2392
|
-
title:
|
|
2393
|
-
type:
|
|
2336
|
+
shipping: z23.object({
|
|
2337
|
+
amount: z23.number().nonnegative(),
|
|
2338
|
+
title: z23.string(),
|
|
2339
|
+
type: z23.enum(["free", "fixed_amount"])
|
|
2394
2340
|
}),
|
|
2395
2341
|
subscription: PostPurchaseSubscriptionTerms.optional()
|
|
2396
2342
|
})
|
|
2397
2343
|
});
|
|
2398
|
-
var PostPurchasePreparation =
|
|
2344
|
+
var PostPurchasePreparation = z23.discriminatedUnion("status", [
|
|
2399
2345
|
PreparedPostPurchaseProduct,
|
|
2400
|
-
|
|
2346
|
+
z23.object({ reason: z23.string(), status: z23.literal("unsupported") })
|
|
2401
2347
|
]);
|
|
2402
2348
|
|
|
2403
|
-
// src/schema/
|
|
2404
|
-
import { z as
|
|
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
|
-
});
|
|
2349
|
+
// src/schema/postPurchaseQuantity.ts
|
|
2350
|
+
import { z as z47 } from "zod";
|
|
2511
2351
|
|
|
2512
|
-
// src/schema/
|
|
2513
|
-
import { z as
|
|
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);
|
|
2352
|
+
// src/schema/postPurchaseProductCollectionView.ts
|
|
2353
|
+
import { z as z46 } from "zod";
|
|
2521
2354
|
|
|
2522
|
-
// src/schema/
|
|
2523
|
-
import { z as
|
|
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
|
-
});
|
|
2355
|
+
// src/schema/postPurchaseProductView.ts
|
|
2356
|
+
import { z as z45 } from "zod";
|
|
2532
2357
|
|
|
2533
|
-
// src/schema/
|
|
2534
|
-
import { z as
|
|
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
|
-
};
|
|
2358
|
+
// src/schema/postPurchaseGroupCatalog.ts
|
|
2359
|
+
import { z as z25 } from "zod";
|
|
2547
2360
|
|
|
2548
2361
|
// src/schema/postPurchaseVariantCatalog.ts
|
|
2549
|
-
import { z as
|
|
2550
|
-
var PostPurchaseVariantSelector =
|
|
2362
|
+
import { z as z24 } from "zod";
|
|
2363
|
+
var PostPurchaseVariantSelector = z24.object({ variantId: PostPurchaseVariantId }).strict();
|
|
2551
2364
|
var PostPurchaseVariantOption = OfferProduct.shape.options.element.extend({
|
|
2552
|
-
id:
|
|
2553
|
-
position:
|
|
2365
|
+
id: z24.number().int().positive(),
|
|
2366
|
+
position: z24.number().int().min(1).max(3)
|
|
2554
2367
|
});
|
|
2555
2368
|
var PostPurchaseVariantValues = OfferProduct.shape.variants.element.pick({
|
|
2556
2369
|
option1: true,
|
|
2557
2370
|
option2: true,
|
|
2558
2371
|
option3: true
|
|
2559
2372
|
});
|
|
2560
|
-
var PostPurchaseVariantCatalog =
|
|
2373
|
+
var PostPurchaseVariantCatalog = z24.object({
|
|
2561
2374
|
displayMode: PostPurchaseSettings.shape.productOptions.shape.variantSelectorDisplayMode,
|
|
2562
|
-
options:
|
|
2375
|
+
options: z24.array(PostPurchaseVariantOption),
|
|
2563
2376
|
productId: PostPurchaseProductId,
|
|
2564
2377
|
showSelectors: PostPurchaseSettings.shape.productOptions.shape.showVariantSelectors,
|
|
2565
|
-
variants:
|
|
2378
|
+
variants: z24.array(
|
|
2566
2379
|
PostPurchaseVariantValues.partial().extend({
|
|
2567
|
-
available:
|
|
2380
|
+
available: z24.boolean(),
|
|
2568
2381
|
id: PostPurchaseVariantId,
|
|
2569
|
-
imageId:
|
|
2382
|
+
imageId: z24.number().int().nonnegative().nullish(),
|
|
2570
2383
|
title: OfferProduct.shape.variants.element.shape.title
|
|
2571
2384
|
})
|
|
2572
2385
|
)
|
|
2573
2386
|
});
|
|
2574
2387
|
|
|
2575
|
-
// src/schema/
|
|
2576
|
-
|
|
2577
|
-
var
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2388
|
+
// src/schema/postPurchaseGroupCatalog.ts
|
|
2389
|
+
var productId = PreparedPostPurchaseProduct.shape.selection.shape.productId;
|
|
2390
|
+
var source = PostPurchaseProductSource.shape.data.element;
|
|
2391
|
+
var PostPurchaseGroupDescription = source.pick({ description: true, id: true, image: true, images: true, title: true }).extend({
|
|
2392
|
+
description: source.shape.description.default(null),
|
|
2393
|
+
image: source.shape.image.default(null),
|
|
2394
|
+
options: PostPurchaseVariantCatalog.shape.options.default([])
|
|
2395
|
+
});
|
|
2396
|
+
var PostPurchaseGroupCatalog = z25.object({
|
|
2397
|
+
memberProductId: productId,
|
|
2398
|
+
options: z25.array(z25.object({ productId, title: z25.string(), variantCatalog: PostPurchaseVariantCatalog }))
|
|
2399
|
+
});
|
|
2400
|
+
var PostPurchaseGroupSelection = z25.object({
|
|
2401
|
+
memberProductId: productId,
|
|
2402
|
+
productId
|
|
2585
2403
|
});
|
|
2586
|
-
var options = z37.array(PostPurchaseVariantOption.pick({ name: true, values: true }));
|
|
2587
|
-
var PostPurchaseVariantDefaultProduct = z37.object({
|
|
2588
|
-
id: PostPurchaseProductId,
|
|
2589
|
-
options,
|
|
2590
|
-
selectedVariant: variant.optional(),
|
|
2591
|
-
variants: z37.array(variant)
|
|
2592
|
-
});
|
|
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
2404
|
|
|
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
|
-
});
|
|
2682
|
-
|
|
2683
|
-
// src/schema/userConfig.ts
|
|
2684
|
-
import { z as z39 } from "zod";
|
|
2685
|
-
var UserConfig = z39.object({
|
|
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
|
-
});
|
|
2694
|
-
|
|
2695
|
-
// src/schema/widgetData.ts
|
|
2696
|
-
import { z as z67 } from "zod";
|
|
2697
|
-
|
|
2698
|
-
// src/schema/widgets/abTestingPlaceholder.ts
|
|
2699
|
-
import { z as z40 } from "zod";
|
|
2700
|
-
var ABTestingPlaceholder = z40.looseObject({
|
|
2701
|
-
type: z40.literal("placeholder")
|
|
2702
|
-
});
|
|
2405
|
+
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
2406
|
+
import { z as z44 } from "zod";
|
|
2703
2407
|
|
|
2704
2408
|
// src/schema/widgets/checkout-and-beyond/constants.ts
|
|
2705
2409
|
import { uniqBy } from "es-toolkit";
|
|
@@ -2752,32 +2456,20 @@ var targetAreas = {
|
|
|
2752
2456
|
]
|
|
2753
2457
|
};
|
|
2754
2458
|
|
|
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
2459
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
2768
2460
|
import { v7 as uuidv713 } from "uuid";
|
|
2769
|
-
import { z as
|
|
2461
|
+
import { z as z43 } from "zod";
|
|
2770
2462
|
|
|
2771
2463
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
2772
|
-
import { z as
|
|
2464
|
+
import { z as z42 } from "zod";
|
|
2773
2465
|
|
|
2774
2466
|
// src/schema/widgets/checkout-and-beyond/banner.ts
|
|
2775
|
-
import { z as
|
|
2776
|
-
var CABBannerSection =
|
|
2467
|
+
import { z as z26 } from "zod";
|
|
2468
|
+
var CABBannerSection = z26.lazy(
|
|
2777
2469
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
2778
|
-
buttonField:
|
|
2779
|
-
color:
|
|
2780
|
-
dismissible:
|
|
2470
|
+
buttonField: z26.enum(buttonFields).optional(),
|
|
2471
|
+
color: z26.enum(bannerColors).default("info"),
|
|
2472
|
+
dismissible: z26.boolean().default(true),
|
|
2781
2473
|
/**
|
|
2782
2474
|
* The `s-banner` heading — localized content (a buyer can see a merchant-composed banner). Absent OR
|
|
2783
2475
|
* blank ⇒ no heading; the renderer emits no heading slot for `''` rather than an empty one.
|
|
@@ -2793,18 +2485,18 @@ var CABBannerSection = z42.lazy(
|
|
|
2793
2485
|
* not a 500. Nothing emits `heading` yet; the first converter that maps merchant banner copy into it
|
|
2794
2486
|
* either strips first or teaches `normalizeTextContent` to strip this field.
|
|
2795
2487
|
*/
|
|
2796
|
-
heading:
|
|
2797
|
-
sectionType:
|
|
2488
|
+
heading: z26.record(z26.string(), z26.string().refine(checkForHTML, NO_HTML)).optional(),
|
|
2489
|
+
sectionType: z26.literal(SectionType.banner).default(SectionType.banner)
|
|
2798
2490
|
})
|
|
2799
2491
|
);
|
|
2800
2492
|
|
|
2801
2493
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
2802
2494
|
import { v7 as uuidv73 } from "uuid";
|
|
2803
|
-
import { z as
|
|
2495
|
+
import { z as z28 } from "zod";
|
|
2804
2496
|
|
|
2805
2497
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
2806
2498
|
import { v7 as uuidv72 } from "uuid";
|
|
2807
|
-
import { z as
|
|
2499
|
+
import { z as z27 } from "zod";
|
|
2808
2500
|
|
|
2809
2501
|
// src/schema/widgets/checkout-and-beyond/icons.ts
|
|
2810
2502
|
var iconNames = [
|
|
@@ -2891,17 +2583,17 @@ var iconTones = ["auto", "critical", "custom", "info", "neutral", "success", "wa
|
|
|
2891
2583
|
var IconTone = freezeEnum(iconTones);
|
|
2892
2584
|
|
|
2893
2585
|
// src/schema/widgets/checkout-and-beyond/image.ts
|
|
2894
|
-
var CABImageSectionFields =
|
|
2586
|
+
var CABImageSectionFields = z27.object({
|
|
2895
2587
|
...CABVariableFields,
|
|
2896
|
-
altText:
|
|
2588
|
+
altText: z27.string().refine(checkForHTML, NO_HTML).default(""),
|
|
2897
2589
|
/**
|
|
2898
2590
|
* Image width÷height (e.g. `46` for the progress-bar fill); `null` renders at natural size. Any POSITIVE
|
|
2899
2591
|
* ratio — never limited to 1, but never `0`/negative either: a renderer dividing by it would get `Infinity`,
|
|
2900
2592
|
* and CSS `aspect-ratio` drops a negative value and silently reverts to natural size.
|
|
2901
2593
|
*/
|
|
2902
|
-
aspectRatio:
|
|
2903
|
-
border:
|
|
2904
|
-
buttonField:
|
|
2594
|
+
aspectRatio: z27.number().positive().nullable().default(null),
|
|
2595
|
+
border: z27.lazy(() => CABBorder),
|
|
2596
|
+
buttonField: z27.enum(buttonFields).optional(),
|
|
2905
2597
|
/**
|
|
2906
2598
|
* `icon` renders `source` as a single `s-icon` by name (the uber-image path covers icons too), reading
|
|
2907
2599
|
* `iconSize`/`iconTone`. The other values are a harmless informational holdover from the previous
|
|
@@ -2920,40 +2612,40 @@ var CABImageSectionFields = z43.object({
|
|
|
2920
2612
|
* behavior degraded gracefully and told us about it. The client-assembled half of the invariant was never
|
|
2921
2613
|
* the risky half.
|
|
2922
2614
|
*/
|
|
2923
|
-
category:
|
|
2615
|
+
category: z27.enum(["gallery", "icon", "icons", "payment-methods", "secure-checkout"]).nullable().default(null),
|
|
2924
2616
|
/** `icon`-mode only: the `s-icon` `size`; `null` ⇒ the component default (`base`). Ignored by image treatments. */
|
|
2925
|
-
iconSize:
|
|
2617
|
+
iconSize: z27.enum(iconSizes).nullable().default(null),
|
|
2926
2618
|
/** `icon`-mode only: the `s-icon` `tone`; `null` ⇒ the component default (`auto`). Ignored by image treatments. */
|
|
2927
|
-
iconTone:
|
|
2928
|
-
name:
|
|
2929
|
-
naturalHeight:
|
|
2930
|
-
naturalWidth:
|
|
2619
|
+
iconTone: z27.enum(iconTones).nullable().default(null),
|
|
2620
|
+
name: z27.string().optional(),
|
|
2621
|
+
naturalHeight: z27.number().default(0),
|
|
2622
|
+
naturalWidth: z27.number().default(0),
|
|
2931
2623
|
/**
|
|
2932
2624
|
* `contain` (the component default): dimensionless images render in s-image's 1/1 default frame, and
|
|
2933
2625
|
* `cover` would crop non-square art (payment badges lost their edges — 15993); `contain` letterboxes.
|
|
2934
2626
|
*/
|
|
2935
|
-
objectFit:
|
|
2936
|
-
sectionId:
|
|
2937
|
-
sectionType:
|
|
2627
|
+
objectFit: z27.enum(objectFits).default(ObjectFit.contain),
|
|
2628
|
+
sectionId: z27.uuid().default(() => uuidv72()),
|
|
2629
|
+
sectionType: z27.literal(SectionType.image).default(SectionType.image),
|
|
2938
2630
|
/**
|
|
2939
2631
|
* An image URL or dynamic token, an empty default, or — when `category: 'icon'` — an icon NAME. Icon mode
|
|
2940
2632
|
* takes a name or `''` only, NOT a token: no renderer resolves a token to an icon today, so accepting one
|
|
2941
2633
|
* would promise a capability that doesn't exist. Widen the refine's carve-out to `DYNAMIC_TOKEN_REGEX` when a
|
|
2942
2634
|
* server-chosen tier icon actually needs it.
|
|
2943
2635
|
*/
|
|
2944
|
-
source:
|
|
2945
|
-
width:
|
|
2636
|
+
source: z27.union([z27.url(), z27.literal(""), z27.string().regex(DYNAMIC_TOKEN_REGEX), z27.enum(iconNames)]).default(""),
|
|
2637
|
+
width: z27.number().default(100)
|
|
2946
2638
|
});
|
|
2947
2639
|
var iconNameSet = new Set(iconNames);
|
|
2948
|
-
var isIconName = (
|
|
2949
|
-
var CABImageSection = CABImageSectionFields.superRefine(({ category, source }, ctx) => {
|
|
2950
|
-
if (category === "icon" &&
|
|
2640
|
+
var isIconName = (source2) => iconNameSet.has(source2);
|
|
2641
|
+
var CABImageSection = CABImageSectionFields.superRefine(({ category, source: source2 }, ctx) => {
|
|
2642
|
+
if (category === "icon" && source2 !== "" && !isIconName(source2))
|
|
2951
2643
|
ctx.addIssue({
|
|
2952
2644
|
code: "custom",
|
|
2953
2645
|
message: "icon-mode source must be an icon name",
|
|
2954
2646
|
path: ["source"]
|
|
2955
2647
|
});
|
|
2956
|
-
if (category !== "icon" && isIconName(
|
|
2648
|
+
if (category !== "icon" && isIconName(source2))
|
|
2957
2649
|
ctx.addIssue({
|
|
2958
2650
|
code: "custom",
|
|
2959
2651
|
message: "source must be a URL or dynamic token unless category is `icon`",
|
|
@@ -2962,35 +2654,35 @@ var CABImageSection = CABImageSectionFields.superRefine(({ category, source }, c
|
|
|
2962
2654
|
});
|
|
2963
2655
|
|
|
2964
2656
|
// src/schema/widgets/checkout-and-beyond/button.ts
|
|
2965
|
-
var CABButtonContent =
|
|
2966
|
-
() =>
|
|
2657
|
+
var CABButtonContent = z28.lazy(
|
|
2658
|
+
() => z28.discriminatedUnion("sectionType", [CABImageSection, CABLayoutSection, CABTextSection])
|
|
2967
2659
|
);
|
|
2968
|
-
var CABButtonSection =
|
|
2660
|
+
var CABButtonSection = z28.object({
|
|
2969
2661
|
...CABVariableFields,
|
|
2970
|
-
action:
|
|
2971
|
-
buttonStyle:
|
|
2972
|
-
custom:
|
|
2973
|
-
color:
|
|
2974
|
-
height:
|
|
2975
|
-
width:
|
|
2662
|
+
action: z28.union([z28.literal(""), z28.enum(buttonActions)]).default(""),
|
|
2663
|
+
buttonStyle: z28.enum(buttonStyles).default(ButtonStyle.primary),
|
|
2664
|
+
custom: z28.object({
|
|
2665
|
+
color: z28.string().regex(HEX_COLOR_REGEX).default("#005bd3"),
|
|
2666
|
+
height: z28.number().default(52),
|
|
2667
|
+
width: z28.number().default(300)
|
|
2976
2668
|
}).default({
|
|
2977
2669
|
color: "#005bd3",
|
|
2978
2670
|
height: 52,
|
|
2979
2671
|
width: 300
|
|
2980
2672
|
}),
|
|
2981
|
-
disableDowngrade:
|
|
2982
|
-
name:
|
|
2983
|
-
optionId:
|
|
2984
|
-
popover:
|
|
2985
|
-
alignment:
|
|
2986
|
-
position:
|
|
2673
|
+
disableDowngrade: z28.boolean().default(false),
|
|
2674
|
+
name: z28.string().optional(),
|
|
2675
|
+
optionId: z28.number().optional(),
|
|
2676
|
+
popover: z28.object({
|
|
2677
|
+
alignment: z28.enum(textAlignments).default(TextAlignment.center),
|
|
2678
|
+
position: z28.enum(popoverPositions).default(PopoverPosition.blockStart)
|
|
2987
2679
|
}).optional().default(() => ({
|
|
2988
2680
|
alignment: TextAlignment.center,
|
|
2989
2681
|
position: PopoverPosition.blockStart
|
|
2990
2682
|
})),
|
|
2991
|
-
sectionId:
|
|
2992
|
-
sections:
|
|
2993
|
-
sectionType:
|
|
2683
|
+
sectionId: z28.uuid().default(() => uuidv73()),
|
|
2684
|
+
sections: z28.union([z28.array(CABButtonContent), z28.strictObject({}).transform(() => [])]).default(() => []),
|
|
2685
|
+
sectionType: z28.literal(SectionType.button).default(SectionType.button),
|
|
2994
2686
|
/**
|
|
2995
2687
|
* The smart-cart tier this button acts on (`addGift`/`removeGift`): scopes the click to one tier's gift. The
|
|
2996
2688
|
* client resolves the tier's gift (productId) from the progress-bar context by this `tierId` — the button node
|
|
@@ -3005,91 +2697,91 @@ var CABButtonSection = z44.object({
|
|
|
3005
2697
|
* lookup finds no tier and the click resolves to nothing. Safe to bound — the field is new, so there are no
|
|
3006
2698
|
* stored payloads to grandfather, and the producer is client code, not a merchant form.
|
|
3007
2699
|
*/
|
|
3008
|
-
tier:
|
|
2700
|
+
tier: z28.object({ tierId: z28.string().min(1) }).optional(),
|
|
3009
2701
|
/** Fire-and-forget pixel POSTed when the button is clicked (e.g. a Monetize decline). */
|
|
3010
|
-
trackingUrl:
|
|
2702
|
+
trackingUrl: z28.string().optional(),
|
|
3011
2703
|
/**
|
|
3012
2704
|
* Secondary effects applied to in-scope variables on click, alongside (never instead of) the primary
|
|
3013
2705
|
* `action` — an `addToOrder` button can also flip a variable. Applied in array order.
|
|
3014
2706
|
*/
|
|
3015
|
-
variableEffects:
|
|
2707
|
+
variableEffects: z28.array(CABVariableEffect).optional()
|
|
3016
2708
|
});
|
|
3017
2709
|
|
|
3018
2710
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3019
|
-
import { z as
|
|
2711
|
+
import { z as z33 } from "zod";
|
|
3020
2712
|
|
|
3021
2713
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3022
|
-
import { z as
|
|
2714
|
+
import { z as z32 } from "zod";
|
|
3023
2715
|
|
|
3024
2716
|
// src/schema/widgets/checkout-and-beyond/dataSource.ts
|
|
3025
2717
|
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:
|
|
2718
|
+
import { z as z29 } from "zod";
|
|
2719
|
+
var CABDiscount = z29.object({
|
|
2720
|
+
amount: z29.union([z29.number(), z29.string()]).catch(0),
|
|
2721
|
+
discountedBy: z29.string().optional(),
|
|
2722
|
+
discountedFrom: z29.enum(discountSources).optional().catch(void 0),
|
|
2723
|
+
type: z29.enum(discountTypes).catch("none")
|
|
2724
|
+
});
|
|
2725
|
+
var CABIntegrations = z29.object({
|
|
2726
|
+
judgeme: z29.boolean().default(false),
|
|
2727
|
+
junip: z29.boolean().default(false),
|
|
2728
|
+
klaviyo: z29.boolean().default(false),
|
|
2729
|
+
loox: z29.boolean().default(false),
|
|
2730
|
+
okendo: z29.boolean().default(false),
|
|
2731
|
+
opinew: z29.boolean().default(false),
|
|
2732
|
+
reviewsio: z29.boolean().default(false),
|
|
2733
|
+
stamped: z29.boolean().default(false),
|
|
2734
|
+
yotpo: z29.boolean().default(false)
|
|
2735
|
+
});
|
|
2736
|
+
var CABDataSourceSection = z29.object({
|
|
2737
|
+
dataSourceId: z29.number().nullable().default(null),
|
|
2738
|
+
dataSourcePath: z29.string().default(DEFAULT_ENDPOINTS[0].value),
|
|
3047
2739
|
discount: CABDiscount.optional(),
|
|
3048
2740
|
integrations: CABIntegrations.optional(),
|
|
3049
|
-
limit:
|
|
3050
|
-
matchVariant:
|
|
3051
|
-
matchVariantOutOfStock:
|
|
3052
|
-
name:
|
|
3053
|
-
productType:
|
|
3054
|
-
sectionId:
|
|
3055
|
-
sectionType:
|
|
2741
|
+
limit: z29.number().default(1),
|
|
2742
|
+
matchVariant: z29.boolean().default(false),
|
|
2743
|
+
matchVariantOutOfStock: z29.boolean().default(false),
|
|
2744
|
+
name: z29.string().default(DEFAULT_ENDPOINTS[0].label),
|
|
2745
|
+
productType: z29.enum(productTypes).optional(),
|
|
2746
|
+
sectionId: z29.uuid().default(() => uuidv74()),
|
|
2747
|
+
sectionType: z29.literal(SectionType.dataSource).default(SectionType.dataSource),
|
|
3056
2748
|
/** Default subscribe-vs-one-time for `productType: both` (legacy `subscription_is_default`). */
|
|
3057
|
-
subscriptionIsDefault:
|
|
3058
|
-
treatAsGwp:
|
|
2749
|
+
subscriptionIsDefault: z29.boolean().default(false),
|
|
2750
|
+
treatAsGwp: z29.boolean().default(false)
|
|
3059
2751
|
});
|
|
3060
2752
|
|
|
3061
2753
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3062
2754
|
import { v7 as uuidv76 } from "uuid";
|
|
3063
|
-
import { z as
|
|
2755
|
+
import { z as z31 } from "zod";
|
|
3064
2756
|
|
|
3065
2757
|
// src/schema/widgets/checkout-and-beyond/product.ts
|
|
3066
2758
|
import { v7 as uuidv75 } from "uuid";
|
|
3067
|
-
import { z as
|
|
3068
|
-
var CABVariantContent =
|
|
3069
|
-
() =>
|
|
2759
|
+
import { z as z30 } from "zod";
|
|
2760
|
+
var CABVariantContent = z30.lazy(
|
|
2761
|
+
() => z30.discriminatedUnion("sectionType", [CABButtonSection, CABTextSection])
|
|
3070
2762
|
);
|
|
3071
|
-
var CABProductSection =
|
|
2763
|
+
var CABProductSection = z30.object({
|
|
3072
2764
|
...CABVariableFields,
|
|
3073
|
-
name:
|
|
3074
|
-
productId:
|
|
3075
|
-
sectionId:
|
|
3076
|
-
sections:
|
|
3077
|
-
sectionType:
|
|
3078
|
-
selectors:
|
|
3079
|
-
variantMode:
|
|
2765
|
+
name: z30.string().optional(),
|
|
2766
|
+
productId: z30.number().nullable().default(null),
|
|
2767
|
+
sectionId: z30.uuid().default(() => uuidv75()),
|
|
2768
|
+
sections: z30.union([z30.array(CABVariantContent), z30.strictObject({}).transform(() => [])]).default(() => []),
|
|
2769
|
+
sectionType: z30.literal(SectionType.product).default(SectionType.product),
|
|
2770
|
+
selectors: z30.record(z30.string(), z30.enum(variantSelectors).default(VariantSelector.menu)).default(() => ({})),
|
|
2771
|
+
variantMode: z30.enum(variantModes).default(VariantMode.multiple)
|
|
3080
2772
|
});
|
|
3081
2773
|
|
|
3082
2774
|
// src/schema/widgets/checkout-and-beyond/products.ts
|
|
3083
|
-
var CABProductsSection =
|
|
2775
|
+
var CABProductsSection = z31.object({
|
|
3084
2776
|
...CABVariableFields,
|
|
3085
|
-
name:
|
|
3086
|
-
sectionId:
|
|
3087
|
-
sections:
|
|
3088
|
-
sectionType:
|
|
2777
|
+
name: z31.string().optional(),
|
|
2778
|
+
sectionId: z31.uuid().default(() => uuidv76()),
|
|
2779
|
+
sections: z31.union([z31.array(z31.lazy(() => CABProductSection)), z31.strictObject({}).transform(() => [])]).default(() => []),
|
|
2780
|
+
sectionType: z31.literal(SectionType.products).default(SectionType.products)
|
|
3089
2781
|
});
|
|
3090
2782
|
|
|
3091
2783
|
// src/schema/widgets/checkout-and-beyond/offers.ts
|
|
3092
|
-
var CABOffersSection =
|
|
2784
|
+
var CABOffersSection = z32.lazy(
|
|
3093
2785
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3094
2786
|
/**
|
|
3095
2787
|
* A rule between consecutive cards in the vertical list — legacy checkout-offers' `<Divider />`,
|
|
@@ -3097,8 +2789,8 @@ var CABOffersSection = z48.lazy(
|
|
|
3097
2789
|
* run of products). Optional, not defaulted: only the v1 converter sets it (REB-24265); a
|
|
3098
2790
|
* hand-built tree keeps React CAB's dividerless rendering.
|
|
3099
2791
|
*/
|
|
3100
|
-
divider:
|
|
3101
|
-
sections:
|
|
2792
|
+
divider: z32.boolean().optional(),
|
|
2793
|
+
sections: z32.union([z32.array(z32.lazy(() => CABSection)), z32.strictObject({}).transform(() => [])]).default(() => [
|
|
3102
2794
|
CABBannerSection.parse({
|
|
3103
2795
|
buttonField: "undoAddToOrder",
|
|
3104
2796
|
color: "success",
|
|
@@ -3112,77 +2804,77 @@ var CABOffersSection = z48.lazy(
|
|
|
3112
2804
|
CABDataSourceSection.parse({}),
|
|
3113
2805
|
CABProductsSection.parse({})
|
|
3114
2806
|
]),
|
|
3115
|
-
sectionType:
|
|
2807
|
+
sectionType: z32.literal(SectionType.offers).default(SectionType.offers)
|
|
3116
2808
|
})
|
|
3117
2809
|
);
|
|
3118
2810
|
|
|
3119
2811
|
// src/schema/widgets/checkout-and-beyond/carousel.ts
|
|
3120
|
-
var CABCarouselSection =
|
|
2812
|
+
var CABCarouselSection = z33.lazy(
|
|
3121
2813
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3122
|
-
autoAdvanceInterval:
|
|
3123
|
-
itemsAtOnce:
|
|
2814
|
+
autoAdvanceInterval: z33.number().default(0),
|
|
2815
|
+
itemsAtOnce: z33.number().min(1).default(1),
|
|
3124
2816
|
/** Card arrangement for the offers child (`horizontal` = side-by-side) — NOT the carousel's own `direction`. */
|
|
3125
|
-
offersDirection:
|
|
3126
|
-
sections:
|
|
3127
|
-
sectionType:
|
|
2817
|
+
offersDirection: z33.enum(offersDirections).default("vertical"),
|
|
2818
|
+
sections: z33.union([z33.array(z33.lazy(() => CABSection)), z33.strictObject({}).transform(() => [])]).default(() => [CABOffersSection.parse({})]),
|
|
2819
|
+
sectionType: z33.literal(SectionType.carousel).default(SectionType.carousel)
|
|
3128
2820
|
})
|
|
3129
2821
|
);
|
|
3130
2822
|
|
|
3131
2823
|
// src/schema/widgets/checkout-and-beyond/cartLine.ts
|
|
3132
|
-
import { z as
|
|
3133
|
-
var CABCartLineSection =
|
|
2824
|
+
import { z as z34 } from "zod";
|
|
2825
|
+
var CABCartLineSection = z34.lazy(
|
|
3134
2826
|
() => CABLayoutSection.omit({ sections: true, sectionType: true }).extend({
|
|
3135
|
-
sections:
|
|
3136
|
-
sectionType:
|
|
2827
|
+
sections: z34.union([z34.array(z34.lazy(() => CABSection)), z34.strictObject({}).transform(() => [])]).default(() => [CABButtonSection.parse({ action: ButtonAction.switchToSubscription })]),
|
|
2828
|
+
sectionType: z34.literal(SectionType.cartLine).default(SectionType.cartLine)
|
|
3137
2829
|
})
|
|
3138
2830
|
);
|
|
3139
2831
|
|
|
3140
2832
|
// src/schema/widgets/checkout-and-beyond/discount.ts
|
|
3141
2833
|
import { v7 as uuidv77 } from "uuid";
|
|
3142
|
-
import { z as
|
|
3143
|
-
var CABDiscountSection =
|
|
2834
|
+
import { z as z35 } from "zod";
|
|
2835
|
+
var CABDiscountSection = z35.object({
|
|
3144
2836
|
...CABVariableFields,
|
|
3145
|
-
amount:
|
|
3146
|
-
discountedBy:
|
|
3147
|
-
discountedFrom:
|
|
3148
|
-
message:
|
|
3149
|
-
name:
|
|
3150
|
-
quantity:
|
|
3151
|
-
sectionId:
|
|
3152
|
-
sectionType:
|
|
3153
|
-
type:
|
|
2837
|
+
amount: z35.union([z35.number(), z35.string()]).catch(0),
|
|
2838
|
+
discountedBy: z35.string().optional(),
|
|
2839
|
+
discountedFrom: z35.enum(discountSources).optional().catch(void 0),
|
|
2840
|
+
message: z35.string().optional(),
|
|
2841
|
+
name: z35.string().optional(),
|
|
2842
|
+
quantity: z35.number().default(1),
|
|
2843
|
+
sectionId: z35.uuid().default(() => uuidv77()),
|
|
2844
|
+
sectionType: z35.literal(SectionType.discount).default(SectionType.discount),
|
|
2845
|
+
type: z35.enum(discountTypes).catch("none")
|
|
3154
2846
|
});
|
|
3155
2847
|
|
|
3156
2848
|
// src/schema/widgets/checkout-and-beyond/monetize.ts
|
|
3157
2849
|
import { v7 as uuidv78 } from "uuid";
|
|
3158
|
-
import { z as
|
|
3159
|
-
var CABMonetizeAds =
|
|
3160
|
-
requestId:
|
|
2850
|
+
import { z as z36 } from "zod";
|
|
2851
|
+
var CABMonetizeAds = z36.object({
|
|
2852
|
+
requestId: z36.string().optional(),
|
|
3161
2853
|
/** Defaulted here, never in the beacon: absence of information is `ads` itself being absent. */
|
|
3162
|
-
testing:
|
|
2854
|
+
testing: z36.boolean().default(false)
|
|
3163
2855
|
});
|
|
3164
|
-
var CABMonetizeSection =
|
|
2856
|
+
var CABMonetizeSection = z36.object({
|
|
3165
2857
|
...CABVariableFields,
|
|
3166
2858
|
ads: CABMonetizeAds.optional(),
|
|
3167
|
-
name:
|
|
2859
|
+
name: z36.string().optional(),
|
|
3168
2860
|
/**
|
|
3169
2861
|
* Server-hydrated offer cards (inline hydration): when `/cab/sections` was asked with a `monetize`
|
|
3170
2862
|
* context block, the composed cards ride the marker itself — `[]` means "hydrated, no fill" (render
|
|
3171
2863
|
* nothing, skip the fetch); ABSENT means "not hydrated" (the client fetches via `/cab/monetize`).
|
|
3172
2864
|
*/
|
|
3173
|
-
offers:
|
|
2865
|
+
offers: z36.array(z36.lazy(() => CABSection)).optional(),
|
|
3174
2866
|
/** 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:
|
|
2867
|
+
privacyPolicyUrl: z36.string().optional(),
|
|
2868
|
+
sectionId: z36.uuid().default(() => uuidv78()),
|
|
2869
|
+
sectionType: z36.literal(SectionType.monetize).default(SectionType.monetize),
|
|
3178
2870
|
/** Ads-taxonomy sub-vertical id (the widget's `sub_vertical` setting); paired with `vertical`. */
|
|
3179
|
-
subVertical:
|
|
2871
|
+
subVertical: z36.string().optional(),
|
|
3180
2872
|
/** Ads-taxonomy vertical id (the widget's `vertical` setting) — with `subVertical`, the admin Monetize editor's two configurables. */
|
|
3181
|
-
vertical:
|
|
2873
|
+
vertical: z36.string().optional()
|
|
3182
2874
|
});
|
|
3183
2875
|
|
|
3184
2876
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3185
|
-
import { z as
|
|
2877
|
+
import { z as z37 } from "zod";
|
|
3186
2878
|
|
|
3187
2879
|
// src/schema/widgets/checkout-and-beyond/giftLabels.ts
|
|
3188
2880
|
var GIFT_LABELS = {
|
|
@@ -3301,34 +2993,34 @@ var GIFT_LABELS = {
|
|
|
3301
2993
|
};
|
|
3302
2994
|
|
|
3303
2995
|
// src/schema/widgets/checkout-and-beyond/progressBar.ts
|
|
3304
|
-
var CABProgressTierExclusion =
|
|
3305
|
-
collectionIds:
|
|
3306
|
-
productIds:
|
|
3307
|
-
tags:
|
|
3308
|
-
type:
|
|
2996
|
+
var CABProgressTierExclusion = z37.object({
|
|
2997
|
+
collectionIds: z37.array(z37.number().int().positive()).default(() => []),
|
|
2998
|
+
productIds: z37.array(z37.number().int().positive()).default(() => []),
|
|
2999
|
+
tags: z37.array(z37.string().min(1)).default(() => []),
|
|
3000
|
+
type: z37.enum(progressTierExclusionTypes)
|
|
3309
3001
|
});
|
|
3310
|
-
var CABProgressTier =
|
|
3002
|
+
var CABProgressTier = z37.object({
|
|
3311
3003
|
/**
|
|
3312
3004
|
* Order-discount tiers only (onsite `discount`): the reward the order-discount Function applies at
|
|
3313
3005
|
* cart time, carried so the client can resolve the `{{discountAmount}}` token in this tier's copy.
|
|
3314
3006
|
* `fixedAmount`: shop-currency CENTS (FX-scaled by the client, like {@link CABProgressTier.threshold});
|
|
3315
3007
|
* `percentage`: the whole-percent number rendered raw (`{n}%`). Absent on non-discount tiers.
|
|
3316
3008
|
*/
|
|
3317
|
-
discount:
|
|
3009
|
+
discount: z37.object({ amount: z37.number().nonnegative(), type: z37.enum(["fixedAmount", "percentage"]) }).optional(),
|
|
3318
3010
|
/**
|
|
3319
3011
|
* Per-tier exclusion rules (onsite `exclusions` when `exclusions_enabled`): lines they match don't count
|
|
3320
3012
|
* toward this tier. Empty (the default, and the converter's output for a disabled or ruleless tier) means
|
|
3321
3013
|
* the tier measures the plain bar-level adjusted progress. Consumers read ONLY the list named by the rule's
|
|
3322
3014
|
* `type` — the converter leaves the other two at `[]`, so a populated off-type list never reaches the tree.
|
|
3323
3015
|
*/
|
|
3324
|
-
exclusions:
|
|
3016
|
+
exclusions: z37.array(CABProgressTierExclusion).default(() => []),
|
|
3325
3017
|
/**
|
|
3326
3018
|
* Smart-cart product (gift) tiers only (onsite `filter_oos_variants`): when set, the client drops this
|
|
3327
3019
|
* tier entirely once its gift has NO in-stock eligible variant — the milestone, fill slot and gift
|
|
3328
3020
|
* controls all disappear, mirroring onsite removing the tier from `bar.tiers` before it renders. Absent
|
|
3329
3021
|
* on shipping/discount/decorative tiers and left off by default (the tier renders regardless of stock).
|
|
3330
3022
|
*/
|
|
3331
|
-
filterOosVariants:
|
|
3023
|
+
filterOosVariants: z37.boolean().default(false),
|
|
3332
3024
|
/**
|
|
3333
3025
|
* Smart-cart product (gift) tiers only: the reward unlocked at this tier. The client enriches
|
|
3334
3026
|
* `productId`/`variantIds` to live variants (availability, price) and adds the chosen one to the cart
|
|
@@ -3336,10 +3028,10 @@ var CABProgressTier = z53.object({
|
|
|
3336
3028
|
* tiers and on tiers with no configured product. Cart add/remove is a later stage; carried here so the
|
|
3337
3029
|
* tree is complete.
|
|
3338
3030
|
*/
|
|
3339
|
-
gift:
|
|
3340
|
-
productId:
|
|
3341
|
-
title:
|
|
3342
|
-
variantIds:
|
|
3031
|
+
gift: z37.object({
|
|
3032
|
+
productId: z37.number().int().positive(),
|
|
3033
|
+
title: z37.string().optional(),
|
|
3034
|
+
variantIds: z37.array(z37.number().int().positive()).default(() => [])
|
|
3343
3035
|
}).optional(),
|
|
3344
3036
|
/**
|
|
3345
3037
|
* The step-row icon's square size in PIXELS (onsite `product_tier_element_size`, an admin px string the
|
|
@@ -3359,7 +3051,7 @@ var CABProgressTier = z53.object({
|
|
|
3359
3051
|
* renderer never spells a fallback), which also makes a tree authored before this field render at
|
|
3360
3052
|
* React's size rather than the old hardcoded 20.
|
|
3361
3053
|
*/
|
|
3362
|
-
iconSizePx:
|
|
3054
|
+
iconSizePx: z37.number().int().min(1).max(64).default(18),
|
|
3363
3055
|
/**
|
|
3364
3056
|
* The step-row label at this tier's slot (onsite `getTierLabel`): the merchant custom label, else the
|
|
3365
3057
|
* type default — 'Free Shipping' or '{n}% Discount'. A PRODUCT tier gets NO converter label: its name is
|
|
@@ -3369,35 +3061,35 @@ var CABProgressTier = z53.object({
|
|
|
3369
3061
|
* turns a blank label into an absent key, and a client-authored blank means the same thing — the renderer
|
|
3370
3062
|
* emits no caption slot rather than an empty one). Plain text — a compact icon+label.
|
|
3371
3063
|
*/
|
|
3372
|
-
label:
|
|
3064
|
+
label: z37.record(z37.string(), z37.string()).optional(),
|
|
3373
3065
|
/**
|
|
3374
3066
|
* Smart-cart product (gift) tiers only (onsite `product_tier_image`): show the gift's product image in
|
|
3375
3067
|
* the step-row slot instead of the generic bag icon. The converter can't supply the image URL (config
|
|
3376
3068
|
* carries only product IDs), so the client resolves it (authoritative Shopify featured image, React
|
|
3377
3069
|
* parity) and falls back to the bag icon when the flag is off or no image resolves. Default false.
|
|
3378
3070
|
*/
|
|
3379
|
-
productTierImage:
|
|
3071
|
+
productTierImage: z37.boolean().default(false),
|
|
3380
3072
|
/**
|
|
3381
3073
|
* The tier's goal, measured per `unit`. `currency` (default): SHOP-currency cents — the canonical
|
|
3382
3074
|
* fallback: when the buyer's presentment currency has no entry in `thresholds`, the client
|
|
3383
3075
|
* multiplies this by the live FX rate (converter maps the v1 `unlock_price`, e.g. `75` → `7500`).
|
|
3384
3076
|
* `item`: a raw item count — no cents, no FX, no `thresholds` overrides.
|
|
3385
3077
|
*/
|
|
3386
|
-
threshold:
|
|
3078
|
+
threshold: z37.number().int().nonnegative(),
|
|
3387
3079
|
/**
|
|
3388
3080
|
* Per-presentment-currency goal overrides — lowercased ISO currency code → cents (e.g. `{ cad: 9900 }`).
|
|
3389
3081
|
* When the buyer's currency has an entry, the client uses it verbatim INSTEAD of FX-converting
|
|
3390
3082
|
* `threshold`, so merchants show intentional, clean per-market amounts (Shopify Markets) rather than a
|
|
3391
3083
|
* converted base. Defaults to `{}` — no overrides means always fall back to `threshold`.
|
|
3392
3084
|
*/
|
|
3393
|
-
thresholds:
|
|
3085
|
+
thresholds: z37.record(z37.string(), z37.number().int().nonnegative()).default(() => ({})),
|
|
3394
3086
|
/**
|
|
3395
3087
|
* Smart-cart tier identifier, mirrored onto the gift cart line's `_tier` attribute so the client can
|
|
3396
3088
|
* match an in-cart gift back to its tier (add on reach, remove on downgrade/decline). Absent on the
|
|
3397
3089
|
* shipping bar (single unlabeled tier, no gift).
|
|
3398
3090
|
*/
|
|
3399
|
-
tierId:
|
|
3400
|
-
tierType:
|
|
3091
|
+
tierId: z37.string().optional(),
|
|
3092
|
+
tierType: z37.enum(progressTierTypes).default(ProgressTierType.shipping),
|
|
3401
3093
|
/**
|
|
3402
3094
|
* What this tier's progress is measured in — PER TIER (onsite's `unlock_condition_type` model, NOT
|
|
3403
3095
|
* the React port's bar-level `tiers[0]` shortcut). `currency` compares money cents against the
|
|
@@ -3408,9 +3100,9 @@ var CABProgressTier = z53.object({
|
|
|
3408
3100
|
* count carries no injected noun (no English `item`/`items` inflection on localized copy); merchant
|
|
3409
3101
|
* template text supplies grammatically-neutral wording around the token.
|
|
3410
3102
|
*/
|
|
3411
|
-
unit:
|
|
3103
|
+
unit: z37.enum(progressTierUnits).default(ProgressTierUnit.currency)
|
|
3412
3104
|
});
|
|
3413
|
-
var CABProgressBarSection =
|
|
3105
|
+
var CABProgressBarSection = z37.lazy(
|
|
3414
3106
|
() => CABLayoutSection.omit({ sectionType: true }).extend({
|
|
3415
3107
|
/**
|
|
3416
3108
|
* The onsite bar id (smart-cart TPB bars only). The client mirrors it to the cart's `_barId` attribute
|
|
@@ -3419,35 +3111,35 @@ var CABProgressBarSection = z53.lazy(
|
|
|
3419
3111
|
* checkout reaches the extension without it, so the client writes it or the tier gift's 100% discount
|
|
3420
3112
|
* (and any tier order discount) never applies. Absent on the v1 shipping bar (no gift tiers, no id).
|
|
3421
3113
|
*/
|
|
3422
|
-
barId:
|
|
3114
|
+
barId: z37.string().optional(),
|
|
3423
3115
|
/** Empty = shown everywhere; otherwise uppercase ISO country codes. */
|
|
3424
|
-
countryCodes:
|
|
3116
|
+
countryCodes: z37.array(z37.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3425
3117
|
/**
|
|
3426
3118
|
* Uppercase ISO codes where a higher-precedence geo bar applies, so this (default, non-geo) bar is
|
|
3427
3119
|
* hidden there — replicates React `getbar`'s geo-match-over-default precedence. Empty = never excluded.
|
|
3428
3120
|
*/
|
|
3429
|
-
excludeCountryCodes:
|
|
3121
|
+
excludeCountryCodes: z37.array(z37.string().transform((code) => code.trim().toUpperCase())).default(() => []),
|
|
3430
3122
|
/**
|
|
3431
3123
|
* Measure progress against the PRE-discount subtotal (onsite `exclude_discount_in_subtotal`, and
|
|
3432
3124
|
* forced on for bars with a discount tier so its own reward can't un-reach the tier). The client
|
|
3433
3125
|
* adds the cart's discount allocations back to the live subtotal.
|
|
3434
3126
|
*/
|
|
3435
|
-
excludeDiscountInSubtotal:
|
|
3127
|
+
excludeDiscountInSubtotal: z37.boolean().default(false),
|
|
3436
3128
|
/** Variant ids the client subtracts from the adjusted subtotal (React `bar.excluded_products`). */
|
|
3437
|
-
excludedVariantIds:
|
|
3129
|
+
excludedVariantIds: z37.array(z37.number().int().positive()).default(() => []),
|
|
3438
3130
|
/**
|
|
3439
3131
|
* When the cart holds a subscription item, treat the bar as reached regardless of subtotal (React
|
|
3440
3132
|
* `free_shipping_on_subscription(s)`). `freeShippingOnAll` is already a zero-threshold tier instead.
|
|
3441
3133
|
*/
|
|
3442
|
-
freeShippingOnSubscription:
|
|
3134
|
+
freeShippingOnSubscription: z37.boolean().default(false),
|
|
3443
3135
|
/** Localized heading over the gift controls (onsite `gift_area_title`, default 'FREE GIFTS'). */
|
|
3444
|
-
giftAreaTitle:
|
|
3136
|
+
giftAreaTitle: z37.record(z37.string(), z37.string()).default(() => ({ en: "FREE GIFTS" })),
|
|
3445
3137
|
/** Localized gift-control labels (add/remove/heading); a tier's gift `title` beats `yourGift`. */
|
|
3446
|
-
giftLabels:
|
|
3447
|
-
addGift:
|
|
3448
|
-
remove:
|
|
3449
|
-
selectOptions:
|
|
3450
|
-
yourGift:
|
|
3138
|
+
giftLabels: z37.object({
|
|
3139
|
+
addGift: z37.record(z37.string(), z37.string()).default(() => ({ ...GIFT_LABELS.addGift })),
|
|
3140
|
+
remove: z37.record(z37.string(), z37.string()).default(() => ({ ...GIFT_LABELS.remove })),
|
|
3141
|
+
selectOptions: z37.record(z37.string(), z37.string()).default(() => ({ ...GIFT_LABELS.selectOptions })),
|
|
3142
|
+
yourGift: z37.record(z37.string(), z37.string()).default(() => ({ ...GIFT_LABELS.yourGift }))
|
|
3451
3143
|
}).default(() => ({
|
|
3452
3144
|
addGift: { ...GIFT_LABELS.addGift },
|
|
3453
3145
|
remove: { ...GIFT_LABELS.remove },
|
|
@@ -3455,38 +3147,38 @@ var CABProgressBarSection = z53.lazy(
|
|
|
3455
3147
|
yourGift: { ...GIFT_LABELS.yourGift }
|
|
3456
3148
|
})),
|
|
3457
3149
|
/** The bar's a11y label; the merchant names it in the editor, else this default (React parity). */
|
|
3458
|
-
name:
|
|
3150
|
+
name: z37.string().default("Order progress"),
|
|
3459
3151
|
/**
|
|
3460
3152
|
* Bar fill color. An explicit (widget-authored) value is used verbatim; when absent the server
|
|
3461
3153
|
* fills it with the live shop theme's `buttonBackground` (React `useRebuyTheme` parity). Still
|
|
3462
3154
|
* absent after that ⇒ the theme fetch failed and the client renders its platform-default bar —
|
|
3463
3155
|
* optional, not defaulted, so "merchant chose no color" stays distinguishable from any real value.
|
|
3464
3156
|
*/
|
|
3465
|
-
progressColor:
|
|
3466
|
-
sectionType:
|
|
3157
|
+
progressColor: z37.string().optional(),
|
|
3158
|
+
sectionType: z37.literal(SectionType.progressBar).default(SectionType.progressBar),
|
|
3467
3159
|
/**
|
|
3468
3160
|
* The bar's milestones in the merchant's CONFIGURED order — the renderer does NOT sort them (022
|
|
3469
3161
|
* O-B2: sorting by resolved threshold reversed configured milestones on out-of-order or mixed-unit
|
|
3470
3162
|
* count-vs-cents bars). Drives the fill (even slot per tier) and, for smart-cart product tiers, the
|
|
3471
3163
|
* gift add/remove. The visual tier display lives in `sections` (composable), NOT here.
|
|
3472
3164
|
*/
|
|
3473
|
-
tiers:
|
|
3165
|
+
tiers: z37.union([z37.array(CABProgressTier), z37.strictObject({}).transform(() => [])]).default(() => [])
|
|
3474
3166
|
})
|
|
3475
3167
|
);
|
|
3476
3168
|
|
|
3477
3169
|
// src/schema/widgets/checkout-and-beyond/quantity.ts
|
|
3478
3170
|
import { v7 as uuidv79 } from "uuid";
|
|
3479
|
-
import { z as
|
|
3480
|
-
var CABQuantitySection =
|
|
3171
|
+
import { z as z38 } from "zod";
|
|
3172
|
+
var CABQuantitySection = z38.object({
|
|
3481
3173
|
...CABVariableFields,
|
|
3482
|
-
errorMessages:
|
|
3483
|
-
|
|
3484
|
-
|
|
3174
|
+
errorMessages: z38.record(
|
|
3175
|
+
z38.string(),
|
|
3176
|
+
z38.object({
|
|
3485
3177
|
/** `{{step}}` is interpolated at render — the off-increment message React never gave a merchant key. */
|
|
3486
|
-
increment:
|
|
3487
|
-
max:
|
|
3488
|
-
min:
|
|
3489
|
-
neg:
|
|
3178
|
+
increment: z38.string().optional(),
|
|
3179
|
+
max: z38.string().optional(),
|
|
3180
|
+
min: z38.string().optional(),
|
|
3181
|
+
neg: z38.string().optional()
|
|
3490
3182
|
})
|
|
3491
3183
|
).default({
|
|
3492
3184
|
en: {
|
|
@@ -3496,18 +3188,18 @@ var CABQuantitySection = z54.object({
|
|
|
3496
3188
|
neg: "Quantity cannot be negative"
|
|
3497
3189
|
}
|
|
3498
3190
|
}),
|
|
3499
|
-
inputType:
|
|
3500
|
-
max:
|
|
3501
|
-
min:
|
|
3191
|
+
inputType: z38.enum(quantityInputs).default(QuantityInput.select),
|
|
3192
|
+
max: z38.number().min(1).max(100).default(10),
|
|
3193
|
+
min: z38.number().min(1).default(1),
|
|
3502
3194
|
/** The a11y label for the quantity control; the merchant names it in the editor, else this default. */
|
|
3503
|
-
name:
|
|
3504
|
-
sectionId:
|
|
3505
|
-
sectionType:
|
|
3195
|
+
name: z38.string().default("Quantity"),
|
|
3196
|
+
sectionId: z38.uuid().default(() => uuidv79()),
|
|
3197
|
+
sectionType: z38.literal(SectionType.quantity).default(SectionType.quantity)
|
|
3506
3198
|
});
|
|
3507
3199
|
|
|
3508
3200
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3509
3201
|
import { v7 as uuidv710 } from "uuid";
|
|
3510
|
-
import { z as
|
|
3202
|
+
import { z as z39 } from "zod";
|
|
3511
3203
|
|
|
3512
3204
|
// src/schema/widgets/checkout-and-beyond/reviewLabels.ts
|
|
3513
3205
|
var REVIEW_LABELS = {
|
|
@@ -3570,68 +3262,68 @@ var REVIEW_LABELS = {
|
|
|
3570
3262
|
};
|
|
3571
3263
|
|
|
3572
3264
|
// src/schema/widgets/checkout-and-beyond/reviews.ts
|
|
3573
|
-
var CABReviewsSection =
|
|
3265
|
+
var CABReviewsSection = z39.object({
|
|
3574
3266
|
...CABVariableFields,
|
|
3575
|
-
color:
|
|
3267
|
+
color: z39.string().default("#fadb14"),
|
|
3576
3268
|
/**
|
|
3577
3269
|
* Localized review-count templates (`{{reviewCount}}`), one/other plural forms; the client picks the
|
|
3578
3270
|
* form via `Intl.PluralRules`. Defaults here (schema-first) so every tree localizes without converter
|
|
3579
3271
|
* or merchant work.
|
|
3580
3272
|
*/
|
|
3581
|
-
countLabels:
|
|
3582
|
-
one:
|
|
3583
|
-
other:
|
|
3273
|
+
countLabels: z39.object({
|
|
3274
|
+
one: z39.record(z39.string(), z39.string()).default(() => ({ ...REVIEW_LABELS.one })),
|
|
3275
|
+
other: z39.record(z39.string(), z39.string()).default(() => ({ ...REVIEW_LABELS.other }))
|
|
3584
3276
|
}).default(() => ({ one: { ...REVIEW_LABELS.one }, other: { ...REVIEW_LABELS.other } })),
|
|
3585
|
-
name:
|
|
3586
|
-
sectionId:
|
|
3587
|
-
sectionType:
|
|
3588
|
-
size:
|
|
3277
|
+
name: z39.string().optional(),
|
|
3278
|
+
sectionId: z39.uuid().default(() => uuidv710()),
|
|
3279
|
+
sectionType: z39.literal(SectionType.reviews).default(SectionType.reviews),
|
|
3280
|
+
size: z39.enum(reviewsSizes).default(ReviewsSize.default),
|
|
3589
3281
|
/**
|
|
3590
3282
|
* Star outline color, interpolated into a style by the renderer, so it is hex-constrained like
|
|
3591
3283
|
* `CABButtonSection.color`. The legacy source (`PostPurchaseSettings.styles.starStrokeColor`) is a free
|
|
3592
3284
|
* string: its converter must validate and fall back to this default rather than let one odd value drop
|
|
3593
3285
|
* the whole reviews section.
|
|
3594
3286
|
*/
|
|
3595
|
-
strokeColor:
|
|
3287
|
+
strokeColor: z39.string().regex(HEX_COLOR_REGEX).default("#fadb14"),
|
|
3596
3288
|
/** Star outline width in px; `0` draws no outline. The legacy `styles.strokeWidth` is a STRING ('1') — its converter coerces. */
|
|
3597
|
-
strokeWidth:
|
|
3289
|
+
strokeWidth: z39.number().nonnegative().default(0)
|
|
3598
3290
|
});
|
|
3599
3291
|
|
|
3600
3292
|
// src/schema/widgets/checkout-and-beyond/separator.ts
|
|
3601
3293
|
import { v7 as uuidv711 } from "uuid";
|
|
3602
|
-
import { z as
|
|
3603
|
-
var CABSeparatorSection =
|
|
3294
|
+
import { z as z40 } from "zod";
|
|
3295
|
+
var CABSeparatorSection = z40.object({
|
|
3604
3296
|
...CABVariableFields,
|
|
3605
|
-
sectionId:
|
|
3606
|
-
sectionType:
|
|
3297
|
+
sectionId: z40.uuid().default(() => uuidv711()),
|
|
3298
|
+
sectionType: z40.literal(SectionType.separator).default(SectionType.separator)
|
|
3607
3299
|
});
|
|
3608
3300
|
|
|
3609
3301
|
// src/schema/widgets/checkout-and-beyond/variants.ts
|
|
3610
3302
|
import { slice } from "es-toolkit/compat";
|
|
3611
3303
|
import { v7 as uuidv712 } from "uuid";
|
|
3612
|
-
import { z as
|
|
3613
|
-
var CABVariantsSection =
|
|
3304
|
+
import { z as z41 } from "zod";
|
|
3305
|
+
var CABVariantsSection = z41.object({
|
|
3614
3306
|
...CABVariableFields,
|
|
3615
|
-
hideOutOfStockVariants:
|
|
3616
|
-
name:
|
|
3617
|
-
sectionId:
|
|
3618
|
-
sectionType:
|
|
3619
|
-
selector:
|
|
3620
|
-
variantMode:
|
|
3307
|
+
hideOutOfStockVariants: z41.boolean().default(false),
|
|
3308
|
+
name: z41.string().optional(),
|
|
3309
|
+
sectionId: z41.uuid().default(() => uuidv712()),
|
|
3310
|
+
sectionType: z41.literal(SectionType.variants).default(SectionType.variants),
|
|
3311
|
+
selector: z41.enum(slice(variantSelectors, 0, 3)).default(VariantSelector.menu),
|
|
3312
|
+
variantMode: z41.enum(variantModes).default(VariantMode.multiple)
|
|
3621
3313
|
});
|
|
3622
3314
|
|
|
3623
3315
|
// src/schema/widgets/checkout-and-beyond/shared.ts
|
|
3624
|
-
var CABBorder =
|
|
3625
|
-
radius:
|
|
3626
|
-
style:
|
|
3627
|
-
width:
|
|
3316
|
+
var CABBorder = z42.object({
|
|
3317
|
+
radius: z42.enum(borderRadii).default(BorderRadius.base),
|
|
3318
|
+
style: z42.enum(borderStyles).default(BorderStyle.none),
|
|
3319
|
+
width: z42.enum(borderWidths).default(BorderWidth.base)
|
|
3628
3320
|
}).default({
|
|
3629
3321
|
radius: BorderRadius.base,
|
|
3630
3322
|
style: BorderStyle.none,
|
|
3631
3323
|
width: BorderWidth.base
|
|
3632
3324
|
});
|
|
3633
|
-
var CABSection =
|
|
3634
|
-
() =>
|
|
3325
|
+
var CABSection = z42.lazy(
|
|
3326
|
+
() => z42.discriminatedUnion("sectionType", [
|
|
3635
3327
|
CABBannerSection,
|
|
3636
3328
|
CABButtonSection,
|
|
3637
3329
|
CABCarouselSection,
|
|
@@ -3654,41 +3346,41 @@ var CABSection = z58.lazy(
|
|
|
3654
3346
|
);
|
|
3655
3347
|
|
|
3656
3348
|
// src/schema/widgets/checkout-and-beyond/layout.ts
|
|
3657
|
-
var GridItem =
|
|
3658
|
-
var CABLayoutWrapping =
|
|
3659
|
-
breakAt:
|
|
3660
|
-
maxPerLine:
|
|
3349
|
+
var GridItem = z43.union([z43.literal("auto"), z43.literal("fill"), z43.string().regex(/^\d+%$/), z43.number()]);
|
|
3350
|
+
var CABLayoutWrapping = z43.object({
|
|
3351
|
+
breakAt: z43.number().positive(),
|
|
3352
|
+
maxPerLine: z43.number().int().positive()
|
|
3661
3353
|
});
|
|
3662
|
-
var CABLayoutSection =
|
|
3354
|
+
var CABLayoutSection = z43.object({
|
|
3663
3355
|
...CABVariableFields,
|
|
3664
|
-
alignment:
|
|
3665
|
-
horizontal:
|
|
3666
|
-
vertical:
|
|
3356
|
+
alignment: z43.object({
|
|
3357
|
+
horizontal: z43.enum(horizontalAlignments).default(HorizontalAlignment.start),
|
|
3358
|
+
vertical: z43.enum(verticalAlignments).default(VerticalAlignment.top)
|
|
3667
3359
|
}).default({
|
|
3668
3360
|
horizontal: HorizontalAlignment.start,
|
|
3669
3361
|
vertical: VerticalAlignment.top
|
|
3670
3362
|
}),
|
|
3671
|
-
border:
|
|
3672
|
-
buttonField:
|
|
3673
|
-
direction:
|
|
3363
|
+
border: z43.lazy(() => CABBorder),
|
|
3364
|
+
buttonField: z43.enum(buttonFields).optional(),
|
|
3365
|
+
direction: z43.enum(directions).default(Direction.rows),
|
|
3674
3366
|
/**
|
|
3675
3367
|
* Platform chrome around the section, not a layout behavior: `callout` is a subdued box with block borders
|
|
3676
3368
|
* (the legacy post-purchase callout banner), `offer-content` the post-purchase offer's own content card.
|
|
3677
3369
|
*/
|
|
3678
|
-
frame:
|
|
3679
|
-
grid:
|
|
3680
|
-
columns:
|
|
3681
|
-
rows:
|
|
3370
|
+
frame: z43.enum(layoutFrames).optional(),
|
|
3371
|
+
grid: z43.object({
|
|
3372
|
+
columns: z43.union([z43.array(GridItem), z43.undefined()]).default(() => ["auto"]),
|
|
3373
|
+
rows: z43.union([z43.array(GridItem), z43.undefined()]).default(() => ["auto"])
|
|
3682
3374
|
}).default({ columns: ["auto"], rows: ["auto"] }).optional(),
|
|
3683
|
-
name:
|
|
3684
|
-
padding:
|
|
3685
|
-
sectionId:
|
|
3686
|
-
sections:
|
|
3687
|
-
sectionType:
|
|
3688
|
-
spacing:
|
|
3375
|
+
name: z43.string().optional(),
|
|
3376
|
+
padding: z43.enum(spacings).default(Spacing.none),
|
|
3377
|
+
sectionId: z43.uuid().default(() => uuidv713()),
|
|
3378
|
+
sections: z43.union([z43.array(z43.lazy(() => CABSection)), z43.strictObject({}).transform(() => [])]).default(() => []),
|
|
3379
|
+
sectionType: z43.literal(SectionType.layout).default(SectionType.layout),
|
|
3380
|
+
spacing: z43.enum(spacings).default(Spacing.base),
|
|
3689
3381
|
/** Fire-and-forget impression pixel POSTed once when the section is shown (e.g. a Monetize offer view). */
|
|
3690
|
-
viewUrl:
|
|
3691
|
-
width:
|
|
3382
|
+
viewUrl: z43.string().optional(),
|
|
3383
|
+
width: z43.number().default(100),
|
|
3692
3384
|
wrapping: CABLayoutWrapping.optional()
|
|
3693
3385
|
});
|
|
3694
3386
|
|
|
@@ -3710,8 +3402,8 @@ var UI_LABELS = {
|
|
|
3710
3402
|
};
|
|
3711
3403
|
|
|
3712
3404
|
// src/schema/widgets/checkout-and-beyond/root.ts
|
|
3713
|
-
var localized = (fallback) =>
|
|
3714
|
-
var CABUILabels =
|
|
3405
|
+
var localized = (fallback) => z44.record(z44.string(), z44.string()).default(() => ({ ...fallback })).transform((labels) => Object.keys(labels).length > 0 ? labels : { ...fallback });
|
|
3406
|
+
var CABUILabels = z44.object({
|
|
3715
3407
|
currentPage: localized(UI_LABELS.currentPage),
|
|
3716
3408
|
guest: localized(UI_LABELS.guest),
|
|
3717
3409
|
loadingOptions: localized(UI_LABELS.loadingOptions),
|
|
@@ -3736,154 +3428,645 @@ var CABUILabels = z60.object({
|
|
|
3736
3428
|
subscriptionOptions: { ...UI_LABELS.subscriptionOptions },
|
|
3737
3429
|
updating: { ...UI_LABELS.updating }
|
|
3738
3430
|
}));
|
|
3739
|
-
var TargetArea =
|
|
3740
|
-
fill:
|
|
3741
|
-
flip:
|
|
3742
|
-
icon:
|
|
3743
|
-
label:
|
|
3744
|
-
width:
|
|
3431
|
+
var TargetArea = z44.object({
|
|
3432
|
+
fill: z44.boolean().optional(),
|
|
3433
|
+
flip: z44.enum(["both", "horizontal", "vertical"]).optional(),
|
|
3434
|
+
icon: z44.string(),
|
|
3435
|
+
label: z44.string(),
|
|
3436
|
+
width: z44.string()
|
|
3745
3437
|
}).default(targetAreas[EditorMode.checkoutExtension][1]);
|
|
3746
|
-
var CABTracking =
|
|
3747
|
-
enableAttribution:
|
|
3748
|
-
enableSource:
|
|
3749
|
-
enableWidget:
|
|
3438
|
+
var CABTracking = z44.object({
|
|
3439
|
+
enableAttribution: z44.boolean().nullish().transform((value) => value ?? true),
|
|
3440
|
+
enableSource: z44.boolean().nullish().transform((value) => value ?? true),
|
|
3441
|
+
enableWidget: z44.boolean().nullish().transform((value) => value ?? true)
|
|
3750
3442
|
}).nullish().transform((value) => value ?? { enableAttribution: true, enableSource: true, enableWidget: true });
|
|
3751
|
-
var CABExperiment =
|
|
3752
|
-
elementId:
|
|
3753
|
-
experimentId:
|
|
3754
|
-
experimentType:
|
|
3755
|
-
selectedId:
|
|
3443
|
+
var CABExperiment = z44.object({
|
|
3444
|
+
elementId: z44.number(),
|
|
3445
|
+
experimentId: z44.number(),
|
|
3446
|
+
experimentType: z44.string(),
|
|
3447
|
+
selectedId: z44.number()
|
|
3756
3448
|
});
|
|
3757
3449
|
var CABRootSection = CABLayoutSection.extend({
|
|
3758
|
-
editorMode:
|
|
3450
|
+
editorMode: z44.enum(editorModes).default(EditorMode.checkoutExtension),
|
|
3759
3451
|
experiment: CABExperiment.optional(),
|
|
3760
3452
|
// Same rule as CABTracking above: the v1 converters pass raw legacy `previewMode` through, so a
|
|
3761
3453
|
// `null` must fall back rather than throw the widget; malformed values still throw.
|
|
3762
|
-
previewMode:
|
|
3763
|
-
storeId:
|
|
3454
|
+
previewMode: z44.boolean().nullish().transform((value) => value ?? false),
|
|
3455
|
+
storeId: z44.number().nullable().default(null),
|
|
3764
3456
|
targetArea: TargetArea.nullable(),
|
|
3765
3457
|
tracking: CABTracking,
|
|
3766
|
-
type:
|
|
3458
|
+
type: z44.enum(widgetTypes).default(WidgetType.ui_extension_content_block),
|
|
3767
3459
|
uiLabels: CABUILabels,
|
|
3768
|
-
version:
|
|
3769
|
-
widgetId:
|
|
3460
|
+
version: z44.literal(2).default(2),
|
|
3461
|
+
widgetId: z44.number().nullable().default(null)
|
|
3462
|
+
});
|
|
3463
|
+
|
|
3464
|
+
// src/schema/postPurchaseProductView.ts
|
|
3465
|
+
var PostPurchaseProductView = z45.union([
|
|
3466
|
+
z45.object({
|
|
3467
|
+
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
3468
|
+
initialVariant: PostPurchaseVariantSelector.optional(),
|
|
3469
|
+
planCatalog: PostPurchasePlanCatalog.nullable().optional(),
|
|
3470
|
+
preparation: PreparedPostPurchaseProduct.extend({
|
|
3471
|
+
display: PreparedPostPurchaseProduct.shape.display.extend({ description: z45.string().nullable() }).refine(
|
|
3472
|
+
({ description, descriptionDocument }) => description === null === (descriptionDocument !== void 0),
|
|
3473
|
+
"Exactly one of the plain and rich descriptions is shown"
|
|
3474
|
+
)
|
|
3475
|
+
}),
|
|
3476
|
+
purchaseOptions: PostPurchaseOptions.optional(),
|
|
3477
|
+
sections: CABRootSection,
|
|
3478
|
+
variantCatalog: PostPurchaseVariantCatalog.optional()
|
|
3479
|
+
}),
|
|
3480
|
+
z45.object({
|
|
3481
|
+
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
3482
|
+
initialVariant: PostPurchaseVariantSelector.optional(),
|
|
3483
|
+
planCatalog: PostPurchasePlanCatalog.nullable().optional(),
|
|
3484
|
+
preparation: PostPurchasePreparation.options[1],
|
|
3485
|
+
purchaseOptions: PostPurchaseOptions.optional(),
|
|
3486
|
+
sections: z45.null(),
|
|
3487
|
+
variantCatalog: PostPurchaseVariantCatalog.optional()
|
|
3488
|
+
})
|
|
3489
|
+
]);
|
|
3490
|
+
|
|
3491
|
+
// src/schema/postPurchaseProductCollectionView.ts
|
|
3492
|
+
var PostPurchaseProductCollectionView = z46.object({
|
|
3493
|
+
members: z46.array(
|
|
3494
|
+
z46.object({
|
|
3495
|
+
productId: PostPurchaseProductId,
|
|
3496
|
+
productIndex: z46.number().int().nonnegative(),
|
|
3497
|
+
view: PostPurchaseProductView
|
|
3498
|
+
})
|
|
3499
|
+
)
|
|
3500
|
+
});
|
|
3501
|
+
var PostPurchaseCollectionChoice = z46.object({
|
|
3502
|
+
choice: PostPurchaseChoice.optional(),
|
|
3503
|
+
productId: PostPurchaseProductId,
|
|
3504
|
+
variantId: PostPurchaseVariantSelector.shape.variantId.optional()
|
|
3505
|
+
}).strict();
|
|
3506
|
+
var PostPurchaseExcludedProductIds = z46.array(PostPurchaseProductId).default([]);
|
|
3507
|
+
|
|
3508
|
+
// src/schema/postPurchaseQuantity.ts
|
|
3509
|
+
var quantity = PreparedPostPurchaseProduct.shape.selection.shape.quantity;
|
|
3510
|
+
var PostPurchaseQuantityChoice = PostPurchaseCollectionChoice.extend({ quantity: quantity.optional() });
|
|
3511
|
+
var PostPurchaseQuantityPolicy = PostPurchaseSettings.shape.quantityInputs.omit({ defaultQuantity: true }).extend({
|
|
3512
|
+
initialQuantity: quantity,
|
|
3513
|
+
maxValue: quantity,
|
|
3514
|
+
minValue: z47.literal(0).transform(() => 1).or(quantity)
|
|
3515
|
+
}).refine(({ maxValue, minValue }) => minValue <= maxValue, "Quantity bounds are reversed");
|
|
3516
|
+
|
|
3517
|
+
// src/schema/postPurchaseGroup.ts
|
|
3518
|
+
var PostPurchaseGroupChoice = PostPurchaseQuantityChoice.extend({
|
|
3519
|
+
memberProductId: PreparedPostPurchaseProduct.shape.selection.shape.productId
|
|
3520
|
+
});
|
|
3521
|
+
|
|
3522
|
+
// src/schema/postPurchaseIdentity.ts
|
|
3523
|
+
import { z as z48 } from "zod";
|
|
3524
|
+
var POST_PURCHASE_ID_MAX = 128;
|
|
3525
|
+
var PostPurchaseTimestampSchema = z48.number().int().nonnegative();
|
|
3526
|
+
var PostPurchaseOrderIdSchema = z48.string().regex(/^gid:\/\/shopify\/Order\/[1-9]\d*$/);
|
|
3527
|
+
var ShopifyDomainSchema = z48.string().max(POST_PURCHASE_ID_MAX).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?\.myshopify\.com$/);
|
|
3528
|
+
var DecideRequestSchema = z48.object({
|
|
3529
|
+
checkoutToken: z48.string().min(1).max(POST_PURCHASE_ID_MAX),
|
|
3530
|
+
shop: ShopifyDomainSchema
|
|
3531
|
+
});
|
|
3532
|
+
var PostPurchaseAppIdSchema = z48.string().min(1).max(POST_PURCHASE_ID_MAX);
|
|
3533
|
+
var DecisionEntrySchema = z48.object({
|
|
3534
|
+
blockId: z48.number().int().positive(),
|
|
3535
|
+
blockIndex: z48.string(),
|
|
3536
|
+
blockParentIndex: z48.string(),
|
|
3537
|
+
flowId: z48.number().int().positive(),
|
|
3538
|
+
sectionId: z48.number().int().positive(),
|
|
3539
|
+
widgetId: z48.number().int().positive(),
|
|
3540
|
+
widgetTraffic: z48.number().min(0).max(100)
|
|
3541
|
+
});
|
|
3542
|
+
|
|
3543
|
+
// src/schema/postPurchaseOfferEligibility.ts
|
|
3544
|
+
import { z as z49 } from "zod";
|
|
3545
|
+
var selection = PreparedPostPurchaseProduct.shape.selection;
|
|
3546
|
+
var PostPurchaseOfferSkipReason = z49.enum(["empty", "no-eligible-subscription"]);
|
|
3547
|
+
var PostPurchaseOfferEligibilityContext = z49.object({
|
|
3548
|
+
excludedProductIds: PostPurchaseExcludedProductIds,
|
|
3549
|
+
originalLineItems: z49.array(selection.pick({ productId: true, sellingPlanId: true, variantId: true }))
|
|
3550
|
+
});
|
|
3551
|
+
var PostPurchaseOfferEligibility = z49.discriminatedUnion("status", [
|
|
3552
|
+
z49.object({
|
|
3553
|
+
members: z49.array(
|
|
3554
|
+
z49.object({ productId: selection.shape.productId, productIndex: z49.number().int().nonnegative() })
|
|
3555
|
+
),
|
|
3556
|
+
status: z49.literal("retain")
|
|
3557
|
+
}),
|
|
3558
|
+
z49.object({ reason: PostPurchaseOfferSkipReason, status: z49.literal("skip") }),
|
|
3559
|
+
z49.object({ reason: z49.literal("eligible-upgrade").optional(), status: z49.literal("unavailable") })
|
|
3560
|
+
]);
|
|
3561
|
+
|
|
3562
|
+
// src/schema/postPurchaseOfferPresentation.ts
|
|
3563
|
+
import { z as z50 } from "zod";
|
|
3564
|
+
var language2 = PostPurchaseSettings.shape.language.shape.global.unwrap().unwrap();
|
|
3565
|
+
var PostPurchaseOfferPresentation = z50.strictObject({
|
|
3566
|
+
labels: language2.pick({ declineAll: true, declineThisOffer: true }),
|
|
3567
|
+
layout: PostPurchaseSettings.shape.offersLayout,
|
|
3568
|
+
sections: CABRootSection.nullable(),
|
|
3569
|
+
showDeclineAll: PostPurchaseSettings.shape.productOptions.shape.showDeclineAll
|
|
3570
|
+
});
|
|
3571
|
+
|
|
3572
|
+
// src/schema/postPurchaseOrderDecision.ts
|
|
3573
|
+
import { z as z51 } from "zod";
|
|
3574
|
+
var OrderDecisionSchema = z51.discriminatedUnion("owner", [
|
|
3575
|
+
z51.object({ owner: z51.literal("session"), sessionId: z51.string().regex(/^[a-f0-9]{64}$/) }),
|
|
3576
|
+
z51.object({ owner: z51.literal("release"), sessionId: z51.null() })
|
|
3577
|
+
]);
|
|
3578
|
+
|
|
3579
|
+
// src/schema/postPurchasePolicy.ts
|
|
3580
|
+
import { z as z52 } from "zod";
|
|
3581
|
+
var HoldSettingSchema = z52.discriminatedUnion("enabled", [
|
|
3582
|
+
z52.object({ durationMinutes: z52.number().int().min(1).max(60), enabled: z52.literal(true) }),
|
|
3583
|
+
z52.object({ durationMinutes: z52.null(), enabled: z52.literal(false) })
|
|
3584
|
+
]);
|
|
3585
|
+
var TimingSettingsSchema = z52.object({ flowHold: HoldSettingSchema, shopHold: HoldSettingSchema });
|
|
3586
|
+
var SessionPolicySchema = TimingSettingsSchema.extend({
|
|
3587
|
+
durationMinutes: z52.number().int().min(1).max(60).nullable(),
|
|
3588
|
+
source: z52.enum(["shop", "flow", "native"])
|
|
3589
|
+
}).refine(
|
|
3590
|
+
(policy) => {
|
|
3591
|
+
const expectedSource = policy.shopHold.enabled ? "shop" : policy.flowHold.enabled ? "flow" : "native";
|
|
3592
|
+
const expectedDuration = expectedSource === "shop" ? policy.shopHold.durationMinutes : expectedSource === "flow" ? policy.flowHold.durationMinutes : null;
|
|
3593
|
+
return policy.source === expectedSource && policy.durationMinutes === expectedDuration;
|
|
3594
|
+
},
|
|
3595
|
+
{
|
|
3596
|
+
message: "source and durationMinutes must reflect the shop-over-flow-over-native precedence",
|
|
3597
|
+
path: ["source"]
|
|
3598
|
+
}
|
|
3599
|
+
);
|
|
3600
|
+
|
|
3601
|
+
// src/schema/postPurchaseProductCalculation.ts
|
|
3602
|
+
import { z as z53 } from "zod";
|
|
3603
|
+
var MoneyBag = z53.object({
|
|
3604
|
+
presentmentMoney: z53.object({
|
|
3605
|
+
amount: PostPurchaseAmount,
|
|
3606
|
+
currencyCode: z53.string().regex(/^[A-Z]{3}$/)
|
|
3607
|
+
})
|
|
3608
|
+
});
|
|
3609
|
+
var PostPurchaseProductCalculation = z53.object({
|
|
3610
|
+
calculatedPurchase: z53.object({
|
|
3611
|
+
addedShippingLines: z53.array(z53.object({ priceSet: MoneyBag })),
|
|
3612
|
+
addedTaxLines: z53.array(z53.object({ priceSet: MoneyBag })),
|
|
3613
|
+
totalOutstandingSet: MoneyBag,
|
|
3614
|
+
updatedLineItems: z53.array(
|
|
3615
|
+
z53.object({
|
|
3616
|
+
priceSet: z53.unknown().optional(),
|
|
3617
|
+
productId: z53.number().int().positive(),
|
|
3618
|
+
sellingPlanId: z53.unknown().optional(),
|
|
3619
|
+
variantId: z53.number().int().positive()
|
|
3620
|
+
})
|
|
3621
|
+
)
|
|
3622
|
+
}),
|
|
3623
|
+
errors: z53.array(z53.unknown()).length(0),
|
|
3624
|
+
status: z53.literal("processed")
|
|
3625
|
+
});
|
|
3626
|
+
var Minor = z53.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
3627
|
+
var PostPurchaseProductCosts = z53.object({
|
|
3628
|
+
currencyCode: MoneyBag.shape.presentmentMoney.shape.currencyCode,
|
|
3629
|
+
recurringDisplay: z53.object({ shippingMinor: Minor, subtotalMinor: Minor, totalMinor: Minor }).optional(),
|
|
3630
|
+
shippingMinor: Minor,
|
|
3631
|
+
subtotalMinor: Minor,
|
|
3632
|
+
taxesMinor: Minor,
|
|
3633
|
+
totalMinor: Minor
|
|
3634
|
+
});
|
|
3635
|
+
var ChangesetDiscount = z53.object({
|
|
3636
|
+
title: z53.string(),
|
|
3637
|
+
value: z53.number().nonnegative(),
|
|
3638
|
+
valueType: z53.enum(["percentage", "fixed_amount"])
|
|
3639
|
+
}).optional();
|
|
3640
|
+
var PostPurchaseProductChangeset = z53.object({
|
|
3641
|
+
changes: z53.array(
|
|
3642
|
+
z53.union([
|
|
3643
|
+
z53.object({
|
|
3644
|
+
discount: ChangesetDiscount,
|
|
3645
|
+
quantity: z53.number().int().positive(),
|
|
3646
|
+
type: z53.literal("add_variant"),
|
|
3647
|
+
variantId: z53.number().int().positive()
|
|
3648
|
+
}),
|
|
3649
|
+
z53.object({ price: z53.number().nonnegative(), title: z53.string(), type: z53.literal("add_shipping_line") }),
|
|
3650
|
+
PostPurchaseSubscriptionTerms.pick({
|
|
3651
|
+
initialShippingPrice: true,
|
|
3652
|
+
recurringShippingPrice: true,
|
|
3653
|
+
shippingOption: true
|
|
3654
|
+
}).extend({
|
|
3655
|
+
discount: ChangesetDiscount,
|
|
3656
|
+
quantity: z53.number().int().positive(),
|
|
3657
|
+
sellingPlanId: z53.number().int().positive(),
|
|
3658
|
+
type: z53.literal("add_subscription"),
|
|
3659
|
+
variantId: z53.number().int().positive()
|
|
3660
|
+
})
|
|
3661
|
+
])
|
|
3662
|
+
)
|
|
3663
|
+
});
|
|
3664
|
+
|
|
3665
|
+
// src/schema/postPurchaseProductSettings.ts
|
|
3666
|
+
import { z as z54 } from "zod";
|
|
3667
|
+
var amount = z54.union([z54.number().nonnegative(), PostPurchaseAmount.transform(Number)]);
|
|
3668
|
+
var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
3669
|
+
discountedFrom: true,
|
|
3670
|
+
language: true,
|
|
3671
|
+
productLimit: true,
|
|
3672
|
+
productOptions: true,
|
|
3673
|
+
productType: true,
|
|
3674
|
+
productTypeSelector: true,
|
|
3675
|
+
quantityInputs: true,
|
|
3676
|
+
subscriptionIsDefault: true,
|
|
3677
|
+
upgradeToSubscription: true
|
|
3678
|
+
}).extend({
|
|
3679
|
+
advance: z54.unknown().default({}),
|
|
3680
|
+
blocks: z54.array(z54.unknown()).optional(),
|
|
3681
|
+
discount: PostPurchaseSettings.shape.discount.extend({ amount: amount.default(30) }),
|
|
3682
|
+
integrations: z54.unknown().default({}),
|
|
3683
|
+
shipping: PostPurchaseSettings.shape.shipping.extend({ amount: amount.default(10) }),
|
|
3684
|
+
styles: z54.unknown().default({}),
|
|
3685
|
+
subImages: PostPurchaseSettings.shape.subImages.catch(null),
|
|
3686
|
+
subscription: z54.unknown().default(PostPurchaseSettings.shape.subscription.parse(void 0))
|
|
3687
|
+
});
|
|
3688
|
+
|
|
3689
|
+
// src/schema/postPurchaseSelection.ts
|
|
3690
|
+
import { z as z55 } from "zod";
|
|
3691
|
+
var SelectionClaimsSchema = DecideRequestSchema.extend({
|
|
3692
|
+
appId: PostPurchaseAppIdSchema,
|
|
3693
|
+
entry: DecisionEntrySchema,
|
|
3694
|
+
iss: z55.literal("rebuy-api"),
|
|
3695
|
+
purpose: z55.literal("post-purchase-selection")
|
|
3696
|
+
});
|
|
3697
|
+
var SessionStartRequestSchema = DecideRequestSchema.extend({
|
|
3698
|
+
selectionToken: z55.string().min(1).max(8192).optional()
|
|
3699
|
+
}).strict();
|
|
3700
|
+
|
|
3701
|
+
// src/schema/postPurchaseSession.ts
|
|
3702
|
+
import { z as z56 } from "zod";
|
|
3703
|
+
var SessionIdentitySchema = DecideRequestSchema.extend({ appId: PostPurchaseAppIdSchema });
|
|
3704
|
+
var SessionOrderTimingSchema = z56.object({
|
|
3705
|
+
nativeDeadline: PostPurchaseTimestampSchema,
|
|
3706
|
+
orderCreatedAt: PostPurchaseTimestampSchema,
|
|
3707
|
+
orderId: PostPurchaseOrderIdSchema,
|
|
3708
|
+
timingSource: z56.literal("shopify-order-created-at")
|
|
3709
|
+
});
|
|
3710
|
+
var ReadySessionTimingSchema = SessionOrderTimingSchema.extend({
|
|
3711
|
+
deadline: PostPurchaseTimestampSchema,
|
|
3712
|
+
entry: DecisionEntrySchema,
|
|
3713
|
+
policySnapshot: SessionPolicySchema,
|
|
3714
|
+
startedAt: PostPurchaseTimestampSchema
|
|
3715
|
+
}).refine((session) => session.orderCreatedAt <= session.startedAt, {
|
|
3716
|
+
message: "startedAt must not precede orderCreatedAt",
|
|
3717
|
+
path: ["startedAt"]
|
|
3718
|
+
}).refine((session) => session.startedAt <= session.deadline, {
|
|
3719
|
+
message: "deadline must not precede startedAt",
|
|
3720
|
+
path: ["deadline"]
|
|
3721
|
+
}).refine((session) => session.deadline <= session.nativeDeadline, {
|
|
3722
|
+
message: "deadline must not exceed nativeDeadline",
|
|
3723
|
+
path: ["deadline"]
|
|
3724
|
+
});
|
|
3725
|
+
var SessionStartResponseSchema = z56.object({
|
|
3726
|
+
data: z56.object({
|
|
3727
|
+
phase: z56.literal("render"),
|
|
3728
|
+
serverNow: PostPurchaseTimestampSchema,
|
|
3729
|
+
session: ReadySessionTimingSchema,
|
|
3730
|
+
workflowPhase: z56.literal("start")
|
|
3731
|
+
}),
|
|
3732
|
+
successful: z56.literal(true)
|
|
3733
|
+
});
|
|
3734
|
+
|
|
3735
|
+
// src/schema/postPurchaseSessionClose.ts
|
|
3736
|
+
import { z as z57 } from "zod";
|
|
3737
|
+
var SessionClosureSchema = z57.object({ closedAt: PostPurchaseTimestampSchema, status: z57.literal("closed") });
|
|
3738
|
+
var SessionCloseRequestSchema = DecideRequestSchema.strict();
|
|
3739
|
+
var SessionCloseResponseSchema = z57.object({ data: SessionClosureSchema, successful: z57.literal(true) });
|
|
3740
|
+
|
|
3741
|
+
// src/schema/postPurchaseShadow.ts
|
|
3742
|
+
import { z as z58 } from "zod";
|
|
3743
|
+
var PostPurchaseShadowSelectionSchema = z58.discriminatedUnion("verdict", [
|
|
3744
|
+
z58.object({ entry: DecisionEntrySchema, verdict: z58.literal("render") }),
|
|
3745
|
+
z58.object({ verdict: z58.literal("skip") })
|
|
3746
|
+
]);
|
|
3747
|
+
var PostPurchaseShadowReportFields = z58.object({
|
|
3748
|
+
differences: z58.array(z58.enum(["verdict", "entry", "targeting", "incomplete-capture", "unsupported-configuration"])).refine((differences) => new Set(differences).size === differences.length, {
|
|
3749
|
+
message: "differences must not contain duplicate entries"
|
|
3750
|
+
}),
|
|
3751
|
+
legacySelection: PostPurchaseShadowSelectionSchema,
|
|
3752
|
+
phase: z58.literal("shouldRender"),
|
|
3753
|
+
sampleId: z58.string(),
|
|
3754
|
+
serverSelection: PostPurchaseShadowSelectionSchema.optional(),
|
|
3755
|
+
status: z58.enum(["match", "diverged", "incomplete"]),
|
|
3756
|
+
targetingFlowIds: z58.array(z58.number().int().positive()),
|
|
3757
|
+
workflowPhase: z58.literal("decide")
|
|
3758
|
+
});
|
|
3759
|
+
var PostPurchaseShadowReportSchema = PostPurchaseShadowReportFields.refine(
|
|
3760
|
+
(report) => report.status !== "match" || report.differences.length === 0,
|
|
3761
|
+
{ message: "status 'match' requires an empty differences array", path: ["status"] }
|
|
3762
|
+
).refine((report) => report.status !== "diverged" || report.differences.length > 0, {
|
|
3763
|
+
message: "status 'diverged' requires a non-empty differences array",
|
|
3764
|
+
path: ["status"]
|
|
3765
|
+
}).refine((report) => report.status !== "diverged" || report.serverSelection !== void 0, {
|
|
3766
|
+
message: "status 'diverged' requires a serverSelection to diverge from",
|
|
3767
|
+
path: ["status"]
|
|
3768
|
+
});
|
|
3769
|
+
|
|
3770
|
+
// src/schema/postPurchaseSkipTrace.ts
|
|
3771
|
+
import { z as z59 } from "zod";
|
|
3772
|
+
var POST_PURCHASE_SKIP_LIMIT = 32;
|
|
3773
|
+
var PostPurchaseSkipTraceSchema = z59.array(
|
|
3774
|
+
z59.object({
|
|
3775
|
+
entry: DecisionEntrySchema,
|
|
3776
|
+
reason: PostPurchaseSkipReasonSchema
|
|
3777
|
+
})
|
|
3778
|
+
).max(POST_PURCHASE_SKIP_LIMIT);
|
|
3779
|
+
|
|
3780
|
+
// src/schema/postPurchaseSubscriptionDisplay.ts
|
|
3781
|
+
import { z as z60 } from "zod";
|
|
3782
|
+
var Minor2 = z60.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
3783
|
+
var PostPurchaseSubscriptionDisplay = z60.object({
|
|
3784
|
+
comparisonMinor: Minor2,
|
|
3785
|
+
currencyCode: z60.string().regex(/^[A-Z]{3}$/),
|
|
3786
|
+
priceMinor: Minor2,
|
|
3787
|
+
savingMinor: Minor2,
|
|
3788
|
+
savingPercent: z60.number().int().min(0).max(100)
|
|
3789
|
+
});
|
|
3790
|
+
|
|
3791
|
+
// src/schema/postPurchaseSubscriptionProduct.ts
|
|
3792
|
+
import { z as z61 } from "zod";
|
|
3793
|
+
var PreparedPostPurchaseSubscription = PreparedPostPurchaseProduct.extend({
|
|
3794
|
+
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId: z61.number().int().positive() }),
|
|
3795
|
+
terms: PreparedPostPurchaseProduct.shape.terms.extend({
|
|
3796
|
+
subscription: PostPurchaseSubscriptionTerms
|
|
3797
|
+
}).refine(
|
|
3798
|
+
({ discount, shipping, subscription }) => (discount.type !== "none" || discount.amount === 0) && shipping.amount === subscription.initialShippingPrice && shipping.amount === subscription.recurringShippingPrice && (shipping.type !== "free" || shipping.amount === 0)
|
|
3799
|
+
)
|
|
3800
|
+
});
|
|
3801
|
+
var readPostPurchaseSubscription = (prepared) => {
|
|
3802
|
+
if (prepared.selection.sellingPlanId === void 0 && prepared.terms.subscription === void 0) return void 0;
|
|
3803
|
+
return PreparedPostPurchaseSubscription.parse(prepared);
|
|
3804
|
+
};
|
|
3805
|
+
|
|
3806
|
+
// src/schema/postPurchaseVariantDefault.ts
|
|
3807
|
+
import { z as z62 } from "zod";
|
|
3808
|
+
var values = PostPurchaseVariantValues.partial().extend({
|
|
3809
|
+
option1: PostPurchaseVariantValues.shape.option1.nullish()
|
|
3810
|
+
});
|
|
3811
|
+
var variant = values.extend({
|
|
3812
|
+
id: PostPurchaseVariantId,
|
|
3813
|
+
inventoryManagement: z62.string().nullable(),
|
|
3814
|
+
inventoryPolicy: z62.string(),
|
|
3815
|
+
inventoryQuantity: z62.number()
|
|
3816
|
+
});
|
|
3817
|
+
var options = z62.array(PostPurchaseVariantOption.pick({ name: true, values: true }));
|
|
3818
|
+
var PostPurchaseVariantDefaultProduct = z62.object({
|
|
3819
|
+
id: PostPurchaseProductId,
|
|
3820
|
+
options,
|
|
3821
|
+
selectedVariant: variant.optional(),
|
|
3822
|
+
variants: z62.array(variant)
|
|
3823
|
+
});
|
|
3824
|
+
var PostPurchaseVariantDefaultSettings = PostPurchaseSettings.shape.productOptions.pick({
|
|
3825
|
+
hideOutOfStockVariants: true,
|
|
3826
|
+
matchVariant: true
|
|
3827
|
+
});
|
|
3828
|
+
var PostPurchaseOrderAttributes = z62.record(z62.string(), z62.array(z62.string())).default({});
|
|
3829
|
+
var PostPurchaseOriginalVariants = z62.array(
|
|
3830
|
+
z62.object({ productId: PostPurchaseProductId, variantId: PostPurchaseVariantId })
|
|
3831
|
+
);
|
|
3832
|
+
var PostPurchaseAttributeProducts = z62.array(
|
|
3833
|
+
z62.object({ id: PostPurchaseProductId, options, variants: z62.array(values.extend({ id: PostPurchaseVariantId })) })
|
|
3834
|
+
);
|
|
3835
|
+
|
|
3836
|
+
// src/schema/postPurchaseVariantDefaultContext.ts
|
|
3837
|
+
import { z as z63 } from "zod";
|
|
3838
|
+
var PostPurchaseVariantDefaultContext = z63.object({
|
|
3839
|
+
enrichedLineItems: z63.unknown().optional(),
|
|
3840
|
+
originalVariants: PostPurchaseOriginalVariants
|
|
3841
|
+
});
|
|
3842
|
+
|
|
3843
|
+
// src/schema/shopConfig.ts
|
|
3844
|
+
import { z as z64 } from "zod";
|
|
3845
|
+
var ShopConfig = z64.object({
|
|
3846
|
+
activeExperiments: z64.array(
|
|
3847
|
+
z64.object({
|
|
3848
|
+
data: z64.array(
|
|
3849
|
+
z64.object({
|
|
3850
|
+
aliasName: z64.string(),
|
|
3851
|
+
cssInput: z64.string().nullish(),
|
|
3852
|
+
elementId: z64.coerce.number(),
|
|
3853
|
+
id: z64.coerce.number(),
|
|
3854
|
+
javascriptInput: z64.string().nullish(),
|
|
3855
|
+
traffic: z64.coerce.number()
|
|
3856
|
+
})
|
|
3857
|
+
),
|
|
3858
|
+
id: z64.coerce.number(),
|
|
3859
|
+
name: z64.string(),
|
|
3860
|
+
pageTarget: z64.string().nullable(),
|
|
3861
|
+
pageTargetUrl: z64.string().nullable(),
|
|
3862
|
+
placeholderId: z64.coerce.number().nullable(),
|
|
3863
|
+
type: z64.string()
|
|
3864
|
+
})
|
|
3865
|
+
),
|
|
3866
|
+
activePackages: z64.array(
|
|
3867
|
+
z64.object({
|
|
3868
|
+
cancelledAt: z64.string().nullable(),
|
|
3869
|
+
id: z64.number(),
|
|
3870
|
+
installedAt: z64.string().nullable(),
|
|
3871
|
+
isActive: z64.boolean(),
|
|
3872
|
+
isBillable: z64.boolean(),
|
|
3873
|
+
packageId: z64.number(),
|
|
3874
|
+
packageName: z64.string(),
|
|
3875
|
+
shortName: z64.string(),
|
|
3876
|
+
trialDays: z64.number(),
|
|
3877
|
+
uninstalledAt: z64.string().nullable()
|
|
3878
|
+
})
|
|
3879
|
+
),
|
|
3880
|
+
apiKey: z64.string(),
|
|
3881
|
+
billingVersion: z64.string().nullable(),
|
|
3882
|
+
cacheKey: z64.coerce.number(),
|
|
3883
|
+
carousel: z64.enum(["flickity", "splide"]),
|
|
3884
|
+
currency: z64.string(),
|
|
3885
|
+
currencySymbol: z64.string(),
|
|
3886
|
+
domain: z64.string(),
|
|
3887
|
+
enabledJquery: z64.boolean(),
|
|
3888
|
+
enabledPresentmentCurrencies: z64.array(z64.string()),
|
|
3889
|
+
hasSmartCollectionsEnabled: z64.boolean(),
|
|
3890
|
+
hasSmartSearchEnabled: z64.boolean(),
|
|
3891
|
+
id: z64.coerce.number(),
|
|
3892
|
+
integrations: z64.record(
|
|
3893
|
+
z64.enum([
|
|
3894
|
+
"attentive",
|
|
3895
|
+
"judgeme",
|
|
3896
|
+
"junip",
|
|
3897
|
+
"klaviyo",
|
|
3898
|
+
"loox",
|
|
3899
|
+
"okendo",
|
|
3900
|
+
"opinew",
|
|
3901
|
+
"recharge",
|
|
3902
|
+
"reviewsio",
|
|
3903
|
+
"stamped",
|
|
3904
|
+
"yotpo"
|
|
3905
|
+
]),
|
|
3906
|
+
z64.union([z64.boolean(), z64.unknown()])
|
|
3907
|
+
),
|
|
3908
|
+
markets: z64.object({
|
|
3909
|
+
enabled: z64.boolean()
|
|
3910
|
+
}),
|
|
3911
|
+
monetize: z64.object({
|
|
3912
|
+
publisherKey: z64.string().nullable()
|
|
3913
|
+
}).nullish(),
|
|
3914
|
+
moneyFormat: z64.string(),
|
|
3915
|
+
myshopifyDomain: z64.string(),
|
|
3916
|
+
primaryLocale: z64.string(),
|
|
3917
|
+
productGroupsEnabled: z64.enum(["no", "yes"]).transform((value) => value === "yes"),
|
|
3918
|
+
rechargeCustomDomain: z64.string().nullable(),
|
|
3919
|
+
sellingPlansEnabled: z64.boolean(),
|
|
3920
|
+
shopId: z64.number(),
|
|
3921
|
+
shopifySellingPlansEnabled: z64.boolean(),
|
|
3922
|
+
shopName: z64.string(),
|
|
3923
|
+
storefrontAccessToken: z64.string().nullable(),
|
|
3924
|
+
useRebuyIcons: z64.boolean()
|
|
3925
|
+
});
|
|
3926
|
+
|
|
3927
|
+
// src/schema/userConfig.ts
|
|
3928
|
+
import { z as z65 } from "zod";
|
|
3929
|
+
var UserConfig = z65.object({
|
|
3930
|
+
shop: ShopConfig,
|
|
3931
|
+
/**
|
|
3932
|
+
* `.catch(undefined)` is the safety bar: smart-cart shape drift can NEVER fail `fetchUserConfig`,
|
|
3933
|
+
* which resolves the apiKey for every offers/monetize/analytics/gift request.
|
|
3934
|
+
*/
|
|
3935
|
+
smartCart: SmartCartConfig.nullish().catch(void 0),
|
|
3936
|
+
smartFlows: z65.array(z65.unknown())
|
|
3937
|
+
});
|
|
3938
|
+
|
|
3939
|
+
// src/schema/widgetData.ts
|
|
3940
|
+
import { z as z74 } from "zod";
|
|
3941
|
+
|
|
3942
|
+
// src/schema/widgets/abTestingPlaceholder.ts
|
|
3943
|
+
import { z as z66 } from "zod";
|
|
3944
|
+
var ABTestingPlaceholder = z66.looseObject({
|
|
3945
|
+
type: z66.literal("placeholder")
|
|
3946
|
+
});
|
|
3947
|
+
|
|
3948
|
+
// src/schema/widgets/checkoutExtension.ts
|
|
3949
|
+
import { z as z67 } from "zod";
|
|
3950
|
+
var CheckoutExtension = z67.looseObject({
|
|
3951
|
+
type: z67.literal(WidgetType.shopify_checkout_extension).default(WidgetType.shopify_checkout_extension)
|
|
3770
3952
|
});
|
|
3771
3953
|
|
|
3772
3954
|
// src/schema/widgets/contentBlock.ts
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3955
|
+
import { z as z68 } from "zod";
|
|
3956
|
+
var ContentBlockV1 = z68.object({
|
|
3957
|
+
blockSpacing: z68.enum(spacings).optional(),
|
|
3958
|
+
imageBlocks: z68.union([
|
|
3959
|
+
z68.array(
|
|
3960
|
+
z68.object({
|
|
3961
|
+
altText: z68.string().nullable(),
|
|
3962
|
+
description: z68.string().nullable(),
|
|
3963
|
+
id: z68.uuid(),
|
|
3964
|
+
imagePlacement: z68.enum(["top", "right", "bottom", "left"]),
|
|
3965
|
+
imageSize: z68.number(),
|
|
3966
|
+
imageUrl: z68.url(),
|
|
3967
|
+
textAlignment: z68.enum(["left", "center", "right"]),
|
|
3785
3968
|
/** Inline scale only: an image caption can never be a block-level heading. */
|
|
3786
|
-
textSize:
|
|
3969
|
+
textSize: z68.enum(inlineTextSizeNames)
|
|
3787
3970
|
})
|
|
3788
3971
|
),
|
|
3789
|
-
|
|
3972
|
+
z68.strictObject({}).transform(() => [])
|
|
3790
3973
|
]).optional(),
|
|
3791
|
-
imageLayout:
|
|
3792
|
-
language:
|
|
3793
|
-
description:
|
|
3794
|
-
superTitle:
|
|
3795
|
-
title:
|
|
3974
|
+
imageLayout: z68.enum(["row", "column"]).optional(),
|
|
3975
|
+
language: z68.object({
|
|
3976
|
+
description: z68.string(),
|
|
3977
|
+
superTitle: z68.string(),
|
|
3978
|
+
title: z68.string()
|
|
3796
3979
|
}),
|
|
3797
|
-
previewMode:
|
|
3798
|
-
type:
|
|
3799
|
-
version:
|
|
3980
|
+
previewMode: z68.boolean(),
|
|
3981
|
+
type: z68.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block),
|
|
3982
|
+
version: z68.literal(1)
|
|
3800
3983
|
});
|
|
3801
|
-
var ContentBlock =
|
|
3984
|
+
var ContentBlock = z68.discriminatedUnion("version", [
|
|
3802
3985
|
ContentBlockV1,
|
|
3803
3986
|
CABRootSection.extend({
|
|
3804
|
-
type:
|
|
3987
|
+
type: z68.literal(WidgetType.ui_extension_content_block).default(WidgetType.ui_extension_content_block)
|
|
3805
3988
|
})
|
|
3806
3989
|
]);
|
|
3807
3990
|
|
|
3808
3991
|
// src/schema/widgets/giftWithPurchase.ts
|
|
3809
|
-
import { z as
|
|
3810
|
-
var GiftWithPurchase =
|
|
3811
|
-
type:
|
|
3992
|
+
import { z as z69 } from "zod";
|
|
3993
|
+
var GiftWithPurchase = z69.looseObject({
|
|
3994
|
+
type: z69.literal(WidgetType.gift_with_purchase).default(WidgetType.gift_with_purchase)
|
|
3812
3995
|
});
|
|
3813
3996
|
|
|
3814
3997
|
// src/schema/widgets/lineItemEditor.ts
|
|
3815
|
-
import { z as
|
|
3816
|
-
var LineItemEditorSwitchLanguageV1 =
|
|
3817
|
-
downgradeToOneTimeLabel:
|
|
3998
|
+
import { z as z70 } from "zod";
|
|
3999
|
+
var LineItemEditorSwitchLanguageV1 = z70.object({
|
|
4000
|
+
downgradeToOneTimeLabel: z70.string().optional(),
|
|
3818
4001
|
/** Frequency-option template (`{{frequency}}`/`{{interval}}`) for the plan select. */
|
|
3819
|
-
subscriptionOptionLabel:
|
|
3820
|
-
upgradeToSubscriptionLabel:
|
|
3821
|
-
upgradeToSubscriptionWithoutDiscountLabel:
|
|
4002
|
+
subscriptionOptionLabel: z70.string().optional(),
|
|
4003
|
+
upgradeToSubscriptionLabel: z70.string().optional(),
|
|
4004
|
+
upgradeToSubscriptionWithoutDiscountLabel: z70.string().optional()
|
|
3822
4005
|
});
|
|
3823
|
-
var LineItemEditorV1 =
|
|
4006
|
+
var LineItemEditorV1 = z70.object({
|
|
3824
4007
|
/** Legacy `getStyles` button style; the converter carries a valid kind, defaulting to `plain`. */
|
|
3825
|
-
button:
|
|
3826
|
-
previewMode:
|
|
3827
|
-
switchToSubscription:
|
|
3828
|
-
disableDowngrade:
|
|
4008
|
+
button: z70.object({ kind: z70.enum(["plain", "primary", "secondary"]).optional() }).optional(),
|
|
4009
|
+
previewMode: z70.boolean().optional(),
|
|
4010
|
+
switchToSubscription: z70.object({
|
|
4011
|
+
disableDowngrade: z70.boolean().optional(),
|
|
3829
4012
|
language: LineItemEditorSwitchLanguageV1.optional()
|
|
3830
4013
|
}).optional(),
|
|
3831
|
-
switchToSubscriptionEnabled:
|
|
3832
|
-
tracking:
|
|
3833
|
-
enableAttribution:
|
|
3834
|
-
enableSource:
|
|
3835
|
-
enableWidget:
|
|
4014
|
+
switchToSubscriptionEnabled: z70.boolean().optional(),
|
|
4015
|
+
tracking: z70.object({
|
|
4016
|
+
enableAttribution: z70.boolean().optional(),
|
|
4017
|
+
enableSource: z70.boolean().optional(),
|
|
4018
|
+
enableWidget: z70.boolean().optional()
|
|
3836
4019
|
}).optional(),
|
|
3837
|
-
type:
|
|
3838
|
-
version:
|
|
4020
|
+
type: z70.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor),
|
|
4021
|
+
version: z70.literal(1)
|
|
3839
4022
|
});
|
|
3840
|
-
var LineItemEditor =
|
|
4023
|
+
var LineItemEditor = z70.discriminatedUnion("version", [
|
|
3841
4024
|
LineItemEditorV1,
|
|
3842
4025
|
CABRootSection.extend({
|
|
3843
|
-
type:
|
|
4026
|
+
type: z70.literal(WidgetType.ui_extension_line_item_editor).default(WidgetType.ui_extension_line_item_editor)
|
|
3844
4027
|
})
|
|
3845
4028
|
]);
|
|
3846
4029
|
|
|
3847
4030
|
// src/schema/widgets/progressBar.ts
|
|
3848
|
-
import { z as
|
|
3849
|
-
var ProgressBar =
|
|
3850
|
-
type:
|
|
4031
|
+
import { z as z71 } from "zod";
|
|
4032
|
+
var ProgressBar = z71.looseObject({
|
|
4033
|
+
type: z71.literal(WidgetType.ui_extension_progress_bar).default(WidgetType.ui_extension_progress_bar)
|
|
3851
4034
|
});
|
|
3852
4035
|
|
|
3853
4036
|
// src/schema/widgets/rebuyButton.ts
|
|
3854
|
-
import { z as
|
|
3855
|
-
var RebuyButtonV1 =
|
|
3856
|
-
type:
|
|
3857
|
-
version:
|
|
4037
|
+
import { z as z72 } from "zod";
|
|
4038
|
+
var RebuyButtonV1 = z72.looseObject({
|
|
4039
|
+
type: z72.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button),
|
|
4040
|
+
version: z72.literal(1)
|
|
3858
4041
|
});
|
|
3859
|
-
var RebuyButton =
|
|
4042
|
+
var RebuyButton = z72.discriminatedUnion("version", [
|
|
3860
4043
|
RebuyButtonV1,
|
|
3861
4044
|
CABRootSection.extend({
|
|
3862
|
-
type:
|
|
4045
|
+
type: z72.literal(WidgetType.ui_extension_button).default(WidgetType.ui_extension_button)
|
|
3863
4046
|
})
|
|
3864
4047
|
]);
|
|
3865
4048
|
|
|
3866
4049
|
// src/schema/widgets/rebuyMonetize.ts
|
|
3867
|
-
import { z as
|
|
3868
|
-
var RebuyMonetize =
|
|
3869
|
-
type:
|
|
4050
|
+
import { z as z73 } from "zod";
|
|
4051
|
+
var RebuyMonetize = z73.looseObject({
|
|
4052
|
+
type: z73.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad)
|
|
3870
4053
|
});
|
|
3871
|
-
var RebuyMonetizeV1 =
|
|
3872
|
-
name:
|
|
3873
|
-
previewMode:
|
|
4054
|
+
var RebuyMonetizeV1 = z73.object({
|
|
4055
|
+
name: z73.string().nullable().optional(),
|
|
4056
|
+
previewMode: z73.boolean().optional(),
|
|
3874
4057
|
/** Privacy Policy footer href → the marker section's `privacyPolicyUrl`. */
|
|
3875
|
-
privacyPolicyUrl:
|
|
4058
|
+
privacyPolicyUrl: z73.string().nullable().optional(),
|
|
3876
4059
|
/** Ads-taxonomy sub-vertical id — one of the admin Monetize editor's two configurables. */
|
|
3877
|
-
subVertical:
|
|
3878
|
-
tracking:
|
|
3879
|
-
enableAttribution:
|
|
3880
|
-
enableSource:
|
|
3881
|
-
enableWidget:
|
|
4060
|
+
subVertical: z73.string().nullable().optional(),
|
|
4061
|
+
tracking: z73.object({
|
|
4062
|
+
enableAttribution: z73.boolean().optional(),
|
|
4063
|
+
enableSource: z73.boolean().optional(),
|
|
4064
|
+
enableWidget: z73.boolean().optional()
|
|
3882
4065
|
}).optional(),
|
|
3883
|
-
type:
|
|
3884
|
-
version:
|
|
4066
|
+
type: z73.literal(WidgetType.ui_extension_ad).default(WidgetType.ui_extension_ad),
|
|
4067
|
+
version: z73.literal(1),
|
|
3885
4068
|
/** Ads-taxonomy vertical id — one of the admin Monetize editor's two configurables. */
|
|
3886
|
-
vertical:
|
|
4069
|
+
vertical: z73.string().nullable().optional()
|
|
3887
4070
|
});
|
|
3888
4071
|
|
|
3889
4072
|
// src/schema/widgetData.ts
|
|
@@ -3897,7 +4080,7 @@ var extensionWidgetTypes = [
|
|
|
3897
4080
|
WidgetType.ui_extension_line_item_editor,
|
|
3898
4081
|
WidgetType.ui_extension_progress_bar
|
|
3899
4082
|
];
|
|
3900
|
-
var WidgetData =
|
|
4083
|
+
var WidgetData = z74.discriminatedUnion("type", [
|
|
3901
4084
|
ABTestingPlaceholder,
|
|
3902
4085
|
CheckoutExtension,
|
|
3903
4086
|
ContentBlock,
|
|
@@ -4257,36 +4440,36 @@ var SWITCH_LABELS = {
|
|
|
4257
4440
|
};
|
|
4258
4441
|
|
|
4259
4442
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
4260
|
-
import { z as
|
|
4443
|
+
import { z as z76 } from "zod";
|
|
4261
4444
|
|
|
4262
4445
|
// 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:
|
|
4446
|
+
import { z as z75 } from "zod";
|
|
4447
|
+
var PostPurchaseWidgetLinkedFlow = z75.object({
|
|
4448
|
+
id: z75.number(),
|
|
4449
|
+
name: z75.string()
|
|
4450
|
+
});
|
|
4451
|
+
var PostPurchaseWidget = z75.object({
|
|
4452
|
+
classification: z75.literal("post_purchase_offer_page").default("post_purchase_offer_page"),
|
|
4453
|
+
createdAtTime: z75.iso.datetime({ offset: true }).optional(),
|
|
4454
|
+
customEndpointName: z75.string().nullish(),
|
|
4455
|
+
id: z75.number().default(0),
|
|
4456
|
+
lastViewed: z75.iso.datetime({ offset: true }).nullish(),
|
|
4457
|
+
linkedCustomEndpointId: z75.number().nullish(),
|
|
4458
|
+
linkedFlows: z75.array(PostPurchaseWidgetLinkedFlow).optional(),
|
|
4459
|
+
name: z75.string().default(""),
|
|
4460
|
+
owner: z75.number().nullish(),
|
|
4278
4461
|
settings: PostPurchaseSettings
|
|
4279
4462
|
});
|
|
4280
4463
|
|
|
4281
4464
|
// src/schema/widgets/post-purchase-offer/postPurchaseOffer.ts
|
|
4282
|
-
var PostPurchaseOffer =
|
|
4283
|
-
|
|
4284
|
-
errors:
|
|
4285
|
-
message:
|
|
4286
|
-
successful:
|
|
4465
|
+
var PostPurchaseOffer = z76.discriminatedUnion("successful", [
|
|
4466
|
+
z76.strictObject({
|
|
4467
|
+
errors: z76.array(z76.object({ message: z76.string() })),
|
|
4468
|
+
message: z76.string(),
|
|
4469
|
+
successful: z76.literal(false)
|
|
4287
4470
|
}),
|
|
4288
|
-
|
|
4289
|
-
successful:
|
|
4471
|
+
z76.strictObject({
|
|
4472
|
+
successful: z76.literal(true),
|
|
4290
4473
|
widget: PostPurchaseWidget
|
|
4291
4474
|
})
|
|
4292
4475
|
]);
|
|
@@ -4979,23 +5162,23 @@ var QUANTITY_INPUT_TYPE = {
|
|
|
4979
5162
|
"buttons-manual-input": "number",
|
|
4980
5163
|
"dropdown-select": "select"
|
|
4981
5164
|
};
|
|
4982
|
-
var buildQuantityErrors = (
|
|
5165
|
+
var buildQuantityErrors = (quantity2) => {
|
|
4983
5166
|
const en = {
|
|
4984
|
-
...
|
|
4985
|
-
...
|
|
4986
|
-
...
|
|
5167
|
+
...quantity2.maxError && { max: normalizeTokens(quantity2.maxError, QUANTITY_ERROR_TOKENS) },
|
|
5168
|
+
...quantity2.minError && { min: normalizeTokens(quantity2.minError, QUANTITY_ERROR_TOKENS) },
|
|
5169
|
+
...quantity2.negativeError && { neg: normalizeTokens(quantity2.negativeError, QUANTITY_ERROR_TOKENS) }
|
|
4987
5170
|
};
|
|
4988
5171
|
return Object.keys(en).length ? { errorMessages: { en } } : {};
|
|
4989
5172
|
};
|
|
4990
5173
|
var buildQuantity = (settings) => {
|
|
4991
|
-
const
|
|
4992
|
-
if (!
|
|
4993
|
-
const inputType =
|
|
4994
|
-
const max = Math.min(Math.max(
|
|
4995
|
-
const min = Math.min(Math.max(
|
|
5174
|
+
const quantity2 = settings.quantityInputs;
|
|
5175
|
+
if (!quantity2?.enabled) return [];
|
|
5176
|
+
const inputType = quantity2.type ? QUANTITY_INPUT_TYPE[quantity2.type] : void 0;
|
|
5177
|
+
const max = Math.min(Math.max(quantity2.maxValue ?? 10, 1), 100);
|
|
5178
|
+
const min = Math.min(Math.max(quantity2.minValue ?? 1, 1), max);
|
|
4996
5179
|
return [
|
|
4997
5180
|
{
|
|
4998
|
-
...buildQuantityErrors(
|
|
5181
|
+
...buildQuantityErrors(quantity2),
|
|
4999
5182
|
...inputType && { inputType },
|
|
5000
5183
|
max,
|
|
5001
5184
|
min,
|
|
@@ -5005,7 +5188,7 @@ var buildQuantity = (settings) => {
|
|
|
5005
5188
|
};
|
|
5006
5189
|
var buildSubscriptionButton = (settings) => {
|
|
5007
5190
|
if (settings.productType !== "both" && settings.productType !== "subscription") return [];
|
|
5008
|
-
const
|
|
5191
|
+
const language3 = settings.language;
|
|
5009
5192
|
const slot = (buttonField, override) => ({
|
|
5010
5193
|
buttonField,
|
|
5011
5194
|
content: localizedContent(SWITCH_LABELS[buttonField], override, SWITCH_LABEL_TOKENS),
|
|
@@ -5019,9 +5202,9 @@ var buildSubscriptionButton = (settings) => {
|
|
|
5019
5202
|
...settings.productType === "subscription" && { disableDowngrade: true },
|
|
5020
5203
|
sections: [
|
|
5021
5204
|
slot("subscriptionOption", void 0),
|
|
5022
|
-
slot("switchToOneTimePurchase",
|
|
5023
|
-
slot("switchToSubscriptionNoDiscount",
|
|
5024
|
-
slot("switchToSubscriptionWithDiscount",
|
|
5205
|
+
slot("switchToOneTimePurchase", language3?.cartSwitchToOnetime),
|
|
5206
|
+
slot("switchToSubscriptionNoDiscount", language3?.upgradeToSubscription),
|
|
5207
|
+
slot("switchToSubscriptionWithDiscount", language3?.upgradeToSubscription)
|
|
5025
5208
|
],
|
|
5026
5209
|
sectionType: "button"
|
|
5027
5210
|
}
|
|
@@ -5076,11 +5259,11 @@ var buildOfferCard = (settings, horizontal) => {
|
|
|
5076
5259
|
const description = buildDescription(settings);
|
|
5077
5260
|
const reviews = buildReviews(settings);
|
|
5078
5261
|
const variants = buildVariants(settings);
|
|
5079
|
-
const
|
|
5262
|
+
const quantity2 = buildQuantity(settings);
|
|
5080
5263
|
const subscription = buildSubscriptionButton(settings);
|
|
5081
5264
|
const reveal = buildRevealButton(settings);
|
|
5082
5265
|
const addButton = buildAddButton(settings);
|
|
5083
|
-
const controls = [...description, ...
|
|
5266
|
+
const controls = [...description, ...quantity2, ...variants, ...subscription];
|
|
5084
5267
|
const info = detailBlock([title, ...variantTitle, ...reviews, price], horizontal, variantTitle.length > 0);
|
|
5085
5268
|
const card = (sections) => [
|
|
5086
5269
|
{
|
|
@@ -5134,9 +5317,9 @@ var buildCarouselNav = () => ({
|
|
|
5134
5317
|
sectionType: "layout"
|
|
5135
5318
|
});
|
|
5136
5319
|
var HEADER_FIELDS = ["superTitle", "title", "description"];
|
|
5137
|
-
var sanitizedHeader = (
|
|
5320
|
+
var sanitizedHeader = (language3) => Object.fromEntries(
|
|
5138
5321
|
HEADER_FIELDS.flatMap((field) => {
|
|
5139
|
-
const value =
|
|
5322
|
+
const value = language3?.[field];
|
|
5140
5323
|
const sanitized = value ? stripContentBlockHtml(normalizeTokens(value)) : "";
|
|
5141
5324
|
return sanitized ? [[field, sanitized]] : [];
|
|
5142
5325
|
})
|
|
@@ -5233,7 +5416,7 @@ var coerceIntegrations = (integrations) => Object.fromEntries(
|
|
|
5233
5416
|
return [key, value];
|
|
5234
5417
|
})
|
|
5235
5418
|
);
|
|
5236
|
-
var buildBanner = (
|
|
5419
|
+
var buildBanner = (language3) => language3?.successBannerEnabled ? [
|
|
5237
5420
|
{
|
|
5238
5421
|
/**
|
|
5239
5422
|
* The banner-level tag is the extraction/routing key on BOTH renderers (React CAB's
|
|
@@ -5246,7 +5429,7 @@ var buildBanner = (language2) => language2?.successBannerEnabled ? [
|
|
|
5246
5429
|
dismissible: true,
|
|
5247
5430
|
sections: [
|
|
5248
5431
|
{
|
|
5249
|
-
content: bannerMessageContent(
|
|
5432
|
+
content: bannerMessageContent(language3.successBannerMessageRte),
|
|
5250
5433
|
sectionType: "text"
|
|
5251
5434
|
},
|
|
5252
5435
|
{
|
|
@@ -5538,24 +5721,42 @@ export {
|
|
|
5538
5721
|
PopoverPosition,
|
|
5539
5722
|
PostPurchaseAmount,
|
|
5540
5723
|
PostPurchaseAppIdSchema,
|
|
5724
|
+
PostPurchaseAttributeProducts,
|
|
5541
5725
|
PostPurchaseBlock,
|
|
5542
5726
|
PostPurchaseChoice,
|
|
5727
|
+
PostPurchaseCollectionChoice,
|
|
5543
5728
|
PostPurchaseDiscount,
|
|
5544
5729
|
PostPurchaseExcludedProductIds,
|
|
5730
|
+
PostPurchaseGroupCatalog,
|
|
5731
|
+
PostPurchaseGroupChoice,
|
|
5732
|
+
PostPurchaseGroupDescription,
|
|
5733
|
+
PostPurchaseGroupSelection,
|
|
5545
5734
|
PostPurchaseOffer,
|
|
5735
|
+
PostPurchaseOfferEligibility,
|
|
5736
|
+
PostPurchaseOfferEligibilityContext,
|
|
5737
|
+
PostPurchaseOfferPresentation,
|
|
5738
|
+
PostPurchaseOfferSkipReason,
|
|
5546
5739
|
PostPurchaseOptions,
|
|
5547
5740
|
PostPurchaseOrderAttributes,
|
|
5548
5741
|
PostPurchaseOrderIdSchema,
|
|
5742
|
+
PostPurchaseOriginalVariants,
|
|
5549
5743
|
PostPurchasePlanAdjustment,
|
|
5550
5744
|
PostPurchasePlanCatalog,
|
|
5551
5745
|
PostPurchasePlanOption,
|
|
5552
5746
|
PostPurchasePreparation,
|
|
5553
5747
|
PostPurchasePrimaryImageSource,
|
|
5748
|
+
PostPurchaseProductCalculation,
|
|
5749
|
+
PostPurchaseProductChangeset,
|
|
5750
|
+
PostPurchaseProductCollectionView,
|
|
5751
|
+
PostPurchaseProductCosts,
|
|
5554
5752
|
PostPurchaseProductDisplay,
|
|
5555
5753
|
PostPurchaseProductGallery,
|
|
5556
5754
|
PostPurchaseProductId,
|
|
5557
5755
|
PostPurchaseProductSettings,
|
|
5558
5756
|
PostPurchaseProductSource,
|
|
5757
|
+
PostPurchaseProductView,
|
|
5758
|
+
PostPurchaseQuantityChoice,
|
|
5759
|
+
PostPurchaseQuantityPolicy,
|
|
5559
5760
|
PostPurchaseSettings,
|
|
5560
5761
|
PostPurchaseShadowReportFields,
|
|
5561
5762
|
PostPurchaseShadowReportSchema,
|
|
@@ -5567,6 +5768,7 @@ export {
|
|
|
5567
5768
|
PostPurchaseTimestampSchema,
|
|
5568
5769
|
PostPurchaseVariant,
|
|
5569
5770
|
PostPurchaseVariantCatalog,
|
|
5771
|
+
PostPurchaseVariantDefaultContext,
|
|
5570
5772
|
PostPurchaseVariantDefaultProduct,
|
|
5571
5773
|
PostPurchaseVariantDefaultSettings,
|
|
5572
5774
|
PostPurchaseVariantId,
|