@helpai/elements 1.5.8 → 1.5.10
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.d.ts +0 -7
- package/configurator.mjs +1 -1
- package/elements-web-component.esm.js +39 -39
- package/elements-web-component.esm.js.map +4 -4
- package/elements.cjs.js +39 -39
- package/elements.cjs.js.map +4 -4
- package/elements.esm.js +39 -39
- package/elements.esm.js.map +4 -4
- package/elements.js +39 -39
- package/elements.js.map +4 -4
- package/index.d.ts +31 -49
- package/index.mjs +22 -19
- package/package.json +1 -1
- package/schema.d.ts +0 -39
- package/style.css +1 -1
- package/web-component.d.ts +0 -3
- package/web-component.mjs +21 -18
package/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
//#region src/core/storage.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* Pluggable client-side key-value storage.
|
|
5
4
|
*
|
|
@@ -25,8 +24,6 @@ interface ClientStorage {
|
|
|
25
24
|
/** Removes `key`. No-op if absent. */
|
|
26
25
|
remove(key: string): void;
|
|
27
26
|
}
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/i18n/strings.d.ts
|
|
30
27
|
/**
|
|
31
28
|
* UI strings — built-in defaults, type contracts, and runtime resolution.
|
|
32
29
|
*
|
|
@@ -41,7 +38,7 @@ interface ClientStorage {
|
|
|
41
38
|
* populated {@link Strings} map. UI components then read `strings.send` as a
|
|
42
39
|
* normal property access — no per-render lookup, no per-render allocation.
|
|
43
40
|
*/
|
|
44
|
-
type StringKey = 'launcherOpen' | 'launcherLabel' | 'panelTitle' | 'composerPlaceholder' | 'send' | 'stop' | 'queueMessage' | 'removeQueuedMessage' | 'compactingContext' | 'attach' | 'micStart' | 'micStop' | 'micUnsupported' | 'expand' | 'collapse' | 'fullscreen' | 'exitFullscreen' | 'popOut' | 'resizeHandle' | 'scrollToBottom' | 'close' | 'moreActions' | 'soundOn' | 'soundOff' | 'language' | 'theme' | 'themeAuto' | 'themeLight' | 'themeDark' | 'textSize' | 'textSizeSmall' | 'textSizeNormal' | 'textSizeLarge' | 'history' | 'historyTitle' | 'historyEmpty' | 'historyLoading' | 'historyBack' | 'historyContinue' | 'loadMoreConversations' | 'conversationLoading' | 'loadPreviousMessages' | 'conversationClosed' | 'startNewConversation' | 'talkToOperator' | 'connectingOperator' | 'noOperatorAvailable' | 'chattingWithOperator' | 'cancelOperatorRequest' | 'dateToday' | 'dateYesterday' | 'dateLastWeek' | 'dateOlder' | 'newConversation' | 'dropZone' | 'attachmentTooLarge' | 'attachmentTooMany' | 'attachmentMimeRejected' | 'errorRetry' | 'errorGeneric' | 'errorRateLimited' | 'loading' | 'visualPreparing' | 'visualError' | 'visualPartial' | 'thinking' | 'thoughts' | 'toolResult' | 'sources' | 'feedbackUp' | 'feedbackDown' | 'feedbackThanks' | 'copy' | 'copied' | 'collapseSidebar' | 'expandSidebar' | 'formSubmit' | 'formSkip' | 'formSubmitted' | 'formSkipped' | 'formFillOut' | 'formRequired' | 'formInvalidEmail' | 'formInvalidTel' | 'formInvalidUrl' | 'formInvalidNumber' | 'formTooShort' | 'formTooLong' | 'formNumberTooSmall' | 'formNumberTooLarge' | 'formPatternMismatch' | 'formChooseAtLeast' | 'formChooseAtMost' | 'formOther' | 'formOtherPlaceholder' | 'inputRequired' | 'inputBadge' | 'inputAnswered' | 'inputSkipped' | 'inputSubmit' | 'inputSubmitHint' | 'inputSkip' | 'showOptions' | 'hideOptions' | 'qtypeText' | 'qtypeEmail' | 'qtypePhone' | 'qtypeNumber' | 'qtypeDate' | 'qtypeChooseOne' | 'qtypeChooseAny' | 'qtypeBoolean' | 'confirmYes' | 'confirmNo' | 'approve' | 'reject' | 'approvalPrompt' | 'approvalBody' | 'approvalYourResponse' | 'approvalEditHint' | 'approvalSubmitting' | 'edit' | 'toolParameters' | 'statusAwaiting' | 'statusResponded' | 'statusCompleted' | 'statusDenied' | 'statusError' | 'statusRunning' | 'statusSuperseded' | 'tabHome' | 'tabConversations' | 'tabHelp' | 'tabNews' | 'modulesEmpty' | 'moduleBack' | 'contentLoading' | 'contentHelpful' | 'homeGreeting' | 'homeGreetingNamed' | 'homeGreetingLead' | 'homeSearchPlaceholder' | 'homeContentTitle' | 'homeStatus' | 'helpTitle' | 'helpSearchPlaceholder' | 'helpEmpty' | 'helpLoading' | 'helpSearchEmpty' | 'helpShowMore' | 'newsTitle' | 'newsEmpty' | 'newsLoading' | 'newsBack' | 'newsPublishedAt';
|
|
41
|
+
type StringKey = 'launcherOpen' | 'launcherLabel' | 'panelTitle' | 'composerPlaceholder' | 'send' | 'stop' | 'queueMessage' | 'removeQueuedMessage' | 'compactingContext' | 'attach' | 'micStart' | 'micStop' | 'micUnsupported' | 'expand' | 'collapse' | 'fullscreen' | 'exitFullscreen' | 'popOut' | 'resizeHandle' | 'scrollToBottom' | 'close' | 'moreActions' | 'soundOn' | 'soundOff' | 'language' | 'theme' | 'themeAuto' | 'themeLight' | 'themeDark' | 'textSize' | 'textSizeSmall' | 'textSizeNormal' | 'textSizeLarge' | 'history' | 'historyTitle' | 'historyEmpty' | 'historyLoading' | 'historyBack' | 'historyContinue' | 'loadMoreConversations' | 'conversationLoading' | 'loadPreviousMessages' | 'conversationClosed' | 'startNewConversation' | 'talkToOperator' | 'connectingOperator' | 'noOperatorAvailable' | 'chattingWithOperator' | 'cancelOperatorRequest' | 'dateToday' | 'dateYesterday' | 'dateLastWeek' | 'dateOlder' | 'newConversation' | 'dropZone' | 'attachmentTooLarge' | 'attachmentTooMany' | 'attachmentMimeRejected' | 'errorRetry' | 'errorGeneric' | 'errorRateLimited' | 'loading' | 'visualPreparing' | 'visualError' | 'visualPartial' | 'thinking' | 'thoughts' | 'toolResult' | 'sources' | 'feedbackUp' | 'feedbackDown' | 'feedbackThanks' | 'copy' | 'copied' | 'collapseSidebar' | 'expandSidebar' | 'formSubmit' | 'formSkip' | 'formSubmitted' | 'formSkipped' | 'formFillOut' | 'formRequired' | 'formInvalidEmail' | 'formInvalidTel' | 'formInvalidUrl' | 'formInvalidNumber' | 'formTooShort' | 'formTooLong' | 'formNumberTooSmall' | 'formNumberTooLarge' | 'formPatternMismatch' | 'formChooseAtLeast' | 'formChooseAtMost' | 'formOther' | 'formOtherPlaceholder' | 'inputRequired' | 'inputBadge' | 'inputAnswered' | 'inputSkipped' | 'inputSubmit' | 'inputSubmitHint' | 'inputSkip' | 'showOptions' | 'hideOptions' | 'qtypeText' | 'qtypeEmail' | 'qtypePhone' | 'qtypeNumber' | 'qtypeDate' | 'qtypeChooseOne' | 'qtypeChooseAny' | 'qtypeBoolean' | 'confirmYes' | 'confirmNo' | 'approve' | 'reject' | 'approvalPrompt' | 'approvalBody' | 'approvalYourResponse' | 'approvalEditHint' | 'approvalSubmitting' | 'edit' | 'toolParameters' | 'statusAwaiting' | 'statusResponded' | 'statusCompleted' | 'statusDenied' | 'statusError' | 'statusRunning' | 'statusSuperseded' | 'tabHome' | 'tabConversations' | 'tabHelp' | 'tabNews' | 'modulesEmpty' | 'moduleBack' | 'contentLoading' | 'contentHelpful' | 'homeGreeting' | 'homeGreetingNamed' | 'homeGreetingLead' | 'homeSearchPlaceholder' | 'homeAskPlaceholder' | 'homeWhatsNew' | 'homeContentTitle' | 'homeStatus' | 'helpTitle' | 'helpSearchPlaceholder' | 'helpEmpty' | 'helpLoading' | 'helpSearchEmpty' | 'helpShowMore' | 'newsTitle' | 'newsEmpty' | 'newsLoading' | 'newsBack' | 'newsPublishedAt' | 'newsShowMore' | 'newsUnseen';
|
|
45
42
|
/** A partial map for one locale — what overrides look like on the wire. */
|
|
46
43
|
type LocaleStrings = Partial<Record<StringKey, string>>;
|
|
47
44
|
/**
|
|
@@ -65,8 +62,6 @@ type Strings = Record<StringKey, string>;
|
|
|
65
62
|
* top-level value is an object, the whole override is treated as nested.
|
|
66
63
|
*/
|
|
67
64
|
type StringsOverride = LocaleStrings | Partial<Record<string, LocaleStrings>>;
|
|
68
|
-
//#endregion
|
|
69
|
-
//#region src/core/config/types/common.d.ts
|
|
70
65
|
/**
|
|
71
66
|
* Primitive type aliases shared across every config section. Kept in
|
|
72
67
|
* one file so a domain-specific change (adding a new `Mode` value,
|
|
@@ -134,8 +129,6 @@ type ActionName = 'clear' | 'expand' | 'fullscreen' | 'popOut' | 'sound' | 'hist
|
|
|
134
129
|
* set for each mode; a deployment can replace the whole list.
|
|
135
130
|
*/
|
|
136
131
|
type ActionList = ActionName[];
|
|
137
|
-
//#endregion
|
|
138
|
-
//#region src/core/config/types/composer.d.ts
|
|
139
132
|
/**
|
|
140
133
|
* Composer chrome and capability flags. `ChatWidgetOptions.composer` owns the
|
|
141
134
|
* send-button skin + attachment limits; `ChatWidgetOptions.features` owns voice,
|
|
@@ -212,8 +205,6 @@ interface ComposerOptions {
|
|
|
212
205
|
/** Client-side attachment limits. Server still validates at upload time. */
|
|
213
206
|
attachments?: AttachmentLimits;
|
|
214
207
|
}
|
|
215
|
-
//#endregion
|
|
216
|
-
//#region src/core/config/types/feedback.d.ts
|
|
217
208
|
/**
|
|
218
209
|
* Audible + tactile feedback knobs. Both channels default to enabled (browser
|
|
219
210
|
* autoplay policy still gates audio playback).
|
|
@@ -261,8 +252,6 @@ interface FeedbackOptions {
|
|
|
261
252
|
sound?: SoundOptions;
|
|
262
253
|
haptics?: HapticsOptions;
|
|
263
254
|
}
|
|
264
|
-
//#endregion
|
|
265
|
-
//#region src/core/config/types/forms.d.ts
|
|
266
255
|
/**
|
|
267
256
|
* Event-driven forms engine — framework-free runtime types (mirror of
|
|
268
257
|
* `src/schema/widget/forms.ts`). The IIFE path has no Zod, so these plain
|
|
@@ -450,8 +439,6 @@ interface ResolvedForms {
|
|
|
450
439
|
/** Forms keyed by trigger kind, for fast event lookup. */
|
|
451
440
|
byTrigger: Partial<Record<TriggerKind, ResolvedForm[]>>;
|
|
452
441
|
}
|
|
453
|
-
//#endregion
|
|
454
|
-
//#region src/core/config/types/launcher.d.ts
|
|
455
442
|
/**
|
|
456
443
|
* Launcher (floating-mode FAB) + the pre-engagement callout bubble.
|
|
457
444
|
* Inputs are option-bag shaped; the resolved variant lives in `widget.ts`.
|
|
@@ -518,8 +505,6 @@ interface LauncherOptions {
|
|
|
518
505
|
/** Pre-engagement bubble next to the FAB. See {@link LauncherCalloutOptions}. */
|
|
519
506
|
callout?: LauncherCalloutOptions;
|
|
520
507
|
}
|
|
521
|
-
//#endregion
|
|
522
|
-
//#region src/core/config/types/modules.d.ts
|
|
523
508
|
/**
|
|
524
509
|
* Messenger "modules" runtime config types — framework-free mirror of
|
|
525
510
|
* `src/schema/widget/modules.ts`. The IIFE runtime path has no Zod, so
|
|
@@ -604,8 +589,6 @@ interface ResolvedModules {
|
|
|
604
589
|
/** The tabs keyed by `id` (for nav + per-tab config lookup). */
|
|
605
590
|
byId: Record<string, ResolvedModule>;
|
|
606
591
|
}
|
|
607
|
-
//#endregion
|
|
608
|
-
//#region src/core/config/types/presentation.d.ts
|
|
609
592
|
/** CSS-custom-property overrides applied as inline styles on the host. */
|
|
610
593
|
interface ThemeOverrides {
|
|
611
594
|
accent?: string;
|
|
@@ -697,8 +680,6 @@ interface PresentationOptions {
|
|
|
697
680
|
iframe?: boolean;
|
|
698
681
|
size?: SizeOptions;
|
|
699
682
|
}
|
|
700
|
-
//#endregion
|
|
701
|
-
//#region src/core/config/types/sections.d.ts
|
|
702
683
|
/**
|
|
703
684
|
* Section: conversation runtime behaviour — auto-open, streaming mode, and the
|
|
704
685
|
* transcript surface (what renders, how it scrolls, reaction controls).
|
|
@@ -844,8 +825,6 @@ interface Endpoints {
|
|
|
844
825
|
*/
|
|
845
826
|
submitForm?: string;
|
|
846
827
|
}
|
|
847
|
-
//#endregion
|
|
848
|
-
//#region src/core/config/types/tracking.d.ts
|
|
849
828
|
/**
|
|
850
829
|
* Built-in anonymous usage tracking — utm.gif-style pixel hits that give
|
|
851
830
|
* the widget OWNER (the site embedding it) insights about how visitors
|
|
@@ -897,8 +876,6 @@ interface ResolvedTracking {
|
|
|
897
876
|
sampleRate: number;
|
|
898
877
|
token?: string;
|
|
899
878
|
}
|
|
900
|
-
//#endregion
|
|
901
|
-
//#region src/core/config/types/widget.d.ts
|
|
902
879
|
/**
|
|
903
880
|
* Raw options passed to {@link mount}, {@link init}, the Web Component, or
|
|
904
881
|
* the `<script data-*>` auto-boot path. The public `mount()` / `init()`
|
|
@@ -1109,11 +1086,7 @@ interface ResolvedOptions {
|
|
|
1109
1086
|
onClose?: ChatWidgetOptions['onClose'];
|
|
1110
1087
|
onError?: ChatWidgetOptions['onError'];
|
|
1111
1088
|
}
|
|
1112
|
-
//#endregion
|
|
1113
|
-
//#region src/ui/host-mode.d.ts
|
|
1114
1089
|
type HostMode = 'page' | 'standalone' | 'inline' | 'modal' | 'drawer' | 'fullscreen' | 'expanded' | 'open' | 'closed';
|
|
1115
|
-
//#endregion
|
|
1116
|
-
//#region src/schema/primitives.d.ts
|
|
1117
1090
|
/** A single image asset (logo, hero, icon). */
|
|
1118
1091
|
declare const assetSchema: z.ZodObject<{
|
|
1119
1092
|
url: z.ZodString;
|
|
@@ -1129,8 +1102,6 @@ declare const linkSchema: z.ZodObject<{
|
|
|
1129
1102
|
description: z.ZodOptional<z.ZodString>;
|
|
1130
1103
|
}, z.core.$loose>;
|
|
1131
1104
|
type Link = z.infer<typeof linkSchema>;
|
|
1132
|
-
//#endregion
|
|
1133
|
-
//#region src/schema/widget.d.ts
|
|
1134
1105
|
/**
|
|
1135
1106
|
* Where the widget talks to and how it authenticates. Owned by the
|
|
1136
1107
|
* **embedding developer** — typically baked into the page template or
|
|
@@ -2484,8 +2455,6 @@ declare const connectionConfigPartialSchema: z.ZodObject<{
|
|
|
2484
2455
|
}>]>>>;
|
|
2485
2456
|
}, z.core.$loose>;
|
|
2486
2457
|
type ConnectionConfigPartial = z.infer<typeof connectionConfigPartialSchema>;
|
|
2487
|
-
//#endregion
|
|
2488
|
-
//#region src/schema/deployment.d.ts
|
|
2489
2458
|
/**
|
|
2490
2459
|
* Server-pushable widget settings. Same surface as the editable
|
|
2491
2460
|
* {@link widgetSettingsSchema} but every field is optional (the server
|
|
@@ -3064,12 +3033,8 @@ declare const handshakeResponseSchema: z.ZodObject<{
|
|
|
3064
3033
|
}, z.core.$strict>>;
|
|
3065
3034
|
}, z.core.$loose>;
|
|
3066
3035
|
type HandshakeResponse = z.infer<typeof handshakeResponseSchema>;
|
|
3067
|
-
//#endregion
|
|
3068
|
-
//#region src/stream/types.d.ts
|
|
3069
3036
|
/** A 👍/👎 reaction on a rateable (assistant/operator) message; `null` clears a prior choice. */
|
|
3070
3037
|
type FeedbackValue = 'up' | 'down' | null;
|
|
3071
|
-
//#endregion
|
|
3072
|
-
//#region src/core/events.d.ts
|
|
3073
3038
|
/**
|
|
3074
3039
|
* Payload shape per event. Keyed by event name; use `void` for events that
|
|
3075
3040
|
* carry no data.
|
|
@@ -3211,8 +3176,6 @@ interface EventMap {
|
|
|
3211
3176
|
};
|
|
3212
3177
|
}
|
|
3213
3178
|
type EventName = keyof EventMap;
|
|
3214
|
-
//#endregion
|
|
3215
|
-
//#region src/boot.d.ts
|
|
3216
3179
|
/**
|
|
3217
3180
|
* Determine what `data-mode` the host should start at — matching what App's
|
|
3218
3181
|
* mount-time `useEffect` will produce on its first render. Used for the initial
|
|
@@ -3225,8 +3188,6 @@ type EventName = keyof EventMap;
|
|
|
3225
3188
|
* first effect (the closed→open→closed flicker this pins against).
|
|
3226
3189
|
*/
|
|
3227
3190
|
export declare function resolveInitialHostMode(options: ResolvedOptions): HostMode;
|
|
3228
|
-
//#endregion
|
|
3229
|
-
//#region src/core/hooks.d.ts
|
|
3230
3191
|
/** Wildcard that matches every widget id / every event name. */
|
|
3231
3192
|
export declare const HOOK_WILDCARD = "*";
|
|
3232
3193
|
/**
|
|
@@ -3243,8 +3204,23 @@ export declare const HOOK_WILDCARD = "*";
|
|
|
3243
3204
|
* ```
|
|
3244
3205
|
*/
|
|
3245
3206
|
type HookListener = (instance: ChatWidgetInstance, event: EventName, data: unknown) => void;
|
|
3246
|
-
|
|
3247
|
-
|
|
3207
|
+
/**
|
|
3208
|
+
* Host-element command bus.
|
|
3209
|
+
*
|
|
3210
|
+
* The programmatic API (`chat.open()`, `.close()`, `.expand()`)
|
|
3211
|
+
* dispatches `CustomEvent`s on the shadow host element. The App listens
|
|
3212
|
+
* for those same events and routes them to its state handlers. That
|
|
3213
|
+
* keeps the two modules decoupled — `index.ts` doesn't hold a ref to App
|
|
3214
|
+
* state, App doesn't know about the public instance handle.
|
|
3215
|
+
*
|
|
3216
|
+
* This module is the single source of truth for the event names + the
|
|
3217
|
+
* tiny helpers on both sides of the bridge.
|
|
3218
|
+
*/
|
|
3219
|
+
/** Where `open()` lands: a tab, and in Help or News optionally one article or post (its content id). */
|
|
3220
|
+
interface OpenTarget {
|
|
3221
|
+
to: 'home' | 'chats' | 'help' | 'news';
|
|
3222
|
+
id?: string;
|
|
3223
|
+
}
|
|
3248
3224
|
/**
|
|
3249
3225
|
* Comprehensive logger for the widget runtime.
|
|
3250
3226
|
*
|
|
@@ -3277,8 +3253,6 @@ interface LogEntry {
|
|
|
3277
3253
|
message: string;
|
|
3278
3254
|
payload?: unknown;
|
|
3279
3255
|
}
|
|
3280
|
-
//#endregion
|
|
3281
|
-
//#region src/index.d.ts
|
|
3282
3256
|
/**
|
|
3283
3257
|
* Handle returned by {@link mount} / {@link init}. All methods are safe to call
|
|
3284
3258
|
* after `destroy()` — they become no-ops rather than throwing.
|
|
@@ -3286,8 +3260,18 @@ interface LogEntry {
|
|
|
3286
3260
|
export interface ChatWidgetInstance {
|
|
3287
3261
|
/** Stable identifier — matches `options.widgetId ?? "default"`. */
|
|
3288
3262
|
readonly widgetId: string;
|
|
3289
|
-
/**
|
|
3290
|
-
|
|
3263
|
+
/**
|
|
3264
|
+
* Open the floating panel (no-op in `inline` / `standalone` mode). With a target it also shows that tab at its
|
|
3265
|
+
* root, or one Help article / News post in it by content id — for a site's own "Help" or "What's new" button. A
|
|
3266
|
+
* tab the widget doesn't have just opens the panel.
|
|
3267
|
+
*
|
|
3268
|
+
* @example
|
|
3269
|
+
* ```ts
|
|
3270
|
+
* chat.open({ to: 'news' });
|
|
3271
|
+
* chat.open({ to: 'help', id: '019a0b6c-7e2a-7000-9d3e-4a5b6c7d8e01' });
|
|
3272
|
+
* ```
|
|
3273
|
+
*/
|
|
3274
|
+
open: (target?: OpenTarget) => void;
|
|
3291
3275
|
/** Close the floating panel (no-op in `inline` / `standalone` mode). */
|
|
3292
3276
|
close: () => void;
|
|
3293
3277
|
/** Unmount the widget and release all subscriptions. */
|
|
@@ -3443,6 +3427,4 @@ export declare const brand: {
|
|
|
3443
3427
|
readonly domain: string;
|
|
3444
3428
|
readonly siteUrl: string;
|
|
3445
3429
|
};
|
|
3446
|
-
|
|
3447
|
-
export type { Asset, BlocksConfig, ChatWidgetOptions, ConnectionConfig, ConnectionConfigPartial, EventMap, EventName, HandshakeResponse, HookListener, Link, LogEntry, LogLevel, ResolvedOptions, ServerConfig, SiteConfig, WidgetConfig, WidgetConfigPartial, WidgetSettings, WidgetSettingsPartial };
|
|
3448
|
-
//# sourceMappingURL=index.d.ts.map
|
|
3430
|
+
export type { Asset, BlocksConfig, ChatWidgetOptions, ConnectionConfig, ConnectionConfigPartial, EventMap, EventName, HandshakeResponse, HookListener, Link, LogEntry, LogLevel, OpenTarget, ResolvedOptions, ServerConfig, SiteConfig, WidgetConfig, WidgetConfigPartial, WidgetSettings, WidgetSettingsPartial };
|