PageSourceSearch

https://jobspidey.com/assets/AffiliateDashboard-BhbfiD2H.js

js jobspidey.com collected 2026-10-04 03:13:48 UTC 10,708 bytes, 1 lines download raw bytes

1import{u as P,r as t,j as e,A as S,L as A}from"./index-gGPAhYiP.js";import{n as E,f as o}from"./billingCatalog-C7pBdl-N.js";import{a as g}from"./apiErrorMessage-BTbqsaiN.js";/* empty css                         */import{C as Y}from"./copy-6r5X6EH5.js";import{W as z}from"./wallet-cards-DpKmQJMf.js";import{L as M}from"./loader-circle-BfkwTOQA.js";import{E as O}from"./external-link-DunIjEqF.js";import{C as W}from"./circle-check-big-CNV11qTi.js";function w(s){return`${((Number(s)||0)/100).toFixed(0)}%`}function l(s){return String(s||"pending").replace(/_/g," ")}function $({currency:s,values:d}){const n=(d.pending||0)+(d.held||0),c=d.payable||0,p=d.paid||0;return e.jsxs("div",{className:"rounded-2xl border border-[var(--app-border)] bg-[var(--app-surface)] p-5 shadow-soft",children:[e.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.16em] text-brand-secondary",children:s.toUpperCase()}),e.jsxs("div",{className:"mt-4 grid gap-3 text-sm",children:[e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("span",{className:"text-[var(--app-text-secondary)]",children:"Pending or held"}),e.jsx("span",{className:"font-bold text-brand-dark",children:o(n,s)})]}),e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("span",{className:"text-[var(--app-text-secondary)]",children:"Payable"}),e.jsx("span",{className:"font-bold text-emerald-700",children:o(c,s)})]}),e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("span",{className:"text-[var(--app-text-secondary)]",children:"Paid"}),e.jsx("span",{className:"font-bold text-brand-dark",children:o(p,s)})]})]})]})}function H(){const{api:s,user:d}=P(),[n,c]=t.useState(null),[p,m]=t.useState(!0),[b,i]=t.useState(""),[k,f]=t.useState(!1),[u,h]=t.useState(!1),j=t.useCallback(async()=>{m(!0),i("");try{const a=await s.get("/api/affiliate/me");c(a.data)}catch(a){i(g(a,"We could not load your affiliate dashboard."))}finally{m(!1)}},[s]);t.useEffect(()=>{j()},[j]);const r=n?.partner||null,x=t.useMemo(()=>!r?.code||typeof window>"u"?"":`${window.location.origin}/a/${r.code}`,[r?.code]),C=async()=>{x&&(await navigator.clipboard.writeText(x),f(!0),window.setTimeout(()=>f(!1),1800))},_=async()=>{h(!0),i("");try{const a=await s.post("/api/affiliate/connect/onboarding");a.data?.url&&(window.location.href=a.data.url)}catch(a){i(g(a,"We could not start payout onboarding.")),h(!1)}};if(p)return e.jsx(S,{compact:!0,title:"Loading affiliate dashboard",message:"Getting your links, commissions, and payout status ready."});if(!r)return e.jsx("div",{className:"affiliate-clarity affiliate-clarity-empty",children:e.jsxs("div",{className:"rounded-[2rem] border border-[var(--app-border)] bg-[var(--app-surface)] p-8 shadow-soft",children:[e.jsx("h1",{className:"text-3xl font-sans font-bold text-brand-dark",children:"Affiliate dashboard"}),e.jsx("p",{className:"mt-4 text-brand-secondary",children:"Apply first. Once approved, your affiliate link, discount code, commissions, and payout setup will appear here."}),e.jsx(A,{to:"/affiliates",className:"mt-6 inline-flex rounded-xl bg-brand-primary px-5 py-3 text-sm font-bold text-[var(--app-on-primary)]",children:"Apply for affiliate approval"})]})});const v=n?.summary?.balances||{},y=n?.recent_commissions||[],N=n?.recent_payouts||[];return e.jsx("div",{className:"affiliate-clarity",children:e.jsxs("div",{className:"mx-auto max-w-6xl",children:[e.jsxs("div",{className:"flex flex-col gap-4 md:flex-row md:items-end md:justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.18em] text-[var(--app-accent)]",children:"Affiliate Program"}),e.jsx("h1",{className:"mt-2 text-4xl font-sans font-bold text-brand-dark",children:"Your affiliate dashboard"}),e.jsxs("p",{className:"mt-2 text-brand-secondary",children:["Signed in as ",d?.email]})]}),e.jsx("span",{className:"w-fit rounded-full border border-brand-primary/20 bg-brand-primary/10 px-4 py-2 text-xs font-bold uppercase tracking-[0.16em] text-[var(--app-accent)]",children:l(r.status)})]}),b&&e.jsx("div",{className:"mt-6 rounded-xl border border-red-200 bg-red-50 px-4 py-3 text-sm font-semibold text-red-700",children:b}),e.jsxs("div",{className:"affiliate-clarity-overview",children:[e.jsxs("div",{className:"rounded-[2rem] border border-[var(--app-border)] bg-[var(--app-surface)] p-6 shadow-soft",children:[e.jsx("h2",{className:"text-xl font-bold text-brand-dark",children:"Affiliate link and code"}),r.status==="approved"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mt-5 rounded-2xl border border-[var(--app-border)] bg-[var(--app-surface-soft)] p-4",children:[e.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.16em] text-brand-secondary",children:"Your link"}),e.jsxs("div",{className:"mt-2 flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[e.jsx("p",{className:"break-all text-sm font-bold text-brand-dark",children:x}),e.jsxs("button",{type:"button",onClick:C,className:"inline-flex items-center justify-center gap-2 rounded-xl bg-brand-primary px-4 py-3 text-sm font-bold text-[var(--app-on-primary)]",children:[e.jsx(Y,{className:"h-4 w-4"}),k?"Copied":"Copy"]})]})]}),e.jsxs("div",{className:"affiliate-clarity-metrics",children:[e.jsxs("div",{className:"rounded-2xl border border-[var(--app-border)] p-4",children:[e.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.16em] text-[var(--app-text-secondary)]",children:"Code"}),e.jsx("p",{className:"mt-2 text-2xl font-bold text-brand-dark",children:r.code})]}),e.jsxs("div",{className:"rounded-2xl border border-[var(--app-border)] p-4",children:[e.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.16em] text-[var(--app-text-secondary)]",children:"Commission"}),e.jsx("p",{className:"mt-2 text-2xl font-bold text-brand-dark",children:w(r.commission_rate_bps)})]}),e.jsxs("div",{className:"rounded-2xl border border-[var(--app-border)] p-4",children:[e.jsx("p",{className:"text-xs font-bold uppercase tracking-[0.16em] text-[var(--app-text-secondary)]",children:"Customer saves"}),e.jsx("p",{className:"mt-2 text-2xl font-bold text-brand-dark",children:w(r.customer_discount_bps)})]})]})]}):e.jsx("p",{className:"mt-4 text-brand-secondary",children:"Your application is under review. Your active link and code appear after approval."})]}),e.jsxs("div",{className:"rounded-[2rem] border border-[var(--app-border)] bg-[var(--app-surface)] p-6 shadow-soft",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-[var(--app-surface-strong)] text-[var(--app-accent)]",children:e.jsx(z,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-xl font-bold text-brand-dark",children:"Payout setup"}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-brand-secondary",children:"Stripe Connect handles payout onboarding where available. Manual fallback stays available for unsupported cases."})]})]}),e.jsxs("div",{className:"mt-5 rounded-2xl border border-[var(--app-border)] bg-[var(--app-surface-soft)] p-4 text-sm",children:[e.jsxs("div",{className:"flex justify-between gap-3",children:[e.jsx("span",{className:"text-[var(--app-text-secondary)]",children:"Connect status"}),e.jsx("span",{className:"font-bold capitalize text-brand-dark",children:l(r.stripe_connect_status)})]}),e.jsxs("div",{className:"mt-3 flex justify-between gap-3",children:[e.jsx("span",{className:"text-[var(--app-text-secondary)]",children:"Payout-ready"}),e.jsx("span",{className:"font-bold text-brand-dark",children:r.stripe_payouts_enabled?"Yes":"No"})]})]}),r.status==="approved"&&e.jsxs("button",{type:"button",onClick:_,disabled:u,className:"mt-5 inline-flex w-full items-center justify-center gap-2 rounded-xl border border-brand-primary bg-[var(--app-surface)] px-4 py-3 text-sm font-bold text-[var(--app-accent)] hover:bg-brand-primary hover:text-[var(--app-on-primary)] disabled:opacity-60",children:[u?e.jsx(M,{className:"h-4 w-4 animate-spin"}):e.jsx(O,{className:"h-4 w-4"}),"Open payout onboarding"]})]})]}),e.jsx("div",{className:"mt-8 grid gap-4 md:grid-cols-3",children:Object.entries(v).length===0?e.jsx("div",{className:"rounded-2xl border border-[var(--app-border)] bg-[var(--app-surface)] p-5 text-sm text-brand-secondary shadow-soft md:col-span-3",children:"Sales and commission balances will appear after attributed purchases."}):Object.entries(v).map(([a,L])=>e.jsx($,{currency:E(a),values:L},a))}),e.jsxs("div",{className:"mt-8 grid gap-6 lg:grid-cols-2",children:[e.jsxs("div",{className:"rounded-[2rem] border border-[var(--app-border)] bg-[var(--app-surface)] p-6 shadow-soft",children:[e.jsx("h2",{className:"text-xl font-bold text-brand-dark",children:"Recent commissions"}),e.jsx("div",{className:"mt-4 space-y-3",children:y.length===0?e.jsx("p",{className:"text-sm text-brand-secondary",children:"No commissions yet."}):y.map(a=>e.jsxs("div",{className:"rounded-2xl border border-[var(--app-border)] p-4 text-sm",children:[e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsx("span",{className:"font-bold text-brand-dark",children:a.offer_id||a.purchase_type}),e.jsx("span",{className:"font-bold text-[var(--app-accent)]",children:o(a.commission_amount_cents,a.currency)})]}),e.jsxs("p",{className:"mt-1 capitalize text-brand-secondary",children:[l(a.status),a.hold_reason?` - ${l(a.hold_reason)}`:""]})]},a.id))})]}),e.jsxs("div",{className:"rounded-[2rem] border border-[var(--app-border)] bg-[var(--app-surface)] p-6 shadow-soft",children:[e.jsx("h2",{className:"text-xl font-bold text-brand-dark",children:"Payout history"}),e.jsx("div",{className:"mt-4 space-y-3",children:N.length===0?e.jsx("p",{className:"text-sm text-brand-secondary",children:"No payout batches yet."}):N.map(a=>e.jsxs("div",{className:"rounded-2xl border border-[var(--app-border)] p-4 text-sm",children:[e.jsxs("div",{className:"flex justify-between gap-4",children:[e.jsxs("span",{className:"font-bold text-brand-dark",children:["Payout #",a.id]}),e.jsx("span",{className:"font-bold text-[var(--app-accent)]",children:o(a.amount_cents,a.currency)})]}),e.jsx("p",{className:"mt-1 capitalize text-brand-secondary",children:l(a.status)})]},a.id))})]})]}),e.jsx("div",{className:"affiliate-studio-note",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(W,{className:"mt-0.5 h-5 w-5 shrink-0 text-[var(--app-accent)]"}),e.jsx("p",{className:"text-sm leading-7 text-[var(--app-text-secondary)]",children:"Payouts run monthly after the refund window. Ultra sales can stay pending while the buyer is still on the Job Guarantee track."})]})})]})})}export{H 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.