1import{r as u,j as e,a7 as q,a8 as E,a9 as N,P as T,K as C,aa as _,ab as U,u as z,ac as L,ad as W,s as f,R as B,ae as P,af as R}from"./index-V72ovg5l.js";import{G as D,P as Y,p as M,a as O,s as F}from"./GoogleButton-DkgC3whQ.js";import{A as G,a as I,b as H}from"./AuthFrame-KaPv7GC_.js";const $={shot:{src:"/preview-fixtures/audit-score-strip.webp",alt:"A real Postclick audit score for a landing page: 54 out of 100",caption:"A real Postclick audit.",url:"postclick.ppc.io",crop:"score-block"},findings:["Your price hides in the footer.","Your sharpest hook sits three scrolls down."]};function K({onSignup:h,auditHost:c,preview:t,googleReturnTo:s}){const[d,k]=u.useState(""),[j,A]=u.useState(""),[o,x]=u.useState("idle"),[v,r]=u.useState(""),l=async g=>{if(g.preventDefault(),!h||o==="sending")return;const b=M(j);if(b){x("error"),r(b);return}x("sending"),r("");const m=await O(()=>h(d.trim().toLowerCase(),j));m?(x("error"),r(m)):x("idle")},n=!!t,i=!!c,a=t?.host??c,p=t?.findingCount??0,w=n&&t?.screenshot&&a?{src:t.screenshot,alt:`The landing page scanned for ${a}`,url:a}:$.shot,y=n?t?.findings??[]:i?[]:$.findings,S=y.length>0?e.jsx("ol",{className:"r5signup-findings",children:y.slice(0,2).map((g,b)=>e.jsxs("li",{children:[e.jsx(q,{n:b+1,tone:"purple",size:"sm"}),e.jsx("span",{children:g})]},g))}):i&&a?e.jsxs("p",{className:"r5signup-queued",children:[e.jsx(E,{"aria-hidden":!0,weight:"fill"}),e.jsxs("span",{children:["Full audit queued for ",e.jsx("strong",{children:a})]})]}):null;return e.jsxs(e.Fragment,{children:[e.jsx("style",{children:J}),e.jsx(G,{header:e.jsx(T,{rich:!0,title:n?e.jsxs(e.Fragment,{children:["Finish the ",e.jsx(C,{icon:_,children:"audit"})]}):i?e.jsxs(e.Fragment,{children:["Your full ",e.jsx(C,{icon:_,children:"audit"})]}):e.jsxs(e.Fragment,{children:["Fix the ",e.jsx(C,{icon:U,children:"page"})]}),description:n?p>0?`${p} ${p===1?"issue":"issues"} found on ${a}.`:`Scanning ${a}.`:i?`Sign up and the full audit of ${a} starts immediately.`:void 0}),card:e.jsxs("form",{onSubmit:l,children:[e.jsx(D,{label:"Continue with Google",returnTo:s}),e.jsx(I,{label:"Work email",type:"email",value:d,onChange:k,placeholder:"[email protected]",autoComplete:"email"}),e.jsx(I,{label:"Password",type:"password",value:j,onChange:A,placeholder:"Create a password",autoComplete:"new-password",hint:Y}),e.jsx(N,{type:"submit",size:"lg",className:"r5auth-submit",busy:o==="sending",children:o==="sending"?"Creating accountâ¦":n?"Create account and continue":i?"Create account + start audit":"Create account"}),n||i?e.jsx("p",{className:"r5signup-note",children:"No card required. We email you when it is ready."}):null,o==="error"&&v?e.jsx(H,{children:v}):null]}),underCard:e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Already have an account?"," ",e.jsx("a",{className:"r5auth-link",href:"/login",children:"Log in"})]}),e.jsxs("p",{className:"r5signup-terms",children:["By creating an account you agree to our"," ",e.jsx("a",{className:"r5auth-link",href:"https://ppc.io/terms",children:"terms"})," ","and"," ",e.jsx("a",{className:"r5auth-link",href:"https://ppc.io/privacy",children:"privacy policy"}),"."]})]}),desk:{checklistTitle:n?"Your scan is only the start.":i?"Your page is waiting.":"See the problems.",sub:n?`Finish the full audit of ${a} and build the page.`:"Postclick finds the landing page problems that cost paid conversions, then helps you design and build the fix.",shot:w,proof:S}})]})}const J=` 2.r5signup-note { 3 margin: 12px 0 0; 4 color: var(--ppc-text-muted); 5 font-size: 13px; 6 font-weight: 500; 7 line-height: 1.45; 8 text-align: center; 9} 10.r5signup-terms { font-size: 13px; } 11.r5signup-findings { 12 display: grid; 13 gap: 8px; 14 margin: 0; 15 padding: 0; 16 list-style: none; 17} 18.r5signup-findings li { 19 display: flex; 20 align-items: center; 21 gap: 12px; 22 min-height: 52px; 23 padding: 10px 14px; 24 border: .5px solid rgba(255, 255, 255, .10); 25 border-radius: var(--ppc-radius-card); 26 background: rgba(255, 255, 255, .045); 27 box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); 28 color: rgba(255, 255, 255, .92); 29 font-size: 15px; 30 font-weight: 600; 31 line-height: 1.4; 32} 33.r5signup-queued { 34 display: flex; 35 align-items: center; 36 gap: 10px; 37 margin: 0; 38 padding: 12px 14px; 39 border: .5px solid rgba(255, 255, 255, .10); 40 border-radius: var(--ppc-radius-card); 41 background: rgba(255, 255, 255, .045); 42 color: var(--ppc-text-on-dark); 43 font-size: 15px; 44 font-weight: 500; 45} 46.r5signup-queued strong { color: rgba(255, 255, 255, .96); font-weight: 700; } 47.r5signup-queued svg { flex: 0 0 auto; color: var(--ppc-status-healthy); font-size: 20px; } 48`;function Z(){const h=z(),{plan:c,audit:t,preview:s,src:d}=L.useSearch(),k=u.useMemo(()=>W(t),[t]),[j,A]=u.useState(()=>s?{auditId:s,host:"your landing page",screenshot:null,findingCount:0,findings:[],status:"running"}:null);u.useEffect(()=>{if(!s)return;let r=!0;return(async()=>{const[{data:l},{data:n},{data:i}]=await Promise.all([f.from("audits").select("source_url, status, summary").eq("id",s).is("workspace_id",null).eq("audit_type","preview").maybeSingle(),f.from("findings").select("payload").eq("audit_id",s).is("superseded_at",null).order("created_at",{ascending:!1}).limit(1).maybeSingle(),f.from("quick_findings").select("payload").eq("audit_id",s).is("superseded_at",null).order("created_at",{ascending:!1}).limit(1).maybeSingle()]);if(!r||!l?.source_url)return;const a=n?.payload,p=["killers","copy","friction"].flatMap(m=>Array.isArray(a?.[m])?a[m]:[]),w=Array.isArray(i?.payload?.leaks)?i.payload.leaks:[],y=p.length?p:w,g=l.summary?.scrape;let b="your landing page";
48try{b=new URL(l.source_url).hostname.replace(/^www\./i,"")}catch{}A({auditId:s,host:b,screenshot:typeof g?.screenshot=="string"&&g.screenshot||typeof g?.screenshotUrl=="string"&&g.screenshotUrl||null,findingCount:y.length,findings:y.map(m=>typeof m.title=="string"?m.title:"").filter(Boolean).slice(0,2),status:l.status})})(),()=>{r=!1}},[s]);const o=u.useMemo(()=>s?{to:"/scan/$auditId",params:{auditId:s},search:{claim:"1",...d?{src:d}:{}}}:c?{to:"/pricing",search:{plan:c}}:{to:"/dashboard",search:t?{start:t}:{}},[t,c,s,d]),x=u.useMemo(()=>{if(s){const r=new URLSearchParams({claim:"1",...d?{src:d}:{}});return`/scan/${s}?${r.toString()}`}return c?`/pricing?plan=${encodeURIComponent(c)}`:t?`/dashboard?start=${encodeURIComponent(t)}`:"/dashboard"},[t,c,s,d]);u.useEffect(()=>{f.auth.getSession().then(({data:r})=>{r.session&&h(o)})},[h,o]);const v=async(r,l)=>{const n=r.trim().toLowerCase(),{data:i,error:a}=await f.auth.signUp({email:n,password:l,options:{emailRedirectTo:`${window.location.origin}${x}`}});if(a){const{error:y}=await f.auth.signInWithPassword({email:n,password:l});if(!y){const{data:S}=await f.auth.getUser();return S.user&&P(S.user.id),h(o),null}return/already registered|already exists/i.test(a.message)?"An account with this email already exists. Try signing in instead, or use a different email address.":F(a.message)}if(i.session)return P(i.session.user.id),R("signup_completed",{source:"signup"}),h(o),null;const{data:p,error:w}=await f.auth.signInWithPassword({email:n,password:l});return w?F(w.message):(p.user&&P(p.user.id),R("signup_completed",{source:"signup"}),h(o),null)};return e.jsx(B,{config:"bare",active:null,children:e.jsx(K,{onSignup:v,auditHost:k,preview:j,googleReturnTo:x})})}export{Z 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.