@pickaxeproject/react 2.5.0 → 2.6.1
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/EmbedPreview/ChatInput.js +1 -0
- package/dist/cjs/components/EmbedPreview/FAB.js +1 -0
- package/dist/cjs/components/EmbedPreview/Inline.js +1 -0
- package/dist/cjs/components/EmbedPreview/Popup.js +1 -0
- 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/Provider.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeButton.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeHead.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/A/index.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Components/P/index.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeMarkdown/Renderer.js +1 -1
- package/dist/cjs/components/Pickaxe/common/PickaxeUpgradeCard.js +1 -1
- package/dist/cjs/components/Pickaxe/index.js +1 -1
- package/dist/cjs/embed/index.js +1 -0
- package/dist/cjs/hooks/pickaxe/usePickaxe.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/prose.css +1 -1
- package/dist/cjs/src/components/EmbedPreview/ChatInput.d.ts +9 -0
- package/dist/cjs/src/components/EmbedPreview/FAB.d.ts +10 -0
- package/dist/cjs/src/components/EmbedPreview/Inline.d.ts +5 -0
- package/dist/cjs/src/components/EmbedPreview/Popup.d.ts +10 -0
- package/dist/cjs/src/components/Pickaxe/Chat/Input.d.ts +3 -3
- package/dist/cjs/src/components/Pickaxe/Provider.d.ts +31 -5
- package/dist/cjs/src/components/Pickaxe/common/PickaxeButton.d.ts +1 -1
- package/dist/cjs/src/components/Pickaxe/common/PickaxeHead.d.ts +2 -2
- package/dist/cjs/src/components/Pickaxe/common/PickaxeMarkdown/Renderer.d.ts +2 -1
- package/dist/cjs/src/embed.d.ts +5 -0
- package/dist/cjs/src/hooks/pickaxe/usePickaxe.d.ts +1 -0
- package/dist/cjs/src/hooks/pickaxe/usePickaxeContext.d.ts +6 -2
- package/dist/cjs/src/index.d.ts +4 -0
- package/dist/esm/components/EmbedPreview/ChatInput.js +1 -0
- package/dist/esm/components/EmbedPreview/FAB.js +1 -0
- package/dist/esm/components/EmbedPreview/Inline.js +1 -0
- package/dist/esm/components/EmbedPreview/Popup.js +1 -0
- 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/Provider.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeButton.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeHead.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/A/index.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Components/P/index.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeMarkdown/Renderer.js +1 -1
- package/dist/esm/components/Pickaxe/common/PickaxeUpgradeCard.js +1 -1
- package/dist/esm/components/Pickaxe/index.js +1 -1
- package/dist/esm/embed/index.js +1 -0
- package/dist/esm/hooks/pickaxe/usePickaxe.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/prose.css +1 -1
- package/dist/esm/src/components/EmbedPreview/ChatInput.d.ts +9 -0
- package/dist/esm/src/components/EmbedPreview/FAB.d.ts +10 -0
- package/dist/esm/src/components/EmbedPreview/Inline.d.ts +5 -0
- package/dist/esm/src/components/EmbedPreview/Popup.d.ts +10 -0
- package/dist/esm/src/components/Pickaxe/Chat/Input.d.ts +3 -3
- package/dist/esm/src/components/Pickaxe/Provider.d.ts +31 -5
- package/dist/esm/src/components/Pickaxe/common/PickaxeButton.d.ts +1 -1
- package/dist/esm/src/components/Pickaxe/common/PickaxeHead.d.ts +2 -2
- package/dist/esm/src/components/Pickaxe/common/PickaxeMarkdown/Renderer.d.ts +2 -1
- package/dist/esm/src/embed.d.ts +5 -0
- package/dist/esm/src/hooks/pickaxe/usePickaxe.d.ts +1 -0
- package/dist/esm/src/hooks/pickaxe/usePickaxeContext.d.ts +6 -2
- package/dist/esm/src/index.d.ts +4 -0
- package/package.json +8 -2
- package/dist/cjs/src/components/Pickaxe/ui/Input/StyledAttachmentGrid.d.ts +0 -7
- package/dist/cjs/src/components/Pickaxe/ui/Input/StyledIconButton.d.ts +0 -10
- package/dist/cjs/src/components/Pickaxe/ui/Input/StyledImagePreview.d.ts +0 -12
- package/dist/cjs/src/components/Pickaxe/ui/Input/StyledInputContainer.d.ts +0 -13
- package/dist/cjs/src/components/Pickaxe/ui/Input/StyledInputWrapper.d.ts +0 -13
- package/dist/cjs/src/components/Pickaxe/ui/Input/StyledRemoveButton.d.ts +0 -13
- package/dist/cjs/src/components/Pickaxe/ui/Input/StyledTextareaWrapper.d.ts +0 -8
- package/dist/cjs/src/components/Pickaxe/ui/Message/StyledIconWrapper.d.ts +0 -11
- package/dist/cjs/src/components/Pickaxe/ui/Message/StyledMessage.d.ts +0 -10
- package/dist/cjs/src/components/Pickaxe/ui/Message/StyledMessageBubble.d.ts +0 -14
- package/dist/cjs/src/components/Pickaxe/ui/Message/StyledMessageContainer.d.ts +0 -10
- package/dist/cjs/src/components/Pickaxe/ui/StyledCopyButton.d.ts +0 -12
- package/dist/cjs/src/components/Pickaxe/ui/StyledDocumentCard.d.ts +0 -25
- package/dist/cjs/src/components/Pickaxe/ui/StyledIceBreaker.d.ts +0 -20
- package/dist/cjs/src/components/Pickaxe/ui/StyledLoadingDots.d.ts +0 -9
- package/dist/cjs/src/components/Pickaxe/ui/index.d.ts +0 -20
- package/dist/cjs/src/components/Pickaxe/ui/types.d.ts +0 -5
- package/dist/esm/src/components/Pickaxe/ui/Input/StyledAttachmentGrid.d.ts +0 -7
- package/dist/esm/src/components/Pickaxe/ui/Input/StyledIconButton.d.ts +0 -10
- package/dist/esm/src/components/Pickaxe/ui/Input/StyledImagePreview.d.ts +0 -12
- package/dist/esm/src/components/Pickaxe/ui/Input/StyledInputContainer.d.ts +0 -13
- package/dist/esm/src/components/Pickaxe/ui/Input/StyledInputWrapper.d.ts +0 -13
- package/dist/esm/src/components/Pickaxe/ui/Input/StyledRemoveButton.d.ts +0 -13
- package/dist/esm/src/components/Pickaxe/ui/Input/StyledTextareaWrapper.d.ts +0 -8
- package/dist/esm/src/components/Pickaxe/ui/Message/StyledIconWrapper.d.ts +0 -11
- package/dist/esm/src/components/Pickaxe/ui/Message/StyledMessage.d.ts +0 -10
- package/dist/esm/src/components/Pickaxe/ui/Message/StyledMessageBubble.d.ts +0 -14
- package/dist/esm/src/components/Pickaxe/ui/Message/StyledMessageContainer.d.ts +0 -10
- package/dist/esm/src/components/Pickaxe/ui/StyledCopyButton.d.ts +0 -12
- package/dist/esm/src/components/Pickaxe/ui/StyledDocumentCard.d.ts +0 -25
- package/dist/esm/src/components/Pickaxe/ui/StyledIceBreaker.d.ts +0 -20
- package/dist/esm/src/components/Pickaxe/ui/StyledLoadingDots.d.ts +0 -9
- package/dist/esm/src/components/Pickaxe/ui/index.d.ts +0 -20
- package/dist/esm/src/components/Pickaxe/ui/types.d.ts +0 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),t=require("../../hooks/pickaxe/usePickaxeContext.js"),r=require("@tanstack/react-query"),s=require("../Pickaxe/index.js"),n=require("../Pickaxe/Provider.js"),a=require("../../common/cn.js");const l=new r.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),o=({children:e})=>{var r;const{styles:s,deploymentDimensions:n,isNewChat:l,isDropShadow:o}=t.usePickaxeContext();return i.jsx("div",Object.assign({className:a.default("relative top-0 flex w-full flex-col transition-all",o&&"shadow-embed",!l&&"overflow-y-auto overflow-x-hidden scrollbar scrollbar-thin"),style:Object.assign(Object.assign({borderRadius:null!==(r=null==s?void 0:s.cornerRadius)&&void 0!==r?r:0},"px"===(null==n?void 0:n.width.unit)?{width:n.width.value+n.width.unit}:"%"===(null==n?void 0:n.width.unit)?{width:"100%",maxWidth:n.maxWidth+"px"}:{}),l?{height:58}:"px"===(null==n?void 0:n.height.unit)?{height:n.height.value+"px"}:"auto"===(null==n?void 0:n.height.unit)?{minHeight:n.minHeight+"px",maxHeight:n.maxHeight+"px"}:{})},{children:e}))};exports.ChatInput=t=>{var{formId:a,className:u}=t,d=e.__rest(t,["formId","className"]);return i.jsx(r.QueryClientProvider,Object.assign({client:l},{children:i.jsx(n.PickaxeProvider,Object.assign({},d,{deploymentType:"chat-input",isEmbed:!0},{children:i.jsx(o,{children:i.jsx(s.Pickaxe,Object.assign({formId:a},u&&{className:u}))})}))}))},exports.ChatInputWrapper=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),t=require("react"),s=require("../../hooks/pickaxe/usePickaxeContext.js"),n=require("@tanstack/react-query"),a=require("../Pickaxe/index.js"),r=require("../Pickaxe/Provider.js"),o=require("framer-motion"),c=require("../Icons/pickaxe.svg.js"),l=require("../Icons/spark.svg.js"),d=require("../Icons/x.svg.js"),u=require("../../common/cn.js");const h=new n.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),m=({isOpen:n,setIsOpen:a})=>{const{colors:r,deploymentMisc:o}=s.usePickaxeContext(),[u,h]=t.useState({src:"",isLarge:!1}),[m,g]=t.useState(!0);return t.useEffect((()=>{e.__awaiter(void 0,void 0,void 0,(function*(){try{if(!(null==o?void 0:o.fabImage))return;g(!0);const e=new Image;e.src=o.fabImage,yield e.decode();const i=e.width>200;h({src:o.fabImage,isLarge:i})}catch(e){console.error("[pxe] error loading FAB image:",e),h({src:"",isLarge:!1})}finally{g(!1)}}))}),[null==o?void 0:o.fabImage]),m?null:i.jsx("button",Object.assign({className:"absolute z-50 flex h-[60px] w-[60px] cursor-pointer items-center justify-center overflow-hidden rounded-full bg-white dark:bg-black",style:{boxShadow:"0px 6px 6px rgba(0, 0, 0, 0.12)",background:r.primary,color:r.text,bottom:20,right:20},onClick:()=>a(!n)},{children:n?i.jsx(x,Object.assign({id:"close-btn"},{children:i.jsx(d.default,{className:"shrink-0 select-none",style:{width:28,height:28}})})):i.jsx(x,Object.assign({id:"open-btn"},{children:u.src===`https://${process.env.NEXT_PUBLIC_PICKAXE_DOMAIN}/builder/assets/images/pickaxe-chaticons/chaticon2.png`?i.jsx(l.default,{className:"h-6 w-6 shrink-0 select-none"}):u.src?i.jsx("img",{src:u.src,alt:"FAB Icon",width:u.isLarge?60:24,height:u.isLarge?60:24,className:"select-none"}):i.jsx(c.default,{className:"h-6 w-6 shrink-0 select-none"})}))}))},x=({id:e,children:t})=>i.jsx(o.motion.div,Object.assign({initial:{opacity:0,rotate:-10},animate:{opacity:1,rotate:0},exit:{opacity:0,rotate:10},transition:{duration:.3}},{children:t}),e);exports.FAB=s=>{var c,l,d,x,{formId:g,className:b}=s,p=e.__rest(s,["formId","className"]);const[v,f]=t.useState(!1),[j,w]=t.useState({}),y=()=>{const e=p.deploymentDimensions;if(!e)return;const i={value:e.width.value,unit:e.width.unit},t=e.maxWidth,s={value:e.height.value,unit:e.height.unit},n=e.minHeight,a=e.maxHeight,r=window.innerHeight-150,o=window.innerWidth-40;let c=0;c="px"===s.unit?s.value:a;let l=Math.min(c,r);l=Math.max(l,n,100),l=Math.min(l,r);let d=0;d="px"===i.unit?i.value:t;let u=Math.min(d,o,t);u=Math.max(u,150),u=Math.min(u,o);w({width:"%"===i.unit?i.value+"%":u+"px",minWidth:150,maxWidth:u,height:"auto"===s.unit?s.value:l+"px",minHeight:100,maxHeight:l})};return t.useEffect((()=>(y(),window.addEventListener("resize",y),()=>window.removeEventListener("resize",y))),[p.deploymentDimensions]),i.jsx(n.QueryClientProvider,Object.assign({client:h},{children:i.jsx(r.PickaxeProvider,Object.assign({},p,{deploymentType:"fab",isEmbed:!0},{children:i.jsxs(o.AnimatePresence,{children:[v&&i.jsx(o.motion.div,Object.assign({initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.1},className:u.default("transition-h absolute z-50 flex flex-col overflow-hidden bg-transparent",p.isDropShadow&&"shadow-embed"),style:Object.assign({transformOrigin:"bottom right",borderRadius:null!==(l=null===(c=p.styles)||void 0===c?void 0:c.cornerRadius)&&void 0!==l?l:0,bottom:100,right:20},j)},{children:i.jsx("div",Object.assign({className:"flex flex-col overflow-auto h-full scrollbar scrollbar-thin dark:bg-black",style:{borderRadius:null!==(x=null===(d=p.styles)||void 0===d?void 0:d.cornerRadius)&&void 0!==x?x:0}},{children:i.jsx(a.Pickaxe,Object.assign({formId:g},b&&{className:b}))}))}),"fab-content"),i.jsx(m,{isOpen:v,setIsOpen:f})]})}))}))},exports.FABButton=m;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),n=require("@tanstack/react-query"),s=require("../Pickaxe/index.js"),t=require("../Pickaxe/Provider.js"),o=require("../../common/cn.js");const l=new n.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}});exports.Inline=r=>{var d,a,m,u,c,h,{formId:x,className:p}=r,v=e.__rest(r,["formId","className"]);return i.jsx(n.QueryClientProvider,Object.assign({client:l},{children:i.jsx(t.PickaxeProvider,Object.assign({},v,{deploymentType:"inline",isEmbed:!0},{children:i.jsx("div",Object.assign({className:o.default("relative top-0 flex w-full flex-col overflow-y-auto overflow-x-hidden transition-all scrollbar scrollbar-thin",v.isDropShadow&&"shadow-embed"),style:Object.assign(Object.assign({borderRadius:null!==(a=null===(d=v.styles)||void 0===d?void 0:d.cornerRadius)&&void 0!==a?a:0},"px"===(null===(m=v.deploymentDimensions)||void 0===m?void 0:m.width.unit)?{width:v.deploymentDimensions.width.value+v.deploymentDimensions.width.unit}:"%"===(null===(u=v.deploymentDimensions)||void 0===u?void 0:u.width.unit)?{width:"100%",maxWidth:v.deploymentDimensions.maxWidth+"px"}:{}),"px"===(null===(c=v.deploymentDimensions)||void 0===c?void 0:c.height.unit)?{height:v.deploymentDimensions.height.value+"px"}:"auto"===(null===(h=v.deploymentDimensions)||void 0===h?void 0:h.height.unit)?{minHeight:v.deploymentDimensions.minHeight+"px",maxHeight:v.deploymentDimensions.maxHeight+"px"}:{})},{children:i.jsx(s.Pickaxe,Object.assign({formId:x},p&&{className:p}))}))}))}))};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),i=require("react/jsx-runtime"),o=require("react"),s=require("../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../hooks/pickaxe/usePickaxe.js"),n=require("../../hooks/studio/useStyleFontSize.js"),l=require("@tanstack/react-query"),a=require("../Pickaxe/index.js"),r=require("../Pickaxe/Provider.js"),d=require("../Icons/x.svg.js"),u=require("../Core/Modal/index.js"),c=require("../Core/Modal/Body.js"),m=require("../../common/cn.js");const p=new l.QueryClient({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),x=({formId:e,setIsOpen:o})=>{var l;const{colors:a,styles:r,deploymentDimensions:d,deploymentMisc:u}=s.usePickaxeContext(),c=n.useStyleFontSize(),p=t.useInstantPickaxe(e);return p.isLoading?null:i.jsx("button",Object.assign({style:Object.assign(Object.assign(Object.assign({},"Real Head Pro"!==r.font&&{fontFamily:r.font}),{color:a.accentText,backgroundColor:a.accent,borderRadius:r.cornerRadius+"px",borderWidth:r.outlineThickness+"px",maxWidth:"%"===(null==d?void 0:d.width.unit)?(null==d?void 0:d.maxWidth)+"px":(null==d?void 0:d.width.value)+"px",minHeight:48}),"Real Head Pro"!==r.font&&{fontFamily:r.font}),className:m.default(c.b2,"flex w-max min-w-[130px] select-none items-center font-semibold justify-center gap-x-3 px-4 hover:duration-300 focus:outline focus:outline-black/30 active:opacity-90 disabled:cursor-not-allowed dark:focus:outline-white/30"),onClick:()=>o(!0)},{children:i.jsx("p",Object.assign({className:m.default(c.b2,"font-semibold"),style:Object.assign({color:a.accentText},"Real Head Pro"!==r.font&&{fontFamily:r.font})},{children:(null==u?void 0:u.popupText)||(null===(l=p.data)||void 0===l?void 0:l.formtitle)||"Open Tool"}))}))};exports.Popup=s=>{var t,n,h,v,j,y,b,f,g,{formId:O,className:k}=s,w=e.__rest(s,["formId","className"]);const[P,q]=o.useState(!1);return i.jsx(l.QueryClientProvider,Object.assign({client:p},{children:i.jsxs(r.PickaxeProvider,Object.assign({},w,{deploymentType:"popup",isEmbed:!0},{children:[i.jsx(x,{formId:O,setIsOpen:q}),i.jsx(u.default,Object.assign({isOpen:P,onChange:()=>q(!1)},{children:i.jsxs(c.default,Object.assign({className:m.default("relative bg-transparent overflow-hidden",w.isDropShadow&&"shadow-embed"),style:{borderRadius:(null!==(n=null===(t=w.styles)||void 0===t?void 0:t.cornerRadius)&&void 0!==n?n:0)+"px"}},{children:[i.jsx("div",Object.assign({className:"overflow-auto scrollbar scrollbar-thin",style:Object.assign(Object.assign({borderRadius:(null!==(v=null===(h=w.styles)||void 0===h?void 0:h.cornerRadius)&&void 0!==v?v:0)+"px"},"px"===(null===(j=w.deploymentDimensions)||void 0===j?void 0:j.width.unit)?{width:w.deploymentDimensions.width.value+w.deploymentDimensions.width.unit}:"%"===(null===(y=w.deploymentDimensions)||void 0===y?void 0:y.width.unit)?{width:Math.floor(w.deploymentDimensions.maxWidth*(w.deploymentDimensions.width.value/100))}:{}),"px"===(null===(b=w.deploymentDimensions)||void 0===b?void 0:b.height.unit)?{height:w.deploymentDimensions.height.value+"px"}:"auto"===(null===(f=w.deploymentDimensions)||void 0===f?void 0:f.height.unit)?{height:w.deploymentDimensions.minHeight+"px",maxHeight:w.deploymentDimensions.maxHeight+"px"}:{})},{children:i.jsx(a.Pickaxe,Object.assign({formId:O},k&&{className:k}))})),i.jsx("button",Object.assign({className:"absolute z-10 outline-none hover:opacity-70 hover:duration-300 active:opacity-100",onClick:()=>q(!1),style:{right:12,top:12,color:(null===(g=w.colors)||void 0===g?void 0:g.text)||"#000"}},{children:i.jsx(d.default,{className:"h-5 w-5 shrink-0"})}))]}))}))]}))}))},exports.PopupCTAButton=x;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),a=require("../../../../hooks/pickaxe/usePickaxeContext.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),a=require("../../../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../../../hooks/pickaxe/useResponseContext.js"),l=require("../../../../hooks/pickaxe/useDimensionContext.js"),i=require("../../Addons/Scroll/hooks/useScrollContext.js"),o=require("../../../../hooks/studio/useStyleFontSize.js"),n=require("../../../../hooks/pickaxe/useConversation.js"),r=require("../../common/PickaxeIcon.js"),c=require("../../../Core/ErrorAlert.js"),d=require("../../../Core/Skeleton.js"),u=require("../../Addons/Scroll/ScrollLockView.js"),x=require("../../common/PickaxeHead.js"),m=require("../../common/PickaxeCompactHead.js"),f=require("../../common/PickaxeUpgradeCard.js"),j=require("./Message.js"),h=require("../../common/PickaxeBranding.js"),p=require("../../../../common/cn.js");exports.default=({hideInfo:g,isInputFocused:v})=>{var w;const N=n.useConversation(),b=o.useStyleFontSize(),{pickaxe:k,colors:y,misc:C,isNewChat:O,isRtl:q,isEmbed:S,setChatId:P}=a.usePickaxeContext(),{scrollContainerRef:I}=i.useScrollContext(),{messages:E,status:L,limitData:M,error:A}=t.useResponseContext(),{height:D}=l.useDimensionContext(),H=s.useMemo((()=>!!N.data&&!(N.data.messages.length<=1)),[N.data]),R=s.useMemo((()=>!g&&N.isSuccess&&O&&!H),[g,N.isSuccess,O,H]),z=s.useMemo((()=>{var e,s;return!!E.length&&!(null!==(s=null===(e=null==E?void 0:E[E.length-1])||void 0===e?void 0:e.content)&&void 0!==s?s:"").trim()}),[E]);return e.jsx("div",Object.assign({ref:I,className:"flex w-full flex-col items-center overflow-y-auto mb-12 pb-8",style:{height:`calc(${D}px - 74px)`}},{children:e.jsxs("div",Object.assign({className:"relative flex flex-col items-center flex-grow w-full max-w-[800px] px-4"},{children:[(R||!S)&&!C.isWhiteLabel&&e.jsx(h.default,{className:p.default("absolute top-4 right-4",!R&&!S&&"top-2"),animateHover:!0}),e.jsx(x.default,{className:p.default("opacity-0 mt-[0%] transition-all duration-500 ease-in-out max-h-0 overflow-hidden max-w-[500px]",R&&"opacity-100 mt-[10%] max-h-[100%]"),iconClassName:"duration-300 hover:opacity-90",maxDescriptionChars:500,onIconClick:()=>P("")}),S&&!N.isLoading&&e.jsx(m.default,{className:p.default("opacity-0 transition-all duration-500 ease-in-out h-0 w-full",!R&&"opacity-100 h-[56px]"),iconClassName:"duration-300 hover:opacity-90",onIconClick:()=>P("")}),e.jsx("div",Object.assign({className:p.default("flex flex-col mt-6 transition-all duration-300 ease-in-out w-full",S&&!N.isLoading&&!R&&"mt-0")},{children:N.isLoading&&!(null==k?void 0:k.enablechatresponses)?e.jsxs("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[O&&e.jsxs("div",Object.assign({className:"flex flex-col items-center w-full"},{children:[e.jsx(d.default,{className:"w-[72px] h-[72px]"}),e.jsx(d.default,{className:"h-[20px] mt-6 w-full"}),e.jsx(d.default,{className:"h-[20px] mt-2 w-full"}),e.jsx(d.default,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]})),e.jsx(d.default,{className:"h-10 w-[70%] animate-pulse justify-self-end rounded"}),e.jsx(d.default,{className:"h-[150px] w-[70%] animate-pulse rounded"}),e.jsx(d.default,{className:"h-10 w-[50%] animate-pulse justify-self-end rounded"})]})):N.isError?e.jsx("div",Object.assign({className:"flex w-full justify-center"},{children:e.jsxs("p",Object.assign({className:p.default(b.b2,"text-center font-semibold")},{children:["Something went wrong. Please try again, or"," ",e.jsx("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help",target:"_blank",rel:"noreferrer"},{children:"contact us"}))," ","for help."]}))})):N.data?e.jsxs("div",Object.assign({className:"flex flex-col w-full"},{children:[e.jsxs("div",Object.assign({className:"grid grid-cols-1 gap-y-6 w-full"},{children:[N.data.messages.map(((s,a)=>e.jsx(j.default,Object.assign({index:a,message:s},0===a&&{isIntroExpand:v}),a))),E.map(((s,a)=>e.jsx(j.default,{index:N.data.messages.length+a,message:s},a))),"fetching"===L||z?e.jsx("div",Object.assign({className:p.default("flex w-full",q?"justify-end":"justify-start")},{children:e.jsx("div",Object.assign({className:"flex flex-col"},{children:e.jsxs("div",Object.assign({className:p.default("flex gap-x-3",q&&"flex-row-reverse")},{children:["NONE"!==(null==k?void 0:k.chaticon)&&e.jsx(r.default,{src:null!==(w=null==k?void 0:k.chaticon)&&void 0!==w?w:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/chaticons/${null==k?void 0:k.formid}.png`,alt:`${null==k?void 0:k.formtitle}'s Chat Icon`,width:24,height:24,className:"my-3 h-6 w-6",textColor:y.text}),e.jsx("div",Object.assign({className:"flex items-center gap-x-2 rounded px-2"},{children:Array.from({length:3}).map(((s,a)=>e.jsx("div",{className:p.default("h-1.5 w-1.5 animate-dot rounded-full",1===a&&"animate-dot-down"),style:{backgroundColor:y.secondaryText}},a)))}))]}))}))})):M?e.jsx("div",Object.assign({className:"flex max-w-[80%] items-center gap-x-3"},{children:e.jsx(f.default,{})})):A?e.jsx("div",Object.assign({className:p.default("flex items-center gap-x-3",q?"justify-end":"justify-start")},{children:e.jsx(c.default,{error:A})})):null]})),e.jsx(u.default,{className:"w-full"})]})):null}))]}))}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("react"),r=require("../../../hooks/pickaxe/usePickaxeContext.js"),o=require("../../../hooks/pickaxe/useResponseContext.js"),l=require("../../../hooks/studio/useStyleInput.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),s=require("react/jsx-runtime"),t=require("react"),r=require("../../../hooks/pickaxe/usePickaxeContext.js"),o=require("../../../hooks/pickaxe/useResponseContext.js"),l=require("../../../hooks/studio/useStyleInput.js"),a=require("../../../hooks/studio/useStyleFontSize.js"),i=require("../../../hooks/pickaxe/useConversation.js"),n=require("../../../hooks/pickaxe/useSubmit.js"),d=require("../Addons/Document/hooks/useDocument.js"),c=require("../Addons/Scroll/hooks/useScroll.js"),u=require("../../../hooks/core/useHover.js"),m=require("../../../common/utils.js"),f=require("../../../common/documents.js"),x=require("eventsource-parser"),p=require("../../Icons/attach-vertical.svg.js"),h=require("../../Icons/spinner-lines.svg.js"),g=require("../../Icons/file.svg.js"),b=require("../../Icons/x.svg.js"),j=require("../../Icons/arrow-right.svg.js"),v=require("../Addons/IceBreaker/index.js"),y=require("../../Core/Textarea.js"),k=require("../../../common/error.js"),w=require("../../../common/cn.js");exports.default=({isFocused:I,onFocus:N,onBlur:O})=>{var C;const{formId:q,chatId:S,userId:R,studioUserId:T,embedUserId:_,deploymentId:A,deploymentType:F,pickaxe:B,styles:D,colors:U,responsiveBy:H,isNewChat:E,isRtl:z,setIsNewChat:M,setIsShowIceBreaker:P,onGenerateComplete:L}=r.usePickaxeContext(),{messages:$,status:G,limits:J,isGenerating:K,setMessages:W,setStatus:Q,setLimitData:V,setError:X}=o.useResponseContext(),{documents:Y,isUploading:Z,isImageUploadAllowed:ee,setDocuments:se,onFileUpload:te}=d.useDocument(),{scrollStartSession:re,scrollEndSession:oe,scrollToBottom:le}=c.useScroll({auto:!0}),ae=i.useConversation(),ie=n.useSubmit(),[ne,de]=t.useState(""),ce=t.useRef(null),ue=u.useHover(),{isHover:me}=ue,fe=e.__rest(ue,["isHover"]),xe=u.useHover(),{isHover:pe}=xe,he=e.__rest(xe,["isHover"]),ge=a.useStyleFontSize(),be=l.useStyleInput(),je=t.useMemo((()=>{var e,s,t;return!!E&&(!!B&&(!ae.isLoading&&(!((null!==(s=null===(e=ae.data)||void 0===e?void 0:e.messages.length)&&void 0!==s?s:0)>1)&&!!(null===(t=B.icebreakers)||void 0===t?void 0:t.length))))}),[B,E,ae.data,ae.isLoading]),ve=s=>e.__awaiter(void 0,void 0,void 0,(function*(){try{if("idle"!==G||Z)return;const e=null!=s?s:ne;if(!e)return;X(""),V(null),de(""),M(!1),Q("fetching"),re(),le();const t=Y.filter((e=>"finished"===e.status&&!e.isInsertedAsRaw)),r=t.length?t[t.length-1].documentId:"",o="enduserupload"===(null==B?void 0:B.documentuploadtype)&&r,l=[...Array.from($),Object.assign({id:$.length+1,role:"user",content:e},o&&{documentIds:[r]})];W(l),le(),o&&se([]);const a=(yield ie.mutateAsync(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({formId:q,responseId:S,value:e},o&&{documentId:r}),R&&{userId:R}),T&&{studioUserId:T}),_&&{embedUserId:_}),A&&{deploymentId:A}))).body;if(!a)throw new Error("Streaming error");const i=l.length,n=new TextDecoder,d=a.getReader();let c="",u=!0,m=!1;const f=x.createParser({onEvent:e=>{if("delta"===e.event){const s=JSON.parse(e.data).token.replace(/\u200B/g,"");c+=s,W([...l.slice(0,i),{id:$.length+1,role:"assistant",content:c}])}else if("error"===e.event){const s=JSON.parse(e.data);X(s.error||"Something went wrong, please try again.")}else"stop"===e.event&&(u=!1)}});for(;u;){const{value:e,done:s}=yield d.read();if(s){u=!1;break}const t=n.decode(e);t&&(m||(Q("streaming"),m=!0),f.feed(t))}null==L||L(S)}catch(e){let s=k.default(e)||"";s&&!s.includes("Unexpected token 'A',")||(s="Oops! We're experiencing high traffic at the moment. Please try again later.");const t=Object.entries(J).find((([e])=>s.includes(e)));t?V(t[1]):X(s)}finally{le(),Q("idle"),oe()}}));return t.useEffect((()=>{P(je)}),[je]),s.jsx("div",Object.assign({className:w.default("w-full flex flex-col items-center absolute bottom-0 left-0 z-1",!("chat-input"===F&&E)&&"px-4 pb-4"),dir:z?"rtl":"ltr"},{children:s.jsxs("div",Object.assign({className:"relative flex flex-col max-w-[800px] w-full"},{children:[!("chat-input"===F&&E)&&s.jsx("div",Object.assign({className:w.default("absolute bottom-full",z?"left-0":"right-0")},{children:s.jsx("div",Object.assign({className:w.default("flex flex-col gap-2 pb-4 px-2",z?"justify-start":"justify-end","viewport"===H?z?"min-[767px]:items-start":"min-[767px]:items-end":z?"@[767px]/pickaxe-root:items-start":"@[767px]/pickaxe-root:items-end")},{children:je&&!I&&s.jsx(v.default,{data:(null==B?void 0:B.icebreakers)||[],onSend:ve})}))})),s.jsxs("div",Object.assign({className:w.default("flex flex-col gap-y-2 px-4 py-3","block"===D.formFieldStyle&&"shadow"),style:be},{children:["idle"===G&&Y.length>0&&s.jsx("div",Object.assign({className:w.default("grid grid-cols-1","viewport"===H?"min-[765px]:grid-cols-2":"@[767px]/pickaxe-root:grid-cols-2")},{children:Y.map((e=>{var r,o,l;return s.jsx(t.Fragment,{children:"document"===e.type?s.jsxs("div",Object.assign({className:w.default("relative gap-x-[10px] flex items-center px-2 h-[56px] border",z&&"flex-row-reverse"),style:{borderRadius:be.borderRadius,borderColor:U.secondaryText+"50"}},{children:[s.jsx("div",Object.assign({className:"w-10 h-10 flex items-center justify-center shrink-0",style:{backgroundColor:U.accent,borderRadius:be.borderRadius}},{children:Z?s.jsx(h.default,{className:"w-5 h-5 animate-spin",style:{color:U.accentText}}):s.jsx(g.default,{className:"w-5 h-5",style:{color:U.accentText}})})),s.jsxs("div",Object.assign({className:w.default("flex flex-col justify-center truncate",z?"text-right items-end":"text-left items-start")},{children:[s.jsx("p",Object.assign({className:(w.default(ge.b3),"font-medium truncate")},{children:e.name})),s.jsx("p",Object.assign({className:w.default(ge.b4,"opacity-80 truncate")},{children:m.formatBytes(e.size)}))]})),s.jsx("button",Object.assign({type:"button",className:w.default("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",z?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:U.accent,borderColor:be.backgroundColor},disabled:Z||"idle"!==G,onClick:()=>se([])},{children:s.jsx(b.default,{className:"w-4 h-4",style:{color:U.accentText}})}))]})):"image"===e.type?s.jsxs("div",Object.assign({className:"relative h-[56px] w-[56px] bg-stone-100",style:{borderRadius:be.borderRadius}},{children:["finished"===e.status?s.jsx("img",{style:{borderRadius:be.borderRadius},className:"object-cover w-full h-full",src:`https://prod-pickaxe-assets.s3.us-west-2.amazonaws.com/documentinterrogation/${null===(r=e.documentId)||void 0===r?void 0:r.split("-")[2]}/${null===(o=e.documentId)||void 0===o?void 0:o.split("-")[1]}.${null===(l=e.documentId)||void 0===l?void 0:l.split("-")[2]}`,alt:""}):s.jsx("div",{className:"h-full w-full animate-pulse",style:{borderRadius:be.borderRadius,backgroundColor:U.secondary}}),s.jsx("button",Object.assign({type:"button",className:w.default("absolute w-5 h-5 rounded-full -top-2 flex items-center justify-center border outline-none disabled:cursor-default",z?"-left-2 right-auto":"-right-2 left-auto"),style:{backgroundColor:U.accent,borderColor:be.backgroundColor},disabled:Z||"idle"!==G,onClick:()=>se([])},{children:s.jsx(b.default,{className:"w-4 h-4",style:{color:U.accentText}})}))]})):null},e.id)}))})),s.jsxs("div",Object.assign({className:w.default("flex items-end gap-x-2",z&&"flex-row-reverse")},{children:[s.jsx(y.default,Object.assign({className:w.default(ge.i1,"max-h-60 min-h-[27px] w-full border-transparent bg-transparent",!ne.length&&"max-h-6 overflow-hidden text-ellipsis whitespace-nowrap",z?"text-right":"text-left"),value:ne,placeholder:z?"بماذا تريد أن تتحدث؟":null!==(C=null==B?void 0:B.placeholdertext)&&void 0!==C?C:"What do you want to talk about?",onChange:e=>de(e),onKeyDown:e=>{"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),Z||"idle"!==G||ve()))}},N&&{onFocus:N},O&&{onBlur:O},{dir:z?"rtl":"ltr"})),s.jsxs("div",Object.assign({className:w.default("flex items-center gap-x-2")},{children:["enduserupload"===(null==B?void 0:B.documentuploadtype)&&s.jsxs("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 ease-in-out",style:{backgroundColor:pe?U.accent+"10":void 0},disabled:Z||"idle"!==G,onClick:()=>{var e;return null===(e=ce.current)||void 0===e?void 0:e.click()}},he,{children:[s.jsx("input",{id:"file-upload",ref:ce,type:"file",accept:[...f.allowedFileMimeTypes,...ee?f.allowedImageMimeTypes:[]].join(", "),multiple:!1,hidden:!0,className:"hidden",onChange:s=>e.__awaiter(void 0,void 0,void 0,(function*(){M(!1),yield te(Array.from(s.target.files||[])),s.target.value=""}))}),s.jsx(p.default,{className:"h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",style:{color:pe?U.accent:U.accent+"80"}})]})),s.jsx("button",Object.assign({className:"outline-none disabled:cursor-default w-8 h-8 flex items-center justify-center rounded-full duration-200 transition-colors ease-in-out",style:{backgroundColor:(me||ne.length||Y.length&&Y.every((e=>"finished"===e.status)))&&!K?U.accent:U.accent+"10"},disabled:Z||"idle"!==G,onClick:()=>ve()},fe,{children:s.jsx(j.default,{className:w.default("h-6 w-6 shrink-0 duration-200 transition-colors ease-in-out",z&&"transform scale-x-[-1]"),style:{color:(me||ne.length||Y.length&&Y.every((e=>"finished"===e.status)))&&!K?U.accentText:U.accent+"80"}})}))]}))]}))]}))]}))}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),s=require("../../../hooks/pickaxe/
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),s=require("../../../hooks/pickaxe/usePickaxeContext.js"),r=require("../../../hooks/pickaxe/useDimensionContext.js"),n=require("../Addons/Document/hooks/useDocument.js"),i=require("./History/index.js"),o=require("./Input.js");exports.default=()=>{const{deploymentType:u,isNewChat:c}=s.usePickaxeContext(),{width:x,height:a,setDimension:l}=r.useDimensionContext(),{setDocuments:d}=n.useDocument(),[f,h]=t.useState(!1),j=t.useRef(null);return t.useEffect((()=>()=>{d([])}),[]),t.useEffect((()=>{if(!j.current)return;const e=new ResizeObserver((e=>{for(const t of e){const{width:e,height:s}=t.contentRect;l(parseInt(e.toFixed(0)),parseInt(s.toFixed(0)))}}));return e.observe(j.current),()=>{e.disconnect()}}),[j.current]),"chat-input"===u&&c?e.jsx("div",Object.assign({className:"relative flex flex-grow flex-col items-center"},{children:e.jsx(o.default,{})})):e.jsxs("div",Object.assign({ref:j,className:"flex flex-grow flex-col items-center"},{children:[e.jsx(i.default,{hideInfo:a<=545||x<=500||f,isInputFocused:f}),e.jsx(o.default,{isFocused:f,onFocus:()=>h(!0),onBlur:()=>h(!1)})]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),i=require("react"),s=require("./Addons/Document/Provider.js"),o=require("./ResponseProvider.js"),r=require("./DimensionProvider.js");function n(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(i){if("default"!==i){var s=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,s.get?s:{enumerable:!0,get:function(){return e[i]}})}})),t.default=e,Object.freeze(t)}const d=i.createContext({});exports.PickaxeContext=d,exports.PickaxeProvider=({children:a,userId:l="",studioUserId:c="",deploymentId:u="",embedUserId:f="",deploymentType:p,deploymentDimensions:m,deploymentMisc:b,styles:y,colors:h,limits:v={},misc:x={isWhiteLabel:!0,isProfileImage:!0,isChatImage:!0,isTitle:!0,isDescription:!0,isHistory:!0},translations:F,responsiveBy:g="viewport",forceMobile:j=!1,disableHtml:I=!1,disableJs:P=!1,disableCss:w=!1,loadFont:S=!0,isRtl:O=!1,isEmbed:k=!1,isDropShadow:C=!1,onGenerateComplete:D})=>{const[_,q]=i.useState(""),[E,H]=i.useState(""),[M,R]=i.useState(null),[T,U]=i.useState(!1),[B,L]=i.useState(!0),[N,z]=i.useState(!0);return i.useEffect((()=>{U(!1)}),[null==y?void 0:y.font]),i.useEffect((()=>{e.__awaiter(void 0,void 0,void 0,(function*(){if("undefined"!=typeof window&&S&&!T&&(null==y?void 0:y.font)&&"Real Head Pro"!==y.font)try{(yield Promise.resolve().then((function(){return n(require("webfontloader"))}))).default.load({google:{families:[y.font]},active:()=>{U(!0)},inactive:()=>{console.error("[pxe] failed to load font {styles.font}"),U(!0)}})}catch(e){console.error("[pxe] failed to load font:",e),U(!0)}}))}),[S,T,null==y?void 0:y.font]),t.jsx(d.Provider,Object.assign({value:Object.assign({formId:_,chatId:E,userId:l,studioUserId:c,embedUserId:f,deploymentId:u,deploymentType:p,deploymentDimensions:m,deploymentMisc:b,pickaxe:M,styles:Object.assign({theme:"light",font:"Real Head Pro",fontSize:"md",formFieldStyle:"box",btnStyle:"filled",outlineThickness:1,cornerRadius:4},y),colors:Object.assign({primary:"#F6F8FA",text:"#000000",secondary:"#FFFFFF",secondaryText:"#000000",accent:"#228DD7",accentText:"#FFFFFF",error:"#EF4444"},h),misc:x,translations:Object.assign({"new-chat":"New chat","see-history":"See history","see-input":"See input","hide-input":"Hide input",processing:"Processing...",uploading:"Uploading...",loading:"Loading...","powered-by-pickaxe":"Powered by Pickaxe","form-doc-placeholder":"Paste a website/video link or drag a file",website:"Website"},F),responsiveBy:g,forceMobile:j,loadFont:S,disableHtml:I,disableJs:P,disableCss:w,isFontLoaded:T,isNewChat:B,isShowIceBreaker:N,isRtl:O,isEmbed:k,isDropShadow:C,setIsFontLoaded:U,setFormId:q,setChatId:H,setPickaxe:R,setIsNewChat:L,setIsShowIceBreaker:z},D&&{onGenerateComplete:D})},{children:t.jsx(o.default,Object.assign({limits:v},{children:t.jsx(r.default,{children:t.jsx(s.default,{children:a})})}))}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),s=require("../../../hooks/pickaxe/usePickaxeContext.js"),r=require("../../../hooks/studio/useStyleButton.js"),a=require("../../../hooks/studio/useStyleFontSize.js"),i=require("../../Core/Button.js"),o=require("../../../common/cn.js");exports.default=u=>{var{variant:n,className:l}=u,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),s=require("../../../hooks/pickaxe/usePickaxeContext.js"),r=require("../../../hooks/studio/useStyleButton.js"),a=require("../../../hooks/studio/useStyleFontSize.js"),i=require("../../Core/Button.js"),o=require("../../../common/cn.js");exports.default=u=>{var{variant:n,className:l,style:c}=u,y=e.__rest(u,["variant","className","style"]);const{styles:j}=s.usePickaxeContext(),v=r.useStyleButton({variant:n}),x=a.useStyleFontSize();return t.jsx(i.default,Object.assign({variant:n,className:o.default(x.l2,"min-h-[48px]",l,("primary"===n||"secondary"===n)&&"hover:opacity-90","outlined"===j.btnStyle&&"hover:opacity-70"),style:Object.assign(Object.assign({},v),c)},y))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),i=require("../../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../../hooks/studio/useStyleFontSize.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),i=require("../../../hooks/pickaxe/usePickaxeContext.js"),t=require("../../../hooks/studio/useStyleFontSize.js"),r=require("./PickaxeMarkdown/Renderer.js"),l=require("./PickaxeIcon.js"),a=require("./PickaxeInfoModal.js"),o=require("./PickaxeMarkdown/index.js"),c=require("../../../common/cn.js");exports.default=({className:n,iconClassName:d,maxDescriptionChars:u,onIconClick:x})=>{const{pickaxe:m,styles:j,colors:p,misc:k,disableHtml:f,disableJs:h,disableCss:b,isRtl:C}=i.usePickaxeContext(),[P,v]=s.useState(!1),g=t.useStyleFontSize(),q=s.useMemo((()=>({title:(null==m?void 0:m.formtitle)||"",description:(null==m?void 0:m.formdescription)||""})),[m]);return e.jsxs("div",Object.assign({className:c.default("flex flex-col items-center",n)},{children:[P&&e.jsx(a.default,{isOpen:P,onChangeIsOpen:v}),k.isProfileImage&&e.jsx(l.default,Object.assign({src:null==m?void 0:m.coverphoto,alt:`${null==m?void 0:m.formtitle}'s Profile Picture`,width:72,height:72,className:c.default("h-[72px] w-[72px] rounded-full",d,!!x&&"cursor-pointer")},x&&{onClick:x})),k.isTitle&&!!q.title&&e.jsx("h2",Object.assign({className:c.default(g.h2,"mt-6 text-center font-semilight opacity-90",!u&&"line-clamp-2")},{children:null==m?void 0:m.formtitle})),k.isDescription&&!!q.description&&e.jsx(o.PickaxeMarkdown,Object.assign({theme:j.theme,accentColor:p.accent},C&&{rtl:!0},f&&{disableHtml:!0},h&&{disableJs:!0},b&&{disableCss:!0},{children:e.jsx(r.PickaxeMarkdownRenderer,Object.assign({className:"mt-2 text-center",value:q.description},u&&{maxChars:u},{onExpandClick:()=>v(!0)}))}))]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("../../hooks/usePickaxeMarkdownContext.js"),s=require("../Img/index.js"),i=require("../common/Action.js"),o=require("./Audio.js"),a=require("./Html/index.js");exports.A=({href:c="",children:m})=>{const{accentColor:l,actions:n}=r.usePickaxeMarkdownContext(),u=t.useMemo((()=>{if(!c)return"";return c.startsWith("http://")?`https://${c.slice(7)}`:c.startsWith("www.")?`https://${c}`:c}),[c]),d=t.useMemo((()=>{const e=u.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(e)return{title:"youtube-embed",src:`https://www.youtube.com/embed/${e[1]}`};const t=u.match(/loom\.com\/(?:share|embed)\/([\w-]+)/i);if(t)return{title:"loom-embed",src:`https://www.loom.com/embed/${t[1]}`};const r=u.match(/vimeo\.com\/(?:video\/)?(\d+)/i);if(r)return{title:"vimeo-embed",src:`https://player.vimeo.com/video/${r[1]}`};const s=u.match(/streamable\.com\/([\w-]+)/i);return s?{title:"streamable-embed",src:`https://streamable.com/e/${s[1]}`}:null}),[u]),p=t.useMemo((()=>u.match(/\.(jpeg|jpg|gif|bmp|webp|svg|tiff|avif|png|jfif|pjpeg|pjp)$/)),[u]),f=t.useMemo((()=>u.includes("action_generated_files")&&u.match(/\.(mp3|wav|ogg|flac|aac|wma|alac|m4a|aiff|ape|au|mid|midi|opus)$/)),[u]),h=t.useMemo((()=>u.includes("action_generated_files")&&u.match(/\.html$/)),[u]),b=t.useMemo((()=>n&&u.includes("pickaxe")&&(u.includes("/api/fn/result")||u.includes("/api/function_call_results"))),[n,u]);return d?e.jsx("div",Object.assign({className:"pxe-markdown-video"},{children:e.jsx("iframe",Object.assign({title:d.title,src:d.src,allowFullScreen:!0,style:{width:"100%",maxWidth:"560px",aspectRatio:"16 / 9"}},{children:"Iframe not supported, use a different browser."}))})):p?e.jsx(s.Img,{src:u,alt:"string"==typeof m?m:"Markdown Image"}):f?e.jsx(o.default,{url:u}):h?e.jsx(a.default,{url:u}):b?e.jsx(i.default,{jobUrl:u}):e.jsx("a",Object.assign({href:u,target:"_blank",rel:"noopener noreferrer",style:{color:l}},{children:m}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react")
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react");exports.P=({children:r})=>{const o=t.useMemo((()=>{if("string"!=typeof r)return null;const e=r.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/)([\w-]+)/i);if(e)return{title:"youtube-embed",src:`https://www.youtube.com/embed/${e[1]}`};const t=r.match(/loom\.com\/(?:share|embed)\/([\w-]+)/i);if(t)return{title:"loom-embed",src:`https://www.loom.com/embed/${t[1]}`};const o=r.match(/vimeo\.com\/(?:video\/)?(\d+)/i);if(o)return{title:"vimeo-embed",src:`https://player.vimeo.com/video/${o[1]}`};const s=r.match(/streamable\.com\/([\w-]+)/i);return s?{title:"streamable-embed",src:`https://streamable.com/e/${s[1]}`}:null}),[r]);return o?e.jsx("div",Object.assign({className:"pxe-markdown-video"},{children:e.jsx("iframe",Object.assign({title:o.title,src:o.src,allowFullScreen:!0,style:{width:"100%",maxWidth:"560px",aspectRatio:"16 / 9"}},{children:"Iframe not supported, use a different browser."}))})):e.jsx("p",{children:r})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),n=require("react"),t=require("./hooks/usePickaxeMarkdownContext.js"),s=require("./utils/custom-plugins.js"),i=require("react-markdown"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_tslib.js"),r=require("react/jsx-runtime"),n=require("react"),t=require("./hooks/usePickaxeMarkdownContext.js"),s=require("./utils/custom-plugins.js"),i=require("react-markdown"),a=require("remark-gfm"),o=require("remark-math"),l=require("rehype-katex"),u=require("rehype-raw"),c=require("./Components/A/index.js"),d=require("./Components/P/index.js"),p=require("./Components/Img/index.js"),h=require("./Components/Iframe/index.js"),m=require("./Components/Code/index.js"),x=require("./Components/Headings/index.js"),g=require("./Components/List/index.js"),f=require("./Components/Table/index.js"),b=require("./Components/Others/index.js"),j=require("./Components/Action/index.js"),C=require("../../../../common/cn.js");function q(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var k=q(i),w=q(a),v=q(o),y=q(l),A=q(u);exports.PickaxeMarkdownRenderer=({className:i,style:a,children:o,value:l,maxLines:u,maxChars:q,multiLineBreaks:O,recursion:H,onExpandClick:P})=>{const{accentColor:S,rtl:M,disableHtml:$,disableJs:T,disableCss:_}=t.usePickaxeMarkdownContext(),[E,I]=n.useState({width:0,height:0}),[L,B]=n.useState(null),N=n.useRef(null),R=n.useMemo((()=>{if(!l)return"";let e=l.trim();return e=e.replace(/<!--[\s\S]*?-->/g,""),e=e.replace(/\u200B/g,""),e=e.replace(/\\[\s\S]*?\\]/g,(e=>"$$"+e.substring(2,e.length-2)+"$$")).replace(/\\\(\s*[\s\S]*?\s*\\\)/g,(e=>"$$"+e.substring(2,e.length-2)+"$$")),O&&(e=e.replace(/```[\s\S]*?```|(\n(?=\n))/g,((e,r)=>r?"\n\n<br/>\n":e))),e||""}),[l,O]);n.useEffect((()=>{if(q)return void B(R.length>q?R.slice(0,q)+'<span class="pxe-expand-btn">...</span>':null);if(!u)return void B(null);if(!N.current||!R||L)return;const e=N.current,r=parseInt(window.getComputedStyle(e).lineHeight,10),n=u*r;if(!(E.height>n))return;const t=Math.floor(E.width/8),s=Math.floor(t*u);B(R.slice(0,s)+'<span class="pxe-expand-btn">...</span>')}),[R,u,q,E,L]);const z={h1:x.H1,h2:x.H2,h3:x.H3,h4:x.H4,h5:x.H5,p:d.P,a:c.A,img:p.Img,iframe:h.Iframe,code:m.Code,ol:g.Ol,ul:g.Ul,li:g.Li,table:f.Table,th:f.Th,tr:f.Tr,td:f.Td,hr:b.Hr,br:b.Br,blockquote:b.Blockquote,span:n=>{var{children:t}=n,s=e.__rest(n,["children"]);return"pxe-expand-btn"===s.className?r.jsx("span",Object.assign({},s,{style:Object.assign({display:"inline",fontWeight:500,color:S,marginLeft:".25rem",userSelect:"none"},P&&{cursor:"pointer"})},P&&{onClick:P},{children:t})):r.jsx("span",Object.assign({},s,{children:t}))},ActionCaption:j.ActionCaption,ActionFinished:j.ActionFinished,ActionError:j.ActionError};n.useEffect((()=>{if(!N.current)return;const e=new ResizeObserver((e=>{for(const r of e){const{width:e,height:n}=r.contentRect;I({width:e,height:n})}}));return e.observe(N.current),()=>{e.disconnect()}}),[]);const F=L||R;return r.jsxs("div",Object.assign({className:"pxe-markdown",ref:N,style:Object.assign({position:"relative",overflowWrap:"break-word",display:"grid",gridTemplateColumns:"repeat(1, minmax(0, 1fr))",gap:".625rem"},a)},M&&{dir:"rtl"},{children:[r.jsx(k.default,Object.assign({className:C.default(!H&&"pxe-prose",i),components:z,remarkPlugins:[w.default,[v.default,{singleDollarTextMath:!1}]],rehypePlugins:[y.default,...$?[]:[A.default],[s.rehypeSanitize,{disableJs:T,disableCss:_}],s.rehypePickaxeAction]},{children:F})),o]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("framer-motion"),t=require("../../../hooks/pickaxe/usePickaxeContext.js"),r=require("../../../hooks/pickaxe/useResponseContext.js"),a=require("../../../hooks/studio/useStyleFontSize.js"),i=require("../../Icons/circle-exclamation.svg.js"),l=require("../../Core/SpringTransition.js"),n=require("../../Core/HtmlRenderer.js"),c=require("./PickaxeButton.js"),o=require("../../../common/cn.js");exports.default=({className:u,iconClassName:x,htmlClassName:m})=>{const{colors:j}=t.usePickaxeContext(),d=
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("framer-motion"),t=require("../../../hooks/pickaxe/usePickaxeContext.js"),r=require("../../../hooks/pickaxe/useResponseContext.js"),a=require("../../../hooks/studio/useStyleFontSize.js"),i=require("../../Icons/circle-exclamation.svg.js"),l=require("../../Core/SpringTransition.js"),n=require("../../Core/HtmlRenderer.js"),c=require("./PickaxeButton.js"),o=require("../../../common/cn.js");exports.default=({className:u,iconClassName:x,htmlClassName:m})=>{const{colors:j}=t.usePickaxeContext(),{limitData:d}=r.useResponseContext(),f=a.useStyleFontSize();return e.jsx(s.AnimatePresence,{children:!!d&&e.jsxs(l.default,Object.assign({className:o.default("flex gap-3",u)},{children:[e.jsx(i.default,{className:o.default("h-5 w-5 shrink-0",x),style:{color:j.accent}}),e.jsxs("div",Object.assign({className:"flex flex-col gap-4"},{children:[e.jsx(n.default,{className:o.default(f.b2,"font-semibold",m),style:{color:j.text},html:d.html}),!!d.cta&&e.jsx("a",Object.assign({href:d.ctaLink,target:"_parent",rel:"noreferrer"},{children:e.jsx(c.default,Object.assign({variant:"primary",className:"min-h-[38px]",style:{minHeight:"38px"}},{children:d.cta}))}))]}))]}))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../../hooks/pickaxe/usePickaxe.js"),t=require("react"),a=require("../../hooks/pickaxe/usePickaxeContext.js"),l=require("../../hooks/pickaxe/useResponseContext.js"),r=require("../../common/utils.js"),i=require("./Addons/Scroll/Provider.js"),x=require("../Core/Skeleton.js"),o=require("./Chat/index.js"),c=require("./Form/index.js"),u=require("../../common/cn.js");exports.Pickaxe=({formId:n,className:d})=>{const{chatId:f,styles:p,colors:m,responsiveBy:j,deploymentType:h,isNewChat:k,setFormId:w,setChatId:g,setPickaxe:q}=a.usePickaxeContext(),{setMessages:v,setResponse:N,setError:b,setLimitData:y,setStatus:C}=l.useResponseContext(),[P,O]=t.useState(!1),I=s.usePickaxe();return t.useEffect((()=>{w(n)}),[n]),t.useEffect((()=>{if(!I.data)return;const e=I.data.chatflag;g(e?r.generateId(15):""),e?v([]):N(null),b(""),y(null),q(I.data),O(!0)}),[I.data]),t.useEffect((()=>{v([]),N(null),C("idle"),y(null),b("")}),[f]),I.data?e.jsx("div",Object.assign({className:u.default("relative @container/pickaxe-root flex flex-col flex-grow w-full",!h&&"h-full","popup"===h&&f&&"h-full","dark"===p.theme&&"dark",d),style:Object.assign({backgroundColor:"chat-input"===h&&k?"transparent":m.primary,color:m.text},p.font&&"Real Head Pro"!==p.font&&{fontFamily:p.font})},{children:I.isLoading||!P?e.jsx("div",Object.assign({className:u.default("flex items-center flex-col w-full pt-12 px-4 pb-10","viewport"===j?"min-[767px]:pb-40":"@[767px]/pickaxe-root:pb-40")},{children:e.jsxs("div",Object.assign({className:"flex w-full items-center max-w-[700px] flex-col"},{children:[e.jsx(x.default,{className:"w-[72px] h-[72px]"}),e.jsx(x.default,{className:"h-[20px] mt-6 w-full"}),e.jsx(x.default,{className:"h-[20px] mt-2 w-full"}),e.jsx(x.default,{className:"h-[20px] mt-2 w-full max-w-[400px]"}),e.jsx("div",Object.assign({className:"flex flex-col gap-y-8 w-full mt-6"},{children:e.jsx(x.default,{className:u.default("w-full min-h-[48px]","viewport"===j?"min-[767px]:max-w-[176px]":"@[767px]/pickaxe-root:max-w-[176px]")})}))]}))})):e.jsx(e.Fragment,{children:f?e.jsx(i.default,{children:e.jsx(o.default,{})}):e.jsx(i.default,{children:e.jsx(c.default,{})})})})):null};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../components/EmbedPreview/Inline.js"),t=require("../components/EmbedPreview/FAB.js"),p=require("../components/EmbedPreview/Popup.js"),r=require("../components/EmbedPreview/ChatInput.js");exports.Inline=e.Inline,exports.FAB=t.FAB,exports.FABButton=t.FABButton,exports.Popup=p.Popup,exports.PopupCTAButton=p.PopupCTAButton,exports.ChatInput=r.ChatInput,exports.ChatInputWrapper=r.ChatInputWrapper;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),r=require("@tanstack/react-query"),t=require("./usePickaxeContext.js");
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),r=require("@tanstack/react-query"),t=require("./usePickaxeContext.js");const i=r=>e.__awaiter(void 0,void 0,void 0,(function*(){if(!r)return null;const e=yield fetch(`${process.env.NEXT_PUBLIC_API_URL}/pickaxe?formid=${r}`,{method:"GET",headers:{"Content-Type":"application/json"}}),{success:t,data:i,error:o}=yield e.json();if(!t)throw new Error(o||"Failed to fetch pickaxe");return i}));exports.useInstantPickaxe=t=>r.useQuery({queryKey:["form",t],queryFn:()=>e.__awaiter(void 0,void 0,void 0,(function*(){return i(t)})),enabled:!!t,staleTime:18e4}),exports.usePickaxe=()=>{const{formId:o}=t.usePickaxeContext();return r.useQuery({queryKey:["form",o],queryFn:()=>e.__awaiter(void 0,void 0,void 0,(function*(){return i(o)})),enabled:!!o,staleTime:18e4})};
|
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./components/Pickaxe/index.js"),o=require("./components/Pickaxe/Provider.js"),s=require("./components/Pickaxe/ResponseProvider.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./components/Pickaxe/index.js"),o=require("./components/Pickaxe/Provider.js"),s=require("./components/Pickaxe/ResponseProvider.js"),t=require("./components/Pickaxe/common/PickaxeMarkdown/index.js"),r=require("./components/Pickaxe/common/PickaxeMarkdown/Renderer.js"),n=require("./components/EmbedPreview/Inline.js"),i=require("./components/EmbedPreview/FAB.js"),x=require("./components/EmbedPreview/Popup.js"),u=require("./components/EmbedPreview/ChatInput.js"),p=require("./hooks/pickaxe/useConversation.js"),a=require("./hooks/pickaxe/useHistory.js"),c=require("./hooks/pickaxe/usePickaxe.js"),k=require("./hooks/pickaxe/usePickaxeContext.js"),P=require("./hooks/pickaxe/useResponseContext.js"),m=require("./hooks/pickaxe/useDimensionContext.js"),C=require("./hooks/pickaxe/useSubmit.js"),d=require("./hooks/pickaxe/useSubmitDocument.js");exports.Pickaxe=e.Pickaxe,exports.PickaxeContext=o.PickaxeContext,exports.PickaxeProvider=o.PickaxeProvider,exports.ResponseContext=s.ResponseContext,exports.PickaxeMarkdown=t.PickaxeMarkdown,exports.PickaxeMarkdownContext=t.PickaxeMarkdownContext,exports.PickaxeMarkdownRenderer=r.PickaxeMarkdownRenderer,exports.Inline=n.Inline,exports.FAB=i.FAB,exports.FABButton=i.FABButton,exports.Popup=x.Popup,exports.PopupCTAButton=x.PopupCTAButton,exports.ChatInput=u.ChatInput,exports.ChatInputWrapper=u.ChatInputWrapper,exports.useConversation=p.useConversation,exports.useHistory=a.useHistory,exports.useInstantPickaxe=c.useInstantPickaxe,exports.usePickaxe=c.usePickaxe,exports.usePickaxeContext=k.usePickaxeContext,exports.useResponseContext=P.useResponseContext,exports.useDimensionContext=m.useDimensionContext,exports.useSubmit=C.useSubmit,exports.useSubmitDocument=d.useSubmitDocument;
|
package/dist/cjs/prose.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.pxe-prose p{font-weight:350}.pxe-prose p:not(:only-child){margin-bottom:.75rem}.pxe-prose a{font-weight:600;text-decoration:underline;text-underline-offset:.2rem}.pxe-prose iframe{margin-bottom:1.5rem}.pxe-prose blockquote{margin-bottom:2.5rem;padding-bottom:.25rem;padding-left:1rem;padding-top:.25rem}.pxe-prose hr{margin-bottom:1.5rem}.pxe-prose .pxe-markdown-image,.pxe-prose .pxe-markdown-
|
|
1
|
+
.pxe-prose p{font-weight:350}.pxe-prose p:not(:only-child){margin-bottom:.75rem}.pxe-prose a{font-weight:600;text-decoration:underline;text-underline-offset:.2rem}.pxe-prose iframe{margin-bottom:1.5rem}.pxe-prose blockquote{margin-bottom:2.5rem;padding-bottom:.25rem;padding-left:1rem;padding-top:.25rem}.pxe-prose hr{margin-bottom:1.5rem}.pxe-prose .pxe-markdown-image,.pxe-prose .pxe-markdown-video{margin-bottom:1.5rem;margin-top:1.5rem}.pxe-prose .pxe-markdown-video{display:flex;justify-content:center;width:100%}.pxe-prose .pxe-markdown-code{margin-bottom:1.5rem}.pxe-prose ol{list-style-type:decimal}.pxe-prose ol,.pxe-prose ul{list-style-position:inside;margin-bottom:1.5rem;padding-left:1rem}.pxe-prose ul{list-style-type:disc}.pxe-prose li{margin:10px 10px 14px}.pxe-prose li>p{display:inline}.pxe-prose .pxe-markdown-table{margin-bottom:2.5rem;overflow:auto;position:relative}.pxe-prose table{font-size:.875rem;line-height:1.24rem;table-layout:fixed}.pxe-prose th{font-weight:600;text-align:left}.pxe-prose td,.pxe-prose th{padding:.75em 1em}.pxe-prose h1{font-size:2.25rem;line-height:2.5rem;margin-bottom:1.5rem}.pxe-prose h2{font-size:1.875rem;line-height:2.25rem;margin-bottom:1.5rem}.pxe-prose h3{font-size:1.5rem;line-height:2rem;margin-bottom:1.5rem}.pxe-prose h4{font-size:1.25rem}.pxe-prose h4,.pxe-prose h5{line-height:1.75rem;margin-bottom:1rem}.pxe-prose h5{font-size:1.125rem}.pxe-prose h2:not(:first-child){margin-top:2.5rem}.pxe-prose h3:not(:first-child),.pxe-prose h4:not(:first-child),.pxe-prose>pre:not(:first-child){margin-top:1rem}.pxe-prose .pxe-markdown-code{display:flex;flex-direction:column}.pxe-prose .pxe-markdown-code>div:first-child{background-color:#1d1f21;border-radius:.3em;display:flex;flex-direction:column;max-width:min-content;padding-top:1em;position:relative}.pxe-prose .pxe-markdown-code>div:first-child>div:first-child{display:flex;justify-content:flex-end;padding:0 1em}.pxe-prose .pxe-markdown-code>div:first-child>div:last-child{overflow:auto}.pxe-prose .pxe-action[data-action-id]:not(:nth-child(2)){margin-top:1rem}.pxe-prose .pxe-markdown-code-inline{background-color:#1d1f21;border-radius:.3em;color:#fff;font-size:10pt;padding:.15em .4em}.pxe-link-previews{display:flex;flex-direction:column;gap:2rem}.pxe-prose>p:first-child>.pxe-markdown-image,.pxe-prose>p:first-child>.pxe-markdown-video{margin-top:0}.pxe-prose .pxe-blink{animation:blink 1s ease-in-out infinite}.pxe-prose .pxe-red{color:red}.pxe-prose .pxe-action-error{display:flex;flex-direction:column}.pxe-prose .pxe-animated-token{animation:fadeIn .3s ease-out forwards;display:inline-block;opacity:0}@keyframes fadeIn{0%{opacity:0;transform:translateX(5px)}to{opacity:1;transform:translateX(0)}}@keyframes blink{0%{opacity:1}50%{opacity:.5}to{opacity:1}}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { PickaxeProps } from "../Pickaxe";
|
|
3
|
+
import { IPickaxeProviderProps } from "../Pickaxe/Provider";
|
|
4
|
+
type ChatInputProps = PickaxeProps & Omit<IPickaxeProviderProps, "children" | "deploymentType" | "isEmbed">;
|
|
5
|
+
export declare const ChatInput: ({ formId, className, ...props }: ChatInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const ChatInputWrapper: ({ children }: {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SetState } from "../../types/common";
|
|
2
|
+
import { PickaxeProps } from "../Pickaxe";
|
|
3
|
+
import { IPickaxeProviderProps } from "../Pickaxe/Provider";
|
|
4
|
+
type FABProps = PickaxeProps & Omit<IPickaxeProviderProps, "children" | "deploymentType" | "isEmbed">;
|
|
5
|
+
export declare const FAB: ({ formId, className, ...props }: FABProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const FABButton: ({ isOpen, setIsOpen, }: {
|
|
7
|
+
isOpen: boolean;
|
|
8
|
+
setIsOpen: SetState<boolean>;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PickaxeProps } from "../Pickaxe";
|
|
2
|
+
import { IPickaxeProviderProps } from "../Pickaxe/Provider";
|
|
3
|
+
type InlineProps = PickaxeProps & Omit<IPickaxeProviderProps, "children" | "deploymentType" | "isEmbed">;
|
|
4
|
+
export declare const Inline: ({ formId, className, ...props }: InlineProps) => import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { SetState } from "../../types/common";
|
|
2
|
+
import { PickaxeProps } from "../Pickaxe";
|
|
3
|
+
import { IPickaxeProviderProps } from "../Pickaxe/Provider";
|
|
4
|
+
type PopupProps = PickaxeProps & Omit<IPickaxeProviderProps, "children" | "deploymentType" | "isEmbed">;
|
|
5
|
+
export declare const Popup: ({ formId, className, ...props }: PopupProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const PopupCTAButton: ({ formId, setIsOpen, }: {
|
|
7
|
+
formId: string;
|
|
8
|
+
setIsOpen: SetState<boolean>;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
interface InputProps {
|
|
2
|
-
isFocused
|
|
3
|
-
onFocus
|
|
4
|
-
onBlur
|
|
2
|
+
isFocused?: boolean;
|
|
3
|
+
onFocus?: () => void;
|
|
4
|
+
onBlur?: () => void;
|
|
5
5
|
}
|
|
6
6
|
declare const Input: ({ isFocused, onFocus, onBlur }: InputProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export default Input;
|
|
@@ -33,13 +33,34 @@ export type PickaxeMisc = {
|
|
|
33
33
|
isDescription: boolean;
|
|
34
34
|
isHistory?: boolean;
|
|
35
35
|
};
|
|
36
|
+
export type PickaxeDeploymentEmbedType = "inline" | "fab" | "popup" | "chat-input";
|
|
37
|
+
export type PickaxeDeploymentDimensions = {
|
|
38
|
+
width: {
|
|
39
|
+
value: number;
|
|
40
|
+
unit: "%" | "px";
|
|
41
|
+
};
|
|
42
|
+
maxWidth: number;
|
|
43
|
+
height: {
|
|
44
|
+
value: number;
|
|
45
|
+
unit: "px" | "auto";
|
|
46
|
+
};
|
|
47
|
+
minHeight: number;
|
|
48
|
+
maxHeight: number;
|
|
49
|
+
};
|
|
50
|
+
export type PickaxeDeploymentMisc = {
|
|
51
|
+
popupText?: string;
|
|
52
|
+
fabImage?: string;
|
|
53
|
+
};
|
|
36
54
|
type PickaxeContextType = {
|
|
37
55
|
formId: string;
|
|
38
56
|
chatId: string;
|
|
39
57
|
userId: string;
|
|
40
58
|
studioUserId: string;
|
|
41
|
-
deploymentId: string;
|
|
42
59
|
embedUserId: string;
|
|
60
|
+
deploymentId: string;
|
|
61
|
+
deploymentType?: PickaxeDeploymentEmbedType;
|
|
62
|
+
deploymentDimensions?: PickaxeDeploymentDimensions;
|
|
63
|
+
deploymentMisc?: PickaxeDeploymentMisc;
|
|
43
64
|
pickaxe: LimitedPickaxe | null;
|
|
44
65
|
styles: PickaxeProviderStyles;
|
|
45
66
|
colors: PickaxeProviderColors;
|
|
@@ -54,8 +75,9 @@ type PickaxeContextType = {
|
|
|
54
75
|
isFontLoaded: boolean;
|
|
55
76
|
isNewChat: boolean;
|
|
56
77
|
isShowIceBreaker: boolean;
|
|
57
|
-
isEmbed: boolean;
|
|
58
78
|
isRtl: boolean;
|
|
79
|
+
isEmbed: boolean;
|
|
80
|
+
isDropShadow: boolean;
|
|
59
81
|
setFormId: SetState<string>;
|
|
60
82
|
setChatId: SetState<string>;
|
|
61
83
|
setPickaxe: SetState<LimitedPickaxe | null>;
|
|
@@ -68,8 +90,11 @@ export interface IPickaxeProviderProps {
|
|
|
68
90
|
children: ReactNode;
|
|
69
91
|
userId?: string;
|
|
70
92
|
studioUserId?: string;
|
|
71
|
-
deploymentId?: string;
|
|
72
93
|
embedUserId?: string;
|
|
94
|
+
deploymentId?: string;
|
|
95
|
+
deploymentType?: PickaxeDeploymentEmbedType;
|
|
96
|
+
deploymentDimensions?: PickaxeDeploymentDimensions;
|
|
97
|
+
deploymentMisc?: PickaxeDeploymentMisc;
|
|
73
98
|
styles?: Partial<PickaxeProviderStyles>;
|
|
74
99
|
colors?: Partial<PickaxeProviderColors>;
|
|
75
100
|
limits?: Record<string, PickaxeLimitData>;
|
|
@@ -81,10 +106,11 @@ export interface IPickaxeProviderProps {
|
|
|
81
106
|
disableHtml?: boolean;
|
|
82
107
|
disableJs?: boolean;
|
|
83
108
|
disableCss?: boolean;
|
|
84
|
-
isEmbed?: boolean;
|
|
85
109
|
isRtl?: boolean;
|
|
110
|
+
isEmbed?: boolean;
|
|
111
|
+
isDropShadow?: boolean;
|
|
86
112
|
onGenerateComplete?: (responseId: string) => void;
|
|
87
113
|
}
|
|
88
114
|
export declare const PickaxeContext: import("react").Context<PickaxeContextType>;
|
|
89
|
-
export declare const PickaxeProvider: ({ children, userId, studioUserId, deploymentId, embedUserId, styles, colors, limits, misc, translations, responsiveBy, forceMobile, disableHtml, disableJs, disableCss, loadFont, isEmbed,
|
|
115
|
+
export declare const PickaxeProvider: ({ children, userId, studioUserId, deploymentId, embedUserId, deploymentType, deploymentDimensions, deploymentMisc, styles, colors, limits, misc, translations, responsiveBy, forceMobile, disableHtml, disableJs, disableCss, loadFont, isRtl, isEmbed, isDropShadow, onGenerateComplete, }: IPickaxeProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
90
116
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { ButtonProps } from "../../Core/Button";
|
|
2
|
-
declare const PickaxeButton: ({ variant, className, ...props }: Omit<ButtonProps, "ref">) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const PickaxeButton: ({ variant, className, style, ...props }: Omit<ButtonProps, "ref">) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default PickaxeButton;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
interface PickaxeHeadProps {
|
|
2
2
|
className?: string;
|
|
3
3
|
iconClassName?: string;
|
|
4
|
-
|
|
4
|
+
maxDescriptionChars?: number;
|
|
5
5
|
onIconClick?: () => void;
|
|
6
6
|
}
|
|
7
|
-
declare const PickaxeHead: ({ className, iconClassName,
|
|
7
|
+
declare const PickaxeHead: ({ className, iconClassName, maxDescriptionChars, onIconClick, }: PickaxeHeadProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
export default PickaxeHead;
|
|
@@ -5,8 +5,9 @@ export interface PickaxeMarkdownRendererProps {
|
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
value?: string | null;
|
|
7
7
|
maxLines?: number;
|
|
8
|
+
maxChars?: number;
|
|
8
9
|
multiLineBreaks?: boolean;
|
|
9
10
|
recursion?: boolean;
|
|
10
11
|
onExpandClick?: () => void;
|
|
11
12
|
}
|
|
12
|
-
export declare const PickaxeMarkdownRenderer: ({ className, style, children: _children, value, maxLines, multiLineBreaks, recursion, onExpandClick, }: PickaxeMarkdownRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const PickaxeMarkdownRenderer: ({ className, style, children: _children, value, maxLines, maxChars, multiLineBreaks, recursion, onExpandClick, }: PickaxeMarkdownRendererProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { LimitedPickaxe } from "../../types/pickaxe";
|
|
2
2
|
export declare const usePickaxe: () => import("@tanstack/react-query").UseQueryResult<LimitedPickaxe | null, Error>;
|
|
3
|
+
export declare const useInstantPickaxe: (formId: string) => import("@tanstack/react-query").UseQueryResult<LimitedPickaxe | null, Error>;
|
|
@@ -3,8 +3,11 @@ export declare const usePickaxeContext: () => {
|
|
|
3
3
|
chatId: string;
|
|
4
4
|
userId: string;
|
|
5
5
|
studioUserId: string;
|
|
6
|
-
deploymentId: string;
|
|
7
6
|
embedUserId: string;
|
|
7
|
+
deploymentId: string;
|
|
8
|
+
deploymentType?: import("../../components/Pickaxe/Provider").PickaxeDeploymentEmbedType | undefined;
|
|
9
|
+
deploymentDimensions?: import("../../components/Pickaxe/Provider").PickaxeDeploymentDimensions | undefined;
|
|
10
|
+
deploymentMisc?: import("../../components/Pickaxe/Provider").PickaxeDeploymentMisc | undefined;
|
|
8
11
|
pickaxe: import("../../types/pickaxe").LimitedPickaxe | null;
|
|
9
12
|
styles: import("../../components/Pickaxe/Provider").PickaxeProviderStyles;
|
|
10
13
|
colors: import("../../components/Pickaxe/Provider").PickaxeProviderColors;
|
|
@@ -19,8 +22,9 @@ export declare const usePickaxeContext: () => {
|
|
|
19
22
|
isFontLoaded: boolean;
|
|
20
23
|
isNewChat: boolean;
|
|
21
24
|
isShowIceBreaker: boolean;
|
|
22
|
-
isEmbed: boolean;
|
|
23
25
|
isRtl: boolean;
|
|
26
|
+
isEmbed: boolean;
|
|
27
|
+
isDropShadow: boolean;
|
|
24
28
|
setFormId: import("../../types/common").SetState<string>;
|
|
25
29
|
setChatId: import("../../types/common").SetState<string>;
|
|
26
30
|
setPickaxe: import("../../types/common").SetState<import("../../types/pickaxe").LimitedPickaxe | null>;
|
package/dist/cjs/src/index.d.ts
CHANGED
|
@@ -4,6 +4,10 @@ export * from "./components/Pickaxe/Provider";
|
|
|
4
4
|
export * from "./components/Pickaxe/ResponseProvider";
|
|
5
5
|
export * from "./components/Pickaxe/common/PickaxeMarkdown";
|
|
6
6
|
export * from "./components/Pickaxe/common/PickaxeMarkdown/Renderer";
|
|
7
|
+
export * from "./components/EmbedPreview/Inline";
|
|
8
|
+
export * from "./components/EmbedPreview/FAB";
|
|
9
|
+
export * from "./components/EmbedPreview/Popup";
|
|
10
|
+
export * from "./components/EmbedPreview/ChatInput";
|
|
7
11
|
export * from "./hooks/pickaxe/useConversation";
|
|
8
12
|
export * from "./hooks/pickaxe/useHistory";
|
|
9
13
|
export * from "./hooks/pickaxe/usePickaxe";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__rest as i}from"../../_virtual/_tslib.js";import{jsx as e}from"react/jsx-runtime";import{usePickaxeContext as t}from"../../hooks/pickaxe/usePickaxeContext.js";import{QueryClient as o,QueryClientProvider as r}from"@tanstack/react-query";import{Pickaxe as n}from"../Pickaxe/index.js";import{PickaxeProvider as s}from"../Pickaxe/Provider.js";import a from"../../common/cn.js";const l=new o({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),d=t=>{var{formId:o,className:a}=t,d=i(t,["formId","className"]);return e(r,Object.assign({client:l},{children:e(s,Object.assign({},d,{deploymentType:"chat-input",isEmbed:!0},{children:e(h,{children:e(n,Object.assign({formId:o},a&&{className:a}))})}))}))},h=({children:i})=>{var o;const{styles:r,deploymentDimensions:n,isNewChat:s,isDropShadow:l}=t();return e("div",Object.assign({className:a("relative top-0 flex w-full flex-col transition-all",l&&"shadow-embed",!s&&"overflow-y-auto overflow-x-hidden scrollbar scrollbar-thin"),style:Object.assign(Object.assign({borderRadius:null!==(o=null==r?void 0:r.cornerRadius)&&void 0!==o?o:0},"px"===(null==n?void 0:n.width.unit)?{width:n.width.value+n.width.unit}:"%"===(null==n?void 0:n.width.unit)?{width:"100%",maxWidth:n.maxWidth+"px"}:{}),s?{height:58}:"px"===(null==n?void 0:n.height.unit)?{height:n.height.value+"px"}:"auto"===(null==n?void 0:n.height.unit)?{minHeight:n.minHeight+"px",maxHeight:n.maxHeight+"px"}:{})},{children:i}))};export{d as ChatInput,h as ChatInputWrapper};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__rest as e,__awaiter as i}from"../../_virtual/_tslib.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useState as s,useEffect as o}from"react";import{usePickaxeContext as a}from"../../hooks/pickaxe/usePickaxeContext.js";import{QueryClient as r,QueryClientProvider as c}from"@tanstack/react-query";import{Pickaxe as l}from"../Pickaxe/index.js";import{PickaxeProvider as d}from"../Pickaxe/Provider.js";import{AnimatePresence as m,motion as h}from"framer-motion";import u from"../Icons/pickaxe.svg.js";import p from"../Icons/spark.svg.js";import g from"../Icons/x.svg.js";import b from"../../common/cn.js";const f=new r({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),x=i=>{var a,r,u,p,{formId:g,className:x}=i,w=e(i,["formId","className"]);const[y,j]=s(!1),[k,O]=s({}),I=()=>{const e=w.deploymentDimensions;if(!e)return;const i={value:e.width.value,unit:e.width.unit},t=e.maxWidth,n={value:e.height.value,unit:e.height.unit},s=e.minHeight,o=e.maxHeight,a=window.innerHeight-150,r=window.innerWidth-40;let c=0;c="px"===n.unit?n.value:o;let l=Math.min(c,a);l=Math.max(l,s,100),l=Math.min(l,a);let d=0;d="px"===i.unit?i.value:t;let m=Math.min(d,r,t);m=Math.max(m,150),m=Math.min(m,r);O({width:"%"===i.unit?i.value+"%":m+"px",minWidth:150,maxWidth:m,height:"auto"===n.unit?n.value:l+"px",minHeight:100,maxHeight:l})};return o((()=>(I(),window.addEventListener("resize",I),()=>window.removeEventListener("resize",I))),[w.deploymentDimensions]),t(c,Object.assign({client:f},{children:t(d,Object.assign({},w,{deploymentType:"fab",isEmbed:!0},{children:n(m,{children:[y&&t(h.div,Object.assign({initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},transition:{duration:.1},className:b("transition-h absolute z-50 flex flex-col overflow-hidden bg-transparent",w.isDropShadow&&"shadow-embed"),style:Object.assign({transformOrigin:"bottom right",borderRadius:null!==(r=null===(a=w.styles)||void 0===a?void 0:a.cornerRadius)&&void 0!==r?r:0,bottom:100,right:20},k)},{children:t("div",Object.assign({className:"flex flex-col overflow-auto h-full scrollbar scrollbar-thin dark:bg-black",style:{borderRadius:null!==(p=null===(u=w.styles)||void 0===u?void 0:u.cornerRadius)&&void 0!==p?p:0}},{children:t(l,Object.assign({formId:g},x&&{className:x}))}))}),"fab-content"),t(v,{isOpen:y,setIsOpen:j})]})}))}))},v=({isOpen:e,setIsOpen:n})=>{const{colors:r,deploymentMisc:c}=a(),[l,d]=s({src:"",isLarge:!1}),[m,h]=s(!0);return o((()=>{i(void 0,void 0,void 0,(function*(){try{if(!(null==c?void 0:c.fabImage))return;h(!0);const e=new Image;e.src=c.fabImage,yield e.decode();const i=e.width>200;d({src:c.fabImage,isLarge:i})}catch(e){console.error("[pxe] error loading FAB image:",e),d({src:"",isLarge:!1})}finally{h(!1)}}))}),[null==c?void 0:c.fabImage]),m?null:t("button",Object.assign({className:"absolute z-50 flex h-[60px] w-[60px] cursor-pointer items-center justify-center overflow-hidden rounded-full bg-white dark:bg-black",style:{boxShadow:"0px 6px 6px rgba(0, 0, 0, 0.12)",background:r.primary,color:r.text,bottom:20,right:20},onClick:()=>n(!e)},{children:t(w,e?Object.assign({id:"close-btn"},{children:t(g,{className:"shrink-0 select-none",style:{width:28,height:28}})}):Object.assign({id:"open-btn"},{children:l.src===`https://${process.env.NEXT_PUBLIC_PICKAXE_DOMAIN}/builder/assets/images/pickaxe-chaticons/chaticon2.png`?t(p,{className:"h-6 w-6 shrink-0 select-none"}):l.src?t("img",{src:l.src,alt:"FAB Icon",width:l.isLarge?60:24,height:l.isLarge?60:24,className:"select-none"}):t(u,{className:"h-6 w-6 shrink-0 select-none"})}))}))},w=({id:e,children:i})=>t(h.div,Object.assign({initial:{opacity:0,rotate:-10},animate:{opacity:1,rotate:0},exit:{opacity:0,rotate:10},transition:{duration:.3}},{children:i}),e);export{x as FAB,v as FABButton};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__rest as i}from"../../_virtual/_tslib.js";import{jsx as e}from"react/jsx-runtime";import{QueryClient as n,QueryClientProvider as o}from"@tanstack/react-query";import{Pickaxe as t}from"../Pickaxe/index.js";import{PickaxeProvider as s}from"../Pickaxe/Provider.js";import l from"../../common/cn.js";const m=new n({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),d=n=>{var d,r,a,c,h,p,{formId:u,className:v}=n,x=i(n,["formId","className"]);return e(o,Object.assign({client:m},{children:e(s,Object.assign({},x,{deploymentType:"inline",isEmbed:!0},{children:e("div",Object.assign({className:l("relative top-0 flex w-full flex-col overflow-y-auto overflow-x-hidden transition-all scrollbar scrollbar-thin",x.isDropShadow&&"shadow-embed"),style:Object.assign(Object.assign({borderRadius:null!==(r=null===(d=x.styles)||void 0===d?void 0:d.cornerRadius)&&void 0!==r?r:0},"px"===(null===(a=x.deploymentDimensions)||void 0===a?void 0:a.width.unit)?{width:x.deploymentDimensions.width.value+x.deploymentDimensions.width.unit}:"%"===(null===(c=x.deploymentDimensions)||void 0===c?void 0:c.width.unit)?{width:"100%",maxWidth:x.deploymentDimensions.maxWidth+"px"}:{}),"px"===(null===(h=x.deploymentDimensions)||void 0===h?void 0:h.height.unit)?{height:x.deploymentDimensions.height.value+"px"}:"auto"===(null===(p=x.deploymentDimensions)||void 0===p?void 0:p.height.unit)?{minHeight:x.deploymentDimensions.minHeight+"px",maxHeight:x.deploymentDimensions.maxHeight+"px"}:{})},{children:e(t,Object.assign({formId:u},v&&{className:v}))}))}))}))};export{d as Inline};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,jsxs as i}from"react/jsx-runtime";import{useState as t}from"react";import{usePickaxeContext as n}from"../../hooks/pickaxe/usePickaxeContext.js";import{useInstantPickaxe as s}from"../../hooks/pickaxe/usePickaxe.js";import{useStyleFontSize as l}from"../../hooks/studio/useStyleFontSize.js";import{QueryClient as a,QueryClientProvider as r}from"@tanstack/react-query";import{Pickaxe as d}from"../Pickaxe/index.js";import{PickaxeProvider as m}from"../Pickaxe/Provider.js";import c from"../Icons/x.svg.js";import p from"../Core/Modal/index.js";import u from"../Core/Modal/Body.js";import h from"../../common/cn.js";const f=new a({defaultOptions:{queries:{refetchOnWindowFocus:!1}}}),v=n=>{var s,l,a,v,b,y,g,j,O,{formId:w,className:k}=n,D=e(n,["formId","className"]);const[N,R]=t(!1);return o(r,Object.assign({client:f},{children:i(m,Object.assign({},D,{deploymentType:"popup",isEmbed:!0},{children:[o(x,{formId:w,setIsOpen:R}),o(p,Object.assign({isOpen:N,onChange:()=>R(!1)},{children:i(u,Object.assign({className:h("relative bg-transparent overflow-hidden",D.isDropShadow&&"shadow-embed"),style:{borderRadius:(null!==(l=null===(s=D.styles)||void 0===s?void 0:s.cornerRadius)&&void 0!==l?l:0)+"px"}},{children:[o("div",Object.assign({className:"overflow-auto scrollbar scrollbar-thin",style:Object.assign(Object.assign({borderRadius:(null!==(v=null===(a=D.styles)||void 0===a?void 0:a.cornerRadius)&&void 0!==v?v:0)+"px"},"px"===(null===(b=D.deploymentDimensions)||void 0===b?void 0:b.width.unit)?{width:D.deploymentDimensions.width.value+D.deploymentDimensions.width.unit}:"%"===(null===(y=D.deploymentDimensions)||void 0===y?void 0:y.width.unit)?{width:Math.floor(D.deploymentDimensions.maxWidth*(D.deploymentDimensions.width.value/100))}:{}),"px"===(null===(g=D.deploymentDimensions)||void 0===g?void 0:g.height.unit)?{height:D.deploymentDimensions.height.value+"px"}:"auto"===(null===(j=D.deploymentDimensions)||void 0===j?void 0:j.height.unit)?{height:D.deploymentDimensions.minHeight+"px",maxHeight:D.deploymentDimensions.maxHeight+"px"}:{})},{children:o(d,Object.assign({formId:w},k&&{className:k}))})),o("button",Object.assign({className:"absolute z-10 outline-none hover:opacity-70 hover:duration-300 active:opacity-100",onClick:()=>R(!1),style:{right:12,top:12,color:(null===(O=D.colors)||void 0===O?void 0:O.text)||"#000"}},{children:o(c,{className:"h-5 w-5 shrink-0"})}))]}))}))]}))}))},x=({formId:e,setIsOpen:i})=>{var t;const{colors:a,styles:r,deploymentDimensions:d,deploymentMisc:m}=n(),c=l(),p=s(e);return p.isLoading?null:o("button",Object.assign({style:Object.assign(Object.assign(Object.assign({},"Real Head Pro"!==r.font&&{fontFamily:r.font}),{color:a.accentText,backgroundColor:a.accent,borderRadius:r.cornerRadius+"px",borderWidth:r.outlineThickness+"px",maxWidth:"%"===(null==d?void 0:d.width.unit)?(null==d?void 0:d.maxWidth)+"px":(null==d?void 0:d.width.value)+"px",minHeight:48}),"Real Head Pro"!==r.font&&{fontFamily:r.font}),className:h(c.b2,"flex w-max min-w-[130px] select-none items-center font-semibold justify-center gap-x-3 px-4 hover:duration-300 focus:outline focus:outline-black/30 active:opacity-90 disabled:cursor-not-allowed dark:focus:outline-white/30"),onClick:()=>i(!0)},{children:o("p",Object.assign({className:h(c.b2,"font-semibold"),style:Object.assign({color:a.accentText},"Real Head Pro"!==r.font&&{fontFamily:r.font})},{children:(null==m?void 0:m.popupText)||(null===(t=p.data)||void 0===t?void 0:t.formtitle)||"Open Tool"}))}))};export{v as Popup,x as PopupCTAButton};
|