@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.
- package/dist/index.cjs +689 -656
- package/dist/index.mjs +689 -656
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/postPurchaseProduct.d.ts +28 -0
- package/dist/schema/postPurchaseProductCollectionView.d.ts +14 -0
- package/dist/schema/postPurchaseProductDisplay.d.ts +16 -4
- package/dist/schema/postPurchaseProductReviews.d.ts +36 -0
- package/dist/schema/postPurchaseProductView.d.ts +14 -0
- package/dist/schema/postPurchaseSubscriptionProduct.d.ts +24 -0
- package/dist/server/__fixtures__/postPurchaseReviewProviders.d.ts +30 -0
- package/dist/server/__fixtures__/postPurchaseReviews.d.ts +67 -0
- package/dist/server/index.cjs +382 -224
- package/dist/server/index.mjs +382 -224
- package/dist/server/postPurchaseJudgeMeReviews.d.ts +6 -0
- package/dist/server/postPurchaseOkendoReviews.d.ts +6 -0
- package/dist/server/postPurchaseProductDisplay.d.ts +12 -2
- package/dist/server/postPurchaseReviewData.d.ts +7 -0
- package/dist/server/postPurchaseReviewFields.d.ts +7 -0
- package/dist/server/postPurchaseReviewProvider.d.ts +2 -0
- package/dist/server/postPurchaseReviews.d.ts +5 -0
- package/dist/server/postPurchaseScalarReviews.d.ts +6 -0
- package/dist/server/prepareNormalizedSubscription.d.ts +2 -2
- package/dist/server/preparePostPurchaseAdmissionView.d.ts +10 -0
- package/dist/server/preparePostPurchaseCollectionGroup.d.ts +10 -0
- package/dist/server/preparePostPurchaseCollectionView.d.ts +10 -0
- package/dist/server/preparePostPurchaseGroupAdmissionView.d.ts +10 -0
- package/dist/server/preparePostPurchaseGroupDefault.d.ts +10 -0
- package/dist/server/preparePostPurchaseGroupView.d.ts +10 -0
- package/dist/server/preparePostPurchaseMemberView.d.ts +30 -0
- package/dist/server/preparePostPurchaseProduct.d.ts +1 -4
- package/dist/server/preparePostPurchaseQuantityAdmissionView.d.ts +10 -0
- package/dist/server/preparePostPurchaseQuantityView.d.ts +10 -0
- package/dist/server/preparePostPurchaseSubscription.d.ts +10 -0
- package/dist/server/projectPostPurchaseProduct.d.ts +12 -1
- package/package.json +1 -1
package/dist/server/index.cjs
CHANGED
|
@@ -5959,13 +5959,13 @@ var projectPostPurchasePlanCatalog = (normalized, report) => {
|
|
|
5959
5959
|
};
|
|
5960
5960
|
|
|
5961
5961
|
// src/schema/postPurchaseSubscriptionProduct.ts
|
|
5962
|
-
var
|
|
5962
|
+
var import_zod55 = require("zod");
|
|
5963
5963
|
|
|
5964
5964
|
// src/schema/postPurchaseProduct.ts
|
|
5965
|
-
var
|
|
5965
|
+
var import_zod54 = require("zod");
|
|
5966
5966
|
|
|
5967
5967
|
// src/schema/postPurchaseProductDisplay.ts
|
|
5968
|
-
var
|
|
5968
|
+
var import_zod52 = require("zod");
|
|
5969
5969
|
|
|
5970
5970
|
// src/schema/postPurchaseProductGallery.ts
|
|
5971
5971
|
var import_zod50 = require("zod");
|
|
@@ -5981,17 +5981,44 @@ var PostPurchaseProductGallery = import_zod50.z.object({
|
|
|
5981
5981
|
selectedImageId: import_zod50.z.number().int().positive().optional()
|
|
5982
5982
|
});
|
|
5983
5983
|
|
|
5984
|
+
// src/schema/postPurchaseProductReviews.ts
|
|
5985
|
+
var import_zod51 = require("zod");
|
|
5986
|
+
var decimal = import_zod51.z.union([
|
|
5987
|
+
import_zod51.z.number(),
|
|
5988
|
+
import_zod51.z.string().regex(/^\d+(?:\.\d+)?$/).transform(Number)
|
|
5989
|
+
]);
|
|
5990
|
+
var PostPurchaseCommonReviewRating = import_zod51.z.object({ value: decimal.pipe(import_zod51.z.number().min(0).max(5)) });
|
|
5991
|
+
var PostPurchaseKlaviyoReviewRating = PostPurchaseCommonReviewRating.extend({
|
|
5992
|
+
// Legacy validates key presence, then displays the raw value on five stars without rescaling.
|
|
5993
|
+
scale_max: import_zod51.z.unknown().nonoptional(),
|
|
5994
|
+
scale_min: import_zod51.z.unknown().nonoptional()
|
|
5995
|
+
});
|
|
5996
|
+
var PostPurchaseReviewCount = import_zod51.z.string().regex(/^\d+(?:\.\d+)?$/).transform(Number).pipe(import_zod51.z.number().int().nonnegative());
|
|
5997
|
+
var PostPurchaseReviewStyles = PostPurchaseSettings.shape.styles.unwrap().extend({
|
|
5998
|
+
strokeWidth: decimal.pipe(import_zod51.z.number().nonnegative()).default(1)
|
|
5999
|
+
}).prefault({});
|
|
6000
|
+
var PostPurchaseProductReviews = import_zod51.z.object({
|
|
6001
|
+
color: import_zod51.z.string(),
|
|
6002
|
+
rating: import_zod51.z.number().positive().max(5),
|
|
6003
|
+
reviewCount: import_zod51.z.number().int().nonnegative(),
|
|
6004
|
+
reviewsPlural: import_zod51.z.string(),
|
|
6005
|
+
reviewsSingular: import_zod51.z.string(),
|
|
6006
|
+
size: import_zod51.z.enum(["small", "medium", "large"]),
|
|
6007
|
+
strokeColor: import_zod51.z.string(),
|
|
6008
|
+
strokeWidth: import_zod51.z.number().nonnegative()
|
|
6009
|
+
});
|
|
6010
|
+
|
|
5984
6011
|
// src/schema/postPurchaseProductDisplay.ts
|
|
5985
6012
|
var language = PostPurchaseSettings.shape.language;
|
|
5986
|
-
var PostPurchasePrimaryImageSource =
|
|
6013
|
+
var PostPurchasePrimaryImageSource = import_zod52.z.string().default(
|
|
5987
6014
|
"https://cdn.shopify.com/shopifycloud/shopify/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c.gif"
|
|
5988
6015
|
);
|
|
5989
|
-
var PostPurchaseProductDisplay =
|
|
6016
|
+
var PostPurchaseProductDisplay = import_zod52.z.object({
|
|
5990
6017
|
descriptionDocument: TiptapDocument.optional(),
|
|
5991
6018
|
discountedFrom: PostPurchaseSettings.shape.discountedFrom,
|
|
5992
6019
|
gallery: PostPurchaseProductGallery.optional(),
|
|
5993
6020
|
language: language.pick({ description: true, descriptionEnabled: true }),
|
|
5994
|
-
primaryImage:
|
|
6021
|
+
primaryImage: import_zod52.z.object({ description: import_zod52.z.string(), source: import_zod52.z.string() }),
|
|
5995
6022
|
productOptions: PostPurchaseSettings.shape.productOptions.pick({
|
|
5996
6023
|
showDeclineAll: true,
|
|
5997
6024
|
showShipping: true,
|
|
@@ -6001,18 +6028,19 @@ var PostPurchaseProductDisplay = import_zod51.z.object({
|
|
|
6001
6028
|
showVariantSelectors: true
|
|
6002
6029
|
}),
|
|
6003
6030
|
responseDescription: language.shape.description,
|
|
6031
|
+
reviews: PostPurchaseProductReviews.nullable().default(null),
|
|
6004
6032
|
shouldShowSavingText: PostPurchaseSettings.shape.discount.shape.shouldShowSavingText
|
|
6005
6033
|
});
|
|
6006
6034
|
|
|
6007
6035
|
// src/schema/postPurchaseSubscription.ts
|
|
6008
|
-
var
|
|
6009
|
-
var PostPurchaseSubscriptionTerms =
|
|
6036
|
+
var import_zod53 = require("zod");
|
|
6037
|
+
var PostPurchaseSubscriptionTerms = import_zod53.z.object({
|
|
6010
6038
|
adjustment: PostPurchasePlanAdjustment.optional(),
|
|
6011
|
-
initialShippingPrice:
|
|
6012
|
-
intervalLabel:
|
|
6013
|
-
name:
|
|
6014
|
-
recurringShippingPrice:
|
|
6015
|
-
shippingOption:
|
|
6039
|
+
initialShippingPrice: import_zod53.z.number().nonnegative(),
|
|
6040
|
+
intervalLabel: import_zod53.z.string().min(1),
|
|
6041
|
+
name: import_zod53.z.string().min(1),
|
|
6042
|
+
recurringShippingPrice: import_zod53.z.number().nonnegative(),
|
|
6043
|
+
shippingOption: import_zod53.z.object({ presentmentTitle: import_zod53.z.string(), title: import_zod53.z.string() })
|
|
6016
6044
|
});
|
|
6017
6045
|
|
|
6018
6046
|
// src/schema/postPurchaseProduct.ts
|
|
@@ -6022,51 +6050,51 @@ var PostPurchaseVariant = OfferProduct.shape.variants.element.pick({ id: true, t
|
|
|
6022
6050
|
id: PostPurchaseVariantId,
|
|
6023
6051
|
price: PostPurchaseAmount
|
|
6024
6052
|
});
|
|
6025
|
-
var PreparedPostPurchaseProduct =
|
|
6053
|
+
var PreparedPostPurchaseProduct = import_zod54.z.object({
|
|
6026
6054
|
display: PostPurchaseProductDisplay,
|
|
6027
|
-
labels:
|
|
6055
|
+
labels: import_zod54.z.object({
|
|
6028
6056
|
declineAll: global.declineAll,
|
|
6029
|
-
free:
|
|
6030
|
-
payNow:
|
|
6031
|
-
quantity:
|
|
6057
|
+
free: import_zod54.z.string(),
|
|
6058
|
+
payNow: import_zod54.z.string(),
|
|
6059
|
+
quantity: import_zod54.z.string(),
|
|
6032
6060
|
recurringShipping: global.recurringShipping,
|
|
6033
6061
|
recurringSubtotal: global.recurringSubtotal,
|
|
6034
|
-
save:
|
|
6035
|
-
shipping:
|
|
6036
|
-
subtotal:
|
|
6037
|
-
taxes:
|
|
6038
|
-
total:
|
|
6062
|
+
save: import_zod54.z.string(),
|
|
6063
|
+
shipping: import_zod54.z.string(),
|
|
6064
|
+
subtotal: import_zod54.z.string(),
|
|
6065
|
+
taxes: import_zod54.z.string(),
|
|
6066
|
+
total: import_zod54.z.string()
|
|
6039
6067
|
}),
|
|
6040
6068
|
product: OfferProduct.pick({ description: true, id: true, image: true, title: true }).extend({
|
|
6041
6069
|
description: OfferProduct.shape.description.nullable(),
|
|
6042
6070
|
id: PostPurchaseProductId,
|
|
6043
6071
|
variant: PostPurchaseVariant
|
|
6044
6072
|
}),
|
|
6045
|
-
selection:
|
|
6073
|
+
selection: import_zod54.z.object({
|
|
6046
6074
|
productId: PostPurchaseProductId,
|
|
6047
|
-
quantity:
|
|
6048
|
-
sellingPlanId:
|
|
6075
|
+
quantity: import_zod54.z.number().int().positive(),
|
|
6076
|
+
sellingPlanId: import_zod54.z.number().int().positive().optional(),
|
|
6049
6077
|
variantId: PostPurchaseVariantId
|
|
6050
6078
|
}),
|
|
6051
|
-
status:
|
|
6052
|
-
terms:
|
|
6079
|
+
status: import_zod54.z.literal("prepared"),
|
|
6080
|
+
terms: import_zod54.z.object({
|
|
6053
6081
|
discount: PostPurchaseDiscount,
|
|
6054
|
-
shipping:
|
|
6055
|
-
amount:
|
|
6056
|
-
title:
|
|
6057
|
-
type:
|
|
6082
|
+
shipping: import_zod54.z.object({
|
|
6083
|
+
amount: import_zod54.z.number().nonnegative(),
|
|
6084
|
+
title: import_zod54.z.string(),
|
|
6085
|
+
type: import_zod54.z.enum(["free", "fixed_amount"])
|
|
6058
6086
|
}),
|
|
6059
6087
|
subscription: PostPurchaseSubscriptionTerms.optional()
|
|
6060
6088
|
})
|
|
6061
6089
|
});
|
|
6062
|
-
var PostPurchasePreparation =
|
|
6090
|
+
var PostPurchasePreparation = import_zod54.z.discriminatedUnion("status", [
|
|
6063
6091
|
PreparedPostPurchaseProduct,
|
|
6064
|
-
|
|
6092
|
+
import_zod54.z.object({ reason: import_zod54.z.string(), status: import_zod54.z.literal("unsupported") })
|
|
6065
6093
|
]);
|
|
6066
6094
|
|
|
6067
6095
|
// src/schema/postPurchaseSubscriptionProduct.ts
|
|
6068
6096
|
var PreparedPostPurchaseSubscription = PreparedPostPurchaseProduct.extend({
|
|
6069
|
-
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId:
|
|
6097
|
+
selection: PreparedPostPurchaseProduct.shape.selection.extend({ sellingPlanId: import_zod55.z.number().int().positive() }),
|
|
6070
6098
|
terms: PreparedPostPurchaseProduct.shape.terms.extend({
|
|
6071
6099
|
subscription: PostPurchaseSubscriptionTerms
|
|
6072
6100
|
}).refine(
|
|
@@ -6108,7 +6136,7 @@ var subscriptionUnavailable = (normalized, plan, allowCollection, quantity2) =>
|
|
|
6108
6136
|
};
|
|
6109
6137
|
|
|
6110
6138
|
// src/server/postPurchaseProductDisplay.ts
|
|
6111
|
-
var
|
|
6139
|
+
var import_zod57 = require("zod");
|
|
6112
6140
|
|
|
6113
6141
|
// src/server/postPurchasePrimaryImage.ts
|
|
6114
6142
|
var postPurchasePrimaryImage = (product) => {
|
|
@@ -6130,7 +6158,7 @@ var postPurchaseProductGallery = (product, limit) => ({
|
|
|
6130
6158
|
});
|
|
6131
6159
|
|
|
6132
6160
|
// src/transforms/postPurchase/convertDescriptionRte.ts
|
|
6133
|
-
var
|
|
6161
|
+
var import_zod56 = require("zod");
|
|
6134
6162
|
var alignments = { center: "center", left: "start", right: "end" };
|
|
6135
6163
|
var colors = ["critical", "subdued", "success", "warning"];
|
|
6136
6164
|
var sizes2 = ["extraSmall", "small", "medium", "large", "extraLarge"];
|
|
@@ -6142,19 +6170,19 @@ var spacings2 = {
|
|
|
6142
6170
|
xloose: "extraLoose",
|
|
6143
6171
|
xtight: "extraTight"
|
|
6144
6172
|
};
|
|
6145
|
-
var Block =
|
|
6146
|
-
attrs:
|
|
6147
|
-
content:
|
|
6148
|
-
type:
|
|
6149
|
-
});
|
|
6150
|
-
var Run =
|
|
6151
|
-
var Inline =
|
|
6152
|
-
attrs:
|
|
6153
|
-
color:
|
|
6154
|
-
emphasis:
|
|
6155
|
-
size:
|
|
6173
|
+
var Block = import_zod56.z.object({
|
|
6174
|
+
attrs: import_zod56.z.object({ alignment: import_zod56.z.enum(["left", "center", "right"]).optional().catch(void 0) }).catch({}),
|
|
6175
|
+
content: import_zod56.z.array(import_zod56.z.unknown()).catch([]),
|
|
6176
|
+
type: import_zod56.z.literal("ShopifyTextBlock")
|
|
6177
|
+
});
|
|
6178
|
+
var Run = import_zod56.z.object({ marks: import_zod56.z.array(import_zod56.z.unknown()).catch([]), text: import_zod56.z.string().min(1), type: import_zod56.z.literal("text") });
|
|
6179
|
+
var Inline = import_zod56.z.object({
|
|
6180
|
+
attrs: import_zod56.z.object({
|
|
6181
|
+
color: import_zod56.z.enum(colors).optional().catch(void 0),
|
|
6182
|
+
emphasis: import_zod56.z.array(import_zod56.z.unknown()).catch([]),
|
|
6183
|
+
size: import_zod56.z.enum(sizes2).optional().catch(void 0)
|
|
6156
6184
|
}),
|
|
6157
|
-
type:
|
|
6185
|
+
type: import_zod56.z.literal("ShopifyTextInline")
|
|
6158
6186
|
});
|
|
6159
6187
|
var marks = (raw) => {
|
|
6160
6188
|
const found = raw.map((mark) => Inline.safeParse(mark)).find(({ success }) => success)?.data;
|
|
@@ -6187,7 +6215,7 @@ var convertDescriptionRte = (rte, spacing) => TiptapDocument.parse({
|
|
|
6187
6215
|
});
|
|
6188
6216
|
|
|
6189
6217
|
// src/server/postPurchaseProductDisplay.ts
|
|
6190
|
-
var ResponseLanguage =
|
|
6218
|
+
var ResponseLanguage = import_zod57.z.object({ description: PostPurchaseProductDisplay.shape.responseDescription }).default({ description: "" });
|
|
6191
6219
|
var projectPostPurchaseProductDisplay = (effective, metadata, product) => PostPurchaseProductDisplay.parse({
|
|
6192
6220
|
descriptionDocument: effective.language.descriptionRte && convertDescriptionRte(effective.language.descriptionRte, effective.language.descriptionSpacing),
|
|
6193
6221
|
discountedFrom: effective.discountedFrom,
|
|
@@ -6199,12 +6227,142 @@ var projectPostPurchaseProductDisplay = (effective, metadata, product) => PostPu
|
|
|
6199
6227
|
shouldShowSavingText: effective.discount.shouldShowSavingText
|
|
6200
6228
|
});
|
|
6201
6229
|
|
|
6230
|
+
// src/server/postPurchaseReviewData.ts
|
|
6231
|
+
var import_zod61 = require("zod");
|
|
6232
|
+
|
|
6233
|
+
// src/server/postPurchaseJudgeMeReviews.ts
|
|
6234
|
+
var import_zod58 = require("zod");
|
|
6235
|
+
var readJudgeMeReviews = (find) => {
|
|
6236
|
+
const field = find("judgeme", "badge");
|
|
6237
|
+
if (!field) return null;
|
|
6238
|
+
const html = import_zod58.z.string().parse(field.value);
|
|
6239
|
+
const rating = html.match(/data-average-rating=['"](\d+(?:\.\d+)?)['"]/);
|
|
6240
|
+
const count = html.match(/data-number-of-reviews=['"](\d+)['"]/);
|
|
6241
|
+
if (!rating || !count) throw new Error("Unreadable Judge.me attributes");
|
|
6242
|
+
return {
|
|
6243
|
+
rating: PostPurchaseCommonReviewRating.parse({ value: rating[1] }).value,
|
|
6244
|
+
reviewCount: PostPurchaseReviewCount.parse(count[1])
|
|
6245
|
+
};
|
|
6246
|
+
};
|
|
6247
|
+
|
|
6248
|
+
// src/server/postPurchaseOkendoReviews.ts
|
|
6249
|
+
var import_zod59 = require("zod");
|
|
6250
|
+
var Summary = import_zod59.z.object({
|
|
6251
|
+
reviewAverageValue: PostPurchaseCommonReviewRating.shape.value,
|
|
6252
|
+
reviewCount: import_zod59.z.union([PostPurchaseProductReviews.shape.reviewCount, PostPurchaseReviewCount])
|
|
6253
|
+
});
|
|
6254
|
+
var readOkendoReviews = (find) => {
|
|
6255
|
+
const field = find("okendo", "summaryData");
|
|
6256
|
+
if (!field) return null;
|
|
6257
|
+
const summary = Summary.parse(JSON.parse(import_zod59.z.string().parse(field.value)));
|
|
6258
|
+
return { rating: summary.reviewAverageValue, reviewCount: summary.reviewCount };
|
|
6259
|
+
};
|
|
6260
|
+
|
|
6261
|
+
// src/server/postPurchaseScalarReviews.ts
|
|
6262
|
+
var import_zod60 = require("zod");
|
|
6263
|
+
var readScalarReviews = (find, namespace, ratingKey, countKey) => {
|
|
6264
|
+
const rating = find(namespace, ratingKey);
|
|
6265
|
+
const count = find(namespace, countKey);
|
|
6266
|
+
if (!rating || !count) return null;
|
|
6267
|
+
return {
|
|
6268
|
+
rating: PostPurchaseCommonReviewRating.parse({ value: import_zod60.z.string().parse(rating.value) }).value,
|
|
6269
|
+
reviewCount: PostPurchaseReviewCount.parse(count.value)
|
|
6270
|
+
};
|
|
6271
|
+
};
|
|
6272
|
+
|
|
6273
|
+
// src/server/postPurchaseReviewData.ts
|
|
6274
|
+
var readPostPurchaseReviewData = (provider, find) => {
|
|
6275
|
+
if (provider === "yotpo") return readScalarReviews(find, "yotpo", "reviews_average", "reviews_count");
|
|
6276
|
+
if (provider === "stamped") return readScalarReviews(find, "stamped", "reviews_average", "reviews_count");
|
|
6277
|
+
if (provider === "judgeme") return readJudgeMeReviews(find);
|
|
6278
|
+
if (provider === "okendo") return readOkendoReviews(find);
|
|
6279
|
+
if (provider === "opinew") return readScalarReviews(find, "opinew_metafields", "reviews_average", "reviews_count");
|
|
6280
|
+
if (provider === "reviewsio") return readScalarReviews(find, "reviewscouk", "rating", "total");
|
|
6281
|
+
if (provider === "loox") return readScalarReviews(find, "loox", "avg_rating", "num_reviews");
|
|
6282
|
+
if (provider === "junip") return readScalarReviews(find, "junip", "rating_average", "rating_count");
|
|
6283
|
+
const rating = find("reviews", "rating");
|
|
6284
|
+
const count = find("reviews", "rating_count");
|
|
6285
|
+
if (!rating || !count) return null;
|
|
6286
|
+
return {
|
|
6287
|
+
rating: PostPurchaseKlaviyoReviewRating.parse(JSON.parse(import_zod61.z.string().parse(rating.value))).value,
|
|
6288
|
+
reviewCount: PostPurchaseReviewCount.parse(count.value)
|
|
6289
|
+
};
|
|
6290
|
+
};
|
|
6291
|
+
|
|
6292
|
+
// src/server/postPurchaseReviewFields.ts
|
|
6293
|
+
var import_zod62 = require("zod");
|
|
6294
|
+
var Field = import_zod62.z.object({ key: import_zod62.z.string(), namespace: import_zod62.z.string(), value: import_zod62.z.unknown().optional() });
|
|
6295
|
+
var reviewFields = (raw) => {
|
|
6296
|
+
const fields4 = import_zod62.z.array(import_zod62.z.unknown()).parse(raw).flatMap((field) => {
|
|
6297
|
+
const parsed = Field.safeParse(field);
|
|
6298
|
+
return parsed.success ? [parsed.data] : [];
|
|
6299
|
+
});
|
|
6300
|
+
return (namespace, key) => fields4.find((field) => field.namespace === namespace && field.key === key);
|
|
6301
|
+
};
|
|
6302
|
+
|
|
6303
|
+
// src/server/postPurchaseReviewProvider.ts
|
|
6304
|
+
var import_zod63 = require("zod");
|
|
6305
|
+
var IntegrationInput = import_zod63.z.record(import_zod63.z.string(), import_zod63.z.unknown()).prefault({});
|
|
6306
|
+
var precedence = [
|
|
6307
|
+
"klaviyo",
|
|
6308
|
+
"judgeme",
|
|
6309
|
+
"junip",
|
|
6310
|
+
"loox",
|
|
6311
|
+
"okendo",
|
|
6312
|
+
"opinew",
|
|
6313
|
+
"reviewsio",
|
|
6314
|
+
"stamped",
|
|
6315
|
+
"yotpo"
|
|
6316
|
+
];
|
|
6317
|
+
var ReviewsIoFlag = import_zod63.z.preprocess((value) => {
|
|
6318
|
+
if (typeof value === "string") {
|
|
6319
|
+
const flag = value.toLowerCase();
|
|
6320
|
+
if (flag === "true" || flag === "yes") return true;
|
|
6321
|
+
if (flag === "false" || flag === "no") return false;
|
|
6322
|
+
}
|
|
6323
|
+
return value;
|
|
6324
|
+
}, PostPurchaseSettings.shape.integrations.shape.reviewsio);
|
|
6325
|
+
var selectPostPurchaseReviewProvider = (raw) => {
|
|
6326
|
+
const integrations = IntegrationInput.parse(raw);
|
|
6327
|
+
for (const provider of precedence) {
|
|
6328
|
+
const schema = provider === "reviewsio" ? ReviewsIoFlag : PostPurchaseSettings.shape.integrations.shape[provider];
|
|
6329
|
+
if (schema.parse(integrations[provider])) return provider;
|
|
6330
|
+
}
|
|
6331
|
+
return null;
|
|
6332
|
+
};
|
|
6333
|
+
|
|
6334
|
+
// src/server/postPurchaseReviews.ts
|
|
6335
|
+
var projectPostPurchaseReviews = (settings, metafields, report) => {
|
|
6336
|
+
try {
|
|
6337
|
+
const provider = selectPostPurchaseReviewProvider(settings.integrations);
|
|
6338
|
+
if (!provider || metafields == null) return null;
|
|
6339
|
+
const data = readPostPurchaseReviewData(provider, reviewFields(metafields));
|
|
6340
|
+
if (data === null || data.rating === 0) return null;
|
|
6341
|
+
const styles2 = PostPurchaseReviewStyles.parse(settings.styles);
|
|
6342
|
+
return PostPurchaseProductReviews.parse({
|
|
6343
|
+
color: styles2.starColor,
|
|
6344
|
+
...data,
|
|
6345
|
+
reviewsPlural: settings.language.global.reviewsPlural,
|
|
6346
|
+
reviewsSingular: settings.language.global.reviewsSingular,
|
|
6347
|
+
size: styles2.starSize,
|
|
6348
|
+
strokeColor: styles2.starStrokeColor,
|
|
6349
|
+
strokeWidth: styles2.strokeWidth
|
|
6350
|
+
});
|
|
6351
|
+
} catch {
|
|
6352
|
+
report?.({ detail: "Unreadable post-purchase reviews", kind: "product" });
|
|
6353
|
+
return null;
|
|
6354
|
+
}
|
|
6355
|
+
};
|
|
6356
|
+
|
|
6202
6357
|
// src/server/projectPostPurchaseProduct.ts
|
|
6203
|
-
var projectPostPurchaseProduct = ({ data, effective, metadata, original }, selectedQuantity) => {
|
|
6358
|
+
var projectPostPurchaseProduct = ({ data, effective, metadata, original }, report, selectedQuantity) => {
|
|
6204
6359
|
const product = data[0];
|
|
6205
6360
|
const variant2 = product.variants[0];
|
|
6206
6361
|
return {
|
|
6207
|
-
display:
|
|
6362
|
+
display: {
|
|
6363
|
+
...projectPostPurchaseProductDisplay(effective, metadata, product),
|
|
6364
|
+
reviews: projectPostPurchaseReviews(effective, product.metafields, report)
|
|
6365
|
+
},
|
|
6208
6366
|
labels: effective.language.global,
|
|
6209
6367
|
product: { ...product, variant: variant2 },
|
|
6210
6368
|
selection: {
|
|
@@ -6221,7 +6379,7 @@ var prepareNormalizedSubscription = (normalized, report, plan, quantity2, allowC
|
|
|
6221
6379
|
const reason = subscriptionUnavailable(normalized, plan, allowCollection, quantity2);
|
|
6222
6380
|
if (reason) return { reason, status: "unsupported" };
|
|
6223
6381
|
const { effective } = normalized;
|
|
6224
|
-
const projected = projectPostPurchaseProduct(normalized, quantity2);
|
|
6382
|
+
const projected = projectPostPurchaseProduct(normalized, report, quantity2);
|
|
6225
6383
|
const { discount, shipping } = PostPurchaseSubscriptionSettings.parse(effective.subscription);
|
|
6226
6384
|
const shippingPrice = shipping.type === "free" ? 0 : shipping.amount;
|
|
6227
6385
|
return PreparedPostPurchaseSubscription.parse({
|
|
@@ -6279,7 +6437,7 @@ var prepareNormalizedProduct = (normalized, report, quantity2, allowCollection =
|
|
|
6279
6437
|
if (reason) return { reason, status: "unsupported" };
|
|
6280
6438
|
const { effective } = normalized;
|
|
6281
6439
|
return PreparedPostPurchaseProduct.parse({
|
|
6282
|
-
...projectPostPurchaseProduct(normalized, quantity2),
|
|
6440
|
+
...projectPostPurchaseProduct(normalized, report, quantity2),
|
|
6283
6441
|
status: "prepared",
|
|
6284
6442
|
terms: {
|
|
6285
6443
|
discount: { ...effective.discount, title: effective.language.global.save },
|
|
@@ -6290,45 +6448,45 @@ var prepareNormalizedProduct = (normalized, report, quantity2, allowCollection =
|
|
|
6290
6448
|
var preparePostPurchaseProduct = (settings, response, report) => prepareNormalizedProduct(normalizePostPurchaseProduct(settings, response), report);
|
|
6291
6449
|
|
|
6292
6450
|
// src/schema/postPurchaseProductView.ts
|
|
6293
|
-
var
|
|
6451
|
+
var import_zod67 = require("zod");
|
|
6294
6452
|
|
|
6295
6453
|
// src/schema/postPurchaseChoice.ts
|
|
6296
|
-
var
|
|
6297
|
-
var PostPurchaseChoice =
|
|
6298
|
-
|
|
6299
|
-
|
|
6454
|
+
var import_zod64 = require("zod");
|
|
6455
|
+
var PostPurchaseChoice = import_zod64.z.discriminatedUnion("mode", [
|
|
6456
|
+
import_zod64.z.object({ mode: import_zod64.z.literal("one-time") }).strict(),
|
|
6457
|
+
import_zod64.z.object({ mode: import_zod64.z.literal("subscription"), sellingPlanId: PostPurchasePlanOption.shape.id }).strict()
|
|
6300
6458
|
]);
|
|
6301
|
-
var PostPurchaseOptions =
|
|
6459
|
+
var PostPurchaseOptions = import_zod64.z.object({
|
|
6302
6460
|
defaultChoice: PostPurchaseChoice,
|
|
6303
|
-
modes:
|
|
6461
|
+
modes: import_zod64.z.array(import_zod64.z.enum(["one-time", "subscription"])).min(1).max(2),
|
|
6304
6462
|
selector: PostPurchaseSettings.shape.productTypeSelector
|
|
6305
6463
|
});
|
|
6306
6464
|
|
|
6307
6465
|
// src/schema/postPurchaseGroupCatalog.ts
|
|
6308
|
-
var
|
|
6466
|
+
var import_zod66 = require("zod");
|
|
6309
6467
|
|
|
6310
6468
|
// src/schema/postPurchaseVariantCatalog.ts
|
|
6311
|
-
var
|
|
6312
|
-
var PostPurchaseVariantSelector =
|
|
6469
|
+
var import_zod65 = require("zod");
|
|
6470
|
+
var PostPurchaseVariantSelector = import_zod65.z.object({ variantId: PostPurchaseVariantId }).strict();
|
|
6313
6471
|
var PostPurchaseVariantOption = OfferProduct.shape.options.element.extend({
|
|
6314
|
-
id:
|
|
6315
|
-
position:
|
|
6472
|
+
id: import_zod65.z.number().int().positive(),
|
|
6473
|
+
position: import_zod65.z.number().int().min(1).max(3)
|
|
6316
6474
|
});
|
|
6317
6475
|
var PostPurchaseVariantValues = OfferProduct.shape.variants.element.pick({
|
|
6318
6476
|
option1: true,
|
|
6319
6477
|
option2: true,
|
|
6320
6478
|
option3: true
|
|
6321
6479
|
});
|
|
6322
|
-
var PostPurchaseVariantCatalog =
|
|
6480
|
+
var PostPurchaseVariantCatalog = import_zod65.z.object({
|
|
6323
6481
|
displayMode: PostPurchaseSettings.shape.productOptions.shape.variantSelectorDisplayMode,
|
|
6324
|
-
options:
|
|
6482
|
+
options: import_zod65.z.array(PostPurchaseVariantOption),
|
|
6325
6483
|
productId: PostPurchaseProductId,
|
|
6326
6484
|
showSelectors: PostPurchaseSettings.shape.productOptions.shape.showVariantSelectors,
|
|
6327
|
-
variants:
|
|
6485
|
+
variants: import_zod65.z.array(
|
|
6328
6486
|
PostPurchaseVariantValues.partial().extend({
|
|
6329
|
-
available:
|
|
6487
|
+
available: import_zod65.z.boolean(),
|
|
6330
6488
|
id: PostPurchaseVariantId,
|
|
6331
|
-
imageId:
|
|
6489
|
+
imageId: import_zod65.z.number().int().nonnegative().nullish(),
|
|
6332
6490
|
title: OfferProduct.shape.variants.element.shape.title
|
|
6333
6491
|
})
|
|
6334
6492
|
)
|
|
@@ -6342,23 +6500,23 @@ var PostPurchaseGroupDescription = source.pick({ description: true, id: true, im
|
|
|
6342
6500
|
image: source.shape.image.default(null),
|
|
6343
6501
|
options: PostPurchaseVariantCatalog.shape.options.default([])
|
|
6344
6502
|
});
|
|
6345
|
-
var PostPurchaseGroupCatalog =
|
|
6503
|
+
var PostPurchaseGroupCatalog = import_zod66.z.object({
|
|
6346
6504
|
memberProductId: productId,
|
|
6347
|
-
options:
|
|
6505
|
+
options: import_zod66.z.array(import_zod66.z.object({ productId, title: import_zod66.z.string(), variantCatalog: PostPurchaseVariantCatalog }))
|
|
6348
6506
|
});
|
|
6349
|
-
var PostPurchaseGroupSelection =
|
|
6507
|
+
var PostPurchaseGroupSelection = import_zod66.z.object({
|
|
6350
6508
|
memberProductId: productId,
|
|
6351
6509
|
productId
|
|
6352
6510
|
});
|
|
6353
6511
|
|
|
6354
6512
|
// src/schema/postPurchaseProductView.ts
|
|
6355
|
-
var PostPurchaseProductView =
|
|
6356
|
-
|
|
6513
|
+
var PostPurchaseProductView = import_zod67.z.union([
|
|
6514
|
+
import_zod67.z.object({
|
|
6357
6515
|
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
6358
6516
|
initialVariant: PostPurchaseVariantSelector.optional(),
|
|
6359
6517
|
planCatalog: PostPurchasePlanCatalog.nullable().optional(),
|
|
6360
6518
|
preparation: PreparedPostPurchaseProduct.extend({
|
|
6361
|
-
display: PreparedPostPurchaseProduct.shape.display.extend({ description:
|
|
6519
|
+
display: PreparedPostPurchaseProduct.shape.display.extend({ description: import_zod67.z.string().nullable() }).refine(
|
|
6362
6520
|
({ description, descriptionDocument }) => description === null === (descriptionDocument !== void 0),
|
|
6363
6521
|
"Exactly one of the plain and rich descriptions is shown"
|
|
6364
6522
|
)
|
|
@@ -6367,24 +6525,24 @@ var PostPurchaseProductView = import_zod60.z.union([
|
|
|
6367
6525
|
sections: CABRootSection,
|
|
6368
6526
|
variantCatalog: PostPurchaseVariantCatalog.optional()
|
|
6369
6527
|
}),
|
|
6370
|
-
|
|
6528
|
+
import_zod67.z.object({
|
|
6371
6529
|
groupCatalog: PostPurchaseGroupCatalog.optional(),
|
|
6372
6530
|
initialVariant: PostPurchaseVariantSelector.optional(),
|
|
6373
6531
|
planCatalog: PostPurchasePlanCatalog.nullable().optional(),
|
|
6374
6532
|
preparation: PostPurchasePreparation.options[1],
|
|
6375
6533
|
purchaseOptions: PostPurchaseOptions.optional(),
|
|
6376
|
-
sections:
|
|
6534
|
+
sections: import_zod67.z.null(),
|
|
6377
6535
|
variantCatalog: PostPurchaseVariantCatalog.optional()
|
|
6378
6536
|
})
|
|
6379
6537
|
]);
|
|
6380
6538
|
|
|
6381
6539
|
// src/server/postPurchaseOfferCopy.ts
|
|
6382
|
-
var
|
|
6383
|
-
var Copy =
|
|
6540
|
+
var import_zod68 = require("zod");
|
|
6541
|
+
var Copy = import_zod68.z.object({
|
|
6384
6542
|
superTitle: CalloutBannerBlock.shape.settings.shape.superTitle.unwrap().optional().catch(void 0),
|
|
6385
6543
|
title: CalloutBannerBlock.shape.settings.shape.title.unwrap().optional().catch(void 0)
|
|
6386
6544
|
});
|
|
6387
|
-
var Callout =
|
|
6545
|
+
var Callout = import_zod68.z.object({ settings: import_zod68.z.record(import_zod68.z.string(), import_zod68.z.unknown()), type: import_zod68.z.literal("callout_banner") });
|
|
6388
6546
|
var postPurchaseOfferCopy = (blocks, metadata) => {
|
|
6389
6547
|
const copy = Copy.safeParse(metadata.widget.language);
|
|
6390
6548
|
if (!blocks || !copy.success) return blocks;
|
|
@@ -6483,28 +6641,28 @@ var preparePostPurchaseAdmissionView = (widgetId, settings, response, report, ch
|
|
|
6483
6641
|
};
|
|
6484
6642
|
|
|
6485
6643
|
// src/schema/postPurchaseProductCollectionView.ts
|
|
6486
|
-
var
|
|
6487
|
-
var PostPurchaseProductCollectionView =
|
|
6488
|
-
members:
|
|
6489
|
-
|
|
6644
|
+
var import_zod69 = require("zod");
|
|
6645
|
+
var PostPurchaseProductCollectionView = import_zod69.z.object({
|
|
6646
|
+
members: import_zod69.z.array(
|
|
6647
|
+
import_zod69.z.object({
|
|
6490
6648
|
productId: PostPurchaseProductId,
|
|
6491
|
-
productIndex:
|
|
6649
|
+
productIndex: import_zod69.z.number().int().nonnegative(),
|
|
6492
6650
|
view: PostPurchaseProductView
|
|
6493
6651
|
})
|
|
6494
6652
|
)
|
|
6495
6653
|
});
|
|
6496
|
-
var PostPurchaseCollectionChoice =
|
|
6654
|
+
var PostPurchaseCollectionChoice = import_zod69.z.object({
|
|
6497
6655
|
choice: PostPurchaseChoice.optional(),
|
|
6498
6656
|
productId: PostPurchaseProductId,
|
|
6499
6657
|
variantId: PostPurchaseVariantSelector.shape.variantId.optional()
|
|
6500
6658
|
}).strict();
|
|
6501
|
-
var PostPurchaseExcludedProductIds =
|
|
6659
|
+
var PostPurchaseExcludedProductIds = import_zod69.z.array(PostPurchaseProductId).default([]);
|
|
6502
6660
|
|
|
6503
6661
|
// src/server/normalizePostPurchaseCollection.ts
|
|
6504
|
-
var
|
|
6662
|
+
var import_zod70 = require("zod");
|
|
6505
6663
|
var normalizePostPurchaseCollection = (settings, response, excludedProductIds) => {
|
|
6506
6664
|
const normalized = normalizePostPurchaseProduct(settings, response);
|
|
6507
|
-
const limit =
|
|
6665
|
+
const limit = import_zod70.z.number().int().positive();
|
|
6508
6666
|
limit.parse(normalized.original.productLimit);
|
|
6509
6667
|
const prefix = normalized.data.slice(0, limit.parse(normalized.effective.productLimit));
|
|
6510
6668
|
if (new Set(prefix.map(({ id }) => id)).size !== prefix.length)
|
|
@@ -6548,13 +6706,13 @@ var projectPostPurchaseVariantCatalog = (product, settings) => {
|
|
|
6548
6706
|
};
|
|
6549
6707
|
|
|
6550
6708
|
// src/schema/postPurchaseQuantity.ts
|
|
6551
|
-
var
|
|
6709
|
+
var import_zod71 = require("zod");
|
|
6552
6710
|
var quantity = PreparedPostPurchaseProduct.shape.selection.shape.quantity;
|
|
6553
6711
|
var PostPurchaseQuantityChoice = PostPurchaseCollectionChoice.extend({ quantity: quantity.optional() });
|
|
6554
6712
|
var PostPurchaseQuantityPolicy = PostPurchaseSettings.shape.quantityInputs.omit({ defaultQuantity: true }).extend({
|
|
6555
6713
|
initialQuantity: quantity,
|
|
6556
6714
|
maxValue: quantity,
|
|
6557
|
-
minValue:
|
|
6715
|
+
minValue: import_zod71.z.literal(0).transform(() => 1).or(quantity)
|
|
6558
6716
|
}).refine(({ maxValue, minValue }) => minValue <= maxValue, "Quantity bounds are reversed");
|
|
6559
6717
|
|
|
6560
6718
|
// src/server/readPostPurchaseQuantity.ts
|
|
@@ -6585,39 +6743,39 @@ var readPostPurchaseQuantity = ({
|
|
|
6585
6743
|
};
|
|
6586
6744
|
|
|
6587
6745
|
// src/schema/postPurchaseVariantDefault.ts
|
|
6588
|
-
var
|
|
6746
|
+
var import_zod72 = require("zod");
|
|
6589
6747
|
var values = PostPurchaseVariantValues.partial().extend({
|
|
6590
6748
|
option1: PostPurchaseVariantValues.shape.option1.nullish()
|
|
6591
6749
|
});
|
|
6592
6750
|
var variant = values.extend({
|
|
6593
6751
|
id: PostPurchaseVariantId,
|
|
6594
|
-
inventoryManagement:
|
|
6595
|
-
inventoryPolicy:
|
|
6596
|
-
inventoryQuantity:
|
|
6752
|
+
inventoryManagement: import_zod72.z.string().nullable(),
|
|
6753
|
+
inventoryPolicy: import_zod72.z.string(),
|
|
6754
|
+
inventoryQuantity: import_zod72.z.number()
|
|
6597
6755
|
});
|
|
6598
|
-
var options =
|
|
6599
|
-
var PostPurchaseVariantDefaultProduct =
|
|
6756
|
+
var options = import_zod72.z.array(PostPurchaseVariantOption.pick({ name: true, values: true }));
|
|
6757
|
+
var PostPurchaseVariantDefaultProduct = import_zod72.z.object({
|
|
6600
6758
|
id: PostPurchaseProductId,
|
|
6601
6759
|
options,
|
|
6602
6760
|
selectedVariant: variant.optional(),
|
|
6603
|
-
variants:
|
|
6761
|
+
variants: import_zod72.z.array(variant)
|
|
6604
6762
|
});
|
|
6605
6763
|
var PostPurchaseVariantDefaultSettings = PostPurchaseSettings.shape.productOptions.pick({
|
|
6606
6764
|
hideOutOfStockVariants: true,
|
|
6607
6765
|
matchVariant: true
|
|
6608
6766
|
});
|
|
6609
|
-
var PostPurchaseOrderAttributes =
|
|
6610
|
-
var PostPurchaseOriginalVariants =
|
|
6611
|
-
|
|
6767
|
+
var PostPurchaseOrderAttributes = import_zod72.z.record(import_zod72.z.string(), import_zod72.z.array(import_zod72.z.string())).default({});
|
|
6768
|
+
var PostPurchaseOriginalVariants = import_zod72.z.array(
|
|
6769
|
+
import_zod72.z.object({ productId: PostPurchaseProductId, variantId: PostPurchaseVariantId })
|
|
6612
6770
|
);
|
|
6613
|
-
var PostPurchaseAttributeProducts =
|
|
6614
|
-
|
|
6771
|
+
var PostPurchaseAttributeProducts = import_zod72.z.array(
|
|
6772
|
+
import_zod72.z.object({ id: PostPurchaseProductId, options, variants: import_zod72.z.array(values.extend({ id: PostPurchaseVariantId })) })
|
|
6615
6773
|
);
|
|
6616
6774
|
|
|
6617
6775
|
// src/schema/postPurchaseVariantDefaultContext.ts
|
|
6618
|
-
var
|
|
6619
|
-
var PostPurchaseVariantDefaultContext =
|
|
6620
|
-
enrichedLineItems:
|
|
6776
|
+
var import_zod73 = require("zod");
|
|
6777
|
+
var PostPurchaseVariantDefaultContext = import_zod73.z.object({
|
|
6778
|
+
enrichedLineItems: import_zod73.z.unknown().optional(),
|
|
6621
6779
|
originalVariants: PostPurchaseOriginalVariants
|
|
6622
6780
|
});
|
|
6623
6781
|
|
|
@@ -6960,22 +7118,22 @@ var preparePostPurchaseCollectionView = (widgetId, settings, response, report, r
|
|
|
6960
7118
|
};
|
|
6961
7119
|
|
|
6962
7120
|
// src/schema/postPurchaseOfferEligibility.ts
|
|
6963
|
-
var
|
|
7121
|
+
var import_zod74 = require("zod");
|
|
6964
7122
|
var selection2 = PreparedPostPurchaseProduct.shape.selection;
|
|
6965
|
-
var PostPurchaseOfferSkipReason =
|
|
6966
|
-
var PostPurchaseOfferEligibilityContext =
|
|
7123
|
+
var PostPurchaseOfferSkipReason = import_zod74.z.enum(["empty", "no-eligible-subscription"]);
|
|
7124
|
+
var PostPurchaseOfferEligibilityContext = import_zod74.z.object({
|
|
6967
7125
|
excludedProductIds: PostPurchaseExcludedProductIds,
|
|
6968
|
-
originalLineItems:
|
|
7126
|
+
originalLineItems: import_zod74.z.array(selection2.pick({ productId: true, sellingPlanId: true, variantId: true }))
|
|
6969
7127
|
});
|
|
6970
|
-
var PostPurchaseOfferEligibility =
|
|
6971
|
-
|
|
6972
|
-
members:
|
|
6973
|
-
|
|
7128
|
+
var PostPurchaseOfferEligibility = import_zod74.z.discriminatedUnion("status", [
|
|
7129
|
+
import_zod74.z.object({
|
|
7130
|
+
members: import_zod74.z.array(
|
|
7131
|
+
import_zod74.z.object({ productId: selection2.shape.productId, productIndex: import_zod74.z.number().int().nonnegative() })
|
|
6974
7132
|
),
|
|
6975
|
-
status:
|
|
7133
|
+
status: import_zod74.z.literal("retain")
|
|
6976
7134
|
}),
|
|
6977
|
-
|
|
6978
|
-
|
|
7135
|
+
import_zod74.z.object({ reason: PostPurchaseOfferSkipReason, status: import_zod74.z.literal("skip") }),
|
|
7136
|
+
import_zod74.z.object({ reason: import_zod74.z.literal("eligible-upgrade").optional(), status: import_zod74.z.literal("unavailable") })
|
|
6979
7137
|
]);
|
|
6980
7138
|
|
|
6981
7139
|
// src/server/postPurchaseMemberEligibility.ts
|
|
@@ -7069,12 +7227,12 @@ var preparePostPurchaseGroupDeclineDisplay = (settings, response, requested, exc
|
|
|
7069
7227
|
|
|
7070
7228
|
// src/server/preparePostPurchaseOfferPresentation.ts
|
|
7071
7229
|
var import_compat7 = require("es-toolkit/compat");
|
|
7072
|
-
var
|
|
7230
|
+
var import_zod76 = require("zod");
|
|
7073
7231
|
|
|
7074
7232
|
// src/schema/postPurchaseOfferPresentation.ts
|
|
7075
|
-
var
|
|
7233
|
+
var import_zod75 = require("zod");
|
|
7076
7234
|
var language2 = PostPurchaseSettings.shape.language.shape.global.unwrap().unwrap();
|
|
7077
|
-
var PostPurchaseOfferPresentation =
|
|
7235
|
+
var PostPurchaseOfferPresentation = import_zod75.z.strictObject({
|
|
7078
7236
|
labels: language2.pick({ declineAll: true, declineThisOffer: true }),
|
|
7079
7237
|
layout: PostPurchaseSettings.shape.offersLayout,
|
|
7080
7238
|
sections: CABRootSection.nullable(),
|
|
@@ -7083,7 +7241,7 @@ var PostPurchaseOfferPresentation = import_zod68.z.strictObject({
|
|
|
7083
7241
|
|
|
7084
7242
|
// src/server/preparePostPurchaseOfferPresentation.ts
|
|
7085
7243
|
var FrameSettings = PostPurchaseSettings.pick({ language: true, offersLayout: true, productOptions: true }).extend({
|
|
7086
|
-
blocks:
|
|
7244
|
+
blocks: import_zod76.z.array(import_zod76.z.unknown()).optional()
|
|
7087
7245
|
});
|
|
7088
7246
|
var preparePostPurchaseOfferPresentation = (widgetId, settings, response, report) => {
|
|
7089
7247
|
const { metadata } = PostPurchaseProductSource.pick({ metadata: true }).parse(deepCamelCase(response));
|
|
@@ -7243,7 +7401,7 @@ var postAnalyticsEvents = async (input, ctx) => {
|
|
|
7243
7401
|
};
|
|
7244
7402
|
|
|
7245
7403
|
// src/server/requestSchemas.ts
|
|
7246
|
-
var
|
|
7404
|
+
var import_zod77 = require("zod");
|
|
7247
7405
|
var REQUEST_BOUNDS = {
|
|
7248
7406
|
/** Cart-level attributes per cart. */
|
|
7249
7407
|
CART_ATTRIBUTES_MAX: 100,
|
|
@@ -7274,42 +7432,42 @@ var REQUEST_BOUNDS = {
|
|
|
7274
7432
|
/** Rich ads transaction lines — the engine's ads contract. */
|
|
7275
7433
|
TRANSACTION_ITEMS_MAX: 50
|
|
7276
7434
|
};
|
|
7277
|
-
var KeyValue =
|
|
7278
|
-
key:
|
|
7279
|
-
value:
|
|
7435
|
+
var KeyValue = import_zod77.z.object({
|
|
7436
|
+
key: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX),
|
|
7437
|
+
value: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_VALUE_MAX).optional()
|
|
7280
7438
|
});
|
|
7281
|
-
var CartLineInputSchema =
|
|
7282
|
-
productId:
|
|
7283
|
-
properties:
|
|
7284
|
-
quantity:
|
|
7285
|
-
subscriptionId:
|
|
7286
|
-
variantId:
|
|
7439
|
+
var CartLineInputSchema = import_zod77.z.object({
|
|
7440
|
+
productId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
7441
|
+
properties: import_zod77.z.array(KeyValue).max(REQUEST_BOUNDS.LINE_PROPERTIES_MAX).optional(),
|
|
7442
|
+
quantity: import_zod77.z.number(),
|
|
7443
|
+
subscriptionId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
7444
|
+
variantId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX)
|
|
7287
7445
|
});
|
|
7288
|
-
var CartInputSchema =
|
|
7289
|
-
attributes:
|
|
7446
|
+
var CartInputSchema = import_zod77.z.object({
|
|
7447
|
+
attributes: import_zod77.z.array(KeyValue).max(REQUEST_BOUNDS.CART_ATTRIBUTES_MAX).optional(),
|
|
7290
7448
|
/**
|
|
7291
7449
|
* Presentment-per-shop-currency FX rate (buyer price ÷ shop price, e.g. `1.35` for a USD shop
|
|
7292
7450
|
* selling in CAD). Money rule thresholds are authored in SHOP currency, so the engine subtotal is
|
|
7293
7451
|
* divided by this before evaluation. Omit (or send 1) when the cart is already in the shop's currency.
|
|
7294
7452
|
*/
|
|
7295
|
-
currencyRate:
|
|
7453
|
+
currencyRate: import_zod77.z.number().optional(),
|
|
7296
7454
|
/** Applied discount codes; the engine evaluates `discount_code` rules against them (sent as `[{code}]`). */
|
|
7297
|
-
discountCodes:
|
|
7455
|
+
discountCodes: import_zod77.z.array(import_zod77.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX)).max(REQUEST_BOUNDS.DISCOUNT_CODES_MAX).optional(),
|
|
7298
7456
|
/** Presentment cents of cart-level discount allocations, subtracted from `subtotal` for the engine. */
|
|
7299
|
-
discountTotal:
|
|
7300
|
-
items:
|
|
7457
|
+
discountTotal: import_zod77.z.number().optional(),
|
|
7458
|
+
items: import_zod77.z.array(CartLineInputSchema).max(REQUEST_BOUNDS.CART_ITEMS_MAX),
|
|
7301
7459
|
/** Presentment subtotal in cents. */
|
|
7302
|
-
subtotal:
|
|
7460
|
+
subtotal: import_zod77.z.number()
|
|
7303
7461
|
});
|
|
7304
|
-
var UserConfigInputSchema =
|
|
7305
|
-
var DataSourceInputSchema =
|
|
7462
|
+
var UserConfigInputSchema = import_zod77.z.object({ shop: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX) });
|
|
7463
|
+
var DataSourceInputSchema = import_zod77.z.object({
|
|
7306
7464
|
cart: CartInputSchema,
|
|
7307
7465
|
/**
|
|
7308
7466
|
* Numeric Shopify company-location id when the buyer is a B2B session (`buyerIdentity.purchasingCompany`).
|
|
7309
7467
|
* Present ⇒ the orchestrator filters results by the location's catalog via admin-api (REB-23713); the
|
|
7310
7468
|
* client's country-context market check is bypassed for B2B (it false-negatives B2B-catalog products).
|
|
7311
7469
|
*/
|
|
7312
|
-
companyLocationId:
|
|
7470
|
+
companyLocationId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
7313
7471
|
/**
|
|
7314
7472
|
* Buyer's market country (ISO 3166-1 alpha-2) — forwarded to the engine as the `country_code` PARAM
|
|
7315
7473
|
* when the shop's markets toggle is on (REB-21688; the sink was the `X-Country-Code` header under
|
|
@@ -7318,16 +7476,16 @@ var DataSourceInputSchema = import_zod70.z.object({
|
|
|
7318
7476
|
* uppercase (the wire value is forwarded verbatim as the param) so a case-sensitive engine lookup
|
|
7319
7477
|
* can't silently miss a lowercase code — `adsEngine.ts` uppercases for the same reason.
|
|
7320
7478
|
*/
|
|
7321
|
-
country:
|
|
7322
|
-
customerId:
|
|
7323
|
-
dataSourcePath:
|
|
7479
|
+
country: import_zod77.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(),
|
|
7480
|
+
customerId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
7481
|
+
dataSourcePath: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX),
|
|
7324
7482
|
/**
|
|
7325
7483
|
* Engine `filter_inputs` override: `'no'` keeps in-cart (input) products in the results/rule
|
|
7326
7484
|
* outputs — gift validation sends it so a gift's own product can appear in its answer. Omitted = the
|
|
7327
7485
|
* engine's default filtering.
|
|
7328
7486
|
*/
|
|
7329
|
-
filterInputs:
|
|
7330
|
-
integrations:
|
|
7487
|
+
filterInputs: import_zod77.z.enum(["no", "yes"]).optional(),
|
|
7488
|
+
integrations: import_zod77.z.record(import_zod77.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX), import_zod77.z.boolean()).refine((record) => Object.keys(record).length <= REQUEST_BOUNDS.INTEGRATION_KEYS_MAX, {
|
|
7331
7489
|
message: `Too many integration keys (max ${REQUEST_BOUNDS.INTEGRATION_KEYS_MAX})`
|
|
7332
7490
|
}).optional(),
|
|
7333
7491
|
/**
|
|
@@ -7340,31 +7498,31 @@ var DataSourceInputSchema = import_zod70.z.object({
|
|
|
7340
7498
|
* request header) fails the regex. Callers should send the buyer's resolved locale (e.g. Shopify
|
|
7341
7499
|
* checkout's `localization.language.isoCode`), not the request header verbatim.
|
|
7342
7500
|
*/
|
|
7343
|
-
language:
|
|
7344
|
-
limit:
|
|
7345
|
-
productType:
|
|
7346
|
-
shop:
|
|
7347
|
-
visitorId:
|
|
7348
|
-
});
|
|
7349
|
-
var GiftInputSchema =
|
|
7350
|
-
cost:
|
|
7351
|
-
discounted:
|
|
7501
|
+
language: import_zod77.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(),
|
|
7502
|
+
limit: import_zod77.z.number().max(REQUEST_BOUNDS.LIMIT_MAX),
|
|
7503
|
+
productType: import_zod77.z.enum(["both", "one-time", "subscription"]).optional(),
|
|
7504
|
+
shop: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
7505
|
+
visitorId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
7506
|
+
});
|
|
7507
|
+
var GiftInputSchema = import_zod77.z.object({
|
|
7508
|
+
cost: import_zod77.z.number(),
|
|
7509
|
+
discounted: import_zod77.z.boolean(),
|
|
7352
7510
|
/**
|
|
7353
7511
|
* Which gift attribution the line carries (REB-24363). Defaults to `gwp` because a client that predates
|
|
7354
7512
|
* the field only ever sent GWP lines — without the default an older extension's request would 422.
|
|
7355
7513
|
*/
|
|
7356
|
-
kind:
|
|
7357
|
-
lineId:
|
|
7358
|
-
productId:
|
|
7514
|
+
kind: import_zod77.z.enum(GIFT_KINDS).default("gwp"),
|
|
7515
|
+
lineId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
7516
|
+
productId: import_zod77.z.number(),
|
|
7359
7517
|
/**
|
|
7360
7518
|
* The line's unit count (REB-24363) — the selectable-GWP verdict trims surplus units against milestone
|
|
7361
7519
|
* capacity. The second deliberate default: a client predating the field sent only GWP lines, whose
|
|
7362
7520
|
* verdict is whole-line, so a missing quantity reads as one unit rather than 422ing the older request.
|
|
7363
7521
|
*/
|
|
7364
|
-
quantity:
|
|
7365
|
-
widgetId:
|
|
7522
|
+
quantity: import_zod77.z.number().int().min(1).default(1),
|
|
7523
|
+
widgetId: import_zod77.z.number()
|
|
7366
7524
|
});
|
|
7367
|
-
var GiftValidationInputSchema =
|
|
7525
|
+
var GiftValidationInputSchema = import_zod77.z.object({
|
|
7368
7526
|
cart: CartInputSchema,
|
|
7369
7527
|
/**
|
|
7370
7528
|
* Buyer's market country — threaded into the per-widget data-source evaluations, which forward it to
|
|
@@ -7373,25 +7531,25 @@ var GiftValidationInputSchema = import_zod70.z.object({
|
|
|
7373
7531
|
* turns markets off); regex-bound and uppercase-normalized for the same reasons as
|
|
7374
7532
|
* `DataSourceInputSchema`'s `country`.
|
|
7375
7533
|
*/
|
|
7376
|
-
country:
|
|
7377
|
-
customerId:
|
|
7378
|
-
gifts:
|
|
7534
|
+
country: import_zod77.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(),
|
|
7535
|
+
customerId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
7536
|
+
gifts: import_zod77.z.array(GiftInputSchema).max(REQUEST_BOUNDS.GIFTS_MAX),
|
|
7379
7537
|
/**
|
|
7380
7538
|
* Buyer's checkout language — threaded into the per-widget data-source evaluations, which normalize
|
|
7381
7539
|
* and forward it as the engine `locale` param under the same markets-toggle gate (REB-21688). MUST be
|
|
7382
7540
|
* a single BCP-47 tag, for the same reason as `DataSourceInputSchema`'s `language` above.
|
|
7383
7541
|
*/
|
|
7384
|
-
language:
|
|
7385
|
-
shop:
|
|
7386
|
-
visitorId:
|
|
7542
|
+
language: import_zod77.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(),
|
|
7543
|
+
shop: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
7544
|
+
visitorId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
7387
7545
|
});
|
|
7388
|
-
var GiftAdjustmentSchema =
|
|
7389
|
-
lineId:
|
|
7390
|
-
quantity:
|
|
7546
|
+
var GiftAdjustmentSchema = import_zod77.z.object({
|
|
7547
|
+
lineId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
7548
|
+
quantity: import_zod77.z.number().int().nonnegative()
|
|
7391
7549
|
});
|
|
7392
|
-
var GiftValidationResponseSchema =
|
|
7393
|
-
adjust:
|
|
7394
|
-
remove:
|
|
7550
|
+
var GiftValidationResponseSchema = import_zod77.z.object({
|
|
7551
|
+
adjust: import_zod77.z.array(GiftAdjustmentSchema).max(REQUEST_BOUNDS.GIFTS_MAX).default([]),
|
|
7552
|
+
remove: import_zod77.z.array(import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX)).max(REQUEST_BOUNDS.GIFTS_MAX).refine(
|
|
7395
7553
|
(remove) => new Set(remove).size === remove.length,
|
|
7396
7554
|
"a line id may appear at most once in `remove`"
|
|
7397
7555
|
)
|
|
@@ -7402,47 +7560,47 @@ var GiftValidationResponseSchema = import_zod70.z.object({
|
|
|
7402
7560
|
({ adjust }) => new Set(adjust.map(({ lineId }) => lineId)).size === adjust.length,
|
|
7403
7561
|
"a line id may appear at most once in `adjust`"
|
|
7404
7562
|
);
|
|
7405
|
-
var MonetizeTransactionItemSchema =
|
|
7406
|
-
id:
|
|
7407
|
-
priceCents:
|
|
7408
|
-
quantity:
|
|
7409
|
-
title:
|
|
7410
|
-
type:
|
|
7411
|
-
});
|
|
7412
|
-
var MonetizeInputSchema =
|
|
7563
|
+
var MonetizeTransactionItemSchema = import_zod77.z.object({
|
|
7564
|
+
id: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
7565
|
+
priceCents: import_zod77.z.number(),
|
|
7566
|
+
quantity: import_zod77.z.number(),
|
|
7567
|
+
title: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX),
|
|
7568
|
+
type: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX)
|
|
7569
|
+
});
|
|
7570
|
+
var MonetizeInputSchema = import_zod77.z.object({
|
|
7413
7571
|
cart: CartInputSchema,
|
|
7414
7572
|
/** Client-minted render-beacon correlation id; forwarded to the ads engine as `client_request_id`. */
|
|
7415
|
-
clientRequestId:
|
|
7416
|
-
country:
|
|
7417
|
-
currency:
|
|
7573
|
+
clientRequestId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
7574
|
+
country: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
7575
|
+
currency: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
7418
7576
|
/** Ads-targeting identity/geo/locale fields (React parity); folded into the engine query verbatim. */
|
|
7419
|
-
customerEmail:
|
|
7420
|
-
customerFirstName:
|
|
7421
|
-
customerId:
|
|
7422
|
-
customerLastName:
|
|
7423
|
-
language:
|
|
7577
|
+
customerEmail: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
|
|
7578
|
+
customerFirstName: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
|
|
7579
|
+
customerId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
7580
|
+
customerLastName: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
|
|
7581
|
+
language: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
7424
7582
|
/** Buyer-facing order name (e.g. `#1001`) for the server-composed "Order … Confirmed" chrome line. */
|
|
7425
|
-
orderName:
|
|
7583
|
+
orderName: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
|
|
7426
7584
|
/** Ads surface label, forwarded verbatim; `customer_account` is measured/floored as its own surface (the account-area order list). */
|
|
7427
|
-
placement:
|
|
7585
|
+
placement: import_zod77.z.enum(["customer_account", "order_status", "thank_you_page"]),
|
|
7428
7586
|
/** Privacy Policy footer href — the Monetize widget's `privacy_policy_url` setting (React parity). */
|
|
7429
|
-
privacyPolicyUrl:
|
|
7587
|
+
privacyPolicyUrl: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_URL_MAX).optional(),
|
|
7430
7588
|
/** 30-min rolling session id (React parity); used for the ads `session_id`, else the visitor id. */
|
|
7431
|
-
sessionId:
|
|
7432
|
-
shop:
|
|
7589
|
+
sessionId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
7590
|
+
shop: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
7433
7591
|
/** Editor/QA indicator; OR-ed into the ads-engine `testing` flag so it stays out of billing/reporting. */
|
|
7434
|
-
testing:
|
|
7435
|
-
timezone:
|
|
7592
|
+
testing: import_zod77.z.boolean().optional(),
|
|
7593
|
+
timezone: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
7436
7594
|
/** Decorated (numeric) order id → the ads `transaction_id`. */
|
|
7437
|
-
transactionId:
|
|
7595
|
+
transactionId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
7438
7596
|
/** Rich per-line ads items; capped at the engine's ads contract. Preferred over `cart.items`. */
|
|
7439
|
-
transactionItems:
|
|
7597
|
+
transactionItems: import_zod77.z.array(MonetizeTransactionItemSchema).max(REQUEST_BOUNDS.TRANSACTION_ITEMS_MAX).optional(),
|
|
7440
7598
|
/** Order total in presentment cents (React prefers total over subtotal); else `cart.subtotal`. */
|
|
7441
|
-
transactionTotal:
|
|
7442
|
-
visitorId:
|
|
7443
|
-
zipCode:
|
|
7599
|
+
transactionTotal: import_zod77.z.number().optional(),
|
|
7600
|
+
visitorId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
7601
|
+
zipCode: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
7444
7602
|
});
|
|
7445
|
-
var WidgetSettingsInputSchema =
|
|
7603
|
+
var WidgetSettingsInputSchema = import_zod77.z.object({
|
|
7446
7604
|
/**
|
|
7447
7605
|
* Same domain as `CabShopConfig.cacheKey`, for the same reason: this side WINS the orchestrator's
|
|
7448
7606
|
* `input.cacheKey ?? config.shop.cacheKey` (and an explicit value skips the config read entirely), so
|
|
@@ -7450,9 +7608,9 @@ var WidgetSettingsInputSchema = import_zod70.z.object({
|
|
|
7450
7608
|
* and pin the edge copy permanently stale. `.catch(undefined)` because a bogus buster should degrade
|
|
7451
7609
|
* the read to un-busted, never 400 a widget render.
|
|
7452
7610
|
*/
|
|
7453
|
-
cacheKey:
|
|
7454
|
-
id:
|
|
7455
|
-
key:
|
|
7611
|
+
cacheKey: import_zod77.z.number().int().positive().optional().catch(void 0),
|
|
7612
|
+
id: import_zod77.z.number(),
|
|
7613
|
+
key: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
7456
7614
|
/**
|
|
7457
7615
|
* Monetize context for inline hydration: when present AND the widget converts to a Monetize marker,
|
|
7458
7616
|
* the server fetches/composes the offer cards inside this same request (no second `/cab/monetize`
|
|
@@ -7461,34 +7619,34 @@ var WidgetSettingsInputSchema = import_zod70.z.object({
|
|
|
7461
7619
|
* `privacyPolicyUrl` comes from the widget settings server-side (more authoritative than a relay).
|
|
7462
7620
|
*/
|
|
7463
7621
|
monetize: MonetizeInputSchema.omit({ privacyPolicyUrl: true, shop: true }).optional(),
|
|
7464
|
-
shop:
|
|
7622
|
+
shop: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
7465
7623
|
/** Stable per-buyer id; when present, enables sticky server-side A/B variant selection. */
|
|
7466
|
-
visitorId:
|
|
7624
|
+
visitorId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
7467
7625
|
});
|
|
7468
|
-
var AnalyticsEventInputSchema =
|
|
7469
|
-
name:
|
|
7470
|
-
properties:
|
|
7471
|
-
sentAt:
|
|
7626
|
+
var AnalyticsEventInputSchema = import_zod77.z.object({
|
|
7627
|
+
name: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX),
|
|
7628
|
+
properties: import_zod77.z.record(import_zod77.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX), import_zod77.z.unknown()).optional(),
|
|
7629
|
+
sentAt: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
7472
7630
|
});
|
|
7473
|
-
var AnalyticsSegmentsInputSchema =
|
|
7474
|
-
device:
|
|
7475
|
-
source:
|
|
7476
|
-
visitor:
|
|
7631
|
+
var AnalyticsSegmentsInputSchema = import_zod77.z.object({
|
|
7632
|
+
device: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional().catch(void 0),
|
|
7633
|
+
source: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional().catch(void 0),
|
|
7634
|
+
visitor: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional().catch(void 0)
|
|
7477
7635
|
});
|
|
7478
|
-
var AnalyticsInputSchema =
|
|
7636
|
+
var AnalyticsInputSchema = import_zod77.z.object({
|
|
7479
7637
|
/** Rebuy cart token (the `r_cart_token` cart attribute), when available — primary aggregation key. */
|
|
7480
|
-
cartToken:
|
|
7638
|
+
cartToken: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
7481
7639
|
/** Shopify checkout token, when available — drives cart/checkout aggregation downstream. */
|
|
7482
|
-
checkoutToken:
|
|
7483
|
-
events:
|
|
7640
|
+
checkoutToken: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
7641
|
+
events: import_zod77.z.array(AnalyticsEventInputSchema).max(REQUEST_BOUNDS.EVENTS_MAX),
|
|
7484
7642
|
/**
|
|
7485
7643
|
* Request-scoped like the tokens: one visitor's segments apply to every event in the batch. The container
|
|
7486
7644
|
* degrades too (`null` is a realistic wire artifact of `attributes ? {…} : null`), so the degrade rule is
|
|
7487
7645
|
* total: nothing about `segments` can cost the envelope.
|
|
7488
7646
|
*/
|
|
7489
7647
|
segments: AnalyticsSegmentsInputSchema.optional().catch(void 0),
|
|
7490
|
-
shop:
|
|
7491
|
-
visitorId:
|
|
7648
|
+
shop: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
7649
|
+
visitorId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
7492
7650
|
/** The widget id (smartBlockId) the events belong to. */
|
|
7493
|
-
widgetId:
|
|
7651
|
+
widgetId: import_zod77.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
7494
7652
|
});
|