1import{z as j,a5 as le,au as z,A as Q,C as _,D as v,Y as re,c as u,a,I as m,H as d,L as h,aQ as K,av as S,G as n,F as r,d as c,b as ne,a9 as L,o as i,aq as Y,ab as ie,a2 as ue,a7 as de,a8 as pe,a4 as E,J as ce,aa as me,w as ve}from"./Cpu_K97E.js";import ge from"./CaJHAZD2.js";import U from"./BlojuEHE.js";import J from"./DZzsTEBe.js";import xe from"./BUvgwiu2.js";import fe from"./yBPzk9sn.js";import{P as ye}from"./D-b9bvil.js";import{p as be,j as he,k as _e,e as we,q as Ce,o as Ie,l as ke,t as Ve}from"./BpLuA9bf.js";import{p as Te}from"./UnZzG3sN.js";import{u as Pe}from"./B45pU4cU.js";import{g as $e}from"./D20Yte9O.js";import"./C-y7IWaC.js";import"./DH6812tT.js";import"./D1_AOPDD.js";import"./Bm__A-E1.js";import"./DHpylnHO.js";import"./WuPYG-_L.js";import"./QdJSlGum.js";import"./nMccuTVk.js";import"./CvDWoXJ6.js";import"./C_DJsIz0.js";import"./BBGqXCjM.js";import"./pqQEp_cG.js";import"./2GC6Bc8a.js";import"./Bs9hQx6G.js";import"./BMFC9Eha.js";import"./D47hPbaO.js";import"./B7O6wAqr.js";import"./D-Do5YRj.js";import"./2vXRn9-w.js";import"./C7CFqEtJ.js";import"./fLROM2lP.js";import"./B1cQrtP-.js";import"./Bwzs2Pu4.js";import"./C47uH6Aj.js";import"./Butf941G.js";(function(){try{var x=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},p=new x.Error().stack;p&&(x._sentryDebugIds=x._sentryDebugIds||{},x._sentryDebugIds[p]="4006cc48-f771-46a5-a6a7-5b5f0384a21a",x._sentryDebugIdIdentifier="sentry-dbid-4006cc48-f771-46a5-a6a7-5b5f0384a21a")}catch{}})();const Ae={key:0},Se={class:"mb-4"},Ue={key:0,class:"text-red-500 text-xs mt-1 block"},Ne={class:"mb-4"},Re={class:"relative"},De={key:0,class:"text-red-500 text-xs mt-1 block"},Ee={key:1},Le={class:"mb-4"},Fe={key:0,class:"text-red-500 text-xs mt-1 block"},Oe={class:"mb-4"},qe={key:0,class:"text-red-500 text-xs mt-1 block"},Be={key:1,class:"text-gray-500 text-xs mt-1 block"},He={class:"mb-4"},Me={class:"flex gap-2"},Ge={key:0,class:"flex items-center gap-1"},Ke={class:"text-xs text-gray-500"},Je={class:"text-sm"},je={class:"flex items-center gap-2 whitespace-nowrap"},ze={class:"text-xs text-gray-500"},Qe={class:"text-xs text-gray-400"},Ye={key:0,class:"text-red-500 text-xs mt-1 block"},We={class:"mb-6"},Xe={class:"flex items-start gap-2"},Ze={for:"tos",class:"text-sm text-gray-700 cursor-pointer"},et={key:0,class:"text-red-500 text-xs mt-1 block ml-6"},tt="/legal/general-terms",at="/legal/terms",st=j({__name:"CustomerSignupForm",props:{redirectOnCompleted:{}},emits:["registration-completed","registration-error","already-registered"],setup(x,{emit:p}){const f=le("CustomerSignup"),V=p,N=z(),{t:R}=Q(),g=Pe(),y=_(1),e=_({email:"",password:"",name:"",taxId:"",taxIdType:"NATURAL_PERSON",phone:"",countryCode:"BR",tosAccepted:!1}),w=_(!1),T=_(!1),b=_(!1),C=Te,s=_({email:"",password:"",name:"",taxId:"",phone:"",tos:""}),F=v(()=>we.isValid(e.value.email)),O=v(()=>Ce.isValid(e.value.password)),W=v(()=>F.value&&O.value),q=v(()=>{const l=e.value.name;return l.length>0&&/\s/.test(l)&&!/[0-9]/.test(l)}),B=v(()=>{const l=e.value.taxId.replace(/[^\d]/g,"");return l.length===11||l.length===14?Ie.isValid(e.value.taxId):!1}),P=v(()=>C.find(l=>l.code===e.value.countryCode)||C[0]),H=v(()=>ke(e.value.phone,P.value)),X=v(()=>q.value&&B.value&&H.value&&e.value.tosAccepted);re(()=>e.value.taxId,l=>{l.replace(/[^\d]/g,"").length<12?e.value.taxIdType="NATURAL_PERSON":e.value.taxIdType="LEGAL_PERSON"});const Z=l=>{const o=l.target.value.replace(/[^\d]/g,"").slice(0,14);e.value.taxId=be(o)},ee=l=>l.length<=3?l:l.length<=6?`(${l.slice(0,3)}) ${l.slice(3)}`:`(${l.slice(0,3)}) ${l.slice(3,6)}-${l.slice(6)}`,te=l=>{const t=l.target,o=he(t.value,P.value);e.value.countryCode==="BR"?e.value.phone=_e(o):e.value.countryCode==="US"||e.value.countryCode==="CA"?e.value.phone=ee(o):e.value.phone=o},M=v(()=>{const l=e.value.taxId.replace(/[^\d]/g,"");return l.length===11?"Pagamentos a partir da sua conta ou cartão pessoal":l.length===14?"Pagamentos a partir da sua conta ou cartão da sua empresa":""}),ae=()=>Ve(e.value.phone,P.value),D=()=>{if(s.value.email="",s.value.password="",!F.value){s.value.email="Digite um e-mail válido";return}if(!O.value){s.value.password="A senha não atende aos requisitos";return}y.value=2},se=()=>{y.value=1},oe=async()=>{var l,t,o,$,A;if(s.value.name="",s.value.taxId="",s.value.phone="",s.value.tos="",!q.value){s.value.name="Insira seu nome completo";return}if(!B.value){s.value.taxId=e.value.taxIdType==="NATURAL_PERSON"?"CPF inválido":"CNPJ inválido";return}if(!H.value){s.value.phone="Telefone inválido";return}if(!e.value.tosAccepted){s.value.tos="Você precisa aceitar os termos";return}b.value=!0,f.info("[AUTH] Customer registration started",{taxIdType:e.value.taxIdType,countryCode:e.value.countryCode});try{await $fetch(`${g}/customer-signup`,{method:"POST",body:{name:e.value.name,email:e.value.email.trim(),password:e.value.password,taxId:e.value.taxId.replace(/[^\d]/g,""),taxIdType:e.value.taxIdType,phone:ae(),tosAccepted:e.value.tosAccepted},credentials:"include"}),f.info("[AUTH] Customer registration completed successfully",{taxIdType:e.value.taxIdType}),V("registration-completed")}catch(I){const k=I;if(((l=k.data)==null?void 0:l.errorCode)==="customer.user-account-with-same-email-already-exists")f.warn("[AUTH] Customer registration failed - email already exists",{errorCode:(t=k.data)==null?void 0:t.errorCode}),V("already-registered",e.value.email.trim());else{const G=((o=k.data)==null?void 0:o.userMessage)||R("auth.accountCreationError");f.error("[AUTH] Customer registration failed",I,{errorCode:($=k.data)==null?void 0:$.errorCode,httpStatus:k.status,userMessage:(A=k.data)==null?void 0:A.userMe
1ssage}),N.add({severity:"error",summary:R("common.error"),detail:G,life:5e3}),V("registration-error",G)}}finally{b.value=!1}};return(l,t)=>(i(),u("form",{onSubmit:t[9]||(t[9]=S(o=>y.value===1?D():oe(),["prevent"]))},[y.value===1?(i(),u("div",Ae,[a("div",Se,[t[10]||(t[10]=a("label",{for:"email",class:"block text-sm font-medium text-gray-700 mb-1"},[m(" E-mail "),a("span",{class:"text-red-500"},"*")],-1)),d(n(U),{id:"email",modelValue:e.value.email,"onUpdate:modelValue":t[0]||(t[0]=o=>e.value.email=o),type:"email",placeholder:"Digite seu e-mail",class:h(["w-full",{"p-invalid":s.value.email}]),onKeypress:K(S(D,["prevent"]),["enter"])},null,8,["modelValue","class","onKeypress"]),s.value.email?(i(),u("small",Ue,r(s.value.email),1)):c("",!0)]),a("div",Ne,[t[11]||(t[11]=a("label",{for:"password",class:"block text-sm font-medium text-gray-700 mb-1"},[m(" Senha "),a("span",{class:"text-red-500"},"*")],-1)),a("div",Re,[d(n(U),{id:"password",modelValue:e.value.password,"onUpdate:modelValue":t[1]||(t[1]=o=>e.value.password=o),type:w.value?"text":"password",placeholder:"Digite sua senha",class:h(["w-full pr-10",{"p-invalid":s.value.password}]),onFocus:t[2]||(t[2]=o=>T.value=!0),onKeypress:K(S(D,["prevent"]),["enter"])},null,8,["modelValue","type","class","onKeypress"]),a("button",{type:"button",class:"absolute right-3 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700",onClick:t[3]||(t[3]=o=>w.value=!w.value)},[a("i",{class:h(w.value?"pi pi-eye-slash":"pi pi-eye")},null,2)])]),s.value.password?(i(),u("small",De,r(s.value.password),1)):c("",!0)]),T.value?(i(),ne(ye,{key:0,password:e.value.password},null,8,["password"])):c("",!0),d(n(J),{type:"submit",label:"Continuar",icon:"pi pi-arrow-right",iconPos:"right",class:"w-full btn-primary mt-6",disabled:!W.value},null,8,["disabled"])])):c("",!0),y.value===2?(i(),u("div",Ee,[a("button",{type:"button",class:"flex items-center text-gray-600 hover:text-gray-800 mb-4",onClick:se},t[12]||(t[12]=[a("i",{class:"pi pi-chevron-left mr-1"},null,-1),m(" Voltar ")])),a("div",Le,[t[13]||(t[13]=a("label",{for:"name",class:"block text-sm font-medium text-gray-700 mb-1"},[m(" Nome "),a("span",{class:"text-red-500"},"*")],-1)),d(n(U),{id:"name",modelValue:e.value.name,"onUpdate:modelValue":t[4]||(t[4]=o=>e.value.name=o),type:"text",placeholder:"Digite seu nome completo",class:h(["w-full",{"p-invalid":s.value.name}])},null,8,["modelValue","class"]),s.value.name?(i(),u("small",Fe,r(s.value.name),1)):c("",!0)]),a("div",Oe,[t[14]||(t[14]=a("label",{for:"taxId",class:"block text-sm font-medium text-gray-700 mb-1"},[m(" CPF ou CNPJ "),a("span",{class:"text-red-500"},"*")],-1)),d(n(U),{id:"taxId",value:e.value.taxId,type:"text",inputmode:"numeric",placeholder:"Digite seu CPF ou CNPJ",class:h(["w-full",{"p-invalid":s.value.taxId}]),onInput:Z},null,8,["value","class"]),s.value.taxId?(i(),u("small",qe,r(s.value.taxId),1)):M.value?(i(),u("small",Be,r(M.value),1)):c("",!0)]),a("div",He,[t[15]||(t[15]=a("label",{for:"phone",class:"block text-sm font-medium text-gray-700 mb-1"},[m(" Telefone "),a("span",{class:"text-red-500"},"*")],-1)),a("div",Me,[d(n(fe),{modelValue:e.value.countryCode,"onUpdate:modelValue":t[5]||(t[5]=o=>e.value.countryCode=o),options:n(C),optionLabel:"filterText",optionValue:"code",filter:"",class:"w-32 flex-shrink-0",pt:{panel:{class:"min-w-60"}}},{value:L(o=>{var $,A;return[o.value?(i(),u("div",Ge,[a("span",null,r(($=n(C).find(I=>I.code===o.value))==null?void 0:$.flag),1),a("span",Ke,r(o.value),1),a("span",Je,r((A=n(C).find(I=>I.code===o.value))==null?void 0:A.label),1)])):c("",!0)]}),option:L(o=>[a("div",je,[a("span",null,r(o.option.flag),1),a("span",ze,r(o.option.code),1),a("span",null,r(o.option.label),1),a("span",Qe,r(o.option.name),1)])]),_:1},8,["modelValue","options"]),d(n(U),{id:"phone",value:e.value.phone,type:"tel",inputmode:"numeric",placeholder:e.value.countryCode==="BR"?"(00) 00000-0000":`${P.value.minDigits}-${P.value.maxDigits} digits`,class:h(["flex-1",{"p-invalid":s.value.phone}]),onInput:te},null,8,["value","placeholder","class"])]),s.value.phone?(i(),u("small",Ye,r(s.value.phone),1)):c("",!0)]),a("div",We,[a("div",Xe,[d(n(xe),{modelValue:e.value.tosAccepted,"onUpdate:modelValue":t[6]||(t[6]=o=>e.value.tosAccepted=o),binary:!0,inputId:"tos",class:h({"p-invalid":s.value.tos})},null,8,["modelValue","class"]),a("label",Ze,[t[16]||(t[16]=m(" Declaro que li e aceito os ")),a("a",{href:tt,target:"_blank",class:"text-gradient font-medium hover:underline",onClick:t[7]||(t[7]=S(()=>{},["stop"]))}," Termos de Serviço e Condições Gerais da Plataforma Glin "),t[17]||(t[17]=m(" e os ")),a("a",{href:at,target:"_blank",class:"text-gradient font-medium hover:underline",onClick:t[8]||(t[8]=S(()=>{},["stop"]))}," Termos de Serviço Glinpay ")])]),s.value.tos?(i(),u("small",et,r(s.value.tos),1)):c("",!0)]),d(n(J),{type:"submit",label:"Cadastrar",icon:"pi pi-check",iconPos:"right",class:"w-full btn-primary",loading:b.value,disabled:!X.value||b.value},null,8,["loading","disabled"])])):c("",!0)],32))}}),ot=Y(st,[["__scopeId","data-v-c46805e9"]]),lt={class:"w-full max-w-md"},rt={class:"bg-white rounded-2xl shadow-xl p-8"},nt={class:"flex justify-center mb-6"},it=["src"],ut={class:"text-2xl font-semibold text-center text-gray-800 mb
1-2"},dt={class:"text-center text-gray-600 mb-6"},pt={class:"text-center text-gray-600 mt-6"},ct=j({__name:"signup",setup(x){var T;const{t:p}=Q();ie({title:p("customerPages.signup.pageTitle"),meta:[{name:"description",content:p("customerPages.signup.pageDescription")}]});const f=ue(),V=ve(),N=de(),{currentUser:R}=pe(N);z();const g=_(f.query.redirectOnCompleted||"/customer/dashboard");(T=R.value)!=null&&T.customer&&E(g.value);const y=async()=>{await N.setUser(),g.value.includes("portal")?window.location.href=`${V.public.appUrl}/`:E(g.value)},e=b=>{E({path:"/login",query:{redirectTo:g.value}})},w=b=>{};return(b,C)=>{const s=me;return i(),u(ce,null,[d(n(ge),{position:"top-center"}),a("div",lt,[a("div",rt,[a("div",nt,[a("img",{src:n($e),alt:"Glin",class:"h-10"},null,8,it)]),a("h1",ut,r(n(p)("customerPages.signup.title")),1),a("p",dt,r(n(p)("customerPages.signup.subtitle")),1),d(ot,{"redirect-on-completed":g.value,onRegistrationCompleted:y,onAlreadyRegistered:e,onRegistrationError:w},null,8,["redirect-on-completed"]),a("p",pt,[m(r(n(p)("customerPages.signup.alreadyRegistered"))+" ",1),d(s,{to:{path:"/login",query:{redirectTo:g.value}},class:"text-gradient font-semibold hover:underline ml-1"},{default:L(()=>[m(r(n(p)("customerPages.signup.login")),1)]),_:1},8,["to"])])])])],64)}}}),Qt=Y(ct,[["__scopeId","data-v-949471c7"]]);export{Qt as default};
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.