PageSourceSearch

https://www.instagem.ai/assets/ProfileDiagnosticRegister-CiQJFNX2.js

js instagem.ai collected 2026-10-05 12:05:51 UTC 4,901 bytes, 1 lines download raw bytes

1import{j as e,I as R,a2 as F,c as b,o as L,A as _,a as I,u as T,b as V,r as a,e as q,d7 as B,t as C,v as M,a3 as U,b5 as $,L as D}from"./main-DX7XzkoU.js";import{u as H}from"./useAuthFlow-FWX3SGoC.js";import{E as Y,S as z,a as O,D as Q}from"./Shell-Be4b4G4B.js";import{f as W,p as G,i as J}from"./phone-h24k5Ibv.js";import{A as E}from"./routes-C6M2Yg1X.js";import"./subscriberService-DJIuIlbz.js";import"./avatar-DOhOFDwI.js";import"./list-checks-C7F0SyKS.js";const K=({eyebrow:o,title:s,lead:i,hint:g,type:m,placeholder:r,autoComplete:f,value:n,onChange:S,onSubmit:j,onBack:p,error:l,cta:w,busy:c,footer:x})=>e.jsxs("form",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300",noValidate:!0,onSubmit:t=>{t.preventDefault(),j()},children:[e.jsx(Y,{children:o}),e.jsx(z,{children:s}),e.jsx(O,{children:i}),e.jsx(R,{type:m,inputMode:m==="tel"?"tel":void 0,placeholder:r,autoComplete:f,autoFocus:!0,value:n,onChange:t=>S(t.target.value),"aria-label":s,"aria-invalid":!!l,disabled:c,className:F("mt-8 h-14 rounded-xl bg-card text-lg shadow-sm",l&&"border-destructive focus-visible:ring-destructive")}
1),l?e.jsx("p",{role:"alert",className:"mt-3 text-sm font-medium text-destructive",children:l}):g?e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:g}):null,e.jsxs("div",{className:"mt-9 flex flex-wrap items-center gap-3",children:[e.jsxs(b,{type:"submit",size:"lg",disabled:c,className:"w-full gap-2 sm:w-auto",children:[c?e.jsx(L,{className:"h-4 w-4 animate-spin"}):null,w,!c&&e.jsx(_,{className:"h-4 w-4"})]}),e.jsx(b,{type:"button",variant:"ghost",onClick:p,disabled:c,children:"Voltar"})]}),x]}),v=["email","phone","password","name"],X={email:{title:"Para onde vai o seu diagnóstico?",lead:"Ele é gratuito. Com esses dados ele fica salvo no seu nome — você abre quando quiser, sem responder nada de novo.",type:"email",placeholder:"[email protected]",autoComplete:"email",error:"Digite um e-mail válido."},phone:{title:"Qual é o seu WhatsApp?",lead:"É por onde a gente fala com você se precisar de ajuda para colocar o diagnóstico em prática.",hint:"DDD e número.",type:"tel",placeholder:"(11) 91234-5678",autoComplete:"tel",error:"Digite o DDD e o número, como (11) 91234-5678."},password:{title:"Crie uma senha",lead:"É com ela que você entra de novo para rever o seu diagnóstico.",hint:"Pelo menos 6 caracteres.",type:"password",placeholder:"sua senha",autoComplete:"new-password",error:"Sua senha precisa de pelo menos 6 caracteres."},name:{title:"Como podemos te chamar?",lead:"Última coisa. Depois é só conectar seu Instagram e o diagnóstico sai.",type:"text",placeholder:"Seu nome",autoComplete:"name",error:"Digite seu nome."}},Z=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,ee=(o,s)=>{const i=s.trim();return o==="email"?Z.test(i):o==="phone"?J(i):o==="password"?s.length>=6:i.length>=2},ce=()=>{const o=I(),{user:s}=T(),{t:i}=V(),{isLoading:g,signUp:m}=H(),[r,f]=a.useState(0),[n,S]=a.useState({email:"",phone:"",password:"",name:""}),[j,p]=a.useState(null),l=a.useRef(!1),[w,c]=a.useState(!1),x=a.useRef(!1),t=v[r],u=X[t],h=r===v.length-1;q(),a.useEffect(()=>{B()},[]),a.useEffect(()=>{window.scrollTo({top:0,behavior:"smooth"})},[r]),a.useEffect(()=>{C("diagnostic_signup_step",{step:t},void 0,t)},[t]),a.useEffect(()=>{!s||x.current||(x.current=!0,C("register_complete",{page:"/diagnostico/cadastro"},s.id),M(s.id))},[s]),a.useEffect(()=>{s&&(l.current||o(E,{replace:!0}))},[s,w,o]);const N=a.useCallback(d=>{S(P=>({...P,[t]:t==="phone"?W(d):d})),p(null)},[t]),y=a.useCallback(()=>{if(!ee(t,n[t])){p(u.error);return}if(!h){f(d=>d+1);return}l.current=!0,c(!1),U(E),(async()=>(await m({email:n.email.trim(),password:n.password,name:n.name.trim(),phone:G(n.phone),instagramUsername:"",signupFlow:"diagnostic"})).ok||($(),l.current=!1,c(!0)))()},[u.error,t,h,m,n]),k=a.useCallback(()=>{p(null),r>0?f(d=>d-1):o("/diagnostico")},[o,r]),A=a.useMemo(()=>h?e.jsxs("p",{className:"mt-8 text-xs leading-relaxed text-muted-foreground",children:["Ao continuar, você cria seu acesso e concorda com os"," ",e.jsx(D,{to:"/terms",className:"text-primary hover:underline",children:"Termos de Serviço"})," e a"," ",e.jsx(D,{to:"/privacy",className:"text-primary hover:underline",children:"Política de Privacidade"}),"."]}):null,[h]);return e.jsxs(Q,{counter:`${r+1} de ${v.length}`,steps:{total:v.length,current:r+1},children:[e.jsx(K,{eyebrow:"Diagnóstico gratuito",title:u.title,lead:u.lead,hint:u.hint,type:u.type,placeholder:u.placeholder,autoComplete:u.autoComplete,value:n[t],onChange:N,onSubmit:y,onBack:k,error:j,cta:h?"Salvar e continuar":"Continuar",busy:g,footer:A},t),e.jsxs("div",{className:"mt-10 border-t pt-6 text-center text-xs leading-relaxed text-muted-foreground",children:[e.jsx("p",{className:"font-medium",children:i("auth.company_info.name")}),e.jsx("p",{className:"mt-1",children:i("auth.company_info.address")})]})]})};export{ce 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.