@helpai/elements 0.60.1 → 0.60.2

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, H as HandshakeResponse, L as Link, S as ServerConfig, b as SiteConfig, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial } from './deployment-Bqqyxer1.js';
1
+ export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, H as HandshakeResponse, L as Link, S as ServerConfig, b as SiteConfig, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial } from './deployment-DrAIrNYP.js';
2
2
  import 'zod';
3
3
 
4
4
  /**
package/index.mjs CHANGED
@@ -29,7 +29,7 @@ var BRAND = {
29
29
  };
30
30
 
31
31
  // src/core/version.ts
32
- var ELEMENTS_VERSION = true ? "0.60.1" : "0.0.0-dev";
32
+ var ELEMENTS_VERSION = true ? "0.60.2" : "0.0.0-dev";
33
33
  var ELEMENTS_VERSION_PARAM = "_ev";
34
34
 
35
35
  // src/i18n/strings.ts
@@ -8116,6 +8116,12 @@ function App({ options, hostElement, bus }) {
8116
8116
  function chatTabId() {
8117
8117
  return options.modules.list.find((m) => m.layout === "chat")?.id;
8118
8118
  }
8119
+ function isChatSurfaceActive() {
8120
+ const chatId = chatTabId();
8121
+ if (!chatId) return false;
8122
+ if (options.modules.list.length === 1) return true;
8123
+ return homeNav.sig.value.activeTab === chatId;
8124
+ }
8119
8125
  const homeNavRef = useRef9();
8120
8126
  if (!homeNavRef.current) {
8121
8127
  const ids = options.modules.list.map((m) => m.id);
@@ -8235,6 +8241,7 @@ function App({ options, hostElement, bus }) {
8235
8241
  const resumeBubbleRef = useRef9(null);
8236
8242
  const regenerateDanglingRef = useRef9(null);
8237
8243
  const regenInFlightRef = useRef9(false);
8244
+ const markActiveReadRef = useRef9(null);
8238
8245
  useEffect16(() => {
8239
8246
  if (!conversationReady || homeNavSeeded.current) return;
8240
8247
  homeNavSeeded.current = true;
@@ -8520,6 +8527,7 @@ function App({ options, hostElement, bus }) {
8520
8527
  setActiveCancel(null);
8521
8528
  setActiveDetach(null);
8522
8529
  messagesSig.value = [...messagesSig.value];
8530
+ markActiveReadRef.current?.();
8523
8531
  }
8524
8532
  }
8525
8533
  },
@@ -8680,6 +8688,7 @@ function App({ options, hostElement, bus }) {
8680
8688
  setActiveCancel(null);
8681
8689
  setActiveDetach(null);
8682
8690
  messagesSig.value = [...messagesSig.value];
8691
+ markActiveReadRef.current?.();
8683
8692
  }
8684
8693
  },
8685
8694
  [
@@ -8909,9 +8918,19 @@ function App({ options, hostElement, bus }) {
8909
8918
  const refreshUnread = useCallback6(() => {
8910
8919
  if (!options.modules.list.some((m) => m.layout === "chat")) return;
8911
8920
  transport.listConversations({ limit: 50 }).then((res) => {
8912
- hasUnreadSig.value = res.conversations.some((c) => c.hasUnread);
8921
+ const viewing = isChatSurfaceActive() ? conversationIdSig.value : void 0;
8922
+ hasUnreadSig.value = res.conversations.some((c) => c.hasUnread && c.conversationId !== viewing);
8913
8923
  }).catch((err) => log17.debug("refreshUnread failed (non-fatal)", { err }));
8914
- }, [transport, options.modules, hasUnreadSig]);
8924
+ }, [transport, options.modules, hasUnreadSig, conversationIdSig]);
8925
+ const markActiveReadIfViewing = useCallback6(() => {
8926
+ if (!isChatSurfaceActive()) return;
8927
+ const id = conversationIdSig.value;
8928
+ if (!id) return;
8929
+ void transport.markRead(id).then(refreshUnread);
8930
+ }, [transport, conversationIdSig, refreshUnread]);
8931
+ useEffect16(() => {
8932
+ markActiveReadRef.current = markActiveReadIfViewing;
8933
+ }, [markActiveReadIfViewing]);
8915
8934
  const unreadSeeded = useRef9(false);
8916
8935
  useEffect16(() => {
8917
8936
  if (!activated || !conversationReady || unreadSeeded.current) return;
package/package.json CHANGED
@@ -80,5 +80,5 @@
80
80
  ],
81
81
  "type": "module",
82
82
  "types": "./index.d.ts",
83
- "version": "0.60.1"
83
+ "version": "0.60.2"
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-Bqqyxer1.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-DrAIrNYP.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";
59
60
  expanded: "expanded";
60
61
  auto: "auto";
61
- normal: "normal";
62
62
  }>>;
63
63
  autoSizeBreakpoint: z.ZodDefault<z.ZodNumber>;
64
64
  }, z.core.$loose>>;
@@ -241,9 +241,9 @@ type LauncherOptions = z.infer<typeof launcherOptionsSchema>;
241
241
 
242
242
  declare const initialSizeSchema: z.ZodEnum<{
243
243
  fullscreen: "fullscreen";
244
+ normal: "normal";
244
245
  expanded: "expanded";
245
246
  auto: "auto";
246
- normal: "normal";
247
247
  }>;
248
248
  declare const resizeOptionsSchema: z.ZodObject<{
249
249
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -270,9 +270,9 @@ declare const sizeOptionsSchema: z.ZodObject<{
270
270
  inset: z.ZodOptional<z.ZodString>;
271
271
  initialSize: z.ZodDefault<z.ZodEnum<{
272
272
  fullscreen: "fullscreen";
273
+ normal: "normal";
273
274
  expanded: "expanded";
274
275
  auto: "auto";
275
- normal: "normal";
276
276
  }>>;
277
277
  autoSizeBreakpoint: z.ZodDefault<z.ZodNumber>;
278
278
  }, z.core.$loose>;
@@ -324,40 +324,40 @@ type FeatureFlags = z.infer<typeof featureFlagsSchema>;
324
324
  */
325
325
 
326
326
  declare const actionNameSchema: z.ZodEnum<{
327
- close: "close";
328
327
  expand: "expand";
329
328
  fullscreen: "fullscreen";
330
- clear: "clear";
331
- theme: "theme";
329
+ close: "close";
332
330
  language: "language";
331
+ theme: "theme";
333
332
  textSize: "textSize";
334
333
  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";
340
339
  expand: "expand";
341
340
  fullscreen: "fullscreen";
342
- clear: "clear";
343
- theme: "theme";
341
+ close: "close";
344
342
  language: "language";
343
+ theme: "theme";
345
344
  textSize: "textSize";
346
345
  history: "history";
346
+ clear: "clear";
347
347
  sound: "sound";
348
348
  }>>;
349
349
  type HeaderActions = z.infer<typeof headerActionsSchema>;
350
350
  /** Section wrapper — `actions` list wrapped under `header` in the dashboard form. */
351
351
  declare const headerSchema: z.ZodObject<{
352
352
  actions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
353
- close: "close";
354
353
  expand: "expand";
355
354
  fullscreen: "fullscreen";
356
- clear: "clear";
357
- theme: "theme";
355
+ close: "close";
358
356
  language: "language";
357
+ theme: "theme";
359
358
  textSize: "textSize";
360
359
  history: "history";
360
+ clear: "clear";
361
361
  sound: "sound";
362
362
  }>>>;
363
363
  }, z.core.$loose>;
@@ -373,33 +373,33 @@ type HeaderOptions = z.infer<typeof headerSchema>;
373
373
  */
374
374
 
375
375
  declare const feedbackEventSchema: z.ZodEnum<{
376
- voiceStart: "voiceStart";
377
- voiceStop: "voiceStop";
378
376
  error: "error";
379
377
  messageReceived: "messageReceived";
380
378
  messageSent: "messageSent";
379
+ voiceStart: "voiceStart";
380
+ voiceStop: "voiceStop";
381
381
  }>;
382
382
  type FeedbackEvent = z.infer<typeof feedbackEventSchema>;
383
383
  declare const soundOptionsSchema: z.ZodObject<{
384
384
  enabled: z.ZodDefault<z.ZodBoolean>;
385
385
  volume: z.ZodDefault<z.ZodNumber>;
386
386
  events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
387
- voiceStart: "voiceStart";
388
- voiceStop: "voiceStop";
389
387
  error: "error";
390
388
  messageReceived: "messageReceived";
391
389
  messageSent: "messageSent";
390
+ voiceStart: "voiceStart";
391
+ voiceStop: "voiceStop";
392
392
  }> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
393
393
  }, z.core.$loose>;
394
394
  type SoundOptions = z.infer<typeof soundOptionsSchema>;
395
395
  declare const hapticsOptionsSchema: z.ZodObject<{
396
396
  enabled: z.ZodDefault<z.ZodBoolean>;
397
397
  events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
398
- voiceStart: "voiceStart";
399
- voiceStop: "voiceStop";
400
398
  error: "error";
401
399
  messageReceived: "messageReceived";
402
400
  messageSent: "messageSent";
401
+ voiceStart: "voiceStart";
402
+ voiceStop: "voiceStop";
403
403
  }> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
404
404
  }, z.core.$loose>;
405
405
  type HapticsOptions = z.infer<typeof hapticsOptionsSchema>;
@@ -408,21 +408,21 @@ declare const feedbackSchema: z.ZodObject<{
408
408
  enabled: z.ZodDefault<z.ZodBoolean>;
409
409
  volume: z.ZodDefault<z.ZodNumber>;
410
410
  events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
411
- voiceStart: "voiceStart";
412
- voiceStop: "voiceStop";
413
411
  error: "error";
414
412
  messageReceived: "messageReceived";
415
413
  messageSent: "messageSent";
414
+ voiceStart: "voiceStart";
415
+ voiceStop: "voiceStop";
416
416
  }> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
417
417
  }, z.core.$loose>>;
418
418
  haptics: z.ZodOptional<z.ZodObject<{
419
419
  enabled: z.ZodDefault<z.ZodBoolean>;
420
420
  events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
421
- voiceStart: "voiceStart";
422
- voiceStop: "voiceStop";
423
421
  error: "error";
424
422
  messageReceived: "messageReceived";
425
423
  messageSent: "messageSent";
424
+ voiceStart: "voiceStart";
425
+ voiceStop: "voiceStop";
426
426
  }> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
427
427
  }, z.core.$loose>>;
428
428
  }, z.core.$loose>;
@@ -857,18 +857,18 @@ type I18nOptions = z.infer<typeof i18nSchema>;
857
857
  */
858
858
 
859
859
  declare const moduleLayoutSchema: z.ZodEnum<{
860
- home: "home";
861
860
  chat: "chat";
862
861
  help: "help";
862
+ home: "home";
863
863
  news: "news";
864
864
  }>;
865
865
  type ModuleLayout = z.infer<typeof moduleLayoutSchema>;
866
866
  declare const moduleSchema: z.ZodObject<{
867
867
  label: z.ZodString;
868
868
  layout: z.ZodEnum<{
869
- home: "home";
870
869
  chat: "chat";
871
870
  help: "help";
871
+ home: "home";
872
872
  news: "news";
873
873
  }>;
874
874
  contentTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -894,9 +894,9 @@ type ModuleOptions = z.infer<typeof moduleSchema>;
894
894
  declare const modulesSchema: z.ZodArray<z.ZodObject<{
895
895
  label: z.ZodString;
896
896
  layout: z.ZodEnum<{
897
- home: "home";
898
897
  chat: "chat";
899
898
  help: "help";
899
+ home: "home";
900
900
  news: "news";
901
901
  }>;
902
902
  contentTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
package/web-component.mjs CHANGED
@@ -1929,7 +1929,7 @@ function createAuth(opts) {
1929
1929
  }
1930
1930
 
1931
1931
  // src/core/version.ts
1932
- var ELEMENTS_VERSION = true ? "0.60.1" : "0.0.0-dev";
1932
+ var ELEMENTS_VERSION = true ? "0.60.2" : "0.0.0-dev";
1933
1933
  var ELEMENTS_VERSION_PARAM = "_ev";
1934
1934
 
1935
1935
  // src/stream/types.ts
@@ -8075,6 +8075,12 @@ function App({ options, hostElement, bus }) {
8075
8075
  function chatTabId() {
8076
8076
  return options.modules.list.find((m) => m.layout === "chat")?.id;
8077
8077
  }
8078
+ function isChatSurfaceActive() {
8079
+ const chatId = chatTabId();
8080
+ if (!chatId) return false;
8081
+ if (options.modules.list.length === 1) return true;
8082
+ return homeNav.sig.value.activeTab === chatId;
8083
+ }
8078
8084
  const homeNavRef = useRef9();
8079
8085
  if (!homeNavRef.current) {
8080
8086
  const ids = options.modules.list.map((m) => m.id);
@@ -8194,6 +8200,7 @@ function App({ options, hostElement, bus }) {
8194
8200
  const resumeBubbleRef = useRef9(null);
8195
8201
  const regenerateDanglingRef = useRef9(null);
8196
8202
  const regenInFlightRef = useRef9(false);
8203
+ const markActiveReadRef = useRef9(null);
8197
8204
  useEffect16(() => {
8198
8205
  if (!conversationReady || homeNavSeeded.current) return;
8199
8206
  homeNavSeeded.current = true;
@@ -8479,6 +8486,7 @@ function App({ options, hostElement, bus }) {
8479
8486
  setActiveCancel(null);
8480
8487
  setActiveDetach(null);
8481
8488
  messagesSig.value = [...messagesSig.value];
8489
+ markActiveReadRef.current?.();
8482
8490
  }
8483
8491
  }
8484
8492
  },
@@ -8639,6 +8647,7 @@ function App({ options, hostElement, bus }) {
8639
8647
  setActiveCancel(null);
8640
8648
  setActiveDetach(null);
8641
8649
  messagesSig.value = [...messagesSig.value];
8650
+ markActiveReadRef.current?.();
8642
8651
  }
8643
8652
  },
8644
8653
  [
@@ -8868,9 +8877,19 @@ function App({ options, hostElement, bus }) {
8868
8877
  const refreshUnread = useCallback6(() => {
8869
8878
  if (!options.modules.list.some((m) => m.layout === "chat")) return;
8870
8879
  transport.listConversations({ limit: 50 }).then((res) => {
8871
- hasUnreadSig.value = res.conversations.some((c) => c.hasUnread);
8880
+ const viewing = isChatSurfaceActive() ? conversationIdSig.value : void 0;
8881
+ hasUnreadSig.value = res.conversations.some((c) => c.hasUnread && c.conversationId !== viewing);
8872
8882
  }).catch((err) => log16.debug("refreshUnread failed (non-fatal)", { err }));
8873
- }, [transport, options.modules, hasUnreadSig]);
8883
+ }, [transport, options.modules, hasUnreadSig, conversationIdSig]);
8884
+ const markActiveReadIfViewing = useCallback6(() => {
8885
+ if (!isChatSurfaceActive()) return;
8886
+ const id = conversationIdSig.value;
8887
+ if (!id) return;
8888
+ void transport.markRead(id).then(refreshUnread);
8889
+ }, [transport, conversationIdSig, refreshUnread]);
8890
+ useEffect16(() => {
8891
+ markActiveReadRef.current = markActiveReadIfViewing;
8892
+ }, [markActiveReadIfViewing]);
8874
8893
  const unreadSeeded = useRef9(false);
8875
8894
  useEffect16(() => {
8876
8895
  if (!activated || !conversationReady || unreadSeeded.current) return;