@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/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, H as HandshakeResponse, L as Link, S as ServerConfig, b as SiteConfig, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial } from './deployment-
|
|
1
|
+
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, H as HandshakeResponse, L as Link, S as ServerConfig, b as SiteConfig, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial } from './deployment-CB6xjMr0.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
package/index.mjs
CHANGED
|
@@ -1400,7 +1400,7 @@ var EventBus = class {
|
|
|
1400
1400
|
import { h, render as renderPreact } from "preact";
|
|
1401
1401
|
|
|
1402
1402
|
// src/ui/app.tsx
|
|
1403
|
-
import { useCallback as useCallback6, useEffect as
|
|
1403
|
+
import { useCallback as useCallback6, useEffect as useEffect16, useMemo as useMemo3, useRef as useRef9, useState as useState13 } from "preact/hooks";
|
|
1404
1404
|
import { batch, useComputed as useComputed7, useSignal as useSignal2 } from "@preact/signals";
|
|
1405
1405
|
|
|
1406
1406
|
// src/core/handshake-shape.ts
|
|
@@ -3302,7 +3302,7 @@ function resolveCalloutPosition(configured, launcherPosition) {
|
|
|
3302
3302
|
}
|
|
3303
3303
|
|
|
3304
3304
|
// src/ui/panel.tsx
|
|
3305
|
-
import { useCallback as useCallback2, useEffect as
|
|
3305
|
+
import { useCallback as useCallback2, useEffect as useEffect9, useRef as useRef6 } from "preact/hooks";
|
|
3306
3306
|
|
|
3307
3307
|
// src/ui/resize-grip.tsx
|
|
3308
3308
|
import { useEffect as useEffect2, useRef } from "preact/hooks";
|
|
@@ -4334,7 +4334,7 @@ function HeaderActions({ panelProps, variant }) {
|
|
|
4334
4334
|
}
|
|
4335
4335
|
|
|
4336
4336
|
// src/ui/message-list.tsx
|
|
4337
|
-
import { useEffect as
|
|
4337
|
+
import { useEffect as useEffect7, useLayoutEffect as useLayoutEffect2, useRef as useRef5, useState as useState6 } from "preact/hooks";
|
|
4338
4338
|
import { useComputed as useComputed5 } from "@preact/signals";
|
|
4339
4339
|
|
|
4340
4340
|
// src/ui/form/dynamic-form.tsx
|
|
@@ -4726,13 +4726,13 @@ function FormDoneMarker({
|
|
|
4726
4726
|
import { useComputed as useComputed4 } from "@preact/signals";
|
|
4727
4727
|
|
|
4728
4728
|
// src/ui/markdown.tsx
|
|
4729
|
-
import {
|
|
4729
|
+
import { useLayoutEffect, useMemo, useRef as useRef4 } from "preact/hooks";
|
|
4730
4730
|
import { effect, signal as signal4 } from "@preact/signals";
|
|
4731
4731
|
import * as smd from "streaming-markdown";
|
|
4732
4732
|
import { jsx as jsx12 } from "preact/jsx-runtime";
|
|
4733
4733
|
function MarkdownView({ textSig, doneSig }) {
|
|
4734
4734
|
const ref = useRef4(null);
|
|
4735
|
-
|
|
4735
|
+
useLayoutEffect(() => {
|
|
4736
4736
|
const el = ref.current;
|
|
4737
4737
|
if (!el) return;
|
|
4738
4738
|
el.classList.add(`${BRAND.cssPrefix}-md`);
|
|
@@ -5224,7 +5224,7 @@ function MessageList({
|
|
|
5224
5224
|
el.scrollTop = el.scrollHeight;
|
|
5225
5225
|
};
|
|
5226
5226
|
const firstMessageId = messages.value[0]?.id;
|
|
5227
|
-
|
|
5227
|
+
useLayoutEffect2(() => {
|
|
5228
5228
|
const el = ref.current;
|
|
5229
5229
|
if (!el) return;
|
|
5230
5230
|
if (messages.value.length === 0) return;
|
|
@@ -5247,7 +5247,7 @@ function MessageList({
|
|
|
5247
5247
|
};
|
|
5248
5248
|
}, [firstMessageId]);
|
|
5249
5249
|
const prevLengthRef = useRef5(0);
|
|
5250
|
-
|
|
5250
|
+
useEffect7(() => {
|
|
5251
5251
|
const el = ref.current;
|
|
5252
5252
|
const list = messages.value;
|
|
5253
5253
|
const prevLength = prevLengthRef.current;
|
|
@@ -5259,11 +5259,12 @@ function MessageList({
|
|
|
5259
5259
|
pinBottom(el);
|
|
5260
5260
|
return;
|
|
5261
5261
|
}
|
|
5262
|
+
if (!list.some((m) => m.role === "user")) return;
|
|
5262
5263
|
if (detachedRef.current || inInteractionGrace()) return;
|
|
5263
5264
|
const distanceFromBottom = el.scrollHeight - el.scrollTop - el.clientHeight;
|
|
5264
5265
|
if (distanceFromBottom < STICK_THRESHOLD) pinBottom(el);
|
|
5265
5266
|
}, [messages.value.length]);
|
|
5266
|
-
|
|
5267
|
+
useEffect7(() => {
|
|
5267
5268
|
const el = ref.current;
|
|
5268
5269
|
if (!el) return;
|
|
5269
5270
|
const last = messages.value.at(-1);
|
|
@@ -5284,13 +5285,13 @@ function MessageList({
|
|
|
5284
5285
|
return () => obs.disconnect();
|
|
5285
5286
|
}, [messages.value]);
|
|
5286
5287
|
const activeFormId = form?.form.id;
|
|
5287
|
-
|
|
5288
|
+
useLayoutEffect2(() => {
|
|
5288
5289
|
const el = ref.current;
|
|
5289
5290
|
if (!el || !activeFormId || detachedRef.current) return;
|
|
5290
5291
|
if (!messages.value.some((m) => m.role === "user")) return;
|
|
5291
5292
|
pinBottom(el);
|
|
5292
5293
|
}, [activeFormId]);
|
|
5293
|
-
|
|
5294
|
+
useEffect7(() => {
|
|
5294
5295
|
const el = ref.current;
|
|
5295
5296
|
if (!el) return;
|
|
5296
5297
|
const syncJump = () => setShowJump(el.scrollHeight - el.scrollTop - el.clientHeight > STICK_THRESHOLD * 2);
|
|
@@ -5460,7 +5461,7 @@ function dayLabel(createdAt, strings) {
|
|
|
5460
5461
|
}
|
|
5461
5462
|
|
|
5462
5463
|
// src/ui/conversation-list.tsx
|
|
5463
|
-
import { useEffect as
|
|
5464
|
+
import { useEffect as useEffect8, useState as useState7 } from "preact/hooks";
|
|
5464
5465
|
|
|
5465
5466
|
// src/ui/history-groups.ts
|
|
5466
5467
|
var HISTORY_BUCKETS = ["today", "yesterday", "lastWeek", "older"];
|
|
@@ -5518,7 +5519,7 @@ function ConversationList({
|
|
|
5518
5519
|
const seed = transport.peekConversations({ visitorId });
|
|
5519
5520
|
const [state, setState] = useState7(seed ? "loaded" : "loading");
|
|
5520
5521
|
const [conversations, setChats] = useState7(seed?.conversations ?? []);
|
|
5521
|
-
|
|
5522
|
+
useEffect8(() => {
|
|
5522
5523
|
let cancelled = false;
|
|
5523
5524
|
transport.listConversations({ visitorId }).then((res) => {
|
|
5524
5525
|
if (cancelled) return;
|
|
@@ -5628,7 +5629,7 @@ function Panel(props2) {
|
|
|
5628
5629
|
const { options, onClose } = props2;
|
|
5629
5630
|
const s = options.strings;
|
|
5630
5631
|
const containerRef = useRef6(null);
|
|
5631
|
-
|
|
5632
|
+
useEffect9(() => {
|
|
5632
5633
|
const el = containerRef.current;
|
|
5633
5634
|
if (!el) return;
|
|
5634
5635
|
const dispose = trapFocus(el);
|
|
@@ -6100,7 +6101,7 @@ var topScreen = (s) => activeStack(s).at(-1);
|
|
|
6100
6101
|
var atTabRoot = (s) => activeStack(s).length === 0;
|
|
6101
6102
|
|
|
6102
6103
|
// src/ui/messenger-home.tsx
|
|
6103
|
-
import { useCallback as useCallback4, useEffect as
|
|
6104
|
+
import { useCallback as useCallback4, useEffect as useEffect14, useRef as useRef8 } from "preact/hooks";
|
|
6104
6105
|
import { useComputed as useComputed6 } from "@preact/signals";
|
|
6105
6106
|
|
|
6106
6107
|
// src/ui/modules/chat.tsx
|
|
@@ -6110,7 +6111,7 @@ var chatLayout = {
|
|
|
6110
6111
|
};
|
|
6111
6112
|
|
|
6112
6113
|
// src/ui/modules/help.tsx
|
|
6113
|
-
import { useEffect as
|
|
6114
|
+
import { useEffect as useEffect10, useMemo as useMemo2, useState as useState8 } from "preact/hooks";
|
|
6114
6115
|
|
|
6115
6116
|
// src/ui/back-header.tsx
|
|
6116
6117
|
import { jsx as jsx23, jsxs as jsxs19 } from "preact/jsx-runtime";
|
|
@@ -6232,7 +6233,7 @@ function HelpRoot({ transport, strings, config, nav, bus, panelProps }) {
|
|
|
6232
6233
|
const [items, setItems] = useState8([]);
|
|
6233
6234
|
const [query, setQuery] = useState8("");
|
|
6234
6235
|
const [reloadKey, setReloadKey] = useState8(0);
|
|
6235
|
-
|
|
6236
|
+
useEffect10(() => {
|
|
6236
6237
|
let cancelled = false;
|
|
6237
6238
|
setState("loading");
|
|
6238
6239
|
transport.listContent({ tags, sortBy: "order", limit: 100 }).then((res) => {
|
|
@@ -6252,7 +6253,7 @@ function HelpRoot({ transport, strings, config, nav, bus, panelProps }) {
|
|
|
6252
6253
|
};
|
|
6253
6254
|
}, [transport, tags, reloadKey, bus]);
|
|
6254
6255
|
const results = useMemo2(() => fuzzySearch(items, query), [items, query]);
|
|
6255
|
-
|
|
6256
|
+
useEffect10(() => {
|
|
6256
6257
|
const q = query.trim();
|
|
6257
6258
|
if (!q) return;
|
|
6258
6259
|
const timer = setTimeout(() => bus.emit("contentSearch", { queryLength: q.length, hitCount: results.length }), 600);
|
|
@@ -6285,7 +6286,7 @@ var helpLayout = {
|
|
|
6285
6286
|
};
|
|
6286
6287
|
|
|
6287
6288
|
// src/ui/modules/home.tsx
|
|
6288
|
-
import { useEffect as
|
|
6289
|
+
import { useEffect as useEffect11, useState as useState9 } from "preact/hooks";
|
|
6289
6290
|
|
|
6290
6291
|
// src/ui/home-card.tsx
|
|
6291
6292
|
import { jsx as jsx28 } from "preact/jsx-runtime";
|
|
@@ -6316,7 +6317,7 @@ function HomeRoot(props2) {
|
|
|
6316
6317
|
const [recent, setRecent] = useState9(null);
|
|
6317
6318
|
const [content, setContent] = useState9([]);
|
|
6318
6319
|
const tagsKey = config.contentTags?.join(",");
|
|
6319
|
-
|
|
6320
|
+
useEffect11(() => {
|
|
6320
6321
|
if (!config.showRecentConversations) return;
|
|
6321
6322
|
let cancelled = false;
|
|
6322
6323
|
transport.listConversations({ limit: 1 }).then((res) => !cancelled && setRecent(res.conversations?.[0] ?? null)).catch((err) => !cancelled && log14.warn("listConversations (home) failed", { err }));
|
|
@@ -6324,7 +6325,7 @@ function HomeRoot(props2) {
|
|
|
6324
6325
|
cancelled = true;
|
|
6325
6326
|
};
|
|
6326
6327
|
}, [transport, config.showRecentConversations]);
|
|
6327
|
-
|
|
6328
|
+
useEffect11(() => {
|
|
6328
6329
|
if (!config.contentTags?.length) return;
|
|
6329
6330
|
let cancelled = false;
|
|
6330
6331
|
transport.listContent({ tags: config.contentTags, limit: 6 }).then((res) => {
|
|
@@ -6404,7 +6405,7 @@ var homeLayout = {
|
|
|
6404
6405
|
};
|
|
6405
6406
|
|
|
6406
6407
|
// src/ui/modules/news.tsx
|
|
6407
|
-
import { useEffect as
|
|
6408
|
+
import { useEffect as useEffect12, useState as useState10 } from "preact/hooks";
|
|
6408
6409
|
import { jsx as jsx30, jsxs as jsxs25 } from "preact/jsx-runtime";
|
|
6409
6410
|
var p26 = BRAND.cssPrefix;
|
|
6410
6411
|
var log15 = logger.scope("news");
|
|
@@ -6414,7 +6415,7 @@ function NewsRoot({ transport, strings, config, nav, bus, panelProps }) {
|
|
|
6414
6415
|
const [errorMsg, setErrorMsg] = useState10(strings.errorGeneric);
|
|
6415
6416
|
const [items, setItems] = useState10([]);
|
|
6416
6417
|
const [reloadKey, setReloadKey] = useState10(0);
|
|
6417
|
-
|
|
6418
|
+
useEffect12(() => {
|
|
6418
6419
|
let cancelled = false;
|
|
6419
6420
|
setState("loading");
|
|
6420
6421
|
transport.listContent({ tags, sortBy: "publishedAt", sortOrder: "desc" }).then((res) => {
|
|
@@ -6536,7 +6537,7 @@ function IframeView({ url, title, strings, onBack, actions }) {
|
|
|
6536
6537
|
}
|
|
6537
6538
|
|
|
6538
6539
|
// src/ui/content-view.tsx
|
|
6539
|
-
import { useCallback as useCallback3, useEffect as
|
|
6540
|
+
import { useCallback as useCallback3, useEffect as useEffect13, useState as useState11 } from "preact/hooks";
|
|
6540
6541
|
import { jsx as jsx33, jsxs as jsxs28 } from "preact/jsx-runtime";
|
|
6541
6542
|
var p29 = BRAND.cssPrefix;
|
|
6542
6543
|
var log16 = logger.scope("content");
|
|
@@ -6550,7 +6551,7 @@ function ContentView({ id, title, transport, strings, bus, onBack, actions }) {
|
|
|
6550
6551
|
setItem(null);
|
|
6551
6552
|
setReloadKey((k) => k + 1);
|
|
6552
6553
|
}, []);
|
|
6553
|
-
|
|
6554
|
+
useEffect13(() => {
|
|
6554
6555
|
let cancelled = false;
|
|
6555
6556
|
transport.listContent({ ids: [id], limit: 1 }).then((res) => {
|
|
6556
6557
|
if (cancelled) return;
|
|
@@ -6568,7 +6569,7 @@ function ContentView({ id, title, transport, strings, bus, onBack, actions }) {
|
|
|
6568
6569
|
cancelled = true;
|
|
6569
6570
|
};
|
|
6570
6571
|
}, [transport, id, reloadKey, bus]);
|
|
6571
|
-
|
|
6572
|
+
useEffect13(() => {
|
|
6572
6573
|
if (!item) return;
|
|
6573
6574
|
const timer = setTimeout(() => bus.emit("contentRead", { contentId: id }), READ_DWELL_MS);
|
|
6574
6575
|
return () => clearTimeout(timer);
|
|
@@ -6621,7 +6622,7 @@ function MessengerHome({
|
|
|
6621
6622
|
const options = panelProps.options;
|
|
6622
6623
|
const strings = options.strings;
|
|
6623
6624
|
const containerRef = useRef8(null);
|
|
6624
|
-
|
|
6625
|
+
useEffect14(() => {
|
|
6625
6626
|
const el = containerRef.current;
|
|
6626
6627
|
if (!el) return;
|
|
6627
6628
|
const dispose = trapFocus(el);
|
|
@@ -6646,7 +6647,7 @@ function MessengerHome({
|
|
|
6646
6647
|
const isReader = top?.kind === "iframe" || top?.kind === "content";
|
|
6647
6648
|
const showTabBar = enabledModules.length > 1 && (atTabRoot(navState) || !isReader);
|
|
6648
6649
|
const savedSize = useRef8(null);
|
|
6649
|
-
|
|
6650
|
+
useEffect14(() => {
|
|
6650
6651
|
if (isReader && savedSize.current === null) {
|
|
6651
6652
|
savedSize.current = panelProps.panelSize;
|
|
6652
6653
|
if (panelProps.panelSize === "normal") onSetPanelSize("expanded");
|
|
@@ -6779,12 +6780,12 @@ function ModulesEmpty({ strings, onClose }) {
|
|
|
6779
6780
|
}
|
|
6780
6781
|
|
|
6781
6782
|
// src/ui/use-launcher-callout.ts
|
|
6782
|
-
import { useCallback as useCallback5, useEffect as
|
|
6783
|
+
import { useCallback as useCallback5, useEffect as useEffect15, useState as useState12 } from "preact/hooks";
|
|
6783
6784
|
function useLauncherCallout({ callout, persistence }) {
|
|
6784
6785
|
const textKey = callout?.text ?? "";
|
|
6785
6786
|
const persistent = callout?.persistent ?? true;
|
|
6786
6787
|
const [dismissed, setDismissed] = useState12(() => persistent ? false : persistence.loadCalloutDismissed(textKey));
|
|
6787
|
-
|
|
6788
|
+
useEffect15(() => {
|
|
6788
6789
|
setDismissed(persistent ? false : persistence.loadCalloutDismissed(textKey));
|
|
6789
6790
|
}, [textKey, persistent, persistence]);
|
|
6790
6791
|
const dismissCallout = useCallback5(() => {
|
|
@@ -6848,7 +6849,7 @@ function App({ options, hostElement, bus }) {
|
|
|
6848
6849
|
activatedRef.current = activated;
|
|
6849
6850
|
const pendingThreadRef = useRef9(false);
|
|
6850
6851
|
const welcomeRef = useRef9(void 0);
|
|
6851
|
-
|
|
6852
|
+
useEffect16(() => {
|
|
6852
6853
|
if (isOpen) setActivated(true);
|
|
6853
6854
|
}, [isOpen]);
|
|
6854
6855
|
const initialPanelApplied = useRef9(false);
|
|
@@ -6899,20 +6900,20 @@ function App({ options, hostElement, bus }) {
|
|
|
6899
6900
|
},
|
|
6900
6901
|
[persistence, transport]
|
|
6901
6902
|
);
|
|
6902
|
-
|
|
6903
|
+
useEffect16(() => {
|
|
6903
6904
|
if (initialSettings.soundMuted !== void 0) feedback.setMuted(initialSettings.soundMuted);
|
|
6904
6905
|
}, []);
|
|
6905
|
-
|
|
6906
|
+
useEffect16(() => {
|
|
6906
6907
|
hostElement.dataset.theme = activeThemeMode;
|
|
6907
6908
|
}, [hostElement, activeThemeMode, options]);
|
|
6908
|
-
|
|
6909
|
+
useEffect16(() => {
|
|
6909
6910
|
hostElement.dataset.textSize = activeTextSize;
|
|
6910
6911
|
}, [hostElement, activeTextSize, options]);
|
|
6911
|
-
|
|
6912
|
+
useEffect16(() => {
|
|
6912
6913
|
feedback.update(options.sound, options.haptics);
|
|
6913
6914
|
}, [feedback, options.sound, options.haptics]);
|
|
6914
|
-
|
|
6915
|
-
|
|
6915
|
+
useEffect16(() => () => feedback.destroy(), [feedback]);
|
|
6916
|
+
useEffect16(() => {
|
|
6916
6917
|
let firstRun = true;
|
|
6917
6918
|
return feedback.mutedSig.subscribe((muted) => {
|
|
6918
6919
|
if (firstRun) {
|
|
@@ -6922,13 +6923,13 @@ function App({ options, hostElement, bus }) {
|
|
|
6922
6923
|
patchAndSync({ soundMuted: muted });
|
|
6923
6924
|
});
|
|
6924
6925
|
}, [feedback, patchAndSync]);
|
|
6925
|
-
|
|
6926
|
+
useEffect16(() => {
|
|
6926
6927
|
if (initialSizeApplied.current || !options.size.initialSize) return;
|
|
6927
6928
|
initialSizeApplied.current = true;
|
|
6928
6929
|
if (persistence.loadPanelSize()) return;
|
|
6929
6930
|
setPanelSize(pickInitialPanelSize(options.mode, options.size, currentViewportWidth()));
|
|
6930
6931
|
}, [options.mode, options.size, persistence]);
|
|
6931
|
-
|
|
6932
|
+
useEffect16(() => {
|
|
6932
6933
|
if (!conversationReady || initialPanelApplied.current) return;
|
|
6933
6934
|
initialPanelApplied.current = true;
|
|
6934
6935
|
const state = resolveInitialPanelState(
|
|
@@ -6943,7 +6944,7 @@ function App({ options, hostElement, bus }) {
|
|
|
6943
6944
|
const homeNavSeeded = useRef9(false);
|
|
6944
6945
|
const resumeActiveRef = useRef9(false);
|
|
6945
6946
|
const resumeBubbleRef = useRef9(null);
|
|
6946
|
-
|
|
6947
|
+
useEffect16(() => {
|
|
6947
6948
|
if (!conversationReady || homeNavSeeded.current) return;
|
|
6948
6949
|
homeNavSeeded.current = true;
|
|
6949
6950
|
if (resumeActiveRef.current) {
|
|
@@ -7128,18 +7129,18 @@ function App({ options, hostElement, bus }) {
|
|
|
7128
7129
|
const userSig = JSON.stringify(options.userContext ?? null);
|
|
7129
7130
|
const pageSig = JSON.stringify(options.pageContext ?? null);
|
|
7130
7131
|
const formCtxSig = JSON.stringify(formContext);
|
|
7131
|
-
|
|
7132
|
+
useEffect16(() => {
|
|
7132
7133
|
const merged = Object.keys(formContext).length ? { ...formContext, ...options.userContext } : options.userContext;
|
|
7133
7134
|
transport.setContext(merged, toWirePageContext(options.pageContext));
|
|
7134
7135
|
}, [transport, userSig, pageSig, formCtxSig]);
|
|
7135
7136
|
const effectiveLocale = clampLocale(activeLocale, options.availableLocales, options.defaultLocale);
|
|
7136
|
-
|
|
7137
|
+
useEffect16(() => {
|
|
7137
7138
|
transport.setLocale(effectiveLocale);
|
|
7138
7139
|
}, [transport, effectiveLocale]);
|
|
7139
|
-
|
|
7140
|
+
useEffect16(() => {
|
|
7140
7141
|
hostElement.dir = isRtlLocale(effectiveLocale) ? "rtl" : "ltr";
|
|
7141
7142
|
}, [hostElement, effectiveLocale]);
|
|
7142
|
-
|
|
7143
|
+
useEffect16(() => {
|
|
7143
7144
|
if (effectiveLocale !== activeLocale) setActiveLocale(effectiveLocale);
|
|
7144
7145
|
}, [effectiveLocale, activeLocale]);
|
|
7145
7146
|
const runResume = useCallback6(
|
|
@@ -7187,7 +7188,7 @@ function App({ options, hostElement, bus }) {
|
|
|
7187
7188
|
[reducer, messagesSig, feedback, bus, options, homeNav]
|
|
7188
7189
|
);
|
|
7189
7190
|
const resumeHandleRef = useRef9(null);
|
|
7190
|
-
|
|
7191
|
+
useEffect16(() => {
|
|
7191
7192
|
const persistedConversation = conversationIdSig.value;
|
|
7192
7193
|
if (persistedConversation) transport.primeIdentity(visitorId, persistedConversation);
|
|
7193
7194
|
void runHandshake({ newConversation: false });
|
|
@@ -7196,7 +7197,7 @@ function App({ options, hostElement, bus }) {
|
|
|
7196
7197
|
resumeHandleRef.current?.cancel();
|
|
7197
7198
|
};
|
|
7198
7199
|
}, []);
|
|
7199
|
-
|
|
7200
|
+
useEffect16(() => {
|
|
7200
7201
|
if (!activated) return;
|
|
7201
7202
|
dataBootRef.current = transport.bootstrap();
|
|
7202
7203
|
void (async () => {
|
|
@@ -7221,7 +7222,7 @@ function App({ options, hostElement, bus }) {
|
|
|
7221
7222
|
}
|
|
7222
7223
|
}, [activated]);
|
|
7223
7224
|
const formsLocaleRef = useRef9(null);
|
|
7224
|
-
|
|
7225
|
+
useEffect16(() => {
|
|
7225
7226
|
if (!activated) return;
|
|
7226
7227
|
if (formsLocaleRef.current === null) {
|
|
7227
7228
|
formsLocaleRef.current = effectiveLocale;
|
|
@@ -7238,15 +7239,15 @@ function App({ options, hostElement, bus }) {
|
|
|
7238
7239
|
};
|
|
7239
7240
|
}, [activated, effectiveLocale, transport]);
|
|
7240
7241
|
const lastUserSig = useRef9(userSig);
|
|
7241
|
-
|
|
7242
|
+
useEffect16(() => {
|
|
7242
7243
|
if (!conversationReady || lastUserSig.current === userSig) return;
|
|
7243
7244
|
lastUserSig.current = userSig;
|
|
7244
7245
|
void runHandshake({ newConversation: false });
|
|
7245
7246
|
}, [userSig, conversationReady, runHandshake]);
|
|
7246
|
-
|
|
7247
|
+
useEffect16(() => {
|
|
7247
7248
|
applyMode(hostElement, computeHostMode(options.mode, panelSize, isOpen));
|
|
7248
7249
|
}, [hostElement, isOpen, panelSize, options.mode]);
|
|
7249
|
-
|
|
7250
|
+
useEffect16(() => {
|
|
7250
7251
|
if (options.mode !== "modal" || !isOpen) return;
|
|
7251
7252
|
const onClick = (e) => {
|
|
7252
7253
|
const path = e.composedPath();
|
|
@@ -7258,7 +7259,7 @@ function App({ options, hostElement, bus }) {
|
|
|
7258
7259
|
hostElement.addEventListener("click", onClick);
|
|
7259
7260
|
return () => hostElement.removeEventListener("click", onClick);
|
|
7260
7261
|
}, [hostElement, isOpen, options.mode]);
|
|
7261
|
-
|
|
7262
|
+
useEffect16(() => {
|
|
7262
7263
|
if (options.mode !== "drawer" || !isOpen) return;
|
|
7263
7264
|
const onKey = (e) => {
|
|
7264
7265
|
if (e.key === "Escape") setIsOpen(false);
|
|
@@ -7393,25 +7394,25 @@ function App({ options, hostElement, bus }) {
|
|
|
7393
7394
|
}
|
|
7394
7395
|
});
|
|
7395
7396
|
const activeForm = useComputed7(() => forms.activeForm.value);
|
|
7396
|
-
|
|
7397
|
+
useEffect16(() => {
|
|
7397
7398
|
forms.refresh();
|
|
7398
7399
|
}, [effectiveForms, forms]);
|
|
7399
7400
|
const pageArea = options.pageContext?.area ? String(options.pageContext.area) : void 0;
|
|
7400
7401
|
const msgCount = useComputed7(() => messagesSig.value.length);
|
|
7401
|
-
|
|
7402
|
+
useEffect16(() => {
|
|
7402
7403
|
if (conversationReady && formsReady) forms.fire("pre-chat");
|
|
7403
7404
|
}, [conversationReady, formsReady, forms]);
|
|
7404
|
-
|
|
7405
|
+
useEffect16(() => {
|
|
7405
7406
|
if (formsReady && !canSend) forms.fire("conversation-closed");
|
|
7406
7407
|
}, [formsReady, canSend, forms]);
|
|
7407
|
-
|
|
7408
|
+
useEffect16(() => {
|
|
7408
7409
|
if (conversationReady && formsReady && pageArea) forms.fire("page-area");
|
|
7409
7410
|
}, [conversationReady, formsReady, pageArea, forms]);
|
|
7410
7411
|
const idleMs = useMemo3(() => {
|
|
7411
7412
|
const secs = effectiveForms.list.flatMap((f) => f.triggers).filter((t) => t.kind === "idle").map((t) => Number(t.param));
|
|
7412
7413
|
return secs.length ? Math.min(...secs) * 1e3 : 0;
|
|
7413
7414
|
}, [effectiveForms]);
|
|
7414
|
-
|
|
7415
|
+
useEffect16(() => {
|
|
7415
7416
|
if (!idleMs || !isOpen) return;
|
|
7416
7417
|
const id = setTimeout(() => forms.fire("idle"), idleMs);
|
|
7417
7418
|
return () => clearTimeout(id);
|
|
@@ -7471,7 +7472,7 @@ function App({ options, hostElement, bus }) {
|
|
|
7471
7472
|
}).catch((err) => log17.debug("refreshUnread failed (non-fatal)", { err }));
|
|
7472
7473
|
}, [transport, options.modules, unreadCountSig]);
|
|
7473
7474
|
const unreadSeeded = useRef9(false);
|
|
7474
|
-
|
|
7475
|
+
useEffect16(() => {
|
|
7475
7476
|
if (!activated || !conversationReady || unreadSeeded.current) return;
|
|
7476
7477
|
unreadSeeded.current = true;
|
|
7477
7478
|
refreshUnread();
|
|
@@ -7629,12 +7630,12 @@ function App({ options, hostElement, bus }) {
|
|
|
7629
7630
|
},
|
|
7630
7631
|
[formsReady, forms]
|
|
7631
7632
|
);
|
|
7632
|
-
|
|
7633
|
+
useEffect16(() => {
|
|
7633
7634
|
if (!formsReady || !pendingOpenFormRef.current) return;
|
|
7634
7635
|
forms.fire("manual", pendingOpenFormRef.current);
|
|
7635
7636
|
pendingOpenFormRef.current = null;
|
|
7636
7637
|
}, [formsReady, forms]);
|
|
7637
|
-
|
|
7638
|
+
useEffect16(() => {
|
|
7638
7639
|
const unsub = bindHostCommands(hostElement, {
|
|
7639
7640
|
open: handleOpen,
|
|
7640
7641
|
close: handleClose,
|
package/package.json
CHANGED
package/schema.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, E as Endpoints, H as HandshakeResponse, L as Link, P as PAGE_AREA_SUGGESTIONS, f as PageContext, S as ServerConfig, b as SiteConfig, U as UserContext, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial, g as assetSchema, h as blocksConfigSchema, i as connectionConfigPartialSchema, j as connectionConfigSchema, k as cssColorSchema, l as cssLengthSchema, m as endpointsSchema, n as handshakeResponseSchema, o as linkSchema, p as localeSchema, q as pageContextSchema, s as serverConfigSchema, r as siteConfigSchema, u as userContextSchema, t as uuid7Schema, w as widgetConfigPartialSchema, v as widgetConfigSchema, x as widgetSettingsPartialSchema, y as widgetSettingsSchema } from './deployment-
|
|
1
|
+
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, E as Endpoints, H as HandshakeResponse, L as Link, P as PAGE_AREA_SUGGESTIONS, f as PageContext, S as ServerConfig, b as SiteConfig, U as UserContext, W as WidgetConfig, c as WidgetConfigPartial, d as WidgetSettings, e as WidgetSettingsPartial, g as assetSchema, h as blocksConfigSchema, i as connectionConfigPartialSchema, j as connectionConfigSchema, k as cssColorSchema, l as cssLengthSchema, m as endpointsSchema, n as handshakeResponseSchema, o as linkSchema, p as localeSchema, q as pageContextSchema, s as serverConfigSchema, r as siteConfigSchema, u as userContextSchema, t as uuid7Schema, w as widgetConfigPartialSchema, v as widgetConfigSchema, x as widgetSettingsPartialSchema, y as widgetSettingsSchema } from './deployment-CB6xjMr0.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -56,9 +56,9 @@ declare const presentationSchema: z.ZodObject<{
|
|
|
56
56
|
inset: z.ZodOptional<z.ZodString>;
|
|
57
57
|
initialSize: z.ZodDefault<z.ZodEnum<{
|
|
58
58
|
fullscreen: "fullscreen";
|
|
59
|
+
normal: "normal";
|
|
59
60
|
expanded: "expanded";
|
|
60
61
|
auto: "auto";
|
|
61
|
-
normal: "normal";
|
|
62
62
|
}>>;
|
|
63
63
|
autoSizeBreakpoint: z.ZodDefault<z.ZodNumber>;
|
|
64
64
|
}, z.core.$loose>>;
|
|
@@ -239,9 +239,9 @@ type LauncherOptions = z.infer<typeof launcherOptionsSchema>;
|
|
|
239
239
|
|
|
240
240
|
declare const initialSizeSchema: z.ZodEnum<{
|
|
241
241
|
fullscreen: "fullscreen";
|
|
242
|
+
normal: "normal";
|
|
242
243
|
expanded: "expanded";
|
|
243
244
|
auto: "auto";
|
|
244
|
-
normal: "normal";
|
|
245
245
|
}>;
|
|
246
246
|
declare const resizeOptionsSchema: z.ZodObject<{
|
|
247
247
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -268,9 +268,9 @@ declare const sizeOptionsSchema: z.ZodObject<{
|
|
|
268
268
|
inset: z.ZodOptional<z.ZodString>;
|
|
269
269
|
initialSize: z.ZodDefault<z.ZodEnum<{
|
|
270
270
|
fullscreen: "fullscreen";
|
|
271
|
+
normal: "normal";
|
|
271
272
|
expanded: "expanded";
|
|
272
273
|
auto: "auto";
|
|
273
|
-
normal: "normal";
|
|
274
274
|
}>>;
|
|
275
275
|
autoSizeBreakpoint: z.ZodDefault<z.ZodNumber>;
|
|
276
276
|
}, z.core.$loose>;
|
|
@@ -322,40 +322,40 @@ type FeatureFlags = z.infer<typeof featureFlagsSchema>;
|
|
|
322
322
|
*/
|
|
323
323
|
|
|
324
324
|
declare const actionNameSchema: z.ZodEnum<{
|
|
325
|
-
close: "close";
|
|
326
325
|
expand: "expand";
|
|
327
326
|
fullscreen: "fullscreen";
|
|
328
|
-
|
|
329
|
-
theme: "theme";
|
|
327
|
+
close: "close";
|
|
330
328
|
language: "language";
|
|
329
|
+
theme: "theme";
|
|
331
330
|
textSize: "textSize";
|
|
332
331
|
history: "history";
|
|
332
|
+
clear: "clear";
|
|
333
333
|
sound: "sound";
|
|
334
334
|
}>;
|
|
335
335
|
type ActionName = z.infer<typeof actionNameSchema>;
|
|
336
336
|
declare const headerActionsSchema: z.ZodArray<z.ZodEnum<{
|
|
337
|
-
close: "close";
|
|
338
337
|
expand: "expand";
|
|
339
338
|
fullscreen: "fullscreen";
|
|
340
|
-
|
|
341
|
-
theme: "theme";
|
|
339
|
+
close: "close";
|
|
342
340
|
language: "language";
|
|
341
|
+
theme: "theme";
|
|
343
342
|
textSize: "textSize";
|
|
344
343
|
history: "history";
|
|
344
|
+
clear: "clear";
|
|
345
345
|
sound: "sound";
|
|
346
346
|
}>>;
|
|
347
347
|
type HeaderActions = z.infer<typeof headerActionsSchema>;
|
|
348
348
|
/** Section wrapper — `actions` list wrapped under `header` in the dashboard form. */
|
|
349
349
|
declare const headerSchema: z.ZodObject<{
|
|
350
350
|
actions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
351
|
-
close: "close";
|
|
352
351
|
expand: "expand";
|
|
353
352
|
fullscreen: "fullscreen";
|
|
354
|
-
|
|
355
|
-
theme: "theme";
|
|
353
|
+
close: "close";
|
|
356
354
|
language: "language";
|
|
355
|
+
theme: "theme";
|
|
357
356
|
textSize: "textSize";
|
|
358
357
|
history: "history";
|
|
358
|
+
clear: "clear";
|
|
359
359
|
sound: "sound";
|
|
360
360
|
}>>>;
|
|
361
361
|
}, z.core.$loose>;
|
|
@@ -371,33 +371,33 @@ type HeaderOptions = z.infer<typeof headerSchema>;
|
|
|
371
371
|
*/
|
|
372
372
|
|
|
373
373
|
declare const feedbackEventSchema: z.ZodEnum<{
|
|
374
|
-
voiceStart: "voiceStart";
|
|
375
|
-
voiceStop: "voiceStop";
|
|
376
374
|
error: "error";
|
|
377
375
|
messageReceived: "messageReceived";
|
|
378
376
|
messageSent: "messageSent";
|
|
377
|
+
voiceStart: "voiceStart";
|
|
378
|
+
voiceStop: "voiceStop";
|
|
379
379
|
}>;
|
|
380
380
|
type FeedbackEvent = z.infer<typeof feedbackEventSchema>;
|
|
381
381
|
declare const soundOptionsSchema: z.ZodObject<{
|
|
382
382
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
383
383
|
volume: z.ZodDefault<z.ZodNumber>;
|
|
384
384
|
events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
385
|
-
voiceStart: "voiceStart";
|
|
386
|
-
voiceStop: "voiceStop";
|
|
387
385
|
error: "error";
|
|
388
386
|
messageReceived: "messageReceived";
|
|
389
387
|
messageSent: "messageSent";
|
|
388
|
+
voiceStart: "voiceStart";
|
|
389
|
+
voiceStop: "voiceStop";
|
|
390
390
|
}> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
|
|
391
391
|
}, z.core.$loose>;
|
|
392
392
|
type SoundOptions = z.infer<typeof soundOptionsSchema>;
|
|
393
393
|
declare const hapticsOptionsSchema: z.ZodObject<{
|
|
394
394
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
395
395
|
events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
396
|
-
voiceStart: "voiceStart";
|
|
397
|
-
voiceStop: "voiceStop";
|
|
398
396
|
error: "error";
|
|
399
397
|
messageReceived: "messageReceived";
|
|
400
398
|
messageSent: "messageSent";
|
|
399
|
+
voiceStart: "voiceStart";
|
|
400
|
+
voiceStop: "voiceStop";
|
|
401
401
|
}> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
402
402
|
}, z.core.$loose>;
|
|
403
403
|
type HapticsOptions = z.infer<typeof hapticsOptionsSchema>;
|
|
@@ -406,21 +406,21 @@ declare const feedbackSchema: z.ZodObject<{
|
|
|
406
406
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
407
407
|
volume: z.ZodDefault<z.ZodNumber>;
|
|
408
408
|
events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
409
|
-
voiceStart: "voiceStart";
|
|
410
|
-
voiceStop: "voiceStop";
|
|
411
409
|
error: "error";
|
|
412
410
|
messageReceived: "messageReceived";
|
|
413
411
|
messageSent: "messageSent";
|
|
412
|
+
voiceStart: "voiceStart";
|
|
413
|
+
voiceStop: "voiceStop";
|
|
414
414
|
}> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
|
|
415
415
|
}, z.core.$loose>>;
|
|
416
416
|
haptics: z.ZodOptional<z.ZodObject<{
|
|
417
417
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
418
418
|
events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
419
|
-
voiceStart: "voiceStart";
|
|
420
|
-
voiceStop: "voiceStop";
|
|
421
419
|
error: "error";
|
|
422
420
|
messageReceived: "messageReceived";
|
|
423
421
|
messageSent: "messageSent";
|
|
422
|
+
voiceStart: "voiceStart";
|
|
423
|
+
voiceStop: "voiceStop";
|
|
424
424
|
}> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
425
425
|
}, z.core.$loose>>;
|
|
426
426
|
}, z.core.$loose>;
|
|
@@ -855,18 +855,18 @@ type I18nOptions = z.infer<typeof i18nSchema>;
|
|
|
855
855
|
*/
|
|
856
856
|
|
|
857
857
|
declare const moduleLayoutSchema: z.ZodEnum<{
|
|
858
|
-
home: "home";
|
|
859
858
|
chat: "chat";
|
|
860
859
|
help: "help";
|
|
860
|
+
home: "home";
|
|
861
861
|
news: "news";
|
|
862
862
|
}>;
|
|
863
863
|
type ModuleLayout = z.infer<typeof moduleLayoutSchema>;
|
|
864
864
|
declare const moduleSchema: z.ZodObject<{
|
|
865
865
|
label: z.ZodString;
|
|
866
866
|
layout: z.ZodEnum<{
|
|
867
|
-
home: "home";
|
|
868
867
|
chat: "chat";
|
|
869
868
|
help: "help";
|
|
869
|
+
home: "home";
|
|
870
870
|
news: "news";
|
|
871
871
|
}>;
|
|
872
872
|
contentTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -892,9 +892,9 @@ type ModuleOptions = z.infer<typeof moduleSchema>;
|
|
|
892
892
|
declare const modulesSchema: z.ZodArray<z.ZodObject<{
|
|
893
893
|
label: z.ZodString;
|
|
894
894
|
layout: z.ZodEnum<{
|
|
895
|
-
home: "home";
|
|
896
895
|
chat: "chat";
|
|
897
896
|
help: "help";
|
|
897
|
+
home: "home";
|
|
898
898
|
news: "news";
|
|
899
899
|
}>;
|
|
900
900
|
contentTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|