@inkeep/cxkit-primitives 0.5.29 → 0.5.31

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 (29) hide show
  1. package/dist/atoms/icons/built-in-icons.cjs +1 -1
  2. package/dist/atoms/icons/built-in-icons.js +44 -41
  3. package/dist/atoms/icons/inkeep-default-icons.cjs +1 -1
  4. package/dist/atoms/icons/inkeep-default-icons.js +1 -0
  5. package/dist/atoms/markdown/components.cjs +1 -1
  6. package/dist/atoms/markdown/components.js +27 -24
  7. package/dist/atoms/markdown/index.cjs +1 -1
  8. package/dist/atoms/markdown/index.js +54 -41
  9. package/dist/components/embedded-chat/use-inkeep-chat.cjs +3 -3
  10. package/dist/components/embedded-chat/use-inkeep-chat.js +127 -126
  11. package/dist/components/embedded-search/search-query.graphql.cjs +7 -0
  12. package/dist/components/embedded-search/search-query.graphql.js +7 -0
  13. package/dist/components/embedded-search/use-inkeep-search.cjs +1 -1
  14. package/dist/components/embedded-search/use-inkeep-search.js +98 -92
  15. package/dist/components/embedded-search.cjs +1 -1
  16. package/dist/components/embedded-search.js +426 -277
  17. package/dist/index.d.cts +141 -2
  18. package/dist/index.d.ts +141 -2
  19. package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.cjs +1 -1
  20. package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.js +29 -17
  21. package/dist/providers/base-events-provider.cjs +1 -1
  22. package/dist/providers/base-events-provider.js +1 -1
  23. package/dist/utils/component-ids.cjs +1 -1
  24. package/dist/utils/component-ids.js +29 -13
  25. package/dist/utils/default-settings.cjs +1 -1
  26. package/dist/utils/default-settings.js +4 -3
  27. package/dist/utils/transform-source/icon.cjs +1 -1
  28. package/dist/utils/transform-source/icon.js +1 -1
  29. package/package.json +5 -4
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fa6/index.cjs"),a=require("../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fi/index.cjs"),e=require("../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/io5/index.cjs"),n=require("../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.cjs"),u={FaBook:o.FaBook,FaGithub:o.FaGithub,FaDatabase:o.FaDatabase,FaStackOverflow:o.FaStackOverflow,FaChrome:o.FaChrome,FaPhone:o.FaPhone,FaEnvelope:o.FaEnvelope,FaPencil:o.FaPencil,FaBlog:o.FaBlog,FaSort:o.FaSort,FaPenSquare:o.FaPenToSquare,FaChevronRight:o.FaChevronRight,FaChevronUp:o.FaChevronUp,FaFilePdf:o.FaFilePdf,FaDiscourse:o.FaDiscourse,FaDiscord:o.FaDiscord,FaSlack:o.FaSlack,IoDocumentTextSharp:e.IoDocumentTextSharp,IoDocumentSharp:e.IoDocumentSharp,IoSend:e.IoSend,IoInformationCircleOutline:e.IoInformationCircleOutline,IoLinkOutline:e.IoLinkOutline,IoThumbsUpSharp:e.IoThumbsUpSharp,IoThumbsDownSharp:e.IoThumbsDownSharp,IoSearch:e.IoSearch,IoCopyOutline:e.IoCopyOutline,IoCopy:e.IoCopy,IoReturnDownBackOutline:e.IoReturnDownBackOutline,IoChevronForwardOutline:e.IoChevronForwardOutline,IoReturnDownForward:e.IoReturnDownForward,IoCloseOutline:e.IoCloseOutline,IoCheckmarkOutline:e.IoCheckmarkOutline,IoBookOutline:e.IoBookOutline,IoReaderOutline:e.IoReaderOutline,IoHelpBuoyOutline:e.IoHelpBuoyOutline,IoPeopleOutline:e.IoPeopleOutline,IoDocumentTextOutline:e.IoDocumentTextOutline,IoChatbubblesOutline:e.IoChatbubblesOutline,FaRegFilePdf:o.FaRegFilePdf,IoLogoDiscord:e.IoLogoDiscord,IoLogoGithub:e.IoLogoGithub,IoTerminal:e.IoTerminal,FaBriefcase:o.FaBriefcase,IoPlayCircleOutline:e.IoPlayCircleOutline,IoPencilOutline:e.IoPencilOutline,IoCheckmarkDoneOutline:e.IoCheckmarkDoneOutline,IoHomeOutline:e.IoHomeOutline,IoMail:e.IoMail,IoOpenOutline:e.IoOpenOutline,FaTelegram:o.FaTelegram,FaTable:o.FaTable,FaMagnifyingGlass:o.FaMagnifyingGlass,LuArrowLeft:n.LuArrowLeft,LuCircleCheck:n.LuCircleCheck,LuCommand:n.LuCommand,LuCopy:n.LuCopy,LuCheck:n.LuCheck,LuCornerDownLeft:n.LuCornerDownLeft,LuRepeat:n.LuRepeat,LuThumbsDown:n.LuThumbsDown,LuThumbsUp:n.LuThumbsUp,LuUsers:n.LuUsers,LuUser:n.LuUser,LuArrowUpRight:n.LuArrowUpRight,LuBookOpen:n.LuBookOpen,LuChevronDown:n.LuChevronDown,LuLoaderCircle:n.LuLoaderCircle,FiEdit:a.FiEdit,LuSparkles:n.LuSparkles};exports.iconMap=u;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fa6/index.cjs"),u=require("../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fi/index.cjs"),e=require("../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/io5/index.cjs"),n=require("../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.cjs"),a={FaBook:o.FaBook,FaGithub:o.FaGithub,FaDatabase:o.FaDatabase,FaStackOverflow:o.FaStackOverflow,FaChrome:o.FaChrome,FaPhone:o.FaPhone,FaEnvelope:o.FaEnvelope,FaPencil:o.FaPencil,FaBlog:o.FaBlog,FaSort:o.FaSort,FaPenSquare:o.FaPenToSquare,FaChevronRight:o.FaChevronRight,FaChevronUp:o.FaChevronUp,FaFilePdf:o.FaFilePdf,FaDiscourse:o.FaDiscourse,FaDiscord:o.FaDiscord,FaSlack:o.FaSlack,IoDocumentTextSharp:e.IoDocumentTextSharp,IoDocumentSharp:e.IoDocumentSharp,IoSend:e.IoSend,IoInformationCircleOutline:e.IoInformationCircleOutline,IoLinkOutline:e.IoLinkOutline,IoThumbsUpSharp:e.IoThumbsUpSharp,IoThumbsDownSharp:e.IoThumbsDownSharp,IoSearch:e.IoSearch,IoCopyOutline:e.IoCopyOutline,IoCopy:e.IoCopy,IoReturnDownBackOutline:e.IoReturnDownBackOutline,IoChevronForwardOutline:e.IoChevronForwardOutline,IoReturnDownForward:e.IoReturnDownForward,IoCloseOutline:e.IoCloseOutline,IoCheckmarkOutline:e.IoCheckmarkOutline,IoBookOutline:e.IoBookOutline,IoReaderOutline:e.IoReaderOutline,IoHelpBuoyOutline:e.IoHelpBuoyOutline,IoPeopleOutline:e.IoPeopleOutline,IoDocumentTextOutline:e.IoDocumentTextOutline,IoChatbubblesOutline:e.IoChatbubblesOutline,FaRegFilePdf:o.FaRegFilePdf,IoLogoDiscord:e.IoLogoDiscord,IoLogoGithub:e.IoLogoGithub,IoTerminal:e.IoTerminal,FaBriefcase:o.FaBriefcase,IoPlayCircleOutline:e.IoPlayCircleOutline,IoPencilOutline:e.IoPencilOutline,IoCheckmarkDoneOutline:e.IoCheckmarkDoneOutline,IoHomeOutline:e.IoHomeOutline,IoMail:e.IoMail,IoOpenOutline:e.IoOpenOutline,FaTelegram:o.FaTelegram,FaTable:o.FaTable,FaMagnifyingGlass:o.FaMagnifyingGlass,LuArrowLeft:n.LuArrowLeft,LuCircleCheck:n.LuCircleCheck,LuCommand:n.LuCommand,LuCopy:n.LuCopy,LuCheck:n.LuCheck,LuCornerDownLeft:n.LuCornerDownLeft,LuGlobe:n.LuGlobe,LuLink:n.LuLink,LuRepeat:n.LuRepeat,LuThumbsDown:n.LuThumbsDown,LuThumbsUp:n.LuThumbsUp,LuUsers:n.LuUsers,LuUser:n.LuUser,LuArrowUpRight:n.LuArrowUpRight,LuBookOpen:n.LuBookOpen,LuChevronDown:n.LuChevronDown,LuLoaderCircle:n.LuLoaderCircle,FiEdit:u.FiEdit,LuSparkles:n.LuSparkles,LuCornerDownRight:n.LuCornerDownRight};exports.iconMap=a;
@@ -1,20 +1,20 @@
1
1
  "use client";
2
- import { FaMagnifyingGlass as o, FaTable as e, FaTelegram as a, FaBriefcase as n, FaRegFilePdf as r, FaSlack as u, FaDiscord as i, FaDiscourse as t, FaFilePdf as l, FaChevronUp as I, FaChevronRight as F, FaPenToSquare as c, FaSort as h, FaBlog as m, FaPencil as p, FaEnvelope as L, FaPhone as O, FaChrome as s, FaStackOverflow as C, FaDatabase as k, FaGithub as D, FaBook as f } from "../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fa6/index.js";
3
- import { FiEdit as S } from "../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fi/index.js";
4
- import { IoOpenOutline as b, IoMail as d, IoHomeOutline as w, IoCheckmarkDoneOutline as T, IoPencilOutline as g, IoPlayCircleOutline as P, IoTerminal as B, IoLogoGithub as R, IoLogoDiscord as v, IoChatbubblesOutline as y, IoDocumentTextOutline as U, IoPeopleOutline as x, IoHelpBuoyOutline as G, IoReaderOutline as M, IoBookOutline as q, IoCheckmarkOutline as A, IoCloseOutline as E, IoReturnDownForward as H, IoChevronForwardOutline as j, IoReturnDownBackOutline as z, IoCopy as J, IoCopyOutline as K, IoSearch as N, IoThumbsDownSharp as Q, IoThumbsUpSharp as V, IoLinkOutline as W, IoInformationCircleOutline as X, IoSend as Y, IoDocumentSharp as Z, IoDocumentTextSharp as _ } from "../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/io5/index.js";
5
- import { LuSparkles as $, LuLoaderCircle as oo, LuChevronDown as eo, LuBookOpen as ao, LuArrowUpRight as no, LuUser as ro, LuUsers as uo, LuThumbsUp as io, LuThumbsDown as to, LuRepeat as lo, LuCornerDownLeft as Io, LuCheck as Fo, LuCopy as co, LuCommand as ho, LuCircleCheck as mo, LuArrowLeft as po } from "../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.js";
6
- const ko = {
7
- FaBook: f,
2
+ import { FaMagnifyingGlass as o, FaTable as e, FaTelegram as n, FaBriefcase as a, FaRegFilePdf as r, FaSlack as u, FaDiscord as i, FaDiscourse as t, FaFilePdf as l, FaChevronUp as I, FaChevronRight as F, FaPenToSquare as L, FaSort as h, FaBlog as c, FaPencil as m, FaEnvelope as p, FaPhone as C, FaChrome as O, FaStackOverflow as s, FaDatabase as k, FaGithub as D, FaBook as b } from "../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fa6/index.js";
3
+ import { FiEdit as f } from "../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fi/index.js";
4
+ import { IoOpenOutline as w, IoMail as S, IoHomeOutline as d, IoCheckmarkDoneOutline as g, IoPencilOutline as T, IoPlayCircleOutline as P, IoTerminal as R, IoLogoGithub as B, IoLogoDiscord as v, IoChatbubblesOutline as y, IoDocumentTextOutline as U, IoPeopleOutline as G, IoHelpBuoyOutline as x, IoReaderOutline as M, IoBookOutline as q, IoCheckmarkOutline as A, IoCloseOutline as E, IoReturnDownForward as H, IoChevronForwardOutline as j, IoReturnDownBackOutline as z, IoCopy as J, IoCopyOutline as K, IoSearch as N, IoThumbsDownSharp as Q, IoThumbsUpSharp as V, IoLinkOutline as W, IoInformationCircleOutline as X, IoSend as Y, IoDocumentSharp as Z, IoDocumentTextSharp as _ } from "../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/io5/index.js";
5
+ import { LuCornerDownRight as $, LuSparkles as oo, LuLoaderCircle as eo, LuChevronDown as no, LuBookOpen as ao, LuArrowUpRight as ro, LuUser as uo, LuUsers as io, LuThumbsUp as to, LuThumbsDown as lo, LuRepeat as Io, LuLink as Fo, LuGlobe as Lo, LuCornerDownLeft as ho, LuCheck as co, LuCopy as mo, LuCommand as po, LuCircleCheck as Co, LuArrowLeft as Oo } from "../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.js";
6
+ const fo = {
7
+ FaBook: b,
8
8
  FaGithub: D,
9
9
  FaDatabase: k,
10
- FaStackOverflow: C,
11
- FaChrome: s,
12
- FaPhone: O,
13
- FaEnvelope: L,
14
- FaPencil: p,
15
- FaBlog: m,
10
+ FaStackOverflow: s,
11
+ FaChrome: O,
12
+ FaPhone: C,
13
+ FaEnvelope: p,
14
+ FaPencil: m,
15
+ FaBlog: c,
16
16
  FaSort: h,
17
- FaPenSquare: c,
17
+ FaPenSquare: L,
18
18
  FaChevronRight: F,
19
19
  FaChevronUp: I,
20
20
  FaFilePdf: l,
@@ -38,42 +38,45 @@ const ko = {
38
38
  IoCheckmarkOutline: A,
39
39
  IoBookOutline: q,
40
40
  IoReaderOutline: M,
41
- IoHelpBuoyOutline: G,
42
- IoPeopleOutline: x,
41
+ IoHelpBuoyOutline: x,
42
+ IoPeopleOutline: G,
43
43
  IoDocumentTextOutline: U,
44
44
  IoChatbubblesOutline: y,
45
45
  FaRegFilePdf: r,
46
46
  IoLogoDiscord: v,
47
- IoLogoGithub: R,
48
- IoTerminal: B,
49
- FaBriefcase: n,
47
+ IoLogoGithub: B,
48
+ IoTerminal: R,
49
+ FaBriefcase: a,
50
50
  IoPlayCircleOutline: P,
51
- IoPencilOutline: g,
52
- IoCheckmarkDoneOutline: T,
53
- IoHomeOutline: w,
54
- IoMail: d,
55
- IoOpenOutline: b,
56
- FaTelegram: a,
51
+ IoPencilOutline: T,
52
+ IoCheckmarkDoneOutline: g,
53
+ IoHomeOutline: d,
54
+ IoMail: S,
55
+ IoOpenOutline: w,
56
+ FaTelegram: n,
57
57
  FaTable: e,
58
58
  FaMagnifyingGlass: o,
59
- LuArrowLeft: po,
60
- LuCircleCheck: mo,
61
- LuCommand: ho,
62
- LuCopy: co,
63
- LuCheck: Fo,
64
- LuCornerDownLeft: Io,
65
- LuRepeat: lo,
66
- LuThumbsDown: to,
67
- LuThumbsUp: io,
68
- LuUsers: uo,
69
- LuUser: ro,
70
- LuArrowUpRight: no,
59
+ LuArrowLeft: Oo,
60
+ LuCircleCheck: Co,
61
+ LuCommand: po,
62
+ LuCopy: mo,
63
+ LuCheck: co,
64
+ LuCornerDownLeft: ho,
65
+ LuGlobe: Lo,
66
+ LuLink: Fo,
67
+ LuRepeat: Io,
68
+ LuThumbsDown: lo,
69
+ LuThumbsUp: to,
70
+ LuUsers: io,
71
+ LuUser: uo,
72
+ LuArrowUpRight: ro,
71
73
  LuBookOpen: ao,
72
- LuChevronDown: eo,
73
- LuLoaderCircle: oo,
74
- FiEdit: S,
75
- LuSparkles: $
74
+ LuChevronDown: no,
75
+ LuLoaderCircle: eo,
76
+ FiEdit: f,
77
+ LuSparkles: oo,
78
+ LuCornerDownRight: $
76
79
  };
77
80
  export {
78
- ko as iconMap
81
+ fo as iconMap
79
82
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={search:"IoSearch",thumbsUp:"LuThumbsUp",thumbsDown:"LuThumbsDown",messageCopy:"LuCopy",messageCopied:"LuCheck",messageRevise:"FiEdit",codeCopy:"LuCopy",codeCopied:"LuCheck",openLinkInNewTab:"LuArrowUpRight",openLinkInSameTab:"LuCornerDownLeft",breadcrumbSeparator:"FaChevronRight",switchToSearch:"IoSearch",switchToChat:"LuSparkles",chatSubmit:"IoSend",close:"IoCloseOutline",info:"IoInformationCircleOutline",command:"LuCommand"};exports.defaultBuiltInIcons=e;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={search:"IoSearch",thumbsUp:"LuThumbsUp",thumbsDown:"LuThumbsDown",messageCopy:"LuCopy",messageCopied:"LuCheck",messageRevise:"FiEdit",codeCopy:"LuCopy",codeCopied:"LuCheck",openLinkInNewTab:"LuArrowUpRight",openLinkInSameTab:"LuCornerDownLeft",newLine:"LuCornerDownRight",breadcrumbSeparator:"FaChevronRight",switchToSearch:"IoSearch",switchToChat:"LuSparkles",chatSubmit:"IoSend",close:"IoCloseOutline",info:"IoInformationCircleOutline",command:"LuCommand"};exports.defaultBuiltInIcons=e;
@@ -10,6 +10,7 @@ const e = {
10
10
  codeCopied: "LuCheck",
11
11
  openLinkInNewTab: "LuArrowUpRight",
12
12
  openLinkInSameTab: "LuCornerDownLeft",
13
+ newLine: "LuCornerDownRight",
13
14
  breadcrumbSeparator: "FaChevronRight",
14
15
  switchToSearch: "IoSearch",
15
16
  switchToChat: "LuSparkles",
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../components/factory.cjs"),d=require("../link.cjs"),k=o.ikp("h1",{_id:"markdownH1"}),n=o.ikp("h2",{_id:"markdownH2"}),e=o.ikp("p",{_id:"markdownP"}),i=o.ikp("li",{_id:"markdownLi"}),r=o.ikp("ul",{_id:"markdownUl"}),a=o.ikp("ol",{_id:"markdownOl"}),c=o.ikp(d.LinkWithQueryParams,{_id:"markdownLink"}),t=o.ikp("sup",{_id:"markdownSourceLink"}),l=o.ikp("table",{_id:"markdownTable"}),w=o.ikp("th",{_id:"markdownTh"}),p=o.ikp("td",{_id:"markdownTd"}),b=o.ikp("code",{_id:"markdownCode"}),s=o.ikp("div",{_id:"codeblockContainer"}),C=o.ikp("div",{_id:"codeblockHeader"}),M=o.ikp("span",{_id:"codeblockHeaderLanguage"}),g=o.ikp("button",{_id:"codeblockCopyButton",type:"button"}),u=o.ikp("div",{_id:"codeblockHighlighterWrapper"}),h=o.ikp("div",{_id:"codeblockHighlighter"}),_=o.ikp("code",{_id:"codeblockCode"});exports.CodeblockCode=_;exports.CodeblockContainer=s;exports.CodeblockCopyButton=g;exports.CodeblockHeader=C;exports.CodeblockHeaderLanguage=M;exports.CodeblockHighlighter=h;exports.CodeblockHighlighterWrapper=u;exports.MarkdownCode=b;exports.MarkdownH1=k;exports.MarkdownH2=n;exports.MarkdownLi=i;exports.MarkdownLink=c;exports.MarkdownOl=a;exports.MarkdownP=e;exports.MarkdownSourceLink=t;exports.MarkdownTable=l;exports.MarkdownTd=p;exports.MarkdownTh=w;exports.MarkdownUl=r;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../components/factory.cjs"),d=require("../link.cjs"),n=o.ikp("h1",{_id:"markdownH1"}),k=o.ikp("h2",{_id:"markdownH2"}),i=o.ikp("p",{_id:"markdownP"}),e=o.ikp("li",{_id:"markdownLi"}),r=o.ikp("ul",{_id:"markdownUl"}),a=o.ikp("ol",{_id:"markdownOl"}),c=o.ikp(d.LinkWithQueryParams,{_id:"markdownLink"}),t=o.ikp("sup",{_id:"markdownSourceLink"}),l=o.ikp("table",{_id:"markdownTable"}),w=o.ikp("th",{_id:"markdownTh"}),p=o.ikp("td",{_id:"markdownTd"}),b=o.ikp("code",{_id:"markdownCode"}),s=o.ikp("div",{_id:"codeblockContainer"}),M=o.ikp("div",{_id:"codeblockHeader"}),C=o.ikp("span",{_id:"codeblockHeaderLanguage"}),u=o.ikp("button",{_id:"codeblockCopyButton",type:"button"}),g=o.ikp("div",{_id:"codeblockHighlighterWrapper"}),_=o.ikp("div",{_id:"codeblockHighlighter"}),h=o.ikp("code",{_id:"codeblockCode"}),H=o.ikp("input",{_id:"markdownInput"});exports.CodeblockCode=h;exports.CodeblockContainer=s;exports.CodeblockCopyButton=u;exports.CodeblockHeader=M;exports.CodeblockHeaderLanguage=C;exports.CodeblockHighlighter=_;exports.CodeblockHighlighterWrapper=g;exports.MarkdownCode=b;exports.MarkdownH1=n;exports.MarkdownH2=k;exports.MarkdownInput=H;exports.MarkdownLi=e;exports.MarkdownLink=c;exports.MarkdownOl=a;exports.MarkdownP=i;exports.MarkdownSourceLink=t;exports.MarkdownTable=l;exports.MarkdownTd=p;exports.MarkdownTh=w;exports.MarkdownUl=r;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { ikp as o } from "../../components/factory.js";
3
3
  import { LinkWithQueryParams as d } from "../link.js";
4
- const r = o("h1", {
4
+ const e = o("h1", {
5
5
  _id: "markdownH1"
6
6
  }), i = o("h2", {
7
7
  _id: "markdownH2"
@@ -9,9 +9,9 @@ const r = o("h1", {
9
9
  _id: "markdownP"
10
10
  }), k = o("li", {
11
11
  _id: "markdownLi"
12
- }), a = o("ul", {
12
+ }), t = o("ul", {
13
13
  _id: "markdownUl"
14
- }), t = o("ol", {
14
+ }), a = o("ol", {
15
15
  _id: "markdownOl"
16
16
  }), l = o(d, {
17
17
  _id: "markdownLink"
@@ -19,46 +19,49 @@ const r = o("h1", {
19
19
  _id: "markdownSourceLink"
20
20
  }), s = o("table", {
21
21
  _id: "markdownTable"
22
- }), b = o("th", {
22
+ }), _ = o("th", {
23
23
  _id: "markdownTh"
24
- }), _ = o("td", {
24
+ }), b = o("td", {
25
25
  _id: "markdownTd"
26
26
  }), m = o("code", {
27
27
  _id: "markdownCode"
28
- }), C = o("div", {
28
+ }), p = o("div", {
29
29
  _id: "codeblockContainer"
30
- }), h = o("div", {
30
+ }), u = o("div", {
31
31
  _id: "codeblockHeader"
32
- }), p = o("span", {
32
+ }), C = o("span", {
33
33
  _id: "codeblockHeaderLanguage"
34
- }), g = o("button", {
34
+ }), h = o("button", {
35
35
  _id: "codeblockCopyButton",
36
36
  type: "button"
37
- }), u = o("div", {
37
+ }), M = o("div", {
38
38
  _id: "codeblockHighlighterWrapper"
39
- }), H = o("div", {
39
+ }), g = o("div", {
40
40
  _id: "codeblockHighlighter"
41
- }), M = o("code", {
41
+ }), H = o("code", {
42
42
  _id: "codeblockCode"
43
+ }), L = o("input", {
44
+ _id: "markdownInput"
43
45
  });
44
46
  export {
45
- M as CodeblockCode,
46
- C as CodeblockContainer,
47
- g as CodeblockCopyButton,
48
- h as CodeblockHeader,
49
- p as CodeblockHeaderLanguage,
50
- H as CodeblockHighlighter,
51
- u as CodeblockHighlighterWrapper,
47
+ H as CodeblockCode,
48
+ p as CodeblockContainer,
49
+ h as CodeblockCopyButton,
50
+ u as CodeblockHeader,
51
+ C as CodeblockHeaderLanguage,
52
+ g as CodeblockHighlighter,
53
+ M as CodeblockHighlighterWrapper,
52
54
  m as MarkdownCode,
53
- r as MarkdownH1,
55
+ e as MarkdownH1,
54
56
  i as MarkdownH2,
57
+ L as MarkdownInput,
55
58
  k as MarkdownLi,
56
59
  l as MarkdownLink,
57
- t as MarkdownOl,
60
+ a as MarkdownOl,
58
61
  c as MarkdownP,
59
62
  w as MarkdownSourceLink,
60
63
  s as MarkdownTable,
61
- _ as MarkdownTd,
62
- b as MarkdownTh,
63
- a as MarkdownUl
64
+ b as MarkdownTd,
65
+ _ as MarkdownTh,
66
+ t as MarkdownUl
64
67
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("react"),m=require("react-markdown"),M=require("rehype-raw"),y=require("../../providers/markdown-provider.cjs"),g=require("../codeblock/index.cjs"),n=require("./components.cjs"),b=require("./rehype-inline-code-property.cjs");const f=({children:c,componentStyles:a,shouldOpenLinksInNewTab:h,onLinkClick:u,onCodeCopy:k,...p})=>{if(!c)return null;const w={h1:({children:r})=>e.jsx(n.MarkdownH1,{children:r}),h2:({children:r})=>e.jsx(n.MarkdownH2,{children:r}),p:({children:r})=>e.jsx(n.MarkdownP,{children:r}),li:({children:r})=>e.jsx(n.MarkdownLi,{children:r}),ul:({children:r})=>e.jsx(n.MarkdownUl,{children:r}),ol:({children:r,node:o})=>{const t=o?.properties?.start,i=typeof t=="number"?t:void 0;return e.jsx(n.MarkdownOl,{style:{"--start":t?.toString()??"0"},start:i,children:r})},a:({children:r,href:o})=>{const t=x.Children.toArray(r),i=t[0],d=typeof i=="string"&&/^\(\d+\)$/.test(i)&&t.length===1,s=d?i.match(/\d+/):r,l=e.jsx(n.MarkdownLink,{isExternal:h,href:o,onClick:()=>{u?.(o,s?.toString())},children:s});return d?e.jsx(n.MarkdownSourceLink,{children:l}):l},img:({src:r,alt:o})=>`![${o||""}](${r||""})`,table:({children:r})=>e.jsx(n.MarkdownTable,{children:r}),th:({children:r,isHeader:o})=>o?e.jsx(n.MarkdownTh,{children:r}):e.jsx(n.MarkdownTd,{children:r}),pre:({children:r})=>e.jsx("pre",{children:r}),code:({children:r,inline:o,className:t})=>o?e.jsx(n.MarkdownCode,{children:r}):e.jsx(g.CodeBlock,{className:t,onCopy:k,children:r})},j=e.jsx(m,{rehypePlugins:[M,b.rehypeInlineCodeProperty],components:w,disallowedElements:C,children:c.toString(),...p});return e.jsx(y.ChatMarkdownProvider,{componentStyles:a,children:j})},C=["script","iframe","frame","embed","meta","base","form","style","object"];exports.Markdown=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),j=require("react"),x=require("react-markdown"),M=require("rehype-raw"),y=require("remark-gfm"),g=require("../../providers/markdown-provider.cjs"),f=require("../codeblock/index.cjs"),n=require("./components.cjs"),b=require("./rehype-inline-code-property.cjs");const q=({children:d,componentStyles:a,shouldOpenLinksInNewTab:h,onLinkClick:u,onCodeCopy:k,...p})=>{if(!d)return null;const m={h1:({children:r})=>e.jsx(n.MarkdownH1,{children:r}),h2:({children:r})=>e.jsx(n.MarkdownH2,{children:r}),p:({children:r})=>e.jsx(n.MarkdownP,{children:r}),li:({children:r})=>e.jsx(n.MarkdownLi,{children:r}),ul:({children:r})=>e.jsx(n.MarkdownUl,{children:r}),input:({type:r,checked:t,disabled:o,readOnly:i,required:c,value:s})=>e.jsx(n.MarkdownInput,{type:r,checked:t,disabled:o,readOnly:i,required:c,value:s}),ol:({children:r,node:t})=>{const o=t?.properties?.start,i=typeof o=="number"?o:void 0;return e.jsx(n.MarkdownOl,{style:{"--start":o?.toString()??"0"},start:i,children:r})},a:({children:r,href:t})=>{const o=j.Children.toArray(r),i=o[0],c=typeof i=="string"&&/^\(\d+\)$/.test(i)&&o.length===1,s=c?i.match(/\d+/):r,l=e.jsx(n.MarkdownLink,{isExternal:h,href:t,onClick:()=>{u?.(t,s?.toString())},children:s});return c?e.jsx(n.MarkdownSourceLink,{children:l}):l},img:({src:r,alt:t})=>`![${t||""}](${r||""})`,table:({children:r})=>e.jsx(n.MarkdownTable,{children:r}),th:({children:r,isHeader:t})=>t?e.jsx(n.MarkdownTh,{children:r}):e.jsx(n.MarkdownTd,{children:r}),pre:({children:r})=>e.jsx("pre",{children:r}),code:({children:r,inline:t,className:o})=>t?e.jsx(n.MarkdownCode,{children:r}):e.jsx(f.CodeBlock,{className:o,onCopy:k,children:r})},w=e.jsx(x,{remarkPlugins:[y],rehypePlugins:[M,b.rehypeInlineCodeProperty],components:m,disallowedElements:C,children:d.toString(),...p});return e.jsx(g.ChatMarkdownProvider,{componentStyles:a,children:w})},C=["script","iframe","frame","embed","meta","base","form","style","object"];exports.Markdown=q;
@@ -1,30 +1,42 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import w from "react";
3
- import f from "react-markdown";
1
+ import { jsx as n } from "react/jsx-runtime";
2
+ import f from "react";
3
+ import w from "react-markdown";
4
4
  import M from "rehype-raw";
5
- import { ChatMarkdownProvider as y } from "../../providers/markdown-provider.js";
6
- import { CodeBlock as g } from "../codeblock/index.js";
7
- import { MarkdownCode as C, MarkdownTh as b, MarkdownTd as S, MarkdownTable as P, MarkdownSourceLink as x, MarkdownOl as L, MarkdownUl as R, MarkdownLi as T, MarkdownP as $, MarkdownH2 as j, MarkdownH1 as v, MarkdownLink as A } from "./components.js";
8
- import { rehypeInlineCodeProperty as E } from "./rehype-inline-code-property.js";
9
- const D = ({
10
- children: i,
5
+ import y from "remark-gfm";
6
+ import { ChatMarkdownProvider as g } from "../../providers/markdown-provider.js";
7
+ import { CodeBlock as C } from "../codeblock/index.js";
8
+ import { MarkdownCode as b, MarkdownTh as P, MarkdownTd as S, MarkdownTable as x, MarkdownSourceLink as L, MarkdownOl as R, MarkdownInput as T, MarkdownUl as $, MarkdownLi as j, MarkdownP as v, MarkdownH2 as A, MarkdownH1 as E, MarkdownLink as H } from "./components.js";
9
+ import { rehypeInlineCodeProperty as I } from "./rehype-inline-code-property.js";
10
+ const J = ({
11
+ children: l,
11
12
  componentStyles: a,
12
13
  shouldOpenLinksInNewTab: h,
13
- onLinkClick: s,
14
- onCodeCopy: m,
14
+ onLinkClick: m,
15
+ onCodeCopy: s,
15
16
  ...p
16
17
  }) => {
17
- if (!i) return null;
18
+ if (!l) return null;
18
19
  const k = {
19
- h1: ({ children: r }) => /* @__PURE__ */ e(v, { children: r }),
20
- h2: ({ children: r }) => /* @__PURE__ */ e(j, { children: r }),
21
- p: ({ children: r }) => /* @__PURE__ */ e($, { children: r }),
22
- li: ({ children: r }) => /* @__PURE__ */ e(T, { children: r }),
23
- ul: ({ children: r }) => /* @__PURE__ */ e(R, { children: r }),
24
- ol: ({ children: r, node: n }) => {
25
- const o = n?.properties?.start, t = typeof o == "number" ? o : void 0;
26
- return /* @__PURE__ */ e(
27
- L,
20
+ h1: ({ children: r }) => /* @__PURE__ */ n(E, { children: r }),
21
+ h2: ({ children: r }) => /* @__PURE__ */ n(A, { children: r }),
22
+ p: ({ children: r }) => /* @__PURE__ */ n(v, { children: r }),
23
+ li: ({ children: r }) => /* @__PURE__ */ n(j, { children: r }),
24
+ ul: ({ children: r }) => /* @__PURE__ */ n($, { children: r }),
25
+ input: ({ type: r, checked: e, disabled: o, readOnly: t, required: i, value: d }) => /* @__PURE__ */ n(
26
+ T,
27
+ {
28
+ type: r,
29
+ checked: e,
30
+ disabled: o,
31
+ readOnly: t,
32
+ required: i,
33
+ value: d
34
+ }
35
+ ),
36
+ ol: ({ children: r, node: e }) => {
37
+ const o = e?.properties?.start, t = typeof o == "number" ? o : void 0;
38
+ return /* @__PURE__ */ n(
39
+ R,
28
40
  {
29
41
  style: {
30
42
  "--start": o?.toString() ?? "0"
@@ -34,37 +46,38 @@ const D = ({
34
46
  }
35
47
  );
36
48
  },
37
- a: ({ children: r, href: n }) => {
38
- const o = w.Children.toArray(r), t = o[0], d = typeof t == "string" && /^\(\d+\)$/.test(t) && o.length === 1, c = d ? t.match(/\d+/) : r, l = /* @__PURE__ */ e(
39
- A,
49
+ a: ({ children: r, href: e }) => {
50
+ const o = f.Children.toArray(r), t = o[0], i = typeof t == "string" && /^\(\d+\)$/.test(t) && o.length === 1, d = i ? t.match(/\d+/) : r, c = /* @__PURE__ */ n(
51
+ H,
40
52
  {
41
53
  isExternal: h,
42
- href: n,
54
+ href: e,
43
55
  onClick: () => {
44
- s?.(n, c?.toString());
56
+ m?.(e, d?.toString());
45
57
  },
46
- children: c
58
+ children: d
47
59
  }
48
60
  );
49
- return d ? /* @__PURE__ */ e(x, { children: l }) : l;
61
+ return i ? /* @__PURE__ */ n(L, { children: c }) : c;
50
62
  },
51
- img: ({ src: r, alt: n }) => `![${n || ""}](${r || ""})`,
52
- table: ({ children: r }) => /* @__PURE__ */ e(P, { children: r }),
53
- th: ({ children: r, isHeader: n }) => n ? /* @__PURE__ */ e(b, { children: r }) : /* @__PURE__ */ e(S, { children: r }),
54
- pre: ({ children: r }) => /* @__PURE__ */ e("pre", { children: r }),
55
- code: ({ children: r, inline: n, className: o }) => n ? /* @__PURE__ */ e(C, { children: r }) : /* @__PURE__ */ e(g, { className: o, onCopy: m, children: r })
56
- }, u = /* @__PURE__ */ e(
57
- f,
63
+ img: ({ src: r, alt: e }) => `![${e || ""}](${r || ""})`,
64
+ table: ({ children: r }) => /* @__PURE__ */ n(x, { children: r }),
65
+ th: ({ children: r, isHeader: e }) => e ? /* @__PURE__ */ n(P, { children: r }) : /* @__PURE__ */ n(S, { children: r }),
66
+ pre: ({ children: r }) => /* @__PURE__ */ n("pre", { children: r }),
67
+ code: ({ children: r, inline: e, className: o }) => e ? /* @__PURE__ */ n(b, { children: r }) : /* @__PURE__ */ n(C, { className: o, onCopy: s, children: r })
68
+ }, u = /* @__PURE__ */ n(
69
+ w,
58
70
  {
59
- rehypePlugins: [M, E],
71
+ remarkPlugins: [y],
72
+ rehypePlugins: [M, I],
60
73
  components: k,
61
- disallowedElements: H,
62
- children: i.toString(),
74
+ disallowedElements: _,
75
+ children: l.toString(),
63
76
  ...p
64
77
  }
65
78
  );
66
- return /* @__PURE__ */ e(y, { componentStyles: a, children: u });
67
- }, H = [
79
+ return /* @__PURE__ */ n(g, { componentStyles: a, children: u });
80
+ }, _ = [
68
81
  "script",
69
82
  "iframe",
70
83
  "frame",
@@ -76,5 +89,5 @@ const D = ({
76
89
  "object"
77
90
  ];
78
91
  export {
79
- D as Markdown
92
+ J as Markdown
80
93
  };
@@ -1,4 +1,4 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const qe=require("openai"),t=require("react"),Ee=require("../../atoms/api/analytics/conversation.cjs"),Ne=require("../../providers/config-provider.cjs"),_e=require("../../providers/conversation-provider.cjs"),Ae=require("../../providers/chat-events-provider.cjs"),D=require("../../utils/get-message-metadata.cjs"),Re=require("../../utils/misc.cjs"),ee=require("../../utils/reset-query-params.cjs"),$e=require("../../providers/chat-form-provider.cjs"),De=require("../../providers/widget-provider.cjs"),Le=require("../../hooks/use-media-query.cjs"),Oe=require("./use-captcha.cjs"),xe=require("../modal/modal-provider.cjs"),Fe=()=>{const{chatId:m,setConversation:te,conversation:se,resetConversation:ne}=_e.useInkeepConversation(),{baseSettings:I,aiChatSettings:L}=Ne.useInkeepConfig(),{aiApiBaseUrl:O,shouldBypassCaptcha:x,filters:F}=I,K=xe.useModal(),{getSolution:oe,prefetchSolution:k,invalidateSolution:T}=Oe.useCaptcha({fetchUrl:`${O}/v1/challenge`,shouldBypassCaptcha:x,shouldMakeInitialRequest:K?K.isOpen:!0}),ae=new qe({baseURL:`${O}/v1`,apiKey:I.apiKey,dangerouslyAllowBrowser:!0}),{onInputMessageChange:re,tools:ie,prompts:ce,model:le,onToolCall:ue,filters:U}=L,[h,E]=t.useState(""),B=t.useRef(null);t.useEffect(()=>{re?.(h)},[h]);const[u,l]=t.useState([]),[Q,p]=t.useState(!1),[ge,f]=t.useState(!1),[de,W]=t.useState(null),[N,J]=t.useState(null),[v,y]=t.useState([]),me=e=>{y(s=>[...s,e])},[he,z]=t.useState({}),i=t.useRef([]),S=t.useRef(null),{logEvent:b}=Ae.useChatEvents(),H=ce?.map((e,s)=>({id:`system-${Date.now().toString()}-${s}`,role:"system",content:e})),[pe,fe]=t.useState(!!m);t.useEffect(()=>{if(m){const{apiKey:e,analyticsApiBaseUrl:s}=I;Ee.getConversation(m,e,s).then(n=>{if(n){console.log("res",n),b({eventName:"shared_chat_loaded",properties:{conversation:n}}),fe(!1),te({...n,id:""});const o=n.messages.map(c=>({id:Date.now().toString()+c.id,content:Re.parseIfJson(c.content),role:c.role,links:c.links}));l(o),i.current=o}})}},[m]);const ve=e=>{switch(e.code){case 400:return e.message;case 403:return`There seems to be a configuration error. Please contact ${I.organizationDisplayName??"Administrator"}`;default:return`Hmm..
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ee=require("openai"),t=require("react"),$e=require("../../atoms/api/analytics/conversation.cjs"),Ue=require("../../providers/config-provider.cjs"),Ne=require("../../providers/conversation-provider.cjs"),_e=require("../../providers/chat-events-provider.cjs"),D=require("../../utils/get-message-metadata.cjs"),Ae=require("../../utils/misc.cjs"),te=require("../../utils/reset-query-params.cjs"),Re=require("../../providers/chat-form-provider.cjs"),De=require("../../providers/widget-provider.cjs"),Le=require("../../hooks/use-media-query.cjs"),Oe=require("./use-captcha.cjs"),xe=require("../modal/modal-provider.cjs"),m=require("../../utils/generate-uid.cjs"),Fe=()=>{const{chatId:h,setConversation:se,conversation:ne,resetConversation:oe}=Ne.useInkeepConversation(),{baseSettings:k,aiChatSettings:L}=Ue.useInkeepConfig(),{aiApiBaseUrl:O,shouldBypassCaptcha:x,filters:F}=k,K=xe.useModal(),{getSolution:ae,prefetchSolution:b,invalidateSolution:T}=Oe.useCaptcha({fetchUrl:`${O}/v1/challenge`,shouldBypassCaptcha:x,shouldMakeInitialRequest:K?K.isOpen:!0}),re=new Ee({baseURL:`${O}/v1`,apiKey:k.apiKey,dangerouslyAllowBrowser:!0}),{onInputMessageChange:ie,tools:ce,prompts:le,model:ue,onToolCall:ge,filters:B}=L,[p,$]=t.useState(""),Q=t.useRef(null);t.useEffect(()=>{ie?.(p)},[p]);const[u,l]=t.useState([]),[W,f]=t.useState(!1),[de,v]=t.useState(!1),[me,J]=t.useState(null),[U,z]=t.useState(null),[y,S]=t.useState([]),he=e=>{S(s=>[...s,e])},[pe,H]=t.useState({}),i=t.useRef([]),C=t.useRef(null),{logEvent:q}=_e.useChatEvents(),j=le?.map((e,s)=>({id:`system-${Date.now().toString()}-${m.generateUid(4)}-${s}`,role:"system",content:e})),[fe,ve]=t.useState(!!h);t.useEffect(()=>{if(h){const{apiKey:e,analyticsApiBaseUrl:s}=k;$e.getConversation(h,e,s).then(n=>{if(n){q({eventName:"shared_chat_loaded",properties:{conversation:n}}),ve(!1),se({...n,id:""});const o=n.messages.map(c=>({id:Date.now().toString()+m.generateUid(4)+c.id,content:Ae.parseIfJson(c.content),role:c.role,links:c.links}));l(o),i.current=o}})}},[h]);const ye=e=>{switch(e.code){case 400:return e.message;case 403:return`There seems to be a configuration error. Please contact ${k.organizationDisplayName??"Administrator"}`;default:return`Hmm..
2
2
 
3
- It seems I might be having some issues right now. Please clear the chat and try again.`}},j=e=>{W(e),l(s=>{const n=[...s],o=n[n.length-1];return o&&(o.content=ve(e)),n}),p(!1),f(!1),T(),k()},_=!h.trim()&&!v.length||Q,ye=e=>{e.key==="Enter"&&!e.shiftKey&&!_&&!e.nativeEvent.isComposing&&(e.preventDefault(),A())},Se=e=>{const s=e.target.value;E(s)},A=async(e=h)=>{if(_&&(!e||e.trim().length===0))return;p(!0);const s=N?u.length===2:u.length===0,n=D.getMessageMetadata(N,v,s);let o;const c=D.serializeAttachments(v);v.length&&c?o=[{type:"text",text:c}]:o=e;const V={id:`${Date.now().toString()}1`,role:"user",content:o,metadata:n},P=[...u.length?[]:H,V];m&&ee.resetQueryParams(),l(C=>[...C,...P]),i.current=[...i.current,...P],y([]),E(""),b({eventName:"user_message_submitted",properties:{}},i.current);try{const C={model:le,messages:i.current,stream:!0,tools:ie,tool_choice:"auto"},X=await oe(),Y=X?btoa(JSON.stringify(X)):null,Z=F||U?JSON.stringify({...F,...U}):void 0,q={};!x&&Y&&(q["X-INKEEP-CHALLENGE-SOLUTION"]=Y),Z&&(q["inkeep-filters"]=Z);const M=ae.beta.chat.completions.stream(C,Object.keys(q).length>0?{headers:q}:void 0),a={id:`${Date.now().toString()}2`,role:"assistant",content:"",links:[]};l(g=>[...g,a]),M.on("content",(g,R)=>{f(!0),a.content=R,l($=>{const r=[...$],d=r.findIndex(w=>w.id===a.id);return d===-1?[...r,a]:(r[d]={...a},r)})}),M.on("tool_calls.function.arguments.done",g=>{const{name:R,arguments:$}=g;if(R==="provideLinks"){const r=JSON.parse($);r.links?.length>0&&(a.links=r.links,l(d=>{const w=[...d],be=w.findIndex(Pe=>Pe.id===a.id);return w[be]={...a},w}))}else{const r=ue?.(g);r&&z(d=>({...d,[a.id]:[...d[a.id]||[],r]}))}}),M.on("error",g=>{j(g)}),M.finalChatCompletion().then(()=>{i.current=[...i.current,a],S.current=null,p(!1),f(!1),k(),b({eventName:"assistant_message_received",properties:{}},i.current)}),S.current=M.controller}catch(C){j(C),p(!1),f(!1)}},Ce=()=>{S.current&&(S.current.abort(),S.current=null),p(!1),f(!1),k()},G=()=>{W(null),l([]),i.current=[],ne(),z({}),y([]),ee.resetQueryParams(),J(null),T(),k(),b({eventName:"chat_clear_button_clicked",properties:{conversation:se}})},Me=e=>{J(e);const{initialReplyMessage:s,displayName:n}=e,o={id:u.length.toString(),role:"user",content:n},c={id:(u.length+1).toString(),role:"assistant",content:s,links:[]},P=[{id:`system-${Date.now().toString()}-${e.id}`,role:"system",content:`Company has asked user to follow this guided workflow:
4
- ${D.serializeWorkflow(e)}`},...H,o,c];l(P),y([])},{openForm:we}=$e.useChatForm(),Ie=De.useWidget();t.useImperativeHandle(L.chatFunctionsRef,()=>({submitMessage:A,updateInputMessage(e){E(e)},clearChat:G,openForm:e=>{Ie?.setView("chat"),we(e)},focusInput:()=>{B.current?.focus()}}));const ke=Le.useMediaQuery("(max-width: 768px)");return{messages:u,input:h,isLoading:Q,isStreaming:ge,isLoadingConversation:pe,error:de,isSubmitDisabled:_,handleInputChange:Se,handleInputKeyDown:ye,handleSubmit:A,stop:Ce,clear:G,handleWorkflow:Me,selectedWorkflow:N,messageAttachments:v,setMessageAttachments:y,addAttachment:me,messageToolCalls:he,isEmpty:u.length===0,inputRef:B,isMobile:ke}};exports.useInkeepChat=Fe;
3
+ It seems I might be having some issues right now. Please clear the chat and try again.`}},G=e=>{J(e),l(s=>{const n=[...s],o=n[n.length-1];return o&&(o.content=ye(e)),n}),f(!1),v(!1),T(),b()},N=!p.trim()&&!y.length||W,Se=e=>{e.key==="Enter"&&!e.shiftKey&&!N&&!e.nativeEvent.isComposing&&(e.preventDefault(),_())},Ce=e=>{const s=e.target.value;$(s)},_=async(e=p)=>{if(N&&(!e||e.trim().length===0))return;f(!0);const s=U?u.length===2:u.length===0,n=D.getMessageMetadata(U,y,s);let o;const c=D.serializeAttachments(y);y.length&&c?o=[{type:"text",text:c}]:o=e;const X={id:`${Date.now().toString()}-${m.generateUid(4)}-1`,role:"user",content:o,metadata:n},P=[...u.length?[]:j,X];h&&te.resetQueryParams(),l(M=>[...M,...P]),i.current=[...i.current,...P],S([]),$(""),q({eventName:"user_message_submitted",properties:{}},i.current);try{const M={model:ue,messages:i.current,stream:!0,tools:ce,tool_choice:"auto"},Y=await ae(),Z=Y?btoa(JSON.stringify(Y)):null,ee=F||B?JSON.stringify({...F,...B}):void 0,E={};!x&&Z&&(E["X-INKEEP-CHALLENGE-SOLUTION"]=Z),ee&&(E["inkeep-filters"]=ee);const w=re.beta.chat.completions.stream(M,Object.keys(E).length>0?{headers:E}:void 0),a={id:`${Date.now().toString()}-${m.generateUid(4)}-2`,role:"assistant",content:"",links:[]};l(g=>[...g,a]),w.on("content",(g,A)=>{v(!0),a.content=A,l(R=>{const r=[...R],d=r.findIndex(I=>I.id===a.id);return d===-1?[...r,a]:(r[d]={...a},r)})}),w.on("tool_calls.function.arguments.done",g=>{const{name:A,arguments:R}=g;if(A==="provideLinks"){const r=JSON.parse(R);r.links?.length>0&&(a.links=r.links,l(d=>{const I=[...d],qe=I.findIndex(Pe=>Pe.id===a.id);return I[qe]={...a},I}))}else{const r=ge?.(g);r&&H(d=>({...d,[a.id]:[...d[a.id]||[],r]}))}}),w.on("error",g=>{G(g)}),w.finalChatCompletion().then(()=>{i.current=[...i.current,a],C.current=null,f(!1),v(!1),b(),q({eventName:"assistant_message_received",properties:{}},i.current)}),C.current=w.controller}catch(M){G(M),f(!1),v(!1)}},Me=()=>{C.current&&(C.current.abort(),C.current=null),f(!1),v(!1),b()},V=()=>{J(null),l([]),i.current=[],oe(),H({}),S([]),te.resetQueryParams(),z(null),T(),b(),q({eventName:"chat_clear_button_clicked",properties:{conversation:ne}})},we=e=>{z(e);const{initialReplyMessage:s,displayName:n}=e,o={id:u.length.toString()+m.generateUid(4),role:"user",content:n},c={id:(u.length+1).toString()+m.generateUid(4),role:"assistant",content:s,links:[]},P=[{id:`system-${Date.now().toString()}-${m.generateUid(4)}-${e.id}`,role:"system",content:`Company has asked user to follow this guided workflow:
4
+ ${D.serializeWorkflow(e)}`},...j,o,c];l(P),S([])},{openForm:Ie}=Re.useChatForm(),ke=De.useWidget();t.useImperativeHandle(L.chatFunctionsRef,()=>({submitMessage:_,updateInputMessage(e){$(e)},clearChat:V,openForm:e=>{ke?.setView("chat"),Ie(e)},focusInput:()=>{Q.current?.focus()}}));const be=Le.useMediaQuery("(max-width: 768px)");return{messages:u,input:p,isLoading:W,isStreaming:de,isLoadingConversation:fe,error:me,isSubmitDisabled:N,handleInputChange:Ce,handleInputKeyDown:Se,handleSubmit:_,stop:Me,clear:V,handleWorkflow:we,selectedWorkflow:U,messageAttachments:y,setMessageAttachments:S,addAttachment:he,messageToolCalls:pe,isEmpty:u.length===0,inputRef:Q,isMobile:be}};exports.useInkeepChat=Fe;