bstp-agent-widget 0.2.4 → 0.2.5

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.
@@ -21263,9 +21263,71 @@ function pD({ config: e, children: t }) {
21263
21263
  children: t
21264
21264
  });
21265
21265
  }
21266
+ var mD = {
21267
+ url: {
21268
+ app: "http://localhost:5173",
21269
+ api: "https://etiyamobile-bss.saas-demo.etycloudbss.com",
21270
+ apiPaths: {
21271
+ crm: "/crm",
21272
+ uiAuthz: "/ui-authz"
21273
+ }
21274
+ },
21275
+ keycloak: {
21276
+ clientId: "csr-frontend",
21277
+ realm: "etiyamobile-prod",
21278
+ url: "https://etiyamobile-eca.saas-demo.etycloudbss.com"
21279
+ },
21280
+ features: { enableThemeManager: !0 },
21281
+ growthBook: {
21282
+ apiHost: "",
21283
+ clientKey: "",
21284
+ enabled: !1
21285
+ },
21286
+ genai: {
21287
+ config: {
21288
+ assistantId: 220,
21289
+ url: "https://cognitus-etiyacell.etiyacloud.com/genai/api/v1",
21290
+ agents: [
21291
+ {
21292
+ assistantKey: "serviceAgent",
21293
+ assistantId: 94,
21294
+ label: "Get help with your service issues",
21295
+ initialMessage: "Hello, my customer id is "
21296
+ },
21297
+ {
21298
+ assistantKey: "salesAgent",
21299
+ assistantId: 220,
21300
+ label: "Explore your usage, upgrades, and add-ons.",
21301
+ initialMessage: "Hello, my customer id is "
21302
+ },
21303
+ {
21304
+ assistantKey: "questionAgent",
21305
+ assistantId: 233,
21306
+ label: "Ask a question",
21307
+ initialMessage: "Hello, my customer id is "
21308
+ }
21309
+ ]
21310
+ },
21311
+ init: {
21312
+ email: "product_management_strategy@etiya.com",
21313
+ clientSecret: "Product123!"
21314
+ }
21315
+ }
21316
+ };
21317
+ //#endregion
21318
+ //#region src/lib/config.service.ts
21319
+ async function hD(e) {
21320
+ let t = `${(globalThis.__BASE_URL__ ?? "").replace(/\/$/, "")}/environment.json`, n = e ?? t;
21321
+ try {
21322
+ let e = await fetch(n);
21323
+ return e.ok ? await e.json() : mD;
21324
+ } catch {
21325
+ return mD;
21326
+ }
21327
+ }
21266
21328
  //#endregion
21267
21329
  //#region src/lib/agent-widget.tsx
21268
- function mD({ config: e, runtime: t }) {
21330
+ function gD({ config: e, runtime: t }) {
21269
21331
  return /* @__PURE__ */ w(pD, {
21270
21332
  config: e,
21271
21333
  children: /* @__PURE__ */ w(fD, {
@@ -21274,17 +21336,17 @@ function mD({ config: e, runtime: t }) {
21274
21336
  })
21275
21337
  });
21276
21338
  }
21277
- var hD = /* @__PURE__ */ new WeakMap();
21278
- function gD(e, t) {
21279
- let n = hD.get(e);
21339
+ var _D = /* @__PURE__ */ new WeakMap();
21340
+ function vD(e, t) {
21341
+ let n = _D.get(e);
21280
21342
  n && n.unmount();
21281
21343
  let r = E(e);
21282
- return r.render(/* @__PURE__ */ w(mD, { ...t })), hD.set(e, r), () => {
21283
- let t = hD.get(e);
21284
- t && (t.unmount(), hD.delete(e));
21344
+ return r.render(/* @__PURE__ */ w(gD, { ...t })), _D.set(e, r), () => {
21345
+ let t = _D.get(e);
21346
+ t && (t.unmount(), _D.delete(e));
21285
21347
  };
21286
21348
  }
21287
- function _D(e) {
21349
+ function yD(e) {
21288
21350
  let t = e.genai?.config;
21289
21351
  if (!t?.url || !t?.assistantId) throw Error("GenAI config is missing in environment.json.");
21290
21352
  return {
@@ -21294,15 +21356,13 @@ function _D(e) {
21294
21356
  genaiInit: e.genai?.init
21295
21357
  };
21296
21358
  }
21297
- async function vD(e, t) {
21298
- let n = t.environmentUrl ?? "/environment.json", r = await fetch(n);
21299
- if (!r.ok) throw Error(`Failed to load environment from ${n}.`);
21300
- return gD(e, {
21301
- config: _D(await r.json()),
21359
+ async function bD(e, t) {
21360
+ return vD(e, {
21361
+ config: yD(await hD(t.environmentUrl)),
21302
21362
  runtime: t.runtime
21303
21363
  });
21304
21364
  }
21305
21365
  //#endregion
21306
- export { mD as AgentChatWidget, gD as mountAgentChatWidget, vD as mountAgentChatWidgetFromEnvironment };
21366
+ export { gD as AgentChatWidget, vD as mountAgentChatWidget, bD as mountAgentChatWidgetFromEnvironment };
21307
21367
 
21308
21368
  //# sourceMappingURL=agent-widget.js.map