@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,38 @@
|
|
|
1
|
+
import { type WidgetMessages } from '../messages.js';
|
|
2
|
+
import type { ChatCards } from '../use-chat-session.js';
|
|
3
|
+
/**
|
|
4
|
+
* THE SHELF — docs/DOCK_SPEC.md §3.4, the sheet's contents for a VOICE
|
|
5
|
+
* session.
|
|
6
|
+
*
|
|
7
|
+
* §1 rule 3: "Recommendations are not a payload inside a bubble: cards are a
|
|
8
|
+
* shelf of at most three; 'see all' is a real page." So this is deliberately
|
|
9
|
+
* NOT `WidgetCardList` (which belongs to a text transcript, where a curation
|
|
10
|
+
* hangs off the turn that produced it): a spoken answer has no bubble, the
|
|
11
|
+
* shelf is the latest curation and only the latest, and the overflow is a
|
|
12
|
+
* link out rather than a longer list.
|
|
13
|
+
*
|
|
14
|
+
* **Full-width rows on mobile, 3-up on desktop** (§3.4), switched by the
|
|
15
|
+
* dock's own `data-viewport` attribute in CSS rather than by a media query
|
|
16
|
+
* here — the dock already knows which viewport class it is in (it sizes the
|
|
17
|
+
* row from it), and two sources for one breakpoint is how they drift.
|
|
18
|
+
*
|
|
19
|
+
* **Prices come from the catalogue, never the model** (§6) — `priceMinor` and
|
|
20
|
+
* `currency` ride on the card the server built. `showPrice` is a tenant
|
|
21
|
+
* toggle (§9.1); `false` hides the line, it does not substitute one.
|
|
22
|
+
*/
|
|
23
|
+
/** §3.4 — "up to three cards from the latest curation". */
|
|
24
|
+
export declare const SHELF_LIMIT = 3;
|
|
25
|
+
export interface DockShelfProps {
|
|
26
|
+
readonly cards: ChatCards;
|
|
27
|
+
readonly messages: WidgetMessages;
|
|
28
|
+
readonly locale: string;
|
|
29
|
+
/** §9.1 `cards.showPrice`. */
|
|
30
|
+
readonly showPrice: boolean;
|
|
31
|
+
/** Builds the "See all N" href. Absent ⇒ no link, and the shelf simply shows its three. */
|
|
32
|
+
readonly curationHref?: (curationId: string) => string;
|
|
33
|
+
readonly productHref?: (handle: string) => string;
|
|
34
|
+
/** A plain left click is handed to the host's router; everything else stays a real link. */
|
|
35
|
+
readonly navigate?: (url: string) => void | Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export declare function DockShelf({ cards, messages, locale, showPrice, curationHref, productHref, navigate, }: DockShelfProps): import("react").JSX.Element | null;
|
|
38
|
+
//# sourceMappingURL=dock-shelf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dock-shelf.d.ts","sourceRoot":"","sources":["../../src/dock/dock-shelf.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,2DAA2D;AAC3D,eAAO,MAAM,WAAW,IAAI,CAAC;AAE7B,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8BAA8B;IAC9B,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,2FAA2F;IAC3F,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;IACvD,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IAClD,4FAA4F;IAC5F,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3D;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,YAAY,EACZ,WAAW,EACX,QAAQ,GACT,EAAE,cAAc,sCAiDhB"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE DOCK'S STATE MACHINE — docs/DOCK_SPEC.md §5.1, as one pure function.
|
|
3
|
+
*
|
|
4
|
+
* Everything under `dock/` renders what `deriveDockState` returns: the row
|
|
5
|
+
* picks its controls from `controls`, the caption reads `caption`, the border
|
|
6
|
+
* and the mark read `border`/`mark`, and the sheet reads `sheet`. Nothing
|
|
7
|
+
* else in the dock decides a state.
|
|
8
|
+
*
|
|
9
|
+
* ## Why it is a pure function over a snapshot
|
|
10
|
+
*
|
|
11
|
+
* The same reason `voice-session-state.ts` and `bot-state.ts` are separate
|
|
12
|
+
* from the components that draw them: whether the shopper is being heard,
|
|
13
|
+
* answered, muted or reconnected is the one thing a voice product has to get
|
|
14
|
+
* right, and it must be assertable without a LiveKit room, a socket, a
|
|
15
|
+
* microphone or a DOM. §5.1 is a thirteen-row table; `dock-state.test.ts`
|
|
16
|
+
* walks it row by row, which is only possible because this takes data and
|
|
17
|
+
* returns data.
|
|
18
|
+
*
|
|
19
|
+
* ## The precedence order IS the behaviour
|
|
20
|
+
*
|
|
21
|
+
* Several claimants can be true at once — a live call that has just
|
|
22
|
+
* escalated, a duck with a curation landing inside it, a reconnect with a
|
|
23
|
+
* refused microphone. The order below is spelled out rather than left to the
|
|
24
|
+
* shape of the `if`s, and it is the same precedence `host-widget.tsx`'s
|
|
25
|
+
* status line already uses for its three claimants (session > voice > cart):
|
|
26
|
+
*
|
|
27
|
+
* 1. **`error`** — the conversation is broken; nothing else the row could
|
|
28
|
+
* say matters more.
|
|
29
|
+
* 2. **`offline`** — the tenant says there is no channel to answer on.
|
|
30
|
+
* 3. **`human`** — a PERSON holds the conversation. Voice is AI-only, so
|
|
31
|
+
* every voice state below is a lie while this is true.
|
|
32
|
+
* 4. **`mic_blocked`** — the browser refused. It outranks `reconnecting`
|
|
33
|
+
* because "resume" is an instruction the shopper cannot follow.
|
|
34
|
+
* 5. **`reconnecting`** — §5.1: the most-seen state on a conventionally
|
|
35
|
+
* navigating storefront.
|
|
36
|
+
* 6. **`ducked`** — the shopper turned to the page.
|
|
37
|
+
* 7. the live voice states, in the order `botStateFor` already established.
|
|
38
|
+
* 8. **`cards`** — only over a quiet row (`dormant`/`ducked`) and only while
|
|
39
|
+
* the sheet is closed, per §5.1's "replaces `dock_ducked` once cards land
|
|
40
|
+
* during a duck". It never steals the caption from a live audio state,
|
|
41
|
+
* where the clause and the partial transcript are the point.
|
|
42
|
+
* 9. **`dormant`**.
|
|
43
|
+
*
|
|
44
|
+
* ## Copy is a KEY, never a string
|
|
45
|
+
*
|
|
46
|
+
* `caption` carries either `{ kind: 'message', key }` — a `WidgetMessages`
|
|
47
|
+
* key the renderer resolves against the tenant's own catalogue — or
|
|
48
|
+
* `{ kind: 'text', text }` for something live (a partial transcript, a spoken
|
|
49
|
+
* clause, an operator's line, the host's error). This module never formats
|
|
50
|
+
* and never localises: it has no messages, on purpose, so the table can be
|
|
51
|
+
* asserted without one.
|
|
52
|
+
*/
|
|
53
|
+
import type { VoicePhase } from '../voice-session-state.js';
|
|
54
|
+
/** Every state the row can be in — §5.1's nine, plus the four the shipped widget already had. */
|
|
55
|
+
export declare const DOCK_STATES: readonly ['dormant', 'connecting', 'listening', 'thinking', 'speaking', 'ducked', 'reconnecting', 'muted', 'mic_blocked', 'human', 'offline', 'error', 'cards'];
|
|
56
|
+
export type DockState = (typeof DOCK_STATES)[number];
|
|
57
|
+
/**
|
|
58
|
+
* §2's control candidates. Never more than three are returned, and the ORDER
|
|
59
|
+
* is the order they are drawn in — `interrupt` first in `speaking` because
|
|
60
|
+
* §5.1 puts it there and because it is the one a thumb reaches for.
|
|
61
|
+
*/
|
|
62
|
+
export type DockControl = 'mic' | 'mute' | 'keyboard' | 'send' | 'interrupt' | 'see' | 'fix_browser' | 'attach';
|
|
63
|
+
/** §2 — the mark carries session state as a TREATMENT, not a colour swap. */
|
|
64
|
+
export type DockMark = 'live' | 'dimmed';
|
|
65
|
+
/** §2's activity slot: a waveform while audio flows, a progress track during retrieval. */
|
|
66
|
+
export type DockActivity = 'none' | 'waveform' | 'progress';
|
|
67
|
+
/** §1 rule 5 — the only chrome that changes. */
|
|
68
|
+
export type DockBorder = 'rest' | 'primary';
|
|
69
|
+
/**
|
|
70
|
+
* What this state does to the sheet. `as-is` is a real answer, not a missing
|
|
71
|
+
* one: most states must leave the sheet exactly where the shopper put it.
|
|
72
|
+
*/
|
|
73
|
+
export type DockSheetPolicy = 'closed' | 'as-is' | 'collapsed';
|
|
74
|
+
/**
|
|
75
|
+
* The caption, as data. `key` is a `WidgetMessages` key (see `messages.ts` —
|
|
76
|
+
* every `dock_*` key is OPTIONAL there, so an older host catalogue falls back
|
|
77
|
+
* to shipped English rather than rendering an empty row).
|
|
78
|
+
*/
|
|
79
|
+
export type DockCaptionSpec = {
|
|
80
|
+
readonly kind: 'field';
|
|
81
|
+
} | {
|
|
82
|
+
readonly kind: 'text';
|
|
83
|
+
readonly text: string;
|
|
84
|
+
} | {
|
|
85
|
+
readonly kind: 'message';
|
|
86
|
+
readonly key: DockMessageKey;
|
|
87
|
+
readonly vars?: Readonly<Record<string, string | number>>;
|
|
88
|
+
};
|
|
89
|
+
/** The `WidgetMessages` keys this module can name. Narrow on purpose — a typo is a compile error. */
|
|
90
|
+
export type DockMessageKey = 'dock_connecting' | 'dock_listening' | 'dock_thinking' | 'dock_ducked' | 'dock_still_here' | 'dock_still_here_resume' | 'dock_muted' | 'dock_mic_blocked' | 'dock_cards' | 'dock_voice_failed' | 'escalated_banner';
|
|
91
|
+
/** The voice leg, as the row needs to see it — a superset of `VoiceSessionSnapshot`'s fields. */
|
|
92
|
+
export interface DockVoiceInput {
|
|
93
|
+
/** The tenant published voice AND this is not an embedded webview (§8.4). */
|
|
94
|
+
readonly enabled: boolean;
|
|
95
|
+
readonly phase: VoicePhase;
|
|
96
|
+
/** The caller's microphone is published to the room. */
|
|
97
|
+
readonly micOpen: boolean;
|
|
98
|
+
/** The browser is being asked for the microphone right now (`VoiceSessionSnapshot.micPending`). */
|
|
99
|
+
readonly micPending: boolean;
|
|
100
|
+
/** The browser REFUSED. Distinct from muted: no press can undo it on this page (§5.1). */
|
|
101
|
+
readonly micBlocked: boolean;
|
|
102
|
+
readonly agentPresent: boolean;
|
|
103
|
+
readonly agentSpeaking: boolean;
|
|
104
|
+
readonly callerSpeaking: boolean;
|
|
105
|
+
readonly awaitingAgent: boolean;
|
|
106
|
+
}
|
|
107
|
+
export interface DockStateInput {
|
|
108
|
+
/** The shopper has expressed intent — before that the dock is resting, whatever the transports say. */
|
|
109
|
+
readonly engaged: boolean;
|
|
110
|
+
readonly voice: DockVoiceInput;
|
|
111
|
+
/** What is in the composer right now. Only `dormant` reads it, for the send control. */
|
|
112
|
+
readonly draft: string;
|
|
113
|
+
/** §5.5 — the shopper turned to the page during `speaking`. */
|
|
114
|
+
readonly ducked: boolean;
|
|
115
|
+
/** §8.6 — the session is being resumed (a navigation, a return from lock). */
|
|
116
|
+
readonly reconnecting: boolean;
|
|
117
|
+
/** The room itself dropped, so the resume needs a tap rather than just a wait. */
|
|
118
|
+
readonly roomDropped: boolean;
|
|
119
|
+
/** A PERSON holds the conversation (`UseChatSessionResult.status === 'escalated'`). */
|
|
120
|
+
readonly escalated: boolean;
|
|
121
|
+
/** The operator's last line, once they have said anything. */
|
|
122
|
+
readonly operatorLine?: string;
|
|
123
|
+
/** The attach control is escalated-only (`AGENTS.md` — the concierge has no vision path). */
|
|
124
|
+
readonly canAttach: boolean;
|
|
125
|
+
/**
|
|
126
|
+
* A host that can actually open the browser's own permission help (§5.1's
|
|
127
|
+
* `dock_fix_browser`).
|
|
128
|
+
*
|
|
129
|
+
* Gated for the same reason `canAttach` is: a control that provably does
|
|
130
|
+
* nothing is worse than no control. Nothing in the browser can open that UI
|
|
131
|
+
* from script, so most hosts have nothing to offer here — and
|
|
132
|
+
* `dock_mic_blocked` ("Mic blocked — type instead") already tells the
|
|
133
|
+
* shopper what they can do.
|
|
134
|
+
*/
|
|
135
|
+
readonly canFixPermission: boolean;
|
|
136
|
+
readonly offline: boolean;
|
|
137
|
+
readonly offlineMessage?: string;
|
|
138
|
+
/**
|
|
139
|
+
* The host's status line, for the two claimants that are genuinely ERRORS:
|
|
140
|
+
* the conversation itself is broken, or the voice leg is (a refused
|
|
141
|
+
* microphone, a dead speech vendor).
|
|
142
|
+
*/
|
|
143
|
+
readonly error?: string;
|
|
144
|
+
/**
|
|
145
|
+
* WHICH claimant `error` came from — the conversation, or the voice leg.
|
|
146
|
+
*
|
|
147
|
+
* The host resolves the precedence (session > voice) into one string before
|
|
148
|
+
* it reaches the dock, and the string alone cannot say what it is: this
|
|
149
|
+
* module has to know a voice CONNECT failed to swap its transport text for
|
|
150
|
+
* §5.1's `dock_voice_failed`, and it must not do that to a session error
|
|
151
|
+
* that merely happened while the room was also down.
|
|
152
|
+
*/
|
|
153
|
+
readonly errorSource?: 'session' | 'voice';
|
|
154
|
+
/**
|
|
155
|
+
* A line the shopper needs to READ that is not an error — today, only
|
|
156
|
+
* `cart_add_failed`: the concierge said an item was going in the basket and
|
|
157
|
+
* only this browser knows it did not.
|
|
158
|
+
*
|
|
159
|
+
* It replaces the CAPTION and changes nothing else. Folding it into `error`
|
|
160
|
+
* instead cost the row its whole live state: an add that failed mid-call
|
|
161
|
+
* took `speaking` down to `error` for the rest of the session, so the
|
|
162
|
+
* clause disappeared and mute and interrupt went with it — and
|
|
163
|
+
* `agentAddFailed` is only cleared by the NEXT successful agent add, so it
|
|
164
|
+
* did not go away. §5.1 puts `cart_add_failed` in the caption; that is all
|
|
165
|
+
* it asks for.
|
|
166
|
+
*/
|
|
167
|
+
readonly notice?: string;
|
|
168
|
+
/** How many cards the latest curation put on the shelf. */
|
|
169
|
+
readonly shelfCount: number;
|
|
170
|
+
readonly sheetOpen: boolean;
|
|
171
|
+
/** The live partial transcript, current utterance only (§5.1's `listening`). */
|
|
172
|
+
readonly partialTranscript?: string;
|
|
173
|
+
/** `FillerPolicy`'s model-authored acknowledgement (§6) — the designed `thinking` caption. */
|
|
174
|
+
readonly preamble?: string;
|
|
175
|
+
/** The clause the agent is saying right now (§5.1's `speaking`). */
|
|
176
|
+
readonly clause?: string;
|
|
177
|
+
}
|
|
178
|
+
export interface DockView {
|
|
179
|
+
readonly state: DockState;
|
|
180
|
+
readonly mark: DockMark;
|
|
181
|
+
readonly activity: DockActivity;
|
|
182
|
+
readonly caption: DockCaptionSpec;
|
|
183
|
+
/** At most three (§2), in draw order. */
|
|
184
|
+
readonly controls: readonly DockControl[];
|
|
185
|
+
readonly border: DockBorder;
|
|
186
|
+
readonly sheet: DockSheetPolicy;
|
|
187
|
+
/**
|
|
188
|
+
* There is a CALL to end — the room is being dialled, is up, or is waiting
|
|
189
|
+
* for the worker to join.
|
|
190
|
+
*
|
|
191
|
+
* The sheet's header hangs "End the call" off this rather than off the
|
|
192
|
+
* presence of an `onEndCall` handler, which is a property of the HOST and
|
|
193
|
+
* not of the session: `host-widget.tsx` passes the handler for any tenant
|
|
194
|
+
* with voice published, so the control stood in `dormant` before anything
|
|
195
|
+
* had been dialled and stayed standing after a connect that failed. A
|
|
196
|
+
* control whose only honest answer is "there is nothing to end" is the
|
|
197
|
+
* thing §5.1's table exists to prevent.
|
|
198
|
+
*
|
|
199
|
+
* Mute is not a hang-up and a reconnect is not a disconnection, so both
|
|
200
|
+
* keep it — it goes false only when the room is genuinely gone (`idle`,
|
|
201
|
+
* `disconnected`, `failed`) or the tenant has no voice leg at all.
|
|
202
|
+
*/
|
|
203
|
+
readonly callActive: boolean;
|
|
204
|
+
/**
|
|
205
|
+
* The microphone is drawn but cannot be used — `human` only. DISABLED
|
|
206
|
+
* rather than hidden, the posture this widget already takes everywhere
|
|
207
|
+
* else: a mic that vanishes at the handoff reads as a bug, a dimmed one
|
|
208
|
+
* with a reason on it reads as the product.
|
|
209
|
+
*/
|
|
210
|
+
readonly micDisabled?: boolean;
|
|
211
|
+
}
|
|
212
|
+
/** A dock nobody has touched, on a tenant with no voice. Every field explicit — see `DockStateInput`. */
|
|
213
|
+
export declare const idleDockInput: DockStateInput;
|
|
214
|
+
/**
|
|
215
|
+
* §5.1's table, as a function.
|
|
216
|
+
*
|
|
217
|
+
* @param input the session, as data — see {@link DockStateInput}
|
|
218
|
+
* @returns everything the row, the caption and the sheet need for one render
|
|
219
|
+
*/
|
|
220
|
+
export declare function deriveDockState(input: DockStateInput): DockView;
|
|
221
|
+
//# sourceMappingURL=dock-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dock-state.d.ts","sourceRoot":"","sources":["../../src/dock/dock-state.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,iGAAiG;AACjG,eAAO,MAAM,WAAW,YACtB,SAAS,EACT,YAAY,EACZ,WAAW,EACX,UAAU,EACV,UAAU,EACV,QAAQ,EACR,cAAc,EACd,OAAO,EACP,aAAa,EACb,OAA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'../messages.js';
|
|
4
|
+
import { type WidgetColorConfig, type WidgetTypeConfig } from '../theme/derive.js';
|
|
5
|
+
import type { ChatCards } from '../use-chat-session.js';
|
|
6
|
+
import { type DesktopAlign, type DesktopWidth, type Direction } from './geometry.js';
|
|
7
|
+
import { DockCaption } from './dock-caption.js';
|
|
8
|
+
import { type DockIdentityView } from './dock-row.js';
|
|
9
|
+
/**
|
|
10
|
+
* THE DOCK — docs/DOCK_SPEC.md §2–§5, composed, plus §4.2's handover.
|
|
11
|
+
*
|
|
12
|
+
* This is what `ConciergeShell` and `ConciergeLauncher` were, and it is a
|
|
13
|
+
* different shape rather than a restyle. There is **no open state**: a pill
|
|
14
|
+
* and a row that swap, and a sheet that rises above the row only while there
|
|
15
|
+
* is something to show. That is what retires the class of bug behind SAA-131
|
|
16
|
+
* — the handover carries a draft and a focus target, and there is no third
|
|
17
|
+
* thing left to lose.
|
|
18
|
+
*
|
|
19
|
+
* ## §4.2, frame by frame, from this side
|
|
20
|
+
*
|
|
21
|
+
* `cdn/dock-dom.ts` froze everything the shopper had done at the moment of
|
|
22
|
+
* intent and `cdn/core.ts` handed it here. The first `useLayoutEffect` below:
|
|
23
|
+
*
|
|
24
|
+
* 1. calls `onReady()` — `cdn/ui.ts` makes this container visible and
|
|
25
|
+
* `cdn/core.ts` removes its own row, both synchronously, inside the
|
|
26
|
+
* `flushSync` that rendered us. One paint.
|
|
27
|
+
* 2. restores focus and the caret onto THIS input, which is why step 1 has
|
|
28
|
+
* to come first: a `visibility: hidden` element cannot take focus.
|
|
29
|
+
*
|
|
30
|
+
* None of the payload can be recovered after the fact — the caret is gone the
|
|
31
|
+
* moment focus moves, the hold gesture is over, and iOS will not unlock audio
|
|
32
|
+
* outside the gesture that started it (§8.5) — which is why it crosses the
|
|
33
|
+
* boundary at all.
|
|
34
|
+
*
|
|
35
|
+
* A hold **released before the room was ready** is remembered here and applied
|
|
36
|
+
* the moment it is (§5.2: "never lost").
|
|
37
|
+
*
|
|
38
|
+
* ## What is deliberately NOT React state
|
|
39
|
+
*
|
|
40
|
+
* The mic level, the keyboard offset and the sheet's drag position (§7.1 rule
|
|
41
|
+
* 5). All three change every frame; all three are written as CSS custom
|
|
42
|
+
* properties by `dock-motion.ts`'s writer, on one element, once per frame.
|
|
43
|
+
*/
|
|
44
|
+
/**
|
|
45
|
+
* The small wordmark under the sheet — which adopter's framework fork
|
|
46
|
+
* produced this bundle, not a per-tenant value.
|
|
47
|
+
*
|
|
48
|
+
* A NAME and DATA prop: this package owns no identity of its own and never
|
|
49
|
+
* imports `@wesence/branding` (it publishes to public npm behind an absolute
|
|
50
|
+
* "resolves no `@wesence/*` module at all" guard,
|
|
51
|
+
* `scripts/check-npm-bundle-provenance.mjs`), so the CALLER resolves
|
|
52
|
+
* `branding.name`/`branding.domain` and passes them down. `cdn/core.ts` does
|
|
53
|
+
* this unconditionally for the real merchant-facing embed — that file is
|
|
54
|
+
* CDN-only and out of the guard's scope. Absent ⇒ no attribution renders at
|
|
55
|
+
* all, rather than a placeholder.
|
|
56
|
+
*
|
|
57
|
+
* Declared here, having moved from the retired `concierge-shell.tsx`: the
|
|
58
|
+
* dock is the only surface that renders it now, and the name is kept so every
|
|
59
|
+
* consumer's import keeps compiling.
|
|
60
|
+
*/
|
|
61
|
+
export interface WidgetAttribution {
|
|
62
|
+
readonly name: string;
|
|
63
|
+
readonly href: string;
|
|
64
|
+
}
|
|
65
|
+
export interface DockLayoutView {
|
|
66
|
+
readonly desktopAlign: DesktopAlign;
|
|
67
|
+
readonly desktopWidth: DesktopWidth;
|
|
68
|
+
/** §5.4. `never` has no pill at all — no recede, no minimise control. */
|
|
69
|
+
readonly minimised: 'never' | 'shopper' | 'startMinimised';
|
|
70
|
+
}
|
|
71
|
+
/** The tenant's `copy[locale]` (§9.1), as the dock reads it. */
|
|
72
|
+
export interface DockCopyView {
|
|
73
|
+
readonly greeting?: string;
|
|
74
|
+
readonly placeholder?: string;
|
|
75
|
+
readonly offlineMessage?: string;
|
|
76
|
+
readonly minimisedLabel?: string;
|
|
77
|
+
}
|
|
78
|
+
/** The voice leg, as the dock drives it. Absent ⇒ no microphone is ever drawn. */
|
|
79
|
+
export interface DockVoiceProps {
|
|
80
|
+
/** The tenant published voice AND this is not an embedded webview (§8.4). */
|
|
81
|
+
readonly enabled: boolean;
|
|
82
|
+
readonly phase: 'idle' | 'connecting' | 'connected' | 'disconnected' | 'failed';
|
|
83
|
+
readonly micOpen: boolean;
|
|
84
|
+
readonly micPending: boolean;
|
|
85
|
+
/** The browser REFUSED — §5.1's `mic_blocked`. */
|
|
86
|
+
readonly micBlocked?: boolean;
|
|
87
|
+
readonly agentPresent?: boolean;
|
|
88
|
+
readonly agentSpeaking?: boolean;
|
|
89
|
+
readonly callerSpeaking?: boolean;
|
|
90
|
+
readonly awaitingAgent?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* 0..1 RMS, for the waveform — a LIVE REF, never a number (§7.1 rule 5).
|
|
93
|
+
*
|
|
94
|
+
* The analyser writes it on every animation frame. A number prop here would
|
|
95
|
+
* mean the caller holds it in state, and sixty renders a second of this
|
|
96
|
+
* whole tree for a value whose only destination is `--wgt-level-*`. The
|
|
97
|
+
* waveform's own `requestAnimationFrame` reads `.current` and writes the
|
|
98
|
+
* custom properties; nothing in React ever observes it. See the module doc
|
|
99
|
+
* comment, and `useVoiceSession`'s `agentLevelRef`.
|
|
100
|
+
*/
|
|
101
|
+
readonly levelRef?: {
|
|
102
|
+
readonly current: number;
|
|
103
|
+
};
|
|
104
|
+
readonly onStart?: () => void;
|
|
105
|
+
readonly onToggleMute?: () => void;
|
|
106
|
+
/**
|
|
107
|
+
* §5.2 — the end-of-utterance hint sent on release. Absent ⇒ the release
|
|
108
|
+
* still mutes; the endpointer just has to find the boundary itself.
|
|
109
|
+
*/
|
|
110
|
+
readonly onEouHint?: () => void;
|
|
111
|
+
/**
|
|
112
|
+
* §5.1's ducked, and the row's own barge-in. `'look'` is the client-
|
|
113
|
+
* initiated pause (§5.5); `'tap'` is a deliberate interrupt — the control,
|
|
114
|
+
* or the row itself while the agent is speaking.
|
|
115
|
+
*
|
|
116
|
+
* The names are `@saar-ai/widget-protocol/telemetry`'s
|
|
117
|
+
* `CALLER_INTERRUPT_REASONS`, which is what reaches the worker and what an
|
|
118
|
+
* operator's console reads back; they are not this component's to invent.
|
|
119
|
+
*/
|
|
120
|
+
readonly onInterrupt?: (reason: 'look' | 'tap') => void;
|
|
121
|
+
/**
|
|
122
|
+
* §5.1 — the duck is over: the shopper spoke, or tapped the microphone.
|
|
123
|
+
* Never a timer.
|
|
124
|
+
*
|
|
125
|
+
* The other half of `onInterrupt('look')`. That frame left the worker
|
|
126
|
+
* holding a cancelled turn and deliberately silent, so lifting the duck
|
|
127
|
+
* without this would leave the shopper looking at a live row nobody is
|
|
128
|
+
* going to speak into. Fired ONCE per duck, and only for a duck this dock
|
|
129
|
+
* actually entered.
|
|
130
|
+
*/
|
|
131
|
+
readonly onResume?: () => void;
|
|
132
|
+
/** §5.1 — opens the browser's own permission help. Offered once. */
|
|
133
|
+
readonly onFixPermission?: () => void;
|
|
134
|
+
/**
|
|
135
|
+
* Present and DISABLED rather than hidden, for a surface that has no voice
|
|
136
|
+
* leg but wants to show the product has one — the marketing preview, whose
|
|
137
|
+
* page denies `microphone=()` outright. A host with nothing to offer sets
|
|
138
|
+
* `enabled: false` instead and no microphone is drawn at all.
|
|
139
|
+
*
|
|
140
|
+
* Deliberately NOT a §5.1 state: nothing about the session has changed, so
|
|
141
|
+
* nothing about the caption, the border or the sheet should.
|
|
142
|
+
*/
|
|
143
|
+
readonly disabled?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* WHY the microphone cannot be used, replacing its own name for as long as
|
|
146
|
+
* it cannot.
|
|
147
|
+
*
|
|
148
|
+
* A button that performs nothing must not announce an action: a shopper who
|
|
149
|
+
* hears "Start talking" on a control that refuses every press has been told
|
|
150
|
+
* the product is broken. Absent ⇒ `voice_unavailable_escalated`, which is
|
|
151
|
+
* the right answer for §5.1's `human` row and the wrong one for a browser
|
|
152
|
+
* that refused — hence the override.
|
|
153
|
+
*/
|
|
154
|
+
readonly unavailableReason?: string;
|
|
155
|
+
}
|
|
156
|
+
export interface DockProps {
|
|
157
|
+
readonly identity: DockIdentityView;
|
|
158
|
+
/** §9.1's `color`/`type` groups. Absent ⇒ the shipped defaults. */
|
|
159
|
+
readonly color?: WidgetColorConfig;
|
|
160
|
+
readonly type?: WidgetTypeConfig;
|
|
161
|
+
readonly layout?: DockLayoutView;
|
|
162
|
+
readonly copy?: DockCopyView;
|
|
163
|
+
readonly direction?: Direction;
|
|
164
|
+
readonly locale?: string;
|
|
165
|
+
readonly messages?: WidgetMessages;
|
|
166
|
+
readonly voice?: DockVoiceProps;
|
|
167
|
+
/** A PERSON holds the conversation — §5.1's `human`. */
|
|
168
|
+
readonly escalated?: boolean;
|
|
169
|
+
readonly offline?: boolean;
|
|
170
|
+
/** The host's status line — §5.1's `error`: a broken conversation, or a broken voice leg. */
|
|
171
|
+
readonly status?: string;
|
|
172
|
+
/**
|
|
173
|
+
* WHICH claimant `status` came from. See `DockStateInput.errorSource`: the
|
|
174
|
+
* host resolves the precedence (session > voice) into one string, and the
|
|
175
|
+
* string alone cannot say whether §5.1's `dock_voice_failed` applies to it.
|
|
176
|
+
*/
|
|
177
|
+
readonly statusKind?: 'session' | 'voice';
|
|
178
|
+
/**
|
|
179
|
+
* A line the shopper needs to READ that is not an error — see
|
|
180
|
+
* `DockStateInput.notice`. It takes the caption and changes nothing else.
|
|
181
|
+
*/
|
|
182
|
+
readonly notice?: string;
|
|
183
|
+
readonly operatorLine?: string;
|
|
184
|
+
readonly reconnecting?: boolean;
|
|
185
|
+
readonly roomDropped?: boolean;
|
|
186
|
+
readonly partialTranscript?: string;
|
|
187
|
+
readonly preamble?: string;
|
|
188
|
+
readonly clause?: string;
|
|
189
|
+
/** §3.4 — a voice session's sheet is the SHELF, a text session's is the transcript. */
|
|
190
|
+
readonly channel?: 'voice' | 'text';
|
|
191
|
+
readonly shelf?: ChatCards;
|
|
192
|
+
/** The text session's transcript, supplied by the caller (`voice-widget.tsx`). */
|
|
193
|
+
readonly transcript?: ReactNode;
|
|
194
|
+
/** Anything the sheet holds beside its main content: the basket, chips, the handoff marker. */
|
|
195
|
+
readonly sheetExtra?: ReactNode;
|
|
196
|
+
/** Bumped when the sheet's contents grew, so the scroll can follow a reader at the bottom. */
|
|
197
|
+
readonly followKey?: unknown;
|
|
198
|
+
/**
|
|
199
|
+
* The sheet holds something the shopper explicitly ASKED for: the basket
|
|
200
|
+
* after a basket intent, or the progress of a file they just picked.
|
|
201
|
+
*
|
|
202
|
+
* The sheet's own automatic open (§5.2) fires once per dock and only on a
|
|
203
|
+
* text channel, which is right for what it covers and blind to this. A
|
|
204
|
+
* caller who says "what's in my basket" mid-call is on the voice channel,
|
|
205
|
+
* which never auto-opens at all; a typed shopper who dismissed the sheet to
|
|
206
|
+
* look at a product has already spent the one open. Both had the basket
|
|
207
|
+
* rendered into a surface that stayed shut, and nothing on the row points at
|
|
208
|
+
* it — §5.1 has a `cards` claimant for a curation and none for the basket.
|
|
209
|
+
*
|
|
210
|
+
* The attachment's status is the same shape of problem with a shorter fuse:
|
|
211
|
+
* the paperclip sits on the always-visible row while "Sending rug.png…" and
|
|
212
|
+
* "Could not send rug.png" are drawn in the sheet, so a shopper who had
|
|
213
|
+
* scrolled the page since — §5.5 shuts the sheet on a scroll past 24 px, a
|
|
214
|
+
* tap outside the dock, or a bridge page change — picked a photo and was
|
|
215
|
+
* told nothing at all about where it went.
|
|
216
|
+
*
|
|
217
|
+
* Edge-triggered, on the rise: an answer the shopper asked for is shown
|
|
218
|
+
* once, and dismissing it keeps it dismissed until they ask again.
|
|
219
|
+
*/
|
|
220
|
+
readonly revealSheet?: boolean;
|
|
221
|
+
/** §9.1 `cards.showPrice`. */
|
|
222
|
+
readonly showPrice?: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* §9.1 `cards.imageAspect` — the fixed box every card thumbnail is drawn
|
|
225
|
+
* in, and the reason §7.1 rule 7 can promise the shelf never shifts.
|
|
226
|
+
*
|
|
227
|
+
* It is a TENANT choice because a catalogue is shot one way: a fashion
|
|
228
|
+
* merchant's photography is portrait and a rug merchant's is landscape, and
|
|
229
|
+
* cropping either to a square is the difference between a shelf that looks
|
|
230
|
+
* like their store and one that looks like ours.
|
|
231
|
+
*/
|
|
232
|
+
readonly cardImageAspect?: WidgetImageAspect;
|
|
233
|
+
/** §9.1 `layout.bottomOffset`. `'auto'` runs §8.3's sticky-footer detector. */
|
|
234
|
+
readonly bottomOffset?: 'auto' | number;
|
|
235
|
+
readonly curationHref?: (curationId: string) => string;
|
|
236
|
+
readonly productHref?: (handle: string) => string;
|
|
237
|
+
readonly navigate?: (url: string) => void | Promise<void>;
|
|
238
|
+
readonly draft: string;
|
|
239
|
+
readonly onDraftChange: (value: string) => void;
|
|
240
|
+
readonly onSubmit: () => void;
|
|
241
|
+
readonly composerDisabled?: boolean;
|
|
242
|
+
/** Escalated-only (§5.1's `human`) — absent ⇒ no attach control is offered. */
|
|
243
|
+
readonly onAttach?: () => void;
|
|
244
|
+
/**
|
|
245
|
+
* An upload is already in flight, so the paperclip is not offered again.
|
|
246
|
+
*
|
|
247
|
+
* The host holds ONE slot for "what is being sent" and reports the outcome
|
|
248
|
+
* into it, so a second pick before the first resolves silently loses one of
|
|
249
|
+
* the two answers. Owned by the host rather than derived here: this dock
|
|
250
|
+
* draws the control, and the widget that owns the file input owns what
|
|
251
|
+
* uploading means.
|
|
252
|
+
*/
|
|
253
|
+
readonly attachBusy?: boolean;
|
|
254
|
+
/** The hidden `<input type="file">` its owner renders; the dock only gives it a home. */
|
|
255
|
+
readonly attachSlot?: ReactNode;
|
|
256
|
+
/** §5.6 — a rule fired. Grows the pill into the row for 8 s, then recedes. Never opens the sheet, never plays audio. */
|
|
257
|
+
readonly proactive?: string;
|
|
258
|
+
/** §5.5 — the bridge saw the shopper move to another page. Any change closes the sheet and ducks a live reply. */
|
|
259
|
+
readonly pageKey?: string | number;
|
|
260
|
+
/**
|
|
261
|
+
* Leave the call — a different intention from muting it, and the reason it
|
|
262
|
+
* is in the SHEET's header rather than in the row: §2 caps the row at three
|
|
263
|
+
* controls, and mute/keyboard/interrupt are the three a caller reaches for
|
|
264
|
+
* mid-sentence. Hanging up is deliberate, and a deliberate action can cost
|
|
265
|
+
* one more tap. Absent ⇒ no hang-up is offered, which is correct for a host
|
|
266
|
+
* with no voice leg.
|
|
267
|
+
*/
|
|
268
|
+
readonly onEndCall?: () => void;
|
|
269
|
+
/**
|
|
270
|
+
* Inline brand-token overrides for the LEGACY `--brand-*` custom properties
|
|
271
|
+
* the transcript's bubbles still read (`concierge.css`).
|
|
272
|
+
*
|
|
273
|
+
* The dock's own chrome is coloured entirely from `--wgt-*` (§9.2), so this
|
|
274
|
+
* exists only for the conversation rendered INSIDE the sheet, which was not
|
|
275
|
+
* restyled by this change. It is merged under the geometry, so nothing here
|
|
276
|
+
* can move the dock.
|
|
277
|
+
*/
|
|
278
|
+
readonly skinStyle?: CSSProperties;
|
|
279
|
+
/**
|
|
280
|
+
* `[data-skin]` on the dock's root, for a host whose brand tokens are set
|
|
281
|
+
* by a stylesheet block rather than by `color`/`type` — the marketing
|
|
282
|
+
* site's theme picker, which drives the scripted preview and the real
|
|
283
|
+
* widget from one attribute (`apps/marketing/src/app/globals.css`).
|
|
284
|
+
*/
|
|
285
|
+
readonly skin?: string;
|
|
286
|
+
/**
|
|
287
|
+
* A PREVIEW of the dock, not a session: the console's publish dialog and
|
|
288
|
+
* any other surface showing a merchant what their widget will look like.
|
|
289
|
+
*
|
|
290
|
+
* It changes exactly two things, both of which exist because the viewer is
|
|
291
|
+
* not a shopper:
|
|
292
|
+
*
|
|
293
|
+
* 1. §4.2's "the row is earned by intent" does not apply. A React dock
|
|
294
|
+
* mounting on a storefront means somebody reached for it, so the first
|
|
295
|
+
* layout effect expands the pill into the row. Nobody reached for a
|
|
296
|
+
* preview — it mounts because a form is open — so the resting form stays
|
|
297
|
+
* what `layout.minimised` says it is. Without this a console preview can
|
|
298
|
+
* never show the PILL, which is the shipped default and therefore the
|
|
299
|
+
* one thing a merchant most needs to see.
|
|
300
|
+
* 2. A minimise is not persisted. `wgt_dock_minimised` is a shopper's
|
|
301
|
+
* preference on a merchant's origin; a preview writing it would leave a
|
|
302
|
+
* key in whatever page is doing the previewing.
|
|
303
|
+
*
|
|
304
|
+
* Nothing else is gated on it. In particular the preview is a REAL dock —
|
|
305
|
+
* every state, control, gesture and token is the shipped one, which is the
|
|
306
|
+
* whole point of previewing with this component rather than a mock.
|
|
307
|
+
*/
|
|
308
|
+
readonly preview?: boolean;
|
|
309
|
+
/** §11 — what a screen reader is told, replacing what the chrome conveys. */
|
|
310
|
+
readonly announcement?: string;
|
|
311
|
+
/** The small wordmark under the sheet — resolved by the caller, never by this package. */
|
|
312
|
+
readonly attribution?: WidgetAttribution;
|
|
313
|
+
/** ── §4.2's handover payload ────────────────────────────────────────── */
|
|
314
|
+
readonly initialDraft?: string;
|
|
315
|
+
readonly initialSelection?: {
|
|
316
|
+
start: number;
|
|
317
|
+
end: number;
|
|
318
|
+
};
|
|
319
|
+
readonly initialFocus?: 'composer' | 'mic' | null;
|
|
320
|
+
readonly initialMinimised?: boolean;
|
|
321
|
+
readonly insets?: {
|
|
322
|
+
kb: number;
|
|
323
|
+
hostOffset: number;
|
|
324
|
+
};
|
|
325
|
+
readonly hold?: {
|
|
326
|
+
downAt: number;
|
|
327
|
+
releasedAt?: number;
|
|
328
|
+
};
|
|
329
|
+
readonly audio?: {
|
|
330
|
+
context: AudioContext;
|
|
331
|
+
};
|
|
332
|
+
/**
|
|
333
|
+
* §4.2 step 3. Called from the FIRST layout effect, before focus is moved:
|
|
334
|
+
* `cdn/ui.ts` makes this container visible and `cdn/core.ts` removes its own
|
|
335
|
+
* row inside the same synchronous render.
|
|
336
|
+
*/
|
|
337
|
+
readonly onReady?: () => void;
|
|
338
|
+
}
|
|
339
|
+
/** §5.1 — "labelled the first two times per visitor, icon after". */
|
|
340
|
+
export declare const INTERRUPT_LABEL_LIMIT = 2;
|
|
341
|
+
export declare const INTERRUPT_SEEN_STORAGE_KEY = "wgt_dock_interrupt_seen";
|
|
342
|
+
export declare function Dock(props: DockProps): import("react").JSX.Element;
|
|
343
|
+
export { DockCaption };
|
|
344
|
+
//# sourceMappingURL=dock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dock.d.ts","sourceRoot":"","sources":["../../src/dock/dock.tsx"],"names":[],"mappings":"AAEA,OAAO,EASL,KAAK,aAAa,EAClB,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAwC,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAQjG,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAYL,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUhD,OAAO,EAAW,KAAK,gBAAgB,EAAsB,MAAM,eAAe,CAAC;AAWnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IACpC,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG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