PageSourceSearch

https://webhunt.ai/assets/referrals-CRhGR2XU.js

js webhunt.ai collected 2026-10-05 13:58:01 UTC 11,638 bytes, 1 lines download raw bytes

1import{a as d,d as e}from"./vendor-query-BTjX_wdR.js";import{g8 as T,t as U,d as E,b0 as p,b1 as f,l as _,o as A,a1 as y,w as v,B as C,j as L,z as Y,A as z,m as B,b2 as F,h as R}from"./index-CkckB97G.js";import{C as I}from"./CoachCard-DSIWxS56.js";import{C as n,c as l,a as g,b as j,d as b}from"./card-Bl0YKt70.js";import{B as O}from"./badge-B76XdfOe.js";import{T as P}from"./trending-up-BfbhhVGz.js";import{C as D}from"./copy-CBm2EBEc.js";import{a as G,u as H}from"./use-transform-DrvtnECv.js";import{a as V}from"./index-YnG32L3O.js";import{f as N}from"./format-C_b85743.js";import{p as w}from"./parseISO-DXVQRmOT.js";import"./vendor-clerk-MFyiThSW.js";function $({value:s,reduced:a}){const r=G(0),t=H(r,m=>Math.round(m).toLocaleString()),[h,c]=d.useState("0");return d.useEffect(()=>{if(a){c(s.toLocaleString());return}const m=V(r,s,{duration:1.1,ease:[.16,1,.3,1]}),u=t.on("change",x=>c(x));return()=>{m.stop(),u()}},[s,a,r,t]),e.jsx("span",{children:h})}const k=["hsl(215, 71%, 49%)","hsl(210, 92%, 66%)","hsl(38, 92%, 50%)","hsl(150, 60%, 45%)","hsl(280, 65%, 60%)"];function J({fire:s}){const a=d.useMemo(()=>Array.from({length:80}).map((r,t)=>({id:t,x:(Math.random()-.5)*600,y:-(Math.random()*380+120),rotate:Math.random()*720-360,color:k[t%k.length],delay:Math.random()*.15,size:Math.random()*6+5})),[s]);return s===0?null:e.jsx("div",{className:"pointer-events-none absolute inset-0 z-20 flex items-center justify-center overflow-hidden","aria-hidden":"true",children:a.map(r=>e.jsx(B.span,{className:"absolute rounded-[2px]",style:{width:r.size,height:r.size*1.6,backgroundColor:r.color},initial:{opacity:1,x:0,y:0,rotate:0},animate:{opacity:[1,1,0],x:r.x,y:[0,r.y,r.y+420],rotate:r.rotate},transition:{duration:1.6,delay:r.delay,ease:[.2,.8,.3,1]}},r.id))},s)}function K({tiers:s}){return e.jsxs(n,{className:"bg-card shadow-sm",children:[e.jsxs(g,{children:[e.jsxs(j,{className:"flex items-center gap-2",children:[e.jsx(F,{className:"h-4 w-4 text-primary"}),"Earn more with higher-tier referrals"]}),e.jsx(b,{children:"The reward you earn depends on which plan your referral chooses. You keep earning regardless of your own plan."})]}),e.jsxs(l,{children:[e.jsx("div",{className:"overflow-hidden rounded-lg border border-border",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border bg-secondary/40",children:[e.jsx("th",{className:"px-4 py-2.5 text-left font-medium text-muted-foreground",children:"Plan they sign up for"}),e.jsx("th",{className:"px-4 py-2.5 text-right font-medium text-muted-foreground",children:"You earn"})]})}),e.jsx("tbody",{children:s.map((a,r)=>e.jsxs("tr",{className:R("transition-colors",r<s.length-1&&"border-b border-border",r===s.length-1&&"bg-primary/5 font-semibold"),children:[e.jsx("td",{className:"px-4 py-3 text-foreground",children:a.name}),e.jsxs("td",{className:"px-4 py-3 text-right tabular-nums text-foreground",children:[a.rewardUnlocks.toLocaleString()," unlocks"]})]},a.planKey))})]})}),e.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Rewards are held for 14 days, then added to your balance automatically."})]})]})}const W={joined:{label:"Signed up",className:"bg-secondary text-secondary-foreground"},paid:{label:"Reward pending",className:"bg-amber-100 text-amber-800 dark:bg-amber-500/15 dark:text-amber-300"},rewarded:{label:"Rewarded",className:"bg-emerald-100 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-300"},reversed:{label:"Reversed",className:"bg-rose-100 text-rose-800 dark:bg-rose-500/15 dark:text-rose-300"}};function q({invitee:s}){const a=W[s.status];return e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border bg-card px-4 py-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:s.email??"New invitee"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Joined ",N(w(s.createdAt),"MMM d, yyyy"),s.status==="paid"&&s.holdUntil&&e.jsxs(e.Fragment,{children:[" · ","matures ",N(w(s.holdUntil),"MMM d")]})]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[s.rewardUnlocks>0&&s.status!=="reversed"&&e.jsxs("span",{className:"hidden text-sm font-semibold text-foreground sm:inline",children:["+",s.rewardUnlocks," unlocks"]}),e.jsx(O,{variant:"secondary",className:R("shrink-0 border-0 font-medium",a.className),children:a.label})]})]})}function Q(){return e.jsx("div",{className:"mx-auto max-w-2xl py-10",children:e.jsxs(n,{className:"relative overflow-hidden border-primary/30 bg-card shadow-lg",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-60 [background:radial-gradient(60%_120%_at_50%_0%,hsl(var(--primary)/0.12),transparent_70%)]","aria-hidden":"true"}),e.jsxs(l,{className:"relative flex flex-col items-center px-8 py-12 text-center",children:[e.jsx("span",{className:"flex h-14 w-14 items-center justify-center rounded-2xl bg-primary/10 text-primary",children:e.jsx(v,{className:"h-7 w-7"})}),e.jsx("h2",{className:"mt-6 text-2xl font-bold tracking-tight text-foreground",children:"Earn free unlocks by referring others"}),e.jsx("p",{className:"mt-3 max-w-md text-muted-foreground",children:"Upgrade to any paid plan to unlock your personal referral link. Every friend who subscribes gets 50% off their first month — and you earn 25–500 unlocks based on the plan they sign up for."}),e.jsx(C,{asChild:!0,size:"lg",className:"mt-8 font-semibold",children:e.jsxs(Y,{href:"/billing",children:["View plans",e.jsx(z,{className:"ml-1 h-4 w-4"})]})})]})]})})}function ce(){const{data:s,isLoading:a}=T(),{toast:r}
1=U(),t=E(),[h,c]=d.useState(!1),[m,u]=d.useState(0),x=d.useRef(!1);d.useEffect(()=>{!t&&!x.current&&s?.eligible&&(s?.available??0)>0&&(x.current=!0,u(i=>i+1))},[s?.eligible,s?.available,t]);const M=async()=>{if(s?.shareUrl)try{await navigator.clipboard.writeText(s.shareUrl),c(!0),r({title:"Link copied",description:"Share it anywhere — your reward applies automatically."}),setTimeout(()=>c(!1),2e3)}catch{r({title:"Couldn't copy",description:"Copy the link manually instead.",variant:"destructive"})}};if(a)return e.jsx(p,{children:e.jsxs("div",{className:"mx-auto max-w-5xl space-y-8 p-4 md:p-8",children:[e.jsx(f,{className:"h-10 w-64"}),e.jsx(f,{className:"h-48 w-full"}),e.jsx(f,{className:"h-64 w-full"})]})});if(!s?.eligible)return e.jsx(p,{children:e.jsxs("div",{className:"p-4 md:p-8",children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Referrals"}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:"Invite others and earn free unlocks."})]}),e.jsx(Q,{})]})});const o=s.invitees??[],S=o.filter(i=>i.status==="rewarded").length;return e.jsxs(p,{children:[e.jsx(I,{slug:"referrals",headline:"Earn as you share",body:"Share your referral link and earn free Unlocks and AI Minutes when someone signs up. Your current balance and pending rewards appear here."}),e.jsxs("div",{className:"mx-auto max-w-5xl space-y-8 p-4 md:p-8 animate-in fade-in duration-500",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold tracking-tight",children:"Referrals"}),e.jsx("p",{className:"mt-1 text-muted-foreground",children:"Share WebHunt. Earn 25–500 unlocks based on the plan your referral signs up for."})]}),e.jsxs(n,{className:"relative overflow-hidden border-primary/30 bg-primary text-primary-foreground shadow-xl",children:[e.jsx(J,{fire:m}),e.jsx("div",{className:"pointer-events-none absolute inset-0 [background:radial-gradient(70%_140%_at_50%_0%,hsl(var(--primary-foreground)/0.18),transparent_70%)]","aria-hidden":"true"}),e.jsxs(l,{className:"relative px-8 py-10",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold uppercase tracking-[0.18em] text-primary-foreground/80",children:[e.jsx(_,{className:"h-4 w-4"}),"Available unlocks"]}),e.jsx("div",{className:"mt-3 text-7xl font-bold leading-none tracking-tight tabular-nums",children:e.jsx($,{value:s.available,reduced:t})}),e.jsx("p",{className:"mt-3 max-w-md text-primary-foreground/80",children:"Earned from referrals and ready to spend. These never expire and kick in automatically once your monthly allowance runs out."}),s.pending>0&&e.jsxs("div",{className:"mt-5 inline-flex items-center gap-2 rounded-full bg-primary-foreground/15 px-4 py-1.5 text-sm font-medium",children:[e.jsx(A,{className:"h-4 w-4"}),s.pending," unlocks pending — released after a 14-day hold"]})]})]}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-3",children:[e.jsx(n,{className:"bg-card shadow-sm",children:e.jsxs(l,{className:"flex items-center gap-4 p-5",children:[e.jsx("span",{className:"flex h-11 w-11 items-center justify-center rounded-xl bg-primary/10 text-primary",children:e.jsx(P,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold tabular-nums",children:s.maxRewardPerReferral}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Max unlocks per referral (Agency sign-up)"})]})]})}),e.jsx(n,{className:"bg-card shadow-sm",children:e.jsxs(l,{className:"flex items-center gap-4 p-5",children:[e.jsx("span",{className:"flex h-11 w-11 items-center justify-center rounded-xl bg-primary/10 text-primary",children:e.jsx(y,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold tabular-nums",children:o.length}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Total invitees"})]})]})}),e.jsx(n,{className:"bg-card shadow-sm",children:e.jsxs(l,{className:"flex items-center gap-4 p-5",children:[e.jsx("span",{className:"flex h-11 w-11 items-center justify-center rounded-xl bg-primary/10 text-primary",children:e.jsx(v,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-2xl font-bold tabular-nums",children:s.totalEarned}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Unlocks earned all-time"})]})]})})]}),e.jsxs(n,{className:"bg-card shadow-sm",children:[e.jsxs(g,{children:[e.jsx(j,{children:"Your referral link"}),e.jsx(b,{children:"Friends who subscribe through this link get 50% off their first month. You earn 25–500 unlocks based on the plan they choose — released after a 14-day hold."})]}),e.jsx(l,{children:e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row",children:[e.jsx("div",{className:"flex-1 truncate rounded-lg border border-border bg-secondary/40 px-4 py-3 font-mono text-sm text-foreground",children:s.shareUrl}),e.jsx(C,{onClick:M,className:"font-semibold sm:w-auto",disabled:!s.shareUrl,children:h?e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"mr-2 h-4 w-4"}),"Copied"]}):e.jsxs(e.Fragment,{children:[e.jsx(D,{className:"mr-2 h-4 w-4"}),"Copy link"]})})]})})]}),s.tierRewards&&s.tierRewards.length>0&&e.jsx(K,{tiers:s.tierRewards}),e.jsxs(n,{className:"bg-card shadow-sm",children:[e.jsxs(g,{children:[e.jsx(j,{children:"Your inv
1itees"}),e.jsx(b,{children:o.length===0?"No one has signed up yet — share your link to get started.":`${S} of ${o.length} have earned you a reward.`})]}),e.jsx(l,{children:o.length===0?e.jsxs("div",{className:"flex flex-col items-center gap-3 py-10 text-center",children:[e.jsx("span",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-secondary text-muted-foreground",children:e.jsx(y,{className:"h-6 w-6"})}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Your invitees will appear here as they join."})]}):e.jsx("div",{className:"space-y-2",children:o.map(i=>e.jsx(q,{invitee:i},i.id))})})]})]})]})}export{ce 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.