@helpai/elements 0.15.0 → 0.17.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/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-P3CoZ-BV.js';
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-BvNoqfIC.js';
2
2
  import 'zod';
3
3
 
4
4
  /**
@@ -40,7 +40,7 @@ interface ClientStorage {
40
40
  * populated {@link Strings} map. UI components then read `strings.send` as a
41
41
  * normal property access — no per-render lookup, no per-render allocation.
42
42
  */
43
- type StringKey = "launcherOpen" | "panelTitle" | "composerPlaceholder" | "send" | "stop" | "attach" | "micStart" | "micStop" | "micUnsupported" | "expand" | "collapse" | "fullscreen" | "exitFullscreen" | "resizeHandle" | "scrollToBottom" | "popOut" | "close" | "moreActions" | "soundOn" | "soundOff" | "language" | "theme" | "themeAuto" | "themeLight" | "themeDark" | "history" | "historyTitle" | "historyEmpty" | "historyLoading" | "historyBack" | "conversationLoading" | "conversationClosed" | "startNewConversation" | "dateToday" | "dateYesterday" | "dateLastWeek" | "dateOlder" | "newConversation" | "dropZone" | "attachmentTooLarge" | "attachmentTooMany" | "attachmentMimeRejected" | "errorRetry" | "errorGeneric" | "errorRateLimited" | "loading" | "thinking" | "thoughts" | "usedTool" | "collapseSidebar" | "expandSidebar" | "formSubmit" | "formSkip" | "formRequired" | "formInvalidEmail" | "formInvalidTel" | "formInvalidUrl" | "formInvalidNumber" | "formTooShort" | "formTooLong" | "formNumberTooSmall" | "formNumberTooLarge" | "formPatternMismatch" | "formChooseAtLeast" | "formChooseAtMost" | "formOther" | "formOtherPlaceholder" | "inputRequired" | "inputSubmit" | "inputSkip" | "inputSubmitted" | "approvalRequired" | "approve" | "reject" | "approved" | "rejected" | "approvalReason" | "stepNoLongerActive" | "tabHome" | "tabConversations" | "tabHelp" | "tabNews" | "modulesEmpty" | "moduleBack" | "contentLoading" | "homeGreeting" | "homeGreetingNamed" | "homeGreetingLead" | "homeSearchPlaceholder" | "homeContentTitle" | "helpTitle" | "helpSearchPlaceholder" | "helpEmpty" | "helpLoading" | "helpSearchEmpty" | "newsTitle" | "newsEmpty" | "newsLoading" | "newsBack" | "newsPublishedAt";
43
+ type StringKey = "launcherOpen" | "panelTitle" | "composerPlaceholder" | "send" | "stop" | "attach" | "micStart" | "micStop" | "micUnsupported" | "expand" | "collapse" | "fullscreen" | "exitFullscreen" | "resizeHandle" | "scrollToBottom" | "popOut" | "close" | "moreActions" | "soundOn" | "soundOff" | "language" | "theme" | "themeAuto" | "themeLight" | "themeDark" | "textSize" | "textSizeSmall" | "textSizeNormal" | "textSizeLarge" | "history" | "historyTitle" | "historyEmpty" | "historyLoading" | "historyBack" | "conversationLoading" | "conversationClosed" | "startNewConversation" | "dateToday" | "dateYesterday" | "dateLastWeek" | "dateOlder" | "newConversation" | "dropZone" | "attachmentTooLarge" | "attachmentTooMany" | "attachmentMimeRejected" | "errorRetry" | "errorGeneric" | "errorRateLimited" | "loading" | "thinking" | "thoughts" | "usedTool" | "collapseSidebar" | "expandSidebar" | "formSubmit" | "formSkip" | "formSubmitted" | "formSkipped" | "formRequired" | "formInvalidEmail" | "formInvalidTel" | "formInvalidUrl" | "formInvalidNumber" | "formTooShort" | "formTooLong" | "formNumberTooSmall" | "formNumberTooLarge" | "formPatternMismatch" | "formChooseAtLeast" | "formChooseAtMost" | "formOther" | "formOtherPlaceholder" | "inputRequired" | "inputSubmit" | "inputSkip" | "inputSubmitted" | "approvalRequired" | "approve" | "reject" | "approved" | "rejected" | "approvalReason" | "stepNoLongerActive" | "tabHome" | "tabConversations" | "tabHelp" | "tabNews" | "modulesEmpty" | "moduleBack" | "contentLoading" | "homeGreeting" | "homeGreetingNamed" | "homeGreetingLead" | "homeSearchPlaceholder" | "homeContentTitle" | "helpTitle" | "helpSearchPlaceholder" | "helpEmpty" | "helpLoading" | "helpSearchEmpty" | "newsTitle" | "newsEmpty" | "newsLoading" | "newsBack" | "newsPublishedAt";
44
44
  /** A partial map for one locale — what overrides look like on the wire. */
45
45
  type LocaleStrings = Partial<Record<StringKey, string>>;
46
46
  /**
@@ -109,6 +109,8 @@ interface UserPrefs {
109
109
  soundMuted?: boolean;
110
110
  /** Theme picked from the theme switcher. */
111
111
  themeMode?: "auto" | "light" | "dark";
112
+ /** Text size picked from the text-size switcher. */
113
+ textSize?: "small" | "normal" | "large";
112
114
  }
113
115
 
114
116
  /**
@@ -139,11 +141,13 @@ interface WireMessage {
139
141
  role: "user" | "assistant" | "system";
140
142
  parts: WirePart[];
141
143
  /**
142
- * Epoch milliseconds the message was created. Optional so older backends
143
- * still parse; when present, the widget shows the real send time (and groups
144
- * messages by day) on reload instead of falling back to "now".
144
+ * ISO-8601 timestamp the message was created (a serialized Mongo ISODate,
145
+ * e.g. `2026-06-10T07:50:55.816Z`) every wire date uses this format.
146
+ * Optional so older backends still parse; when present, the widget shows
147
+ * the real send time (and groups messages by day) on reload instead of
148
+ * falling back to "now". Parse with {@link parseWireDate}.
145
149
  */
146
- createdAt?: number;
150
+ createdAt?: string;
147
151
  }
148
152
  type WirePart = {
149
153
  type: "text";
@@ -176,6 +180,21 @@ type WirePart = {
176
180
  errorText?: string;
177
181
  approval?: ToolApproval;
178
182
  };
183
+ /**
184
+ * One recorded form submission, returned on `/ai/agent/start-conversation`
185
+ * (alongside `messages`) so the widget can re-place the collapsed
186
+ * "form submitted" marker at its chronological spot in the timeline.
187
+ * Values are NOT echoed back — the marker is pure indication.
188
+ */
189
+ interface FormSubmissionRecord {
190
+ formId: string;
191
+ /** The trigger kind that surfaced the form. */
192
+ trigger: string;
193
+ /** True when the visitor skipped instead of answering. */
194
+ skipped?: boolean;
195
+ /** ISO-8601 — same format + name as {@link WireMessage.createdAt}. */
196
+ createdAt?: string;
197
+ }
179
198
  /** One-shot bot persona shown in the panel header. */
180
199
  interface ConversationAgent {
181
200
  name: string;
@@ -237,6 +256,13 @@ interface StartConversationResponse {
237
256
  /** Page-mode sidebar blocks (navigation, link cards). Backend ships it whenever the deployment renders the page-shell sidebar. */
238
257
  blocks?: Record<string, unknown>;
239
258
  messages?: WireMessage[];
259
+ /**
260
+ * Form submissions recorded for this conversation (via
261
+ * `/ai/agent/submit-form`), returned like `messages` so the widget can
262
+ * reconstruct the timeline on resume — each renders as a collapsed
263
+ * "form submitted" marker at its chronological position.
264
+ */
265
+ formSubmissions?: FormSubmissionRecord[];
240
266
  /**
241
267
  * Server's authoritative copy of the visitor's preferences. When present,
242
268
  * client adopts it (overrides local cache) and re-applies it to the UI
@@ -291,6 +317,8 @@ type Position = "bottom-right" | "bottom-left" | "top-right" | "top-left";
291
317
  * Page mode reads `site` and `blocks` from the start-conversation response.
292
318
  */
293
319
  type Mode = "floating" | "inline" | "standalone" | "page" | "modal" | "drawer";
320
+ /** End-user text-size preference — scales the whole type ramp. */
321
+ type TextSize = "small" | "normal" | "large";
294
322
  /** Theme preference. `auto` follows `prefers-color-scheme`. */
295
323
  type ThemePreference = "auto" | "light" | "dark";
296
324
  /**
@@ -331,9 +359,10 @@ interface WelcomeOptions {
331
359
  * - `sound` — Toggle notification sounds + haptics on/off (switch-style).
332
360
  * - `language` — Switch the UI locale at runtime.
333
361
  * - `theme` — Cycle `auto` / `light` / `dark`.
362
+ * - `textSize` — Cycle `normal` / `large` / `small`.
334
363
  * - `close` — Close the floating panel.
335
364
  */
336
- type ActionName = "clear" | "expand" | "fullscreen" | "popOut" | "sound" | "history" | "language" | "theme" | "close";
365
+ type ActionName = "clear" | "expand" | "fullscreen" | "popOut" | "sound" | "history" | "language" | "theme" | "textSize" | "close";
337
366
  /**
338
367
  * The header's enabled actions. Unlisted actions are hidden; order is
339
368
  * irrelevant. Per-mode defaults (`DEFAULT_ACTIONS_BY_MODE`) pick a sensible
@@ -1062,6 +1091,8 @@ interface ResolvedOptions {
1062
1091
  pageContext?: PageContext;
1063
1092
  position: Position;
1064
1093
  themeMode: ThemePreference;
1094
+ /** Active text size. Default `normal`; the end-user's pick overrides at runtime. */
1095
+ textSize: TextSize;
1065
1096
  themeOverrides: ThemeOverrides;
1066
1097
  mode: Mode;
1067
1098
  iframe: boolean;
@@ -1295,6 +1326,8 @@ interface EventMap {
1295
1326
  localeChange: string;
1296
1327
  /** End-user picked a different theme mode (`auto` / `light` / `dark`). */
1297
1328
  themeChange: ThemePreference;
1329
+ /** End-user picked a different text size (`small` / `normal` / `large`). */
1330
+ textSizeChange: TextSize;
1298
1331
  /** End-user toggled the global sound mute. */
1299
1332
  soundToggle: {
1300
1333
  muted: boolean;