@inkeep/agents-ui 0.15.21 → 0.15.22
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),l=require("react"),Ba=require("react-dom/client"),ie=require("react-textarea-autosize"),Ta=require("@radix-ui/react-avatar"),ya=require("@radix-ui/react-checkbox"),Ha=require("@radix-ui/react-popover"),ja=require("@radix-ui/react-tooltip"),wa=require("@radix-ui/react-scroll-area"),j=require("../atoms/select.cjs"),S=require("../atoms/combobox.cjs"),A=require("../atoms/dialog.cjs"),La=require("../atoms/avatars/ai.cjs"),Da=require("../atoms/avatars/user.cjs"),x=require("../atoms/icons/custom-icon.cjs"),w=require("../atoms/icons/built-in-icon-renderer.cjs"),Ra=require("../atoms/link.cjs"),z=require("../atoms/markdown/index.cjs"),V=require("../providers/attachment-item-provider.cjs"),B=require("../providers/attachments-bar-provider.cjs"),O=require("../providers/source-item-provider.cjs"),g=require("../providers/config-provider.cjs"),ae=require("../providers/feedback-provider.cjs"),U=require("../providers/message-attachments-provider.cjs"),_=require("../providers/message-provider.cjs"),ue=require("../atoms/icons/checkbox-icon.cjs"),ee=require("../hooks/use-copy-to-clipboard.cjs"),G=require("../providers/feedback-item-provider.cjs"),u=require("../utils/misc.cjs"),a=require("./factory.cjs"),F=require("./embedded-chat/chat-provider.cjs"),Oa=require("./tagline-logo-icon.cjs"),qa=require("../hooks/use-settle-action.cjs"),Wa=require("../hooks/use-container-size.cjs"),re=require("./embedded-chat/use-chat-action.cjs"),te=require("../providers/help-menu-provider.cjs"),k=require("../providers/chat-form-provider.cjs"),H=require("../providers/form-field-provider.cjs"),Na=require("react-hook-form"),Va=require("../utils/highlight-emphasis.cjs"),Qa=require("./modal/modal-provider.cjs"),$a=require("../../color-mode/index.cjs"),oe=require("../utils/compose-refs.cjs"),C=require("../utils/compose-event-handlers.cjs"),Ua=require("../hooks/use-simple-scroll.cjs"),Ka=require("../hooks/use-debounce.cjs"),ne=require("../providers/hover-popover-provider.cjs"),za=require("./modal/widget-auto-focus.cjs"),se=require("../providers/base-events-provider.cjs"),Ga=require("../atoms/shadow/context.cjs"),Ya=require("../utils/get-source-icon.cjs"),Ja=require("../providers/chat-history-provider.cjs");function Q(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const o=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const Xa=Q(Ba),de=Q(Ta),Y=Q(ya),q=Q(Ha),W=Q(ja),K=Q(wa),Za="__intro__",er=767,tr=a.ikp("div",{_id:"aiChatWrapper"}),Ce=l.forwardRef(({chatHistoryLayout:t,isChatHistoryOpen:e,setChatHistoryOpen:i,isChatHistoryButtonVisible:o,children:n,...s},d)=>{l.useEffect(()=>{t==="stack"?i(!1):t==="sidepane"&&o&&i(!0)},[t,o,i]);const c=t==="stack"&&e;return r.jsx(tr,{ref:d,"data-chat-history-layout":t,"data-chat-history-open":u.dataAttr(e),"data-stack-history-open":u.dataAttr(c),...s,children:n})});Ce.displayName="EmbeddedChatWrapperInner";const be=l.forwardRef((t,e)=>{const{children:i,...o}=t,{isHidden:n,isMobile:s}=F.useChat(),{aiChatSettings:d}=g.useInkeepConfig(),{isChatHistoryButtonVisible:c}=d,[m,h]=Wa.useContainerSize(),b=oe.useComposedRefs(e,m),v=h?.width?h.width>580:!0,p=Qa.useModal(),P=(h?.width??0)>er?"sidepane":"stack";return r.jsx(Ja.ChatHistoryProvider,{layout:P,children:({isOpen:I,setIsOpen:M})=>r.jsx(Ce,{ref:b,chatHistoryLayout:P,isChatHistoryOpen:I,setChatHistoryOpen:M,isChatHistoryButtonVisible:!!c,"data-widget-md":u.dataAttr(v),"data-hidden":u.dataAttr(n),"data-in-modal":u.dataAttr(!!p),"data-mobile":u.dataAttr(s),...o,children:i})})}),ir=a.ikp("div",{_id:"aiChatRoot"}),pe=t=>{const{isHidden:e}=F.useChat(),{form:i}=k.useChatForm();return i?null:r.jsx(ir,{"data-hidden":u.dataAttr(e),...t})},ar=a.ikp("div",{_id:"aiChatHeader"}),ve=a.ikp("div",{_id:"aiChatHeader__Toolbar"}),ge=a.ikp("div",{_id:"aiChatHeader__ToolbarHeaderWrapper"}),rr=a.ikp(x.CustomIcon,{_id:"aiChatHeader__ChatHistoryButtonIcon"}),Pe=l.memo(t=>r.jsx(rr,{...t})),Fe=a.ikp("button",{_id:"aiChatHeader__ChatHistoryButton"}),or=a.ikp("div",{_id:"aiChatHeader__ToolbarHeader"}),_e=l.memo(t=>{const{aiChatSettings:e}=g.useInkeepConfig(),i=`Ask ${e.aiAssistantName||"AI"}`;return r.jsx(or,{...t,children:i})}),Ee=a.ikp("div",{_id:"aiChatContent"}),Ae=a.ikp(K.Root,{_id:"aiChatContentScrollArea"}),nr=a.ikp(K.Viewport,{_id:"aiChatContentScrollArea__Viewport"}),ke=l.forwardRef(({children:t,...e},i)=>{const{messages:o,isStreaming:n}=F.useChat(),{containerRef:s,scrollToBottom:d,handleScroll:c}=Ua.useSimpleScroll({isStreaming:n}),m=oe.useComposedRefs(i,s);return l.useEffect(()=>{o.length>0&&!n&&d()},[o.length,d,n]),r.jsx(nr,{ref:m,onScroll:c,children:r.jsx("div",{"data-part":"grid",style:{display:"grid"},children:t}),...e})}),Ie=a.ikp(K.ScrollAreaScrollbar,{_id:"aiChatContentScrollArea__Scrollbar"}),Me=a.ikp(K.ScrollAreaThumb,{_id:"aiChatContentScrollArea__Thumb"}),fe=a.ikp(K.Corner,{_id:"aiChatContentScrollArea__Corner"}),sr=a.ikp("div",{_id:"aiChatMessages"}),xe=t=>{const e=F.useChat(),{children:i,...o}=t;return r.jsx(sr,{children:u.maybeRender(i,e),...o})},dr=a.ikp("div",{_id:"aiChatDisclaimer"}),Se=l.memo(t=>{const{aiChatSettings:e}=g.useInkeepConfig(),[i,o]=l.useState(!1),n=Ka.useDebounce(i,100);return e.disclaimerSettings?.isEnabled?r.jsx(ne.HoverPopoverProvider,{open:i,setOpen:o,children:r.jsx(q.Root,{open:n,onOpenChange:o,children:r.jsx(dr,{...t})})}):null}),cr=a.ikp("span",{_id:"aiChatDisclaimerLabel"}),Be=l.memo(t=>{const{aiChatSettings:e}=g.useInkeepConfig(),i=e.disclaimerSettings;return r.jsx(cr,{children:i?.label,...t})}),mr=a.ikp(q.Trigger,{_id:"aiChatDisclaimerTrigger",children:r.jsx(x.CustomIcon,{iconKey:"info"})}),Te=l.memo(t=>{const{setOpen:e}=ne.useHoverPopover(),i=()=>e(!0),o=()=>e(!1);return r.jsx(mr,{onMouseEnter:i,onMouseLeave:o,...t})}),lr=a.ikp(q.Content,{_id:"aiChatDisclaimerContent"}),ye=t=>{const{setOpen:e}=ne.useHoverPopover(),i=()=>e(!0),o=()=>e(!1);return r.jsx(lr,{onMouseEnter:i,onMouseLeave:o,side:"top",sideOffset:8,align:"end",alignOffset:-10,...t})},hr=a.ikp(z.Markdown,{_id:"aiChatDisclaimerText"}),He=l.memo(t=>{const{aiChatSettings:e}=g.useInkeepConfig(),i=e.aiAssistantName,n=e.disclaimerSettings?.tooltip||`Information provided by ${i||"this AI assistant"} is not guaranteed to be accurate or comprehensive.`;return r.jsx(hr,{shouldOpenLinksInNewTab:!0,children:n,...t})}),je=a.ikp(q.Arrow,{_id:"aiChatDisclaimerArrow"}),ur=a.ikp("div",{_id:"aiChatExampleQuestions"}),we=t=>{const{aiChatSettings:e}=g.useInkeepConfig(),{messages:i}=F.useChat();return!e.exampleQuestions?.length||i.length?null:r.jsx(ur,{...t})},Cr=a.ikp("h3",{_id:"aiChatExampleQuestionsLabel"}),Le=l.memo(t=>{const{aiChatSettings:e}=g.useInkeepConfig();return r.jsx(Cr,{children:e.exampleQuestionsLabel,...t})}),br=a.ikp("div",{_id:"aiChatExampleQuestionsList"}),De=l.memo(t=>{const{aiChatSettings:e}=g.useInkeepConfig(),i=e.exampleQuestions,{children:o,...n}=t;return r.jsx(br,{children:u.maybeRender(o,i),...n})}),pr=a.ikp("div",{_id:"aiChatExampleQuestion"}),Re=l.forwardRef((t,e)=>{const{aiChatSettings:i}=g.useInkeepConfig(),o=i.isFirstExampleQuestionHighlighted;return r.jsx(pr,{ref:e,"data-highlight":u.dataAttr(o),...t})}),vr=a.ikp("button",{_id:"aiChatExampleQuestionButton"}),Oe=t=>{const{question:e,onClick:i,...o}=t,n=typeof e=="object"?e.value:e,s=typeof e=="object"?e.label:e,{handleSubmit:d}=F.useChat();return r.jsx(vr,{onClick:C.composeEventHandlers(i,()=>d(n)),children:s,...o})},gr=a.ikp("div",{_id:"aiChatWorkflows"}),qe=t=>{const{aiChatSettings:e}=g.useInkeepConfig(),{messages:i}=F.useChat();return!e.workflows?.length||i.length?null:r.jsx(gr,{...t})},Pr=a.ikp("h3",{_id:"aiChatWorkflowsLabel"}),We=l.memo(t=>{const{aiChatSettings:e}=g.useInkeepConfig();return r.jsx(Pr,{children:e.workflowsHeader,...t})}),Fr=a.ikp("div",{_id:"aiChatWorkflowsList"}),Ne=l.memo(t=>{const{aiChatSettings:e}=g.useInkeepConfig(),i=e.workflows,{children:o,...n}=t;return r.jsx(Fr,{children:u.maybeRender(o,i),...n})}),_r=a.ikp("button",{_id:"aiChatWorkflow"}),Ve=t=>{const{workflow:e,onClick:i,...o}=t,n=s=>{};return r.jsx(_r,{onClick:C.composeEventHandlers(i,()=>n()),children:e.displayName,...o})},Er=a.ikp("div",{_id:"aiChatMessageWrapper"}),ce=t=>{const{message:e,...i}=t;return e.role==="system"?null:r.jsx(_.MessageProvider,{message:e,children:r.jsx(Er,{"data-role":e.role,...i})})},Qe=l.memo(t=>{const{message:e,...i}=t,{aiChatSettings:o,baseSettings:n}=g.useInkeepConfig(),s=o.aiAssistantName,d=s?`Hi, I'm ${s}!`:"Hi!",c=o.chatSubjectName??n.organizationDisplayName,m=c?`
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),l=require("react"),Ba=require("react-dom/client"),ie=require("react-textarea-autosize"),Ta=require("@radix-ui/react-avatar"),ya=require("@radix-ui/react-checkbox"),Ha=require("@radix-ui/react-popover"),ja=require("@radix-ui/react-tooltip"),wa=require("@radix-ui/react-scroll-area"),j=require("../atoms/select.cjs"),S=require("../atoms/combobox.cjs"),A=require("../atoms/dialog.cjs"),La=require("../atoms/avatars/ai.cjs"),Da=require("../atoms/avatars/user.cjs"),x=require("../atoms/icons/custom-icon.cjs"),w=require("../atoms/icons/built-in-icon-renderer.cjs"),Ra=require("../atoms/link.cjs"),z=require("../atoms/markdown/index.cjs"),V=require("../providers/attachment-item-provider.cjs"),B=require("../providers/attachments-bar-provider.cjs"),O=require("../providers/source-item-provider.cjs"),g=require("../providers/config-provider.cjs"),ae=require("../providers/feedback-provider.cjs"),U=require("../providers/message-attachments-provider.cjs"),_=require("../providers/message-provider.cjs"),ue=require("../atoms/icons/checkbox-icon.cjs"),ee=require("../hooks/use-copy-to-clipboard.cjs"),G=require("../providers/feedback-item-provider.cjs"),u=require("../utils/misc.cjs"),a=require("./factory.cjs"),F=require("./embedded-chat/chat-provider.cjs"),Oa=require("./tagline-logo-icon.cjs"),qa=require("../hooks/use-settle-action.cjs"),Wa=require("../hooks/use-container-size.cjs"),re=require("./embedded-chat/use-chat-action.cjs"),te=require("../providers/help-menu-provider.cjs"),k=require("../providers/chat-form-provider.cjs"),H=require("../providers/form-field-provider.cjs"),Na=require("react-hook-form"),Va=require("../utils/highlight-emphasis.cjs"),Qa=require("./modal/modal-provider.cjs"),$a=require("../../color-mode/index.cjs"),oe=require("../utils/compose-refs.cjs"),C=require("../utils/compose-event-handlers.cjs"),Ua=require("../hooks/use-simple-scroll.cjs"),Ka=require("../hooks/use-debounce.cjs"),ne=require("../providers/hover-popover-provider.cjs"),za=require("./modal/widget-auto-focus.cjs"),se=require("../providers/base-events-provider.cjs"),Ga=require("../atoms/shadow/context.cjs"),Ya=require("../utils/get-source-icon.cjs"),Ja=require("../providers/chat-history-provider.cjs");function Q(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const i in t)if(i!=="default"){const o=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,o.get?o:{enumerable:!0,get:()=>t[i]})}}return e.default=t,Object.freeze(e)}const Xa=Q(Ba),de=Q(Ta),Y=Q(ya),q=Q(Ha),W=Q(ja),K=Q(wa),Za="__intro__",er=767,tr=a.ikp("div",{_id:"aiChatWrapper"}),Ce=l.forwardRef(({chatHistoryLayout:t,isChatHistoryOpen:e,setChatHistoryOpen:i,isChatHistoryButtonVisible:o,children:n,...s},d)=>{l.useEffect(()=>{t==="stack"?i(!1):t==="sidepane"&&o&&i(!0)},[t,o,i]);const c=t==="stack"&&e;return r.jsx(tr,{ref:d,"data-chat-history-layout":t,"data-chat-history-open":u.dataAttr(e),"data-stack-history-open":u.dataAttr(c),...s,children:n})});Ce.displayName="EmbeddedChatWrapperInner";const be=l.forwardRef((t,e)=>{const{children:i,...o}=t,{isHidden:n,isMobile:s}=F.useChat(),{aiChatSettings:d}=g.useInkeepConfig(),{isChatHistoryButtonVisible:c}=d,[m,h]=Wa.useContainerSize(),b=oe.useComposedRefs(e,m),v=h?.width?h.width>580:!0,p=Qa.useModal(),P=(h?.width??0)>er?"sidepane":"stack";return r.jsx(Ja.ChatHistoryProvider,{layout:P,children:({isOpen:I,setIsOpen:M})=>r.jsx(Ce,{ref:b,chatHistoryLayout:P,isChatHistoryOpen:I,setChatHistoryOpen:M,isChatHistoryButtonVisible:!!c,"data-widget-md":u.dataAttr(v),"data-hidden":u.dataAttr(n),"data-in-modal":u.dataAttr(!!p),"data-mobile":u.dataAttr(s),...o,children:i})})}),ir=a.ikp("div",{_id:"aiChatRoot"}),pe=t=>{const{isHidden:e}=F.useChat(),{form:i}=k.useChatForm();return i?null:r.jsx(ir,{"data-hidden":u.dataAttr(e),...t})},ar=a.ikp("div",{_id:"aiChatHeader"}),ve=a.ikp("div",{_id:"aiChatHeader__Toolbar"}),ge=a.ikp("div",{_id:"aiChatHeader__ToolbarHeaderWrapper"}),rr=a.ikp(x.CustomIcon,{_id:"aiChatHeader__ChatHistoryButtonIcon"}),Pe=l.memo(t=>r.jsx(rr,{...t})),Fe=a.ikp("button",{_id:"aiChatHeader__ChatHistoryButton"}),or=a.ikp("div",{_id:"aiChatHeader__ToolbarHeader"}),_e=l.memo(t=>{const{aiChatSettings:e}=g.useInkeepConfig(),i=`Ask ${e.aiAssistantName||"AI"}`;return r.jsx(or,{...t,children:i})}),Ee=a.ikp("div",{_id:"aiChatContent"}),Ae=a.ikp(K.Root,{_id:"aiChatContentScrollArea"}),nr=a.ikp(K.Viewport,{_id:"aiChatContentScrollArea__Viewport"}),ke=l.forwardRef(({children:t,...e},i)=>{const{messages:o,isStreaming:n}=F.useChat(),{containerRef:s,scrollToBottom:d,handleScroll:c}=Ua.useSimpleScroll({isStreaming:n}),m=oe.useComposedRefs(i,s);return l.useEffect(()=>{o.length>0&&!n&&d()},[o.length,d,n]),r.jsx(nr,{ref:m,tabIndex:-1,onScroll:c,style:{outline:"none"},children:r.jsx("div",{"data-part":"grid",tabIndex:-1,style:{display:"grid",outline:"none"},children:t}),...e})}),Ie=a.ikp(K.ScrollAreaScrollbar,{_id:"aiChatContentScrollArea__Scrollbar"}),Me=a.ikp(K.ScrollAreaThumb,{_id:"aiChatContentScrollArea__Thumb"}),fe=a.ikp(K.Corner,{_id:"aiChatContentScrollArea__Corner"}),sr=a.ikp("div",{_id:"aiChatMessages"}),xe=t=>{const e=F.useChat(),{children:i,...o}=t;return r.jsx(sr,{children:u.maybeRender(i,e),...o})},dr=a.ikp("div",{_id:"aiChatDisclaimer"}),Se=l.memo(t=>{const{aiChatSettings:e}=g.useInkeepConfig(),[i,o]=l.useState(!1),n=Ka.useDebounce(i,100);return e.disclaimerSettings?.isEnabled?r.jsx(ne.HoverPopoverProvider,{open:i,setOpen:o,children:r.jsx(q.Root,{open:n,onOpenChange:o,children:r.jsx(dr,{...t})})}):null}),cr=a.ikp("span",{_id:"aiChatDisclaimerLabel"}),Be=l.memo(t=>{const{aiChatSettings:e}=g.useInkeepConfig(),i=e.disclaimerSettings;return r.jsx(cr,{children:i?.label,...t})}),mr=a.ikp(q.Trigger,{_id:"aiChatDisclaimerTrigger",children:r.jsx(x.CustomIcon,{iconKey:"info"})}),Te=l.memo(t=>{const{setOpen:e}=ne.useHoverPopover(),i=()=>e(!0),o=()=>e(!1);return r.jsx(mr,{onMouseEnter:i,onMouseLeave:o,...t})}),lr=a.ikp(q.Content,{_id:"aiChatDisclaimerContent"}),ye=t=>{const{setOpen:e}=ne.useHoverPopover(),i=()=>e(!0),o=()=>e(!1);return r.jsx(lr,{onMouseEnter:i,onMouseLeave:o,side:"top",sideOffset:8,align:"end",alignOffset:-10,...t})},hr=a.ikp(z.Markdown,{_id:"aiChatDisclaimerText"}),He=l.memo(t=>{const{aiChatSettings:e}=g.useInkeepConfig(),i=e.aiAssistantName,n=e.disclaimerSettings?.tooltip||`Information provided by ${i||"this AI assistant"} is not guaranteed to be accurate or comprehensive.`;return r.jsx(hr,{shouldOpenLinksInNewTab:!0,children:n,...t})}),je=a.ikp(q.Arrow,{_id:"aiChatDisclaimerArrow"}),ur=a.ikp("div",{_id:"aiChatExampleQuestions"}),we=t=>{const{aiChatSettings:e}=g.useInkeepConfig(),{messages:i}=F.useChat();return!e.exampleQuestions?.length||i.length?null:r.jsx(ur,{...t})},Cr=a.ikp("h3",{_id:"aiChatExampleQuestionsLabel"}),Le=l.memo(t=>{const{aiChatSettings:e}=g.useInkeepConfig();return r.jsx(Cr,{children:e.exampleQuestionsLabel,...t})}),br=a.ikp("div",{_id:"aiChatExampleQuestionsList"}),De=l.memo(t=>{const{aiChatSettings:e}=g.useInkeepConfig(),i=e.exampleQuestions,{children:o,...n}=t;return r.jsx(br,{children:u.maybeRender(o,i),...n})}),pr=a.ikp("div",{_id:"aiChatExampleQuestion"}),Re=l.forwardRef((t,e)=>{const{aiChatSettings:i}=g.useInkeepConfig(),o=i.isFirstExampleQuestionHighlighted;return r.jsx(pr,{ref:e,"data-highlight":u.dataAttr(o),...t})}),vr=a.ikp("button",{_id:"aiChatExampleQuestionButton"}),Oe=t=>{const{question:e,onClick:i,...o}=t,n=typeof e=="object"?e.value:e,s=typeof e=="object"?e.label:e,{handleSubmit:d}=F.useChat();return r.jsx(vr,{onClick:C.composeEventHandlers(i,()=>d(n)),children:s,...o})},gr=a.ikp("div",{_id:"aiChatWorkflows"}),qe=t=>{const{aiChatSettings:e}=g.useInkeepConfig(),{messages:i}=F.useChat();return!e.workflows?.length||i.length?null:r.jsx(gr,{...t})},Pr=a.ikp("h3",{_id:"aiChatWorkflowsLabel"}),We=l.memo(t=>{const{aiChatSettings:e}=g.useInkeepConfig();return r.jsx(Pr,{children:e.workflowsHeader,...t})}),Fr=a.ikp("div",{_id:"aiChatWorkflowsList"}),Ne=l.memo(t=>{const{aiChatSettings:e}=g.useInkeepConfig(),i=e.workflows,{children:o,...n}=t;return r.jsx(Fr,{children:u.maybeRender(o,i),...n})}),_r=a.ikp("button",{_id:"aiChatWorkflow"}),Ve=t=>{const{workflow:e,onClick:i,...o}=t,n=s=>{};return r.jsx(_r,{onClick:C.composeEventHandlers(i,()=>n()),children:e.displayName,...o})},Er=a.ikp("div",{_id:"aiChatMessageWrapper"}),ce=t=>{const{message:e,...i}=t;return e.role==="system"?null:r.jsx(_.MessageProvider,{message:e,children:r.jsx(Er,{"data-role":e.role,...i})})},Qe=l.memo(t=>{const{message:e,...i}=t,{aiChatSettings:o,baseSettings:n}=g.useInkeepConfig(),s=o.aiAssistantName,d=s?`Hi, I'm ${s}!`:"Hi!",c=o.chatSubjectName??n.organizationDisplayName,m=c?`
|
|
2
2
|
|
|
3
3
|
Ask me anything about \`${c}\`.`:`
|
|
4
4
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as n, jsxs as j, Fragment as te } from "react/jsx-runtime";
|
|
3
|
-
import Z, { memo as S, forwardRef as U, useRef as O, useState as q, useMemo as
|
|
3
|
+
import Z, { memo as S, forwardRef as U, useRef as O, useState as q, useMemo as be, useEffect as $, useLayoutEffect as fe } from "react";
|
|
4
4
|
import * as Ie from "react-dom/client";
|
|
5
5
|
import ie from "react-textarea-autosize";
|
|
6
6
|
import * as ae from "@radix-ui/react-avatar";
|
|
@@ -17,10 +17,10 @@ import { CustomIcon as E } from "../atoms/icons/custom-icon.js";
|
|
|
17
17
|
import { BuiltInIconRenderer as x } from "../atoms/icons/built-in-icon-renderer.js";
|
|
18
18
|
import { LinkWithQueryParams as Ge } from "../atoms/link.js";
|
|
19
19
|
import { Markdown as G } from "../atoms/markdown/index.js";
|
|
20
|
-
import { AttachmentItemProvider as
|
|
20
|
+
import { AttachmentItemProvider as pe, useAttachmentItem as Y } from "../providers/attachment-item-provider.js";
|
|
21
21
|
import { useAttachmentsBar as k, AttachmentsBarProvider as Ye } from "../providers/attachments-bar-provider.js";
|
|
22
22
|
import { SourceItemProvider as Je, useSourceItem as N } from "../providers/source-item-provider.js";
|
|
23
|
-
import { useInkeepConfig as
|
|
23
|
+
import { useInkeepConfig as p } from "../providers/config-provider.js";
|
|
24
24
|
import { useMessageFeedback as de } from "../providers/feedback-provider.js";
|
|
25
25
|
import { MessageAttachmentsProvider as Xe, useMessageAttachments as J } from "../providers/message-attachments-provider.js";
|
|
26
26
|
import { useMessage as P, MessageProvider as Ze } from "../providers/message-provider.js";
|
|
@@ -46,8 +46,8 @@ import { useComposedRefs as he } from "../utils/compose-refs.js";
|
|
|
46
46
|
import { composeEventHandlers as h } from "../utils/compose-event-handlers.js";
|
|
47
47
|
import { useSimpleScroll as ut } from "../hooks/use-simple-scroll.js";
|
|
48
48
|
import { useDebounce as Ct } from "../hooks/use-debounce.js";
|
|
49
|
-
import { HoverPopoverProvider as
|
|
50
|
-
import { useWidgetAutoFocus as
|
|
49
|
+
import { HoverPopoverProvider as bt, useHoverPopover as ge } from "../providers/hover-popover-provider.js";
|
|
50
|
+
import { useWidgetAutoFocus as pt } from "./modal/widget-auto-focus.js";
|
|
51
51
|
import { useBaseEvents as ue } from "../providers/base-events-provider.js";
|
|
52
52
|
import { useShadow as vt } from "../atoms/shadow/context.js";
|
|
53
53
|
import { getIcon as _t } from "../utils/get-source-icon.js";
|
|
@@ -82,7 +82,7 @@ const Ft = "__intro__", Pt = 767, At = i("div", {
|
|
|
82
82
|
);
|
|
83
83
|
Fe.displayName = "EmbeddedChatWrapperInner";
|
|
84
84
|
const Bn = U((t, e) => {
|
|
85
|
-
const { children: a, ...o } = t, { isHidden: r, isMobile: s } = g(), { aiChatSettings: c } =
|
|
85
|
+
const { children: a, ...o } = t, { isHidden: r, isMobile: s } = g(), { aiChatSettings: c } = p(), { isChatHistoryButtonVisible: d } = c, [m, l] = nt(), u = he(e, m), b = l?.width ? l.width > 580 : !0, C = lt(), _ = (l?.width ?? 0) > Pt ? "sidepane" : "stack";
|
|
86
86
|
return /* @__PURE__ */ n(gt, { layout: _, children: ({ isOpen: f, setIsOpen: I }) => /* @__PURE__ */ n(
|
|
87
87
|
Fe,
|
|
88
88
|
{
|
|
@@ -91,7 +91,7 @@ const Bn = U((t, e) => {
|
|
|
91
91
|
isChatHistoryOpen: f,
|
|
92
92
|
setChatHistoryOpen: I,
|
|
93
93
|
isChatHistoryButtonVisible: !!d,
|
|
94
|
-
"data-widget-md": v(
|
|
94
|
+
"data-widget-md": v(b),
|
|
95
95
|
"data-hidden": v(r),
|
|
96
96
|
"data-in-modal": v(!!C),
|
|
97
97
|
"data-mobile": v(s),
|
|
@@ -120,7 +120,7 @@ const Bn = U((t, e) => {
|
|
|
120
120
|
_id: "aiChatHeader__ToolbarHeader"
|
|
121
121
|
}), Dn = S(
|
|
122
122
|
(t) => {
|
|
123
|
-
const { aiChatSettings: e } =
|
|
123
|
+
const { aiChatSettings: e } = p(), a = `Ask ${e.aiAssistantName || "AI"}`;
|
|
124
124
|
return /* @__PURE__ */ n(Mt, { ...t, children: a });
|
|
125
125
|
}
|
|
126
126
|
), On = i("div", {
|
|
@@ -137,10 +137,12 @@ const Bn = U((t, e) => {
|
|
|
137
137
|
Et,
|
|
138
138
|
{
|
|
139
139
|
ref: m,
|
|
140
|
+
tabIndex: -1,
|
|
140
141
|
onScroll: d,
|
|
142
|
+
style: { outline: "none" },
|
|
141
143
|
children: (
|
|
142
144
|
/* added this to fix an overflow issue see https://github.com/radix-ui/primitives/issues/926 */
|
|
143
|
-
/* @__PURE__ */ n("div", { "data-part": "grid", style: { display: "grid" }, children: t })
|
|
145
|
+
/* @__PURE__ */ n("div", { "data-part": "grid", tabIndex: -1, style: { display: "grid", outline: "none" }, children: t })
|
|
144
146
|
),
|
|
145
147
|
...e
|
|
146
148
|
}
|
|
@@ -166,14 +168,14 @@ const Bn = U((t, e) => {
|
|
|
166
168
|
_id: "aiChatDisclaimer"
|
|
167
169
|
}), Un = S(
|
|
168
170
|
(t) => {
|
|
169
|
-
const { aiChatSettings: e } =
|
|
170
|
-
return e.disclaimerSettings?.isEnabled ? /* @__PURE__ */ n(
|
|
171
|
+
const { aiChatSettings: e } = p(), [a, o] = q(!1), r = Ct(a, 100);
|
|
172
|
+
return e.disclaimerSettings?.isEnabled ? /* @__PURE__ */ n(bt, { open: a, setOpen: o, children: /* @__PURE__ */ n(R.Root, { open: r, onOpenChange: o, children: /* @__PURE__ */ n(kt, { ...t }) }) }) : null;
|
|
171
173
|
}
|
|
172
174
|
), Bt = i("span", {
|
|
173
175
|
_id: "aiChatDisclaimerLabel"
|
|
174
176
|
}), Kn = S(
|
|
175
177
|
(t) => {
|
|
176
|
-
const { aiChatSettings: e } =
|
|
178
|
+
const { aiChatSettings: e } = p(), a = e.disclaimerSettings;
|
|
177
179
|
return /* @__PURE__ */ n(Bt, { children: a?.label, ...t });
|
|
178
180
|
}
|
|
179
181
|
), yt = i(R.Trigger, {
|
|
@@ -211,7 +213,7 @@ const Bn = U((t, e) => {
|
|
|
211
213
|
_id: "aiChatDisclaimerText"
|
|
212
214
|
}), zn = S(
|
|
213
215
|
(t) => {
|
|
214
|
-
const { aiChatSettings: e } =
|
|
216
|
+
const { aiChatSettings: e } = p(), a = e.aiAssistantName, r = e.disclaimerSettings?.tooltip || `Information provided by ${a || "this AI assistant"} is not guaranteed to be accurate or comprehensive.`;
|
|
215
217
|
return /* @__PURE__ */ n(xt, { shouldOpenLinksInNewTab: !0, children: r, ...t });
|
|
216
218
|
}
|
|
217
219
|
), Gn = i(R.Arrow, {
|
|
@@ -219,26 +221,26 @@ const Bn = U((t, e) => {
|
|
|
219
221
|
}), wt = i("div", {
|
|
220
222
|
_id: "aiChatExampleQuestions"
|
|
221
223
|
}), Yn = (t) => {
|
|
222
|
-
const { aiChatSettings: e } =
|
|
224
|
+
const { aiChatSettings: e } = p(), { messages: a } = g();
|
|
223
225
|
return !e.exampleQuestions?.length || a.length ? null : /* @__PURE__ */ n(wt, { ...t });
|
|
224
226
|
}, Ht = i("h3", {
|
|
225
227
|
_id: "aiChatExampleQuestionsLabel"
|
|
226
228
|
}), Jn = S(
|
|
227
229
|
(t) => {
|
|
228
|
-
const { aiChatSettings: e } =
|
|
230
|
+
const { aiChatSettings: e } = p();
|
|
229
231
|
return /* @__PURE__ */ n(Ht, { children: e.exampleQuestionsLabel, ...t });
|
|
230
232
|
}
|
|
231
233
|
), Lt = i("div", {
|
|
232
234
|
_id: "aiChatExampleQuestionsList"
|
|
233
235
|
}), Xn = S(
|
|
234
236
|
(t) => {
|
|
235
|
-
const { aiChatSettings: e } =
|
|
237
|
+
const { aiChatSettings: e } = p(), a = e.exampleQuestions, { children: o, ...r } = t;
|
|
236
238
|
return /* @__PURE__ */ n(Lt, { children: B(o, a), ...r });
|
|
237
239
|
}
|
|
238
240
|
), Dt = i("div", {
|
|
239
241
|
_id: "aiChatExampleQuestion"
|
|
240
242
|
}), Zn = U((t, e) => {
|
|
241
|
-
const { aiChatSettings: a } =
|
|
243
|
+
const { aiChatSettings: a } = p(), o = a.isFirstExampleQuestionHighlighted;
|
|
242
244
|
return /* @__PURE__ */ n(Dt, { ref: e, "data-highlight": v(o), ...t });
|
|
243
245
|
}), Ot = i("button", {
|
|
244
246
|
_id: "aiChatExampleQuestionButton"
|
|
@@ -255,18 +257,18 @@ const Bn = U((t, e) => {
|
|
|
255
257
|
}, Rt = i("div", {
|
|
256
258
|
_id: "aiChatWorkflows"
|
|
257
259
|
}), to = (t) => {
|
|
258
|
-
const { aiChatSettings: e } =
|
|
260
|
+
const { aiChatSettings: e } = p(), { messages: a } = g();
|
|
259
261
|
return !e.workflows?.length || a.length ? null : /* @__PURE__ */ n(Rt, { ...t });
|
|
260
262
|
}, Wt = i("h3", {
|
|
261
263
|
_id: "aiChatWorkflowsLabel"
|
|
262
264
|
}), io = S((t) => {
|
|
263
|
-
const { aiChatSettings: e } =
|
|
265
|
+
const { aiChatSettings: e } = p();
|
|
264
266
|
return /* @__PURE__ */ n(Wt, { children: e.workflowsHeader, ...t });
|
|
265
267
|
}), Nt = i("div", {
|
|
266
268
|
_id: "aiChatWorkflowsList"
|
|
267
269
|
}), ao = S(
|
|
268
270
|
(t) => {
|
|
269
|
-
const { aiChatSettings: e } =
|
|
271
|
+
const { aiChatSettings: e } = p(), a = e.workflows, { children: o, ...r } = t;
|
|
270
272
|
return /* @__PURE__ */ n(Nt, { children: B(o, a), ...r });
|
|
271
273
|
}
|
|
272
274
|
), Vt = i("button", {
|
|
@@ -289,7 +291,7 @@ const Bn = U((t, e) => {
|
|
|
289
291
|
return e.role === "system" ? null : /* @__PURE__ */ n(Ze, { message: e, children: /* @__PURE__ */ n($t, { "data-role": e.role, ...a }) });
|
|
290
292
|
}, oo = S(
|
|
291
293
|
(t) => {
|
|
292
|
-
const { message: e, ...a } = t, { aiChatSettings: o, baseSettings: r } =
|
|
294
|
+
const { message: e, ...a } = t, { aiChatSettings: o, baseSettings: r } = p(), s = o.aiAssistantName, c = s ? `Hi, I'm ${s}!` : "Hi!", d = o.chatSubjectName ?? r.organizationDisplayName, m = d ? `
|
|
293
295
|
|
|
294
296
|
Ask me anything about \`${d}\`.` : `
|
|
295
297
|
|
|
@@ -317,7 +319,7 @@ const Bn = U((t, e) => {
|
|
|
317
319
|
}, jt = i(ae.Root, {
|
|
318
320
|
_id: "aiChatMessageAvatarContent"
|
|
319
321
|
}), mo = (t) => {
|
|
320
|
-
const { message: e } = P(), { baseSettings: a } =
|
|
322
|
+
const { message: e } = P(), { baseSettings: a } = p();
|
|
321
323
|
return /* @__PURE__ */ n(
|
|
322
324
|
jt,
|
|
323
325
|
{
|
|
@@ -330,7 +332,7 @@ const Bn = U((t, e) => {
|
|
|
330
332
|
_id: "aiChatMessageAvatarFallback"
|
|
331
333
|
}), lo = S(
|
|
332
334
|
(t) => {
|
|
333
|
-
const { baseSettings: e } =
|
|
335
|
+
const { baseSettings: e } = p(), { message: a } = P();
|
|
334
336
|
return e.userProperties.name ? /* @__PURE__ */ n(
|
|
335
337
|
zt,
|
|
336
338
|
{
|
|
@@ -347,12 +349,12 @@ const Bn = U((t, e) => {
|
|
|
347
349
|
const { onLoadingStatusChange: e, ...a } = t, {
|
|
348
350
|
aiChatSettings: o,
|
|
349
351
|
baseSettings: { userProperties: r }
|
|
350
|
-
} =
|
|
352
|
+
} = p(), { message: s } = P(), { aiAssistantAvatar: c } = o ?? {}, d = typeof c == "string" ? c : c?.light, m = (typeof c == "string" ? c : c?.dark) ?? d, l = ht(d, m), [u, b] = q(l);
|
|
351
353
|
$(() => {
|
|
352
|
-
|
|
354
|
+
b(l);
|
|
353
355
|
}, [l]);
|
|
354
356
|
const C = (_) => {
|
|
355
|
-
_ === "error" &&
|
|
357
|
+
_ === "error" && b(null);
|
|
356
358
|
};
|
|
357
359
|
return s.role === "user" ? r.name ? null : o.userAvatar ? /* @__PURE__ */ n(
|
|
358
360
|
Ce,
|
|
@@ -395,7 +397,7 @@ const Bn = U((t, e) => {
|
|
|
395
397
|
), Gt = i("span", {
|
|
396
398
|
_id: "aiChatMessageName"
|
|
397
399
|
}), uo = (t) => {
|
|
398
|
-
const { message: e } = P(), { aiChatSettings: a } =
|
|
400
|
+
const { message: e } = P(), { aiChatSettings: a } = p(), { aiAssistantName: o } = a;
|
|
399
401
|
return /* @__PURE__ */ n(
|
|
400
402
|
Gt,
|
|
401
403
|
{
|
|
@@ -411,12 +413,12 @@ const Bn = U((t, e) => {
|
|
|
411
413
|
return /* @__PURE__ */ n(Yt, { "data-role": e.role, ...t });
|
|
412
414
|
}, Jt = i("div", {
|
|
413
415
|
_id: "aiChatMessageContent"
|
|
414
|
-
}),
|
|
416
|
+
}), bo = (t) => {
|
|
415
417
|
const { message: e } = P();
|
|
416
418
|
return /* @__PURE__ */ n(Jt, { "data-role": e.role, ...t });
|
|
417
419
|
}, Xt = i("div", {
|
|
418
420
|
_id: "aiChatMessageAttachments"
|
|
419
|
-
}),
|
|
421
|
+
}), po = (t) => {
|
|
420
422
|
const { message: e } = P(), a = [];
|
|
421
423
|
return e.role !== "user" || !a?.length ? null : /* @__PURE__ */ n(Xe, { children: /* @__PURE__ */ n(Xt, { ...t }) });
|
|
422
424
|
}, Zt = i("div", {
|
|
@@ -428,7 +430,7 @@ const Bn = U((t, e) => {
|
|
|
428
430
|
_id: "aiChatMessageAttachments__Item"
|
|
429
431
|
}), _o = (t) => {
|
|
430
432
|
const { attachment: e, onClick: a, ...o } = t, { selectItem: r, onOpen: s } = J();
|
|
431
|
-
return /* @__PURE__ */ n(
|
|
433
|
+
return /* @__PURE__ */ n(pe, { attachment: e, children: /* @__PURE__ */ n(
|
|
432
434
|
ei,
|
|
433
435
|
{
|
|
434
436
|
onClick: h(a, () => {
|
|
@@ -486,7 +488,7 @@ const Bn = U((t, e) => {
|
|
|
486
488
|
const { selectedItem: e } = J();
|
|
487
489
|
return /* @__PURE__ */ n(oi, { children: e?.content, ...t });
|
|
488
490
|
}, So = (t) => {
|
|
489
|
-
const { text: e, componentStyles: a, ...o } = t, { aiChatSettings: r } =
|
|
491
|
+
const { text: e, componentStyles: a, ...o } = t, { aiChatSettings: r } = p(), { shouldOpenLinksInNewTab: s } = r;
|
|
490
492
|
return /* @__PURE__ */ n(
|
|
491
493
|
G,
|
|
492
494
|
{
|
|
@@ -501,8 +503,8 @@ const Bn = U((t, e) => {
|
|
|
501
503
|
props: e,
|
|
502
504
|
componentDef: a
|
|
503
505
|
}) => {
|
|
504
|
-
const r = vt()?.shadowHost, s = O(void 0), c = O(null), d = O(null), m = O(!1), [l, u] = q(!1), [
|
|
505
|
-
|
|
506
|
+
const r = vt()?.shadowHost, s = O(void 0), c = O(null), d = O(null), m = O(!1), [l, u] = q(!1), [b, C] = q(!1), _ = O(a);
|
|
507
|
+
be(() => {
|
|
506
508
|
a !== _.current && (typeof a == "function" && typeof _.current == "function" ? a.toString() !== _.current.toString() && (_.current = a) : _.current = a);
|
|
507
509
|
}, [a]);
|
|
508
510
|
const f = _.current, I = O(e);
|
|
@@ -569,7 +571,7 @@ const Bn = U((t, e) => {
|
|
|
569
571
|
};
|
|
570
572
|
return $(() => {
|
|
571
573
|
Q(I.current);
|
|
572
|
-
}, [f,
|
|
574
|
+
}, [f, b]), $(() => {
|
|
573
575
|
!d.current || m.current || Q(e);
|
|
574
576
|
}, [e]), /* @__PURE__ */ n("slot", { name: s.current });
|
|
575
577
|
}, Bo = i("div", {
|
|
@@ -582,7 +584,7 @@ const Bn = U((t, e) => {
|
|
|
582
584
|
}, si = i("div", {
|
|
583
585
|
_id: "aiChatMessageCustomActions"
|
|
584
586
|
}), To = (t) => {
|
|
585
|
-
const { children: e, ...a } = t, { aiChatSettings: o } =
|
|
587
|
+
const { children: e, ...a } = t, { aiChatSettings: o } = p(), { message: r } = P(), { isStreaming: s, messages: c } = g(), d = c.at(-1)?.id === r?.id, m = r.role === "assistant", l = o.messageActions || [];
|
|
586
588
|
return d && s || !m ? null : /* @__PURE__ */ n(si, { children: B(e, l), ...a });
|
|
587
589
|
}, ci = i("a", {
|
|
588
590
|
_id: "aiChatMessageCustomAction"
|
|
@@ -626,11 +628,11 @@ const Bn = U((t, e) => {
|
|
|
626
628
|
}), wo = (t) => {
|
|
627
629
|
const { action: e, onClick: a, className: o, ...r } = t, { conversationId: s } = g(), {
|
|
628
630
|
baseSettings: { onFeedback: c }
|
|
629
|
-
} =
|
|
631
|
+
} = p(), { message: d } = P(), { isStreaming: m, messages: l } = g(), [u, b] = ee(), { feedback: C, submitPositiveFeedback: _, setCurrentFeedback: f, currentFeedback: I } = de(), { logEvent: M } = ue(), [H, Q] = at(), L = l.at(-1)?.id === d?.id, F = d.role === "assistant";
|
|
630
632
|
if (L && m || !F) return null;
|
|
631
633
|
const y = {
|
|
632
634
|
copy() {
|
|
633
|
-
|
|
635
|
+
b(_e(d)), M({
|
|
634
636
|
eventName: "assistant_message_copied",
|
|
635
637
|
properties: {
|
|
636
638
|
conversationId: s
|
|
@@ -695,17 +697,17 @@ const Bn = U((t, e) => {
|
|
|
695
697
|
baseSettings: { transformSource: r, organizationDisplayName: s },
|
|
696
698
|
aiChatSettings: { shouldOpenLinksInNewTab: c },
|
|
697
699
|
searchSettings: { tabs: d }
|
|
698
|
-
} =
|
|
700
|
+
} = p();
|
|
699
701
|
if (e.role !== "assistant") return null;
|
|
700
702
|
const m = e.parts.filter(
|
|
701
|
-
(
|
|
703
|
+
(b) => b.type === "data-artifact" && b.data?.type?.toLowerCase() === "citation"
|
|
702
704
|
);
|
|
703
705
|
if (!m?.length) return null;
|
|
704
|
-
const l = /* @__PURE__ */ new Map(), u = m.filter((
|
|
705
|
-
const C =
|
|
706
|
+
const l = /* @__PURE__ */ new Map(), u = m.filter((b) => {
|
|
707
|
+
const C = b.data.artifactSummary.url;
|
|
706
708
|
return !C || l.has(C) ? !1 : (l.set(C, !0), !0);
|
|
707
|
-
}).map((
|
|
708
|
-
const C =
|
|
709
|
+
}).map((b) => {
|
|
710
|
+
const C = b.data, _ = {
|
|
709
711
|
id: C?.artifactId,
|
|
710
712
|
title: C?.artifactSummary?.title || C?.name,
|
|
711
713
|
url: C?.artifactSummary?.url || "",
|
|
@@ -748,19 +750,19 @@ const Bn = U((t, e) => {
|
|
|
748
750
|
...o
|
|
749
751
|
}
|
|
750
752
|
) });
|
|
751
|
-
},
|
|
753
|
+
}, bi = i("div", {
|
|
752
754
|
_id: "aiChatMessageSourceItem__Breadcrumbs"
|
|
753
755
|
}), Ro = (t) => {
|
|
754
756
|
const { source: e } = N();
|
|
755
|
-
return e.breadcrumbs?.length ? /* @__PURE__ */ n(
|
|
757
|
+
return e.breadcrumbs?.length ? /* @__PURE__ */ n(bi, { "data-type": e.type, ...t }) : null;
|
|
756
758
|
}, Wo = i(E, {
|
|
757
759
|
_id: "aiChatMessageSourceItem__BreadcrumbIcon",
|
|
758
760
|
iconKey: "breadcrumbSeparator"
|
|
759
|
-
}),
|
|
761
|
+
}), pi = i(x, {
|
|
760
762
|
_id: "aiChatMessageSourceItem__Icon"
|
|
761
763
|
}), No = (t) => {
|
|
762
764
|
const { source: e } = N();
|
|
763
|
-
return /* @__PURE__ */ n(
|
|
765
|
+
return /* @__PURE__ */ n(pi, { iconSettings: e.icon, "data-type": e.type, ...t });
|
|
764
766
|
}, vi = i("span", {
|
|
765
767
|
_id: "aiChatMessageSourceItem__Title"
|
|
766
768
|
}), Vo = (t) => {
|
|
@@ -774,7 +776,7 @@ const Bn = U((t, e) => {
|
|
|
774
776
|
}, gi = i("span", {
|
|
775
777
|
_id: "aiChatMessageSourceItem__Description"
|
|
776
778
|
}), Qo = (t) => {
|
|
777
|
-
const { source: e } = N(), { children: a, ...o } = t, r =
|
|
779
|
+
const { source: e } = N(), { children: a, ...o } = t, r = be(() => e.description ? mt(e.description) : [], [e.description]);
|
|
778
780
|
return r.length ? /* @__PURE__ */ n(
|
|
779
781
|
gi,
|
|
780
782
|
{
|
|
@@ -816,15 +818,15 @@ const Bn = U((t, e) => {
|
|
|
816
818
|
}), Ai = i("textarea", {
|
|
817
819
|
_id: "aiChatInput"
|
|
818
820
|
}), Go = U(({ onChange: t, onKeyDown: e, ...a }, o) => {
|
|
819
|
-
const { handleInputChange: r, handleInputKeyDown: s, input: c, error: d, shouldAutoFocusInput: m, inputRef: l } = g(), { aiChatSettings: u } =
|
|
821
|
+
const { handleInputChange: r, handleInputKeyDown: s, input: c, error: d, shouldAutoFocusInput: m, inputRef: l } = g(), { aiChatSettings: u } = p(), b = he(
|
|
820
822
|
o,
|
|
821
823
|
l
|
|
822
824
|
);
|
|
823
|
-
return
|
|
825
|
+
return pt("chat", l, m), /* @__PURE__ */ n(
|
|
824
826
|
Ai,
|
|
825
827
|
{
|
|
826
828
|
asChild: !0,
|
|
827
|
-
ref:
|
|
829
|
+
ref: b,
|
|
828
830
|
maxLength: 99999,
|
|
829
831
|
placeholder: u.placeholder,
|
|
830
832
|
value: c,
|
|
@@ -838,7 +840,7 @@ const Bn = U((t, e) => {
|
|
|
838
840
|
}), fi = i("button", {
|
|
839
841
|
_id: "aiChatInput__SendButton"
|
|
840
842
|
}), Yo = (t) => {
|
|
841
|
-
const { handleSubmit: e, isSubmitDisabled: a, error: o } = g(), { aiChatSettings: r } =
|
|
843
|
+
const { handleSubmit: e, isSubmitDisabled: a, error: o } = g(), { aiChatSettings: r } = p(), { onClick: s, ...c } = t;
|
|
842
844
|
return /* @__PURE__ */ n(
|
|
843
845
|
fi,
|
|
844
846
|
{
|
|
@@ -865,7 +867,7 @@ const Bn = U((t, e) => {
|
|
|
865
867
|
_id: "aiChatAttachmentsBar__Attachment"
|
|
866
868
|
}), er = (t) => {
|
|
867
869
|
const { attachment: e, ...a } = t;
|
|
868
|
-
return /* @__PURE__ */ n(
|
|
870
|
+
return /* @__PURE__ */ n(pe, { attachment: e, children: /* @__PURE__ */ n(Ei, { ...a }) });
|
|
869
871
|
}, Si = i(x, {
|
|
870
872
|
_id: "aiChatAttachmentsBar__AttachmentIcon"
|
|
871
873
|
}), tr = (t) => {
|
|
@@ -965,12 +967,12 @@ const Bn = U((t, e) => {
|
|
|
965
967
|
return /* @__PURE__ */ n(Hi, { children: a, ...t });
|
|
966
968
|
}, Li = i("span", {
|
|
967
969
|
_id: "aiChatAttachmentsBar__ModalDescription"
|
|
968
|
-
}),
|
|
970
|
+
}), br = (t) => {
|
|
969
971
|
const { selectedInput: e } = k(), a = e?.workflowModalProps?.modalHelpText;
|
|
970
972
|
return a ? /* @__PURE__ */ n(Li, { children: a, ...t }) : null;
|
|
971
973
|
}, Di = i("div", {
|
|
972
974
|
_id: "aiChatAttachmentsBar__ModalHelp"
|
|
973
|
-
}),
|
|
975
|
+
}), pr = (t) => {
|
|
974
976
|
const { children: e, ...a } = t, { selectedInput: o } = k(), r = o?.workflowModalProps?.modalHelpElement;
|
|
975
977
|
return r ? /* @__PURE__ */ n(Di, { asChild: !e, children: e || r, ...a }) : null;
|
|
976
978
|
}, vr = i(re, {
|
|
@@ -1102,15 +1104,15 @@ const Bn = U((t, e) => {
|
|
|
1102
1104
|
}), Ui = i(W.Trigger, {
|
|
1103
1105
|
_id: "aiChat__ChatAction"
|
|
1104
1106
|
}), Pe = (t) => {
|
|
1105
|
-
const { action: e, onClick: a, className: o, ...r } = t, s = {}, { clear: c, stop: d, isBusy: m, messages: l } = g(), { conversationId: u } = g(), { aiChatSettings:
|
|
1107
|
+
const { action: e, onClick: a, className: o, ...r } = t, s = {}, { clear: c, stop: d, isBusy: m, messages: l } = g(), { conversationId: u } = g(), { aiChatSettings: b } = p(), [C, _] = ee(), [
|
|
1106
1108
|
f
|
|
1107
1109
|
/* copyShareUri */
|
|
1108
1110
|
] = ee(), I = l.length > 0;
|
|
1109
1111
|
if ({
|
|
1110
1112
|
help: !1,
|
|
1111
|
-
copy: !I || !
|
|
1112
|
-
share: !I || !
|
|
1113
|
-
clear: !I ||
|
|
1113
|
+
copy: !I || !b.isCopyChatButtonVisible || m,
|
|
1114
|
+
share: !I || !b.isShareButtonVisible || !u || !!s || m,
|
|
1115
|
+
clear: !I || b.isViewOnly || m,
|
|
1114
1116
|
stop: !m
|
|
1115
1117
|
}[e]) return null;
|
|
1116
1118
|
const L = {
|
|
@@ -1152,7 +1154,7 @@ ${T}`;
|
|
|
1152
1154
|
}, Ki = i("span", {
|
|
1153
1155
|
_id: "aiChat__ChatActionLabel"
|
|
1154
1156
|
}), qi = (t) => {
|
|
1155
|
-
const { action: e, ...a } = t, { aiChatSettings: o } =
|
|
1157
|
+
const { action: e, ...a } = t, { aiChatSettings: o } = p(), r = o.toolbarButtonLabels ?? {}, s = {
|
|
1156
1158
|
help: r.getHelp ?? "Get Help",
|
|
1157
1159
|
copy: r.copyChat ?? "Copy",
|
|
1158
1160
|
share: r.share ?? "Share",
|
|
@@ -1174,13 +1176,13 @@ ${T}`;
|
|
|
1174
1176
|
}, zi = i(R.Root, {
|
|
1175
1177
|
_id: "aiChatHelpActions"
|
|
1176
1178
|
}), Dr = (t) => {
|
|
1177
|
-
const { children: e, ...a } = t, { aiChatSettings: o } =
|
|
1179
|
+
const { children: e, ...a } = t, { aiChatSettings: o } = p(), { getHelpOptions: r } = o;
|
|
1178
1180
|
if (!r || (r ?? []).length === 0)
|
|
1179
1181
|
return null;
|
|
1180
1182
|
const { _pinned: s, _unpinned: c } = r.reduce(
|
|
1181
|
-
(u,
|
|
1182
|
-
const C =
|
|
1183
|
-
return { ...u, [C]: [...u[C],
|
|
1183
|
+
(u, b) => {
|
|
1184
|
+
const C = b.isPinnedToToolbar ? "_pinned" : "_unpinned";
|
|
1185
|
+
return { ...u, [C]: [...u[C], b] };
|
|
1184
1186
|
},
|
|
1185
1187
|
{ _pinned: [], _unpinned: [] }
|
|
1186
1188
|
), d = c.length === 1 ? [...s, c[0]] : s, m = c.length === 1 ? [] : c, l = ot();
|
|
@@ -1216,7 +1218,7 @@ ${T}`;
|
|
|
1216
1218
|
_id: "aiChatHelpActions__Trigger"
|
|
1217
1219
|
}), Rr = S(
|
|
1218
1220
|
(t) => {
|
|
1219
|
-
const { aiChatSettings: e } =
|
|
1221
|
+
const { aiChatSettings: e } = p();
|
|
1220
1222
|
return /* @__PURE__ */ n(Pe, { action: "help", ...t, asChild: !0, children: /* @__PURE__ */ n(Ji, { children: e.toolbarButtonLabels?.getHelp ?? "Get Help" }) });
|
|
1221
1223
|
}
|
|
1222
1224
|
), Xi = i(R.Content, {
|
|
@@ -1453,7 +1455,7 @@ ${T}`;
|
|
|
1453
1455
|
}, ls = i(Ae, {
|
|
1454
1456
|
_id: "aiChatForm__FieldEmail",
|
|
1455
1457
|
type: "email"
|
|
1456
|
-
}),
|
|
1458
|
+
}), ba = i("input", {
|
|
1457
1459
|
_id: "aiChatForm__FieldFile",
|
|
1458
1460
|
type: "file",
|
|
1459
1461
|
multiple: !0
|
|
@@ -1463,12 +1465,12 @@ ${T}`;
|
|
|
1463
1465
|
error: a,
|
|
1464
1466
|
fieldProps: { value: o, onChange: r, onBlur: s, ...c },
|
|
1465
1467
|
autoFocus: d
|
|
1466
|
-
} = w(), { onChange: m, onBlur: l, ...u } = t,
|
|
1468
|
+
} = w(), { onChange: m, onBlur: l, ...u } = t, b = (C) => {
|
|
1467
1469
|
const _ = C.target.files;
|
|
1468
1470
|
r(_);
|
|
1469
1471
|
};
|
|
1470
1472
|
return /* @__PURE__ */ n(
|
|
1471
|
-
|
|
1473
|
+
ba,
|
|
1472
1474
|
{
|
|
1473
1475
|
id: e.name,
|
|
1474
1476
|
autoFocus: d,
|
|
@@ -1476,7 +1478,7 @@ ${T}`;
|
|
|
1476
1478
|
"data-invalid": v(!!a),
|
|
1477
1479
|
...u,
|
|
1478
1480
|
...c,
|
|
1479
|
-
onChange: h(m,
|
|
1481
|
+
onChange: h(m, b),
|
|
1480
1482
|
onBlur: h(l, s)
|
|
1481
1483
|
}
|
|
1482
1484
|
);
|
|
@@ -1485,12 +1487,12 @@ ${T}`;
|
|
|
1485
1487
|
type: "textarea",
|
|
1486
1488
|
asChild: !0,
|
|
1487
1489
|
children: /* @__PURE__ */ n(ie, { maxRows: 8 })
|
|
1488
|
-
}),
|
|
1490
|
+
}), pa = i(z.Root, {
|
|
1489
1491
|
_id: "aiChatForm__FieldCheckbox"
|
|
1490
1492
|
}), Cs = (t) => {
|
|
1491
1493
|
const { field: e, error: a, fieldProps: o, autoFocus: r } = w(), { onCheckedChange: s, ...c } = t;
|
|
1492
1494
|
return /* @__PURE__ */ n(
|
|
1493
|
-
|
|
1495
|
+
pa,
|
|
1494
1496
|
{
|
|
1495
1497
|
id: e.name,
|
|
1496
1498
|
name: e.name,
|
|
@@ -1501,12 +1503,12 @@ ${T}`;
|
|
|
1501
1503
|
...c
|
|
1502
1504
|
}
|
|
1503
1505
|
);
|
|
1504
|
-
},
|
|
1506
|
+
}, bs = i(z.Indicator, {
|
|
1505
1507
|
_id: "aiChatForm__FieldCheckboxIndicator",
|
|
1506
1508
|
children: /* @__PURE__ */ n(ve, {})
|
|
1507
1509
|
}), va = i(xe, {
|
|
1508
1510
|
_id: "aiChatForm__FieldSelect"
|
|
1509
|
-
}),
|
|
1511
|
+
}), ps = (t) => {
|
|
1510
1512
|
const { field: e, error: a, fieldProps: o } = w(), { onValueChange: r, ...s } = t;
|
|
1511
1513
|
return /* @__PURE__ */ n(
|
|
1512
1514
|
va,
|
|
@@ -1554,7 +1556,7 @@ ${T}`;
|
|
|
1554
1556
|
), Ms = (t) => {
|
|
1555
1557
|
const { field: e, error: a, fieldProps: o } = w(), { onValueChange: r, ...s } = t;
|
|
1556
1558
|
if (e.inputType !== "combobox") return null;
|
|
1557
|
-
const c = e, { items: d, placeholder: m, multiple: l } = c, u = Array.isArray(o.value) ? o.value : [],
|
|
1559
|
+
const c = e, { items: d, placeholder: m, multiple: l } = c, u = Array.isArray(o.value) ? o.value : [], b = {
|
|
1558
1560
|
name: e.name,
|
|
1559
1561
|
"data-invalid": v(!!a) || void 0,
|
|
1560
1562
|
items: d,
|
|
@@ -1570,7 +1572,7 @@ ${T}`;
|
|
|
1570
1572
|
return /* @__PURE__ */ n(
|
|
1571
1573
|
Le,
|
|
1572
1574
|
{
|
|
1573
|
-
...
|
|
1575
|
+
...b
|
|
1574
1576
|
}
|
|
1575
1577
|
);
|
|
1576
1578
|
}, ga = { _id: "aiChatForm__FieldCombobox__Control" }, Es = i(
|
|
@@ -1709,10 +1711,10 @@ export {
|
|
|
1709
1711
|
_r as AttachmentsBarModalBody,
|
|
1710
1712
|
vr as AttachmentsBarModalClose,
|
|
1711
1713
|
hr as AttachmentsBarModalContent,
|
|
1712
|
-
|
|
1714
|
+
br as AttachmentsBarModalDescription,
|
|
1713
1715
|
ur as AttachmentsBarModalHeader,
|
|
1714
1716
|
Cr as AttachmentsBarModalHeading,
|
|
1715
|
-
|
|
1717
|
+
pr as AttachmentsBarModalHelp,
|
|
1716
1718
|
lr as AttachmentsBarModalOverlay,
|
|
1717
1719
|
Pe as ChatAction,
|
|
1718
1720
|
Lr as ChatActionFeedback,
|
|
@@ -1762,10 +1764,10 @@ export {
|
|
|
1762
1764
|
_r as EmbeddedChatPrimitiveAttachmentsBarModalBody,
|
|
1763
1765
|
vr as EmbeddedChatPrimitiveAttachmentsBarModalClose,
|
|
1764
1766
|
hr as EmbeddedChatPrimitiveAttachmentsBarModalContent,
|
|
1765
|
-
|
|
1767
|
+
br as EmbeddedChatPrimitiveAttachmentsBarModalDescription,
|
|
1766
1768
|
ur as EmbeddedChatPrimitiveAttachmentsBarModalHeader,
|
|
1767
1769
|
Cr as EmbeddedChatPrimitiveAttachmentsBarModalHeading,
|
|
1768
|
-
|
|
1770
|
+
pr as EmbeddedChatPrimitiveAttachmentsBarModalHelp,
|
|
1769
1771
|
lr as EmbeddedChatPrimitiveAttachmentsBarModalOverlay,
|
|
1770
1772
|
Pe as EmbeddedChatPrimitiveChatAction,
|
|
1771
1773
|
Lr as EmbeddedChatPrimitiveChatActionFeedback,
|
|
@@ -1813,7 +1815,7 @@ export {
|
|
|
1813
1815
|
Ns as EmbeddedChatPrimitiveFormError,
|
|
1814
1816
|
ds as EmbeddedChatPrimitiveFormField,
|
|
1815
1817
|
Cs as EmbeddedChatPrimitiveFormFieldCheckbox,
|
|
1816
|
-
|
|
1818
|
+
bs as EmbeddedChatPrimitiveFormFieldCheckboxIndicator,
|
|
1817
1819
|
Ms as EmbeddedChatPrimitiveFormFieldCombobox,
|
|
1818
1820
|
ys as EmbeddedChatPrimitiveFormFieldComboboxContent,
|
|
1819
1821
|
Es as EmbeddedChatPrimitiveFormFieldComboboxControl,
|
|
@@ -1832,7 +1834,7 @@ export {
|
|
|
1832
1834
|
Ws as EmbeddedChatPrimitiveFormFieldError,
|
|
1833
1835
|
hs as EmbeddedChatPrimitiveFormFieldFile,
|
|
1834
1836
|
ms as EmbeddedChatPrimitiveFormFieldLabel,
|
|
1835
|
-
|
|
1837
|
+
ps as EmbeddedChatPrimitiveFormFieldSelect,
|
|
1836
1838
|
Fs as EmbeddedChatPrimitiveFormFieldSelectContent,
|
|
1837
1839
|
gs as EmbeddedChatPrimitiveFormFieldSelectIcon,
|
|
1838
1840
|
As as EmbeddedChatPrimitiveFormFieldSelectItem,
|
|
@@ -1865,7 +1867,7 @@ export {
|
|
|
1865
1867
|
oo as EmbeddedChatPrimitiveIntroMessageWrapper,
|
|
1866
1868
|
So as EmbeddedChatPrimitiveMarkdown,
|
|
1867
1869
|
wo as EmbeddedChatPrimitiveMessageAction,
|
|
1868
|
-
|
|
1870
|
+
po as EmbeddedChatPrimitiveMessageAttachments,
|
|
1869
1871
|
_o as EmbeddedChatPrimitiveMessageAttachmentsItem,
|
|
1870
1872
|
go as EmbeddedChatPrimitiveMessageAttachmentsItemIcon,
|
|
1871
1873
|
Fo as EmbeddedChatPrimitiveMessageAttachmentsItemTitle,
|
|
@@ -1880,7 +1882,7 @@ export {
|
|
|
1880
1882
|
mo as EmbeddedChatPrimitiveMessageAvatarContent,
|
|
1881
1883
|
lo as EmbeddedChatPrimitiveMessageAvatarFallback,
|
|
1882
1884
|
ho as EmbeddedChatPrimitiveMessageAvatarImage,
|
|
1883
|
-
|
|
1885
|
+
bo as EmbeddedChatPrimitiveMessageContent,
|
|
1884
1886
|
Co as EmbeddedChatPrimitiveMessageContentWrapper,
|
|
1885
1887
|
xo as EmbeddedChatPrimitiveMessageCustomAction,
|
|
1886
1888
|
To as EmbeddedChatPrimitiveMessageCustomActions,
|
|
@@ -1942,7 +1944,7 @@ export {
|
|
|
1942
1944
|
Ns as FormError,
|
|
1943
1945
|
ds as FormField,
|
|
1944
1946
|
Cs as FormFieldCheckbox,
|
|
1945
|
-
|
|
1947
|
+
bs as FormFieldCheckboxIndicator,
|
|
1946
1948
|
Ms as FormFieldCombobox,
|
|
1947
1949
|
ys as FormFieldComboboxContent,
|
|
1948
1950
|
Es as FormFieldComboboxControl,
|
|
@@ -1961,7 +1963,7 @@ export {
|
|
|
1961
1963
|
Ws as FormFieldError,
|
|
1962
1964
|
hs as FormFieldFile,
|
|
1963
1965
|
ms as FormFieldLabel,
|
|
1964
|
-
|
|
1966
|
+
ps as FormFieldSelect,
|
|
1965
1967
|
Fs as FormFieldSelectContent,
|
|
1966
1968
|
gs as FormFieldSelectIcon,
|
|
1967
1969
|
As as FormFieldSelectItem,
|
|
@@ -1996,7 +1998,7 @@ export {
|
|
|
1996
1998
|
oo as IntroMessageWrapper,
|
|
1997
1999
|
So as Markdown,
|
|
1998
2000
|
wo as MessageAction,
|
|
1999
|
-
|
|
2001
|
+
po as MessageAttachments,
|
|
2000
2002
|
_o as MessageAttachmentsItem,
|
|
2001
2003
|
go as MessageAttachmentsItemIcon,
|
|
2002
2004
|
Fo as MessageAttachmentsItemTitle,
|
|
@@ -2011,7 +2013,7 @@ export {
|
|
|
2011
2013
|
mo as MessageAvatarContent,
|
|
2012
2014
|
lo as MessageAvatarFallback,
|
|
2013
2015
|
ho as MessageAvatarImage,
|
|
2014
|
-
|
|
2016
|
+
bo as MessageContent,
|
|
2015
2017
|
Co as MessageContentWrapper,
|
|
2016
2018
|
xo as MessageCustomAction,
|
|
2017
2019
|
To as MessageCustomActions,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),t=require("react"),l=require("./config-provider.cjs"),a=t.createContext(void 0),p=({children:e})=>{const{baseSettings:s,componentType:n}=l.useInkeepConfig(),{tags:o,analyticsProperties:r}=s,i=t.useMemo(()=>({widgetLibraryVersion:"0.15.
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("react/jsx-runtime"),t=require("react"),l=require("./config-provider.cjs"),a=t.createContext(void 0),p=({children:e})=>{const{baseSettings:s,componentType:n}=l.useInkeepConfig(),{tags:o,analyticsProperties:r}=s,i=t.useMemo(()=>({widgetLibraryVersion:"0.15.22",componentType:n,tags:o}),[n,o]),u={logEvent:t.useCallback(async c=>{const v={...i,...c.properties,...r},d={eventName:c.eventName,properties:v};return s.onEvent?.(d)},[s,i,r])};return E.jsx(a.Provider,{value:u,children:e})},g=()=>{const e=t.useContext(a);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=p;exports.useBaseEvents=g;
|
|
@@ -5,7 +5,7 @@ import { useInkeepConfig as g } from "./config-provider.js";
|
|
|
5
5
|
const a = d(void 0), P = ({ children: e }) => {
|
|
6
6
|
const { baseSettings: t, componentType: o } = g(), { tags: s, analyticsProperties: n } = t, r = u(
|
|
7
7
|
() => ({
|
|
8
|
-
widgetLibraryVersion: "0.15.
|
|
8
|
+
widgetLibraryVersion: "0.15.22",
|
|
9
9
|
componentType: o,
|
|
10
10
|
tags: s
|
|
11
11
|
}),
|