bstp-agent-widget 0.2.96 → 0.2.98

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.
@@ -33834,40 +33834,44 @@ var LV = EV({
33834
33834
  mutationKey: ["genai", "login"],
33835
33835
  mutationFn: async ({ serviceAccount: e, serviceKey: t }) => TV.loginToGenai(e, t)
33836
33836
  }), RV = null, zV = null;
33837
- function BV() {
33838
- let e = IV(), { mutateAsync: t } = LV(), [n, r] = y(!1), [i, a] = y(null), [o, s] = y(null), [c, l] = y(null);
33837
+ function BV(e = !1) {
33838
+ let t = IV(), { mutateAsync: n } = LV(), [r, i] = y(!1), [a, o] = y(null), [s, c] = y(null), [l, u] = y(null);
33839
33839
  return f(() => {
33840
33840
  (async () => {
33841
- let n = pF();
33842
- if (n) {
33843
- s(n);
33841
+ let r = pF();
33842
+ if (r && !e) {
33843
+ c(r);
33844
33844
  return;
33845
33845
  }
33846
- let i = e?.genai?.init ?? null;
33847
- if (!i) return;
33848
- l(i);
33849
- let o = `${i.serviceAccount}::${i.serviceKey}`;
33850
- if (RV === o) {
33851
- zV && s(await zV);
33846
+ let a = t?.genai?.init ?? null;
33847
+ if (!a) return;
33848
+ u(a);
33849
+ let s = `${a.serviceAccount}::${a.serviceKey}`;
33850
+ if (RV === s && !e) {
33851
+ zV && c(await zV);
33852
33852
  return;
33853
33853
  }
33854
- RV = o, r(!0), a(null), zV = (async () => (await t({
33855
- serviceAccount: i.serviceAccount,
33856
- serviceKey: i.serviceKey
33854
+ e && (RV = null, zV = null), RV = s, i(!0), o(null), zV = (async () => (await n({
33855
+ serviceAccount: a.serviceAccount,
33856
+ serviceKey: a.serviceKey
33857
33857
  })).access_token ?? null)();
33858
33858
  try {
33859
- s(await zV);
33859
+ c(await zV);
33860
33860
  } catch (e) {
33861
- console.error("GenAI login failed at app startup:", e), a("Failed to authenticate with GenAI service");
33861
+ console.error("GenAI login failed at app startup:", e), o("Failed to authenticate with GenAI service");
33862
33862
  } finally {
33863
- zV = null, r(!1);
33863
+ zV = null, i(!1);
33864
33864
  }
33865
33865
  })();
33866
- }, [e, t]), {
33867
- isLoggingIn: n,
33868
- loginError: i,
33869
- loginToken: o,
33870
- genaiInit: c
33866
+ }, [
33867
+ t,
33868
+ n,
33869
+ e
33870
+ ]), {
33871
+ isLoggingIn: r,
33872
+ loginError: a,
33873
+ loginToken: s,
33874
+ genaiInit: l
33871
33875
  };
33872
33876
  }
33873
33877
  //#endregion
@@ -33876,52 +33880,53 @@ var VV = EV({
33876
33880
  mutationKey: ["genai", "tenant-switch"],
33877
33881
  mutationFn: async ({ tenant_id: e, token: t }) => TV.switchTenant(e, t)
33878
33882
  }), HV = null, UV = null;
33879
- function WV(e, t) {
33880
- let { mutateAsync: n } = VV(), [r, i] = y(!1), [a, o] = y(null), [s, c] = y(!1);
33883
+ function WV(e, t, n = !1) {
33884
+ let { mutateAsync: r } = VV(), [i, a] = y(!1), [o, s] = y(null), [c, l] = y(!1);
33881
33885
  return f(() => {
33882
33886
  (async () => {
33883
33887
  if (!e || !t) return;
33884
- let r = pF();
33885
- if (r && r !== e) {
33886
- c(!0);
33888
+ let i = pF();
33889
+ if (i && i !== e && !n) {
33890
+ l(!0);
33887
33891
  return;
33888
33892
  }
33889
- if (UV === e) {
33890
- HV && (await HV, c(!!pF()));
33893
+ if (UV === e && !n) {
33894
+ HV && (await HV, l(!!pF()));
33891
33895
  return;
33892
33896
  }
33893
- UV = e, i(!0), o(null), HV = (async () => {
33894
- await n({
33897
+ n && (UV = null, HV = null), UV = e, a(!0), s(null), HV = (async () => {
33898
+ await r({
33895
33899
  tenant_id: t,
33896
33900
  token: e
33897
33901
  });
33898
33902
  })();
33899
33903
  try {
33900
- await HV, c(!0);
33904
+ await HV, l(!0);
33901
33905
  } catch (e) {
33902
- console.error("GenAI tenant switch failed:", e), o("Failed to switch tenant");
33906
+ console.error("GenAI tenant switch failed:", e), s("Failed to switch tenant");
33903
33907
  } finally {
33904
- HV = null, i(!1);
33908
+ HV = null, a(!1);
33905
33909
  }
33906
33910
  })();
33907
33911
  }, [
33908
33912
  e,
33909
33913
  t,
33914
+ r,
33910
33915
  n
33911
33916
  ]), {
33912
- isSwitching: r,
33913
- switchError: a,
33914
- hasToken: s
33917
+ isSwitching: i,
33918
+ switchError: o,
33919
+ hasToken: c
33915
33920
  };
33916
33921
  }
33917
33922
  //#endregion
33918
33923
  //#region src/hooks/useGenaiAuth.ts
33919
- function GV() {
33920
- let { isLoggingIn: e, loginError: t, loginToken: n, genaiInit: r } = BV(), { isSwitching: i, switchError: a, hasToken: o } = WV(n, r?.tenantId);
33924
+ function GV(e = !1) {
33925
+ let { isLoggingIn: t, loginError: n, loginToken: r, genaiInit: i } = BV(e), { isSwitching: a, switchError: o, hasToken: s } = WV(r, i?.tenantId, e);
33921
33926
  return {
33922
- isAuthenticating: e || i,
33923
- authError: t ?? a,
33924
- hasToken: o
33927
+ isAuthenticating: t || a,
33928
+ authError: n ?? o,
33929
+ hasToken: s
33925
33930
  };
33926
33931
  }
33927
33932
  //#endregion
@@ -34166,7 +34171,7 @@ function aH(e) {
34166
34171
  }, [e]);
34167
34172
  return f(() => {
34168
34173
  try {
34169
- let t = document.documentElement, n = e || "#18182B", r = nH(n, 80), i = rH(n, 15);
34174
+ let t = document.documentElement, n = e || "#414275", r = nH(n, 40), i = rH(n, 15);
34170
34175
  t.style.setProperty("--agent-accent-color", n), t.style.setProperty("--agent-accent-color-light", nH(n, 40)), t.style.setProperty("--agent-accent-color-dark", i), t.style.setProperty("--agent-accent-bg", n), t.style.setProperty("--agent-accent-bg-light", r), t.style.setProperty("--agent-accent-border", n), t.style.setProperty("--agent-accent-text", "#ffffff"), t.style.setProperty("--agent-accent-text-muted", "rgba(255, 255, 255, 0.8)"), console.log("CSS variables set successfully");
34171
34176
  } catch (e) {
34172
34177
  console.error("Failed to set accent color CSS properties:", e);
@@ -34176,59 +34181,60 @@ function aH(e) {
34176
34181
  //#endregion
34177
34182
  //#region src/features/agent-chat/components/AgentChatLauncher/AgentChatLauncher.tsx
34178
34183
  function oH(e) {
34179
- GV();
34180
- let { panelWidth: t, panelHeight: n, panelHeaderHeight: r, panelTopOffset: i, zIndex: a, fabPosition: o, fabButtonLabel: s, panelTitle: c, accentColor: l } = YV(e);
34181
- aH(l);
34182
- let 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({
34184
+ let t = d(GP);
34185
+ GV(t && "forceReAuth" in t ? t.forceReAuth : !1);
34186
+ let { panelWidth: n, panelHeight: r, panelHeaderHeight: i, panelTopOffset: a, zIndex: o, fabPosition: s, fabButtonLabel: c, panelTitle: l, accentColor: u } = YV(e);
34187
+ aH(u);
34188
+ let f = v(!1), { messages: p, composerText: m, setComposerText: h, isLoading: g, error: _, sendMessage: y, sendInitialMessage: b, canSend: x } = kV(), { actions: S, handleActionClick: C } = XV(p, y), { runtimeInfo: D, refreshRuntimeInfo: O } = AV(), { isOpen: k, open: A, close: j } = KV({
34183
34189
  defaultOpen: !1,
34184
34190
  persist: !0,
34185
34191
  onOpen: async () => {
34186
- u.current || (u.current = !0, await C(), await _());
34192
+ f.current || (f.current = !0, await O(), await b());
34187
34193
  }
34188
- }), A = MV([d.length, m]), { isListening: j, isSupported: M, startListening: N, stopListening: P, reset: F } = NV({
34194
+ }), M = MV([p.length, g]), { isListening: N, isSupported: P, startListening: F, stopListening: ee, reset: te } = NV({
34189
34195
  lang: PV(),
34190
34196
  continuous: !0,
34191
34197
  pauseOnSubmit: !0,
34192
- onTextChange: p
34193
- }), { panelResizableWidth: ee } = $V(e, t, D), { handleSubmit: te, handleToggleVoice: I, handleClose: L } = eH({
34194
- isListening: j,
34195
- stopListening: P,
34196
- reset: F,
34197
- sendMessage: g,
34198
- composerText: f,
34199
- setComposerText: p,
34200
- startListening: N,
34201
- close: k
34202
- });
34203
- return /* @__PURE__ */ E(w, { children: [!D && /* @__PURE__ */ T(MP, {
34204
- onClick: () => void O(),
34205
- zIndex: a,
34206
- position: o,
34207
- label: s
34208
- }), D && /* @__PURE__ */ T(EP, {
34198
+ onTextChange: h
34199
+ }), { panelResizableWidth: I } = $V(e, n, k), { handleSubmit: L, handleToggleVoice: R, handleClose: ne } = eH({
34200
+ isListening: N,
34201
+ stopListening: ee,
34202
+ reset: te,
34203
+ sendMessage: y,
34204
+ composerText: m,
34205
+ setComposerText: h,
34206
+ startListening: F,
34207
+ close: j
34208
+ });
34209
+ return /* @__PURE__ */ E(w, { children: [!k && /* @__PURE__ */ T(MP, {
34210
+ onClick: () => void A(),
34211
+ zIndex: o,
34212
+ position: s,
34213
+ label: c
34214
+ }), k && /* @__PURE__ */ T(EP, {
34209
34215
  visible: !0,
34210
- onClose: L,
34211
- messages: d,
34212
- composerText: f,
34213
- onComposerTextChange: p,
34214
- isLoading: m,
34215
- error: h,
34216
- canSend: y,
34217
- onSubmit: te,
34218
- actions: b,
34219
- onActionClick: x,
34220
- isListening: j,
34221
- isVoiceSupported: M,
34222
- onToggleVoice: I,
34223
- panelTitle: c,
34224
- runtimeInfo: S,
34225
- scrollViewportRef: A,
34226
- panelWidth: t,
34227
- panelHeight: n,
34228
- panelHeaderHeight: r,
34229
- panelResizableWidth: ee,
34230
- zIndex: a,
34231
- panelTopOffset: i
34216
+ onClose: ne,
34217
+ messages: p,
34218
+ composerText: m,
34219
+ onComposerTextChange: h,
34220
+ isLoading: g,
34221
+ error: _,
34222
+ canSend: x,
34223
+ onSubmit: L,
34224
+ actions: S,
34225
+ onActionClick: C,
34226
+ isListening: N,
34227
+ isVoiceSupported: P,
34228
+ onToggleVoice: R,
34229
+ panelTitle: l,
34230
+ runtimeInfo: D,
34231
+ scrollViewportRef: M,
34232
+ panelWidth: n,
34233
+ panelHeight: r,
34234
+ panelHeaderHeight: i,
34235
+ panelResizableWidth: I,
34236
+ zIndex: o,
34237
+ panelTopOffset: a
34232
34238
  })] });
34233
34239
  }
34234
34240
  //#endregion