PageSourceSearch

https://cheeppy.com/assets/Rewards-CluCJX1I.js

js cheeppy.com collected 2026-09-25 20:27:25 UTC 12,259 bytes, 1 lines download raw bytes

1import{a3 as y,V as c,W as e,at as $,a1 as D,bk as P,aL as N,ai as E}from"./index-B3jPZcUH.js";import{C as _}from"./copy-CgCr5AvZ.js";import{M as F}from"./mail-RYttuqw4.js";import{E as I}from"./external-link-D5GgqeQH.js";const M=300,k="bg-card dark:bg-white/5 border border-line dark:border-white/10 rounded-[6px]";function Z({data:t,error:i,onRetry:o}){const{t:r,isFr:s}=y(),[x,d]=c.useState(!1),p=n=>Number(n).toLocaleString(s?"fr-FR":"en-US"),h=async()=>{try{await navigator.clipboard.writeText(t.link),d(!0),setTimeout(()=>d(!1),2e3)}catch{}},f=(t==null?void 0:t.rewardCredits)??M,m=t?encodeURIComponent(r("referral.shareMessage",{credits:t.rewardCredits,link:t.link})):"",l=(t==null?void 0:t.milestoneTarget)??5,v=t?t.stats.cycleProgress??t.stats.subscribed%l:0,g=t?t.stats.milestonesEarned??Math.floor(t.stats.subscribed/l):0,b="px-3 py-1.5 bg-sage-pill dark:bg-white/10 text-sage-deep dark:text-white/80 hover:bg-mist dark:hover:bg-white/15 rounded-[4px] text-[12px] font-medium transition-colors";return e.jsxs("div",{children:[e.jsxs("h1",{className:"font-serif text-[34px] sm:text-[44px] font-light text-ink dark:text-white leading-[1.1]",children:[r("referral.title")," ",e.jsx("em",{className:"italic text-sage",children:r("referral.titleAccent")})]}),e.jsx("p",{className:"mt-3 text-[15px] text-ink/60 dark:text-white/60",children:r("referral.subtitle",{credits:f})}),i&&e.jsxs("div",{className:"mt-8 py-10 text-center",children:[e.jsx("p",{className:"text-[15px] text-ink/60 dark:text-white/60",children:r("referral.error")}),e.jsx("button",{onClick:o,className:"mt-4 px-4 py-2 bg-sage hover:bg-sage-deep text-card rounded-[4px] text-[13px] font-medium transition-colors",children:r("referral.retry")})]}),!i&&!t&&e.jsxs("div",{className:"animate-pulse","aria-hidden":"true",children:[e.jsx("div",{className:`mt-8 h-36 ${k}`}),e.jsx("div",{className:"mt-6 grid grid-cols-3 gap-3",children:[0,1,2].map(n=>e.jsx("div",{className:`h-[88px] ${k}`},n))}),e.jsx("div",{className:"mt-6 h-[84px] bg-sage-pill dark:bg-white/5 border border-line dark:border-white/10 rounded-[6px]"})]}),!i&&t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`mt-8 ${k} p-5`,children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.12em] text-ink/50 dark:text-white/45 mb-2",children:r("referral.yourLink")}),e.jsxs("div",{className:"flex flex-col sm:flex-row gap-2",children:[e.jsx("code",{className:"flex-1 px-3 py-2.5 bg-sidebar dark:bg-white/5 border border-line dark:border-white/10 rounded-[4px] text-[13px] text-ink dark:text-white truncate",children:t.link}),e.jsxs("button",{onClick:h,className:"px-4 py-2.5 bg-sage hover:bg-sage-deep text-card rounded-[4px] text-[13px] font-medium inline-flex items-center justify-center gap-2 transition-colors shrink-0",children:[x?e.jsx($,{className:"w-4 h-4"}):e.jsx(_,{className:"w-4 h-4"}),r(x?"referral.copied":"referral.copy")]})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 mt-3",children:[e.jsx("a",{href:`https://wa.me/?text=${m}`,target:"_blank",rel:"noreferrer",className:b,children:r("referral.shareWhatsapp")}),e.jsx("a",{href:`https://twitter.com/intent/tweet?text=${m}`,target:"_blank",rel:"noreferrer",className:b,children:r("referral.shareX")}),e.jsxs("a",{href:`mailto:?subject=Cheeppy&body=${m}`,className:`${b} inline-flex items-center gap-1`,children:[e.jsx(F,{className:"w-3 h-3"}),r("referral.shareEmail")]})]})]}),e.jsx("div",{className:"mt-6 grid grid-cols-3 gap-3",children:[[t.stats.signups,"referral.statInvited"],[t.stats.subscribed,"referral.statSubscribed"],[t.stats.creditsEarned,"referral.statEarned"]].map(([n,u])=>e.jsxs("div",{className:`${k} p-4 text-center`,children:[e.jsx("p",{className:"font-serif text-[26px] font-light text-ink dark:text-white",children:p(n)}),e.jsx("p",{className:"font-mono text-[9px] uppercase tracking-[0.1em] text-ink/50 dark:text-white/45 mt-1",children:r(u)})]},u))}),e.jsxs("div",{className:"mt-6 bg-sage-pill dark:bg-white/5 border border-line dark:border-white/10 rounded-[6px] p-5",children:[e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-1.5 mb-3",children:[e.jsx("p",{className:"text-[13px] font-medium text-sage-deep dark:text-white",children:r("referral.milestone",{n:v,target:l})}),e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.1em] text-sage",children:r("referral.milestoneReward",{credits:p(t.milestoneCredits),target:l})})]}),e.jsx("div",{className:"h-2 bg-card dark:bg-white/10 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-sage rounded-full transition-all",style:{width:`${v/l*100}%`}})}),g>0&&e.jsx("p",{className:"mt-3 font-mono text-[10px] uppercase tracking-[0.1em] text-sage-deep dark:text-white/70",children:r("referral.milestonesUnlocked",{n:g,total:p(g*t.milestoneCredits)})})]})]}),e.jsxs("div",{className:"mt-10",children:[e.jsx("h2",{className:"font-serif text-[22px] font-light text-ink dark:text-white mb-4",children:r("referral.howTitle")}),e.jsx("div",{className:"grid sm:grid-cols-3 gap-3",children:[1,2,3].map(n=>e.jsxs("div",{className:`${k} p-4`,children:[e.jsxs("p",{className:"font-mono text-[10px] text-sage mb-1.5",children:["0",n]}),e.jsx("p",{className:"text-[14px] font-medium text-ink dark:text-white",children:r(`referral.how${n}`)}),e.jsx("p",{className:"text-[12.5px] text-ink/55 dark:text-white/50 mt-1",children:r(`referral.how${n}d`,{credits:f})})]},n))})]})]})}const B="/assets/capterra-Dx3-1Z2Z.png",W="data:image/svg+xml,%3csvg%20fill='%23FF492C'%20role='img'%20viewBox='0%200%2024%2024'%20xmlns='http://www.w3.org/2000/svg'%3e%3ctitle%3eG2%3c/title%3e%3cpath%20d='M12%2
100a12%2012%200%201%200%200%2024%2012%2012%200%200%200%200-24Zm.122%205.143c.45%200%20.9.044%201.342.132l-1.342%202.806C9.962%208.08%208.203%209.84%208.203%2012s1.76%203.92%203.92%203.92c.937%200%201.844-.338%202.553-.951l1.483%202.572A6.856%206.856%200%200%201%205.266%2012a6.856%206.856%200%200%201%206.856-6.856Zm3.498.49a1.262%201.262%200%200%201%20.026%200c.427%200%20.792.113%201.101.34.31.229.466.546.466.946%200%20.639-.36%201.03-1.035%201.376l-.377.191c-.403.204-.602.385-.657.706h2.05v.85h-3.101v-.144c0-.526.103-.96.314-1.306.211-.345.576-.65%201.102-.917l.242-.117c.427-.216.538-.401.538-.625%200-.266-.228-.458-.6-.458-.44%200-.773.228-1.004.694l-.592-.595c.13-.279.338-.502.619-.675a1.7%201.7%200%200%201%20.908-.266Zm-2.094%205.388h3.394l1.697%202.937-1.697%202.94-1.697-2.94H11.83l1.696-2.937Z'/%3e%3c/svg%3e",G="/assets/saashub-DSuxr9u2.png",L={capterra:B,g2:W,saashub:G},S=[{id:"invite",labelKey:"rewards.tabInvite"},{id:"reviews",labelKey:"rewards.tabReviews"}];function K({data:t,error:i,onRetry:o,onData:r}){const{t:s}=y(),[x,d]=c.useState(null),p=async h=>{if(x)return;d(h);const f=t;r(m=>({...m,sites:m.sites.map(l=>l.key===h?{...l,status:"pending"}:l)}));try{await N.claimReviewReward(h)}catch(m){m.code==="ALREADY_CLAIMED"?(E(s("rewards.alreadyClaimed")),o()):(r(f),E.error(s("rewards.claimError")))}finally{d(null)}};return e.jsxs("div",{children:[e.jsxs("h1",{className:"font-serif text-[34px] sm:text-[44px] font-light text-ink dark:text-white leading-[1.1]",children:[s("rewards.reviewsTitle")," ",e.jsx("em",{className:"italic text-sage",children:s("rewards.reviewsTitleAccent")})]}),i&&e.jsxs("div",{className:"mt-8 py-10 text-center",children:[e.jsx("p",{className:"text-[15px] text-ink/60 dark:text-white/60",children:s("rewards.error")}),e.jsx("button",{onClick:o,className:"mt-4 px-4 py-2 bg-sage hover:bg-sage-deep text-card rounded-[4px] text-[13px] font-medium transition-colors",children:s("rewards.retry")})]}),!i&&!t&&e.jsxs("div",{className:"animate-pulse","aria-hidden":"true",children:[e.jsx("div",{className:"mt-4 h-4 w-2/3 bg-line dark:bg-white/10 rounded-[4px]"}),e.jsx("div",{className:"mt-8 space-y-3",children:[0,1,2].map(h=>e.jsx("div",{className:"h-20 bg-card dark:bg-white/5 border border-line dark:border-white/10 rounded-[6px]"},h))})]}),!i&&t&&e.jsx(O,{data:t,claiming:x,onClaim:p,t:s})]})}function O({data:t,claiming:i,onClaim:o,t:r}){return e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-3 text-[15px] text-ink/60 dark:text-white/60",children:r("rewards.reviewsIntro",{credits:t.creditsPerSite})}),e.jsx("div",{className:"mt-8 space-y-3",children:t.sites.map(s=>{var x;return e.jsxs("div",{className:"bg-card dark:bg-white/5 border border-line dark:border-white/10 rounded-[6px] p-4 sm:p-5 flex flex-col gap-3.5 sm:flex-row sm:items-center sm:gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-[6px] bg-sidebar dark:bg-white/90 border border-line dark:border-transparent flex items-center justify-center shrink-0",children:L[s.key]?e.jsx("img",{src:L[s.key],alt:"","aria-hidden":"true",className:"w-7 h-7 object-contain"}):e.jsx("span",{className:"font-mono text-[15px] uppercase text-sage-deep",children:(x=s.label)==null?void 0:x.charAt(0)})}),e.jsx("p",{className:"text-[15px] font-medium text-ink dark:text-white truncate",children:s.label})]}),e.jsxs("div",{className:"flex items-stretch gap-2 shrink-0",children:[e.jsxs("a",{href:s.url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center gap-1.5 text-[12.5px] font-medium text-sage-deep dark:text-white/90 bg-sage-pill dark:bg-white/10 hover:bg-mist dark:hover:bg-white/15 border border-line dark:border-white/10 rounded-[4px] px-3 py-2 transition-colors whitespace-nowrap",children:[r("rewards.leaveReview"),e.jsx(I,{className:"w-3 h-3"})]}),(s.status===null||s.status==="rejected")&&e.jsx("button",{onClick:()=>o(s.key),disabled:i===s.key,className:"flex-1 sm:flex-none px-4 py-2 bg-sage hover:bg-sage-deep disabled:opacity-60 text-card rounded-[4px] text-[13px] font-medium transition-colors whitespace-nowrap",children:r("rewards.claimPosted")}),s.status==="pending"&&e.jsx("span",{className:"flex-1 sm:flex-none flex items-center justify-center text-center font-mono text-[10px] uppercase tracking-[0.08em] text-ink/60 dark:text-white/60 bg-sidebar dark:bg-white/10 border border-line dark:border-white/10 rounded-[4px] px-3 py-2 whitespace-nowrap",children:r("rewards.statusPending")}),s.status==="approved"&&e.jsx("span",{className:"flex-1 sm:flex-none flex items-center justify-center text-center font-mono text-[10px] uppercase tracking-[0.08em] text-sage-deep dark:text-white bg-sage-pill dark:bg-white/10 rounded-[4px] px-3 py-2 whitespace-nowrap",children:r("rewards.statusApproved",{credits:t.creditsPerSite})})]})]},s.key)})})]})}function V(){var R;const{t}=y(),{user:i,refreshUser:o}=D(),[r,s]=P(),x=r.get("tab"),d=!!(i&&(i.tier&&i.tier!=="free"||i.ever_subscribed===!0)),p=d?S:S.filter(a=>a.id!=="reviews"),[h,f]=c.useState(null),[m,l]=c.useState(!1),[v,g]=c.useState(null),[b,n]=c.useState(!1),u=c.useCallback(()=>
1{l(!1),N.getMyReferrals().then(f).catch(()=>l(!0))},[]),j=c.useRef(!1),w=c.useCallback(()=>{j.current||(j.current=!0,n(!1),N.getReviewRewards().then(g).catch(()=>n(!0)).finally(()=>{j.current=!1}))},[]);c.useEffect(()=>{u()},[u]),c.useEffect(()=>{d&&w()},[d,w]),c.useEffect(()=>{if(!d)return;const a=()=>{document.visibilityState==="visible"&&(w(),o==null||o())};return window.addEventListener("focus",a),document.addEventListener("visibilitychange",a),()=>{window.removeEventListener("focus",a),document.removeEventListener("visibilitychange",a)}},[d,w]);const C=((R=p.find(a=>a.id===x))==null?void 0:R.id)||"invite",A=a=>{a==="invite"?s({},{replace:!0}):s({tab:a},{replace:!0})};return e.jsxs("div",{className:"max-w-3xl mx-auto px-4 pt-5 pb-10 sm:pt-7 sm:pb-14",children:[e.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.15em] text-sage mb-4",children:t("rewards.menuLabel")}),p.length>1&&e.jsx("div",{className:"flex gap-2 mb-8",children:p.map(a=>{const T=C===a.id;return e.jsx("button",{onClick:()=>A(a.id),className:`font-mono text-[10px] uppercase tracking-[0.1em] px-3.5 py-2 rounded-[4px] transition-colors ${T?"bg-sage text-card":"bg-card dark:bg-white/5 border border-line dark:border-white/10 text-ink/60 dark:text-white/60 hover:text-ink dark:hover:text-white"}`,children:t(a.labelKey)},a.id)})}),C==="invite"?e.jsx(Z,{data:h,error:m,onRetry:u}):e.jsx(K,{data:v,error:b,onRetry:w,onData:g})]})}export{V 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.