"use strict";(globalThis.webpackChunkwoocommerce_payments=globalThis.webpackChunkwoocommerce_payments||[]).push([[7554],{6657(e,a,s){s.r(a),s.d(a,{default:()=>x}),s(1609);var t=s(7723),n=s(8846),o=s(7583),r=s(2335),c=s(9199),l=s(596),i=s(4937),m=s(6519),d=s(1272),p=s(541),_=s(612),u=s(7564),y=s(4848);const h=[{key:"paid_out_at",label:(0,t.__)("Disbursed","woocommerce-payments"),screenReaderLabel:(0,t.__)("Disbursed","woocommerce-payments"),required:!0,isLeftAligned:!0,defaultSort:!0},{key:"status",label:(0,t.__)("Status","woocommerce-payments"),screenReaderLabel:(0,t.__)("Status","woocommerce-payments"),required:!0,cellClassName:"is-center-aligned"},{key:"amount",label:(0,t.__)("Amount","woocommerce-payments"),screenReaderLabel:(0,t.__)("Amount","woocommerce-payments"),required:!0,isLeftAligned:!1,isNumeric:!0},{key:"fee_amount",label:(0,t.__)("Fixed fee","woocommerce-payments"),screenReaderLabel:(0,t.__)("Fixed fee","woocommerce-payments"),required:!0,isLeftAligned:!1,isNumeric:!0},{key:"withhold_rate",label:(0,t.__)("Withhold rate","woocommerce-payments"),screenReaderLabel:(0,t.__)("Withhold rate","woocommerce-payments"),required:!0,isLeftAligned:!1,isNumeric:!0},{key:"first_paydown_at",label:(0,t.__)("First paydown","woocommerce-payments"),screenReaderLabel:(0,t.__)("First paydown","woocommerce-payments"),required:!0,isLeftAligned:!1,isNumeric:!0}],w=e=>e.fully_paid_at?(0,t.sprintf)((0,t.__)("Paid off: %s","woocommerce-payments"),(0,u._)(e.fully_paid_at)):(0,t.__)("Active","woocommerce-payments"),f=e=>(0,y.jsx)(d.A,{message:w(e),type:e.fully_paid_at?"primary":"warning"}),g=e=>e.map(e=>{const a=a=>(0,y.jsx)(m.A,{href:(0,_.hT)({page:"wc-admin",path:"/payments/transactions",type:"charge",filter:"advanced",loan_id_is:e.stripe_loan_id}),children:a}),s={paid_out_at:{value:e.paid_out_at,display:a((0,u._)(e.paid_out_at))},status:{value:w(e),display:a(f(e))},amount:{value:(0,i.rx)(e.currency)?e.amount:e.amount/100,display:a((0,i.$9)(e.amount,e.currency.toUpperCase()))},fee_amount:{value:(0,i.rx)(e.currency)?e.fee_amount:e.fee_amount/100,display:a((0,i.$9)(e.fee_amount,e.currency.toUpperCase()))},withhold_rate:{value:e.withhold_rate,display:a(+(100*e.withhold_rate).toFixed(2)+"%")},first_paydown_at:{value:e.first_paydown_at,display:a(e.first_paydown_at?(0,u._)(e.first_paydown_at):"-")}};return h.map(({key:e})=>s[e])}),b=e=>{if(!e.length)return[];const a=[{label:(0,t._n)("loan","loans",e.length,"woocommerce-payments"),value:String(e.length)}],s=Array.from(new Set(e.map(e=>e.currency)));return 1===s.length&&(a.push({label:(0,t.__)("total","woocommerce-payments"),value:(0,i.$9)(e.reduce((e,a)=>e+a.amount,0),s[0])}),a.push({label:(0,t.__)("fixed fees","woocommerce-payments"),value:(0,i.$9)(e.reduce((e,a)=>e+a.fee_amount,0),s[0])})),a},x=()=>{const{loans:e,isLoading:a}=(0,p.xr)();return(0,y.jsxs)(o.A,{children:[(0,y.jsx)(r.Y,{currentPage:"loans"}),wcpaySettings.accountLoans.has_active_loan&&(0,y.jsx)(c.A,{children:(0,y.jsx)(l.A,{})}),(0,y.jsx)(n.TableCard,{className:"wcpay-loans-list",title:(0,t.__)("All loans","woocommerce-payments"),isLoading:a,totalRows:e.length,headers:h,rows:g(e),rowsPerPage:e.length,summary:b(e),showMenu:!1})]})}},1272(e,a,s){s.d(a,{A:()=>c}),s(1609);var t=s(7677),n=s(4164),o=s(2159),r=s(4848);const c=({message:e,type:a="primary",className:s,tooltip:c,icon:l})=>{const i=(0,n.A)("chip",`chip-${a}`,l&&"chip-has-icon",s),m=(0,r.jsxs)(r.Fragment,{children:[l&&(0,r.jsx)(t.A,{icon:l,size:16}),e]});return c?(0,r.jsx)(o.s,{content:c,children:(0,r.jsx)("span",{className:i,children:m})}):(0,r.jsx)("span",{className:i,children:m})}},6519(e,a,s){s.d(a,{A:()=>o});var t=s(8846),n=(s(1609),s(4848));const o=({href:e,children:a,...s})=>e?(0,n.jsx)(t.Link,{href:e,className:"woocommerce-table__clickable-cell",tabIndex:"-1",...s,children:a}):(0,n.jsx)(n.Fragment,{children:a})},7014(e,a,s){s.d(a,{A:()=>r,a:()=>o}),s(1609);var t=s(4848);const n=({isLoading:e,display:a,placeholder:s,value:n,children:o,...r})=>e?(0,t.jsx)("span",{className:a?`is-loadable-placeholder is-${a}`:"is-loadable-placeholder","aria-busy":"true",...r,children:void 0===s?o||n:s}):(0,t.jsx)(t.Fragment,{children:o||n}),o=({numLines:e,...a})=>{const s=(0,t.jsx)("p",{style:{lineHeight:e},children:"Block placeholder"});return(0,t.jsx)(n,{...a,placeholder:s,display:"block","aria-hidden":!0})},r=n},2455(e,a,s){s.d(a,{$q:()=>y,A4:()=>t,U9:()=>h,WW:()=>u,_k:()=>n,a9:()=>r,fP:()=>_,j_:()=>p,jb:()=>m,kM:()=>o,oV:()=>w,ox:()=>c,pU:()=>i,tH:()=>d,uM:()=>l});const t="wc/payments/deposits",n="wc/payments/transactions",o="wc/payments/charges",r="wc/payments/timeline",c="wc/payments/disputes",l="wc/payments/settings",i="wc/payments/readers",m="wc/payments/capital",d="wc/payments/documents",p="wc/payments/paymentIntents",_="wc/payments/authorizations",u="wc/payments/files",y="wc/payments/pmPromotions",h="wc/payments/disputeReadiness",w="wc/payments/reports"}}]);