@inkeep/agents-ui 0.14.11 → 0.14.13
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/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.cjs +2 -2
- package/dist/primitives/components/embedded-chat/use-inkeep-chat.js +59 -54
- package/dist/primitives/components/embedded-chat/use-stream-processor.cjs +1 -1
- package/dist/primitives/components/embedded-chat/use-stream-processor.js +80 -100
- package/dist/primitives/components/embedded-search/use-search-filter.cjs +1 -1
- package/dist/primitives/components/embedded-search/use-search-filter.js +1 -1
- package/dist/primitives/hooks/use-streaming-events.cjs +1 -1
- package/dist/primitives/hooks/use-streaming-events.js +19 -126
- package/dist/primitives/providers/base-events-provider.cjs +1 -1
- package/dist/primitives/providers/base-events-provider.js +1 -1
- package/dist/react/embedded-chat.cjs +1 -1
- package/dist/react/embedded-chat.js +123 -120
- package/dist/styled/components/data-summary-group.cjs +1 -1
- package/dist/styled/components/data-summary-group.js +44 -34
- package/dist/styled/components/embedded-search.cjs +1 -1
- package/dist/styled/components/embedded-search.js +1 -1
- package/dist/styled/components/message.cjs +1 -1
- package/dist/styled/components/message.js +39 -39
- package/dist/styled/inkeep.css.cjs +2 -9
- package/dist/styled/inkeep.css.js +2 -9
- package/dist/types/types.d.cts +6 -4
- package/dist/types/types.d.ts +6 -4
- package/package.json +1 -1
|
@@ -1,140 +1,33 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { useShadow as
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { useRef as c, useCallback as o } from "react";
|
|
3
|
+
import { useShadow as u } from "../atoms/shadow/context.js";
|
|
4
|
+
function v() {
|
|
5
|
+
const e = u()?.shadowHost, n = c(""), s = o((t) => {
|
|
6
|
+
n.current = t;
|
|
7
|
+
}, []), r = o(
|
|
8
|
+
(t, a) => {
|
|
9
|
+
if (!e) {
|
|
10
|
+
console.warn("useStreamingEvents: No host element available for parent event emission");
|
|
9
11
|
return;
|
|
10
12
|
}
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const i = new CustomEvent(`ikp-${t}`, {
|
|
14
|
+
detail: {
|
|
15
|
+
...a,
|
|
16
|
+
conversationId: n.current,
|
|
17
|
+
timestamp: Date.now()
|
|
18
|
+
},
|
|
17
19
|
bubbles: !0,
|
|
18
|
-
// Allow event to bubble up
|
|
19
20
|
composed: !0
|
|
20
|
-
// Allow event to escape Shadow DOM boundary
|
|
21
|
-
});
|
|
22
|
-
r.dispatchEvent(a);
|
|
23
|
-
},
|
|
24
|
-
[r]
|
|
25
|
-
), m = o((t) => {
|
|
26
|
-
c.current = t;
|
|
27
|
-
}, []), l = o(
|
|
28
|
-
(t) => {
|
|
29
|
-
e({
|
|
30
|
-
kind: "text:delta",
|
|
31
|
-
data: { text: t }
|
|
32
|
-
});
|
|
33
|
-
},
|
|
34
|
-
[e]
|
|
35
|
-
), u = o(
|
|
36
|
-
(t, n, a) => {
|
|
37
|
-
e({
|
|
38
|
-
kind: "stream:error",
|
|
39
|
-
data: {
|
|
40
|
-
message: t,
|
|
41
|
-
agent: n,
|
|
42
|
-
severity: "error",
|
|
43
|
-
code: a
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
},
|
|
47
|
-
[e]
|
|
48
|
-
), g = o(
|
|
49
|
-
(t, n) => {
|
|
50
|
-
e({
|
|
51
|
-
kind: "agent:reasoning",
|
|
52
|
-
data: { agentId: t, parts: n }
|
|
53
|
-
});
|
|
54
|
-
},
|
|
55
|
-
[e]
|
|
56
|
-
), v = o(
|
|
57
|
-
(t, n, a) => {
|
|
58
|
-
e({
|
|
59
|
-
kind: "agent:generate",
|
|
60
|
-
data: { agentId: t, parts: n, generationType: a }
|
|
61
|
-
});
|
|
62
|
-
},
|
|
63
|
-
[e]
|
|
64
|
-
), f = o(
|
|
65
|
-
(t, n, a, i, s, d) => {
|
|
66
|
-
e({
|
|
67
|
-
kind: "tool:execution",
|
|
68
|
-
data: { agentId: t, toolName: n, args: a, result: i, toolId: s, duration: d }
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
|
-
[e]
|
|
72
|
-
), k = o(
|
|
73
|
-
(t, n, a, i) => {
|
|
74
|
-
e({
|
|
75
|
-
kind: "agent:transfer",
|
|
76
|
-
data: { fromAgent: t, targetAgent: n, reason: a, context: i }
|
|
77
|
-
});
|
|
78
|
-
},
|
|
79
|
-
[e]
|
|
80
|
-
), E = o(
|
|
81
|
-
(t, n, a, i, s) => {
|
|
82
|
-
e({
|
|
83
|
-
kind: "delegation:sent",
|
|
84
|
-
data: { delegationId: t, fromAgent: n, targetAgent: a, taskDescription: i, context: s }
|
|
85
|
-
});
|
|
86
|
-
},
|
|
87
|
-
[e]
|
|
88
|
-
), p = o(
|
|
89
|
-
(t, n, a, i) => {
|
|
90
|
-
e({
|
|
91
|
-
kind: "delegation:returned",
|
|
92
|
-
data: { delegationId: t, fromAgent: n, targetAgent: a, result: i }
|
|
93
|
-
});
|
|
94
|
-
},
|
|
95
|
-
[e]
|
|
96
|
-
), h = o(
|
|
97
|
-
(t, n, a, i, s, d, b) => {
|
|
98
|
-
e({
|
|
99
|
-
kind: "artifact:saved",
|
|
100
|
-
data: { artifactId: t, taskId: n, toolCallId: a, artifactType: i, summaryData: s, fullData: d, metadata: b }
|
|
101
|
-
});
|
|
102
|
-
},
|
|
103
|
-
[e]
|
|
104
|
-
), w = o(
|
|
105
|
-
(t, n) => {
|
|
106
|
-
e({
|
|
107
|
-
kind: "completion",
|
|
108
|
-
data: { agent: t, iteration: n }
|
|
109
|
-
});
|
|
110
|
-
},
|
|
111
|
-
[e]
|
|
112
|
-
), S = o(
|
|
113
|
-
(t, n) => {
|
|
114
|
-
e({
|
|
115
|
-
kind: "agent:initializing",
|
|
116
|
-
data: { sessionId: t, graphId: n }
|
|
117
21
|
});
|
|
22
|
+
e.dispatchEvent(i);
|
|
118
23
|
},
|
|
119
24
|
[e]
|
|
120
25
|
);
|
|
121
26
|
return {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
// Convenience methods
|
|
125
|
-
emitTextDelta: l,
|
|
126
|
-
emitStreamError: u,
|
|
127
|
-
emitAgentReasoning: g,
|
|
128
|
-
emitAgentGenerate: v,
|
|
129
|
-
emitToolExecution: f,
|
|
130
|
-
emitAgentTransfer: k,
|
|
131
|
-
emitDelegationSent: E,
|
|
132
|
-
emitDelegationReturned: p,
|
|
133
|
-
emitArtifactSaved: h,
|
|
134
|
-
emitCompletion: w,
|
|
135
|
-
emitAgentInitializing: S
|
|
27
|
+
setConversationId: s,
|
|
28
|
+
emitToParent: r
|
|
136
29
|
};
|
|
137
30
|
}
|
|
138
31
|
export {
|
|
139
|
-
|
|
32
|
+
v as useStreamingEvents
|
|
140
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),t=require("react"),l=require("./config-provider.cjs"),a=t.createContext(void 0),p=({children:e})=>{const{baseSettings:s,componentType:n}=l.useInkeepConfig(),{tags:o,analyticsProperties:r}=s,i=t.useMemo(()=>({widgetLibraryVersion:"0.14.
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),t=require("react"),l=require("./config-provider.cjs"),a=t.createContext(void 0),p=({children:e})=>{const{baseSettings:s,componentType:n}=l.useInkeepConfig(),{tags:o,analyticsProperties:r}=s,i=t.useMemo(()=>({widgetLibraryVersion:"0.14.11",componentType:n,tags:o}),[n,o]),u={logEvent:t.useCallback(async c=>{const v={...i,...c.properties,...r},d={eventName:c.eventName,properties:v};return s.onEvent?.(d)},[s,i,r])};return E.jsx(a.Provider,{value:u,children:e})},g=()=>{const e=t.useContext(a);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=p;exports.useBaseEvents=g;
|
|
@@ -5,7 +5,7 @@ import { useInkeepConfig as g } from "./config-provider.js";
|
|
|
5
5
|
const a = d(void 0), P = ({ children: e }) => {
|
|
6
6
|
const { baseSettings: t, componentType: o } = g(), { tags: s, analyticsProperties: n } = t, r = u(
|
|
7
7
|
() => ({
|
|
8
|
-
widgetLibraryVersion: "0.14.
|
|
8
|
+
widgetLibraryVersion: "0.14.11",
|
|
9
9
|
componentType: o,
|
|
10
10
|
tags: s
|
|
11
11
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("react"),s=require("../styled/components/embedded-chat.cjs"),h=require("../styled/components/modal.cjs"),M=require("../styled/components/shadow.cjs"),g=require("../styled/components/message.cjs"),p=require("../primitives/providers/config-provider.cjs"),C=require("../primitives/providers/root-provider.cjs"),k=require("../primitives/providers/widget-provider.cjs"),T=require("../primitives/components/modal/modal-provider.cjs"),F=require("../primitives/utils/misc.cjs"),j=require("../primitives/atoms/portal-with-theme.cjs"),B=require("../primitives/atoms/error-boundary.cjs"),S=require("./modal.cjs"),v=require("./widget-toggle.cjs");function w(n){const{baseSettings:t,aiChatSettings:r}=n;return e.jsx(B.ErrorBoundary,{children:e.jsx(M.Shadow,{wrapperStyles:{height:"inherit",width:"inherit"},children:e.jsx(C.RootProvider,{config:{baseSettings:t,aiChatSettings:r},componentType:p.WebWidgetInteractionType.EmbeddedChat,children:e.jsx(b,{...n})})})})}function A(n){const{children:t,onToggleView:r,isHidden:a,shouldAutoFocusInput:o=!r}=n;return e.jsx(s.Provider,{isHidden:a,shouldAutoFocusInput:o,children:t})}function b(n){return e.jsx(A,{...n,children:e.jsx(I,{...n})})}function I(n){const{onToggleView:t,variant:r,header:a=y}=n,o=T.useModal(),i=k.useWidget(),c=o&&!i?S.ModalContent:x.Fragment;return e.jsx(c,{children:e.jsxs(s.Wrapper,{variant:r??(t?"no-shadow":"container-with-shadow"),"data-composite":F.dataAttr(!!n.onToggleView||o?.isOpen),children:[e.jsxs(s.Root,{children:[a&&e.jsx(a,{...n}),e.jsx(f,{}),e.jsx(W,{})]}),e.jsx(V,{}),e.jsx(O,{})]})})}const y=n=>{const{onToggleView:t,askAILabel:r,searchLabel:a}=n,o=!!t;return e.jsx(s.Header,{"data-show-toolbar":F.dataAttr(o),children:o?e.jsxs(s.HeaderToolbar,{children:[e.jsxs(s.HeaderToolbarWrapper,{children:[e.jsx(s.ToolbarHeader,{}),e.jsxs(s.Disclaimer,{children:[e.jsx(s.DisclaimerTrigger,{}),e.jsxs(s.DisclaimerContent,{side:"bottom",align:"start",children:[e.jsx(s.DisclaimerText,{}),e.jsx(s.DisclaimerArrow,{})]})]})]}),e.jsx(v.WidgetToggle,{onToggleView:t,askAILabel:r,searchLabel:a,view:"chat"}),e.jsx(h.Close,{})]}):e.jsx(h.Close,{})})};function f(){return e.jsx(s.Content,{children:e.jsxs(s.ContentScrollArea,{children:[e.jsx(s.ContentScrollAreaViewport,{children:e.jsx(E,{})}),e.jsx(s.ContentScrollAreaScrollbar,{children:e.jsx(s.ContentScrollAreaThumb,{})}),e.jsx(s.ContentScrollAreaCorner,{})]})})}function E(){const{aiChatSettings:{components:n}}=p.useInkeepConfig();return e.jsx(s.Messages,{children:({messages:t,isLoading:r})=>{const a=t.at(-1),o=(c,m)=>{const d=n?.[c];if(!d)return console.warn(`Component "${c}" not found in components config`),null;try{if(typeof d=="function"&&d.length<=1)return x.createElement(d,m);const l=d(m,document.createElement("div"),null);return x.isValidElement(l)||typeof l=="string"?l:null}catch(l){return console.error(`🔍 [renderComponent] Error rendering component "${c}":`,l),null}},i=c=>e.jsx(s.Markdown,{text:c});return e.jsxs(e.Fragment,{children:[e.jsx(H,{}),t.map(c=>e.jsxs(s.MessageWrapper,{message:c,children:[e.jsx(u,{}),e.jsxs(s.MessageContentWrapper,{children:[e.jsx(s.MessageContent,{children:n?.IkpMessage?e.jsx(s.DynamicComponent,{name:"IkpMessage",props:{message:c,renderComponent:o,renderMarkdown:i},componentDef:n.IkpMessage}):e.jsxs(e.Fragment,{children:[e.jsx(g.EmbeddedChatMessagePart,{isLast:a?.id===c.id}),e.jsx(L,{})]})}),e.jsx(D,{}),e.jsx(P,{})]})]},c.id)),r&&a?.parts.length&&e.jsx(s.MessageWrapper,{message:{id:"___loader___",role:"assistant",parts:[{type:"text",text:"Thinking..."}]},children:e.jsx(u,{})})]})}})}function H(){return e.jsxs(s.IntroMessageWrapper,{children:[e.jsxs(s.MessageHeader,{children:[e.jsx(s.MessageAvatar,{children:e.jsxs(s.MessageAvatarContent,{children:[e.jsx(s.MessageAvatarFallback,{}),e.jsx(s.MessageAvatarImage,{})]})}),e.jsx(s.MessageName,{})]}),e.jsxs(s.MessageContentWrapper,{children:[e.jsx(s.MessageContent,{children:e.jsx(g.EmbeddedChatMessagePart,{isLast:!1})}),e.jsxs(s.Disclaimer,{children:[e.jsx(s.DisclaimerLabel,{}),e.jsx(s.DisclaimerTrigger,{}),e.jsxs(s.DisclaimerContent,{children:[e.jsx(s.DisclaimerText,{}),e.jsx(s.DisclaimerArrow,{})]})]}),e.jsxs(s.ExampleQuestions,{children:[e.jsx(s.ExampleQuestionsLabel,{}),e.jsx(s.ExampleQuestionsList,{children:n=>n.map(t=>e.jsx(s.ExampleQuestion,{children:e.jsx(s.ExampleQuestionButton,{question:t})},t))})]})]})]})}function u(){return e.jsxs(s.MessageHeader,{children:[e.jsx(s.MessageAvatar,{children:e.jsxs(s.MessageAvatarContent,{children:[e.jsx(s.MessageAvatarFallback,{}),e.jsx(s.MessageAvatarImage,{})]})}),e.jsx(s.MessageName,{})]})}function D(){return e.jsxs(s.MessageAttachments,{children:[e.jsx(s.MessageAttachmentsList,{children:n=>n.map(t=>e.jsxs(s.MessageAttachmentsItem,{attachment:t,children:[e.jsx(s.MessageAttachmentsItemIcon,{}),e.jsx(s.MessageAttachmentsItemTitle,{})]},t.id))}),e.jsx(s.MessageAttachmentsPreview,{children:e.jsx(j.PortalWithTheme,{children:e.jsx(s.MessageAttachmentsPreviewOverlay,{children:e.jsxs(s.MessageAttachmentsPreviewContent,{children:[e.jsx(s.MessageAttachmentsPreviewHeader,{}),e.jsx(s.MessageAttachmentsPreviewClose,{}),e.jsx(s.MessageAttachmentsPreviewBody,{})]})})})})]})}function P(){return e.jsxs(s.MessageToolbar,{children:[e.jsx(s.MessageAnnotationActions,{children:n=>n.map((t,r)=>e.jsx(s.MessageAnnotationAction,{action:t},`action-${r}`))}),e.jsx(s.MessageAction,{action:"copy"}),e.jsx(s.MessageAction,{action:"upvote"}),e.jsx(s.MessageAction,{action:"downvote"})]})}function L(){return e.jsxs(s.MessageSources,{children:[e.jsx(s.MessageSourcesHeader,{}),e.jsx(s.MessageSourcesList,{children:n=>n.map((t,r)=>e.jsxs(s.MessageSourceItem,{href:t.url,source:t,children:[e.jsx(s.MessageSourceItemBreadcrumbs,{children:t.breadcrumbs?.map(a=>e.jsxs(x.Fragment,{children:[a,e.jsx(s.MessageSourceItemBreadcrumbIcon,{})]},a))}),e.jsx(s.MessageSourceItemIcon,{}),e.jsx(s.MessageSourceItemTitle,{}),e.jsx(s.MessageSourceItemTag,{}),e.jsx(s.MessageSourceItemDescription,{children:a=>a.map((o,i)=>e.jsx(s.MessageSourceItemDescriptionPart,{part:o},`part-${i}`))}),e.jsx(s.MessageSourceItemIndicator,{})]},r))})]})}function W(){return e.jsxs(s.Footer,{children:[e.jsx(q,{}),e.jsx(_,{})]})}function q(){return e.jsxs(s.InputFieldset,{children:[e.jsxs(s.InputGroup,{children:[e.jsx(s.Input,{}),e.jsx(s.SendButton,{children:e.jsx(s.SendButtonIcon,{})})]}),e.jsxs(s.AttachmentsBar,{children:[e.jsx(s.AttachmentsBarList,{children:n=>n.map(t=>e.jsxs(s.AttachmentsBarAttachment,{attachment:t,children:[e.jsx(s.AttachmentsBarAttachmentIcon,{}),e.jsx(s.AttachmentsBarAttachmentTitle,{}),e.jsx(s.AttachmentsBarAttachmentDelete,{})]},t.id))}),e.jsxs(s.AttachmentsBarActions,{children:[e.jsxs(s.AttachmentsBarInfoTip,{children:[e.jsx(s.AttachmentsBarInfoTipIcon,{}),e.jsx(s.AttachmentsBarInfoTipText,{})]}),e.jsx(s.AttachmentsBarInputs,{children:n=>n.map(t=>e.jsx(s.AttachmentsBarInput,{input:t,children:t.displayName},t.id))})]}),e.jsx(j.PortalWithTheme,{children:e.jsx(s.AttachmentsBarModal,{children:e.jsx(s.AttachmentsBarModalOverlay,{children:e.jsxs(s.AttachmentsBarModalContent,{children:[e.jsxs(s.AttachmentsBarModalHeader,{children:[e.jsx(s.AttachmentsBarModalHeading,{}),e.jsx(s.AttachmentsBarModalDescription,{}),e.jsx(s.AttachmentsBarModalHelp,{})]}),e.jsx(s.AttachmentsBarModalClose,{}),e.jsx(s.AttachmentsBarModalBody,{children:e.jsxs(s.AttachmentsBarForm,{children:[e.jsxs(s.AttachmentsBarFormTitle,{children:[e.jsx(s.AttachmentsBarFormTitleLabel,{}),e.jsx(s.AttachmentsBarFormTitleInput,{}),e.jsx(s.AttachmentsBarFormTitleError,{})]}),e.jsxs(s.AttachmentsBarFormContent,{children:[e.jsx(s.AttachmentsBarFormContentLabel,{}),e.jsx(s.AttachmentsBarFormContentInput,{}),e.jsx(s.AttachmentsBarFormContentError,{})]}),e.jsx(s.AttachmentsBarFormSubmitButton,{})]})})]})})})})]})]})}function _(){return e.jsxs(s.ActionBar,{children:[e.jsxs(s.TaglineContainer,{children:[e.jsx(s.TaglineText,{}),e.jsx(s.TaglineLogo,{}),e.jsx(s.TaglineBrandName,{})]}),e.jsxs(s.Actions,{children:[e.jsx(s.HelpActions,{children:({pinned:n,unpinned:t})=>e.jsxs(e.Fragment,{children:[n.map(r=>e.jsx(s.HelpAction,{action:r},r.name)),t.length>0&&e.jsx(s.HelpActionsTrigger,{}),e.jsxs(s.HelpActionsMenu,{children:[e.jsx(s.HelpActionsMenuArrow,{}),t.map(r=>e.jsxs(s.HelpActionsMenuItem,{action:r,children:[e.jsx(s.HelpActionsMenuItemIcon,{action:r}),r.name]},r.name))]})]})}),e.jsxs(s.ChatAction,{action:"copy",children:[e.jsx(s.ChatActionLabel,{action:"copy"}),e.jsx(s.ChatActionFeedback,{action:"copy"})]}),e.jsx(s.ChatAction,{action:"clear"}),e.jsx(s.ChatAction,{action:"stop"})]})]})}function V(){return e.jsx(j.PortalWithTheme,{children:e.jsx(s.FeedbackModal,{children:e.jsx(s.FeedbackModalOverlay,{children:e.jsxs(s.FeedbackModalContent,{children:[e.jsx(s.FeedbackModalHeader,{}),e.jsx(s.FeedbackModalClose,{}),e.jsx(s.FeedbackModalBody,{children:e.jsxs(s.FeedbackForm,{children:[e.jsxs(s.FeedbackItem,{name:"unrelated_response",children:[e.jsx(s.FeedbackItemCheckbox,{children:e.jsx(s.FeedbackItemCheckboxIndicator,{})}),e.jsx(s.FeedbackItemLabel,{}),e.jsx(s.FeedbackItemDescription,{})]}),e.jsxs(s.FeedbackItem,{name:"inaccurate_statement",children:[e.jsx(s.FeedbackItemCheckbox,{children:e.jsx(s.FeedbackItemCheckboxIndicator,{})}),e.jsx(s.FeedbackItemLabel,{}),e.jsx(s.FeedbackItemDescription,{})]}),e.jsxs(s.FeedbackItem,{name:"inaccurate_code_snippet",children:[e.jsx(s.FeedbackItemCheckbox,{children:e.jsx(s.FeedbackItemCheckboxIndicator,{})}),e.jsx(s.FeedbackItemLabel,{}),e.jsx(s.FeedbackItemDescription,{})]}),e.jsxs(s.FeedbackItem,{name:"irrelevant_citations",children:[e.jsx(s.FeedbackItemCheckbox,{children:e.jsx(s.FeedbackItemCheckboxIndicator,{})}),e.jsx(s.FeedbackItemLabel,{})]}),e.jsx(s.FeedbackSubmitButton,{})]})})]})})})})}function O(){return e.jsxs(s.FormWrapper,{children:[e.jsx(s.FormClose,{}),e.jsxs(s.Form,{children:[e.jsxs(s.FormHeader,{children:[e.jsx(s.FormHeading,{}),e.jsx(s.FormDescription,{})]}),e.jsx(s.FormContent,{children:n=>e.jsxs(e.Fragment,{children:[n.map((t,r)=>e.jsxs(s.FormField,{field:t,autoFocus:r===0,children:[e.jsx(s.FormFieldLabel,{}),t.inputType==="text"&&e.jsx(s.FormFieldText,{}),t.inputType==="email"&&e.jsx(s.FormFieldEmail,{}),t.inputType==="file"&&e.jsx(s.FormFieldFile,{}),t.inputType==="textarea"&&e.jsx(s.FormFieldTextArea,{}),t.inputType==="checkbox"&&e.jsx(s.FormFieldCheckbox,{children:e.jsx(s.FormFieldCheckboxIndicator,{})}),t.inputType==="select"&&e.jsxs(s.FormFieldSelect,{children:[e.jsxs(s.FormFieldSelectTrigger,{children:[e.jsx(s.FormFieldSelectValue,{}),e.jsx(s.FormFieldSelectIcon,{})]}),e.jsx(s.FormFieldSelectContent,{children:e.jsx(s.FormFieldSelectViewport,{children:t.items.map(a=>e.jsxs(s.FormFieldSelectItem,{value:a.value,children:[e.jsx(s.FormFieldSelectItemText,{children:a.label}),e.jsx(s.FormFieldSelectItemIndicator,{})]},a.value))})})]}),e.jsx(s.FormFieldError,{})]},t.name)),e.jsx(s.FormError,{})]})}),e.jsxs(s.FormFooter,{children:[e.jsx(s.FormCancel,{}),e.jsx(s.FormSubmit,{})]})]}),e.jsxs(s.FormSuccess,{children:[e.jsx(s.FormSuccessHeading,{}),e.jsx(s.FormSuccessMessage,{}),e.jsx(s.FormSuccessButton,{})]})]})}exports.InkeepEmbeddedChat=w;exports.InkeepEmbeddedChatImpl=b;exports.InkeepEmbeddedChatImplContent=I;exports.InkeepEmbeddedChatProvider=A;
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("react"),s=require("../styled/components/embedded-chat.cjs"),h=require("../styled/components/modal.cjs"),M=require("../styled/components/shadow.cjs"),g=require("../styled/components/message.cjs"),p=require("../primitives/providers/config-provider.cjs"),C=require("../primitives/providers/root-provider.cjs"),k=require("../primitives/providers/widget-provider.cjs"),T=require("../primitives/components/modal/modal-provider.cjs"),F=require("../primitives/utils/misc.cjs"),j=require("../primitives/atoms/portal-with-theme.cjs"),B=require("../primitives/atoms/error-boundary.cjs"),S=require("./modal.cjs"),v=require("./widget-toggle.cjs");function w(n){const{baseSettings:t,aiChatSettings:r}=n;return e.jsx(B.ErrorBoundary,{children:e.jsx(M.Shadow,{wrapperStyles:{height:"inherit",width:"inherit"},children:e.jsx(C.RootProvider,{config:{baseSettings:t,aiChatSettings:r},componentType:p.WebWidgetInteractionType.EmbeddedChat,children:e.jsx(b,{...n})})})})}function A(n){const{children:t,onToggleView:r,isHidden:a,shouldAutoFocusInput:o=!r}=n;return e.jsx(s.Provider,{isHidden:a,shouldAutoFocusInput:o,children:t})}function b(n){return e.jsx(A,{...n,children:e.jsx(I,{...n})})}function I(n){const{onToggleView:t,variant:r,header:a=y}=n,o=T.useModal(),i=k.useWidget(),c=o&&!i?S.ModalContent:x.Fragment;return e.jsx(c,{children:e.jsxs(s.Wrapper,{variant:r??(t?"no-shadow":"container-with-shadow"),"data-composite":F.dataAttr(!!n.onToggleView||o?.isOpen),children:[e.jsxs(s.Root,{children:[a&&e.jsx(a,{...n}),e.jsx(f,{}),e.jsx(W,{})]}),e.jsx(V,{}),e.jsx(O,{})]})})}const y=n=>{const{onToggleView:t,askAILabel:r,searchLabel:a}=n,o=!!t;return e.jsx(s.Header,{"data-show-toolbar":F.dataAttr(o),children:o?e.jsxs(s.HeaderToolbar,{children:[e.jsxs(s.HeaderToolbarWrapper,{children:[e.jsx(s.ToolbarHeader,{}),e.jsxs(s.Disclaimer,{children:[e.jsx(s.DisclaimerTrigger,{}),e.jsxs(s.DisclaimerContent,{side:"bottom",align:"start",children:[e.jsx(s.DisclaimerText,{}),e.jsx(s.DisclaimerArrow,{})]})]})]}),e.jsx(v.WidgetToggle,{onToggleView:t,askAILabel:r,searchLabel:a,view:"chat"}),e.jsx(h.Close,{})]}):e.jsx(h.Close,{})})};function f(){return e.jsx(s.Content,{children:e.jsxs(s.ContentScrollArea,{children:[e.jsx(s.ContentScrollAreaViewport,{children:e.jsx(E,{})}),e.jsx(s.ContentScrollAreaScrollbar,{children:e.jsx(s.ContentScrollAreaThumb,{})}),e.jsx(s.ContentScrollAreaCorner,{})]})})}function E(){const{aiChatSettings:{components:n}}=p.useInkeepConfig();return e.jsx(s.Messages,{children:({messages:t,isLoading:r})=>{const a=t.at(-1),o=(c,m)=>{const d=n?.[c];if(!d)return console.warn(`Component "${c}" not found in components config`),null;try{if(typeof d=="function"&&d.length<=1)return x.createElement(d,m);const l=d(m,document.createElement("div"),null);return x.isValidElement(l)||typeof l=="string"?l:null}catch(l){return console.error(`🔍 [renderComponent] Error rendering component "${c}":`,l),null}},i=c=>e.jsx(s.Markdown,{text:c});return e.jsxs(e.Fragment,{children:[e.jsx(H,{}),t.map(c=>e.jsxs(s.MessageWrapper,{message:c,children:[e.jsx(u,{}),e.jsxs(s.MessageContentWrapper,{children:[e.jsx(s.MessageContent,{children:n?.IkpMessage?e.jsx(s.DynamicComponent,{name:"IkpMessage",props:{message:c,renderComponent:o,renderMarkdown:i},componentDef:n.IkpMessage}):e.jsxs(e.Fragment,{children:[e.jsx(g.EmbeddedChatMessagePart,{isLast:a?.id===c.id}),e.jsx(L,{})]})}),e.jsx(D,{}),e.jsx(P,{})]})]},c.id)),r&&a?.parts.length&&e.jsxs(s.MessageWrapper,{message:{id:"___loader___",role:"assistant",parts:[{type:"text",text:"Thinking..."}]},children:[e.jsx(u,{}),e.jsx(s.MessageLoading,{})]})]})}})}function H(){return e.jsxs(s.IntroMessageWrapper,{children:[e.jsxs(s.MessageHeader,{children:[e.jsx(s.MessageAvatar,{children:e.jsxs(s.MessageAvatarContent,{children:[e.jsx(s.MessageAvatarFallback,{}),e.jsx(s.MessageAvatarImage,{})]})}),e.jsx(s.MessageName,{})]}),e.jsxs(s.MessageContentWrapper,{children:[e.jsx(s.MessageContent,{children:e.jsx(g.EmbeddedChatMessagePart,{isLast:!1})}),e.jsxs(s.Disclaimer,{children:[e.jsx(s.DisclaimerLabel,{}),e.jsx(s.DisclaimerTrigger,{}),e.jsxs(s.DisclaimerContent,{children:[e.jsx(s.DisclaimerText,{}),e.jsx(s.DisclaimerArrow,{})]})]}),e.jsxs(s.ExampleQuestions,{children:[e.jsx(s.ExampleQuestionsLabel,{}),e.jsx(s.ExampleQuestionsList,{children:n=>n.map(t=>e.jsx(s.ExampleQuestion,{children:e.jsx(s.ExampleQuestionButton,{question:t})},t))})]})]})]})}function u(){return e.jsxs(s.MessageHeader,{children:[e.jsx(s.MessageAvatar,{children:e.jsxs(s.MessageAvatarContent,{children:[e.jsx(s.MessageAvatarFallback,{}),e.jsx(s.MessageAvatarImage,{})]})}),e.jsx(s.MessageName,{})]})}function D(){return e.jsxs(s.MessageAttachments,{children:[e.jsx(s.MessageAttachmentsList,{children:n=>n.map(t=>e.jsxs(s.MessageAttachmentsItem,{attachment:t,children:[e.jsx(s.MessageAttachmentsItemIcon,{}),e.jsx(s.MessageAttachmentsItemTitle,{})]},t.id))}),e.jsx(s.MessageAttachmentsPreview,{children:e.jsx(j.PortalWithTheme,{children:e.jsx(s.MessageAttachmentsPreviewOverlay,{children:e.jsxs(s.MessageAttachmentsPreviewContent,{children:[e.jsx(s.MessageAttachmentsPreviewHeader,{}),e.jsx(s.MessageAttachmentsPreviewClose,{}),e.jsx(s.MessageAttachmentsPreviewBody,{})]})})})})]})}function P(){return e.jsxs(s.MessageToolbar,{children:[e.jsx(s.MessageAnnotationActions,{children:n=>n.map((t,r)=>e.jsx(s.MessageAnnotationAction,{action:t},`action-${r}`))}),e.jsx(s.MessageAction,{action:"copy"}),e.jsx(s.MessageAction,{action:"upvote"}),e.jsx(s.MessageAction,{action:"downvote"})]})}function L(){return e.jsxs(s.MessageSources,{children:[e.jsx(s.MessageSourcesHeader,{}),e.jsx(s.MessageSourcesList,{children:n=>n.map((t,r)=>e.jsxs(s.MessageSourceItem,{href:t.url,source:t,children:[e.jsx(s.MessageSourceItemBreadcrumbs,{children:t.breadcrumbs?.map(a=>e.jsxs(x.Fragment,{children:[a,e.jsx(s.MessageSourceItemBreadcrumbIcon,{})]},a))}),e.jsx(s.MessageSourceItemIcon,{}),e.jsx(s.MessageSourceItemTitle,{}),e.jsx(s.MessageSourceItemTag,{}),e.jsx(s.MessageSourceItemDescription,{children:a=>a.map((o,i)=>e.jsx(s.MessageSourceItemDescriptionPart,{part:o},`part-${i}`))}),e.jsx(s.MessageSourceItemIndicator,{})]},r))})]})}function W(){return e.jsxs(s.Footer,{children:[e.jsx(q,{}),e.jsx(_,{})]})}function q(){return e.jsxs(s.InputFieldset,{children:[e.jsxs(s.InputGroup,{children:[e.jsx(s.Input,{}),e.jsx(s.SendButton,{children:e.jsx(s.SendButtonIcon,{})})]}),e.jsxs(s.AttachmentsBar,{children:[e.jsx(s.AttachmentsBarList,{children:n=>n.map(t=>e.jsxs(s.AttachmentsBarAttachment,{attachment:t,children:[e.jsx(s.AttachmentsBarAttachmentIcon,{}),e.jsx(s.AttachmentsBarAttachmentTitle,{}),e.jsx(s.AttachmentsBarAttachmentDelete,{})]},t.id))}),e.jsxs(s.AttachmentsBarActions,{children:[e.jsxs(s.AttachmentsBarInfoTip,{children:[e.jsx(s.AttachmentsBarInfoTipIcon,{}),e.jsx(s.AttachmentsBarInfoTipText,{})]}),e.jsx(s.AttachmentsBarInputs,{children:n=>n.map(t=>e.jsx(s.AttachmentsBarInput,{input:t,children:t.displayName},t.id))})]}),e.jsx(j.PortalWithTheme,{children:e.jsx(s.AttachmentsBarModal,{children:e.jsx(s.AttachmentsBarModalOverlay,{children:e.jsxs(s.AttachmentsBarModalContent,{children:[e.jsxs(s.AttachmentsBarModalHeader,{children:[e.jsx(s.AttachmentsBarModalHeading,{}),e.jsx(s.AttachmentsBarModalDescription,{}),e.jsx(s.AttachmentsBarModalHelp,{})]}),e.jsx(s.AttachmentsBarModalClose,{}),e.jsx(s.AttachmentsBarModalBody,{children:e.jsxs(s.AttachmentsBarForm,{children:[e.jsxs(s.AttachmentsBarFormTitle,{children:[e.jsx(s.AttachmentsBarFormTitleLabel,{}),e.jsx(s.AttachmentsBarFormTitleInput,{}),e.jsx(s.AttachmentsBarFormTitleError,{})]}),e.jsxs(s.AttachmentsBarFormContent,{children:[e.jsx(s.AttachmentsBarFormContentLabel,{}),e.jsx(s.AttachmentsBarFormContentInput,{}),e.jsx(s.AttachmentsBarFormContentError,{})]}),e.jsx(s.AttachmentsBarFormSubmitButton,{})]})})]})})})})]})]})}function _(){return e.jsxs(s.ActionBar,{children:[e.jsxs(s.TaglineContainer,{children:[e.jsx(s.TaglineText,{}),e.jsx(s.TaglineLogo,{}),e.jsx(s.TaglineBrandName,{})]}),e.jsxs(s.Actions,{children:[e.jsx(s.HelpActions,{children:({pinned:n,unpinned:t})=>e.jsxs(e.Fragment,{children:[n.map(r=>e.jsx(s.HelpAction,{action:r},r.name)),t.length>0&&e.jsx(s.HelpActionsTrigger,{}),e.jsxs(s.HelpActionsMenu,{children:[e.jsx(s.HelpActionsMenuArrow,{}),t.map(r=>e.jsxs(s.HelpActionsMenuItem,{action:r,children:[e.jsx(s.HelpActionsMenuItemIcon,{action:r}),r.name]},r.name))]})]})}),e.jsxs(s.ChatAction,{action:"copy",children:[e.jsx(s.ChatActionLabel,{action:"copy"}),e.jsx(s.ChatActionFeedback,{action:"copy"})]}),e.jsx(s.ChatAction,{action:"clear"}),e.jsx(s.ChatAction,{action:"stop"})]})]})}function V(){return e.jsx(j.PortalWithTheme,{children:e.jsx(s.FeedbackModal,{children:e.jsx(s.FeedbackModalOverlay,{children:e.jsxs(s.FeedbackModalContent,{children:[e.jsx(s.FeedbackModalHeader,{}),e.jsx(s.FeedbackModalClose,{}),e.jsx(s.FeedbackModalBody,{children:e.jsxs(s.FeedbackForm,{children:[e.jsxs(s.FeedbackItem,{name:"unrelated_response",children:[e.jsx(s.FeedbackItemCheckbox,{children:e.jsx(s.FeedbackItemCheckboxIndicator,{})}),e.jsx(s.FeedbackItemLabel,{}),e.jsx(s.FeedbackItemDescription,{})]}),e.jsxs(s.FeedbackItem,{name:"inaccurate_statement",children:[e.jsx(s.FeedbackItemCheckbox,{children:e.jsx(s.FeedbackItemCheckboxIndicator,{})}),e.jsx(s.FeedbackItemLabel,{}),e.jsx(s.FeedbackItemDescription,{})]}),e.jsxs(s.FeedbackItem,{name:"inaccurate_code_snippet",children:[e.jsx(s.FeedbackItemCheckbox,{children:e.jsx(s.FeedbackItemCheckboxIndicator,{})}),e.jsx(s.FeedbackItemLabel,{}),e.jsx(s.FeedbackItemDescription,{})]}),e.jsxs(s.FeedbackItem,{name:"irrelevant_citations",children:[e.jsx(s.FeedbackItemCheckbox,{children:e.jsx(s.FeedbackItemCheckboxIndicator,{})}),e.jsx(s.FeedbackItemLabel,{})]}),e.jsx(s.FeedbackSubmitButton,{})]})})]})})})})}function O(){return e.jsxs(s.FormWrapper,{children:[e.jsx(s.FormClose,{}),e.jsxs(s.Form,{children:[e.jsxs(s.FormHeader,{children:[e.jsx(s.FormHeading,{}),e.jsx(s.FormDescription,{})]}),e.jsx(s.FormContent,{children:n=>e.jsxs(e.Fragment,{children:[n.map((t,r)=>e.jsxs(s.FormField,{field:t,autoFocus:r===0,children:[e.jsx(s.FormFieldLabel,{}),t.inputType==="text"&&e.jsx(s.FormFieldText,{}),t.inputType==="email"&&e.jsx(s.FormFieldEmail,{}),t.inputType==="file"&&e.jsx(s.FormFieldFile,{}),t.inputType==="textarea"&&e.jsx(s.FormFieldTextArea,{}),t.inputType==="checkbox"&&e.jsx(s.FormFieldCheckbox,{children:e.jsx(s.FormFieldCheckboxIndicator,{})}),t.inputType==="select"&&e.jsxs(s.FormFieldSelect,{children:[e.jsxs(s.FormFieldSelectTrigger,{children:[e.jsx(s.FormFieldSelectValue,{}),e.jsx(s.FormFieldSelectIcon,{})]}),e.jsx(s.FormFieldSelectContent,{children:e.jsx(s.FormFieldSelectViewport,{children:t.items.map(a=>e.jsxs(s.FormFieldSelectItem,{value:a.value,children:[e.jsx(s.FormFieldSelectItemText,{children:a.label}),e.jsx(s.FormFieldSelectItemIndicator,{})]},a.value))})})]}),e.jsx(s.FormFieldError,{})]},t.name)),e.jsx(s.FormError,{})]})}),e.jsxs(s.FormFooter,{children:[e.jsx(s.FormCancel,{}),e.jsx(s.FormSubmit,{})]})]}),e.jsxs(s.FormSuccess,{children:[e.jsx(s.FormSuccessHeading,{}),e.jsx(s.FormSuccessMessage,{}),e.jsx(s.FormSuccessButton,{})]})]})}exports.InkeepEmbeddedChat=w;exports.InkeepEmbeddedChatImpl=b;exports.InkeepEmbeddedChatImplContent=I;exports.InkeepEmbeddedChatProvider=A;
|