1import{r as o,j as e}from"./animation-CddyXVCz.js";import{N,h as v,a5 as j,B as d,a3 as w,a4 as C,ab as _,D as S,m as P,p as $,S as I,r as R,ci as U,cd as L}from"./index-CGKNpi9E.js";import{c as E}from"./clipboard-C0L7pyCw.js";import"./react-vendor-CbN3pvl2.js";import"./supabase-iKSPld20.js";import"./docgen-Bp8WKBAE.js";import"./query-DPqpbKNH.js";const T=({title:a="Share and refer",description:t="Copy the public score link, open it on mobile, or share it directly with someone who can help.",shareUrl:l,referralUrl:m,referralCode:r,shareText:u,onOpen:x})=>{const n=N(),p=m||l,i=o.useMemo(()=>l||p,[p,l]),f=async()=>{try{await E(i),n.success("Link copied","The public score link is on your clipboard.")}catch(h){n.error("Could not copy link",h instanceof Error?h.message:"Try again.")}},b=async()=>{if(typeof navigator>"u"||!navigator.share){await f();return}try{await navigator.share({title:a,text:u||t,url:i}),n.success("Shared")}catch{}};return e.jsxs(v,{variant:"soft",padding:"md",className:"space-y-5 bg-gradient-to-br from-indigo-50 to-blue-50 dark:from-slate-900 dark:to-slate-800",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"rounded-2xl bg-indigo-600/10 p-3 text-indigo-600 dark:text-indigo-300",children:e.jsx(j,{className:"h-5 w-5"})}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.2em] text-indigo-600 dark:text-indigo-300",children:"Share"}),e.jsx("h2",{className:"text-xl font-bold text-slate-900 dark:text-slate-100",children:a}),e.jsx("p",{className:"text-sm text-slate-500 dark:text-slate-400",children:t})]})]}),e.jsxs("div",{className:"rounded-2xl border border-slate-200 bg-white/80 p-4 dark:border-slate-700 dark:bg-slate-900/60",children:[e.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-slate-400",children:"Public link"}),e.jsx("p",{className:"mt-2 break-all text-sm text-slate-700 dark:text-slate-300",children:i}),r&&e.jsxs("div",{className:"mt-3 inline-flex rounded-full bg-slate-100 px-3 py-1 text-xs font-semibold text-slate-600 dark:bg-slate-800 dark:text-slate-300",children:["Referral code: ",r]})]}),e.jsxs("div",{className:"flex flex-wrap gap-3",children:[e.jsx(d,{type:"button",variant:"primary",leftIcon:e.jsx(w,{className:"h-4 w-4"}),onClick:()=>{f()},children:"Copy Link"}),e.jsx(d,{type:"button",variant:"outline",leftIcon:e.jsx(C,{className:"h-4 w-4"}),onClick:()=>{b()},children:"Share"}),x&&e.jsx(d,{type:"button",variant:"ghost",onClick:x,children:"Open Preview"})]})]})},G=({kind:a})=>{const{code:t=""}=_(),l=S(),{session:m}=P(),[r,u]=o.useState(null),[x,n]=o.useState(!0),[p,i]=o.useState(null);o.useEffect(()=>{let s=!0;const k=String(t||"").trim().toUpperCase();return(async()=>{if(!k){s&&(i("Missing referral code"),n(!1));return}try{const c=await U(k);if(!s)return;u(c),i(null),await L({referralCode:c.kind==="referral"&&a==="referral"?k:null,campaignCode:c.kind==="campaign"||a==="promo"?k:null})}catch(c){if(!s)return;u(null),i(c instanceof Error?c.message:"Landing page unavailable")}finally{s&&n(!1)}})(),()=>{s=!1}},[t,a]);const f=o.useMemo(()=>(r==null?void 0:r.kind)==="campaign"?`${r.rewardDays} days of Pro | CareerDiary`:r!=null&&r.referrerName?`Invite from ${r.referrerName} | CareerDiary`:"CareerDiary Referral Offer",[r]),b=o.useMemo(()=>r?r.description:a==="promo"?"Unlock a campaign bonus and stack it with your free Pro trial.":"Claim your free Pro trial from a CareerDiary referral link.",[r,a]);$({title:f,description:b,canonical:`https://careerdiary.io/${a==="promo"?"promo":"r"}/${String(t||"").trim().toUpperCase()}`,ogImage:"https://careerdiary.io/preview-2026-02.png",ogUrl:`https://careerdiary.io/${a==="promo"?"promo":"r"}/${String(t||"").trim().toUpperCase()}`,type:"website"});const h=()=>{if(m){l("/app/settings/billing");return}l("/signup")},g=(r==null?void 0:r.vanityCode)||(r==null?void 0:r.code)||String(t||"").trim().toUpperCase(),y=(r==null?void 0:r.referralLink)||`https://careerdiary.io/${a==="promo"?"promo":"r"}/${g}`;return e.jsx("div",{className:"min-h-screen min-h-dvh overflow-x-hidden bg-[radial-gradient(circle_at_top_left,_rgba(59,130,246,0.18),_transparent_35%),radial-gradient(circle_at_top_right,_rgba(16,185,129,0.14),_transparent_28%),linear-gradient(180deg,_#f8fafc_0%,_#ffffff_42%,_#f8fafc_100%)] text-slate-900 dark:bg-[radial-gradient(circle_at_top_left,_rgba(59,130,246,0.22),_transparent_35%),radial-gradient(circle_at_top_right,_rgba(16,185,129,0.14),_transparent_28%),linear-gradient(180deg,_#020617_0%,_#0f172a_46%,_#020617_100%)] dark:text-white",children:e.jsxs("div",{className:"mx-auto flex min-h-screen min-h-dvh w-full max-w-6xl flex-col px-4 py-6 sm:px-6 lg:px-8",children:[e.jsxs("div",{className:"mb-8 flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-slate-200 bg-white/85 px-4 py-2 text-xs font-semibold uppercase tracking-[0.2em] text-slate-600 shadow-sm backdrop-blur dark:border-slate-800 dark:bg-slate-950/70 dark:text-slate-300",children:[e.jsx(I,{className:"h-4 w-4 text-sky-500"}),a==="promo"?"Promo offer":"Referral invite"]}),e.jsx(d,{variant:"ghost",onClick:()=>l("/signup"),className:"rounded-full",children:"Sign up"})]}),e.jsxs("div",{className:"grid flex-1 gap-8 lg:grid-cols-[1.1fr_0.9fr] lg:items-start",children:[e.jsxs(v,{variant:"glass",className:"relative overflow-hidden border border-slate-200/80 bg-white/75 p-6 shadow-xl backdrop-blur dark:border-slate-800/70 dark:bg-slate-950/75 sm:p-8",children:[e.jsx("div",{className:"absolute inset-x-0 top-0 h-1 bg-gradient-to-r from-sky-500 via-indigo-500 to-emerald-500"}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-sky-200 bg-sky-50 px-3 py-1 text-[11px] font-bold uppercase tracking-[0.2em] text-sky-700 dark:border-sky-900/40 dark:bg-sky-950/40 dark:text-sky-200",children:[e.jsx(j,{className:"h-4 w-4"}),(r==null?void 0:r.kind)==="campaign"?"Campaign code":"Referral code"]}
1),e.jsx("h1",{className:"max-w-2xl text-4xl font-black tracking-tight text-slate-900 dark:text-white sm:text-5xl",children:x?"Loading your Pro offer...":p?"Claim your Pro time":(r==null?void 0:r.title)||"Claim 14 days of Pro"}),e.jsx("p",{className:"max-w-2xl text-base leading-7 text-slate-600 dark:text-slate-300 sm:text-lg",children:x?"We are checking the offer details.":p?"Join CareerDiary to start a free Pro trial. If the code is valid, your extra time will stack automatically.":b})]}),e.jsx("div",{className:"grid gap-3 sm:grid-cols-3",children:[{label:"Free trial",value:`${(r==null?void 0:r.signupDays)??7} days`},{label:"Bonus time",value:`${(r==null?void 0:r.bonusDays)??0} days`},{label:"Total unlock",value:`${(r==null?void 0:r.rewardDays)??7} days`}].map(s=>e.jsxs("div",{className:"rounded-2xl border border-slate-200 bg-slate-50/90 p-4 dark:border-slate-800 dark:bg-slate-900/70",children:[e.jsx("div",{className:"text-[11px] font-semibold uppercase tracking-[0.18em] text-slate-500 dark:text-slate-400",children:s.label}),e.jsx("div",{className:"mt-2 text-2xl font-bold text-slate-900 dark:text-white",children:s.value})]},s.label))}),e.jsx("div",{className:"rounded-3xl border border-emerald-200/70 bg-emerald-50/80 p-4 text-sm text-emerald-900 dark:border-emerald-900/40 dark:bg-emerald-950/20 dark:text-emerald-100",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(R,{className:"mt-0.5 h-5 w-5 flex-shrink-0"}),e.jsx("p",{children:"Your reward stacks into a single Pro credit expiry. New users get the 7-day signup trial plus referral or campaign time on top."})]})}),e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row",children:[e.jsx(d,{type:"button",variant:"primary",size:"lg",onClick:h,className:"rounded-full px-8",children:m?"Open billing":"Start free signup"}),e.jsx(d,{type:"button",variant:"outline",size:"lg",onClick:()=>l("/auth"),className:"rounded-full px-8",children:m?"View dashboard":"I already have an account"})]}),e.jsxs("div",{className:"rounded-2xl border border-slate-200 bg-white/80 p-4 text-sm text-slate-600 shadow-sm dark:border-slate-800 dark:bg-slate-950/60 dark:text-slate-300",children:[e.jsx("div",{className:"font-semibold text-slate-900 dark:text-white",children:"How it works"}),e.jsxs("ol",{className:"mt-3 space-y-2",children:[e.jsx("li",{children:"1. Create your account or sign in."}),e.jsx("li",{children:"2. Your trial and bonus time are activated automatically."}),e.jsx("li",{children:"3. Use Pro immediately, no Stripe checkout required."})]}),(r==null?void 0:r.kind)==="referral"&&r.referrerName&&e.jsxs("p",{className:"mt-3 text-xs uppercase tracking-[0.18em] text-slate-400",children:["Invited by ",r.referrerName]})]})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(T,{title:(r==null?void 0:r.kind)==="campaign"?"Campaign preview":"Referral preview",description:(r==null?void 0:r.kind)==="campaign"?"Share the promo link or open it on your own account.":"Copy the invite link and send it to a friend who is job hunting.",shareUrl:y,referralUrl:y,referralCode:g,shareText:r==null?void 0:r.description}),e.jsx(v,{variant:"glass",className:"border border-slate-200/70 bg-white/70 p-5 dark:border-slate-800/70 dark:bg-slate-950/70",children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-semibold uppercase tracking-[0.18em] text-slate-500 dark:text-slate-400",children:"Reward link"}),e.jsx("div",{className:"mt-2 break-all rounded-2xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm font-medium text-slate-900 dark:border-slate-800 dark:bg-slate-900 dark:text-slate-100",children:y})]}),e.jsx("div",{className:"text-sm text-slate-600 dark:text-slate-300",children:(r==null?void 0:r.kind)==="campaign"?`Promo code ${g} is worth ${(r==null?void 0:r.rewardDays)??0} days of Pro.`:`Referral code ${g} stacks a 7-day trial with a 7-day referral bonus.`}),e.jsx(d,{type:"button",variant:"ghost",className:"rounded-full",onClick:h,children:"Claim your Pro time"})]})})]})]})]})})};export{G as ReferralLandingPage,G 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.