PageSourceSearch

https://bookingme.ai/assets/login-Do1G2NYm.js

js bookingme.ai collected 2026-10-05 13:56:32 UTC 5,264 bytes, 1 lines download raw bytes

1import{u as _,r as o,s as r,j as t,L as q,z as E,B,t as l}from"./index-c3yCc6ME.js";import{u as L}from"./useServerFn-BecMQxnj.js";import{l as M}from"./index-hcTgCRrq.js";import{l as z}from"./portal.functions-t0spjvlB.js";function W(){const n=_(),[a,p]=o.useState("signin"),[c,h]=o.useState(""),[d,b]=o.useState(""),[g,w]=o.useState(""),[f,i]=o.useState(!1),v=L(z);o.useEffect(()=>{let e=!1;return r.auth.getSession().then(({data:s})=>{!e&&s.session&&u()}),()=>{e=!0}},[]);const u=async()=>{const{data:{user:e}}=await r.auth.getUser();if(!e)return;const[{data:s},{data:N}]=await Promise.all([r.from("profiles").select("phone").eq("id",e.id).maybeSingle(),r.from("businesses").select("id").eq("owner_id",e.id).maybeSingle()]);if(N){s?.phone?n({to:"/dashboard"}):n({to:"/onboarding"});return}const{data:S}=await r.from("staff_members").select("id").eq("user_id",e.id).eq("is_active",!0).limit(1);if(S?.length){n({to:"/dashboard"});return}const{data:k}=await r.from("vendors").select("id").eq("owner_id",e.id).limit(1);if(k?.length){n({to:"/vendor"});return}try{if((await v({})).length){const m=new URLSearchParams(window.location.search).get("next");if(m&&m.startsWith("/portal/")){const x=m.split("/")[2];if(x){n({to:"/portal/$eventId",params:{eventId:x}});return}}n({to:"/portal"});return}}catch{}const{data:C}=await r.from("customer_profiles").select("user_id").eq("user_id",e.id).maybeSingle();if(C){n({to:"/account"});return}n({to:"/onboarding"})},y=async e=>{e.preventDefault(),i(!0);try{if(a==="signup"){const{error:s}=await r.auth.signUp({email:c,password:d,options:{emailRedirectTo:window.location.origin,data:{full_name:g}}});if(s)throw s;l.success("Account created! Check your email to verify.")}else{const{error:s}=await r.auth.signInWithPassword({email:c,password:d});if(s)throw s;await u()}}catch(s){l.error(s.message)}finally{i(!1)}},j=async()=>{i(!0);try{const e=await M.auth.signInWithOAuth("google",{redirect_uri:window.location.origin+"/login"});if(e.error){l.error(e.error.message??"Google sign-in failed"),i(!1);return}if(e.redirected)return;await u()}catch(e){l.error(e.message??"Google sign-in failed"),i(!1)}};return t.jsx("div",{className:"flex min-h-screen flex-col bg-gradient-hero",children:t.jsxs("div",{className:"mx-auto flex w-full max-w-md flex-1 flex-col justify-center px-4 py-10",children:[t.jsx(q,{to:"/",className:"mb-8 self-center",children:t.jsx(E,{size:"lg"})}),t.jsxs("div",{className:"rounded-3xl border border-border/60 bg-card/95 p-8 shadow-elegant backdrop-blur",children:[t.jsx("h1",{className:"font-display text-3xl font-semibold",children:a==="signin"?"Welcome back":"Create your account"}),t.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:a==="signin"?"Sign in to manage your bookings.":"Join BookingMe — book or list, in minutes."}),t.jsxs("button",{onClick:j,className:"mt-6 flex w-full items-center justify-center gap-2 rounded-full border border-border bg-background py-3 text-sm font-medium transition hover:bg-muted",children:[t.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",children:[t.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),t.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.99.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),t.jsx("path",{fill:"#FBBC04",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),t.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]}),"Continue with Google"]}),t.jsxs("div",{className:"my-5 flex items-center gap-3 text-xs text-muted-foreground",children:[t.jsx("div",{className:"h-px flex-1 bg-border"})," or ",t.jsx("div",{className:"h-px flex-1 bg-border"})]}),t.jsxs("form",{onSubmit:y,className:"space-y-3",children:[a==="signup"&&t.jsx("input",{value:g,onChange:e=>w(e.target.value),placeholder:"Full name",required:!0,className:"w-full rounded-xl border border-input bg-background px-4 py-3 text-sm outline-none focus:border-accent focus:ring-2 focus:ring-accent/20"}),t.jsx("input",{type:"email",value:c,onChange:e=>h(e.target.value),placeholder:"Email",required:!0,className:"w-full rounded-xl border border-input bg-background px-4 py-3 text-sm outline-none focus:border-accent focus:ring-2 focus:ring-accent/20"}),t.jsx("input",{type:"password",value:d,onChange:e=>b(e.target.value),placeholder:"Password",required:!0,minLength:6,className:"w-full rounded-xl border border-input bg-background px-4 py-3 text-sm outline-none focus:border-accent focus:ring-2 focus:ring-accent/20"}
1),t.jsx(B,{type:"submit",disabled:f,className:"w-full rounded-full bg-primary py-6 text-base",children:f?"...":a==="signin"?"Sign in":"Create account"})]}),t.jsxs("div",{className:"mt-5 text-center text-sm text-muted-foreground",children:[a==="signin"?"New here?":"Have an account?"," ",t.jsx("button",{onClick:()=>p(a==="signin"?"signup":"signin"),className:"font-medium text-accent hover:underline",children:a==="signin"?"Create an account":"Sign in"})]})]})]})})}export{W as component};

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.