@rebuy/rebuy 3.28.1 → 3.29.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/server/index.cjs +341 -140
- package/dist/server/index.mjs +341 -140
- package/dist/transforms/index.cjs +215 -14
- package/dist/transforms/index.mjs +215 -14
- package/dist/transforms/postPurchase/convertImageBlock.d.ts +4 -0
- package/dist/transforms/postPurchase/convertImageContentBlock.d.ts +7 -0
- package/dist/transforms/postPurchase/convertImageContentText.d.ts +5 -0
- package/dist/transforms/postPurchase/convertImageFrame.d.ts +9 -0
- package/dist/transforms/postPurchase/convertMessagePreview.d.ts +3 -3
- package/dist/transforms/postPurchase/convertProductInformation.d.ts +4 -0
- package/dist/transforms/postPurchase/imageContentSettings.d.ts +50 -0
- package/dist/transforms/postPurchase/sizeImageSource.d.ts +2 -0
- package/package.json +1 -1
package/dist/server/index.cjs
CHANGED
|
@@ -3778,7 +3778,7 @@ var convertOfferToV2 = ({ id, name, settings }) => {
|
|
|
3778
3778
|
var parseShielded = (schema, raw, transform = (input) => input) => schema.parse(transform(convertNumericObjects(deepCamelCase(raw))));
|
|
3779
3779
|
|
|
3780
3780
|
// src/transforms/postPurchase/convertMessagePreview.ts
|
|
3781
|
-
var
|
|
3781
|
+
var import_zod36 = require("zod");
|
|
3782
3782
|
|
|
3783
3783
|
// src/transforms/postPurchase/convertCalloutBlock.ts
|
|
3784
3784
|
var import_zod31 = require("zod");
|
|
@@ -4001,6 +4001,150 @@ var convertCalloutBlock = (raw, report) => {
|
|
|
4001
4001
|
return sections.length ? [CABLayoutSection.parse({ alignment: { horizontal }, frame: "callout", sections })] : [];
|
|
4002
4002
|
};
|
|
4003
4003
|
|
|
4004
|
+
// src/transforms/postPurchase/convertImageFrame.ts
|
|
4005
|
+
var import_zod32 = require("zod");
|
|
4006
|
+
|
|
4007
|
+
// src/transforms/postPurchase/sizeImageSource.ts
|
|
4008
|
+
var sizeImageSource = (source, size) => {
|
|
4009
|
+
const extension = source.split(".").pop();
|
|
4010
|
+
for (const previous of ["small", "medium", "large", "original", "master"]) {
|
|
4011
|
+
source = source.replace(`_${previous}.${extension}`, `.${extension}`);
|
|
4012
|
+
}
|
|
4013
|
+
return source.replace(`.${extension}`, `${size === void 0 ? "" : `_${size}`}.${extension}`);
|
|
4014
|
+
};
|
|
4015
|
+
|
|
4016
|
+
// src/transforms/postPurchase/convertImageFrame.ts
|
|
4017
|
+
var Source = import_zod32.z.url().default("https://cdn.shopify.com/s/files/1/0605/0555/5177/files/placeholder.jpg?v=1657762972");
|
|
4018
|
+
var DEFAULT_IMAGE_SIZE = 20;
|
|
4019
|
+
var convertImageFrame = (raw) => {
|
|
4020
|
+
const parsed = ImageBlock.shape.settings.options[0].safeParse(raw);
|
|
4021
|
+
if (!parsed.success) return null;
|
|
4022
|
+
const settings = parsed.data;
|
|
4023
|
+
const source = sizeImageSource(Source.parse(settings.image || void 0));
|
|
4024
|
+
const withAlt = CABImageSection.safeParse({ altText: settings.alt, source });
|
|
4025
|
+
const image = withAlt.success ? withAlt.data : CABImageSection.parse({ source });
|
|
4026
|
+
const size = settings.imageSize > 0 ? settings.imageSize : DEFAULT_IMAGE_SIZE;
|
|
4027
|
+
return CABLayoutSection.parse({
|
|
4028
|
+
alignment: { horizontal: "center" },
|
|
4029
|
+
direction: "grid",
|
|
4030
|
+
grid: { columns: size <= 1 ? ["100%"] : [size] },
|
|
4031
|
+
sections: [image],
|
|
4032
|
+
width: size <= 1 ? size * 100 : 100
|
|
4033
|
+
});
|
|
4034
|
+
};
|
|
4035
|
+
|
|
4036
|
+
// src/transforms/postPurchase/convertImageBlock.ts
|
|
4037
|
+
var dropMalformedAlt = (raw) => {
|
|
4038
|
+
if (typeof raw !== "object" || raw === null) return raw;
|
|
4039
|
+
const { settings, ...rest } = raw;
|
|
4040
|
+
if (typeof settings !== "object" || settings === null || Array.isArray(settings)) return raw;
|
|
4041
|
+
const { alt, ...restSettings } = settings;
|
|
4042
|
+
if (typeof alt === "string" || alt === void 0) return raw;
|
|
4043
|
+
return { ...rest, settings: restSettings };
|
|
4044
|
+
};
|
|
4045
|
+
var convertImageBlock = (raw, report) => {
|
|
4046
|
+
const block = ImageBlock.safeParse(dropMalformedAlt(raw));
|
|
4047
|
+
const image = block.success ? convertImageFrame(block.data.settings) : null;
|
|
4048
|
+
if (!image) {
|
|
4049
|
+
report?.({ detail: "Unreadable post-purchase image", kind: "section" });
|
|
4050
|
+
return [];
|
|
4051
|
+
}
|
|
4052
|
+
return [
|
|
4053
|
+
CABLayoutSection.parse({
|
|
4054
|
+
alignment: { horizontal: "center" },
|
|
4055
|
+
frame: "offer-content",
|
|
4056
|
+
sections: [image],
|
|
4057
|
+
spacing: "none"
|
|
4058
|
+
})
|
|
4059
|
+
];
|
|
4060
|
+
};
|
|
4061
|
+
|
|
4062
|
+
// src/transforms/postPurchase/convertImageContentBlock.ts
|
|
4063
|
+
var import_zod34 = require("zod");
|
|
4064
|
+
|
|
4065
|
+
// src/transforms/postPurchase/convertImageContentText.ts
|
|
4066
|
+
var fields2 = ["superTitle", "title", "description"];
|
|
4067
|
+
var convertImageContentText = (settings, report) => {
|
|
4068
|
+
const horizontal = { center: "center", leading: "start", trailing: "end" }[settings.horizontalAlignment];
|
|
4069
|
+
const sections = fields2.flatMap((field) => {
|
|
4070
|
+
const omit = () => {
|
|
4071
|
+
report?.({ detail: `Unreadable post-purchase image-content field: ${field}`, kind: "section" });
|
|
4072
|
+
return [];
|
|
4073
|
+
};
|
|
4074
|
+
const value = ImageContentBlock.shape.settings.shape[field].safeParse(settings[field]);
|
|
4075
|
+
if (!value.success) return omit();
|
|
4076
|
+
const text2 = value.data;
|
|
4077
|
+
if (text2 === null || text2 === "") return [];
|
|
4078
|
+
const content = typeof text2 === "string" ? {
|
|
4079
|
+
content: [
|
|
4080
|
+
{
|
|
4081
|
+
attrs: { textAlign: horizontal },
|
|
4082
|
+
content: [styledTextRun(text2, field !== "description", settings[`${field}Size`])]
|
|
4083
|
+
}
|
|
4084
|
+
]
|
|
4085
|
+
} : text2;
|
|
4086
|
+
const section = CABTextSection.safeParse({ content: { en: content } });
|
|
4087
|
+
return section.success ? [section.data] : omit();
|
|
4088
|
+
});
|
|
4089
|
+
return CABLayoutSection.parse({ alignment: { horizontal }, sections });
|
|
4090
|
+
};
|
|
4091
|
+
|
|
4092
|
+
// src/transforms/postPurchase/imageContentSettings.ts
|
|
4093
|
+
var import_zod33 = require("zod");
|
|
4094
|
+
var ImageContentSettings = ImageContentBlock.shape.settings.pick({
|
|
4095
|
+
descriptionSize: true,
|
|
4096
|
+
horizontalAlignment: true,
|
|
4097
|
+
superTitleSize: true,
|
|
4098
|
+
swapContent: true,
|
|
4099
|
+
titleSize: true
|
|
4100
|
+
}).extend({
|
|
4101
|
+
alt: import_zod33.z.unknown().optional(),
|
|
4102
|
+
description: import_zod33.z.unknown().optional(),
|
|
4103
|
+
image: import_zod33.z.unknown().optional(),
|
|
4104
|
+
imagePlacement: ImageContentBlock.shape.settings.shape.imagePlacement.unwrap().nullable(),
|
|
4105
|
+
imageSize: ImageContentBlock.shape.settings.shape.imageSize.pipe(import_zod33.z.number().positive()),
|
|
4106
|
+
superTitle: import_zod33.z.unknown().optional(),
|
|
4107
|
+
title: import_zod33.z.unknown().optional()
|
|
4108
|
+
});
|
|
4109
|
+
|
|
4110
|
+
// src/transforms/postPurchase/convertImageContentBlock.ts
|
|
4111
|
+
var Shell2 = import_zod34.z.object({ settings: ImageContentSettings, type: import_zod34.z.literal("image_content") });
|
|
4112
|
+
var PROPORTIONAL_BREAK_AT = 500;
|
|
4113
|
+
var convertImageContentBlock = (raw, report) => {
|
|
4114
|
+
const shell = Shell2.safeParse(raw);
|
|
4115
|
+
if (!shell.success) {
|
|
4116
|
+
report?.({ detail: "Unreadable post-purchase image-content block", kind: "section" });
|
|
4117
|
+
return [];
|
|
4118
|
+
}
|
|
4119
|
+
const settings = shell.data.settings;
|
|
4120
|
+
const alt = typeof settings.alt === "string" ? settings.alt : void 0;
|
|
4121
|
+
if (settings.alt !== void 0 && alt === void 0) {
|
|
4122
|
+
report?.({ detail: "Unreadable post-purchase image-content alt text", kind: "section" });
|
|
4123
|
+
}
|
|
4124
|
+
const image = convertImageFrame({ alt, image: settings.image, imageSize: settings.imageSize });
|
|
4125
|
+
if (!image) report?.({ detail: "Unreadable post-purchase image-content image", kind: "section" });
|
|
4126
|
+
const text2 = convertImageContentText(settings, report);
|
|
4127
|
+
const textFrame = CABLayoutSection.parse({ direction: "grid", grid: { columns: ["100%"] }, sections: [text2] });
|
|
4128
|
+
const placement = settings.imagePlacement ?? (settings.swapContent ? "right" : "left");
|
|
4129
|
+
const imageFirst = placement === "left" || placement === "top";
|
|
4130
|
+
const sections = imageFirst ? [image, textFrame] : [textFrame, image];
|
|
4131
|
+
const ordered = sections.filter((section) => section !== null);
|
|
4132
|
+
const inner = placement === "left" || placement === "right" ? CABLayoutSection.parse({
|
|
4133
|
+
sections: ordered,
|
|
4134
|
+
spacing: "loose",
|
|
4135
|
+
wrapping: {
|
|
4136
|
+
breakAt: settings.imageSize <= 1 ? PROPORTIONAL_BREAK_AT : settings.imageSize,
|
|
4137
|
+
maxPerLine: 2
|
|
4138
|
+
}
|
|
4139
|
+
}) : CABLayoutSection.parse({
|
|
4140
|
+
direction: "grid",
|
|
4141
|
+
grid: { columns: ["100%"] },
|
|
4142
|
+
sections: [CABLayoutSection.parse({ sections: ordered })],
|
|
4143
|
+
width: 95
|
|
4144
|
+
});
|
|
4145
|
+
return [CABLayoutSection.parse({ frame: "offer-content", sections: [inner], spacing: "none" })];
|
|
4146
|
+
};
|
|
4147
|
+
|
|
4004
4148
|
// src/transforms/postPurchase/convertPayButtonBlock.ts
|
|
4005
4149
|
var convertPayButtonBlock = (raw, report) => {
|
|
4006
4150
|
const omit = () => {
|
|
@@ -4029,6 +4173,60 @@ var convertPayButtonBlock = (raw, report) => {
|
|
|
4029
4173
|
];
|
|
4030
4174
|
};
|
|
4031
4175
|
|
|
4176
|
+
// src/transforms/postPurchase/convertProductInformation.ts
|
|
4177
|
+
var convertProductInformation = (raw, report) => {
|
|
4178
|
+
const block = ProductInformationBlock.safeParse(raw);
|
|
4179
|
+
if (!block.success) {
|
|
4180
|
+
report?.({ detail: "Unreadable post-purchase product information", kind: "section" });
|
|
4181
|
+
return [];
|
|
4182
|
+
}
|
|
4183
|
+
return [
|
|
4184
|
+
CABOffersSection.parse({
|
|
4185
|
+
direction: "grid",
|
|
4186
|
+
sections: [
|
|
4187
|
+
CABLayoutSection.parse({
|
|
4188
|
+
alignment: { horizontal: "center" },
|
|
4189
|
+
sections: [
|
|
4190
|
+
CABLayoutSection.parse({
|
|
4191
|
+
alignment: { horizontal: "center" },
|
|
4192
|
+
direction: "grid",
|
|
4193
|
+
grid: { columns: [250] },
|
|
4194
|
+
sections: [
|
|
4195
|
+
CABImageSection.parse({ altText: "{{productTitle}}", source: "{{productImage}}" })
|
|
4196
|
+
],
|
|
4197
|
+
width: 90
|
|
4198
|
+
})
|
|
4199
|
+
]
|
|
4200
|
+
}),
|
|
4201
|
+
CABLayoutSection.parse({
|
|
4202
|
+
sections: [
|
|
4203
|
+
CABTextSection.parse({
|
|
4204
|
+
content: {
|
|
4205
|
+
en: {
|
|
4206
|
+
content: [
|
|
4207
|
+
{
|
|
4208
|
+
content: [
|
|
4209
|
+
{
|
|
4210
|
+
marks: [{ attrs: { fontSize: "heading" }, type: "textStyle" }],
|
|
4211
|
+
text: "{{productTitle}}"
|
|
4212
|
+
}
|
|
4213
|
+
]
|
|
4214
|
+
}
|
|
4215
|
+
]
|
|
4216
|
+
}
|
|
4217
|
+
}
|
|
4218
|
+
}),
|
|
4219
|
+
CABReviewsSection.parse({}),
|
|
4220
|
+
CABTextSection.parse({ content: { en: "{{productDescription}}" } })
|
|
4221
|
+
]
|
|
4222
|
+
})
|
|
4223
|
+
],
|
|
4224
|
+
spacing: "extraLoose",
|
|
4225
|
+
wrapping: { breakAt: 500, maxPerLine: block.data.hideProductImage ? 1 : 2 }
|
|
4226
|
+
})
|
|
4227
|
+
];
|
|
4228
|
+
};
|
|
4229
|
+
|
|
4032
4230
|
// src/transforms/postPurchase/convertSeparatorBlock.ts
|
|
4033
4231
|
var convertSeparatorBlock = (raw, report) => {
|
|
4034
4232
|
if (!SeparatorBlock.safeParse(raw).success) {
|
|
@@ -4039,29 +4237,29 @@ var convertSeparatorBlock = (raw, report) => {
|
|
|
4039
4237
|
};
|
|
4040
4238
|
|
|
4041
4239
|
// src/transforms/postPurchase/convertTextBlock.ts
|
|
4042
|
-
var
|
|
4043
|
-
var
|
|
4240
|
+
var import_zod35 = require("zod");
|
|
4241
|
+
var fields3 = ["superTitle", "title", "description"];
|
|
4044
4242
|
var styles = {
|
|
4045
4243
|
description: [{ attrs: { color: "base", fontSize: "small" }, type: "textStyle" }],
|
|
4046
4244
|
superTitle: [{ attrs: { color: "subdued", fontSize: "small" }, type: "textStyle" }],
|
|
4047
4245
|
title: [{ type: "bold" }, { attrs: { color: "base", fontSize: "large" }, type: "textStyle" }]
|
|
4048
4246
|
};
|
|
4049
4247
|
var settingsSchema = TextBlock.shape.settings;
|
|
4050
|
-
var
|
|
4248
|
+
var Shell3 = import_zod35.z.object({
|
|
4051
4249
|
settings: settingsSchema.pick({ horizontalAlignment: true }).extend({
|
|
4052
|
-
description:
|
|
4053
|
-
superTitle:
|
|
4054
|
-
title:
|
|
4250
|
+
description: import_zod35.z.unknown().optional(),
|
|
4251
|
+
superTitle: import_zod35.z.unknown().optional(),
|
|
4252
|
+
title: import_zod35.z.unknown().optional()
|
|
4055
4253
|
}),
|
|
4056
|
-
type:
|
|
4254
|
+
type: import_zod35.z.literal("text")
|
|
4057
4255
|
});
|
|
4058
4256
|
var convertTextBlock = (raw, report) => {
|
|
4059
|
-
const shell =
|
|
4257
|
+
const shell = Shell3.safeParse(raw);
|
|
4060
4258
|
if (!shell.success) {
|
|
4061
4259
|
report?.({ detail: "Unreadable post-purchase text block", kind: "section" });
|
|
4062
4260
|
return [];
|
|
4063
4261
|
}
|
|
4064
|
-
const values =
|
|
4262
|
+
const values = fields3.map((field) => ({
|
|
4065
4263
|
field,
|
|
4066
4264
|
result: settingsSchema.shape[field].safeParse(shell.data.settings[field])
|
|
4067
4265
|
}));
|
|
@@ -4125,14 +4323,17 @@ var convertTimerBlock = (raw, report) => {
|
|
|
4125
4323
|
};
|
|
4126
4324
|
|
|
4127
4325
|
// src/transforms/postPurchase/convertMessagePreview.ts
|
|
4128
|
-
var MessageWidget =
|
|
4129
|
-
blocks:
|
|
4130
|
-
type:
|
|
4326
|
+
var MessageWidget = import_zod36.z.object({
|
|
4327
|
+
blocks: import_zod36.z.array(import_zod36.z.unknown()).min(1),
|
|
4328
|
+
type: import_zod36.z.literal(WidgetType.shopify_post_purchase_extension)
|
|
4131
4329
|
});
|
|
4132
|
-
var BlockType2 =
|
|
4330
|
+
var BlockType2 = import_zod36.z.object({ type: import_zod36.z.string() });
|
|
4133
4331
|
var converters = {
|
|
4134
4332
|
callout_banner: convertCalloutBlock,
|
|
4333
|
+
image: convertImageBlock,
|
|
4334
|
+
image_content: convertImageContentBlock,
|
|
4135
4335
|
pay_button: convertPayButtonBlock,
|
|
4336
|
+
product_information: convertProductInformation,
|
|
4136
4337
|
separator: convertSeparatorBlock,
|
|
4137
4338
|
text: convertTextBlock,
|
|
4138
4339
|
timer: convertTimerBlock
|
|
@@ -4674,7 +4875,7 @@ var fetchDataSourceResults = async (input, ctx) => {
|
|
|
4674
4875
|
};
|
|
4675
4876
|
|
|
4676
4877
|
// src/server/adsEngine.ts
|
|
4677
|
-
var
|
|
4878
|
+
var import_zod37 = require("zod");
|
|
4678
4879
|
var SUPPLY_KEY = { production: "AQF5RKLR", staging: "Z56LQ7PS" };
|
|
4679
4880
|
var OFFER_LIMIT = 4;
|
|
4680
4881
|
var SUPPORTED_COUNTRIES = /* @__PURE__ */ new Set(["US", "CA"]);
|
|
@@ -4687,28 +4888,28 @@ var transactionItems = (input) => (input.transactionItems?.map(({ id, priceCents
|
|
|
4687
4888
|
title,
|
|
4688
4889
|
type
|
|
4689
4890
|
})) ?? input.cart.items.map(({ productId, quantity }) => ({ id: productId, quantity }))).slice(0, MAX_TRANSACTION_ITEMS);
|
|
4690
|
-
var AdsEngineOffer =
|
|
4891
|
+
var AdsEngineOffer = import_zod37.z.object({
|
|
4691
4892
|
/** Pill-style value prop ("Get $45 Cashback"). Carried through the parse; the card does not render it yet (REB-24429 — pill design pending). */
|
|
4692
|
-
callout:
|
|
4693
|
-
click_url:
|
|
4694
|
-
cta:
|
|
4893
|
+
callout: import_zod37.z.string().catch(""),
|
|
4894
|
+
click_url: import_zod37.z.string(),
|
|
4895
|
+
cta: import_zod37.z.string(),
|
|
4695
4896
|
/** `omitempty` on the ad server — a bid without it must not fail the parse and drop the whole batch (composeOffer falls back to 'No Thanks'). */
|
|
4696
|
-
decline_cta:
|
|
4697
|
-
decline_url:
|
|
4698
|
-
description:
|
|
4897
|
+
decline_cta: import_zod37.z.string().catch(""),
|
|
4898
|
+
decline_url: import_zod37.z.string(),
|
|
4899
|
+
description: import_zod37.z.string(),
|
|
4699
4900
|
/** Short legal disclosure (FDIC / auto-renewal / FTC-affiliation lines). Rendered subdued under the CTAs. */
|
|
4700
|
-
disclaimer:
|
|
4901
|
+
disclaimer: import_zod37.z.string().catch(""),
|
|
4701
4902
|
/** Long legal text behind the disclosure toggle in the composed card (REB-24429). */
|
|
4702
|
-
extended_disclaimer:
|
|
4703
|
-
headline:
|
|
4704
|
-
id:
|
|
4903
|
+
extended_disclaimer: import_zod37.z.string().catch(""),
|
|
4904
|
+
headline: import_zod37.z.string(),
|
|
4905
|
+
id: import_zod37.z.string(),
|
|
4705
4906
|
/** Advertiser-supplied image alt; the composed card falls back to the stripped headline when empty. */
|
|
4706
|
-
image_alt:
|
|
4707
|
-
image_url:
|
|
4708
|
-
view_url:
|
|
4907
|
+
image_alt: import_zod37.z.string().catch(""),
|
|
4908
|
+
image_url: import_zod37.z.string().optional(),
|
|
4909
|
+
view_url: import_zod37.z.string()
|
|
4709
4910
|
});
|
|
4710
|
-
var AdsEngineResponse =
|
|
4711
|
-
offers:
|
|
4911
|
+
var AdsEngineResponse = import_zod37.z.object({
|
|
4912
|
+
offers: import_zod37.z.array(import_zod37.z.unknown()).default([]).transform(
|
|
4712
4913
|
(offers) => offers.flatMap((offer) => {
|
|
4713
4914
|
const result = AdsEngineOffer.safeParse(offer);
|
|
4714
4915
|
return result.success ? [result.data] : [];
|
|
@@ -4720,8 +4921,8 @@ var AdsEngineResponse = import_zod34.z.object({
|
|
|
4720
4921
|
* offers-testing fixture on a test store forces it, REB-24467). Both optional: an older engine or a
|
|
4721
4922
|
* non-JSON body must not fail the parse and drop the offers.
|
|
4722
4923
|
*/
|
|
4723
|
-
request_id:
|
|
4724
|
-
testing:
|
|
4924
|
+
request_id: import_zod37.z.string().optional().catch(void 0),
|
|
4925
|
+
testing: import_zod37.z.boolean().optional().catch(void 0)
|
|
4725
4926
|
});
|
|
4726
4927
|
var adsHost = (host) => `offers.${host}`;
|
|
4727
4928
|
var isTestingRequest = (input, isProduction) => !isProduction || !!input.testing || input.customerEmail?.toLowerCase() === TEST_CUSTOMER_EMAIL;
|
|
@@ -5151,13 +5352,13 @@ var convertWidgetSettings = async (input, ctx) => {
|
|
|
5151
5352
|
};
|
|
5152
5353
|
|
|
5153
5354
|
// src/server/giftWidgets.ts
|
|
5154
|
-
var
|
|
5155
|
-
var SettingsNumber =
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
]).pipe(
|
|
5159
|
-
var SgwpMilestoneSchema =
|
|
5160
|
-
selectable_product_quantity: SettingsNumber.pipe(
|
|
5355
|
+
var import_zod38 = require("zod");
|
|
5356
|
+
var SettingsNumber = import_zod38.z.union([
|
|
5357
|
+
import_zod38.z.number(),
|
|
5358
|
+
import_zod38.z.string().trim().regex(/^-?\d+(\.\d+)?$/)
|
|
5359
|
+
]).pipe(import_zod38.z.coerce.number());
|
|
5360
|
+
var SgwpMilestoneSchema = import_zod38.z.object({
|
|
5361
|
+
selectable_product_quantity: SettingsNumber.pipe(import_zod38.z.number().int().nonnegative()),
|
|
5161
5362
|
unlock_price: SettingsNumber
|
|
5162
5363
|
});
|
|
5163
5364
|
var fetchGiftWidgetSettings = async (widgetId, shop, ctx) => unwrapData(await ctx.fetchUpstream("/api/v1/widgets/settings", { id: String(widgetId), shop }, { host: ctx.host }));
|
|
@@ -5168,7 +5369,7 @@ var readDataSourcePath = (settings) => {
|
|
|
5168
5369
|
var readMilestones = (settings, report) => {
|
|
5169
5370
|
const raw = settings && typeof settings === "object" ? settings.milestones : void 0;
|
|
5170
5371
|
if (raw == null) return [];
|
|
5171
|
-
const parsed =
|
|
5372
|
+
const parsed = import_zod38.z.array(SgwpMilestoneSchema).safeParse(raw);
|
|
5172
5373
|
if (parsed.success) return parsed.data;
|
|
5173
5374
|
report?.({
|
|
5174
5375
|
detail: [
|
|
@@ -5417,7 +5618,7 @@ var postAnalyticsEvents = async (input, ctx) => {
|
|
|
5417
5618
|
};
|
|
5418
5619
|
|
|
5419
5620
|
// src/server/requestSchemas.ts
|
|
5420
|
-
var
|
|
5621
|
+
var import_zod39 = require("zod");
|
|
5421
5622
|
var REQUEST_BOUNDS = {
|
|
5422
5623
|
/** Cart-level attributes per cart. */
|
|
5423
5624
|
CART_ATTRIBUTES_MAX: 100,
|
|
@@ -5448,42 +5649,42 @@ var REQUEST_BOUNDS = {
|
|
|
5448
5649
|
/** Rich ads transaction lines — the engine's ads contract. */
|
|
5449
5650
|
TRANSACTION_ITEMS_MAX: 50
|
|
5450
5651
|
};
|
|
5451
|
-
var KeyValue =
|
|
5452
|
-
key:
|
|
5453
|
-
value:
|
|
5652
|
+
var KeyValue = import_zod39.z.object({
|
|
5653
|
+
key: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX),
|
|
5654
|
+
value: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_VALUE_MAX).optional()
|
|
5454
5655
|
});
|
|
5455
|
-
var CartLineInputSchema =
|
|
5456
|
-
productId:
|
|
5457
|
-
properties:
|
|
5458
|
-
quantity:
|
|
5459
|
-
subscriptionId:
|
|
5460
|
-
variantId:
|
|
5656
|
+
var CartLineInputSchema = import_zod39.z.object({
|
|
5657
|
+
productId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
5658
|
+
properties: import_zod39.z.array(KeyValue).max(REQUEST_BOUNDS.LINE_PROPERTIES_MAX).optional(),
|
|
5659
|
+
quantity: import_zod39.z.number(),
|
|
5660
|
+
subscriptionId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
5661
|
+
variantId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX)
|
|
5461
5662
|
});
|
|
5462
|
-
var CartInputSchema =
|
|
5463
|
-
attributes:
|
|
5663
|
+
var CartInputSchema = import_zod39.z.object({
|
|
5664
|
+
attributes: import_zod39.z.array(KeyValue).max(REQUEST_BOUNDS.CART_ATTRIBUTES_MAX).optional(),
|
|
5464
5665
|
/**
|
|
5465
5666
|
* Presentment-per-shop-currency FX rate (buyer price ÷ shop price, e.g. `1.35` for a USD shop
|
|
5466
5667
|
* selling in CAD). Money rule thresholds are authored in SHOP currency, so the engine subtotal is
|
|
5467
5668
|
* divided by this before evaluation. Omit (or send 1) when the cart is already in the shop's currency.
|
|
5468
5669
|
*/
|
|
5469
|
-
currencyRate:
|
|
5670
|
+
currencyRate: import_zod39.z.number().optional(),
|
|
5470
5671
|
/** Applied discount codes; the engine evaluates `discount_code` rules against them (sent as `[{code}]`). */
|
|
5471
|
-
discountCodes:
|
|
5672
|
+
discountCodes: import_zod39.z.array(import_zod39.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX)).max(REQUEST_BOUNDS.DISCOUNT_CODES_MAX).optional(),
|
|
5472
5673
|
/** Presentment cents of cart-level discount allocations, subtracted from `subtotal` for the engine. */
|
|
5473
|
-
discountTotal:
|
|
5474
|
-
items:
|
|
5674
|
+
discountTotal: import_zod39.z.number().optional(),
|
|
5675
|
+
items: import_zod39.z.array(CartLineInputSchema).max(REQUEST_BOUNDS.CART_ITEMS_MAX),
|
|
5475
5676
|
/** Presentment subtotal in cents. */
|
|
5476
|
-
subtotal:
|
|
5677
|
+
subtotal: import_zod39.z.number()
|
|
5477
5678
|
});
|
|
5478
|
-
var UserConfigInputSchema =
|
|
5479
|
-
var DataSourceInputSchema =
|
|
5679
|
+
var UserConfigInputSchema = import_zod39.z.object({ shop: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX) });
|
|
5680
|
+
var DataSourceInputSchema = import_zod39.z.object({
|
|
5480
5681
|
cart: CartInputSchema,
|
|
5481
5682
|
/**
|
|
5482
5683
|
* Numeric Shopify company-location id when the buyer is a B2B session (`buyerIdentity.purchasingCompany`).
|
|
5483
5684
|
* Present ⇒ the orchestrator filters results by the location's catalog via admin-api (REB-23713); the
|
|
5484
5685
|
* client's country-context market check is bypassed for B2B (it false-negatives B2B-catalog products).
|
|
5485
5686
|
*/
|
|
5486
|
-
companyLocationId:
|
|
5687
|
+
companyLocationId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
5487
5688
|
/**
|
|
5488
5689
|
* Buyer's market country (ISO 3166-1 alpha-2) — forwarded to the engine as the `country_code` PARAM
|
|
5489
5690
|
* when the shop's markets toggle is on (REB-21688; the sink was the `X-Country-Code` header under
|
|
@@ -5492,16 +5693,16 @@ var DataSourceInputSchema = import_zod36.z.object({
|
|
|
5492
5693
|
* uppercase (the wire value is forwarded verbatim as the param) so a case-sensitive engine lookup
|
|
5493
5694
|
* can't silently miss a lowercase code — `adsEngine.ts` uppercases for the same reason.
|
|
5494
5695
|
*/
|
|
5495
|
-
country:
|
|
5496
|
-
customerId:
|
|
5497
|
-
dataSourcePath:
|
|
5696
|
+
country: import_zod39.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(),
|
|
5697
|
+
customerId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
5698
|
+
dataSourcePath: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX),
|
|
5498
5699
|
/**
|
|
5499
5700
|
* Engine `filter_inputs` override: `'no'` keeps in-cart (input) products in the results/rule
|
|
5500
5701
|
* outputs — gift validation sends it so a gift's own product can appear in its answer. Omitted = the
|
|
5501
5702
|
* engine's default filtering.
|
|
5502
5703
|
*/
|
|
5503
|
-
filterInputs:
|
|
5504
|
-
integrations:
|
|
5704
|
+
filterInputs: import_zod39.z.enum(["no", "yes"]).optional(),
|
|
5705
|
+
integrations: import_zod39.z.record(import_zod39.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX), import_zod39.z.boolean()).refine((record) => Object.keys(record).length <= REQUEST_BOUNDS.INTEGRATION_KEYS_MAX, {
|
|
5505
5706
|
message: `Too many integration keys (max ${REQUEST_BOUNDS.INTEGRATION_KEYS_MAX})`
|
|
5506
5707
|
}).optional(),
|
|
5507
5708
|
/**
|
|
@@ -5514,31 +5715,31 @@ var DataSourceInputSchema = import_zod36.z.object({
|
|
|
5514
5715
|
* request header) fails the regex. Callers should send the buyer's resolved locale (e.g. Shopify
|
|
5515
5716
|
* checkout's `localization.language.isoCode`), not the request header verbatim.
|
|
5516
5717
|
*/
|
|
5517
|
-
language:
|
|
5518
|
-
limit:
|
|
5519
|
-
productType:
|
|
5520
|
-
shop:
|
|
5521
|
-
visitorId:
|
|
5718
|
+
language: import_zod39.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(),
|
|
5719
|
+
limit: import_zod39.z.number().max(REQUEST_BOUNDS.LIMIT_MAX),
|
|
5720
|
+
productType: import_zod39.z.enum(["both", "one-time", "subscription"]).optional(),
|
|
5721
|
+
shop: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
5722
|
+
visitorId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
5522
5723
|
});
|
|
5523
|
-
var GiftInputSchema =
|
|
5524
|
-
cost:
|
|
5525
|
-
discounted:
|
|
5724
|
+
var GiftInputSchema = import_zod39.z.object({
|
|
5725
|
+
cost: import_zod39.z.number(),
|
|
5726
|
+
discounted: import_zod39.z.boolean(),
|
|
5526
5727
|
/**
|
|
5527
5728
|
* Which gift attribution the line carries (REB-24363). Defaults to `gwp` because a client that predates
|
|
5528
5729
|
* the field only ever sent GWP lines — without the default an older extension's request would 422.
|
|
5529
5730
|
*/
|
|
5530
|
-
kind:
|
|
5531
|
-
lineId:
|
|
5532
|
-
productId:
|
|
5731
|
+
kind: import_zod39.z.enum(GIFT_KINDS).default("gwp"),
|
|
5732
|
+
lineId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
5733
|
+
productId: import_zod39.z.number(),
|
|
5533
5734
|
/**
|
|
5534
5735
|
* The line's unit count (REB-24363) — the selectable-GWP verdict trims surplus units against milestone
|
|
5535
5736
|
* capacity. The second deliberate default: a client predating the field sent only GWP lines, whose
|
|
5536
5737
|
* verdict is whole-line, so a missing quantity reads as one unit rather than 422ing the older request.
|
|
5537
5738
|
*/
|
|
5538
|
-
quantity:
|
|
5539
|
-
widgetId:
|
|
5739
|
+
quantity: import_zod39.z.number().int().min(1).default(1),
|
|
5740
|
+
widgetId: import_zod39.z.number()
|
|
5540
5741
|
});
|
|
5541
|
-
var GiftValidationInputSchema =
|
|
5742
|
+
var GiftValidationInputSchema = import_zod39.z.object({
|
|
5542
5743
|
cart: CartInputSchema,
|
|
5543
5744
|
/**
|
|
5544
5745
|
* Buyer's market country — threaded into the per-widget data-source evaluations, which forward it to
|
|
@@ -5547,25 +5748,25 @@ var GiftValidationInputSchema = import_zod36.z.object({
|
|
|
5547
5748
|
* turns markets off); regex-bound and uppercase-normalized for the same reasons as
|
|
5548
5749
|
* `DataSourceInputSchema`'s `country`.
|
|
5549
5750
|
*/
|
|
5550
|
-
country:
|
|
5551
|
-
customerId:
|
|
5552
|
-
gifts:
|
|
5751
|
+
country: import_zod39.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(),
|
|
5752
|
+
customerId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
5753
|
+
gifts: import_zod39.z.array(GiftInputSchema).max(REQUEST_BOUNDS.GIFTS_MAX),
|
|
5553
5754
|
/**
|
|
5554
5755
|
* Buyer's checkout language — threaded into the per-widget data-source evaluations, which normalize
|
|
5555
5756
|
* and forward it as the engine `locale` param under the same markets-toggle gate (REB-21688). MUST be
|
|
5556
5757
|
* a single BCP-47 tag, for the same reason as `DataSourceInputSchema`'s `language` above.
|
|
5557
5758
|
*/
|
|
5558
|
-
language:
|
|
5559
|
-
shop:
|
|
5560
|
-
visitorId:
|
|
5759
|
+
language: import_zod39.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(),
|
|
5760
|
+
shop: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
5761
|
+
visitorId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
5561
5762
|
});
|
|
5562
|
-
var GiftAdjustmentSchema =
|
|
5563
|
-
lineId:
|
|
5564
|
-
quantity:
|
|
5763
|
+
var GiftAdjustmentSchema = import_zod39.z.object({
|
|
5764
|
+
lineId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
5765
|
+
quantity: import_zod39.z.number().int().nonnegative()
|
|
5565
5766
|
});
|
|
5566
|
-
var GiftValidationResponseSchema =
|
|
5567
|
-
adjust:
|
|
5568
|
-
remove:
|
|
5767
|
+
var GiftValidationResponseSchema = import_zod39.z.object({
|
|
5768
|
+
adjust: import_zod39.z.array(GiftAdjustmentSchema).max(REQUEST_BOUNDS.GIFTS_MAX).default([]),
|
|
5769
|
+
remove: import_zod39.z.array(import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX)).max(REQUEST_BOUNDS.GIFTS_MAX).refine(
|
|
5569
5770
|
(remove) => new Set(remove).size === remove.length,
|
|
5570
5771
|
"a line id may appear at most once in `remove`"
|
|
5571
5772
|
)
|
|
@@ -5576,47 +5777,47 @@ var GiftValidationResponseSchema = import_zod36.z.object({
|
|
|
5576
5777
|
({ adjust }) => new Set(adjust.map(({ lineId }) => lineId)).size === adjust.length,
|
|
5577
5778
|
"a line id may appear at most once in `adjust`"
|
|
5578
5779
|
);
|
|
5579
|
-
var MonetizeTransactionItemSchema =
|
|
5580
|
-
id:
|
|
5581
|
-
priceCents:
|
|
5582
|
-
quantity:
|
|
5583
|
-
title:
|
|
5584
|
-
type:
|
|
5780
|
+
var MonetizeTransactionItemSchema = import_zod39.z.object({
|
|
5781
|
+
id: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
5782
|
+
priceCents: import_zod39.z.number(),
|
|
5783
|
+
quantity: import_zod39.z.number(),
|
|
5784
|
+
title: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX),
|
|
5785
|
+
type: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX)
|
|
5585
5786
|
});
|
|
5586
|
-
var MonetizeInputSchema =
|
|
5787
|
+
var MonetizeInputSchema = import_zod39.z.object({
|
|
5587
5788
|
cart: CartInputSchema,
|
|
5588
5789
|
/** Client-minted render-beacon correlation id; forwarded to the ads engine as `client_request_id`. */
|
|
5589
|
-
clientRequestId:
|
|
5590
|
-
country:
|
|
5591
|
-
currency:
|
|
5790
|
+
clientRequestId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
5791
|
+
country: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
5792
|
+
currency: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
5592
5793
|
/** Ads-targeting identity/geo/locale fields (React parity); folded into the engine query verbatim. */
|
|
5593
|
-
customerEmail:
|
|
5594
|
-
customerFirstName:
|
|
5595
|
-
customerId:
|
|
5596
|
-
customerLastName:
|
|
5597
|
-
language:
|
|
5794
|
+
customerEmail: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
|
|
5795
|
+
customerFirstName: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
|
|
5796
|
+
customerId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
5797
|
+
customerLastName: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
|
|
5798
|
+
language: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
5598
5799
|
/** Buyer-facing order name (e.g. `#1001`) for the server-composed "Order … Confirmed" chrome line. */
|
|
5599
|
-
orderName:
|
|
5800
|
+
orderName: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_TEXT_MAX).optional(),
|
|
5600
5801
|
/** Ads surface label, forwarded verbatim; `customer_account` is measured/floored as its own surface (the account-area order list). */
|
|
5601
|
-
placement:
|
|
5802
|
+
placement: import_zod39.z.enum(["customer_account", "order_status", "thank_you_page"]),
|
|
5602
5803
|
/** Privacy Policy footer href — the Monetize widget's `privacy_policy_url` setting (React parity). */
|
|
5603
|
-
privacyPolicyUrl:
|
|
5804
|
+
privacyPolicyUrl: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_URL_MAX).optional(),
|
|
5604
5805
|
/** 30-min rolling session id (React parity); used for the ads `session_id`, else the visitor id. */
|
|
5605
|
-
sessionId:
|
|
5606
|
-
shop:
|
|
5806
|
+
sessionId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
5807
|
+
shop: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
5607
5808
|
/** Editor/QA indicator; OR-ed into the ads-engine `testing` flag so it stays out of billing/reporting. */
|
|
5608
|
-
testing:
|
|
5609
|
-
timezone:
|
|
5809
|
+
testing: import_zod39.z.boolean().optional(),
|
|
5810
|
+
timezone: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
5610
5811
|
/** Decorated (numeric) order id → the ads `transaction_id`. */
|
|
5611
|
-
transactionId:
|
|
5812
|
+
transactionId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
5612
5813
|
/** Rich per-line ads items; capped at the engine's ads contract. Preferred over `cart.items`. */
|
|
5613
|
-
transactionItems:
|
|
5814
|
+
transactionItems: import_zod39.z.array(MonetizeTransactionItemSchema).max(REQUEST_BOUNDS.TRANSACTION_ITEMS_MAX).optional(),
|
|
5614
5815
|
/** Order total in presentment cents (React prefers total over subtotal); else `cart.subtotal`. */
|
|
5615
|
-
transactionTotal:
|
|
5616
|
-
visitorId:
|
|
5617
|
-
zipCode:
|
|
5816
|
+
transactionTotal: import_zod39.z.number().optional(),
|
|
5817
|
+
visitorId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
5818
|
+
zipCode: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
5618
5819
|
});
|
|
5619
|
-
var WidgetSettingsInputSchema =
|
|
5820
|
+
var WidgetSettingsInputSchema = import_zod39.z.object({
|
|
5620
5821
|
/**
|
|
5621
5822
|
* Same domain as `CabShopConfig.cacheKey`, for the same reason: this side WINS the orchestrator's
|
|
5622
5823
|
* `input.cacheKey ?? config.shop.cacheKey` (and an explicit value skips the config read entirely), so
|
|
@@ -5624,9 +5825,9 @@ var WidgetSettingsInputSchema = import_zod36.z.object({
|
|
|
5624
5825
|
* and pin the edge copy permanently stale. `.catch(undefined)` because a bogus buster should degrade
|
|
5625
5826
|
* the read to un-busted, never 400 a widget render.
|
|
5626
5827
|
*/
|
|
5627
|
-
cacheKey:
|
|
5628
|
-
id:
|
|
5629
|
-
key:
|
|
5828
|
+
cacheKey: import_zod39.z.number().int().positive().optional().catch(void 0),
|
|
5829
|
+
id: import_zod39.z.number(),
|
|
5830
|
+
key: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
5630
5831
|
/**
|
|
5631
5832
|
* Monetize context for inline hydration: when present AND the widget converts to a Monetize marker,
|
|
5632
5833
|
* the server fetches/composes the offer cards inside this same request (no second `/cab/monetize`
|
|
@@ -5635,34 +5836,34 @@ var WidgetSettingsInputSchema = import_zod36.z.object({
|
|
|
5635
5836
|
* `privacyPolicyUrl` comes from the widget settings server-side (more authoritative than a relay).
|
|
5636
5837
|
*/
|
|
5637
5838
|
monetize: MonetizeInputSchema.omit({ privacyPolicyUrl: true, shop: true }).optional(),
|
|
5638
|
-
shop:
|
|
5839
|
+
shop: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
5639
5840
|
/** Stable per-buyer id; when present, enables sticky server-side A/B variant selection. */
|
|
5640
|
-
visitorId:
|
|
5841
|
+
visitorId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
5641
5842
|
});
|
|
5642
|
-
var AnalyticsEventInputSchema =
|
|
5643
|
-
name:
|
|
5644
|
-
properties:
|
|
5645
|
-
sentAt:
|
|
5843
|
+
var AnalyticsEventInputSchema = import_zod39.z.object({
|
|
5844
|
+
name: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX),
|
|
5845
|
+
properties: import_zod39.z.record(import_zod39.z.string().max(REQUEST_BOUNDS.STRING_KEY_MAX), import_zod39.z.unknown()).optional(),
|
|
5846
|
+
sentAt: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
5646
5847
|
});
|
|
5647
|
-
var AnalyticsSegmentsInputSchema =
|
|
5648
|
-
device:
|
|
5649
|
-
source:
|
|
5650
|
-
visitor:
|
|
5848
|
+
var AnalyticsSegmentsInputSchema = import_zod39.z.object({
|
|
5849
|
+
device: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional().catch(void 0),
|
|
5850
|
+
source: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional().catch(void 0),
|
|
5851
|
+
visitor: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional().catch(void 0)
|
|
5651
5852
|
});
|
|
5652
|
-
var AnalyticsInputSchema =
|
|
5853
|
+
var AnalyticsInputSchema = import_zod39.z.object({
|
|
5653
5854
|
/** Rebuy cart token (the `r_cart_token` cart attribute), when available — primary aggregation key. */
|
|
5654
|
-
cartToken:
|
|
5855
|
+
cartToken: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
5655
5856
|
/** Shopify checkout token, when available — drives cart/checkout aggregation downstream. */
|
|
5656
|
-
checkoutToken:
|
|
5657
|
-
events:
|
|
5857
|
+
checkoutToken: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional(),
|
|
5858
|
+
events: import_zod39.z.array(AnalyticsEventInputSchema).max(REQUEST_BOUNDS.EVENTS_MAX),
|
|
5658
5859
|
/**
|
|
5659
5860
|
* Request-scoped like the tokens: one visitor's segments apply to every event in the batch. The container
|
|
5660
5861
|
* degrades too (`null` is a realistic wire artifact of `attributes ? {…} : null`), so the degrade rule is
|
|
5661
5862
|
* total: nothing about `segments` can cost the envelope.
|
|
5662
5863
|
*/
|
|
5663
5864
|
segments: AnalyticsSegmentsInputSchema.optional().catch(void 0),
|
|
5664
|
-
shop:
|
|
5665
|
-
visitorId:
|
|
5865
|
+
shop: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
5866
|
+
visitorId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX),
|
|
5666
5867
|
/** The widget id (smartBlockId) the events belong to. */
|
|
5667
|
-
widgetId:
|
|
5868
|
+
widgetId: import_zod39.z.string().max(REQUEST_BOUNDS.STRING_ID_MAX).optional()
|
|
5668
5869
|
});
|