@helpai/elements 0.33.0 → 0.35.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
@@ -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" | "textSize" | "textSizeSmall" | "textSizeNormal" | "textSizeLarge" | "history" | "historyTitle" | "historyEmpty" | "historyLoading" | "historyBack" | "historyContinue" | "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" | "formFillOut" | "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" | "historyContinue" | "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" | "formFillOut" | "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" | "homeStatus" | "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
  /**
package/index.mjs CHANGED
@@ -101,6 +101,7 @@ var STRINGS_EN = {
101
101
  homeGreetingLead: "How can we help?",
102
102
  homeSearchPlaceholder: "Search for help",
103
103
  homeContentTitle: "Popular articles",
104
+ homeStatus: "Status",
104
105
  helpTitle: "Help",
105
106
  helpSearchPlaceholder: "Search for help",
106
107
  helpEmpty: "No help articles yet",
@@ -213,6 +214,7 @@ var STRINGS_FR = {
213
214
  homeGreetingLead: "Comment pouvons-nous vous aider ?",
214
215
  homeSearchPlaceholder: "Rechercher de l'aide",
215
216
  homeContentTitle: "Articles populaires",
217
+ homeStatus: "Statut",
216
218
  helpTitle: "Aide",
217
219
  helpSearchPlaceholder: "Rechercher de l'aide",
218
220
  helpEmpty: "Aucun article d'aide pour le moment",
@@ -3455,13 +3457,15 @@ function initials(name) {
3455
3457
  // src/ui/agent-badge.tsx
3456
3458
  import { jsx as jsx4, jsxs as jsxs3 } from "preact/jsx-runtime";
3457
3459
  var p5 = BRAND.cssPrefix;
3458
- function AgentBadge({ agent }) {
3460
+ function AgentBadge({ agent, strings }) {
3459
3461
  const status = agent.status ?? "online";
3462
+ const name = localizeText(strings, agent.name);
3463
+ const title = agent.title ? localizeText(strings, agent.title) : null;
3460
3464
  return /* @__PURE__ */ jsxs3("div", { class: `${p5}-agent`, children: [
3461
- /* @__PURE__ */ jsx4("div", { class: `${p5}-agent-avatar`, "data-status": status, children: agent.avatar ? /* @__PURE__ */ jsx4("img", { src: agent.avatar, alt: "" }) : /* @__PURE__ */ jsx4("span", { children: initials(agent.name) }) }),
3465
+ /* @__PURE__ */ jsx4("div", { class: `${p5}-agent-avatar`, "data-status": status, children: agent.avatar ? /* @__PURE__ */ jsx4("img", { src: agent.avatar, alt: "" }) : /* @__PURE__ */ jsx4("span", { children: initials(name) }) }),
3462
3466
  /* @__PURE__ */ jsxs3("div", { class: `${p5}-agent-meta`, children: [
3463
- /* @__PURE__ */ jsx4("strong", { children: agent.name }),
3464
- agent.title ? /* @__PURE__ */ jsx4("span", { children: agent.title }) : null
3467
+ /* @__PURE__ */ jsx4("strong", { children: name }),
3468
+ title ? /* @__PURE__ */ jsx4("span", { children: title }) : null
3465
3469
  ] })
3466
3470
  ] });
3467
3471
  }
@@ -5698,7 +5702,7 @@ function PanelContent(props2) {
5698
5702
  children: /* @__PURE__ */ jsx20(BackIcon, {})
5699
5703
  }
5700
5704
  ) : null,
5701
- agent ? /* @__PURE__ */ jsx20(AgentBadge, { agent }) : /* @__PURE__ */ jsx20("h1", { children: s.panelTitle }),
5705
+ agent ? /* @__PURE__ */ jsx20(AgentBadge, { agent, strings: s }) : /* @__PURE__ */ jsx20("h1", { children: s.panelTitle }),
5702
5706
  /* @__PURE__ */ jsx20(HeaderActions, { panelProps: props2, variant: "chat" })
5703
5707
  ] }),
5704
5708
  view === "history" ? /* @__PURE__ */ jsx20(
@@ -6237,7 +6241,7 @@ var p25 = BRAND.cssPrefix;
6237
6241
  var log14 = logger.scope("home");
6238
6242
  function resolveGreeting(props2) {
6239
6243
  const name = props2.options.userContext?.name;
6240
- const fromConfig = props2.config.greetingText;
6244
+ const fromConfig = props2.config.greetingText ? localizeText(props2.strings, props2.config.greetingText) : void 0;
6241
6245
  if (fromConfig) {
6242
6246
  const title = name ? fromConfig.replace("{name}", name) : fromConfig.replace(/\s*\{name\}\s*/, " ").trim();
6243
6247
  return { title, subtitle: props2.strings.homeGreetingLead };
@@ -6303,10 +6307,10 @@ function HomeRoot(props2) {
6303
6307
  status ? /* @__PURE__ */ jsx29(
6304
6308
  HomeCard,
6305
6309
  {
6306
- onClick: status.url ? () => nav.push({ kind: "iframe", url: status.url, title: status.text }) : void 0,
6310
+ onClick: status.url ? () => nav.push({ kind: "iframe", url: status.url, title: localizeText(strings, status.text) }) : void 0,
6307
6311
  children: /* @__PURE__ */ jsxs24("div", { class: `${p25}-home-status`, "data-level": status.level ?? "operational", children: [
6308
6312
  /* @__PURE__ */ jsx29("span", { class: `${p25}-home-status-icon`, "aria-hidden": "true", children: /* @__PURE__ */ jsx29(StatusOkIcon, {}) }),
6309
- /* @__PURE__ */ jsx29("span", { class: `${p25}-home-status-text`, children: status.text })
6313
+ /* @__PURE__ */ jsx29("span", { class: `${p25}-home-status-text`, children: localizeText(strings, status.text) })
6310
6314
  ] })
6311
6315
  }
6312
6316
  ) : null,
package/package.json CHANGED
@@ -80,5 +80,5 @@
80
80
  ],
81
81
  "type": "module",
82
82
  "types": "./index.d.ts",
83
- "version": "0.33.0"
83
+ "version": "0.35.0"
84
84
  }
package/web-component.mjs CHANGED
@@ -101,6 +101,7 @@ var STRINGS_EN = {
101
101
  homeGreetingLead: "How can we help?",
102
102
  homeSearchPlaceholder: "Search for help",
103
103
  homeContentTitle: "Popular articles",
104
+ homeStatus: "Status",
104
105
  helpTitle: "Help",
105
106
  helpSearchPlaceholder: "Search for help",
106
107
  helpEmpty: "No help articles yet",
@@ -213,6 +214,7 @@ var STRINGS_FR = {
213
214
  homeGreetingLead: "Comment pouvons-nous vous aider ?",
214
215
  homeSearchPlaceholder: "Rechercher de l'aide",
215
216
  homeContentTitle: "Articles populaires",
217
+ homeStatus: "Statut",
216
218
  helpTitle: "Aide",
217
219
  helpSearchPlaceholder: "Rechercher de l'aide",
218
220
  helpEmpty: "Aucun article d'aide pour le moment",
@@ -3414,13 +3416,15 @@ function initials(name) {
3414
3416
  // src/ui/agent-badge.tsx
3415
3417
  import { jsx as jsx4, jsxs as jsxs3 } from "preact/jsx-runtime";
3416
3418
  var p5 = BRAND.cssPrefix;
3417
- function AgentBadge({ agent }) {
3419
+ function AgentBadge({ agent, strings }) {
3418
3420
  const status = agent.status ?? "online";
3421
+ const name = localizeText(strings, agent.name);
3422
+ const title = agent.title ? localizeText(strings, agent.title) : null;
3419
3423
  return /* @__PURE__ */ jsxs3("div", { class: `${p5}-agent`, children: [
3420
- /* @__PURE__ */ jsx4("div", { class: `${p5}-agent-avatar`, "data-status": status, children: agent.avatar ? /* @__PURE__ */ jsx4("img", { src: agent.avatar, alt: "" }) : /* @__PURE__ */ jsx4("span", { children: initials(agent.name) }) }),
3424
+ /* @__PURE__ */ jsx4("div", { class: `${p5}-agent-avatar`, "data-status": status, children: agent.avatar ? /* @__PURE__ */ jsx4("img", { src: agent.avatar, alt: "" }) : /* @__PURE__ */ jsx4("span", { children: initials(name) }) }),
3421
3425
  /* @__PURE__ */ jsxs3("div", { class: `${p5}-agent-meta`, children: [
3422
- /* @__PURE__ */ jsx4("strong", { children: agent.name }),
3423
- agent.title ? /* @__PURE__ */ jsx4("span", { children: agent.title }) : null
3426
+ /* @__PURE__ */ jsx4("strong", { children: name }),
3427
+ title ? /* @__PURE__ */ jsx4("span", { children: title }) : null
3424
3428
  ] })
3425
3429
  ] });
3426
3430
  }
@@ -5657,7 +5661,7 @@ function PanelContent(props2) {
5657
5661
  children: /* @__PURE__ */ jsx20(BackIcon, {})
5658
5662
  }
5659
5663
  ) : null,
5660
- agent ? /* @__PURE__ */ jsx20(AgentBadge, { agent }) : /* @__PURE__ */ jsx20("h1", { children: s.panelTitle }),
5664
+ agent ? /* @__PURE__ */ jsx20(AgentBadge, { agent, strings: s }) : /* @__PURE__ */ jsx20("h1", { children: s.panelTitle }),
5661
5665
  /* @__PURE__ */ jsx20(HeaderActions, { panelProps: props2, variant: "chat" })
5662
5666
  ] }),
5663
5667
  view === "history" ? /* @__PURE__ */ jsx20(
@@ -6196,7 +6200,7 @@ var p25 = BRAND.cssPrefix;
6196
6200
  var log13 = logger.scope("home");
6197
6201
  function resolveGreeting(props2) {
6198
6202
  const name = props2.options.userContext?.name;
6199
- const fromConfig = props2.config.greetingText;
6203
+ const fromConfig = props2.config.greetingText ? localizeText(props2.strings, props2.config.greetingText) : void 0;
6200
6204
  if (fromConfig) {
6201
6205
  const title = name ? fromConfig.replace("{name}", name) : fromConfig.replace(/\s*\{name\}\s*/, " ").trim();
6202
6206
  return { title, subtitle: props2.strings.homeGreetingLead };
@@ -6262,10 +6266,10 @@ function HomeRoot(props2) {
6262
6266
  status ? /* @__PURE__ */ jsx29(
6263
6267
  HomeCard,
6264
6268
  {
6265
- onClick: status.url ? () => nav.push({ kind: "iframe", url: status.url, title: status.text }) : void 0,
6269
+ onClick: status.url ? () => nav.push({ kind: "iframe", url: status.url, title: localizeText(strings, status.text) }) : void 0,
6266
6270
  children: /* @__PURE__ */ jsxs24("div", { class: `${p25}-home-status`, "data-level": status.level ?? "operational", children: [
6267
6271
  /* @__PURE__ */ jsx29("span", { class: `${p25}-home-status-icon`, "aria-hidden": "true", children: /* @__PURE__ */ jsx29(StatusOkIcon, {}) }),
6268
- /* @__PURE__ */ jsx29("span", { class: `${p25}-home-status-text`, children: status.text })
6272
+ /* @__PURE__ */ jsx29("span", { class: `${p25}-home-status-text`, children: localizeText(strings, status.text) })
6269
6273
  ] })
6270
6274
  }
6271
6275
  ) : null,