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