@pickaxeproject/react 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/.storybook/main.d.ts +3 -0
- package/dist/cjs/components/Core/Button.js +1 -0
- package/dist/cjs/components/Core/CopyButton.js +1 -1
- package/dist/cjs/components/Core/ErrorAlert.js +1 -1
- package/dist/cjs/components/Core/Tooltip.js +1 -1
- package/dist/cjs/components/Icons/attach.svg.js +1 -1
- package/dist/cjs/components/Pickaxe/Addons/Document/List.js +1 -1
- package/dist/cjs/components/Pickaxe/Chat/History/Message.js +1 -1
- package/dist/cjs/components/Pickaxe/Chat/History/index.js +1 -1
- package/dist/cjs/components/Pickaxe/Chat/Input.js +1 -1
- package/dist/cjs/components/Pickaxe/Chat/index.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/Head.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/History/Container.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/History/Item.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/History/Response.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/NewChat.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/Questions/Document.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/Questions/Input.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/Questions/Option.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/Questions/Submit.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/index.js +1 -1
- package/dist/cjs/components/Pickaxe/InfoModal.js +1 -1
- package/dist/cjs/components/Pickaxe/Provider.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeButton.js +1 -0
- package/dist/cjs/components/Pickaxe/index.js +1 -1
- package/dist/cjs/hooks/studio/useStyleButton.js +1 -0
- package/dist/cjs/hooks/studio/useStyleInput.js +1 -0
- package/dist/cjs/index.js +1 -1
- package/dist/{esm → cjs/src}/components/Pickaxe/Provider.d.ts +14 -2
- package/dist/cjs/src/components/Pickaxe/__stories__/Pickaxe.stories.d.ts +7 -0
- package/dist/cjs/src/components/Pickaxe/__stories__/PickaxeStoryWrapper.d.ts +4 -0
- package/dist/cjs/src/components/Pickaxe/common/PickaxeButton.d.ts +3 -0
- package/dist/cjs/{components → src/components}/Pickaxe/index.d.ts +1 -1
- package/dist/cjs/{hooks → src/hooks}/pickaxe/usePickaxeContext.d.ts +1 -0
- package/dist/cjs/src/hooks/studio/useStyleButton.d.ts +7 -0
- package/dist/cjs/src/hooks/studio/useStyleInput.d.ts +2 -0
- package/dist/cjs/src/index.d.ts +11 -0
- package/dist/cjs/src/types/studio.d.ts +3 -0
- package/dist/esm/.storybook/main.d.ts +3 -0
- package/dist/esm/components/Core/Button.js +1 -0
- package/dist/esm/components/Core/CopyButton.js +1 -1
- package/dist/esm/components/Core/ErrorAlert.js +1 -1
- package/dist/esm/components/Core/Tooltip.js +1 -1
- package/dist/esm/components/Icons/attach.svg.js +1 -1
- package/dist/esm/components/Pickaxe/Addons/Document/List.js +1 -1
- package/dist/esm/components/Pickaxe/Chat/History/Message.js +1 -1
- package/dist/esm/components/Pickaxe/Chat/History/index.js +1 -1
- package/dist/esm/components/Pickaxe/Chat/Input.js +1 -1
- package/dist/esm/components/Pickaxe/Chat/index.js +1 -1
- package/dist/esm/components/Pickaxe/Form/Head.js +1 -1
- package/dist/esm/components/Pickaxe/Form/History/Container.js +1 -1
- package/dist/esm/components/Pickaxe/Form/History/Item.js +1 -1
- package/dist/esm/components/Pickaxe/Form/History/Response.js +1 -1
- package/dist/esm/components/Pickaxe/Form/NewChat.js +1 -1
- package/dist/esm/components/Pickaxe/Form/Questions/Document.js +1 -1
- package/dist/esm/components/Pickaxe/Form/Questions/Input.js +1 -1
- package/dist/esm/components/Pickaxe/Form/Questions/Option.js +1 -1
- package/dist/esm/components/Pickaxe/Form/Questions/Submit.js +1 -1
- package/dist/esm/components/Pickaxe/Form/index.js +1 -1
- package/dist/esm/components/Pickaxe/InfoModal.js +1 -1
- package/dist/esm/components/Pickaxe/Provider.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeButton.js +1 -0
- package/dist/esm/components/Pickaxe/index.js +1 -1
- package/dist/esm/hooks/studio/useStyleButton.js +1 -0
- package/dist/esm/hooks/studio/useStyleInput.js +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/{cjs → esm/src}/components/Pickaxe/Provider.d.ts +14 -2
- package/dist/esm/src/components/Pickaxe/__stories__/Pickaxe.stories.d.ts +7 -0
- package/dist/esm/src/components/Pickaxe/__stories__/PickaxeStoryWrapper.d.ts +4 -0
- package/dist/esm/src/components/Pickaxe/common/PickaxeButton.d.ts +3 -0
- package/dist/esm/{components → src/components}/Pickaxe/index.d.ts +1 -1
- package/dist/esm/{hooks → src/hooks}/pickaxe/usePickaxeContext.d.ts +1 -0
- package/dist/esm/src/hooks/studio/useStyleButton.d.ts +7 -0
- package/dist/esm/src/hooks/studio/useStyleInput.d.ts +2 -0
- package/dist/esm/src/index.d.ts +11 -0
- package/dist/esm/src/types/studio.d.ts +3 -0
- package/package.json +24 -3
- package/dist/cjs/index.d.ts +0 -3
- package/dist/esm/index.d.ts +0 -3
- /package/dist/cjs/{common → src/common}/api/index.d.ts +0 -0
- /package/dist/cjs/{common → src/common}/api/streamer.d.ts +0 -0
- /package/dist/cjs/{common → src/common}/api/utils.d.ts +0 -0
- /package/dist/cjs/{common → src/common}/cn.d.ts +0 -0
- /package/dist/cjs/{common → src/common}/documents.d.ts +0 -0
- /package/dist/cjs/{common → src/common}/error.d.ts +0 -0
- /package/dist/cjs/{common → src/common}/renderer.d.ts +0 -0
- /package/dist/cjs/{common → src/common}/utils.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Core/Button.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Core/CopyButton.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Core/ErrorAlert.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Core/HtmlRenderer.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Core/MarkdownRenderer.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Core/Menu/Button.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Core/Menu/List.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Core/Menu/index.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Core/Modal/Body.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Core/Modal/CloseButton.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Core/Modal/index.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Core/PickaxeIcon.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Core/ScrollArea.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Core/Skeleton.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Core/Textarea.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Core/Tooltip.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Addons/Document/List.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Addons/Document/Provider.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Addons/Document/hooks/useDocument.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Addons/Document/hooks/useDocumentContext.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Addons/IceBreaker/Breaker.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Addons/IceBreaker/index.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Addons/Scroll/Provider.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Addons/Scroll/ScrollLockView.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Addons/Scroll/hooks/useScroll.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Addons/Scroll/hooks/useScrollContext.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Chat/History/Message.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Chat/History/index.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Chat/Input.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Chat/index.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Form/Head.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Form/History/Container.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Form/History/Item.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Form/History/Response.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Form/History/index.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Form/NewChat.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Form/Questions/Checkbox.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Form/Questions/Document.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Form/Questions/Dropdown.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Form/Questions/Input.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Form/Questions/Option.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Form/Questions/Submit.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Form/Questions/index.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/Form/index.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/InfoModal.d.ts +0 -0
- /package/dist/cjs/{components → src/components}/Pickaxe/ResponseProvider.d.ts +0 -0
- /package/dist/cjs/{hooks → src/hooks}/core/useHover.d.ts +0 -0
- /package/dist/cjs/{hooks → src/hooks}/core/useMediaQuery.d.ts +0 -0
- /package/dist/cjs/{hooks → src/hooks}/core/useOutsideAlerter.d.ts +0 -0
- /package/dist/cjs/{hooks → src/hooks}/pickaxe/useConversation.d.ts +0 -0
- /package/dist/cjs/{hooks → src/hooks}/pickaxe/useHistory.d.ts +0 -0
- /package/dist/cjs/{hooks → src/hooks}/pickaxe/usePickaxe.d.ts +0 -0
- /package/dist/cjs/{hooks → src/hooks}/pickaxe/useResponseContext.d.ts +0 -0
- /package/dist/cjs/{hooks → src/hooks}/pickaxe/useSubmit.d.ts +0 -0
- /package/dist/cjs/{hooks → src/hooks}/pickaxe/useSubmitDocument.d.ts +0 -0
- /package/dist/cjs/{hooks → src/hooks}/pickaxe/useSubmitResult.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/chat.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/common.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/document.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/form.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/history.d.ts +0 -0
- /package/dist/cjs/{types → src/types}/pickaxe.d.ts +0 -0
- /package/dist/esm/{common → src/common}/api/index.d.ts +0 -0
- /package/dist/esm/{common → src/common}/api/streamer.d.ts +0 -0
- /package/dist/esm/{common → src/common}/api/utils.d.ts +0 -0
- /package/dist/esm/{common → src/common}/cn.d.ts +0 -0
- /package/dist/esm/{common → src/common}/documents.d.ts +0 -0
- /package/dist/esm/{common → src/common}/error.d.ts +0 -0
- /package/dist/esm/{common → src/common}/renderer.d.ts +0 -0
- /package/dist/esm/{common → src/common}/utils.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Core/Button.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Core/CopyButton.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Core/ErrorAlert.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Core/HtmlRenderer.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Core/MarkdownRenderer.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Core/Menu/Button.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Core/Menu/List.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Core/Menu/index.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Core/Modal/Body.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Core/Modal/CloseButton.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Core/Modal/index.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Core/PickaxeIcon.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Core/ScrollArea.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Core/Skeleton.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Core/Textarea.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Core/Tooltip.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Addons/Document/List.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Addons/Document/Provider.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Addons/Document/hooks/useDocument.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Addons/Document/hooks/useDocumentContext.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Addons/IceBreaker/Breaker.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Addons/IceBreaker/index.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Addons/Scroll/Provider.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Addons/Scroll/ScrollLockView.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Addons/Scroll/hooks/useScroll.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Addons/Scroll/hooks/useScrollContext.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Chat/History/Message.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Chat/History/index.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Chat/Input.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Chat/index.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Form/Head.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Form/History/Container.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Form/History/Item.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Form/History/Response.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Form/History/index.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Form/NewChat.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Form/Questions/Checkbox.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Form/Questions/Document.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Form/Questions/Dropdown.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Form/Questions/Input.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Form/Questions/Option.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Form/Questions/Submit.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Form/Questions/index.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/Form/index.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/InfoModal.d.ts +0 -0
- /package/dist/esm/{components → src/components}/Pickaxe/ResponseProvider.d.ts +0 -0
- /package/dist/esm/{hooks → src/hooks}/core/useHover.d.ts +0 -0
- /package/dist/esm/{hooks → src/hooks}/core/useMediaQuery.d.ts +0 -0
- /package/dist/esm/{hooks → src/hooks}/core/useOutsideAlerter.d.ts +0 -0
- /package/dist/esm/{hooks → src/hooks}/pickaxe/useConversation.d.ts +0 -0
- /package/dist/esm/{hooks → src/hooks}/pickaxe/useHistory.d.ts +0 -0
- /package/dist/esm/{hooks → src/hooks}/pickaxe/usePickaxe.d.ts +0 -0
- /package/dist/esm/{hooks → src/hooks}/pickaxe/useResponseContext.d.ts +0 -0
- /package/dist/esm/{hooks → src/hooks}/pickaxe/useSubmit.d.ts +0 -0
- /package/dist/esm/{hooks → src/hooks}/pickaxe/useSubmitDocument.d.ts +0 -0
- /package/dist/esm/{hooks → src/hooks}/pickaxe/useSubmitResult.d.ts +0 -0
- /package/dist/esm/{types → src/types}/chat.d.ts +0 -0
- /package/dist/esm/{types → src/types}/common.d.ts +0 -0
- /package/dist/esm/{types → src/types}/document.d.ts +0 -0
- /package/dist/esm/{types → src/types}/form.d.ts +0 -0
- /package/dist/esm/{types → src/types}/history.d.ts +0 -0
- /package/dist/esm/{types → src/types}/pickaxe.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useState as
|
|
1
|
+
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useState as a,useMemo as t}from"react";import{usePickaxeContext as l}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as i}from"../../../../hooks/pickaxe/useResponseContext.js";import{useConversation as o}from"../../../../hooks/pickaxe/useConversation.js";import c from"../../../Icons/circle-info.svg.js";import n from"../../../Core/PickaxeIcon.js";import r from"../../Addons/Scroll/ScrollLockView.js";import m from"../../InfoModal.js";import d from"./Message.js";import p from"../../../../common/cn.js";import f from"../../../Core/HtmlRenderer.js";const x=()=>{var x;const{pickaxe:u,colors:g,isNewChat:h}=l(),{messages:b,status:v,error:j}=i(),w=o(),[N,y]=a(!1),k=t((()=>!!w.data&&!(w.data.messages.length<=1)),[w.data]),O=t((()=>w.isSuccess&&h&&!k),[w.isSuccess,h,k]);return e("div",Object.assign({className:"relative flex flex-grow flex-col justify-end"},{children:[N&&s(m,{isOpen:N,onChangeIsOpen:y}),e("div",Object.assign({className:p("absolute left-1/2 top-5 flex w-full max-w-[400px] -translate-x-1/2 -translate-y-1/3 transform flex-col items-center px-4 opacity-0 duration-300",O&&"top-1/3 opacity-100")},{children:[s(n,{src:null==u?void 0:u.coverphoto,alt:`${null==u?void 0:u.formtitle}'s Profile Picture`,width:64,height:64,className:"h-16 w-16 rounded-full"}),e("div",Object.assign({className:"flex flex-col items-center"},{children:[e("h2",Object.assign({className:"mt-6 text-center text-lg font-semibold opacity-70 max-[767px]:text-base"},{children:[`${null==u?void 0:u.formtitle.slice(0,130)}${(null!==(x=null==u?void 0:u.formtitle)&&void 0!==x?x:"").length>130?"...":""}`,s("button",Object.assign({className:"ml-2 inline-block outline-none hover:opacity-70 hover:duration-300 active:opacity-100",onClick:()=>y(!0)},{children:s(c,{className:"h-5 w-5 shrink-0",style:{color:g.accent}})}))]})),s("p",Object.assign({className:"mt-2 line-clamp-3 whitespace-pre-line max-w-[600px] text-center font-semilight opacity-70"},{children:null==u?void 0:u.formdescription}))]}))]})),s("div",Object.assign({className:"flex w-full justify-center"},{children:w.isLoading?e("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[s("div",{className:"h-10 w-[70%] animate-pulse justify-self-end rounded bg-gray-200"}),s("div",{className:"h-[150px] w-[70%] animate-pulse rounded bg-gray-200"}),s("div",{className:"h-10 w-[50%] animate-pulse justify-self-end rounded bg-gray-200"})]})):w.isError?s("div",Object.assign({className:"flex w-full max-w-[800px] justify-center pt-10"},{children:e("p",Object.assign({className:"text-center text-xl font-semibold"},{children:["Something went wrong. Please try again, or"," ",s("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help"},{children:"contact us"}))," ","for help."]}))})):e("div",Object.assign({className:"relative grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-4 pt-10 max-[767px]:pt-6"},{children:[w.data.messages.map(((e,a)=>s(d,{message:e},a))),b.map(((e,a)=>s(d,{message:e},a))),"fetching"===v?e("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:["NONE"!==(null==u?void 0:u.chaticon)&&s(n,{src:null==u?void 0:u.chaticon,alt:`${null==u?void 0:u.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6"}),e("div",Object.assign({className:"flex items-center gap-x-2 rounded bg-blue-100/50 px-4 py-4"},{children:[s("div",{className:"h-1.5 w-1.5 animate-dot rounded-full bg-black/60"}),s("div",{className:"h-1.5 w-1.5 animate-dot-down rounded-full bg-black/60"}),s("div",{className:"h-1.5 w-1.5 animate-dot rounded-full bg-black/60"})]}))]})):j?e("div",Object.assign({className:"flex max-w-[80%] gap-x-3"},{children:[s(c,{className:"mt-2 h-6 w-6 shrink-0 text-red-500"}),s(f,{className:"x-4 py-2 font-semibold text-red-500",html:j})]})):null,s(r,{className:"absolute bottom-0 left-0 w-full"})]}))}))]}))};export{x 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,useRef as r}from"react";import{useMediaQuery as n}from"../../../hooks/core/useMediaQuery.js";import{usePickaxeContext as i}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as a}from"../../../hooks/pickaxe/useResponseContext.js";import{useConversation as l}from"../../../hooks/pickaxe/useConversation.js";import{useSubmit as d}from"../../../hooks/pickaxe/useSubmit.js";import{useSubmitResult as c}from"../../../hooks/pickaxe/useSubmitResult.js";import{useDocument as m}from"../Addons/Document/hooks/useDocument.js";import{useScroll as u}from"../Addons/Scroll/hooks/useScroll.js";import{allowedFileMimeTypes as p,allowedImageMimeTypes as f}from"../../../common/documents.js";import{streamer as h}from"../../../common/api/streamer.js";import g from"../../../node_modules/.pnpm/react-textarea-autosize@8.5.7_@types_react@18.3.18_react@18.3.1/node_modules/react-textarea-autosize/dist/react-textarea-autosize.esm.js";import x from"../../Icons/attach.svg.js";import v from"../../Icons/send.svg.js";import b from"../Addons/IceBreaker/index.js";import k from"../../../common/error.js";import w from"../../../common/cn.js";const y=()=>{var y,I,j,A;const{formId:D,chatId:S,pickaxe:N,colors:C,isNewChat:E,setIsNewChat:O}=i(),{messages:R,status:U,setMessage:_,setStatus:z,setError:B}=a(),{documents:F,isUploading:M,isImageUploadAllowed:K,upsertDocuments:L,onFileUpload:P,onEditDocumentByDocId:T}=m(),{isScrollIncreasing:W,scrollToBottom:H,scrollStart:Q,scrollEnd:Y}=u(),q=l(),G=d(),J=c(),[V,X]=s(""),Z=r(null),[$]=n("(max-width: 767px)"),ee=o=>e(void 0,void 0,void 0,(function*(){try{if(M)return;B(""),O(!1);const e=null!=o?o:V;if(!e||"fetching"===U||"streaming"===U)return;const t=new Date;X("");const s="enduserupload"===(null==N?void 0:N.documentuploadtype),r=F.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),n=r.length?r[r.length-1].documentId:"";z("fetching"),_({id:R.length+1,role:"user",content:e});const{success:i,data:a,usedDocumentIds:l,newDocumentId:d,newDocumentName:c,isInsertedFile:m,error:u}=yield G.mutateAsync(Object.assign({formId:D,responseId:S,value:e},s&&n&&{documentId:n}));if(!i)throw new Error(null!=u?u:"An error occurred, please try again.");m&&n&&T({documentId:n,isInsertedAsRaw:!0}),d&&c&&L([{type:"website",id:c,name:c,status:"finished",documentId:d}]),Q(),H();const p=(yield h({formId:D,responseId:S,data:a})).body;if(!p)throw new Error("Streaming error");const f=p.getReader(),g=new TextDecoder;let x="",v=!0;for(;v;){const{value:e,done:o}=yield f.read();v=!o;if(x+=g.decode(e),x)z("streaming"),_({id:R.length+2,role:"assistant",content:x}),W&&H();else if(!v&&!x)throw new Error("Server error")}const b=new Date;x&&(H(),z("idle"),yield J.mutateAsync({formId:D,responseId:S,documentIds:l,studioUserId:"USER68RFBSHU4YS2I4L",messages:[{role:"user",message:e,sentAt:t},{role:"assistant",message:x,sentAt:b}]}))}catch(e){let o=k(e);o.includes("Unexpected token 'A',")&&(o="Oops! We're experiencing high traffic at the moment. Please try again later."),B(o),H()}finally{z("idle"),Y()}}));return o("div",Object.assign({className:"relative flex w-full flex-col max-[767px]:fixed max-[767px]:bottom-0 max-[767px]:left-0"},{children:[E&&N&&!q.isLoading&&(null!==(I=null===(y=q.data)||void 0===y?void 0:y.messages.length)&&void 0!==I?I:0)<=1&&N.icebreakers&&N.icebreakers.length>0&&t(b,{data:null!==(j=N.icebreakers)&&void 0!==j?j:[],style:{color:"#000000"},isMobile:$,onSend:ee}),o("div",Object.assign({className:"flex min-h-
|
|
1
|
+
import{__awaiter as e}from"../../../_virtual/_tslib.js";import{jsxs as o,jsx as t}from"react/jsx-runtime";import{useState as s,useRef as r}from"react";import{useMediaQuery as n}from"../../../hooks/core/useMediaQuery.js";import{usePickaxeContext as i}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as a}from"../../../hooks/pickaxe/useResponseContext.js";import{useConversation as l}from"../../../hooks/pickaxe/useConversation.js";import{useSubmit as d}from"../../../hooks/pickaxe/useSubmit.js";import{useSubmitResult as c}from"../../../hooks/pickaxe/useSubmitResult.js";import{useDocument as m}from"../Addons/Document/hooks/useDocument.js";import{useScroll as u}from"../Addons/Scroll/hooks/useScroll.js";import{allowedFileMimeTypes as p,allowedImageMimeTypes as f}from"../../../common/documents.js";import{streamer as h}from"../../../common/api/streamer.js";import g from"../../../node_modules/.pnpm/react-textarea-autosize@8.5.7_@types_react@18.3.18_react@18.3.1/node_modules/react-textarea-autosize/dist/react-textarea-autosize.esm.js";import x from"../../Icons/attach.svg.js";import v from"../../Icons/send.svg.js";import b from"../Addons/IceBreaker/index.js";import k from"../../../common/error.js";import w from"../../../common/cn.js";const y=()=>{var y,I,j,A;const{formId:D,chatId:S,pickaxe:N,colors:C,isNewChat:E,setIsNewChat:O}=i(),{messages:R,status:U,setMessage:_,setStatus:z,setError:B}=a(),{documents:F,isUploading:M,isImageUploadAllowed:K,upsertDocuments:L,onFileUpload:P,onEditDocumentByDocId:T}=m(),{isScrollIncreasing:W,scrollToBottom:H,scrollStart:Q,scrollEnd:Y}=u(),q=l(),G=d(),J=c(),[V,X]=s(""),Z=r(null),[$]=n("(max-width: 767px)"),ee=o=>e(void 0,void 0,void 0,(function*(){try{if(M)return;B(""),O(!1);const e=null!=o?o:V;if(!e||"fetching"===U||"streaming"===U)return;const t=new Date;X("");const s="enduserupload"===(null==N?void 0:N.documentuploadtype),r=F.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),n=r.length?r[r.length-1].documentId:"";z("fetching"),_({id:R.length+1,role:"user",content:e});const{success:i,data:a,usedDocumentIds:l,newDocumentId:d,newDocumentName:c,isInsertedFile:m,error:u}=yield G.mutateAsync(Object.assign({formId:D,responseId:S,value:e},s&&n&&{documentId:n}));if(!i)throw new Error(null!=u?u:"An error occurred, please try again.");m&&n&&T({documentId:n,isInsertedAsRaw:!0}),d&&c&&L([{type:"website",id:c,name:c,status:"finished",documentId:d}]),Q(),H();const p=(yield h({formId:D,responseId:S,data:a})).body;if(!p)throw new Error("Streaming error");const f=p.getReader(),g=new TextDecoder;let x="",v=!0;for(;v;){const{value:e,done:o}=yield f.read();v=!o;if(x+=g.decode(e),x)z("streaming"),_({id:R.length+2,role:"assistant",content:x}),W&&H();else if(!v&&!x)throw new Error("Server error")}const b=new Date;x&&(H(),z("idle"),yield J.mutateAsync({formId:D,responseId:S,documentIds:l,studioUserId:"USER68RFBSHU4YS2I4L",messages:[{role:"user",message:e,sentAt:t},{role:"assistant",message:x,sentAt:b}]}))}catch(e){let o=k(e);o.includes("Unexpected token 'A',")&&(o="Oops! We're experiencing high traffic at the moment. Please try again later."),B(o),H()}finally{z("idle"),Y()}}));return o("div",Object.assign({className:"relative flex w-full flex-col max-[767px]:fixed max-[767px]:bottom-0 max-[767px]:left-0"},{children:[E&&N&&!q.isLoading&&(null!==(I=null===(y=q.data)||void 0===y?void 0:y.messages.length)&&void 0!==I?I:0)<=1&&N.icebreakers&&N.icebreakers.length>0&&t(b,{data:null!==(j=N.icebreakers)&&void 0!==j?j:[],style:{color:"#000000"},isMobile:$,onSend:ee}),o("div",Object.assign({className:"flex min-h-[56px] items-end gap-x-2 bg-white px-4 py-3 pb-[15px] shadow"},{children:["enduserupload"===(null==N?void 0:N.documentuploadtype)&&o("div",Object.assign({className:"tooltip"},{children:[t("input",{id:"file-upload",ref:Z,type:"file",accept:[...p,...K?f:[]].join(", "),multiple:!0,hidden:!0,className:"hidden",onChange:o=>e(void 0,void 0,void 0,(function*(){yield P(Array.from(o.target.files||[])),o.target.value=""}))}),t("button",Object.assign({className:"flex items-center disabled:cursor-wait disabled:opacity-50",disabled:M,onClick:()=>{var e;return null===(e=Z.current)||void 0===e?void 0:e.click()}},{children:t(x,{className:"h-6 w-6 shrink-0 stroke-2",style:{color:C.accent}})}))]})),t(g,{className:w("max-h-60 w-full resize-none border-black bg-transparent outline-none ring-0 scrollbar scrollbar-thin placeholder:font-semilight",!V.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap"),value:V,placeholder:null!==(A=null==N?void 0:N.placeholdertext)&&void 0!==A?A:"What do you want to talk about?",onChange:e=>X(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||(e.preventDefault(),ee())}}),t("button",Object.assign({className:"outline-none disabled:cursor-default disabled:opacity-50",disabled:"idle"!==U||M,onClick:()=>ee()},{children:t(v,{className:"h-6 w-6 shrink-0 stroke-2",style:{color:C.accent}})}))]}))]}))};export{y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{usePickaxeContext as l}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useScroll as r}from"../Addons/Scroll/hooks/useScroll.js";import s from"../../Core/ScrollArea.js";import t from"../Addons/Document/List.js";import i from"./History/index.js";import
|
|
1
|
+
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{usePickaxeContext as l}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useScroll as r}from"../Addons/Scroll/hooks/useScroll.js";import s from"../../Core/ScrollArea.js";import t from"../Addons/Document/List.js";import i from"./History/index.js";import m from"./Input.js";import c from"../../../common/cn.js";const a=()=>{const{pickaxe:a,isShowIceBreaker:n}=l(),{scrollContainerRef:f}=r();return e("div",Object.assign({className:"relative flex flex-grow flex-col items-center"},{children:o("div",Object.assign({className:"relative flex w-full max-w-[800px] flex-grow flex-col"},{children:["enduserupload"===(null==a?void 0:a.documentuploadtype)&&e(t,{className:"absolute z-10 mt-4"}),e("div",Object.assign({className:c("flex w-full flex-grow flex-col pb-24 max-[767px]:pb-[4.5rem]",n&&"pb-44 max-[767px]:pb-40")},{children:e(s,Object.assign({ref:f,hideScrollbar:!0},{children:e(i,{})}))})),e("div",Object.assign({className:"absolute bottom-0 mb-6 mt-4 flex w-full justify-center max-[767px]:m-0"},{children:e(m,{})}))]}))}))};export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as i}from"react";import{usePickaxeContext as o}from"../../../hooks/pickaxe/usePickaxeContext.js";import l from"../../Icons/circle-info.svg.js";import n from"../../Core/PickaxeIcon.js";import c from"../InfoModal.js";const s=()=>{var s;const{pickaxe:r}=o(),[a,m]=i(!1);return e("div",Object.assign({className:"flex flex-col items-center"},{children:[a&&t(c,{isOpen:a,onChangeIsOpen:m}),t(n,{src:null==r?void 0:r.coverphoto,alt:`${null==r?void 0:r.formtitle}'s Profile Picture`,width:90,height:90,className:"h-[90px] w-[90px] rounded-full"}),e("h2",Object.assign({className:"mt-6 text-center text-[18px] font-semibold
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as i}from"react";import{usePickaxeContext as o}from"../../../hooks/pickaxe/usePickaxeContext.js";import l from"../../Icons/circle-info.svg.js";import n from"../../Core/PickaxeIcon.js";import c from"../InfoModal.js";const s=()=>{var s;const{pickaxe:r}=o(),[a,m]=i(!1);return e("div",Object.assign({className:"flex flex-col items-center"},{children:[a&&t(c,{isOpen:a,onChangeIsOpen:m}),t(n,{src:null==r?void 0:r.coverphoto,alt:`${null==r?void 0:r.formtitle}'s Profile Picture`,width:90,height:90,className:"h-[90px] w-[90px] rounded-full"}),e("h2",Object.assign({className:"mt-6 text-center text-[18px] font-semibold opacity-70 max-[767px]:text-base"},{children:[`${null==r?void 0:r.formtitle.slice(0,130)}${(null!==(s=null==r?void 0:r.formtitle)&&void 0!==s?s:"").length>130?"...":""}`,t("button",Object.assign({className:"ml-2 inline-block outline-none hover:opacity-70 hover:duration-300 active:opacity-100",onClick:()=>m(!0)},{children:t(l,{className:"h-5 w-5 shrink-0 text-c-blue"})}))]})),t("p",Object.assign({className:"mt-2 max-w-[600px] line-clamp-3 whitespace-pre-line text-center font-semilight opacity-70"},{children:null==r?void 0:r.formdescription}))]}))};export{s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as s}from"react/jsx-runtime";import{Fragment as i}from"react";import{useInView as a}from"react-intersection-observer";import{usePickaxeContext as t}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useHistory as r}from"../../../../hooks/pickaxe/useHistory.js";import o from"../../../Icons/spinner-circle.svg.js";import n from"./Item.js";const c=()=>{var c;const{colors:l,isShowHistory:m}=t(),p=r({enabled:m}),{ref:d}=a({onChange(e){e&&p.hasNextPage&&p.fetchNextPage()}});return m&&p.isLoading?e("div",{className:"w-full animate-pulse bg-gray-200"
|
|
1
|
+
import{jsx as e,jsxs as s}from"react/jsx-runtime";import{Fragment as i}from"react";import{useInView as a}from"react-intersection-observer";import{usePickaxeContext as t}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useHistory as r}from"../../../../hooks/pickaxe/useHistory.js";import o from"../../../Icons/spinner-circle.svg.js";import n from"./Item.js";const c=()=>{var c;const{colors:l,isShowHistory:m}=t(),p=r({enabled:m}),{ref:d}=a({onChange(e){e&&p.hasNextPage&&p.fetchNextPage()}});return m&&p.isLoading?e("div",{className:"w-full min-h-[300px] animate-pulse bg-gray-200"}):p.isError?e("div",{}):m?s("div",Object.assign({className:"flex flex-col gap-y-8"},{children:[null===(c=p.data)||void 0===c?void 0:c.pages.map(((s,a)=>e(i,{children:s.data.map((s=>e(i,{children:e(n,{item:s})},s.responseId)))},a))),e("div",Object.assign({className:"flex items-center justify-center"},{children:p.isFetchingNextPage?e(o,{className:"my-10 h-14 w-14 animate-spin animate-spin text-gray-300",style:{fill:l.accent}}):p.hasNextPage?e("div",{ref:d,className:"invisible h-14 w-14"}):null}))]})):null};export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useMemo as t}from"react";import{usePickaxeContext as o}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{format as l}from"date-fns";import r from"../../../Icons/message-square-notes.svg.js";import a from"../../../Icons/visitor.svg.js";import i from"../../../Core/PickaxeIcon.js";import n from"../../../Core/CopyButton.js";import c from"../../../Core/MarkdownRenderer.js";const d=({item:d})=>{const{pickaxe:m,colors:p,setChatId:h,setIsNewChat:f}=o(),u=t((()=>l(d.createdAt,"hh:mm a MMM dd, yy")),[d]),g=t((()=>d&&d.messages?d.messages.length:0),[d]),x=t((()=>{var e,s,t,o;if("form"===d.type){return(null!==(e=d.questions)&&void 0!==e?e:[]).map((e=>`<div style="display: flex; flex-direction: column; margin-bottom: 1em;">\n <p style="font-weight: 500;">${e.question}</p>\n <p>${e.answer||"n/a"}</p>\n</div>`)).join("")}return null!==(o=null===(t=null===(s=d.messages)||void 0===s?void 0:s[0])||void 0===t?void 0:t.message)&&void 0!==o?o:""}),[d]),v=t((()=>{var e,s,t,o;return"form"===d.type?null!==(e=d.questionResponse)&&void 0!==e?e:"":null!==(o=null===(t=null===(s=d.messages)||void 0===s?void 0:s[1])||void 0===t?void 0:t.message)&&void 0!==o?o:""}),[d]);return e("div",Object.assign({className:"flex flex-co transition hover:shadow"},{children:[e("div",Object.assign({className:"flex gap-x-3 overflow-hidden bg-white px-4 py-5"},{children:[s("div",Object.assign({className:"shrink-0 pt-1"},{children:s(a,{className:"h-6 w-6"})})),e("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-1.5 scrollbar-track-gray-100 scrollbar-thumb-[#4A4A4B] lg:max-w-[520px] lg:scrollbar-thin"},{children:[s("input",{id:`${d.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:x.length<280}),s("div",{className:"danger-html hidden flex-col peer-checked:flex",dangerouslySetInnerHTML:{__html:x}}),s("label",Object.assign({htmlFor:`${d.responseId}-input`,className:"mt-1 flex shrink-0 whitespace-nowrap text-sm font-semibold peer-checked:hidden hover:cursor-pointer",style:{color:p.accent}},{children:"See input"})),s("label",Object.assign({htmlFor:`${d.responseId}-input`,className:"hidden shrink-0 whitespace-nowrap text-sm font-semibold peer-checked:flex hover:cursor-pointer",style:{color:p.accent}},{children:"Hide input"}))]}))]})),e("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:p.secondary,color:p.secondaryText}},{children:[s(i,{src:null==m?void 0:m.chaticon,alt:`${null==m?void 0:m.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1"}),e("div",Object.assign({className:"flex w-full flex-col gap-y-2 overflow-hidden"},{children:[s(c,{className:"overflow-x-auto pb-2 font-light
|
|
1
|
+
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useMemo as t}from"react";import{usePickaxeContext as o}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{format as l}from"date-fns";import r from"../../../Icons/message-square-notes.svg.js";import a from"../../../Icons/visitor.svg.js";import i from"../../../Core/PickaxeIcon.js";import n from"../../../Core/CopyButton.js";import c from"../../../Core/MarkdownRenderer.js";const d=({item:d})=>{const{pickaxe:m,colors:p,setChatId:h,setIsNewChat:f}=o(),u=t((()=>l(d.createdAt,"hh:mm a MMM dd, yy")),[d]),g=t((()=>d&&d.messages?d.messages.length:0),[d]),x=t((()=>{var e,s,t,o;if("form"===d.type){return(null!==(e=d.questions)&&void 0!==e?e:[]).map((e=>`<div style="display: flex; flex-direction: column; margin-bottom: 1em;">\n <p style="font-weight: 500;">${e.question}</p>\n <p>${e.answer||"n/a"}</p>\n</div>`)).join("")}return null!==(o=null===(t=null===(s=d.messages)||void 0===s?void 0:s[0])||void 0===t?void 0:t.message)&&void 0!==o?o:""}),[d]),v=t((()=>{var e,s,t,o;return"form"===d.type?null!==(e=d.questionResponse)&&void 0!==e?e:"":null!==(o=null===(t=null===(s=d.messages)||void 0===s?void 0:s[1])||void 0===t?void 0:t.message)&&void 0!==o?o:""}),[d]);return e("div",Object.assign({className:"flex flex-co transition hover:shadow"},{children:[e("div",Object.assign({className:"flex gap-x-3 overflow-hidden bg-white px-4 py-5"},{children:[s("div",Object.assign({className:"shrink-0 pt-1"},{children:s(a,{className:"h-6 w-6"})})),e("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-1.5 scrollbar-track-gray-100 scrollbar-thumb-[#4A4A4B] lg:max-w-[520px] lg:scrollbar-thin"},{children:[s("input",{id:`${d.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:x.length<280}),s("div",{className:"danger-html hidden flex-col peer-checked:flex",dangerouslySetInnerHTML:{__html:x}}),s("label",Object.assign({htmlFor:`${d.responseId}-input`,className:"mt-1 flex shrink-0 whitespace-nowrap text-sm font-semibold peer-checked:hidden hover:cursor-pointer",style:{color:p.accent}},{children:"See input"})),s("label",Object.assign({htmlFor:`${d.responseId}-input`,className:"hidden shrink-0 whitespace-nowrap text-sm font-semibold peer-checked:flex hover:cursor-pointer",style:{color:p.accent}},{children:"Hide input"}))]}))]})),e("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:p.secondary,color:p.secondaryText}},{children:[s(i,{src:null==m?void 0:m.chaticon,alt:`${null==m?void 0:m.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1"}),e("div",Object.assign({className:"flex w-full flex-col gap-y-2 overflow-hidden"},{children:[s(c,{className:"overflow-x-auto pb-2 font-light opacity-90 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B]",html:v}),e("div",Object.assign({className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1"},{children:[e("div",Object.assign({className:"flex items-center gap-3"},{children:[(null==m?void 0:m.enablechatresponses)&&e("button",Object.assign({className:"flex items-center gap-x-1 hover:cursor-pointer hover:text-c-blue",onClick:()=>{return e=d.responseId,f(!1),void h(e);var e}},{children:[s(r,{className:"h-4 w-4"}),s("p",Object.assign({className:"text-sm font-semibold"},{children:g+1}))]})),s(n,{text:v})]})),s("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:s("p",Object.assign({className:"text-sm font-semibold uppercase opacity-30"},{children:u}))}))]}))]}))]}))]}))};export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useMemo as t}from"react";import{usePickaxeContext as o}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as r}from"../../../../hooks/pickaxe/useResponseContext.js";import{format as l}from"date-fns";import a from"../../../Icons/message-square-notes.svg.js";import n from"../../../Icons/visitor.svg.js";import i from"../../../Core/PickaxeIcon.js";import c from"../../../Core/CopyButton.js";import d from"../../../Core/MarkdownRenderer.js";import
|
|
1
|
+
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useMemo as t}from"react";import{usePickaxeContext as o}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as r}from"../../../../hooks/pickaxe/useResponseContext.js";import{format as l}from"date-fns";import a from"../../../Icons/message-square-notes.svg.js";import n from"../../../Icons/visitor.svg.js";import i from"../../../Core/PickaxeIcon.js";import c from"../../../Core/CopyButton.js";import d from"../../../Core/MarkdownRenderer.js";import p from"../../Addons/Scroll/ScrollLockView.js";const m=()=>{var m;const{pickaxe:h,colors:x,setChatId:f,setIsNewChat:u}=o(),{response:g}=r(),b=t((()=>l(g?g.createdAt:new Date,"hh:mm a MMM dd, yy")),[g]),v=t((()=>{var e;if(!g)return"";return(null!==(e=g.questions)&&void 0!==e?e:[]).map((e=>`<div style="display: flex; flex-direction: column; margin-bottom: 1em;">\n <p style="font-weight: 500;">${e.question}</p>\n <p>${e.answer||"n/a"}</p>\n</div>`)).join("")}),[g]);return g?e("div",Object.assign({className:"flex flex-col shadow-black transition hover:shadow"},{children:[e("div",Object.assign({className:"flex gap-x-3 overflow-hidden bg-white px-4 py-5"},{children:[s("div",Object.assign({className:"shrink-0 pt-1"},{children:s(n,{className:"h-6 w-6"})})),e("div",Object.assign({className:"flex flex-col gap-y-1 overflow-x-auto pb-[6px] scrollbar-track-gray-100 scrollbar-thumb-[#4A4A4B] lg:max-w-[520px] lg:scrollbar-thin"},{children:[s("input",{id:`${g.responseId}-input`,type:"checkbox",className:"peer hidden",defaultChecked:v.length<280}),s("div",{className:"danger-html hidden flex-col opacity-50 peer-checked:flex",dangerouslySetInnerHTML:{__html:v}}),s("label",Object.assign({htmlFor:`${g.responseId}-input`,className:"mt-1 flex shrink-0 whitespace-nowrap text-sm font-semibold text-[#228DD7] peer-checked:hidden hover:cursor-pointer",style:{color:x.accent}},{children:"See input"})),s("label",Object.assign({htmlFor:`${g.responseId}-input`,className:"hidden shrink-0 whitespace-nowrap text-sm font-semibold text-[#228DD7] peer-checked:flex hover:cursor-pointer",style:{color:x.accent}},{children:"Hide input"}))]}))]})),e("div",Object.assign({className:"flex gap-x-3 px-4 py-5",style:{backgroundColor:x.secondary,color:x.secondaryText}},{children:[s(i,{src:null==h?void 0:h.chaticon,alt:`${null==h?void 0:h.formtitle}'s Chat Icon`,width:24,height:24,className:"h-6 w-6 pt-1"}),e("div",Object.assign({className:"flex w-full flex-col gap-y-2 overflow-hidden"},{children:[s(d,{className:"overflow-x-auto pb-2 font-light opacity-90 scrollbar-thin scrollbar-track-white scrollbar-thumb-[#4A4A4B]",html:g.questionResponse}),e("div",Object.assign({className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1"},{children:[e("div",Object.assign({className:"flex items-center gap-3"},{children:[(null==h?void 0:h.enablechatresponses)&&e("button",Object.assign({className:"flex items-center gap-x-1 hover:cursor-pointer hover:text-c-blue",onClick:()=>{return e=g.responseId,u(!1),void f(e);var e}},{children:[s(a,{className:"h-4 w-4"}),s("p",Object.assign({className:"text-sm font-semibold"},{children:g.messages.length+1}))]})),s(c,{text:null!==(m=g.questionResponse)&&void 0!==m?m:""})]})),s("div",Object.assign({className:"flex shrink-0 grow justify-end"},{children:s("p",Object.assign({className:"text-sm font-semibold uppercase opacity-30"},{children:b}))}))]}))]}))]})),s(p,{})]})):null};export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{usePickaxeContext as s}from"../../../hooks/pickaxe/usePickaxeContext.js";import{generateId as o}from"../../../common/utils.js";const i=()=>{const{isShowHistory:i,setChatId:a,setIsNewChat:r,setIsShowHistory:c}=s();return e("div",Object.assign({className:"mt-6 flex flex-wrap gap-2"},{children:[t("button",Object.assign({onClick:()=>{return e=o(20),r(!0),void a(e);var e},className:"flex h-[48px] w-full max-w-[140px] items-center justify-center gap-2 rounded-sm bg-c-blue px-4 font-semibold text-white hover:opacity-80 hover:duration-300 disabled:cursor-wait disabled:opacity-60"},{children:t("span",Object.assign({className:"font-semibold"},{children:"New chat"}))})),!i&&t("button",Object.assign({className:"flex h-[48px] w-full max-w-[140px] items-center justify-center px-4 font-semibold hover:
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{usePickaxeContext as s}from"../../../hooks/pickaxe/usePickaxeContext.js";import{generateId as o}from"../../../common/utils.js";const i=()=>{const{isShowHistory:i,setChatId:a,setIsNewChat:r,setIsShowHistory:c}=s();return e("div",Object.assign({className:"mt-6 flex flex-wrap gap-2"},{children:[t("button",Object.assign({onClick:()=>{return e=o(20),r(!0),void a(e);var e},className:"flex h-[48px] w-full max-w-[140px] items-center justify-center gap-2 rounded-sm bg-c-blue px-4 font-semibold text-white hover:opacity-80 hover:duration-300 disabled:cursor-wait disabled:opacity-60"},{children:t("span",Object.assign({className:"font-semibold"},{children:"New chat"}))})),!i&&t("button",Object.assign({className:"flex h-[48px] w-full max-w-[140px] items-center justify-center px-4 font-semibold hover:opacity-70 hover:duration-300",onClick:()=>c(!0)},{children:"See history"}))]}))};export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e}from"../../../../_virtual/_tslib.js";import{jsxs as s,jsx as o,Fragment as
|
|
1
|
+
import{__awaiter as e}from"../../../../_virtual/_tslib.js";import{jsxs as s,jsx as o,Fragment as t}from"react/jsx-runtime";import{useState as i,useRef as a}from"react";import{usePickaxeContext as n}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleInput as r}from"../../../../hooks/studio/useStyleInput.js";import{useDocument as l}from"../../Addons/Document/hooks/useDocument.js";import{allowedFileMimeTypes as c,allowedImageMimeTypes as d}from"../../../../common/documents.js";import m from"../../../Icons/attach.svg.js";import p from"../../../Icons/check.svg.js";import u from"../../../Icons/x.svg.js";import b from"../../../Core/ErrorAlert.js";import f from"../../Addons/Document/List.js";import h from"../../../../common/cn.js";const g=({field:g,update:j})=>{const{colors:v}=n(),{documentError:y,websiteLink:k,isUploading:N,isImageUploadAllowed:x,setDocumentError:w,setWebsiteLink:O,onFileUpload:C,onWebsiteUpload:D}=l({onQuestionChange:e=>{j(Object.assign(Object.assign({},g),e))}}),[A,I]=i(!1),E=a(null),U=r();return s("div",Object.assign({className:"flex flex-col gap-y-1"},{children:[s("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[s("div",Object.assign({className:"flex items-center gap-2"},{children:[o("p",Object.assign({className:"text-sm font-semibold opacity-70"},{children:g.main})),g.isRequired&&o("span",Object.assign({className:"select-none font-semibold",style:{color:v.error}},{children:"*"}))]})),s("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[o("input",{ref:E,type:"file",accept:[...c,...x?d:[]].join(", "),id:g.id,hidden:!0,className:"hidden",onChange:s=>e(void 0,void 0,void 0,(function*(){yield C(Array.from(s.target.files||[])),s.target.value=""})),disabled:N}),s("div",Object.assign({className:h("flex items-center justify-between rounded-sm border border-transparent bg-white py-3 pl-4 pr-3 shadow duration-300 hover:border-black/25",A&&"border-black/70 shadow-none hover:border-black/70"),style:U},{children:[o("input",{type:"text",value:k,className:"w-full outline-none bg-transparent",placeholder:"Paste a website/video link or drag a file",onChange:e=>O(e.target.value),onDrop:s=>e(void 0,void 0,void 0,(function*(){s.preventDefault(),yield C(Array.from(s.dataTransfer.files||[]))})),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),D(k))},onFocus:()=>I(!0),onBlur:()=>I(!1)}),o("div",Object.assign({className:"flex items-center gap-3 pl-4"},{children:k.length>0?s(t,{children:[o("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:N,onClick:()=>D(k)},{children:o(p,{className:"h-5 w-5 shrink-0",style:{color:v.accent}})})),o("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:N,onClick:()=>{O(""),w("")}},{children:o(u,{className:"h-6 w-6 shrink-0",style:{color:v.accent}})}))]}):o("button",Object.assign({className:"outline-none disabled:cursor-wait disabled:opacity-80",disabled:N,onClick:()=>{var e;null===(e=E.current)||void 0===e||e.click()}},{children:o(m,{className:"h-6 w-6 shrink-0",style:{color:v.accent}})}))}))]}))]}))]})),o(f,{className:"mt-2"}),y&&o(b,{error:y,className:"mt-3"})]}))};export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as
|
|
1
|
+
import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useState as t}from"react";import{usePickaxeContext as s}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as r}from"../../../../hooks/pickaxe/useResponseContext.js";import{useStyleInput as a}from"../../../../hooks/studio/useStyleInput.js";import{encode as n}from"@nem035/gpt-3-encoder";import i from"../../../Core/Textarea.js";import c from"../../../../common/cn.js";const l=({field:l,update:m})=>{const{colors:p}=s(),{setError:d}=r(),[g,h]=t(!1),x=a();return e("div",Object.assign({className:"group relative flex flex-col gap-y-1"},{children:[e("div",Object.assign({className:"flex flex-col gap-y-2"},{children:[e("div",Object.assign({className:"flex items-center gap-2"},{children:[o("p",Object.assign({className:"text-sm font-semibold opacity-70"},{children:l.main})),l.isRequired&&o("span",Object.assign({className:"select-none font-semibold",style:{color:p.error}},{children:"*"}))]})),o(i,{className:c("rounded-sm border border-transparent bg-white px-4 py-3 shadow duration-300 hover:border-black/25 focus:border-black/70 focus:shadow-none",l.maxLength<10&&"max-w-[400px]"),style:x,placeholder:l.example,rows:l.maxLength>500?3:1,value:l.input,tabIndex:l.order,onChange:e=>{d("");const o=n(e).length;m(Object.assign(Object.assign({},l),{input:e,length:o}))},onFocus:()=>h(!0),onBlur:()=>h(!1)})]})),o("div",Object.assign({className:"pointer-events-none absolute bottom-0 right-0 p-1 px-2"},{children:e("p",Object.assign({className:c("text-[14px] font-semibold opacity-20 opacity-0 group-hover:opacity-100 group-hover:duration-200",l.length>l.maxLength&&"text-c-red opacity-100",g&&"opacity-100")},{children:[l.length,"/",l.maxLength]}))}))]}))};export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{usePickaxeContext as t}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as i}from"../../../../hooks/pickaxe/useResponseContext.js";import
|
|
1
|
+
import{jsxs as e,jsx as s}from"react/jsx-runtime";import{usePickaxeContext as t}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as i}from"../../../../hooks/pickaxe/useResponseContext.js";import a from"./Dropdown.js";const n=({field:n,update:c})=>{const{colors:r}=t(),{setError:o}=i();return e("div",Object.assign({className:"flex flex-col gap-y-3"},{children:[e("div",Object.assign({className:"flex items-center gap-2"},{children:[s("p",Object.assign({className:"text-sm font-semibold opacity-70"},{children:n.main})),n.isRequired&&s("span",Object.assign({className:"select-none font-semibold",style:{color:r.error}},{children:"*"}))]})),s(a,Object.assign({id:n.id.replace(/[^A-Za-z]+/g,""),value:n.input,placeholder:"Select an option",closeOnSelect:!1,maxToken:n.maxLength,isDropdown:n.isDropdown},{children:s("div",Object.assign({className:"flex flex-col items-start gap-y-3"},{children:n.example.split("S3P32X").map(((t,i)=>e("div",Object.assign({className:"flex items-center gap-x-2 hover:cursor-pointer",onClick:()=>{return e=t,o(""),void c(Object.assign(Object.assign({},n),{input:e}));var e}},{children:[s("div",Object.assign({className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full border-2 border-black bg-white"},{children:n.input===t&&s("div",{className:"h-4 w-4 rounded-full",style:{backgroundColor:r.accent}})})),s("p",Object.assign({className:"select-none max-lg:text-sm"},{children:t}))]}),i)))}))}))]}))};export{n 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 r}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as i}from"../../../../hooks/pickaxe/useResponseContext.js";import{useSubmit as n}from"../../../../hooks/pickaxe/useSubmit.js";import{useSubmitResult as l}from"../../../../hooks/pickaxe/useSubmitResult.js";import{useDocument as
|
|
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 r}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useResponseContext as i}from"../../../../hooks/pickaxe/useResponseContext.js";import{useSubmit as n}from"../../../../hooks/pickaxe/useSubmit.js";import{useSubmitResult as l}from"../../../../hooks/pickaxe/useSubmitResult.js";import{useDocument as a}from"../../Addons/Document/hooks/useDocument.js";import{useScroll as d}from"../../Addons/Scroll/hooks/useScroll.js";import{streamer as m}from"../../../../common/api/streamer.js";import{extractUrlsFromText as c}from"../../../../common/utils.js";import{encode as u}from"@nem035/gpt-3-encoder";import p from"../../common/PickaxeButton.js";import f from"../../../../common/error.js";const g=({questions:g})=>{const{formId:h,pickaxe:w,isShowHistory:x,setIsShowHistory:k}=r(),{status:y,setResponse:j,setStatus:I,setError:b}=i(),{documents:v,websiteLink:S,isUploading:q,onWebsiteUpload:E,setDocumentError:R}=a(),{isScrollIncreasing:O,scrollToContainer:U,scrollToBottom:P,scrollStart:A,scrollEnd:C}=d(),D=n(),L=l(),[T,B]=s(!1);return o("div",Object.assign({className:"mt-4 flex flex-wrap gap-2"},{children:[t(p,Object.assign({className:"w-full max-w-[176px]",isDisabled:q||T||"fetching"===y||"streaming"===y,onClick:()=>e(void 0,void 0,void 0,(function*(){var e;try{if(q||T||"fetching"===y||"streaming"===y)return;R("");const o="enduserupload"===(null==w?void 0:w.documentuploadtype),t=g.some((e=>"userinput:documentupload"===e.id&&e.isRequired)),s=v.filter((e=>"finished"===e.status)),r=c(S),i=v.map((e=>e.name)),n=r.filter((e=>!i.includes(e)));if(n.length){const e=n[n.length-1],o=yield E(e);o&&(s.push(o),B(!0),yield new Promise((e=>setTimeout(e,5e3))),B(!1))}else if(t&&o&&!s.length)return void R("Please paste a valid website/video link or drag a file to add to the knowledge base.");b("");const l=["Multiple Choice","Checkbox"];for(const e of g){if(u(e.input).length>e.maxLength&&!l.includes(e.type))throw new Error("One or more of your responses is too long!");if(e.isRequired&&!e.input.trim()&&"userinput:documentupload"!==e.id)throw new Error("You must fill out all required fields.")}const a=s.length?s[s.length-1]:null;let d={};g.forEach((e=>d=Object.assign(Object.assign({},d),{[e.id]:"Knowledge Upload"===e.type||e.id.includes("documentupload")?(null==a?void 0:a.name)||"":e.input}))),I("fetching");const{success:p,responseId:f,data:x,usedDocumentIds:k,rawUserInput:U,error:C}=yield D.mutateAsync(Object.assign({formId:h,valueObj:d},o&&a&&{documentId:null!==(e=a.documentId)&&void 0!==e?e:""}));if(!p)throw new Error(null!=C?C:"An error occurred, please try again.");A();const H=(yield m({formId:h,responseId:f,data:x})).body;if(!H)throw new Error("Streaming error");const N=H.getReader(),W=new TextDecoder;let Y="",_=!0;j(null);const F=g.map((e=>({id:e.id,question:e.main,answer:e.input})));for(;_;){const{value:e,done:o}=yield N.read();_=!o;if(Y+=W.decode(e),Y)I("streaming"),j({formId:h,responseId:f,documentIds:k,messages:[],questions:F,questionPrompt:U,questionResponse:Y,createdAt:new Date}),O&&P();else if(!_&&!Y)throw new Error("Server error")}Y&&(P(),I("idle"),yield L.mutateAsync({formId:h,responseId:f,documentIds:k,studioUserId:"USER68RFBSHU4YS2I4L",questions:F,questionPrompt:U,questionResponse:Y}))}catch(e){let o=f(e);o.includes("Unexpected token 'A',")&&(o="Oops! We're experiencing high traffic at the moment. Please try again later."),b(o),B(!1),U()}finally{I("idle"),C()}}))},{children:T?"Processing...":q?"Uploading...":"fetching"===y||"streaming"===y?"Loading...":"Submit"})),!x&&t(p,Object.assign({variant:"transparent-text",className:"w-full max-w-[176px]",onClick:()=>k(!0)},{children:"See history"}))]}))};export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as s}from"react/jsx-runtime";import{usePickaxeContext as
|
|
1
|
+
import{jsx as e,jsxs as s}from"react/jsx-runtime";import{usePickaxeContext as t}from"../../../hooks/pickaxe/usePickaxeContext.js";import i from"./Head.js";import l from"./History/index.js";import o from"./NewChat.js";import a from"./Questions/index.js";const r=()=>{const{pickaxe:r}=t();return e("div",Object.assign({className:"flex w-full flex-col items-center pt-12 px-4 pb-40 max-[899px]:pb-10"},{children:s("div",Object.assign({className:"flex w-full max-w-[700px] flex-col"},{children:[e(i,{}),s("div",Object.assign({className:"flex flex-col gap-y-8 lg:mt-4"},{children:[(null==r?void 0:r.chatflag)?e(o,{}):e(a,{}),e(l,{})]}))]}))}))};export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{usePickaxeContext as
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{usePickaxeContext as i}from"../../hooks/pickaxe/usePickaxeContext.js";import s from"../Icons/x.svg.js";import o from"../Core/Modal/index.js";import l from"../Core/Modal/Body.js";import a from"../Core/PickaxeIcon.js";const c=({isOpen:c,onChangeIsOpen:n})=>{const{pickaxe:r}=i();return e(o,Object.assign({isOpen:c,onChange:n},{children:t(l,Object.assign({className:"relative flex w-full max-w-[480px] flex-col px-8 py-[26px] max-[767px]:max-w-full",avoidOverflow:!0},{children:[e("div",Object.assign({className:"flex items-start justify-end gap-4"},{children:e("button",Object.assign({className:"outline-none hover:opacity-70 hover:duration-300 active:opacity-100",onClick:()=>n(!1)},{children:e(s,{className:"h-6 w-6 shrink-0"})}))})),e("div",Object.assign({className:"mt-8 flex flex-col items-center"},{children:t("div",Object.assign({className:"flex w-full max-w-[360px] flex-col items-center text-center"},{children:[e(a,{src:null==r?void 0:r.coverphoto,alt:`${null==r?void 0:r.formtitle}'s Profile Picture`,width:90,height:90,className:"h-[90px] w-[90px] rounded-full"}),e("h2",Object.assign({className:"mt-6 text-center text-[18px] font-semibold opacity-70 max-[767px]:text-base"},{children:null==r?void 0:r.formtitle})),e("p",Object.assign({className:"mt-4 font-semilight opacity-70"},{children:null==r?void 0:r.formdescription}))]}))}))]}))}))};export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{createContext as r,useState as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{createContext as r,useState as t}from"react";import o from"./Addons/Document/Provider.js";import s from"./ResponseProvider.js";const i=r({}),c=({styles:r,colors:c,children:n})=>{const[a,d]=t(""),[l,F]=t(""),[m,h]=t(null),[f,y]=t(!0),[I,p]=t(!0),[x,u]=t(!1);return e(i.Provider,Object.assign({value:{formId:a,chatId:l,pickaxe:m,styles:Object.assign({theme:"light",font:"Real Head Pro",fontSize:"md",formFieldStyle:"box",btnStyle:"filled",outlineThickness:1,cornerRadius:4},r),colors:Object.assign({primary:"#F6F8FA",text:"#000000",secondary:"#FFFFFF",secondaryText:"#000000",accent:"#228DD7",accentText:"#FFFFFF",error:"#EF4444"},c),isNewChat:f,isShowIceBreaker:I,isShowHistory:x,setFormId:d,setChatId:F,setPickaxe:h,setIsNewChat:y,setIsShowIceBreaker:p,setIsShowHistory:u}},{children:e(s,{children:e(o,{children:n})})}))};export{i as PickaxeContext,c as PickaxeProvider};
|
|
@@ -0,0 +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 a from"../../Core/Button.js";import e from"../../../common/cn.js";const i=i=>{var{variant:m,className:n}=i,c=t(i,["variant","className"]);const{styles:p}=r(),l=s({variant:m});return o(a,Object.assign({variant:m,className:e("min-h-[48px]",n,("primary"===m||"secondary"===m)&&"hover:opacity-90","outlined"===p.btnStyle&&"hover:opacity-70"),style:l},c))};export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o}from"react/jsx-runtime";import{usePickaxe as r}from"../../hooks/pickaxe/usePickaxe.js";import{useEffect as t}from"react";import{usePickaxeContext as e}from"../../hooks/pickaxe/usePickaxeContext.js";import{generateId as a}from"../../common/utils.js";import m from"./Addons/Scroll/Provider.js";import
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{usePickaxe as r}from"../../hooks/pickaxe/usePickaxe.js";import{useEffect as t}from"react";import{usePickaxeContext as e}from"../../hooks/pickaxe/usePickaxeContext.js";import{generateId as a}from"../../common/utils.js";import m from"./Addons/Scroll/Provider.js";import s from"./Chat/index.js";import i from"./Form/index.js";import c from"../../common/cn.js";const l=({formId:l,chatId:d,className:n})=>{const{chatId:f,styles:p,colors:x,setFormId:h,setChatId:k,setPickaxe:j}=e(),u=r();return t((()=>{h(l)}),[l]),t((()=>{"string"==typeof d&&k(d)}),[d]),t((()=>{u.data&&(k(u.data.chatflag?a(15):""),j(u.data))}),[u.data]),u.data?o(m,{children:o("div",Object.assign({className:c("relative @container/pickaxe-root flex flex-col flex-grow w-full h-full",n,"dark"===p.theme&&"dark"),style:{backgroundColor:x.primary,color:x.text}},{children:o(f?s:i,{})}))}):null};export{l as Pickaxe};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useMemo as r}from"react";import{usePickaxeContext as t}from"../pickaxe/usePickaxeContext.js";const o=({variant:o="primary"})=>{const{styles:e,colors:n}=t();return r((()=>Object.assign(Object.assign(Object.assign({},"primary"===o&&Object.assign(Object.assign(Object.assign({borderWidth:`${e.outlineThickness}px`},"filled"===e.btnStyle&&{borderColor:n.accent,backgroundColor:n.accent,color:n.accentText}),"outlined"===e.btnStyle&&{color:n.accent,backgroundColor:"transparent",borderColor:n.accent}),"transparent"===e.btnStyle&&{color:n.accent,backgroundColor:"transparent",borderColor:"transparent"})),"secondary"===o&&{backgroundColor:"transparent",color:n.accent}),"transparent-text"===o&&{color:n.accent})),[e,n,o])};export{o as useStyleButton};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useMemo as o}from"react";import{usePickaxeContext as r}from"../pickaxe/usePickaxeContext.js";const e=()=>{const{styles:e,colors:t}=r();return o((()=>Object.assign(Object.assign(Object.assign({borderWidth:`${e.outlineThickness}px`,borderRadius:`${e.cornerRadius}px`,background:"transparent"},"minimal"===e.formFieldStyle&&{borderBottomColor:t.secondary,color:t.text}),"box"===e.formFieldStyle&&{borderColor:t.secondary+"AA",color:t.text}),"block"===e.formFieldStyle&&{backgroundColor:t.secondary,color:t.secondaryText})),[e,t])};export{e as useStyleInput};
|
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";
|
|
1
|
+
export{Pickaxe}from"./components/Pickaxe/index.js";export{PickaxeContext,PickaxeProvider}from"./components/Pickaxe/Provider.js";export{ResponseContext}from"./components/Pickaxe/ResponseProvider.js";export{useConversation}from"./hooks/pickaxe/useConversation.js";export{useHistory}from"./hooks/pickaxe/useHistory.js";export{usePickaxe}from"./hooks/pickaxe/usePickaxe.js";export{usePickaxeContext}from"./hooks/pickaxe/usePickaxeContext.js";export{useResponseContext}from"./hooks/pickaxe/useResponseContext.js";export{useSubmit}from"./hooks/pickaxe/useSubmit.js";export{useSubmitDocument}from"./hooks/pickaxe/useSubmitDocument.js";export{useSubmitResult}from"./hooks/pickaxe/useSubmitResult.js";
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import type { SetState } from "../../types/common";
|
|
2
2
|
import type { Pickaxe } from "../../types/pickaxe";
|
|
3
|
+
import type { StudioFontSize, StudioFormFieldStyle, StudioButtonStyle } from "../../types/studio";
|
|
3
4
|
import { type ReactNode } from "react";
|
|
5
|
+
export type PickaxeProviderStyles = {
|
|
6
|
+
theme: "light" | "dark";
|
|
7
|
+
font: string;
|
|
8
|
+
fontSize: StudioFontSize;
|
|
9
|
+
formFieldStyle: StudioFormFieldStyle;
|
|
10
|
+
btnStyle: StudioButtonStyle;
|
|
11
|
+
outlineThickness: number;
|
|
12
|
+
cornerRadius: number;
|
|
13
|
+
};
|
|
4
14
|
export type PickaxeProviderColors = {
|
|
5
15
|
primary: string;
|
|
6
16
|
text: string;
|
|
@@ -14,6 +24,7 @@ type PickaxeContextType = {
|
|
|
14
24
|
formId: string;
|
|
15
25
|
chatId: string;
|
|
16
26
|
pickaxe: Pickaxe | null;
|
|
27
|
+
styles: PickaxeProviderStyles;
|
|
17
28
|
colors: PickaxeProviderColors;
|
|
18
29
|
isNewChat: boolean;
|
|
19
30
|
isShowIceBreaker: boolean;
|
|
@@ -25,10 +36,11 @@ type PickaxeContextType = {
|
|
|
25
36
|
setIsShowIceBreaker: SetState<boolean>;
|
|
26
37
|
setIsShowHistory: SetState<boolean>;
|
|
27
38
|
};
|
|
28
|
-
interface IPickaxeProviderProps {
|
|
39
|
+
export interface IPickaxeProviderProps {
|
|
40
|
+
styles?: Partial<PickaxeProviderStyles>;
|
|
29
41
|
colors?: Partial<PickaxeProviderColors>;
|
|
30
42
|
children: ReactNode;
|
|
31
43
|
}
|
|
32
44
|
export declare const PickaxeContext: import("react").Context<PickaxeContextType>;
|
|
33
|
-
export declare const PickaxeProvider: ({ colors, children, }: IPickaxeProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
45
|
+
export declare const PickaxeProvider: ({ styles, colors, children, }: IPickaxeProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
34
46
|
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import PickaxeStoryWrapper from "./PickaxeStoryWrapper";
|
|
3
|
+
declare const meta: Meta<typeof PickaxeStoryWrapper>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof PickaxeStoryWrapper>;
|
|
6
|
+
export declare const Chat: Story;
|
|
7
|
+
export declare const Form: Story;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { IPickaxeProviderProps } from "../Provider";
|
|
2
|
+
import { PickaxeProps } from "..";
|
|
3
|
+
declare const PickaxeStoryWrapper: ({ styles, colors, ...props }: PickaxeProps & IPickaxeProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default PickaxeStoryWrapper;
|
|
@@ -3,4 +3,4 @@ export interface PickaxeProps {
|
|
|
3
3
|
chatId?: string;
|
|
4
4
|
className?: string;
|
|
5
5
|
}
|
|
6
|
-
export declare const Pickaxe: ({ formId: _formId, chatId: _chatId, className, }: PickaxeProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const Pickaxe: ({ formId: _formId, chatId: _chatId, className, }: PickaxeProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -2,6 +2,7 @@ export declare const usePickaxeContext: () => {
|
|
|
2
2
|
formId: string;
|
|
3
3
|
chatId: string;
|
|
4
4
|
pickaxe: import("../../types/pickaxe").Pickaxe | null;
|
|
5
|
+
styles: import("../../components/Pickaxe/Provider").PickaxeProviderStyles;
|
|
5
6
|
colors: import("../../components/Pickaxe/Provider").PickaxeProviderColors;
|
|
6
7
|
isNewChat: boolean;
|
|
7
8
|
isShowIceBreaker: boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ButtonProps } from "../../components/Core/Button";
|
|
2
|
+
import { type CSSProperties } from "react";
|
|
3
|
+
interface UseStyleButtonOptions {
|
|
4
|
+
variant?: ButtonProps["variant"];
|
|
5
|
+
}
|
|
6
|
+
export declare const useStyleButton: ({ variant, }: UseStyleButtonOptions) => CSSProperties;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./components/Pickaxe";
|
|
2
|
+
export * from "./components/Pickaxe/Provider";
|
|
3
|
+
export * from "./components/Pickaxe/ResponseProvider";
|
|
4
|
+
export * from "./hooks/pickaxe/useConversation";
|
|
5
|
+
export * from "./hooks/pickaxe/useHistory";
|
|
6
|
+
export * from "./hooks/pickaxe/usePickaxe";
|
|
7
|
+
export * from "./hooks/pickaxe/usePickaxeContext";
|
|
8
|
+
export * from "./hooks/pickaxe/useResponseContext";
|
|
9
|
+
export * from "./hooks/pickaxe/useSubmit";
|
|
10
|
+
export * from "./hooks/pickaxe/useSubmitDocument";
|
|
11
|
+
export * from "./hooks/pickaxe/useSubmitResult";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pickaxeproject/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "Client utility library for Pickaxe",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,14 +34,18 @@
|
|
|
34
34
|
"not op_mini all"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@babel/runtime": "^7.20.7"
|
|
37
|
+
"@babel/runtime": "^7.20.7",
|
|
38
|
+
"@storybook/react-vite": "^8.4.7"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
41
|
"@babel/core": "^7.20.12",
|
|
41
42
|
"@babel/plugin-transform-runtime": "^7.19.6",
|
|
42
43
|
"@babel/preset-env": "^7.20.2",
|
|
43
44
|
"@babel/preset-react": "^7.18.6",
|
|
45
|
+
"@babel/preset-typescript": "^7.26.0",
|
|
44
46
|
"@changesets/cli": "^2.26.0",
|
|
47
|
+
"@chromatic-com/storybook": "3.2.3",
|
|
48
|
+
"@mdx-js/react": "^3.1.0",
|
|
45
49
|
"@nem035/gpt-3-encoder": "^1.1.7",
|
|
46
50
|
"@rollup/plugin-alias": "^5.1.1",
|
|
47
51
|
"@rollup/plugin-babel": "^6.0.3",
|
|
@@ -49,6 +53,15 @@
|
|
|
49
53
|
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
50
54
|
"@rollup/plugin-replace": "^6.0.2",
|
|
51
55
|
"@rollup/plugin-terser": "^0.3.0",
|
|
56
|
+
"@storybook/addon-a11y": "^8.4.7",
|
|
57
|
+
"@storybook/addon-docs": "^8.4.7",
|
|
58
|
+
"@storybook/addon-essentials": "8.4.7",
|
|
59
|
+
"@storybook/addon-interactions": "8.4.7",
|
|
60
|
+
"@storybook/addon-links": "^8.4.7",
|
|
61
|
+
"@storybook/addon-themes": "^8.4.7",
|
|
62
|
+
"@storybook/blocks": "8.4.7",
|
|
63
|
+
"@storybook/react": "8.4.7",
|
|
64
|
+
"@storybook/test": "8.4.7",
|
|
52
65
|
"@svgr/rollup": "^8.1.0",
|
|
53
66
|
"@tailwindcss/container-queries": "^0.1.1",
|
|
54
67
|
"@tanstack/react-query": "^4.36.1",
|
|
@@ -73,6 +86,7 @@
|
|
|
73
86
|
"eslint-plugin-prettier": "^4.2.1",
|
|
74
87
|
"eslint-plugin-react": "^7.32.0",
|
|
75
88
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
89
|
+
"eslint-plugin-storybook": "^0.11.2",
|
|
76
90
|
"framer-motion": "^11.17.0",
|
|
77
91
|
"husky": "^8.0.3",
|
|
78
92
|
"isomorphic-dompurify": "^2.20.0",
|
|
@@ -94,6 +108,7 @@
|
|
|
94
108
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
95
109
|
"rollup-plugin-postcss": "^4.0.2",
|
|
96
110
|
"rollup-plugin-typescript2": "^0.34.1",
|
|
111
|
+
"storybook": "8.4.7",
|
|
97
112
|
"tailwind-merge": "^2.6.0",
|
|
98
113
|
"tailwind-scrollbar": "^3.1.0",
|
|
99
114
|
"tailwindcss": "^3.4.17",
|
|
@@ -101,6 +116,9 @@
|
|
|
101
116
|
"ttypescript": "^1.5.15",
|
|
102
117
|
"typescript": "^4.9.4",
|
|
103
118
|
"typescript-transform-paths": "^3.4.6",
|
|
119
|
+
"vite": "^6.0.7",
|
|
120
|
+
"vite-plugin-svgr": "^4.3.0",
|
|
121
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
104
122
|
"webpack": "^5.75.0",
|
|
105
123
|
"webpack-cli": "^5.0.1"
|
|
106
124
|
},
|
|
@@ -133,6 +151,9 @@
|
|
|
133
151
|
"build": "cross-env NODE_ENV=production rollup -c",
|
|
134
152
|
"lint": "eslint . --ext .ts,.tsx,.js,.jsx",
|
|
135
153
|
"changeset": "changeset",
|
|
136
|
-
"release": "changeset publish"
|
|
154
|
+
"release": "changeset publish",
|
|
155
|
+
"dev": "storybook dev -p 6006",
|
|
156
|
+
"storybook": "storybook dev -p 6006",
|
|
157
|
+
"build-storybook": "storybook build"
|
|
137
158
|
}
|
|
138
159
|
}
|
package/dist/cjs/index.d.ts
DELETED
package/dist/esm/index.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/cjs/{components → src/components}/Pickaxe/Addons/Document/hooks/useDocument.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/dist/cjs/{components → src/components}/Pickaxe/Addons/Scroll/hooks/useScrollContext.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|