@pickaxeproject/react 3.7.1 → 3.8.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.
- package/dist/cjs/components/Core/Menu/Button.js +1 -1
- package/dist/cjs/components/EmbedPreview/FAB.js +1 -1
- package/dist/cjs/components/EmbedPreview/Inline.js +1 -1
- package/dist/cjs/components/EmbedPreview/Popup.js +1 -1
- package/dist/cjs/components/Icons/message-clock.svg.js +1 -0
- package/dist/cjs/components/Pickaxe/Addons/Artifact/Renderer/SaveMenu.js +1 -1
- package/dist/cjs/components/Pickaxe/Addons/Artifact/Renderer/ViewOptions.js +1 -1
- package/dist/cjs/components/Pickaxe/Addons/Artifact/Renderer/index.js +1 -1
- package/dist/cjs/components/Pickaxe/Addons/Artifact/index.js +1 -1
- package/dist/cjs/components/Pickaxe/Addons/Auth/index.js +1 -1
- package/dist/cjs/components/Pickaxe/Addons/Document/List.js +1 -1
- package/dist/cjs/components/Pickaxe/Addons/Document/hooks/useDocument.js +1 -1
- package/dist/cjs/components/Pickaxe/Addons/IceBreaker/Breaker.js +1 -1
- package/dist/cjs/components/Pickaxe/Chat/History/Document.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/Form/History/Container.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/History/Item.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/NewChat.js +1 -1
- package/dist/cjs/components/Pickaxe/Form/Questions/Checkbox.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/Provider.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeBranding.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeCopyButton.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeEmbedHead.js +1 -0
- package/dist/cjs/components/Pickaxe/common/PickaxeHistoryButton.js +1 -0
- package/dist/cjs/components/Pickaxe/common/PickaxeInfoModal.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeInput.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/Artifact/index.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeSimpleButton.js +1 -1
- package/dist/cjs/components/Pickaxe/index.js +1 -1
- package/dist/cjs/hooks/core/usePressed.js +1 -0
- package/dist/cjs/hooks/pickaxe/useSubmitDocument.js +1 -1
- package/dist/cjs/src/components/EmbedPreview/Popup.d.ts +1 -1
- package/dist/cjs/src/components/Pickaxe/Form/NewChat.d.ts +1 -2
- package/dist/cjs/src/components/Pickaxe/Provider.d.ts +2 -0
- package/dist/cjs/src/components/Pickaxe/common/PickaxeBranding.d.ts +2 -2
- package/dist/cjs/src/components/Pickaxe/common/PickaxeEmbedHead.d.ts +9 -0
- package/dist/cjs/src/components/Pickaxe/common/PickaxeHistoryButton.d.ts +6 -0
- package/dist/cjs/src/components/Pickaxe/common/PickaxeSimpleButton.d.ts +8 -2
- package/dist/cjs/src/hooks/core/usePressed.d.ts +5 -0
- package/dist/cjs/src/hooks/pickaxe/usePickaxeContext.d.ts +2 -0
- package/dist/cjs/src/hooks/pickaxe/useSubmitDocument.d.ts +9 -5
- package/dist/cjs/src/types/pickaxe.d.ts +1 -1
- package/dist/esm/components/Core/Menu/Button.js +1 -1
- package/dist/esm/components/EmbedPreview/FAB.js +1 -1
- package/dist/esm/components/EmbedPreview/Inline.js +1 -1
- package/dist/esm/components/EmbedPreview/Popup.js +1 -1
- package/dist/esm/components/Icons/message-clock.svg.js +1 -0
- package/dist/esm/components/Pickaxe/Addons/Artifact/Renderer/SaveMenu.js +1 -1
- package/dist/esm/components/Pickaxe/Addons/Artifact/Renderer/ViewOptions.js +1 -1
- package/dist/esm/components/Pickaxe/Addons/Artifact/Renderer/index.js +1 -1
- package/dist/esm/components/Pickaxe/Addons/Artifact/index.js +1 -1
- package/dist/esm/components/Pickaxe/Addons/Auth/index.js +1 -1
- package/dist/esm/components/Pickaxe/Addons/Document/List.js +1 -1
- package/dist/esm/components/Pickaxe/Addons/Document/hooks/useDocument.js +1 -1
- package/dist/esm/components/Pickaxe/Addons/IceBreaker/Breaker.js +1 -1
- package/dist/esm/components/Pickaxe/Chat/History/Document.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/Form/History/Container.js +1 -1
- package/dist/esm/components/Pickaxe/Form/History/Item.js +1 -1
- package/dist/esm/components/Pickaxe/Form/NewChat.js +1 -1
- package/dist/esm/components/Pickaxe/Form/Questions/Checkbox.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/Provider.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeBranding.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeCopyButton.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeEmbedHead.js +1 -0
- package/dist/esm/components/Pickaxe/common/PickaxeHistoryButton.js +1 -0
- package/dist/esm/components/Pickaxe/common/PickaxeInfoModal.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeInput.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/Artifact/index.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeSimpleButton.js +1 -1
- package/dist/esm/components/Pickaxe/index.js +1 -1
- package/dist/esm/hooks/core/usePressed.js +1 -0
- package/dist/esm/hooks/pickaxe/useSubmitDocument.js +1 -1
- package/dist/esm/src/components/EmbedPreview/Popup.d.ts +1 -1
- package/dist/esm/src/components/Pickaxe/Form/NewChat.d.ts +1 -2
- package/dist/esm/src/components/Pickaxe/Provider.d.ts +2 -0
- package/dist/esm/src/components/Pickaxe/common/PickaxeBranding.d.ts +2 -2
- package/dist/esm/src/components/Pickaxe/common/PickaxeEmbedHead.d.ts +9 -0
- package/dist/esm/src/components/Pickaxe/common/PickaxeHistoryButton.d.ts +6 -0
- package/dist/esm/src/components/Pickaxe/common/PickaxeSimpleButton.d.ts +8 -2
- package/dist/esm/src/hooks/core/usePressed.d.ts +5 -0
- package/dist/esm/src/hooks/pickaxe/usePickaxeContext.d.ts +2 -0
- package/dist/esm/src/hooks/pickaxe/useSubmitDocument.d.ts +9 -5
- package/dist/esm/src/types/pickaxe.d.ts +1 -1
- package/package.json +3 -2
- package/dist/cjs/components/Pickaxe/common/PickaxeCompactHead.js +0 -1
- package/dist/cjs/src/components/Pickaxe/common/PickaxeCompactHead.d.ts +0 -7
- package/dist/esm/components/Pickaxe/common/PickaxeCompactHead.js +0 -1
- package/dist/esm/src/components/Pickaxe/common/PickaxeCompactHead.d.ts +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as o}from"../../../_virtual/_tslib.js";import{jsx as t}from"react/jsx-runtime";import{useState as i,useEffect as c}from"react";import r from"copy-to-clipboard";import n from"../../Icons/copy.svg.js";import e from"../../Icons/copied.svg.js";import a from"./PickaxeSimpleButton.js";import s from"../../../common/cn.js";const l=({color:l,text:m="",className:p,iconClassName:f})=>{const[d,h]=i(m),[u,g]=i(!1),[j,y]=i(!1);c((()=>{h(m)}),[m]);return t(a,Object.assign({color:l},p&&{className:p},{isForceColor:j,onClick:()=>o(void 0,void 0,void 0,(function*(){var o;try{if(u)return;g(!0);const t=null!==(o=[...Array.from(m.matchAll(/https:\/\/streaming\.pickaxeproject\.com\/api\/function_call_results\?.*?&name=[^&]+/g)),...Array.from(m.matchAll(/https:\/\/utils\.pickaxe\.co\/api\/fn\/result\?.*?&name=[^&]+/g))].map((o=>o[0])))&&void 0!==o?o:[],i=[];if(t.length){for(const o of t)try{const t=yield fetch(o),c=yield t.json(),r=c.text||c.url||"";i.push(r)}catch(o){console.error(o)}i.length&&h(i.join("\n"))}let c=i.length>0?i.join("\n"):d;(c.includes("<action-caption")||c.includes("<action-finished"))&&(c=c.replace(/<action-caption data-index="[^"]">(.*?)<\/action-caption>/g,"$1"),c=c.replace(/<action-finished data-index="[^"]">.*?<\/action-finished>/g,"")),r(c),g(!1),y(!0),yield new Promise((o=>setTimeout(o,1500)))}catch(o){console.error(o)}finally{g(!1),y(!1)}}))},{children:t(u||j?e:n,{className:s("
|
|
1
|
+
import{__awaiter as o}from"../../../_virtual/_tslib.js";import{jsx as t}from"react/jsx-runtime";import{useState as i,useEffect as c}from"react";import r from"copy-to-clipboard";import n from"../../Icons/copy.svg.js";import e from"../../Icons/copied.svg.js";import a from"./PickaxeSimpleButton.js";import s from"../../../common/cn.js";const l=({color:l,text:m="",className:p,iconClassName:f})=>{const[d,h]=i(m),[u,g]=i(!1),[j,y]=i(!1);c((()=>{h(m)}),[m]);return t(a,Object.assign({color:l},p&&{className:p},{isForceColor:j,onClick:()=>o(void 0,void 0,void 0,(function*(){var o;try{if(u)return;g(!0);const t=null!==(o=[...Array.from(m.matchAll(/https:\/\/streaming\.pickaxeproject\.com\/api\/function_call_results\?.*?&name=[^&]+/g)),...Array.from(m.matchAll(/https:\/\/utils\.pickaxe\.co\/api\/fn\/result\?.*?&name=[^&]+/g))].map((o=>o[0])))&&void 0!==o?o:[],i=[];if(t.length){for(const o of t)try{const t=yield fetch(o),c=yield t.json(),r=c.text||c.url||"";i.push(r)}catch(o){console.error(o)}i.length&&h(i.join("\n"))}let c=i.length>0?i.join("\n"):d;(c.includes("<action-caption")||c.includes("<action-finished"))&&(c=c.replace(/<action-caption data-index="[^"]">(.*?)<\/action-caption>/g,"$1"),c=c.replace(/<action-finished data-index="[^"]">.*?<\/action-finished>/g,"")),r(c),g(!1),y(!0),yield new Promise((o=>setTimeout(o,1500)))}catch(o){console.error(o)}finally{g(!1),y(!1)}}))},{children:t(u||j?e:n,{className:s("h-4 w-4 shrink-0",f)})}))};export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsxs as i,jsx as e}from"react/jsx-runtime";import{useMemo as o}from"react";import{usePickaxeContext as s}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as t}from"../../../hooks/studio/useStyleFontSize.js";import r from"./PickaxeIcon.js";import c from"./PickaxeHistoryButton.js";import l from"../../../common/cn.js";const n=({className:n,iconClassName:a,historyBtnTip:m,onIconClick:p,onHistoryClick:d})=>{const{pickaxe:u,misc:f,colors:h,deploymentType:x}=s(),k=t(),j=o((()=>({title:(null==u?void 0:u.formtitle)||"",description:(null==u?void 0:u.formdescription)||""})),[u]);return f.isTitle||f.isDescription||!f.isWhiteLabel?i("div",Object.assign({className:l("flex min-h-[56px] items-center justify-between gap-4 px-4",n),style:{backgroundColor:h.secondary,color:h.secondaryText}},{children:[i("div",Object.assign({className:"flex items-center gap-4"},{children:[f.isProfileImage&&e(r,Object.assign({src:null==u?void 0:u.coverphoto,alt:`${null==u?void 0:u.formtitle}'s Profile Picture`,width:32,height:32,className:l("h-[32px] w-[32px] shrink-0 rounded-full",a,!!p&&"cursor-pointer")},p&&{onClick:p})),f.isTitle&&e("p",Object.assign({className:l(k.b1)},{children:j.title}))]})),!!d&&e("div",Object.assign({className:l("popup"===x&&"pr-10")},{children:e(c,{tip:m,onClick:d})}))]})):null};export{n as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__rest as e}from"../../../_virtual/_tslib.js";import{jsxs as o,jsx as s}from"react/jsx-runtime";import{useHover as t}from"../../../hooks/core/useHover.js";import{usePressed as r}from"../../../hooks/core/usePressed.js";import{usePickaxeContext as i}from"../../../hooks/pickaxe/usePickaxeContext.js";import{AnimatePresence as c,motion as a}from"framer-motion";import n from"../../Icons/message-clock.svg.js";import m from"./PickaxeSimpleButton.js";const l=({tip:l,onClick:d})=>{const{colors:u,styles:p}=i(),f=t(),{isHover:k}=f,h=e(f,["isHover"]),v=r(),{isActive:j}=v,x=e(v,["isActive"]);return o("div",Object.assign({className:"relative"},{children:[s(m,Object.assign({className:"h-8 w-8 shrink-0 items-center justify-center rounded-full duration-300 ease-in-out",color:u.accent,style:{backgroundColor:j?u.accent+"30":k?u.accent+"10":void 0},onClick:d,reversed:!0},h,x,{children:s(n,{className:"h-6 w-6 shrink-0"})})),s(c,{children:k&&!!l&&s(a.div,Object.assign({className:"absolute right-0 top-10 z-10 w-max rounded text-xs font-semibold",style:{background:u.accent,color:u.accentText,padding:"0.5rem 0.75rem",borderRadius:p.cornerRadius},initial:{opacity:0,y:-10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2,ease:"easeInOut"}},{children:l}))})]}))};export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{usePickaxeContext as s}from"../../../hooks/pickaxe/usePickaxeContext.js";import r from"../../Icons/x.svg.js";import t from"../../Core/Modal/index.js";import i from"../../Core/Modal/Body.js";import l from"./PickaxeSimpleButton.js";import a from"./PickaxeHead.js";const c=({isOpen:c,onChangeIsOpen:n})=>{const{colors:m}=s();return e(t,Object.assign({isOpen:c,onChange:n},{children:o(i,Object.assign({className:"relative flex flex-col px-8 pt-[26px]
|
|
1
|
+
import{jsx as e,jsxs as o}from"react/jsx-runtime";import{usePickaxeContext as s}from"../../../hooks/pickaxe/usePickaxeContext.js";import r from"../../Icons/x.svg.js";import t from"../../Core/Modal/index.js";import i from"../../Core/Modal/Body.js";import l from"./PickaxeSimpleButton.js";import a from"./PickaxeHead.js";const c=({isOpen:c,onChangeIsOpen:n})=>{const{colors:m}=s();return e(t,Object.assign({isOpen:c,onChange:n},{children:o(i,Object.assign({className:"relative flex w-full flex-col px-8 pb-8 pt-[26px] max-[767px]:border-0 min-[767px]:max-w-[480px]",style:{backgroundColor:m.primary,color:m.text,borderColor:m.text+"4D"},avoidOverflow:!0},{children:[e("div",Object.assign({className:"flex items-start justify-end gap-4"},{children:e(l,Object.assign({color:m.text,onClick:()=>n(!1)},{children:e(r,{className:"h-6 w-6 shrink-0"})}))})),e("div",Object.assign({className:"mt-6 flex flex-col items-center"},{children:e("div",Object.assign({className:"flex w-full max-w-[360px] flex-col items-center text-center"},{children:e(a,{})}))}))]}))}))};export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__rest as t}from"../../../_virtual/_tslib.js";import{jsx as s}from"react/jsx-runtime";import{forwardRef as e}from"react";import{useStyleInput as o}from"../../../hooks/studio/useStyleInput.js";import{usePickaxeContext as r}from"../../../hooks/pickaxe/usePickaxeContext.js";import a from"../../../common/cn.js";const i=e(((e,i)=>{var{className:m,style:l}=e,n=t(e,["className","style"]);const{styles:c}=r(),p=o();return s("input",Object.assign({ref:i,style:Object.assign(Object.assign({},p),l),className:a("outline-none ring-0
|
|
1
|
+
import{__rest as t}from"../../../_virtual/_tslib.js";import{jsx as s}from"react/jsx-runtime";import{forwardRef as e}from"react";import{useStyleInput as o}from"../../../hooks/studio/useStyleInput.js";import{usePickaxeContext as r}from"../../../hooks/pickaxe/usePickaxeContext.js";import a from"../../../common/cn.js";const i=e(((e,i)=>{var{className:m,style:l}=e,n=t(e,["className","style"]);const{styles:c}=r(),p=o();return s("input",Object.assign({ref:i,style:Object.assign(Object.assign({},p),l),className:a("px-4 py-3 outline-none ring-0","block"===c.formFieldStyle&&"shadow",m),autoComplete:"off"},n))}));i.displayName="PickaxeInput";export{i as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useMemo as r,useEffect as i}from"react";import{usePickaxeMarkdownContext as a}from"../../hooks/usePickaxeMarkdownContext.js";import{useArtifactContext as n}from"../../../../Addons/Artifact/hooks/useArtifactContext.js";import{motion as o}from"framer-motion";import s from"../../../../../Icons/spinner-lines.svg.js";import c from"../../../../Addons/Artifact/Renderer/index.js";const d=({node:i})=>{const{theme:d,colors:l,styles:p,onArtifactClick:m}=a(),{artifacts:f,currentPopupType:u,currentArtifact:x}=n(),v=r((()=>{const{dataId:e,dataCommand:t,dataTitle:r,dataType:a,dataVersion:n}=(null==i?void 0:i.properties)||{};return e?{id:e,command:t||"create",title:r||"Untitled Artifact",type:a||"text/markdown",version:n?parseInt(n,10):1}:null}),[]),h=r((()=>{var e,t;if(!v)return null;const{command:r,type:i,version:a}=v;let n=`${null!==(e={create:"Created",update:"Updated",rewrite:"Rewrote"}[r])&&void 0!==e?e:"Created"} ${null!==(t={"text/markdown":"Markdown","text/html":"HTML","text/csv":"CSV","image/svg+xml":"SVG","application/vnd.pxe.code":"Code","application/vnd.pxe.mermaid":"Diagram","application/vnd.pxe.react":"React Component"}[i])&&void 0!==t?t:"Artifact"}`;return a>1&&(n+=` (v${a})`),n}),[v]),C=r((()=>{if(!v)return"finished";const e=f.find((e=>e.id===v.id&&e.version===v.version));return e?e.status:"finished"}),[f,v]);return v?u.startsWith("inline")&&"finished"===C?x?null:e(c,{type:"inline",className:"pxe-artifact-inline",styling:{colors:l,styles:p},artifact:{id:v.id,version:v.version}}):t(o.div,Object.assign({className:"pxe-artifact-create-container
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useMemo as r,useEffect as i}from"react";import{usePickaxeMarkdownContext as a}from"../../hooks/usePickaxeMarkdownContext.js";import{useArtifactContext as n}from"../../../../Addons/Artifact/hooks/useArtifactContext.js";import{motion as o}from"framer-motion";import s from"../../../../../Icons/spinner-lines.svg.js";import c from"../../../../Addons/Artifact/Renderer/index.js";const d=({node:i})=>{const{theme:d,colors:l,styles:p,onArtifactClick:m}=a(),{artifacts:f,currentPopupType:u,currentArtifact:x}=n(),v=r((()=>{const{dataId:e,dataCommand:t,dataTitle:r,dataType:a,dataVersion:n}=(null==i?void 0:i.properties)||{};return e?{id:e,command:t||"create",title:r||"Untitled Artifact",type:a||"text/markdown",version:n?parseInt(n,10):1}:null}),[]),h=r((()=>{var e,t;if(!v)return null;const{command:r,type:i,version:a}=v;let n=`${null!==(e={create:"Created",update:"Updated",rewrite:"Rewrote"}[r])&&void 0!==e?e:"Created"} ${null!==(t={"text/markdown":"Markdown","text/html":"HTML","text/csv":"CSV","image/svg+xml":"SVG","application/vnd.pxe.code":"Code","application/vnd.pxe.mermaid":"Diagram","application/vnd.pxe.react":"React Component"}[i])&&void 0!==t?t:"Artifact"}`;return a>1&&(n+=` (v${a})`),n}),[v]),C=r((()=>{if(!v)return"finished";const e=f.find((e=>e.id===v.id&&e.version===v.version));return e?e.status:"finished"}),[f,v]);return v?u.startsWith("inline")&&"finished"===C?x?null:e(c,{type:"inline",className:"pxe-artifact-inline",styling:{colors:l,styles:p},artifact:{id:v.id,version:v.version}}):t(o.div,Object.assign({className:"pxe-artifact-create-container mb-4 flex select-none flex-wrap items-center justify-between gap-8 p-4",style:Object.assign({borderColor:"dark"===d?"#444444":"#CCCCCC",backgroundColor:l.secondary+"80",color:l.secondaryText,borderRadius:p.cornerRadius},!!m&&{cursor:"pointer"}),initial:{opacity:0,x:10,scale:.95},animate:{opacity:1,x:0,scale:1},transition:{duration:.5,ease:"easeOut",staggerChildren:.1},whileHover:{borderColor:"dark"===d?"#666666":"#AAAAAA",backgroundColor:l.secondary}},m&&{onClick:()=>m({id:v.id,version:v.version})},{children:[t("div",Object.assign({className:"pxe-artifact-create-header flex flex-col gap-2 text-[10pt]"},{children:[e("p",Object.assign({className:"font-semibold"},{children:v.title})),e("p",Object.assign({className:"opacity-90"},{children:h}))]})),"finished"!==C&&e("div",{children:e(s,{className:"pxe-spin h-5 w-5 shrink-0"})})]})):null},l=({node:t,children:r})=>{const{setArtifacts:a}=n();return i((()=>{if(!t||!t.properties)return;const e=t.properties.dataId;e&&a((t=>t.map((t=>t.id===e?Object.assign(Object.assign({},t),{status:"error"}):t))))}),[]),e("div",Object.assign({className:"pxe-red pxe-artifact-error"},{children:r}))};export{d as Artifact,l as ArtifactError};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{__rest as o}from"../../../_virtual/_tslib.js";import{jsx as e}from"react/jsx-runtime";import t from"../../../common/cn.js";const r=r=>{var{color:i,children:c,className:s,style:a,reversed:n=!1,isForceColor:l,onClick:p}=r,m=o(r,["color","children","className","style","reversed","isForceColor","onClick"]);return e("button",Object.assign({className:t("flex items-center gap-1 opacity-70 outline-none transition-opacity duration-300 ease-in-out hover:opacity-100",n&&"opacity-100 hover:opacity-70",s,l&&(n?"opacity-70":"opacity-100"))},(i||a)&&{style:Object.assign(Object.assign({},i&&{color:i}),a)},p&&{onClick:o=>{o.stopPropagation(),p()}},m,{children:c}))};export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as t,jsxs as o}from"react/jsx-runtime";import{usePickaxe as s}from"../../hooks/pickaxe/usePickaxe.js";import{useState as r,useEffect as a}from"react";import{usePickaxeContext as l}from"../../hooks/pickaxe/usePickaxeContext.js";import{useAuthContext as i}from"./Addons/Auth/hooks/useAuthContext.js";import{useResponseContext as m}from"../../hooks/pickaxe/useResponseContext.js";import{useDocumentContext as n}from"./Addons/Document/hooks/useDocumentContext.js";import{useArtifactContext as c}from"./Addons/Artifact/hooks/useArtifactContext.js";import{generateId as p}from"../../common/utils.js";import{ScrollProvider as x}from"./Addons/Scroll/Provider.js";import d from"./common/PickaxeSkeleton.js";import f from"./Chat/index.js";import u from"./Form/index.js";import h from"./Addons/Auth/index.js";import k from"../../common/cn.js";const j=({formId:j,className:w})=>{const{chatId:g,styles:A,colors:
|
|
1
|
+
import{jsx as e,Fragment as t,jsxs as o}from"react/jsx-runtime";import{usePickaxe as s}from"../../hooks/pickaxe/usePickaxe.js";import{useState as r,useEffect as a}from"react";import{usePickaxeContext as l}from"../../hooks/pickaxe/usePickaxeContext.js";import{useAuthContext as i}from"./Addons/Auth/hooks/useAuthContext.js";import{useResponseContext as m}from"../../hooks/pickaxe/useResponseContext.js";import{useDocumentContext as n}from"./Addons/Document/hooks/useDocumentContext.js";import{useArtifactContext as c}from"./Addons/Artifact/hooks/useArtifactContext.js";import{generateId as p}from"../../common/utils.js";import{ScrollProvider as x}from"./Addons/Scroll/Provider.js";import d from"./common/PickaxeSkeleton.js";import f from"./Chat/index.js";import u from"./Form/index.js";import h from"./Addons/Auth/index.js";import k from"../../common/cn.js";const j=({formId:j,className:w})=>{const{chatId:g,styles:A,colors:C,responsiveBy:N,deploymentType:b,isNewChat:v,isEmailLogin:y,setFormId:I,setChatId:O,setLastChatId:P,setSessionId:L,setPickaxe:S}=l(),{isLoggedOut:D,isSent:E}=i(),{setMessages:F,setResponse:R,setError:B,setLimitData:H,setStatus:M}=m(),{setDocumentError:T}=n(),{setCurrentArtifact:q}=c(),[z,G]=r(!1),J=s(),K="chat-input"===b&&v&&!E,Q="popup"===b&&g,U="chat-input"!==b||!E,V="popup"===b&&!g&&y&&D;return a((()=>{I(j)}),[j]),a((()=>{if(!J.data)return;const e=J.data.chatflag,t=p(15);O(e?t:""),P(e?t:""),L(p(15)),e?F([]):R(null),B(""),T(""),H(null),q(null),S(J.data),G(!0)}),[J.data]),a((()=>{B(""),T(""),H(null),F([]),R(null),q(null),M("idle")}),[g]),J.data?e("div",Object.assign({className:k("relative flex w-full flex-grow flex-col @container/pickaxe-root",(!b||Q||V)&&"h-full","dark"===A.theme&&"dark",w),style:Object.assign({backgroundColor:K?"transparent":C.primary,color:C.text},A.font&&"Real Head Pro"!==A.font&&{fontFamily:A.font})},{children:y&&D&&U?e(h,{}):e(t,{children:J.isLoading||!z?e("div",Object.assign({className:k("flex w-full flex-col items-center px-4 pb-10 pt-12","viewport"===N?"min-[767px]:pb-40":"@[767px]/pickaxe-root:pb-40")},{children:o("div",Object.assign({className:"flex w-full max-w-[700px] flex-col items-center"},{children:[e(d,{className:"h-[72px] w-[72px]"}),e(d,{className:"mt-6 h-[20px] w-full"}),e(d,{className:"mt-2 h-[20px] w-full"}),e(d,{className:"mt-2 h-[20px] w-full max-w-[400px]"}),e("div",Object.assign({className:"mt-6 flex w-full flex-col gap-y-8"},{children:e(d,{className:k("min-h-[48px] w-full","viewport"===N?"min-[767px]:max-w-[176px]":"@[767px]/pickaxe-root:max-w-[176px]")})}))]}))})):e(t,{children:e(x,g?{children:e(f,{})}:{children:e(u,{})})})})})):null};export{j as Pickaxe};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useState as o,useCallback as t}from"react";const e=()=>{const[e,n]=o(!1);return{isActive:e,onMouseDown:t((()=>n(!0)),[]),onMouseUp:t((()=>n(!1)),[])}};export{e as usePressed};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as e}from"../../_virtual/_tslib.js";import{generateId as s}from"../../common/utils.js";const o=()=>({document:({formId:s,
|
|
1
|
+
import{__awaiter as e}from"../../_virtual/_tslib.js";import{generateId as s}from"../../common/utils.js";const o=()=>({document:({formId:s,sessionId:o,file:i,workspaceId:n,responseId:t,studioUserId:r,studioSessionToken:d,isKnowledge:c,isBlocking:a})=>e(void 0,void 0,void 0,(function*(){var e,l;if(!process.env.NEXT_PUBLIC_MODAL_DOC_APP_URL)throw new Error("NEXT_PUBLIC_MODAL_DOC_APP_URL is not defined");const p=i.name.split(".").pop(),_=i.type,u={formid:s,mimetype:_,extension:p,responseid:t,workspaceid:n,sessionid:o},O=new URLSearchParams(Object.entries(u).filter((e=>void 0!==e[1]&&null!==e[1]&&""!==e[1]))),g=`${process.env.NEXT_PUBLIC_MODAL_DOC_APP_URL}/get_document_upload_url?${O.toString()}`,f=yield fetch(g),m=yield f.json();if(!m.success)throw new Error(null!==(e=m.error)&&void 0!==e?e:"Failed to get presigned URL, try again or contact support.");const I=new FormData;Object.entries(Object.assign(Object.assign({},m.fields),{file:i})).forEach((([e,s])=>{I.append(e,s)}));const w=yield fetch(m.url,{method:"POST",body:I});if(!w.ok)throw new Error(w.statusText);const P=`${m.url}${m.fields.key}`;if("development"===process.env.NODE_ENV&&console.log("[S3URL]",P),_.startsWith("image"))return{success:!0,documentId:`IMAGE-${m.documentId}-${m.folder}`};const b=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,documentId:m.documentId,fileName:i.name,fileSize:i.size},n&&{workspaceId:n}),t&&{responseId:t}),r&&{studioUserId:r}),d&&{studioSessionToken:d}),c&&{isKnowledge:c}),a&&{isBlocking:a})),headers:{"Content-Type":"application/json"}}),L=yield b.json();if(!L.success)throw new Error(null!==(l=L.error)&&void 0!==l?l:"Failed processing document, try again or contact support.");return L})),website:({formId:o,website:i,workspaceId:n,responseId:t,studioUserId:r,studioSessionToken:d,isKnowledge:c,isBlocking:a})=>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 l=s(20),p=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,documentId:l,website:i},n&&{workspaceId:n}),t&&{responseId:t}),r&&{studioUserId:r}),d&&{studioSessionToken:d}),c&&{isKnowledge:c}),a&&{isBlocking:a})),headers:{"Content-Type":"application/json"}}),_=yield p.json();if(!_.success)throw new Error(null!==(e=_.error)&&void 0!==e?e:"Failed processing website, try again or contact support.");return _}))});export{o as useSubmitDocument};
|
|
@@ -2,7 +2,7 @@ import type { SetState } from "../../types/common";
|
|
|
2
2
|
import { PickaxeProps } from "../Pickaxe";
|
|
3
3
|
import { IPickaxeProviderProps } from "../Pickaxe/Provider";
|
|
4
4
|
type PopupProps = PickaxeProps & Omit<IPickaxeProviderProps, "children" | "deploymentType" | "isEmbed">;
|
|
5
|
-
export declare const Popup: (
|
|
5
|
+
export declare const Popup: (props: PopupProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export declare const PopupCTAButton: ({ formId, setIsOpen, }: {
|
|
7
7
|
formId: string;
|
|
8
8
|
setIsOpen: SetState<boolean>;
|
|
@@ -55,6 +55,7 @@ export type PickaxeDeploymentMisc = {
|
|
|
55
55
|
type PickaxeContextType = {
|
|
56
56
|
formId: string;
|
|
57
57
|
chatId: string;
|
|
58
|
+
lastChatId: string;
|
|
58
59
|
sessionId: string;
|
|
59
60
|
userId: string;
|
|
60
61
|
studioUserId: string;
|
|
@@ -84,6 +85,7 @@ type PickaxeContextType = {
|
|
|
84
85
|
isEmailLogin: boolean;
|
|
85
86
|
setFormId: SetState<string>;
|
|
86
87
|
setChatId: SetState<string>;
|
|
88
|
+
setLastChatId: SetState<string>;
|
|
87
89
|
setSessionId: SetState<string>;
|
|
88
90
|
setPickaxe: SetState<LimitedPickaxe | null>;
|
|
89
91
|
setIsFontLoaded: SetState<boolean>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
interface PickaxeBrandingProps {
|
|
2
|
+
containerClassName?: string;
|
|
2
3
|
className?: string;
|
|
3
|
-
animateHover?: boolean;
|
|
4
4
|
}
|
|
5
|
-
declare const PickaxeBranding: ({
|
|
5
|
+
declare const PickaxeBranding: ({ containerClassName, className, }: PickaxeBrandingProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
6
6
|
export default PickaxeBranding;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface PickaxeEmbedHeadProps {
|
|
2
|
+
className?: string;
|
|
3
|
+
iconClassName?: string;
|
|
4
|
+
historyBtnTip?: string;
|
|
5
|
+
onIconClick?: () => void;
|
|
6
|
+
onHistoryClick?: () => void;
|
|
7
|
+
}
|
|
8
|
+
declare const PickaxeEmbedHead: ({ className, iconClassName, historyBtnTip, onIconClick, onHistoryClick, }: PickaxeEmbedHeadProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
9
|
+
export default PickaxeEmbedHead;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
|
-
import type { ReactNode } from "react";
|
|
1
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
2
2
|
interface PickaxeSimpleButtonProps {
|
|
3
3
|
color?: string;
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
className?: string;
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
reversed?: boolean;
|
|
6
8
|
isForceColor?: boolean;
|
|
7
9
|
onClick?: () => void;
|
|
10
|
+
onMouseDown?: () => void;
|
|
11
|
+
onMouseUp?: () => void;
|
|
12
|
+
onMouseEnter?: () => void;
|
|
13
|
+
onMouseLeave?: () => void;
|
|
8
14
|
}
|
|
9
|
-
declare const PickaxeSimpleButton: ({ color, children, className, isForceColor, onClick, }: PickaxeSimpleButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
declare const PickaxeSimpleButton: ({ color, children, className, style, reversed, isForceColor, onClick, ...props }: PickaxeSimpleButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
16
|
export default PickaxeSimpleButton;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare const usePickaxeContext: () => {
|
|
2
2
|
formId: string;
|
|
3
3
|
chatId: string;
|
|
4
|
+
lastChatId: string;
|
|
4
5
|
sessionId: string;
|
|
5
6
|
userId: string;
|
|
6
7
|
studioUserId: string;
|
|
@@ -30,6 +31,7 @@ export declare const usePickaxeContext: () => {
|
|
|
30
31
|
isEmailLogin: boolean;
|
|
31
32
|
setFormId: import("../../types/common").SetState<string>;
|
|
32
33
|
setChatId: import("../../types/common").SetState<string>;
|
|
34
|
+
setLastChatId: import("../../types/common").SetState<string>;
|
|
33
35
|
setSessionId: import("../../types/common").SetState<string>;
|
|
34
36
|
setPickaxe: import("../../types/common").SetState<import("../../types/pickaxe").LimitedPickaxe | null>;
|
|
35
37
|
setIsFontLoaded: import("../../types/common").SetState<boolean>;
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
export declare const useSubmitDocument: () => {
|
|
2
|
-
document: ({ formId, workspaceId, responseId,
|
|
2
|
+
document: ({ formId, sessionId, file, workspaceId, responseId, studioUserId, studioSessionToken, isKnowledge, isBlocking, }: {
|
|
3
3
|
formId: string;
|
|
4
|
+
sessionId: string;
|
|
5
|
+
file: File;
|
|
4
6
|
workspaceId?: string | undefined;
|
|
5
7
|
responseId?: string | undefined;
|
|
6
|
-
|
|
8
|
+
studioUserId?: string | undefined;
|
|
9
|
+
studioSessionToken?: string | undefined;
|
|
7
10
|
isKnowledge?: boolean | undefined;
|
|
8
11
|
isBlocking?: boolean | undefined;
|
|
9
|
-
sessionId: string;
|
|
10
12
|
}) => Promise<{
|
|
11
13
|
success: boolean;
|
|
12
14
|
documentId: string;
|
|
13
15
|
chunkCount?: number;
|
|
14
16
|
error?: string;
|
|
15
17
|
}>;
|
|
16
|
-
website: ({ formId, workspaceId, responseId,
|
|
18
|
+
website: ({ formId, website, workspaceId, responseId, studioUserId, studioSessionToken, isKnowledge, isBlocking, }: {
|
|
17
19
|
formId: string;
|
|
20
|
+
website: string;
|
|
18
21
|
workspaceId?: string | undefined;
|
|
19
22
|
responseId?: string | undefined;
|
|
20
|
-
|
|
23
|
+
studioUserId?: string | undefined;
|
|
24
|
+
studioSessionToken?: string | undefined;
|
|
21
25
|
isKnowledge?: boolean | undefined;
|
|
22
26
|
isBlocking?: boolean | undefined;
|
|
23
27
|
}) => Promise<{
|
|
@@ -2,7 +2,7 @@ import type { PickaxeQuestion } from "./form";
|
|
|
2
2
|
export type PickaxeImageOrText = "text" | "image";
|
|
3
3
|
export type PickaxePrivacySetting = "public" | "unlisted" | "private" | "deleted";
|
|
4
4
|
export type PickaxeCloneable = "true" | "false";
|
|
5
|
-
export type PickaxeDocumentUploadType = "ownerupload" | "enduserupload" | "enduserupload-
|
|
5
|
+
export type PickaxeDocumentUploadType = "ownerupload" | "enduserupload" | "enduserupload-user";
|
|
6
6
|
export type PickaxeModel = "gpt-3.5-turbo" | "gpt-4-1106-preview" | "mistral-small" | "gpt-4.1" | "gpt-4.1-mini" | "gpt-4.1-nano" | "gpt-4o-mini" | "gpt-4o" | "gpt-4" | "o3-mini" | "o1" | "deepseek-chat" | "mistral-large-latest" | "claude-3-opus-20240229" | "claude-3-5-sonnet-20240620" | "claude-3-7-sonnet-20250219" | "llama-3-uncensored";
|
|
7
7
|
export type Pickaxe = {
|
|
8
8
|
_id: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pickaxeproject/react",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "Client utility library for Pickaxe",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -101,6 +101,7 @@
|
|
|
101
101
|
"mermaid": "^11.7.0",
|
|
102
102
|
"postcss": "^8.4.49",
|
|
103
103
|
"prettier": "^3.5.3",
|
|
104
|
+
"prettier-plugin-tailwindcss": "^0.6.14",
|
|
104
105
|
"prismjs": "^1.29.0",
|
|
105
106
|
"react": "^18.2.0",
|
|
106
107
|
"react-dom": "^18.2.0",
|
|
@@ -180,7 +181,7 @@
|
|
|
180
181
|
"scripts": {
|
|
181
182
|
"build": "cross-env NODE_ENV=production rollup -c",
|
|
182
183
|
"lint": "eslint . --ext .ts,.tsx,.js,.jsx",
|
|
183
|
-
"lint:format": "prettier --check src
|
|
184
|
+
"lint:format": "prettier --check \"src/**/*.{js,jsx,ts,tsx,json,css,md,svg}\"",
|
|
184
185
|
"lint:staged": "pnpm run lint && pnpm run lint:format",
|
|
185
186
|
"format": "prettier --write .",
|
|
186
187
|
"changeset": "changeset",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("../../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../../hooks/studio/useStyleFontSize.js"),l=require("./PickaxeIcon.js"),r=require("./PickaxeBranding.js"),a=require("../../../common/cn.js");exports.default=({className:o,iconClassName:c,onIconClick:n})=>{const{pickaxe:u,misc:d,deploymentType:p}=s.usePickaxeContext(),x=t.useStyleFontSize(),m=i.useMemo((()=>({title:(null==u?void 0:u.formtitle)||"",description:(null==u?void 0:u.formdescription)||""})),[u]);return d.isTitle||d.isDescription||!d.isWhiteLabel?e.jsxs("div",Object.assign({className:a.default("flex h-[56px] items-center justify-between gap-4",o)},{children:[e.jsxs("div",Object.assign({className:"flex items-center gap-4"},{children:[d.isProfileImage&&e.jsx(l.default,Object.assign({src:null==u?void 0:u.coverphoto,alt:`${null==u?void 0:u.formtitle}'s Profile Picture`,width:32,height:32,className:a.default("shrink-0 h-[32px] w-[32px] rounded-full",c,!!n&&"cursor-pointer")},n&&{onClick:n})),d.isTitle&&e.jsx("p",Object.assign({className:a.default(x.b1)},{children:m.title}))]})),!d.isWhiteLabel&&e.jsx(r.default,{className:a.default("flex","popup"===p&&"p-0 pr-12"),animateHover:!0})]})):null};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
interface PickaxeCompactHeadProps {
|
|
2
|
-
className?: string;
|
|
3
|
-
iconClassName?: string;
|
|
4
|
-
onIconClick?: () => void;
|
|
5
|
-
}
|
|
6
|
-
declare const PickaxeCompactHead: ({ className, iconClassName, onIconClick, }: PickaxeCompactHeadProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
-
export default PickaxeCompactHead;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useMemo as s}from"react";import{usePickaxeContext as t}from"../../../hooks/pickaxe/usePickaxeContext.js";import{useStyleFontSize as o}from"../../../hooks/studio/useStyleFontSize.js";import r from"./PickaxeIcon.js";import l from"./PickaxeBranding.js";import c from"../../../common/cn.js";const n=({className:n,iconClassName:a,onIconClick:m})=>{const{pickaxe:p,misc:d,deploymentType:f}=t(),u=o(),h=s((()=>({title:(null==p?void 0:p.formtitle)||"",description:(null==p?void 0:p.formdescription)||""})),[p]);return d.isTitle||d.isDescription||!d.isWhiteLabel?e("div",Object.assign({className:c("flex h-[56px] items-center justify-between gap-4",n)},{children:[e("div",Object.assign({className:"flex items-center gap-4"},{children:[d.isProfileImage&&i(r,Object.assign({src:null==p?void 0:p.coverphoto,alt:`${null==p?void 0:p.formtitle}'s Profile Picture`,width:32,height:32,className:c("shrink-0 h-[32px] w-[32px] rounded-full",a,!!m&&"cursor-pointer")},m&&{onClick:m})),d.isTitle&&i("p",Object.assign({className:c(u.b1)},{children:h.title}))]})),!d.isWhiteLabel&&i(l,{className:c("flex","popup"===f&&"p-0 pr-12"),animateHover:!0})]})):null};export{n as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
interface PickaxeCompactHeadProps {
|
|
2
|
-
className?: string;
|
|
3
|
-
iconClassName?: string;
|
|
4
|
-
onIconClick?: () => void;
|
|
5
|
-
}
|
|
6
|
-
declare const PickaxeCompactHead: ({ className, iconClassName, onIconClick, }: PickaxeCompactHeadProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
-
export default PickaxeCompactHead;
|