bstp-agent-widget 0.2.89 → 0.2.91

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.
@@ -28403,42 +28403,52 @@ function AP(e = {}) {
28403
28403
  };
28404
28404
  }
28405
28405
  var jP = {
28406
- root: "_root_1vfzh_1",
28407
- button: "_button_1vfzh_5",
28408
- icon: "_icon_1vfzh_22",
28409
- label: "_label_1vfzh_28"
28406
+ root: "_root_1eel0_1",
28407
+ button: "_button_1eel0_5",
28408
+ icon: "_icon_1eel0_21",
28409
+ label: "_label_1eel0_27"
28410
28410
  };
28411
28411
  //#endregion
28412
28412
  //#region src/components/AgentChat/AgentChatFab/AgentChatFab.tsx
28413
- function MP({ onClick: e, zIndex: t, position: n, label: r }) {
28414
- let i = CT(), { handlePointerDown: a, style: o } = AP({ skipSelector: "" }), { transform: s, cursor: c, touchAction: l } = o, u = _(() => ({
28415
- transform: s,
28416
- touchAction: l,
28413
+ function MP({ onClick: e, zIndex: t, position: n, label: r, accentColor: i }) {
28414
+ let a = CT(), o = An(), { handlePointerDown: s, style: c } = AP({ skipSelector: "" }), { transform: l, cursor: u, touchAction: d } = c, f = _(() => ({
28415
+ transform: l,
28416
+ touchAction: d,
28417
28417
  zIndex: t,
28418
28418
  ...n
28419
28419
  }), [
28420
28420
  n,
28421
+ d,
28421
28422
  l,
28422
- s,
28423
28423
  t
28424
+ ]), p = _(() => {
28425
+ let e = i || o.colors.primary[4];
28426
+ return {
28427
+ cursor: u ?? "pointer",
28428
+ background: `linear-gradient(135deg, ${o.colors.primary[5]}, ${e})`
28429
+ };
28430
+ }, [
28431
+ u,
28432
+ i,
28433
+ o.colors.primary
28424
28434
  ]);
28425
28435
  return /* @__PURE__ */ T("div", {
28426
28436
  className: jP.root,
28427
- style: u,
28437
+ style: f,
28428
28438
  children: /* @__PURE__ */ T(xv, {
28429
28439
  label: "Open agent widget",
28430
28440
  position: "left",
28431
28441
  children: /* @__PURE__ */ E(hc, {
28432
28442
  onClick: e,
28433
- onPointerDown: a,
28434
- style: { cursor: c ?? "pointer" },
28443
+ onPointerDown: s,
28444
+ style: p,
28435
28445
  className: jP.button,
28436
28446
  "aria-label": "Open agent widget",
28437
28447
  children: [/* @__PURE__ */ T("span", {
28438
28448
  className: jP.icon,
28439
28449
  children: /* @__PURE__ */ T(DP, {
28440
- width: i.other.iconSize["icon-md"],
28441
- height: i.other.iconSize["icon-md"]
28450
+ width: a.other.iconSize["icon-md"],
28451
+ height: a.other.iconSize["icon-md"]
28442
28452
  })
28443
28453
  }), /* @__PURE__ */ T("span", {
28444
28454
  className: jP.label,
@@ -33485,7 +33495,15 @@ async function SV(e, t) {
33485
33495
  });
33486
33496
  return r.data?.access_token && mF(r.data.access_token), r.data;
33487
33497
  } catch (e) {
33488
- throw xV.error("Error logging in to GenAI: ", { error: e }), e;
33498
+ let t = {
33499
+ message: e instanceof Error ? e.message : String(e),
33500
+ ...e && typeof e == "object" && "response" in e ? {
33501
+ status: e.response?.status,
33502
+ statusText: e.response?.statusText,
33503
+ data: e.response?.data
33504
+ } : {}
33505
+ };
33506
+ throw xV.error("Error logging in to GenAI: ", t), e;
33489
33507
  }
33490
33508
  }
33491
33509
  async function CV(e, t) {
@@ -33496,14 +33514,30 @@ async function CV(e, t) {
33496
33514
  });
33497
33515
  return n.data?.data?.access_token && mF(n.data.data.access_token), n.data?.data?.tenant_id && gF(n.data.data.tenant_id), n.data;
33498
33516
  } catch (e) {
33499
- throw xV.error("Error switching tenant: ", { error: e }), e;
33517
+ let t = {
33518
+ message: e instanceof Error ? e.message : String(e),
33519
+ ...e && typeof e == "object" && "response" in e ? {
33520
+ status: e.response?.status,
33521
+ statusText: e.response?.statusText,
33522
+ data: e.response?.data
33523
+ } : {}
33524
+ };
33525
+ throw xV.error("Error switching tenant: ", t), e;
33500
33526
  }
33501
33527
  }
33502
33528
  async function wV(e) {
33503
33529
  try {
33504
33530
  return (await yV.post("/agent-message", e, { anonymous: !0 })).data;
33505
33531
  } catch (e) {
33506
- throw xV.error("Error sending agent message: ", { error: e }), e;
33532
+ let t = {
33533
+ message: e instanceof Error ? e.message : String(e),
33534
+ ...e && typeof e == "object" && "response" in e ? {
33535
+ status: e.response?.status,
33536
+ statusText: e.response?.statusText,
33537
+ data: e.response?.data
33538
+ } : {}
33539
+ };
33540
+ throw xV.error("Error sending agent message: ", t), e;
33507
33541
  }
33508
33542
  }
33509
33543
  var TV = {
@@ -33947,7 +33981,8 @@ function YV(e) {
33947
33981
  zIndex: a,
33948
33982
  fabPosition: o,
33949
33983
  fabButtonLabel: e?.fabButtonLabel,
33950
- panelTitle: s
33984
+ panelTitle: s,
33985
+ accentColor: e?.accentColor
33951
33986
  };
33952
33987
  }
33953
33988
  //#endregion
@@ -34084,54 +34119,55 @@ function eH({ isListening: e, stopListening: t, reset: n, sendMessage: r, compos
34084
34119
  //#region src/features/agent-chat/components/AgentChatLauncher/AgentChatLauncher.tsx
34085
34120
  function tH(e) {
34086
34121
  GV();
34087
- let { panelWidth: t, panelHeight: n, panelHeaderHeight: r, panelTopOffset: i, zIndex: a, fabPosition: o, fabButtonLabel: s, panelTitle: c } = YV(e), l = v(!1), { messages: u, composerText: d, setComposerText: f, isLoading: p, error: m, sendMessage: h, sendInitialMessage: g, canSend: _ } = kV(), { actions: y, handleActionClick: b } = XV(u, h), { runtimeInfo: x, refreshRuntimeInfo: S } = AV(), { isOpen: C, open: D, close: O } = KV({
34122
+ let { panelWidth: t, panelHeight: n, panelHeaderHeight: r, panelTopOffset: i, zIndex: a, fabPosition: o, fabButtonLabel: s, panelTitle: c, accentColor: l } = YV(e), u = v(!1), { messages: d, composerText: f, setComposerText: p, isLoading: m, error: h, sendMessage: g, sendInitialMessage: _, canSend: y } = kV(), { actions: b, handleActionClick: x } = XV(d, g), { runtimeInfo: S, refreshRuntimeInfo: C } = AV(), { isOpen: D, open: O, close: k } = KV({
34088
34123
  defaultOpen: !1,
34089
34124
  persist: !0,
34090
34125
  onOpen: async () => {
34091
- l.current || (l.current = !0, await S(), await g());
34126
+ u.current || (u.current = !0, await C(), await _());
34092
34127
  }
34093
- }), k = MV([u.length, p]), { isListening: A, isSupported: j, startListening: M, stopListening: N, reset: P } = NV({
34128
+ }), A = MV([d.length, m]), { isListening: j, isSupported: M, startListening: N, stopListening: P, reset: F } = NV({
34094
34129
  lang: PV(),
34095
34130
  continuous: !0,
34096
34131
  pauseOnSubmit: !0,
34097
- onTextChange: f
34098
- }), { panelResizableWidth: F } = $V(e, t, C), { handleSubmit: ee, handleToggleVoice: te, handleClose: I } = eH({
34099
- isListening: A,
34100
- stopListening: N,
34101
- reset: P,
34102
- sendMessage: h,
34103
- composerText: d,
34104
- setComposerText: f,
34105
- startListening: M,
34106
- close: O
34107
- });
34108
- return /* @__PURE__ */ E(w, { children: [!C && /* @__PURE__ */ T(MP, {
34109
- onClick: () => void D(),
34132
+ onTextChange: p
34133
+ }), { panelResizableWidth: ee } = $V(e, t, D), { handleSubmit: te, handleToggleVoice: I, handleClose: L } = eH({
34134
+ isListening: j,
34135
+ stopListening: P,
34136
+ reset: F,
34137
+ sendMessage: g,
34138
+ composerText: f,
34139
+ setComposerText: p,
34140
+ startListening: N,
34141
+ close: k
34142
+ });
34143
+ return /* @__PURE__ */ E(w, { children: [!D && /* @__PURE__ */ T(MP, {
34144
+ onClick: () => void O(),
34110
34145
  zIndex: a,
34111
34146
  position: o,
34112
- label: s
34113
- }), C && /* @__PURE__ */ T(EP, {
34147
+ label: s,
34148
+ accentColor: l
34149
+ }), D && /* @__PURE__ */ T(EP, {
34114
34150
  visible: !0,
34115
- onClose: I,
34116
- messages: u,
34117
- composerText: d,
34118
- onComposerTextChange: f,
34119
- isLoading: p,
34120
- error: m,
34121
- canSend: _,
34122
- onSubmit: ee,
34123
- actions: y,
34124
- onActionClick: b,
34125
- isListening: A,
34126
- isVoiceSupported: j,
34127
- onToggleVoice: te,
34151
+ onClose: L,
34152
+ messages: d,
34153
+ composerText: f,
34154
+ onComposerTextChange: p,
34155
+ isLoading: m,
34156
+ error: h,
34157
+ canSend: y,
34158
+ onSubmit: te,
34159
+ actions: b,
34160
+ onActionClick: x,
34161
+ isListening: j,
34162
+ isVoiceSupported: M,
34163
+ onToggleVoice: I,
34128
34164
  panelTitle: c,
34129
- runtimeInfo: x,
34130
- scrollViewportRef: k,
34165
+ runtimeInfo: S,
34166
+ scrollViewportRef: A,
34131
34167
  panelWidth: t,
34132
34168
  panelHeight: n,
34133
34169
  panelHeaderHeight: r,
34134
- panelResizableWidth: F,
34170
+ panelResizableWidth: ee,
34135
34171
  zIndex: a,
34136
34172
  panelTopOffset: i
34137
34173
  })] });
@@ -34267,11 +34303,16 @@ async function cH(e) {
34267
34303
  //#endregion
34268
34304
  //#region src/lib/mount-widget.tsx
34269
34305
  var lH = /* @__PURE__ */ new WeakMap();
34270
- function uH(e, t) {
34271
- let n = lH.get(e);
34272
- n && n.unmount();
34273
- let r = D(e);
34274
- return r.render(/* @__PURE__ */ T(aH, { ...t })), lH.set(e, r), () => {
34306
+ async function uH(e, t, n) {
34307
+ try {
34308
+ bV(await cH(n?.environmentUrl));
34309
+ } catch (e) {
34310
+ throw console.error("Failed to initialize agent widget rest services:", e), e;
34311
+ }
34312
+ let r = lH.get(e);
34313
+ r && r.unmount();
34314
+ let i = D(e);
34315
+ return i.render(/* @__PURE__ */ T(aH, { ...t })), lH.set(e, i), () => {
34275
34316
  let t = lH.get(e);
34276
34317
  t && (t.unmount(), lH.delete(e));
34277
34318
  };