PageSourceSearch

https://goneat.co.uk/assets/index-C5my5K8M.js

js goneat.co.uk collected 2026-09-24 15:15:10 UTC 21,569 bytes, 1 lines download raw bytes

1import{u as B,e as X,b as Y,a as ee,j as e}from"./vendor-query-D1Mshrk-.js";import{r as u}from"./vendor-react-BfQMi0FG.js";import{b$ as ye,k as R,B as b,r as q,$ as I,C as ge,L as S,I as E,d as je,f as pe,t as T,ah as be}from"./index-D3kn74s7.js";import{P as ve}from"./page-header-C7x1KRLA.js";import{T as Ne,a as Ce,b as K,c as O}from"./tabs-nPG276U5.js";import{C as Q,d as z,a as Pe,b as ke}from"./card-C6DfUXn8.js";import{T as te,a as se,b as L,c as g,d as ae,e as j}from"./table-B-sxBKmb.js";import{D as V,a as G,b as U,c as Z,d as ne,e as re}from"./dialog-Dt-Wm_UE.js";import"./vendor-ui-nQy3bJlE.js";function we(t,s,n){return ye(t,-1,n)}function Me(){return B({queryKey:["ryft","accounts"],queryFn:async()=>(await R.get("/ryft/accounts")).data.data.accounts})}function Re(t,s="base"){return X({queryKey:["ryft","payments",s,t??{}],initialPageParam:void 0,queryFn:async({pageParam:n})=>(await R.get("/ryft/payments",{params:{...t,account:s,cursor:n}})).data.data,getNextPageParam:n=>n.items.length>0?n.paginationToken??void 0:void 0})}function Te(t,s="base"){return B({queryKey:["ryft","payment",s,t],enabled:!!t,queryFn:async()=>(await R.get(`/ryft/payments/${t}`,{params:{account:s}})).data.data})}function de(t,s="base"){return X({queryKey:["ryft","payouts",s,t??{}],initialPageParam:void 0,queryFn:async({pageParam:n})=>(await R.get("/ryft/payouts",{params:{...t,account:s,cursor:n}})).data.data,getNextPageParam:n=>n.payouts.length>0?n.paginationToken??void 0:void 0})}function le(t="base"){return B({queryKey:["ryft","balances",t],queryFn:async()=>(await R.get("/ryft/balances",{params:{account:t}})).data.data})}function Se(){const t=Y();return ee({mutationFn:async({id:s,amount:n,reason:a,account:l="base"})=>(await R.post(`/ryft/payments/${s}/refunds`,{amount:n,reason:a},{params:{account:l}})).data.data,onSuccess:()=>{t.invalidateQueries({queryKey:["ryft","payment"]}),t.invalidateQueries({queryKey:["ryft","payments"]})}})}function Fe(t="base"){return B({queryKey:["ryft","payout-methods",t],queryFn:async()=>(await R.get("/ryft/payout-methods",{params:{account:t}})).data.data})}function Ae(){const t=Y();return ee({mutationFn:async({account:s="base",...n})=>(await R.post("/ryft/payouts",n,{params:{account:s}})).data.data,onSuccess:()=>{t.invalidateQueries({queryKey:["ryft","payouts"]}),t.invalidateQueries({queryKey:["ryft","balances"]})}})}const ce=u.createContext("base"),D=()=>u.useContext(ce);function oe(t){const s=new Set;return t.filter(n=>s.has(n.id)?!1:(s.add(n.id),!0))}function m(t,s="GBP"){const n=(t??0)/100;try{return new Intl.NumberFormat("en-GB",{style:"currency",currency:s}).format(n)}catch{return`${n.toFixed(2)} ${s}`}}function k(t){return t?I(new Date(t*1e3),"dd MMM yyyy, HH:mm"):"—"}function H(){return I(new Date,"yyyy-MM-dd")}function De(){return I(we(new Date),"yyyy-MM-dd")}function ie(t){return Math.floor(new Date(`${t}T00:00:00`).getTime()/1e3)}function ue(t){const s=Math.floor(new Date(`${t}T23:59:59`).getTime()/1e3),n=Math.floor(Date.now()/1e3);return Math.min(s,n)}function W(t,s){return I(be(new Date(`${t}T00:00:00`),s),"yyyy-MM-dd")}function me({from:t,to:s,onFrom:n,onTo:a}){const l=r=>{n(W(t,r)),a(W(s,r))};return e.jsxs("div",{className:"mb-4 flex items-end gap-2",children:[e.jsx(b,{type:"button",variant:"outline",size:"icon",className:"shrink-0","aria-label":"Previous day",onClick:()=>l(-1),children:e.jsx(ge,{className:"h-4 w-4"})}),e.jsxs("div",{className:"flex flex-1 gap-2 sm:flex-none",children:[e.jsxs("div",{className:"flex-1 space-y-1 sm:flex-none",children:[e.jsx(S,{htmlFor:"ryft-from",className:"text-xs text-muted-foreground",children:"From"}),e.jsx(E,{id:"ryft-from",type:"date",value:t,max:s,onChange:r=>n(r.target.value),className:"w-full sm:w-auto"})]}),e.jsxs("div",{className:"flex-1 space-y-1 sm:flex-none",children:[e.jsx(S,{htmlFor:"ryft-to",className:"text-xs text-muted-foreground",children:"To"}),e.jsx(E,{id:"ryft-to",type:"date",value:s,min:t,onChange:r=>a(r.target.value),className:"w-full sm:w-auto"})]})]}),e.jsx(b,{type:"button",variant:"outline",size:"icon",className:"shrink-0","aria-label":"Next day",onClick:()=>l(1),children:e.jsx(je,{className:"h-4 w-4"})})]})}function xe({hasNextPage:t,isFetchingNextPage:s,onLoadMore:n,loadedCount:a,noun:l}){return t?e.jsxs("div",{className:"mt-4 flex flex-col items-center gap-1",children:[e.jsxs(b,{type:"button",variant:"outline",onClick:n,disabled:s,children:[s&&e.jsx(q,{className:"mr-2 h-4 w-4 animate-spin"}),s?"Loading…":"Load more"]}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[a," ",l," loaded"]})]}):a>
10?e.jsxs("p",{className:"mt-4 text-center text-xs text-muted-foreground",children:["Showing all ",a," ",l]}):null}const _={Captured:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",Approved:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400",Processing:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",PendingPayment:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300",PendingAction:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300",Voided:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"},he={Completed:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",InProgress:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400",PendingReview:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",Returned:"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300",Failed:"bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400"};function qe(t){return t==="Captured"?"Successful":t.replace(/([a-z])([A-Z])/g,"$1 $2")}function $e(t){const s=t.replace(/_/g," ").trim();return s?s.charAt(0).toUpperCase()+s.slice(1):t}function A(t){const s=t.customerDetails;return`${s?.firstName??""} ${s?.lastName??""}`.trim()||null}function Ee(t){return t.status==="Captured"||t.status==="Voided"||!!t.lastError}function $({status:t,colors:s}){return e.jsx(pe,{variant:"secondary",className:s[t]??"bg-gray-100 text-gray-700 dark:bg-gray-800 dark:text-gray-300",children:qe(t)})}function Le({payment:t,onClick:s}){const n=t.paymentMethod?.card,a=n?.last4?`${n.scheme??"Card"} ••${n.last4}`:t.paymentMethod?.wallet?.type??"—";return e.jsxs("button",{type:"button",onClick:s,className:"w-full rounded-lg border bg-card p-4 text-left",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-base font-semibold",children:m(t.amount,t.currency)}),e.jsx($,{status:t.status,colors:_})]}),e.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2 text-sm text-muted-foreground",children:[e.jsx("span",{className:"truncate",children:a}),!!t.refundedAmount&&e.jsxs("span",{className:"shrink-0 font-medium text-amber-600 dark:text-amber-400",children:["Refunded ",m(t.refundedAmount,t.currency)]})]}),!!A(t)&&e.jsx("p",{className:"mt-1 truncate text-sm font-medium",children:A(t)}),!!t.customerEmail&&e.jsx("p",{className:"mt-0.5 truncate text-sm text-muted-foreground",children:t.customerEmail}),e.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:k(t.createdTimestamp)})]})}function Be({payout:t}){return e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"text-base font-semibold",children:m(t.amount,t.currency)}),e.jsx($,{status:t.status,colors:he})]}),e.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Type"}),e.jsx("p",{className:"font-medium",children:t.scheduleType??"—"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Created"}),e.jsx("p",{className:"font-medium",children:k(t.createdTimestamp)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Scheduled"}),e.jsx("p",{className:"font-medium",children:k(t.scheduledTimestamp)})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground",children:"Completed"}),e.jsx("p",{className:"font-medium",children:k(t.completedTimestamp)})]})]}),!!t.failureReason&&e.jsx("p",{className:"mt-2 text-xs text-destructive",children:t.failureReason})]})}function Ie(){const t=D(),[s,n]=u.useState(H()),[a,l]=u.useState(H()),r=u.useMemo(()=>({from:ie(s),to:ue(a),limit:50}),[s,a]),{data:f,isLoading:v,isError:N,fetchNextPage:C,hasNextPage:P,isFetchingNextPage:p}=Re(r,t),[w,c]=u.useState(null),[x,F]=u.useState(!1),h=oe(f?.pages.flatMap(d=>d.items)??[]),o=x?h:h.filter(Ee),M=h.length-o.length;return e.jsxs(e.Fragment,{children:[e.jsx(me,{from:s,to:a,onFrom:n,onTo:l}),e.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2",children:[e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("input",{type:"checkbox",className:"h-4 w-4 roun
1ded border-input accent-primary",checked:x,onChange:d=>F(d.target.checked)}),"Show all transactions"]}),!x&&M>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[M," pending hidden"]})]}),v?e.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:e.jsx(q,{className:"h-5 w-5 animate-spin"})}):N?e.jsx("p",{className:"py-12 text-center text-muted-foreground",children:"Failed to load payments."}):e.jsxs(e.Fragment,{children:[o.length===0?e.jsx("p",{className:"py-12 text-center text-muted-foreground",children:!x&&M>0?'No successful or failed payments in this range. Tick "Show all transactions" to see pending ones.':"No payments found."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 md:hidden",children:o.map(d=>e.jsx(Le,{payment:d,onClick:()=>c(d.id)},d.id))}),e.jsx(Q,{className:"hidden md:block",children:e.jsx(z,{className:"p-0",children:e.jsxs(te,{children:[e.jsx(se,{children:e.jsxs(L,{children:[e.jsx(g,{children:"Date"}),e.jsx(g,{children:"Amount"}),e.jsx(g,{children:"Status"}),e.jsx(g,{children:"Card"}),e.jsx(g,{children:"Customer"}),e.jsx(g,{className:"text-right",children:"Refunded"})]})}),e.jsx(ae,{children:o.map(d=>e.jsxs(L,{className:"cursor-pointer",onClick:()=>c(d.id),children:[e.jsx(j,{children:k(d.createdTimestamp)}),e.jsx(j,{children:m(d.amount,d.currency)}),e.jsx(j,{children:e.jsx($,{status:d.status,colors:_})}),e.jsx(j,{children:d.paymentMethod?.card?.last4?`${d.paymentMethod.card.scheme??"Card"} ••${d.paymentMethod.card.last4}`:d.paymentMethod?.wallet?.type??"—"}),e.jsx(j,{children:A(d)?e.jsxs("div",{children:[e.jsx("div",{children:A(d)}),!!d.customerEmail&&e.jsx("div",{className:"text-xs text-muted-foreground",children:d.customerEmail})]}):d.customerEmail??"—"}),e.jsx(j,{className:"text-right",children:d.refundedAmount?m(d.refundedAmount,d.currency):"—"})]},d.id))})]})})})]}),e.jsx(xe,{hasNextPage:!!P,isFetchingNextPage:p,onLoadMore:()=>C(),loadedCount:o.length,noun:"payments"})]}),e.jsx(Ke,{id:w,onClose:()=>c(null)})]})}function Ke({id:t,onClose:s}){const n=D(),{data:a,isLoading:l}=Te(t,n);return e.jsx(V,{open:!!t,onOpenChange:r=>!r&&s(),children:e.jsxs(G,{children:[e.jsxs(U,{children:[e.jsx(Z,{children:"Payment Details"}),e.jsx(ne,{children:a?.id??t})]}),l||!a?e.jsx("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:e.jsx(q,{className:"h-5 w-5 animate-spin"})}):e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsx(y,{label:"Amount",value:m(a.amount,a.currency)}),e.jsx(y,{label:"Status",value:e.jsx($,{status:a.status,colors:_})}),e.jsx(y,{label:"Card",value:a.paymentMethod?.card?.last4?`${a.paymentMethod.card.scheme??"Card"} ••${a.paymentMethod.card.last4}`:a.paymentMethod?.wallet?.type??"—"}),!!A(a)&&e.jsx(y,{label:"Customer",value:A(a)}),e.jsx(y,{label:"Email",value:a.customerEmail??"—"}),e.jsx(y,{label:"Created",value:k(a.createdTimestamp)}),a.platformFee!=null&&e.jsx(y,{label:"Platform fee",value:m(a.platformFee,a.currency)}),e.jsx(y,{label:"Refunded",value:m(a.refundedAmount??0,a.currency)}),a.lastError&&e.jsx(y,{label:"Reason",value:$e(a.lastError)}),e.jsx(Oe,{payment:a,onRefunded:s})]})]})})}function Oe({payment:t,onRefunded:s}){const n=D(),[a,l]=u.useState(!1),[r,f]=u.useState("full"),[v,N]=u.useState(""),[C,P]=u.useState(""),p=Se();if(!(t.status==="Captured"&&(t.refundedAmount??0)<t.amount))return null;const c=t.amount-(t.refundedAmount??0),x=c/100,F=async()=>{const h={id:t.id,account:n};if(r==="partial"){const o=parseFloat(v);if(!o||o<=0||o>x){T.error(`Enter a valid amount between £0.01 and £${x.toFixed(2)}`);return}h.amount=Math.round(o*100)}C.trim()&&(h.reason=C.trim());try{const o=await p.mutateAsync(h);T.success(`Refund of ${m(o.refundedAmount,t.currency)} processed successfully`),l(!1),f("full"),N(""),P(""),s()}catch(o){const M=o?.response?.data?.error?.message??o?.message??"Refund failed";T.error(M)}};return e.jsxs("div",{className:"pt-2",children:[e.jsx(b,{variant:"destructive",size:"sm",onClick:()=>l(!0),children:"Refund Payment"}),e.jsx(V,{open:a,onOpenChange:l,children:e.jsxs(G,{children:[e.jsx(U,{children:e.jsx(Z,{children:"Refund Payment"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1 text-sm",children:[e.jsxs("p",{children:["Payment: ",m(t.amount,t.currency)]}),(t.refundedAmount??0)>0&&e.jsxs("p",{className:"text-muted-foreground",children:["Already refunded: ",m(t.refundedAmount,t.currency)]}
1),e.jsxs("p",{className:"font-medium",children:["Max refundable: ",m(c,t.currency)]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{children:"Refund type"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-sm",children:[e.jsx("input",{type:"radio",checked:r==="full",onChange:()=>f("full")}),"Full refund (",m(c,t.currency),")"]}),e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-sm",children:[e.jsx("input",{type:"radio",checked:r==="partial",onChange:()=>f("partial")}),"Partial refund"]})]})]}),r==="partial"&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{htmlFor:"ryft-refund-amount",children:"Amount (£)"}),e.jsx(E,{id:"ryft-refund-amount",type:"number",step:"0.01",min:"0.01",max:x,value:v,onChange:h=>N(h.target.value),placeholder:`Max £${x.toFixed(2)}`})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{htmlFor:"ryft-refund-reason",children:"Reason (optional)"}),e.jsx("textarea",{id:"ryft-refund-reason",className:"flex w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",rows:2,maxLength:255,value:C,onChange:h=>P(h.target.value),placeholder:"Optional reason for the refund"})]})]}),e.jsxs(re,{children:[e.jsx(b,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),e.jsx(b,{variant:"destructive",onClick:F,disabled:p.isPending,children:p.isPending?"Processing...":"Confirm Refund"})]})]})})]})}function y({label:t,value:s}){return e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsx("span",{className:"text-muted-foreground",children:t}),e.jsx("span",{className:"font-medium",children:s})]})}function He(){const t=D(),{data:s}=de({limit:1},t),{data:n}=Fe(t),{data:a}=le(t),l=Ae(),[r,f]=u.useState(!1),[v,N]=u.useState(""),[C,P]=u.useState(""),p=s?.pages[0]?.payouts?.[0];if(!(p?.scheduleType==="Manual"))return null;const c=p?.currency??"GBP",x=(n?.items??[]).filter(i=>i.status==="Valid"),F=a?.items?.find(i=>i.currency===c),h=F?.available?.amount??0,o=h/100,M=C||(x.length===1?x[0].id:""),d=async()=>{const i=parseFloat(v);if(!i||i<=0){T.error("Enter a valid payout amount");return}if(h>0&&i>o){T.error(`Amount exceeds your available balance of £${o.toFixed(2)}`);return}try{await l.mutateAsync({amount:Math.round(i*100),currency:c,payoutMethodId:M||void 0,account:t}),T.success("Payout requested successfully"),f(!1),N(""),P("")}catch(J){const fe=J?.response?.data?.error?.message??J?.message??"Failed to request payout";T.error(fe)}};return e.jsxs("div",{className:"mb-4 flex justify-end",children:[e.jsx(b,{type:"button",onClick:()=>f(!0),children:"Request Payout"}),e.jsx(V,{open:r,onOpenChange:f,children:e.jsxs(G,{children:[e.jsxs(U,{children:[e.jsx(Z,{children:"Request Payout"}),e.jsx(ne,{children:"Send your available balance to your bank account."})]}),e.jsxs("div",{className:"space-y-4",children:[F&&e.jsxs("p",{className:"text-sm font-medium",children:["Available balance: ",m(h,c)]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{htmlFor:"ryft-payout-amount",children:"Amount (£)"}),e.jsx(E,{id:"ryft-payout-amount",type:"number",step:"0.01",min:"0.01",max:o>0?o:void 0,value:v,onChange:i=>N(i.target.value),placeholder:o>0?`Max £${o.toFixed(2)}`:"Enter amount"})]}),n?.restricted&&e.jsx("p",{className:"text-sm text-muted-foreground",children:n.message}),x.length>1&&e.jsxs("div",{className:"space-y-2",children:[e.jsx(S,{htmlFor:"ryft-payout-method",children:"Payout method"}),e.jsxs("select",{id:"ryft-payout-method",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",value:M,onChange:i=>P(i.target.value),children:[e.jsx("option",{value:"",children:"Select a payout method"}),x.map(i=>e.jsxs("option",{value:i.id,children:[i.displayName??i.id,i.currency?` (${i.currency})`:""]},i.id))]})]}),x.length===1&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Paying out to ",x[0].displayName??x[0].id]})]}),e.jsxs(re,{children:[e.jsx(b,{variant:"outline",onClick:()=>f(!1),children:"Cancel"}),e.jsx(b,{onClick:d,disabled:l.isPending,children:l.isPending?"Processing...":"Confirm Payout"})]})]})})]})}function Qe(){const t=D(),[s,n]=u.useState(De()),[a,l]=u.useState(H()),r=u.useMemo(()=>({from:ie(s),to:ue(a),limit:50}),[s,a]),{data:f,isLoading:v,isError:N,fetchNextPage:C,hasNextPage:P,isFetchingNextPage:p}=de(r,t),w=oe(f?.pages.flatMap(c=>c.payouts)??[]);return e.jsxs(e.Fragment,{children:[e.jsx(He,{}),e.jsx(me,{from:s,to:a,onFrom:n,onTo:l}),v?e.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:e.jsx(q,{className:"h-5 w-5 animate-spin"})}):N?e.jsx("p",{className:"py-12 text-center text-muted-foreground",children:"Failed to load payouts."}):w.length===0?e.jsx("p",{className:"py-12 text-center text-muted-foreground",children:"No payouts found."}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-3 md:hidden",children:w.map(c=>e.jsx(Be,{payout:c},c.id))}),e.jsx(Q,{className:"hidden md:block",children:e.jsx(z,{className:"p-0",children:e.jsxs(te,{children:[e.jsx(se,{children:e.jsxs(L,{children:[e.jsx(g,{children:"Created"}),e.jsx(g,{children:"Amount"}),e.jsx(g,{children:"Status"}),e.jsx(g,{children:"Type"}),e.jsx(g,{children:"Scheduled"}),e.jsx(g,{children:"Completed"})]})}),e.jsx(ae,{children:w.map(c=>e.jsxs(L,{children:[e.jsx(j,{children:k(c.createdTimestamp)}),e.jsx(j,{children:m(c.amount,c.currency)}),e.jsx(j,{children:e.jsx($,{status:c.status,colors:he})}),e.jsx(j,{children:c.scheduleType??"—"}),e.jsx(j,{children:k(c.scheduledTimestamp)}),e.jsx(j,{children:k(c.completedTimestamp)})]},c.id))})]})})}),e.jsx(xe,{hasNextPage:!!P,isFetchingNextPage:p,onLoadMore:()=>C(),loadedCount:w.length,noun:"payouts"})]})]})}function ze(){const t=D(),{data:s,isLoading:n,isError:a}=le(t);if(n)return e.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:e.jsx(q,{className:"h-5 w-5 animate-spin"})});if(a)return e.jsx("p",{className:"py-12 text-center text-muted-foreground",children:"Failed to load balances."});const l=s?.items??[];return l.length===0?e.jsx("p",{className:"py-12 text-center text-muted-foreground",children:"No balances found."}):e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:l.map(r=>e.jsxs(Q,{children:[e.jsx(Pe,{children:e.jsx(ke,{children:r.currency})}),e.jsxs(z,{className:"space-y-2 text-sm",children:[e.jsx(y,{label:"Available",value:m(r.available?.amount,r.currency)}),e.jsx(y,{label:"Pending",value:m(r.pending?.amount,r.currency)}),e.jsx(y,{label:"Cleared",value:m(r.cleared?.amount,r.currency)})]})]},r.currency))})}function Ve({options:t,value:s,onChange:n}){return e.jsx("div",{className:"inline-flex rounded-lg border bg-muted/40 p-1",children:t.map(a=>e.jsx(b,{type:"button",size:"sm",variant:s===a.key?"default":"ghost",className:"h-8",onClick:()=>n(a.key),children:a.label},a.key))})}function tt(){const{data:t}=Me(),[s,n]=u.useState("base"),a=(t?.length??0)>1;return e.jsx(ce.Provider,{value:s,children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(ve,{title:"Ryft Dashboard",description:"View your card payments, payouts and account balance."}),a&&e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Account"}),e.jsx(Ve,{options:t,value:s,onChange:n})]}),e.jsxs(Ne,{defaultValue:"payments",children:[e.jsxs(Ce,{className:"grid w-full grid-cols-3 sm:inline-flex sm:w-auto",children:[e.jsx(K,{value:"payments",children:"Payments"}),e.jsx(K,{value:"payouts",children:"Payouts"}),e.jsx(K,{value:"balance",children:"Balance"})]}),e.jsx(O,{value:"payments",children:e.jsx(Ie,{})}),e.jsx(O,{value:"payouts",children:e.jsx(Qe,{})}),e.jsx(O,{value:"balance",children:e.jsx(ze,{})})]})]})})}export{tt as RyftDashboardPage};

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.