@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/index.d.ts CHANGED
@@ -1733,8 +1733,9 @@ declare function getAllInstances(): ChatWidgetInstance[];
1733
1733
  * cycles until explicitly unregistered.
1734
1734
  */
1735
1735
  declare function hook(widgetId: string, event: string, listener: HookListener): () => void;
1736
- /** Semver of the published package. */
1737
- declare const version = "0.1.0";
1736
+ /** Semver of the published `@<brand>/elements` package — build-injected, also
1737
+ * sent on every request + analytics hit as `_ev`. */
1738
+ declare const version: string;
1738
1739
  /** Compile-time brand constants inlined at build time (name, CDN URL, theme). */
1739
1740
  declare const brand: {
1740
1741
  readonly id: string;
package/index.mjs CHANGED
@@ -29,6 +29,10 @@ var BRAND = {
29
29
  siteUrl: true ? "https://help.ai" : "https://help.ai"
30
30
  };
31
31
 
32
+ // src/core/version.ts
33
+ var ELEMENTS_VERSION = true ? "0.44.0" : "0.0.0-dev";
34
+ var ELEMENTS_VERSION_PARAM = "_ev";
35
+
32
36
  // src/i18n/strings.ts
33
37
  var STRINGS_EN = {
34
38
  attach: "Attach files",
@@ -1400,7 +1404,7 @@ var EventBus = class {
1400
1404
  import { h, render as renderPreact } from "preact";
1401
1405
 
1402
1406
  // src/ui/app.tsx
1403
- import { useCallback as useCallback6, useEffect as useEffect17, useMemo as useMemo3, useRef as useRef9, useState as useState13 } from "preact/hooks";
1407
+ import { useCallback as useCallback6, useEffect as useEffect16, useMemo as useMemo3, useRef as useRef9, useState as useState13 } from "preact/hooks";
1404
1408
  import { batch, useComputed as useComputed7, useSignal as useSignal2 } from "@preact/signals";
1405
1409
 
1406
1410
  // src/core/handshake-shape.ts
@@ -1790,7 +1794,7 @@ var AgentTransport = class {
1790
1794
  }
1791
1795
  /** Build the per-request envelope from the current transport state. */
1792
1796
  envelope() {
1793
- const out = {};
1797
+ const out = { [ELEMENTS_VERSION_PARAM]: ELEMENTS_VERSION };
1794
1798
  if (this.visitorId) out.visitorId = this.visitorId;
1795
1799
  if (this.conversationId) out.conversationId = this.conversationId;
1796
1800
  if (this.locale) out.locale = this.locale;
@@ -3302,7 +3306,7 @@ function resolveCalloutPosition(configured, launcherPosition) {
3302
3306
  }
3303
3307
 
3304
3308
  // src/ui/panel.tsx
3305
- import { useCallback as useCallback2, useEffect as useEffect10, useRef as useRef6 } from "preact/hooks";
3309
+ import { useCallback as useCallback2, useEffect as useEffect9, useRef as useRef6 } from "preact/hooks";
3306
3310
 
3307
3311
  // src/ui/resize-grip.tsx
3308
3312
  import { useEffect as useEffect2, useRef } from "preact/hooks";
@@ -4334,7 +4338,7 @@ function HeaderActions({ panelProps, variant }) {
4334
4338
  }
4335
4339
 
4336
4340
  // src/ui/message-list.tsx
4337
- import { useEffect as useEffect8, useLayoutEffect, useRef as useRef5, useState as useState6 } from "preact/hooks";
4341
+ import { useEffect as useEffect7, useLayoutEffect as useLayoutEffect2, useRef as useRef5, useState as useState6 } from "preact/hooks";
4338
4342
  import { useComputed as useComputed5 } from "@preact/signals";
4339
4343
 
4340
4344
  // src/ui/form/dynamic-form.tsx
@@ -4726,13 +4730,13 @@ function FormDoneMarker({
4726
4730
  import { useComputed as useComputed4 } from "@preact/signals";
4727
4731
 
4728
4732
  // src/ui/markdown.tsx
4729
- import { useEffect as useEffect7, useMemo, useRef as useRef4 } from "preact/hooks";
4733
+ import { useLayoutEffect, useMemo, useRef as useRef4 } from "preact/hooks";
4730
4734
  import { effect, signal as signal4 } from "@preact/signals";
4731
4735
  import * as smd from "streaming-markdown";
4732
4736
  import { jsx as jsx12 } from "preact/jsx-runtime";
4733
4737
  function MarkdownView({ textSig, doneSig }) {
4734
4738
  const ref = useRef4(null);
4735
- useEffect7(() => {
4739
+ useLayoutEffect(() => {
4736
4740
  const el = ref.current;
4737
4741
  if (!el) return;
4738
4742
  el.classList.add(`${BRAND.cssPrefix}-md`);
@@ -5224,7 +5228,7 @@ function MessageList({
5224
5228
  el.scrollTop = el.scrollHeight;
5225
5229
  };
5226
5230
  const firstMessageId = messages.value[0]?.id;
5227
- useLayoutEffect(() => {
5231
+ useLayoutEffect2(() => {
5228
5232
  const el = ref.current;
5229
5233
  if (!el) return;
5230
5234
  if (messages.value.length === 0) return;
@@ -5247,7 +5251,7 @@ function MessageList({
5247
5251
  };
5248
5252
  }, [firstMessageId]);
5249
5253
  const prevLengthRef = useRef5(0);
5250
- useEffect8(() => {
5254
+ useEffect7(() => {
5251
5255
  const el = ref.current;
5252
5256
  const list = messages.value;
5253
5257
  const prevLength = prevLengthRef.current;
@@ -5264,7 +5268,7 @@ function MessageList({
5264
5268
  const distanceFromBottom = el.scrollHeight - el.scrollTop - el.clientHeight;
5265
5269
  if (distanceFromBottom < STICK_THRESHOLD) pinBottom(el);
5266
5270
  }, [messages.value.length]);
5267
- useEffect8(() => {
5271
+ useEffect7(() => {
5268
5272
  const el = ref.current;
5269
5273
  if (!el) return;
5270
5274
  const last = messages.value.at(-1);
@@ -5285,13 +5289,13 @@ function MessageList({
5285
5289
  return () => obs.disconnect();
5286
5290
  }, [messages.value]);
5287
5291
  const activeFormId = form?.form.id;
5288
- useLayoutEffect(() => {
5292
+ useLayoutEffect2(() => {
5289
5293
  const el = ref.current;
5290
5294
  if (!el || !activeFormId || detachedRef.current) return;
5291
5295
  if (!messages.value.some((m) => m.role === "user")) return;
5292
5296
  pinBottom(el);
5293
5297
  }, [activeFormId]);
5294
- useEffect8(() => {
5298
+ useEffect7(() => {
5295
5299
  const el = ref.current;
5296
5300
  if (!el) return;
5297
5301
  const syncJump = () => setShowJump(el.scrollHeight - el.scrollTop - el.clientHeight > STICK_THRESHOLD * 2);
@@ -5461,7 +5465,7 @@ function dayLabel(createdAt, strings) {
5461
5465
  }
5462
5466
 
5463
5467
  // src/ui/conversation-list.tsx
5464
- import { useEffect as useEffect9, useState as useState7 } from "preact/hooks";
5468
+ import { useEffect as useEffect8, useState as useState7 } from "preact/hooks";
5465
5469
 
5466
5470
  // src/ui/history-groups.ts
5467
5471
  var HISTORY_BUCKETS = ["today", "yesterday", "lastWeek", "older"];
@@ -5519,7 +5523,7 @@ function ConversationList({
5519
5523
  const seed = transport.peekConversations({ visitorId });
5520
5524
  const [state, setState] = useState7(seed ? "loaded" : "loading");
5521
5525
  const [conversations, setChats] = useState7(seed?.conversations ?? []);
5522
- useEffect9(() => {
5526
+ useEffect8(() => {
5523
5527
  let cancelled = false;
5524
5528
  transport.listConversations({ visitorId }).then((res) => {
5525
5529
  if (cancelled) return;
@@ -5629,7 +5633,7 @@ function Panel(props2) {
5629
5633
  const { options, onClose } = props2;
5630
5634
  const s = options.strings;
5631
5635
  const containerRef = useRef6(null);
5632
- useEffect10(() => {
5636
+ useEffect9(() => {
5633
5637
  const el = containerRef.current;
5634
5638
  if (!el) return;
5635
5639
  const dispose = trapFocus(el);
@@ -6101,7 +6105,7 @@ var topScreen = (s) => activeStack(s).at(-1);
6101
6105
  var atTabRoot = (s) => activeStack(s).length === 0;
6102
6106
 
6103
6107
  // src/ui/messenger-home.tsx
6104
- import { useCallback as useCallback4, useEffect as useEffect15, useRef as useRef8 } from "preact/hooks";
6108
+ import { useCallback as useCallback4, useEffect as useEffect14, useRef as useRef8 } from "preact/hooks";
6105
6109
  import { useComputed as useComputed6 } from "@preact/signals";
6106
6110
 
6107
6111
  // src/ui/modules/chat.tsx
@@ -6111,7 +6115,7 @@ var chatLayout = {
6111
6115
  };
6112
6116
 
6113
6117
  // src/ui/modules/help.tsx
6114
- import { useEffect as useEffect11, useMemo as useMemo2, useState as useState8 } from "preact/hooks";
6118
+ import { useEffect as useEffect10, useMemo as useMemo2, useState as useState8 } from "preact/hooks";
6115
6119
 
6116
6120
  // src/ui/back-header.tsx
6117
6121
  import { jsx as jsx23, jsxs as jsxs19 } from "preact/jsx-runtime";
@@ -6233,7 +6237,7 @@ function HelpRoot({ transport, strings, config, nav, bus, panelProps }) {
6233
6237
  const [items, setItems] = useState8([]);
6234
6238
  const [query, setQuery] = useState8("");
6235
6239
  const [reloadKey, setReloadKey] = useState8(0);
6236
- useEffect11(() => {
6240
+ useEffect10(() => {
6237
6241
  let cancelled = false;
6238
6242
  setState("loading");
6239
6243
  transport.listContent({ tags, sortBy: "order", limit: 100 }).then((res) => {
@@ -6253,7 +6257,7 @@ function HelpRoot({ transport, strings, config, nav, bus, panelProps }) {
6253
6257
  };
6254
6258
  }, [transport, tags, reloadKey, bus]);
6255
6259
  const results = useMemo2(() => fuzzySearch(items, query), [items, query]);
6256
- useEffect11(() => {
6260
+ useEffect10(() => {
6257
6261
  const q = query.trim();
6258
6262
  if (!q) return;
6259
6263
  const timer = setTimeout(() => bus.emit("contentSearch", { queryLength: q.length, hitCount: results.length }), 600);
@@ -6286,7 +6290,7 @@ var helpLayout = {
6286
6290
  };
6287
6291
 
6288
6292
  // src/ui/modules/home.tsx
6289
- import { useEffect as useEffect12, useState as useState9 } from "preact/hooks";
6293
+ import { useEffect as useEffect11, useState as useState9 } from "preact/hooks";
6290
6294
 
6291
6295
  // src/ui/home-card.tsx
6292
6296
  import { jsx as jsx28 } from "preact/jsx-runtime";
@@ -6317,7 +6321,7 @@ function HomeRoot(props2) {
6317
6321
  const [recent, setRecent] = useState9(null);
6318
6322
  const [content, setContent] = useState9([]);
6319
6323
  const tagsKey = config.contentTags?.join(",");
6320
- useEffect12(() => {
6324
+ useEffect11(() => {
6321
6325
  if (!config.showRecentConversations) return;
6322
6326
  let cancelled = false;
6323
6327
  transport.listConversations({ limit: 1 }).then((res) => !cancelled && setRecent(res.conversations?.[0] ?? null)).catch((err) => !cancelled && log14.warn("listConversations (home) failed", { err }));
@@ -6325,7 +6329,7 @@ function HomeRoot(props2) {
6325
6329
  cancelled = true;
6326
6330
  };
6327
6331
  }, [transport, config.showRecentConversations]);
6328
- useEffect12(() => {
6332
+ useEffect11(() => {
6329
6333
  if (!config.contentTags?.length) return;
6330
6334
  let cancelled = false;
6331
6335
  transport.listContent({ tags: config.contentTags, limit: 6 }).then((res) => {
@@ -6405,7 +6409,7 @@ var homeLayout = {
6405
6409
  };
6406
6410
 
6407
6411
  // src/ui/modules/news.tsx
6408
- import { useEffect as useEffect13, useState as useState10 } from "preact/hooks";
6412
+ import { useEffect as useEffect12, useState as useState10 } from "preact/hooks";
6409
6413
  import { jsx as jsx30, jsxs as jsxs25 } from "preact/jsx-runtime";
6410
6414
  var p26 = BRAND.cssPrefix;
6411
6415
  var log15 = logger.scope("news");
@@ -6415,7 +6419,7 @@ function NewsRoot({ transport, strings, config, nav, bus, panelProps }) {
6415
6419
  const [errorMsg, setErrorMsg] = useState10(strings.errorGeneric);
6416
6420
  const [items, setItems] = useState10([]);
6417
6421
  const [reloadKey, setReloadKey] = useState10(0);
6418
- useEffect13(() => {
6422
+ useEffect12(() => {
6419
6423
  let cancelled = false;
6420
6424
  setState("loading");
6421
6425
  transport.listContent({ tags, sortBy: "publishedAt", sortOrder: "desc" }).then((res) => {
@@ -6537,7 +6541,7 @@ function IframeView({ url, title, strings, onBack, actions }) {
6537
6541
  }
6538
6542
 
6539
6543
  // src/ui/content-view.tsx
6540
- import { useCallback as useCallback3, useEffect as useEffect14, useState as useState11 } from "preact/hooks";
6544
+ import { useCallback as useCallback3, useEffect as useEffect13, useState as useState11 } from "preact/hooks";
6541
6545
  import { jsx as jsx33, jsxs as jsxs28 } from "preact/jsx-runtime";
6542
6546
  var p29 = BRAND.cssPrefix;
6543
6547
  var log16 = logger.scope("content");
@@ -6551,7 +6555,7 @@ function ContentView({ id, title, transport, strings, bus, onBack, actions }) {
6551
6555
  setItem(null);
6552
6556
  setReloadKey((k) => k + 1);
6553
6557
  }, []);
6554
- useEffect14(() => {
6558
+ useEffect13(() => {
6555
6559
  let cancelled = false;
6556
6560
  transport.listContent({ ids: [id], limit: 1 }).then((res) => {
6557
6561
  if (cancelled) return;
@@ -6569,7 +6573,7 @@ function ContentView({ id, title, transport, strings, bus, onBack, actions }) {
6569
6573
  cancelled = true;
6570
6574
  };
6571
6575
  }, [transport, id, reloadKey, bus]);
6572
- useEffect14(() => {
6576
+ useEffect13(() => {
6573
6577
  if (!item) return;
6574
6578
  const timer = setTimeout(() => bus.emit("contentRead", { contentId: id }), READ_DWELL_MS);
6575
6579
  return () => clearTimeout(timer);
@@ -6622,7 +6626,7 @@ function MessengerHome({
6622
6626
  const options = panelProps.options;
6623
6627
  const strings = options.strings;
6624
6628
  const containerRef = useRef8(null);
6625
- useEffect15(() => {
6629
+ useEffect14(() => {
6626
6630
  const el = containerRef.current;
6627
6631
  if (!el) return;
6628
6632
  const dispose = trapFocus(el);
@@ -6647,7 +6651,7 @@ function MessengerHome({
6647
6651
  const isReader = top?.kind === "iframe" || top?.kind === "content";
6648
6652
  const showTabBar = enabledModules.length > 1 && (atTabRoot(navState) || !isReader);
6649
6653
  const savedSize = useRef8(null);
6650
- useEffect15(() => {
6654
+ useEffect14(() => {
6651
6655
  if (isReader && savedSize.current === null) {
6652
6656
  savedSize.current = panelProps.panelSize;
6653
6657
  if (panelProps.panelSize === "normal") onSetPanelSize("expanded");
@@ -6780,12 +6784,12 @@ function ModulesEmpty({ strings, onClose }) {
6780
6784
  }
6781
6785
 
6782
6786
  // src/ui/use-launcher-callout.ts
6783
- import { useCallback as useCallback5, useEffect as useEffect16, useState as useState12 } from "preact/hooks";
6787
+ import { useCallback as useCallback5, useEffect as useEffect15, useState as useState12 } from "preact/hooks";
6784
6788
  function useLauncherCallout({ callout, persistence }) {
6785
6789
  const textKey = callout?.text ?? "";
6786
6790
  const persistent = callout?.persistent ?? true;
6787
6791
  const [dismissed, setDismissed] = useState12(() => persistent ? false : persistence.loadCalloutDismissed(textKey));
6788
- useEffect16(() => {
6792
+ useEffect15(() => {
6789
6793
  setDismissed(persistent ? false : persistence.loadCalloutDismissed(textKey));
6790
6794
  }, [textKey, persistent, persistence]);
6791
6795
  const dismissCallout = useCallback5(() => {
@@ -6849,7 +6853,7 @@ function App({ options, hostElement, bus }) {
6849
6853
  activatedRef.current = activated;
6850
6854
  const pendingThreadRef = useRef9(false);
6851
6855
  const welcomeRef = useRef9(void 0);
6852
- useEffect17(() => {
6856
+ useEffect16(() => {
6853
6857
  if (isOpen) setActivated(true);
6854
6858
  }, [isOpen]);
6855
6859
  const initialPanelApplied = useRef9(false);
@@ -6900,20 +6904,20 @@ function App({ options, hostElement, bus }) {
6900
6904
  },
6901
6905
  [persistence, transport]
6902
6906
  );
6903
- useEffect17(() => {
6907
+ useEffect16(() => {
6904
6908
  if (initialSettings.soundMuted !== void 0) feedback.setMuted(initialSettings.soundMuted);
6905
6909
  }, []);
6906
- useEffect17(() => {
6910
+ useEffect16(() => {
6907
6911
  hostElement.dataset.theme = activeThemeMode;
6908
6912
  }, [hostElement, activeThemeMode, options]);
6909
- useEffect17(() => {
6913
+ useEffect16(() => {
6910
6914
  hostElement.dataset.textSize = activeTextSize;
6911
6915
  }, [hostElement, activeTextSize, options]);
6912
- useEffect17(() => {
6916
+ useEffect16(() => {
6913
6917
  feedback.update(options.sound, options.haptics);
6914
6918
  }, [feedback, options.sound, options.haptics]);
6915
- useEffect17(() => () => feedback.destroy(), [feedback]);
6916
- useEffect17(() => {
6919
+ useEffect16(() => () => feedback.destroy(), [feedback]);
6920
+ useEffect16(() => {
6917
6921
  let firstRun = true;
6918
6922
  return feedback.mutedSig.subscribe((muted) => {
6919
6923
  if (firstRun) {
@@ -6923,13 +6927,13 @@ function App({ options, hostElement, bus }) {
6923
6927
  patchAndSync({ soundMuted: muted });
6924
6928
  });
6925
6929
  }, [feedback, patchAndSync]);
6926
- useEffect17(() => {
6930
+ useEffect16(() => {
6927
6931
  if (initialSizeApplied.current || !options.size.initialSize) return;
6928
6932
  initialSizeApplied.current = true;
6929
6933
  if (persistence.loadPanelSize()) return;
6930
6934
  setPanelSize(pickInitialPanelSize(options.mode, options.size, currentViewportWidth()));
6931
6935
  }, [options.mode, options.size, persistence]);
6932
- useEffect17(() => {
6936
+ useEffect16(() => {
6933
6937
  if (!conversationReady || initialPanelApplied.current) return;
6934
6938
  initialPanelApplied.current = true;
6935
6939
  const state = resolveInitialPanelState(
@@ -6944,7 +6948,7 @@ function App({ options, hostElement, bus }) {
6944
6948
  const homeNavSeeded = useRef9(false);
6945
6949
  const resumeActiveRef = useRef9(false);
6946
6950
  const resumeBubbleRef = useRef9(null);
6947
- useEffect17(() => {
6951
+ useEffect16(() => {
6948
6952
  if (!conversationReady || homeNavSeeded.current) return;
6949
6953
  homeNavSeeded.current = true;
6950
6954
  if (resumeActiveRef.current) {
@@ -7129,18 +7133,18 @@ function App({ options, hostElement, bus }) {
7129
7133
  const userSig = JSON.stringify(options.userContext ?? null);
7130
7134
  const pageSig = JSON.stringify(options.pageContext ?? null);
7131
7135
  const formCtxSig = JSON.stringify(formContext);
7132
- useEffect17(() => {
7136
+ useEffect16(() => {
7133
7137
  const merged = Object.keys(formContext).length ? { ...formContext, ...options.userContext } : options.userContext;
7134
7138
  transport.setContext(merged, toWirePageContext(options.pageContext));
7135
7139
  }, [transport, userSig, pageSig, formCtxSig]);
7136
7140
  const effectiveLocale = clampLocale(activeLocale, options.availableLocales, options.defaultLocale);
7137
- useEffect17(() => {
7141
+ useEffect16(() => {
7138
7142
  transport.setLocale(effectiveLocale);
7139
7143
  }, [transport, effectiveLocale]);
7140
- useEffect17(() => {
7144
+ useEffect16(() => {
7141
7145
  hostElement.dir = isRtlLocale(effectiveLocale) ? "rtl" : "ltr";
7142
7146
  }, [hostElement, effectiveLocale]);
7143
- useEffect17(() => {
7147
+ useEffect16(() => {
7144
7148
  if (effectiveLocale !== activeLocale) setActiveLocale(effectiveLocale);
7145
7149
  }, [effectiveLocale, activeLocale]);
7146
7150
  const runResume = useCallback6(
@@ -7188,7 +7192,7 @@ function App({ options, hostElement, bus }) {
7188
7192
  [reducer, messagesSig, feedback, bus, options, homeNav]
7189
7193
  );
7190
7194
  const resumeHandleRef = useRef9(null);
7191
- useEffect17(() => {
7195
+ useEffect16(() => {
7192
7196
  const persistedConversation = conversationIdSig.value;
7193
7197
  if (persistedConversation) transport.primeIdentity(visitorId, persistedConversation);
7194
7198
  void runHandshake({ newConversation: false });
@@ -7197,7 +7201,7 @@ function App({ options, hostElement, bus }) {
7197
7201
  resumeHandleRef.current?.cancel();
7198
7202
  };
7199
7203
  }, []);
7200
- useEffect17(() => {
7204
+ useEffect16(() => {
7201
7205
  if (!activated) return;
7202
7206
  dataBootRef.current = transport.bootstrap();
7203
7207
  void (async () => {
@@ -7222,7 +7226,7 @@ function App({ options, hostElement, bus }) {
7222
7226
  }
7223
7227
  }, [activated]);
7224
7228
  const formsLocaleRef = useRef9(null);
7225
- useEffect17(() => {
7229
+ useEffect16(() => {
7226
7230
  if (!activated) return;
7227
7231
  if (formsLocaleRef.current === null) {
7228
7232
  formsLocaleRef.current = effectiveLocale;
@@ -7239,15 +7243,15 @@ function App({ options, hostElement, bus }) {
7239
7243
  };
7240
7244
  }, [activated, effectiveLocale, transport]);
7241
7245
  const lastUserSig = useRef9(userSig);
7242
- useEffect17(() => {
7246
+ useEffect16(() => {
7243
7247
  if (!conversationReady || lastUserSig.current === userSig) return;
7244
7248
  lastUserSig.current = userSig;
7245
7249
  void runHandshake({ newConversation: false });
7246
7250
  }, [userSig, conversationReady, runHandshake]);
7247
- useEffect17(() => {
7251
+ useEffect16(() => {
7248
7252
  applyMode(hostElement, computeHostMode(options.mode, panelSize, isOpen));
7249
7253
  }, [hostElement, isOpen, panelSize, options.mode]);
7250
- useEffect17(() => {
7254
+ useEffect16(() => {
7251
7255
  if (options.mode !== "modal" || !isOpen) return;
7252
7256
  const onClick = (e) => {
7253
7257
  const path = e.composedPath();
@@ -7259,7 +7263,7 @@ function App({ options, hostElement, bus }) {
7259
7263
  hostElement.addEventListener("click", onClick);
7260
7264
  return () => hostElement.removeEventListener("click", onClick);
7261
7265
  }, [hostElement, isOpen, options.mode]);
7262
- useEffect17(() => {
7266
+ useEffect16(() => {
7263
7267
  if (options.mode !== "drawer" || !isOpen) return;
7264
7268
  const onKey = (e) => {
7265
7269
  if (e.key === "Escape") setIsOpen(false);
@@ -7394,25 +7398,25 @@ function App({ options, hostElement, bus }) {
7394
7398
  }
7395
7399
  });
7396
7400
  const activeForm = useComputed7(() => forms.activeForm.value);
7397
- useEffect17(() => {
7401
+ useEffect16(() => {
7398
7402
  forms.refresh();
7399
7403
  }, [effectiveForms, forms]);
7400
7404
  const pageArea = options.pageContext?.area ? String(options.pageContext.area) : void 0;
7401
7405
  const msgCount = useComputed7(() => messagesSig.value.length);
7402
- useEffect17(() => {
7406
+ useEffect16(() => {
7403
7407
  if (conversationReady && formsReady) forms.fire("pre-chat");
7404
7408
  }, [conversationReady, formsReady, forms]);
7405
- useEffect17(() => {
7409
+ useEffect16(() => {
7406
7410
  if (formsReady && !canSend) forms.fire("conversation-closed");
7407
7411
  }, [formsReady, canSend, forms]);
7408
- useEffect17(() => {
7412
+ useEffect16(() => {
7409
7413
  if (conversationReady && formsReady && pageArea) forms.fire("page-area");
7410
7414
  }, [conversationReady, formsReady, pageArea, forms]);
7411
7415
  const idleMs = useMemo3(() => {
7412
7416
  const secs = effectiveForms.list.flatMap((f) => f.triggers).filter((t) => t.kind === "idle").map((t) => Number(t.param));
7413
7417
  return secs.length ? Math.min(...secs) * 1e3 : 0;
7414
7418
  }, [effectiveForms]);
7415
- useEffect17(() => {
7419
+ useEffect16(() => {
7416
7420
  if (!idleMs || !isOpen) return;
7417
7421
  const id = setTimeout(() => forms.fire("idle"), idleMs);
7418
7422
  return () => clearTimeout(id);
@@ -7472,7 +7476,7 @@ function App({ options, hostElement, bus }) {
7472
7476
  }).catch((err) => log17.debug("refreshUnread failed (non-fatal)", { err }));
7473
7477
  }, [transport, options.modules, unreadCountSig]);
7474
7478
  const unreadSeeded = useRef9(false);
7475
- useEffect17(() => {
7479
+ useEffect16(() => {
7476
7480
  if (!activated || !conversationReady || unreadSeeded.current) return;
7477
7481
  unreadSeeded.current = true;
7478
7482
  refreshUnread();
@@ -7630,12 +7634,12 @@ function App({ options, hostElement, bus }) {
7630
7634
  },
7631
7635
  [formsReady, forms]
7632
7636
  );
7633
- useEffect17(() => {
7637
+ useEffect16(() => {
7634
7638
  if (!formsReady || !pendingOpenFormRef.current) return;
7635
7639
  forms.fire("manual", pendingOpenFormRef.current);
7636
7640
  pendingOpenFormRef.current = null;
7637
7641
  }, [formsReady, forms]);
7638
- useEffect17(() => {
7642
+ useEffect16(() => {
7639
7643
  const unsub = bindHostCommands(hostElement, {
7640
7644
  open: handleOpen,
7641
7645
  close: handleClose,
@@ -7902,6 +7906,7 @@ function createTracker(bus, deps) {
7902
7906
  if (++windowHits > MAX_HITS_PER_MINUTE) return;
7903
7907
  const params = new URLSearchParams();
7904
7908
  params.set("v", PROTOCOL_VERSION);
7909
+ params.set(ELEMENTS_VERSION_PARAM, ELEMENTS_VERSION);
7905
7910
  params.set("e", event);
7906
7911
  if (tracking.token) params.set("tk", tracking.token);
7907
7912
  if (publicKey) params.set("pk", publicKey);
@@ -8222,7 +8227,7 @@ function getAllInstances() {
8222
8227
  function hook(widgetId, event, listener) {
8223
8228
  return registerHook(widgetId, event, listener);
8224
8229
  }
8225
- var version = "0.1.0";
8230
+ var version = ELEMENTS_VERSION;
8226
8231
  var brand = BRAND;
8227
8232
  export {
8228
8233
  HOOK_WILDCARD,
package/package.json CHANGED
@@ -80,5 +80,5 @@
80
80
  ],
81
81
  "type": "module",
82
82
  "types": "./index.d.ts",
83
- "version": "0.43.1"
83
+ "version": "0.44.0"
84
84
  }