@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/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;
|
|
@@ -5264,7 +5264,7 @@ function MessageList({
|
|
|
5264
5264
|
const distanceFromBottom = el.scrollHeight - el.scrollTop - el.clientHeight;
|
|
5265
5265
|
if (distanceFromBottom < STICK_THRESHOLD) pinBottom(el);
|
|
5266
5266
|
}, [messages.value.length]);
|
|
5267
|
-
|
|
5267
|
+
useEffect7(() => {
|
|
5268
5268
|
const el = ref.current;
|
|
5269
5269
|
if (!el) return;
|
|
5270
5270
|
const last = messages.value.at(-1);
|
|
@@ -5285,13 +5285,13 @@ function MessageList({
|
|
|
5285
5285
|
return () => obs.disconnect();
|
|
5286
5286
|
}, [messages.value]);
|
|
5287
5287
|
const activeFormId = form?.form.id;
|
|
5288
|
-
|
|
5288
|
+
useLayoutEffect2(() => {
|
|
5289
5289
|
const el = ref.current;
|
|
5290
5290
|
if (!el || !activeFormId || detachedRef.current) return;
|
|
5291
5291
|
if (!messages.value.some((m) => m.role === "user")) return;
|
|
5292
5292
|
pinBottom(el);
|
|
5293
5293
|
}, [activeFormId]);
|
|
5294
|
-
|
|
5294
|
+
useEffect7(() => {
|
|
5295
5295
|
const el = ref.current;
|
|
5296
5296
|
if (!el) return;
|
|
5297
5297
|
const syncJump = () => setShowJump(el.scrollHeight - el.scrollTop - el.clientHeight > STICK_THRESHOLD * 2);
|
|
@@ -5461,7 +5461,7 @@ function dayLabel(createdAt, strings) {
|
|
|
5461
5461
|
}
|
|
5462
5462
|
|
|
5463
5463
|
// src/ui/conversation-list.tsx
|
|
5464
|
-
import { useEffect as
|
|
5464
|
+
import { useEffect as useEffect8, useState as useState7 } from "preact/hooks";
|
|
5465
5465
|
|
|
5466
5466
|
// src/ui/history-groups.ts
|
|
5467
5467
|
var HISTORY_BUCKETS = ["today", "yesterday", "lastWeek", "older"];
|
|
@@ -5519,7 +5519,7 @@ function ConversationList({
|
|
|
5519
5519
|
const seed = transport.peekConversations({ visitorId });
|
|
5520
5520
|
const [state, setState] = useState7(seed ? "loaded" : "loading");
|
|
5521
5521
|
const [conversations, setChats] = useState7(seed?.conversations ?? []);
|
|
5522
|
-
|
|
5522
|
+
useEffect8(() => {
|
|
5523
5523
|
let cancelled = false;
|
|
5524
5524
|
transport.listConversations({ visitorId }).then((res) => {
|
|
5525
5525
|
if (cancelled) return;
|
|
@@ -5629,7 +5629,7 @@ function Panel(props2) {
|
|
|
5629
5629
|
const { options, onClose } = props2;
|
|
5630
5630
|
const s = options.strings;
|
|
5631
5631
|
const containerRef = useRef6(null);
|
|
5632
|
-
|
|
5632
|
+
useEffect9(() => {
|
|
5633
5633
|
const el = containerRef.current;
|
|
5634
5634
|
if (!el) return;
|
|
5635
5635
|
const dispose = trapFocus(el);
|
|
@@ -6101,7 +6101,7 @@ var topScreen = (s) => activeStack(s).at(-1);
|
|
|
6101
6101
|
var atTabRoot = (s) => activeStack(s).length === 0;
|
|
6102
6102
|
|
|
6103
6103
|
// src/ui/messenger-home.tsx
|
|
6104
|
-
import { useCallback as useCallback4, useEffect as
|
|
6104
|
+
import { useCallback as useCallback4, useEffect as useEffect14, useRef as useRef8 } from "preact/hooks";
|
|
6105
6105
|
import { useComputed as useComputed6 } from "@preact/signals";
|
|
6106
6106
|
|
|
6107
6107
|
// src/ui/modules/chat.tsx
|
|
@@ -6111,7 +6111,7 @@ var chatLayout = {
|
|
|
6111
6111
|
};
|
|
6112
6112
|
|
|
6113
6113
|
// src/ui/modules/help.tsx
|
|
6114
|
-
import { useEffect as
|
|
6114
|
+
import { useEffect as useEffect10, useMemo as useMemo2, useState as useState8 } from "preact/hooks";
|
|
6115
6115
|
|
|
6116
6116
|
// src/ui/back-header.tsx
|
|
6117
6117
|
import { jsx as jsx23, jsxs as jsxs19 } from "preact/jsx-runtime";
|
|
@@ -6233,7 +6233,7 @@ function HelpRoot({ transport, strings, config, nav, bus, panelProps }) {
|
|
|
6233
6233
|
const [items, setItems] = useState8([]);
|
|
6234
6234
|
const [query, setQuery] = useState8("");
|
|
6235
6235
|
const [reloadKey, setReloadKey] = useState8(0);
|
|
6236
|
-
|
|
6236
|
+
useEffect10(() => {
|
|
6237
6237
|
let cancelled = false;
|
|
6238
6238
|
setState("loading");
|
|
6239
6239
|
transport.listContent({ tags, sortBy: "order", limit: 100 }).then((res) => {
|
|
@@ -6253,7 +6253,7 @@ function HelpRoot({ transport, strings, config, nav, bus, panelProps }) {
|
|
|
6253
6253
|
};
|
|
6254
6254
|
}, [transport, tags, reloadKey, bus]);
|
|
6255
6255
|
const results = useMemo2(() => fuzzySearch(items, query), [items, query]);
|
|
6256
|
-
|
|
6256
|
+
useEffect10(() => {
|
|
6257
6257
|
const q = query.trim();
|
|
6258
6258
|
if (!q) return;
|
|
6259
6259
|
const timer = setTimeout(() => bus.emit("contentSearch", { queryLength: q.length, hitCount: results.length }), 600);
|
|
@@ -6286,7 +6286,7 @@ var helpLayout = {
|
|
|
6286
6286
|
};
|
|
6287
6287
|
|
|
6288
6288
|
// src/ui/modules/home.tsx
|
|
6289
|
-
import { useEffect as
|
|
6289
|
+
import { useEffect as useEffect11, useState as useState9 } from "preact/hooks";
|
|
6290
6290
|
|
|
6291
6291
|
// src/ui/home-card.tsx
|
|
6292
6292
|
import { jsx as jsx28 } from "preact/jsx-runtime";
|
|
@@ -6317,7 +6317,7 @@ function HomeRoot(props2) {
|
|
|
6317
6317
|
const [recent, setRecent] = useState9(null);
|
|
6318
6318
|
const [content, setContent] = useState9([]);
|
|
6319
6319
|
const tagsKey = config.contentTags?.join(",");
|
|
6320
|
-
|
|
6320
|
+
useEffect11(() => {
|
|
6321
6321
|
if (!config.showRecentConversations) return;
|
|
6322
6322
|
let cancelled = false;
|
|
6323
6323
|
transport.listConversations({ limit: 1 }).then((res) => !cancelled && setRecent(res.conversations?.[0] ?? null)).catch((err) => !cancelled && log14.warn("listConversations (home) failed", { err }));
|
|
@@ -6325,7 +6325,7 @@ function HomeRoot(props2) {
|
|
|
6325
6325
|
cancelled = true;
|
|
6326
6326
|
};
|
|
6327
6327
|
}, [transport, config.showRecentConversations]);
|
|
6328
|
-
|
|
6328
|
+
useEffect11(() => {
|
|
6329
6329
|
if (!config.contentTags?.length) return;
|
|
6330
6330
|
let cancelled = false;
|
|
6331
6331
|
transport.listContent({ tags: config.contentTags, limit: 6 }).then((res) => {
|
|
@@ -6405,7 +6405,7 @@ var homeLayout = {
|
|
|
6405
6405
|
};
|
|
6406
6406
|
|
|
6407
6407
|
// src/ui/modules/news.tsx
|
|
6408
|
-
import { useEffect as
|
|
6408
|
+
import { useEffect as useEffect12, useState as useState10 } from "preact/hooks";
|
|
6409
6409
|
import { jsx as jsx30, jsxs as jsxs25 } from "preact/jsx-runtime";
|
|
6410
6410
|
var p26 = BRAND.cssPrefix;
|
|
6411
6411
|
var log15 = logger.scope("news");
|
|
@@ -6415,7 +6415,7 @@ function NewsRoot({ transport, strings, config, nav, bus, panelProps }) {
|
|
|
6415
6415
|
const [errorMsg, setErrorMsg] = useState10(strings.errorGeneric);
|
|
6416
6416
|
const [items, setItems] = useState10([]);
|
|
6417
6417
|
const [reloadKey, setReloadKey] = useState10(0);
|
|
6418
|
-
|
|
6418
|
+
useEffect12(() => {
|
|
6419
6419
|
let cancelled = false;
|
|
6420
6420
|
setState("loading");
|
|
6421
6421
|
transport.listContent({ tags, sortBy: "publishedAt", sortOrder: "desc" }).then((res) => {
|
|
@@ -6537,7 +6537,7 @@ function IframeView({ url, title, strings, onBack, actions }) {
|
|
|
6537
6537
|
}
|
|
6538
6538
|
|
|
6539
6539
|
// src/ui/content-view.tsx
|
|
6540
|
-
import { useCallback as useCallback3, useEffect as
|
|
6540
|
+
import { useCallback as useCallback3, useEffect as useEffect13, useState as useState11 } from "preact/hooks";
|
|
6541
6541
|
import { jsx as jsx33, jsxs as jsxs28 } from "preact/jsx-runtime";
|
|
6542
6542
|
var p29 = BRAND.cssPrefix;
|
|
6543
6543
|
var log16 = logger.scope("content");
|
|
@@ -6551,7 +6551,7 @@ function ContentView({ id, title, transport, strings, bus, onBack, actions }) {
|
|
|
6551
6551
|
setItem(null);
|
|
6552
6552
|
setReloadKey((k) => k + 1);
|
|
6553
6553
|
}, []);
|
|
6554
|
-
|
|
6554
|
+
useEffect13(() => {
|
|
6555
6555
|
let cancelled = false;
|
|
6556
6556
|
transport.listContent({ ids: [id], limit: 1 }).then((res) => {
|
|
6557
6557
|
if (cancelled) return;
|
|
@@ -6569,7 +6569,7 @@ function ContentView({ id, title, transport, strings, bus, onBack, actions }) {
|
|
|
6569
6569
|
cancelled = true;
|
|
6570
6570
|
};
|
|
6571
6571
|
}, [transport, id, reloadKey, bus]);
|
|
6572
|
-
|
|
6572
|
+
useEffect13(() => {
|
|
6573
6573
|
if (!item) return;
|
|
6574
6574
|
const timer = setTimeout(() => bus.emit("contentRead", { contentId: id }), READ_DWELL_MS);
|
|
6575
6575
|
return () => clearTimeout(timer);
|
|
@@ -6622,7 +6622,7 @@ function MessengerHome({
|
|
|
6622
6622
|
const options = panelProps.options;
|
|
6623
6623
|
const strings = options.strings;
|
|
6624
6624
|
const containerRef = useRef8(null);
|
|
6625
|
-
|
|
6625
|
+
useEffect14(() => {
|
|
6626
6626
|
const el = containerRef.current;
|
|
6627
6627
|
if (!el) return;
|
|
6628
6628
|
const dispose = trapFocus(el);
|
|
@@ -6647,7 +6647,7 @@ function MessengerHome({
|
|
|
6647
6647
|
const isReader = top?.kind === "iframe" || top?.kind === "content";
|
|
6648
6648
|
const showTabBar = enabledModules.length > 1 && (atTabRoot(navState) || !isReader);
|
|
6649
6649
|
const savedSize = useRef8(null);
|
|
6650
|
-
|
|
6650
|
+
useEffect14(() => {
|
|
6651
6651
|
if (isReader && savedSize.current === null) {
|
|
6652
6652
|
savedSize.current = panelProps.panelSize;
|
|
6653
6653
|
if (panelProps.panelSize === "normal") onSetPanelSize("expanded");
|
|
@@ -6780,12 +6780,12 @@ function ModulesEmpty({ strings, onClose }) {
|
|
|
6780
6780
|
}
|
|
6781
6781
|
|
|
6782
6782
|
// src/ui/use-launcher-callout.ts
|
|
6783
|
-
import { useCallback as useCallback5, useEffect as
|
|
6783
|
+
import { useCallback as useCallback5, useEffect as useEffect15, useState as useState12 } from "preact/hooks";
|
|
6784
6784
|
function useLauncherCallout({ callout, persistence }) {
|
|
6785
6785
|
const textKey = callout?.text ?? "";
|
|
6786
6786
|
const persistent = callout?.persistent ?? true;
|
|
6787
6787
|
const [dismissed, setDismissed] = useState12(() => persistent ? false : persistence.loadCalloutDismissed(textKey));
|
|
6788
|
-
|
|
6788
|
+
useEffect15(() => {
|
|
6789
6789
|
setDismissed(persistent ? false : persistence.loadCalloutDismissed(textKey));
|
|
6790
6790
|
}, [textKey, persistent, persistence]);
|
|
6791
6791
|
const dismissCallout = useCallback5(() => {
|
|
@@ -6849,7 +6849,7 @@ function App({ options, hostElement, bus }) {
|
|
|
6849
6849
|
activatedRef.current = activated;
|
|
6850
6850
|
const pendingThreadRef = useRef9(false);
|
|
6851
6851
|
const welcomeRef = useRef9(void 0);
|
|
6852
|
-
|
|
6852
|
+
useEffect16(() => {
|
|
6853
6853
|
if (isOpen) setActivated(true);
|
|
6854
6854
|
}, [isOpen]);
|
|
6855
6855
|
const initialPanelApplied = useRef9(false);
|
|
@@ -6900,20 +6900,20 @@ function App({ options, hostElement, bus }) {
|
|
|
6900
6900
|
},
|
|
6901
6901
|
[persistence, transport]
|
|
6902
6902
|
);
|
|
6903
|
-
|
|
6903
|
+
useEffect16(() => {
|
|
6904
6904
|
if (initialSettings.soundMuted !== void 0) feedback.setMuted(initialSettings.soundMuted);
|
|
6905
6905
|
}, []);
|
|
6906
|
-
|
|
6906
|
+
useEffect16(() => {
|
|
6907
6907
|
hostElement.dataset.theme = activeThemeMode;
|
|
6908
6908
|
}, [hostElement, activeThemeMode, options]);
|
|
6909
|
-
|
|
6909
|
+
useEffect16(() => {
|
|
6910
6910
|
hostElement.dataset.textSize = activeTextSize;
|
|
6911
6911
|
}, [hostElement, activeTextSize, options]);
|
|
6912
|
-
|
|
6912
|
+
useEffect16(() => {
|
|
6913
6913
|
feedback.update(options.sound, options.haptics);
|
|
6914
6914
|
}, [feedback, options.sound, options.haptics]);
|
|
6915
|
-
|
|
6916
|
-
|
|
6915
|
+
useEffect16(() => () => feedback.destroy(), [feedback]);
|
|
6916
|
+
useEffect16(() => {
|
|
6917
6917
|
let firstRun = true;
|
|
6918
6918
|
return feedback.mutedSig.subscribe((muted) => {
|
|
6919
6919
|
if (firstRun) {
|
|
@@ -6923,13 +6923,13 @@ function App({ options, hostElement, bus }) {
|
|
|
6923
6923
|
patchAndSync({ soundMuted: muted });
|
|
6924
6924
|
});
|
|
6925
6925
|
}, [feedback, patchAndSync]);
|
|
6926
|
-
|
|
6926
|
+
useEffect16(() => {
|
|
6927
6927
|
if (initialSizeApplied.current || !options.size.initialSize) return;
|
|
6928
6928
|
initialSizeApplied.current = true;
|
|
6929
6929
|
if (persistence.loadPanelSize()) return;
|
|
6930
6930
|
setPanelSize(pickInitialPanelSize(options.mode, options.size, currentViewportWidth()));
|
|
6931
6931
|
}, [options.mode, options.size, persistence]);
|
|
6932
|
-
|
|
6932
|
+
useEffect16(() => {
|
|
6933
6933
|
if (!conversationReady || initialPanelApplied.current) return;
|
|
6934
6934
|
initialPanelApplied.current = true;
|
|
6935
6935
|
const state = resolveInitialPanelState(
|
|
@@ -6944,7 +6944,7 @@ function App({ options, hostElement, bus }) {
|
|
|
6944
6944
|
const homeNavSeeded = useRef9(false);
|
|
6945
6945
|
const resumeActiveRef = useRef9(false);
|
|
6946
6946
|
const resumeBubbleRef = useRef9(null);
|
|
6947
|
-
|
|
6947
|
+
useEffect16(() => {
|
|
6948
6948
|
if (!conversationReady || homeNavSeeded.current) return;
|
|
6949
6949
|
homeNavSeeded.current = true;
|
|
6950
6950
|
if (resumeActiveRef.current) {
|
|
@@ -7129,18 +7129,18 @@ function App({ options, hostElement, bus }) {
|
|
|
7129
7129
|
const userSig = JSON.stringify(options.userContext ?? null);
|
|
7130
7130
|
const pageSig = JSON.stringify(options.pageContext ?? null);
|
|
7131
7131
|
const formCtxSig = JSON.stringify(formContext);
|
|
7132
|
-
|
|
7132
|
+
useEffect16(() => {
|
|
7133
7133
|
const merged = Object.keys(formContext).length ? { ...formContext, ...options.userContext } : options.userContext;
|
|
7134
7134
|
transport.setContext(merged, toWirePageContext(options.pageContext));
|
|
7135
7135
|
}, [transport, userSig, pageSig, formCtxSig]);
|
|
7136
7136
|
const effectiveLocale = clampLocale(activeLocale, options.availableLocales, options.defaultLocale);
|
|
7137
|
-
|
|
7137
|
+
useEffect16(() => {
|
|
7138
7138
|
transport.setLocale(effectiveLocale);
|
|
7139
7139
|
}, [transport, effectiveLocale]);
|
|
7140
|
-
|
|
7140
|
+
useEffect16(() => {
|
|
7141
7141
|
hostElement.dir = isRtlLocale(effectiveLocale) ? "rtl" : "ltr";
|
|
7142
7142
|
}, [hostElement, effectiveLocale]);
|
|
7143
|
-
|
|
7143
|
+
useEffect16(() => {
|
|
7144
7144
|
if (effectiveLocale !== activeLocale) setActiveLocale(effectiveLocale);
|
|
7145
7145
|
}, [effectiveLocale, activeLocale]);
|
|
7146
7146
|
const runResume = useCallback6(
|
|
@@ -7188,7 +7188,7 @@ function App({ options, hostElement, bus }) {
|
|
|
7188
7188
|
[reducer, messagesSig, feedback, bus, options, homeNav]
|
|
7189
7189
|
);
|
|
7190
7190
|
const resumeHandleRef = useRef9(null);
|
|
7191
|
-
|
|
7191
|
+
useEffect16(() => {
|
|
7192
7192
|
const persistedConversation = conversationIdSig.value;
|
|
7193
7193
|
if (persistedConversation) transport.primeIdentity(visitorId, persistedConversation);
|
|
7194
7194
|
void runHandshake({ newConversation: false });
|
|
@@ -7197,7 +7197,7 @@ function App({ options, hostElement, bus }) {
|
|
|
7197
7197
|
resumeHandleRef.current?.cancel();
|
|
7198
7198
|
};
|
|
7199
7199
|
}, []);
|
|
7200
|
-
|
|
7200
|
+
useEffect16(() => {
|
|
7201
7201
|
if (!activated) return;
|
|
7202
7202
|
dataBootRef.current = transport.bootstrap();
|
|
7203
7203
|
void (async () => {
|
|
@@ -7222,7 +7222,7 @@ function App({ options, hostElement, bus }) {
|
|
|
7222
7222
|
}
|
|
7223
7223
|
}, [activated]);
|
|
7224
7224
|
const formsLocaleRef = useRef9(null);
|
|
7225
|
-
|
|
7225
|
+
useEffect16(() => {
|
|
7226
7226
|
if (!activated) return;
|
|
7227
7227
|
if (formsLocaleRef.current === null) {
|
|
7228
7228
|
formsLocaleRef.current = effectiveLocale;
|
|
@@ -7239,15 +7239,15 @@ function App({ options, hostElement, bus }) {
|
|
|
7239
7239
|
};
|
|
7240
7240
|
}, [activated, effectiveLocale, transport]);
|
|
7241
7241
|
const lastUserSig = useRef9(userSig);
|
|
7242
|
-
|
|
7242
|
+
useEffect16(() => {
|
|
7243
7243
|
if (!conversationReady || lastUserSig.current === userSig) return;
|
|
7244
7244
|
lastUserSig.current = userSig;
|
|
7245
7245
|
void runHandshake({ newConversation: false });
|
|
7246
7246
|
}, [userSig, conversationReady, runHandshake]);
|
|
7247
|
-
|
|
7247
|
+
useEffect16(() => {
|
|
7248
7248
|
applyMode(hostElement, computeHostMode(options.mode, panelSize, isOpen));
|
|
7249
7249
|
}, [hostElement, isOpen, panelSize, options.mode]);
|
|
7250
|
-
|
|
7250
|
+
useEffect16(() => {
|
|
7251
7251
|
if (options.mode !== "modal" || !isOpen) return;
|
|
7252
7252
|
const onClick = (e) => {
|
|
7253
7253
|
const path = e.composedPath();
|
|
@@ -7259,7 +7259,7 @@ function App({ options, hostElement, bus }) {
|
|
|
7259
7259
|
hostElement.addEventListener("click", onClick);
|
|
7260
7260
|
return () => hostElement.removeEventListener("click", onClick);
|
|
7261
7261
|
}, [hostElement, isOpen, options.mode]);
|
|
7262
|
-
|
|
7262
|
+
useEffect16(() => {
|
|
7263
7263
|
if (options.mode !== "drawer" || !isOpen) return;
|
|
7264
7264
|
const onKey = (e) => {
|
|
7265
7265
|
if (e.key === "Escape") setIsOpen(false);
|
|
@@ -7394,25 +7394,25 @@ function App({ options, hostElement, bus }) {
|
|
|
7394
7394
|
}
|
|
7395
7395
|
});
|
|
7396
7396
|
const activeForm = useComputed7(() => forms.activeForm.value);
|
|
7397
|
-
|
|
7397
|
+
useEffect16(() => {
|
|
7398
7398
|
forms.refresh();
|
|
7399
7399
|
}, [effectiveForms, forms]);
|
|
7400
7400
|
const pageArea = options.pageContext?.area ? String(options.pageContext.area) : void 0;
|
|
7401
7401
|
const msgCount = useComputed7(() => messagesSig.value.length);
|
|
7402
|
-
|
|
7402
|
+
useEffect16(() => {
|
|
7403
7403
|
if (conversationReady && formsReady) forms.fire("pre-chat");
|
|
7404
7404
|
}, [conversationReady, formsReady, forms]);
|
|
7405
|
-
|
|
7405
|
+
useEffect16(() => {
|
|
7406
7406
|
if (formsReady && !canSend) forms.fire("conversation-closed");
|
|
7407
7407
|
}, [formsReady, canSend, forms]);
|
|
7408
|
-
|
|
7408
|
+
useEffect16(() => {
|
|
7409
7409
|
if (conversationReady && formsReady && pageArea) forms.fire("page-area");
|
|
7410
7410
|
}, [conversationReady, formsReady, pageArea, forms]);
|
|
7411
7411
|
const idleMs = useMemo3(() => {
|
|
7412
7412
|
const secs = effectiveForms.list.flatMap((f) => f.triggers).filter((t) => t.kind === "idle").map((t) => Number(t.param));
|
|
7413
7413
|
return secs.length ? Math.min(...secs) * 1e3 : 0;
|
|
7414
7414
|
}, [effectiveForms]);
|
|
7415
|
-
|
|
7415
|
+
useEffect16(() => {
|
|
7416
7416
|
if (!idleMs || !isOpen) return;
|
|
7417
7417
|
const id = setTimeout(() => forms.fire("idle"), idleMs);
|
|
7418
7418
|
return () => clearTimeout(id);
|
|
@@ -7472,7 +7472,7 @@ function App({ options, hostElement, bus }) {
|
|
|
7472
7472
|
}).catch((err) => log17.debug("refreshUnread failed (non-fatal)", { err }));
|
|
7473
7473
|
}, [transport, options.modules, unreadCountSig]);
|
|
7474
7474
|
const unreadSeeded = useRef9(false);
|
|
7475
|
-
|
|
7475
|
+
useEffect16(() => {
|
|
7476
7476
|
if (!activated || !conversationReady || unreadSeeded.current) return;
|
|
7477
7477
|
unreadSeeded.current = true;
|
|
7478
7478
|
refreshUnread();
|
|
@@ -7630,12 +7630,12 @@ function App({ options, hostElement, bus }) {
|
|
|
7630
7630
|
},
|
|
7631
7631
|
[formsReady, forms]
|
|
7632
7632
|
);
|
|
7633
|
-
|
|
7633
|
+
useEffect16(() => {
|
|
7634
7634
|
if (!formsReady || !pendingOpenFormRef.current) return;
|
|
7635
7635
|
forms.fire("manual", pendingOpenFormRef.current);
|
|
7636
7636
|
pendingOpenFormRef.current = null;
|
|
7637
7637
|
}, [formsReady, forms]);
|
|
7638
|
-
|
|
7638
|
+
useEffect16(() => {
|
|
7639
7639
|
const unsub = bindHostCommands(hostElement, {
|
|
7640
7640
|
open: handleOpen,
|
|
7641
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>>;
|