PageSourceSearch

https://iconaapp.com/assets/social-auth-complete-form-Bx5f1Yk7.js

js iconaapp.com collected 2026-10-06 15:23:42 UTC 7,578 bytes, 11 lines download raw bytes

1import{c as w,r as f,i as A,b as R,l as G,s as g,m as T,j as e,I as u,B}from"./index-WHULU0jW.js";import{u as O,F as z,a as o,b as l,c as n,d,t as H}from"./form-E7bzEHyU.js";import{C as J,a as Y,b as _}from"./card-BlH5Drk3.js";import{S as N,a as v,b as y,c as S,d as m}from"./select-GrX3B2N2.js";import{A as $,a as K}from"./alert-CnyCenlc.js";import{U as C}from"./user-0i7uv4fM.js";import{G as Q}from"./globe-Jm8oSgPd.js";import{P as W}from"./phone-BY_9-kar.js";import{U as X}from"./users-B3UdF1il.js";import"./label-Cp0G8FgB.js";import"./index-BdQq_4o_.js";import"./index-DXGq4QHA.js";import"./index-BFruoVYP.js";import"./chevron-down-6yZoXBwj.js";import"./chevron-up-CBx5ZPzc.js";/**
2 * @license lucide-react v0.453.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Z=w("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/**
7 * @license lucide-react v0.453.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const L=w("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);function he({userEmail:F,socialAuthData:c,onComplete:k,isLoading:s=!1}){var j,b;const[h,p]=f.useState(""),{toast:U}=A(),{settings:P}=R(),x=P.allowed_countries??null,E=G(x),M=f.useMemo(()=>x===null?g:g.extend({country:T().min(1,"Country is required")}),[x]),V=((j=c.displayName)==null?void 0:j.split(" ")[0])||"",I=((b=c.displayName)==null?void 0:b.split(" ").slice(1).join(" "))||"",a=O({resolver:H(M),defaultValues:{firstName:V,lastName:I,userName:"",country:"",phone:"",gender:""}}),q=async r=>{try{p(""),await k(r)}catch(t){console.error("Social auth completion failed:",t);const i=(t==null?void 0:t.message)||"Failed to complete account setup. Please try again.";p(i),U({variant:"destructive",title:"Setup failed",description:i})}};return e.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center bg-background relative overflow-hidden",children:[e.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-background via-background to-primary/5 pointer-events-none"}),e.jsxs("div",{className:"relative z-10 w-full max-w-2xl px-4 sm:px-6 md:px-8",children:[e.jsxs("div",{className:"text-center mb-8",children:[e.jsxs("div",{className:"flex items-center justify-center w-16 h-16 mx-auto mb-4 rounded-2xl bg-primary/10 overflow-hidden",children:[c.photoURL?e.jsx("img",{src:c.photoURL,alt:"Profile",className:"w-full h-full object-cover",onError:r=>{var i;const t=r.target;t.style.display="none",(i=t.nextElementSibling)==null||i.classList.remove("hidden")}}):null,e.jsx(L,{className:`h-8 w-8 text-primary ${c.photoURL?"hidden":""}`})]}),e.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:"Complete Your Profile"}),e.jsx("p",{className:"text-muted-foreground mb-2",children:"Just a few more details to finish setting up your account"}),e.jsxs("p",{className:"text-xs text-muted-foreground/70",children:["Signed in as: ",F]})]}),e.jsxs(J,{className:"shadow-2xl border border-border/50 bg-card/80 backdrop-blur-sm","data-testid":"card-social-auth-complete",children:[e.jsx(Y,{className:"pb-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:"Setup your profile"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Choose your unique username to complete your account"})]})}),e.jsxs(_,{className:"space-y-6 pb-8",children:[h&&e.jsx($,{variant:"destructive",className:"mb-4","data-testid":"alert-submit-error",children:e.jsx(K,{children:h})}),e.jsx(z,{...a,children:e.jsxs("form",{onSubmit:a.handleSubmit(q),className:"space-y-6","data-testid":"form-social-auth-complete",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsx(o,{control:a.control,name:"firstName",render:({field:r})=>e.jsxs(l,{children:[e.jsx(n,{children:e.jsxs("div",{className:"relative",children:[e.jsx(C,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(u,{...r,placeholder:"First Name",className:"pl-10 bg-input border-border text-foreground placeholder:text-muted-foreground h-12",disabled:s,"data-testid":"input-firstName"})]})}),e.jsx(d,{})]})}),e.jsx(o,{control:a.control,name:"lastName",render:({field:r})=>e.jsxs(l,{children:[e.jsx(n,{children:e.jsxs("div",{className:"relative",children:[e.jsx(C,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(u,{...r,placeholder:"Last Name",className:"pl-10 bg-input border-border text-foreground placeholder:text-muted-foreground h-12",disabled:s,"data-testid":"input-lastName"})]})}),e.jsx(d,{})]})})]}),e.jsx(o,{control:a.control,name:"userName",render:({field:r})=>e.jsxs(l,{children:[e.jsx(n,{children:e.jsxs("div",{className:"relative",children:[e.jsx(Z,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(u,{...r,placeholder:"Choose your unique username",className:"pl-10 bg-input border-border text-foreground placeholder:text-muted-foreground h-12",disabled:s,"data-testid":"input-userName"})]})}),e.jsx(d,{})]})}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[e.jsx(o,{control:a.control,name:"country",render:({field:r})=>e.jsxs(l,{children:[e.jsxs(N,{name:r.name,onValueChange:r.onChange,value:r.value,disabled:s,children:[e.jsx(n,{children:e.jsx(v,{className:"h-12 bg-input border-border text-foreground","data-testid":"select-country",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(Q,{className:"h-4 w-4 text-muted-foreground mr-3"}),e.jsx(y,{placeholder:"Select Country"})]})})}),e.jsx(S,{className:"max-h-60",children:E.map(t=>e.jsx(m,{value:t.name,children:t.name},t.isoCode))})]}),e.jsx(d,{})]})}),e.jsx(o,{control:a.control,name:"phone",render:({field:r})=>e.jsxs(l,{children:[e.jsx(n,{children:e.jsxs("div",{className:"relative",children:[e.jsx(W,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),e.jsx(u,{...r,placeholder:"Phone Number (optional)",className:"pl-10 bg-input border-border text-foreground placeholder:text-muted-foreground h-12",disabled:s,"data-testid":"input-phone",type:"tel"})]})}),e.jsx(d,{})]})})]}),e.jsx(o,{control:a.control,name:"gender",render:({field:r})=>e.jsxs(l,{children:[e.jsxs(N,{onValueChange:r.onChange,defaultValue:r.value,disabled:s,children:[e.jsx(n,{children:e.jsx(v,{className:"h-12 bg-input border-border text-foreground","data-testid":"select-gender",children:e.jsxs("div",{className:"flex items-center",children:[e.jsx(X,{className:"h-4 w-4 text-muted-foreground mr-3"}),e.jsx(y,{placeholder:"Select Gender (optional)"})]})})}),e.jsxs(S,{children:[e.jsx(m,{value:"male",children:"Male"}),e.jsx(m,{value:"female",children:"Female"}),e.jsx(m,{value:"other",children:"Other"}),e.jsx(m,{value:"prefer-not-to-say",children:"Prefer not to say"})]})]}),e.jsx(d,{})]})}
11),e.jsx(B,{type:"submit",className:"w-full bg-gradient-to-r from-primary to-accent hover:from-primary/90 hover:to-accent/90 text-white font-medium h-12 text-lg",disabled:s,"data-testid":"button-complete-setup",children:s?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-current border-t-transparent mr-3"}),"Setting up your account..."]}):"Complete Setup"})]})})]})]})]})]})}export{he as SocialAuthCompleteForm};

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.