@saar-ai/web-widget 0.5.0 → 0.6.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/card-aspect.d.ts +58 -0
- package/dist/card-aspect.d.ts.map +1 -0
- package/dist/chunks/{host-widget-B0SkhMIs.js → host-widget-C0XT9lHX.js} +4301 -5756
- package/dist/chunks/{telemetry-Bw-3F_Zk.js → telemetry-BI_SEWTb.js} +104 -2
- package/dist/dock/dock-caption.d.ts +67 -0
- package/dist/dock/dock-caption.d.ts.map +1 -0
- package/dist/dock/dock-motion.d.ts +155 -0
- package/dist/dock/dock-motion.d.ts.map +1 -0
- package/dist/dock/dock-pill.d.ts +38 -0
- package/dist/dock/dock-pill.d.ts.map +1 -0
- package/dist/dock/dock-row.d.ts +120 -0
- package/dist/dock/dock-row.d.ts.map +1 -0
- package/dist/dock/dock-sheet.d.ts +89 -0
- package/dist/dock/dock-sheet.d.ts.map +1 -0
- package/dist/dock/dock-shelf.d.ts +38 -0
- package/dist/dock/dock-shelf.d.ts.map +1 -0
- package/dist/dock/dock-state.d.ts +221 -0
- package/dist/dock/dock-state.d.ts.map +1 -0
- package/dist/dock/dock.d.ts +344 -0
- package/dist/dock/dock.d.ts.map +1 -0
- package/dist/dock/geometry.d.ts +161 -0
- package/dist/dock/geometry.d.ts.map +1 -0
- package/dist/generated/widget-css.d.ts.map +1 -1
- package/dist/host-widget.d.ts +94 -16
- package/dist/host-widget.d.ts.map +1 -1
- package/dist/index.d.ts +7 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4029 -7
- package/dist/messages.d.ts +69 -0
- package/dist/messages.d.ts.map +1 -1
- package/dist/next/index.js +1 -1
- package/dist/session-log.d.ts +7 -0
- package/dist/session-log.d.ts.map +1 -1
- package/dist/session-panel.d.ts +13 -3
- package/dist/session-panel.d.ts.map +1 -1
- package/dist/theme/color.d.ts +114 -0
- package/dist/theme/color.d.ts.map +1 -0
- package/dist/theme/derive.d.ts +92 -0
- package/dist/theme/derive.d.ts.map +1 -0
- package/dist/theme/index.d.ts +10 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/use-chat-session.d.ts +18 -16
- package/dist/use-chat-session.d.ts.map +1 -1
- package/dist/use-voice-session.d.ts +79 -3
- package/dist/use-voice-session.d.ts.map +1 -1
- package/dist/voice-widget.d.ts +49 -19
- package/dist/voice-widget.d.ts.map +1 -1
- package/dist/widget-cards.d.ts +28 -1
- package/dist/widget-cards.d.ts.map +1 -1
- package/dist/widget.css +1 -1
- package/package.json +4 -4
- package/src/styles/concierge.css +758 -28
- package/src/styles/tokens.css +67 -0
- package/dist/concierge-launcher.d.ts +0 -53
- package/dist/concierge-launcher.d.ts.map +0 -1
- package/dist/concierge-shell.d.ts +0 -256
- package/dist/concierge-shell.d.ts.map +0 -1
- package/dist/position.d.ts +0 -65
- package/dist/position.d.ts.map +0 -1
- package/dist/transcript-geometry.d.ts +0 -220
- package/dist/transcript-geometry.d.ts.map +0 -1
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DOCK GEOMETRY — every length the dock's row, pill and sheet are built from
|
|
3
|
+
* (docs/DOCK_SPEC.md §3), and the CSS expressions that carry them.
|
|
4
|
+
*
|
|
5
|
+
* ONE module owns all of it, for the same reason `transcript-geometry.ts`
|
|
6
|
+
* owns the panel's four lengths: the dock is drawn TWICE, by two renderers
|
|
7
|
+
* with no shared runtime. The CDN `core` stage paints the resting row and the
|
|
8
|
+
* pill in plain DOM before any framework loads, writing these values as an
|
|
9
|
+
* inline `style` attribute; the React dock then adopts a stylesheet built
|
|
10
|
+
* from the same values and swaps in over one frame (§4.2). If the two ever
|
|
11
|
+
* disagree by a pixel, the handover — which is supposed to be invisible —
|
|
12
|
+
* becomes a visible jump, and nothing in the type system connects a number in
|
|
13
|
+
* a `.tsx` to the same number in `cdn/dock-dom.ts`. Importing both from here
|
|
14
|
+
* is what connects them.
|
|
15
|
+
*
|
|
16
|
+
* The functions return CSS LENGTH STRINGS rather than numbers because most of
|
|
17
|
+
* these lengths are not numbers at all: they involve `env(safe-area-inset-*)`,
|
|
18
|
+
* `dvh`, and custom properties written per-frame by the keyboard and
|
|
19
|
+
* sticky-footer detectors. `geometry.test.ts` evaluates the strings
|
|
20
|
+
* structurally instead of rendering, because jsdom has no layout engine and
|
|
21
|
+
* mangles a `max()` containing a subtraction — reading these back off a
|
|
22
|
+
* rendered element would test jsdom, not this widget.
|
|
23
|
+
*/
|
|
24
|
+
/** Row height, mobile and desktop alike (§3.1). */
|
|
25
|
+
export declare const ROW_H = 48;
|
|
26
|
+
/** Pill height — the resting and receded form (§3.2). */
|
|
27
|
+
export declare const PILL_H = 44;
|
|
28
|
+
/** The session mark inside the row (§3.1). */
|
|
29
|
+
export declare const MARK = 32;
|
|
30
|
+
/** The same mark inside the pill (§3.2). */
|
|
31
|
+
export declare const PILL_MARK = 28;
|
|
32
|
+
/** Every tappable control in the row. WCAG 2.5.5 / iOS HIG floor (§11). */
|
|
33
|
+
export declare const CONTROL = 44;
|
|
34
|
+
/** The activity/waveform strip's width inside the row (§3.1). */
|
|
35
|
+
export declare const ACTIVITY_W = 20;
|
|
36
|
+
/** Mobile margin each side of the row (§3.1 — `100% - 20px`). */
|
|
37
|
+
export declare const MOBILE_MARGIN = 10;
|
|
38
|
+
/** Desktop gutter: the row's edge inset, and the pill's (§3.1, §3.2). */
|
|
39
|
+
export declare const DESKTOP_GUTTER = 16;
|
|
40
|
+
/** Minimum bottom inset on a device with no safe area (§8.1). */
|
|
41
|
+
export declare const BOTTOM_FLOOR = 10;
|
|
42
|
+
/** Desktop bottom inset (§3.1). */
|
|
43
|
+
export declare const DESKTOP_BOTTOM = 16;
|
|
44
|
+
/** Gap between the sheet's floor and the row above it (§3.3). */
|
|
45
|
+
export declare const SHEET_GAP = 8;
|
|
46
|
+
/** The one breakpoint. Below it the dock is full-width and thumb-anchored. */
|
|
47
|
+
export declare const DESKTOP_BREAKPOINT = 768;
|
|
48
|
+
/**
|
|
49
|
+
* §3.1. Deliberately below the 2147483647 ceiling: a merchant's own overlay
|
|
50
|
+
* that "goes to the top" typically uses the maximum, and the dock must lose
|
|
51
|
+
* to a genuine modal rather than sit on top of a cookie banner or a checkout
|
|
52
|
+
* dialog.
|
|
53
|
+
*/
|
|
54
|
+
export declare const Z_INDEX = 2147483000;
|
|
55
|
+
/** §9.1 `layout.desktopWidth`. `full` is width-minus-gutters, not a number. */
|
|
56
|
+
export declare const DESKTOP_WIDTHS: {
|
|
57
|
+
readonly narrow: 480;
|
|
58
|
+
readonly medium: 600;
|
|
59
|
+
readonly wide: 800;
|
|
60
|
+
readonly full: null;
|
|
61
|
+
};
|
|
62
|
+
/** §9.1 `type.radius`, in px. Mirrors `theme/derive.ts`'s `--wgt-radius`. */
|
|
63
|
+
export declare const RADII: {
|
|
64
|
+
readonly square: 0;
|
|
65
|
+
readonly soft: 12;
|
|
66
|
+
readonly round: 20;
|
|
67
|
+
readonly pill: 9999;
|
|
68
|
+
};
|
|
69
|
+
/** The sheet's `peek` snap point: three shelf rows (§3.3). */
|
|
70
|
+
export declare const SHEET_PEEK_MAX = 260;
|
|
71
|
+
/** The `expanded` snap point, as a share of the dynamic viewport (§3.3). */
|
|
72
|
+
export declare const SHEET_EXPANDED_VH: {
|
|
73
|
+
readonly mobile: 60;
|
|
74
|
+
readonly desktop: 50;
|
|
75
|
+
};
|
|
76
|
+
/** Desktop `expanded` also stops at a fixed height (§3.3). */
|
|
77
|
+
export declare const SHEET_EXPANDED_DESKTOP_MAX = 560;
|
|
78
|
+
/** Below this viewport height the sheet offers `peek` only (§3.3). */
|
|
79
|
+
export declare const SHORT_VIEWPORT = 500;
|
|
80
|
+
/**
|
|
81
|
+
* Breathing room left above an expanded sheet (§3.3's trailing `- 24px`), so
|
|
82
|
+
* the sheet never reaches the top edge of the viewport and always reads as an
|
|
83
|
+
* overlay on the merchant's page rather than as a takeover.
|
|
84
|
+
*/
|
|
85
|
+
export declare const SHEET_TOP_CLEARANCE = 24;
|
|
86
|
+
/**
|
|
87
|
+
* §5.4 — a shopper's own minimise, persisted per visitor.
|
|
88
|
+
*
|
|
89
|
+
* Lives HERE, with the lengths, rather than in either renderer, for the same
|
|
90
|
+
* reason every length does: `cdn/dock-dom.ts` reads it before first paint (so
|
|
91
|
+
* a visitor who minimised never watches the dock expand and collapse again)
|
|
92
|
+
* and the React dock writes it when they press "Minimise". Two copies of a
|
|
93
|
+
* storage key is two ways for one preference to be lost.
|
|
94
|
+
*/
|
|
95
|
+
export declare const DOCK_MINIMISED_STORAGE_KEY = "wgt_dock_minimised";
|
|
96
|
+
/** §5.6 — how long a proactive nudge holds the row open before it recedes. */
|
|
97
|
+
export declare const PROACTIVE_NUDGE_MS = 8000;
|
|
98
|
+
export type DesktopWidth = keyof typeof DESKTOP_WIDTHS;
|
|
99
|
+
export type DesktopAlign = 'left' | 'center' | 'right';
|
|
100
|
+
export type Direction = 'ltr' | 'rtl';
|
|
101
|
+
/** §9.1's `layout` fields this module needs. */
|
|
102
|
+
export interface DockLayout {
|
|
103
|
+
desktopAlign: DesktopAlign;
|
|
104
|
+
desktopWidth: DesktopWidth;
|
|
105
|
+
}
|
|
106
|
+
/** The six custom properties the dock's CSS reads. */
|
|
107
|
+
export type DockGeometryVar = '--wgt-row-h' | '--wgt-pill-h' | '--wgt-bottom' | '--wgt-row-w' | '--wgt-sheet-max-h' | '--wgt-z';
|
|
108
|
+
/**
|
|
109
|
+
* The bottom inset (§3.1).
|
|
110
|
+
*
|
|
111
|
+
* Mobile stacks three things: the device's safe area with a 10 px floor (so a
|
|
112
|
+
* phone without a home indicator still clears the bezel), the software
|
|
113
|
+
* keyboard offset written per-frame from `visualViewport` (§8.2), and the
|
|
114
|
+
* detected host sticky-footer height or the tenant's `layout.bottomOffset`
|
|
115
|
+
* (§8.3). Both custom properties carry an explicit `0px` fallback: an UNSET
|
|
116
|
+
* `var()` inside `calc()` makes the whole declaration invalid, and `--wgt-kb`
|
|
117
|
+
* is unset whenever the keyboard is closed — which is nearly always.
|
|
118
|
+
*/
|
|
119
|
+
export declare function bottomLen(isDesktop: boolean): string;
|
|
120
|
+
/**
|
|
121
|
+
* The row's width (§3.1): full width less a 10 px margin each side on mobile,
|
|
122
|
+
* one of the three fixed widths on desktop, or gutter-inset for `full`.
|
|
123
|
+
*
|
|
124
|
+
* @throws {TypeError} on an unknown width — better than emitting an empty
|
|
125
|
+
* string, which CSS drops silently and leaves the row at its intrinsic size.
|
|
126
|
+
*/
|
|
127
|
+
export declare function rowWidthLen(isDesktop: boolean, desktopWidth: DesktopWidth): string;
|
|
128
|
+
/**
|
|
129
|
+
* The sheet's `expanded` ceiling (§3.3).
|
|
130
|
+
*
|
|
131
|
+
* `dvh`, never `vh`: `vh` resolves against mobile Safari's LARGE viewport, so
|
|
132
|
+
* a sheet sized in `vh` runs underneath the browser's collapsing toolbar and
|
|
133
|
+
* its last row cannot be reached. The mobile arm also subtracts the row and
|
|
134
|
+
* the gap above it, because the row is the sheet's floor and must never be
|
|
135
|
+
* covered by it.
|
|
136
|
+
*/
|
|
137
|
+
export declare function sheetMaxHeightLen(isDesktop: boolean): string;
|
|
138
|
+
/**
|
|
139
|
+
* Every geometry custom property, for one viewport class and one layout.
|
|
140
|
+
*
|
|
141
|
+
* This is the object `core` serialises into the shadow host's inline `style`
|
|
142
|
+
* attribute and the React dock writes onto the same host — the single reason
|
|
143
|
+
* the handover does not move anything.
|
|
144
|
+
*/
|
|
145
|
+
export declare function geometryVars(isDesktop: boolean, layout: DockLayout): Record<DockGeometryVar, string>;
|
|
146
|
+
/**
|
|
147
|
+
* Which edge the pill hangs off, and how far in (§3.2).
|
|
148
|
+
*
|
|
149
|
+
* On mobile this is the THUMB edge, so it mirrors with the reading direction
|
|
150
|
+
* (§8.9). On desktop it follows `layout.desktopAlign`, which is a physical
|
|
151
|
+
* choice the tenant made about their own page and is therefore NOT mirrored;
|
|
152
|
+
* `center` resolves to the right edge, since a centred pill has no edge to
|
|
153
|
+
* hang off.
|
|
154
|
+
*
|
|
155
|
+
* @throws {TypeError} on an unknown alignment.
|
|
156
|
+
*/
|
|
157
|
+
export declare function pillAnchor(dir: Direction, isDesktop: boolean, desktopAlign: DesktopAlign): {
|
|
158
|
+
side: 'left' | 'right';
|
|
159
|
+
inset: number;
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=geometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/dock/geometry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,mDAAmD;AACnD,eAAO,MAAM,KAAK,KAAK,CAAC;AACxB,yDAAyD;AACzD,eAAO,MAAM,MAAM,KAAK,CAAC;AACzB,8CAA8C;AAC9C,eAAO,MAAM,IAAI,KAAK,CAAC;AACvB,4CAA4C;AAC5C,eAAO,MAAM,SAAS,KAAK,CAAC;AAC5B,2EAA2E;AAC3E,eAAO,MAAM,OAAO,KAAK,CAAC;AAC1B,iEAAiE;AACjE,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,iEAAiE;AACjE,eAAO,MAAM,aAAa,KAAK,CAAC;AAChC,yEAAyE;AACzE,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,iEAAiE;AACjE,eAAO,MAAM,YAAY,KAAK,CAAC;AAC/B,mCAAmC;AACnC,eAAO,MAAM,cAAc,KAAK,CAAC;AACjC,iEAAiE;AACjE,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,8EAA8E;AAC9E,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC;;;;;GAKG;AACH,eAAO,MAAM,OAAO,aAAa,CAAC;AAClC,+EAA+E;AAC/E,eAAO,MAAM,cAAc;aACzB,MAAM,EAAE,GAAG;aACX,MAAM,EAAE,GAAG;aACX,IAAI,EAAE,GAAG;aACT,IAAI;CACI,CAAC;AACX,6EAA6E;AAC7E,eAAO,MAAM,KAAK;aAAK,MAAM,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gB,YAAY,CAC1B,SAAS,EAAE,OAAO,EAClB,MAAM,EAAE,UAAU,GACjB,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CASjC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,OAAO,EAClB,YAAY,EAAE,YAAY,GACzB;IAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAQ3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"widget-css.d.ts","sourceRoot":"","sources":["../../src/generated/widget-css.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"widget-css.d.ts","sourceRoot":"","sources":["../../src/generated/widget-css.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,EAAE,MAA285D,CAAC"}
|
package/dist/host-widget.d.ts
CHANGED
|
@@ -4,7 +4,10 @@ import type { WidgetChatCart } from '@saar-ai/widget-protocol/chat';
|
|
|
4
4
|
import { type ChatCardItem, type ChatCheckoutHandoff } from './use-chat-session.js';
|
|
5
5
|
import { type VoiceSession } from './use-voice-session.js';
|
|
6
6
|
import type { WidgetCartLine } from './widget-cart-summary.js';
|
|
7
|
-
import {
|
|
7
|
+
import type { ConciergeCallPhase, WidgetAttribution } from './voice-widget.js';
|
|
8
|
+
import type { DockAvatarKind } from './dock/dock-row.js';
|
|
9
|
+
import type { DockCopyView, DockLayoutView } from './dock/dock.js';
|
|
10
|
+
import type { WidgetColorConfig, WidgetTypeConfig } from './theme/derive.js';
|
|
8
11
|
import { type WidgetMessages } from './messages.js';
|
|
9
12
|
import type { WidgetAvatar } from './avatar.js';
|
|
10
13
|
/**
|
|
@@ -289,23 +292,52 @@ export interface ConciergeWidgetProps {
|
|
|
289
292
|
/** Builds a truncated curation's "See all N" href. */
|
|
290
293
|
readonly curationHref?: (curationId: string) => string;
|
|
291
294
|
/**
|
|
292
|
-
*
|
|
293
|
-
*
|
|
295
|
+
* The tenant's published v2 config groups (docs/DOCK_SPEC.md §9.1), sourced
|
|
296
|
+
* from `GET /widget/config/:embedKey` by whoever mounts this component —
|
|
297
|
+
* never the session response. Every one of them is optional and every one
|
|
298
|
+
* has a shipped default, so a host that knows none of them (an npm consumer,
|
|
299
|
+
* a preview harness) still gets a correct dock.
|
|
294
300
|
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
|
|
301
|
-
|
|
301
|
+
* `defaultOpen` is GONE with the panel it belonged to. The dock has no open
|
|
302
|
+
* state at all — a pill, a row, and a sheet that rises when there is
|
|
303
|
+
* something to show — which is what structurally retires SAA-131: there is
|
|
304
|
+
* nothing left for a handover to lose but a draft and a focus target, and
|
|
305
|
+
* §4.2 carries both.
|
|
306
|
+
*/
|
|
307
|
+
readonly color?: WidgetColorConfig;
|
|
308
|
+
readonly type?: WidgetTypeConfig;
|
|
309
|
+
/** §9.1's `identity` group — the concierge's own name and mark. */
|
|
310
|
+
readonly identity?: {
|
|
311
|
+
readonly name?: string;
|
|
312
|
+
readonly avatar?: DockAvatarKind;
|
|
313
|
+
readonly avatarUrl?: string;
|
|
314
|
+
};
|
|
315
|
+
readonly layout?: DockLayoutView;
|
|
316
|
+
readonly copy?: DockCopyView;
|
|
317
|
+
/** §9.1 `layout.bottomOffset` — `'auto'` runs §8.3's sticky-footer detector. */
|
|
318
|
+
readonly bottomOffset?: 'auto' | number;
|
|
319
|
+
/** §9.1 `cards.showPrice`. */
|
|
320
|
+
readonly showPrice?: boolean;
|
|
321
|
+
/** §9.1 `cards.imageAspect` — the fixed box every card thumbnail is drawn in. */
|
|
322
|
+
readonly cardImageAspect?: 'square' | 'portrait' | 'landscape';
|
|
323
|
+
/**
|
|
324
|
+
* §8.4 — voice is available in THIS browser, as the core stage judged it.
|
|
302
325
|
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
326
|
+
* `session.modalities.voice` is the SERVER's answer and it knows nothing
|
|
327
|
+
* about the page the shopper is on. An embedded webview (Instagram,
|
|
328
|
+
* Facebook, Line, ChatGPT's in-app browser) has no usable
|
|
329
|
+
* `getUserMedia`, and the core dock already withholds the microphone
|
|
330
|
+
* there — so without this the React dock drew one the moment it mounted:
|
|
331
|
+
* the shopper taps the pill and gets a control that can never work, on
|
|
332
|
+
* exactly the traffic §8.4 was written for. Absent ⇒ no opinion, and the
|
|
333
|
+
* server's answer stands, which is right for a host that is not the CDN
|
|
334
|
+
* embed.
|
|
307
335
|
*/
|
|
308
|
-
readonly
|
|
336
|
+
readonly voiceAvailable?: boolean;
|
|
337
|
+
/** §9.4's resolved reading direction. */
|
|
338
|
+
readonly direction?: 'ltr' | 'rtl';
|
|
339
|
+
/** §5.6 — a proactive rule fired; the line it wants in the caption for 8 s. */
|
|
340
|
+
readonly proactive?: string;
|
|
309
341
|
/**
|
|
310
342
|
* Called if this widget's OWN render throws — never surfaced to the host
|
|
311
343
|
* page otherwise (see `error-boundary.tsx`). Optional; the default is to
|
|
@@ -320,6 +352,52 @@ export interface ConciergeWidgetProps {
|
|
|
320
352
|
* component resolves no identity of its own.
|
|
321
353
|
*/
|
|
322
354
|
readonly attribution?: WidgetAttribution;
|
|
355
|
+
/**
|
|
356
|
+
* DOCK_SPEC §4.2's HANDOVER payload — everything the core dock
|
|
357
|
+
* (`cdn/dock-dom.ts`) captured at the instant the shopper expressed intent,
|
|
358
|
+
* so the first React render is already correct instead of catching up a
|
|
359
|
+
* frame later.
|
|
360
|
+
*
|
|
361
|
+
* All seven are OPTIONAL and, as of this change, all seven are IGNORED by
|
|
362
|
+
* this component: PR 4's React dock is what consumes them. That is
|
|
363
|
+
* deliberate rather than premature — the core half and the React half ship
|
|
364
|
+
* as separate PRs, and the core half cannot land without somewhere to send
|
|
365
|
+
* the payload. A caller that renders `ConciergeWidget` directly (a Next.js
|
|
366
|
+
* host, an npm consumer) has no dock in front of it and passes none of them.
|
|
367
|
+
*
|
|
368
|
+
* None of these can be recovered after the fact, which is why they cross
|
|
369
|
+
* the boundary at all: the caret is gone the moment focus moves, the hold
|
|
370
|
+
* gesture is over, and iOS will not unlock audio outside the gesture that
|
|
371
|
+
* started it (§8.5) — so the `AudioContext` is constructed inside the mic's
|
|
372
|
+
* `pointerdown` and handed over as a live object.
|
|
373
|
+
*/
|
|
374
|
+
readonly initialDraft?: string;
|
|
375
|
+
readonly initialSelection?: {
|
|
376
|
+
start: number;
|
|
377
|
+
end: number;
|
|
378
|
+
};
|
|
379
|
+
readonly initialFocus?: 'composer' | 'mic' | null;
|
|
380
|
+
readonly initialMinimised?: boolean;
|
|
381
|
+
/** The measured insets (§8.1–§8.3) at the moment of intent. */
|
|
382
|
+
readonly insets?: {
|
|
383
|
+
kb: number;
|
|
384
|
+
hostOffset: number;
|
|
385
|
+
};
|
|
386
|
+
/** The hold-to-talk gesture (§5.2). `releasedAt` absent ⇒ still held. */
|
|
387
|
+
readonly hold?: {
|
|
388
|
+
downAt: number;
|
|
389
|
+
releasedAt?: number;
|
|
390
|
+
};
|
|
391
|
+
/** The `AudioContext` the mic gesture unlocked (§8.5). */
|
|
392
|
+
readonly audio?: {
|
|
393
|
+
context: AudioContext;
|
|
394
|
+
};
|
|
395
|
+
/**
|
|
396
|
+
* §4.2 step 3 — called from the dock's FIRST layout effect. `cdn/ui.ts`
|
|
397
|
+
* makes the React container visible and `cdn/core.ts` removes its own row
|
|
398
|
+
* inside the same synchronous render, so the swap is one paint.
|
|
399
|
+
*/
|
|
400
|
+
readonly onReady?: () => void;
|
|
323
401
|
}
|
|
324
402
|
/**
|
|
325
403
|
* The plain React widget component — for a Next.js host (Phase 5's npm
|
|
@@ -357,5 +435,5 @@ export interface ConciergeWidgetProps {
|
|
|
357
435
|
* about offering voice here costs a byte until a caller actually presses
|
|
358
436
|
* the microphone.
|
|
359
437
|
*/
|
|
360
|
-
export declare function ConciergeWidget({ embedKey, apiBase, socketUrl, socketPath, bridge, collector, messages, locale, productHref, curationHref, brandPrimary, brandSecondary, brandAccent, avatar,
|
|
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;
|
|
361
439
|
//# sourceMappingURL=host-widget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"host-widget.d.ts","sourceRoot":"","sources":["../src/host-widget.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAmB,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACxF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAIpE,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,+BAA+B,CAAC;AAEtF,OAAO,EAAkB,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACpG,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"host-widget.d.ts","sourceRoot":"","sources":["../src/host-widget.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAmB,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACxF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAIpE,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,+BAA+B,CAAC;AAEtF,OAAO,EAAkB,KAAK,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,uBA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,EAAE,MAAM,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,OAAO,EACP,SAAS,EACT,UAAU,EACV,MAAM,EACN,SAAS,EACT,QAAgC,EAChC,MAAa,EACb,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,WAAW,EACX,MAAM,EACN,WAAW,EACX,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,eAAe,EACf,cAAc,EACd,SAAS,EACT,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,MAAM,EACN,IAAI,EACJ,KAAK,EACL,OAAO,GACR,EAAE,oBAAoB,+BAi1CtB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
export * from './bot-face.js';
|
|
2
2
|
export * from './rope-knot.js';
|
|
3
3
|
export * from './avatar.js';
|
|
4
|
-
export * from './concierge-launcher.js';
|
|
5
|
-
export * from './concierge-shell.js';
|
|
6
|
-
export * from './position.js';
|
|
7
4
|
export * from './morphing-loader.js';
|
|
8
5
|
export { cn } from './cn.js';
|
|
6
|
+
export { Dock } from './dock/dock.js';
|
|
7
|
+
export type { DockProps, DockVoiceProps, DockLayoutView, DockCopyView, WidgetAttribution, } from './dock/dock.js';
|
|
8
|
+
export type { DockIdentityView, DockAvatarKind, DockMicSource } from './dock/dock-row.js';
|
|
9
|
+
export type { DockSheetSnap } from './dock/dock-sheet.js';
|
|
10
|
+
export * from './dock/dock-state.js';
|
|
9
11
|
export * from './messages.js';
|
|
10
12
|
export * from './bot-state.js';
|
|
11
13
|
export * from './bot-avatar.js';
|
|
@@ -19,6 +21,8 @@ export * from './widget-cart-summary.js';
|
|
|
19
21
|
export * from './voice-widget.js';
|
|
20
22
|
export * from './use-chat-session.js';
|
|
21
23
|
export * from './use-voice-session.js';
|
|
24
|
+
export * from './theme/index.js';
|
|
25
|
+
export * from './dock/geometry.js';
|
|
22
26
|
export * from './text-direction.js';
|
|
23
27
|
export * from './format-money.js';
|
|
24
28
|
export * from './host-widget.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAc7B,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,YAAY,EACV,SAAS,EACT,cAAc,EACd,cAAc,EACd,YAAY,EACZ,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC1F,YAAY,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,cAAc,sBAAsB,CAAC;AAGrC,cAAc,eAAe,CAAC;AAG9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAw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