@helpai/elements 0.13.1 → 0.14.1

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/package.json CHANGED
@@ -80,5 +80,5 @@
80
80
  ],
81
81
  "type": "module",
82
82
  "types": "./index.d.ts",
83
- "version": "0.13.1"
83
+ "version": "0.14.1"
84
84
  }
package/schema.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, E as Endpoints, L as Link, P as PAGE_AREA_SUGGESTIONS, g as PageContext, S as ServerConfig, b as SiteConfig, c as StartSessionResponse, U as UserContext, W as WidgetConfig, d as WidgetConfigPartial, e as WidgetSettings, f as WidgetSettingsPartial, h as assetSchema, i as blocksConfigSchema, j as connectionConfigPartialSchema, k as connectionConfigSchema, l as cssColorSchema, m as cssLengthSchema, n as endpointsSchema, o as linkSchema, p as localeSchema, q as pageContextSchema, s as serverConfigSchema, r as siteConfigSchema, t as startSessionResponseSchema, u as userContextSchema, v as uuid7Schema, w as widgetConfigPartialSchema, x as widgetConfigSchema, y as widgetSettingsPartialSchema, z as widgetSettingsSchema } from './deployment-Big98MYV.js';
1
+ export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, E as Endpoints, L as Link, P as PAGE_AREA_SUGGESTIONS, g as PageContext, S as ServerConfig, b as SiteConfig, c as StartSessionResponse, U as UserContext, W as WidgetConfig, d as WidgetConfigPartial, e as WidgetSettings, f as WidgetSettingsPartial, h as assetSchema, i as blocksConfigSchema, j as connectionConfigPartialSchema, k as connectionConfigSchema, l as cssColorSchema, m as cssLengthSchema, n as endpointsSchema, o as linkSchema, p as localeSchema, q as pageContextSchema, s as serverConfigSchema, r as siteConfigSchema, t as startSessionResponseSchema, u as userContextSchema, v as uuid7Schema, w as widgetConfigPartialSchema, x as widgetConfigSchema, y as widgetSettingsPartialSchema, z as widgetSettingsSchema } from './deployment-DYIboFNT.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  /**
@@ -548,50 +548,30 @@ declare const footerSchema: z.ZodObject<{
548
548
  type FooterOptions = z.infer<typeof footerSchema>;
549
549
 
550
550
  /**
551
- * i18n section schemas locale resolution + per-instance string
552
- * overrides.
551
+ * Forms section — an **event-driven forms engine**. A deployment declares an
552
+ * ordered array of form definitions, each bound to trigger event(s), shown as a
553
+ * a prompt that replaces the composer (gating chat until submit/skip), deduped
554
+ * by frequency, and recorded via one shared submit endpoint (`endpoints.submitForm`).
553
555
  *
554
- * The runtime layers three sources to pick the active locale (highest
555
- * wins): user picker server-pushed `locale` field `defaultLocale`
556
- * (or `"auto"` `navigator.language`). `availableLocales` controls the
557
- * runtime language switcher's option list.
558
- */
559
-
560
- declare const stringsOverrideSchema: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>]>;
561
- type StringsOverride = z.infer<typeof stringsOverrideSchema>;
562
- declare const i18nSchema: z.ZodObject<{
563
- locale: z.ZodOptional<z.ZodString>;
564
- defaultLocale: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodString]>>;
565
- availableLocales: z.ZodOptional<z.ZodArray<z.ZodString>>;
566
- strings: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>]>>;
567
- }, z.core.$loose>;
568
- type I18nOptions = z.infer<typeof i18nSchema>;
569
-
570
- /**
571
- * Intake section — the pre-chat **lead/sales capture form**, modeled as a
572
- * deterministic array of typed fields with validation. When enabled it renders
573
- * as a **blocking gate**: the visitor completes (or skips, if `skippable`) the
574
- * form before the composer unlocks.
575
- *
576
- * The same {@link formFieldSchema} shape is reused at runtime by the AI-driven
577
- * **ask-input tool** (`src/ui/tool-ask-input.tsx`), so a sales/support/lead
578
- * agent can both capture a lead up-front and ask for more structured info
579
- * mid-conversation through one form engine.
580
- *
581
- * Off by default — existing deployments are unchanged. See
582
- * `docs/api/hitl-and-forms.md` for the wire contract + agent presets.
556
+ * Generic across verticals (healthcare, insurance, dealerships, clinics) the
557
+ * widget has NO industry logic; a clinic triage intake, an insurance claim form,
558
+ * a CSAT survey, and a sales lead capture are all just different `forms` config.
559
+ * The same field shape powers the AI ask-input tool. See
560
+ * `docs/api/hitl-and-forms.md` + `docs/features/forms-and-hitl.md`.
583
561
  */
584
562
 
585
563
  declare const fieldTypeSchema: z.ZodEnum<{
586
564
  number: "number";
587
565
  select: "select";
588
566
  textarea: "textarea";
567
+ time: "time";
589
568
  text: "text";
590
569
  checkbox: "checkbox";
591
570
  radio: "radio";
592
571
  url: "url";
593
572
  email: "email";
594
573
  tel: "tel";
574
+ date: "date";
595
575
  multiselect: "multiselect";
596
576
  }>;
597
577
  type FieldType = z.infer<typeof fieldTypeSchema>;
@@ -618,12 +598,14 @@ declare const formFieldSchema: z.ZodObject<{
618
598
  number: "number";
619
599
  select: "select";
620
600
  textarea: "textarea";
601
+ time: "time";
621
602
  text: "text";
622
603
  checkbox: "checkbox";
623
604
  radio: "radio";
624
605
  url: "url";
625
606
  email: "email";
626
607
  tel: "tel";
608
+ date: "date";
627
609
  multiselect: "multiselect";
628
610
  }>;
629
611
  placeholder: z.ZodOptional<z.ZodString>;
@@ -647,10 +629,86 @@ declare const formFieldSchema: z.ZodObject<{
647
629
  validationHint: z.ZodOptional<z.ZodString>;
648
630
  }, z.core.$loose>;
649
631
  type FormField = z.infer<typeof formFieldSchema>;
650
- declare const intakeSchema: z.ZodObject<{
651
- enabled: z.ZodDefault<z.ZodBoolean>;
632
+ /**
633
+ * Trigger string: a bare event, or `event:param` for the parameterised ones.
634
+ * `pre-chat` · `after-messages:N` · `conversation-closed` · `panel-close` ·
635
+ * `idle:Nseconds` · `page-area:<area>` · `manual`.
636
+ */
637
+ declare const formTriggerSchema: z.ZodString;
638
+ declare const formConditionSchema: z.ZodObject<{
639
+ missingContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
640
+ pageArea: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
641
+ minMessages: z.ZodOptional<z.ZodNumber>;
642
+ maxMessages: z.ZodOptional<z.ZodNumber>;
643
+ }, z.core.$loose>;
644
+ type FormCondition = z.infer<typeof formConditionSchema>;
645
+ declare const formDefSchema: z.ZodObject<{
646
+ id: z.ZodString;
647
+ on: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
648
+ when: z.ZodOptional<z.ZodObject<{
649
+ missingContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
650
+ pageArea: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
651
+ minMessages: z.ZodOptional<z.ZodNumber>;
652
+ maxMessages: z.ZodOptional<z.ZodNumber>;
653
+ }, z.core.$loose>>;
654
+ fields: z.ZodDefault<z.ZodArray<z.ZodObject<{
655
+ name: z.ZodString;
656
+ label: z.ZodString;
657
+ type: z.ZodEnum<{
658
+ number: "number";
659
+ select: "select";
660
+ textarea: "textarea";
661
+ time: "time";
662
+ text: "text";
663
+ checkbox: "checkbox";
664
+ radio: "radio";
665
+ url: "url";
666
+ email: "email";
667
+ tel: "tel";
668
+ date: "date";
669
+ multiselect: "multiselect";
670
+ }>;
671
+ placeholder: z.ZodOptional<z.ZodString>;
672
+ required: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
673
+ defaultValue: z.ZodOptional<z.ZodString>;
674
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
675
+ value: z.ZodString;
676
+ label: z.ZodOptional<z.ZodString>;
677
+ description: z.ZodOptional<z.ZodString>;
678
+ }, z.core.$loose>>>;
679
+ validation: z.ZodOptional<z.ZodObject<{
680
+ pattern: z.ZodOptional<z.ZodString>;
681
+ minLength: z.ZodOptional<z.ZodNumber>;
682
+ maxLength: z.ZodOptional<z.ZodNumber>;
683
+ min: z.ZodOptional<z.ZodNumber>;
684
+ max: z.ZodOptional<z.ZodNumber>;
685
+ minSelections: z.ZodOptional<z.ZodNumber>;
686
+ maxSelections: z.ZodOptional<z.ZodNumber>;
687
+ }, z.core.$loose>>;
688
+ allowOther: z.ZodOptional<z.ZodBoolean>;
689
+ validationHint: z.ZodOptional<z.ZodString>;
690
+ }, z.core.$loose>>>;
652
691
  title: z.ZodOptional<z.ZodString>;
653
692
  description: z.ZodOptional<z.ZodString>;
693
+ submitLabel: z.ZodOptional<z.ZodString>;
694
+ skippable: z.ZodDefault<z.ZodBoolean>;
695
+ frequency: z.ZodDefault<z.ZodEnum<{
696
+ once: "once";
697
+ session: "session";
698
+ always: "always";
699
+ }>>;
700
+ mirrorToContext: z.ZodDefault<z.ZodBoolean>;
701
+ }, z.core.$loose>;
702
+ type FormDef = z.infer<typeof formDefSchema>;
703
+ declare const formsSchema: z.ZodArray<z.ZodObject<{
704
+ id: z.ZodString;
705
+ on: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
706
+ when: z.ZodOptional<z.ZodObject<{
707
+ missingContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
708
+ pageArea: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
709
+ minMessages: z.ZodOptional<z.ZodNumber>;
710
+ maxMessages: z.ZodOptional<z.ZodNumber>;
711
+ }, z.core.$loose>>;
654
712
  fields: z.ZodDefault<z.ZodArray<z.ZodObject<{
655
713
  name: z.ZodString;
656
714
  label: z.ZodString;
@@ -658,12 +716,14 @@ declare const intakeSchema: z.ZodObject<{
658
716
  number: "number";
659
717
  select: "select";
660
718
  textarea: "textarea";
719
+ time: "time";
661
720
  text: "text";
662
721
  checkbox: "checkbox";
663
722
  radio: "radio";
664
723
  url: "url";
665
724
  email: "email";
666
725
  tel: "tel";
726
+ date: "date";
667
727
  multiselect: "multiselect";
668
728
  }>;
669
729
  placeholder: z.ZodOptional<z.ZodString>;
@@ -686,10 +746,38 @@ declare const intakeSchema: z.ZodObject<{
686
746
  allowOther: z.ZodOptional<z.ZodBoolean>;
687
747
  validationHint: z.ZodOptional<z.ZodString>;
688
748
  }, z.core.$loose>>>;
749
+ title: z.ZodOptional<z.ZodString>;
750
+ description: z.ZodOptional<z.ZodString>;
689
751
  submitLabel: z.ZodOptional<z.ZodString>;
690
752
  skippable: z.ZodDefault<z.ZodBoolean>;
753
+ frequency: z.ZodDefault<z.ZodEnum<{
754
+ once: "once";
755
+ session: "session";
756
+ always: "always";
757
+ }>>;
758
+ mirrorToContext: z.ZodDefault<z.ZodBoolean>;
759
+ }, z.core.$loose>>;
760
+ type Forms = z.infer<typeof formsSchema>;
761
+
762
+ /**
763
+ * i18n section schemas — locale resolution + per-instance string
764
+ * overrides.
765
+ *
766
+ * The runtime layers three sources to pick the active locale (highest
767
+ * wins): user picker → server-pushed → `locale` field → `defaultLocale`
768
+ * (or `"auto"` → `navigator.language`). `availableLocales` controls the
769
+ * runtime language switcher's option list.
770
+ */
771
+
772
+ declare const stringsOverrideSchema: z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>]>;
773
+ type StringsOverride = z.infer<typeof stringsOverrideSchema>;
774
+ declare const i18nSchema: z.ZodObject<{
775
+ locale: z.ZodOptional<z.ZodString>;
776
+ defaultLocale: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<"auto">, z.ZodString]>>;
777
+ availableLocales: z.ZodOptional<z.ZodArray<z.ZodString>>;
778
+ strings: z.ZodOptional<z.ZodUnion<readonly [z.ZodRecord<z.ZodString, z.ZodString>, z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>>]>>;
691
779
  }, z.core.$loose>;
692
- type Intake = z.infer<typeof intakeSchema>;
780
+ type I18nOptions = z.infer<typeof i18nSchema>;
693
781
 
694
782
  /**
695
783
  * Modules section — the Intercom-style "messenger" surface, modeled as a
@@ -811,4 +899,4 @@ declare const ALL_MODES: readonly Mode[];
811
899
  */
812
900
  declare function emitJsonSchema(): unknown;
813
901
 
814
- export { ALL_MODES, type ActionName, type AttachmentLimits, type Behavior, type CalloutPosition, type CalloutShape, type ComposerOptions, type FeatureFlags, type FeedbackEvent, type FeedbackOptions, type FieldOption, type FieldType, type FieldValidation, type FooterOptions, type FormField, type HapticsOptions, type HeaderActions, type HeaderOptions, type I18nOptions, type Intake, type LauncherCallout, type LauncherOptions, type LauncherSize, type LauncherVariant, type Mode, type ModuleLayout, type ModuleOptions, type ModulesOptions, type Position, type PoweredBy, type Presentation, type ResizeOptions, type ResponseMode, type SendButtonOptions, type SizeOptions, type SoundOptions, type StringsOverride, type ThemeOverrides, type ThemePreference, type VoiceMode, type WelcomeAnimation, type WelcomeOptions, actionNameSchema, attachmentLimitsSchema, behaviorSchema, calloutPositionSchema, calloutShapeSchema, composerOptionsSchema, emitJsonSchema, featureFlagsSchema, feedbackEventSchema, feedbackSchema, fieldOptionSchema, fieldTypeSchema, fieldValidationSchema, footerSchema, formFieldSchema, hapticsOptionsSchema, headerActionsSchema, headerSchema, i18nSchema, initialSizeSchema, intakeSchema, launcherCalloutSchema, launcherOptionsSchema, launcherSizeSchema, launcherVariantSchema, modeSchema, moduleLayoutSchema, moduleSchema, modulesSchema, positionSchema, poweredBySchema, presentationSchema, resizeOptionsSchema, responseModeSchema, sendButtonIconSchema, sendButtonOptionsSchema, sendButtonShapeSchema, sendButtonVariantSchema, sizeOptionsSchema, soundOptionsSchema, stringsOverrideSchema, themeFieldSchema, themeOverridesSchema, themePreferenceSchema, toolRefSchema, voiceModeSchema, welcomeAnimationSchema, welcomeOptionsSchema, widgetSettingsSchemaForMode };
902
+ export { ALL_MODES, type ActionName, type AttachmentLimits, type Behavior, type CalloutPosition, type CalloutShape, type ComposerOptions, type FeatureFlags, type FeedbackEvent, type FeedbackOptions, type FieldOption, type FieldType, type FieldValidation, type FooterOptions, type FormCondition, type FormDef, type FormField, type Forms, type HapticsOptions, type HeaderActions, type HeaderOptions, type I18nOptions, type LauncherCallout, type LauncherOptions, type LauncherSize, type LauncherVariant, type Mode, type ModuleLayout, type ModuleOptions, type ModulesOptions, type Position, type PoweredBy, type Presentation, type ResizeOptions, type ResponseMode, type SendButtonOptions, type SizeOptions, type SoundOptions, type StringsOverride, type ThemeOverrides, type ThemePreference, type VoiceMode, type WelcomeAnimation, type WelcomeOptions, actionNameSchema, attachmentLimitsSchema, behaviorSchema, calloutPositionSchema, calloutShapeSchema, composerOptionsSchema, emitJsonSchema, featureFlagsSchema, feedbackEventSchema, feedbackSchema, fieldOptionSchema, fieldTypeSchema, fieldValidationSchema, footerSchema, formConditionSchema, formDefSchema, formFieldSchema, formTriggerSchema, formsSchema, hapticsOptionsSchema, headerActionsSchema, headerSchema, i18nSchema, initialSizeSchema, launcherCalloutSchema, launcherOptionsSchema, launcherSizeSchema, launcherVariantSchema, modeSchema, moduleLayoutSchema, moduleSchema, modulesSchema, positionSchema, poweredBySchema, presentationSchema, resizeOptionsSchema, responseModeSchema, sendButtonIconSchema, sendButtonOptionsSchema, sendButtonShapeSchema, sendButtonVariantSchema, sizeOptionsSchema, soundOptionsSchema, stringsOverrideSchema, themeFieldSchema, themeOverridesSchema, themePreferenceSchema, toolRefSchema, voiceModeSchema, welcomeAnimationSchema, welcomeOptionsSchema, widgetSettingsSchemaForMode };