bstp-agent-widget 0.2.109 → 0.2.110
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 +105 -106
- package/dist/agent-widget.js.map +1 -1
- package/package.json +1 -1
package/dist/agent-widget.js
CHANGED
|
@@ -22112,7 +22112,8 @@ var aD = {
|
|
|
22112
22112
|
...e,
|
|
22113
22113
|
[t]: `${oD}${n}`
|
|
22114
22114
|
}), {});
|
|
22115
|
-
|
|
22115
|
+
//#endregion
|
|
22116
|
+
//#region src/utils/local-storage.utils.ts
|
|
22116
22117
|
function cD(e, t = null) {
|
|
22117
22118
|
let n = localStorage.getItem(e);
|
|
22118
22119
|
if (n === null) return t;
|
|
@@ -33718,8 +33719,7 @@ function FV(e, t = {}) {
|
|
|
33718
33719
|
}
|
|
33719
33720
|
//#endregion
|
|
33720
33721
|
//#region src/hooks/useAgentChatSpeechToText.ts
|
|
33721
|
-
|
|
33722
|
-
function LV(e = {}) {
|
|
33722
|
+
function IV(e = {}) {
|
|
33723
33723
|
let { lang: t = "en-EN", continuous: n = !0, interimResults: r = !0, onResult: i, onError: a, onTextChange: o, pauseOnSubmit: s = !1 } = e, [c, l] = y(!1), [d, p] = y(""), [m, h] = y(!1), g = v(null), _ = v(""), b = v(!1), x = v(!1), S = v(""), C = v(""), w = v(null), T = v(!1), E = v(o), D = v(c);
|
|
33724
33724
|
f(() => {
|
|
33725
33725
|
E.current = o, D.current = c;
|
|
@@ -33733,7 +33733,7 @@ function LV(e = {}) {
|
|
|
33733
33733
|
try {
|
|
33734
33734
|
o = new e(), h(!0);
|
|
33735
33735
|
} catch (e) {
|
|
33736
|
-
|
|
33736
|
+
console.log("useAgentChatSpeechToText: Speech recognition is present but not constructable", e), h(!1);
|
|
33737
33737
|
return;
|
|
33738
33738
|
}
|
|
33739
33739
|
return o.lang = t, o.continuous = n, o.interimResults = r, o.onresult = (e) => {
|
|
@@ -33756,7 +33756,7 @@ function LV(e = {}) {
|
|
|
33756
33756
|
E.current?.(e);
|
|
33757
33757
|
});
|
|
33758
33758
|
}, o.onerror = (e) => {
|
|
33759
|
-
|
|
33759
|
+
console.log("useAgentChatSpeechToText: Speech recognition error", e.error), l(!1), a?.(e.error);
|
|
33760
33760
|
}, o.onend = () => {
|
|
33761
33761
|
if (b.current || !D.current) {
|
|
33762
33762
|
l(!1);
|
|
@@ -33783,13 +33783,13 @@ function LV(e = {}) {
|
|
|
33783
33783
|
if (!(!g.current || !m)) try {
|
|
33784
33784
|
p(""), _.current = "", b.current = !1, x.current = !1, T.current = !1, S.current = "", C.current = "", w.current != null && (cancelAnimationFrame(w.current), w.current = null), g.current.start(), l(!0);
|
|
33785
33785
|
} catch (e) {
|
|
33786
|
-
|
|
33786
|
+
console.log("useAgentChatSpeechToText: Failed to start speech recognition", e), a?.("Failed to start speech recognition");
|
|
33787
33787
|
}
|
|
33788
33788
|
}, [m, a]), k = u(() => {
|
|
33789
33789
|
if (g.current) try {
|
|
33790
33790
|
b.current = !0, g.current.stop(), l(!1);
|
|
33791
33791
|
} catch (e) {
|
|
33792
|
-
|
|
33792
|
+
console.log("useAgentChatSpeechToText: Failed to stop speech recognition", e);
|
|
33793
33793
|
}
|
|
33794
33794
|
}, []);
|
|
33795
33795
|
return {
|
|
@@ -33814,11 +33814,11 @@ function LV(e = {}) {
|
|
|
33814
33814
|
}
|
|
33815
33815
|
//#endregion
|
|
33816
33816
|
//#region src/hooks/useAgentChatSpeechLanguage.ts
|
|
33817
|
-
function
|
|
33817
|
+
function LV() {
|
|
33818
33818
|
let e = $P();
|
|
33819
33819
|
return _(() => e && iF(e) || "en-US", [e]);
|
|
33820
33820
|
}
|
|
33821
|
-
var
|
|
33821
|
+
var RV = o({
|
|
33822
33822
|
keycloak: {
|
|
33823
33823
|
url: "",
|
|
33824
33824
|
realm: "",
|
|
@@ -33841,19 +33841,19 @@ var zV = o({
|
|
|
33841
33841
|
});
|
|
33842
33842
|
//#endregion
|
|
33843
33843
|
//#region src/hooks/useConfig.ts
|
|
33844
|
-
function
|
|
33845
|
-
let e = d(
|
|
33844
|
+
function zV() {
|
|
33845
|
+
let e = d(RV);
|
|
33846
33846
|
if (!e) throw Error("useConfig must be used within a ConfigProvider");
|
|
33847
33847
|
return e;
|
|
33848
33848
|
}
|
|
33849
33849
|
//#endregion
|
|
33850
33850
|
//#region src/queries/genai/useGenaiLoginMutation.ts
|
|
33851
|
-
var
|
|
33851
|
+
var BV = kV({
|
|
33852
33852
|
mutationKey: ["genai", "login"],
|
|
33853
33853
|
mutationFn: async ({ serviceAccount: e, serviceKey: t }) => OV.loginToGenai(e, t)
|
|
33854
|
-
}),
|
|
33855
|
-
function
|
|
33856
|
-
let t =
|
|
33854
|
+
}), VV = new pD("useGenaiLogin"), HV = null, UV = null;
|
|
33855
|
+
function WV(e = !1) {
|
|
33856
|
+
let t = zV(), { mutateAsync: n } = BV(), [r, i] = y(!1), [a, o] = y(null), [s, c] = y(null), [l, u] = y(null);
|
|
33857
33857
|
return f(() => {
|
|
33858
33858
|
(async () => {
|
|
33859
33859
|
let r = bF();
|
|
@@ -33865,20 +33865,20 @@ function GV(e = !1) {
|
|
|
33865
33865
|
if (!a) return;
|
|
33866
33866
|
u(a);
|
|
33867
33867
|
let s = `${a.serviceAccount}::${a.serviceKey}`;
|
|
33868
|
-
if (
|
|
33869
|
-
|
|
33868
|
+
if (HV === s && !e) {
|
|
33869
|
+
UV && c(await UV);
|
|
33870
33870
|
return;
|
|
33871
33871
|
}
|
|
33872
|
-
e && (
|
|
33872
|
+
e && (HV = null, UV = null), HV = s, i(!0), o(null), UV = (async () => (await n({
|
|
33873
33873
|
serviceAccount: a.serviceAccount,
|
|
33874
33874
|
serviceKey: a.serviceKey
|
|
33875
33875
|
})).access_token ?? null)();
|
|
33876
33876
|
try {
|
|
33877
|
-
c(await
|
|
33877
|
+
c(await UV);
|
|
33878
33878
|
} catch (e) {
|
|
33879
|
-
|
|
33879
|
+
VV.error("GenAI login failed", { error: e instanceof Error ? e.message : String(e) }), o("Failed to authenticate with GenAI service");
|
|
33880
33880
|
} finally {
|
|
33881
|
-
|
|
33881
|
+
UV = null, i(!1);
|
|
33882
33882
|
}
|
|
33883
33883
|
})();
|
|
33884
33884
|
}, [
|
|
@@ -33894,12 +33894,12 @@ function GV(e = !1) {
|
|
|
33894
33894
|
}
|
|
33895
33895
|
//#endregion
|
|
33896
33896
|
//#region src/queries/genai/useTenantSwitchMutation.ts
|
|
33897
|
-
var
|
|
33897
|
+
var GV = kV({
|
|
33898
33898
|
mutationKey: ["genai", "tenant-switch"],
|
|
33899
33899
|
mutationFn: async ({ tenant_id: e, token: t }) => OV.switchTenant(e, t)
|
|
33900
|
-
}),
|
|
33901
|
-
function
|
|
33902
|
-
let { mutateAsync: r } =
|
|
33900
|
+
}), KV = new pD("useGenaiTenantSwitch"), qV = null, JV = null;
|
|
33901
|
+
function YV(e, t, n = !1) {
|
|
33902
|
+
let { mutateAsync: r } = GV(), [i, a] = y(!1), [o, s] = y(null), [c, l] = y(!1);
|
|
33903
33903
|
return f(() => {
|
|
33904
33904
|
(async () => {
|
|
33905
33905
|
if (!e || !t) return;
|
|
@@ -33908,22 +33908,22 @@ function XV(e, t, n = !1) {
|
|
|
33908
33908
|
l(!0);
|
|
33909
33909
|
return;
|
|
33910
33910
|
}
|
|
33911
|
-
if (
|
|
33912
|
-
|
|
33911
|
+
if (JV === e && !n) {
|
|
33912
|
+
qV && (await qV, l(!!bF()));
|
|
33913
33913
|
return;
|
|
33914
33914
|
}
|
|
33915
|
-
n && (
|
|
33915
|
+
n && (JV = null, qV = null), JV = e, a(!0), s(null), qV = (async () => {
|
|
33916
33916
|
await r({
|
|
33917
33917
|
tenant_id: t,
|
|
33918
33918
|
token: e
|
|
33919
33919
|
});
|
|
33920
33920
|
})();
|
|
33921
33921
|
try {
|
|
33922
|
-
await
|
|
33922
|
+
await qV, l(!0);
|
|
33923
33923
|
} catch (e) {
|
|
33924
|
-
|
|
33924
|
+
KV.error("GenAI tenant switch failed", { error: e instanceof Error ? e.message : String(e) }), s("Failed to switch tenant");
|
|
33925
33925
|
} finally {
|
|
33926
|
-
|
|
33926
|
+
qV = null, a(!1);
|
|
33927
33927
|
}
|
|
33928
33928
|
})();
|
|
33929
33929
|
}, [
|
|
@@ -33939,8 +33939,8 @@ function XV(e, t, n = !1) {
|
|
|
33939
33939
|
}
|
|
33940
33940
|
//#endregion
|
|
33941
33941
|
//#region src/hooks/useGenaiAuth.ts
|
|
33942
|
-
function
|
|
33943
|
-
let { isLoggingIn: t, loginError: n, loginToken: r, genaiInit: i } =
|
|
33942
|
+
function XV(e = !1) {
|
|
33943
|
+
let { isLoggingIn: t, loginError: n, loginToken: r, genaiInit: i } = WV(e), { isSwitching: a, switchError: o, hasToken: s } = YV(r, i?.tenantId, e);
|
|
33944
33944
|
return {
|
|
33945
33945
|
isAuthenticating: t || a,
|
|
33946
33946
|
authError: n ?? o,
|
|
@@ -33949,7 +33949,7 @@ function ZV(e = !1) {
|
|
|
33949
33949
|
}
|
|
33950
33950
|
//#endregion
|
|
33951
33951
|
//#region src/hooks/usePanelState.ts
|
|
33952
|
-
function
|
|
33952
|
+
function ZV(e = {}) {
|
|
33953
33953
|
let { defaultOpen: t = !1, persist: n = !0 } = e, [r, i] = nt({
|
|
33954
33954
|
key: n ? sD.PANEL_OPEN : `panel-state-${Date.now()}`,
|
|
33955
33955
|
defaultValue: t,
|
|
@@ -33980,14 +33980,14 @@ function QV(e = {}) {
|
|
|
33980
33980
|
}
|
|
33981
33981
|
//#endregion
|
|
33982
33982
|
//#region src/hooks/useAgentChatUiOptions.ts
|
|
33983
|
-
var
|
|
33983
|
+
var QV = {
|
|
33984
33984
|
bottom: 24,
|
|
33985
33985
|
right: 24
|
|
33986
|
-
},
|
|
33987
|
-
function
|
|
33988
|
-
let t = e?.panelWidth ?? 420, n = e?.panelHeight ?? "100%", r = e?.panelHeaderHeight ?? 56, i = e?.panelTopOffset, a = e?.zIndex ??
|
|
33989
|
-
...typeof e?.fabTopOffset == "number" ? { top: e.fabTopOffset } : { bottom: e?.fabBottomOffset ??
|
|
33990
|
-
...typeof e?.fabLeftOffset == "number" ? { left: e.fabLeftOffset } : { right: e?.fabRightOffset ??
|
|
33986
|
+
}, $V = 1e4;
|
|
33987
|
+
function eH(e) {
|
|
33988
|
+
let t = e?.panelWidth ?? 420, n = e?.panelHeight ?? "100%", r = e?.panelHeaderHeight ?? 56, i = e?.panelTopOffset, a = e?.zIndex ?? $V, o = {
|
|
33989
|
+
...typeof e?.fabTopOffset == "number" ? { top: e.fabTopOffset } : { bottom: e?.fabBottomOffset ?? QV.bottom },
|
|
33990
|
+
...typeof e?.fabLeftOffset == "number" ? { left: e.fabLeftOffset } : { right: e?.fabRightOffset ?? QV.right }
|
|
33991
33991
|
}, s = e?.panelTitle ?? "Agent Chat";
|
|
33992
33992
|
return {
|
|
33993
33993
|
panelWidth: t,
|
|
@@ -34003,7 +34003,7 @@ function tH(e) {
|
|
|
34003
34003
|
}
|
|
34004
34004
|
//#endregion
|
|
34005
34005
|
//#region src/hooks/useAgentChatActions.ts
|
|
34006
|
-
function
|
|
34006
|
+
function tH(e, t) {
|
|
34007
34007
|
let n = v([]);
|
|
34008
34008
|
return {
|
|
34009
34009
|
actions: _(() => {
|
|
@@ -34019,7 +34019,7 @@ function nH(e, t) {
|
|
|
34019
34019
|
}
|
|
34020
34020
|
//#endregion
|
|
34021
34021
|
//#region src/hooks/useResizable.ts
|
|
34022
|
-
function
|
|
34022
|
+
function nH(e = {}) {
|
|
34023
34023
|
let { axis: t = "y", direction: n = 1, onResizeChange: r } = e, [i, a] = y(0), o = v({
|
|
34024
34024
|
startPos: 0,
|
|
34025
34025
|
startOffset: 0
|
|
@@ -34057,7 +34057,7 @@ function rH(e = {}) {
|
|
|
34057
34057
|
}
|
|
34058
34058
|
//#endregion
|
|
34059
34059
|
//#region src/hooks/useAgentChatLayout.ts
|
|
34060
|
-
var
|
|
34060
|
+
var rH = [
|
|
34061
34061
|
"#root main",
|
|
34062
34062
|
"#root",
|
|
34063
34063
|
"main",
|
|
@@ -34065,9 +34065,9 @@ var iH = [
|
|
|
34065
34065
|
"#app",
|
|
34066
34066
|
"body"
|
|
34067
34067
|
];
|
|
34068
|
-
function
|
|
34068
|
+
function iH(e, t, n) {
|
|
34069
34069
|
let r = v(Math.max(280, t ?? 420)), i = v(n ?? !1), a = v(null), o = u(() => {
|
|
34070
|
-
let t = e?.hostContainerSelector, n = [...t ? t.split(",").map((e) => e.trim()).filter(Boolean) : [], ...
|
|
34070
|
+
let t = e?.hostContainerSelector, n = [...t ? t.split(",").map((e) => e.trim()).filter(Boolean) : [], ...rH];
|
|
34071
34071
|
for (let e of n) {
|
|
34072
34072
|
let t = document.querySelector(e);
|
|
34073
34073
|
if (t) return t;
|
|
@@ -34093,7 +34093,7 @@ function aH(e, t, n) {
|
|
|
34093
34093
|
}
|
|
34094
34094
|
let { element: n, inlinePaddingBefore: r, widthApplied: i } = a.current;
|
|
34095
34095
|
e !== i && (n.style.paddingRight = r, n.style.paddingRight = `calc(${r || "0px"} + ${e}px)`, a.current.widthApplied = e);
|
|
34096
|
-
}, [o]), c =
|
|
34096
|
+
}, [o]), c = nH({
|
|
34097
34097
|
axis: "x",
|
|
34098
34098
|
direction: -1,
|
|
34099
34099
|
onResizeChange: u((e) => {
|
|
@@ -34118,7 +34118,7 @@ function aH(e, t, n) {
|
|
|
34118
34118
|
}
|
|
34119
34119
|
//#endregion
|
|
34120
34120
|
//#region src/hooks/useAgentChatVoiceHandlers.ts
|
|
34121
|
-
function
|
|
34121
|
+
function aH({ isListening: e, stopListening: t, reset: n, sendMessage: r, composerText: i, setComposerText: a, startListening: o, close: s }) {
|
|
34122
34122
|
return {
|
|
34123
34123
|
handleSubmit: () => {
|
|
34124
34124
|
e && t(), n(), r(i);
|
|
@@ -34133,7 +34133,7 @@ function oH({ isListening: e, stopListening: t, reset: n, sendMessage: r, compos
|
|
|
34133
34133
|
}
|
|
34134
34134
|
//#endregion
|
|
34135
34135
|
//#region src/utils/color-utils.ts
|
|
34136
|
-
function
|
|
34136
|
+
function oH(e) {
|
|
34137
34137
|
let t = 0, n = 0, r = 0;
|
|
34138
34138
|
if (e.startsWith("rgb")) {
|
|
34139
34139
|
let i = e.match(/\d+/g);
|
|
@@ -34148,16 +34148,16 @@ function sH(e) {
|
|
|
34148
34148
|
b: r
|
|
34149
34149
|
};
|
|
34150
34150
|
}
|
|
34151
|
-
function
|
|
34152
|
-
let { r: n, g: r, b: i } =
|
|
34151
|
+
function sH(e, t) {
|
|
34152
|
+
let { r: n, g: r, b: i } = oH(e), a = t / 100;
|
|
34153
34153
|
return `rgb(${Math.min(255, n + (255 - n) * a)}, ${Math.min(255, r + (255 - r) * a)}, ${Math.min(255, i + (255 - i) * a)})`;
|
|
34154
34154
|
}
|
|
34155
|
-
function
|
|
34156
|
-
let { r: n, g: r, b: i } =
|
|
34155
|
+
function cH(e, t) {
|
|
34156
|
+
let { r: n, g: r, b: i } = oH(e), a = t / 100;
|
|
34157
34157
|
return `rgb(${Math.max(0, n - n * a)}, ${Math.max(0, r - r * a)}, ${Math.max(0, i - i * a)})`;
|
|
34158
34158
|
}
|
|
34159
|
-
function
|
|
34160
|
-
let { r: t, g: n, b: r } =
|
|
34159
|
+
function lH(e) {
|
|
34160
|
+
let { r: t, g: n, b: r } = oH(e);
|
|
34161
34161
|
return [
|
|
34162
34162
|
`rgb(${t + 50}, ${n + 50}, ${r + 50})`,
|
|
34163
34163
|
`rgb(${t + 40}, ${n + 40}, ${r + 40})`,
|
|
@@ -34174,35 +34174,35 @@ function uH(e) {
|
|
|
34174
34174
|
}
|
|
34175
34175
|
//#endregion
|
|
34176
34176
|
//#region src/hooks/useAccentColor.ts
|
|
34177
|
-
var
|
|
34178
|
-
function
|
|
34177
|
+
var uH = new pD("useAccentColor");
|
|
34178
|
+
function dH(e) {
|
|
34179
34179
|
let t = _(() => {
|
|
34180
34180
|
if (e) try {
|
|
34181
|
-
let t =
|
|
34181
|
+
let t = lH(e);
|
|
34182
34182
|
if (t && t.length === 11) return nT({
|
|
34183
34183
|
colors: { accent: t },
|
|
34184
34184
|
primaryColor: "accent"
|
|
34185
34185
|
});
|
|
34186
34186
|
} catch (e) {
|
|
34187
|
-
|
|
34187
|
+
uH.error("Failed to create theme with accent color", { error: e instanceof Error ? e.message : String(e) });
|
|
34188
34188
|
}
|
|
34189
34189
|
return rT;
|
|
34190
34190
|
}, [e]);
|
|
34191
34191
|
return f(() => {
|
|
34192
34192
|
try {
|
|
34193
|
-
let t = document.documentElement, n = e || "#414275", r =
|
|
34194
|
-
t.style.setProperty("--agent-accent-color", n), t.style.setProperty("--agent-accent-color-light",
|
|
34193
|
+
let t = document.documentElement, n = e || "#414275", r = sH(n, 40), i = cH(n, 15);
|
|
34194
|
+
t.style.setProperty("--agent-accent-color", n), t.style.setProperty("--agent-accent-color-light", sH(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)");
|
|
34195
34195
|
} catch (e) {
|
|
34196
|
-
|
|
34196
|
+
uH.error("Failed to set accent color CSS properties", { error: e instanceof Error ? e.message : String(e) });
|
|
34197
34197
|
}
|
|
34198
34198
|
}, [e]), t;
|
|
34199
34199
|
}
|
|
34200
34200
|
//#endregion
|
|
34201
34201
|
//#region src/features/agent-chat/components/AgentChatLauncher/AgentChatLauncher.tsx
|
|
34202
|
-
function
|
|
34203
|
-
let t = d(QP).forceReAuth, { isAuthenticating: n, hasToken: r } =
|
|
34204
|
-
|
|
34205
|
-
let h = v(!1), { messages: g, composerText: _, setComposerText: y, isLoading: b, error: x, sendMessage: S, sendInitialMessage: C, canSend: D } = MV(), { actions: O, handleActionClick: k } =
|
|
34202
|
+
function fH(e) {
|
|
34203
|
+
let t = d(QP).forceReAuth, { isAuthenticating: n, hasToken: r } = XV(t), { panelWidth: i, panelHeight: a, panelHeaderHeight: o, panelTopOffset: s, zIndex: c, fabPosition: l, fabButtonLabel: u, panelTitle: p, accentColor: m } = eH(e);
|
|
34204
|
+
dH(m);
|
|
34205
|
+
let h = v(!1), { messages: g, composerText: _, setComposerText: y, isLoading: b, error: x, sendMessage: S, sendInitialMessage: C, canSend: D } = MV(), { actions: O, handleActionClick: k } = tH(g, S), { runtimeInfo: A, refreshRuntimeInfo: j } = NV(), { isOpen: M, open: N, close: P } = ZV({
|
|
34206
34206
|
defaultOpen: !1,
|
|
34207
34207
|
persist: !0,
|
|
34208
34208
|
onOpen: async () => {
|
|
@@ -34219,12 +34219,12 @@ function pH(e) {
|
|
|
34219
34219
|
r,
|
|
34220
34220
|
C
|
|
34221
34221
|
]);
|
|
34222
|
-
let F = FV([g.length, b]), { isListening: ee, isSupported: te, startListening: I, stopListening: L, reset: R } =
|
|
34223
|
-
lang:
|
|
34222
|
+
let F = FV([g.length, b]), { isListening: ee, isSupported: te, startListening: I, stopListening: L, reset: R } = IV({
|
|
34223
|
+
lang: LV(),
|
|
34224
34224
|
continuous: !0,
|
|
34225
34225
|
pauseOnSubmit: !0,
|
|
34226
34226
|
onTextChange: y
|
|
34227
|
-
}), { panelResizableWidth: ne } =
|
|
34227
|
+
}), { panelResizableWidth: ne } = iH(e, i, M), { handleSubmit: re, handleToggleVoice: ie, handleClose: ae } = aH({
|
|
34228
34228
|
isListening: ee,
|
|
34229
34229
|
stopListening: L,
|
|
34230
34230
|
reset: R,
|
|
@@ -34267,13 +34267,13 @@ function pH(e) {
|
|
|
34267
34267
|
}
|
|
34268
34268
|
//#endregion
|
|
34269
34269
|
//#region src/providers/AgentChatProviders.tsx
|
|
34270
|
-
function
|
|
34270
|
+
function pH({ runtime: e, children: t }) {
|
|
34271
34271
|
return /* @__PURE__ */ T(QP.Provider, {
|
|
34272
34272
|
value: e,
|
|
34273
34273
|
children: t
|
|
34274
34274
|
});
|
|
34275
34275
|
}
|
|
34276
|
-
function
|
|
34276
|
+
function mH({ config: e, children: t }) {
|
|
34277
34277
|
return /* @__PURE__ */ T(eF.Provider, {
|
|
34278
34278
|
value: e,
|
|
34279
34279
|
children: t
|
|
@@ -34281,10 +34281,10 @@ function hH({ config: e, children: t }) {
|
|
|
34281
34281
|
}
|
|
34282
34282
|
//#endregion
|
|
34283
34283
|
//#region src/providers/ConfigProvider.tsx
|
|
34284
|
-
var
|
|
34284
|
+
var hH = ({ children: e, config: t }) => /* @__PURE__ */ T(RV.Provider, {
|
|
34285
34285
|
value: t,
|
|
34286
34286
|
children: e
|
|
34287
|
-
}),
|
|
34287
|
+
}), gH = {
|
|
34288
34288
|
url: {
|
|
34289
34289
|
app: "http://localhost:4201",
|
|
34290
34290
|
api: "https://cognitus-etiyacell.etiyacloud.com",
|
|
@@ -34330,12 +34330,12 @@ var gH = ({ children: e, config: t }) => /* @__PURE__ */ T(zV.Provider, {
|
|
|
34330
34330
|
tenantId: 54
|
|
34331
34331
|
}
|
|
34332
34332
|
}
|
|
34333
|
-
},
|
|
34334
|
-
function
|
|
34335
|
-
return
|
|
34333
|
+
}, _H = null;
|
|
34334
|
+
function vH() {
|
|
34335
|
+
return _H;
|
|
34336
34336
|
}
|
|
34337
|
-
function
|
|
34338
|
-
let t =
|
|
34337
|
+
function yH(e) {
|
|
34338
|
+
let t = gH.genai?.init;
|
|
34339
34339
|
return !t || e.genai?.init ? e : {
|
|
34340
34340
|
...e,
|
|
34341
34341
|
genai: {
|
|
@@ -34344,23 +34344,22 @@ function bH(e) {
|
|
|
34344
34344
|
}
|
|
34345
34345
|
};
|
|
34346
34346
|
}
|
|
34347
|
-
async function
|
|
34347
|
+
async function bH(e) {
|
|
34348
34348
|
let t = `${(globalThis.__BASE_URL__ ?? "").replace(/\/$/, "")}/environment.json`, n = e ?? t;
|
|
34349
34349
|
try {
|
|
34350
34350
|
let e = await fetch(n);
|
|
34351
|
-
if (!e.ok) return
|
|
34352
|
-
let t =
|
|
34353
|
-
return
|
|
34351
|
+
if (!e.ok) return _H = gH, gH;
|
|
34352
|
+
let t = yH(await e.json());
|
|
34353
|
+
return _H = t, t;
|
|
34354
34354
|
} catch {
|
|
34355
|
-
return
|
|
34355
|
+
return _H = gH, gH;
|
|
34356
34356
|
}
|
|
34357
34357
|
}
|
|
34358
34358
|
//#endregion
|
|
34359
34359
|
//#region src/lib/agent-widget.tsx
|
|
34360
|
-
|
|
34361
|
-
function CH({ config: e, runtime: t, theme: n }) {
|
|
34360
|
+
function xH({ config: e, runtime: t, theme: n }) {
|
|
34362
34361
|
bI.locale || bI.activate("en");
|
|
34363
|
-
let r =
|
|
34362
|
+
let r = dH(n?.accentColor), i = vH();
|
|
34364
34363
|
return i ? /* @__PURE__ */ T($O, {
|
|
34365
34364
|
i18n: bI,
|
|
34366
34365
|
children: /* @__PURE__ */ T(Gn, {
|
|
@@ -34368,38 +34367,38 @@ function CH({ config: e, runtime: t, theme: n }) {
|
|
|
34368
34367
|
defaultColorScheme: "auto",
|
|
34369
34368
|
children: /* @__PURE__ */ T(eR, {
|
|
34370
34369
|
client: gV,
|
|
34371
|
-
children: /* @__PURE__ */ T(
|
|
34370
|
+
children: /* @__PURE__ */ T(hH, {
|
|
34372
34371
|
config: i,
|
|
34373
|
-
children: /* @__PURE__ */ T(
|
|
34372
|
+
children: /* @__PURE__ */ T(mH, {
|
|
34374
34373
|
config: e,
|
|
34375
|
-
children: /* @__PURE__ */ T(
|
|
34374
|
+
children: /* @__PURE__ */ T(pH, {
|
|
34376
34375
|
runtime: t,
|
|
34377
|
-
children: /* @__PURE__ */ T(
|
|
34376
|
+
children: /* @__PURE__ */ T(fH, { ...n ?? {} })
|
|
34378
34377
|
})
|
|
34379
34378
|
})
|
|
34380
34379
|
})
|
|
34381
34380
|
})
|
|
34382
34381
|
})
|
|
34383
|
-
}) : (
|
|
34382
|
+
}) : (console.log("AgentChatWidget: No environment config loaded. Login will not work."), null);
|
|
34384
34383
|
}
|
|
34385
34384
|
//#endregion
|
|
34386
34385
|
//#region src/lib/mount-widget.tsx
|
|
34387
|
-
var
|
|
34388
|
-
async function
|
|
34386
|
+
var SH = /* @__PURE__ */ new WeakMap();
|
|
34387
|
+
async function CH(e, t, n) {
|
|
34389
34388
|
try {
|
|
34390
|
-
CV(await
|
|
34389
|
+
CV(await bH(n?.environmentUrl));
|
|
34391
34390
|
} catch (e) {
|
|
34392
|
-
throw
|
|
34391
|
+
throw console.log("mountAgentChatWidget: Failed to initialize agent widget rest services", e), e;
|
|
34393
34392
|
}
|
|
34394
|
-
let r =
|
|
34393
|
+
let r = SH.get(e);
|
|
34395
34394
|
r && r.unmount();
|
|
34396
34395
|
let i = D(e);
|
|
34397
|
-
return i.render(/* @__PURE__ */ T(
|
|
34398
|
-
let t =
|
|
34399
|
-
t && (t.unmount(),
|
|
34396
|
+
return i.render(/* @__PURE__ */ T(xH, { ...t })), SH.set(e, i), () => {
|
|
34397
|
+
let t = SH.get(e);
|
|
34398
|
+
t && (t.unmount(), SH.delete(e));
|
|
34400
34399
|
};
|
|
34401
34400
|
}
|
|
34402
|
-
function
|
|
34401
|
+
function wH(e) {
|
|
34403
34402
|
let t = e.genai?.config;
|
|
34404
34403
|
if (!t?.assistantId) throw Error("GenAI config is missing in environment.json.");
|
|
34405
34404
|
return {
|
|
@@ -34407,24 +34406,24 @@ function DH(e) {
|
|
|
34407
34406
|
agents: t.agents
|
|
34408
34407
|
};
|
|
34409
34408
|
}
|
|
34410
|
-
function
|
|
34409
|
+
function TH(e, t) {
|
|
34411
34410
|
return t ? {
|
|
34412
34411
|
assistantId: t.assistantId ?? e.assistantId,
|
|
34413
34412
|
agents: t.agents ?? e.agents
|
|
34414
34413
|
} : e;
|
|
34415
34414
|
}
|
|
34416
|
-
function
|
|
34415
|
+
function EH(e, t) {
|
|
34417
34416
|
return t ? (e.genai ||= {}, e.genai.config || (e.genai.config = {}), typeof t.assistantId == "number" && (e.genai.config.assistantId = t.assistantId), t.agents && (e.genai.config.agents = t.agents), e) : e;
|
|
34418
34417
|
}
|
|
34419
|
-
async function
|
|
34420
|
-
let n =
|
|
34421
|
-
return CV(n),
|
|
34422
|
-
config:
|
|
34418
|
+
async function DH(e, t) {
|
|
34419
|
+
let n = EH(await bH(t.environmentUrl), t.config);
|
|
34420
|
+
return CV(n), CH(e, {
|
|
34421
|
+
config: TH(wH(n), t.config),
|
|
34423
34422
|
runtime: t.runtime,
|
|
34424
34423
|
theme: t.theme
|
|
34425
34424
|
});
|
|
34426
34425
|
}
|
|
34427
34426
|
//#endregion
|
|
34428
|
-
export {
|
|
34427
|
+
export { xH as AgentChatWidget, pD as Logger, CH as mountAgentChatWidget, DH as mountAgentChatWidgetFromEnvironment };
|
|
34429
34428
|
|
|
34430
34429
|
//# sourceMappingURL=agent-widget.js.map
|