@helpai/elements 0.25.0 → 0.26.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/README.md +2 -2
- package/configurator.mjs +13 -14
- package/elements-web-component.esm.js +19 -19
- package/elements-web-component.esm.js.map +4 -4
- package/elements.cjs.js +19 -19
- package/elements.cjs.js.map +4 -4
- package/elements.esm.js +19 -19
- package/elements.esm.js.map +4 -4
- package/elements.js +19 -19
- package/elements.js.map +4 -4
- package/index.d.ts +37 -83
- package/index.mjs +132 -125
- package/package.json +1 -1
- package/schema.d.ts +50 -50
- package/schema.json +19 -22
- package/schema.mjs +15 -16
- package/web-component.d.ts +1 -1
- package/web-component.mjs +132 -125
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
|
|
88
|
+
| `schema.json` | JSON Schema | Dashboard config UIs, backend handshake 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,7 +323,7 @@ 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
|
|
326
|
+
Help AI workspace at handshake time — colors, launcher
|
|
327
327
|
chrome, strings, action layout, model defaults, history visibility
|
|
328
328
|
all flow through `StartConversationResponse.settings`. You don't recompile
|
|
329
329
|
per-customer.
|
package/configurator.mjs
CHANGED
|
@@ -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 `?conversation=<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 `/
|
|
135
|
+
"URL the `popOut` action opens in a new tab (carries `?conversation=<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 `/handshake.widget.behavior.popOutUrl`."
|
|
136
136
|
)
|
|
137
137
|
}).loose().describe("Lifecycle + streaming behaviour. Doesn't affect visual presentation.").meta({
|
|
138
138
|
examples: [
|
|
@@ -578,7 +578,7 @@ var trackingSchema = z15.object({
|
|
|
578
578
|
),
|
|
579
579
|
sampleRate: z15.number().min(0).max(1).optional().describe("Per-visitor sampling 0..1 (decided once per page load, keeping funnels intact). Default `1`."),
|
|
580
580
|
token: z15.string().max(512).optional().describe(
|
|
581
|
-
"Anti-forgery token, echoed as `tk=` on every hit. Server-issued in the `/
|
|
581
|
+
"Anti-forgery token, echoed as `tk=` on every hit. Server-issued in the `/handshake` response \u2014 never set by hand (see `docs/api/tracking-collector.md`)."
|
|
582
582
|
)
|
|
583
583
|
}).loose().describe(
|
|
584
584
|
"Anonymous usage tracking for the widget owner \u2014 GA-style pixel events (open, send, form submit, \u2026) with page / device / locale dimensions. Never includes message content; visitors are identified only by the widget's anonymous visitorId."
|
|
@@ -588,8 +588,8 @@ var trackingSchema = z15.object({
|
|
|
588
588
|
|
|
589
589
|
// src/schema/widget.ts
|
|
590
590
|
var endpointsSchema = z16.object({
|
|
591
|
-
upload: z16.string().min(1).max(2048).default("/ai
|
|
592
|
-
transcribe: z16.string().min(1).max(2048).default("/ai
|
|
591
|
+
upload: z16.string().min(1).max(2048).default("/ai-agent/upload-file"),
|
|
592
|
+
transcribe: z16.string().min(1).max(2048).default("/ai-agent/transcribe-audio"),
|
|
593
593
|
submitForm: z16.string().min(1).max(2048).default("/submit-form").describe(
|
|
594
594
|
"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."
|
|
595
595
|
)
|
|
@@ -597,7 +597,7 @@ var endpointsSchema = z16.object({
|
|
|
597
597
|
"HTTP endpoint overrides. `upload` / `transcribe` paths are appended to the agent base (`${baseUrl}/api/agent`), `submitForm` to the data base (`dataBaseUrl`); absolute URLs are accepted too."
|
|
598
598
|
).meta({
|
|
599
599
|
examples: [
|
|
600
|
-
{ upload: "/ai
|
|
600
|
+
{ upload: "/ai-agent/upload-file", transcribe: "/ai-agent/transcribe-audio" },
|
|
601
601
|
{ upload: "https://help.ai/uploads/presign" },
|
|
602
602
|
{ submitForm: "https://crm.acme.com/leads" }
|
|
603
603
|
]
|
|
@@ -646,8 +646,11 @@ var connectionConfigSchema = z16.object({
|
|
|
646
646
|
baseUrl: z16.string().min(1).max(2048).optional().describe(
|
|
647
647
|
"MAIN site origin (e.g. `https://help.ai`) \u2014 the API modules derive from it: agent API at `${baseUrl}/api/agent`, data API at `${baseUrl}/api/data`. Set this to point at your staging / self-hosted / custom backend. Default: the brand's `defaultBaseUrl` baked at build time."
|
|
648
648
|
),
|
|
649
|
+
agentBaseUrl: z16.string().min(1).max(2048).optional().describe(
|
|
650
|
+
"Full agent-API base \u2014 set it to reach a STANDALONE `module-help-ai-agent-api` directly (local module on its own port, e.g. `http://localhost:3087`; routes attach as-is: `/ai-agent/handshake`). Precedence: this option > derived from the main origin (`${baseUrl}/api/agent`). Not server-pushable."
|
|
651
|
+
),
|
|
649
652
|
dataBaseUrl: z16.string().min(1).max(2048).optional().describe(
|
|
650
|
-
"Full data-API base (e.g. `https://help.ai/api/data`) \u2014 the service serving content, form definitions (`GET /forms`), and form submissions at root-level paths. Precedence: this option > server-pushed `config.dataBaseUrl` > derived from the main origin (`${baseUrl}/api/data`)."
|
|
653
|
+
"Full data-API base (e.g. `https://help.ai/api/data`, or a standalone local module like `http://localhost:3106`) \u2014 the service serving content, form definitions (`GET /forms`), and form submissions at root-level paths. Precedence: this option > server-pushed `config.dataBaseUrl` > derived from the main origin (`${baseUrl}/api/data`)."
|
|
651
654
|
),
|
|
652
655
|
userContext: userContextSchema.optional(),
|
|
653
656
|
pageContext: pageContextSchema.optional(),
|
|
@@ -687,7 +690,7 @@ var widgetSettingsSchema = z16.object({
|
|
|
687
690
|
modules: modulesSchema.optional(),
|
|
688
691
|
tracking: trackingSchema.optional()
|
|
689
692
|
}).loose().describe(
|
|
690
|
-
"Portal-configurable widget settings \u2014 fourteen sections, one per dashboard tab. The backend pushes this same shape on `/ai
|
|
693
|
+
"Portal-configurable widget settings \u2014 fourteen sections, one per dashboard tab. The backend pushes this same shape on `/ai-agent/handshake` under `config`."
|
|
691
694
|
).meta({
|
|
692
695
|
examples: [
|
|
693
696
|
{ presentation: { mode: "floating", position: "bottom-right" }, theme: "auto" },
|
|
@@ -705,10 +708,8 @@ var widgetSettingsSchema = z16.object({
|
|
|
705
708
|
});
|
|
706
709
|
var widgetConfigSchema = connectionConfigSchema.extend({
|
|
707
710
|
...widgetSettingsSchema.shape,
|
|
708
|
-
site: z16.unknown().optional().describe(
|
|
709
|
-
|
|
710
|
-
),
|
|
711
|
-
blocks: z16.unknown().optional().describe('Blocks (nav + link cards) \u2014 applies in `mode: "page"`. Comes from the start-conversation response.')
|
|
711
|
+
site: z16.unknown().optional().describe('Site config \u2014 applies in `mode: "page"`. Comes from the handshake response, not user-edited.'),
|
|
712
|
+
blocks: z16.unknown().optional().describe('Blocks (nav + link cards) \u2014 applies in `mode: "page"`. Comes from the handshake response.')
|
|
712
713
|
}).describe(
|
|
713
714
|
"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."
|
|
714
715
|
).meta({
|
|
@@ -757,7 +758,7 @@ var handshakeWelcomeSuggestionSchema = z17.object({
|
|
|
757
758
|
text: z17.string().optional()
|
|
758
759
|
}).loose();
|
|
759
760
|
var rebindReasonSchema = z17.enum(["conflict", "expired", "invalid"]);
|
|
760
|
-
var
|
|
761
|
+
var handshakeResponseSchema = z17.object({
|
|
761
762
|
deployment: z17.object({
|
|
762
763
|
id: z17.string(),
|
|
763
764
|
name: z17.string(),
|
|
@@ -791,8 +792,6 @@ var startConversationResponseSchema = z17.object({
|
|
|
791
792
|
}).loose().optional(),
|
|
792
793
|
visitorId: z17.string(),
|
|
793
794
|
conversationId: z17.string(),
|
|
794
|
-
canContinue: z17.boolean(),
|
|
795
|
-
messages: z17.array(z17.unknown()),
|
|
796
795
|
/**
|
|
797
796
|
* Per-visitor preferences (locale picker, theme picker, sound
|
|
798
797
|
* mute, dragged panel size). Distinct from `config` — this is
|