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/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: "_root_98si9_1",
54918
- surface: "_surface_98si9_9",
54919
- resizeHandle: "_resizeHandle_98si9_22"
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, zIndex: w }) {
54924
- let T = h.hasCustomerToken && h.hasGenaiToken;
54925
- return e ? /* @__PURE__ */ (0, U.jsxs)(q, {
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: w,
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: T,
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: (e) => {
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
- }) : null;
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]), l = (0, H.useCallback)((e) => {
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 = c();
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]), u = YU({
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, l(n);
55522
- }, [t, l])
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 && l(e);
55529
- }, [t, l]), (0, H.useEffect)(() => {
55539
+ a.current = e, o.current && u(e);
55540
+ }, [t, u]), (0, H.useEffect)(() => {
55530
55541
  if (!n) {
55531
- l(null), document.documentElement.removeAttribute("data-agent-widget-open");
55542
+ u(null), document.documentElement.removeAttribute("data-agent-widget-open");
55532
55543
  return;
55533
55544
  }
55534
- return l(a.current), document.documentElement.setAttribute("data-agent-widget-open", "true"), () => {
55535
- l(null), document.documentElement.removeAttribute("data-agent-widget-open");
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, l]);
55538
- let d = u ? Math.max(280, (t ?? 420) + u.offset) : t ?? 420, f = r === "100%" || r === "100vh", p = "var(--mantine-custom-space-150)", m = i ?? 0;
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: u,
55541
- actualWidth: d,
55542
- shellGap: p,
55543
- floatingTop: m ? `calc(${m}px + ${p})` : p,
55544
- floatingHeight: f ? `calc(100vh - ${m}px - ${p} - ${p})` : typeof r == "number" ? `${r}px` : r ?? "100%",
55545
- floatingMaxHeight: `calc(100vh - ${m}px - ${p} - ${p})`
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, zIndex: l, fabPosition: u } = rW(t), d = (0, H.useRef)(!1), { messages: f, composerText: p, setComposerText: m, isLoading: h, error: g, sendMessage: _, sendInitialMessage: v, agentDisplayName: y, canSend: b } = qU(), { actions: x, handleActionClick: S } = JU(f, m), { runtimeInfo: C, refreshRuntimeInfo: w } = QU(), { isOpen: T, open: E, close: D } = vW({
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
- d.current || (d.current = !0, await w());
55897
+ p.current || (p.current = !0, await E());
55884
55898
  }
55885
55899
  });
55886
55900
  (0, H.useEffect)(() => {
55887
55901
  (async () => {
55888
- d.current && T && !r && i && await v() && (d.current = !1);
55902
+ p.current && D && !r && i && await b() && (p.current = !1);
55889
55903
  })();
55890
55904
  }, [
55891
- T,
55905
+ D,
55892
55906
  r,
55893
55907
  i,
55894
- v
55908
+ b
55895
55909
  ]);
55896
- let O = oW([f.length, h]), { isListening: k, isSupported: A, startListening: j, stopListening: M, reset: N } = eW({
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: m
55901
- }), { panelResizableWidth: P, actualWidth: ee, shellGap: F, floatingTop: I, floatingHeight: te, floatingMaxHeight: ne } = ZU(t, a, T, o, c), { handleSubmit: re, handleToggleVoice: ie, handleClose: L } = iW({
55902
- isListening: k,
55903
- stopListening: M,
55904
- reset: N,
55905
- sendMessage: _,
55906
- composerText: p,
55907
- setComposerText: m,
55908
- startListening: j,
55909
- close: D
55910
- });
55911
- return /* @__PURE__ */ (0, U.jsxs)(U.Fragment, { children: [!T && /* @__PURE__ */ (0, U.jsx)(BM, {
55912
- onClick: () => void E(),
55913
- zIndex: l,
55914
- position: u,
55915
- label: y
55916
- }), T && /* @__PURE__ */ (0, U.jsx)(dU, {
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: L,
55919
- messages: f,
55920
- composerText: p,
55921
- onComposerTextChange: m,
55922
- isLoading: h,
55923
- error: g,
55924
- canSend: b,
55925
- onSubmit: re,
55926
- actions: x,
55927
- onActionClick: S,
55928
- isListening: k,
55929
- isVoiceSupported: A,
55930
- onToggleVoice: ie,
55931
- panelTitle: y,
55932
- runtimeInfo: C,
55933
- scrollViewportRef: O,
55934
- actualWidth: ee,
55935
- floatingTop: I,
55936
- floatingHeight: te,
55937
- floatingMaxHeight: ne,
55938
- shellGap: F,
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: P,
55941
- zIndex: l
55954
+ panelResizableWidth: F,
55955
+ panelBorder: l,
55956
+ panelBorderRadius: u,
55957
+ zIndex: d
55942
55958
  })] });
55943
55959
  }
55944
55960
  //#endregion