@arcblock/payment-service 1.29.8 → 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.
Files changed (179) hide show
  1. package/dist/cf.d.ts +31 -0
  2. package/dist/cf.js +79 -60
  3. package/dist/index.js +163 -44
  4. package/package.json +4 -4
  5. package/web/assets/{account-DETfFe4_.js → account-Clbqiiw3.js} +1 -1
  6. package/web/assets/{action-B_DQJlip.js → action-DENqSeOa.js} +1 -1
  7. package/web/assets/{actions-BtaoyTWt.js → actions-0iWP2mcx.js} +1 -1
  8. package/web/assets/{actions-QPa-8lfB.js → actions-BD9BAp3M.js} +1 -1
  9. package/web/assets/{actions-jxGAdGfb.js → actions-BJDN6Op2.js} +1 -1
  10. package/web/assets/{actions-DJyfN5OU.js → actions-BSNy5bOd.js} +1 -1
  11. package/web/assets/{actions-Bt_jST94.js → actions-CDsj5j8l.js} +1 -1
  12. package/web/assets/{actions-D9MHLBFH.js → actions-CSpJGOX7.js} +1 -1
  13. package/web/assets/{actions-BknL4OyZ.js → actions-CZL47E9r.js} +1 -1
  14. package/web/assets/{actions-EPYeS5p4.js → actions-D3tJgrUn.js} +1 -1
  15. package/web/assets/{actions-BaDh4xWX.js → actions-DGQs8fFF.js} +1 -1
  16. package/web/assets/{add-price-CD-utowo.js → add-price-BpnICuHO.js} +1 -1
  17. package/web/assets/{admin-_nEB-lHn.js → admin-CD8ViZ7D.js} +1 -1
  18. package/web/assets/{assign-CkV5Q2LP.js → assign-0vMUDW_C.js} +1 -1
  19. package/web/assets/{attempts-DySeqBYU.js → attempts-CKlxkJuE.js} +1 -1
  20. package/web/assets/browser-DDv4_sgY.js +1 -0
  21. package/web/assets/{change-payment-CPUCUEER.js → change-payment-gAlRmJpv.js} +1 -1
  22. package/web/assets/{change-plan-CxE-XfWc.js → change-plan-C47wfWH8.js} +1 -1
  23. package/web/assets/{click-boundary-y8dVA_tr.js → click-boundary-CafubiPp.js} +1 -1
  24. package/web/assets/{connect-CC_l_f6Q.js → connect-BHHzrwLA.js} +1 -1
  25. package/web/assets/{copyable-DpX04wZz.js → copyable-QrCyyiou.js} +1 -1
  26. package/web/assets/{create-3SsWCAOC.js → create-0PUtkJZY.js} +1 -1
  27. package/web/assets/{create-BkQAaSvD.js → create-BJ1asdcy.js} +1 -1
  28. package/web/assets/{create-kG09X9gl.js → create-Bgv5ux17.js} +1 -1
  29. package/web/assets/{create-BmcRybZ5.js → create-C7GOgZZM.js} +1 -1
  30. package/web/assets/{create-tYebjhr9.js → create-DNar5UQD.js} +1 -1
  31. package/web/assets/{create-Bs65p5Ne.js → create-ke4FrPx1.js} +1 -1
  32. package/web/assets/{credit-grant-item-list-Bk27jIc7.js → credit-grant-item-list-CeDAM3qV.js} +1 -1
  33. package/web/assets/{credit-overview-DmMSEs14.js → credit-overview-4zh0H02x.js} +2 -2
  34. package/web/assets/{currency-restrictions-DYLv4YyW.js → currency-restrictions-BcEm8W45.js} +1 -1
  35. package/web/assets/{currency-select-DGS-62-L.js → currency-select-B4ieQBvv.js} +1 -1
  36. package/web/assets/{dayjs-B9tvQIKg.js → dayjs-DUTDpcNU.js} +1 -1
  37. package/web/assets/{description-Ym17DL48.js → description-SnR5WxWT.js} +1 -1
  38. package/web/assets/detail-46aLUdJj.js +1 -0
  39. package/web/assets/{detail-Cr2wG4Th.js → detail-B-ceWfZr.js} +1 -1
  40. package/web/assets/detail-B0IHl4MI.js +1 -0
  41. package/web/assets/detail-B8eOBVSQ.js +15 -0
  42. package/web/assets/{detail-DE3OOC5M.js → detail-BO3zglCn.js} +1 -1
  43. package/web/assets/{detail-DG4l2CqN.js → detail-BQpDGZJQ.js} +1 -1
  44. package/web/assets/{detail-CxYQYu_l.js → detail-BXTsnQny.js} +1 -1
  45. package/web/assets/{detail-CT9Unyrf.js → detail-B_lpOomD.js} +1 -1
  46. package/web/assets/{detail-Do9QO5L2.js → detail-Bfnkg0A1.js} +1 -1
  47. package/web/assets/detail-BwH0DwAi.js +1 -0
  48. package/web/assets/{detail-OZeeKI69.js → detail-C1FupF1D.js} +2 -2
  49. package/web/assets/{detail-cwHZbY62.js → detail-CMBRd4Ct.js} +1 -1
  50. package/web/assets/detail-C_Zdfa0y.js +1 -0
  51. package/web/assets/{detail-Cb9HBSMw.js → detail-Cg505nKX.js} +1 -1
  52. package/web/assets/{detail-DB56SG-k.js → detail-CsGZMimg.js} +1 -1
  53. package/web/assets/{detail-K9EVY3r2.js → detail-Ct5QNBqu.js} +1 -1
  54. package/web/assets/{detail-DuO_Jn5X.js → detail-CyMhK5K_.js} +1 -1
  55. package/web/assets/{detail-DuWdZIyp.js → detail-DACnmls3.js} +1 -1
  56. package/web/assets/{detail-BJTcK7mx.js → detail-DCTb8R7F.js} +1 -1
  57. package/web/assets/{detail-DPCTQLOx.js → detail-DNcp_u5S.js} +1 -1
  58. package/web/assets/detail-DbU3p040.js +1 -0
  59. package/web/assets/{detail-D5KRrQDx.js → detail-Tn2R5C8i.js} +1 -1
  60. package/web/assets/{detail-15zxCbV9.js → detail-wU4wNf4s.js} +1 -1
  61. package/web/assets/{drawer-form-Cl0T1Yyt.js → drawer-form-DspWWj3x.js} +1 -1
  62. package/web/assets/{edit-3HUAnaXW.js → edit-Bkj-OTJh.js} +1 -1
  63. package/web/assets/{editor-BF5I0siU.js → editor-AmthipP2.js} +1 -1
  64. package/web/assets/{embed-CsNqeCd0.js → embed-rRKjDoHi.js} +1 -1
  65. package/web/assets/{filter-toolbar-BydfQ-79.js → filter-toolbar-DXGSTq57.js} +1 -1
  66. package/web/assets/{form-DSzMo9UD.js → form-B5WW-lS5.js} +1 -1
  67. package/web/assets/form-BmQlJZ84.js +9 -0
  68. package/web/assets/{form-BGm5NPDn.js → form-CAPjlw7l.js} +1 -1
  69. package/web/assets/{form-CKfKLGXP.js → form-DD-EiA7W.js} +3 -3
  70. package/web/assets/{form-P4luyUpY.js → form-cX026J4G.js} +1 -1
  71. package/web/assets/{gas-Qf0SSUfS.js → gas-nyR96dB0.js} +1 -1
  72. package/web/assets/{generateCategoricalChart-BaWwaXky.js → generateCategoricalChart-BadryV3H.js} +1 -1
  73. package/web/assets/{home-HbrLyxJL.js → home-_eX1aim8.js} +1 -1
  74. package/web/assets/index-BBHMsIxJ.js +1 -0
  75. package/web/assets/{index-Dr_MwbKt.js → index-BQjlhCSt.js} +1 -1
  76. package/web/assets/{index-DPodCQ9c.js → index-BRENdB5m.js} +1 -1
  77. package/web/assets/{index-9xBRL_33.js → index-BTfJ08JU.js} +1 -1
  78. package/web/assets/{index-DgSc1Qy8.js → index-BarN7DfU.js} +17 -17
  79. package/web/assets/index-BhcoukR2.js +1 -0
  80. package/web/assets/index-BturOfxo.js +1 -0
  81. package/web/assets/{index-SYTpMMMH.js → index-BzABukCz.js} +1 -1
  82. package/web/assets/{index-2l22EYw9.js → index-C-RT84yb.js} +1 -1
  83. package/web/assets/{index-C0JaS08f.js → index-C136x0O2.js} +1 -1
  84. package/web/assets/{index-Cw0ugaQL.js → index-CCVDDX0c.js} +1 -1
  85. package/web/assets/index-CDVogp6E.js +1 -0
  86. package/web/assets/{index-Br7_mvEw.js → index-CW8VfoJO.js} +1 -1
  87. package/web/assets/{index-BIoSdRvX.js → index-CbSXdD6E.js} +3 -3
  88. package/web/assets/{index-CdkYrABk.js → index-Cd_BD9TM.js} +1 -1
  89. package/web/assets/index-D-bx9Kam.js +1 -0
  90. package/web/assets/index-D0mynT6_.js +1 -0
  91. package/web/assets/index-DEiuhiEo.js +14 -0
  92. package/web/assets/{index-DE2KzqXl.js → index-DNGmCIRP.js} +1 -1
  93. package/web/assets/{index-CI_EY4YS.js → index-DSe7Dot_.js} +1 -1
  94. package/web/assets/{index-BFML4-2u.js → index-DcddP3R9.js} +1 -1
  95. package/web/assets/index-DcrGSDby.js +1 -0
  96. package/web/assets/{index-fByZjxLy.js → index-DeK5Pqjv.js} +1 -1
  97. package/web/assets/{index-Clbt8nRm.js → index-DoX0A-rP.js} +1 -1
  98. package/web/assets/index-Du0Ieh1F.js +49 -0
  99. package/web/assets/index-Dybqd298.js +1 -0
  100. package/web/assets/index-EXZPddtw.js +1 -0
  101. package/web/assets/{index-Drav4oDH.js → index-Kd_qCyRG.js} +2 -2
  102. package/web/assets/{index-Dc954mDP.js → index-SOzRg0yJ.js} +1 -1
  103. package/web/assets/{index-BMKZToMM.js → index-UYeD8rTJ.js} +2 -2
  104. package/web/assets/{index-DZpJPE1Z.js → index-W2uZUlFs.js} +1 -1
  105. package/web/assets/{index-1y9kjPIr.js → index-XaFn2ySq.js} +1 -1
  106. package/web/assets/{index-fswPX_qe.js → index-YG5oc8O3.js} +1 -1
  107. package/web/assets/{index-B1pTTyGZ.js → index-ajD9Iotk.js} +1 -1
  108. package/web/assets/index-brUCsnBA.js +1 -0
  109. package/web/assets/{index-BP53rZV9.js → index-mn5Zdrtn.js} +1 -1
  110. package/web/assets/index-qulrJQ4J.js +1 -0
  111. package/web/assets/{index.es-BWnfUzLb.js → index.es-C8dcCHdW.js} +1 -1
  112. package/web/assets/{info-card-C1yxhxJG.js → info-card-BvIMFQo5.js} +1 -1
  113. package/web/assets/{info-metric-CNse3r66.js → info-metric-Dl4ZDm0Z.js} +1 -1
  114. package/web/assets/{info-row-group-BeUhWnnY.js → info-row-group-CFuMWJf1.js} +1 -1
  115. package/web/assets/{info-row-DOK2whMn.js → info-row-jI0h_hv4.js} +1 -1
  116. package/web/assets/{libphonenumber-CyphiuxQ.js → libphonenumber-Qs8PCdM-.js} +1 -1
  117. package/web/assets/{link-3eeclTeS.js → link-CmPoIweR.js} +1 -1
  118. package/web/assets/{list-DnePqZ2K.js → list-BdSkPjIa.js} +1 -1
  119. package/web/assets/{list-jHj_5yy3.js → list-CWMEf-_C.js} +1 -1
  120. package/web/assets/{list-C521zE_7.js → list-CkHExntK.js} +1 -1
  121. package/web/assets/{list-CO0X4L3-.js → list-DLB_hd0Q.js} +1 -1
  122. package/web/assets/{list-D-I0msRW.js → list-DVFJwd_I.js} +2 -2
  123. package/web/assets/{list-D1aevUOI.js → list-DaK9287Y.js} +2 -2
  124. package/web/assets/{list-1OG83xc4.js → list-DghnUOc4.js} +1 -1
  125. package/web/assets/{list-CNmzJKIQ.js → list-eFkvVlp5.js} +1 -1
  126. package/web/assets/metadata-BmQTVFku.js +55 -0
  127. package/web/assets/{meter-event-lmNMgmIu.js → meter-event-B1JIhVpb.js} +1 -1
  128. package/web/assets/{metrics-C7U41HWk.js → metrics-UvxyQbUF.js} +1 -1
  129. package/web/assets/{overview-Cs3-8n4e.js → overview-Cxc6WKba.js} +1 -1
  130. package/web/assets/{overview-CH1HnSP-.js → overview-DrMaIptb.js} +1 -1
  131. package/web/assets/{past-due-CGGRZmXY.js → past-due-CUXkxns0.js} +1 -1
  132. package/web/assets/pay-omLYkqRA.js +4 -0
  133. package/web/assets/{payment-method-info-BsOBbA3m.js → payment-method-info-Bsf89VxV.js} +2 -2
  134. package/web/assets/{preview-DjYRpRA8.js → preview-BifsgUGT.js} +1 -1
  135. package/web/assets/{preview-CjYh9dTg.js → preview-C-H8pGVw.js} +1 -1
  136. package/web/assets/{pricing-table-C3Lkhq46.js → pricing-table-B3QOaAB5.js} +2 -2
  137. package/web/assets/{pricing-table-edE6TJGX.js → pricing-table-BUJdtkMq.js} +1 -1
  138. package/web/assets/{product-select-0ScZE2e8.js → product-select-ChEyoJqJ.js} +1 -1
  139. package/web/assets/{recharge-DcPtT8vt.js → recharge-BVT4USAO.js} +1 -1
  140. package/web/assets/{related-credit-grants-BygNGPfb.js → related-credit-grants-JV2ICsR5.js} +22 -22
  141. package/web/assets/{safe-did-address-B0fFbUph.js → safe-did-address-CiG_V6Gy.js} +1 -1
  142. package/web/assets/{source-data-viewer-By_Utay-.js → source-data-viewer-i1q9wNIG.js} +1 -1
  143. package/web/assets/{status-l6pD08fw.js → status-CUVYrUIG.js} +1 -1
  144. package/web/assets/subscription-BYz_k9dq.js +1 -0
  145. package/web/assets/{subscription-Dq22e3D1.js → subscription-DrnSPIfs.js} +1 -1
  146. package/web/assets/table-BrtHemkA.js +1 -0
  147. package/web/assets/{tax-code-select-CWhIIiXi.js → tax-code-select-TS07I0rB.js} +1 -1
  148. package/web/assets/{tax-utils-DqNX34-r.js → tax-utils-bPjALcVG.js} +1 -1
  149. package/web/assets/{uploader-DRXDz_r0.js → uploader-CsQNHG4I.js} +1 -1
  150. package/web/assets/{usage-records-jjJMZ6DI.js → usage-records-DAUQMJAW.js} +1 -1
  151. package/web/assets/{util-mDHAL0lx.js → util-DxXTXkeY.js} +1 -1
  152. package/web/assets/{vendor-arcblock-ChFCRdyx.js → vendor-arcblock-BTCAQSUK.js} +1 -1
  153. package/web/assets/{vendor-blocklet-D_i_QeSo.js → vendor-blocklet-DcLR2Cyf.js} +43 -43
  154. package/web/index.html +1 -1
  155. package/web/assets/browser-DSLTxXlL.js +0 -1
  156. package/web/assets/detail-ASPdMJoW.js +0 -1
  157. package/web/assets/detail-CIx9vkir.js +0 -1
  158. package/web/assets/detail-D5NbV29V.js +0 -1
  159. package/web/assets/detail-DVVzYhdV.js +0 -1
  160. package/web/assets/detail-Dqc0OfCQ.js +0 -1
  161. package/web/assets/detail-uhlID8jD.js +0 -15
  162. package/web/assets/form-BXAuSawq.js +0 -9
  163. package/web/assets/index-0HK7CYm4.js +0 -1
  164. package/web/assets/index-BJ_E6bEO.js +0 -1
  165. package/web/assets/index-Bnyh4rlV.js +0 -1
  166. package/web/assets/index-BoQ7wf3O.js +0 -1
  167. package/web/assets/index-C68x-aau.js +0 -1
  168. package/web/assets/index-C8s2QKoe.js +0 -1
  169. package/web/assets/index-Cn7O-OP7.js +0 -49
  170. package/web/assets/index-DU39aG5u.js +0 -1
  171. package/web/assets/index-DtbqgSK4.js +0 -1
  172. package/web/assets/index-DuRu9NWB.js +0 -14
  173. package/web/assets/index-WMKOiUez.js +0 -1
  174. package/web/assets/index-dmHgoplS.js +0 -1
  175. package/web/assets/index-txVTkoDD.js +0 -1
  176. package/web/assets/metadata-CMSHcSXi.js +0 -55
  177. package/web/assets/pay-CSpHBUh_.js +0 -4
  178. package/web/assets/subscription-DcwhSOpa.js +0 -1
  179. package/web/assets/table-BRU4Enia.js +0 -1
@@ -0,0 +1 @@
1
+ import{j as t}from"./vendor-mui-BXZut9Pz.js";import{P as o}from"./list-BdSkPjIa.js";import"./vendor-blocklet-DcLR2Cyf.js";import"./vendor-react-BPknnnEA.js";import"./index-BarN7DfU.js";import"./table-BrtHemkA.js";import"./util-DxXTXkeY.js";import"./lodash-B4Ozcv0x.js";import"./cache-state-lld4zuDg.js";import"./link-CmPoIweR.js";import"./filter-toolbar-DXGSTq57.js";import"./product-select-ChEyoJqJ.js";import"./info-card-BvIMFQo5.js";import"./actions-BJDN6Op2.js";import"./click-boundary-CafubiPp.js";function c(){return t.jsx(o,{})}export{c as default};
@@ -0,0 +1 @@
1
+ import{A as n}from"./vendor-blocklet-DcLR2Cyf.js";import{j as e,e as r}from"./vendor-mui-BXZut9Pz.js";import{u as i,P as a}from"./index-BarN7DfU.js";import{e as c}from"./vendor-react-BPknnnEA.js";const m={pay:r.lazy(()=>n(()=>import("./pay-omLYkqRA.js"),[])),"pricing-table":r.lazy(()=>n(()=>import("./pricing-table-BUJdtkMq.js"),[]))};function p(){const{action:o,id:t}=c(),s=m[o];return e.jsx(s,{id:t})}function x(){const{session:o,connectApi:t}=i();return e.jsx(a,{session:o,connect:t,children:e.jsx(p,{})})}export{x as default};
@@ -1,4 +1,4 @@
1
- import{r as y,j as e,w as K,a3 as g,N as W,bE as ge,B as i,q as p,Y as H,x as D,e as ye,bF as G,A as Y,aQ as ie,aT as J,ad as _,bG as je,ab as be,n as ve,a0 as Se,a2 as we,bf as X,L as Ce,O as ee,bH as ke,a1 as q,be as ze,bI as Te,bJ as De,bK as Ie,bL as Ae}from"./vendor-mui-BXZut9Pz.js";import{V as L,ag as Ne,ae as Re,O as Q,$ as Me,N as Oe,X as te,E as _e}from"./vendor-blocklet-D_i_QeSo.js";import{d as Z,g as Le,f as Pe,e as P,h as Ee,F as $e,C as oe,i as ce,j as Fe,T as We,u as qe,a as ne,b as Be,k as Ue,l as Ve,m as Ke,O as He}from"./index-DgSc1Qy8.js";import{L as se,b as Ge,a as Ye}from"./vendor-react-BPknnnEA.js";import{l as U}from"./lodash-B4Ozcv0x.js";import{u as Je,C as ae,a as Qe}from"./credit-overview-DmMSEs14.js";import{S as Xe}from"./description-Ym17DL48.js";import{S as re}from"./actions-BaDh4xWX.js";import{S as Ze}from"./status-l6pD08fw.js";import{f as et,i as tt,d as nt}from"./util-mDHAL0lx.js";import{u as st}from"./table-BRU4Enia.js";import{C as at}from"./link-3eeclTeS.js";import"./collapse-CSrlJ0eG.js";import"./currency-GstdXsJf.js";import"./dayjs-B9tvQIKg.js";import"./actions-jxGAdGfb.js";import"./subscription-Dq22e3D1.js";function rt(t,a=300){const[n,r]=y.useState(!1),c=y.useRef(null);return y.useEffect(()=>(c.current&&clearTimeout(c.current),t?c.current=setTimeout(()=>{r(!0)},a):r(!1),()=>{c.current&&clearTimeout(c.current)}),[t,a]),n}const it=(t={})=>{const a=new URLSearchParams;return Object.keys(t).forEach(n=>{a.set(n,String(t[n]))}),P.get(`/api/subscriptions?${a.toString()}`).then(n=>n.data)},V=2;function ot({id:t,status:a,onChange:n=()=>{},onClickSubscription:r,onlyActive:c=!1,changeActive:d=()=>{},setStatusState:b=()=>{},setHasSubscriptions:k=()=>{},...h}){const{t:x,locale:C}=L(),{isMobile:S}=Z(),z=y.useRef(null),I=S?5:10,{data:l,loadMore:j,loadingMore:u,loading:R,reload:M}=Ne(s=>{const v=s?Math.ceil(s.list.length/I)+1:1;return it({page:v,pageSize:I,status:a,customer_id:t,activeFirst:!0,showTotalCount:!0})},{reloadDeps:[t,a],onSuccess(s){s.totalCount>0||s.count>0?(b?.(!0),k?.(!0)):k?.(!1)},...S?{}:{target:z,isNoMore:s=>s?.list?.length===0||(s?.list?.length??0)>=(s?.count??0)}}),E=rt(u);if(!l||R)return e.jsx(K,{});const m=l.totalCount>0,N=l&&l.list?.length<l.count,T=S?{width:42,height:42}:{width:44,height:44};return e.jsx(g,{direction:"column",spacing:2,sx:{mt:2,containerType:"inline-size"},children:l.list?.length>0?e.jsxs(e.Fragment,{children:[e.jsx(g,{ref:z,sx:{maxHeight:{xs:"100%",md:"700px"},overflowY:"auto",webkitOverflowScrolling:"touch",display:"grid",gridTemplateColumns:{xs:"repeat(1, 1fr)",md:"repeat(2, 1fr)"},"@container (max-width: 600px)":{gridTemplateColumns:"repeat(1, 1fr)"},gap:2},children:l.list.map(s=>{const v=Le(s,C),$=v?x(`admin.subscription.${v?.action}`,{date:v?.time,prefix:v?.isToday?"at":"on"}):"";return e.jsxs(g,{sx:{flexWrap:"wrap",padding:2,borderRadius:1,border:"1px solid",borderColor:"divider",boxShadow:1,display:"flex",flexDirection:"column",justifyContent:"space-between",gap:2,width:"100%","&:hover":{backgroundColor:"grey.50",transition:"background-color 200ms linear",cursor:"pointer"}},children:[e.jsxs(g,{direction:"column",spacing:2,...h,sx:[{flex:1,width:"100%"},...Array.isArray(h.sx)?h.sx:[h.sx]],children:[e.jsx(g,{direction:"row",spacing:1,onClick:()=>r(s),sx:{alignItems:"flex-start",justifyContent:"space-between",width:"100%"},children:e.jsxs(g,{direction:"row",spacing:1.5,sx:{alignItems:"center",width:"100%"},children:[s.metadata?.appLogo?e.jsx(W,{src:et(s.metadata?.appLogo),alt:s.metadata?.appName,variant:"rounded",sx:T}):e.jsx(ge,{max:2,sx:{"& .MuiAvatar-colorDefault":{...T,boxSizing:"border-box"}},children:s.items.slice(0,2).map(f=>f.price.product.images.length>0?e.jsx(W,{src:f.price.product.images[0],alt:f.price.product.name,variant:"rounded",sx:T},f.price.product_id):e.jsx(W,{variant:"rounded",sx:T,children:f.price.product.name.slice(0,1)},f.price.product_id))}),e.jsxs(g,{direction:"column",spacing:.25,sx:{width:"100%"},children:[e.jsx(Xe,{subscription:s,hideSubscription:!0,maxLength:S?30:40,variant:S?"subtitle2":"subtitle1"}),e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"space-between"},children:[e.jsx(Ze,{subscription:s,sx:{height:18,width:"fit-content"},size:"small"}),(()=>{const f=s.items?.[0]?.price?.product?.vendor_config;return!f||f.length===0?null:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[f.slice(0,V).map((F,B)=>e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:.25,px:.5,py:.25,bgcolor:"action.hover",borderRadius:.5,border:"1px solid",borderColor:"divider"},children:[e.jsx(i,{sx:{width:4,height:4,borderRadius:"50%",bgcolor:"success.main"}}),e.jsx(p,{variant:"caption",sx:{color:"text.secondary",fontSize:"0.7rem",fontWeight:500,whiteSpace:"nowrap"},children:F.name||F.vendor_key})]},F.vendor_id||B)),f.length>V&&e.jsxs(p,{variant:"caption",sx:{color:"text.secondary",fontSize:"0.7rem",fontStyle:"italic",px:.5},children:["+",f.length-V," more"]})]})})()]})]})]})}),e.jsx(H,{}),e.jsxs(g,{sx:{gap:1,justifyContent:"space-between",flexWrap:"nowrap",flexDirection:"row",alignItems:"center"},children:[e.jsxs(i,{component:"div",onClick:()=>r(s),sx:{display:"flex",gap:{xs:.5,md:1},flexDirection:"row",flexWrap:"wrap"},children:[e.jsx(p,{variant:S?"subtitle2":"subtitle1",sx:{whiteSpace:"nowrap"},children:Pe(s.items?.[0]?.price,s.paymentCurrency,s.items?.[0]?.price?.product?.unit_label)}),$&&e.jsxs(p,{variant:"body2",sx:{color:"text.secondary"},children:["(",$,")"]})]}),e.jsx(re,{subscription:s,onChange:f=>{M(),n&&n(f)},showUnsubscribe:!1,showRecharge:!tt(s),showBalanceInfo:!0,includeActions:["recharge"],actionProps:{recharge:{variant:"text",color:"primary",sx:{whiteSpace:"nowrap"}}}})]})]}),e.jsx(g,{sx:{display:"flex",justifyContent:"flex-end",".action-button":{flex:1}},children:e.jsx(re,{subscription:s,onChange:f=>{M(),n&&n(f)},forceShowDetailAction:!0,showUnsubscribe:!1,excludeActions:["recharge"],actionProps:{cancel:{variant:"outlined",color:"primary"},recover:{variant:"outlined",color:"info"},pastDue:{variant:"outlined",color:"primary"},detail:{variant:"contained",sx:{color:"text.primary",backgroundColor:"grey.100","&:hover":{backgroundColor:"grey.200"}}},menu:{sx:{color:"text.primary"}}},mode:"menu-only",buttonSize:"medium"})})]},s.id)})}),N&&!S&&E&&e.jsx(i,{sx:{alignItems:"center",gap:.5,display:"flex",mt:.5},children:x("common.loadingMore",{resource:x("admin.subscriptions")})}),S&&e.jsxs(i,{children:[N&&e.jsx(D,{variant:"text",type:"button",color:"inherit",onClick:j,disabled:u,children:u?x("common.loadingMore",{resource:x("admin.subscriptions")}):x("common.loadMore",{resource:x("admin.subscriptions")})}),!N&&l.count>I&&e.jsx(p,{sx:{color:"text.secondary"},children:x("common.noMore",{resource:x("admin.subscriptions")})})]})]}):e.jsx(Re,{children:c&&m?e.jsxs(i,{sx:{textAlign:"center"},children:[e.jsx(p,{children:x("admin.subscription.noActiveEmpty")}),d&&e.jsx(D,{onClick:()=>d(!1),variant:"text",sx:{color:"text.link"},children:x("admin.subscription.viewAll")})]}):x("admin.subscription.empty")})})}const ct=async()=>{const{data:t}=await P.get("/api/customers/me");return t.preference||{notification:{frequency:"default"}}},lt=async t=>{const{data:a}=await P.put("/api/customers/preference",t);return a},dt=t=>/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/.test(t);function ut({name:t,control:a,required:n,timeFormatErrorMessage:r}){return e.jsx(oe,{name:t,control:a,rules:{required:n,validate:c=>dt(c)||r},render:({field:c,fieldState:d})=>e.jsx(we,{type:"time",size:"small",sx:{minWidth:"fit-content","& input::-webkit-calendar-picker-indicator":{filter:b=>b.palette.mode==="dark"?"invert(1) brightness(80%)":"none"}},...c,error:!!d.error,helperText:d.error?.message})})}function mt({value:t,onChange:a,onBlur:n=()=>{}}){const{t:r}=L(),[c,d]=y.useState(!1),b=y.useRef(null),k=()=>{d(!1),n?.()};return e.jsxs(i,{children:[e.jsx(D,{ref:b,variant:"outlined",onClick:()=>d(!c),sx:{minWidth:"fit-content",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"grey.50","&:hover, &:focus":{borderColor:"primary.main"},color:"text.secondary"},size:"large",startIcon:e.jsx(je,{fontSize:"small",color:"action",sx:{fontSize:"1rem !important"}}),endIcon:e.jsx(p,{variant:"caption",color:"action",sx:{fontSize:"0.75rem !important",lineHeight:"normal"},children:r("notification.preferences.day")}),children:t||1}),e.jsx(be,{open:c,anchorEl:b.current,placement:"bottom-start",style:{zIndex:1300},modifiers:[{name:"offset",options:{offset:[0,8]}}],children:e.jsx(ve,{onClickAway:k,children:e.jsx(Se,{variant:"outlined",sx:{p:1,borderRadius:1,width:"280px",boxShadow:3},children:e.jsx(i,{sx:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:.5},children:Array.from({length:31},(h,x)=>x+1).map(h=>e.jsx(D,{size:"small",variant:t===h?"contained":"text",onClick:()=>{a(h),d(!1)},sx:{minWidth:30,height:30,p:0},children:h},h))})})})})]})}function xt({open:t,onClose:a}){const{t:n}=L(),[r,c]=y.useState(1),{data:d,loading:b}=Q(ct,{manual:!1,refreshDeps:[t]}),k=Ee({mode:"onChange",defaultValues:{notification:{frequency:"default",schedule:{time:"10:00",date:1}}}}),{handleSubmit:h,watch:x,reset:C,control:S,setValue:z,formState:{isValid:I}}=k,l=x("notification.frequency"),j=x("notification.schedule.date"),u=l!=="default";y.useEffect(()=>{d&&t&&(C(d),d.notification?.schedule?.date&&c(d.notification.schedule.date))},[d,C,t]),y.useEffect(()=>{j&&c(j)},[j]);const{loading:R,runAsync:M}=Q(lt,{manual:!0,onSuccess:()=>{a()}}),E=s=>{M(s)},m=s=>{z("notification.schedule.date",s,{shouldValidate:!0}),c(s)},N=s=>n(`common.days.${["sunday","monday","tuesday","wednesday","thursday","friday","saturday"][s]}`),T=s=>{z("notification.frequency",s.target.value)};return e.jsx(Me,{open:t,onClose:a,disableEscapeKeyDown:!0,title:e.jsxs(g,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(G,{fontSize:"small"}),e.jsx(p,{variant:"h6",component:"span",children:n("notification.preferences.title")})]}),maxWidth:"sm",fullWidth:!0,className:"base-dialog",actions:e.jsxs(g,{direction:"row",spacing:2,children:[e.jsx(D,{variant:"outlined",color:"inherit",onClick:a,children:n("common.cancel")}),e.jsxs(D,{variant:"contained",color:"primary",disabled:b||R||!I,onClick:h(E),children:[R&&e.jsx(K,{size:20,sx:{mr:1}}),n("common.save")]})]}),children:b?e.jsx(g,{sx:{alignItems:"center",justifyContent:"center",height:200},children:e.jsx(K,{})}):e.jsx($e,{...k,children:e.jsxs(i,{children:[e.jsx(Y,{severity:"info",children:n("notification.preferences.subscriptionRenewalNote")}),e.jsx(p,{id:"frequency-label",sx:{color:"text.primary",mt:2,mb:1},children:n("notification.preferences.frequency.label")}),e.jsx(g,{sx:{flexDirection:"row"},children:e.jsxs(i,{sx:{display:"flex",alignItems:"center",flexWrap:"nowrap",gap:{xs:.5,sm:1,md:2},width:"100%",overflow:"auto",pb:1},children:[e.jsx(ie,{sx:{width:{xs:"100px",sm:"120px"},minWidth:"fit-content"},children:e.jsxs(J,{value:l,onChange:T,size:"small",displayEmpty:!0,sx:{fontSize:{xs:"0.85rem",sm:"0.9rem"}},children:[e.jsx(_,{value:"default",children:n("notification.preferences.frequency.default")}),e.jsx(_,{value:"daily",children:n("notification.preferences.frequency.daily")}),e.jsx(_,{value:"weekly",children:n("notification.preferences.frequency.weekly")}),e.jsx(_,{value:"monthly",children:n("notification.preferences.frequency.monthly")})]})}),l!=="default"&&e.jsxs(e.Fragment,{children:[l==="weekly"&&e.jsx(oe,{name:"notification.schedule.date",control:S,render:({field:s})=>e.jsx(J,{size:"small",sx:{minWidth:120},value:s.value,onChange:s.onChange,children:[0,1,2,3,4,5,6].map(v=>e.jsx(_,{value:v,children:N(v)},v))})}),l==="monthly"&&e.jsx(mt,{value:j||1,onChange:m}),e.jsx(ut,{name:"notification.schedule.time",control:S,required:u,timeFormatErrorMessage:n("notification.preferences.timeFormatError")})]})]})}),r>28&&l==="monthly"&&e.jsxs(p,{variant:"caption",sx:{color:"text.secondary",fontStyle:"italic",display:"flex",alignItems:"center",gap:.5},children:[e.jsx(i,{component:"span",sx:{fontSize:"0.8rem"},children:"⚠️"}),n("notification.preferences.monthlyHelp")]})]})})})}function pt(){const{t}=L(),{isMobile:a}=Z(),[n,r]=ye.useState(!1);return e.jsxs(e.Fragment,{children:[a?e.jsx(D,{size:"small",variant:"outlined",sx:{minWidth:0,width:32,height:32,borderRadius:"50%"},onClick:()=>r(!0),children:e.jsx(G,{fontSize:"small"})}):e.jsx(D,{startIcon:e.jsx(G,{}),size:"small",onClick:()=>r(!0),variant:"outlined",sx:{whiteSpace:"nowrap"},children:t("notification.preferences.button")}),e.jsx(xt,{open:n,onClose:()=>r(!1)})]})}const ht=(t={})=>{const a=new URLSearchParams;return Object.keys(t).forEach(n=>{let r=t[n];n==="q"&&(r=Object.entries(r).map(c=>c.join(":")).join(" ")),a.set(n,String(r))}),P.get(`/api/payouts/mine?${a.toString()}`).then(n=>n.data)},ft=t=>t.customer_id?`customer-payouts-${t.customer_id}`:"payouts-mine";function gt({currency_id:t="",status:a="",customer_id:n=""}){const{t:r}=L(),{isMobile:c}=Z("sm"),d=Je(),b=ft({customer_id:n}),k=st(10),[h,x]=Oe(b,{defaultValue:{status:a,customer_id:n,currency_id:t,pageSize:k,page:1}}),[C,S]=y.useState({list:[],count:0});y.useEffect(()=>{nt(()=>{ht(h).then(l=>{S(l);const j=l.count>0;d?.hideRender(!j)})},300)()},[h,d]);const z=[{label:r("common.amount"),name:"id",align:"right",width:80,options:{customBodyRenderLite:(l,j)=>{const u=C.list[j];return e.jsx(se,{to:`/customer/payout/${u.id}`,children:e.jsxs(p,{component:"strong",sx:{fontWeight:600},children:[ce(u.amount,u?.paymentCurrency.decimal)," ",u?.paymentCurrency.symbol]})})}}},{label:r("customer.payout.payer"),name:"customer_id",options:{customBodyRenderLite:(l,j)=>{const u=C.list[j];return u?.paymentIntent?.customer?e.jsx(at,{customer:u.paymentIntent.customer,linkTo:`/customer/payout/${u.id}`,size:c?"small":"default"}):r("common.none")}}},{label:r("common.createdAt"),name:"created_at",options:{customBodyRenderLite:(l,j)=>{const u=C.list[j];return e.jsx(se,{to:`/customer/payout/${u.id}`,children:Fe(u.created_at)})}}}],I=({page:l,rowsPerPage:j})=>{h.pageSize!==j?x(u=>({...u,pageSize:j,page:1})):h.page!==l+1&&x(u=>({...u,page:l+1}))};return e.jsx(yt,{children:e.jsx(We,{hasRowLink:!0,durable:`__${b}__`,data:C.list||[],columns:z,loading:!C.list,onChange:I,options:{count:C.count,page:h.page-1,rowsPerPage:h.pageSize},toolbar:!1,showMobile:!1,mobileTDFlexDirection:"row",emptyNodeText:r("customer.payout.empty"),sx:{mt:2}})})}const yt=X(i)`
1
+ import{r as y,j as e,w as K,a3 as g,N as W,bE as ge,B as i,q as p,Y as H,x as D,e as ye,bF as G,A as Y,aQ as ie,aT as J,ad as _,bG as je,ab as be,n as ve,a0 as Se,a2 as we,bf as X,L as Ce,O as ee,bH as ke,a1 as q,be as ze,bI as Te,bJ as De,bK as Ie,bL as Ae}from"./vendor-mui-BXZut9Pz.js";import{V as L,ah as Re,af as Ne,P as Q,$ as Me,O as Oe,Y as te,F as _e}from"./vendor-blocklet-DcLR2Cyf.js";import{d as Z,g as Le,f as Pe,e as P,h as Ee,F as $e,C as oe,i as ce,j as Fe,T as We,u as qe,a as ne,b as Be,k as Ue,l as Ve,m as Ke,O as He}from"./index-BarN7DfU.js";import{L as se,b as Ge,a as Ye}from"./vendor-react-BPknnnEA.js";import{l as U}from"./lodash-B4Ozcv0x.js";import{u as Je,C as ae,a as Qe}from"./credit-overview-4zh0H02x.js";import{S as Xe}from"./description-SnR5WxWT.js";import{S as re}from"./actions-DGQs8fFF.js";import{S as Ze}from"./status-CUVYrUIG.js";import{f as et,i as tt,d as nt}from"./util-DxXTXkeY.js";import{u as st}from"./table-BrtHemkA.js";import{C as at}from"./link-CmPoIweR.js";import"./collapse-CSrlJ0eG.js";import"./currency-GstdXsJf.js";import"./dayjs-DUTDpcNU.js";import"./actions-BJDN6Op2.js";import"./subscription-DrnSPIfs.js";function rt(t,a=300){const[n,r]=y.useState(!1),c=y.useRef(null);return y.useEffect(()=>(c.current&&clearTimeout(c.current),t?c.current=setTimeout(()=>{r(!0)},a):r(!1),()=>{c.current&&clearTimeout(c.current)}),[t,a]),n}const it=(t={})=>{const a=new URLSearchParams;return Object.keys(t).forEach(n=>{a.set(n,String(t[n]))}),P.get(`/api/subscriptions?${a.toString()}`).then(n=>n.data)},V=2;function ot({id:t,status:a,onChange:n=()=>{},onClickSubscription:r,onlyActive:c=!1,changeActive:d=()=>{},setStatusState:b=()=>{},setHasSubscriptions:k=()=>{},...h}){const{t:x,locale:C}=L(),{isMobile:S}=Z(),z=y.useRef(null),I=S?5:10,{data:l,loadMore:j,loadingMore:u,loading:N,reload:M}=Re(s=>{const v=s?Math.ceil(s.list.length/I)+1:1;return it({page:v,pageSize:I,status:a,customer_id:t,activeFirst:!0,showTotalCount:!0})},{reloadDeps:[t,a],onSuccess(s){s.totalCount>0||s.count>0?(b?.(!0),k?.(!0)):k?.(!1)},...S?{}:{target:z,isNoMore:s=>s?.list?.length===0||(s?.list?.length??0)>=(s?.count??0)}}),E=rt(u);if(!l||N)return e.jsx(K,{});const m=l.totalCount>0,R=l&&l.list?.length<l.count,T=S?{width:42,height:42}:{width:44,height:44};return e.jsx(g,{direction:"column",spacing:2,sx:{mt:2,containerType:"inline-size"},children:l.list?.length>0?e.jsxs(e.Fragment,{children:[e.jsx(g,{ref:z,sx:{maxHeight:{xs:"100%",md:"700px"},overflowY:"auto",webkitOverflowScrolling:"touch",display:"grid",gridTemplateColumns:{xs:"repeat(1, 1fr)",md:"repeat(2, 1fr)"},"@container (max-width: 600px)":{gridTemplateColumns:"repeat(1, 1fr)"},gap:2},children:l.list.map(s=>{const v=Le(s,C),$=v?x(`admin.subscription.${v?.action}`,{date:v?.time,prefix:v?.isToday?"at":"on"}):"";return e.jsxs(g,{sx:{flexWrap:"wrap",padding:2,borderRadius:1,border:"1px solid",borderColor:"divider",boxShadow:1,display:"flex",flexDirection:"column",justifyContent:"space-between",gap:2,width:"100%","&:hover":{backgroundColor:"grey.50",transition:"background-color 200ms linear",cursor:"pointer"}},children:[e.jsxs(g,{direction:"column",spacing:2,...h,sx:[{flex:1,width:"100%"},...Array.isArray(h.sx)?h.sx:[h.sx]],children:[e.jsx(g,{direction:"row",spacing:1,onClick:()=>r(s),sx:{alignItems:"flex-start",justifyContent:"space-between",width:"100%"},children:e.jsxs(g,{direction:"row",spacing:1.5,sx:{alignItems:"center",width:"100%"},children:[s.metadata?.appLogo?e.jsx(W,{src:et(s.metadata?.appLogo),alt:s.metadata?.appName,variant:"rounded",sx:T}):e.jsx(ge,{max:2,sx:{"& .MuiAvatar-colorDefault":{...T,boxSizing:"border-box"}},children:s.items.slice(0,2).map(f=>f.price.product.images.length>0?e.jsx(W,{src:f.price.product.images[0],alt:f.price.product.name,variant:"rounded",sx:T},f.price.product_id):e.jsx(W,{variant:"rounded",sx:T,children:f.price.product.name.slice(0,1)},f.price.product_id))}),e.jsxs(g,{direction:"column",spacing:.25,sx:{width:"100%"},children:[e.jsx(Xe,{subscription:s,hideSubscription:!0,maxLength:S?30:40,variant:S?"subtitle2":"subtitle1"}),e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"space-between"},children:[e.jsx(Ze,{subscription:s,sx:{height:18,width:"fit-content"},size:"small"}),(()=>{const f=s.items?.[0]?.price?.product?.vendor_config;return!f||f.length===0?null:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[f.slice(0,V).map((F,B)=>e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:.25,px:.5,py:.25,bgcolor:"action.hover",borderRadius:.5,border:"1px solid",borderColor:"divider"},children:[e.jsx(i,{sx:{width:4,height:4,borderRadius:"50%",bgcolor:"success.main"}}),e.jsx(p,{variant:"caption",sx:{color:"text.secondary",fontSize:"0.7rem",fontWeight:500,whiteSpace:"nowrap"},children:F.name||F.vendor_key})]},F.vendor_id||B)),f.length>V&&e.jsxs(p,{variant:"caption",sx:{color:"text.secondary",fontSize:"0.7rem",fontStyle:"italic",px:.5},children:["+",f.length-V," more"]})]})})()]})]})]})}),e.jsx(H,{}),e.jsxs(g,{sx:{gap:1,justifyContent:"space-between",flexWrap:"nowrap",flexDirection:"row",alignItems:"center"},children:[e.jsxs(i,{component:"div",onClick:()=>r(s),sx:{display:"flex",gap:{xs:.5,md:1},flexDirection:"row",flexWrap:"wrap"},children:[e.jsx(p,{variant:S?"subtitle2":"subtitle1",sx:{whiteSpace:"nowrap"},children:Pe(s.items?.[0]?.price,s.paymentCurrency,s.items?.[0]?.price?.product?.unit_label)}),$&&e.jsxs(p,{variant:"body2",sx:{color:"text.secondary"},children:["(",$,")"]})]}),e.jsx(re,{subscription:s,onChange:f=>{M(),n&&n(f)},showUnsubscribe:!1,showRecharge:!tt(s),showBalanceInfo:!0,includeActions:["recharge"],actionProps:{recharge:{variant:"text",color:"primary",sx:{whiteSpace:"nowrap"}}}})]})]}),e.jsx(g,{sx:{display:"flex",justifyContent:"flex-end",".action-button":{flex:1}},children:e.jsx(re,{subscription:s,onChange:f=>{M(),n&&n(f)},forceShowDetailAction:!0,showUnsubscribe:!1,excludeActions:["recharge"],actionProps:{cancel:{variant:"outlined",color:"primary"},recover:{variant:"outlined",color:"info"},pastDue:{variant:"outlined",color:"primary"},detail:{variant:"contained",sx:{color:"text.primary",backgroundColor:"grey.100","&:hover":{backgroundColor:"grey.200"}}},menu:{sx:{color:"text.primary"}}},mode:"menu-only",buttonSize:"medium"})})]},s.id)})}),R&&!S&&E&&e.jsx(i,{sx:{alignItems:"center",gap:.5,display:"flex",mt:.5},children:x("common.loadingMore",{resource:x("admin.subscriptions")})}),S&&e.jsxs(i,{children:[R&&e.jsx(D,{variant:"text",type:"button",color:"inherit",onClick:j,disabled:u,children:u?x("common.loadingMore",{resource:x("admin.subscriptions")}):x("common.loadMore",{resource:x("admin.subscriptions")})}),!R&&l.count>I&&e.jsx(p,{sx:{color:"text.secondary"},children:x("common.noMore",{resource:x("admin.subscriptions")})})]})]}):e.jsx(Ne,{children:c&&m?e.jsxs(i,{sx:{textAlign:"center"},children:[e.jsx(p,{children:x("admin.subscription.noActiveEmpty")}),d&&e.jsx(D,{onClick:()=>d(!1),variant:"text",sx:{color:"text.link"},children:x("admin.subscription.viewAll")})]}):x("admin.subscription.empty")})})}const ct=async()=>{const{data:t}=await P.get("/api/customers/me");return t.preference||{notification:{frequency:"default"}}},lt=async t=>{const{data:a}=await P.put("/api/customers/preference",t);return a},dt=t=>/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/.test(t);function ut({name:t,control:a,required:n,timeFormatErrorMessage:r}){return e.jsx(oe,{name:t,control:a,rules:{required:n,validate:c=>dt(c)||r},render:({field:c,fieldState:d})=>e.jsx(we,{type:"time",size:"small",sx:{minWidth:"fit-content","& input::-webkit-calendar-picker-indicator":{filter:b=>b.palette.mode==="dark"?"invert(1) brightness(80%)":"none"}},...c,error:!!d.error,helperText:d.error?.message})})}function mt({value:t,onChange:a,onBlur:n=()=>{}}){const{t:r}=L(),[c,d]=y.useState(!1),b=y.useRef(null),k=()=>{d(!1),n?.()};return e.jsxs(i,{children:[e.jsx(D,{ref:b,variant:"outlined",onClick:()=>d(!c),sx:{minWidth:"fit-content",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"grey.50","&:hover, &:focus":{borderColor:"primary.main"},color:"text.secondary"},size:"large",startIcon:e.jsx(je,{fontSize:"small",color:"action",sx:{fontSize:"1rem !important"}}),endIcon:e.jsx(p,{variant:"caption",color:"action",sx:{fontSize:"0.75rem !important",lineHeight:"normal"},children:r("notification.preferences.day")}),children:t||1}),e.jsx(be,{open:c,anchorEl:b.current,placement:"bottom-start",style:{zIndex:1300},modifiers:[{name:"offset",options:{offset:[0,8]}}],children:e.jsx(ve,{onClickAway:k,children:e.jsx(Se,{variant:"outlined",sx:{p:1,borderRadius:1,width:"280px",boxShadow:3},children:e.jsx(i,{sx:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:.5},children:Array.from({length:31},(h,x)=>x+1).map(h=>e.jsx(D,{size:"small",variant:t===h?"contained":"text",onClick:()=>{a(h),d(!1)},sx:{minWidth:30,height:30,p:0},children:h},h))})})})})]})}function xt({open:t,onClose:a}){const{t:n}=L(),[r,c]=y.useState(1),{data:d,loading:b}=Q(ct,{manual:!1,refreshDeps:[t]}),k=Ee({mode:"onChange",defaultValues:{notification:{frequency:"default",schedule:{time:"10:00",date:1}}}}),{handleSubmit:h,watch:x,reset:C,control:S,setValue:z,formState:{isValid:I}}=k,l=x("notification.frequency"),j=x("notification.schedule.date"),u=l!=="default";y.useEffect(()=>{d&&t&&(C(d),d.notification?.schedule?.date&&c(d.notification.schedule.date))},[d,C,t]),y.useEffect(()=>{j&&c(j)},[j]);const{loading:N,runAsync:M}=Q(lt,{manual:!0,onSuccess:()=>{a()}}),E=s=>{M(s)},m=s=>{z("notification.schedule.date",s,{shouldValidate:!0}),c(s)},R=s=>n(`common.days.${["sunday","monday","tuesday","wednesday","thursday","friday","saturday"][s]}`),T=s=>{z("notification.frequency",s.target.value)};return e.jsx(Me,{open:t,onClose:a,disableEscapeKeyDown:!0,title:e.jsxs(g,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(G,{fontSize:"small"}),e.jsx(p,{variant:"h6",component:"span",children:n("notification.preferences.title")})]}),maxWidth:"sm",fullWidth:!0,className:"base-dialog",actions:e.jsxs(g,{direction:"row",spacing:2,children:[e.jsx(D,{variant:"outlined",color:"inherit",onClick:a,children:n("common.cancel")}),e.jsxs(D,{variant:"contained",color:"primary",disabled:b||N||!I,onClick:h(E),children:[N&&e.jsx(K,{size:20,sx:{mr:1}}),n("common.save")]})]}),children:b?e.jsx(g,{sx:{alignItems:"center",justifyContent:"center",height:200},children:e.jsx(K,{})}):e.jsx($e,{...k,children:e.jsxs(i,{children:[e.jsx(Y,{severity:"info",children:n("notification.preferences.subscriptionRenewalNote")}),e.jsx(p,{id:"frequency-label",sx:{color:"text.primary",mt:2,mb:1},children:n("notification.preferences.frequency.label")}),e.jsx(g,{sx:{flexDirection:"row"},children:e.jsxs(i,{sx:{display:"flex",alignItems:"center",flexWrap:"nowrap",gap:{xs:.5,sm:1,md:2},width:"100%",overflow:"auto",pb:1},children:[e.jsx(ie,{sx:{width:{xs:"100px",sm:"120px"},minWidth:"fit-content"},children:e.jsxs(J,{value:l,onChange:T,size:"small",displayEmpty:!0,sx:{fontSize:{xs:"0.85rem",sm:"0.9rem"}},children:[e.jsx(_,{value:"default",children:n("notification.preferences.frequency.default")}),e.jsx(_,{value:"daily",children:n("notification.preferences.frequency.daily")}),e.jsx(_,{value:"weekly",children:n("notification.preferences.frequency.weekly")}),e.jsx(_,{value:"monthly",children:n("notification.preferences.frequency.monthly")})]})}),l!=="default"&&e.jsxs(e.Fragment,{children:[l==="weekly"&&e.jsx(oe,{name:"notification.schedule.date",control:S,render:({field:s})=>e.jsx(J,{size:"small",sx:{minWidth:120},value:s.value,onChange:s.onChange,children:[0,1,2,3,4,5,6].map(v=>e.jsx(_,{value:v,children:R(v)},v))})}),l==="monthly"&&e.jsx(mt,{value:j||1,onChange:m}),e.jsx(ut,{name:"notification.schedule.time",control:S,required:u,timeFormatErrorMessage:n("notification.preferences.timeFormatError")})]})]})}),r>28&&l==="monthly"&&e.jsxs(p,{variant:"caption",sx:{color:"text.secondary",fontStyle:"italic",display:"flex",alignItems:"center",gap:.5},children:[e.jsx(i,{component:"span",sx:{fontSize:"0.8rem"},children:"⚠️"}),n("notification.preferences.monthlyHelp")]})]})})})}function pt(){const{t}=L(),{isMobile:a}=Z(),[n,r]=ye.useState(!1);return e.jsxs(e.Fragment,{children:[a?e.jsx(D,{size:"small",variant:"outlined",sx:{minWidth:0,width:32,height:32,borderRadius:"50%"},onClick:()=>r(!0),children:e.jsx(G,{fontSize:"small"})}):e.jsx(D,{startIcon:e.jsx(G,{}),size:"small",onClick:()=>r(!0),variant:"outlined",sx:{whiteSpace:"nowrap"},children:t("notification.preferences.button")}),e.jsx(xt,{open:n,onClose:()=>r(!1)})]})}const ht=(t={})=>{const a=new URLSearchParams;return Object.keys(t).forEach(n=>{let r=t[n];n==="q"&&(r=Object.entries(r).map(c=>c.join(":")).join(" ")),a.set(n,String(r))}),P.get(`/api/payouts/mine?${a.toString()}`).then(n=>n.data)},ft=t=>t.customer_id?`customer-payouts-${t.customer_id}`:"payouts-mine";function gt({currency_id:t="",status:a="",customer_id:n=""}){const{t:r}=L(),{isMobile:c}=Z("sm"),d=Je(),b=ft({customer_id:n}),k=st(10),[h,x]=Oe(b,{defaultValue:{status:a,customer_id:n,currency_id:t,pageSize:k,page:1}}),[C,S]=y.useState({list:[],count:0});y.useEffect(()=>{nt(()=>{ht(h).then(l=>{S(l);const j=l.count>0;d?.hideRender(!j)})},300)()},[h,d]);const z=[{label:r("common.amount"),name:"id",align:"right",width:80,options:{customBodyRenderLite:(l,j)=>{const u=C.list[j];return e.jsx(se,{to:`/customer/payout/${u.id}`,children:e.jsxs(p,{component:"strong",sx:{fontWeight:600},children:[ce(u.amount,u?.paymentCurrency.decimal)," ",u?.paymentCurrency.symbol]})})}}},{label:r("customer.payout.payer"),name:"customer_id",options:{customBodyRenderLite:(l,j)=>{const u=C.list[j];return u?.paymentIntent?.customer?e.jsx(at,{customer:u.paymentIntent.customer,linkTo:`/customer/payout/${u.id}`,size:c?"small":"default"}):r("common.none")}}},{label:r("common.createdAt"),name:"created_at",options:{customBodyRenderLite:(l,j)=>{const u=C.list[j];return e.jsx(se,{to:`/customer/payout/${u.id}`,children:Fe(u.created_at)})}}}],I=({page:l,rowsPerPage:j})=>{h.pageSize!==j?x(u=>({...u,pageSize:j,page:1})):h.page!==l+1&&x(u=>({...u,page:l+1}))};return e.jsx(yt,{children:e.jsx(We,{hasRowLink:!0,durable:`__${b}__`,data:C.list||[],columns:z,loading:!C.list,onChange:I,options:{count:C.count,page:h.page-1,rowsPerPage:h.pageSize},toolbar:!1,showMobile:!1,mobileTDFlexDirection:"row",emptyNodeText:r("customer.payout.empty"),sx:{mt:2}})})}const yt=X(i)`
2
2
  @media (max-width: ${({theme:t})=>t.breakpoints.values.md}px) {
3
3
  .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > td.MuiTableCell-root {
4
4
  > div {
@@ -14,7 +14,7 @@ import{r as y,j as e,w as K,a3 as g,N as W,bE as ge,B as i,q as p,Y as H,x as D,
14
14
  padding-right: 20px;
15
15
  }
16
16
  }
17
- `,jt=()=>P.get("/api/customers/me?skipError=true&create=true").then(t=>t.data),bt={},vt=y.memo(({label:t,data:a,currency:n,icon:r})=>{const d=ce((a||{})[n?.id],n?.decimal,6,!0);return e.jsxs(i,{sx:{transition:"all 0.2s ease-in-out",position:"relative",height:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",containerType:"inline-size"},children:[e.jsxs(p,{variant:"body1",gutterBottom:!0,sx:{color:"text.secondary",display:"flex",alignItems:"center",gap:1},children:[r,t]}),e.jsxs(p,{variant:"body1",gutterBottom:!0,sx:{color:"text.primary",whiteSpace:"nowrap"},children:[d," ",n.symbol]})]})}),St=y.memo(({height:t=100})=>e.jsxs(i,{className:"base-card section",children:[e.jsx(i,{className:"section-header",sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:e.jsx(q,{variant:"text",width:150,height:32})}),e.jsx(q,{variant:"rectangular",height:t})]}));function wt(){return e.jsxs(i,{className:"base-card section section-summary",children:[e.jsx(q,{variant:"text",width:150,height:32,sx:{mb:2}}),e.jsx(q,{variant:"rectangular",height:88,width:"100%"})]})}function Ct(t,a){return["balance","paid","stake","refund","due"].every(r=>!t?.[r]?.[a]||t?.[r]?.[a]==="0")}const kt={balance:{key:"token"},spent:{key:"paid",alwaysShow:!0},stake:{key:"stake"},refund:{key:"refund"},due:{key:"due"}},zt=(t,a,n,r,c)=>{const d=a.key,b=n?.summary?.[d]?.[r.id]&&n?.summary?.[d]?.[r.id]!=="0";return t==="balance"?c?.type==="arcblock"||a.alwaysShow||b:a.alwaysShow||b},Tt=t=>({balance:e.jsx(Ae,{color:"success",fontSize:"small"}),spent:e.jsx(Ie,{color:"warning",fontSize:"small"}),stake:e.jsx(De,{fontSize:"small",color:"info"}),refund:e.jsx(Te,{fontSize:"small",sx:{color:"chip.secondary.text"}}),due:e.jsx(ze,{fontSize:"small",color:"error"})})[t];function Gt(){const{t}=L(),{events:a}=qe(),{settings:n}=ne(),[r,c]=te({credit:"",revenue:""}),[d,b]=y.useState(!1),k=U.flatten(n.paymentMethods?.map(o=>(o.payment_currencies||[]).map(w=>({...w,methodName:o.name})))),[h]=Ge(),x=h.get("embed")||sessionStorage.getItem("embed"),{livemode:C,setLivemode:S}=ne(),[z,I]=te({editing:!1,loading:!1,onlyActive:!0,setOverdraftProtection:!1}),l=Ye(),[j,u]=y.useState(!1),[R,M]=y.useState(!1),{startTransition:E}=Be(),{data:m,error:N,runAsync:T,loading:s=!0}=Q(jt,{manual:!0,onSuccess:async o=>{if(!R){const w=new URLSearchParams,A={page:1,pageSize:5,showTotalCount:!0,customer_id:o.id};Object.entries(A).forEach(([he,fe])=>{w.set(he,String(fe))});const{data:O}=await P.get(`/api/subscriptions?${w.toString()}`);(O.totalCount>0||O.count>0)&&M(!0)}}}),v=s||!m,[$,f]=y.useState(!1);if(y.useEffect(()=>{T(),a.on("switch-did",()=>{T()})},[]),y.useEffect(()=>{m&&!m.error&&m.livemode!==C&&S(m.livemode)},[m]),N)return e.jsx(i,{sx:{backgroundColor:"error.light",color:"error.dark",p:1,mb:2,borderRadius:1,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(p,{variant:"body2",children:Ue(N)})});const F=o=>{o?.id&&l(`/customer/recharge/${o.id}`)},B=o=>{b(!0),I({onlyActive:o.target.value==="active"}),setTimeout(()=>{b(!1)},300)},le=v||!R?null:e.jsxs(i,{className:"base-card section section-subscription",children:[e.jsxs(i,{className:"section-header",children:[e.jsx(p,{variant:"h3",children:t("customer.subscription.title")}),e.jsxs(g,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(pt,{}),j&&e.jsx(ie,{sx:{".MuiInputBase-root":{background:"none",border:"none"},".MuiOutlinedInput-notchedOutline":{border:"none"}},children:e.jsxs(J,{value:z.onlyActive?"active":"",onChange:B,displayEmpty:!0,IconComponent:Ce,inputProps:{"aria-label":"Without label"},children:[e.jsx(_,{value:"",children:"All"}),e.jsx(_,{value:"active",children:"Active"})]})})]})]}),e.jsx(i,{className:"section-body",children:d?e.jsx(i,{children:t("common.loading")}):e.jsx(ot,{id:m?.id,onlyActive:z.onlyActive,changeActive:o=>I({onlyActive:o}),status:z.onlyActive?"active,trialing,past_due":"active,trialing,paused,past_due,canceled",style:{cursor:"pointer"},onClickSubscription:o=>{E(()=>{l(`/customer/subscription/${o.id}`)})},setStatusState:u,setHasSubscriptions:M})})]}),de=v?e.jsx(wt,{}):e.jsx(i,{className:"base-card section section-summary",sx:{containerType:"inline-size"},children:m?.summary&&e.jsxs(e.Fragment,{children:[e.jsx(i,{className:"section-header",children:e.jsx(p,{variant:"h3",children:t("admin.customer.summary.stats")})}),e.jsx(g,{sx:{gap:2,mt:2,display:"grid",gridTemplateColumns:{xs:"repeat(1, 1fr)",md:"repeat(2, 1fr)"},"@container (max-width: 600px)":{gridTemplateColumns:"repeat(1, 1fr)"}},children:k.map(o=>{const w=n?.paymentMethods?.find(A=>A.id===o.payment_method_id);return w?.type!=="arcblock"||Ct(m?.summary,o.id)&&o.id!==n.baseCurrency.id?null:e.jsxs(g,{sx:{borderRadius:1,p:2,gap:2,border:"1px solid",borderColor:"divider",boxShadow:1},children:[e.jsxs(g,{sx:{flexDirection:"row",justifyContent:"space-between"},children:[e.jsxs(i,{sx:{alignItems:"center",display:"flex",gap:1},children:[e.jsx(W,{src:o?.logo,alt:o?.symbol,sx:{width:18,height:18}}),e.jsx(p,{variant:"h5",component:"div",sx:{fontSize:"16px",color:"text.primary",fontWeight:"500"},children:o?.symbol}),e.jsx(p,{sx:{color:"text.lighter",fontSize:12},children:o?.methodName})]}),w?.type==="arcblock"&&e.jsx(ee,{title:t("customer.recharge.rechargeTooltip"),arrow:!0,placement:"top",children:e.jsxs(D,{onClick:()=>F(o),variant:"text",color:"primary",size:"small",children:[e.jsx(ke,{fontSize:"small"}),e.jsx(p,{variant:"body2",className:"recharge-title",children:t("customer.recharge.title")})]})})]}),e.jsx(H,{}),e.jsx(g,{className:"section-body",sx:{gap:1,mt:1.5},children:Object.entries(kt).map(([A,O])=>zt(A,O,m,o,w)?e.jsx(i,{className:"card-item",sx:{position:"relative"},children:e.jsx(vt,{label:t(`admin.customer.summary.${A}`),data:m?.summary?.[O.key]||bt,currency:o,icon:Tt(A)})},`card-${o.id}-${A}`):null)})]},o.id)})})]})}),ue=e.jsx(ae,{skeleton:v,onStateChange:o=>c({credit:o}),children:e.jsxs(i,{className:"base-card section section-credit",children:[e.jsx(i,{className:"section-header",sx:{mb:2},children:e.jsx(p,{variant:"h3",children:t("admin.creditGrants.title")})}),e.jsx(Qe,{customerId:m?.id||"",settings:n})]})}),me=v?e.jsx(St,{height:200}):e.jsxs(i,{className:"base-card section section-invoices",children:[e.jsxs(i,{className:"section-header",children:[e.jsx(p,{variant:"h3",children:t("customer.invoiceHistory")}),U.isEmpty(m?.summary?.due)===!1&&e.jsx(ee,{title:t("payment.customer.pastDue.warning"),children:e.jsx(D,{variant:"text",color:"error",component:"a",size:"small",href:_e(Ve(),"/customer/invoice/past-due",`${x==="1"?"?embed=1":""}`),target:"_blank",rel:"noreferrer",style:{textDecoration:"none",fontSize:13},children:t("payment.customer.pastDue.invoices")})})]}),e.jsx(i,{className:"section-body",children:e.jsx(Ke,{customer_id:m?.id,type:"table",include_staking:!0,relatedSubscription:!0})})]}),xe=e.jsx(ae,{skeleton:v,onStateChange:o=>c({revenue:o}),children:e.jsxs(i,{className:"base-card section section-revenue",children:[e.jsx(i,{className:"section-header",children:e.jsx(p,{variant:"h3",children:t("customer.payout.title")})}),e.jsx(i,{className:"section-body",children:e.jsx(gt,{})})]})}),pe=[{card:de,key:"summary"},{card:ue,key:"credit"},{card:le,key:"subscription"},{card:me,key:"invoice"},{card:xe,key:"revenue"}].filter(({card:o,key:w})=>o&&r[w]!=="none");return e.jsxs(Dt,{children:[m?.error&&e.jsx(Y,{severity:"error",sx:{mb:2},children:m?.error}),U.isEmpty(m?.summary?.due)===!1&&e.jsx(Y,{severity:"error",sx:{mb:2,".MuiAlert-action":{alignItems:"center"}},action:e.jsx(D,{color:"inherit",size:"small",variant:"outlined",onClick:()=>f(!0),sx:{whiteSpace:"nowrap"},children:t("customer.pastDue.payNow")}),children:t("customer.pastDue.alert")}),$&&m&&e.jsx(He,{customerId:m.id,onPaid:()=>{f(!1),T()},successToast:!1,detailLinkOptions:{enabled:!0,onClick:()=>{f(!1),l("/customer/invoice/past-due")}},dialogProps:{open:$,onClose:()=>{f(!1),T()},title:t("customer.pastDue.title")}}),e.jsx(It,{children:pe.map(({card:o,key:w},A,O)=>e.jsxs(y.Fragment,{children:[o,(r[w]?r[w]==="visible":A<O.length-1)&&e.jsx(H,{})]},w))})]})}const Dt=X(g)`
17
+ `,jt=()=>P.get("/api/customers/me?skipError=true&create=true").then(t=>t.data),bt={},vt=y.memo(({label:t,data:a,currency:n,icon:r})=>{const d=ce((a||{})[n?.id],n?.decimal,6,!0);return e.jsxs(i,{sx:{transition:"all 0.2s ease-in-out",position:"relative",height:"100%",display:"flex",flexDirection:"row",justifyContent:"space-between",containerType:"inline-size"},children:[e.jsxs(p,{variant:"body1",gutterBottom:!0,sx:{color:"text.secondary",display:"flex",alignItems:"center",gap:1},children:[r,t]}),e.jsxs(p,{variant:"body1",gutterBottom:!0,sx:{color:"text.primary",whiteSpace:"nowrap"},children:[d," ",n.symbol]})]})}),St=y.memo(({height:t=100})=>e.jsxs(i,{className:"base-card section",children:[e.jsx(i,{className:"section-header",sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:e.jsx(q,{variant:"text",width:150,height:32})}),e.jsx(q,{variant:"rectangular",height:t})]}));function wt(){return e.jsxs(i,{className:"base-card section section-summary",children:[e.jsx(q,{variant:"text",width:150,height:32,sx:{mb:2}}),e.jsx(q,{variant:"rectangular",height:88,width:"100%"})]})}function Ct(t,a){return["balance","paid","stake","refund","due"].every(r=>!t?.[r]?.[a]||t?.[r]?.[a]==="0")}const kt={balance:{key:"token"},spent:{key:"paid",alwaysShow:!0},stake:{key:"stake"},refund:{key:"refund"},due:{key:"due"}},zt=(t,a,n,r,c)=>{const d=a.key,b=n?.summary?.[d]?.[r.id]&&n?.summary?.[d]?.[r.id]!=="0";return t==="balance"?c?.type==="arcblock"||a.alwaysShow||b:a.alwaysShow||b},Tt=t=>({balance:e.jsx(Ae,{color:"success",fontSize:"small"}),spent:e.jsx(Ie,{color:"warning",fontSize:"small"}),stake:e.jsx(De,{fontSize:"small",color:"info"}),refund:e.jsx(Te,{fontSize:"small",sx:{color:"chip.secondary.text"}}),due:e.jsx(ze,{fontSize:"small",color:"error"})})[t];function Gt(){const{t}=L(),{events:a}=qe(),{settings:n}=ne(),[r,c]=te({credit:"",revenue:""}),[d,b]=y.useState(!1),k=U.flatten(n.paymentMethods?.map(o=>(o.payment_currencies||[]).map(w=>({...w,methodName:o.name})))),[h]=Ge(),x=h.get("embed")||sessionStorage.getItem("embed"),{livemode:C,setLivemode:S}=ne(),[z,I]=te({editing:!1,loading:!1,onlyActive:!0,setOverdraftProtection:!1}),l=Ye(),[j,u]=y.useState(!1),[N,M]=y.useState(!1),{startTransition:E}=Be(),{data:m,error:R,runAsync:T,loading:s=!0}=Q(jt,{manual:!0,onSuccess:async o=>{if(!N){const w=new URLSearchParams,A={page:1,pageSize:5,showTotalCount:!0,customer_id:o.id};Object.entries(A).forEach(([he,fe])=>{w.set(he,String(fe))});const{data:O}=await P.get(`/api/subscriptions?${w.toString()}`);(O.totalCount>0||O.count>0)&&M(!0)}}}),v=s||!m,[$,f]=y.useState(!1);if(y.useEffect(()=>{T(),a.on("switch-did",()=>{T()})},[]),y.useEffect(()=>{m&&!m.error&&m.livemode!==C&&S(m.livemode)},[m]),R)return e.jsx(i,{sx:{backgroundColor:"error.light",color:"error.dark",p:1,mb:2,borderRadius:1,display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx(p,{variant:"body2",children:Ue(R)})});const F=o=>{o?.id&&l(`/customer/recharge/${o.id}`)},B=o=>{b(!0),I({onlyActive:o.target.value==="active"}),setTimeout(()=>{b(!1)},300)},le=v||!N?null:e.jsxs(i,{className:"base-card section section-subscription",children:[e.jsxs(i,{className:"section-header",children:[e.jsx(p,{variant:"h3",children:t("customer.subscription.title")}),e.jsxs(g,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(pt,{}),j&&e.jsx(ie,{sx:{".MuiInputBase-root":{background:"none",border:"none"},".MuiOutlinedInput-notchedOutline":{border:"none"}},children:e.jsxs(J,{value:z.onlyActive?"active":"",onChange:B,displayEmpty:!0,IconComponent:Ce,inputProps:{"aria-label":"Without label"},children:[e.jsx(_,{value:"",children:"All"}),e.jsx(_,{value:"active",children:"Active"})]})})]})]}),e.jsx(i,{className:"section-body",children:d?e.jsx(i,{children:t("common.loading")}):e.jsx(ot,{id:m?.id,onlyActive:z.onlyActive,changeActive:o=>I({onlyActive:o}),status:z.onlyActive?"active,trialing,past_due":"active,trialing,paused,past_due,canceled",style:{cursor:"pointer"},onClickSubscription:o=>{E(()=>{l(`/customer/subscription/${o.id}`)})},setStatusState:u,setHasSubscriptions:M})})]}),de=v?e.jsx(wt,{}):e.jsx(i,{className:"base-card section section-summary",sx:{containerType:"inline-size"},children:m?.summary&&e.jsxs(e.Fragment,{children:[e.jsx(i,{className:"section-header",children:e.jsx(p,{variant:"h3",children:t("admin.customer.summary.stats")})}),e.jsx(g,{sx:{gap:2,mt:2,display:"grid",gridTemplateColumns:{xs:"repeat(1, 1fr)",md:"repeat(2, 1fr)"},"@container (max-width: 600px)":{gridTemplateColumns:"repeat(1, 1fr)"}},children:k.map(o=>{const w=n?.paymentMethods?.find(A=>A.id===o.payment_method_id);return w?.type!=="arcblock"||Ct(m?.summary,o.id)&&o.id!==n.baseCurrency.id?null:e.jsxs(g,{sx:{borderRadius:1,p:2,gap:2,border:"1px solid",borderColor:"divider",boxShadow:1},children:[e.jsxs(g,{sx:{flexDirection:"row",justifyContent:"space-between"},children:[e.jsxs(i,{sx:{alignItems:"center",display:"flex",gap:1},children:[e.jsx(W,{src:o?.logo,alt:o?.symbol,sx:{width:18,height:18}}),e.jsx(p,{variant:"h5",component:"div",sx:{fontSize:"16px",color:"text.primary",fontWeight:"500"},children:o?.symbol}),e.jsx(p,{sx:{color:"text.lighter",fontSize:12},children:o?.methodName})]}),w?.type==="arcblock"&&e.jsx(ee,{title:t("customer.recharge.rechargeTooltip"),arrow:!0,placement:"top",children:e.jsxs(D,{onClick:()=>F(o),variant:"text",color:"primary",size:"small",children:[e.jsx(ke,{fontSize:"small"}),e.jsx(p,{variant:"body2",className:"recharge-title",children:t("customer.recharge.title")})]})})]}),e.jsx(H,{}),e.jsx(g,{className:"section-body",sx:{gap:1,mt:1.5},children:Object.entries(kt).map(([A,O])=>zt(A,O,m,o,w)?e.jsx(i,{className:"card-item",sx:{position:"relative"},children:e.jsx(vt,{label:t(`admin.customer.summary.${A}`),data:m?.summary?.[O.key]||bt,currency:o,icon:Tt(A)})},`card-${o.id}-${A}`):null)})]},o.id)})})]})}),ue=e.jsx(ae,{skeleton:v,onStateChange:o=>c({credit:o}),children:e.jsxs(i,{className:"base-card section section-credit",children:[e.jsx(i,{className:"section-header",sx:{mb:2},children:e.jsx(p,{variant:"h3",children:t("admin.creditGrants.title")})}),e.jsx(Qe,{customerId:m?.id||"",settings:n})]})}),me=v?e.jsx(St,{height:200}):e.jsxs(i,{className:"base-card section section-invoices",children:[e.jsxs(i,{className:"section-header",children:[e.jsx(p,{variant:"h3",children:t("customer.invoiceHistory")}),U.isEmpty(m?.summary?.due)===!1&&e.jsx(ee,{title:t("payment.customer.pastDue.warning"),children:e.jsx(D,{variant:"text",color:"error",component:"a",size:"small",href:_e(Ve(),"/customer/invoice/past-due",`${x==="1"?"?embed=1":""}`),target:"_blank",rel:"noreferrer",style:{textDecoration:"none",fontSize:13},children:t("payment.customer.pastDue.invoices")})})]}),e.jsx(i,{className:"section-body",children:e.jsx(Ke,{customer_id:m?.id,type:"table",include_staking:!0,relatedSubscription:!0})})]}),xe=e.jsx(ae,{skeleton:v,onStateChange:o=>c({revenue:o}),children:e.jsxs(i,{className:"base-card section section-revenue",children:[e.jsx(i,{className:"section-header",children:e.jsx(p,{variant:"h3",children:t("customer.payout.title")})}),e.jsx(i,{className:"section-body",children:e.jsx(gt,{})})]})}),pe=[{card:de,key:"summary"},{card:ue,key:"credit"},{card:le,key:"subscription"},{card:me,key:"invoice"},{card:xe,key:"revenue"}].filter(({card:o,key:w})=>o&&r[w]!=="none");return e.jsxs(Dt,{children:[m?.error&&e.jsx(Y,{severity:"error",sx:{mb:2},children:m?.error}),U.isEmpty(m?.summary?.due)===!1&&e.jsx(Y,{severity:"error",sx:{mb:2,".MuiAlert-action":{alignItems:"center"}},action:e.jsx(D,{color:"inherit",size:"small",variant:"outlined",onClick:()=>f(!0),sx:{whiteSpace:"nowrap"},children:t("customer.pastDue.payNow")}),children:t("customer.pastDue.alert")}),$&&m&&e.jsx(He,{customerId:m.id,onPaid:()=>{f(!1),T()},successToast:!1,detailLinkOptions:{enabled:!0,onClick:()=>{f(!1),l("/customer/invoice/past-due")}},dialogProps:{open:$,onClose:()=>{f(!1),T()},title:t("customer.pastDue.title")}}),e.jsx(It,{children:pe.map(({card:o,key:w},A,O)=>e.jsxs(y.Fragment,{children:[o,(r[w]?r[w]==="visible":A<O.length-1)&&e.jsx(H,{})]},w))})]})}const Dt=X(g)`
18
18
  height: 100%;
19
19
  .section-header {
20
20
  display: flex;
@@ -1 +1 @@
1
- import{V as u,an as x,y as o}from"./vendor-blocklet-D_i_QeSo.js";import{j as t,a3 as _,B as h,r as f,e as n}from"./vendor-mui-BXZut9Pz.js";import{b as g}from"./index-DgSc1Qy8.js";import{a as y,e as b}from"./vendor-react-BPknnnEA.js";const v=n.lazy(()=>o(()=>import("./create-3SsWCAOC.js"),[])),r={"payment-methods":n.lazy(()=>o(()=>import("./index-fByZjxLy.js"),[])),"vault-config":n.lazy(()=>o(()=>import("./index-DuRu9NWB.js"),[]))};function C(){const l=y(),{t:s}=u(),{page:a="payment-methods"}=b(),{startTransition:m}=g(),c=p=>{m(()=>{l(`/admin/settings/${p}`)})},e=r[a]||r.paymentMethods,d=[{label:s("admin.paymentMethods"),value:"payment-methods"},{label:s("admin.vaultConfig.title"),value:"vault-config"}];let i=null;return a==="payment-methods"&&(i=t.jsx(v,{})),t.jsxs(t.Fragment,{children:[t.jsxs(_,{direction:"row",spacing:1,sx:{alignItems:"flex-start",justifyContent:"end",flexWrap:"wrap"},children:[t.jsx(x,{tabs:d,current:a,onChange:c,scrollButtons:"auto",variant:"scrollable",sx:{flex:"1 0 auto",maxWidth:"100%",".MuiTab-root":{color:"text.lighter"},".MuiTabs-indicator":{display:"none"},".Mui-selected":{fontSize:24,color:"text.primary"},".MuiTabs-hideScrollbar":{border:"none !important"},".MuiTouchRipple-root":{display:"none"}}}),t.jsxs(h,{children:[" ",i]})]}),f.isValidElement(e)?e:t.jsx(e,{})]})}export{C as default};
1
+ import{V as u,ao as x,A as o}from"./vendor-blocklet-DcLR2Cyf.js";import{j as t,a3 as _,B as h,r as f,e as n}from"./vendor-mui-BXZut9Pz.js";import{b as g}from"./index-BarN7DfU.js";import{a as y,e as b}from"./vendor-react-BPknnnEA.js";const v=n.lazy(()=>o(()=>import("./create-0PUtkJZY.js"),[])),r={"payment-methods":n.lazy(()=>o(()=>import("./index-DeK5Pqjv.js"),[])),"vault-config":n.lazy(()=>o(()=>import("./index-DEiuhiEo.js"),[]))};function C(){const l=y(),{t:s}=u(),{page:a="payment-methods"}=b(),{startTransition:m}=g(),c=p=>{m(()=>{l(`/admin/settings/${p}`)})},e=r[a]||r.paymentMethods,d=[{label:s("admin.paymentMethods"),value:"payment-methods"},{label:s("admin.vaultConfig.title"),value:"vault-config"}];let i=null;return a==="payment-methods"&&(i=t.jsx(v,{})),t.jsxs(t.Fragment,{children:[t.jsxs(_,{direction:"row",spacing:1,sx:{alignItems:"flex-start",justifyContent:"end",flexWrap:"wrap"},children:[t.jsx(x,{tabs:d,current:a,onChange:c,scrollButtons:"auto",variant:"scrollable",sx:{flex:"1 0 auto",maxWidth:"100%",".MuiTab-root":{color:"text.lighter"},".MuiTabs-indicator":{display:"none"},".Mui-selected":{fontSize:24,color:"text.primary"},".MuiTabs-hideScrollbar":{border:"none !important"},".MuiTouchRipple-root":{display:"none"}}}),t.jsxs(h,{children:[" ",i]})]}),f.isValidElement(e)?e:t.jsx(e,{})]})}export{C as default};
@@ -1,4 +1,4 @@
1
- import{r as j,j as e,a3 as b,q as h,a0 as B,x as k,B as a,a2 as T,Y as W,$ as A,bs as $,bt as z,aY as V,N,A as H,w as O,O as M,I as Y,V as U}from"./vendor-mui-BXZut9Pz.js";import{V as P,Y as y,cu as G,N as K,O as X,E as J,$ as E}from"./vendor-blocklet-D_i_QeSo.js";import{h as Q,F as Z,C as w,e as D,bc as I,k as R,b9 as ee,l as te,S as ne,T as oe,I as se}from"./index-DgSc1Qy8.js";import"./vendor-react-BPknnnEA.js";function re({count:t}){return e.jsxs(b,{sx:{flexDirection:"row",justifyContent:"center",alignItems:"center"},children:[e.jsx(a,{sx:{display:"flex",position:"relative"},children:Array(Math.min(t,5)).fill(0).map((n,i)=>e.jsx(a,{sx:{width:"24px",height:"24px",borderRadius:"50%",bgcolor:"grey.200",border:"2px solid",borderColor:"divider",position:"relative",marginLeft:i===0?0:"-8px",zIndex:t-i}},i))}),e.jsx(a,{sx:{fontSize:"14px",color:"text.secondary",pl:1.5,pr:1,ml:-1,borderRadius:"8px",backgroundColor:"background.paper",height:"24px",display:"flex",alignItems:"center"},children:`${t} supporter${t>1?"s":""} (XX ABT)`})]})}function ae({config:t}){const{t:n}=P(),i=t.settings.amount.presets?.length>0,[o,c]=j.useState(t.settings.amount.preset),[f,g]=j.useState(""),[u,p]=j.useState(i?!1:t.settings.amount.custom),s=l=>{c(l),p(!1),g("")},m=()=>{p(!0),c("")};return e.jsxs(b,{spacing:3,children:[e.jsx(h,{variant:"h6",gutterBottom:!0,sx:{color:"text.primary"},children:n("admin.donate.previewTitle")}),e.jsxs(B,{elevation:0,sx:{p:2,bgcolor:"background.paper",border:"1px dashed",borderColor:"divider",borderRadius:1},children:[e.jsx(h,{variant:"caption",gutterBottom:!0,sx:{display:"block",color:"text.secondary",mb:1},children:n("admin.donate.btn.preview")}),e.jsxs(b,{spacing:2,sx:{alignItems:"center"},children:[e.jsx(k,{variant:"outlined",color:"primary",children:t.settings.btnText}),e.jsx(re,{count:3}),e.jsx(a,{sx:{width:"100%",maxWidth:300},children:t.settings.historyType==="table"&&e.jsx(a,{sx:{borderRadius:1,p:1.5,display:"flex",flexDirection:"column",alignItems:"center",gap:1.5},children:Array(3).fill(0).map((l,x)=>e.jsxs(a,{sx:{display:"flex",justifyContent:"center",alignItems:"center",gap:1,opacity:1-x*.2,width:"100%",maxWidth:240},children:[e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:.5,width:"75%"},children:[e.jsx(a,{sx:{width:"16px",height:"16px",borderRadius:"50%",bgcolor:"grey.200",border:"2px solid",borderColor:"divider",position:"relative"}},x),e.jsx(a,{sx:{width:"100%",height:8,borderRadius:1,bgcolor:"grey.200"}})]}),e.jsx(a,{sx:{width:"25%",height:8,borderRadius:1,bgcolor:"grey.200"}})]},x))})})]})]}),e.jsxs(B,{elevation:0,sx:{p:2,bgcolor:"background.paper",border:"1px dashed",borderColor:"divider",borderRadius:1},children:[e.jsx(h,{variant:"caption",gutterBottom:!0,sx:{display:"block",color:"text.secondary",mb:1},children:n("admin.donate.dialog.preview")}),e.jsxs(b,{spacing:3,children:[e.jsxs(a,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:[t.settings.amount.presets?.map(l=>e.jsx(k,{variant:"outlined",size:"small",sx:{borderColor:o===l?"primary.main":"divider",borderWidth:o===l?2:1,color:o===l?"primary.main":"text.primary"},onClick:()=>s(l),children:`${l} ABT`},l)),t.settings.amount.custom&&i&&e.jsx(k,{variant:"outlined",size:"small",sx:{borderColor:u?"primary.main":"divider",borderWidth:u?2:1,color:u?"primary.main":"text.primary"},onClick:m,children:n("common.custom")})]}),u&&t.settings.amount.custom&&e.jsx(T,{fullWidth:!0,size:"small",autoFocus:!0,label:n("admin.donate.customAmount"),value:f,onChange:l=>{const{value:x}=l.target;g(x)},helperText:n("admin.donate.amountRange",{min:t.settings.amount.minimum,max:t.settings.amount.maximum}),slotProps:{input:{endAdornment:e.jsx(h,{sx:{ml:1},children:"ABT"})}},autoComplete:"off"})]}),e.jsx(W,{sx:{my:2}}),e.jsxs(a,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:1},children:[e.jsx(a,{sx:{px:2,py:.5,bgcolor:"grey.200",borderRadius:1,width:40,height:24}}),e.jsx(a,{sx:{px:2,py:.5,bgcolor:"primary.main",borderRadius:1,width:40,height:24,opacity:.5}})]})]})]})}function ie({value:t,onChange:n}){const{t:i}=P(),[o,c]=j.useState(t.join(", ")),f=j.useRef(!1);j.useEffect(()=>{if(f.current){f.current=!1;return}c(t.join(", "))},[t]);const g=u=>{const{value:p}=u.target;if(!/^[\d,.\s]*$/.test(p))return;c(p);const m=p.split(/[,\s]+/).filter(Boolean).map(l=>l.trim()).filter(l=>!Number.isNaN(Number(l))).map(Number).filter((l,x,v)=>v.indexOf(l)===x);f.current=!0,n(m.map(String))};return e.jsx(T,{fullWidth:!0,label:i("admin.donate.presets"),helperText:i("admin.donate.presetsHelper"),value:o,onChange:g,placeholder:"1, 5, 10",sx:{bgcolor:"background.paper"},onBlur:()=>{const u=(o.match(/[\d.]+/g)||[]).join(", ");c(u)}})}function le({item:t,onSuccess:n,onCancel:i}){const{t:o}=P(),c=Q({defaultValues:{settings:{amount:{presets:t?.settings?.amount?.presets,preset:t?.settings?.amount?.preset,minimum:t?.settings?.amount?.minimum,maximum:t?.settings?.amount?.maximum,custom:t?.settings?.amount?.custom},btnText:t?.settings?.btnText,historyType:t?.settings?.historyType}}}),{handleSubmit:f,watch:g}=c,u=g(),p=async s=>{if(s.settings.amount.presets?.length>0&&s.settings.amount.preset&&!s.settings.amount.presets.includes(s.settings.amount.preset)){y.error(o("admin.donate.validation.invalidPreset"));return}try{await D.put(`/api/settings/${t.id}`,s),I(t.mount_location),y.success(o("admin.donate.updateSuccess")),n()}catch(m){y.error(R(m))}};return e.jsxs(a,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[e.jsx(a,{sx:{flex:1,overflow:{xs:"visible",md:"auto"},pb:2,display:"flex",flexDirection:"column"},children:e.jsx(Z,{...c,children:e.jsxs(A,{container:!0,spacing:3,sx:{flex:1,minHeight:0},children:[e.jsx(A,{sx:{height:"100%"},size:{xs:12,md:6},children:e.jsx(B,{elevation:0,sx:{p:{xs:2,md:3},bgcolor:"background.neutral",height:"100%",overflow:"auto"},children:e.jsxs(b,{spacing:4,children:[e.jsxs(a,{children:[e.jsx(h,{variant:"h6",gutterBottom:!0,sx:{color:"text.primary",mb:3},children:o("admin.donate.buttonSettings")}),e.jsxs(b,{spacing:3,children:[e.jsx(w,{name:"settings.btnText",render:({field:s})=>e.jsx(T,{...s,fullWidth:!0,label:o("admin.donate.btn.text"),helperText:o("admin.donate.btn.helper"),sx:{bgcolor:"background.paper"}})}),e.jsxs(b,{sx:{gap:1},children:[e.jsx(h,{variant:"subtitle2",gutterBottom:!0,children:o("admin.donate.historyType.title")}),e.jsx(w,{name:"settings.historyType",render:({field:s})=>e.jsxs($,{value:s.value,exclusive:!0,onChange:(m,l)=>s.onChange(l),size:"small",sx:{bgcolor:"background.paper"},children:[e.jsx(z,{value:"table",size:"small",children:o("admin.donate.historyType.list")}),e.jsx(z,{value:"avatar",size:"small",children:o("admin.donate.historyType.avatar")})]})})]})]})]}),e.jsx(W,{}),e.jsxs(a,{children:[e.jsx(h,{variant:"h6",gutterBottom:!0,sx:{color:"text.primary",mb:3},children:o("admin.donate.amountSettings")}),e.jsxs(b,{spacing:3,children:[e.jsx(w,{control:c.control,name:"settings.amount.presets",render:({field:s})=>e.jsx(ie,{value:s.value||[],onChange:s.onChange})}),e.jsx(w,{name:"settings.amount.preset",render:({field:s})=>e.jsx(T,{...s,fullWidth:!0,label:o("admin.donate.preset"),helperText:o("admin.donate.presetHelper"),sx:{bgcolor:"background.paper"}})}),e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(h,{variant:"subtitle2",gutterBottom:!0,children:o("admin.donate.custom")}),e.jsx(w,{name:"settings.amount.custom",render:({field:s})=>e.jsx(V,{checked:s.value,onChange:m=>s.onChange(m.target.checked),size:"small"})})]}),u.settings.amount.custom&&e.jsxs(b,{spacing:2,sx:{mt:2},children:[e.jsx(w,{name:"settings.amount.minimum",render:({field:s})=>e.jsx(T,{...s,fullWidth:!0,label:o("admin.donate.minimum"),type:"number",sx:{bgcolor:"background.paper"}})}),e.jsx(w,{name:"settings.amount.maximum",render:({field:s})=>e.jsx(T,{...s,fullWidth:!0,label:o("admin.donate.maximum"),type:"number",sx:{bgcolor:"background.paper"}})})]})]})]})]})})}),e.jsx(A,{sx:{display:{xs:"none",md:"block"},height:"100%"},size:{md:6},children:e.jsx(B,{elevation:0,sx:{p:3,bgcolor:"background.neutral",height:"100%",overflow:"auto"},children:e.jsx(ae,{config:c.watch()})})})]})})}),e.jsxs(a,{sx:{mt:2,pt:2,pb:2,px:2,borderTop:1,borderColor:"divider",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"background.paper",position:"sticky",bottom:0,left:0,right:0,zIndex:1},children:[e.jsx(k,{onClick:i,variant:"outlined",children:o("common.cancel")}),e.jsx(k,{variant:"contained",onClick:f(p),children:o("common.save")})]})]})}const de=`import { PaymentProvider, DonateProvider, CheckoutDonate } from '@blocklet/payment-react';
1
+ import{r as j,j as e,a3 as b,q as h,a0 as B,x as k,B as a,a2 as T,Y as W,$ as A,bs as $,bt as z,aY as V,N,A as H,w as O,O as M,I as U,V as Y}from"./vendor-mui-BXZut9Pz.js";import{V as P,Z as y,cv as G,O as K,P as X,F as Z,$ as F}from"./vendor-blocklet-DcLR2Cyf.js";import{h as J,F as Q,C as w,e as D,bc as I,k as R,b9 as ee,l as te,S as ne,T as oe,I as se}from"./index-BarN7DfU.js";import"./vendor-react-BPknnnEA.js";function re({count:t}){return e.jsxs(b,{sx:{flexDirection:"row",justifyContent:"center",alignItems:"center"},children:[e.jsx(a,{sx:{display:"flex",position:"relative"},children:Array(Math.min(t,5)).fill(0).map((n,i)=>e.jsx(a,{sx:{width:"24px",height:"24px",borderRadius:"50%",bgcolor:"grey.200",border:"2px solid",borderColor:"divider",position:"relative",marginLeft:i===0?0:"-8px",zIndex:t-i}},i))}),e.jsx(a,{sx:{fontSize:"14px",color:"text.secondary",pl:1.5,pr:1,ml:-1,borderRadius:"8px",backgroundColor:"background.paper",height:"24px",display:"flex",alignItems:"center"},children:`${t} supporter${t>1?"s":""} (XX ABT)`})]})}function ae({config:t}){const{t:n}=P(),i=t.settings.amount.presets?.length>0,[o,c]=j.useState(t.settings.amount.preset),[f,g]=j.useState(""),[u,p]=j.useState(i?!1:t.settings.amount.custom),s=l=>{c(l),p(!1),g("")},m=()=>{p(!0),c("")};return e.jsxs(b,{spacing:3,children:[e.jsx(h,{variant:"h6",gutterBottom:!0,sx:{color:"text.primary"},children:n("admin.donate.previewTitle")}),e.jsxs(B,{elevation:0,sx:{p:2,bgcolor:"background.paper",border:"1px dashed",borderColor:"divider",borderRadius:1},children:[e.jsx(h,{variant:"caption",gutterBottom:!0,sx:{display:"block",color:"text.secondary",mb:1},children:n("admin.donate.btn.preview")}),e.jsxs(b,{spacing:2,sx:{alignItems:"center"},children:[e.jsx(k,{variant:"outlined",color:"primary",children:t.settings.btnText}),e.jsx(re,{count:3}),e.jsx(a,{sx:{width:"100%",maxWidth:300},children:t.settings.historyType==="table"&&e.jsx(a,{sx:{borderRadius:1,p:1.5,display:"flex",flexDirection:"column",alignItems:"center",gap:1.5},children:Array(3).fill(0).map((l,x)=>e.jsxs(a,{sx:{display:"flex",justifyContent:"center",alignItems:"center",gap:1,opacity:1-x*.2,width:"100%",maxWidth:240},children:[e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:.5,width:"75%"},children:[e.jsx(a,{sx:{width:"16px",height:"16px",borderRadius:"50%",bgcolor:"grey.200",border:"2px solid",borderColor:"divider",position:"relative"}},x),e.jsx(a,{sx:{width:"100%",height:8,borderRadius:1,bgcolor:"grey.200"}})]}),e.jsx(a,{sx:{width:"25%",height:8,borderRadius:1,bgcolor:"grey.200"}})]},x))})})]})]}),e.jsxs(B,{elevation:0,sx:{p:2,bgcolor:"background.paper",border:"1px dashed",borderColor:"divider",borderRadius:1},children:[e.jsx(h,{variant:"caption",gutterBottom:!0,sx:{display:"block",color:"text.secondary",mb:1},children:n("admin.donate.dialog.preview")}),e.jsxs(b,{spacing:3,children:[e.jsxs(a,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:[t.settings.amount.presets?.map(l=>e.jsx(k,{variant:"outlined",size:"small",sx:{borderColor:o===l?"primary.main":"divider",borderWidth:o===l?2:1,color:o===l?"primary.main":"text.primary"},onClick:()=>s(l),children:`${l} ABT`},l)),t.settings.amount.custom&&i&&e.jsx(k,{variant:"outlined",size:"small",sx:{borderColor:u?"primary.main":"divider",borderWidth:u?2:1,color:u?"primary.main":"text.primary"},onClick:m,children:n("common.custom")})]}),u&&t.settings.amount.custom&&e.jsx(T,{fullWidth:!0,size:"small",autoFocus:!0,label:n("admin.donate.customAmount"),value:f,onChange:l=>{const{value:x}=l.target;g(x)},helperText:n("admin.donate.amountRange",{min:t.settings.amount.minimum,max:t.settings.amount.maximum}),slotProps:{input:{endAdornment:e.jsx(h,{sx:{ml:1},children:"ABT"})}},autoComplete:"off"})]}),e.jsx(W,{sx:{my:2}}),e.jsxs(a,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:1},children:[e.jsx(a,{sx:{px:2,py:.5,bgcolor:"grey.200",borderRadius:1,width:40,height:24}}),e.jsx(a,{sx:{px:2,py:.5,bgcolor:"primary.main",borderRadius:1,width:40,height:24,opacity:.5}})]})]})]})}function ie({value:t,onChange:n}){const{t:i}=P(),[o,c]=j.useState(t.join(", ")),f=j.useRef(!1);j.useEffect(()=>{if(f.current){f.current=!1;return}c(t.join(", "))},[t]);const g=u=>{const{value:p}=u.target;if(!/^[\d,.\s]*$/.test(p))return;c(p);const m=p.split(/[,\s]+/).filter(Boolean).map(l=>l.trim()).filter(l=>!Number.isNaN(Number(l))).map(Number).filter((l,x,v)=>v.indexOf(l)===x);f.current=!0,n(m.map(String))};return e.jsx(T,{fullWidth:!0,label:i("admin.donate.presets"),helperText:i("admin.donate.presetsHelper"),value:o,onChange:g,placeholder:"1, 5, 10",sx:{bgcolor:"background.paper"},onBlur:()=>{const u=(o.match(/[\d.]+/g)||[]).join(", ");c(u)}})}function le({item:t,onSuccess:n,onCancel:i}){const{t:o}=P(),c=J({defaultValues:{settings:{amount:{presets:t?.settings?.amount?.presets,preset:t?.settings?.amount?.preset,minimum:t?.settings?.amount?.minimum,maximum:t?.settings?.amount?.maximum,custom:t?.settings?.amount?.custom},btnText:t?.settings?.btnText,historyType:t?.settings?.historyType}}}),{handleSubmit:f,watch:g}=c,u=g(),p=async s=>{if(s.settings.amount.presets?.length>0&&s.settings.amount.preset&&!s.settings.amount.presets.includes(s.settings.amount.preset)){y.error(o("admin.donate.validation.invalidPreset"));return}try{await D.put(`/api/settings/${t.id}`,s),I(t.mount_location),y.success(o("admin.donate.updateSuccess")),n()}catch(m){y.error(R(m))}};return e.jsxs(a,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[e.jsx(a,{sx:{flex:1,overflow:{xs:"visible",md:"auto"},pb:2,display:"flex",flexDirection:"column"},children:e.jsx(Q,{...c,children:e.jsxs(A,{container:!0,spacing:3,sx:{flex:1,minHeight:0},children:[e.jsx(A,{sx:{height:"100%"},size:{xs:12,md:6},children:e.jsx(B,{elevation:0,sx:{p:{xs:2,md:3},bgcolor:"background.neutral",height:"100%",overflow:"auto"},children:e.jsxs(b,{spacing:4,children:[e.jsxs(a,{children:[e.jsx(h,{variant:"h6",gutterBottom:!0,sx:{color:"text.primary",mb:3},children:o("admin.donate.buttonSettings")}),e.jsxs(b,{spacing:3,children:[e.jsx(w,{name:"settings.btnText",render:({field:s})=>e.jsx(T,{...s,fullWidth:!0,label:o("admin.donate.btn.text"),helperText:o("admin.donate.btn.helper"),sx:{bgcolor:"background.paper"}})}),e.jsxs(b,{sx:{gap:1},children:[e.jsx(h,{variant:"subtitle2",gutterBottom:!0,children:o("admin.donate.historyType.title")}),e.jsx(w,{name:"settings.historyType",render:({field:s})=>e.jsxs($,{value:s.value,exclusive:!0,onChange:(m,l)=>s.onChange(l),size:"small",sx:{bgcolor:"background.paper"},children:[e.jsx(z,{value:"table",size:"small",children:o("admin.donate.historyType.list")}),e.jsx(z,{value:"avatar",size:"small",children:o("admin.donate.historyType.avatar")})]})})]})]})]}),e.jsx(W,{}),e.jsxs(a,{children:[e.jsx(h,{variant:"h6",gutterBottom:!0,sx:{color:"text.primary",mb:3},children:o("admin.donate.amountSettings")}),e.jsxs(b,{spacing:3,children:[e.jsx(w,{control:c.control,name:"settings.amount.presets",render:({field:s})=>e.jsx(ie,{value:s.value||[],onChange:s.onChange})}),e.jsx(w,{name:"settings.amount.preset",render:({field:s})=>e.jsx(T,{...s,fullWidth:!0,label:o("admin.donate.preset"),helperText:o("admin.donate.presetHelper"),sx:{bgcolor:"background.paper"}})}),e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(h,{variant:"subtitle2",gutterBottom:!0,children:o("admin.donate.custom")}),e.jsx(w,{name:"settings.amount.custom",render:({field:s})=>e.jsx(V,{checked:s.value,onChange:m=>s.onChange(m.target.checked),size:"small"})})]}),u.settings.amount.custom&&e.jsxs(b,{spacing:2,sx:{mt:2},children:[e.jsx(w,{name:"settings.amount.minimum",render:({field:s})=>e.jsx(T,{...s,fullWidth:!0,label:o("admin.donate.minimum"),type:"number",sx:{bgcolor:"background.paper"}})}),e.jsx(w,{name:"settings.amount.maximum",render:({field:s})=>e.jsx(T,{...s,fullWidth:!0,label:o("admin.donate.maximum"),type:"number",sx:{bgcolor:"background.paper"}})})]})]})]})]})})}),e.jsx(A,{sx:{display:{xs:"none",md:"block"},height:"100%"},size:{md:6},children:e.jsx(B,{elevation:0,sx:{p:3,bgcolor:"background.neutral",height:"100%",overflow:"auto"},children:e.jsx(ae,{config:c.watch()})})})]})})}),e.jsxs(a,{sx:{mt:2,pt:2,pb:2,px:2,borderTop:1,borderColor:"divider",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"background.paper",position:"sticky",bottom:0,left:0,right:0,zIndex:1},children:[e.jsx(k,{onClick:i,variant:"outlined",children:o("common.cancel")}),e.jsx(k,{variant:"contained",onClick:f(p),children:o("common.save")})]})]})}const de=`import { PaymentProvider, DonateProvider, CheckoutDonate } from '@blocklet/payment-react';
2
2
 
3
3
  // In your component
4
4
  function YourComponent() {
@@ -25,4 +25,4 @@ function YourComponent() {
25
25
  </DonateProvider>
26
26
  </PaymentProvider>
27
27
  );
28
- }`,ce=(t={})=>{const n=new URLSearchParams;return Object.keys(t).forEach(i=>{let o=t[i];i==="q"&&(o=Object.entries(o).map(c=>c.join(":")).join(" ")),n.set(i,String(o))}),D.get(`/api/settings/donate?${n.toString()}`).then(i=>i.data)};function ue({code:t}){const{t:n}=P(),i=async()=>{try{await navigator.clipboard.writeText(t),y.success(n("common.copySuccess"))}catch{y.error(n("common.copyFailed"))}};return e.jsxs(a,{sx:{position:"relative"},children:[e.jsx(a,{component:"pre",sx:{backgroundColor:"#F8F9FA",color:"#495057",borderRadius:1,p:2,overflow:"auto","&::-webkit-scrollbar":{height:8,bgcolor:"background.paper"},"&::-webkit-scrollbar-thumb":{bgcolor:"#CED4DA",borderRadius:4},fontSize:"0.875rem",fontFamily:"monospace",lineHeight:1.5,border:"1px solid #E9ECEF"},children:t}),e.jsx(M,{title:n("common.copy"),placement:"top",children:e.jsx(Y,{onClick:i,sx:{position:"absolute",top:8,right:8,bgcolor:"background.paper","&:hover":{bgcolor:"#F8F9FA"}},children:e.jsx(U,{fontSize:"small"})})})]})}function ge(){const t="donation-settings",{t:n}=P(),[i,o]=j.useState(null),[c,f]=j.useState(!1),[g,u]=j.useState({open:!1,id:"",active:!1,mountLocation:""}),p=G(t),[s,m]=K(t,{defaultValue:{o:"desc",pageSize:p.rowsPerPage||10,page:p.page?p.page+1:1}}),{error:l,data:x={list:[],count:0},refresh:v}=X(()=>ce(s)),S=x.list||[];j.useEffect(()=>{v()},[s,v]),ee("donation.updated",()=>v(),[]);const _=async(r,d)=>{if(d){u({open:!0,id:r.id,active:d,mountLocation:r.mount_location});return}try{await D.put(`/api/settings/${r.id}`,{active:!d}),I(r.mount_location),y.success(n("admin.donate.status.activeSuccess")),v()}catch(C){y.error(R(C))}},F=async()=>{try{await D.put(`/api/settings/${g.id}`,{active:!g.active}),I(g.mountLocation),y.success(n("admin.donate.status.inactiveSuccess")),v()}catch(r){y.error(R(r))}finally{u({open:!1,id:"",active:!1,mountLocation:""})}},L=[{label:n("admin.donate.component"),name:"component_did",options:{sort:!1,customBodyRenderLite:r=>{const d=window.blocklet?.componentMountPoints.find(C=>C?.did===S[r]?.component_did);return d?e.jsxs(b,{direction:"row",sx:{alignItems:"center",gap:1},children:[e.jsx(N,{src:J(te(),`.well-known/service/blocklet/logo-bundle/${d.did}`),alt:d?.title}),e.jsx(h,{onClick:()=>window.open(d.mountPoint,"_blank"),sx:{cursor:"pointer"},children:d?.title})]}):x[r]?.component_did||n("common.none")}}},{label:n("admin.donate.mountLocation"),name:"mount_location",options:{sort:!1}},{label:n("admin.donate.description"),name:"description",options:{sort:!1}},{label:n("admin.donate.status.title"),name:"active",width:100,options:{sort:!1,customBodyRenderLite:r=>e.jsx(ne,{checked:S[r].active,onChange:()=>_(S[r],S[r].active)})}},{label:n("common.setting"),width:100,options:{sort:!1,customBodyRenderLite:r=>e.jsx(k,{component:"text",sx:{color:"text.link",minWidth:"fit-content"},onClick:()=>o(S[r]),children:n("common.edit")})}}],q=({page:r,rowsPerPage:d})=>{s.pageSize!==d?m(C=>({...C,pageSize:d,page:1})):s.page!==r+1&&m(C=>({...C,page:r+1}))};return l?e.jsx(H,{severity:"error",children:l.message}):x?e.jsxs(e.Fragment,{children:[e.jsxs(b,{direction:"row",sx:{alignItems:"center",gap:1,flexWrap:"wrap"},children:[e.jsx(h,{variant:"body2",children:n("admin.donate.intro")}),e.jsx(k,{variant:"text",size:"small",onClick:()=>f(!0),sx:{color:"text.link"},children:n("admin.donate.usage.viewExample")})]}),e.jsx(oe,{hasSearch:!0,durable:`__${t}__`,durableKeys:["searchText"],data:S,columns:L,options:{count:x.count,page:s.page-1,rowsPerPage:s.pageSize,onSearchChange:r=>{m(r?d=>({...d,q:{"like-mount_location":r,"like-description":r,"like-component_did":r},page:1}):d=>({...d,page:1,q:{}}))}},onChange:q}),c&&e.jsx(E,{open:!0,onClose:()=>f(!1),title:n("admin.donate.usage.title"),maxWidth:"md",sx:{".MuiDialogContent-root":{padding:0}},fullWidth:!0,children:e.jsxs(a,{sx:{p:3},children:[e.jsx(h,{variant:"body2",sx:{marginBottom:"16px"},children:n("admin.donate.usage.description")}),e.jsx(ue,{code:de}),e.jsx(h,{variant:"body2",sx:{color:"text.secondary",mt:2},children:n("admin.donate.usage.note")})]})}),i&&e.jsx(E,{open:!0,onClose:()=>o(null),title:n("admin.donate.editTitle"),maxWidth:"md",fullWidth:!0,sx:{".MuiDialogContent-root":{padding:0}},children:e.jsx(le,{item:i,onSuccess:()=>{v(),o(null)},onCancel:()=>o(null)})}),g.open&&e.jsx(se,{title:n("admin.donate.status.inactiveTitle"),message:n("admin.donate.status.inactiveTip"),onConfirm:F,onCancel:()=>u({open:!1,id:"",active:!1,mountLocation:""})})]}):e.jsx(O,{})}export{ge as default};
28
+ }`,ce=(t={})=>{const n=new URLSearchParams;return Object.keys(t).forEach(i=>{let o=t[i];i==="q"&&(o=Object.entries(o).map(c=>c.join(":")).join(" ")),n.set(i,String(o))}),D.get(`/api/settings/donate?${n.toString()}`).then(i=>i.data)};function ue({code:t}){const{t:n}=P(),i=async()=>{try{await navigator.clipboard.writeText(t),y.success(n("common.copySuccess"))}catch{y.error(n("common.copyFailed"))}};return e.jsxs(a,{sx:{position:"relative"},children:[e.jsx(a,{component:"pre",sx:{backgroundColor:"#F8F9FA",color:"#495057",borderRadius:1,p:2,overflow:"auto","&::-webkit-scrollbar":{height:8,bgcolor:"background.paper"},"&::-webkit-scrollbar-thumb":{bgcolor:"#CED4DA",borderRadius:4},fontSize:"0.875rem",fontFamily:"monospace",lineHeight:1.5,border:"1px solid #E9ECEF"},children:t}),e.jsx(M,{title:n("common.copy"),placement:"top",children:e.jsx(U,{onClick:i,sx:{position:"absolute",top:8,right:8,bgcolor:"background.paper","&:hover":{bgcolor:"#F8F9FA"}},children:e.jsx(Y,{fontSize:"small"})})})]})}function ge(){const t="donation-settings",{t:n}=P(),[i,o]=j.useState(null),[c,f]=j.useState(!1),[g,u]=j.useState({open:!1,id:"",active:!1,mountLocation:""}),p=G(t),[s,m]=K(t,{defaultValue:{o:"desc",pageSize:p.rowsPerPage||10,page:p.page?p.page+1:1}}),{error:l,data:x={list:[],count:0},refresh:v}=X(()=>ce(s)),S=x.list||[];j.useEffect(()=>{v()},[s,v]),ee("donation.updated",()=>v(),[]);const _=async(r,d)=>{if(d){u({open:!0,id:r.id,active:d,mountLocation:r.mount_location});return}try{await D.put(`/api/settings/${r.id}`,{active:!d}),I(r.mount_location),y.success(n("admin.donate.status.activeSuccess")),v()}catch(C){y.error(R(C))}},E=async()=>{try{await D.put(`/api/settings/${g.id}`,{active:!g.active}),I(g.mountLocation),y.success(n("admin.donate.status.inactiveSuccess")),v()}catch(r){y.error(R(r))}finally{u({open:!1,id:"",active:!1,mountLocation:""})}},L=[{label:n("admin.donate.component"),name:"component_did",options:{sort:!1,customBodyRenderLite:r=>{const d=window.blocklet?.componentMountPoints.find(C=>C?.did===S[r]?.component_did);return d?e.jsxs(b,{direction:"row",sx:{alignItems:"center",gap:1},children:[e.jsx(N,{src:Z(te(),`.well-known/service/blocklet/logo-bundle/${d.did}`),alt:d?.title}),e.jsx(h,{onClick:()=>window.open(d.mountPoint,"_blank"),sx:{cursor:"pointer"},children:d?.title})]}):x[r]?.component_did||n("common.none")}}},{label:n("admin.donate.mountLocation"),name:"mount_location",options:{sort:!1}},{label:n("admin.donate.description"),name:"description",options:{sort:!1}},{label:n("admin.donate.status.title"),name:"active",width:100,options:{sort:!1,customBodyRenderLite:r=>e.jsx(ne,{checked:S[r].active,onChange:()=>_(S[r],S[r].active)})}},{label:n("common.setting"),width:100,options:{sort:!1,customBodyRenderLite:r=>e.jsx(k,{component:"text",sx:{color:"text.link",minWidth:"fit-content"},onClick:()=>o(S[r]),children:n("common.edit")})}}],q=({page:r,rowsPerPage:d})=>{s.pageSize!==d?m(C=>({...C,pageSize:d,page:1})):s.page!==r+1&&m(C=>({...C,page:r+1}))};return l?e.jsx(H,{severity:"error",children:l.message}):x?e.jsxs(e.Fragment,{children:[e.jsxs(b,{direction:"row",sx:{alignItems:"center",gap:1,flexWrap:"wrap"},children:[e.jsx(h,{variant:"body2",children:n("admin.donate.intro")}),e.jsx(k,{variant:"text",size:"small",onClick:()=>f(!0),sx:{color:"text.link"},children:n("admin.donate.usage.viewExample")})]}),e.jsx(oe,{hasSearch:!0,durable:`__${t}__`,durableKeys:["searchText"],data:S,columns:L,options:{count:x.count,page:s.page-1,rowsPerPage:s.pageSize,onSearchChange:r=>{m(r?d=>({...d,q:{"like-mount_location":r,"like-description":r,"like-component_did":r},page:1}):d=>({...d,page:1,q:{}}))}},onChange:q}),c&&e.jsx(F,{open:!0,onClose:()=>f(!1),title:n("admin.donate.usage.title"),maxWidth:"md",sx:{".MuiDialogContent-root":{padding:0}},fullWidth:!0,children:e.jsxs(a,{sx:{p:3},children:[e.jsx(h,{variant:"body2",sx:{marginBottom:"16px"},children:n("admin.donate.usage.description")}),e.jsx(ue,{code:de}),e.jsx(h,{variant:"body2",sx:{color:"text.secondary",mt:2},children:n("admin.donate.usage.note")})]})}),i&&e.jsx(F,{open:!0,onClose:()=>o(null),title:n("admin.donate.editTitle"),maxWidth:"md",fullWidth:!0,sx:{".MuiDialogContent-root":{padding:0}},children:e.jsx(le,{item:i,onSuccess:()=>{v(),o(null)},onCancel:()=>o(null)})}),g.open&&e.jsx(se,{title:n("admin.donate.status.inactiveTitle"),message:n("admin.donate.status.inactiveTip"),onConfirm:E,onCancel:()=>u({open:!1,id:"",active:!1,mountLocation:""})})]}):e.jsx(O,{})}export{ge as default};
@@ -1 +1 @@
1
- import{r as K,j as e,a3 as p,A as E,a2 as _,aQ as D,aS as L,aT as A,ad as h,aR as B,q as g,ai as $,x as j,w as G,O as Y,I,cA as Q,cB as V}from"./vendor-mui-BXZut9Pz.js";import{V as F,X as M,$ as N,Y as f,O as X}from"./vendor-blocklet-D_i_QeSo.js";import{e as y,k as P,n as w,j as J,S as Z,T as ee,I as ae}from"./index-DgSc1Qy8.js";import{b as te}from"./vendor-react-BPknnnEA.js";const U={"token-data":"https://token-data.arcblock.io",coingecko:"https://api.coingecko.com/api/v3",coinmarketcap:"https://pro-api.coinmarketcap.com/v1"},ne={coinmarketcap:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",coingecko:"CG-xxxxxxxxxxxxxxxxxxxxxxxx"},W={"token-data":"Token Data",coingecko:"CoinGecko",coinmarketcap:"CoinMarketCap"};function re({provider:a,isCreate:d=!1,open:b,onClose:l,onSave:c}){const{t:r}=F(),[t,i]=M({name:a.name||"",type:a.type||"token-data",base_url:a.config?.base_url||"",api_key:a.config?.api_key||"",priority:a.priority,status:a.status,paused_reason:a.paused_reason||"",loading:!1,error:null,testing:!1,testResult:null,apiKeyTouched:!1});K.useEffect(()=>{i({name:a.name||"",type:a.type||"token-data",base_url:a.config?.base_url||"",api_key:a.config?.api_key||"",priority:a.priority,status:a.status,paused_reason:a.paused_reason||"",error:null,apiKeyTouched:!1})},[a,b]);const R=async()=>{if(d&&!t.name.trim()){i({error:r("admin.exchangeRateProvider.edit.nameRequired")});return}try{i({loading:!0,error:null});const s={name:t.name.trim(),type:t.type,priority:t.priority,status:t.status,config:{...t.base_url&&{base_url:t.base_url}}};(d||t.apiKeyTouched)&&(s.config.api_key=t.api_key),t.status==="paused"&&t.paused_reason?s.paused_reason=t.paused_reason:t.status!=="paused"&&(s.paused_reason=null),d?await y.post("/api/exchange-rate-providers",s):await y.put(`/api/exchange-rate-providers/${a.id}`,s),c()}catch(s){i({error:P(s)}),f.error(P(s))}finally{i({loading:!1})}},k=()=>{i({name:a.name||"",type:a.type||"token-data",base_url:a.config?.base_url||"",api_key:a.config?.api_key||"",priority:a.priority,status:a.status,paused_reason:a.paused_reason||"",error:null,testing:!1,testResult:null,apiKeyTouched:!1}),l()},C=async()=>{i({testing:!0,testResult:null});try{const s=await y.post("/api/exchange-rate-providers/test-connection",{type:t.type,provider_id:d?void 0:a.id,config:{...t.base_url&&{base_url:t.base_url},...t.apiKeyTouched&&{api_key:t.api_key}}});i({testResult:s.data})}catch(s){i({testResult:{success:!1,error:P(s)}})}finally{i({testing:!1})}};return e.jsx(N,{open:b,onClose:k,maxWidth:"sm",fullWidth:!0,title:d?r("admin.exchangeRateProvider.create.title"):r("admin.exchangeRateProvider.edit.title",{name:a.name}),PaperProps:{sx:{borderRadius:2}},actions:e.jsxs(p,{direction:"row",spacing:2,children:[e.jsx(j,{variant:"outlined",onClick:k,disabled:t.loading,children:r("common.cancel")}),e.jsx(j,{variant:"contained",onClick:R,disabled:t.loading,children:t.loading?r("common.saving"):r("common.save")})]}),children:e.jsxs(p,{spacing:3,children:[t.error&&e.jsx(E,{severity:"error",onClose:()=>i({error:null}),children:t.error}),e.jsx(_,{label:r("admin.exchangeRateProvider.edit.name"),value:t.name,onChange:s=>i({name:s.target.value}),helperText:r("admin.exchangeRateProvider.edit.nameHelp"),fullWidth:!0,required:!0,disabled:!1}),e.jsxs(D,{fullWidth:!0,required:!0,children:[e.jsx(L,{children:r("admin.exchangeRateProvider.edit.type")}),e.jsxs(A,{value:t.type,label:r("admin.exchangeRateProvider.edit.type"),onChange:s=>{const m=s.target.value;i(v=>{const T=d&&(!v.name||v.name===W[v.type]);return{type:m,name:T?W[m]:v.name}})},disabled:!d,children:[e.jsx(h,{value:"token-data",children:"Token Data (ArcBlock)"}),e.jsx(h,{value:"coingecko",children:"CoinGecko"}),e.jsx(h,{value:"coinmarketcap",children:"CoinMarketCap"})]}),e.jsx(B,{children:r("admin.exchangeRateProvider.edit.typeHelp")})]}),e.jsx(_,{label:r("admin.exchangeRateProvider.edit.baseUrl"),value:t.base_url,onChange:s=>i({base_url:s.target.value}),helperText:r("admin.exchangeRateProvider.edit.baseUrlHelp",{defaultUrl:U[t.type]||""}),placeholder:U[t.type]||"",fullWidth:!0}),t.type==="coinmarketcap"&&e.jsxs(p,{spacing:1,children:[e.jsx(_,{label:r("admin.exchangeRateProvider.edit.apiKey"),value:t.api_key,onChange:s=>i({api_key:s.target.value,apiKeyTouched:!0}),helperText:r("admin.exchangeRateProvider.edit.apiKeyHelp"),placeholder:ne[t.type]||"",type:"password",fullWidth:!0}),e.jsxs(g,{variant:"caption",color:"text.secondary",children:[r("admin.exchangeRateProvider.edit.apiKeyLinkText")," ",e.jsx($,{href:"https://pro.coinmarketcap.com/account",target:"_blank",rel:"noreferrer",children:r("admin.exchangeRateProvider.edit.apiKeyLinkAction")})]})]}),e.jsx(p,{direction:"row",spacing:2,alignItems:"flex-start",children:e.jsx(j,{variant:"outlined",onClick:C,disabled:t.testing,startIcon:t.testing?e.jsx(G,{size:16}):void 0,children:t.testing?r("admin.exchangeRateProvider.edit.testing"):r("admin.exchangeRateProvider.edit.testConnection")})}),t.testResult&&e.jsx(E,{severity:t.testResult.success?"success":"error",onClose:()=>i({testResult:null}),children:t.testResult.success?r("admin.exchangeRateProvider.edit.testSuccess",{time:t.testResult.responseTime,rate:t.testResult.rate,symbol:t.testResult.symbol,timestamp:t.testResult.timestamp}):r("admin.exchangeRateProvider.edit.testFailed",{error:t.testResult.error})}),e.jsx(_,{label:r("admin.exchangeRateProvider.edit.priority"),type:"number",value:t.priority,onChange:s=>{const m=parseInt(s.target.value,10);i({priority:Number.isNaN(m)?1:Math.max(1,m)})},helperText:r("admin.exchangeRateProvider.edit.priorityHelp"),fullWidth:!0,inputProps:{min:1}}),e.jsxs(D,{fullWidth:!0,children:[e.jsx(L,{children:r("admin.exchangeRateProvider.edit.status")}),e.jsxs(A,{value:t.status,label:r("admin.exchangeRateProvider.edit.status"),onChange:s=>i({status:s.target.value}),children:[e.jsx(h,{value:"active",children:r("admin.exchangeRateProvider.status.active")}),e.jsx(h,{value:"degraded",children:r("admin.exchangeRateProvider.status.degraded")}),e.jsx(h,{value:"paused",children:r("admin.exchangeRateProvider.status.paused")}),e.jsx(h,{value:"inactive",children:r("admin.exchangeRateProvider.status.inactive")})]}),e.jsx(B,{children:r("admin.exchangeRateProvider.edit.statusHelp")})]}),t.status==="paused"&&e.jsx(_,{label:r("admin.exchangeRateProvider.edit.pausedReason"),value:t.paused_reason,onChange:s=>i({paused_reason:s.target.value}),multiline:!0,rows:3,fullWidth:!0,helperText:r("admin.exchangeRateProvider.edit.pausedReasonHelp")})]})})}const ie={"token-data":"https://token-data.arcblock.io",coingecko:"https://api.coingecko.com/api/v3",coinmarketcap:"https://pro-api.coinmarketcap.com/v1"},se=()=>y.get("/api/exchange-rate-providers").then(a=>a.data),H=a=>{switch(a){case"active":return"success";case"degraded":return"warning";case"paused":return"default";case"inactive":return"error";default:return"default"}};function ue(){const{t:a}=F(),[d,b]=te(),[l,c]=M({editingProvider:null,isCreating:!1,deletingProvider:null,updatingProviderId:null,confirmDisableProvider:null}),{loading:r,error:t,data:i,refresh:R}=X(se),k=o=>{c({editingProvider:o,isCreating:!1})},C=()=>{if(c({editingProvider:null,isCreating:!1}),d.get("create")==="1"){const o=new URLSearchParams(d);o.delete("create"),b(o)}},s=async()=>{if(await R(),C(),f.success(a("common.saved")),d.get("create")==="1"){const o=new URLSearchParams(d);o.delete("create"),b(o)}},m=()=>{c({editingProvider:{id:"",name:"Token Data",type:"token-data",enabled:!0,priority:(i?.data?.length||0)+1,status:"active",paused_reason:"",config:{base_url:""},last_failure_at:null,last_success_at:null,failure_count:0,created_at:"",updated_at:""},isCreating:!0})};K.useEffect(()=>{d.get("create")==="1"&&!l.isCreating&&!l.editingProvider&&m()},[d,l.isCreating,l.editingProvider,i?.data]);const v=async()=>{if(l.deletingProvider)try{await y.delete(`/api/exchange-rate-providers/${l.deletingProvider.id}`),f.success(a("common.deleted")),await R(),c({deletingProvider:null})}catch(o){f.error(P(o))}},T=async(o,u)=>{c({updatingProviderId:o.id});try{await y.put(`/api/exchange-rate-providers/${o.id}`,{enabled:u}),f.success(a("common.saved")),await R()}catch(n){f.error(P(n))}finally{c({updatingProviderId:null})}};if(t)return e.jsx(E,{severity:"error",children:P(t)});const z=[{label:a("admin.exchangeRateProvider.table.name"),name:"name",options:{customBodyRenderLite:(o,u)=>{const n=i?.data?.[u];if(!n)return null;const x=n.config?.base_url||ie[n.type];return e.jsxs(p,{direction:"column",spacing:.5,children:[e.jsx(g,{variant:"body2",fontWeight:500,children:n.name}),x&&e.jsx(g,{variant:"caption",color:"text.secondary",children:x})]})}}},{label:a("admin.exchangeRateProvider.table.participation"),name:"participation",options:{customBodyRenderLite:(o,u)=>{const n=i?.data?.[u];if(!n)return null;const x=n.enabled&&n.status!=="paused"&&n.status!=="inactive";return e.jsx(w,{label:a(x?"admin.exchangeRateProvider.participation.included":"admin.exchangeRateProvider.participation.excluded"),color:x?"success":"default"})}}},{label:a("admin.exchangeRateProvider.table.health"),name:"health",options:{customBodyRenderLite:(o,u)=>{const n=i?.data?.[u];if(!n)return null;const x=a(`admin.exchangeRateProvider.health.${n.status}`);return n.paused_reason?e.jsx(Y,{title:n.paused_reason,arrow:!0,children:e.jsx("span",{children:e.jsx(w,{label:x,color:H(n.status)})})}):e.jsx(w,{label:x,color:H(n.status)})}}},{label:a("admin.exchangeRateProvider.table.recentActivity"),name:"recent_activity",options:{customBodyRenderLite:(o,u)=>{const n=i?.data?.[u];if(!n)return null;const x=n.last_success_at||n.last_failure_at,S=x?J(x):"-",O=1440*60*1e3,q=n.last_failure_at&&Date.now()-new Date(n.last_failure_at).getTime()<=O?n.failure_count:0;return e.jsxs(p,{direction:"column",spacing:.25,children:[e.jsx(g,{variant:"caption",color:"text.secondary",children:a("admin.exchangeRateProvider.table.lastUpdate",{time:S})}),e.jsx(g,{variant:"caption",color:"text.secondary",children:a("admin.exchangeRateProvider.table.failures24h",{count:q})})]})}}},{label:a("admin.exchangeRateProvider.table.enabled"),name:"enabled",options:{customBodyRenderLite:(o,u)=>{const n=i?.data?.[u];return n?e.jsx(Z,{checked:n.enabled,onChange:x=>{const S=x.target.checked;if(!S){c({confirmDisableProvider:n});return}T(n,S)},disabled:l.updatingProviderId===n.id,size:"small"}):null}}},{label:a("common.actions"),name:"id",options:{customBodyRenderLite:(o,u)=>{const n=i?.data?.[u];return n?e.jsxs(p,{direction:"row",spacing:.5,children:[e.jsx(I,{size:"small",onClick:()=>k(n),children:e.jsx(Q,{fontSize:"small"})}),e.jsx(I,{size:"small",onClick:()=>c({deletingProvider:n}),color:"error",children:e.jsx(V,{fontSize:"small"})})]}):null}}}];return e.jsxs(e.Fragment,{children:[e.jsx(g,{variant:"subtitle1",sx:{color:"text.secondary",whiteSpace:"break-spaces",mt:3,mb:2},children:a("admin.exchangeRateProvider.medianStrategyNote")}),e.jsx(ee,{data:i?.data||[],columns:z,loading:r,toolbar:!1,footer:!1,options:{count:i?.data?.length||0,page:0,rowsPerPage:100},emptyNodeText:a("common.noData")}),l.confirmDisableProvider&&e.jsx(ae,{title:a("admin.exchangeRateProvider.disableConfirmTitle"),message:a("admin.exchangeRateProvider.disableConfirmMessage"),onConfirm:()=>{const o=l.confirmDisableProvider;c({confirmDisableProvider:null}),T(o,!1)},onCancel:()=>c({confirmDisableProvider:null})}),l.editingProvider&&e.jsx(re,{provider:l.editingProvider,isCreate:l.isCreating,open:!!l.editingProvider,onClose:C,onSave:s}),l.deletingProvider&&e.jsx(N,{open:!!l.deletingProvider,onClose:()=>c({deletingProvider:null}),maxWidth:"sm",title:a("admin.exchangeRateProvider.delete.title"),PaperProps:{sx:{borderRadius:2}},actions:e.jsxs(p,{direction:"row",spacing:2,children:[e.jsx(j,{variant:"outlined",onClick:()=>c({deletingProvider:null}),children:a("common.cancel")}),e.jsx(j,{variant:"contained",color:"error",onClick:v,children:a("common.delete")})]}),children:e.jsx(g,{children:a("admin.exchangeRateProvider.delete.confirm",{name:l.deletingProvider.name})})})]})}export{ue as default};
1
+ import{r as K,j as e,a3 as p,A as E,a2 as _,aQ as D,aS as L,aT as A,ad as h,aR as B,q as g,ai as $,x as j,w as G,O as Y,I,cA as Q,cB as V}from"./vendor-mui-BXZut9Pz.js";import{V as F,Y as M,$ as N,Z as f,P as Z}from"./vendor-blocklet-DcLR2Cyf.js";import{e as y,k as P,n as w,j as J,S as X,T as ee,I as ae}from"./index-BarN7DfU.js";import{b as te}from"./vendor-react-BPknnnEA.js";const U={"token-data":"https://token-data.arcblock.io",coingecko:"https://api.coingecko.com/api/v3",coinmarketcap:"https://pro-api.coinmarketcap.com/v1"},ne={coinmarketcap:"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",coingecko:"CG-xxxxxxxxxxxxxxxxxxxxxxxx"},W={"token-data":"Token Data",coingecko:"CoinGecko",coinmarketcap:"CoinMarketCap"};function re({provider:a,isCreate:d=!1,open:b,onClose:l,onSave:c}){const{t:r}=F(),[t,i]=M({name:a.name||"",type:a.type||"token-data",base_url:a.config?.base_url||"",api_key:a.config?.api_key||"",priority:a.priority,status:a.status,paused_reason:a.paused_reason||"",loading:!1,error:null,testing:!1,testResult:null,apiKeyTouched:!1});K.useEffect(()=>{i({name:a.name||"",type:a.type||"token-data",base_url:a.config?.base_url||"",api_key:a.config?.api_key||"",priority:a.priority,status:a.status,paused_reason:a.paused_reason||"",error:null,apiKeyTouched:!1})},[a,b]);const R=async()=>{if(d&&!t.name.trim()){i({error:r("admin.exchangeRateProvider.edit.nameRequired")});return}try{i({loading:!0,error:null});const s={name:t.name.trim(),type:t.type,priority:t.priority,status:t.status,config:{...t.base_url&&{base_url:t.base_url}}};(d||t.apiKeyTouched)&&(s.config.api_key=t.api_key),t.status==="paused"&&t.paused_reason?s.paused_reason=t.paused_reason:t.status!=="paused"&&(s.paused_reason=null),d?await y.post("/api/exchange-rate-providers",s):await y.put(`/api/exchange-rate-providers/${a.id}`,s),c()}catch(s){i({error:P(s)}),f.error(P(s))}finally{i({loading:!1})}},k=()=>{i({name:a.name||"",type:a.type||"token-data",base_url:a.config?.base_url||"",api_key:a.config?.api_key||"",priority:a.priority,status:a.status,paused_reason:a.paused_reason||"",error:null,testing:!1,testResult:null,apiKeyTouched:!1}),l()},C=async()=>{i({testing:!0,testResult:null});try{const s=await y.post("/api/exchange-rate-providers/test-connection",{type:t.type,provider_id:d?void 0:a.id,config:{...t.base_url&&{base_url:t.base_url},...t.apiKeyTouched&&{api_key:t.api_key}}});i({testResult:s.data})}catch(s){i({testResult:{success:!1,error:P(s)}})}finally{i({testing:!1})}};return e.jsx(N,{open:b,onClose:k,maxWidth:"sm",fullWidth:!0,title:d?r("admin.exchangeRateProvider.create.title"):r("admin.exchangeRateProvider.edit.title",{name:a.name}),PaperProps:{sx:{borderRadius:2}},actions:e.jsxs(p,{direction:"row",spacing:2,children:[e.jsx(j,{variant:"outlined",onClick:k,disabled:t.loading,children:r("common.cancel")}),e.jsx(j,{variant:"contained",onClick:R,disabled:t.loading,children:t.loading?r("common.saving"):r("common.save")})]}),children:e.jsxs(p,{spacing:3,children:[t.error&&e.jsx(E,{severity:"error",onClose:()=>i({error:null}),children:t.error}),e.jsx(_,{label:r("admin.exchangeRateProvider.edit.name"),value:t.name,onChange:s=>i({name:s.target.value}),helperText:r("admin.exchangeRateProvider.edit.nameHelp"),fullWidth:!0,required:!0,disabled:!1}),e.jsxs(D,{fullWidth:!0,required:!0,children:[e.jsx(L,{children:r("admin.exchangeRateProvider.edit.type")}),e.jsxs(A,{value:t.type,label:r("admin.exchangeRateProvider.edit.type"),onChange:s=>{const m=s.target.value;i(v=>{const T=d&&(!v.name||v.name===W[v.type]);return{type:m,name:T?W[m]:v.name}})},disabled:!d,children:[e.jsx(h,{value:"token-data",children:"Token Data (ArcBlock)"}),e.jsx(h,{value:"coingecko",children:"CoinGecko"}),e.jsx(h,{value:"coinmarketcap",children:"CoinMarketCap"})]}),e.jsx(B,{children:r("admin.exchangeRateProvider.edit.typeHelp")})]}),e.jsx(_,{label:r("admin.exchangeRateProvider.edit.baseUrl"),value:t.base_url,onChange:s=>i({base_url:s.target.value}),helperText:r("admin.exchangeRateProvider.edit.baseUrlHelp",{defaultUrl:U[t.type]||""}),placeholder:U[t.type]||"",fullWidth:!0}),t.type==="coinmarketcap"&&e.jsxs(p,{spacing:1,children:[e.jsx(_,{label:r("admin.exchangeRateProvider.edit.apiKey"),value:t.api_key,onChange:s=>i({api_key:s.target.value,apiKeyTouched:!0}),helperText:r("admin.exchangeRateProvider.edit.apiKeyHelp"),placeholder:ne[t.type]||"",type:"password",fullWidth:!0}),e.jsxs(g,{variant:"caption",color:"text.secondary",children:[r("admin.exchangeRateProvider.edit.apiKeyLinkText")," ",e.jsx($,{href:"https://pro.coinmarketcap.com/account",target:"_blank",rel:"noreferrer",children:r("admin.exchangeRateProvider.edit.apiKeyLinkAction")})]})]}),e.jsx(p,{direction:"row",spacing:2,alignItems:"flex-start",children:e.jsx(j,{variant:"outlined",onClick:C,disabled:t.testing,startIcon:t.testing?e.jsx(G,{size:16}):void 0,children:t.testing?r("admin.exchangeRateProvider.edit.testing"):r("admin.exchangeRateProvider.edit.testConnection")})}),t.testResult&&e.jsx(E,{severity:t.testResult.success?"success":"error",onClose:()=>i({testResult:null}),children:t.testResult.success?r("admin.exchangeRateProvider.edit.testSuccess",{time:t.testResult.responseTime,rate:t.testResult.rate,symbol:t.testResult.symbol,timestamp:t.testResult.timestamp}):r("admin.exchangeRateProvider.edit.testFailed",{error:t.testResult.error})}),e.jsx(_,{label:r("admin.exchangeRateProvider.edit.priority"),type:"number",value:t.priority,onChange:s=>{const m=parseInt(s.target.value,10);i({priority:Number.isNaN(m)?1:Math.max(1,m)})},helperText:r("admin.exchangeRateProvider.edit.priorityHelp"),fullWidth:!0,inputProps:{min:1}}),e.jsxs(D,{fullWidth:!0,children:[e.jsx(L,{children:r("admin.exchangeRateProvider.edit.status")}),e.jsxs(A,{value:t.status,label:r("admin.exchangeRateProvider.edit.status"),onChange:s=>i({status:s.target.value}),children:[e.jsx(h,{value:"active",children:r("admin.exchangeRateProvider.status.active")}),e.jsx(h,{value:"degraded",children:r("admin.exchangeRateProvider.status.degraded")}),e.jsx(h,{value:"paused",children:r("admin.exchangeRateProvider.status.paused")}),e.jsx(h,{value:"inactive",children:r("admin.exchangeRateProvider.status.inactive")})]}),e.jsx(B,{children:r("admin.exchangeRateProvider.edit.statusHelp")})]}),t.status==="paused"&&e.jsx(_,{label:r("admin.exchangeRateProvider.edit.pausedReason"),value:t.paused_reason,onChange:s=>i({paused_reason:s.target.value}),multiline:!0,rows:3,fullWidth:!0,helperText:r("admin.exchangeRateProvider.edit.pausedReasonHelp")})]})})}const ie={"token-data":"https://token-data.arcblock.io",coingecko:"https://api.coingecko.com/api/v3",coinmarketcap:"https://pro-api.coinmarketcap.com/v1"},se=()=>y.get("/api/exchange-rate-providers").then(a=>a.data),H=a=>{switch(a){case"active":return"success";case"degraded":return"warning";case"paused":return"default";case"inactive":return"error";default:return"default"}};function ue(){const{t:a}=F(),[d,b]=te(),[l,c]=M({editingProvider:null,isCreating:!1,deletingProvider:null,updatingProviderId:null,confirmDisableProvider:null}),{loading:r,error:t,data:i,refresh:R}=Z(se),k=o=>{c({editingProvider:o,isCreating:!1})},C=()=>{if(c({editingProvider:null,isCreating:!1}),d.get("create")==="1"){const o=new URLSearchParams(d);o.delete("create"),b(o)}},s=async()=>{if(await R(),C(),f.success(a("common.saved")),d.get("create")==="1"){const o=new URLSearchParams(d);o.delete("create"),b(o)}},m=()=>{c({editingProvider:{id:"",name:"Token Data",type:"token-data",enabled:!0,priority:(i?.data?.length||0)+1,status:"active",paused_reason:"",config:{base_url:""},last_failure_at:null,last_success_at:null,failure_count:0,created_at:"",updated_at:""},isCreating:!0})};K.useEffect(()=>{d.get("create")==="1"&&!l.isCreating&&!l.editingProvider&&m()},[d,l.isCreating,l.editingProvider,i?.data]);const v=async()=>{if(l.deletingProvider)try{await y.delete(`/api/exchange-rate-providers/${l.deletingProvider.id}`),f.success(a("common.deleted")),await R(),c({deletingProvider:null})}catch(o){f.error(P(o))}},T=async(o,u)=>{c({updatingProviderId:o.id});try{await y.put(`/api/exchange-rate-providers/${o.id}`,{enabled:u}),f.success(a("common.saved")),await R()}catch(n){f.error(P(n))}finally{c({updatingProviderId:null})}};if(t)return e.jsx(E,{severity:"error",children:P(t)});const z=[{label:a("admin.exchangeRateProvider.table.name"),name:"name",options:{customBodyRenderLite:(o,u)=>{const n=i?.data?.[u];if(!n)return null;const x=n.config?.base_url||ie[n.type];return e.jsxs(p,{direction:"column",spacing:.5,children:[e.jsx(g,{variant:"body2",fontWeight:500,children:n.name}),x&&e.jsx(g,{variant:"caption",color:"text.secondary",children:x})]})}}},{label:a("admin.exchangeRateProvider.table.participation"),name:"participation",options:{customBodyRenderLite:(o,u)=>{const n=i?.data?.[u];if(!n)return null;const x=n.enabled&&n.status!=="paused"&&n.status!=="inactive";return e.jsx(w,{label:a(x?"admin.exchangeRateProvider.participation.included":"admin.exchangeRateProvider.participation.excluded"),color:x?"success":"default"})}}},{label:a("admin.exchangeRateProvider.table.health"),name:"health",options:{customBodyRenderLite:(o,u)=>{const n=i?.data?.[u];if(!n)return null;const x=a(`admin.exchangeRateProvider.health.${n.status}`);return n.paused_reason?e.jsx(Y,{title:n.paused_reason,arrow:!0,children:e.jsx("span",{children:e.jsx(w,{label:x,color:H(n.status)})})}):e.jsx(w,{label:x,color:H(n.status)})}}},{label:a("admin.exchangeRateProvider.table.recentActivity"),name:"recent_activity",options:{customBodyRenderLite:(o,u)=>{const n=i?.data?.[u];if(!n)return null;const x=n.last_success_at||n.last_failure_at,S=x?J(x):"-",q=1440*60*1e3,O=n.last_failure_at&&Date.now()-new Date(n.last_failure_at).getTime()<=q?n.failure_count:0;return e.jsxs(p,{direction:"column",spacing:.25,children:[e.jsx(g,{variant:"caption",color:"text.secondary",children:a("admin.exchangeRateProvider.table.lastUpdate",{time:S})}),e.jsx(g,{variant:"caption",color:"text.secondary",children:a("admin.exchangeRateProvider.table.failures24h",{count:O})})]})}}},{label:a("admin.exchangeRateProvider.table.enabled"),name:"enabled",options:{customBodyRenderLite:(o,u)=>{const n=i?.data?.[u];return n?e.jsx(X,{checked:n.enabled,onChange:x=>{const S=x.target.checked;if(!S){c({confirmDisableProvider:n});return}T(n,S)},disabled:l.updatingProviderId===n.id,size:"small"}):null}}},{label:a("common.actions"),name:"id",options:{customBodyRenderLite:(o,u)=>{const n=i?.data?.[u];return n?e.jsxs(p,{direction:"row",spacing:.5,children:[e.jsx(I,{size:"small",onClick:()=>k(n),children:e.jsx(Q,{fontSize:"small"})}),e.jsx(I,{size:"small",onClick:()=>c({deletingProvider:n}),color:"error",children:e.jsx(V,{fontSize:"small"})})]}):null}}}];return e.jsxs(e.Fragment,{children:[e.jsx(g,{variant:"subtitle1",sx:{color:"text.secondary",whiteSpace:"break-spaces",mt:3,mb:2},children:a("admin.exchangeRateProvider.medianStrategyNote")}),e.jsx(ee,{data:i?.data||[],columns:z,loading:r,toolbar:!1,footer:!1,options:{count:i?.data?.length||0,page:0,rowsPerPage:100},emptyNodeText:a("common.noData")}),l.confirmDisableProvider&&e.jsx(ae,{title:a("admin.exchangeRateProvider.disableConfirmTitle"),message:a("admin.exchangeRateProvider.disableConfirmMessage"),onConfirm:()=>{const o=l.confirmDisableProvider;c({confirmDisableProvider:null}),T(o,!1)},onCancel:()=>c({confirmDisableProvider:null})}),l.editingProvider&&e.jsx(re,{provider:l.editingProvider,isCreate:l.isCreating,open:!!l.editingProvider,onClose:C,onSave:s}),l.deletingProvider&&e.jsx(N,{open:!!l.deletingProvider,onClose:()=>c({deletingProvider:null}),maxWidth:"sm",title:a("admin.exchangeRateProvider.delete.title"),PaperProps:{sx:{borderRadius:2}},actions:e.jsxs(p,{direction:"row",spacing:2,children:[e.jsx(j,{variant:"outlined",onClick:()=>c({deletingProvider:null}),children:a("common.cancel")}),e.jsx(j,{variant:"contained",color:"error",onClick:v,children:a("common.delete")})]}),children:e.jsx(g,{children:a("admin.exchangeRateProvider.delete.confirm",{name:l.deletingProvider.name})})})]})}export{ue as default};
@@ -1 +1 @@
1
- import{r as f,j as c,A as S,w,q as x}from"./vendor-mui-BXZut9Pz.js";import{cu as j,V as y,N as k,O as T}from"./vendor-blocklet-D_i_QeSo.js";import{b as v,n as C,j as E,T as P,e as R}from"./index-DgSc1Qy8.js";import{w as z}from"./util-mDHAL0lx.js";import{a as L}from"./vendor-react-BPknnnEA.js";import"./lodash-B4Ozcv0x.js";const A=(a={})=>{const s=new URLSearchParams;return Object.keys(a).forEach(e=>{s.set(e,String(a[e]))}),R.get(`/api/webhook-endpoints?${s.toString()}`).then(e=>e.data)};function V(){const a="webhooks",s=j(a),{t:e}=y(),d=L(),{startTransition:g}=v(),[o,l]=k(a,{defaultValue:{active:"",pageSize:s.rowsPerPage||20,page:s.page?s.page+1:1}}),{loading:p,error:u,data:i,refresh:m}=T(()=>A(o));if(f.useEffect(()=>{m()},[o,m]),u)return c.jsx(S,{severity:"error",children:u.message});if(p||!i)return c.jsx(w,{});const h=[{label:e("admin.webhookEndpoint.url.label"),name:"url"},{label:e("common.status"),name:"status",options:{customBodyRenderLite:(r,n)=>{const t=i.list[n];return c.jsx(C,{label:t?.status,color:z(t?.status)})}}},{label:e("common.updatedAt"),name:"updated_at",options:{customBodyRender:r=>E(r)}}],b=({page:r,rowsPerPage:n})=>{o.pageSize!==n?l(t=>({...t,pageSize:n,page:1})):o.page!==r+1&&l(t=>({...t,page:r+1}))};return c.jsx(P,{durable:a,durableKeys:["page","rowsPerPage"],data:i.list,columns:h,options:{count:i.count,page:o.page-1,rowsPerPage:o.pageSize,onRowClick:(r,{dataIndex:n})=>{const t=i.list[n];g(()=>{d(`/admin/developers/${t.id}`)})}},loading:p,onChange:b,title:c.jsx(x,{variant:"h6",children:e("admin.webhookEndpoint.hosted")}),emptyNodeText:e("empty.webhooks")})}export{V as default};
1
+ import{r as f,j as c,A as S,w,q as x}from"./vendor-mui-BXZut9Pz.js";import{cv as j,V as y,O as k,P as T}from"./vendor-blocklet-DcLR2Cyf.js";import{b as v,n as P,j as C,T as E,e as R}from"./index-BarN7DfU.js";import{w as z}from"./util-DxXTXkeY.js";import{a as L}from"./vendor-react-BPknnnEA.js";import"./lodash-B4Ozcv0x.js";const A=(a={})=>{const s=new URLSearchParams;return Object.keys(a).forEach(e=>{s.set(e,String(a[e]))}),R.get(`/api/webhook-endpoints?${s.toString()}`).then(e=>e.data)};function V(){const a="webhooks",s=j(a),{t:e}=y(),d=L(),{startTransition:g}=v(),[o,l]=k(a,{defaultValue:{active:"",pageSize:s.rowsPerPage||20,page:s.page?s.page+1:1}}),{loading:p,error:u,data:i,refresh:m}=T(()=>A(o));if(f.useEffect(()=>{m()},[o,m]),u)return c.jsx(S,{severity:"error",children:u.message});if(p||!i)return c.jsx(w,{});const h=[{label:e("admin.webhookEndpoint.url.label"),name:"url"},{label:e("common.status"),name:"status",options:{customBodyRenderLite:(r,n)=>{const t=i.list[n];return c.jsx(P,{label:t?.status,color:z(t?.status)})}}},{label:e("common.updatedAt"),name:"updated_at",options:{customBodyRender:r=>C(r)}}],b=({page:r,rowsPerPage:n})=>{o.pageSize!==n?l(t=>({...t,pageSize:n,page:1})):o.page!==r+1&&l(t=>({...t,page:r+1}))};return c.jsx(E,{durable:a,durableKeys:["page","rowsPerPage"],data:i.list,columns:h,options:{count:i.count,page:o.page-1,rowsPerPage:o.pageSize,onRowClick:(r,{dataIndex:n})=>{const t=i.list[n];g(()=>{d(`/admin/developers/${t.id}`)})}},loading:p,onChange:b,title:c.jsx(x,{variant:"h6",children:e("admin.webhookEndpoint.hosted")}),emptyNodeText:e("empty.webhooks")})}export{V as default};
@@ -1 +1 @@
1
- import{r as f,j as s,w as x}from"./vendor-mui-BXZut9Pz.js";import{cu as y,V as P,N as C}from"./vendor-blocklet-D_i_QeSo.js";import{a as L,b9 as g,Y as v,n as R,j as h,T as w,e as z}from"./index-DgSc1Qy8.js";import{L as l}from"./vendor-react-BPknnnEA.js";import{F as B}from"./filter-toolbar-BydfQ-79.js";import{I as T}from"./info-card-C1yxhxJG.js";import{P as $}from"./actions-D9MHLBFH.js";import{n as q}from"./util-mDHAL0lx.js";import"./lodash-B4Ozcv0x.js";import"./product-select-0ScZE2e8.js";import"./actions-jxGAdGfb.js";import"./click-boundary-y8dVA_tr.js";import"./assign-CkV5Q2LP.js";import"./edit-3HUAnaXW.js";import"./form-P4luyUpY.js";import"./collapse-CSrlJ0eG.js";import"./currency-select-DGS-62-L.js";import"./currency-GstdXsJf.js";import"./form-BGm5NPDn.js";import"./uploader-DRXDz_r0.js";import"./tax-code-select-CWhIIiXi.js";import"./collapse-BvbJGg1V.js";const A=(n={})=>{const c=new URLSearchParams;return Object.keys(n).forEach(a=>{let m=n[a];a==="q"&&(m=Object.entries(m).map(u=>u.join(":")).join(" ")),c.set(a,String(m))}),z.get(`/api/products?${c.toString()}`).then(a=>a.data)};function at(){const n="products",c=y(n),{t:a,locale:m}=P(),{settings:u}=L(),[r,d]=C(n,{defaultValue:{active:"",pageSize:c.rowsPerPage||20,page:c.page?c.page+1:1,donation:"hide"}}),[i,j]=f.useState({}),p=()=>A(r).then(e=>{j(e)});if(g("product.created",()=>p(),[]),g("product.updated",()=>p(),[]),g("product.deleted",()=>p(),[]),f.useEffect(()=>{p()},[r]),!i.list)return s.jsx(x,{});const b=[{label:a("admin.product.name.label"),name:"name",options:{filter:!0,customBodyRenderLite:(e,o)=>{const t=i.list[o],_=v(u.paymentMethods,t.prices[0]?.currency_id??"")||u.baseCurrency;return s.jsx(l,{to:`/admin/products/${t.id}`,children:s.jsx(T,{name:t.name,description:q(t,_,m),logo:t.images[0]})})}}},{label:a("common.status"),name:"active",options:{filter:!0,customBodyRenderLite:(e,o)=>{const t=i.list[o];return s.jsx(l,{to:`/admin/products/${t.id}`,children:s.jsx(R,{label:t?.active?"Active":"Archived",color:t?.active?"success":"default"})})}}},{label:a("common.createdAt"),name:"created_at",options:{sort:!0,customBodyRenderLite:(e,o)=>{const t=i.list[o];return s.jsx(l,{to:`/admin/products/${t.id}`,children:h(t.created_at)})}}},{label:a("common.updatedAt"),name:"updated_at",options:{sort:!0,customBodyRenderLite:(e,o)=>{const t=i.list[o];return s.jsx(l,{to:`/admin/products/${t.id}`,children:h(t.updated_at)})}}},{label:a("common.actions"),name:"id",width:100,align:"center",options:{sort:!1,customBodyRenderLite:(e,o)=>{const t=i.list[o];return s.jsx($,{data:t,onChange:p})}}}],S=({page:e,rowsPerPage:o})=>{r.pageSize!==o?d(t=>({...t,pageSize:o,page:1})):r.page!==e+1&&d(t=>({...t,page:e+1}))};return s.jsx(w,{hasRowLink:!0,durable:`__${n}__`,durableKeys:["page","rowsPerPage","searchText"],title:s.jsx(B,{setSearch:d,search:r,status:["active","archived"]}),data:i.list,columns:b,options:{count:i.count,page:r.page-1,rowsPerPage:r.pageSize,onColumnSortChange(e,o){d({...r,q:r.q||{},o})},onSearchChange:e=>{d(e?{...r,q:{"like-description":e,"like-name":e},pageSize:100,page:1}:{...r,pageSize:100,page:1,q:{}})}},loading:!i.list,onChange:S})}export{at as default};
1
+ import{r as f,j as s,w as x}from"./vendor-mui-BXZut9Pz.js";import{cv as y,V as P,O as C}from"./vendor-blocklet-DcLR2Cyf.js";import{a as L,b9 as g,Y as v,n as R,j as h,T as w,e as z}from"./index-BarN7DfU.js";import{L as l}from"./vendor-react-BPknnnEA.js";import{F as B}from"./filter-toolbar-DXGSTq57.js";import{I as T}from"./info-card-BvIMFQo5.js";import{P as $}from"./actions-CSpJGOX7.js";import{n as q}from"./util-DxXTXkeY.js";import"./lodash-B4Ozcv0x.js";import"./product-select-ChEyoJqJ.js";import"./actions-BJDN6Op2.js";import"./click-boundary-CafubiPp.js";import"./assign-0vMUDW_C.js";import"./edit-Bkj-OTJh.js";import"./form-cX026J4G.js";import"./collapse-CSrlJ0eG.js";import"./currency-select-B4ieQBvv.js";import"./currency-GstdXsJf.js";import"./form-CAPjlw7l.js";import"./uploader-CsQNHG4I.js";import"./tax-code-select-TS07I0rB.js";import"./collapse-BvbJGg1V.js";const A=(n={})=>{const c=new URLSearchParams;return Object.keys(n).forEach(a=>{let m=n[a];a==="q"&&(m=Object.entries(m).map(u=>u.join(":")).join(" ")),c.set(a,String(m))}),z.get(`/api/products?${c.toString()}`).then(a=>a.data)};function at(){const n="products",c=y(n),{t:a,locale:m}=P(),{settings:u}=L(),[r,d]=C(n,{defaultValue:{active:"",pageSize:c.rowsPerPage||20,page:c.page?c.page+1:1,donation:"hide"}}),[i,j]=f.useState({}),p=()=>A(r).then(e=>{j(e)});if(g("product.created",()=>p(),[]),g("product.updated",()=>p(),[]),g("product.deleted",()=>p(),[]),f.useEffect(()=>{p()},[r]),!i.list)return s.jsx(x,{});const b=[{label:a("admin.product.name.label"),name:"name",options:{filter:!0,customBodyRenderLite:(e,o)=>{const t=i.list[o],_=v(u.paymentMethods,t.prices[0]?.currency_id??"")||u.baseCurrency;return s.jsx(l,{to:`/admin/products/${t.id}`,children:s.jsx(T,{name:t.name,description:q(t,_,m),logo:t.images[0]})})}}},{label:a("common.status"),name:"active",options:{filter:!0,customBodyRenderLite:(e,o)=>{const t=i.list[o];return s.jsx(l,{to:`/admin/products/${t.id}`,children:s.jsx(R,{label:t?.active?"Active":"Archived",color:t?.active?"success":"default"})})}}},{label:a("common.createdAt"),name:"created_at",options:{sort:!0,customBodyRenderLite:(e,o)=>{const t=i.list[o];return s.jsx(l,{to:`/admin/products/${t.id}`,children:h(t.created_at)})}}},{label:a("common.updatedAt"),name:"updated_at",options:{sort:!0,customBodyRenderLite:(e,o)=>{const t=i.list[o];return s.jsx(l,{to:`/admin/products/${t.id}`,children:h(t.updated_at)})}}},{label:a("common.actions"),name:"id",width:100,align:"center",options:{sort:!1,customBodyRenderLite:(e,o)=>{const t=i.list[o];return s.jsx($,{data:t,onChange:p})}}}],S=({page:e,rowsPerPage:o})=>{r.pageSize!==o?d(t=>({...t,pageSize:o,page:1})):r.page!==e+1&&d(t=>({...t,page:e+1}))};return s.jsx(w,{hasRowLink:!0,durable:`__${n}__`,durableKeys:["page","rowsPerPage","searchText"],title:s.jsx(B,{setSearch:d,search:r,status:["active","archived"]}),data:i.list,columns:b,options:{count:i.count,page:r.page-1,rowsPerPage:r.pageSize,onColumnSortChange(e,o){d({...r,q:r.q||{},o})},onSearchChange:e=>{d(e?{...r,q:{"like-description":e,"like-name":e},pageSize:100,page:1}:{...r,pageSize:100,page:1,q:{}})}},loading:!i.list,onChange:S})}export{at as default};
@@ -1 +1 @@
1
- import{r as j,j as a}from"./vendor-mui-BXZut9Pz.js";import{cu as S,V as v,N as y,O as L}from"./vendor-blocklet-D_i_QeSo.js";import{a as $,b9 as l,j as R,n as C,T,Y as q,v as z,e as B}from"./index-DgSc1Qy8.js";import{L as d}from"./vendor-react-BPknnnEA.js";import{F as P}from"./filter-toolbar-BydfQ-79.js";import"./lodash-B4Ozcv0x.js";import"./product-select-0ScZE2e8.js";import"./info-card-C1yxhxJG.js";const w=(m={})=>{const r=new URLSearchParams;return Object.keys(m).forEach(n=>{let i=m[n];if(n==="q"&&(i=Object.entries(i).map(s=>s.join(":")).join(" ")),n==="status"&&["active","inactive"].includes(i)){r.set("valid",i==="active"?"true":"false");return}r.set(n,String(i))}),B.get(`/api/coupons?${r.toString()}`).then(n=>n.data)};function M(){const m="coupons",r=S(m),{t:n}=v(),{settings:i}=$(),[s,u]=y(m,{defaultValue:{valid:"",pageSize:r.rowsPerPage||20,page:r.page?r.page+1:1}}),{data:f={list:[],count:0},refresh:p}=L(()=>w(s),{refreshDeps:[s]}),c=f?.list||[];l("coupon.created",()=>p(),[]),l("coupon.updated",()=>p(),[]),l("coupon.deleted",()=>p(),[]),j.useEffect(()=>{p()},[s]);const g=t=>{let o="";if(t.percent_off&&t.percent_off>0&&(o=`${t.percent_off}%`),t.amount_off&&t.amount_off!=="0"){const e=q(i.paymentMethods,t.currency_id)||i.baseCurrency;o=`${z(t.amount_off,e.decimal)} ${e.symbol}`}return o?n(`admin.coupon.couponTerms.${t.duration}`,{couponOff:o,months:t.duration_in_months}):n("admin.coupon.noDiscount")},h=[{label:n("admin.coupon.listTitle"),name:"name",options:{filter:!0,customBodyRenderLite:(t,o)=>{const e=c[o];return a.jsx(d,{to:`/admin/products/coupons/${e.id}`,children:e.name})}}},{label:n("admin.coupon.terms"),name:"terms",options:{filter:!1,customBodyRenderLite:(t,o)=>{const e=c[o];return a.jsx(d,{to:`/admin/products/coupons/${e.id}`,children:g(e)})}}},{label:n("admin.coupon.redemptions"),name:"redemptions",options:{filter:!1,customBodyRenderLite:(t,o)=>{const e=c[o],b=e.max_redemptions||n("admin.coupon.unlimited"),x=e.times_redeemed||0;return a.jsxs(d,{to:`/admin/products/coupons/${e.id}`,children:[x," / ",b]})}}},{label:n("admin.coupon.expires"),name:"expires",options:{filter:!1,customBodyRenderLite:(t,o)=>{const e=c[o];return e.redeem_by?a.jsx(d,{to:`/admin/products/coupons/${e.id}`,children:R(e.redeem_by*1e3)}):a.jsx(d,{to:`/admin/products/coupons/${e.id}`,children:"—"})}}},{label:n("common.status"),name:"valid",options:{filter:!0,customBodyRenderLite:(t,o)=>{const e=c[o];return a.jsx(d,{to:`/admin/products/coupons/${e.id}`,children:a.jsx(C,{label:e?.valid?n("common.active"):n("common.inactive"),color:e?.valid?"success":"default"})})}}}],_=({page:t,rowsPerPage:o})=>{s.pageSize!==o?u(e=>({...e,pageSize:o,page:1})):s.page!==t+1&&u(e=>({...e,page:t+1}))};return a.jsx(T,{hasRowLink:!0,durable:`__${m}__`,durableKeys:["page","rowsPerPage","searchText"],title:a.jsx(P,{setSearch:u,search:s,status:["active","inactive"]}),data:c,columns:h,options:{count:f.count,page:s.page-1,rowsPerPage:s.pageSize,onColumnSortChange(t,o){u({...s,q:s.q||{},o})},onSearchChange:t=>{u(t?{...s,q:{"like-name":t,"like-id":t},pageSize:100,page:1}:{...s,pageSize:100,page:1,q:{}})}},loading:!c,onChange:_})}export{M as default};
1
+ import{r as j,j as a}from"./vendor-mui-BXZut9Pz.js";import{cv as v,V as S,O as y,P as L}from"./vendor-blocklet-DcLR2Cyf.js";import{a as $,b9 as l,j as R,n as C,T,Y as P,v as q,e as z}from"./index-BarN7DfU.js";import{L as u}from"./vendor-react-BPknnnEA.js";import{F as B}from"./filter-toolbar-DXGSTq57.js";import"./lodash-B4Ozcv0x.js";import"./product-select-ChEyoJqJ.js";import"./info-card-BvIMFQo5.js";const w=(m={})=>{const r=new URLSearchParams;return Object.keys(m).forEach(n=>{let i=m[n];if(n==="q"&&(i=Object.entries(i).map(s=>s.join(":")).join(" ")),n==="status"&&["active","inactive"].includes(i)){r.set("valid",i==="active"?"true":"false");return}r.set(n,String(i))}),z.get(`/api/coupons?${r.toString()}`).then(n=>n.data)};function M(){const m="coupons",r=v(m),{t:n}=S(),{settings:i}=$(),[s,d]=y(m,{defaultValue:{valid:"",pageSize:r.rowsPerPage||20,page:r.page?r.page+1:1}}),{data:f={list:[],count:0},refresh:p}=L(()=>w(s),{refreshDeps:[s]}),c=f?.list||[];l("coupon.created",()=>p(),[]),l("coupon.updated",()=>p(),[]),l("coupon.deleted",()=>p(),[]),j.useEffect(()=>{p()},[s]);const g=t=>{let o="";if(t.percent_off&&t.percent_off>0&&(o=`${t.percent_off}%`),t.amount_off&&t.amount_off!=="0"){const e=P(i.paymentMethods,t.currency_id)||i.baseCurrency;o=`${q(t.amount_off,e.decimal)} ${e.symbol}`}return o?n(`admin.coupon.couponTerms.${t.duration}`,{couponOff:o,months:t.duration_in_months}):n("admin.coupon.noDiscount")},h=[{label:n("admin.coupon.listTitle"),name:"name",options:{filter:!0,customBodyRenderLite:(t,o)=>{const e=c[o];return a.jsx(u,{to:`/admin/products/coupons/${e.id}`,children:e.name})}}},{label:n("admin.coupon.terms"),name:"terms",options:{filter:!1,customBodyRenderLite:(t,o)=>{const e=c[o];return a.jsx(u,{to:`/admin/products/coupons/${e.id}`,children:g(e)})}}},{label:n("admin.coupon.redemptions"),name:"redemptions",options:{filter:!1,customBodyRenderLite:(t,o)=>{const e=c[o],b=e.max_redemptions||n("admin.coupon.unlimited"),x=e.times_redeemed||0;return a.jsxs(u,{to:`/admin/products/coupons/${e.id}`,children:[x," / ",b]})}}},{label:n("admin.coupon.expires"),name:"expires",options:{filter:!1,customBodyRenderLite:(t,o)=>{const e=c[o];return e.redeem_by?a.jsx(u,{to:`/admin/products/coupons/${e.id}`,children:R(e.redeem_by*1e3)}):a.jsx(u,{to:`/admin/products/coupons/${e.id}`,children:"—"})}}},{label:n("common.status"),name:"valid",options:{filter:!0,customBodyRenderLite:(t,o)=>{const e=c[o];return a.jsx(u,{to:`/admin/products/coupons/${e.id}`,children:a.jsx(C,{label:e?.valid?n("common.active"):n("common.inactive"),color:e?.valid?"success":"default"})})}}}],_=({page:t,rowsPerPage:o})=>{s.pageSize!==o?d(e=>({...e,pageSize:o,page:1})):s.page!==t+1&&d(e=>({...e,page:t+1}))};return a.jsx(T,{hasRowLink:!0,durable:`__${m}__`,durableKeys:["page","rowsPerPage","searchText"],title:a.jsx(B,{setSearch:d,search:s,status:["active","inactive"]}),data:c,columns:h,options:{count:f.count,page:s.page-1,rowsPerPage:s.pageSize,onColumnSortChange(t,o){d({...s,q:s.q||{},o})},onSearchChange:t=>{d(t?{...s,q:{"like-name":t,"like-id":t},pageSize:100,page:1}:{...s,pageSize:100,page:1,q:{}})}},loading:!c,onChange:_})}export{M as default};
@@ -0,0 +1 @@
1
+ import{j as t}from"./vendor-mui-BXZut9Pz.js";import{P as r}from"./list-DghnUOc4.js";import"./vendor-blocklet-DcLR2Cyf.js";import"./vendor-react-BPknnnEA.js";import"./index-BarN7DfU.js";import"./table-BrtHemkA.js";import"./util-DxXTXkeY.js";import"./lodash-B4Ozcv0x.js";import"./cache-state-lld4zuDg.js";import"./link-CmPoIweR.js";import"./filter-toolbar-DXGSTq57.js";import"./product-select-ChEyoJqJ.js";import"./info-card-BvIMFQo5.js";import"./actions-D3tJgrUn.js";import"./actions-BJDN6Op2.js";import"./click-boundary-CafubiPp.js";function d(){return t.jsx(r,{})}export{d as default};
@@ -1 +1 @@
1
- import{V as d,an as p,y as i}from"./vendor-blocklet-D_i_QeSo.js";import{j as e,a3 as v,B as x,r as E,e as r}from"./vendor-mui-BXZut9Pz.js";import{b}from"./index-DgSc1Qy8.js";import{a as T,e as f}from"./vendor-react-BPknnnEA.js";const y=r.lazy(()=>i(()=>import("./detail-DuO_Jn5X.js"),[])),D=r.lazy(()=>i(()=>import("./detail-ASPdMJoW.js"),[])),h=r.lazy(()=>i(()=>import("./detail-DVVzYhdV.js"),[])),j=r.lazy(()=>i(()=>import("./create-BkQAaSvD.js"),[])),I=r.lazy(()=>i(()=>import("./meter-event-lmNMgmIu.js"),[])),n={invoices:r.lazy(()=>i(()=>import("./index-WMKOiUez.js"),[])),subscriptions:r.lazy(()=>i(()=>import("./index-txVTkoDD.js"),[])),meters:r.lazy(()=>i(()=>import("./index-CI_EY4YS.js"),[])),"meter-events":r.lazy(()=>i(()=>import("./index-C0JaS08f.js"),[])),overdue:r.lazy(()=>i(()=>import("./index-Dr_MwbKt.js"),[]))};function z(){const l=T(),{t:s}=d(),{page:t="invoices"}=f(),{startTransition:_}=b();if(t.startsWith("sub_"))return e.jsx(y,{id:t});if(t.startsWith("in_"))return e.jsx(D,{id:t});if(t.startsWith("mtr_"))return e.jsx(h,{id:t});if(t.startsWith("mevt_"))return e.jsx(I,{id:t});const u=c=>{_(()=>{l(`/admin/billing/${c}`)})},a=n[t]||n.subscriptions,m=[{label:s("admin.invoices"),value:"invoices"},{label:s("admin.subscriptions"),value:"subscriptions"},{label:s("admin.meters"),value:"meters"},{label:s("admin.meterEvents.title"),value:"meter-events"},{label:s("admin.overdue.title"),value:"overdue"}];let o=null;return t==="meters"&&(o=e.jsx(j,{})),e.jsxs(e.Fragment,{children:[e.jsxs(v,{direction:"row",spacing:1,sx:{alignItems:"flex-start",justifyContent:"end",flexWrap:"wrap"},children:[e.jsx(p,{tabs:m,current:t,onChange:u,scrollButtons:"auto",variant:"scrollable",sx:{flex:"1 0 auto",maxWidth:"100%",".MuiTab-root":{color:"text.lighter"},".MuiTabs-indicator":{display:"none"},".Mui-selected":{fontSize:24,color:"text.primary"},".MuiTabs-hideScrollbar":{border:"none !important"},".MuiTouchRipple-root":{display:"none"}}}),e.jsx(x,{children:o})]}),E.isValidElement(a)?a:e.jsx(a,{})]})}export{z as default};
1
+ import{V as d,ao as p,A as i}from"./vendor-blocklet-DcLR2Cyf.js";import{j as e,a3 as v,B as x,r as E,e as r}from"./vendor-mui-BXZut9Pz.js";import{b}from"./index-BarN7DfU.js";import{a as T,e as f}from"./vendor-react-BPknnnEA.js";const y=r.lazy(()=>i(()=>import("./detail-CyMhK5K_.js"),[])),D=r.lazy(()=>i(()=>import("./detail-C_Zdfa0y.js"),[])),h=r.lazy(()=>i(()=>import("./detail-BwH0DwAi.js"),[])),j=r.lazy(()=>i(()=>import("./create-BJ1asdcy.js"),[])),I=r.lazy(()=>i(()=>import("./meter-event-B1JIhVpb.js"),[])),n={invoices:r.lazy(()=>i(()=>import("./index-BturOfxo.js"),[])),subscriptions:r.lazy(()=>i(()=>import("./index-CDVogp6E.js"),[])),meters:r.lazy(()=>i(()=>import("./index-DSe7Dot_.js"),[])),"meter-events":r.lazy(()=>i(()=>import("./index-C136x0O2.js"),[])),overdue:r.lazy(()=>i(()=>import("./index-BQjlhCSt.js"),[]))};function z(){const l=T(),{t:s}=d(),{page:t="invoices"}=f(),{startTransition:_}=b();if(t.startsWith("sub_"))return e.jsx(y,{id:t});if(t.startsWith("in_"))return e.jsx(D,{id:t});if(t.startsWith("mtr_"))return e.jsx(h,{id:t});if(t.startsWith("mevt_"))return e.jsx(I,{id:t});const u=c=>{_(()=>{l(`/admin/billing/${c}`)})},a=n[t]||n.subscriptions,m=[{label:s("admin.invoices"),value:"invoices"},{label:s("admin.subscriptions"),value:"subscriptions"},{label:s("admin.meters"),value:"meters"},{label:s("admin.meterEvents.title"),value:"meter-events"},{label:s("admin.overdue.title"),value:"overdue"}];let o=null;return t==="meters"&&(o=e.jsx(j,{})),e.jsxs(e.Fragment,{children:[e.jsxs(v,{direction:"row",spacing:1,sx:{alignItems:"flex-start",justifyContent:"end",flexWrap:"wrap"},children:[e.jsx(p,{tabs:m,current:t,onChange:u,scrollButtons:"auto",variant:"scrollable",sx:{flex:"1 0 auto",maxWidth:"100%",".MuiTab-root":{color:"text.lighter"},".MuiTabs-indicator":{display:"none"},".Mui-selected":{fontSize:24,color:"text.primary"},".MuiTabs-hideScrollbar":{border:"none !important"},".MuiTouchRipple-root":{display:"none"}}}),e.jsx(x,{children:o})]}),E.isValidElement(a)?a:e.jsx(a,{})]})}export{z as default};
@@ -0,0 +1 @@
1
+ import{V as p,ao as m,A as e}from"./vendor-blocklet-DcLR2Cyf.js";import{j as a,r as c,e as o}from"./vendor-mui-BXZut9Pz.js";import{b as y}from"./index-BarN7DfU.js";import{a as x,e as E}from"./vendor-react-BPknnnEA.js";const T=o.lazy(()=>e(()=>import("./detail-DbU3p040.js"),[])),f=o.lazy(()=>e(()=>import("./detail-Bfnkg0A1.js"),[])),v=o.lazy(()=>e(()=>import("./detail-B0IHl4MI.js"),[])),s={intents:o.lazy(()=>e(()=>import("./index-brUCsnBA.js"),[])),refunds:o.lazy(()=>e(()=>import("./index-DcrGSDby.js"),[])),payouts:o.lazy(()=>e(()=>import("./index-Dybqd298.js"),[]))};function D(){const r=x(),{t:n}=p(),{page:t="intents"}=E(),{startTransition:l}=y();if(t.startsWith("pi_"))return a.jsx(T,{id:t});if(t.startsWith("po_"))return a.jsx(v,{id:t});if(t.startsWith("re_"))return a.jsx(f,{id:t});const u=d=>{l(()=>{r(`/admin/payments/${d}`)})},i=s[t]||s.intents,_=[{label:n("admin.paymentIntent.list"),value:"intents"},{label:n("admin.refunds"),value:"refunds"},{label:n("admin.payouts"),value:"payouts"}];return a.jsxs("div",{children:[a.jsx(m,{tabs:_,current:t,onChange:u,scrollButtons:"auto",variant:"scrollable",sx:{".MuiTab-root":{color:"text.lighter"},".MuiTabs-indicator":{display:"none"},".Mui-selected":{fontSize:24,color:"text.primary"},".MuiTabs-hideScrollbar":{border:"none !important"},".MuiTouchRipple-root":{display:"none"}}}),c.isValidElement(i)?i:a.jsx(i,{})]})}export{D as default};