bstp-agent-widget 0.2.93 → 0.2.95

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.
@@ -34248,27 +34248,34 @@ 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 pI.locale || pI.activate("en"), /* @__PURE__ */ T(HO, {
34252
- i18n: pI,
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
- })
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 ?? {} })
34264
34261
  })
34265
34262
  })
34266
34263
  })
34267
34264
  });
34268
34265
  }
34266
+ function uH({ config: e, runtime: t, theme: n }) {
34267
+ return pI.locale || pI.activate("en"), /* @__PURE__ */ T(HO, {
34268
+ i18n: pI,
34269
+ children: /* @__PURE__ */ T(lH, {
34270
+ config: e,
34271
+ runtime: t,
34272
+ theme: n
34273
+ })
34274
+ });
34275
+ }
34269
34276
  //#endregion
34270
34277
  //#region src/lib/config.service.ts
34271
- var uH = {
34278
+ var dH = {
34272
34279
  url: {
34273
34280
  app: "http://localhost:4201",
34274
34281
  api: "https://cognitus-etiyacell.etiyacloud.com",
@@ -34315,8 +34322,8 @@ var uH = {
34315
34322
  }
34316
34323
  }
34317
34324
  };
34318
- function dH(e) {
34319
- let t = uH.genai?.init;
34325
+ function fH(e) {
34326
+ let t = dH.genai?.init;
34320
34327
  return !t || e.genai?.init ? e : {
34321
34328
  ...e,
34322
34329
  genai: {
@@ -34325,33 +34332,33 @@ function dH(e) {
34325
34332
  }
34326
34333
  };
34327
34334
  }
34328
- async function fH(e) {
34335
+ async function pH(e) {
34329
34336
  let t = `${(globalThis.__BASE_URL__ ?? "").replace(/\/$/, "")}/environment.json`, n = e ?? t;
34330
34337
  try {
34331
34338
  let e = await fetch(n);
34332
- return e.ok ? dH(await e.json()) : uH;
34339
+ return e.ok ? fH(await e.json()) : dH;
34333
34340
  } catch {
34334
- return uH;
34341
+ return dH;
34335
34342
  }
34336
34343
  }
34337
34344
  //#endregion
34338
34345
  //#region src/lib/mount-widget.tsx
34339
- var pH = /* @__PURE__ */ new WeakMap();
34340
- async function mH(e, t, n) {
34346
+ var mH = /* @__PURE__ */ new WeakMap();
34347
+ async function hH(e, t, n) {
34341
34348
  try {
34342
- bV(await fH(n?.environmentUrl));
34349
+ bV(await pH(n?.environmentUrl));
34343
34350
  } catch (e) {
34344
34351
  throw console.error("Failed to initialize agent widget rest services:", e), e;
34345
34352
  }
34346
- let r = pH.get(e);
34353
+ let r = mH.get(e);
34347
34354
  r && r.unmount();
34348
34355
  let i = D(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));
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));
34352
34359
  };
34353
34360
  }
34354
- function hH(e) {
34361
+ function gH(e) {
34355
34362
  let t = e.genai?.config;
34356
34363
  if (!t?.assistantId) throw Error("GenAI config is missing in environment.json.");
34357
34364
  return {
@@ -34359,24 +34366,24 @@ function hH(e) {
34359
34366
  agents: t.agents
34360
34367
  };
34361
34368
  }
34362
- function gH(e, t) {
34369
+ function _H(e, t) {
34363
34370
  return t ? {
34364
34371
  assistantId: t.assistantId ?? e.assistantId,
34365
34372
  agents: t.agents ?? e.agents
34366
34373
  } : e;
34367
34374
  }
34368
- function _H(e, t) {
34375
+ function vH(e, t) {
34369
34376
  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;
34370
34377
  }
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),
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),
34375
34382
  runtime: t.runtime,
34376
34383
  theme: t.theme
34377
34384
  });
34378
34385
  }
34379
34386
  //#endregion
34380
- export { lH as AgentChatWidget, mH as mountAgentChatWidget, vH as mountAgentChatWidgetFromEnvironment };
34387
+ export { uH as AgentChatWidget, hH as mountAgentChatWidget, yH as mountAgentChatWidgetFromEnvironment };
34381
34388
 
34382
34389
  //# sourceMappingURL=agent-widget.js.map