| Current Path : /home/users/unlimited/www/whatsapp-crm/public/build/assets/ |
| Current File : /home/users/unlimited/www/whatsapp-crm/public/build/assets/Invite-ba34a99b.js |
import{r as _,T as S,m as U,q as Z,R as D,c as n,a as t,f as d,g as k,u as a,t as l,k as V,b as C,h as $,n as u,o as i,l as A}from"./app-f1493ab2.js";import{_ as p}from"./FormInput-b3450213.js";import{u as R,a as z}from"./ReCaptcha-55f58cbf.js";const E={class:"flex h-screen justify-center"},F={class:"flex justify-center items-center"},L={key:0,class:"w-[25em]"},P={class:"flex justify-center mb-5"},G=["src","alt"],H={key:1,class:"text-2xl mb-2"},I={class:"text-2xl text-center"},q={key:0},K={key:1},O={key:0,class:"text-center text-sm text-slate-500 mt-5"},Y={class:"mt-5 grid grid-cols-2 space-x-4"},J={class:""},Q={class:""},W={class:"mt-5"},X={class:"mt-5 grid grid-cols-2 space-x-4"},ee={class:""},te={class:""},se={key:0,class:"form-error text-[#b91c1c] text-xs"},oe={class:"mt-6"},ae={key:0,type:"submit",class:"rounded-md bg-primary px-3 py-3 text-sm text-white shadow-sm w-full"},re={key:1,type:"button",class:"rounded-md bg-primary px-3 py-3 text-sm text-white shadow-sm w-full flex justify-center"},ne={class:"mt-10"},ie={key:0,type:"submit",class:"rounded-md bg-primary px-3 py-3 text-sm text-white shadow-sm w-full"},le={key:1,type:"button",class:"rounded-md bg-primary px-3 py-3 text-sm text-white shadow-sm w-full flex justify-center"},me={key:1,class:"w-[25em]"},de={class:"text-2xl text-center"},ce={class:"mt-10 text-center"},he={__name:"Invite",props:["flash","config","organization","companyConfig","invite","user"],setup(T){var w,v,x,g;const r=T,j=_((w=r.invite)==null?void 0:w.expire_at),M=_(new Date().toISOString()),f=_(!1),s=S({first_name:(v=r.user)==null?void 0:v.first_name,last_name:(x=r.user)==null?void 0:x.last_name,email:(g=r.invite)==null?void 0:g.email,password:null,password_confirmation:null,code:r.code,recaptcha_response:null}),c=o=>{const e=r.config.find(h=>h.key===o);return e?e.value:""};r.user&&delete s.password;const B=U(()=>{const o=new Date(j.value),e=new Date(M.value);return o<e}),y=async()=>{if(f.value=!0,c("recaptcha_active")==="1"){const o=await N();s.recaptcha_response=o}s.post("",{onSuccess:()=>s.reset(),onFinish:()=>{f.value=!1}})},N=()=>new Promise(o=>{grecaptcha.ready(()=>{grecaptcha.execute(c("recaptcha_site_key"),{action:"submit"}).then(e=>{o(e)})})});return Z(()=>{c("recaptcha_active")==="1"&&R(c("recaptcha_site_key"))}),D(()=>{z(c("recaptcha_site_key"))}),(o,e)=>{var h,b;return i(),n("div",E,[t("div",F,[B.value?(i(),n("div",me,[t("h1",de,l(o.$t("This invite link has expired. Contact the account owner to send you another link")),1),t("div",ce,[d(a(A),{href:"/login",type:"button",class:"rounded-md bg-primary px-3 py-3 text-sm text-white shadow-sm w-full"},{default:k(()=>[V(l(o.$t("Go to login")),1)]),_:1})])])):(i(),n("div",L,[t("div",P,[d(a(A),{href:"/"},{default:k(()=>[r.companyConfig.logo?(i(),n("img",{key:0,class:"max-w-[180px]",src:"/media/"+r.companyConfig.logo,alt:r.companyConfig.company_name},null,8,G)):(i(),n("h4",H,l(r.companyConfig.company_name),1))]),_:1})]),t("h3",I,[r.user?(i(),n("span",q,l(o.$t("Hi"))+" "+l((h=r.user)==null?void 0:h.first_name),1)):(i(),n("span",K,l(o.$t("Hi")),1)),V(", "+l(o.$t("You have been invited to join"))+" "+l((b=r==null?void 0:r.organization)==null?void 0:b.name),1)]),r.user?C("",!0):(i(),n("div",O,l(o.$t("Get started by entering your details below")),1)),r.user?(i(),n("form",{key:2,onSubmit:e[6]||(e[6]=$(m=>y(),["prevent"]))},[t("div",ne,[f.value?(i(),n("button",le,e[8]||(e[8]=[t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},[t("path",{fill:"currentColor",d:"M12 2A10 10 0 1 0 22 12A10 10 0 0 0 12 2Zm0 18a8 8 0 1 1 8-8A8 8 0 0 1 12 20Z",opacity:".5"}),t("path",{fill:"currentColor",d:"M20 12h2A10 10 0 0 0 12 2V4A8 8 0 0 1 20 12Z"},[t("animateTransform",{attributeName:"transform",dur:"1s",from:"0 12 12",repeatCount:"indefinite",to:"360 12 12",type:"rotate"})])],-1)]))):(i(),n("button",ie,l(o.$t("Proceed to join")),1))])],32)):(i(),n("form",{key:1,onSubmit:e[5]||(e[5]=$(m=>y(),["prevent"])),class:"mt-5"},[t("div",Y,[t("div",J,[d(p,{modelValue:a(s).first_name,"onUpdate:modelValue":e[0]||(e[0]=m=>a(s).first_name=m),name:o.$t("First name"),type:"text",error:a(s).errors.first_name,class:u("w-full"),labelClass:"mb-0"},null,8,["modelValue","name","error"])]),t("div",Q,[d(p,{modelValue:a(s).last_name,"onUpdate:modelValue":e[1]||(e[1]=m=>a(s).last_name=m),name:o.$t("Last name"),type:"text",error:a(s).errors.last_name,class:u("w-full"),labelClass:"mb-0"},null,8,["modelValue","name","error"])])]),t("div",W,[d(p,{modelValue:a(s).email,"onUpdate:modelValue":e[2]||(e[2]=m=>a(s).email=m),name:o.$t("Email"),type:"email",disabled:!0,error:a(s).errors.email,class:u("w-full"),labelClass:"mb-0"},null,8,["modelValue","name","error"])]),t("div",X,[t("div",ee,[d(p,{modelValue:a(s).password,"onUpdate:modelValue":e[3]||(e[3]=m=>a(s).password=m),name:o.$t("Password"),type:"password",error:a(s).errors.password,class:u("w-full"),labelClass:"mb-0"},null,8,["modelValue","name","error"])]),t("div",te,[d(p,{modelValue:a(s).password_confirmation,"onUpdate:modelValue":e[4]||(e[4]=m=>a(s).password_confirmation=m),name:o.$t("Confirm password"),type:"password",error:a(s).errors.password_confirmation,class:u("w-full")},null,8,["modelValue","name","error"])])]),a(s).errors.recaptcha_response?(i(),n("div",se,l(a(s).errors.recaptcha_response),1)):C("",!0),t("div",oe,[f.value?(i(),n("button",re,e[7]||(e[7]=[t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24"},[t("path",{fill:"currentColor",d:"M12 2A10 10 0 1 0 22 12A10 10 0 0 0 12 2Zm0 18a8 8 0 1 1 8-8A8 8 0 0 1 12 20Z",opacity:".5"}),t("path",{fill:"currentColor",d:"M20 12h2A10 10 0 0 0 12 2V4A8 8 0 0 1 20 12Z"},[t("animateTransform",{attributeName:"transform",dur:"1s",from:"0 12 12",repeatCount:"indefinite",to:"360 12 12",type:"rotate"})])],-1)]))):(i(),n("button",ae,l(o.$t("Create account")),1))])],32))]))])])}}};export{he as default};