@arcblock/payment-service 1.29.7 → 1.29.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cf.d.ts +31 -0
- package/dist/cf.js +79 -60
- package/dist/index.d.ts +17 -0
- package/dist/index.js +264 -73
- package/package.json +4 -4
- package/web/assets/{account-DETfFe4_.js → account-Clbqiiw3.js} +1 -1
- package/web/assets/{action-B_DQJlip.js → action-DENqSeOa.js} +1 -1
- package/web/assets/{actions-BtaoyTWt.js → actions-0iWP2mcx.js} +1 -1
- package/web/assets/{actions-QPa-8lfB.js → actions-BD9BAp3M.js} +1 -1
- package/web/assets/{actions-jxGAdGfb.js → actions-BJDN6Op2.js} +1 -1
- package/web/assets/{actions-DJyfN5OU.js → actions-BSNy5bOd.js} +1 -1
- package/web/assets/{actions-Bt_jST94.js → actions-CDsj5j8l.js} +1 -1
- package/web/assets/{actions-D9MHLBFH.js → actions-CSpJGOX7.js} +1 -1
- package/web/assets/{actions-BknL4OyZ.js → actions-CZL47E9r.js} +1 -1
- package/web/assets/{actions-EPYeS5p4.js → actions-D3tJgrUn.js} +1 -1
- package/web/assets/{actions-BaDh4xWX.js → actions-DGQs8fFF.js} +1 -1
- package/web/assets/{add-price-CD-utowo.js → add-price-BpnICuHO.js} +1 -1
- package/web/assets/{admin-_nEB-lHn.js → admin-CD8ViZ7D.js} +1 -1
- package/web/assets/{assign-CkV5Q2LP.js → assign-0vMUDW_C.js} +1 -1
- package/web/assets/{attempts-DySeqBYU.js → attempts-CKlxkJuE.js} +1 -1
- package/web/assets/browser-DDv4_sgY.js +1 -0
- package/web/assets/{change-payment-CPUCUEER.js → change-payment-gAlRmJpv.js} +1 -1
- package/web/assets/{change-plan-CxE-XfWc.js → change-plan-C47wfWH8.js} +1 -1
- package/web/assets/{click-boundary-y8dVA_tr.js → click-boundary-CafubiPp.js} +1 -1
- package/web/assets/{connect-CC_l_f6Q.js → connect-BHHzrwLA.js} +1 -1
- package/web/assets/{copyable-DpX04wZz.js → copyable-QrCyyiou.js} +1 -1
- package/web/assets/{create-3SsWCAOC.js → create-0PUtkJZY.js} +1 -1
- package/web/assets/{create-BkQAaSvD.js → create-BJ1asdcy.js} +1 -1
- package/web/assets/{create-kG09X9gl.js → create-Bgv5ux17.js} +1 -1
- package/web/assets/{create-BmcRybZ5.js → create-C7GOgZZM.js} +1 -1
- package/web/assets/{create-tYebjhr9.js → create-DNar5UQD.js} +1 -1
- package/web/assets/{create-Bs65p5Ne.js → create-ke4FrPx1.js} +1 -1
- package/web/assets/{credit-grant-item-list-Bk27jIc7.js → credit-grant-item-list-CeDAM3qV.js} +1 -1
- package/web/assets/{credit-overview-DmMSEs14.js → credit-overview-4zh0H02x.js} +2 -2
- package/web/assets/{currency-restrictions-DYLv4YyW.js → currency-restrictions-BcEm8W45.js} +1 -1
- package/web/assets/{currency-select-DGS-62-L.js → currency-select-B4ieQBvv.js} +1 -1
- package/web/assets/{dayjs-B9tvQIKg.js → dayjs-DUTDpcNU.js} +1 -1
- package/web/assets/{description-Ym17DL48.js → description-SnR5WxWT.js} +1 -1
- package/web/assets/detail-46aLUdJj.js +1 -0
- package/web/assets/{detail-Cr2wG4Th.js → detail-B-ceWfZr.js} +1 -1
- package/web/assets/detail-B0IHl4MI.js +1 -0
- package/web/assets/detail-B8eOBVSQ.js +15 -0
- package/web/assets/{detail-DE3OOC5M.js → detail-BO3zglCn.js} +1 -1
- package/web/assets/{detail-DG4l2CqN.js → detail-BQpDGZJQ.js} +1 -1
- package/web/assets/{detail-CxYQYu_l.js → detail-BXTsnQny.js} +1 -1
- package/web/assets/{detail-CT9Unyrf.js → detail-B_lpOomD.js} +1 -1
- package/web/assets/{detail-Do9QO5L2.js → detail-Bfnkg0A1.js} +1 -1
- package/web/assets/detail-BwH0DwAi.js +1 -0
- package/web/assets/{detail-OZeeKI69.js → detail-C1FupF1D.js} +2 -2
- package/web/assets/{detail-cwHZbY62.js → detail-CMBRd4Ct.js} +1 -1
- package/web/assets/detail-C_Zdfa0y.js +1 -0
- package/web/assets/{detail-Cb9HBSMw.js → detail-Cg505nKX.js} +1 -1
- package/web/assets/{detail-DB56SG-k.js → detail-CsGZMimg.js} +1 -1
- package/web/assets/{detail-K9EVY3r2.js → detail-Ct5QNBqu.js} +1 -1
- package/web/assets/{detail-DuO_Jn5X.js → detail-CyMhK5K_.js} +1 -1
- package/web/assets/{detail-DuWdZIyp.js → detail-DACnmls3.js} +1 -1
- package/web/assets/{detail-BJTcK7mx.js → detail-DCTb8R7F.js} +1 -1
- package/web/assets/{detail-DPCTQLOx.js → detail-DNcp_u5S.js} +1 -1
- package/web/assets/detail-DbU3p040.js +1 -0
- package/web/assets/{detail-D5KRrQDx.js → detail-Tn2R5C8i.js} +1 -1
- package/web/assets/{detail-15zxCbV9.js → detail-wU4wNf4s.js} +1 -1
- package/web/assets/{drawer-form-Cl0T1Yyt.js → drawer-form-DspWWj3x.js} +1 -1
- package/web/assets/{edit-3HUAnaXW.js → edit-Bkj-OTJh.js} +1 -1
- package/web/assets/{editor-BF5I0siU.js → editor-AmthipP2.js} +1 -1
- package/web/assets/{embed-CsNqeCd0.js → embed-rRKjDoHi.js} +1 -1
- package/web/assets/{filter-toolbar-BydfQ-79.js → filter-toolbar-DXGSTq57.js} +1 -1
- package/web/assets/{form-DSzMo9UD.js → form-B5WW-lS5.js} +1 -1
- package/web/assets/form-BmQlJZ84.js +9 -0
- package/web/assets/{form-BGm5NPDn.js → form-CAPjlw7l.js} +1 -1
- package/web/assets/{form-CKfKLGXP.js → form-DD-EiA7W.js} +3 -3
- package/web/assets/{form-P4luyUpY.js → form-cX026J4G.js} +1 -1
- package/web/assets/{gas-Qf0SSUfS.js → gas-nyR96dB0.js} +1 -1
- package/web/assets/{generateCategoricalChart-BaWwaXky.js → generateCategoricalChart-BadryV3H.js} +1 -1
- package/web/assets/{home-HbrLyxJL.js → home-_eX1aim8.js} +1 -1
- package/web/assets/index-BBHMsIxJ.js +1 -0
- package/web/assets/{index-Dr_MwbKt.js → index-BQjlhCSt.js} +1 -1
- package/web/assets/{index-DPodCQ9c.js → index-BRENdB5m.js} +1 -1
- package/web/assets/{index-9xBRL_33.js → index-BTfJ08JU.js} +1 -1
- package/web/assets/{index-DgSc1Qy8.js → index-BarN7DfU.js} +17 -17
- package/web/assets/index-BhcoukR2.js +1 -0
- package/web/assets/index-BturOfxo.js +1 -0
- package/web/assets/{index-SYTpMMMH.js → index-BzABukCz.js} +1 -1
- package/web/assets/{index-2l22EYw9.js → index-C-RT84yb.js} +1 -1
- package/web/assets/{index-C0JaS08f.js → index-C136x0O2.js} +1 -1
- package/web/assets/{index-Cw0ugaQL.js → index-CCVDDX0c.js} +1 -1
- package/web/assets/index-CDVogp6E.js +1 -0
- package/web/assets/{index-Br7_mvEw.js → index-CW8VfoJO.js} +1 -1
- package/web/assets/{index-BIoSdRvX.js → index-CbSXdD6E.js} +3 -3
- package/web/assets/{index-CdkYrABk.js → index-Cd_BD9TM.js} +1 -1
- package/web/assets/index-D-bx9Kam.js +1 -0
- package/web/assets/index-D0mynT6_.js +1 -0
- package/web/assets/index-DEiuhiEo.js +14 -0
- package/web/assets/{index-DE2KzqXl.js → index-DNGmCIRP.js} +1 -1
- package/web/assets/{index-CI_EY4YS.js → index-DSe7Dot_.js} +1 -1
- package/web/assets/{index-BFML4-2u.js → index-DcddP3R9.js} +1 -1
- package/web/assets/index-DcrGSDby.js +1 -0
- package/web/assets/{index-fByZjxLy.js → index-DeK5Pqjv.js} +1 -1
- package/web/assets/{index-Clbt8nRm.js → index-DoX0A-rP.js} +1 -1
- package/web/assets/index-Du0Ieh1F.js +49 -0
- package/web/assets/index-Dybqd298.js +1 -0
- package/web/assets/index-EXZPddtw.js +1 -0
- package/web/assets/{index-Drav4oDH.js → index-Kd_qCyRG.js} +2 -2
- package/web/assets/{index-Dc954mDP.js → index-SOzRg0yJ.js} +1 -1
- package/web/assets/{index-BMKZToMM.js → index-UYeD8rTJ.js} +2 -2
- package/web/assets/{index-DZpJPE1Z.js → index-W2uZUlFs.js} +1 -1
- package/web/assets/{index-1y9kjPIr.js → index-XaFn2ySq.js} +1 -1
- package/web/assets/{index-fswPX_qe.js → index-YG5oc8O3.js} +1 -1
- package/web/assets/{index-B1pTTyGZ.js → index-ajD9Iotk.js} +1 -1
- package/web/assets/index-brUCsnBA.js +1 -0
- package/web/assets/{index-BP53rZV9.js → index-mn5Zdrtn.js} +1 -1
- package/web/assets/index-qulrJQ4J.js +1 -0
- package/web/assets/{index.es-BWnfUzLb.js → index.es-C8dcCHdW.js} +1 -1
- package/web/assets/{info-card-C1yxhxJG.js → info-card-BvIMFQo5.js} +1 -1
- package/web/assets/{info-metric-CNse3r66.js → info-metric-Dl4ZDm0Z.js} +1 -1
- package/web/assets/{info-row-group-BeUhWnnY.js → info-row-group-CFuMWJf1.js} +1 -1
- package/web/assets/{info-row-DOK2whMn.js → info-row-jI0h_hv4.js} +1 -1
- package/web/assets/{libphonenumber-CyphiuxQ.js → libphonenumber-Qs8PCdM-.js} +1 -1
- package/web/assets/{link-3eeclTeS.js → link-CmPoIweR.js} +1 -1
- package/web/assets/{list-DnePqZ2K.js → list-BdSkPjIa.js} +1 -1
- package/web/assets/{list-jHj_5yy3.js → list-CWMEf-_C.js} +1 -1
- package/web/assets/{list-C521zE_7.js → list-CkHExntK.js} +1 -1
- package/web/assets/{list-CO0X4L3-.js → list-DLB_hd0Q.js} +1 -1
- package/web/assets/{list-D-I0msRW.js → list-DVFJwd_I.js} +2 -2
- package/web/assets/{list-D1aevUOI.js → list-DaK9287Y.js} +2 -2
- package/web/assets/{list-1OG83xc4.js → list-DghnUOc4.js} +1 -1
- package/web/assets/{list-CNmzJKIQ.js → list-eFkvVlp5.js} +1 -1
- package/web/assets/metadata-BmQTVFku.js +55 -0
- package/web/assets/{meter-event-lmNMgmIu.js → meter-event-B1JIhVpb.js} +1 -1
- package/web/assets/{metrics-C7U41HWk.js → metrics-UvxyQbUF.js} +1 -1
- package/web/assets/{overview-Cs3-8n4e.js → overview-Cxc6WKba.js} +1 -1
- package/web/assets/{overview-CH1HnSP-.js → overview-DrMaIptb.js} +1 -1
- package/web/assets/{past-due-CGGRZmXY.js → past-due-CUXkxns0.js} +1 -1
- package/web/assets/pay-omLYkqRA.js +4 -0
- package/web/assets/{payment-method-info-BsOBbA3m.js → payment-method-info-Bsf89VxV.js} +2 -2
- package/web/assets/{preview-DjYRpRA8.js → preview-BifsgUGT.js} +1 -1
- package/web/assets/{preview-CjYh9dTg.js → preview-C-H8pGVw.js} +1 -1
- package/web/assets/{pricing-table-C3Lkhq46.js → pricing-table-B3QOaAB5.js} +2 -2
- package/web/assets/{pricing-table-edE6TJGX.js → pricing-table-BUJdtkMq.js} +1 -1
- package/web/assets/{product-select-0ScZE2e8.js → product-select-ChEyoJqJ.js} +1 -1
- package/web/assets/{recharge-DcPtT8vt.js → recharge-BVT4USAO.js} +1 -1
- package/web/assets/{related-credit-grants-BygNGPfb.js → related-credit-grants-JV2ICsR5.js} +22 -22
- package/web/assets/{safe-did-address-B0fFbUph.js → safe-did-address-CiG_V6Gy.js} +1 -1
- package/web/assets/{source-data-viewer-By_Utay-.js → source-data-viewer-i1q9wNIG.js} +1 -1
- package/web/assets/{status-l6pD08fw.js → status-CUVYrUIG.js} +1 -1
- package/web/assets/subscription-BYz_k9dq.js +1 -0
- package/web/assets/{subscription-Dq22e3D1.js → subscription-DrnSPIfs.js} +1 -1
- package/web/assets/table-BrtHemkA.js +1 -0
- package/web/assets/{tax-code-select-CWhIIiXi.js → tax-code-select-TS07I0rB.js} +1 -1
- package/web/assets/{tax-utils-DqNX34-r.js → tax-utils-bPjALcVG.js} +1 -1
- package/web/assets/{uploader-DRXDz_r0.js → uploader-CsQNHG4I.js} +1 -1
- package/web/assets/{usage-records-jjJMZ6DI.js → usage-records-DAUQMJAW.js} +1 -1
- package/web/assets/{util-mDHAL0lx.js → util-DxXTXkeY.js} +1 -1
- package/web/assets/{vendor-arcblock-ChFCRdyx.js → vendor-arcblock-BTCAQSUK.js} +1 -1
- package/web/assets/{vendor-blocklet-D_i_QeSo.js → vendor-blocklet-DcLR2Cyf.js} +43 -43
- package/web/index.html +1 -1
- package/web/assets/browser-DSLTxXlL.js +0 -1
- package/web/assets/detail-ASPdMJoW.js +0 -1
- package/web/assets/detail-CIx9vkir.js +0 -1
- package/web/assets/detail-D5NbV29V.js +0 -1
- package/web/assets/detail-DVVzYhdV.js +0 -1
- package/web/assets/detail-Dqc0OfCQ.js +0 -1
- package/web/assets/detail-uhlID8jD.js +0 -15
- package/web/assets/form-BXAuSawq.js +0 -9
- package/web/assets/index-0HK7CYm4.js +0 -1
- package/web/assets/index-BJ_E6bEO.js +0 -1
- package/web/assets/index-Bnyh4rlV.js +0 -1
- package/web/assets/index-BoQ7wf3O.js +0 -1
- package/web/assets/index-C68x-aau.js +0 -1
- package/web/assets/index-C8s2QKoe.js +0 -1
- package/web/assets/index-Cn7O-OP7.js +0 -49
- package/web/assets/index-DU39aG5u.js +0 -1
- package/web/assets/index-DtbqgSK4.js +0 -1
- package/web/assets/index-DuRu9NWB.js +0 -14
- package/web/assets/index-WMKOiUez.js +0 -1
- package/web/assets/index-dmHgoplS.js +0 -1
- package/web/assets/index-txVTkoDD.js +0 -1
- package/web/assets/metadata-CMSHcSXi.js +0 -55
- package/web/assets/pay-CSpHBUh_.js +0 -4
- package/web/assets/subscription-DcwhSOpa.js +0 -1
- package/web/assets/table-BRU4Enia.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as x,j as s,w,q as b,N as B}from"./vendor-mui-BXZut9Pz.js";import{V as z}from"./vendor-blocklet-
|
|
1
|
+
import{r as x,j as s,w,q as b,N as B}from"./vendor-mui-BXZut9Pz.js";import{V as z}from"./vendor-blocklet-DcLR2Cyf.js";import{i as P,n as j,o as T,j as S,T as q,e as E}from"./index-BarN7DfU.js";import{b as k,L as c}from"./vendor-react-BPknnnEA.js";import{u as v}from"./table-BrtHemkA.js";import{l as L}from"./lodash-B4Ozcv0x.js";import{C as A}from"./link-CmPoIweR.js";import{F as M}from"./filter-toolbar-DXGSTq57.js";import{R as D}from"./actions-0iWP2mcx.js";import{u as K}from"./cache-state-lld4zuDg.js";const N=(o={})=>{const p=new URLSearchParams;return Object.keys(o).forEach(m=>{let f=o[m];m==="q"&&(f=Object.entries(f).map(d=>d.join(":")).join(" ")),p.set(m,String(f))}),E.get(`/api/refunds?${p.toString()}`).then(m=>m.data)},F=o=>o.customer_id?`customer-refunds-${o.customer_id}`:o.invoice_id?`invoice-refunds-${o.invoice_id}`:o.subscription_id?`subscription-refunds-${o.subscription_id}`:o.payment_intent_id?`payment-intent-refunds-${o.payment_intent_id}`:"refunds";function Y({customer_id:o="",invoice_id:p="",subscription_id:m="",status:f="",features:d={customer:!0,filter:!0},payment_intent_id:h=""}){const{t:i}=z(),[u]=k(),y=F({customer_id:o,invoice_id:p,subscription_id:m,payment_intent_id:h}),R=v(20),[r,l]=K(y,{defaultValue:{status:f,customer_id:o,invoice_id:p,subscription_id:m,payment_intent_id:h,pageSize:R,page:1},getUrlParams:()=>{const t={};return u.has("status")&&(t.status=u.get("status")),u.has("currency_id")&&(t.currency_id=u.get("currency_id")),u.has("customer_id")&&(t.customer_id=u.get("customer_id")),t}}),[a,$]=x.useState({}),g=()=>N(r).then(t=>{$(t)});if(x.useEffect(()=>{g()},[r]),!a.list)return s.jsx(w,{});const _=[{label:i("common.amount"),name:"id",align:"right",width:80,options:{customBodyRenderLite:(t,n)=>{const e=a.list[n];return s.jsx(c,{to:`/admin/payments/${e.id}`,children:s.jsxs(b,{component:"strong",sx:{fontWeight:600},children:[P(e?.amount,e?.paymentCurrency.decimal)," ",e?.paymentCurrency.symbol]})})}}},{label:i("common.paymentMethod"),name:"paymentMethod",width:120,options:{customBodyRenderLite:(t,n)=>{const e=a.list[n];return s.jsx(c,{to:`/admin/payments/${e.id}`,children:s.jsxs(b,{sx:{display:"flex",alignItems:"center",whiteSpace:"nowrap"},children:[s.jsx(B,{src:e.paymentMethod.logo,sx:{width:18,height:18,mr:1}}),e.paymentMethod.name]})})}}},{label:i("common.status"),name:"status",width:80,options:{filter:!0,customBodyRenderLite:(t,n)=>{const e=a.list[n];return s.jsx(c,{to:`/admin/payments/${e.id}`,children:s.jsx(j,{label:e.status,color:T(e.status)})})}}},{label:i("common.type"),name:"type",width:80,options:{filter:!0,customBodyRenderLite:(t,n)=>{const e=a.list[n];return s.jsx(c,{to:`/admin/payments/${e.id}`,children:s.jsx(j,{label:i(`refund.type.${e.type}`)})})}}},{label:i("common.description"),name:"description",options:{customBodyRenderLite:(t,n)=>{const e=a.list[n];return s.jsx(c,{to:`/admin/payments/${e.id}`,children:e.description?L.capitalize(L.toLower(e.description.replace(/_/g," "))):e.id})}}},{label:i("common.createdAt"),name:"created_at",options:{sort:!0,customBodyRenderLite:(t,n)=>{const e=a.list[n];return s.jsx(c,{to:`/admin/payments/${e.id}`,children:S(e.created_at)})}}},{label:i("common.updatedAt"),name:"updated_at",options:{sort:!0,customBodyRenderLite:(t,n)=>{const e=a.list[n];return s.jsx(c,{to:`/admin/payments/${e.id}`,children:S(e.updated_at)})}}},{label:i("common.actions"),name:"",options:{customBodyRenderLite:(t,n)=>{const e=a.list[n];return s.jsx(D,{data:e,onChange:()=>g()})}}}];d?.customer&&_.splice(3,0,{label:i("common.customer"),name:"customer_id",options:{customBodyRenderLite:(t,n)=>{const e=a.list[n];return s.jsx(A,{customer:e.customer})}}});const C=({page:t,rowsPerPage:n})=>{r.pageSize!==n?l(e=>({...e,pageSize:n,page:1})):r.page!==t+1&&l(e=>({...e,page:t+1}))};return s.jsx(q,{hasRowLink:!0,data:a.list,durable:`__${y}__`,durableKeys:["searchText"],columns:_,loading:!a.list,onChange:C,options:{count:a.count,page:r.page-1,rowsPerPage:r.pageSize,onColumnSortChange(t,n){l({...r,q:r.q||{},o:n})},onSearchChange:t=>{l(t?{...r,q:{"like-description":t,"like-metadata":t},pageSize:100,page:1}:{...r,pageSize:100,page:1,q:{}})}},toolbar:d?.toolbar,footer:d?.footer,title:d?.filter&&s.jsx(M,{setSearch:l,search:r,status:["succeeded","canceled","failed","requires_action","pending"],currency:!0}),emptyNodeText:i("empty.refunds")})}export{Y as R};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as g,j as e,B as x,x as T,o as $,bp as B,aJ as I,ad as R,a2 as N,aG as P,aH as M,s as O,q as S,O as D}from"./vendor-mui-BXZut9Pz.js";import{V as w,
|
|
1
|
+
import{r as g,j as e,B as x,x as T,o as $,bp as B,aJ as I,ad as R,a2 as N,aG as P,aH as M,s as O,q as S,O as D}from"./vendor-mui-BXZut9Pz.js";import{V as w,cv as E,O as U,P as F,bQ as W}from"./vendor-blocklet-DcLR2Cyf.js";import{aa as _,ab as z,ac as k,b9 as L,n as H,j as K,T as V,e as G}from"./index-BarN7DfU.js";import{C as J}from"./copyable-QrCyyiou.js";import{g as Q,a as Y,T as X}from"./tax-utils-bPjALcVG.js";import{a as Z}from"./vendor-react-BPknnnEA.js";import"./click-boundary-CafubiPp.js";import"./actions-BJDN6Op2.js";import"./drawer-form-DspWWj3x.js";import"./index-CW8VfoJO.js";import"./collapse-CSrlJ0eG.js";import"./form-CAPjlw7l.js";import"./lodash-B4Ozcv0x.js";import"./util-DxXTXkeY.js";import"./tax-code-select-TS07I0rB.js";import"./collapse-BvbJGg1V.js";const ee=O(x)`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 12px;
|
|
@@ -32,4 +32,4 @@ import{r as g,j as e,B as x,x as T,o as $,bp as B,aJ as I,ad as R,a2 as N,aG as
|
|
|
32
32
|
color: ${({theme:n})=>n.palette.primary.main};
|
|
33
33
|
padding-left: 4px;
|
|
34
34
|
}
|
|
35
|
-
`;function te({search:n={},onFilterChange:c}){const{t:o}=w(),[d,r]=g.useState(null),[f,h]=g.useState(null),[y,p]=g.useState(""),j=g.useMemo(()=>n?.active?n.active==="active"?o("common.active"):n.active==="inactive"?o("common.inactive"):"":"",[n?.active,o]),l=g.useMemo(()=>{const i=y.trim().toLowerCase();return i?_.map(m=>z(m)).filter(m=>m.name.toLowerCase().includes(i)||m.iso2.toLowerCase().includes(i)||`+${m.dialCode}`.includes(i)):_.map(m=>z(m))},[y]),v=g.useMemo(()=>{if(!n?.country)return null;const i=_.find(m=>m[1]===n.country);return i?z(i):{iso2:n.country.toLowerCase(),name:n.country.toUpperCase(),dialCode:""}},[n?.country]),C=()=>{p(""),h(null)};return e.jsx(ee,{children:e.jsxs(x,{className:"filters",children:[e.jsxs(T,{className:"filter-trigger",variant:"text",onClick:i=>r(i.currentTarget),children:[n?.active?e.jsx($,{sx:{fontSize:18,mr:1},onClick:i=>{i.stopPropagation(),c("active","")}}):e.jsx(B,{sx:{fontSize:18,mr:1}}),o("common.status"),j&&e.jsx("span",{children:j})]}),e.jsxs(I,{anchorEl:d,open:!!d,onClose:()=>r(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:[e.jsx(R,{onClick:()=>{c("active","active"),r(null)},children:o("common.active")}),e.jsx(R,{onClick:()=>{c("active","inactive"),r(null)},children:o("common.inactive")})]}),e.jsxs(T,{className:"filter-trigger",variant:"text",onClick:i=>{p(""),h(i.currentTarget)},children:[n?.country?e.jsx($,{sx:{fontSize:18,mr:1},onClick:i=>{i.stopPropagation(),c("country","")}}):e.jsx(B,{sx:{fontSize:18,mr:1}}),o("admin.taxRate.country"),v&&e.jsxs(x,{sx:{display:"inline-flex",alignItems:"center",gap:.75,ml:.5,color:"primary.main"},children:[e.jsx(k,{iso2:v.iso2,style:{fontSize:16}}),v.name]})]}),e.jsx(I,{anchorEl:f,open:!!f,onClose:()=>C(),anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:e.jsxs(x,{sx:{p:2,display:"flex",flexDirection:"column",gap:1.5},children:[e.jsx(N,{size:"small",placeholder:o("admin.taxRate.searchCountry"),value:y,onChange:i=>p(i.target.value),autoFocus:!0}),e.jsxs(x,{sx:{maxHeight:260,overflowY:"auto",border:"1px solid",borderColor:"divider",borderRadius:1},children:[l.map(i=>e.jsxs(R,{selected:i.iso2===n?.country,onClick:()=>{c("country",i.iso2),C()},children:[e.jsx(P,{sx:{minWidth:32,fontSize:18,color:"text.secondary"},children:e.jsx(k,{iso2:i.iso2})}),e.jsx(M,{primary:i.name})]},i.iso2)),!l.length&&e.jsx(x,{sx:{py:1.5,px:2,fontSize:14,color:"text.secondary"},children:o("common.noData")})]})]})})]})})}const ae=(n={})=>{const c=new URLSearchParams;return Object.keys(n).forEach(o=>{const d=n[o];if(!(d==null||d==="")){if(o==="q"&&d){c.set("q",d);return}c.set(o,String(d))}}),G.get(`/api/tax-rates?${c.toString()}`).then(o=>o.data)};function ve(){const n="tax-rates",c=E(n),{t:o}=w(),d=Z(),[r,f]=U(n,{defaultValue:{page:c.page?c.page+1:1,pageSize:c.rowsPerPage||20,active:"",country:"",q:""}}),h=g.useMemo(()=>{const s={page:r?.page,pageSize:r?.pageSize,sort:"-createdAt"};if(r?.active&&(s.active=r.active==="active"),r?.country&&(s.country=r.country),r?.q){const t=encodeURIComponent(r.q),a=[`like-display_name:${t}`,`like-description:${t}`,`like-state:${t}`,`like-postal_code:${t}`,`like-tax_code:${t}`,`like-country:${t}`,`like-percentage:${t}`];s.q=a.join(" ")}return s},[r]),{data:y={list:[],count:0},refresh:p,loading:j}=F(()=>ae(h),{refreshDeps:[h]});L("tax-rate.created",()=>p(),[]),L("tax-rate.updated",()=>p(),[]),L("tax-rate.deleted",()=>p(),[]),W(()=>{p()},[r?.page,r?.pageSize]);const l=y.list||[],{locale:v}=w(),C=[{label:o("common.id"),name:"id",options:{filter:!1,customBodyRenderLite:(s,t)=>{const a=l[t];return e.jsx(J,{text:a.id,style:{fontSize:"0.875rem"}})}}},{label:o("admin.taxRate.displayName"),name:"display_name",options:{filter:!1,customBodyRenderLite:(s,t)=>{const a=l[t];return e.jsx(T,{variant:"text",sx:{p:0,minWidth:"unset",textTransform:"none",textAlign:"left"},onClick:()=>d(`/admin/tax/${a.id}`),children:a.display_name})}}},{label:o("admin.taxRate.location"),name:"location",options:{filter:!1,customBodyRenderLite:(s,t)=>{const a=l[t];if(!a.country)return"—";const u=
|
|
35
|
+
`;function te({search:n={},onFilterChange:c}){const{t:o}=w(),[d,r]=g.useState(null),[f,h]=g.useState(null),[y,p]=g.useState(""),j=g.useMemo(()=>n?.active?n.active==="active"?o("common.active"):n.active==="inactive"?o("common.inactive"):"":"",[n?.active,o]),l=g.useMemo(()=>{const i=y.trim().toLowerCase();return i?_.map(m=>z(m)).filter(m=>m.name.toLowerCase().includes(i)||m.iso2.toLowerCase().includes(i)||`+${m.dialCode}`.includes(i)):_.map(m=>z(m))},[y]),v=g.useMemo(()=>{if(!n?.country)return null;const i=_.find(m=>m[1]===n.country);return i?z(i):{iso2:n.country.toLowerCase(),name:n.country.toUpperCase(),dialCode:""}},[n?.country]),C=()=>{p(""),h(null)};return e.jsx(ee,{children:e.jsxs(x,{className:"filters",children:[e.jsxs(T,{className:"filter-trigger",variant:"text",onClick:i=>r(i.currentTarget),children:[n?.active?e.jsx($,{sx:{fontSize:18,mr:1},onClick:i=>{i.stopPropagation(),c("active","")}}):e.jsx(B,{sx:{fontSize:18,mr:1}}),o("common.status"),j&&e.jsx("span",{children:j})]}),e.jsxs(I,{anchorEl:d,open:!!d,onClose:()=>r(null),anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:[e.jsx(R,{onClick:()=>{c("active","active"),r(null)},children:o("common.active")}),e.jsx(R,{onClick:()=>{c("active","inactive"),r(null)},children:o("common.inactive")})]}),e.jsxs(T,{className:"filter-trigger",variant:"text",onClick:i=>{p(""),h(i.currentTarget)},children:[n?.country?e.jsx($,{sx:{fontSize:18,mr:1},onClick:i=>{i.stopPropagation(),c("country","")}}):e.jsx(B,{sx:{fontSize:18,mr:1}}),o("admin.taxRate.country"),v&&e.jsxs(x,{sx:{display:"inline-flex",alignItems:"center",gap:.75,ml:.5,color:"primary.main"},children:[e.jsx(k,{iso2:v.iso2,style:{fontSize:16}}),v.name]})]}),e.jsx(I,{anchorEl:f,open:!!f,onClose:()=>C(),anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:e.jsxs(x,{sx:{p:2,display:"flex",flexDirection:"column",gap:1.5},children:[e.jsx(N,{size:"small",placeholder:o("admin.taxRate.searchCountry"),value:y,onChange:i=>p(i.target.value),autoFocus:!0}),e.jsxs(x,{sx:{maxHeight:260,overflowY:"auto",border:"1px solid",borderColor:"divider",borderRadius:1},children:[l.map(i=>e.jsxs(R,{selected:i.iso2===n?.country,onClick:()=>{c("country",i.iso2),C()},children:[e.jsx(P,{sx:{minWidth:32,fontSize:18,color:"text.secondary"},children:e.jsx(k,{iso2:i.iso2})}),e.jsx(M,{primary:i.name})]},i.iso2)),!l.length&&e.jsx(x,{sx:{py:1.5,px:2,fontSize:14,color:"text.secondary"},children:o("common.noData")})]})]})})]})})}const ae=(n={})=>{const c=new URLSearchParams;return Object.keys(n).forEach(o=>{const d=n[o];if(!(d==null||d==="")){if(o==="q"&&d){c.set("q",d);return}c.set(o,String(d))}}),G.get(`/api/tax-rates?${c.toString()}`).then(o=>o.data)};function ve(){const n="tax-rates",c=E(n),{t:o}=w(),d=Z(),[r,f]=U(n,{defaultValue:{page:c.page?c.page+1:1,pageSize:c.rowsPerPage||20,active:"",country:"",q:""}}),h=g.useMemo(()=>{const s={page:r?.page,pageSize:r?.pageSize,sort:"-createdAt"};if(r?.active&&(s.active=r.active==="active"),r?.country&&(s.country=r.country),r?.q){const t=encodeURIComponent(r.q),a=[`like-display_name:${t}`,`like-description:${t}`,`like-state:${t}`,`like-postal_code:${t}`,`like-tax_code:${t}`,`like-country:${t}`,`like-percentage:${t}`];s.q=a.join(" ")}return s},[r]),{data:y={list:[],count:0},refresh:p,loading:j}=F(()=>ae(h),{refreshDeps:[h]});L("tax-rate.created",()=>p(),[]),L("tax-rate.updated",()=>p(),[]),L("tax-rate.deleted",()=>p(),[]),W(()=>{p()},[r?.page,r?.pageSize]);const l=y.list||[],{locale:v}=w(),C=[{label:o("common.id"),name:"id",options:{filter:!1,customBodyRenderLite:(s,t)=>{const a=l[t];return e.jsx(J,{text:a.id,style:{fontSize:"0.875rem"}})}}},{label:o("admin.taxRate.displayName"),name:"display_name",options:{filter:!1,customBodyRenderLite:(s,t)=>{const a=l[t];return e.jsx(T,{variant:"text",sx:{p:0,minWidth:"unset",textTransform:"none",textAlign:"left"},onClick:()=>d(`/admin/tax/${a.id}`),children:a.display_name})}}},{label:o("admin.taxRate.location"),name:"location",options:{filter:!1,customBodyRenderLite:(s,t)=>{const a=l[t];if(!a.country)return"—";const u=Q(a.country),b=[];return a.state&&b.push(a.state),a.postal_code&&b.push(a.postal_code),e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(k,{iso2:a.country.toLowerCase(),style:{width:24}}),e.jsxs(S,{variant:"body2",children:[u?.name,b.length>0&&` · ${b.join(" · ")}`]})]})}}},{label:o("admin.taxRate.percentage"),name:"percentage",options:{filter:!1,customBodyRenderLite:(s,t)=>`${l[t].percentage}%`}},{label:o("admin.taxRate.taxCode"),name:"tax_code",options:{filter:!1,customBodyRenderLite:(s,t)=>{const a=l[t];if(!a.tax_code)return"—";const u=Y(a.tax_code,v);return u?e.jsx(D,{title:u.description,arrow:!0,children:e.jsxs(x,{children:[e.jsx(S,{variant:"body2",sx:{fontWeight:500},children:u.name}),e.jsx(S,{variant:"caption",sx:{color:"text.secondary"},children:u.id})]})}):a.tax_code}}},{label:o("admin.taxRate.relatedInvoiceNum"),name:"invoice_count",options:{filter:!1,customBodyRenderLite:(s,t)=>{const a=l[t],u=Number(a.invoice_count)||0;return e.jsx(S,{variant:"body2",sx:{color:u>0?"text.primary":"text.secondary"},children:u>0?u:o("admin.taxRate.notUsed")})}}},{label:o("common.status"),name:"active",options:{filter:!1,customBodyRenderLite:(s,t)=>{const a=l[t];return e.jsx(H,{label:a.active?o("common.active"):o("common.inactive"),color:a.active?"success":"default"})}}},{label:o("common.createdAt"),name:"created_at",options:{filter:!1,customBodyRenderLite:(s,t)=>{const a=l[t];return K(a.created_at)}}},{label:o("common.actions"),name:"actions",width:80,options:{sort:!1,filter:!1,customBodyRenderLite:(s,t)=>{const a=l[t];return e.jsx(X,{data:a,onChange:()=>p()})}}}],i=({page:s,rowsPerPage:t})=>{r.pageSize!==t?f(a=>({...a||{},page:1,pageSize:t})):r.page!==s+1&&f(a=>({...a||{},page:s+1}))},m=s=>{f(t=>({...t||{},q:s,page:1}))},q=(s,t)=>{f(a=>({...a||{},[s]:t,page:1}))},A=e.jsx(te,{search:r,onFilterChange:(s,t)=>q(s,t)});return e.jsx(V,{hasRowLink:!1,durable:`__${n}__`,durableKeys:["page","rowsPerPage","searchText"],title:A,data:l,columns:C,loading:j,options:{count:y.count,page:(r?.page||1)-1,rowsPerPage:r?.pageSize||20,onSearchChange:m},onChange:i,mobileTDFlexDirection:"row"})}export{ve as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{r as b,j as d,A as T,w as g,q as f,bf as D,B as I}from"./vendor-mui-BXZut9Pz.js";import{
|
|
1
|
+
import{r as b,j as d,A as T,w as g,q as f,bf as D,B as I}from"./vendor-mui-BXZut9Pz.js";import{cv as k,V as x,P as S,F as A}from"./vendor-blocklet-DcLR2Cyf.js";import{b as P,j as R,T as z,l as E,e as L}from"./index-BarN7DfU.js";import{u as B}from"./table-BrtHemkA.js";const C=(e={})=>{const n=new URLSearchParams;return Object.keys(e).forEach(a=>{n.set(a,String(e[a]))}),L.get(`/api/events?${n.toString()}`).then(a=>a.data)},q=e=>e.type?`events-${e.type}`:e.object_id?`events-${e.object_id}`:"events",K=e=>{switch(e.type){case"product.created":return`A new product ${e.object_id} was created`;case"product.updated":return`The product with ID ${e.object_id} was updated`;case"product.deleted":return`The product with ID ${e.object_id} was deleted`;case"price.created":return`A new price ${e.object_id} was created`;case"price.updated":return`The price with ID ${e.object_id} was updated`;case"price.deleted":return`The price with ID ${e.object_id} was deleted`;case"payment_link.created":return`A new payment link ${e.object_id} was created`;case"payment_link.updated":return`The payment link with ID ${e.object_id} was updated`;case"payment_link.deleted":return`The payment link with ID ${e.object_id} was deleted`;case"payment_intent.created":return`A new payment intent ${e.object_id} was created`;case"payment_intent.updated":return`The payment intent with ID ${e.object_id} was updated`;case"payment_intent.canceled":return`The payment intent with ID ${e.object_id} was canceled`;case"payment_intent.succeeded":return`The payment intent with ID ${e.object_id} succeeded`;case"payment_intent.processing":return`The payment intent with ID ${e.object_id} is processing`;case"payment_intent.requires_action":return`The payment intent with ID ${e.object_id} requires user action`;case"payment_intent.payment_failed":return`The payment intent with ID ${e.object_id} failed to pay`;case"payment_intent.deleted":return`The payment intent with ID ${e.object_id} was deleted`;case"customer.created":return`A new customer ${e.object_id} was created`;case"customer.updated":return`The customer with ID ${e.object_id} was updated`;case"customer.deleted":return`The customer with ID ${e.object_id} was deleted`;case"invoice.created":return`A new invoice ${e.object_id} was created`;case"invoice.finalized":return`The invoice with ID ${e.object_id} was finalized`;case"invoice.updated":return`The invoice with ID ${e.object_id} was updated`;case"invoice.voided":return`The invoice with ID ${e.object_id} was marked as void`;case"invoice.paid":return`The invoice with ID ${e.object_id} was marked as paid`;case"invoice.marked_uncollectible":return`The invoice with ID ${e.object_id} was marked as uncollectible`;case"invoice.deleted":return`The invoice with ID ${e.object_id} was deleted`;case"checkout.session.completed":return`The checkout session ${e.object_id} completed`;case"checkout.session.expired":return`The checkout session ${e.object_id} expired`;case"customer.subscription.created":return`A new subscription ${e.object_id} was created`;case"customer.subscription.updated":return`The subscription with ID ${e.object_id} was updated`;case"customer.subscription.resumed":return`The subscription with ID ${e.object_id} was resumed`;case"customer.subscription.paused":return`The subscription with ID ${e.object_id} was paused`;case"customer.subscription.deleted":return`The subscription with ID ${e.object_id} was canceled`;default:return`${e.type}: ${e.object_id}`}};function W({type:e="",object_id:n="",features:a={toolbar:!0}}){const p=q({type:e,object_id:n}),u=k(p),{t:o}=x(),_=B(u.rowsPerPage||50),[r,h]=b.useState({type:e,object_id:n,pageSize:_,page:u.page?u.page+1:1}),{startTransition:j}=P(),{loading:m,error:l,data:t,refresh:w}=S(()=>C(r));if(b.useEffect(()=>{w()},[r,w]),l)return d.jsx(T,{severity:"error",children:l.message});if(m||!t)return d.jsx(g,{});if(t&&t.list.length===0)return d.jsx(f,{sx:{color:"text.secondary"},children:o("admin.event.empty")});const y=[{label:o("common.description"),name:"type",options:{customBodyRenderLite:(s,c)=>{const i=t.list[c];return K(i)}}},{label:o("common.id"),name:"id"},{label:o("common.createdAt"),name:"created_at",minWidth:100,options:{customBodyRender:s=>R(s)}}].filter(Boolean),$=({page:s,rowsPerPage:c})=>{r.pageSize!==c?h(i=>({...i,pageSize:c,page:1})):r.page!==s+1&&h(i=>({...i,page:s+1}))};return d.jsx(U,{children:d.jsx(z,{hasRowLink:!0,durable:p,durableKeys:["page","rowsPerPage"],data:t.list,columns:y,loading:m,onChange:$,options:{count:t.count,page:r.page-1,rowsPerPage:r.pageSize,onRowClick:(s,{dataIndex:c})=>{const i=t.list[c];j(()=>{window.open(A(E(),`/admin/developers/${i.id}`),"_blank")})}},toolbar:a?.toolbar,emptyNodeText:o("empty.events")})})}const U=D(I)`
|
|
2
2
|
td {
|
|
3
3
|
cursor: pointer;
|
|
4
4
|
}
|
|
5
|
-
`;export{
|
|
5
|
+
`;export{W as E};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as y,j as s,w as L,q as f,N as C}from"./vendor-mui-BXZut9Pz.js";import{V as P}from"./vendor-blocklet-
|
|
1
|
+
import{r as y,j as s,w as L,q as f,N as C}from"./vendor-mui-BXZut9Pz.js";import{V as P}from"./vendor-blocklet-DcLR2Cyf.js";import{i as R,n as q,o as w,j as _,T as $,e as B}from"./index-BarN7DfU.js";import{b as z,L as d}from"./vendor-react-BPknnnEA.js";import{u as T}from"./table-BrtHemkA.js";import{d as v}from"./util-DxXTXkeY.js";import{u as k}from"./cache-state-lld4zuDg.js";import{C as A}from"./link-CmPoIweR.js";import{F as D}from"./filter-toolbar-DXGSTq57.js";import{P as E}from"./actions-D3tJgrUn.js";const M=(r={})=>{const l=new URLSearchParams;return Object.keys(r).forEach(m=>{let o=r[m];m==="q"&&(o=Object.entries(o).map(c=>c.join(":")).join(" ")),l.set(m,String(o))}),B.get(`/api/payment-intents?${l.toString()}`).then(m=>m.data)},I=r=>r.customer_id?`customer-payments-${r.customer_id}`:r.invoice_id?`invoice-payments-${r.invoice_id}`:"payments";function Q({customer_id:r="",invoice_id:l="",features:m={customer:!0,filter:!0}}){const{t:o}=P(),[c]=z(),p=I({customer_id:r,invoice_id:l}),x=T(20),[i,u]=k(p,{defaultValue:{status:"",customer_id:r,invoice_id:l,pageSize:x,page:1},getUrlParams:()=>{const e={};return c.has("status")&&(e.status=c.get("status")),c.has("currency_id")&&(e.currency_id=c.get("currency_id")),c.has("customer_id")&&(e.customer_id=c.get("customer_id")),e}}),[n,j]=y.useState({}),h=()=>{M(i).then(e=>{j(e)})};if(y.useEffect(()=>{v(()=>{h()},300)()},[i]),!n.list)return s.jsx(L,{});const g=[{label:o("common.amount"),name:"id",align:"right",width:80,options:{customBodyRenderLite:(e,a)=>{const t=n.list[a],S=t.amount_received==="0"&&t.status!=="canceled";return s.jsx(d,{to:`/admin/payments/${t.id}`,children:s.jsxs(f,{component:"strong",sx:{fontWeight:600,color:S?"warning.main":"inherit"},children:[R(t.amount_received==="0"?t.amount:t.amount_received,t?.paymentCurrency.decimal)," ",t?.paymentCurrency.symbol]})})}}},{label:o("common.paymentMethod"),name:"paymentMethod",width:120,options:{customBodyRenderLite:(e,a)=>{const t=n.list[a];return s.jsx(d,{to:`/admin/payments/${t.id}`,children:s.jsxs(f,{sx:{display:"flex",alignItems:"center",whiteSpace:"nowrap"},children:[s.jsx(C,{src:t.paymentMethod.logo,sx:{width:18,height:18,mr:1}}),t.paymentMethod.name]})})}}},{label:o("common.status"),name:"status",width:80,options:{customBodyRenderLite:(e,a)=>{const t=n.list[a];return s.jsx(d,{to:`/admin/payments/${t.id}`,children:s.jsx(q,{label:t.status,color:w(t.status)})})}}},{label:o("common.description"),name:"description",options:{customBodyRenderLite:(e,a)=>{const t=n.list[a];return s.jsx(d,{to:`/admin/payments/${t.id}`,children:t.description||t.id})}}},{label:o("common.createdAt"),name:"created_at",options:{sort:!0,customBodyRenderLite:(e,a)=>{const t=n.list[a];return s.jsx(d,{to:`/admin/payments/${t.id}`,children:_(t.created_at)})}}},{label:o("common.updatedAt"),name:"updated_at",options:{sort:!0,customBodyRenderLite:(e,a)=>{const t=n.list[a];return s.jsx(d,{to:`/admin/payments/${t.id}`,children:_(t.updated_at)})}}},{label:o("common.actions"),name:"",options:{customBodyRenderLite:(e,a)=>{const t=n.list[a];return s.jsx(E,{data:t,onChange:h})}}}];m?.customer&&g.splice(3,0,{label:o("common.customer"),name:"customer_id",options:{filter:!0,customBodyRenderLite:(e,a)=>{const t=n.list[a];return s.jsx(A,{customer:t.customer})}}});const b=({page:e,rowsPerPage:a})=>{i.pageSize!==a?u(t=>({...t,pageSize:a,page:1})):i.page!==e+1&&u(t=>({...t,page:e+1}))};return s.jsx($,{hasRowLink:!0,data:n.list||[],durable:`__${p}__`,durableKeys:["searchText"],columns:g,loading:!n.list,onChange:b,options:{count:n.count,page:i.page-1,rowsPerPage:i.pageSize,onSearchChange:e=>{u(e?{...i,q:{"like-description":e,"like-metadata":e},pageSize:100,page:1}:{...i,pageSize:100,page:1,q:{}})},onColumnSortChange(e,a){u({...i,q:i.q||{},o:a})}},toolbar:m?.toolbar,footer:m?.footer,title:m?.filter&&s.jsx(D,{setSearch:u,search:i,status:["succeeded","canceled","processing","requires_action","requires_capture","requires_payment_method","requires_confirmation"],currency:!0}),emptyNodeText:o("empty.payments")})}export{Q as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as L,j as t,w as
|
|
1
|
+
import{r as L,j as t,w as H,a3 as R,q as p,O as q,N as Q,bj as Y}from"./vendor-mui-BXZut9Pz.js";import{V as J,G as X}from"./vendor-blocklet-DcLR2Cyf.js";import{j as b,aV as Z,aS as M,b6 as ee,v as te,n as U,s as ne,t as E,T as oe,e as ae,a9 as se}from"./index-BarN7DfU.js";import{b as re,L as ie}from"./vendor-react-BPknnnEA.js";import{u as ce}from"./table-BrtHemkA.js";import{u as le}from"./cache-state-lld4zuDg.js";import{C as me}from"./link-CmPoIweR.js";import{F as ue}from"./filter-toolbar-DXGSTq57.js";import{I as de}from"./action-DENqSeOa.js";const pe=r=>{const u=r.lines||[];for(const i of u){const l=i.metadata?.quote;if(l?.exchange_rate)return l}return null},ge=(r={})=>{const u=new URLSearchParams,i={include_quote:!0,...r};return Object.keys(i).forEach(l=>{let g=i[l];g==null||g===""||(l==="q"&&(g=Object.entries(g).map(y=>y.join(":")).join(" ")),u.set(l,String(g)))}),ae.get(`/api/invoices?${u.toString()}`).then(l=>l.data)},he=r=>r.customer_id?`customer-invoices-${r.customer_id}`:r.subscription_id?`subscription-invoices-${r.subscription_id}`:r.tax_rate_id?`tax-rate-invoices-${r.tax_rate_id}`:"invoices",fe=r=>r.id.startsWith("in_")?{external:!1,url:`/admin/billing/${r.id}`}:{external:!0,connect:!1,url:se(r.paymentMethod,r.metadata?.payment_details).link};function h({invoice:r,children:u}){const i=fe(r);return i.external?t.jsx("a",{href:i.url,target:"_blank",rel:"noreferrer",children:u}):t.jsx(ie,{to:i.url,children:u})}function Re({customer_id:r="",subscription_id:u="",tax_rate_id:i="",features:l={customer:!0,filter:!0},status:g="",include_staking:y=!1,include_return_staking:C=!1,ignore_zero:w=!1,mode:N="admin"}){const[_]=re(),k=he({customer_id:r,subscription_id:u}),{t:s,locale:v}=J(),W=ce(20),[m,f]=le(k,{defaultValue:{status:g,customer_id:r,subscription_id:u,tax_rate_id:i,pageSize:W,page:1,ignore_zero:!!w,include_staking:!!y,include_return_staking:!!C},getUrlParams:()=>{const n={};return _.has("status")&&(n.status=_.get("status")),_.has("currency_id")&&(n.currency_id=_.get("currency_id")),_.has("customer_id")&&(n.customer_id=_.get("customer_id")),n}}),[c,F]=L.useState({}),I=()=>ge({...m,include_staking:!!y,ignore_zero:!!w,include_return_staking:!!C,tax_rate_id:i}).then(n=>{F(n)});if(L.useEffect(()=>{I()},[m]),L.useEffect(()=>{i&&m?.tax_rate_id!==i&&f(n=>({...n||{},tax_rate_id:i,page:1}))},[i]),!c.list)return t.jsx(H,{});const B=[{label:s("common.amount"),name:"total",width:80,align:"right",options:{customBodyRenderLite:(n,a)=>{const e=c.list[a],o=pe(e),d=o?.providers||[],T=d.map(x=>x.provider_name).filter(Boolean);let j="—";d.length>1?j=`${T[0]||d[0]?.provider_id||"data"} (${d.length} sources)`:d.length===1?j=T[0]||d[0]?.provider_id||"—":j=o?.rate_provider_name||o?.rate_provider_id||"—";const O=o?.consensus_method||(d.length>1?"median":"single"),V=o?.rate_timestamp_ms?b(o.rate_timestamp_ms):"—",z=o?.degraded?s("customer.quote.degraded"):null,A=o?.base_amount?`${o.base_amount} ${o.base_currency||"USD"}`:null,$=Z(o?.exchange_rate||null),D=$?(()=>{const P={USD:"$",CNY:"¥"}[o?.base_currency];return`1 ${e.paymentCurrency.symbol} ≈ ${P?`${P}${$}`:`${$} ${o?.base_currency||"USD"}`}`})():null;let S=null;if(o?.base_amount)S=M(o.base_amount,v);else if(o?.exchange_rate&&e.total){const x=ee(new X(e.total),e.paymentCurrency.decimal,o.exchange_rate);x&&(S=M(x,v))}const G=o?t.jsxs(R,{spacing:.5,children:[t.jsxs(p,{variant:"caption",children:[s("customer.quote.provider"),": ",j||"—"]}),A&&t.jsxs(p,{variant:"caption",children:[s("customer.quote.baseAmount"),": ",A]}),D&&t.jsxs(p,{variant:"caption",children:[s("customer.quote.exchangeRate"),": ",D]}),t.jsxs(p,{variant:"caption",children:[s("customer.quote.rateTimestamp"),": ",V]}),t.jsxs(p,{variant:"caption",children:[s("customer.quote.consensusMethod"),": ",O]}),z&&t.jsxs(p,{variant:"caption",children:[s("common.status"),": ",z,o?.degraded_reason?` (${o.degraded_reason})`:""]}),o.slippage_percent!==null&&o.slippage_percent!==void 0&&t.jsxs(p,{variant:"caption",children:[s("customer.quote.slippage"),": ",o.slippage_percent,"%"]})]}):null;return t.jsx(h,{invoice:e,children:t.jsxs(R,{spacing:.25,alignItems:"flex-end",children:[t.jsxs(p,{component:"strong",sx:{fontWeight:600,textDecoration:e.status==="void"?"line-through":"none"},children:[te(e?.total,e?.paymentCurrency.decimal)," ",e?.paymentCurrency.symbol]}),S&&t.jsx(q,{title:G,placement:"top",arrow:!0,children:t.jsxs(p,{variant:"caption",sx:{color:"text.secondary",fontSize:"0.75rem",fontWeight:400,lineHeight:1.2},children:["≈ $",S]})})]})})}}},{label:s("common.paymentMethod"),name:"paymentMethod",width:120,options:{customBodyRenderLite:(n,a)=>{const e=c?.list[a];return t.jsx(h,{invoice:e,children:t.jsxs(p,{sx:{display:"flex",alignItems:"center",whiteSpace:"nowrap"},children:[t.jsx(Q,{src:e.paymentMethod.logo,sx:{width:18,height:18,mr:1}}),e.paymentMethod.name]})})}}},{label:s("common.status"),name:"status",width:120,options:{customBodyRenderLite:(n,a)=>{const e=c.list[a],o=e?.status==="uncollectible"&&e?.metadata?.slippage?.below_threshold;return t.jsx(h,{invoice:e,children:t.jsxs(R,{direction:"row",spacing:.5,alignItems:"center",children:[t.jsx(U,{label:e?.status,color:ne(e?.status)}),o&&t.jsx(q,{title:s("payment.customer.invoice.slippageExceededDetail",{currentRate:e.metadata?.slippage?.rate_at_invoice||"—",minRate:e.metadata?.slippage?.min_acceptable_rate||"—"}),arrow:!0,placement:"top",children:t.jsx(Y,{sx:{fontSize:16,color:"warning.main",cursor:"help"}})})]})})}}},{label:s("common.type"),name:"billing_reason",options:{customBodyRenderLite:(n,a)=>{const e=c.list[a];return t.jsx(h,{invoice:e,children:t.jsx(U,{label:E(e,v)?.type})})}}},{label:s("admin.invoice.number"),name:"number",options:{customBodyRenderLite:(n,a)=>{const e=c.list[a];return t.jsx(h,{invoice:e,children:e.number})}}},{label:s("common.description"),name:"description",minWidth:120,options:{customBodyRenderLite:(n,a)=>{const e=c.list[a];return t.jsx(h,{invoice:e,children:E(e,v)?.description||e?.id})}}},{label:s("common.createdAt"),name:"created_at",options:{sort:!0,customBodyRenderLite:(n,a)=>{const e=c.list[a];return t.jsx(h,{invoice:e,children:b(e.created_at)})}}},{label:s("common.updatedAt"),name:"updated_at",options:{sort:!0,customBodyRenderLite:(n,a)=>{const e=c.list[a],o=e.period_start>0&&e.period_end>0,d=t.jsx(h,{invoice:e,children:b(e.updated_at)});return o?t.jsx(q,{title:`${s("common.billingPeriod")}: ${b(e.period_start*1e3)} ~ ${b(e.period_end*1e3)}`,children:d}):d}}},{label:s("common.actions"),name:"id",width:100,align:"center",options:{sort:!1,customBodyRenderLite:(n,a)=>{const e=c.list[a];return t.jsx(de,{data:e,onChange:I,mode:N})}}}].filter(Boolean);l?.customer&&B.splice(2,0,{label:s("common.customer"),name:"customer_id",options:{customBodyRenderLite:(n,a)=>{const e=c.list[a];return t.jsx(me,{customer:e.customer,size:"small"})}}});const K=({page:n,rowsPerPage:a})=>{m.pageSize!==a?f(e=>({...e,pageSize:a,page:1})):m.page!==n+1&&f(e=>({...e,page:n+1}))};return t.jsx(oe,{hasRowLink:!0,data:c.list,durable:`__${k}__`,durableKeys:["searchText"],columns:B,loading:!c.list,onChange:K,options:{count:c.count,page:m.page-1,rowsPerPage:m.pageSize,onColumnSortChange(n,a){f({...m,q:m.q||{},o:a})},onSearchChange:n=>{f(n?{...m,q:{"like-description":n,"like-metadata":n,"like-number":n},pageSize:100,page:1}:{...m,pageSize:100,page:1,q:{}})}},toolbar:l?.toolbar,footer:l?.footer,title:l?.filter&&t.jsx(ue,{setSearch:f,search:m,status:["open","paid","uncollectible","draft","void"],currency:!0}),emptyNodeText:`${s("empty.invoices")}`})}export{Re as I};
|