@inkeep/cxkit-react 0.0.0-dev-20250221234142
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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/components/chat-button.cjs +1 -0
- package/dist/components/chat-button.d.cts +14 -0
- package/dist/components/chat-button.d.ts +14 -0
- package/dist/components/chat-button.js +54 -0
- package/dist/components/embedded-chat.cjs +1 -0
- package/dist/components/embedded-chat.d.cts +8 -0
- package/dist/components/embedded-chat.d.ts +8 -0
- package/dist/components/embedded-chat.js +340 -0
- package/dist/components/embedded-search-and-chat.cjs +1 -0
- package/dist/components/embedded-search-and-chat.d.cts +40 -0
- package/dist/components/embedded-search-and-chat.d.ts +40 -0
- package/dist/components/embedded-search-and-chat.impl.cjs +1 -0
- package/dist/components/embedded-search-and-chat.impl.d.cts +9 -0
- package/dist/components/embedded-search-and-chat.impl.d.ts +9 -0
- package/dist/components/embedded-search-and-chat.impl.js +43 -0
- package/dist/components/embedded-search-and-chat.js +65 -0
- package/dist/components/embedded-search.cjs +1 -0
- package/dist/components/embedded-search.d.cts +14 -0
- package/dist/components/embedded-search.d.ts +14 -0
- package/dist/components/embedded-search.js +99 -0
- package/dist/components/index.cjs +1 -0
- package/dist/components/index.d.cts +10 -0
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.js +28 -0
- package/dist/components/intelligent-form.cjs +1 -0
- package/dist/components/intelligent-form.d.cts +8 -0
- package/dist/components/intelligent-form.d.ts +8 -0
- package/dist/components/intelligent-form.js +130 -0
- package/dist/components/modal.chat.cjs +1 -0
- package/dist/components/modal.chat.d.cts +6 -0
- package/dist/components/modal.chat.d.ts +6 -0
- package/dist/components/modal.chat.js +21 -0
- package/dist/components/modal.cjs +1 -0
- package/dist/components/modal.d.cts +21 -0
- package/dist/components/modal.d.ts +21 -0
- package/dist/components/modal.js +19 -0
- package/dist/components/modal.search-and-chat.cjs +1 -0
- package/dist/components/modal.search-and-chat.d.cts +6 -0
- package/dist/components/modal.search-and-chat.d.ts +6 -0
- package/dist/components/modal.search-and-chat.js +27 -0
- package/dist/components/modal.search.cjs +1 -0
- package/dist/components/modal.search.d.cts +6 -0
- package/dist/components/modal.search.d.ts +6 -0
- package/dist/components/modal.search.js +21 -0
- package/dist/components/searchbar.cjs +1 -0
- package/dist/components/searchbar.d.cts +13 -0
- package/dist/components/searchbar.d.ts +13 -0
- package/dist/components/searchbar.js +60 -0
- package/dist/components/widget-toggle.cjs +1 -0
- package/dist/components/widget-toggle.d.cts +14 -0
- package/dist/components/widget-toggle.d.ts +14 -0
- package/dist/components/widget-toggle.js +62 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +29 -0
- package/dist/utils.cjs +1 -0
- package/dist/utils.d.cts +6 -0
- package/dist/utils.d.ts +6 -0
- package/dist/utils.js +20 -0
- package/package.json +73 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Chakra UI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @inkeep
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("@inkeep/cxkit-styled"),m=require("react"),g=require("./modal.cjs"),x=require("./embedded-search-and-chat.cjs"),B=require("./embedded-search-and-chat.impl.cjs"),j=require("./embedded-chat.cjs");function I(n){const[r,o]=m.useState(!1),{modalSettings:a,label:i,defaultView:s="chat",canToggleView:p=!0,...c}=n,{config:d,...u}=B.useWidgetImpl({...c,defaultView:s}),C={...a,open:r,onOpenChange:h=>{n.forceDefaultView&&!h&&u.setView(s??"chat"),o(!!h)}};return t.jsxs(t.Fragment,{children:[t.jsx(e.Shadow,{wrapperStyles:{display:"contents"},children:t.jsx(e.RootProvider,{config:d,interactionType:e.WebWidgetInteractionType.ChatButton,children:t.jsx(l,{label:i,setOpen:o})})}),t.jsx(g.InkeepModal,{...d,interactionType:e.WebWidgetInteractionType.ChatButton,modalSettings:C,children:p?t.jsx(x.InkeepEmbeddedSearchAndChatImpl,{...u}):t.jsx(j.InkeepEmbeddedChatImpl,{...c})})]})}function l(n){const{label:r="Ask AI",setOpen:o}=n;return t.jsx(e.ChatButton.Container,{children:t.jsxs(e.ChatButton.ChatButton,{onPointerDown:a=>{a.button!==2&&(o(i=>!i),a.stopPropagation())},children:[t.jsx(e.ChatButton.ChatButtonText,{children:r}),t.jsx(e.ChatButton.ChatButtonAvatarContent,{children:t.jsx(e.ChatButton.ChatButtonAvatarImage,{})})]})})}exports.ChatButtonImpl=l;exports.InkeepChatButton=I;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InkeepModalSettings } from '@inkeep/cxkit-types';
|
|
2
|
+
import { InkeepEmbeddedSearchAndChatProps } from './embedded-search-and-chat';
|
|
3
|
+
export interface InkeepChatButtonProps extends Omit<InkeepEmbeddedSearchAndChatProps, 'onToggleView'> {
|
|
4
|
+
modalSettings?: Omit<InkeepModalSettings, 'open' | 'onOpenChange'>;
|
|
5
|
+
label?: string;
|
|
6
|
+
canToggleView?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function InkeepChatButton(props: InkeepChatButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
interface ChatButtonImplProps {
|
|
10
|
+
label?: string;
|
|
11
|
+
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
12
|
+
}
|
|
13
|
+
export declare function ChatButtonImpl(props: ChatButtonImplProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InkeepModalSettings } from '@inkeep/cxkit-types';
|
|
2
|
+
import { InkeepEmbeddedSearchAndChatProps } from './embedded-search-and-chat';
|
|
3
|
+
export interface InkeepChatButtonProps extends Omit<InkeepEmbeddedSearchAndChatProps, 'onToggleView'> {
|
|
4
|
+
modalSettings?: Omit<InkeepModalSettings, 'open' | 'onOpenChange'>;
|
|
5
|
+
label?: string;
|
|
6
|
+
canToggleView?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function InkeepChatButton(props: InkeepChatButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
interface ChatButtonImplProps {
|
|
10
|
+
label?: string;
|
|
11
|
+
setOpen: React.Dispatch<React.SetStateAction<boolean>>;
|
|
12
|
+
}
|
|
13
|
+
export declare function ChatButtonImpl(props: ChatButtonImplProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as s, Fragment as C, jsx as t } from "react/jsx-runtime";
|
|
3
|
+
import { Shadow as g, RootProvider as I, WebWidgetInteractionType as h, ChatButton as e } from "@inkeep/cxkit-styled";
|
|
4
|
+
import { useState as B } from "react";
|
|
5
|
+
import { InkeepModal as w } from "./modal.js";
|
|
6
|
+
import { InkeepEmbeddedSearchAndChatImpl as S } from "./embedded-search-and-chat.js";
|
|
7
|
+
import { useWidgetImpl as b } from "./embedded-search-and-chat.impl.js";
|
|
8
|
+
import { InkeepEmbeddedChatImpl as k } from "./embedded-chat.js";
|
|
9
|
+
function v(n) {
|
|
10
|
+
const [a, o] = B(!1), {
|
|
11
|
+
modalSettings: r,
|
|
12
|
+
label: i,
|
|
13
|
+
defaultView: l = "chat",
|
|
14
|
+
canToggleView: u = !0,
|
|
15
|
+
...c
|
|
16
|
+
} = n, { config: p, ...m } = b({ ...c, defaultView: l }), f = {
|
|
17
|
+
...r,
|
|
18
|
+
open: a,
|
|
19
|
+
onOpenChange: (d) => {
|
|
20
|
+
n.forceDefaultView && !d && m.setView(l ?? "chat"), o(!!d);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
return /* @__PURE__ */ s(C, { children: [
|
|
24
|
+
/* @__PURE__ */ t(g, { wrapperStyles: { display: "contents" }, children: /* @__PURE__ */ t(I, { config: p, interactionType: h.ChatButton, children: /* @__PURE__ */ t(y, { label: i, setOpen: o }) }) }),
|
|
25
|
+
/* @__PURE__ */ t(
|
|
26
|
+
w,
|
|
27
|
+
{
|
|
28
|
+
...p,
|
|
29
|
+
interactionType: h.ChatButton,
|
|
30
|
+
modalSettings: f,
|
|
31
|
+
children: u ? /* @__PURE__ */ t(S, { ...m }) : /* @__PURE__ */ t(k, { ...c })
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
] });
|
|
35
|
+
}
|
|
36
|
+
function y(n) {
|
|
37
|
+
const { label: a = "Ask AI", setOpen: o } = n;
|
|
38
|
+
return /* @__PURE__ */ t(e.Container, { children: /* @__PURE__ */ s(
|
|
39
|
+
e.ChatButton,
|
|
40
|
+
{
|
|
41
|
+
onPointerDown: (r) => {
|
|
42
|
+
r.button !== 2 && (o((i) => !i), r.stopPropagation());
|
|
43
|
+
},
|
|
44
|
+
children: [
|
|
45
|
+
/* @__PURE__ */ t(e.ChatButtonText, { children: a }),
|
|
46
|
+
/* @__PURE__ */ t(e.ChatButtonAvatarContent, { children: /* @__PURE__ */ t(e.ChatButtonAvatarImage, {}) })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
) });
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
y as ChatButtonImpl,
|
|
53
|
+
v as InkeepChatButton
|
|
54
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("@inkeep/cxkit-styled"),c=require("react"),i=require("./widget-toggle.cjs");function o(a){const{baseSettings:t,aiChatSettings:s}=a;return e.jsx(d.Shadow,{wrapperStyles:{height:"inherit",width:"inherit"},children:e.jsx(d.RootProvider,{config:{baseSettings:t,aiChatSettings:s},interactionType:d.WebWidgetInteractionType.EmbeddedChat,children:e.jsx(r,{...a})})})}function r(a){const{onToggleView:t,isHidden:s,shouldAutoFocusInput:n=!t}=a,h=d.useModal();return e.jsx(d.EmbeddedChat.Provider,{isHidden:s,shouldAutoFocusInput:n,children:e.jsxs(d.EmbeddedChat.Wrapper,{variant:t?"no-shadow":"container-with-shadow","data-composite":d.dataAttr(!!a.onToggleView||h?.open),children:[e.jsx(d.EmbeddedChat.ConversationLoading,{}),e.jsxs(d.EmbeddedChat.Root,{children:[e.jsx(b,{...a}),e.jsx(C,{}),e.jsx(g,{})]}),e.jsx(I,{}),e.jsx(M,{})]})})}function b(a){const{onToggleView:t,askAILabel:s,searchLabel:n}=a,h=!!t;return e.jsxs(d.EmbeddedChat.Header,{"data-show-toolbar":d.dataAttr(h),children:[h&&e.jsxs(d.EmbeddedChat.HeaderToolbar,{children:[e.jsxs(d.EmbeddedChat.HeaderToolbarWrapper,{children:[e.jsx(d.EmbeddedChat.ToolbarHeader,{}),e.jsxs(d.EmbeddedChat.Disclaimer,{children:[e.jsx(d.EmbeddedChat.DisclaimerTrigger,{}),e.jsxs(d.EmbeddedChat.DisclaimerContent,{side:"bottom",align:"start",children:[e.jsx(d.EmbeddedChat.DisclaimerText,{}),e.jsx(d.EmbeddedChat.DisclaimerArrow,{})]})]})]}),e.jsx(i.WidgetToggle,{onToggleView:t,askAILabel:s,searchLabel:n,view:"chat"})]}),e.jsx(d.Modal.Close,{})]})}function C(){return e.jsx(d.EmbeddedChat.Content,{children:e.jsxs(d.EmbeddedChat.ContentScrollArea,{children:[e.jsx(d.EmbeddedChat.ContentScrollAreaViewport,{children:e.jsx(l,{})}),e.jsx(d.EmbeddedChat.ContentScrollAreaScrollbar,{children:e.jsx(d.EmbeddedChat.ContentScrollAreaThumb,{})}),e.jsx(d.EmbeddedChat.ContentScrollAreaCorner,{})]})})}function l(){return e.jsx(d.EmbeddedChat.Messages,{children:({messages:a})=>e.jsxs(e.Fragment,{children:[e.jsx(x,{}),a.map(t=>e.jsxs(d.EmbeddedChat.MessageWrapper,{message:t,children:[e.jsx(j,{}),e.jsx(d.EmbeddedChat.MessageLoading,{}),e.jsxs(d.EmbeddedChat.MessageContentWrapper,{children:[e.jsx(d.EmbeddedChat.MessageContent,{children:e.jsx(d.EmbeddedChat.Message,{})}),e.jsx(E,{}),e.jsx(u,{}),e.jsx(F,{})]})]},t.id))]})})}function x(){return e.jsxs(d.EmbeddedChat.IntroMessageWrapper,{children:[e.jsxs(d.EmbeddedChat.MessageHeader,{children:[e.jsx(d.EmbeddedChat.MessageAvatar,{children:e.jsxs(d.EmbeddedChat.MessageAvatarContent,{children:[e.jsx(d.EmbeddedChat.MessageAvatarFallback,{}),e.jsx(d.EmbeddedChat.MessageAvatarImage,{})]})}),e.jsx(d.EmbeddedChat.MessageName,{})]}),e.jsxs(d.EmbeddedChat.MessageContentWrapper,{children:[e.jsx(d.EmbeddedChat.MessageContent,{children:e.jsx(d.EmbeddedChat.Message,{})}),e.jsxs(d.EmbeddedChat.Disclaimer,{children:[e.jsx(d.EmbeddedChat.DisclaimerLabel,{}),e.jsx(d.EmbeddedChat.DisclaimerTrigger,{}),e.jsxs(d.EmbeddedChat.DisclaimerContent,{children:[e.jsx(d.EmbeddedChat.DisclaimerText,{}),e.jsx(d.EmbeddedChat.DisclaimerArrow,{})]})]}),e.jsxs(d.EmbeddedChat.QuickQuestions,{children:[e.jsx(d.EmbeddedChat.QuickQuestionsLabel,{}),e.jsx(d.EmbeddedChat.QuickQuestionsList,{children:a=>a.map(t=>e.jsx(d.EmbeddedChat.QuickQuestion,{children:e.jsx(d.EmbeddedChat.QuickQuestionButton,{question:t})},t))})]}),e.jsxs(d.EmbeddedChat.Workflows,{children:[e.jsx(d.EmbeddedChat.WorkflowsLabel,{}),e.jsx(d.EmbeddedChat.WorkflowsList,{children:a=>a.map(t=>e.jsxs(d.EmbeddedChat.Workflow,{workflow:t,children:[e.jsx(d.EmbeddedChat.WorkflowIcon,{}),t.displayName]},t.id))})]})]})]})}function j(){return e.jsxs(d.EmbeddedChat.MessageHeader,{children:[e.jsx(d.EmbeddedChat.MessageAvatar,{children:e.jsxs(d.EmbeddedChat.MessageAvatarContent,{children:[e.jsx(d.EmbeddedChat.MessageAvatarFallback,{}),e.jsx(d.EmbeddedChat.MessageAvatarImage,{})]})}),e.jsx(d.EmbeddedChat.MessageName,{})]})}function E(){return e.jsxs(d.EmbeddedChat.MessageAttachments,{children:[e.jsx(d.EmbeddedChat.MessageAttachmentsList,{children:a=>a.map(t=>e.jsxs(d.EmbeddedChat.MessageAttachmentsItem,{attachment:t,children:[e.jsx(d.EmbeddedChat.MessageAttachmentsItemIcon,{}),e.jsx(d.EmbeddedChat.MessageAttachmentsItemTitle,{})]},t.id))}),e.jsx(d.EmbeddedChat.MessageAttachmentsPreview,{children:e.jsx(d.PortalWithTheme,{children:e.jsx(d.EmbeddedChat.MessageAttachmentsPreviewOverlay,{children:e.jsxs(d.EmbeddedChat.MessageAttachmentsPreviewContent,{children:[e.jsx(d.EmbeddedChat.MessageAttachmentsPreviewHeader,{}),e.jsx(d.EmbeddedChat.MessageAttachmentsPreviewClose,{}),e.jsx(d.EmbeddedChat.MessageAttachmentsPreviewBody,{})]})})})})]})}function u(){return e.jsxs(d.EmbeddedChat.MessageActions,{children:[e.jsx(d.EmbeddedChat.MessageToolActions,{children:a=>a.map((t,s)=>e.jsx(d.EmbeddedChat.MessageToolAction,{action:t},`action-${s}`))}),e.jsx(d.EmbeddedChat.MessageAction,{action:"copy"}),e.jsx(d.EmbeddedChat.MessageAction,{action:"upvote"}),e.jsx(d.EmbeddedChat.MessageAction,{action:"downvote"})]})}function F(){return e.jsxs(d.EmbeddedChat.MessageSources,{children:[e.jsx(d.EmbeddedChat.MessageSourcesHeader,{}),e.jsx(d.EmbeddedChat.MessageSourcesList,{children:a=>a.map((t,s)=>e.jsxs(d.EmbeddedChat.MessageSourceItem,{href:t.url,source:t,children:[e.jsx(d.EmbeddedChat.MessageSourceItemBreadcrumbs,{children:t.breadcrumbs?.map(n=>e.jsxs(c.Fragment,{children:[n,e.jsx(d.EmbeddedChat.MessageSourceItemBreadcrumbIcon,{})]},n))}),e.jsx(d.EmbeddedChat.MessageSourceItemIcon,{}),e.jsx(d.EmbeddedChat.MessageSourceItemTitle,{}),e.jsx(d.EmbeddedChat.MessageSourceItemTag,{}),e.jsx(d.EmbeddedChat.MessageSourceItemDescription,{children:n=>n.map((h,m)=>e.jsx(d.EmbeddedChat.MessageSourceItemDescriptionPart,{part:h},`part-${m}`))}),e.jsx(d.EmbeddedChat.MessageSourceItemIndicator,{})]},s))})]})}function g(){return e.jsxs(d.EmbeddedChat.Footer,{children:[e.jsx(A,{}),e.jsx(p,{})]})}function A(){return e.jsxs(d.EmbeddedChat.InputFieldset,{children:[e.jsxs(d.EmbeddedChat.InputGroup,{children:[e.jsx(d.EmbeddedChat.Input,{}),e.jsx(d.EmbeddedChat.SendButton,{children:e.jsx(d.EmbeddedChat.SendButtonIcon,{})})]}),e.jsxs(d.EmbeddedChat.AttachmentsBar,{children:[e.jsx(d.EmbeddedChat.AttachmentsBarList,{children:a=>a.map(t=>e.jsxs(d.EmbeddedChat.AttachmentsBarAttachment,{attachment:t,children:[e.jsx(d.EmbeddedChat.AttachmentsBarAttachmentIcon,{}),e.jsx(d.EmbeddedChat.AttachmentsBarAttachmentTitle,{}),e.jsx(d.EmbeddedChat.AttachmentsBarAttachmentDelete,{})]},t.id))}),e.jsxs(d.EmbeddedChat.AttachmentsBarActions,{children:[e.jsxs(d.EmbeddedChat.AttachmentsBarInfoTip,{children:[e.jsx(d.EmbeddedChat.AttachmentsBarInfoTipIcon,{}),e.jsx(d.EmbeddedChat.AttachmentsBarInfoTipText,{})]}),e.jsx(d.EmbeddedChat.AttachmentsBarInputs,{children:a=>a.map(t=>e.jsxs(d.EmbeddedChat.AttachmentsBarInput,{input:t,children:[e.jsx(d.EmbeddedChat.AttachmentsBarInputIcon,{}),t.displayName]},t.id))})]}),e.jsx(d.PortalWithTheme,{children:e.jsx(d.EmbeddedChat.AttachmentsBarModal,{children:e.jsx(d.EmbeddedChat.AttachmentsBarModalOverlay,{children:e.jsxs(d.EmbeddedChat.AttachmentsBarModalContent,{children:[e.jsxs(d.EmbeddedChat.AttachmentsBarModalHeader,{children:[e.jsx(d.EmbeddedChat.AttachmentsBarModalHeading,{}),e.jsx(d.EmbeddedChat.AttachmentsBarModalDescription,{}),e.jsx(d.EmbeddedChat.AttachmentsBarModalHelp,{})]}),e.jsx(d.EmbeddedChat.AttachmentsBarModalClose,{}),e.jsx(d.EmbeddedChat.AttachmentsBarModalBody,{children:e.jsxs(d.EmbeddedChat.AttachmentsBarForm,{children:[e.jsxs(d.EmbeddedChat.AttachmentsBarFormTitle,{children:[e.jsx(d.EmbeddedChat.AttachmentsBarFormTitleLabel,{}),e.jsx(d.EmbeddedChat.AttachmentsBarFormTitleInput,{}),e.jsx(d.EmbeddedChat.AttachmentsBarFormTitleError,{})]}),e.jsxs(d.EmbeddedChat.AttachmentsBarFormContent,{children:[e.jsx(d.EmbeddedChat.AttachmentsBarFormContentLabel,{}),e.jsx(d.EmbeddedChat.AttachmentsBarFormContentInput,{}),e.jsx(d.EmbeddedChat.AttachmentsBarFormContentError,{})]}),e.jsx(d.EmbeddedChat.AttachmentsBarFormSubmitButton,{})]})})]})})})})]})]})}function p(){return e.jsxs(d.EmbeddedChat.ActionBar,{children:[e.jsxs(d.EmbeddedChat.TaglineContainer,{children:[e.jsx(d.EmbeddedChat.TaglineText,{}),e.jsx(d.EmbeddedChat.TaglineLogo,{}),e.jsx(d.EmbeddedChat.TaglineBrandName,{})]}),e.jsxs(d.EmbeddedChat.Actions,{children:[e.jsx(d.EmbeddedChat.HelpActions,{children:({pinned:a,unpinned:t})=>e.jsxs(e.Fragment,{children:[a.map(s=>e.jsx(d.EmbeddedChat.HelpAction,{action:s},s.name)),t.length>0&&e.jsx(d.EmbeddedChat.HelpActionsTrigger,{}),e.jsxs(d.EmbeddedChat.HelpActionsMenu,{children:[e.jsx(d.EmbeddedChat.HelpActionsMenuArrow,{}),t.map(s=>e.jsxs(d.EmbeddedChat.HelpActionsMenuItem,{action:s,children:[e.jsx(d.EmbeddedChat.HelpActionsMenuItemIcon,{action:s}),s.name]},s.name))]})]})}),e.jsxs(d.EmbeddedChat.ChatAction,{action:"copy",children:[e.jsx(d.EmbeddedChat.ChatActionLabel,{action:"copy"}),e.jsx(d.EmbeddedChat.ChatActionFeedback,{action:"copy"})]}),e.jsxs(d.EmbeddedChat.ChatAction,{action:"share",children:[e.jsx(d.EmbeddedChat.ChatActionLabel,{action:"share"}),e.jsx(d.EmbeddedChat.ChatActionFeedback,{action:"share"})]}),e.jsx(d.EmbeddedChat.ChatAction,{action:"clear"}),e.jsx(d.EmbeddedChat.ChatAction,{action:"stop"})]})]})}function I(){return e.jsx(d.PortalWithTheme,{children:e.jsx(d.EmbeddedChat.FeedbackModal,{children:e.jsx(d.EmbeddedChat.FeedbackModalOverlay,{children:e.jsxs(d.EmbeddedChat.FeedbackModalContent,{children:[e.jsx(d.EmbeddedChat.FeedbackModalHeader,{}),e.jsx(d.EmbeddedChat.FeedbackModalClose,{}),e.jsx(d.EmbeddedChat.FeedbackModalBody,{children:e.jsxs(d.EmbeddedChat.FeedbackForm,{children:[e.jsxs(d.EmbeddedChat.FeedbackItem,{name:"unrelated_response",children:[e.jsx(d.EmbeddedChat.FeedbackItemCheckbox,{children:e.jsx(d.EmbeddedChat.FeedbackItemCheckboxIndicator,{})}),e.jsx(d.EmbeddedChat.FeedbackItemLabel,{}),e.jsx(d.EmbeddedChat.FeedbackItemDescription,{})]}),e.jsxs(d.EmbeddedChat.FeedbackItem,{name:"inaccurate_statement",children:[e.jsx(d.EmbeddedChat.FeedbackItemCheckbox,{children:e.jsx(d.EmbeddedChat.FeedbackItemCheckboxIndicator,{})}),e.jsx(d.EmbeddedChat.FeedbackItemLabel,{}),e.jsx(d.EmbeddedChat.FeedbackItemDescription,{})]}),e.jsxs(d.EmbeddedChat.FeedbackItem,{name:"inaccurate_code_snippet",children:[e.jsx(d.EmbeddedChat.FeedbackItemCheckbox,{children:e.jsx(d.EmbeddedChat.FeedbackItemCheckboxIndicator,{})}),e.jsx(d.EmbeddedChat.FeedbackItemLabel,{}),e.jsx(d.EmbeddedChat.FeedbackItemDescription,{})]}),e.jsxs(d.EmbeddedChat.FeedbackItem,{name:"irrelevant_citations",children:[e.jsx(d.EmbeddedChat.FeedbackItemCheckbox,{children:e.jsx(d.EmbeddedChat.FeedbackItemCheckboxIndicator,{})}),e.jsx(d.EmbeddedChat.FeedbackItemLabel,{})]}),e.jsx(d.EmbeddedChat.FeedbackSubmitButton,{})]})})]})})})})}function M(){return e.jsxs(d.EmbeddedChat.FormWrapper,{children:[e.jsx(d.EmbeddedChat.FormClose,{}),e.jsxs(d.EmbeddedChat.Form,{children:[e.jsxs(d.EmbeddedChat.FormHeader,{children:[e.jsx(d.EmbeddedChat.FormHeading,{}),e.jsx(d.EmbeddedChat.FormDescription,{})]}),e.jsx(d.EmbeddedChat.FormContent,{children:a=>e.jsxs(e.Fragment,{children:[a.map((t,s)=>e.jsxs(d.EmbeddedChat.FormField,{field:t,autoFocus:s===0,children:[e.jsx(d.EmbeddedChat.FormFieldLabel,{}),t.inputType==="TEXT"&&e.jsx(d.EmbeddedChat.FormFieldText,{}),t.inputType==="EMAIL"&&e.jsx(d.EmbeddedChat.FormFieldEmail,{}),t.inputType==="FILE"&&e.jsx(d.EmbeddedChat.FormFieldFile,{}),t.inputType==="TEXTAREA"&&e.jsx(d.EmbeddedChat.FormFieldTextArea,{}),t.inputType==="CHECKBOX"&&e.jsx(d.EmbeddedChat.FormFieldCheckbox,{children:e.jsx(d.EmbeddedChat.FormFieldCheckboxIndicator,{})}),t.inputType==="SELECT"&&e.jsxs(d.EmbeddedChat.FormFieldSelect,{children:[e.jsxs(d.EmbeddedChat.FormFieldSelectTrigger,{children:[e.jsx(d.EmbeddedChat.FormFieldSelectValue,{}),e.jsx(d.EmbeddedChat.FormFieldSelectIcon,{})]}),e.jsx(d.EmbeddedChat.FormFieldSelectContent,{children:e.jsx(d.EmbeddedChat.FormFieldSelectViewport,{children:t.items.map(n=>e.jsxs(d.EmbeddedChat.FormFieldSelectItem,{value:n.value,children:[e.jsx(d.EmbeddedChat.FormFieldSelectItemText,{children:n.label}),e.jsx(d.EmbeddedChat.FormFieldSelectItemIndicator,{})]},n.value))})})]}),e.jsx(d.EmbeddedChat.FormFieldError,{})]},t.name)),e.jsx(d.EmbeddedChat.FormError,{})]})}),e.jsxs(d.EmbeddedChat.FormFooter,{children:[e.jsx(d.EmbeddedChat.FormCancel,{}),e.jsx(d.EmbeddedChat.FormSubmit,{})]})]}),e.jsxs(d.EmbeddedChat.FormSuccess,{children:[e.jsx(d.EmbeddedChat.FormSuccessHeading,{}),e.jsx(d.EmbeddedChat.FormSuccessMessage,{}),e.jsx(d.EmbeddedChat.FormSuccessButton,{})]})]})}exports.InkeepEmbeddedChat=o;exports.InkeepEmbeddedChatImpl=r;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { WidgetView, InkeepConfig } from '@inkeep/cxkit-types';
|
|
2
|
+
import { EmbeddedChatProviderProps } from '@inkeep/cxkit-styled';
|
|
3
|
+
type ChatConfig = Pick<InkeepConfig, 'baseSettings' | 'aiChatSettings'>;
|
|
4
|
+
type InkeepEmbeddedChatImplProps = EmbeddedChatProviderProps & WidgetView;
|
|
5
|
+
export type InkeepEmbeddedChatProps = InkeepEmbeddedChatImplProps & Partial<ChatConfig>;
|
|
6
|
+
export declare function InkeepEmbeddedChat(props: InkeepEmbeddedChatProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function InkeepEmbeddedChatImpl(props: InkeepEmbeddedChatImplProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { WidgetView, InkeepConfig } from '@inkeep/cxkit-types';
|
|
2
|
+
import { EmbeddedChatProviderProps } from '@inkeep/cxkit-styled';
|
|
3
|
+
type ChatConfig = Pick<InkeepConfig, 'baseSettings' | 'aiChatSettings'>;
|
|
4
|
+
type InkeepEmbeddedChatImplProps = EmbeddedChatProviderProps & WidgetView;
|
|
5
|
+
export type InkeepEmbeddedChatProps = InkeepEmbeddedChatImplProps & Partial<ChatConfig>;
|
|
6
|
+
export declare function InkeepEmbeddedChat(props: InkeepEmbeddedChatProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function InkeepEmbeddedChatImpl(props: InkeepEmbeddedChatImplProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as t, jsxs as n, Fragment as s } from "react/jsx-runtime";
|
|
3
|
+
import { Shadow as m, RootProvider as F, WebWidgetInteractionType as u, useModal as A, EmbeddedChat as e, dataAttr as d, Modal as g, PortalWithTheme as l } from "@inkeep/cxkit-styled";
|
|
4
|
+
import { Fragment as p } from "react";
|
|
5
|
+
import { WidgetToggle as M } from "./widget-toggle.js";
|
|
6
|
+
function Q(a) {
|
|
7
|
+
const { baseSettings: r, aiChatSettings: c } = a;
|
|
8
|
+
return /* @__PURE__ */ t(
|
|
9
|
+
m,
|
|
10
|
+
{
|
|
11
|
+
wrapperStyles: {
|
|
12
|
+
height: "inherit",
|
|
13
|
+
width: "inherit"
|
|
14
|
+
},
|
|
15
|
+
children: /* @__PURE__ */ t(
|
|
16
|
+
F,
|
|
17
|
+
{
|
|
18
|
+
config: {
|
|
19
|
+
baseSettings: r,
|
|
20
|
+
aiChatSettings: c
|
|
21
|
+
},
|
|
22
|
+
interactionType: u.EmbeddedChat,
|
|
23
|
+
children: /* @__PURE__ */ t(I, { ...a })
|
|
24
|
+
}
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
function I(a) {
|
|
30
|
+
const { onToggleView: r, isHidden: c, shouldAutoFocusInput: i = !r } = a, o = A();
|
|
31
|
+
return /* @__PURE__ */ t(e.Provider, { isHidden: c, shouldAutoFocusInput: i, children: /* @__PURE__ */ n(
|
|
32
|
+
e.Wrapper,
|
|
33
|
+
{
|
|
34
|
+
variant: r ? "no-shadow" : "container-with-shadow",
|
|
35
|
+
"data-composite": d(!!a.onToggleView || o?.open),
|
|
36
|
+
children: [
|
|
37
|
+
/* @__PURE__ */ t(e.ConversationLoading, {}),
|
|
38
|
+
/* @__PURE__ */ n(e.Root, { children: [
|
|
39
|
+
/* @__PURE__ */ t(b, { ...a }),
|
|
40
|
+
/* @__PURE__ */ t(C, {}),
|
|
41
|
+
/* @__PURE__ */ t(w, {})
|
|
42
|
+
] }),
|
|
43
|
+
/* @__PURE__ */ t(x, {}),
|
|
44
|
+
/* @__PURE__ */ t(f, {})
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
) });
|
|
48
|
+
}
|
|
49
|
+
function b(a) {
|
|
50
|
+
const { onToggleView: r, askAILabel: c, searchLabel: i } = a, o = !!r;
|
|
51
|
+
return /* @__PURE__ */ n(e.Header, { "data-show-toolbar": d(o), children: [
|
|
52
|
+
o && /* @__PURE__ */ n(e.HeaderToolbar, { children: [
|
|
53
|
+
/* @__PURE__ */ n(e.HeaderToolbarWrapper, { children: [
|
|
54
|
+
/* @__PURE__ */ t(e.ToolbarHeader, {}),
|
|
55
|
+
/* @__PURE__ */ n(e.Disclaimer, { children: [
|
|
56
|
+
/* @__PURE__ */ t(e.DisclaimerTrigger, {}),
|
|
57
|
+
/* @__PURE__ */ n(e.DisclaimerContent, { side: "bottom", align: "start", children: [
|
|
58
|
+
/* @__PURE__ */ t(e.DisclaimerText, {}),
|
|
59
|
+
/* @__PURE__ */ t(e.DisclaimerArrow, {})
|
|
60
|
+
] })
|
|
61
|
+
] })
|
|
62
|
+
] }),
|
|
63
|
+
/* @__PURE__ */ t(
|
|
64
|
+
M,
|
|
65
|
+
{
|
|
66
|
+
onToggleView: r,
|
|
67
|
+
askAILabel: c,
|
|
68
|
+
searchLabel: i,
|
|
69
|
+
view: "chat"
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
] }),
|
|
73
|
+
/* @__PURE__ */ t(g.Close, {})
|
|
74
|
+
] });
|
|
75
|
+
}
|
|
76
|
+
function C() {
|
|
77
|
+
return /* @__PURE__ */ t(e.Content, { children: /* @__PURE__ */ n(e.ContentScrollArea, { children: [
|
|
78
|
+
/* @__PURE__ */ t(e.ContentScrollAreaViewport, { children: /* @__PURE__ */ t(k, {}) }),
|
|
79
|
+
/* @__PURE__ */ t(e.ContentScrollAreaScrollbar, { children: /* @__PURE__ */ t(e.ContentScrollAreaThumb, {}) }),
|
|
80
|
+
/* @__PURE__ */ t(e.ContentScrollAreaCorner, {})
|
|
81
|
+
] }) });
|
|
82
|
+
}
|
|
83
|
+
function k() {
|
|
84
|
+
return /* @__PURE__ */ t(e.Messages, { children: ({ messages: a }) => /* @__PURE__ */ n(s, { children: [
|
|
85
|
+
/* @__PURE__ */ t(T, {}),
|
|
86
|
+
a.map((r) => /* @__PURE__ */ n(e.MessageWrapper, { message: r, children: [
|
|
87
|
+
/* @__PURE__ */ t(B, {}),
|
|
88
|
+
/* @__PURE__ */ t(e.MessageLoading, {}),
|
|
89
|
+
/* @__PURE__ */ n(e.MessageContentWrapper, { children: [
|
|
90
|
+
/* @__PURE__ */ t(e.MessageContent, { children: /* @__PURE__ */ t(e.Message, {}) }),
|
|
91
|
+
/* @__PURE__ */ t(S, {}),
|
|
92
|
+
/* @__PURE__ */ t(v, {}),
|
|
93
|
+
/* @__PURE__ */ t(H, {})
|
|
94
|
+
] })
|
|
95
|
+
] }, r.id))
|
|
96
|
+
] }) });
|
|
97
|
+
}
|
|
98
|
+
function T() {
|
|
99
|
+
return /* @__PURE__ */ n(e.IntroMessageWrapper, { children: [
|
|
100
|
+
/* @__PURE__ */ n(e.MessageHeader, { children: [
|
|
101
|
+
/* @__PURE__ */ t(e.MessageAvatar, { children: /* @__PURE__ */ n(e.MessageAvatarContent, { children: [
|
|
102
|
+
/* @__PURE__ */ t(e.MessageAvatarFallback, {}),
|
|
103
|
+
/* @__PURE__ */ t(e.MessageAvatarImage, {})
|
|
104
|
+
] }) }),
|
|
105
|
+
/* @__PURE__ */ t(e.MessageName, {})
|
|
106
|
+
] }),
|
|
107
|
+
/* @__PURE__ */ n(e.MessageContentWrapper, { children: [
|
|
108
|
+
/* @__PURE__ */ t(e.MessageContent, { children: /* @__PURE__ */ t(e.Message, {}) }),
|
|
109
|
+
/* @__PURE__ */ n(e.Disclaimer, { children: [
|
|
110
|
+
/* @__PURE__ */ t(e.DisclaimerLabel, {}),
|
|
111
|
+
/* @__PURE__ */ t(e.DisclaimerTrigger, {}),
|
|
112
|
+
/* @__PURE__ */ n(e.DisclaimerContent, { children: [
|
|
113
|
+
/* @__PURE__ */ t(e.DisclaimerText, {}),
|
|
114
|
+
/* @__PURE__ */ t(e.DisclaimerArrow, {})
|
|
115
|
+
] })
|
|
116
|
+
] }),
|
|
117
|
+
/* @__PURE__ */ n(e.QuickQuestions, { children: [
|
|
118
|
+
/* @__PURE__ */ t(e.QuickQuestionsLabel, {}),
|
|
119
|
+
/* @__PURE__ */ t(e.QuickQuestionsList, { children: (a) => a.map((r) => /* @__PURE__ */ t(e.QuickQuestion, { children: /* @__PURE__ */ t(e.QuickQuestionButton, { question: r }) }, r)) })
|
|
120
|
+
] }),
|
|
121
|
+
/* @__PURE__ */ n(e.Workflows, { children: [
|
|
122
|
+
/* @__PURE__ */ t(e.WorkflowsLabel, {}),
|
|
123
|
+
/* @__PURE__ */ t(e.WorkflowsList, { children: (a) => a.map((r) => /* @__PURE__ */ n(e.Workflow, { workflow: r, children: [
|
|
124
|
+
/* @__PURE__ */ t(e.WorkflowIcon, {}),
|
|
125
|
+
r.displayName
|
|
126
|
+
] }, r.id)) })
|
|
127
|
+
] })
|
|
128
|
+
] })
|
|
129
|
+
] });
|
|
130
|
+
}
|
|
131
|
+
function B() {
|
|
132
|
+
return /* @__PURE__ */ n(e.MessageHeader, { children: [
|
|
133
|
+
/* @__PURE__ */ t(e.MessageAvatar, { children: /* @__PURE__ */ n(e.MessageAvatarContent, { children: [
|
|
134
|
+
/* @__PURE__ */ t(e.MessageAvatarFallback, {}),
|
|
135
|
+
/* @__PURE__ */ t(e.MessageAvatarImage, {})
|
|
136
|
+
] }) }),
|
|
137
|
+
/* @__PURE__ */ t(e.MessageName, {})
|
|
138
|
+
] });
|
|
139
|
+
}
|
|
140
|
+
function S() {
|
|
141
|
+
return /* @__PURE__ */ n(e.MessageAttachments, { children: [
|
|
142
|
+
/* @__PURE__ */ t(e.MessageAttachmentsList, { children: (a) => a.map((r) => /* @__PURE__ */ n(e.MessageAttachmentsItem, { attachment: r, children: [
|
|
143
|
+
/* @__PURE__ */ t(e.MessageAttachmentsItemIcon, {}),
|
|
144
|
+
/* @__PURE__ */ t(e.MessageAttachmentsItemTitle, {})
|
|
145
|
+
] }, r.id)) }),
|
|
146
|
+
/* @__PURE__ */ t(e.MessageAttachmentsPreview, { children: /* @__PURE__ */ t(l, { children: /* @__PURE__ */ t(e.MessageAttachmentsPreviewOverlay, { children: /* @__PURE__ */ n(e.MessageAttachmentsPreviewContent, { children: [
|
|
147
|
+
/* @__PURE__ */ t(e.MessageAttachmentsPreviewHeader, {}),
|
|
148
|
+
/* @__PURE__ */ t(e.MessageAttachmentsPreviewClose, {}),
|
|
149
|
+
/* @__PURE__ */ t(e.MessageAttachmentsPreviewBody, {})
|
|
150
|
+
] }) }) }) })
|
|
151
|
+
] });
|
|
152
|
+
}
|
|
153
|
+
function v() {
|
|
154
|
+
return /* @__PURE__ */ n(e.MessageActions, { children: [
|
|
155
|
+
/* @__PURE__ */ t(e.MessageToolActions, { children: (a) => a.map((r, c) => /* @__PURE__ */ t(e.MessageToolAction, { action: r }, `action-${c}`)) }),
|
|
156
|
+
/* @__PURE__ */ t(e.MessageAction, { action: "copy" }),
|
|
157
|
+
/* @__PURE__ */ t(e.MessageAction, { action: "upvote" }),
|
|
158
|
+
/* @__PURE__ */ t(e.MessageAction, { action: "downvote" })
|
|
159
|
+
] });
|
|
160
|
+
}
|
|
161
|
+
function H() {
|
|
162
|
+
return /* @__PURE__ */ n(e.MessageSources, { children: [
|
|
163
|
+
/* @__PURE__ */ t(e.MessageSourcesHeader, {}),
|
|
164
|
+
/* @__PURE__ */ t(e.MessageSourcesList, { children: (a) => a.map((r, c) => /* @__PURE__ */ n(e.MessageSourceItem, { href: r.url, source: r, children: [
|
|
165
|
+
/* @__PURE__ */ t(e.MessageSourceItemBreadcrumbs, { children: r.breadcrumbs?.map((i) => /* @__PURE__ */ n(p, { children: [
|
|
166
|
+
i,
|
|
167
|
+
/* @__PURE__ */ t(e.MessageSourceItemBreadcrumbIcon, {})
|
|
168
|
+
] }, i)) }),
|
|
169
|
+
/* @__PURE__ */ t(e.MessageSourceItemIcon, {}),
|
|
170
|
+
/* @__PURE__ */ t(e.MessageSourceItemTitle, {}),
|
|
171
|
+
/* @__PURE__ */ t(e.MessageSourceItemTag, {}),
|
|
172
|
+
/* @__PURE__ */ t(e.MessageSourceItemDescription, { children: (i) => i.map((o, h) => /* @__PURE__ */ t(
|
|
173
|
+
e.MessageSourceItemDescriptionPart,
|
|
174
|
+
{
|
|
175
|
+
part: o
|
|
176
|
+
},
|
|
177
|
+
`part-${h}`
|
|
178
|
+
)) }),
|
|
179
|
+
/* @__PURE__ */ t(e.MessageSourceItemIndicator, {})
|
|
180
|
+
] }, c)) })
|
|
181
|
+
] });
|
|
182
|
+
}
|
|
183
|
+
function w() {
|
|
184
|
+
return /* @__PURE__ */ n(e.Footer, { children: [
|
|
185
|
+
/* @__PURE__ */ t(L, {}),
|
|
186
|
+
/* @__PURE__ */ t(y, {})
|
|
187
|
+
] });
|
|
188
|
+
}
|
|
189
|
+
function L() {
|
|
190
|
+
return /* @__PURE__ */ n(e.InputFieldset, { children: [
|
|
191
|
+
/* @__PURE__ */ n(e.InputGroup, { children: [
|
|
192
|
+
/* @__PURE__ */ t(e.Input, {}),
|
|
193
|
+
/* @__PURE__ */ t(e.SendButton, { children: /* @__PURE__ */ t(e.SendButtonIcon, {}) })
|
|
194
|
+
] }),
|
|
195
|
+
/* @__PURE__ */ n(e.AttachmentsBar, { children: [
|
|
196
|
+
/* @__PURE__ */ t(e.AttachmentsBarList, { children: (a) => a.map((r) => /* @__PURE__ */ n(e.AttachmentsBarAttachment, { attachment: r, children: [
|
|
197
|
+
/* @__PURE__ */ t(e.AttachmentsBarAttachmentIcon, {}),
|
|
198
|
+
/* @__PURE__ */ t(e.AttachmentsBarAttachmentTitle, {}),
|
|
199
|
+
/* @__PURE__ */ t(e.AttachmentsBarAttachmentDelete, {})
|
|
200
|
+
] }, r.id)) }),
|
|
201
|
+
/* @__PURE__ */ n(e.AttachmentsBarActions, { children: [
|
|
202
|
+
/* @__PURE__ */ n(e.AttachmentsBarInfoTip, { children: [
|
|
203
|
+
/* @__PURE__ */ t(e.AttachmentsBarInfoTipIcon, {}),
|
|
204
|
+
/* @__PURE__ */ t(e.AttachmentsBarInfoTipText, {})
|
|
205
|
+
] }),
|
|
206
|
+
/* @__PURE__ */ t(e.AttachmentsBarInputs, { children: (a) => a.map((r) => /* @__PURE__ */ n(e.AttachmentsBarInput, { input: r, children: [
|
|
207
|
+
/* @__PURE__ */ t(e.AttachmentsBarInputIcon, {}),
|
|
208
|
+
r.displayName
|
|
209
|
+
] }, r.id)) })
|
|
210
|
+
] }),
|
|
211
|
+
/* @__PURE__ */ t(l, { children: /* @__PURE__ */ t(e.AttachmentsBarModal, { children: /* @__PURE__ */ t(e.AttachmentsBarModalOverlay, { children: /* @__PURE__ */ n(e.AttachmentsBarModalContent, { children: [
|
|
212
|
+
/* @__PURE__ */ n(e.AttachmentsBarModalHeader, { children: [
|
|
213
|
+
/* @__PURE__ */ t(e.AttachmentsBarModalHeading, {}),
|
|
214
|
+
/* @__PURE__ */ t(e.AttachmentsBarModalDescription, {}),
|
|
215
|
+
/* @__PURE__ */ t(e.AttachmentsBarModalHelp, {})
|
|
216
|
+
] }),
|
|
217
|
+
/* @__PURE__ */ t(e.AttachmentsBarModalClose, {}),
|
|
218
|
+
/* @__PURE__ */ t(e.AttachmentsBarModalBody, { children: /* @__PURE__ */ n(e.AttachmentsBarForm, { children: [
|
|
219
|
+
/* @__PURE__ */ n(e.AttachmentsBarFormTitle, { children: [
|
|
220
|
+
/* @__PURE__ */ t(e.AttachmentsBarFormTitleLabel, {}),
|
|
221
|
+
/* @__PURE__ */ t(e.AttachmentsBarFormTitleInput, {}),
|
|
222
|
+
/* @__PURE__ */ t(e.AttachmentsBarFormTitleError, {})
|
|
223
|
+
] }),
|
|
224
|
+
/* @__PURE__ */ n(e.AttachmentsBarFormContent, { children: [
|
|
225
|
+
/* @__PURE__ */ t(e.AttachmentsBarFormContentLabel, {}),
|
|
226
|
+
/* @__PURE__ */ t(e.AttachmentsBarFormContentInput, {}),
|
|
227
|
+
/* @__PURE__ */ t(e.AttachmentsBarFormContentError, {})
|
|
228
|
+
] }),
|
|
229
|
+
/* @__PURE__ */ t(e.AttachmentsBarFormSubmitButton, {})
|
|
230
|
+
] }) })
|
|
231
|
+
] }) }) }) })
|
|
232
|
+
] })
|
|
233
|
+
] });
|
|
234
|
+
}
|
|
235
|
+
function y() {
|
|
236
|
+
return /* @__PURE__ */ n(e.ActionBar, { children: [
|
|
237
|
+
/* @__PURE__ */ n(e.TaglineContainer, { children: [
|
|
238
|
+
/* @__PURE__ */ t(e.TaglineText, {}),
|
|
239
|
+
/* @__PURE__ */ t(e.TaglineLogo, {}),
|
|
240
|
+
/* @__PURE__ */ t(e.TaglineBrandName, {})
|
|
241
|
+
] }),
|
|
242
|
+
/* @__PURE__ */ n(e.Actions, { children: [
|
|
243
|
+
/* @__PURE__ */ t(e.HelpActions, { children: ({ pinned: a, unpinned: r }) => /* @__PURE__ */ n(s, { children: [
|
|
244
|
+
a.map((c) => /* @__PURE__ */ t(e.HelpAction, { action: c }, c.name)),
|
|
245
|
+
r.length > 0 && /* @__PURE__ */ t(e.HelpActionsTrigger, {}),
|
|
246
|
+
/* @__PURE__ */ n(e.HelpActionsMenu, { children: [
|
|
247
|
+
/* @__PURE__ */ t(e.HelpActionsMenuArrow, {}),
|
|
248
|
+
r.map((c) => /* @__PURE__ */ n(e.HelpActionsMenuItem, { action: c, children: [
|
|
249
|
+
/* @__PURE__ */ t(e.HelpActionsMenuItemIcon, { action: c }),
|
|
250
|
+
c.name
|
|
251
|
+
] }, c.name))
|
|
252
|
+
] })
|
|
253
|
+
] }) }),
|
|
254
|
+
/* @__PURE__ */ n(e.ChatAction, { action: "copy", children: [
|
|
255
|
+
/* @__PURE__ */ t(e.ChatActionLabel, { action: "copy" }),
|
|
256
|
+
/* @__PURE__ */ t(e.ChatActionFeedback, { action: "copy" })
|
|
257
|
+
] }),
|
|
258
|
+
/* @__PURE__ */ n(e.ChatAction, { action: "share", children: [
|
|
259
|
+
/* @__PURE__ */ t(e.ChatActionLabel, { action: "share" }),
|
|
260
|
+
/* @__PURE__ */ t(e.ChatActionFeedback, { action: "share" })
|
|
261
|
+
] }),
|
|
262
|
+
/* @__PURE__ */ t(e.ChatAction, { action: "clear" }),
|
|
263
|
+
/* @__PURE__ */ t(e.ChatAction, { action: "stop" })
|
|
264
|
+
] })
|
|
265
|
+
] });
|
|
266
|
+
}
|
|
267
|
+
function x() {
|
|
268
|
+
return /* @__PURE__ */ t(l, { children: /* @__PURE__ */ t(e.FeedbackModal, { children: /* @__PURE__ */ t(e.FeedbackModalOverlay, { children: /* @__PURE__ */ n(e.FeedbackModalContent, { children: [
|
|
269
|
+
/* @__PURE__ */ t(e.FeedbackModalHeader, {}),
|
|
270
|
+
/* @__PURE__ */ t(e.FeedbackModalClose, {}),
|
|
271
|
+
/* @__PURE__ */ t(e.FeedbackModalBody, { children: /* @__PURE__ */ n(e.FeedbackForm, { children: [
|
|
272
|
+
/* @__PURE__ */ n(e.FeedbackItem, { name: "unrelated_response", children: [
|
|
273
|
+
/* @__PURE__ */ t(e.FeedbackItemCheckbox, { children: /* @__PURE__ */ t(e.FeedbackItemCheckboxIndicator, {}) }),
|
|
274
|
+
/* @__PURE__ */ t(e.FeedbackItemLabel, {}),
|
|
275
|
+
/* @__PURE__ */ t(e.FeedbackItemDescription, {})
|
|
276
|
+
] }),
|
|
277
|
+
/* @__PURE__ */ n(e.FeedbackItem, { name: "inaccurate_statement", children: [
|
|
278
|
+
/* @__PURE__ */ t(e.FeedbackItemCheckbox, { children: /* @__PURE__ */ t(e.FeedbackItemCheckboxIndicator, {}) }),
|
|
279
|
+
/* @__PURE__ */ t(e.FeedbackItemLabel, {}),
|
|
280
|
+
/* @__PURE__ */ t(e.FeedbackItemDescription, {})
|
|
281
|
+
] }),
|
|
282
|
+
/* @__PURE__ */ n(e.FeedbackItem, { name: "inaccurate_code_snippet", children: [
|
|
283
|
+
/* @__PURE__ */ t(e.FeedbackItemCheckbox, { children: /* @__PURE__ */ t(e.FeedbackItemCheckboxIndicator, {}) }),
|
|
284
|
+
/* @__PURE__ */ t(e.FeedbackItemLabel, {}),
|
|
285
|
+
/* @__PURE__ */ t(e.FeedbackItemDescription, {})
|
|
286
|
+
] }),
|
|
287
|
+
/* @__PURE__ */ n(e.FeedbackItem, { name: "irrelevant_citations", children: [
|
|
288
|
+
/* @__PURE__ */ t(e.FeedbackItemCheckbox, { children: /* @__PURE__ */ t(e.FeedbackItemCheckboxIndicator, {}) }),
|
|
289
|
+
/* @__PURE__ */ t(e.FeedbackItemLabel, {})
|
|
290
|
+
] }),
|
|
291
|
+
/* @__PURE__ */ t(e.FeedbackSubmitButton, {})
|
|
292
|
+
] }) })
|
|
293
|
+
] }) }) }) });
|
|
294
|
+
}
|
|
295
|
+
function f() {
|
|
296
|
+
return /* @__PURE__ */ n(e.FormWrapper, { children: [
|
|
297
|
+
/* @__PURE__ */ t(e.FormClose, {}),
|
|
298
|
+
/* @__PURE__ */ n(e.Form, { children: [
|
|
299
|
+
/* @__PURE__ */ n(e.FormHeader, { children: [
|
|
300
|
+
/* @__PURE__ */ t(e.FormHeading, {}),
|
|
301
|
+
/* @__PURE__ */ t(e.FormDescription, {})
|
|
302
|
+
] }),
|
|
303
|
+
/* @__PURE__ */ t(e.FormContent, { children: (a) => /* @__PURE__ */ n(s, { children: [
|
|
304
|
+
a.map((r, c) => /* @__PURE__ */ n(e.FormField, { field: r, autoFocus: c === 0, children: [
|
|
305
|
+
/* @__PURE__ */ t(e.FormFieldLabel, {}),
|
|
306
|
+
r.inputType === "TEXT" && /* @__PURE__ */ t(e.FormFieldText, {}),
|
|
307
|
+
r.inputType === "EMAIL" && /* @__PURE__ */ t(e.FormFieldEmail, {}),
|
|
308
|
+
r.inputType === "FILE" && /* @__PURE__ */ t(e.FormFieldFile, {}),
|
|
309
|
+
r.inputType === "TEXTAREA" && /* @__PURE__ */ t(e.FormFieldTextArea, {}),
|
|
310
|
+
r.inputType === "CHECKBOX" && /* @__PURE__ */ t(e.FormFieldCheckbox, { children: /* @__PURE__ */ t(e.FormFieldCheckboxIndicator, {}) }),
|
|
311
|
+
r.inputType === "SELECT" && /* @__PURE__ */ n(e.FormFieldSelect, { children: [
|
|
312
|
+
/* @__PURE__ */ n(e.FormFieldSelectTrigger, { children: [
|
|
313
|
+
/* @__PURE__ */ t(e.FormFieldSelectValue, {}),
|
|
314
|
+
/* @__PURE__ */ t(e.FormFieldSelectIcon, {})
|
|
315
|
+
] }),
|
|
316
|
+
/* @__PURE__ */ t(e.FormFieldSelectContent, { children: /* @__PURE__ */ t(e.FormFieldSelectViewport, { children: r.items.map((i) => /* @__PURE__ */ n(e.FormFieldSelectItem, { value: i.value, children: [
|
|
317
|
+
/* @__PURE__ */ t(e.FormFieldSelectItemText, { children: i.label }),
|
|
318
|
+
/* @__PURE__ */ t(e.FormFieldSelectItemIndicator, {})
|
|
319
|
+
] }, i.value)) }) })
|
|
320
|
+
] }),
|
|
321
|
+
/* @__PURE__ */ t(e.FormFieldError, {})
|
|
322
|
+
] }, r.name)),
|
|
323
|
+
/* @__PURE__ */ t(e.FormError, {})
|
|
324
|
+
] }) }),
|
|
325
|
+
/* @__PURE__ */ n(e.FormFooter, { children: [
|
|
326
|
+
/* @__PURE__ */ t(e.FormCancel, {}),
|
|
327
|
+
/* @__PURE__ */ t(e.FormSubmit, {})
|
|
328
|
+
] })
|
|
329
|
+
] }),
|
|
330
|
+
/* @__PURE__ */ n(e.FormSuccess, { children: [
|
|
331
|
+
/* @__PURE__ */ t(e.FormSuccessHeading, {}),
|
|
332
|
+
/* @__PURE__ */ t(e.FormSuccessMessage, {}),
|
|
333
|
+
/* @__PURE__ */ t(e.FormSuccessButton, {})
|
|
334
|
+
] })
|
|
335
|
+
] });
|
|
336
|
+
}
|
|
337
|
+
export {
|
|
338
|
+
Q as InkeepEmbeddedChat,
|
|
339
|
+
I as InkeepEmbeddedChatImpl
|
|
340
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("./embedded-chat.cjs"),t=require("@inkeep/cxkit-styled"),p=require("./embedded-search.cjs"),m=require("./embedded-search-and-chat.impl.cjs");function I(n){const{config:d,...r}=m.useWidgetImpl(n);return e.jsx(t.Shadow,{wrapperStyles:{height:"inherit",width:"inherit"},children:e.jsx(t.RootProvider,{config:d,interactionType:t.WebWidgetInteractionType.EmbeddedSearchAndChat,children:e.jsx(a,{...r})})})}function a(n){const{view:d,setView:r,shouldShowAskAICard:u,onToggleView:i,defaultView:c,shouldAutoFocusInput:h,searchLabel:s,askAILabel:o}=n;return e.jsxs(t.WidgetProvider,{widget:{setView:r},children:[e.jsx(p.InkeepEmbeddedSearchImpl,{isHidden:d==="chat",onToggleView:i,shouldShowAskAICard:u,shouldAutoFocusInput:h&&c==="search",searchLabel:s,askAILabel:o}),e.jsx(l.InkeepEmbeddedChatImpl,{isHidden:d==="search",onToggleView:i,shouldAutoFocusInput:h&&c==="chat",askAILabel:o,searchLabel:s})]})}exports.InkeepEmbeddedSearchAndChat=I;exports.InkeepEmbeddedSearchAndChatImpl=a;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useWidgetImpl } from './embedded-search-and-chat.impl';
|
|
2
|
+
import { ModalViewTypes, InkeepConfig, WidgetView } from '@inkeep/cxkit-types';
|
|
3
|
+
import { RefObject } from 'react';
|
|
4
|
+
export interface InkeepEmbeddedSearchAndChatFunctions {
|
|
5
|
+
setView: (view: ModalViewTypes) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface InkeepEmbeddedSearchAndChatProps extends Partial<Omit<InkeepConfig, 'interactionType'>>, WidgetView {
|
|
8
|
+
/**
|
|
9
|
+
* The default view to show when the widget is loaded.
|
|
10
|
+
* @default 'search'
|
|
11
|
+
*/
|
|
12
|
+
defaultView?: ModalViewTypes;
|
|
13
|
+
/**
|
|
14
|
+
* Whether to always open the widget in the default view. (Modal only)
|
|
15
|
+
*
|
|
16
|
+
* By default, subsequent opens will remember the last view.
|
|
17
|
+
* This prop will force the widget to always open in the default view.
|
|
18
|
+
*
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
forceDefaultView?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to show the Ask AI card.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
shouldShowAskAICard?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Whether to auto focus the input.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
shouldAutoFocusInput?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* A ref to the component functions.
|
|
34
|
+
*/
|
|
35
|
+
ref?: RefObject<InkeepEmbeddedSearchAndChatFunctions>;
|
|
36
|
+
}
|
|
37
|
+
export declare function InkeepEmbeddedSearchAndChat(props: InkeepEmbeddedSearchAndChatProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
type InkeepEmbeddedSearchAndChatImplProps = Omit<ReturnType<typeof useWidgetImpl>, 'config'>;
|
|
39
|
+
export declare function InkeepEmbeddedSearchAndChatImpl(props: InkeepEmbeddedSearchAndChatImplProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useWidgetImpl } from './embedded-search-and-chat.impl';
|
|
2
|
+
import { ModalViewTypes, InkeepConfig, WidgetView } from '@inkeep/cxkit-types';
|
|
3
|
+
import { RefObject } from 'react';
|
|
4
|
+
export interface InkeepEmbeddedSearchAndChatFunctions {
|
|
5
|
+
setView: (view: ModalViewTypes) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface InkeepEmbeddedSearchAndChatProps extends Partial<Omit<InkeepConfig, 'interactionType'>>, WidgetView {
|
|
8
|
+
/**
|
|
9
|
+
* The default view to show when the widget is loaded.
|
|
10
|
+
* @default 'search'
|
|
11
|
+
*/
|
|
12
|
+
defaultView?: ModalViewTypes;
|
|
13
|
+
/**
|
|
14
|
+
* Whether to always open the widget in the default view. (Modal only)
|
|
15
|
+
*
|
|
16
|
+
* By default, subsequent opens will remember the last view.
|
|
17
|
+
* This prop will force the widget to always open in the default view.
|
|
18
|
+
*
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
forceDefaultView?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to show the Ask AI card.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
shouldShowAskAICard?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Whether to auto focus the input.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
shouldAutoFocusInput?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* A ref to the component functions.
|
|
34
|
+
*/
|
|
35
|
+
ref?: RefObject<InkeepEmbeddedSearchAndChatFunctions>;
|
|
36
|
+
}
|
|
37
|
+
export declare function InkeepEmbeddedSearchAndChat(props: InkeepEmbeddedSearchAndChatProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
type InkeepEmbeddedSearchAndChatImplProps = Omit<ReturnType<typeof useWidgetImpl>, 'config'>;
|
|
39
|
+
export declare function InkeepEmbeddedSearchAndChatImpl(props: InkeepEmbeddedSearchAndChatImplProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),a=require("../utils.cjs");function p(f){const{defaultView:u="search",aiChatSettings:i,baseSettings:g,searchSettings:o,shouldAutoFocusInput:l=!0,onToggleView:h,ref:S,...R}=f,s=t.useRef(null),m=a.composeRefs(s,i?.chatFunctionsRef),r=t.useRef(null),d=a.composeRefs(r,o?.searchFunctionsRef),w={...i,chatFunctionsRef:m},I={...o,searchFunctionsRef:d},[n,c]=t.useState(u),b=e=>{e.autoSubmit&&e.query&&s.current?.submitMessage(e.query),h?.(e),c(e.view)};return t.useImperativeHandle(S,()=>({setView:c})),t.useEffect(()=>{n==="chat"?s.current?.focusInput():r.current?.focusInput()},[n]),{config:{baseSettings:g,aiChatSettings:w,searchSettings:I},defaultView:u,view:n,setView:c,onToggleView:b,shouldAutoFocusInput:l,...R}}exports.useWidgetImpl=p;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InkeepEmbeddedSearchAndChatProps } from './embedded-search-and-chat';
|
|
2
|
+
import { ModalViewTypes, InkeepConfig } from '@inkeep/cxkit-types';
|
|
3
|
+
interface UseWidgetImpReturn extends InkeepEmbeddedSearchAndChatProps {
|
|
4
|
+
config: InkeepConfig;
|
|
5
|
+
view: ModalViewTypes;
|
|
6
|
+
setView: (view: ModalViewTypes) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function useWidgetImpl<T extends InkeepEmbeddedSearchAndChatProps>(props: T): UseWidgetImpReturn;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { InkeepEmbeddedSearchAndChatProps } from './embedded-search-and-chat';
|
|
2
|
+
import { ModalViewTypes, InkeepConfig } from '@inkeep/cxkit-types';
|
|
3
|
+
interface UseWidgetImpReturn extends InkeepEmbeddedSearchAndChatProps {
|
|
4
|
+
config: InkeepConfig;
|
|
5
|
+
view: ModalViewTypes;
|
|
6
|
+
setView: (view: ModalViewTypes) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function useWidgetImpl<T extends InkeepEmbeddedSearchAndChatProps>(props: T): UseWidgetImpReturn;
|
|
9
|
+
export {};
|