@smooai/chat-widget 0.11.0 → 0.12.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/chat-widget.global.js +268 -9
- package/dist/chat-widget.global.js.map +1 -1
- package/dist/index.d.ts +262 -236
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +249 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/conversation.ts +112 -2
- package/src/element.ts +178 -5
- package/src/styles.ts +11 -2
package/dist/index.d.ts
CHANGED
|
@@ -138,242 +138,6 @@ interface ChatWidgetConfig {
|
|
|
138
138
|
theme?: ChatWidgetTheme;
|
|
139
139
|
}
|
|
140
140
|
//#endregion
|
|
141
|
-
//#region src/element.d.ts
|
|
142
|
-
declare const ELEMENT_TAG = "smooth-agent-chat";
|
|
143
|
-
declare class SmoothAgentChatElement extends HTMLElement {
|
|
144
|
-
static get observedAttributes(): readonly string[];
|
|
145
|
-
private readonly root;
|
|
146
|
-
private controller;
|
|
147
|
-
private overrides;
|
|
148
|
-
private open;
|
|
149
|
-
private messages;
|
|
150
|
-
private status;
|
|
151
|
-
private mounted;
|
|
152
|
-
/** True once the visitor has cleared the pre-chat identity gate (or it's not needed). */
|
|
153
|
-
private userInfoSatisfied;
|
|
154
|
-
/** True after the visitor has sent their first message (hides starter chips). */
|
|
155
|
-
private hasSent;
|
|
156
|
-
/** Starter prompts shown as chips in the empty state. */
|
|
157
|
-
private examplePrompts;
|
|
158
|
-
/** Whether mid-conversation suggested-reply chips are shown (config). */
|
|
159
|
-
private showSuggestedReplies;
|
|
160
|
-
/** Resolved greeting text, cached so async (rAF) renders can reuse it. */
|
|
161
|
-
private greeting;
|
|
162
|
-
/** Current mid-turn interrupt (OTP / tool-confirmation), or null. */
|
|
163
|
-
private interrupt;
|
|
164
|
-
private interruptEl;
|
|
165
|
-
/** Cross-device "restore my chats" flow state (ADR-048 §c). */
|
|
166
|
-
private identityRestore;
|
|
167
|
-
/** Whether the cross-device restore affordance is offered (config). */
|
|
168
|
-
private allowChatRestore;
|
|
169
|
-
/** True while the pre-chat identity gate is showing (blocks premature connect). */
|
|
170
|
-
private gating;
|
|
171
|
-
private panelEl;
|
|
172
|
-
private launcherEl;
|
|
173
|
-
private messagesEl;
|
|
174
|
-
private statusEl;
|
|
175
|
-
private dotEl;
|
|
176
|
-
private inputEl;
|
|
177
|
-
private sendBtn;
|
|
178
|
-
private suggestionsEl;
|
|
179
|
-
/** The live streaming assistant bubble whose textContent the rAF loop drives. */
|
|
180
|
-
private streamBubbleEl;
|
|
181
|
-
/** Message id the reveal is bound to (guards against stale frames after rebuilds). */
|
|
182
|
-
private streamMsgId;
|
|
183
|
-
/** Full buffered target text for the streaming message (grows as tokens arrive). */
|
|
184
|
-
private streamTarget;
|
|
185
|
-
/** How many chars of {@link streamTarget} are currently shown. */
|
|
186
|
-
private displayedLength;
|
|
187
|
-
private rafId;
|
|
188
|
-
constructor();
|
|
189
|
-
connectedCallback(): void;
|
|
190
|
-
disconnectedCallback(): void;
|
|
191
|
-
attributeChangedCallback(): void;
|
|
192
|
-
/**
|
|
193
|
-
* Programmatically merge config overrides (endpoint, agentId, theme, …). Values
|
|
194
|
-
* set here take precedence over HTML attributes. Re-renders the widget.
|
|
195
|
-
*/
|
|
196
|
-
configure(config: Partial<ChatWidgetConfig>): void;
|
|
197
|
-
/** Open the chat panel. */
|
|
198
|
-
openChat(): void;
|
|
199
|
-
/** Collapse the chat panel back to the launcher. */
|
|
200
|
-
closeChat(): void;
|
|
201
|
-
private readConfig;
|
|
202
|
-
private render;
|
|
203
|
-
/**
|
|
204
|
-
* Render (or clear) the mid-turn interrupt overlay above the composer:
|
|
205
|
-
* an OTP code prompt or a tool-write confirmation. Server-supplied text is
|
|
206
|
-
* set via `textContent` (never innerHTML); only static icons use innerHTML.
|
|
207
|
-
*/
|
|
208
|
-
private renderInterrupt;
|
|
209
|
-
/**
|
|
210
|
-
* Build the cross-device "Restore my chats" card (ADR-048 §c). Reuses the
|
|
211
|
-
* same overlay slot + visual language as the OTP interrupt. All server-supplied
|
|
212
|
-
* strings (masked destination, conversation previews) are set via `textContent`
|
|
213
|
-
* — never innerHTML — so they can't inject markup; only the static lock icon
|
|
214
|
-
* uses innerHTML.
|
|
215
|
-
*/
|
|
216
|
-
private buildRestoreCard;
|
|
217
|
-
/** Format an ISO timestamp as a short, locale-aware label (best-effort). */
|
|
218
|
-
private formatWhen;
|
|
219
|
-
/**
|
|
220
|
-
* Wire as-you-type formatting + an inline validity hint onto the pre-chat
|
|
221
|
-
* phone input (libphonenumber-js, US default region). Autofill is preserved:
|
|
222
|
-
* the input keeps its `type="tel"` + `autocomplete="tel"` + implicit <label>,
|
|
223
|
-
* and we also reformat on `change` so a browser-autofilled value gets
|
|
224
|
-
* formatted/validated too.
|
|
225
|
-
*
|
|
226
|
-
* As-you-type caret note: `AsYouType` reformats the entire string, which
|
|
227
|
-
* moves the caret to the end on a mid-string edit. To avoid fighting the
|
|
228
|
-
* user, we only rewrite the value when the caret is at the end (the typical
|
|
229
|
-
* append-a-digit case) and never on a deletion — so backspacing the
|
|
230
|
-
* formatting characters works naturally.
|
|
231
|
-
*/
|
|
232
|
-
private wirePhoneField;
|
|
233
|
-
/** Collect identity + consent from the pre-chat form, then drop into the chat view. */
|
|
234
|
-
private handlePrechatSubmit;
|
|
235
|
-
/** Send a starter prompt (from a chip click). */
|
|
236
|
-
private submitPrompt;
|
|
237
|
-
private syncOpenState;
|
|
238
|
-
/** Grow the textarea with its content, up to the CSS max-height. */
|
|
239
|
-
private autosize;
|
|
240
|
-
/**
|
|
241
|
-
* Receive a new message snapshot from the controller and update the view.
|
|
242
|
-
*
|
|
243
|
-
* `onMessages` fires on *every* `stream_token` delta. Rebuilding the whole
|
|
244
|
-
* list each frame is wasteful and fights the smooth reveal, so we take the
|
|
245
|
-
* cheap path when the only change is the trailing streaming assistant message
|
|
246
|
-
* growing: just bump the reveal *target* (the rAF loop drains it). Any
|
|
247
|
-
* structural change (new message, finalize, citations) triggers a full
|
|
248
|
-
* rebuild via {@link renderMessages}.
|
|
249
|
-
*/
|
|
250
|
-
private handleMessages;
|
|
251
|
-
private renderMessages;
|
|
252
|
-
/**
|
|
253
|
-
* Render (or clear) the mid-conversation suggested-reply chips under the
|
|
254
|
-
* composer. Shown ONLY when: the feature is enabled, no interrupt / restore
|
|
255
|
-
* overlay is active (those reuse the slot above the composer), and the LATEST
|
|
256
|
-
* message is a finalized assistant turn that carried suggestions. A new turn
|
|
257
|
-
* (agent or the visitor typing) appends messages, so the latest is no longer
|
|
258
|
-
* that assistant message and the chips clear on the next render. Chips reuse
|
|
259
|
-
* the empty-state `.prompts`/`.chip` styling and send via the same path.
|
|
260
|
-
*/
|
|
261
|
-
private renderSuggestions;
|
|
262
|
-
/** True when the host/user prefers reduced motion (snap, no typewriter). */
|
|
263
|
-
private prefersReducedMotion;
|
|
264
|
-
/**
|
|
265
|
-
* Bind the rAF typewriter to a freshly built streaming bubble. Preserves the
|
|
266
|
-
* already-revealed prefix across rebuilds (so a structural rebuild mid-stream
|
|
267
|
-
* doesn't restart the reveal from zero), then resumes the loop.
|
|
268
|
-
*/
|
|
269
|
-
private bindReveal;
|
|
270
|
-
/** Start the rAF loop if it isn't already running. */
|
|
271
|
-
private ensureRevealLoop;
|
|
272
|
-
/**
|
|
273
|
-
* One animation frame of the reveal. Advances `displayedLength` toward the
|
|
274
|
-
* buffered target at an ADAPTIVE rate — the deeper the backlog, the more
|
|
275
|
-
* chars per frame — so the reveal stays smooth yet never falls behind the
|
|
276
|
-
* network. Updates ONLY the bound bubble's textContent (no list rebuild).
|
|
277
|
-
*/
|
|
278
|
-
private tickReveal;
|
|
279
|
-
/** Snap the bound bubble to the full buffered text immediately (reduced-motion / no-rAF). */
|
|
280
|
-
private snapReveal;
|
|
281
|
-
/**
|
|
282
|
-
* Full-page sizing probe: decide whether the host's container gives it a
|
|
283
|
-
* real box. With the `.wrap` flex chain hidden, `height: 100%` of a SIZED
|
|
284
|
-
* container still resolves (clientHeight > 0), while an auto-height parent
|
|
285
|
-
* (e.g. mounted straight into `<body>`) collapses to ~0. Only the latter
|
|
286
|
-
* gets `data-viewport-fallback`, whose CSS applies `min-height: 100dvh` —
|
|
287
|
-
* so an embed inside a fixed-height box never overflows it (the composer
|
|
288
|
-
* stays visible), and a bare full-page route still fills the viewport.
|
|
289
|
-
*/
|
|
290
|
-
private syncViewportFallback;
|
|
291
|
-
/** Cancel any in-flight reveal loop and clear its state (called on full rebuild). */
|
|
292
|
-
private resetReveal;
|
|
293
|
-
/**
|
|
294
|
-
* Auto-scroll the message list to the bottom — but don't fight a visitor who
|
|
295
|
-
* has scrolled up to read history. When `force` (a structural rebuild) we
|
|
296
|
-
* always pin to bottom; during the streaming reveal we only follow if the
|
|
297
|
-
* viewport is already near the bottom.
|
|
298
|
-
*/
|
|
299
|
-
private scrollToBottom;
|
|
300
|
-
/** Wrap a bubble in a `.row`, prefixing assistant rows with a mini avatar. */
|
|
301
|
-
private buildRow;
|
|
302
|
-
private greetingBubble;
|
|
303
|
-
private typingDot;
|
|
304
|
-
/**
|
|
305
|
-
* Build the collapsible "Sources (N)" block for an assistant message's
|
|
306
|
-
* citations. Title/snippet are set via `textContent` (never innerHTML) so
|
|
307
|
-
* citation text can't inject markup; only the static chevron + numeric count
|
|
308
|
-
* use innerHTML.
|
|
309
|
-
*/
|
|
310
|
-
private renderSources;
|
|
311
|
-
private renderStatus;
|
|
312
|
-
private renderComposerState;
|
|
313
|
-
private submit;
|
|
314
|
-
}
|
|
315
|
-
/** Register the custom element once. Safe to call multiple times. */
|
|
316
|
-
declare function defineChatWidget(): void;
|
|
317
|
-
/**
|
|
318
|
-
* Programmatically create, configure, and append a widget to the page.
|
|
319
|
-
* Returns the element so the host can drive `openChat()` / `closeChat()`.
|
|
320
|
-
*/
|
|
321
|
-
declare function mountChatWidget(config: ChatWidgetConfig, target?: HTMLElement): SmoothAgentChatElement;
|
|
322
|
-
/**
|
|
323
|
-
* Ergonomic helper for the full-page layout: mounts a `<smooth-agent-chat>` in
|
|
324
|
-
* `mode: "fullpage"` (no launcher — the chat fills its container/viewport with a
|
|
325
|
-
* Smooth-branded header, a scrollable message list, and an input bar) and
|
|
326
|
-
* returns the element.
|
|
327
|
-
*
|
|
328
|
-
* `target` defaults to `document.body`; pass a sized container to embed the
|
|
329
|
-
* full-page chat inside a layout region (e.g. a `/chat` route shell or an
|
|
330
|
-
* iframe). The `mode` is forced to `"fullpage"` regardless of the passed config.
|
|
331
|
-
*
|
|
332
|
-
* ```ts
|
|
333
|
-
* mountFullPageChat({ endpoint: 'wss://…/ws', agentId: '…', agentName: 'Support' });
|
|
334
|
-
* ```
|
|
335
|
-
*/
|
|
336
|
-
declare function mountFullPageChat(config: Omit<ChatWidgetConfig, 'mode'>, target?: HTMLElement): SmoothAgentChatElement;
|
|
337
|
-
//#endregion
|
|
338
|
-
//#region src/loader-core.d.ts
|
|
339
|
-
/**
|
|
340
|
-
* Tiny, dependency-free deferred loader for `@smooai/chat-widget`.
|
|
341
|
-
*
|
|
342
|
-
* The recommended embed: a host includes this *small* script eagerly, and it
|
|
343
|
-
* defers injecting the real (heavier) `chat-widget.global.js` module until the
|
|
344
|
-
* page is past its critical render — so the widget never competes with the host
|
|
345
|
-
* page's LCP/TBT. It triggers the real load on the **first** of:
|
|
346
|
-
*
|
|
347
|
-
* - `window` `load` → `requestIdleCallback` (idle time), or
|
|
348
|
-
* - user intent (`pointerdown` / `keydown` / `scroll`), or
|
|
349
|
-
* - an 8s fallback.
|
|
350
|
-
*
|
|
351
|
-
* After the module loads (which registers `<smooth-agent-chat>` and exposes
|
|
352
|
-
* `window.SmoothAgentChat`), it mounts the widget with the host's config.
|
|
353
|
-
*
|
|
354
|
-
* Deliberately imports nothing from the widget itself — this file must stay a
|
|
355
|
-
* few hundred bytes so including it eagerly is free.
|
|
356
|
-
*
|
|
357
|
-
* ## Config
|
|
358
|
-
* Set a global before/with the loader (any `ChatWidgetConfig`, plus an optional
|
|
359
|
-
* `src` pointing at the module bundle):
|
|
360
|
-
*
|
|
361
|
-
* ```html
|
|
362
|
-
* <script>window.SmoothAgentChatConfig = { endpoint: 'wss://…/ws', agentId: '…' };</script>
|
|
363
|
-
* <script src="https://cdn/…/chat-widget-loader.global.js" async></script>
|
|
364
|
-
* ```
|
|
365
|
-
*
|
|
366
|
-
* Or, for the simplest installs, `data-*` attributes on the loader's own tag
|
|
367
|
-
* (`data-endpoint`, `data-agent-id`, `data-primary`, `data-mode`, `data-src`).
|
|
368
|
-
* If no config is found, the module is still loaded (registering the element) so
|
|
369
|
-
* a `<smooth-agent-chat …>` placed directly in markup upgrades itself.
|
|
370
|
-
*/
|
|
371
|
-
/**
|
|
372
|
-
* Install the deferred loader. Idempotent per call; the IIFE entry
|
|
373
|
-
* (`loader.ts`) invokes it once on script execution.
|
|
374
|
-
*/
|
|
375
|
-
declare function initChatWidgetLoader(): void;
|
|
376
|
-
//#endregion
|
|
377
141
|
//#region src/persistence.d.ts
|
|
378
142
|
/** Current persisted-shape version. Bump when the shape below changes incompatibly. */
|
|
379
143
|
declare const PERSIST_VERSION: 1;
|
|
@@ -485,6 +249,9 @@ type ConnectionStatus = 'idle' | 'connecting' | 'ready' | 'error' | 'closed';
|
|
|
485
249
|
* Resume with {@link ConversationController.verifyOtp}.
|
|
486
250
|
* - `confirm` — the agent wants to run a state-mutating tool and needs approval.
|
|
487
251
|
* Resume with {@link ConversationController.confirmTool}.
|
|
252
|
+
* - `interaction` — the agent raised a Rich Interaction (structured card, e.g.
|
|
253
|
+
* identity intake). Resume with {@link ConversationController.submitInteraction}
|
|
254
|
+
* or {@link ConversationController.declineInteraction}.
|
|
488
255
|
*/
|
|
489
256
|
type Interrupt = {
|
|
490
257
|
kind: 'otp';
|
|
@@ -501,6 +268,16 @@ type Interrupt = {
|
|
|
501
268
|
kind: 'confirm';
|
|
502
269
|
toolId?: string;
|
|
503
270
|
actionDescription?: string;
|
|
271
|
+
} | {
|
|
272
|
+
kind: 'interaction'; /** Server-generated interaction instance id (echoed on submit). */
|
|
273
|
+
interactionId: string; /** The Rich Interaction kind (e.g. `identity_intake`) — selects the card. */
|
|
274
|
+
interactionKind: string; /** Kind-specific render spec (identity_intake: `{ fields: [...] }`). */
|
|
275
|
+
spec: Record<string, unknown>; /** Why the agent raised it (card header copy). */
|
|
276
|
+
reason?: string; /** Per-field server-side validation errors (from `interaction_invalid`). */
|
|
277
|
+
errors?: {
|
|
278
|
+
field: string;
|
|
279
|
+
message: string;
|
|
280
|
+
}[];
|
|
504
281
|
};
|
|
505
282
|
interface UserInfo {
|
|
506
283
|
name?: string;
|
|
@@ -578,6 +355,9 @@ declare class ConversationController {
|
|
|
578
355
|
/** requestId of the in-flight turn — used to resume OTP / tool confirmations. */
|
|
579
356
|
private activeRequestId;
|
|
580
357
|
private interrupt;
|
|
358
|
+
/** Values from the last interaction submit, merged into the persisted
|
|
359
|
+
* identity (identity_intake only) once the server acks them. */
|
|
360
|
+
private pendingInteractionValues;
|
|
581
361
|
private identityRestore;
|
|
582
362
|
/**
|
|
583
363
|
* True once the resume probe (persisted-pointer get_session OR the
|
|
@@ -612,6 +392,16 @@ declare class ConversationController {
|
|
|
612
392
|
verifyOtp(code: string): void;
|
|
613
393
|
/** Approve or reject a pending tool write to resume the paused turn. */
|
|
614
394
|
confirmTool(approved: boolean): void;
|
|
395
|
+
/**
|
|
396
|
+
* Submit a Rich Interaction card to resume the parked turn. The server
|
|
397
|
+
* routes to the kind's validator: invalid values come back as an
|
|
398
|
+
* `interaction_invalid` event (the card re-renders with per-field errors —
|
|
399
|
+
* the turn stays parked); a valid submit is acked and the turn resumes.
|
|
400
|
+
* No-op if not awaiting an interaction.
|
|
401
|
+
*/
|
|
402
|
+
submitInteraction(values: Record<string, unknown>): void;
|
|
403
|
+
/** Decline the pending Rich Interaction; the agent continues without it. */
|
|
404
|
+
declineInteraction(): void;
|
|
615
405
|
private nextId;
|
|
616
406
|
private setStatus;
|
|
617
407
|
private emitMessages;
|
|
@@ -705,6 +495,242 @@ declare class ConversationController {
|
|
|
705
495
|
disconnect(): void;
|
|
706
496
|
}
|
|
707
497
|
//#endregion
|
|
498
|
+
//#region src/element.d.ts
|
|
499
|
+
declare const ELEMENT_TAG = "smooth-agent-chat";
|
|
500
|
+
declare class SmoothAgentChatElement extends HTMLElement {
|
|
501
|
+
static get observedAttributes(): readonly string[];
|
|
502
|
+
private readonly root;
|
|
503
|
+
private controller;
|
|
504
|
+
private overrides;
|
|
505
|
+
private open;
|
|
506
|
+
private messages;
|
|
507
|
+
private status;
|
|
508
|
+
private mounted;
|
|
509
|
+
/** True once the visitor has cleared the pre-chat identity gate (or it's not needed). */
|
|
510
|
+
private userInfoSatisfied;
|
|
511
|
+
/** True after the visitor has sent their first message (hides starter chips). */
|
|
512
|
+
private hasSent;
|
|
513
|
+
/** Starter prompts shown as chips in the empty state. */
|
|
514
|
+
private examplePrompts;
|
|
515
|
+
/** Whether mid-conversation suggested-reply chips are shown (config). */
|
|
516
|
+
private showSuggestedReplies;
|
|
517
|
+
/** Resolved greeting text, cached so async (rAF) renders can reuse it. */
|
|
518
|
+
private greeting;
|
|
519
|
+
/** Current mid-turn interrupt (OTP / tool-confirmation), or null. */
|
|
520
|
+
private interrupt;
|
|
521
|
+
private interruptEl;
|
|
522
|
+
/** Cross-device "restore my chats" flow state (ADR-048 §c). */
|
|
523
|
+
private identityRestore;
|
|
524
|
+
/** Whether the cross-device restore affordance is offered (config). */
|
|
525
|
+
private allowChatRestore;
|
|
526
|
+
/** True while the pre-chat identity gate is showing (blocks premature connect). */
|
|
527
|
+
private gating;
|
|
528
|
+
private panelEl;
|
|
529
|
+
private launcherEl;
|
|
530
|
+
private messagesEl;
|
|
531
|
+
private statusEl;
|
|
532
|
+
private dotEl;
|
|
533
|
+
private inputEl;
|
|
534
|
+
private sendBtn;
|
|
535
|
+
private suggestionsEl;
|
|
536
|
+
/** The live streaming assistant bubble whose textContent the rAF loop drives. */
|
|
537
|
+
private streamBubbleEl;
|
|
538
|
+
/** Message id the reveal is bound to (guards against stale frames after rebuilds). */
|
|
539
|
+
private streamMsgId;
|
|
540
|
+
/** Full buffered target text for the streaming message (grows as tokens arrive). */
|
|
541
|
+
private streamTarget;
|
|
542
|
+
/** How many chars of {@link streamTarget} are currently shown. */
|
|
543
|
+
private displayedLength;
|
|
544
|
+
private rafId;
|
|
545
|
+
constructor();
|
|
546
|
+
connectedCallback(): void;
|
|
547
|
+
disconnectedCallback(): void;
|
|
548
|
+
attributeChangedCallback(): void;
|
|
549
|
+
/**
|
|
550
|
+
* Programmatically merge config overrides (endpoint, agentId, theme, …). Values
|
|
551
|
+
* set here take precedence over HTML attributes. Re-renders the widget.
|
|
552
|
+
*/
|
|
553
|
+
configure(config: Partial<ChatWidgetConfig>): void;
|
|
554
|
+
/** Open the chat panel. */
|
|
555
|
+
openChat(): void;
|
|
556
|
+
/** Collapse the chat panel back to the launcher. */
|
|
557
|
+
closeChat(): void;
|
|
558
|
+
private readConfig;
|
|
559
|
+
private render;
|
|
560
|
+
/**
|
|
561
|
+
* Render (or clear) the mid-turn interrupt overlay above the composer:
|
|
562
|
+
* an OTP code prompt or a tool-write confirmation. Server-supplied text is
|
|
563
|
+
* set via `textContent` (never innerHTML); only static icons use innerHTML.
|
|
564
|
+
*/
|
|
565
|
+
private renderInterrupt;
|
|
566
|
+
/**
|
|
567
|
+
* Build the cross-device "Restore my chats" card (ADR-048 §c). Reuses the
|
|
568
|
+
* same overlay slot + visual language as the OTP interrupt. All server-supplied
|
|
569
|
+
* strings (masked destination, conversation previews) are set via `textContent`
|
|
570
|
+
* — never innerHTML — so they can't inject markup; only the static lock icon
|
|
571
|
+
* uses innerHTML.
|
|
572
|
+
*/
|
|
573
|
+
private buildRestoreCard;
|
|
574
|
+
/** Format an ISO timestamp as a short, locale-aware label (best-effort). */
|
|
575
|
+
private formatWhen;
|
|
576
|
+
/**
|
|
577
|
+
* Wire as-you-type formatting + an inline validity hint onto the pre-chat
|
|
578
|
+
* phone input (libphonenumber-js, US default region). Autofill is preserved:
|
|
579
|
+
* the input keeps its `type="tel"` + `autocomplete="tel"` + implicit <label>,
|
|
580
|
+
* and we also reformat on `change` so a browser-autofilled value gets
|
|
581
|
+
* formatted/validated too.
|
|
582
|
+
*
|
|
583
|
+
* As-you-type caret note: `AsYouType` reformats the entire string, which
|
|
584
|
+
* moves the caret to the end on a mid-string edit. To avoid fighting the
|
|
585
|
+
* user, we only rewrite the value when the caret is at the end (the typical
|
|
586
|
+
* append-a-digit case) and never on a deletion — so backspacing the
|
|
587
|
+
* formatting characters works naturally.
|
|
588
|
+
*/
|
|
589
|
+
private wirePhoneField;
|
|
590
|
+
/** Collect identity + consent from the pre-chat form, then drop into the chat view. */
|
|
591
|
+
private handlePrechatSubmit;
|
|
592
|
+
/** Send a starter prompt (from a chip click). */
|
|
593
|
+
private submitPrompt;
|
|
594
|
+
private syncOpenState;
|
|
595
|
+
/** Grow the textarea with its content, up to the CSS max-height. */
|
|
596
|
+
private autosize;
|
|
597
|
+
/**
|
|
598
|
+
* Receive a new message snapshot from the controller and update the view.
|
|
599
|
+
*
|
|
600
|
+
* `onMessages` fires on *every* `stream_token` delta. Rebuilding the whole
|
|
601
|
+
* list each frame is wasteful and fights the smooth reveal, so we take the
|
|
602
|
+
* cheap path when the only change is the trailing streaming assistant message
|
|
603
|
+
* growing: just bump the reveal *target* (the rAF loop drains it). Any
|
|
604
|
+
* structural change (new message, finalize, citations) triggers a full
|
|
605
|
+
* rebuild via {@link renderMessages}.
|
|
606
|
+
*/
|
|
607
|
+
private handleMessages;
|
|
608
|
+
private renderMessages;
|
|
609
|
+
/**
|
|
610
|
+
* Render (or clear) the mid-conversation suggested-reply chips under the
|
|
611
|
+
* composer. Shown ONLY when: the feature is enabled, no interrupt / restore
|
|
612
|
+
* overlay is active (those reuse the slot above the composer), and the LATEST
|
|
613
|
+
* message is a finalized assistant turn that carried suggestions. A new turn
|
|
614
|
+
* (agent or the visitor typing) appends messages, so the latest is no longer
|
|
615
|
+
* that assistant message and the chips clear on the next render. Chips reuse
|
|
616
|
+
* the empty-state `.prompts`/`.chip` styling and send via the same path.
|
|
617
|
+
*/
|
|
618
|
+
private renderSuggestions;
|
|
619
|
+
/** True when the host/user prefers reduced motion (snap, no typewriter). */
|
|
620
|
+
private prefersReducedMotion;
|
|
621
|
+
/**
|
|
622
|
+
* Bind the rAF typewriter to a freshly built streaming bubble. Preserves the
|
|
623
|
+
* already-revealed prefix across rebuilds (so a structural rebuild mid-stream
|
|
624
|
+
* doesn't restart the reveal from zero), then resumes the loop.
|
|
625
|
+
*/
|
|
626
|
+
private bindReveal;
|
|
627
|
+
/** Start the rAF loop if it isn't already running. */
|
|
628
|
+
private ensureRevealLoop;
|
|
629
|
+
/**
|
|
630
|
+
* One animation frame of the reveal. Advances `displayedLength` toward the
|
|
631
|
+
* buffered target at an ADAPTIVE rate — the deeper the backlog, the more
|
|
632
|
+
* chars per frame — so the reveal stays smooth yet never falls behind the
|
|
633
|
+
* network. Updates ONLY the bound bubble's textContent (no list rebuild).
|
|
634
|
+
*/
|
|
635
|
+
private tickReveal;
|
|
636
|
+
/** Snap the bound bubble to the full buffered text immediately (reduced-motion / no-rAF). */
|
|
637
|
+
private snapReveal;
|
|
638
|
+
/**
|
|
639
|
+
* Full-page sizing probe: decide whether the host's container gives it a
|
|
640
|
+
* real box. With the `.wrap` flex chain hidden, `height: 100%` of a SIZED
|
|
641
|
+
* container still resolves (clientHeight > 0), while an auto-height parent
|
|
642
|
+
* (e.g. mounted straight into `<body>`) collapses to ~0. Only the latter
|
|
643
|
+
* gets `data-viewport-fallback`, whose CSS applies `min-height: 100dvh` —
|
|
644
|
+
* so an embed inside a fixed-height box never overflows it (the composer
|
|
645
|
+
* stays visible), and a bare full-page route still fills the viewport.
|
|
646
|
+
*/
|
|
647
|
+
private syncViewportFallback;
|
|
648
|
+
/** Cancel any in-flight reveal loop and clear its state (called on full rebuild). */
|
|
649
|
+
private resetReveal;
|
|
650
|
+
/**
|
|
651
|
+
* Auto-scroll the message list to the bottom — but don't fight a visitor who
|
|
652
|
+
* has scrolled up to read history. When `force` (a structural rebuild) we
|
|
653
|
+
* always pin to bottom; during the streaming reveal we only follow if the
|
|
654
|
+
* viewport is already near the bottom.
|
|
655
|
+
*/
|
|
656
|
+
private scrollToBottom;
|
|
657
|
+
/** Wrap a bubble in a `.row`, prefixing assistant rows with a mini avatar. */
|
|
658
|
+
private buildRow;
|
|
659
|
+
private greetingBubble;
|
|
660
|
+
private typingDot;
|
|
661
|
+
/**
|
|
662
|
+
* Build the collapsible "Sources (N)" block for an assistant message's
|
|
663
|
+
* citations. Title/snippet are set via `textContent` (never innerHTML) so
|
|
664
|
+
* citation text can't inject markup; only the static chevron + numeric count
|
|
665
|
+
* use innerHTML.
|
|
666
|
+
*/
|
|
667
|
+
private renderSources;
|
|
668
|
+
private renderStatus;
|
|
669
|
+
private renderComposerState;
|
|
670
|
+
private submit;
|
|
671
|
+
}
|
|
672
|
+
/** Register the custom element once. Safe to call multiple times. */
|
|
673
|
+
declare function defineChatWidget(): void;
|
|
674
|
+
/**
|
|
675
|
+
* Programmatically create, configure, and append a widget to the page.
|
|
676
|
+
* Returns the element so the host can drive `openChat()` / `closeChat()`.
|
|
677
|
+
*/
|
|
678
|
+
declare function mountChatWidget(config: ChatWidgetConfig, target?: HTMLElement): SmoothAgentChatElement;
|
|
679
|
+
/**
|
|
680
|
+
* Ergonomic helper for the full-page layout: mounts a `<smooth-agent-chat>` in
|
|
681
|
+
* `mode: "fullpage"` (no launcher — the chat fills its container/viewport with a
|
|
682
|
+
* Smooth-branded header, a scrollable message list, and an input bar) and
|
|
683
|
+
* returns the element.
|
|
684
|
+
*
|
|
685
|
+
* `target` defaults to `document.body`; pass a sized container to embed the
|
|
686
|
+
* full-page chat inside a layout region (e.g. a `/chat` route shell or an
|
|
687
|
+
* iframe). The `mode` is forced to `"fullpage"` regardless of the passed config.
|
|
688
|
+
*
|
|
689
|
+
* ```ts
|
|
690
|
+
* mountFullPageChat({ endpoint: 'wss://…/ws', agentId: '…', agentName: 'Support' });
|
|
691
|
+
* ```
|
|
692
|
+
*/
|
|
693
|
+
declare function mountFullPageChat(config: Omit<ChatWidgetConfig, 'mode'>, target?: HTMLElement): SmoothAgentChatElement;
|
|
694
|
+
//#endregion
|
|
695
|
+
//#region src/loader-core.d.ts
|
|
696
|
+
/**
|
|
697
|
+
* Tiny, dependency-free deferred loader for `@smooai/chat-widget`.
|
|
698
|
+
*
|
|
699
|
+
* The recommended embed: a host includes this *small* script eagerly, and it
|
|
700
|
+
* defers injecting the real (heavier) `chat-widget.global.js` module until the
|
|
701
|
+
* page is past its critical render — so the widget never competes with the host
|
|
702
|
+
* page's LCP/TBT. It triggers the real load on the **first** of:
|
|
703
|
+
*
|
|
704
|
+
* - `window` `load` → `requestIdleCallback` (idle time), or
|
|
705
|
+
* - user intent (`pointerdown` / `keydown` / `scroll`), or
|
|
706
|
+
* - an 8s fallback.
|
|
707
|
+
*
|
|
708
|
+
* After the module loads (which registers `<smooth-agent-chat>` and exposes
|
|
709
|
+
* `window.SmoothAgentChat`), it mounts the widget with the host's config.
|
|
710
|
+
*
|
|
711
|
+
* Deliberately imports nothing from the widget itself — this file must stay a
|
|
712
|
+
* few hundred bytes so including it eagerly is free.
|
|
713
|
+
*
|
|
714
|
+
* ## Config
|
|
715
|
+
* Set a global before/with the loader (any `ChatWidgetConfig`, plus an optional
|
|
716
|
+
* `src` pointing at the module bundle):
|
|
717
|
+
*
|
|
718
|
+
* ```html
|
|
719
|
+
* <script>window.SmoothAgentChatConfig = { endpoint: 'wss://…/ws', agentId: '…' };</script>
|
|
720
|
+
* <script src="https://cdn/…/chat-widget-loader.global.js" async></script>
|
|
721
|
+
* ```
|
|
722
|
+
*
|
|
723
|
+
* Or, for the simplest installs, `data-*` attributes on the loader's own tag
|
|
724
|
+
* (`data-endpoint`, `data-agent-id`, `data-primary`, `data-mode`, `data-src`).
|
|
725
|
+
* If no config is found, the module is still loaded (registering the element) so
|
|
726
|
+
* a `<smooth-agent-chat …>` placed directly in markup upgrades itself.
|
|
727
|
+
*/
|
|
728
|
+
/**
|
|
729
|
+
* Install the deferred loader. Idempotent per call; the IIFE entry
|
|
730
|
+
* (`loader.ts`) invokes it once on script execution.
|
|
731
|
+
*/
|
|
732
|
+
declare function initChatWidgetLoader(): void;
|
|
733
|
+
//#endregion
|
|
708
734
|
//#region src/fingerprint.d.ts
|
|
709
735
|
/**
|
|
710
736
|
* Browser fingerprint — a stable, privacy-light identifier used by the
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/config.ts","../src/
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/config.ts","../src/persistence.ts","../src/conversation.ts","../src/element.ts","../src/loader-core.ts","../src/fingerprint.ts"],"mappings":";;;;UASiB,eAAA;;EAEb,IAAA;;EAEA,UAAA;EAJ4B;EAM5B,OAAA;EAN4B;EAQ5B,WAAA;EAJA;EAMA,SAAA;EAFA;EAIA,eAAA;EAAA;EAEA,mBAAA;EAEA;EAAA,UAAA;EAIA;EAFA,cAAA;EAUA;EARA,MAAA;EAYA;EANA,iBAAA;EAMsB;EAJtB,qBAAA;EAesB;EAbtB,kBAAA;EAasB;EAXtB,sBAAA;AAAA;;;;;;;;;KAWQ,cAAA;AAAA,UAEK,gBAAA;EAyBb;;;;EApBA,QAAA;EA6BmD;;;;EAxBnD,IAAA,GAAO,cAAA;EAsCP;EApCA,OAAA;EA+CA;EA7CA,SAAA;EAiDA;;;;;;EA1CA,OAAA;EAqEQ;EAnER,QAAA;EAmEuB;EAjEvB,SAAA;;EAEA,SAAA;ECxDS;;;;AAA4B;AAGzC;ED4DI,WAAA;IAAgB,MAAA;IAAgB,SAAA;IAAmB,SAAA;EAAA;ECxDnD;ED0DA,WAAA;ECxDS;ED0DT,QAAA;ECtDa;EDwDb,sBAAA;;EAEA,SAAA;ECzDA;;;;AAEK;ED6DL,YAAA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