@pickaxeproject/react 2.6.0 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/cjs/components/EmbedPreview/ChatInput.js +1 -0
  2. package/dist/cjs/components/EmbedPreview/FAB.js +1 -0
  3. package/dist/cjs/components/EmbedPreview/Inline.js +1 -0
  4. package/dist/cjs/components/EmbedPreview/Popup.js +1 -0
  5. package/dist/cjs/components/Pickaxe/Addons/Document/Provider.js +1 -1
  6. package/dist/cjs/components/Pickaxe/Addons/Document/hooks/useDocument.js +1 -1
  7. package/dist/cjs/components/Pickaxe/Chat/History/Message.js +1 -1
  8. package/dist/cjs/components/Pickaxe/Chat/Input.js +1 -1
  9. package/dist/cjs/components/Pickaxe/Form/Questions/Document.js +1 -1
  10. package/dist/cjs/components/Pickaxe/Form/Questions/Submit.js +1 -1
  11. package/dist/cjs/components/Pickaxe/Provider.js +1 -1
  12. package/dist/cjs/components/Pickaxe/common/PickaxeButton.js +1 -1
  13. package/dist/cjs/components/Pickaxe/common/PickaxeHead.js +1 -1
  14. package/dist/cjs/components/Pickaxe/common/PickaxeUpgradeCard.js +1 -1
  15. package/dist/cjs/components/Pickaxe/index.js +1 -1
  16. package/dist/cjs/embed/index.js +1 -0
  17. package/dist/cjs/hooks/pickaxe/useSubmit.js +1 -1
  18. package/dist/cjs/hooks/pickaxe/useSubmitDocument.js +1 -1
  19. package/dist/cjs/index.js +1 -1
  20. package/dist/cjs/src/components/EmbedPreview/ChatInput.d.ts +1 -1
  21. package/dist/cjs/src/components/EmbedPreview/FAB.d.ts +1 -1
  22. package/dist/cjs/src/components/EmbedPreview/Inline.d.ts +1 -1
  23. package/dist/cjs/src/components/EmbedPreview/Popup.d.ts +1 -1
  24. package/dist/cjs/src/components/Pickaxe/Addons/Document/Provider.d.ts +2 -1
  25. package/dist/cjs/src/components/Pickaxe/Addons/Document/hooks/useDocument.d.ts +3 -3
  26. package/dist/cjs/src/components/Pickaxe/Addons/Document/hooks/useDocumentContext.d.ts +2 -1
  27. package/dist/cjs/src/components/Pickaxe/Provider.d.ts +2 -0
  28. package/dist/cjs/src/components/Pickaxe/common/PickaxeButton.d.ts +1 -1
  29. package/dist/cjs/src/embed.d.ts +5 -0
  30. package/dist/cjs/src/hooks/pickaxe/usePickaxeContext.d.ts +2 -0
  31. package/dist/cjs/src/hooks/pickaxe/useSubmit.d.ts +1 -1
  32. package/dist/cjs/src/hooks/pickaxe/useSubmitDocument.d.ts +2 -1
  33. package/dist/cjs/src/index.d.ts +4 -0
  34. package/dist/esm/components/EmbedPreview/ChatInput.js +1 -0
  35. package/dist/esm/components/EmbedPreview/FAB.js +1 -0
  36. package/dist/esm/components/EmbedPreview/Inline.js +1 -0
  37. package/dist/esm/components/EmbedPreview/Popup.js +1 -0
  38. package/dist/esm/components/Pickaxe/Addons/Document/Provider.js +1 -1
  39. package/dist/esm/components/Pickaxe/Addons/Document/hooks/useDocument.js +1 -1
  40. package/dist/esm/components/Pickaxe/Chat/History/Message.js +1 -1
  41. package/dist/esm/components/Pickaxe/Chat/Input.js +1 -1
  42. package/dist/esm/components/Pickaxe/Form/Questions/Document.js +1 -1
  43. package/dist/esm/components/Pickaxe/Form/Questions/Submit.js +1 -1
  44. package/dist/esm/components/Pickaxe/Provider.js +1 -1
  45. package/dist/esm/components/Pickaxe/common/PickaxeButton.js +1 -1
  46. package/dist/esm/components/Pickaxe/common/PickaxeHead.js +1 -1
  47. package/dist/esm/components/Pickaxe/common/PickaxeUpgradeCard.js +1 -1
  48. package/dist/esm/components/Pickaxe/index.js +1 -1
  49. package/dist/esm/embed/index.js +1 -0
  50. package/dist/esm/hooks/pickaxe/useSubmit.js +1 -1
  51. package/dist/esm/hooks/pickaxe/useSubmitDocument.js +1 -1
  52. package/dist/esm/index.js +1 -1
  53. package/dist/esm/src/components/EmbedPreview/ChatInput.d.ts +1 -1
  54. package/dist/esm/src/components/EmbedPreview/FAB.d.ts +1 -1
  55. package/dist/esm/src/components/EmbedPreview/Inline.d.ts +1 -1
  56. package/dist/esm/src/components/EmbedPreview/Popup.d.ts +1 -1
  57. package/dist/esm/src/components/Pickaxe/Addons/Document/Provider.d.ts +2 -1
  58. package/dist/esm/src/components/Pickaxe/Addons/Document/hooks/useDocument.d.ts +3 -3
  59. package/dist/esm/src/components/Pickaxe/Addons/Document/hooks/useDocumentContext.d.ts +2 -1
  60. package/dist/esm/src/components/Pickaxe/Provider.d.ts +2 -0
  61. package/dist/esm/src/components/Pickaxe/common/PickaxeButton.d.ts +1 -1
  62. package/dist/esm/src/embed.d.ts +5 -0
  63. package/dist/esm/src/hooks/pickaxe/usePickaxeContext.d.ts +2 -0
  64. package/dist/esm/src/hooks/pickaxe/useSubmit.d.ts +1 -1
  65. package/dist/esm/src/hooks/pickaxe/useSubmitDocument.d.ts +2 -1
  66. package/dist/esm/src/index.d.ts +4 -0
  67. package/package.json +8 -1
@@ -0,0 +1 @@
1
+ import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as i}from"react/jsx-runtime";import{useState as t}from"react";import{usePickaxeContext as n}from"../../hooks/pickaxe/usePickaxeContext.js";import{useInstantPickaxe as s}from"../../hooks/pickaxe/usePickaxe.js";import{useStyleFontSize as l}from"../../hooks/studio/useStyleFontSize.js";import{QueryClient as a,QueryClientProvider as r}from"@tanstack/react-query";import{Pickaxe as d}from"../Pickaxe/index.js";import{PickaxeProvider as m}from"../Pickaxe/Provider.js";import c from"../Icons/x.svg.js";import p from"../Core/Modal/index.js";import u from"../Core/Modal/Body.js";import h from"../../common/cn.js";const f=new a({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),v=n=>{var s,l,a,v,b,y,g,j,O,{formId:w,className:k}=n,D=e(n,["formId","className"]);const[N,R]=t(!1);return o(r,Object.assign({client:f},{children:i(m,Object.assign({},D,{deploymentType:"popup",isEmbed:!0},{children:[o(x,{formId:w,setIsOpen:R}),o(p,Object.assign({isOpen:N,onChange:()=>R(!1)},{children:i(u,Object.assign({className:h("relative bg-transparent overflow-hidden",D.isDropShadow&&"shadow-embed"),style:{borderRadius:(null!==(l=null===(s=D.styles)||void 0===s?void 0:s.cornerRadius)&&void 0!==l?l:0)+"px"}},{children:[o("div",Object.assign({className:"overflow-auto scrollbar scrollbar-thin",style:Object.assign(Object.assign({borderRadius:(null!==(v=null===(a=D.styles)||void 0===a?void 0:a.cornerRadius)&&void 0!==v?v:0)+"px"},"px"===(null===(b=D.deploymentDimensions)||void 0===b?void 0:b.width.unit)?{width:D.deploymentDimensions.width.value+D.deploymentDimensions.width.unit}:"%"===(null===(y=D.deploymentDimensions)||void 0===y?void 0:y.width.unit)?{width:Math.floor(D.deploymentDimensions.maxWidth*(D.deploymentDimensions.width.value/100))}:{}),"px"===(null===(g=D.deploymentDimensions)||void 0===g?void 0:g.height.unit)?{height:D.deploymentDimensions.height.value+"px"}:"auto"===(null===(j=D.deploymentDimensions)||void 0===j?void 0:j.height.unit)?{height:D.deploymentDimensions.minHeight+"px",maxHeight:D.deploymentDimensions.maxHeight+"px"}:{})},{children:o(d,Object.assign({formId:w},k&&{className:k}))})),o("button",Object.assign({className:"absolute z-10 outline-none hover:opacity-70 hover:duration-300 active:opacity-100",onClick:()=>R(!1),style:{right:12,top:12,color:(null===(O=D.colors)||void 0===O?void 0:O.text)||"#000"}},{children:o(c,{className:"h-5 w-5 shrink-0"})}))]}))}))]}))}))},x=({formId:e,setIsOpen:i})=>{var t;const{colors:a,styles:r,deploymentDimensions:d,deploymentMisc:m}=n(),c=l(),p=s(e);return p.isLoading?null:o("button",Object.assign({style:Object.assign(Object.assign(Object.assign({},"Real Head Pro"!==r.font&&{fontFamily:r.font}),{color:a.accentText,backgroundColor:a.accent,borderRadius:r.cornerRadius+"px",borderWidth:r.outlineThickness+"px",maxWidth:"%"===(null==d?void 0:d.width.unit)?(null==d?void 0:d.maxWidth)+"px":(null==d?void 0:d.width.value)+"px",minHeight:48}),"Real Head Pro"!==r.font&&{fontFamily:r.font}),className:h(c.b2,"flex w-max min-w-[130px] select-none items-center font-semibold justify-center gap-x-3 px-4 hover:duration-300 focus:outline focus:outline-black/30 active:opacity-90 disabled:cursor-not-allowed dark:focus:outline-white/30"),onClick:()=>i(!0)},{children:o("p",Object.assign({className:h(c.b2,"font-semibold"),style:Object.assign({color:a.accentText},"Real Head Pro"!==r.font&&{fontFamily:r.font})},{children:(null==m?void 0:m.popupText)||(null===(t=p.data)||void 0===t?void 0:t.formtitle)||"Open Tool"}))}))};export{v as Popup,x as PopupCTAButton};
@@ -1 +1 @@
1
- import{jsx as t}from"react/jsx-runtime";import{useState as e,createContext as s}from"react";const n=s({}),o=({children:s})=>{const[o,i]=e([]),[c,r]=e(""),[d,m]=e(""),[a,u]=e(!1),[g,b]=e(!1);return t(n.Provider,Object.assign({value:{documents:o,documentCount:o.length,documentError:c,websiteLink:d,isUploading:a,isShowList:g,editDocument:t=>{const e=o.map((e=>e.id===t.id?Object.assign(Object.assign({},e),t):e));i(e)},editDocumentByDocId:t=>{const e=o.map((e=>e.documentId===t.documentId?Object.assign(Object.assign({},e),t):e));i(e)},setDocuments:i,setDocumentError:r,setWebsiteLink:m,setIsUploading:u,setIsShowList:b}},{children:s}))};export{n as DocumentContext,o as default};
1
+ import{jsx as e}from"react/jsx-runtime";import{useState as t,createContext as o}from"react";const s=o({}),i=({children:o})=>{const[i,n]=t([]),[r,c]=t(""),[d,m]=t(""),[u,a]=t(!1),[l,g]=t(!1);return e(s.Provider,Object.assign({value:{documents:i,documentCount:i.length,documentError:r,websiteLink:d,isUploading:u,isShowList:l,editDocument:e=>{n((t=>t.map((t=>t.id===e.id?Object.assign(Object.assign({},t),e):t))))},setDocuments:n,addDocument:e=>{n((t=>[...t,e]))},removeDocument:e=>{console.log(e),n((t=>t.filter((t=>t.id!==e))))},setDocumentError:c,setWebsiteLink:m,setIsUploading:a,setIsShowList:g}},{children:o}))};export{s as DocumentContext,i as default};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../../../_virtual/_tslib.js";import{useMemo as t}from"react";import{usePickaxeContext as o}from"../../../../../hooks/pickaxe/usePickaxeContext.js";import{useSubmitDocument as s}from"../../../../../hooks/pickaxe/useSubmitDocument.js";import{useDocumentContext as n}from"./useDocumentContext.js";import{allowedFileMimeTypes as i,allowedImageMimeTypes as r}from"../../../../../common/documents.js";import a from"../../../../../common/error.js";const d=["gpt-4o","gpt-4o-mini","gpt-4.1","gpt-4.1-mini","gpt-4.1-nano","o1"],u=({onQuestionChange:u}={})=>{const{formId:m,chatId:l,pickaxe:c}=o(),p=n(),f=s(),g=t((()=>{var e;return d.includes(null!==(e=null==c?void 0:c.model)&&void 0!==e?e:"gpt-3.5-turbo")}),[c]);return Object.assign(Object.assign({},p),{isImageUploadAllowed:g,onFileUpload:t=>e(void 0,void 0,void 0,(function*(){if(p.setDocumentError(""),!t.length)return null;const e=t[0];try{const o=[...i,...g?r:[]],s=t.some((e=>!o.includes(e.type)));if(s){throw new Error(g?"You can only upload PDF, TXT, DOCX, CSV, XLSX, JSON, PPTX, PNG, JPEG, WEBP, or GIF files. Please try again.":"You can only upload PDF, TXT, DOCX, CSV, XLSX, JSON, or PPTX files. Please try again.")}p.setIsUploading(!0),p.setIsShowList(!0),p.setDocuments([{type:"document",id:e.name,size:e.size,name:e.name,status:"uploading"}]);const n=yield f.document({formId:m,responseId:l,file:e}),{success:a,documentId:d,error:c}=n;if(!a)throw new Error(null!=c?c:"Document processing failed, please try again.");null==u||u({input:e.name,documentId:d});const h=d.startsWith("IMAGE-")?"image":"document";p.setDocuments([{type:h,id:e.name,size:e.size,name:e.name,status:"finished",documentId:d}]);return{type:h,size:e.size,id:e.name,name:e.name,status:"finished",documentId:d}}catch(t){const o=a(t);if(console.log("[onFileUpload] Error",o),o.includes("You can only upload"))return p.setDocumentError(o),null;p.editDocument({type:"document",id:e.name,name:e.name,size:e.size,status:"failed",error:o});return{type:"document",size:e.size,id:e.name,name:e.name,status:"failed",error:o}}finally{p.setIsUploading(!1)}})),onWebsiteUpload:t=>e(void 0,void 0,void 0,(function*(){p.setDocumentError("");let e=t.trim();if(!e)return null;e.startsWith("http://")&&(e=e.replace("http://","https://")),e.startsWith("https://")||(e=`https://${e}`);try{if(!e.includes("."))throw new Error("Please paste a valid website URL or Youtube video link to add to the knowledge base.");p.setIsUploading(!0),p.setIsShowList(!0),p.setWebsiteLink(""),p.setDocuments([{type:"website",id:e,size:0,name:e,status:"uploading"}]);const t=yield f.website({formId:m,responseId:l,website:e}),{success:o,documentId:s}=t;if(!o)throw new Error("Website processing failed, please try again.");p.setDocuments([{type:"website",id:e,size:0,name:e,status:"finished",documentId:s}]);return{type:"website",id:e,name:e,size:0,status:"finished",documentId:s}}catch(t){const o=a(t);if(console.log("[onWebsiteUpload] Error",o),o.includes("Please paste a valid website URL"))return p.setDocumentError(o),null;p.editDocument({type:"website",id:e,size:0,name:e,status:"failed",error:o});return{type:"website",id:e,size:0,name:e,status:"failed",error:o}}finally{p.setIsUploading(!1)}})),onEditDocumentByDocId:p.editDocumentByDocId})};export{u as useDocument};
1
+ import{__awaiter as e}from"../../../../../_virtual/_tslib.js";import{useMemo as t}from"react";import{usePickaxeContext as o}from"../../../../../hooks/pickaxe/usePickaxeContext.js";import{useSubmitDocument as s}from"../../../../../hooks/pickaxe/useSubmitDocument.js";import{useDocumentContext as i}from"./useDocumentContext.js";import{allowedFileMimeTypes as n,allowedImageMimeTypes as r}from"../../../../../common/documents.js";import d from"../../../../../common/error.js";import{v4 as a}from"uuid";const u=["gpt-4o","gpt-4o-mini","gpt-4.1","gpt-4.1-mini","gpt-4.1-nano","o1"],l=({onQuestionChange:l}={})=>{const{formId:m,chatId:c,sessionId:p,pickaxe:f}=o(),g=i(),h=s(),I=t((()=>{var e;return u.includes(null!==(e=null==f?void 0:f.model)&&void 0!==e?e:"gpt-3.5-turbo")}),[f]),w=e=>{const t=[...n,...I?r:[]];if(e.some((e=>!t.includes(e.type)))){const e=new Error(I?"You can only upload PDF, TXT, DOCX, CSV, XLSX, JSON, PPTX, PNG, JPEG, WEBP, or GIF files. Please try again.":"You can only upload PDF, TXT, DOCX, CSV, XLSX, JSON, or PPTX files. Please try again."),t=d(e);return g.setDocumentError(t),!0}return!1};return Object.assign(Object.assign({},g),{isImageUploadAllowed:I,onFileUpload:t=>e(void 0,void 0,void 0,(function*(){if(g.setDocumentError(""),!t.length)return null;if(w(t))return null;g.setIsUploading(!0),g.setIsShowList(!0);const o=t.map((e=>({file:e,id:a()})));o.forEach((({file:e,id:t})=>{g.addDocument({type:"document",id:t,size:e.size,name:e.name,status:"uploading"})}));const s=o.map((({file:t,id:o})=>e(void 0,void 0,void 0,(function*(){try{const{success:e,documentId:s,error:i}=yield h.document({formId:m,responseId:c,file:t,sessionId:p});if(!e)throw new Error(null!=i?i:"Document processing failed");null==l||l({input:t.name,documentId:s});const n=s.startsWith("IMAGE-");return g.editDocument({id:o,type:n?"image":"document",name:t.name,size:t.size,status:"finished",documentId:s}),{name:t.name,documentId:s}}catch(e){const s=d(e);return g.editDocument({id:o,name:t.name,size:t.size,status:"failed",error:s}),{error:s}}})))),i=yield Promise.allSettled(s),n=new Set;for(const e of i)"fulfilled"===e.status&&"error"in e.value&&n.add(e.value.error);n.size>0&&g.setDocumentError([...n].join(", ")),g.setIsUploading(!1)})),onWebsiteUpload:t=>e(void 0,void 0,void 0,(function*(){g.setDocumentError("");let e=t.trim();if(!e)return null;e.startsWith("http://")&&(e=e.replace("http://","https://")),e.startsWith("https://")||(e=`https://${e}`);try{if(!e.includes("."))throw new Error("Please paste a valid website URL or Youtube video link to add to the knowledge base.");g.setIsUploading(!0),g.setIsShowList(!0),g.setWebsiteLink(""),g.setDocuments([{type:"website",id:e,size:0,name:e,status:"uploading"}]);const t=yield h.website({formId:m,responseId:c,website:e}),{success:o,documentId:s}=t;if(!o)throw new Error("Website processing failed, please try again.");g.setDocuments([{type:"website",id:e,size:0,name:e,status:"finished",documentId:s}]);return{type:"website",id:e,name:e,size:0,status:"finished",documentId:s}}catch(t){const o=d(t);if(console.log("[onWebsiteUpload] Error",o),o.includes("Please paste a valid website URL"))return g.setDocumentError(o),null;g.editDocument({type:"website",id:e,size:0,name:e,status:"failed",error:o});return{type:"website",id:e,size:0,name:e,status:"failed",error:o}}finally{g.setIsUploading(!1)}}))})};export{l as useDocument};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as s}from"react/jsx-runtime";import{Fragment as t}from"react";import{usePickaxeContext as i}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as a}from"../../../../hooks/studio/useStyleFontSize.js";import{PickaxeMarkdown as o}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as c}from"../../common/PickaxeMarkdown/Renderer.js";import l from"../../common/PickaxeIcon.js";import n from"./Document.js";import r from"../../common/PickaxeCopyButton.js";import m from"../../../../common/cn.js";const d=({index:d,message:x,isIntroExpand:p})=>{var h,u;const{formId:f,pickaxe:b,styles:g,colors:j,misc:v,responsiveBy:w,disableHtml:k,disableJs:y,disableCss:N,isNewChat:O,isRtl:C}=i(),I=a(),R=null!==(h=null==b?void 0:b.chaticon)&&void 0!==h?h:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${f}.png`;return"assistant"===x.role?e("div",Object.assign({className:m("flex w-full",C?"justify-end":"justify-start")},{children:e("div",Object.assign({className:m("flex flex-col",0===d&&O&&"viewport"===w&&"min-[767px]:max-w-[80%]",0===d&&O&&"container"===w&&"@[767px]/pickaxe-root:max-w-[80%]")},{children:s("div",Object.assign({className:m("flex gap-x-3",C&&"flex-row-reverse")},{children:[v.isChatImage&&"NONE"!==R&&e(l,{src:R,alt:"Assistant",width:24,height:24,className:"my-3 h-6 w-6",textColor:j.text}),s("div",Object.assign({className:m("flex flex-col",C?"items-end":"items-start")},{children:[e("div",Object.assign({className:m(I.b2,"chat-message pt-3",C?"text-right":"text-left")},{children:e(o,Object.assign({theme:g.theme,accentColor:j.accent,actions:!0},C&&{rtl:!0},k&&{disableHtml:!0},y&&{disableJs:!0},N&&{disableCss:!0},{children:e(c,Object.assign({value:x.content},0===d&&O&&x.content.length>470&&3===(null!==(u=null==b?void 0:b.icebreakers)&&void 0!==u?u:[]).length&&!x.content.includes("https://utils.pickaxe.co/api/fn")&&{maxLines:p?void 0:12}))}))})),e("div",Object.assign({className:"mt-4 flex gap-3"},{children:e(r,{color:j.accent,text:x.content})}))]}))]}))}))})):"user"===x.role?e("div",Object.assign({className:m("flex w-full",C?"justify-start":"justify-end")},{children:e("div",Object.assign({className:m("flex gap-x-3 max-w-[80%]",C?"pr-9":"pl-9","viewport"===w?C?"min-[767px]:pr-0":"min-[767px]:pl-0":C?"@[767px]/pickaxe-root:pr-0":"@[767px]/pickaxe-root:pl-0")},{children:s("div",Object.assign({className:m(I.b2,"overflow-x-auto overflow-y-hidden px-4 py-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B] flex flex-col gap-y-3",C?"text-right":"text-left"),style:{backgroundColor:j.secondary+"80",color:j.secondaryText,borderRadius:g.cornerRadius}},{children:[x.documentIds&&x.documentIds.length>0&&e("div",Object.assign({className:m("flex flex-col",C?"items-start":"items-end")},{children:x.documentIds.map((s=>e(t,{children:s.startsWith("IMAGE-")?e("div",Object.assign({className:"max-w-[300px]"},{children:e("img",{style:{borderRadius:g.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${s.split("-")[2]}/${s.split("-")[1]}.${null==s?void 0:s.split("-")[2]}`,alt:""})})):e(n,{documentId:s})},s)))})),e(o,Object.assign({theme:g.theme,accentColor:j.accent},C&&{rtl:!0},k&&{disableHtml:!0},y&&{disableJs:!0},N&&{disableCss:!0},{children:e(c,{value:x.content})}))]}))}))})):e("div",{})};export{d as default};
1
+ import{jsx as e,jsxs as s}from"react/jsx-runtime";import{Fragment as t}from"react";import{usePickaxeContext as a}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as i}from"../../../../hooks/studio/useStyleFontSize.js";import{PickaxeMarkdown as o}from"../../common/PickaxeMarkdown/index.js";import{PickaxeMarkdownRenderer as c}from"../../common/PickaxeMarkdown/Renderer.js";import l from"../../common/PickaxeIcon.js";import n from"./Document.js";import r from"../../common/PickaxeCopyButton.js";import m from"../../../../common/cn.js";const d=({index:d,message:x,isIntroExpand:p})=>{var h,u;const{formId:f,pickaxe:b,styles:g,colors:j,misc:v,responsiveBy:w,disableHtml:k,disableJs:y,disableCss:N,isNewChat:O,isRtl:C}=a(),I=i(),R=null!==(h=null==b?void 0:b.chaticon)&&void 0!==h?h:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${f}.png`;return"assistant"===x.role?e("div",Object.assign({className:m("flex w-full",C?"justify-end":"justify-start")},{children:e("div",Object.assign({className:m("flex flex-col",0===d&&O&&"viewport"===w&&"min-[767px]:max-w-[80%]",0===d&&O&&"container"===w&&"@[767px]/pickaxe-root:max-w-[80%]")},{children:s("div",Object.assign({className:m("flex gap-x-3",C&&"flex-row-reverse")},{children:[v.isChatImage&&"NONE"!==R&&e(l,{src:R,alt:"Assistant",width:24,height:24,className:"my-3 h-6 w-6",textColor:j.text}),s("div",Object.assign({className:m("flex flex-col",C?"items-end":"items-start")},{children:[e("div",Object.assign({className:m(I.b2,"chat-message pt-3",C?"text-right":"text-left")},{children:e(o,Object.assign({theme:g.theme,accentColor:j.accent,actions:!0},C&&{rtl:!0},k&&{disableHtml:!0},y&&{disableJs:!0},N&&{disableCss:!0},{children:e(c,Object.assign({value:x.content},0===d&&O&&x.content.length>470&&3===(null!==(u=null==b?void 0:b.icebreakers)&&void 0!==u?u:[]).length&&!x.content.includes("https://utils.pickaxe.co/api/fn")&&{maxLines:p?void 0:12}))}))})),e("div",Object.assign({className:"mt-4 flex gap-3"},{children:e(r,{color:j.accent,text:x.content})}))]}))]}))}))})):"user"===x.role?e("div",Object.assign({className:m("flex w-full",C?"justify-start":"justify-end")},{children:e("div",Object.assign({className:m("flex gap-x-3 max-w-[80%]",C?"pr-9":"pl-9","viewport"===w?C?"min-[767px]:pr-0":"min-[767px]:pl-0":C?"@[767px]/pickaxe-root:pr-0":"@[767px]/pickaxe-root:pl-0")},{children:s("div",Object.assign({className:m(I.b2,"overflow-x-auto overflow-y-hidden px-4 py-3 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B] flex flex-col gap-y-3",C?"text-right":"text-left"),style:{backgroundColor:j.secondary+"80",color:j.secondaryText,borderRadius:g.cornerRadius}},{children:[x.documentIds&&x.documentIds.length>0&&e("div",Object.assign({className:m("flex flex-col gap-y-2",C?"items-start":"items-end")},{children:x.documentIds.map((s=>e(t,{children:s.startsWith("IMAGE-")?e("div",Object.assign({className:"max-w-[300px]"},{children:e("img",{style:{borderRadius:g.cornerRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${s.split("-")[2]}/${s.split("-")[1]}.${null==s?void 0:s.split("-")[2]}`,alt:""})})):e(n,{documentId:s})},s)))})),e(o,Object.assign({theme:g.theme,accentColor:j.accent},C&&{rtl:!0},k&&{disableHtml:!0},y&&{disableJs:!0},N&&{disableCss:!0},{children:e(c,{value:x.content})}))]}))}))})):e("div",{})};export{d as default};
@@ -1 +1 @@
1
- import{__rest as e,__awaiter as t}from"../../../_virtual/_tslib.js";import{jsx as s,jsxs as o}from"react/jsx-runtime";import{useState as r,useRef as i,useMemo as n,useEffect as l,Fragment as a}from"react";import{usePickaxeContext as c}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as d}from"../../../hooks/pickaxe/useResponseContext.js";import{useStyleInput as u}from"../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as m}from"../../../hooks/studio/useStyleFontSize.js";import{useConversation as p}from"../../../hooks/pickaxe/useConversation.js";import{useSubmit as f}from"../../../hooks/pickaxe/useSubmit.js";import{useDocument as h}from"../Addons/Document/hooks/useDocument.js";import{useScroll as g}from"../Addons/Scroll/hooks/useScroll.js";import{useHover as b}from"../../../hooks/core/useHover.js";import{formatBytes as v}from"../../../common/utils.js";import{allowedFileMimeTypes as x,allowedImageMimeTypes as y}from"../../../common/documents.js";import{createParser as j}from"eventsource-parser";import k from"../../Icons/attach-vertical.svg.js";import w from"../../Icons/spinner-lines.svg.js";import N from"../../Icons/file.svg.js";import I from"../../Icons/x.svg.js";import O from"../../Icons/arrow-right.svg.js";import C from"../Addons/IceBreaker/index.js";import S from"../../Core/Textarea.js";import R from"../../../common/error.js";import T from"../../../common/cn.js";const A=({isFocused:A,onFocus:U,onBlur:B})=>{var D;const{formId:F,chatId:E,userId:H,studioUserId:z,embedUserId:L,deploymentId:$,deploymentType:G,pickaxe:J,styles:K,colors:P,responsiveBy:W,isNewChat:_,isRtl:M,setIsNewChat:q,setIsShowIceBreaker:Q,onGenerateComplete:V}=c(),{messages:X,status:Y,limits:Z,isGenerating:ee,setMessages:te,setStatus:se,setLimitData:oe,setError:re}=d(),{documents:ie,isUploading:ne,isImageUploadAllowed:le,setDocuments:ae,onFileUpload:ce}=h(),{scrollStartSession:de,scrollEndSession:ue,scrollToBottom:me}=g({auto:!0}),pe=p(),fe=f(),[he,ge]=r(""),be=i(null),ve=b(),{isHover:xe}=ve,ye=e(ve,["isHover"]),je=b(),{isHover:ke}=je,we=e(je,["isHover"]),Ne=m(),Ie=u(),Oe=n((()=>{var e,t,s;return!!_&&(!!J&&(!pe.isLoading&&(!((null!==(t=null===(e=pe.data)||void 0===e?void 0:e.messages.length)&&void 0!==t?t:0)>1)&&!!(null===(s=J.icebreakers)||void 0===s?void 0:s.length))))}),[J,_,pe.data,pe.isLoading]),Ce=e=>t(void 0,void 0,void 0,(function*(){try{if("idle"!==Y||ne)return;const t=null!=e?e:he;if(!t)return;re(""),oe(null),ge(""),q(!1),se("fetching"),de(),me();const s=ie.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),o=s.length?s[s.length-1].documentId:"",r="enduserupload"===(null==J?void 0:J.documentuploadtype)&&o,i=[...Array.from(X),Object.assign({id:X.length+1,role:"user",content:t},r&&{documentIds:[o]})];te(i),me(),r&&ae([]);const n=(yield fe.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:F,responseId:E,value:t},r&&{documentId:o}),H&&{userId:H}),z&&{studioUserId:z}),L&&{embedUserId:L}),$&&{deploymentId:$}))).body;if(!n)throw new Error("Streaming error");const l=i.length,a=new TextDecoder,c=n.getReader();let d="",u=!0,m=!1;const p=j({onEvent:e=>{if("delta"===e.event){const t=JSON.parse(e.data).token.replace(/\u200B/g,"");d+=t,te([...i.slice(0,l),{id:X.length+1,role:"assistant",content:d}])}else if("error"===e.event){const t=JSON.parse(e.data);re(t.error||"Something went wrong, please try again.")}else"stop"===e.event&&(u=!1)}});for(;u;){const{value:e,done:t}=yield c.read();if(t){u=!1;break}const s=a.decode(e);s&&(m||(se("streaming"),m=!0),p.feed(s))}null==V||V(E)}catch(e){let t=R(e)||"";t&&!t.includes("Unexpected token 'A',")||(t="Oops! We're experiencing high traffic at the moment. Please try again later.");const s=Object.entries(Z).find((([e])=>t.includes(e)));s?oe(s[1]):re(t)}finally{me(),se("idle"),ue()}}));return l((()=>{Q(Oe)}),[Oe]),s("div",Object.assign({className:T("w-full flex flex-col items-center absolute bottom-0 left-0 z-1",!("chat-input"===G&&_)&&"px-4 pb-4"),dir:M?"rtl":"ltr"},{children:o("div",Object.assign({className:"relative flex flex-col max-w-[800px] w-full"},{children:[!("chat-input"===G&&_)&&s("div",Object.assign({className:T("absolute bottom-full",M?"left-0":"right-0")},{children:s("div",Object.assign({className:T("flex flex-col gap-2 pb-4 px-2",M?"justify-start":"justify-end","viewport"===W?M?"min-[767px]:items-start":"min-[767px]:items-end":M?"@[767px]/pickaxe-root:items-start":"@[767px]/pickaxe-root:items-end")},{children:Oe&&!A&&s(C,{data:(null==J?void 0:J.icebreakers)||[],onSend:Ce})}))})),o("div",Object.assign({className:T("flex flex-col gap-y-2 px-4 py-3","block"===K.formFieldStyle&&"shadow"),style:Ie},{children:["idle"===Y&&ie.length>0&&s("div",Object.assign({className:T("grid grid-cols-1","viewport"===W?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:ie.map((e=>{var t,r,i;return s(a,{children:"document"===e.type?o("div",Object.assign({className:T("relative gap-x-[10px] flex items-center px-2 h-[56px] border",M&&"flex-row-reverse"),style:{borderRadius:Ie.borderRadius,borderColor:P.secondaryText+"50"}},{children:[s("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:P.accent,borderRadius:Ie.borderRadius}},{children:ne?s(w,{className:"w-5 h-5 animate-spin",style:{color:P.accentText}}):s(N,{className:"w-5 h-5",style:{color:P.accentText}})})),o("div",Object.assign({className:T("flex flex-col justify-center truncate",M?"text-right items-end":"text-left items-start")},{children:[s("p",Object.assign({className:(T(Ne.b3),"font-medium truncate")},{children:e.name})),s("p",Object.assign({className:T(Ne.b4,"opacity-80 truncate")},{children:v(e.size)}))]})),s("button",Object.assign({type:"button",className:T("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",M?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:P.accent,borderColor:Ie.backgroundColor},disabled:ne||"idle"!==Y,onClick:()=>ae([])},{children:s(I,{className:"w-4 h-4",style:{color:P.accentText}})}))]})):"image"===e.type?o("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:Ie.borderRadius}},{children:["finished"===e.status?s("img",{style:{borderRadius:Ie.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(t=e.documentId)||void 0===t?void 0:t.split("-")[2]}/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[1]}.${null===(i=e.documentId)||void 0===i?void 0:i.split("-")[2]}`,alt:""}):s("div",{className:"h-full w-full animate-pulse",style:{borderRadius:Ie.borderRadius,backgroundColor:P.secondary}}),s("button",Object.assign({type:"button",className:T("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",M?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:P.accent,borderColor:Ie.backgroundColor},disabled:ne||"idle"!==Y,onClick:()=>ae([])},{children:s(I,{className:"w-4 h-4",style:{color:P.accentText}})}))]})):null},e.id)}))})),o("div",Object.assign({className:T("flex items-end gap-x-2",M&&"flex-row-reverse")},{children:[s(S,Object.assign({className:T(Ne.i1,"max-h-60 min-h-[27px] w-full border-transparent bg-transparent",!he.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap",M?"text-right":"text-left"),value:he,placeholder:M?"بماذا تريد أن تتحدث؟":null!==(D=null==J?void 0:J.placeholdertext)&&void 0!==D?D:"What do you want to talk about?",onChange:e=>ge(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),ne||"idle"!==Y||Ce()))}},U&&{onFocus:U},B&&{onBlur:B},{dir:M?"rtl":"ltr"})),o("div",Object.assign({className:T("flex items-center gap-x-2")},{children:["enduserupload"===(null==J?void 0:J.documentuploadtype)&&o("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 ease-in-out",style:{backgroundColor:ke?P.accent+"10":void 0},disabled:ne||"idle"!==Y,onClick:()=>{var e;return null===(e=be.current)||void 0===e?void 0:e.click()}},we,{children:[s("input",{id:"file-upload",ref:be,type:"file",accept:[...x,...le?y:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:e=>t(void 0,void 0,void 0,(function*(){q(!1),yield ce(Array.from(e.target.files||[])),e.target.value=""}))}),s(k,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:ke?P.accent:P.accent+"80"}})]})),s("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full duration-200 transition-colors ease-in-out",style:{backgroundColor:(xe||he.length||ie.length&&ie.every((e=>"finished"===e.status)))&&!ee?P.accent:P.accent+"10"},disabled:ne||"idle"!==Y,onClick:()=>Ce()},ye,{children:s(O,{className:T("h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",M&&"transform scale-x-[-1]"),style:{color:(xe||he.length||ie.length&&ie.every((e=>"finished"===e.status)))&&!ee?P.accentText:P.accent+"80"}})}))]}))]}))]}))]}))}))};export{A as default};
1
+ import{__rest as e,__awaiter as t}from"../../../_virtual/_tslib.js";import{jsx as s,jsxs as o}from"react/jsx-runtime";import{useState as r,useRef as i,useMemo as n,useEffect as l,Fragment as a}from"react";import{usePickaxeContext as c}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as d}from"../../../hooks/pickaxe/useResponseContext.js";import{useStyleInput as u}from"../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as m}from"../../../hooks/studio/useStyleFontSize.js";import{useConversation as p}from"../../../hooks/pickaxe/useConversation.js";import{useSubmit as f}from"../../../hooks/pickaxe/useSubmit.js";import{useDocument as h}from"../Addons/Document/hooks/useDocument.js";import{useScroll as g}from"../Addons/Scroll/hooks/useScroll.js";import{useHover as b}from"../../../hooks/core/useHover.js";import{formatBytes as v}from"../../../common/utils.js";import{allowedFileMimeTypes as x,allowedImageMimeTypes as y}from"../../../common/documents.js";import{createParser as j}from"eventsource-parser";import k from"../../Icons/attach-vertical.svg.js";import w from"../../Icons/spinner-lines.svg.js";import N from"../../Icons/file.svg.js";import I from"../../Icons/x.svg.js";import O from"../../Icons/arrow-right.svg.js";import C from"../Addons/IceBreaker/index.js";import S from"../../Core/Textarea.js";import R from"../../Core/ErrorAlert.js";import A from"../../../common/error.js";import T from"../../../common/cn.js";const D=({isFocused:D,onFocus:B,onBlur:E})=>{var U;const{formId:F,chatId:H,userId:z,studioUserId:L,embedUserId:$,deploymentId:G,deploymentType:J,pickaxe:K,styles:P,colors:W,responsiveBy:_,isNewChat:M,isRtl:q,setIsNewChat:Q,setIsShowIceBreaker:V,onGenerateComplete:X}=c(),{messages:Y,status:Z,limits:ee,isGenerating:te,setMessages:se,setStatus:oe,setLimitData:re,setError:ie}=d(),{documents:ne,isUploading:le,isImageUploadAllowed:ae,documentError:ce,onFileUpload:de,setDocuments:ue,setDocumentError:me,removeDocument:pe}=h(),{scrollStartSession:fe,scrollEndSession:he,scrollToBottom:ge}=g({auto:!0}),be=p(),ve=f(),[xe,ye]=r(""),je=i(null),ke=b(),{isHover:we}=ke,Ne=e(ke,["isHover"]),Ie=b(),{isHover:Oe}=Ie,Ce=e(Ie,["isHover"]),Se=m(),Re=u(),Ae=n((()=>{var e,t,s;return!!M&&(!!K&&(!be.isLoading&&(!((null!==(t=null===(e=be.data)||void 0===e?void 0:e.messages.length)&&void 0!==t?t:0)>1)&&!!(null===(s=K.icebreakers)||void 0===s?void 0:s.length))))}),[K,M,be.data,be.isLoading]),Te=e=>t(void 0,void 0,void 0,(function*(){try{if("idle"!==Z||le)return;const t=null!=e?e:xe;if(!t)return;ie(""),me(""),re(null),ye(""),Q(!1),oe("fetching"),fe(),ge();const s=ne.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)).map((e=>e.documentId)).filter(Boolean),o="enduserupload"===(null==K?void 0:K.documentuploadtype)&&s.length>0,r=[...Array.from(Y),Object.assign({id:Y.length+1,role:"user",content:t},o&&{documentIds:s})];se(r),ge(),o&&ue([]);const i=(yield ve.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:F,responseId:H,value:t},o&&{documentIds:s}),z&&{userId:z}),L&&{studioUserId:L}),$&&{embedUserId:$}),G&&{deploymentId:G}))).body;if(!i)throw new Error("Streaming error");const n=r.length,l=new TextDecoder,a=i.getReader();let c="",d=!0,u=!1;const m=j({onEvent:e=>{if("delta"===e.event){const t=JSON.parse(e.data).token.replace(/\u200B/g,"");c+=t,se([...r.slice(0,n),{id:Y.length+1,role:"assistant",content:c}])}else if("error"===e.event){const t=JSON.parse(e.data);ie(t.error||"Something went wrong, please try again.")}else"stop"===e.event&&(d=!1)}});for(;d;){const{value:e,done:t}=yield a.read();if(t){d=!1;break}const s=l.decode(e);s&&(u||(oe("streaming"),u=!0),m.feed(s))}null==X||X(H)}catch(e){let t=A(e)||"";t&&!t.includes("Unexpected token 'A',")||(t="Oops! We're experiencing high traffic at the moment. Please try again later.");const s=Object.entries(ee).find((([e])=>t.includes(e)));s?re(s[1]):ie(t)}finally{ge(),oe("idle"),he()}}));return l((()=>{V(Ae)}),[Ae]),s("div",Object.assign({className:T("w-full flex flex-col items-center absolute bottom-0 left-0 z-1",!("chat-input"===J&&M)&&"px-4 pb-4"),dir:q?"rtl":"ltr"},{children:o("div",Object.assign({className:"relative flex flex-col max-w-[800px] w-full"},{children:[!("chat-input"===J&&M)&&s("div",Object.assign({className:T("absolute bottom-full",q?"left-0":"right-0")},{children:s("div",Object.assign({className:T("flex flex-col gap-2 pb-4 px-2",q?"justify-start":"justify-end","viewport"===_?q?"min-[767px]:items-start":"min-[767px]:items-end":q?"@[767px]/pickaxe-root:items-start":"@[767px]/pickaxe-root:items-end")},{children:Ae&&!D&&s(C,{data:(null==K?void 0:K.icebreakers)||[],onSend:Te})}))})),o("div",Object.assign({className:T("flex flex-col gap-y-2 px-4 py-3","block"===P.formFieldStyle&&"shadow"),style:Re},{children:["idle"===Z&&ne.length>0&&s("div",Object.assign({className:T("grid grid-cols-1","viewport"===_?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:s("div",Object.assign({className:"flex flex-row gap-x-2"},{children:ne.filter((e=>"failed"!==e.status)).map((e=>{var t,r,i;return s(a,{children:"document"===e.type?o("div",Object.assign({className:T("relative gap-x-[10px] flex items-center px-2 h-[56px] border",q&&"flex-row-reverse"),style:{borderRadius:Re.borderRadius,borderColor:W.secondaryText+"50"}},{children:[s("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:W.accent,borderRadius:Re.borderRadius}},{children:le?s(w,{className:"w-5 h-5 animate-spin",style:{color:W.accentText}}):s(N,{className:"w-5 h-5",style:{color:W.accentText}})})),o("div",Object.assign({className:T("flex flex-col justify-center truncate",q?"text-right items-end":"text-left items-start")},{children:[s("p",Object.assign({className:(T(Se.b3),"font-medium truncate")},{children:e.name})),s("p",Object.assign({className:T(Se.b4,"opacity-80 truncate")},{children:v(e.size)}))]})),s("button",Object.assign({type:"button",className:T("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",q?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:W.accent,borderColor:Re.backgroundColor},disabled:le||"idle"!==Z,onClick:()=>pe(e.id)},{children:s(I,{className:"w-4 h-4",style:{color:W.accentText}})}))]})):"image"===e.type?o("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:Re.borderRadius}},{children:["finished"===e.status?s("img",{style:{borderRadius:Re.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(t=e.documentId)||void 0===t?void 0:t.split("-")[2]}/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[1]}.${null===(i=e.documentId)||void 0===i?void 0:i.split("-")[2]}`,alt:""}):s("div",{className:"h-full w-full animate-pulse",style:{borderRadius:Re.borderRadius,backgroundColor:W.secondary}}),s("button",Object.assign({type:"button",className:T("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",q?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:W.accent,borderColor:Re.backgroundColor},disabled:le||"idle"!==Z,onClick:()=>pe(e.id)},{children:s(I,{className:"w-4 h-4",style:{color:W.accentText}})}))]})):null},e.id)}))}))})),o("div",Object.assign({className:T("flex items-end gap-x-2",q&&"flex-row-reverse")},{children:[s(S,Object.assign({className:T(Se.i1,"max-h-60 min-h-[27px] w-full border-transparent bg-transparent",!xe.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap",q?"text-right":"text-left"),value:xe,placeholder:q?"بماذا تريد أن تتحدث؟":null!==(U=null==K?void 0:K.placeholdertext)&&void 0!==U?U:"What do you want to talk about?",onChange:e=>ye(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),le||"idle"!==Z||Te()))}},B&&{onFocus:B},E&&{onBlur:E},{dir:q?"rtl":"ltr"})),o("div",Object.assign({className:T("flex items-center gap-x-2")},{children:["enduserupload"===(null==K?void 0:K.documentuploadtype)&&o("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 ease-in-out",style:{backgroundColor:Oe?W.accent+"10":void 0},disabled:le||"idle"!==Z,onClick:()=>{var e;return null===(e=je.current)||void 0===e?void 0:e.click()}},Ce,{children:[s("input",{id:"file-upload",ref:je,type:"file",accept:[...x,...ae?y:[]].join(", "),multiple:!0,hidden:!0,className:"hidden",onChange:e=>t(void 0,void 0,void 0,(function*(){Q(!1),yield de(Array.from(e.target.files||[])),e.target.value=""}))}),s(k,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:Oe?W.accent:W.accent+"80"}})]})),s("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full duration-200 transition-colors ease-in-out",style:{backgroundColor:(we||xe.length||ne.length&&ne.every((e=>"finished"===e.status)))&&!te?W.accent:W.accent+"10"},disabled:le||"idle"!==Z,onClick:()=>Te()},Ne,{children:s(O,{className:T("h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",q&&"transform scale-x-[-1]"),style:{color:(we||xe.length||ne.length&&ne.every((e=>"finished"===e.status)))&&!te?W.accentText:W.accent+"80"}})}))]}))]}))]})),ce&&s(R,{error:ce,className:"mt-3"})]}))}))};export{D as default};
@@ -1 +1 @@
1
- import{__rest as e,__awaiter as s}from"../../../../_virtual/_tslib.js";import{jsxs as t,jsx as o,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as r,Fragment as i}from"react";import{usePickaxeContext as n}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleInput as c}from"../../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as d}from"../../../../hooks/studio/useStyleFontSize.js";import{useDocument as u}from"../../Addons/Document/hooks/useDocument.js";import{useHover as m}from"../../../../hooks/core/useHover.js";import{allowedFileMimeTypes as b,allowedImageMimeTypes as p}from"../../../../common/documents.js";import{formatBytes as f}from"../../../../common/utils.js";import h from"../../../Icons/attach-vertical.svg.js";import g from"../../../Icons/check.svg.js";import y from"../../../Icons/spinner-lines.svg.js";import v from"../../../Icons/file.svg.js";import x from"../../../Icons/x.svg.js";import j from"../../../Icons/link.svg.js";import w from"../../../Core/ErrorAlert.js";import N from"../../../../common/cn.js";const k=({field:k,update:O})=>{var C;const R=d(),{colors:I,styles:D,translations:T,responsiveBy:F}=n(),A=m(),{isHover:S}=A,U=e(A,["isHover"]),{documents:E,documentError:z,websiteLink:H,isUploading:L,isImageUploadAllowed:W,setDocuments:$,setDocumentError:B,setWebsiteLink:P,onFileUpload:_,onWebsiteUpload:q}=u({onQuestionChange:e=>{O(Object.assign(Object.assign({},k),e))}}),[K,Q]=a(!1),G=r(null),J=c();return t("div",Object.assign({className:"flex flex-col gap-y-4"},{children:[t("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[t("div",Object.assign({className:"flex items-center gap-1"},{children:[o("p",Object.assign({className:N(R.b3,"font-semibold opacity-70")},{children:k.main})),k.isRequired&&o("span",Object.assign({className:"select-none font-semibold",style:{color:I.error}},{children:"*"}))]})),t("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[o("input",{ref:G,type:"file",accept:[...b,...W?p:[]].join(", "),id:k.id,hidden:!0,multiple:!1,className:"hidden",onChange:e=>s(void 0,void 0,void 0,(function*(){yield _(Array.from(e.target.files||[])),e.target.value=""})),disabled:L}),t("div",Object.assign({className:N("flex items-center justify-between rounded-sm border border-transparent bg-white py-3 pl-4 pr-3 duration-300 ease-in-out transition-all",K&&"block"===D.formFieldStyle&&"shadow","block"===D.formFieldStyle&&"shadow hover:shadow-none"),style:J},{children:[o("input",{type:"text",value:H,className:N(R.i1,"w-full outline-none ring-0 bg-transparent placeholder:text-inherit placeholder:opacity-50"),placeholder:null!==(C=null==T?void 0:T["form-doc-placeholder"])&&void 0!==C?C:"Paste a website/video link or drag a file",onChange:e=>P(e.target.value),onDrop:e=>s(void 0,void 0,void 0,(function*(){e.preventDefault(),yield _(Array.from(e.dataTransfer.files||[]))})),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),q(H))},onFocus:()=>Q(!0),onBlur:()=>Q(!1)}),o("div",Object.assign({className:"flex items-center gap-3 pl-4"},{children:H.length>0?t(l,{children:[o("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:L,onClick:()=>q(H)},{children:o(g,{className:"h-5 w-5 shrink-0",style:{color:I.accent}})})),o("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:L,onClick:()=>{P(""),B("")}},{children:o(x,{className:"h-6 w-6 shrink-0",style:{color:I.accent}})}))]}):o("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 ease-in-out",disabled:L,onClick:()=>{var e;null===(e=G.current)||void 0===e||e.click()},style:{backgroundColor:S?I.accent+"10":void 0}},U,{children:o(h,{className:"h-6 w-6 shrink-0",style:{color:S?I.accent:I.accent+"80"}})}))}))]}))]}))]})),E.length>0&&o("div",Object.assign({className:N("flex gap-4","viewport"===F?"min-[765px]:flex-col":"@[767px]/pickaxe-root:flex-col")},{children:E.map((e=>{var s,l,a;return o(i,{children:"document"===e.type?t("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:J},{children:[o("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:I.accent,borderRadius:J.borderRadius}},{children:L?o(y,{className:"w-5 h-5 animate-spin",style:{color:I.accentText}}):o(v,{className:"w-5 h-5",style:{color:I.accentText}})})),t("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[o("p",Object.assign({className:(N(R.b3),"font-medium truncate")},{children:e.name})),o("p",Object.assign({className:N(R.b4,"opacity-80 truncate")},{children:f(e.size)}))]})),o("button",Object.assign({type:"button",disabled:L,onClick:()=>$([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:I.accent,borderColor:J.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:I.accentText}})}))]})):"image"===e.type?t("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:J.borderRadius}},{children:["finished"===e.status?o("img",{style:{borderRadius:J.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(s=e.documentId)||void 0===s?void 0:s.split("-")[2]}/${null===(l=e.documentId)||void 0===l?void 0:l.split("-")[1]}.${null===(a=e.documentId)||void 0===a?void 0:a.split("-")[2]}`,alt:""}):o("div",{className:"h-full w-full animate-pulse",style:{borderRadius:J.borderRadius,backgroundColor:I.secondary}}),o("button",Object.assign({type:"button",disabled:L,onClick:()=>$([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:I.accent,borderColor:J.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:I.accentText}})}))]})):"website"===e.type?t("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:J},{children:[o("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:I.accent,borderRadius:J.borderRadius}},{children:L?o(y,{className:"w-5 h-5 animate-spin",style:{color:I.accentText}}):o(j,{className:"w-5 h-5",style:{color:I.accentText}})})),t("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[o("p",Object.assign({className:(N(R.b3),"font-medium truncate")},{children:new URL(e.name).hostname})),o("p",Object.assign({className:N(R.b4,"opacity-80 truncate")},{children:(null==T?void 0:T.website)||"Website"}))]})),o("button",Object.assign({type:"button",disabled:L,onClick:()=>$([]),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:I.accent,borderColor:J.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:I.accentText}})}))]})):null},e.id)}))})),z&&o(w,{error:z,className:"mt-3"})]}))};export{k as default};
1
+ import{__rest as e,__awaiter as s}from"../../../../_virtual/_tslib.js";import{jsxs as t,jsx as o,Fragment as l}from"react/jsx-runtime";import{useState as a,useRef as i,Fragment as r}from"react";import{usePickaxeContext as n}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleInput as c}from"../../../../hooks/studio/useStyleInput.js";import{useStyleFontSize as d}from"../../../../hooks/studio/useStyleFontSize.js";import{useDocument as u}from"../../Addons/Document/hooks/useDocument.js";import{useHover as m}from"../../../../hooks/core/useHover.js";import{allowedFileMimeTypes as b,allowedImageMimeTypes as p}from"../../../../common/documents.js";import{formatBytes as f}from"../../../../common/utils.js";import h from"../../../Icons/attach-vertical.svg.js";import g from"../../../Icons/check.svg.js";import y from"../../../Icons/spinner-lines.svg.js";import v from"../../../Icons/file.svg.js";import x from"../../../Icons/x.svg.js";import j from"../../../Icons/link.svg.js";import w from"../../../Core/ErrorAlert.js";import N from"../../../../common/cn.js";const k=({field:k,update:O})=>{var C;const R=d(),{colors:I,styles:D,translations:T,responsiveBy:F}=n(),A=m(),{isHover:S}=A,U=e(A,["isHover"]),{documents:E,documentError:z,websiteLink:H,isUploading:L,isImageUploadAllowed:W,removeDocument:$,setDocumentError:B,setWebsiteLink:P,onFileUpload:_,onWebsiteUpload:q}=u({onQuestionChange:e=>{O(Object.assign(Object.assign({},k),e))}}),[K,Q]=a(!1),G=i(null),J=c();return t("div",Object.assign({className:"flex flex-col gap-y-4"},{children:[t("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[t("div",Object.assign({className:"flex items-center gap-1"},{children:[o("p",Object.assign({className:N(R.b3,"font-semibold opacity-70")},{children:k.main})),k.isRequired&&o("span",Object.assign({className:"select-none font-semibold",style:{color:I.error}},{children:"*"}))]})),t("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[o("input",{ref:G,type:"file",accept:[...b,...W?p:[]].join(", "),id:k.id,hidden:!0,multiple:!0,className:"hidden",onChange:e=>s(void 0,void 0,void 0,(function*(){yield _(Array.from(e.target.files||[])),e.target.value=""})),disabled:L}),t("div",Object.assign({className:N("flex items-center justify-between rounded-sm border border-transparent bg-white py-3 pl-4 pr-3 duration-300 ease-in-out transition-all",K&&"block"===D.formFieldStyle&&"shadow","block"===D.formFieldStyle&&"shadow hover:shadow-none"),style:J},{children:[o("input",{type:"text",value:H,className:N(R.i1,"w-full outline-none ring-0 bg-transparent placeholder:text-inherit placeholder:opacity-50"),placeholder:null!==(C=null==T?void 0:T["form-doc-placeholder"])&&void 0!==C?C:"Paste a website/video link or drag a file",onChange:e=>P(e.target.value),onDrop:e=>s(void 0,void 0,void 0,(function*(){e.preventDefault(),yield _(Array.from(e.dataTransfer.files||[]))})),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),q(H))},onFocus:()=>Q(!0),onBlur:()=>Q(!1)}),o("div",Object.assign({className:"flex items-center gap-3 pl-4"},{children:H.length>0?t(l,{children:[o("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:L,onClick:()=>q(H)},{children:o(g,{className:"h-5 w-5 shrink-0",style:{color:I.accent}})})),o("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:L,onClick:()=>{P(""),B("")}},{children:o(x,{className:"h-6 w-6 shrink-0",style:{color:I.accent}})}))]}):o("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 ease-in-out",disabled:L,onClick:()=>{var e;null===(e=G.current)||void 0===e||e.click()},style:{backgroundColor:S?I.accent+"10":void 0}},U,{children:o(h,{className:"h-6 w-6 shrink-0",style:{color:S?I.accent:I.accent+"80"}})}))}))]}))]}))]})),E.length>0&&o("div",Object.assign({className:N("flex gap-4","viewport"===F?"min-[765px]:flex-col":"@[767px]/pickaxe-root:flex-col")},{children:o("div",Object.assign({className:"flex flex-row gap-x-2"},{children:E.filter((e=>"failed"!==e.status)).map((e=>{var s,l,a;return o(r,{children:"document"===e.type?t("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:J},{children:[o("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:I.accent,borderRadius:J.borderRadius}},{children:L?o(y,{className:"w-5 h-5 animate-spin",style:{color:I.accentText}}):o(v,{className:"w-5 h-5",style:{color:I.accentText}})})),t("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[o("p",Object.assign({className:(N(R.b3),"font-medium truncate")},{children:e.name})),o("p",Object.assign({className:N(R.b4,"opacity-80 truncate")},{children:f(e.size)}))]})),o("button",Object.assign({type:"button",disabled:L,onClick:()=>$(e.id),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:I.accent,borderColor:J.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:I.accentText}})}))]})):"image"===e.type?t("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:J.borderRadius}},{children:["finished"===e.status?o("img",{style:{borderRadius:J.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(s=e.documentId)||void 0===s?void 0:s.split("-")[2]}/${null===(l=e.documentId)||void 0===l?void 0:l.split("-")[1]}.${null===(a=e.documentId)||void 0===a?void 0:a.split("-")[2]}`,alt:""}):o("div",{className:"h-full w-full animate-pulse",style:{borderRadius:J.borderRadius,backgroundColor:I.secondary}}),o("button",Object.assign({type:"button",disabled:L,onClick:()=>$(e.id),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:I.accent,borderColor:J.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:I.accentText}})}))]})):"website"===e.type?t("div",Object.assign({className:"relative w-full max-w-[350px] gap-x-[10px] flex items-center px-2 h-[56px] border",style:J},{children:[o("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:I.accent,borderRadius:J.borderRadius}},{children:L?o(y,{className:"w-5 h-5 animate-spin",style:{color:I.accentText}}):o(j,{className:"w-5 h-5",style:{color:I.accentText}})})),t("div",Object.assign({className:"flex flex-col justify-center truncate"},{children:[o("p",Object.assign({className:(N(R.b3),"font-medium truncate")},{children:new URL(e.name).hostname})),o("p",Object.assign({className:N(R.b4,"opacity-80 truncate")},{children:(null==T?void 0:T.website)||"Website"}))]})),o("button",Object.assign({type:"button",disabled:L,onClick:()=>$(e.id),className:"absolute w-5 h-5 rounded-full -right-2 -top-2 flex items-center justify-center border outline-none disabled:cursor-default",style:{backgroundColor:I.accent,borderColor:J.backgroundColor}},{children:o(x,{className:"w-4 h-4",style:{color:I.accentText}})}))]})):null},e.id)}))}))})),z&&o(w,{error:z,className:"mt-3"})]}))};export{k as default};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../../_virtual/_tslib.js";import{jsxs as o,jsx as t}from"react/jsx-runtime";import{useState as s}from"react";import{usePickaxeContext as n}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as i}from"../../../../hooks/pickaxe/useResponseContext.js";import{useSubmit as r}from"../../../../hooks/pickaxe/useSubmit.js";import{useDocument as l}from"../../Addons/Document/hooks/useDocument.js";import{useScroll as a}from"../../Addons/Scroll/hooks/useScroll.js";import{extractUrlsFromText as d}from"../../../../common/utils.js";import{encode as c}from"@nem035/gpt-3-encoder";import{createParser as m}from"eventsource-parser";import u from"../../common/PickaxeBranding.js";import p from"../../common/PickaxeButton.js";import f from"../../../../common/error.js";import g from"../../../../common/cn.js";const h=({questions:h})=>{var b;const{formId:x,userId:v,studioUserId:j,embedUserId:w,deploymentId:k,pickaxe:I,misc:y,translations:O,responsiveBy:S,setChatId:C,setIsNewChat:E,onGenerateComplete:U}=n(),{status:D,limits:P,isGenerating:R,setResponse:q,setMessages:N,setStatus:A,setLimitData:L,setError:B}=i(),{documents:T,websiteLink:W,isUploading:G,onWebsiteUpload:J,setDocumentError:M}=l(),{scrollStartSession:_,scrollEndSession:K,scrollToTarget:X}=a({auto:!(null==I?void 0:I.enablechatresponses)}),Y=r(),[z,F]=s(!1);return o("div",Object.assign({className:g("mt-4 flex flex-wrap flex-col justify-between gap-2","viewport"===S?"min-[767px]:flex-row":"@[767px]/pickaxe-root:flex-row")},{children:[t("div",Object.assign({className:"flex items-center flex-grow flex-wrap gap-2"},{children:t(p,Object.assign({className:"px-5 min-h-[42px]",isDisabled:G||"idle"!==D||R||z,onClick:()=>e(void 0,void 0,void 0,(function*(){try{if("idle"!==D||G||z)return;B(""),L(null),M(""),q(null);const e=["Multiple Choice","Checkbox"];for(const o of h){if(c(o.input).length>o.maxLength&&!e.includes(o.type))throw new Error("One or more of your responses is too long!");if(o.isRequired&&!o.input.trim()&&"userinput:documentupload"!==o.id)throw new Error("You must fill out all required fields.")}const o=T.filter((e=>"finished"===e.status)),t=T.map((e=>e.name)),s="enduserupload"===(null==I?void 0:I.documentuploadtype),n=h.some((e=>"userinput:documentupload"===e.id&&e.isRequired)),i=d(W).filter((e=>!t.includes(e)));if(i.length){const e=i[i.length-1];F(!0);const t=yield J(e);t&&(o.push(t),yield new Promise((e=>setTimeout(e,5e3)))),F(!1)}else if(n&&s&&!o.length)return void M("Please paste a valid website/video link or drag a file to add to the knowledge base.");const r=o.length?o[o.length-1]:null,l=s&&r&&"finished"===r.status;let a={};h.forEach((e=>a=Object.assign(Object.assign({},a),{[e.id]:"Knowledge Upload"===e.type||e.id.includes("documentupload")?(null==r?void 0:r.name)||"":e.input}))),A("fetching"),_(),X();const u=yield Y.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:x,valueObj:a},l&&{documentId:r.documentId}),v&&{userId:v}),j&&{studioUserId:j}),w&&{embedUserId:w}),k&&{deploymentId:k})),p=u.body;if(!p)throw new Error("Streaming error");const f=u.headers.get("X-Pickaxe-Response-Id");if(!f)throw new Error("Response ID not found");const g=new TextDecoder,b=p.getReader();let y="",O=!0,S=!1;const P=m({onEvent:e=>{if("delta"===e.event){const o=JSON.parse(e.data).token.replace(/\u200B/g,"");y+=o,q({formId:x,responseId:f,documentIds:r&&r.documentId?[r.documentId]:[],questions:h.map((e=>({id:e.id,question:e.main,answer:e.input}))),questionResponse:y,messageCount:0,sentAt:new Date}),(null==I?void 0:I.enablechatresponses)&&N([{id:0,role:"assistant",content:y}])}else if("error"===e.event){const o=JSON.parse(e.data);B(o.error||"Something went wrong, please try again.")}else"stop"===e.event&&(O=!1)}});for(;O;){const{value:e,done:o}=yield b.read();if(o){O=!1;break}const t=g.decode(e);t&&(S||(A("streaming"),S=!0,(null==I?void 0:I.enablechatresponses)&&(C(f),E(!1))),P.feed(t))}null==U||U(f)}catch(e){let o=f(e)||"";o&&!o.includes("Unexpected token 'A',")||(o="Oops! We're experiencing high traffic at the moment. Please try again later.");const t=Object.entries(P).find((([e])=>o.includes(e)));t?L(t[1]):B(o),X()}finally{A("idle"),F(!1),K()}}))},{children:z?(null==O?void 0:O.processing)||"Processing...":G?(null==O?void 0:O.uploading)||"Uploading...":"fetching"===D||"streaming"===D?(null==O?void 0:O.loading)||"Loading...":null!==(b=null==I?void 0:I.submittext)&&void 0!==b?b:"Submit"}))})),!y.isWhiteLabel&&t("div",Object.assign({className:"flex justify-end pr-3"},{children:t(u,{})}))]}))};export{h as default};
1
+ import{__awaiter as e}from"../../../../_virtual/_tslib.js";import{jsxs as o,jsx as t}from"react/jsx-runtime";import{useState as s}from"react";import{usePickaxeContext as n}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as i}from"../../../../hooks/pickaxe/useResponseContext.js";import{useSubmit as r}from"../../../../hooks/pickaxe/useSubmit.js";import{useDocument as l}from"../../Addons/Document/hooks/useDocument.js";import{useScroll as a}from"../../Addons/Scroll/hooks/useScroll.js";import{extractUrlsFromText as d}from"../../../../common/utils.js";import{encode as c}from"@nem035/gpt-3-encoder";import{createParser as m}from"eventsource-parser";import u from"../../common/PickaxeBranding.js";import p from"../../common/PickaxeButton.js";import f from"../../../../common/error.js";import g from"../../../../common/cn.js";const h=({questions:h})=>{var b;const{formId:x,userId:v,studioUserId:j,embedUserId:w,deploymentId:k,pickaxe:y,misc:I,translations:O,responsiveBy:S,setChatId:C,setIsNewChat:D,onGenerateComplete:E}=n(),{status:U,limits:P,isGenerating:R,setResponse:q,setMessages:N,setStatus:A,setLimitData:B,setError:L}=i(),{documents:T,websiteLink:W,isUploading:G,onWebsiteUpload:J,setDocuments:M,setDocumentError:_}=l(),{scrollStartSession:K,scrollEndSession:X,scrollToTarget:Y}=a({auto:!(null==y?void 0:y.enablechatresponses)}),z=r(),[F,H]=s(!1);return o("div",Object.assign({className:g("mt-4 flex flex-wrap flex-col justify-between gap-2","viewport"===S?"min-[767px]:flex-row":"@[767px]/pickaxe-root:flex-row")},{children:[t("div",Object.assign({className:"flex items-center flex-grow flex-wrap gap-2"},{children:t(p,Object.assign({className:"px-5 min-h-[42px]",isDisabled:G||"idle"!==U||R||F,onClick:()=>e(void 0,void 0,void 0,(function*(){try{if("idle"!==U||G||F)return;L(""),_(""),B(null),q(null);const e=["Multiple Choice","Checkbox"];for(const o of h){if(c(o.input).length>o.maxLength&&!e.includes(o.type))throw new Error("One or more of your responses is too long!");if(o.isRequired&&!o.input.trim()&&"userinput:documentupload"!==o.id)throw new Error("You must fill out all required fields.")}const o=T.filter((e=>"finished"===e.status)),t=T.map((e=>e.name)),s="enduserupload"===(null==y?void 0:y.documentuploadtype),n=h.some((e=>"userinput:documentupload"===e.id&&e.isRequired)),i=d(W).filter((e=>!t.includes(e)));if(i.length){const e=i[i.length-1];H(!0);const t=yield J(e);t&&(o.push(t),yield new Promise((e=>setTimeout(e,5e3)))),H(!1)}else if(n&&s&&!o.length)return void _("Please paste a valid website/video link or drag a file to add to the knowledge base.");const r=o.map((e=>e.documentId)).filter(Boolean),l=s&&r.length>0;let a={};h.forEach((e=>a=Object.assign(Object.assign({},a),{[e.id]:"Knowledge Upload"===e.type||e.id.includes("documentupload")?o.map((e=>e.name)).join(",")||"":e.input}))),A("fetching"),K(),Y();const u=yield z.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:x,valueObj:a},l&&{documentIds:r}),v&&{userId:v}),j&&{studioUserId:j}),w&&{embedUserId:w}),k&&{deploymentId:k})),p=u.body;if(!p)throw new Error("Streaming error");const f=u.headers.get("X-Pickaxe-Response-Id");if(!f)throw new Error("Response ID not found");const g=new TextDecoder,b=p.getReader();let I="",O=!0,S=!1;const P=m({onEvent:e=>{if("delta"===e.event){const o=JSON.parse(e.data).token.replace(/\u200B/g,"");I+=o,q({formId:x,responseId:f,documentIds:r,questions:h.map((e=>({id:e.id,question:e.main,answer:e.input}))),questionResponse:I,messageCount:0,sentAt:new Date}),(null==y?void 0:y.enablechatresponses)&&N([{id:0,role:"assistant",content:I}])}else if("error"===e.event){const o=JSON.parse(e.data);L(o.error||"Something went wrong, please try again.")}else"stop"===e.event&&(O=!1)}});for(;O;){const{value:e,done:o}=yield b.read();if(o){O=!1;break}const t=g.decode(e);t&&(S||(A("streaming"),S=!0,l&&M([]),(null==y?void 0:y.enablechatresponses)&&(C(f),D(!1))),P.feed(t))}null==E||E(f)}catch(e){let o=f(e)||"";o&&!o.includes("Unexpected token 'A',")||(o="Oops! We're experiencing high traffic at the moment. Please try again later.");const t=Object.entries(P).find((([e])=>o.includes(e)));t?B(t[1]):L(o),Y()}finally{A("idle"),H(!1),X()}}))},{children:F?(null==O?void 0:O.processing)||"Processing...":G?(null==O?void 0:O.uploading)||"Uploading...":"fetching"===U||"streaming"===U?(null==O?void 0:O.loading)||"Loading...":null!==(b=null==y?void 0:y.submittext)&&void 0!==b?b:"Submit"}))})),!I.isWhiteLabel&&t("div",Object.assign({className:"flex justify-end pr-3"},{children:t(u,{})}))]}))};export{h as default};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as o}from"react/jsx-runtime";import{createContext as i,useState as s,useEffect as t}from"react";import r from"./Addons/Document/Provider.js";import n from"./ResponseProvider.js";import d from"./DimensionProvider.js";const l=i({}),a=({children:i,userId:a="",studioUserId:c="",deploymentId:m="",embedUserId:p="",deploymentType:f,deploymentDimensions:b,deploymentMisc:y,styles:h,colors:u,limits:F={},misc:I={isWhiteLabel:!0,isProfileImage:!0,isChatImage:!0,isTitle:!0,isDescription:!0,isHistory:!0},translations:g,responsiveBy:v="viewport",forceMobile:w=!1,disableHtml:x=!1,disableJs:P=!1,disableCss:j=!1,loadFont:D=!0,isRtl:S=!1,isEmbed:k=!1,isDropShadow:C=!1,onGenerateComplete:H})=>{const[O,R]=s(""),[T,U]=s(""),[B,L]=s(null),[M,E]=s(!1),[N,A]=s(!0),[G,J]=s(!0);return t((()=>{E(!1)}),[null==h?void 0:h.font]),t((()=>{e(void 0,void 0,void 0,(function*(){if("undefined"!=typeof window&&D&&!M&&(null==h?void 0:h.font)&&"Real Head Pro"!==h.font)try{(yield import("webfontloader")).default.load({google:{families:[h.font]},active:()=>{E(!0)},inactive:()=>{console.error("[pxe] failed to load font {styles.font}"),E(!0)}})}catch(e){console.error("[pxe] failed to load font:",e),E(!0)}}))}),[D,M,null==h?void 0:h.font]),o(l.Provider,Object.assign({value:Object.assign({formId:O,chatId:T,userId:a,studioUserId:c,embedUserId:p,deploymentId:m,deploymentType:f,deploymentDimensions:b,deploymentMisc:y,pickaxe:B,styles:Object.assign({theme:"light",font:"Real Head Pro",fontSize:"md",formFieldStyle:"box",btnStyle:"filled",outlineThickness:1,cornerRadius:4},h),colors:Object.assign({primary:"#F6F8FA",text:"#000000",secondary:"#FFFFFF",secondaryText:"#000000",accent:"#228DD7",accentText:"#FFFFFF",error:"#EF4444"},u),misc:I,translations:Object.assign({"new-chat":"New chat","see-history":"See history","see-input":"See input","hide-input":"Hide input",processing:"Processing...",uploading:"Uploading...",loading:"Loading...","powered-by-pickaxe":"Powered by Pickaxe","form-doc-placeholder":"Paste a website/video link or drag a file",website:"Website"},g),responsiveBy:v,forceMobile:w,loadFont:D,disableHtml:x,disableJs:P,disableCss:j,isFontLoaded:M,isNewChat:N,isShowIceBreaker:G,isRtl:S,isEmbed:k,isDropShadow:C,setIsFontLoaded:E,setFormId:R,setChatId:U,setPickaxe:L,setIsNewChat:A,setIsShowIceBreaker:J},H&&{onGenerateComplete:H})},{children:o(n,Object.assign({limits:F},{children:o(d,{children:o(r,{children:i})})}))}))};export{l as PickaxeContext,a as PickaxeProvider};
1
+ import{__awaiter as e}from"../../_virtual/_tslib.js";import{jsx as o}from"react/jsx-runtime";import{createContext as i,useState as s,useEffect as t}from"react";import n from"./Addons/Document/Provider.js";import r from"./ResponseProvider.js";import d from"./DimensionProvider.js";const l=i({}),a=({children:i,userId:a="",studioUserId:c="",deploymentId:m="",embedUserId:p="",deploymentType:f,deploymentDimensions:b,deploymentMisc:y,styles:h,colors:u,limits:F={},misc:I={isWhiteLabel:!0,isProfileImage:!0,isChatImage:!0,isTitle:!0,isDescription:!0,isHistory:!0},translations:g,responsiveBy:v="viewport",forceMobile:w=!1,disableHtml:x=!1,disableJs:P=!1,disableCss:j=!1,loadFont:S=!0,isRtl:D=!1,isEmbed:k=!1,isDropShadow:C=!1,onGenerateComplete:H})=>{const[O,R]=s(""),[T,U]=s(""),[B,L]=s(""),[M,E]=s(null),[N,A]=s(!1),[G,J]=s(!0),[W,_]=s(!0);return t((()=>{A(!1)}),[null==h?void 0:h.font]),t((()=>{e(void 0,void 0,void 0,(function*(){if("undefined"!=typeof window&&S&&!N&&(null==h?void 0:h.font)&&"Real Head Pro"!==h.font)try{(yield import("webfontloader")).default.load({google:{families:[h.font]},active:()=>{A(!0)},inactive:()=>{console.error("[pxe] failed to load font {styles.font}"),A(!0)}})}catch(e){console.error("[pxe] failed to load font:",e),A(!0)}}))}),[S,N,null==h?void 0:h.font]),o(l.Provider,Object.assign({value:Object.assign({formId:O,chatId:T,sessionId:B,userId:a,studioUserId:c,embedUserId:p,deploymentId:m,deploymentType:f,deploymentDimensions:b,deploymentMisc:y,pickaxe:M,styles:Object.assign({theme:"light",font:"Real Head Pro",fontSize:"md",formFieldStyle:"box",btnStyle:"filled",outlineThickness:1,cornerRadius:4},h),colors:Object.assign({primary:"#F6F8FA",text:"#000000",secondary:"#FFFFFF",secondaryText:"#000000",accent:"#228DD7",accentText:"#FFFFFF",error:"#EF4444"},u),misc:I,translations:Object.assign({"new-chat":"New chat","see-history":"See history","see-input":"See input","hide-input":"Hide input",processing:"Processing...",uploading:"Uploading...",loading:"Loading...","powered-by-pickaxe":"Powered by Pickaxe","form-doc-placeholder":"Paste a website/video link or drag a file",website:"Website"},g),responsiveBy:v,forceMobile:w,loadFont:S,disableHtml:x,disableJs:P,disableCss:j,isFontLoaded:N,isNewChat:G,isShowIceBreaker:W,isRtl:D,isEmbed:k,isDropShadow:C,setIsFontLoaded:A,setFormId:R,setChatId:U,setSessionId:L,setPickaxe:E,setIsNewChat:J,setIsShowIceBreaker:_},H&&{onGenerateComplete:H})},{children:o(r,Object.assign({limits:F},{children:o(d,{children:o(n,{children:i})})}))}))};export{l as PickaxeContext,a as PickaxeProvider};
@@ -1 +1 @@
1
- import{__rest as t}from"../../../_virtual/_tslib.js";import{jsx as o}from"react/jsx-runtime";import{usePickaxeContext as r}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleButton as s}from"../../../hooks/studio/useStyleButton.js";import{useStyleFontSize as a}from"../../../hooks/studio/useStyleFontSize.js";import e from"../../Core/Button.js";import i from"../../../common/cn.js";const m=m=>{var{variant:n,className:c}=m,l=t(m,["variant","className"]);const{styles:p}=r(),u=s({variant:n}),y=a();return o(e,Object.assign({variant:n,className:i(y.l2,"min-h-[48px]",c,("primary"===n||"secondary"===n)&&"hover:opacity-90","outlined"===p.btnStyle&&"hover:opacity-70"),style:u},l))};export{m as default};
1
+ import{__rest as t}from"../../../_virtual/_tslib.js";import{jsx as o}from"react/jsx-runtime";import{usePickaxeContext as s}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleButton as r}from"../../../hooks/studio/useStyleButton.js";import{useStyleFontSize as e}from"../../../hooks/studio/useStyleFontSize.js";import a from"../../Core/Button.js";import i from"../../../common/cn.js";const m=m=>{var{variant:n,className:c,style:l}=m,p=t(m,["variant","className","style"]);const{styles:u}=s(),y=r({variant:n}),j=e();return o(a,Object.assign({variant:n,className:i(j.l2,"min-h-[48px]",c,("primary"===n||"secondary"===n)&&"hover:opacity-90","outlined"===u.btnStyle&&"hover:opacity-70"),style:Object.assign(Object.assign({},y),l)},p))};export{m as default};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useState as s,useMemo as t}from"react";import{usePickaxeContext as o}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as r}from"../../../hooks/studio/useStyleFontSize.js";import{PickaxeMarkdownRenderer as l}from"./PickaxeMarkdown/Renderer.js";import c from"./PickaxeIcon.js";import n from"./PickaxeInfoModal.js";import{PickaxeMarkdown as a}from"./PickaxeMarkdown/index.js";import m from"../../../common/cn.js";const d=({className:d,iconClassName:p,maxDescriptionChars:f,onIconClick:x})=>{const{pickaxe:h,styles:u,colors:k,misc:j,disableHtml:b,disableJs:C,disableCss:g,isRtl:v}=o(),[P,O]=s(!1),N=r(),I=t((()=>({title:(null==h?void 0:h.formtitle)||"",description:(null==h?void 0:h.formdescription)||""})),[h]);return e("div",Object.assign({className:m("flex flex-col items-center",d)},{children:[P&&i(n,{isOpen:P,onChangeIsOpen:O}),j.isProfileImage&&i(c,Object.assign({src:null==h?void 0:h.coverphoto,alt:`${null==h?void 0:h.formtitle}'s Profile Picture`,width:72,height:72,className:m("h-[72px] w-[72px] rounded-full",p,!!x&&"cursor-pointer")},x&&{onClick:x})),j.isTitle&&!!I.title&&i("h2",Object.assign({className:m(N.h2,"mt-6 text-center font-semilight opacity-90",!f&&"line-clamp-2")},{children:null==h?void 0:h.formtitle})),j.isDescription&&!!I.description&&i(a,Object.assign({theme:u.theme,accentColor:k.accent},v&&{rtl:!0},b&&{disableHtml:!0},C&&{disableJs:!0},g&&{disableCss:!0},{children:i(l,Object.assign({className:"mt-2 text-center",value:I.description},f&&{maxDescriptionChars:f},{onExpandClick:()=>O(!0)}))}))]}))};export{d as default};
1
+ import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useState as s,useMemo as t}from"react";import{usePickaxeContext as o}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as r}from"../../../hooks/studio/useStyleFontSize.js";import{PickaxeMarkdownRenderer as l}from"./PickaxeMarkdown/Renderer.js";import c from"./PickaxeIcon.js";import n from"./PickaxeInfoModal.js";import{PickaxeMarkdown as a}from"./PickaxeMarkdown/index.js";import m from"../../../common/cn.js";const d=({className:d,iconClassName:p,maxDescriptionChars:f,onIconClick:x})=>{const{pickaxe:h,styles:u,colors:k,misc:j,disableHtml:b,disableJs:C,disableCss:g,isRtl:v}=o(),[P,O]=s(!1),N=r(),I=t((()=>({title:(null==h?void 0:h.formtitle)||"",description:(null==h?void 0:h.formdescription)||""})),[h]);return e("div",Object.assign({className:m("flex flex-col items-center",d)},{children:[P&&i(n,{isOpen:P,onChangeIsOpen:O}),j.isProfileImage&&i(c,Object.assign({src:null==h?void 0:h.coverphoto,alt:`${null==h?void 0:h.formtitle}'s Profile Picture`,width:72,height:72,className:m("h-[72px] w-[72px] rounded-full",p,!!x&&"cursor-pointer")},x&&{onClick:x})),j.isTitle&&!!I.title&&i("h2",Object.assign({className:m(N.h2,"mt-6 text-center font-semilight opacity-90",!f&&"line-clamp-2")},{children:null==h?void 0:h.formtitle})),j.isDescription&&!!I.description&&i(a,Object.assign({theme:u.theme,accentColor:k.accent},v&&{rtl:!0},b&&{disableHtml:!0},C&&{disableJs:!0},g&&{disableCss:!0},{children:i(l,Object.assign({className:"mt-2 text-center",value:I.description},f&&{maxChars:f},{onExpandClick:()=>O(!0)}))}))]}))};export{d as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as o}from"react/jsx-runtime";import{AnimatePresence as r}from"framer-motion";import{usePickaxeContext as s}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as t}from"../../../hooks/pickaxe/useResponseContext.js";import{useStyleFontSize as a}from"../../../hooks/studio/useStyleFontSize.js";import i from"../../Icons/circle-exclamation.svg.js";import m from"../../Core/SpringTransition.js";import c from"../../Core/HtmlRenderer.js";import n from"./PickaxeButton.js";import l from"../../../common/cn.js";const p=({className:p,iconClassName:f,htmlClassName:h})=>{const{colors:x}=s(),j=a(),{limitData:d}=t();return e(r,{children:!!d&&o(m,Object.assign({className:l("flex gap-3",p)},{children:[e(i,{className:l("h-5 w-5 shrink-0",f),style:{color:x.accent}}),o("div",Object.assign({className:"flex flex-col gap-4"},{children:[e(c,{className:l(j.b2,"font-semibold",h),style:{color:x.text},html:d.html}),!!d.cta&&e("a",Object.assign({href:d.ctaLink,target:"_parent",rel:"noreferrer"},{children:e(n,Object.assign({variant:"primary",className:"min-h-[38px]",style:{minHeight:"38px"}},{children:d.cta}))}))]}))]}))})};export{p as default};
1
+ import{jsx as e,jsxs as o}from"react/jsx-runtime";import{AnimatePresence as r}from"framer-motion";import{usePickaxeContext as s}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as t}from"../../../hooks/pickaxe/useResponseContext.js";import{useStyleFontSize as a}from"../../../hooks/studio/useStyleFontSize.js";import i from"../../Icons/circle-exclamation.svg.js";import m from"../../Core/SpringTransition.js";import c from"../../Core/HtmlRenderer.js";import n from"./PickaxeButton.js";import l from"../../../common/cn.js";const p=({className:p,iconClassName:f,htmlClassName:h})=>{const{colors:x}=s(),{limitData:j}=t(),d=a();return e(r,{children:!!j&&o(m,Object.assign({className:l("flex gap-3",p)},{children:[e(i,{className:l("h-5 w-5 shrink-0",f),style:{color:x.accent}}),o("div",Object.assign({className:"flex flex-col gap-4"},{children:[e(c,{className:l(d.b2,"font-semibold",h),style:{color:x.text},html:j.html}),!!j.cta&&e("a",Object.assign({href:j.ctaLink,target:"_parent",rel:"noreferrer"},{children:e(n,Object.assign({variant:"primary",className:"min-h-[38px]",style:{minHeight:"38px"}},{children:j.cta}))}))]}))]}))})};export{p as default};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import{usePickaxe as s}from"../../hooks/pickaxe/usePickaxe.js";import{useState as l,useEffect as a}from"react";import{usePickaxeContext as r}from"../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as i}from"../../hooks/pickaxe/useResponseContext.js";import{generateId as m}from"../../common/utils.js";import c from"./Addons/Scroll/Provider.js";import n from"../Core/Skeleton.js";import p from"./Chat/index.js";import x from"./Form/index.js";import f from"../../common/cn.js";const d=({formId:d,className:u})=>{const{chatId:h,styles:w,colors:k,responsiveBy:j,deploymentType:g,isNewChat:N,setFormId:b,setChatId:v,setPickaxe:y}=r(),{setMessages:C,setResponse:O,setError:P,setLimitData:I,setStatus:F}=i(),[R,S]=l(!1),L=s();return a((()=>{b(d)}),[d]),a((()=>{if(!L.data)return;const e=L.data.chatflag;v(e?m(15):""),e?C([]):O(null),P(""),I(null),y(L.data),S(!0)}),[L.data]),a((()=>{C([]),O(null),F("idle"),I(null),P("")}),[h]),L.data?e("div",Object.assign({className:f("relative @container/pickaxe-root flex flex-col flex-grow w-full",!g&&"h-full","popup"===g&&h&&"h-full","dark"===w.theme&&"dark",u),style:Object.assign({backgroundColor:"chat-input"===g&&N?"transparent":k.primary,color:k.text},w.font&&"Real Head Pro"!==w.font&&{fontFamily:w.font})},{children:L.isLoading||!R?e("div",Object.assign({className:f("flex items-center flex-col w-full pt-12 px-4 pb-10","viewport"===j?"min-[767px]:pb-40":"@[767px]/pickaxe-root:pb-40")},{children:t("div",Object.assign({className:"flex w-full items-center max-w-[700px] flex-col"},{children:[e(n,{className:"w-[72px] h-[72px]"}),e(n,{className:"h-[20px] mt-6 w-full"}),e(n,{className:"h-[20px] mt-2 w-full"}),e(n,{className:"h-[20px] mt-2 w-full max-w-[400px]"}),e("div",Object.assign({className:"flex flex-col gap-y-8 w-full mt-6"},{children:e(n,{className:f("w-full min-h-[48px]","viewport"===j?"min-[767px]:max-w-[176px]":"@[767px]/pickaxe-root:max-w-[176px]")})}))]}))})):e(o,{children:e(c,h?{children:e(p,{})}:{children:e(x,{})})})})):null};export{d as Pickaxe};
1
+ import{jsx as e,jsxs as t,Fragment as o}from"react/jsx-runtime";import{usePickaxe as s}from"../../hooks/pickaxe/usePickaxe.js";import{useState as l,useEffect as a}from"react";import{usePickaxeContext as r}from"../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as i}from"../../hooks/pickaxe/useResponseContext.js";import{useDocumentContext as m}from"./Addons/Document/hooks/useDocumentContext.js";import{generateId as n}from"../../common/utils.js";import c from"./Addons/Scroll/Provider.js";import p from"../Core/Skeleton.js";import x from"./Chat/index.js";import f from"./Form/index.js";import d from"../../common/cn.js";const u=({formId:u,className:h})=>{const{chatId:k,styles:w,colors:j,responsiveBy:g,deploymentType:N,isNewChat:b,setFormId:v,setChatId:y,setSessionId:C,setPickaxe:I}=r(),{setMessages:O,setResponse:P,setError:D,setLimitData:S,setStatus:F}=i(),{setDocumentError:R}=m(),[A,E]=l(!1),L=s();return a((()=>{v(u)}),[u]),a((()=>{if(!L.data)return;const e=L.data.chatflag;y(e?n(15):""),C(n(15)),e?O([]):P(null),D(""),R(""),S(null),I(L.data),E(!0)}),[L.data]),a((()=>{D(""),R(""),S(null),O([]),P(null),F("idle")}),[k]),L.data?e("div",Object.assign({className:d("relative @container/pickaxe-root flex flex-col flex-grow w-full",!N&&"h-full","popup"===N&&k&&"h-full","dark"===w.theme&&"dark",h),style:Object.assign({backgroundColor:"chat-input"===N&&b?"transparent":j.primary,color:j.text},w.font&&"Real Head Pro"!==w.font&&{fontFamily:w.font})},{children:L.isLoading||!A?e("div",Object.assign({className:d("flex items-center flex-col w-full pt-12 px-4 pb-10","viewport"===g?"min-[767px]:pb-40":"@[767px]/pickaxe-root:pb-40")},{children:t("div",Object.assign({className:"flex w-full items-center max-w-[700px] flex-col"},{children:[e(p,{className:"w-[72px] h-[72px]"}),e(p,{className:"h-[20px] mt-6 w-full"}),e(p,{className:"h-[20px] mt-2 w-full"}),e(p,{className:"h-[20px] mt-2 w-full max-w-[400px]"}),e("div",Object.assign({className:"flex flex-col gap-y-8 w-full mt-6"},{children:e(p,{className:d("w-full min-h-[48px]","viewport"===g?"min-[767px]:max-w-[176px]":"@[767px]/pickaxe-root:max-w-[176px]")})}))]}))})):e(o,{children:e(c,k?{children:e(x,{})}:{children:e(f,{})})})})):null};export{u as Pickaxe};
@@ -0,0 +1 @@
1
+ export{Inline}from"../components/EmbedPreview/Inline.js";export{FAB,FABButton}from"../components/EmbedPreview/FAB.js";export{Popup,PopupCTAButton}from"../components/EmbedPreview/Popup.js";export{ChatInput,ChatInputWrapper}from"../components/EmbedPreview/ChatInput.js";
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../_virtual/_tslib.js";import{useMutation as s}from"@tanstack/react-query";const n=()=>s({mutationFn:s=>(({formId:s,responseId:n,documentId:t,studioUserId:o,deploymentId:i,embedUserId:d,pickaxe:c,value:r,valueObj:a,disabledDocumentIds:p,metadata:u})=>e(void 0,void 0,void 0,(function*(){const e="undefined"!=typeof window?window.location.hostname:"",l="undefined"!=typeof window?window.location.href:"",O=e.includes("pickaxe.co")&&!l.includes("https://studio.pickaxe.co/_embed"),b=yield fetch(`${process.env.NEXT_PUBLIC_API_URL}/pickaxe/sse`,Object.assign(Object.assign({method:"POST",body:JSON.stringify(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:s},n&&{responseId:n}),t&&{documentId:t}),o&&{studioUserId:o}),i&&{deploymentId:i}),d&&{embedUserId:d}),c&&{pickaxe:c}),r&&{value:r}),a&&{valueObj:a}),p&&{disabledDocumentIds:p}),u&&{metadata:u}))},(!process.env.NODE_ENV||"development"===process.env.NODE_ENV)&&Object.assign({},process.env.NEXT_PUBLIC_PICKAXE_SESSION_TOKEN&&{headers:{"x-pickaxe-session-token":process.env.NEXT_PUBLIC_PICKAXE_SESSION_TOKEN}})),O&&{credentials:"include"}));if(200!==b.status){const e=yield b.json();throw new Error(e.error||"Unknown error, please contact support")}if("application/json"===b.headers.get("content-type")){const{success:e,error:s}=yield b.json();if(!e)throw new Error(s||"Unknown error, please contact support")}return b})))(s)});export{n as useSubmit};
1
+ import{__awaiter as e}from"../../_virtual/_tslib.js";import{useMutation as s}from"@tanstack/react-query";const n=()=>s({mutationFn:s=>(({formId:s,responseId:n,documentIds:t,studioUserId:o,deploymentId:i,embedUserId:d,pickaxe:c,value:r,valueObj:a,disabledDocumentIds:p,metadata:u})=>e(void 0,void 0,void 0,(function*(){const e="undefined"!=typeof window?window.location.hostname:"",l="undefined"!=typeof window?window.location.href:"",O=e.includes("pickaxe.co")&&!l.includes("https://studio.pickaxe.co/_embed"),b=yield fetch(`${process.env.NEXT_PUBLIC_API_URL}/pickaxe/sse`,Object.assign(Object.assign({method:"POST",body:JSON.stringify(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:s},n&&{responseId:n}),t&&{documentIds:t}),o&&{studioUserId:o}),i&&{deploymentId:i}),d&&{embedUserId:d}),c&&{pickaxe:c}),r&&{value:r}),a&&{valueObj:a}),p&&{disabledDocumentIds:p}),u&&{metadata:u}))},(!process.env.NODE_ENV||"development"===process.env.NODE_ENV)&&Object.assign({},process.env.NEXT_PUBLIC_PICKAXE_SESSION_TOKEN&&{headers:{"x-pickaxe-session-token":process.env.NEXT_PUBLIC_PICKAXE_SESSION_TOKEN}})),O&&{credentials:"include"}));if(200!==b.status){const e=yield b.json();throw new Error(e.error||"Unknown error, please contact support")}if("application/json"===b.headers.get("content-type")){const{success:e,error:s}=yield b.json();if(!e)throw new Error(s||"Unknown error, please contact support")}return b})))(s)});export{n as useSubmit};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../_virtual/_tslib.js";import{generateId as s}from"../../common/utils.js";const o=()=>({document:({formId:s,workspaceId:o,responseId:n,file:t,isKnowledge:i,isBlocking:r})=>e(void 0,void 0,void 0,(function*(){var e,c;if(!process.env.NEXT_PUBLIC_MODAL_DOC_APP_URL)throw new Error("NEXT_PUBLIC_MODAL_DOC_APP_URL is not defined");const d=t.name.split(".").pop(),a=t.type,l=yield fetch(`${process.env.NEXT_PUBLIC_MODAL_DOC_APP_URL}/get_document_upload_url?formid=${s}&mimetype=${a}&extension=${d}`),p=yield l.json();if(!p.success)throw new Error(null!==(e=p.error)&&void 0!==e?e:"Failed to get presigned URL, try again or contact support.");const _=new FormData;Object.entries(Object.assign(Object.assign({},p.fields),{file:t})).forEach((([e,s])=>{_.append(e,s)}));const O=yield fetch(p.url,{method:"POST",body:_});if(!O.ok)throw new Error(O.statusText);const g=`${p.url}${p.fields.key}`;if("development"===process.env.NODE_ENV&&console.log("[S3URL]",g),a.startsWith("image"))return{success:!0,documentId:`IMAGE-${p.documentId}-${p.folder}`};const f=yield fetch(`${process.env.NEXT_PUBLIC_MODAL_DOC_APP_URL}/process_document`,{method:"POST",body:JSON.stringify(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:s},o&&{workspaceId:o}),{documentId:p.documentId}),n&&{responseId:n}),{fileName:t.name,fileSize:t.size}),i&&{isKnowledge:i}),r&&{isBlocking:r})),headers:{"Content-Type":"application/json"}}),m=yield f.json();if(!m.success)throw new Error(null!==(c=m.error)&&void 0!==c?c:"Failed processing document, try again or contact support.");return m})),website:({formId:o,workspaceId:n,responseId:t,website:i,isKnowledge:r,isBlocking:c})=>e(void 0,void 0,void 0,(function*(){var e;if(!process.env.NEXT_PUBLIC_MODAL_DOC_APP_URL)throw new Error("NEXT_PUBLIC_MODAL_DOC_APP_URL is not defined");const d=s(20),a=yield fetch(`${process.env.NEXT_PUBLIC_MODAL_DOC_APP_URL}/process_document`,{method:"POST",body:JSON.stringify(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:o},n&&{workspaceId:n}),{documentId:d}),t&&{responseId:t}),{website:i}),r&&{isKnowledge:r}),c&&{isBlocking:c})),headers:{"Content-Type":"application/json"}}),l=yield a.json();if(!l.success)throw new Error(null!==(e=l.error)&&void 0!==e?e:"Failed processing website, try again or contact support.");return l}))});export{o as useSubmitDocument};
1
+ import{__awaiter as e}from"../../_virtual/_tslib.js";import{generateId as s}from"../../common/utils.js";const o=()=>({document:({formId:s,workspaceId:o,responseId:n,file:i,isKnowledge:t,isBlocking:r,sessionId:c})=>e(void 0,void 0,void 0,(function*(){var e,d;if(!process.env.NEXT_PUBLIC_MODAL_DOC_APP_URL)throw new Error("NEXT_PUBLIC_MODAL_DOC_APP_URL is not defined");const a=i.name.split(".").pop(),l=i.type,p={formid:s,mimetype:l,extension:a,responseid:n,workspaceid:o,sessionid:c},_=new URLSearchParams(Object.entries(p).filter((e=>void 0!==e[1]))),O=`${process.env.NEXT_PUBLIC_MODAL_DOC_APP_URL}/get_document_upload_url?${_.toString()}`,g=yield fetch(O),f=yield g.json();if(!f.success)throw new Error(null!==(e=f.error)&&void 0!==e?e:"Failed to get presigned URL, try again or contact support.");const m=new FormData;Object.entries(Object.assign(Object.assign({},f.fields),{file:i})).forEach((([e,s])=>{m.append(e,s)}));const u=yield fetch(f.url,{method:"POST",body:m});if(!u.ok)throw new Error(u.statusText);const w=`${f.url}${f.fields.key}`;if("development"===process.env.NODE_ENV&&console.log("[S3URL]",w),l.startsWith("image"))return{success:!0,documentId:`IMAGE-${f.documentId}-${f.folder}`};const I=yield fetch(`${process.env.NEXT_PUBLIC_MODAL_DOC_APP_URL}/process_document`,{method:"POST",body:JSON.stringify(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:s},o&&{workspaceId:o}),{documentId:f.documentId}),n&&{responseId:n}),{fileName:i.name,fileSize:i.size}),t&&{isKnowledge:t}),r&&{isBlocking:r})),headers:{"Content-Type":"application/json"}}),P=yield I.json();if(!P.success)throw new Error(null!==(d=P.error)&&void 0!==d?d:"Failed processing document, try again or contact support.");return P})),website:({formId:o,workspaceId:n,responseId:i,website:t,isKnowledge:r,isBlocking:c})=>e(void 0,void 0,void 0,(function*(){var e;if(!process.env.NEXT_PUBLIC_MODAL_DOC_APP_URL)throw new Error("NEXT_PUBLIC_MODAL_DOC_APP_URL is not defined");const d=s(20),a=yield fetch(`${process.env.NEXT_PUBLIC_MODAL_DOC_APP_URL}/process_document`,{method:"POST",body:JSON.stringify(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:o},n&&{workspaceId:n}),{documentId:d}),i&&{responseId:i}),{website:t}),r&&{isKnowledge:r}),c&&{isBlocking:c})),headers:{"Content-Type":"application/json"}}),l=yield a.json();if(!l.success)throw new Error(null!==(e=l.error)&&void 0!==e?e:"Failed processing website, try again or contact support.");return l}))});export{o as useSubmitDocument};
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- export{Pickaxe}from"./components/Pickaxe/index.js";export{PickaxeContext,PickaxeProvider}from"./components/Pickaxe/Provider.js";export{ResponseContext}from"./components/Pickaxe/ResponseProvider.js";export{PickaxeMarkdown,PickaxeMarkdownContext}from"./components/Pickaxe/common/PickaxeMarkdown/index.js";export{PickaxeMarkdownRenderer}from"./components/Pickaxe/common/PickaxeMarkdown/Renderer.js";export{useConversation}from"./hooks/pickaxe/useConversation.js";export{useHistory}from"./hooks/pickaxe/useHistory.js";export{useInstantPickaxe,usePickaxe}from"./hooks/pickaxe/usePickaxe.js";export{usePickaxeContext}from"./hooks/pickaxe/usePickaxeContext.js";export{useResponseContext}from"./hooks/pickaxe/useResponseContext.js";export{useDimensionContext}from"./hooks/pickaxe/useDimensionContext.js";export{useSubmit}from"./hooks/pickaxe/useSubmit.js";export{useSubmitDocument}from"./hooks/pickaxe/useSubmitDocument.js";
1
+ export{Pickaxe}from"./components/Pickaxe/index.js";export{PickaxeContext,PickaxeProvider}from"./components/Pickaxe/Provider.js";export{ResponseContext}from"./components/Pickaxe/ResponseProvider.js";export{PickaxeMarkdown,PickaxeMarkdownContext}from"./components/Pickaxe/common/PickaxeMarkdown/index.js";export{PickaxeMarkdownRenderer}from"./components/Pickaxe/common/PickaxeMarkdown/Renderer.js";export{Inline}from"./components/EmbedPreview/Inline.js";export{FAB,FABButton}from"./components/EmbedPreview/FAB.js";export{Popup,PopupCTAButton}from"./components/EmbedPreview/Popup.js";export{ChatInput,ChatInputWrapper}from"./components/EmbedPreview/ChatInput.js";export{useConversation}from"./hooks/pickaxe/useConversation.js";export{useHistory}from"./hooks/pickaxe/useHistory.js";export{useInstantPickaxe,usePickaxe}from"./hooks/pickaxe/usePickaxe.js";export{usePickaxeContext}from"./hooks/pickaxe/usePickaxeContext.js";export{useResponseContext}from"./hooks/pickaxe/useResponseContext.js";export{useDimensionContext}from"./hooks/pickaxe/useDimensionContext.js";export{useSubmit}from"./hooks/pickaxe/useSubmit.js";export{useSubmitDocument}from"./hooks/pickaxe/useSubmitDocument.js";
@@ -1,7 +1,7 @@
1
1
  import type { ReactNode } from "react";
2
2
  import { PickaxeProps } from "../Pickaxe";
3
3
  import { IPickaxeProviderProps } from "../Pickaxe/Provider";
4
- type ChatInputProps = PickaxeProps & Omit<IPickaxeProviderProps, "deploymentType">;
4
+ type ChatInputProps = PickaxeProps & Omit<IPickaxeProviderProps, "children" | "deploymentType" | "isEmbed">;
5
5
  export declare const ChatInput: ({ formId, className, ...props }: ChatInputProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export declare const ChatInputWrapper: ({ children }: {
7
7
  children: ReactNode;
@@ -1,7 +1,7 @@
1
1
  import type { SetState } from "../../types/common";
2
2
  import { PickaxeProps } from "../Pickaxe";
3
3
  import { IPickaxeProviderProps } from "../Pickaxe/Provider";
4
- type FABProps = PickaxeProps & Omit<IPickaxeProviderProps, "deploymentType">;
4
+ type FABProps = PickaxeProps & Omit<IPickaxeProviderProps, "children" | "deploymentType" | "isEmbed">;
5
5
  export declare const FAB: ({ formId, className, ...props }: FABProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export declare const FABButton: ({ isOpen, setIsOpen, }: {
7
7
  isOpen: boolean;
@@ -1,5 +1,5 @@
1
1
  import { PickaxeProps } from "../Pickaxe";
2
2
  import { IPickaxeProviderProps } from "../Pickaxe/Provider";
3
- type InlineProps = PickaxeProps & Omit<IPickaxeProviderProps, "deploymentType">;
3
+ type InlineProps = PickaxeProps & Omit<IPickaxeProviderProps, "children" | "deploymentType" | "isEmbed">;
4
4
  export declare const Inline: ({ formId, className, ...props }: InlineProps) => import("react/jsx-runtime").JSX.Element;
5
5
  export {};
@@ -1,7 +1,7 @@
1
1
  import type { SetState } from "../../types/common";
2
2
  import { PickaxeProps } from "../Pickaxe";
3
3
  import { IPickaxeProviderProps } from "../Pickaxe/Provider";
4
- type PopupProps = PickaxeProps & Omit<IPickaxeProviderProps, "deploymentType">;
4
+ type PopupProps = PickaxeProps & Omit<IPickaxeProviderProps, "children" | "deploymentType" | "isEmbed">;
5
5
  export declare const Popup: ({ formId, className, ...props }: PopupProps) => import("react/jsx-runtime").JSX.Element;
6
6
  export declare const PopupCTAButton: ({ formId, setIsOpen, }: {
7
7
  formId: string;
@@ -9,8 +9,9 @@ type DocumentContextType = {
9
9
  isUploading: boolean;
10
10
  isShowList: boolean;
11
11
  editDocument: (newDocument: Partial<MemoryStoredDocument>) => void;
12
- editDocumentByDocId: (newDocument: Partial<MemoryStoredDocument>) => void;
13
12
  setDocuments: SetState<MemoryStoredDocument[]>;
13
+ addDocument: (newDocument: MemoryStoredDocument) => void;
14
+ removeDocument: (documentId: string) => void;
14
15
  setDocumentError: SetState<string>;
15
16
  setWebsiteLink: SetState<string>;
16
17
  setIsUploading: SetState<boolean>;
@@ -5,9 +5,8 @@ interface UseDocumentProps {
5
5
  }
6
6
  export declare const useDocument: ({ onQuestionChange }?: UseDocumentProps) => {
7
7
  isImageUploadAllowed: boolean;
8
- onFileUpload: (files: File[]) => Promise<MemoryStoredDocument | null>;
8
+ onFileUpload: (files: File[]) => Promise<null | undefined>;
9
9
  onWebsiteUpload: (website: string) => Promise<MemoryStoredDocument | null>;
10
- onEditDocumentByDocId: (newDocument: Partial<MemoryStoredDocument>) => void;
11
10
  documents: MemoryStoredDocument[];
12
11
  documentCount: number;
13
12
  documentError: string;
@@ -15,8 +14,9 @@ export declare const useDocument: ({ onQuestionChange }?: UseDocumentProps) => {
15
14
  isUploading: boolean;
16
15
  isShowList: boolean;
17
16
  editDocument: (newDocument: Partial<MemoryStoredDocument>) => void;
18
- editDocumentByDocId: (newDocument: Partial<MemoryStoredDocument>) => void;
19
17
  setDocuments: import("../../../../../types/common").SetState<MemoryStoredDocument[]>;
18
+ addDocument: (newDocument: MemoryStoredDocument) => void;
19
+ removeDocument: (documentId: string) => void;
20
20
  setDocumentError: import("../../../../../types/common").SetState<string>;
21
21
  setWebsiteLink: import("../../../../../types/common").SetState<string>;
22
22
  setIsUploading: import("../../../../../types/common").SetState<boolean>;
@@ -6,8 +6,9 @@ export declare const useDocumentContext: () => {
6
6
  isUploading: boolean;
7
7
  isShowList: boolean;
8
8
  editDocument: (newDocument: Partial<import("../../../../../types/document").MemoryStoredDocument>) => void;
9
- editDocumentByDocId: (newDocument: Partial<import("../../../../../types/document").MemoryStoredDocument>) => void;
10
9
  setDocuments: import("../../../../../types/common").SetState<import("../../../../../types/document").MemoryStoredDocument[]>;
10
+ addDocument: (newDocument: import("../../../../../types/document").MemoryStoredDocument) => void;
11
+ removeDocument: (documentId: string) => void;
11
12
  setDocumentError: import("../../../../../types/common").SetState<string>;
12
13
  setWebsiteLink: import("../../../../../types/common").SetState<string>;
13
14
  setIsUploading: import("../../../../../types/common").SetState<boolean>;
@@ -54,6 +54,7 @@ export type PickaxeDeploymentMisc = {
54
54
  type PickaxeContextType = {
55
55
  formId: string;
56
56
  chatId: string;
57
+ sessionId: string;
57
58
  userId: string;
58
59
  studioUserId: string;
59
60
  embedUserId: string;
@@ -80,6 +81,7 @@ type PickaxeContextType = {
80
81
  isDropShadow: boolean;
81
82
  setFormId: SetState<string>;
82
83
  setChatId: SetState<string>;
84
+ setSessionId: SetState<string>;
83
85
  setPickaxe: SetState<LimitedPickaxe | null>;
84
86
  setIsFontLoaded: SetState<boolean>;
85
87
  setIsNewChat: SetState<boolean>;
@@ -1,3 +1,3 @@
1
1
  import { ButtonProps } from "../../Core/Button";
2
- declare const PickaxeButton: ({ variant, className, ...props }: Omit<ButtonProps, "ref">) => import("react/jsx-runtime").JSX.Element;
2
+ declare const PickaxeButton: ({ variant, className, style, ...props }: Omit<ButtonProps, "ref">) => import("react/jsx-runtime").JSX.Element;
3
3
  export default PickaxeButton;
@@ -0,0 +1,5 @@
1
+ import "./styles/prose.css";
2
+ export * from "./components/EmbedPreview/Inline";
3
+ export * from "./components/EmbedPreview/FAB";
4
+ export * from "./components/EmbedPreview/Popup";
5
+ export * from "./components/EmbedPreview/ChatInput";
@@ -1,6 +1,7 @@
1
1
  export declare const usePickaxeContext: () => {
2
2
  formId: string;
3
3
  chatId: string;
4
+ sessionId: string;
4
5
  userId: string;
5
6
  studioUserId: string;
6
7
  embedUserId: string;
@@ -27,6 +28,7 @@ export declare const usePickaxeContext: () => {
27
28
  isDropShadow: boolean;
28
29
  setFormId: import("../../types/common").SetState<string>;
29
30
  setChatId: import("../../types/common").SetState<string>;
31
+ setSessionId: import("../../types/common").SetState<string>;
30
32
  setPickaxe: import("../../types/common").SetState<import("../../types/pickaxe").LimitedPickaxe | null>;
31
33
  setIsFontLoaded: import("../../types/common").SetState<boolean>;
32
34
  setIsNewChat: import("../../types/common").SetState<boolean>;
@@ -2,7 +2,7 @@ import type { Pickaxe } from "../../types/pickaxe";
2
2
  type MutationParams = {
3
3
  formId: string;
4
4
  responseId?: string;
5
- documentId?: string;
5
+ documentIds?: string[];
6
6
  studioUserId?: string;
7
7
  embedUserId?: string;
8
8
  deploymentId?: string;
@@ -1,11 +1,12 @@
1
1
  export declare const useSubmitDocument: () => {
2
- document: ({ formId, workspaceId, responseId, file, isKnowledge, isBlocking, }: {
2
+ document: ({ formId, workspaceId, responseId, file, isKnowledge, isBlocking, sessionId, }: {
3
3
  formId: string;
4
4
  workspaceId?: string | undefined;
5
5
  responseId?: string | undefined;
6
6
  file: File;
7
7
  isKnowledge?: boolean | undefined;
8
8
  isBlocking?: boolean | undefined;
9
+ sessionId: string;
9
10
  }) => Promise<{
10
11
  success: boolean;
11
12
  documentId: string;
@@ -4,6 +4,10 @@ export * from "./components/Pickaxe/Provider";
4
4
  export * from "./components/Pickaxe/ResponseProvider";
5
5
  export * from "./components/Pickaxe/common/PickaxeMarkdown";
6
6
  export * from "./components/Pickaxe/common/PickaxeMarkdown/Renderer";
7
+ export * from "./components/EmbedPreview/Inline";
8
+ export * from "./components/EmbedPreview/FAB";
9
+ export * from "./components/EmbedPreview/Popup";
10
+ export * from "./components/EmbedPreview/ChatInput";
7
11
  export * from "./hooks/pickaxe/useConversation";
8
12
  export * from "./hooks/pickaxe/useHistory";
9
13
  export * from "./hooks/pickaxe/usePickaxe";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pickaxeproject/react",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "description": "Client utility library for Pickaxe",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,6 +12,10 @@
12
12
  "import": "./dist/esm/index.js",
13
13
  "require": "./dist/cjs/index.js"
14
14
  },
15
+ "./embed": {
16
+ "import": "./dist/esm/embed/index.js",
17
+ "require": "./dist/cjs/embed/index.js"
18
+ },
15
19
  "./prose.css": "./dist/esm/prose.css"
16
20
  },
17
21
  "main": "dist/cjs/index.js",
@@ -66,6 +70,7 @@
66
70
  "@types/react": "^18.0.26",
67
71
  "@types/react-dom": "^18.0.10",
68
72
  "@types/react-syntax-highlighter": "^15.5.13",
73
+ "@types/uuid": "^10.0.0",
69
74
  "@types/webfontloader": "^1.6.38",
70
75
  "@typescript-eslint/eslint-plugin": "^5.48.1",
71
76
  "@typescript-eslint/parser": "^5.48.1",
@@ -119,6 +124,7 @@
119
124
  "typescript": "^4.9.4",
120
125
  "typescript-transform-paths": "^3.4.6",
121
126
  "unist-util-visit": "^5.0.0",
127
+ "uuid": "^11.1.0",
122
128
  "vite": "^6.0.7",
123
129
  "vite-plugin-svgr": "^4.3.0",
124
130
  "vite-tsconfig-paths": "^5.1.4",
@@ -155,6 +161,7 @@
155
161
  "tailwind-merge": "^2.6.0",
156
162
  "tailwind-scrollbar": "^3.1.0",
157
163
  "unist-util-visit": "^5.0.0",
164
+ "uuid": "^11.1.0",
158
165
  "webfontloader": "^1.6.28"
159
166
  },
160
167
  "engines": {