bstp-agent-widget 0.2.91 → 0.2.93

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_k8anj_25",
15642
+ headerLeft: "_headerLeft_k8anj_36",
15643
+ headerInfo: "_headerInfo_k8anj_42",
15644
+ orbContainer: "_orbContainer_k8anj_49",
15645
+ orbOuter: "_orbOuter_k8anj_59",
15646
+ orbPulse: "_orbPulse_k8anj_1",
15647
+ orbMiddle: "_orbMiddle_k8anj_68",
15648
+ orbInner: "_orbInner_k8anj_77",
15649
+ orbFloat: "_orbFloat_k8anj_1",
15650
+ headerMeta: "_headerMeta_k8anj_89",
15651
+ statusDot: "_statusDot_k8anj_95",
15652
+ statusText: "_statusText_k8anj_109",
15653
+ closeButton: "_closeButton_k8anj_117",
15654
+ title: "_title_k8anj_121",
15655
+ topSubHeader: "_topSubHeader_k8anj_130",
15656
+ subHeaderLeft: "_subHeaderLeft_k8anj_140",
15657
+ subHeaderIcon: "_subHeaderIcon_k8anj_146",
15658
+ subHeaderTitle: "_subHeaderTitle_k8anj_157",
15659
+ subHeaderStatus: "_subHeaderStatus_k8anj_163"
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_qciga_1",
20661
+ messageBubble: "_messageBubble_qciga_9",
20662
+ messageBubbleUser: "_messageBubbleUser_qciga_15",
20663
+ userText: "_userText_qciga_20",
20664
+ messageBubbleAssistant: "_messageBubbleAssistant_qciga_27",
20665
+ messageList: "_messageList_qciga_33"
20665
20666
  };
20666
20667
  //#endregion
20667
20668
  //#region node_modules/marked/lib/marked.esm.js
@@ -28187,10 +28188,11 @@ function SP({ messages: e, isLoading: t, error: n, scrollViewportRef: r, onWidge
28187
28188
  });
28188
28189
  }
28189
28190
  var CP = {
28190
- footer: "_footer_16fk7_1",
28191
- inputWrapper: "_inputWrapper_16fk7_10",
28192
- actionGroup: "_actionGroup_16fk7_15",
28193
- poweredBy: "_poweredBy_16fk7_22"
28191
+ footer: "_footer_jvnzh_1",
28192
+ inputWrapper: "_inputWrapper_jvnzh_10",
28193
+ actionGroup: "_actionGroup_jvnzh_15",
28194
+ poweredBy: "_poweredBy_jvnzh_22",
28195
+ sendButton: "_sendButton_jvnzh_27"
28194
28196
  };
28195
28197
  //#endregion
28196
28198
  //#region src/icons/IconSend.tsx
@@ -28236,6 +28238,7 @@ function TP({ composerText: e, onComposerTextChange: t, isLoading: n, isListenin
28236
28238
  size: 32,
28237
28239
  radius: "xl",
28238
28240
  variant: "filled",
28241
+ className: CP.sendButton,
28239
28242
  children: /* @__PURE__ */ T(wP, {
28240
28243
  width: c.other.iconSize["icon-md"],
28241
28244
  height: c.other.iconSize["icon-md"]
@@ -28403,52 +28406,42 @@ function AP(e = {}) {
28403
28406
  };
28404
28407
  }
28405
28408
  var jP = {
28406
- root: "_root_1eel0_1",
28407
- button: "_button_1eel0_5",
28408
- icon: "_icon_1eel0_21",
28409
- label: "_label_1eel0_27"
28409
+ root: "_root_zqs5y_1",
28410
+ button: "_button_zqs5y_5",
28411
+ icon: "_icon_zqs5y_22",
28412
+ label: "_label_zqs5y_28"
28410
28413
  };
28411
28414
  //#endregion
28412
28415
  //#region src/components/AgentChat/AgentChatFab/AgentChatFab.tsx
28413
- function MP({ onClick: e, zIndex: t, position: n, label: r, accentColor: i }) {
28414
- let a = CT(), o = An(), { handlePointerDown: s, style: c } = AP({ skipSelector: "" }), { transform: l, cursor: u, touchAction: d } = c, f = _(() => ({
28415
- transform: l,
28416
- touchAction: d,
28416
+ function MP({ onClick: e, zIndex: t, position: n, label: r }) {
28417
+ let i = CT(), { handlePointerDown: a, style: o } = AP({ skipSelector: "" }), { transform: s, cursor: c, touchAction: l } = o, u = _(() => ({
28418
+ transform: s,
28419
+ touchAction: l,
28417
28420
  zIndex: t,
28418
28421
  ...n
28419
28422
  }), [
28420
28423
  n,
28421
- d,
28422
28424
  l,
28425
+ s,
28423
28426
  t
28424
- ]), p = _(() => {
28425
- let e = i || o.colors.primary[4];
28426
- return {
28427
- cursor: u ?? "pointer",
28428
- background: `linear-gradient(135deg, ${o.colors.primary[5]}, ${e})`
28429
- };
28430
- }, [
28431
- u,
28432
- i,
28433
- o.colors.primary
28434
- ]);
28427
+ ]), d = _(() => ({ cursor: c ?? "pointer" }), [c]);
28435
28428
  return /* @__PURE__ */ T("div", {
28436
28429
  className: jP.root,
28437
- style: f,
28430
+ style: u,
28438
28431
  children: /* @__PURE__ */ T(xv, {
28439
28432
  label: "Open agent widget",
28440
28433
  position: "left",
28441
28434
  children: /* @__PURE__ */ E(hc, {
28442
28435
  onClick: e,
28443
- onPointerDown: s,
28444
- style: p,
28436
+ onPointerDown: a,
28437
+ style: d,
28445
28438
  className: jP.button,
28446
28439
  "aria-label": "Open agent widget",
28447
28440
  children: [/* @__PURE__ */ T("span", {
28448
28441
  className: jP.icon,
28449
28442
  children: /* @__PURE__ */ T(DP, {
28450
- width: a.other.iconSize["icon-md"],
28451
- height: a.other.iconSize["icon-md"]
28443
+ width: i.other.iconSize["icon-md"],
28444
+ height: i.other.iconSize["icon-md"]
28452
28445
  })
28453
28446
  }), /* @__PURE__ */ T("span", {
28454
28447
  className: jP.label,
@@ -34116,10 +34109,77 @@ function eH({ isListening: e, stopListening: t, reset: n, sendMessage: r, compos
34116
34109
  };
34117
34110
  }
34118
34111
  //#endregion
34119
- //#region src/features/agent-chat/components/AgentChatLauncher/AgentChatLauncher.tsx
34112
+ //#region src/utils/color-utils.ts
34120
34113
  function tH(e) {
34114
+ let t = 0, n = 0, r = 0;
34115
+ if (e.startsWith("rgb")) {
34116
+ let i = e.match(/\d+/g);
34117
+ i && i.length >= 3 && ([t, n, r] = i.slice(0, 3).map(Number));
34118
+ } else if (e.startsWith("#")) {
34119
+ let i = e.slice(1);
34120
+ 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));
34121
+ }
34122
+ 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)), {
34123
+ r: t,
34124
+ g: n,
34125
+ b: r
34126
+ };
34127
+ }
34128
+ function nH(e, t) {
34129
+ let { r: n, g: r, b: i } = tH(e), a = t / 100;
34130
+ return `rgb(${Math.min(255, n + (255 - n) * a)}, ${Math.min(255, r + (255 - r) * a)}, ${Math.min(255, i + (255 - i) * a)})`;
34131
+ }
34132
+ function rH(e, t) {
34133
+ let { r: n, g: r, b: i } = tH(e), a = t / 100;
34134
+ return `rgb(${Math.max(0, n - n * a)}, ${Math.max(0, r - r * a)}, ${Math.max(0, i - i * a)})`;
34135
+ }
34136
+ function iH(e) {
34137
+ let { r: t, g: n, b: r } = tH(e);
34138
+ return [
34139
+ `rgb(${t + 50}, ${n + 50}, ${r + 50})`,
34140
+ `rgb(${t + 40}, ${n + 40}, ${r + 40})`,
34141
+ `rgb(${t + 30}, ${n + 30}, ${r + 30})`,
34142
+ `rgb(${t + 20}, ${n + 20}, ${r + 20})`,
34143
+ `rgb(${t + 10}, ${n + 10}, ${r + 10})`,
34144
+ e,
34145
+ `rgb(${t - 10}, ${n - 10}, ${r - 10})`,
34146
+ `rgb(${t - 20}, ${n - 20}, ${r - 20})`,
34147
+ `rgb(${t - 30}, ${n - 30}, ${r - 30})`,
34148
+ `rgb(${t - 40}, ${n - 40}, ${r - 40})`,
34149
+ `rgb(${t - 50}, ${n - 50}, ${r - 50})`
34150
+ ];
34151
+ }
34152
+ //#endregion
34153
+ //#region src/hooks/useAccentColor.ts
34154
+ function aH(e) {
34155
+ let t = An(), n = _(() => {
34156
+ if (e) try {
34157
+ let t = iH(e);
34158
+ if (t && t.length === 11) return nT({
34159
+ colors: { accent: t },
34160
+ primaryColor: "accent"
34161
+ });
34162
+ } catch (e) {
34163
+ console.error("Failed to create theme with accent color:", e);
34164
+ }
34165
+ return rT;
34166
+ }, [e]);
34167
+ return f(() => {
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");
34171
+ } catch (e) {
34172
+ console.error("Failed to set accent color CSS properties:", e);
34173
+ }
34174
+ }, [e, t]), n;
34175
+ }
34176
+ //#endregion
34177
+ //#region src/features/agent-chat/components/AgentChatLauncher/AgentChatLauncher.tsx
34178
+ function oH(e) {
34121
34179
  GV();
34122
- let { panelWidth: t, panelHeight: n, panelHeaderHeight: r, panelTopOffset: i, zIndex: a, fabPosition: o, fabButtonLabel: s, panelTitle: c, accentColor: l } = YV(e), u = v(!1), { messages: d, composerText: f, setComposerText: p, isLoading: m, error: h, sendMessage: g, sendInitialMessage: _, canSend: y } = kV(), { actions: b, handleActionClick: x } = XV(d, g), { runtimeInfo: S, refreshRuntimeInfo: C } = AV(), { isOpen: D, open: O, close: k } = KV({
34180
+ let { panelWidth: t, panelHeight: n, panelHeaderHeight: r, panelTopOffset: i, zIndex: a, fabPosition: o, fabButtonLabel: s, panelTitle: c, accentColor: l } = YV(e);
34181
+ aH(l);
34182
+ let u = v(!1), { messages: d, composerText: f, setComposerText: p, isLoading: m, error: h, sendMessage: g, sendInitialMessage: _, canSend: y } = kV(), { actions: b, handleActionClick: x } = XV(d, g), { runtimeInfo: S, refreshRuntimeInfo: C } = AV(), { isOpen: D, open: O, close: k } = KV({
34123
34183
  defaultOpen: !1,
34124
34184
  persist: !0,
34125
34185
  onOpen: async () => {
@@ -34144,8 +34204,7 @@ function tH(e) {
34144
34204
  onClick: () => void O(),
34145
34205
  zIndex: a,
34146
34206
  position: o,
34147
- label: s,
34148
- accentColor: l
34207
+ label: s
34149
34208
  }), D && /* @__PURE__ */ T(EP, {
34150
34209
  visible: !0,
34151
34210
  onClose: L,
@@ -34174,13 +34233,13 @@ function tH(e) {
34174
34233
  }
34175
34234
  //#endregion
34176
34235
  //#region src/providers/AgentChatProviders.tsx
34177
- function nH({ runtime: e, children: t }) {
34236
+ function sH({ runtime: e, children: t }) {
34178
34237
  return /* @__PURE__ */ T(GP.Provider, {
34179
34238
  value: e,
34180
34239
  children: t
34181
34240
  });
34182
34241
  }
34183
- function rH({ config: e, children: t }) {
34242
+ function cH({ config: e, children: t }) {
34184
34243
  return /* @__PURE__ */ T(qP.Provider, {
34185
34244
  value: e,
34186
34245
  children: t
@@ -34188,44 +34247,19 @@ function rH({ config: e, children: t }) {
34188
34247
  }
34189
34248
  //#endregion
34190
34249
  //#region src/lib/agent-widget.tsx
34191
- function iH(e) {
34192
- let t = 0, n = 0, r = 0;
34193
- if (e.startsWith("rgb")) {
34194
- let i = e.match(/\d+/g);
34195
- i && ([t, n, r] = i.map(Number));
34196
- } else if (e.startsWith("#")) {
34197
- let i = e.slice(1);
34198
- 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));
34199
- }
34200
- return [
34201
- `rgb(${t + 40}, ${n + 40}, ${r + 40})`,
34202
- `rgb(${t + 30}, ${n + 30}, ${r + 30})`,
34203
- `rgb(${t + 20}, ${n + 20}, ${r + 20})`,
34204
- `rgb(${t + 10}, ${n + 10}, ${r + 10})`,
34205
- e,
34206
- `rgb(${t - 10}, ${n - 10}, ${r - 10})`,
34207
- `rgb(${t - 20}, ${n - 20}, ${r - 20})`,
34208
- `rgb(${t - 30}, ${n - 30}, ${r - 30})`,
34209
- `rgb(${t - 40}, ${n - 40}, ${r - 40})`,
34210
- `rgb(${t - 50}, ${n - 50}, ${r - 50})`
34211
- ];
34212
- }
34213
- function aH({ config: e, runtime: t, theme: n }) {
34250
+ function lH({ config: e, runtime: t, theme: n }) {
34214
34251
  return pI.locale || pI.activate("en"), /* @__PURE__ */ T(HO, {
34215
34252
  i18n: pI,
34216
34253
  children: /* @__PURE__ */ T(Gn, {
34217
- theme: _(() => n?.accentColor ? nT({
34218
- colors: { accent: iH(n.accentColor) },
34219
- primaryColor: "accent"
34220
- }) : rT, [n?.accentColor]),
34254
+ theme: aH(n?.accentColor),
34221
34255
  defaultColorScheme: "auto",
34222
34256
  children: /* @__PURE__ */ T(qL, {
34223
34257
  client: pV,
34224
- children: /* @__PURE__ */ T(rH, {
34258
+ children: /* @__PURE__ */ T(cH, {
34225
34259
  config: e,
34226
- children: /* @__PURE__ */ T(nH, {
34260
+ children: /* @__PURE__ */ T(sH, {
34227
34261
  runtime: t,
34228
- children: /* @__PURE__ */ T(tH, { ui: n })
34262
+ children: /* @__PURE__ */ T(oH, { ...n ?? {} })
34229
34263
  })
34230
34264
  })
34231
34265
  })
@@ -34234,7 +34268,7 @@ function aH({ config: e, runtime: t, theme: n }) {
34234
34268
  }
34235
34269
  //#endregion
34236
34270
  //#region src/lib/config.service.ts
34237
- var oH = {
34271
+ var uH = {
34238
34272
  url: {
34239
34273
  app: "http://localhost:4201",
34240
34274
  api: "https://cognitus-etiyacell.etiyacloud.com",
@@ -34281,8 +34315,8 @@ var oH = {
34281
34315
  }
34282
34316
  }
34283
34317
  };
34284
- function sH(e) {
34285
- let t = oH.genai?.init;
34318
+ function dH(e) {
34319
+ let t = uH.genai?.init;
34286
34320
  return !t || e.genai?.init ? e : {
34287
34321
  ...e,
34288
34322
  genai: {
@@ -34291,33 +34325,33 @@ function sH(e) {
34291
34325
  }
34292
34326
  };
34293
34327
  }
34294
- async function cH(e) {
34328
+ async function fH(e) {
34295
34329
  let t = `${(globalThis.__BASE_URL__ ?? "").replace(/\/$/, "")}/environment.json`, n = e ?? t;
34296
34330
  try {
34297
34331
  let e = await fetch(n);
34298
- return e.ok ? sH(await e.json()) : oH;
34332
+ return e.ok ? dH(await e.json()) : uH;
34299
34333
  } catch {
34300
- return oH;
34334
+ return uH;
34301
34335
  }
34302
34336
  }
34303
34337
  //#endregion
34304
34338
  //#region src/lib/mount-widget.tsx
34305
- var lH = /* @__PURE__ */ new WeakMap();
34306
- async function uH(e, t, n) {
34339
+ var pH = /* @__PURE__ */ new WeakMap();
34340
+ async function mH(e, t, n) {
34307
34341
  try {
34308
- bV(await cH(n?.environmentUrl));
34342
+ bV(await fH(n?.environmentUrl));
34309
34343
  } catch (e) {
34310
34344
  throw console.error("Failed to initialize agent widget rest services:", e), e;
34311
34345
  }
34312
- let r = lH.get(e);
34346
+ let r = pH.get(e);
34313
34347
  r && r.unmount();
34314
34348
  let i = D(e);
34315
- return i.render(/* @__PURE__ */ T(aH, { ...t })), lH.set(e, i), () => {
34316
- let t = lH.get(e);
34317
- t && (t.unmount(), lH.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));
34318
34352
  };
34319
34353
  }
34320
- function dH(e) {
34354
+ function hH(e) {
34321
34355
  let t = e.genai?.config;
34322
34356
  if (!t?.assistantId) throw Error("GenAI config is missing in environment.json.");
34323
34357
  return {
@@ -34325,24 +34359,24 @@ function dH(e) {
34325
34359
  agents: t.agents
34326
34360
  };
34327
34361
  }
34328
- function fH(e, t) {
34362
+ function gH(e, t) {
34329
34363
  return t ? {
34330
34364
  assistantId: t.assistantId ?? e.assistantId,
34331
34365
  agents: t.agents ?? e.agents
34332
34366
  } : e;
34333
34367
  }
34334
- function pH(e, t) {
34368
+ function _H(e, t) {
34335
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;
34336
34370
  }
34337
- async function mH(e, t) {
34338
- let n = pH(await cH(t.environmentUrl), t.config);
34339
- return bV(n), uH(e, {
34340
- config: fH(dH(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),
34341
34375
  runtime: t.runtime,
34342
34376
  theme: t.theme
34343
34377
  });
34344
34378
  }
34345
34379
  //#endregion
34346
- export { aH as AgentChatWidget, uH as mountAgentChatWidget, mH as mountAgentChatWidgetFromEnvironment };
34380
+ export { lH as AgentChatWidget, mH as mountAgentChatWidget, vH as mountAgentChatWidgetFromEnvironment };
34347
34381
 
34348
34382
  //# sourceMappingURL=agent-widget.js.map