function Register(){ const [name,setName]=React.useState(''); const [email,setEmail]=React.useState(''); const [mobile,setMobile]=React.useState(''); const [password,setPassword]=React.useState(''); const [confirm,setConfirm]=React.useState(''); const [touched,setTouched]=React.useState({}); const touch=k=>setTouched(t=>({...t,[k]:true})); const nameValid=BBValidate.isFullName(name); const emailValid=BBValidate.isEmail(email); const mobileValid=BBValidate.isMobile(mobile); const confirmValid=confirm&&confirm===password; const [marketing,setMarketing]=React.useState(true); const [error,setError]=React.useState(''); const [notice,setNotice]=React.useState(''); const [loading,setLoading]=React.useState(false); const [success,setSuccess]=React.useState(false); React.useEffect(()=>{document.title='Create Account — Bold Bee';},[]); const strength=BB_AUTH.passwordStrength(password); const strengthLabel=['Too weak','Weak','Fair','Good','Strong'][strength]; const strengthColor=['#B3261E','#B3261E','#B89B5E','#8A8B4A','#3D6B4A'][strength]; function submit(e){ e.preventDefault(); setError(''); setTouched({name:true,email:true,mobile:true,confirm:true}); if(!nameValid){setError('Please enter a valid full name.');return;} if(!emailValid){setError('Please enter a valid email address.');return;} if(!mobileValid){setError('Please enter a valid 10-digit mobile number.');return;} if(password.length<8){setError('Password must be at least 8 characters.');return;} if(password!==confirm){setError('Passwords do not match.');return;} setLoading(true); setTimeout(()=>{ const res=BB_AUTH.register({name,email,mobile,password,marketing}); setLoading(false); if(!res.ok){setError(res.error);return;} setSuccess(true); setTimeout(()=>{location.href='Account.html';},700); },500); } return ( {success?(

Welcome to Bold Bee — taking you to your account.

):(<>
AuthProviderStub('Google',setNotice,()=>{setSuccess(true);setTimeout(()=>{location.href='Account.html';},700);})}>Continue with Google AuthProviderStub('Apple',setNotice)}>Continue with Apple
or continue with email
setName(BBValidate.filterName(e.target.value))} onBlur={()=>{touch('name');setName(n=>n.trim());}} style={{width:'100%',border:fieldBorder(touched.name,name,nameValid),borderRadius:'var(--radius-md)',padding:'12px 14px',fontSize:14}}/>
setEmail(e.target.value)} onBlur={()=>touch('email')} style={{width:'100%',border:fieldBorder(touched.email,email,emailValid),borderRadius:'var(--radius-md)',padding:'12px 14px',fontSize:14}}/>
setMobile(BBValidate.filterMobile(e.target.value))} onBlur={()=>touch('mobile')} style={{width:'100%',border:fieldBorder(touched.mobile,mobile,mobileValid),borderRadius:'var(--radius-md)',padding:'12px 14px',fontSize:14}}/>
setPassword(e.target.value)}/> {password&&(
{[0,1,2,3].map(i=>(
))}
{strengthLabel}
)} setConfirm(e.target.value)} onBlur={()=>touch('confirm')}/> {touched.confirm&&confirm&&(confirmValid?

Passwords match.

:

Passwords do not match.

)} {error&&

{error}

} {notice&&

{notice}

} {loading?'Creating Account…':'Create Account'}
Already have an account? Sign in
)}
); } window.Register=Register;