@helpai/elements 0.43.1 → 0.44.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/web-component.mjs CHANGED
@@ -1342,7 +1342,7 @@ function applyHostAttributes(host, resolved) {
1342
1342
  import { h, render as renderPreact } from "preact";
1343
1343
 
1344
1344
  // src/ui/app.tsx
1345
- import { useCallback as useCallback6, useEffect as useEffect17, useMemo as useMemo3, useRef as useRef9, useState as useState13 } from "preact/hooks";
1345
+ import { useCallback as useCallback6, useEffect as useEffect16, useMemo as useMemo3, useRef as useRef9, useState as useState13 } from "preact/hooks";
1346
1346
  import { batch, useComputed as useComputed7, useSignal as useSignal2 } from "@preact/signals";
1347
1347
 
1348
1348
  // src/core/handshake-shape.ts
@@ -1426,6 +1426,10 @@ function createAuth(opts) {
1426
1426
  };
1427
1427
  }
1428
1428
 
1429
+ // src/core/version.ts
1430
+ var ELEMENTS_VERSION = true ? "0.44.0" : "0.0.0-dev";
1431
+ var ELEMENTS_VERSION_PARAM = "_ev";
1432
+
1429
1433
  // src/stream/types.ts
1430
1434
  var StreamError = class extends Error {
1431
1435
  constructor(message, code, status, cause) {
@@ -1749,7 +1753,7 @@ var AgentTransport = class {
1749
1753
  }
1750
1754
  /** Build the per-request envelope from the current transport state. */
1751
1755
  envelope() {
1752
- const out = {};
1756
+ const out = { [ELEMENTS_VERSION_PARAM]: ELEMENTS_VERSION };
1753
1757
  if (this.visitorId) out.visitorId = this.visitorId;
1754
1758
  if (this.conversationId) out.conversationId = this.conversationId;
1755
1759
  if (this.locale) out.locale = this.locale;
@@ -3261,7 +3265,7 @@ function resolveCalloutPosition(configured, launcherPosition) {
3261
3265
  }
3262
3266
 
3263
3267
  // src/ui/panel.tsx
3264
- import { useCallback as useCallback2, useEffect as useEffect10, useRef as useRef6 } from "preact/hooks";
3268
+ import { useCallback as useCallback2, useEffect as useEffect9, useRef as useRef6 } from "preact/hooks";
3265
3269
 
3266
3270
  // src/ui/resize-grip.tsx
3267
3271
  import { useEffect as useEffect2, useRef } from "preact/hooks";
@@ -4293,7 +4297,7 @@ function HeaderActions({ panelProps, variant }) {
4293
4297
  }
4294
4298
 
4295
4299
  // src/ui/message-list.tsx
4296
- import { useEffect as useEffect8, useLayoutEffect, useRef as useRef5, useState as useState6 } from "preact/hooks";
4300
+ import { useEffect as useEffect7, useLayoutEffect as useLayoutEffect2, useRef as useRef5, useState as useState6 } from "preact/hooks";
4297
4301
  import { useComputed as useComputed5 } from "@preact/signals";
4298
4302
 
4299
4303
  // src/ui/form/dynamic-form.tsx
@@ -4685,13 +4689,13 @@ function FormDoneMarker({
4685
4689
  import { useComputed as useComputed4 } from "@preact/signals";
4686
4690
 
4687
4691
  // src/ui/markdown.tsx
4688
- import { useEffect as useEffect7, useMemo, useRef as useRef4 } from "preact/hooks";
4692
+ import { useLayoutEffect, useMemo, useRef as useRef4 } from "preact/hooks";
4689
4693
  import { effect, signal as signal4 } from "@preact/signals";
4690
4694
  import * as smd from "streaming-markdown";
4691
4695
  import { jsx as jsx12 } from "preact/jsx-runtime";
4692
4696
  function MarkdownView({ textSig, doneSig }) {
4693
4697
  const ref = useRef4(null);
4694
- useEffect7(() => {
4698
+ useLayoutEffect(() => {
4695
4699
  const el = ref.current;
4696
4700
  if (!el) return;
4697
4701
  el.classList.add(`${BRAND.cssPrefix}-md`);
@@ -5183,7 +5187,7 @@ function MessageList({
5183
5187
  el.scrollTop = el.scrollHeight;
5184
5188
  };
5185
5189
  const firstMessageId = messages.value[0]?.id;
5186
- useLayoutEffect(() => {
5190
+ useLayoutEffect2(() => {
5187
5191
  const el = ref.current;
5188
5192
  if (!el) return;
5189
5193
  if (messages.value.length === 0) return;
@@ -5206,7 +5210,7 @@ function MessageList({
5206
5210
  };
5207
5211
  }, [firstMessageId]);
5208
5212
  const prevLengthRef = useRef5(0);
5209
- useEffect8(() => {
5213
+ useEffect7(() => {
5210
5214
  const el = ref.current;
5211
5215
  const list = messages.value;
5212
5216
  const prevLength = prevLengthRef.current;
@@ -5223,7 +5227,7 @@ function MessageList({
5223
5227
  const distanceFromBottom = el.scrollHeight - el.scrollTop - el.clientHeight;
5224
5228
  if (distanceFromBottom < STICK_THRESHOLD) pinBottom(el);
5225
5229
  }, [messages.value.length]);
5226
- useEffect8(() => {
5230
+ useEffect7(() => {
5227
5231
  const el = ref.current;
5228
5232
  if (!el) return;
5229
5233
  const last = messages.value.at(-1);
@@ -5244,13 +5248,13 @@ function MessageList({
5244
5248
  return () => obs.disconnect();
5245
5249
  }, [messages.value]);
5246
5250
  const activeFormId = form?.form.id;
5247
- useLayoutEffect(() => {
5251
+ useLayoutEffect2(() => {
5248
5252
  const el = ref.current;
5249
5253
  if (!el || !activeFormId || detachedRef.current) return;
5250
5254
  if (!messages.value.some((m) => m.role === "user")) return;
5251
5255
  pinBottom(el);
5252
5256
  }, [activeFormId]);
5253
- useEffect8(() => {
5257
+ useEffect7(() => {
5254
5258
  const el = ref.current;
5255
5259
  if (!el) return;
5256
5260
  const syncJump = () => setShowJump(el.scrollHeight - el.scrollTop - el.clientHeight > STICK_THRESHOLD * 2);
@@ -5420,7 +5424,7 @@ function dayLabel(createdAt, strings) {
5420
5424
  }
5421
5425
 
5422
5426
  // src/ui/conversation-list.tsx
5423
- import { useEffect as useEffect9, useState as useState7 } from "preact/hooks";
5427
+ import { useEffect as useEffect8, useState as useState7 } from "preact/hooks";
5424
5428
 
5425
5429
  // src/ui/history-groups.ts
5426
5430
  var HISTORY_BUCKETS = ["today", "yesterday", "lastWeek", "older"];
@@ -5478,7 +5482,7 @@ function ConversationList({
5478
5482
  const seed = transport.peekConversations({ visitorId });
5479
5483
  const [state, setState] = useState7(seed ? "loaded" : "loading");
5480
5484
  const [conversations, setChats] = useState7(seed?.conversations ?? []);
5481
- useEffect9(() => {
5485
+ useEffect8(() => {
5482
5486
  let cancelled = false;
5483
5487
  transport.listConversations({ visitorId }).then((res) => {
5484
5488
  if (cancelled) return;
@@ -5588,7 +5592,7 @@ function Panel(props2) {
5588
5592
  const { options, onClose } = props2;
5589
5593
  const s = options.strings;
5590
5594
  const containerRef = useRef6(null);
5591
- useEffect10(() => {
5595
+ useEffect9(() => {
5592
5596
  const el = containerRef.current;
5593
5597
  if (!el) return;
5594
5598
  const dispose = trapFocus(el);
@@ -6060,7 +6064,7 @@ var topScreen = (s) => activeStack(s).at(-1);
6060
6064
  var atTabRoot = (s) => activeStack(s).length === 0;
6061
6065
 
6062
6066
  // src/ui/messenger-home.tsx
6063
- import { useCallback as useCallback4, useEffect as useEffect15, useRef as useRef8 } from "preact/hooks";
6067
+ import { useCallback as useCallback4, useEffect as useEffect14, useRef as useRef8 } from "preact/hooks";
6064
6068
  import { useComputed as useComputed6 } from "@preact/signals";
6065
6069
 
6066
6070
  // src/ui/modules/chat.tsx
@@ -6070,7 +6074,7 @@ var chatLayout = {
6070
6074
  };
6071
6075
 
6072
6076
  // src/ui/modules/help.tsx
6073
- import { useEffect as useEffect11, useMemo as useMemo2, useState as useState8 } from "preact/hooks";
6077
+ import { useEffect as useEffect10, useMemo as useMemo2, useState as useState8 } from "preact/hooks";
6074
6078
 
6075
6079
  // src/ui/back-header.tsx
6076
6080
  import { jsx as jsx23, jsxs as jsxs19 } from "preact/jsx-runtime";
@@ -6192,7 +6196,7 @@ function HelpRoot({ transport, strings, config, nav, bus, panelProps }) {
6192
6196
  const [items, setItems] = useState8([]);
6193
6197
  const [query, setQuery] = useState8("");
6194
6198
  const [reloadKey, setReloadKey] = useState8(0);
6195
- useEffect11(() => {
6199
+ useEffect10(() => {
6196
6200
  let cancelled = false;
6197
6201
  setState("loading");
6198
6202
  transport.listContent({ tags, sortBy: "order", limit: 100 }).then((res) => {
@@ -6212,7 +6216,7 @@ function HelpRoot({ transport, strings, config, nav, bus, panelProps }) {
6212
6216
  };
6213
6217
  }, [transport, tags, reloadKey, bus]);
6214
6218
  const results = useMemo2(() => fuzzySearch(items, query), [items, query]);
6215
- useEffect11(() => {
6219
+ useEffect10(() => {
6216
6220
  const q = query.trim();
6217
6221
  if (!q) return;
6218
6222
  const timer = setTimeout(() => bus.emit("contentSearch", { queryLength: q.length, hitCount: results.length }), 600);
@@ -6245,7 +6249,7 @@ var helpLayout = {
6245
6249
  };
6246
6250
 
6247
6251
  // src/ui/modules/home.tsx
6248
- import { useEffect as useEffect12, useState as useState9 } from "preact/hooks";
6252
+ import { useEffect as useEffect11, useState as useState9 } from "preact/hooks";
6249
6253
 
6250
6254
  // src/ui/home-card.tsx
6251
6255
  import { jsx as jsx28 } from "preact/jsx-runtime";
@@ -6276,7 +6280,7 @@ function HomeRoot(props2) {
6276
6280
  const [recent, setRecent] = useState9(null);
6277
6281
  const [content, setContent] = useState9([]);
6278
6282
  const tagsKey = config.contentTags?.join(",");
6279
- useEffect12(() => {
6283
+ useEffect11(() => {
6280
6284
  if (!config.showRecentConversations) return;
6281
6285
  let cancelled = false;
6282
6286
  transport.listConversations({ limit: 1 }).then((res) => !cancelled && setRecent(res.conversations?.[0] ?? null)).catch((err) => !cancelled && log13.warn("listConversations (home) failed", { err }));
@@ -6284,7 +6288,7 @@ function HomeRoot(props2) {
6284
6288
  cancelled = true;
6285
6289
  };
6286
6290
  }, [transport, config.showRecentConversations]);
6287
- useEffect12(() => {
6291
+ useEffect11(() => {
6288
6292
  if (!config.contentTags?.length) return;
6289
6293
  let cancelled = false;
6290
6294
  transport.listContent({ tags: config.contentTags, limit: 6 }).then((res) => {
@@ -6364,7 +6368,7 @@ var homeLayout = {
6364
6368
  };
6365
6369
 
6366
6370
  // src/ui/modules/news.tsx
6367
- import { useEffect as useEffect13, useState as useState10 } from "preact/hooks";
6371
+ import { useEffect as useEffect12, useState as useState10 } from "preact/hooks";
6368
6372
  import { jsx as jsx30, jsxs as jsxs25 } from "preact/jsx-runtime";
6369
6373
  var p26 = BRAND.cssPrefix;
6370
6374
  var log14 = logger.scope("news");
@@ -6374,7 +6378,7 @@ function NewsRoot({ transport, strings, config, nav, bus, panelProps }) {
6374
6378
  const [errorMsg, setErrorMsg] = useState10(strings.errorGeneric);
6375
6379
  const [items, setItems] = useState10([]);
6376
6380
  const [reloadKey, setReloadKey] = useState10(0);
6377
- useEffect13(() => {
6381
+ useEffect12(() => {
6378
6382
  let cancelled = false;
6379
6383
  setState("loading");
6380
6384
  transport.listContent({ tags, sortBy: "publishedAt", sortOrder: "desc" }).then((res) => {
@@ -6496,7 +6500,7 @@ function IframeView({ url, title, strings, onBack, actions }) {
6496
6500
  }
6497
6501
 
6498
6502
  // src/ui/content-view.tsx
6499
- import { useCallback as useCallback3, useEffect as useEffect14, useState as useState11 } from "preact/hooks";
6503
+ import { useCallback as useCallback3, useEffect as useEffect13, useState as useState11 } from "preact/hooks";
6500
6504
  import { jsx as jsx33, jsxs as jsxs28 } from "preact/jsx-runtime";
6501
6505
  var p29 = BRAND.cssPrefix;
6502
6506
  var log15 = logger.scope("content");
@@ -6510,7 +6514,7 @@ function ContentView({ id, title, transport, strings, bus, onBack, actions }) {
6510
6514
  setItem(null);
6511
6515
  setReloadKey((k) => k + 1);
6512
6516
  }, []);
6513
- useEffect14(() => {
6517
+ useEffect13(() => {
6514
6518
  let cancelled = false;
6515
6519
  transport.listContent({ ids: [id], limit: 1 }).then((res) => {
6516
6520
  if (cancelled) return;
@@ -6528,7 +6532,7 @@ function ContentView({ id, title, transport, strings, bus, onBack, actions }) {
6528
6532
  cancelled = true;
6529
6533
  };
6530
6534
  }, [transport, id, reloadKey, bus]);
6531
- useEffect14(() => {
6535
+ useEffect13(() => {
6532
6536
  if (!item) return;
6533
6537
  const timer = setTimeout(() => bus.emit("contentRead", { contentId: id }), READ_DWELL_MS);
6534
6538
  return () => clearTimeout(timer);
@@ -6581,7 +6585,7 @@ function MessengerHome({
6581
6585
  const options = panelProps.options;
6582
6586
  const strings = options.strings;
6583
6587
  const containerRef = useRef8(null);
6584
- useEffect15(() => {
6588
+ useEffect14(() => {
6585
6589
  const el = containerRef.current;
6586
6590
  if (!el) return;
6587
6591
  const dispose = trapFocus(el);
@@ -6606,7 +6610,7 @@ function MessengerHome({
6606
6610
  const isReader = top?.kind === "iframe" || top?.kind === "content";
6607
6611
  const showTabBar = enabledModules.length > 1 && (atTabRoot(navState) || !isReader);
6608
6612
  const savedSize = useRef8(null);
6609
- useEffect15(() => {
6613
+ useEffect14(() => {
6610
6614
  if (isReader && savedSize.current === null) {
6611
6615
  savedSize.current = panelProps.panelSize;
6612
6616
  if (panelProps.panelSize === "normal") onSetPanelSize("expanded");
@@ -6739,12 +6743,12 @@ function ModulesEmpty({ strings, onClose }) {
6739
6743
  }
6740
6744
 
6741
6745
  // src/ui/use-launcher-callout.ts
6742
- import { useCallback as useCallback5, useEffect as useEffect16, useState as useState12 } from "preact/hooks";
6746
+ import { useCallback as useCallback5, useEffect as useEffect15, useState as useState12 } from "preact/hooks";
6743
6747
  function useLauncherCallout({ callout, persistence }) {
6744
6748
  const textKey = callout?.text ?? "";
6745
6749
  const persistent = callout?.persistent ?? true;
6746
6750
  const [dismissed, setDismissed] = useState12(() => persistent ? false : persistence.loadCalloutDismissed(textKey));
6747
- useEffect16(() => {
6751
+ useEffect15(() => {
6748
6752
  setDismissed(persistent ? false : persistence.loadCalloutDismissed(textKey));
6749
6753
  }, [textKey, persistent, persistence]);
6750
6754
  const dismissCallout = useCallback5(() => {
@@ -6808,7 +6812,7 @@ function App({ options, hostElement, bus }) {
6808
6812
  activatedRef.current = activated;
6809
6813
  const pendingThreadRef = useRef9(false);
6810
6814
  const welcomeRef = useRef9(void 0);
6811
- useEffect17(() => {
6815
+ useEffect16(() => {
6812
6816
  if (isOpen) setActivated(true);
6813
6817
  }, [isOpen]);
6814
6818
  const initialPanelApplied = useRef9(false);
@@ -6859,20 +6863,20 @@ function App({ options, hostElement, bus }) {
6859
6863
  },
6860
6864
  [persistence, transport]
6861
6865
  );
6862
- useEffect17(() => {
6866
+ useEffect16(() => {
6863
6867
  if (initialSettings.soundMuted !== void 0) feedback.setMuted(initialSettings.soundMuted);
6864
6868
  }, []);
6865
- useEffect17(() => {
6869
+ useEffect16(() => {
6866
6870
  hostElement.dataset.theme = activeThemeMode;
6867
6871
  }, [hostElement, activeThemeMode, options]);
6868
- useEffect17(() => {
6872
+ useEffect16(() => {
6869
6873
  hostElement.dataset.textSize = activeTextSize;
6870
6874
  }, [hostElement, activeTextSize, options]);
6871
- useEffect17(() => {
6875
+ useEffect16(() => {
6872
6876
  feedback.update(options.sound, options.haptics);
6873
6877
  }, [feedback, options.sound, options.haptics]);
6874
- useEffect17(() => () => feedback.destroy(), [feedback]);
6875
- useEffect17(() => {
6878
+ useEffect16(() => () => feedback.destroy(), [feedback]);
6879
+ useEffect16(() => {
6876
6880
  let firstRun = true;
6877
6881
  return feedback.mutedSig.subscribe((muted) => {
6878
6882
  if (firstRun) {
@@ -6882,13 +6886,13 @@ function App({ options, hostElement, bus }) {
6882
6886
  patchAndSync({ soundMuted: muted });
6883
6887
  });
6884
6888
  }, [feedback, patchAndSync]);
6885
- useEffect17(() => {
6889
+ useEffect16(() => {
6886
6890
  if (initialSizeApplied.current || !options.size.initialSize) return;
6887
6891
  initialSizeApplied.current = true;
6888
6892
  if (persistence.loadPanelSize()) return;
6889
6893
  setPanelSize(pickInitialPanelSize(options.mode, options.size, currentViewportWidth()));
6890
6894
  }, [options.mode, options.size, persistence]);
6891
- useEffect17(() => {
6895
+ useEffect16(() => {
6892
6896
  if (!conversationReady || initialPanelApplied.current) return;
6893
6897
  initialPanelApplied.current = true;
6894
6898
  const state = resolveInitialPanelState(
@@ -6903,7 +6907,7 @@ function App({ options, hostElement, bus }) {
6903
6907
  const homeNavSeeded = useRef9(false);
6904
6908
  const resumeActiveRef = useRef9(false);
6905
6909
  const resumeBubbleRef = useRef9(null);
6906
- useEffect17(() => {
6910
+ useEffect16(() => {
6907
6911
  if (!conversationReady || homeNavSeeded.current) return;
6908
6912
  homeNavSeeded.current = true;
6909
6913
  if (resumeActiveRef.current) {
@@ -7088,18 +7092,18 @@ function App({ options, hostElement, bus }) {
7088
7092
  const userSig = JSON.stringify(options.userContext ?? null);
7089
7093
  const pageSig = JSON.stringify(options.pageContext ?? null);
7090
7094
  const formCtxSig = JSON.stringify(formContext);
7091
- useEffect17(() => {
7095
+ useEffect16(() => {
7092
7096
  const merged = Object.keys(formContext).length ? { ...formContext, ...options.userContext } : options.userContext;
7093
7097
  transport.setContext(merged, toWirePageContext(options.pageContext));
7094
7098
  }, [transport, userSig, pageSig, formCtxSig]);
7095
7099
  const effectiveLocale = clampLocale(activeLocale, options.availableLocales, options.defaultLocale);
7096
- useEffect17(() => {
7100
+ useEffect16(() => {
7097
7101
  transport.setLocale(effectiveLocale);
7098
7102
  }, [transport, effectiveLocale]);
7099
- useEffect17(() => {
7103
+ useEffect16(() => {
7100
7104
  hostElement.dir = isRtlLocale(effectiveLocale) ? "rtl" : "ltr";
7101
7105
  }, [hostElement, effectiveLocale]);
7102
- useEffect17(() => {
7106
+ useEffect16(() => {
7103
7107
  if (effectiveLocale !== activeLocale) setActiveLocale(effectiveLocale);
7104
7108
  }, [effectiveLocale, activeLocale]);
7105
7109
  const runResume = useCallback6(
@@ -7147,7 +7151,7 @@ function App({ options, hostElement, bus }) {
7147
7151
  [reducer, messagesSig, feedback, bus, options, homeNav]
7148
7152
  );
7149
7153
  const resumeHandleRef = useRef9(null);
7150
- useEffect17(() => {
7154
+ useEffect16(() => {
7151
7155
  const persistedConversation = conversationIdSig.value;
7152
7156
  if (persistedConversation) transport.primeIdentity(visitorId, persistedConversation);
7153
7157
  void runHandshake({ newConversation: false });
@@ -7156,7 +7160,7 @@ function App({ options, hostElement, bus }) {
7156
7160
  resumeHandleRef.current?.cancel();
7157
7161
  };
7158
7162
  }, []);
7159
- useEffect17(() => {
7163
+ useEffect16(() => {
7160
7164
  if (!activated) return;
7161
7165
  dataBootRef.current = transport.bootstrap();
7162
7166
  void (async () => {
@@ -7181,7 +7185,7 @@ function App({ options, hostElement, bus }) {
7181
7185
  }
7182
7186
  }, [activated]);
7183
7187
  const formsLocaleRef = useRef9(null);
7184
- useEffect17(() => {
7188
+ useEffect16(() => {
7185
7189
  if (!activated) return;
7186
7190
  if (formsLocaleRef.current === null) {
7187
7191
  formsLocaleRef.current = effectiveLocale;
@@ -7198,15 +7202,15 @@ function App({ options, hostElement, bus }) {
7198
7202
  };
7199
7203
  }, [activated, effectiveLocale, transport]);
7200
7204
  const lastUserSig = useRef9(userSig);
7201
- useEffect17(() => {
7205
+ useEffect16(() => {
7202
7206
  if (!conversationReady || lastUserSig.current === userSig) return;
7203
7207
  lastUserSig.current = userSig;
7204
7208
  void runHandshake({ newConversation: false });
7205
7209
  }, [userSig, conversationReady, runHandshake]);
7206
- useEffect17(() => {
7210
+ useEffect16(() => {
7207
7211
  applyMode(hostElement, computeHostMode(options.mode, panelSize, isOpen));
7208
7212
  }, [hostElement, isOpen, panelSize, options.mode]);
7209
- useEffect17(() => {
7213
+ useEffect16(() => {
7210
7214
  if (options.mode !== "modal" || !isOpen) return;
7211
7215
  const onClick = (e) => {
7212
7216
  const path = e.composedPath();
@@ -7218,7 +7222,7 @@ function App({ options, hostElement, bus }) {
7218
7222
  hostElement.addEventListener("click", onClick);
7219
7223
  return () => hostElement.removeEventListener("click", onClick);
7220
7224
  }, [hostElement, isOpen, options.mode]);
7221
- useEffect17(() => {
7225
+ useEffect16(() => {
7222
7226
  if (options.mode !== "drawer" || !isOpen) return;
7223
7227
  const onKey = (e) => {
7224
7228
  if (e.key === "Escape") setIsOpen(false);
@@ -7353,25 +7357,25 @@ function App({ options, hostElement, bus }) {
7353
7357
  }
7354
7358
  });
7355
7359
  const activeForm = useComputed7(() => forms.activeForm.value);
7356
- useEffect17(() => {
7360
+ useEffect16(() => {
7357
7361
  forms.refresh();
7358
7362
  }, [effectiveForms, forms]);
7359
7363
  const pageArea = options.pageContext?.area ? String(options.pageContext.area) : void 0;
7360
7364
  const msgCount = useComputed7(() => messagesSig.value.length);
7361
- useEffect17(() => {
7365
+ useEffect16(() => {
7362
7366
  if (conversationReady && formsReady) forms.fire("pre-chat");
7363
7367
  }, [conversationReady, formsReady, forms]);
7364
- useEffect17(() => {
7368
+ useEffect16(() => {
7365
7369
  if (formsReady && !canSend) forms.fire("conversation-closed");
7366
7370
  }, [formsReady, canSend, forms]);
7367
- useEffect17(() => {
7371
+ useEffect16(() => {
7368
7372
  if (conversationReady && formsReady && pageArea) forms.fire("page-area");
7369
7373
  }, [conversationReady, formsReady, pageArea, forms]);
7370
7374
  const idleMs = useMemo3(() => {
7371
7375
  const secs = effectiveForms.list.flatMap((f) => f.triggers).filter((t) => t.kind === "idle").map((t) => Number(t.param));
7372
7376
  return secs.length ? Math.min(...secs) * 1e3 : 0;
7373
7377
  }, [effectiveForms]);
7374
- useEffect17(() => {
7378
+ useEffect16(() => {
7375
7379
  if (!idleMs || !isOpen) return;
7376
7380
  const id = setTimeout(() => forms.fire("idle"), idleMs);
7377
7381
  return () => clearTimeout(id);
@@ -7431,7 +7435,7 @@ function App({ options, hostElement, bus }) {
7431
7435
  }).catch((err) => log16.debug("refreshUnread failed (non-fatal)", { err }));
7432
7436
  }, [transport, options.modules, unreadCountSig]);
7433
7437
  const unreadSeeded = useRef9(false);
7434
- useEffect17(() => {
7438
+ useEffect16(() => {
7435
7439
  if (!activated || !conversationReady || unreadSeeded.current) return;
7436
7440
  unreadSeeded.current = true;
7437
7441
  refreshUnread();
@@ -7589,12 +7593,12 @@ function App({ options, hostElement, bus }) {
7589
7593
  },
7590
7594
  [formsReady, forms]
7591
7595
  );
7592
- useEffect17(() => {
7596
+ useEffect16(() => {
7593
7597
  if (!formsReady || !pendingOpenFormRef.current) return;
7594
7598
  forms.fire("manual", pendingOpenFormRef.current);
7595
7599
  pendingOpenFormRef.current = null;
7596
7600
  }, [formsReady, forms]);
7597
- useEffect17(() => {
7601
+ useEffect16(() => {
7598
7602
  const unsub = bindHostCommands(hostElement, {
7599
7603
  open: handleOpen,
7600
7604
  close: handleClose,
@@ -7861,6 +7865,7 @@ function createTracker(bus, deps) {
7861
7865
  if (++windowHits > MAX_HITS_PER_MINUTE) return;
7862
7866
  const params = new URLSearchParams();
7863
7867
  params.set("v", PROTOCOL_VERSION);
7868
+ params.set(ELEMENTS_VERSION_PARAM, ELEMENTS_VERSION);
7864
7869
  params.set("e", event);
7865
7870
  if (tracking.token) params.set("tk", tracking.token);
7866
7871
  if (publicKey) params.set("pk", publicKey);