bstp-agent-widget 0.2.86 → 0.2.87
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 +47 -22
- package/dist/agent-widget.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/index.d.ts +2 -0
package/dist/agent-widget.js
CHANGED
|
@@ -33875,11 +33875,36 @@ function yV(e = {}) {
|
|
|
33875
33875
|
var bV = yV();
|
|
33876
33876
|
//#endregion
|
|
33877
33877
|
//#region src/lib/agent-widget.tsx
|
|
33878
|
-
function xV(
|
|
33878
|
+
function xV(e) {
|
|
33879
|
+
let t = 0, n = 0, r = 0;
|
|
33880
|
+
if (e.startsWith("rgb")) {
|
|
33881
|
+
let i = e.match(/\d+/g);
|
|
33882
|
+
i && ([t, n, r] = i.map(Number));
|
|
33883
|
+
} else if (e.startsWith("#")) {
|
|
33884
|
+
let i = e.slice(1);
|
|
33885
|
+
i.length === 3 ? (t = parseInt(i[0] + i[0], 16), n = parseInt(i[1] + i[1], 16), r = parseInt(i[2] + i[2], 16)) : i.length === 6 && (t = parseInt(i.slice(0, 2), 16), n = parseInt(i.slice(2, 4), 16), r = parseInt(i.slice(4, 6), 16));
|
|
33886
|
+
}
|
|
33887
|
+
return [
|
|
33888
|
+
`rgb(${t + 40}, ${n + 40}, ${r + 40})`,
|
|
33889
|
+
`rgb(${t + 30}, ${n + 30}, ${r + 30})`,
|
|
33890
|
+
`rgb(${t + 20}, ${n + 20}, ${r + 20})`,
|
|
33891
|
+
`rgb(${t + 10}, ${n + 10}, ${r + 10})`,
|
|
33892
|
+
e,
|
|
33893
|
+
`rgb(${t - 10}, ${n - 10}, ${r - 10})`,
|
|
33894
|
+
`rgb(${t - 20}, ${n - 20}, ${r - 20})`,
|
|
33895
|
+
`rgb(${t - 30}, ${n - 30}, ${r - 30})`,
|
|
33896
|
+
`rgb(${t - 40}, ${n - 40}, ${r - 40})`,
|
|
33897
|
+
`rgb(${t - 50}, ${n - 50}, ${r - 50})`
|
|
33898
|
+
];
|
|
33899
|
+
}
|
|
33900
|
+
function SV({ config: e, runtime: t, theme: n }) {
|
|
33879
33901
|
return KA.locale || KA.activate("en"), /* @__PURE__ */ T(kC, {
|
|
33880
33902
|
i18n: KA,
|
|
33881
33903
|
children: /* @__PURE__ */ T(Gn, {
|
|
33882
|
-
theme: _(() => n?.accentColor ? yV({
|
|
33904
|
+
theme: _(() => n?.accentColor ? yV({
|
|
33905
|
+
colors: { accent: xV(n.accentColor) },
|
|
33906
|
+
primaryColor: "accent"
|
|
33907
|
+
}) : bV, [n?.accentColor]),
|
|
33883
33908
|
defaultColorScheme: "auto",
|
|
33884
33909
|
children: /* @__PURE__ */ T(EM, {
|
|
33885
33910
|
client: KF,
|
|
@@ -33896,7 +33921,7 @@ function xV({ config: e, runtime: t, theme: n }) {
|
|
|
33896
33921
|
}
|
|
33897
33922
|
//#endregion
|
|
33898
33923
|
//#region src/lib/config.service.ts
|
|
33899
|
-
var
|
|
33924
|
+
var CV = {
|
|
33900
33925
|
url: {
|
|
33901
33926
|
app: "http://localhost:4201",
|
|
33902
33927
|
api: "https://cognitus-etiyacell.etiyacloud.com",
|
|
@@ -33943,8 +33968,8 @@ var SV = {
|
|
|
33943
33968
|
}
|
|
33944
33969
|
}
|
|
33945
33970
|
};
|
|
33946
|
-
function
|
|
33947
|
-
let t =
|
|
33971
|
+
function wV(e) {
|
|
33972
|
+
let t = CV.genai?.init;
|
|
33948
33973
|
return !t || e.genai?.init ? e : {
|
|
33949
33974
|
...e,
|
|
33950
33975
|
genai: {
|
|
@@ -33953,28 +33978,28 @@ function CV(e) {
|
|
|
33953
33978
|
}
|
|
33954
33979
|
};
|
|
33955
33980
|
}
|
|
33956
|
-
async function
|
|
33981
|
+
async function TV(e) {
|
|
33957
33982
|
let t = `${(globalThis.__BASE_URL__ ?? "").replace(/\/$/, "")}/environment.json`, n = e ?? t;
|
|
33958
33983
|
try {
|
|
33959
33984
|
let e = await fetch(n);
|
|
33960
|
-
return e.ok ?
|
|
33985
|
+
return e.ok ? wV(await e.json()) : CV;
|
|
33961
33986
|
} catch {
|
|
33962
|
-
return
|
|
33987
|
+
return CV;
|
|
33963
33988
|
}
|
|
33964
33989
|
}
|
|
33965
33990
|
//#endregion
|
|
33966
33991
|
//#region src/lib/mount-widget.tsx
|
|
33967
|
-
var
|
|
33968
|
-
function
|
|
33969
|
-
let n =
|
|
33992
|
+
var EV = /* @__PURE__ */ new WeakMap();
|
|
33993
|
+
function DV(e, t) {
|
|
33994
|
+
let n = EV.get(e);
|
|
33970
33995
|
n && n.unmount();
|
|
33971
33996
|
let r = D(e);
|
|
33972
|
-
return r.render(/* @__PURE__ */ T(
|
|
33973
|
-
let t =
|
|
33974
|
-
t && (t.unmount(),
|
|
33997
|
+
return r.render(/* @__PURE__ */ T(SV, { ...t })), EV.set(e, r), () => {
|
|
33998
|
+
let t = EV.get(e);
|
|
33999
|
+
t && (t.unmount(), EV.delete(e));
|
|
33975
34000
|
};
|
|
33976
34001
|
}
|
|
33977
|
-
function
|
|
34002
|
+
function OV(e) {
|
|
33978
34003
|
let t = e.genai?.config;
|
|
33979
34004
|
if (!t?.assistantId) throw Error("GenAI config is missing in environment.json.");
|
|
33980
34005
|
return {
|
|
@@ -33983,25 +34008,25 @@ function DV(e) {
|
|
|
33983
34008
|
genaiInit: e.genai?.init
|
|
33984
34009
|
};
|
|
33985
34010
|
}
|
|
33986
|
-
function
|
|
34011
|
+
function kV(e, t) {
|
|
33987
34012
|
return t ? {
|
|
33988
34013
|
assistantId: t.assistantId ?? e.assistantId,
|
|
33989
34014
|
assistants: t.assistants ?? e.assistants,
|
|
33990
34015
|
genaiInit: e.genaiInit
|
|
33991
34016
|
} : e;
|
|
33992
34017
|
}
|
|
33993
|
-
function
|
|
34018
|
+
function AV(e, t) {
|
|
33994
34019
|
return t ? (e.genai ||= {}, e.genai.config || (e.genai.config = {}), typeof t.assistantId == "number" && (e.genai.config.assistantId = t.assistantId), t.assistants && (e.genai.config.agents = t.assistants), e) : e;
|
|
33995
34020
|
}
|
|
33996
|
-
async function
|
|
33997
|
-
let n =
|
|
33998
|
-
return $F(n),
|
|
33999
|
-
config: OV(
|
|
34021
|
+
async function jV(e, t) {
|
|
34022
|
+
let n = AV(await TV(t.environmentUrl), t.config);
|
|
34023
|
+
return $F(n), DV(e, {
|
|
34024
|
+
config: kV(OV(n), t.config),
|
|
34000
34025
|
runtime: t.runtime,
|
|
34001
34026
|
theme: t.theme
|
|
34002
34027
|
});
|
|
34003
34028
|
}
|
|
34004
34029
|
//#endregion
|
|
34005
|
-
export {
|
|
34030
|
+
export { SV as AgentChatWidget, DV as mountAgentChatWidget, jV as mountAgentChatWidgetFromEnvironment };
|
|
34006
34031
|
|
|
34007
34032
|
//# sourceMappingURL=agent-widget.js.map
|