@helpai/elements 0.30.0 → 0.31.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/package.json CHANGED
@@ -80,5 +80,5 @@
80
80
  ],
81
81
  "type": "module",
82
82
  "types": "./index.d.ts",
83
- "version": "0.30.0"
83
+ "version": "0.31.0"
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, H as HandshakeResponse, L as Link, P as PAGE_AREA_SUGGESTIONS, f as PageContext, S as ServerConfig, b as SiteConfig, U as UserContext, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial, g as assetSchema, h as blocksConfigSchema, i as connectionConfigPartialSchema, j as connectionConfigSchema, k as cssColorSchema, l as cssLengthSchema, m as endpointsSchema, n as handshakeResponseSchema, o as linkSchema, p as localeSchema, q as pageContextSchema, s as serverConfigSchema, r as siteConfigSchema, u as userContextSchema, t as uuid7Schema, w as widgetConfigPartialSchema, v as widgetConfigSchema, x as widgetSettingsPartialSchema, y as widgetSettingsSchema } from './deployment-E-Jyc0nF.js';
1
+ export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, E as Endpoints, H as HandshakeResponse, L as Link, P as PAGE_AREA_SUGGESTIONS, f as PageContext, S as ServerConfig, b as SiteConfig, U as UserContext, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial, g as assetSchema, h as blocksConfigSchema, i as connectionConfigPartialSchema, j as connectionConfigSchema, k as cssColorSchema, l as cssLengthSchema, m as endpointsSchema, n as handshakeResponseSchema, o as linkSchema, p as localeSchema, q as pageContextSchema, s as serverConfigSchema, r as siteConfigSchema, u as userContextSchema, t as uuid7Schema, w as widgetConfigPartialSchema, v as widgetConfigSchema, x as widgetSettingsPartialSchema, y as widgetSettingsSchema } from './deployment-DRGLrW2j.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  /**
@@ -56,9 +56,9 @@ declare const presentationSchema: z.ZodObject<{
56
56
  inset: z.ZodOptional<z.ZodString>;
57
57
  initialSize: z.ZodDefault<z.ZodEnum<{
58
58
  fullscreen: "fullscreen";
59
- normal: "normal";
60
59
  expanded: "expanded";
61
60
  auto: "auto";
61
+ normal: "normal";
62
62
  }>>;
63
63
  autoSizeBreakpoint: z.ZodDefault<z.ZodNumber>;
64
64
  }, z.core.$loose>>;
@@ -240,9 +240,9 @@ type LauncherOptions = z.infer<typeof launcherOptionsSchema>;
240
240
 
241
241
  declare const initialSizeSchema: z.ZodEnum<{
242
242
  fullscreen: "fullscreen";
243
- normal: "normal";
244
243
  expanded: "expanded";
245
244
  auto: "auto";
245
+ normal: "normal";
246
246
  }>;
247
247
  declare const resizeOptionsSchema: z.ZodObject<{
248
248
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -269,9 +269,9 @@ declare const sizeOptionsSchema: z.ZodObject<{
269
269
  inset: z.ZodOptional<z.ZodString>;
270
270
  initialSize: z.ZodDefault<z.ZodEnum<{
271
271
  fullscreen: "fullscreen";
272
- normal: "normal";
273
272
  expanded: "expanded";
274
273
  auto: "auto";
274
+ normal: "normal";
275
275
  }>>;
276
276
  autoSizeBreakpoint: z.ZodDefault<z.ZodNumber>;
277
277
  }, z.core.$loose>;
@@ -323,43 +323,43 @@ type FeatureFlags = z.infer<typeof featureFlagsSchema>;
323
323
  */
324
324
 
325
325
  declare const actionNameSchema: z.ZodEnum<{
326
+ close: "close";
326
327
  expand: "expand";
327
328
  fullscreen: "fullscreen";
328
329
  popOut: "popOut";
329
- close: "close";
330
- language: "language";
330
+ clear: "clear";
331
331
  theme: "theme";
332
+ language: "language";
332
333
  textSize: "textSize";
333
334
  history: "history";
334
- clear: "clear";
335
335
  sound: "sound";
336
336
  }>;
337
337
  type ActionName = z.infer<typeof actionNameSchema>;
338
338
  declare const headerActionsSchema: z.ZodArray<z.ZodEnum<{
339
+ close: "close";
339
340
  expand: "expand";
340
341
  fullscreen: "fullscreen";
341
342
  popOut: "popOut";
342
- close: "close";
343
- language: "language";
343
+ clear: "clear";
344
344
  theme: "theme";
345
+ language: "language";
345
346
  textSize: "textSize";
346
347
  history: "history";
347
- clear: "clear";
348
348
  sound: "sound";
349
349
  }>>;
350
350
  type HeaderActions = z.infer<typeof headerActionsSchema>;
351
351
  /** Section wrapper — `actions` list wrapped under `header` in the dashboard form. */
352
352
  declare const headerSchema: z.ZodObject<{
353
353
  actions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
354
+ close: "close";
354
355
  expand: "expand";
355
356
  fullscreen: "fullscreen";
356
357
  popOut: "popOut";
357
- close: "close";
358
- language: "language";
358
+ clear: "clear";
359
359
  theme: "theme";
360
+ language: "language";
360
361
  textSize: "textSize";
361
362
  history: "history";
362
- clear: "clear";
363
363
  sound: "sound";
364
364
  }>>>;
365
365
  }, z.core.$loose>;
@@ -375,33 +375,33 @@ type HeaderOptions = z.infer<typeof headerSchema>;
375
375
  */
376
376
 
377
377
  declare const feedbackEventSchema: z.ZodEnum<{
378
+ voiceStart: "voiceStart";
379
+ voiceStop: "voiceStop";
378
380
  error: "error";
379
381
  messageReceived: "messageReceived";
380
382
  messageSent: "messageSent";
381
- voiceStart: "voiceStart";
382
- voiceStop: "voiceStop";
383
383
  }>;
384
384
  type FeedbackEvent = z.infer<typeof feedbackEventSchema>;
385
385
  declare const soundOptionsSchema: z.ZodObject<{
386
386
  enabled: z.ZodDefault<z.ZodBoolean>;
387
387
  volume: z.ZodDefault<z.ZodNumber>;
388
388
  events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
389
+ voiceStart: "voiceStart";
390
+ voiceStop: "voiceStop";
389
391
  error: "error";
390
392
  messageReceived: "messageReceived";
391
393
  messageSent: "messageSent";
392
- voiceStart: "voiceStart";
393
- voiceStop: "voiceStop";
394
394
  }> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
395
395
  }, z.core.$loose>;
396
396
  type SoundOptions = z.infer<typeof soundOptionsSchema>;
397
397
  declare const hapticsOptionsSchema: z.ZodObject<{
398
398
  enabled: z.ZodDefault<z.ZodBoolean>;
399
399
  events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
400
+ voiceStart: "voiceStart";
401
+ voiceStop: "voiceStop";
400
402
  error: "error";
401
403
  messageReceived: "messageReceived";
402
404
  messageSent: "messageSent";
403
- voiceStart: "voiceStart";
404
- voiceStop: "voiceStop";
405
405
  }> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
406
406
  }, z.core.$loose>;
407
407
  type HapticsOptions = z.infer<typeof hapticsOptionsSchema>;
@@ -410,21 +410,21 @@ declare const feedbackSchema: z.ZodObject<{
410
410
  enabled: z.ZodDefault<z.ZodBoolean>;
411
411
  volume: z.ZodDefault<z.ZodNumber>;
412
412
  events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
413
+ voiceStart: "voiceStart";
414
+ voiceStop: "voiceStop";
413
415
  error: "error";
414
416
  messageReceived: "messageReceived";
415
417
  messageSent: "messageSent";
416
- voiceStart: "voiceStart";
417
- voiceStop: "voiceStop";
418
418
  }> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
419
419
  }, z.core.$loose>>;
420
420
  haptics: z.ZodOptional<z.ZodObject<{
421
421
  enabled: z.ZodDefault<z.ZodBoolean>;
422
422
  events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
423
+ voiceStart: "voiceStart";
424
+ voiceStop: "voiceStop";
423
425
  error: "error";
424
426
  messageReceived: "messageReceived";
425
427
  messageSent: "messageSent";
426
- voiceStart: "voiceStart";
427
- voiceStop: "voiceStop";
428
428
  }> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
429
429
  }, z.core.$loose>>;
430
430
  }, z.core.$loose>;
@@ -624,6 +624,48 @@ declare const formConditionSchema: z.ZodObject<{
624
624
  maxMessages: z.ZodOptional<z.ZodNumber>;
625
625
  }, z.core.$loose>;
626
626
  type FormCondition = z.infer<typeof formConditionSchema>;
627
+ /**
628
+ * Per-locale overrides of a form's HUMAN-FACING strings only. Structure (field
629
+ * `name` / `type` / `validation`, option `value`) is shared across locales and
630
+ * stays canonical — a translation matches the canonical form by the stable
631
+ * `name` (field) / `value` (option) keys; absent strings fall back to the
632
+ * top-level (defaultLocale) copy. The data module trims `translations` to the
633
+ * requested `?locale=` (≤1 entry); the widget overlays it (`overlayFormDef`).
634
+ */
635
+ declare const fieldOptionTranslationSchema: z.ZodObject<{
636
+ value: z.ZodString;
637
+ label: z.ZodOptional<z.ZodString>;
638
+ description: z.ZodOptional<z.ZodString>;
639
+ }, z.core.$loose>;
640
+ declare const formFieldTranslationSchema: z.ZodObject<{
641
+ name: z.ZodString;
642
+ label: z.ZodOptional<z.ZodString>;
643
+ placeholder: z.ZodOptional<z.ZodString>;
644
+ validationHint: z.ZodOptional<z.ZodString>;
645
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
646
+ value: z.ZodString;
647
+ label: z.ZodOptional<z.ZodString>;
648
+ description: z.ZodOptional<z.ZodString>;
649
+ }, z.core.$loose>>>;
650
+ }, z.core.$loose>;
651
+ declare const formTranslationSchema: z.ZodObject<{
652
+ locale: z.ZodString;
653
+ title: z.ZodOptional<z.ZodString>;
654
+ description: z.ZodOptional<z.ZodString>;
655
+ submitLabel: z.ZodOptional<z.ZodString>;
656
+ fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
657
+ name: z.ZodString;
658
+ label: z.ZodOptional<z.ZodString>;
659
+ placeholder: z.ZodOptional<z.ZodString>;
660
+ validationHint: z.ZodOptional<z.ZodString>;
661
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
662
+ value: z.ZodString;
663
+ label: z.ZodOptional<z.ZodString>;
664
+ description: z.ZodOptional<z.ZodString>;
665
+ }, z.core.$loose>>>;
666
+ }, z.core.$loose>>>;
667
+ }, z.core.$loose>;
668
+ type FormTranslation = z.infer<typeof formTranslationSchema>;
627
669
  declare const formDefSchema: z.ZodObject<{
628
670
  id: z.ZodString;
629
671
  on: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
@@ -682,6 +724,24 @@ declare const formDefSchema: z.ZodObject<{
682
724
  mirrorToContext: z.ZodDefault<z.ZodBoolean>;
683
725
  reopenable: z.ZodDefault<z.ZodBoolean>;
684
726
  reviewable: z.ZodDefault<z.ZodBoolean>;
727
+ defaultLocale: z.ZodOptional<z.ZodString>;
728
+ translations: z.ZodOptional<z.ZodArray<z.ZodObject<{
729
+ locale: z.ZodString;
730
+ title: z.ZodOptional<z.ZodString>;
731
+ description: z.ZodOptional<z.ZodString>;
732
+ submitLabel: z.ZodOptional<z.ZodString>;
733
+ fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
734
+ name: z.ZodString;
735
+ label: z.ZodOptional<z.ZodString>;
736
+ placeholder: z.ZodOptional<z.ZodString>;
737
+ validationHint: z.ZodOptional<z.ZodString>;
738
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
739
+ value: z.ZodString;
740
+ label: z.ZodOptional<z.ZodString>;
741
+ description: z.ZodOptional<z.ZodString>;
742
+ }, z.core.$loose>>>;
743
+ }, z.core.$loose>>>;
744
+ }, z.core.$loose>>>;
685
745
  }, z.core.$loose>;
686
746
  type FormDef = z.infer<typeof formDefSchema>;
687
747
  declare const formsSchema: z.ZodArray<z.ZodObject<{
@@ -742,6 +802,24 @@ declare const formsSchema: z.ZodArray<z.ZodObject<{
742
802
  mirrorToContext: z.ZodDefault<z.ZodBoolean>;
743
803
  reopenable: z.ZodDefault<z.ZodBoolean>;
744
804
  reviewable: z.ZodDefault<z.ZodBoolean>;
805
+ defaultLocale: z.ZodOptional<z.ZodString>;
806
+ translations: z.ZodOptional<z.ZodArray<z.ZodObject<{
807
+ locale: z.ZodString;
808
+ title: z.ZodOptional<z.ZodString>;
809
+ description: z.ZodOptional<z.ZodString>;
810
+ submitLabel: z.ZodOptional<z.ZodString>;
811
+ fields: z.ZodOptional<z.ZodArray<z.ZodObject<{
812
+ name: z.ZodString;
813
+ label: z.ZodOptional<z.ZodString>;
814
+ placeholder: z.ZodOptional<z.ZodString>;
815
+ validationHint: z.ZodOptional<z.ZodString>;
816
+ options: z.ZodOptional<z.ZodArray<z.ZodObject<{
817
+ value: z.ZodString;
818
+ label: z.ZodOptional<z.ZodString>;
819
+ description: z.ZodOptional<z.ZodString>;
820
+ }, z.core.$loose>>>;
821
+ }, z.core.$loose>>>;
822
+ }, z.core.$loose>>>;
745
823
  }, z.core.$loose>>;
746
824
  type Forms = z.infer<typeof formsSchema>;
747
825
 
@@ -781,18 +859,18 @@ type I18nOptions = z.infer<typeof i18nSchema>;
781
859
  */
782
860
 
783
861
  declare const moduleLayoutSchema: z.ZodEnum<{
862
+ home: "home";
784
863
  chat: "chat";
785
864
  help: "help";
786
- home: "home";
787
865
  news: "news";
788
866
  }>;
789
867
  type ModuleLayout = z.infer<typeof moduleLayoutSchema>;
790
868
  declare const moduleSchema: z.ZodObject<{
791
869
  label: z.ZodString;
792
870
  layout: z.ZodEnum<{
871
+ home: "home";
793
872
  chat: "chat";
794
873
  help: "help";
795
- home: "home";
796
874
  news: "news";
797
875
  }>;
798
876
  contentTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -818,9 +896,9 @@ type ModuleOptions = z.infer<typeof moduleSchema>;
818
896
  declare const modulesSchema: z.ZodArray<z.ZodObject<{
819
897
  label: z.ZodString;
820
898
  layout: z.ZodEnum<{
899
+ home: "home";
821
900
  chat: "chat";
822
901
  help: "help";
823
- home: "home";
824
902
  news: "news";
825
903
  }>;
826
904
  contentTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -902,4 +980,4 @@ declare const ALL_MODES: readonly Mode[];
902
980
  */
903
981
  declare function emitJsonSchema(): unknown;
904
982
 
905
- 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 TrackingSettings, type VoiceMode, 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, trackingSchema, voiceModeSchema, widgetSettingsSchemaForMode };
983
+ 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 FormTranslation, 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 TrackingSettings, type VoiceMode, actionNameSchema, attachmentLimitsSchema, behaviorSchema, calloutPositionSchema, calloutShapeSchema, composerOptionsSchema, emitJsonSchema, featureFlagsSchema, feedbackEventSchema, feedbackSchema, fieldOptionSchema, fieldOptionTranslationSchema, fieldTypeSchema, fieldValidationSchema, footerSchema, formConditionSchema, formDefSchema, formFieldSchema, formFieldTranslationSchema, formTranslationSchema, 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, trackingSchema, voiceModeSchema, widgetSettingsSchemaForMode };
package/schema.json CHANGED
@@ -628,7 +628,7 @@
628
628
  "properties": {
629
629
  "text": {
630
630
  "default": "👋 Hi! Need any help?",
631
- "description": "The message to show in the bubble. Defaults to a friendly greeting; replace with your own copy (e.g. 'Click here →' or 'Try our new feature!').",
631
+ "description": "The message to show in the bubble. Defaults to a friendly greeting; replace with your own copy (e.g. 'Click here →'). May also be an i18n key (e.g. `launcherCallout`) resolved against `i18n.strings` for per-locale copy; a non-key literal renders as-is.",
632
632
  "type": "string",
633
633
  "minLength": 1,
634
634
  "maxLength": 500
@@ -1590,6 +1590,104 @@
1590
1590
  "default": true,
1591
1591
  "description": "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.",
1592
1592
  "type": "boolean"
1593
+ },
1594
+ "defaultLocale": {
1595
+ "description": "BCP-47 locale the top-level strings (title / fields copy) are authored in.",
1596
+ "type": "string",
1597
+ "minLength": 1,
1598
+ "maxLength": 35
1599
+ },
1600
+ "translations": {
1601
+ "description": "Per-locale string overrides — the data module trims to the bootstrap `?locale=` (≤1); the widget overlays it onto the default copy.",
1602
+ "maxItems": 50,
1603
+ "type": "array",
1604
+ "items": {
1605
+ "type": "object",
1606
+ "properties": {
1607
+ "locale": {
1608
+ "type": "string",
1609
+ "minLength": 1,
1610
+ "maxLength": 35,
1611
+ "description": "BCP-47 locale tag (e.g. `en`, `fr-CA`, `zh-Hant-HK`)."
1612
+ },
1613
+ "title": {
1614
+ "type": "string",
1615
+ "maxLength": 120
1616
+ },
1617
+ "description": {
1618
+ "type": "string",
1619
+ "maxLength": 500
1620
+ },
1621
+ "submitLabel": {
1622
+ "type": "string",
1623
+ "maxLength": 60
1624
+ },
1625
+ "fields": {
1626
+ "maxItems": 50,
1627
+ "type": "array",
1628
+ "items": {
1629
+ "type": "object",
1630
+ "properties": {
1631
+ "name": {
1632
+ "type": "string",
1633
+ "minLength": 1,
1634
+ "maxLength": 80,
1635
+ "description": "The canonical field `name` this localizes."
1636
+ },
1637
+ "label": {
1638
+ "type": "string",
1639
+ "minLength": 1,
1640
+ "maxLength": 200
1641
+ },
1642
+ "placeholder": {
1643
+ "type": "string",
1644
+ "maxLength": 200
1645
+ },
1646
+ "validationHint": {
1647
+ "type": "string",
1648
+ "maxLength": 280
1649
+ },
1650
+ "options": {
1651
+ "maxItems": 50,
1652
+ "type": "array",
1653
+ "items": {
1654
+ "type": "object",
1655
+ "properties": {
1656
+ "value": {
1657
+ "type": "string",
1658
+ "minLength": 1,
1659
+ "maxLength": 200,
1660
+ "description": "The canonical option `value` this localizes."
1661
+ },
1662
+ "label": {
1663
+ "type": "string",
1664
+ "minLength": 1,
1665
+ "maxLength": 200
1666
+ },
1667
+ "description": {
1668
+ "type": "string",
1669
+ "maxLength": 280
1670
+ }
1671
+ },
1672
+ "required": [
1673
+ "value"
1674
+ ],
1675
+ "additionalProperties": {}
1676
+ }
1677
+ }
1678
+ },
1679
+ "required": [
1680
+ "name"
1681
+ ],
1682
+ "additionalProperties": {}
1683
+ }
1684
+ }
1685
+ },
1686
+ "required": [
1687
+ "locale"
1688
+ ],
1689
+ "additionalProperties": {}
1690
+ }
1593
1691
  }
1594
1692
  },
1595
1693
  "required": [
@@ -2395,7 +2493,7 @@
2395
2493
  "properties": {
2396
2494
  "text": {
2397
2495
  "default": "👋 Hi! Need any help?",
2398
- "description": "The message to show in the bubble. Defaults to a friendly greeting; replace with your own copy (e.g. 'Click here →' or 'Try our new feature!').",
2496
+ "description": "The message to show in the bubble. Defaults to a friendly greeting; replace with your own copy (e.g. 'Click here →'). May also be an i18n key (e.g. `launcherCallout`) resolved against `i18n.strings` for per-locale copy; a non-key literal renders as-is.",
2399
2497
  "type": "string",
2400
2498
  "minLength": 1,
2401
2499
  "maxLength": 500
package/schema.mjs CHANGED
@@ -171,7 +171,7 @@ var calloutShapeSchema = z6.enum(["pill", "bubble", "callout"]);
171
171
  var calloutPositionSchema = z6.enum(["auto", "horizontal", "vertical"]);
172
172
  var launcherCalloutSchema = z6.object({
173
173
  text: z6.string().min(1).max(500).default("\u{1F44B} Hi! Need any help?").describe(
174
- "The message to show in the bubble. Defaults to a friendly greeting; replace with your own copy (e.g. 'Click here \u2192' or 'Try our new feature!')."
174
+ "The message to show in the bubble. Defaults to a friendly greeting; replace with your own copy (e.g. 'Click here \u2192'). May also be an i18n key (e.g. `launcherCallout`) resolved against `i18n.strings` for per-locale copy; a non-key literal renders as-is."
175
175
  ),
176
176
  shape: calloutShapeSchema.default("pill").describe("Visual shape \u2014 `pill` (slim label + arrow), `bubble` (speech-bubble tail), `callout` (loud variant)."),
177
177
  position: calloutPositionSchema.default("auto").describe(
@@ -417,6 +417,25 @@ var formConditionSchema = z12.object({
417
417
  minMessages: z12.number().int().min(0).max(1e3).optional(),
418
418
  maxMessages: z12.number().int().min(0).max(1e3).optional()
419
419
  }).loose();
420
+ var fieldOptionTranslationSchema = z12.object({
421
+ value: z12.string().min(1).max(200).describe("The canonical option `value` this localizes."),
422
+ label: z12.string().min(1).max(200).optional(),
423
+ description: z12.string().max(280).optional()
424
+ }).loose();
425
+ var formFieldTranslationSchema = z12.object({
426
+ name: z12.string().min(1).max(80).describe("The canonical field `name` this localizes."),
427
+ label: z12.string().min(1).max(200).optional(),
428
+ placeholder: z12.string().max(200).optional(),
429
+ validationHint: z12.string().max(280).optional(),
430
+ options: z12.array(fieldOptionTranslationSchema).max(50).optional()
431
+ }).loose();
432
+ var formTranslationSchema = z12.object({
433
+ locale: localeSchema,
434
+ title: z12.string().max(120).optional(),
435
+ description: z12.string().max(500).optional(),
436
+ submitLabel: z12.string().max(60).optional(),
437
+ fields: z12.array(formFieldTranslationSchema).max(50).optional()
438
+ }).loose();
420
439
  var formDefSchema = z12.object({
421
440
  id: z12.string().min(1).max(80).describe("Stable id \u2014 persistence dedupe + `manual` openForm(id)."),
422
441
  on: z12.union([formTriggerSchema, z12.array(formTriggerSchema).min(1).max(8)]).describe("Trigger(s) that surface this form."),
@@ -435,6 +454,10 @@ var formDefSchema = z12.object({
435
454
  ),
436
455
  reviewable: z12.boolean().default(true).describe(
437
456
  "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."
457
+ ),
458
+ defaultLocale: localeSchema.optional().describe("BCP-47 locale the top-level strings (title / fields copy) are authored in."),
459
+ translations: z12.array(formTranslationSchema).max(50).optional().describe(
460
+ "Per-locale string overrides \u2014 the data module trims to the bootstrap `?locale=` (\u22641); the widget overlays it onto the default copy."
438
461
  )
439
462
  }).loose();
440
463
  var formsSchema = z12.array(formDefSchema).max(20).describe(
@@ -871,12 +894,15 @@ export {
871
894
  feedbackEventSchema,
872
895
  feedbackSchema,
873
896
  fieldOptionSchema,
897
+ fieldOptionTranslationSchema,
874
898
  fieldTypeSchema,
875
899
  fieldValidationSchema,
876
900
  footerSchema,
877
901
  formConditionSchema,
878
902
  formDefSchema,
879
903
  formFieldSchema,
904
+ formFieldTranslationSchema,
905
+ formTranslationSchema,
880
906
  formTriggerSchema,
881
907
  formsSchema,
882
908
  handshakeResponseSchema,
@@ -3,16 +3,22 @@
3
3
  *
4
4
  * Attributes mirror {@link ChatWidgetOptions} (kebab-cased: `public-key`,
5
5
  * `ai-agent-deployment-id`, `mode`, `theme`, `base-url`, …). Reactive
6
- * attributes trigger a re-mount when they change at runtime — see
6
+ * attributes trigger a re-resolve when they change at runtime — see
7
7
  * {@link REACTIVE_ATTRS}.
8
8
  *
9
9
  * Mode resolution: the tag itself doesn't pin a default mode. When no
10
10
  * `mode=…` attribute is set, the resolver default (`"floating"`) seeds
11
11
  * the very first frame — which the App's handshake gate keeps blank
12
- * — then the server's pushed `widget.presentation.mode` wins via
13
- * `mergeServerConfig` (subscribed in `boot()` below). Drop a bare
14
- * `<web-ai-chat public-key="…" ai-agent-deployment-id="…">` on the
15
- * page and the deployment's dashboard config drives the layout.
12
+ * — then the server's pushed `widget.presentation.mode` wins via the
13
+ * shared runtime's handshake merge. Drop a bare `<web-ai-chat
14
+ * public-key="…" ai-agent-deployment-id="…">` on the page and the
15
+ * deployment's dashboard config drives the layout.
16
+ *
17
+ * Everything between `<App>` and the shadow host — the ErrorBoundary, the
18
+ * handshake-config merge, the usage tracker, host-attribute application — lives
19
+ * in the shared {@link createWidgetRuntime} that `mount()` (`src/index.ts`) also
20
+ * uses, so the two boot paths can't drift. This file owns only what's specific
21
+ * to the custom element: attribute parsing and the connect/disconnect lifecycle.
16
22
  */
17
23
  declare function registerWebComponent(): void;
18
24