bstp-agent-widget 0.2.70 → 0.2.71
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/dist/agent-widget.js +65 -81
- package/dist/agent-widget.js.map +1 -1
- package/dist/bstp-agent-widget.css +1 -1
- package/package.json +1 -1
package/dist/agent-widget.js
CHANGED
|
@@ -23917,10 +23917,10 @@ function UO(e = {}) {
|
|
|
23917
23917
|
};
|
|
23918
23918
|
}
|
|
23919
23919
|
var WO = {
|
|
23920
|
-
root: "
|
|
23921
|
-
button: "
|
|
23922
|
-
icon: "
|
|
23923
|
-
label: "
|
|
23920
|
+
root: "_root_qxd5o_1",
|
|
23921
|
+
button: "_button_qxd5o_7",
|
|
23922
|
+
icon: "_icon_qxd5o_28",
|
|
23923
|
+
label: "_label_qxd5o_34"
|
|
23924
23924
|
};
|
|
23925
23925
|
//#endregion
|
|
23926
23926
|
//#region src/components/AgentChat/AgentChatFab.tsx
|
|
@@ -29047,29 +29047,21 @@ var BF = {
|
|
|
29047
29047
|
];
|
|
29048
29048
|
function UF({ ui: e }) {
|
|
29049
29049
|
RF();
|
|
29050
|
-
let t = e?.panelWidth ?? 420, n = e?.panelHeight ?? "100%", r = e?.panelHeaderHeight ?? 56, i = e?.zIndex ?? VF, a =
|
|
29051
|
-
bottom:
|
|
29052
|
-
right:
|
|
29053
|
-
}, { isOpen:
|
|
29050
|
+
let t = e?.panelWidth ?? 420, n = e?.panelHeight ?? "100%", r = e?.panelHeaderHeight ?? 56, i = e?.zIndex ?? VF, a = {
|
|
29051
|
+
bottom: e?.fabBottomOffset ?? BF.bottom,
|
|
29052
|
+
right: e?.fabRightOffset ?? BF.right
|
|
29053
|
+
}, { isOpen: o, open: s, close: c } = zF({
|
|
29054
29054
|
defaultOpen: !1,
|
|
29055
29055
|
persist: !0
|
|
29056
|
-
}), { messages:
|
|
29056
|
+
}), { messages: l, composerText: d, setComposerText: p, isLoading: m, error: h, sendMessage: g, sendInitialMessage: y, canSend: b } = OF(), { runtimeInfo: x, refreshRuntimeInfo: S } = kF(), C = MF([l.length, m]), { isListening: D, isSupported: O, startListening: k, stopListening: A, reset: j } = NF({
|
|
29057
29057
|
lang: PF(),
|
|
29058
29058
|
continuous: !0,
|
|
29059
29059
|
pauseOnSubmit: !0,
|
|
29060
|
-
onTextChange:
|
|
29061
|
-
}),
|
|
29060
|
+
onTextChange: p
|
|
29061
|
+
}), M = _(() => /* @__PURE__ */ T(Xd, {
|
|
29062
29062
|
fw: 800,
|
|
29063
29063
|
children: e?.panelTitle ?? "Agent Chat"
|
|
29064
|
-
}), [e?.panelTitle]),
|
|
29065
|
-
if (typeof window > "u") return;
|
|
29066
|
-
if (!e) {
|
|
29067
|
-
c(a);
|
|
29068
|
-
return;
|
|
29069
|
-
}
|
|
29070
|
-
let t = e.getBoundingClientRect();
|
|
29071
|
-
c(a + Math.max(0, window.innerHeight - t.bottom));
|
|
29072
|
-
}, [a]), ne = u(() => {
|
|
29064
|
+
}), [e?.panelTitle]), N = v(Math.max(280, t)), P = v(null), F = u(() => {
|
|
29073
29065
|
if (typeof document > "u") return null;
|
|
29074
29066
|
let t = [...typeof e?.hostContainerSelector == "string" ? e.hostContainerSelector.split(",").map((e) => e.trim()).filter(Boolean) : [], ...HF];
|
|
29075
29067
|
for (let e of t) {
|
|
@@ -29077,101 +29069,93 @@ function UF({ ui: e }) {
|
|
|
29077
29069
|
if (t) return t;
|
|
29078
29070
|
}
|
|
29079
29071
|
return document.body;
|
|
29080
|
-
}, [e?.hostContainerSelector]),
|
|
29072
|
+
}, [e?.hostContainerSelector]), ee = u((e) => {
|
|
29081
29073
|
if (typeof document > "u") return;
|
|
29082
29074
|
let t = document.documentElement;
|
|
29083
29075
|
if (e === null ? t.style.removeProperty("--agent-widget-panel-width") : t.style.setProperty("--agent-widget-panel-width", `${e}px`), typeof window > "u") return;
|
|
29084
29076
|
if (e === null) {
|
|
29085
|
-
if (
|
|
29086
|
-
let { element: e, inlinePaddingBefore: t
|
|
29087
|
-
e.style.paddingRight = t,
|
|
29077
|
+
if (P.current) {
|
|
29078
|
+
let { element: e, inlinePaddingBefore: t } = P.current;
|
|
29079
|
+
e.style.paddingRight = t, P.current = null;
|
|
29088
29080
|
}
|
|
29089
|
-
R(null);
|
|
29090
29081
|
return;
|
|
29091
29082
|
}
|
|
29092
|
-
|
|
29093
|
-
|
|
29094
|
-
|
|
29095
|
-
|
|
29083
|
+
if (!P.current || !document.contains(P.current.element)) {
|
|
29084
|
+
let e = F();
|
|
29085
|
+
if (!e) return;
|
|
29086
|
+
P.current = {
|
|
29087
|
+
element: e,
|
|
29088
|
+
inlinePaddingBefore: e.style.paddingRight,
|
|
29089
|
+
widthApplied: 0
|
|
29090
|
+
};
|
|
29096
29091
|
}
|
|
29097
|
-
|
|
29098
|
-
|
|
29099
|
-
|
|
29100
|
-
|
|
29101
|
-
|
|
29102
|
-
|
|
29103
|
-
|
|
29104
|
-
|
|
29105
|
-
|
|
29106
|
-
|
|
29107
|
-
M && F(), m();
|
|
29108
|
-
}, se = async () => {
|
|
29109
|
-
p(), ie.current || (ie.current = !0, await A(), await D());
|
|
29092
|
+
let { element: n, inlinePaddingBefore: r, widthApplied: i } = P.current;
|
|
29093
|
+
e !== i && (n.style.paddingRight = r, n.style.paddingRight = `calc(${r || "0px"} + ${e}px)`, P.current.widthApplied = e);
|
|
29094
|
+
}, [F]), te = v(!1), I = () => {
|
|
29095
|
+
D && A(), j(), g(d);
|
|
29096
|
+
}, L = () => {
|
|
29097
|
+
D ? A() : (p(""), k());
|
|
29098
|
+
}, R = () => {
|
|
29099
|
+
D && A(), c();
|
|
29100
|
+
}, ne = async () => {
|
|
29101
|
+
s(), te.current || (te.current = !0, await S(), await y());
|
|
29110
29102
|
};
|
|
29111
29103
|
f(() => {
|
|
29112
|
-
|
|
29113
|
-
await
|
|
29104
|
+
o && !te.current && (te.current = !0, (async () => {
|
|
29105
|
+
await S(), await y();
|
|
29114
29106
|
})());
|
|
29115
|
-
}, [
|
|
29116
|
-
let
|
|
29107
|
+
}, [o]);
|
|
29108
|
+
let re = AF({
|
|
29117
29109
|
axis: "x",
|
|
29118
29110
|
direction: -1,
|
|
29119
29111
|
onResizeChange: u((e) => {
|
|
29120
29112
|
let n = Math.max(280, t + e);
|
|
29121
|
-
|
|
29122
|
-
}, [t,
|
|
29113
|
+
N.current = n, ee(n);
|
|
29114
|
+
}, [t, ee])
|
|
29123
29115
|
});
|
|
29124
29116
|
return f(() => {
|
|
29125
29117
|
let e = Math.max(280, t);
|
|
29126
|
-
|
|
29118
|
+
N.current = e, o && ee(e);
|
|
29127
29119
|
}, [
|
|
29128
29120
|
t,
|
|
29129
|
-
|
|
29130
|
-
|
|
29121
|
+
o,
|
|
29122
|
+
ee
|
|
29131
29123
|
]), f(() => {
|
|
29132
29124
|
if (!(typeof document > "u")) {
|
|
29133
|
-
if (!
|
|
29134
|
-
|
|
29125
|
+
if (!o) {
|
|
29126
|
+
ee(null), document.documentElement.removeAttribute("data-agent-widget-open");
|
|
29135
29127
|
return;
|
|
29136
29128
|
}
|
|
29137
29129
|
return document.documentElement.setAttribute("data-agent-widget-open", "true"), () => {
|
|
29138
|
-
|
|
29130
|
+
ee(null), document.documentElement.removeAttribute("data-agent-widget-open");
|
|
29139
29131
|
};
|
|
29140
29132
|
}
|
|
29141
|
-
}, [
|
|
29142
|
-
|
|
29143
|
-
let e = () => {
|
|
29144
|
-
R(L.current?.element ?? ne() ?? null);
|
|
29145
|
-
};
|
|
29146
|
-
return window.addEventListener("resize", e), () => {
|
|
29147
|
-
window.removeEventListener("resize", e);
|
|
29148
|
-
};
|
|
29149
|
-
}, [ne, R]), /* @__PURE__ */ E(w, { children: [!d && /* @__PURE__ */ T(GO, {
|
|
29150
|
-
onClick: () => void se(),
|
|
29133
|
+
}, [o, ee]), /* @__PURE__ */ E(w, { children: [!o && /* @__PURE__ */ T(GO, {
|
|
29134
|
+
onClick: () => void ne(),
|
|
29151
29135
|
zIndex: i,
|
|
29152
|
-
position:
|
|
29136
|
+
position: a,
|
|
29153
29137
|
color: e?.accentColor,
|
|
29154
29138
|
label: e?.fabButtonLabel
|
|
29155
|
-
}),
|
|
29139
|
+
}), o && /* @__PURE__ */ T(zO, {
|
|
29156
29140
|
visible: !0,
|
|
29157
|
-
onClose:
|
|
29158
|
-
messages:
|
|
29159
|
-
composerText:
|
|
29160
|
-
onComposerTextChange:
|
|
29161
|
-
isLoading:
|
|
29162
|
-
error:
|
|
29163
|
-
canSend:
|
|
29164
|
-
onSubmit:
|
|
29165
|
-
isListening:
|
|
29166
|
-
isVoiceSupported:
|
|
29167
|
-
onToggleVoice:
|
|
29168
|
-
panelTitle:
|
|
29169
|
-
runtimeInfo:
|
|
29170
|
-
scrollViewportRef:
|
|
29141
|
+
onClose: R,
|
|
29142
|
+
messages: l,
|
|
29143
|
+
composerText: d,
|
|
29144
|
+
onComposerTextChange: p,
|
|
29145
|
+
isLoading: m,
|
|
29146
|
+
error: h,
|
|
29147
|
+
canSend: b,
|
|
29148
|
+
onSubmit: I,
|
|
29149
|
+
isListening: D,
|
|
29150
|
+
isVoiceSupported: O,
|
|
29151
|
+
onToggleVoice: L,
|
|
29152
|
+
panelTitle: M,
|
|
29153
|
+
runtimeInfo: x,
|
|
29154
|
+
scrollViewportRef: C,
|
|
29171
29155
|
panelWidth: t,
|
|
29172
29156
|
panelHeight: n,
|
|
29173
29157
|
panelHeaderHeight: r,
|
|
29174
|
-
panelResizableWidth:
|
|
29158
|
+
panelResizableWidth: re,
|
|
29175
29159
|
zIndex: i
|
|
29176
29160
|
})] });
|
|
29177
29161
|
}
|