PageSourceSearch

https://www.tatemweb.com/assets/profile-CmfiQKcu.js

js tatemweb.com collected 2026-10-05 02:04:51 UTC 15,786 bytes, 1 lines download raw bytes

1import{f as re,a as r,u as Q,e as ae,j as e}from"./vendor-query-ClCD5UFq.js";import{N as ie,F as ne,k as oe}from"./index-DLFIeQ52.js";import{u as le,L as K}from"./vendor-router-CA2L_-_-.js";import{u as de}from"./use-toast-BvLT171a.js";import{v as ce,au as he,U as M,M as ue,aI as pe,d as me,b as ye,aJ as ge,ar as xe,aK as fe,aA as be}from"./vendor-icons-yyd94Ngs.js";import"./vendor-react-BI6t_jha.js";const i={width:"100%",padding:".55rem .9rem",background:"rgba(255,255,255,0.04)",border:"1px solid rgba(255,255,255,0.12)",borderRadius:9,color:"var(--wt)",fontSize:".88rem",outline:"none"},je={...i,background:"rgba(255,255,255,0.02)",color:"var(--mut)",cursor:"not-allowed",border:"1px solid rgba(255,255,255,0.06)"},n={display:"block",fontSize:".72rem",fontWeight:700,color:"var(--mut)",marginBottom:".4rem",letterSpacing:".03em"},p={fontFamily:"var(--body)",fontSize:".82rem",fontWeight:700,color:"var(--wt)",textTransform:"none",display:"flex",alignItems:"center",gap:".5rem",marginBottom:"1rem"},m={borderTop:"1px solid rgba(255,255,255,0.07)",paddingTop:"1.5rem",marginTop:"1.5rem"},J={background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:12,padding:"1rem 1.1rem"},c={fontSize:".75rem",fontWeight:600,padding:".4rem .85rem",borderRadius:8,border:"1px solid rgba(255,255,255,0.12)",background:"rgba(255,255,255,0.05)",color:"var(--mut)",cursor:"pointer"},U={fontSize:".75rem",fontWeight:600,padding:".4rem .85rem",borderRadius:8,border:"1px solid rgba(248,113,113,0.30)",background:"rgba(248,113,113,0.08)",color:"#f87171",cursor:"pointer"},P={fontSize:".8rem",fontWeight:700,padding:".55rem 1.15rem",borderRadius:9,border:"none",background:"var(--org)",color:"#fff",cursor:"pointer",display:"flex",alignItems:"center",gap:".4rem"};function Fe(){const g=re(),[,x]=le(),{toast:o}=de(),[s,k]=r.useState({}),[f,F]=r.useState(!1),[H,b]=r.useState(!1),[j,N]=r.useState(!1),[T,E]=r.useState(""),[y,A]=r.useState(""),[z,B]=r.useState(""),[V,v]=r.useState(!1),[R,w]=r.useState(!1),[L,Y]=r.useState(""),[G,Z]=r.useState(""),[I,W]=r.useState(""),[D,O]=r.useState(""),{data:q,isLoading:S}=Q({queryKey:["/api/auth/session"],queryFn:async()=>(await fetch("/api/auth/session",{credentials:"include"})).json()}),h=!!(q?.isLoggedIn&&q?.userId),{data:l,isLoading:C}=Q({queryKey:["/api/auth/profile"],queryFn:async()=>{const t=await fetch("/api/auth/profile",{credentials:"include"});if(!t.ok)throw new Error("Failed to fetch profile");return t.json()},enabled:!!h});r.useEffect(()=>{l&&k({id:String(l.id),email:l.email,firstName:l.firstName,lastName:l.lastName,phone:l.phone,company:l.company,twoFactorEnabled:l.twoFactorEnabled})},[l]);const X=async()=>{if(y!==z){o({title:"Error",description:"Passwords do not match",variant:"destructive"});return}if(y.length<8){o({title:"Error",description:"Password must be at least 8 characters",variant:"destructive"});return}try{const t=await fetch("/api/auth/change-password",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({currentPassword:T,newPassword:y})}),a=await t.json();if(!t.ok)throw new Error(a.message);o({title:"Success",description:"Password changed successfully"}),N(!1),E(""),A(""),B("")}catch(t){o({title:"Error",description:t.message,variant:"destructive"})}},_=async()=>{try{const t=await fetch("/api/auth/2fa/setup",{method:"POST",credentials:"include"}),a=await t.json();if(!t.ok)throw new Error(a.message);Y(a.qrCode),Z(a.secret),v(!0)}catch(t){o({title:"Error",description:t.message,variant:"destructive"})}},$=async()=>{try{const t=await fetch("/api/auth/2fa/verify",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({code:I})}),a=await t.json();if(!t.ok)throw new Error(a.message);o({title:"Success",description:"Two-factor authentication enabled"}),v(!1),W(""),g.invalidateQueries({queryKey:["/api/auth/profile"]})}catch(t){o({title:"Error",description:t.message,variant:"destructive"})}},ee=async()=>{try{const t=await fetch("/api/auth/2fa/disable",{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({password:D})}),a=await t.json();if(!t.ok)throw new Error(a.message);o({title:"Success",description:"Two-factor authentication disabled"}),w(!1),O(""),g.invalidateQueries({queryKey:["/api/auth/profile"]})}catch(t){o({title:"Error",description:t.message,variant:"destructive"})}},u=ae({mutationFn:async t=>{const a=await fetch("/api/profile",{method:"PUT",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify(t)});if(!a.ok)throw new Error("Failed to update profile");return a.json()},onSuccess:()=>{g.invalidateQueries({queryKey:["/api/profile"]}),F(!1),b(!0),setTimeout(()=>b(!1),3e3)}}),d=(t,a)=>{k(se=>({...se,[t]:a})),F(!0),b(!1)},te=async()=>{await fetch("/api/auth/logout",{method:"POST",credentials:"include"}),x("/login")};return r.useEffect(()=>{!S&&!C&&!h&&x("/login")}
1,[S,C,h,x]),C||S?e.jsx("div",{className:"min-h-screen flex items-center justify-center",style:{background:"var(--ink)"},children:e.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-primary"})}):h?e.jsxs("div",{className:"min-h-screen font-sans flex flex-col",style:{background:"var(--ink)"},children:[e.jsx(ie,{}),e.jsx("main",{className:"flex-1",style:{paddingTop:96,paddingBottom:60},children:e.jsxs("div",{style:{maxWidth:760,margin:"0 auto",padding:"0 1.5rem"},children:[e.jsxs("div",{style:{marginBottom:"1.5rem"},children:[e.jsx("span",{className:"klabel",style:{color:"var(--org)",marginBottom:".4rem",display:"inline-flex"},children:"Account"}),e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{style:{fontFamily:"var(--disp)",fontSize:"1.6rem",color:"var(--wt)",lineHeight:1.1},children:"My Profile"}),e.jsx("p",{style:{color:"var(--mut)",fontSize:".83rem",marginTop:".25rem"},children:"Manage your account information"})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(K,{href:"/portal",children:e.jsxs("button",{type:"button",style:c,children:[e.jsx(ce,{style:{width:12,height:12,display:"inline",marginRight:".3rem"}}),"Portal"]})}),e.jsxs("button",{type:"button",onClick:te,style:c,children:[e.jsx(he,{style:{width:12,height:12,display:"inline",marginRight:".3rem"}}),"Logout"]})]})]})]}),H&&e.jsx("div",{style:{background:"rgba(74,222,128,0.08)",border:"1px solid rgba(74,222,128,0.25)",borderRadius:10,padding:".75rem 1rem",marginBottom:"1rem"},children:e.jsx("p",{style:{color:"#4ade80",fontSize:".85rem",fontWeight:600},children:"Profile updated successfully!"})}),e.jsxs("div",{style:{background:"var(--panel)",border:"1px solid rgba(255,255,255,0.09)",borderRadius:18,overflow:"hidden"},children:[e.jsxs("div",{style:{padding:"1.5rem 1.75rem",background:"rgba(21,87,244,0.10)",borderBottom:"1px solid rgba(255,255,255,0.07)",display:"flex",alignItems:"center",gap:"1rem"},children:[e.jsx("div",{style:{width:56,height:56,borderRadius:"50%",background:"rgba(21,87,244,0.20)",border:"1px solid rgba(21,87,244,0.35)",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:e.jsx(M,{style:{width:26,height:26,color:"var(--blue2)"}})}),e.jsxs("div",{children:[e.jsxs("p",{style:{color:"var(--wt)",fontWeight:700,fontSize:"1rem"},children:[s.firstName," ",s.lastName]}),e.jsx("p",{style:{color:"var(--mut)",fontSize:".82rem"},children:s.email})]})]}),e.jsxs("div",{style:{padding:"1.5rem 1.75rem"},children:[e.jsxs("p",{style:p,children:[e.jsx(M,{style:{width:14,height:14,color:"var(--blue2)"}})," Personal Information"]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",style:{marginBottom:"1.5rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:n,children:"First Name"}),e.jsx("input",{type:"text",style:i,value:s.firstName||"",onChange:t=>d("firstName",t.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Last Name"}),e.jsx("input",{type:"text",style:i,value:s.lastName||"",onChange:t=>d("lastName",t.target.value)})]})]}),e.jsxs("div",{style:m,children:[e.jsxs("p",{style:p,children:[e.jsx(ue,{style:{width:14,height:14,color:"var(--org)"}})," Contact Information"]}),e.jsxs("div",{className:"grid md:grid-cols-2 gap-4",style:{marginBottom:"1.5rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Email"}),e.jsx("input",{type:"email",style:je,value:s.email||"",disabled:!0}),e.jsx("p",{style:{fontSize:".7rem",color:"var(--mut)",marginTop:".3rem"},children:"Email cannot be changed"})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Phone"}),e.jsx("input",{type:"tel",style:i,value:s.phone||"",onChange:t=>d("phone",t.target.value),placeholder:"(555) 555-5555"})]})]})]}),e.jsxs("div",{style:m,children:[e.jsxs("p",{style:p,children:[e.jsx(pe,{style:{width:14,height:14,color:"var(--cyan)"}})," Business Information"]}),e.jsxs("div",{style:{marginBottom:"1.5rem"},children:[e.jsx("label",{style:n,children:"Company Name"}),e.jsx("input",{type:"text",style:i,value:s.company||"",onChange:t=>d("company",t.target.value),placeholder:"Your business name"})]})]}),e.jsxs("div",{style:m,children:[e.jsxs("p",{style:p,children:[e.jsx(me,{style:{width:14,height:14,color:"var(--org)"}})," Address"]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:".75rem",marginBottom:"1.5rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Street Address"}),e.jsx("input",{type:"text",style:i,value:s.address||"",onChange:t=>d("address",t.target.value),placeholder:"123 Main Street"})]}),e.jsxs("div",{className:"grid md:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{style:n,children:"City"}),e.jsx("input",{type:"text",style:i,value:s.city||"",onChange:t=>d("city",t.target.value),placeholder:"Stuart"})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"State"}),e.jsx("input",{type:"text",style:i,value:s.state||"",onChange:t=>d("state",t.target.value),placeholder:"FL"})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"ZIP Co
1de"}),e.jsx("input",{type:"text",style:i,value:s.zipCode||"",onChange:t=>d("zipCode",t.target.value),placeholder:"34994"})]})]})]})]}),h&&e.jsxs("div",{style:m,children:[e.jsxs("p",{style:p,children:[e.jsx(ye,{style:{width:14,height:14,color:"var(--mut)"}})," Security Settings"]}),e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:".75rem",marginBottom:"1.5rem"},children:[e.jsxs("div",{style:J,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".75rem"},children:[e.jsx(ge,{style:{width:15,height:15,color:"var(--mut)"}}),e.jsxs("div",{children:[e.jsx("p",{style:{color:"var(--wt)",fontWeight:600,fontSize:".85rem"},children:"Password"}),e.jsx("p",{style:{color:"var(--mut)",fontSize:".75rem"},children:"Change your account password"})]})]}),e.jsx("button",{type:"button",style:c,onClick:()=>N(!j),"data-testid":"button-toggle-password-change",children:j?"Cancel":"Change Password"})]}),j&&e.jsxs("div",{style:{marginTop:"1rem",display:"flex",flexDirection:"column",gap:".6rem"},children:[e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Current Password"}),e.jsx("input",{type:"password",style:i,value:T,onChange:t=>E(t.target.value),"data-testid":"input-current-password"})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"New Password"}),e.jsx("input",{type:"password",style:i,value:y,onChange:t=>A(t.target.value),"data-testid":"input-new-password"})]}),e.jsxs("div",{children:[e.jsx("label",{style:n,children:"Confirm New Password"}),e.jsx("input",{type:"password",style:i,value:z,onChange:t=>B(t.target.value),"data-testid":"input-confirm-new-password"})]}),e.jsx("div",{children:e.jsx("button",{type:"button",onClick:X,style:P,"data-testid":"button-save-password",children:"Update Password"})})]})]}),e.jsxs("div",{style:J,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"1rem"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:".75rem"},children:[s.twoFactorEnabled?e.jsx(xe,{style:{width:15,height:15,color:"#4ade80"}}):e.jsx(fe,{style:{width:15,height:15,color:"var(--mut)"}}),e.jsxs("div",{children:[e.jsx("p",{style:{color:"var(--wt)",fontWeight:600,fontSize:".85rem"},children:"Two-Factor Authentication"}),e.jsx("p",{style:{color:"var(--mut)",fontSize:".75rem"},children:s.twoFactorEnabled?"Enabled — your account is protected":"Add an extra layer of security"})]})]}),s.twoFactorEnabled?e.jsx("button",{type:"button",style:U,onClick:()=>w(!R),"data-testid":"button-disable-2fa",children:"Disable 2FA"}):e.jsx("button",{type:"button",style:c,onClick:_,"data-testid":"button-setup-2fa",children:"Enable 2FA"})]}),V&&e.jsxs("div",{style:{marginTop:"1rem",padding:"1rem",background:"rgba(255,255,255,0.03)",border:"1px solid rgba(255,255,255,0.08)",borderRadius:10},children:[e.jsx("p",{style:{color:"var(--wt)",fontWeight:700,fontSize:".83rem",marginBottom:".4rem"},children:"Set Up Two-Factor Authentication"}),e.jsx("p",{style:{color:"var(--mut)",fontSize:".78rem",marginBottom:"1rem"},children:"Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.)"}),L&&e.jsx("div",{style:{display:"flex",justifyContent:"center",marginBottom:"1rem"},children:e.jsx("img",{src:L,alt:"2FA QR Code",style:{width:160,height:160,borderRadius:8},"data-testid":"img-2fa-qr",width:"160",height:"160"})}),e.jsxs("p",{style:{color:"var(--mut)",fontSize:".75rem",marginBottom:"1rem"},children:["Or enter code manually:"," ",e.jsx("code",{style:{background:"rgba(255,255,255,0.08)",padding:".15rem .45rem",borderRadius:5,fontSize:".7rem",color:"var(--wt)"},"data-testid":"text-2fa-secret",children:G})]}),e.jsx("label",{style:n,children:"Enter verification code from app"}),e.jsxs("div",{style:{display:"flex",gap:".5rem",flexWrap:"wrap"},children:[e.jsx("input",{type:"text",value:I,onChange:t=>W(t.target.value),placeholder:"000000",maxLength:6,style:{...i,width:100,textAlign:"center",letterSpacing:".15em"},"data-testid":"input-2fa-verify-code"}),e.jsx("button",{type:"button",onClick:$,style:P,"data-testid":"button-verify-2fa",children:"Verify & Enable"}),e.jsx("button",{type:"button",onClick:()=>v(!1),style:c,children:"Cancel"})]})]}),R&&e.jsxs("div",{style:{marginTop:"1rem",padding:"1rem",background:"rgba(248,113,113,0.04)",border:"1px solid rgba(248,113,113,0.18)",borderRadius:10},children:[e.jsx("p",{style:{color:"#f87171",fontWeight:700,fontSize:".83rem",marginBottom:".4rem"},children:"Disable Two-Factor Authentication"}),e.jsx("p",{style:{color:"var(--mut)",fontSize:".78rem",marginBottom:"1rem"},children:"Enter your password to confirm disabling 2FA"}),e.jsxs("div",{style:{display:"flex",gap:".5rem",flexWrap:"wrap"},children:[e.jsx("input",{type:"password",value:D,onChange:t=>O(t.target.value),placeholder:"Your password",style:{...i,flex:1,minWidth:120},"data-testid":"input-2fa-disable-password"}),e.jsx("button",{type:"button",onClick:ee,style:U,"data-testid":"button-confirm-disable-2fa",children:"Disable 2FA"}),e.jsx("button",{type:"button",onClick:()=>w(!1),style:c,children:"Cancel"})]})]})]})]})]}),e.jsxs("div",{style:{...m,display:"flex",justifyContent:"flex-end",gap:".6rem"},children:[e.jsx(K,{href:"/portal",children:e.jsx("button",{type:"button",style:c,children:"Cancel"})}),e.jsxs("button",{type:"button",onClick:()=>u.mutate(s),disabled:!f||u.isPending,style:{...P,opacity:!f||u.isPending?.45:1,cursor:!f||u.isPending?"not-allowed":"pointer"},children:[e.jsx(be,{style:{width:13,height:13}}),u.isPending?"Saving…":"Save Changes"]})]})]})]})]})}),e.jsx(ne,{}),e.jsx(oe,{})]}):null}export{Fe 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.