@helpai/elements 0.23.0 → 0.25.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 +1 -1
- package/configurator.mjs +21 -20
- package/elements-web-component.esm.js +27 -27
- package/elements-web-component.esm.js.map +3 -3
- package/elements.cjs.js +27 -27
- package/elements.cjs.js.map +3 -3
- package/elements.esm.js +27 -27
- package/elements.esm.js.map +3 -3
- package/elements.js +27 -27
- package/elements.js.map +3 -3
- package/index.d.ts +50 -38
- package/index.mjs +175 -53
- package/package.json +1 -1
- package/schema.d.ts +54 -50
- package/schema.json +31 -385
- package/schema.mjs +21 -20
- package/web-component.mjs +175 -53
package/README.md
CHANGED
|
@@ -335,7 +335,7 @@ mount({
|
|
|
335
335
|
publicKey: "agent_pk_...",
|
|
336
336
|
aiAgentDeploymentId: "...",
|
|
337
337
|
presentation: { mode: "floating" },
|
|
338
|
-
baseUrl: "https://help.ai
|
|
338
|
+
baseUrl: "https://help.ai", // omit to use the brand default
|
|
339
339
|
user: { id: "u_123", email: "alice@help.ai" },
|
|
340
340
|
theme: "dark", // "auto" | "light" | "dark" | overrides object
|
|
341
341
|
i18n: { defaultLocale: "en" },
|
package/configurator.mjs
CHANGED
|
@@ -432,6 +432,12 @@ var formDefSchema = z12.object({
|
|
|
432
432
|
frequency: z12.enum(["once", "conversation", "always"]).default("once").describe("`once` (per device, persisted), `conversation` (re-eligible each new conversation), or `always`."),
|
|
433
433
|
mirrorToContext: z12.boolean().default(true).describe(
|
|
434
434
|
"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."
|
|
435
|
+
),
|
|
436
|
+
reopenable: z12.boolean().default(true).describe(
|
|
437
|
+
'Skipped marker offers a "Fill out" button that reopens the form. Set `false` when a skip must be final (e.g. a consent ask that should not be re-surfaced).'
|
|
438
|
+
),
|
|
439
|
+
reviewable: z12.boolean().default(true).describe(
|
|
440
|
+
"Submitted marker expands in place to a read-only list of the visitor's answers. Set `false` for sensitive answers that shouldn't linger on screen."
|
|
435
441
|
)
|
|
436
442
|
}).loose();
|
|
437
443
|
var formsSchema = z12.array(formDefSchema).max(20).describe(
|
|
@@ -514,7 +520,7 @@ var moduleSchema = z14.object({
|
|
|
514
520
|
"UI layout that renders this tab: `chat` (the conversation), `home`, `help`, or `news`."
|
|
515
521
|
),
|
|
516
522
|
contentTags: z14.array(z14.string().max(60)).max(20).optional().describe(
|
|
517
|
-
"Content tags this tab scopes to \u2014 the `tags` filter on `GET /
|
|
523
|
+
"Content tags this tab scopes to \u2014 the `tags` filter on `GET /content` (matches content tagged with ANY of them). Omit for the `chat` layout."
|
|
518
524
|
),
|
|
519
525
|
id: z14.string().max(60).optional().describe(
|
|
520
526
|
"Stable id for navigation + last-tab persistence. Defaults to the first `contentTags` entry, else `layout`."
|
|
@@ -567,7 +573,9 @@ var modulesSchema = z14.array(moduleSchema).max(4).describe(
|
|
|
567
573
|
import { z as z15 } from "zod";
|
|
568
574
|
var trackingSchema = z15.object({
|
|
569
575
|
enabled: z15.boolean().optional().describe("Master switch. Default `false` \u2014 no hits are sent until the deployment turns tracking on."),
|
|
570
|
-
endpoint: z15.url().max(2048).optional().describe(
|
|
576
|
+
endpoint: z15.url().max(2048).optional().describe(
|
|
577
|
+
"Pixel collector URL. Default: `${dataBaseUrl}/elements/px.gif` (e.g. `https://help.ai/api/data/elements/px.gif`). Must be a full URL."
|
|
578
|
+
),
|
|
571
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`."),
|
|
572
580
|
token: z15.string().max(512).optional().describe(
|
|
573
581
|
"Anti-forgery token, echoed as `tk=` on every hit. Server-issued in the `/start-conversation` response \u2014 never set by hand (see `docs/api/tracking-collector.md`)."
|
|
@@ -582,10 +590,12 @@ var trackingSchema = z15.object({
|
|
|
582
590
|
var endpointsSchema = z16.object({
|
|
583
591
|
upload: z16.string().min(1).max(2048).default("/ai/agent/upload-file"),
|
|
584
592
|
transcribe: z16.string().min(1).max(2048).default("/ai/agent/transcribe-audio"),
|
|
585
|
-
submitForm: z16.string().min(1).max(2048).default("/
|
|
593
|
+
submitForm: z16.string().min(1).max(2048).default("/submit-form").describe(
|
|
586
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."
|
|
587
595
|
)
|
|
588
|
-
}).loose().describe(
|
|
596
|
+
}).loose().describe(
|
|
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
|
+
).meta({
|
|
589
599
|
examples: [
|
|
590
600
|
{ upload: "/ai/agent/upload-file", transcribe: "/ai/agent/transcribe-audio" },
|
|
591
601
|
{ upload: "https://help.ai/uploads/presign" },
|
|
@@ -634,7 +644,10 @@ var connectionConfigSchema = z16.object({
|
|
|
634
644
|
"Deployment UUID from the dashboard. Picks which agent / settings bundle answers this mount. Sent as `x-ai-agent-deployment-id`."
|
|
635
645
|
),
|
|
636
646
|
baseUrl: z16.string().min(1).max(2048).optional().describe(
|
|
637
|
-
"
|
|
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
|
+
),
|
|
649
|
+
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`)."
|
|
638
651
|
),
|
|
639
652
|
userContext: userContextSchema.optional(),
|
|
640
653
|
pageContext: pageContextSchema.optional(),
|
|
@@ -719,7 +732,9 @@ var connectionConfigPartialSchema = connectionConfigSchema.partial();
|
|
|
719
732
|
|
|
720
733
|
// src/schema/deployment.ts
|
|
721
734
|
import { z as z17 } from "zod";
|
|
722
|
-
var serverConfigSchema = widgetSettingsSchema.partial()
|
|
735
|
+
var serverConfigSchema = widgetSettingsSchema.partial().omit({ forms: true }).extend({
|
|
736
|
+
dataBaseUrl: z17.string().min(1).max(2048).optional()
|
|
737
|
+
});
|
|
723
738
|
var siteConfigSchema = z17.object({
|
|
724
739
|
title: z17.string().min(1).max(120).optional().describe("Brand / site name. Used as the logo's alt-text fallback."),
|
|
725
740
|
logo: assetSchema.optional().describe("Brand logo shown at the top of the page-mode sidebar."),
|
|
@@ -778,20 +793,6 @@ var startConversationResponseSchema = z17.object({
|
|
|
778
793
|
conversationId: z17.string(),
|
|
779
794
|
canContinue: z17.boolean(),
|
|
780
795
|
messages: z17.array(z17.unknown()),
|
|
781
|
-
/**
|
|
782
|
-
* Form submissions recorded for this conversation — echoed like
|
|
783
|
-
* `messages` so the widget reconstructs the collapsed "form submitted"
|
|
784
|
-
* timeline markers on resume. `createdAt` is ISO-8601 (a serialized
|
|
785
|
-
* Mongo ISODate — same format as message `createdAt`).
|
|
786
|
-
*/
|
|
787
|
-
formSubmissions: z17.array(
|
|
788
|
-
z17.object({
|
|
789
|
-
formId: z17.string(),
|
|
790
|
-
trigger: z17.string(),
|
|
791
|
-
skipped: z17.boolean().optional(),
|
|
792
|
-
createdAt: z17.iso.datetime().optional()
|
|
793
|
-
}).loose()
|
|
794
|
-
).optional(),
|
|
795
796
|
/**
|
|
796
797
|
* Per-visitor preferences (locale picker, theme picker, sound
|
|
797
798
|
* mute, dragged panel size). Distinct from `config` — this is
|