PageSourceSearch

https://trovable.ai/assets/InviteLanding-WZ69w0Lu.js

js trovable.ai collected 2026-10-05 13:49:45 UTC 9,398 bytes, 1 lines download raw bytes

1import{u as ee,M as te,aK as se,r as s,dU as re,j as e,ah as ae,B as k,e as I,L as A,I as F,bn as ie,b2 as ne,bp as oe,b8 as f,dV as le,s as L,f as r,J as ce,aV as de,ai as me}from"./index-CaerIkuo.js";import{u as ue}from"./useNoIndex-DMRuXZls.js";import{L as xe}from"./leaf-CB7zEcnu.js";const fe=(x,v)=>{const n={},o=x.trim();return(!o||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o))&&(n.email="Please enter a valid email address"),v.length<8&&(n.password="Password must be at least 8 characters"),{errors:n,valid:Object.keys(n).length===0}},ye=()=>{ue();const{user:x,loading:v}=ee(),n=te(),[o]=se(),y=o.get("ref"),[m,R]=s.useState(""),[j,M]=s.useState(""),[b,D]=s.useState(!1),[h,l]=s.useState(!1),[u,N]=s.useState({}),[O,w]=s.useState(!1),[B,J]=s.useState(!1),[z,P]=s.useState(!1),[g,he]=s.useState(()=>sessionStorage.getItem("trovable_referral_code")||localStorage.getItem("invite_ref_code")||""),S=s.useRef(null),{deviceFingerprint:U,hadMouseMovement:W,isReady:Y,getFormFillTime:q,initializeTurnstile:C,resetTurnstile:_,ensureFreshTurnstileToken:G}=re();s.useEffect(()=>{if(y)try{localStorage.setItem("invite_ref",y)}catch{}},[y]),s.useEffect(()=>{sessionStorage.setItem("trovable_signup_meta",JSON.stringify({entry_point:"referral",utm_source:o.get("utm_source")||null,utm_campaign:o.get("utm_campaign")||null,started_at:Date.now()}))},[o]),s.useEffect(()=>{!x&&S.current&&C(S.current)},[x,C]);const K=()=>{const t=fe(m,j);return t.valid?(N({}),!0):(N(t.errors),!1)},T=async()=>{var p,V;const t=await G();if(!t){r.error("Security check failed. Please refresh and try again."),l(!1);return}try{const{detectSignupSource:Z}=await me(async()=>{const{detectSignupSource:a}=await import("./signupSource-CCFeSVyN.js");return{detectSignupSource:a}},[]),{data:c,error:i}=await L.functions.invoke("verify-signup",{body:{turnstileToken:t,email:m.trim(),password:j,username:m.split("@")[0],deviceFingerprint:U,formFillTimeSeconds:q(),hadMouseMovement:W,isBetaSignup:!1,betaCodeId:null,signupSource:Z()}});if(i){let a="Could not create account. Please try again.";try{if(i.context&&typeof i.context=="object"){const d=await((V=(p=i.context).json)==null?void 0:V.call(p))||i.context;d!=null&&d.error&&(a=d.error)}else if(i.message){const d=i.message.match(/\{.*\}/s);if(d){const E=JSON.parse(d[0]);E.error&&(a=E.error)}else a=i.message}}catch{}a.includes("already registered")?N({email:"This email is already registered. Try signing in."}):a.includes("rate")||a.includes("too many")?r.error("Too many signup attempts. Please wait and try again."):r.error(a),_();return}if(c!=null&&c.error){r.error(c.error),_();return}c!=null&&c.requiresEmailVerification?(g.trim()&&localStorage.setItem("trovable_pending_referral_code",g.trim()),P(!0),r.success("Account created! Please check your email to verify.")):(g.trim()&&localStorage.setItem("trovable_pending_referral_code",g.trim()),r.success("Account created! Welcome to Trovable."),n("/"))}catch{r.error("Something went wrong. Please try again."),_()}},$=async t=>{if(t.preventDefault(),!!K()){if(!B){w(!0);return}l(!0);try{await T()}finally{l(!1)}}},H=()=>{J(!0),w(!1),l(!0),T().finally(()=>l(!1))},Q=async()=>{l(!0);try{const{error:t}=await L.auth.resend({type:"signup",email:m.trim()});t?r.error(t.message):r.success("Verification email sent! Check your inbox.")}catch{r.error("Could not send verification email.")}finally{l(!1)}};if(v)return null;const X=[{icon:e.jsx(ce,{className:"w-5 h-5 text-coral"}),text:"Discover books, podcasts, newsletters, and articles curated by real people"},{icon:e.jsx(de,{className:"w-5 h-5 text-coral"}),text:"Join Pods — small communities built around shared curiosity"},{icon:e.jsx(xe,{className:"w-5 h-5 text-coral"}),text:"No algorithms, no infinite scroll, no dopamine traps"}];return z?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background px-4",children:e.jsxs("div",{className:"max-w-md w-full text-center space-y-6",children:[e.jsx("div",{className:"w-16 h-16 bg-accent/10 rounded-full flex items-center justify-center mx-auto",children:e.jsx(ae,{className:"w-8 h-8 text-accent"})}),e.jsx("h2",{className:"text-2xl font-serif font-semibold text-foreground",children:"Verify your email"}),e.jsxs("p",{className:"text-muted-foreground",children:["We've sent a verification link to ",e.jsx("strong",{children:m}),". Check your inbox and click the link to activate your account."]}),e.jsx(k,{onClick:Q,variant:"outline",className:"w-full",disabled:h,children:h?e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"w-4 h-4 animate-spin mr-2"}),"Sending..."]}):"Resend verification email"}),e.jsx("button",{type:"button",onClick:()=>P(!1),className:"text-sm text-muted-foreground hover:text-accent transition-colors",children:"Use a different email address"})]})}):e.jsxs("div",{className:"min-h-screen flex flex-col bg-background",children:[e.jsxs("div",{className:"flex-1 flex flex-col lg:flex-row items-center justify-center px-4 py-12 gap-12 lg:gap-20 max-w-5xl mx-auto w-full",children:[e.jsxs("div",{className:"flex-1 max-w-md w-full space-y-8 text-center lg:text-left",children:[e.jsx("h1",{className:"text-2xl font-serif font-bold tracking-tight text-foreground",children:"Trovable"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h2",{className:"text-3xl font-serif font-semibold text-foreground leading-tight",children:"You've been invited to Trovable"}),e.jsx("p",{className:"text-muted-foreground leading-relaxed",children:"A place to find content worth your time — and people worth talking about it with."})]}),e.jsx("div",{className:"space-y-4 text-left",children:X.map((t,p)=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"mt-0.5 shrink-0",children:t.icon}
1),e.jsx("p",{className:"text-sm text-foreground/80 leading-relaxed",children:t.text})]},p))})]}),e.jsx("div",{className:"flex-1 max-w-md w-full",children:x?e.jsxs("div",{className:"bg-card border border-border rounded-2xl p-8 text-center space-y-4",children:[e.jsx("h3",{className:"text-xl font-serif font-semibold text-foreground",children:"You're already a Trovable member!"}),e.jsx(k,{size:"lg",className:"w-full bg-coral hover:bg-coral/90 text-white",onClick:()=>n("/community"),children:"Go to Community"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Want to invite someone? Share your link from the Community page."})]}):e.jsxs("div",{className:"bg-card border border-border rounded-2xl p-8 space-y-6",children:[e.jsx("h3",{className:"text-xl font-serif font-semibold text-foreground text-center",children:"Create your free account"}),e.jsxs("form",{onSubmit:$,className:"space-y-5",children:[e.jsx("div",{ref:S,className:"sr-only"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{htmlFor:"invite-email",children:"Email"}),e.jsx(F,{id:"invite-email",type:"email",placeholder:"[email protected]",value:m,onChange:t=>R(t.target.value),className:u.email?"border-destructive":""}),u.email&&e.jsx("p",{className:"text-sm text-destructive",children:u.email})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(A,{htmlFor:"invite-password",children:"Password"}),e.jsxs("div",{className:"relative",children:[e.jsx(F,{id:"invite-password",type:b?"text":"password",placeholder:"••••••••",value:j,onChange:t=>M(t.target.value),className:u.password?"border-destructive pr-10":"pr-10"}),e.jsx("button",{type:"button",onClick:()=>D(!b),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:b?e.jsx(ie,{className:"w-4 h-4"}):e.jsx(ne,{className:"w-4 h-4"})})]}),u.password&&e.jsx("p",{className:"text-sm text-destructive",children:u.password})]}),e.jsx(k,{type:"submit",size:"lg",className:"w-full",disabled:h||!Y,children:h?e.jsxs(e.Fragment,{children:[e.jsx(I,{className:"w-4 h-4 animate-spin mr-2"}),"Creating account..."]}):"Create Account"}),e.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(oe,{className:"w-3.5 h-3.5"}),e.jsx("span",{children:"Protected by Cloudflare"})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute inset-0 flex items-center",children:e.jsx("div",{className:"w-full border-t border-border"})}),e.jsx("div",{className:"relative flex justify-center text-xs",children:e.jsx("span",{className:"bg-card px-2 text-muted-foreground",children:"or"})})]}),e.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:["Already have an account?"," ",e.jsx(f,{to:"/auth",className:"text-accent hover:underline",children:"Sign in"})]}),e.jsxs("p",{className:"text-xs text-center text-muted-foreground",children:["By creating an account, you agree to our"," ",e.jsx(f,{to:"/terms",className:"hover:text-foreground transition-colors underline",children:"Terms"})," ","and"," ",e.jsx(f,{to:"/privacy",className:"hover:text-foreground transition-colors underline",children:"Privacy Policy"}),"."]})]})})]}),e.jsxs("footer",{className:"py-6 text-center text-xs text-muted-foreground space-x-4 border-t border-border",children:[e.jsx("span",{children:"© 2026 Trovable"}),e.jsx(f,{to:"/terms",className:"hover:text-foreground transition-colors",children:"Terms"}),e.jsx(f,{to:"/privacy",className:"hover:text-foreground transition-colors",children:"Privacy"})]}),e.jsx(le,{open:O,onVerified:H,onDeclined:()=>w(!1)})]})};export{ye 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.