@modainteract/moda-interact-shared 5.6.0 → 5.8.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 (31) hide show
  1. package/dist/{chunk-KIHGDO35.js → chunk-2XZVIWQZ.js} +11 -3
  2. package/dist/chunk-2XZVIWQZ.js.map +1 -0
  3. package/dist/{chunk-QVPEX7KY.js → chunk-GCCT2BDE.js} +4 -4
  4. package/dist/chunk-QFUK7FIO.js +16 -0
  5. package/dist/chunk-QFUK7FIO.js.map +1 -0
  6. package/dist/{chunk-S42O2OCG.js → chunk-SW2AFMT7.js} +434 -321
  7. package/dist/chunk-SW2AFMT7.js.map +1 -0
  8. package/dist/chunk-WHZAAF2Q.js +25 -0
  9. package/dist/chunk-WHZAAF2Q.js.map +1 -0
  10. package/dist/commerce/index.d.ts +41 -5
  11. package/dist/commerce/index.js +20 -17
  12. package/dist/commerce/index.js.map +1 -1
  13. package/dist/commerce/model/node.d.ts +3 -3
  14. package/dist/commerce/model/node.js +3 -3
  15. package/dist/commerce/outreach/index.d.ts +1094 -0
  16. package/dist/commerce/outreach/index.js +1355 -0
  17. package/dist/commerce/outreach/index.js.map +1 -0
  18. package/dist/commerce/presentation/index.d.ts +103 -6
  19. package/dist/commerce/presentation/index.js +80 -13
  20. package/dist/commerce/presentation/index.js.map +1 -1
  21. package/dist/commerce/runner/index.d.ts +4 -4
  22. package/dist/commerce/runner/index.js +12 -28
  23. package/dist/commerce/runner/index.js.map +1 -1
  24. package/dist/{product-context-D3FuI6ah.d.ts → product-context-qfk6k9uk.d.ts} +1 -1
  25. package/dist/recovery-offer-proof.js +2 -2
  26. package/dist/{response-Cs4zC3d3.d.ts → response-DD6HXT8s.d.ts} +121 -1
  27. package/dist/{types-ByoKuP90.d.ts → types-BXeYmpeg.d.ts} +2 -2
  28. package/package.json +12 -6
  29. package/dist/chunk-KIHGDO35.js.map +0 -1
  30. package/dist/chunk-S42O2OCG.js.map +0 -1
  31. /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,14 +1142,14 @@ 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 optionLabel = z6.string().transform((value) => value.replace(/[\r\n\t]+/g, " ").trim()).pipe(z6.string().min(1).max(128).refine((value) => !/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/.test(value)));
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)));
1052
1153
  function normalizeCommerceProductOptions(raw) {
1053
1154
  if (raw === void 0 || raw === null) return { status: "NOT_PROVIDED", items: [] };
1054
1155
  const source = raw;
@@ -1084,9 +1185,9 @@ function normalizeCommerceProductOptions(raw) {
1084
1185
  }
1085
1186
  return { status: partial ? "PARTIAL" : items.length ? "AVAILABLE" : "NOT_PROVIDED", items };
1086
1187
  }
1087
- var CommerceProductOptionsSchema = z6.preprocess(normalizeCommerceProductOptions, z6.strictObject({
1088
- status: z6.enum(["AVAILABLE", "NOT_PROVIDED", "PARTIAL"]),
1089
- items: z6.array(z6.strictObject({ name: optionLabel, values: z6.array(optionLabel).max(64), usedForVariants: z6.boolean().nullable() })).max(16)
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)
1090
1191
  }));
1091
1192
  function normalizeCommerceProductSelectedOptions(raw) {
1092
1193
  if (!Array.isArray(raw)) return [];
@@ -1099,31 +1200,33 @@ function normalizeCommerceProductSelectedOptions(raw) {
1099
1200
  }
1100
1201
  return result;
1101
1202
  }
1102
- var CommerceProductSelectedOptionsSchema = z6.preprocess(normalizeCommerceProductSelectedOptions, z6.array(z6.strictObject({ name: optionLabel, value: optionLabel })).max(16));
1103
- var CommerceProductSchema = z6.strictObject({
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(),
1104
1207
  options: CommerceProductOptionsSchema.optional(),
1105
1208
  selectedOptions: CommerceProductSelectedOptionsSchema.optional(),
1106
1209
  productId: IdSchema,
1107
1210
  variantId: IdSchema.nullable(),
1108
- title: z6.string().min(1).max(512),
1109
- url: z6.url({ protocol: /^https$/ }).refine((v) => {
1211
+ title: z7.string().min(1).max(512),
1212
+ url: z7.url({ protocol: /^https$/ }).refine((v) => {
1110
1213
  const u = new URL(v);
1111
1214
  return !u.username && !u.password && !u.port;
1112
1215
  }).nullable(),
1113
- available: z6.boolean().nullable(),
1216
+ available: z7.boolean().nullable(),
1114
1217
  unitPrice: MoneySchema.nullable(),
1115
1218
  currency: CurrencySchema.nullable(),
1116
- productType: z6.string().max(512).nullable(),
1117
- vendor: z6.string().max(512).nullable(),
1118
- categories: z6.array(z6.string()).optional(),
1119
- categoryIds: z6.array(IdSchema).max(128).optional(),
1120
- collectionIds: z6.array(IdSchema).max(128).optional(),
1121
- 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(),
1122
1225
  saleEvidence: CommerceProductSaleEvidenceSchema.nullable().optional(),
1123
1226
  observedAt: DateSchema
1124
1227
  });
1125
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])/;
1126
- var CommerceDiscountDateTimeSchema = z6.string().regex(discountUtcPattern).refine((value) => {
1229
+ var CommerceDiscountDateTimeSchema = z7.string().regex(discountUtcPattern).refine((value) => {
1127
1230
  const match = discountUtcPattern.exec(value);
1128
1231
  if (!match) return false;
1129
1232
  const [year, month, day, hour, minute, second] = match.slice(1).map(Number);
@@ -1132,36 +1235,36 @@ var CommerceDiscountDateTimeSchema = z6.string().regex(discountUtcPattern).refin
1132
1235
  const daysInMonth = [31, leapYear ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
1133
1236
  return day >= 1 && day <= daysInMonth[month - 1];
1134
1237
  }, "Expected a valid UTC discount timestamp with seconds");
1135
- var CommerceOfferSchema = z6.strictObject({
1238
+ var CommerceOfferSchema = z7.strictObject({
1136
1239
  offerId: IdSchema,
1137
- title: z6.string().min(1).max(512),
1138
- method: z6.enum(["AUTOMATIC", "CODE"]),
1139
- 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(),
1140
1243
  startsAt: CommerceDiscountDateTimeSchema.nullable(),
1141
1244
  endsAt: CommerceDiscountDateTimeSchema.nullable(),
1142
- support: z6.enum(["SUPPORTED", "UNSUPPORTED", "UNKNOWN"]),
1143
- 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)
1144
1247
  }).refine(
1145
1248
  (v) => (v.startsAt === null || v.endsAt === null || Date.parse(v.startsAt) < Date.parse(v.endsAt)) && (v.method !== "AUTOMATIC" || v.code === null)
1146
1249
  );
1147
- var CommerceDiscountCombinationFactsSchema = z6.strictObject({
1148
- discountClasses: z6.array(z6.enum(["ORDER", "PRODUCT", "SHIPPING"])).max(3).nullable(),
1149
- shopifyPlus: z6.boolean().nullable(),
1150
- combinesWith: z6.strictObject({
1151
- orderDiscounts: z6.boolean().nullable(),
1152
- productDiscounts: z6.boolean().nullable(),
1153
- 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()
1154
1257
  }).nullable(),
1155
- discountTags: z6.array(z6.string().min(1).max(128)).max(64).nullable(),
1156
- 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()
1157
1260
  });
1158
- var CommerceDiscountConditionFactsSchema = z6.strictObject({
1159
- provider: z6.enum(["SHOPIFY", "WOOCOMMERCE"]),
1160
- completeness: z6.enum(["COMPLETE", "PARTIAL", "UNKNOWN"]),
1261
+ var CommerceDiscountConditionFactsSchema = z7.strictObject({
1262
+ provider: z7.enum(["SHOPIFY", "WOOCOMMERCE"]),
1263
+ completeness: z7.enum(["COMPLETE", "PARTIAL", "UNKNOWN"]),
1161
1264
  observedAt: CommerceDiscountDateTimeSchema,
1162
- providerStatus: z6.string().max(64),
1265
+ providerStatus: z7.string().max(64),
1163
1266
  unavailableAt: CommerceDiscountDateTimeSchema.nullable(),
1164
- discountKind: z6.enum([
1267
+ discountKind: z7.enum([
1165
1268
  "PERCENTAGE",
1166
1269
  "FIXED_AMOUNT",
1167
1270
  "FREE_SHIPPING",
@@ -1171,8 +1274,8 @@ var CommerceDiscountConditionFactsSchema = z6.strictObject({
1171
1274
  ]),
1172
1275
  discountValue: MoneySchema.nullable(),
1173
1276
  discountCurrency: CurrencySchema.nullable(),
1174
- targeting: z6.strictObject({
1175
- kind: z6.enum([
1277
+ targeting: z7.strictObject({
1278
+ kind: z7.enum([
1176
1279
  "ALL",
1177
1280
  "PRODUCTS",
1178
1281
  "VARIANTS",
@@ -1181,38 +1284,38 @@ var CommerceDiscountConditionFactsSchema = z6.strictObject({
1181
1284
  "MIXED",
1182
1285
  "UNKNOWN"
1183
1286
  ]),
1184
- includedProductIds: z6.array(IdSchema).max(128),
1185
- includedVariantIds: z6.array(IdSchema).max(128),
1186
- includedCategoryIds: z6.array(IdSchema).max(128),
1187
- includedCollectionIds: z6.array(IdSchema).max(128),
1188
- excludedProductIds: z6.array(IdSchema).max(128),
1189
- excludedVariantIds: z6.array(IdSchema).max(128),
1190
- excludedCategoryIds: z6.array(IdSchema).max(128),
1191
- 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)
1192
1295
  }),
1193
1296
  minimumSubtotal: MoneySchema.nullable(),
1194
1297
  maximumSubtotal: MoneySchema.nullable(),
1195
1298
  subtotalRequirementCurrency: CurrencySchema.nullable(),
1196
- minimumQuantity: z6.number().int().nonnegative().nullable(),
1197
- usageLimit: z6.number().int().nonnegative().nullable(),
1198
- usageCount: z6.number().int().nonnegative().nullable(),
1199
- perCustomerLimit: z6.number().int().nonnegative().nullable(),
1200
- customerScope: z6.enum(["ALL", "RESTRICTED", "UNKNOWN"]),
1201
- excludesSaleItems: z6.boolean().nullable(),
1202
- 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(),
1203
1306
  combination: CommerceDiscountCombinationFactsSchema,
1204
- unrepresentedConditions: z6.array(z6.string().min(1).max(128)).max(24)
1307
+ unrepresentedConditions: z7.array(z7.string().min(1).max(128)).max(24)
1205
1308
  });
1206
- var CommerceDiscountDetailsSchema = z6.strictObject({
1309
+ var CommerceDiscountDetailsSchema = z7.strictObject({
1207
1310
  offer: CommerceOfferSchema,
1208
1311
  facts: CommerceDiscountConditionFactsSchema,
1209
- providerDiscountId: z6.string().min(1).max(191).nullable()
1312
+ providerDiscountId: z7.string().min(1).max(191).nullable()
1210
1313
  });
1211
- var condition = z6.strictObject({
1212
- code: z6.string().min(1).max(64),
1213
- description: z6.string().max(256)
1314
+ var condition = z7.strictObject({
1315
+ code: z7.string().min(1).max(64),
1316
+ description: z7.string().max(256)
1214
1317
  });
1215
- var CommerceEvidenceSchema = z6.strictObject({
1318
+ var CommerceEvidenceSchema = z7.strictObject({
1216
1319
  evidenceId: HashSchema,
1217
1320
  turn: CommerceTurnIdentitySchema,
1218
1321
  grantId: IdSchema,
@@ -1223,7 +1326,7 @@ var CommerceEvidenceSchema = z6.strictObject({
1223
1326
  ruleFingerprint: HashSchema,
1224
1327
  evaluatedAt: DateSchema,
1225
1328
  expiresAt: DateSchema,
1226
- outcome: z6.enum([
1329
+ outcome: z7.enum([
1227
1330
  "QUALIFIES_FOR_KNOWN_RULES",
1228
1331
  "DOES_NOT_QUALIFY",
1229
1332
  "UNKNOWN",
@@ -1232,8 +1335,8 @@ var CommerceEvidenceSchema = z6.strictObject({
1232
1335
  currency: CurrencySchema.nullable(),
1233
1336
  savings: MoneySchema.nullable(),
1234
1337
  resultingTotal: MoneySchema.nullable(),
1235
- evaluatedConditions: z6.array(condition).max(32),
1236
- unresolvedConditions: z6.array(condition).max(32)
1338
+ evaluatedConditions: z7.array(condition).max(32),
1339
+ unresolvedConditions: z7.array(condition).max(32)
1237
1340
  }).superRefine((v, c) => {
1238
1341
  if (Date.parse(v.expiresAt) - Date.parse(v.evaluatedAt) > 6e4)
1239
1342
  c.addIssue({
@@ -1243,16 +1346,16 @@ var CommerceEvidenceSchema = z6.strictObject({
1243
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))
1244
1347
  c.addIssue({ code: "custom", message: "Unsupported qualifying claim" });
1245
1348
  });
1246
- var CommerceAlternativeSchema = z6.strictObject({
1349
+ var CommerceAlternativeSchema = z7.strictObject({
1247
1350
  product: CommerceProductSchema,
1248
1351
  proposal: CommerceProposalSchema,
1249
1352
  extraSpend: MoneySchema.nullable(),
1250
1353
  resultingTotal: MoneySchema.nullable(),
1251
1354
  currency: CurrencySchema.nullable(),
1252
1355
  evidence: CommerceEvidenceSchema.nullable(),
1253
- similarityReasons: z6.array(z6.string().max(256)).max(3)
1356
+ similarityReasons: z7.array(z7.string().max(256)).max(3)
1254
1357
  }).refine((v) => v.product.available === true);
1255
- var CommerceErrorCodeSchema = z6.enum([
1358
+ var CommerceErrorCodeSchema = z7.enum([
1256
1359
  "INVALID_INPUT",
1257
1360
  "DENIED",
1258
1361
  "STALE_TURN",
@@ -1263,184 +1366,189 @@ var CommerceErrorCodeSchema = z6.enum([
1263
1366
  "INCOMPATIBLE_VERSION"
1264
1367
  ]);
1265
1368
  function commerceToolResultSchema(data) {
1266
- return z6.union([
1267
- z6.strictObject({
1369
+ return z7.union([
1370
+ z7.strictObject({
1268
1371
  contractVersion: ContractVersionSchema,
1269
- status: z6.literal("OK"),
1372
+ status: z7.literal("OK"),
1270
1373
  data,
1271
- renderedText: z6.string().max(4096)
1374
+ renderedText: z7.string().max(4096)
1272
1375
  }),
1273
- z6.strictObject({
1376
+ z7.strictObject({
1274
1377
  contractVersion: ContractVersionSchema,
1275
- status: z6.literal("ERROR"),
1378
+ status: z7.literal("ERROR"),
1276
1379
  code: CommerceErrorCodeSchema,
1277
- retryable: z6.boolean(),
1278
- renderedText: z6.string().max(4096).optional()
1380
+ retryable: z7.boolean(),
1381
+ renderedText: z7.string().max(4096).optional()
1279
1382
  })
1280
1383
  ]);
1281
1384
  }
1282
1385
  var CommerceToolResultSchema = commerceToolResultSchema(
1283
1386
  boundedJson(262144)
1284
1387
  );
1285
- var wireId = z6.string().min(1).max(128);
1286
- var taxonomySource = z6.enum(["SHOPIFY_STANDARD_PRODUCT_TAXONOMY"]).meta({ maxLength: 33 });
1287
- 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({
1288
1391
  categoryId: wireId,
1289
- name: z6.string().min(1).max(512),
1290
- fullName: z6.string().min(1).max(4096),
1392
+ name: z7.string().min(1).max(512),
1393
+ fullName: z7.string().min(1).max(4096),
1291
1394
  parentId: wireId.nullable(),
1292
- level: z6.number().int().min(0).max(32),
1293
- ancestorIds: z6.array(wireId).max(32),
1294
- 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)
1295
1398
  });
1296
- var CommerceCategoryResolutionSchema = z6.union([
1297
- z6.strictObject({
1298
- 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 }),
1299
1402
  generationId: wireId,
1300
1403
  source: taxonomySource,
1301
- taxonomyVersion: z6.string().min(1).max(64),
1302
- languageTag: z6.string().min(1).max(35),
1303
- 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)
1304
1407
  }),
1305
- z6.strictObject({
1306
- outcome: z6.enum(["UNAVAILABLE"]).meta({ maxLength: 11 }),
1307
- 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 })
1308
1411
  })
1309
1412
  ]);
1310
- var CommerceOptionalLookupUnavailableSchema = z6.strictObject({
1311
- outcome: z6.enum(["UNAVAILABLE"]).meta({ maxLength: 11 }),
1312
- 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 })
1313
1416
  });
1314
- var CommerceProductRecommendationSelectionSchema = z6.strictObject({
1315
- productRecommendationVersion: z6.enum(["1"]).meta({ maxLength: 1 }).optional(),
1316
- productRecommendations: z6.array(z6.strictObject({
1317
- 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 }),
1318
1421
  basketLineId: wireId.nullable(),
1319
1422
  productId: wireId,
1320
1423
  variantId: wireId.nullable(),
1321
- quantity: z6.number().int().min(1).max(99),
1322
- promotionKind: z6.enum(["NONE", "NATIVE_SALE", "DISCOUNT"]).meta({ maxLength: 11 }),
1323
- 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)
1324
1427
  })).min(1).max(3).optional()
1325
1428
  });
1326
- var CommerceResponseDispositionSchema = z6.enum([
1429
+ var CommerceResponseDispositionSchema = z7.enum([
1327
1430
  "STANDARD",
1328
1431
  "OUT_OF_SCOPE_REDIRECT",
1329
1432
  "SHIPPING_INFORMATION_UNVERIFIED",
1330
- "PRODUCT_OPTIONS"
1433
+ "PRODUCT_OPTIONS",
1434
+ "PRODUCT_DETAILS"
1331
1435
  ]).meta({ maxLength: 31 });
1332
- var CommerceAnswerPresentationSelectionSchema = z6.strictObject({
1333
- productOptionSelections: z6.array(z6.strictObject({ productId: wireId, variantId: wireId.nullable() })).max(3).optional(),
1436
+ var CommerceAnswerPresentationSelectionSchema = z7.strictObject({
1437
+ productOptionSelections: z7.array(z7.strictObject({ productId: wireId, variantId: wireId.nullable() })).max(3).optional(),
1438
+ productDetailSelections: z7.array(z7.strictObject({ productId: wireId, variantId: wireId.nullable() })).max(3).refine(
1439
+ (selections) => new Set(selections.map((selection) => JSON.stringify([selection.productId, selection.variantId]))).size === selections.length,
1440
+ "Duplicate product detail selection"
1441
+ ).optional(),
1334
1442
  responseDisposition: CommerceResponseDispositionSchema.optional(),
1335
- shippingInformationSelection: z6.strictObject({
1443
+ shippingInformationSelection: z7.strictObject({
1336
1444
  productId: wireId.nullable(),
1337
1445
  variantId: wireId.nullable()
1338
1446
  }).optional()
1339
1447
  });
1340
- var CommerceShippingInformationInputSchema = z6.strictObject({
1448
+ var CommerceShippingInformationInputSchema = z7.strictObject({
1341
1449
  productId: wireId.nullable().default(null),
1342
1450
  variantId: wireId.nullable().default(null)
1343
1451
  });
1344
- var CommerceShippingInformationSchema = z6.strictObject({
1345
- provider: z6.enum(["SHOPIFY", "WOOCOMMERCE"]).meta({ maxLength: 11 }),
1452
+ var CommerceShippingInformationSchema = z7.strictObject({
1453
+ provider: z7.enum(["SHOPIFY", "WOOCOMMERCE"]).meta({ maxLength: 11 }),
1346
1454
  observedAt: DateSchema,
1347
- product: z6.strictObject({
1348
- status: z6.enum(["NOT_REQUESTED", "VARIANT_REQUIRED", "AVAILABLE"]).meta({ maxLength: 16 }),
1455
+ product: z7.strictObject({
1456
+ status: z7.enum(["NOT_REQUESTED", "VARIANT_REQUIRED", "AVAILABLE"]).meta({ maxLength: 16 }),
1349
1457
  productId: wireId.nullable(),
1350
1458
  variantId: wireId.nullable(),
1351
- requiresShipping: z6.boolean().nullable(),
1352
- virtual: z6.boolean().nullable(),
1353
- weight: z6.strictObject({
1354
- value: z6.number().min(0),
1355
- unit: z6.enum(["GRAMS", "KILOGRAMS", "OUNCES", "POUNDS"]).meta({ maxLength: 9 }).nullable()
1459
+ requiresShipping: z7.boolean().nullable(),
1460
+ virtual: z7.boolean().nullable(),
1461
+ weight: z7.strictObject({
1462
+ value: z7.number().min(0),
1463
+ unit: z7.enum(["GRAMS", "KILOGRAMS", "OUNCES", "POUNDS"]).meta({ maxLength: 9 }).nullable()
1356
1464
  }).nullable(),
1357
- dimensions: z6.strictObject({
1358
- length: z6.number().min(0).nullable(),
1359
- width: z6.number().min(0).nullable(),
1360
- height: z6.number().min(0).nullable(),
1361
- unit: z6.string().min(1).max(16).nullable()
1465
+ dimensions: z7.strictObject({
1466
+ length: z7.number().min(0).nullable(),
1467
+ width: z7.number().min(0).nullable(),
1468
+ height: z7.number().min(0).nullable(),
1469
+ unit: z7.string().min(1).max(16).nullable()
1362
1470
  }).nullable(),
1363
1471
  shippingClassId: wireId.nullable(),
1364
- shippingClassSlug: z6.string().min(1).max(512).nullable()
1472
+ shippingClassSlug: z7.string().min(1).max(512).nullable()
1365
1473
  }),
1366
- policy: z6.strictObject({
1367
- status: z6.enum(["AVAILABLE", "NOT_CONFIGURED", "SCOPE_NOT_GRANTED", "UNSUPPORTED"]).meta({ maxLength: 17 }),
1368
- trust: z6.enum(["UNTRUSTED_REFERENCE"]).meta({ maxLength: 19 }),
1369
- title: z6.string().min(1).max(512).nullable(),
1370
- bodyStatus: z6.enum(["AVAILABLE", "EMPTY", "TOO_LARGE", "NOT_AVAILABLE"]).meta({ maxLength: 13 }),
1371
- bodyHtml: z6.string().min(1).max(8e3).nullable(),
1372
- url: z6.url({ protocol: /^https$/ }).min(1).max(2048).nullable(),
1474
+ policy: z7.strictObject({
1475
+ status: z7.enum(["AVAILABLE", "NOT_CONFIGURED", "SCOPE_NOT_GRANTED", "UNSUPPORTED"]).meta({ maxLength: 17 }),
1476
+ trust: z7.enum(["UNTRUSTED_REFERENCE"]).meta({ maxLength: 19 }),
1477
+ title: z7.string().min(1).max(512).nullable(),
1478
+ bodyStatus: z7.enum(["AVAILABLE", "EMPTY", "TOO_LARGE", "NOT_AVAILABLE"]).meta({ maxLength: 13 }),
1479
+ bodyHtml: z7.string().min(1).max(8e3).nullable(),
1480
+ url: z7.url({ protocol: /^https$/ }).min(1).max(2048).nullable(),
1373
1481
  updatedAt: DateSchema.nullable()
1374
1482
  })
1375
1483
  });
1376
- var limit = z6.number().int().min(1).max(3).default(3);
1484
+ var limit = z7.number().int().min(1).max(3).default(3);
1377
1485
  var CommerceToolInputs = {
1378
- commerce_resolve_product_categories: z6.strictObject({
1379
- query: z6.string().min(1).max(200),
1380
- limit: z6.number().int().min(1).max(10).default(5)
1486
+ commerce_resolve_product_categories: z7.strictObject({
1487
+ query: z7.string().min(1).max(200),
1488
+ limit: z7.number().int().min(1).max(10).default(5)
1381
1489
  }),
1382
1490
  commerce_get_shipping_information: CommerceShippingInformationInputSchema,
1383
- commerce_get_basket: z6.strictObject({}),
1384
- commerce_search_products: z6.strictObject({
1385
- query: z6.string().min(1).max(200).nullable().default(null),
1386
- category: z6.strictObject({
1387
- system: z6.enum(["SHOPIFY_STANDARD_PRODUCT_TAXONOMY", "WOOCOMMERCE_PRODUCT_CATEGORY"]).meta({ maxLength: 33 }),
1491
+ commerce_get_basket: z7.strictObject({}),
1492
+ commerce_search_products: z7.strictObject({
1493
+ query: z7.string().min(1).max(200).nullable().default(null),
1494
+ category: z7.strictObject({
1495
+ system: z7.enum(["SHOPIFY_STANDARD_PRODUCT_TAXONOMY", "WOOCOMMERCE_PRODUCT_CATEGORY"]).meta({ maxLength: 33 }),
1388
1496
  id: wireId,
1389
- taxonomyVersion: z6.string().min(1).max(64).nullable()
1497
+ taxonomyVersion: z7.string().min(1).max(64).nullable()
1390
1498
  }).optional(),
1391
- browse: z6.boolean().default(false),
1499
+ browse: z7.boolean().default(false),
1392
1500
  maximumPrice: MoneySchema.optional(),
1393
- availableOnly: z6.boolean().default(true),
1394
- limit: z6.number().int().min(1).max(20).default(10),
1395
- cursor: z6.string().max(2048).nullable().default(null)
1501
+ availableOnly: z7.boolean().default(true),
1502
+ limit: z7.number().int().min(1).max(20).default(10),
1503
+ cursor: z7.string().max(2048).nullable().default(null)
1396
1504
  }),
1397
- commerce_get_product: z6.strictObject({
1505
+ commerce_get_product: z7.strictObject({
1398
1506
  productId: IdSchema,
1399
1507
  variantId: IdSchema.nullable()
1400
1508
  }),
1401
- commerce_get_discount_options: z6.strictObject({
1402
- limit: z6.number().int().min(1).max(50).default(20),
1403
- cursor: z6.string().max(2048).nullable().default(null)
1509
+ commerce_get_discount_options: z7.strictObject({
1510
+ limit: z7.number().int().min(1).max(50).default(20),
1511
+ cursor: z7.string().max(2048).nullable().default(null)
1404
1512
  }),
1405
- commerce_get_discount_details: z6.strictObject({ offerId: IdSchema }),
1406
- commerce_evaluate_discount: z6.strictObject({
1513
+ commerce_get_discount_details: z7.strictObject({ offerId: IdSchema }),
1514
+ commerce_evaluate_discount: z7.strictObject({
1407
1515
  offerId: IdSchema,
1408
1516
  proposal: CommerceProposalSchema.nullable()
1409
1517
  }),
1410
- commerce_find_qualifying_products: z6.strictObject({
1518
+ commerce_find_qualifying_products: z7.strictObject({
1411
1519
  offerId: IdSchema,
1412
- query: z6.string().min(1).max(200).nullable(),
1520
+ query: z7.string().min(1).max(200).nullable(),
1413
1521
  limit
1414
1522
  }),
1415
- commerce_find_similar_products: z6.strictObject({
1523
+ commerce_find_similar_products: z7.strictObject({
1416
1524
  variantId: IdSchema,
1417
1525
  offerId: IdSchema.nullable(),
1418
1526
  limit
1419
1527
  })
1420
1528
  };
1421
- var alternatives = z6.strictObject({
1422
- alternatives: z6.array(CommerceAlternativeSchema).max(3),
1423
- truncated: z6.boolean()
1529
+ var alternatives = z7.strictObject({
1530
+ alternatives: z7.array(CommerceAlternativeSchema).max(3),
1531
+ truncated: z7.boolean()
1424
1532
  });
1425
1533
  var CommerceToolOutputs = {
1426
1534
  commerce_resolve_product_categories: CommerceCategoryResolutionSchema,
1427
1535
  commerce_get_shipping_information: CommerceShippingInformationSchema,
1428
1536
  commerce_get_basket: CommerceBasketSchema,
1429
- commerce_search_products: z6.strictObject({
1430
- products: z6.array(CommerceProductSchema).max(20),
1431
- cursor: z6.string().max(2048).nullable(),
1432
- truncated: z6.boolean()
1537
+ commerce_search_products: z7.strictObject({
1538
+ products: z7.array(CommerceProductSchema).max(20),
1539
+ cursor: z7.string().max(2048).nullable(),
1540
+ truncated: z7.boolean()
1433
1541
  }),
1434
- commerce_get_product: z6.strictObject({
1542
+ commerce_get_product: z7.strictObject({
1435
1543
  product: CommerceProductSchema.nullable()
1436
1544
  }),
1437
- commerce_get_discount_options: z6.union([CommerceOptionalLookupUnavailableSchema, z6.strictObject({
1438
- mode: z6.enum(["NONE", "FIXED", "AI_BEST_APPLICABLE"]),
1439
- offers: z6.array(CommerceOfferSchema).max(50),
1440
- truncated: z6.boolean(),
1441
- cursor: z6.string().max(2048).nullable().optional()
1545
+ commerce_get_discount_options: z7.union([CommerceOptionalLookupUnavailableSchema, z7.strictObject({
1546
+ mode: z7.enum(["NONE", "FIXED", "AI_BEST_APPLICABLE"]),
1547
+ offers: z7.array(CommerceOfferSchema).max(50),
1548
+ truncated: z7.boolean(),
1549
+ cursor: z7.string().max(2048).nullable().optional()
1442
1550
  })]),
1443
- commerce_get_discount_details: z6.union([CommerceOptionalLookupUnavailableSchema, z6.strictObject({
1551
+ commerce_get_discount_details: z7.union([CommerceOptionalLookupUnavailableSchema, z7.strictObject({
1444
1552
  details: CommerceDiscountDetailsSchema.nullable()
1445
1553
  })]),
1446
1554
  commerce_evaluate_discount: CommerceEvidenceSchema,
@@ -1456,6 +1564,11 @@ function productBelongsToDomain(product, verifiedDomain) {
1456
1564
  }
1457
1565
 
1458
1566
  export {
1567
+ CommerceProductDescriptionSchema,
1568
+ CommerceProductAttributesSchema,
1569
+ normalizeCommerceProductDescription,
1570
+ normalizeCommerceProductAttributes,
1571
+ normalizeCommerceProductDescriptionField,
1459
1572
  MONEY_PATTERN,
1460
1573
  safeName,
1461
1574
  safePath,
@@ -1559,4 +1672,4 @@ export {
1559
1672
  CommerceToolOutputs,
1560
1673
  productBelongsToDomain
1561
1674
  };
1562
- //# sourceMappingURL=chunk-S42O2OCG.js.map
1675
+ //# sourceMappingURL=chunk-SW2AFMT7.js.map