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