@modainteract/moda-interact-shared 5.5.0 → 5.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/{chunk-QVPEX7KY.js → chunk-GCCT2BDE.js} +4 -4
  2. package/dist/chunk-QFUK7FIO.js +16 -0
  3. package/dist/chunk-QFUK7FIO.js.map +1 -0
  4. package/dist/{chunk-BDGLKOCW.js → chunk-WF2BDUPZ.js} +483 -315
  5. package/dist/chunk-WF2BDUPZ.js.map +1 -0
  6. package/dist/chunk-WHZAAF2Q.js +25 -0
  7. package/dist/chunk-WHZAAF2Q.js.map +1 -0
  8. package/dist/chunk-WK7QSBHJ.js +148 -0
  9. package/dist/chunk-WK7QSBHJ.js.map +1 -0
  10. package/dist/{chunk-XB5NIOKJ.js → chunk-WONND3OK.js} +3 -1
  11. package/dist/chunk-WONND3OK.js.map +1 -0
  12. package/dist/commerce/index.d.ts +34 -4
  13. package/dist/commerce/index.js +31 -16
  14. package/dist/commerce/index.js.map +1 -1
  15. package/dist/commerce/model/node.d.ts +3 -2
  16. package/dist/commerce/model/node.js +4 -4
  17. package/dist/commerce/outreach/index.d.ts +1094 -0
  18. package/dist/commerce/outreach/index.js +1355 -0
  19. package/dist/commerce/outreach/index.js.map +1 -0
  20. package/dist/commerce/presentation/index.d.ts +420 -0
  21. package/dist/commerce/presentation/index.js +661 -0
  22. package/dist/commerce/presentation/index.js.map +1 -0
  23. package/dist/commerce/runner/index.d.ts +4 -3
  24. package/dist/commerce/runner/index.js +69 -43
  25. package/dist/commerce/runner/index.js.map +1 -1
  26. package/dist/product-context-Bh74WGOo.d.ts +746 -0
  27. package/dist/recovery-offer-proof.js +2 -2
  28. package/dist/{response-C1JsiFoO.d.ts → response-DFDEw4K0.d.ts} +254 -707
  29. package/dist/{types-Ds5QJ621.d.ts → types-vIMrj5J4.d.ts} +6 -2
  30. package/package.json +17 -6
  31. package/dist/chunk-BDGLKOCW.js.map +0 -1
  32. package/dist/chunk-BYAI6W7T.js +0 -97
  33. package/dist/chunk-BYAI6W7T.js.map +0 -1
  34. package/dist/chunk-XB5NIOKJ.js.map +0 -1
  35. /package/dist/{chunk-QVPEX7KY.js.map → chunk-GCCT2BDE.js.map} +0 -0
@@ -8,18 +8,119 @@ import {
8
8
  SemverSchema,
9
9
  boundedJson,
10
10
  distinct
11
- } from "./chunk-QVPEX7KY.js";
11
+ } from "./chunk-GCCT2BDE.js";
12
+ import {
13
+ canonicaliseLanguageTag
14
+ } from "./chunk-4KSODB2R.js";
12
15
  import {
13
16
  canonicalJson,
14
17
  jsonBytes,
15
18
  responseContractCanonicalJson
16
19
  } from "./chunk-AUS3WQIW.js";
17
- import {
18
- canonicaliseLanguageTag
19
- } from "./chunk-4KSODB2R.js";
20
20
 
21
- // src/commerce/subset.ts
21
+ // src/commerce/product-facts.ts
22
22
  import { z } from "zod";
23
+ import { parseFragment } from "parse5";
24
+ var codePoints = (value) => Array.from(value).length;
25
+ var controls = /[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/u;
26
+ var label = z.string().min(1).refine((value) => codePoints(value) <= 128 && value === value.trim() && !/[\r\n\t]/u.test(value) && !controls.test(value));
27
+ var status = z.enum(["AVAILABLE", "NOT_PROVIDED", "PARTIAL"]);
28
+ var CommerceProductDescriptionSchema = z.strictObject({ status, text: z.string().refine((value) => codePoints(value) <= 4096 && !controls.test(value)) }).refine((value) => (value.status !== "NOT_PROVIDED" || value.text === "") && (value.status !== "AVAILABLE" || value.text.trim().length > 0));
29
+ var CommerceProductAttributesSchema = z.strictObject({ status, items: z.array(z.strictObject({ name: label, values: z.array(label).max(64) })).max(16) }).refine((value) => (value.status !== "NOT_PROVIDED" || value.items.length === 0) && (value.status !== "AVAILABLE" || value.items.length > 0)).refine((value) => new Set(value.items.map((item) => item.name)).size === value.items.length && value.items.every((item) => new Set(item.values).size === item.values.length));
30
+ function normalizeCommerceProductDescription(source, format) {
31
+ if (source === null || source === void 0 || source === "") return { status: "NOT_PROVIDED", text: "" };
32
+ if (typeof source !== "string" || !["PLAIN_TEXT", "HTML"].includes(format)) return { status: "PARTIAL", text: "" };
33
+ if (new TextEncoder().encode(source).length > 65536) return { status: "PARTIAL", text: "" };
34
+ let partial = controls.test(source);
35
+ let text = source;
36
+ if (format === "HTML") {
37
+ const lines = [];
38
+ const boundaries = /* @__PURE__ */ new Set(["br", "p", "div", "li", "ul", "ol", "h1", "h2", "h3", "h4", "h5", "h6", "table", "tr"]);
39
+ const skip = /* @__PURE__ */ new Set(["script", "style", "template", "noscript"]);
40
+ const walk = (node) => {
41
+ if ("tagName" in node && skip.has(node.tagName)) return;
42
+ const boundary = "tagName" in node && boundaries.has(node.tagName);
43
+ if (boundary) lines.push("\n");
44
+ if (node.nodeName === "#text" && "value" in node) lines.push(node.value);
45
+ if ("childNodes" in node) for (const child of node.childNodes) walk(child);
46
+ if (boundary && !("tagName" in node && node.tagName === "br")) lines.push("\n");
47
+ };
48
+ try {
49
+ walk(parseFragment(source, { onParseError: () => {
50
+ partial = true;
51
+ } }));
52
+ text = lines.join("");
53
+ } catch {
54
+ return { status: "PARTIAL", text: "" };
55
+ }
56
+ }
57
+ partial ||= controls.test(text);
58
+ text = text.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/gu, "").replace(/\r\n?/gu, "\n").replace(/[^\S\n]+/gu, " ").replace(/\n{3,}/gu, "\n\n").trim();
59
+ if (codePoints(text) > 4096) {
60
+ text = Array.from(text).slice(0, 4096).join("");
61
+ partial = true;
62
+ }
63
+ return { status: partial ? "PARTIAL" : text ? "AVAILABLE" : "NOT_PROVIDED", text };
64
+ }
65
+ function normalizeCommerceProductAttributes(source) {
66
+ if (source === void 0 || source === null) return { status: "NOT_PROVIDED", items: [] };
67
+ const canonical = source && typeof source === "object" && !Array.isArray(source) ? source : null;
68
+ const rows = canonical ? canonical.items : source;
69
+ if (!Array.isArray(rows)) return { status: "PARTIAL", items: [] };
70
+ let partial = !!canonical && (!["AVAILABLE", "NOT_PROVIDED"].includes(String(canonical.status)) || canonical.status === "NOT_PROVIDED" && rows.length > 0);
71
+ const items = [];
72
+ const clean = (raw) => {
73
+ if (typeof raw !== "string" || controls.test(raw)) return null;
74
+ const value = raw.replace(/[\r\n\t]/gu, " ").replace(/\s+/gu, " ").trim();
75
+ return value && codePoints(value) <= 128 ? value : null;
76
+ };
77
+ for (const raw of rows) {
78
+ if (!raw || typeof raw !== "object" || Array.isArray(raw)) {
79
+ partial = true;
80
+ continue;
81
+ }
82
+ const row = raw;
83
+ const name = clean(row.name);
84
+ if (!name || !Array.isArray(row.values)) {
85
+ partial = true;
86
+ continue;
87
+ }
88
+ let item = items.find((value) => value.name === name);
89
+ if (!item) {
90
+ if (items.length >= 16) {
91
+ partial = true;
92
+ continue;
93
+ }
94
+ item = { name, values: [] };
95
+ items.push(item);
96
+ }
97
+ for (const rawValue of row.values) {
98
+ const value = clean(rawValue);
99
+ if (!value) {
100
+ partial = true;
101
+ continue;
102
+ }
103
+ if (item.values.includes(value)) continue;
104
+ if (item.values.length >= 64) {
105
+ partial = true;
106
+ continue;
107
+ }
108
+ item.values.push(value);
109
+ }
110
+ }
111
+ return { status: partial ? "PARTIAL" : items.length ? "AVAILABLE" : "NOT_PROVIDED", items };
112
+ }
113
+ function normalizeCommerceProductDescriptionField(source) {
114
+ if (!source || typeof source !== "object" || Array.isArray(source)) return { status: "PARTIAL", text: "" };
115
+ const value = source;
116
+ if (typeof value.text !== "string") return { status: "PARTIAL", text: "" };
117
+ const normalized = normalizeCommerceProductDescription(value.text, "PLAIN_TEXT");
118
+ if (!status.safeParse(value.status).success || value.status === "PARTIAL" || value.status === "NOT_PROVIDED" && normalized.text) normalized.status = "PARTIAL";
119
+ return normalized;
120
+ }
121
+
122
+ // src/commerce/subset.ts
123
+ import { z as z2 } from "zod";
23
124
  var MONEY_PATTERN = "^[0-9]{1,18}(\\.[0-9]{1,6})?$";
24
125
  var safeName = (name) => /^[A-Za-z][A-Za-z0-9_]{0,63}$/.test(name) && !["__proto__", "prototype", "constructor"].includes(name);
25
126
  var safePath = (path) => path.length <= 256 && path.split(".").every(safeName);
@@ -119,10 +220,10 @@ function validateSubset(value, mode) {
119
220
  return false;
120
221
  }
121
222
  }
122
- var InputSchemaSchema = z.custom(
223
+ var InputSchemaSchema = z2.custom(
123
224
  (v) => validateSubset(v, "input")
124
225
  );
125
- var DetailsSchemaSchema = z.custom(
226
+ var DetailsSchemaSchema = z2.custom(
126
227
  (v) => validateSubset(v, "details")
127
228
  );
128
229
  function matchesSubset(schema, value) {
@@ -146,7 +247,7 @@ function matchesSubset(schema, value) {
146
247
  }
147
248
  function compileSubset(schema, mode) {
148
249
  if (!validateSubset(schema, mode)) throw new TypeError("Unsupported schema");
149
- return z.custom((value) => {
250
+ return z2.custom((value) => {
150
251
  try {
151
252
  return jsonBytes(value) <= (mode === "details" ? 16384 : 131072) && matchesSubset(schema, value);
152
253
  } catch {
@@ -156,7 +257,7 @@ function compileSubset(schema, mode) {
156
257
  }
157
258
 
158
259
  // src/commerce/purpose-output.ts
159
- import { z as z2 } from "zod";
260
+ import { z as z3 } from "zod";
160
261
  var CANONICAL_PATTERNS = [
161
262
  "^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\\.[0-9]+)?Z(?![\\s\\S])",
162
263
  "^[0-9]{1,18}(\\.[0-9]{1,6})?$",
@@ -223,7 +324,7 @@ function validateCommercePurposeOutputSchema(value) {
223
324
  return false;
224
325
  }
225
326
  }
226
- var CommercePurposeOutputSchemaSchema = z2.custom(validateCommercePurposeOutputSchema);
327
+ var CommercePurposeOutputSchemaSchema = z3.custom(validateCommercePurposeOutputSchema);
227
328
  function matches(schema, value) {
228
329
  if (schema.anyOf) return schema.anyOf.some((branch) => matches(branch, value));
229
330
  const nullable = Array.isArray(schema.type);
@@ -254,7 +355,7 @@ function matches(schema, value) {
254
355
  function compileCommercePurposeOutputSchema(raw) {
255
356
  if (!validateCommercePurposeOutputSchema(raw)) throw new TypeError("Unsupported purpose output schema");
256
357
  const snapshot = structuredClone(raw);
257
- return z2.custom((value) => {
358
+ return z3.custom((value) => {
258
359
  try {
259
360
  return jsonBytes(value) <= 32768 && matches(snapshot, value);
260
361
  } catch {
@@ -264,39 +365,39 @@ function compileCommercePurposeOutputSchema(raw) {
264
365
  }
265
366
 
266
367
  // src/commerce/external.ts
267
- import { z as z3 } from "zod";
368
+ import { z as z4 } from "zod";
268
369
  var utf8 = (value, maximum) => new TextEncoder().encode(value).length <= maximum;
269
- var scalar = z3.union([z3.string().refine((value) => utf8(value, 2048)), z3.number().finite(), z3.boolean()]);
370
+ var scalar = z4.union([z4.string().refine((value) => utf8(value, 2048)), z4.number().finite(), z4.boolean()]);
270
371
  var ExternalQueryValueSchema = scalar;
271
- var scalarOrNull = z3.union([scalar, z3.null()]);
272
- var record2 = (item, max) => z3.record(z3.string().refine(safeName), item).refine((value) => Object.keys(value).length <= max);
273
- var ExternalQueryMappingSchema = z3.union([
274
- z3.strictObject({ input: z3.string().refine(safeName), omitIfMissing: z3.literal(true).optional() }),
275
- z3.strictObject({ literal: scalar })
372
+ var scalarOrNull = z4.union([scalar, z4.null()]);
373
+ var record2 = (item, max) => z4.record(z4.string().refine(safeName), item).refine((value) => Object.keys(value).length <= max);
374
+ var ExternalQueryMappingSchema = z4.union([
375
+ z4.strictObject({ input: z4.string().refine(safeName), omitIfMissing: z4.literal(true).optional() }),
376
+ z4.strictObject({ literal: scalar })
276
377
  ]);
277
378
  var ExternalQueryMappingsSchema = record2(ExternalQueryMappingSchema, 32).superRefine((value, ctx) => {
278
379
  const reserved = /^(authorization|cookie|set-cookie|host|x-api-key|api_key|apikey|access_token|token|secret|password)$/i;
279
380
  for (const key of Object.keys(value)) if (reserved.test(key)) ctx.addIssue({ code: "custom", path: [key], message: "Reserved query key" });
280
381
  });
281
- var ExternalPathSchema = z3.string().max(1024).refine(
382
+ var ExternalPathSchema = z4.string().max(1024).refine(
282
383
  (value) => utf8(value, 1024) && /^\/(?:[A-Za-z0-9._~-]+\/)*[A-Za-z0-9._~-]*\/?$/.test(value) && !value.includes("//") && !value.includes("%") && !value.includes("\\") && !value.includes("?") && !value.includes("#") && !value.includes("{") && !value.includes("}") && value.split("/").every((segment) => segment !== "." && segment !== "..")
283
384
  );
284
- var mediaType = z3.string().min(1).max(128).refine((value) => value === value.toLowerCase() && /^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/.test(value));
385
+ var mediaType = z4.string().min(1).max(128).refine((value) => value === value.toLowerCase() && /^[a-z0-9!#$&^_.+-]+\/[a-z0-9!#$&^_.+-]+$/.test(value));
285
386
  var jsonMime = (value) => value === "application/json" || /^application\/[a-z0-9!#$&^_.+-]+\+json$/.test(value);
286
387
  var textMime = (value) => /^text\/[a-z0-9!#$&^_.+-]+$/.test(value) || value === "application/xml" || /^application\/[a-z0-9!#$&^_.+-]+\+xml$/.test(value) || jsonMime(value);
287
- var ExternalResponseFormatSchema = z3.strictObject({ mode: z3.enum(["JSON", "TEXT"]), mediaTypes: z3.array(mediaType).min(1).max(8).refine((values) => new Set(values).size === values.length) }).refine((value) => value.mediaTypes.every(value.mode === "JSON" ? jsonMime : textMime));
288
- var FieldProjectionSchema = record2(z3.strictObject({ path: z3.string().refine(safePath), omitIfMissing: z3.literal(true).optional() }), 32).refine((value) => Object.keys(value).length >= 1);
289
- var ResponseFilterSchema = z3.discriminatedUnion("op", [
290
- z3.strictObject({ path: z3.string().refine(safePath), op: z3.enum(["EQ", "NE", "GT", "GTE", "LT", "LTE", "CONTAINS", "STARTS_WITH"]), value: scalarOrNull }),
291
- z3.strictObject({ path: z3.string().refine(safePath), op: z3.literal("IN"), values: z3.array(scalarOrNull).min(1).max(20) })
388
+ var ExternalResponseFormatSchema = z4.strictObject({ mode: z4.enum(["JSON", "TEXT"]), mediaTypes: z4.array(mediaType).min(1).max(8).refine((values) => new Set(values).size === values.length) }).refine((value) => value.mediaTypes.every(value.mode === "JSON" ? jsonMime : textMime));
389
+ var FieldProjectionSchema = record2(z4.strictObject({ path: z4.string().refine(safePath), omitIfMissing: z4.literal(true).optional() }), 32).refine((value) => Object.keys(value).length >= 1);
390
+ var ResponseFilterSchema = z4.discriminatedUnion("op", [
391
+ z4.strictObject({ path: z4.string().refine(safePath), op: z4.enum(["EQ", "NE", "GT", "GTE", "LT", "LTE", "CONTAINS", "STARTS_WITH"]), value: scalarOrNull }),
392
+ z4.strictObject({ path: z4.string().refine(safePath), op: z4.literal("IN"), values: z4.array(scalarOrNull).min(1).max(20) })
292
393
  ]);
293
- var visualObject = z3.strictObject({ kind: z3.literal("OBJECT"), fields: FieldProjectionSchema });
294
- var visualList = z3.strictObject({ kind: z3.literal("LIST"), fields: FieldProjectionSchema, filters: z3.array(ResponseFilterSchema).max(8), sort: z3.union([z3.null(), z3.strictObject({ path: z3.string().refine(safePath), direction: z3.enum(["ASC", "DESC"]) })]), limit: z3.int().min(1).max(20) });
295
- var VisualResponseProcessingSchema = z3.union([visualObject, visualList]);
296
- var ResponseProcessingSchema = z3.union([VisualResponseProcessingSchema, z3.strictObject({ kind: z3.literal("JAVASCRIPT"), runtimeVersion: z3.literal("quickjs-sync.v1"), source: z3.string().min(1).refine((value) => utf8(value, 16384)) })]);
297
- var TransformResponseSchema = z3.strictObject({ status: z3.int().min(200).max(299), contentType: z3.string().min(1).max(128), bodyText: z3.string().refine((value) => utf8(value, 262144)), json: z3.union([z3.null(), z3.json()]) });
298
- var TransformSampleSchema = z3.strictObject({ status: z3.int().min(200).max(299), contentType: z3.string().min(1).max(128), bodyText: z3.string().refine((value) => utf8(value, 262144)) }).refine((value) => jsonBytes(value) <= 524288);
299
- var boundedValues = z3.custom((value) => {
394
+ var visualObject = z4.strictObject({ kind: z4.literal("OBJECT"), fields: FieldProjectionSchema });
395
+ var visualList = z4.strictObject({ kind: z4.literal("LIST"), fields: FieldProjectionSchema, filters: z4.array(ResponseFilterSchema).max(8), sort: z4.union([z4.null(), z4.strictObject({ path: z4.string().refine(safePath), direction: z4.enum(["ASC", "DESC"]) })]), limit: z4.int().min(1).max(20) });
396
+ var VisualResponseProcessingSchema = z4.union([visualObject, visualList]);
397
+ var ResponseProcessingSchema = z4.union([VisualResponseProcessingSchema, z4.strictObject({ kind: z4.literal("JAVASCRIPT"), runtimeVersion: z4.literal("quickjs-sync.v1"), source: z4.string().min(1).refine((value) => utf8(value, 16384)) })]);
398
+ var TransformResponseSchema = z4.strictObject({ status: z4.int().min(200).max(299), contentType: z4.string().min(1).max(128), bodyText: z4.string().refine((value) => utf8(value, 262144)), json: z4.union([z4.null(), z4.json()]) });
399
+ var TransformSampleSchema = z4.strictObject({ status: z4.int().min(200).max(299), contentType: z4.string().min(1).max(128), bodyText: z4.string().refine((value) => utf8(value, 262144)) }).refine((value) => jsonBytes(value) <= 524288);
400
+ var boundedValues = z4.custom((value) => {
300
401
  const visit = (node, depth) => depth <= 20 && (node === null || typeof node === "string" || typeof node === "boolean" || typeof node === "number" && Number.isFinite(node) || Array.isArray(node) && node.every((child) => visit(child, depth + 1)) || !!node && typeof node === "object" && !Array.isArray(node) && Object.getPrototypeOf(node) === Object.prototype && Object.entries(node).every(([key, child]) => !["__proto__", "prototype", "constructor"].includes(key) && visit(child, depth + 1)));
301
402
  try {
302
403
  return !!value && typeof value === "object" && !Array.isArray(value) && visit(value, 1) && jsonBytes(value) <= 49152;
@@ -304,24 +405,24 @@ var boundedValues = z3.custom((value) => {
304
405
  return false;
305
406
  }
306
407
  });
307
- var ExternalHttpResultDataSchema = z3.strictObject({ source: z3.literal("EXTERNAL_HTTP"), connectionRevisionId: IdSchema, observedAt: DateSchema, values: boundedValues });
308
- var ConnectionRevisionViewSchema = z3.strictObject({ id: IdSchema, connectionId: IdSchema, revisionNumber: z3.int().positive(), origin: z3.string().min(1).max(2048), scope: z3.enum(["PLATFORM", "PER_SHOP"]), authMode: z3.enum(["NONE", "BEARER", "API_KEY"]), authHeader: z3.string().min(1).max(128).nullable(), documentation: z3.string().max(16e3), createdAt: z3.iso.datetime({ offset: false }) });
309
- var ConnectionViewSchema = z3.strictObject({ id: IdSchema, key: z3.string().regex(/^[a-z][a-z0-9_]{0,127}$/), displayName: z3.string().min(1).max(255), description: z3.string().max(4096), enabled: z3.boolean(), editVersion: z3.int().positive(), revisions: z3.array(ConnectionRevisionViewSchema) });
310
- var CredentialStatusSchema = z3.strictObject({ connectionRevisionId: IdSchema, shopId: IdSchema.nullable(), configured: z3.boolean(), editVersion: z3.int().positive().nullable(), updatedAt: z3.iso.datetime({ offset: false }).nullable() });
311
- var ConnectionCommandSchema = z3.strictObject({ operationId: IdSchema, reason: z3.string().trim().min(1).max(1e3) });
312
- var RevisionInputSchema = z3.strictObject({ origin: z3.string().min(1).max(2048), scope: z3.enum(["PLATFORM", "PER_SHOP"]), authMode: z3.enum(["NONE", "BEARER", "API_KEY"]), authHeader: z3.string().min(1).max(128).nullable(), documentation: z3.string().max(16e3) });
313
- var ConnectionIssueSchema = z3.strictObject({ path: z3.string().max(256), message: z3.string().min(1).max(512) });
314
- var ConnectionResultSchema = (value) => z3.discriminatedUnion("kind", [
315
- z3.strictObject({ kind: z3.literal("ok"), value }),
316
- z3.strictObject({ kind: z3.literal("not-found") }),
317
- z3.strictObject({ kind: z3.literal("forbidden") }),
318
- z3.strictObject({ kind: z3.literal("unavailable") }),
319
- z3.strictObject({ kind: z3.literal("invalid"), issues: z3.array(ConnectionIssueSchema).max(32) }),
320
- z3.strictObject({ kind: z3.literal("conflict"), code: z3.enum(["STALE_CAS", "CONFLICTING_REPLAY"]) })
408
+ var ExternalHttpResultDataSchema = z4.strictObject({ source: z4.literal("EXTERNAL_HTTP"), connectionRevisionId: IdSchema, observedAt: DateSchema, values: boundedValues });
409
+ var ConnectionRevisionViewSchema = z4.strictObject({ id: IdSchema, connectionId: IdSchema, revisionNumber: z4.int().positive(), origin: z4.string().min(1).max(2048), scope: z4.enum(["PLATFORM", "PER_SHOP"]), authMode: z4.enum(["NONE", "BEARER", "API_KEY"]), authHeader: z4.string().min(1).max(128).nullable(), documentation: z4.string().max(16e3), createdAt: z4.iso.datetime({ offset: false }) });
410
+ var ConnectionViewSchema = z4.strictObject({ id: IdSchema, key: z4.string().regex(/^[a-z][a-z0-9_]{0,127}$/), displayName: z4.string().min(1).max(255), description: z4.string().max(4096), enabled: z4.boolean(), editVersion: z4.int().positive(), revisions: z4.array(ConnectionRevisionViewSchema) });
411
+ var CredentialStatusSchema = z4.strictObject({ connectionRevisionId: IdSchema, shopId: IdSchema.nullable(), configured: z4.boolean(), editVersion: z4.int().positive().nullable(), updatedAt: z4.iso.datetime({ offset: false }).nullable() });
412
+ var ConnectionCommandSchema = z4.strictObject({ operationId: IdSchema, reason: z4.string().trim().min(1).max(1e3) });
413
+ var RevisionInputSchema = z4.strictObject({ origin: z4.string().min(1).max(2048), scope: z4.enum(["PLATFORM", "PER_SHOP"]), authMode: z4.enum(["NONE", "BEARER", "API_KEY"]), authHeader: z4.string().min(1).max(128).nullable(), documentation: z4.string().max(16e3) });
414
+ var ConnectionIssueSchema = z4.strictObject({ path: z4.string().max(256), message: z4.string().min(1).max(512) });
415
+ var ConnectionResultSchema = (value) => z4.discriminatedUnion("kind", [
416
+ z4.strictObject({ kind: z4.literal("ok"), value }),
417
+ z4.strictObject({ kind: z4.literal("not-found") }),
418
+ z4.strictObject({ kind: z4.literal("forbidden") }),
419
+ z4.strictObject({ kind: z4.literal("unavailable") }),
420
+ z4.strictObject({ kind: z4.literal("invalid"), issues: z4.array(ConnectionIssueSchema).max(32) }),
421
+ z4.strictObject({ kind: z4.literal("conflict"), code: z4.enum(["STALE_CAS", "CONFLICTING_REPLAY"]) })
321
422
  ]);
322
423
 
323
424
  // src/commerce/definitions.ts
324
- import { z as z4 } from "zod";
425
+ import { z as z5 } from "zod";
325
426
  import { gt } from "semver";
326
427
 
327
428
  // src/commerce/definition-size.ts
@@ -362,19 +463,19 @@ var definitionFitsStorage = (value) => {
362
463
  var DEFINITION_SIZE_MESSAGE = "Definition exceeds the 65536-byte jsonb text limit";
363
464
 
364
465
  // src/commerce/definitions.ts
365
- var ToolNameSchema = z4.string().regex(/^[a-z][a-z0-9_]{0,127}$/).refine((n) => n !== "finalResponse");
366
- var CommerceExecutionPurposeSchema = z4.literal("INITIAL_RECOVERY_OUTREACH");
367
- var CommercePurposeProfileSchema = z4.strictObject({
466
+ var ToolNameSchema = z5.string().regex(/^[a-z][a-z0-9_]{0,127}$/).refine((n) => n !== "finalResponse");
467
+ var CommerceExecutionPurposeSchema = z5.literal("INITIAL_RECOVERY_OUTREACH");
468
+ var CommercePurposeProfileSchema = z5.strictObject({
368
469
  purpose: CommerceExecutionPurposeSchema,
369
470
  featureId: IdSchema,
370
471
  releaseId: IdSchema,
371
- behaviourPrompt: z4.string().refine((value) => new TextEncoder().encode(value).length <= 32768),
372
- capabilities: z4.array(z4.strictObject({
472
+ behaviourPrompt: z5.string().refine((value) => new TextEncoder().encode(value).length <= 32768),
473
+ capabilities: z5.array(z5.strictObject({
373
474
  capabilityId: IdSchema,
374
475
  toolId: IdSchema,
375
476
  revisionId: IdSchema,
376
477
  name: ToolNameSchema,
377
- position: z4.number().int().nonnegative(),
478
+ position: z5.number().int().nonnegative(),
378
479
  inputSchema: InputSchemaSchema,
379
480
  outputSchema: CommercePurposeOutputSchemaSchema
380
481
  })).min(1, { message: "PROFILE_EMPTY" }).max(32)
@@ -396,52 +497,52 @@ var CommercePurposeProfileSchema = z4.strictObject({
396
497
  function requireCommercePurposeProfile(raw) {
397
498
  return CommercePurposeProfileSchema.parse(raw);
398
499
  }
399
- var PublishedGrantedToolSchema = z4.strictObject({
500
+ var PublishedGrantedToolSchema = z5.strictObject({
400
501
  toolId: IdSchema,
401
502
  toolRevisionId: IdSchema,
402
503
  toolName: ToolNameSchema,
403
504
  definitionVersion: SemverSchema,
404
- capabilityKeys: z4.array(IdSchema).min(1).max(32).refine((v) => distinct(v) && v.join("\0") === [...v].sort().join("\0"))
505
+ capabilityKeys: z5.array(IdSchema).min(1).max(32).refine((v) => distinct(v) && v.join("\0") === [...v].sort().join("\0"))
405
506
  });
406
- var PublishedToolDescriptorSchema = z4.strictObject({
507
+ var PublishedToolDescriptorSchema = z5.strictObject({
407
508
  toolId: IdSchema,
408
509
  toolRevisionId: IdSchema,
409
510
  name: ToolNameSchema,
410
511
  definitionVersion: SemverSchema,
411
- description: z4.string().min(1).max(4096),
512
+ description: z5.string().min(1).max(4096),
412
513
  inputSchema: InputSchemaSchema
413
514
  });
414
- var CommerceBuiltInToolNameSchema = z4.enum([
515
+ var CommerceBuiltInToolNameSchema = z5.enum([
415
516
  "commerce_get_discount_options",
416
517
  "commerce_get_discount_details"
417
518
  ]).meta({ maxLength: 29 });
418
- var CommerceBuiltInToolGrantSchema = z4.strictObject({
419
- kind: z4.enum(["BUILT_IN"]).meta({ maxLength: 8 }),
519
+ var CommerceBuiltInToolGrantSchema = z5.strictObject({
520
+ kind: z5.enum(["BUILT_IN"]).meta({ maxLength: 8 }),
420
521
  toolName: CommerceBuiltInToolNameSchema,
421
- definitionVersion: z4.enum(["2.0.0"]).meta({ maxLength: 5 })
522
+ definitionVersion: z5.enum(["2.0.0"]).meta({ maxLength: 5 })
422
523
  });
423
- var CommerceBuiltInToolDescriptorSchema = z4.strictObject({
424
- kind: z4.enum(["BUILT_IN"]).meta({ maxLength: 8 }),
524
+ var CommerceBuiltInToolDescriptorSchema = z5.strictObject({
525
+ kind: z5.enum(["BUILT_IN"]).meta({ maxLength: 8 }),
425
526
  name: CommerceBuiltInToolNameSchema,
426
- definitionVersion: z4.enum(["2.0.0"]).meta({ maxLength: 5 }),
427
- description: z4.string().min(1).max(4096),
527
+ definitionVersion: z5.enum(["2.0.0"]).meta({ maxLength: 5 }),
528
+ description: z5.string().min(1).max(4096),
428
529
  inputSchema: InputSchemaSchema
429
530
  });
430
- var GrantedToolSchema = z4.union([PublishedGrantedToolSchema, CommerceBuiltInToolGrantSchema]);
431
- var ToolDescriptorSchema = z4.union([PublishedToolDescriptorSchema, CommerceBuiltInToolDescriptorSchema]);
432
- var GrantedToolsSchema = z4.array(GrantedToolSchema).max(32).refine((values) => {
531
+ var GrantedToolSchema = z5.union([PublishedGrantedToolSchema, CommerceBuiltInToolGrantSchema]);
532
+ var ToolDescriptorSchema = z5.union([PublishedToolDescriptorSchema, CommerceBuiltInToolDescriptorSchema]);
533
+ var GrantedToolsSchema = z5.array(GrantedToolSchema).max(32).refine((values) => {
433
534
  const published = values.filter((value) => !("kind" in value));
434
535
  return distinct(values.map((value) => value.toolName)) && distinct(published.map((value) => value.toolId));
435
536
  });
436
537
  var isBuiltInTool = (value) => "kind" in value && value.kind === "BUILT_IN";
437
- var MappingSchema = z4.union([
438
- z4.strictObject({
439
- input: z4.string().refine(safeName),
440
- omitIfMissing: z4.literal(true).optional()
538
+ var MappingSchema = z5.union([
539
+ z5.strictObject({
540
+ input: z5.string().refine(safeName),
541
+ omitIfMissing: z5.literal(true).optional()
441
542
  }),
442
- z4.strictObject({ literal: boundedJson(8192) })
543
+ z5.strictObject({ literal: boundedJson(8192) })
443
544
  ]);
444
- var MappingsSchema = z4.record(z4.string().refine(safeName), MappingSchema).refine((v) => Object.keys(v).length <= 32);
545
+ var MappingsSchema = z5.record(z5.string().refine(safeName), MappingSchema).refine((v) => Object.keys(v).length <= 32);
445
546
  var POLICY_OPERATIONS = [
446
547
  "taxonomy.resolveCategories",
447
548
  "products.search",
@@ -455,15 +556,15 @@ var POLICY_OPERATIONS = [
455
556
  "products.findQualifying",
456
557
  "products.findSimilar"
457
558
  ];
458
- var ExternalHttpExecutionSchema = z4.strictObject({
459
- kind: z4.literal("EXTERNAL_HTTP"),
460
- executorVersion: z4.literal("1.0.0"),
559
+ var ExternalHttpExecutionSchema = z5.strictObject({
560
+ kind: z5.literal("EXTERNAL_HTTP"),
561
+ executorVersion: z5.literal("1.0.0"),
461
562
  connectionRevisionId: IdSchema,
462
- method: z4.literal("GET"),
563
+ method: z5.literal("GET"),
463
564
  path: ExternalPathSchema,
464
565
  query: ExternalQueryMappingsSchema,
465
566
  responseFormat: ExternalResponseFormatSchema,
466
- resultPath: z4.string().refine((value) => value === "" || safePath(value)),
567
+ resultPath: z5.string().refine((value) => value === "" || safePath(value)),
467
568
  responseProcessing: ResponseProcessingSchema,
468
569
  resultSchema: DetailsSchemaSchema
469
570
  }).superRefine((value, ctx) => {
@@ -472,21 +573,21 @@ var ExternalHttpExecutionSchema = z4.strictObject({
472
573
  if (value.responseProcessing.kind !== "JAVASCRIPT" && value.responseFormat.mode !== "JSON")
473
574
  ctx.addIssue({ code: "custom", path: ["responseFormat", "mode"], message: "Visual processing requires JSON" });
474
575
  });
475
- var CommerceExecutionSchema = z4.discriminatedUnion("kind", [
476
- z4.strictObject({
477
- kind: z4.literal("SHOPIFY_STOREFRONT_QUERY"),
478
- executorVersion: z4.literal("1.0.0"),
479
- apiVersion: z4.literal("2026-07"),
576
+ var CommerceExecutionSchema = z5.discriminatedUnion("kind", [
577
+ z5.strictObject({
578
+ kind: z5.literal("SHOPIFY_STOREFRONT_QUERY"),
579
+ executorVersion: z5.literal("1.0.0"),
580
+ apiVersion: z5.literal("2026-07"),
480
581
  schemaHash: HashSchema,
481
- document: z4.string().min(1).refine((v) => new TextEncoder().encode(v).length <= 16384),
482
- operationName: z4.string().refine(safeName),
582
+ document: z5.string().min(1).refine((v) => new TextEncoder().encode(v).length <= 16384),
583
+ operationName: z5.string().refine(safeName),
483
584
  variables: MappingsSchema,
484
- resultPath: z4.string().refine(safePath)
585
+ resultPath: z5.string().refine(safePath)
485
586
  }),
486
- z4.strictObject({
487
- kind: z4.literal("POLICY_OPERATION"),
488
- operation: z4.enum(POLICY_OPERATIONS),
489
- operationVersion: z4.literal("1.0.0"),
587
+ z5.strictObject({
588
+ kind: z5.literal("POLICY_OPERATION"),
589
+ operation: z5.enum(POLICY_OPERATIONS),
590
+ operationVersion: z5.literal("1.0.0"),
490
591
  arguments: MappingsSchema
491
592
  }),
492
593
  ExternalHttpExecutionSchema
@@ -499,17 +600,17 @@ function tokensValid(text, root) {
499
600
  );
500
601
  return !residue.includes("{{") && !residue.includes("}}");
501
602
  }
502
- var fixed = z4.string().max(4096).refine((v) => !/[<>]|\{\{|\}\}/.test(v));
503
- var ResponseTemplateSchema = z4.discriminatedUnion("kind", [
504
- z4.strictObject({
505
- kind: z4.literal("text"),
506
- text: z4.string().max(4096).refine((v) => tokensValid(v, "result")),
603
+ var fixed = z5.string().max(4096).refine((v) => !/[<>]|\{\{|\}\}/.test(v));
604
+ var ResponseTemplateSchema = z5.discriminatedUnion("kind", [
605
+ z5.strictObject({
606
+ kind: z5.literal("text"),
607
+ text: z5.string().max(4096).refine((v) => tokensValid(v, "result")),
507
608
  unavailable: fixed
508
609
  }),
509
- z4.strictObject({
510
- kind: z4.literal("items"),
511
- itemsPath: z4.string().refine(safePath),
512
- item: z4.string().max(4096).refine((v) => tokensValid(v, "item")),
610
+ z5.strictObject({
611
+ kind: z5.literal("items"),
612
+ itemsPath: z5.string().refine(safePath),
613
+ item: z5.string().max(4096).refine((v) => tokensValid(v, "item")),
513
614
  empty: fixed,
514
615
  unavailable: fixed
515
616
  })
@@ -517,11 +618,11 @@ var ResponseTemplateSchema = z4.discriminatedUnion("kind", [
517
618
  var identity = {
518
619
  name: ToolNameSchema,
519
620
  definitionVersion: SemverSchema,
520
- description: z4.string().min(1).max(4096)
621
+ description: z5.string().min(1).max(4096)
521
622
  };
522
623
  var forbiddenInput = /^(shopid|customerid|checkoutrecoveryid|conversationid|grantid|releaseid|token|accesstoken|domain|headers|url|graphql|document|authorization)$/i;
523
624
  var forbiddenExternalInput = /^(authorization|cookie|set-cookie|host|x-api-key|api_key|apikey|access_token|token|secret|password)$/i;
524
- var CommerceToolDefinitionSchema = z4.strictObject({
625
+ var CommerceToolDefinitionSchema = z5.strictObject({
525
626
  ...identity,
526
627
  inputSchema: InputSchemaSchema,
527
628
  execution: CommerceExecutionSchema,
@@ -557,7 +658,7 @@ var CommerceToolDefinitionSchema = z4.strictObject({
557
658
  var draftObject = boundedJson(65536).refine(
558
659
  (v) => !!v && typeof v === "object" && !Array.isArray(v)
559
660
  );
560
- var CommerceToolDraftDefinitionSchema = z4.strictObject({
661
+ var CommerceToolDraftDefinitionSchema = z5.strictObject({
561
662
  ...identity,
562
663
  inputSchema: draftObject,
563
664
  execution: draftObject,
@@ -650,12 +751,12 @@ function validateDefinitionVersion(proposed, highestPublished) {
650
751
  SemverSchema.parse(highestPublished);
651
752
  return gt(proposed, highestPublished);
652
753
  }
653
- var CommerceToolIdentitySchema = z4.strictObject({
754
+ var CommerceToolIdentitySchema = z5.strictObject({
654
755
  id: IdSchema,
655
756
  name: ToolNameSchema,
656
- enabled: z4.boolean()
757
+ enabled: z5.boolean()
657
758
  });
658
- var CommerceToolRevisionIdentitySchema = z4.strictObject({
759
+ var CommerceToolRevisionIdentitySchema = z5.strictObject({
659
760
  toolId: IdSchema,
660
761
  toolRevisionId: IdSchema,
661
762
  definitionVersion: SemverSchema,
@@ -707,10 +808,10 @@ function isTrustedCommerceBuiltInGrant(value) {
707
808
  }
708
809
 
709
810
  // src/commerce/response.ts
710
- import { z as z5 } from "zod";
711
- var CommerceResponseContractSchema = z5.strictObject({
712
- version: z5.literal("response.v1"),
713
- instructions: z5.string().min(1).max(8e3),
811
+ import { z as z6 } from "zod";
812
+ var CommerceResponseContractSchema = z6.strictObject({
813
+ version: z6.literal("response.v1"),
814
+ instructions: z6.string().min(1).max(8e3),
714
815
  detailsSchema: DetailsSchemaSchema
715
816
  }).refine((v) => jsonBytes(v) <= 32768);
716
817
  var EMPTY_RESPONSE_CONTRACT = {
@@ -723,31 +824,31 @@ var EMPTY_RESPONSE_CONTRACT = {
723
824
  additionalProperties: false
724
825
  }
725
826
  };
726
- var ReferralReasonSchema = z5.enum([
827
+ var ReferralReasonSchema = z6.enum([
727
828
  "INSUFFICIENT_TOOLS",
728
829
  "UNVERIFIABLE_FACTS",
729
830
  "TOOL_UNAVAILABLE",
730
831
  "TOOL_REVOKED"
731
832
  ]);
732
- var DetectedLanguageTagSchema = z5.string().min(1).max(128).transform((value, ctx) => {
833
+ var DetectedLanguageTagSchema = z6.string().min(1).max(128).transform((value, ctx) => {
733
834
  const canonical = canonicaliseLanguageTag(value);
734
835
  if (!canonical) {
735
836
  ctx.addIssue({
736
837
  code: "custom",
737
838
  message: "Invalid detected language tag"
738
839
  });
739
- return z5.NEVER;
840
+ return z6.NEVER;
740
841
  }
741
842
  return canonical;
742
843
  });
743
- var CommerceFinalResponseSchema = z5.strictObject({
744
- answerKind: z5.enum(["ANSWER", "REFER_TO_STORE"]),
745
- replyText: z5.string().min(1).max(4096),
844
+ var CommerceFinalResponseSchema = z6.strictObject({
845
+ answerKind: z6.enum(["ANSWER", "REFER_TO_STORE"]),
846
+ replyText: z6.string().min(1).max(4096),
746
847
  referralReason: ReferralReasonSchema.nullable(),
747
848
  detectedLanguageTag: DetectedLanguageTagSchema.nullable(),
748
- detectedLanguageConfidence: z5.number().min(0).max(1).nullable(),
749
- evidenceIds: z5.array(IdSchema).max(3).refine((v) => new Set(v).size === v.length),
750
- details: z5.record(z5.string(), z5.unknown()).refine((v) => {
849
+ detectedLanguageConfidence: z6.number().min(0).max(1).nullable(),
850
+ evidenceIds: z6.array(IdSchema).max(3).refine((v) => new Set(v).size === v.length),
851
+ details: z6.record(z6.string(), z6.unknown()).refine((v) => {
751
852
  try {
752
853
  return jsonBytes(v) <= 16384;
753
854
  } catch {
@@ -883,22 +984,22 @@ function finalResponseToolSchema(definition) {
883
984
  }
884
985
 
885
986
  // src/commerce/schemas.ts
886
- import { z as z6 } from "zod";
987
+ import { z as z7 } from "zod";
887
988
  import { validRange } from "semver";
888
- var CommerceTurnIdentitySchema = z6.strictObject({
989
+ var CommerceTurnIdentitySchema = z7.strictObject({
889
990
  contractVersion: ContractVersionSchema,
890
991
  shopId: IdSchema,
891
992
  checkoutRecoveryId: IdSchema,
892
993
  conversationId: IdSchema,
893
- inboundVersion: z6.number().int().positive()
994
+ inboundVersion: z7.number().int().positive()
894
995
  });
895
- var CommerceConversationGrantSchema = z6.strictObject({
996
+ var CommerceConversationGrantSchema = z7.strictObject({
896
997
  id: IdSchema,
897
998
  shopId: IdSchema,
898
999
  conversationId: IdSchema,
899
- initialInboundVersion: z6.number().int().positive(),
1000
+ initialInboundVersion: z7.number().int().positive(),
900
1001
  releaseId: IdSchema,
901
- selectedCapabilityKeys: z6.array(IdSchema).max(32).refine(distinct),
1002
+ selectedCapabilityKeys: z7.array(IdSchema).max(32).refine(distinct),
902
1003
  purposeProfile: CommercePurposeProfileSchema.optional(),
903
1004
  grantedTools: GrantedToolsSchema,
904
1005
  runnerVersion: SemverSchema,
@@ -914,27 +1015,27 @@ var CommerceConversationGrantSchema = z6.strictObject({
914
1015
  ))
915
1016
  c.addIssue({ code: "custom", message: "Unselected grant provenance" });
916
1017
  });
917
- var CommerceManifestSchema = z6.strictObject({
1018
+ var CommerceManifestSchema = z7.strictObject({
918
1019
  contractVersion: ContractVersionSchema,
919
1020
  releaseId: IdSchema,
920
- runnerCompatibility: z6.string().min(1).max(128).refine((v) => !!validRange(v)),
921
- capabilities: z6.array(
922
- z6.strictObject({
1021
+ runnerCompatibility: z7.string().min(1).max(128).refine((v) => !!validRange(v)),
1022
+ capabilities: z7.array(
1023
+ z7.strictObject({
923
1024
  capabilityId: IdSchema,
924
1025
  key: IdSchema,
925
1026
  featureId: IdSchema,
926
- position: z6.number().int().nonnegative(),
1027
+ position: z7.number().int().nonnegative(),
927
1028
  toolDescriptor: PublishedToolDescriptorSchema
928
1029
  })
929
1030
  ).max(32),
930
- featureBehaviours: z6.array(
931
- z6.strictObject({
1031
+ featureBehaviours: z7.array(
1032
+ z7.strictObject({
932
1033
  featureId: IdSchema,
933
- behaviourPrompt: z6.string().max(32e3)
1034
+ behaviourPrompt: z7.string().max(32e3)
934
1035
  })
935
1036
  ).max(32),
936
- selectedCapabilityKeys: z6.array(IdSchema).max(32).refine(distinct),
937
- builtInTools: z6.array(CommerceBuiltInToolDescriptorSchema).max(2).default([]),
1037
+ selectedCapabilityKeys: z7.array(IdSchema).max(32).refine(distinct),
1038
+ builtInTools: z7.array(CommerceBuiltInToolDescriptorSchema).max(2).default([]),
938
1039
  purposeProfile: CommercePurposeProfileSchema.optional(),
939
1040
  grantedTools: GrantedToolsSchema,
940
1041
  responseContract: CommerceResponseContractSchema,
@@ -989,32 +1090,32 @@ var CommerceManifestSchema = z6.strictObject({
989
1090
  message: "Grant must equal selected capability set"
990
1091
  });
991
1092
  });
992
- var CommerceReleaseIdentitySchema = z6.strictObject({
1093
+ var CommerceReleaseIdentitySchema = z7.strictObject({
993
1094
  contractVersion: ContractVersionSchema,
994
1095
  releaseId: IdSchema,
995
- runnerCompatibility: z6.string().min(1).max(128).refine((v) => !!validRange(v))
1096
+ runnerCompatibility: z7.string().min(1).max(128).refine((v) => !!validRange(v))
996
1097
  });
997
1098
  var CommerceResolveAssertionSchema = CommerceTurnIdentitySchema.extend(
998
- { purpose: z6.literal("resolve") }
1099
+ { purpose: z7.literal("resolve") }
999
1100
  );
1000
1101
  var CommerceExecuteAssertionSchema = CommerceTurnIdentitySchema.extend(
1001
- { purpose: z6.literal("execute"), grantId: IdSchema, releaseId: IdSchema }
1102
+ { purpose: z7.literal("execute"), grantId: IdSchema, releaseId: IdSchema }
1002
1103
  );
1003
- var CommerceAssertionSchema = z6.discriminatedUnion("purpose", [
1104
+ var CommerceAssertionSchema = z7.discriminatedUnion("purpose", [
1004
1105
  CommerceResolveAssertionSchema,
1005
1106
  CommerceExecuteAssertionSchema
1006
1107
  ]);
1007
- var qty = z6.number().int().min(1).max(999);
1008
- var CommerceProposalSchema = z6.strictObject({
1009
- operations: z6.array(
1010
- z6.discriminatedUnion("kind", [
1011
- z6.strictObject({
1012
- kind: z6.literal("ADD"),
1108
+ var qty = z7.number().int().min(1).max(999);
1109
+ var CommerceProposalSchema = z7.strictObject({
1110
+ operations: z7.array(
1111
+ z7.discriminatedUnion("kind", [
1112
+ z7.strictObject({
1113
+ kind: z7.literal("ADD"),
1013
1114
  variantId: IdSchema,
1014
1115
  quantity: qty
1015
1116
  }),
1016
- z6.strictObject({
1017
- kind: z6.literal("REPLACE"),
1117
+ z7.strictObject({
1118
+ kind: z7.literal("REPLACE"),
1018
1119
  lineId: IdSchema,
1019
1120
  variantId: IdSchema,
1020
1121
  quantity: qty
@@ -1026,13 +1127,13 @@ var CommerceProposalSchema = z6.strictObject({
1026
1127
  v.operations.flatMap((o) => o.kind === "REPLACE" ? [o.lineId] : [])
1027
1128
  )
1028
1129
  );
1029
- var CommerceBasketSchema = z6.strictObject({
1130
+ var CommerceBasketSchema = z7.strictObject({
1030
1131
  basketId: IdSchema,
1031
- source: z6.enum(["RECOVERY_SNAPSHOT", "PROPOSED"]),
1132
+ source: z7.enum(["RECOVERY_SNAPSHOT", "PROPOSED"]),
1032
1133
  observedAt: DateSchema,
1033
1134
  currency: CurrencySchema.nullable(),
1034
- lines: z6.array(
1035
- z6.strictObject({
1135
+ lines: z7.array(
1136
+ z7.strictObject({
1036
1137
  lineId: IdSchema,
1037
1138
  productId: IdSchema.nullable(),
1038
1139
  variantId: IdSchema.nullable(),
@@ -1041,35 +1142,91 @@ var CommerceBasketSchema = z6.strictObject({
1041
1142
  })
1042
1143
  ).max(100),
1043
1144
  fingerprint: HashSchema,
1044
- unknownFields: z6.array(z6.string().min(1).max(256)).max(128)
1145
+ unknownFields: z7.array(z7.string().min(1).max(256)).max(128)
1045
1146
  }).refine((v) => distinct(v.lines.map((line) => line.lineId)));
1046
- var CommerceProductSaleEvidenceSchema = z6.strictObject({
1147
+ var CommerceProductSaleEvidenceSchema = z7.strictObject({
1047
1148
  regularPrice: MoneySchema.nullable(),
1048
1149
  salePrice: MoneySchema.nullable(),
1049
1150
  observedAt: DateSchema
1050
1151
  });
1051
- var CommerceProductSchema = z6.strictObject({
1152
+ var optionLabel = z7.string().transform((value) => value.replace(/[\r\n\t]+/g, " ").trim()).pipe(z7.string().min(1).max(128).refine((value) => !/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/.test(value)));
1153
+ function normalizeCommerceProductOptions(raw) {
1154
+ if (raw === void 0 || raw === null) return { status: "NOT_PROVIDED", items: [] };
1155
+ const source = raw;
1156
+ if (!Array.isArray(source.items)) return { status: "PARTIAL", items: [] };
1157
+ let partial = !["AVAILABLE", "NOT_PROVIDED"].includes(String(source.status)) || source.items.length > 16 || source.status === "NOT_PROVIDED" && source.items.length > 0;
1158
+ const items = [];
1159
+ const names = /* @__PURE__ */ new Set();
1160
+ for (const value of source.items.slice(0, 16)) {
1161
+ if (!value || typeof value !== "object") {
1162
+ partial = true;
1163
+ continue;
1164
+ }
1165
+ const item = value;
1166
+ const name = optionLabel.safeParse(item.name);
1167
+ if (!name.success || !Array.isArray(item.values)) {
1168
+ partial = true;
1169
+ continue;
1170
+ }
1171
+ if (names.has(name.data)) continue;
1172
+ names.add(name.data);
1173
+ const values = [];
1174
+ if (item.values.length > 64) partial = true;
1175
+ for (const rawValue of item.values.slice(0, 64)) {
1176
+ const parsed = optionLabel.safeParse(rawValue);
1177
+ if (!parsed.success) {
1178
+ if (!(typeof rawValue === "string" && rawValue.trim() === "")) partial = true;
1179
+ continue;
1180
+ }
1181
+ if (!values.includes(parsed.data)) values.push(parsed.data);
1182
+ }
1183
+ if (item.usedForVariants !== null && typeof item.usedForVariants !== "boolean") partial = true;
1184
+ items.push({ name: name.data, values, usedForVariants: typeof item.usedForVariants === "boolean" ? item.usedForVariants : null });
1185
+ }
1186
+ return { status: partial ? "PARTIAL" : items.length ? "AVAILABLE" : "NOT_PROVIDED", items };
1187
+ }
1188
+ var CommerceProductOptionsSchema = z7.preprocess(normalizeCommerceProductOptions, z7.strictObject({
1189
+ status: z7.enum(["AVAILABLE", "NOT_PROVIDED", "PARTIAL"]),
1190
+ items: z7.array(z7.strictObject({ name: optionLabel, values: z7.array(optionLabel).max(64), usedForVariants: z7.boolean().nullable() })).max(16)
1191
+ }));
1192
+ function normalizeCommerceProductSelectedOptions(raw) {
1193
+ if (!Array.isArray(raw)) return [];
1194
+ const result = [];
1195
+ for (const entry of raw.slice(0, 16)) {
1196
+ if (!entry || typeof entry !== "object") continue;
1197
+ const item = entry;
1198
+ const name = optionLabel.safeParse(item.name), value = optionLabel.safeParse(item.value);
1199
+ if (name.success && value.success && !result.some((e) => e.name === name.data && e.value === value.data)) result.push({ name: name.data, value: value.data });
1200
+ }
1201
+ return result;
1202
+ }
1203
+ var CommerceProductSelectedOptionsSchema = z7.preprocess(normalizeCommerceProductSelectedOptions, z7.array(z7.strictObject({ name: optionLabel, value: optionLabel })).max(16));
1204
+ var CommerceProductSchema = z7.strictObject({
1205
+ description: z7.preprocess(normalizeCommerceProductDescriptionField, CommerceProductDescriptionSchema).optional(),
1206
+ attributes: z7.preprocess(normalizeCommerceProductAttributes, CommerceProductAttributesSchema).optional(),
1207
+ options: CommerceProductOptionsSchema.optional(),
1208
+ selectedOptions: CommerceProductSelectedOptionsSchema.optional(),
1052
1209
  productId: IdSchema,
1053
1210
  variantId: IdSchema.nullable(),
1054
- title: z6.string().min(1).max(512),
1055
- url: z6.url({ protocol: /^https$/ }).refine((v) => {
1211
+ title: z7.string().min(1).max(512),
1212
+ url: z7.url({ protocol: /^https$/ }).refine((v) => {
1056
1213
  const u = new URL(v);
1057
1214
  return !u.username && !u.password && !u.port;
1058
1215
  }).nullable(),
1059
- available: z6.boolean().nullable(),
1216
+ available: z7.boolean().nullable(),
1060
1217
  unitPrice: MoneySchema.nullable(),
1061
1218
  currency: CurrencySchema.nullable(),
1062
- productType: z6.string().max(512).nullable(),
1063
- vendor: z6.string().max(512).nullable(),
1064
- categories: z6.array(z6.string()).optional(),
1065
- categoryIds: z6.array(IdSchema).max(128).optional(),
1066
- collectionIds: z6.array(IdSchema).max(128).optional(),
1067
- imageUrl: z6.string().nullable().optional(),
1219
+ productType: z7.string().max(512).nullable(),
1220
+ vendor: z7.string().max(512).nullable(),
1221
+ categories: z7.array(z7.string()).optional(),
1222
+ categoryIds: z7.array(IdSchema).max(128).optional(),
1223
+ collectionIds: z7.array(IdSchema).max(128).optional(),
1224
+ imageUrl: z7.string().nullable().optional(),
1068
1225
  saleEvidence: CommerceProductSaleEvidenceSchema.nullable().optional(),
1069
1226
  observedAt: DateSchema
1070
1227
  });
1071
1228
  var discountUtcPattern = /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\.[0-9]+)?Z(?![\s\S])/;
1072
- var CommerceDiscountDateTimeSchema = z6.string().regex(discountUtcPattern).refine((value) => {
1229
+ var CommerceDiscountDateTimeSchema = z7.string().regex(discountUtcPattern).refine((value) => {
1073
1230
  const match = discountUtcPattern.exec(value);
1074
1231
  if (!match) return false;
1075
1232
  const [year, month, day, hour, minute, second] = match.slice(1).map(Number);
@@ -1078,36 +1235,36 @@ var CommerceDiscountDateTimeSchema = z6.string().regex(discountUtcPattern).refin
1078
1235
  const daysInMonth = [31, leapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
1079
1236
  return day >= 1 && day <= daysInMonth[month - 1];
1080
1237
  }, "Expected a valid UTC discount timestamp with seconds");
1081
- var CommerceOfferSchema = z6.strictObject({
1238
+ var CommerceOfferSchema = z7.strictObject({
1082
1239
  offerId: IdSchema,
1083
- title: z6.string().min(1).max(512),
1084
- method: z6.enum(["AUTOMATIC", "CODE"]),
1085
- code: z6.string().min(1).max(128).nullable(),
1240
+ title: z7.string().min(1).max(512),
1241
+ method: z7.enum(["AUTOMATIC", "CODE"]),
1242
+ code: z7.string().min(1).max(128).nullable(),
1086
1243
  startsAt: CommerceDiscountDateTimeSchema.nullable(),
1087
1244
  endsAt: CommerceDiscountDateTimeSchema.nullable(),
1088
- support: z6.enum(["SUPPORTED", "UNSUPPORTED", "UNKNOWN"]),
1089
- reasonCodes: z6.array(z6.string().min(1).max(64)).max(16)
1245
+ support: z7.enum(["SUPPORTED", "UNSUPPORTED", "UNKNOWN"]),
1246
+ reasonCodes: z7.array(z7.string().min(1).max(64)).max(16)
1090
1247
  }).refine(
1091
1248
  (v) => (v.startsAt === null || v.endsAt === null || Date.parse(v.startsAt) < Date.parse(v.endsAt)) && (v.method !== "AUTOMATIC" || v.code === null)
1092
1249
  );
1093
- var CommerceDiscountCombinationFactsSchema = z6.strictObject({
1094
- discountClasses: z6.array(z6.enum(["ORDER", "PRODUCT", "SHIPPING"])).max(3).nullable(),
1095
- shopifyPlus: z6.boolean().nullable(),
1096
- combinesWith: z6.strictObject({
1097
- orderDiscounts: z6.boolean().nullable(),
1098
- productDiscounts: z6.boolean().nullable(),
1099
- shippingDiscounts: z6.boolean().nullable()
1250
+ var CommerceDiscountCombinationFactsSchema = z7.strictObject({
1251
+ discountClasses: z7.array(z7.enum(["ORDER", "PRODUCT", "SHIPPING"])).max(3).nullable(),
1252
+ shopifyPlus: z7.boolean().nullable(),
1253
+ combinesWith: z7.strictObject({
1254
+ orderDiscounts: z7.boolean().nullable(),
1255
+ productDiscounts: z7.boolean().nullable(),
1256
+ shippingDiscounts: z7.boolean().nullable()
1100
1257
  }).nullable(),
1101
- discountTags: z6.array(z6.string().min(1).max(128)).max(64).nullable(),
1102
- allowedSameLineProductTags: z6.array(z6.string().min(1).max(128)).max(64).nullable()
1258
+ discountTags: z7.array(z7.string().min(1).max(128)).max(64).nullable(),
1259
+ allowedSameLineProductTags: z7.array(z7.string().min(1).max(128)).max(64).nullable()
1103
1260
  });
1104
- var CommerceDiscountConditionFactsSchema = z6.strictObject({
1105
- provider: z6.enum(["SHOPIFY", "WOOCOMMERCE"]),
1106
- completeness: z6.enum(["COMPLETE", "PARTIAL", "UNKNOWN"]),
1261
+ var CommerceDiscountConditionFactsSchema = z7.strictObject({
1262
+ provider: z7.enum(["SHOPIFY", "WOOCOMMERCE"]),
1263
+ completeness: z7.enum(["COMPLETE", "PARTIAL", "UNKNOWN"]),
1107
1264
  observedAt: CommerceDiscountDateTimeSchema,
1108
- providerStatus: z6.string().max(64),
1265
+ providerStatus: z7.string().max(64),
1109
1266
  unavailableAt: CommerceDiscountDateTimeSchema.nullable(),
1110
- discountKind: z6.enum([
1267
+ discountKind: z7.enum([
1111
1268
  "PERCENTAGE",
1112
1269
  "FIXED_AMOUNT",
1113
1270
  "FREE_SHIPPING",
@@ -1117,8 +1274,8 @@ var CommerceDiscountConditionFactsSchema = z6.strictObject({
1117
1274
  ]),
1118
1275
  discountValue: MoneySchema.nullable(),
1119
1276
  discountCurrency: CurrencySchema.nullable(),
1120
- targeting: z6.strictObject({
1121
- kind: z6.enum([
1277
+ targeting: z7.strictObject({
1278
+ kind: z7.enum([
1122
1279
  "ALL",
1123
1280
  "PRODUCTS",
1124
1281
  "VARIANTS",
@@ -1127,38 +1284,38 @@ var CommerceDiscountConditionFactsSchema = z6.strictObject({
1127
1284
  "MIXED",
1128
1285
  "UNKNOWN"
1129
1286
  ]),
1130
- includedProductIds: z6.array(IdSchema).max(128),
1131
- includedVariantIds: z6.array(IdSchema).max(128),
1132
- includedCategoryIds: z6.array(IdSchema).max(128),
1133
- includedCollectionIds: z6.array(IdSchema).max(128),
1134
- excludedProductIds: z6.array(IdSchema).max(128),
1135
- excludedVariantIds: z6.array(IdSchema).max(128),
1136
- excludedCategoryIds: z6.array(IdSchema).max(128),
1137
- excludedCollectionIds: z6.array(IdSchema).max(128)
1287
+ includedProductIds: z7.array(IdSchema).max(128),
1288
+ includedVariantIds: z7.array(IdSchema).max(128),
1289
+ includedCategoryIds: z7.array(IdSchema).max(128),
1290
+ includedCollectionIds: z7.array(IdSchema).max(128),
1291
+ excludedProductIds: z7.array(IdSchema).max(128),
1292
+ excludedVariantIds: z7.array(IdSchema).max(128),
1293
+ excludedCategoryIds: z7.array(IdSchema).max(128),
1294
+ excludedCollectionIds: z7.array(IdSchema).max(128)
1138
1295
  }),
1139
1296
  minimumSubtotal: MoneySchema.nullable(),
1140
1297
  maximumSubtotal: MoneySchema.nullable(),
1141
1298
  subtotalRequirementCurrency: CurrencySchema.nullable(),
1142
- minimumQuantity: z6.number().int().nonnegative().nullable(),
1143
- usageLimit: z6.number().int().nonnegative().nullable(),
1144
- usageCount: z6.number().int().nonnegative().nullable(),
1145
- perCustomerLimit: z6.number().int().nonnegative().nullable(),
1146
- customerScope: z6.enum(["ALL", "RESTRICTED", "UNKNOWN"]),
1147
- excludesSaleItems: z6.boolean().nullable(),
1148
- individualUse: z6.boolean().nullable(),
1299
+ minimumQuantity: z7.number().int().nonnegative().nullable(),
1300
+ usageLimit: z7.number().int().nonnegative().nullable(),
1301
+ usageCount: z7.number().int().nonnegative().nullable(),
1302
+ perCustomerLimit: z7.number().int().nonnegative().nullable(),
1303
+ customerScope: z7.enum(["ALL", "RESTRICTED", "UNKNOWN"]),
1304
+ excludesSaleItems: z7.boolean().nullable(),
1305
+ individualUse: z7.boolean().nullable(),
1149
1306
  combination: CommerceDiscountCombinationFactsSchema,
1150
- unrepresentedConditions: z6.array(z6.string().min(1).max(128)).max(24)
1307
+ unrepresentedConditions: z7.array(z7.string().min(1).max(128)).max(24)
1151
1308
  });
1152
- var CommerceDiscountDetailsSchema = z6.strictObject({
1309
+ var CommerceDiscountDetailsSchema = z7.strictObject({
1153
1310
  offer: CommerceOfferSchema,
1154
1311
  facts: CommerceDiscountConditionFactsSchema,
1155
- providerDiscountId: z6.string().min(1).max(191).nullable()
1312
+ providerDiscountId: z7.string().min(1).max(191).nullable()
1156
1313
  });
1157
- var condition = z6.strictObject({
1158
- code: z6.string().min(1).max(64),
1159
- description: z6.string().max(256)
1314
+ var condition = z7.strictObject({
1315
+ code: z7.string().min(1).max(64),
1316
+ description: z7.string().max(256)
1160
1317
  });
1161
- var CommerceEvidenceSchema = z6.strictObject({
1318
+ var CommerceEvidenceSchema = z7.strictObject({
1162
1319
  evidenceId: HashSchema,
1163
1320
  turn: CommerceTurnIdentitySchema,
1164
1321
  grantId: IdSchema,
@@ -1169,7 +1326,7 @@ var CommerceEvidenceSchema = z6.strictObject({
1169
1326
  ruleFingerprint: HashSchema,
1170
1327
  evaluatedAt: DateSchema,
1171
1328
  expiresAt: DateSchema,
1172
- outcome: z6.enum([
1329
+ outcome: z7.enum([
1173
1330
  "QUALIFIES_FOR_KNOWN_RULES",
1174
1331
  "DOES_NOT_QUALIFY",
1175
1332
  "UNKNOWN",
@@ -1178,8 +1335,8 @@ var CommerceEvidenceSchema = z6.strictObject({
1178
1335
  currency: CurrencySchema.nullable(),
1179
1336
  savings: MoneySchema.nullable(),
1180
1337
  resultingTotal: MoneySchema.nullable(),
1181
- evaluatedConditions: z6.array(condition).max(32),
1182
- unresolvedConditions: z6.array(condition).max(32)
1338
+ evaluatedConditions: z7.array(condition).max(32),
1339
+ unresolvedConditions: z7.array(condition).max(32)
1183
1340
  }).superRefine((v, c) => {
1184
1341
  if (Date.parse(v.expiresAt) - Date.parse(v.evaluatedAt) > 6e4)
1185
1342
  c.addIssue({
@@ -1189,16 +1346,16 @@ var CommerceEvidenceSchema = z6.strictObject({
1189
1346
  if (v.outcome === "QUALIFIES_FOR_KNOWN_RULES" && (v.unresolvedConditions.length || Date.parse(v.expiresAt) <= Date.parse(v.evaluatedAt) || v.currency === null || v.savings === null || v.resultingTotal === null))
1190
1347
  c.addIssue({ code: "custom", message: "Unsupported qualifying claim" });
1191
1348
  });
1192
- var CommerceAlternativeSchema = z6.strictObject({
1349
+ var CommerceAlternativeSchema = z7.strictObject({
1193
1350
  product: CommerceProductSchema,
1194
1351
  proposal: CommerceProposalSchema,
1195
1352
  extraSpend: MoneySchema.nullable(),
1196
1353
  resultingTotal: MoneySchema.nullable(),
1197
1354
  currency: CurrencySchema.nullable(),
1198
1355
  evidence: CommerceEvidenceSchema.nullable(),
1199
- similarityReasons: z6.array(z6.string().max(256)).max(3)
1356
+ similarityReasons: z7.array(z7.string().max(256)).max(3)
1200
1357
  }).refine((v) => v.product.available === true);
1201
- var CommerceErrorCodeSchema = z6.enum([
1358
+ var CommerceErrorCodeSchema = z7.enum([
1202
1359
  "INVALID_INPUT",
1203
1360
  "DENIED",
1204
1361
  "STALE_TURN",
@@ -1209,182 +1366,184 @@ var CommerceErrorCodeSchema = z6.enum([
1209
1366
  "INCOMPATIBLE_VERSION"
1210
1367
  ]);
1211
1368
  function commerceToolResultSchema(data) {
1212
- return z6.union([
1213
- z6.strictObject({
1369
+ return z7.union([
1370
+ z7.strictObject({
1214
1371
  contractVersion: ContractVersionSchema,
1215
- status: z6.literal("OK"),
1372
+ status: z7.literal("OK"),
1216
1373
  data,
1217
- renderedText: z6.string().max(4096)
1374
+ renderedText: z7.string().max(4096)
1218
1375
  }),
1219
- z6.strictObject({
1376
+ z7.strictObject({
1220
1377
  contractVersion: ContractVersionSchema,
1221
- status: z6.literal("ERROR"),
1378
+ status: z7.literal("ERROR"),
1222
1379
  code: CommerceErrorCodeSchema,
1223
- retryable: z6.boolean(),
1224
- renderedText: z6.string().max(4096).optional()
1380
+ retryable: z7.boolean(),
1381
+ renderedText: z7.string().max(4096).optional()
1225
1382
  })
1226
1383
  ]);
1227
1384
  }
1228
1385
  var CommerceToolResultSchema = commerceToolResultSchema(
1229
1386
  boundedJson(262144)
1230
1387
  );
1231
- var wireId = z6.string().min(1).max(128);
1232
- var taxonomySource = z6.enum(["SHOPIFY_STANDARD_PRODUCT_TAXONOMY"]).meta({ maxLength: 33 });
1233
- var CommerceCategoryCandidateSchema = z6.strictObject({
1388
+ var wireId = z7.string().min(1).max(128);
1389
+ var taxonomySource = z7.enum(["SHOPIFY_STANDARD_PRODUCT_TAXONOMY"]).meta({ maxLength: 33 });
1390
+ var CommerceCategoryCandidateSchema = z7.strictObject({
1234
1391
  categoryId: wireId,
1235
- name: z6.string().min(1).max(512),
1236
- fullName: z6.string().min(1).max(4096),
1392
+ name: z7.string().min(1).max(512),
1393
+ fullName: z7.string().min(1).max(4096),
1237
1394
  parentId: wireId.nullable(),
1238
- level: z6.number().int().min(0).max(32),
1239
- ancestorIds: z6.array(wireId).max(32),
1240
- distance: z6.number().min(0).max(2)
1395
+ level: z7.number().int().min(0).max(32),
1396
+ ancestorIds: z7.array(wireId).max(32),
1397
+ distance: z7.number().min(0).max(2)
1241
1398
  });
1242
- var CommerceCategoryResolutionSchema = z6.union([
1243
- z6.strictObject({
1244
- outcome: z6.enum(["CANDIDATES", "NO_CANDIDATES"]).meta({ maxLength: 13 }),
1399
+ var CommerceCategoryResolutionSchema = z7.union([
1400
+ z7.strictObject({
1401
+ outcome: z7.enum(["CANDIDATES", "NO_CANDIDATES"]).meta({ maxLength: 13 }),
1245
1402
  generationId: wireId,
1246
1403
  source: taxonomySource,
1247
- taxonomyVersion: z6.string().min(1).max(64),
1248
- languageTag: z6.string().min(1).max(35),
1249
- candidates: z6.array(CommerceCategoryCandidateSchema).max(10)
1404
+ taxonomyVersion: z7.string().min(1).max(64),
1405
+ languageTag: z7.string().min(1).max(35),
1406
+ candidates: z7.array(CommerceCategoryCandidateSchema).max(10)
1250
1407
  }),
1251
- z6.strictObject({
1252
- outcome: z6.enum(["UNAVAILABLE"]).meta({ maxLength: 11 }),
1253
- reasonCode: z6.enum(["NOT_READY", "TEMPORARY_UNAVAILABLE"]).meta({ maxLength: 21 })
1408
+ z7.strictObject({
1409
+ outcome: z7.enum(["UNAVAILABLE"]).meta({ maxLength: 11 }),
1410
+ reasonCode: z7.enum(["NOT_READY", "TEMPORARY_UNAVAILABLE"]).meta({ maxLength: 21 })
1254
1411
  })
1255
1412
  ]);
1256
- var CommerceOptionalLookupUnavailableSchema = z6.strictObject({
1257
- outcome: z6.enum(["UNAVAILABLE"]).meta({ maxLength: 11 }),
1258
- reasonCode: z6.enum(["TEMPORARY_UNAVAILABLE"]).meta({ maxLength: 21 })
1413
+ var CommerceOptionalLookupUnavailableSchema = z7.strictObject({
1414
+ outcome: z7.enum(["UNAVAILABLE"]).meta({ maxLength: 11 }),
1415
+ reasonCode: z7.enum(["TEMPORARY_UNAVAILABLE"]).meta({ maxLength: 21 })
1259
1416
  });
1260
- var CommerceProductRecommendationSelectionSchema = z6.strictObject({
1261
- productRecommendationVersion: z6.enum(["1"]).meta({ maxLength: 1 }).optional(),
1262
- productRecommendations: z6.array(z6.strictObject({
1263
- scope: z6.enum(["PRODUCT_ONLY", "ADD_TO_BASKET", "REPLACE_BASKET_LINE"]).meta({ maxLength: 19 }),
1417
+ var CommerceProductRecommendationSelectionSchema = z7.strictObject({
1418
+ productRecommendationVersion: z7.enum(["1"]).meta({ maxLength: 1 }).optional(),
1419
+ productRecommendations: z7.array(z7.strictObject({
1420
+ scope: z7.enum(["PRODUCT_ONLY", "ADD_TO_BASKET", "REPLACE_BASKET_LINE"]).meta({ maxLength: 19 }),
1264
1421
  basketLineId: wireId.nullable(),
1265
1422
  productId: wireId,
1266
1423
  variantId: wireId.nullable(),
1267
- quantity: z6.number().int().min(1).max(99),
1268
- promotionKind: z6.enum(["NONE", "NATIVE_SALE", "DISCOUNT"]).meta({ maxLength: 11 }),
1269
- offerIds: z6.array(wireId).max(3)
1424
+ quantity: z7.number().int().min(1).max(99),
1425
+ promotionKind: z7.enum(["NONE", "NATIVE_SALE", "DISCOUNT"]).meta({ maxLength: 11 }),
1426
+ offerIds: z7.array(wireId).max(3)
1270
1427
  })).min(1).max(3).optional()
1271
1428
  });
1272
- var CommerceResponseDispositionSchema = z6.enum([
1429
+ var CommerceResponseDispositionSchema = z7.enum([
1273
1430
  "STANDARD",
1274
1431
  "OUT_OF_SCOPE_REDIRECT",
1275
- "SHIPPING_INFORMATION_UNVERIFIED"
1432
+ "SHIPPING_INFORMATION_UNVERIFIED",
1433
+ "PRODUCT_OPTIONS"
1276
1434
  ]).meta({ maxLength: 31 });
1277
- var CommerceAnswerPresentationSelectionSchema = z6.strictObject({
1435
+ var CommerceAnswerPresentationSelectionSchema = z7.strictObject({
1436
+ productOptionSelections: z7.array(z7.strictObject({ productId: wireId, variantId: wireId.nullable() })).max(3).optional(),
1278
1437
  responseDisposition: CommerceResponseDispositionSchema.optional(),
1279
- shippingInformationSelection: z6.strictObject({
1438
+ shippingInformationSelection: z7.strictObject({
1280
1439
  productId: wireId.nullable(),
1281
1440
  variantId: wireId.nullable()
1282
1441
  }).optional()
1283
1442
  });
1284
- var CommerceShippingInformationInputSchema = z6.strictObject({
1443
+ var CommerceShippingInformationInputSchema = z7.strictObject({
1285
1444
  productId: wireId.nullable().default(null),
1286
1445
  variantId: wireId.nullable().default(null)
1287
1446
  });
1288
- var CommerceShippingInformationSchema = z6.strictObject({
1289
- provider: z6.enum(["SHOPIFY", "WOOCOMMERCE"]).meta({ maxLength: 11 }),
1447
+ var CommerceShippingInformationSchema = z7.strictObject({
1448
+ provider: z7.enum(["SHOPIFY", "WOOCOMMERCE"]).meta({ maxLength: 11 }),
1290
1449
  observedAt: DateSchema,
1291
- product: z6.strictObject({
1292
- status: z6.enum(["NOT_REQUESTED", "VARIANT_REQUIRED", "AVAILABLE"]).meta({ maxLength: 16 }),
1450
+ product: z7.strictObject({
1451
+ status: z7.enum(["NOT_REQUESTED", "VARIANT_REQUIRED", "AVAILABLE"]).meta({ maxLength: 16 }),
1293
1452
  productId: wireId.nullable(),
1294
1453
  variantId: wireId.nullable(),
1295
- requiresShipping: z6.boolean().nullable(),
1296
- virtual: z6.boolean().nullable(),
1297
- weight: z6.strictObject({
1298
- value: z6.number().min(0),
1299
- unit: z6.enum(["GRAMS", "KILOGRAMS", "OUNCES", "POUNDS"]).meta({ maxLength: 9 }).nullable()
1454
+ requiresShipping: z7.boolean().nullable(),
1455
+ virtual: z7.boolean().nullable(),
1456
+ weight: z7.strictObject({
1457
+ value: z7.number().min(0),
1458
+ unit: z7.enum(["GRAMS", "KILOGRAMS", "OUNCES", "POUNDS"]).meta({ maxLength: 9 }).nullable()
1300
1459
  }).nullable(),
1301
- dimensions: z6.strictObject({
1302
- length: z6.number().min(0).nullable(),
1303
- width: z6.number().min(0).nullable(),
1304
- height: z6.number().min(0).nullable(),
1305
- unit: z6.string().min(1).max(16).nullable()
1460
+ dimensions: z7.strictObject({
1461
+ length: z7.number().min(0).nullable(),
1462
+ width: z7.number().min(0).nullable(),
1463
+ height: z7.number().min(0).nullable(),
1464
+ unit: z7.string().min(1).max(16).nullable()
1306
1465
  }).nullable(),
1307
1466
  shippingClassId: wireId.nullable(),
1308
- shippingClassSlug: z6.string().min(1).max(512).nullable()
1467
+ shippingClassSlug: z7.string().min(1).max(512).nullable()
1309
1468
  }),
1310
- policy: z6.strictObject({
1311
- status: z6.enum(["AVAILABLE", "NOT_CONFIGURED", "SCOPE_NOT_GRANTED", "UNSUPPORTED"]).meta({ maxLength: 17 }),
1312
- trust: z6.enum(["UNTRUSTED_REFERENCE"]).meta({ maxLength: 19 }),
1313
- title: z6.string().min(1).max(512).nullable(),
1314
- bodyStatus: z6.enum(["AVAILABLE", "EMPTY", "TOO_LARGE", "NOT_AVAILABLE"]).meta({ maxLength: 13 }),
1315
- bodyHtml: z6.string().min(1).max(8e3).nullable(),
1316
- url: z6.url({ protocol: /^https$/ }).min(1).max(2048).nullable(),
1469
+ policy: z7.strictObject({
1470
+ status: z7.enum(["AVAILABLE", "NOT_CONFIGURED", "SCOPE_NOT_GRANTED", "UNSUPPORTED"]).meta({ maxLength: 17 }),
1471
+ trust: z7.enum(["UNTRUSTED_REFERENCE"]).meta({ maxLength: 19 }),
1472
+ title: z7.string().min(1).max(512).nullable(),
1473
+ bodyStatus: z7.enum(["AVAILABLE", "EMPTY", "TOO_LARGE", "NOT_AVAILABLE"]).meta({ maxLength: 13 }),
1474
+ bodyHtml: z7.string().min(1).max(8e3).nullable(),
1475
+ url: z7.url({ protocol: /^https$/ }).min(1).max(2048).nullable(),
1317
1476
  updatedAt: DateSchema.nullable()
1318
1477
  })
1319
1478
  });
1320
- var limit = z6.number().int().min(1).max(3).default(3);
1479
+ var limit = z7.number().int().min(1).max(3).default(3);
1321
1480
  var CommerceToolInputs = {
1322
- commerce_resolve_product_categories: z6.strictObject({
1323
- query: z6.string().min(1).max(200),
1324
- limit: z6.number().int().min(1).max(10).default(5)
1481
+ commerce_resolve_product_categories: z7.strictObject({
1482
+ query: z7.string().min(1).max(200),
1483
+ limit: z7.number().int().min(1).max(10).default(5)
1325
1484
  }),
1326
1485
  commerce_get_shipping_information: CommerceShippingInformationInputSchema,
1327
- commerce_get_basket: z6.strictObject({}),
1328
- commerce_search_products: z6.strictObject({
1329
- query: z6.string().min(1).max(200).nullable().default(null),
1330
- category: z6.strictObject({
1331
- system: z6.enum(["SHOPIFY_STANDARD_PRODUCT_TAXONOMY", "WOOCOMMERCE_PRODUCT_CATEGORY"]).meta({ maxLength: 33 }),
1486
+ commerce_get_basket: z7.strictObject({}),
1487
+ commerce_search_products: z7.strictObject({
1488
+ query: z7.string().min(1).max(200).nullable().default(null),
1489
+ category: z7.strictObject({
1490
+ system: z7.enum(["SHOPIFY_STANDARD_PRODUCT_TAXONOMY", "WOOCOMMERCE_PRODUCT_CATEGORY"]).meta({ maxLength: 33 }),
1332
1491
  id: wireId,
1333
- taxonomyVersion: z6.string().min(1).max(64).nullable()
1492
+ taxonomyVersion: z7.string().min(1).max(64).nullable()
1334
1493
  }).optional(),
1335
- browse: z6.boolean().default(false),
1494
+ browse: z7.boolean().default(false),
1336
1495
  maximumPrice: MoneySchema.optional(),
1337
- availableOnly: z6.boolean().default(true),
1338
- limit: z6.number().int().min(1).max(20).default(10),
1339
- cursor: z6.string().max(2048).nullable().default(null)
1496
+ availableOnly: z7.boolean().default(true),
1497
+ limit: z7.number().int().min(1).max(20).default(10),
1498
+ cursor: z7.string().max(2048).nullable().default(null)
1340
1499
  }),
1341
- commerce_get_product: z6.strictObject({
1500
+ commerce_get_product: z7.strictObject({
1342
1501
  productId: IdSchema,
1343
1502
  variantId: IdSchema.nullable()
1344
1503
  }),
1345
- commerce_get_discount_options: z6.strictObject({
1346
- limit: z6.number().int().min(1).max(50).default(20),
1347
- cursor: z6.string().max(2048).nullable().default(null)
1504
+ commerce_get_discount_options: z7.strictObject({
1505
+ limit: z7.number().int().min(1).max(50).default(20),
1506
+ cursor: z7.string().max(2048).nullable().default(null)
1348
1507
  }),
1349
- commerce_get_discount_details: z6.strictObject({ offerId: IdSchema }),
1350
- commerce_evaluate_discount: z6.strictObject({
1508
+ commerce_get_discount_details: z7.strictObject({ offerId: IdSchema }),
1509
+ commerce_evaluate_discount: z7.strictObject({
1351
1510
  offerId: IdSchema,
1352
1511
  proposal: CommerceProposalSchema.nullable()
1353
1512
  }),
1354
- commerce_find_qualifying_products: z6.strictObject({
1513
+ commerce_find_qualifying_products: z7.strictObject({
1355
1514
  offerId: IdSchema,
1356
- query: z6.string().min(1).max(200).nullable(),
1515
+ query: z7.string().min(1).max(200).nullable(),
1357
1516
  limit
1358
1517
  }),
1359
- commerce_find_similar_products: z6.strictObject({
1518
+ commerce_find_similar_products: z7.strictObject({
1360
1519
  variantId: IdSchema,
1361
1520
  offerId: IdSchema.nullable(),
1362
1521
  limit
1363
1522
  })
1364
1523
  };
1365
- var alternatives = z6.strictObject({
1366
- alternatives: z6.array(CommerceAlternativeSchema).max(3),
1367
- truncated: z6.boolean()
1524
+ var alternatives = z7.strictObject({
1525
+ alternatives: z7.array(CommerceAlternativeSchema).max(3),
1526
+ truncated: z7.boolean()
1368
1527
  });
1369
1528
  var CommerceToolOutputs = {
1370
1529
  commerce_resolve_product_categories: CommerceCategoryResolutionSchema,
1371
1530
  commerce_get_shipping_information: CommerceShippingInformationSchema,
1372
1531
  commerce_get_basket: CommerceBasketSchema,
1373
- commerce_search_products: z6.strictObject({
1374
- products: z6.array(CommerceProductSchema).max(20),
1375
- cursor: z6.string().max(2048).nullable(),
1376
- truncated: z6.boolean()
1532
+ commerce_search_products: z7.strictObject({
1533
+ products: z7.array(CommerceProductSchema).max(20),
1534
+ cursor: z7.string().max(2048).nullable(),
1535
+ truncated: z7.boolean()
1377
1536
  }),
1378
- commerce_get_product: z6.strictObject({
1537
+ commerce_get_product: z7.strictObject({
1379
1538
  product: CommerceProductSchema.nullable()
1380
1539
  }),
1381
- commerce_get_discount_options: z6.union([CommerceOptionalLookupUnavailableSchema, z6.strictObject({
1382
- mode: z6.enum(["NONE", "FIXED", "AI_BEST_APPLICABLE"]),
1383
- offers: z6.array(CommerceOfferSchema).max(50),
1384
- truncated: z6.boolean(),
1385
- cursor: z6.string().max(2048).nullable().optional()
1540
+ commerce_get_discount_options: z7.union([CommerceOptionalLookupUnavailableSchema, z7.strictObject({
1541
+ mode: z7.enum(["NONE", "FIXED", "AI_BEST_APPLICABLE"]),
1542
+ offers: z7.array(CommerceOfferSchema).max(50),
1543
+ truncated: z7.boolean(),
1544
+ cursor: z7.string().max(2048).nullable().optional()
1386
1545
  })]),
1387
- commerce_get_discount_details: z6.union([CommerceOptionalLookupUnavailableSchema, z6.strictObject({
1546
+ commerce_get_discount_details: z7.union([CommerceOptionalLookupUnavailableSchema, z7.strictObject({
1388
1547
  details: CommerceDiscountDetailsSchema.nullable()
1389
1548
  })]),
1390
1549
  commerce_evaluate_discount: CommerceEvidenceSchema,
@@ -1400,6 +1559,11 @@ function productBelongsToDomain(product, verifiedDomain) {
1400
1559
  }
1401
1560
 
1402
1561
  export {
1562
+ CommerceProductDescriptionSchema,
1563
+ CommerceProductAttributesSchema,
1564
+ normalizeCommerceProductDescription,
1565
+ normalizeCommerceProductAttributes,
1566
+ normalizeCommerceProductDescriptionField,
1403
1567
  MONEY_PATTERN,
1404
1568
  safeName,
1405
1569
  safePath,
@@ -1477,6 +1641,10 @@ export {
1477
1641
  CommerceProposalSchema,
1478
1642
  CommerceBasketSchema,
1479
1643
  CommerceProductSaleEvidenceSchema,
1644
+ normalizeCommerceProductOptions,
1645
+ CommerceProductOptionsSchema,
1646
+ normalizeCommerceProductSelectedOptions,
1647
+ CommerceProductSelectedOptionsSchema,
1480
1648
  CommerceProductSchema,
1481
1649
  CommerceOfferSchema,
1482
1650
  CommerceDiscountCombinationFactsSchema,
@@ -1499,4 +1667,4 @@ export {
1499
1667
  CommerceToolOutputs,
1500
1668
  productBelongsToDomain
1501
1669
  };
1502
- //# sourceMappingURL=chunk-BDGLKOCW.js.map
1670
+ //# sourceMappingURL=chunk-WF2BDUPZ.js.map