@helpai/elements 0.16.0 → 0.17.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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, L as Link, S as ServerConfig, b as SiteConfig, c as StartConversationResponse, W as WidgetConfig, d as WidgetConfigPartial, e as WidgetSettings, f as WidgetSettingsPartial } from './deployment-DvzmRV7E.js';
1
+ export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, L as Link, S as ServerConfig, b as SiteConfig, c as StartConversationResponse, W as WidgetConfig, d as WidgetConfigPartial, e as WidgetSettings, f as WidgetSettingsPartial } from './deployment-BvNoqfIC.js';
2
2
  import 'zod';
3
3
 
4
4
  /**
@@ -141,11 +141,13 @@ interface WireMessage {
141
141
  role: "user" | "assistant" | "system";
142
142
  parts: WirePart[];
143
143
  /**
144
- * Epoch milliseconds the message was created. Optional so older backends
145
- * still parse; when present, the widget shows the real send time (and groups
146
- * messages by day) on reload instead of falling back to "now".
144
+ * ISO-8601 timestamp the message was created (a serialized Mongo ISODate,
145
+ * e.g. `2026-06-10T07:50:55.816Z`) every wire date uses this format.
146
+ * Optional so older backends still parse; when present, the widget shows
147
+ * the real send time (and groups messages by day) on reload instead of
148
+ * falling back to "now". Parse with {@link parseWireDate}.
147
149
  */
148
- createdAt?: number;
150
+ createdAt?: string;
149
151
  }
150
152
  type WirePart = {
151
153
  type: "text";
@@ -190,8 +192,8 @@ interface FormSubmissionRecord {
190
192
  trigger: string;
191
193
  /** True when the visitor skipped instead of answering. */
192
194
  skipped?: boolean;
193
- /** Epoch ms — same clock + name as {@link WireMessage.createdAt}. */
194
- createdAt?: number;
195
+ /** ISO-8601 — same format + name as {@link WireMessage.createdAt}. */
196
+ createdAt?: string;
195
197
  }
196
198
  /** One-shot bot persona shown in the panel header. */
197
199
  interface ConversationAgent {
package/index.mjs CHANGED
@@ -1214,6 +1214,11 @@ function encodeContext(user, page) {
1214
1214
  }
1215
1215
 
1216
1216
  // src/stream/protocol.ts
1217
+ function parseWireDate(value) {
1218
+ if (!value) return void 0;
1219
+ const ms = Date.parse(value);
1220
+ return Number.isFinite(ms) ? ms : void 0;
1221
+ }
1217
1222
  var DEFAULT_PATHS = {
1218
1223
  /** Conversation bootstrap. `POST` → deployment config + per-visitor state. */
1219
1224
  startConversation: "/ai/agent/start-conversation",
@@ -1263,7 +1268,8 @@ function buildSendMessageRequest(params) {
1263
1268
  id: m.id,
1264
1269
  parts: messageToWireParts(m),
1265
1270
  role: m.role,
1266
- createdAt: m.createdAt
1271
+ // Internal clock is epoch ms; the wire speaks ISO-8601 (Mongo ISODate).
1272
+ createdAt: m.createdAt !== void 0 ? new Date(m.createdAt).toISOString() : void 0
1267
1273
  }));
1268
1274
  const body = {
1269
1275
  messages: wire,
@@ -1912,7 +1918,7 @@ function fromWireMessage(w) {
1912
1918
  role: w.role,
1913
1919
  // Real send time when the backend provides it; otherwise fall back to now
1914
1920
  // (older backends) so the timestamp + day divider still render.
1915
- createdAt: w.createdAt ?? Date.now(),
1921
+ createdAt: parseWireDate(w.createdAt) ?? Date.now(),
1916
1922
  status: "complete",
1917
1923
  partsSig: signal(parts)
1918
1924
  };
@@ -6464,7 +6470,7 @@ function App({ options, hostElement, bus }) {
6464
6470
  key: `wire:${rec.formId}:${rec.createdAt ?? i}`,
6465
6471
  formId: rec.formId,
6466
6472
  outcome: rec.skipped ? "skipped" : "submitted",
6467
- createdAt: rec.createdAt
6473
+ createdAt: parseWireDate(rec.createdAt)
6468
6474
  }))
6469
6475
  );
6470
6476
  const tail = resumeBubbleRef.current ? [resumeBubbleRef.current] : [];
package/package.json CHANGED
@@ -80,5 +80,5 @@
80
80
  ],
81
81
  "type": "module",
82
82
  "types": "./index.d.ts",
83
- "version": "0.16.0"
83
+ "version": "0.17.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, L as Link, P as PAGE_AREA_SUGGESTIONS, g as PageContext, S as ServerConfig, b as SiteConfig, c as StartConversationResponse, 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 startConversationResponseSchema, u as userContextSchema, v as uuid7Schema, w as widgetConfigPartialSchema, x as widgetConfigSchema, y as widgetSettingsPartialSchema, z as widgetSettingsSchema } from './deployment-DvzmRV7E.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 StartConversationResponse, 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 startConversationResponseSchema, u as userContextSchema, v as uuid7Schema, w as widgetConfigPartialSchema, x as widgetConfigSchema, y as widgetSettingsPartialSchema, z as widgetSettingsSchema } from './deployment-BvNoqfIC.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>>;
@@ -148,9 +148,9 @@ declare const launcherSizeSchema: z.ZodEnum<{
148
148
  }>;
149
149
  type LauncherSize = z.infer<typeof launcherSizeSchema>;
150
150
  declare const calloutShapeSchema: z.ZodEnum<{
151
+ callout: "callout";
151
152
  pill: "pill";
152
153
  bubble: "bubble";
153
- callout: "callout";
154
154
  }>;
155
155
  type CalloutShape = z.infer<typeof calloutShapeSchema>;
156
156
  declare const calloutPositionSchema: z.ZodEnum<{
@@ -162,9 +162,9 @@ type CalloutPosition = z.infer<typeof calloutPositionSchema>;
162
162
  declare const launcherCalloutSchema: z.ZodObject<{
163
163
  text: z.ZodDefault<z.ZodString>;
164
164
  shape: z.ZodDefault<z.ZodEnum<{
165
+ callout: "callout";
165
166
  pill: "pill";
166
167
  bubble: "bubble";
167
- callout: "callout";
168
168
  }>>;
169
169
  position: z.ZodDefault<z.ZodEnum<{
170
170
  auto: "auto";
@@ -195,9 +195,9 @@ declare const launcherOptionsSchema: z.ZodObject<{
195
195
  callout: z.ZodOptional<z.ZodObject<{
196
196
  text: z.ZodDefault<z.ZodString>;
197
197
  shape: z.ZodDefault<z.ZodEnum<{
198
+ callout: "callout";
198
199
  pill: "pill";
199
200
  bubble: "bubble";
200
- callout: "callout";
201
201
  }>>;
202
202
  position: z.ZodDefault<z.ZodEnum<{
203
203
  auto: "auto";
@@ -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>;
@@ -565,16 +565,16 @@ type FooterOptions = z.infer<typeof footerSchema>;
565
565
 
566
566
  declare const fieldTypeSchema: z.ZodEnum<{
567
567
  number: "number";
568
+ select: "select";
569
+ textarea: "textarea";
570
+ time: "time";
568
571
  text: "text";
572
+ checkbox: "checkbox";
573
+ radio: "radio";
569
574
  url: "url";
570
575
  email: "email";
571
576
  tel: "tel";
572
577
  date: "date";
573
- time: "time";
574
- textarea: "textarea";
575
- select: "select";
576
- radio: "radio";
577
- checkbox: "checkbox";
578
578
  multiselect: "multiselect";
579
579
  }>;
580
580
  type FieldType = z.infer<typeof fieldTypeSchema>;
@@ -599,16 +599,16 @@ declare const formFieldSchema: z.ZodObject<{
599
599
  label: z.ZodString;
600
600
  type: z.ZodEnum<{
601
601
  number: "number";
602
+ select: "select";
603
+ textarea: "textarea";
604
+ time: "time";
602
605
  text: "text";
606
+ checkbox: "checkbox";
607
+ radio: "radio";
603
608
  url: "url";
604
609
  email: "email";
605
610
  tel: "tel";
606
611
  date: "date";
607
- time: "time";
608
- textarea: "textarea";
609
- select: "select";
610
- radio: "radio";
611
- checkbox: "checkbox";
612
612
  multiselect: "multiselect";
613
613
  }>;
614
614
  placeholder: z.ZodOptional<z.ZodString>;
@@ -659,16 +659,16 @@ declare const formDefSchema: z.ZodObject<{
659
659
  label: z.ZodString;
660
660
  type: z.ZodEnum<{
661
661
  number: "number";
662
+ select: "select";
663
+ textarea: "textarea";
664
+ time: "time";
662
665
  text: "text";
666
+ checkbox: "checkbox";
667
+ radio: "radio";
663
668
  url: "url";
664
669
  email: "email";
665
670
  tel: "tel";
666
671
  date: "date";
667
- time: "time";
668
- textarea: "textarea";
669
- select: "select";
670
- radio: "radio";
671
- checkbox: "checkbox";
672
672
  multiselect: "multiselect";
673
673
  }>;
674
674
  placeholder: z.ZodOptional<z.ZodString>;
@@ -717,16 +717,16 @@ declare const formsSchema: z.ZodArray<z.ZodObject<{
717
717
  label: z.ZodString;
718
718
  type: z.ZodEnum<{
719
719
  number: "number";
720
+ select: "select";
721
+ textarea: "textarea";
722
+ time: "time";
720
723
  text: "text";
724
+ checkbox: "checkbox";
725
+ radio: "radio";
721
726
  url: "url";
722
727
  email: "email";
723
728
  tel: "tel";
724
729
  date: "date";
725
- time: "time";
726
- textarea: "textarea";
727
- select: "select";
728
- radio: "radio";
729
- checkbox: "checkbox";
730
730
  multiselect: "multiselect";
731
731
  }>;
732
732
  placeholder: z.ZodOptional<z.ZodString>;
@@ -798,18 +798,18 @@ type I18nOptions = z.infer<typeof i18nSchema>;
798
798
  */
799
799
 
800
800
  declare const moduleLayoutSchema: z.ZodEnum<{
801
+ home: "home";
801
802
  chat: "chat";
802
803
  help: "help";
803
- home: "home";
804
804
  news: "news";
805
805
  }>;
806
806
  type ModuleLayout = z.infer<typeof moduleLayoutSchema>;
807
807
  declare const moduleSchema: z.ZodObject<{
808
808
  label: z.ZodString;
809
809
  layout: z.ZodEnum<{
810
+ home: "home";
810
811
  chat: "chat";
811
812
  help: "help";
812
- home: "home";
813
813
  news: "news";
814
814
  }>;
815
815
  contentTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -835,9 +835,9 @@ type ModuleOptions = z.infer<typeof moduleSchema>;
835
835
  declare const modulesSchema: z.ZodArray<z.ZodObject<{
836
836
  label: z.ZodString;
837
837
  layout: z.ZodEnum<{
838
+ home: "home";
838
839
  chat: "chat";
839
840
  help: "help";
840
- home: "home";
841
841
  news: "news";
842
842
  }>;
843
843
  contentTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
package/schema.json CHANGED
@@ -3867,7 +3867,9 @@
3867
3867
  "type": "boolean"
3868
3868
  },
3869
3869
  "createdAt": {
3870
- "type": "number"
3870
+ "type": "string",
3871
+ "format": "date-time",
3872
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
3871
3873
  }
3872
3874
  },
3873
3875
  "required": [
package/schema.mjs CHANGED
@@ -775,15 +775,15 @@ var startConversationResponseSchema = z17.object({
775
775
  /**
776
776
  * Form submissions recorded for this conversation — echoed like
777
777
  * `messages` so the widget reconstructs the collapsed "form submitted"
778
- * timeline markers on resume. `createdAt` is epoch ms (same clock as
779
- * message `createdAt`).
778
+ * timeline markers on resume. `createdAt` is ISO-8601 (a serialized
779
+ * Mongo ISODate — same format as message `createdAt`).
780
780
  */
781
781
  formSubmissions: z17.array(
782
782
  z17.object({
783
783
  formId: z17.string(),
784
784
  trigger: z17.string(),
785
785
  skipped: z17.boolean().optional(),
786
- createdAt: z17.number().optional()
786
+ createdAt: z17.iso.datetime().optional()
787
787
  }).loose()
788
788
  ).optional(),
789
789
  /**
package/web-component.mjs CHANGED
@@ -1269,6 +1269,11 @@ function encodeContext(user, page) {
1269
1269
  }
1270
1270
 
1271
1271
  // src/stream/protocol.ts
1272
+ function parseWireDate(value) {
1273
+ if (!value) return void 0;
1274
+ const ms = Date.parse(value);
1275
+ return Number.isFinite(ms) ? ms : void 0;
1276
+ }
1272
1277
  var DEFAULT_PATHS = {
1273
1278
  /** Conversation bootstrap. `POST` → deployment config + per-visitor state. */
1274
1279
  startConversation: "/ai/agent/start-conversation",
@@ -1318,7 +1323,8 @@ function buildSendMessageRequest(params) {
1318
1323
  id: m.id,
1319
1324
  parts: messageToWireParts(m),
1320
1325
  role: m.role,
1321
- createdAt: m.createdAt
1326
+ // Internal clock is epoch ms; the wire speaks ISO-8601 (Mongo ISODate).
1327
+ createdAt: m.createdAt !== void 0 ? new Date(m.createdAt).toISOString() : void 0
1322
1328
  }));
1323
1329
  const body = {
1324
1330
  messages: wire,
@@ -1967,7 +1973,7 @@ function fromWireMessage(w) {
1967
1973
  role: w.role,
1968
1974
  // Real send time when the backend provides it; otherwise fall back to now
1969
1975
  // (older backends) so the timestamp + day divider still render.
1970
- createdAt: w.createdAt ?? Date.now(),
1976
+ createdAt: parseWireDate(w.createdAt) ?? Date.now(),
1971
1977
  status: "complete",
1972
1978
  partsSig: signal(parts)
1973
1979
  };
@@ -6519,7 +6525,7 @@ function App({ options, hostElement, bus }) {
6519
6525
  key: `wire:${rec.formId}:${rec.createdAt ?? i}`,
6520
6526
  formId: rec.formId,
6521
6527
  outcome: rec.skipped ? "skipped" : "submitted",
6522
- createdAt: rec.createdAt
6528
+ createdAt: parseWireDate(rec.createdAt)
6523
6529
  }))
6524
6530
  );
6525
6531
  const tail = resumeBubbleRef.current ? [resumeBubbleRef.current] : [];