PageSourceSearch

https://www.dibaapp.com/assets/ReferEarnPage-v1dIw0RS.js

js dibaapp.com collected 2026-10-04 06:55:12 UTC 9,707 bytes, 6 lines download raw bytes

1import{r as m,j as e,L as w,z as L,g as A,k,y as D,c as _,p as P}from"./index-D6UrFXqh.js";import{A as q,S as $}from"./AppShell-DKhCxBd5.js";import{A as I}from"./arrow-left-DJrC1F0y.js";import{C as R}from"./check-CZJsqEMY.js";import{C as E}from"./copy-D70Gfk73.js";import{S as M}from"./share-2-C_hXJAFu.js";import{U}from"./users-round-SlJ593mX.js";import{B as Y}from"./badge-check-0NxAIUlX.js";import{W as z}from"./Logo-VUZnl8oB.js";import{c as O}from"./createLucideIcon-DBOTLUhc.js";import"./shield-check-Nz0OL0hG.js";import"./sparkles-DMSCgezF.js";import"./help-circle-DfpDRC0m.js";import"./appContent-Bmmk0ks2.js";import"./file-text-DXawlq-x.js";/**
2 * @license lucide-react v0.344.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const B=O("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]),F=5*60*1e3,H=15e3;let x=null,p=null;const J=()=>{var i;const s=(i=k())==null?void 0:i.access;if(!s)return Promise.reject(new Error("No authenticated session is available."));if((x==null?void 0:x.accessToken)===s&&Date.now()-x.timestamp<F)return Promise.resolve({response:new Response(null,{status:200}),data:x.data});if((p==null?void 0:p.accessToken)===s)return p.promise;const a=new AbortController,r=window.setTimeout(()=>a.abort(),H),u=D(_.referral,{signal:a.signal}).then(async n=>{var l;const o=await P(n);return n.ok&&o&&typeof o=="object"&&(x={accessToken:((l=k())==null?void 0:l.access)??s,data:o,timestamp:Date.now()}),{response:n,data:o}}).finally(()=>{window.clearTimeout(r),p=null});return p={accessToken:s,promise:u},u},T=[{title:"Share your referral link",description:"Invite a friend with your unique Diba referral link or code.",icon:U},{title:"Your friend joins Diba",description:"They create a new account and successfully complete identity verification (KYC).",icon:Y},{title:"They transact $500+",description:"Your friend completes at least $500 in qualifying transactions through Diba.",icon:z},{title:"You get $5",description:"Once every requirement is complete, your $5 Diba reward is unlocked.",icon:B}],ne=()=>{var j,N;const[s,a]=m.useState(""),[r,u]=m.useState(null),[i,n]=m.useState(!0),[o,l]=m.useState(""),h=((j=r==null?void 0:r.code)==null?void 0:j.trim())??"",c=((N=r==null?void 0:r.referral_link)==null?void 0:N.trim())??"",C=!i&&!!h,y=!i&&!!c;m.useEffect(()=>{let t=!0;return(async()=>{n(!0),l("");try{const{response:d,data:f}=await J();if(!d.ok){const v=L(f,d.status);if(v){l(v.message);return}l(A(f,d.status,{fallback:"We could not load your referral code right now.",serverError:"The referral service is having trouble right now. Please try again shortly.",fieldOrder:["code","non_field_errors"]}));return}t&&f&&typeof f=="object"&&u(f)}catch(d){t&&l(d instanceof DOMException&&d.name==="AbortError"?"The referral service took too long to respond. Please try again.":"Network or server error. Please try again.")}finally{t&&n(!1)}})(),()=>{t=!1}},[]),m.useEffect(()=>{if(!s)return;const t=window.setTimeout(()=>a(""),2200);return()=>window.clearTimeout(t)},[s]);const g=async(t,b)=>{try{await navigator.clipboard.writeText(t),a(b)}catch{a("Copy failed")}},S=async()=>{if(!c){a("Referral link unavailable");return}const t=h?`Join me on Diba and use my referral code ${h}.`:"Join me on Diba using my referral link.";if(navigator.share)try{await navigator.share({title:"Join me on Diba",text:t,url:c});return}catch{return}g(c,"Link copied")};return e.jsx(q,{children:e.jsxs("div",{className:"mx-auto max-w-3xl",children:[e.jsxs(w,{to:"/dashboard",className:"inline-flex items-center gap-2 text-sm font-semibold text-slate-500 transition hover:text-primary",children:[e.jsx(I,{className:"h-4 w-4"}),"Dashboard"]}),e.jsxs("div",{className:"mt-4 overflow-hidden rounded-xl bg-white shadow-xl shadow-slate-200/80",children:[e.jsxs("section",{className:"relative overflow-hidden bg-primary px-5 pb-20 pt-8 text-white sm:px-8 sm:pb-24 sm:pt-10",children:[e.jsxs("div",{className:"relative z-10 min-h-28",children:[e.jsx("p",{className:"text-sm font-semibold text-white/80",children:"Refer your friends"}),e.jsx("h1",{className:"mt-2 text-3xl font-bold leading-tight sm:text-4xl",children:"Invite a friend. Earn $5."}),e.jsx("p",{className:"mt-2 max-w-sm text-sm font-medium leading-6 text-white/85",children:"Earn up to $25 each month from five successful referrals."}),e.jsxs("p",{className:"mt-3 text-xs font-medium text-white/80",children:["Terms and conditions apply."," ",e.jsx(w,{to:"/dashboard/refer/terms",className:"font-bold text-white underline decoration-white/60 underline-offset-2 transition hover:decoration-white",children:"View referral terms"})]})]}),e.jsxs("div",{className:"absolute right-4 top-5 h-40 w-64 sm:right-10 sm:top-3 sm:h-48 sm:w-80",children:[e.jsx("div",{className:"absolute right-10 top-12 h-24 w-32 rounded-full bg-amber-300/50 blur-2xl sm:h-28 sm:w-44"}),e.jsxs("picture",{children:[e.jsx("source",{srcSet:"/refer-coins-640.webp",type:"image/webp"}),e.jsx("img",{src:"/refer-coins.png",alt:"",className:"absolute -right-12 -top-8 h-56 w-96 object-contain sm:h-64 sm:w-[28rem]",decoding:"async"})]})]})]}),e.jsxs("section",{className:"-mt-14 space-y-4 px-4 pb-5 sm:px-6 sm:pb-6",children:[e.jsxs("div",{className:"relative z-10 rounded-lg border border-slate-100 bg-white p-4 shadow-xl shadow-slate-200/80 sm:p-5",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e.jsx("span",{className:"inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-amber-50",children:e.jsx("img",{src:"/refer-coin.png",alt:"",className:"h-8 w-8 object-contain"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-base font-bold text-slate-900",children:"Your referrals"}),e.jsx("p",{className:"mt-1 text-xs font-medium text-slate-500",children:"Track referrals and KYC verification"})]})]}),e.jsx(w,{to:"/dashboard/refer/activity",className:"shrink-0 rounded-full bg-primary/10 px-4 py-2 text-xs font-bold text-primary transition hover:bg-primary/15",children:"View activity"})]}),e.jsxs("div",{className:"mt-4 grid grid-cols-[minmax(0,1fr)_auto] items-center gap-3 border-t border-slate-100 pt-4 sm:grid-cols-[minmax(0,1fr)_minmax(0,auto)_auto]",children:[e.jsx("p",{className:"col-span-2 min-w-0 text-sm font-semibold text-emerald-600 sm:col-span-1",children:"Referral code:"}),e.jsx("p",{className:"min-w-0 truncate text-base font-black tracking-wide text-slate-800 sm:max-w-56 sm:text-lg",children:i?"Loading...":h||"Referral code unavailable"}),e.jsxs("button",{type:"button",onClick:()=>g(h,"Code copied"),disabled:!C,className:"inline-flex shrink-0 items-center justify-center gap-2 rounded-full bg-emerald-50 px-4 py-2 text-xs font-bold text-emerald-700 transition hover:bg-emerald-100 disabled:cursor-not-allowed disabled:opacity-60",children:[s==="Code copied"?e.jsx(R,{className:"h-4 w-4"}):e.jsx(E,{className:"h-4 w-4"}),"Copy"]})]}),o&&e.jsx("p",{className:"mt-3 rounded-lg bg-amber-50 px-3 py-2 text-xs font-semibold text-amber-700",children:o})]}),e.jsx("div",{className:"rounded-lg bg-primary/10 px-4 py-5 sm:px-5",children:T.map((t,b)=>e.jsxs("div",{className:"relative flex gap-4 pb-6 last:pb-0",children:[b<T.length-1&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"absolute left-5 top-11 h-12 border-l-2 border-dashed border-primary/40"}),e.jsx("span",{className:"absolute left-[1.15rem] top-[5.55rem] h-2 w-2 rotate-45 border-b-2 border-r-2 border-primary/70"})]}),e.jsx("span",{className:"relative z-10 inline-flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-white text-primary shadow-sm",children:e.jsx(t.icon,{className:"h-5 w-5"})}),e.jsxs("div",{className:"min-w-0 pb-1",children:[e.jsx("p",{className:"text-sm font-bold text-slate-700",children:t.title}),e.jsx("p",{className:"mt-1 max-w-sm text-sm font-semibold leading-relaxed text-slate-500",children:t.description})]})]},t.title))}),e.jsxs("div",{className:"rounded-lg border border-slate-100 bg-white p-4 shadow-lg shadow-slate-200/70 sm:p-5",children:[e.jsx("p",{className:"text-sm font-bold text-slate-500",children:"Referral link"}),e.jsxs("div",{className:"mt-3 flex flex-col gap-3 sm:flex-row sm:items-center",children:[e.jsx("p",{className:"min-w-0 flex-1 truncate rounded bg-emerald-50 px-3 py-3 text-xs font-bold text-emerald-700",children:i?"Loading...":c||"Referral link unavailable"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:flex sm:shrink-0",children:[e.jsxs("button",{type:"button",onClick:S,disabled:!y,className:"inline-flex items-center justify-center gap-2 rounded-full bg-primary/10 px-5 py-2.5 text-xs font-bold text-primary transition hover:bg-primary/15 disabled:cursor-not-allowed disabled:opacity-60",children:[e.jsx(M,{className:"h-4 w-4"}),"Share Link"]}),e.jsxs("button",{type:"button",onClick:()=>g(c,"Link copied"),disabled:!y,className:"inline-flex items-center justify-center gap-2 rounded-full bg-primary/10 px-5 py-2.5 text-xs font-bold text-primary transition hover:bg-primary/15 disabled:cursor-not-allowed disabled:opacity-60",children:[s==="Link copied"?e.jsx(R,{className:"h-4 w-4"}):e.jsx(E,{className:"h-4 w-4"}),"Copy Link"]})]})]})]})]})]}),s&&e.jsxs("div",{className:"fixed bottom-24 left-4 right-4 z-50 mx-auto flex max-w-sm items-center justify-center gap-2 rounded-xl bg-slate-950 px-4 py-3 text-sm font-semibold text-white shadow-2xl shadow-slate-950/20 lg:bottom-6",role:"status","aria-live":"polite",children:[e.jsx($,{className:"h-4 w-4 text-emerald-300"}),s]})]})})};export{ne 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.