@inkeep/cxkit-primitives 0.5.49 → 0.5.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/atoms/icons/built-in-icons.cjs +1 -1
- package/dist/atoms/icons/built-in-icons.js +41 -39
- package/dist/components/embedded-chat/use-inkeep-chat.cjs +3 -3
- package/dist/components/embedded-chat/use-inkeep-chat.js +52 -52
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.cjs +1 -1
- package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.js +35 -27
- package/dist/providers/base-events-provider.cjs +1 -1
- package/dist/providers/base-events-provider.js +1 -1
- package/dist/providers/chat-events-provider.cjs +1 -1
- package/dist/providers/chat-events-provider.js +29 -31
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fa6/index.cjs"),
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fa6/index.cjs"),a=require("../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fi/index.cjs"),e=require("../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/io5/index.cjs"),n=require("../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.cjs"),u={FaBook:o.FaBook,FaGithub:o.FaGithub,FaDatabase:o.FaDatabase,FaStackOverflow:o.FaStackOverflow,FaChrome:o.FaChrome,FaPhone:o.FaPhone,FaEnvelope:o.FaEnvelope,FaPencil:o.FaPencil,FaBlog:o.FaBlog,FaSort:o.FaSort,FaPenSquare:o.FaPenToSquare,FaChevronRight:o.FaChevronRight,FaChevronUp:o.FaChevronUp,FaFilePdf:o.FaFilePdf,FaDiscourse:o.FaDiscourse,FaDiscord:o.FaDiscord,FaSlack:o.FaSlack,IoDocumentTextSharp:e.IoDocumentTextSharp,IoDocumentSharp:e.IoDocumentSharp,IoSend:e.IoSend,IoInformationCircleOutline:e.IoInformationCircleOutline,IoLinkOutline:e.IoLinkOutline,IoThumbsUpSharp:e.IoThumbsUpSharp,IoThumbsDownSharp:e.IoThumbsDownSharp,IoSearch:e.IoSearch,IoCopyOutline:e.IoCopyOutline,IoCopy:e.IoCopy,IoReturnDownBackOutline:e.IoReturnDownBackOutline,IoChevronForwardOutline:e.IoChevronForwardOutline,IoReturnDownForward:e.IoReturnDownForward,IoCloseOutline:e.IoCloseOutline,IoCheckmarkOutline:e.IoCheckmarkOutline,IoBookOutline:e.IoBookOutline,IoReaderOutline:e.IoReaderOutline,IoHelpBuoyOutline:e.IoHelpBuoyOutline,IoPeopleOutline:e.IoPeopleOutline,IoDocumentTextOutline:e.IoDocumentTextOutline,IoChatbubblesOutline:e.IoChatbubblesOutline,FaRegFilePdf:o.FaRegFilePdf,IoLogoDiscord:e.IoLogoDiscord,IoLogoGithub:e.IoLogoGithub,IoTerminal:e.IoTerminal,FaBriefcase:o.FaBriefcase,IoPlayCircleOutline:e.IoPlayCircleOutline,IoPencilOutline:e.IoPencilOutline,IoCheckmarkDoneOutline:e.IoCheckmarkDoneOutline,IoHomeOutline:e.IoHomeOutline,IoMail:e.IoMail,IoOpenOutline:e.IoOpenOutline,FaTelegram:o.FaTelegram,FaTable:o.FaTable,FaMagnifyingGlass:o.FaMagnifyingGlass,LuArrowLeft:n.LuArrowLeft,LuCircleCheck:n.LuCircleCheck,LuCommand:n.LuCommand,LuCopy:n.LuCopy,LuCheck:n.LuCheck,LuCornerDownLeft:n.LuCornerDownLeft,LuGlobe:n.LuGlobe,LuLink:n.LuLink,LuRepeat:n.LuRepeat,LuThumbsDown:n.LuThumbsDown,LuThumbsUp:n.LuThumbsUp,LuUsers:n.LuUsers,LuUser:n.LuUser,LuArrowUpRight:n.LuArrowUpRight,LuBookOpen:n.LuBookOpen,LuChevronDown:n.LuChevronDown,LuLoaderCircle:n.LuLoaderCircle,FiEdit:a.FiEdit,LuSparkles:n.LuSparkles,LuCornerDownRight:n.LuCornerDownRight,LuCalendar:n.LuCalendar,LuHeadset:n.LuHeadset};exports.iconMap=u;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { FaMagnifyingGlass as o, FaTable as e, FaTelegram as
|
|
3
|
-
import { FiEdit as
|
|
4
|
-
import { IoOpenOutline as
|
|
5
|
-
import {
|
|
6
|
-
const
|
|
7
|
-
FaBook:
|
|
2
|
+
import { FaMagnifyingGlass as o, FaTable as e, FaTelegram as a, FaBriefcase as n, FaRegFilePdf as r, FaSlack as u, FaDiscord as i, FaDiscourse as t, FaFilePdf as l, FaChevronUp as I, FaChevronRight as F, FaPenToSquare as L, FaSort as h, FaBlog as c, FaPencil as m, FaEnvelope as p, FaPhone as C, FaChrome as s, FaStackOverflow as O, FaDatabase as k, FaGithub as D, FaBook as d } from "../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fa6/index.js";
|
|
3
|
+
import { FiEdit as b } from "../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/fi/index.js";
|
|
4
|
+
import { IoOpenOutline as f, IoMail as w, IoHomeOutline as S, IoCheckmarkDoneOutline as g, IoPencilOutline as T, IoPlayCircleOutline as P, IoTerminal as R, IoLogoGithub as B, IoLogoDiscord as v, IoChatbubblesOutline as y, IoDocumentTextOutline as U, IoPeopleOutline as G, IoHelpBuoyOutline as x, IoReaderOutline as H, IoBookOutline as M, IoCheckmarkOutline as q, IoCloseOutline as A, IoReturnDownForward as E, IoChevronForwardOutline as j, IoReturnDownBackOutline as z, IoCopy as J, IoCopyOutline as K, IoSearch as N, IoThumbsDownSharp as Q, IoThumbsUpSharp as V, IoLinkOutline as W, IoInformationCircleOutline as X, IoSend as Y, IoDocumentSharp as Z, IoDocumentTextSharp as _ } from "../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/io5/index.js";
|
|
5
|
+
import { LuHeadset as $, LuCalendar as oo, LuCornerDownRight as eo, LuSparkles as ao, LuLoaderCircle as no, LuChevronDown as ro, LuBookOpen as uo, LuArrowUpRight as io, LuUser as to, LuUsers as lo, LuThumbsUp as Io, LuThumbsDown as Fo, LuRepeat as Lo, LuLink as ho, LuGlobe as co, LuCornerDownLeft as mo, LuCheck as po, LuCopy as Co, LuCommand as so, LuCircleCheck as Oo, LuArrowLeft as ko } from "../../node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.js";
|
|
6
|
+
const So = {
|
|
7
|
+
FaBook: d,
|
|
8
8
|
FaGithub: D,
|
|
9
9
|
FaDatabase: k,
|
|
10
|
-
FaStackOverflow:
|
|
11
|
-
FaChrome:
|
|
10
|
+
FaStackOverflow: O,
|
|
11
|
+
FaChrome: s,
|
|
12
12
|
FaPhone: C,
|
|
13
13
|
FaEnvelope: p,
|
|
14
14
|
FaPencil: m,
|
|
@@ -33,11 +33,11 @@ const fo = {
|
|
|
33
33
|
IoCopy: J,
|
|
34
34
|
IoReturnDownBackOutline: z,
|
|
35
35
|
IoChevronForwardOutline: j,
|
|
36
|
-
IoReturnDownForward:
|
|
37
|
-
IoCloseOutline:
|
|
38
|
-
IoCheckmarkOutline:
|
|
39
|
-
IoBookOutline:
|
|
40
|
-
IoReaderOutline:
|
|
36
|
+
IoReturnDownForward: E,
|
|
37
|
+
IoCloseOutline: A,
|
|
38
|
+
IoCheckmarkOutline: q,
|
|
39
|
+
IoBookOutline: M,
|
|
40
|
+
IoReaderOutline: H,
|
|
41
41
|
IoHelpBuoyOutline: x,
|
|
42
42
|
IoPeopleOutline: G,
|
|
43
43
|
IoDocumentTextOutline: U,
|
|
@@ -46,37 +46,39 @@ const fo = {
|
|
|
46
46
|
IoLogoDiscord: v,
|
|
47
47
|
IoLogoGithub: B,
|
|
48
48
|
IoTerminal: R,
|
|
49
|
-
FaBriefcase:
|
|
49
|
+
FaBriefcase: n,
|
|
50
50
|
IoPlayCircleOutline: P,
|
|
51
51
|
IoPencilOutline: T,
|
|
52
52
|
IoCheckmarkDoneOutline: g,
|
|
53
|
-
IoHomeOutline:
|
|
54
|
-
IoMail:
|
|
55
|
-
IoOpenOutline:
|
|
56
|
-
FaTelegram:
|
|
53
|
+
IoHomeOutline: S,
|
|
54
|
+
IoMail: w,
|
|
55
|
+
IoOpenOutline: f,
|
|
56
|
+
FaTelegram: a,
|
|
57
57
|
FaTable: e,
|
|
58
58
|
FaMagnifyingGlass: o,
|
|
59
|
-
LuArrowLeft:
|
|
60
|
-
LuCircleCheck:
|
|
61
|
-
LuCommand:
|
|
62
|
-
LuCopy:
|
|
63
|
-
LuCheck:
|
|
64
|
-
LuCornerDownLeft:
|
|
65
|
-
LuGlobe:
|
|
66
|
-
LuLink:
|
|
67
|
-
LuRepeat:
|
|
68
|
-
LuThumbsDown:
|
|
69
|
-
LuThumbsUp:
|
|
70
|
-
LuUsers:
|
|
71
|
-
LuUser:
|
|
72
|
-
LuArrowUpRight:
|
|
73
|
-
LuBookOpen:
|
|
74
|
-
LuChevronDown:
|
|
75
|
-
LuLoaderCircle:
|
|
76
|
-
FiEdit:
|
|
77
|
-
LuSparkles:
|
|
78
|
-
LuCornerDownRight:
|
|
59
|
+
LuArrowLeft: ko,
|
|
60
|
+
LuCircleCheck: Oo,
|
|
61
|
+
LuCommand: so,
|
|
62
|
+
LuCopy: Co,
|
|
63
|
+
LuCheck: po,
|
|
64
|
+
LuCornerDownLeft: mo,
|
|
65
|
+
LuGlobe: co,
|
|
66
|
+
LuLink: ho,
|
|
67
|
+
LuRepeat: Lo,
|
|
68
|
+
LuThumbsDown: Fo,
|
|
69
|
+
LuThumbsUp: Io,
|
|
70
|
+
LuUsers: lo,
|
|
71
|
+
LuUser: to,
|
|
72
|
+
LuArrowUpRight: io,
|
|
73
|
+
LuBookOpen: uo,
|
|
74
|
+
LuChevronDown: ro,
|
|
75
|
+
LuLoaderCircle: no,
|
|
76
|
+
FiEdit: b,
|
|
77
|
+
LuSparkles: ao,
|
|
78
|
+
LuCornerDownRight: eo,
|
|
79
|
+
LuCalendar: oo,
|
|
80
|
+
LuHeadset: $
|
|
79
81
|
};
|
|
80
82
|
export {
|
|
81
|
-
|
|
83
|
+
So as iconMap
|
|
82
84
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ae=require("openai"),t=require("react"),Re=require("../../providers/config-provider.cjs"),Le=require("../../providers/conversation-provider.cjs"),xe=require("../../providers/chat-events-provider.cjs"),D=require("../../utils/get-message-metadata.cjs"),Be=require("../../utils/misc.cjs"),ae=require("../../utils/reset-query-params.cjs"),De=require("../../providers/chat-form-provider.cjs"),Oe=require("../../providers/widget-provider.cjs"),Fe=require("../../hooks/use-media-query.cjs"),Te=require("./use-captcha.cjs"),Ke=require("../modal/modal-provider.cjs"),l=require("../../utils/generate-uid.cjs"),Qe=require("../../utils/tools/links-tool.cjs"),We=require("../../atoms/api/analytics/conversation.cjs"),Je=()=>{const{chatId:f,setConversation:re,conversation:N,resetConversation:ie}=Le.useInkeepConversation(),{baseSettings:b,aiChatSettings:O}=Re.useInkeepConfig(),{aiApiBaseUrl:F,shouldBypassCaptcha:T,filters:K}=b,Q=Ke.useModal(),{getSolution:ce,prefetchSolution:q,invalidateSolution:W}=Te.useCaptcha({fetchUrl:`${F}/v1/challenge`,shouldBypassCaptcha:T,shouldMakeInitialRequest:Q?Q.isOpen:!0}),ue=new Ae({baseURL:`${F}/v1`,apiKey:b.apiKey,dangerouslyAllowBrowser:!0}),{onInputMessageChange:le,getTools:ge,prompts:de,model:me,filters:J,onToolCall:fe}=O,[p,_]=t.useState(""),z=t.useRef(null);t.useEffect(()=>{le?.(p)},[p]);const[g,u]=t.useState([]),[H,h]=t.useState(!1),[pe,v]=t.useState(!1),[he,j]=t.useState(null),[A,G]=t.useState(null),[y,S]=t.useState([]),ve=e=>{S(s=>[...s,e])},[ye,V]=t.useState({}),r=t.useRef([]),C=t.useRef(null),{logEvent:P}=xe.useChatEvents(),X=de?.map((e,s)=>({id:`system-${Date.now().toString()}-${l.generateUid(4)}-${s}`,role:"system",content:e})),[Se,Ce]=t.useState(!!f);t.useEffect(()=>{if(f){const{apiKey:e,analyticsApiBaseUrl:s}=b;We.getConversation(f,e,s).then(o=>{if(o){P({eventName:"shared_chat_loaded",properties:{conversation:o}}),Ce(!1),re({...o,id:""});const a=o.messages.map(c=>({id:Date.now().toString()+l.generateUid(4)+c.id,content:Be.parseIfJson(c.content),role:c.role,links:c.links}));u(a),r.current=a}})}},[f]);const Me=e=>{switch(e.code){case 400:return e.message;case 403:return`There seems to be a configuration error. Please contact ${b.organizationDisplayName??"Administrator"}`;default:return`Hmm..
|
|
2
2
|
|
|
3
|
-
It seems I might be having some issues right now. Please clear the chat and try again.`}},Y=e=>{j(e),u(s=>{const o=[...s],a=o[o.length-1];return a&&(a.content=Me(e)),o}),h(!1),v(!1),W(),q()},R=!
|
|
4
|
-
${D.serializeWorkflow(e)}`},...X,a,c];u(E),S([])},{openForm:
|
|
3
|
+
It seems I might be having some issues right now. Please clear the chat and try again.`}},Y=e=>{j(e),u(s=>{const o=[...s],a=o[o.length-1];return a&&(a.content=Me(e)),o}),h(!1),v(!1),W(),q()},R=!p.trim()&&!y.length||H,we=e=>{e.key==="Enter"&&!e.shiftKey&&!R&&!e.nativeEvent.isComposing&&(e.preventDefault(),L())},Ie=e=>{const s=e.target.value;_(s)},L=async(e=p)=>{if(R&&(!e||e.trim().length===0))return;h(!0);const s=A?g.length===2:g.length===0,o=D.getMessageMetadata(A,y,s);let a;const c=D.serializeAttachments(y);y.length&&c?a=[{type:"text",text:c}]:a=e;const ee={id:`${Date.now().toString()}-${l.generateUid(4)}-1`,role:"user",content:a,metadata:o},E=[...g.length?[]:X,ee];f&&ae.resetQueryParams(),u(M=>[...M,...E]),r.current=[...r.current,...E],S([]),_(""),P({eventName:"user_message_submitted",properties:{}},r.current);const te=[Qe.provideLinksTool,...ge?.({conversation:N})||[]];try{const M={model:me,messages:r.current,stream:!0,tools:te,tool_choice:"auto"},se=await ce(),ne=se?btoa(JSON.stringify(se)):null,oe=K||J?JSON.stringify({...K,...J}):void 0,U={};!T&&ne&&(U["X-INKEEP-CHALLENGE-SOLUTION"]=ne),oe&&(U["inkeep-filters"]=oe);const d=ue.beta.chat.completions.stream(M,Object.keys(U).length>0?{headers:U}:void 0),n={id:`${Date.now().toString()}-${l.generateUid(4)}-2`,role:"assistant",content:"",links:[],toolCalls:[]};u(w=>[...w,n]),d.on("content",(w,I)=>{v(!0),n.content=I,u($=>{const i=[...$],x=i.findIndex(k=>k.id===n.id);return x===-1?[...i,n]:(i[x]={...n},i)})}),d.on("tool_calls.function.arguments.done",async w=>{const{name:I,arguments:$}=w,i=te?.find(m=>m.function.name===I);if(!i)return;const k=("parse"in i.function?i.function.parse:JSON.parse)($),Ue=i.function.function?.(k,d),$e=i.renderMessageButtons?.({args:k,execution:Ue})??[];I==="provideLinks"?n.links=k.links??[]:V(m=>({...m,[n.id]:[...m[n.id]??[],...$e]})),n.toolCalls?.push({id:"call_"+l.generateUid(24),type:"function",function:{name:I,arguments:$}}),u(m=>{const B=[...m],Ne=B.findIndex(_e=>_e.id===n.id);return B[Ne]={...n},B}),fe?.(w,{conversation:{...N,messages:[...r.current,n]}})}),d.on("error",Y),d.finalChatCompletion().then(()=>{r.current=[...r.current,n],C.current=null,h(!1),v(!1),q(),P({eventName:"assistant_message_received",properties:{}},r.current)}),C.current=d.controller}catch(M){Y(M),h(!1),v(!1)}},ke=()=>{C.current&&(C.current.abort(),C.current=null),h(!1),v(!1),q()},Z=()=>{j(null),u([]),r.current=[],ie(),V({}),S([]),ae.resetQueryParams(),G(null),W(),q(),P({eventName:"chat_clear_button_clicked",properties:{conversation:N}})},be=e=>{G(e);const{initialReplyMessage:s,displayName:o}=e,a={id:g.length.toString()+l.generateUid(4),role:"user",content:o},c={id:(g.length+1).toString()+l.generateUid(4),role:"assistant",content:s,links:[]},E=[{id:`system-${Date.now().toString()}-${l.generateUid(4)}-${e.id}`,role:"system",content:`Company has asked user to follow this guided workflow:
|
|
4
|
+
${D.serializeWorkflow(e)}`},...X,a,c];u(E),S([])},{openForm:qe}=De.useChatForm(),Pe=Oe.useWidget();t.useImperativeHandle(O.chatFunctionsRef,()=>({submitMessage:L,updateInputMessage(e){_(e)},clearChat:Z,openForm:e=>{Pe?.setView("chat"),qe(e)},focusInput:()=>{z.current?.focus()}}));const Ee=Fe.useMediaQuery("(max-width: 768px)");return{messages:g,input:p,isLoading:H,isStreaming:pe,isLoadingConversation:Se,error:he,isSubmitDisabled:R,handleInputChange:Ie,handleInputKeyDown:we,handleSubmit:L,stop:ke,clear:Z,handleWorkflow:be,selectedWorkflow:A,messageAttachments:y,setMessageAttachments:S,addAttachment:ve,messageButtons:ye,isEmpty:g.length===0,inputRef:z,isMobile:Ee}};exports.useInkeepChat=Je;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import
|
|
3
|
-
import { useState as c, useRef as U, useEffect as ae, useImperativeHandle as
|
|
4
|
-
import { useInkeepConfig as
|
|
5
|
-
import { useInkeepConversation as
|
|
6
|
-
import { useChatEvents as
|
|
7
|
-
import { getMessageMetadata as
|
|
8
|
-
import { parseIfJson as
|
|
2
|
+
import De from "openai";
|
|
3
|
+
import { useState as c, useRef as U, useEffect as ae, useImperativeHandle as Oe } from "react";
|
|
4
|
+
import { useInkeepConfig as Re } from "../../providers/config-provider.js";
|
|
5
|
+
import { useInkeepConversation as Pe } from "../../providers/conversation-provider.js";
|
|
6
|
+
import { useChatEvents as Ue } from "../../providers/chat-events-provider.js";
|
|
7
|
+
import { getMessageMetadata as Fe, serializeAttachments as Ke, serializeWorkflow as Te } from "../../utils/get-message-metadata.js";
|
|
8
|
+
import { parseIfJson as We } from "../../utils/misc.js";
|
|
9
9
|
import { resetQueryParams as re } from "../../utils/reset-query-params.js";
|
|
10
|
-
import { useChatForm as
|
|
11
|
-
import { useWidget as
|
|
12
|
-
import { useMediaQuery as
|
|
13
|
-
import { useCaptcha as
|
|
14
|
-
import { useModal as
|
|
10
|
+
import { useChatForm as Je } from "../../providers/chat-form-provider.js";
|
|
11
|
+
import { useWidget as ze } from "../../providers/widget-provider.js";
|
|
12
|
+
import { useMediaQuery as He } from "../../hooks/use-media-query.js";
|
|
13
|
+
import { useCaptcha as Qe } from "./use-captcha.js";
|
|
14
|
+
import { useModal as je } from "../modal/modal-provider.js";
|
|
15
15
|
import { generateUid as u } from "../../utils/generate-uid.js";
|
|
16
|
-
import { provideLinksTool as
|
|
17
|
-
import { getConversation as
|
|
18
|
-
const
|
|
19
|
-
const { chatId: d, setConversation: ie, conversation: x, resetConversation: ce } =
|
|
16
|
+
import { provideLinksTool as qe } from "../../utils/tools/links-tool.js";
|
|
17
|
+
import { getConversation as Ge } from "../../atoms/api/analytics/conversation.js";
|
|
18
|
+
const gt = () => {
|
|
19
|
+
const { chatId: d, setConversation: ie, conversation: x, resetConversation: ce } = Pe(), { baseSettings: b, aiChatSettings: F } = Re(), { aiApiBaseUrl: K, shouldBypassCaptcha: T, filters: W } = b, J = je(), { getSolution: le, prefetchSolution: $, invalidateSolution: z } = Qe({
|
|
20
20
|
fetchUrl: `${K}/v1/challenge`,
|
|
21
21
|
shouldBypassCaptcha: T,
|
|
22
22
|
shouldMakeInitialRequest: J ? J.isOpen : !0
|
|
23
|
-
}), ue = new
|
|
23
|
+
}), ue = new De({
|
|
24
24
|
baseURL: `${K}/v1`,
|
|
25
25
|
apiKey: b.apiKey,
|
|
26
26
|
dangerouslyAllowBrowser: !0
|
|
@@ -37,25 +37,25 @@ const dt = () => {
|
|
|
37
37
|
}, [f]);
|
|
38
38
|
const [m, l] = c([]), [j, h] = c(!1), [he, y] = c(!1), [ye, q] = c(null), [B, G] = c(null), [C, v] = c([]), Ce = (e) => {
|
|
39
39
|
v((t) => [...t, e]);
|
|
40
|
-
}, [ve, V] = c({}), a = U([]), w = U(null), { logEvent: E
|
|
40
|
+
}, [ve, V] = c({}), a = U([]), w = U(null), { logEvent: E } = Ue(), X = pe?.map((e, t) => ({
|
|
41
41
|
id: `system-${Date.now().toString()}-${u(4)}-${t}`,
|
|
42
42
|
role: "system",
|
|
43
43
|
content: e
|
|
44
|
-
})), [
|
|
44
|
+
})), [we, Ie] = c(!!d);
|
|
45
45
|
ae(() => {
|
|
46
46
|
if (d) {
|
|
47
47
|
const { apiKey: e, analyticsApiBaseUrl: t } = b;
|
|
48
|
-
|
|
48
|
+
Ge(d, e, t).then((n) => {
|
|
49
49
|
if (n) {
|
|
50
50
|
E({
|
|
51
51
|
eventName: "shared_chat_loaded",
|
|
52
52
|
properties: {
|
|
53
53
|
conversation: n
|
|
54
54
|
}
|
|
55
|
-
}),
|
|
55
|
+
}), Ie(!1), ie({ ...n, id: "" });
|
|
56
56
|
const o = n.messages.map((i) => ({
|
|
57
57
|
id: Date.now().toString() + u(4) + i.id,
|
|
58
|
-
content:
|
|
58
|
+
content: We(i.content),
|
|
59
59
|
role: i.role,
|
|
60
60
|
links: i.links
|
|
61
61
|
}));
|
|
@@ -64,7 +64,7 @@ const dt = () => {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
}, [d]);
|
|
67
|
-
const
|
|
67
|
+
const Me = (e) => {
|
|
68
68
|
switch (e.code) {
|
|
69
69
|
case 400:
|
|
70
70
|
return e.message;
|
|
@@ -78,19 +78,19 @@ It seems I might be having some issues right now. Please clear the chat and try
|
|
|
78
78
|
}, Y = (e) => {
|
|
79
79
|
q(e), l((t) => {
|
|
80
80
|
const n = [...t], o = n[n.length - 1];
|
|
81
|
-
return o && (o.content =
|
|
81
|
+
return o && (o.content = Me(e)), n;
|
|
82
82
|
}), h(!1), y(!1), z(), $();
|
|
83
|
-
}, D = !f.trim() && !C.length || j,
|
|
83
|
+
}, D = !f.trim() && !C.length || j, Se = (e) => {
|
|
84
84
|
e.key === "Enter" && !e.shiftKey && !D && !e.nativeEvent.isComposing && (e.preventDefault(), O());
|
|
85
|
-
},
|
|
85
|
+
}, ke = (e) => {
|
|
86
86
|
const t = e.target.value;
|
|
87
87
|
L(t);
|
|
88
88
|
}, O = async (e = f) => {
|
|
89
89
|
if (D && (!e || e.trim().length === 0)) return;
|
|
90
90
|
h(!0);
|
|
91
|
-
const t = B ? m.length === 2 : m.length === 0, n =
|
|
91
|
+
const t = B ? m.length === 2 : m.length === 0, n = Fe(B, C, t);
|
|
92
92
|
let o;
|
|
93
|
-
const i =
|
|
93
|
+
const i = Ke(C);
|
|
94
94
|
C.length && i ? o = [{ type: "text", text: i }] : o = e;
|
|
95
95
|
const ee = {
|
|
96
96
|
id: `${Date.now().toString()}-${u(4)}-1`,
|
|
@@ -105,7 +105,7 @@ It seems I might be having some issues right now. Please clear the chat and try
|
|
|
105
105
|
},
|
|
106
106
|
a.current
|
|
107
107
|
);
|
|
108
|
-
const te = [
|
|
108
|
+
const te = [qe, ...ge?.({ conversation: x }) || []];
|
|
109
109
|
try {
|
|
110
110
|
const I = {
|
|
111
111
|
model: de,
|
|
@@ -136,10 +136,10 @@ It seems I might be having some issues right now. Please clear the chat and try
|
|
|
136
136
|
}), g.on("tool_calls.function.arguments.done", async (M) => {
|
|
137
137
|
const { name: S, arguments: A } = M, r = te?.find((p) => p.function.name === S);
|
|
138
138
|
if (!r) return;
|
|
139
|
-
const k = ("parse" in r.function ? r.function.parse : JSON.parse)(A),
|
|
139
|
+
const k = ("parse" in r.function ? r.function.parse : JSON.parse)(A), Ae = r.function.function?.(k, g), xe = r.renderMessageButtons?.({ args: k, execution: Ae }) ?? [];
|
|
140
140
|
S === "provideLinks" ? s.links = k.links ?? [] : V((p) => ({
|
|
141
141
|
...p,
|
|
142
|
-
[s.id]: [...p[s.id] ?? [], ...
|
|
142
|
+
[s.id]: [...p[s.id] ?? [], ...xe]
|
|
143
143
|
})), s.toolCalls?.push({
|
|
144
144
|
id: "call_" + u(24),
|
|
145
145
|
type: "function",
|
|
@@ -148,14 +148,14 @@ It seems I might be having some issues right now. Please clear the chat and try
|
|
|
148
148
|
arguments: A
|
|
149
149
|
}
|
|
150
150
|
}), l((p) => {
|
|
151
|
-
const P = [...p],
|
|
152
|
-
return P[
|
|
151
|
+
const P = [...p], Le = P.findIndex((Be) => Be.id === s.id);
|
|
152
|
+
return P[Le] = { ...s }, P;
|
|
153
|
+
}), fe?.(M, {
|
|
154
|
+
conversation: {
|
|
155
|
+
...x,
|
|
156
|
+
messages: [...a.current, s]
|
|
157
|
+
}
|
|
153
158
|
});
|
|
154
|
-
const Be = await we([
|
|
155
|
-
...a.current,
|
|
156
|
-
s
|
|
157
|
-
]);
|
|
158
|
-
fe?.(M, { conversation: Be ?? x });
|
|
159
159
|
}), g.on("error", Y), g.finalChatCompletion().then(() => {
|
|
160
160
|
a.current = [...a.current, s], w.current = null, h(!1), y(!1), $(), E(
|
|
161
161
|
{
|
|
@@ -168,7 +168,7 @@ It seems I might be having some issues right now. Please clear the chat and try
|
|
|
168
168
|
} catch (I) {
|
|
169
169
|
Y(I), h(!1), y(!1);
|
|
170
170
|
}
|
|
171
|
-
},
|
|
171
|
+
}, be = () => {
|
|
172
172
|
w.current && (w.current.abort(), w.current = null), h(!1), y(!1), $();
|
|
173
173
|
}, Z = () => {
|
|
174
174
|
q(null), l([]), a.current = [], ce(), V({}), v([]), re(), G(null), z(), $(), E({
|
|
@@ -177,7 +177,7 @@ It seems I might be having some issues right now. Please clear the chat and try
|
|
|
177
177
|
conversation: x
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
|
-
},
|
|
180
|
+
}, $e = (e) => {
|
|
181
181
|
G(e);
|
|
182
182
|
const { initialReplyMessage: t, displayName: n } = e, o = {
|
|
183
183
|
id: m.length.toString() + u(4),
|
|
@@ -192,38 +192,38 @@ It seems I might be having some issues right now. Please clear the chat and try
|
|
|
192
192
|
id: `system-${Date.now().toString()}-${u(4)}-${e.id}`,
|
|
193
193
|
role: "system",
|
|
194
194
|
content: `Company has asked user to follow this guided workflow:
|
|
195
|
-
${
|
|
195
|
+
${Te(e)}`
|
|
196
196
|
}, ...X, o, i];
|
|
197
197
|
l(N), v([]);
|
|
198
|
-
}, { openForm:
|
|
199
|
-
|
|
198
|
+
}, { openForm: Ee } = Je(), Ne = ze();
|
|
199
|
+
Oe(F.chatFunctionsRef, () => ({
|
|
200
200
|
submitMessage: O,
|
|
201
201
|
updateInputMessage(e) {
|
|
202
202
|
L(e);
|
|
203
203
|
},
|
|
204
204
|
clearChat: Z,
|
|
205
205
|
openForm: (e) => {
|
|
206
|
-
|
|
206
|
+
Ne?.setView("chat"), Ee(e);
|
|
207
207
|
},
|
|
208
208
|
focusInput: () => {
|
|
209
209
|
Q.current?.focus();
|
|
210
210
|
}
|
|
211
211
|
}));
|
|
212
|
-
const
|
|
212
|
+
const _e = He("(max-width: 768px)");
|
|
213
213
|
return {
|
|
214
214
|
messages: m,
|
|
215
215
|
input: f,
|
|
216
216
|
isLoading: j,
|
|
217
217
|
isStreaming: he,
|
|
218
|
-
isLoadingConversation:
|
|
218
|
+
isLoadingConversation: we,
|
|
219
219
|
error: ye,
|
|
220
220
|
isSubmitDisabled: D,
|
|
221
|
-
handleInputChange:
|
|
222
|
-
handleInputKeyDown:
|
|
221
|
+
handleInputChange: ke,
|
|
222
|
+
handleInputKeyDown: Se,
|
|
223
223
|
handleSubmit: O,
|
|
224
|
-
stop:
|
|
224
|
+
stop: be,
|
|
225
225
|
clear: Z,
|
|
226
|
-
handleWorkflow:
|
|
226
|
+
handleWorkflow: $e,
|
|
227
227
|
selectedWorkflow: B,
|
|
228
228
|
messageAttachments: C,
|
|
229
229
|
setMessageAttachments: v,
|
|
@@ -231,9 +231,9 @@ ${Je(e)}`
|
|
|
231
231
|
messageButtons: ve,
|
|
232
232
|
isEmpty: m.length === 0,
|
|
233
233
|
inputRef: Q,
|
|
234
|
-
isMobile:
|
|
234
|
+
isMobile: _e
|
|
235
235
|
};
|
|
236
236
|
};
|
|
237
237
|
export {
|
|
238
|
-
|
|
238
|
+
gt as useInkeepChat
|
|
239
239
|
};
|
package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../lib/iconBase.cjs");require("../lib/iconContext.cjs");function o(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"m12 19-7-7 7-7"},child:[]},{tag:"path",attr:{d:"M19 12H5"},child:[]}]})(t)}function n(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M7 7h10v10"},child:[]},{tag:"path",attr:{d:"M7 17 17 7"},child:[]}]})(t)}function e(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 7v14"},child:[]},{tag:"path",attr:{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"},child:[]}]})(t)}function i(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 6 9 17l-5-5"},child:[]}]})(t)}function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../lib/iconBase.cjs");require("../lib/iconContext.cjs");function o(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"m12 19-7-7 7-7"},child:[]},{tag:"path",attr:{d:"M19 12H5"},child:[]}]})(t)}function n(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M7 7h10v10"},child:[]},{tag:"path",attr:{d:"M7 17 17 7"},child:[]}]})(t)}function e(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M12 7v14"},child:[]},{tag:"path",attr:{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z"},child:[]}]})(t)}function a(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M8 2v4"},child:[]},{tag:"path",attr:{d:"M16 2v4"},child:[]},{tag:"rect",attr:{width:"18",height:"18",x:"3",y:"4",rx:"2"},child:[]},{tag:"path",attr:{d:"M3 10h18"},child:[]}]})(t)}function i(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M20 6 9 17l-5-5"},child:[]}]})(t)}function c(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"m6 9 6 6 6-6"},child:[]}]})(t)}function d(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"path",attr:{d:"m9 12 2 2 4-4"},child:[]}]})(t)}function h(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3"},child:[]}]})(t)}function l(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"rect",attr:{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"},child:[]},{tag:"path",attr:{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"},child:[]}]})(t)}function u(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"9 10 4 15 9 20"},child:[]},{tag:"path",attr:{d:"M20 4v7a4 4 0 0 1-4 4H4"},child:[]}]})(t)}function s(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"polyline",attr:{points:"15 10 20 15 15 20"},child:[]},{tag:"path",attr:{d:"M4 4v7a4 4 0 0 0 4 4h12"},child:[]}]})(t)}function L(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"circle",attr:{cx:"12",cy:"12",r:"10"},child:[]},{tag:"path",attr:{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"},child:[]},{tag:"path",attr:{d:"M2 12h20"},child:[]}]})(t)}function k(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z"},child:[]},{tag:"path",attr:{d:"M21 16v2a4 4 0 0 1-4 4h-5"},child:[]}]})(t)}function p(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"},child:[]},{tag:"path",attr:{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"},child:[]}]})(t)}function g(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M21 12a9 9 0 1 1-6.219-8.56"},child:[]}]})(t)}function v(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"m17 2 4 4-4 4"},child:[]},{tag:"path",attr:{d:"M3 11v-1a4 4 0 0 1 4-4h14"},child:[]},{tag:"path",attr:{d:"m7 22-4-4 4-4"},child:[]},{tag:"path",attr:{d:"M21 13v1a4 4 0 0 1-4 4H3"},child:[]}]})(t)}function f(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z"},child:[]},{tag:"path",attr:{d:"M20 3v4"},child:[]},{tag:"path",attr:{d:"M22 5h-4"},child:[]},{tag:"path",attr:{d:"M4 17v2"},child:[]},{tag:"path",attr:{d:"M5 18H3"},child:[]}]})(t)}function C(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M17 14V2"},child:[]},{tag:"path",attr:{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"},child:[]}]})(t)}function M(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M7 10v12"},child:[]},{tag:"path",attr:{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"},child:[]}]})(t)}function w(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2"},child:[]},{tag:"circle",attr:{cx:"12",cy:"7",r:"4"},child:[]}]})(t)}function x(t){return r.GenIcon({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"},child:[]},{tag:"circle",attr:{cx:"9",cy:"7",r:"4"},child:[]},{tag:"path",attr:{d:"M22 21v-2a4 4 0 0 0-3-3.87"},child:[]},{tag:"path",attr:{d:"M16 3.13a4 4 0 0 1 0 7.75"},child:[]}]})(t)}exports.LuArrowLeft=o;exports.LuArrowUpRight=n;exports.LuBookOpen=e;exports.LuCalendar=a;exports.LuCheck=i;exports.LuChevronDown=c;exports.LuCircleCheck=d;exports.LuCommand=h;exports.LuCopy=l;exports.LuCornerDownLeft=u;exports.LuCornerDownRight=s;exports.LuGlobe=L;exports.LuHeadset=k;exports.LuLink=p;exports.LuLoaderCircle=g;exports.LuRepeat=v;exports.LuSparkles=f;exports.LuThumbsDown=C;exports.LuThumbsUp=M;exports.LuUser=w;exports.LuUsers=x;
|
package/dist/node_modules/.pnpm/react-icons@5.4.0_react@19.0.0/node_modules/react-icons/lu/index.js
CHANGED
|
@@ -10,6 +10,9 @@ function a(t) {
|
|
|
10
10
|
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M12 7v14" }, child: [] }, { tag: "path", attr: { d: "M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z" }, child: [] }] })(t);
|
|
11
11
|
}
|
|
12
12
|
function d(t) {
|
|
13
|
+
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M8 2v4" }, child: [] }, { tag: "path", attr: { d: "M16 2v4" }, child: [] }, { tag: "rect", attr: { width: "18", height: "18", x: "3", y: "4", rx: "2" }, child: [] }, { tag: "path", attr: { d: "M3 10h18" }, child: [] }] })(t);
|
|
14
|
+
}
|
|
15
|
+
function h(t) {
|
|
13
16
|
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M20 6 9 17l-5-5" }, child: [] }] })(t);
|
|
14
17
|
}
|
|
15
18
|
function c(t) {
|
|
@@ -18,63 +21,68 @@ function c(t) {
|
|
|
18
21
|
function l(t) {
|
|
19
22
|
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "circle", attr: { cx: "12", cy: "12", r: "10" }, child: [] }, { tag: "path", attr: { d: "m9 12 2 2 4-4" }, child: [] }] })(t);
|
|
20
23
|
}
|
|
21
|
-
function
|
|
24
|
+
function u(t) {
|
|
22
25
|
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3" }, child: [] }] })(t);
|
|
23
26
|
}
|
|
24
|
-
function
|
|
27
|
+
function s(t) {
|
|
25
28
|
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "rect", attr: { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2" }, child: [] }, { tag: "path", attr: { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" }, child: [] }] })(t);
|
|
26
29
|
}
|
|
27
|
-
function
|
|
30
|
+
function k(t) {
|
|
28
31
|
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "polyline", attr: { points: "9 10 4 15 9 20" }, child: [] }, { tag: "path", attr: { d: "M20 4v7a4 4 0 0 1-4 4H4" }, child: [] }] })(t);
|
|
29
32
|
}
|
|
30
|
-
function
|
|
33
|
+
function p(t) {
|
|
31
34
|
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "polyline", attr: { points: "15 10 20 15 15 20" }, child: [] }, { tag: "path", attr: { d: "M4 4v7a4 4 0 0 0 4 4h12" }, child: [] }] })(t);
|
|
32
35
|
}
|
|
33
|
-
function
|
|
36
|
+
function L(t) {
|
|
34
37
|
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "circle", attr: { cx: "12", cy: "12", r: "10" }, child: [] }, { tag: "path", attr: { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20" }, child: [] }, { tag: "path", attr: { d: "M2 12h20" }, child: [] }] })(t);
|
|
35
38
|
}
|
|
36
|
-
function
|
|
39
|
+
function g(t) {
|
|
40
|
+
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z" }, child: [] }, { tag: "path", attr: { d: "M21 16v2a4 4 0 0 1-4 4h-5" }, child: [] }] })(t);
|
|
41
|
+
}
|
|
42
|
+
function v(t) {
|
|
37
43
|
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }, child: [] }, { tag: "path", attr: { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" }, child: [] }] })(t);
|
|
38
44
|
}
|
|
39
|
-
function
|
|
45
|
+
function f(t) {
|
|
40
46
|
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M21 12a9 9 0 1 1-6.219-8.56" }, child: [] }] })(t);
|
|
41
47
|
}
|
|
42
|
-
function
|
|
48
|
+
function M(t) {
|
|
43
49
|
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "m17 2 4 4-4 4" }, child: [] }, { tag: "path", attr: { d: "M3 11v-1a4 4 0 0 1 4-4h14" }, child: [] }, { tag: "path", attr: { d: "m7 22-4-4 4-4" }, child: [] }, { tag: "path", attr: { d: "M21 13v1a4 4 0 0 1-4 4H3" }, child: [] }] })(t);
|
|
44
50
|
}
|
|
45
|
-
function
|
|
51
|
+
function C(t) {
|
|
46
52
|
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z" }, child: [] }, { tag: "path", attr: { d: "M20 3v4" }, child: [] }, { tag: "path", attr: { d: "M22 5h-4" }, child: [] }, { tag: "path", attr: { d: "M4 17v2" }, child: [] }, { tag: "path", attr: { d: "M5 18H3" }, child: [] }] })(t);
|
|
47
53
|
}
|
|
48
|
-
function
|
|
54
|
+
function x(t) {
|
|
49
55
|
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M17 14V2" }, child: [] }, { tag: "path", attr: { d: "M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z" }, child: [] }] })(t);
|
|
50
56
|
}
|
|
51
|
-
function
|
|
57
|
+
function w(t) {
|
|
52
58
|
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M7 10v12" }, child: [] }, { tag: "path", attr: { d: "M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z" }, child: [] }] })(t);
|
|
53
59
|
}
|
|
54
|
-
function
|
|
60
|
+
function B(t) {
|
|
55
61
|
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2" }, child: [] }, { tag: "circle", attr: { cx: "12", cy: "7", r: "4" }, child: [] }] })(t);
|
|
56
62
|
}
|
|
57
|
-
function
|
|
63
|
+
function j(t) {
|
|
58
64
|
return r({ attr: { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }, child: [{ tag: "path", attr: { d: "M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2" }, child: [] }, { tag: "circle", attr: { cx: "9", cy: "7", r: "4" }, child: [] }, { tag: "path", attr: { d: "M22 21v-2a4 4 0 0 0-3-3.87" }, child: [] }, { tag: "path", attr: { d: "M16 3.13a4 4 0 0 1 0 7.75" }, child: [] }] })(t);
|
|
59
65
|
}
|
|
60
66
|
export {
|
|
61
67
|
e as LuArrowLeft,
|
|
62
68
|
i as LuArrowUpRight,
|
|
63
69
|
a as LuBookOpen,
|
|
64
|
-
d as
|
|
70
|
+
d as LuCalendar,
|
|
71
|
+
h as LuCheck,
|
|
65
72
|
c as LuChevronDown,
|
|
66
73
|
l as LuCircleCheck,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
f as
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
w as
|
|
79
|
-
|
|
74
|
+
u as LuCommand,
|
|
75
|
+
s as LuCopy,
|
|
76
|
+
k as LuCornerDownLeft,
|
|
77
|
+
p as LuCornerDownRight,
|
|
78
|
+
L as LuGlobe,
|
|
79
|
+
g as LuHeadset,
|
|
80
|
+
v as LuLink,
|
|
81
|
+
f as LuLoaderCircle,
|
|
82
|
+
M as LuRepeat,
|
|
83
|
+
C as LuSparkles,
|
|
84
|
+
x as LuThumbsDown,
|
|
85
|
+
w as LuThumbsUp,
|
|
86
|
+
B as LuUser,
|
|
87
|
+
j as LuUsers
|
|
80
88
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),f=require("./user-provider.cjs"),d=t.createContext(void 0),b=({children:e})=>{const{baseSettings:n,componentType:o}=B.useInkeepConfig(),{apiKey:r,analyticsApiBaseUrl:i,tags:c,privacyPreferences:E,env:g}=n,{userProperties:a}=f.useUser(),v=t.useMemo(()=>({widgetLibraryVersion:"0.5.
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const P=require("react/jsx-runtime"),t=require("react"),y=require("../atoms/api/analytics/events.cjs"),B=require("./config-provider.cjs"),f=require("./user-provider.cjs"),d=t.createContext(void 0),b=({children:e})=>{const{baseSettings:n,componentType:o}=B.useInkeepConfig(),{apiKey:r,analyticsApiBaseUrl:i,tags:c,privacyPreferences:E,env:g}=n,{userProperties:a}=f.useUser(),v=t.useMemo(()=>({widgetLibraryVersion:"0.5.51",componentType:o,tags:c}),[o,c]),u=!E.optOutAllAnalytics&&g!=="development",m={logEvent:t.useCallback(async l=>{const s={...v,...l.properties},p={eventName:l.eventName,properties:s,userProperties:a};if(u){if("conversation"in s&&!s.conversation?.id)return;y.logEvent(p,r,i)}n.onEvent?.(p)},[u,n,r,i,a,v])};return P.jsx(d.Provider,{value:m,children:e})},x=()=>{const e=t.useContext(d);if(!e)throw new Error("useBaseEvents must be used within a BaseEventsProvider");return e};exports.BaseEventsProvider=b;exports.useBaseEvents=x;
|
|
@@ -7,7 +7,7 @@ import { useUser as b } from "./user-provider.js";
|
|
|
7
7
|
const u = x(void 0), U = ({ children: e }) => {
|
|
8
8
|
const { baseSettings: t, componentType: n } = C(), { apiKey: s, analyticsApiBaseUrl: r, tags: i, privacyPreferences: l, env: E } = t, { userProperties: a } = b(), c = g(
|
|
9
9
|
() => ({
|
|
10
|
-
widgetLibraryVersion: "0.5.
|
|
10
|
+
widgetLibraryVersion: "0.5.51",
|
|
11
11
|
componentType: n,
|
|
12
12
|
tags: i
|
|
13
13
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),t=require("react"),j=require("../atoms/api/analytics/conversation.cjs"),w=require("./config-provider.cjs"),B=require("./conversation-provider.cjs"),k=require("./user-provider.cjs"),f=require("./base-events-provider.cjs"),g=t.createContext(void 0),b=({children:e})=>{const{baseSettings:x}=w.useInkeepConfig(),{apiKey:C,analyticsApiBaseUrl:d,tags:E,privacyPreferences:{optOutAllAnalytics:i},env:a}=x,{userProperties:h}=k.useUser(),{logEvent:p}=f.useBaseEvents(),{conversation:c,setConversation:y}=B.useInkeepConversation(),v=t.useRef(c);t.useEffect(()=>{v.current=c},[c]);const u=t.useCallback(async n=>{const s=v.current,r=!i&&a!=="development";let o=Object.assign({},s,{messages:n});if(r){const P=await j.logConversation(s.id,{messages:n,tags:E,userProperties:h},C,d);P&&(o=P)}return o},[d,C,E,h,i,a]),q={logEvent:t.useCallback(async(n,s)=>{let r=v.current;s&&(r=await u(s),y(r));const o={...n,properties:{conversation:r,...n.properties}};p(o)},[p,u,i,a]),logConversation:u};return l.jsx(g.Provider,{value:q,children:e})},A=({children:e})=>l.jsx(f.BaseEventsProvider,{children:l.jsx(b,{children:e})}),O=()=>{const e=t.useContext(g);if(!e)throw new Error("useChatEvents must be used within a ChatEventsProvider");return e};exports.ChatEventsProvider=b;exports.ChatEventsProviderWithBase=A;exports.useChatEvents=O;
|
|
@@ -1,65 +1,63 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { useRef as y, useEffect as w, useCallback as
|
|
2
|
+
import { jsx as u } from "react/jsx-runtime";
|
|
3
|
+
import { useRef as y, useEffect as w, useCallback as h, createContext as b, useContext as B } from "react";
|
|
4
4
|
import { logConversation as k } from "../atoms/api/analytics/conversation.js";
|
|
5
5
|
import { useInkeepConfig as A } from "./config-provider.js";
|
|
6
6
|
import { useInkeepConversation as j } from "./conversation-provider.js";
|
|
7
7
|
import { useUser as I } from "./user-provider.js";
|
|
8
8
|
import { useBaseEvents as O, BaseEventsProvider as U } from "./base-events-provider.js";
|
|
9
|
-
const
|
|
9
|
+
const m = b(void 0), K = ({ children: t }) => {
|
|
10
10
|
const { baseSettings: g } = A(), {
|
|
11
|
-
apiKey:
|
|
12
|
-
analyticsApiBaseUrl:
|
|
13
|
-
tags:
|
|
11
|
+
apiKey: p,
|
|
12
|
+
analyticsApiBaseUrl: l,
|
|
13
|
+
tags: C,
|
|
14
14
|
privacyPreferences: { optOutAllAnalytics: s },
|
|
15
15
|
env: i
|
|
16
|
-
} = g, { userProperties:
|
|
16
|
+
} = g, { userProperties: f } = I(), { logEvent: E } = O(), { conversation: a, setConversation: P } = j(), c = y(a);
|
|
17
17
|
w(() => {
|
|
18
|
-
|
|
19
|
-
}, [
|
|
20
|
-
const
|
|
18
|
+
c.current = a;
|
|
19
|
+
}, [a]);
|
|
20
|
+
const v = h(
|
|
21
21
|
async (e) => {
|
|
22
|
-
const n =
|
|
22
|
+
const n = c.current, o = !s && i !== "development";
|
|
23
23
|
let r = Object.assign({}, n, { messages: e });
|
|
24
|
-
if (
|
|
25
|
-
const
|
|
24
|
+
if (o) {
|
|
25
|
+
const d = await k(
|
|
26
26
|
n.id,
|
|
27
27
|
{
|
|
28
28
|
messages: e,
|
|
29
|
-
tags:
|
|
30
|
-
userProperties:
|
|
29
|
+
tags: C,
|
|
30
|
+
userProperties: f
|
|
31
31
|
},
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
p,
|
|
33
|
+
l
|
|
34
34
|
);
|
|
35
|
-
|
|
35
|
+
d && (r = d);
|
|
36
36
|
}
|
|
37
37
|
return r;
|
|
38
38
|
},
|
|
39
|
-
[
|
|
39
|
+
[l, p, C, f, s, i]
|
|
40
40
|
), x = {
|
|
41
|
-
logEvent:
|
|
41
|
+
logEvent: h(
|
|
42
42
|
async (e, n) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
const c = {
|
|
43
|
+
let o = c.current;
|
|
44
|
+
n && (o = await v(n), P(o));
|
|
45
|
+
const r = {
|
|
48
46
|
...e,
|
|
49
47
|
properties: {
|
|
50
48
|
conversation: o,
|
|
51
49
|
...e.properties
|
|
52
50
|
}
|
|
53
51
|
};
|
|
54
|
-
|
|
52
|
+
E(r);
|
|
55
53
|
},
|
|
56
|
-
[
|
|
54
|
+
[E, v, s, i]
|
|
57
55
|
),
|
|
58
|
-
logConversation:
|
|
56
|
+
logConversation: v
|
|
59
57
|
};
|
|
60
|
-
return /* @__PURE__ */
|
|
61
|
-
}, F = ({ children: t }) => /* @__PURE__ */
|
|
62
|
-
const t = B(
|
|
58
|
+
return /* @__PURE__ */ u(m.Provider, { value: x, children: t });
|
|
59
|
+
}, F = ({ children: t }) => /* @__PURE__ */ u(U, { children: /* @__PURE__ */ u(K, { children: t }) }), G = () => {
|
|
60
|
+
const t = B(m);
|
|
63
61
|
if (!t)
|
|
64
62
|
throw new Error("useChatEvents must be used within a ChatEventsProvider");
|
|
65
63
|
return t;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/cxkit-primitives",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.51",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "Inkeep, Inc. Customer License (IICL) v1.1",
|
|
6
6
|
"homepage": "",
|
|
@@ -59,9 +59,9 @@
|
|
|
59
59
|
"remark-gfm": "^4.0.1",
|
|
60
60
|
"unist-util-visit": "^5.0.0",
|
|
61
61
|
"use-sync-external-store": "^1.4.0",
|
|
62
|
-
"@inkeep/cxkit-color-mode": "0.5.
|
|
63
|
-
"@inkeep/cxkit-theme": "0.5.
|
|
64
|
-
"@inkeep/cxkit-types": "0.5.
|
|
62
|
+
"@inkeep/cxkit-color-mode": "0.5.51",
|
|
63
|
+
"@inkeep/cxkit-theme": "0.5.51",
|
|
64
|
+
"@inkeep/cxkit-types": "0.5.51"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@biomejs/biome": "1.9.4",
|