@rebuy/rebuy 3.54.0 → 3.55.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/schema/postPurchaseProductSource.d.ts +4 -1
- package/dist/server/index.cjs +475 -429
- package/dist/server/index.d.ts +3 -2
- package/dist/server/index.mjs +475 -429
- package/dist/server/normalizePostPurchaseCollection.d.ts +11 -2
- package/dist/server/normalizePostPurchaseProduct.d.ts +260 -1
- package/dist/server/postPurchasePlanCatalog.d.ts +5 -0
- package/dist/server/readPostPurchaseProductSource.d.ts +70 -0
- package/dist/server/shared.d.ts +2 -1
- package/package.json +1 -1
package/dist/server/index.cjs
CHANGED
|
@@ -64,6 +64,7 @@ __export(server_exports, {
|
|
|
64
64
|
preparePostPurchaseSubscription: () => preparePostPurchaseSubscription,
|
|
65
65
|
preparePostPurchaseView: () => preparePostPurchaseView,
|
|
66
66
|
readPostPurchaseGroupSelection: () => readPostPurchaseGroupSelection,
|
|
67
|
+
readPostPurchaseProductSource: () => readPostPurchaseProductSource,
|
|
67
68
|
readPostPurchaseQuantity: () => readPostPurchaseQuantity,
|
|
68
69
|
translateAnalyticsEvent: () => translateAnalyticsEvent,
|
|
69
70
|
validateGifts: () => validateGifts
|
|
@@ -6080,7 +6081,7 @@ var validateGifts = async (input, ctx) => {
|
|
|
6080
6081
|
|
|
6081
6082
|
// src/server/normalizePostPurchaseProduct.ts
|
|
6082
6083
|
var import_compat7 = require("es-toolkit/compat");
|
|
6083
|
-
var
|
|
6084
|
+
var import_zod46 = require("zod");
|
|
6084
6085
|
|
|
6085
6086
|
// src/schema/postPurchaseProductSettings.ts
|
|
6086
6087
|
var import_zod44 = require("zod");
|
|
@@ -6161,18 +6162,54 @@ var PostPurchaseProductSettings = PostPurchaseSettings.pick({
|
|
|
6161
6162
|
subscription: import_zod44.z.unknown().default(PostPurchaseSettings.shape.subscription.parse(void 0))
|
|
6162
6163
|
});
|
|
6163
6164
|
|
|
6165
|
+
// src/server/readPostPurchaseProductSource.ts
|
|
6166
|
+
var import_zod45 = require("zod");
|
|
6167
|
+
var Envelope = PostPurchaseProductSource.extend({ data: import_zod45.z.array(import_zod45.z.unknown()) });
|
|
6168
|
+
var Product3 = PostPurchaseProductSource.shape.data.element;
|
|
6169
|
+
var Identified = import_zod45.z.object({ id: PostPurchaseProductId });
|
|
6170
|
+
var heard = /* @__PURE__ */ new WeakMap();
|
|
6171
|
+
var firstHearing = (response, report) => {
|
|
6172
|
+
const reporters = heard.get(response) ?? /* @__PURE__ */ new WeakSet();
|
|
6173
|
+
heard.set(response, reporters);
|
|
6174
|
+
if (reporters.has(report)) return false;
|
|
6175
|
+
reporters.add(report);
|
|
6176
|
+
return true;
|
|
6177
|
+
};
|
|
6178
|
+
var readPostPurchaseProductSource = (response, report) => {
|
|
6179
|
+
const { data, metadata } = Envelope.parse(deepCamelCase(response));
|
|
6180
|
+
const drift = [];
|
|
6181
|
+
const dropped = [];
|
|
6182
|
+
const products = data.flatMap((raw, productIndex) => {
|
|
6183
|
+
const parsed = Product3.safeParse(raw);
|
|
6184
|
+
if (parsed.success) return [{ product: parsed.data, productIndex }];
|
|
6185
|
+
const id = Identified.safeParse(raw);
|
|
6186
|
+
const issues = parsed.error.issues.map((issue) => ({ ...issue, path: ["data", productIndex, ...issue.path] }));
|
|
6187
|
+
const path = issues[0].path.join(".");
|
|
6188
|
+
dropped.push({ issues, productIndex });
|
|
6189
|
+
drift.push({
|
|
6190
|
+
detail: `Dropped post-purchase product${id.success ? ` ${id.data.id}` : ""}: ${path}`,
|
|
6191
|
+
kind: "product"
|
|
6192
|
+
});
|
|
6193
|
+
return [];
|
|
6194
|
+
});
|
|
6195
|
+
if (report && drift.length && firstHearing(response, report)) drift.forEach((event) => report(event));
|
|
6196
|
+
return { dropped, metadata, products };
|
|
6197
|
+
};
|
|
6198
|
+
|
|
6164
6199
|
// src/server/normalizePostPurchaseProduct.ts
|
|
6165
|
-
var
|
|
6200
|
+
var normalizePostPurchaseSource = (settings, response, report) => {
|
|
6166
6201
|
const original = PostPurchaseProductSettings.parse(deepCamelCase(settings));
|
|
6167
|
-
const {
|
|
6202
|
+
const { dropped, metadata, products } = readPostPurchaseProductSource(response, report);
|
|
6168
6203
|
const overrides = Object.fromEntries(Object.entries(metadata.widget).filter(([key]) => key in original));
|
|
6169
|
-
const discount =
|
|
6204
|
+
const discount = import_zod46.z.object({ type: import_zod46.z.string() }).safeParse(overrides.discount);
|
|
6170
6205
|
if (discount.success && discount.data.type === "fixed") {
|
|
6171
|
-
overrides.discount = { ...
|
|
6206
|
+
overrides.discount = { ...import_zod46.z.record(import_zod46.z.string(), import_zod46.z.unknown()).parse(overrides.discount), type: "fixed_amount" };
|
|
6172
6207
|
}
|
|
6173
6208
|
const effective = PostPurchaseProductSettings.parse((0, import_compat7.merge)({}, original, overrides));
|
|
6174
|
-
|
|
6209
|
+
const data = products.map(({ product }) => product);
|
|
6210
|
+
return { dropped, normalized: { data, effective, metadata, original }, products };
|
|
6175
6211
|
};
|
|
6212
|
+
var normalizePostPurchaseProduct = (settings, response, report) => normalizePostPurchaseSource(settings, response, report).normalized;
|
|
6176
6213
|
|
|
6177
6214
|
// src/pricing/amountToCents.ts
|
|
6178
6215
|
var round = (value, precision = 0) => {
|
|
@@ -6197,52 +6234,52 @@ var postPurchasePlanDiscountPercentage = (price, adjustment) => {
|
|
|
6197
6234
|
};
|
|
6198
6235
|
|
|
6199
6236
|
// src/schema/postPurchasePlanCatalog.ts
|
|
6200
|
-
var
|
|
6237
|
+
var import_zod49 = require("zod");
|
|
6201
6238
|
|
|
6202
6239
|
// src/schema/postPurchasePlanAdjustment.ts
|
|
6203
|
-
var
|
|
6240
|
+
var import_zod48 = require("zod");
|
|
6204
6241
|
|
|
6205
6242
|
// src/schema/postPurchaseDiscount.ts
|
|
6206
|
-
var
|
|
6207
|
-
var Discount =
|
|
6208
|
-
amount:
|
|
6209
|
-
title:
|
|
6210
|
-
type:
|
|
6243
|
+
var import_zod47 = require("zod");
|
|
6244
|
+
var Discount = import_zod47.z.object({
|
|
6245
|
+
amount: import_zod47.z.number().nonnegative(),
|
|
6246
|
+
title: import_zod47.z.string(),
|
|
6247
|
+
type: import_zod47.z.enum(["none", "fixed_amount", "percentage"])
|
|
6211
6248
|
});
|
|
6212
6249
|
var validPostPurchaseDiscount = (discount) => discount.type !== "percentage" || discount.amount <= 100;
|
|
6213
6250
|
var PostPurchaseDiscount = Discount.refine(validPostPurchaseDiscount);
|
|
6214
6251
|
|
|
6215
6252
|
// src/schema/postPurchasePlanAdjustment.ts
|
|
6216
|
-
var PostPurchasePlanAdjustment =
|
|
6253
|
+
var PostPurchasePlanAdjustment = import_zod48.z.object({
|
|
6217
6254
|
amount: PostPurchaseDiscount.shape.amount,
|
|
6218
|
-
type:
|
|
6255
|
+
type: import_zod48.z.enum(["percentage", "fixed_amount", "price"])
|
|
6219
6256
|
}).refine(({ amount: amount2, type }) => type === "price" || validPostPurchaseDiscount({ amount: amount2, type }));
|
|
6220
6257
|
|
|
6221
6258
|
// src/schema/postPurchasePlanCatalog.ts
|
|
6222
|
-
var PostPurchasePlanOption =
|
|
6259
|
+
var PostPurchasePlanOption = import_zod49.z.object({
|
|
6223
6260
|
adjustment: PostPurchasePlanAdjustment.optional(),
|
|
6224
6261
|
/** cab-checkout's `discountPercentage`: the plan's own whole-percent saving on the regular price (`{{subscriptionDiscount}}`). */
|
|
6225
|
-
discountPercentage:
|
|
6226
|
-
id:
|
|
6227
|
-
intervalFrequency:
|
|
6228
|
-
intervalLabel:
|
|
6229
|
-
name:
|
|
6262
|
+
discountPercentage: import_zod49.z.number().int().min(0).max(100).optional(),
|
|
6263
|
+
id: import_zod49.z.number().int().positive(),
|
|
6264
|
+
intervalFrequency: import_zod49.z.string().regex(/^[1-9]\d*$/).optional(),
|
|
6265
|
+
intervalLabel: import_zod49.z.string().min(1),
|
|
6266
|
+
name: import_zod49.z.string().min(1)
|
|
6230
6267
|
});
|
|
6231
|
-
var PostPurchasePlanCatalog =
|
|
6232
|
-
plans:
|
|
6233
|
-
productId:
|
|
6234
|
-
requiresSellingPlan:
|
|
6235
|
-
variantId:
|
|
6268
|
+
var PostPurchasePlanCatalog = import_zod49.z.object({
|
|
6269
|
+
plans: import_zod49.z.array(PostPurchasePlanOption),
|
|
6270
|
+
productId: import_zod49.z.number().int().positive(),
|
|
6271
|
+
requiresSellingPlan: import_zod49.z.boolean(),
|
|
6272
|
+
variantId: import_zod49.z.number().int().positive()
|
|
6236
6273
|
});
|
|
6237
6274
|
|
|
6238
6275
|
// src/server/postPurchaseLegacyPlans.ts
|
|
6239
|
-
var
|
|
6276
|
+
var import_zod51 = require("zod");
|
|
6240
6277
|
|
|
6241
6278
|
// src/server/postPurchasePlanAdjustment.ts
|
|
6242
|
-
var
|
|
6243
|
-
var SourceAdjustment =
|
|
6279
|
+
var import_zod50 = require("zod");
|
|
6280
|
+
var SourceAdjustment = import_zod50.z.object({
|
|
6244
6281
|
amount: PostPurchaseProductSettings.shape.discount.shape.amount.unwrap(),
|
|
6245
|
-
type:
|
|
6282
|
+
type: import_zod50.z.enum(["percentage", "fixed_amount", "amount", "price", "none", "fixed"])
|
|
6246
6283
|
});
|
|
6247
6284
|
var readPostPurchasePlanAdjustment = (raw) => {
|
|
6248
6285
|
const source2 = SourceAdjustment.parse(raw);
|
|
@@ -6261,13 +6298,13 @@ var readPostPurchasePlanAdjustment = (raw) => {
|
|
|
6261
6298
|
var Plan = PostPurchasePlanOption.pick({ id: true, name: true }).extend({
|
|
6262
6299
|
orderIntervalFrequency: PostPurchasePlanOption.shape.intervalFrequency.unwrap(),
|
|
6263
6300
|
orderIntervalUnitType: PostPurchasePlanOption.shape.intervalLabel,
|
|
6264
|
-
shopifyVariantId:
|
|
6301
|
+
shopifyVariantId: import_zod51.z.string().regex(/^[1-9]\d*$/).nullish()
|
|
6265
6302
|
});
|
|
6266
|
-
var Group =
|
|
6267
|
-
discountAmount:
|
|
6268
|
-
discountType:
|
|
6269
|
-
id:
|
|
6270
|
-
sellingPlans:
|
|
6303
|
+
var Group = import_zod51.z.object({
|
|
6304
|
+
discountAmount: import_zod51.z.unknown(),
|
|
6305
|
+
discountType: import_zod51.z.unknown(),
|
|
6306
|
+
id: import_zod51.z.number().int().positive(),
|
|
6307
|
+
sellingPlans: import_zod51.z.array(import_zod51.z.object({ shopifyVariantId: Plan.shape.shopifyVariantId }).passthrough())
|
|
6271
6308
|
});
|
|
6272
6309
|
var readPostPurchaseLegacyPlans = (raw, variantId) => {
|
|
6273
6310
|
const group = Group.pick({ id: true, sellingPlans: true }).parse(raw);
|
|
@@ -6288,21 +6325,21 @@ var readPostPurchaseLegacyPlans = (raw, variantId) => {
|
|
|
6288
6325
|
};
|
|
6289
6326
|
|
|
6290
6327
|
// src/server/postPurchaseModernPlans.ts
|
|
6291
|
-
var
|
|
6292
|
-
var Groups =
|
|
6293
|
-
|
|
6294
|
-
id:
|
|
6295
|
-
sellingPlans:
|
|
6328
|
+
var import_zod52 = require("zod");
|
|
6329
|
+
var Groups = import_zod52.z.array(
|
|
6330
|
+
import_zod52.z.object({
|
|
6331
|
+
id: import_zod52.z.string().min(1),
|
|
6332
|
+
sellingPlans: import_zod52.z.unknown()
|
|
6296
6333
|
})
|
|
6297
6334
|
);
|
|
6298
|
-
var Allocations =
|
|
6299
|
-
var Plans =
|
|
6335
|
+
var Allocations = import_zod52.z.array(import_zod52.z.object({ sellingPlanGroupId: import_zod52.z.string().min(1) })).default([]);
|
|
6336
|
+
var Plans = import_zod52.z.array(
|
|
6300
6337
|
PostPurchasePlanOption.pick({ id: true, name: true }).extend({
|
|
6301
|
-
options:
|
|
6302
|
-
priceAdjustments:
|
|
6338
|
+
options: import_zod52.z.array(import_zod52.z.object({ value: import_zod52.z.string().min(1) })).min(1),
|
|
6339
|
+
priceAdjustments: import_zod52.z.array(import_zod52.z.unknown())
|
|
6303
6340
|
})
|
|
6304
6341
|
);
|
|
6305
|
-
var FirstAdjustment =
|
|
6342
|
+
var FirstAdjustment = import_zod52.z.object({
|
|
6306
6343
|
value: PostPurchaseProductSettings.shape.discount.shape.amount.unwrap(),
|
|
6307
6344
|
valueType: PostPurchasePlanAdjustment.shape.type
|
|
6308
6345
|
});
|
|
@@ -6325,8 +6362,9 @@ var readPostPurchaseModernPlans = (raw, allocations) => {
|
|
|
6325
6362
|
|
|
6326
6363
|
// src/server/postPurchasePlanCatalog.ts
|
|
6327
6364
|
var projectPostPurchasePlanCatalog = (normalized, report) => {
|
|
6365
|
+
const { data } = normalized;
|
|
6366
|
+
if (data.length === 1 && data[0].variants.length > 1) return null;
|
|
6328
6367
|
try {
|
|
6329
|
-
const { data } = normalized;
|
|
6330
6368
|
if (data.length !== 1 || data[0].variants.length !== 1) throw new Error("Ambiguous product");
|
|
6331
6369
|
const product = data[0];
|
|
6332
6370
|
const variant2 = product.variants[0];
|
|
@@ -6357,72 +6395,72 @@ var projectPostPurchasePlanCatalog = (normalized, report) => {
|
|
|
6357
6395
|
};
|
|
6358
6396
|
|
|
6359
6397
|
// src/schema/postPurchaseSubscriptionProduct.ts
|
|
6360
|
-
var
|
|
6398
|
+
var import_zod58 = require("zod");
|
|
6361
6399
|
|
|
6362
6400
|
// src/schema/postPurchaseProduct.ts
|
|
6363
|
-
var
|
|
6401
|
+
var import_zod57 = require("zod");
|
|
6364
6402
|
|
|
6365
6403
|
// src/schema/postPurchaseProductDisplay.ts
|
|
6366
|
-
var
|
|
6404
|
+
var import_zod55 = require("zod");
|
|
6367
6405
|
|
|
6368
6406
|
// src/schema/postPurchaseProductGallery.ts
|
|
6369
|
-
var
|
|
6370
|
-
var PostPurchaseProductGallery =
|
|
6407
|
+
var import_zod53 = require("zod");
|
|
6408
|
+
var PostPurchaseProductGallery = import_zod53.z.object({
|
|
6371
6409
|
/**
|
|
6372
6410
|
* Show the thumbnail row: the product had more than one image before `images` was capped at the
|
|
6373
6411
|
* sub-image limit, and that limit allows at least one thumbnail. It stays true when the cap leaves one
|
|
6374
6412
|
* image (legacy checks the count before slicing). Older replies omit it; fall back to `images.length > 1`.
|
|
6375
6413
|
*/
|
|
6376
|
-
hasMultiple:
|
|
6377
|
-
images:
|
|
6378
|
-
|
|
6379
|
-
description:
|
|
6380
|
-
id:
|
|
6381
|
-
source:
|
|
6382
|
-
thumbnail:
|
|
6414
|
+
hasMultiple: import_zod53.z.boolean().optional(),
|
|
6415
|
+
images: import_zod53.z.array(
|
|
6416
|
+
import_zod53.z.object({
|
|
6417
|
+
description: import_zod53.z.string(),
|
|
6418
|
+
id: import_zod53.z.number().int().positive(),
|
|
6419
|
+
source: import_zod53.z.string(),
|
|
6420
|
+
thumbnail: import_zod53.z.string()
|
|
6383
6421
|
})
|
|
6384
6422
|
),
|
|
6385
|
-
selectedImageId:
|
|
6423
|
+
selectedImageId: import_zod53.z.number().int().positive().optional()
|
|
6386
6424
|
});
|
|
6387
6425
|
|
|
6388
6426
|
// src/schema/postPurchaseProductReviews.ts
|
|
6389
|
-
var
|
|
6390
|
-
var decimal =
|
|
6391
|
-
|
|
6392
|
-
|
|
6427
|
+
var import_zod54 = require("zod");
|
|
6428
|
+
var decimal = import_zod54.z.union([
|
|
6429
|
+
import_zod54.z.number(),
|
|
6430
|
+
import_zod54.z.string().regex(/^\d+(?:\.\d+)?$/).transform(Number)
|
|
6393
6431
|
]);
|
|
6394
|
-
var PostPurchaseCommonReviewRating =
|
|
6432
|
+
var PostPurchaseCommonReviewRating = import_zod54.z.object({ value: decimal.pipe(import_zod54.z.number().min(0).max(5)) });
|
|
6395
6433
|
var PostPurchaseKlaviyoReviewRating = PostPurchaseCommonReviewRating.extend({
|
|
6396
6434
|
// Legacy validates key presence, then displays the raw value on five stars without rescaling.
|
|
6397
|
-
scale_max:
|
|
6398
|
-
scale_min:
|
|
6435
|
+
scale_max: import_zod54.z.unknown().nonoptional(),
|
|
6436
|
+
scale_min: import_zod54.z.unknown().nonoptional()
|
|
6399
6437
|
});
|
|
6400
|
-
var PostPurchaseReviewCount =
|
|
6438
|
+
var PostPurchaseReviewCount = import_zod54.z.string().regex(/^\d+(?:\.\d+)?$/).transform(Number).pipe(import_zod54.z.number().int().nonnegative());
|
|
6401
6439
|
var PostPurchaseReviewStyles = PostPurchaseSettings.shape.styles.unwrap().extend({
|
|
6402
|
-
strokeWidth: decimal.pipe(
|
|
6440
|
+
strokeWidth: decimal.pipe(import_zod54.z.number().nonnegative()).default(1)
|
|
6403
6441
|
}).prefault({});
|
|
6404
|
-
var PostPurchaseProductReviews =
|
|
6405
|
-
color:
|
|
6406
|
-
rating:
|
|
6407
|
-
reviewCount:
|
|
6408
|
-
reviewsPlural:
|
|
6409
|
-
reviewsSingular:
|
|
6410
|
-
size:
|
|
6411
|
-
strokeColor:
|
|
6412
|
-
strokeWidth:
|
|
6442
|
+
var PostPurchaseProductReviews = import_zod54.z.object({
|
|
6443
|
+
color: import_zod54.z.string(),
|
|
6444
|
+
rating: import_zod54.z.number().positive().max(5),
|
|
6445
|
+
reviewCount: import_zod54.z.number().int().nonnegative(),
|
|
6446
|
+
reviewsPlural: import_zod54.z.string(),
|
|
6447
|
+
reviewsSingular: import_zod54.z.string(),
|
|
6448
|
+
size: import_zod54.z.enum(["small", "medium", "large"]),
|
|
6449
|
+
strokeColor: import_zod54.z.string(),
|
|
6450
|
+
strokeWidth: import_zod54.z.number().nonnegative()
|
|
6413
6451
|
});
|
|
6414
6452
|
|
|
6415
6453
|
// src/schema/postPurchaseProductDisplay.ts
|
|
6416
6454
|
var language = PostPurchaseSettings.shape.language;
|
|
6417
|
-
var PostPurchasePrimaryImageSource =
|
|
6455
|
+
var PostPurchasePrimaryImageSource = import_zod55.z.string().default(
|
|
6418
6456
|
"https://cdn.shopify.com/shopifycloud/shopify/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c.gif"
|
|
6419
6457
|
);
|
|
6420
|
-
var PostPurchaseProductDisplay =
|
|
6458
|
+
var PostPurchaseProductDisplay = import_zod55.z.object({
|
|
6421
6459
|
descriptionDocument: TiptapDocument.optional(),
|
|
6422
6460
|
discountedFrom: PostPurchaseSettings.shape.discountedFrom,
|
|
6423
6461
|
gallery: PostPurchaseProductGallery.optional(),
|
|
6424
6462
|
language: language.pick({ description: true, descriptionEnabled: true }),
|
|
6425
|
-
primaryImage:
|
|
6463
|
+
primaryImage: import_zod55.z.object({ description: import_zod55.z.string(), source: import_zod55.z.string() }),
|
|
6426
6464
|
productOptions: PostPurchaseSettings.shape.productOptions.pick({
|
|
6427
6465
|
showDeclineAll: true,
|
|
6428
6466
|
showShipping: true,
|
|
@@ -6437,14 +6475,14 @@ var PostPurchaseProductDisplay = import_zod54.z.object({
|
|
|
6437
6475
|
});
|
|
6438
6476
|
|
|
6439
6477
|
// src/schema/postPurchaseSubscription.ts
|
|
6440
|
-
var
|
|
6441
|
-
var PostPurchaseSubscriptionTerms =
|
|
6478
|
+
var import_zod56 = require("zod");
|
|
6479
|
+
var PostPurchaseSubscriptionTerms = import_zod56.z.object({
|
|
6442
6480
|
adjustment: PostPurchasePlanAdjustment.optional(),
|
|
6443
|
-
initialShippingPrice:
|
|
6444
|
-
intervalLabel:
|
|
6445
|
-
name:
|
|
6446
|
-
recurringShippingPrice:
|
|
6447
|
-
shippingOption:
|
|
6481
|
+
initialShippingPrice: import_zod56.z.number().nonnegative(),
|
|
6482
|
+
intervalLabel: import_zod56.z.string().min(1),
|
|
6483
|
+
name: import_zod56.z.string().min(1),
|
|
6484
|
+
recurringShippingPrice: import_zod56.z.number().nonnegative(),
|
|
6485
|
+
shippingOption: import_zod56.z.object({ presentmentTitle: import_zod56.z.string(), title: import_zod56.z.string() })
|
|
6448
6486
|
});
|
|
6449
6487
|
|
|
6450
6488
|
// src/schema/postPurchaseProduct.ts
|
|
@@ -6454,52 +6492,52 @@ var PostPurchaseVariant = OfferProduct.shape.variants.element.pick({ id: true, t
|
|
|
6454
6492
|
id: PostPurchaseVariantId,
|
|
6455
6493
|
price: PostPurchaseAmount
|
|
6456
6494
|
});
|
|
6457
|
-
var PreparedPostPurchaseProduct =
|
|
6495
|
+
var PreparedPostPurchaseProduct = import_zod57.z.object({
|
|
6458
6496
|
display: PostPurchaseProductDisplay,
|
|
6459
|
-
labels:
|
|
6497
|
+
labels: import_zod57.z.object({
|
|
6460
6498
|
declineAll: global.declineAll,
|
|
6461
|
-
free:
|
|
6499
|
+
free: import_zod57.z.string(),
|
|
6462
6500
|
notAvailable: global.notAvailable,
|
|
6463
|
-
payNow:
|
|
6464
|
-
quantity:
|
|
6501
|
+
payNow: import_zod57.z.string(),
|
|
6502
|
+
quantity: import_zod57.z.string(),
|
|
6465
6503
|
recurringShipping: global.recurringShipping,
|
|
6466
6504
|
recurringSubtotal: global.recurringSubtotal,
|
|
6467
|
-
save:
|
|
6468
|
-
shipping:
|
|
6469
|
-
subtotal:
|
|
6470
|
-
taxes:
|
|
6471
|
-
total:
|
|
6505
|
+
save: import_zod57.z.string(),
|
|
6506
|
+
shipping: import_zod57.z.string(),
|
|
6507
|
+
subtotal: import_zod57.z.string(),
|
|
6508
|
+
taxes: import_zod57.z.string(),
|
|
6509
|
+
total: import_zod57.z.string()
|
|
6472
6510
|
}),
|
|
6473
6511
|
product: OfferProduct.pick({ description: true, id: true, image: true, title: true }).extend({
|
|
6474
6512
|
description: OfferProduct.shape.description.nullable(),
|
|
6475
6513
|
id: PostPurchaseProductId,
|
|
6476
6514
|
variant: PostPurchaseVariant
|
|
6477
6515
|
}),
|
|
6478
|
-
selection:
|
|
6516
|
+
selection: import_zod57.z.object({
|
|
6479
6517
|
productId: PostPurchaseProductId,
|
|
6480
|
-
quantity:
|
|
6481
|
-
sellingPlanId:
|
|
6518
|
+
quantity: import_zod57.z.number().int().positive(),
|
|
6519
|
+
sellingPlanId: import_zod57.z.number().int().positive().optional(),
|
|
6482
6520
|
variantId: PostPurchaseVariantId
|
|
6483
6521
|
}),
|
|
6484
|
-
status:
|
|
6485
|
-
terms:
|
|
6522
|
+
status: import_zod57.z.literal("prepared"),
|
|
6523
|
+
terms: import_zod57.z.object({
|
|
6486
6524
|
discount: PostPurchaseDiscount,
|
|
6487
|
-
shipping:
|
|
6488
|
-
amount:
|
|
6489
|
-
title:
|
|
6490
|
-
type:
|
|
6525
|
+
shipping: import_zod57.z.object({
|
|
6526
|
+
amount: import_zod57.z.number().nonnegative(),
|
|
6527
|
+
title: import_zod57.z.string(),
|
|
6528
|
+
type: import_zod57.z.enum(["free", "fixed_amount"])
|
|
6491
6529
|
}),
|
|
6492
6530
|
subscription: PostPurchaseSubscriptionTerms.optional()
|
|
6493
6531
|
})
|
|
6494
6532
|
});
|
|
6495
|
-
var PostPurchasePreparation =
|
|
6533
|
+
var PostPurchasePreparation = import_zod57.z.discriminatedUnion("status", [
|
|
6496
6534
|
PreparedPostPurchaseProduct,
|
|
6497
|
-
|
|
6535
|
+
import_zod57.z.object({ reason: import_zod57.z.string(), status: import_zod57.z.literal("unsupported") })
|
|
6498
6536
|
]);
|
|
6499
6537
|
|
|
6500
6538
|
// src/schema/postPurchaseSubscriptionProduct.ts
|
|
6501
6539
|
var PreparedPostPurchaseSubscription = PreparedPostPurchaseProduct.extend({
|
|
6502
|
-
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId:
|
|
6540
|
+
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId: import_zod58.z.number().int().positive() }),
|
|
6503
6541
|
terms: PreparedPostPurchaseProduct.shape.terms.extend({
|
|
6504
6542
|
subscription: PostPurchaseSubscriptionTerms
|
|
6505
6543
|
}).refine(
|
|
@@ -6558,7 +6596,7 @@ var subscriptionUnavailable = (normalized, plan, allowCollection, quantity3) =>
|
|
|
6558
6596
|
};
|
|
6559
6597
|
|
|
6560
6598
|
// src/server/postPurchaseProductDisplay.ts
|
|
6561
|
-
var
|
|
6599
|
+
var import_zod60 = require("zod");
|
|
6562
6600
|
|
|
6563
6601
|
// src/server/postPurchasePrimaryImage.ts
|
|
6564
6602
|
var postPurchasePrimaryImage = (product) => {
|
|
@@ -6584,7 +6622,7 @@ var postPurchaseProductGallery = (product, limit) => {
|
|
|
6584
6622
|
};
|
|
6585
6623
|
|
|
6586
6624
|
// src/transforms/postPurchase/convertDescriptionRte.ts
|
|
6587
|
-
var
|
|
6625
|
+
var import_zod59 = require("zod");
|
|
6588
6626
|
var alignments = { center: "center", left: "start", right: "end" };
|
|
6589
6627
|
var colors = ["critical", "subdued", "success", "warning"];
|
|
6590
6628
|
var sizes2 = ["extraSmall", "small", "medium", "large", "extraLarge"];
|
|
@@ -6596,19 +6634,19 @@ var spacings2 = {
|
|
|
6596
6634
|
xloose: "extraLoose",
|
|
6597
6635
|
xtight: "extraTight"
|
|
6598
6636
|
};
|
|
6599
|
-
var Block =
|
|
6600
|
-
attrs:
|
|
6601
|
-
content:
|
|
6602
|
-
type:
|
|
6603
|
-
});
|
|
6604
|
-
var Run =
|
|
6605
|
-
var Inline =
|
|
6606
|
-
attrs:
|
|
6607
|
-
color:
|
|
6608
|
-
emphasis:
|
|
6609
|
-
size:
|
|
6637
|
+
var Block = import_zod59.z.object({
|
|
6638
|
+
attrs: import_zod59.z.object({ alignment: import_zod59.z.enum(["left", "center", "right"]).optional().catch(void 0) }).catch({}),
|
|
6639
|
+
content: import_zod59.z.array(import_zod59.z.unknown()).catch([]),
|
|
6640
|
+
type: import_zod59.z.literal("ShopifyTextBlock")
|
|
6641
|
+
});
|
|
6642
|
+
var Run = import_zod59.z.object({ marks: import_zod59.z.array(import_zod59.z.unknown()).catch([]), text: import_zod59.z.string().min(1), type: import_zod59.z.literal("text") });
|
|
6643
|
+
var Inline = import_zod59.z.object({
|
|
6644
|
+
attrs: import_zod59.z.object({
|
|
6645
|
+
color: import_zod59.z.enum(colors).optional().catch(void 0),
|
|
6646
|
+
emphasis: import_zod59.z.array(import_zod59.z.unknown()).catch([]),
|
|
6647
|
+
size: import_zod59.z.enum(sizes2).optional().catch(void 0)
|
|
6610
6648
|
}),
|
|
6611
|
-
type:
|
|
6649
|
+
type: import_zod59.z.literal("ShopifyTextInline")
|
|
6612
6650
|
});
|
|
6613
6651
|
var marks = (raw) => {
|
|
6614
6652
|
const found = raw.map((mark) => Inline.safeParse(mark)).find(({ success }) => success)?.data;
|
|
@@ -6641,7 +6679,7 @@ var convertDescriptionRte = (rte, spacing) => TiptapDocument.parse({
|
|
|
6641
6679
|
});
|
|
6642
6680
|
|
|
6643
6681
|
// src/server/postPurchaseProductDisplay.ts
|
|
6644
|
-
var ResponseLanguage =
|
|
6682
|
+
var ResponseLanguage = import_zod60.z.object({ description: PostPurchaseProductDisplay.shape.responseDescription }).default({ description: "" });
|
|
6645
6683
|
var projectPostPurchaseProductDisplay = (effective, metadata, product) => PostPurchaseProductDisplay.parse({
|
|
6646
6684
|
descriptionDocument: effective.language.descriptionRte && convertDescriptionRte(effective.language.descriptionRte, effective.language.descriptionSpacing),
|
|
6647
6685
|
discountedFrom: effective.discountedFrom,
|
|
@@ -6654,16 +6692,16 @@ var projectPostPurchaseProductDisplay = (effective, metadata, product) => PostPu
|
|
|
6654
6692
|
});
|
|
6655
6693
|
|
|
6656
6694
|
// src/server/postPurchaseReviewData.ts
|
|
6657
|
-
var
|
|
6695
|
+
var import_zod65 = require("zod");
|
|
6658
6696
|
|
|
6659
6697
|
// src/server/postPurchaseJudgeMeReviews.ts
|
|
6660
|
-
var
|
|
6698
|
+
var import_zod62 = require("zod");
|
|
6661
6699
|
|
|
6662
6700
|
// src/server/postPurchaseReviewFields.ts
|
|
6663
|
-
var
|
|
6664
|
-
var Field =
|
|
6701
|
+
var import_zod61 = require("zod");
|
|
6702
|
+
var Field = import_zod61.z.object({ key: import_zod61.z.string(), namespace: import_zod61.z.string(), value: import_zod61.z.unknown().optional() });
|
|
6665
6703
|
var reviewFields = (raw) => {
|
|
6666
|
-
const fields4 =
|
|
6704
|
+
const fields4 = import_zod61.z.array(import_zod61.z.unknown()).parse(raw).flatMap((field) => {
|
|
6667
6705
|
const parsed = Field.safeParse(field);
|
|
6668
6706
|
return parsed.success ? [parsed.data] : [];
|
|
6669
6707
|
});
|
|
@@ -6688,7 +6726,7 @@ var readJudgeMeReviews = (find) => {
|
|
|
6688
6726
|
const field = find("judgeme", "badge");
|
|
6689
6727
|
if (!field) return null;
|
|
6690
6728
|
return readReviewField(field, (value) => {
|
|
6691
|
-
const html =
|
|
6729
|
+
const html = import_zod62.z.string().parse(value);
|
|
6692
6730
|
const rating = html.match(/data-average-rating=['"](\d+(?:\.\d+)?)['"]/);
|
|
6693
6731
|
const count = html.match(/data-number-of-reviews=['"](\d+)['"]/);
|
|
6694
6732
|
if (!rating || !count) throw new Error("Unreadable Judge.me attributes");
|
|
@@ -6700,20 +6738,20 @@ var readJudgeMeReviews = (find) => {
|
|
|
6700
6738
|
};
|
|
6701
6739
|
|
|
6702
6740
|
// src/server/postPurchaseOkendoReviews.ts
|
|
6703
|
-
var
|
|
6704
|
-
var Summary =
|
|
6741
|
+
var import_zod63 = require("zod");
|
|
6742
|
+
var Summary = import_zod63.z.object({
|
|
6705
6743
|
reviewAverageValue: PostPurchaseCommonReviewRating.shape.value,
|
|
6706
|
-
reviewCount:
|
|
6744
|
+
reviewCount: import_zod63.z.union([PostPurchaseProductReviews.shape.reviewCount, PostPurchaseReviewCount])
|
|
6707
6745
|
});
|
|
6708
6746
|
var readOkendoReviews = (find) => {
|
|
6709
6747
|
const field = find("okendo", "summaryData");
|
|
6710
6748
|
if (!field) return null;
|
|
6711
|
-
const summary = readReviewField(field, (value) => Summary.parse(JSON.parse(
|
|
6749
|
+
const summary = readReviewField(field, (value) => Summary.parse(JSON.parse(import_zod63.z.string().parse(value))));
|
|
6712
6750
|
return { rating: summary.reviewAverageValue, reviewCount: summary.reviewCount };
|
|
6713
6751
|
};
|
|
6714
6752
|
|
|
6715
6753
|
// src/server/postPurchaseScalarReviews.ts
|
|
6716
|
-
var
|
|
6754
|
+
var import_zod64 = require("zod");
|
|
6717
6755
|
var readScalarReviews = (find, namespace, ratingKey, countKey) => {
|
|
6718
6756
|
const rating = find(namespace, ratingKey);
|
|
6719
6757
|
const count = find(namespace, countKey);
|
|
@@ -6721,7 +6759,7 @@ var readScalarReviews = (find, namespace, ratingKey, countKey) => {
|
|
|
6721
6759
|
return {
|
|
6722
6760
|
rating: readReviewField(
|
|
6723
6761
|
rating,
|
|
6724
|
-
(value) => PostPurchaseCommonReviewRating.parse({ value:
|
|
6762
|
+
(value) => PostPurchaseCommonReviewRating.parse({ value: import_zod64.z.string().parse(value) }).value
|
|
6725
6763
|
),
|
|
6726
6764
|
reviewCount: readReviewField(count, (value) => PostPurchaseReviewCount.parse(value))
|
|
6727
6765
|
};
|
|
@@ -6734,7 +6772,7 @@ var readStandardReviews = (find) => {
|
|
|
6734
6772
|
if (!rating || !count) return null;
|
|
6735
6773
|
return {
|
|
6736
6774
|
rating: readReviewField(rating, (raw) => {
|
|
6737
|
-
const value =
|
|
6775
|
+
const value = import_zod65.z.string().parse(raw);
|
|
6738
6776
|
return PostPurchaseCommonReviewRating.parse(/^\d+(?:\.\d+)?$/.test(value) ? { value } : JSON.parse(value)).value;
|
|
6739
6777
|
}),
|
|
6740
6778
|
reviewCount: readReviewField(count, (value) => PostPurchaseReviewCount.parse(value))
|
|
@@ -6756,15 +6794,15 @@ var readPostPurchaseReviewData = (provider, find) => {
|
|
|
6756
6794
|
return {
|
|
6757
6795
|
rating: readReviewField(
|
|
6758
6796
|
rating,
|
|
6759
|
-
(value) => PostPurchaseKlaviyoReviewRating.parse(JSON.parse(
|
|
6797
|
+
(value) => PostPurchaseKlaviyoReviewRating.parse(JSON.parse(import_zod65.z.string().parse(value))).value
|
|
6760
6798
|
),
|
|
6761
6799
|
reviewCount: readReviewField(count, (value) => PostPurchaseReviewCount.parse(value))
|
|
6762
6800
|
};
|
|
6763
6801
|
};
|
|
6764
6802
|
|
|
6765
6803
|
// src/server/postPurchaseReviewProvider.ts
|
|
6766
|
-
var
|
|
6767
|
-
var IntegrationInput =
|
|
6804
|
+
var import_zod66 = require("zod");
|
|
6805
|
+
var IntegrationInput = import_zod66.z.record(import_zod66.z.string(), import_zod66.z.unknown()).prefault({});
|
|
6768
6806
|
var precedence = [
|
|
6769
6807
|
"klaviyo",
|
|
6770
6808
|
"judgeme",
|
|
@@ -6776,7 +6814,7 @@ var precedence = [
|
|
|
6776
6814
|
"stamped",
|
|
6777
6815
|
"yotpo"
|
|
6778
6816
|
];
|
|
6779
|
-
var ReviewsIoFlag =
|
|
6817
|
+
var ReviewsIoFlag = import_zod66.z.preprocess((value) => {
|
|
6780
6818
|
if (typeof value === "string") {
|
|
6781
6819
|
const flag = value.toLowerCase();
|
|
6782
6820
|
if (flag === "true" || flag === "yes") return true;
|
|
@@ -6877,7 +6915,7 @@ var prepareNormalizedSubscription = (normalized, report, plan, quantity3, allowC
|
|
|
6877
6915
|
|
|
6878
6916
|
// src/server/preparePostPurchaseSubscription.ts
|
|
6879
6917
|
var preparePostPurchaseSubscription = (settings, response, report) => {
|
|
6880
|
-
const normalized = normalizePostPurchaseProduct(settings, response);
|
|
6918
|
+
const normalized = normalizePostPurchaseProduct(settings, response, report);
|
|
6881
6919
|
return prepareNormalizedSubscription(
|
|
6882
6920
|
normalized,
|
|
6883
6921
|
report,
|
|
@@ -6915,42 +6953,42 @@ var prepareNormalizedProduct = (normalized, report, quantity3, allowCollection =
|
|
|
6915
6953
|
}
|
|
6916
6954
|
});
|
|
6917
6955
|
};
|
|
6918
|
-
var preparePostPurchaseProduct = (settings, response, report) => prepareNormalizedProduct(normalizePostPurchaseProduct(settings, response), report);
|
|
6956
|
+
var preparePostPurchaseProduct = (settings, response, report) => prepareNormalizedProduct(normalizePostPurchaseProduct(settings, response, report), report);
|
|
6919
6957
|
|
|
6920
6958
|
// src/schema/postPurchaseProductView.ts
|
|
6921
|
-
var
|
|
6959
|
+
var import_zod73 = require("zod");
|
|
6922
6960
|
|
|
6923
6961
|
// src/schema/postPurchaseChoice.ts
|
|
6924
|
-
var
|
|
6925
|
-
var PostPurchaseChoice =
|
|
6926
|
-
|
|
6927
|
-
|
|
6962
|
+
var import_zod67 = require("zod");
|
|
6963
|
+
var PostPurchaseChoice = import_zod67.z.discriminatedUnion("mode", [
|
|
6964
|
+
import_zod67.z.object({ mode: import_zod67.z.literal("one-time") }).strict(),
|
|
6965
|
+
import_zod67.z.object({ mode: import_zod67.z.literal("subscription"), sellingPlanId: PostPurchasePlanOption.shape.id }).strict()
|
|
6928
6966
|
]);
|
|
6929
|
-
var PostPurchaseOptions =
|
|
6967
|
+
var PostPurchaseOptions = import_zod67.z.object({
|
|
6930
6968
|
defaultChoice: PostPurchaseChoice,
|
|
6931
|
-
modes:
|
|
6969
|
+
modes: import_zod67.z.array(import_zod67.z.enum(["one-time", "subscription"])).min(1).max(2),
|
|
6932
6970
|
selector: PostPurchaseSettings.shape.productTypeSelector
|
|
6933
6971
|
});
|
|
6934
6972
|
|
|
6935
6973
|
// src/schema/postPurchaseDisplayPrice.ts
|
|
6936
|
-
var
|
|
6974
|
+
var import_zod69 = require("zod");
|
|
6937
6975
|
|
|
6938
6976
|
// src/schema/postPurchaseSubscriptionDisplay.ts
|
|
6939
|
-
var
|
|
6940
|
-
var Minor =
|
|
6941
|
-
var PostPurchaseSubscriptionDisplay =
|
|
6977
|
+
var import_zod68 = require("zod");
|
|
6978
|
+
var Minor = import_zod68.z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
6979
|
+
var PostPurchaseSubscriptionDisplay = import_zod68.z.object({
|
|
6942
6980
|
comparisonMinor: Minor,
|
|
6943
|
-
currencyCode:
|
|
6981
|
+
currencyCode: import_zod68.z.string().regex(/^[A-Z]{3}$/),
|
|
6944
6982
|
priceMinor: Minor,
|
|
6945
6983
|
savingMinor: Minor,
|
|
6946
|
-
savingPercent:
|
|
6984
|
+
savingPercent: import_zod68.z.number().int().min(0).max(100)
|
|
6947
6985
|
});
|
|
6948
6986
|
|
|
6949
6987
|
// src/schema/postPurchaseDisplayPrice.ts
|
|
6950
6988
|
var { currencyCode: CurrencyCode, priceMinor: Minor2, savingPercent: Percent } = PostPurchaseSubscriptionDisplay.shape;
|
|
6951
|
-
var PostPurchaseDisplayPrice =
|
|
6989
|
+
var PostPurchaseDisplayPrice = import_zod69.z.object({
|
|
6952
6990
|
currencyCode: CurrencyCode,
|
|
6953
|
-
savingFormat:
|
|
6991
|
+
savingFormat: import_zod69.z.enum(["amount", "percent"]).nullable(),
|
|
6954
6992
|
savingMinor: Minor2,
|
|
6955
6993
|
savingPercent: Percent,
|
|
6956
6994
|
subscriptionUnit: PostPurchaseSubscriptionDisplay.optional(),
|
|
@@ -6968,30 +7006,30 @@ var PostPurchaseDisplayPrice = import_zod68.z.object({
|
|
|
6968
7006
|
);
|
|
6969
7007
|
|
|
6970
7008
|
// src/schema/postPurchaseGroupCatalog.ts
|
|
6971
|
-
var
|
|
7009
|
+
var import_zod71 = require("zod");
|
|
6972
7010
|
|
|
6973
7011
|
// src/schema/postPurchaseVariantCatalog.ts
|
|
6974
|
-
var
|
|
6975
|
-
var PostPurchaseVariantSelector =
|
|
7012
|
+
var import_zod70 = require("zod");
|
|
7013
|
+
var PostPurchaseVariantSelector = import_zod70.z.object({ variantId: PostPurchaseVariantId }).strict();
|
|
6976
7014
|
var PostPurchaseVariantOption = OfferProduct.shape.options.element.extend({
|
|
6977
|
-
id:
|
|
6978
|
-
position:
|
|
7015
|
+
id: import_zod70.z.number().int().positive().optional(),
|
|
7016
|
+
position: import_zod70.z.number().int().min(1).max(3)
|
|
6979
7017
|
});
|
|
6980
7018
|
var PostPurchaseVariantValues = OfferProduct.shape.variants.element.pick({
|
|
6981
7019
|
option1: true,
|
|
6982
7020
|
option2: true,
|
|
6983
7021
|
option3: true
|
|
6984
7022
|
});
|
|
6985
|
-
var PostPurchaseVariantCatalog =
|
|
7023
|
+
var PostPurchaseVariantCatalog = import_zod70.z.object({
|
|
6986
7024
|
displayMode: PostPurchaseSettings.shape.productOptions.shape.variantSelectorDisplayMode,
|
|
6987
|
-
options:
|
|
7025
|
+
options: import_zod70.z.array(PostPurchaseVariantOption),
|
|
6988
7026
|
productId: PostPurchaseProductId,
|
|
6989
7027
|
showSelectors: PostPurchaseSettings.shape.productOptions.shape.showVariantSelectors,
|
|
6990
|
-
variants:
|
|
7028
|
+
variants: import_zod70.z.array(
|
|
6991
7029
|
PostPurchaseVariantValues.partial().extend({
|
|
6992
|
-
available:
|
|
7030
|
+
available: import_zod70.z.boolean(),
|
|
6993
7031
|
id: PostPurchaseVariantId,
|
|
6994
|
-
imageId:
|
|
7032
|
+
imageId: import_zod70.z.number().int().nonnegative().nullish(),
|
|
6995
7033
|
title: OfferProduct.shape.variants.element.shape.title
|
|
6996
7034
|
})
|
|
6997
7035
|
)
|
|
@@ -7005,89 +7043,89 @@ var PostPurchaseGroupDescription = source.pick({ description: true, id: true, im
|
|
|
7005
7043
|
image: source.shape.image.default(null),
|
|
7006
7044
|
options: PostPurchaseVariantCatalog.shape.options.default([])
|
|
7007
7045
|
});
|
|
7008
|
-
var PostPurchaseGroupCatalog =
|
|
7046
|
+
var PostPurchaseGroupCatalog = import_zod71.z.object({
|
|
7009
7047
|
memberProductId: productId,
|
|
7010
|
-
options:
|
|
7048
|
+
options: import_zod71.z.array(import_zod71.z.object({ productId, title: import_zod71.z.string(), variantCatalog: PostPurchaseVariantCatalog }))
|
|
7011
7049
|
});
|
|
7012
|
-
var PostPurchaseGroupSelection =
|
|
7050
|
+
var PostPurchaseGroupSelection = import_zod71.z.object({
|
|
7013
7051
|
memberProductId: productId,
|
|
7014
7052
|
productId
|
|
7015
7053
|
});
|
|
7016
7054
|
|
|
7017
7055
|
// src/schema/postPurchaseProductCalculation.ts
|
|
7018
|
-
var
|
|
7019
|
-
var MoneyBag =
|
|
7020
|
-
presentmentMoney:
|
|
7056
|
+
var import_zod72 = require("zod");
|
|
7057
|
+
var MoneyBag = import_zod72.z.object({
|
|
7058
|
+
presentmentMoney: import_zod72.z.object({
|
|
7021
7059
|
amount: PostPurchaseAmount,
|
|
7022
|
-
currencyCode:
|
|
7060
|
+
currencyCode: import_zod72.z.string().regex(/^[A-Z]{3}$/)
|
|
7023
7061
|
})
|
|
7024
7062
|
});
|
|
7025
|
-
var PostPurchaseProductCalculation =
|
|
7026
|
-
calculatedPurchase:
|
|
7027
|
-
addedShippingLines:
|
|
7028
|
-
addedTaxLines:
|
|
7063
|
+
var PostPurchaseProductCalculation = import_zod72.z.object({
|
|
7064
|
+
calculatedPurchase: import_zod72.z.object({
|
|
7065
|
+
addedShippingLines: import_zod72.z.array(import_zod72.z.object({ priceSet: MoneyBag })),
|
|
7066
|
+
addedTaxLines: import_zod72.z.array(import_zod72.z.object({ priceSet: MoneyBag })),
|
|
7029
7067
|
totalOutstandingSet: MoneyBag,
|
|
7030
|
-
updatedLineItems:
|
|
7031
|
-
|
|
7032
|
-
priceSet:
|
|
7033
|
-
productId:
|
|
7034
|
-
sellingPlanId:
|
|
7035
|
-
variantId:
|
|
7068
|
+
updatedLineItems: import_zod72.z.array(
|
|
7069
|
+
import_zod72.z.object({
|
|
7070
|
+
priceSet: import_zod72.z.unknown().optional(),
|
|
7071
|
+
productId: import_zod72.z.number().int().positive(),
|
|
7072
|
+
sellingPlanId: import_zod72.z.unknown().optional(),
|
|
7073
|
+
variantId: import_zod72.z.number().int().positive()
|
|
7036
7074
|
})
|
|
7037
7075
|
)
|
|
7038
7076
|
}),
|
|
7039
|
-
errors:
|
|
7040
|
-
status:
|
|
7077
|
+
errors: import_zod72.z.array(import_zod72.z.unknown()).length(0),
|
|
7078
|
+
status: import_zod72.z.literal("processed")
|
|
7041
7079
|
});
|
|
7042
|
-
var Minor3 =
|
|
7043
|
-
var PostPurchaseProductCosts =
|
|
7080
|
+
var Minor3 = import_zod72.z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER);
|
|
7081
|
+
var PostPurchaseProductCosts = import_zod72.z.object({
|
|
7044
7082
|
currencyCode: MoneyBag.shape.presentmentMoney.shape.currencyCode,
|
|
7045
|
-
recurringDisplay:
|
|
7083
|
+
recurringDisplay: import_zod72.z.object({ shippingMinor: Minor3, subtotalMinor: Minor3, totalMinor: Minor3 }).optional(),
|
|
7046
7084
|
shippingMinor: Minor3,
|
|
7047
7085
|
subtotalMinor: Minor3,
|
|
7048
7086
|
taxesMinor: Minor3,
|
|
7049
7087
|
totalMinor: Minor3
|
|
7050
7088
|
});
|
|
7051
|
-
var ChangesetDiscount =
|
|
7052
|
-
title:
|
|
7053
|
-
value:
|
|
7054
|
-
valueType:
|
|
7089
|
+
var ChangesetDiscount = import_zod72.z.object({
|
|
7090
|
+
title: import_zod72.z.string(),
|
|
7091
|
+
value: import_zod72.z.number().nonnegative(),
|
|
7092
|
+
valueType: import_zod72.z.enum(["percentage", "fixed_amount"])
|
|
7055
7093
|
}).optional();
|
|
7056
|
-
var PostPurchaseProductChangeset =
|
|
7057
|
-
changes:
|
|
7058
|
-
|
|
7059
|
-
|
|
7094
|
+
var PostPurchaseProductChangeset = import_zod72.z.object({
|
|
7095
|
+
changes: import_zod72.z.array(
|
|
7096
|
+
import_zod72.z.union([
|
|
7097
|
+
import_zod72.z.object({
|
|
7060
7098
|
discount: ChangesetDiscount,
|
|
7061
|
-
quantity:
|
|
7062
|
-
type:
|
|
7063
|
-
variantId:
|
|
7099
|
+
quantity: import_zod72.z.number().int().positive(),
|
|
7100
|
+
type: import_zod72.z.literal("add_variant"),
|
|
7101
|
+
variantId: import_zod72.z.number().int().positive()
|
|
7064
7102
|
}),
|
|
7065
|
-
|
|
7103
|
+
import_zod72.z.object({ price: import_zod72.z.number().nonnegative(), title: import_zod72.z.string(), type: import_zod72.z.literal("add_shipping_line") }),
|
|
7066
7104
|
PostPurchaseSubscriptionTerms.pick({
|
|
7067
7105
|
initialShippingPrice: true,
|
|
7068
7106
|
recurringShippingPrice: true,
|
|
7069
7107
|
shippingOption: true
|
|
7070
7108
|
}).extend({
|
|
7071
7109
|
discount: ChangesetDiscount,
|
|
7072
|
-
quantity:
|
|
7073
|
-
sellingPlanId:
|
|
7074
|
-
type:
|
|
7075
|
-
variantId:
|
|
7110
|
+
quantity: import_zod72.z.number().int().positive(),
|
|
7111
|
+
sellingPlanId: import_zod72.z.number().int().positive(),
|
|
7112
|
+
type: import_zod72.z.literal("add_subscription"),
|
|
7113
|
+
variantId: import_zod72.z.number().int().positive()
|
|
7076
7114
|
})
|
|
7077
7115
|
])
|
|
7078
7116
|
)
|
|
7079
7117
|
});
|
|
7080
7118
|
|
|
7081
7119
|
// src/schema/postPurchaseProductView.ts
|
|
7082
|
-
var PostPurchaseProductView =
|
|
7083
|
-
|
|
7120
|
+
var PostPurchaseProductView = import_zod73.z.union([
|
|
7121
|
+
import_zod73.z.object({
|
|
7084
7122
|
changeset: PostPurchaseProductChangeset.optional(),
|
|
7085
7123
|
displayPrice: PostPurchaseDisplayPrice.optional(),
|
|
7086
7124
|
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
7087
7125
|
initialVariant: PostPurchaseVariantSelector.optional(),
|
|
7088
7126
|
planCatalog: PostPurchasePlanCatalog.nullable().optional(),
|
|
7089
7127
|
preparation: PreparedPostPurchaseProduct.extend({
|
|
7090
|
-
display: PreparedPostPurchaseProduct.shape.display.extend({ description:
|
|
7128
|
+
display: PreparedPostPurchaseProduct.shape.display.extend({ description: import_zod73.z.string().nullable() }).refine(
|
|
7091
7129
|
({ description, descriptionDocument }) => description === null === (descriptionDocument !== void 0),
|
|
7092
7130
|
"Exactly one of the plain and rich descriptions is shown"
|
|
7093
7131
|
)
|
|
@@ -7096,7 +7134,7 @@ var PostPurchaseProductView = import_zod72.z.union([
|
|
|
7096
7134
|
sections: CABRootSection,
|
|
7097
7135
|
variantCatalog: PostPurchaseVariantCatalog.optional()
|
|
7098
7136
|
}),
|
|
7099
|
-
|
|
7137
|
+
import_zod73.z.object({
|
|
7100
7138
|
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
7101
7139
|
initialVariant: PostPurchaseVariantSelector.optional(),
|
|
7102
7140
|
/** The localized unavailable copy, for the choices still offered beneath an unprepared product. */
|
|
@@ -7111,12 +7149,12 @@ var PostPurchaseProductView = import_zod72.z.union([
|
|
|
7111
7149
|
]);
|
|
7112
7150
|
|
|
7113
7151
|
// src/server/postPurchaseOfferCopy.ts
|
|
7114
|
-
var
|
|
7115
|
-
var Copy =
|
|
7152
|
+
var import_zod74 = require("zod");
|
|
7153
|
+
var Copy = import_zod74.z.object({
|
|
7116
7154
|
superTitle: CalloutBannerBlock.shape.settings.shape.superTitle.unwrap().optional().catch(void 0),
|
|
7117
7155
|
title: CalloutBannerBlock.shape.settings.shape.title.unwrap().optional().catch(void 0)
|
|
7118
7156
|
});
|
|
7119
|
-
var Callout =
|
|
7157
|
+
var Callout = import_zod74.z.object({ settings: import_zod74.z.record(import_zod74.z.string(), import_zod74.z.unknown()), type: import_zod74.z.literal("callout_banner") });
|
|
7120
7158
|
var postPurchaseOfferCopy = (blocks, metadata) => {
|
|
7121
7159
|
const copy = Copy.safeParse(metadata.widget.language);
|
|
7122
7160
|
if (!blocks || !copy.success) return blocks;
|
|
@@ -7150,7 +7188,7 @@ var postPurchaseCardSections = (widgetId, { effective, metadata }, report) => {
|
|
|
7150
7188
|
);
|
|
7151
7189
|
return sections.sections.filter(({ sectionType }) => sectionType === "offers").length === 1 ? sections : null;
|
|
7152
7190
|
};
|
|
7153
|
-
var preparePostPurchaseCardSections = (widgetId, settings, response, report) => postPurchaseCardSections(widgetId, normalizePostPurchaseProduct(settings, response), report);
|
|
7191
|
+
var preparePostPurchaseCardSections = (widgetId, settings, response, report) => postPurchaseCardSections(widgetId, normalizePostPurchaseProduct(settings, response, report), report);
|
|
7154
7192
|
|
|
7155
7193
|
// src/server/selectPostPurchaseChoice.ts
|
|
7156
7194
|
var preferChoiceLevel = (preferred, other) => !isChoiceUnavailable(preferred) && isChoiceUnavailable(other) ? other : preferred;
|
|
@@ -7220,72 +7258,77 @@ var prepareNormalizedPostPurchaseView = (widgetId, normalized, report, choice, q
|
|
|
7220
7258
|
sections
|
|
7221
7259
|
});
|
|
7222
7260
|
};
|
|
7223
|
-
var preparePostPurchaseView = (widgetId, settings, response, report, choice) => prepareNormalizedPostPurchaseView(
|
|
7261
|
+
var preparePostPurchaseView = (widgetId, settings, response, report, choice) => prepareNormalizedPostPurchaseView(
|
|
7262
|
+
widgetId,
|
|
7263
|
+
normalizePostPurchaseProduct(settings, response, report),
|
|
7264
|
+
report,
|
|
7265
|
+
choice
|
|
7266
|
+
);
|
|
7224
7267
|
|
|
7225
7268
|
// src/server/preparePostPurchaseAdmissionView.ts
|
|
7226
7269
|
var preparePostPurchaseAdmissionView = (widgetId, settings, response, report, choice) => {
|
|
7227
|
-
const normalized = normalizePostPurchaseProduct(settings, response);
|
|
7270
|
+
const normalized = normalizePostPurchaseProduct(settings, response, report);
|
|
7228
7271
|
const view = prepareNormalizedPostPurchaseView(widgetId, normalized, report, choice);
|
|
7229
7272
|
const { removePartialOrder } = PostPurchaseSettings.shape.advance.parse(normalized.effective.advance);
|
|
7230
7273
|
return { removePartialOrder, view };
|
|
7231
7274
|
};
|
|
7232
7275
|
|
|
7233
7276
|
// src/schema/postPurchaseProductCollectionView.ts
|
|
7234
|
-
var
|
|
7277
|
+
var import_zod81 = require("zod");
|
|
7235
7278
|
|
|
7236
7279
|
// src/schema/postPurchaseProgress.ts
|
|
7237
|
-
var
|
|
7280
|
+
var import_zod80 = require("zod");
|
|
7238
7281
|
|
|
7239
7282
|
// src/schema/postPurchaseDeclineDelivery.ts
|
|
7240
|
-
var
|
|
7283
|
+
var import_zod79 = require("zod");
|
|
7241
7284
|
|
|
7242
7285
|
// src/schema/postPurchaseAcceptedEvent.ts
|
|
7243
|
-
var
|
|
7286
|
+
var import_zod78 = require("zod");
|
|
7244
7287
|
|
|
7245
7288
|
// src/schema/postPurchaseAdmission.ts
|
|
7246
|
-
var
|
|
7289
|
+
var import_zod77 = require("zod");
|
|
7247
7290
|
|
|
7248
7291
|
// src/schema/postPurchaseIdentity.ts
|
|
7249
|
-
var
|
|
7292
|
+
var import_zod75 = require("zod");
|
|
7250
7293
|
var POST_PURCHASE_ID_MAX = 128;
|
|
7251
|
-
var PostPurchaseTimestampSchema =
|
|
7252
|
-
var PostPurchaseOrderIdSchema =
|
|
7253
|
-
var ShopifyDomainSchema =
|
|
7254
|
-
var DecideRequestSchema =
|
|
7255
|
-
checkoutToken:
|
|
7294
|
+
var PostPurchaseTimestampSchema = import_zod75.z.number().int().nonnegative();
|
|
7295
|
+
var PostPurchaseOrderIdSchema = import_zod75.z.string().regex(/^gid:\/\/shopify\/Order\/[1-9]\d*$/);
|
|
7296
|
+
var ShopifyDomainSchema = import_zod75.z.string().max(POST_PURCHASE_ID_MAX).regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?\.myshopify\.com$/);
|
|
7297
|
+
var DecideRequestSchema = import_zod75.z.object({
|
|
7298
|
+
checkoutToken: import_zod75.z.string().min(1).max(POST_PURCHASE_ID_MAX),
|
|
7256
7299
|
shop: ShopifyDomainSchema
|
|
7257
7300
|
});
|
|
7258
|
-
var PostPurchaseAppIdSchema =
|
|
7259
|
-
var DecisionEntrySchema =
|
|
7260
|
-
blockId:
|
|
7261
|
-
blockIndex:
|
|
7262
|
-
blockParentIndex:
|
|
7263
|
-
flowId:
|
|
7264
|
-
sectionId:
|
|
7265
|
-
widgetId:
|
|
7266
|
-
widgetTraffic:
|
|
7301
|
+
var PostPurchaseAppIdSchema = import_zod75.z.string().min(1).max(POST_PURCHASE_ID_MAX);
|
|
7302
|
+
var DecisionEntrySchema = import_zod75.z.object({
|
|
7303
|
+
blockId: import_zod75.z.number().int().positive(),
|
|
7304
|
+
blockIndex: import_zod75.z.string(),
|
|
7305
|
+
blockParentIndex: import_zod75.z.string(),
|
|
7306
|
+
flowId: import_zod75.z.number().int().positive(),
|
|
7307
|
+
sectionId: import_zod75.z.number().int().positive(),
|
|
7308
|
+
widgetId: import_zod75.z.number().int().positive(),
|
|
7309
|
+
widgetTraffic: import_zod75.z.number().min(0).max(100)
|
|
7267
7310
|
});
|
|
7268
7311
|
|
|
7269
7312
|
// src/schema/postPurchaseMemberIdentity.ts
|
|
7270
|
-
var
|
|
7271
|
-
var PostPurchaseMemberIdentity =
|
|
7272
|
-
productId:
|
|
7273
|
-
productIndex:
|
|
7313
|
+
var import_zod76 = require("zod");
|
|
7314
|
+
var PostPurchaseMemberIdentity = import_zod76.z.object({
|
|
7315
|
+
productId: import_zod76.z.number().int().positive(),
|
|
7316
|
+
productIndex: import_zod76.z.number().int().nonnegative()
|
|
7274
7317
|
}).strict();
|
|
7275
7318
|
|
|
7276
7319
|
// src/schema/postPurchaseAdmission.ts
|
|
7277
|
-
var PurchaseAdmissionModeSchema =
|
|
7320
|
+
var PurchaseAdmissionModeSchema = import_zod77.z.enum(["purchase", "sts"]);
|
|
7278
7321
|
var selection = PreparedPostPurchaseProduct.shape.selection;
|
|
7279
7322
|
var EventCalculationSchema = PostPurchaseProductCosts.pick({ currencyCode: true, totalMinor: true }).strict();
|
|
7280
|
-
var PurchaseExpectedSchema =
|
|
7281
|
-
buyerConsentToSubscriptions:
|
|
7323
|
+
var PurchaseExpectedSchema = import_zod77.z.object({
|
|
7324
|
+
buyerConsentToSubscriptions: import_zod77.z.boolean().optional(),
|
|
7282
7325
|
changeset: PostPurchaseProductChangeset.extend({
|
|
7283
7326
|
changes: PostPurchaseProductChangeset.shape.changes.min(1).max(2)
|
|
7284
7327
|
}),
|
|
7285
7328
|
entry: DecisionEntrySchema,
|
|
7286
7329
|
member: PostPurchaseMemberIdentity.optional(),
|
|
7287
7330
|
mode: PurchaseAdmissionModeSchema.optional(),
|
|
7288
|
-
progressRevision:
|
|
7331
|
+
progressRevision: import_zod77.z.number().int().nonnegative().optional(),
|
|
7289
7332
|
/**
|
|
7290
7333
|
* The total the buyer affirmed, stored with the admitted operation so a reloaded client can still
|
|
7291
7334
|
* send its follow-ups with it. Optional: a client from before it was added admits without one.
|
|
@@ -7306,16 +7349,16 @@ var PurchaseExpectedSchema = import_zod76.z.object({
|
|
|
7306
7349
|
}, "Selection, change and buyer consent must agree");
|
|
7307
7350
|
var PurchaseRequestSchema = DecideRequestSchema.extend({
|
|
7308
7351
|
expected: PurchaseExpectedSchema,
|
|
7309
|
-
requestId:
|
|
7352
|
+
requestId: import_zod77.z.uuid()
|
|
7310
7353
|
}).strict();
|
|
7311
|
-
var PurchaseReceiptSchema =
|
|
7354
|
+
var PurchaseReceiptSchema = import_zod77.z.object({
|
|
7312
7355
|
admittedAt: PostPurchaseTimestampSchema,
|
|
7313
|
-
changesetToken:
|
|
7356
|
+
changesetToken: import_zod77.z.string().min(1),
|
|
7314
7357
|
mode: PurchaseAdmissionModeSchema.optional(),
|
|
7315
|
-
operationId:
|
|
7358
|
+
operationId: import_zod77.z.uuid(),
|
|
7316
7359
|
/** The server-bound one-time line an STS refunds; its quantity is the order's, not the selection's. */
|
|
7317
|
-
originalLine:
|
|
7318
|
-
requiresSubscriptionConsent:
|
|
7360
|
+
originalLine: import_zod77.z.strictObject({ quantity: selection.shape.quantity, variantId: selection.shape.variantId }).optional(),
|
|
7361
|
+
requiresSubscriptionConsent: import_zod77.z.boolean(),
|
|
7319
7362
|
selection
|
|
7320
7363
|
}).refine(
|
|
7321
7364
|
({ requiresSubscriptionConsent, selection: selection4 }) => requiresSubscriptionConsent === (selection4.sellingPlanId !== void 0),
|
|
@@ -7324,14 +7367,14 @@ var PurchaseReceiptSchema = import_zod76.z.object({
|
|
|
7324
7367
|
({ mode, originalLine, selection: { sellingPlanId, variantId } }) => mode === "sts" ? sellingPlanId !== void 0 && originalLine?.variantId === variantId : originalLine === void 0,
|
|
7325
7368
|
"An STS Receipt binds the original line of its subscribed variant, and only an STS does"
|
|
7326
7369
|
);
|
|
7327
|
-
var PurchaseResponseSchema =
|
|
7370
|
+
var PurchaseResponseSchema = import_zod77.z.object({ data: PurchaseReceiptSchema, successful: import_zod77.z.literal(true) });
|
|
7328
7371
|
|
|
7329
7372
|
// src/schema/postPurchaseAcceptedEvent.ts
|
|
7330
|
-
var AcceptedEventOutcomeSchema =
|
|
7331
|
-
var AttemptProgressSchema =
|
|
7373
|
+
var AcceptedEventOutcomeSchema = import_zod78.z.enum(["acknowledged", "rejected", "skipped", "unknown"]);
|
|
7374
|
+
var AttemptProgressSchema = import_zod78.z.strictObject({
|
|
7332
7375
|
attemptedAt: PostPurchaseTimestampSchema,
|
|
7333
7376
|
reportedCalculation: EventCalculationSchema,
|
|
7334
|
-
status:
|
|
7377
|
+
status: import_zod78.z.literal("attempted")
|
|
7335
7378
|
});
|
|
7336
7379
|
var AcceptedEventAttemptProgressSchema = AttemptProgressSchema.extend({
|
|
7337
7380
|
operationId: PurchaseReceiptSchema.shape.operationId
|
|
@@ -7344,17 +7387,17 @@ var AcceptedEventRequestSchema = DecideRequestSchema.extend({
|
|
|
7344
7387
|
operationId: PurchaseReceiptSchema.shape.operationId,
|
|
7345
7388
|
reportedCalculation: EventCalculationSchema
|
|
7346
7389
|
}).strict();
|
|
7347
|
-
var AcceptedEventResponseSchema =
|
|
7348
|
-
data:
|
|
7349
|
-
successful:
|
|
7390
|
+
var AcceptedEventResponseSchema = import_zod78.z.object({
|
|
7391
|
+
data: import_zod78.z.union([AcceptedEventAttemptProgressSchema, AcceptedEventResultProgressSchema]),
|
|
7392
|
+
successful: import_zod78.z.literal(true)
|
|
7350
7393
|
});
|
|
7351
7394
|
|
|
7352
7395
|
// src/schema/postPurchaseDeclineDelivery.ts
|
|
7353
|
-
var AttemptSchema =
|
|
7396
|
+
var AttemptSchema = import_zod79.z.strictObject({
|
|
7354
7397
|
attemptedAt: PostPurchaseTimestampSchema,
|
|
7355
|
-
status:
|
|
7398
|
+
status: import_zod79.z.enum(["attempted", "unavailable"])
|
|
7356
7399
|
});
|
|
7357
|
-
var DeclineDeliveryProgressSchema =
|
|
7400
|
+
var DeclineDeliveryProgressSchema = import_zod79.z.union([
|
|
7358
7401
|
AttemptSchema,
|
|
7359
7402
|
AttemptSchema.extend({
|
|
7360
7403
|
finishedAt: PostPurchaseTimestampSchema,
|
|
@@ -7363,36 +7406,36 @@ var DeclineDeliveryProgressSchema = import_zod78.z.union([
|
|
|
7363
7406
|
]);
|
|
7364
7407
|
|
|
7365
7408
|
// src/schema/postPurchaseProgress.ts
|
|
7366
|
-
var PostPurchaseProgressSchema =
|
|
7409
|
+
var PostPurchaseProgressSchema = import_zod80.z.object({
|
|
7367
7410
|
closedAt: PostPurchaseTimestampSchema.nullable(),
|
|
7368
7411
|
deadline: PostPurchaseTimestampSchema,
|
|
7369
7412
|
entry: DecisionEntrySchema,
|
|
7370
|
-
entryRevision:
|
|
7371
|
-
members:
|
|
7413
|
+
entryRevision: import_zod80.z.number().int().nonnegative(),
|
|
7414
|
+
members: import_zod80.z.array(
|
|
7372
7415
|
PostPurchaseMemberIdentity.extend({
|
|
7373
7416
|
declineDelivery: DeclineDeliveryProgressSchema.optional(),
|
|
7374
|
-
status:
|
|
7417
|
+
status: import_zod80.z.enum(["unhandled", "accepted", "declined"])
|
|
7375
7418
|
}).strict()
|
|
7376
7419
|
),
|
|
7377
|
-
revision:
|
|
7420
|
+
revision: import_zod80.z.number().int().nonnegative()
|
|
7378
7421
|
}).strict();
|
|
7379
7422
|
|
|
7380
7423
|
// src/schema/postPurchaseProductCollectionView.ts
|
|
7381
|
-
var PostPurchaseProductCollectionView =
|
|
7382
|
-
members:
|
|
7383
|
-
|
|
7424
|
+
var PostPurchaseProductCollectionView = import_zod81.z.object({
|
|
7425
|
+
members: import_zod81.z.array(
|
|
7426
|
+
import_zod81.z.object({
|
|
7384
7427
|
productId: PostPurchaseProductId,
|
|
7385
|
-
productIndex:
|
|
7428
|
+
productIndex: import_zod81.z.number().int().nonnegative(),
|
|
7386
7429
|
view: PostPurchaseProductView
|
|
7387
7430
|
})
|
|
7388
7431
|
)
|
|
7389
7432
|
});
|
|
7390
|
-
var PostPurchaseCollectionChoice =
|
|
7433
|
+
var PostPurchaseCollectionChoice = import_zod81.z.object({
|
|
7391
7434
|
choice: PostPurchaseChoice.optional(),
|
|
7392
7435
|
productId: PostPurchaseProductId,
|
|
7393
7436
|
variantId: PostPurchaseVariantSelector.shape.variantId.optional()
|
|
7394
7437
|
}).strict();
|
|
7395
|
-
var PostPurchaseExcludedProductIds =
|
|
7438
|
+
var PostPurchaseExcludedProductIds = import_zod81.z.array(PostPurchaseProductId).default([]);
|
|
7396
7439
|
var PostPurchaseMemberSelector = PostPurchaseProgressSchema.shape.members.element.pick({ productId: true }).extend({ progressRevision: PostPurchaseProgressSchema.shape.revision });
|
|
7397
7440
|
var PostPurchaseMemberPointer = PostPurchaseProgressSchema.shape.members.element.omit({ status: true }).extend({
|
|
7398
7441
|
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
@@ -7400,16 +7443,19 @@ var PostPurchaseMemberPointer = PostPurchaseProgressSchema.shape.members.element
|
|
|
7400
7443
|
});
|
|
7401
7444
|
|
|
7402
7445
|
// src/server/normalizePostPurchaseCollection.ts
|
|
7403
|
-
var
|
|
7404
|
-
var normalizePostPurchaseCollection = (settings, response, excludedProductIds) => {
|
|
7405
|
-
const normalized =
|
|
7406
|
-
const limit =
|
|
7446
|
+
var import_zod82 = require("zod");
|
|
7447
|
+
var normalizePostPurchaseCollection = (settings, response, excludedProductIds, report) => {
|
|
7448
|
+
const { dropped, normalized, products } = normalizePostPurchaseSource(settings, response, report);
|
|
7449
|
+
const limit = import_zod82.z.number().int().positive();
|
|
7407
7450
|
limit.parse(normalized.original.productLimit);
|
|
7408
|
-
const
|
|
7409
|
-
|
|
7451
|
+
const cap = limit.parse(normalized.effective.productLimit);
|
|
7452
|
+
const prefix = products.filter(({ productIndex }) => productIndex < cap);
|
|
7453
|
+
const unread = dropped.filter(({ productIndex }) => productIndex < cap);
|
|
7454
|
+
if (unread.length && !prefix.length) throw new import_zod82.ZodError(unread.flatMap(({ issues }) => issues));
|
|
7455
|
+
if (new Set(prefix.map(({ product }) => product.id)).size !== prefix.length)
|
|
7410
7456
|
throw new Error("Ambiguous post-purchase collection");
|
|
7411
7457
|
const excluded = new Set(PostPurchaseExcludedProductIds.parse(excludedProductIds));
|
|
7412
|
-
const members = prefix.
|
|
7458
|
+
const members = prefix.filter(({ product }) => !excluded.has(product.id));
|
|
7413
7459
|
return { members, normalized };
|
|
7414
7460
|
};
|
|
7415
7461
|
|
|
@@ -7447,40 +7493,40 @@ var projectPostPurchaseVariantCatalog = (product, settings) => {
|
|
|
7447
7493
|
};
|
|
7448
7494
|
|
|
7449
7495
|
// src/schema/postPurchaseOfferEligibility.ts
|
|
7450
|
-
var
|
|
7496
|
+
var import_zod83 = require("zod");
|
|
7451
7497
|
var selection2 = PreparedPostPurchaseProduct.shape.selection;
|
|
7452
|
-
var PostPurchaseOfferSkipReason =
|
|
7453
|
-
var PostPurchaseOfferEligibilityContext =
|
|
7498
|
+
var PostPurchaseOfferSkipReason = import_zod83.z.enum(["empty", "no-eligible-subscription"]);
|
|
7499
|
+
var PostPurchaseOfferEligibilityContext = import_zod83.z.object({
|
|
7454
7500
|
excludedProductIds: PostPurchaseExcludedProductIds,
|
|
7455
|
-
originalLineItems:
|
|
7501
|
+
originalLineItems: import_zod83.z.array(selection2.pick({ productId: true, sellingPlanId: true, variantId: true }))
|
|
7456
7502
|
});
|
|
7457
|
-
var PostPurchaseStsOptions =
|
|
7458
|
-
var PostPurchaseStsContext =
|
|
7459
|
-
originalLineItems:
|
|
7503
|
+
var PostPurchaseStsOptions = import_zod83.z.object({ sts: import_zod83.z.boolean().optional() }).strict();
|
|
7504
|
+
var PostPurchaseStsContext = import_zod83.z.object({
|
|
7505
|
+
originalLineItems: import_zod83.z.array(
|
|
7460
7506
|
selection2.pick({ productId: true, quantity: true, sellingPlanId: true, variantId: true })
|
|
7461
7507
|
)
|
|
7462
7508
|
});
|
|
7463
|
-
var PostPurchaseOfferEligibility =
|
|
7464
|
-
|
|
7465
|
-
members:
|
|
7466
|
-
|
|
7509
|
+
var PostPurchaseOfferEligibility = import_zod83.z.discriminatedUnion("status", [
|
|
7510
|
+
import_zod83.z.object({
|
|
7511
|
+
members: import_zod83.z.array(
|
|
7512
|
+
import_zod83.z.object({ productId: selection2.shape.productId, productIndex: import_zod83.z.number().int().nonnegative() })
|
|
7467
7513
|
),
|
|
7468
7514
|
/** Present only with STS on: each member switches one original one-time line to subscription. */
|
|
7469
|
-
mode:
|
|
7470
|
-
status:
|
|
7515
|
+
mode: import_zod83.z.literal("sts").optional(),
|
|
7516
|
+
status: import_zod83.z.literal("retain")
|
|
7471
7517
|
}),
|
|
7472
|
-
|
|
7473
|
-
|
|
7518
|
+
import_zod83.z.object({ reason: PostPurchaseOfferSkipReason, status: import_zod83.z.literal("skip") }),
|
|
7519
|
+
import_zod83.z.object({ reason: import_zod83.z.literal("eligible-sts").optional(), status: import_zod83.z.literal("unavailable") })
|
|
7474
7520
|
]);
|
|
7475
7521
|
|
|
7476
7522
|
// src/schema/postPurchaseQuantity.ts
|
|
7477
|
-
var
|
|
7523
|
+
var import_zod84 = require("zod");
|
|
7478
7524
|
var quantity2 = PreparedPostPurchaseProduct.shape.selection.shape.quantity;
|
|
7479
7525
|
var PostPurchaseQuantityChoice = PostPurchaseCollectionChoice.extend({ quantity: quantity2.optional() });
|
|
7480
7526
|
var PostPurchaseQuantityPolicy = PostPurchaseSettings.shape.quantityInputs.omit({ defaultQuantity: true }).extend({
|
|
7481
7527
|
initialQuantity: quantity2,
|
|
7482
7528
|
maxValue: quantity2,
|
|
7483
|
-
minValue:
|
|
7529
|
+
minValue: import_zod84.z.literal(0).transform(() => 1).or(quantity2)
|
|
7484
7530
|
}).refine(({ maxValue, minValue }) => minValue <= maxValue, "Quantity bounds are reversed");
|
|
7485
7531
|
|
|
7486
7532
|
// src/server/readPostPurchaseQuantity.ts
|
|
@@ -7548,7 +7594,7 @@ var prepareStsCollectionMember = (widgetId, normalized, { product, productIndex
|
|
|
7548
7594
|
|
|
7549
7595
|
// src/server/preparePostPurchaseStsMember.ts
|
|
7550
7596
|
var preparePostPurchaseStsMember = (widgetId, settings, response, selected, sts, requestedQuantity, report) => {
|
|
7551
|
-
const { members, normalized } = normalizePostPurchaseCollection(settings, response);
|
|
7597
|
+
const { members, normalized } = normalizePostPurchaseCollection(settings, response, void 0, report);
|
|
7552
7598
|
if (!stsAllowed(normalized)) return void 0;
|
|
7553
7599
|
const member = members.find(({ product }) => product.id === selected.productId);
|
|
7554
7600
|
const quantity3 = requestedQuantity && ("quantity" in requestedQuantity ? requestedQuantity.quantity : requestedQuantity.expectedQuantity);
|
|
@@ -7559,39 +7605,39 @@ var preparePostPurchaseStsMember = (widgetId, settings, response, selected, sts,
|
|
|
7559
7605
|
};
|
|
7560
7606
|
|
|
7561
7607
|
// src/schema/postPurchaseVariantDefault.ts
|
|
7562
|
-
var
|
|
7608
|
+
var import_zod85 = require("zod");
|
|
7563
7609
|
var values = PostPurchaseVariantValues.partial().extend({
|
|
7564
7610
|
option1: PostPurchaseVariantValues.shape.option1.nullish()
|
|
7565
7611
|
});
|
|
7566
7612
|
var variant = values.extend({
|
|
7567
7613
|
id: PostPurchaseVariantId,
|
|
7568
|
-
inventoryManagement:
|
|
7569
|
-
inventoryPolicy:
|
|
7570
|
-
inventoryQuantity:
|
|
7614
|
+
inventoryManagement: import_zod85.z.string().nullable(),
|
|
7615
|
+
inventoryPolicy: import_zod85.z.string(),
|
|
7616
|
+
inventoryQuantity: import_zod85.z.number()
|
|
7571
7617
|
});
|
|
7572
|
-
var options =
|
|
7573
|
-
var PostPurchaseVariantDefaultProduct =
|
|
7618
|
+
var options = import_zod85.z.array(PostPurchaseVariantOption.pick({ name: true, values: true }));
|
|
7619
|
+
var PostPurchaseVariantDefaultProduct = import_zod85.z.object({
|
|
7574
7620
|
id: PostPurchaseProductId,
|
|
7575
7621
|
options,
|
|
7576
7622
|
selectedVariant: variant.optional(),
|
|
7577
|
-
variants:
|
|
7623
|
+
variants: import_zod85.z.array(variant)
|
|
7578
7624
|
});
|
|
7579
7625
|
var PostPurchaseVariantDefaultSettings = PostPurchaseSettings.shape.productOptions.pick({
|
|
7580
7626
|
hideOutOfStockVariants: true,
|
|
7581
7627
|
matchVariant: true
|
|
7582
7628
|
});
|
|
7583
|
-
var PostPurchaseOrderAttributes =
|
|
7584
|
-
var PostPurchaseOriginalVariants =
|
|
7585
|
-
|
|
7629
|
+
var PostPurchaseOrderAttributes = import_zod85.z.record(import_zod85.z.string(), import_zod85.z.array(import_zod85.z.string())).default({});
|
|
7630
|
+
var PostPurchaseOriginalVariants = import_zod85.z.array(
|
|
7631
|
+
import_zod85.z.object({ productId: PostPurchaseProductId, variantId: PostPurchaseVariantId })
|
|
7586
7632
|
);
|
|
7587
|
-
var PostPurchaseAttributeProducts =
|
|
7588
|
-
|
|
7633
|
+
var PostPurchaseAttributeProducts = import_zod85.z.array(
|
|
7634
|
+
import_zod85.z.object({ id: PostPurchaseProductId, options, variants: import_zod85.z.array(values.extend({ id: PostPurchaseVariantId })) })
|
|
7589
7635
|
);
|
|
7590
7636
|
|
|
7591
7637
|
// src/schema/postPurchaseVariantDefaultContext.ts
|
|
7592
|
-
var
|
|
7593
|
-
var PostPurchaseVariantDefaultContext =
|
|
7594
|
-
enrichedLineItems:
|
|
7638
|
+
var import_zod86 = require("zod");
|
|
7639
|
+
var PostPurchaseVariantDefaultContext = import_zod86.z.object({
|
|
7640
|
+
enrichedLineItems: import_zod86.z.unknown().optional(),
|
|
7595
7641
|
originalVariants: PostPurchaseOriginalVariants
|
|
7596
7642
|
});
|
|
7597
7643
|
|
|
@@ -7670,7 +7716,7 @@ var prepareMember = (widgetId, settings, response, requested, report, excludedPr
|
|
|
7670
7716
|
const selected = PostPurchaseCollectionChoice.parse(requested);
|
|
7671
7717
|
const stsResult = sts && preparePostPurchaseStsMember(widgetId, settings, response, selected, sts, requestedQuantity, report);
|
|
7672
7718
|
if (stsResult !== void 0) return stsResult;
|
|
7673
|
-
const { members, normalized } = normalizePostPurchaseCollection(settings, response, excludedProductIds);
|
|
7719
|
+
const { members, normalized } = normalizePostPurchaseCollection(settings, response, excludedProductIds, report);
|
|
7674
7720
|
const found = members.find(({ product: product2 }) => product2.id === selected.productId);
|
|
7675
7721
|
if (!found) return null;
|
|
7676
7722
|
const variantId = selected.variantId ?? (defaults && resolvePostPurchaseMemberDefault(found.product, normalized.original, defaults));
|
|
@@ -7844,7 +7890,7 @@ var preparePostPurchaseGroupAdmissionView = (widgetId, settings, response, reque
|
|
|
7844
7890
|
|
|
7845
7891
|
// src/server/preparePostPurchaseGroupDefault.ts
|
|
7846
7892
|
var preparePostPurchaseGroupDefault = (widgetId, settings, response, memberProductId, context, report, excludedProductIds) => {
|
|
7847
|
-
const { members, normalized } = normalizePostPurchaseCollection(settings, response);
|
|
7893
|
+
const { members, normalized } = normalizePostPurchaseCollection(settings, response, void 0, report);
|
|
7848
7894
|
const member = members.find(({ product }) => product.id === memberProductId);
|
|
7849
7895
|
if (!member || !member.product.productGroupVariants.length) return null;
|
|
7850
7896
|
const group = readPostPurchaseGroup(member.product, normalized.effective, excludedProductIds);
|
|
@@ -7903,7 +7949,7 @@ var preparePostPurchaseCollectionGroup = (widgetId, settings, response, member,
|
|
|
7903
7949
|
// src/server/preparePostPurchaseCollectionView.ts
|
|
7904
7950
|
var CollectionChoice = PostPurchaseCollectionChoice.omit({ variantId: true });
|
|
7905
7951
|
var preparePostPurchaseCollectionView = (widgetId, settings, response, report, requested, excludedProductIds, defaults, sts) => {
|
|
7906
|
-
const { members, normalized } = normalizePostPurchaseCollection(settings, response);
|
|
7952
|
+
const { members, normalized } = normalizePostPurchaseCollection(settings, response, void 0, report);
|
|
7907
7953
|
const excluded = PostPurchaseExcludedProductIds.parse(excludedProductIds);
|
|
7908
7954
|
const selected = CollectionChoice.optional().parse(requested);
|
|
7909
7955
|
const stsMode = sts && stsAllowed(normalized) ? sts : void 0;
|
|
@@ -8029,10 +8075,10 @@ var classifyPostPurchaseOffer = (settings, response, context, options2) => {
|
|
|
8029
8075
|
};
|
|
8030
8076
|
|
|
8031
8077
|
// src/server/preparePostPurchaseDeclineDisplay.ts
|
|
8032
|
-
var
|
|
8078
|
+
var import_zod88 = require("zod");
|
|
8033
8079
|
|
|
8034
8080
|
// src/schema/postPurchaseDecline.ts
|
|
8035
|
-
var
|
|
8081
|
+
var import_zod87 = require("zod");
|
|
8036
8082
|
var OfferDeclineRequestSchema = DecideRequestSchema.extend({
|
|
8037
8083
|
entryRevision: PostPurchaseProgressSchema.shape.entryRevision,
|
|
8038
8084
|
productId: PostPurchaseProgressSchema.shape.members.element.shape.productId,
|
|
@@ -8044,13 +8090,13 @@ var OfferDeclineRequestSchema = DecideRequestSchema.extend({
|
|
|
8044
8090
|
"Selected merchandise requires a variant"
|
|
8045
8091
|
);
|
|
8046
8092
|
var RecordedOfferDeclineSchema = PostPurchaseProgressSchema.shape.members.element.omit({ declineDelivery: true, status: true }).extend({ entry: DecisionEntrySchema.strict(), entryRevision: PostPurchaseProgressSchema.shape.entryRevision }).strict();
|
|
8047
|
-
var OfferDeclineResponseSchema =
|
|
8048
|
-
data:
|
|
8049
|
-
successful:
|
|
8093
|
+
var OfferDeclineResponseSchema = import_zod87.z.object({
|
|
8094
|
+
data: import_zod87.z.object({ decline: RecordedOfferDeclineSchema, progress: PostPurchaseProgressSchema }),
|
|
8095
|
+
successful: import_zod87.z.literal(true)
|
|
8050
8096
|
});
|
|
8051
8097
|
|
|
8052
8098
|
// src/server/preparePostPurchaseDeclineDisplay.ts
|
|
8053
|
-
var Selection =
|
|
8099
|
+
var Selection = import_zod88.z.object({
|
|
8054
8100
|
productId: OfferDeclineRequestSchema.shape.productId,
|
|
8055
8101
|
variant: OfferDeclineRequestSchema.shape.variant.unwrap()
|
|
8056
8102
|
});
|
|
@@ -8080,30 +8126,30 @@ var preparePostPurchaseGroupDeclineDisplay = (settings, response, requested, exc
|
|
|
8080
8126
|
|
|
8081
8127
|
// src/server/preparePostPurchaseOfferPresentation.ts
|
|
8082
8128
|
var import_compat8 = require("es-toolkit/compat");
|
|
8083
|
-
var
|
|
8129
|
+
var import_zod90 = require("zod");
|
|
8084
8130
|
|
|
8085
8131
|
// src/schema/postPurchaseOfferPresentation.ts
|
|
8086
|
-
var
|
|
8132
|
+
var import_zod89 = require("zod");
|
|
8087
8133
|
var language2 = PostPurchaseSettings.shape.language.shape.global.unwrap().unwrap();
|
|
8088
|
-
var PostPurchaseOfferPresentation =
|
|
8134
|
+
var PostPurchaseOfferPresentation = import_zod89.z.strictObject({
|
|
8089
8135
|
labels: language2.pick({ declineAll: true, declineThisOffer: true }),
|
|
8090
8136
|
layout: PostPurchaseSettings.shape.offersLayout,
|
|
8091
8137
|
sections: CABRootSection.nullable(),
|
|
8092
8138
|
showDeclineAll: PostPurchaseSettings.shape.productOptions.shape.showDeclineAll
|
|
8093
8139
|
});
|
|
8094
8140
|
var OfferPresentationRequestSchema = DecideRequestSchema.strict();
|
|
8095
|
-
var OfferPresentationResponseSchema =
|
|
8096
|
-
data:
|
|
8141
|
+
var OfferPresentationResponseSchema = import_zod89.z.object({
|
|
8142
|
+
data: import_zod89.z.strictObject({
|
|
8097
8143
|
presentation: PostPurchaseOfferPresentation.nullable(),
|
|
8098
8144
|
progress: PostPurchaseProgressSchema.nullable(),
|
|
8099
8145
|
serverNow: PostPurchaseTimestampSchema
|
|
8100
8146
|
}),
|
|
8101
|
-
successful:
|
|
8147
|
+
successful: import_zod89.z.literal(true)
|
|
8102
8148
|
});
|
|
8103
8149
|
|
|
8104
8150
|
// src/server/preparePostPurchaseOfferPresentation.ts
|
|
8105
8151
|
var FrameSettings = PostPurchaseSettings.pick({ language: true, offersLayout: true, productOptions: true }).extend({
|
|
8106
|
-
blocks:
|
|
8152
|
+
blocks: import_zod90.z.array(import_zod90.z.unknown()).optional()
|
|
8107
8153
|
});
|
|
8108
8154
|
var preparePostPurchaseOfferPresentation = (widgetId, settings, response, report) => {
|
|
8109
8155
|
const { metadata } = PostPurchaseProductSource.pick({ metadata: true }).parse(deepCamelCase(response));
|
|
@@ -8268,7 +8314,7 @@ var postAnalyticsEvents = async (input, ctx) => {
|
|
|
8268
8314
|
};
|
|
8269
8315
|
|
|
8270
8316
|
// src/server/requestSchemas.ts
|
|
8271
|
-
var
|
|
8317
|
+
var import_zod91 = require("zod");
|
|
8272
8318
|
var REQUEST_BOUNDS = {
|
|
8273
8319
|
/** Cart-level attributes per cart. */
|
|
8274
8320
|
CART_ATTRIBUTES_MAX: 100,
|
|
@@ -8299,42 +8345,42 @@ var REQUEST_BOUNDS = {
|
|
|
8299
8345
|
/** Rich ads transaction lines — the engine's ads contract. */
|
|
8300
8346
|
TRANSACTION_ITEMS_MAX: 50
|
|
8301
8347
|
};
|
|
8302
|
-
var KeyValue =
|
|
8303
|
-
key:
|
|
8304
|
-
value:
|
|
8348
|
+
var KeyValue = import_zod91.z.object({
|
|
8349
|
+
key: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX),
|
|
8350
|
+
value: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_VALUE_MAX).optional()
|
|
8305
8351
|
});
|
|
8306
|
-
var CartLineInputSchema =
|
|
8307
|
-
productId:
|
|
8308
|
-
properties:
|
|
8309
|
-
quantity:
|
|
8310
|
-
subscriptionId:
|
|
8311
|
-
variantId:
|
|
8352
|
+
var CartLineInputSchema = import_zod91.z.object({
|
|
8353
|
+
productId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
8354
|
+
properties: import_zod91.z.array(KeyValue).max(REQUEST_BOUNDS.LINE_PROPERTIES_MAX).optional(),
|
|
8355
|
+
quantity: import_zod91.z.number(),
|
|
8356
|
+
subscriptionId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
8357
|
+
variantId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX)
|
|
8312
8358
|
});
|
|
8313
|
-
var CartInputSchema =
|
|
8314
|
-
attributes:
|
|
8359
|
+
var CartInputSchema = import_zod91.z.object({
|
|
8360
|
+
attributes: import_zod91.z.array(KeyValue).max(REQUEST_BOUNDS.CART_ATTRIBUTES_MAX).optional(),
|
|
8315
8361
|
/**
|
|
8316
8362
|
* Presentment-per-shop-currency FX rate (buyer price ÷ shop price, e.g. `1.35` for a USD shop
|
|
8317
8363
|
* selling in CAD). Money rule thresholds are authored in SHOP currency, so the engine subtotal is
|
|
8318
8364
|
* divided by this before evaluation. Omit (or send 1) when the cart is already in the shop's currency.
|
|
8319
8365
|
*/
|
|
8320
|
-
currencyRate:
|
|
8366
|
+
currencyRate: import_zod91.z.number().optional(),
|
|
8321
8367
|
/** Applied discount codes; the engine evaluates `discount_code` rules against them (sent as `[{code}]`). */
|
|
8322
|
-
discountCodes:
|
|
8368
|
+
discountCodes: import_zod91.z.array(import_zod91.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX)).max(REQUEST_BOUNDS.DISCOUNT_CODES_MAX).optional(),
|
|
8323
8369
|
/** Presentment cents of cart-level discount allocations, subtracted from `subtotal` for the engine. */
|
|
8324
|
-
discountTotal:
|
|
8325
|
-
items:
|
|
8370
|
+
discountTotal: import_zod91.z.number().optional(),
|
|
8371
|
+
items: import_zod91.z.array(CartLineInputSchema).max(REQUEST_BOUNDS.CART_ITEMS_MAX),
|
|
8326
8372
|
/** Presentment subtotal in cents. */
|
|
8327
|
-
subtotal:
|
|
8373
|
+
subtotal: import_zod91.z.number()
|
|
8328
8374
|
});
|
|
8329
|
-
var UserConfigInputSchema =
|
|
8330
|
-
var DataSourceInputSchema =
|
|
8375
|
+
var UserConfigInputSchema = import_zod91.z.object({ shop: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX) });
|
|
8376
|
+
var DataSourceInputSchema = import_zod91.z.object({
|
|
8331
8377
|
cart: CartInputSchema,
|
|
8332
8378
|
/**
|
|
8333
8379
|
* Numeric Shopify company-location id when the buyer is a B2B session (`buyerIdentity.purchasingCompany`).
|
|
8334
8380
|
* Present ⇒ the orchestrator filters results by the location's catalog via admin-api (REB-23713); the
|
|
8335
8381
|
* client's country-context market check is bypassed for B2B (it false-negatives B2B-catalog products).
|
|
8336
8382
|
*/
|
|
8337
|
-
companyLocationId:
|
|
8383
|
+
companyLocationId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
8338
8384
|
/**
|
|
8339
8385
|
* Buyer's market country (ISO 3166-1 alpha-2) — forwarded to the engine as the `country_code` PARAM
|
|
8340
8386
|
* when the shop's markets toggle is on (REB-21688; the sink was the `X-Country-Code` header under
|
|
@@ -8343,16 +8389,16 @@ var DataSourceInputSchema = import_zod90.z.object({
|
|
|
8343
8389
|
* uppercase (the wire value is forwarded verbatim as the param) so a case-sensitive engine lookup
|
|
8344
8390
|
* can't silently miss a lowercase code — `adsEngine.ts` uppercases for the same reason.
|
|
8345
8391
|
*/
|
|
8346
|
-
country:
|
|
8347
|
-
customerId:
|
|
8348
|
-
dataSourcePath:
|
|
8392
|
+
country: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).regex(/^[A-Za-z]{2}$/, "must be an ISO 3166-1 alpha-2 country code (e.g. CA)").transform((value) => value.toUpperCase()).optional(),
|
|
8393
|
+
customerId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
8394
|
+
dataSourcePath: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX),
|
|
8349
8395
|
/**
|
|
8350
8396
|
* Engine `filter_inputs` override: `'no'` keeps in-cart (input) products in the results/rule
|
|
8351
8397
|
* outputs — gift validation sends it so a gift's own product can appear in its answer. Omitted = the
|
|
8352
8398
|
* engine's default filtering.
|
|
8353
8399
|
*/
|
|
8354
|
-
filterInputs:
|
|
8355
|
-
integrations:
|
|
8400
|
+
filterInputs: import_zod91.z.enum(["no", "yes"]).optional(),
|
|
8401
|
+
integrations: import_zod91.z.record(import_zod91.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX), import_zod91.z.boolean()).refine((record) => Object.keys(record).length <= REQUEST_BOUNDS.INTEGRATION_KEYS_MAX, {
|
|
8356
8402
|
message: `Too many integration keys (max ${REQUEST_BOUNDS.INTEGRATION_KEYS_MAX})`
|
|
8357
8403
|
}).optional(),
|
|
8358
8404
|
/**
|
|
@@ -8365,31 +8411,31 @@ var DataSourceInputSchema = import_zod90.z.object({
|
|
|
8365
8411
|
* request header) fails the regex. Callers should send the buyer's resolved locale (e.g. Shopify
|
|
8366
8412
|
* checkout's `localization.language.isoCode`), not the request header verbatim.
|
|
8367
8413
|
*/
|
|
8368
|
-
language:
|
|
8369
|
-
limit:
|
|
8370
|
-
productType:
|
|
8371
|
-
shop:
|
|
8372
|
-
visitorId:
|
|
8373
|
-
});
|
|
8374
|
-
var GiftInputSchema =
|
|
8375
|
-
cost:
|
|
8376
|
-
discounted:
|
|
8414
|
+
language: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).regex(/^[A-Za-z0-9-]+$/, "must be a single BCP-47 tag (e.g. fr-CA), not a q-value list").optional(),
|
|
8415
|
+
limit: import_zod91.z.number().max(REQUEST_BOUNDS.LIMIT_MAX),
|
|
8416
|
+
productType: import_zod91.z.enum(["both", "one-time", "subscription"]).optional(),
|
|
8417
|
+
shop: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
8418
|
+
visitorId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
8419
|
+
});
|
|
8420
|
+
var GiftInputSchema = import_zod91.z.object({
|
|
8421
|
+
cost: import_zod91.z.number(),
|
|
8422
|
+
discounted: import_zod91.z.boolean(),
|
|
8377
8423
|
/**
|
|
8378
8424
|
* Which gift attribution the line carries (REB-24363). Defaults to `gwp` because a client that predates
|
|
8379
8425
|
* the field only ever sent GWP lines — without the default an older extension's request would 422.
|
|
8380
8426
|
*/
|
|
8381
|
-
kind:
|
|
8382
|
-
lineId:
|
|
8383
|
-
productId:
|
|
8427
|
+
kind: import_zod91.z.enum(GIFT_KINDS).default("gwp"),
|
|
8428
|
+
lineId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
8429
|
+
productId: import_zod91.z.number(),
|
|
8384
8430
|
/**
|
|
8385
8431
|
* The line's unit count (REB-24363) — the selectable-GWP verdict trims surplus units against milestone
|
|
8386
8432
|
* capacity. The second deliberate default: a client predating the field sent only GWP lines, whose
|
|
8387
8433
|
* verdict is whole-line, so a missing quantity reads as one unit rather than 422ing the older request.
|
|
8388
8434
|
*/
|
|
8389
|
-
quantity:
|
|
8390
|
-
widgetId:
|
|
8435
|
+
quantity: import_zod91.z.number().int().min(1).default(1),
|
|
8436
|
+
widgetId: import_zod91.z.number()
|
|
8391
8437
|
});
|
|
8392
|
-
var GiftValidationInputSchema =
|
|
8438
|
+
var GiftValidationInputSchema = import_zod91.z.object({
|
|
8393
8439
|
cart: CartInputSchema,
|
|
8394
8440
|
/**
|
|
8395
8441
|
* Buyer's market country — threaded into the per-widget data-source evaluations, which forward it to
|
|
@@ -8398,25 +8444,25 @@ var GiftValidationInputSchema = import_zod90.z.object({
|
|
|
8398
8444
|
* turns markets off); regex-bound and uppercase-normalized for the same reasons as
|
|
8399
8445
|
* `DataSourceInputSchema`'s `country`.
|
|
8400
8446
|
*/
|
|
8401
|
-
country:
|
|
8402
|
-
customerId:
|
|
8403
|
-
gifts:
|
|
8447
|
+
country: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).regex(/^[A-Za-z]{2}$/, "must be an ISO 3166-1 alpha-2 country code (e.g. CA)").transform((value) => value.toUpperCase()).optional(),
|
|
8448
|
+
customerId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
8449
|
+
gifts: import_zod91.z.array(GiftInputSchema).max(REQUEST_BOUNDS.GIFTS_MAX),
|
|
8404
8450
|
/**
|
|
8405
8451
|
* Buyer's checkout language — threaded into the per-widget data-source evaluations, which normalize
|
|
8406
8452
|
* and forward it as the engine `locale` param under the same markets-toggle gate (REB-21688). MUST be
|
|
8407
8453
|
* a single BCP-47 tag, for the same reason as `DataSourceInputSchema`'s `language` above.
|
|
8408
8454
|
*/
|
|
8409
|
-
language:
|
|
8410
|
-
shop:
|
|
8411
|
-
visitorId:
|
|
8455
|
+
language: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).regex(/^[A-Za-z0-9-]+$/, "must be a single BCP-47 tag (e.g. fr-CA), not a q-value list").optional(),
|
|
8456
|
+
shop: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
8457
|
+
visitorId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
8412
8458
|
});
|
|
8413
|
-
var GiftAdjustmentSchema =
|
|
8414
|
-
lineId:
|
|
8415
|
-
quantity:
|
|
8459
|
+
var GiftAdjustmentSchema = import_zod91.z.object({
|
|
8460
|
+
lineId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
8461
|
+
quantity: import_zod91.z.number().int().nonnegative()
|
|
8416
8462
|
});
|
|
8417
|
-
var GiftValidationResponseSchema =
|
|
8418
|
-
adjust:
|
|
8419
|
-
remove:
|
|
8463
|
+
var GiftValidationResponseSchema = import_zod91.z.object({
|
|
8464
|
+
adjust: import_zod91.z.array(GiftAdjustmentSchema).max(REQUEST_BOUNDS.GIFTS_MAX).default([]),
|
|
8465
|
+
remove: import_zod91.z.array(import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX)).max(REQUEST_BOUNDS.GIFTS_MAX).refine(
|
|
8420
8466
|
(remove) => new Set(remove).size === remove.length,
|
|
8421
8467
|
"a line id may appear at most once in `remove`"
|
|
8422
8468
|
)
|
|
@@ -8427,47 +8473,47 @@ var GiftValidationResponseSchema = import_zod90.z.object({
|
|
|
8427
8473
|
({ adjust }) => new Set(adjust.map(({ lineId }) => lineId)).size === adjust.length,
|
|
8428
8474
|
"a line id may appear at most once in `adjust`"
|
|
8429
8475
|
);
|
|
8430
|
-
var MonetizeTransactionItemSchema =
|
|
8431
|
-
id:
|
|
8432
|
-
priceCents:
|
|
8433
|
-
quantity:
|
|
8434
|
-
title:
|
|
8435
|
-
type:
|
|
8436
|
-
});
|
|
8437
|
-
var MonetizeInputSchema =
|
|
8476
|
+
var MonetizeTransactionItemSchema = import_zod91.z.object({
|
|
8477
|
+
id: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
8478
|
+
priceCents: import_zod91.z.number(),
|
|
8479
|
+
quantity: import_zod91.z.number(),
|
|
8480
|
+
title: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX),
|
|
8481
|
+
type: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX)
|
|
8482
|
+
});
|
|
8483
|
+
var MonetizeInputSchema = import_zod91.z.object({
|
|
8438
8484
|
cart: CartInputSchema,
|
|
8439
8485
|
/** Client-minted render-beacon correlation id; forwarded to the ads engine as `client_request_id`. */
|
|
8440
|
-
clientRequestId:
|
|
8441
|
-
country:
|
|
8442
|
-
currency:
|
|
8486
|
+
clientRequestId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
8487
|
+
country: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
8488
|
+
currency: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
8443
8489
|
/** Ads-targeting identity/geo/locale fields (React parity); folded into the engine query verbatim. */
|
|
8444
|
-
customerEmail:
|
|
8445
|
-
customerFirstName:
|
|
8446
|
-
customerId:
|
|
8447
|
-
customerLastName:
|
|
8448
|
-
language:
|
|
8490
|
+
customerEmail: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
|
|
8491
|
+
customerFirstName: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
|
|
8492
|
+
customerId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
8493
|
+
customerLastName: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
|
|
8494
|
+
language: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
8449
8495
|
/** Buyer-facing order name (e.g. `#1001`) for the server-composed "Order … Confirmed" chrome line. */
|
|
8450
|
-
orderName:
|
|
8496
|
+
orderName: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
|
|
8451
8497
|
/** Ads surface label, forwarded verbatim; `customer_account` is measured/floored as its own surface (the account-area order list). */
|
|
8452
|
-
placement:
|
|
8498
|
+
placement: import_zod91.z.enum(["customer_account", "order_status", "thank_you_page"]),
|
|
8453
8499
|
/** Privacy Policy footer href — the Monetize widget's `privacy_policy_url` setting (React parity). */
|
|
8454
|
-
privacyPolicyUrl:
|
|
8500
|
+
privacyPolicyUrl: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_URL_MAX).optional(),
|
|
8455
8501
|
/** 30-min rolling session id (React parity); used for the ads `session_id`, else the visitor id. */
|
|
8456
|
-
sessionId:
|
|
8457
|
-
shop:
|
|
8502
|
+
sessionId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
8503
|
+
shop: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
8458
8504
|
/** Editor/QA indicator; OR-ed into the ads-engine `testing` flag so it stays out of billing/reporting. */
|
|
8459
|
-
testing:
|
|
8460
|
-
timezone:
|
|
8505
|
+
testing: import_zod91.z.boolean().optional(),
|
|
8506
|
+
timezone: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
8461
8507
|
/** Decorated (numeric) order id → the ads `transaction_id`. */
|
|
8462
|
-
transactionId:
|
|
8508
|
+
transactionId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
8463
8509
|
/** Rich per-line ads items; capped at the engine's ads contract. Preferred over `cart.items`. */
|
|
8464
|
-
transactionItems:
|
|
8510
|
+
transactionItems: import_zod91.z.array(MonetizeTransactionItemSchema).max(REQUEST_BOUNDS.TRANSACTION_ITEMS_MAX).optional(),
|
|
8465
8511
|
/** Order total in presentment cents (React prefers total over subtotal); else `cart.subtotal`. */
|
|
8466
|
-
transactionTotal:
|
|
8467
|
-
visitorId:
|
|
8468
|
-
zipCode:
|
|
8512
|
+
transactionTotal: import_zod91.z.number().optional(),
|
|
8513
|
+
visitorId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
8514
|
+
zipCode: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
8469
8515
|
});
|
|
8470
|
-
var WidgetSettingsInputSchema =
|
|
8516
|
+
var WidgetSettingsInputSchema = import_zod91.z.object({
|
|
8471
8517
|
/**
|
|
8472
8518
|
* Same domain as `CabShopConfig.cacheKey`, for the same reason: this side WINS the orchestrator's
|
|
8473
8519
|
* `input.cacheKey ?? config.shop.cacheKey` (and an explicit value skips the config read entirely), so
|
|
@@ -8475,9 +8521,9 @@ var WidgetSettingsInputSchema = import_zod90.z.object({
|
|
|
8475
8521
|
* and pin the edge copy permanently stale. `.catch(undefined)` because a bogus buster should degrade
|
|
8476
8522
|
* the read to un-busted, never 400 a widget render.
|
|
8477
8523
|
*/
|
|
8478
|
-
cacheKey:
|
|
8479
|
-
id:
|
|
8480
|
-
key:
|
|
8524
|
+
cacheKey: import_zod91.z.number().int().positive().optional().catch(void 0),
|
|
8525
|
+
id: import_zod91.z.number(),
|
|
8526
|
+
key: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
8481
8527
|
/**
|
|
8482
8528
|
* Monetize context for inline hydration: when present AND the widget converts to a Monetize marker,
|
|
8483
8529
|
* the server fetches/composes the offer cards inside this same request (no second `/cab/monetize`
|
|
@@ -8486,34 +8532,34 @@ var WidgetSettingsInputSchema = import_zod90.z.object({
|
|
|
8486
8532
|
* `privacyPolicyUrl` comes from the widget settings server-side (more authoritative than a relay).
|
|
8487
8533
|
*/
|
|
8488
8534
|
monetize: MonetizeInputSchema.omit({ privacyPolicyUrl: true, shop: true }).optional(),
|
|
8489
|
-
shop:
|
|
8535
|
+
shop: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
8490
8536
|
/** Stable per-buyer id; when present, enables sticky server-side A/B variant selection. */
|
|
8491
|
-
visitorId:
|
|
8537
|
+
visitorId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
8492
8538
|
});
|
|
8493
|
-
var AnalyticsEventInputSchema =
|
|
8494
|
-
name:
|
|
8495
|
-
properties:
|
|
8496
|
-
sentAt:
|
|
8539
|
+
var AnalyticsEventInputSchema = import_zod91.z.object({
|
|
8540
|
+
name: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX),
|
|
8541
|
+
properties: import_zod91.z.record(import_zod91.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX), import_zod91.z.unknown()).optional(),
|
|
8542
|
+
sentAt: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
8497
8543
|
});
|
|
8498
|
-
var AnalyticsSegmentsInputSchema =
|
|
8499
|
-
device:
|
|
8500
|
-
source:
|
|
8501
|
-
visitor:
|
|
8544
|
+
var AnalyticsSegmentsInputSchema = import_zod91.z.object({
|
|
8545
|
+
device: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional().catch(void 0),
|
|
8546
|
+
source: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional().catch(void 0),
|
|
8547
|
+
visitor: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional().catch(void 0)
|
|
8502
8548
|
});
|
|
8503
|
-
var AnalyticsInputSchema =
|
|
8549
|
+
var AnalyticsInputSchema = import_zod91.z.object({
|
|
8504
8550
|
/** Rebuy cart token (the `r_cart_token` cart attribute), when available — primary aggregation key. */
|
|
8505
|
-
cartToken:
|
|
8551
|
+
cartToken: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
8506
8552
|
/** Shopify checkout token, when available — drives cart/checkout aggregation downstream. */
|
|
8507
|
-
checkoutToken:
|
|
8508
|
-
events:
|
|
8553
|
+
checkoutToken: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
8554
|
+
events: import_zod91.z.array(AnalyticsEventInputSchema).max(REQUEST_BOUNDS.EVENTS_MAX),
|
|
8509
8555
|
/**
|
|
8510
8556
|
* Request-scoped like the tokens: one visitor's segments apply to every event in the batch. The container
|
|
8511
8557
|
* degrades too (`null` is a realistic wire artifact of `attributes ? {…} : null`), so the degrade rule is
|
|
8512
8558
|
* total: nothing about `segments` can cost the envelope.
|
|
8513
8559
|
*/
|
|
8514
8560
|
segments: AnalyticsSegmentsInputSchema.optional().catch(void 0),
|
|
8515
|
-
shop:
|
|
8516
|
-
visitorId:
|
|
8561
|
+
shop: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
8562
|
+
visitorId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
8517
8563
|
/** The widget id (smartBlockId) the events belong to. */
|
|
8518
|
-
widgetId:
|
|
8564
|
+
widgetId: import_zod91.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
8519
8565
|
});
|