PageSourceSearch

https://tradeintelx.com/assets/CompleteProfile-DpHjS49R.js

js tradeintelx.com collected 2026-09-24 14:55:14 UTC 7,968 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chat-page-evUfHQgD.js","assets/chartjs-vendor-CJ58C3gX.js","assets/rolldown-runtime-ChpBd9eV.js","assets/chat-page-BXqTKTIP.css"])))=>i.map(i=>d[i]);
2import{o as U}from"./rolldown-runtime-ChpBd9eV.js";import{Fa as y,La as I,Ma as O,Qr as T,Rr as q,Ta as R,_r as V,li as F,xr as H}from"./chat-page-evUfHQgD.js";import{Hu as M}from"./market-core-DitXLvJ-.js";import{Pt as W,et as $,s as N}from"./react-icons-vendor-BRFUBoNn.js";var o=U(I(),1),e=R();function Z(){const[s,j]=(0,o.useState)(""),[a,P]=(0,o.useState)(""),[f,S]=(0,o.useState)(""),[u,n]=(0,o.useState)(""),[w,b]=(0,o.useState)(!1),[m,_]=(0,o.useState)(!1),p=O(),t=H.currentUser;(0,o.useEffect)(()=>{if(!t){p("/signin",{replace:!0});return}t.displayName&&j(t.displayName)},[t,p]),(0,o.useEffect)(()=>{u&&n("")},[s,a,f,u]);const C=r=>/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}$/.test(r),k=async r=>{if(r.preventDefault(),!s.trim()){n("Please enter a username");return}if(a&&a!==f){n("Passwords do not match");return}if(a&&!C(a)){n("Password must be at least 8 characters with a number, uppercase and lowercase letter");return}b(!0);try{const{createUserDocument:x,updateUserDocument:z,findUserByUsern
2ame:E}=V.getState(),v=await E(s);if(v&&v.uid!==t.uid){n("This username is already taken. Please choose a different username."),b(!1);return}const{doc:d,getDoc:A,updateDoc:h}=await y(async()=>{const{doc:l,getDoc:i,updateDoc:g}=await import("./chat-page-evUfHQgD.js").then(L=>L.fi);return{doc:l,getDoc:i,updateDoc:g}},__vite__mapDeps([0,1,2,3])),{db:c}=await y(async()=>{const{db:l}=await import("./chat-page-evUfHQgD.js").then(i=>i.Cr);return{db:l}},__vite__mapDeps([0,1,2,3]));if((await A(d(c,"users",t.uid))).exists()){await h(d(c,"users",t.uid),{username:s,usernameLower:s.toLowerCase(),displayName:s,updatedAt:new Date().toISOString(),profileCompleted:!0});try{await h(d(c,"userProfiles",t.uid),{username:s,usernameLower:s.toLowerCase(),displayName:s,updatedAt:new Date().toISOString(),profileCompleted:!0})}catch{console.log("userProfile update skipped")}await h(d(c,"usernames",s.toLowerCase()),{uid:t.uid,username:s,email:t.email,updatedAt:new Date().toISOString()}).catch(async()=>{const{setDoc:l}=await y(async()=>{const{setDoc:i}=await import("./chat-page-evUfHQgD.js").then(g=>g.fi);return{setDoc:i}},__vite__mapDeps([0,1,2,3]));await l(d(c,"usernames",s.toLowerCase()),{uid:t.uid,username:s,email:t.email,createdAt:new Date().toISOString()})})}else await x(t,{username:s,displayName:s,profileCompleted:!0});if(a)try{await T(t,q.credential(t.email,a)),console.log("✅ Email/password credential linked"),await h(d(c,"users",t.uid),{linkedProviders:["google","email"],hasPassword:!0,updatedAt:new Date().toISOString()})}catch(l){if(console.error("Password linking error:",l),l.code==="auth/provider-already-linked")try{await F(t,a)}catch(i){console.error("Password update error:",i)}}p("/",{replace:!0})}catch(x){console.error("Profile completion error:",x),n(`Failed to complete profile: ${x.message}`)}finally{b(!1)}},D=()=>{p("/",{replace:!0})};return(0,e.jsx)("div",{className:"public-page min-h-screen bg-gradient-to-br from-slate-900 via-purple-900/20 to-slate-900 flex items-center justify-center p-4",children:(0,e.jsxs)("div",{className:"w-full max-w-xl",children:[(0,e.jsxs)("div",{className:"text-center mb-8",children:[(0,e.jsx)("div",{className:"inline-flex items-center justify-center w-16 h-16 bg-gradient-to-r from-purple-500 to-pink-500 rounded-full mb-4",children:(0,e.jsx)(N,{className:"w-8 h-8 text-white"})}),(0,e.jsx)("h1",{className:"text-3xl font-bold text-white mb-2",children:"Complete Your Profile"}),(0,e.jsx)("p",{className:"text-gray-400",children:"Set up your username and password to secure your account"})]}),(0,e.jsxs)("div",{className:"bg-slate-800/50 backdrop-blur-sm border border-slate-700/50 rounded-2xl p-8 shadow-2xl",children:[u&&(0,e.jsx)("div",{className:"mb-6 p-4 bg-red-500/10 border border-red-500/50 rounded-lg text-red-400 text-sm",children:u}),(0,e.jsxs)("form",{onSubmit:k,className:"space-y-6",children:[(0,e.jsxs)("div",{children:[(0,e.jsxs)("label",{className:"block text-sm font-medium text-gray-300 mb-2",children:["Username ",(0,e.jsx)("span",{className:"text-red-400",children:"*"})]}),(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("div",{className:"absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none",children:(0,e.jsx)(N,{className:"w-5 h-5 text-gray-500"})}),(0,e.jsx)("input",{type:"text",value:s,onChange:r=>j(r.target.value),placeholder:"Choose a unique username",className:"w-full pl-12 pr-4 py-3 bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-gray-500 focus:outline-none focus:border-purple-500 transition-colors",required:!0})]}),(0,e.jsx)("p",{className:"mt-2 text-xs text-gray-500",children:"This will be your public display name"})]}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("label",{className:"block text-sm font-medium text-gray-300 mb-2",children:["Password ",(0,e.jsx)("span",{className:"text-gray-500",children:"(Optional)"})]}),(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("div",{className:"absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none",children:(0,e.jsx)($,{className:"w-5 h-5 text-gray-500"})}),(0,e.jsx)("input",{type:m?"text":"password",value:a,onChange:r=>P(r.target.value),placeholder:"Create a strong password",className:"w-full pl-12 pr-12 py-3 bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-gray-500 focus:outline-none focus:border-purple-500 transition-colors"}),(0,e.jsx)("button",{type:"button",onClick:()=>_(!m),className:"absolute inset-y-0 right-0 pr-4 flex items-center text-gray-500 hover:text-gray-300",children:m?"Hide":"Show"})]}),(0,e.jsx)("p",{className:"mt-2 text-xs text-gray-500",children:"At least 8 characters with number, uppercase and lowercase"})]}),a&&(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"block text-sm font-medium text-gray-300 mb-2",children:"Confirm Password"}),(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsx)("div",{className:"absolute inset-y-0 left-0 pl-4 flex items-center pointer-events-none",children:(0,e.jsx)(M,{className:"w-5 h-5 text-gray-500"})}),(0,e.jsx)("input",{type:m?"text":"password",value:f,onChange:r=>S(r.target.value),placeholder:"Confirm your password",className:"w-full pl-12 pr-4 py-3 bg-slate-700/50 border border-slate-600 rounded-lg text-white placeholder-gray-500 focus:outline-none focus:border-purple-500 transition-colors"})]})]}),(0,e.jsx)("div",{className:"bg-blue-500/10 border border-blue-500/30 rounded-lg p-4",children:(0,e.jsxs)("div",{className:"flex items-start gap-3",children:[(0,e.jsx)(W,{className:"w-5 h-5 text-blue-400 mt-0.5 flex-shrink-0"}),(0,e.jsxs)("div",{className:"text-sm text-blue-300",children:[(0,e.jsx)("p",{className:"font-medium mb-1",children:"Why add a password?"}),(0,e.jsx)("p",{className:"text-blue-300/80",children:"Adding a password lets you sign in with either Google or email/password, giving you more flexibility and account security."})]})]})}),(0,e.jsxs)("div",{className:"flex gap-3",children:[(0,e.jsx)("button",{type:"button",onClick:D,disabled:w,className:"flex-1 py-3 px-4 bg-slate-700 hover:bg-slate-600 text-white rounded-lg font-medium transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"Skip for now"}),(0,e.jsx)("button",{type:"submit",disabled:w,className:"flex-1 py-3 px-4 bg-gradient-to-r from-purple-500 to-pink-500 hover:from-purple-600 hover:to-pink-600 text-white rounded-lg font-medium transition-all disabled:opacity-50 disabled:cursor-not-allowed",children:w?"Saving...":"Complete Profile"})]})]}),t&&(0,e.jsx)("div",{className:"mt-6 pt-6 border-t border-slate-700",children:(0,e.jsxs)("p",{className:"text-xs text-gray-500 text-center",children:["Signed in as ",(0,e.jsx)("span",{className:"text-gray-400",children:t.email})]})})]})]})})}export{Z 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.