@inkeep/cxkit-react 0.0.0-dev-20250723223321 → 0.0.0-rc-20250806214454

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/components/api/analytics/events.cjs +1 -0
  2. package/dist/components/api/analytics/events.js +34 -0
  3. package/dist/components/api/analytics/feedback.cjs +1 -0
  4. package/dist/components/api/analytics/feedback.js +31 -0
  5. package/dist/components/chat-button.cjs +1 -1
  6. package/dist/components/chat-button.js +16 -53
  7. package/dist/components/default-settings.cjs +1 -0
  8. package/dist/components/default-settings.js +25 -0
  9. package/dist/components/embedded-chat.cjs +1 -1
  10. package/dist/components/embedded-chat.js +26 -323
  11. package/dist/components/embedded-search-and-chat.cjs +1 -1
  12. package/dist/components/embedded-search-and-chat.js +16 -57
  13. package/dist/components/embedded-search.cjs +1 -1
  14. package/dist/components/embedded-search.js +13 -166
  15. package/dist/components/hooks/use-base-settings.cjs +1 -0
  16. package/dist/components/hooks/use-base-settings.js +38 -0
  17. package/dist/components/hooks/use-browser-storage.cjs +1 -0
  18. package/dist/components/hooks/use-browser-storage.js +91 -0
  19. package/dist/components/hooks/use-search-settings.cjs +1 -0
  20. package/dist/components/hooks/use-search-settings.js +23 -0
  21. package/dist/components/hooks/use-user-properties.cjs +1 -0
  22. package/dist/components/hooks/use-user-properties.js +28 -0
  23. package/dist/components/index.cjs +1 -1
  24. package/dist/components/index.js +23 -32
  25. package/dist/components/modal.chat.cjs +1 -1
  26. package/dist/components/modal.chat.js +10 -11
  27. package/dist/components/modal.cjs +1 -1
  28. package/dist/components/modal.js +1 -1
  29. package/dist/components/modal.search-and-chat.cjs +1 -1
  30. package/dist/components/modal.search-and-chat.js +16 -23
  31. package/dist/components/modal.search.cjs +1 -1
  32. package/dist/components/modal.search.js +7 -8
  33. package/dist/components/searchbar.cjs +1 -1
  34. package/dist/components/searchbar.js +16 -61
  35. package/dist/components/sidebar-chat.cjs +1 -1
  36. package/dist/components/sidebar-chat.js +9 -39
  37. package/dist/components/utils/generate-uid.cjs +1 -0
  38. package/dist/components/utils/generate-uid.js +8 -0
  39. package/dist/components/utils/index.cjs +1 -0
  40. package/dist/components/utils/index.js +6 -0
  41. package/dist/components/utils/search-implementation.cjs +89 -0
  42. package/dist/components/utils/search-implementation.js +125 -0
  43. package/dist/components/widget-toggle.cjs +1 -1
  44. package/dist/components/widget-toggle.js +1 -1
  45. package/dist/index.cjs +1 -1
  46. package/dist/index.d.cts +47 -125
  47. package/dist/index.d.ts +47 -125
  48. package/dist/index.js +24 -34
  49. package/package.json +4 -4
  50. package/dist/components/embedded-search-and-chat.impl.cjs +0 -1
  51. package/dist/components/embedded-search-and-chat.impl.js +0 -43
  52. package/dist/components/intelligent-form.cjs +0 -1
  53. package/dist/components/intelligent-form.js +0 -130
  54. /package/dist/{utils.cjs → components/utils.cjs} +0 -0
  55. /package/dist/{utils.js → components/utils.js} +0 -0
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});async function a(e,s,i){try{const t=`${i}/events`,r={...e,type:e.eventName};if("searchQuery"in e.properties)r.entityType="search",r.searchQuery=e.properties.searchQuery;else if("messageId"in e.properties)r.entityType="message",r.messageId=e.properties.messageId;else{if(r.entityType="conversation",!e.properties.conversationId)return;r.conversationId=e.properties.conversationId}const o=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`},body:JSON.stringify(r)});if(!o.ok){const n=await o.text();throw new Error(`Failed to log event: ${n}`)}}catch(t){console.warn("Error in logEvent:",t)}}exports.logEvent=a;
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ async function a(e, s, i) {
3
+ try {
4
+ const o = `${i}/events`, r = {
5
+ ...e,
6
+ type: e.eventName
7
+ };
8
+ if ("searchQuery" in e.properties)
9
+ r.entityType = "search", r.searchQuery = e.properties.searchQuery;
10
+ else if ("messageId" in e.properties)
11
+ r.entityType = "message", r.messageId = e.properties.messageId;
12
+ else {
13
+ if (r.entityType = "conversation", !e.properties.conversationId) return;
14
+ r.conversationId = e.properties.conversationId;
15
+ }
16
+ const t = await fetch(o, {
17
+ method: "POST",
18
+ headers: {
19
+ "Content-Type": "application/json",
20
+ Authorization: `Bearer ${s}`
21
+ },
22
+ body: JSON.stringify(r)
23
+ });
24
+ if (!t.ok) {
25
+ const n = await t.text();
26
+ throw new Error(`Failed to log event: ${n}`);
27
+ }
28
+ } catch (o) {
29
+ console.warn("Error in logEvent:", o);
30
+ }
31
+ }
32
+ export {
33
+ a as logEvent
34
+ };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});async function p(o){try{const{type:e,messageId:n,reasons:s=[],apiKey:a,apiUrl:i,userProperties:c,properties:d}=o,b=`${i}/feedback`,r={type:e,messageId:n,createdAt:new Date().toISOString(),userProperties:c,properties:d};e==="negative"&&(r.reasons=s);const t=await fetch(b,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(r)});if(!t.ok){const u=await t.text();throw new Error(`Failed to send feedback: ${u}`)}return t.json()}catch(e){console.warn("Error in submitFeedback:",e)}}exports.submitFeedback=p;
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ async function u(o) {
3
+ try {
4
+ const { type: e, messageId: n, reasons: s = [], apiKey: a, apiUrl: i, userProperties: c, properties: d } = o, p = `${i}/feedback`, r = {
5
+ type: e,
6
+ messageId: n,
7
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
8
+ userProperties: c,
9
+ properties: d
10
+ };
11
+ e === "negative" && (r.reasons = s);
12
+ const t = await fetch(p, {
13
+ method: "POST",
14
+ headers: {
15
+ "Content-Type": "application/json",
16
+ Authorization: `Bearer ${a}`
17
+ },
18
+ body: JSON.stringify(r)
19
+ });
20
+ if (!t.ok) {
21
+ const b = await t.text();
22
+ throw new Error(`Failed to send feedback: ${b}`);
23
+ }
24
+ return t.json();
25
+ } catch (e) {
26
+ console.warn("Error in submitFeedback:", e);
27
+ }
28
+ }
29
+ export {
30
+ u as submitFeedback
31
+ };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("@inkeep/cxkit-styled"),I=require("./modal.cjs"),f=require("./embedded-search-and-chat.cjs"),j=require("./embedded-search-and-chat.impl.cjs"),S=require("./embedded-chat.cjs"),b=require("../utils.cjs"),k=require("@radix-ui/react-use-controllable-state");function A(o){const{modalSettings:n,label:s,defaultView:r="chat",canToggleView:a=!0,avatar:i,...l}=o,p={...l,shouldShowAskAICard:a?o.shouldShowAskAICard:!1},{config:c,...u}=j.useWidgetImpl({...p,defaultView:r}),m=h=>{n?.isOpen===void 0&&(o.forceDefaultView&&!h&&u.setView(r??"search"),d(!!h))},[g=!1,d]=k.useControllableState({prop:n?.isOpen,defaultProp:!1,onChange:b.composeEventHandlers(n?.onOpenChange,m)}),x={...n,isOpen:g,onOpenChange:d},B=()=>a?e.jsx(f.InkeepEmbeddedSearchAndChatImpl,{...u}):e.jsx(S.InkeepEmbeddedChatImpl,{...l});return e.jsxs(e.Fragment,{children:[e.jsx(t.ErrorBoundary,{children:e.jsx(t.Shadow,{wrapperStyles:{display:"contents"},children:e.jsx(t.RootProvider,{config:c,componentType:t.WebWidgetInteractionType.ChatButton,children:e.jsx(C,{label:s,avatar:i,onOpenChange:d})})})}),e.jsx(I.InkeepModal,{...c,componentType:t.WebWidgetInteractionType.ChatButton,modalSettings:x,children:B()})]})}function C({label:o="Ask AI",avatar:n,onOpenChange:s}){const r=a=>{a.button!==2&&s(i=>!i)};return e.jsx(t.ChatButton.Container,{children:e.jsxs(t.ChatButton.ChatButton,{onClick:r,children:[e.jsx(t.ChatButton.ChatButtonText,{children:o}),e.jsx(t.ChatButton.ChatButtonAvatarContent,{children:e.jsx(t.ChatButton.ChatButtonAvatarImage,{avatar:n})})]})})}exports.ChatButtonImpl=C;exports.InkeepChatButton=A;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),t=require("@inkeep/cxkit-react-oss"),u=require("./hooks/use-base-settings.cjs"),c=require("./hooks/use-search-settings.cjs"),g=require("./default-settings.cjs");function S(e){const s=u.useBaseSettings(e.baseSettings),n=c.useSearchSettings({baseSettings:s,searchSettings:e.searchSettings}),i=t.mergeProps(g.defaultInkeepAIChatSettings,e.aiChatSettings??{}),a=t.mergeProps(e,{baseSettings:s,aiChatSettings:i,searchSettings:n});return r.jsx(t.InkeepChatButton,{...a})}exports.InkeepChatButton=S;
@@ -1,57 +1,20 @@
1
1
  "use client";
2
- import { jsxs as u, Fragment as k, jsx as t } from "react/jsx-runtime";
3
- import { ErrorBoundary as A, Shadow as S, RootProvider as w, WebWidgetInteractionType as p, ChatButton as o } from "@inkeep/cxkit-styled";
4
- import { InkeepModal as b } from "./modal.js";
5
- import { InkeepEmbeddedSearchAndChatImpl as v } from "./embedded-search-and-chat.js";
6
- import { useWidgetImpl as y } from "./embedded-search-and-chat.impl.js";
7
- import { InkeepEmbeddedChatImpl as O } from "./embedded-chat.js";
8
- import { composeEventHandlers as T } from "../utils.js";
9
- import { useControllableState as x } from "@radix-ui/react-use-controllable-state";
10
- function R(n) {
11
- const {
12
- modalSettings: e,
13
- label: i,
14
- defaultView: r = "chat",
15
- canToggleView: a = !0,
16
- avatar: l,
17
- ...s
18
- } = n, C = {
19
- ...s,
20
- shouldShowAskAICard: a ? n.shouldShowAskAICard : !1
21
- }, { config: c, ...h } = y({ ...C, defaultView: r }), f = (m) => {
22
- e?.isOpen === void 0 && (n.forceDefaultView && !m && h.setView(r ?? "search"), d(!!m));
23
- }, [g = !1, d] = x({
24
- prop: e?.isOpen,
25
- defaultProp: !1,
26
- onChange: T(e?.onOpenChange, f)
27
- }), I = {
28
- ...e,
29
- isOpen: g,
30
- onOpenChange: d
31
- }, B = () => a ? /* @__PURE__ */ t(v, { ...h }) : /* @__PURE__ */ t(O, { ...s });
32
- return /* @__PURE__ */ u(k, { children: [
33
- /* @__PURE__ */ t(A, { children: /* @__PURE__ */ t(S, { wrapperStyles: { display: "contents" }, children: /* @__PURE__ */ t(w, { config: c, componentType: p.ChatButton, children: /* @__PURE__ */ t(E, { label: i, avatar: l, onOpenChange: d }) }) }) }),
34
- /* @__PURE__ */ t(
35
- b,
36
- {
37
- ...c,
38
- componentType: p.ChatButton,
39
- modalSettings: I,
40
- children: B()
41
- }
42
- )
43
- ] });
44
- }
45
- function E({ label: n = "Ask AI", avatar: e, onOpenChange: i }) {
46
- const r = (a) => {
47
- a.button !== 2 && i((l) => !l);
48
- };
49
- return /* @__PURE__ */ t(o.Container, { children: /* @__PURE__ */ u(o.ChatButton, { onClick: r, children: [
50
- /* @__PURE__ */ t(o.ChatButtonText, { children: n }),
51
- /* @__PURE__ */ t(o.ChatButtonAvatarContent, { children: /* @__PURE__ */ t(o.ChatButtonAvatarImage, { avatar: e }) })
52
- ] }) });
2
+ import { jsx as o } from "react/jsx-runtime";
3
+ import { mergeProps as n, InkeepChatButton as r } from "@inkeep/cxkit-react-oss";
4
+ import { useBaseSettings as g } from "./hooks/use-base-settings.js";
5
+ import { useSearchSettings as m } from "./hooks/use-search-settings.js";
6
+ import { defaultInkeepAIChatSettings as S } from "./default-settings.js";
7
+ function p(t) {
8
+ const e = g(t.baseSettings), s = m({
9
+ baseSettings: e,
10
+ searchSettings: t.searchSettings
11
+ }), i = n(S, t.aiChatSettings ?? {}), a = n(t, {
12
+ baseSettings: e,
13
+ aiChatSettings: i,
14
+ searchSettings: s
15
+ });
16
+ return /* @__PURE__ */ o(r, { ...a });
53
17
  }
54
18
  export {
55
- E as ChatButtonImpl,
56
- R as InkeepChatButton
19
+ p as InkeepChatButton
57
20
  };
@@ -0,0 +1 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={graphUrl:"http://localhost:3002/tenants/test-tenant/graphs/customer-support-graph/api/chat"},t={env:"production",primaryBrandColor:"#0000",analyticsApiBaseUrl:"https://api.io.inkeep.com",privacyPreferences:{optOutAnalyticalCookies:!1,optOutAllAnalytics:!1,optOutFunctionalCookies:!1}},a={apiKey:"",url:"https://api.inkeep.com"};exports.defaultInkeepAIChatSettings=e;exports.defaultInkeepBaseSettings=t;exports.defaultInkeepSearchSettings=a;
@@ -0,0 +1,25 @@
1
+ "use client";
2
+ const t = {
3
+ // TODO: remove this
4
+ graphUrl: "http://localhost:3002/tenants/test-tenant/graphs/customer-support-graph/api/chat"
5
+ }, e = {
6
+ env: "production",
7
+ primaryBrandColor: "#0000",
8
+ analyticsApiBaseUrl: "https://api.io.inkeep.com",
9
+ privacyPreferences: {
10
+ optOutAnalyticalCookies: !1,
11
+ // disable use of cookies for analytics. Default is false.
12
+ optOutAllAnalytics: !1,
13
+ // disable all event logging, even analytics that don't use cookies (e.g. anonymous events)
14
+ optOutFunctionalCookies: !1
15
+ // disable all cookies that are used for functionality, like caching chat sessions cross-tabs. Default is false.
16
+ }
17
+ }, a = {
18
+ apiKey: "",
19
+ url: "https://api.inkeep.com"
20
+ };
21
+ export {
22
+ t as defaultInkeepAIChatSettings,
23
+ e as defaultInkeepBaseSettings,
24
+ a as defaultInkeepSearchSettings
25
+ };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("@inkeep/cxkit-styled"),m=require("react"),l=require("./widget-toggle.cjs"),C=require("./modal.cjs");function x(a){const{baseSettings:t,aiChatSettings:s}=a;return e.jsx(d.ErrorBoundary,{children:e.jsx(d.Shadow,{wrapperStyles:{height:"inherit",width:"inherit"},children:e.jsx(d.RootProvider,{config:{baseSettings:t,aiChatSettings:s},componentType:d.WebWidgetInteractionType.EmbeddedChat,children:e.jsx(o,{...a})})})})}function c(a){const{children:t,onToggleView:s,isHidden:n,shouldAutoFocusInput:r=!s}=a;return e.jsx(d.EmbeddedChat.Provider,{isHidden:n,shouldAutoFocusInput:r,children:t})}function o(a){return e.jsx(c,{...a,children:e.jsx(i,{...a})})}function i(a){const{onToggleView:t,variant:s,header:n=j}=a,r=d.useModal(),h=d.useWidget(),b=r&&!h?C.ModalContent:m.Fragment;return e.jsx(b,{children:e.jsxs(d.EmbeddedChat.Wrapper,{variant:s??(t?"no-shadow":"container-with-shadow"),"data-composite":d.dataAttr(!!a.onToggleView||r?.isOpen),children:[e.jsx(d.EmbeddedChat.ConversationLoading,{}),e.jsxs(d.EmbeddedChat.Root,{children:[e.jsx(n,{...a}),e.jsx(E,{}),e.jsx(M,{})]}),e.jsx(B,{}),e.jsx(S,{})]})})}function j(a){const{onToggleView:t,askAILabel:s,searchLabel:n}=a,r=!!t;return e.jsx(d.EmbeddedChat.Header,{"data-show-toolbar":d.dataAttr(r),children:r?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(l.WidgetToggle,{onToggleView:t,askAILabel:s,searchLabel:n,view:"chat"}),e.jsx(d.Modal.Close,{})]}):e.jsx(d.Modal.Close,{})})}function E(){return e.jsx(d.EmbeddedChat.Content,{children:e.jsxs(d.EmbeddedChat.ContentScrollArea,{children:[e.jsx(d.EmbeddedChat.ContentScrollAreaViewport,{children:e.jsx(u,{})}),e.jsx(d.EmbeddedChat.ContentScrollAreaScrollbar,{children:e.jsx(d.EmbeddedChat.ContentScrollAreaThumb,{})}),e.jsx(d.EmbeddedChat.ContentScrollAreaCorner,{})]})})}function u(){return e.jsx(d.EmbeddedChat.Messages,{children:({messages:a})=>e.jsxs(e.Fragment,{children:[e.jsx(F,{}),a.map(t=>e.jsxs(d.EmbeddedChat.MessageWrapper,{message:t,children:[e.jsx(g,{}),e.jsx(d.EmbeddedChat.MessageLoading,{}),e.jsxs(d.EmbeddedChat.MessageContentWrapper,{children:[e.jsx(d.EmbeddedChat.MessageContent,{children:e.jsx(d.EmbeddedChat.Message,{})}),e.jsx(p,{}),e.jsx(A,{}),e.jsx(I,{})]})]},t.id))]})})}function F(){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.ExampleQuestions,{children:[e.jsx(d.EmbeddedChat.ExampleQuestionsLabel,{}),e.jsx(d.EmbeddedChat.ExampleQuestionsList,{children:a=>a.map(t=>e.jsx(d.EmbeddedChat.ExampleQuestion,{children:e.jsx(d.EmbeddedChat.ExampleQuestionButton,{question:t})},t))})]})]})]})}function g(){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 p(){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 A(){return e.jsxs(d.EmbeddedChat.MessageToolbar,{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 I(){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(m.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((r,h)=>e.jsx(d.EmbeddedChat.MessageSourceItemDescriptionPart,{part:r},`part-${h}`))}),e.jsx(d.EmbeddedChat.MessageSourceItemIndicator,{})]},s))})]})}function M(){return e.jsxs(d.EmbeddedChat.Footer,{children:[e.jsx(k,{}),e.jsx(T,{})]})}function k(){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.jsx(d.EmbeddedChat.AttachmentsBarInput,{input:t,children: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 T(){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 B(){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 S(){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=x;exports.InkeepEmbeddedChatImpl=o;exports.InkeepEmbeddedChatImplContent=i;exports.InkeepEmbeddedChatProvider=c;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("@inkeep/cxkit-react-oss"),n=require("./widget-toggle.cjs"),o=require("./default-settings.cjs"),l=require("./hooks/use-base-settings.cjs");function c(s){const d=l.useBaseSettings(s.baseSettings),a=e.mergeProps(o.defaultInkeepAIChatSettings,s.aiChatSettings??{}),r=e.mergeProps(s,{baseSettings:d,aiChatSettings:a});return t.jsx(e.InkeepEmbeddedChat,{header:h,...r})}const h=s=>{const{onToggleView:d,askAILabel:a,searchLabel:r}=s,i=!!d;return t.jsx(e.EmbeddedChat.Header,{"data-show-toolbar":e.dataAttr(i),children:i?t.jsxs(e.EmbeddedChat.HeaderToolbar,{children:[t.jsxs(e.EmbeddedChat.HeaderToolbarWrapper,{children:[t.jsx(e.EmbeddedChat.ToolbarHeader,{}),t.jsxs(e.EmbeddedChat.Disclaimer,{children:[t.jsx(e.EmbeddedChat.DisclaimerTrigger,{}),t.jsxs(e.EmbeddedChat.DisclaimerContent,{side:"bottom",align:"start",children:[t.jsx(e.EmbeddedChat.DisclaimerText,{}),t.jsx(e.EmbeddedChat.DisclaimerArrow,{})]})]})]}),t.jsx(n.WidgetToggle,{onToggleView:d,askAILabel:a,searchLabel:r,view:"chat"}),t.jsx(e.Modal.Close,{})]}):t.jsx(e.Modal.Close,{})})};exports.InkeepEmbeddedChat=c;
@@ -1,338 +1,41 @@
1
1
  "use client";
2
- import { jsx as t, jsxs as n, Fragment as s } from "react/jsx-runtime";
3
- import { ErrorBoundary as u, Shadow as g, RootProvider as p, WebWidgetInteractionType as A, EmbeddedChat as e, useModal as b, useWidget as M, dataAttr as m, Modal as h, PortalWithTheme as d } from "@inkeep/cxkit-styled";
4
- import { Fragment as F } from "react";
5
- import { WidgetToggle as I } from "./widget-toggle.js";
6
- import { ModalContent as C } from "./modal.js";
7
- function R(a) {
8
- const { baseSettings: r, aiChatSettings: c } = a;
9
- return /* @__PURE__ */ t(u, { children: /* @__PURE__ */ t(
10
- g,
11
- {
12
- wrapperStyles: {
13
- height: "inherit",
14
- width: "inherit"
15
- },
16
- children: /* @__PURE__ */ t(
17
- p,
18
- {
19
- config: {
20
- baseSettings: r,
21
- aiChatSettings: c
22
- },
23
- componentType: A.EmbeddedChat,
24
- children: /* @__PURE__ */ t(T, { ...a })
25
- }
26
- )
27
- }
28
- ) });
29
- }
30
- function k(a) {
31
- const { children: r, onToggleView: c, isHidden: o, shouldAutoFocusInput: i = !c } = a;
32
- return /* @__PURE__ */ t(e.Provider, { isHidden: o, shouldAutoFocusInput: i, children: r });
33
- }
34
- function T(a) {
35
- return /* @__PURE__ */ t(k, { ...a, children: /* @__PURE__ */ t(B, { ...a }) });
36
- }
37
- function B(a) {
38
- const { onToggleView: r, variant: c, header: o = S } = a, i = b(), l = M();
39
- return /* @__PURE__ */ t(i && !l ? C : F, { children: /* @__PURE__ */ n(
40
- e.Wrapper,
41
- {
42
- variant: c ?? (r ? "no-shadow" : "container-with-shadow"),
43
- "data-composite": m(!!a.onToggleView || i?.isOpen),
44
- children: [
45
- /* @__PURE__ */ t(e.ConversationLoading, {}),
46
- /* @__PURE__ */ n(e.Root, { children: [
47
- /* @__PURE__ */ t(o, { ...a }),
48
- /* @__PURE__ */ t(v, {}),
49
- /* @__PURE__ */ t(D, {})
50
- ] }),
51
- /* @__PURE__ */ t(P, {}),
52
- /* @__PURE__ */ t(V, {})
53
- ]
54
- }
55
- ) });
56
- }
57
- function S(a) {
58
- const { onToggleView: r, askAILabel: c, searchLabel: o } = a, i = !!r;
59
- return /* @__PURE__ */ t(e.Header, { "data-show-toolbar": m(i), children: i ? /* @__PURE__ */ n(e.HeaderToolbar, { children: [
60
- /* @__PURE__ */ n(e.HeaderToolbarWrapper, { children: [
2
+ import { jsx as t, jsxs as o } from "react/jsx-runtime";
3
+ import { mergeProps as d, InkeepEmbeddedChat as m, EmbeddedChat as e, dataAttr as c, Modal as l } from "@inkeep/cxkit-react-oss";
4
+ import { WidgetToggle as h } from "./widget-toggle.js";
5
+ import { defaultInkeepAIChatSettings as g } from "./default-settings.js";
6
+ import { useBaseSettings as b } from "./hooks/use-base-settings.js";
7
+ function S(r) {
8
+ const a = b(r.baseSettings), i = d(g, r.aiChatSettings ?? {}), s = d(r, {
9
+ baseSettings: a,
10
+ aiChatSettings: i
11
+ });
12
+ return /* @__PURE__ */ t(m, { header: C, ...s });
13
+ }
14
+ const C = (r) => {
15
+ const { onToggleView: a, askAILabel: i, searchLabel: s } = r, n = !!a;
16
+ return /* @__PURE__ */ t(e.Header, { "data-show-toolbar": c(n), children: n ? /* @__PURE__ */ o(e.HeaderToolbar, { children: [
17
+ /* @__PURE__ */ o(e.HeaderToolbarWrapper, { children: [
61
18
  /* @__PURE__ */ t(e.ToolbarHeader, {}),
62
- /* @__PURE__ */ n(e.Disclaimer, { children: [
19
+ /* @__PURE__ */ o(e.Disclaimer, { children: [
63
20
  /* @__PURE__ */ t(e.DisclaimerTrigger, {}),
64
- /* @__PURE__ */ n(e.DisclaimerContent, { side: "bottom", align: "start", children: [
21
+ /* @__PURE__ */ o(e.DisclaimerContent, { side: "bottom", align: "start", children: [
65
22
  /* @__PURE__ */ t(e.DisclaimerText, {}),
66
23
  /* @__PURE__ */ t(e.DisclaimerArrow, {})
67
24
  ] })
68
25
  ] })
69
26
  ] }),
70
27
  /* @__PURE__ */ t(
71
- I,
28
+ h,
72
29
  {
73
- onToggleView: r,
74
- askAILabel: c,
75
- searchLabel: o,
30
+ onToggleView: a,
31
+ askAILabel: i,
32
+ searchLabel: s,
76
33
  view: "chat"
77
34
  }
78
35
  ),
79
- /* @__PURE__ */ t(h.Close, {})
80
- ] }) : /* @__PURE__ */ t(h.Close, {}) });
81
- }
82
- function v() {
83
- return /* @__PURE__ */ t(e.Content, { children: /* @__PURE__ */ n(e.ContentScrollArea, { children: [
84
- /* @__PURE__ */ t(e.ContentScrollAreaViewport, { children: /* @__PURE__ */ t(x, {}) }),
85
- /* @__PURE__ */ t(e.ContentScrollAreaScrollbar, { children: /* @__PURE__ */ t(e.ContentScrollAreaThumb, {}) }),
86
- /* @__PURE__ */ t(e.ContentScrollAreaCorner, {})
87
- ] }) });
88
- }
89
- function x() {
90
- return /* @__PURE__ */ t(e.Messages, { children: ({ messages: a }) => /* @__PURE__ */ n(s, { children: [
91
- /* @__PURE__ */ t(w, {}),
92
- a.map((r) => /* @__PURE__ */ n(e.MessageWrapper, { message: r, children: [
93
- /* @__PURE__ */ t(H, {}),
94
- /* @__PURE__ */ t(e.MessageLoading, {}),
95
- /* @__PURE__ */ n(e.MessageContentWrapper, { children: [
96
- /* @__PURE__ */ t(e.MessageContent, { children: /* @__PURE__ */ t(e.Message, {}) }),
97
- /* @__PURE__ */ t(y, {}),
98
- /* @__PURE__ */ t(f, {}),
99
- /* @__PURE__ */ t(L, {})
100
- ] })
101
- ] }, r.id))
102
- ] }) });
103
- }
104
- function w() {
105
- return /* @__PURE__ */ n(e.IntroMessageWrapper, { children: [
106
- /* @__PURE__ */ n(e.MessageHeader, { children: [
107
- /* @__PURE__ */ t(e.MessageAvatar, { children: /* @__PURE__ */ n(e.MessageAvatarContent, { children: [
108
- /* @__PURE__ */ t(e.MessageAvatarFallback, {}),
109
- /* @__PURE__ */ t(e.MessageAvatarImage, {})
110
- ] }) }),
111
- /* @__PURE__ */ t(e.MessageName, {})
112
- ] }),
113
- /* @__PURE__ */ n(e.MessageContentWrapper, { children: [
114
- /* @__PURE__ */ t(e.MessageContent, { children: /* @__PURE__ */ t(e.Message, {}) }),
115
- /* @__PURE__ */ n(e.Disclaimer, { children: [
116
- /* @__PURE__ */ t(e.DisclaimerLabel, {}),
117
- /* @__PURE__ */ t(e.DisclaimerTrigger, {}),
118
- /* @__PURE__ */ n(e.DisclaimerContent, { children: [
119
- /* @__PURE__ */ t(e.DisclaimerText, {}),
120
- /* @__PURE__ */ t(e.DisclaimerArrow, {})
121
- ] })
122
- ] }),
123
- /* @__PURE__ */ n(e.ExampleQuestions, { children: [
124
- /* @__PURE__ */ t(e.ExampleQuestionsLabel, {}),
125
- /* @__PURE__ */ t(e.ExampleQuestionsList, { children: (a) => a.map((r) => /* @__PURE__ */ t(e.ExampleQuestion, { children: /* @__PURE__ */ t(e.ExampleQuestionButton, { question: r }) }, r)) })
126
- ] })
127
- ] })
128
- ] });
129
- }
130
- function H() {
131
- return /* @__PURE__ */ n(e.MessageHeader, { children: [
132
- /* @__PURE__ */ t(e.MessageAvatar, { children: /* @__PURE__ */ n(e.MessageAvatarContent, { children: [
133
- /* @__PURE__ */ t(e.MessageAvatarFallback, {}),
134
- /* @__PURE__ */ t(e.MessageAvatarImage, {})
135
- ] }) }),
136
- /* @__PURE__ */ t(e.MessageName, {})
137
- ] });
138
- }
139
- function y() {
140
- return /* @__PURE__ */ n(e.MessageAttachments, { children: [
141
- /* @__PURE__ */ t(e.MessageAttachmentsList, { children: (a) => a.map((r) => /* @__PURE__ */ n(e.MessageAttachmentsItem, { attachment: r, children: [
142
- /* @__PURE__ */ t(e.MessageAttachmentsItemIcon, {}),
143
- /* @__PURE__ */ t(e.MessageAttachmentsItemTitle, {})
144
- ] }, r.id)) }),
145
- /* @__PURE__ */ t(e.MessageAttachmentsPreview, { children: /* @__PURE__ */ t(d, { children: /* @__PURE__ */ t(e.MessageAttachmentsPreviewOverlay, { children: /* @__PURE__ */ n(e.MessageAttachmentsPreviewContent, { children: [
146
- /* @__PURE__ */ t(e.MessageAttachmentsPreviewHeader, {}),
147
- /* @__PURE__ */ t(e.MessageAttachmentsPreviewClose, {}),
148
- /* @__PURE__ */ t(e.MessageAttachmentsPreviewBody, {})
149
- ] }) }) }) })
150
- ] });
151
- }
152
- function f() {
153
- return /* @__PURE__ */ n(e.MessageToolbar, { children: [
154
- /* @__PURE__ */ t(e.MessageToolActions, { children: (a) => a.map((r, c) => /* @__PURE__ */ t(e.MessageToolAction, { action: r }, `action-${c}`)) }),
155
- /* @__PURE__ */ t(e.MessageAction, { action: "copy" }),
156
- /* @__PURE__ */ t(e.MessageAction, { action: "upvote" }),
157
- /* @__PURE__ */ t(e.MessageAction, { action: "downvote" })
158
- ] });
159
- }
160
- function L() {
161
- return /* @__PURE__ */ n(e.MessageSources, { children: [
162
- /* @__PURE__ */ t(e.MessageSourcesHeader, {}),
163
- /* @__PURE__ */ t(e.MessageSourcesList, { children: (a) => a.map((r, c) => /* @__PURE__ */ n(e.MessageSourceItem, { href: r.url, source: r, children: [
164
- /* @__PURE__ */ t(e.MessageSourceItemBreadcrumbs, { children: r.breadcrumbs?.map((o) => /* @__PURE__ */ n(F, { children: [
165
- o,
166
- /* @__PURE__ */ t(e.MessageSourceItemBreadcrumbIcon, {})
167
- ] }, o)) }),
168
- /* @__PURE__ */ t(e.MessageSourceItemIcon, {}),
169
- /* @__PURE__ */ t(e.MessageSourceItemTitle, {}),
170
- /* @__PURE__ */ t(e.MessageSourceItemTag, {}),
171
- /* @__PURE__ */ t(e.MessageSourceItemDescription, { children: (o) => o.map((i, l) => /* @__PURE__ */ t(
172
- e.MessageSourceItemDescriptionPart,
173
- {
174
- part: i
175
- },
176
- `part-${l}`
177
- )) }),
178
- /* @__PURE__ */ t(e.MessageSourceItemIndicator, {})
179
- ] }, c)) })
180
- ] });
181
- }
182
- function D() {
183
- return /* @__PURE__ */ n(e.Footer, { children: [
184
- /* @__PURE__ */ t(E, {}),
185
- /* @__PURE__ */ t(W, {})
186
- ] });
187
- }
188
- function E() {
189
- return /* @__PURE__ */ n(e.InputFieldset, { children: [
190
- /* @__PURE__ */ n(e.InputGroup, { children: [
191
- /* @__PURE__ */ t(e.Input, {}),
192
- /* @__PURE__ */ t(e.SendButton, { children: /* @__PURE__ */ t(e.SendButtonIcon, {}) })
193
- ] }),
194
- /* @__PURE__ */ n(e.AttachmentsBar, { children: [
195
- /* @__PURE__ */ t(e.AttachmentsBarList, { children: (a) => a.map((r) => /* @__PURE__ */ n(e.AttachmentsBarAttachment, { attachment: r, children: [
196
- /* @__PURE__ */ t(e.AttachmentsBarAttachmentIcon, {}),
197
- /* @__PURE__ */ t(e.AttachmentsBarAttachmentTitle, {}),
198
- /* @__PURE__ */ t(e.AttachmentsBarAttachmentDelete, {})
199
- ] }, r.id)) }),
200
- /* @__PURE__ */ n(e.AttachmentsBarActions, { children: [
201
- /* @__PURE__ */ n(e.AttachmentsBarInfoTip, { children: [
202
- /* @__PURE__ */ t(e.AttachmentsBarInfoTipIcon, {}),
203
- /* @__PURE__ */ t(e.AttachmentsBarInfoTipText, {})
204
- ] }),
205
- /* @__PURE__ */ t(e.AttachmentsBarInputs, { children: (a) => a.map((r) => /* @__PURE__ */ t(e.AttachmentsBarInput, { input: r, children: r.displayName }, r.id)) })
206
- ] }),
207
- /* @__PURE__ */ t(d, { children: /* @__PURE__ */ t(e.AttachmentsBarModal, { children: /* @__PURE__ */ t(e.AttachmentsBarModalOverlay, { children: /* @__PURE__ */ n(e.AttachmentsBarModalContent, { children: [
208
- /* @__PURE__ */ n(e.AttachmentsBarModalHeader, { children: [
209
- /* @__PURE__ */ t(e.AttachmentsBarModalHeading, {}),
210
- /* @__PURE__ */ t(e.AttachmentsBarModalDescription, {}),
211
- /* @__PURE__ */ t(e.AttachmentsBarModalHelp, {})
212
- ] }),
213
- /* @__PURE__ */ t(e.AttachmentsBarModalClose, {}),
214
- /* @__PURE__ */ t(e.AttachmentsBarModalBody, { children: /* @__PURE__ */ n(e.AttachmentsBarForm, { children: [
215
- /* @__PURE__ */ n(e.AttachmentsBarFormTitle, { children: [
216
- /* @__PURE__ */ t(e.AttachmentsBarFormTitleLabel, {}),
217
- /* @__PURE__ */ t(e.AttachmentsBarFormTitleInput, {}),
218
- /* @__PURE__ */ t(e.AttachmentsBarFormTitleError, {})
219
- ] }),
220
- /* @__PURE__ */ n(e.AttachmentsBarFormContent, { children: [
221
- /* @__PURE__ */ t(e.AttachmentsBarFormContentLabel, {}),
222
- /* @__PURE__ */ t(e.AttachmentsBarFormContentInput, {}),
223
- /* @__PURE__ */ t(e.AttachmentsBarFormContentError, {})
224
- ] }),
225
- /* @__PURE__ */ t(e.AttachmentsBarFormSubmitButton, {})
226
- ] }) })
227
- ] }) }) }) })
228
- ] })
229
- ] });
230
- }
231
- function W() {
232
- return /* @__PURE__ */ n(e.ActionBar, { children: [
233
- /* @__PURE__ */ n(e.TaglineContainer, { children: [
234
- /* @__PURE__ */ t(e.TaglineText, {}),
235
- /* @__PURE__ */ t(e.TaglineLogo, {}),
236
- /* @__PURE__ */ t(e.TaglineBrandName, {})
237
- ] }),
238
- /* @__PURE__ */ n(e.Actions, { children: [
239
- /* @__PURE__ */ t(e.HelpActions, { children: ({ pinned: a, unpinned: r }) => /* @__PURE__ */ n(s, { children: [
240
- a.map((c) => /* @__PURE__ */ t(e.HelpAction, { action: c }, c.name)),
241
- r.length > 0 && /* @__PURE__ */ t(e.HelpActionsTrigger, {}),
242
- /* @__PURE__ */ n(e.HelpActionsMenu, { children: [
243
- /* @__PURE__ */ t(e.HelpActionsMenuArrow, {}),
244
- r.map((c) => /* @__PURE__ */ n(e.HelpActionsMenuItem, { action: c, children: [
245
- /* @__PURE__ */ t(e.HelpActionsMenuItemIcon, { action: c }),
246
- c.name
247
- ] }, c.name))
248
- ] })
249
- ] }) }),
250
- /* @__PURE__ */ n(e.ChatAction, { action: "copy", children: [
251
- /* @__PURE__ */ t(e.ChatActionLabel, { action: "copy" }),
252
- /* @__PURE__ */ t(e.ChatActionFeedback, { action: "copy" })
253
- ] }),
254
- /* @__PURE__ */ n(e.ChatAction, { action: "share", children: [
255
- /* @__PURE__ */ t(e.ChatActionLabel, { action: "share" }),
256
- /* @__PURE__ */ t(e.ChatActionFeedback, { action: "share" })
257
- ] }),
258
- /* @__PURE__ */ t(e.ChatAction, { action: "clear" }),
259
- /* @__PURE__ */ t(e.ChatAction, { action: "stop" })
260
- ] })
261
- ] });
262
- }
263
- function P() {
264
- return /* @__PURE__ */ t(d, { children: /* @__PURE__ */ t(e.FeedbackModal, { children: /* @__PURE__ */ t(e.FeedbackModalOverlay, { children: /* @__PURE__ */ n(e.FeedbackModalContent, { children: [
265
- /* @__PURE__ */ t(e.FeedbackModalHeader, {}),
266
- /* @__PURE__ */ t(e.FeedbackModalClose, {}),
267
- /* @__PURE__ */ t(e.FeedbackModalBody, { children: /* @__PURE__ */ n(e.FeedbackForm, { children: [
268
- /* @__PURE__ */ n(e.FeedbackItem, { name: "unrelated_response", children: [
269
- /* @__PURE__ */ t(e.FeedbackItemCheckbox, { children: /* @__PURE__ */ t(e.FeedbackItemCheckboxIndicator, {}) }),
270
- /* @__PURE__ */ t(e.FeedbackItemLabel, {}),
271
- /* @__PURE__ */ t(e.FeedbackItemDescription, {})
272
- ] }),
273
- /* @__PURE__ */ n(e.FeedbackItem, { name: "inaccurate_statement", children: [
274
- /* @__PURE__ */ t(e.FeedbackItemCheckbox, { children: /* @__PURE__ */ t(e.FeedbackItemCheckboxIndicator, {}) }),
275
- /* @__PURE__ */ t(e.FeedbackItemLabel, {}),
276
- /* @__PURE__ */ t(e.FeedbackItemDescription, {})
277
- ] }),
278
- /* @__PURE__ */ n(e.FeedbackItem, { name: "inaccurate_code_snippet", children: [
279
- /* @__PURE__ */ t(e.FeedbackItemCheckbox, { children: /* @__PURE__ */ t(e.FeedbackItemCheckboxIndicator, {}) }),
280
- /* @__PURE__ */ t(e.FeedbackItemLabel, {}),
281
- /* @__PURE__ */ t(e.FeedbackItemDescription, {})
282
- ] }),
283
- /* @__PURE__ */ n(e.FeedbackItem, { name: "irrelevant_citations", children: [
284
- /* @__PURE__ */ t(e.FeedbackItemCheckbox, { children: /* @__PURE__ */ t(e.FeedbackItemCheckboxIndicator, {}) }),
285
- /* @__PURE__ */ t(e.FeedbackItemLabel, {})
286
- ] }),
287
- /* @__PURE__ */ t(e.FeedbackSubmitButton, {})
288
- ] }) })
289
- ] }) }) }) });
290
- }
291
- function V() {
292
- return /* @__PURE__ */ n(e.FormWrapper, { children: [
293
- /* @__PURE__ */ t(e.FormClose, {}),
294
- /* @__PURE__ */ n(e.Form, { children: [
295
- /* @__PURE__ */ n(e.FormHeader, { children: [
296
- /* @__PURE__ */ t(e.FormHeading, {}),
297
- /* @__PURE__ */ t(e.FormDescription, {})
298
- ] }),
299
- /* @__PURE__ */ t(e.FormContent, { children: (a) => /* @__PURE__ */ n(s, { children: [
300
- a.map((r, c) => /* @__PURE__ */ n(e.FormField, { field: r, autoFocus: c === 0, children: [
301
- /* @__PURE__ */ t(e.FormFieldLabel, {}),
302
- r.inputType === "text" && /* @__PURE__ */ t(e.FormFieldText, {}),
303
- r.inputType === "email" && /* @__PURE__ */ t(e.FormFieldEmail, {}),
304
- r.inputType === "file" && /* @__PURE__ */ t(e.FormFieldFile, {}),
305
- r.inputType === "textarea" && /* @__PURE__ */ t(e.FormFieldTextArea, {}),
306
- r.inputType === "checkbox" && /* @__PURE__ */ t(e.FormFieldCheckbox, { children: /* @__PURE__ */ t(e.FormFieldCheckboxIndicator, {}) }),
307
- r.inputType === "select" && /* @__PURE__ */ n(e.FormFieldSelect, { children: [
308
- /* @__PURE__ */ n(e.FormFieldSelectTrigger, { children: [
309
- /* @__PURE__ */ t(e.FormFieldSelectValue, {}),
310
- /* @__PURE__ */ t(e.FormFieldSelectIcon, {})
311
- ] }),
312
- /* @__PURE__ */ t(e.FormFieldSelectContent, { children: /* @__PURE__ */ t(e.FormFieldSelectViewport, { children: r.items.map((o) => /* @__PURE__ */ n(e.FormFieldSelectItem, { value: o.value, children: [
313
- /* @__PURE__ */ t(e.FormFieldSelectItemText, { children: o.label }),
314
- /* @__PURE__ */ t(e.FormFieldSelectItemIndicator, {})
315
- ] }, o.value)) }) })
316
- ] }),
317
- /* @__PURE__ */ t(e.FormFieldError, {})
318
- ] }, r.name)),
319
- /* @__PURE__ */ t(e.FormError, {})
320
- ] }) }),
321
- /* @__PURE__ */ n(e.FormFooter, { children: [
322
- /* @__PURE__ */ t(e.FormCancel, {}),
323
- /* @__PURE__ */ t(e.FormSubmit, {})
324
- ] })
325
- ] }),
326
- /* @__PURE__ */ n(e.FormSuccess, { children: [
327
- /* @__PURE__ */ t(e.FormSuccessHeading, {}),
328
- /* @__PURE__ */ t(e.FormSuccessMessage, {}),
329
- /* @__PURE__ */ t(e.FormSuccessButton, {})
330
- ] })
331
- ] });
332
- }
36
+ /* @__PURE__ */ t(l.Close, {})
37
+ ] }) : /* @__PURE__ */ t(l.Close, {}) });
38
+ };
333
39
  export {
334
- R as InkeepEmbeddedChat,
335
- T as InkeepEmbeddedChatImpl,
336
- B as InkeepEmbeddedChatImplContent,
337
- k as InkeepEmbeddedChatProvider
40
+ S as InkeepEmbeddedChat
338
41
  };
@@ -1 +1 @@
1
- "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./embedded-chat.cjs"),d=require("@inkeep/cxkit-styled"),a=require("./embedded-search.cjs"),S=require("./embedded-search-and-chat.impl.cjs"),j=require("react"),k=require("./modal.cjs");function x(n){const{config:r,...t}=S.useWidgetImpl(n);return e.jsx(d.ErrorBoundary,{children:e.jsx(d.Shadow,{wrapperStyles:{height:"inherit",width:"inherit"},children:e.jsx(d.RootProvider,{config:r,componentType:d.WebWidgetInteractionType.EmbeddedSearchAndChat,children:e.jsx(h,{...t})})})})}function h(n){const{view:r,setView:t,shouldShowAskAICard:l,onToggleView:p,shouldAutoFocusInput:m,searchLabel:u,askAILabel:b,askAICardLabel:I}=n,C=d.useModal()?k.ModalContent:j.Fragment,o={onToggleView:p,shouldShowAskAICard:l,shouldAutoFocusInput:m,searchLabel:u,askAILabel:b,askAICardLabel:I},s={isHidden:r==="chat",...o},i={isHidden:r==="search",...o};return e.jsx(d.WidgetProvider,{widget:{setView:t,view:r},children:e.jsx(a.InkeepEmbeddedSearchProvider,{...s,children:e.jsx(c.InkeepEmbeddedChatProvider,{...i,children:e.jsxs(C,{children:[e.jsx(a.InkeepEmbeddedSearchImplContent,{...s}),e.jsx(c.InkeepEmbeddedChatImplContent,{...i})]})})})})}exports.InkeepEmbeddedSearchAndChat=x;exports.InkeepEmbeddedSearchAndChatImpl=h;
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),t=require("@inkeep/cxkit-react-oss"),c=require("./hooks/use-base-settings.cjs"),S=require("./hooks/use-search-settings.cjs"),u=require("./default-settings.cjs");function g(e){const s=c.useBaseSettings(e.baseSettings),n=S.useSearchSettings({baseSettings:s,searchSettings:e.searchSettings}),i=t.mergeProps(u.defaultInkeepAIChatSettings,e.aiChatSettings??{}),a=t.mergeProps(e,{baseSettings:s,aiChatSettings:i,searchSettings:n});return r.jsx(t.InkeepEmbeddedSearchAndChat,{...a})}exports.InkeepEmbeddedSearchAndChat=g;