@helpai/elements 0.19.10 → 0.21.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/configurator.mjs +145 -158
- package/elements-web-component.esm.js +27 -27
- package/elements-web-component.esm.js.map +4 -4
- package/elements.cjs.js +27 -27
- package/elements.cjs.js.map +4 -4
- package/elements.esm.js +27 -27
- package/elements.esm.js.map +4 -4
- package/elements.js +27 -27
- package/elements.js.map +4 -4
- package/index.d.ts +1 -18
- package/index.mjs +5 -78
- package/package.json +1 -1
- package/schema.d.ts +2 -23
- package/schema.json +0 -72
- package/schema.mjs +147 -163
- package/style.css +1 -1
- package/web-component.mjs +5 -78
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, L as Link, S as ServerConfig, b as SiteConfig, c as StartConversationResponse, W as WidgetConfig, d as WidgetConfigPartial, e as WidgetSettings, f as WidgetSettingsPartial } from './deployment-
|
|
1
|
+
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, L as Link, S as ServerConfig, b as SiteConfig, c as StartConversationResponse, W as WidgetConfig, d as WidgetConfigPartial, e as WidgetSettings, f as WidgetSettingsPartial } from './deployment-CA9yYj8Y.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -331,20 +331,6 @@ type ThemePreference = "auto" | "light" | "dark";
|
|
|
331
331
|
* whole.
|
|
332
332
|
*/
|
|
333
333
|
type ResponseMode = "streaming" | "buffered";
|
|
334
|
-
/**
|
|
335
|
-
* How welcome messages (pushed by the server via `connect`) render.
|
|
336
|
-
*
|
|
337
|
-
* - `'typewriter'` (default) — each message types in character by character.
|
|
338
|
-
* - `'instant'` — messages appear whole the moment they arrive.
|
|
339
|
-
*/
|
|
340
|
-
type WelcomeAnimation = "typewriter" | "instant";
|
|
341
|
-
/** Welcome-message rendering options. */
|
|
342
|
-
interface WelcomeOptions {
|
|
343
|
-
/** Render style for welcome messages. Default: `'typewriter'`. */
|
|
344
|
-
animation?: WelcomeAnimation;
|
|
345
|
-
/** Typewriter speed in characters per second. Default: `60`. */
|
|
346
|
-
speed?: number;
|
|
347
|
-
}
|
|
348
334
|
/**
|
|
349
335
|
* Identifiers for every header action the widget can render.
|
|
350
336
|
*
|
|
@@ -1054,7 +1040,6 @@ interface ChatWidgetOptions {
|
|
|
1054
1040
|
launcher?: LauncherOptions;
|
|
1055
1041
|
header?: HeaderOptions;
|
|
1056
1042
|
composer?: ComposerOptions;
|
|
1057
|
-
welcome?: WelcomeOptions;
|
|
1058
1043
|
feedback?: FeedbackOptions;
|
|
1059
1044
|
i18n?: I18nOptions;
|
|
1060
1045
|
footer?: FooterOptions;
|
|
@@ -1107,7 +1092,6 @@ interface ResolvedOptions {
|
|
|
1107
1092
|
* when the resolved URL is empty).
|
|
1108
1093
|
*/
|
|
1109
1094
|
popOutUrl: string;
|
|
1110
|
-
welcome: Required<WelcomeOptions>;
|
|
1111
1095
|
features: Required<Omit<FeatureFlags, "tools">> & {
|
|
1112
1096
|
tools?: Array<string | ToolRef>;
|
|
1113
1097
|
};
|
|
@@ -1185,7 +1169,6 @@ interface ServerConfig {
|
|
|
1185
1169
|
launcher?: LauncherOptions;
|
|
1186
1170
|
header?: HeaderOptions;
|
|
1187
1171
|
composer?: ComposerOptions;
|
|
1188
|
-
welcome?: WelcomeOptions;
|
|
1189
1172
|
feedback?: FeedbackOptions;
|
|
1190
1173
|
i18n?: I18nOptions;
|
|
1191
1174
|
footer?: FooterOptions;
|
package/index.mjs
CHANGED
|
@@ -462,7 +462,6 @@ var DEFAULT_ATTACHMENTS = {
|
|
|
462
462
|
maxCount: 10,
|
|
463
463
|
accept: "*/*"
|
|
464
464
|
};
|
|
465
|
-
var DEFAULT_WELCOME = { animation: "instant", speed: 60 };
|
|
466
465
|
var DEFAULT_FEATURES = {
|
|
467
466
|
files: true,
|
|
468
467
|
voice: "local",
|
|
@@ -532,7 +531,6 @@ function resolveOptions(rawOpts) {
|
|
|
532
531
|
showReasoning: behavior.showReasoning ?? false,
|
|
533
532
|
showToolCalls: behavior.showToolCalls ?? false,
|
|
534
533
|
popOutUrl: behavior.popOutUrl ?? BRAND.standaloneUrl,
|
|
535
|
-
welcome: { ...DEFAULT_WELCOME, ...opts.welcome },
|
|
536
534
|
features: {
|
|
537
535
|
files: opts.features?.files ?? DEFAULT_FEATURES.files,
|
|
538
536
|
voice: opts.features?.voice ?? DEFAULT_FEATURES.voice,
|
|
@@ -734,7 +732,6 @@ var SECTION_KEYS = [
|
|
|
734
732
|
"launcher",
|
|
735
733
|
"header",
|
|
736
734
|
"composer",
|
|
737
|
-
"welcome",
|
|
738
735
|
"feedback",
|
|
739
736
|
"i18n",
|
|
740
737
|
"footer",
|
|
@@ -925,7 +922,7 @@ function bindHostCommands(host, handlers) {
|
|
|
925
922
|
}
|
|
926
923
|
|
|
927
924
|
// src/styles/tokens.css
|
|
928
|
-
var tokens_default = ':host{--__P__-accent: __BRAND_ACCENT__;--__P__-accent-text: __BRAND_ACCENT_TEXT__;--__P__-radius: __BRAND_RADIUS__;--__P__-radius-sm: 8px;--__P__-radius-md: 10px;--__P__-radius-lg: 16px;--__P__-font: __BRAND_FONT__;--__P__-font-display: var(--__P__-font);--__P__-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;--__P__-bg: oklch(1 0 0);--__P__-bg-elevated: oklch(.9789 .0029 278.3);--__P__-surface: var(--__P__-bg-elevated);--__P__-muted: var(--__P__-fg-muted);--__P__-hover: oklch(.1686 .011 278.3 / .06);--__P__-fg: oklch(.1686 .011 278.3);--__P__-fg-muted: oklch(.4932 .0301 278.3);--__P__-border: oklch(.9312 .0084 278.3);--__P__-border-strong: oklch(.8757 .0131 278.3);--__P__-bubble-user: var(--__P__-accent);--__P__-bubble-user-text: var(--__P__-accent-text);--__P__-bubble-assistant: oklch(.9638 .0058 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-on-accent: var(--__P__-accent-text);--__P__-success: oklch(.6456 .1654 151.53);--__P__-warning: oklch(.7135 .1494 74.05);--__P__-danger: oklch(.5966 .1818 24.51);--__P__-danger-text: oklch(.5054 .1905 27.52);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .1);--__P__-neutral: oklch(.7137 .0192 278.3);--__P__-focus: var(--__P__-accent);--__P__-shadow-panel: 0 8px 24px -8px rgba(13, 15, 20, .18), 0 24px 64px -24px rgba(13, 15, 20, .24);--__P__-shadow-card: 0 1px 2px rgba(13, 15, 20, .06), 0 4px 12px -6px rgba(13, 15, 20, .12);--__P__-backdrop: oklch(.1686 .011 278.3 / .55);--__P__-shadow-fab: 0 6px 16px -4px color-mix(in oklch, var(--__P__-accent) 45%, transparent), 0 12px 32px -12px rgba(13, 15, 20, .25);--__P__-z-fab: 2147483600;--__P__-z-panel: 2147483601;--__P__-panel-w: 380px;--__P__-panel-h: 600px;--__P__-fab-size: 56px;--__P__-space-1: 4px;--__P__-space-2: 8px;--__P__-space-3: 12px;--__P__-space-4: 16px;--__P__-space-5: 20px;--__P__-space-6: 24px;--__P__-space-8: 32px;--__P__-text-scale: 1;--__P__-text-xs: calc(12px * var(--__P__-text-scale));--__P__-text-sm: calc(13px * var(--__P__-text-scale));--__P__-text-base: calc(15px * var(--__P__-text-scale));--__P__-text-md: calc(16px * var(--__P__-text-scale));--__P__-text-lg: calc(18px * var(--__P__-text-scale));--__P__-text-xl: calc(22px * var(--__P__-text-scale));--__P__-text-2xl: calc(30px * var(--__P__-text-scale))}:host([data-text-size="small"]){--__P__-text-scale: .9}:host([data-text-size="large"]){--__P__-text-scale: 1.15}:host{--__P__-ease: cubic-bezier(.2, .7, .2, 1);--__P__-ease-out: cubic-bezier(.2, .7, .2, 1);--__P__-ease-in: cubic-bezier(.4, 0, 1, 1);--__P__-ease-in-out: cubic-bezier(.65, 0, .35, 1);--__P__-dur-quick: .12s;--__P__-dur-base: .22s;--__P__-dur-slow: .32s;font-family:var(--__P__-font);color:var(--__P__-fg);color-scheme:light;--__P__-color-scheme: light}:host([data-theme="dark"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-danger-text: oklch(.8077 .1035 19.57);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .18);--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);--__P__-shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px -6px rgba(0, 0, 0, .5);--__P__-backdrop: rgba(0, 0, 0, .65);color-scheme:dark;--__P__-color-scheme: dark}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);color-scheme:dark;--__P__-color-scheme: dark}}@media(prefers-reduced-motion:reduce){:host{--__P__-dur-quick: 1ms;--__P__-dur-base: 1ms;--__P__-dur-slow: 1ms}}\n';
|
|
925
|
+
var tokens_default = ':host{--__P__-accent-user: __BRAND_ACCENT__;--__P__-accent: var(--__P__-accent-user);--__P__-accent-text-user: __BRAND_ACCENT_TEXT__;--__P__-accent-text: var(--__P__-accent-text-user);--__P__-radius: __BRAND_RADIUS__;--__P__-radius-sm: 8px;--__P__-radius-md: 10px;--__P__-radius-lg: 16px;--__P__-font: __BRAND_FONT__;--__P__-font-display: var(--__P__-font);--__P__-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;--__P__-bg: oklch(1 0 0);--__P__-bg-elevated: oklch(.9789 .0029 278.3);--__P__-surface: var(--__P__-bg-elevated);--__P__-muted: var(--__P__-fg-muted);--__P__-hover: oklch(.1686 .011 278.3 / .06);--__P__-fg: oklch(.1686 .011 278.3);--__P__-fg-muted: oklch(.4932 .0301 278.3);--__P__-border: oklch(.9312 .0084 278.3);--__P__-border-strong: oklch(.8757 .0131 278.3);--__P__-bubble-user: var(--__P__-accent);--__P__-bubble-user-text: var(--__P__-accent-text);--__P__-bubble-assistant: oklch(.9638 .0058 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-on-accent: var(--__P__-accent-text);--__P__-success: oklch(.6456 .1654 151.53);--__P__-warning: oklch(.7135 .1494 74.05);--__P__-danger: oklch(.5966 .1818 24.51);--__P__-danger-text: oklch(.5054 .1905 27.52);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .1);--__P__-neutral: oklch(.7137 .0192 278.3);--__P__-focus: var(--__P__-accent);--__P__-shadow-panel: 0 8px 24px -8px rgba(13, 15, 20, .18), 0 24px 64px -24px rgba(13, 15, 20, .24);--__P__-shadow-card: 0 1px 2px rgba(13, 15, 20, .06), 0 4px 12px -6px rgba(13, 15, 20, .12);--__P__-backdrop: oklch(.1686 .011 278.3 / .55);--__P__-shadow-fab: 0 6px 16px -4px color-mix(in oklch, var(--__P__-accent) 45%, transparent), 0 12px 32px -12px rgba(13, 15, 20, .25);--__P__-z-fab: 2147483600;--__P__-z-panel: 2147483601;--__P__-panel-w: 380px;--__P__-panel-h: 600px;--__P__-fab-size: 56px;--__P__-space-1: 4px;--__P__-space-2: 8px;--__P__-space-3: 12px;--__P__-space-4: 16px;--__P__-space-5: 20px;--__P__-space-6: 24px;--__P__-space-8: 32px;--__P__-text-scale: 1;--__P__-text-xs: calc(12px * var(--__P__-text-scale));--__P__-text-sm: calc(13px * var(--__P__-text-scale));--__P__-text-base: calc(15px * var(--__P__-text-scale));--__P__-text-md: calc(16px * var(--__P__-text-scale));--__P__-text-lg: calc(18px * var(--__P__-text-scale));--__P__-text-xl: calc(22px * var(--__P__-text-scale));--__P__-text-2xl: calc(30px * var(--__P__-text-scale))}:host([data-text-size="small"]){--__P__-text-scale: .9}:host([data-text-size="large"]){--__P__-text-scale: 1.15}:host{--__P__-ease: cubic-bezier(.2, .7, .2, 1);--__P__-ease-out: cubic-bezier(.2, .7, .2, 1);--__P__-ease-in: cubic-bezier(.4, 0, 1, 1);--__P__-ease-in-out: cubic-bezier(.65, 0, .35, 1);--__P__-dur-quick: .12s;--__P__-dur-base: .22s;--__P__-dur-slow: .32s;font-family:var(--__P__-font);color:var(--__P__-fg);color-scheme:light;--__P__-color-scheme: light}:host([data-theme="dark"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-danger-text: oklch(.8077 .1035 19.57);--__P__-danger-bg: oklch(.5966 .1818 24.51 / .18);--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);--__P__-shadow-card: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px -6px rgba(0, 0, 0, .5);--__P__-backdrop: rgba(0, 0, 0, .65);color-scheme:dark;--__P__-color-scheme: dark}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-bg: oklch(.1783 .0128 278.3);--__P__-bg-elevated: oklch(.2232 .0182 278.3);--__P__-fg: oklch(.9368 .01 278.3);--__P__-fg-muted: oklch(.7048 .0296 278.3);--__P__-border: oklch(.2752 .0266 278.3);--__P__-border-strong: oklch(.335 .0291 278.3);--__P__-hover: oklch(.9368 .01 278.3 / .08);--__P__-bubble-assistant: oklch(.2474 .0311 278.3);--__P__-bubble-assistant-text: var(--__P__-fg);--__P__-shadow-panel: 0 8px 24px -8px rgba(0, 0, 0, .6), 0 24px 64px -24px rgba(0, 0, 0, .7);color-scheme:dark;--__P__-color-scheme: dark}}@supports (color: oklch(from red l c h)){:host{--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.3, l, .62) c h);--__P__-accent-text: oklch(from var(--__P__-accent) clamp(0, (l / .623 - 1) * -infinity, 1) 0 h)}:host([data-theme="dark"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h)}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h)}}}@media(prefers-reduced-motion:reduce){:host{--__P__-dur-quick: 1ms;--__P__-dur-base: 1ms;--__P__-dur-slow: 1ms}}\n';
|
|
929
926
|
|
|
930
927
|
// src/styles/reset.css
|
|
931
928
|
var reset_default = '*,*:before,*:after{box-sizing:border-box;margin:0;padding:0;border:0}button{font:inherit;color:inherit;background:none;cursor:pointer;-webkit-appearance:none;appearance:none;line-height:1}button:focus-visible,[tabindex]:focus-visible,textarea:focus-visible,input:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px}textarea,input{font:inherit;color:inherit;background:none;border:0;outline:0;resize:none}a{color:var(--__P__-accent);text-decoration:underline;text-underline-offset:2px}img,svg{display:block;max-width:100%}ul,ol{list-style:none}.__P__-app{display:block;width:100%;height:100%;font-family:var(--__P__-font);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-feature-settings:"cv11","ss01","ss03"}.__P__-sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n';
|
|
@@ -1020,8 +1017,8 @@ function attachAdoptedSheet(shadow, doc) {
|
|
|
1020
1017
|
}
|
|
1021
1018
|
function applyThemeOverrides(host, overrides) {
|
|
1022
1019
|
const p33 = BRAND.cssPrefix;
|
|
1023
|
-
if (overrides.accent) host.style.setProperty(`--${p33}-accent`, overrides.accent);
|
|
1024
|
-
if (overrides.accentText) host.style.setProperty(`--${p33}-accent-text`, overrides.accentText);
|
|
1020
|
+
if (overrides.accent) host.style.setProperty(`--${p33}-accent-user`, overrides.accent);
|
|
1021
|
+
if (overrides.accentText) host.style.setProperty(`--${p33}-accent-text-user`, overrides.accentText);
|
|
1025
1022
|
if (overrides.radius) host.style.setProperty(`--${p33}-radius`, overrides.radius);
|
|
1026
1023
|
if (overrides.fontFamily) host.style.setProperty(`--${p33}-font`, overrides.fontFamily);
|
|
1027
1024
|
}
|
|
@@ -1860,15 +1857,6 @@ function makeAssistantMessage() {
|
|
|
1860
1857
|
partsSig: signal([])
|
|
1861
1858
|
};
|
|
1862
1859
|
}
|
|
1863
|
-
function makeTypewriterMessage(m) {
|
|
1864
|
-
return {
|
|
1865
|
-
id: m.id,
|
|
1866
|
-
role: m.role,
|
|
1867
|
-
createdAt: Date.now(),
|
|
1868
|
-
status: "streaming",
|
|
1869
|
-
partsSig: signal([{ kind: "text", id: `${m.id}-t0`, textSig: signal(""), doneSig: signal(false) }])
|
|
1870
|
-
};
|
|
1871
|
-
}
|
|
1872
1860
|
function makeInstantWelcomeMessage(m) {
|
|
1873
1861
|
return toReactive({
|
|
1874
1862
|
id: m.id,
|
|
@@ -6254,55 +6242,6 @@ function ModulesEmpty({ strings, onClose }) {
|
|
|
6254
6242
|
);
|
|
6255
6243
|
}
|
|
6256
6244
|
|
|
6257
|
-
// src/ui/welcome-animator.ts
|
|
6258
|
-
async function animateWelcomeSequence(reactives, payloads, charsPerSecond, abort) {
|
|
6259
|
-
for (let i = 0; i < reactives.length; i++) {
|
|
6260
|
-
if (abort.aborted) return;
|
|
6261
|
-
const msg = reactives[i];
|
|
6262
|
-
const payload = payloads[i];
|
|
6263
|
-
if (!msg || !payload) continue;
|
|
6264
|
-
await animateTypewriter(msg, payload.text, charsPerSecond, abort);
|
|
6265
|
-
}
|
|
6266
|
-
}
|
|
6267
|
-
function animateTypewriter(msg, text, charsPerSecond, abort) {
|
|
6268
|
-
return new Promise((resolve) => {
|
|
6269
|
-
const part = msg.partsSig.value[0];
|
|
6270
|
-
if (!part || part.kind !== "text") {
|
|
6271
|
-
resolve();
|
|
6272
|
-
return;
|
|
6273
|
-
}
|
|
6274
|
-
const finish = () => {
|
|
6275
|
-
part.textSig.value = text;
|
|
6276
|
-
part.doneSig.value = true;
|
|
6277
|
-
msg.status = "complete";
|
|
6278
|
-
msg.partsSig.value = [...msg.partsSig.value];
|
|
6279
|
-
resolve();
|
|
6280
|
-
};
|
|
6281
|
-
if (typeof requestAnimationFrame === "undefined") {
|
|
6282
|
-
finish();
|
|
6283
|
-
return;
|
|
6284
|
-
}
|
|
6285
|
-
const totalMs = text.length / Math.max(1, charsPerSecond) * 1e3;
|
|
6286
|
-
const start = performance.now();
|
|
6287
|
-
const tick = (now) => {
|
|
6288
|
-
if (abort.aborted) return finish();
|
|
6289
|
-
const progress = totalMs === 0 ? 1 : Math.min(1, (now - start) / totalMs);
|
|
6290
|
-
part.textSig.value = text.slice(0, Math.floor(progress * text.length));
|
|
6291
|
-
if (progress >= 1) return finish();
|
|
6292
|
-
rafId = requestAnimationFrame(tick);
|
|
6293
|
-
};
|
|
6294
|
-
let rafId = requestAnimationFrame(tick);
|
|
6295
|
-
abort.addEventListener(
|
|
6296
|
-
"abort",
|
|
6297
|
-
() => {
|
|
6298
|
-
cancelAnimationFrame(rafId);
|
|
6299
|
-
finish();
|
|
6300
|
-
},
|
|
6301
|
-
{ once: true }
|
|
6302
|
-
);
|
|
6303
|
-
});
|
|
6304
|
-
}
|
|
6305
|
-
|
|
6306
6245
|
// src/ui/use-launcher-callout.ts
|
|
6307
6246
|
import { useCallback as useCallback5, useEffect as useEffect16, useState as useState12 } from "preact/hooks";
|
|
6308
6247
|
function useLauncherCallout({ callout, persistence }) {
|
|
@@ -6381,7 +6320,6 @@ function App({ options, hostElement, bus }) {
|
|
|
6381
6320
|
const [agent, setAgent] = useState13(null);
|
|
6382
6321
|
const [suggestions, setSuggestions] = useState13([]);
|
|
6383
6322
|
const [activeCancel, setActiveCancel] = useState13(null);
|
|
6384
|
-
const welcomeAbortRef = useRef9(null);
|
|
6385
6323
|
const [parsedSite, setParsedSite] = useState13(void 0);
|
|
6386
6324
|
const [parsedBlocks, setParsedBlocks] = useState13(void 0);
|
|
6387
6325
|
const [sidebarCollapsed, setSidebarCollapsed] = useState13(() => persistence.loadSidebarCollapsed() ?? false);
|
|
@@ -6465,19 +6403,9 @@ function App({ options, hostElement, bus }) {
|
|
|
6465
6403
|
const playWelcome = useCallback6(
|
|
6466
6404
|
(welcomeMessages) => {
|
|
6467
6405
|
if (!welcomeMessages || welcomeMessages.length === 0) return;
|
|
6468
|
-
|
|
6469
|
-
if (animation === "instant") {
|
|
6470
|
-
messagesSig.value = welcomeMessages.map(makeInstantWelcomeMessage);
|
|
6471
|
-
return;
|
|
6472
|
-
}
|
|
6473
|
-
welcomeAbortRef.current?.abort();
|
|
6474
|
-
const ctrl = new AbortController();
|
|
6475
|
-
welcomeAbortRef.current = ctrl;
|
|
6476
|
-
const reactives = welcomeMessages.map(makeTypewriterMessage);
|
|
6477
|
-
messagesSig.value = reactives;
|
|
6478
|
-
void animateWelcomeSequence(reactives, welcomeMessages, speed, ctrl.signal);
|
|
6406
|
+
messagesSig.value = welcomeMessages.map(makeInstantWelcomeMessage);
|
|
6479
6407
|
},
|
|
6480
|
-
[messagesSig
|
|
6408
|
+
[messagesSig]
|
|
6481
6409
|
);
|
|
6482
6410
|
const connectGenRef = useRef9(0);
|
|
6483
6411
|
const runStartConversation = useCallback6(
|
|
@@ -6916,7 +6844,6 @@ function App({ options, hostElement, bus }) {
|
|
|
6916
6844
|
log16.info("clear \u2192 new conversation", { wasStreaming: streaming });
|
|
6917
6845
|
bus.emit("clear", void 0);
|
|
6918
6846
|
if (streaming) activeCancel?.();
|
|
6919
|
-
welcomeAbortRef.current?.abort();
|
|
6920
6847
|
messagesSig.value = [];
|
|
6921
6848
|
conversationIdSig.value = void 0;
|
|
6922
6849
|
persistence.clearConversation();
|
package/package.json
CHANGED
package/schema.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, E as Endpoints, L as Link, P as PAGE_AREA_SUGGESTIONS, g as PageContext, S as ServerConfig, b as SiteConfig, c as StartConversationResponse, U as UserContext, W as WidgetConfig, d as WidgetConfigPartial, e as WidgetSettings, f as WidgetSettingsPartial, h as assetSchema, i as blocksConfigSchema, j as connectionConfigPartialSchema, k as connectionConfigSchema, l as cssColorSchema, m as cssLengthSchema, n as endpointsSchema, o as linkSchema, p as localeSchema, q as pageContextSchema, s as serverConfigSchema, r as siteConfigSchema, t as startConversationResponseSchema, u as userContextSchema, v as uuid7Schema, w as widgetConfigPartialSchema, x as widgetConfigSchema, y as widgetSettingsPartialSchema, z as widgetSettingsSchema } from './deployment-
|
|
1
|
+
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, E as Endpoints, L as Link, P as PAGE_AREA_SUGGESTIONS, g as PageContext, S as ServerConfig, b as SiteConfig, c as StartConversationResponse, U as UserContext, W as WidgetConfig, d as WidgetConfigPartial, e as WidgetSettings, f as WidgetSettingsPartial, h as assetSchema, i as blocksConfigSchema, j as connectionConfigPartialSchema, k as connectionConfigSchema, l as cssColorSchema, m as cssLengthSchema, n as endpointsSchema, o as linkSchema, p as localeSchema, q as pageContextSchema, s as serverConfigSchema, r as siteConfigSchema, t as startConversationResponseSchema, u as userContextSchema, v as uuid7Schema, w as widgetConfigPartialSchema, x as widgetConfigSchema, y as widgetSettingsPartialSchema, z as widgetSettingsSchema } from './deployment-CA9yYj8Y.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -504,27 +504,6 @@ declare const composerOptionsSchema: z.ZodObject<{
|
|
|
504
504
|
}, z.core.$loose>;
|
|
505
505
|
type ComposerOptions = z.infer<typeof composerOptionsSchema>;
|
|
506
506
|
|
|
507
|
-
/**
|
|
508
|
-
* Welcome section — how the agent's greeting messages render when
|
|
509
|
-
* the chat opens. Content (the actual message text + suggestions)
|
|
510
|
-
* comes from the server's start-conversation response; this schema only
|
|
511
|
-
* governs the visual presentation (animation style + speed).
|
|
512
|
-
*/
|
|
513
|
-
|
|
514
|
-
declare const welcomeAnimationSchema: z.ZodEnum<{
|
|
515
|
-
typewriter: "typewriter";
|
|
516
|
-
instant: "instant";
|
|
517
|
-
}>;
|
|
518
|
-
type WelcomeAnimation = z.infer<typeof welcomeAnimationSchema>;
|
|
519
|
-
declare const welcomeOptionsSchema: z.ZodObject<{
|
|
520
|
-
animation: z.ZodDefault<z.ZodEnum<{
|
|
521
|
-
typewriter: "typewriter";
|
|
522
|
-
instant: "instant";
|
|
523
|
-
}>>;
|
|
524
|
-
speed: z.ZodDefault<z.ZodNumber>;
|
|
525
|
-
}, z.core.$loose>;
|
|
526
|
-
type WelcomeOptions = z.infer<typeof welcomeOptionsSchema>;
|
|
527
|
-
|
|
528
507
|
/**
|
|
529
508
|
* Footer section schemas — the area below the composer.
|
|
530
509
|
*
|
|
@@ -902,4 +881,4 @@ declare const ALL_MODES: readonly Mode[];
|
|
|
902
881
|
*/
|
|
903
882
|
declare function emitJsonSchema(): unknown;
|
|
904
883
|
|
|
905
|
-
export { ALL_MODES, type ActionName, type AttachmentLimits, type Behavior, type CalloutPosition, type CalloutShape, type ComposerOptions, type FeatureFlags, type FeedbackEvent, type FeedbackOptions, type FieldOption, type FieldType, type FieldValidation, type FooterOptions, type FormCondition, type FormDef, type FormField, type Forms, type HapticsOptions, type HeaderActions, type HeaderOptions, type I18nOptions, type LauncherCallout, type LauncherOptions, type LauncherSize, type LauncherVariant, type Mode, type ModuleLayout, type ModuleOptions, type ModulesOptions, type Position, type PoweredBy, type Presentation, type ResizeOptions, type ResponseMode, type SendButtonOptions, type SizeOptions, type SoundOptions, type StringsOverride, type ThemeOverrides, type ThemePreference, type VoiceMode,
|
|
884
|
+
export { ALL_MODES, type ActionName, type AttachmentLimits, type Behavior, type CalloutPosition, type CalloutShape, type ComposerOptions, type FeatureFlags, type FeedbackEvent, type FeedbackOptions, type FieldOption, type FieldType, type FieldValidation, type FooterOptions, type FormCondition, type FormDef, type FormField, type Forms, type HapticsOptions, type HeaderActions, type HeaderOptions, type I18nOptions, type LauncherCallout, type LauncherOptions, type LauncherSize, type LauncherVariant, type Mode, type ModuleLayout, type ModuleOptions, type ModulesOptions, type Position, type PoweredBy, type Presentation, type ResizeOptions, type ResponseMode, type SendButtonOptions, type SizeOptions, type SoundOptions, type StringsOverride, type ThemeOverrides, type ThemePreference, type VoiceMode, actionNameSchema, attachmentLimitsSchema, behaviorSchema, calloutPositionSchema, calloutShapeSchema, composerOptionsSchema, emitJsonSchema, featureFlagsSchema, feedbackEventSchema, feedbackSchema, fieldOptionSchema, fieldTypeSchema, fieldValidationSchema, footerSchema, formConditionSchema, formDefSchema, formFieldSchema, formTriggerSchema, formsSchema, hapticsOptionsSchema, headerActionsSchema, headerSchema, i18nSchema, initialSizeSchema, launcherCalloutSchema, launcherOptionsSchema, launcherSizeSchema, launcherVariantSchema, modeSchema, moduleLayoutSchema, moduleSchema, modulesSchema, positionSchema, poweredBySchema, presentationSchema, resizeOptionsSchema, responseModeSchema, sendButtonIconSchema, sendButtonOptionsSchema, sendButtonShapeSchema, sendButtonVariantSchema, sizeOptionsSchema, soundOptionsSchema, stringsOverrideSchema, themeFieldSchema, themeOverridesSchema, themePreferenceSchema, toolRefSchema, voiceModeSchema, widgetSettingsSchemaForMode };
|
package/schema.json
CHANGED
|
@@ -907,42 +907,6 @@
|
|
|
907
907
|
}
|
|
908
908
|
]
|
|
909
909
|
},
|
|
910
|
-
"welcome": {
|
|
911
|
-
"type": "object",
|
|
912
|
-
"properties": {
|
|
913
|
-
"animation": {
|
|
914
|
-
"default": "instant",
|
|
915
|
-
"description": "How welcome messages render — `typewriter` types each message in character-by-character; `instant` shows them whole.",
|
|
916
|
-
"type": "string",
|
|
917
|
-
"enum": [
|
|
918
|
-
"typewriter",
|
|
919
|
-
"instant"
|
|
920
|
-
]
|
|
921
|
-
},
|
|
922
|
-
"speed": {
|
|
923
|
-
"default": 60,
|
|
924
|
-
"description": "Typewriter speed in characters per second. Only meaningful when `animation = typewriter`.",
|
|
925
|
-
"type": "integer",
|
|
926
|
-
"minimum": 1,
|
|
927
|
-
"maximum": 2000
|
|
928
|
-
}
|
|
929
|
-
},
|
|
930
|
-
"required": [
|
|
931
|
-
"animation",
|
|
932
|
-
"speed"
|
|
933
|
-
],
|
|
934
|
-
"additionalProperties": {},
|
|
935
|
-
"description": "How welcome messages render — instant by default; opt into a typewriter effect with adjustable cps speed.",
|
|
936
|
-
"examples": [
|
|
937
|
-
{
|
|
938
|
-
"animation": "instant"
|
|
939
|
-
},
|
|
940
|
-
{
|
|
941
|
-
"animation": "typewriter",
|
|
942
|
-
"speed": 60
|
|
943
|
-
}
|
|
944
|
-
]
|
|
945
|
-
},
|
|
946
910
|
"feedback": {
|
|
947
911
|
"type": "object",
|
|
948
912
|
"properties": {
|
|
@@ -2661,42 +2625,6 @@
|
|
|
2661
2625
|
}
|
|
2662
2626
|
]
|
|
2663
2627
|
},
|
|
2664
|
-
"welcome": {
|
|
2665
|
-
"type": "object",
|
|
2666
|
-
"properties": {
|
|
2667
|
-
"animation": {
|
|
2668
|
-
"default": "instant",
|
|
2669
|
-
"description": "How welcome messages render — `typewriter` types each message in character-by-character; `instant` shows them whole.",
|
|
2670
|
-
"type": "string",
|
|
2671
|
-
"enum": [
|
|
2672
|
-
"typewriter",
|
|
2673
|
-
"instant"
|
|
2674
|
-
]
|
|
2675
|
-
},
|
|
2676
|
-
"speed": {
|
|
2677
|
-
"default": 60,
|
|
2678
|
-
"description": "Typewriter speed in characters per second. Only meaningful when `animation = typewriter`.",
|
|
2679
|
-
"type": "integer",
|
|
2680
|
-
"minimum": 1,
|
|
2681
|
-
"maximum": 2000
|
|
2682
|
-
}
|
|
2683
|
-
},
|
|
2684
|
-
"required": [
|
|
2685
|
-
"animation",
|
|
2686
|
-
"speed"
|
|
2687
|
-
],
|
|
2688
|
-
"additionalProperties": {},
|
|
2689
|
-
"description": "How welcome messages render — instant by default; opt into a typewriter effect with adjustable cps speed.",
|
|
2690
|
-
"examples": [
|
|
2691
|
-
{
|
|
2692
|
-
"animation": "instant"
|
|
2693
|
-
},
|
|
2694
|
-
{
|
|
2695
|
-
"animation": "typewriter",
|
|
2696
|
-
"speed": 60
|
|
2697
|
-
}
|
|
2698
|
-
]
|
|
2699
|
-
},
|
|
2700
2628
|
"feedback": {
|
|
2701
2629
|
"type": "object",
|
|
2702
2630
|
"properties": {
|