@helpai/elements 0.14.1 → 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 +3 -3
- package/configurator.mjs +13 -11
- package/elements-web-component.esm.js +12 -12
- package/elements-web-component.esm.js.map +4 -4
- package/elements.cjs.js +12 -12
- package/elements.cjs.js.map +4 -4
- package/elements.esm.js +12 -12
- package/elements.esm.js.map +4 -4
- package/elements.js +12 -12
- package/elements.js.map +4 -4
- package/index.d.ts +38 -35
- package/index.mjs +220 -194
- package/package.json +1 -1
- package/schema.d.ts +53 -53
- package/schema.json +13 -13
- package/schema.mjs +15 -13
- package/style.css +1 -1
- package/web-component.d.ts +1 -1
- package/web-component.mjs +218 -192
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-
|
|
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-
|
|
326
|
+
Help AI workspace at start-conversation time — colors, launcher
|
|
327
327
|
chrome, strings, action layout, model defaults, history visibility
|
|
328
|
-
all flow through `
|
|
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 /
|
|
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-
|
|
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: [
|
|
@@ -440,7 +440,7 @@ var formDefSchema = z13.object({
|
|
|
440
440
|
description: z13.string().max(500).optional(),
|
|
441
441
|
submitLabel: z13.string().max(60).optional(),
|
|
442
442
|
skippable: z13.boolean().default(false).describe("Show a Skip control so the visitor can dismiss the form."),
|
|
443
|
-
frequency: z13.enum(["once", "
|
|
443
|
+
frequency: z13.enum(["once", "conversation", "always"]).default("once").describe("`once` (per device, persisted), `conversation` (re-eligible each new conversation), or `always`."),
|
|
444
444
|
mirrorToContext: z13.boolean().default(true).describe(
|
|
445
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."
|
|
446
446
|
)
|
|
@@ -579,7 +579,7 @@ var endpointsSchema = z16.object({
|
|
|
579
579
|
upload: z16.string().min(1).max(2048).default("/ai/agent/upload-file"),
|
|
580
580
|
transcribe: z16.string().min(1).max(2048).default("/ai/agent/transcribe-audio"),
|
|
581
581
|
submitForm: z16.string().min(1).max(2048).default("/ai/agent/submit-form").describe(
|
|
582
|
-
"Form submission endpoint. The widget POSTs each completed form's values here (fire-and-forget), keyed by the same visitorId +
|
|
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."
|
|
583
583
|
)
|
|
584
584
|
}).loose().describe("HTTP endpoint overrides. Paths are appended to baseUrl; absolute URLs are accepted too.").meta({
|
|
585
585
|
examples: [
|
|
@@ -670,7 +670,7 @@ var widgetSettingsSchema = z16.object({
|
|
|
670
670
|
forms: formsSchema.optional(),
|
|
671
671
|
modules: modulesSchema.optional()
|
|
672
672
|
}).loose().describe(
|
|
673
|
-
"Portal-configurable widget settings \u2014 thirteen sections, one per dashboard tab. The backend pushes this same shape on `/ai/agent/start-
|
|
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`."
|
|
674
674
|
).meta({
|
|
675
675
|
examples: [
|
|
676
676
|
{ presentation: { mode: "floating", position: "bottom-right" }, theme: "auto" },
|
|
@@ -688,8 +688,10 @@ var widgetSettingsSchema = z16.object({
|
|
|
688
688
|
});
|
|
689
689
|
var widgetConfigSchema = connectionConfigSchema.extend({
|
|
690
690
|
...widgetSettingsSchema.shape,
|
|
691
|
-
site: z16.unknown().optional().describe(
|
|
692
|
-
|
|
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.')
|
|
693
695
|
}).describe(
|
|
694
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."
|
|
695
697
|
).meta({
|
|
@@ -736,7 +738,7 @@ var handshakeWelcomeSuggestionSchema = z17.object({
|
|
|
736
738
|
text: z17.string().optional()
|
|
737
739
|
}).loose();
|
|
738
740
|
var rebindReasonSchema = z17.enum(["conflict", "expired", "invalid"]);
|
|
739
|
-
var
|
|
741
|
+
var startConversationResponseSchema = z17.object({
|
|
740
742
|
deployment: z17.object({
|
|
741
743
|
id: z17.string(),
|
|
742
744
|
name: z17.string(),
|
|
@@ -769,7 +771,7 @@ var startSessionResponseSchema = z17.object({
|
|
|
769
771
|
suggestions: z17.array(handshakeWelcomeSuggestionSchema).optional()
|
|
770
772
|
}).loose().optional(),
|
|
771
773
|
visitorId: z17.string(),
|
|
772
|
-
|
|
774
|
+
conversationId: z17.string(),
|
|
773
775
|
canContinue: z17.boolean(),
|
|
774
776
|
messages: z17.array(z17.unknown()),
|
|
775
777
|
/**
|
|
@@ -780,11 +782,11 @@ var startSessionResponseSchema = z17.object({
|
|
|
780
782
|
*/
|
|
781
783
|
userPrefs: z17.record(z17.string(), z17.unknown()).optional(),
|
|
782
784
|
// Present only when the server rotated the request `visitorId` /
|
|
783
|
-
// `
|
|
785
|
+
// `conversationId`. Purely advisory — client must adopt the response ids
|
|
784
786
|
// verbatim regardless of whether this block is present.
|
|
785
787
|
rebind: z17.object({
|
|
786
788
|
visitorId: rebindReasonSchema.optional(),
|
|
787
|
-
|
|
789
|
+
conversationId: rebindReasonSchema.optional()
|
|
788
790
|
}).loose().optional()
|
|
789
791
|
}).loose();
|
|
790
792
|
|