@saar-ai/web-widget 0.7.0 → 0.9.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.
@@ -1916,6 +1916,115 @@ function handleIntersectionResults(result, left, right) {
1916
1916
  result.value = merged.data;
1917
1917
  return result;
1918
1918
  }
1919
+ var $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
1920
+ $ZodType.init(inst, def);
1921
+ inst._zod.parse = (payload, ctx) => {
1922
+ const input = payload.value;
1923
+ if (!isPlainObject(input)) {
1924
+ payload.issues.push({
1925
+ expected: "record",
1926
+ code: "invalid_type",
1927
+ input,
1928
+ inst
1929
+ });
1930
+ return payload;
1931
+ }
1932
+ const proms = [];
1933
+ const values = def.keyType._zod.values;
1934
+ if (values) {
1935
+ payload.value = {};
1936
+ const recordKeys = /* @__PURE__ */ new Set();
1937
+ for (const key of values) if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
1938
+ recordKeys.add(typeof key === "number" ? key.toString() : key);
1939
+ const keyResult = def.keyType._zod.run({
1940
+ value: key,
1941
+ issues: []
1942
+ }, ctx);
1943
+ if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
1944
+ if (keyResult.issues.length) {
1945
+ payload.issues.push({
1946
+ code: "invalid_key",
1947
+ origin: "record",
1948
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
1949
+ input: key,
1950
+ path: [key],
1951
+ inst
1952
+ });
1953
+ continue;
1954
+ }
1955
+ const outKey = keyResult.value;
1956
+ const result = def.valueType._zod.run({
1957
+ value: input[key],
1958
+ issues: []
1959
+ }, ctx);
1960
+ if (result instanceof Promise) proms.push(result.then((result) => {
1961
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
1962
+ payload.value[outKey] = result.value;
1963
+ }));
1964
+ else {
1965
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
1966
+ payload.value[outKey] = result.value;
1967
+ }
1968
+ }
1969
+ let unrecognized;
1970
+ for (const key in input) if (!recordKeys.has(key)) {
1971
+ unrecognized = unrecognized ?? [];
1972
+ unrecognized.push(key);
1973
+ }
1974
+ if (unrecognized && unrecognized.length > 0) payload.issues.push({
1975
+ code: "unrecognized_keys",
1976
+ input,
1977
+ inst,
1978
+ keys: unrecognized
1979
+ });
1980
+ } else {
1981
+ payload.value = {};
1982
+ for (const key of Reflect.ownKeys(input)) {
1983
+ if (key === "__proto__") continue;
1984
+ if (!Object.prototype.propertyIsEnumerable.call(input, key)) continue;
1985
+ let keyResult = def.keyType._zod.run({
1986
+ value: key,
1987
+ issues: []
1988
+ }, ctx);
1989
+ if (keyResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
1990
+ if (typeof key === "string" && number$1.test(key) && keyResult.issues.length) {
1991
+ const retryResult = def.keyType._zod.run({
1992
+ value: Number(key),
1993
+ issues: []
1994
+ }, ctx);
1995
+ if (retryResult instanceof Promise) throw new Error("Async schemas not supported in object keys currently");
1996
+ if (retryResult.issues.length === 0) keyResult = retryResult;
1997
+ }
1998
+ if (keyResult.issues.length) {
1999
+ if (def.mode === "loose") payload.value[key] = input[key];
2000
+ else payload.issues.push({
2001
+ code: "invalid_key",
2002
+ origin: "record",
2003
+ issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
2004
+ input: key,
2005
+ path: [key],
2006
+ inst
2007
+ });
2008
+ continue;
2009
+ }
2010
+ const result = def.valueType._zod.run({
2011
+ value: input[key],
2012
+ issues: []
2013
+ }, ctx);
2014
+ if (result instanceof Promise) proms.push(result.then((result) => {
2015
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
2016
+ payload.value[keyResult.value] = result.value;
2017
+ }));
2018
+ else {
2019
+ if (result.issues.length) payload.issues.push(...prefixIssues(key, result.issues));
2020
+ payload.value[keyResult.value] = result.value;
2021
+ }
2022
+ }
2023
+ }
2024
+ if (proms.length) return Promise.all(proms).then(() => payload);
2025
+ return payload;
2026
+ };
2027
+ });
1919
2028
  var $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
1920
2029
  $ZodType.init(inst, def);
1921
2030
  const values = getEnumValues(def.entries);
@@ -3191,6 +3300,39 @@ var intersectionProcessor = (schema, ctx, json, params) => {
3191
3300
  const isSimpleIntersection = (val) => "allOf" in val && Object.keys(val).length === 1;
3192
3301
  json.allOf = [...isSimpleIntersection(a) ? a.allOf : [a], ...isSimpleIntersection(b) ? b.allOf : [b]];
3193
3302
  };
3303
+ var recordProcessor = (schema, ctx, _json, params) => {
3304
+ const json = _json;
3305
+ const def = schema._zod.def;
3306
+ json.type = "object";
3307
+ const keyType = def.keyType;
3308
+ const patterns = keyType._zod.bag?.patterns;
3309
+ if (def.mode === "loose" && patterns && patterns.size > 0) {
3310
+ const valueSchema = process(def.valueType, ctx, {
3311
+ ...params,
3312
+ path: [
3313
+ ...params.path,
3314
+ "patternProperties",
3315
+ "*"
3316
+ ]
3317
+ });
3318
+ json.patternProperties = {};
3319
+ for (const pattern of patterns) json.patternProperties[pattern.source] = valueSchema;
3320
+ } else {
3321
+ if (ctx.target === "draft-07" || ctx.target === "draft-2020-12") json.propertyNames = process(def.keyType, ctx, {
3322
+ ...params,
3323
+ path: [...params.path, "propertyNames"]
3324
+ });
3325
+ json.additionalProperties = process(def.valueType, ctx, {
3326
+ ...params,
3327
+ path: [...params.path, "additionalProperties"]
3328
+ });
3329
+ }
3330
+ const keyValues = keyType._zod.values;
3331
+ if (keyValues) {
3332
+ const validKeyValues = [...keyValues].filter((v) => typeof v === "string" || typeof v === "number");
3333
+ if (validKeyValues.length > 0) json.required = validKeyValues;
3334
+ }
3335
+ };
3194
3336
  var nullableProcessor = (schema, ctx, json, params) => {
3195
3337
  const def = schema._zod.def;
3196
3338
  const inner = process(def.innerType, ctx, params);
@@ -3900,6 +4042,27 @@ function intersection(left, right) {
3900
4042
  right
3901
4043
  });
3902
4044
  }
4045
+ var ZodRecord = /*@__PURE__*/ $constructor("ZodRecord", (inst, def) => {
4046
+ $ZodRecord.init(inst, def);
4047
+ ZodType.init(inst, def);
4048
+ inst._zod.processJSONSchema = (ctx, json, params) => recordProcessor(inst, ctx, json, params);
4049
+ inst.keyType = def.keyType;
4050
+ inst.valueType = def.valueType;
4051
+ });
4052
+ function record(keyType, valueType, params) {
4053
+ if (!valueType || !valueType._zod) return new ZodRecord({
4054
+ type: "record",
4055
+ keyType: string(),
4056
+ valueType: keyType,
4057
+ ...normalizeParams(valueType)
4058
+ });
4059
+ return new ZodRecord({
4060
+ type: "record",
4061
+ keyType,
4062
+ valueType,
4063
+ ...normalizeParams(params)
4064
+ });
4065
+ }
3903
4066
  var ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def) => {
3904
4067
  $ZodEnum.init(inst, def);
3905
4068
  ZodType.init(inst, def);
@@ -4120,4 +4283,4 @@ function superRefine(fn, params) {
4120
4283
  return /* @__PURE__ */ _superRefine(fn, params);
4121
4284
  }
4122
4285
  //#endregion
4123
- export { httpUrl as a, number as c, discriminatedUnion as i, object as l, array as n, literal as o, boolean as r, looseObject as s, _enum as t, string as u };
4286
+ export { httpUrl as a, number as c, string as d, discriminatedUnion as i, object as l, array as n, literal as o, boolean as r, looseObject as s, _enum as t, record as u };
@@ -1,4 +1,4 @@
1
- import { c as number, i as discriminatedUnion, l as object, o as literal, r as boolean, s as looseObject, t as _enum, u as string } from "./schemas-Bl_6mxe4.js";
1
+ import { c as number, d as string, i as discriminatedUnion, l as object, o as literal, r as boolean, s as looseObject, t as _enum } from "./schemas-D-uDc-9q.js";
2
2
  //#region ../widget-protocol/dist/telemetry.js
3
3
  /**
4
4
  * The voice call's wire contract, as the CALLER's browser sees it: what the
@@ -173,6 +173,21 @@ var TurnLatencyPayloadSchema = object({
173
173
  /** Caller stopped speaking → first audio they hear. The felt latency. */
174
174
  overallMs: number().nullable(),
175
175
  /**
176
+ * Caller stopped speaking → the first ACT that reached their screen: a card
177
+ * ringed, a page opened, a grid narrowed.
178
+ *
179
+ * Not a stage and not part of the sum — an eager act tool runs while the
180
+ * model is still dictating the rest of its sentence, so this can land before
181
+ * `overallMs` and that is the concierge acting while it talks. Above
182
+ * `overallMs` it is a navigation waiting for the clause to finish, which is
183
+ * equally correct. `null` is a turn that only spoke.
184
+ *
185
+ * OPTIONAL, and read defensively: a widget bundle older than this field is
186
+ * the ordinary case for the life of a storefront tab, and a worker older than
187
+ * it simply does not send one.
188
+ */
189
+ firstActMs: number().nullable().optional(),
190
+ /**
176
191
  * The turn tier began generating before the turn was confirmed, so most of
177
192
  * `agentMs` hid under `eotMs` and the stages will not sum to `overallMs`.
178
193
  */
@@ -57,6 +57,20 @@ export declare const CONTROL_MS = 120;
57
57
  export declare const LEVEL_LERP = 0.25;
58
58
  /** §5.5 — a page scroll past this much closes the sheet and ducks a live reply. */
59
59
  export declare const PAGE_SCROLL_DUCK_PX = 24;
60
+ /**
61
+ * §5.3/§5.5's concierge-scroll exception — how long a flagged scroll stays
62
+ * ours.
63
+ *
64
+ * Longer than `recede.ts`'s own default window, deliberately: that one is
65
+ * sized for the few frames a bridge `navigate` emits before the document goes
66
+ * away, and a `spotlight` is a SMOOTH scroll across an arbitrary distance —
67
+ * the length of a collection page, on a slow phone. The cost of being generous
68
+ * is asymmetric and that is why it is generous: too long and the dock ignores
69
+ * one deliberate shopper scroll a second after the concierge acted; too short
70
+ * and it recedes and ducks in the middle of its own gesture, which is the
71
+ * failure the exception exists for.
72
+ */
73
+ export declare const CONCIERGE_SCROLL_WINDOW_MS = 1200;
60
74
  /** §3.3 — a downward drag past this fraction of the sheet's height dismisses it. */
61
75
  export declare const SHEET_DISMISS_FRACTION = 0.4;
62
76
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"dock-motion.d.ts","sourceRoot":"","sources":["../../src/dock/dock-motion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,OAAO,EAAqD,KAAK,SAAS,EAAE,MA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MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,OAAO,GAAG,aAAa,CA0BlE"}
@@ -1,4 +1,6 @@
1
1
  import { type CSSProperties, type ReactNode } from 'react';
2
+ import type { CallerInterruptReason } from '@saar-ai/widget-protocol/telemetry';
3
+ import type { WidgetCopyField } from '@saar-ai/widget-protocol/copy-limits';
2
4
  import { type WidgetImageAspect } from '../card-aspect.js';
3
5
  import { type WidgetMessages } from '../messages.js';
4
6
  import { type WidgetColorConfig, type WidgetTypeConfig } from '../theme/derive.js';
@@ -77,13 +79,32 @@ export interface DockLayoutView {
77
79
  */
78
80
  readonly draggable?: boolean;
79
81
  }
80
- /** The tenant's `copy[locale]` (§9.1), as the dock reads it. */
81
- export interface DockCopyView {
82
- readonly greeting?: string;
83
- readonly placeholder?: string;
84
- readonly offlineMessage?: string;
85
- readonly minimisedLabel?: string;
86
- }
82
+ /**
83
+ * The tenant's `copy[locale]` (§9.1), as the dock reads it.
84
+ *
85
+ * Field NAMES are derived from `@saar-ai/widget-protocol/copy-limits`'s
86
+ * `WidgetCopyField` here — this package's own four hand-typed lists collapse
87
+ * to one. `apps/api`'s `widgetCopySchema` (`apps/api/src/widget/dto/
88
+ * widget-config.type.ts`) and `apps/web`'s console
89
+ * (`components/widget-config/model.ts`'s `WidgetCopyDraft`) do NOT key off
90
+ * `WidgetCopyField` — corrected from an earlier version of this comment,
91
+ * which claimed they did: both are still their own hand-typed
92
+ * `z.object({greeting, placeholder, offlineMessage, minimisedLabel})`/
93
+ * interface, verified by reading each file directly. (`apps/api`'s
94
+ * `widget-config.types.ts` DOES re-export `WidgetCopyField` from this same
95
+ * package, at a different file from `widgetCopySchema` — that's what misled
96
+ * the earlier version of this comment.) A fifth and sixth copy of the same
97
+ * four names, left as they are: this package cannot import `widgetCopySchema`
98
+ * itself (a private `apps/api` zod schema; packages never depend on apps),
99
+ * so it uses `WidgetCopyField` — the zod-free, dependency-free piece of that
100
+ * contract that already lives in a package for exactly this reason (see that
101
+ * module's own doc comment) — as the closest canonical source it CAN reach,
102
+ * not as evidence the other two sites are derived from anything.
103
+ * All four stay optional here, unlike the console's `WidgetCopyDraft` (whose
104
+ * `''` empty-string default is form state, not wire shape) — an unauthored
105
+ * field is simply absent on this side.
106
+ */
107
+ export type DockCopyView = Readonly<Partial<Record<WidgetCopyField, string>>>;
87
108
  /** The voice leg, as the dock drives it. Absent ⇒ no microphone is ever drawn. */
88
109
  export interface DockVoiceProps {
89
110
  /** The tenant published voice AND this is not an embedded webview (§8.4). */
@@ -125,8 +146,20 @@ export interface DockVoiceProps {
125
146
  * The names are `@saar-ai/widget-protocol/telemetry`'s
126
147
  * `CALLER_INTERRUPT_REASONS`, which is what reaches the worker and what an
127
148
  * operator's console reads back; they are not this component's to invent.
149
+ *
150
+ * `Exclude<CallerInterruptReason, 'keyboard'>`, not the full three-value
151
+ * type, and deliberately: the dock itself only ever calls this for its own
152
+ * two native gestures, the duck (`'look'`, above) and the interrupt
153
+ * control/row tap (`'tap'`, `onControl`'s `'interrupt'` case below).
154
+ * `'keyboard'` — "switched to text mid-reply" — would have to be fired from
155
+ * wherever a typed turn is actually SUBMITTED, which is outside this
156
+ * component (`onSubmit`, wired up by whatever renders the dock); nothing in
157
+ * this package calls it today. Narrowing here keeps the callback's declared
158
+ * surface honest about what THIS component emits — widening back to the
159
+ * full union is one edit away, the same day something upstream of
160
+ * `onSubmit` actually wires a keyboard interrupt through it.
128
161
  */
129
- readonly onInterrupt?: (reason: 'look' | 'tap') => void;
162
+ readonly onInterrupt?: (reason: Exclude<CallerInterruptReason, 'keyboard'>) => void;
130
163
  /**
131
164
  * §5.1 — the duck is over: the shopper spoke, or tapped the microphone.
132
165
  * Never a timer.
@@ -291,6 +324,36 @@ export interface DockProps {
291
324
  readonly proactive?: string;
292
325
  /** §5.5 — the bridge saw the shopper move to another page. Any change closes the sheet and ducks a live reply. */
293
326
  readonly pageKey?: string | number;
327
+ /**
328
+ * §5.3/§5.5's concierge-scroll EXCEPTION: "Concierge-driven scrolls … are
329
+ * flagged and ignored." An OUT parameter — the dock writes the flag-raising
330
+ * function into `current`, and the widget calls it.
331
+ *
332
+ * Calling it says the scroll that is about to happen is OURS — a `spotlight`
333
+ * bringing a card into view — so for the next `ms` (default
334
+ * {@link CONCIERGE_SCROLL_WINDOW_MS}) the row does not recede and the sheet
335
+ * does not duck. Without the flag the dock acts on its own gesture: the
336
+ * shopper says "show me that rug", the concierge scrolls to it, and the row
337
+ * shrinks to a pill and the sheet closes at the exact moment it acted —
338
+ * which reads as the concierge walking away mid-sentence.
339
+ *
340
+ * ## Why a callback ref and not a nonce prop
341
+ *
342
+ * It was a nonce prop, bumped through `useState` immediately before the
343
+ * scroll, and that ordering was a lie: a state update is asynchronous, the
344
+ * scroll two statements later is not, and the dock's own listener captures
345
+ * on `document`. On a busy main thread the FIRST `scroll` event of a smooth
346
+ * scroll arrives before React has re-rendered, finds the flag unset, and
347
+ * ducks the sheet — the exact failure the exception exists to prevent, and
348
+ * one that only shows up under load. A function call happens now.
349
+ *
350
+ * `ms <= 0` DISARMS instead: a spotlight that found no card scrolled
351
+ * nothing, and a window left armed over a gesture that never happened would
352
+ * deafen the dock to the shopper's own next scroll for over a second.
353
+ */
354
+ readonly conciergeScrollRef?: {
355
+ current: ((ms?: number) => void) | null;
356
+ };
294
357
  /**
295
358
  * Leave the call — a different intention from muting it, and the reason it
296
359
  * is in the SHEET's header rather than in the row: §2 caps the row at three
@@ -1 +1 @@
1
- {"version":3,"file":"dock.d.ts","sourceRoot":"","sources":["../../src/dock/dock.tsx"],"names":[],"mappings":"AAEA,OAAO,EASL,KAAK,aAAa,EAClB,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAwC,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAQjG,OA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;IAEzC,4EAA4E;IAC5E,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,gBAAgB,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3D,QAAQ,CAAC,YAAY,CAAC,EAAE,UAAU,GAAG,KAAK,GAAG,IAAI,CAAC;IAClD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,MAAM,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACrD,QAAQ,CAAC,IAAI,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACxD,QAAQ,CAAC,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,YAAY,CAAA;KAAE,CAAC;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B;AAUD,qEAAqE;AACrE,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,0BAA0B,4BAA4B,CAAC;AAEpE,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,+BA89CpC;AAuMD,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,187 @@
1
+ /**
2
+ * HOST ROUTES — the merchant's own URL scheme, and the two things the widget
3
+ * does with it.
4
+ *
5
+ * ## The defect
6
+ *
7
+ * `navigate` (`apps/api/src/catalog/tools/navigate.tool.ts`) resolves every
8
+ * destination against the catalogue and spells the result the way a SHOPIFY
9
+ * storefront spells it: `/products/<handle>`, `/collections/<handle>`,
10
+ * `/search?q=`, `/cart`. That is right for the only production bridge and
11
+ * wrong for any host with a scheme of its own. The console's own demo store is
12
+ * the worked example: "take me to the rugs collection" produced
13
+ * `/collections/carpets`, the widget applied it on the console's origin, no
14
+ * such route exists there, and the console's auth gate turned the navigation
15
+ * into `/login?next=/`. Every collection navigation ejected the shopper.
16
+ *
17
+ * ## Two halves, and both are needed
18
+ *
19
+ * 1. **Rewrite** — {@link resolveHostRoutePath} turns the canonical path the
20
+ * server resolved into the path THIS host serves, using the templates the
21
+ * embed declared (`data-collection-url-template` and friends). A host that
22
+ * declared nothing is untouched, which is what keeps every Shopify
23
+ * storefront byte-identical.
24
+ * 2. **Declare** — {@link hostRouteTargets} turns the same templates into the
25
+ * capability list the widget sends on session boot, so the server can
26
+ * REFUSE a target this host cannot serve instead of emitting a path that
27
+ * ends in a 404. Without this half the concierge still says "taking you to
28
+ * the cushions" and then nothing happens; without the first half the
29
+ * declaration would be a promise the widget could not keep.
30
+ *
31
+ * The two are derived from ONE object for exactly that reason — a host that
32
+ * declares `collection` and cannot build a collection path, or builds one it
33
+ * never declared, is the bug this module's shape makes unrepresentable.
34
+ *
35
+ * ## Root-relative only, for NAVIGATION
36
+ *
37
+ * `buildProductHref` (`./cdn/core.ts`) accepts an absolute `https://` template
38
+ * because a product CARD may legitimately link to another origin. A navigation
39
+ * may not: `@saar-ai/widget-protocol`'s `SameOriginPathSchema` makes every
40
+ * server-resolved destination structurally same-origin, and a host template
41
+ * that re-opened that door would undo it at the last step. So
42
+ * {@link hostRouteResolvers} builds navigation hrefs with
43
+ * `allowAbsoluteHttps: false`, and a host whose product template is absolute
44
+ * simply does not declare `product` — its cards still link out, and the
45
+ * concierge declines to drive.
46
+ */
47
+ /**
48
+ * Backslash, every ASCII C0 control (0x00–0x1F — which includes tab, LF and
49
+ * CR), and space (0x20), as one ascending range plus the backslash.
50
+ *
51
+ * Both bypasses this closes are properties of the WHATWG URL parser rather
52
+ * than of any check below it, which is why they are rejected on the raw
53
+ * template before any prefix test runs:
54
+ *
55
+ * - **backslash** — the spec treats `\` exactly like `/` when scanning a
56
+ * special scheme's authority, so `/\evil.com/{handle}` starts with `/`,
57
+ * fails a `startsWith('//')` test, and parses identically to
58
+ * `//evil.com/{handle}`.
59
+ * - **tab/newline/CR** — the same spec STRIPS every ASCII tab and newline
60
+ * before parsing at all, so `/<TAB>/evil.com/{handle}` also starts with
61
+ * `/`, contains no backslash, and becomes protocol-relative once the
62
+ * browser is done with it. A raw space goes for the same class of reason.
63
+ *
64
+ * `eslint-disable-next-line no-control-regex` — the control range is the
65
+ * entire point of this pattern, not an accidental literal.
66
+ */
67
+ export declare const UNSAFE_TEMPLATE_CHARS: RegExp;
68
+ /**
69
+ * Turn a merchant-declared URL template into a one-argument href builder, or
70
+ * `undefined` when the template is not safe to use. Never throws — a malformed
71
+ * or hostile template degrades to "this host declares no such route" rather
72
+ * than reaching a `location.assign` unvalidated.
73
+ *
74
+ * Four rules, all required:
75
+ *
76
+ * - **carries the literal placeholder.** A template with nothing to
77
+ * substitute is not a per-entity template at all (probably a typo'd
78
+ * attribute), and building hrefs that all point at the same URL is worse
79
+ * than building none.
80
+ * - **contains none of {@link UNSAFE_TEMPLATE_CHARS}**, ahead of the prefix
81
+ * check so a hostile template never reaches it.
82
+ * - **starts with `/` and is not protocol-relative** — or, when
83
+ * `allowAbsoluteHttps`, with `https://`. This is the one thing standing
84
+ * between a merchant-configured attribute and a URL a shopper's browser
85
+ * will follow: `javascript:` executes script, `data:` can spoof a page, and
86
+ * a bare `//evil.com/{handle}` silently sends the shopper to another
87
+ * origin.
88
+ * - **the substituted value is `encodeURIComponent`-ed**, so a handle or a
89
+ * search query containing `/`, `?`, `#` or `&` cannot smuggle extra path
90
+ * segments or query parameters into the built href.
91
+ *
92
+ * @param template the merchant's template, verbatim from the embed attribute
93
+ * @param placeholder the literal token to substitute (`{handle}`, `{query}`)
94
+ * @param allowAbsoluteHttps whether an `https://…` template is acceptable —
95
+ * true for a card link, false for a navigation (see the module doc comment)
96
+ */
97
+ export declare function buildTemplateHref(template: string, placeholder: string, allowAbsoluteHttps: boolean): ((value: string) => string) | undefined;
98
+ /**
99
+ * The scheme half of {@link buildTemplateHref}'s rules, on its own — for the
100
+ * one declared route that substitutes nothing (the cart page). Exported so
101
+ * "is this merchant-supplied path safe to send a browser to" has exactly one
102
+ * spelling, rather than a second, subtly different copy for the placeholder-
103
+ * less case.
104
+ *
105
+ * @param template the merchant-supplied template or path
106
+ * @param allowAbsoluteHttps whether an `https://…` value is acceptable
107
+ */
108
+ export declare function isSafeHrefTemplate(template: string, allowAbsoluteHttps: boolean): boolean;
109
+ /**
110
+ * The merchant's declared URL scheme, as builders. Every member optional: a
111
+ * host declares what it has, and an absent member is a target the concierge
112
+ * will be told it cannot reach.
113
+ */
114
+ export interface HostRouteResolvers {
115
+ /** `/shop/p/{handle}` → a builder taking a product handle. */
116
+ readonly product?: (handle: string) => string;
117
+ /** `/shop/c/{handle}` → a builder taking a collection handle. */
118
+ readonly collection?: (handle: string) => string;
119
+ /** `/shop/search?query={query}` → a builder taking the shopper's own text. */
120
+ readonly search?: (query: string) => string;
121
+ /** The host's cart PAGE, as a root-relative path. A cart drawer is not a page and must not be declared. */
122
+ readonly cart?: string;
123
+ }
124
+ /** The embed's raw declaration — every field exactly as it came off the `<script>` tag, unvalidated. */
125
+ export interface HostRouteTemplates {
126
+ readonly product?: string | null;
127
+ readonly collection?: string | null;
128
+ readonly search?: string | null;
129
+ readonly cart?: string | null;
130
+ }
131
+ /**
132
+ * Build the resolvers from the raw embed attributes, or `undefined` when this
133
+ * host is not declaring a scheme at all.
134
+ *
135
+ * **What counts as declaring is deliberately narrow**: any of `collection`,
136
+ * `search` or `cart`. `product` alone does NOT, because
137
+ * `data-product-url-template` predates this feature by many releases and means
138
+ * "link my cards" — a merchant who set only that one has said nothing about
139
+ * navigation, and reading it as a narrowing would silently stop their
140
+ * concierge from navigating anywhere. The demo store sets a collection
141
+ * template, so it declares; a Shopify storefront sets none of the three, so it
142
+ * does not, and nothing about it changes.
143
+ *
144
+ * @param templates the raw attribute values
145
+ */
146
+ export declare function hostRouteResolvers(templates: HostRouteTemplates): HostRouteResolvers | undefined;
147
+ /** The navigation targets, in the vocabulary `@saar-ai/widget-protocol`'s `HostRoutes` uses. Spelt as literals, so `ui`/`core` never pull the zod-backed protocol module in for a string. */
148
+ export type HostRouteTarget = 'product' | 'collection' | 'search' | 'cart' | 'url';
149
+ /**
150
+ * What to declare to the server on session boot, or `undefined` when this host
151
+ * declares nothing (⇒ the field is omitted, and the server keeps its Shopify
152
+ * assumption).
153
+ *
154
+ * `'url'` is never declared. That target exists so a model can name a
155
+ * storefront path directly, and a host with a scheme of its own has no closed
156
+ * route list the server could check such a path against — so on a declaring
157
+ * host it is refused outright rather than allowed to become the one hole every
158
+ * other narrowing here would leave.
159
+ *
160
+ * @param routes the resolvers, from {@link hostRouteResolvers}
161
+ */
162
+ export declare function hostRouteTargets(routes: HostRouteResolvers | undefined): readonly HostRouteTarget[] | undefined;
163
+ /**
164
+ * Rewrite a server-resolved destination into the path THIS host serves.
165
+ *
166
+ * Three answers, and the difference between the last two is the whole point:
167
+ *
168
+ * - the path itself — this host declared nothing, so the server's Shopify
169
+ * spelling is the right one and nothing is rewritten;
170
+ * - a rewritten path — the host declared this target and the destination
171
+ * matched its shape;
172
+ * - `null` — this host cannot serve the destination, so NOTHING should
173
+ * happen. The caller reports a failed navigate rather than assigning a URL
174
+ * the host will 404 (or, on the console, bounce to a login page).
175
+ *
176
+ * `null` for a declared target whose path does not match the expected shape is
177
+ * deliberate rather than a fallthrough to the raw path: a `product` target
178
+ * carrying something that is not `/products/<handle>` is a destination this
179
+ * function does not understand, and passing an un-rewritten Shopify path to a
180
+ * host that just told us it has no Shopify routes is precisely the defect.
181
+ *
182
+ * @param url the server-resolved, root-relative destination
183
+ * @param target which kind of destination the server said it was
184
+ * @param routes this host's declared scheme, or `undefined`
185
+ */
186
+ export declare function resolveHostRoutePath(url: string, target: HostRouteTarget | undefined, routes: HostRouteResolvers | undefined): string | null;
187
+ //# sourceMappingURL=host-routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-routes.d.ts","sourceRo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AAgB,kBAAkB,CAAC,SAAS,EAAE,kBAAkB,GAAG,kBAAkB,GAAG,SAAS,CAuBhG;AAED,6LAA6L;AAC7L,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,CAAC;AAEnF;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,kBAAkB,GAAG,SAAS,GACrC,SAAS,eAAe,EAAE,GAAG,SAAS,CAQxC;AAsCD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,eAAe,GAAG,SAAS,EACnC,MAAM,EAAE,kBAAkB,GAAG,SAAS,GACrC,MAAM,GAAG,IAAI,CAsCf"}
@@ -1,6 +1,7 @@
1
- import type { CartSnapshot, HostBridge } from '@saar-ai/widget-bridge';
1
+ import type { CartSnapshot, HostBridge, SiteProfile } from '@saar-ai/widget-bridge';
2
2
  import type { VisitorEventCollector } from '@saar-ai/widget-bridge';
3
3
  import type { WidgetChatCart } from '@saar-ai/widget-protocol/chat';
4
+ import { type HostRouteResolvers } from './host-routes.js';
4
5
  import { type ChatCardItem, type ChatCheckoutHandoff } from './use-chat-session.js';
5
6
  import { type VoiceSession } from './use-voice-session.js';
6
7
  import type { WidgetCartLine } from './widget-cart-summary.js';
@@ -259,6 +260,18 @@ export interface ConciergeWidgetProps {
259
260
  * and carries a full text conversation.
260
261
  */
261
262
  readonly bridge?: HostBridge;
263
+ /**
264
+ * The tenant's us-authored site profile (docs/WIDGET_EMBED_PLAN.md §5.3),
265
+ * served inside `PublicWidgetConfig`. Only `productCard` is read here, and
266
+ * only by `spotlight`: it is what tells the widget which elements on THIS
267
+ * merchant's page are product cards and which attribute carries their id.
268
+ *
269
+ * Absent ⇒ the shipped default ladder (`.product-card, [data-product-id]`,
270
+ * then a `/products/<handle>` link), which is what every storefront we have
271
+ * seen actually emits. A profile is the escape hatch for the one that does
272
+ * not, and a merchant still writes no code for it.
273
+ */
274
+ readonly siteProfile?: SiteProfile;
262
275
  /** Wires the visitor-event pipeline — see `use-chat-session.ts`'s `collector` option. */
263
276
  readonly collector?: VisitorEventCollector;
264
277
  /** Defaults to the package's brand-neutral fallback — see `messages.ts`. */
@@ -289,6 +302,22 @@ export interface ConciergeWidgetProps {
289
302
  readonly locale?: string;
290
303
  /** Builds a product card's PDP href from its handle — also feeds the `addToCart` degraded path, see `resolveAddToCartHandler`. */
291
304
  readonly productHref?: (handle: string) => string;
305
+ /**
306
+ * This host's OWN navigation scheme — see `./host-routes.ts` for the defect
307
+ * it exists for (a demo storefront whose every collection navigation bounced
308
+ * the shopper to a login page).
309
+ *
310
+ * Two things follow from it, and both have to, which is why it is one prop
311
+ * rather than two: the concierge's destinations are REWRITTEN into this
312
+ * host's paths before the bridge is asked to navigate, and the same set is
313
+ * DECLARED to the api on session boot so a target this host cannot serve is
314
+ * refused before an event is ever produced.
315
+ *
316
+ * Absent — the default, and every host that predates this — means "spell
317
+ * destinations the way a Shopify storefront spells them", which is exactly
318
+ * what the widget did before.
319
+ */
320
+ readonly hostRoutes?: HostRouteResolvers;
292
321
  /** Builds a truncated curation's "See all N" href. */
293
322
  readonly curationHref?: (curationId: string) => string;
294
323
  /**
@@ -435,5 +464,5 @@ export interface ConciergeWidgetProps {
435
464
  * about offering voice here costs a byte until a caller actually presses
436
465
  * the microphone.
437
466
  */
438
- export declare function ConciergeWidget({ embedKey, apiBase, socketUrl, socketPath, bridge, collector, messages, locale, productHref, curationHref, brandPrimary, brandSecondary, brandAccent, avatar, attribution, color, type, identity, layout, copy, bottomOffset, showPrice, cardImageAspect, voiceAvailable, direction, proactive, initialDraft, initialSelection, initialFocus, initialMinimised, insets, hold, audio, onReady, }: ConciergeWidgetProps): import("react").JSX.Element;
467
+ export declare function ConciergeWidget({ embedKey, apiBase, socketUrl, socketPath, bridge, siteProfile, collector, messages, locale, productHref, hostRoutes, curationHref, brandPrimary, brandSecondary, brandAccent, avatar, attribution, color, type, identity, layout, copy, bottomOffset, showPrice, cardImageAspect, voiceAvailable, direction, proactive, initialDraft, initialSelection, initialFocus, initialMinimised, insets, hold, audio, onReady, }: ConciergeWidgetProps): import("react").JSX.Element;
439
468
  //# sourceMappingURL=host-widget.d.ts.map