@inkeep/agents-ui 0.0.0-dev-20260508233535 → 0.0.0-dev-20260509021601

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.
Files changed (35) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +161 -158
  3. package/dist/primitives/components/embedded-chat/use-chat-action.cjs +1 -1
  4. package/dist/primitives/components/embedded-chat/use-chat-action.js +16 -14
  5. package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +2 -2
  6. package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +230 -219
  7. package/dist/primitives/components/embedded-chat.cjs +3 -3
  8. package/dist/primitives/components/embedded-chat.js +96 -93
  9. package/dist/primitives/hooks/use-events-api.cjs +1 -0
  10. package/dist/primitives/hooks/use-events-api.d.ts +29 -0
  11. package/dist/primitives/hooks/use-events-api.js +44 -0
  12. package/dist/primitives/index.cjs +1 -1
  13. package/dist/primitives/index.js +150 -147
  14. package/dist/primitives/providers/base-events-provider.cjs +1 -1
  15. package/dist/primitives/providers/base-events-provider.d.ts +2 -0
  16. package/dist/primitives/providers/base-events-provider.js +6 -5
  17. package/dist/primitives/providers/chat-base-events-provider.cjs +1 -0
  18. package/dist/primitives/providers/chat-base-events-provider.d.ts +12 -0
  19. package/dist/primitives/providers/chat-base-events-provider.js +68 -0
  20. package/dist/primitives/providers/feedback-provider.cjs +1 -1
  21. package/dist/primitives/providers/feedback-provider.js +13 -12
  22. package/dist/primitives/providers/index.cjs +1 -1
  23. package/dist/primitives/providers/index.d.ts +1 -0
  24. package/dist/primitives/providers/index.js +57 -54
  25. package/dist/react/embedded-chat.cjs +1 -1
  26. package/dist/react/embedded-chat.js +96 -95
  27. package/dist/react/index.cjs +1 -1
  28. package/dist/react/index.js +161 -158
  29. package/dist/styled/components/message.cjs +1 -1
  30. package/dist/styled/components/message.js +77 -74
  31. package/dist/styled/index.cjs +1 -1
  32. package/dist/styled/index.js +151 -148
  33. package/dist/types/config/ai.d.ts +5 -0
  34. package/dist/types/events.d.ts +11 -0
  35. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as a, jsxs as G, Fragment as ie } from "react/jsx-runtime";
3
- import j, { memo as I, useRef as D, useState as $, useMemo as oe, useEffect as W, useLayoutEffect as he, forwardRef as Q } from "react";
3
+ import j, { memo as E, useRef as D, useState as $, useMemo as oe, useEffect as W, useLayoutEffect as he, forwardRef as Q } from "react";
4
4
  import * as Ce from "react-dom/client";
5
5
  import ae from "react-textarea-autosize";
6
6
  import * as Y from "@radix-ui/react-avatar";
@@ -9,7 +9,7 @@ import * as B from "@radix-ui/react-popover";
9
9
  import * as K from "@radix-ui/react-tooltip";
10
10
  import * as U from "@radix-ui/react-scroll-area";
11
11
  import { ItemText as be, Content as pe, Icon as ge, Item as ve, ItemIndicator as Fe, Trigger as _e, Viewport as Pe, Root as fe, Value as Se } from "../atoms/select.js";
12
- import { ComboboxListItems as Ee, ComboboxRoot as Ie, ComboboxItemText as Me, ComboboxContent as Ae, ComboboxControl as ye, ComboboxInput as ke, ComboboxItem as xe, ComboboxItemIndicator as Te, ComboboxList as He, ComboboxListEmpty as Le, ComboboxPositioner as we, ComboboxSelectedTags as De, ComboboxTrigger as Be } from "../atoms/combobox.js";
12
+ import { ComboboxListItems as Ie, ComboboxRoot as Ee, ComboboxItemText as Me, ComboboxContent as Ae, ComboboxControl as ye, ComboboxInput as ke, ComboboxItem as xe, ComboboxItemIndicator as Te, ComboboxList as He, ComboboxListEmpty as Le, ComboboxPositioner as we, ComboboxSelectedTags as De, ComboboxTrigger as Be } from "../atoms/combobox.js";
13
13
  import { Close as Ne, Content as Re, Title as Oe, Overlay as Ve, Root as We } from "../atoms/dialog.js";
14
14
  import Qe from "../atoms/avatars/ai.js";
15
15
  import Ue from "../atoms/avatars/user.js";
@@ -20,7 +20,7 @@ import { Markdown as q } from "../atoms/markdown/index.js";
20
20
  import { SourceItemProvider as Ke, useSourceItem as R } from "../providers/source-item-provider.js";
21
21
  import { useInkeepConfig as p } from "../providers/config-provider.js";
22
22
  import { useMessageFeedback as Z } from "../providers/feedback-provider.js";
23
- import { useMessage as E, MessageProvider as qe } from "../providers/message-provider.js";
23
+ import { useMessage as P, MessageProvider as qe } from "../providers/message-provider.js";
24
24
  import { CheckboxIcon as je } from "../atoms/icons/checkbox-icon.js";
25
25
  import { useCopyToClipboard as z } from "../hooks/use-copy-to-clipboard.js";
26
26
  import { dataAttr as g, maybeRender as O, isCitationArtifact as ne, getInitials as ze, getMessageContent as se } from "../utils/misc.js";
@@ -31,7 +31,7 @@ import { useSettleAction as Ge } from "../hooks/use-settle-action.js";
31
31
  import { useContainerSize as Ye } from "../hooks/use-container-size.js";
32
32
  import { useChatAction as J } from "./embedded-chat/use-chat-action.js";
33
33
  import { useHelpMenuState as Ze, HelpMenuProvider as Je, useHelpMenu as Xe } from "../providers/help-menu-provider.js";
34
- import { useChatForm as P } from "../providers/chat-form-provider.js";
34
+ import { useChatForm as f } from "../providers/chat-form-provider.js";
35
35
  import { useFormField as k, FormFieldProvider as et } from "../providers/form-field-provider.js";
36
36
  import { Controller as tt } from "react-hook-form";
37
37
  import { highlightEmphasis as it } from "../utils/highlight-emphasis.js";
@@ -47,7 +47,7 @@ import { useBaseEvents as ee } from "../providers/base-events-provider.js";
47
47
  import { useShadow as ct } from "../atoms/shadow/context.js";
48
48
  import { getIcon as mt } from "../utils/get-source-icon.js";
49
49
  import { ChatHistoryProvider as lt } from "../providers/chat-history-provider.js";
50
- import { EmbeddedChatPrimitiveDropZone as nn, EmbeddedChatPrimitiveFileContent as sn, EmbeddedChatPrimitiveFileInput as dn, EmbeddedChatPrimitiveFileItem as cn, EmbeddedChatPrimitiveFileList as mn, EmbeddedChatPrimitiveFileName as ln, EmbeddedChatPrimitiveFilePreviewTrigger as un, EmbeddedChatPrimitiveFileRemove as hn, EmbeddedChatPrimitiveFileRemoveIcon as Cn, EmbeddedChatPrimitiveFileThumbnail as bn, EmbeddedChatPrimitiveFileTypeIcon as pn, EmbeddedChatPrimitiveFileUploadButton as gn, EmbeddedChatPrimitiveFileUploadButtonIcon as vn, EmbeddedChatPrimitiveInputFieldset as Fn, EmbeddedChatPrimitiveInputNotification as _n, EmbeddedChatPrimitiveInputNotificationClose as Pn, EmbeddedChatPrimitiveInputNotificationContent as fn, EmbeddedChatPrimitiveInputNotificationHeader as Sn, EmbeddedChatPrimitiveInputNotificationMessage as En, EmbeddedChatPrimitiveInputNotificationTitle as In, EmbeddedChatPrimitiveMessageFile as Mn, EmbeddedChatPrimitiveMessageFiles as An } from "./embedded-chat/file-upload-input.js";
50
+ import { EmbeddedChatPrimitiveDropZone as nn, EmbeddedChatPrimitiveFileContent as sn, EmbeddedChatPrimitiveFileInput as dn, EmbeddedChatPrimitiveFileItem as cn, EmbeddedChatPrimitiveFileList as mn, EmbeddedChatPrimitiveFileName as ln, EmbeddedChatPrimitiveFilePreviewTrigger as un, EmbeddedChatPrimitiveFileRemove as hn, EmbeddedChatPrimitiveFileRemoveIcon as Cn, EmbeddedChatPrimitiveFileThumbnail as bn, EmbeddedChatPrimitiveFileTypeIcon as pn, EmbeddedChatPrimitiveFileUploadButton as gn, EmbeddedChatPrimitiveFileUploadButtonIcon as vn, EmbeddedChatPrimitiveInputFieldset as Fn, EmbeddedChatPrimitiveInputNotification as _n, EmbeddedChatPrimitiveInputNotificationClose as Pn, EmbeddedChatPrimitiveInputNotificationContent as fn, EmbeddedChatPrimitiveInputNotificationHeader as Sn, EmbeddedChatPrimitiveInputNotificationMessage as In, EmbeddedChatPrimitiveInputNotificationTitle as En, EmbeddedChatPrimitiveMessageFile as Mn, EmbeddedChatPrimitiveMessageFiles as An } from "./embedded-chat/file-upload-input.js";
51
51
  import { EmbeddedChatPrimitiveImagePreviewModal as kn, EmbeddedChatPrimitiveImagePreviewModalClose as xn, EmbeddedChatPrimitiveImagePreviewModalContent as Tn, EmbeddedChatPrimitiveImagePreviewModalFileName as Hn, EmbeddedChatPrimitiveImagePreviewModalFooter as Ln, EmbeddedChatPrimitiveImagePreviewModalImage as wn, EmbeddedChatPrimitiveImagePreviewModalOverlay as Dn } from "./embedded-chat/image-preview-modal.js";
52
52
  const ut = "__intro__", ht = 767, Ct = i("div", {
53
53
  _id: "aiChatWrapper"
@@ -99,7 +99,7 @@ const Lo = Q((t, e) => {
99
99
  }), bt = i("div", {
100
100
  _id: "aiChatRoot"
101
101
  }), wo = (t) => {
102
- const { isHidden: e } = F(), { form: o } = P();
102
+ const { isHidden: e } = F(), { form: o } = f();
103
103
  return o ? null : /* @__PURE__ */ a(bt, { "data-hidden": g(e), ...t });
104
104
  }, Do = i("div", {
105
105
  _id: "aiChatHeader"
@@ -109,13 +109,13 @@ const Lo = Q((t, e) => {
109
109
  _id: "aiChatHeader__ToolbarHeaderWrapper"
110
110
  }), pt = i(A, {
111
111
  _id: "aiChatHeader__ChatHistoryButtonIcon"
112
- }), Ro = I(
112
+ }), Ro = E(
113
113
  (t) => /* @__PURE__ */ a(pt, { ...t })
114
114
  ), Oo = i("button", {
115
115
  _id: "aiChatHeader__ChatHistoryButton"
116
116
  }), gt = i("div", {
117
117
  _id: "aiChatHeader__ToolbarHeader"
118
- }), Vo = I(
118
+ }), Vo = E(
119
119
  (t) => {
120
120
  const { aiChatSettings: e } = p(), o = `Ask ${e.aiAssistantName || "AI"}`;
121
121
  return /* @__PURE__ */ a(gt, { ...t, children: o });
@@ -168,14 +168,14 @@ const Lo = Q((t, e) => {
168
168
  return /* @__PURE__ */ a(Ft, { children: O(o, e), ...r });
169
169
  }, _t = i("div", {
170
170
  _id: "aiChatDisclaimer"
171
- }), zo = I(
171
+ }), zo = E(
172
172
  (t) => {
173
173
  const { aiChatSettings: e } = p(), [o, r] = $(!1), n = nt(o, 100);
174
174
  return e.disclaimerSettings?.isEnabled ? /* @__PURE__ */ a(st, { open: o, setOpen: r, children: /* @__PURE__ */ a(B.Root, { open: n, onOpenChange: r, children: /* @__PURE__ */ a(_t, { ...t }) }) }) : null;
175
175
  }
176
176
  ), Pt = i("span", {
177
177
  _id: "aiChatDisclaimerLabel"
178
- }), Go = I(
178
+ }), Go = E(
179
179
  (t) => {
180
180
  const { aiChatSettings: e } = p(), o = e.disclaimerSettings;
181
181
  return /* @__PURE__ */ a(Pt, { children: o?.label, ...t });
@@ -183,7 +183,7 @@ const Lo = Q((t, e) => {
183
183
  ), ft = i(B.Trigger, {
184
184
  _id: "aiChatDisclaimerTrigger",
185
185
  children: /* @__PURE__ */ a(A, { iconKey: "info" })
186
- }), Yo = I(
186
+ }), Yo = E(
187
187
  (t) => {
188
188
  const { setOpen: e } = de();
189
189
  return /* @__PURE__ */ a(
@@ -211,30 +211,30 @@ const Lo = Q((t, e) => {
211
211
  ...t
212
212
  }
213
213
  );
214
- }, Et = i(q, {
214
+ }, It = i(q, {
215
215
  _id: "aiChatDisclaimerText"
216
- }), Jo = I(
216
+ }), Jo = E(
217
217
  (t) => {
218
218
  const { aiChatSettings: e } = p(), o = e.aiAssistantName, n = e.disclaimerSettings?.tooltip || `Information provided by ${o || "this AI assistant"} is not guaranteed to be accurate or comprehensive.`;
219
- return /* @__PURE__ */ a(Et, { shouldOpenLinksInNewTab: !0, children: n, ...t });
219
+ return /* @__PURE__ */ a(It, { shouldOpenLinksInNewTab: !0, children: n, ...t });
220
220
  }
221
221
  ), Xo = i(B.Arrow, {
222
222
  _id: "aiChatDisclaimerArrow"
223
- }), It = i("div", {
223
+ }), Et = i("div", {
224
224
  _id: "aiChatExampleQuestions"
225
225
  }), ea = (t) => {
226
226
  const { aiChatSettings: e } = p(), { messages: o } = F();
227
- return !e.exampleQuestions?.length || o.length ? null : /* @__PURE__ */ a(It, { ...t });
227
+ return !e.exampleQuestions?.length || o.length ? null : /* @__PURE__ */ a(Et, { ...t });
228
228
  }, Mt = i("h3", {
229
229
  _id: "aiChatExampleQuestionsLabel"
230
- }), ta = I(
230
+ }), ta = E(
231
231
  (t) => {
232
232
  const { aiChatSettings: e } = p();
233
233
  return /* @__PURE__ */ a(Mt, { children: e.exampleQuestionsLabel, ...t });
234
234
  }
235
235
  ), At = i("div", {
236
236
  _id: "aiChatExampleQuestionsList"
237
- }), ia = I(
237
+ }), ia = E(
238
238
  (t) => {
239
239
  const { aiChatSettings: e } = p(), o = e.exampleQuestions, { children: r, ...n } = t;
240
240
  return /* @__PURE__ */ a(At, { children: O(r, o), ...n });
@@ -261,7 +261,7 @@ const Lo = Q((t, e) => {
261
261
  }), Tt = (t) => {
262
262
  const { message: e, ...o } = t;
263
263
  return e.role === "system" ? null : /* @__PURE__ */ a(qe, { message: e, children: /* @__PURE__ */ a(xt, { "data-role": e.role, ...o }) });
264
- }, ra = I(
264
+ }, ra = E(
265
265
  (t) => {
266
266
  const { message: e, ...o } = t, { aiChatSettings: r, baseSettings: n } = p(), s = r.aiAssistantName, d = s ? `Hi, I'm ${s}!` : "Hi!", c = r.chatSubjectName ?? n.organizationDisplayName, m = c ? `
267
267
 
@@ -278,7 +278,7 @@ const Lo = Q((t, e) => {
278
278
  ), Ht = i("div", {
279
279
  _id: "aiChatMessageHeader"
280
280
  }), na = (t) => {
281
- const { message: e } = E();
281
+ const { message: e } = P();
282
282
  return /* @__PURE__ */ a(Ht, { "data-role": e.role, ...t });
283
283
  }, Lt = i("div", {
284
284
  _id: "aiChatMessageLoading",
@@ -286,12 +286,12 @@ const Lo = Q((t, e) => {
286
286
  }), sa = (t) => /* @__PURE__ */ a(Lt, { ...t }), wt = i("div", {
287
287
  _id: "aiChatMessageAvatar"
288
288
  }), da = (t) => {
289
- const { message: e } = E();
289
+ const { message: e } = P();
290
290
  return /* @__PURE__ */ a(wt, { "data-role": e.role, ...t });
291
291
  }, Dt = i(Y.Root, {
292
292
  _id: "aiChatMessageAvatarContent"
293
293
  }), ca = (t) => {
294
- const { message: e } = E(), { baseSettings: o } = p();
294
+ const { message: e } = P(), { baseSettings: o } = p();
295
295
  return /* @__PURE__ */ a(
296
296
  Dt,
297
297
  {
@@ -302,9 +302,9 @@ const Lo = Q((t, e) => {
302
302
  );
303
303
  }, Bt = i(Y.Fallback, {
304
304
  _id: "aiChatMessageAvatarFallback"
305
- }), ma = I(
305
+ }), ma = E(
306
306
  (t) => {
307
- const { baseSettings: e } = p(), { message: o } = E();
307
+ const { baseSettings: e } = p(), { message: o } = P();
308
308
  return e.userProperties.name ? /* @__PURE__ */ a(
309
309
  Bt,
310
310
  {
@@ -316,12 +316,12 @@ const Lo = Q((t, e) => {
316
316
  }
317
317
  ), te = i(Y.Image, {
318
318
  _id: "aiChatMessageAvatarImage"
319
- }), la = I(
319
+ }), la = E(
320
320
  (t) => {
321
321
  const { onLoadingStatusChange: e, ...o } = t, {
322
322
  aiChatSettings: r,
323
323
  baseSettings: { userProperties: n }
324
- } = p(), { message: s } = E(), { aiAssistantAvatar: d } = r ?? {}, c = typeof d == "string" ? d : d?.light, m = (typeof d == "string" ? d : d?.dark) ?? c, l = at(c, m), [u, C] = $(l);
324
+ } = p(), { message: s } = P(), { aiAssistantAvatar: d } = r ?? {}, c = typeof d == "string" ? d : d?.light, m = (typeof d == "string" ? d : d?.dark) ?? c, l = at(c, m), [u, C] = $(l);
325
325
  W(() => {
326
326
  C(l);
327
327
  }, [l]);
@@ -369,7 +369,7 @@ const Lo = Q((t, e) => {
369
369
  ), Nt = i("span", {
370
370
  _id: "aiChatMessageName"
371
371
  }), ua = (t) => {
372
- const { message: e } = E(), { aiChatSettings: o } = p(), { aiAssistantName: r } = o;
372
+ const { message: e } = P(), { aiChatSettings: o } = p(), { aiAssistantName: r } = o;
373
373
  return /* @__PURE__ */ a(
374
374
  Nt,
375
375
  {
@@ -381,12 +381,12 @@ const Lo = Q((t, e) => {
381
381
  }, Rt = i("div", {
382
382
  _id: "aiChatMessageContentWrapper"
383
383
  }), ha = (t) => {
384
- const { message: e } = E();
384
+ const { message: e } = P();
385
385
  return /* @__PURE__ */ a(Rt, { "data-role": e.role, ...t });
386
386
  }, Ot = i("div", {
387
387
  _id: "aiChatMessageContent"
388
388
  }), Ca = (t) => {
389
- const { message: e } = E();
389
+ const { message: e } = P();
390
390
  return /* @__PURE__ */ a(Ot, { "data-role": e.role, ...t });
391
391
  }, ba = (t) => {
392
392
  const { text: e, componentStyles: o, ...r } = t, { aiChatSettings: n } = p(), { shouldOpenLinksInNewTab: s } = n;
@@ -410,39 +410,39 @@ const Lo = Q((t, e) => {
410
410
  }, [o]);
411
411
  const _ = v.current, M = D(e);
412
412
  M.current = e;
413
- const f = D(null), x = D(_);
414
- x.current !== _ && (f.current = null, x.current = _), W(() => {
413
+ const S = D(null), x = D(_);
414
+ x.current !== _ && (S.current = null, x.current = _), W(() => {
415
415
  s.current || (s.current = `dyn:${t}:${crypto.randomUUID()}`, u(!0));
416
416
  }, [t]), he(() => {
417
417
  if (!_ || !n || !l || !s.current)
418
418
  return;
419
- const T = s.current, S = document.createElement("div");
420
- return S.setAttribute("data-ikp-component", ""), S.setAttribute("data-component", t), S.setAttribute("slot", T), d.current = S, m.current = !1, n.appendChild(S), h(!0), () => {
419
+ const T = s.current, I = document.createElement("div");
420
+ return I.setAttribute("data-ikp-component", ""), I.setAttribute("data-component", t), I.setAttribute("slot", T), d.current = I, m.current = !1, n.appendChild(I), h(!0), () => {
421
421
  m.current = !0, h(!1), queueMicrotask(() => {
422
422
  try {
423
423
  c.current && (c.current.unmount(), c.current = null);
424
424
  } catch (H) {
425
425
  console.debug("Ignoring unmount error:", H);
426
426
  }
427
- S.parentNode === n && S.remove(), d.current = null;
427
+ I.parentNode === n && I.remove(), d.current = null;
428
428
  });
429
429
  };
430
430
  }, [_, n, l, t]);
431
431
  const V = (T) => {
432
- const S = d.current;
433
- if (!S || m.current) return;
432
+ const I = d.current;
433
+ if (!I || m.current) return;
434
434
  const H = (w) => {
435
- if (f.current !== null) return f.current;
435
+ if (S.current !== null) return S.current;
436
436
  if (typeof w != "function" || w.length > 1)
437
- return f.current = !1, !1;
437
+ return S.current = !1, !1;
438
438
  try {
439
439
  if (w.constructor === Function) {
440
440
  const ue = w({});
441
- return f.current = j.isValidElement(ue), f.current;
441
+ return S.current = j.isValidElement(ue), S.current;
442
442
  }
443
- return f.current = !1, !1;
443
+ return S.current = !1, !1;
444
444
  } catch {
445
- return f.current = !0, !0;
445
+ return S.current = !0, !0;
446
446
  }
447
447
  };
448
448
  let y;
@@ -458,14 +458,14 @@ const Lo = Q((t, e) => {
458
458
  return;
459
459
  }
460
460
  else if (typeof L == "function")
461
- y = L(T || {}, S, null);
461
+ y = L(T || {}, I, null);
462
462
  else {
463
463
  console.error("Invalid component definition");
464
464
  return;
465
465
  }
466
466
  if (j.isValidElement(y) || typeof y == "string") {
467
467
  if (m.current) return;
468
- c.current || (c.current = Ce.createRoot(S)), !m.current && c.current && c.current.render(y);
468
+ c.current || (c.current = Ce.createRoot(I)), !m.current && c.current && c.current.render(y);
469
469
  return;
470
470
  }
471
471
  c.current && !m.current && c.current.render(null);
@@ -480,24 +480,25 @@ const Lo = Q((t, e) => {
480
480
  }), Vt = i("div", {
481
481
  _id: "aiChatMessageToolbar"
482
482
  }), va = (t) => {
483
- const { isLoading: e, messages: o } = F(), { message: r } = E();
483
+ const { isLoading: e, messages: o } = F(), { message: r } = P();
484
484
  return o.at(-1)?.id === r?.id && e || r.role === "user" ? null : /* @__PURE__ */ a(Vt, { ...t });
485
485
  }, Wt = i("div", {
486
486
  _id: "aiChatMessageCustomActions"
487
487
  }), Fa = (t) => {
488
- const { children: e, ...o } = t, { aiChatSettings: r } = p(), { message: n } = E(), { isStreaming: s, messages: d } = F(), c = d.at(-1)?.id === n?.id, m = n.role === "assistant", l = r.messageActions || [];
488
+ const { children: e, ...o } = t, { aiChatSettings: r } = p(), { message: n } = P(), { isStreaming: s, messages: d } = F(), c = d.at(-1)?.id === n?.id, m = n.role === "assistant", l = r.messageActions || [];
489
489
  return c && s || !m ? null : /* @__PURE__ */ a(Wt, { children: O(e, l), ...o });
490
490
  }, Qt = i("a", {
491
491
  _id: "aiChatMessageCustomAction"
492
492
  }), Ut = i("button", {
493
493
  _id: "aiChatMessageCustomAction"
494
494
  }), _a = (t) => {
495
- const { onClick: e, action: o, ...r } = t, { message: n } = E(), { handleAction: s } = J(o, n.id), { logEvent: d } = ee(), { conversationId: c } = F(), m = () => {
495
+ const { onClick: e, action: o, ...r } = t, { message: n } = P(), { handleAction: s } = J(o, n.id), { logEvent: d } = ee(), { conversationId: c } = F(), m = () => {
496
496
  s(), d({
497
497
  eventName: "user_escalation_indicated",
498
498
  properties: {
499
499
  escalationType: "contact_us",
500
- conversationId: c
500
+ conversationId: c,
501
+ messageId: n.id
501
502
  }
502
503
  });
503
504
  }, l = o.label, u = /* @__PURE__ */ G(ie, { children: [
@@ -527,14 +528,15 @@ const Lo = Q((t, e) => {
527
528
  }, $t = i("button", {
528
529
  _id: "aiChatMessageAction"
529
530
  }), Pa = (t) => {
530
- const { action: e, onClick: o, className: r, ...n } = t, { conversationId: s } = F(), { message: d } = E(), { isStreaming: c, messages: m } = F(), [l, u] = z(), { feedback: C, submitPositiveFeedback: h, setCurrentFeedback: v, currentFeedback: _ } = Z(), { logEvent: M } = ee(), [f, x] = Ge(), V = m.at(-1)?.id === d?.id, T = d.role === "assistant";
531
+ const { action: e, onClick: o, className: r, ...n } = t, { conversationId: s } = F(), { message: d } = P(), { isStreaming: c, messages: m } = F(), [l, u] = z(), { feedback: C, submitPositiveFeedback: h, setCurrentFeedback: v, currentFeedback: _ } = Z(), { logEvent: M } = ee(), [S, x] = Ge(), V = m.at(-1)?.id === d?.id, T = d.role === "assistant";
531
532
  if (V && c || !T) return null;
532
533
  const H = {
533
534
  copy() {
534
535
  u(se(d)), M({
535
536
  eventName: "assistant_message_copied",
536
537
  properties: {
537
- conversationId: s
538
+ conversationId: s,
539
+ messageId: d.id
538
540
  }
539
541
  });
540
542
  },
@@ -552,7 +554,7 @@ const Lo = Q((t, e) => {
552
554
  downvote: "Downvote Message"
553
555
  }, L = {
554
556
  copy: /* @__PURE__ */ a(A, { iconKey: l ? "messageCopied" : "messageCopy" }),
555
- upvote: /* @__PURE__ */ a(A, { iconKey: f ? "messageCopied" : "thumbsUp" }),
557
+ upvote: /* @__PURE__ */ a(A, { iconKey: S ? "messageCopied" : "thumbsUp" }),
556
558
  downvote: /* @__PURE__ */ a(A, { iconKey: "thumbsDown" })
557
559
  }, w = {
558
560
  copy: { "data-copied": g(l) },
@@ -579,14 +581,14 @@ const Lo = Q((t, e) => {
579
581
  }, Kt = i("div", {
580
582
  _id: "aiChatMessageSources"
581
583
  }), fa = (t) => {
582
- const { message: e } = E();
584
+ const { message: e } = P();
583
585
  return e.role !== "assistant" || !e.parts.filter(ne).filter((r) => !!r.data?.artifactSummary?.url)?.length ? null : /* @__PURE__ */ a(Kt, { ...t });
584
586
  }, qt = i("div", {
585
587
  _id: "aiChatMessageSources__Header"
586
588
  }), Sa = (t) => /* @__PURE__ */ a(qt, { children: "Sources", ...t }), jt = i("div", {
587
589
  _id: "aiChatMessageSources__List"
588
- }), Ea = (t) => {
589
- const { message: e } = E(), { children: o, ...r } = t, {
590
+ }), Ia = (t) => {
591
+ const { message: e } = P(), { children: o, ...r } = t, {
590
592
  baseSettings: { transformSource: n, organizationDisplayName: s },
591
593
  aiChatSettings: { shouldOpenLinksInNewTab: d },
592
594
  searchSettings: { tabs: c }
@@ -614,18 +616,19 @@ const Lo = Q((t, e) => {
614
616
  })))(v, "chatSourceItem", {
615
617
  organizationDisplayName: s,
616
618
  tabs: c
617
- }), f = M.shouldOpenInNewTab !== void 0 ? M.shouldOpenInNewTab : d;
618
- return { ...M, isExternal: f };
619
+ }), S = M.shouldOpenInNewTab !== void 0 ? M.shouldOpenInNewTab : d;
620
+ return { ...M, isExternal: S };
619
621
  });
620
622
  return /* @__PURE__ */ a(jt, { children: O(o, u), ...r });
621
623
  }, zt = i($e, {
622
624
  _id: "aiChatMessageSourceItem"
623
- }), Ia = (t) => {
624
- const { source: e, onClick: o, ...r } = t, { logEvent: n } = ee(), { conversationId: s } = F(), d = () => {
625
+ }), Ea = (t) => {
626
+ const { source: e, onClick: o, ...r } = t, { logEvent: n } = ee(), { conversationId: s } = F(), { message: d } = P(), c = () => {
625
627
  n({
626
628
  eventName: "assistant_source_item_clicked",
627
629
  properties: {
628
630
  conversationId: s,
631
+ messageId: d.id,
629
632
  link: e
630
633
  }
631
634
  });
@@ -637,7 +640,7 @@ const Lo = Q((t, e) => {
637
640
  appendToUrl: e.appendToUrl,
638
641
  isExternal: e.isExternal,
639
642
  "data-breadcrumbs": !!e.breadcrumbs?.length,
640
- onClick: b(o, d),
643
+ onClick: b(o, c),
641
644
  ...r
642
645
  }
643
646
  ) });
@@ -776,7 +779,7 @@ const Lo = Q((t, e) => {
776
779
  help: () => {
777
780
  },
778
781
  copy: () => {
779
- const S = m.map((H) => {
782
+ const I = m.map((H) => {
780
783
  const y = `**${H.role === "assistant" ? "AI Assistant" : "User"}**`, L = se(H);
781
784
  return `${y}
782
785
 
@@ -786,7 +789,7 @@ ${L}`;
786
789
  ---
787
790
 
788
791
  `);
789
- h(S);
792
+ h(I);
790
793
  },
791
794
  share: async () => {
792
795
  },
@@ -872,7 +875,7 @@ ${L}`;
872
875
  return d === "open_link" ? /* @__PURE__ */ a(mi, { href: e.action.url, ...c }) : /* @__PURE__ */ a(ci, { ...c });
873
876
  }, li = i(B.Trigger, {
874
877
  _id: "aiChatHelpActions__Trigger"
875
- }), ja = I(
878
+ }), ja = E(
876
879
  (t) => {
877
880
  const { aiChatSettings: e } = p();
878
881
  return /* @__PURE__ */ a(me, { action: "help", ...t, asChild: !0, children: /* @__PURE__ */ a(li, { children: e.toolbarButtonLabels?.getHelp ?? "Get Help" }) });
@@ -967,12 +970,12 @@ ${L}`;
967
970
  }), pi = i("div", {
968
971
  _id: "aiChatForm__Wrapper"
969
972
  }), cr = (t) => {
970
- const { form: e } = P();
973
+ const { form: e } = f();
971
974
  return e ? /* @__PURE__ */ a(pi, { ...t }) : null;
972
975
  }, gi = i("form", {
973
976
  _id: "aiChatForm"
974
977
  }), mr = (t) => {
975
- const { onSubmit: e, ...o } = t, { conversationId: r, messages: n } = F(), { handleSubmit: s, isSuccess: d } = P();
978
+ const { onSubmit: e, ...o } = t, { conversationId: r, messages: n } = F(), { handleSubmit: s, isSuccess: d } = f();
976
979
  return d ? null : /* @__PURE__ */ a(
977
980
  gi,
978
981
  {
@@ -987,29 +990,29 @@ ${L}`;
987
990
  _id: "aiChatForm__Close",
988
991
  children: /* @__PURE__ */ a(A, { iconKey: "close" })
989
992
  }), lr = (t) => {
990
- const { onClick: e, ...o } = t, { closeForm: r } = P();
993
+ const { onClick: e, ...o } = t, { closeForm: r } = f();
991
994
  return /* @__PURE__ */ a(vi, { onClick: b(e, r), ...o });
992
995
  }, ur = i("div", {
993
996
  _id: "aiChatForm__Header"
994
997
  }), Fi = i("h2", {
995
998
  _id: "aiChatForm__Heading"
996
999
  }), hr = (t) => {
997
- const { form: e } = P();
1000
+ const { form: e } = f();
998
1001
  return e?.heading ? /* @__PURE__ */ a(Fi, { children: e.heading, ...t }) : null;
999
1002
  }, _i = i(q, {
1000
1003
  _id: "aiChatForm__Description"
1001
1004
  }), Cr = (t) => {
1002
- const { form: e } = P();
1005
+ const { form: e } = f();
1003
1006
  return e?.description ? /* @__PURE__ */ a(_i, { shouldOpenLinksInNewTab: !0, children: e.description, ...t }) : null;
1004
1007
  }, Pi = i("div", {
1005
1008
  _id: "aiChatForm__Content"
1006
1009
  }), br = (t) => {
1007
- const { children: e, ...o } = t, { getFields: r } = P(), { conversationId: n } = F(), s = r(n) || [];
1010
+ const { children: e, ...o } = t, { getFields: r } = f(), { conversationId: n } = F(), s = r(n) || [];
1008
1011
  return /* @__PURE__ */ a(Pi, { children: O(e, s), ...o });
1009
1012
  }, fi = i("div", {
1010
1013
  _id: "aiChatForm__Field"
1011
1014
  }), pr = (t) => {
1012
- const { field: e, autoFocus: o, ...r } = t, { control: n, errors: s } = P();
1015
+ const { field: e, autoFocus: o, ...r } = t, { control: n, errors: s } = f();
1013
1016
  return /* @__PURE__ */ a(
1014
1017
  tt,
1015
1018
  {
@@ -1051,7 +1054,7 @@ ${L}`;
1051
1054
  ...t
1052
1055
  }
1053
1056
  );
1054
- }, Ei = i("input", {
1057
+ }, Ii = i("input", {
1055
1058
  _id: "aiChatForm__FieldText",
1056
1059
  type: "text"
1057
1060
  }), le = (t) => {
@@ -1062,7 +1065,7 @@ ${L}`;
1062
1065
  autoFocus: d
1063
1066
  } = k(), { onChange: c, onBlur: m, ...l } = t;
1064
1067
  return /* @__PURE__ */ a(
1065
- Ei,
1068
+ Ii,
1066
1069
  {
1067
1070
  id: e.name,
1068
1071
  autoFocus: d,
@@ -1077,7 +1080,7 @@ ${L}`;
1077
1080
  }, vr = i(le, {
1078
1081
  _id: "aiChatForm__FieldEmail",
1079
1082
  type: "email"
1080
- }), Ii = i("input", {
1083
+ }), Ei = i("input", {
1081
1084
  _id: "aiChatForm__FieldFile",
1082
1085
  type: "file",
1083
1086
  multiple: !0
@@ -1092,7 +1095,7 @@ ${L}`;
1092
1095
  n(v);
1093
1096
  };
1094
1097
  return /* @__PURE__ */ a(
1095
- Ii,
1098
+ Ei,
1096
1099
  {
1097
1100
  id: e.name,
1098
1101
  autoFocus: c,
@@ -1142,11 +1145,11 @@ ${L}`;
1142
1145
  ...s
1143
1146
  }
1144
1147
  );
1145
- }, Er = i(_e, {
1148
+ }, Ir = i(_e, {
1146
1149
  _id: "aiChatForm__FieldSelect__Trigger"
1147
1150
  }), yi = i(Se, {
1148
1151
  _id: "aiChatForm__FieldSelect__Value"
1149
- }), Ir = (t) => {
1152
+ }), Er = (t) => {
1150
1153
  const { field: e } = k();
1151
1154
  return /* @__PURE__ */ a(
1152
1155
  yi,
@@ -1192,7 +1195,7 @@ ${L}`;
1192
1195
  ...s
1193
1196
  };
1194
1197
  return /* @__PURE__ */ a(
1195
- Ie,
1198
+ Ee,
1196
1199
  {
1197
1200
  ...C
1198
1201
  }
@@ -1229,7 +1232,7 @@ ${L}`;
1229
1232
  ), Qr = i(
1230
1233
  Te,
1231
1234
  { _id: "aiChatForm__FieldCombobox__ItemIndicator" }
1232
- ), Ur = Ee, $r = i(
1235
+ ), Ur = Ie, $r = i(
1233
1236
  Le,
1234
1237
  { _id: "aiChatForm__FieldCombobox__ListEmpty" }
1235
1238
  ), Bi = i("p", {
@@ -1245,7 +1248,7 @@ ${L}`;
1245
1248
  }, Ri = i("span", {
1246
1249
  _id: "aiChatForm__Error"
1247
1250
  }), jr = (t) => {
1248
- const { formError: e } = P();
1251
+ const { formError: e } = f();
1249
1252
  return e ? /* @__PURE__ */ a(Ri, { children: e.message, ...t }) : null;
1250
1253
  }, zr = i("div", {
1251
1254
  _id: "aiChatForm__Footer"
@@ -1254,29 +1257,29 @@ ${L}`;
1254
1257
  children: "Cancel",
1255
1258
  type: "button"
1256
1259
  }), Gr = (t) => {
1257
- const { onClick: e, ...o } = t, { closeForm: r } = P();
1260
+ const { onClick: e, ...o } = t, { closeForm: r } = f();
1258
1261
  return /* @__PURE__ */ a(Oi, { onClick: b(e, r), ...o });
1259
1262
  }, Vi = i("button", {
1260
1263
  _id: "aiChatForm__Submit",
1261
1264
  children: "Submit",
1262
1265
  type: "submit"
1263
1266
  }), Yr = (t) => {
1264
- const { onClick: e, ...o } = t, { isSubmitting: r, form: n } = P(), s = n?.buttons.submit.label || "Submit";
1267
+ const { onClick: e, ...o } = t, { isSubmitting: r, form: n } = f(), s = n?.buttons.submit.label || "Submit";
1265
1268
  return /* @__PURE__ */ a(Vi, { disabled: r, ...o, children: s });
1266
1269
  }, Wi = i("div", {
1267
1270
  _id: "aiChatForm__Success"
1268
1271
  }), Zr = (t) => {
1269
- const { isSuccess: e } = P();
1272
+ const { isSuccess: e } = f();
1270
1273
  return e ? /* @__PURE__ */ a(Wi, { ...t }) : null;
1271
1274
  }, Qi = i("h2", {
1272
1275
  _id: "aiChatForm__SuccessHeading"
1273
1276
  }), Jr = (t) => {
1274
- const { form: e } = P();
1277
+ const { form: e } = f();
1275
1278
  return /* @__PURE__ */ a(Qi, { children: e?.successView?.heading, ...t });
1276
1279
  }, Ui = i(q, {
1277
1280
  _id: "aiChatForm__SuccessMessage"
1278
1281
  }), Xr = (t) => {
1279
- const { form: e } = P();
1282
+ const { form: e } = f();
1280
1283
  return /* @__PURE__ */ a(
1281
1284
  Ui,
1282
1285
  {
@@ -1288,7 +1291,7 @@ ${L}`;
1288
1291
  }, $i = i("button", {
1289
1292
  _id: "aiChatForm__SuccessButton"
1290
1293
  }), en = (t) => {
1291
- const { onClick: e, ...o } = t, { form: r, closeForm: n } = P(), s = r?.successView?.doneButton;
1294
+ const { onClick: e, ...o } = t, { form: r, closeForm: n } = f(), s = r?.successView?.doneButton;
1292
1295
  if (!s) return null;
1293
1296
  const d = s.icon && /* @__PURE__ */ a(N, { iconSettings: s.icon }), c = s.label;
1294
1297
  return /* @__PURE__ */ a(
@@ -1397,8 +1400,8 @@ export {
1397
1400
  kr as EmbeddedChatPrimitiveFormFieldSelectItem,
1398
1401
  Tr as EmbeddedChatPrimitiveFormFieldSelectItemIndicator,
1399
1402
  xr as EmbeddedChatPrimitiveFormFieldSelectItemText,
1400
- Er as EmbeddedChatPrimitiveFormFieldSelectTrigger,
1401
- Ir as EmbeddedChatPrimitiveFormFieldSelectValue,
1403
+ Ir as EmbeddedChatPrimitiveFormFieldSelectTrigger,
1404
+ Er as EmbeddedChatPrimitiveFormFieldSelectValue,
1402
1405
  yr as EmbeddedChatPrimitiveFormFieldSelectViewport,
1403
1406
  le as EmbeddedChatPrimitiveFormFieldText,
1404
1407
  _r as EmbeddedChatPrimitiveFormFieldTextArea,
@@ -1434,7 +1437,7 @@ export {
1434
1437
  na as EmbeddedChatPrimitiveMessageHeader,
1435
1438
  sa as EmbeddedChatPrimitiveMessageLoading,
1436
1439
  ua as EmbeddedChatPrimitiveMessageName,
1437
- Ia as EmbeddedChatPrimitiveMessageSourceItem,
1440
+ Ea as EmbeddedChatPrimitiveMessageSourceItem,
1438
1441
  Ma as EmbeddedChatPrimitiveMessageSourceItemBreadcrumbs,
1439
1442
  Ta as EmbeddedChatPrimitiveMessageSourceItemDescription,
1440
1443
  Ha as EmbeddedChatPrimitiveMessageSourceItemDescriptionPart,
@@ -1444,7 +1447,7 @@ export {
1444
1447
  ka as EmbeddedChatPrimitiveMessageSourceItemTitle,
1445
1448
  fa as EmbeddedChatPrimitiveMessageSources,
1446
1449
  Sa as EmbeddedChatPrimitiveMessageSourcesHeader,
1447
- Ea as EmbeddedChatPrimitiveMessageSourcesList,
1450
+ Ia as EmbeddedChatPrimitiveMessageSourcesList,
1448
1451
  va as EmbeddedChatPrimitiveMessageToolbar,
1449
1452
  Tt as EmbeddedChatPrimitiveMessageWrapper,
1450
1453
  jo as EmbeddedChatPrimitiveMessages,
@@ -1519,8 +1522,8 @@ export {
1519
1522
  kr as FormFieldSelectItem,
1520
1523
  Tr as FormFieldSelectItemIndicator,
1521
1524
  xr as FormFieldSelectItemText,
1522
- Er as FormFieldSelectTrigger,
1523
- Ir as FormFieldSelectValue,
1525
+ Ir as FormFieldSelectTrigger,
1526
+ Er as FormFieldSelectValue,
1524
1527
  yr as FormFieldSelectViewport,
1525
1528
  le as FormFieldText,
1526
1529
  _r as FormFieldTextArea,
@@ -1556,8 +1559,8 @@ export {
1556
1559
  Pn as InputNotificationClose,
1557
1560
  fn as InputNotificationContent,
1558
1561
  Sn as InputNotificationHeader,
1559
- En as InputNotificationMessage,
1560
- In as InputNotificationTitle,
1562
+ In as InputNotificationMessage,
1563
+ En as InputNotificationTitle,
1561
1564
  ra as IntroMessageWrapper,
1562
1565
  ba as Markdown,
1563
1566
  Pa as MessageAction,
@@ -1574,7 +1577,7 @@ export {
1574
1577
  na as MessageHeader,
1575
1578
  sa as MessageLoading,
1576
1579
  ua as MessageName,
1577
- Ia as MessageSourceItem,
1580
+ Ea as MessageSourceItem,
1578
1581
  Aa as MessageSourceItemBreadcrumbIcon,
1579
1582
  Ma as MessageSourceItemBreadcrumbs,
1580
1583
  Ta as MessageSourceItemDescription,
@@ -1585,7 +1588,7 @@ export {
1585
1588
  ka as MessageSourceItemTitle,
1586
1589
  fa as MessageSources,
1587
1590
  Sa as MessageSourcesHeader,
1588
- Ea as MessageSourcesList,
1591
+ Ia as MessageSourcesList,
1589
1592
  va as MessageToolbar,
1590
1593
  Tt as MessageWrapper,
1591
1594
  jo as Messages,
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react"),p=require("./use-inkeep-api-client.cjs"),v=()=>{};function d({baseUrl:e,appId:i,authToken:t,getCaptchaHeader:r,invalidateCaptcha:c,refreshSession:a}){const{fetchWithAuth:o}=p.useInkeepApiClient({appId:i,authToken:t,getCaptchaHeader:r,invalidateCaptcha:c??v,refreshSession:a});return{logEvent:l.useCallback(async({body:u})=>{if(!(!e||!t))try{const n=`${e}/run/v1/events`,s=await o(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!s.ok){console.warn(`[events-api] log failed: ${s.status}`);return}return s.json()}catch(n){console.warn("[events-api] log threw",n)}},[e,t,o])}}exports.useEventsApi=d;