bstp-agent-widget 0.2.90 → 0.2.92

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.
@@ -15638,25 +15638,25 @@ var sb = {
15638
15638
  root: "_root_gud67_1",
15639
15639
  resizeHandle: "_resizeHandle_gud67_13"
15640
15640
  }, cb = {
15641
- header: "_header_1w6rh_19",
15642
- headerLeft: "_headerLeft_1w6rh_30",
15643
- headerInfo: "_headerInfo_1w6rh_36",
15644
- orbContainer: "_orbContainer_1w6rh_43",
15645
- orbOuter: "_orbOuter_1w6rh_53",
15646
- orbPulse: "_orbPulse_1w6rh_1",
15647
- orbMiddle: "_orbMiddle_1w6rh_62",
15648
- orbInner: "_orbInner_1w6rh_71",
15649
- orbFloat: "_orbFloat_1w6rh_1",
15650
- headerMeta: "_headerMeta_1w6rh_83",
15651
- statusDot: "_statusDot_1w6rh_89",
15652
- statusText: "_statusText_1w6rh_103",
15653
- closeButton: "_closeButton_1w6rh_111",
15654
- title: "_title_1w6rh_115",
15655
- topSubHeader: "_topSubHeader_1w6rh_124",
15656
- subHeaderLeft: "_subHeaderLeft_1w6rh_134",
15657
- subHeaderIcon: "_subHeaderIcon_1w6rh_140",
15658
- subHeaderTitle: "_subHeaderTitle_1w6rh_151",
15659
- subHeaderStatus: "_subHeaderStatus_1w6rh_157"
15641
+ header: "_header_1q9jc_32",
15642
+ headerLeft: "_headerLeft_1q9jc_43",
15643
+ headerInfo: "_headerInfo_1q9jc_49",
15644
+ orbContainer: "_orbContainer_1q9jc_56",
15645
+ orbOuter: "_orbOuter_1q9jc_66",
15646
+ orbPulse: "_orbPulse_1q9jc_1",
15647
+ orbMiddle: "_orbMiddle_1q9jc_75",
15648
+ orbInner: "_orbInner_1q9jc_84",
15649
+ orbFloat: "_orbFloat_1q9jc_1",
15650
+ headerMeta: "_headerMeta_1q9jc_96",
15651
+ statusDot: "_statusDot_1q9jc_102",
15652
+ statusText: "_statusText_1q9jc_116",
15653
+ closeButton: "_closeButton_1q9jc_124",
15654
+ title: "_title_1q9jc_128",
15655
+ topSubHeader: "_topSubHeader_1q9jc_137",
15656
+ subHeaderLeft: "_subHeaderLeft_1q9jc_147",
15657
+ subHeaderIcon: "_subHeaderIcon_1q9jc_153",
15658
+ subHeaderTitle: "_subHeaderTitle_1q9jc_164",
15659
+ subHeaderStatus: "_subHeaderStatus_1q9jc_170"
15660
15660
  };
15661
15661
  //#endregion
15662
15662
  //#region src/icons/IconAgentOrb.tsx
@@ -20368,6 +20368,7 @@ function $w(e, t) {
20368
20368
  var eT = {
20369
20369
  "brand-dark-blue": Hw,
20370
20370
  "brand-orange": Uw,
20371
+ accent: Uw,
20371
20372
  blue: Ww,
20372
20373
  orange: Gw,
20373
20374
  red: Kw,
@@ -20656,12 +20657,12 @@ function wT({ panelTitle: e, isLoading: t, isOnline: n, onClose: r }) {
20656
20657
  });
20657
20658
  }
20658
20659
  var TT = {
20659
- body: "_body_1bxhf_1",
20660
- messageBubble: "_messageBubble_1bxhf_9",
20661
- messageBubbleUser: "_messageBubbleUser_1bxhf_15",
20662
- messageBubbleAssistant: "_messageBubbleAssistant_1bxhf_20",
20663
- userText: "_userText_1bxhf_26",
20664
- messageList: "_messageList_1bxhf_32"
20660
+ body: "_body_1cocr_1",
20661
+ messageBubble: "_messageBubble_1cocr_9",
20662
+ messageBubbleUser: "_messageBubbleUser_1cocr_15",
20663
+ userText: "_userText_1cocr_20",
20664
+ messageBubbleAssistant: "_messageBubbleAssistant_1cocr_27",
20665
+ messageList: "_messageList_1cocr_33"
20665
20666
  };
20666
20667
  //#endregion
20667
20668
  //#region node_modules/marked/lib/marked.esm.js
@@ -28403,10 +28404,10 @@ function AP(e = {}) {
28403
28404
  };
28404
28405
  }
28405
28406
  var jP = {
28406
- root: "_root_1vfzh_1",
28407
- button: "_button_1vfzh_5",
28408
- icon: "_icon_1vfzh_22",
28409
- label: "_label_1vfzh_28"
28407
+ root: "_root_zqs5y_1",
28408
+ button: "_button_zqs5y_5",
28409
+ icon: "_icon_zqs5y_22",
28410
+ label: "_label_zqs5y_28"
28410
28411
  };
28411
28412
  //#endregion
28412
28413
  //#region src/components/AgentChat/AgentChatFab/AgentChatFab.tsx
@@ -28421,7 +28422,7 @@ function MP({ onClick: e, zIndex: t, position: n, label: r }) {
28421
28422
  l,
28422
28423
  s,
28423
28424
  t
28424
- ]);
28425
+ ]), d = _(() => ({ cursor: c ?? "pointer" }), [c]);
28425
28426
  return /* @__PURE__ */ T("div", {
28426
28427
  className: jP.root,
28427
28428
  style: u,
@@ -28431,7 +28432,7 @@ function MP({ onClick: e, zIndex: t, position: n, label: r }) {
28431
28432
  children: /* @__PURE__ */ E(hc, {
28432
28433
  onClick: e,
28433
28434
  onPointerDown: a,
28434
- style: { cursor: c ?? "pointer" },
28435
+ style: d,
28435
28436
  className: jP.button,
28436
28437
  "aria-label": "Open agent widget",
28437
28438
  children: [/* @__PURE__ */ T("span", {
@@ -33971,7 +33972,8 @@ function YV(e) {
33971
33972
  zIndex: a,
33972
33973
  fabPosition: o,
33973
33974
  fabButtonLabel: e?.fabButtonLabel,
33974
- panelTitle: s
33975
+ panelTitle: s,
33976
+ accentColor: e?.accentColor
33975
33977
  };
33976
33978
  }
33977
33979
  //#endregion
@@ -34175,17 +34177,30 @@ function rH({ config: e, children: t }) {
34175
34177
  });
34176
34178
  }
34177
34179
  //#endregion
34178
- //#region src/lib/agent-widget.tsx
34180
+ //#region src/utils/color-utils.ts
34179
34181
  function iH(e) {
34180
34182
  let t = 0, n = 0, r = 0;
34181
34183
  if (e.startsWith("rgb")) {
34182
34184
  let i = e.match(/\d+/g);
34183
- i && ([t, n, r] = i.map(Number));
34185
+ i && i.length >= 3 && ([t, n, r] = i.slice(0, 3).map(Number));
34184
34186
  } else if (e.startsWith("#")) {
34185
34187
  let i = e.slice(1);
34186
34188
  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));
34187
34189
  }
34190
+ return t = Math.max(0, Math.min(255, t)), n = Math.max(0, Math.min(255, n)), r = Math.max(0, Math.min(255, r)), {
34191
+ r: t,
34192
+ g: n,
34193
+ b: r
34194
+ };
34195
+ }
34196
+ function aH(e, t) {
34197
+ let { r: n, g: r, b: i } = iH(e), a = t / 100;
34198
+ return `rgb(${Math.min(255, n + (255 - n) * a)}, ${Math.min(255, r + (255 - r) * a)}, ${Math.min(255, i + (255 - i) * a)})`;
34199
+ }
34200
+ function oH(e) {
34201
+ let { r: t, g: n, b: r } = iH(e);
34188
34202
  return [
34203
+ `rgb(${t + 50}, ${n + 50}, ${r + 50})`,
34189
34204
  `rgb(${t + 40}, ${n + 40}, ${r + 40})`,
34190
34205
  `rgb(${t + 30}, ${n + 30}, ${r + 30})`,
34191
34206
  `rgb(${t + 20}, ${n + 20}, ${r + 20})`,
@@ -34198,14 +34213,37 @@ function iH(e) {
34198
34213
  `rgb(${t - 50}, ${n - 50}, ${r - 50})`
34199
34214
  ];
34200
34215
  }
34201
- function aH({ config: e, runtime: t, theme: n }) {
34216
+ //#endregion
34217
+ //#region src/hooks/useAccentColor.ts
34218
+ function sH(e) {
34219
+ let t = _(() => {
34220
+ if (e) try {
34221
+ let t = oH(e);
34222
+ if (t && t.length === 11) return nT({
34223
+ colors: { accent: t },
34224
+ primaryColor: "accent"
34225
+ });
34226
+ } catch (e) {
34227
+ console.error("Failed to create theme with accent color:", e);
34228
+ }
34229
+ return rT;
34230
+ }, [e]);
34231
+ return f(() => {
34232
+ try {
34233
+ let t = document.documentElement, n = e || "#35355F", r = aH(n, 10), i = aH(n, 30);
34234
+ t.style.setProperty("--agent-accent-color", n), t.style.setProperty("--agent-accent-color-light", aH(n, 20)), t.style.setProperty("--agent-accent-bg", r), t.style.setProperty("--agent-accent-bg-light", i), 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)");
34235
+ } catch (e) {
34236
+ console.error("Failed to set accent color CSS properties:", e);
34237
+ }
34238
+ }, [e]), t;
34239
+ }
34240
+ //#endregion
34241
+ //#region src/lib/agent-widget.tsx
34242
+ function cH({ config: e, runtime: t, theme: n }) {
34202
34243
  return pI.locale || pI.activate("en"), /* @__PURE__ */ T(HO, {
34203
34244
  i18n: pI,
34204
34245
  children: /* @__PURE__ */ T(Gn, {
34205
- theme: _(() => n?.accentColor ? nT({
34206
- colors: { accent: iH(n.accentColor) },
34207
- primaryColor: "accent"
34208
- }) : rT, [n?.accentColor]),
34246
+ theme: sH(n?.accentColor),
34209
34247
  defaultColorScheme: "auto",
34210
34248
  children: /* @__PURE__ */ T(qL, {
34211
34249
  client: pV,
@@ -34213,7 +34251,7 @@ function aH({ config: e, runtime: t, theme: n }) {
34213
34251
  config: e,
34214
34252
  children: /* @__PURE__ */ T(nH, {
34215
34253
  runtime: t,
34216
- children: /* @__PURE__ */ T(tH, { ui: n })
34254
+ children: /* @__PURE__ */ T(tH, { ...n ?? {} })
34217
34255
  })
34218
34256
  })
34219
34257
  })
@@ -34222,7 +34260,7 @@ function aH({ config: e, runtime: t, theme: n }) {
34222
34260
  }
34223
34261
  //#endregion
34224
34262
  //#region src/lib/config.service.ts
34225
- var oH = {
34263
+ var lH = {
34226
34264
  url: {
34227
34265
  app: "http://localhost:4201",
34228
34266
  api: "https://cognitus-etiyacell.etiyacloud.com",
@@ -34269,8 +34307,8 @@ var oH = {
34269
34307
  }
34270
34308
  }
34271
34309
  };
34272
- function sH(e) {
34273
- let t = oH.genai?.init;
34310
+ function uH(e) {
34311
+ let t = lH.genai?.init;
34274
34312
  return !t || e.genai?.init ? e : {
34275
34313
  ...e,
34276
34314
  genai: {
@@ -34279,33 +34317,33 @@ function sH(e) {
34279
34317
  }
34280
34318
  };
34281
34319
  }
34282
- async function cH(e) {
34320
+ async function dH(e) {
34283
34321
  let t = `${(globalThis.__BASE_URL__ ?? "").replace(/\/$/, "")}/environment.json`, n = e ?? t;
34284
34322
  try {
34285
34323
  let e = await fetch(n);
34286
- return e.ok ? sH(await e.json()) : oH;
34324
+ return e.ok ? uH(await e.json()) : lH;
34287
34325
  } catch {
34288
- return oH;
34326
+ return lH;
34289
34327
  }
34290
34328
  }
34291
34329
  //#endregion
34292
34330
  //#region src/lib/mount-widget.tsx
34293
- var lH = /* @__PURE__ */ new WeakMap();
34294
- async function uH(e, t, n) {
34331
+ var fH = /* @__PURE__ */ new WeakMap();
34332
+ async function pH(e, t, n) {
34295
34333
  try {
34296
- bV(await cH(n?.environmentUrl));
34334
+ bV(await dH(n?.environmentUrl));
34297
34335
  } catch (e) {
34298
34336
  throw console.error("Failed to initialize agent widget rest services:", e), e;
34299
34337
  }
34300
- let r = lH.get(e);
34338
+ let r = fH.get(e);
34301
34339
  r && r.unmount();
34302
34340
  let i = D(e);
34303
- return i.render(/* @__PURE__ */ T(aH, { ...t })), lH.set(e, i), () => {
34304
- let t = lH.get(e);
34305
- t && (t.unmount(), lH.delete(e));
34341
+ return i.render(/* @__PURE__ */ T(cH, { ...t })), fH.set(e, i), () => {
34342
+ let t = fH.get(e);
34343
+ t && (t.unmount(), fH.delete(e));
34306
34344
  };
34307
34345
  }
34308
- function dH(e) {
34346
+ function mH(e) {
34309
34347
  let t = e.genai?.config;
34310
34348
  if (!t?.assistantId) throw Error("GenAI config is missing in environment.json.");
34311
34349
  return {
@@ -34313,24 +34351,24 @@ function dH(e) {
34313
34351
  agents: t.agents
34314
34352
  };
34315
34353
  }
34316
- function fH(e, t) {
34354
+ function hH(e, t) {
34317
34355
  return t ? {
34318
34356
  assistantId: t.assistantId ?? e.assistantId,
34319
34357
  agents: t.agents ?? e.agents
34320
34358
  } : e;
34321
34359
  }
34322
- function pH(e, t) {
34360
+ function gH(e, t) {
34323
34361
  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;
34324
34362
  }
34325
- async function mH(e, t) {
34326
- let n = pH(await cH(t.environmentUrl), t.config);
34327
- return bV(n), uH(e, {
34328
- config: fH(dH(n), t.config),
34363
+ async function _H(e, t) {
34364
+ let n = gH(await dH(t.environmentUrl), t.config);
34365
+ return bV(n), pH(e, {
34366
+ config: hH(mH(n), t.config),
34329
34367
  runtime: t.runtime,
34330
34368
  theme: t.theme
34331
34369
  });
34332
34370
  }
34333
34371
  //#endregion
34334
- export { aH as AgentChatWidget, uH as mountAgentChatWidget, mH as mountAgentChatWidgetFromEnvironment };
34372
+ export { cH as AgentChatWidget, pH as mountAgentChatWidget, _H as mountAgentChatWidgetFromEnvironment };
34335
34373
 
34336
34374
  //# sourceMappingURL=agent-widget.js.map