@saar-ai/web-widget 0.5.0 → 0.6.1
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-CAPud_Jz.js} +4609 -5776
- 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 +270 -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/dock/motion-gate.d.ts +123 -0
- package/dist/dock/motion-gate.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
package/src/styles/tokens.css
CHANGED
|
@@ -65,3 +65,70 @@
|
|
|
65
65
|
--background: oklch(14% 0.01 280);
|
|
66
66
|
--foreground: oklch(97% 0.006 84.6);
|
|
67
67
|
}
|
|
68
|
+
|
|
69
|
+
/*
|
|
70
|
+
* ---------------------------------------------------------------------------
|
|
71
|
+
* DOCK TOKENS (`--wgt-*`) — docs/DOCK_SPEC.md §9.2.
|
|
72
|
+
*
|
|
73
|
+
* ADDITIVE, alongside the `--widget-*` roles above. The two sets coexist on
|
|
74
|
+
* purpose: the shipped panel still reads `--widget-*` and will keep reading
|
|
75
|
+
* them until DOCK_SPEC §17 PR 4 replaces `ConciergeShell`, while the dock's
|
|
76
|
+
* row, pill and sheet read only `--wgt-*`. Removing or renaming anything
|
|
77
|
+
* above would break the widget that is live on merchant sites today.
|
|
78
|
+
*
|
|
79
|
+
* These are DEFAULTS, not the theme. A published tenant config is turned into
|
|
80
|
+
* the same twelve properties by `src/theme/derive.ts` and written onto the
|
|
81
|
+
* shadow host — as an inline `style` attribute by the CDN `core` stage, and as
|
|
82
|
+
* an adopted stylesheet by the React dock — where they override this block.
|
|
83
|
+
* What lives here is the neutral fallback that renders a correct, readable
|
|
84
|
+
* dock when no config has arrived yet (first paint, a failed
|
|
85
|
+
* `GET /widget/config`, a Storybook story with no theme decorator).
|
|
86
|
+
*
|
|
87
|
+
* The values are the exact output of
|
|
88
|
+
* `deriveTheme({ primary: '#111827', tone: 'auto' }, { font: 'inherit',
|
|
89
|
+
* radius: 'soft', caps: 'none' })` — copied rather than computed, because CSS
|
|
90
|
+
* cannot call the function and a hand-tuned near-miss here would make the
|
|
91
|
+
* fallback and the themed dock two different-looking widgets. Regenerate them
|
|
92
|
+
* from `deriveTheme` if the derivation changes; do not tune them by eye.
|
|
93
|
+
*
|
|
94
|
+
* Dark uses the SAME `.dark` class hook as the block above, not
|
|
95
|
+
* `prefers-color-scheme` — the shadow host's class is what the mount controls,
|
|
96
|
+
* and a media query here would fight it. `themeToCss` emits the media query
|
|
97
|
+
* for a themed dock; this fallback follows the host's explicit choice.
|
|
98
|
+
* --------------------------------------------------------------------------- */
|
|
99
|
+
|
|
100
|
+
:host,
|
|
101
|
+
:root {
|
|
102
|
+
--wgt-primary: #111827;
|
|
103
|
+
--wgt-on-primary: #ffffff;
|
|
104
|
+
--wgt-accent: #191525;
|
|
105
|
+
--wgt-surface: #ffffff;
|
|
106
|
+
--wgt-surface-2: #f0efef;
|
|
107
|
+
--wgt-text: #1c1618;
|
|
108
|
+
--wgt-text-muted: rgb(28 22 24 / 0.62);
|
|
109
|
+
--wgt-border: rgb(28 22 24 / 0.12);
|
|
110
|
+
--wgt-ring: #111827;
|
|
111
|
+
--wgt-radius: 12px;
|
|
112
|
+
--wgt-sheet-radius: 12px;
|
|
113
|
+
--wgt-card-radius: 12px;
|
|
114
|
+
--wgt-font: inherit;
|
|
115
|
+
--wgt-caps: none;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
:host(.dark),
|
|
119
|
+
.dark {
|
|
120
|
+
--wgt-primary: #111827;
|
|
121
|
+
--wgt-on-primary: #ffffff;
|
|
122
|
+
--wgt-accent: #191525;
|
|
123
|
+
--wgt-surface: #141414;
|
|
124
|
+
--wgt-surface-2: #1f1f1f;
|
|
125
|
+
--wgt-text: #fbf2f5;
|
|
126
|
+
--wgt-text-muted: rgb(251 242 245 / 0.62);
|
|
127
|
+
--wgt-border: rgb(251 242 245 / 0.12);
|
|
128
|
+
--wgt-ring: #5a6376;
|
|
129
|
+
--wgt-radius: 12px;
|
|
130
|
+
--wgt-sheet-radius: 12px;
|
|
131
|
+
--wgt-card-radius: 12px;
|
|
132
|
+
--wgt-font: inherit;
|
|
133
|
+
--wgt-caps: none;
|
|
134
|
+
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { type WidgetAvatar } from './avatar.js';
|
|
2
|
-
import { alignOf, type ConciergePosition } from './position.js';
|
|
3
|
-
/**
|
|
4
|
-
* The collapsed concierge: a pill the visitor can read, press, and move.
|
|
5
|
-
*
|
|
6
|
-
* ## Why a pill and not a round button
|
|
7
|
-
*
|
|
8
|
-
* A bare orb says "there is a bot here" and nothing else. This product's
|
|
9
|
-
* concierge answers in SPEECH, which is the thing a visitor has to be told —
|
|
10
|
-
* nobody presses an unlabelled circle expecting to talk to it. So the launcher
|
|
11
|
-
* carries the tenant's own words (`label`), beside the face rather than instead
|
|
12
|
-
* of it: the mascot is what the concierge IS, and swapping it for a microphone
|
|
13
|
-
* glyph would trade a personality for an icon that says less.
|
|
14
|
-
*
|
|
15
|
-
* ## Why it is draggable
|
|
16
|
-
*
|
|
17
|
-
* The widget sits on somebody else's page, over content the tenant chose and we
|
|
18
|
-
* have never seen. A fixed corner covers a cookie bar on one site and a "buy"
|
|
19
|
-
* button on another, and no default can be right everywhere. The tenant picks
|
|
20
|
-
* where it starts; the visitor gets the last word.
|
|
21
|
-
*
|
|
22
|
-
* Dragging is the obvious gesture and the inaccessible one, so the grip is a
|
|
23
|
-
* real focusable control and arrow keys move between the same six anchors —
|
|
24
|
-
* see `positionForArrow`. Anyone who cannot drag can still move the thing off
|
|
25
|
-
* the content it is covering.
|
|
26
|
-
*
|
|
27
|
-
* ## What it does NOT do
|
|
28
|
-
*
|
|
29
|
-
* It does not remember anything. Where the widget sits between visits is the
|
|
30
|
-
* host app's business — it owns the storage, the tenant default it falls back
|
|
31
|
-
* to, and the consent posture around keeping anything at all.
|
|
32
|
-
*/
|
|
33
|
-
export interface ConciergeLauncherProps {
|
|
34
|
-
/** Visible text. Absent ⇒ the face alone, and `srLabel` names it. */
|
|
35
|
-
readonly label?: string;
|
|
36
|
-
/** Accessible name of the launcher itself. Always required. */
|
|
37
|
-
readonly srLabel: string;
|
|
38
|
-
/** Accessible name of the drag grip, e.g. "Move the assistant". */
|
|
39
|
-
readonly moveLabel: string;
|
|
40
|
-
readonly position: ConciergePosition;
|
|
41
|
-
/** Absent ⇒ the launcher is fixed where the tenant put it, with no grip. */
|
|
42
|
-
readonly onPositionChange?: (position: ConciergePosition) => void;
|
|
43
|
-
readonly onOpen: () => void;
|
|
44
|
-
readonly hidden: boolean;
|
|
45
|
-
readonly id?: string;
|
|
46
|
-
readonly testId?: string;
|
|
47
|
-
/** Which face renders inside the pill. Defaults to `'orb'` — see `avatar.ts`. */
|
|
48
|
-
readonly avatar?: WidgetAvatar;
|
|
49
|
-
}
|
|
50
|
-
export declare function ConciergeLauncher({ label, srLabel, moveLabel, position, onPositionChange, onOpen, hidden, id, testId, avatar, }: ConciergeLauncherProps): import("react").JSX.Element;
|
|
51
|
-
/** Re-exported so a host can type its own stored value. */
|
|
52
|
-
export { alignOf };
|
|
53
|
-
//# sourceMappingURL=concierge-launcher.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"concierge-launcher.d.ts","sourceRoot":"","sources":["../src/concierge-launcher.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EACL,OAAO,EAIP,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,WAAW,sBAAsB;IACrC,qEAAqE;IACrE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,mEAAmE;IACnE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACrC,4EAA4E;IAC5E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAClE,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,iFAAiF;IACjF,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;CAChC;AAED,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,OAAO,EACP,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,MAAM,EACN,MAAM,EACN,EAAE,EACF,MAAM,EACN,MAA8B,GAC/B,EAAE,sBAAsB,+BAuOxB;AAED,2DAA2D;AAC3D,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import { type CSSProperties, type ReactNode } from 'react';
|
|
2
|
-
import type { BotState } from './bot-state.js';
|
|
3
|
-
import { type WidgetAvatar } from './avatar.js';
|
|
4
|
-
import { type ConciergePosition } from './position.js';
|
|
5
|
-
/**
|
|
6
|
-
* The concierge widget's chrome: trigger, backdrop, panel, face, composer.
|
|
7
|
-
*
|
|
8
|
-
* ## Why it is a package and not a component in one app
|
|
9
|
-
*
|
|
10
|
-
* This widget renders in two places — the scripted preview on the marketing
|
|
11
|
-
* site and the real assistant in the product — and the preview's entire claim
|
|
12
|
-
* is that a visitor is looking at what they would get. Two implementations can
|
|
13
|
-
* only agree by hand, and would stop agreeing the first time either was
|
|
14
|
-
* touched. So the chrome is defined once, here, and each app supplies what is
|
|
15
|
-
* genuinely its own: the marketing preview replays a script, the product holds
|
|
16
|
-
* a live session with a microphone, product cards and a cart.
|
|
17
|
-
*
|
|
18
|
-
* What is deliberately NOT here: the transcript. `children` is the whole
|
|
19
|
-
* conversation area, because that is where the two legitimately differ — the
|
|
20
|
-
* preview renders bubbles, the product renders bubbles plus cards, attachments,
|
|
21
|
-
* markdown and a cart summary. A shell that tried to own that would end up with
|
|
22
|
-
* a prop for every feature either app ever grows.
|
|
23
|
-
*
|
|
24
|
-
* ## No i18n, no router, no data
|
|
25
|
-
*
|
|
26
|
-
* Every string arrives in {@link ConciergeShellProps.labels}. The package has
|
|
27
|
-
* no locale of its own, and an app that translates with `next-intl` should not
|
|
28
|
-
* have to reach a translator into a design-system component to render a button.
|
|
29
|
-
*
|
|
30
|
-
* ## It is a modal dialog, and behaves like one
|
|
31
|
-
*
|
|
32
|
-
* `Escape` closes, `Tab` is trapped inside the panel, and focus returns to the
|
|
33
|
-
* trigger on close — focus leaking to the page behind an open dialog leaves a
|
|
34
|
-
* keyboard or screen-reader user navigating content they cannot see.
|
|
35
|
-
*
|
|
36
|
-
* Focus lands on the COMPOSER, not the close button. It is what a visitor
|
|
37
|
-
* opened the panel to use, and a focused close button swallows the space bar:
|
|
38
|
-
* press space to start typing before clicking into the field and the panel
|
|
39
|
-
* shuts instead — a keyboard user's first keystroke dismissing the thing they
|
|
40
|
-
* just opened.
|
|
41
|
-
*
|
|
42
|
-
* ## The animation carries nothing
|
|
43
|
-
*
|
|
44
|
-
* Every flourish below is decorative and stops wholesale under
|
|
45
|
-
* `prefers-reduced-motion`. That is only safe because the state is also
|
|
46
|
-
* announced in text — see {@link ConciergeShellProps.announcement}, which is
|
|
47
|
-
* the live region and not an afterthought.
|
|
48
|
-
*/
|
|
49
|
-
export interface ConciergeShellLabels {
|
|
50
|
-
/** Accessible name of the collapsed trigger. */
|
|
51
|
-
readonly open: string;
|
|
52
|
-
/**
|
|
53
|
-
* Visible text ON the collapsed launcher — the tenant's own words for their
|
|
54
|
-
* concierge, from the widget config, in the config's own locale.
|
|
55
|
-
*
|
|
56
|
-
* Absent leaves the face alone with `open` as its accessible name, which is
|
|
57
|
-
* what a host with nothing to say should render rather than a placeholder.
|
|
58
|
-
*/
|
|
59
|
-
readonly launcher?: string;
|
|
60
|
-
/** Accessible name of the drag grip, e.g. "Move the assistant". */
|
|
61
|
-
readonly move?: string;
|
|
62
|
-
readonly close: string;
|
|
63
|
-
/** Accessible name of the dialog itself. */
|
|
64
|
-
readonly dialog: string;
|
|
65
|
-
readonly composerPlaceholder: string;
|
|
66
|
-
readonly send: string;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Where a call is, from the caller's point of view.
|
|
70
|
-
*
|
|
71
|
-
* The panel no longer draws a full status BAR for these — removed on
|
|
72
|
-
* request; the widget reads better without one. What it draws instead, on
|
|
73
|
-
* explicit later request, is a small one-word PILL under the orb (see
|
|
74
|
-
* `ConciergeShellVoice.labels`'s `connecting`/`listening`/`thinking`/
|
|
75
|
-
* `speaking` and the orb overlay below) — a partial reversal, not a
|
|
76
|
-
* contradiction: the pill shows only the call's current state word, never
|
|
77
|
-
* an error or a refusal reason, which still reaches the caller through the
|
|
78
|
-
* host's own status line exactly as before. The phase still decides which
|
|
79
|
-
* control the composer row offers too.
|
|
80
|
-
*/
|
|
81
|
-
export type ConciergeCallPhase = 'idle' | 'connecting' | 'waiting' | 'live' | 'blocked';
|
|
82
|
-
/**
|
|
83
|
-
* The voice leg, as the panel needs to see it.
|
|
84
|
-
*
|
|
85
|
-
* Replaces the old `mic` prop, which could only express "there is a button".
|
|
86
|
-
* A voice-first widget has to express where the call IS: a caller who presses
|
|
87
|
-
* the microphone and sees nothing for four seconds concludes the product is
|
|
88
|
-
* broken, and that is exactly what the transport spends on a good day.
|
|
89
|
-
*/
|
|
90
|
-
export interface ConciergeShellVoice {
|
|
91
|
-
readonly phase: ConciergeCallPhase;
|
|
92
|
-
/** Start a call. Only reachable while `phase` is `idle`. */
|
|
93
|
-
readonly onStart: () => void;
|
|
94
|
-
/** Leave the call — a different intention from muting it. */
|
|
95
|
-
readonly onEnd?: () => void;
|
|
96
|
-
/** Ask the browser for the microphone again, after it was refused. */
|
|
97
|
-
readonly onRetryMic?: () => void;
|
|
98
|
-
readonly muted?: boolean;
|
|
99
|
-
readonly onToggleMute?: () => void;
|
|
100
|
-
/** True while the agent is talking, so the bar can offer the interrupt. */
|
|
101
|
-
readonly agentSpeaking?: boolean;
|
|
102
|
-
/** 0..1, drives the level meter. */
|
|
103
|
-
readonly level?: number;
|
|
104
|
-
/**
|
|
105
|
-
* Present and DISABLED rather than hidden, for a surface that has no voice
|
|
106
|
-
* leg but wants to show the product has one — the marketing preview. A host
|
|
107
|
-
* with nothing to offer omits `voice` entirely.
|
|
108
|
-
*/
|
|
109
|
-
readonly disabled?: boolean;
|
|
110
|
-
readonly labels: {
|
|
111
|
-
/** Accessible name of the start button, and its tooltip when disabled. */
|
|
112
|
-
readonly start: string;
|
|
113
|
-
readonly end?: string;
|
|
114
|
-
readonly mute?: string;
|
|
115
|
-
readonly unmute?: string;
|
|
116
|
-
/** One line for the call bar: "Connecting…", "You can talk now", a reason. */
|
|
117
|
-
readonly status?: string;
|
|
118
|
-
/** Shown while the agent speaks: "go ahead and interrupt". */
|
|
119
|
-
readonly interrupt?: string;
|
|
120
|
-
/** The retry button, offered only when the microphone was refused. */
|
|
121
|
-
readonly retry?: string;
|
|
122
|
-
/**
|
|
123
|
-
* WHY the control cannot be used, replacing `start` as the accessible
|
|
124
|
-
* name for as long as it cannot — see `micLabel` below.
|
|
125
|
-
*
|
|
126
|
-
* `start` names the action the button would perform, and a button that
|
|
127
|
-
* performs nothing must not announce one: a caller who hears "Start
|
|
128
|
-
* talking" on a control that refuses every press has been told the
|
|
129
|
-
* product is broken. Read only while the control is unusable
|
|
130
|
-
* (`disabled`, or `phase === 'blocked'`), so a host can supply it
|
|
131
|
-
* unconditionally; absent falls back to the old behaviour, which is what
|
|
132
|
-
* a host with no reason worth naming should get.
|
|
133
|
-
*/
|
|
134
|
-
readonly unavailable?: string;
|
|
135
|
-
/**
|
|
136
|
-
* The four words the voice-state pill under the orb shows (see that
|
|
137
|
-
* pill's own doc comment) — one per state a live call can be in.
|
|
138
|
-
* Defaults to the package's brand-neutral English fallback
|
|
139
|
-
* (`defaultWidgetMessages`, `messages.ts`) so an existing caller that
|
|
140
|
-
* has not been updated to pass these still renders sensibly; a host
|
|
141
|
-
* with its own translation catalogue supplies its own.
|
|
142
|
-
*/
|
|
143
|
-
readonly connecting?: string;
|
|
144
|
-
readonly listening?: string;
|
|
145
|
-
readonly thinking?: string;
|
|
146
|
-
readonly speaking?: string;
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* The small wordmark link rendered directly under the open panel — which
|
|
151
|
-
* adopter's framework fork produced this bundle, not a per-tenant value. See
|
|
152
|
-
* {@link ConciergeShellProps.attribution}'s own doc comment for the full
|
|
153
|
-
* "why not just resolve `@wesence/branding` here" reasoning. Exported (rather
|
|
154
|
-
* than declared inline on each prop that carries it) so `voice-widget.tsx`,
|
|
155
|
-
* `host-widget.tsx`, and `cdn/core.ts`'s `UiModule` reference one definition
|
|
156
|
-
* instead of four independent copies of the same two-field shape.
|
|
157
|
-
*/
|
|
158
|
-
export interface WidgetAttribution {
|
|
159
|
-
readonly name: string;
|
|
160
|
-
readonly href: string;
|
|
161
|
-
}
|
|
162
|
-
export interface ConciergeShellProps {
|
|
163
|
-
readonly open: boolean;
|
|
164
|
-
readonly onOpenChange: (open: boolean) => void;
|
|
165
|
-
/** What the face renders. */
|
|
166
|
-
readonly state: BotState;
|
|
167
|
-
/** One-shot flourish when the visitor's own message lands. */
|
|
168
|
-
readonly messageArrived?: boolean;
|
|
169
|
-
/** Which face — the 'orb' blob or the 'knot' rope line. Defaults to `'orb'`; see `avatar.ts`. */
|
|
170
|
-
readonly avatar?: WidgetAvatar;
|
|
171
|
-
readonly labels: ConciergeShellLabels;
|
|
172
|
-
/**
|
|
173
|
-
* The conversation. Rendered inside the panel's own scroll container, so a
|
|
174
|
-
* caller supplies list items and nothing about scrolling or padding.
|
|
175
|
-
*/
|
|
176
|
-
readonly children: ReactNode;
|
|
177
|
-
/** Between the face and the transcript — the preview's "scripted" badge. */
|
|
178
|
-
readonly badge?: ReactNode;
|
|
179
|
-
readonly draft: string;
|
|
180
|
-
readonly onDraftChange: (value: string) => void;
|
|
181
|
-
/** The composer was submitted with a non-empty draft. */
|
|
182
|
-
readonly onSubmit: () => void;
|
|
183
|
-
readonly composerDisabled?: boolean;
|
|
184
|
-
/** Omitted ⇒ no voice control renders at all. */
|
|
185
|
-
readonly voice?: ConciergeShellVoice;
|
|
186
|
-
/**
|
|
187
|
-
* Rendered inside the composer, before the text field.
|
|
188
|
-
*
|
|
189
|
-
* Exists for the product's attachment control, which the marketing preview
|
|
190
|
-
* has nothing to put there. A slot rather than an `onAttach` prop because
|
|
191
|
-
* the widget that owns the file input also owns its label, its accepted
|
|
192
|
-
* types and what "uploading" looks like — none of which belongs in a design
|
|
193
|
-
* system component.
|
|
194
|
-
*/
|
|
195
|
-
readonly composerLeading?: ReactNode;
|
|
196
|
-
/**
|
|
197
|
-
* What a screen reader is told, replacing everything the animation conveys.
|
|
198
|
-
* Changing it announces it, so it should be the state or the newest reply —
|
|
199
|
-
* never a value that changes on every frame.
|
|
200
|
-
*/
|
|
201
|
-
readonly announcement?: string;
|
|
202
|
-
/** `[data-skin]` on the root, for the brand-token overrides. */
|
|
203
|
-
readonly skin?: string;
|
|
204
|
-
/** Inline brand-token overrides, for a skin computed at runtime. */
|
|
205
|
-
readonly skinStyle?: CSSProperties;
|
|
206
|
-
/**
|
|
207
|
-
* Namespaces this instance's element ids. Two widgets on one page would
|
|
208
|
-
* otherwise share a trigger id and hand focus to each other's.
|
|
209
|
-
*/
|
|
210
|
-
readonly idPrefix?: string;
|
|
211
|
-
/** Scrolls the transcript to the newest turn when it changes. */
|
|
212
|
-
readonly scrollKey?: unknown;
|
|
213
|
-
/**
|
|
214
|
-
* Which edge the widget hangs from. Defaults to bottom-centre.
|
|
215
|
-
*
|
|
216
|
-
* The TENANT's default arrives here from the widget config; a visitor may
|
|
217
|
-
* move it, which is what `onPositionChange` reports. Remembering their choice
|
|
218
|
-
* is the host app's business — see `ConciergeLauncher`.
|
|
219
|
-
*/
|
|
220
|
-
readonly position?: ConciergePosition;
|
|
221
|
-
/** Absent ⇒ the launcher cannot be moved and renders no grip. */
|
|
222
|
-
readonly onPositionChange?: (position: ConciergePosition) => void;
|
|
223
|
-
/**
|
|
224
|
-
* `data-testid`s for the controls the shell owns.
|
|
225
|
-
*
|
|
226
|
-
* The product's suite drives this widget through its own ids and predates
|
|
227
|
-
* the shell; naming them here keeps those tests asserting behaviour rather
|
|
228
|
-
* than being rewritten into assertions about a design system's markup.
|
|
229
|
-
*/
|
|
230
|
-
readonly testIds?: {
|
|
231
|
-
readonly trigger?: string;
|
|
232
|
-
readonly panel?: string;
|
|
233
|
-
readonly input?: string;
|
|
234
|
-
readonly send?: string;
|
|
235
|
-
readonly mic?: string;
|
|
236
|
-
readonly endCall?: string;
|
|
237
|
-
};
|
|
238
|
-
/**
|
|
239
|
-
* The small wordmark link rendered directly under the open panel — which
|
|
240
|
-
* adopter's framework fork produced this bundle, not a per-tenant value.
|
|
241
|
-
*
|
|
242
|
-
* A NAME and DATA prop, same rule this file states above for `labels`: this
|
|
243
|
-
* package owns no identity of its own and never imports `@wesence/branding`
|
|
244
|
-
* (this package publishes to public npm with an absolute "resolves no
|
|
245
|
-
* `@wesence/*` module at all" guard, `scripts/check-npm-bundle-provenance.mjs`) —
|
|
246
|
-
* the caller resolves `branding.name`/`branding.domain` and passes them
|
|
247
|
-
* down. `cdn/core.ts` does this unconditionally for the real merchant-facing
|
|
248
|
-
* embed (that file is CDN-only, out of the guard's scope, so importing
|
|
249
|
-
* `@wesence/branding` there is safe); any other caller wanting the badge
|
|
250
|
-
* (the marketing preview, a future light-DOM npm consumer) does the same.
|
|
251
|
-
* Absent ⇒ no attribution renders at all, rather than a placeholder.
|
|
252
|
-
*/
|
|
253
|
-
readonly attribution?: WidgetAttribution;
|
|
254
|
-
}
|
|
255
|
-
export declare function ConciergeShell({ open, onOpenChange, state, messageArrived, avatar, labels, children, badge, draft, onDraftChange, onSubmit, composerDisabled, voice, announcement, skin, skinStyle, idPrefix, scrollKey, composerLeading, testIds, position, onPositionChange, attribution, }: ConciergeShellProps): import("react").JSX.Element;
|
|
256
|
-
//# sourceMappingURL=concierge-shell.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"concierge-shell.d.ts","sourceRoot":"","sources":["../src/concierge-shell.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKL,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAIf,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AA4BvE,OAAO,EAIL,KAAK,iBAAiB,EACvB,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,WAAW,oBAAoB;IACnC,gDAAgD;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,mEAAmE;IACnE,QAAQ,CAAC,IAAI,CA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,EACL,cAAsB,EACtB,MAA8B,EAC9B,MAAM,EACN,QAAQ,EACR,KAAK,EACL,KAAK,EACL,aAAa,EACb,QAAQ,EACR,gBAAwB,EACxB,KAAK,EACL,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,QAAsB,EACtB,SAAS,EACT,eAAe,EACf,OAAO,EACP,QAAqC,EACrC,gBAAgB,EAChB,WAAW,GACZ,EAAE,mBAAmB,+BA67BrB"}
|
package/dist/position.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Where the concierge sits on the host page, and how a visitor moves it.
|
|
3
|
-
*
|
|
4
|
-
* Six anchors, not four. The two centres exist because the launcher is a PILL
|
|
5
|
-
* with a label on it now, not a round button: a wide control tucked into a
|
|
6
|
-
* corner reads as an ad, and the middle of an edge is where a host page's own
|
|
7
|
-
* content is least likely to be. The corners remain because they are where a
|
|
8
|
-
* tenant with a fixed footer or a cookie bar needs it.
|
|
9
|
-
*
|
|
10
|
-
* The tenant picks the default in the widget config; a visitor may drag it
|
|
11
|
-
* somewhere else, and where they put it is theirs — see `nearestPosition`.
|
|
12
|
-
*/
|
|
13
|
-
export declare const CONCIERGE_POSITIONS: readonly ['top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', 'bottom-right'];
|
|
14
|
-
export type ConciergePosition = (typeof CONCIERGE_POSITIONS)[number];
|
|
15
|
-
export declare const DEFAULT_CONCIERGE_POSITION: ConciergePosition;
|
|
16
|
-
/** `top` | `bottom` — which edge the widget hangs from. */
|
|
17
|
-
export type ConciergeEdge = 'top' | 'bottom';
|
|
18
|
-
/** `left` | `center` | `right` — where along that edge. */
|
|
19
|
-
export type ConciergeAlign = 'left' | 'center' | 'right';
|
|
20
|
-
export declare function edgeOf(position: ConciergePosition): ConciergeEdge;
|
|
21
|
-
export declare function alignOf(position: ConciergePosition): ConciergeAlign;
|
|
22
|
-
/**
|
|
23
|
-
* The anchor a dropped widget should snap to.
|
|
24
|
-
*
|
|
25
|
-
* Thirds horizontally, halves vertically, measured on the widget's own CENTRE
|
|
26
|
-
* rather than the pointer: a visitor drags the grip, which sits at one end of
|
|
27
|
-
* the pill, and snapping on the pointer would send a pill they dropped dead
|
|
28
|
-
* centre off to whichever side they happened to be holding.
|
|
29
|
-
*
|
|
30
|
-
* Pure arithmetic on numbers the caller measures, so it is testable without a
|
|
31
|
-
* DOM and cannot disagree with itself across browsers.
|
|
32
|
-
* @param centre the widget's centre point, in viewport pixels
|
|
33
|
-
* @param viewport the viewport's size, in pixels
|
|
34
|
-
*/
|
|
35
|
-
export declare function nearestPosition(centre: {
|
|
36
|
-
x: number;
|
|
37
|
-
y: number;
|
|
38
|
-
}, viewport: {
|
|
39
|
-
width: number;
|
|
40
|
-
height: number;
|
|
41
|
-
}): ConciergePosition;
|
|
42
|
-
/**
|
|
43
|
-
* The anchor an arrow key moves to.
|
|
44
|
-
*
|
|
45
|
-
* The keyboard equivalent of dragging, and not a nicety: a pointer-only way to
|
|
46
|
-
* move the widget is unusable for anyone who cannot drag, and the widget can
|
|
47
|
-
* cover a host page's own controls. Left/right walk the three columns and stop
|
|
48
|
-
* at the ends rather than wrapping — a control that jumps from one edge of the
|
|
49
|
-
* screen to the other because a key was held is disorienting. Up/down flip the
|
|
50
|
-
* edge.
|
|
51
|
-
* @param position where it is now
|
|
52
|
-
* @param key the arrow key pressed
|
|
53
|
-
*/
|
|
54
|
-
export declare function positionForArrow(position: ConciergePosition, key: 'ArrowLeft' | 'ArrowRight' | 'ArrowUp' | 'ArrowDown'): ConciergePosition;
|
|
55
|
-
/** Tailwind classes pinning a fixed element to one anchor. */
|
|
56
|
-
export declare function positionClasses(position: ConciergePosition): string;
|
|
57
|
-
/**
|
|
58
|
-
* How the open PANEL lines up under (or over) the launcher.
|
|
59
|
-
*
|
|
60
|
-
* The panel is much wider than the pill, so it cannot simply share the
|
|
61
|
-
* launcher's anchor: pinned left it would still be pinned left, but pinned
|
|
62
|
-
* centre it has to centre on the viewport rather than on the pill.
|
|
63
|
-
*/
|
|
64
|
-
export declare function panelClasses(position: ConciergePosition): string;
|
|
65
|
-
//# sourceMappingURL=position.d.ts.map
|
package/dist/position.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../src/position.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,YAC9B,UAAU,EACV,YAAY,EACZ,WAAW,EACX,aAAa,EACb,eAAe,EACf,cAAc,CACN,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAErE,eAAO,MAAM,0BAA0B,EAAE,iBAAmC,CAAC;AAE7E,2DAA2D;AAC3D,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,CAAC;AAC7C,2DAA2D;AAC3D,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEzD,wBAAgB,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,aAAa,CAEjE;AAED,wBAAgB,OAAO,CAAC,QAAQ,EAAE,iBAAiB,GAAG,cAAc,CAInE;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,EAChC,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC1C,iBAAiB,CAMnB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,iBAAiB,EAC3B,GAAG,EAAE,WAAW,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,GACxD,iBAAiB,CAUnB;AAED,8DAA8D;AAC9D,wBAAgB,eAAe,CAAC,QAAQ,EAAE,iBAAiB,GAAG,MAAM,C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