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