1import{r as o,U as P,n as T,o as D,j as e,aH as V,h as E,aS as Z,l as q,ag as K,k as Q,aI as J}from"./index-Bn97Kz8X.js";import{S as X}from"./SEO-BjAPr8No.js";import{B as ee}from"./BackToDriverHQ-BcTdxsIk.js";import{T as v}from"./trophy-C_wfJYls.js";import{F as A}from"./flame-CdNu4bei.js";import{T as te}from"./triangle-alert-DCst1_nP.js";import{C as se}from"./clock-Dfd8vDx6.js";import{U as ne}from"./user-plus-BnfvoBVT.js";import{P as ie}from"./package-qTtWaAad.js";import{Z as ae}from"./zap-Cbe5Dgwm.js";import{H as re}from"./heart-handshake-CJP7UlgI.js";const c=[{name:"Road Rookie",threshold:0},{name:"Road Hustler",threshold:250},{name:"Road Veteran",threshold:750},{name:"Road Boss",threshold:1750},{name:"Road King",threshold:4e3},{name:"Road Legend",threshold:8e3}],oe=[{label:"Signup",points:100,icon:ne,desc:"Create your RSG account"},{label:"Business registration",points:100,icon:ie,desc:"List your business in the directory"},{label:"Member recruiting",points:100,icon:Q,desc:"Successful referral joins RSG"},{label:"Completed delivery",points:10,icon:ae,desc:"Finish a verified delivery run"},{label:"Review submitted",points:5,icon:J,desc:"The act of reviewing earns"},{label:"Community action",points:5,icon:re,desc:"Post, comment, or engage"}];function C(){const n=encodeURIComponent(window.location.href);return`${"https://www.buildy.ai/api".replace(/\/api\/?$/,"").replace(/\/$/,"")}/auth/app-login?app_id=9xrrufffexrbbkhc2dshz&from_url=${n}`}function le(n){let x=c[0];for(const r of c)n>=r.threshold&&(x=r);return x}function N(n){if(!n)return"â";try{return new Date(n).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}catch{return n}}function de(n){if(!n)return"";const x=new Date(n),r=Date.now()-x.getTime(),p=Math.floor(r/864e5);return p===0?"Today":p===1?"Yesterday":p<7?`${p} days ago`:N(n)}function ve(){const[n,x]=o.useState(!1),[r,p]=o.useState(null),[t,I]=o.useState(null),[H,$]=o.useState(0),[w,M]=o.useState([]),[h,B]=o.useState(null),[F,_]=o.useState(!0),[G,k]=o.useState(!0);o.useEffect(()=>{(async()=>{try{const s=await P.me();x(!0);const a=(s==null?void 0:s.email)||null;if(p(a),!a){_(!1);return}try{const m=(await T.filter({email:a})||[])[0]||null;m&&(I(m),$(m.total_points??m.lifetime_points??0))}catch{}try{const i=await T.filter({daily_top_earner_today:!0})||[];i[0]&&B(i[0])}catch{}}catch{x(!1)}finally{_(!1)}})()},[]),o.useEffect(()=>{if(!r&&!(t!=null&&t.driver_id)){k(!1);return}(async()=>{try{let s=[];try{t!=null&&t.driver_id&&(s=await D.filter({driver_id:t.driver_id})||[])}catch{}if(s.length===0&&r)try{s=await D.filter({member_email:r})||[]}catch{}s.sort((a,i)=>new Date(i.created_at||0).getTime()-new Date(a.created_at||0).getTime()),M(s.slice(0,50))}catch{}finally{k(!1)}})()},[r,t==null?void 0:t.driver_id]);const l=t?t.total_points??t.lifetime_points??0:H,g=le(l),f=(t==null?void 0:t.tier)||g.name,S=c.findIndex(s=>s.name===f),u=S>=0?S:c.findIndex(s=>s.name===g.name),d=u>=0&&u<c.length-1?c[u+1]:null,y=u>=0?c[u].threshold:g.threshold,j=(d==null?void 0:d.threshold)??8e3,U=(t==null?void 0:t.progress_to_next)??(d?Math.max(0,j-l):0),Y=(t==null?void 0:t.next_tier)||(d==null?void 0:d.name)||"Road Legend",L=j-y||1,O=Math.max(0,Math.min(L,l-y)),z=d?Math.min(100,Math.max(0,O/L*100)):100,R=!!(t!=null&&t.at_risk),b=!!(t!=null&&t.daily_top_earner_today);return e.jsxs("div",{className:"min-h-screen bg-white text-zinc-900 selection:bg-[#F45815]/20",children:[e.jsx(X,{title:"Don Points â Your Road Ladder",description:"Don Points unlock status on the Road Ladder. Activity earns points, points unlock tiers. No cash value. Computed by GHL.",url:"https://rideshareguides.com/don-points-store"}),e.jsx(V,{isAuthenticated:n,email:r,onSignIn:()=>window.location.href=C(),onSignOut:async()=>{try{await P.logout()}catch{}window.location.reload()},variant:"default",driverId:t==null?void 0:t.driver_id}),e.jsxs("main",{className:"mx-auto w-full max-w-[960px] px-5 sm:px-8 py-8 sm:py-10",children:[e.jsx(ee,{variant:"light",wrapperClassName:"mb-6"}),e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"font-black tracking-tight text-[2.2rem] sm:text-[2.8rem] leading-[0.95]",style:{fontFamily:"Poppins, sans-serif",fontWeight:800},children:"Don Points"}),e.jsx("p",{className:"mt-3 max-w-[60ch] text-[15px] leading-relaxed",style:{fontFamily:"Inter, sans-serif",color:"#666"},children:"Your Road Ladder â activity earns points, points unlock status. No cash value."})]}),!n&&!F&&e.jsx("div",{className:"rounded-[16px] border border-stone-200 bg-white p-6 sm:p-8 shadow-sm",children:e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[#FFF0E7] text-[#F45815]",children:e.jsx(v,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-[17px] font-bold",style:{fontFamily:"Poppins, sans-serif"},children:"Sign in to see your Don Points and Road Ladder"}),e.jsx("p",{className:"mt-1.5 text-[14px] leading-relaxed text-zinc-500",children:"Track your tier, progress to the next level, earning history, and daily spotlight. Your Road Ladder badge shows publicly on your listings."}),e.jsx("a",{href:C(),className:"mt-4 inline-flex items-center justify-center rounded-full bg-[#F45815] px-6 py-2.5 text-[13px] font-bold text-white transition hover:bg-[#
1E04E12] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#F45815] focus-visible:ring-offset-2",children:"Sign in to view"})]})]})}),n&&e.jsxs("div",{className:"space-y-10",children:[e.jsx("div",{className:"rounded-[20px] border-2 border-[#F45815]/20 bg-white p-6 sm:p-8 shadow-[0_4px_24px_rgba(244,88,21,0.06)]",children:e.jsxs("div",{className:"flex flex-col gap-6 lg:flex-row lg:items-start lg:justify-between",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("span",{className:"inline-flex items-center gap-2 rounded-full bg-[#F45815] px-4 py-2 text-[15px] font-bold leading-none tracking-tight text-white shadow-sm",style:{fontFamily:"Poppins, sans-serif"},children:f}),b&&e.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-amber-200 bg-amber-50 px-3 py-1.5 text-[11px] font-bold uppercase tracking-widest text-amber-700",children:[e.jsx(A,{className:"h-3.5 w-3.5"})," Today's Top Earner"]})]}),e.jsxs("div",{className:"mt-5 flex items-baseline gap-3",children:[e.jsx("p",{className:"font-black leading-none tracking-tight text-zinc-900",style:{fontFamily:"Poppins, sans-serif",fontSize:"3rem"},children:F?"â":l.toLocaleString()}),e.jsx("span",{className:"text-[18px] font-semibold text-zinc-500",children:"points"})]}),e.jsx("div",{className:"mt-6",children:d?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between text-[12px] font-semibold",children:[e.jsxs("span",{className:"text-zinc-500",children:[y.toLocaleString()," ⢠",f]}),e.jsxs("span",{className:"text-zinc-900",children:[U.toLocaleString()," pts to ",Y]})]}),e.jsx("div",{className:"mt-2 h-2.5 w-full overflow-hidden rounded-full bg-stone-100",children:e.jsx("div",{className:"h-full rounded-full bg-[#F45815] transition-all duration-700",style:{width:`${z}%`}})}),e.jsxs("div",{className:"mt-1.5 flex justify-between text-[11px] text-zinc-400",children:[e.jsxs("span",{children:[l.toLocaleString()," / ",j.toLocaleString()]}),e.jsxs("span",{children:[Math.round(z),"%"]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-2.5 w-full overflow-hidden rounded-full bg-stone-100",children:e.jsx("div",{className:"h-full w-full rounded-full bg-[#F45815]"})}),e.jsx("p",{className:"mt-2 text-[13px] font-semibold text-[#F45815]",children:"Road Legend â max tier reached. You own the road."})]})})]}),e.jsxs("div",{className:"lg:w-[300px] shrink-0 space-y-3",children:[R&&e.jsxs("div",{className:"flex gap-2.5 rounded-[14px] border border-amber-200 bg-amber-50 p-3.5",children:[e.jsx(te,{className:"mt-0.5 h-4 w-4 shrink-0 text-amber-600"}),e.jsx("p",{className:"text-[13px] font-medium leading-snug text-amber-900",children:"Inactive â earn points this week to avoid 10% decay"})]}),e.jsxs("div",{className:"rounded-[14px] border border-stone-200 bg-stone-50/80 p-4",children:[e.jsxs("p",{className:"flex items-center gap-1.5 text-[11px] font-bold uppercase tracking-widest text-zinc-500",children:[e.jsx(se,{className:"h-3.5 w-3.5"})," Activity"]}),e.jsxs("p",{className:"mt-2 text-[13px] text-zinc-700",children:["Last active: ",e.jsx("span",{className:"font-semibold text-zinc-900",children:de(t==null?void 0:t.last_activity_date)||"â"})]}),e.jsx("p",{className:"mt-1 text-[11px] text-zinc-400",children:N(t==null?void 0:t.last_activity_date)}),(t==null?void 0:t.driver_id)&&e.jsx("p",{className:"mt-3 font-mono text-[11px] text-zinc-500",children:t.driver_id})]}),e.jsxs("div",{className:"rounded-[14px] bg-[#FFF0E7] border border-[#F45815]/15 p-4",children:[e.jsx("p",{className:"text-[11px] font-bold uppercase tracking-widest text-[#F45815]/70",children:"How tiers work"}),e.jsx("p",{className:"mt-1.5 text-[12px] leading-relaxed text-zinc-600",children:"Points never demote you. Once you earn a tier, you keep it. Decay may reduce points but stops at your earned tier threshold."})]})]})]})}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-[20px] font-bold tracking-tight",style:{fontFamily:"Poppins, sans-serif"},children:"The Road Ladder"}),e.jsx("p",{className:"mt-1 text-[13px] text-zinc-500",children:"Locked thresholds set by Coach Carl. Tier is derived from cumulative points."}),e.jsx("div",{className:"mt-5 space-y-2.5",children:c.map(s=>{const a=s.name===f,i=l>=s.threshold&&s.name!==f,m=s.threshold>l,W=Math.max(0,s.threshold-l);return e.jsxs("div",{className:`group flex items-center justify-between gap-4 roun
1ded-[16px] border bg-white p-4 sm:p-5 transition ${a?"border-[#F45815] bg-[#FFF0E7] shadow-[0_2px_12px_rgba(244,88,21,0.12)]":i?"border-stone-200":"border-stone-200 hover:border-stone-300"}`,style:a?{borderLeftWidth:"4px"}:void 0,children:[e.jsxs("div",{className:"flex items-center gap-3.5 min-w-0",children:[e.jsx("div",{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-full text-[13px] font-bold ${a?"bg-[#F45815] text-white":i?"bg-emerald-500 text-white":"bg-stone-100 text-stone-500"}`,children:i?e.jsx(E,{className:"h-4 w-4"}):s.threshold===0?e.jsx(Z,{className:"h-4 w-4"}):c.indexOf(s)+1}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-bold leading-tight",style:{fontFamily:"Poppins, sans-serif",fontSize:"15px"},children:s.name}),e.jsxs("p",{className:"text-[12px] text-zinc-500",children:[s.threshold.toLocaleString()," pts threshold"]})]})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[a&&e.jsx("span",{className:"inline-flex rounded-full bg-[#F45815] px-3 py-1 text-[11px] font-bold text-white",children:"You are here"}),i&&e.jsxs("span",{className:"inline-flex items-center gap-1 text-[12px] font-semibold text-emerald-600",children:[e.jsx(E,{className:"h-3.5 w-3.5"})," Achieved"]}),m&&e.jsxs("span",{className:"text-[12px] text-zinc-400",children:[W.toLocaleString()," pts away"]})]})]},s.name)})})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-[20px] font-bold tracking-tight",style:{fontFamily:"Poppins, sans-serif"},children:"How you earn"}),e.jsx("div",{className:"mt-5 grid gap-3 sm:grid-cols-2",children:oe.map(s=>e.jsxs("div",{className:"flex items-start gap-3.5 rounded-[16px] border border-stone-200 bg-white p-4 transition hover:border-zinc-300",children:[e.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[#FFF0E7] text-[#F45815]",children:e.jsx(s.icon,{className:"h-5 w-5"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"text-[14px] font-bold leading-tight text-zinc-900",children:s.label}),e.jsx("p",{className:"mt-0.5 text-[12px] leading-snug text-zinc-500",children:s.desc})]}),e.jsxs("div",{className:"shrink-0 text-right",children:[e.jsx("p",{className:"text-[20px] font-black leading-none text-[#F45815]",style:{fontFamily:"Poppins, sans-serif"},children:s.points}),e.jsx("p",{className:"text-[10px] font-bold uppercase tracking-widest text-zinc-400",children:"pts"})]})]},s.label))}),e.jsxs("div",{className:"mt-4 space-y-2 rounded-[14px] border border-stone-200 bg-stone-50 p-4",children:[e.jsx("p",{className:"text-[12px] leading-relaxed text-zinc-600",children:"Points reward the act of reviewing, not the rating. Star value never affects points earned."}),e.jsx("p",{className:"text-[11px] text-zinc-400",children:"Awarded by n8n. GHL computes your balance."})]})]}),e.jsx("section",{children:e.jsxs("div",{className:"rounded-[16px] border border-stone-200 bg-[#FFF0E7] p-5 sm:p-6",style:{borderLeftWidth:"4px",borderLeftColor:"#F45815"},children:[e.jsx("h3",{className:"text-[15px] font-bold",style:{fontFamily:"Poppins, sans-serif"},children:"Freshness mechanic"}),e.jsx("p",{className:"mt-2 text-[14px] leading-relaxed text-zinc-700",children:"1 weekly inactivity triggers a 10% point decay â but you will never drop below a tier you have earned. Stay active to keep climbing."}),e.jsxs("div",{className:"mt-3 space-y-1",children:[e.jsx("p",{className:"text-[12px] font-medium text-zinc-600",children:"Decay is floored at your earned tier threshold."}),e.jsx("p",{className:"text-[11px] text-zinc-500",children:"Decay is computed by GHL."})]})]})}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-[20px] font-bold tracking-tight",style:{fontFamily:"Poppins, sans-serif"},children:"Today's Top Earner"}),e.jsx("div",{className:"mt-4 rounded-[16px] border border-stone-200 bg-white p-5 sm:p-6",children:h?e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-[#F45815] text-white",children:e.jsx(v,{className:"h-6 w-6"})}),e.jsxs("div",{children:[e.jsxs("p",{className:"text-[15px] font-bold",style:{fontFamily:"Poppins, sans-serif"},children:[h.first_name||h.driver_id||"Top Driver"," â ",h.daily_top_earner_points?`${h.daily_top_earner_points} pts today`:"Leading today"]}),e.jsx("p",{className:"mt-0.5 text-[12px] text-zinc-500",children:"Platform-wide daily top earner, shown from verified RSG activity."}),b&&e.jsx("span",{className:"mt-2 inline-flex rounded-full bg-amber-50 border border-amber-200 px-2.5 py-1 text-[11px] font-bold text-amber-700",children:"That's you today"})]})]}):b?e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-[#F45815] text-white",children:e.jsx(A,{className:"h-6 w-6"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-[15px] font-bold",children:"You are Today's Top Earner"}),e.jsx("p",{className:"mt-0.5 text-[13px] text-zinc-600",children:t!=null&&t.daily_top_earner_points?`${t.daily_top_earner_points} points earned today`:`${l} points total`})]})]}):e.jsxs("div",{className:"flex gap-3",children:[e.jsx(v,{className:"h-5 w-5 shrink-0 text-stone-300 mt-0.5"}),e.jsx("p",{className:"text-[14px] leading-relaxed text-zinc-500",children:"Check back tomorrow â GHL computes the daily top earner. One platform-wide daily top-earner is surfaced in the community feed."})]})})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-[20px] font-bold tracking-tight",style:{fontFamily:"Poppins, sans-serif"},children:"Your activity"}),e.jsx("div",{className:"mt-4 overflow-hidden rounded-[16px] border border-stone-200 bg-white",children:G?e.jsx("div",{className:"p-6 text-[13px] text-zinc-500",children:"Loading..."}):w.length===0?e.jsx("div",{className:"p-6 sm:p-8",children:e.jsx("p",{className:"text-[14px] text-zinc-600",children:"No activity yet. Start earning by completing deliveries, submitting reviews, or engaging in the community."})}):e.jsx("div",{className:"divide-y divide-stone-100",children:w.map(s=>{const a=Math.abs(Number(s.points_earned??0)),i=s.description||s.deal_name||s.business_name||s.source||"Activity",m=N(s.
1created_at);return e.jsxs("div",{className:"flex items-center gap-3.5 px-5 py-3.5",children:[e.jsx("span",{className:"h-2.5 w-2.5 shrink-0 rounded-full bg-[#F45815] mt-0.5"}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-[13px] font-semibold text-zinc-900",children:i}),e.jsx("p",{className:"text-[11px] text-zinc-400",children:m})]}),e.jsxs("span",{className:"shrink-0 rounded-full bg-[#FFF0E7] px-2.5 py-1 text-[12px] font-bold text-[#F45815]",children:["+",a]})]},s.id||`${s.created_at}-${i}`)})})})]}),e.jsx("section",{children:e.jsxs("div",{className:"rounded-[16px] border border-stone-200 bg-white p-5 sm:p-6",children:[e.jsx("p",{className:"text-[13px] leading-relaxed text-zinc-600",children:"Don Points have no cash value and cannot be redeemed â they unlock status on the Road Ladder only. All point awards and decay are computed server-side by GHL and n8n."}),e.jsx("p",{className:"mt-2 text-[12px] text-zinc-500",children:"RSG Reviewer Badges are a separate recognition system. View them on your profile."}),e.jsx(q,{to:"/don-points-funnel",className:"mt-3 inline-flex items-center text-[12px] font-bold text-[#B9380B] underline decoration-[#F45815]/40 underline-offset-4 transition hover:text-[#F45815] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[#F45815] focus-visible:ring-offset-2",children:"Share the DON Points overview with a driver"})]})})]})]}),e.jsx(K,{})]})}export{ve 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.