@helpai/elements 0.60.3 → 0.60.4

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.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.3" : "0.0.0-dev";
32
+ var ELEMENTS_VERSION = true ? "0.60.4" : "0.0.0-dev";
33
33
  var ELEMENTS_VERSION_PARAM = "_ev";
34
34
 
35
35
  // src/i18n/strings.ts
@@ -8242,6 +8242,8 @@ function App({ options, hostElement, bus }) {
8242
8242
  const regenerateDanglingRef = useRef9(null);
8243
8243
  const regenInFlightRef = useRef9(false);
8244
8244
  const markActiveConversationReadRef = useRef9(null);
8245
+ const markReadTimerRef = useRef9();
8246
+ useEffect16(() => () => clearTimeout(markReadTimerRef.current), []);
8245
8247
  useEffect16(() => {
8246
8248
  if (!conversationReady || homeNavSeeded.current) return;
8247
8249
  homeNavSeeded.current = true;
@@ -8926,7 +8928,10 @@ function App({ options, hostElement, bus }) {
8926
8928
  if (!isChatActive()) return;
8927
8929
  const conversationId = conversationIdSig.value;
8928
8930
  if (!conversationId) return;
8929
- void transport.markRead(conversationId).then(refreshUnread);
8931
+ clearTimeout(markReadTimerRef.current);
8932
+ markReadTimerRef.current = setTimeout(() => {
8933
+ void transport.markRead(conversationId).then(refreshUnread);
8934
+ }, MARK_READ_DELAY_MS);
8930
8935
  }, [transport, conversationIdSig, refreshUnread]);
8931
8936
  useEffect16(() => {
8932
8937
  markActiveConversationReadRef.current = markActiveConversationRead;
@@ -9271,6 +9276,7 @@ function toWirePageContext(pageContext) {
9271
9276
  return { ...pageContext, ...url ? { url } : {} };
9272
9277
  }
9273
9278
  var LAUNCHER_EXIT_MS = 120;
9279
+ var MARK_READ_DELAY_MS = 300;
9274
9280
  async function uploadAttachments(transport, attachments, onError) {
9275
9281
  const out = [];
9276
9282
  for (const a of attachments) {
package/package.json CHANGED
@@ -80,5 +80,5 @@
80
80
  ],
81
81
  "type": "module",
82
82
  "types": "./index.d.ts",
83
- "version": "0.60.3"
83
+ "version": "0.60.4"
84
84
  }
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.3" : "0.0.0-dev";
1932
+ var ELEMENTS_VERSION = true ? "0.60.4" : "0.0.0-dev";
1933
1933
  var ELEMENTS_VERSION_PARAM = "_ev";
1934
1934
 
1935
1935
  // src/stream/types.ts
@@ -8201,6 +8201,8 @@ function App({ options, hostElement, bus }) {
8201
8201
  const regenerateDanglingRef = useRef9(null);
8202
8202
  const regenInFlightRef = useRef9(false);
8203
8203
  const markActiveConversationReadRef = useRef9(null);
8204
+ const markReadTimerRef = useRef9();
8205
+ useEffect16(() => () => clearTimeout(markReadTimerRef.current), []);
8204
8206
  useEffect16(() => {
8205
8207
  if (!conversationReady || homeNavSeeded.current) return;
8206
8208
  homeNavSeeded.current = true;
@@ -8885,7 +8887,10 @@ function App({ options, hostElement, bus }) {
8885
8887
  if (!isChatActive()) return;
8886
8888
  const conversationId = conversationIdSig.value;
8887
8889
  if (!conversationId) return;
8888
- void transport.markRead(conversationId).then(refreshUnread);
8890
+ clearTimeout(markReadTimerRef.current);
8891
+ markReadTimerRef.current = setTimeout(() => {
8892
+ void transport.markRead(conversationId).then(refreshUnread);
8893
+ }, MARK_READ_DELAY_MS);
8889
8894
  }, [transport, conversationIdSig, refreshUnread]);
8890
8895
  useEffect16(() => {
8891
8896
  markActiveConversationReadRef.current = markActiveConversationRead;
@@ -9230,6 +9235,7 @@ function toWirePageContext(pageContext) {
9230
9235
  return { ...pageContext, ...url ? { url } : {} };
9231
9236
  }
9232
9237
  var LAUNCHER_EXIT_MS = 120;
9238
+ var MARK_READ_DELAY_MS = 300;
9233
9239
  async function uploadAttachments(transport, attachments, onError) {
9234
9240
  const out = [];
9235
9241
  for (const a of attachments) {