bstp-agent-widget 0.2.121 → 0.2.123
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/angular.cjs +1 -1
- package/dist/angular.css +1 -1
- package/dist/angular.mjs +97 -81
- package/dist/element.cjs +1 -1
- package/dist/element.css +1 -1
- package/dist/element.mjs +97 -81
- package/dist/index.cjs +87 -87
- package/dist/index.mjs +5579 -5563
- package/dist/shadow.cjs +1 -1
- package/dist/shadow.css +1 -1
- package/dist/shadow.mjs +97 -81
- package/dist/styles.css +1 -1
- package/dist/styles.layer.css +1 -1
- package/dist/types/internal/components/AgentPanel/AgentPanel.d.mts +3 -1
- package/dist/types/internal/components/AgentPanel/AgentPanel.d.ts +3 -1
- package/dist/types/internal/hooks/useAgentUiOptions.d.mts +3 -0
- package/dist/types/internal/hooks/useAgentUiOptions.d.ts +3 -0
- package/dist/types/internal/types/models/widget-ui-options.d.mts +8 -0
- package/dist/types/internal/types/models/widget-ui-options.d.ts +8 -0
- package/package.json +1 -1
package/dist/element.mjs
CHANGED
|
@@ -54914,15 +54914,22 @@ function lU({ panelTitle: e, isLoading: t, isOnline: n, onClose: r }) {
|
|
|
54914
54914
|
});
|
|
54915
54915
|
}
|
|
54916
54916
|
var uU = {
|
|
54917
|
-
root: "
|
|
54918
|
-
surface: "
|
|
54919
|
-
resizeHandle: "
|
|
54917
|
+
root: "_root_nkl8r_1",
|
|
54918
|
+
surface: "_surface_nkl8r_9",
|
|
54919
|
+
resizeHandle: "_resizeHandle_nkl8r_22"
|
|
54920
54920
|
};
|
|
54921
54921
|
//#endregion
|
|
54922
54922
|
//#region package/src/internal/components/AgentPanel/AgentPanel.tsx
|
|
54923
|
-
function dU({ visible: e, onClose: t, messages: n, composerText: r, onComposerTextChange: i, isLoading: a, error: o, canSend: s, onSubmit: c, isListening: l, isVoiceSupported: u, onToggleVoice: d, actions: f, onActionClick: p, panelTitle: m, runtimeInfo: h, scrollViewportRef: g, actualWidth: _ = 420, floatingTop: v = "var(--mantine-custom-space-150)", floatingHeight: y = "100%", floatingMaxHeight: b = "calc(100vh - var(--mantine-custom-space-150) - var(--mantine-custom-space-150))", shellGap: x = "var(--mantine-custom-space-150)", panelHeaderHeight: S = 56, panelResizableWidth: C,
|
|
54924
|
-
let
|
|
54925
|
-
|
|
54923
|
+
function dU({ visible: e, onClose: t, messages: n, composerText: r, onComposerTextChange: i, isLoading: a, error: o, canSend: s, onSubmit: c, isListening: l, isVoiceSupported: u, onToggleVoice: d, actions: f, onActionClick: p, panelTitle: m, runtimeInfo: h, scrollViewportRef: g, actualWidth: _ = 420, floatingTop: v = "var(--mantine-custom-space-150)", floatingHeight: y = "100%", floatingMaxHeight: b = "calc(100vh - var(--mantine-custom-space-150) - var(--mantine-custom-space-150))", shellGap: x = "var(--mantine-custom-space-150)", panelHeaderHeight: S = 56, panelResizableWidth: C, panelBorder: w, panelBorderRadius: T, zIndex: E }) {
|
|
54924
|
+
let D = h.hasCustomerToken && h.hasGenaiToken, O = (e) => {
|
|
54925
|
+
if (e.type === "action-click" && e.data) {
|
|
54926
|
+
let t = f.find((t) => t.buttonText === e.data?.buttonText);
|
|
54927
|
+
t && p(t);
|
|
54928
|
+
}
|
|
54929
|
+
};
|
|
54930
|
+
if (!e) return null;
|
|
54931
|
+
let k = typeof T == "number" ? `${T}px` : T;
|
|
54932
|
+
return /* @__PURE__ */ (0, U.jsxs)(q, {
|
|
54926
54933
|
className: uU.root,
|
|
54927
54934
|
style: {
|
|
54928
54935
|
width: _,
|
|
@@ -54931,9 +54938,11 @@ function dU({ visible: e, onClose: t, messages: n, composerText: r, onComposerTe
|
|
|
54931
54938
|
maxHeight: b,
|
|
54932
54939
|
top: v,
|
|
54933
54940
|
right: x,
|
|
54934
|
-
zIndex:
|
|
54941
|
+
zIndex: E,
|
|
54935
54942
|
"--agent-widget-panel-header-height": `${S}px`,
|
|
54936
|
-
"--agent-widget-shell-gap": x
|
|
54943
|
+
"--agent-widget-shell-gap": x,
|
|
54944
|
+
"--agent-widget-panel-border": w,
|
|
54945
|
+
"--agent-widget-panel-radius": k
|
|
54937
54946
|
},
|
|
54938
54947
|
children: [C && /* @__PURE__ */ (0, U.jsx)(q, {
|
|
54939
54948
|
onPointerDown: C.handlePointerDown,
|
|
@@ -54945,7 +54954,7 @@ function dU({ visible: e, onClose: t, messages: n, composerText: r, onComposerTe
|
|
|
54945
54954
|
/* @__PURE__ */ (0, U.jsx)(lU, {
|
|
54946
54955
|
panelTitle: m,
|
|
54947
54956
|
isLoading: a,
|
|
54948
|
-
isOnline:
|
|
54957
|
+
isOnline: D,
|
|
54949
54958
|
onClose: t
|
|
54950
54959
|
}),
|
|
54951
54960
|
/* @__PURE__ */ (0, U.jsx)(ZH, {
|
|
@@ -54953,12 +54962,7 @@ function dU({ visible: e, onClose: t, messages: n, composerText: r, onComposerTe
|
|
|
54953
54962
|
isLoading: a,
|
|
54954
54963
|
error: o,
|
|
54955
54964
|
scrollViewportRef: g,
|
|
54956
|
-
onWidgetEvent:
|
|
54957
|
-
if (e.type === "action-click" && e.data) {
|
|
54958
|
-
let t = f.find((t) => t.buttonText === e.data?.buttonText);
|
|
54959
|
-
t && p(t);
|
|
54960
|
-
}
|
|
54961
|
-
}
|
|
54965
|
+
onWidgetEvent: O
|
|
54962
54966
|
}),
|
|
54963
54967
|
/* @__PURE__ */ (0, U.jsx)(aU, {
|
|
54964
54968
|
composerText: r,
|
|
@@ -54972,7 +54976,7 @@ function dU({ visible: e, onClose: t, messages: n, composerText: r, onComposerTe
|
|
|
54972
54976
|
})
|
|
54973
54977
|
]
|
|
54974
54978
|
})]
|
|
54975
|
-
})
|
|
54979
|
+
});
|
|
54976
54980
|
}
|
|
54977
54981
|
//#endregion
|
|
54978
54982
|
//#region package/src/internal/hooks/useResolvedAgentType.ts
|
|
@@ -55486,15 +55490,22 @@ var XU = [
|
|
|
55486
55490
|
"body"
|
|
55487
55491
|
];
|
|
55488
55492
|
function ZU(e, t, n, r, i) {
|
|
55489
|
-
let a = (0, H.useRef)(Math.max(280, t ?? 420)), o = (0, H.useRef)(n ?? !1), s = (0, H.useRef)(null), c = (0, H.useCallback)(() => {
|
|
55493
|
+
let a = (0, H.useRef)(Math.max(280, t ?? 420)), o = (0, H.useRef)(n ?? !1), s = (0, H.useRef)(null), c = e?.reserveLayoutSpace ?? !0, l = (0, H.useCallback)(() => {
|
|
55490
55494
|
let t = e?.hostContainerSelector, n = [...t ? t.split(",").map((e) => e.trim()).filter(Boolean) : [], ...XU];
|
|
55491
55495
|
for (let e of n) {
|
|
55492
55496
|
let t = document.querySelector(e);
|
|
55493
55497
|
if (t) return t;
|
|
55494
55498
|
}
|
|
55495
55499
|
return document.body;
|
|
55496
|
-
}, [e?.hostContainerSelector]),
|
|
55500
|
+
}, [e?.hostContainerSelector]), u = (0, H.useCallback)((e) => {
|
|
55497
55501
|
let t = document.documentElement;
|
|
55502
|
+
if (!c) {
|
|
55503
|
+
if (t.style.removeProperty("--agent-widget-panel-width"), s.current) {
|
|
55504
|
+
let { element: e, inlinePaddingBefore: t } = s.current;
|
|
55505
|
+
e.style.paddingRight = t, s.current = null;
|
|
55506
|
+
}
|
|
55507
|
+
return;
|
|
55508
|
+
}
|
|
55498
55509
|
if (e === null ? t.style.removeProperty("--agent-widget-panel-width") : t.style.setProperty("--agent-widget-panel-width", `${e}px`), e === null) {
|
|
55499
55510
|
if (s.current) {
|
|
55500
55511
|
let { element: e, inlinePaddingBefore: t } = s.current;
|
|
@@ -55503,7 +55514,7 @@ function ZU(e, t, n, r, i) {
|
|
|
55503
55514
|
return;
|
|
55504
55515
|
}
|
|
55505
55516
|
if (!s.current || !document.contains(s.current.element)) {
|
|
55506
|
-
let e =
|
|
55517
|
+
let e = l();
|
|
55507
55518
|
if (!e) return;
|
|
55508
55519
|
s.current = {
|
|
55509
55520
|
element: e,
|
|
@@ -55513,36 +55524,36 @@ function ZU(e, t, n, r, i) {
|
|
|
55513
55524
|
}
|
|
55514
55525
|
let { element: n, inlinePaddingBefore: r, widthApplied: i } = s.current;
|
|
55515
55526
|
e !== i && (n.style.paddingRight = r, n.style.paddingRight = `calc(${r || "0px"} + ${e}px)`, s.current.widthApplied = e);
|
|
55516
|
-
}, [c]),
|
|
55527
|
+
}, [l, c]), d = YU({
|
|
55517
55528
|
axis: "x",
|
|
55518
55529
|
direction: -1,
|
|
55519
55530
|
onResizeChange: (0, H.useCallback)((e) => {
|
|
55520
55531
|
let n = Math.max(280, (t ?? 420) + e);
|
|
55521
|
-
a.current = n,
|
|
55522
|
-
}, [t,
|
|
55532
|
+
a.current = n, u(n);
|
|
55533
|
+
}, [t, u])
|
|
55523
55534
|
});
|
|
55524
55535
|
(0, H.useEffect)(() => {
|
|
55525
55536
|
o.current = n ?? !1;
|
|
55526
55537
|
}, [n]), (0, H.useEffect)(() => {
|
|
55527
55538
|
let e = Math.max(280, t ?? 420);
|
|
55528
|
-
a.current = e, o.current &&
|
|
55529
|
-
}, [t,
|
|
55539
|
+
a.current = e, o.current && u(e);
|
|
55540
|
+
}, [t, u]), (0, H.useEffect)(() => {
|
|
55530
55541
|
if (!n) {
|
|
55531
|
-
|
|
55542
|
+
u(null), document.documentElement.removeAttribute("data-agent-widget-open");
|
|
55532
55543
|
return;
|
|
55533
55544
|
}
|
|
55534
|
-
return
|
|
55535
|
-
|
|
55545
|
+
return u(a.current), document.documentElement.setAttribute("data-agent-widget-open", "true"), () => {
|
|
55546
|
+
u(null), document.documentElement.removeAttribute("data-agent-widget-open");
|
|
55536
55547
|
};
|
|
55537
|
-
}, [n,
|
|
55538
|
-
let
|
|
55548
|
+
}, [n, u]);
|
|
55549
|
+
let f = d ? Math.max(280, (t ?? 420) + d.offset) : t ?? 420, p = r === "100%" || r === "100vh", m = typeof e?.panelGap == "number" ? `${e.panelGap}px` : e?.panelGap ?? "var(--mantine-custom-space-150)", h = i ?? 0;
|
|
55539
55550
|
return {
|
|
55540
|
-
panelResizableWidth:
|
|
55541
|
-
actualWidth:
|
|
55542
|
-
shellGap:
|
|
55543
|
-
floatingTop:
|
|
55544
|
-
floatingHeight:
|
|
55545
|
-
floatingMaxHeight: `calc(100vh - ${
|
|
55551
|
+
panelResizableWidth: d,
|
|
55552
|
+
actualWidth: f,
|
|
55553
|
+
shellGap: m,
|
|
55554
|
+
floatingTop: h ? `calc(${h}px + ${m})` : m,
|
|
55555
|
+
floatingHeight: p ? `calc(100vh - ${h}px - ${m} - ${m})` : typeof r == "number" ? `${r}px` : r ?? "100%",
|
|
55556
|
+
floatingMaxHeight: `calc(100vh - ${h}px - ${m} - ${m})`
|
|
55546
55557
|
};
|
|
55547
55558
|
}
|
|
55548
55559
|
//#endregion
|
|
@@ -55684,6 +55695,9 @@ function rW(e) {
|
|
|
55684
55695
|
panelHeight: e?.panelHeight ?? "100%",
|
|
55685
55696
|
panelHeaderHeight: e?.panelHeaderHeight ?? 56,
|
|
55686
55697
|
panelTopOffset: e?.panelTopOffset,
|
|
55698
|
+
panelGap: e?.panelGap,
|
|
55699
|
+
panelBorder: e?.panelBorder,
|
|
55700
|
+
panelBorderRadius: e?.panelBorderRadius,
|
|
55687
55701
|
zIndex: e?.zIndex ?? nW,
|
|
55688
55702
|
fabPosition: {
|
|
55689
55703
|
...typeof e?.fabTopOffset == "number" ? { top: e.fabTopOffset } : { bottom: e?.fabBottomOffset ?? tW.bottom },
|
|
@@ -55876,69 +55890,71 @@ function vW(e = {}) {
|
|
|
55876
55890
|
//#endregion
|
|
55877
55891
|
//#region package/src/internal/features/agent-chat/components/AgentLauncher/AgentLauncher.tsx
|
|
55878
55892
|
function yW({ runtime: e, uiOptions: t }) {
|
|
55879
|
-
let n = e.forceReAuth, { isAuthenticating: r, hasToken: i } = _W(n), { panelWidth: a, panelHeight: o, panelHeaderHeight: s, panelTopOffset: c,
|
|
55893
|
+
let n = e.forceReAuth, { isAuthenticating: r, hasToken: i } = _W(n), { panelWidth: a, panelHeight: o, panelHeaderHeight: s, panelTopOffset: c, panelBorder: l, panelBorderRadius: u, zIndex: d, fabPosition: f } = rW(t), p = (0, H.useRef)(!1), { messages: m, composerText: h, setComposerText: g, isLoading: _, error: v, sendMessage: y, sendInitialMessage: b, agentDisplayName: x, canSend: S } = qU(), { actions: C, handleActionClick: w } = JU(m, g), { runtimeInfo: T, refreshRuntimeInfo: E } = QU(), { isOpen: D, open: O, close: k } = vW({
|
|
55880
55894
|
defaultOpen: !1,
|
|
55881
55895
|
persist: !0,
|
|
55882
55896
|
onOpen: async () => {
|
|
55883
|
-
|
|
55897
|
+
p.current || (p.current = !0, await E());
|
|
55884
55898
|
}
|
|
55885
55899
|
});
|
|
55886
55900
|
(0, H.useEffect)(() => {
|
|
55887
55901
|
(async () => {
|
|
55888
|
-
|
|
55902
|
+
p.current && D && !r && i && await b() && (p.current = !1);
|
|
55889
55903
|
})();
|
|
55890
55904
|
}, [
|
|
55891
|
-
|
|
55905
|
+
D,
|
|
55892
55906
|
r,
|
|
55893
55907
|
i,
|
|
55894
|
-
|
|
55908
|
+
b
|
|
55895
55909
|
]);
|
|
55896
|
-
let
|
|
55910
|
+
let A = oW([m.length, _]), { isListening: j, isSupported: M, startListening: N, stopListening: P, reset: ee } = eW({
|
|
55897
55911
|
lang: $U(),
|
|
55898
55912
|
continuous: !0,
|
|
55899
55913
|
pauseOnSubmit: !0,
|
|
55900
|
-
onTextChange:
|
|
55901
|
-
}), { panelResizableWidth:
|
|
55902
|
-
isListening:
|
|
55903
|
-
stopListening:
|
|
55904
|
-
reset:
|
|
55905
|
-
sendMessage:
|
|
55906
|
-
composerText:
|
|
55907
|
-
setComposerText:
|
|
55908
|
-
startListening:
|
|
55909
|
-
close:
|
|
55910
|
-
});
|
|
55911
|
-
return /* @__PURE__ */ (0, U.jsxs)(U.Fragment, { children: [!
|
|
55912
|
-
onClick: () => void
|
|
55913
|
-
zIndex:
|
|
55914
|
-
position:
|
|
55915
|
-
label:
|
|
55916
|
-
}),
|
|
55914
|
+
onTextChange: g
|
|
55915
|
+
}), { panelResizableWidth: F, actualWidth: I, shellGap: te, floatingTop: ne, floatingHeight: re, floatingMaxHeight: ie } = ZU(t, a, D, o, c), { handleSubmit: L, handleToggleVoice: ae, handleClose: oe } = iW({
|
|
55916
|
+
isListening: j,
|
|
55917
|
+
stopListening: P,
|
|
55918
|
+
reset: ee,
|
|
55919
|
+
sendMessage: y,
|
|
55920
|
+
composerText: h,
|
|
55921
|
+
setComposerText: g,
|
|
55922
|
+
startListening: N,
|
|
55923
|
+
close: k
|
|
55924
|
+
});
|
|
55925
|
+
return /* @__PURE__ */ (0, U.jsxs)(U.Fragment, { children: [!D && /* @__PURE__ */ (0, U.jsx)(BM, {
|
|
55926
|
+
onClick: () => void O(),
|
|
55927
|
+
zIndex: d,
|
|
55928
|
+
position: f,
|
|
55929
|
+
label: x
|
|
55930
|
+
}), D && /* @__PURE__ */ (0, U.jsx)(dU, {
|
|
55917
55931
|
visible: !0,
|
|
55918
|
-
onClose:
|
|
55919
|
-
messages:
|
|
55920
|
-
composerText:
|
|
55921
|
-
onComposerTextChange:
|
|
55922
|
-
isLoading:
|
|
55923
|
-
error:
|
|
55924
|
-
canSend:
|
|
55925
|
-
onSubmit:
|
|
55926
|
-
actions:
|
|
55927
|
-
onActionClick:
|
|
55928
|
-
isListening:
|
|
55929
|
-
isVoiceSupported:
|
|
55930
|
-
onToggleVoice:
|
|
55931
|
-
panelTitle:
|
|
55932
|
-
runtimeInfo:
|
|
55933
|
-
scrollViewportRef:
|
|
55934
|
-
actualWidth:
|
|
55935
|
-
floatingTop:
|
|
55936
|
-
floatingHeight:
|
|
55937
|
-
floatingMaxHeight:
|
|
55938
|
-
shellGap:
|
|
55932
|
+
onClose: oe,
|
|
55933
|
+
messages: m,
|
|
55934
|
+
composerText: h,
|
|
55935
|
+
onComposerTextChange: g,
|
|
55936
|
+
isLoading: _,
|
|
55937
|
+
error: v,
|
|
55938
|
+
canSend: S,
|
|
55939
|
+
onSubmit: L,
|
|
55940
|
+
actions: C,
|
|
55941
|
+
onActionClick: w,
|
|
55942
|
+
isListening: j,
|
|
55943
|
+
isVoiceSupported: M,
|
|
55944
|
+
onToggleVoice: ae,
|
|
55945
|
+
panelTitle: x,
|
|
55946
|
+
runtimeInfo: T,
|
|
55947
|
+
scrollViewportRef: A,
|
|
55948
|
+
actualWidth: I,
|
|
55949
|
+
floatingTop: ne,
|
|
55950
|
+
floatingHeight: re,
|
|
55951
|
+
floatingMaxHeight: ie,
|
|
55952
|
+
shellGap: te,
|
|
55939
55953
|
panelHeaderHeight: s,
|
|
55940
|
-
panelResizableWidth:
|
|
55941
|
-
|
|
55954
|
+
panelResizableWidth: F,
|
|
55955
|
+
panelBorder: l,
|
|
55956
|
+
panelBorderRadius: u,
|
|
55957
|
+
zIndex: d
|
|
55942
55958
|
})] });
|
|
55943
55959
|
}
|
|
55944
55960
|
//#endregion
|