@rebuy/rebuy 3.36.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.
Files changed (35) hide show
  1. package/dist/index.cjs +689 -656
  2. package/dist/index.mjs +689 -656
  3. package/dist/schema/index.d.ts +1 -0
  4. package/dist/schema/postPurchaseProduct.d.ts +28 -0
  5. package/dist/schema/postPurchaseProductCollectionView.d.ts +14 -0
  6. package/dist/schema/postPurchaseProductDisplay.d.ts +16 -4
  7. package/dist/schema/postPurchaseProductReviews.d.ts +36 -0
  8. package/dist/schema/postPurchaseProductView.d.ts +14 -0
  9. package/dist/schema/postPurchaseSubscriptionProduct.d.ts +24 -0
  10. package/dist/server/__fixtures__/postPurchaseReviewProviders.d.ts +30 -0
  11. package/dist/server/__fixtures__/postPurchaseReviews.d.ts +67 -0
  12. package/dist/server/index.cjs +382 -224
  13. package/dist/server/index.mjs +382 -224
  14. package/dist/server/postPurchaseJudgeMeReviews.d.ts +6 -0
  15. package/dist/server/postPurchaseOkendoReviews.d.ts +6 -0
  16. package/dist/server/postPurchaseProductDisplay.d.ts +12 -2
  17. package/dist/server/postPurchaseReviewData.d.ts +7 -0
  18. package/dist/server/postPurchaseReviewFields.d.ts +7 -0
  19. package/dist/server/postPurchaseReviewProvider.d.ts +2 -0
  20. package/dist/server/postPurchaseReviews.d.ts +5 -0
  21. package/dist/server/postPurchaseScalarReviews.d.ts +6 -0
  22. package/dist/server/prepareNormalizedSubscription.d.ts +2 -2
  23. package/dist/server/preparePostPurchaseAdmissionView.d.ts +10 -0
  24. package/dist/server/preparePostPurchaseCollectionGroup.d.ts +10 -0
  25. package/dist/server/preparePostPurchaseCollectionView.d.ts +10 -0
  26. package/dist/server/preparePostPurchaseGroupAdmissionView.d.ts +10 -0
  27. package/dist/server/preparePostPurchaseGroupDefault.d.ts +10 -0
  28. package/dist/server/preparePostPurchaseGroupView.d.ts +10 -0
  29. package/dist/server/preparePostPurchaseMemberView.d.ts +30 -0
  30. package/dist/server/preparePostPurchaseProduct.d.ts +1 -4
  31. package/dist/server/preparePostPurchaseQuantityAdmissionView.d.ts +10 -0
  32. package/dist/server/preparePostPurchaseQuantityView.d.ts +10 -0
  33. package/dist/server/preparePostPurchaseSubscription.d.ts +10 -0
  34. package/dist/server/projectPostPurchaseProduct.d.ts +12 -1
  35. package/package.json +1 -1
@@ -5889,13 +5889,13 @@ var projectPostPurchasePlanCatalog = (normalized, report) => {
5889
5889
  };
5890
5890
 
5891
5891
  // src/schema/postPurchaseSubscriptionProduct.ts
5892
- import { z as z54 } from "zod";
5892
+ import { z as z55 } from "zod";
5893
5893
 
5894
5894
  // src/schema/postPurchaseProduct.ts
5895
- import { z as z53 } from "zod";
5895
+ import { z as z54 } from "zod";
5896
5896
 
5897
5897
  // src/schema/postPurchaseProductDisplay.ts
5898
- import { z as z51 } from "zod";
5898
+ import { z as z52 } from "zod";
5899
5899
 
5900
5900
  // src/schema/postPurchaseProductGallery.ts
5901
5901
  import { z as z50 } from "zod";
@@ -5911,17 +5911,44 @@ var PostPurchaseProductGallery = z50.object({
5911
5911
  selectedImageId: z50.number().int().positive().optional()
5912
5912
  });
5913
5913
 
5914
+ // src/schema/postPurchaseProductReviews.ts
5915
+ import { z as z51 } from "zod";
5916
+ var decimal = z51.union([
5917
+ z51.number(),
5918
+ z51.string().regex(/^\d+(?:\.\d+)?$/).transform(Number)
5919
+ ]);
5920
+ var PostPurchaseCommonReviewRating = z51.object({ value: decimal.pipe(z51.number().min(0).max(5)) });
5921
+ var PostPurchaseKlaviyoReviewRating = PostPurchaseCommonReviewRating.extend({
5922
+ // Legacy validates key presence, then displays the raw value on five stars without rescaling.
5923
+ scale_max: z51.unknown().nonoptional(),
5924
+ scale_min: z51.unknown().nonoptional()
5925
+ });
5926
+ var PostPurchaseReviewCount = z51.string().regex(/^\d+(?:\.\d+)?$/).transform(Number).pipe(z51.number().int().nonnegative());
5927
+ var PostPurchaseReviewStyles = PostPurchaseSettings.shape.styles.unwrap().extend({
5928
+ strokeWidth: decimal.pipe(z51.number().nonnegative()).default(1)
5929
+ }).prefault({});
5930
+ var PostPurchaseProductReviews = z51.object({
5931
+ color: z51.string(),
5932
+ rating: z51.number().positive().max(5),
5933
+ reviewCount: z51.number().int().nonnegative(),
5934
+ reviewsPlural: z51.string(),
5935
+ reviewsSingular: z51.string(),
5936
+ size: z51.enum(["small", "medium", "large"]),
5937
+ strokeColor: z51.string(),
5938
+ strokeWidth: z51.number().nonnegative()
5939
+ });
5940
+
5914
5941
  // src/schema/postPurchaseProductDisplay.ts
5915
5942
  var language = PostPurchaseSettings.shape.language;
5916
- var PostPurchasePrimaryImageSource = z51.string().default(
5943
+ var PostPurchasePrimaryImageSource = z52.string().default(
5917
5944
  "https://cdn.shopify.com/shopifycloud/shopify/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c.gif"
5918
5945
  );
5919
- var PostPurchaseProductDisplay = z51.object({
5946
+ var PostPurchaseProductDisplay = z52.object({
5920
5947
  descriptionDocument: TiptapDocument.optional(),
5921
5948
  discountedFrom: PostPurchaseSettings.shape.discountedFrom,
5922
5949
  gallery: PostPurchaseProductGallery.optional(),
5923
5950
  language: language.pick({ description: true, descriptionEnabled: true }),
5924
- primaryImage: z51.object({ description: z51.string(), source: z51.string() }),
5951
+ primaryImage: z52.object({ description: z52.string(), source: z52.string() }),
5925
5952
  productOptions: PostPurchaseSettings.shape.productOptions.pick({
5926
5953
  showDeclineAll: true,
5927
5954
  showShipping: true,
@@ -5931,18 +5958,19 @@ var PostPurchaseProductDisplay = z51.object({
5931
5958
  showVariantSelectors: true
5932
5959
  }),
5933
5960
  responseDescription: language.shape.description,
5961
+ reviews: PostPurchaseProductReviews.nullable().default(null),
5934
5962
  shouldShowSavingText: PostPurchaseSettings.shape.discount.shape.shouldShowSavingText
5935
5963
  });
5936
5964
 
5937
5965
  // src/schema/postPurchaseSubscription.ts
5938
- import { z as z52 } from "zod";
5939
- var PostPurchaseSubscriptionTerms = z52.object({
5966
+ import { z as z53 } from "zod";
5967
+ var PostPurchaseSubscriptionTerms = z53.object({
5940
5968
  adjustment: PostPurchasePlanAdjustment.optional(),
5941
- initialShippingPrice: z52.number().nonnegative(),
5942
- intervalLabel: z52.string().min(1),
5943
- name: z52.string().min(1),
5944
- recurringShippingPrice: z52.number().nonnegative(),
5945
- shippingOption: z52.object({ presentmentTitle: z52.string(), title: z52.string() })
5969
+ initialShippingPrice: z53.number().nonnegative(),
5970
+ intervalLabel: z53.string().min(1),
5971
+ name: z53.string().min(1),
5972
+ recurringShippingPrice: z53.number().nonnegative(),
5973
+ shippingOption: z53.object({ presentmentTitle: z53.string(), title: z53.string() })
5946
5974
  });
5947
5975
 
5948
5976
  // src/schema/postPurchaseProduct.ts
@@ -5952,51 +5980,51 @@ var PostPurchaseVariant = OfferProduct.shape.variants.element.pick({ id: true, t
5952
5980
  id: PostPurchaseVariantId,
5953
5981
  price: PostPurchaseAmount
5954
5982
  });
5955
- var PreparedPostPurchaseProduct = z53.object({
5983
+ var PreparedPostPurchaseProduct = z54.object({
5956
5984
  display: PostPurchaseProductDisplay,
5957
- labels: z53.object({
5985
+ labels: z54.object({
5958
5986
  declineAll: global.declineAll,
5959
- free: z53.string(),
5960
- payNow: z53.string(),
5961
- quantity: z53.string(),
5987
+ free: z54.string(),
5988
+ payNow: z54.string(),
5989
+ quantity: z54.string(),
5962
5990
  recurringShipping: global.recurringShipping,
5963
5991
  recurringSubtotal: global.recurringSubtotal,
5964
- save: z53.string(),
5965
- shipping: z53.string(),
5966
- subtotal: z53.string(),
5967
- taxes: z53.string(),
5968
- total: z53.string()
5992
+ save: z54.string(),
5993
+ shipping: z54.string(),
5994
+ subtotal: z54.string(),
5995
+ taxes: z54.string(),
5996
+ total: z54.string()
5969
5997
  }),
5970
5998
  product: OfferProduct.pick({ description: true, id: true, image: true, title: true }).extend({
5971
5999
  description: OfferProduct.shape.description.nullable(),
5972
6000
  id: PostPurchaseProductId,
5973
6001
  variant: PostPurchaseVariant
5974
6002
  }),
5975
- selection: z53.object({
6003
+ selection: z54.object({
5976
6004
  productId: PostPurchaseProductId,
5977
- quantity: z53.number().int().positive(),
5978
- sellingPlanId: z53.number().int().positive().optional(),
6005
+ quantity: z54.number().int().positive(),
6006
+ sellingPlanId: z54.number().int().positive().optional(),
5979
6007
  variantId: PostPurchaseVariantId
5980
6008
  }),
5981
- status: z53.literal("prepared"),
5982
- terms: z53.object({
6009
+ status: z54.literal("prepared"),
6010
+ terms: z54.object({
5983
6011
  discount: PostPurchaseDiscount,
5984
- shipping: z53.object({
5985
- amount: z53.number().nonnegative(),
5986
- title: z53.string(),
5987
- type: z53.enum(["free", "fixed_amount"])
6012
+ shipping: z54.object({
6013
+ amount: z54.number().nonnegative(),
6014
+ title: z54.string(),
6015
+ type: z54.enum(["free", "fixed_amount"])
5988
6016
  }),
5989
6017
  subscription: PostPurchaseSubscriptionTerms.optional()
5990
6018
  })
5991
6019
  });
5992
- var PostPurchasePreparation = z53.discriminatedUnion("status", [
6020
+ var PostPurchasePreparation = z54.discriminatedUnion("status", [
5993
6021
  PreparedPostPurchaseProduct,
5994
- z53.object({ reason: z53.string(), status: z53.literal("unsupported") })
6022
+ z54.object({ reason: z54.string(), status: z54.literal("unsupported") })
5995
6023
  ]);
5996
6024
 
5997
6025
  // src/schema/postPurchaseSubscriptionProduct.ts
5998
6026
  var PreparedPostPurchaseSubscription = PreparedPostPurchaseProduct.extend({
5999
- selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId: z54.number().int().positive() }),
6027
+ selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId: z55.number().int().positive() }),
6000
6028
  terms: PreparedPostPurchaseProduct.shape.terms.extend({
6001
6029
  subscription: PostPurchaseSubscriptionTerms
6002
6030
  }).refine(
@@ -6038,7 +6066,7 @@ var subscriptionUnavailable = (normalized, plan, allowCollection, quantity2) =>
6038
6066
  };
6039
6067
 
6040
6068
  // src/server/postPurchaseProductDisplay.ts
6041
- import { z as z56 } from "zod";
6069
+ import { z as z57 } from "zod";
6042
6070
 
6043
6071
  // src/server/postPurchasePrimaryImage.ts
6044
6072
  var postPurchasePrimaryImage = (product) => {
@@ -6060,7 +6088,7 @@ var postPurchaseProductGallery = (product, limit) => ({
6060
6088
  });
6061
6089
 
6062
6090
  // src/transforms/postPurchase/convertDescriptionRte.ts
6063
- import { z as z55 } from "zod";
6091
+ import { z as z56 } from "zod";
6064
6092
  var alignments = { center: "center", left: "start", right: "end" };
6065
6093
  var colors = ["critical", "subdued", "success", "warning"];
6066
6094
  var sizes2 = ["extraSmall", "small", "medium", "large", "extraLarge"];
@@ -6072,19 +6100,19 @@ var spacings2 = {
6072
6100
  xloose: "extraLoose",
6073
6101
  xtight: "extraTight"
6074
6102
  };
6075
- var Block = z55.object({
6076
- attrs: z55.object({ alignment: z55.enum(["left", "center", "right"]).optional().catch(void 0) }).catch({}),
6077
- content: z55.array(z55.unknown()).catch([]),
6078
- type: z55.literal("ShopifyTextBlock")
6079
- });
6080
- var Run = z55.object({ marks: z55.array(z55.unknown()).catch([]), text: z55.string().min(1), type: z55.literal("text") });
6081
- var Inline = z55.object({
6082
- attrs: z55.object({
6083
- color: z55.enum(colors).optional().catch(void 0),
6084
- emphasis: z55.array(z55.unknown()).catch([]),
6085
- size: z55.enum(sizes2).optional().catch(void 0)
6103
+ var Block = z56.object({
6104
+ attrs: z56.object({ alignment: z56.enum(["left", "center", "right"]).optional().catch(void 0) }).catch({}),
6105
+ content: z56.array(z56.unknown()).catch([]),
6106
+ type: z56.literal("ShopifyTextBlock")
6107
+ });
6108
+ var Run = z56.object({ marks: z56.array(z56.unknown()).catch([]), text: z56.string().min(1), type: z56.literal("text") });
6109
+ var Inline = z56.object({
6110
+ attrs: z56.object({
6111
+ color: z56.enum(colors).optional().catch(void 0),
6112
+ emphasis: z56.array(z56.unknown()).catch([]),
6113
+ size: z56.enum(sizes2).optional().catch(void 0)
6086
6114
  }),
6087
- type: z55.literal("ShopifyTextInline")
6115
+ type: z56.literal("ShopifyTextInline")
6088
6116
  });
6089
6117
  var marks = (raw) => {
6090
6118
  const found = raw.map((mark) => Inline.safeParse(mark)).find(({ success }) => success)?.data;
@@ -6117,7 +6145,7 @@ var convertDescriptionRte = (rte, spacing) => TiptapDocument.parse({
6117
6145
  });
6118
6146
 
6119
6147
  // src/server/postPurchaseProductDisplay.ts
6120
- var ResponseLanguage = z56.object({ description: PostPurchaseProductDisplay.shape.responseDescription }).default({ description: "" });
6148
+ var ResponseLanguage = z57.object({ description: PostPurchaseProductDisplay.shape.responseDescription }).default({ description: "" });
6121
6149
  var projectPostPurchaseProductDisplay = (effective, metadata, product) => PostPurchaseProductDisplay.parse({
6122
6150
  descriptionDocument: effective.language.descriptionRte && convertDescriptionRte(effective.language.descriptionRte, effective.language.descriptionSpacing),
6123
6151
  discountedFrom: effective.discountedFrom,
@@ -6129,12 +6157,142 @@ var projectPostPurchaseProductDisplay = (effective, metadata, product) => PostPu
6129
6157
  shouldShowSavingText: effective.discount.shouldShowSavingText
6130
6158
  });
6131
6159
 
6160
+ // src/server/postPurchaseReviewData.ts
6161
+ import { z as z61 } from "zod";
6162
+
6163
+ // src/server/postPurchaseJudgeMeReviews.ts
6164
+ import { z as z58 } from "zod";
6165
+ var readJudgeMeReviews = (find) => {
6166
+ const field = find("judgeme", "badge");
6167
+ if (!field) return null;
6168
+ const html = z58.string().parse(field.value);
6169
+ const rating = html.match(/data-average-rating=['"](\d+(?:\.\d+)?)['"]/);
6170
+ const count = html.match(/data-number-of-reviews=['"](\d+)['"]/);
6171
+ if (!rating || !count) throw new Error("Unreadable Judge.me attributes");
6172
+ return {
6173
+ rating: PostPurchaseCommonReviewRating.parse({ value: rating[1] }).value,
6174
+ reviewCount: PostPurchaseReviewCount.parse(count[1])
6175
+ };
6176
+ };
6177
+
6178
+ // src/server/postPurchaseOkendoReviews.ts
6179
+ import { z as z59 } from "zod";
6180
+ var Summary = z59.object({
6181
+ reviewAverageValue: PostPurchaseCommonReviewRating.shape.value,
6182
+ reviewCount: z59.union([PostPurchaseProductReviews.shape.reviewCount, PostPurchaseReviewCount])
6183
+ });
6184
+ var readOkendoReviews = (find) => {
6185
+ const field = find("okendo", "summaryData");
6186
+ if (!field) return null;
6187
+ const summary = Summary.parse(JSON.parse(z59.string().parse(field.value)));
6188
+ return { rating: summary.reviewAverageValue, reviewCount: summary.reviewCount };
6189
+ };
6190
+
6191
+ // src/server/postPurchaseScalarReviews.ts
6192
+ import { z as z60 } from "zod";
6193
+ var readScalarReviews = (find, namespace, ratingKey, countKey) => {
6194
+ const rating = find(namespace, ratingKey);
6195
+ const count = find(namespace, countKey);
6196
+ if (!rating || !count) return null;
6197
+ return {
6198
+ rating: PostPurchaseCommonReviewRating.parse({ value: z60.string().parse(rating.value) }).value,
6199
+ reviewCount: PostPurchaseReviewCount.parse(count.value)
6200
+ };
6201
+ };
6202
+
6203
+ // src/server/postPurchaseReviewData.ts
6204
+ var readPostPurchaseReviewData = (provider, find) => {
6205
+ if (provider === "yotpo") return readScalarReviews(find, "yotpo", "reviews_average", "reviews_count");
6206
+ if (provider === "stamped") return readScalarReviews(find, "stamped", "reviews_average", "reviews_count");
6207
+ if (provider === "judgeme") return readJudgeMeReviews(find);
6208
+ if (provider === "okendo") return readOkendoReviews(find);
6209
+ if (provider === "opinew") return readScalarReviews(find, "opinew_metafields", "reviews_average", "reviews_count");
6210
+ if (provider === "reviewsio") return readScalarReviews(find, "reviewscouk", "rating", "total");
6211
+ if (provider === "loox") return readScalarReviews(find, "loox", "avg_rating", "num_reviews");
6212
+ if (provider === "junip") return readScalarReviews(find, "junip", "rating_average", "rating_count");
6213
+ const rating = find("reviews", "rating");
6214
+ const count = find("reviews", "rating_count");
6215
+ if (!rating || !count) return null;
6216
+ return {
6217
+ rating: PostPurchaseKlaviyoReviewRating.parse(JSON.parse(z61.string().parse(rating.value))).value,
6218
+ reviewCount: PostPurchaseReviewCount.parse(count.value)
6219
+ };
6220
+ };
6221
+
6222
+ // src/server/postPurchaseReviewFields.ts
6223
+ import { z as z62 } from "zod";
6224
+ var Field = z62.object({ key: z62.string(), namespace: z62.string(), value: z62.unknown().optional() });
6225
+ var reviewFields = (raw) => {
6226
+ const fields4 = z62.array(z62.unknown()).parse(raw).flatMap((field) => {
6227
+ const parsed = Field.safeParse(field);
6228
+ return parsed.success ? [parsed.data] : [];
6229
+ });
6230
+ return (namespace, key) => fields4.find((field) => field.namespace === namespace && field.key === key);
6231
+ };
6232
+
6233
+ // src/server/postPurchaseReviewProvider.ts
6234
+ import { z as z63 } from "zod";
6235
+ var IntegrationInput = z63.record(z63.string(), z63.unknown()).prefault({});
6236
+ var precedence = [
6237
+ "klaviyo",
6238
+ "judgeme",
6239
+ "junip",
6240
+ "loox",
6241
+ "okendo",
6242
+ "opinew",
6243
+ "reviewsio",
6244
+ "stamped",
6245
+ "yotpo"
6246
+ ];
6247
+ var ReviewsIoFlag = z63.preprocess((value) => {
6248
+ if (typeof value === "string") {
6249
+ const flag = value.toLowerCase();
6250
+ if (flag === "true" || flag === "yes") return true;
6251
+ if (flag === "false" || flag === "no") return false;
6252
+ }
6253
+ return value;
6254
+ }, PostPurchaseSettings.shape.integrations.shape.reviewsio);
6255
+ var selectPostPurchaseReviewProvider = (raw) => {
6256
+ const integrations = IntegrationInput.parse(raw);
6257
+ for (const provider of precedence) {
6258
+ const schema = provider === "reviewsio" ? ReviewsIoFlag : PostPurchaseSettings.shape.integrations.shape[provider];
6259
+ if (schema.parse(integrations[provider])) return provider;
6260
+ }
6261
+ return null;
6262
+ };
6263
+
6264
+ // src/server/postPurchaseReviews.ts
6265
+ var projectPostPurchaseReviews = (settings, metafields, report) => {
6266
+ try {
6267
+ const provider = selectPostPurchaseReviewProvider(settings.integrations);
6268
+ if (!provider || metafields == null) return null;
6269
+ const data = readPostPurchaseReviewData(provider, reviewFields(metafields));
6270
+ if (data === null || data.rating === 0) return null;
6271
+ const styles2 = PostPurchaseReviewStyles.parse(settings.styles);
6272
+ return PostPurchaseProductReviews.parse({
6273
+ color: styles2.starColor,
6274
+ ...data,
6275
+ reviewsPlural: settings.language.global.reviewsPlural,
6276
+ reviewsSingular: settings.language.global.reviewsSingular,
6277
+ size: styles2.starSize,
6278
+ strokeColor: styles2.starStrokeColor,
6279
+ strokeWidth: styles2.strokeWidth
6280
+ });
6281
+ } catch {
6282
+ report?.({ detail: "Unreadable post-purchase reviews", kind: "product" });
6283
+ return null;
6284
+ }
6285
+ };
6286
+
6132
6287
  // src/server/projectPostPurchaseProduct.ts
6133
- var projectPostPurchaseProduct = ({ data, effective, metadata, original }, selectedQuantity) => {
6288
+ var projectPostPurchaseProduct = ({ data, effective, metadata, original }, report, selectedQuantity) => {
6134
6289
  const product = data[0];
6135
6290
  const variant2 = product.variants[0];
6136
6291
  return {
6137
- display: projectPostPurchaseProductDisplay(effective, metadata, product),
6292
+ display: {
6293
+ ...projectPostPurchaseProductDisplay(effective, metadata, product),
6294
+ reviews: projectPostPurchaseReviews(effective, product.metafields, report)
6295
+ },
6138
6296
  labels: effective.language.global,
6139
6297
  product: { ...product, variant: variant2 },
6140
6298
  selection: {
@@ -6151,7 +6309,7 @@ var prepareNormalizedSubscription = (normalized, report, plan, quantity2, allowC
6151
6309
  const reason = subscriptionUnavailable(normalized, plan, allowCollection, quantity2);
6152
6310
  if (reason) return { reason, status: "unsupported" };
6153
6311
  const { effective } = normalized;
6154
- const projected = projectPostPurchaseProduct(normalized, quantity2);
6312
+ const projected = projectPostPurchaseProduct(normalized, report, quantity2);
6155
6313
  const { discount, shipping } = PostPurchaseSubscriptionSettings.parse(effective.subscription);
6156
6314
  const shippingPrice = shipping.type === "free" ? 0 : shipping.amount;
6157
6315
  return PreparedPostPurchaseSubscription.parse({
@@ -6209,7 +6367,7 @@ var prepareNormalizedProduct = (normalized, report, quantity2, allowCollection =
6209
6367
  if (reason) return { reason, status: "unsupported" };
6210
6368
  const { effective } = normalized;
6211
6369
  return PreparedPostPurchaseProduct.parse({
6212
- ...projectPostPurchaseProduct(normalized, quantity2),
6370
+ ...projectPostPurchaseProduct(normalized, report, quantity2),
6213
6371
  status: "prepared",
6214
6372
  terms: {
6215
6373
  discount: { ...effective.discount, title: effective.language.global.save },
@@ -6220,45 +6378,45 @@ var prepareNormalizedProduct = (normalized, report, quantity2, allowCollection =
6220
6378
  var preparePostPurchaseProduct = (settings, response, report) => prepareNormalizedProduct(normalizePostPurchaseProduct(settings, response), report);
6221
6379
 
6222
6380
  // src/schema/postPurchaseProductView.ts
6223
- import { z as z60 } from "zod";
6381
+ import { z as z67 } from "zod";
6224
6382
 
6225
6383
  // src/schema/postPurchaseChoice.ts
6226
- import { z as z57 } from "zod";
6227
- var PostPurchaseChoice = z57.discriminatedUnion("mode", [
6228
- z57.object({ mode: z57.literal("one-time") }).strict(),
6229
- z57.object({ mode: z57.literal("subscription"), sellingPlanId: PostPurchasePlanOption.shape.id }).strict()
6384
+ import { z as z64 } from "zod";
6385
+ var PostPurchaseChoice = z64.discriminatedUnion("mode", [
6386
+ z64.object({ mode: z64.literal("one-time") }).strict(),
6387
+ z64.object({ mode: z64.literal("subscription"), sellingPlanId: PostPurchasePlanOption.shape.id }).strict()
6230
6388
  ]);
6231
- var PostPurchaseOptions = z57.object({
6389
+ var PostPurchaseOptions = z64.object({
6232
6390
  defaultChoice: PostPurchaseChoice,
6233
- modes: z57.array(z57.enum(["one-time", "subscription"])).min(1).max(2),
6391
+ modes: z64.array(z64.enum(["one-time", "subscription"])).min(1).max(2),
6234
6392
  selector: PostPurchaseSettings.shape.productTypeSelector
6235
6393
  });
6236
6394
 
6237
6395
  // src/schema/postPurchaseGroupCatalog.ts
6238
- import { z as z59 } from "zod";
6396
+ import { z as z66 } from "zod";
6239
6397
 
6240
6398
  // src/schema/postPurchaseVariantCatalog.ts
6241
- import { z as z58 } from "zod";
6242
- var PostPurchaseVariantSelector = z58.object({ variantId: PostPurchaseVariantId }).strict();
6399
+ import { z as z65 } from "zod";
6400
+ var PostPurchaseVariantSelector = z65.object({ variantId: PostPurchaseVariantId }).strict();
6243
6401
  var PostPurchaseVariantOption = OfferProduct.shape.options.element.extend({
6244
- id: z58.number().int().positive(),
6245
- position: z58.number().int().min(1).max(3)
6402
+ id: z65.number().int().positive(),
6403
+ position: z65.number().int().min(1).max(3)
6246
6404
  });
6247
6405
  var PostPurchaseVariantValues = OfferProduct.shape.variants.element.pick({
6248
6406
  option1: true,
6249
6407
  option2: true,
6250
6408
  option3: true
6251
6409
  });
6252
- var PostPurchaseVariantCatalog = z58.object({
6410
+ var PostPurchaseVariantCatalog = z65.object({
6253
6411
  displayMode: PostPurchaseSettings.shape.productOptions.shape.variantSelectorDisplayMode,
6254
- options: z58.array(PostPurchaseVariantOption),
6412
+ options: z65.array(PostPurchaseVariantOption),
6255
6413
  productId: PostPurchaseProductId,
6256
6414
  showSelectors: PostPurchaseSettings.shape.productOptions.shape.showVariantSelectors,
6257
- variants: z58.array(
6415
+ variants: z65.array(
6258
6416
  PostPurchaseVariantValues.partial().extend({
6259
- available: z58.boolean(),
6417
+ available: z65.boolean(),
6260
6418
  id: PostPurchaseVariantId,
6261
- imageId: z58.number().int().nonnegative().nullish(),
6419
+ imageId: z65.number().int().nonnegative().nullish(),
6262
6420
  title: OfferProduct.shape.variants.element.shape.title
6263
6421
  })
6264
6422
  )
@@ -6272,23 +6430,23 @@ var PostPurchaseGroupDescription = source.pick({ description: true, id: true, im
6272
6430
  image: source.shape.image.default(null),
6273
6431
  options: PostPurchaseVariantCatalog.shape.options.default([])
6274
6432
  });
6275
- var PostPurchaseGroupCatalog = z59.object({
6433
+ var PostPurchaseGroupCatalog = z66.object({
6276
6434
  memberProductId: productId,
6277
- options: z59.array(z59.object({ productId, title: z59.string(), variantCatalog: PostPurchaseVariantCatalog }))
6435
+ options: z66.array(z66.object({ productId, title: z66.string(), variantCatalog: PostPurchaseVariantCatalog }))
6278
6436
  });
6279
- var PostPurchaseGroupSelection = z59.object({
6437
+ var PostPurchaseGroupSelection = z66.object({
6280
6438
  memberProductId: productId,
6281
6439
  productId
6282
6440
  });
6283
6441
 
6284
6442
  // src/schema/postPurchaseProductView.ts
6285
- var PostPurchaseProductView = z60.union([
6286
- z60.object({
6443
+ var PostPurchaseProductView = z67.union([
6444
+ z67.object({
6287
6445
  groupCatalog: PostPurchaseGroupCatalog.optional(),
6288
6446
  initialVariant: PostPurchaseVariantSelector.optional(),
6289
6447
  planCatalog: PostPurchasePlanCatalog.nullable().optional(),
6290
6448
  preparation: PreparedPostPurchaseProduct.extend({
6291
- display: PreparedPostPurchaseProduct.shape.display.extend({ description: z60.string().nullable() }).refine(
6449
+ display: PreparedPostPurchaseProduct.shape.display.extend({ description: z67.string().nullable() }).refine(
6292
6450
  ({ description, descriptionDocument }) => description === null === (descriptionDocument !== void 0),
6293
6451
  "Exactly one of the plain and rich descriptions is shown"
6294
6452
  )
@@ -6297,24 +6455,24 @@ var PostPurchaseProductView = z60.union([
6297
6455
  sections: CABRootSection,
6298
6456
  variantCatalog: PostPurchaseVariantCatalog.optional()
6299
6457
  }),
6300
- z60.object({
6458
+ z67.object({
6301
6459
  groupCatalog: PostPurchaseGroupCatalog.optional(),
6302
6460
  initialVariant: PostPurchaseVariantSelector.optional(),
6303
6461
  planCatalog: PostPurchasePlanCatalog.nullable().optional(),
6304
6462
  preparation: PostPurchasePreparation.options[1],
6305
6463
  purchaseOptions: PostPurchaseOptions.optional(),
6306
- sections: z60.null(),
6464
+ sections: z67.null(),
6307
6465
  variantCatalog: PostPurchaseVariantCatalog.optional()
6308
6466
  })
6309
6467
  ]);
6310
6468
 
6311
6469
  // src/server/postPurchaseOfferCopy.ts
6312
- import { z as z61 } from "zod";
6313
- var Copy = z61.object({
6470
+ import { z as z68 } from "zod";
6471
+ var Copy = z68.object({
6314
6472
  superTitle: CalloutBannerBlock.shape.settings.shape.superTitle.unwrap().optional().catch(void 0),
6315
6473
  title: CalloutBannerBlock.shape.settings.shape.title.unwrap().optional().catch(void 0)
6316
6474
  });
6317
- var Callout = z61.object({ settings: z61.record(z61.string(), z61.unknown()), type: z61.literal("callout_banner") });
6475
+ var Callout = z68.object({ settings: z68.record(z68.string(), z68.unknown()), type: z68.literal("callout_banner") });
6318
6476
  var postPurchaseOfferCopy = (blocks, metadata) => {
6319
6477
  const copy = Copy.safeParse(metadata.widget.language);
6320
6478
  if (!blocks || !copy.success) return blocks;
@@ -6413,28 +6571,28 @@ var preparePostPurchaseAdmissionView = (widgetId, settings, response, report, ch
6413
6571
  };
6414
6572
 
6415
6573
  // src/schema/postPurchaseProductCollectionView.ts
6416
- import { z as z62 } from "zod";
6417
- var PostPurchaseProductCollectionView = z62.object({
6418
- members: z62.array(
6419
- z62.object({
6574
+ import { z as z69 } from "zod";
6575
+ var PostPurchaseProductCollectionView = z69.object({
6576
+ members: z69.array(
6577
+ z69.object({
6420
6578
  productId: PostPurchaseProductId,
6421
- productIndex: z62.number().int().nonnegative(),
6579
+ productIndex: z69.number().int().nonnegative(),
6422
6580
  view: PostPurchaseProductView
6423
6581
  })
6424
6582
  )
6425
6583
  });
6426
- var PostPurchaseCollectionChoice = z62.object({
6584
+ var PostPurchaseCollectionChoice = z69.object({
6427
6585
  choice: PostPurchaseChoice.optional(),
6428
6586
  productId: PostPurchaseProductId,
6429
6587
  variantId: PostPurchaseVariantSelector.shape.variantId.optional()
6430
6588
  }).strict();
6431
- var PostPurchaseExcludedProductIds = z62.array(PostPurchaseProductId).default([]);
6589
+ var PostPurchaseExcludedProductIds = z69.array(PostPurchaseProductId).default([]);
6432
6590
 
6433
6591
  // src/server/normalizePostPurchaseCollection.ts
6434
- import { z as z63 } from "zod";
6592
+ import { z as z70 } from "zod";
6435
6593
  var normalizePostPurchaseCollection = (settings, response, excludedProductIds) => {
6436
6594
  const normalized = normalizePostPurchaseProduct(settings, response);
6437
- const limit = z63.number().int().positive();
6595
+ const limit = z70.number().int().positive();
6438
6596
  limit.parse(normalized.original.productLimit);
6439
6597
  const prefix = normalized.data.slice(0, limit.parse(normalized.effective.productLimit));
6440
6598
  if (new Set(prefix.map(({ id }) => id)).size !== prefix.length)
@@ -6478,13 +6636,13 @@ var projectPostPurchaseVariantCatalog = (product, settings) => {
6478
6636
  };
6479
6637
 
6480
6638
  // src/schema/postPurchaseQuantity.ts
6481
- import { z as z64 } from "zod";
6639
+ import { z as z71 } from "zod";
6482
6640
  var quantity = PreparedPostPurchaseProduct.shape.selection.shape.quantity;
6483
6641
  var PostPurchaseQuantityChoice = PostPurchaseCollectionChoice.extend({ quantity: quantity.optional() });
6484
6642
  var PostPurchaseQuantityPolicy = PostPurchaseSettings.shape.quantityInputs.omit({ defaultQuantity: true }).extend({
6485
6643
  initialQuantity: quantity,
6486
6644
  maxValue: quantity,
6487
- minValue: z64.literal(0).transform(() => 1).or(quantity)
6645
+ minValue: z71.literal(0).transform(() => 1).or(quantity)
6488
6646
  }).refine(({ maxValue, minValue }) => minValue <= maxValue, "Quantity bounds are reversed");
6489
6647
 
6490
6648
  // src/server/readPostPurchaseQuantity.ts
@@ -6515,39 +6673,39 @@ var readPostPurchaseQuantity = ({
6515
6673
  };
6516
6674
 
6517
6675
  // src/schema/postPurchaseVariantDefault.ts
6518
- import { z as z65 } from "zod";
6676
+ import { z as z72 } from "zod";
6519
6677
  var values = PostPurchaseVariantValues.partial().extend({
6520
6678
  option1: PostPurchaseVariantValues.shape.option1.nullish()
6521
6679
  });
6522
6680
  var variant = values.extend({
6523
6681
  id: PostPurchaseVariantId,
6524
- inventoryManagement: z65.string().nullable(),
6525
- inventoryPolicy: z65.string(),
6526
- inventoryQuantity: z65.number()
6682
+ inventoryManagement: z72.string().nullable(),
6683
+ inventoryPolicy: z72.string(),
6684
+ inventoryQuantity: z72.number()
6527
6685
  });
6528
- var options = z65.array(PostPurchaseVariantOption.pick({ name: true, values: true }));
6529
- var PostPurchaseVariantDefaultProduct = z65.object({
6686
+ var options = z72.array(PostPurchaseVariantOption.pick({ name: true, values: true }));
6687
+ var PostPurchaseVariantDefaultProduct = z72.object({
6530
6688
  id: PostPurchaseProductId,
6531
6689
  options,
6532
6690
  selectedVariant: variant.optional(),
6533
- variants: z65.array(variant)
6691
+ variants: z72.array(variant)
6534
6692
  });
6535
6693
  var PostPurchaseVariantDefaultSettings = PostPurchaseSettings.shape.productOptions.pick({
6536
6694
  hideOutOfStockVariants: true,
6537
6695
  matchVariant: true
6538
6696
  });
6539
- var PostPurchaseOrderAttributes = z65.record(z65.string(), z65.array(z65.string())).default({});
6540
- var PostPurchaseOriginalVariants = z65.array(
6541
- z65.object({ productId: PostPurchaseProductId, variantId: PostPurchaseVariantId })
6697
+ var PostPurchaseOrderAttributes = z72.record(z72.string(), z72.array(z72.string())).default({});
6698
+ var PostPurchaseOriginalVariants = z72.array(
6699
+ z72.object({ productId: PostPurchaseProductId, variantId: PostPurchaseVariantId })
6542
6700
  );
6543
- var PostPurchaseAttributeProducts = z65.array(
6544
- z65.object({ id: PostPurchaseProductId, options, variants: z65.array(values.extend({ id: PostPurchaseVariantId })) })
6701
+ var PostPurchaseAttributeProducts = z72.array(
6702
+ z72.object({ id: PostPurchaseProductId, options, variants: z72.array(values.extend({ id: PostPurchaseVariantId })) })
6545
6703
  );
6546
6704
 
6547
6705
  // src/schema/postPurchaseVariantDefaultContext.ts
6548
- import { z as z66 } from "zod";
6549
- var PostPurchaseVariantDefaultContext = z66.object({
6550
- enrichedLineItems: z66.unknown().optional(),
6706
+ import { z as z73 } from "zod";
6707
+ var PostPurchaseVariantDefaultContext = z73.object({
6708
+ enrichedLineItems: z73.unknown().optional(),
6551
6709
  originalVariants: PostPurchaseOriginalVariants
6552
6710
  });
6553
6711
 
@@ -6890,22 +7048,22 @@ var preparePostPurchaseCollectionView = (widgetId, settings, response, report, r
6890
7048
  };
6891
7049
 
6892
7050
  // src/schema/postPurchaseOfferEligibility.ts
6893
- import { z as z67 } from "zod";
7051
+ import { z as z74 } from "zod";
6894
7052
  var selection2 = PreparedPostPurchaseProduct.shape.selection;
6895
- var PostPurchaseOfferSkipReason = z67.enum(["empty", "no-eligible-subscription"]);
6896
- var PostPurchaseOfferEligibilityContext = z67.object({
7053
+ var PostPurchaseOfferSkipReason = z74.enum(["empty", "no-eligible-subscription"]);
7054
+ var PostPurchaseOfferEligibilityContext = z74.object({
6897
7055
  excludedProductIds: PostPurchaseExcludedProductIds,
6898
- originalLineItems: z67.array(selection2.pick({ productId: true, sellingPlanId: true, variantId: true }))
7056
+ originalLineItems: z74.array(selection2.pick({ productId: true, sellingPlanId: true, variantId: true }))
6899
7057
  });
6900
- var PostPurchaseOfferEligibility = z67.discriminatedUnion("status", [
6901
- z67.object({
6902
- members: z67.array(
6903
- z67.object({ productId: selection2.shape.productId, productIndex: z67.number().int().nonnegative() })
7058
+ var PostPurchaseOfferEligibility = z74.discriminatedUnion("status", [
7059
+ z74.object({
7060
+ members: z74.array(
7061
+ z74.object({ productId: selection2.shape.productId, productIndex: z74.number().int().nonnegative() })
6904
7062
  ),
6905
- status: z67.literal("retain")
7063
+ status: z74.literal("retain")
6906
7064
  }),
6907
- z67.object({ reason: PostPurchaseOfferSkipReason, status: z67.literal("skip") }),
6908
- z67.object({ reason: z67.literal("eligible-upgrade").optional(), status: z67.literal("unavailable") })
7065
+ z74.object({ reason: PostPurchaseOfferSkipReason, status: z74.literal("skip") }),
7066
+ z74.object({ reason: z74.literal("eligible-upgrade").optional(), status: z74.literal("unavailable") })
6909
7067
  ]);
6910
7068
 
6911
7069
  // src/server/postPurchaseMemberEligibility.ts
@@ -6999,12 +7157,12 @@ var preparePostPurchaseGroupDeclineDisplay = (settings, response, requested, exc
6999
7157
 
7000
7158
  // src/server/preparePostPurchaseOfferPresentation.ts
7001
7159
  import { merge as merge2 } from "es-toolkit/compat";
7002
- import { z as z69 } from "zod";
7160
+ import { z as z76 } from "zod";
7003
7161
 
7004
7162
  // src/schema/postPurchaseOfferPresentation.ts
7005
- import { z as z68 } from "zod";
7163
+ import { z as z75 } from "zod";
7006
7164
  var language2 = PostPurchaseSettings.shape.language.shape.global.unwrap().unwrap();
7007
- var PostPurchaseOfferPresentation = z68.strictObject({
7165
+ var PostPurchaseOfferPresentation = z75.strictObject({
7008
7166
  labels: language2.pick({ declineAll: true, declineThisOffer: true }),
7009
7167
  layout: PostPurchaseSettings.shape.offersLayout,
7010
7168
  sections: CABRootSection.nullable(),
@@ -7013,7 +7171,7 @@ var PostPurchaseOfferPresentation = z68.strictObject({
7013
7171
 
7014
7172
  // src/server/preparePostPurchaseOfferPresentation.ts
7015
7173
  var FrameSettings = PostPurchaseSettings.pick({ language: true, offersLayout: true, productOptions: true }).extend({
7016
- blocks: z69.array(z69.unknown()).optional()
7174
+ blocks: z76.array(z76.unknown()).optional()
7017
7175
  });
7018
7176
  var preparePostPurchaseOfferPresentation = (widgetId, settings, response, report) => {
7019
7177
  const { metadata } = PostPurchaseProductSource.pick({ metadata: true }).parse(deepCamelCase(response));
@@ -7173,7 +7331,7 @@ var postAnalyticsEvents = async (input, ctx) => {
7173
7331
  };
7174
7332
 
7175
7333
  // src/server/requestSchemas.ts
7176
- import { z as z70 } from "zod";
7334
+ import { z as z77 } from "zod";
7177
7335
  var REQUEST_BOUNDS = {
7178
7336
  /** Cart-level attributes per cart. */
7179
7337
  CART_ATTRIBUTES_MAX: 100,
@@ -7204,42 +7362,42 @@ var REQUEST_BOUNDS = {
7204
7362
  /** Rich ads transaction lines — the engine's ads contract. */
7205
7363
  TRANSACTION_ITEMS_MAX: 50
7206
7364
  };
7207
- var KeyValue = z70.object({
7208
- key: z70.string().max(REQUEST_BOUNDS.STRING_KEY_MAX),
7209
- value: z70.string().max(REQUEST_BOUNDS.STRING_VALUE_MAX).optional()
7365
+ var KeyValue = z77.object({
7366
+ key: z77.string().max(REQUEST_BOUNDS.STRING_KEY_MAX),
7367
+ value: z77.string().max(REQUEST_BOUNDS.STRING_VALUE_MAX).optional()
7210
7368
  });
7211
- var CartLineInputSchema = z70.object({
7212
- productId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7213
- properties: z70.array(KeyValue).max(REQUEST_BOUNDS.LINE_PROPERTIES_MAX).optional(),
7214
- quantity: z70.number(),
7215
- subscriptionId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7216
- variantId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX)
7369
+ var CartLineInputSchema = z77.object({
7370
+ productId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7371
+ properties: z77.array(KeyValue).max(REQUEST_BOUNDS.LINE_PROPERTIES_MAX).optional(),
7372
+ quantity: z77.number(),
7373
+ subscriptionId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7374
+ variantId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX)
7217
7375
  });
7218
- var CartInputSchema = z70.object({
7219
- attributes: z70.array(KeyValue).max(REQUEST_BOUNDS.CART_ATTRIBUTES_MAX).optional(),
7376
+ var CartInputSchema = z77.object({
7377
+ attributes: z77.array(KeyValue).max(REQUEST_BOUNDS.CART_ATTRIBUTES_MAX).optional(),
7220
7378
  /**
7221
7379
  * Presentment-per-shop-currency FX rate (buyer price ÷ shop price, e.g. `1.35` for a USD shop
7222
7380
  * selling in CAD). Money rule thresholds are authored in SHOP currency, so the engine subtotal is
7223
7381
  * divided by this before evaluation. Omit (or send 1) when the cart is already in the shop's currency.
7224
7382
  */
7225
- currencyRate: z70.number().optional(),
7383
+ currencyRate: z77.number().optional(),
7226
7384
  /** Applied discount codes; the engine evaluates `discount_code` rules against them (sent as `[{code}]`). */
7227
- discountCodes: z70.array(z70.string().max(REQUEST_BOUNDS.STRING_KEY_MAX)).max(REQUEST_BOUNDS.DISCOUNT_CODES_MAX).optional(),
7385
+ discountCodes: z77.array(z77.string().max(REQUEST_BOUNDS.STRING_KEY_MAX)).max(REQUEST_BOUNDS.DISCOUNT_CODES_MAX).optional(),
7228
7386
  /** Presentment cents of cart-level discount allocations, subtracted from `subtotal` for the engine. */
7229
- discountTotal: z70.number().optional(),
7230
- items: z70.array(CartLineInputSchema).max(REQUEST_BOUNDS.CART_ITEMS_MAX),
7387
+ discountTotal: z77.number().optional(),
7388
+ items: z77.array(CartLineInputSchema).max(REQUEST_BOUNDS.CART_ITEMS_MAX),
7231
7389
  /** Presentment subtotal in cents. */
7232
- subtotal: z70.number()
7390
+ subtotal: z77.number()
7233
7391
  });
7234
- var UserConfigInputSchema = z70.object({ shop: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX) });
7235
- var DataSourceInputSchema = z70.object({
7392
+ var UserConfigInputSchema = z77.object({ shop: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX) });
7393
+ var DataSourceInputSchema = z77.object({
7236
7394
  cart: CartInputSchema,
7237
7395
  /**
7238
7396
  * Numeric Shopify company-location id when the buyer is a B2B session (`buyerIdentity.purchasingCompany`).
7239
7397
  * Present ⇒ the orchestrator filters results by the location's catalog via admin-api (REB-23713); the
7240
7398
  * client's country-context market check is bypassed for B2B (it false-negatives B2B-catalog products).
7241
7399
  */
7242
- companyLocationId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7400
+ companyLocationId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7243
7401
  /**
7244
7402
  * Buyer's market country (ISO 3166-1 alpha-2) — forwarded to the engine as the `country_code` PARAM
7245
7403
  * when the shop's markets toggle is on (REB-21688; the sink was the `X-Country-Code` header under
@@ -7248,16 +7406,16 @@ var DataSourceInputSchema = z70.object({
7248
7406
  * uppercase (the wire value is forwarded verbatim as the param) so a case-sensitive engine lookup
7249
7407
  * can't silently miss a lowercase code — `adsEngine.ts` uppercases for the same reason.
7250
7408
  */
7251
- country: z70.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(),
7252
- customerId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7253
- dataSourcePath: z70.string().max(REQUEST_BOUNDS.STRING_KEY_MAX),
7409
+ country: z77.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(),
7410
+ customerId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7411
+ dataSourcePath: z77.string().max(REQUEST_BOUNDS.STRING_KEY_MAX),
7254
7412
  /**
7255
7413
  * Engine `filter_inputs` override: `'no'` keeps in-cart (input) products in the results/rule
7256
7414
  * outputs — gift validation sends it so a gift's own product can appear in its answer. Omitted = the
7257
7415
  * engine's default filtering.
7258
7416
  */
7259
- filterInputs: z70.enum(["no", "yes"]).optional(),
7260
- integrations: z70.record(z70.string().max(REQUEST_BOUNDS.STRING_KEY_MAX), z70.boolean()).refine((record) => Object.keys(record).length <= REQUEST_BOUNDS.INTEGRATION_KEYS_MAX, {
7417
+ filterInputs: z77.enum(["no", "yes"]).optional(),
7418
+ integrations: z77.record(z77.string().max(REQUEST_BOUNDS.STRING_KEY_MAX), z77.boolean()).refine((record) => Object.keys(record).length <= REQUEST_BOUNDS.INTEGRATION_KEYS_MAX, {
7261
7419
  message: `Too many integration keys (max ${REQUEST_BOUNDS.INTEGRATION_KEYS_MAX})`
7262
7420
  }).optional(),
7263
7421
  /**
@@ -7270,31 +7428,31 @@ var DataSourceInputSchema = z70.object({
7270
7428
  * request header) fails the regex. Callers should send the buyer's resolved locale (e.g. Shopify
7271
7429
  * checkout's `localization.language.isoCode`), not the request header verbatim.
7272
7430
  */
7273
- language: z70.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(),
7274
- limit: z70.number().max(REQUEST_BOUNDS.LIMIT_MAX),
7275
- productType: z70.enum(["both", "one-time", "subscription"]).optional(),
7276
- shop: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7277
- visitorId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
7278
- });
7279
- var GiftInputSchema = z70.object({
7280
- cost: z70.number(),
7281
- discounted: z70.boolean(),
7431
+ language: z77.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(),
7432
+ limit: z77.number().max(REQUEST_BOUNDS.LIMIT_MAX),
7433
+ productType: z77.enum(["both", "one-time", "subscription"]).optional(),
7434
+ shop: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7435
+ visitorId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
7436
+ });
7437
+ var GiftInputSchema = z77.object({
7438
+ cost: z77.number(),
7439
+ discounted: z77.boolean(),
7282
7440
  /**
7283
7441
  * Which gift attribution the line carries (REB-24363). Defaults to `gwp` because a client that predates
7284
7442
  * the field only ever sent GWP lines — without the default an older extension's request would 422.
7285
7443
  */
7286
- kind: z70.enum(GIFT_KINDS).default("gwp"),
7287
- lineId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7288
- productId: z70.number(),
7444
+ kind: z77.enum(GIFT_KINDS).default("gwp"),
7445
+ lineId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7446
+ productId: z77.number(),
7289
7447
  /**
7290
7448
  * The line's unit count (REB-24363) — the selectable-GWP verdict trims surplus units against milestone
7291
7449
  * capacity. The second deliberate default: a client predating the field sent only GWP lines, whose
7292
7450
  * verdict is whole-line, so a missing quantity reads as one unit rather than 422ing the older request.
7293
7451
  */
7294
- quantity: z70.number().int().min(1).default(1),
7295
- widgetId: z70.number()
7452
+ quantity: z77.number().int().min(1).default(1),
7453
+ widgetId: z77.number()
7296
7454
  });
7297
- var GiftValidationInputSchema = z70.object({
7455
+ var GiftValidationInputSchema = z77.object({
7298
7456
  cart: CartInputSchema,
7299
7457
  /**
7300
7458
  * Buyer's market country — threaded into the per-widget data-source evaluations, which forward it to
@@ -7303,25 +7461,25 @@ var GiftValidationInputSchema = z70.object({
7303
7461
  * turns markets off); regex-bound and uppercase-normalized for the same reasons as
7304
7462
  * `DataSourceInputSchema`'s `country`.
7305
7463
  */
7306
- country: z70.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(),
7307
- customerId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7308
- gifts: z70.array(GiftInputSchema).max(REQUEST_BOUNDS.GIFTS_MAX),
7464
+ country: z77.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(),
7465
+ customerId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7466
+ gifts: z77.array(GiftInputSchema).max(REQUEST_BOUNDS.GIFTS_MAX),
7309
7467
  /**
7310
7468
  * Buyer's checkout language — threaded into the per-widget data-source evaluations, which normalize
7311
7469
  * and forward it as the engine `locale` param under the same markets-toggle gate (REB-21688). MUST be
7312
7470
  * a single BCP-47 tag, for the same reason as `DataSourceInputSchema`'s `language` above.
7313
7471
  */
7314
- language: z70.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(),
7315
- shop: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7316
- visitorId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
7472
+ language: z77.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(),
7473
+ shop: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7474
+ visitorId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
7317
7475
  });
7318
- var GiftAdjustmentSchema = z70.object({
7319
- lineId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7320
- quantity: z70.number().int().nonnegative()
7476
+ var GiftAdjustmentSchema = z77.object({
7477
+ lineId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7478
+ quantity: z77.number().int().nonnegative()
7321
7479
  });
7322
- var GiftValidationResponseSchema = z70.object({
7323
- adjust: z70.array(GiftAdjustmentSchema).max(REQUEST_BOUNDS.GIFTS_MAX).default([]),
7324
- remove: z70.array(z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX)).max(REQUEST_BOUNDS.GIFTS_MAX).refine(
7480
+ var GiftValidationResponseSchema = z77.object({
7481
+ adjust: z77.array(GiftAdjustmentSchema).max(REQUEST_BOUNDS.GIFTS_MAX).default([]),
7482
+ remove: z77.array(z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX)).max(REQUEST_BOUNDS.GIFTS_MAX).refine(
7325
7483
  (remove) => new Set(remove).size === remove.length,
7326
7484
  "a line id may appear at most once in `remove`"
7327
7485
  )
@@ -7332,47 +7490,47 @@ var GiftValidationResponseSchema = z70.object({
7332
7490
  ({ adjust }) => new Set(adjust.map(({ lineId }) => lineId)).size === adjust.length,
7333
7491
  "a line id may appear at most once in `adjust`"
7334
7492
  );
7335
- var MonetizeTransactionItemSchema = z70.object({
7336
- id: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7337
- priceCents: z70.number(),
7338
- quantity: z70.number(),
7339
- title: z70.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX),
7340
- type: z70.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX)
7341
- });
7342
- var MonetizeInputSchema = z70.object({
7493
+ var MonetizeTransactionItemSchema = z77.object({
7494
+ id: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7495
+ priceCents: z77.number(),
7496
+ quantity: z77.number(),
7497
+ title: z77.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX),
7498
+ type: z77.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX)
7499
+ });
7500
+ var MonetizeInputSchema = z77.object({
7343
7501
  cart: CartInputSchema,
7344
7502
  /** Client-minted render-beacon correlation id; forwarded to the ads engine as `client_request_id`. */
7345
- clientRequestId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7346
- country: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7347
- currency: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7503
+ clientRequestId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7504
+ country: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7505
+ currency: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7348
7506
  /** Ads-targeting identity/geo/locale fields (React parity); folded into the engine query verbatim. */
7349
- customerEmail: z70.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
7350
- customerFirstName: z70.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
7351
- customerId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7352
- customerLastName: z70.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
7353
- language: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7507
+ customerEmail: z77.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
7508
+ customerFirstName: z77.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
7509
+ customerId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7510
+ customerLastName: z77.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
7511
+ language: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7354
7512
  /** Buyer-facing order name (e.g. `#1001`) for the server-composed "Order … Confirmed" chrome line. */
7355
- orderName: z70.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
7513
+ orderName: z77.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
7356
7514
  /** Ads surface label, forwarded verbatim; `customer_account` is measured/floored as its own surface (the account-area order list). */
7357
- placement: z70.enum(["customer_account", "order_status", "thank_you_page"]),
7515
+ placement: z77.enum(["customer_account", "order_status", "thank_you_page"]),
7358
7516
  /** Privacy Policy footer href — the Monetize widget's `privacy_policy_url` setting (React parity). */
7359
- privacyPolicyUrl: z70.string().max(REQUEST_BOUNDS.STRING_URL_MAX).optional(),
7517
+ privacyPolicyUrl: z77.string().max(REQUEST_BOUNDS.STRING_URL_MAX).optional(),
7360
7518
  /** 30-min rolling session id (React parity); used for the ads `session_id`, else the visitor id. */
7361
- sessionId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7362
- shop: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7519
+ sessionId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7520
+ shop: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7363
7521
  /** Editor/QA indicator; OR-ed into the ads-engine `testing` flag so it stays out of billing/reporting. */
7364
- testing: z70.boolean().optional(),
7365
- timezone: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7522
+ testing: z77.boolean().optional(),
7523
+ timezone: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7366
7524
  /** Decorated (numeric) order id → the ads `transaction_id`. */
7367
- transactionId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7525
+ transactionId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7368
7526
  /** Rich per-line ads items; capped at the engine's ads contract. Preferred over `cart.items`. */
7369
- transactionItems: z70.array(MonetizeTransactionItemSchema).max(REQUEST_BOUNDS.TRANSACTION_ITEMS_MAX).optional(),
7527
+ transactionItems: z77.array(MonetizeTransactionItemSchema).max(REQUEST_BOUNDS.TRANSACTION_ITEMS_MAX).optional(),
7370
7528
  /** Order total in presentment cents (React prefers total over subtotal); else `cart.subtotal`. */
7371
- transactionTotal: z70.number().optional(),
7372
- visitorId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7373
- zipCode: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
7529
+ transactionTotal: z77.number().optional(),
7530
+ visitorId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7531
+ zipCode: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
7374
7532
  });
7375
- var WidgetSettingsInputSchema = z70.object({
7533
+ var WidgetSettingsInputSchema = z77.object({
7376
7534
  /**
7377
7535
  * Same domain as `CabShopConfig.cacheKey`, for the same reason: this side WINS the orchestrator's
7378
7536
  * `input.cacheKey ?? config.shop.cacheKey` (and an explicit value skips the config read entirely), so
@@ -7380,9 +7538,9 @@ var WidgetSettingsInputSchema = z70.object({
7380
7538
  * and pin the edge copy permanently stale. `.catch(undefined)` because a bogus buster should degrade
7381
7539
  * the read to un-busted, never 400 a widget render.
7382
7540
  */
7383
- cacheKey: z70.number().int().positive().optional().catch(void 0),
7384
- id: z70.number(),
7385
- key: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7541
+ cacheKey: z77.number().int().positive().optional().catch(void 0),
7542
+ id: z77.number(),
7543
+ key: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7386
7544
  /**
7387
7545
  * Monetize context for inline hydration: when present AND the widget converts to a Monetize marker,
7388
7546
  * the server fetches/composes the offer cards inside this same request (no second `/cab/monetize`
@@ -7391,36 +7549,36 @@ var WidgetSettingsInputSchema = z70.object({
7391
7549
  * `privacyPolicyUrl` comes from the widget settings server-side (more authoritative than a relay).
7392
7550
  */
7393
7551
  monetize: MonetizeInputSchema.omit({ privacyPolicyUrl: true, shop: true }).optional(),
7394
- shop: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7552
+ shop: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7395
7553
  /** Stable per-buyer id; when present, enables sticky server-side A/B variant selection. */
7396
- visitorId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
7554
+ visitorId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
7397
7555
  });
7398
- var AnalyticsEventInputSchema = z70.object({
7399
- name: z70.string().max(REQUEST_BOUNDS.STRING_KEY_MAX),
7400
- properties: z70.record(z70.string().max(REQUEST_BOUNDS.STRING_KEY_MAX), z70.unknown()).optional(),
7401
- sentAt: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
7556
+ var AnalyticsEventInputSchema = z77.object({
7557
+ name: z77.string().max(REQUEST_BOUNDS.STRING_KEY_MAX),
7558
+ properties: z77.record(z77.string().max(REQUEST_BOUNDS.STRING_KEY_MAX), z77.unknown()).optional(),
7559
+ sentAt: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
7402
7560
  });
7403
- var AnalyticsSegmentsInputSchema = z70.object({
7404
- device: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional().catch(void 0),
7405
- source: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional().catch(void 0),
7406
- visitor: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional().catch(void 0)
7561
+ var AnalyticsSegmentsInputSchema = z77.object({
7562
+ device: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional().catch(void 0),
7563
+ source: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional().catch(void 0),
7564
+ visitor: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional().catch(void 0)
7407
7565
  });
7408
- var AnalyticsInputSchema = z70.object({
7566
+ var AnalyticsInputSchema = z77.object({
7409
7567
  /** Rebuy cart token (the `r_cart_token` cart attribute), when available — primary aggregation key. */
7410
- cartToken: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7568
+ cartToken: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7411
7569
  /** Shopify checkout token, when available — drives cart/checkout aggregation downstream. */
7412
- checkoutToken: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7413
- events: z70.array(AnalyticsEventInputSchema).max(REQUEST_BOUNDS.EVENTS_MAX),
7570
+ checkoutToken: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
7571
+ events: z77.array(AnalyticsEventInputSchema).max(REQUEST_BOUNDS.EVENTS_MAX),
7414
7572
  /**
7415
7573
  * Request-scoped like the tokens: one visitor's segments apply to every event in the batch. The container
7416
7574
  * degrades too (`null` is a realistic wire artifact of `attributes ? {…} : null`), so the degrade rule is
7417
7575
  * total: nothing about `segments` can cost the envelope.
7418
7576
  */
7419
7577
  segments: AnalyticsSegmentsInputSchema.optional().catch(void 0),
7420
- shop: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7421
- visitorId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7578
+ shop: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7579
+ visitorId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
7422
7580
  /** The widget id (smartBlockId) the events belong to. */
7423
- widgetId: z70.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
7581
+ widgetId: z77.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
7424
7582
  });
7425
7583
  export {
7426
7584
  AnalyticsEventInputSchema,