bstp-agent-widget 0.2.91 → 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,52 +28404,42 @@ function AP(e = {}) {
28403
28404
  };
28404
28405
  }
28405
28406
  var jP = {
28406
- root: "_root_1eel0_1",
28407
- button: "_button_1eel0_5",
28408
- icon: "_icon_1eel0_21",
28409
- label: "_label_1eel0_27"
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
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,
28414
+ function MP({ onClick: e, zIndex: t, position: n, label: r }) {
28415
+ let i = CT(), { handlePointerDown: a, style: o } = AP({ skipSelector: "" }), { transform: s, cursor: c, touchAction: l } = o, u = _(() => ({
28416
+ transform: s,
28417
+ touchAction: l,
28417
28418
  zIndex: t,
28418
28419
  ...n
28419
28420
  }), [
28420
28421
  n,
28421
- d,
28422
28422
  l,
28423
+ s,
28423
28424
  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
- ]);
28425
+ ]), d = _(() => ({ cursor: c ?? "pointer" }), [c]);
28435
28426
  return /* @__PURE__ */ T("div", {
28436
28427
  className: jP.root,
28437
- style: f,
28428
+ style: u,
28438
28429
  children: /* @__PURE__ */ T(xv, {
28439
28430
  label: "Open agent widget",
28440
28431
  position: "left",
28441
28432
  children: /* @__PURE__ */ E(hc, {
28442
28433
  onClick: e,
28443
- onPointerDown: s,
28444
- style: p,
28434
+ onPointerDown: a,
28435
+ style: d,
28445
28436
  className: jP.button,
28446
28437
  "aria-label": "Open agent widget",
28447
28438
  children: [/* @__PURE__ */ T("span", {
28448
28439
  className: jP.icon,
28449
28440
  children: /* @__PURE__ */ T(DP, {
28450
- width: a.other.iconSize["icon-md"],
28451
- height: a.other.iconSize["icon-md"]
28441
+ width: i.other.iconSize["icon-md"],
28442
+ height: i.other.iconSize["icon-md"]
28452
28443
  })
28453
28444
  }), /* @__PURE__ */ T("span", {
28454
28445
  className: jP.label,
@@ -34119,55 +34110,54 @@ function eH({ isListening: e, stopListening: t, reset: n, sendMessage: r, compos
34119
34110
  //#region src/features/agent-chat/components/AgentChatLauncher/AgentChatLauncher.tsx
34120
34111
  function tH(e) {
34121
34112
  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({
34113
+ let { panelWidth: t, panelHeight: n, panelHeaderHeight: r, panelTopOffset: i, zIndex: a, fabPosition: o, fabButtonLabel: s, panelTitle: c } = YV(e), l = v(!1), { messages: u, composerText: d, setComposerText: f, isLoading: p, error: m, sendMessage: h, sendInitialMessage: g, canSend: _ } = kV(), { actions: y, handleActionClick: b } = XV(u, h), { runtimeInfo: x, refreshRuntimeInfo: S } = AV(), { isOpen: C, open: D, close: O } = KV({
34123
34114
  defaultOpen: !1,
34124
34115
  persist: !0,
34125
34116
  onOpen: async () => {
34126
- u.current || (u.current = !0, await C(), await _());
34117
+ l.current || (l.current = !0, await S(), await g());
34127
34118
  }
34128
- }), A = MV([d.length, m]), { isListening: j, isSupported: M, startListening: N, stopListening: P, reset: F } = NV({
34119
+ }), k = MV([u.length, p]), { isListening: A, isSupported: j, startListening: M, stopListening: N, reset: P } = NV({
34129
34120
  lang: PV(),
34130
34121
  continuous: !0,
34131
34122
  pauseOnSubmit: !0,
34132
- onTextChange: p
34133
- }), { panelResizableWidth: ee } = $V(e, t, D), { handleSubmit: te, handleToggleVoice: I, handleClose: L } = eH({
34134
- isListening: j,
34135
- stopListening: P,
34136
- reset: F,
34137
- sendMessage: g,
34138
- composerText: f,
34139
- setComposerText: p,
34140
- startListening: N,
34141
- close: k
34142
- });
34143
- return /* @__PURE__ */ E(w, { children: [!D && /* @__PURE__ */ T(MP, {
34144
- onClick: () => void O(),
34123
+ onTextChange: f
34124
+ }), { panelResizableWidth: F } = $V(e, t, C), { handleSubmit: ee, handleToggleVoice: te, handleClose: I } = eH({
34125
+ isListening: A,
34126
+ stopListening: N,
34127
+ reset: P,
34128
+ sendMessage: h,
34129
+ composerText: d,
34130
+ setComposerText: f,
34131
+ startListening: M,
34132
+ close: O
34133
+ });
34134
+ return /* @__PURE__ */ E(w, { children: [!C && /* @__PURE__ */ T(MP, {
34135
+ onClick: () => void D(),
34145
34136
  zIndex: a,
34146
34137
  position: o,
34147
- label: s,
34148
- accentColor: l
34149
- }), D && /* @__PURE__ */ T(EP, {
34138
+ label: s
34139
+ }), C && /* @__PURE__ */ T(EP, {
34150
34140
  visible: !0,
34151
- onClose: L,
34152
- messages: d,
34153
- composerText: f,
34154
- onComposerTextChange: p,
34155
- isLoading: m,
34156
- error: h,
34157
- canSend: y,
34158
- onSubmit: te,
34159
- actions: b,
34160
- onActionClick: x,
34161
- isListening: j,
34162
- isVoiceSupported: M,
34163
- onToggleVoice: I,
34141
+ onClose: I,
34142
+ messages: u,
34143
+ composerText: d,
34144
+ onComposerTextChange: f,
34145
+ isLoading: p,
34146
+ error: m,
34147
+ canSend: _,
34148
+ onSubmit: ee,
34149
+ actions: y,
34150
+ onActionClick: b,
34151
+ isListening: A,
34152
+ isVoiceSupported: j,
34153
+ onToggleVoice: te,
34164
34154
  panelTitle: c,
34165
- runtimeInfo: S,
34166
- scrollViewportRef: A,
34155
+ runtimeInfo: x,
34156
+ scrollViewportRef: k,
34167
34157
  panelWidth: t,
34168
34158
  panelHeight: n,
34169
34159
  panelHeaderHeight: r,
34170
- panelResizableWidth: ee,
34160
+ panelResizableWidth: F,
34171
34161
  zIndex: a,
34172
34162
  panelTopOffset: i
34173
34163
  })] });
@@ -34187,17 +34177,30 @@ function rH({ config: e, children: t }) {
34187
34177
  });
34188
34178
  }
34189
34179
  //#endregion
34190
- //#region src/lib/agent-widget.tsx
34180
+ //#region src/utils/color-utils.ts
34191
34181
  function iH(e) {
34192
34182
  let t = 0, n = 0, r = 0;
34193
34183
  if (e.startsWith("rgb")) {
34194
34184
  let i = e.match(/\d+/g);
34195
- i && ([t, n, r] = i.map(Number));
34185
+ i && i.length >= 3 && ([t, n, r] = i.slice(0, 3).map(Number));
34196
34186
  } else if (e.startsWith("#")) {
34197
34187
  let i = e.slice(1);
34198
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));
34199
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);
34200
34202
  return [
34203
+ `rgb(${t + 50}, ${n + 50}, ${r + 50})`,
34201
34204
  `rgb(${t + 40}, ${n + 40}, ${r + 40})`,
34202
34205
  `rgb(${t + 30}, ${n + 30}, ${r + 30})`,
34203
34206
  `rgb(${t + 20}, ${n + 20}, ${r + 20})`,
@@ -34210,14 +34213,37 @@ function iH(e) {
34210
34213
  `rgb(${t - 50}, ${n - 50}, ${r - 50})`
34211
34214
  ];
34212
34215
  }
34213
- 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 }) {
34214
34243
  return pI.locale || pI.activate("en"), /* @__PURE__ */ T(HO, {
34215
34244
  i18n: pI,
34216
34245
  children: /* @__PURE__ */ T(Gn, {
34217
- theme: _(() => n?.accentColor ? nT({
34218
- colors: { accent: iH(n.accentColor) },
34219
- primaryColor: "accent"
34220
- }) : rT, [n?.accentColor]),
34246
+ theme: sH(n?.accentColor),
34221
34247
  defaultColorScheme: "auto",
34222
34248
  children: /* @__PURE__ */ T(qL, {
34223
34249
  client: pV,
@@ -34225,7 +34251,7 @@ function aH({ config: e, runtime: t, theme: n }) {
34225
34251
  config: e,
34226
34252
  children: /* @__PURE__ */ T(nH, {
34227
34253
  runtime: t,
34228
- children: /* @__PURE__ */ T(tH, { ui: n })
34254
+ children: /* @__PURE__ */ T(tH, { ...n ?? {} })
34229
34255
  })
34230
34256
  })
34231
34257
  })
@@ -34234,7 +34260,7 @@ function aH({ config: e, runtime: t, theme: n }) {
34234
34260
  }
34235
34261
  //#endregion
34236
34262
  //#region src/lib/config.service.ts
34237
- var oH = {
34263
+ var lH = {
34238
34264
  url: {
34239
34265
  app: "http://localhost:4201",
34240
34266
  api: "https://cognitus-etiyacell.etiyacloud.com",
@@ -34281,8 +34307,8 @@ var oH = {
34281
34307
  }
34282
34308
  }
34283
34309
  };
34284
- function sH(e) {
34285
- let t = oH.genai?.init;
34310
+ function uH(e) {
34311
+ let t = lH.genai?.init;
34286
34312
  return !t || e.genai?.init ? e : {
34287
34313
  ...e,
34288
34314
  genai: {
@@ -34291,33 +34317,33 @@ function sH(e) {
34291
34317
  }
34292
34318
  };
34293
34319
  }
34294
- async function cH(e) {
34320
+ async function dH(e) {
34295
34321
  let t = `${(globalThis.__BASE_URL__ ?? "").replace(/\/$/, "")}/environment.json`, n = e ?? t;
34296
34322
  try {
34297
34323
  let e = await fetch(n);
34298
- return e.ok ? sH(await e.json()) : oH;
34324
+ return e.ok ? uH(await e.json()) : lH;
34299
34325
  } catch {
34300
- return oH;
34326
+ return lH;
34301
34327
  }
34302
34328
  }
34303
34329
  //#endregion
34304
34330
  //#region src/lib/mount-widget.tsx
34305
- var lH = /* @__PURE__ */ new WeakMap();
34306
- async function uH(e, t, n) {
34331
+ var fH = /* @__PURE__ */ new WeakMap();
34332
+ async function pH(e, t, n) {
34307
34333
  try {
34308
- bV(await cH(n?.environmentUrl));
34334
+ bV(await dH(n?.environmentUrl));
34309
34335
  } catch (e) {
34310
34336
  throw console.error("Failed to initialize agent widget rest services:", e), e;
34311
34337
  }
34312
- let r = lH.get(e);
34338
+ let r = fH.get(e);
34313
34339
  r && r.unmount();
34314
34340
  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));
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));
34318
34344
  };
34319
34345
  }
34320
- function dH(e) {
34346
+ function mH(e) {
34321
34347
  let t = e.genai?.config;
34322
34348
  if (!t?.assistantId) throw Error("GenAI config is missing in environment.json.");
34323
34349
  return {
@@ -34325,24 +34351,24 @@ function dH(e) {
34325
34351
  agents: t.agents
34326
34352
  };
34327
34353
  }
34328
- function fH(e, t) {
34354
+ function hH(e, t) {
34329
34355
  return t ? {
34330
34356
  assistantId: t.assistantId ?? e.assistantId,
34331
34357
  agents: t.agents ?? e.agents
34332
34358
  } : e;
34333
34359
  }
34334
- function pH(e, t) {
34360
+ function gH(e, t) {
34335
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;
34336
34362
  }
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),
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),
34341
34367
  runtime: t.runtime,
34342
34368
  theme: t.theme
34343
34369
  });
34344
34370
  }
34345
34371
  //#endregion
34346
- export { aH as AgentChatWidget, uH as mountAgentChatWidget, mH as mountAgentChatWidgetFromEnvironment };
34372
+ export { cH as AgentChatWidget, pH as mountAgentChatWidget, _H as mountAgentChatWidgetFromEnvironment };
34347
34373
 
34348
34374
  //# sourceMappingURL=agent-widget.js.map