@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.
- package/dist/atoms/icons/built-in-icons.cjs +1 -1
- package/dist/atoms/icons/built-in-icons.js +44 -41
- package/dist/atoms/icons/inkeep-default-icons.cjs +1 -1
- package/dist/atoms/icons/inkeep-default-icons.js +1 -0
- package/dist/atoms/markdown/components.cjs +1 -1
- package/dist/atoms/markdown/components.js +27 -24
- package/dist/atoms/markdown/index.cjs +1 -1
- package/dist/atoms/markdown/index.js +54 -41
- package/dist/components/embedded-chat/use-inkeep-chat.cjs +3 -3
- package/dist/components/embedded-chat/use-inkeep-chat.js +127 -126
- package/dist/components/embedded-search/search-query.graphql.cjs +7 -0
- package/dist/components/embedded-search/search-query.graphql.js +7 -0
- package/dist/components/embedded-search/use-inkeep-search.cjs +1 -1
- package/dist/components/embedded-search/use-inkeep-search.js +98 -92
- package/dist/components/embedded-search.cjs +1 -1
- package/dist/components/embedded-search.js +426 -277
- package/dist/index.d.cts +141 -2
- package/dist/index.d.ts +141 -2
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.cjs +1 -1
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.js +29 -17
- package/dist/providers/base-events-provider.cjs +1 -1
- package/dist/providers/base-events-provider.js +1 -1
- package/dist/utils/component-ids.cjs +1 -1
- package/dist/utils/component-ids.js +29 -13
- package/dist/utils/default-settings.cjs +1 -1
- package/dist/utils/default-settings.js +4 -3
- package/dist/utils/transform-source/icon.cjs +1 -1
- package/dist/utils/transform-source/icon.js +1 -1
- 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"),
|
|
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
|
|
3
|
-
import { FiEdit as
|
|
4
|
-
import { IoOpenOutline as
|
|
5
|
-
import {
|
|
6
|
-
const
|
|
7
|
-
FaBook:
|
|
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:
|
|
11
|
-
FaChrome:
|
|
12
|
-
FaPhone:
|
|
13
|
-
FaEnvelope:
|
|
14
|
-
FaPencil:
|
|
15
|
-
FaBlog:
|
|
10
|
+
FaStackOverflow: s,
|
|
11
|
+
FaChrome: O,
|
|
12
|
+
FaPhone: C,
|
|
13
|
+
FaEnvelope: p,
|
|
14
|
+
FaPencil: m,
|
|
15
|
+
FaBlog: c,
|
|
16
16
|
FaSort: h,
|
|
17
|
-
FaPenSquare:
|
|
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:
|
|
42
|
-
IoPeopleOutline:
|
|
41
|
+
IoHelpBuoyOutline: x,
|
|
42
|
+
IoPeopleOutline: G,
|
|
43
43
|
IoDocumentTextOutline: U,
|
|
44
44
|
IoChatbubblesOutline: y,
|
|
45
45
|
FaRegFilePdf: r,
|
|
46
46
|
IoLogoDiscord: v,
|
|
47
|
-
IoLogoGithub:
|
|
48
|
-
IoTerminal:
|
|
49
|
-
FaBriefcase:
|
|
47
|
+
IoLogoGithub: B,
|
|
48
|
+
IoTerminal: R,
|
|
49
|
+
FaBriefcase: a,
|
|
50
50
|
IoPlayCircleOutline: P,
|
|
51
|
-
IoPencilOutline:
|
|
52
|
-
IoCheckmarkDoneOutline:
|
|
53
|
-
IoHomeOutline:
|
|
54
|
-
IoMail:
|
|
55
|
-
IoOpenOutline:
|
|
56
|
-
FaTelegram:
|
|
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:
|
|
60
|
-
LuCircleCheck:
|
|
61
|
-
LuCommand:
|
|
62
|
-
LuCopy:
|
|
63
|
-
LuCheck:
|
|
64
|
-
LuCornerDownLeft:
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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:
|
|
73
|
-
LuLoaderCircle:
|
|
74
|
-
FiEdit:
|
|
75
|
-
LuSparkles:
|
|
74
|
+
LuChevronDown: no,
|
|
75
|
+
LuLoaderCircle: eo,
|
|
76
|
+
FiEdit: f,
|
|
77
|
+
LuSparkles: oo,
|
|
78
|
+
LuCornerDownRight: $
|
|
76
79
|
};
|
|
77
80
|
export {
|
|
78
|
-
|
|
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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../components/factory.cjs"),d=require("../link.cjs"),
|
|
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
|
|
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
|
-
}),
|
|
12
|
+
}), t = o("ul", {
|
|
13
13
|
_id: "markdownUl"
|
|
14
|
-
}),
|
|
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
|
-
}),
|
|
22
|
+
}), _ = o("th", {
|
|
23
23
|
_id: "markdownTh"
|
|
24
|
-
}),
|
|
24
|
+
}), b = o("td", {
|
|
25
25
|
_id: "markdownTd"
|
|
26
26
|
}), m = o("code", {
|
|
27
27
|
_id: "markdownCode"
|
|
28
|
-
}),
|
|
28
|
+
}), p = o("div", {
|
|
29
29
|
_id: "codeblockContainer"
|
|
30
|
-
}),
|
|
30
|
+
}), u = o("div", {
|
|
31
31
|
_id: "codeblockHeader"
|
|
32
|
-
}),
|
|
32
|
+
}), C = o("span", {
|
|
33
33
|
_id: "codeblockHeaderLanguage"
|
|
34
|
-
}),
|
|
34
|
+
}), h = o("button", {
|
|
35
35
|
_id: "codeblockCopyButton",
|
|
36
36
|
type: "button"
|
|
37
|
-
}),
|
|
37
|
+
}), M = o("div", {
|
|
38
38
|
_id: "codeblockHighlighterWrapper"
|
|
39
|
-
}),
|
|
39
|
+
}), g = o("div", {
|
|
40
40
|
_id: "codeblockHighlighter"
|
|
41
|
-
}),
|
|
41
|
+
}), H = o("code", {
|
|
42
42
|
_id: "codeblockCode"
|
|
43
|
+
}), L = o("input", {
|
|
44
|
+
_id: "markdownInput"
|
|
43
45
|
});
|
|
44
46
|
export {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
55
|
+
e as MarkdownH1,
|
|
54
56
|
i as MarkdownH2,
|
|
57
|
+
L as MarkdownInput,
|
|
55
58
|
k as MarkdownLi,
|
|
56
59
|
l as MarkdownLink,
|
|
57
|
-
|
|
60
|
+
a as MarkdownOl,
|
|
58
61
|
c as MarkdownP,
|
|
59
62
|
w as MarkdownSourceLink,
|
|
60
63
|
s as MarkdownTable,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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"),
|
|
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})=>``,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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
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:
|
|
14
|
-
onCodeCopy:
|
|
14
|
+
onLinkClick: m,
|
|
15
|
+
onCodeCopy: s,
|
|
15
16
|
...p
|
|
16
17
|
}) => {
|
|
17
|
-
if (!
|
|
18
|
+
if (!l) return null;
|
|
18
19
|
const k = {
|
|
19
|
-
h1: ({ children: r }) => /* @__PURE__ */
|
|
20
|
-
h2: ({ children: r }) => /* @__PURE__ */
|
|
21
|
-
p: ({ children: r }) => /* @__PURE__ */
|
|
22
|
-
li: ({ children: r }) => /* @__PURE__ */
|
|
23
|
-
ul: ({ children: r }) => /* @__PURE__ */
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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:
|
|
38
|
-
const o =
|
|
39
|
-
|
|
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:
|
|
54
|
+
href: e,
|
|
43
55
|
onClick: () => {
|
|
44
|
-
|
|
56
|
+
m?.(e, d?.toString());
|
|
45
57
|
},
|
|
46
|
-
children:
|
|
58
|
+
children: d
|
|
47
59
|
}
|
|
48
60
|
);
|
|
49
|
-
return
|
|
61
|
+
return i ? /* @__PURE__ */ n(L, { children: c }) : c;
|
|
50
62
|
},
|
|
51
|
-
img: ({ src: r, alt:
|
|
52
|
-
table: ({ children: r }) => /* @__PURE__ */
|
|
53
|
-
th: ({ children: r, isHeader:
|
|
54
|
-
pre: ({ children: r }) => /* @__PURE__ */
|
|
55
|
-
code: ({ children: r, inline:
|
|
56
|
-
}, u = /* @__PURE__ */
|
|
57
|
-
|
|
63
|
+
img: ({ src: r, alt: e }) => ``,
|
|
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
|
-
|
|
71
|
+
remarkPlugins: [y],
|
|
72
|
+
rehypePlugins: [M, I],
|
|
60
73
|
components: k,
|
|
61
|
-
disallowedElements:
|
|
62
|
-
children:
|
|
74
|
+
disallowedElements: _,
|
|
75
|
+
children: l.toString(),
|
|
63
76
|
...p
|
|
64
77
|
}
|
|
65
78
|
);
|
|
66
|
-
return /* @__PURE__ */
|
|
67
|
-
},
|
|
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
|
-
|
|
92
|
+
J as Markdown
|
|
80
93
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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.`}},
|
|
4
|
-
${D.serializeWorkflow(e)}`},...
|
|
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;
|