PageSourceSearch

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

js tradeintelx.com collected 2026-10-02 01:47:23 UTC 8,125 bytes, 2 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/chat-page-C-flp553.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{Ka as O,Kr as R,Pa as T,Tr as V,Va as q,Wa as y,_i as H,ga as W,kr as K,oi as M}from"./chat-page-C-flp553.js";import{Ru as z}from"./market-core-B8Bfud51.js";import{Pt as B,et as F,s as N}from"./react-icons-vendor-Cpb90wOl.js";var i=U(O(),1),e=T();function X(){const{t}=W(),[r,j]=(0,i.useState)(""),[a,_]=(0,i.useState)(""),[h,k]=(0,i.useState)(""),[p,d]=(0,i.useState)(""),[g,w]=(0,i.useState)(!1),[u,S]=(0,i.useState)(!1),x=q(),s=K.currentUser;(0,i.useEffect)(()=>{if(!s){x("/signin",{replace:!0});return}s.displayName&&j(s.displayName)},[s,x]),(0,i.useEffect)(()=>{p&&d("")},[r,a,h,p]);const C=l=>/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}$/.test(l),D=async l=>{if(l.preventDefault(),!r.trim()){d("completeProfilePage.errors.usernameRequired");return}if(a&&a!==h){d("completeProfilePage.errors.passwordsMismatch");return}if(a&&!C(a)){d("completeProfilePage.errors.passwordWeak");return}w(!0);try{const{createUserDocument:b,updateUserDocument:Z,findUserByUsern
2ame:A}=V.getState(),v=await A(r);if(v&&v.uid!==s.uid){d("completeProfilePage.errors.usernameTaken"),w(!1);return}const{doc:c,getDoc:L,updateDoc:f}=await y(async()=>{const{doc:o,getDoc:n,updateDoc:P}=await import("./chat-page-C-flp553.js").then(I=>I.bi);return{doc:o,getDoc:n,updateDoc:P}},__vite__mapDeps([0,1,2,3])),{db:m}=await y(async()=>{const{db:o}=await import("./chat-page-C-flp553.js").then(n=>n.jr);return{db:o}},__vite__mapDeps([0,1,2,3]));if((await L(c(m,"users",s.uid))).exists()){await f(c(m,"users",s.uid),{username:r,usernameLower:r.toLowerCase(),displayName:r,updatedAt:new Date().toISOString(),profileCompleted:!0});try{await f(c(m,"userProfiles",s.uid),{username:r,usernameLower:r.toLowerCase(),displayName:r,updatedAt:new Date().toISOString(),profileCompleted:!0})}catch{console.log("userProfile update skipped")}await f(c(m,"usernames",r.toLowerCase()),{uid:s.uid,username:r,email:s.email,updatedAt:new Date().toISOString()}).catch(async()=>{const{setDoc:o}=await y(async()=>{const{setDoc:n}=await import("./chat-page-C-flp553.js").then(P=>P.bi);return{setDoc:n}},__vite__mapDeps([0,1,2,3]));await o(c(m,"usernames",r.toLowerCase()),{uid:s.uid,username:r,email:s.email,createdAt:new Date().toISOString()})})}else await b(s,{username:r,displayName:r,profileCompleted:!0});if(a)try{await M(s,R.credential(s.email,a)),console.log("✅ Email/password credential linked"),await f(c(m,"users",s.uid),{linkedProviders:["google","email"],hasPassword:!0,updatedAt:new Date().toISOString()})}catch(o){if(console.error("Password linking error:",o),o.code==="auth/provider-already-linked")try{await H(s,a)}catch(n){console.error("Password update error:",n)}}x("/",{replace:!0})}catch(b){console.error("Profile completion error:",b),d("completeProfilePage.errors.saveFailed")}finally{w(!1)}},E=()=>{x("/",{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:t("completeProfilePage.title")}),(0,e.jsx)("p",{className:"text-gray-400",children:t("completeProfilePage.subtitle")})]}),(0,e.jsxs)("div",{className:"bg-slate-800/50 backdrop-blur-sm border border-slate-700/50 rounded-2xl p-8 shadow-2xl",children:[p&&(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:t(p,{defaultValue:p})}),(0,e.jsxs)("form",{onSubmit:D,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:[t("completeProfilePage.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:r,onChange:l=>j(l.target.value),placeholder:t("completeProfilePage.usernamePlaceholder"),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:t("completeProfilePage.usernameHelp")})]}),(0,e.jsxs)("div",{children:[(0,e.jsxs)("label",{className:"block text-sm font-medium text-gray-300 mb-2",children:[t("completeProfilePage.password")," ",(0,e.jsxs)("span",{className:"text-gray-500",children:["(",t("completeProfilePage.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)(F,{className:"w-5 h-5 text-gray-500"})}),(0,e.jsx)("input",{type:u?"text":"password",value:a,onChange:l=>_(l.target.value),placeholder:t("completeProfilePage.passwordPlaceholder"),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:()=>S(!u),className:"absolute inset-y-0 right-0 pr-4 flex items-center text-gray-500 hover:text-gray-300",children:u?t("common.hide","Hide"):t("common.show","Show")})]}),(0,e.jsx)("p",{className:"mt-2 text-xs text-gray-500",children:t("completeProfilePage.passwordHelp")})]}),a&&(0,e.jsxs)("div",{children:[(0,e.jsx)("label",{className:"block text-sm font-medium text-gray-300 mb-2",children:t("completeProfilePage.confirmPassword")}),(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)(z,{className:"w-5 h-5 text-gray-500"})}),(0,e.jsx)("input",{type:u?"text":"password",value:h,onChange:l=>k(l.target.value),placeholder:t("completeProfilePage.confirmPlaceholder"),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)(B,{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:t("completeProfilePage.whyPassword")}),(0,e.jsx)("p",{className:"text-blue-300/80",children:t("completeProfilePage.passwordReason")})]})]})}),(0,e.jsxs)("div",{className:"flex gap-3",children:[(0,e.jsx)("button",{type:"button",onClick:E,disabled:g,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:t("completeProfilePage.skip")}),(0,e.jsx)("button",{type:"submit",disabled:g,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:t(g?"completeProfilePage.saving":"completeProfilePage.complete")}
2)]})]}),s&&(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:[t("completeProfilePage.signedInAs")," ",(0,e.jsx)("span",{className:"text-gray-400",children:s.email})]})})]})]})})}export{X 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.