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