PageSourceSearch

https://app.wonderchat.io/_next/static/chunks/9157-d3401a2a6a284474.js

js wonderchat.io collected 2026-09-24 17:17:07 UTC 134,243 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9157,4127],{64141:function(e,n,i){i.d(n,{MQ:function(){return r},OA:function(){return l},R7:function(){return a},hs:function(){return s}});var t=i(15103),o=i(95495);let r=(0,t.cn)(null),a=(0,t.cn)(!1),s=(0,o.O4)("sidebar-tab","agents"),l=(0,o.O4)("wc_last_product",null)},22275:function(e,n,i){i.d(n,{b:function(){return D}});var t=i(85893),o=i(95925),r=i(22697),a=i(59007),s=i(7963),l=i(35541),c=i(83589),d=i(14581),u=i(64859),h=i(54346),p=i(71293),g=i(57747),m=i(55281),x=i(96854),b=i(48783),f=i(34292),v=i(75141),j=i(36948),w=i(93717),y=i(85970),S=i(33090),_=i(26105),C=i(41731),k=i(73804),T=i(93108),O=i(70385),E=i(20512),I=i(67294),R=i(34052),A=i(16310);let D=e=>{var n,i;let{chatbotMode:D,fixedChatbot:z,isOpen:W,onClose:N,onSuccess:L}=e,P=A.Ry().shape({email:A.Z_().email().required("Email is required"),role:A.Z_().required("Role is required")}),[U,F]=(0,I.useState)(null),{data:M,isLoading:B}=a.S.chatbot.getChatbots.useQuery(void 0,{enabled:W&&"variable"===D,refetchOnWindowFocus:!1}),q=(0,s.p)(),H=a.S.teams.inviteTeamMember.useMutation({onError:e=>{console.log(e),q({title:"Failed to invite",description:e.message,status:"error",duration:5e3,isClosable:!0})},onSuccess:()=>{"variable"===D&&F(null),L()}}),Y=()=>{"variable"===D&&F(null),N()};return(0,t.jsxs)(l.u_,{isOpen:W,onClose:Y,size:"lg",autoFocus:"fixed"===D,children:[(0,t.jsx)(c.Z,{}),(0,t.jsxs)(d.h,{children:[(0,t.jsx)(u.x,{children:"Invite Member to Chatbot"}),(0,t.jsxs)(h.f,{pb:6,children:[(0,t.jsxs)(p.x,{fontSize:"sm",color:"gray.600",mb:3,children:["Give someone access to"," ",(0,t.jsx)(p.x,{as:"span",fontWeight:"semibold",color:"gray.800",children:null!==(i=null===(n="fixed"===D?z:U)||void 0===n?void 0:n.name)&&void 0!==i?i:"a chatbot"})," ","so that they can manage the chatbot with you."]}),"variable"===D&&(0,t.jsx)(g.xu,{mb:4,children:B?(0,t.jsx)(m.K,{spacing:2,children:[0,1,2].map(e=>(0,t.jsx)(x.O,{height:"56px",borderRadius:"md"},e))}):M&&0!==M.length?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.x,{fontSize:"xs",fontWeight:"medium",color:"gray.500",mb:2,children:"Select a chatbot"}),(0,t.jsx)(b.g,{spacing:1,align:"stretch",maxH:"200px",overflowY:"auto",children:M.map(e=>{var n,i;let o=(null==U?void 0:U.id)===e.id;return(0,t.jsxs)(f.U,{spacing:3,py:2,px:3,borderWidth:"1px",borderColor:o?"blue.400":"gray.200",borderRadius:"md",bg:o?"blue.50":"white",cursor:"pointer",_hover:{borderColor:o?"blue.400":"blue.200",bg:o?"blue.50":"gray.50"},onClick:()=>F(e),children:[(0,t.jsx)(v.q,{size:"xs",name:null!==(n=e.name)&&void 0!==n?n:void 0,src:null!==(i=e.pictureUrl)&&void 0!==i?i:void 0}),(0,t.jsx)(p.x,{flex:1,fontSize:"sm",fontWeight:"medium",noOfLines:1,children:e.name}),o&&(0,t.jsx)(j.J,{as:R.UgA,color:"blue.500",boxSize:4})]},e.id)})})]}):(0,t.jsx)(g.xu,{textAlign:"center",py:10,px:4,bg:"gray.50",borderRadius:"md",children:(0,t.jsx)(p.x,{fontSize:"sm",color:"gray.600",children:"You don't have any chatbots yet. Create one first."})})}),(0,t.jsx)(E.J9,{initialValues:{email:"",role:O.TeamMemberRole.ADMIN},validateOnChange:!1,validateOnBlur:!1,onSubmit:e=>{"fixed"===D?H.mutate({chatbotId:z.id,teamMemberEmail:e.email,role:e.role}):U&&H.mutate({chatbotId:U.id,teamMemberEmail:e.email,role:e.role})},validationSchema:P,children:e=>{let{errors:n,handleSubmit:i,values:a}=e;return(0,t.jsxs)(E.l0,{onSubmit:i,children:[(0,t.jsxs)(w.k,{direction:"column",fontSize:"14px",children:[(0,t.jsxs)(w.k,{gap:4,children:[(0,t.jsxs)(y.NI,{isRequired:!0,isInvalid:!!n.email,children:[(0,t.jsx)(E.gN,{flex:1,name:"email",as:S.I,size:"sm",placeholder:"[email protected]"}),(0,t.jsx)(_.J1,{children:n.email})]}),(0,t.jsx)(E.gN,{name:"role",children:e=>{let{field:n}=e;return(0,t.jsx)(C.P,{...n,size:"sm",defaultValue:O.TeamMemberRole.ADMIN,w:"200px",children:Object.keys(O.TeamMemberRole).map(e=>(0,t.jsx)("option",{value:e,children:(0,r.Mp)(e)},e))})}})]}),(0,t.jsx)(o.T,{mt:3,color:"warning",title:"ADMIN"===a.role?"Invited admins will be able to:":"Invited members will be able to:",description:"ADMIN"===a.role?(0,t.jsxs)(k.QI,{children:[(0,t.jsx)(k.HC,{children:"View and edit this chatbot"}),(0,t.jsx)(k.HC,{children:"View and download chatlogs of this chatbot"}),(0,t.jsx)(k.HC,{children:"View analytics of this chatbot"}),(0,t.jsx)(k.HC,{children:"Create corrections for this chatbot"}),(0,t.jsx)(k.HC,{children:"Respond to live chat queries"}),(0,t.jsx)(k.HC,{children:"Add/delete pages from this chatbot"})]}):(0,t.jsxs)(k.QI,{children:[(0,t.jsx)(k.HC,{children:"View this chatbot"}),(0,t.jsx)(k.HC,{children:"View and download chatlogs of this chatbot"}),(0,t.jsx)(k.HC,{children:"View analytics of this chatbot"}),(0,t.jsx)(k.HC,{children:"Create corrections for this chatbot"}),(0,t.jsx)(k.HC,{children:"Respond to live chat queries"})]})})]}),(0,t.jsxs)(f.U,{justifyContent:"flex-end",mt:4,children:[(0,t.jsx)(T.z,{onClick:Y,isLoading:H.isLoading,children:"Close"}),(0,t.jsx)(T.z,{colorScheme:"brand",type:"submit",isLoading:H.isLoading,isDisabled:!a.email||!a.role||"variable"===D&&!U,children:"Invite"})]})]})}})]})]})]})}},39157:function(e,n,i){i.d(n,{Z:function(){return ea}});var t=i(85893),o=i(33299),r=i(4298),a=i.n(r),s=i(67294),l=()=>{let e=(0,o.useSession)();return(0,s.useEffect)(()=>{var n,i;let t=window;"function"!=typeof t.Featurebase&&(t.Featurebase=function(){(t.Featurebase.q=t.Featurebase.q||[]).push(arguments)}),t.Featurebase("initialize_feedback_widget",{organization:"wonderchat",theme:"light",email:null===(i=e.data)||void 0===i?void 0:null===(n=i.user)||void 0===n?void 0:n.email}),t.Featurebase("init_changelog_widget",{organization:"wonderchat",changelogCard:{enabled:!0},theme:"light",locale:"en"})},[]),(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(a(),{src:"https://do.featurebase.app/js/sdk.js",i
1d:"featurebase-sdk"})})},c=()=>{let e=(0,o.useSession)(),[n,i]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{var t,o,r,a,s,l,c;if(!(null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.user)||n)return;let d=window;"function"!=typeof d.Featurebase&&(d.Featurebase=function(){(d.Featurebase.q=d.Featurebase.q||[]).push(arguments)}),e.data.user.email&&e.data.user.id&&d.Featurebase("identify",{organization:"wonderchat",email:null===(r=e.data)||void 0===r?void 0:null===(o=r.user)||void 0===o?void 0:o.email,name:(null===(s=e.data)||void 0===s?void 0:null===(a=s.user)||void 0===a?void 0:a.name)||e.data.user.email,id:null===(c=e.data)||void 0===c?void 0:null===(l=c.user)||void 0===l?void 0:l.id},e=>{e||i(!0)})},[e]),(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(a(),{src:"https://do.featurebase.app/js/sdk.js",id:"featurebase-sdk"})})},d=i(10679),u=i(84790),h=i(81399);function p(){return(0,t.jsx)(a(),{src:"https://cdn.paddle.com/paddle/paddle.js",onLoad:()=>{d.O.NEXT_PUBLIC_PADDLE_SANDBOX&&Paddle.Environment.set("sandbox"),Paddle.Setup({vendor:Number(d.O.NEXT_PUBLIC_PADDLE_VENDOR_ID),eventCallback:e=>{if("Checkout.Complete"===e.event){var n,i,t;let r=e.checkoutData.product,a=u.GV[r],s=u.kT[null!=a?a:"LITE"];function o(e){let n="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=i.length,o=0;for(;o<e;)n+=i.charAt(Math.floor(Math.random()*t)),o+=1;return n}gtag("event","conversion",{send_to:"AW-11319943579/vsRbCODm6JkZEJvD4pUq",value:null!=s?s:50,currency:"USD"}),(0,h.FZ)(h.KW.purchase,{email:null==e?void 0:null===(n=e.eventData)||void 0===n?void 0:n.email,value:s,currency:"USD",transaction_id:null!==(t=null==e?void 0:null===(i=e.checkout)||void 0===i?void 0:i.id)&&void 0!==t?t:o(20),plan:a?String(a).toLowerCase():void 0}),dataLayer.push({ecommerce:null}),dataLayer.push({event:"purchase",ecommerce:{transaction_id:o(20),value:s,currency:"USD",items:[{item_id:r,item_name:a,currency:"USD",google_business_vertical:"retail",price:s,quantity:1}]}})}}})}})}function g(){var e,n,i,r;let s=(0,o.useSession)();return(null==s?void 0:null===(n=s.data)||void 0===n?void 0:null===(e=n.user)||void 0===e?void 0:e.email)?(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(a(),{id:"profitwell-js","data-pw-auth":"46782cfdf6bf85514915d0cdd2c7cbae",dangerouslySetInnerHTML:{__html:"(function(i,s,o,g,r,a,m){i[o]=i[o]||function(){(i[o].q=i[o].q||[]).push(arguments)};a=s.createElement(g);m=s.getElementsByTagName(g)[0];a.async=1;a.src=r+'?auth='+s.getElementById(o+'-js').getAttribute('data-pw-auth');m.parentNode.insertBefore(a,m);})(window,document,'profitwell','script','https://public.profitwell.com/js/profitwell.js');profitwell('start', { 'user_email': \"".concat(s.data.user.email,'" })')}})}):(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(a(),{id:"profitwell-js","data-pw-auth":"46782cfdf6bf85514915d0cdd2c7cbae",dangerouslySetInnerHTML:{__html:"(function(i,s,o,g,r,a,m){i[o]=i[o]||function(){(i[o].q=i[o].q||[]).push(arguments)};a=s.createElement(g);m=s.getElementsByTagName(g)[0];a.async=1;a.src=r+'?auth='+s.getElementById(o+'-js').getAttribute('data-pw-auth');m.parentNode.insertBefore(a,m);})(window,document,'profitwell','script','https://public.profitwell.com/js/profitwell.js');profitwell('start', { 'user_email': \"".concat(null==s?void 0:null===(r=s.data)||void 0===r?void 0:null===(i=r.user)||void 0===i?void 0:i.email,'" })')}})})}var m=i(48100),x=i(59007),b=i(93717),f=i(81136),v=i(57747),j=i(85945),w=i(99893),y=i(58192),S=i(86606),_=i.n(S),C=i(1679),k=i(34292),T=i(36948),O=i(71293),E=i(93108),I=i(89993),R=i(11163),A=i(94050);let D="wc:deploy_trial_banner_dismissed",z=()=>{var e,n,i;let r=(0,R.useRouter)(),a=(0,o.useSession)(),l=(0,y.U0)(),[c,d]=(0,s.useState)(!1);(0,s.useEffect)(()=>{try{"1"===window.localStorage.getItem(D)&&d(!0)}catch(e){}},[]);let{data:u}=x.S.user.getTrialOptInState.useQuery(void 0,{enabled:!!(null===(n=a.data)||void 0===n?void 0:null===(e=n.user)||void 0===e?void 0:e.id)}),h=!!(u&&!u.isExcludedFromTrialUpsell&&!(i={subscriptionType:u.subscriptionType,subscriptionId:u.subscriptionId,hasUsedFreeTrial:u.hasUsedFreeTrial}).hasUsedFreeTrial&&"NONE"===i.subscriptionType&&null==i.subscriptionId),{data:p}=x.S.chatbot.getChatbots.useQuery(void 0,{enabled:h&&!c}),g=(0,s.useMemo)(()=>{var e,n;return null!==(n=null==p?void 0:null===(e=p[0])||void 0===e?void 0:e.id)&&void 0!==n?n:null},[p]);return!c&&h&&g?(0,t.jsxs)(b.k,{bg:"brand.25",align:"center",justify:"space-between",gap:4,px:{base:4,md:6},py:2.5,position:"sticky",top:0,zIndex:1,children:[(0,t.jsxs)(k.U,{spacing:3,align:"center",minW:0,children:[(0,t.jsx)(b.k,{align:"center",justify:"center",bg:"brand.500",color:"white",borderRadius:"full",boxSize:"28px",flexShrink:0,children:(0,t.jsx)(T.J,{as:A.Ose,boxSize:"16px"})}),(0,t.jsxs)(O.x,{fontSize:"sm",color:"#4a5578",noOfLines:{base:3,md:2},children:[(0,t.jsx)(O.x,{as:"span",fontWeight:"bold",children:"Your agent is ready. Ship it."})," ",(0,t.jsx)(O.x,{as:"span",color:"#7d89b0",children:"Deploy now and get ".concat(7," days of Scale free. No card, nothing to cancel.")})]})]}),(0,t.jsxs)(k.U,{spacing:2,flexShrink:0,children:[(0,t.jsx)(E.z,{size:"sm",colorScheme:"brand",fontWeight:"semibold",rightIcon:(0,t.jsx)(T.J,{as:A.Ose,boxSize:"14px"}),onClick:()=>{null==l||l.capture("deploy_trial_banner_clicked",{chatbot_id:g}),r.push("/agents/settings/".concat(g,"?tab=installation"))},children:"Deploy my agent"}),(0,t.jsx)(I.h,{"aria-label":"Dismiss",icon:(0,t.jsx)(C.T,{boxSize:"10px"}),size:"sm",variant:"ghost",color:"#7d89b0",_hover:{bg:"blackAlpha.50",color:"#4a5578"},onClick:()=>{d(!0),null==l||l.capture("deploy_trial_banner_dismissed");try{window.localStorage.setItem(D,"1")}catch(e){}},flexShrink:0})]})]}):null};var W=i(7963),N=i(5460);let L=()=>{var e,n;let i=(0,o.useSession)(),r=(0,W.p)(),a=(0,y.U0)(),[l,c]=(0,s.use
1State)(!1),[d,u]=(0,s.useState)("initial"),{data:h}=x.S.g2Review.getBannerState.useQuery(void 0,{enabled:!!(null===(n=i.data)||void 0===n?void 0:null===(e=n.user)||void 0===e?void 0:e.id)}),p=x.S.g2Review.dismiss.useMutation(),g=x.S.g2Review.claimCredits.useMutation();if(l||!(null==h?void 0:h.shouldShow))return null;let m=h.creditReward.toLocaleString(),f=e=>{g.isLoading||(null==a||a.capture(e?"g2_review_banner_already_left":"g2_review_banner_confirmed"),g.mutate({alreadyLeft:e},{onSuccess:e=>{c(!0),e.granted&&r({title:"".concat(m," credits added"),description:"Thanks for taking the time to review us.",status:"success",duration:6e3,isClosable:!0})}}))};return(0,t.jsxs)(b.k,{bg:"brand.25",align:"center",justify:"space-between",gap:4,px:{base:4,md:6},py:2.5,position:"sticky",top:0,zIndex:1,children:[(0,t.jsxs)(k.U,{spacing:3,align:"center",minW:0,children:[(0,t.jsx)(N.E,{src:"/g2.svg",alt:"G2",boxSize:"26px",flexShrink:0}),"initial"===d?(0,t.jsxs)(O.x,{fontSize:"sm",color:"#4a5578",noOfLines:{base:3,md:2},children:[(0,t.jsx)(O.x,{as:"span",fontWeight:"bold",children:"Mind leaving us a review on G2?"})," ",(0,t.jsx)(O.x,{as:"span",color:"#7d89b0",children:"If Wonderchat has been useful, an honest review helps other teams decide. We'll add ".concat(m," message credits to your account for leaving one.")})]}):(0,t.jsxs)(O.x,{fontSize:"sm",color:"#4a5578",noOfLines:{base:3,md:2},children:[(0,t.jsx)(O.x,{as:"span",fontWeight:"bold",children:"Done? Grab your credits."})," ",(0,t.jsx)(O.x,{as:"span",color:"#7d89b0",children:"Once your review is submitted on G2, confirm here and we'll drop ".concat(m," credits into your account.")})]})]}),(0,t.jsxs)(k.U,{spacing:2,flexShrink:0,children:["initial"===d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(E.z,{size:"sm",colorScheme:"brand",fontWeight:"semibold",onClick:()=>{null==a||a.capture("g2_review_banner_write_clicked"),window.open("https://www.g2.com/products/wonderchat/reviews","_blank","noopener,noreferrer"),u("confirm")},children:"Write a review"}),(0,t.jsx)(E.z,{size:"sm",variant:"ghost",color:"#7d89b0",fontWeight:"medium",isLoading:g.isLoading,onClick:()=>f(!0),children:"I've already left one"})]}):(0,t.jsx)(E.z,{size:"sm",colorScheme:"brand",fontWeight:"semibold",isLoading:g.isLoading,onClick:()=>f(!1),children:"I submitted it, add my credits"}),(0,t.jsx)(I.h,{"aria-label":"Dismiss",icon:(0,t.jsx)(C.T,{boxSize:"10px"}),size:"sm",variant:"ghost",color:"#7d89b0",_hover:{bg:"blackAlpha.50",color:"#4a5578"},onClick:()=>{c(!0),null==a||a.capture("g2_review_banner_dismissed"),p.mutate()},flexShrink:0})]})]})};var P=i(64141),U=i(22697),F=i(20967),M=i(45161),B=i(8371),q=i(72250),H=i(32883),Y=i(12903),G=i(48583),Q=i(51559),J=i(30454);function K(e){return e>=1e6?"".concat((e/1e6).toFixed(e%1e6==0?0:1),"M"):e>=1e3?"".concat((e/1e3).toFixed(e%1e3==0?0:1),"k"):String(e)}let Z=e=>{var n,i,r,a,l,c,d,h,p,g,m,x,f,j,w,y,S,_,C,k,T,I,R,A,D,z,W,N;let{headerHeight:L}=e,{data:Z}=(0,o.useSession)(),[V,X]=(0,s.useState)(""),[$,ee]=(0,s.useState)(""),en=(0,s.useContext)(Y.Z),ei=(0,o.useSession)(),et=(0,G.Dv)(P.R7),eo=(null==Z?void 0:null===(n=Z.workspace)||void 0===n?void 0:n.subscriptionType)||(null==Z?void 0:null===(i=Z.user)||void 0===i?void 0:i.subscriptionType),{isOpen:er,onOpen:ea,onClose:es}=(0,F.q)();(0,s.useEffect)(()=>{var e,n,i,t,o,r;(null==Z?void 0:null===(e=Z.user)||void 0===e?void 0:e.messageQuota)!==void 0&&(null==Z?void 0:null===(n=Z.user)||void 0===n?void 0:n.messageQuota)<=10&&!localStorage.getItem("10 message sent")&&(localStorage.setItem("10 message sent","done"),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"10_messages consumed"}),gtag("event","10_messages consumed",{send_to:"AW-11319943579/vsRbCODm6JkZEJvD4pUq"}),dataLayer.push({event:"10_Messages_Received",data:{email:Z.user.email}})),(null==Z?void 0:null===(i=Z.user)||void 0===i?void 0:i.messageQuota)!==void 0&&(null==Z?void 0:null===(t=Z.user)||void 0===t?void 0:t.messageQuota)<=17&&!localStorage.getItem("3 message sent")&&(localStorage.setItem("3 message sent","done"),gtag("event","3_messages consumed",{send_to:"AW-11319943579/vsRbCODm6JkZEJvD4pUq"}),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"3_messages consumed"}),dataLayer.push({event:"3_Messages_Received",data:{email:Z.user.email}})),(null==Z?void 0:null===(o=Z.user)||void 0===o?void 0:o.image)&&!V&&X(Z.user.image),(null==Z?void 0:null===(r=Z.user)||void 0===r?void 0:r.name)&&!$&&ee(Z.user.name)}
1,[Z]);let el=(null!==(A=null==Z?void 0:null===(r=Z.user)||void 0===r?void 0:r.messageQuota)&&void 0!==A?A:0)/(u.aq[null!==(D=(null==Z?void 0:null===(a=Z.workspace)||void 0===a?void 0:a.subscriptionType)||eo)&&void 0!==D?D:"NONE"]||20)*100,ec=(null!==(z=null==Z?void 0:null===(l=Z.user)||void 0===l?void 0:l.callSecondsQuota)&&void 0!==z?z:0)/(u.YD[null!==(W=(null==Z?void 0:null===(c=Z.workspace)||void 0===c?void 0:c.subscriptionType)||eo)&&void 0!==W?W:"NONE"]||0)*100;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(b.k,{bg:(0,M.ff)("white","gray.800"),color:(0,M.ff)("gray.600","white"),py:{base:2},px:{base:4},borderBottom:1,borderStyle:"solid",borderColor:(0,M.ff)("gray.200","gray.900"),align:"center",position:{md:"fixed",sm:"relative"},width:"100%",zIndex:2,h:L,w:{md:(null===(h=ei.data)||void 0===h?void 0:null===(d=h.user)||void 0===d?void 0:d.highestGoogleWorkspaceType)==="USER"&&"NONE"===ei.data.user.subscriptionType?"100%":et?"calc(100% - 80px)":"calc(100% - 240px)",sm:"100%"},children:(0,t.jsx)(b.k,{flex:1,alignItems:"center",children:(null==Z?void 0:Z.user)?(0,t.jsxs)(t.Fragment,{children:[(!(null===(m=ei.data)||void 0===m?void 0:null===(g=m.user)||void 0===g?void 0:null===(p=g.email)||void 0===p?void 0:p.endsWith("@supportninja.com"))||(null==ei?void 0:null===(f=ei.data)||void 0===f?void 0:null===(x=f.user)||void 0===x?void 0:x.email)==="[email protected]")&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B.Vp,{mr:{base:2,md:4},colorScheme:"blue",onClick:ea,cursor:"pointer",children:function(e){let n=null!=e?e:"NONE";return"NONE"===n?"Free":n.toUpperCase().startsWith("ENTERPRISE")?"Enterprise":(0,U.Mp)(String(n))}(eo)}),(0,t.jsxs)(v.xu,{layerStyle:"regularImportant",alignItems:"center",display:"flex",gap:{base:2,md:4},sx:{"& > *":{bg:{base:"gray.100",md:"transparent"},px:{base:2,md:0},py:{base:1,md:0},borderRadius:{base:"full",md:"none"}}},children:[(el<=20||"NONE"===eo||Z.workspace)&&(0,t.jsxs)(b.k,{flexDir:"column",gap:1,children:[(0,t.jsxs)(v.xu,{children:[(null==Z?void 0:null===(j=Z.user)||void 0===j?void 0:j.messageQuota)<=0&&(null==Z?void 0:null===(w=Z.user)||void 0===w?void 0:w.enableOverage)&&(0,t.jsx)(B.Vp,{mr:"4",colorScheme:"orange",children:"Overcharge: ".concat(null==Z?void 0:null===(y=Z.user)||void 0===y?void 0:y.overageMessages)}),(0,t.jsx)(O.x,{as:"span",display:{base:"none",md:"inline"},children:"".concat((null===(S=Z.workspace)||void 0===S?void 0:S.messageQuota)||(null==Z?void 0:null===(_=Z.user)||void 0===_?void 0:_.messageQuota)," messages remaining")}),(0,t.jsx)(O.x,{as:"span",display:{base:"inline",md:"none"},fontSize:"xs",whiteSpace:"nowrap",children:"\uD83D\uDCAC ".concat(K((null===(C=Z.workspace)||void 0===C?void 0:C.messageQuota)||(null==Z?void 0:null===(k=Z.user)||void 0===k?void 0:k.messageQuota)||0),"/").concat(K(u.aq[null!==(N=(null==Z?void 0:null===(T=Z.workspace)||void 0===T?void 0:T.subscriptionType)||eo)&&void 0!==N?N:"NONE"]||20))})]}),(0,t.jsx)(q.E,{display:{base:"none",md:"block"},colorScheme:el<=20?"red":el<=50?"orange":"green",size:"sm",value:el,w:"full",rounded:"full"})]}),u.YD[null!=eo?eo:"NONE"]>0&&(0,t.jsxs)(b.k,{flexDir:"column",gap:1,children:[(0,t.jsxs)(v.xu,{children:[(0,t.jsx)(O.x,{as:"span",display:{base:"none",md:"inline"},children:"".concat(null==Z?void 0:null===(I=Z.user)||void 0===I?void 0:I.callSecondsQuota," of ").concat(u.YD[null!=eo?eo:"NONE"]||0," call seconds remaining")}),(0,t.jsx)(O.x,{as:"span",display:{base:"inline",md:"none"},fontSize:"xs",whiteSpace:"nowrap",children:"\uD83D\uDCDE ".concat(K((null==Z?void 0:null===(R=Z.user)||void 0===R?void 0:R.callSecondsQuota)||0),"/").concat(K(u.YD[null!=eo?eo:"NONE"]||0))})]}),(0,t.jsx)(q.E,{display:{base:"none",md:"block"},colorScheme:ec<=20?"red":ec<=50?"orange":"green",size:"sm",value:ec,w:"full",rounded:"full"})]})]})]}),(0,t.jsxs)(b.k,{ml:"auto",gap:{base:2,md:4},alignItems:"center",children:[!en.isWhitelabelled&&(0,t.jsx)(H.r,{href:"https://wonderchat.featurebase.app/dashboard/changelog",target:"_blank",rel:"noreferrer",display:{base:"none",md:"block"},children:(0,t.jsx)(E.z,{colorScheme:"brand",size:"xs",children:"\uD83D\uDCDD Changelog"})}),(0,t.jsx)(Q.D,{})]})]}):(0,t.jsx)(E.z,{ml:"auto",onClick:()=>(0,o.signIn)(),children:"Logout"})})}),(0,t.jsx)(J.C,{isOpen:er,onClose:es})]})},V={"@litecoms.com":"litecoms.wonderchat.io","@ewingos.com":"us.wonderchat.io"},X=()=>window.location.host,$=e=>{if(!e)return;let n=e.toLowerCase(),i=Object.keys(V).find(e=>n.endsWith(e));return i?V[i]:void 0},ee=()=>{var e,n;let i=$(null===(n=(0,o.useSession)().data)||void 0===n?void 0:null===(e=n.user)||void 0===e?void 0:e.email);return i&&X()!==i?(0,t.jsx)(b.k,{bg:"#d92d20",align:"center",justify:"space-between",gap:2,px:{base:4,md:6},py:3,position:"sticky",top:0,zIndex:1,boxShadow:"0 2px 8px rgba(217, 45, 32, 0.35)",children:(0,t.jsxs)(k.U,{spacing:2,align:"center",minW:0,justify:"center",flex:1,children:[(0,t.jsx)(T.J,{as:A.L8_,boxSize:"20px",color:"white",flexShrink:0}),(0,t.jsxs)(O.x,{fontSize:"sm",fontWeight:"semibold",color:"white",children:["Your account has moved to a regional Wonderchat instance. This ","copy is no longer kept up to date, so please log in and continue ","your work at ",(0,t.jsx)(H.r,{href:"https://".concat(i),fontWeight:"bold",color:"white",textDecoration:"underline",children:i})," instead."]})]})}):null};var en=i(38782),ei=i(73209);
1let et="60px",eo=["chatbot-settings","agents/settings","playground","workspace-v2/chat"],er=["/agents/settings"],ea=e=>{var n,i;let{children:r}=e,u=(0,o.useSession)(),h=(0,R.useRouter)(),S=(0,s.useContext)(Y.Z),C=er.some(e=>h.pathname.startsWith(e)),k=h.pathname.startsWith("/workspace-v2"),T=(0,s.useRef)(),O=(0,s.useRef)(),[E,I]=(0,s.useState)(!1),[A,D]=(0,s.useState)(!1),W=(0,s.useRef)(null),N=(0,s.useRef)(null),P=(0,j.NL)();(0,s.useRef)();let U=h.query.hideSidebar,F=x.S.user.heartbeat.useMutation();(0,s.useEffect)(()=>{var e;if(!(null===(e=u.data)||void 0===e?void 0:e.user))return;F.mutate();let n=setInterval(()=>{F.mutate()},6e4);return()=>clearInterval(n)},[null===(i=u.data)||void 0===i?void 0:null===(n=i.user)||void 0===n?void 0:n.id]);let[M,B]=(0,s.useState)(!1),q=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=()=>null===w.ZP||void 0===w.ZP?void 0:w.ZP.capture("$pageview");return h.events.on("routeChangeComplete",e),()=>{h.events.off("routeChangeComplete",e)}},[h]),(0,s.useEffect)(()=>{let e=()=>{"visible"===document.visibilityState&&(I(!1),D(!1))};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[]),(0,s.useEffect)(()=>{var e,n;E?null==N||null===(e=N.current)||void 0===e||e.play():null==N||null===(n=N.current)||void 0===n||n.pause()},[E]),(0,s.useEffect)(()=>{if(A){let e=!1,n=document.title;return W.current=setInterval(()=>{e=!e,document.title=e?"\uD83D\uDD34 New Live Chat!":n},1e3),()=>{W.current&&(clearInterval(W.current),W.current=null),document.title=n}}W.current&&(clearInterval(W.current),W.current=null)},[A]),(0,s.useEffect)(()=>{var e,n,i,t,o;(null===(e=u.data)||void 0===e?void 0:e.user)&&!(null===(n=T.current)||void 0===n?void 0:n.connection)&&(null==T||null===(i=T.current)||void 0===i||i.disconnect(),T.current=new(_())(d.O.NEXT_PUBLIC_PUSHER_APP_KEY,{cluster:d.O.NEXT_PUBLIC_PUSHER_APP_CLUSTER}),O.current=T.current.subscribe("user-".concat(null===(o=u.data)||void 0===o?void 0:null===(t=o.user)||void 0===t?void 0:t.id)),O.current.bind("agent-responded",()=>{console.log("an agent responded"),P.invalidateQueries()}),O.current.bind("new-livechat-message",e=>{var n,i,t,o,r;let{message:a}=e;if(P.invalidateQueries(),"visible"!==document.visibilityState&&D(!0),"visible"!==document.visibilityState&&(null==u?void 0:null===(i=u.data)||void 0===i?void 0:null===(n=i.user)||void 0===n?void 0:n.enableLiveChatDesktopNotifications)&&new Notification("New livechat message",{body:a,icon:"/logo.png"}),!(null===(t=u.data.user)||void 0===t?void 0:t.enableLiveChatRinging))return;let s="".concat(Date.now(),"-").concat(Math.random());q.current=s,q.current===s&&("visible"===document.visibilityState||(null===(r=u.data)||void 0===r?void 0:null===(o=r.user)||void 0===o?void 0:o.liveChatRingingInterval)==="ONCE"?new Audio("/notification.mp3").play():I(!0))}))},[u]);let H=()=>{try{return window.self!==window.top}catch(e){return!0}};return S.isLoading?(0,t.jsx)(b.k,{h:"100vh",w:"100vw",alignItems:"center",justifyContent:"center",children:(0,t.jsx)(f.$,{})}):(0,t.jsxs)(y.zf,{client:w.ZP,children:[!u.data||H()||U?r:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p,{}),(0,t.jsx)(g,{}),(0,t.jsx)(l,{}),(0,t.jsx)(c,{}),(0,t.jsx)(a(),{id:"rewardful-1",dangerouslySetInnerHTML:{__html:"(function(w,r){w._rwq=r;w[r]=w[r]||function(){(w[r].q=w[r].q||[]).push(arguments)}})(window,'rewardful');"}}),(0,t.jsx)(a(),{id:"rewardful-2",async:!0,src:"https://r.wdfl.co/rw.js","data-rewardful":"0726a0"}),(0,t.jsx)(a(),{id:"gtag-manager",async:!0,src:"https://www.googletagmanager.com/gtag/js?id=G-ZW6W9W9VNJ"}),(0,t.jsx)(a(),{id:"gtag-script-1",children:"
vendor: 127 bytes, line 1
1window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '
1G-ZW6W9W9VNJ
vendor: 4 bytes, line 1
1'); 
1"}),(0,t.jsx)(a(),{id:"gtag-script-2",children:"
vendor: 324 bytes, line 1
1(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','
1GTM-K6F69SFH
vendor: 2 bytes, line 1
1')
1"}),(0,t.jsx)(a(),{async:!0,id:"gtag-script-3",src:"https://www.googletagmanager.com/gtag/js?id=AW-11319943579"})," ",(0,t.jsxs)(a(),{id:"gtag-script-4",children:["
vendor: 127 bytes, line 1
1window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '
1AW-11319943579
vendor: 3 bytes, line 1
1');
1"," "]}),(0,t.jsx)(a(),{id:"gtag-script-5",children:"
vendor: 325 bytes, line 1
1(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','
1GTM-KG83B6K
vendor: 3 bytes, line 1
1');
1"}),(0,t.jsx)(a(),{id:"gtag-event",children:"gtag('event', 'conversion', {'send_to': 'AW-11319943579/2-ADCNTZ9OMYEJvD4pUq'});"}),(0,t.jsx)(a(),{id:"fb-init",children:"window.fbAsyncInit = function() {\n                FB.init({\n                  appId            : '1072059227177857',\n                  autoLogAppEvents : true,\n                  xfbml            : true,\n                  version          : 'v17.0'\n                });\n              };"}),(0,t.jsx)(a(),{async:!0,defer:!0,crossOrigin:"anonymous",src:"https://connect.facebook.net/en_US/sdk.js"}),(0,t.jsx)(a(),{id:"stape-script",children:"(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s);j.async=true;j.src=\"https://load.g.wonderchat.io/6bjwjtagd.js?\"+i;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','2yau=aWQ9R1RNLUtHODNCNks%3D&page=2');"}),(0,t.jsx)("noscript",{children:(0,t.jsx)("iframe",{src:"https://load.g.wonderchat.io/ns.html?id=GTM-KG83B6K",height:"0",width:"0",style:{display:"none",visibility:"hidden"}})}),(0,t.jsx)("noscript",{children:(0,t.jsx)("iframe",{src:"https://www.googletagmanager.com/ns.html?id=GTM-K6F69SFH",height:"0",width:"0",style:{display:"none",visibility:"hidden"}})}),(0,t.jsx)("noscript",{children:(0,t.jsx)("iframe",{src:"https://www.googletagmanager.com/ns.html?id=GTM-KG83B6K",height:"0",width:"0",style:{display:"none",visibility:"hidden"}})}),(0,t.jsx)(ei.W5,{children:(0,t.jsxs)(en.Z,{children:[(0,t.jsxs)("audio",{ref:N,loop:!0,children:[(0,t.jsx)("source",{src:"/notification.mp3",type:"audio/mpeg"}),"Your browser does not support the audio element."]}),!C&&(0,t.jsx)(Z,{headerHeight:et}),(0,t.jsxs)(v.xu,{pt:{md:C?"0":et},bgColor:"background.100",overflow:C?"visible":"auto",children:[!C&&(0,t.jsx)(ee,{}),!C&&!k&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(z,{}),(0,t.jsx)(L,{})]}),(0,t.jsx)(v.xu,{h:C?"auto":{md:"calc(100vh - ".concat(et,")"),base:"calc(100vh - 140px)"},p:eo.some(e=>h.pathname.includes(e))?"0":"4",children:r})]})]})}),!k&&(0,t.jsx)(m.OwnSiteWidget,{chatbotId:d.O.NEXT_PUBLIC_SITE_WIDGET_CHATBOT_ID})]}),u.data&&!H()]})}},6417:function(e,n,i){i.d(n,{x:function(){return L}});var t=i(85893),o=i(19875),r=i(47583),a=i(84790),s=i(81399),l=i(22697),c=i(59007),d=i(45349),u=i(7963),h=i(35796),p=i(35541),g=i(83589),m=i(14581),x=i(66205),b=i(64859),f=i(93717),v=i(89993),j=i(57747),w=i(71293),y=i(54346),S=i(85970),_=i(22797),C=i(32883),k=i(48783),T=i(73804),O=i(34292),E=i(93108),I=i(74e3),R=i(97930),A=i(33299),D=i(58192),z=i(67294),W=i(34052);let N=e=>{let{features:n,subtitle:i,currentPlan:o,isTrialingCurrentPlan:r=!1,cardPlan:s,isYearly:c,onClick:d}=e,u=c?(a.yJ[s]/12).toFixed(0):a.kT[s],h=o===s;return(0,t.jsx)(j.xu,{borderWidth:"1px",borderColor:"gray.200",borderRadius:"2xl",bg:"white",boxShadow:"sm",p:6,width:"full",h:"full",children:(0,t.jsxs)(k.g,{align:"flex-start",spacing:5,children:[(0,t.jsx)(w.x,{fontSize:"xl",fontWeight:"semibold",color:"gray.900",children:(0,l.Mp)(s.split("_")[0])}),r&&(0,t.jsx)(w.x,{fontSize:"xs",fontWeight:"bold",color:"blue.600",bg:"blue.50",px:3,py:1,borderRadius:"full",children:"Trialing"}),(0,t.jsxs)(f.k,{align:"baseline",children:[(0,t.jsxs)(w.x,{fontSize:"4xl",fontWeight:"bold",color:"gray.900",lineHeight:"1",children:["$",u]}),(0,t.jsx)(w.x,{fontSize:"sm",color:"gray.500",ml:1,children:"/mo"})]}),(0,t.jsx)(E.z,{width:"full",colorScheme:"blue",variant:"solid",borderRadius:"lg",fontWeight:"semibold",isDisabled:h&&!r,onClick:()=>{d(s)},children:r?"Choose ".concat((0,l.Mp)(s.split("_")[0])):h?"Current Plan":(0,l.BQ)(o,s)?"Downgrade":"Upgrade"}),i&&(0,t.jsx)(w.x,{color:"blue.500",fontWeight:"medium",fontSize:"sm",children:i}),(0,t.jsx)(k.g,{align:"flex-start",spacing:3,width:"full",children:n.map((e,n)=>(0,t.jsxs)(f.k,{align:"center",children:[(0,t.jsx)(j.xu,{color:"blue.500",mr:2,flexShrink:0,mt:"1px",children:(0,t.jsx)(W.UgA,{size:16,strokeWidth:2.5})}),(0,t.jsx)(w.x,{fontSize:"sm",color:"gray.700",textDecoration:0===n?"underline":void 0,children:e})]},n))})]})})},L=e=>{var n,i,L,P,U,F,M,B,q,H,Y,G;let{isOpen:Q,onClose:J}=e,[K,Z]=(0,z.useState)(!1),[V,X]=(0,z.useState)("plans"),[$,ee]=(0,z.useState)(null),en=(0,A.useSession)(),ei=(0,u.p)(),et=(0,h.S)({base:"full",md:"4xl"}),eo=null===(n=en.data)||void 0===n?void 0:n.user,er=null!==(B=null===(L=en.data)||void 0===L?void 0:null===(i=L.user)||void 0===i?void 0:i.subscriptionType)&&void 0!==B?B:"NONE",{data:ea}=c.S.user.getUserDetails.useQuery(void 0,{enabled:Q}),es=(null==ea?void 0:ea.noCardTrialEndsAt)?new Date(ea.noCardTrialEndsAt):null,el=null!=es&&es.getTime()>Date.now()&&(null==ea?void 0:ea.subscriptionId)==null&&er===a.Ye,ec=(0,o.Kn)(),ed=(0,D.U0)(),eu=(0,z.useRef)(!1);(0,z.useEffect)(()=>
1{if(!Q){eu.current=!1;return}eu.current||(eu.current=!0,null==ed||ed.capture("upgrade_prompt_shown",{surface:"legacy_paywall_modal",prompt_type:"legacy_paywall_modal",trial_opt_in_variant:ec,current_plan:er}))},[Q,ed,ec,er]);let{data:eh}=c.S.subscriptions.getSubscriptionInfo.useQuery(),ep=null==eh?void 0:eh.subscriptionInfo,eg=c.S.subscriptions.changeSubscription.useMutation({onSuccess:e=>{X("plans"),ee(null),ei({title:e?"Subscription downgraded":"Subscription upgraded!",description:e?"Your plan will be downgraded at the end of your current billing cycle.":"Your subscription has been upgraded. Please refresh the page if changes have not shown.",status:"success",duration:4e3,isClosable:!0}),J()},onError:e=>{ei({title:"Error occurred when changing subscription",description:"Error: ".concat(e.message,". Please contact support if the problem persists"),status:"error",duration:4e3,isClosable:!0})}}),em=(null!==(q=a.kT[null!=$?$:"NONE"])&&void 0!==q?q:0)-(null!==(H=a.kT[er])&&void 0!==H?H:0)>=0,ex={accountId:null==eo?void 0:eo.id,email:null==eo?void 0:eo.email,plan:er},eb=(e,n)=>{null==ed||ed.capture(r._X.upgrade_started,(0,r.ht)({accountContext:ex,currentPlan:er,targetPlan:e,surface:n,extraProperties:{billing_interval:K?"yearly":"monthly",trial_opt_in_variant:ec}})),(0,s.FZ)(s.KW.addToCart,{email:null==eo?void 0:eo.email,value:a.kT[e],currency:"USD",plan:String(e).toLowerCase()})},ef=e=>{if(ep)ee(e),X("confirm");else{eb(e,"paywall_modal"),J&&J();let n="undefined"!=typeof Rewardful?Rewardful.referral:null;dataLayer.push({ecommerce:null}),dataLayer.push({event:"add_to_cart",ecommerce:{currency:"USD",value:a.kT[e],items:[{item_id:e,item_name:e,currency:"USD",google_business_vertical:"retail",price:a.kT[e],quantity:1}]}}),Paddle.Checkout.open({product:K?a.Zn[e]:a.cj[e],email:null==eo?void 0:eo.email,passthrough:JSON.stringify({userId:null==eo?void 0:eo.id,rewardful:{referral:n}})})}},ev=()=>{X("plans"),ee(null)};return(0,t.jsxs)(p.u_,{onClose:()=>{X("plans"),ee(null),J()},isOpen:Q,size:et,isCentered:!0,trapFocus:!1,scrollBehavior:"inside",children:[(0,t.jsx)(g.Z,{bg:"blackAlpha.700",backdropFilter:"blur(4px)"}),(0,t.jsxs)(m.h,{bg:"gray.50",children:[(0,t.jsx)(x.o,{}),(0,t.jsx)(b.x,{pt:6,children:(0,t.jsxs)(f.k,{align:"center",gap:3,children:["confirm"===V&&(0,t.jsx)(v.h,{"aria-label":"Back to plans",icon:(0,t.jsx)(W.Ao2,{}),variant:"ghost",onClick:ev,size:"sm"}),(0,t.jsx)(j.xu,{color:"blue.500",children:(0,t.jsx)(W.Wpg,{size:24})}),(0,t.jsx)(w.x,{fontSize:"2xl",fontWeight:"bold",children:"plans"===V?"Subscription":em?"Upgrade Plan":"Downgrade Plan"})]})}),(0,t.jsx)(y.f,{pb:6,pt:0,px:8,children:"plans"===V?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(f.k,{justify:"space-between",mb:"4",children:[(0,t.jsx)(j.xu,{flex:"1"}),(0,t.jsxs)(S.NI,{display:"flex",justifyContent:"center",alignItems:"center",gap:2,flex:"1",fontWeight:"semibold",children:[(0,t.jsx)(_.r,{id:"billing-switch",size:"md",isChecked:K,onChange:e=>Z(e.target.checked)}),(0,t.jsx)(w.x,{color:"gray.600",children:"Yearly (-17% off)"})]}),(0,t.jsx)(f.k,{justify:"flex-end",flex:"1",children:(0,t.jsxs)(C.r,{href:"https://wonderchat.io/pricing",target:"_blank",layerStyle:"bigImpt",alignItems:"center",display:"flex",color:"blue.500",children:["Learn More"," ",(0,t.jsx)(d.h,{ml:2})]})})]}),(0,t.jsxs)(f.k,{direction:{base:"column",md:"row"},gap:4,align:"stretch",children:[(0,t.jsx)(j.xu,{flex:"1",children:(0,t.jsx)(N,{isPopular:!0,cardPlan:"BASIC",features:a.Vb,isYearly:K,currentPlan:er,isTrialingCurrentPlan:el&&"BASIC"===er,onClick:ef})}),(0,t.jsx)(j.xu,{flex:"1",children:(0,t.jsx)(N,{cardPlan:"SCALE",features:a.Bm,isYearly:K,currentPlan:er,isTrialingCurrentPlan:el&&"SCALE"===er,subtitle:"Everything in Basic and ...",onClick:ef})})]})]}):(0,t.jsxs)(k.g,{alignItems:"flex-start",gap:"4",pb:4,children:[(0,t.jsx)(w.x,{layerStyle:"bigImpt",children:"Plan change: ".concat(er," to ").concat($," ").concat(K?"yearly":"monthly")}),(0,t.jsx)(w.x,{fontSize:"sm",children:em?(0,t.jsxs)(t.Fragment,{children:["You will be",(0,t.jsxs)("strong",{children:[" charged the full amount of $",K?a.yJ[null!=$?$:"NONE"]:a.kT[null!=$?$:"NONE"]," ","USD immediately"]})," ","and the full plan quota of ",(0,t.jsxs)("strong",{children:[null!==(Y=a.aq[null!=$?$:"NONE"])&&void 0!==Y?Y:0," ","messages "]}),"will be topped up to your account. Your next bill date will be ",(0,t.jsx)("strong",{children:(0,I.Z)((0,R.Z)(new Date,K?12:1),"dd-M
1M-yyyy")}),", and you will be billed $",K?a.yJ[null!=$?$:"NONE"]:a.kT[null!=$?$:"NONE"]," ","USD for all subsequent ",K?"years":"months","."]}):"Your plan will be downgraded to ".concat(null!=$?$:"NONE",", and you will be billed ").concat(K?a.yJ[null!=$?$:"NONE"]:a.kT[null!=$?$:"NONE"]," USD for all subsequent ").concat(K?"years":"months",".")}),!em&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(w.x,{fontSize:"sm",children:["Are you sure you want to downgrade your subscription from ",(0,t.jsx)("strong",{children:er})," ","to"," ",(0,t.jsx)("strong",{children:$}),"?"]}),(0,t.jsxs)(w.x,{fontSize:"sm",children:["You will ",(0,t.jsx)("strong",{children:"lose access to the following features"})," ","if you downgrade:"]}),(0,t.jsxs)(T.QI,{spacing:2,fontSize:"sm",children:[(0,l.BQ)(er,"TURBO")&&!(0,l.BQ)($,"TURBO")&&(0,t.jsxs)(T.HC,{children:[(0,t.jsx)(w.x,{fontWeight:"bold",children:"Zendesk Integration"}),(0,t.jsx)(w.x,{fontSize:"sm",color:"gray.600",children:"Any of your existing Zendesk integrations will be disconnected"})]}),(0,l.BQ)(er,"TURBO")&&!(0,l.BQ)($,"TURBO")&&(0,t.jsxs)(T.HC,{children:[(0,t.jsx)(w.x,{fontWeight:"bold",children:"AI Models"}),(0,t.jsx)(w.x,{fontSize:"sm",color:"gray.600",children:"Any of your chatbots currently on Claude 3 Sonnet / Opus, Command R+ or Mistral models will be changed to GPT-4o"})]}),(0,l.BQ)(er,"BASIC")&&!(0,l.BQ)($,"BASIC")&&(0,t.jsxs)(T.HC,{children:[(0,t.jsx)(w.x,{fontWeight:"bold",children:"FAQ generation"}),(0,t.jsx)(w.x,{fontSize:"sm",color:"gray.600",children:"You will no longer be able to view the most frequently asked questions on the analytics dashboard"})]}),(0,l.BQ)(er,"BASIC")&&!(0,l.BQ)($,"BASIC")&&(0,t.jsxs)(T.HC,{children:[(0,t.jsx)(w.x,{fontWeight:"bold",children:"Live Chat"}),(0,t.jsx)(w.x,{fontSize:"sm",color:"gray.600",children:"Your chatbots will no longer be able to hand off to live chat"})]}),(0,t.jsxs)(T.HC,{children:[(0,t.jsx)(w.x,{fontWeight:"bold",children:"Chatbot capacity"}),(0,t.jsxs)(w.x,{fontSize:"sm",color:"gray.600",children:["Only your first ",(0,a.Fu)(null!=$?$:"BASIC",null!==(G=null===(U=en.data)||void 0===U?void 0:null===(P=U.workspace)||void 0===P?void 0:P.ownerCreatedAt)&&void 0!==G?G:null===(M=en.data)||void 0===M?void 0:null===(F=M.user)||void 0===F?void 0:F.createdAt)," ","chatbots will remain active, and only the first ",a.aP[null!=$?$:"LITE"]," ","webpages in your chatbot will remain active"]})]}),(0,t.jsxs)(T.HC,{children:[(0,t.jsx)(w.x,{fontWeight:"bold",children:"Team Members"}),(0,t.jsxs)(w.x,{fontSize:"sm",color:"gray.600",children:["Only your first ",a.be[null!=$?$:"BASIC"]," ","team members will have access to each of your chatbots"]})]})]})]}),(0,t.jsxs)(O.U,{w:"full",justify:"flex-end",pt:4,children:[(0,t.jsx)(E.z,{onClick:ev,variant:"ghost",children:"Back"}),(0,t.jsx)(E.z,{isLoading:eg.isLoading,colorScheme:em?"green":"red",onClick:()=>{$&&(em&&eb($,"paywall_modal_confirm"),eg.mutate({planId:K?a.Zn[$]:a.cj[$]}))},children:"Confirm"})]})]})})]})]})}},51559:function(e,n,i){i.d(n,{D:function(){return ei}});var t=i(85893),o=i(64141),r=i(73209),a=i(90545),s=i(84790),l=i(70386),c=i(22697),d=i(59007),u=i(6147),h=i(36855),p=i(93717),g=i(75141),m=i(71293),x=i(36948),b=i(7963),f=i(20967),v=i(66712),j=i(91170),w=i(93108),y=i(57747),S=i(1702),_=i(4040),C=i(34292),k=i(62658),T=i(8371),O=i(89993),E=i(48583),I=i(33299),R=i(11163),A=i(67294),D=i(34052),z=i(22275),W=i(30454),N=i(45527),L=i(35541),P=i(83589),U=i(14581),F=i(64859),M=i(66205),B=i(54346),q=i(55281),H=i(85970),Y=i(5418),G=i(33090),Q=i(41731),J=i(45966),K=i(74153),Z=i(7405),V=i(14253);function X(e){let{isOpen:n,onClose:i,onSuccess:o}=e,r=(0,b.p)(),[a,s]=(0,A.useState)(""),[l,c]=(0,A.useState)(!1),[u,g]=(0,A.useState)(!1),[x,f]=(0,A.useState)([{email:"",role:"MEMBER",id:1}]),v=(e,n,i)=>{f(x.map(t=>t.id===e?{...t,[n]:i}:t))},j=e=>{f(x.filter(n=>n.id!==e))},S=()=>{let e=[],n=new Set;for(let i of x){let t=i.email.trim();if(t){if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t)||n.has(t.toLowerCase()))continue;n.add(t.toLowerCase()),e.push({email:t,role:i.role,id:i.id})}}return e}
1,_=d.S.workspaces.createWorkspace.useMutation({onSuccess:async e=>{r({title:"Team created",description:'Your team "'.concat(e.name,'" has been created successfully'),status:"success",duration:5e3,isClosable:!0}),i(),o&&o()},onError:e=>{r({title:"Error creating team",description:e.message,status:"error",duration:5e3,isClosable:!0}),c(!1)}}),C=async e=>{if(e.preventDefault(),!a.trim()){r({title:"Error",description:"Team name is required",status:"error",duration:3e3,isClosable:!0});return}let n=S();c(!0),_.mutate({name:a,invitedUsers:n,migrateCredentials:u})};return(0,t.jsxs)(L.u_,{isOpen:n,onClose:i,size:"lg",children:[(0,t.jsx)(P.Z,{}),(0,t.jsxs)(U.h,{children:[(0,t.jsx)(F.x,{children:"Create New Team"}),(0,t.jsx)(M.o,{}),(0,t.jsxs)("form",{onSubmit:C,children:[(0,t.jsx)(B.f,{children:(0,t.jsx)(q.K,{spacing:6,pb:4,children:(0,t.jsxs)(y.xu,{children:[(0,t.jsx)(m.x,{mb:6,color:"gray.600",children:"Create a team to collaborate with your team members and share chatbots and credentials."}),(0,t.jsxs)(H.NI,{id:"name",isRequired:!0,mb:6,children:[(0,t.jsx)(Y.l,{children:"Team Name"}),(0,t.jsx)(G.I,{type:"text",value:a,size:"sm",onChange:e=>s(e.target.value),placeholder:"Enter team name",autoFocus:!0})]}),(0,t.jsxs)(y.xu,{children:[(0,t.jsx)(Y.l,{children:"Invite Team Members (Optional)"}),(0,t.jsx)(m.x,{fontSize:"sm",color:"gray.500",mb:4,children:"Add team members by email and assign their role"}),(0,t.jsxs)(q.K,{spacing:3,mb:4,children:[x.map((e,n)=>(0,t.jsxs)(p.k,{gap:3,alignItems:"center",children:[(0,t.jsx)(G.I,{type:"email",placeholder:"Email address",value:e.email,onChange:n=>v(e.id,"email",n.target.value),size:"sm",flex:1}),(0,t.jsxs)(Q.P,{value:e.role,onChange:n=>v(e.id,"role",n.target.value),size:"sm",width:"120px",children:[(0,t.jsx)("option",{value:"MEMBER",children:"Member"}),(0,t.jsx)("option",{value:"ADMIN",children:"Admin"})]}),x.length>1&&(0,t.jsx)(O.h,{"aria-label":"Remove member",icon:(0,t.jsx)(N.p,{}),onClick:()=>j(e.id),size:"sm",variant:"ghost",colorScheme:"red"})]},e.id)),(0,t.jsx)(w.z,{leftIcon:(0,t.jsx)(h.d,{}),onClick:()=>{f([...x,{email:"",role:"MEMBER",id:Date.now()}])},colorScheme:"gray",variant:"outline",size:"sm",width:"full",mt:2,children:"Add Team Member"})]})]}),(0,t.jsx)(y.xu,{mt:6,children:(0,t.jsxs)(H.NI,{children:[(0,t.jsx)(J.X,{isChecked:u,onChange:e=>g(e.target.checked),children:(0,t.jsx)(m.x,{fontWeight:"medium",children:"Migrate existing integrations to this team"})}),(0,t.jsxs)(K.b,{status:"info",mt:3,fontSize:"sm",children:[(0,t.jsx)(Z.z,{}),(0,t.jsx)(m.x,{children:"This will copy your current integration credentials (SharePoint, Google Drive, HubSpot, etc.) to the new team, allowing all team members to use these integrations."})]})]})})]})})}),(0,t.jsxs)(V.m,{borderTopWidth:"1px",pt:4,children:[(0,t.jsx)(w.z,{variant:"outline",onClick:i,isDisabled:l,mr:3,children:"Cancel"}),(0,t.jsx)(w.z,{colorScheme:"brand",isLoading:l,type:"submit",loadingText:"Creating...",children:"Create Team"})]})]})]})]})}var $=i(73430);function ee(e){let n=null!=e?e:"NONE";return"NONE"===n?"Free":n.toUpperCase().startsWith("ENTERPRISE")?"Enterprise":(0,c.Mp)(String(n))}function en(e){let{imageUrl:n,name:i,tag1:o,tag2:r,icon:a,size:s="md",isActive:l,onClick:c}=e,d="md"===s?"40px":"32px";return(0,t.jsxs)(p.k,{alignItems:"center",gap:3,px:"md"===s?1:2,py:"md"===s?0:2,borderRadius:"md",cursor:c?"pointer":void 0,_hover:c?{bg:"gray.100"}:void 0,onClick:c,children:[a?(0,t.jsx)(g.q,{h:d,w:d,bg:"gray.200",color:"gray.600",icon:A.cloneElement(a,{size:"md"===s?20:16})}):(0,t.jsx)(g.q,{h:d,w:d,src:null!=n?n:void 0,name:i}),(0,t.jsxs)(p.k,{direction:"column",minW:0,flex:1,children:[(0,t.jsx)(m.x,{fontSize:"sm",color:"gray.800",fontWeight:"600",noOfLines:1,children:i}),(0,t.jsxs)(m.x,{fontSize:"xs",fontWeight:"500",color:"gray.600",isTruncated:!0,children:[o,r&&" \xb7 ".concat(r)]})]}),l&&(0,t.jsx)(x.J,{as:D.UgA,color:"gray.600",boxSize:5})]})}let ei=()=>{var e,n,i,c,N,L,P,U,F;let{data:M,update:B}=(0,I.useSession)(),q=(0,R.useRouter)(),H=(0,b.p)(),Y=(0,I.useSession)(),[G,Q]=(0,A.useState)(!1),{data:J,refetch:K}=d.S.workspaces.getUserWorkspaces.useQuery(),Z=q.pathname.startsWith("/workspace-v2")?"WORKSPACE":"CHATBOT",{isAllowed:V}=(0,a.L)(),{workspaces:ei,activeWorkspace:et,setActiveWorkspace:eo}=(0,r.cF)(),er=d.S.user.setAppMode.useMutation(),ea=(0,E.b9)(o.OA),es=e=>{e!==Z&&(er.mutate({mode:e}),ea("WORKSPACE"===e?"workspace":"agents"),"WORKSPACE"===e?window.location.href="/workspace-v2":window.location.href="/")},{isOpen:el,onOpen:ec,onClose:ed}=(0,f.q)(),{isOpen:eu,onOpen:eh,onClose:ep}=(0,f.q)(),{isOpen:eg,onOpen:em,onClose:ex}=(0,f.q)(),{data:eb,refetch:ef}=d.S.workspaces.getUserPendingInvitations.useQuery(),ev=d.S.workspaces.acceptWorksp
1aceInvitation.useMutation({onSuccess:e=>{let{workspaceId:n,workspaceName:i}=e;q.push("/"),K(),ef(),ey(n),H({title:"Invitation for ".concat(i," accepted!"),status:"success",duration:1500,isClosable:!0})}}),ej=d.S.workspaces.rejectWorkspaceInvitation.useMutation({onSuccess:()=>{ef()}}),ew=d.S.workspaces.setSelectedWorkspace.useMutation({onSuccess:(e,n)=>{B(),q.query.accept_workspace_invite?q.push("/"):"/settings"===q.pathname||"/workspace"===q.pathname?window.location.href=n.workspaceId?"/workspace":"/settings":window.location.reload()}}),ey=e=>{var n;e!==(null==M?void 0:null===(n=M.workspace)||void 0===n?void 0:n.id)&&ew.mutate({workspaceId:e})},eS=e=>{ev.mutate({invitationId:e})},e_=e=>{ej.mutate({invitationId:e})};(0,A.useEffect)(()=>{var e;if(null==q?void 0:null===(e=q.query)||void 0===e?void 0:e.accept_workspace_invite){let e=q.query.accept_workspace_invite;if("string"!=typeof e)return;ev.mutate({invitationId:e})}},[q.query]);let eC=(0,A.useMemo)(()=>{var e,n;let i=null==Y?void 0:null===(e=Y.data)||void 0===e?void 0:e.user;return!i||!J||J.length>=s.W7[null!==(n=i.subscriptionType)&&void 0!==n?n:"NONE"]},[null==Y?void 0:Y.data,null==J?void 0:J.length]),ek=null==M?void 0:null===(e=M.workspace)||void 0===e?void 0:e.id,eT=null!==(P=null==J?void 0:J.find(e=>e.id===ek))&&void 0!==P?P:null;return(null==M?void 0:M.user)?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(v.v,{closeOnBlur:!eu&&!eg&&!G&&!el,children:[(0,t.jsxs)(j.j,{as:w.z,"aria-label":"Options",variant:{base:"ghost",md:"outline"},py:1,px:{base:1,md:3},position:"relative",children:[eb&&(null==eb?void 0:eb.length)>0&&(0,t.jsx)(y.xu,{position:"absolute",top:"-2px",right:"-2px",bg:"red.500",color:"white",borderRadius:"full",minW:"18px",h:"18px",fontSize:"xs",display:"flex",alignItems:"center",justifyContent:"center",fontWeight:"bold",children:eb.length}),"WORKSPACE"===Z?(0,t.jsxs)(p.k,{justifyContent:"center",alignItems:"center",gap:3,children:[(0,t.jsx)(g.q,{h:{base:"36px",md:"28px"},w:{base:"36px",md:"28px"},bg:"brand.100",color:"brand.700",icon:(0,t.jsx)(D.aCJ,{size:16}),shadow:{base:"md",md:"none"}}),(0,t.jsx)(m.x,{fontSize:"14px",fontWeight:"semibold",display:{base:"none",md:"block"},children:null!==(U=null==et?void 0:et.name)&&void 0!==U?U:"Workspace"}),(0,t.jsx)(u.v,{display:{base:"none",md:"block"}})]}):M.workspace?(0,t.jsxs)(p.k,{justifyContent:"center",alignItems:"center",gap:3,children:[M.workspace.imageUrl?(0,t.jsx)(g.q,{h:{base:"36px",md:"28px"},w:{base:"36px",md:"28px"},src:null==M?void 0:null===(n=M.workspace)||void 0===n?void 0:n.imageUrl,name:"Workspace picture",shadow:{base:"md",md:"none"}}):(0,t.jsx)(g.q,{h:{base:"36px",md:"28px"},w:{base:"36px",md:"28px"},bg:"gray.200",color:"gray.600",icon:(0,t.jsx)(D.ggF,{size:16}),shadow:{base:"md",md:"none"}}),(0,t.jsx)(m.x,{fontSize:"14px",fontWeight:"semibold",display:{base:"none",md:"block"},children:null==M?void 0:null===(i=M.workspace)||void 0===i?void 0:i.name}),(0,t.jsx)(u.v,{display:{base:"none",md:"block"}})]}):(0,t.jsxs)(p.k,{justifyContent:"center",alignItems:"center",gap:3,children:[(0,t.jsx)(g.q,{h:{base:"36px",md:"28px"},w:{base:"36px",md:"28px"},src:null!==(F=null==M?void 0:null===(c=M.user)||void 0===c?void 0:c.image)&&void 0!==F?F:s.rD,name:"Profile picture",shadow:{base:"md",md:"none"}}),(0,t.jsx)(m.x,{fontSize:"14px",fontWeight:"semibold",display:{base:"none",md:"block"},children:(null==M?void 0:null===(N=M.user)||void 0===N?void 0:N.name)||(null==M?void 0:null===(L=M.user)||void 0===L?void 0:L.email)}),(0,t.jsx)(u.v,{display:{base:"none",md:"block"}})]})]}),(()=>{var e,n,i,o,r,a,c,d,u;let b="WORKSPACE"===Z,f=b?"Workspace":"".concat(ee(eT?eT.owner.subscriptionType:null==M?void 0:null===(e=M.user)||void 0===e?void 0:e.subscriptionType)," plan"),v=b?null:eT?eT.imageUrl:null!==(c=null==M?void 0:null===(n=M.user)||void 0===n?void 0:n.image)&&void 0!==c?c:s.rD,j=b?(0,t.jsx)(D.aCJ,{size:20}):eT&&!eT.imageUrl?(0,t.jsx)(D.ggF,{size:20}):void 0,E=b?null!==(d=null==et?void 0:et.name)&&void 0!==d?d:"Workspace":eT?eT.name:M.user.name||M.user.email||"",R=b?null==M?void 0:null===(i=M.user)||void 0===i?void 0:i.email:eT?void 0:null==M?void 0:null===(o=M.user)||void 0===o?void 0:o.email;return(0,t.jsx)(S.h,{children:(0,t.jsxs)(_.q,{minW:"280px",maxW:"320px",maxH:"70vh",overflowY:"auto",p:3,boxShadow:"lg",border:"1px solid",borderColor:"gray.200",zIndex:"dropdown",children:[(0,t.jsx)(y.xu,{pb:3,children:(0,t.jsx)(en,{imageUrl:v,icon:j,name:E,tag1:f,tag2:R})}),!b&&(0,t.jsxs)(C.U,{spacing:2,px:1,children:[(0,t.jsx)(w.z,{size:"sm",variant:"outline",rounded:"lg",onClick:()=>q.push(eT?"/workspace":"/settings"),flex:8,children:"Settings"}),(0,t.jsx)(w.z,{size:"sm",variant:"outline",flex:14,rounded:"lg",onClick:()=>{eT?eh():em()},children:"Invite members"})]}),b&&et&&(0,t.jsxs)(C.U,{spacing:2,px:1,children:[(0,t.jsx)(w.z,{size:"sm",variant:"outline",rounded:"lg",onClick:()=>q.push("/workspace-v2/team"),flex:8,children:"Settings"}),(0,t.jsx)(w.z,{size:"sm",variant:"outline",flex:14,rounded:"lg",onClick:()=>q.push("/workspace-v2/team"),children:"Invite members"})]}),V&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(k.R,{py:1}),(0,t.jsxs)(p.k,{alignItems:"center",gap:3,px:2,py:2,borderRadius:"md",cursor:"pointer",bg:b?"gray.50":"brand.50",_hover:{bg:b?"gray.
1100":"brand.100"},onClick:()=>es(b?"CHATBOT":"WORKSPACE"),children:[(0,t.jsx)(p.k,{w:"32px",h:"32px",borderRadius:"full",bg:b?"gray.200":"brand.500",color:b?"gray.700":"white",align:"center",justify:"center",flexShrink:0,children:b?(0,t.jsx)(D.IC0,{size:16}):(0,t.jsx)(D.aCJ,{size:16})}),(0,t.jsxs)(p.k,{direction:"column",flex:1,minW:0,children:[(0,t.jsxs)(m.x,{fontSize:"xs",color:"gray.500",fontWeight:"500",children:["Currently viewing: ",b?"Workspace":"Chatbot"]}),(0,t.jsx)(m.x,{fontSize:"sm",color:"gray.800",fontWeight:"600",children:b?"Switch to Chatbot":"Switch to Workspace"})]}),(0,t.jsx)(x.J,{as:D.Rgz,color:"gray.500",boxSize:4})]})]}),(0,t.jsx)(k.R,{py:1}),!b&&eT&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.x,{fontSize:"xs",fontWeight:"medium",color:"gray.600",px:1,mb:1,children:"Account"}),(0,t.jsx)(en,{size:"sm",imageUrl:null!==(u=null==M?void 0:null===(r=M.user)||void 0===r?void 0:r.image)&&void 0!==u?u:s.rD,name:M.user.name||M.user.email||"",tag1:"".concat(ee(M.user.subscriptionType)," plan"),tag2:M.user.email,onClick:()=>ey(null)})]}),!b&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.x,{fontSize:"xs",fontWeight:"medium",color:"gray.600",px:1,mb:1,children:"Teams"}),null==J?void 0:J.map(e=>(0,t.jsx)(en,{size:"sm",imageUrl:e.imageUrl,icon:e.imageUrl?void 0:(0,t.jsx)(D.ggF,{size:16}),name:e.name,tag1:"".concat(e.members.length," member").concat(e.members.length>1?"s":""),tag2:"".concat(ee(e.owner.subscriptionType)),isActive:ek===e.id,onClick:ek===e.id?void 0:()=>ey(e.id)},e.id)),(0,t.jsxs)(p.k,{alignItems:"center",gap:3,px:2,py:2,borderRadius:"md",cursor:"pointer",_hover:{bg:"gray.50"},onClick:()=>{eC?ec():Q(!0)},children:[(0,t.jsx)(p.k,{w:"32px",justify:"center",flexShrink:0,children:(0,t.jsx)(h.d,{boxSize:"14px",color:"brand.500"})}),(0,t.jsx)(m.x,{fontSize:"sm",color:"brand.500",fontWeight:"500",flex:1,children:"New team"}),(0,l.N7)("ACCOUNT_WORKSPACE_TEAM",null==M?void 0:null===(a=M.user)||void 0===a?void 0:a.subscriptionType)&&(0,t.jsxs)(T.Vp,{size:"sm",bg:"purple.100",color:"purple.700",fontWeight:"medium",children:[(0,l.Vo)("ACCOUNT_WORKSPACE_TEAM"),"+"]})]})]}),b&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m.x,{fontSize:"xs",fontWeight:"medium",color:"gray.600",px:1,mb:1,children:"Workspaces"}),ei.map(e=>(0,t.jsx)(en,{size:"sm",icon:(0,t.jsx)(D.aCJ,{size:16}),name:e.name,tag1:"".concat(e.members.length," member").concat(e.members.length>1?"s":""),isActive:(null==et?void 0:et.id)===e.id,onClick:(null==et?void 0:et.id)===e.id?void 0:()=>{eo(e.id),window.location.href="/workspace-v2"}},e.id)),(0,t.jsxs)(p.k,{alignItems:"center",gap:3,px:2,py:2,borderRadius:"md",cursor:"pointer",_hover:{bg:"gray.50"},onClick:()=>q.push("/workspace-v2?createWorkspace=1"),children:[(0,t.jsx)(p.k,{w:"32px",justify:"center",flexShrink:0,children:(0,t.jsx)(h.d,{boxSize:"14px",color:"brand.500"})}),(0,t.jsx)(m.x,{fontSize:"sm",color:"brand.500",fontWeight:"500",flex:1,children:"New workspace"})]})]}),!b&&eb&&eb.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(k.R,{py:1}),(0,t.jsx)(m.x,{fontSize:"xs",fontWeight:"medium",color:"gray.600",px:1,mb:1,children:"Team invitations"}),eb.map(e=>{var n;return(0,t.jsxs)(C.U,{px:2,py:2,spacing:3,children:[(null===(n=e.workspace)||void 0===n?void 0:n.imageUrl)?(0,t.jsx)(g.q,{h:"32px",w:"32px",src:e.workspace.imageUrl,name:e.workspace.name}):(0,t.jsx)(p.k,{h:"32px",w:"32px",borderRadius:"full",bg:"gray.200",align:"center",justify:"center",flexShrink:0,children:(0,t.jsx)(D.ggF,{size:16,color:"#4A5568"})}),(0,t.jsx)(m.x,{fontSize:"sm",color:"gray.800",fontWeight:"500",flex:1,noOfLines:1,children:e.workspace.name}),(0,t.jsxs)(C.U,{spacing:1,children:[(0,t.jsx)(O.h,{size:"xs","aria-label":"Accept invitation",icon:(0,t.jsx)(D.UgA,{}),colorScheme:"green",onClick:()=>eS(e.id)}),(0,t.jsx)(O.h,{size:"xs","aria-label":"Reject invitation",icon:(0,t.jsx)(D.q5L,{}),colorScheme:"red",onClick:()=>e_(e.id)})]})]},e.id)})]}),(0,t.jsx)(k.R,{}),(0,t.jsx)(p.k,{px:2,py:2,borderRadius:"md",cursor:"pointer",_hover:{bg:"gray.100"},onClick:()=>(0,I.signOut)({callbackUrl:"".concat(window.location.origin,"?authState=signedOut")}),children:(0,t.jsx)(m.x,{fontSize:"sm",color:"gray.600",fontWeight:"500",children:"Log out"})})]})})})()]}),(0,t.jsx)($.D,{isOpen:eu,onClose:ep}),(0,t.jsx)(z.b,{chatbotMode:"variable",isOpen:eg,onClose:ex,onSuccess:()=>{H({title:"Invitation sent",status:"success",duration:3e3,isClosable:!0})}}),(0,t.jsx)(X,{isOpen:G,onClose:()=>Q(!1),onSuccess:()=>{K()}}),(0,t.jsx)(W.C,{isOpen:el,onClose:ed})]}):null}},38782:function(e,n,i){i.d(n,{L:function(){return ee},Z:function(){return K}});var t=i(85893),o=i(20967),r=i(57747),a=i(55083),s=i(85335),l=i(35541),c=i(83589),d=i(14581),u=i(93717),h=i(33090),p=i(3949),g=i(75141),m=i(71293),x=i(24880),b=i(5460),f=i(89993),v=i(36948),j=i(66712),w=i(91170),y=i(1702),S=i(4040),_=i(74970),C=i(62658),k=i(64859),T=i(66205),O=i(54346),E=i(14253),I=i(93108),R=i(32568),A=i(45161),D=i(41664),z=i.n(D),W=i(67294),N=i(34052),L=i(64141),P=i(73209),U=i(59007),F=i(12903),M=i(48583),B=i(33299),q=i(11163),H=i(2914),Y=i(94050),G=i(18151),Q=i(93358);let J=["/agents/settings"];function K(e){var n,i,l,c;let{children:d}=e,{isOpen:u,onOpen:h,onClose:p}=(0,o.q)(),g=(0,M.Dv)(L.R7),m=(0,q.useRouter)(),x=(0,B.useSession)(),b=J.some(e=>m.pathname.startsWith(e)),f=!b&&((null===(i=x.data)||void 0===i?void 0:null===(n=i.user)||void 0===n?void 0:n.highestGoogleWorksp
1aceType)!=="USER"||"NONE"!==x.data.user.subscriptionType);return(0,t.jsxs)(r.xu,{h:"full",children:[f&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(V,{onClose:p,display:{base:"none",md:"flex"}}),(0,t.jsx)(a.d,{autoFocus:!1,isOpen:u,placement:"left",onClose:p,returnFocusOnClose:!1,onOverlayClick:p,size:"full",children:(0,t.jsx)(s.s,{backgroundColor:"blue",children:(0,t.jsx)(V,{onClose:p})})}),(0,t.jsx)(en,{display:{base:"flex",md:"none"},onOpen:h})]}),(0,t.jsx)(r.xu,{ml:{base:0,md:b||(null===(c=x.data)||void 0===c?void 0:null===(l=c.user)||void 0===l?void 0:l.highestGoogleWorkspaceType)==="USER"&&"NONE"===x.data.user.subscriptionType?0:g?20:60},h:"full",children:d})]})}function Z(e){var n,i;let{isOpen:o,onClose:a}=e,[s,x]=(0,W.useState)(""),b=(0,q.useRouter)(),{activeWorkspace:f}=(0,P.cF)(),{data:v}=U.S.internalWorkspaces.getRecentChatlogs.useQuery({workspaceId:null!==(n=null==f?void 0:f.id)&&void 0!==n?n:"",limit:50},{enabled:!!(null==f?void 0:f.id)&&o}),{data:j}=U.S.internalWorkspaces.searchChatlogs.useQuery({workspaceId:null!==(i=null==f?void 0:f.id)&&void 0!==i?i:"",query:s},{enabled:!!(null==f?void 0:f.id)&&s.trim().length>0}),w=s.trim().length>0,y=e=>{b.push("/workspace-v2/chat/".concat(e)),a(),x("")},S=v?(e=>{let n=new Date,i=new Date(n.getFullYear(),n.getMonth(),n.getDate()),t=new Date(i.getTime()-864e5),o=[],r=e.filter(e=>new Date(e.updatedAt)>=i),a=e.filter(e=>{let n=new Date(e.updatedAt);return n>=t&&n<i}),s=e.filter(e=>new Date(e.updatedAt)<t);return r.length>0&&o.push({label:"Today",chats:r}),a.length>0&&o.push({label:"Yesterday",chats:a}),s.length>0&&o.push({label:"Earlier",chats:s}),o})(v):[];return(0,t.jsxs)(l.u_,{isOpen:o,onClose:a,size:"lg",children:[(0,t.jsx)(c.Z,{}),(0,t.jsxs)(d.h,{borderRadius:"xl",overflow:"hidden",children:[(0,t.jsxs)(u.k,{align:"center",px:5,pt:4,pb:2,gap:3,children:[(0,t.jsx)(h.I,{placeholder:"Search chat",variant:"unstyled",fontSize:"md",value:s,onChange:e=>x(e.target.value),autoFocus:!0}),(0,t.jsx)(p.P,{size:"sm",onClick:a})]}),(0,t.jsxs)(r.xu,{maxH:"400px",overflowY:"auto",px:2,pb:4,children:[w&&j&&j.length>0&&(0,t.jsx)(t.Fragment,{children:j.map(e=>(0,t.jsxs)(u.k,{align:"center",gap:3,px:3,py:2.5,cursor:"pointer",borderRadius:"md",_hover:{bg:"gray.50"},onClick:()=>y(e.chatlogId),children:[(0,t.jsx)(g.q,{size:"xs",name:"C",bg:"orange.400",color:"white"}),(0,t.jsxs)(r.xu,{flex:1,minW:0,children:[(0,t.jsx)(m.x,{fontSize:"sm",color:"gray.800",noOfLines:1,children:e.chatlogTitle||"Untitled chat"}),(0,t.jsx)(m.x,{fontSize:"xs",color:"gray.500",noOfLines:1,dangerouslySetInnerHTML:{__html:e.snippet.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/\[\[mark\]\]/g,"<mark>").replace(/\[\[\/mark\]\]/g,"</mark>")},sx:{mark:{bg:"yellow.200",borderRadius:"2px"}}})]})]},e.messageId))}),w&&j&&0===j.length&&(0,t.jsx)(m.x,{px:3,py:4,fontSize:"sm",color:"gray.400",textAlign:"center",children:"No chats found"}),!w&&S.map(e=>(0,t.jsxs)(r.xu,{children:[(0,t.jsx)(m.x,{fontSize:"xs",fontWeight:"medium",color:"gray.400",px:3,pt:3,pb:1,children:e.label}),e.chats.map(e=>{var n;return(0,t.jsxs)(u.k,{align:"center",gap:3,px:3,py:2.5,cursor:"pointer",borderRadius:"md",_hover:{bg:"gray.50"},onClick:()=>y(e.id),children:[(0,t.jsx)(g.q,{size:"xs",name:e.agent.name,src:null!==(n=e.agent.image)&&void 0!==n?n:void 0,bg:"orange.400",color:"white"}),(0,t.jsx)(m.x,{fontSize:"sm",color:"gray.800",noOfLines:1,children:e.title||"Untitled chat"})]},e.id)})]},e.label))]})]})]})}let V=e=>{var n,i,a,s,l,c,d,h,g,k,T,O,E,I,R,A,D;let{onClose:z,...J}=e,{data:K}=U.S.chat.getUnreadLiveChatCount.useQuery(),{data:V}=U.S.user.getUserFeatureFlags.useQuery(),{data:X}=U.S.chatlog.getTicketsCount.useQuery({}),en=(0,B.useSession)(),ei=(0,W.useContext)(F.Z),[et,eo]=(0,M.KO)(L.R7),[er,ea]=(0,M.KO)(L.hs),es="workspace"===er,el=(0,M.b9)(L.OA),ec=(0,o.q)(),ed=(0,q.useRouter)(),{workspaces:eu,activeWorkspace:eh,setActiveWorkspace:ep}=(0,P.cF)(),[eg,em]=(0,W.useState)(!1);(0,W.useEffect)(()=>{ed.pathname.startsWith("/workspace-v2")?ea("workspace"):ea("agents")},[ed.pathname,ea]),(0,W.useEffect)(()=>{"/"!==ed.pathname&&el(ed.pathname.startsWith("/workspace-v2")?"workspace":"agents")},[ed.pathname,el]),(0,W.useEffect)(()=>{K&&K>0&&(document.title="".concat(ei.name||"Wonderchat"," (").concat(K,")"))});let{data:ex,isLoading:eb}=U.S.corrections.getChatMessagesPendingCorrectionCount.useQuery(),ef=[...ei.isWhitelabelled&&ei.hideDashboardFromUsers&&(null===(i=en.data)||void 0===i?void 0:null===(n=i.user)||void 0===n?void 0:n.role)==="USER"?[]:[{name:"Dashboard",icon:N.m6D,href:"/dashboard"}],{name:"Chatbots",icon:H.iNY,href:"/agents"},{name:"Chatlogs",icon:N.EQ9,href:"/chatlogs"},{name:"Live Chats",icon:H.Ov7,href:"/escalated",extra:(0,t.jsx)(t.Fragment,{children:!!K&&(0,t.jsx)(x.C,{bgColor:"red.500",color:"white",borderRadius:"full",px:2,py:"1px",fontSize:"xs",fontWeight:"medium",children:K})})},{name:"Tickets",icon:N.Px5,href:"/tickets",extra:(0,t.jsx)(t.Fragment,{children:!!X&&(0,t.jsx)(x.C,{bgColor:"red.500",color:"white",borderRadius:"full",px:2,py:"1px",fontSize:"xs",fontWeight:"medium",children:X})})},{name:"Review",icon:N.bcx,href:"/review",hiddenSubscriptionTypes:["NONE"],extra:(0,t.jsx)(t.Fragment,{children:!!ex&&(0,t.jsx)(x.C,{color:"white",bgColor:"red.500",borderRadius:"full",px:2,py:"1px",fontSize:"xs",fontWeight:"medium",children:ex>=100?"99+":ex})})},{name:"Corrections",icon:N.Nte,href:"/corrections",hiddenSubscriptionTypes:["NONE"]},...(null==V?void 0:V.find(e=>"INBOX"===e.featureName))?[{name:"Inbox",icon:N.Imn,href:"/inbox"}]:[],{name:"Contacts",icon:N.tMu,href:"/contacts"},{name:"Analytics",icon:N.CFv,href:"/analytics"},{name:"Evaluation",icon:Y.oqb,href:"/evaluation"},...ei.isWhitelabelled||(null===(s=en.data)||void 0===s?void 0:null===(a=s.user)||void 0===a?void 0:a.howDidYouHearAboutUs)==="shopify_app"||(null===(l=en.data)||void 0===l?void 0:l.workspace)&&(null===(d=en.data)||void 0===d?void 0:null===(c=d.user)||void 0===c?void 0:c.id)!==(null===(g=en.data)||void 0===g?void 0:null===(h=g.workspace)||void 0===h?void 0:h.ownerId)?[]:[{name:"Subscription",icon:N.XiQ,href:"/subscription"}],{name:"Settings",icon:N.nbt,href:"/settings"},...(null==en?void 0:null===(k=en.data)||void 0===k?void 0:k.workspace)?[{name:"Team",icon:N.ggF,href:"/workspace"}]:[],...(null===(O=en.data)||void 0===O?void 0:null===(T=O.user)||void 0===T?void 0:T.role)==="ADMIN"?[{name:"Admin",icon:N.tMu,href:"/admin-panel"}]:[],...(null===(I=en.data)||void 0===I?void 0:null===(E=I.user)||void 0===E?void 0:E.role)==="WHITELABEL_ADMIN"||(null===(A=en.data)||void 0===A?void 0:null===(R=A.user)||void 0===R?void 0:R.role)==="ADMIN"?[{name:"Whitelabel",icon:N.E25,href:"/whitelabel/dashboard"}]:[]];return(0,t.jsxs)(u.k,{w:{base:"full",md:et?20:60},pos:"fixed",h:"full",bgColor:"rgb(248, 249, 250)",color:"#404968",flexDirection:"column",justifyContent:"space-between",alignItems:"stretch",overflow:"hidden",p:4,gap:es?2:4,...J,borderRight:"1px solid",borderColor:"gray.200",children:[(0,t.jsxs)(u.k,{alignItems:"center",justifyContent:et?"center":"space-between",shrink:0,h:"10",px:et?0:2,gap:"1",children:[(0,t.jsx)(b.E,{display:{base:"flex",md:et?"none":"flex"},src:ei.isWhitelabelled?et?ei.logo:ei.nameLogo||ei.logo:et?"/logo.png":"/logo-name-new.png",alt:ei.isWhitelabelled?ei.name:"Wonderchat logo",h:"full",flex:1,minW:0,objectFit:"contain",objectPosition:"left"}),(0,t.jsx)(f.h,{variant:"ghost",size:"xs","aria-label":"collapse",display:{base:"none",md:"flex"},onClick:()=>eo(e=>!e),icon:(0,t.jsx)(v.J,{as:N.iYc,boxSize:"5",color:"gray.500"})}),(0,t.jsx)(p.P,{display:{base:"flex",md:"none"},onClick:z})]}),!et&&"workspace"===er&&eu.length>0&&(0,t.jsxs)(j.v,{children:[(0,t.jsx)(w.j,{as:r.xu,cursor:"pointer",px:3,py:2,borderRadius:"md",_hover:{bg:"gray.100"},flexShrink:0,children:(0,t.jsxs)(u.k,{align:"center",justify:"space-between",children:[(0,t.jsx)(m.x,{fontSize:"sm",fontWeight:"semibold",color:"gray.700",noOfLines:1,children:null!==(D=null==eh?void 0:eh.name)&&void 0!==D?D:"My Workspace"}),(0,t.jsx)(v.J,{as:N.bTu,boxSize:3.5,color:"gray.400",ml:2,flexShrink:0})]})}),(0,t.jsx)(y.h,{children:(0,t.jsxs)(S.q,{minW:"220px",fontSize:"sm",zIndex:"popover",children:[eu.map(e=>(0,t.jsx)(_.s,{onClick:()=>{ep(e.id),ed.push("/workspace-v2")},fontWeight:e.id===(null==eh?void 0:eh.id)?"semibold":"normal",icon:e.id===(null==eh?void 0:eh.id)?(0,t.jsx)(v.J,{as:N.UgA,boxSize:3.5,color:"brand.500"}):(0,t.jsx)(r.xu,{boxSize:3.5}),children:e.name},e.id)),(0,t.jsx)(C.R,{}),(0,t.jsx)(_.s,{onClick:()=>em(!0),icon:(0,t.jsx)(v.J,{as:N.OvN,boxSize:3.5,color:"gray.500"}),color:"gray.700",children:"Create new workspace"})]})})]}),eg&&(0,t.jsx)(y.h,{children:(0,t.jsx)(Q._F,{onClose:()=>em(!1)})}),(0,t.jsx)(u.k,{flexDirection:"column",flex:1,minH:0,overflow:"hidden",children:"agents"===er?(0,t.jsx)(r.xu,{overflowY:"auto",overflowX:"hidden",flex:1,minH:0,children:ef.map(e=>(0,t.jsxs)(ee,{href:e.href,icon:e.icon,isCollapsed:et,onClose:z,children:[e.name,e.extra&&e.extra]},e.name))}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(r.xu,{flexShrink:0,children:[(0,t.jsx)(ee,{href:"/workspace-v2",icon:N.OvN,isCollapsed:et,onClose:z,compact:!0,children:"New chat"}),(0,t.jsx)(ee,{icon:N.jRj,isCollapsed:et,onClick:ec.onOpen,compact:!0,children:"Search Chat"}),(0,t.jsx)(ee,{href:"/workspace-v2/knowledge",icon:N.yK7,isCollapsed:et,onClose:z,compact:!0,children:"Knowledge library"}),(0,t.jsx)(ee,{href:"/workspace-v2/agents",icon:H.iNY,isCollapsed:et,onClose:z,compact:!0,children:"Agents"}),(0,t.jsx)(ee,{href:"/workspace-v2/commands",icon:N.cDN,isCollapsed:et,onClose:z,compact:!0,children:"Commands"}),(0,t.jsx)(ee,{href:"/workspace-v2/review",icon:N.ND7,isCollapsed:et,onClose:z,compact:!0,children:"Review"}),(0,t.jsx)(ee,{href:"/workspace-v2/analytics",icon:N.CFv,isCollapsed:et,onClose:z,compact:!0,children:"Analytics"}),(0,t.jsx)(ee,{href:"/workspace-v2/team",icon:N.WY8,isCollapsed:et,onClose:z,compact:!0,children:"Team"}),(0,t.jsx)(ee,{href:"/workspace-v2/integrations",icon:N.XKb,isCollapsed:et,onClose:z,compact:!0,children:"Integrations"})]}),!et&&(0,t.jsx)(r.xu,{flex:1,minH:0,overflowY:"auto",overflowX:"hidden",sx:{"&::-webkit-scrollbar":{width:"4px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{background:"rgba(0,0,0,0.15)",borderRadius:"4px"}},children:(0,t.jsx)($,{isCollapsed:et,onClose:z})})]})}),(0,t.jsx)(u.k,{flexDir:"column",shrink:0,children:ei.isWhitelabelled?(0,t.jsx)(ee,{href:"mailto:".concat(ei.supportEmail),icon:N.cZY,isCollapsed:et,newTab:!0,compact:es,children:"Contact Support"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(G.Z,{type:"SUPPORT",isCollapsed:et,compact:es}),(0,t.jsx)(ee,{isCollapsed:et,href:"https://docs.wonderchat.io",icon:N.NOg,newTab:!0,compact:es,children:"Documentation"}),(0,t.jsx)(r.xu,{display:{base:"block",md:"none"},children:(0,t.jsx)(ee,{isCollapsed:et,href:"https://wonderchat.featurebase.app/dashboard/changelog",icon:N.yK7,newTab:!0,compact:es,children:"Changelog"})})]})}),(0,t.jsx)(Z,{isOpen:ec.isOpen,onClose:ec.onClose})]})},X=["Knowledge Assistant"],$=e=>{var n;let{isCollapsed:i,onClose:o}=e,a=(0,q.useRouter)(),s=U.S.useUtils(),{activeWorkspace:h}=(0,P.cF)(),{data:p}=U.S.internalWorkspaces.getRecentChatlogs.useQuery({workspaceId:null!==(n=null==h?void 0:h.id)&&void 0!==n?n:"",limit:30},{enabled:!!(null==h?void 0:h.id)}),x=U.S.internalWorkspaces.togglePinChatlog.useMutation({onSuccess:()=>s.internalWorkspaces.getRecentChatlogs.invalidate()}),b=U.S.internalWorkspaces.deleteChatlog.useMutation({onSuccess:(e,n)=>{s.internalWorkspaces.getRecentChatlogs.invalidate(),a.asPath==="/workspace-v2/chat/".concat(n.chatlogId)&&a.push("/workspace-v2")}}),[C,R]=(0,W.useState)(null),A=e=>{var n;if(!e.isPinned){if(X.includes(e.agent.name))return;return(0,t.jsx)(g.q,{size:"2xs",name:e.agent.name,src:null!==(n=e.agent.image)&&void 0!==n?n:void 0,boxSize:5})}};if(!p||0===p.length)return null;let D=p.filter(e=>e.isPinned),z=p.filter(e=>!e.isPinned),L=e=>{let n=A(e);return(0,t.jsxs)(u.k,{role:"group",align:"center",position:"relative",children:[(0,t.jsx)(r.xu,{flex:1,minW:0,children:(0,t.jsx)(ee,{href:"/workspace-v2/chat/".concat(e.id),icon:e.isPinned?N.i63:N.EQ9,leftElement:n,isCollapsed:i,onClose:o,compact:!0,children:(0,t.jsx)(m.x,{noOfLines:1,title:e.title||"Untitled chat",flex:1,_groupHover:{pr:5},transition:"padding 0.1s",children:e.title||"Untitled chat"})})}),!i&&(0,t.jsx)(r.xu,{position:"absolute",right:3,top:"50%",transform:"translateY(-50%)",opacity:0,_groupHover:{opacity:1},transition:"opacity 0.15s",bg:"transparent",children:(0,t.jsxs)(j.v,{placement:"bottom-end",children:[(0,t.jsx)(w.j,{as:f.h,"aria-label":"Chat options",icon:(0,t.jsx)(v.J,{as:N.K9M,boxSize:4}),variant:"ghost",size:"xs",color:"gray.500",_hover:{color:"gray.700"},onClick:e=>{e.stopPropagation()}}),(0,t.jsx)(y.h,{children:(0,t.jsxs)(S.q,{minW:"140px",fontSize:"sm",zIndex:"popover",children:[(0,t.jsx)(_.s,{icon:(0,t.jsx)(v.J,{as:N.i63,boxSize:3.5}),onClick:n=>{n.preventDefault(),n.stopPropagation(),x.mutate({chatlogId:e.id})},children:e.isPinned?"Unpin":"Pin"}),(0,t.jsx)(_.s,{icon:(0,t.jsx)(v.J,{as:N.Ybf,boxSize:3.5}),color:"red.500",onClick:n=>{n.preventDefault(),n.stopPropagation(),R({id:e.id,title:e.title||"Untitled chat"})},children:"Delete"})]})})]})})]},e.id)};return(0,t.jsxs)(t.Fragment,{children:[D.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(u.k,{px:3,mt:3,mb:1,alignItems:"center",children:[(0,t.jsx)(r.xu,{fontSize:"xs",fontWeight:"semibold",color:"gray.400",textTransform:"uppercase",letterSpacing:"wider",children:"Pinned"}),(0,t.jsx)(r.xu,{flex:1,h:"1px",bg:"gray.200",ml:2})]}),D.map(L)]}),z.length>0&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(u.k,{px:3,pt:3,pb:1,alignItems:"center",position:"sticky",top:0,zIndex:1,bg:"rgb(248, 249, 250)",children:[(0,t.jsx)(r.xu,{fontSize:"xs",fontWeight:"semibold",color:"gray.400",textTransform:"uppercase",letterSpacing:"wider",children:"Recents"}),(0,t.jsx)(r.xu,{flex:1,h:"1px",bg:"gray.200",ml:2})]}),z.map(L)]}),(0,t.jsxs)(l.u_,{isOpen:!!C,onClose:()=>R(null),size:"sm",isCentered:!0,children:[(0,t.jsx)(c.Z,{}),(0,t.jsxs)(d.h,{children:[(0,t.jsx)(k.x,{fontSize:"md",children:"Delete chat"}),(0,t.jsx)(T.o,{}),(0,t.jsx)(O.f,{children:(0,t.jsxs)(m.x,{fontSize:"sm",color:"gray.600",children:["Are you sure you want to permanently delete ",(0,t.jsx)(m.x,{as:"span",fontWeight:"semibold",children:null==C?void 0:C.title}),"? This action cannot be undone."]})}),(0,t.jsxs)(E.m,{gap:2,children:[(0,t.jsx)(I.z,{size:"sm",variant:"ghost",onClick:()=>R(null),children:"Cancel"}),(0,t.jsx)(I.z,{size:"sm",colorScheme:"red",isLoading:b.isLoading,onClick:()=>{C&&b.mutate({chatlogId:C.id},{onSuccess:()=>R(null)})},children:"Delete"})]})]})]})]})},ee=e=>{let{href:n,icon:i,children:o,newTab:r,isCollapsed:a,onClick:s,onClose:l,leftElement:c,compact:d,...h}=e,p=(0,q.useRouter)(),g=!!(n&&(n.includes("/chat/")||"/workspace-v2"
1===n?p.asPath.split("?")[0]===n:p.asPath.startsWith(n))),m=(0,t.jsx)(R.u,{padding:2,label:a?o:void 0,placement:"right",openDelay:150,children:(0,t.jsx)(u.k,{align:"center",justify:"space-between",h:d?"36px":"44px",py:"2px",overflow:"hidden",alignItems:"center",justifyContent:"center",children:(0,t.jsxs)(u.k,{align:"center",gap:2,flex:1,px:3,py:d?1.5:2,borderRadius:"md",role:"group",cursor:"pointer",_hover:{bg:"brand.25"},fontSize:"sm",fontWeight:"medium",color:g?"brand.500":"#404968",...h,children:[c?(0,t.jsx)(u.k,{align:"center",pr:"2px",shrink:0,children:c}):i?(0,t.jsx)(u.k,{align:"center",pr:"2px",shrink:0,children:(0,t.jsx)(v.J,{boxSize:5,as:i})}):null,(0,t.jsx)(u.k,{as:"span",display:{base:"flex",md:a?"none":"flex"},alignItems:"center",gap:2,flex:1,justify:"space-between",children:o})]})})});return n?(0,t.jsx)(z(),{href:n,style:{textDecoration:"none"},...r&&{target:"_blank"},onClick:l,children:m}):(0,t.jsx)(I.z,{variant:"unstyled",fontWeight:"normal",textDecoration:"none",onClick:s,h:"fit-content",w:"full",children:m})},en=e=>{let{onOpen:n,...i}=e,o=(0,W.useContext)(F.Z);return(0,t.jsxs)(u.k,{ml:{base:0,md:60},px:{base:4,md:24},height:"16",alignItems:"center",bg:(0,A.ff)("white","gray.900"),borderBottomWidth:"1px",borderBottomColor:(0,A.ff)("gray.200","gray.700"),justifyContent:"flex-start",...i,children:[(0,t.jsx)(f.h,{variant:"outline",onClick:n,"aria-label":"open menu",icon:(0,t.jsx)(N.cur,{})}),(0,t.jsx)(b.E,{p:"3",h:"full",ml:"4",src:o.isWhitelabelled?o.nameLogo||o.logo:"/logo-name-new.png",alt:o.isWhitelabelled?o.name:"Wonderchat logo"})]})}},18151:function(e,n,i){i.d(n,{Z:function(){return z}});var t=i(85893),o=i(10679),r=i(81399),a=i(59007),s=i(20967),l=i(7963),c=i(93108),d=i(35541),u=i(83589),h=i(14581),p=i(64859),g=i(66205),m=i(54346),x=i(48783),b=i(85970),f=i(5418),v=i(33090),j=i(41731),w=i(57747),y=i(71293),S=i(32883),_=i(34292),C=i(57169),k=i(89993),T=i(14253),O=i(81136),E=i(33299),I=i(11163),R=i(67294),A=i(34052),D=i(38782);function z(e){var n,i,O,z;let{isCollapsed:W=!1,type:L="SUPPORT",compact:P=!1}=e,{data:U}=(0,E.useSession)(),{data:F}=a.S.chatbot.getChatbotsBasicInfo.useQuery(),{isOpen:M,onOpen:B,onClose:q}=(0,s.q)(),[H,Y]=(0,R.useState)(null!==(O=null==U?void 0:null===(n=U.user)||void 0===n?void 0:n.email)&&void 0!==O?O:""),[G,Q]=(0,R.useState)(null!==(z=null==U?void 0:null===(i=U.user)||void 0===i?void 0:i.name)&&void 0!==z?z:""),[J,K]=(0,R.useState)(""),[Z,V]=(0,R.useState)("Bug Report"),[X,$]=(0,R.useState)("Low"),[ee,en]=(0,R.useState)(""),[ei,et]=(0,R.useState)(""),[eo,er]=(0,R.useState)([]),[ea,es]=(0,R.useState)([]),el=(0,l.p)();(0,I.useRouter)();let ec=a.S.support.submitSupportTicket.useMutation({onSuccess:()=>{el({title:"Support ticket submitted",description:"We'll get back to you soon.",status:"success",duration:5e3,isClosable:!0}),eh()},onError:e=>{console.error("Error submitting support ticket:",e),el({title:"Error submitting support ticket",description:"Please try again later.",status:"error",duration:5e3,isClosable:!0})}}),ed=a.S.support.submitSalesTicket.useMutation({onSuccess:()=>{el({title:"Enterprise sales inquiry submitted",description:"We'll get back to you soon.",status:"success",duration:5e3,isClosable:!0}),eh()},onError:e=>{console.error("Error submitting sales ticket:",e),el({title:"Error submitting sales ticket",description:"Please try again later.",status:"error",duration:5e3,isClosable:!0})}}),eu=()=>{K(""),V("Bug Report"),$("Low"),en(""),et(""),er([]),es([])},eh=()=>{eu(),q()},ep=eo.map(e=>e.trim()).filter(e=>""!==e),eg=""!==ee.trim()&&""!==ei.trim()&&("SALES"===L||""!==J)&&("Poor Chatbot Performance"!==Z||ep.length>0);return(0,t.jsxs)(t.Fragment,{children:["SUPPORT"===L&&(0,t.jsx)(D.L,{isCollapsed:W,icon:A.Imn,onClick:B,compact:P,children:"Contact Support"}),"SALES"===L&&(0,t.jsx)(c.z,{colorScheme:"brand",onClick:B,children:"Contact Sales"}),(0,t.jsxs)(d.u_,{isOpen:M,onClose:eh,size:"xl",children:[(0,t.jsx)(u.Z,{}),(0,t.jsxs)(h.h,{children:[(0,t.jsx)(p.x,{children:"SUPPORT"===L?"Submit a case to our Customer Support Team":"Contact Sales"}),(0,t.jsx)(g.o,{}),(0,t.jsx)(m.f,{children:(0,t.jsxs)(x.g,{spacing:4,align:"stretch",children:[(0,t.jsxs)(b.NI,{children:[(0,t.jsx)(f.l,{children:"Email"}),(0,t.jsx)(v.I,{value:H,onChange:e=>Y(e.target.value),isDisabled:!0})]}),"SUPPORT"===L&&(0,t.jsxs)(b.NI,{isRequired:!0,children:[(0,t.jsx)(f.l,{children:"Related Chatbot"}),(0,t.jsx)(j.P,{value:J,onChange:e=>K(e.target.value),placeholder:"Select a Chatbot...",children:null==F?void 0:F.map(e=>(0,t.jsx)("option",{value:e.id,children:e.name},e.id))})]}),(0,t.jsxs)(t.Fragment,{children:["SUPPORT"===L&&(0,t.jsxs)(b.NI,{children:[(0,t.jsx)(f.l,{children:"Selected Problem"}),(0,t.jsxs)(j.P,{value:Z,onChange:e=>V(e.target.value),children:[(0,t.jsx)("option",{value:"Bug Report",children:"Bug Report"}),(0,t.jsx)("option",{value:"Chatbot Setup",children:"Chatbot Setup"}),(0,t.jsx)("option",{value:"Poor Chatbot Performance",children:"Poor Chatbot Performance"}),(0,t.jsx)("option",{value:"Feedback",children:"Feedback"}),(0,t.jsx)("option",{value:"Feature Request",children:"Feature Request"}),(0,t.jsx)("option",{value:"Sales Inquiry",children:"Sales Inquiry"}),(0,t.jsx)("option",{value:"Delete Account",children:"Delete Account"}),(0,t.jsx)("option",{value:"Others",children:"Others"})]})]}),"Delete Account"===Z?(0,t.jsxs)(w.xu,{p:4,bg:"gray.50",borderRadius:"md",children:[(0,t.jsx)(y.x,{mb:3,children:"You can delete your account in the settings page. Click the link below to go there:"}),(0,t.jsx)(S.r,{href:"".concat(o.O.NEXT_PUBLIC_APP_BASE_URL,"/settings"),color:"brand.500",fontWeight:"medium",_hover:{textDecoration:"underline"},children:"Go to Settings Page →"})]}):(0,t.jsxs)(t.Fragment,{children:["SUPPORT"===L&&(0,t.jsx)(_.U,{children:(0,t.jsxs)(b.NI,{children:[(0,t.jsx)(f.l,{children:"Selected Severity"}),(0,t.jsxs)(j.P,{value:X,onChange:e=>$(e.target.value),children:[(0,t.jsx)("option",{value:"Low",children:"Low"}),(0,t.jsx)("option",{value:"Medium",children:"Medium"}),(0,t.jsx)("option",{value:"High",children:"High"})]})]})}),(0,t.jsxs)(b.NI,{isRequired:!0,children:[(0,t.jsx)(f.l,{children:"Subject"}),(0,t.jsx)(v.I,{value:ee,onChange:e=>en(e.target.value),..."SALES"===L&&{placeholder:"Enterprise sales inquiry"}})]}),(0,t.jsxs)(b.NI,{isRequired:!0,children:[(0,t.jsx)(f.l,{children:"Description"}),(0,t.jsx)(C.g,{value:ei,onChange:e=>et(e.target.value),placeholder:"Please include all information relevant to your issue. ".concat("Poor Chatbot Performance"===Z?"\n\nFor poor chatbot performance, please include specific examples where the chatbot answered incorrectly, and the location in your knowledge base where the correct information can be found":""),rows:5})]}),"SUPPORT"===L&&(0,t.jsxs)(b.NI,{isRequired:"Poor Chatbot Performance"===Z,children:[(0,t.jsx)(f.l,{children:"Relevant chat log IDs"}),(0,t.jsxs)(x.g,{spacing:2,align:"stretch",children:[eo.map((e,n)=>(0,t.jsxs)(_.U,{children:[(0,t.jsx)(v.I,{value:e,placeholder:"e.g. clx1a2b3c4d5e6",onChange:e=>er(eo.map((i,t)=>t===n?e.target.value:i))}),(0,t.jsx)(k.h,{"aria-label":"Remove chat log ID",icon:(0,t.jsx)(A.Ybf,{}),variant:"ghost",onClick:()=>er(eo.filter((e,i)=>i!==n))})]},n)),(0,t.jsx)(c.z,{size:"sm",variant:"outline",leftIcon:(0,t.jsx)(A.OvN,{}
1),alignSelf:"flex-start",onClick:()=>er([...eo,""]),children:"Add chat log ID"})]}),(0,t.jsx)(b.Q6,{children:"Poor Chatbot Performance"===Z?"Please add the chat logs where the bot underperformed. Sharing them lets our team reproduce and fix the issue much faster. You'll find each ID in your Chat Logs dashboard.":"Linking the chat logs related to your issue helps our team debug it much faster. You'll find each ID in your Chat Logs dashboard."})]}),(0,t.jsxs)(b.NI,{children:[(0,t.jsx)(f.l,{children:"Attachments"}),(0,t.jsxs)(_.U,{spacing:2,wrap:"wrap",children:[ea.map((e,n)=>(0,t.jsx)(c.z,{size:"sm",variant:"outline",leftIcon:(0,t.jsx)(A.UH,{}),onClick:()=>window.open(e.url),children:e.name},n)),(0,t.jsx)(N,{onUpload:(e,n)=>{es([...ea,{url:e,name:n}])},isDisabled:ea.length>=5})]})]})]})]})]})}),(0,t.jsxs)(T.m,{children:[(0,t.jsx)(c.z,{variant:"ghost",mr:3,onClick:eh,children:"Delete Account"===Z?"Close":"Cancel"}),"Delete Account"!==Z&&(0,t.jsx)(c.z,{colorScheme:"brand",onClick:()=>{var e,n,i;if(eg){if("SALES"===L){try{null===(e=dataLayer)||void 0===e||e.push({event:"book_a_demo_clicked"}),(0,r.FZ)(r.KW.bookDemoEnterprise,{email:null==U?void 0:null===(n=U.user)||void 0===n?void 0:n.email,lead_type:"enterprise"})}catch(e){console.log(e)}ed.mutate({subject:ee,description:ei})}else"SUPPORT"===L&&"Delete Account"!==Z&&ec.mutate({email:H,name:G,chatbotId:J,chatbotName:(null==F?void 0:null===(i=F.find(e=>e.id===J))||void 0===i?void 0:i.name)||"",problem:Z,severity:X,subject:ee,description:ei,relevantChatlogIds:ep,attachments:ea.map(e=>e.url)})}},isLoading:ec.isLoading||ed.isLoading,isDisabled:!eg,children:"Submit"})]})]})]})]})}let W=async e=>{try{let n=await e.json();return(null==n?void 0:n.msg)||(null==n?void 0:n.status)||"Upload failed"}catch(e){return"Upload failed"}};function N(e){let{onUpload:n,title:i,size:o="sm",isDisabled:r,...a}=e,s=(0,R.useRef)(null),d=(0,l.p)(),[u,h]=(0,R.useState)(!1),p=async e=>{var i;let t=null===(i=e.target.files)||void 0===i?void 0:i[0];if(!t)return;h(!0);let o=new FormData;o.append("file",t);let r=t.type.startsWith("image")?"/api/upload-photo":"/api/upload-video";try{let e=await fetch(r,{method:"POST",body:o});if(!e.ok)throw Error(await W(e));let i=await e.json();if(!(null==i?void 0:i.url))throw Error("Upload completed without a file URL");n(i.url,t.name),d({title:"File uploaded successfully",status:"success",duration:3e3,isClosable:!0})}catch(e){console.error("Upload error:",e),d({title:"Upload failed",description:e instanceof Error?e.message:"Please try again.",status:"error",duration:3e3,isClosable:!0})}finally{h(!1)}};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("input",{type:"file",ref:s,onChange:p,accept:"image/*,video/*",style:{display:"none"}}),(0,t.jsx)(c.z,{...a,size:o,leftIcon:u?(0,t.jsx)(O.$,{size:"sm"}):(0,t.jsx)(A.UH,{}),variant:"outline",onClick:()=>{var e;return null===(e=s.current)||void 0===e?void 0:e.click()},isLoading:u,loadingText:"Uploading...",isDisabled:u||r,children:u?(0,t.jsx)(O.$,{}):"Add Attachment"})]})}},68693:function(e,n,i){i.d(n,{Z:function(){return I}});var t=i(85893),o=i(19875),r=i(47583),a=i(84790),s=i(90273),l=i(35796),c=i(35541),d=i(83589),u=i(14581),h=i(66205),p=i(57747),g=i(34292),m=i(93717),x=i(5460),b=i(48783),f=i(71293),v=i(49289),j=i(93108),w=i(36948),y=i(33299),S=i(58192),_=i(67294),C=i(34052);let k=["BASIC","TURBO"],T=(e,n)=>{let i=new URLSearchParams({utm_source:"trial_variant_booking"});return e&&i.set("utm_content",e),n&&i.set("salesforce_uuid",n),"".concat("https://calendly.com/marlene-wonderchat/30min","?").concat(i.toString())},O={BASIC:"Basic",TURBO:"Turbo"},E={BASIC:[{icon:C.UgA,text:"5,000 msgs/mo"},{icon:C.wBW,text:"1,000 training pages"},{icon:C.Wqx,text:"Live Chat + HubSpot"}],TURBO:[{icon:C.UgA,text:"15,000 msgs/mo"},{icon:C.wBW,text:"3,000 training pages"},{icon:C.Wqx,text:"Voice Agent + Zendesk"}]},I=e=>{var n;let{isOpen:i,onClose:w,surface:E}=e,I=(0,y.useSession)(),W=(0,S.U0)(),N=(0,o.hJ)(),L=null===(n=I.data)||void 0===n?void 0:n.user,P=(0,l.S)({base:"full",md:"3xl"}),U=(0,_.useRef)(!1),[F,M]=(0,_.useState)("BASIC"),[B,q]=(0,_.useState)("monthly"),H="yearly"===B;(0,_.useEffect)(()=>
1{if(!i){U.current=!1;return}U.current||(U.current=!0,null==W||W.capture("upgrade_prompt_shown",{surface:E,prompt_type:"trial_opt_in_modal",trial_opt_in_variant:N}),null==W||W.capture("trial_opt_in_modal_shown",{surface:E}))},[i,W,E,N]);let Y=H?a.TM[F]:a.qH[F],G={surface:E,tier:F,interval:B,plan_id:Y};return(0,t.jsxs)(c.u_,{isOpen:i,onClose:()=>{null==W||W.capture("trial_opt_in_modal_dismissed",G),w()},size:P,isCentered:!0,scrollBehavior:"inside",children:[(0,t.jsx)(d.Z,{bg:"blackAlpha.600",backdropFilter:"blur(2px)"}),(0,t.jsxs)(u.h,{overflow:"hidden",borderRadius:"2xl",bg:"white",boxShadow:"0 24px 48px -12px rgba(15, 23, 42, 0.22)",children:[(0,t.jsx)(h.o,{top:2,right:2,color:"white",_hover:{bg:"whiteAlpha.200"},zIndex:2}),(0,t.jsxs)(p.xu,{position:"relative",bg:"#3658d8",color:"white",px:8,py:8,overflow:"hidden",children:[(0,t.jsx)(p.xu,{position:"absolute",inset:0,pointerEvents:"none",backgroundImage:"radial-gradient(circle at 12% 10%, rgba(134,155,232,0.5), transparent 45%), radial-gradient(circle at 88% 90%, rgba(134,155,232,0.45), transparent 50%), radial-gradient(circle at 70% 20%, rgba(134,155,232,0.25), transparent 40%)"}),(0,t.jsxs)(g.U,{align:"flex-start",spacing:4,position:"relative",pb:"4",children:[(0,t.jsx)(m.k,{align:"center",justify:"center",bg:"white",borderRadius:"lg",boxSize:"44px",boxShadow:"0 2px 8px rgba(15, 23, 42, 0.18)",flexShrink:0,mt:"1",children:(0,t.jsx)(x.E,{src:"/logo.png",alt:"Wonderchat",boxSize:"32px"})}),(0,t.jsxs)(b.g,{align:"flex-start",spacing:4,children:[(0,t.jsxs)(f.x,{fontSize:"3xl",fontWeight:"medium",lineHeight:"38px",whiteSpace:{base:"normal",md:"nowrap"},children:["Go live on your website today.",(0,t.jsx)("br",{}),(0,t.jsx)(f.x,{as:"span",color:"rgba(255,255,255,0.6)",children:"No charges for 7 days."})]}),(0,t.jsx)(f.x,{fontSize:"md",fontWeight:"medium",color:"#afbcef",children:"Pick a plan → embed your chatbot → start answering real visitors."})]})]})]}),(0,t.jsxs)(b.g,{align:"stretch",spacing:6,px:8,py:6,children:[(0,t.jsxs)(g.U,{spacing:4,align:"center",w:"full",children:[(0,t.jsx)(f.x,{fontSize:"md",fontWeight:"medium",color:"#4a5578",flexShrink:0,children:"Choose your plan"}),(0,t.jsx)(v.i,{borderColor:"border.tertiary"}),(0,t.jsx)(R,{interval:B,onChange:q})]}),(0,t.jsxs)(b.g,{align:"stretch",spacing:4,children:[(0,t.jsxs)(g.U,{spacing:2,align:"stretch",pt:"26px",children:[k.map(e=>(0,t.jsx)(A,{tier:e,isSelected:F===e,isYearly:H,onSelect:()=>M(e)},e)),(0,t.jsx)(D,{onClick:()=>{null==W||W.capture("trial_opt_in_book_call_clicked",{surface:E}),window.open(T(null==W?void 0:W.get_distinct_id(),null==L?void 0:L.id),"_blank","noopener,noreferrer")}})]}),(0,t.jsxs)(g.U,{spacing:4,align:"center",bg:"#f9f9fb",borderRadius:"2xl",p:4,children:[(0,t.jsx)(x.E,{src:"/marlene.jpeg",alt:"Marlene Costa",boxSize:"46px",borderRadius:"full",objectFit:"cover",border:"1px solid",borderColor:"gray.400",fallbackSrc:"/default_pfp.png",flexShrink:0}),(0,t.jsxs)(p.xu,{flex:1,minW:0,children:[(0,t.jsx)(f.x,{fontSize:"md",fontWeight:"medium",color:"#4a5578",children:"Marlene Costa - your dedicated CSM"}),(0,t.jsx)(f.x,{fontSize:"sm",fontWeight:"medium",color:"#7d89b0",children:"I’ll personally get your chatbot live and answering real visitors within 24 hours."})]})]})]}),(0,t.jsxs)(b.g,{spacing:2,align:"center",children:[(0,t.jsx)(j.z,{w:"full",colorScheme:"brand",size:"md",fontSize:"md",fontWeight:"medium",onClick:()=>{var e,n,i,t,o;null==W||W.capture("trial_opt_in_modal_cta_clicked",G);let a="undefined"!=typeof Rewardful&&null!==(o=null==Rewardful?void 0:Rewardful.referral)&&void 0!==o?o:null;null==W||W.capture("trial_opt_in_checkout_opened",G),null==W||W.capture(r._X.upgrade_started,(0,r.ht)({accountContext:{accountId:null==L?void 0:L.id,email:null==L?void 0:L.email,plan:null===(n=I.data)||void 0===n?void 0:null===(e=n.user)||void 0===e?void 0:e.subscriptionType},currentPlan:null===(t=I.data)||void 0===t?void 0:null===(i=t.user)||void 0===i?void 0:i.subscriptionType,targetPlan:F,surface:"trial_opt_in_modal",extraProperties:{billing_interval:B,plan_id:Y,trial_opt_in_variant:N,trial_opt_in_surface:E}})),"undefined"!=typeof Paddle&&Paddle.Checkout.open({product:Y,email:null==L?void 0:L.email,passthrough:JSON.stringify({userId:null==L?void 0:L.id,variant:N,surface:E,tier:F,interval:B,rewardful:{referral:a}})}),w()},rightIcon:(0,t.jsx)(s.m,{}),children:"Start my 7-day ".concat(O[F]," trial - free")}),(0,t.jsxs)(g.U,{spacing:6,pt:1,children:[(0,t.jsx)(z,{icon:C.XiQ,label:"Card required"}),(0,t.jsx)(z,{icon:C.UIZ,label:"Cancel anytime"}),(0,t.jsx)(z,{icon:C.vlc,label:"Free for 7 days"})]})]})]})]})]})},R=e=>{let{interval:n,onChange:i}=e,o="yearly"===n;return(0,t.jsxs)(g.U,{spacing:2,px:3,flexShrink:0,children:[(0,t.jsx)(f.x,{as:"button",type:"button",onClick:()=>i("monthly"),fontSize:"sm",fontWeight:"medium",color:o?"#7d89b0":"#4a5578",transition:"color 0.12s",children:"Monthly"}),(0,t.jsx)(p.xu,{as:"button",type:"button",onClick:()=>i(o?"monthly":"yearly"),bg:"brand.500",borderRadius:"full",p:"2px",display:"inline-flex",alignItems:"center",w:"36px",h:"20px",position:"relative",flexShrink:0,children:(0,t.jsx)(p.xu,{bg:"white",borderRadius:"full",boxSize:"16px",transform:o?"translateX(16px)":"translateX(0)",transition:"transform 0.15s"})}),(0,t.jsx)(f.x,{as:"button",type:"button",onClick:()=>i("yearly"),fontSize:"sm",fontWeight:"medium",color:o?"#4a5578":"#7d89b0",transition:"color 0.12s",children:"Yearly"}),(0,t.jsx)(p.xu,{bg:"brand.25",borderRadius:"full",px:2,py:"1px",display:"inline-flex",alignItems:"center",justifyContent:"center",children:(0,t.jsx)(f.x,{fontSize:"xs",fontWeight:"medium",color:"brand.500",lineHeight:"18px",children:"−16%"})})]})},A=e=>{let{tier:n,isSelected:i,isYearly:o,onSelect:r}=e,s="BASIC"===n,l=o?Math.round(a.yJ[n]/12):a.kT[n],c=(0,t.jsxs)(p.xu,{as:"button",type:"button",onClick:r,textAlign:"left",bg:"white",borderRadius:"2xl",borderWidth:"1px",borderStyle:"solid",borderColor:i?"brand.500":"border.tertiary",h:"182px",w:s?"full":"auto",flex:s?void 0:"1 0 0",minW:s?void 0:0,p:4,display:"flex",flexDirection:"column",justifyContent:"center",gap:3,overflow:"hidden",transition:"border-color 0.12s",_hover:i?void 0:{borderColor:"border.secondary"},children:[(0,t.jsx)(f.x,{fontSize:"sm",fontWeight:"medium",color:"#4a5578",w:"full",children:O[n]}),(0,t.jsxs)(m.k,{align:"flex-end",gap:"3px",children:[(0,t.jsx)(f.x,{fontSize:"xl",fontWeight:"semibold",color:"#4a5578",lineHeight:"30px",children:"$".concat(l)}),(0,t.jsx)(f.x,{fontSize:"sm",fontWeight:"medium",color:"#7d89b0",lineHeight:"20px",children:"/mo"})]}),(0,t.jsx)(b.g,{align:"stretch",spacing:2,children:E[n].map(e=>(0,t.jsxs)(g.U,{spacing:1,align:"center",children:[(0,t.jsx)(w.J,{as:e.icon,boxSize:"18px",color:"#7d89b0"}),(0,t.jsx)(f.x,{fontSize:"sm",fontWeight:"medium",color:"#7d89b0",lineHeight:"20px",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:e.text})]},e.text))})]});return s?(0,t.jsxs)(p.xu,{bg:"brand.50",borderRadius:"2xl",flex:"1 0 0",minW:0,mt:"-2
16px",display:"flex",flexDirection:"column",children:[(0,t.jsx)(m.k,{align:"center",justify:"center",px:2,py:1,h:"26px",children:(0,t.jsx)(f.x,{fontSize:"xs",fontWeight:"medium",color:"brand.500",lineHeight:"18px",letterSpacing:"wider",children:"MOST POPULAR"})}),c]}):c},D=e=>{let{onClick:n}=e;return(0,t.jsxs)(p.xu,{as:"button",type:"button",onClick:n,textAlign:"left",bg:"white",borderRadius:"2xl",borderWidth:"1px",borderStyle:"dashed",borderColor:"border.secondary",h:"182px",flex:"1 0 0",minW:0,p:4,display:"flex",flexDirection:"column",justifyContent:"center",gap:2,overflow:"hidden",transition:"border-color 0.12s, background-color 0.12s",_hover:{borderColor:"brand.500",bg:"brand.25"},children:[(0,t.jsx)(f.x,{fontSize:"sm",fontWeight:"medium",color:"#4a5578",w:"full",children:"Not sure yet?"}),(0,t.jsx)(f.x,{fontSize:"sm",fontWeight:"medium",color:"#7d89b0",lineHeight:"20px",mb:1,children:"Hop on a 15-min call. We’ll help you pick the right plan and get your bot live."}),(0,t.jsxs)(g.U,{spacing:1,align:"center",color:"brand.500",children:[(0,t.jsx)(f.x,{fontSize:"sm",fontWeight:"semibold",children:"Book a call"}),(0,t.jsx)(w.J,{as:C.Rgz,boxSize:"14px"})]})]})},z=e=>{let{icon:n,label:i}=e;return(0,t.jsxs)(g.U,{spacing:1,align:"center",children:[(0,t.jsx)(w.J,{as:n,boxSize:"18px",color:"#7d89b0"}),(0,t.jsx)(f.x,{fontSize:"sm",fontWeight:"medium",color:"#7d89b0",lineHeight:"20px",children:i})]})}},30454:function(e,n,i){i.d(n,{C:function(){return l}});var t=i(85893),o=i(19875),r=i(33299);i(67294);var a=i(6417),s=i(68693);let l=e=>{var n,i,l;let{isOpen:c,onClose:d}=e,u=(0,o.Kn)(),h=null!==(l=null===(i=(0,r.useSession)().data)||void 0===i?void 0:null===(n=i.user)||void 0===n?void 0:n.subscriptionType)&&void 0!==l?l:"NONE";return"treatment"===u&&"NONE"===h?(0,t.jsx)(s.Z,{isOpen:c,onClose:d,surface:"paywall_replacement"}):(0,t.jsx)(a.x,{isOpen:c,onClose:d})}},95925:function(e,n,i){i.d(n,{T:function(){return u}});var t=i(85893),o=i(93717),r=i(36948),a=i(71293),s=i(57747),l=i(89993),c=i(34052);let d={brand:{bg:"#EBEEFB",border:"#AFBCEF",iconBg:"#D7DEF7",iconColor:"#3658D8"},gray:{bg:"white",border:"#D5D7DA",iconBg:"#F3F4F6",iconColor:"#414651"},error:{bg:"#FEF3F2",border:"#FECDCA",iconBg:"#FEE4E2",iconColor:"#D92D20"},warning:{bg:"#FFFAEB",border:"#FEDF89",iconBg:"#FEF0C7",iconColor:"#DC6803"},success:{bg:"#ECFDF3",border:"#75E0A7",iconBg:"#DCFAE6",iconColor:"#079455"}};
1function u(e){let{color:n="brand",title:i,description:u,icon:h,onClose:p,...g}=e,m=d[n],x=null!=h?h:"success"===n?c._rq:c.H33;return(0,t.jsxs)(o.k,{position:"relative",w:"full",gap:4,p:4,align:u?"flex-start":"center",bg:m.bg,border:"1px solid",borderColor:m.border,borderRadius:"12px",boxShadow:"0px 1px 2px 0px rgba(10, 13, 18, 0.05)",...g,children:[(0,t.jsx)(o.k,{w:"32px",h:"32px",align:"center",justify:"center",borderRadius:"full",bg:m.iconBg,flexShrink:0,children:(0,t.jsx)(r.J,{as:x,boxSize:"20px",color:m.iconColor})}),(0,t.jsxs)(o.k,{direction:"column",flex:"1 0 0",minW:0,gap:1,pr:p?8:0,children:[(0,t.jsx)(a.x,{fontSize:"14px",fontWeight:600,lineHeight:"20px",color:"#414651",children:i}),u&&(0,t.jsx)(s.xu,{fontSize:"14px",fontWeight:400,lineHeight:"20px",color:"#535862",children:u})]}),p&&(0,t.jsx)(l.h,{"aria-label":"Close alert",icon:(0,t.jsx)(r.J,{as:c.q5L,boxSize:"20px"}),onClick:p,variant:"ghost",size:"sm",position:"absolute",top:"7px",right:"7px",color:"#A4A7AE",minW:"36px",h:"36px",borderRadius:"8px",_hover:{bg:"blackAlpha.50"}})]})}},93358:function(e,n,i){i.d(n,{Cz:function(){return A},_F:function(){return I}});var t=i(85893),o=i(73209),r=i(22697),a=i(59007),s=i(93717),l=i(57747),c=i(71293),d=i(89993),u=i(36948),h=i(48783),p=i(22757),g=i(33090),m=i(93108),x=i(81136),b=i(72250),f=i(8371),v=i(85857),j=i(75141),w=i(49289),y=i(33299),S=i(11163),_=i(88261),C=i(67294),k=i(34052);function T(e){let{step:n,total:i}=e;return(0,t.jsx)(s.k,{justify:"center",gap:2,mb:8,children:Array.from({length:i}).map((e,i)=>(0,t.jsx)(l.xu,{w:i===n?5:2,h:2,borderRadius:"full",bg:i===n?"brand.500":i<n?"brand.200":"gray.200",transition:"all 0.3s ease"},i))})}function O(e){let{emoji:n,title:i,desc:o}=e;return(0,t.jsxs)(s.k,{align:"flex-start",gap:3,bg:"gray.50",borderRadius:"xl",p:4,border:"1px solid",borderColor:"gray.100",children:[(0,t.jsx)(s.k,{w:9,h:9,borderRadius:"lg",bg:"brand.50",align:"center",justify:"center",flexShrink:0,fontSize:"lg",children:n}),(0,t.jsxs)(l.xu,{children:[(0,t.jsx)(c.x,{fontSize:"sm",fontWeight:"semibold",color:"gray.800",children:i}),(0,t.jsx)(c.x,{fontSize:"xs",color:"gray.500",mt:.5,children:o})]})]})}function E(e){let{children:n,direction:i}=e,[o,r]=(0,C.useState)(!1);return(0,C.useEffect)(()=>{let e=requestAnimationFrame(()=>r(!0));return()=>cancelAnimationFrame(e)},[]),(0,t.jsx)(l.xu,{style:{opacity:o?1:0,transform:o?"translateY(0)":"forward"===i?"translateY(12px)":"translateY(-12px)",transition:"opacity 0.25s ease, transform 0.25s ease"},children:n})}function I(e){var n,i;let{onSwitchToInvited:v,onClose:j}=e,{data:w}=(0,y.useSession)(),I=(0,S.useRouter)(),R=a.S.useUtils(),{refetch:A,setActiveWorkspace:D}=(0,o.cF)(),[z,W]=(0,C.useState)(0),[N,L]=(0,C.useState)("forward"),[P,U]=(0,C.useState)((null==w?void 0:null===(n=w.user)||void 0===n?void 0:n.name)?"".concat(w.user.name.split(" ")[0],"'s Workspace"):"My Workspace"),[F,M]=(0,C.useState)([]),[B,q]=(0,C.useState)(!1),[H,Y]=(0,C.useState)(""),[G,Q]=(0,C.useState)(null),[J,K]=(0,C.useState)(0),[Z,V]=(0,C.useState)(["","",""]),[X,$]=(0,C.useState)(!1),[ee,en]=(0,C.useState)(!1),[ei,et]=(0,C.useState)(null),[eo,er]=(0,C.useState)(0),ea=(0,C.useRef)(0),es=(0,C.useRef)(!1);(0,C.useEffect)(()=>{var e;(null==w?void 0:null===(e=w.user)||void 0===e?void 0:e.name)&&"My Workspace"===P&&U("".concat(w.user.name.split(" ")[0],"'s Workspace"))},[null==w?void 0:null===(i=w.user)||void 0===i?void 0:i.name]);let el=a.S.internalWorkspaces.inviteWorkspaceMember.useMutation(),ec=a.S.internalWorkspaces.createInternalWorkspace.useMutation(),ed=()=>{L("forward"),ea.current+=1,W(e=>e+1)},eu=async e=>{Y("");let{file:n,onSuccess:i,onError:t}=e,o=Math.ceil(n.size/2097152),a=(0,r.YO)(20);Q(o);let s=[];for(let e=0;e<o-1;e++){let i=2097152*e,t=Math.min(i+2097152,n.size),r=n.slice(i,t),l=new FormData;l.append("file",r),l.append("fileName",n.name),l.append("chunkNumber",String(e)),l.append("totalChunks",String(o)),l.append("uniqueId",a),s.push(fetch("/api/upload-file",{method:"POST",body:l}).then(()=>{K(e=>e+1)}))}let l=o-1,c=2097152*l,d=Math.min(c+2097152,n.size),u=n.slice(c,d),h=new FormData;h.append("file",u),h.append("fileName",n.name),h.append("chunkNumber",String(l)),h.append("totalChunks",String(o)),h.append("uniqueId",a),await Promise.all(s),fetch("/api/upload-file",{method:"POST",body:h}).then(async e=>{let n=await e.json();e.ok?i(n):t(Error(n.errMsg))}).catch(e=>{t(e)}).finally(()=>{Q(null),K(0)})};return(0,C.useEffect)(()=>{3!==z||es.current||(es.current=!0,$(!0),(async()=>{try{let e=await ec.mutateAsync({name:P.trim(),files:F.map(e=>({path:e.path,name:e.name}))});et(e.id);let n=Z.map(e=>
1e.trim().toLowerCase()).filter(Boolean),i=await Promise.allSettled(n.map(n=>el.mutateAsync({workspaceId:e.id,email:n})));er(i.filter(e=>"fulfilled"===e.status).length),await R.internalWorkspaces.getUserInternalWorkspace.invalidate(),await A(),D(e.id),en(!0)}catch(e){console.error("[CreateOnboarding] Failed:",e),es.current=!1,$(!1)}})())},[z]),(0,t.jsx)(l.xu,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:2e3,sx:{backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},bg:"whiteAlpha.700",overflowY:"auto",children:(0,t.jsx)(s.k,{minH:"100%",w:"full",align:"center",justify:"center",px:6,py:6,children:(0,t.jsxs)(l.xu,{w:"full",maxW:"520px",bg:"white",borderRadius:"2xl",border:"1px solid",borderColor:"gray.200",p:7,shadow:"sm",position:"relative",children:[z>0&&z<3&&(0,t.jsx)(d.h,{"aria-label":"Back",icon:(0,t.jsx)(u.J,{as:k.Ao2,boxSize:4}),size:"sm",variant:"ghost",color:"gray.400",position:"absolute",top:4,left:4,onClick:()=>{L("back"),ea.current+=1,W(e=>e-1)}}),j&&z<3&&(0,t.jsx)(d.h,{"aria-label":"Close",icon:(0,t.jsx)(u.J,{as:k.q5L,boxSize:4}),size:"sm",variant:"ghost",color:"gray.400",position:"absolute",top:4,right:4,onClick:j}),(0,t.jsx)(T,{step:z,total:4}),(0,t.jsxs)(l.xu,{children:[0===z&&(0,t.jsxs)(E,{direction:N,children:[(0,t.jsxs)(h.g,{spacing:2,mb:5,children:[(0,t.jsx)(s.k,{w:12,h:12,borderRadius:"2xl",bg:"brand.50",align:"center",justify:"center",children:(0,t.jsx)(u.J,{as:k.yK7,boxSize:6,color:"brand.500"})}),(0,t.jsx)(p.X,{fontSize:"xl",fontWeight:"bold",textAlign:"center",color:"gray.800",children:"Welcome to Workspace"}),(0,t.jsx)(c.x,{fontSize:"sm",color:"gray.500",textAlign:"center",maxW:"340px",children:"Your team's shared brain — one place for all your company knowledge, AI agents, and conversations."})]}),(0,t.jsxs)(h.g,{spacing:2,mb:5,children:[(0,t.jsx)(O,{emoji:"\uD83D\uDCDA",title:"All your company knowledge, searchable & chattable",desc:"Upload PDFs, docs, spreadsheets, policies — anything. Ask questions, get instant answers."}),(0,t.jsx)(O,{emoji:"\uD83E\uDD16",title:"Specialized agents for every job",desc:"Create private or shared agents trained on a subset of your knowledge. HR bot, legal helper, onboarding guide."}),(0,t.jsx)(O,{emoji:"\uD83D\uDCAC",title:"Continue where you left off",desc:"Every chat is saved. Switch models mid-conversation. Pick up any thread at any time."}),(0,t.jsx)(O,{emoji:"\uD83D\uDC65",title:"Your whole team, one knowledge base",desc:"Invite teammates — everyone contributes knowledge, creates agents, and benefits from each other's work."})]}),(0,t.jsxs)(l.xu,{mb:4,children:[(0,t.jsx)(c.x,{fontSize:"xs",fontWeight:"semibold",color:"gray.500",textTransform:"uppercase",letterSpacing:"wide",mb:2,children:"What should we call your workspace?"}),(0,t.jsx)(g.I,{value:P,onChange:e=>U(e.target.value),size:"lg",borderRadius:"lg",fontSize:"md",autoFocus:!0,onKeyDown:e=>{"Enter"===e.key&&P.trim()&&ed()}})]}),(0,t.jsx)(m.z,{size:"lg",w:"full",bg:"brand.500",color:"white",_hover:{bg:"brand.600"},borderRadius:"lg",rightIcon:(0,t.jsx)(u.J,{as:k.Rgz}),isDisabled:!P.trim(),onClick:ed,children:"Get started"}),v&&(0,t.jsxs)(c.x,{fontSize:"xs",color:"gray.400",textAlign:"center",mt:4,children:["Have an invitation? ",(0,t.jsx)(c.x,{as:"span",color:"brand.500",cursor:"pointer",textDecoration:"underline",onClick:v,children:"View your invitations"})]})]}),1===z&&(0,t.jsxs)(E,{direction:N,children:[(0,t.jsxs)(h.g,{spacing:1,mb:6,children:[(0,t.jsx)(p.X,{fontSize:"xl",fontWeight:"bold",textAlign:"center",color:"gray.800",children:"Add your company knowledge"}),(0,t.jsx)(c.x,{fontSize:"sm",color:"gray.500",textAlign:"center",maxW:"360px",children:"Upload PDFs, docs, spreadsheets, CSVs — anything your team references. We'll make it all searchable and chattable."})]}),(0,t.jsxs)(s.k,{align:"flex-start",gap:2,bg:"blue.50",border:"1px solid",borderColor:"blue.100",borderRadius:"lg",p:3,mb:5,children:[(0,t.jsx)(c.x,{fontSize:"lg",flexShrink:0,children:"\uD83D\uDCA1"}),(0,t.jsx)(c.x,{fontSize:"xs",color:"blue.700",children:"Pro tip: After uploading, use folders to organize knowledge by department, project, or topic — then assign specific folders to specialized agents."})]}),(0,t.jsx)(_.Z,{accept:"application/pdf,.txt,.csv,.md,.json,.doc,.docx,.pptx",action:"/api/upload-file",multiple:!0,customRequest:eu,onStart:()=>q(!0),onSuccess:(e,n)=>{q(!1);let{path:i,chars:t}=e;i&&(t||0===t)&&M(e=>[...e,{path:i,name:n.name,chars:t}])},onError:e=>{Y(e.message),q(!1)},children:(0,t.jsxs)(l.xu,{border:"2px dashed",borderColor:B?"brand.300":"gray.200",borderRadius:"xl",p:8,textAlign:"center",cursor:"pointer",_hover:{borderColor:"brand.300",bg:"brand.25"},transition:"all 0.2s",mb:3,children:[B?(0,t.jsx)(x.$,{size:"sm",color:"brand.500",mb:2}):(0,t.jsx)(u.J,{as:k.Yjd,boxSize:6,color:"gray.300",mb:2}),(0,t.jsx)(c.x,{fontSize:"sm",fontWeight:"medium",color:"gray.600",children:B?"Uploading...":"Click or drag files to upload"}),(0,t.jsx)(c.x,{fontSize:"xs",color:"gray.400",mt:1,children:"PDF, TXT, MD, CSV, JSON, DOC, DOCX, PPTX"})]})}),null!==G&&(0,t.jsx)(b.E,{hasStripe:!0,value:J/G*100,mb:3,borderRadius:4,size:"xs",colorScheme:"brand"}),H&&(0,t.jsx)(c.x,{fontSize:"xs",color:"red.500",mb:3,children:H}),F.length>0&&(0,t.jsx)(s.k,{flexWrap:"wrap",gap:2,mb:4,children:F.map((e,n)=>(0,t.jsxs)(f.Vp,{colorScheme:"brand",size:"sm",borderRadius:"full",children:[(0,t.jsx)(f.Sn,{children:e.name}),(0,t.jsx)(f.SD,{onClick:()=>M(e=>e.filter((e,i)=>i!==n))})]},e.path))}),(0,t.jsx)(m.z,{size:"lg",w:"full",bg:"brand.500",color:"white",_hover:{bg:"brand.600"},borderRadius:"lg",rightIcon:(0,t.jsx)(u.J,{as:k.Rgz}),isDisabled:B,onClick:ed,mb:3,children:"Continue"}),(0,t.jsx)(m.z,{size:"sm",variant:"ghost",color:"gray.400",w:"full",onClick:ed,children:"I'll add knowledge later →"})]}),2===z&&(0,t.jsxs)(E,{direction:N,children:[(0,t.jsxs)(h.g,{spacing:1,mb:6,children:[(0,t.jsx)(s.k,{w:12,h:12,borderRadius:"xl",bg:"brand.50",align:"center",justify:"center",mb:1,children:(0,t.jsx)(u.J,{as:k.WY8,boxSize:6,color:"brand.500"})}),(0,t.jsx)(p.X,{fontSize:"xl",fontWeight:"bold",textAlign:"center",color:"gray.800",children:"Bring your team in"}),(0,t.jsx)(c.x,{fontSize:"sm",color:"gray.500",textAlign:"center",maxW:"360px",children:"Share your knowledge base with your team. Everyone can contribute files, create their own agents (private or shared), and chat using any AI model."})]}),(0,t.jsxs)(h.g,{spacing:2,mb:5,children:[Z.map((e,n)=>(0,t.jsxs)(s.k,{gap:2,align:"center",children:[(0,t.jsx)(g.I,{placeholder:"teammate".concat(n+1,"@company.com"),size:"sm",borderRadius:"md",value:e,onCh
1ange:e=>{let i=[...Z];i[n]=e.target.value,V(i)}}),Z.length>1&&(0,t.jsx)(d.h,{"aria-label":"Remove",icon:(0,t.jsx)(u.J,{as:k.q5L,boxSize:3.5}),size:"xs",variant:"ghost",color:"gray.400",onClick:()=>V(e=>e.filter((e,i)=>i!==n))})]},n)),Z.length<5&&(0,t.jsx)(m.z,{size:"xs",variant:"ghost",color:"brand.500",leftIcon:(0,t.jsx)(u.J,{as:k.OvN,boxSize:3}),alignSelf:"flex-start",onClick:()=>V(e=>[...e,""]),children:"Add another"})]}),(0,t.jsx)(m.z,{size:"lg",w:"full",bg:"brand.500",color:"white",_hover:{bg:"brand.600"},borderRadius:"lg",rightIcon:(0,t.jsx)(u.J,{as:k.Rgz}),onClick:ed,mb:3,children:"Continue"}),(0,t.jsx)(m.z,{size:"sm",variant:"ghost",color:"gray.400",w:"full",onClick:ed,children:"I'll invite them later →"})]}),3===z&&(0,t.jsx)(E,{direction:N,children:(0,t.jsx)(h.g,{spacing:4,py:4,children:ee?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.k,{w:16,h:16,borderRadius:"full",bg:"green.50",align:"center",justify:"center",children:(0,t.jsx)(u.J,{as:k.UgA,boxSize:8,color:"green.500"})}),(0,t.jsx)(p.X,{fontSize:"2xl",fontWeight:"bold",color:"gray.800",textAlign:"center",children:"You're all set! \uD83C\uDF89"}),(0,t.jsxs)(h.g,{spacing:1,children:[(0,t.jsxs)(c.x,{fontSize:"sm",color:"gray.600",children:[(0,t.jsx)(c.x,{as:"span",fontWeight:"semibold",children:P})," is ready to go."]}),F.length>0&&(0,t.jsx)(c.x,{fontSize:"xs",color:"gray.400",children:"".concat(F.length," file").concat(1!==F.length?"s":""," added to your knowledge library")}),eo>0&&(0,t.jsx)(c.x,{fontSize:"xs",color:"gray.400",children:"Invites sent to ".concat(eo," teammate").concat(1!==eo?"s":"")})]}),(0,t.jsx)(m.z,{size:"lg",bg:"brand.500",color:"white",_hover:{bg:"brand.600"},borderRadius:"lg",rightIcon:(0,t.jsx)(u.J,{as:k.IC0}),mt:2,onClick:()=>{j&&j(),I.push("/workspace-v2")},children:"Start chatting"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.$,{size:"xl",color:"brand.500",thickness:"3px"}),(0,t.jsx)(c.x,{fontSize:"sm",color:"gray.500",children:"Setting up your workspace..."})]})})})]},ea.current)]})})})}function R(e){let{invitations:n,onCreateOwn:i}=e,r=(0,S.useRouter)(),d=a.S.useUtils(),{refetch:g}=(0,o.cF)(),[x,b]=(0,C.useState)(null),[f,y]=(0,C.useState)(null),_=a.S.internalWorkspaces.acceptWorkspaceInvitation.useMutation({onSuccess:async(e,n)=>{b(null),y(n.token),await d.internalWorkspaces.getUserInternalWorkspace.invalidate(),await g(),setTimeout(()=>r.push("/workspace-v2"),1200)},onError:()=>{b(null)}});return(0,t.jsx)(s.k,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1500,align:"center",justify:"center",px:6,py:10,sx:{backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},bg:"whiteAlpha.700",overflowY:"auto",children:(0,t.jsxs)(l.xu,{w:"full",maxW:"520px",bg:"white",borderRadius:"2xl",border:"1px solid",borderColor:"gray.200",p:8,shadow:"sm",children:[(0,t.jsxs)(h.g,{spacing:2,mb:8,children:[(0,t.jsx)(c.x,{fontSize:"3xl",mb:1,children:"\uD83D\uDC4B"}),(0,t.jsx)(p.X,{fontSize:"2xl",fontWeight:"bold",textAlign:"center",color:"gray.800",children:"You've been invited!"}),(0,t.jsx)(c.x,{fontSize:"sm",color:"gray.500",textAlign:"center",children:"Join an existing workspace or create your own."})]}),(0,t.jsx)(h.g,{spacing:3,mb:6,children:n.map(e=>{let n=x===e.id,i=f===e.id,o=e.workspace.members.length,r=e.workspace.members.slice(0,4);return(0,t.jsxs)(s.k,{align:"center",gap:4,p:4,bg:"gray.50",border:"1px solid",borderColor:"gray.200",borderRadius:"xl",w:"full",children:[(0,t.jsx)(s.k,{w:10,h:10,borderRadius:"lg",bg:"brand.50",align:"center",justify:"center",flexShrink:0,fontSize:"lg",children:"\uD83C\uDFE2"}),(0,t.jsxs)(l.xu,{flex:1,minW:0,children:[(0,t.jsx)(c.x,{fontSize:"sm",fontWeight:"semibold",color:"gray.800",noOfLines:1,children:e.workspace.name}),(0,t.jsxs)(s.k,{align:"center",gap:2,mt:1,children:[(0,t.jsx)(v.H,{size:"2xs",max:4,spacing:"-0.5rem",children:r.map((e,n)=>{var i,o;return(0,t.jsx)(j.q,{name:null!==(i=e.user.name)&&void 0!==i?i:void 0,src:null!==(o=e.user.image)&&void 0!==o?o:void 0},n)})}),(0,t.jsx)(c.x,{fontSize:"xs",color:"gray.400",children:"".concat(o," member").concat(1!==o?"s":"")})]})]}),(0,t.jsx)(m.z,{size:"sm",colorScheme:i?"green":"brand",borderRadius:"lg",flexShrink:0,isLoading:n,leftIcon:i?(0,t.jsx)(u.J,{as:k.UgA,boxSize:3.5}):void 0,onClick:()=>{i||n||(b(e.id),_.mutate({token:e.id}))},children:i?"Joined!":"Join"})]},e.id)})}),(0,t.jsxs)(s.k,{align:"center",gap:3,mb:6,children:[(0,t.jsx)(w.i,{}),(0,t.jsx)(c.x,{fontSize:"xs",color:"gray.400",flexShrink:0,children:"or"}),(0,t.jsx)(w.i,{})]}),(0,t.jsx)(m.z,{size:"md",variant:"outline",colorScheme:"brand",w:"full",borderRadius:"lg",rightIcon:(0,t.jsx)(u.J,{as:k.Rgz}),onClick:i,children:"Create my own workspace"})]})})}function A(){let[e,n]=(0,C.useState)(!1),{data:i=[],isLoading:o}
1=a.S.internalWorkspaces.getMyPendingWorkspaceInvitations.useQuery();return o?(0,t.jsx)(s.k,{position:"fixed",top:0,left:0,right:0,bottom:0,zIndex:1500,align:"center",justify:"center",sx:{backdropFilter:"blur(12px)",WebkitBackdropFilter:"blur(12px)"},bg:"whiteAlpha.700",children:(0,t.jsx)(x.$,{size:"lg",color:"brand.500"})}):i.length>0&&!e?(0,t.jsx)(R,{invitations:i,onCreateOwn:()=>n(!0)}):(0,t.jsx)(I,{onSwitchToInvited:i.length>0?()=>n(!1):void 0})}},73430:function(e,n,i){i.d(n,{D:function(){return E}});var t=i(85893),o=i(95925),r=i(59007),a=i(7963),s=i(35541),l=i(83589),c=i(14581),d=i(64859),u=i(71293),h=i(66205),p=i(54346),g=i(48783),m=i(85970),x=i(5418),b=i(33090),f=i(26105),v=i(41731),j=i(73804),w=i(93717),y=i(57747),S=i(14253),_=i(93108),C=i(20512),k=i(33299),T=i(34052),O=i(16310);function E(e){var n,i;let{isOpen:E,onClose:I,onSuccess:R}=e,{data:A}=(0,k.useSession)(),D=(0,a.p)(),z=r.S.workspaces.inviteWorkspaceMember.useMutation({onSuccess:e=>{let{invitedEmail:n}=e;null==R||R(),D({title:"Invitation sent",description:"An invitation has been sent to ".concat(n),status:"success",duration:3e3,isClosable:!0}),I()},onError:e=>{D({title:"Error",description:e.message||"Failed to send invitation",status:"error",duration:3e3,isClosable:!0})}});return(0,t.jsxs)(s.u_,{isOpen:E,onClose:I,children:[(0,t.jsx)(l.Z,{}),(0,t.jsxs)(c.h,{children:[(0,t.jsxs)(d.x,{pb:1,children:["Invite Member to Team",(0,t.jsxs)(u.x,{fontSize:"sm",fontWeight:"normal",color:"gray.600",mt:1,children:["Invite someone to join"," ",(0,t.jsx)(u.x,{as:"span",fontWeight:"semibold",color:"gray.800",children:null!==(i=null==A?void 0:null===(n=A.workspace)||void 0===n?void 0:n.name)&&void 0!==i?i:"your team"}),". They'll be able to access and manage resources owned by the team together with you."]})]}),(0,t.jsx)(h.o,{}),(0,t.jsx)(C.J9,{initialValues:{email:"",role:"MEMBER"},validationSchema:O.Ry({email:O.Z_().email("Invalid email address").required("Email is required"),role:O.Z_().oneOf(["MEMBER","ADMIN"],"Invalid role").required("Role is required")}),onSubmit:e=>{var n;z.mutate({workspaceId:(null==A?void 0:null===(n=A.workspace)||void 0===n?void 0:n.id)||"",email:e.email,role:e.role})},children:e=>(0,t.jsxs)(C.l0,{children:[(0,t.jsx)(p.f,{pb:6,children:(0,t.jsxs)(g.g,{spacing:4,children:[(0,t.jsx)(C.gN,{name:"email",children:e=>{let{field:n,form:i}=e;return(0,t.jsxs)(m.NI,{isInvalid:i.errors.email&&i.touched.email,children:[(0,t.jsx)(x.l,{fontSize:"sm",children:"Email"}),(0,t.jsx)(b.I,{...n,size:"sm",placeholder:"Enter email address"}),(0,t.jsx)(f.J1,{children:i.errors.email})]})}}),(0,t.jsx)(C.gN,{name:"role",children:e=>{let{field:n,form:i}=e;return(0,t.jsxs)(m.NI,{isInvalid:i.errors.role&&i.touched.role,children:[(0,t.jsx)(x.l,{fontSize:"sm",children:"Role"}),(0,t.jsxs)(v.P,{...n,size:"sm",children:[(0,t.jsx)("option",{value:"MEMBER",children:"Member"}),(0,t.jsx)("option",{value:"ADMIN",children:"Admin"})]}),(0,t.jsx)(f.J1,{children:i.errors.role})]})}}),(0,t.jsx)(o.T,{color:"warning",title:"ADMIN"===e.values.role?"Invited admins will be able to:":"Invited members will be able to:",description:(0,t.jsxs)(j.aV,{spacing:2,children:["ADMIN"===e.values.role&&(0,t.jsx)(j.HC,{children:(0,t.jsxs)(w.k,{align:"center",children:[(0,t.jsx)(y.xu,{as:T.OvN,size:14,mr:2}),"Create and Delete chatbots in your team"]})}),(0,t.jsx)(j.HC,{children:(0,t.jsxs)(w.k,{align:"center",children:[(0,t.jsx)(y.xu,{as:T.rDJ,size:14,mr:2}),"View and update chatbots in your team"]})}),(0,t.jsx)(j.HC,{children:(0,t.jsxs)(w.k,{align:"center",children:[(0,t.jsx)(y.xu,{as:T.DKx,size:14,mr:2}),"View analytics of all chatbots in your team"]})}),(0,t.jsx)(j.HC,{children:(0,t.jsxs)(w.k,{align:"center",children:[(0,t.jsx)(y.xu,{as:T.IYd,size:14,mr:2}),"Create corrections for all chatbots in your team"]})}),(0,t.jsx)(j.HC,{children:(0,t.jsxs)(w.k,{align:"center",children:[(0,t.jsx)(y.xu,{as:T.IC0,size:14,mr:2}),"Respond to live chat queries in your team"]})})]})})]})}),(0,t.jsxs)(S.m,{children:[(0,t.jsx)(_.z,{variant:"ghost",mr:3,onClick:I,children:"Cancel"}),(0,t.jsx)(_.z,{type:"submit",colorScheme:"brand",isLoading:z.isLoading,children:"Send Invitation"})]})]})})]})]})}},73209:function(e,n,i){i.d(n,{W5:function(){return p},cF:function(){return g}});var t=i(85893),o=i(90545),r=i(59007),a=i(85945),s=i(16058),l=i(33299),c=i(11163),d=i(67294);let u="wc_active_workspace",h=(0,d.createContext)({workspaces:[],activeWorkspace:null,setActiveWorkspace:()=>void 0,isLoading:!0,refetch:()=>void 0});function p(e){var n,i;let{children:p}=e,g=(0,l.useSession)(),m=(0,c.useRouter)(),x=(0,a.NL)(),{isAllowed:b,isResolved:f}=(0,o.L)();(0,d.useState)(()=>(x.setQueryDefaults((0,s.Ol)(r.S.internalWorkspaces),{staleTime:3e4,refetchOnWindowFocus:!1,retry:1}),!0));let{data:v=[],isLoading:j,refetch:w}=r.S.internalWorkspaces.getMyWorkspaces.useQuery(void 0,{enabled:b}),[y,S]=(0,d.useState)(null),_=m.pathname.startsWith("/workspace-v2/join")||m.pathname.startsWith("/workspace-v2/invite");(0,d.useEffect)(()=>{"authenticated"===g.status&&f&&!b&&m.pathname.startsWith("/workspace-v2")&&!_&&m.replace("/dashboard")},[g.status,f,b,m.pathname,_]),(0,d.useEffect)(()=>{try{let e=localStorage.getItem(u);e&&S(e)}catch(e){}},[]);let C=null!==(i=null!==(n=v.find(e=>e.id===y))&&void 0!==n?n:v[0])&&void 0!==i?i:null;return(0,t.jsx)(h.Provider,{value:{workspaces:v,activeWorkspace:C,setActiveWorkspace:e=>{S(e);try{localStorage.setItem(u,e)}catch(e){}},isLoading:j,refetch:w},children:p})}function g(){return(0,d.useContext)(h)}},19875:function(e,n,i){i.d(n,{Kn:function(){return l},hJ:function(){return c}});var t=i(10679),o=i(59007),r=i(33299),a=i(58192),s=i(67294);function l(){var e,n,i,t;let a=(0,r.useSession)(),s=c(),{data:l}=o.S.user.getTrialOptInState.useQuery(void 0,{enabled:!!(null===(n=a.data)||void 0===n?void 0:null===(e=n.user)||void 0===e?void 0:e.id)});return"loading"===s?"loading":(null===(t=a.data)||void 0===t?void 0:null===(i=t.user)||void 0===i?void 0:i.id)?l?l.isExcludedFromTrialUpsell?"control":s:"loading":s}function c(){var e,n;let i;let l=(0,a.U0)(),c=null===(n=(0,r.useSession)().data)||void 0===n?void 0:null===(e=n.user)||void 0===e?void 0:e.id,{data:d}=o.S.user.getTrialOptInState.useQuery(void 0,{enabled:!!c}),u=o.S.user.persistTrialOptInVariant.useMutation(),h=(0,s.useRef)(!1),p=t.O.NEXT_PUBLIC_TRIAL_OPT_IN_OVERRIDE,g=l?l.getFeatureFlag("onboarding-trial-opt-in-2"):void 0,m=null!=d&&"NONE"!==d.subscriptionType;return i=c&&null==d?"loading":m?"control":p||(void 0===g?"loading":"treatment"===g||!0===g?"treatment":"control"),(0,s.useEffect)(()=>{var e;if(!m&&!(e={variant:i,userId:c,alreadyPersisted:h.current}).alreadyPersisted&&"loading"!==e.variant&&e.userId&&(h.current=!0,"loading"!==i)){if(l){let e=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Date;return{set:{trial_opt_in_variant:e},setOnce:{trial_opt_in_variant_assigned_at:n.toISOString(),trial_opt_in_first_variant:e,onboarding_trial_opt_in_variant:e}}}(i);l.setPersonProperties(e.set,e.setOnce)}u.mutate({variant:i})}},[i,c,u,l,m]),i}},90545:function(e,n,i){i.d(n,{L:function(){return r}});var t=i(59007),o=i(33299);function r(){var e,n,i,r;let a=(0,o.useSession)(),s=null===(i=a.data)||void 0===i?void 0:null===(n=i.user)||void 0===n?void 0:null===(e=n.email)||void 0===e?void 0:e.toLowerCase(),l=!!s&&s.endsWith("@wonderchat.io"),{data:c,isLoading:d}=t.S.internalWorkspaces.getWorkspaceV2Access.useQuery(void 0,{enabled:"authenticated"===a.status&&!l});return{isAllowed:l||null!==(r=null==c?void 0:c.isAllowed)&&void 0!==r&&r,isResolved:l||!d,isWonderchatEmail:l}}},47583:function(e,n,i){i.d(n,{D7:function(){return s},_X:function(){return t},cf:function(){return o},ht:function(){return a},oH:function(){return r}});let t={kb_source_added:"kb_source_added",kb_indexing_completed:"kb_indexing_completed",first_kb_question_asked:"first_kb_question_asked",first_kb_answer_generated:"first_kb_answer_generated",embed_code_copied:"embed_code_copied",widget_installed:"widget_installed",first_external_visitor_message:"first_external_visitor_message",team_member_invited:"team_member_invited",bot_shared:"bot_shared",pricing_page_viewed:"pricing_page_viewed",upgrade_started:"upgrade_started",enterprise_demo_requested:"enterprise_demo_requested",try_page_viewed:"tr
1y_page_viewed",try_chatbot_create_submitted:"try_chatbot_create_submitted",try_chatbot_ready:"try_chatbot_ready",try_claim_clicked:"try_claim_clicked",try_signin_started:"try_signin_started",try_survey_completed:"try_survey_completed",agent_created:"agent_created",agent_claimed:"agent_claimed",onboarding_page_viewed:"onboarding_page_viewed",onboarding_step_viewed:"onboarding_step_viewed",onboarding_step_completed:"onboarding_step_completed",channel_connected:"channel_connected",channel_first_message:"channel_first_message",agent_deployed:"agent_deployed",lead_captured:"lead_captured",first_lead_captured:"first_lead_captured",first_resolution:"first_resolution",credit_threshold_reached:"credit_threshold_reached",credit_usage_synced:"credit_usage_synced",message_pack_purchased:"message_pack_purchased",resolution_logged:"resolution_logged",usage_logged:"usage_logged",signed_up:"signed_up",logged_in:"logged_in",onboarding_completed:"onboarding_completed",subscription_upgraded:"subscription_upgraded",plan_downgraded:"plan_downgraded",integration_connected:"integration_connected",integration_disconnected:"integration_disconnected",bot_deleted:"bot_deleted"},o={TRY_PAGE:"try_page",REGULAR_ONBOARDING:"regular_onboarding"};function r(e){return"PAGE"===e?"page":"SEARCHBAR"===e?"searchbar":"SHOPIFY"===e?"shopify":"widget"}function a(e){let{accountContext:n,currentPlan:i,targetPlan:o,surface:r,extraProperties:a}=e;return s({event:t.upgrade_started,accountContext:n,properties:{current_plan:null!=i?i:"NONE",target_plan:o,surface:r,...a},setOnce:{upgrade_started_target_plan:o}})}function s(e){let{event:n,accountContext:i,properties:t,setOnce:o,eventTime:r}=e,a=function(e){var n;let{accountId:i,companyDomain:t,plan:o,icpPrimary:r,icpConfidence:a,buyerFunction:s,websiteComplexity:l,useCasePrimary:c,sourceMotion:d,email:u}=e,h={account_id:null!=i?i:null,company_domain:null!=t?t:(null==u?void 0:null===(n=u.split("@")[1])||void 0===n?void 0:n.toLowerCase())||null,plan:o&&"NONE"!==o?"ENTERPRISE"===o||o.startsWith("ENTERPRISE_")?"enterprise":String(o).toLowerCase():"free"};return null!=r&&(h.icp_primary=r),null!=a&&(h.icp_confidence=a),null!=s&&(h.buyer_function=s),null!=l&&(h.website_complexity=l),null!=c&&(h.use_case_primary=c),null!=d&&(h.source_motion=d),h}(null!=i?i:{}),s={["has_".concat(n)]:!0,["".concat(n,"_at")]:(null!=r?r:new Date).toISOString(),...(null==t?void 0:t.bot_id)?{["".concat(n,"_bot_id")]:t.bot_id}:{},...o};return{...a,...t,$set:a,$set_once:s}}},70386:function(e,n,i){i.d(n,{N7:function(){return s},Vo:function(){return c},Yp:function(){return d},n:function(){return l}});var t=i(22697);let o={LITE:"Basic",STARTER:"Basic",BASIC:"Basic",TURBO:"Scale",SCALE:"Scale",PRO:"Pro",ENTERPRISE:"Enterprise"};function r(e){var n;return null!==(n=o[e])&&void 0!==n?n:e.charAt(0)+e.slice(1).toLowerCase()}let a={DS_TYPE_SHAREPOINT:{minTier:"TURBO",label:"SharePoint Data Source",description:"SharePoint data source: ingest documents from SharePoint into chatbot knowledge.",enforceOnDowngrade:!1},DS_TYPE_AUDIO_FILES:{minTier:"TURBO",label:"Audio Files Data Source",description:"Audio files data source: ingest audio files uploaded into chatbot knowledge.",enforceOnDowngrade:!1},DS_RECRAWL_WEEKLY:{minTier:"TURBO",label:"Weekly Auto-Recrawl",description:"Weekly auto-recrawl: automatically recrawl documents every week when enabled.",enforceOnDowngrade:!1},WIDGET_WIDGET_ICON:{minTier:"BASIC",label:"Custom Widget Icon",description:"Custom widget icon: replace the default chat bubble with own brand image.",enforceOnDowngrade:!0},WIDGET_BASIC_LANGUAGES:{minTier:"TURBO",label:"Widget Multiple Languages",description:"Widget multiple languages: add multiple languages to chatbot to support users who speak different languages.",enforceOnDowngrade:!0},WIDGET_DYNAMIC_GREETINGS:{minTier:"TURBO",label:"Widget Dynamic Greetings",description:"Widget dynamic greetings: widget greets visitors dynamically based on page content.",enforceOnDowngrade:!1},WIDGET_PAGE_CONTEXT:{minTier:"TURBO",label:"Page-Aware Answers",description:"Page-aware answers: the widget and search bar read the title and visible text of the page they are embedded on, so answers, follow-up questions, and suggested questions are tailored to what the visitor is currently viewing.",enforceOnDowngrade:!1},WIDGET_LEAD_CUSTOM_FIELDS:{minTier:"TURBO",label:"Custom Lead Fields",description:"Custom lead fields: configure and collect custom lead fields.",enforceOnDowngrade:!0},WIDGET_LEAD_CUSTOM_TRIGGERS:{minTier:"TURBO",label:"Custom Lead Triggers",description:"Custom lead triggers: trigger lead collection under customized conditions.",enforceOnDowngrade:!0},WIDGET_LEAD_IDENTITY_VERIFICATION:{minTier:"TURBO",label:"Lead Identity Verification",description:"Lead identity verification: verify visitors by email or phone number.",enforceOnDowngrade:!1},WIDGET_LEAD_CONSENT_CERTIFICATION:{minTier:"TURBO",label:"Lead consent certification (TrustedForm)",description:"Lead consent certification: load the TrustedForm script when a phone number is collected, show your TCPA disclosure by the phone field, and capture a TrustedForm certificate URL as third-party proof of consent.",enforceOnDowngrade:!1},WIDGET_LEAD_SCORING:{minTier:"TURBO",label:"AI Lead Scoring",description:"AI lead scoring: read each captured lead's conversation against your hot/warm criteria and tag it hot, warm, or cold, then route notifications by tier.",enforceOnDowngrade:!0},WIDGET_HUMAN_HANDOVER_CUSTOM:{minTier:"TURBO",label:"Custom Human Handover",description:"Custom human handover: custom triggers and handover form fields for human handover.",enforceOnDowngrade:!1},WIDGET_LIVE_CHAT:{minTier:"BASIC",label:"Live Chat",description:"Live chat: hand off conversations from the bot to a human agent in real time.",enforceOnDowngrade:!0},WIDGET_HOME_PAGE:{minTier:"BASIC",label:"Home Page",description:"Home page: show a customizable welcome screen with quick-start prompts when the chat widget opens.",enforceOnDowngrade:!0},WIDGET_CSS_CUSTOMIZATION:{minTier:"TURBO",label:"Widget CSS Customization",description:"Widget CSS customization: customize widget chat container and chat header with custom CSS.",enforceOnDowngrade:!1},WIDGET_EMBED_RESTRICTION:{minTier:"TURBO",label:"Widget Embed Restrictions",description:"Widget embed restrictions: restrict which websites can embed the chatbot widget.",enforceOnDowngrade:!1},WIDGET_GEO_BLOCKING:{minTier:"TURBO",label:"Widget Geo-Blocking",description:"Widget geo-blocking: restrict which countries visitors can access the chatbot from.",enforceOnDowngrade:!1},WIDGET_SPAM_FILTER:{minTier:"TURBO",label:"Widget Spam Filter",description:"Widget spam filter: automatically classify chat messages for spam, hiding detected spam from the default chat view and excluding it from correction flagging.",enforceOnDowngrade:!1},SECURITY_PII_REDACTION:{minTier:"TURBO",label:"PII Redaction",description:"PII redaction: scan user messages for personal information (emails, phone numbers, SSNs, credit cards, names, and more) and redact, detect, or block it before it reaches the model.",enforceOnDowngrade:!1},CHANNELS_PHONE_CALL:{minTier:"TURBO",label:"Phone Call Integration",description:"Phone call integration: connect a voice agent to answer inbound phone calls.",enforceOnDowngrade:!1},CHANNELS_MICROSOFT_TEAMS:{minTier:"TURBO",label:"Microsoft Teams Integration",description:"Microsoft Teams integration: send and receive chatbot messages in Microsoft Teams using a work or school account.",enforceOnDowngrade:!1},CHANNELS_DIALPAD:{minTier:"TURBO",label:"Dialpad Integration",description:"Dialpad integration: connect a Dialpad phone number so the chatbot can send and receive SMS.",enforceOnDowngrade:!1},CHANNELS_NYLAS_EMAIL:{minTier:"STARTER",label:"Nylas Integration",description:"Nylas integration: connect an email inbox via Nylas so the chatbot can receive and reply to support emails.",enforceOnDowngrade:!1},TOOLS_CHAT_WEBHOOKS:{minTier:"STARTER",label:"Chat Event Webhooks",description:"Chat event webhooks: send real-time notifications by calling a custom webhook, when a live chat starts, a human takes over, or a users send a message.",enforceOnDowngrade:!1},TOOLS_WONDERCHAT_WEB_SEARCH:{minTier:"BASIC",label:"Wonderchat Web Search",description:"Wonderchat web search: search web for relevant information during conversation.",enforceOnDowngrade:!0},TOOLS_WONDERCHAT_LIST_MORE_ITEMS:{minTier:"BASIC",label:"Wonderchat List More Items",description:"List more items: let the chatbot fetch and show additional results when a user asks to see more from a list it returned.",enforceOnDowngrade:!0},TOOLS_SHOPIFY:{minTier:"BASIC",label:"Shopify Integration",description:"Shopify integration: connect a Shopify store for order tracking and product search in conversations.",enforceOnDowngrade:!1},TOOLS_HUBSPOT_SYNC_CONTACTS:{minTier:"BASIC",label:"HubSpot Sync Contacts",description:"HubSpot sync contacts: sync captured contacts to HubSpot during a conversation.",enforceOnDowngrade:!0},TOOLS_HUBSPOT_GET_CONTACT:{minTier:"ENTERPRISE",label:"HubSpot Get Contact",description:"HubSpot get contact: look up existing contact details from HubSpot during a conversation.",enforceOnDowngrade:!0},TOOLS_HUBSPOT_UPDATE_CONTACT:{minTier:"ENTERPRISE",label:"HubSpot Update Contact",description:"HubSpot update contact: update contact details in HubSpot during a conversation.",enforceOnDowngrade:!0},TOOLS_MICROSOFT_DYNAMICS_LEADS:{minTier:"TURBO",label:"Microsoft Dynamics Sync Leads",description:"Microsoft Dynamics sync leads: sync captured leads to Microsoft Dynamics 365 Sales during a conversation.",enforceOnDowngrade:!1},TOOLS_SALESFORCE_LEADS:{minTier:"TURBO",label:"Salesforce Sync Leads",description:"Salesforce sync leads: sync captured leads to Salesforce during a conversation.",enforceOnDowngrade:!1},TOOLS_SALESFORCE_CASES:{minTier:"TURBO",label:"Salesforce Save Chat Transcripts",description:"Salesforce save chat transcripts: save live-agent chat transcripts as Salesforce Cases.",enforceOnDowngrade:!1},TOOLS_ZENDESK_CREATE_TICKET:{minTier:"TURBO",label:"Zendesk Create Ticket",description:"Zendesk create ticket: create a Zendesk supp
1ort ticket from a conversation.",enforceOnDowngrade:!0},TOOLS_FRESHDESK_CREATE_TICKET:{minTier:"TURBO",label:"Freshdesk Create Ticket",description:"Freshdesk create ticket: create a Freshdesk support ticket from a conversation.",enforceOnDowngrade:!0},TOOLS_ACTIVE_CAMPAIGN_SYNC_CONTACTS:{minTier:"BASIC",label:"ActiveCampaign Sync Contacts",description:"ActiveCampaign sync contacts: sync captured contacts to ActiveCampaign during a conversation.",enforceOnDowngrade:!0},TOOLS_KUSTOMER_SYNC_CONVERSATIONS:{minTier:"ENTERPRISE",label:"Kustomer Sync Conversations",description:"Kustomer sync conversations: sync conversations to Kustomer.",enforceOnDowngrade:!0},TOOLS_ELOQUA_SUBMIT_FORM:{minTier:"ENTERPRISE",label:"Eloqua Submit Form",description:"Eloqua submit form: submit captured data to an Eloqua form during a conversation.",enforceOnDowngrade:!0},TOOLS_MARKETO_DISPLAY_FORM:{minTier:"ENTERPRISE",label:"Marketo Display Form",description:"Marketo display form: display a Marketo form during a conversation.",enforceOnDowngrade:!0},TOOLS_PARDOT_SUBMIT_FORM:{minTier:"ENTERPRISE",label:"Pardot Submit Form",description:"Pardot submit form: submit captured lead data to a Pardot Form Handler endpoint during a conversation.",enforceOnDowngrade:!0},TOOLS_CUSTOM_EMBED_FORM:{minTier:"TURBO",label:"Custom Embed Form",description:"Custom embed form: display custom forms via iframe to capture leads.",enforceOnDowngrade:!1},TOOLS_MCP_CONNECTOR:{minTier:"SCALE",label:"MCP Connector",description:"MCP connector: connect the chatbot to a remote MCP server to use its tools.",enforceOnDowngrade:!0},MODERATE_IMPORT_CORRECTIONS:{minTier:"MINI",label:"Import Corrections",description:"Import corrections: bulk-upload answer corrections.",enforceOnDowngrade:!1},MODERATE_CHATLOG_TRANSLATION:{minTier:"TURBO",label:"Chatlog Translation",description:"Chatlog translation: view chatlogs in translated languages.",enforceOnDowngrade:!1},MODERATE_CHATLOG_AUTO_TAGGING:{minTier:"TURBO",label:"Chatlog Automatic Tagging",description:"Chatlog automatic tagging: automatically tag chatlogs to keep conversations neatly categorized and easy to find.",enforceOnDowngrade:!0},ANALYTICS_DASHBOARD:{minTier:"LITE",label:"Analytics Dashboard",description:"Analytics dashboard: view detailed analytics including trends, confidence levels, channel breakdowns, and top questions.",enforceOnDowngrade:!1},ANALYTICS_REGENERATE_MONTHLY_FAQ:{minTier:"TURBO",label:"Regenerate Monthly FAQ",description:"Regenerate monthly FAQ: regenerate monthly FAQ.",enforceOnDowngrade:!1},ANALYTICS_QA_PIPELINE:{minTier:"BASIC",label:"QA Pipeline",description:"QA pipeline: automatically review answers for conflicts and quality issues.",enforceOnDowngrade:!1},PLAYGROUND_MULTI_PROMPT:{minTier:"BASIC",label:"Multi-Prompt Playground",description:"Multi-prompt playground: test and compare multi prompt sets side by side in the evaluation playground.",enforceOnDowngrade:!1},ACCOUNT_API_KEY:{minTier:"MINI",label:"Account API Key",description:"Account API key: create and use account API keys to interact with Wonderchat programmatically.",enforceOnDowngrade:!1},ACCOUNT_WORKSPACE_TEAM:{minTier:"TURBO",label:"Workspace Team",description:"Workspace team: create team to manage chatbots from multiple accounts.",enforceOnDowngrade:!1},INTERNAL_HNSW_INDEX:{minTier:"TURBO",label:"Fast Vector Search",description:"Fast vector search: build HNSW index so large knowledge bases return answers with lower latency.",enforceOnDowngrade:!1},INTERNAL_LLAMA_PDF:{minTier:"TURBO",label:"LlamaParse",description:"LlamaParse: parse PDF using LlamaParse as fallback.",enforceOnDowngrade:!1},INTERNAL_AGENTIC_RAG:{minTier:"TURBO",label:"Agentic RAG",description:"Agentic RAG: improve response quality with agentic RAG that runs multi-turn searches across knowledge base.",enforceOnDowngrade:!1},INTERNAL_SEARCH_RULES:{minTier:"ENTERPRISE",label:"Search Rules",description:"Search rules: define rules to restrict search to specific content based on user queries.",enforceOnDowngrade:!1}};function s(e,n){return(0,t.BQ)(n,a[e].minTier)}function l(e){return a[e].minTier}function c(e){return r(l(e))}function d(){return Object.entries(a).map(e=>{let[n,i]=e;return{"Feature Key":n,"Feature Name":i.label,"Required Plan":r(i.minTier),Description:i.description}})}},81399:function(e,n,i){i.d(n,{FZ:function(){return r},KW:function(){return t},NS:function(){return a},l4:function(){return s}});let t={purchase:"custom_event_purchase",create:"click_button_create",addToCart:"custom_event_add_to_cart",signUp:"custom_event_sign_up",startForFree:"click_button_start_for_free",completeOnboarding:"click_button_create_my_first_chatbot",bookDemoEnterprise:"custom_event_book_a_demo_clicked_enterprise_chatbot",claimMyAgent:"click_button_claim_my_agent",pricingView:"page_view_pricing",copyToClipboard:"click_button_copy_to_clipboard"};function o(e){let n=window;if(n.dataLayer=n.dataLayer||[],n.dataLayer.push(e),window.parent&&window.parent!==window)try{let{user_data:n,...i}=e;window.parent.postMessage({source:"wonderchat-outcome",...i},"*")}catch(e){}}function r(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{email:i,...t}=n;o({event:e,...t,...i?{user_data:{email:i}}:{}})}let a={conversationStarted:"conversation_started",problemDescribed:"problem_described",promptBoosted:"prompt_boosted",dataSourceAdded:"data_source_added",agentBuilt:"agent_built",firstValue:"first_value",qualified:"qualified",buildQuestionAnswered:"build_question_answered",gateShown:"gate_shown",outcomeRouted:"outcome_routed",claimMyAgent:"claim_my_agent",bookADemo:"book_a_demo",generateLead:"generate_lead"};function s(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o({event:e,...n})}},22697:function(e,n,i){i.d(n,{$f:function(){return s},BQ:function(){return l},D5:function(){return u},EZ:function(){return r},Md:function(){return d},Mp:function(){return o},R8:function(){return c},YO:function(){return a}});var t=i(84790);i(70386);let o=e=>e?e.split(" ").map(e=>{var n;let i=e.toLowerCase();return(null===(n=i.charAt(0))||void 0===n?void 0:n.toUpperCase())+i.slice(1)}).join(" "):e;function r(e,n){let i=new Blob([function(e){let n=e=>{let n=String(null!=e?e:"");return n.includes(",")||n.includes('"')||n.includes("\n")?'"'.concat(n.replace(/"/g,'""'),'"'):n};return[Object.keys(e[0]).map(n).join(","),...e.map(e=>Object.values(e).map(n).join(","))].join("\n")}(e)],{type:"text/csv"}),t=URL.createObjectURL(i),o=document.createElement("a");o.href=t,o.download=n,o.click(),URL.revokeObjectURL(t)}function a(e){let n="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=i.length,o=0;for(;o<e;)n+=i.charAt(Math.floor(Math.random()*t)),o+=1;return n}function s(e,n){if(e.length!==n.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==n[i])return!1;return!0}function l(e,n){let i=e=>{let n=t.aq[null!=e?e:"NONE"];return(null==e?void 0:e.includes("ENTERPRISE"))?Math.max(n,t.aq.ENTERPRISE):n};return i(e)>=i(n)}function c(e,n){if(e.includes("utm_source"))return e;let[i,t]=e.split("#"),o=null==i?void 0:i.includes("?"),r=i;!o&&!(null==i?void 0:i.endsWith("/"))&&((null==i?void 0:i.toLowerCase().includes("armanino"))||(null==i?void 0:i.toLowerCase().includes("ridemss.com")))&&(r="".concat(i,"/"));let a="utm_source=".concat(encodeURIComponent(n)),s=o?"".concat(r,"&").concat(a):"".concat(r,"?").concat(a);return t?"".concat(s,"#").concat(t):s}function d(e){var n;let i=new Set(["gmail.com","yahoo.com","hotmail.com","outlook.com","live.com","msn.com","aol.com","icloud.com","me.com","mac.com","protonmail.com","tutanota.com","mail.com","yandex.com","zoho.com","fastmail.com","gmx.com","web.de","freenet.de","t-online.de","orange.fr","laposte.net","free.fr","wanadoo.fr","libero.it","virgilio.it","tiscali.it","terra.com.br","uol.com.br","bol.com.br","ig.com.br","globo.com","yahoo.co.jp","docomo.ne.jp","ezweb.ne.jp","softbank.ne.jp","naver.com","daum.
1net","nate.com","hanmail.net","qq.com","163.com","126.com","sina.com","sohu.com","yeah.net","139.com","189.cn","21cn.com","tom.com","foxmail.com","mail.ru","rambler.ru","yandex.ru","bk.ru","inbox.ru","list.ru","rediffmail.com","sify.com","indiatimes.com","rediff.com","gmail.co.in","yahoo.co.in","hotmail.co.in","outlook.co.in","live.co.in","msn.co.in","aol.co.in","icloud.co.in","me.co.in","mac.co.in","protonmail.co.in","tutanota.co.in","mail.co.in","yandex.co.in","zoho.co.in","fastmail.co.in","gmx.co.in","web.de","freenet.de","t-online.de","orange.fr","laposte.net","free.fr","wanadoo.fr","libero.it","virgilio.it","tiscali.it","terra.com.br","uol.com.br","bol.com.br","ig.com.br","globo.com","yahoo.co.jp","docomo.ne.jp","ezweb.ne.jp","softbank.ne.jp","naver.com","daum.net","nate.com","hanmail.net","qq.com","163.com","126.com","sina.com","sohu.com","yeah.net","139.com","189.cn","21cn.com","tom.com","foxmail.com","mail.ru","rambler.ru","yandex.ru","bk.ru","inbox.ru","list.ru","rediffmail.com","sify.com","indiatimes.com","rediff.com"]),t=null===(n=e.split("@")[1])||void 0===n?void 0:n.toLowerCase();return!!t&&!i.has(t)}function u(e){let n=e.trim();return n?/^https?:\/\//i.test(n)?n:"https://".concat(n):""}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.