bstp-agent-widget 0.2.95 → 0.2.96

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.
@@ -34152,7 +34152,7 @@ function iH(e) {
34152
34152
  //#endregion
34153
34153
  //#region src/hooks/useAccentColor.ts
34154
34154
  function aH(e) {
34155
- let t = An(), n = _(() => {
34155
+ let t = _(() => {
34156
34156
  if (e) try {
34157
34157
  let t = iH(e);
34158
34158
  if (t && t.length === 11) return nT({
@@ -34166,12 +34166,12 @@ function aH(e) {
34166
34166
  }, [e]);
34167
34167
  return f(() => {
34168
34168
  try {
34169
- let n = document.documentElement, r = e || t.colors?.["brand-dark-blue"]?.[7] || "#18182B", i = nH(r, 80), a = rH(r, 15);
34170
- n.style.setProperty("--agent-accent-color", r), n.style.setProperty("--agent-accent-color-light", nH(r, 40)), n.style.setProperty("--agent-accent-color-dark", a), n.style.setProperty("--agent-accent-bg", r), n.style.setProperty("--agent-accent-bg-light", i), n.style.setProperty("--agent-accent-border", r), n.style.setProperty("--agent-accent-text", "#ffffff"), n.style.setProperty("--agent-accent-text-muted", "rgba(255, 255, 255, 0.8)"), console.log("CSS variables set successfully");
34169
+ let t = document.documentElement, n = e || "#18182B", r = nH(n, 80), i = rH(n, 15);
34170
+ 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
34171
  } catch (e) {
34172
34172
  console.error("Failed to set accent color CSS properties:", e);
34173
34173
  }
34174
- }, [e, t]), n;
34174
+ }, [e]), t;
34175
34175
  }
34176
34176
  //#endregion
34177
34177
  //#region src/features/agent-chat/components/AgentChatLauncher/AgentChatLauncher.tsx
@@ -34248,34 +34248,27 @@ function cH({ config: e, children: t }) {
34248
34248
  //#endregion
34249
34249
  //#region src/lib/agent-widget.tsx
34250
34250
  function lH({ config: e, runtime: t, theme: n }) {
34251
- return /* @__PURE__ */ T(Gn, {
34252
- theme: aH(n?.accentColor),
34253
- defaultColorScheme: "auto",
34254
- children: /* @__PURE__ */ T(qL, {
34255
- client: pV,
34256
- children: /* @__PURE__ */ T(cH, {
34257
- config: e,
34258
- children: /* @__PURE__ */ T(sH, {
34259
- runtime: t,
34260
- children: /* @__PURE__ */ T(oH, { ...n ?? {} })
34261
- })
34262
- })
34263
- })
34264
- });
34265
- }
34266
- function uH({ config: e, runtime: t, theme: n }) {
34267
34251
  return pI.locale || pI.activate("en"), /* @__PURE__ */ T(HO, {
34268
34252
  i18n: pI,
34269
- children: /* @__PURE__ */ T(lH, {
34270
- config: e,
34271
- runtime: t,
34272
- theme: n
34253
+ children: /* @__PURE__ */ T(Gn, {
34254
+ theme: aH(n?.accentColor),
34255
+ defaultColorScheme: "auto",
34256
+ children: /* @__PURE__ */ T(qL, {
34257
+ client: pV,
34258
+ children: /* @__PURE__ */ T(cH, {
34259
+ config: e,
34260
+ children: /* @__PURE__ */ T(sH, {
34261
+ runtime: t,
34262
+ children: /* @__PURE__ */ T(oH, { ...n ?? {} })
34263
+ })
34264
+ })
34265
+ })
34273
34266
  })
34274
34267
  });
34275
34268
  }
34276
34269
  //#endregion
34277
34270
  //#region src/lib/config.service.ts
34278
- var dH = {
34271
+ var uH = {
34279
34272
  url: {
34280
34273
  app: "http://localhost:4201",
34281
34274
  api: "https://cognitus-etiyacell.etiyacloud.com",
@@ -34322,8 +34315,8 @@ var dH = {
34322
34315
  }
34323
34316
  }
34324
34317
  };
34325
- function fH(e) {
34326
- let t = dH.genai?.init;
34318
+ function dH(e) {
34319
+ let t = uH.genai?.init;
34327
34320
  return !t || e.genai?.init ? e : {
34328
34321
  ...e,
34329
34322
  genai: {
@@ -34332,33 +34325,33 @@ function fH(e) {
34332
34325
  }
34333
34326
  };
34334
34327
  }
34335
- async function pH(e) {
34328
+ async function fH(e) {
34336
34329
  let t = `${(globalThis.__BASE_URL__ ?? "").replace(/\/$/, "")}/environment.json`, n = e ?? t;
34337
34330
  try {
34338
34331
  let e = await fetch(n);
34339
- return e.ok ? fH(await e.json()) : dH;
34332
+ return e.ok ? dH(await e.json()) : uH;
34340
34333
  } catch {
34341
- return dH;
34334
+ return uH;
34342
34335
  }
34343
34336
  }
34344
34337
  //#endregion
34345
34338
  //#region src/lib/mount-widget.tsx
34346
- var mH = /* @__PURE__ */ new WeakMap();
34347
- async function hH(e, t, n) {
34339
+ var pH = /* @__PURE__ */ new WeakMap();
34340
+ async function mH(e, t, n) {
34348
34341
  try {
34349
- bV(await pH(n?.environmentUrl));
34342
+ bV(await fH(n?.environmentUrl));
34350
34343
  } catch (e) {
34351
34344
  throw console.error("Failed to initialize agent widget rest services:", e), e;
34352
34345
  }
34353
- let r = mH.get(e);
34346
+ let r = pH.get(e);
34354
34347
  r && r.unmount();
34355
34348
  let i = D(e);
34356
- return i.render(/* @__PURE__ */ T(uH, { ...t })), mH.set(e, i), () => {
34357
- let t = mH.get(e);
34358
- t && (t.unmount(), mH.delete(e));
34349
+ return i.render(/* @__PURE__ */ T(lH, { ...t })), pH.set(e, i), () => {
34350
+ let t = pH.get(e);
34351
+ t && (t.unmount(), pH.delete(e));
34359
34352
  };
34360
34353
  }
34361
- function gH(e) {
34354
+ function hH(e) {
34362
34355
  let t = e.genai?.config;
34363
34356
  if (!t?.assistantId) throw Error("GenAI config is missing in environment.json.");
34364
34357
  return {
@@ -34366,24 +34359,24 @@ function gH(e) {
34366
34359
  agents: t.agents
34367
34360
  };
34368
34361
  }
34369
- function _H(e, t) {
34362
+ function gH(e, t) {
34370
34363
  return t ? {
34371
34364
  assistantId: t.assistantId ?? e.assistantId,
34372
34365
  agents: t.agents ?? e.agents
34373
34366
  } : e;
34374
34367
  }
34375
- function vH(e, t) {
34368
+ function _H(e, t) {
34376
34369
  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;
34377
34370
  }
34378
- async function yH(e, t) {
34379
- let n = vH(await pH(t.environmentUrl), t.config);
34380
- return bV(n), hH(e, {
34381
- config: _H(gH(n), t.config),
34371
+ async function vH(e, t) {
34372
+ let n = _H(await fH(t.environmentUrl), t.config);
34373
+ return bV(n), mH(e, {
34374
+ config: gH(hH(n), t.config),
34382
34375
  runtime: t.runtime,
34383
34376
  theme: t.theme
34384
34377
  });
34385
34378
  }
34386
34379
  //#endregion
34387
- export { uH as AgentChatWidget, hH as mountAgentChatWidget, yH as mountAgentChatWidgetFromEnvironment };
34380
+ export { lH as AgentChatWidget, mH as mountAgentChatWidget, vH as mountAgentChatWidgetFromEnvironment };
34388
34381
 
34389
34382
  //# sourceMappingURL=agent-widget.js.map