1import{r as n,j as e,L as c,e as p}from"./index-CWvV5cvI.js";import{M as g}from"./mail-C5XLUiID.js";import{L as b}from"./loader-circle-BSSIn_fq.js";import{K as f}from"./key-round-BKCUatC_.js";function v(){const[i,m]=n.useState(""),[l,x]=n.useState(""),[d,u]=n.useState(!0),[t,o]=n.useState({kind:"idle"}),a=t.kind==="submitting";async function h(r){if(r.preventDefault(),!i.trim()||!l.trim()){o({kind:"error",message:"Enter both your DealMirror code and email."});return}o({kind:"submitting"});try{const s=await(await fetch("/api/dealmirror/redeem",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:i.trim(),email:l.trim(),optIn:d})})).json();if(!s.ok){o({kind:"error",message:s.message??"Redemption failed. Try again."});return}o({kind:"success",licenseKey:s.licenseKey,email:s.email,plan:s.plan,alreadyRedeemed:!!s.alreadyRedeemed})}catch{o({kind:"error",message:"Network problem. Check your connection and try again."})}}return e.jsx("main",{className:"min-h-screen px-6 py-20",children:e.jsxs("div",{className:"mx-auto max-w-lg",children:[e.jsx(c,{to:"/",className:"mb-8 inline-block text-sm text-white/60 hover:text-white",children:"â Back to notionflow.io"}),e.jsxs("header",{className:"mb-8",children:[e.jsx("div",{className:"mb-4 inline-block rounded-full bg-white/10 px-3 py-1 text-xs font-semibold uppercase tracking-wider text-white/90",children:"DealMirror Deal"}),e.jsx("h1",{className:"text-3xl font-bold tracking-tight text-white",children:"Redeem your NotionFlow code"}),e.jsx("p",{className:"mt-3 text-base leading-relaxed text-white/70",children:"Enter your email and the code from DealMirror. We'll unlock the full NotionFlow Suite â every extension, current and future â on your account, and email your license keys."})]}),t.kind==="success"?e.jsxs("section",{className:"rounded-2xl border border-border bg-card p-8 shadow-sm",children:[e.jsx("div",{className:"mb-5 inline-flex h-12 w-12 items-center justify-center rounded-xl bg-green-100 ring-1 ring-green-200",children:e.jsx(p,{className:"h-6 w-6 text-green-700"})}),e.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:t.alreadyRedeemed?"Welcome back":"Suite Pro is active"}),e.jsxs("p",{className:"mt-2 inline-flex items-center gap-1.5 text-sm text-muted-foreground",children:[e.jsx(g,{className:"h-4 w-4"})," We emailed your license keys to ",t.email,"."]}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Plan: ",e.jsx("span",{className:"font-medium text-foreground",children:t.plan==="pro_yearly"?"Annual (1 year)":"Lifetime"})]}),e.jsxs("div",{className:"mt-6 rounded-xl bg-muted p-5 text-center",children:[e.jsx("p",{className:"mb-2 text-xs uppercase tracking-widest text-muted-foreground",children:"Suite license key"}),e.jsx("p",{className:"break-all font-mono text-xl font-bold tracking-wider text-foreground",children:t.licenseKey})]}),e.jsxs("div",{className:"mt-8 rounded-xl border border-border p-5 text-left",children:[e.jsx("h3",{className:"mb-2 text-sm font-semibold text-foreground",children:"Next steps"}),e.jsxs("ol",{className:"list-decimal space-y-1.5 pl-5 text-sm text-muted-foreground",children:[e.jsx("li",{children:"Install any NotionFlow extension from the Chrome Web Store."}),e.jsxs("li",{children:["Open its settings and go to ",e.jsx("span",{className:"font-medium text-foreground",children:"Activate Pro"}),"."]}),e.jsx("li",{children:"Paste a license key from your email (or connect Notion if that email matches). The whole suite unlocks."})]})]}),e.jsxs("p",{className:"mt-6 text-sm text-muted-foreground",children:["Need help? ",e.jsx(c,{to:"/support",className:"underline",children:"Contact support"}),"."]})]}):e.jsxs("form",{onSubmit:h,className:"space-y-5 rounded-2xl border border-border bg-card p-8 shadow-sm",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"mb-1.5 block text-sm font-medium text-foreground",children:"Email"}),e.jsx("input",{id:"email",type:"email",value:l,onChange:r=>x(r.target.value),placeholder:"[email protected]",disabled:a,className:"w-full rounded-lg border border-border bg-background px-4 py-3 text-foreground outline-none focus:ring-2 focus:ring-primary/30"}),e.jsx("p",{className:"mt-1.5 text-xs text-muted-foreground",children:"Your Pro is tied to this email â pick one you'll keep."})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"code",className:"mb-1.5 block text-sm font-medium text-foreground",children:"DealMirror code"}),e.jsx("input",{id:"code",type:"text",autoComplete:"off",spellCheck:!1,value:i,onChange:r=>m(r.target.value.toUpperCase()),placeholder:"DM-NF-XX-XXXXXX",disabled:a,className:"w-full rounded-lg border border-border bg-background px-4 py-3 font-mono text-sm tracking-wide text-foreground outline-none focus:ring-2 focus:ring-primary/30"})]}),e.jsxs("label",{className:"flex items-start gap-2.5 text-sm text-muted-foreground",children:[e.jsx("input",{type:"checkbox",checked:d,onChange:r=>
1u(r.target.checked),disabled:a,className:"mt-0.5 h-4 w-4 rounded border-border"}),e.jsx("span",{children:"Send me occasional product tips and deals from Beast Creative. No spam, unsubscribe anytime."})]}),t.kind==="error"&&e.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3 text-sm text-red-700",children:t.message}),e.jsx("button",{type:"submit",disabled:a,className:"flex w-full items-center justify-center gap-2 rounded-lg bg-primary px-4 py-3 font-medium text-primary-foreground transition hover:opacity-90 disabled:opacity-60",children:a?e.jsxs(e.Fragment,{children:[e.jsx(b,{className:"h-4 w-4 animate-spin"})," Redeemingâ¦"]}):e.jsxs(e.Fragment,{children:[e.jsx(f,{className:"h-4 w-4"})," Redeem code"]})})]})]})})}export{v as DealMirrorPage};
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.