bstp-agent-widget 0.2.119 → 0.2.122

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.
package/dist/angular.mjs CHANGED
@@ -46215,30 +46215,26 @@ function VM({ onClick: e, zIndex: t, position: n, label: r }) {
46215
46215
  return /* @__PURE__ */ (0, U.jsx)("div", {
46216
46216
  className: BM.root,
46217
46217
  style: d,
46218
- children: /* @__PURE__ */ (0, U.jsx)(dy, {
46219
- label: "Open agent widget",
46220
- position: "left",
46221
- children: /* @__PURE__ */ (0, U.jsx)(jm, {
46222
- onClick: e,
46223
- onPointerDown: a,
46224
- style: f,
46225
- classNames: {
46226
- root: BM.button,
46227
- inner: BM.buttonInner,
46228
- section: BM.iconSection,
46229
- label: BM.label
46230
- },
46231
- leftSection: /* @__PURE__ */ (0, U.jsx)(zM, {
46232
- width: s,
46233
- height: s
46234
- }),
46235
- radius: 20,
46236
- variant: "filled",
46237
- color: "accent",
46238
- "aria-label": `Open ${r ?? "agent widget"}`,
46239
- title: r ?? "Assistant",
46240
- children: r ?? "Assistant"
46241
- })
46218
+ children: /* @__PURE__ */ (0, U.jsx)(jm, {
46219
+ onClick: e,
46220
+ onPointerDown: a,
46221
+ style: f,
46222
+ classNames: {
46223
+ root: BM.button,
46224
+ inner: BM.buttonInner,
46225
+ section: BM.iconSection,
46226
+ label: BM.label
46227
+ },
46228
+ leftSection: /* @__PURE__ */ (0, U.jsx)(zM, {
46229
+ width: s,
46230
+ height: s
46231
+ }),
46232
+ radius: 20,
46233
+ variant: "filled",
46234
+ color: "accent",
46235
+ "aria-label": `Open ${r ?? "agent widget"}`,
46236
+ title: `Open ${r ?? "agent widget"}`,
46237
+ children: r ?? "Assistant"
46242
46238
  })
46243
46239
  });
46244
46240
  }
@@ -54919,15 +54915,22 @@ function uU({ panelTitle: e, isLoading: t, isOnline: n, onClose: r }) {
54919
54915
  });
54920
54916
  }
54921
54917
  var dU = {
54922
- root: "_root_98si9_1",
54923
- surface: "_surface_98si9_9",
54924
- resizeHandle: "_resizeHandle_98si9_22"
54918
+ root: "_root_nkl8r_1",
54919
+ surface: "_surface_nkl8r_9",
54920
+ resizeHandle: "_resizeHandle_nkl8r_22"
54925
54921
  };
54926
54922
  //#endregion
54927
54923
  //#region package/src/internal/components/AgentPanel/AgentPanel.tsx
54928
- function fU({ visible: e, onClose: t, messages: n, composerText: r, onComposerTextChange: i, isLoading: a, error: o, canSend: s, onSubmit: c, isListening: l, isVoiceSupported: u, onToggleVoice: d, actions: f, onActionClick: p, panelTitle: m, runtimeInfo: h, scrollViewportRef: g, actualWidth: _ = 420, floatingTop: v = "var(--mantine-custom-space-150)", floatingHeight: y = "100%", floatingMaxHeight: b = "calc(100vh - var(--mantine-custom-space-150) - var(--mantine-custom-space-150))", shellGap: x = "var(--mantine-custom-space-150)", panelHeaderHeight: S = 56, panelResizableWidth: C, zIndex: w }) {
54929
- let T = h.hasCustomerToken && h.hasGenaiToken;
54930
- return e ? /* @__PURE__ */ (0, U.jsxs)(q, {
54924
+ function fU({ visible: e, onClose: t, messages: n, composerText: r, onComposerTextChange: i, isLoading: a, error: o, canSend: s, onSubmit: c, isListening: l, isVoiceSupported: u, onToggleVoice: d, actions: f, onActionClick: p, panelTitle: m, runtimeInfo: h, scrollViewportRef: g, actualWidth: _ = 420, floatingTop: v = "var(--mantine-custom-space-150)", floatingHeight: y = "100%", floatingMaxHeight: b = "calc(100vh - var(--mantine-custom-space-150) - var(--mantine-custom-space-150))", shellGap: x = "var(--mantine-custom-space-150)", panelHeaderHeight: S = 56, panelResizableWidth: C, panelBorder: w, panelBorderRadius: T, zIndex: E }) {
54925
+ let D = h.hasCustomerToken && h.hasGenaiToken, O = (e) => {
54926
+ if (e.type === "action-click" && e.data) {
54927
+ let t = f.find((t) => t.buttonText === e.data?.buttonText);
54928
+ t && p(t);
54929
+ }
54930
+ };
54931
+ if (!e) return null;
54932
+ let k = typeof T == "number" ? `${T}px` : T;
54933
+ return /* @__PURE__ */ (0, U.jsxs)(q, {
54931
54934
  className: dU.root,
54932
54935
  style: {
54933
54936
  width: _,
@@ -54936,9 +54939,11 @@ function fU({ visible: e, onClose: t, messages: n, composerText: r, onComposerTe
54936
54939
  maxHeight: b,
54937
54940
  top: v,
54938
54941
  right: x,
54939
- zIndex: w,
54942
+ zIndex: E,
54940
54943
  "--agent-widget-panel-header-height": `${S}px`,
54941
- "--agent-widget-shell-gap": x
54944
+ "--agent-widget-shell-gap": x,
54945
+ "--agent-widget-panel-border": w,
54946
+ "--agent-widget-panel-radius": k
54942
54947
  },
54943
54948
  children: [C && /* @__PURE__ */ (0, U.jsx)(q, {
54944
54949
  onPointerDown: C.handlePointerDown,
@@ -54950,7 +54955,7 @@ function fU({ visible: e, onClose: t, messages: n, composerText: r, onComposerTe
54950
54955
  /* @__PURE__ */ (0, U.jsx)(uU, {
54951
54956
  panelTitle: m,
54952
54957
  isLoading: a,
54953
- isOnline: T,
54958
+ isOnline: D,
54954
54959
  onClose: t
54955
54960
  }),
54956
54961
  /* @__PURE__ */ (0, U.jsx)(QH, {
@@ -54958,12 +54963,7 @@ function fU({ visible: e, onClose: t, messages: n, composerText: r, onComposerTe
54958
54963
  isLoading: a,
54959
54964
  error: o,
54960
54965
  scrollViewportRef: g,
54961
- onWidgetEvent: (e) => {
54962
- if (e.type === "action-click" && e.data) {
54963
- let t = f.find((t) => t.buttonText === e.data?.buttonText);
54964
- t && p(t);
54965
- }
54966
- }
54966
+ onWidgetEvent: O
54967
54967
  }),
54968
54968
  /* @__PURE__ */ (0, U.jsx)(oU, {
54969
54969
  composerText: r,
@@ -54977,20 +54977,31 @@ function fU({ visible: e, onClose: t, messages: n, composerText: r, onComposerTe
54977
54977
  })
54978
54978
  ]
54979
54979
  })]
54980
- }) : null;
54980
+ });
54981
54981
  }
54982
54982
  //#endregion
54983
- //#region package/src/internal/mappers/genai-agent-catalog.mapper.ts
54983
+ //#region package/src/internal/hooks/useResolvedAgentType.ts
54984
54984
  function pU(e) {
54985
- return typeof e == "object" && !!e;
54985
+ return (0, H.useMemo)(() => {
54986
+ let t = e === "MULTI" ? "MULTI" : "SINGLE";
54987
+ return {
54988
+ agentType: t,
54989
+ isMultiAgent: t === "MULTI"
54990
+ };
54991
+ }, [e]);
54986
54992
  }
54993
+ //#endregion
54994
+ //#region package/src/internal/mappers/genai-agent-catalog.mapper.ts
54987
54995
  function mU(e) {
54996
+ return typeof e == "object" && !!e;
54997
+ }
54998
+ function hU(e) {
54988
54999
  let t = Number(e);
54989
55000
  return Number.isFinite(t) && t > 0 ? t : null;
54990
55001
  }
54991
- function hU(e) {
54992
- if (Array.isArray(e)) return e.filter(pU);
54993
- if (!pU(e)) return [];
55002
+ function gU(e) {
55003
+ if (Array.isArray(e)) return e.filter(mU);
55004
+ if (!mU(e)) return [];
54994
55005
  for (let t of [
54995
55006
  "data",
54996
55007
  "items",
@@ -55001,20 +55012,20 @@ function hU(e) {
55001
55012
  "response"
55002
55013
  ]) {
55003
55014
  let n = e[t];
55004
- if (Array.isArray(n)) return n.filter(pU);
55005
- if (pU(n)) {
55006
- let e = hU(n);
55015
+ if (Array.isArray(n)) return n.filter(mU);
55016
+ if (mU(n)) {
55017
+ let e = gU(n);
55007
55018
  if (e.length > 0) return e;
55008
55019
  }
55009
55020
  }
55010
55021
  for (let t of Object.values(e)) if (Array.isArray(t)) {
55011
- let e = t.filter(pU);
55022
+ let e = t.filter(mU);
55012
55023
  if (e.length > 0) return e;
55013
55024
  }
55014
55025
  return [];
55015
55026
  }
55016
- function gU(e) {
55017
- let t = mU(e.assistantId ?? e.assistant_id ?? e.id ?? e.agentId ?? e.agent_id ?? e.appId ?? e.app_id);
55027
+ function _U(e) {
55028
+ let t = hU(e.assistantId ?? e.assistant_id ?? e.id ?? e.agentId ?? e.agent_id ?? e.appId ?? e.app_id);
55018
55029
  if (!t) return null;
55019
55030
  let n = e.description ?? e.appDescription ?? e.app_description ?? e.label ?? e.name ?? e.assistantName ?? e.assistant_name ?? e.agentName ?? e.agent_name ?? e.title, r = typeof n == "string" && n.trim().length > 0 ? n.trim() : `Agent ${t}`, i = e.assistantKey ?? e.assistant_key ?? e.key ?? e.agentKey ?? e.agent_key ?? e.code, a = typeof i == "string" && i.trim().length > 0 ? i.trim() : r.toLowerCase().replace(/\s+/g, "-"), o = e.initialMessage ?? e.initial_message ?? e.welcomeMessage ?? e.welcome_message, s = typeof o == "string" && o.trim().length > 0 ? o.trim() : void 0;
55020
55031
  return {
@@ -55024,8 +55035,8 @@ function gU(e) {
55024
55035
  ...s ? { initialMessage: s } : {}
55025
55036
  };
55026
55037
  }
55027
- function _U(e) {
55028
- let t = mU(e.appId ?? e.app_id ?? e.id ?? e.assistantId ?? e.assistant_id);
55038
+ function vU(e) {
55039
+ let t = hU(e.appId ?? e.app_id ?? e.id ?? e.assistantId ?? e.assistant_id);
55029
55040
  if (!t) return null;
55030
55041
  let n = e.description ?? e.name ?? e.label ?? e.title ?? e.appName ?? e.app_name, r = typeof n == "string" && n.trim().length > 0 ? n.trim() : `Agent ${t}`, i = e.assistantKey ?? e.assistant_key ?? e.key ?? e.code, a = typeof i == "string" && i.trim().length > 0 ? i.trim() : r.toLowerCase().replace(/\s+/g, "-"), o = e.initialMessage ?? e.initial_message ?? e.welcomeMessage ?? e.welcome_message, s = typeof o == "string" && o.trim().length > 0 ? o.trim() : void 0;
55031
55042
  return {
@@ -55035,25 +55046,25 @@ function _U(e) {
55035
55046
  ...s ? { initialMessage: s } : {}
55036
55047
  };
55037
55048
  }
55038
- function vU(e) {
55049
+ function yU(e) {
55039
55050
  if (Array.isArray(e.apps) && e.apps.length > 0) {
55040
- let t = e.apps.map((e) => _U(e)).filter((e) => e !== null);
55051
+ let t = e.apps.map((e) => vU(e)).filter((e) => e !== null);
55041
55052
  if (t.length > 0) return t;
55042
55053
  }
55043
- let t = gU(e);
55054
+ let t = _U(e);
55044
55055
  return t ? [t] : [];
55045
55056
  }
55046
- function yU(e) {
55047
- return hU(e).flatMap((e) => vU(e));
55057
+ function bU(e) {
55058
+ return gU(e).flatMap((e) => yU(e));
55048
55059
  }
55049
55060
  //#endregion
55050
55061
  //#region package/src/internal/stores/agent-chat/agent-chat.store.ts
55051
- var bU = { runtimeInfo: {
55062
+ var xU = { runtimeInfo: {
55052
55063
  customerId: null,
55053
55064
  hasCustomerToken: !1,
55054
55065
  hasGenaiToken: !1
55055
- } }, xU = fE((e) => ({
55056
- ...bU,
55066
+ } }, SU = fE((e) => ({
55067
+ ...xU,
55057
55068
  setRuntimeInfo: (t) => e({ runtimeInfo: t }),
55058
55069
  updateCustomerId: (t) => e((e) => ({ runtimeInfo: {
55059
55070
  ...e.runtimeInfo,
@@ -55067,11 +55078,11 @@ var bU = { runtimeInfo: {
55067
55078
  ...e.runtimeInfo,
55068
55079
  hasGenaiToken: t
55069
55080
  } })),
55070
- resetRuntimeInfo: () => e({ runtimeInfo: bU.runtimeInfo })
55081
+ resetRuntimeInfo: () => e({ runtimeInfo: xU.runtimeInfo })
55071
55082
  }));
55072
55083
  //#endregion
55073
55084
  //#region package/src/internal/api/genai.service.ts
55074
- async function SU(e, t) {
55085
+ async function CU(e, t) {
55075
55086
  try {
55076
55087
  let n = new URLSearchParams();
55077
55088
  n.set("username", atob(e)), n.set("password", atob(t));
@@ -55084,7 +55095,7 @@ async function SU(e, t) {
55084
55095
  throw e;
55085
55096
  }
55086
55097
  }
55087
- async function CU(e, t) {
55098
+ async function wU(e, t) {
55088
55099
  try {
55089
55100
  let n = await EE.post("/tenants/switch", { tenant_id: e }, {
55090
55101
  anonymous: !0,
@@ -55095,21 +55106,21 @@ async function CU(e, t) {
55095
55106
  throw e;
55096
55107
  }
55097
55108
  }
55098
- async function wU(e) {
55109
+ async function TU(e) {
55099
55110
  try {
55100
55111
  return (await EE.post("/agent-message", e, { anonymous: !0 })).data;
55101
55112
  } catch (e) {
55102
55113
  throw e;
55103
55114
  }
55104
55115
  }
55105
- async function TU(e) {
55116
+ async function EU(e) {
55106
55117
  try {
55107
55118
  return (await EE.post("/agentic-app-chat", e, { anonymous: !0 })).data;
55108
55119
  } catch (e) {
55109
55120
  throw e;
55110
55121
  }
55111
55122
  }
55112
- async function EU(e) {
55123
+ async function DU(e) {
55113
55124
  let { customerToken: t, tenantId: n, ...r } = e;
55114
55125
  try {
55115
55126
  return (await EE.post("/assistant", r, {
@@ -55123,7 +55134,7 @@ async function EU(e) {
55123
55134
  throw e;
55124
55135
  }
55125
55136
  }
55126
- async function DU(e) {
55137
+ async function OU(e) {
55127
55138
  let { customerToken: t, tenantId: n, ...r } = e;
55128
55139
  try {
55129
55140
  return (await EE.post("/fetch-agentic-app", r, {
@@ -55137,17 +55148,17 @@ async function DU(e) {
55137
55148
  throw e;
55138
55149
  }
55139
55150
  }
55140
- var OU = {
55141
- loginToGenai: SU,
55142
- switchTenant: CU,
55143
- sendAgentMessage: wU,
55144
- sendAgenticAppChat: TU,
55145
- fetchAssistants: EU,
55146
- fetchAgenticApps: DU
55151
+ var kU = {
55152
+ loginToGenai: CU,
55153
+ switchTenant: wU,
55154
+ sendAgentMessage: TU,
55155
+ sendAgenticAppChat: EU,
55156
+ fetchAssistants: DU,
55157
+ fetchAgenticApps: OU
55147
55158
  };
55148
55159
  //#endregion
55149
55160
  //#region package/src/internal/queries/utils/createApiMutation.ts
55150
- function kU({ mutationKey: e, mutationFn: t, defaultOptions: n = {} }) {
55161
+ function AU({ mutationKey: e, mutationFn: t, defaultOptions: n = {} }) {
55151
55162
  return function(r) {
55152
55163
  return tS({
55153
55164
  ...n,
@@ -55163,121 +55174,115 @@ function kU({ mutationKey: e, mutationFn: t, defaultOptions: n = {} }) {
55163
55174
  }
55164
55175
  //#endregion
55165
55176
  //#region package/src/internal/queries/genai/useFetchAgenticAppsMutation.ts
55166
- var AU = kU({
55177
+ var jU = AU({
55167
55178
  mutationKey: ["genai", "agentic-apps"],
55168
- mutationFn: async (e) => OU.fetchAgenticApps(e)
55169
- }), jU = kU({
55179
+ mutationFn: async (e) => kU.fetchAgenticApps(e)
55180
+ }), MU = AU({
55170
55181
  mutationKey: ["genai", "assistants"],
55171
- mutationFn: async (e) => OU.fetchAssistants(e)
55182
+ mutationFn: async (e) => kU.fetchAssistants(e)
55172
55183
  });
55173
55184
  //#endregion
55174
- //#region package/src/internal/hooks/useAgentConfig.ts
55175
- function MU(e) {
55176
- return e === "MULTI" ? "MULTI" : "SINGLE";
55177
- }
55185
+ //#region package/src/internal/hooks/useRemoteAssistants.ts
55178
55186
  function NU(e, t) {
55179
- if (e) {
55180
- let n = t.find((t) => t.assistantId === e);
55181
- if (n) return n.assistantId;
55182
- }
55183
- return t[0]?.assistantId;
55187
+ return e && t.includes(e) ? e : t[0];
55184
55188
  }
55185
- function PU() {
55186
- let e = (0, H.useContext)(kM), { mutateAsync: t } = jU(), { mutateAsync: n } = AU(), [r, i] = (0, H.useState)(null), a = (0, H.useRef)(null), o = (0, H.useRef)(null), s = _T(), c = yT(), l = c ? Number(c) : null, u = xT();
55189
+ function PU(e, t, n) {
55190
+ let { mutateAsync: r } = MU(), { mutateAsync: i } = jU(), { isMultiAgent: a } = pU(e), [o, s] = (0, H.useState)(null), c = (0, H.useRef)(null), l = (0, H.useRef)(null), u = _T(), d = yT(), f = d ? Number(d) : null, p = xT();
55187
55191
  (0, H.useEffect)(() => {
55188
- if (!e) {
55189
- i(null);
55192
+ if (!n) {
55193
+ s(null);
55190
55194
  return;
55191
55195
  }
55192
- if (!s || !l || Number.isNaN(l) || l <= 0 || !u) {
55193
- i(null), a.current = null, o.current = null;
55196
+ if (!u || !f || Number.isNaN(f) || f <= 0 || !p) {
55197
+ s(null), c.current = null, l.current = null;
55194
55198
  return;
55195
55199
  }
55196
- let r = MU(e.agentType) === "MULTI", c = `${r ? "multi" : "single"}:${l}:${s}`;
55197
- if (a.current === c || o.current === c) return;
55198
- o.current = c;
55199
- let d = !0;
55200
+ let e = `${a ? "multi" : "single"}:${f}:${u}`;
55201
+ if (c.current === e || l.current === e) return;
55202
+ l.current = e;
55203
+ let t = !0;
55200
55204
  return (async () => {
55201
55205
  try {
55202
- let e = r ? await n({
55206
+ let n = a ? await i({
55203
55207
  page: 1,
55204
55208
  limit: 10,
55205
- customerToken: s,
55206
- tenantId: l
55207
- }) : await t({
55209
+ customerToken: u,
55210
+ tenantId: f
55211
+ }) : await r({
55208
55212
  page: 1,
55209
55213
  limit: 20,
55210
55214
  agent_type: "SINGLE",
55211
- customerToken: s,
55212
- tenantId: l
55215
+ customerToken: u,
55216
+ tenantId: f
55213
55217
  });
55214
- if (!d) return;
55215
- i(yU(e)), a.current = c;
55218
+ if (!t) return;
55219
+ s(bU(n)), c.current = e;
55216
55220
  } catch {
55217
- d && (i([]), a.current = null);
55221
+ t && (s([]), c.current = null);
55218
55222
  } finally {
55219
- o.current === c && (o.current = null);
55223
+ l.current === e && (l.current = null);
55220
55224
  }
55221
55225
  })(), () => {
55222
- d = !1;
55226
+ t = !1;
55223
55227
  };
55224
55228
  }, [
55225
- e?.agentType,
55226
55229
  n,
55230
+ i,
55231
+ r,
55232
+ u,
55233
+ f,
55234
+ a,
55235
+ p
55236
+ ]);
55237
+ let m = o ?? [], h = NU(t, m.map((e) => e.assistantId));
55238
+ return {
55239
+ availableAssistants: m,
55240
+ selectedAssistantId: h,
55241
+ selectedAssistant: m.find((e) => e.assistantId === h)
55242
+ };
55243
+ }
55244
+ //#endregion
55245
+ //#region package/src/internal/hooks/useAgentConfig.ts
55246
+ function FU() {
55247
+ let e = (0, H.useContext)(kM), { agentType: t } = pU(e?.agentType), { selectedAssistantId: n, selectedAssistant: r } = PU(e?.agentType, e?.assistantId, !!e), i = (0, H.useMemo)(() => e ? {
55248
+ ...e,
55249
+ assistantId: n,
55250
+ agentType: t,
55251
+ assistantLabel: r?.label,
55252
+ assistantInitialMessage: r?.initialMessage
55253
+ } : null, [
55254
+ e,
55227
55255
  t,
55228
- s,
55229
- l,
55230
- u
55256
+ r,
55257
+ n
55231
55258
  ]);
55232
- let d = (0, H.useMemo)(() => {
55233
- if (!e) return null;
55234
- let t = r ?? [], n = MU(e.agentType), i = NU(e.assistantId, t), a = t.find((e) => e.assistantId === i);
55235
- return {
55236
- ...e,
55237
- assistantId: i,
55238
- agentType: n,
55239
- assistantLabel: a?.label,
55240
- assistantInitialMessage: a?.initialMessage
55241
- };
55242
- }, [e, r]);
55243
- if (!d) throw Error("AgentConfigContext is missing.");
55244
- return d;
55259
+ if (!i) throw Error("AgentConfigContext is missing.");
55260
+ return i;
55245
55261
  }
55246
55262
  //#endregion
55247
55263
  //#region package/src/internal/hooks/useAgentRuntime.ts
55248
- function FU() {
55264
+ function IU() {
55249
55265
  let e = (0, H.useContext)(AM);
55250
55266
  if (!e) throw Error("AgentRuntimeContext is missing.");
55251
55267
  return e;
55252
55268
  }
55253
55269
  //#endregion
55254
55270
  //#region package/src/internal/hooks/useAgentCustomerToken.ts
55255
- function IU() {
55256
- let e = FU();
55271
+ function LU() {
55272
+ let e = IU();
55257
55273
  return (0, H.useMemo)(() => {
55258
55274
  let t = e?.customerToken;
55259
55275
  return typeof t != "string" || t.trim().length === 0 ? null : t;
55260
55276
  }, [e?.customerToken]);
55261
55277
  }
55262
55278
  //#endregion
55263
- //#region package/src/internal/hooks/useResolvedAgentType.ts
55264
- function LU(e) {
55265
- return (0, H.useMemo)(() => {
55266
- let t = e === "MULTI" ? "MULTI" : "SINGLE";
55267
- return {
55268
- agentType: t,
55269
- isMultiAgent: t === "MULTI"
55270
- };
55271
- }, [e]);
55272
- }
55273
- //#endregion
55274
55279
  //#region package/src/internal/queries/genai/useSendAgentMessageMutation.ts
55275
- var RU = kU({
55280
+ var RU = AU({
55276
55281
  mutationKey: ["genai", "agent-message"],
55277
- mutationFn: async ({ payload: e }) => OU.sendAgentMessage(e)
55278
- }), zU = kU({
55282
+ mutationFn: async ({ payload: e }) => kU.sendAgentMessage(e)
55283
+ }), zU = AU({
55279
55284
  mutationKey: ["genai", "agentic-app-chat"],
55280
- mutationFn: async ({ payload: e }) => OU.sendAgenticAppChat(e)
55285
+ mutationFn: async ({ payload: e }) => kU.sendAgenticAppChat(e)
55281
55286
  });
55282
55287
  //#endregion
55283
55288
  //#region package/src/internal/hooks/useSendChatMessage.ts
@@ -55338,7 +55343,7 @@ function qU() {
55338
55343
  return e?.randomUUID ? e.randomUUID() : `${Date.now()}-${Math.random().toString(16).slice(2)}`;
55339
55344
  }
55340
55345
  function JU() {
55341
- let e = FU(), t = IU(), n = PU(), { agentType: r, isMultiAgent: i } = LU(n.agentType), { sendChatMessage: a } = BU(), [o, s] = (0, H.useState)([]), [c, l] = (0, H.useState)(""), [u, d] = (0, H.useState)(null), [f, p] = (0, H.useState)(!1), [m, h] = (0, H.useState)(null), g = (0, H.useRef)(!1), _ = VU(n), v = i ? n.assistantLabel ?? "Assistant" : "Assistant", y = (0, H.useCallback)((e) => {
55346
+ let e = IU(), t = LU(), n = FU(), { agentType: r, isMultiAgent: i } = pU(n.agentType), { sendChatMessage: a } = BU(), [o, s] = (0, H.useState)([]), [c, l] = (0, H.useState)(""), [u, d] = (0, H.useState)(null), [f, p] = (0, H.useState)(!1), [m, h] = (0, H.useState)(null), g = (0, H.useRef)(!1), _ = VU(n), v = i ? n.assistantLabel ?? "Assistant" : "Assistant", y = (0, H.useCallback)((e) => {
55342
55347
  let t = {
55343
55348
  id: qU(),
55344
55349
  sentBy: "user",
@@ -55486,15 +55491,22 @@ var ZU = [
55486
55491
  "body"
55487
55492
  ];
55488
55493
  function QU(e, t, n, r, i) {
55489
- let a = (0, H.useRef)(Math.max(280, t ?? 420)), o = (0, H.useRef)(n ?? !1), s = (0, H.useRef)(null), c = (0, H.useCallback)(() => {
55494
+ let a = (0, H.useRef)(Math.max(280, t ?? 420)), o = (0, H.useRef)(n ?? !1), s = (0, H.useRef)(null), c = e?.reserveLayoutSpace ?? !0, l = (0, H.useCallback)(() => {
55490
55495
  let t = e?.hostContainerSelector, n = [...t ? t.split(",").map((e) => e.trim()).filter(Boolean) : [], ...ZU];
55491
55496
  for (let e of n) {
55492
55497
  let t = document.querySelector(e);
55493
55498
  if (t) return t;
55494
55499
  }
55495
55500
  return document.body;
55496
- }, [e?.hostContainerSelector]), l = (0, H.useCallback)((e) => {
55501
+ }, [e?.hostContainerSelector]), u = (0, H.useCallback)((e) => {
55497
55502
  let t = document.documentElement;
55503
+ if (!c) {
55504
+ if (t.style.removeProperty("--agent-widget-panel-width"), s.current) {
55505
+ let { element: e, inlinePaddingBefore: t } = s.current;
55506
+ e.style.paddingRight = t, s.current = null;
55507
+ }
55508
+ return;
55509
+ }
55498
55510
  if (e === null ? t.style.removeProperty("--agent-widget-panel-width") : t.style.setProperty("--agent-widget-panel-width", `${e}px`), e === null) {
55499
55511
  if (s.current) {
55500
55512
  let { element: e, inlinePaddingBefore: t } = s.current;
@@ -55503,7 +55515,7 @@ function QU(e, t, n, r, i) {
55503
55515
  return;
55504
55516
  }
55505
55517
  if (!s.current || !document.contains(s.current.element)) {
55506
- let e = c();
55518
+ let e = l();
55507
55519
  if (!e) return;
55508
55520
  s.current = {
55509
55521
  element: e,
@@ -55513,42 +55525,42 @@ function QU(e, t, n, r, i) {
55513
55525
  }
55514
55526
  let { element: n, inlinePaddingBefore: r, widthApplied: i } = s.current;
55515
55527
  e !== i && (n.style.paddingRight = r, n.style.paddingRight = `calc(${r || "0px"} + ${e}px)`, s.current.widthApplied = e);
55516
- }, [c]), u = XU({
55528
+ }, [l, c]), d = XU({
55517
55529
  axis: "x",
55518
55530
  direction: -1,
55519
55531
  onResizeChange: (0, H.useCallback)((e) => {
55520
55532
  let n = Math.max(280, (t ?? 420) + e);
55521
- a.current = n, l(n);
55522
- }, [t, l])
55533
+ a.current = n, u(n);
55534
+ }, [t, u])
55523
55535
  });
55524
55536
  (0, H.useEffect)(() => {
55525
55537
  o.current = n ?? !1;
55526
55538
  }, [n]), (0, H.useEffect)(() => {
55527
55539
  let e = Math.max(280, t ?? 420);
55528
- a.current = e, o.current && l(e);
55529
- }, [t, l]), (0, H.useEffect)(() => {
55540
+ a.current = e, o.current && u(e);
55541
+ }, [t, u]), (0, H.useEffect)(() => {
55530
55542
  if (!n) {
55531
- l(null), document.documentElement.removeAttribute("data-agent-widget-open");
55543
+ u(null), document.documentElement.removeAttribute("data-agent-widget-open");
55532
55544
  return;
55533
55545
  }
55534
- return l(a.current), document.documentElement.setAttribute("data-agent-widget-open", "true"), () => {
55535
- l(null), document.documentElement.removeAttribute("data-agent-widget-open");
55546
+ return u(a.current), document.documentElement.setAttribute("data-agent-widget-open", "true"), () => {
55547
+ u(null), document.documentElement.removeAttribute("data-agent-widget-open");
55536
55548
  };
55537
- }, [n, l]);
55538
- let d = u ? Math.max(280, (t ?? 420) + u.offset) : t ?? 420, f = r === "100%" || r === "100vh", p = "var(--mantine-custom-space-150)", m = i ?? 0;
55549
+ }, [n, u]);
55550
+ let f = d ? Math.max(280, (t ?? 420) + d.offset) : t ?? 420, p = r === "100%" || r === "100vh", m = typeof e?.panelGap == "number" ? `${e.panelGap}px` : e?.panelGap ?? "var(--mantine-custom-space-150)", h = i ?? 0;
55539
55551
  return {
55540
- panelResizableWidth: u,
55541
- actualWidth: d,
55542
- shellGap: p,
55543
- floatingTop: m ? `calc(${m}px + ${p})` : p,
55544
- floatingHeight: f ? `calc(100vh - ${m}px - ${p} - ${p})` : typeof r == "number" ? `${r}px` : r ?? "100%",
55545
- floatingMaxHeight: `calc(100vh - ${m}px - ${p} - ${p})`
55552
+ panelResizableWidth: d,
55553
+ actualWidth: f,
55554
+ shellGap: m,
55555
+ floatingTop: h ? `calc(${h}px + ${m})` : m,
55556
+ floatingHeight: p ? `calc(100vh - ${h}px - ${m} - ${m})` : typeof r == "number" ? `${r}px` : r ?? "100%",
55557
+ floatingMaxHeight: `calc(100vh - ${h}px - ${m} - ${m})`
55546
55558
  };
55547
55559
  }
55548
55560
  //#endregion
55549
55561
  //#region package/src/internal/hooks/useAgentRuntimeInfo.ts
55550
55562
  function $U() {
55551
- let e = FU(), { runtimeInfo: t, setRuntimeInfo: n } = xU(), r = (0, H.useCallback)(async () => {
55563
+ let e = IU(), { runtimeInfo: t, setRuntimeInfo: n } = SU(), r = (0, H.useCallback)(async () => {
55552
55564
  if (!e) {
55553
55565
  n({
55554
55566
  customerId: null,
@@ -55574,7 +55586,7 @@ function $U() {
55574
55586
  //#endregion
55575
55587
  //#region package/src/internal/hooks/useAgentSpeechLanguage.ts
55576
55588
  function eW() {
55577
- let e = FU();
55589
+ let e = IU();
55578
55590
  return (0, H.useMemo)(() => e && GU(e) || "en-US", [e]);
55579
55591
  }
55580
55592
  //#endregion
@@ -55684,6 +55696,9 @@ function iW(e) {
55684
55696
  panelHeight: e?.panelHeight ?? "100%",
55685
55697
  panelHeaderHeight: e?.panelHeaderHeight ?? 56,
55686
55698
  panelTopOffset: e?.panelTopOffset,
55699
+ panelGap: e?.panelGap,
55700
+ panelBorder: e?.panelBorder,
55701
+ panelBorderRadius: e?.panelBorderRadius,
55687
55702
  zIndex: e?.zIndex ?? rW,
55688
55703
  fabPosition: {
55689
55704
  ...typeof e?.fabTopOffset == "number" ? { top: e.fabTopOffset } : { bottom: e?.fabBottomOffset ?? nW.bottom },
@@ -55739,9 +55754,9 @@ function sW(e, t = {}) {
55739
55754
  }
55740
55755
  //#endregion
55741
55756
  //#region package/src/internal/queries/genai/useGenaiLoginMutation.ts
55742
- var cW = kU({
55757
+ var cW = AU({
55743
55758
  mutationKey: ["genai", "login"],
55744
- mutationFn: async ({ serviceAccount: e, serviceKey: t }) => OU.loginToGenai(e, t)
55759
+ mutationFn: async ({ serviceAccount: e, serviceKey: t }) => kU.loginToGenai(e, t)
55745
55760
  }), lW = new gE("useGenaiLogin"), uW = null, dW = null;
55746
55761
  function fW(e = !1) {
55747
55762
  let t = (0, H.useContext)(kM), { mutateAsync: n } = cW(), [r, i] = (0, H.useState)(!1), [a, o] = (0, H.useState)(null), [s, c] = (0, H.useState)(null), [l, u] = (0, H.useState)(null);
@@ -55789,9 +55804,9 @@ function fW(e = !1) {
55789
55804
  }
55790
55805
  //#endregion
55791
55806
  //#region package/src/internal/queries/genai/useTenantSwitchMutation.ts
55792
- var pW = kU({
55807
+ var pW = AU({
55793
55808
  mutationKey: ["genai", "tenant-switch"],
55794
- mutationFn: async ({ tenant_id: e, token: t }) => OU.switchTenant(e, t)
55809
+ mutationFn: async ({ tenant_id: e, token: t }) => kU.switchTenant(e, t)
55795
55810
  }), mW = new gE("useGenaiTenantSwitch"), hW = null, gW = null;
55796
55811
  function _W(e, t, n = !1) {
55797
55812
  let { mutateAsync: r } = pW(), [i, a] = (0, H.useState)(!1), [o, s] = (0, H.useState)(null), [c, l] = (0, H.useState)(!1);
@@ -55876,69 +55891,71 @@ function yW(e = {}) {
55876
55891
  //#endregion
55877
55892
  //#region package/src/internal/features/agent-chat/components/AgentLauncher/AgentLauncher.tsx
55878
55893
  function bW({ runtime: e, uiOptions: t }) {
55879
- let n = e.forceReAuth, { isAuthenticating: r, hasToken: i } = vW(n), { panelWidth: a, panelHeight: o, panelHeaderHeight: s, panelTopOffset: c, zIndex: l, fabPosition: u } = iW(t), d = (0, H.useRef)(!1), { messages: f, composerText: p, setComposerText: m, isLoading: h, error: g, sendMessage: _, sendInitialMessage: v, agentDisplayName: y, canSend: b } = JU(), { actions: x, handleActionClick: S } = YU(f, m), { runtimeInfo: C, refreshRuntimeInfo: w } = $U(), { isOpen: T, open: E, close: D } = yW({
55894
+ let n = e.forceReAuth, { isAuthenticating: r, hasToken: i } = vW(n), { panelWidth: a, panelHeight: o, panelHeaderHeight: s, panelTopOffset: c, panelBorder: l, panelBorderRadius: u, zIndex: d, fabPosition: f } = iW(t), p = (0, H.useRef)(!1), { messages: m, composerText: h, setComposerText: g, isLoading: _, error: v, sendMessage: y, sendInitialMessage: b, agentDisplayName: x, canSend: S } = JU(), { actions: C, handleActionClick: w } = YU(m, g), { runtimeInfo: T, refreshRuntimeInfo: E } = $U(), { isOpen: D, open: O, close: k } = yW({
55880
55895
  defaultOpen: !1,
55881
55896
  persist: !0,
55882
55897
  onOpen: async () => {
55883
- d.current || (d.current = !0, await w());
55898
+ p.current || (p.current = !0, await E());
55884
55899
  }
55885
55900
  });
55886
55901
  (0, H.useEffect)(() => {
55887
55902
  (async () => {
55888
- d.current && T && !r && i && await v() && (d.current = !1);
55903
+ p.current && D && !r && i && await b() && (p.current = !1);
55889
55904
  })();
55890
55905
  }, [
55891
- T,
55906
+ D,
55892
55907
  r,
55893
55908
  i,
55894
- v
55909
+ b
55895
55910
  ]);
55896
- let O = sW([f.length, h]), { isListening: k, isSupported: A, startListening: j, stopListening: M, reset: N } = tW({
55911
+ let A = sW([m.length, _]), { isListening: j, isSupported: M, startListening: N, stopListening: P, reset: ee } = tW({
55897
55912
  lang: eW(),
55898
55913
  continuous: !0,
55899
55914
  pauseOnSubmit: !0,
55900
- onTextChange: m
55901
- }), { panelResizableWidth: P, actualWidth: ee, shellGap: F, floatingTop: I, floatingHeight: te, floatingMaxHeight: ne } = QU(t, a, T, o, c), { handleSubmit: re, handleToggleVoice: ie, handleClose: L } = aW({
55902
- isListening: k,
55903
- stopListening: M,
55904
- reset: N,
55905
- sendMessage: _,
55906
- composerText: p,
55907
- setComposerText: m,
55908
- startListening: j,
55909
- close: D
55910
- });
55911
- return /* @__PURE__ */ (0, U.jsxs)(U.Fragment, { children: [!T && /* @__PURE__ */ (0, U.jsx)(VM, {
55912
- onClick: () => void E(),
55913
- zIndex: l,
55914
- position: u,
55915
- label: y
55916
- }), T && /* @__PURE__ */ (0, U.jsx)(fU, {
55915
+ onTextChange: g
55916
+ }), { panelResizableWidth: F, actualWidth: I, shellGap: te, floatingTop: ne, floatingHeight: re, floatingMaxHeight: ie } = QU(t, a, D, o, c), { handleSubmit: L, handleToggleVoice: ae, handleClose: oe } = aW({
55917
+ isListening: j,
55918
+ stopListening: P,
55919
+ reset: ee,
55920
+ sendMessage: y,
55921
+ composerText: h,
55922
+ setComposerText: g,
55923
+ startListening: N,
55924
+ close: k
55925
+ });
55926
+ return /* @__PURE__ */ (0, U.jsxs)(U.Fragment, { children: [!D && /* @__PURE__ */ (0, U.jsx)(VM, {
55927
+ onClick: () => void O(),
55928
+ zIndex: d,
55929
+ position: f,
55930
+ label: x
55931
+ }), D && /* @__PURE__ */ (0, U.jsx)(fU, {
55917
55932
  visible: !0,
55918
- onClose: L,
55919
- messages: f,
55920
- composerText: p,
55921
- onComposerTextChange: m,
55922
- isLoading: h,
55923
- error: g,
55924
- canSend: b,
55925
- onSubmit: re,
55926
- actions: x,
55927
- onActionClick: S,
55928
- isListening: k,
55929
- isVoiceSupported: A,
55930
- onToggleVoice: ie,
55931
- panelTitle: y,
55932
- runtimeInfo: C,
55933
- scrollViewportRef: O,
55934
- actualWidth: ee,
55935
- floatingTop: I,
55936
- floatingHeight: te,
55937
- floatingMaxHeight: ne,
55938
- shellGap: F,
55933
+ onClose: oe,
55934
+ messages: m,
55935
+ composerText: h,
55936
+ onComposerTextChange: g,
55937
+ isLoading: _,
55938
+ error: v,
55939
+ canSend: S,
55940
+ onSubmit: L,
55941
+ actions: C,
55942
+ onActionClick: w,
55943
+ isListening: j,
55944
+ isVoiceSupported: M,
55945
+ onToggleVoice: ae,
55946
+ panelTitle: x,
55947
+ runtimeInfo: T,
55948
+ scrollViewportRef: A,
55949
+ actualWidth: I,
55950
+ floatingTop: ne,
55951
+ floatingHeight: re,
55952
+ floatingMaxHeight: ie,
55953
+ shellGap: te,
55939
55954
  panelHeaderHeight: s,
55940
- panelResizableWidth: P,
55941
- zIndex: l
55955
+ panelResizableWidth: F,
55956
+ panelBorder: l,
55957
+ panelBorderRadius: u,
55958
+ zIndex: d
55942
55959
  })] });
55943
55960
  }
55944
55961
  //#endregion