@helpai/elements 0.43.1 → 0.43.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/elements-web-component.esm.js +9 -9
- package/elements-web-component.esm.js.map +3 -3
- package/elements.cjs.js +9 -9
- package/elements.cjs.js.map +3 -3
- package/elements.esm.js +9 -9
- package/elements.esm.js.map +3 -3
- package/elements.js +9 -9
- package/elements.js.map +3 -3
- package/index.d.ts +1 -1
- package/index.mjs +58 -58
- package/package.json +1 -1
- package/schema.d.ts +26 -26
- package/web-component.mjs +58 -58
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
|
|
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
|
|
@@ -3261,7 +3261,7 @@ function resolveCalloutPosition(configured, launcherPosition) {
|
|
|
3261
3261
|
}
|
|
3262
3262
|
|
|
3263
3263
|
// src/ui/panel.tsx
|
|
3264
|
-
import { useCallback as useCallback2, useEffect as
|
|
3264
|
+
import { useCallback as useCallback2, useEffect as useEffect9, useRef as useRef6 } from "preact/hooks";
|
|
3265
3265
|
|
|
3266
3266
|
// src/ui/resize-grip.tsx
|
|
3267
3267
|
import { useEffect as useEffect2, useRef } from "preact/hooks";
|
|
@@ -4293,7 +4293,7 @@ function HeaderActions({ panelProps, variant }) {
|
|
|
4293
4293
|
}
|
|
4294
4294
|
|
|
4295
4295
|
// src/ui/message-list.tsx
|
|
4296
|
-
import { useEffect as
|
|
4296
|
+
import { useEffect as useEffect7, useLayoutEffect as useLayoutEffect2, useRef as useRef5, useState as useState6 } from "preact/hooks";
|
|
4297
4297
|
import { useComputed as useComputed5 } from "@preact/signals";
|
|
4298
4298
|
|
|
4299
4299
|
// src/ui/form/dynamic-form.tsx
|
|
@@ -4685,13 +4685,13 @@ function FormDoneMarker({
|
|
|
4685
4685
|
import { useComputed as useComputed4 } from "@preact/signals";
|
|
4686
4686
|
|
|
4687
4687
|
// src/ui/markdown.tsx
|
|
4688
|
-
import {
|
|
4688
|
+
import { useLayoutEffect, useMemo, useRef as useRef4 } from "preact/hooks";
|
|
4689
4689
|
import { effect, signal as signal4 } from "@preact/signals";
|
|
4690
4690
|
import * as smd from "streaming-markdown";
|
|
4691
4691
|
import { jsx as jsx12 } from "preact/jsx-runtime";
|
|
4692
4692
|
function MarkdownView({ textSig, doneSig }) {
|
|
4693
4693
|
const ref = useRef4(null);
|
|
4694
|
-
|
|
4694
|
+
useLayoutEffect(() => {
|
|
4695
4695
|
const el = ref.current;
|
|
4696
4696
|
if (!el) return;
|
|
4697
4697
|
el.classList.add(`${BRAND.cssPrefix}-md`);
|
|
@@ -5183,7 +5183,7 @@ function MessageList({
|
|
|
5183
5183
|
el.scrollTop = el.scrollHeight;
|
|
5184
5184
|
};
|
|
5185
5185
|
const firstMessageId = messages.value[0]?.id;
|
|
5186
|
-
|
|
5186
|
+
useLayoutEffect2(() => {
|
|
5187
5187
|
const el = ref.current;
|
|
5188
5188
|
if (!el) return;
|
|
5189
5189
|
if (messages.value.length === 0) return;
|
|
@@ -5206,7 +5206,7 @@ function MessageList({
|
|
|
5206
5206
|
};
|
|
5207
5207
|
}, [firstMessageId]);
|
|
5208
5208
|
const prevLengthRef = useRef5(0);
|
|
5209
|
-
|
|
5209
|
+
useEffect7(() => {
|
|
5210
5210
|
const el = ref.current;
|
|
5211
5211
|
const list = messages.value;
|
|
5212
5212
|
const prevLength = prevLengthRef.current;
|
|
@@ -5223,7 +5223,7 @@ function MessageList({
|
|
|
5223
5223
|
const distanceFromBottom = el.scrollHeight - el.scrollTop - el.clientHeight;
|
|
5224
5224
|
if (distanceFromBottom < STICK_THRESHOLD) pinBottom(el);
|
|
5225
5225
|
}, [messages.value.length]);
|
|
5226
|
-
|
|
5226
|
+
useEffect7(() => {
|
|
5227
5227
|
const el = ref.current;
|
|
5228
5228
|
if (!el) return;
|
|
5229
5229
|
const last = messages.value.at(-1);
|
|
@@ -5244,13 +5244,13 @@ function MessageList({
|
|
|
5244
5244
|
return () => obs.disconnect();
|
|
5245
5245
|
}, [messages.value]);
|
|
5246
5246
|
const activeFormId = form?.form.id;
|
|
5247
|
-
|
|
5247
|
+
useLayoutEffect2(() => {
|
|
5248
5248
|
const el = ref.current;
|
|
5249
5249
|
if (!el || !activeFormId || detachedRef.current) return;
|
|
5250
5250
|
if (!messages.value.some((m) => m.role === "user")) return;
|
|
5251
5251
|
pinBottom(el);
|
|
5252
5252
|
}, [activeFormId]);
|
|
5253
|
-
|
|
5253
|
+
useEffect7(() => {
|
|
5254
5254
|
const el = ref.current;
|
|
5255
5255
|
if (!el) return;
|
|
5256
5256
|
const syncJump = () => setShowJump(el.scrollHeight - el.scrollTop - el.clientHeight > STICK_THRESHOLD * 2);
|
|
@@ -5420,7 +5420,7 @@ function dayLabel(createdAt, strings) {
|
|
|
5420
5420
|
}
|
|
5421
5421
|
|
|
5422
5422
|
// src/ui/conversation-list.tsx
|
|
5423
|
-
import { useEffect as
|
|
5423
|
+
import { useEffect as useEffect8, useState as useState7 } from "preact/hooks";
|
|
5424
5424
|
|
|
5425
5425
|
// src/ui/history-groups.ts
|
|
5426
5426
|
var HISTORY_BUCKETS = ["today", "yesterday", "lastWeek", "older"];
|
|
@@ -5478,7 +5478,7 @@ function ConversationList({
|
|
|
5478
5478
|
const seed = transport.peekConversations({ visitorId });
|
|
5479
5479
|
const [state, setState] = useState7(seed ? "loaded" : "loading");
|
|
5480
5480
|
const [conversations, setChats] = useState7(seed?.conversations ?? []);
|
|
5481
|
-
|
|
5481
|
+
useEffect8(() => {
|
|
5482
5482
|
let cancelled = false;
|
|
5483
5483
|
transport.listConversations({ visitorId }).then((res) => {
|
|
5484
5484
|
if (cancelled) return;
|
|
@@ -5588,7 +5588,7 @@ function Panel(props2) {
|
|
|
5588
5588
|
const { options, onClose } = props2;
|
|
5589
5589
|
const s = options.strings;
|
|
5590
5590
|
const containerRef = useRef6(null);
|
|
5591
|
-
|
|
5591
|
+
useEffect9(() => {
|
|
5592
5592
|
const el = containerRef.current;
|
|
5593
5593
|
if (!el) return;
|
|
5594
5594
|
const dispose = trapFocus(el);
|
|
@@ -6060,7 +6060,7 @@ var topScreen = (s) => activeStack(s).at(-1);
|
|
|
6060
6060
|
var atTabRoot = (s) => activeStack(s).length === 0;
|
|
6061
6061
|
|
|
6062
6062
|
// src/ui/messenger-home.tsx
|
|
6063
|
-
import { useCallback as useCallback4, useEffect as
|
|
6063
|
+
import { useCallback as useCallback4, useEffect as useEffect14, useRef as useRef8 } from "preact/hooks";
|
|
6064
6064
|
import { useComputed as useComputed6 } from "@preact/signals";
|
|
6065
6065
|
|
|
6066
6066
|
// src/ui/modules/chat.tsx
|
|
@@ -6070,7 +6070,7 @@ var chatLayout = {
|
|
|
6070
6070
|
};
|
|
6071
6071
|
|
|
6072
6072
|
// src/ui/modules/help.tsx
|
|
6073
|
-
import { useEffect as
|
|
6073
|
+
import { useEffect as useEffect10, useMemo as useMemo2, useState as useState8 } from "preact/hooks";
|
|
6074
6074
|
|
|
6075
6075
|
// src/ui/back-header.tsx
|
|
6076
6076
|
import { jsx as jsx23, jsxs as jsxs19 } from "preact/jsx-runtime";
|
|
@@ -6192,7 +6192,7 @@ function HelpRoot({ transport, strings, config, nav, bus, panelProps }) {
|
|
|
6192
6192
|
const [items, setItems] = useState8([]);
|
|
6193
6193
|
const [query, setQuery] = useState8("");
|
|
6194
6194
|
const [reloadKey, setReloadKey] = useState8(0);
|
|
6195
|
-
|
|
6195
|
+
useEffect10(() => {
|
|
6196
6196
|
let cancelled = false;
|
|
6197
6197
|
setState("loading");
|
|
6198
6198
|
transport.listContent({ tags, sortBy: "order", limit: 100 }).then((res) => {
|
|
@@ -6212,7 +6212,7 @@ function HelpRoot({ transport, strings, config, nav, bus, panelProps }) {
|
|
|
6212
6212
|
};
|
|
6213
6213
|
}, [transport, tags, reloadKey, bus]);
|
|
6214
6214
|
const results = useMemo2(() => fuzzySearch(items, query), [items, query]);
|
|
6215
|
-
|
|
6215
|
+
useEffect10(() => {
|
|
6216
6216
|
const q = query.trim();
|
|
6217
6217
|
if (!q) return;
|
|
6218
6218
|
const timer = setTimeout(() => bus.emit("contentSearch", { queryLength: q.length, hitCount: results.length }), 600);
|
|
@@ -6245,7 +6245,7 @@ var helpLayout = {
|
|
|
6245
6245
|
};
|
|
6246
6246
|
|
|
6247
6247
|
// src/ui/modules/home.tsx
|
|
6248
|
-
import { useEffect as
|
|
6248
|
+
import { useEffect as useEffect11, useState as useState9 } from "preact/hooks";
|
|
6249
6249
|
|
|
6250
6250
|
// src/ui/home-card.tsx
|
|
6251
6251
|
import { jsx as jsx28 } from "preact/jsx-runtime";
|
|
@@ -6276,7 +6276,7 @@ function HomeRoot(props2) {
|
|
|
6276
6276
|
const [recent, setRecent] = useState9(null);
|
|
6277
6277
|
const [content, setContent] = useState9([]);
|
|
6278
6278
|
const tagsKey = config.contentTags?.join(",");
|
|
6279
|
-
|
|
6279
|
+
useEffect11(() => {
|
|
6280
6280
|
if (!config.showRecentConversations) return;
|
|
6281
6281
|
let cancelled = false;
|
|
6282
6282
|
transport.listConversations({ limit: 1 }).then((res) => !cancelled && setRecent(res.conversations?.[0] ?? null)).catch((err) => !cancelled && log13.warn("listConversations (home) failed", { err }));
|
|
@@ -6284,7 +6284,7 @@ function HomeRoot(props2) {
|
|
|
6284
6284
|
cancelled = true;
|
|
6285
6285
|
};
|
|
6286
6286
|
}, [transport, config.showRecentConversations]);
|
|
6287
|
-
|
|
6287
|
+
useEffect11(() => {
|
|
6288
6288
|
if (!config.contentTags?.length) return;
|
|
6289
6289
|
let cancelled = false;
|
|
6290
6290
|
transport.listContent({ tags: config.contentTags, limit: 6 }).then((res) => {
|
|
@@ -6364,7 +6364,7 @@ var homeLayout = {
|
|
|
6364
6364
|
};
|
|
6365
6365
|
|
|
6366
6366
|
// src/ui/modules/news.tsx
|
|
6367
|
-
import { useEffect as
|
|
6367
|
+
import { useEffect as useEffect12, useState as useState10 } from "preact/hooks";
|
|
6368
6368
|
import { jsx as jsx30, jsxs as jsxs25 } from "preact/jsx-runtime";
|
|
6369
6369
|
var p26 = BRAND.cssPrefix;
|
|
6370
6370
|
var log14 = logger.scope("news");
|
|
@@ -6374,7 +6374,7 @@ function NewsRoot({ transport, strings, config, nav, bus, panelProps }) {
|
|
|
6374
6374
|
const [errorMsg, setErrorMsg] = useState10(strings.errorGeneric);
|
|
6375
6375
|
const [items, setItems] = useState10([]);
|
|
6376
6376
|
const [reloadKey, setReloadKey] = useState10(0);
|
|
6377
|
-
|
|
6377
|
+
useEffect12(() => {
|
|
6378
6378
|
let cancelled = false;
|
|
6379
6379
|
setState("loading");
|
|
6380
6380
|
transport.listContent({ tags, sortBy: "publishedAt", sortOrder: "desc" }).then((res) => {
|
|
@@ -6496,7 +6496,7 @@ function IframeView({ url, title, strings, onBack, actions }) {
|
|
|
6496
6496
|
}
|
|
6497
6497
|
|
|
6498
6498
|
// src/ui/content-view.tsx
|
|
6499
|
-
import { useCallback as useCallback3, useEffect as
|
|
6499
|
+
import { useCallback as useCallback3, useEffect as useEffect13, useState as useState11 } from "preact/hooks";
|
|
6500
6500
|
import { jsx as jsx33, jsxs as jsxs28 } from "preact/jsx-runtime";
|
|
6501
6501
|
var p29 = BRAND.cssPrefix;
|
|
6502
6502
|
var log15 = logger.scope("content");
|
|
@@ -6510,7 +6510,7 @@ function ContentView({ id, title, transport, strings, bus, onBack, actions }) {
|
|
|
6510
6510
|
setItem(null);
|
|
6511
6511
|
setReloadKey((k) => k + 1);
|
|
6512
6512
|
}, []);
|
|
6513
|
-
|
|
6513
|
+
useEffect13(() => {
|
|
6514
6514
|
let cancelled = false;
|
|
6515
6515
|
transport.listContent({ ids: [id], limit: 1 }).then((res) => {
|
|
6516
6516
|
if (cancelled) return;
|
|
@@ -6528,7 +6528,7 @@ function ContentView({ id, title, transport, strings, bus, onBack, actions }) {
|
|
|
6528
6528
|
cancelled = true;
|
|
6529
6529
|
};
|
|
6530
6530
|
}, [transport, id, reloadKey, bus]);
|
|
6531
|
-
|
|
6531
|
+
useEffect13(() => {
|
|
6532
6532
|
if (!item) return;
|
|
6533
6533
|
const timer = setTimeout(() => bus.emit("contentRead", { contentId: id }), READ_DWELL_MS);
|
|
6534
6534
|
return () => clearTimeout(timer);
|
|
@@ -6581,7 +6581,7 @@ function MessengerHome({
|
|
|
6581
6581
|
const options = panelProps.options;
|
|
6582
6582
|
const strings = options.strings;
|
|
6583
6583
|
const containerRef = useRef8(null);
|
|
6584
|
-
|
|
6584
|
+
useEffect14(() => {
|
|
6585
6585
|
const el = containerRef.current;
|
|
6586
6586
|
if (!el) return;
|
|
6587
6587
|
const dispose = trapFocus(el);
|
|
@@ -6606,7 +6606,7 @@ function MessengerHome({
|
|
|
6606
6606
|
const isReader = top?.kind === "iframe" || top?.kind === "content";
|
|
6607
6607
|
const showTabBar = enabledModules.length > 1 && (atTabRoot(navState) || !isReader);
|
|
6608
6608
|
const savedSize = useRef8(null);
|
|
6609
|
-
|
|
6609
|
+
useEffect14(() => {
|
|
6610
6610
|
if (isReader && savedSize.current === null) {
|
|
6611
6611
|
savedSize.current = panelProps.panelSize;
|
|
6612
6612
|
if (panelProps.panelSize === "normal") onSetPanelSize("expanded");
|
|
@@ -6739,12 +6739,12 @@ function ModulesEmpty({ strings, onClose }) {
|
|
|
6739
6739
|
}
|
|
6740
6740
|
|
|
6741
6741
|
// src/ui/use-launcher-callout.ts
|
|
6742
|
-
import { useCallback as useCallback5, useEffect as
|
|
6742
|
+
import { useCallback as useCallback5, useEffect as useEffect15, useState as useState12 } from "preact/hooks";
|
|
6743
6743
|
function useLauncherCallout({ callout, persistence }) {
|
|
6744
6744
|
const textKey = callout?.text ?? "";
|
|
6745
6745
|
const persistent = callout?.persistent ?? true;
|
|
6746
6746
|
const [dismissed, setDismissed] = useState12(() => persistent ? false : persistence.loadCalloutDismissed(textKey));
|
|
6747
|
-
|
|
6747
|
+
useEffect15(() => {
|
|
6748
6748
|
setDismissed(persistent ? false : persistence.loadCalloutDismissed(textKey));
|
|
6749
6749
|
}, [textKey, persistent, persistence]);
|
|
6750
6750
|
const dismissCallout = useCallback5(() => {
|
|
@@ -6808,7 +6808,7 @@ function App({ options, hostElement, bus }) {
|
|
|
6808
6808
|
activatedRef.current = activated;
|
|
6809
6809
|
const pendingThreadRef = useRef9(false);
|
|
6810
6810
|
const welcomeRef = useRef9(void 0);
|
|
6811
|
-
|
|
6811
|
+
useEffect16(() => {
|
|
6812
6812
|
if (isOpen) setActivated(true);
|
|
6813
6813
|
}, [isOpen]);
|
|
6814
6814
|
const initialPanelApplied = useRef9(false);
|
|
@@ -6859,20 +6859,20 @@ function App({ options, hostElement, bus }) {
|
|
|
6859
6859
|
},
|
|
6860
6860
|
[persistence, transport]
|
|
6861
6861
|
);
|
|
6862
|
-
|
|
6862
|
+
useEffect16(() => {
|
|
6863
6863
|
if (initialSettings.soundMuted !== void 0) feedback.setMuted(initialSettings.soundMuted);
|
|
6864
6864
|
}, []);
|
|
6865
|
-
|
|
6865
|
+
useEffect16(() => {
|
|
6866
6866
|
hostElement.dataset.theme = activeThemeMode;
|
|
6867
6867
|
}, [hostElement, activeThemeMode, options]);
|
|
6868
|
-
|
|
6868
|
+
useEffect16(() => {
|
|
6869
6869
|
hostElement.dataset.textSize = activeTextSize;
|
|
6870
6870
|
}, [hostElement, activeTextSize, options]);
|
|
6871
|
-
|
|
6871
|
+
useEffect16(() => {
|
|
6872
6872
|
feedback.update(options.sound, options.haptics);
|
|
6873
6873
|
}, [feedback, options.sound, options.haptics]);
|
|
6874
|
-
|
|
6875
|
-
|
|
6874
|
+
useEffect16(() => () => feedback.destroy(), [feedback]);
|
|
6875
|
+
useEffect16(() => {
|
|
6876
6876
|
let firstRun = true;
|
|
6877
6877
|
return feedback.mutedSig.subscribe((muted) => {
|
|
6878
6878
|
if (firstRun) {
|
|
@@ -6882,13 +6882,13 @@ function App({ options, hostElement, bus }) {
|
|
|
6882
6882
|
patchAndSync({ soundMuted: muted });
|
|
6883
6883
|
});
|
|
6884
6884
|
}, [feedback, patchAndSync]);
|
|
6885
|
-
|
|
6885
|
+
useEffect16(() => {
|
|
6886
6886
|
if (initialSizeApplied.current || !options.size.initialSize) return;
|
|
6887
6887
|
initialSizeApplied.current = true;
|
|
6888
6888
|
if (persistence.loadPanelSize()) return;
|
|
6889
6889
|
setPanelSize(pickInitialPanelSize(options.mode, options.size, currentViewportWidth()));
|
|
6890
6890
|
}, [options.mode, options.size, persistence]);
|
|
6891
|
-
|
|
6891
|
+
useEffect16(() => {
|
|
6892
6892
|
if (!conversationReady || initialPanelApplied.current) return;
|
|
6893
6893
|
initialPanelApplied.current = true;
|
|
6894
6894
|
const state = resolveInitialPanelState(
|
|
@@ -6903,7 +6903,7 @@ function App({ options, hostElement, bus }) {
|
|
|
6903
6903
|
const homeNavSeeded = useRef9(false);
|
|
6904
6904
|
const resumeActiveRef = useRef9(false);
|
|
6905
6905
|
const resumeBubbleRef = useRef9(null);
|
|
6906
|
-
|
|
6906
|
+
useEffect16(() => {
|
|
6907
6907
|
if (!conversationReady || homeNavSeeded.current) return;
|
|
6908
6908
|
homeNavSeeded.current = true;
|
|
6909
6909
|
if (resumeActiveRef.current) {
|
|
@@ -7088,18 +7088,18 @@ function App({ options, hostElement, bus }) {
|
|
|
7088
7088
|
const userSig = JSON.stringify(options.userContext ?? null);
|
|
7089
7089
|
const pageSig = JSON.stringify(options.pageContext ?? null);
|
|
7090
7090
|
const formCtxSig = JSON.stringify(formContext);
|
|
7091
|
-
|
|
7091
|
+
useEffect16(() => {
|
|
7092
7092
|
const merged = Object.keys(formContext).length ? { ...formContext, ...options.userContext } : options.userContext;
|
|
7093
7093
|
transport.setContext(merged, toWirePageContext(options.pageContext));
|
|
7094
7094
|
}, [transport, userSig, pageSig, formCtxSig]);
|
|
7095
7095
|
const effectiveLocale = clampLocale(activeLocale, options.availableLocales, options.defaultLocale);
|
|
7096
|
-
|
|
7096
|
+
useEffect16(() => {
|
|
7097
7097
|
transport.setLocale(effectiveLocale);
|
|
7098
7098
|
}, [transport, effectiveLocale]);
|
|
7099
|
-
|
|
7099
|
+
useEffect16(() => {
|
|
7100
7100
|
hostElement.dir = isRtlLocale(effectiveLocale) ? "rtl" : "ltr";
|
|
7101
7101
|
}, [hostElement, effectiveLocale]);
|
|
7102
|
-
|
|
7102
|
+
useEffect16(() => {
|
|
7103
7103
|
if (effectiveLocale !== activeLocale) setActiveLocale(effectiveLocale);
|
|
7104
7104
|
}, [effectiveLocale, activeLocale]);
|
|
7105
7105
|
const runResume = useCallback6(
|
|
@@ -7147,7 +7147,7 @@ function App({ options, hostElement, bus }) {
|
|
|
7147
7147
|
[reducer, messagesSig, feedback, bus, options, homeNav]
|
|
7148
7148
|
);
|
|
7149
7149
|
const resumeHandleRef = useRef9(null);
|
|
7150
|
-
|
|
7150
|
+
useEffect16(() => {
|
|
7151
7151
|
const persistedConversation = conversationIdSig.value;
|
|
7152
7152
|
if (persistedConversation) transport.primeIdentity(visitorId, persistedConversation);
|
|
7153
7153
|
void runHandshake({ newConversation: false });
|
|
@@ -7156,7 +7156,7 @@ function App({ options, hostElement, bus }) {
|
|
|
7156
7156
|
resumeHandleRef.current?.cancel();
|
|
7157
7157
|
};
|
|
7158
7158
|
}, []);
|
|
7159
|
-
|
|
7159
|
+
useEffect16(() => {
|
|
7160
7160
|
if (!activated) return;
|
|
7161
7161
|
dataBootRef.current = transport.bootstrap();
|
|
7162
7162
|
void (async () => {
|
|
@@ -7181,7 +7181,7 @@ function App({ options, hostElement, bus }) {
|
|
|
7181
7181
|
}
|
|
7182
7182
|
}, [activated]);
|
|
7183
7183
|
const formsLocaleRef = useRef9(null);
|
|
7184
|
-
|
|
7184
|
+
useEffect16(() => {
|
|
7185
7185
|
if (!activated) return;
|
|
7186
7186
|
if (formsLocaleRef.current === null) {
|
|
7187
7187
|
formsLocaleRef.current = effectiveLocale;
|
|
@@ -7198,15 +7198,15 @@ function App({ options, hostElement, bus }) {
|
|
|
7198
7198
|
};
|
|
7199
7199
|
}, [activated, effectiveLocale, transport]);
|
|
7200
7200
|
const lastUserSig = useRef9(userSig);
|
|
7201
|
-
|
|
7201
|
+
useEffect16(() => {
|
|
7202
7202
|
if (!conversationReady || lastUserSig.current === userSig) return;
|
|
7203
7203
|
lastUserSig.current = userSig;
|
|
7204
7204
|
void runHandshake({ newConversation: false });
|
|
7205
7205
|
}, [userSig, conversationReady, runHandshake]);
|
|
7206
|
-
|
|
7206
|
+
useEffect16(() => {
|
|
7207
7207
|
applyMode(hostElement, computeHostMode(options.mode, panelSize, isOpen));
|
|
7208
7208
|
}, [hostElement, isOpen, panelSize, options.mode]);
|
|
7209
|
-
|
|
7209
|
+
useEffect16(() => {
|
|
7210
7210
|
if (options.mode !== "modal" || !isOpen) return;
|
|
7211
7211
|
const onClick = (e) => {
|
|
7212
7212
|
const path = e.composedPath();
|
|
@@ -7218,7 +7218,7 @@ function App({ options, hostElement, bus }) {
|
|
|
7218
7218
|
hostElement.addEventListener("click", onClick);
|
|
7219
7219
|
return () => hostElement.removeEventListener("click", onClick);
|
|
7220
7220
|
}, [hostElement, isOpen, options.mode]);
|
|
7221
|
-
|
|
7221
|
+
useEffect16(() => {
|
|
7222
7222
|
if (options.mode !== "drawer" || !isOpen) return;
|
|
7223
7223
|
const onKey = (e) => {
|
|
7224
7224
|
if (e.key === "Escape") setIsOpen(false);
|
|
@@ -7353,25 +7353,25 @@ function App({ options, hostElement, bus }) {
|
|
|
7353
7353
|
}
|
|
7354
7354
|
});
|
|
7355
7355
|
const activeForm = useComputed7(() => forms.activeForm.value);
|
|
7356
|
-
|
|
7356
|
+
useEffect16(() => {
|
|
7357
7357
|
forms.refresh();
|
|
7358
7358
|
}, [effectiveForms, forms]);
|
|
7359
7359
|
const pageArea = options.pageContext?.area ? String(options.pageContext.area) : void 0;
|
|
7360
7360
|
const msgCount = useComputed7(() => messagesSig.value.length);
|
|
7361
|
-
|
|
7361
|
+
useEffect16(() => {
|
|
7362
7362
|
if (conversationReady && formsReady) forms.fire("pre-chat");
|
|
7363
7363
|
}, [conversationReady, formsReady, forms]);
|
|
7364
|
-
|
|
7364
|
+
useEffect16(() => {
|
|
7365
7365
|
if (formsReady && !canSend) forms.fire("conversation-closed");
|
|
7366
7366
|
}, [formsReady, canSend, forms]);
|
|
7367
|
-
|
|
7367
|
+
useEffect16(() => {
|
|
7368
7368
|
if (conversationReady && formsReady && pageArea) forms.fire("page-area");
|
|
7369
7369
|
}, [conversationReady, formsReady, pageArea, forms]);
|
|
7370
7370
|
const idleMs = useMemo3(() => {
|
|
7371
7371
|
const secs = effectiveForms.list.flatMap((f) => f.triggers).filter((t) => t.kind === "idle").map((t) => Number(t.param));
|
|
7372
7372
|
return secs.length ? Math.min(...secs) * 1e3 : 0;
|
|
7373
7373
|
}, [effectiveForms]);
|
|
7374
|
-
|
|
7374
|
+
useEffect16(() => {
|
|
7375
7375
|
if (!idleMs || !isOpen) return;
|
|
7376
7376
|
const id = setTimeout(() => forms.fire("idle"), idleMs);
|
|
7377
7377
|
return () => clearTimeout(id);
|
|
@@ -7431,7 +7431,7 @@ function App({ options, hostElement, bus }) {
|
|
|
7431
7431
|
}).catch((err) => log16.debug("refreshUnread failed (non-fatal)", { err }));
|
|
7432
7432
|
}, [transport, options.modules, unreadCountSig]);
|
|
7433
7433
|
const unreadSeeded = useRef9(false);
|
|
7434
|
-
|
|
7434
|
+
useEffect16(() => {
|
|
7435
7435
|
if (!activated || !conversationReady || unreadSeeded.current) return;
|
|
7436
7436
|
unreadSeeded.current = true;
|
|
7437
7437
|
refreshUnread();
|
|
@@ -7589,12 +7589,12 @@ function App({ options, hostElement, bus }) {
|
|
|
7589
7589
|
},
|
|
7590
7590
|
[formsReady, forms]
|
|
7591
7591
|
);
|
|
7592
|
-
|
|
7592
|
+
useEffect16(() => {
|
|
7593
7593
|
if (!formsReady || !pendingOpenFormRef.current) return;
|
|
7594
7594
|
forms.fire("manual", pendingOpenFormRef.current);
|
|
7595
7595
|
pendingOpenFormRef.current = null;
|
|
7596
7596
|
}, [formsReady, forms]);
|
|
7597
|
-
|
|
7597
|
+
useEffect16(() => {
|
|
7598
7598
|
const unsub = bindHostCommands(hostElement, {
|
|
7599
7599
|
open: handleOpen,
|
|
7600
7600
|
close: handleClose,
|