PageSourceSearch

https://nbyula.com/assets/index-DikRzxII.js

js nbyula.com collected 2026-10-06 20:44:29 UTC 13,151 bytes, 2 lines download raw bytes

1import{j as e,Y as Z,B as k,R as K,L as V,am as ee,r as l,c as v,A as w,f as N,b as se,t as te,C as ae,i2 as ne,bb as le}from"./index-QW0Z3Qxf.js";import{H as re}from"./Helmet-D6VBfBsl.js";import{B as ie}from"./BoxWrapper-BF06_f7n.js";import{S as q}from"./Skeletons-C-edCTea.js";import{r as M,k as oe}from"./constants-BsUlcXBm.js";import{A as ce}from"./ArrowIcon-b1xbJvXe.js";import"./index-LAbZhY8x.js";import"./index-BhHJjVN1.js";const D={reload:-1,loading:0,loaded:3};function de({totalEarnings:s,unsettledEarnings:o,totalDisbursedAmount:c,disbursementUnderProcessing:a,withdrawableBalance:u,getWithdrawableBalance:x,setWithdrawAmount:d,handleDisbursementRequest:r,shouldReloadSummary:m,className:h,showFullBreakupModal:n,getFinalBalance:g}){const p=({totalEarnings:b,unsettledEarnings:S,totalDisbursedAmount:y,disbursementUnderProcessing:$})=>{const f=({className:C="",title:I,amount:R,variant:A="default"})=>{const E=A==="primary";return e.jsxs("p",{className:`flex justify-between space-x-4 break-words ${C}`,children:[e.jsx("span",{className:`${E?"text-lg font-medium":"text-base font-light"}`,children:I}),e.jsx("span",{className:`${E?"text-lg font-semibold text-oxy-200":"text-base font-light"}`,children:M(R)})]})};return e.jsxs("div",{className:"pb-6 space-y-1.5 border-b-1.5",children:[e.jsx(f,{title:"Earnings",amount:b}),e.jsx(f,{title:"Unsettled earnings (-)",amount:S}),e.jsx(f,{title:"Disbursements until now (-)",amount:y}),e.jsx(f,{title:"Disbursements under process (-)",amount:$}),e.jsx(f,{className:"pt-4",title:e.jsxs("span",{className:"flex flex-col",children:["Withdrawable balance ",e.jsx("span",{className:"text-sm font-light",children:"(Post tax deducted at source)"})]}),amount:g(),variant:"primary"}),e.jsxs("div",{className:"flex justify-end items-center cursor-pointer",onClick:n,children:[e.jsx("p",{className:"text-sm",children:"View Breakdown"}),e.jsx(ce,{className:"w-3 h-3"})]})]})};return m!==D.loaded?e.jsx(q,{width:"w-full",customClasses:"h-72 lg:h-80 animate-pulse space-y-1 rounded-lg",backgroundColor:"bg-gray-200"}):e.jsx(e.Fragment,{children:e.jsxs(ie,{className:`space-y-6 ${h}`,children:[e.jsx(p,{totalEarnings:s,unsettledEarnings:o,totalDisbursedAmount:c,disbursementUnderProcessing:a,withdrawableBalance:u}),e.jsxs("div",{className:"flex justify-between space-x-4",children:[e.jsx("div",{className:"w-full",children:e.jsx(Z,{required:!0,type:"number",placeholder:"Amount to withdraw",onChange:({target:b})=>d(b.value),onKeyUp:b=>{b.persist(),(b.keyCode===13||b.key==="Enter")&&r()}})}),e.jsx(k,{label:"Continue",variant:"primary",onClick:r})]})]})})}function ue({isModalActive:s,setIdModalActive:o,totalEarnings:c,unsettledEarnings:a,totalDisbursedAmount:u,disbursementUnderProcessing:x,settledBalance:d,taxAppliedOnSettledBalance:r,withdrawableBalance:m,getFinalBalance:h}){const n=({heading:g,subHeading:p,amount:b,variant:S="DEFAULT"})=>{const y=S==="PRIMARY";return e.jsxs("div",{className:"flex justify-between space-x-10",children:[e.jsxs("div",{className:"",children:[e.jsx("h3",{className:`${y?"text-lg font-semibold":"text-base font-medium"}`,children:g}),e.jsx("p",{className:"text-sm font-light",children:p})]}),e.jsx("div",{className:"flex-shrink-0",children:e.jsx("h3",{className:`${y?"font-semibold text-oxy-200":""}`,children:M(b)})})]})};return K.createPortal(e.jsx(V,{showModal:s,setShowModal:o,showCloseIcon:!0,shouldCloseOnBackgroundClick:!0,children:e.jsxs("main",{className:"py-10 px-4 space-y-6",children:[e.jsx("div",{className:"border-b",children:e.jsx("h1",{className:"pb-4 text-xl font-medium",children:"Withdrawable balance breakdown"})}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(n,{heading:"Earnings",subHeading:"Total amount earned in Nbyula.",amount:c}),e.jsx(n,{heading:"Unsettled earnings (-)",subHeading:"Amount from earnings that will be released for withdrawal once the skylift is delivered and all disputes are resolved.",amount:a}),e.jsx(n,{heading:"Disbursements until now (-)",subHeading:"Amount from earnings that has been withdrawn until now.",amount:u}),e.jsx(n,{heading:"Disbursements under process (-)",subHeading:"Amount that is requested for disbur
1sement.",amount:x}),e.jsx("hr",{}),e.jsx(n,{heading:"Settled Balance",subHeading:"Withdrawable balance before tax.",amount:d}),e.jsx(n,{heading:"Tax (-)",subHeading:"Tax applied on Settled Balance.",amount:r}),e.jsx(n,{heading:"Withdrawable balance",subHeading:"Final balance that can be withdrawn.",amount:h(),variant:"PRIMARY"})]})]})}),document.getElementById("modal"))}function me(s){const{isModalActive:o}=s;return o&&e.jsx(ue,{...s})}function xe({isModalActive:s,setIdModalActive:o,withdrawAmount:c,hideConfirmationModal:a,successHandler:u,isKycDetailsApproved:x,isLoading:d}){return K.createPortal(e.jsx(V,{showModal:s,setShowModal:o,showCloseIcon:!0,shouldCloseOnBackgroundClick:!0,className:"md:h-auto",children:e.jsx("main",{className:"py-10 px-4 space-y-6",children:d?e.jsx(e.Fragment,{children:e.jsx(q,{width:"w-full",customClasses:"animate-pulse space-y-1 rounded-lg",backgroundColor:"bg-gray-200"})}):e.jsx(e.Fragment,{children:x?e.jsx(e.Fragment,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("h1",{className:"text-lg",children:e.jsxs("span",{children:["Are you sure you want to withdraw ",e.jsx("span",{className:"font-semibold",children:M(c)}),"?"]})}),e.jsxs("div",{className:"flex justify-between space-x-4",children:[e.jsx(k,{label:"No, go back",variant:"outline-secondary",onClick:a}),e.jsx(k,{label:"Sure",variant:"primary",onClick:u})]})]})}):e.jsx(e.Fragment,{children:e.jsxs("h1",{className:"text-lg",children:[e.jsx("span",{children:"Please complete your"})," ",e.jsx(ee,{to:"settlements/add-settlement-method",className:"font-semibold hover:underline text-space",children:"KYC"})," ",e.jsx("span",{children:"in order to withdraw your earnings!"})]})})})})}),document.getElementById("modal"))}function he(s){const{isModalActive:o}=s,[c,a]=l.useState(!1),[u,x]=l.useState(!1),d=l.useCallback(()=>{x(!0),v.get(`${w}/v1/game-player/kyc`).then(({data:r})=>{r&&r.status===oe.APPROVED&&a(!0),x(!1)}).catch(r=>{var m;const h=(r==null||(m=r.data)===null||m===void 0?void 0:m.message)||"Something went wrong";console.error(h)})},[]);return l.useEffect(()=>{d()},[d]),o&&e.jsx(xe,{...s,isKycDetailsApproved:c,isLoading:u})}function ge({className:s,setShouldReload:o,shouldReloadSummary:c,setShouldReloadSummary:a}){const[u,x]=l.useState(null),[d,r]=l.useState(0),[m,h]=l.useState(0),[n,g]=l.useState(0),[p,b]=l.useState(0),[S,y]=l.useState(0),[$,f]=l.useState(0),[C,I]=l.useState(0),[R,A]=l.useState(!1),[E,F]=l.useState(!1),Q=()=>{A(!0)},_=()=>{F(!0)},T=()=>{F(!1)},z=()=>{if(!u||u<1)return N.error("Please enter a valid amount to withdraw.");if(u>P())return N.error("Withdraw amount can't be more then withdrawable Balance.");_()},G=(t,i)=>{J(t,i)},J=(t=0,i=0)=>{if(t===0)return;const j={netLiability:t,requestedAmount:i};v.post(`${w}/v1/payment/disbursement`,j).then(({data:B})=>{N.success("We have received your request."),T(),o(!0),a(D.reload)}).catch(B=>{var U;const X=(B==null||(U=B.data)===null||U===void 0?void 0:U.message)||"Something went wrong";console.error(X),N.error("Something went wrong please try later.")})},H=l.useCallback(()=>{v.get(`${w}/v1/payment/liability/balance-summary`).then(({data:t})=>{y(t.settledBalance||0),f(t.taxApplied||0),I(t.withdrawableBalance||0),a(i=>i+1)}).catch(t=>{var i;const j=(t==null||(i=t.data)===null||i===void 0?void 0:i.message)||"Something went wrong";console.error(j)})},[a]),L=l.useCallback(()=>{v.get(`${w}/v1/payment/settlement/balance-summary`).then(({data:t})=>{r(t.totalEarnings||0),h(t.unsettledEarnings||0),a(i=>i+1)}).catch(t=>{var i;const j=(t==null||(i=t.data)===null||i===void 0?void 0:i.message)||"Something went wrong";console.error(j)})},[a]),W=l.useCallback(()=>{v.get(`${w}/v1/payment/disbursement/balance-summary`).then(({data:t})=>{g(t.totalDisbursedAmount||0),b(t.disbursementUnderProcessing||0),a(i=>i+1)}).catch(t=>{var i;const j=(t==null||(i=t.data)===null||i===void 0?void 0:i.message)||"Something went wrong";console.error(j)})},[a]);l.useEffect(()=>{c===D.reload&&(L(),W(),H(),a(D.loading))},[W,L,H,a,c]);const P=()=>{let t=C-(n+p);return t=parseFloat(t.toFixed(2)),t};return e.jsxs(e.Fragment,{children:[e.jsx(de,{totalEarnings:d,unsettledEarnings:m,totalDisbursedAmount:n,disbursementUnderProcessing:p,withdrawableBalance:C,setWithdrawAmount:x,handleDisbur
1sementRequest:z,shouldReloadSummary:c,className:s,showFullBreakupModal:Q,showConfirmationModal:_,getFinalBalance:P}),e.jsx(me,{isModalActive:R,setIdModalActive:A,totalEarnings:d,unsettledEarnings:m,totalDisbursedAmount:n,disbursementUnderProcessing:p,settledBalance:S,taxAppliedOnSettledBalance:$,withdrawableBalance:C,getFinalBalance:P}),e.jsx(he,{isModalActive:E,setIdModalActive:F,successHandler:()=>{G(C,u)},withdrawAmount:u,hideConfirmationModal:T})]})}function be({renderDisbursementDetailsCard:s,setShouldReload:o,shouldReloadSummary:c,setShouldReloadSummary:a}){return e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[e.jsx("meta",{charSet:"utf-8"}),e.jsx("title",{children:"Disbursements | Nbyula"}),e.jsx("meta",{name:"description",content:"Skillizens without Borders"})]}),e.jsxs("main",{className:"px-3 mx-auto mt-10 space-y-12 w-full max-w-7xl font-serif",children:[e.jsx("section",{children:e.jsx("h1",{className:"text-2xl font-bold",children:"Disbursements"})}),e.jsxs("section",{className:"flex flex-col-reverse space-x-0 lg:flex-row lg:space-x-24",children:[e.jsxs("section",{className:"space-y-2 w-full",children:[e.jsx("h1",{className:"text-2xl font-medium text-space",children:"All Requests"}),e.jsx("div",{children:s()})]}),e.jsx("section",{className:"pb-6 lg:relative lg:flex-shrink-0 lg:pb-0 lg:w-96",children:e.jsx(ge,{className:"lg:sticky lg:top-20",setShouldReload:o,shouldReloadSummary:c,setShouldReloadSummary:a})})]})]})]})}const O={REQUESTED:1,PROCESSING:2,REJECTED:3,DISBURSED:4,CANCELED:5},pe={1:"Requested",2:"Processing",3:"Rejected",4:"Disbursed",5:"Cancelled"};function fe({data:s,handleCancelCta:o,isCancelCtaDisabled:c}){const a=s&&Object.keys(s).length>0,u=se(x=>{var d,r;return(d=x.user)===null||d===void 0||(r=d.profile)===null||r===void 0?void 0:r.email});return a?e.jsx(e.Fragment,{children:e.jsxs("div",{className:"py-8 px-5 space-y-4 border-b border-space-30",children:[e.jsxs("div",{className:"flex justify-between space-x-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"pb-2 text-lg font-semibold text-space-80",children:pe[s.status]}),s.status===O.DISBURSED&&e.jsxs("p",{className:"text-sm font-medium hover:underline text-space",children:["Transaction Id: ",s.disbursementReferenceNumber||""]})]}),e.jsxs("div",{className:"flex-shrink-0 space-y-3 text-right",children:[e.jsx("h1",{className:"text-xl font-bold text-space",children:M(s.requestedAmount)}),e.jsx("p",{className:"text-sm font-normal text-space-80",children:e.jsxs("span",{children:["Requested on ",te(s.createdAt).format("MMMM Do YYYY")]})})]})]}),e.jsxs("div",{className:"flex justify-between",children:[e.jsx(k,{customContainerClass:`${s.status===O.REQUESTED?"visible":"invisible"}`,label:"Cancel Request",variant:"outline-secondary",startIcon:e.jsx(ae,{className:"mr-2.5 w-4 h-4"}),onClick:o,disabled:c}),e.jsx("div",{children:e.jsx(ne,{subject:`${u} needs assistance for disbursement id: ${s==null?void 0:s._id}`,recipientEmail:"[email protected]",children:e.jsx(k,{label:"Need Help?",variant:"text-underline"})})})]})]})}):e.jsx("div",{className:"flex justify-between py-10 px-5 space-x-6 border-b border-space-30",children:e.jsx("h1",{className:"pb-2 text-base font-semibold text-space-80",children:"No disbursement request found!"})})}function Y(s){let{data:o,setShouldReloadSummary:c}=s;const[a,u]=l.useState(o),[x,d]=l.useState(!1),r=()=>{d(!0),v.patch(`${w}/v1/payment/disbursement/cancel-request/${o._id}`).then(m=>{m.data&&(u(m.data),c(D.reload),N.success("Request successfully cancelled.")),d(!1)}).catch(m=>{var h;const n=(m==null||(h=m.data)===null||h===void 0?void 0:h.message)||"Something went wrong";N.error("Unable to cancel request."),console.error(n)})};return e.jsx(fe,{handleCancelCta:r,isCancelCtaDisabled:x,data:a})}function ke(){const[s,o]=l.useState([]),[c,a]=l.useState(!0),[u,x]=l.useState(!1),[d,r]=l.useState(D.reload),m=()=>u?e.jsx(q,{width:"w-full",customClasses:"h-36 animate-pulse rounded-lg mt-8",backgroundColor:"bg-gray-200"}):s.length===0?e.jsx(e.Fragment,{children:e.jsx(Y,{})}):e.jsx(e.Fragment,{children:s.map((n,g)=>e.jsx(Y,{data:n,setShouldReloadSummary:r},n._id||g))}),h=l.useCallback(()=>{x(!0),v.get(`${w}/v1/payment/disbursement`).then(({data:n})=>{n.constructor===Array&&n.length?o(n):console.error("No disbursements found!"),x(!1)}).catch(n=>{var g;const p=(n==null||(g=n.data)===null||g===void 0?void 0:g.message)||"Something went wrong";console.error(p)})},[]);return l.useEffect(()=>{c&&(h(),a(!1))},[h,c]),e.jsx(le,{eventName:"page-visit",logImpression:!0,children:e.jsx(be,{renderDisbursementDetailsCard:m,setShouldReload:a,shouldReloadSummary:d,setShouldReloadSummary:r})})}
1export{ke as default};
2//# sourceMappingURL=index-DikRzxII.js.map

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.