@helpai/elements 0.14.0 → 0.14.2

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/README.md CHANGED
@@ -85,7 +85,7 @@ re-resolves at runtime.
85
85
  | `index.mjs` / `web-component.mjs` | ESM | Bundlers (Vite, webpack, esbuild) — bare imports kept |
86
86
  | `elements.cjs.js` | CJS | `require()` from Node / legacy tooling |
87
87
  | `style.css` | CSS | `<link rel="stylesheet">` |
88
- | `schema.json` | JSON Schema | Dashboard config UIs, backend start-session validation, 3rd-party tooling |
88
+ | `schema.json` | JSON Schema | Dashboard config UIs, backend start-conversation validation, 3rd-party tooling |
89
89
  | `schema.mjs` | ESM | Zod runtime schemas: `import { widgetConfigSchema } from "@helpai/elements/schema"` |
90
90
 
91
91
  Every bundle exposes the same surface (`mount`, `init`, `hook`, types).
@@ -323,9 +323,9 @@ attribute. See [https://help.ai/docs/elements/modes](https://help.ai/docs/elemen
323
323
  ## Configuration
324
324
 
325
325
  The element reads its per-deployment configuration from your
326
- Help AI workspace at start-session time — colors, launcher
326
+ Help AI workspace at start-conversation time — colors, launcher
327
327
  chrome, strings, action layout, model defaults, history visibility
328
- all flow through `StartSessionResponse.settings`. You don't recompile
328
+ all flow through `StartConversationResponse.settings`. You don't recompile
329
329
  per-customer.
330
330
 
331
331
  A handful of options live in the install snippet itself:
package/configurator.mjs CHANGED
@@ -17,7 +17,7 @@ var linkSchema = z.object({
17
17
  var cssLengthSchema = z.string().min(1).max(120).describe("Any CSS length \u2014 `640px`, `80vh`, `calc(100vh - 64px)`, etc. Validated only for size, not syntax.");
18
18
  var cssColorSchema = z.string().min(1).max(120).describe("Any CSS colour \u2014 hex, `rgb()`, `hsl()`, `oklch()`, a named colour, or a `var(--token)`.");
19
19
  var localeSchema = z.string().min(1).max(35).describe("BCP-47 locale tag (e.g. `en`, `fr-CA`, `zh-Hant-HK`).");
20
- var uuid7Schema = z.uuidv7().describe("UUID v7 (RFC 9562) \u2014 the single id format for visitor / session / message / file / content ids.");
20
+ var uuid7Schema = z.uuidv7().describe("UUID v7 (RFC 9562) \u2014 the single id format for visitor / conversation / message / file / content ids.");
21
21
 
22
22
  // src/schema/widget.ts
23
23
  import { z as z16 } from "zod";
@@ -132,7 +132,7 @@ var behaviorSchema = z4.object({
132
132
  "Show tool/function calls the model makes (e.g. search) as inline chips in the transcript. `false` (default) hides them."
133
133
  ),
134
134
  popOutUrl: z4.string().min(1).max(2048).optional().describe(
135
- "URL the `popOut` action opens in a new tab (carries `?chat=<id>&widgetId=<id>` query params). Falls back to the brand's build-time default. Set this to point at your own dedicated chat page (e.g. `https://app.acme.com/chat`). Server-pushable on `/start-session.widget.behavior.popOutUrl`."
135
+ "URL the `popOut` action opens in a new tab (carries `?chat=<id>&widgetId=<id>` query params). Falls back to the brand's build-time default. Set this to point at your own dedicated chat page (e.g. `https://app.acme.com/chat`). Server-pushable on `/start-conversation.widget.behavior.popOutUrl`."
136
136
  )
137
137
  }).loose().describe("Lifecycle + streaming behaviour. Doesn't affect visual presentation.").meta({
138
138
  examples: [
@@ -439,23 +439,21 @@ var formDefSchema = z13.object({
439
439
  title: z13.string().max(120).optional(),
440
440
  description: z13.string().max(500).optional(),
441
441
  submitLabel: z13.string().max(60).optional(),
442
- skippable: z13.boolean().default(false).describe("Show a Skip control."),
443
- blocking: z13.boolean().default(false).describe("Gate the composer (honored only for `pre-chat` / `after-messages`); otherwise renders inline."),
444
- frequency: z13.enum(["once", "session", "always"]).default("once").describe("`once` (persisted per-device), `session`, or `always`."),
442
+ skippable: z13.boolean().default(false).describe("Show a Skip control so the visitor can dismiss the form."),
443
+ frequency: z13.enum(["once", "conversation", "always"]).default("once").describe("`once` (per device, persisted), `conversation` (re-eligible each new conversation), or `always`."),
445
444
  mirrorToContext: z13.boolean().default(true).describe(
446
445
  "Mirror the answers into `userContext` so they ride every request. Set `false` for PII (DOB, policy #, symptoms) \u2014 those then go only to the submit endpoint."
447
446
  )
448
447
  }).loose();
449
448
  var formsSchema = z13.array(formDefSchema).max(20).describe(
450
- "Event-driven forms \u2014 an ordered list (order = priority). Each binds to trigger event(s), shows blocking or inline, dedupes by frequency, and records via `endpoints.forms`. Generic across verticals."
449
+ "Event-driven forms \u2014 an ordered list (order = priority). Each binds to trigger event(s), gates the chat until submit/skip, dedupes by frequency, and records via `endpoints.submitForm`. Generic across verticals."
451
450
  ).meta({
452
451
  examples: [
453
- [{ id: "intake", on: "pre-chat", blocking: true, fields: [{ name: "email", label: "Email", type: "email" }] }],
452
+ [{ id: "intake", on: "pre-chat", fields: [{ name: "email", label: "Email", type: "email" }] }],
454
453
  [
455
454
  {
456
455
  id: "lead",
457
456
  on: "pre-chat",
458
- blocking: true,
459
457
  title: "Before we start",
460
458
  fields: [
461
459
  { name: "name", label: "Your name", type: "text" },
@@ -581,7 +579,7 @@ var endpointsSchema = z16.object({
581
579
  upload: z16.string().min(1).max(2048).default("/ai/agent/upload-file"),
582
580
  transcribe: z16.string().min(1).max(2048).default("/ai/agent/transcribe-audio"),
583
581
  submitForm: z16.string().min(1).max(2048).default("/ai/agent/submit-form").describe(
584
- "Form submission endpoint. The widget POSTs each completed form's values here (fire-and-forget), keyed by the same visitorId + sessionId as the conversation; the payload carries `formId` + `trigger` so the backend can route. Optional \u2014 a 404 is ignored."
582
+ "Form submission endpoint. The widget POSTs each completed form's values here (fire-and-forget), keyed by the same visitorId + conversationId as the conversation; the payload carries `formId` + `trigger` so the backend can route. Optional \u2014 a 404 is ignored."
585
583
  )
586
584
  }).loose().describe("HTTP endpoint overrides. Paths are appended to baseUrl; absolute URLs are accepted too.").meta({
587
585
  examples: [
@@ -672,7 +670,7 @@ var widgetSettingsSchema = z16.object({
672
670
  forms: formsSchema.optional(),
673
671
  modules: modulesSchema.optional()
674
672
  }).loose().describe(
675
- "Portal-configurable widget settings \u2014 thirteen sections, one per dashboard tab. The backend pushes this same shape on `/ai/agent/start-session` under `config`."
673
+ "Portal-configurable widget settings \u2014 thirteen sections, one per dashboard tab. The backend pushes this same shape on `/ai/agent/start-conversation` under `config`."
676
674
  ).meta({
677
675
  examples: [
678
676
  { presentation: { mode: "floating", position: "bottom-right" }, theme: "auto" },
@@ -690,8 +688,10 @@ var widgetSettingsSchema = z16.object({
690
688
  });
691
689
  var widgetConfigSchema = connectionConfigSchema.extend({
692
690
  ...widgetSettingsSchema.shape,
693
- site: z16.unknown().optional().describe('Site config \u2014 applies in `mode: "page"`. Comes from the start-session response, not user-edited.'),
694
- blocks: z16.unknown().optional().describe('Blocks (nav + link cards) \u2014 applies in `mode: "page"`. Comes from the start-session response.')
691
+ site: z16.unknown().optional().describe(
692
+ 'Site config \u2014 applies in `mode: "page"`. Comes from the start-conversation response, not user-edited.'
693
+ ),
694
+ blocks: z16.unknown().optional().describe('Blocks (nav + link cards) \u2014 applies in `mode: "page"`. Comes from the start-conversation response.')
695
695
  }).describe(
696
696
  "Full client widget config \u2014 connection (where + auth) + widget settings (look + behaviour) + page-mode extras. This is what the runtime parses on `mount()` / `init()`. Mode-specific constraints (e.g. `position` only meaningful in `floating`) are NOT enforced here \u2014 the runtime silently ignores irrelevant fields rather than rejecting them so the same object can flow across mode changes."
697
697
  ).meta({
@@ -738,7 +738,7 @@ var handshakeWelcomeSuggestionSchema = z17.object({
738
738
  text: z17.string().optional()
739
739
  }).loose();
740
740
  var rebindReasonSchema = z17.enum(["conflict", "expired", "invalid"]);
741
- var startSessionResponseSchema = z17.object({
741
+ var startConversationResponseSchema = z17.object({
742
742
  deployment: z17.object({
743
743
  id: z17.string(),
744
744
  name: z17.string(),
@@ -771,7 +771,7 @@ var startSessionResponseSchema = z17.object({
771
771
  suggestions: z17.array(handshakeWelcomeSuggestionSchema).optional()
772
772
  }).loose().optional(),
773
773
  visitorId: z17.string(),
774
- sessionId: z17.string(),
774
+ conversationId: z17.string(),
775
775
  canContinue: z17.boolean(),
776
776
  messages: z17.array(z17.unknown()),
777
777
  /**
@@ -782,11 +782,11 @@ var startSessionResponseSchema = z17.object({
782
782
  */
783
783
  userPrefs: z17.record(z17.string(), z17.unknown()).optional(),
784
784
  // Present only when the server rotated the request `visitorId` /
785
- // `sessionId`. Purely advisory — client must adopt the response ids
785
+ // `conversationId`. Purely advisory — client must adopt the response ids
786
786
  // verbatim regardless of whether this block is present.
787
787
  rebind: z17.object({
788
788
  visitorId: rebindReasonSchema.optional(),
789
- sessionId: rebindReasonSchema.optional()
789
+ conversationId: rebindReasonSchema.optional()
790
790
  }).loose().optional()
791
791
  }).loose();
792
792