@saar-ai/web-widget 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{chat-e1afSRBr.js → chat-CU9VPqVO.js} +260 -37
- package/dist/chunks/{host-widget-Ce-l1xu1.js → host-widget-BtiYIMwb.js} +5638 -350
- package/dist/chunks/{schemas-D-uDc-9q.js → schemas-YN3wGSGZ.js} +7 -4
- package/dist/chunks/{telemetry-CBblNC6C.js → telemetry-B1xBTk1s.js} +16 -1
- package/dist/dock/dock-drag.d.ts +5 -5
- package/dist/dock/dock-drag.d.ts.map +1 -1
- package/dist/dock/dock-float.d.ts +116 -0
- package/dist/dock/dock-float.d.ts.map +1 -0
- package/dist/dock/dock-motion.d.ts +61 -6
- package/dist/dock/dock-motion.d.ts.map +1 -1
- package/dist/dock/dock-pill.d.ts +18 -1
- package/dist/dock/dock-pill.d.ts.map +1 -1
- package/dist/dock/dock-row.d.ts +128 -10
- package/dist/dock/dock-row.d.ts.map +1 -1
- package/dist/dock/dock-sheet.d.ts.map +1 -1
- package/dist/dock/dock-state.d.ts +129 -9
- package/dist/dock/dock-state.d.ts.map +1 -1
- package/dist/dock/dock.d.ts +137 -25
- package/dist/dock/dock.d.ts.map +1 -1
- package/dist/dock/geometry.d.ts +129 -3
- package/dist/dock/geometry.d.ts.map +1 -1
- package/dist/generated/widget-css.d.ts.map +1 -1
- package/dist/host-routes.d.ts +187 -0
- package/dist/host-routes.d.ts.map +1 -0
- package/dist/host-widget.d.ts +78 -2
- package/dist/host-widget.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3889
- package/dist/messages.d.ts +88 -1
- package/dist/messages.d.ts.map +1 -1
- package/dist/mount.d.ts +10 -1
- package/dist/mount.d.ts.map +1 -1
- package/dist/next/index.js +1 -1
- package/dist/rope-knot.d.ts +67 -0
- package/dist/rope-knot.d.ts.map +1 -1
- package/dist/theme/derive.d.ts +1 -1
- package/dist/theme/derive.d.ts.map +1 -1
- package/dist/use-chat-session.d.ts +87 -33
- package/dist/use-chat-session.d.ts.map +1 -1
- package/dist/use-voice-session.d.ts +13 -8
- package/dist/use-voice-session.d.ts.map +1 -1
- package/dist/voice-widget.d.ts +22 -1
- package/dist/voice-widget.d.ts.map +1 -1
- package/dist/widget-cards.d.ts +21 -1
- package/dist/widget-cards.d.ts.map +1 -1
- package/dist/widget-cart-summary.d.ts +10 -1
- package/dist/widget-cart-summary.d.ts.map +1 -1
- package/dist/widget.css +1 -1
- package/package.json +7 -3
- package/src/styles/concierge.css +528 -65
- package/src/styles/dock-surface.css +284 -0
- package/src/styles/tokens.css +22 -6
- package/src/styles/widget-entry.css +3 -0
package/dist/messages.d.ts
CHANGED
|
@@ -90,7 +90,12 @@ export interface WidgetMessages {
|
|
|
90
90
|
* | `dock_cards` | `cards` — carries `{count}` |
|
|
91
91
|
* | `dock_voice_failed` | a voice CONNECT that failed — the one line a shopper can act on |
|
|
92
92
|
* | `dock_show_transcript` | §3.4 — the sheet's header, voice sessions only |
|
|
93
|
-
* | `dock_show_conversation` | §3.
|
|
93
|
+
* | `dock_show_conversation` | §3.5 — the float's accessible name: pressing it opens the visor |
|
|
94
|
+
* | `dock_unread` | §3.2 — appended to the pill's name while the unread dot shows |
|
|
95
|
+
* | `dock_float_you` | §3.5 — the float's speaker label on the shopper's own line |
|
|
96
|
+
* | `dock_float_dismiss` | §3.5 — the float's own close control |
|
|
97
|
+
* | `dock_minimise_dock` | §5.4 — what pressing the MARK does: collapse the row to the pill |
|
|
98
|
+
* | `dock_hide_conversation` | §3.3 — the visor's X: closes the visor, and nothing else |
|
|
94
99
|
* | `dock_earbuds` | §8.7 — offered once per session on a headset connect |
|
|
95
100
|
*/
|
|
96
101
|
readonly dock_connecting?: string;
|
|
@@ -128,6 +133,53 @@ export interface WidgetMessages {
|
|
|
128
133
|
*/
|
|
129
134
|
readonly dock_show_conversation?: string;
|
|
130
135
|
readonly dock_earbuds?: string;
|
|
136
|
+
/**
|
|
137
|
+
* §3.2 (added 2026-09-15) — the notification dot's words. The dot is
|
|
138
|
+
* colour and shape only, so its meaning reaches a screen reader as a
|
|
139
|
+
* suffix on the pill's accessible name.
|
|
140
|
+
*/
|
|
141
|
+
readonly dock_unread?: string;
|
|
142
|
+
/**
|
|
143
|
+
* §3.5 (added 2026-09-15) — the float's speaker label on the SHOPPER's own
|
|
144
|
+
* line. The concierge's lines carry its name instead, which is the
|
|
145
|
+
* tenant's and needs no key.
|
|
146
|
+
*/
|
|
147
|
+
readonly dock_float_you?: string;
|
|
148
|
+
/**
|
|
149
|
+
* §3.5 (added 2026-09-16) — the float's own dismiss control.
|
|
150
|
+
*
|
|
151
|
+
* The float no longer times out or hides on a scroll, so it needs a way
|
|
152
|
+
* out that the shopper chooses. One word, because it sits on a 44 px target
|
|
153
|
+
* inside a two-line surface and the WORDS are only ever read aloud — what
|
|
154
|
+
* is drawn is a glyph.
|
|
155
|
+
*/
|
|
156
|
+
readonly dock_float_dismiss?: string;
|
|
157
|
+
/**
|
|
158
|
+
* §5.4 (added 2026-09-16) — the ACTION half of the mark's accessible name.
|
|
159
|
+
*
|
|
160
|
+
* The mark announces the session's state (`state_idle` / `state_listening`)
|
|
161
|
+
* and now also collapses the dock, so the name is "<state>, <action>": a
|
|
162
|
+
* screen-reader user who cannot see the row shrink has no other way to tell
|
|
163
|
+
* that pressing the avatar puts the concierge away. Distinct from
|
|
164
|
+
* `minimize`, which names the visor header's chevron — the two controls
|
|
165
|
+
* reach the same pill but from different surfaces, and a tenant translating
|
|
166
|
+
* them may well want different words.
|
|
167
|
+
*/
|
|
168
|
+
readonly dock_minimise_dock?: string;
|
|
169
|
+
/**
|
|
170
|
+
* §3.3 (added 2026-09-16) — the visor's own close control, the X at the
|
|
171
|
+
* inline end of its top bar.
|
|
172
|
+
*
|
|
173
|
+
* Distinct from `minimize` and from `dock_minimise_dock`, and the
|
|
174
|
+
* distinction is the whole point of the key existing. Those two put the
|
|
175
|
+
* CONCIERGE away: the row collapses to the pill and the session goes with
|
|
176
|
+
* it. This one closes the VISOR and leaves the row exactly where it was,
|
|
177
|
+
* which is what an X on a panel means everywhere else and what the header's
|
|
178
|
+
* chevron wrongly did not do until 2026-09-16. A tenant translating the
|
|
179
|
+
* three needs three strings, because in most languages "hide this panel"
|
|
180
|
+
* and "put the assistant away" are not the same verb.
|
|
181
|
+
*/
|
|
182
|
+
readonly dock_hide_conversation?: string;
|
|
131
183
|
/**
|
|
132
184
|
* The handoff MARKER — the quiet inline divider in the transcript at the
|
|
133
185
|
* point the conversation was handed to a person. Past tense on purpose: it
|
|
@@ -182,6 +234,13 @@ export interface WidgetMessages {
|
|
|
182
234
|
readonly see_all: string;
|
|
183
235
|
readonly cart_summary_title: string;
|
|
184
236
|
readonly cart_summary_total: string;
|
|
237
|
+
/**
|
|
238
|
+
* The cart summary's discount row label (SAA-174) — shown when the
|
|
239
|
+
* storefront's total is below its own line prices, as it is for a Shopify
|
|
240
|
+
* basket with a discount applied. Optional, like every key added after
|
|
241
|
+
* 0.2.0 (see `handoff_event` above for the compatibility contract).
|
|
242
|
+
*/
|
|
243
|
+
readonly cart_summary_discounts?: string;
|
|
185
244
|
readonly checkout_now: string;
|
|
186
245
|
readonly checkout_failed: string;
|
|
187
246
|
/**
|
|
@@ -228,6 +287,34 @@ export interface WidgetMessages {
|
|
|
228
287
|
* Optional for the same published-interface reason as `handoff_event`.
|
|
229
288
|
*/
|
|
230
289
|
readonly voice_unavailable_escalated?: string;
|
|
290
|
+
/**
|
|
291
|
+
* SAA-175 — the control a product card draws INSTEAD of "Add to cart" when
|
|
292
|
+
* the product has more than one sellable variant
|
|
293
|
+
* (`WidgetChatCard.variantChoiceRequired`). The shopper has not picked a
|
|
294
|
+
* size or colour, so a one-press add would put a variant they never chose in
|
|
295
|
+
* the basket.
|
|
296
|
+
*
|
|
297
|
+
* - `choose_options` — the visible button text.
|
|
298
|
+
* - `choose_options_label` — its accessible name; `{title}` is the card's
|
|
299
|
+
* product title, so a screen reader hears WHICH product the control is
|
|
300
|
+
* for rather than several identical "Choose options" buttons.
|
|
301
|
+
*
|
|
302
|
+
* There is deliberately no key for what the press SENDS: it is a typed
|
|
303
|
+
* `variant_choice_request` storefront report, and the server composes the
|
|
304
|
+
* model's line. No widget copy reaches the model.
|
|
305
|
+
*
|
|
306
|
+
* Optional for the same published-interface reason as `handoff_event`.
|
|
307
|
+
*/
|
|
308
|
+
readonly choose_options?: string;
|
|
309
|
+
readonly choose_options_label?: string;
|
|
310
|
+
/**
|
|
311
|
+
* SAA-175 — the notice shown when "Choose options" is pressed during a live
|
|
312
|
+
* call. The question is held until the call ends (a typed turn mid-call
|
|
313
|
+
* would be answered over the caller), so the shopper is told it is coming
|
|
314
|
+
* rather than seeing the button re-arm with nothing happening. Optional for
|
|
315
|
+
* the same published-interface reason as `handoff_event`.
|
|
316
|
+
*/
|
|
317
|
+
readonly choose_options_after_call?: string;
|
|
231
318
|
}
|
|
232
319
|
/**
|
|
233
320
|
* Message keys that carry a `{product}` placeholder — the avatar's
|
package/dist/messages.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/messages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IA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,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,CAGhG"}
|
package/dist/mount.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { type ConciergeWidgetProps } from './host-widget.js';
|
|
2
2
|
export interface MountedWidget {
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Unmounts the React tree and detaches nothing else — the shadow root stays
|
|
5
|
+
* on `host` (removing it is the caller's own DOM to own).
|
|
6
|
+
*
|
|
7
|
+
* CALL IT. Removing `host` from the document is NOT equivalent: detaching
|
|
8
|
+
* leaves the tree mounted, so `useChatSession`'s refresh timer, its polling
|
|
9
|
+
* loop, its desk socket and every listener the dock attached keep running
|
|
10
|
+
* for the life of the page. A host that mounts and removes the widget across
|
|
11
|
+
* route changes accumulates one live widget per route.
|
|
12
|
+
*/
|
|
4
13
|
unmount(): void;
|
|
5
14
|
}
|
|
6
15
|
/**
|
package/dist/mount.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG9E,MAAM,WAAW,aAAa;IAC5B
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../src/mount.ts"],"names":[],"mappings":"AAIA,OAAO,EAAmB,KAAK,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG9E,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;OASG;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,WAAW,EACjB,KAAK,EAAE,oBAAoB,GAC1B,aAAa,CAqCf;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAiB9D"}
|
package/dist/next/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { _ as detectPage, r as ConciergeWidget } from "../chunks/host-widget-BtiYIMwb.js";
|
|
2
2
|
import { useCallback, useEffect, useMemo, useRef } from "react";
|
|
3
3
|
import { usePathname, useRouter } from "next/navigation";
|
|
4
4
|
//#region src/next/use-next-bridge.ts
|
package/dist/rope-knot.d.ts
CHANGED
|
@@ -1,4 +1,71 @@
|
|
|
1
1
|
import type { BotState } from './bot-state.js';
|
|
2
|
+
/**
|
|
3
|
+
* The `'knot'` avatar — a single hand-drawn line that loops through itself
|
|
4
|
+
* into a knot, in the two sizes the widget uses (`sm` trigger, `lg` panel
|
|
5
|
+
* orb-slot) and the same four {@link BotState}s `BotFace` (the `'orb'`
|
|
6
|
+
* avatar) renders. Selected per tenant via `appearance.avatar` — see
|
|
7
|
+
* `avatar.ts` — and otherwise a drop-in for `BotFace` at every call site:
|
|
8
|
+
* same `state`/`size`/`label` contract, same `labelProps` accessibility rule
|
|
9
|
+
* (imported from `bot-face.tsx` rather than redeclared).
|
|
10
|
+
*
|
|
11
|
+
* Ported from the Lovable prototype's `RopeKnot.tsx`.
|
|
12
|
+
*
|
|
13
|
+
* ## Why the colour vars are declared HERE, not in `concierge.css`
|
|
14
|
+
*
|
|
15
|
+
* The rope's colour is never hardcoded — `--knot-ink` and its
|
|
16
|
+
* `-faint`/`-halo`/`-surface` derivatives alias `--brand-plum`, the same
|
|
17
|
+
* tenant-config-driven variable `BotFace`'s gradient reads. They used to
|
|
18
|
+
* live in a `:root { --knot-ink: var(--brand-plum, …); … }` block in
|
|
19
|
+
* `concierge.css`, which was broken two ways at once: `:root` matches
|
|
20
|
+
* nothing inside the CDN embed's shadow tree (the tenant's brand colours
|
|
21
|
+
* never reach a shadow-mounted widget at all), and even in light DOM, a
|
|
22
|
+
* `--x: var(--y)` declaration resolves `var(--y)` using the DECLARING
|
|
23
|
+
* element's own cascade AT THAT MOMENT — `:root` has no tenant override on
|
|
24
|
+
* it, that override lives on a DESCENDANT (`ConciergeShell`'s
|
|
25
|
+
* `skinStyle`-carrying wrapper), so every tenant silently got the built-in
|
|
26
|
+
* plum default regardless of what they published.
|
|
27
|
+
*
|
|
28
|
+
* `RopeKnotFrame`'s own root div is always rendered somewhere INSIDE that
|
|
29
|
+
* `skinStyle` wrapper (`ConciergeShell` renders both the panel orb and,
|
|
30
|
+
* via `ConciergeLauncher`, the collapsed pill, and both sit inside the one
|
|
31
|
+
* `<div data-skin style={skinStyle}>` root). Declaring the vars on THIS
|
|
32
|
+
* element via inline `style` means `var(--brand-plum, …)` resolves using
|
|
33
|
+
* THIS element's own cascade — which, by the time render reaches here, has
|
|
34
|
+
* already inherited whatever override the ancestor set. Everything BELOW
|
|
35
|
+
* this div (the halo, the svg, the drawn path) then just inherits the
|
|
36
|
+
* already-resolved values normally, in both light and shadow DOM, no
|
|
37
|
+
* selector needed at all. Same fix `concierge.css`'s own `@theme inline`
|
|
38
|
+
* block uses for `--color-brand-plum` (see that block's doc comment) —
|
|
39
|
+
* "resolve where it's used," not "resolve once at the top."
|
|
40
|
+
*
|
|
41
|
+
* ## The crossfade
|
|
42
|
+
*
|
|
43
|
+
* Every state change freezes the `stroke-dasharray` the rope was showing —
|
|
44
|
+
* read directly off the live element via `getComputedStyle` at the instant
|
|
45
|
+
* the state actually changes — into `--rk-from`, then remounts the drawn
|
|
46
|
+
* path so the incoming state's `rk-blend-to-*` animation eases OUT of that
|
|
47
|
+
* exact shape instead of snapping back to the self-tying intro. This is a
|
|
48
|
+
* single synchronous read inside the state-change effect, not a polling
|
|
49
|
+
* loop: a CSS animation keeps an element's OWN computed style live at every
|
|
50
|
+
* instant, so there is nothing to gain by sampling continuously, and a
|
|
51
|
+
* `requestAnimationFrame` loop that ran forever — for the life of the
|
|
52
|
+
* component, including a launcher pill that never leaves `state="idle"` and
|
|
53
|
+
* can never blend at all, and regardless of `prefers-reduced-motion`, where
|
|
54
|
+
* the dash never even changes — was a real cost on a merchant's page for no
|
|
55
|
+
* benefit.
|
|
56
|
+
*/
|
|
57
|
+
/**
|
|
58
|
+
* The knot itself, in a 100 × 100 box with `pathLength={100}`.
|
|
59
|
+
*
|
|
60
|
+
* EXPORTED, and this is the copy the `ui` bundle keeps: `dock-row.tsx` drew
|
|
61
|
+
* the same string again for the mark's `knot` avatar, which made three copies
|
|
62
|
+
* counting `cdn/dock-dom.ts`'s — and that file's own comment names a third
|
|
63
|
+
* copy as the signal to extract. Two of the three ship in the SAME chunk, so
|
|
64
|
+
* there is no bundling reason for them to be apart; `dock-dom.ts` keeps its
|
|
65
|
+
* copy on purpose, because `core` is a separate artefact with its own budget
|
|
66
|
+
* and importing this module would drag the whole rope into it.
|
|
67
|
+
*/
|
|
68
|
+
export declare const KNOT_PATH = "M2 54 C15 54 24 55 31 53 C40 50 44 40 54 41 C64 42 67 51 60 57 C52 64 38 64 33 57 C29 51 34 45 42 46 C50 47 58 52 68 53.5 C80 55 90 54 98 54";
|
|
2
69
|
type Size = 'sm' | 'lg';
|
|
3
70
|
export interface RopeKnotProps {
|
|
4
71
|
state?: BotState;
|
package/dist/rope-knot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rope-knot.d.ts","sourceRoot":"","sources":["../src/rope-knot.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"rope-knot.d.ts","sourceRoot":"","sources":["../src/rope-knot.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,iJAC0H,CAAC;AAuCjJ,KAAK,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAExB,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sFAAsF;IACtF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,QAAQ,CAAC,EAAE,KAAc,EAAE,IAAW,EAAE,KAAK,EAAE,UAAc,EAAE,EAAE,aAAa,+BA2B7F"}
|
package/dist/theme/derive.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface WidgetTypeConfig {
|
|
|
20
20
|
* is part of the contract: `themeToCss`'s output is snapshotted, and a reader
|
|
21
21
|
* comparing a rendered block against the spec table should not have to sort.
|
|
22
22
|
*/
|
|
23
|
-
export declare const WIDGET_THEME_TOKENS: readonly ['--wgt-primary', '--wgt-on-primary', '--wgt-
|
|
23
|
+
export declare const WIDGET_THEME_TOKENS: readonly ['--wgt-primary', '--wgt-on-primary', '--wgt-surface', '--wgt-surface-2', '--wgt-surface-glass', '--wgt-surface-glass-blurred', '--wgt-surface-veil', '--wgt-glass-tune', '--wgt-text', '--wgt-text-muted', '--wgt-border', '--wgt-ring', '--wgt-radius', '--wgt-row-radius', '--wgt-sheet-radius', '--wgt-card-radius', '--wgt-font', '--wgt-caps'];
|
|
24
24
|
export type WidgetThemeVar = (typeof WIDGET_THEME_TOKENS)[number];
|
|
25
25
|
export type WidgetThemeVars = Record<WidgetThemeVar, string>;
|
|
26
26
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../src/theme/derive.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../src/theme/derive.ts"],"names":[],"mappings":"AAyCA,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AACnD,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC9C,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EAAE,iBAAiB,EAAE,IAAI,EAAE,gBAAgB,GAAG,kBAAkB,CA2BhG;AAOD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,kBAAkB,EAAE,QAAQ,SAAU,GAAG,MAAM,CAMhF;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAEhE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PageContext, VisitorEventCollector } from '@saar-ai/widget-bridge';
|
|
2
|
-
import type { WidgetChatCart, WidgetChatReport } from '@saar-ai/widget-protocol/chat';
|
|
2
|
+
import type { WidgetChatCard, WidgetChatCart, WidgetChatReport } from '@saar-ai/widget-protocol/chat';
|
|
3
3
|
import type { WidgetActEvent } from '@saar-ai/widget-protocol/act';
|
|
4
4
|
/**
|
|
5
5
|
* Is `value` a root-relative, same-origin storefront path?
|
|
@@ -128,37 +128,42 @@ export type ChatStatus = 'idle' | 'streaming' | 'escalated' | 'error';
|
|
|
128
128
|
* or the handshake was refused); poll restores to its normal cadence.
|
|
129
129
|
*/
|
|
130
130
|
export type ChatConnectionState = 'idle' | 'connecting' | 'connected' | 'disconnected';
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
131
|
+
/**
|
|
132
|
+
* The UI's own name for one product/curation card, as it renders it.
|
|
133
|
+
*
|
|
134
|
+
* An ALIAS of `@saar-ai/widget-protocol/chat`'s `WidgetChatCard` — the wire
|
|
135
|
+
* shape the server already validated before this ever reaches the widget —
|
|
136
|
+
* not a hand-maintained retyping. The two used to drift silently: a field
|
|
137
|
+
* added to the wire schema (`WidgetChatCardSchema`) would type-check here
|
|
138
|
+
* with no error, and the card renderer would just never see it. `variantId`
|
|
139
|
+
* is the INTERNAL catalog UUID (`curation_items.variant_id`) — never a
|
|
140
|
+
* platform id; see `platformVariantId` for what `addToCart` actually needs.
|
|
141
|
+
*
|
|
142
|
+
* `platformVariantId` is the PLATFORM-NATIVE variant id (e.g. Shopify's
|
|
143
|
+
* numeric `/cart/add.js` id, extracted server-side from the variant's
|
|
144
|
+
* provider GID via `apps/api/src/catalog/checkout-permalink.ts`'s
|
|
145
|
+
* `parseShopifyVariantNumericId` — the SAME parser the checkout permalink
|
|
146
|
+
* uses, never a client-side string-slice of `variantId`).
|
|
147
|
+
* `resolveAddToCartHandler` (`host-widget.tsx`) calls `bridge.addToCart` with
|
|
148
|
+
* THIS field, never `variantId` — adversarial-review finding #2: the
|
|
149
|
+
* internal UUID is meaningless to `ShopifyBridge`'s `POST /cart/add.js`,
|
|
150
|
+
* which needs Shopify's own numeric id. Absent whenever the underlying
|
|
151
|
+
* variant's external id isn't a recognised platform GID (§5.3's "degrade,
|
|
152
|
+
* never fabricate" — never guessed from `variantId`) — in that case the
|
|
153
|
+
* widget offers no add-to-cart action for this card and falls back to a PDP
|
|
154
|
+
* navigation instead, same as a card with no `handle` at all falling back to
|
|
155
|
+
* nothing.
|
|
156
|
+
*
|
|
157
|
+
* `Readonly<...>`, not the bare alias — `WidgetChatCard` is `z.infer<...>`
|
|
158
|
+
* and carries no `readonly` modifiers (zod does not emit them), but the
|
|
159
|
+
* interface this replaced marked every field `readonly` and callers hold
|
|
160
|
+
* `ChatCardItem[]` buffers (`host-widget.tsx`'s pending-cart-add and
|
|
161
|
+
* cards-by-turn maps) that were never meant to be mutated in place. Dropping
|
|
162
|
+
* that annotation silently was caught by adversarial review, not intended —
|
|
163
|
+
* `Readonly<WidgetChatCard>` restores it while staying a real alias: any
|
|
164
|
+
* field the wire schema adds still flows through with no edit here.
|
|
165
|
+
*/
|
|
166
|
+
export type ChatCardItem = Readonly<WidgetChatCard>;
|
|
162
167
|
export interface ChatCards {
|
|
163
168
|
readonly curationId?: string;
|
|
164
169
|
readonly items: readonly ChatCardItem[];
|
|
@@ -247,6 +252,30 @@ export interface ChatTurn {
|
|
|
247
252
|
readonly cards?: ChatCards;
|
|
248
253
|
/** Files carried on THIS turn, either direction. Empty/absent for a turn with none. */
|
|
249
254
|
readonly attachments?: readonly ChatAttachment[];
|
|
255
|
+
/**
|
|
256
|
+
* The display name of the HUMAN who wrote this reply — see
|
|
257
|
+
* {@link PolledTurn.operatorName} for where it comes from and why its
|
|
258
|
+
* absence is the normal case rather than an error.
|
|
259
|
+
*
|
|
260
|
+
* Carried through to the renderer so the widget can say who is talking
|
|
261
|
+
* after a handoff (DOCK_SPEC §2, §3.5, §5.1's `human` row). Never derived
|
|
262
|
+
* here: a turn either arrived with a name or it did not.
|
|
263
|
+
*/
|
|
264
|
+
readonly operatorName?: string;
|
|
265
|
+
/**
|
|
266
|
+
* The server's own position for this turn (`turns.seq`), present only on a
|
|
267
|
+
* turn that ARRIVED from the server — the poll or the socket push.
|
|
268
|
+
*
|
|
269
|
+
* Absent on everything created locally: the shopper's own bubble at send
|
|
270
|
+
* time, the streamed agent bubble, and the handoff marker. That absence is
|
|
271
|
+
* meaningful rather than incidental, and `insertBySeq` reads it as one —
|
|
272
|
+
* those rows have no server position, so they are fixed points that an
|
|
273
|
+
* out-of-order arrival may not be placed across.
|
|
274
|
+
*
|
|
275
|
+
* Exposed because a consumer rendering a merged transcript needs the same
|
|
276
|
+
* ordering fact this hook does; it is not a display field.
|
|
277
|
+
*/
|
|
278
|
+
readonly seq?: number;
|
|
250
279
|
}
|
|
251
280
|
export interface ChatAttribution {
|
|
252
281
|
readonly pageUrl?: string;
|
|
@@ -298,6 +327,23 @@ export interface UseChatSessionOptions {
|
|
|
298
327
|
* this option is purely additive.
|
|
299
328
|
*/
|
|
300
329
|
readonly collector?: VisitorEventCollector;
|
|
330
|
+
/**
|
|
331
|
+
* Which navigation targets THIS host page can actually resolve, sent once on
|
|
332
|
+
* `POST /widget/session` — see `./host-routes.ts` for the defect and
|
|
333
|
+
* `@saar-ai/widget-protocol`'s `host-routes.ts` for the wire contract.
|
|
334
|
+
*
|
|
335
|
+
* Absent ⇒ the field is omitted from the boot body entirely and the server
|
|
336
|
+
* keeps its storefront assumption, which is what every host did before this
|
|
337
|
+
* existed. An EMPTY array is a real declaration ("I can serve none of
|
|
338
|
+
* these") and is sent as one.
|
|
339
|
+
*
|
|
340
|
+
* Re-sent on a RECOVERY boot as well as a mount boot, unlike the tenant
|
|
341
|
+
* config this hook deliberately does not re-apply: a recovery mints a new
|
|
342
|
+
* session row server-side, and a capability omitted from that boot would
|
|
343
|
+
* leave the new session assuming a Shopify storefront on a host that is not
|
|
344
|
+
* one — the original bug, arriving thirty minutes in.
|
|
345
|
+
*/
|
|
346
|
+
readonly hostRoutes?: readonly ('product' | 'collection' | 'search' | 'cart' | 'url')[];
|
|
301
347
|
/**
|
|
302
348
|
* Overridable for tests; defaults to `Date.now`.
|
|
303
349
|
*
|
|
@@ -474,8 +520,16 @@ export interface UseChatSessionResult {
|
|
|
474
520
|
* The report is client-asserted, exactly as the sentence it replaced was —
|
|
475
521
|
* see `WidgetChatInput.report`'s doc comment (`apps/api`) for why
|
|
476
522
|
* cross-verifying it server-side is deliberately out of scope.
|
|
523
|
+
*
|
|
524
|
+
* `quietOnHttpError` (SAA-175): a 4xx still resolves `false` and rolls the
|
|
525
|
+
* turn back, but leaves the session status alone instead of setting
|
|
526
|
+
* `'error'`. For a caller that has its own fallback, such as an old api
|
|
527
|
+
* refusing a report kind it does not know. A 5xx or network failure is
|
|
528
|
+
* unaffected.
|
|
477
529
|
*/
|
|
478
|
-
readonly sendReport: (report: WidgetChatReport
|
|
530
|
+
readonly sendReport: (report: WidgetChatReport, options?: {
|
|
531
|
+
readonly quietOnHttpError?: boolean;
|
|
532
|
+
}) => Promise<boolean>;
|
|
479
533
|
/**
|
|
480
534
|
* Tell this hook what the shopper's basket currently is, so that every
|
|
481
535
|
* later turn carries it to the concierge as context.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-chat-session.d.ts","sourceRoot":"","sources":["../src/use-chat-session.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAQjF,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"use-chat-session.d.ts","sourceRoot":"","sources":["../src/use-chat-session.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAQjF,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EACjB,MAAM,+BAA+B,CAAC;AAOvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAenE;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEhE;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwGG;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,WAAW,GAAG,WAAW,GAAG,OAAO,CAAC;AAEtE;;;;;;;;;GASG;AACH,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,YAAY,GAAG,WAAW,GAAG,cAAc,CAAC;AAEvF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC;AAEpD,MAAM,WAAW,SAAS;IACxB,QAAQ,CA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,CAAC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7C;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,QAAQ,EAAE,CACjB,KAAK,EAAE,SAAS;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,EACzD,UAAU,CAAC,EAAE,MAAM,EACnB,oBAAoB,CAAC,EAAE,MAAM,KAC1B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACzC;;;;;;;;;OASG;IACH,QAAQ,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5E;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,QAAQ,CAAC,kBAAkB,EAAE,MAAM,IAAI,CAAC;CACzC;AAyXD,wBAAgB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,oBAAoB,CAs7DnF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BotState } from './bot-state.js';
|
|
2
|
-
import type { SessionConfigPayload, TranscriptPayload, TurnCostPayload, TurnLatencyPayload } from '@saar-ai/widget-protocol/telemetry';
|
|
2
|
+
import type { CallerInterruptReason, SessionConfigPayload, TranscriptPayload, TurnCostPayload, TurnLatencyPayload } from '@saar-ai/widget-protocol/telemetry';
|
|
3
3
|
import type { SessionTuning } from '@saar-ai/widget-protocol/tuning';
|
|
4
4
|
import type { WidgetToolEvent } from '@saar-ai/widget-protocol/chat';
|
|
5
5
|
import { type SessionLogEntry } from './session-log.js';
|
|
@@ -138,6 +138,7 @@ declare function loadVoiceProtocol(): Promise<{
|
|
|
138
138
|
currency: import("zod").ZodString;
|
|
139
139
|
available: import("zod").ZodBoolean;
|
|
140
140
|
reason: import("zod").ZodOptional<import("zod").ZodString>;
|
|
141
|
+
variantChoiceRequired: import("zod").ZodOptional<import("zod").ZodLiteral<true>>;
|
|
141
142
|
}, import("zod/v4/core").$strip>>;
|
|
142
143
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
143
144
|
type: import("zod").ZodLiteral<"escalated">;
|
|
@@ -159,6 +160,7 @@ declare function loadVoiceProtocol(): Promise<{
|
|
|
159
160
|
currency: import("zod").ZodString;
|
|
160
161
|
available: import("zod").ZodBoolean;
|
|
161
162
|
reason: import("zod").ZodOptional<import("zod").ZodString>;
|
|
163
|
+
variantChoiceRequired: import("zod").ZodOptional<import("zod").ZodLiteral<true>>;
|
|
162
164
|
}, import("zod/v4/core").$strip>;
|
|
163
165
|
}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
|
|
164
166
|
type: import("zod").ZodLiteral<"navigate">;
|
|
@@ -187,13 +189,17 @@ export type VoiceProtocol = Awaited<ReturnType<typeof loadVoiceProtocol>>;
|
|
|
187
189
|
/**
|
|
188
190
|
* Why the shopper cut the agent off, when they did it without speaking.
|
|
189
191
|
*
|
|
190
|
-
*
|
|
191
|
-
* `
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
* text mid-reply.
|
|
192
|
+
* Re-exported (not retyped) from `@saar-ai/widget-protocol/telemetry`'s
|
|
193
|
+
* `CallerInterruptReason` — the type derived from `CALLER_INTERRUPT_REASONS`,
|
|
194
|
+
* the same names `apps/voice`'s `handleCallerControl` records on the turn:
|
|
195
|
+
* `'look'` is §5.1's duck (the shopper turned to the page), `'tap'` the
|
|
196
|
+
* explicit interrupt control, `'keyboard'` a switch to text mid-reply. A
|
|
197
|
+
* TYPE-only import — this file already imports payload types from the same
|
|
198
|
+
* subpath above — so a fourth reason added to the wire enum reaches this
|
|
199
|
+
* hook's `interrupt()` signature with no edit here, rather than silently
|
|
200
|
+
* type-checking against a stale three-value union.
|
|
195
201
|
*/
|
|
196
|
-
export type CallerInterruptReason
|
|
202
|
+
export type { CallerInterruptReason };
|
|
197
203
|
/**
|
|
198
204
|
* `RoomEvent` values, as literals.
|
|
199
205
|
*
|
|
@@ -420,5 +426,4 @@ export interface WidgetVoiceTokenFetcherOptions {
|
|
|
420
426
|
*/
|
|
421
427
|
export declare function createWidgetVoiceTokenFetcher(options: WidgetVoiceTokenFetcherOptions): (tuning: SessionTuning) => Promise<CallerSession>;
|
|
422
428
|
export declare function useVoiceSession(options?: UseVoiceSessionOptions): VoiceSession;
|
|
423
|
-
export {};
|
|
424
429
|
//# sourceMappingURL=use-voice-session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-voice-session.d.ts","sourceRoot":"","sources":["../src/use-voice-session.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EACnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,EAAqC,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAC3F,OAAO,EAGL,KAAK,UAAU,EACf,KAAK,oBAAoB,EAC1B,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AAEH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAA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CAAC,IAAI,CAAC,CAAC;IAC7C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,wEAAwE;IACxE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC;;;;;;;;;OASG;IACH,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC;;;;;;;;OAQG;IACH,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B;;;;;;;;;;;;;;;OAeG;IACH,SAAS,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3D;;;;;;;;;;;;OAYG;IACH,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CACtC;AAiBD,MAAM,WAAW,8BAA8B;IAC7C;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,0HAA0H;IAC1H,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CACnC;AAqGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,8BAA8B,GACtC,CAAC,MAAM,EAAE,aAAa,KAAK,OAAO,CAAC,aAAa,CAAC,CAyBnD;AA4ED,wBAAgB,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,YAAY,CA0gBlF"}
|
package/dist/voice-widget.d.ts
CHANGED
|
@@ -61,6 +61,17 @@ export interface WidgetTurn {
|
|
|
61
61
|
* read as one.
|
|
62
62
|
*/
|
|
63
63
|
readonly filler?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* WHO wrote this reply, when it was not the concierge — the display name of
|
|
66
|
+
* the human operator who took the conversation (DOCK_SPEC §5.1's `human`).
|
|
67
|
+
*
|
|
68
|
+
* Present ONLY on an operator's own turn, and only when the tenant
|
|
69
|
+
* published `handoff.showOperatorName: true`: the api omits the field
|
|
70
|
+
* entirely otherwise (`use-chat-session.ts`'s `PolledTurn.operatorName`),
|
|
71
|
+
* so its absence is the normal case and there is nothing on this side to
|
|
72
|
+
* gate or to hide. A turn without it is drawn exactly as it always was.
|
|
73
|
+
*/
|
|
74
|
+
readonly operatorName?: string;
|
|
64
75
|
}
|
|
65
76
|
export type WidgetMode = 'voice' | 'text';
|
|
66
77
|
export interface VoiceWidgetProps {
|
|
@@ -133,6 +144,14 @@ export interface VoiceWidgetProps {
|
|
|
133
144
|
readonly onTyping?: () => void;
|
|
134
145
|
/** Forwarded to every product card's "Add to cart" button, text mode only. */
|
|
135
146
|
readonly onAddToCart?: (item: ChatCardItem) => void;
|
|
147
|
+
/**
|
|
148
|
+
* Forwarded to `WidgetCardList` — pressed on a card for a product with more
|
|
149
|
+
* than one sellable variant, whose "Choose options" control replaces "Add to
|
|
150
|
+
* cart" (SAA-175). See `WidgetCardListProps.onChooseOptions`.
|
|
151
|
+
*/
|
|
152
|
+
readonly onChooseOptions?: (item: ChatCardItem) => void | Promise<void>;
|
|
153
|
+
/** Forwarded to `WidgetCardList` — see `WidgetCardListProps.chooseOptionsBusy`. */
|
|
154
|
+
readonly chooseOptionsBusy?: boolean;
|
|
136
155
|
/**
|
|
137
156
|
* Forwarded to `WidgetCardList` — builds the "See all N" link's href for a
|
|
138
157
|
* curation too large to show inline in full. See that component's own doc
|
|
@@ -159,6 +178,8 @@ export interface VoiceWidgetProps {
|
|
|
159
178
|
readonly lines: readonly WidgetCartLine[];
|
|
160
179
|
readonly subtotalMinor: number;
|
|
161
180
|
readonly currency: string;
|
|
181
|
+
/** The storefront's discounts, when its total is below its own lines — see `WidgetCartSummaryProps.discountMinor`. */
|
|
182
|
+
readonly discountMinor?: number;
|
|
162
183
|
/** Starts checkout; resolves to the URL to send the shopper to, or `null` on failure. */
|
|
163
184
|
readonly onCheckout: () => Promise<string | null>;
|
|
164
185
|
};
|
|
@@ -301,5 +322,5 @@ export declare function basketIntentFromTurns(turns: readonly Pick<WidgetTurn, '
|
|
|
301
322
|
* `dir`, resolved from that line's locale rather than inherited from the page —
|
|
302
323
|
* inheriting is what renders Arabic punctuation on the wrong end of a sentence.
|
|
303
324
|
*/
|
|
304
|
-
export declare function VoiceWidget({ state, turns, onToggleMic, onEndCall, callPhase, onSendText, micOpen, status, statusKind, notice, mode, escalated, humanTyping, onTyping, onAddToCart, curationHref, productHref, onAttachFile, cart, messages, navigate, locale, skinStyle, avatar, attribution, dock, }: VoiceWidgetProps): import("react").JSX.Element;
|
|
325
|
+
export declare function VoiceWidget({ state, turns, onToggleMic, onEndCall, callPhase, onSendText, micOpen, status, statusKind, notice, mode, escalated, humanTyping, onTyping, onAddToCart, onChooseOptions, chooseOptionsBusy, curationHref, productHref, onAttachFile, cart, messages, navigate, locale, skinStyle, avatar, attribution, dock, }: VoiceWidgetProps): import("react").JSX.Element;
|
|
305
326
|
//# sourceMappingURL=voice-widget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voice-widget.d.ts","sourceRoot":"","sources":["../src/voice-widget.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAGpE,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAE1F,OAAO,
|
|
1
|
+
{"version":3,"file":"voice-widget.d.ts","sourceRoot":"","sources":["../src/voice-widget.tsx"],"names":[],"mappings":"AAEA,OAAO,EAA2B,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAGpE,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAE1F,OAAO,EAEL,KAAK,SAAS,EAGd,KAAK,iBAAiB,EACvB,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;GAQG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