@wacht/jsx 0.0.1-alpha.24 → 0.0.1-alpha.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -684,7 +684,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Xr]+=1);const le=u.div`
684
684
  `,cr=u.span`
685
685
  color: var(--color-danger);
686
686
  margin-left: 2px;
687
- `;function Gp(){var J,ae,ee,F,U,G,X,se,oe,ce,K,ie,Z,q,A;const{loading:t,signUp:r,signupAttempt:o,discardSignupAttempt:n,errors:a}=ec(),{signIn:s}=Dr("oauth"),{deployment:h}=xe(),{navigate:g}=Ge(),{session:c,refetch:p}=Fe(),[l,d]=i.useState({first_name:"",last_name:"",email:"",password:"",username:"",phone_number:""}),[m,x]=i.useState({}),[v,y]=i.useState(!1),[C,z]=i.useState(void 0),[b,S]=i.useState(null),[k,$]=i.useState(null),w=((J=h==null?void 0:h.restrictions)==null?void 0:J.sign_up_mode)==="restricted",f=((ae=h==null?void 0:h.restrictions)==null?void 0:ae.sign_up_mode)==="waitlist";i.useEffect(()=>{var W;if(!h)return;if(f){const te=((W=h.ui_settings)==null?void 0:W.waitlist_page_url)||`${h.frontend_host}/waitlist`||"/waitlist";g(te);return}const L=new URLSearchParams(window.location.search).get("invite_token");L&&!b&&r&&($(L),r.validateDeploymentInvitation(L).then(te=>{S(te),te.valid&&d(pe=>({...pe,first_name:te.first_name||pe.first_name,last_name:te.last_name||pe.last_name,email:te.email||pe.email}))}).catch(te=>{console.error("Failed to validate invitation:",te)}))},[h,f,g,b,r]);const[E,j]=i.useState(!1),[_,I]=i.useState(""),P=B=>{let{name:L,value:W}=B.target;L==="phone_number"?W=W.replace(/[^0-9-]/g,""):L==="email"&&(W=W.toLowerCase()),d(te=>({...te,[L]:W})),x(te=>({...te,[L]:""}))},T=()=>{d({first_name:"",last_name:"",email:"",password:"",username:"",phone_number:""}),x({}),j(!1),I(""),n()},R=async B=>{if(B.preventDefault(),console.log("Signup form - handleSubmit called"),console.log("Auth settings:",M),console.log("Form data:",l),t||v)return;const L={},W=/^[a-zA-Z]{3,30}$/,te=/^[a-zA-Z][a-zA-Z0-9_.]{2,29}$/,pe=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,Se=/^\d{7,15}$/,Ne=/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,125}$/;if(M!=null&&M.first_name.enabled&&(M!=null&&M.first_name.required&&!l.first_name?L.first_name="First name is required":l.first_name&&!W.test(l.first_name)&&(L.first_name="Invalid name")),M!=null&&M.last_name.enabled&&(M!=null&&M.last_name.required&&!l.last_name?L.last_name="Last name is required":l.last_name&&!W.test(l.last_name)&&(L.last_name="Invalid last name")),M!=null&&M.username.enabled&&(M!=null&&M.username.required&&!l.username?L.username="Username is required":l.username&&!te.test(l.username)&&(L.username="Username must be 3-20 characters")),M!=null&&M.email_address.enabled&&(M!=null&&M.email_address.required&&!l.email?L.email="Email address is required":l.email&&!pe.test(l.email)&&(L.email="Invalid email address")),M!=null&&M.phone_number.enabled&&(M!=null&&M.phone_number.required&&!l.phone_number?L.phone_number="Phone number is required":l.phone_number&&!Se.test(l.phone_number)&&(L.phone_number="Phone number must contain 7-15 digits")),M!=null&&M.password.enabled&&(l.password?Ne.test(l.password)||(L.password="Password must be 8-125 characters and include uppercase, lowercase, number, and special character"):L.password="Password is required"),x(L),Object.keys(L).length>0){console.log("Signup validation failed. Errors:",L);return}console.log("Signup validation passed"),y(!0);try{const H={...l};l.phone_number&&C&&(H.phone_country_code=C),k&&(H.invite_token=k),console.log("Submitting signup data:",H),console.log("Phone number:",H.phone_number),console.log("Phone country code:",H.phone_country_code),await r.create(H)}catch(H){x({submit:H.message})}finally{y(!1)}},O=async B=>{if(!(t||v)){y(!0);try{const W=new URLSearchParams(window.location.search).get("redirect_uri")||void 0,{data:te}=await s.create({provider:B.provider,redirectUri:W});te&&typeof te=="object"&&"oauth_url"in te&&(window.location.href=te.oauth_url)}catch(L){x({submit:L.message})}finally{y(!1)}}},D=(h==null?void 0:h.social_connections.filter(B=>B.enabled))||[],M=h==null?void 0:h.auth_settings,Y=!!((ee=M==null?void 0:M.first_name)!=null&&ee.enabled&&((F=M==null?void 0:M.last_name)!=null&&F.enabled)),N=async B=>{var W;if(B.preventDefault(),t||v)return;y(!0);const L={};if(!_){L.otp="OTP code is required",x(L),y(!1);return}x(L);try{const te=await r.completeVerification(_);"data"in te&&((W=te.data)!=null&&W.active_signin)&&await p()}catch(te){console.error("Verification failed:",te)}finally{y(!1)}};return i.useEffect(()=>{var B;if(o){if(o.completed){let L=new URLSearchParams(window.location.search).get("redirect_uri");if(L||(L=((B=h==null?void 0:h.ui_settings)==null?void 0:B.after_signup_redirect_url)||null),!L&&(h!=null&&h.frontend_host)&&(L=`https://${h.frontend_host}`),L){const W=new URL(L);(h==null?void 0:h.mode)==="staging"&&W.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),g(W.toString())}return}if(!E){switch(o.current_step){case"verify_email":r.prepareVerification({strategy:"email_otp"});break;case"verify_phone":r.prepareVerification({strategy:"phone_otp"});break}j(!0)}}},[o,r,E,h,c,g]),i.useEffect(()=>{const B={};if(a!=null&&a.errors&&Array.isArray(a==null?void 0:a.errors))for(const L of a.errors)L.code==="USERNAME_EXISTS"&&(B.username=L.message),L.code==="EMAIL_EXISTS"&&(B.email=L.message),L.code==="PHONE_NUMBER_EXISTS"&&(B.phone_number=L.message),L.code==="INVALID_CREDENTIALS"&&(B.password=L.message),["COUNTRY_RESTRICTED","EMAIL_NOT_ALLOWED","EMAIL_BLOCKED","DISPOSABLE_EMAIL_BLOCKED","VOIP_NUMBER_BLOCKED","BANNED_KEYWORD"].includes(L.code)&&(B.submit=L.message);x(B)},[a]),w?e.jsx(le,{children:e.jsxs(rs,{children:[e.jsx(Ie,{}),e.jsx(bn,{children:e.jsx(yn,{children:"Sign up Restricted!"})}),e.jsx(Fp,{children:e.jsx(Bp,{children:"New account registration is currently restricted. Please check back later."})}),e.jsx(Up,{children:e.jsxs(Wp,{children:["Need assistance?"," ",e.jsx(Vp,{href:(U=h==null?void 0:h.ui_settings)!=null&&U.sign_in_page_url?`${h.ui_settings.sign_in_page_url}?help=true`:"/contact",children:"Get help"})]})})]})}):e.jsx(le,{children:e.jsx(rs,{children:E?e.jsxs(e.Fragment,{children:[e.jsxs(bn,{children:[e.jsxs(yn,{children:["Check your"," ",(o==null?void 0:o.current_step)==="verify_email"?"email":"phone"]}),e.jsx(os,{children:(o==null?void 0:o.current_step)==="verify_email"?`${l.email} to continue to ${(G=h==null?void 0:h.ui_settings)==null?void 0:G.app_name}`:`${l.phone_number} to continue to ${(X=h==null?void 0:h.ui_settings)==null?void 0:X.app_name}`})]}),e.jsxs(ns,{style:{gap:"15px"},onSubmit:N,noValidate:!0,children:[e.jsx(It,{onComplete:async B=>{I(B)},onResend:async()=>{const B=(o==null?void 0:o.current_step)==="verify_email"?"email_otp":"phone_otp";await r.prepareVerification({strategy:B})},error:m.otp,isSubmitting:v}),e.jsx(as,{type:"submit",disabled:v||t||!_,children:v?"Verifying...":`Continue to ${(se=h==null?void 0:h.ui_settings)==null?void 0:se.app_name}`})]}),e.jsxs(ss,{children:["Having trouble?"," ",e.jsx(wn,{children:e.jsx(tt,{to:h.ui_settings.support_page_url,children:"Contact support"})}),e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx(wn,{onClick:()=>{T()},style:{cursor:"pointer"},children:"Use other method"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ie,{}),e.jsxs(bn,{children:[e.jsx(yn,{children:"Create your account"}),e.jsx(os,{children:b!=null&&b.valid?"You've been invited! Complete your registration below.":"Welcome! Please fill in the details to get started."})]}),D.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(wa,{connections:D,callback:O}),e.jsx(Lp,{children:e.jsx(Ap,{children:"or"})})]}),e.jsxs(ns,{onSubmit:R,noValidate:!0,children:[(((oe=M==null?void 0:M.first_name)==null?void 0:oe.enabled)||((ce=M==null?void 0:M.last_name)==null?void 0:ce.enabled))&&e.jsxs(Dp,{$isBothEnabled:Y,children:[((K=M==null?void 0:M.first_name)==null?void 0:K.enabled)&&e.jsxs(sr,{children:[e.jsxs(ir,{htmlFor:"first_name",children:["First name",((ie=M==null?void 0:M.first_name)==null?void 0:ie.required)&&e.jsx(cr,{children:"*"})]}),e.jsx(de,{type:"text",id:"first_name",name:"first_name",required:!0,minLength:3,maxLength:30,value:l.first_name,onChange:P,placeholder:"First name","aria-invalid":!!m.first_name,pattern:"^[a-zA-Z]{3,30}$"}),m.first_name&&e.jsx(Mt,{children:m.first_name})]}),((Z=M==null?void 0:M.last_name)==null?void 0:Z.enabled)&&e.jsxs(sr,{children:[e.jsxs(ir,{htmlFor:"last_name",children:["Last name",((q=M==null?void 0:M.last_name)==null?void 0:q.required)&&e.jsx(cr,{children:"*"})]}),e.jsx(de,{type:"text",id:"last_name",name:"last_name",required:!0,minLength:3,maxLength:30,value:l.last_name,onChange:P,placeholder:"Last name","aria-invalid":!!m.last_name,pattern:"^[a-zA-Z]{3,30}$"}),m.last_name&&e.jsx(Mt,{children:m.last_name})]})]}),(M==null?void 0:M.username.enabled)&&e.jsxs(sr,{children:[e.jsxs(ir,{htmlFor:"username",children:["Username",M.username.required&&e.jsx(cr,{children:"*"})]}),e.jsx(de,{type:"text",id:"username",name:"username",minLength:3,maxLength:20,value:l.username,onChange:P,placeholder:"Choose a username","aria-invalid":!!m.username,required:!0,pattern:"^[a-zA-Z][a-zA-Z0-9_.]{2,29}$"}),m.username&&e.jsx(Mt,{children:m.username})]}),(M==null?void 0:M.email_address.enabled)&&e.jsxs(sr,{children:[e.jsxs(ir,{htmlFor:"email",children:["Email address",M.email_address.required&&e.jsx(cr,{children:"*"})]}),e.jsx(de,{type:"email",id:"email",name:"email",maxLength:320,value:l.email,onChange:P,placeholder:"Enter your email address","aria-invalid":!!m.email,required:!0,readOnly:(b==null?void 0:b.valid)&&!!(b!=null&&b.email),pattern:"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"}),m.email&&e.jsx(Mt,{children:m.email})]}),(M==null?void 0:M.phone_number.enabled)&&e.jsxs(sr,{children:[e.jsxs(ir,{htmlFor:"phone_number",children:["Phone number",M.phone_number.required&&e.jsx(cr,{children:"*"})]}),e.jsx(Ur,{value:l.phone_number,onChange:P,error:m.phone_number,countryCode:C,setCountryCode:z}),m.phone_number&&e.jsx(Mt,{children:m.phone_number})]}),(M==null?void 0:M.password.enabled)&&e.jsxs(sr,{children:[e.jsxs(ir,{htmlFor:"password",children:["Password",M.password.required&&e.jsx(cr,{children:"*"})]}),e.jsx(Np,{children:e.jsx(de,{type:"password",id:"password",name:"password",value:l.password,onChange:P,placeholder:"Enter your password","aria-invalid":!!m.password,required:!0,minLength:8,maxLength:128,pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,125}$"})}),m.password&&e.jsx(Mt,{children:m.password})]}),m.submit&&e.jsx(Mt,{children:m.submit}),e.jsx(as,{type:"submit",disabled:v||t,children:v?"Creating account...":"Continue"})]}),e.jsxs(ss,{children:["Already have an account?"," ",e.jsx(wn,{children:e.jsx(tt,{to:`${(A=h.ui_settings)==null?void 0:A.sign_in_page_url}${window.location.search}`,children:"Sign in"})})]})]})})})}/**
687
+ `;function Gp(){var J,ae,ee,F,U,G,X,se,oe,ce,K,ie,Z,q,A;const{loading:t,signUp:r,signupAttempt:o,discardSignupAttempt:n,errors:a}=ec(),{signIn:s}=Dr("oauth"),{deployment:h}=xe(),{navigate:g}=Ge(),{session:c,refetch:p}=Fe(),[l,d]=i.useState({first_name:"",last_name:"",email:"",password:"",username:"",phone_number:""}),[m,x]=i.useState({}),[v,y]=i.useState(!1),[C,z]=i.useState(void 0),[b,S]=i.useState(null),[k,$]=i.useState(null),w=((J=h==null?void 0:h.restrictions)==null?void 0:J.sign_up_mode)==="restricted",f=((ae=h==null?void 0:h.restrictions)==null?void 0:ae.sign_up_mode)==="waitlist";i.useEffect(()=>{var W;if(!h)return;const L=new URLSearchParams(window.location.search).get("invite_token");if(f&&!L){const te=((W=h.ui_settings)==null?void 0:W.waitlist_page_url)||`${h.frontend_host}/waitlist`||"/waitlist";g(te);return}L&&!b&&r&&($(L),r.validateDeploymentInvitation(L).then(te=>{S(te),te.valid&&d(pe=>({...pe,first_name:te.first_name||pe.first_name,last_name:te.last_name||pe.last_name,email:te.email||pe.email}))}).catch(te=>{console.error("Failed to validate invitation:",te)}))},[h,f,g,b,r]);const[E,j]=i.useState(!1),[_,I]=i.useState(""),P=B=>{let{name:L,value:W}=B.target;L==="phone_number"?W=W.replace(/[^0-9-]/g,""):L==="email"&&(W=W.toLowerCase()),d(te=>({...te,[L]:W})),x(te=>({...te,[L]:""}))},T=()=>{d({first_name:"",last_name:"",email:"",password:"",username:"",phone_number:""}),x({}),j(!1),I(""),n()},R=async B=>{if(B.preventDefault(),console.log("Signup form - handleSubmit called"),console.log("Auth settings:",M),console.log("Form data:",l),t||v)return;const L={},W=/^[a-zA-Z]{3,30}$/,te=/^[a-zA-Z][a-zA-Z0-9_.]{2,29}$/,pe=/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,Se=/^\d{7,15}$/,Ne=/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,125}$/;if(M!=null&&M.first_name.enabled&&(M!=null&&M.first_name.required&&!l.first_name?L.first_name="First name is required":l.first_name&&!W.test(l.first_name)&&(L.first_name="Invalid name")),M!=null&&M.last_name.enabled&&(M!=null&&M.last_name.required&&!l.last_name?L.last_name="Last name is required":l.last_name&&!W.test(l.last_name)&&(L.last_name="Invalid last name")),M!=null&&M.username.enabled&&(M!=null&&M.username.required&&!l.username?L.username="Username is required":l.username&&!te.test(l.username)&&(L.username="Username must be 3-20 characters")),M!=null&&M.email_address.enabled&&(M!=null&&M.email_address.required&&!l.email?L.email="Email address is required":l.email&&!pe.test(l.email)&&(L.email="Invalid email address")),M!=null&&M.phone_number.enabled&&(M!=null&&M.phone_number.required&&!l.phone_number?L.phone_number="Phone number is required":l.phone_number&&!Se.test(l.phone_number)&&(L.phone_number="Phone number must contain 7-15 digits")),M!=null&&M.password.enabled&&(l.password?Ne.test(l.password)||(L.password="Password must be 8-125 characters and include uppercase, lowercase, number, and special character"):L.password="Password is required"),x(L),Object.keys(L).length>0){console.log("Signup validation failed. Errors:",L);return}console.log("Signup validation passed"),y(!0);try{const H={...l};l.phone_number&&C&&(H.phone_country_code=C),k&&(H.invite_token=k),console.log("Submitting signup data:",H),console.log("Phone number:",H.phone_number),console.log("Phone country code:",H.phone_country_code),await r.create(H)}catch(H){x({submit:H.message})}finally{y(!1)}},O=async B=>{if(!(t||v)){y(!0);try{const W=new URLSearchParams(window.location.search).get("redirect_uri")||void 0,{data:te}=await s.create({provider:B.provider,redirectUri:W});te&&typeof te=="object"&&"oauth_url"in te&&(window.location.href=te.oauth_url)}catch(L){x({submit:L.message})}finally{y(!1)}}},D=(h==null?void 0:h.social_connections.filter(B=>B.enabled))||[],M=h==null?void 0:h.auth_settings,Y=!!((ee=M==null?void 0:M.first_name)!=null&&ee.enabled&&((F=M==null?void 0:M.last_name)!=null&&F.enabled)),N=async B=>{var W;if(B.preventDefault(),t||v)return;y(!0);const L={};if(!_){L.otp="OTP code is required",x(L),y(!1);return}x(L);try{const te=await r.completeVerification(_);"data"in te&&((W=te.data)!=null&&W.active_signin)&&await p()}catch(te){console.error("Verification failed:",te)}finally{y(!1)}};return i.useEffect(()=>{var B;if(o){if(o.completed){let L=new URLSearchParams(window.location.search).get("redirect_uri");if(L||(L=((B=h==null?void 0:h.ui_settings)==null?void 0:B.after_signup_redirect_url)||null),!L&&(h!=null&&h.frontend_host)&&(L=`https://${h.frontend_host}`),L){const W=new URL(L);(h==null?void 0:h.mode)==="staging"&&W.searchParams.set("__dev_session__",localStorage.getItem("__dev_session__")||""),g(W.toString())}return}if(!E){switch(o.current_step){case"verify_email":r.prepareVerification({strategy:"email_otp"});break;case"verify_phone":r.prepareVerification({strategy:"phone_otp"});break}j(!0)}}},[o,r,E,h,c,g]),i.useEffect(()=>{const B={};if(a!=null&&a.errors&&Array.isArray(a==null?void 0:a.errors))for(const L of a.errors)L.code==="USERNAME_EXISTS"&&(B.username=L.message),L.code==="EMAIL_EXISTS"&&(B.email=L.message),L.code==="PHONE_NUMBER_EXISTS"&&(B.phone_number=L.message),L.code==="INVALID_CREDENTIALS"&&(B.password=L.message),["COUNTRY_RESTRICTED","EMAIL_NOT_ALLOWED","EMAIL_BLOCKED","DISPOSABLE_EMAIL_BLOCKED","VOIP_NUMBER_BLOCKED","BANNED_KEYWORD"].includes(L.code)&&(B.submit=L.message);x(B)},[a]),w?e.jsx(le,{children:e.jsxs(rs,{children:[e.jsx(Ie,{}),e.jsx(bn,{children:e.jsx(yn,{children:"Sign up Restricted!"})}),e.jsx(Fp,{children:e.jsx(Bp,{children:"New account registration is currently restricted. Please check back later."})}),e.jsx(Up,{children:e.jsxs(Wp,{children:["Need assistance?"," ",e.jsx(Vp,{href:(U=h==null?void 0:h.ui_settings)!=null&&U.sign_in_page_url?`${h.ui_settings.sign_in_page_url}?help=true`:"/contact",children:"Get help"})]})})]})}):e.jsx(le,{children:e.jsx(rs,{children:E?e.jsxs(e.Fragment,{children:[e.jsxs(bn,{children:[e.jsxs(yn,{children:["Check your"," ",(o==null?void 0:o.current_step)==="verify_email"?"email":"phone"]}),e.jsx(os,{children:(o==null?void 0:o.current_step)==="verify_email"?`${l.email} to continue to ${(G=h==null?void 0:h.ui_settings)==null?void 0:G.app_name}`:`${l.phone_number} to continue to ${(X=h==null?void 0:h.ui_settings)==null?void 0:X.app_name}`})]}),e.jsxs(ns,{style:{gap:"15px"},onSubmit:N,noValidate:!0,children:[e.jsx(It,{onComplete:async B=>{I(B)},onResend:async()=>{const B=(o==null?void 0:o.current_step)==="verify_email"?"email_otp":"phone_otp";await r.prepareVerification({strategy:B})},error:m.otp,isSubmitting:v}),e.jsx(as,{type:"submit",disabled:v||t||!_,children:v?"Verifying...":`Continue to ${(se=h==null?void 0:h.ui_settings)==null?void 0:se.app_name}`})]}),e.jsxs(ss,{children:["Having trouble?"," ",e.jsx(wn,{children:e.jsx(tt,{to:h.ui_settings.support_page_url,children:"Contact support"})}),e.jsx("div",{style:{marginTop:"var(--space-sm)"},children:e.jsx(wn,{onClick:()=>{T()},style:{cursor:"pointer"},children:"Use other method"})})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ie,{}),e.jsxs(bn,{children:[e.jsx(yn,{children:"Create your account"}),e.jsx(os,{children:b!=null&&b.valid?"You've been invited! Complete your registration below.":"Welcome! Please fill in the details to get started."})]}),D.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(wa,{connections:D,callback:O}),e.jsx(Lp,{children:e.jsx(Ap,{children:"or"})})]}),e.jsxs(ns,{onSubmit:R,noValidate:!0,children:[(((oe=M==null?void 0:M.first_name)==null?void 0:oe.enabled)||((ce=M==null?void 0:M.last_name)==null?void 0:ce.enabled))&&e.jsxs(Dp,{$isBothEnabled:Y,children:[((K=M==null?void 0:M.first_name)==null?void 0:K.enabled)&&e.jsxs(sr,{children:[e.jsxs(ir,{htmlFor:"first_name",children:["First name",((ie=M==null?void 0:M.first_name)==null?void 0:ie.required)&&e.jsx(cr,{children:"*"})]}),e.jsx(de,{type:"text",id:"first_name",name:"first_name",required:!0,minLength:3,maxLength:30,value:l.first_name,onChange:P,placeholder:"First name","aria-invalid":!!m.first_name,pattern:"^[a-zA-Z]{3,30}$"}),m.first_name&&e.jsx(Mt,{children:m.first_name})]}),((Z=M==null?void 0:M.last_name)==null?void 0:Z.enabled)&&e.jsxs(sr,{children:[e.jsxs(ir,{htmlFor:"last_name",children:["Last name",((q=M==null?void 0:M.last_name)==null?void 0:q.required)&&e.jsx(cr,{children:"*"})]}),e.jsx(de,{type:"text",id:"last_name",name:"last_name",required:!0,minLength:3,maxLength:30,value:l.last_name,onChange:P,placeholder:"Last name","aria-invalid":!!m.last_name,pattern:"^[a-zA-Z]{3,30}$"}),m.last_name&&e.jsx(Mt,{children:m.last_name})]})]}),(M==null?void 0:M.username.enabled)&&e.jsxs(sr,{children:[e.jsxs(ir,{htmlFor:"username",children:["Username",M.username.required&&e.jsx(cr,{children:"*"})]}),e.jsx(de,{type:"text",id:"username",name:"username",minLength:3,maxLength:20,value:l.username,onChange:P,placeholder:"Choose a username","aria-invalid":!!m.username,required:!0,pattern:"^[a-zA-Z][a-zA-Z0-9_.]{2,29}$"}),m.username&&e.jsx(Mt,{children:m.username})]}),(M==null?void 0:M.email_address.enabled)&&e.jsxs(sr,{children:[e.jsxs(ir,{htmlFor:"email",children:["Email address",M.email_address.required&&e.jsx(cr,{children:"*"})]}),e.jsx(de,{type:"email",id:"email",name:"email",maxLength:320,value:l.email,onChange:P,placeholder:"Enter your email address","aria-invalid":!!m.email,required:!0,readOnly:(b==null?void 0:b.valid)&&!!(b!=null&&b.email),pattern:"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"}),m.email&&e.jsx(Mt,{children:m.email})]}),(M==null?void 0:M.phone_number.enabled)&&e.jsxs(sr,{children:[e.jsxs(ir,{htmlFor:"phone_number",children:["Phone number",M.phone_number.required&&e.jsx(cr,{children:"*"})]}),e.jsx(Ur,{value:l.phone_number,onChange:P,error:m.phone_number,countryCode:C,setCountryCode:z}),m.phone_number&&e.jsx(Mt,{children:m.phone_number})]}),(M==null?void 0:M.password.enabled)&&e.jsxs(sr,{children:[e.jsxs(ir,{htmlFor:"password",children:["Password",M.password.required&&e.jsx(cr,{children:"*"})]}),e.jsx(Np,{children:e.jsx(de,{type:"password",id:"password",name:"password",value:l.password,onChange:P,placeholder:"Enter your password","aria-invalid":!!m.password,required:!0,minLength:8,maxLength:128,pattern:"^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,125}$"})}),m.password&&e.jsx(Mt,{children:m.password})]}),m.submit&&e.jsx(Mt,{children:m.submit}),e.jsx(as,{type:"submit",disabled:v||t,children:v?"Creating account...":"Continue"})]}),e.jsxs(ss,{children:["Already have an account?"," ",e.jsx(wn,{children:e.jsx(tt,{to:`${(A=h.ui_settings)==null?void 0:A.sign_in_page_url}${window.location.search}`,children:"Sign in"})})]})]})})})}/**
688
688
  * @license lucide-react v0.474.0 - ISC
689
689
  *
690
690
  * This source code is licensed under the ISC license.