@helpai/elements 0.19.10 → 0.21.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 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 / conversation / message / file / content ids.");
21
21
 
22
22
  // src/schema/widget.ts
23
- import { z as z16 } from "zod";
23
+ import { z as z15 } from "zod";
24
24
 
25
25
  // src/schema/widget/presentation.ts
26
26
  import { z as z3 } from "zod";
@@ -344,33 +344,21 @@ var composerOptionsSchema = z10.object({
344
344
  ]
345
345
  });
346
346
 
347
- // src/schema/widget/welcome.ts
348
- import { z as z11 } from "zod";
349
- var welcomeAnimationSchema = z11.enum(["typewriter", "instant"]);
350
- var welcomeOptionsSchema = z11.object({
351
- animation: welcomeAnimationSchema.default("instant").describe(
352
- "How welcome messages render \u2014 `typewriter` types each message in character-by-character; `instant` shows them whole."
353
- ),
354
- speed: z11.number().int().min(1).max(2e3).default(60).describe("Typewriter speed in characters per second. Only meaningful when `animation = typewriter`.")
355
- }).loose().describe("How welcome messages render \u2014 instant by default; opt into a typewriter effect with adjustable cps speed.").meta({
356
- examples: [{ animation: "instant" }, { animation: "typewriter", speed: 60 }]
357
- });
358
-
359
347
  // src/schema/widget/footer.ts
360
- import { z as z12 } from "zod";
361
- var poweredBySchema = z12.object({
362
- text: z12.string().max(200).optional().describe("Visible attribution text (e.g. `Powered by Help AI`)."),
363
- href: z12.url().max(2048).optional().describe("Click target \u2014 the attribution becomes a link. Must be a full URL (`https://\u2026`)."),
364
- logoUrl: z12.url().max(2048).optional().describe("Small logo rendered before the text. Must be a full URL.")
348
+ import { z as z11 } from "zod";
349
+ var poweredBySchema = z11.object({
350
+ text: z11.string().max(200).optional().describe("Visible attribution text (e.g. `Powered by Help AI`)."),
351
+ href: z11.url().max(2048).optional().describe("Click target \u2014 the attribution becomes a link. Must be a full URL (`https://\u2026`)."),
352
+ logoUrl: z11.url().max(2048).optional().describe("Small logo rendered before the text. Must be a full URL.")
365
353
  }).loose().describe('"Powered by \u2026" attribution shown below the composer.').meta({
366
354
  examples: [
367
355
  { text: "Powered by Help AI" },
368
356
  { text: "Powered by Help AI", href: "https://help.ai", logoUrl: "https://help.ai/logo.svg" }
369
357
  ]
370
358
  });
371
- var footerSchema = z12.object({
359
+ var footerSchema = z11.object({
372
360
  poweredBy: poweredBySchema.optional(),
373
- composerDisclaimer: z12.string().max(500).optional().describe("Small muted text under the composer (like ChatGPT's 'ChatGPT can make mistakes.'). Empty = hidden.")
361
+ composerDisclaimer: z11.string().max(500).optional().describe("Small muted text under the composer (like ChatGPT's 'ChatGPT can make mistakes.'). Empty = hidden.")
374
362
  }).loose().describe("Footer \u2014 attribution + composer disclaimer.").meta({
375
363
  examples: [
376
364
  { poweredBy: { text: "Powered by Help AI", href: "https://help.ai" } },
@@ -379,8 +367,8 @@ var footerSchema = z12.object({
379
367
  });
380
368
 
381
369
  // src/schema/widget/forms.ts
382
- import { z as z13 } from "zod";
383
- var fieldTypeSchema = z13.enum([
370
+ import { z as z12 } from "zod";
371
+ var fieldTypeSchema = z12.enum([
384
372
  "text",
385
373
  "email",
386
374
  "tel",
@@ -394,59 +382,59 @@ var fieldTypeSchema = z13.enum([
394
382
  "checkbox",
395
383
  "multiselect"
396
384
  ]);
397
- var fieldOptionSchema = z13.object({
398
- value: z13.string().min(1).max(200).describe("The value recorded when this choice is picked."),
399
- label: z13.string().min(1).max(200).optional().describe("Display text; falls back to `value`."),
400
- description: z13.string().max(280).optional().describe("Optional sub-label under the choice.")
385
+ var fieldOptionSchema = z12.object({
386
+ value: z12.string().min(1).max(200).describe("The value recorded when this choice is picked."),
387
+ label: z12.string().min(1).max(200).optional().describe("Display text; falls back to `value`."),
388
+ description: z12.string().max(280).optional().describe("Optional sub-label under the choice.")
401
389
  }).loose();
402
- var fieldValidationSchema = z13.object({
403
- pattern: z13.string().max(500).optional().describe("Regex source string \u2014 text-like fields (e.g. `^\\d{5}$`)."),
404
- minLength: z13.number().int().min(0).max(1e4).optional(),
405
- maxLength: z13.number().int().min(1).max(1e4).optional(),
406
- min: z13.number().optional().describe("Minimum \u2014 `number` fields."),
407
- max: z13.number().optional().describe("Maximum \u2014 `number` fields."),
408
- minSelections: z13.number().int().min(0).max(50).optional().describe("Minimum picks \u2014 `multiselect`."),
409
- maxSelections: z13.number().int().min(1).max(50).optional().describe("Maximum picks \u2014 `multiselect`.")
390
+ var fieldValidationSchema = z12.object({
391
+ pattern: z12.string().max(500).optional().describe("Regex source string \u2014 text-like fields (e.g. `^\\d{5}$`)."),
392
+ minLength: z12.number().int().min(0).max(1e4).optional(),
393
+ maxLength: z12.number().int().min(1).max(1e4).optional(),
394
+ min: z12.number().optional().describe("Minimum \u2014 `number` fields."),
395
+ max: z12.number().optional().describe("Maximum \u2014 `number` fields."),
396
+ minSelections: z12.number().int().min(0).max(50).optional().describe("Minimum picks \u2014 `multiselect`."),
397
+ maxSelections: z12.number().int().min(1).max(50).optional().describe("Maximum picks \u2014 `multiselect`.")
410
398
  }).loose();
411
- var formFieldSchema = z13.object({
412
- name: z13.string().min(1).max(80).describe("Stable key the answer is recorded under (e.g. `email`)."),
413
- label: z13.string().min(1).max(200).describe("Visible field label."),
399
+ var formFieldSchema = z12.object({
400
+ name: z12.string().min(1).max(80).describe("Stable key the answer is recorded under (e.g. `email`)."),
401
+ label: z12.string().min(1).max(200).describe("Visible field label."),
414
402
  type: fieldTypeSchema.describe("Field renderer + built-in validation (email/tel/url/number/date/time checked)."),
415
- placeholder: z13.string().max(200).optional(),
416
- required: z13.boolean().optional().default(true).describe("Must be answered to submit. `false` allows skipping."),
417
- defaultValue: z13.string().max(2e3).optional().describe("Pre-filled value (comma-join for `multiselect`)."),
418
- options: z13.array(fieldOptionSchema).max(50).optional().describe("Choices for `select` / `radio` / `multiselect`."),
403
+ placeholder: z12.string().max(200).optional(),
404
+ required: z12.boolean().optional().default(true).describe("Must be answered to submit. `false` allows skipping."),
405
+ defaultValue: z12.string().max(2e3).optional().describe("Pre-filled value (comma-join for `multiselect`)."),
406
+ options: z12.array(fieldOptionSchema).max(50).optional().describe("Choices for `select` / `radio` / `multiselect`."),
419
407
  validation: fieldValidationSchema.optional(),
420
- allowOther: z13.boolean().optional().describe("`select`/`radio`/`multiselect` \u2014 allow a free-text 'Other' answer."),
421
- validationHint: z13.string().max(280).optional().describe("Small helper line under the field.")
408
+ allowOther: z12.boolean().optional().describe("`select`/`radio`/`multiselect` \u2014 allow a free-text 'Other' answer."),
409
+ validationHint: z12.string().max(280).optional().describe("Small helper line under the field.")
422
410
  }).loose();
423
- var formTriggerSchema = z13.string().regex(
411
+ var formTriggerSchema = z12.string().regex(
424
412
  /^(pre-chat|conversation-closed|panel-close|manual|after-messages:\d+|idle:\d+|page-area:.+)$/,
425
413
  "Unrecognised form trigger"
426
414
  ).describe(
427
415
  "When the form fires: `pre-chat`, `after-messages:N`, `conversation-closed`, `panel-close`, `idle:Nseconds`, `page-area:<area>`, or `manual`."
428
416
  );
429
- var formConditionSchema = z13.object({
430
- missingContext: z13.array(z13.string().max(80)).max(20).optional().describe("Only show if `userContext` lacks ALL of these keys (progressive profiling)."),
431
- pageArea: z13.union([z13.string().max(64), z13.array(z13.string().max(64)).max(20)]).optional().describe("Only on these `pageContext.area` values."),
432
- minMessages: z13.number().int().min(0).max(1e3).optional(),
433
- maxMessages: z13.number().int().min(0).max(1e3).optional()
417
+ var formConditionSchema = z12.object({
418
+ missingContext: z12.array(z12.string().max(80)).max(20).optional().describe("Only show if `userContext` lacks ALL of these keys (progressive profiling)."),
419
+ pageArea: z12.union([z12.string().max(64), z12.array(z12.string().max(64)).max(20)]).optional().describe("Only on these `pageContext.area` values."),
420
+ minMessages: z12.number().int().min(0).max(1e3).optional(),
421
+ maxMessages: z12.number().int().min(0).max(1e3).optional()
434
422
  }).loose();
435
- var formDefSchema = z13.object({
436
- id: z13.string().min(1).max(80).describe("Stable id \u2014 persistence dedupe + `manual` openForm(id)."),
437
- on: z13.union([formTriggerSchema, z13.array(formTriggerSchema).min(1).max(8)]).describe("Trigger(s) that surface this form."),
423
+ var formDefSchema = z12.object({
424
+ id: z12.string().min(1).max(80).describe("Stable id \u2014 persistence dedupe + `manual` openForm(id)."),
425
+ on: z12.union([formTriggerSchema, z12.array(formTriggerSchema).min(1).max(8)]).describe("Trigger(s) that surface this form."),
438
426
  when: formConditionSchema.optional().describe("Extra eligibility predicate evaluated when a trigger fires."),
439
- fields: z13.array(formFieldSchema).max(20).default([]).describe("The questions, in order. \u22651 required to show."),
440
- title: z13.string().max(120).optional(),
441
- description: z13.string().max(500).optional(),
442
- submitLabel: z13.string().max(60).optional(),
443
- skippable: z13.boolean().default(false).describe("Show a Skip control so the visitor can dismiss the form."),
444
- frequency: z13.enum(["once", "conversation", "always"]).default("once").describe("`once` (per device, persisted), `conversation` (re-eligible each new conversation), or `always`."),
445
- mirrorToContext: z13.boolean().default(true).describe(
427
+ fields: z12.array(formFieldSchema).max(20).default([]).describe("The questions, in order. \u22651 required to show."),
428
+ title: z12.string().max(120).optional(),
429
+ description: z12.string().max(500).optional(),
430
+ submitLabel: z12.string().max(60).optional(),
431
+ skippable: z12.boolean().default(false).describe("Show a Skip control so the visitor can dismiss the form."),
432
+ frequency: z12.enum(["once", "conversation", "always"]).default("once").describe("`once` (per device, persisted), `conversation` (re-eligible each new conversation), or `always`."),
433
+ mirrorToContext: z12.boolean().default(true).describe(
446
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."
447
435
  )
448
436
  }).loose();
449
- var formsSchema = z13.array(formDefSchema).max(20).describe(
437
+ var formsSchema = z12.array(formDefSchema).max(20).describe(
450
438
  "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
439
  ).meta({
452
440
  examples: [
@@ -489,9 +477,9 @@ var formsSchema = z13.array(formDefSchema).max(20).describe(
489
477
  });
490
478
 
491
479
  // src/schema/widget/i18n.ts
492
- import { z as z14 } from "zod";
493
- var localeStringsSchema = z14.record(z14.string(), z14.string());
494
- var stringsOverrideSchema = z14.union([localeStringsSchema, z14.record(localeSchema, localeStringsSchema)]).describe(
480
+ import { z as z13 } from "zod";
481
+ var localeStringsSchema = z13.record(z13.string(), z13.string());
482
+ var stringsOverrideSchema = z13.union([localeStringsSchema, z13.record(localeSchema, localeStringsSchema)]).describe(
495
483
  "Per-instance UI string overrides. Flat = active-locale only; nested = multi-locale map. Both forms are partial \u2014 missing keys fall through to built-in defaults."
496
484
  ).meta({
497
485
  examples: [
@@ -502,10 +490,10 @@ var stringsOverrideSchema = z14.union([localeStringsSchema, z14.record(localeSch
502
490
  }
503
491
  ]
504
492
  });
505
- var i18nSchema = z14.object({
493
+ var i18nSchema = z13.object({
506
494
  locale: localeSchema.optional().describe("BCP-47 locale tag forced for this widget instance (e.g. `fr-CA`). Page-owner explicit override."),
507
- defaultLocale: z14.union([z14.literal("auto"), localeSchema]).default("auto").describe("Initial / fallback locale for users who haven't picked one. `auto` sniffs `navigator.language`."),
508
- availableLocales: z14.array(localeSchema).max(200).optional().describe("BCP-47 locale tags shown in the runtime language switcher. Hidden when fewer than 2 entries."),
495
+ defaultLocale: z13.union([z13.literal("auto"), localeSchema]).default("auto").describe("Initial / fallback locale for users who haven't picked one. `auto` sniffs `navigator.language`."),
496
+ availableLocales: z13.array(localeSchema).max(200).optional().describe("BCP-47 locale tags shown in the runtime language switcher. Hidden when fewer than 2 entries."),
509
497
  strings: stringsOverrideSchema.optional()
510
498
  }).loose().describe("Locale + i18n overrides.").meta({
511
499
  examples: [
@@ -516,44 +504,44 @@ var i18nSchema = z14.object({
516
504
  });
517
505
 
518
506
  // src/schema/widget/modules.ts
519
- import { z as z15 } from "zod";
520
- var moduleLayoutSchema = z15.enum(["chat", "home", "help", "news"]);
521
- var moduleSchema = z15.object({
522
- label: z15.string().min(1).max(40).describe(
507
+ import { z as z14 } from "zod";
508
+ var moduleLayoutSchema = z14.enum(["chat", "home", "help", "news"]);
509
+ var moduleSchema = z14.object({
510
+ label: z14.string().min(1).max(40).describe(
523
511
  "Tab label \u2014 an i18n key (resolved against the i18n strings, e.g. `tabHome`) or a literal. Translations ride `i18n.strings`."
524
512
  ),
525
513
  layout: moduleLayoutSchema.describe(
526
514
  "UI layout that renders this tab: `chat` (the conversation), `home`, `help`, or `news`."
527
515
  ),
528
- contentTags: z15.array(z15.string().max(60)).max(20).optional().describe(
516
+ contentTags: z14.array(z14.string().max(60)).max(20).optional().describe(
529
517
  "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."
530
518
  ),
531
- id: z15.string().max(60).optional().describe(
519
+ id: z14.string().max(60).optional().describe(
532
520
  "Stable id for navigation + last-tab persistence. Defaults to the first `contentTags` entry, else `layout`."
533
521
  ),
534
522
  // ── `home` layout config (flat feature flags — no block authoring) ──────
535
- brandName: z15.string().max(80).optional().describe("`home` \u2014 hero wordmark (e.g. your company name)."),
536
- showGreeting: z15.boolean().optional().describe("`home` \u2014 show the greeting hero (default true)."),
537
- greetingText: z15.string().max(280).optional().describe("`home` \u2014 override the greeting headline (default 'How can we help?'); supports a `{name}` token."),
538
- userAvatars: z15.array(
539
- z15.object({
540
- name: z15.string().min(1).max(80),
541
- avatar: z15.string().max(2048).optional().describe("Image URL; falls back to initials of `name`."),
542
- role: z15.string().max(80).optional()
523
+ brandName: z14.string().max(80).optional().describe("`home` \u2014 hero wordmark (e.g. your company name)."),
524
+ showGreeting: z14.boolean().optional().describe("`home` \u2014 show the greeting hero (default true)."),
525
+ greetingText: z14.string().max(280).optional().describe("`home` \u2014 override the greeting headline (default 'How can we help?'); supports a `{name}` token."),
526
+ userAvatars: z14.array(
527
+ z14.object({
528
+ name: z14.string().min(1).max(80),
529
+ avatar: z14.string().max(2048).optional().describe("Image URL; falls back to initials of `name`."),
530
+ role: z14.string().max(80).optional()
543
531
  }).loose()
544
532
  ).max(10).optional().describe("`home` \u2014 team/agent avatars shown in the hero."),
545
- showSearchBar: z15.boolean().optional().describe("`home` \u2014 show the 'Search for help' bar (default true)."),
546
- showRecentConversations: z15.boolean().optional().describe("`home` \u2014 show the visitor's most recent conversation card (default true)."),
547
- status: z15.object({
548
- text: z15.string().min(1).max(120),
549
- level: z15.string().max(40).optional().describe(
533
+ showSearchBar: z14.boolean().optional().describe("`home` \u2014 show the 'Search for help' bar (default true)."),
534
+ showRecentConversations: z14.boolean().optional().describe("`home` \u2014 show the visitor's most recent conversation card (default true)."),
535
+ status: z14.object({
536
+ text: z14.string().min(1).max(120),
537
+ level: z14.string().max(40).optional().describe(
550
538
  "`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."
551
539
  ).meta({ examples: ["operational", "degraded", "down"] }),
552
- url: z15.string().max(2048).optional().describe("Opens in an in-widget iframe when tapped.")
540
+ url: z14.string().max(2048).optional().describe("Opens in an in-widget iframe when tapped.")
553
541
  }).optional().describe("`home` \u2014 system-status card. Omit to hide."),
554
- contentBlockTitle: z15.string().max(80).optional().describe("`home` \u2014 heading for the content list built from `contentTags` (default 'Popular articles').")
542
+ contentBlockTitle: z14.string().max(80).optional().describe("`home` \u2014 heading for the content list built from `contentTags` (default 'Popular articles').")
555
543
  }).loose();
556
- var modulesSchema = z15.array(moduleSchema).max(4).describe(
544
+ var modulesSchema = z14.array(moduleSchema).max(4).describe(
557
545
  "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."
558
546
  ).meta({
559
547
  examples: [
@@ -576,10 +564,10 @@ var modulesSchema = z15.array(moduleSchema).max(4).describe(
576
564
  });
577
565
 
578
566
  // src/schema/widget.ts
579
- var endpointsSchema = z16.object({
580
- upload: z16.string().min(1).max(2048).default("/ai/agent/upload-file"),
581
- transcribe: z16.string().min(1).max(2048).default("/ai/agent/transcribe-audio"),
582
- submitForm: z16.string().min(1).max(2048).default("/ai/agent/submit-form").describe(
567
+ var endpointsSchema = z15.object({
568
+ upload: z15.string().min(1).max(2048).default("/ai/agent/upload-file"),
569
+ transcribe: z15.string().min(1).max(2048).default("/ai/agent/transcribe-audio"),
570
+ submitForm: z15.string().min(1).max(2048).default("/ai/agent/submit-form").describe(
583
571
  "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."
584
572
  )
585
573
  }).loose().describe("HTTP endpoint overrides. Paths are appended to baseUrl; absolute URLs are accepted too.").meta({
@@ -589,14 +577,14 @@ var endpointsSchema = z16.object({
589
577
  { submitForm: "https://crm.acme.com/leads" }
590
578
  ]
591
579
  });
592
- var userContextSchema = z16.object({
593
- 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)."),
594
- email: z16.string().min(1).max(320).optional().describe("User email \u2014 surfaced to the agent for context (optional)."),
595
- name: z16.string().min(1).max(200).optional().describe("Display name \u2014 shown in the Home greeting (`{name}`) and conversation transcripts (optional)."),
596
- plan: z16.string().min(1).max(120).optional().describe("Subscription / pricing tier, e.g. `pro` (optional)."),
597
- role: z16.string().min(1).max(120).optional().describe("The user's role on the host site, e.g. `admin` (optional)."),
598
- phone: z16.string().min(1).max(40).optional().describe("Phone number (optional).")
599
- }).catchall(z16.union([z16.string(), z16.number(), z16.boolean()])).describe(
580
+ var userContextSchema = z15.object({
581
+ id: z15.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)."),
582
+ email: z15.string().min(1).max(320).optional().describe("User email \u2014 surfaced to the agent for context (optional)."),
583
+ name: z15.string().min(1).max(200).optional().describe("Display name \u2014 shown in the Home greeting (`{name}`) and conversation transcripts (optional)."),
584
+ plan: z15.string().min(1).max(120).optional().describe("Subscription / pricing tier, e.g. `pro` (optional)."),
585
+ role: z15.string().min(1).max(120).optional().describe("The user's role on the host site, e.g. `admin` (optional)."),
586
+ phone: z15.string().min(1).max(40).optional().describe("Phone number (optional).")
587
+ }).catchall(z15.union([z15.string(), z15.number(), z15.boolean()])).describe(
600
588
  "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."
601
589
  ).meta({
602
590
  examples: [{ id: "u_123" }, { id: "u_123", email: "alex@acme.com", name: "Alex Lee", plan: "pro" }]
@@ -612,31 +600,31 @@ var PAGE_AREA_SUGGESTIONS = [
612
600
  "account",
613
601
  "blog"
614
602
  ];
615
- var pageContextSchema = z16.object({
616
- area: z16.string().min(1).max(64).optional().describe(`Host-defined surface the visitor is on. Free-form; suggested: ${PAGE_AREA_SUGGESTIONS.join(" | ")}.`),
617
- url: z16.string().min(1).max(2048).optional().describe("Full page URL. Auto-filled from the host page when omitted."),
618
- path: z16.string().min(1).max(2048).optional().describe("Page path, e.g. `/pricing/enterprise`."),
619
- title: z16.string().min(1).max(300).optional().describe("Human-readable page title.")
620
- }).catchall(z16.union([z16.string(), z16.number(), z16.boolean()])).describe(
603
+ var pageContextSchema = z15.object({
604
+ area: z15.string().min(1).max(64).optional().describe(`Host-defined surface the visitor is on. Free-form; suggested: ${PAGE_AREA_SUGGESTIONS.join(" | ")}.`),
605
+ url: z15.string().min(1).max(2048).optional().describe("Full page URL. Auto-filled from the host page when omitted."),
606
+ path: z15.string().min(1).max(2048).optional().describe("Page path, e.g. `/pricing/enterprise`."),
607
+ title: z15.string().min(1).max(300).optional().describe("Human-readable page title.")
608
+ }).catchall(z15.union([z15.string(), z15.number(), z15.boolean()])).describe(
621
609
  "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."
622
610
  ).meta({ examples: [{ area: "pricing", path: "/pricing" }, { area: "help-desk" }] });
623
- var connectionConfigSchema = z16.object({
624
- widgetId: z16.string().min(1).max(80).default("default").describe(
611
+ var connectionConfigSchema = z15.object({
612
+ widgetId: z15.string().min(1).max(80).default("default").describe(
625
613
  "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."
626
614
  ),
627
- publicKey: z16.string().min(1).max(200).optional().describe(
615
+ publicKey: z15.string().min(1).max(200).optional().describe(
628
616
  "Workspace-scoped public key (`agent_pk_\u2026`) issued from the dashboard. Sent on every API call as the `x-public-key` header."
629
617
  ),
630
- aiAgentDeploymentId: z16.string().min(1).max(200).optional().describe(
618
+ aiAgentDeploymentId: z15.string().min(1).max(200).optional().describe(
631
619
  "Deployment UUID from the dashboard. Picks which agent / settings bundle answers this mount. Sent as `x-ai-agent-deployment-id`."
632
620
  ),
633
- baseUrl: z16.string().min(1).max(2048).optional().describe(
621
+ baseUrl: z15.string().min(1).max(2048).optional().describe(
634
622
  "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."
635
623
  ),
636
624
  userContext: userContextSchema.optional(),
637
625
  pageContext: pageContextSchema.optional(),
638
626
  endpoints: endpointsSchema.optional(),
639
- debug: z16.union([z16.boolean(), z16.enum(["off", "error", "warn", "info", "debug", "trace"])]).optional().describe(
627
+ debug: z15.union([z15.boolean(), z15.enum(["off", "error", "warn", "info", "debug", "trace"])]).optional().describe(
640
628
  '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.'
641
629
  )
642
630
  }).loose().describe(
@@ -656,14 +644,13 @@ var connectionConfigSchema = z16.object({
656
644
  }
657
645
  ]
658
646
  });
659
- var widgetSettingsSchema = z16.object({
647
+ var widgetSettingsSchema = z15.object({
660
648
  presentation: presentationSchema.optional(),
661
649
  behavior: behaviorSchema.optional(),
662
650
  theme: themeFieldSchema.default("auto").describe("Theme preference (`auto` follows OS) or a tokens override object (`accent`, `radius`, `fontFamily`)."),
663
651
  launcher: launcherOptionsSchema.optional(),
664
652
  header: headerSchema.optional(),
665
653
  composer: composerOptionsSchema.optional(),
666
- welcome: welcomeOptionsSchema.optional(),
667
654
  feedback: feedbackSchema.optional(),
668
655
  i18n: i18nSchema.optional(),
669
656
  footer: footerSchema.optional(),
@@ -689,10 +676,10 @@ var widgetSettingsSchema = z16.object({
689
676
  });
690
677
  var widgetConfigSchema = connectionConfigSchema.extend({
691
678
  ...widgetSettingsSchema.shape,
692
- site: z16.unknown().optional().describe(
679
+ site: z15.unknown().optional().describe(
693
680
  'Site config \u2014 applies in `mode: "page"`. Comes from the start-conversation response, not user-edited.'
694
681
  ),
695
- blocks: z16.unknown().optional().describe('Blocks (nav + link cards) \u2014 applies in `mode: "page"`. Comes from the start-conversation response.')
682
+ blocks: z15.unknown().optional().describe('Blocks (nav + link cards) \u2014 applies in `mode: "page"`. Comes from the start-conversation response.')
696
683
  }).describe(
697
684
  "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."
698
685
  ).meta({
@@ -715,49 +702,49 @@ var widgetSettingsPartialSchema = widgetSettingsSchema.partial();
715
702
  var connectionConfigPartialSchema = connectionConfigSchema.partial();
716
703
 
717
704
  // src/schema/deployment.ts
718
- import { z as z17 } from "zod";
705
+ import { z as z16 } from "zod";
719
706
  var serverConfigSchema = widgetSettingsSchema.partial();
720
- var siteConfigSchema = z17.object({
721
- title: z17.string().min(1).max(120).optional().describe("Brand / site name. Used as the logo's alt-text fallback."),
707
+ var siteConfigSchema = z16.object({
708
+ title: z16.string().min(1).max(120).optional().describe("Brand / site name. Used as the logo's alt-text fallback."),
722
709
  logo: assetSchema.optional().describe("Brand logo shown at the top of the page-mode sidebar."),
723
710
  logoDark: assetSchema.optional().describe(
724
711
  "Optional dark-theme logo variant. Falls back to `logo` when the active theme is light or `logoDark` is unset."
725
712
  )
726
713
  }).loose();
727
- var blocksConfigSchema = z17.object({
728
- navigation: z17.array(linkSchema).max(100).optional().describe("Sidebar navigation links (vertical list, primary nav)."),
729
- linkCards: z17.array(linkSchema).max(100).optional().describe("Sidebar link cards (richer entries with optional `description`).")
714
+ var blocksConfigSchema = z16.object({
715
+ navigation: z16.array(linkSchema).max(100).optional().describe("Sidebar navigation links (vertical list, primary nav)."),
716
+ linkCards: z16.array(linkSchema).max(100).optional().describe("Sidebar link cards (richer entries with optional `description`).")
730
717
  }).loose();
731
- var handshakeWelcomeMessageSchema = z17.object({
732
- id: z17.string(),
733
- role: z17.enum(["assistant", "system"]),
734
- text: z17.string()
718
+ var handshakeWelcomeMessageSchema = z16.object({
719
+ id: z16.string(),
720
+ role: z16.enum(["assistant", "system"]),
721
+ text: z16.string()
735
722
  }).loose();
736
- var handshakeWelcomeSuggestionSchema = z17.object({
737
- id: z17.string(),
738
- label: z17.string(),
739
- text: z17.string().optional()
723
+ var handshakeWelcomeSuggestionSchema = z16.object({
724
+ id: z16.string(),
725
+ label: z16.string(),
726
+ text: z16.string().optional()
740
727
  }).loose();
741
- var rebindReasonSchema = z17.enum(["conflict", "expired", "invalid"]);
742
- var startConversationResponseSchema = z17.object({
743
- deployment: z17.object({
744
- id: z17.string(),
745
- name: z17.string(),
728
+ var rebindReasonSchema = z16.enum(["conflict", "expired", "invalid"]);
729
+ var startConversationResponseSchema = z16.object({
730
+ deployment: z16.object({
731
+ id: z16.string(),
732
+ name: z16.string(),
746
733
  // Page URL identifier — present on every deployment; unique per host.
747
734
  // Used to mount page deployments via `?slug=…`.
748
- slug: z17.string().optional(),
749
- publicKey: z17.string().optional()
735
+ slug: z16.string().optional(),
736
+ publicKey: z16.string().optional()
750
737
  // Deliberately no `type` / `channel` here. Deployment-level
751
738
  // taxonomy is a backend categorization concern — the widget's
752
739
  // rendering choice flows from `widget.presentation.mode`, not
753
740
  // the deployment record's category. `.loose()` lets any such
754
741
  // backend field pass through without typing.
755
742
  }).loose(),
756
- agent: z17.object({
757
- id: z17.string(),
758
- name: z17.string(),
759
- title: z17.string().optional(),
760
- status: z17.enum(["online", "away", "offline"]).optional()
743
+ agent: z16.object({
744
+ id: z16.string(),
745
+ name: z16.string(),
746
+ title: z16.string().optional(),
747
+ status: z16.enum(["online", "away", "offline"]).optional()
761
748
  }).loose(),
762
749
  /**
763
750
  * Deployment-wide widget configuration the dashboard admin saved
@@ -767,26 +754,26 @@ var startConversationResponseSchema = z17.object({
767
754
  config: serverConfigSchema.optional(),
768
755
  site: siteConfigSchema.optional(),
769
756
  blocks: blocksConfigSchema.optional(),
770
- welcome: z17.object({
771
- messages: z17.array(handshakeWelcomeMessageSchema).optional(),
772
- suggestions: z17.array(handshakeWelcomeSuggestionSchema).optional()
757
+ welcome: z16.object({
758
+ messages: z16.array(handshakeWelcomeMessageSchema).optional(),
759
+ suggestions: z16.array(handshakeWelcomeSuggestionSchema).optional()
773
760
  }).loose().optional(),
774
- visitorId: z17.string(),
775
- conversationId: z17.string(),
776
- canContinue: z17.boolean(),
777
- messages: z17.array(z17.unknown()),
761
+ visitorId: z16.string(),
762
+ conversationId: z16.string(),
763
+ canContinue: z16.boolean(),
764
+ messages: z16.array(z16.unknown()),
778
765
  /**
779
766
  * Form submissions recorded for this conversation — echoed like
780
767
  * `messages` so the widget reconstructs the collapsed "form submitted"
781
768
  * timeline markers on resume. `createdAt` is ISO-8601 (a serialized
782
769
  * Mongo ISODate — same format as message `createdAt`).
783
770
  */
784
- formSubmissions: z17.array(
785
- z17.object({
786
- formId: z17.string(),
787
- trigger: z17.string(),
788
- skipped: z17.boolean().optional(),
789
- createdAt: z17.iso.datetime().optional()
771
+ formSubmissions: z16.array(
772
+ z16.object({
773
+ formId: z16.string(),
774
+ trigger: z16.string(),
775
+ skipped: z16.boolean().optional(),
776
+ createdAt: z16.iso.datetime().optional()
790
777
  }).loose()
791
778
  ).optional(),
792
779
  /**
@@ -795,11 +782,11 @@ var startConversationResponseSchema = z17.object({
795
782
  * what THIS visitor toggled inside the widget, not the
796
783
  * deployment's admin-set defaults.
797
784
  */
798
- userPrefs: z17.record(z17.string(), z17.unknown()).optional(),
785
+ userPrefs: z16.record(z16.string(), z16.unknown()).optional(),
799
786
  // Present only when the server rotated the request `visitorId` /
800
787
  // `conversationId`. Purely advisory — client must adopt the response ids
801
788
  // verbatim regardless of whether this block is present.
802
- rebind: z17.object({
789
+ rebind: z16.object({
803
790
  visitorId: rebindReasonSchema.optional(),
804
791
  conversationId: rebindReasonSchema.optional()
805
792
  }).loose().optional()
@@ -809,7 +796,7 @@ var startConversationResponseSchema = z17.object({
809
796
  import "zod";
810
797
 
811
798
  // src/schema/json-schema.ts
812
- import { z as z19 } from "zod";
799
+ import { z as z18 } from "zod";
813
800
 
814
801
  // src/configurator/field-help.tsx
815
802
  import { createPortal } from "preact/compat";