bstp-agent-widget 0.2.97 → 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.
package/dist/agent-widget.js
CHANGED
|
@@ -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
|
|
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
|
|
33842
|
-
if (
|
|
33843
|
-
|
|
33841
|
+
let r = pF();
|
|
33842
|
+
if (r && !e) {
|
|
33843
|
+
c(r);
|
|
33844
33844
|
return;
|
|
33845
33845
|
}
|
|
33846
|
-
let
|
|
33847
|
-
if (!
|
|
33848
|
-
|
|
33849
|
-
let
|
|
33850
|
-
if (RV ===
|
|
33851
|
-
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 =
|
|
33855
|
-
serviceAccount:
|
|
33856
|
-
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
|
-
|
|
33859
|
+
c(await zV);
|
|
33860
33860
|
} catch (e) {
|
|
33861
|
-
console.error("GenAI login failed at app startup:", e),
|
|
33861
|
+
console.error("GenAI login failed at app startup:", e), o("Failed to authenticate with GenAI service");
|
|
33862
33862
|
} finally {
|
|
33863
|
-
zV = null,
|
|
33863
|
+
zV = null, i(!1);
|
|
33864
33864
|
}
|
|
33865
33865
|
})();
|
|
33866
|
-
}, [
|
|
33867
|
-
|
|
33868
|
-
|
|
33869
|
-
|
|
33870
|
-
|
|
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:
|
|
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
|
|
33885
|
-
if (
|
|
33886
|
-
|
|
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,
|
|
33893
|
+
if (UV === e && !n) {
|
|
33894
|
+
HV && (await HV, l(!!pF()));
|
|
33891
33895
|
return;
|
|
33892
33896
|
}
|
|
33893
|
-
UV = e,
|
|
33894
|
-
await
|
|
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,
|
|
33904
|
+
await HV, l(!0);
|
|
33901
33905
|
} catch (e) {
|
|
33902
|
-
console.error("GenAI tenant switch failed:", e),
|
|
33906
|
+
console.error("GenAI tenant switch failed:", e), s("Failed to switch tenant");
|
|
33903
33907
|
} finally {
|
|
33904
|
-
HV = null,
|
|
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:
|
|
33913
|
-
switchError:
|
|
33914
|
-
hasToken:
|
|
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:
|
|
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:
|
|
33923
|
-
authError:
|
|
33924
|
-
hasToken:
|
|
33927
|
+
isAuthenticating: t || a,
|
|
33928
|
+
authError: n ?? o,
|
|
33929
|
+
hasToken: s
|
|
33925
33930
|
};
|
|
33926
33931
|
}
|
|
33927
33932
|
//#endregion
|
|
@@ -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
|
-
|
|
34180
|
-
|
|
34181
|
-
|
|
34182
|
-
|
|
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
|
-
|
|
34192
|
+
f.current || (f.current = !0, await O(), await b());
|
|
34187
34193
|
}
|
|
34188
|
-
}),
|
|
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:
|
|
34193
|
-
}), { panelResizableWidth:
|
|
34194
|
-
isListening:
|
|
34195
|
-
stopListening:
|
|
34196
|
-
reset:
|
|
34197
|
-
sendMessage:
|
|
34198
|
-
composerText:
|
|
34199
|
-
setComposerText:
|
|
34200
|
-
startListening:
|
|
34201
|
-
close:
|
|
34202
|
-
});
|
|
34203
|
-
return /* @__PURE__ */ E(w, { children: [!
|
|
34204
|
-
onClick: () => void
|
|
34205
|
-
zIndex:
|
|
34206
|
-
position:
|
|
34207
|
-
label:
|
|
34208
|
-
}),
|
|
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:
|
|
34211
|
-
messages:
|
|
34212
|
-
composerText:
|
|
34213
|
-
onComposerTextChange:
|
|
34214
|
-
isLoading:
|
|
34215
|
-
error:
|
|
34216
|
-
canSend:
|
|
34217
|
-
onSubmit:
|
|
34218
|
-
actions:
|
|
34219
|
-
onActionClick:
|
|
34220
|
-
isListening:
|
|
34221
|
-
isVoiceSupported:
|
|
34222
|
-
onToggleVoice:
|
|
34223
|
-
panelTitle:
|
|
34224
|
-
runtimeInfo:
|
|
34225
|
-
scrollViewportRef:
|
|
34226
|
-
panelWidth:
|
|
34227
|
-
panelHeight:
|
|
34228
|
-
panelHeaderHeight:
|
|
34229
|
-
panelResizableWidth:
|
|
34230
|
-
zIndex:
|
|
34231
|
-
panelTopOffset:
|
|
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
|