@pickaxeproject/react 5.6.1-beta.2 → 5.6.1-beta.3

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.
@@ -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"),a=require("../../Addons/Auth/hooks/useAuthContext.js"),t=require("../../Addons/Auth/hooks/useAuth.js"),l=require("../../../../hooks/pickaxe/useResponseContext.js"),n=require("../../../../hooks/pickaxe/useDimensionContext.js"),r=require("../../Addons/Scroll/hooks/useScrollContext.js"),o=require("../../../../hooks/studio/useStyleFontSize.js"),c=require("../../../../hooks/pickaxe/useConversation.js"),d=require("../../Addons/Artifact/hooks/useArtifactContext.js"),u=require("framer-motion"),x=require("../../../Icons/lock.svg.js"),m=require("../../../Core/ErrorAlert.js"),f=require("../../common/PickaxeHead.js"),j=require("../../common/PickaxeEmbedHead.js"),h=require("../../common/PickaxeUpgradeCard.js"),g=require("../../common/PickaxeSkeleton.js"),p=require("../../common/PickaxeHistoryButton.js"),b=require("../../Addons/Scroll/ScrollLockView.js"),v=require("../../Addons/Artifact/Renderer/index.js"),y=require("./Message.js"),k=require("./CustomMessage.js"),w=require("../../Addons/IceBreaker/index.js"),N=require("../../common/PickaxeBranding.js"),C=require("../../../../common/cn.js");exports.default=({additionalScrollHeight:O,smitheryAuthData:q,isForceHideInfo:S,isInputFocused:A,onSubmit:P,resubmitPrompt:I})=>{var L,H,R,M,D;const{sessionId:E,deploymentType:F,pickaxe:B,translations:T,misc:z,isNewChat:W,isRtl:_,isEmbed:$,isEmailLogin:U,isShowIceBreaker:V,setSessionId:G,setLastSessionId:J}=i.usePickaxeContext(),{emailInput:K,isLoggedOut:Q,isSending:X,isResendDisabled:Y,isSent:Z}=a.useAuthContext(),{onSend:ee}=t.useAuth(),{scrollContainerRef:se}=r.useScrollContext(),{messages:ie,limitData:ae,error:te}=l.useResponseContext(),{height:le,width:ne}=n.useDimensionContext(),{currentArtifact:re,chatPopupType:oe,currentPopupType:ce}=d.useArtifactContext(),de=c.useConversation(),ue=o.useStyleFontSize(),xe=s.useMemo((()=>(null==B?void 0:B.icebreakers)?B.icebreakers.slice(0,3):[]),[null==B?void 0:B.icebreakers]),me=s.useMemo((()=>{const e=!!de.data&&de.data.messages.length>1;return!S&&de.isSuccess&&W&&!e}),[S,de.isSuccess,W,de.data]),fe=s.useMemo((()=>!(null==B?void 0:B.chatflag)&&(null==B?void 0:B.enablechatresponses)&&ie.length>0),[B,ie]),je=s.useMemo((()=>!!de.data&&de.data.messages.some((e=>"intromessage"===e.area))),[de.data]),he="chat-input"===F&&U&&Q&&Z,ge=V&&!A&&!je&&me&&ne>767,pe=V&&!A&&(je||ne<=767),be=()=>{J(E),G("")};return s.useEffect((()=>{se.current&&requestAnimationFrame((()=>{se.current&&(se.current.scrollTop=se.current.scrollHeight)}))}),[O,se]),console.log(B,de.data,de.isLoading,de.error),e.jsxs("div",Object.assign({ref:se,className:"flex flex-1 w-full flex-col items-center overflow-y-auto pb-4 scrollbar scrollbar-thin min-h-0 mb-4"},{children:[e.jsx(u.AnimatePresence,{children:!!re&&"inline"===ce&&e.jsx(u.motion.div,Object.assign({className:C.default("absolute top-0 z-20 w-full px-4 py-2",oe),style:{height:`calc(${le-O}px - 80px)`},initial:{opacity:0,y:-20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeOut"}},{children:e.jsx(v.default,{type:"inline",className:"pxe-artifact-inline h-full shadow",artifact:{id:re.id,version:re.version}})}))}),e.jsxs("div",Object.assign({className:"relative flex flex-col items-center flex-grow w-full max-w-[800px]"},{children:[me&&$&&e.jsx("div",Object.assign({className:C.default("absolute right-4 top-3 flex items-center gap-2","popup"===F&&"right-12")},{children:e.jsx(p.default,{tip:(null==T?void 0:T["chat-history"])||"Chat History",onClick:be})})),e.jsx(f.default,Object.assign({className:C.default("opacity-0 mt-[0%] transition-all duration-500 ease-in-out max-h-0 overflow-hidden max-w-[500px]",me&&"opacity-100 mt-[10%] max-h-[100%]"),iconClassName:"duration-300 hover:opacity-90",maxDescriptionChars:500},!he&&{onIconClick:be})),$&&!de.isLoading&&e.jsx(j.default,Object.assign({className:C.default("opacity-0 transition-all duration-500 ease-in-out h-0 w-full sticky top-0 z-10",!me&&"opacity-100 h-[56px]"),iconClassName:"duration-300 hover:opacity-90",historyBtnTip:(null==T?void 0:T["chat-history"])||"Chat History"},!he&&{onIconClick:be,onHistoryClick:be})),e.jsxs("div",Object.assign({className:C.default("flex flex-col flex-grow mt-6 transition-all duration-300 ease-in-out w-full px-4",$&&!de.isLoading&&!me&&"mt-0")},{children:[ge&&e.jsx("div",Object.assign({className:C.default("grid grid-cols-3 gap-4",2===xe.length&&"grid-cols-2",1===xe.length&&"grid-cols-1")},{children:e.jsx(w.default,{type:"center",data:xe,onSend:P})})),he?e.jsx("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:[e.jsx(k.default,Object.assign({chatRole:"user"},{children:e.jsxs("div",Object.assign({className:"flex items-center gap-x-3"},{children:[e.jsx(x.default,{className:"h-6 w-6 shrink-0"}),e.jsx("p",Object.assign({className:"font-semilight"},{children:K}))]}))})),e.jsx(k.default,Object.assign({chatRole:"assistant"},{children:e.jsxs("p",Object.assign({className:"py-3 font-semilight"},{children:[`${null!==(R=null==T?void 0:T["we-sent-your-an-activation-link"])&&void 0!==R?R:"We sent you an activation link. Please be sure to check your spam folder too."} `,e.jsx("span",Object.assign({className:"underline underline-offset-2 cursor-pointer",onClick:()=>{Y||X||ee(!0)}},{children:X?null!==(M=null==T?void 0:T.resending)&&void 0!==M?M:"Resending...":null!==(D=null==T?void 0:T.resend)&&void 0!==D?D:"Resend"}))]}))}))]}))})):e.jsx(e.Fragment,{children:de.isLoading&&!(null==B?void 0:B.enablechatresponses)?e.jsxs("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[W&&e.jsxs("div",Object.assign({className:"flex flex-col items-center w-full"},{children:[e.jsx(g.default,{className:"w-[72px] h-[72px]"}),e.jsx(g.default,{className:"h-[20px] mt-6 w-full"}),e.jsx(g.default,{className:"h-[20px] mt-2 w-full"}),e.jsx(g.default,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]})),e.jsx(g.default,{className:"h-10 w-[70%] animate-pulse justify-self-end rounded"}),e.jsx(g.default,{className:"h-[150px] w-[70%] animate-pulse rounded"}),e.jsx(g.default,{className:"h-10 w-[50%] animate-pulse justify-self-end rounded"})]})):de.isError?e.jsx("div",Object.assign({className:"flex w-full justify-center"},{children:e.jsxs("p",Object.assign({className:C.default(ue.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."]}))})):de.data||fe?e.jsxs("div",Object.assign({className:"flex flex-col w-full flex-grow justify-between"},{children:[e.jsxs("div",Object.assign({className:"grid grid-cols-1 gap-y-6 w-full"},{children:[(null!==(H=null===(L=de.data)||void 0===L?void 0:L.messages)&&void 0!==H?H:[]).map(((s,i)=>e.jsx(y.default,{index:i,message:s},i))),ie.map(((s,i)=>{var a,t;return e.jsx(y.default,{smitheryData:q,resubmitPrompt:I,index:(null!==(t=null===(a=de.data)||void 0===a?void 0:a.messages.length)&&void 0!==t?t:0)+i,message:s,isLastMessage:i===ie.length-1},i)})),ae?e.jsx("div",Object.assign({className:"flex max-w-[100%] items-center gap-x-3"},{children:e.jsx(h.default,{})})):te?e.jsx("div",Object.assign({className:C.default("flex items-center gap-x-3",_?"justify-end":"justify-start")},{children:e.jsx(m.default,{error:te})})):null]})),e.jsxs("div",Object.assign({className:C.default("flex flex-col",!z.isWhiteLabel||pe&&"mt-4")},{children:[!z.isWhiteLabel&&e.jsx(N.default,{containerClassName:C.default("justify-end",pe&&"mb-2")}),pe&&e.jsx("div",Object.assign({className:"flex flex-col items-end gap-2"},{children:e.jsx(w.default,{type:"right",data:xe,onSend:P})})),e.jsx(b.default,{})]}))]})):null})]}))]}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),i=require("../../../../hooks/pickaxe/usePickaxeContext.js"),a=require("../../Addons/Auth/hooks/useAuthContext.js"),t=require("../../Addons/Auth/hooks/useAuth.js"),l=require("../../../../hooks/pickaxe/useResponseContext.js"),n=require("../../../../hooks/pickaxe/useDimensionContext.js"),r=require("../../Addons/Scroll/hooks/useScrollContext.js"),o=require("../../../../hooks/studio/useStyleFontSize.js"),c=require("../../../../hooks/pickaxe/useConversation.js"),d=require("../../Addons/Artifact/hooks/useArtifactContext.js"),u=require("framer-motion"),x=require("../../../Icons/lock.svg.js"),m=require("../../../Core/ErrorAlert.js"),f=require("../../common/PickaxeHead.js"),j=require("../../common/PickaxeEmbedHead.js"),h=require("../../common/PickaxeUpgradeCard.js"),g=require("../../common/PickaxeSkeleton.js"),p=require("../../common/PickaxeHistoryButton.js"),b=require("../../Addons/Scroll/ScrollLockView.js"),v=require("../../Addons/Artifact/Renderer/index.js"),y=require("./Message.js"),k=require("./CustomMessage.js"),w=require("../../Addons/IceBreaker/index.js"),N=require("../../common/PickaxeBranding.js"),C=require("../../../../common/cn.js");exports.default=({additionalScrollHeight:O,smitheryAuthData:q,isForceHideInfo:S,isInputFocused:A,onSubmit:P,resubmitPrompt:I})=>{var H,L,R,M,D;const{sessionId:E,deploymentType:F,pickaxe:B,translations:T,misc:z,isNewChat:W,isRtl:_,isEmbed:$,isEmailLogin:U,isShowIceBreaker:V,setSessionId:G,setLastSessionId:J}=i.usePickaxeContext(),{emailInput:K,isLoggedOut:Q,isSending:X,isResendDisabled:Y,isSent:Z}=a.useAuthContext(),{onSend:ee}=t.useAuth(),{scrollContainerRef:se}=r.useScrollContext(),{messages:ie,limitData:ae,error:te}=l.useResponseContext(),{height:le,width:ne}=n.useDimensionContext(),{currentArtifact:re,chatPopupType:oe,currentPopupType:ce}=d.useArtifactContext(),de=c.useConversation(),ue=o.useStyleFontSize(),xe=s.useMemo((()=>(null==B?void 0:B.icebreakers)?B.icebreakers.slice(0,3):[]),[null==B?void 0:B.icebreakers]),me=s.useMemo((()=>{const e=!!de.data&&de.data.messages.length>1;return!S&&de.isSuccess&&W&&!e}),[S,de.isSuccess,W,de.data]),fe=s.useMemo((()=>!(null==B?void 0:B.chatflag)&&(null==B?void 0:B.enablechatresponses)&&ie.length>0),[B,ie]),je=s.useMemo((()=>!!de.data&&de.data.messages.some((e=>"intromessage"===e.area))),[de.data]),he="chat-input"===F&&U&&Q&&Z,ge=V&&!A&&!je&&me&&ne>767,pe=V&&!A&&(je||ne<=767),be=()=>{J(E),G("")};return s.useEffect((()=>{se.current&&requestAnimationFrame((()=>{se.current&&(se.current.scrollTop=se.current.scrollHeight)}))}),[O,se]),e.jsxs("div",Object.assign({ref:se,className:"flex flex-1 w-full flex-col items-center overflow-y-auto pb-4 scrollbar scrollbar-thin min-h-0 mb-4"},{children:[e.jsx(u.AnimatePresence,{children:!!re&&"inline"===ce&&e.jsx(u.motion.div,Object.assign({className:C.default("absolute top-0 z-20 w-full px-4 py-2",oe),style:{height:`calc(${le-O}px - 80px)`},initial:{opacity:0,y:-20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeOut"}},{children:e.jsx(v.default,{type:"inline",className:"pxe-artifact-inline h-full shadow",artifact:{id:re.id,version:re.version}})}))}),e.jsxs("div",Object.assign({className:"relative flex flex-col items-center flex-grow w-full max-w-[800px]"},{children:[me&&$&&e.jsx("div",Object.assign({className:C.default("absolute right-4 top-3 flex items-center gap-2","popup"===F&&"right-12")},{children:e.jsx(p.default,{tip:(null==T?void 0:T["chat-history"])||"Chat History",onClick:be})})),e.jsx(f.default,Object.assign({className:C.default("opacity-0 mt-[0%] transition-all duration-500 ease-in-out max-h-0 overflow-hidden max-w-[500px]",me&&"opacity-100 mt-[10%] max-h-[100%]"),iconClassName:"duration-300 hover:opacity-90",maxDescriptionChars:500},!he&&{onIconClick:be})),$&&!de.isLoading&&e.jsx(j.default,Object.assign({className:C.default("opacity-0 transition-all duration-500 ease-in-out h-0 w-full sticky top-0 z-10",!me&&"opacity-100 h-[56px]"),iconClassName:"duration-300 hover:opacity-90",historyBtnTip:(null==T?void 0:T["chat-history"])||"Chat History"},!he&&{onIconClick:be,onHistoryClick:be})),e.jsxs("div",Object.assign({className:C.default("flex flex-col flex-grow mt-6 transition-all duration-300 ease-in-out w-full px-4",$&&!de.isLoading&&!me&&"mt-0")},{children:[ge&&e.jsx("div",Object.assign({className:C.default("grid grid-cols-3 gap-4",2===xe.length&&"grid-cols-2",1===xe.length&&"grid-cols-1")},{children:e.jsx(w.default,{type:"center",data:xe,onSend:P})})),he?e.jsx("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:[e.jsx(k.default,Object.assign({chatRole:"user"},{children:e.jsxs("div",Object.assign({className:"flex items-center gap-x-3"},{children:[e.jsx(x.default,{className:"h-6 w-6 shrink-0"}),e.jsx("p",Object.assign({className:"font-semilight"},{children:K}))]}))})),e.jsx(k.default,Object.assign({chatRole:"assistant"},{children:e.jsxs("p",Object.assign({className:"py-3 font-semilight"},{children:[`${null!==(R=null==T?void 0:T["we-sent-your-an-activation-link"])&&void 0!==R?R:"We sent you an activation link. Please be sure to check your spam folder too."} `,e.jsx("span",Object.assign({className:"underline underline-offset-2 cursor-pointer",onClick:()=>{Y||X||ee(!0)}},{children:X?null!==(M=null==T?void 0:T.resending)&&void 0!==M?M:"Resending...":null!==(D=null==T?void 0:T.resend)&&void 0!==D?D:"Resend"}))]}))}))]}))})):e.jsx(e.Fragment,{children:de.isLoading&&!(null==B?void 0:B.enablechatresponses)?e.jsxs("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[W&&e.jsxs("div",Object.assign({className:"flex flex-col items-center w-full"},{children:[e.jsx(g.default,{className:"w-[72px] h-[72px]"}),e.jsx(g.default,{className:"h-[20px] mt-6 w-full"}),e.jsx(g.default,{className:"h-[20px] mt-2 w-full"}),e.jsx(g.default,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]})),e.jsx(g.default,{className:"h-10 w-[70%] animate-pulse justify-self-end rounded"}),e.jsx(g.default,{className:"h-[150px] w-[70%] animate-pulse rounded"}),e.jsx(g.default,{className:"h-10 w-[50%] animate-pulse justify-self-end rounded"})]})):de.isError?e.jsx("div",Object.assign({className:"flex w-full justify-center"},{children:e.jsxs("p",Object.assign({className:C.default(ue.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."]}))})):de.data||fe?e.jsxs("div",Object.assign({className:"flex flex-col w-full flex-grow justify-between"},{children:[e.jsxs("div",Object.assign({className:"grid grid-cols-1 gap-y-6 w-full"},{children:[(null!==(L=null===(H=de.data)||void 0===H?void 0:H.messages)&&void 0!==L?L:[]).map(((s,i)=>e.jsx(y.default,{index:i,message:s},i))),ie.map(((s,i)=>{var a,t;return e.jsx(y.default,{smitheryData:q,resubmitPrompt:I,index:(null!==(t=null===(a=de.data)||void 0===a?void 0:a.messages.length)&&void 0!==t?t:0)+i,message:s,isLastMessage:i===ie.length-1},i)})),ae?e.jsx("div",Object.assign({className:"flex max-w-[100%] items-center gap-x-3"},{children:e.jsx(h.default,{})})):te?e.jsx("div",Object.assign({className:C.default("flex items-center gap-x-3",_?"justify-end":"justify-start")},{children:e.jsx(m.default,{error:te})})):null]})),e.jsxs("div",Object.assign({className:C.default("flex flex-col",!z.isWhiteLabel||pe&&"mt-4")},{children:[!z.isWhiteLabel&&e.jsx(N.default,{containerClassName:C.default("justify-end",pe&&"mb-2")}),pe&&e.jsx("div",Object.assign({className:"flex flex-col items-end gap-2"},{children:e.jsx(w.default,{type:"right",data:xe,onSend:P})})),e.jsx(b.default,{})]}))]})):null})]}))]}))]}))};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as s,Fragment as i}from"react/jsx-runtime";import{useMemo as t,useEffect as a}from"react";import{usePickaxeContext as o}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useAuthContext as n}from"../../Addons/Auth/hooks/useAuthContext.js";import{useAuth as l}from"../../Addons/Auth/hooks/useAuth.js";import{useResponseContext as r}from"../../../../hooks/pickaxe/useResponseContext.js";import{useDimensionContext as c}from"../../../../hooks/pickaxe/useDimensionContext.js";import{useScrollContext as m}from"../../Addons/Scroll/hooks/useScrollContext.js";import{useStyleFontSize as d}from"../../../../hooks/studio/useStyleFontSize.js";import{useConversation as p}from"../../../../hooks/pickaxe/useConversation.js";import{useArtifactContext as u}from"../../Addons/Artifact/hooks/useArtifactContext.js";import{AnimatePresence as h,motion as f}from"framer-motion";import g from"../../../Icons/lock.svg.js";import x from"../../../Core/ErrorAlert.js";import j from"../../common/PickaxeHead.js";import b from"../../common/PickaxeEmbedHead.js";import v from"../../common/PickaxeUpgradeCard.js";import y from"../../common/PickaxeSkeleton.js";import k from"../../common/PickaxeHistoryButton.js";import w from"../../Addons/Scroll/ScrollLockView.js";import N from"../../Addons/Artifact/Renderer/index.js";import O from"./Message.js";import C from"./CustomMessage.js";import S from"../../Addons/IceBreaker/index.js";import A from"../../common/PickaxeBranding.js";import P from"../../../../common/cn.js";const I=({additionalScrollHeight:I,smitheryAuthData:L,isForceHideInfo:H,isInputFocused:R,onSubmit:D,resubmitPrompt:B})=>{var E,T,F,z,M;const{sessionId:W,deploymentType:$,pickaxe:q,translations:U,misc:V,isNewChat:_,isRtl:G,isEmbed:J,isEmailLogin:K,isShowIceBreaker:Q,setSessionId:X,setLastSessionId:Y}=o(),{emailInput:Z,isLoggedOut:ee,isSending:se,isResendDisabled:ie,isSent:te}=n(),{onSend:ae}=l(),{scrollContainerRef:oe}=m(),{messages:ne,limitData:le,error:re}=r(),{height:ce,width:me}=c(),{currentArtifact:de,chatPopupType:pe,currentPopupType:ue}=u(),he=p(),fe=d(),ge=t((()=>(null==q?void 0:q.icebreakers)?q.icebreakers.slice(0,3):[]),[null==q?void 0:q.icebreakers]),xe=t((()=>{const e=!!he.data&&he.data.messages.length>1;return!H&&he.isSuccess&&_&&!e}),[H,he.isSuccess,_,he.data]),je=t((()=>!(null==q?void 0:q.chatflag)&&(null==q?void 0:q.enablechatresponses)&&ne.length>0),[q,ne]),be=t((()=>!!he.data&&he.data.messages.some((e=>"intromessage"===e.area))),[he.data]),ve="chat-input"===$&&K&&ee&&te,ye=Q&&!R&&!be&&xe&&me>767,ke=Q&&!R&&(be||me<=767),we=()=>{Y(W),X("")};return a((()=>{oe.current&&requestAnimationFrame((()=>{oe.current&&(oe.current.scrollTop=oe.current.scrollHeight)}))}),[I,oe]),console.log(q,he.data,he.isLoading,he.error),e("div",Object.assign({ref:oe,className:"flex flex-1 w-full flex-col items-center overflow-y-auto pb-4 scrollbar scrollbar-thin min-h-0 mb-4"},{children:[s(h,{children:!!de&&"inline"===ue&&s(f.div,Object.assign({className:P("absolute top-0 z-20 w-full px-4 py-2",pe),style:{height:`calc(${ce-I}px - 80px)`},initial:{opacity:0,y:-20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeOut"}},{children:s(N,{type:"inline",className:"pxe-artifact-inline h-full shadow",artifact:{id:de.id,version:de.version}})}))}),e("div",Object.assign({className:"relative flex flex-col items-center flex-grow w-full max-w-[800px]"},{children:[xe&&J&&s("div",Object.assign({className:P("absolute right-4 top-3 flex items-center gap-2","popup"===$&&"right-12")},{children:s(k,{tip:(null==U?void 0:U["chat-history"])||"Chat History",onClick:we})})),s(j,Object.assign({className:P("opacity-0 mt-[0%] transition-all duration-500 ease-in-out max-h-0 overflow-hidden max-w-[500px]",xe&&"opacity-100 mt-[10%] max-h-[100%]"),iconClassName:"duration-300 hover:opacity-90",maxDescriptionChars:500},!ve&&{onIconClick:we})),J&&!he.isLoading&&s(b,Object.assign({className:P("opacity-0 transition-all duration-500 ease-in-out h-0 w-full sticky top-0 z-10",!xe&&"opacity-100 h-[56px]"),iconClassName:"duration-300 hover:opacity-90",historyBtnTip:(null==U?void 0:U["chat-history"])||"Chat History"},!ve&&{onIconClick:we,onHistoryClick:we})),e("div",Object.assign({className:P("flex flex-col flex-grow mt-6 transition-all duration-300 ease-in-out w-full px-4",J&&!he.isLoading&&!xe&&"mt-0")},{children:[ye&&s("div",Object.assign({className:P("grid grid-cols-3 gap-4",2===ge.length&&"grid-cols-2",1===ge.length&&"grid-cols-1")},{children:s(S,{type:"center",data:ge,onSend:D})})),ve?s("div",Object.assign({className:"flex flex-col w-full"},{children:e("div",Object.assign({className:"grid grid-cols-1 gap-y-6 w-full"},{children:[s(C,Object.assign({chatRole:"user"},{children:e("div",Object.assign({className:"flex items-center gap-x-3"},{children:[s(g,{className:"h-6 w-6 shrink-0"}),s("p",Object.assign({className:"font-semilight"},{children:Z}))]}))})),s(C,Object.assign({chatRole:"assistant"},{children:e("p",Object.assign({className:"py-3 font-semilight"},{children:[`${null!==(F=null==U?void 0:U["we-sent-your-an-activation-link"])&&void 0!==F?F:"We sent you an activation link. Please be sure to check your spam folder too."} `,s("span",Object.assign({className:"underline underline-offset-2 cursor-pointer",onClick:()=>{ie||se||ae(!0)}},{children:se?null!==(z=null==U?void 0:U.resending)&&void 0!==z?z:"Resending...":null!==(M=null==U?void 0:U.resend)&&void 0!==M?M:"Resend"}))]}))}))]}))})):s(i,{children:he.isLoading&&!(null==q?void 0:q.enablechatresponses)?e("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[_&&e("div",Object.assign({className:"flex flex-col items-center w-full"},{children:[s(y,{className:"w-[72px] h-[72px]"}),s(y,{className:"h-[20px] mt-6 w-full"}),s(y,{className:"h-[20px] mt-2 w-full"}),s(y,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]})),s(y,{className:"h-10 w-[70%] animate-pulse justify-self-end rounded"}),s(y,{className:"h-[150px] w-[70%] animate-pulse rounded"}),s(y,{className:"h-10 w-[50%] animate-pulse justify-self-end rounded"})]})):he.isError?s("div",Object.assign({className:"flex w-full justify-center"},{children:e("p",Object.assign({className:P(fe.b2,"text-center font-semibold")},{children:["Something went wrong. Please try again, or"," ",s("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help",target:"_blank",rel:"noreferrer"},{children:"contact us"}))," ","for help."]}))})):he.data||je?e("div",Object.assign({className:"flex flex-col w-full flex-grow justify-between"},{children:[e("div",Object.assign({className:"grid grid-cols-1 gap-y-6 w-full"},{children:[(null!==(T=null===(E=he.data)||void 0===E?void 0:E.messages)&&void 0!==T?T:[]).map(((e,i)=>s(O,{index:i,message:e},i))),ne.map(((e,i)=>{var t,a;return s(O,{smitheryData:L,resubmitPrompt:B,index:(null!==(a=null===(t=he.data)||void 0===t?void 0:t.messages.length)&&void 0!==a?a:0)+i,message:e,isLastMessage:i===ne.length-1},i)})),le?s("div",Object.assign({className:"flex max-w-[100%] items-center gap-x-3"},{children:s(v,{})})):re?s("div",Object.assign({className:P("flex items-center gap-x-3",G?"justify-end":"justify-start")},{children:s(x,{error:re})})):null]})),e("div",Object.assign({className:P("flex flex-col",!V.isWhiteLabel||ke&&"mt-4")},{children:[!V.isWhiteLabel&&s(A,{containerClassName:P("justify-end",ke&&"mb-2")}),ke&&s("div",Object.assign({className:"flex flex-col items-end gap-2"},{children:s(S,{type:"right",data:ge,onSend:D})})),s(w,{})]}))]})):null})]}))]}))]}))};export{I as default};
1
+ import{jsxs as e,jsx as s,Fragment as i}from"react/jsx-runtime";import{useMemo as t,useEffect as a}from"react";import{usePickaxeContext as o}from"../../../../hooks/pickaxe/usePickaxeContext.js";import{useAuthContext as n}from"../../Addons/Auth/hooks/useAuthContext.js";import{useAuth as l}from"../../Addons/Auth/hooks/useAuth.js";import{useResponseContext as r}from"../../../../hooks/pickaxe/useResponseContext.js";import{useDimensionContext as c}from"../../../../hooks/pickaxe/useDimensionContext.js";import{useScrollContext as m}from"../../Addons/Scroll/hooks/useScrollContext.js";import{useStyleFontSize as d}from"../../../../hooks/studio/useStyleFontSize.js";import{useConversation as p}from"../../../../hooks/pickaxe/useConversation.js";import{useArtifactContext as u}from"../../Addons/Artifact/hooks/useArtifactContext.js";import{AnimatePresence as h,motion as f}from"framer-motion";import g from"../../../Icons/lock.svg.js";import x from"../../../Core/ErrorAlert.js";import j from"../../common/PickaxeHead.js";import b from"../../common/PickaxeEmbedHead.js";import v from"../../common/PickaxeUpgradeCard.js";import y from"../../common/PickaxeSkeleton.js";import k from"../../common/PickaxeHistoryButton.js";import w from"../../Addons/Scroll/ScrollLockView.js";import N from"../../Addons/Artifact/Renderer/index.js";import O from"./Message.js";import C from"./CustomMessage.js";import S from"../../Addons/IceBreaker/index.js";import A from"../../common/PickaxeBranding.js";import P from"../../../../common/cn.js";const I=({additionalScrollHeight:I,smitheryAuthData:H,isForceHideInfo:L,isInputFocused:R,onSubmit:D,resubmitPrompt:B})=>{var E,T,F,z,M;const{sessionId:W,deploymentType:$,pickaxe:q,translations:U,misc:V,isNewChat:_,isRtl:G,isEmbed:J,isEmailLogin:K,isShowIceBreaker:Q,setSessionId:X,setLastSessionId:Y}=o(),{emailInput:Z,isLoggedOut:ee,isSending:se,isResendDisabled:ie,isSent:te}=n(),{onSend:ae}=l(),{scrollContainerRef:oe}=m(),{messages:ne,limitData:le,error:re}=r(),{height:ce,width:me}=c(),{currentArtifact:de,chatPopupType:pe,currentPopupType:ue}=u(),he=p(),fe=d(),ge=t((()=>(null==q?void 0:q.icebreakers)?q.icebreakers.slice(0,3):[]),[null==q?void 0:q.icebreakers]),xe=t((()=>{const e=!!he.data&&he.data.messages.length>1;return!L&&he.isSuccess&&_&&!e}),[L,he.isSuccess,_,he.data]),je=t((()=>!(null==q?void 0:q.chatflag)&&(null==q?void 0:q.enablechatresponses)&&ne.length>0),[q,ne]),be=t((()=>!!he.data&&he.data.messages.some((e=>"intromessage"===e.area))),[he.data]),ve="chat-input"===$&&K&&ee&&te,ye=Q&&!R&&!be&&xe&&me>767,ke=Q&&!R&&(be||me<=767),we=()=>{Y(W),X("")};return a((()=>{oe.current&&requestAnimationFrame((()=>{oe.current&&(oe.current.scrollTop=oe.current.scrollHeight)}))}),[I,oe]),e("div",Object.assign({ref:oe,className:"flex flex-1 w-full flex-col items-center overflow-y-auto pb-4 scrollbar scrollbar-thin min-h-0 mb-4"},{children:[s(h,{children:!!de&&"inline"===ue&&s(f.div,Object.assign({className:P("absolute top-0 z-20 w-full px-4 py-2",pe),style:{height:`calc(${ce-I}px - 80px)`},initial:{opacity:0,y:-20},animate:{opacity:1,y:0},exit:{opacity:0,y:-20},transition:{duration:.2,ease:"easeOut"}},{children:s(N,{type:"inline",className:"pxe-artifact-inline h-full shadow",artifact:{id:de.id,version:de.version}})}))}),e("div",Object.assign({className:"relative flex flex-col items-center flex-grow w-full max-w-[800px]"},{children:[xe&&J&&s("div",Object.assign({className:P("absolute right-4 top-3 flex items-center gap-2","popup"===$&&"right-12")},{children:s(k,{tip:(null==U?void 0:U["chat-history"])||"Chat History",onClick:we})})),s(j,Object.assign({className:P("opacity-0 mt-[0%] transition-all duration-500 ease-in-out max-h-0 overflow-hidden max-w-[500px]",xe&&"opacity-100 mt-[10%] max-h-[100%]"),iconClassName:"duration-300 hover:opacity-90",maxDescriptionChars:500},!ve&&{onIconClick:we})),J&&!he.isLoading&&s(b,Object.assign({className:P("opacity-0 transition-all duration-500 ease-in-out h-0 w-full sticky top-0 z-10",!xe&&"opacity-100 h-[56px]"),iconClassName:"duration-300 hover:opacity-90",historyBtnTip:(null==U?void 0:U["chat-history"])||"Chat History"},!ve&&{onIconClick:we,onHistoryClick:we})),e("div",Object.assign({className:P("flex flex-col flex-grow mt-6 transition-all duration-300 ease-in-out w-full px-4",J&&!he.isLoading&&!xe&&"mt-0")},{children:[ye&&s("div",Object.assign({className:P("grid grid-cols-3 gap-4",2===ge.length&&"grid-cols-2",1===ge.length&&"grid-cols-1")},{children:s(S,{type:"center",data:ge,onSend:D})})),ve?s("div",Object.assign({className:"flex flex-col w-full"},{children:e("div",Object.assign({className:"grid grid-cols-1 gap-y-6 w-full"},{children:[s(C,Object.assign({chatRole:"user"},{children:e("div",Object.assign({className:"flex items-center gap-x-3"},{children:[s(g,{className:"h-6 w-6 shrink-0"}),s("p",Object.assign({className:"font-semilight"},{children:Z}))]}))})),s(C,Object.assign({chatRole:"assistant"},{children:e("p",Object.assign({className:"py-3 font-semilight"},{children:[`${null!==(F=null==U?void 0:U["we-sent-your-an-activation-link"])&&void 0!==F?F:"We sent you an activation link. Please be sure to check your spam folder too."} `,s("span",Object.assign({className:"underline underline-offset-2 cursor-pointer",onClick:()=>{ie||se||ae(!0)}},{children:se?null!==(z=null==U?void 0:U.resending)&&void 0!==z?z:"Resending...":null!==(M=null==U?void 0:U.resend)&&void 0!==M?M:"Resend"}))]}))}))]}))})):s(i,{children:he.isLoading&&!(null==q?void 0:q.enablechatresponses)?e("div",Object.assign({className:"grid w-full max-w-[800px] grid-cols-1 gap-y-6 px-6 pt-10"},{children:[_&&e("div",Object.assign({className:"flex flex-col items-center w-full"},{children:[s(y,{className:"w-[72px] h-[72px]"}),s(y,{className:"h-[20px] mt-6 w-full"}),s(y,{className:"h-[20px] mt-2 w-full"}),s(y,{className:"h-[20px] mt-2 w-full max-w-[400px]"})]})),s(y,{className:"h-10 w-[70%] animate-pulse justify-self-end rounded"}),s(y,{className:"h-[150px] w-[70%] animate-pulse rounded"}),s(y,{className:"h-10 w-[50%] animate-pulse justify-self-end rounded"})]})):he.isError?s("div",Object.assign({className:"flex w-full justify-center"},{children:e("p",Object.assign({className:P(fe.b2,"text-center font-semibold")},{children:["Something went wrong. Please try again, or"," ",s("a",Object.assign({href:"mailto:info@pickaxeproject.com?subject=Help",target:"_blank",rel:"noreferrer"},{children:"contact us"}))," ","for help."]}))})):he.data||je?e("div",Object.assign({className:"flex flex-col w-full flex-grow justify-between"},{children:[e("div",Object.assign({className:"grid grid-cols-1 gap-y-6 w-full"},{children:[(null!==(T=null===(E=he.data)||void 0===E?void 0:E.messages)&&void 0!==T?T:[]).map(((e,i)=>s(O,{index:i,message:e},i))),ne.map(((e,i)=>{var t,a;return s(O,{smitheryData:H,resubmitPrompt:B,index:(null!==(a=null===(t=he.data)||void 0===t?void 0:t.messages.length)&&void 0!==a?a:0)+i,message:e,isLastMessage:i===ne.length-1},i)})),le?s("div",Object.assign({className:"flex max-w-[100%] items-center gap-x-3"},{children:s(v,{})})):re?s("div",Object.assign({className:P("flex items-center gap-x-3",G?"justify-end":"justify-start")},{children:s(x,{error:re})})):null]})),e("div",Object.assign({className:P("flex flex-col",!V.isWhiteLabel||ke&&"mt-4")},{children:[!V.isWhiteLabel&&s(A,{containerClassName:P("justify-end",ke&&"mb-2")}),ke&&s("div",Object.assign({className:"flex flex-col items-end gap-2"},{children:s(S,{type:"right",data:ge,onSend:D})})),s(w,{})]}))]})):null})]}))]}))]}))};export{I as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pickaxeproject/react",
3
- "version": "5.6.1-beta.2",
3
+ "version": "5.6.1-beta.3",
4
4
  "description": "Client utility library for Pickaxe",
5
5
  "repository": {
6
6
  "type": "git",