@helpai/elements 0.12.3 → 0.13.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/configurator.mjs +171 -87
- package/elements-web-component.esm.js +27 -27
- package/elements-web-component.esm.js.map +4 -4
- package/elements.cjs.js +27 -27
- package/elements.cjs.js.map +4 -4
- package/elements.esm.js +27 -27
- package/elements.esm.js.map +4 -4
- package/elements.js +28 -28
- package/elements.js.map +4 -4
- package/index.d.ts +143 -2
- package/index.mjs +1470 -502
- package/package.json +1 -1
- package/schema.d.ts +127 -2
- package/schema.json +476 -3
- package/schema.mjs +178 -89
- package/style.css +1 -1
- package/web-component.mjs +1487 -523
package/configurator.mjs
CHANGED
|
@@ -20,7 +20,7 @@ var localeSchema = z.string().min(1).max(35).describe("BCP-47 locale tag (e.g. `
|
|
|
20
20
|
var uuid7Schema = z.uuidv7().describe("UUID v7 (RFC 9562) \u2014 the single id format for visitor / session / message / file / content ids.");
|
|
21
21
|
|
|
22
22
|
// src/schema/widget.ts
|
|
23
|
-
import { z as
|
|
23
|
+
import { z as z16 } from "zod";
|
|
24
24
|
|
|
25
25
|
// src/schema/widget/presentation.ts
|
|
26
26
|
import { z as z3 } from "zod";
|
|
@@ -228,6 +228,9 @@ var featureFlagsSchema = z7.object({
|
|
|
228
228
|
),
|
|
229
229
|
tools: z7.array(toolRefSchema).max(200).optional().describe(
|
|
230
230
|
"Backend tools the assistant may invoke. Bare codes (`'tool:send-money'`) or rich refs (`{ code, config }`)."
|
|
231
|
+
),
|
|
232
|
+
humanInLoop: z7.boolean().default(true).describe(
|
|
233
|
+
"Render human-in-the-loop tool UI \u2014 the inline ask-input form + approve/reject controls for gated tools. `true` (default) shows them; `false` suppresses the UI (the wire still carries the signals)."
|
|
231
234
|
)
|
|
232
235
|
}).loose().describe("Capability flags \u2014 file upload, voice mode, and the tools the assistant may invoke.").meta({
|
|
233
236
|
examples: [
|
|
@@ -401,45 +404,121 @@ var i18nSchema = z13.object({
|
|
|
401
404
|
]
|
|
402
405
|
});
|
|
403
406
|
|
|
404
|
-
// src/schema/widget/
|
|
407
|
+
// src/schema/widget/intake.ts
|
|
405
408
|
import { z as z14 } from "zod";
|
|
406
|
-
var
|
|
407
|
-
|
|
408
|
-
|
|
409
|
+
var fieldTypeSchema = z14.enum([
|
|
410
|
+
"text",
|
|
411
|
+
"email",
|
|
412
|
+
"tel",
|
|
413
|
+
"url",
|
|
414
|
+
"number",
|
|
415
|
+
"textarea",
|
|
416
|
+
"select",
|
|
417
|
+
"radio",
|
|
418
|
+
"checkbox",
|
|
419
|
+
"multiselect"
|
|
420
|
+
]);
|
|
421
|
+
var fieldOptionSchema = z14.object({
|
|
422
|
+
value: z14.string().min(1).max(200).describe("The value recorded when this choice is picked."),
|
|
423
|
+
label: z14.string().min(1).max(200).optional().describe("Display text; falls back to `value`."),
|
|
424
|
+
description: z14.string().max(280).optional().describe("Optional sub-label under the choice.")
|
|
425
|
+
}).loose();
|
|
426
|
+
var fieldValidationSchema = z14.object({
|
|
427
|
+
pattern: z14.string().max(500).optional().describe("Regex source string \u2014 text-like fields (e.g. `^\\d{5}$`)."),
|
|
428
|
+
minLength: z14.number().int().min(0).max(1e4).optional(),
|
|
429
|
+
maxLength: z14.number().int().min(1).max(1e4).optional(),
|
|
430
|
+
min: z14.number().optional().describe("Minimum \u2014 `number` fields."),
|
|
431
|
+
max: z14.number().optional().describe("Maximum \u2014 `number` fields."),
|
|
432
|
+
minSelections: z14.number().int().min(0).max(50).optional().describe("Minimum picks \u2014 `multiselect`."),
|
|
433
|
+
maxSelections: z14.number().int().min(1).max(50).optional().describe("Maximum picks \u2014 `multiselect`.")
|
|
434
|
+
}).loose();
|
|
435
|
+
var formFieldSchema = z14.object({
|
|
436
|
+
name: z14.string().min(1).max(80).describe("Stable key the answer is recorded under (e.g. `email`). Sent to the agent as captured context."),
|
|
437
|
+
label: z14.string().min(1).max(200).describe("Visible field label."),
|
|
438
|
+
type: fieldTypeSchema.describe("Field renderer + built-in validation (`email`/`tel`/`url`/`number` are checked)."),
|
|
439
|
+
placeholder: z14.string().max(200).optional(),
|
|
440
|
+
required: z14.boolean().optional().default(true).describe("Must be answered to submit. Set `false` to allow skipping."),
|
|
441
|
+
defaultValue: z14.string().max(2e3).optional().describe("Pre-filled value (comma-join for `multiselect`)."),
|
|
442
|
+
options: z14.array(fieldOptionSchema).max(50).optional().describe("Choices for `select` / `radio` / `multiselect`."),
|
|
443
|
+
validation: fieldValidationSchema.optional(),
|
|
444
|
+
allowOther: z14.boolean().optional().describe("`select`/`radio`/`multiselect` \u2014 allow a free-text 'Other' answer."),
|
|
445
|
+
validationHint: z14.string().max(280).optional().describe("Small helper line under the field.")
|
|
446
|
+
}).loose();
|
|
447
|
+
var intakeSchema = z14.object({
|
|
448
|
+
enabled: z14.boolean().default(false).describe("Turn the pre-chat intake gate on. Off by default."),
|
|
449
|
+
title: z14.string().max(120).optional().describe("Form heading (e.g. 'Before we start')."),
|
|
450
|
+
description: z14.string().max(500).optional().describe("Sub-heading under the title."),
|
|
451
|
+
fields: z14.array(formFieldSchema).max(20).default([]).describe("The questions to ask, in order. The gate is only active when there is \u22651 field."),
|
|
452
|
+
submitLabel: z14.string().max(60).optional().describe("Submit button label (default 'Start chat')."),
|
|
453
|
+
skippable: z14.boolean().default(false).describe("Show a Skip control to dismiss the whole form.")
|
|
454
|
+
}).loose().describe(
|
|
455
|
+
"Pre-chat intake form \u2014 a blocking lead/sales-capture gate of typed, validated fields. The same field shape powers the AI ask-input tool. Off by default."
|
|
456
|
+
).meta({
|
|
457
|
+
examples: [
|
|
458
|
+
{ enabled: false },
|
|
459
|
+
{
|
|
460
|
+
enabled: true,
|
|
461
|
+
title: "Before we start",
|
|
462
|
+
description: "Tell us who you are so we can help faster.",
|
|
463
|
+
submitLabel: "Start chat",
|
|
464
|
+
fields: [
|
|
465
|
+
{ name: "name", label: "Your name", type: "text", required: true },
|
|
466
|
+
{ name: "email", label: "Work email", type: "email", required: true },
|
|
467
|
+
{ name: "phone", label: "Phone", type: "tel", required: false },
|
|
468
|
+
{
|
|
469
|
+
name: "topic",
|
|
470
|
+
label: "What can we help with?",
|
|
471
|
+
type: "select",
|
|
472
|
+
required: true,
|
|
473
|
+
options: [
|
|
474
|
+
{ value: "sales", label: "Talk to sales" },
|
|
475
|
+
{ value: "support", label: "Get support" }
|
|
476
|
+
]
|
|
477
|
+
}
|
|
478
|
+
]
|
|
479
|
+
}
|
|
480
|
+
]
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
// src/schema/widget/modules.ts
|
|
484
|
+
import { z as z15 } from "zod";
|
|
485
|
+
var moduleLayoutSchema = z15.enum(["chat", "home", "help", "news"]);
|
|
486
|
+
var moduleSchema = z15.object({
|
|
487
|
+
label: z15.string().min(1).max(40).describe(
|
|
409
488
|
"Tab label \u2014 an i18n key (resolved against the i18n strings, e.g. `tabHome`) or a literal. Translations ride `i18n.strings`."
|
|
410
489
|
),
|
|
411
490
|
layout: moduleLayoutSchema.describe(
|
|
412
491
|
"UI layout that renders this tab: `chat` (the conversation), `home`, `help`, or `news`."
|
|
413
492
|
),
|
|
414
|
-
contentTags:
|
|
493
|
+
contentTags: z15.array(z15.string().max(60)).max(20).optional().describe(
|
|
415
494
|
"Content tags this tab scopes to \u2014 the `tags` filter on `GET /ai/agent/content` (matches content tagged with ANY of them). Omit for the `chat` layout."
|
|
416
495
|
),
|
|
417
|
-
id:
|
|
496
|
+
id: z15.string().max(60).optional().describe(
|
|
418
497
|
"Stable id for navigation + last-tab persistence. Defaults to the first `contentTags` entry, else `layout`."
|
|
419
498
|
),
|
|
420
499
|
// ── `home` layout config (flat feature flags — no block authoring) ──────
|
|
421
|
-
brandName:
|
|
422
|
-
showGreeting:
|
|
423
|
-
greetingText:
|
|
424
|
-
userAvatars:
|
|
425
|
-
|
|
426
|
-
name:
|
|
427
|
-
avatar:
|
|
428
|
-
role:
|
|
500
|
+
brandName: z15.string().max(80).optional().describe("`home` \u2014 hero wordmark (e.g. your company name)."),
|
|
501
|
+
showGreeting: z15.boolean().optional().describe("`home` \u2014 show the greeting hero (default true)."),
|
|
502
|
+
greetingText: z15.string().max(280).optional().describe("`home` \u2014 override the greeting headline (default 'How can we help?'); supports a `{name}` token."),
|
|
503
|
+
userAvatars: z15.array(
|
|
504
|
+
z15.object({
|
|
505
|
+
name: z15.string().min(1).max(80),
|
|
506
|
+
avatar: z15.string().max(2048).optional().describe("Image URL; falls back to initials of `name`."),
|
|
507
|
+
role: z15.string().max(80).optional()
|
|
429
508
|
}).loose()
|
|
430
509
|
).max(10).optional().describe("`home` \u2014 team/agent avatars shown in the hero."),
|
|
431
|
-
showSearchBar:
|
|
432
|
-
showRecentMessages:
|
|
433
|
-
status:
|
|
434
|
-
text:
|
|
435
|
-
level:
|
|
510
|
+
showSearchBar: z15.boolean().optional().describe("`home` \u2014 show the 'Search for help' bar (default true)."),
|
|
511
|
+
showRecentMessages: z15.boolean().optional().describe("`home` \u2014 show the visitor's most recent conversation card (default true)."),
|
|
512
|
+
status: z15.object({
|
|
513
|
+
text: z15.string().min(1).max(120),
|
|
514
|
+
level: z15.string().max(40).optional().describe(
|
|
436
515
|
"`home` \u2014 status severity, drives the status icon colour. Free text; `operational` (green, default), `degraded` (amber), and `down` (red) are styled, any other value falls back to the operational style."
|
|
437
516
|
).meta({ examples: ["operational", "degraded", "down"] }),
|
|
438
|
-
url:
|
|
517
|
+
url: z15.string().max(2048).optional().describe("Opens in an in-widget iframe when tapped.")
|
|
439
518
|
}).optional().describe("`home` \u2014 system-status card. Omit to hide."),
|
|
440
|
-
contentBlockTitle:
|
|
519
|
+
contentBlockTitle: z15.string().max(80).optional().describe("`home` \u2014 heading for the content list built from `contentTags` (default 'Popular articles').")
|
|
441
520
|
}).loose();
|
|
442
|
-
var modulesSchema =
|
|
521
|
+
var modulesSchema = z15.array(moduleSchema).max(4).describe(
|
|
443
522
|
"Messenger tabs \u2014 an ordered list of up to 4 tabs, each picking a `layout` + optional content `contentTags` (the content scope) + a translatable `label`. One tab \u2192 no tab bar (just that content); zero \u2192 an empty state. Floating / drawer / modal only."
|
|
444
523
|
).meta({
|
|
445
524
|
examples: [
|
|
@@ -462,23 +541,27 @@ var modulesSchema = z14.array(moduleSchema).max(4).describe(
|
|
|
462
541
|
});
|
|
463
542
|
|
|
464
543
|
// src/schema/widget.ts
|
|
465
|
-
var endpointsSchema =
|
|
466
|
-
upload:
|
|
467
|
-
transcribe:
|
|
544
|
+
var endpointsSchema = z16.object({
|
|
545
|
+
upload: z16.string().min(1).max(2048).default("/ai/agent/upload-file"),
|
|
546
|
+
transcribe: z16.string().min(1).max(2048).default("/ai/agent/transcribe-audio"),
|
|
547
|
+
intake: z16.string().min(1).max(2048).default("/ai/agent/intake").describe(
|
|
548
|
+
"Pre-chat intake submission endpoint. The widget POSTs the captured lead values here on completion (fire-and-forget), keyed by the same visitorId + sessionId as the conversation. Optional \u2014 a 404 is ignored."
|
|
549
|
+
)
|
|
468
550
|
}).loose().describe("HTTP endpoint overrides. Paths are appended to baseUrl; absolute URLs are accepted too.").meta({
|
|
469
551
|
examples: [
|
|
470
552
|
{ upload: "/ai/agent/upload-file", transcribe: "/ai/agent/transcribe-audio" },
|
|
471
|
-
{ upload: "https://help.ai/uploads/presign" }
|
|
553
|
+
{ upload: "https://help.ai/uploads/presign" },
|
|
554
|
+
{ intake: "https://crm.acme.com/leads/intake" }
|
|
472
555
|
]
|
|
473
556
|
});
|
|
474
|
-
var userContextSchema =
|
|
475
|
-
id:
|
|
476
|
-
email:
|
|
477
|
-
name:
|
|
478
|
-
plan:
|
|
479
|
-
role:
|
|
480
|
-
phone:
|
|
481
|
-
}).catchall(
|
|
557
|
+
var userContextSchema = z16.object({
|
|
558
|
+
id: z16.string().min(1).max(200).optional().describe("Host's stable id for the user \u2014 informational context the agent/backend can key on (not auth)."),
|
|
559
|
+
email: z16.string().min(1).max(320).optional().describe("User email \u2014 surfaced to the agent for context (optional)."),
|
|
560
|
+
name: z16.string().min(1).max(200).optional().describe("Display name \u2014 shown in the Home greeting (`{name}`) and conversation transcripts (optional)."),
|
|
561
|
+
plan: z16.string().min(1).max(120).optional().describe("Subscription / pricing tier, e.g. `pro` (optional)."),
|
|
562
|
+
role: z16.string().min(1).max(120).optional().describe("The user's role on the host site, e.g. `admin` (optional)."),
|
|
563
|
+
phone: z16.string().min(1).max(40).optional().describe("Phone number (optional).")
|
|
564
|
+
}).catchall(z16.union([z16.string(), z16.number(), z16.boolean()])).describe(
|
|
482
565
|
"Host-asserted end-user context (informational, untrusted \u2014 not authentication). Recognised `id` / `email` / `name` / `plan` / `role` / `phone` plus any extra custom scalar fields forwarded to the agent."
|
|
483
566
|
).meta({
|
|
484
567
|
examples: [{ id: "u_123" }, { id: "u_123", email: "alex@acme.com", name: "Alex Lee", plan: "pro" }]
|
|
@@ -494,31 +577,31 @@ var PAGE_AREA_SUGGESTIONS = [
|
|
|
494
577
|
"account",
|
|
495
578
|
"blog"
|
|
496
579
|
];
|
|
497
|
-
var pageContextSchema =
|
|
498
|
-
area:
|
|
499
|
-
url:
|
|
500
|
-
path:
|
|
501
|
-
title:
|
|
502
|
-
}).catchall(
|
|
580
|
+
var pageContextSchema = z16.object({
|
|
581
|
+
area: z16.string().min(1).max(64).optional().describe(`Host-defined surface the visitor is on. Free-form; suggested: ${PAGE_AREA_SUGGESTIONS.join(" | ")}.`),
|
|
582
|
+
url: z16.string().min(1).max(2048).optional().describe("Full page URL. Auto-filled from the host page when omitted."),
|
|
583
|
+
path: z16.string().min(1).max(2048).optional().describe("Page path, e.g. `/pricing/enterprise`."),
|
|
584
|
+
title: z16.string().min(1).max(300).optional().describe("Human-readable page title.")
|
|
585
|
+
}).catchall(z16.union([z16.string(), z16.number(), z16.boolean()])).describe(
|
|
503
586
|
"Host-asserted page/visit context (informational, untrusted). Where the visitor is + the surface (`area`) they're using, plus any custom scalar fields, forwarded to the agent."
|
|
504
587
|
).meta({ examples: [{ area: "pricing", path: "/pricing" }, { area: "help-desk" }] });
|
|
505
|
-
var connectionConfigSchema =
|
|
506
|
-
widgetId:
|
|
588
|
+
var connectionConfigSchema = z16.object({
|
|
589
|
+
widgetId: z16.string().min(1).max(80).default("default").describe(
|
|
507
590
|
"Stable per-instance id used to namespace localStorage keys. Set this when mounting more than one widget on the same page so their conversation state doesn't collide."
|
|
508
591
|
),
|
|
509
|
-
publicKey:
|
|
592
|
+
publicKey: z16.string().min(1).max(200).optional().describe(
|
|
510
593
|
"Workspace-scoped public key (`agent_pk_\u2026`) issued from the dashboard. Sent on every API call as the `x-public-key` header."
|
|
511
594
|
),
|
|
512
|
-
aiAgentDeploymentId:
|
|
595
|
+
aiAgentDeploymentId: z16.string().min(1).max(200).optional().describe(
|
|
513
596
|
"Deployment UUID from the dashboard. Picks which agent / settings bundle answers this mount. Sent as `x-ai-agent-deployment-id`."
|
|
514
597
|
),
|
|
515
|
-
baseUrl:
|
|
598
|
+
baseUrl: z16.string().min(1).max(2048).optional().describe(
|
|
516
599
|
"Full backend origin (e.g. `https://help.ai/api`). Set this to point at your staging / self-hosted / custom backend. Default: the brand's `defaultBaseUrl` baked at build time."
|
|
517
600
|
),
|
|
518
601
|
userContext: userContextSchema.optional(),
|
|
519
602
|
pageContext: pageContextSchema.optional(),
|
|
520
603
|
endpoints: endpointsSchema.optional(),
|
|
521
|
-
debug:
|
|
604
|
+
debug: z16.union([z16.boolean(), z16.enum(["off", "error", "warn", "info", "debug", "trace"])]).optional().describe(
|
|
522
605
|
'Console log verbosity. `false` / `"off"` silences everything (default in production). `true` \u2192 `"debug"`. Levels `error` / `warn` / `info` / `debug` / `trace` gate output additively. Use `"trace"` to capture per-chunk SSE frames + every state transition. Also toggleable at runtime via `chat.setDebug(level)` or `?<brand>-debug=trace` in the page URL \u2014 the URL beats this option, this option beats the persisted `localStorage` value.'
|
|
523
606
|
)
|
|
524
607
|
}).loose().describe(
|
|
@@ -538,7 +621,7 @@ var connectionConfigSchema = z15.object({
|
|
|
538
621
|
}
|
|
539
622
|
]
|
|
540
623
|
});
|
|
541
|
-
var widgetSettingsSchema =
|
|
624
|
+
var widgetSettingsSchema = z16.object({
|
|
542
625
|
presentation: presentationSchema.optional(),
|
|
543
626
|
behavior: behaviorSchema.optional(),
|
|
544
627
|
theme: themeFieldSchema.default("auto").describe("Theme preference (`auto` follows OS) or a tokens override object (`accent`, `radius`, `fontFamily`)."),
|
|
@@ -550,9 +633,10 @@ var widgetSettingsSchema = z15.object({
|
|
|
550
633
|
i18n: i18nSchema.optional(),
|
|
551
634
|
footer: footerSchema.optional(),
|
|
552
635
|
features: featureFlagsSchema.optional(),
|
|
636
|
+
intake: intakeSchema.optional(),
|
|
553
637
|
modules: modulesSchema.optional()
|
|
554
638
|
}).loose().describe(
|
|
555
|
-
"Portal-configurable widget settings \u2014
|
|
639
|
+
"Portal-configurable widget settings \u2014 thirteen sections, one per dashboard tab. The backend pushes this same shape on `/ai/agent/start-session` under `config`."
|
|
556
640
|
).meta({
|
|
557
641
|
examples: [
|
|
558
642
|
{ presentation: { mode: "floating", position: "bottom-right" }, theme: "auto" },
|
|
@@ -570,8 +654,8 @@ var widgetSettingsSchema = z15.object({
|
|
|
570
654
|
});
|
|
571
655
|
var widgetConfigSchema = connectionConfigSchema.extend({
|
|
572
656
|
...widgetSettingsSchema.shape,
|
|
573
|
-
site:
|
|
574
|
-
blocks:
|
|
657
|
+
site: z16.unknown().optional().describe('Site config \u2014 applies in `mode: "page"`. Comes from the start-session response, not user-edited.'),
|
|
658
|
+
blocks: z16.unknown().optional().describe('Blocks (nav + link cards) \u2014 applies in `mode: "page"`. Comes from the start-session response.')
|
|
575
659
|
}).describe(
|
|
576
660
|
"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."
|
|
577
661
|
).meta({
|
|
@@ -594,49 +678,49 @@ var widgetSettingsPartialSchema = widgetSettingsSchema.partial();
|
|
|
594
678
|
var connectionConfigPartialSchema = connectionConfigSchema.partial();
|
|
595
679
|
|
|
596
680
|
// src/schema/deployment.ts
|
|
597
|
-
import { z as
|
|
681
|
+
import { z as z17 } from "zod";
|
|
598
682
|
var serverConfigSchema = widgetSettingsSchema.partial();
|
|
599
|
-
var siteConfigSchema =
|
|
600
|
-
title:
|
|
683
|
+
var siteConfigSchema = z17.object({
|
|
684
|
+
title: z17.string().min(1).max(120).optional().describe("Brand / site name. Used as the logo's alt-text fallback."),
|
|
601
685
|
logo: assetSchema.optional().describe("Brand logo shown at the top of the page-mode sidebar."),
|
|
602
686
|
logoDark: assetSchema.optional().describe(
|
|
603
687
|
"Optional dark-theme logo variant. Falls back to `logo` when the active theme is light or `logoDark` is unset."
|
|
604
688
|
)
|
|
605
689
|
}).loose();
|
|
606
|
-
var blocksConfigSchema =
|
|
607
|
-
navigation:
|
|
608
|
-
linkCards:
|
|
690
|
+
var blocksConfigSchema = z17.object({
|
|
691
|
+
navigation: z17.array(linkSchema).max(100).optional().describe("Sidebar navigation links (vertical list, primary nav)."),
|
|
692
|
+
linkCards: z17.array(linkSchema).max(100).optional().describe("Sidebar link cards (richer entries with optional `description`).")
|
|
609
693
|
}).loose();
|
|
610
|
-
var handshakeWelcomeMessageSchema =
|
|
611
|
-
id:
|
|
612
|
-
role:
|
|
613
|
-
text:
|
|
694
|
+
var handshakeWelcomeMessageSchema = z17.object({
|
|
695
|
+
id: z17.string(),
|
|
696
|
+
role: z17.enum(["assistant", "system"]),
|
|
697
|
+
text: z17.string()
|
|
614
698
|
}).loose();
|
|
615
|
-
var handshakeWelcomeSuggestionSchema =
|
|
616
|
-
id:
|
|
617
|
-
label:
|
|
618
|
-
text:
|
|
699
|
+
var handshakeWelcomeSuggestionSchema = z17.object({
|
|
700
|
+
id: z17.string(),
|
|
701
|
+
label: z17.string(),
|
|
702
|
+
text: z17.string().optional()
|
|
619
703
|
}).loose();
|
|
620
|
-
var rebindReasonSchema =
|
|
621
|
-
var startSessionResponseSchema =
|
|
622
|
-
deployment:
|
|
623
|
-
id:
|
|
624
|
-
name:
|
|
704
|
+
var rebindReasonSchema = z17.enum(["conflict", "expired", "invalid"]);
|
|
705
|
+
var startSessionResponseSchema = z17.object({
|
|
706
|
+
deployment: z17.object({
|
|
707
|
+
id: z17.string(),
|
|
708
|
+
name: z17.string(),
|
|
625
709
|
// Page URL identifier — present on every deployment; unique per host.
|
|
626
710
|
// Used to mount page deployments via `?slug=…`.
|
|
627
|
-
slug:
|
|
628
|
-
publicKey:
|
|
711
|
+
slug: z17.string().optional(),
|
|
712
|
+
publicKey: z17.string().optional()
|
|
629
713
|
// Deliberately no `type` / `channel` here. Deployment-level
|
|
630
714
|
// taxonomy is a backend categorization concern — the widget's
|
|
631
715
|
// rendering choice flows from `widget.presentation.mode`, not
|
|
632
716
|
// the deployment record's category. `.loose()` lets any such
|
|
633
717
|
// backend field pass through without typing.
|
|
634
718
|
}).loose(),
|
|
635
|
-
agent:
|
|
636
|
-
id:
|
|
637
|
-
name:
|
|
638
|
-
title:
|
|
639
|
-
status:
|
|
719
|
+
agent: z17.object({
|
|
720
|
+
id: z17.string(),
|
|
721
|
+
name: z17.string(),
|
|
722
|
+
title: z17.string().optional(),
|
|
723
|
+
status: z17.enum(["online", "away", "offline"]).optional()
|
|
640
724
|
}).loose(),
|
|
641
725
|
/**
|
|
642
726
|
* Deployment-wide widget configuration the dashboard admin saved
|
|
@@ -646,25 +730,25 @@ var startSessionResponseSchema = z16.object({
|
|
|
646
730
|
config: serverConfigSchema.optional(),
|
|
647
731
|
site: siteConfigSchema.optional(),
|
|
648
732
|
blocks: blocksConfigSchema.optional(),
|
|
649
|
-
welcome:
|
|
650
|
-
messages:
|
|
651
|
-
suggestions:
|
|
733
|
+
welcome: z17.object({
|
|
734
|
+
messages: z17.array(handshakeWelcomeMessageSchema).optional(),
|
|
735
|
+
suggestions: z17.array(handshakeWelcomeSuggestionSchema).optional()
|
|
652
736
|
}).loose().optional(),
|
|
653
|
-
visitorId:
|
|
654
|
-
sessionId:
|
|
655
|
-
canContinue:
|
|
656
|
-
messages:
|
|
737
|
+
visitorId: z17.string(),
|
|
738
|
+
sessionId: z17.string(),
|
|
739
|
+
canContinue: z17.boolean(),
|
|
740
|
+
messages: z17.array(z17.unknown()),
|
|
657
741
|
/**
|
|
658
742
|
* Per-visitor preferences (locale picker, theme picker, sound
|
|
659
743
|
* mute, dragged panel size). Distinct from `config` — this is
|
|
660
744
|
* what THIS visitor toggled inside the widget, not the
|
|
661
745
|
* deployment's admin-set defaults.
|
|
662
746
|
*/
|
|
663
|
-
userPrefs:
|
|
747
|
+
userPrefs: z17.record(z17.string(), z17.unknown()).optional(),
|
|
664
748
|
// Present only when the server rotated the request `visitorId` /
|
|
665
749
|
// `sessionId`. Purely advisory — client must adopt the response ids
|
|
666
750
|
// verbatim regardless of whether this block is present.
|
|
667
|
-
rebind:
|
|
751
|
+
rebind: z17.object({
|
|
668
752
|
visitorId: rebindReasonSchema.optional(),
|
|
669
753
|
sessionId: rebindReasonSchema.optional()
|
|
670
754
|
}).loose().optional()
|
|
@@ -674,7 +758,7 @@ var startSessionResponseSchema = z16.object({
|
|
|
674
758
|
import "zod";
|
|
675
759
|
|
|
676
760
|
// src/schema/json-schema.ts
|
|
677
|
-
import { z as
|
|
761
|
+
import { z as z19 } from "zod";
|
|
678
762
|
|
|
679
763
|
// src/configurator/field-help.tsx
|
|
680
764
|
import { createPortal } from "preact/compat";
|