HEX
Server: Apache
System: Linux webd001.cluster127.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: mciraet (192513)
PHP: 8.2.31
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/mciraet/www/wp-content/plugins/woocommerce-payments/dist/chunks/reports-balance-actions.js
"use strict";(globalThis.webpackChunkwoocommerce_payments=globalThis.webpackChunkwoocommerce_payments||[]).push([[1505],{592(e,t,a){a.d(t,{BalanceActions:()=>b});var n=a(1609),r=a(6427),o=a(7143),s=a(1554),c=a(7723),l=a(2461),i=a(579),u=a(3990),p=a(5377),d=a(8896),m=a(8190),y=a(4848);const _=(e,t,a)=>({currency:t,visible_row_count:a,range_days:(0,m.PM)(e.start,e.end)}),w=e=>e instanceof Error?e.message.slice(0,200):"unknown",b=()=>{const{period:e,hasDateFilterValue:t}=(0,p.yR)(),{createNotice:a}=(0,o.useDispatch)("core/notices"),{summary:b,error:g={},isLoading:h}=(0,i.Np)(t?e:void 0,wcpaySettings.accountDefaultCurrency||""),v=(0,m.xV)(g),f=(0,u.k3)(b),k=(0,m.aO)(f,b),C=(0,m.yF)({summary:b,hasDateFilterValue:t,isLoading:h,hasStoreError:v}),D={start:b.period?.start??e.start,end:b.period?.end??e.end},S=b.currency??"",x=!t||h||v||C||!k,A=(0,n.useId)(),E=t?h?(0,c.__)("Print and Export are available once the Balance report finishes loading.","woocommerce-payments"):v||C?(0,c.__)("Print and Export are unavailable while the Balance report is unavailable.","woocommerce-payments"):k?"":(0,c.__)("Print and Export are unavailable when the selected range has no Balance activity.","woocommerce-payments"):(0,c.__)("Select a date range to enable Print and Export.","woocommerce-payments");return(0,y.jsxs)("div",{className:"wcpay-reports-balance-actions",children:[x&&(0,y.jsx)("span",{id:A,className:"screen-reader-text",children:E}),(0,y.jsx)(r.Button,{variant:"secondary",disabled:x,accessibleWhenDisabled:!0,onClick:()=>{x||((0,l.yM)("wcpay_reports_balance_print_click",_(D,S,f.length)),window.print())},"aria-describedby":x?A:void 0,__next40pxDefaultSize:!0,children:(0,c.__)("Print","woocommerce-payments")}),(0,y.jsx)(r.Button,{variant:"primary",disabled:x,accessibleWhenDisabled:!0,onClick:()=>{if(x)return;const e=_(D,S,f.length);(0,l.yM)("wcpay_reports_balance_export_click",e);try{(0,s.downloadCSVFile)((0,d.Sn)(D),(0,d.hz)({visibleRows:f,summary:b,displayPeriod:D,currency:S})),(0,l.yM)("wcpay_reports_balance_export_success",e)}catch(t){(0,l.yM)("wcpay_reports_balance_export_error",{...e,error_message:w(t)}),console.error("Balance CSV export failed:",t),a("error",(0,c.__)("There was a problem generating your export.","woocommerce-payments"))}},"aria-describedby":x?A:void 0,__next40pxDefaultSize:!0,children:(0,c.__)("Export","woocommerce-payments")})]})}},8896(e,t,a){a.d(t,{Sn:()=>c,WT:()=>i,hz:()=>l});var n=a(1554),r=a(4937),o=a(8190);const s=e=>e.slice(0,10),c=e=>`wcpay-balance-${s(e.start)}_${s(e.end)}.csv`,l=({visibleRows:e,summary:t,displayPeriod:a,currency:r})=>{const c=s(a.start),l=s(a.end),i=(0,o.h8)();return(0,n.generateCSVDataFromTable)([{key:"business_name",label:"business_name"},{key:"woopayments_account_id",label:"woopayments_account_id"},{key:"row_key",label:"row_key"},{key:"label",label:"label"},{key:"amount",label:"amount"},{key:"count",label:"count"},{key:"currency",label:"currency"},{key:"period_start",label:"period_start"},{key:"period_end",label:"period_end"}],e.map(e=>{const n=e.getCount?.(t),s=(0,o.Fe)(e,a);return[{value:i.businessName,display:i.businessName},{value:i.accountId,display:i.accountId},{value:e.key,display:e.key},{value:s,display:s},{value:e.getAmount(t),display:""},{value:n??"",display:""},{value:r,display:r},{value:c,display:c},{value:l,display:l}]}))},i=(e,t)=>{const a=t.toUpperCase(),n=e<0,o=0===e,s=n?-e:e,c=(0,r.$9)(s,a,!0).replace(new RegExp(`\\s*${a}\\s*$`),"").trim();return o?`${a} ${c}`:`${n?"-":"+"}${a} ${c}`}},3990(e,t,a){a.d(t,{Qg:()=>r,k3:()=>u,wG:()=>o});var n=a(7723);const r=e=>e.depth??0,o=(e,t)=>e.displayNegative&&0!==t?-Math.abs(t):t,s=(e,t)=>e[t],c=e=>t=>s(t,e)?.amount??0,l=e=>t=>s(t,e)?.count,i=[{key:"starting_balance",label:(0,n.__)("Starting balance","woocommerce-payments"),alwaysVisible:!0,getAmount:c("starting_balance")},{key:"total_charges_captured",label:(0,n.__)("Total charges captured","woocommerce-payments"),alwaysVisible:!0,getAmount:c("total_charges_captured"),getCount:l("total_charges_captured")},{key:"fees",label:(0,n.__)("Fees","woocommerce-payments"),alwaysVisible:!0,depth:1,getAmount:c("fees")},{key:"charge_fees",label:(0,n.__)("Charge fees","woocommerce-payments"),depth:2,getAmount:c("charge_fees")},{key:"dispute_fees",label:(0,n.__)("Dispute fees","woocommerce-payments"),depth:2,getAmount:c("dispute_fees")},{key:"fee_refunds",label:(0,n.__)("Fee refunds","woocommerce-payments"),depth:2,getAmount:c("fee_refunds")},{key:"refunds",label:(0,n.__)("Refunds","woocommerce-payments"),depth:1,getAmount:c("refunds"),getCount:l("refunds")},{key:"refund_failure",label:(0,n.__)("Refund failures","woocommerce-payments"),depth:1,getAmount:c("refund_failure"),getCount:l("refund_failure")},{key:"disputes",label:(0,n.__)("Disputes","woocommerce-payments"),depth:1,getAmount:c("disputes"),getCount:l("disputes")},{key:"financing_payout",label:(0,n.__)("Financing payout","woocommerce-payments"),depth:1,getAmount:c("financing_payout"),getCount:l("financing_payout")},{key:"financing_paydown",label:(0,n.__)("Financing paydown","woocommerce-payments"),depth:1,getAmount:c("financing_paydown"),getCount:l("financing_paydown")},{key:"payout_fees",label:(0,n.__)("Payout fees","woocommerce-payments"),depth:1,getAmount:c("payout_fees")},{key:"reader_fees",label:(0,n.__)("Reader costs","woocommerce-payments"),depth:1,getAmount:c("reader_fees")},{key:"network_costs",label:(0,n.__)("Network costs","woocommerce-payments"),depth:1,getAmount:c("network_costs"),getCount:l("network_costs")},{key:"other_adjustments",label:(0,n.__)("Other adjustments","woocommerce-payments"),depth:1,getAmount:c("other_adjustments"),getCount:l("other_adjustments")},{key:"net_balance_change_in_the_period",label:(0,n.__)("Net balance change in the period","woocommerce-payments"),alwaysVisible:!0,getAmount:c("net_balance_change_in_the_period")},{key:"payouts",label:(0,n.__)("Payouts","woocommerce-payments"),alwaysVisible:!0,depth:1,displayNegative:!0,getAmount:c("payouts"),getCount:l("payouts")},{key:"ending_balance",label:(0,n.__)("Ending balance","woocommerce-payments"),alwaysVisible:!0,getAmount:c("ending_balance")}],u=e=>i.filter(t=>t.alwaysVisible||0!==t.getAmount(e)||0!==(t.getCount?.(e)??0))},5377(e,t,a){a.d(t,{tb:()=>g,yR:()=>h});var n=a(1609),r=a(6476),o=a(6951),s=a(671),c=a(4380);const l="wcpay-balance-date-filter-change",i=e=>{const[t,a,n]=e.split("-").map(Number);return[t,a,n]},u=e=>{const[t,a,n]=i(e);return new Date(Date.UTC(t,a-1,n,0,0,0,0)).toISOString()},p=e=>{const[t,a,n]=i(e);return new Date(Date.UTC(t,a-1,n,23,59,59,999)).toISOString()},d=e=>[e.getUTCFullYear(),String(e.getUTCMonth()+1).padStart(2,"0"),String(e.getUTCDate()).padStart(2,"0")].join("-"),m=e=>{const[t,a]=i(e);return d(new Date(Date.UTC(t,a-1,1)))},y=e=>d(new Date(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()-1))),_=(e,t)=>e<=t?e:t,w=(e,t)=>_(e,y(t)),b=(e,t)=>{if(e){if("between"===e.operator){const[a,n]=((e,t)=>e<=t?[e,t]:[t,e])(w(e.value[0],t),w(e.value[1],t));return{operator:"between",value:[a,n]}}return"on"===e.operator?{operator:"on",value:w(e.value,t)}:"before"===e.operator?{operator:"before",value:w(e.value,t)}:{operator:"after",value:w(e.value,t)}}},g=(e,t=new Date)=>{const a=b(e,t);if(!a)return(0,s.A)(t);if("on"===a.operator)return{start:u(a.value),end:p(a.value)};if("between"===a.operator)return{start:u(a.value[0]),end:p(a.value[1])};if("before"===a.operator)return{start:u(m(a.value)),end:p(a.value)};const n=_((e=>{const[t,a]=i(e);return d(new Date(Date.UTC(t,a,0)))})(a.value),y(t));return{start:u(a.value),end:p(n)}},h=e=>{const t=(0,n.useContext)(c.W),a=(0,n.useRef)(e??t??new Date).current,i=(0,n.useRef)(!1),[u,p]=(0,n.useState)(0),[d,m]=(0,n.useState)(),y=(0,n.useCallback)(()=>p(e=>e+1),[]),_=(0,n.useCallback)(()=>b((0,o.e)((0,r.getQuery)()),a),[a]),w=(0,n.useCallback)(e=>{m(e.detail),y()},[y]),h=(0,n.useCallback)(()=>{i.current||m(void 0),y()},[y]);(0,n.useEffect)(()=>(window.addEventListener(l,w),window.addEventListener("popstate",h),window.addEventListener("pushstate",h),window.addEventListener("replacestate",h),()=>{window.removeEventListener(l,w),window.removeEventListener("popstate",h),window.removeEventListener("pushstate",h),window.removeEventListener("replacestate",h)}),[h,w]);const v=d?d.value:_()??(e=>{const t=(0,s.A)(e);return{operator:"between",value:[t.start.slice(0,10),t.end.slice(0,10)]}})(a);return{value:v,period:g(v,a),hasDateFilterValue:void 0!==v,setValue:(0,n.useCallback)(e=>{const t=b(e,a);i.current=!0;try{(0,r.updateQueryString)((0,o.K)(t),"/payments/reports")}finally{i.current=!1}window.dispatchEvent(new CustomEvent(l,{detail:{value:t}})),p(e=>e+1)},[a])}}},8190(e,t,a){a.d(t,{Fe:()=>d,PM:()=>c,aO:()=>u,h8:()=>s,xV:()=>l,xi:()=>o,yF:()=>i});var n=a(7723),r=a(7564);const o="wcpay-reports-balance-print-context",s=()=>({businessName:(wcpaySettings.accountStatus?.businessName||wcpaySettings.storeName||"").trim(),accountId:(wcpaySettings.accountStatus?.accountId||"").trim()}),c=(e,t)=>e&&t?Math.round((new Date(t).getTime()-new Date(e).getTime())/864e5):null,l=e=>Object.keys(e??{}).length>0,i=({summary:e,hasDateFilterValue:t,isLoading:a,hasStoreError:n})=>t&&!a&&!n&&!(e=>Boolean(e.currency&&e.period?.start&&e.period?.end))(e),u=(e,t)=>e.some(e=>0!==e.getAmount(t)||0!==(e.getCount?.(t)??0)),p=e=>(0,n.sprintf)((0,n.__)("%s UTC","woocommerce-payments"),(0,r._)(e,{timezone:"UTC"})),d=(e,t)=>"starting_balance"===e.key?(0,n.sprintf)((0,n.__)("Starting balance - %s","woocommerce-payments"),p(t.start)):"ending_balance"===e.key?(0,n.sprintf)((0,n.__)("Ending balance - %s","woocommerce-payments"),p(t.end)):e.label}}]);