@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
package/web/index.html CHANGED
@@ -60,7 +60,7 @@ if (!window.blocklet) {
60
60
  <link rel="dns-prefetch" href="https://js.stripe.com" />
61
61
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
62
62
  <meta name="theme-color" content="#4F6AF5" />
63
- <script type="module" crossorigin src="/.well-known/payment/assets/index-DgSc1Qy8.js"></script>
63
+ <script type="module" crossorigin src="/.well-known/payment/assets/index-BarN7DfU.js"></script>
64
64
  <link rel="stylesheet" crossorigin href="/.well-known/payment/assets/style-BWb904Pt.css">
65
65
  </head>
66
66
 
@@ -1 +0,0 @@
1
- import{Z as r}from"./vendor-blocklet-D_i_QeSo.js";function s(){return r().arcSphere}export{s as u};
@@ -1 +0,0 @@
1
- import{j as e,A as I,w as L,B as s,a3 as n,bv as $,q as m,O as z,Y as c,x as B,bf as G}from"./vendor-mui-BXZut9Pz.js";import{V as P,X as H,O,Y as w}from"./vendor-blocklet-D_i_QeSo.js";import{d as U,v as q,n as C,s as F,j as x,p as k,w as Y,e as T,k as V}from"./index-DgSc1Qy8.js";import{T as X}from"./gas-Qf0SSUfS.js";import{L as f}from"./vendor-react-BPknnnEA.js";import{l as N}from"./lodash-B4Ozcv0x.js";import{C as J}from"./copyable-DpX04wZz.js";import{C as D}from"./currency-GstdXsJf.js";import{C as K}from"./link-3eeclTeS.js";import{E as Q}from"./list-D1aevUOI.js";import{I as i}from"./info-row-DOK2whMn.js";import{D as Z,R as ee,I as te}from"./related-credit-grants-BygNGPfb.js";import{I as ae}from"./action-B_DQJlip.js";import{M as se}from"./editor-BF5I0siU.js";import{M as ie}from"./list-C521zE_7.js";import{P as ne}from"./list-1OG83xc4.js";import{R as oe}from"./list-CO0X4L3-.js";import{S as d}from"./header-ivXuPt06.js";import{g as re}from"./util-mDHAL0lx.js";import{I as h}from"./info-metric-CNse3r66.js";import{I as le}from"./info-row-group-BeUhWnnY.js";import"./table-BRU4Enia.js";import"./browser-Bb9g-cvG.js";import"./usage-records-jjJMZ6DI.js";import"./actions-jxGAdGfb.js";import"./click-boundary-y8dVA_tr.js";import"./generateCategoricalChart-BaWwaXky.js";import"./form-BGm5NPDn.js";import"./cache-state-lld4zuDg.js";import"./filter-toolbar-BydfQ-79.js";import"./product-select-0ScZE2e8.js";import"./info-card-C1yxhxJG.js";import"./actions-EPYeS5p4.js";import"./actions-BtaoyTWt.js";const me=p=>T.get(`/api/invoices/${p}?sync=true`).then(a=>a.data),M="column",S="flex-start";function Fe(p){const{t:a}=P(),{isMobile:y}=U(),[j,u]=H({adding:{price:!1},editing:{metadata:!1,product:!1},loading:{metadata:!1,price:!1,product:!1}}),{loading:R,error:b,data:t,runAsync:g}=O(()=>me(p.id));if(b)return e.jsx(I,{severity:"error",children:b.message});if(R||!t)return e.jsx(L,{});const E=(o=>async r=>{try{u(l=>({loading:{...l.loading,[o]:!0}})),await T.put(`/api/invoices/${p.id}`,r).then(l=>l.data),w.success(a("common.saved")),g()}catch(l){console.error(l),w.error(V(l))}finally{u(l=>({loading:{...l.loading,[o]:!1}}))}})("metadata"),v=()=>{u(o=>({editing:{...o.editing,metadata:!0}}))},W=o=>{let r=o;return r.startsWith("Slash stake")&&(r=a("payment.invoice.reason.slashStake")),r.startsWith("Subscription ")&&(r=a(`payment.invoice.reason.${r.replace("Subscription ","")}`)),r},_=t?.checkoutSession?.submit_type==="donate",A=["open","paid","uncollectible"].includes(t.status)&&!_&&!N.isEmpty(t.lines);return e.jsxs(ce,{direction:"column",spacing:2.5,sx:{mb:4},children:[e.jsxs(s,{children:[e.jsxs(n,{className:"page-header",direction:"row",sx:{justifyContent:"space-between",alignItems:"center"},children:[e.jsxs(n,{direction:"row",onClick:()=>re("/admin/billing/invoices"),sx:{alignItems:"center",fontWeight:"normal",cursor:"pointer"},children:[e.jsx($,{fontSize:"small",sx:{mr:.5,color:"text.secondary"}}),e.jsx(m,{variant:"h6",sx:{color:"text.secondary",fontWeight:"normal"},children:a("admin.invoices")})]}),e.jsxs(s,{style:{display:"flex",gap:"10px"},children:[A&&e.jsx(Z,{data:t}),e.jsx(ae,{data:t,onChange:g,variant:"normal"})]})]}),t.status==="uncollectible"&&t.metadata?.slippage?.below_threshold&&e.jsx(I,{severity:"warning",sx:{mt:2},children:e.jsx(m,{variant:"body2",children:a("payment.customer.invoice.slippageExceededDetail",{currentRate:t.metadata.slippage.rate_at_invoice||"—",minRate:t.metadata.slippage.min_acceptable_rate||"—"})})}),e.jsxs(s,{sx:{mt:4,mb:3,display:"flex",gap:{xs:2,sm:2,md:5},flexWrap:"wrap",flexDirection:{xs:"column",sm:"column",md:"row"},alignItems:{xs:"flex-start",sm:"flex-start",md:"center"}},children:[e.jsxs(n,{direction:"column",sx:{gap:1},children:[e.jsxs(n,{direction:"row",sx:{alignItems:"center"},children:[e.jsx(m,{variant:"h2",sx:{fontWeight:600},children:t.number}),e.jsx(m,{variant:"h2",sx:{fontWeight:600,mx:1},children:"for"}),e.jsxs(m,{variant:"h2",sx:{fontWeight:600},children:[q(t.total,t.paymentCurrency.decimal)," ",t.paymentCurrency.symbol]})]}),e.jsx(J,{text:p.id,style:{marginLeft:4}})]}),e.jsxs(n,{className:"section-body",sx:{justifyContent:"flex-start",flexWrap:"wrap","hr.MuiDivider-root:last-child":{display:"none"},flexDirection:{xs:"column",sm:"column",md:"row"},alignItems:"flex-start",gap:{xs:1,sm:1,md:3}},children:[e.jsx(h,{label:a("common.status"),value:e.jsxs(n,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(C,{label:t.status,color:F(t.status)}),t.status==="uncollectible"&&t.metadata?.slippage?.below_threshold&&e.jsx(z,{title:a("payment.customer.invoice.slippageExceededDetail",{currentRate:t.metadata.slippage.rate_at_invoice||"—",minRate:t.metadata.slippage.min_acceptable_rate||"—"}),arrow:!0,placement:"top",children:e.jsx("span",{children:e.jsx(C,{label:a("payment.customer.invoice.slippageExceeded"),color:"warning"})})})]}),divider:!0}),t.subscription&&e.jsx(h,{label:a("admin.subscription.name"),value:e.jsx(f,{to:`/admin/billing/${t.subscription.id}`,children:e.jsx(m,{variant:"body1",sx:{color:"text.link"},children:t.subscription.description||t.subscription.id})}),divider:!0}),e.jsx(h,{label:a("common.createdAt"),value:x(t.created_at),divider:!0}),e.jsx(h,{label:a("admin.subscription.currentPeriod"),value:t.period_start&&t.period_end?[x(t.period_start*1e3),x(t.period_end*1e3)].join(" ~ "):""})]})]}),e.jsx(c,{})]}),e.jsxs(n,{sx:{flexDirection:{xs:"column",lg:"row"},gap:{xs:2.5,md:4},".payment-link-column-1":{minWidth:{xs:"100%",lg:"600px"}},".payment-link-column-2":{width:{xs:"100%",md:"100%",lg:"320px"},maxWidth:{xs:"100%",md:"33%"}}},children:[e.jsxs(s,{className:"payment-link-column-1",sx:{flex:1,gap:2.5,display:"flex",flexDirection:"column"},children:[e.jsxs(s,{className:"section",sx:{containerType:"inline-size"},children:[e.jsx(d,{title:a("admin.details")}),e.jsxs(le,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(1, 1fr)",xl:"repeat(2, 1fr)"},"@container (min-width: 1000px)":{gridTemplateColumns:"repeat(2, 1fr)"},".info-row-wrapper":{gap:1,flexDirection:{xs:"column",xl:"row"},alignItems:{xs:"flex-start",xl:"center"},"@container (min-width: 1000px)":{flexDirection:"row",alignItems:"center"}},".currency-name":{color:"text.secondary"}},children:[e.jsx(i,{label:a("admin.invoice.billTo"),value:e.jsx(K,{customer:t.customer,size:y?"default":"small"})}),e.jsx(i,{label:a("admin.invoice.from"),value:t.statement_descriptor||blocklet.appName}),e.jsx(i,{label:a("admin.invoice.description"),value:W(t.description||"")}),e.jsx(i,{label:a("admin.invoice.billing"),value:t.collection_method}),t.status_transitions?.finalized_at&&e.jsx(i,{label:a("admin.invoice.finalizedAt"),value:x(t.status_transitions.finalized_at*1e3)}),t.status_transitions?.paid_at&&e.jsx(i,{label:a("admin.invoice.paidAt"),value:x(t.status_transitions.paid_at*1e3)}),e.jsx(i,{label:a("admin.paymentMethod._name"),value:e.jsx(D,{logo:t.paymentMethod?.logo,name:t.paymentMethod?.name})}),e.jsx(i,{label:a("admin.paymentCurrency.name"),value:e.jsx(D,{logo:t.paymentCurrency.logo,name:`${t.paymentCurrency.symbol} (${t.paymentMethod?.name})`})}),(!!t.paymentIntent?.payment_details?.ethereum||!!t.paymentIntent?.payment_details?.base)&&e.jsx(i,{label:a("common.txGas"),value:e.jsx(X,{details:t.paymentIntent.payment_details,method:t.paymentMethod})}),t.paymentIntent&&t.paymentIntent.payment_details&&e.jsx(i,{label:a(`common.${t.paymentIntent.payment_details?.arcblock?.type||"transfer"}TxHash`),value:e.jsx(k,{details:t.paymentIntent.payment_details,method:t.paymentMethod,mode:"customer"})}),["stake","stake_overdraft_protection"].includes(t.billing_reason)&&t?.metadata?.payment_details?.arcblock?.tx_hash&&e.jsx(i,{label:a("common.stakeTxHash"),value:e.jsx(k,{details:{arcblock:{tx_hash:t.metadata?.payment_details?.arcblock?.tx_hash,payer:""}},method:t.paymentMethod})})]})]}),t?.relatedCreditGrants&&t.relatedCreditGrants.length>0&&e.jsx(ee,{grants:t.relatedCreditGrants,mode:"dashboard"}),e.jsx(c,{}),e.jsxs(s,{className:"section",children:[e.jsx(d,{title:a("admin.summary")}),e.jsx(m,{variant:"body2",sx:{color:"text.secondary",mb:2,fontSize:"0.875rem"},children:a("admin.invoice.billingContextNote")}),e.jsx(s,{className:"section-body",children:e.jsx(te,{invoice:t,emptyNodeText:a("empty.summary"),mode:"admin"})})]}),e.jsx(c,{}),_&&!N.isEmpty(t.paymentIntent?.beneficiaries)&&e.jsxs(e.Fragment,{children:[e.jsx(s,{className:"section",children:e.jsx(m,{variant:"h3",className:"section-header",children:a("customer.invoice.donation")})}),e.jsx(s,{sx:{maxWidth:800},children:e.jsx(Y,{data:t?.paymentIntent?.beneficiaries,currency:t.paymentCurrency,totalAmount:t?.amount_paid})}),e.jsx(c,{})]}),e.jsxs(s,{className:"section",children:[e.jsx(d,{title:a("admin.payments")}),e.jsx(s,{className:"section-body",children:e.jsx(ne,{features:{customer:!1,toolbar:!1},invoice_id:t.id})})]}),e.jsx(c,{}),e.jsxs(s,{className:"section",children:[e.jsx(d,{title:a("admin.refunds")}),e.jsx(s,{className:"section-body",children:e.jsx(oe,{features:{customer:!1,toolbar:!1},invoice_id:t.id})})]}),e.jsx(c,{}),e.jsxs(s,{className:"section",children:[e.jsx(d,{title:a("admin.events.title")}),e.jsx(s,{className:"section-body",children:e.jsx(Q,{features:{toolbar:!1},object_id:[t.id,t.payment_intent_id].filter(Boolean).join(",")})})]})]}),y&&e.jsx(c,{}),e.jsxs(s,{className:"payment-link-column-2",sx:{gap:2.5,display:"flex",flexDirection:"column"},children:[e.jsxs(s,{className:"section",children:[e.jsx(d,{title:a("admin.connections")}),e.jsxs(n,{children:[e.jsx(i,{label:a("admin.subscription.name"),value:t.subscription?e.jsx(f,{to:`/admin/billing/${t.subscription.id}`,children:t.subscription.id}):"",direction:M,alignItems:S}),e.jsx(i,{label:a("admin.paymentIntent.name"),value:t.payment_intent_id?e.jsx(f,{to:`/admin/payments/${t.payment_intent_id}`,children:t.payment_intent_id}):"",direction:M,alignItems:S})]})]}),e.jsx(c,{}),e.jsxs(s,{className:"section",children:[e.jsx(d,{title:a("common.metadata.label"),children:e.jsx(B,{variant:"text",color:"inherit",size:"small",sx:{color:"text.link"},disabled:j.editing.metadata,onClick:v,children:a("common.edit")})}),e.jsxs(s,{className:"section-body",children:[e.jsx(ie,{data:t.metadata,handleEditMetadata:v}),j.editing.metadata&&e.jsx(se,{data:t,loading:j.loading.metadata,onSave:E,onCancel:()=>u(o=>({editing:{...o.editing,metadata:!1}}))})]})]})]})]})]})}const ce=G(n)``;export{Fe as default};
@@ -1 +0,0 @@
1
- import{j as e,b$ as U,a3 as d,B as s,q as c,bf as C,bg as q,a7 as v,A as z,w as H,z as Y,bv as G,Y as f,x as O}from"./vendor-mui-BXZut9Pz.js";import{V as E,O as W,X,Y as A}from"./vendor-blocklet-D_i_QeSo.js";import{e as w,d as J,a as K,n as Q,j as N,b8 as Z,k as ee}from"./index-DgSc1Qy8.js";import{C as oe}from"./copyable-DpX04wZz.js";import{E as ie}from"./list-D1aevUOI.js";import{I as b}from"./info-metric-CNse3r66.js";import{I as p}from"./info-row-DOK2whMn.js";import{I as te}from"./info-row-group-BeUhWnnY.js";import{M as ne}from"./editor-BF5I0siU.js";import{M as se}from"./list-C521zE_7.js";import{S as g}from"./header-ivXuPt06.js";import{g as re}from"./util-mDHAL0lx.js";import{P as ae,C as ce,A as de,a as le}from"./currency-restrictions-DYLv4YyW.js";import{C as me}from"./link-3eeclTeS.js";import{a as pe}from"./vendor-react-BPknnnEA.js";import"./table-BRU4Enia.js";import"./lodash-B4Ozcv0x.js";import"./form-BGm5NPDn.js";import"./index-Clbt8nRm.js";import"./collapse-CSrlJ0eG.js";import"./drawer-form-Cl0T1Yyt.js";import"./currency-select-DGS-62-L.js";import"./currency-GstdXsJf.js";import"./product-select-0ScZE2e8.js";import"./form-P4luyUpY.js";import"./info-card-C1yxhxJG.js";import"./uploader-DRXDz_r0.js";import"./tax-code-select-CWhIIiXi.js";import"./collapse-BvbJGg1V.js";import"./actions-jxGAdGfb.js";import"./link-DMWJcQvZ.js";import"./description-Ym17DL48.js";import"./status-l6pD08fw.js";const xe=()=>w.get("/api/customers?limit=1000").then(t=>t.data);function ue({data:t}){const{t:o}=E(),{data:M}=W(xe,{ready:t.verification_type==="user_restricted"&&(t.customer_dids?.length??0)>0}),S=M?.list||[],k=()=>t.nft_config?e.jsxs(d,{spacing:2,children:[t.nft_config.nft_addresses&&t.nft_config.nft_addresses.length>0&&e.jsxs(j,{children:[e.jsx(h,{children:o("admin.promotionCode.nftAddresses")}),e.jsx(_,{children:t.nft_config.nft_addresses.map(n=>e.jsx(v,{label:n,size:"small",variant:"outlined",color:"default",sx:{backgroundColor:"grey.50",borderColor:"grey.300",fontFamily:"monospace",fontSize:"0.75rem",maxWidth:200}},n))})]}),t.nft_config.nft_tags&&t.nft_config.nft_tags.length>0&&e.jsxs(j,{children:[e.jsx(h,{children:o("admin.promotionCode.nftTags")}),e.jsx(_,{children:t.nft_config.nft_tags.map(n=>e.jsx(v,{label:n,size:"small",variant:"outlined",color:"primary",sx:{backgroundColor:"primary.50",fontWeight:500}},n))})]}),t.nft_config.min_balance&&e.jsxs(j,{children:[e.jsx(h,{children:o("admin.promotionCode.minBalance")}),e.jsx(c,{variant:"body2",sx:{fontWeight:"medium"},children:t.nft_config.min_balance})]})]}):e.jsx(c,{variant:"body2",sx:{color:"text.secondary"},children:o("admin.promotionCode.noNftConfig")}),x=()=>t.vc_config?e.jsxs(d,{spacing:2,children:[t.vc_config.vc_roles&&t.vc_config.vc_roles.length>0&&e.jsxs(j,{children:[e.jsx(h,{children:o("admin.promotionCode.requiredRoles")}),e.jsx(_,{children:t.vc_config.vc_roles.map(n=>e.jsx(v,{label:n,size:"small",variant:"outlined",color:"secondary",sx:{backgroundColor:"secondary.50",fontWeight:500,textTransform:"capitalize"}},n))})]}),t.vc_config.vc_trusted_issuers&&t.vc_config.vc_trusted_issuers.length>0&&e.jsxs(j,{children:[e.jsx(h,{children:o("admin.promotionCode.trustedIssuers")}),e.jsx(_,{children:t.vc_config.vc_trusted_issuers.map(n=>e.jsx(v,{label:n,size:"small",variant:"outlined",color:"info",sx:{backgroundColor:"info.50",fontFamily:"monospace",fontSize:"0.75rem",maxWidth:200}},n))})]})]}):e.jsx(c,{variant:"body2",sx:{color:"text.secondary"},children:o("admin.promotionCode.noVcConfig")}),l=()=>t.customer_dids?.length?e.jsxs(j,{children:[e.jsx(h,{children:o("admin.promotionCode.allowedUsers")}),e.jsx(ge,{children:t.customer_dids.map(n=>{const i=S.find(u=>u.did===n||u.id===n);return i?e.jsx(me,{customer:i,size:"small",cardProps:{sx:{border:"none",p:0,minWidth:0}}},n):e.jsx(v,{label:n,size:"small",variant:"outlined",color:"default",sx:{maxWidth:200,backgroundColor:"grey.50",borderColor:"grey.300"}},n)})})]}):e.jsx(c,{variant:"body2",sx:{color:"text.secondary"},children:o("admin.promotionCode.noUsersSpecified")}),I=()=>{switch(t.verification_type){case"nft":return k();case"vc":return x();case"user_restricted":return l();default:return e.jsx(c,{variant:"body2",sx:{color:"text.secondary",fontStyle:"italic"},children:o("admin.promotionCode.codeVerificationOnly")})}};return e.jsx(fe,{children:e.jsx(U,{children:e.jsxs(d,{spacing:2,children:[e.jsxs(s,{sx:{display:"flex",flexDirection:{xs:"column",sm:"row"},gap:{xs:1,sm:2},alignItems:{xs:"flex-start",sm:"center"}},children:[e.jsx(c,{variant:"caption",sx:{color:"text.secondary"},children:o("admin.promotionCode.verificationType")}),e.jsx(c,{variant:"subtitle2",sx:{color:"text.primary",fontWeight:"medium"},children:o(`admin.promotionCode.verificationTypeMap.${t.verification_type}`)})]}),I()]})})})}const fe=C(q)(({theme:t})=>({border:`1px solid ${t.palette.divider}`,boxShadow:"none",backgroundColor:t.palette.background.paper})),j=C(s)({display:"flex",flexDirection:"column",gap:8}),h=C(c)(({theme:t})=>({fontSize:"0.875rem",fontWeight:500,color:t.palette.text.secondary})),_=C(s)({display:"flex",flexDirection:"row",flexWrap:"wrap",gap:8}),ge=C(s)({display:"flex",flexDirection:"row",flexWrap:"wrap",gap:8,alignItems:"center"}),je=t=>w.get(`/api/promotion-codes/${t}`).then(o=>o.data),he=t=>w.get(`/api/coupons/${t}`).then(o=>o.data);function eo(t){const{t:o}=E(),{isMobile:M}=J(),S=pe(),{settings:k}=K(),[x,l]=X({editing:{metadata:!1},loading:{metadata:!1},editModalOpen:!1}),{loading:I,error:n,data:i,runAsync:u}=W(()=>je(t.id)),{data:m}=W(()=>i?.coupon_id?he(i.coupon_id):Promise.resolve(null),{refreshDeps:[i?.coupon_id]});if(n)return e.jsx(z,{severity:"error",children:n.message});if(I||!i)return e.jsx(H,{});const T=(()=>{const r=k.paymentMethods?.flatMap(y=>y.payment_currencies)||[];if(!m||m.percent_off)return r;const a=new Set;return m.currency_id&&a.add(m.currency_id),m.currency_options&&typeof m.currency_options=="object"&&Object.keys(m.currency_options).forEach(y=>{a.add(y)}),r.filter(y=>a.has(y.id))})(),$=async r=>{try{l(a=>({loading:{...a.loading,metadata:!0}})),await w.put(`/api/promotion-codes/${t.id}`,{metadata:r.metadata}),A.success(o("common.saved")),Z("promotion-code.updated"),u()}catch(a){console.error(a),A.error(ee(a))}finally{l(a=>({loading:{...a.loading,metadata:!1}}))}},D=()=>{l(r=>({editing:{...r.editing,metadata:!0}}))},P=(r,a)=>{r==="edit"&&a?l({editModalOpen:!0}):u()},B=()=>{l({editModalOpen:!1})},L=()=>{l({editModalOpen:!1}),u()},V=()=>{const r=i.expires_at&&Math.floor(Date.now()/1e3)>i.expires_at,a=i.max_redemptions&&i.times_redeemed>=i.max_redemptions;return r?{label:o("admin.promotionCode.expired"),color:"default"}:a?{label:o("admin.promotionCode.maxedOut"),color:"default"}:i.active?{label:o("admin.promotionCode.active"),color:"success"}:{label:o("admin.promotionCode.inactive"),color:"default"}},F=()=>{const r=i.max_redemptions?i.max_redemptions.toString():o("admin.promotionCode.unlimited");return`${i.times_redeemed||0}/${r}`},R=V();return e.jsxs(Ce,{direction:"column",spacing:2.5,sx:{mb:4},children:[e.jsxs(s,{children:[!i.active&&e.jsxs(z,{severity:"warning",children:[e.jsx(Y,{children:o("admin.promotionCode.inactiveTitle")}),o("admin.promotionCode.inactiveTip")]}),e.jsxs(d,{className:"page-header",direction:"row",sx:{justifyContent:"space-between",alignItems:"center"},children:[e.jsxs(d,{direction:"row",onClick:()=>re("/admin/products/coupons"),sx:{alignItems:"center",fontWeight:"normal",cursor:"pointer"},children:[e.jsx(G,{fontSize:"small",sx:{mr:.5,color:"text.secondary"}}),e.jsx(c,{variant:"h6",sx:{color:"text.secondary",fontWeight:"normal"},children:o("admin.coupons")})]}),e.jsx(d,{direction:"row",spacing:2,children:e.jsx(ae,{data:i,onChange:P,variant:"normal"})})]}),e.jsxs(s,{sx:{mt:4,mb:3,display:"flex",gap:{xs:2,sm:2,md:5},flexWrap:"wrap",flexDirection:{xs:"column",sm:"column",md:"row"},alignItems:{xs:"flex-start",sm:"flex-start",md:"center"}},children:[e.jsx(d,{direction:"column",sx:{alignItems:"flex-start",justifyContent:"space-around"},children:e.jsx(c,{variant:"h2",sx:{color:"text.primary",fontFamily:"monospace",letterSpacing:1},children:i.code})}),e.jsxs(d,{className:"section-body",sx:{justifyContent:"flex-start",flexWrap:"wrap","hr.MuiDivider-root:last-child":{display:"none"},flexDirection:{xs:"column",sm:"column",md:"row"},alignItems:"flex-start",gap:{xs:1,sm:1,md:3}},children:[e.jsx(b,{label:o("admin.promotionCode.id"),value:e.jsx(oe,{text:t.id,style:{marginLeft:4}}),divider:!0}),e.jsx(b,{label:o("admin.promotionCode.redemptions"),value:F(),divider:!0}),e.jsx(b,{label:o("admin.promotionCode.status"),value:e.jsx(Q,{label:R.label,color:R.color}),divider:!0}),e.jsx(b,{label:o("admin.promotionCode.verificationType"),value:o(`admin.promotionCode.verificationTypeMap.${i.verification_type}`),divider:!0}),e.jsx(b,{label:o("admin.promotionCode.created"),value:N(i.created_at),divider:!0})]})]}),e.jsx(f,{})]}),e.jsxs(d,{sx:{flexDirection:{xs:"column",lg:"row"},gap:{xs:2.5,md:4},".promotion-code-column-1":{minWidth:{xs:"100%",lg:"600px"}},".promotion-code-column-2":{width:{xs:"100%",md:"100%",lg:"320px"},maxWidth:{xs:"100%",md:"33%"}}},children:[e.jsxs(s,{className:"promotion-code-column-1",sx:{flex:1,gap:2.5,display:"flex",flexDirection:"column"},children:[e.jsxs(s,{className:"section",children:[e.jsx(g,{title:o("common.details")}),e.jsxs(te,{children:[e.jsx(p,{label:o("common.active"),value:i.active?o("admin.promotionCode.yes"):o("admin.promotionCode.no")}),i.description&&e.jsx(p,{label:o("admin.coupon.desc"),value:i.description}),e.jsx(p,{label:o("admin.promotionCode.couponId"),value:e.jsx(O,{variant:"text",color:"inherit",size:"small",sx:{color:"secondary.main"},onClick:()=>S(`/admin/products/coupons/${i.coupon_id}`),children:i.coupon_id})}),e.jsx(p,{label:o("admin.promotionCode.maxRedemptions"),value:i.max_redemptions||o("admin.promotionCode.unlimited")}),e.jsx(p,{label:o("admin.promotionCode.timesRedeemed"),value:i.times_redeemed||0}),e.jsx(p,{label:o("admin.promotionCode.expires"),value:i.expires_at?N(i.expires_at*1e3):o("admin.promotionCode.never")}),e.jsx(p,{label:o("admin.promotionCode.updated"),value:N(i.updated_at)})]})]}),e.jsx(f,{}),e.jsxs(s,{className:"section",children:[e.jsx(g,{title:o("admin.promotionCode.verificationConfig")}),e.jsx(s,{className:"section-body",children:e.jsx(ue,{data:i})})]}),i.restrictions?.currency_options&&Object.keys(i.restrictions.currency_options).length>0&&e.jsxs(e.Fragment,{children:[e.jsx(f,{}),e.jsxs(s,{className:"section",children:[e.jsx(g,{title:o("admin.coupon.currencies")}),e.jsx(s,{className:"section-body",children:e.jsx(ce,{currencyOptions:i.restrictions.currency_options,type:"promotion_code"})})]})]}),e.jsx(f,{}),e.jsxs(s,{className:"section",children:[e.jsx(g,{title:o("admin.coupon.activeRedemptions")}),e.jsx(s,{className:"section-body",children:e.jsx(de,{promotionCodeId:i.id})})]}),e.jsx(f,{}),e.jsxs(s,{className:"section",children:[e.jsx(g,{title:o("common.events")}),e.jsx(s,{className:"section-body",children:e.jsx(ie,{features:{toolbar:!1},object_id:i.id})})]})]}),M&&e.jsx(f,{}),e.jsx(s,{className:"promotion-code-column-2",sx:{gap:2.5,display:"flex",flexDirection:"column"},children:e.jsxs(s,{className:"section",children:[e.jsx(g,{title:o("common.metadata.label"),children:e.jsx(O,{variant:"text",color:"inherit",size:"small",sx:{color:"text.link"},disabled:x.editing.metadata,onClick:D,children:o("common.edit")})}),e.jsxs(s,{className:"section-body",children:[e.jsx(se,{data:i.metadata,handleEditMetadata:D}),x.editing.metadata&&e.jsx(ne,{data:i,loading:x.loading.metadata,onSave:$,onCancel:()=>l(r=>({editing:{...r.editing,metadata:!1}}))})]})]})})]}),e.jsx(le,{open:x.editModalOpen,onClose:B,onSubmit:L,couponId:i.coupon_id,promotionCode:i,isEditing:!0,availableCurrencies:T})]})}const Ce=C(d)``;export{eo as default};
@@ -1 +0,0 @@
1
- import{j as e,A as E,w as P,B as r,a3 as o,bv as R,q as w,N as W,Y as x,O as H,be as U,x as q,bf as G}from"./vendor-mui-BXZut9Pz.js";import{V,X as Y,O as F,cv as J,a6 as C,Y as k}from"./vendor-blocklet-D_i_QeSo.js";import{d as X,i as K,a5 as Q,n as _,a6 as M,a7 as Z,N as ee,j as S,p as te,e as A,k as ae}from"./index-DgSc1Qy8.js";import{T as se}from"./gas-Qf0SSUfS.js";import{L as ne}from"./vendor-react-BPknnnEA.js";import{C as ie}from"./copyable-DpX04wZz.js";import{C as oe}from"./link-3eeclTeS.js";import{E as re}from"./list-D1aevUOI.js";import{I as N}from"./info-metric-CNse3r66.js";import{I as i}from"./info-row-DOK2whMn.js";import{M as le}from"./editor-BF5I0siU.js";import{M as me}from"./list-C521zE_7.js";import{S as p}from"./header-ivXuPt06.js";import{g as ce,l as de}from"./util-mDHAL0lx.js";import{I as D}from"./info-card-C1yxhxJG.js";import{I as xe}from"./info-row-group-BeUhWnnY.js";import"./table-BRU4Enia.js";import"./lodash-B4Ozcv0x.js";import"./form-BGm5NPDn.js";const pe=d=>A.get(`/api/payouts/${d}`).then(a=>a.data),m="column",c="flex-start";function Le(d){const{t:a,locale:T}=V(),{isMobile:j}=X(),[f,u]=Y({adding:{price:!1},editing:{metadata:!1,product:!1},loading:{metadata:!1,price:!1,product:!1}}),{loading:$,error:y,data:t,runAsync:z}=F(()=>pe(d.id));if(y)return e.jsx(E,{severity:"error",children:y.message});if($||!t)return e.jsx(P,{});const L=(n=>async B=>{try{u(l=>({loading:{...l.loading,[n]:!0}})),await A.put(`/api/payouts/${d.id}`,B).then(l=>l.data),k.success(a("common.saved")),z()}catch(l){console.error(l),k.error(ae(l))}finally{u(l=>({loading:{...l.loading,[n]:!1}}))}})("metadata"),g=t.paymentCurrency,h=[K(t?.amount,g.decimal),g.symbol].join(" "),b=()=>{u(n=>({editing:{...n.editing,metadata:!0}}))},{paymentIntent:s}=t||{},O=()=>{if(t.customer)return e.jsx(oe,{customer:t.customer});const n=de(t.destination);return n?e.jsx(D,{name:n.name,description:e.jsx(C,{did:t.destination}),logo:n.avatar,size:40}):t.destination},I=s?.customer?.metadata?.anonymous,v=s?.customer?.did||s?.metadata?.payerDid||"";return e.jsxs(ue,{direction:"column",spacing:2.5,mb:4,children:[e.jsxs(r,{children:[e.jsx(o,{className:"page-header",direction:"row",sx:{justifyContent:"space-between",alignItems:"center"},children:e.jsxs(o,{direction:"row",onClick:()=>ce("/admin/payments/payouts"),sx:{alignItems:"center",fontWeight:"normal",cursor:"pointer"},children:[e.jsx(R,{fontSize:"small",sx:{mr:.5,color:"text.secondary"}}),e.jsx(w,{variant:"h6",sx:{color:"text.secondary",fontWeight:"normal"},children:a("admin.payouts")})]})}),e.jsxs(r,{sx:{mt:4,mb:3,display:"flex",gap:{xs:2,sm:2,md:5},flexWrap:"wrap",flexDirection:{xs:"column",sm:"column",md:"row"},alignItems:{xs:"flex-start",sm:"flex-start",md:"center"}},children:[e.jsx(o,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center"},children:e.jsx(o,{direction:"row",sx:{alignItems:"center"},children:e.jsxs(o,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(W,{src:t.paymentCurrency.logo,alt:t.paymentCurrency.symbol,variant:"square",sx:{width:"52px",height:"52px",borderRadius:.5}}),e.jsxs(o,{direction:"column",sx:{alignItems:"flex-start",justifyContent:"space-around"},children:[e.jsx(Q,{amount:h,sx:{my:0,fontSize:"1.75rem",lineHeight:"32px"}}),e.jsx(ie,{text:d.id})]})]})})}),e.jsxs(o,{className:"section-body",sx:{justifyContent:"flex-start",flexWrap:"wrap","hr.MuiDivider-root:last-child":{display:"none"},flexDirection:{xs:"column",sm:"column",md:"row"},alignItems:"flex-start",gap:{xs:1,sm:1,md:3}},children:[e.jsx(N,{label:a("common.status"),value:e.jsx(_,{label:t.status,color:M(t.status)}),divider:!0}),s?.id&&e.jsx(N,{label:a("customer.payout.payer"),value:e.jsx(D,{variant:"circular",logo:ee(s?.customer?.did,s?.customer?.updated_at?new Date(s?.customer?.updated_at).toISOString():"",48),logoName:s?.customer?.metadata?.anonymous?"":s?.customer?.name,name:e.jsxs(w,{variant:"subtitle2",sx:{...I?{}:{cursor:"pointer","&:hover":{color:"text.link"}}},onClick:()=>{if(I)return;const n=Z(s?.customer?.did,T);window.open(n,"_blank")},children:[s?.customer?.name,s?.customer?.email?` (${s?.customer?.email})`:""]}),description:J(v)&&e.jsx(C,{did:v,...j?{responsive:!1,compact:!0}:{}}),size:40}),divider:!0})]})]}),e.jsx(x,{})]}),e.jsxs(o,{sx:{flexDirection:{xs:"column",lg:"row"},gap:{xs:2.5,md:4},".payment-link-column-1":{minWidth:{xs:"100%",lg:"600px"}},".payment-link-column-2":{width:{xs:"100%",md:"100%",lg:"320px"},maxWidth:{xs:"100%",md:"33%"}}},children:[e.jsxs(r,{className:"payment-link-column-1",sx:{flex:1,gap:2.5,display:"flex",flexDirection:"column"},children:[e.jsxs(r,{className:"section",sx:{containerType:"inline-size"},children:[e.jsx(p,{title:a("admin.details")}),e.jsxs(xe,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(1, 1fr)",xl:"repeat(2, 1fr)"},"@container (min-width: 1000px)":{gridTemplateColumns:"repeat(2, 1fr)"},".info-row-wrapper":{gap:1,flexDirection:{xs:"column",xl:"row"},alignItems:{xs:"flex-start",xl:"center"},"@container (min-width: 1000px)":{flexDirection:"row",alignItems:"center"}}},children:[e.jsx(i,{label:a("common.status"),value:e.jsxs(o,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(_,{label:t.status,color:M(t.status)}),t.last_attempt_error&&e.jsx(H,{title:e.jsx("pre",{style:{whiteSpace:"break-spaces"},children:JSON.stringify(t.last_attempt_error,null,2)}),children:e.jsx(U,{fontSize:"small",color:"error"})})]})}),e.jsx(i,{label:a("common.amount"),value:h}),e.jsx(i,{label:a("common.customer"),value:O()}),e.jsx(i,{label:a("common.createdAt"),value:S(t.created_at)}),e.jsx(i,{label:a("common.description"),value:t.description}),e.jsx(i,{label:a("common.updatedAt"),value:S(t.updated_at)})]})]}),e.jsx(x,{}),e.jsxs(r,{className:"section",children:[e.jsx(p,{title:a("admin.events.title")}),e.jsx(r,{className:"section-body",children:e.jsx(re,{features:{toolbar:!1},object_id:t.id})})]})]}),j&&e.jsx(x,{}),e.jsxs(r,{className:"payment-link-column-2",sx:{gap:2.5,display:"flex",flexDirection:"column"},children:[e.jsxs(r,{className:"section",children:[e.jsx(p,{title:a("admin.paymentMethod._name")}),e.jsxs(o,{children:[e.jsx(i,{label:a("common.id"),value:t.paymentMethod?.id,direction:m,alignItems:c}),e.jsx(i,{label:a("admin.paymentMethod.type"),value:t.paymentMethod?.type,direction:m,alignItems:c}),e.jsx(i,{label:a("admin.paymentCurrency.name"),value:`${t.paymentCurrency.symbol} (${t.paymentMethod?.name})`,direction:m,alignItems:c}),(!!t.payment_details?.ethereum||!!t.payment_details?.base)&&e.jsx(i,{label:a("common.txGas"),value:e.jsx(se,{details:t.payment_details,method:t.paymentMethod}),direction:m,alignItems:c}),e.jsx(i,{label:a(`common.${t.payment_details?.arcblock?.type||"transfer"}TxHash`),value:e.jsx(te,{details:t.payment_details,method:t.paymentMethod}),direction:m,alignItems:c})]})]}),e.jsx(x,{}),e.jsxs(r,{className:"section",children:[e.jsx(p,{title:a("admin.connections")}),e.jsx(o,{children:t.payment_intent_id?e.jsx(i,{label:a("admin.paymentIntent.name"),value:e.jsx(ne,{to:`/admin/payments/${t.paymentIntent.id}`,children:t.paymentIntent.id}),direction:m,alignItems:c}):a("common.none")})]}),e.jsx(x,{}),e.jsxs(r,{className:"section",children:[e.jsx(p,{title:a("common.metadata.label"),children:e.jsx(q,{variant:"text",color:"inherit",size:"small",sx:{color:"text.link"},disabled:f.editing.metadata,onClick:b,children:a("common.edit")})}),e.jsxs(r,{className:"section-body",children:[e.jsx(me,{data:t.metadata,handleEditMetadata:b}),f.editing.metadata&&e.jsx(le,{data:t,loading:f.loading.metadata,onSave:L,onCancel:()=>u(n=>({editing:{...n.editing,metadata:!1}}))})]})]})]})]})]})}const ue=G(o)``;export{Le as default};
@@ -1 +0,0 @@
1
- import{j as e,B as x,a3 as w,ck as re,a2 as F,N as se,q as I,x as T,r as M,cD as ue,bp as K,bs as fe,bt as te,bg as pe,a1 as xe,aF as ge,A as H,aN as he,aM as ae,w as ye,z as ve,bv as je,Y as $,cA as be,bf as Ce}from"./vendor-mui-BXZut9Pz.js";import{V as G,X as Q,$ as _e,A as y,Y,N as De,O as ie,G as ne}from"./vendor-blocklet-D_i_QeSo.js";import{d as Z,aW as W,N as oe,e as _,k as J,a as de,j as U,T as le,Y as we,n as ke,h as Se,F as Me}from"./index-DgSc1Qy8.js";import{C as Ee}from"./copyable-DpX04wZz.js";import{I as q}from"./info-metric-CNse3r66.js";import{I as z}from"./info-row-DOK2whMn.js";import{I as Te}from"./info-row-group-BeUhWnnY.js";import{M as Ae}from"./editor-BF5I0siU.js";import{M as Ie}from"./list-C521zE_7.js";import{M as Pe}from"./actions-DJyfN5OU.js";import{S as B}from"./header-ivXuPt06.js";import{n as Ye,g as Le}from"./util-mDHAL0lx.js";import{L as R,a as Oe}from"./vendor-react-BPknnnEA.js";import{R as ze,A as Re,C as Ne,a as $e,D as Be,g as Fe}from"./overview-Cs3-8n4e.js";import{C as We}from"./link-3eeclTeS.js";import{X as He,Y as Ue,T as Ge}from"./generateCategoricalChart-BaWwaXky.js";import Ve from"./create-Bs65p5Ne.js";import{I as Xe}from"./info-card-C1yxhxJG.js";import{P as qe}from"./actions-D9MHLBFH.js";import{M as Ke}from"./form-DSzMo9UD.js";import{D as Je}from"./drawer-form-Cl0T1Yyt.js";import"./lodash-B4Ozcv0x.js";import"./form-BGm5NPDn.js";import"./actions-jxGAdGfb.js";import"./click-boundary-y8dVA_tr.js";import"./currency-select-DGS-62-L.js";import"./currency-GstdXsJf.js";import"./collapse-CSrlJ0eG.js";import"./form-P4luyUpY.js";import"./product-select-0ScZE2e8.js";import"./uploader-DRXDz_r0.js";import"./tax-code-select-CWhIIiXi.js";import"./collapse-BvbJGg1V.js";import"./assign-CkV5Q2LP.js";import"./edit-3HUAnaXW.js";const Qe=c=>_.post("/api/meter-events",{event_name:c.event_name,payload:{customer_id:c.customer_id,value:c.value,subscription_id:c.subscription_id||void 0},timestamp:c.timestamp,identifier:`manual_${Date.now()}`,metadata:{source:"manual",created_by:"admin"},source_data:[{key:"origin",label:"created_by",value:"Admin",type:"text"}]}).then(a=>a.data);function Ze({open:c,onClose:a,meterId:d,customers:r,onSuccess:C}){const{t:n}=G(),{isMobile:m}=Z("md"),[i,g]=Q({loading:!1,form:{customer_id:"",value:"",subscription_id:"",timestamp:new Date}}),k=l=>l.name||l.email||l.did||l.id,s=()=>{g({form:{customer_id:"",value:"",subscription_id:"",timestamp:new Date}}),a()},o=async()=>{if(!i.form.customer_id||!i.form.value){Y.error(n("admin.meterEvent.add.validation"));return}g({loading:!0});try{const p=(await _.get(`/api/meters/${d}`)).data;await Qe({event_name:p.event_name,customer_id:i.form.customer_id,value:i.form.value,subscription_id:i.form.subscription_id,timestamp:y(i.form.timestamp).unix()}),Y.success(n("admin.meterEvent.add.success")),s(),C()}catch(l){console.error("Failed to add usage:",l),Y.error(J(l))}finally{g({loading:!1})}};return e.jsx(_e,{open:c,onClose:s,maxWidth:"sm",fullWidth:!0,fullScreen:m,title:n("admin.meterEvent.add.title"),actions:e.jsxs(e.Fragment,{children:[e.jsx(T,{onClick:s,variant:"outlined",disabled:i.loading,children:n("common.cancel")}),e.jsx(T,{onClick:o,variant:"contained",disabled:i.loading,children:n("admin.meterEvent.add.submit")})]}),children:e.jsx(x,{children:e.jsxs(w,{spacing:3,children:[e.jsxs(x,{children:[e.jsx(W,{sx:{color:"text.primary"},children:n("admin.meterEvent.add.customerId")}),e.jsx(re,{options:r,getOptionLabel:k,value:r.find(l=>l.id===i.form.customer_id)||null,onChange:(l,p)=>g({form:{...i.form,customer_id:p?.id||""}}),renderOption:(l,p)=>e.jsxs(x,{component:"li",...l,sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(se,{src:oe(p.did,p?.updated_at?new Date(p.updated_at).toISOString():void 0,24),sx:{width:24,height:24},alt:k(p)}),k(p)]}),renderInput:l=>e.jsx(F,{...l,placeholder:n("admin.meterEvent.add.customerIdPlaceholder"),fullWidth:!0})})]}),e.jsxs(x,{children:[e.jsx(W,{sx:{color:"text.primary"},children:n("admin.meterEvent.add.value")}),e.jsx(F,{type:"number",fullWidth:!0,value:i.form.value,onChange:l=>g({form:{...i.form,value:l.target.value}}),placeholder:n("admin.meterEvent.add.valuePlaceholder")})]}),e.jsxs(x,{children:[e.jsx(W,{sx:{color:"text.primary"},children:n("admin.meterEvent.add.subscriptionId")}),e.jsx(F,{fullWidth:!0,value:i.form.subscription_id,onChange:l=>g({form:{...i.form,subscription_id:l.target.value}}),placeholder:n("admin.meterEvent.add.subscriptionIdPlaceholder")}),e.jsx(I,{variant:"caption",sx:{color:"text.secondary",mt:.5,display:"block"},children:n("admin.meterEvent.add.subscriptionIdHint")})]}),e.jsxs(x,{children:[e.jsx(W,{sx:{color:"text.primary"},children:n("admin.meterEvent.add.timestamp")}),e.jsx(F,{type:"datetime-local",fullWidth:!0,value:y(i.form.timestamp).format("YYYY-MM-DDTHH:mm"),onChange:l=>g({form:{...i.form,timestamp:new Date(l.target.value)}}),InputLabelProps:{shrink:!0}}),e.jsx(I,{variant:"caption",sx:{color:"text.secondary",mt:.5,display:"block"},children:n("admin.meterEvent.add.timestampHint")})]})]})})})}const et=(c,a={})=>{const d=new URLSearchParams;return d.append("meter_id",c),a.page!==void 0&&d.append("page",String(a.page)),a.pageSize!==void 0&&d.append("pageSize",String(a.pageSize)),a.start!==void 0&&d.append("start",String(a.start)),a.end!==void 0&&d.append("end",String(a.end)),a.customer_id&&d.append("customer_id",a.customer_id),_.get(`/api/meter-events?${d.toString()}`).then(r=>r.data)},tt=(c,a,d,r,C)=>{const n=new URLSearchParams;return n.append("meter_id",c),n.append("start",a.toString()),n.append("end",d.toString()),r&&n.append("customer_id",r),C&&n.append("granularity",C),_.get(`/api/meter-events/stats?${n.toString()}`).then(m=>m.data)},at=()=>_.get("/api/customers?limit=100").then(c=>c.data),nt=(c,a,d)=>{const r=[],C=y(c),n=y(a),m=y();if(d==="hour"){let i=C.startOf("hour");const g=n.isAfter(m)?m:n;for(;i.isBefore(g)||i.isSame(g,"hour");)r.push({date:i.format("HH:mm"),fullDate:i.format("YYYY-MM-DD HH:mm"),timestamp:i.unix().toString(),event_count:0,total_value:0}),i=i.add(1,"hour")}else{let i=C.startOf("day");const g=n.isAfter(m,"day")?m.startOf("day"):n;for(;i.isBefore(g)||i.isSame(g,"day");)r.push({date:i.format("MM/DD"),fullDate:i.format("YYYY-MM-DD"),timestamp:i.unix().toString(),event_count:0,total_value:0}),i=i.add(1,"day")}return r};function rt({meterId:c,paymentCurrency:a}){const{t:d}=G(),{isMobile:r}=Z("md"),{livemode:C}=de(),n=y().endOf("day").toDate(),[m,i]=De(`meter-events-${c}`,{defaultValue:{pageSize:10,page:1,start:y().subtract(30,"day").startOf("day").unix(),end:y().endOf("day").unix()}}),{data:g={list:[],count:0},refresh:k,loading:s}=ie(()=>et(c,m),{refreshDeps:[m]}),[o,l]=Q({stats:[],customers:[],statsLoading:!1,anchorEl:null,startDate:y().subtract(30,"day").startOf("day").toDate(),endDate:n,selectedCustomer:null,chartType:"event_count",addUsageDialog:!1}),p=M.useMemo(()=>{const t=y(o.startDate);return y(o.endDate).diff(t,"day")===0?"hour":"day"},[o.startDate,o.endDate]),P=M.useMemo(()=>{if(o.statsLoading)return[];const t=nt(o.startDate,o.endDate,p);if(!o.stats.length)return t;const u=new Map;return o.stats.forEach(f=>{let D,X;p==="hour"?(D=y(f.timestamp).format("HH:mm"),X=y(f.timestamp).format("YYYY-MM-DD HH:mm")):(D=y(f.timestamp).format("MM/DD"),X=y(f.timestamp).format("YYYY-MM-DD")),u.set(D,{...f,date:D,fullDate:X})}),t.map(f=>u.get(f.date)||f)},[o.stats,o.statsLoading,o.startDate,o.endDate,p]),A=async()=>{l({statsLoading:!0});try{const t=await tt(c,y(o.startDate).unix(),y(o.endDate).unix(),o.selectedCustomer?.id,p);l({stats:t.list,statsLoading:!1})}catch(t){console.error("Failed to fetch stats:",t),l({statsLoading:!1})}},N=async()=>{try{const t=await at();if(l({customers:t.list}),m.customer_id&&t.list.length>0){const u=t.list.find(f=>f.id===m.customer_id);u&&l({selectedCustomer:u})}}catch(t){console.error("Failed to fetch customers:",t)}};M.useEffect(()=>{N()},[c]),M.useEffect(()=>{m?.start&&m?.end&&l({startDate:y.unix(m.start).toDate(),endDate:y.unix(m.end).toDate()})},[m?.start,m?.end]),M.useEffect(()=>{A()},[o.startDate,o.endDate,o.selectedCustomer,p]);const h=({page:t,rowsPerPage:u})=>{m.pageSize!==u?i(f=>({...f,pageSize:u,page:1})):m.page!==t+1&&i(f=>({...f,page:t+1}))},v=t=>{o.anchorEl?l({anchorEl:null}):l({anchorEl:t.currentTarget})},L=t=>{const u=y(t.startDate).startOf("day").unix(),f=y(t.endDate).endOf("day").unix();i(D=>({...D,start:u,end:f,page:1})),l({startDate:t.startDate,endDate:y(t.endDate).endOf("day").toDate(),anchorEl:null})},S=(t,u)=>{u!==null&&l({chartType:u})},O=t=>{i(u=>({...u,customer_id:t?.id,page:1})),l({selectedCustomer:t})},E=t=>t.name||t.email||t.did||t.id,b=()=>{l({addUsageDialog:!0})},j=()=>{l({addUsageDialog:!1})},V=()=>{k(),A()},ee=!!o.anchorEl,ce=ee?"date-range-picker-popover":void 0,me=[{label:d("admin.meter.events.value"),name:"value",options:{filter:!1,sort:!1,customBodyRenderLite:(t,u)=>{const f=g.list[u];if(!f)return null;const D=ne(f.payload.value||"0",a.decimal);return e.jsx(R,{to:`/admin/billing/${f.id}`,children:`${D} ${a.symbol}`})}}},{label:d("admin.meter.events.customer"),name:"customer",options:{filter:!1,sort:!1,customBodyRenderLite:(t,u)=>{const f=g.list[u];return!f||!f?.customer?"-":e.jsx(We,{customer:f.customer,size:"small"})}}},{label:d("admin.meter.events.subscription"),name:"subscription",options:{filter:!1,sort:!1,customBodyRenderLite:(t,u)=>{const f=g.list[u];if(!f)return"-";const D=f.payload?.subscription_id;return D?e.jsx(R,{to:`/admin/billing/${D}`,children:e.jsx(I,{variant:"body2",sx:{color:"text.link"},children:f?.subscription?.description||D})}):"-"}}},{label:d("admin.meter.events.reportTime"),name:"created_at",options:{filter:!1,sort:!1,customBodyRenderLite:(t,u)=>{const f=g.list[u];return e.jsx(R,{to:`/admin/billing/${f?.id}`,children:f?U(f.created_at):"-"})}}}];return e.jsxs(x,{children:[e.jsxs(x,{sx:{mb:3},children:[e.jsxs(w,{direction:r?"column":"row",spacing:2,sx:{alignItems:r?"stretch":"center",flexWrap:"wrap"},children:[e.jsxs(T,{variant:"outlined",startIcon:e.jsx(ue,{}),onClick:v,size:"large",sx:{minWidth:r?"100%":200,justifyContent:r?"flex-start":"center",color:"text.secondary",borderColor:"grey.300","&:hover":{borderColor:"primary.main"},backgroundColor:"grey.50"},children:[y(o.startDate).format("YYYY-MM-DD")," - ",y(o.endDate).format("YYYY-MM-DD")]}),e.jsx(re,{options:o.customers,getOptionLabel:E,value:o.selectedCustomer,onChange:(t,u)=>O(u),sx:{minWidth:r?"100%":200,flex:r?1:"none"},renderInput:t=>e.jsx(F,{...t,label:d("admin.meter.events.filterByCustomer"),size:"small"}),renderOption:(t,u)=>e.jsxs(x,{component:"li",...t,sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(se,{src:oe(u.did,u?.updated_at?new Date(u.updated_at).toISOString():void 0,24),sx:{width:24,height:24},alt:E(u)}),E(u)]})}),!C&&e.jsx(T,{variant:"outlined",startIcon:e.jsx(K,{}),onClick:b,sx:{minWidth:r?"100%":"auto",color:"text.link"},children:d("admin.meterEvent.add.button")})]}),e.jsx(x,{sx:{mt:2,display:"flex",justifyContent:r?"center":"flex-end"},children:e.jsxs(fe,{value:o.chartType,exclusive:!0,onChange:S,size:"small",sx:{width:r?"100%":"auto","& .MuiToggleButton-root":{flex:r?1:"none"}},children:[e.jsx(te,{value:"event_count",children:d("admin.meter.events.eventCount")}),e.jsx(te,{value:"total_value",children:d("admin.meter.events.totalValue")})]})})]}),e.jsx(pe,{sx:{mb:3},children:e.jsx(x,{sx:{height:r?250:300,position:"relative",pr:r?1:2,pl:r?.5:1},children:o.statsLoading?e.jsx(x,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:e.jsx(xe,{variant:"rectangular",width:"100%",height:"100%"})}):e.jsx(ze,{width:"100%",height:"100%",children:e.jsxs(Re,{data:P,margin:{top:10,right:r?10:30,left:r?5:10,bottom:p==="hour"?r?50:60:r?30:40},children:[e.jsx(Ne,{strokeDasharray:"3 3"}),e.jsx(He,{dataKey:"date",tick:{fontSize:r?10:11},angle:p==="hour"?-45:0,textAnchor:p==="hour"?"end":"middle",height:p==="hour"?r?50:60:r?30:40,interval:(()=>{const t=P.length;return r?t>20?Math.floor(t/6):t>10?Math.floor(t/4):t>5?1:0:p==="hour"?t>24?Math.floor(t/12):t>12?1:0:t>30?Math.floor(t/15):t>15?1:0})()}),e.jsx(Ue,{tick:{fontSize:r?9:11},width:r?35:40,tickFormatter:t=>r&&t>=1e3?`${(t/1e3).toFixed(1)}k`:t.toString()}),e.jsx(Ge,{labelFormatter:t=>P.find(f=>f.date===t)?.fullDate||t,formatter:(t,u)=>[u==="event_count"?t:ne(t,a.decimal),d(u==="event_count"?"admin.meter.events.eventCount":"admin.meter.events.totalValue")],contentStyle:{fontSize:r?"12px":"14px",padding:r?"8px":"10px"}}),e.jsx($e,{type:"monotone",dataKey:o.chartType,stroke:o.chartType==="event_count"?"#8884d8":"#82ca9d",fill:o.chartType==="event_count"?"#8884d8":"#82ca9d",fillOpacity:.6,strokeWidth:r?1.5:2})]})})})}),e.jsx(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2},children:e.jsx(I,{variant:"body2",sx:{color:"text.secondary"},children:d("admin.meter.events.count",{count:g.count})})}),e.jsx(le,{data:g.list,columns:me,onChange:h,options:{count:g.count,page:m.page-1,rowsPerPage:m.pageSize,responsive:r?"vertical":"standard"},loading:s,emptyNodeText:d("admin.meter.events.empty")}),e.jsx(ge,{id:ce,open:ee,anchorEl:o.anchorEl,onClose:()=>l({anchorEl:null}),anchorOrigin:{vertical:"bottom",horizontal:"right"},children:e.jsx(Be,{open:!0,toggle:v,maxDate:n,definedRanges:Fe(n.toISOString()),onChange:L})}),e.jsx(Ze,{open:o.addUsageDialog,onClose:j,meterId:c,customers:o.customers,paymentCurrency:a,onSuccess:V})]})}const st=c=>_.get(`/api/products?meter_id=${c}`).then(a=>a.data),it=c=>_.get(`/api/products?type=credit&meter_id=${c}`).then(a=>a.data);function ot({meterId:c,meter:a=void 0}){const{t:d,locale:r}=G(),{settings:C}=de(),[n,m]=M.useState([]),[i,g]=M.useState(!1),[k,s]=M.useState(!1),[o,l]=M.useState(null),[p,P]=M.useState("credit"),A=async(E=p)=>{g(!0),l(null);try{const b=E==="meter"?await st(c):await it(c);m(b.list)}catch(b){console.error("Failed to fetch products:",b),l("Failed to load products")}finally{g(!1)}};M.useEffect(()=>{A()},[c,p]);const N=(E,b)=>{P(b)},h=()=>{s(!0)},v=()=>{s(!1),A()};if(o)return e.jsx(H,{severity:"error",sx:{mt:1},children:o});const L=[{label:d("admin.product.name.label"),name:"name",options:{filter:!1,customBodyRenderLite:(E,b)=>{const j=n[b];if(!j)return null;const V=we(C.paymentMethods,j.prices[0]?.currency_id??"")||C.baseCurrency;return e.jsx(R,{to:`/admin/products/${j.id}`,children:e.jsx(Xe,{name:j.name,description:Ye(j,V,r),logo:j.images[0]})})}}},{label:d("common.status"),name:"active",options:{filter:!1,customBodyRenderLite:(E,b)=>{const j=n[b];return j?e.jsx(R,{to:`/admin/products/${j.id}`,children:e.jsx(ke,{label:j?.active?"Active":"Archived",color:j?.active?"success":"default"})}):null}}},{label:d("common.createdAt"),name:"created_at",options:{sort:!1,customBodyRenderLite:(E,b)=>{const j=n[b];return j?e.jsx(R,{to:`/admin/products/${j.id}`,children:U(j.created_at)}):null}}},{label:d("common.actions"),name:"id",width:100,align:"center",options:{sort:!1,customBodyRenderLite:(E,b)=>{const j=n[b];return j?e.jsx(qe,{data:j,onChange:()=>A()}):null}}}],O=p==="meter"?{text:d("admin.meter.products.emptyTip"),buttonText:d("admin.meter.products.create")}:{text:d("admin.meter.creditProducts.emptyTip"),buttonText:d("admin.creditProduct.create")};return e.jsxs(x,{children:[e.jsx(w,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center"},children:e.jsxs(he,{value:p,onChange:N,sx:{flex:"1 0 auto",maxWidth:"100%",fontSize:14,borderBottom:1,borderColor:"divider",".Mui-selected":{fontSize:"14px !important",color:"primary.main"}},children:[e.jsx(ae,{label:d("admin.meter.products.creditCharge"),value:"credit"}),e.jsx(ae,{label:d("admin.meter.products.meterService"),value:"meter"})]})}),e.jsx(w,{direction:"row",sx:{justifyContent:"flex-end",mb:2},children:e.jsx(T,{variant:"text",color:"inherit",size:"small",sx:{color:"text.link",float:"right"},startIcon:e.jsx(K,{}),onClick:h,children:d(p==="meter"?"admin.meter.products.create":"admin.creditProduct.create")})}),e.jsx(le,{hasRowLink:!0,data:n,columns:L,options:{count:n.length,page:0,rowsPerPage:n.length,pagination:!1,search:!1,filter:!1,sort:!1,viewColumns:!1,download:!1,print:!1,selectableRows:"none"},loading:i,emptyNodeText:e.jsxs(x,{children:[e.jsx(I,{children:O.text}),e.jsx(T,{size:"small",variant:"text",startIcon:e.jsx(K,{}),onClick:h,sx:{mt:1,color:"text.link"},children:O.buttonText})]})}),k&&e.jsx(Ve,{open:k,onClose:v,onSubmit:()=>A(p),mode:p==="credit"?"credit":"standard",meterId:c,initialPrice:p==="meter"?{currency_id:a?.currency_id||"",priceModel:"credit_metered"}:{metadata:{credit_config:{currency_id:a?.currency_id||""}},name:a?.unit||""}})]})}const dt=c=>_.get(`/api/meters/${c}`).then(a=>a.data);function Ut(c){const{t:a}=G(),{isMobile:d}=Z(),r=Oe(),C=h=>{switch(h){case"sum":return a("admin.meter.aggregationMethod.sumHint");case"count":return a("admin.meter.aggregationMethod.countHint");case"last":return a("admin.meter.aggregationMethod.lastHint");default:return""}},[n,m]=Q({editing:{metadata:!1,meter:!1},loading:{metadata:!1,meter:!1},creating:{product:!1,creditProduct:!1},tokenConfig:{name:"",symbol:"",tokenFactoryAddress:""}}),i=Se({defaultValues:{name:"",event_name:"",aggregation_method:"sum",unit:"",description:"",metadata:{},mode:"OffChain"}}),{loading:g,error:k,data:s,runAsync:o}=ie(()=>dt(c.id));if(k)return e.jsx(H,{severity:"error",children:k.message});if(g||!s)return e.jsx(ye,{});const l=async h=>{try{m(v=>({loading:{...v.loading,metadata:!0}})),await _.put(`/api/meters/${c.id}`,h),Y.success(a("common.saved")),o()}catch(v){console.error(v),Y.error(J(v))}finally{m(v=>({loading:{...v.loading,metadata:!1}}))}},p=h=>{h==="delete"?r("/admin/billing/meters"):o()},P=()=>{m(h=>({editing:{...h.editing,metadata:!0}}))},A=()=>{const h=!!s.paymentCurrency?.token_config;i.reset({name:s.name,event_name:s.event_name,aggregation_method:s.aggregation_method,unit:s.unit,description:s.description||"",metadata:s.metadata||{},mode:h?"OnChain":"OffChain"}),m(v=>({editing:{...v.editing,meter:!0},tokenConfig:{name:"",symbol:"",tokenFactoryAddress:""}}))},N=async h=>{try{m(S=>({loading:{...S.loading,meter:!0}}));const v=s.paymentCurrency?.id,L=!!s.paymentCurrency?.token_config;if(v&&!L&&h.mode==="OnChain"){let{tokenFactoryAddress:S}=n.tokenConfig;if(!S&&n.tokenConfig.symbol){const{data:O}=await _.post("/api/credit-tokens",{name:n.tokenConfig.name,symbol:n.tokenConfig.symbol});S=O.address}S&&await _.put(`/api/payment-currencies/${v}/token-config`,{token_factory_address:S})}v&&L&&h.mode==="OffChain"&&await _.delete(`/api/payment-currencies/${v}/token-config`),delete h.mode,await _.put(`/api/meters/${c.id}`,h),Y.success(a("admin.meter.saved")),m(S=>({editing:{...S.editing,meter:!1}})),o()}catch(v){console.error(v),Y.error(J(v))}finally{m(v=>({loading:{...v.loading,meter:!1}}))}};return e.jsxs(lt,{direction:"column",spacing:2.5,sx:{mb:4},children:[e.jsxs(x,{children:[s.status==="inactive"&&e.jsxs(H,{severity:"warning",sx:{mb:2},children:[e.jsx(ve,{children:a("admin.meter.inactive")}),a("admin.meter.inactiveTip")]}),e.jsxs(w,{className:"page-header",direction:"row",sx:{justifyContent:"space-between",alignItems:"center"},children:[e.jsxs(w,{direction:"row",onClick:()=>Le("/admin/meters"),sx:{alignItems:"center",fontWeight:"normal",cursor:"pointer"},children:[e.jsx(je,{fontSize:"small",sx:{mr:.5,color:"text.secondary"}}),e.jsx(I,{variant:"h6",sx:{color:"text.secondary",fontWeight:"normal"},children:a("admin.meters")})]}),e.jsx(Pe,{data:s,variant:"normal",onChange:p})]}),e.jsxs(x,{sx:{mt:4,mb:3,display:"flex",gap:{xs:2,sm:2,md:5},flexWrap:"wrap",flexDirection:{xs:"column",sm:"column",md:"row"},alignItems:{xs:"flex-start",sm:"flex-start",md:"center"}},children:[e.jsx(w,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center"},children:e.jsx(w,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsxs(w,{direction:"column",sx:{alignItems:"flex-start",justifyContent:"space-around"},children:[e.jsx(I,{variant:"h2",sx:{color:"text.primary"},children:s.name}),e.jsxs(I,{variant:"subtitle1",sx:{color:"text.lighter"},children:[s.event_name," • ",s.unit]})]})})}),e.jsxs(w,{className:"section-body",sx:{justifyContent:"flex-start",flexWrap:"wrap","hr.MuiDivider-root:last-child":{display:"none"},flexDirection:{xs:"column",sm:"column",md:"row"},alignItems:"flex-start",gap:{xs:1,sm:1,md:3}},children:[e.jsx(q,{label:a("common.id"),value:e.jsx(Ee,{text:c.id,style:{marginLeft:4}}),divider:!0}),e.jsx(q,{label:a("common.createdAt"),value:U(s.created_at),divider:!0}),s.paymentCurrency?.recharge_config?.base_price_id&&e.jsx(q,{label:a("admin.meter.rechargePackage.priceId"),tip:a("admin.meter.rechargePackage.tooltip",{name:s.paymentCurrency.name}),value:e.jsx(T,{variant:"text",size:"small",onClick:()=>r(`/admin/products/${s.paymentCurrency.recharge_config.base_price_id}`),sx:{p:0,minWidth:"auto",textAlign:"left",ml:.5,color:"text.link"},children:s.paymentCurrency.recharge_config.base_price_id}),divider:!0})]})]}),e.jsx($,{})]}),e.jsxs(w,{sx:{flexDirection:{xs:"column",lg:"row"},gap:{xs:2.5,md:4},".meter-column-1":{minWidth:{xs:"100%",lg:"600px"}},".meter-column-2":{width:{xs:"100%",md:"100%",lg:"320px"},maxWidth:{xs:"100%",md:"33%"}}},children:[e.jsxs(x,{className:"meter-column-1",sx:{flex:1,gap:2.5,display:"flex",flexDirection:"column"},children:[e.jsxs(x,{className:"section",sx:{containerType:"inline-size"},children:[e.jsx(B,{title:a("admin.details"),children:e.jsx(T,{variant:"text",color:"inherit",size:"small",sx:{color:"text.link"},disabled:n.editing.meter,onClick:A,children:a("common.edit")})}),e.jsxs(Te,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(1, 1fr)",xl:"repeat(2, 1fr)"},"@container (min-width: 1000px)":{gridTemplateColumns:"repeat(2, 1fr)"},".info-row-wrapper":{gap:1,flexDirection:{xs:"column",xl:"row"},alignItems:{xs:"flex-start",xl:"center"},"@container (min-width: 1000px)":{flexDirection:"row",alignItems:"center"}}},children:[e.jsx(z,{label:a("admin.meter.name.label"),value:s.name}),e.jsx(z,{label:a("admin.meter.eventName.label"),value:s.event_name}),e.jsx(z,{label:a("admin.meter.aggregationMethod.label"),value:s.aggregation_method}),e.jsx(z,{label:a("admin.meter.unit.label"),value:s.unit}),e.jsx(z,{label:a("admin.meter.description.label"),value:s.description||"-"}),e.jsx(z,{label:a("common.updatedAt"),value:U(s.updated_at)})]})]}),e.jsx($,{}),e.jsxs(x,{className:"section",children:[e.jsx(B,{title:a("admin.meter.events.title")}),e.jsx(x,{className:"section-body",children:e.jsx(rt,{meterId:s.id,paymentCurrency:s.paymentCurrency})})]}),e.jsx($,{}),e.jsxs(x,{className:"section",children:[e.jsx(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:e.jsx(B,{title:a("admin.meter.products.title")})}),e.jsx(x,{className:"section-body",children:e.jsx(ot,{meterId:s.id,meter:s})})]})]}),d&&e.jsx($,{}),e.jsxs(x,{className:"meter-column-2",sx:{gap:2.5,display:"flex",flexDirection:"column"},children:[e.jsxs(x,{className:"section",children:[e.jsx(B,{title:a("admin.meter.usageGuide.title")}),e.jsx(x,{className:"section-body",children:e.jsx(H,{severity:"info",sx:{mb:2},children:e.jsx(I,{variant:"body2",children:a("admin.meter.usageGuide.tip",{eventName:s.event_name,aggregationMethodHint:C(s.aggregation_method),unit:s.unit})})})})]}),e.jsx($,{}),e.jsxs(x,{className:"section",children:[e.jsx(B,{title:a("common.metadata.label"),children:e.jsx(T,{variant:"text",color:"inherit",size:"small",sx:{color:"text.link"},disabled:n.editing.metadata,onClick:P,children:a("common.edit")})}),e.jsxs(x,{className:"section-body",children:[e.jsx(Ie,{data:s.metadata,handleEditMetadata:P}),n.editing.metadata&&e.jsx(Ae,{data:s,loading:n.loading.metadata,onSave:l,onCancel:()=>m(h=>({editing:{...h.editing,metadata:!1}}))})]})]})]})]}),n.editing.meter&&e.jsx(Je,{icon:e.jsx(be,{}),text:a("admin.meter.edit"),open:n.editing.meter,onClose:()=>m(h=>({editing:{...h.editing,meter:!1}})),width:640,addons:e.jsx(T,{variant:"contained",size:"small",disabled:n.loading.meter,onClick:i.handleSubmit(N),children:a("admin.meter.save")}),children:e.jsx(Me,{...i,children:e.jsx(Ke,{mode:"edit",paymentCurrency:s.paymentCurrency,tokenConfig:n.tokenConfig,onTokenConfigChange:h=>m({tokenConfig:h})})})})]})}const lt=Ce(w)``;export{Ut as default};
@@ -1 +0,0 @@
1
- import{j as e,A as P,w as R,B as s,a3 as n,bv as $,q as E,N as B,Y as r,O,be as W,x as z,bf as H}from"./vendor-mui-BXZut9Pz.js";import{V as q,X as G,O as U,cv as V,a6 as Y,Y as I}from"./vendor-blocklet-D_i_QeSo.js";import{d as F,i as w,a5 as J,n as _,o as C,j as N,p as X,e as k,k as K}from"./index-DgSc1Qy8.js";import{T as Q}from"./gas-Qf0SSUfS.js";import{L as M}from"./vendor-react-BPknnnEA.js";import{l as Z}from"./lodash-B4Ozcv0x.js";import{C as ee}from"./copyable-DpX04wZz.js";import{C as te}from"./link-3eeclTeS.js";import{E as ae}from"./list-D1aevUOI.js";import{I as S}from"./info-metric-CNse3r66.js";import{I as i}from"./info-row-DOK2whMn.js";import{M as se}from"./editor-BF5I0siU.js";import{M as ie}from"./list-C521zE_7.js";import{P as ne}from"./actions-EPYeS5p4.js";import{P as oe}from"./list-DnePqZ2K.js";import{S as l}from"./header-ivXuPt06.js";import{g as re}from"./util-mDHAL0lx.js";import{R as le}from"./list-CO0X4L3-.js";import{I as me}from"./info-row-group-BeUhWnnY.js";import"./table-BRU4Enia.js";import"./form-BGm5NPDn.js";import"./actions-jxGAdGfb.js";import"./click-boundary-y8dVA_tr.js";import"./cache-state-lld4zuDg.js";import"./filter-toolbar-BydfQ-79.js";import"./product-select-0ScZE2e8.js";import"./info-card-C1yxhxJG.js";import"./actions-BtaoyTWt.js";const ce=x=>k.get(`/api/payment-intents/${x}`).then(a=>a.data),m="column",c="flex-start";function ze(x){const{t:a}=q(),{isMobile:f}=F(),[j,p]=G({adding:{price:!1},editing:{metadata:!1,product:!1},loading:{metadata:!1,price:!1,product:!1}}),{loading:D,error:y,data:t,runAsync:h}=U(()=>ce(x.id));if(y)return e.jsx(P,{severity:"error",children:y.message});if(D||!t)return e.jsx(R,{});const A=(d=>async L=>{try{p(o=>({loading:{...o.loading,[d]:!0}})),await k.put(`/api/payment-intents/${x.id}`,L).then(o=>o.data),I.success(a("common.saved")),h()}catch(o){console.error(o),I.error(K(o))}finally{p(o=>({loading:{...o.loading,[d]:!1}}))}})("metadata"),u=t.paymentCurrency,g=[w(t?.amount_received,u.decimal),u.symbol].join(" "),b=[w(t?.amount,u.decimal),u.symbol].join(" "),v=()=>{p(d=>({editing:{...d.editing,metadata:!0}}))},T=t.subscription?.status==="canceled";return e.jsxs(de,{direction:"column",spacing:2.5,mb:4,children:[e.jsxs(s,{children:[e.jsxs(n,{className:"page-header",direction:"row",sx:{justifyContent:"space-between",alignItems:"center"},children:[e.jsxs(n,{direction:"row",onClick:()=>re("/admin/payments/intents"),sx:{alignItems:"center",fontWeight:"normal",cursor:"pointer"},children:[e.jsx($,{fontSize:"small",sx:{mr:.5,color:"text.secondary"}}),e.jsx(E,{variant:"h6",sx:{color:"text.secondary",fontWeight:"normal"},children:a("admin.payments")})]}),e.jsx(ne,{data:t,variant:"normal",onChange:h})]}),e.jsxs(s,{sx:{mt:4,mb:3,display:"flex",gap:{xs:2,sm:2,md:5},flexWrap:"wrap",flexDirection:{xs:"column",sm:"column",md:"row"},alignItems:{xs:"flex-start",sm:"flex-start",md:"center"}},children:[e.jsx(n,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center"},children:e.jsxs(n,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(B,{src:t.paymentCurrency.logo,alt:t.paymentCurrency.symbol,variant:"square",sx:{width:"52px",height:"52px",borderRadius:.5}}),e.jsxs(n,{direction:"column",sx:{alignItems:"flex-start",justifyContent:"space-around"},children:[e.jsx(J,{amount:t?.amount_received==="0"?b:g,sx:{my:0,fontSize:"1.75rem",lineHeight:"32px"}}),e.jsx(ee,{text:x.id})]})]})}),e.jsxs(n,{className:"section-body",sx:{justifyContent:"flex-start",flexWrap:"wrap","hr.MuiDivider-root:last-child":{display:"none"},flexDirection:{xs:"column",sm:"column",md:"row"},alignItems:"flex-start",gap:{xs:1,sm:1,md:3}},children:[e.jsx(S,{label:a("common.status"),value:e.jsx(_,{label:t.status,color:C(t.status)}),divider:!0}),e.jsx(S,{label:a("common.customer"),value:t.metadata?.payerDid&&V(t.metadata?.payerDid)?e.jsx(Y,{did:t.metadata?.payerDid,...f?{responsive:!1,compact:!0}:{}}):e.jsx(te,{customer:t.customer}),divider:!0})]})]}),e.jsx(r,{})]}),e.jsxs(n,{sx:{flexDirection:{xs:"column",lg:"row"},gap:{xs:2.5,md:4},".payment-link-column-1":{minWidth:{xs:"100%",lg:"600px"}},".payment-link-column-2":{width:{xs:"100%",md:"100%",lg:"320px"},maxWidth:{xs:"100%",md:"33%"}}},children:[e.jsxs(s,{className:"payment-link-column-1",sx:{flex:1,gap:2.5,display:"flex",flexDirection:"column"},children:[e.jsxs(s,{className:"section",sx:{containerType:"inline-size"},children:[e.jsx(l,{title:a("admin.details")}),e.jsxs(me,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(1, 1fr)",xl:"repeat(2, 1fr)"},"@container (min-width: 1000px)":{gridTemplateColumns:"repeat(2, 1fr)"},".info-row-wrapper":{gap:1,flexDirection:{xs:"column",xl:"row"},alignItems:{xs:"flex-start",xl:"center"},"@container (min-width: 1000px)":{flexDirection:"row",alignItems:"center"}}},children:[e.jsx(i,{label:a("common.status"),value:e.jsxs(n,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(_,{label:t.status,color:C(t.status)}),t.last_payment_error&&e.jsx(O,{title:e.jsx("pre",{style:{whiteSpace:"break-spaces"},children:JSON.stringify({...t.last_payment_error,type:Z.startCase(t.last_payment_error?.type)},null,2)}),children:e.jsx(W,{fontSize:"small",color:"error"})})]})}),e.jsx(i,{label:a("common.amount"),value:b}),e.jsx(i,{label:a("admin.paymentIntent.received"),value:g}),e.jsx(i,{label:a("common.createdAt"),value:N(t.created_at)}),e.jsx(i,{label:a("common.description"),value:t.description}),e.jsx(i,{label:a("common.updatedAt"),value:N(t.updated_at)}),e.jsx(i,{label:a("common.statementDescriptor"),value:t.statement_descriptor})]})]}),e.jsx(r,{}),e.jsxs(s,{className:"section",children:[e.jsx(l,{title:a("admin.payouts")}),e.jsx(s,{className:"section-body",children:e.jsx(oe,{features:{toolbar:!1},payment_intent_id:t?.id,isCanceledSubscription:T})})]}),e.jsx(r,{}),e.jsxs(s,{className:"section",children:[e.jsx(l,{title:a("admin.refunds")}),e.jsx(s,{className:"section-body",children:e.jsx(le,{features:{customer:!1,toolbar:!1},payment_intent_id:t?.id})})]}),e.jsx(r,{}),e.jsxs(s,{className:"section",children:[e.jsx(l,{title:a("admin.events.title")}),e.jsx(s,{className:"section-body",children:e.jsx(ae,{features:{toolbar:!1},object_id:t.id})})]})]}),f&&e.jsx(r,{}),e.jsxs(s,{className:"payment-link-column-2",sx:{gap:2.5,display:"flex",flexDirection:"column"},children:[e.jsxs(s,{className:"section",children:[e.jsx(l,{title:a("admin.paymentMethod._name")}),e.jsxs(n,{children:[e.jsx(i,{label:a("common.id"),value:t.paymentMethod?.id,direction:m,alignItems:c}),e.jsx(i,{label:a("admin.paymentMethod.type"),value:t.paymentMethod?.type,direction:m,alignItems:c}),e.jsx(i,{label:a("admin.paymentCurrency.name"),value:`${t.paymentCurrency.symbol} (${t.paymentMethod?.name})`,direction:m,alignItems:c}),(!!t.payment_details?.ethereum||!!t.payment_details?.base)&&e.jsx(i,{label:a("common.txGas"),value:e.jsx(Q,{details:t.payment_details,method:t.paymentMethod}),direction:m,alignItems:c}),e.jsx(i,{label:a(`common.${t.payment_details?.arcblock?.type||"transfer"}TxHash`),value:e.jsx(X,{details:t.payment_details,method:t.paymentMethod}),direction:m,alignItems:c})]})]}),e.jsx(r,{}),e.jsxs(s,{className:"section",children:[e.jsx(l,{title:a("admin.connections")}),e.jsxs(n,{children:[t.subscription&&e.jsx(i,{label:a("admin.subscription.name"),value:e.jsx(M,{to:`/admin/billing/${t.subscription.id}`,children:t.subscription.id}),direction:m,alignItems:c}),t.invoice_id&&e.jsx(i,{label:a("admin.invoice.name"),value:e.jsx(M,{to:`/admin/billing/${t.invoice_id}`,children:t.invoice_id}),direction:m,alignItems:c})]})]}),e.jsx(r,{}),e.jsxs(s,{className:"section",children:[e.jsx(l,{title:a("common.metadata.label"),children:e.jsx(z,{variant:"text",color:"inherit",size:"small",sx:{color:"text.link"},disabled:j.editing.metadata,onClick:v,children:a("common.edit")})}),e.jsxs(s,{className:"section-body",children:[e.jsx(ie,{data:t.metadata,handleEditMetadata:v}),j.editing.metadata&&e.jsx(se,{data:t,loading:j.loading.metadata,onSave:A,onCancel:()=>p(d=>({editing:{...d.editing,metadata:!1}}))})]})]})]})]})]})}const de=H(n)``;export{ze as default};
@@ -1,15 +0,0 @@
1
- import{r as p,u as _e,j as e,A as v,w as Ce,B as a,a3 as c,bv as Se,q as o,ai as we,O as w,b4 as X,bL as ke,Y as k,x as P,bM as Z,v as Pe,a4 as Ie,D as De,bh as ze,N as Me,I as Ne,bf as Ae}from"./vendor-mui-BXZut9Pz.js";import{V as Te,O,Y as j,E as Re,F as W,G as ee}from"./vendor-blocklet-D_i_QeSo.js";import{d as Oe,u as We,a as Le,i as L,j as g,y as $e,z as Ue,p as te,A as Ee,m as Fe,B as Be,e as D,k as re,l as He}from"./index-DgSc1Qy8.js";import{e as Ge,a as qe,L as Ve}from"./vendor-react-BPknnnEA.js";import{C as ne}from"./currency-GstdXsJf.js";import{C as Ke}from"./link-3eeclTeS.js";import{I as se}from"./info-metric-CNse3r66.js";import{I as l}from"./info-row-DOK2whMn.js";import{I as Ye}from"./info-row-group-BeUhWnnY.js";import{S as Je}from"./description-Ym17DL48.js";import{P as Qe,D as Xe,S as Ze,V as et}from"./payment-method-info-BsOBbA3m.js";import{S as tt}from"./metrics-C7U41HWk.js";import{S as rt}from"./actions-BaDh4xWX.js";import{u as nt,a as st,b as at}from"./subscription-Dq22e3D1.js";import{f as it}from"./dayjs-B9tvQIKg.js";import{c as ot}from"./util-mDHAL0lx.js";import{u as ct}from"./browser-DSLTxXlL.js";import"./copyable-DpX04wZz.js";import"./usage-records-jjJMZ6DI.js";import"./actions-jxGAdGfb.js";import"./click-boundary-y8dVA_tr.js";import"./generateCategoricalChart-BaWwaXky.js";import"./status-l6pD08fw.js";import"./lodash-B4Ozcv0x.js";const I={mode:"percent",percent:.5},lt=s=>D.get(`/api/subscriptions/${s}`).then(x=>x.data),dt=s=>D.get(`/api/subscriptions/${s}/overdraft-protection`).then(x=>x.data),mt=(s,x)=>D.get(`/api/subscriptions/${s}/cycle-amount`,{params:x}).then(r=>r.data);function Lt(){const{id:s}=Ge(),x=qe(),{t:r,locale:ae}=Te(),{isMobile:d}=Oe(),{session:$}=We(),{connect:z}=Le(),ie=ct(),{loading:oe,error:U,data:t,refresh:_}=O(()=>lt(s)),{hasUnpaid:ce,checkUnpaidInvoices:M}=nt(s),{hasPendingAmount:E,pendingAmount:N}=st(s,t?.paymentCurrency),F=["active","trialing","past_due"].includes(t?.status||"")&&t?.paymentMethod?.type==="arcblock",[le,A]=p.useState(!1),[m,b]=p.useState(I),[B,T]=p.useState(I),[H,G]=p.useState(!1),{liveRateInfo:f}=at({subscriptionId:s,currencyId:t?.paymentCurrency?.id,enabled:!!t?.paymentCurrency?.id});p.useEffect(()=>{const n=t?.slippage_config;if(n&&typeof n=="object"){const i=n.mode==="rate"?"rate":"percent",u=Number(n.percent),y=Number.isFinite(u)&&u>=0?u:.5,S={mode:i,percent:y,...n.min_acceptable_rate?{min_acceptable_rate:String(n.min_acceptable_rate)}:{},...n.base_currency?{base_currency:String(n.base_currency)}:{},...n.updated_at_ms?{updated_at_ms:Number(n.updated_at_ms)}:{}};b(S),T(S);return}b(I),T(I)},[t]);const de=p.useMemo(()=>(t?.items||[]).some(n=>{const i=n.upsell_price||n.price;return i&&i?.pricing_type==="dynamic"}),[t?.items]),q=p.useMemo(()=>{if(m.min_acceptable_rate)return m.min_acceptable_rate;if(f?.rate&&m.percent!==void 0){const n=Number(f.rate),{percent:i}=m;if(Number.isFinite(n)&&n>0&&Number.isFinite(i))return(n*(1-i/100)).toFixed(8).replace(/\.?0+$/,"")}return null},[m.min_acceptable_rate,m.percent,f?.rate]),{data:h=null,loading:me,run:pe}=O(()=>dt(s),{ready:F}),V=_e(),{data:ue={amount:"0",gas:"0"}}=O(()=>mt(s,{overdraftProtection:!0}),{refreshDeps:[s],ready:F}),C=p.useRef(void 0),xe=!!h?.enabled,he=p.useCallback(n=>{C.current=n},[]),K=p.useCallback(()=>{A(!1),b(B)},[B]),fe=async()=>{if(s){G(!0);try{const n={...m,...m.base_currency?{}:{base_currency:f?.base_currency||"USD"}},i=await D.put(`/api/subscriptions/${s}/slippage`,{slippage_config:n});T(n),await _(),A(!1);const u=i.data?.delegation_warning;u&&!u.sufficient?(j.info(r("payment.customer.changePayment.reauthorizationRequired")),z.open({locale:ae,containerEl:void 0,action:"delegation",prefix:Re(He(),"/api/did"),saveConnect:!1,extraParams:{subscriptionId:s},messages:{scan:r("common.connect.defaultScan"),title:r("payment.customer.changePayment.reauthorizationTitle"),confirm:r("common.connect.confirm")},onSuccess:async()=>{z.close(),j.success(r("payment.customer.changePayment.reauthorizationCompleted")),await _()},onClose:()=>{z.close()},onError:y=>{console.error("Delegation failed:",y),j.error(re(y))}})):j.success(r("common.saved"))}catch(n){j.error(re(n))}finally{G(!1)}}};if(t?.customer?.did&&$?.user?.did&&t.customer.did!==$.user.did)return e.jsx(v,{severity:"error",children:r("common.accessDenied")});if(U)return e.jsx(v,{severity:"error",children:U.message});if(oe||!t)return e.jsx(Ce,{});const R=t?.serviceType==="credit"||t?.paymentCurrency?.type==="credit"||t?.items?.some(n=>n?.price?.product?.type==="credit"||n?.price?.metadata?.credit_config),Y=t?.paymentMethod?.type==="arcblock"&&!me&&!!h&&["active","trialing","past_due"].includes(t.status)&&!R,ye=()=>{const n=t?.overdraft_protection?.enabled,i=h?.upcoming?.amount||"0",u=h?.gas||"0",y=!xe||h.unused==="0"||new W(h.unused).lt(new W(i).add(new W(u))),S=+ee(ue.amount||"0",t.paymentCurrency?.decimal),ge=+ee(h?.unused||"0",t.paymentCurrency?.decimal),be=ve=>{if(!t?.pending_invoice_item_interval)return"";const{interval:J,interval_count:je}=t.pending_invoice_item_interval,Q=ve*je;return["hour","day","week","month","year"].includes(J)?r("common.estimatedDuration",{duration:it(Q,J,{t:r})}):r("customer.overdraftProtection.estimatedDuration",{duration:Q,unit:r("customer.overdraftProtection.intervals").toLowerCase()})};return n?n&&y?e.jsx(P,{size:"small",color:"error",sx:{fontSize:"12px",textAlign:"left"},onClick:()=>C.current?.openOverdraftProtection({enabled:!0}),children:r("customer.overdraftProtection.insufficient")}):e.jsxs(c,{direction:"row",sx:{alignItems:"center",flexWrap:"wrap",justifyContent:"flex-end",columnGap:.5},children:[e.jsxs(c,{direction:"row",spacing:.5,sx:{alignItems:"center"},children:[e.jsx(ze,{sx:{fontSize:"16px",color:"success.main",verticalAlign:"middle"}}),e.jsx(o,{sx:{color:"success.main",fontWeight:500},children:r("customer.overdraftProtection.enabled")})]}),!d&&e.jsx(k,{orientation:"vertical",flexItem:!0,sx:{mx:1,borderColor:"divider"}}),e.jsxs(o,{sx:{color:"text.primary",display:"flex",alignItems:"center",gap:.5,fontWeight:500},children:[e.jsx(Me,{src:t.paymentCurrency?.logo,sx:{width:16,height:16},alt:t.paymentCurrency?.symbol}),e.jsxs(a,{sx:{display:"flex",alignItems:"baseline"},children:[L(h?.unused,t.paymentCurrency.decimal),e.jsxs(o,{sx:{color:"text.secondary",fontSize:"14px",ml:.5},children:[t.paymentCurrency.symbol,"(",be(Math.ceil(ge/S)),")"]})]})]}),t?.overdraft_protection?.enabled&&e.jsx(w,{title:r("customer.overdraftProtection.setting"),placement:"top",children:e.jsx(Ne,{size:"small",sx:{ml:-1,color:"text.disabled","&:hover":{color:"primary.main",backgroundColor:"transparent"}},onClick:()=>C.current?.openOverdraftProtection({enabled:!0}),children:e.jsx(Z,{fontSize:"small",sx:{fontSize:16}})})})]}):e.jsxs(c,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(o,{sx:{color:"text.lighter"},children:r("customer.overdraftProtection.disabled")}),e.jsx(P,{size:"small",sx:{fontSize:"13px",pt:0,pb:0,height:3,color:"text.link","&:hover":{backgroundColor:"primary.lighter"}},onClick:()=>C.current?.openOverdraftProtection({enabled:!0}),children:r("customer.overdraftProtection.open")})]})};return e.jsxs(e.Fragment,{children:[e.jsxs(pt,{children:[e.jsxs(a,{children:[!t.paymentMethodDetails&&["active","trialing"].includes(t.status)&&e.jsx(v,{severity:"warning",sx:{mb:2},children:r("admin.subscription.noPaymentMethodWarning")}),ce&&e.jsx(v,{severity:"error",sx:{mb:2},children:r("customer.unpaidInvoicesWarningTip")}),E&&N&&e.jsx(v,{severity:"error",sx:{mb:2},children:r("customer.pendingAmountWarningTip",{amount:L(N,t?.paymentCurrency?.decimal),symbol:t?.paymentCurrency?.symbol})}),e.jsxs(c,{className:"page-header",direction:"row",sx:{justifyContent:"space-between",alignItems:"center",position:"relative"},children:[ie?e.jsx(a,{}):e.jsxs(c,{direction:"row",onClick:()=>x("/customer",{replace:!0}),sx:{alignItems:"center",fontWeight:"normal",cursor:"pointer"},children:[e.jsx(Se,{fontSize:"small",sx:{mr:.5,color:"text.secondary"}}),e.jsx(o,{variant:"h6",sx:{color:"text.secondary",fontWeight:"normal"},children:r("payment.customer.subscriptions.title")})]}),e.jsx(c,{direction:"row",sx:{gap:1},children:e.jsx(rt,{subscription:t,onChange:n=>{_(),n==="batch-pay"&&M()},showExtra:!0,showDelegation:!0,showOverdraftProtection:{show:Y,onChange:()=>pe()},showRecharge:!0,mode:d?"menu-only":"primary-buttons",actionProps:{cancel:{variant:"outlined",color:"primary"},recover:{variant:"outlined",color:"info"},pastDue:{variant:"outlined",color:"primary"}},setUp:he})})]}),e.jsxs(a,{sx:{mt:d?2:4,display:"flex",border:d?`1px solid ${V.palette.divider}`:"none",borderRadius:d?1:0,p:d?2:0,gap:{xs:2,sm:2,md:5},flexWrap:"wrap",flexDirection:{xs:"column",sm:"column",md:"row"},alignItems:{xs:"flex-start",sm:"flex-start",md:"center"}},children:[e.jsx(c,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center"},children:e.jsx(c,{direction:"row",sx:{alignItems:"center",flexWrap:"wrap",gap:1},children:e.jsx(Je,{subscription:t,variant:"h1"})})}),e.jsxs(c,{className:"section-body",sx:{justifyContent:"flex-start",flexWrap:"wrap",flex:1,width:"100%","hr.MuiDivider-root:last-child":{display:"none"},flexDirection:{xs:"column",sm:"column",md:"row"},alignItems:"flex-start",gap:{xs:1,sm:1,md:3}},children:[e.jsx(tt,{subscription:t}),Y&&e.jsx(se,{label:e.jsxs(c,{direction:"row",spacing:.5,sx:{alignItems:"center"},children:[e.jsx(o,{component:"span",sx:{fontSize:14,fontWeight:500},children:r("customer.overdraftProtection.title")}),e.jsx(we,{href:"https://www.arcblock.io/content/blog/en/payment-kit-v117-sub-guard#listen-to-the-audio-overview",target:"_blank",rel:"noopener noreferrer",sx:{display:"flex",alignItems:"center"},children:e.jsx(w,{title:r("customer.overdraftProtection.learnMore"),placement:"top",children:e.jsx(X,{fontSize:"small",sx:{fontSize:"14px",ml:-.2,color:"text.secondary",cursor:"pointer",opacity:.8,"&:hover":{color:"primary.main"}}})})}),t.overdraft_protection?.payment_details?.arcblock?.staking?.address&&e.jsx(w,{title:e.jsxs(o,{sx:{fontFamily:"monospace",fontSize:"13px"},children:[r("customer.overdraftProtection.stakingAddress"),":",t.overdraft_protection?.payment_details?.arcblock?.staking?.address]}),arrow:!0,placement:"top",children:e.jsx(ke,{sx:{fontSize:"16px",color:"text.secondary",cursor:"pointer",ml:1,"&:hover":{color:"primary.main"},display:{xs:"none",md:"block"}}})})]}),value:ye()}),R&&E&&e.jsx(se,{label:r("admin.customer.creditGrants.pendingAmount"),value:e.jsx(o,{sx:{color:"error.main"},children:`${L(N,t?.paymentCurrency?.decimal)} ${t?.paymentCurrency?.symbol}`})})]})]})]}),d?null:e.jsx(k,{}),e.jsxs(a,{className:"section",sx:{containerType:"inline-size",border:d?`1px solid ${V.palette.divider}`:"none",borderRadius:d?1:0,p:d?2:0},children:[e.jsx(o,{variant:"h3",className:"section-header",sx:{mb:3},children:r("admin.details")}),e.jsxs(Ye,{sx:{display:"grid",gridTemplateColumns:{xs:"repeat(1, 1fr)",xl:"repeat(2, 1fr)"},"@container (min-width: 980px)":{gridTemplateColumns:"repeat(2, 1fr)"},".info-row-wrapper":{gap:d?.5:1,flexDirection:{xs:"column",xl:"row"},alignItems:{xs:"flex-start",xl:"center"},"@container (min-width: 980px)":{flexDirection:"row",alignItems:"center"}},".currency-name":{color:"text.secondary",lineHeight:1,fontSize:14},".tx-link-text":{fontSize:14,lineHeight:1}},children:[e.jsx(l,{label:r("common.customer"),value:e.jsx(Ke,{customer:t.customer,linked:!1,size:"small"})}),e.jsx(l,{label:r("common.createdAt"),value:g(t.created_at)}),e.jsx(l,{label:r("admin.subscription.currentPeriod"),value:[g(t.current_period_start*1e3),g(t.current_period_end*1e3)].join(" ~ ")}),e.jsx(l,{label:r("admin.subscription.trialingPeriod"),value:t.trial_end&&t.trial_start?[g(t.trial_start*1e3),g(t.trial_end*1e3)].join(" ~ "):""}),t.status==="paused"&&!!t.pause_collection?.resumes_at&&e.jsx(l,{label:r("common.resumesAt"),value:g(t.pause_collection.resumes_at*1e3)}),e.jsx(l,{label:r("admin.subscription.collectionMethod"),value:t.collection_method}),e.jsx(l,{label:r("admin.paymentMethod._name"),value:e.jsx(ne,{logo:t.paymentMethod?.logo,name:t.paymentMethod?.name,size:16})}),e.jsx(l,{label:r("admin.paymentCurrency.name"),value:e.jsxs(c,{direction:"row",spacing:2,children:[e.jsx(ne,{logo:t.paymentCurrency.logo,name:t.paymentCurrency.symbol,size:16}),ot(t)&&e.jsx(P,{variant:"text",sx:{color:"text.link"},size:"small",onClick:async()=>{t?.overdraft_protection?.enabled&&await M()||x(`/customer/subscription/${t.id}/change-payment`)},children:r("payment.customer.subscriptions.changePayment")})]})}),de&&t.paymentMethod?.type!=="stripe"&&e.jsx(l,{label:e.jsxs(c,{direction:"row",spacing:.5,sx:{alignItems:"center"},children:[e.jsx("span",{children:r("common.slippage")}),e.jsx(w,{title:r("common.slippageTooltip"),placement:"top",children:e.jsx(X,{sx:{fontSize:"0.875rem",color:"text.secondary",cursor:"help"}})})]}),value:e.jsxs(c,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(o,{color:q?"text.primary":"text.secondary",children:$e(q)||"—"}),e.jsx(P,{variant:"text",size:"small",sx:{color:"text.link",minWidth:"auto",p:.5},onClick:()=>A(!0),disabled:H,children:e.jsx(Z,{sx:{fontSize:"1rem"}})})]})}),e.jsx(l,{label:r("admin.subscription.payerAddress"),value:e.jsx(Qe,{subscriptionId:s,customer:t.customer,paymentMethodDetails:t.paymentMethodDetails,editable:["active","trialing","past_due"].includes(t.status),onUpdate:()=>{_(),M()},paymentMethodType:t.paymentMethod?.type})}),t.payment_details&&Ue(t.payment_details,t.paymentMethod)&&e.jsx(l,{label:r("common.delegateTxHash"),value:e.jsx(te,{details:t.payment_details,method:t.paymentMethod,size:16})}),t.paymentMethod?.type==="arcblock"&&t.payment_details?.arcblock?.staking?.tx_hash&&e.jsx(l,{label:r("common.stakeTxHash"),value:e.jsx(a,{sx:{".MuiTypography-root":{color:"text.link"}},children:e.jsx(te,{details:{arcblock:{tx_hash:t.payment_details?.arcblock?.staking?.tx_hash,payer:""}},method:t.paymentMethod,size:16})})}),!!t.recovered_from&&e.jsx(l,{label:r("common.recoverFrom"),value:e.jsx(Ve,{to:`/customer/subscription/${t.recovered_from}`,target:"_blank",children:t.recovered_from})})]})]}),e.jsx(k,{}),t.discountStats&&e.jsxs(a,{className:"section",children:[e.jsx(o,{variant:"h3",className:"section-header",sx:{mb:1.5},children:r("admin.subscription.discount")}),e.jsx(a,{className:"section-body",children:e.jsx(Xe,{discountStats:t.discountStats})})]}),e.jsx(a,{className:"divider"}),e.jsxs(a,{className:"section",children:[e.jsx(o,{variant:"h3",className:"section-header",sx:{mb:1.5},children:r("admin.products")}),e.jsx(a,{className:"section-body",children:e.jsx(Ze,{data:t.items,currency:t.paymentCurrency,mode:"customer"})})]}),(()=>{const n=t.items?.map(i=>i.price?.product?.vendor_config||[]).flat();return!n||n.length===0?null:e.jsxs(e.Fragment,{children:[e.jsx(k,{}),e.jsx(a,{className:"section",children:e.jsx(et,{vendorServices:n,subscriptionId:s,isCanceled:t.status==="canceled"})})]})})(),e.jsx(a,{className:"divider"}),R?e.jsxs(a,{className:"section",children:[e.jsx(o,{variant:"h3",className:"section-header",children:r("admin.creditTransactions.title")}),e.jsx(a,{className:"section-body",children:e.jsx(Ee,{customer_id:t.customer_id,subscription_id:t.id,showAdminColumns:!1,includeGrants:!0})})]}):e.jsxs(a,{className:"section",children:[e.jsx(o,{variant:"h3",className:"section-header",children:r("customer.invoiceHistory")}),e.jsx(a,{className:"section-body",children:e.jsx(Fe,{subscription_id:t.id,type:"table",include_staking:!0,status:"open,paid,uncollectible,void"})})]})]}),e.jsxs(Pe,{open:le,onClose:K,maxWidth:"xs",fullWidth:!0,PaperProps:{sx:{borderRadius:2}},children:[e.jsx(Ie,{children:r("payment.checkout.quote.slippageLimit.title")}),e.jsx(De,{sx:{pb:3},children:e.jsx(Be,{value:m.percent,onChange:n=>b(i=>({...i,percent:n})),config:m,onConfigChange:b,exchangeRate:f?.rate||null,baseCurrency:f?.base_currency||"USD",disabled:H,onCancel:K,onSave:fe})})]})]})}const pt=Ae(c)`
2
- margin-bottom: 24px;
3
- gap: 24px;
4
- flex-direction: column;
5
- @media (max-width: ${({theme:s})=>s.breakpoints.values.md}px) {
6
- . {
7
- border: none;
8
- box-shadow: none;
9
- padding: 0;
10
- }
11
- .section-header {
12
- font-size: 18px;
13
- }
14
- }
15
- `;export{Lt as default};
@@ -1,9 +0,0 @@
1
- import{j as t,a3 as x,q as p,bs as v,bt as c,r as y,B as M,w as k,cH as C,br as E,A as I,bf as R}from"./vendor-mui-BXZut9Pz.js";import{V as u,a0 as S,y as B}from"./vendor-blocklet-D_i_QeSo.js";import{E as h,aX as a,C as f,X as b}from"./index-DgSc1Qy8.js";import{U as j}from"./uploader-DRXDz_r0.js";function A({checkDisabled:n}){const{t:e}=u(),{control:d}=h();return t.jsxs(t.Fragment,{children:[t.jsx(a,{name:"name",type:"text",rules:{required:!0},label:e("admin.paymentMethod.name.label"),placeholder:e("admin.paymentMethod.name.tip"),disabled:n("name"),inputProps:{maxLength:32}}),t.jsx(a,{name:"description",type:"text",rules:{required:!0},label:e("admin.paymentMethod.description.label"),placeholder:e("admin.paymentMethod.description.tip"),inputProps:{maxLength:255}}),t.jsx(a,{name:"settings.app_store.bundle_id",type:"text",rules:{required:!0},label:e("admin.paymentMethod.app_store.bundle_id.label"),placeholder:e("admin.paymentMethod.app_store.bundle_id.tip"),disabled:n("settings.app_store.bundle_id")}),t.jsxs(x,{spacing:.5,children:[t.jsx(p,{variant:"body2",children:e("admin.paymentMethod.app_store.environment.label")}),t.jsx(f,{name:"settings.app_store.environment",control:d,rules:{required:!0},render:({field:s})=>t.jsxs(v,{...s,exclusive:!0,disabled:n("settings.app_store.environment"),onChange:(i,r)=>{r!==null&&s.onChange(r)},children:[t.jsx(c,{value:"production",children:e("admin.paymentMethod.app_store.environment.production")}),t.jsx(c,{value:"sandbox",children:e("admin.paymentMethod.app_store.environment.sandbox")})]})}),t.jsx(p,{variant:"caption",color:"text.secondary",children:e("admin.paymentMethod.app_store.environment.tip")})]}),t.jsx(a,{name:"settings.app_store.shared_secret",type:"password",label:e("admin.paymentMethod.app_store.shared_secret.label"),placeholder:e("admin.paymentMethod.app_store.shared_secret.tip"),disabled:n("settings.app_store.shared_secret")}),t.jsx(p,{variant:"subtitle2",sx:{mt:2},children:e("admin.paymentMethod.app_store.serverApi.heading")}),t.jsx(p,{variant:"caption",color:"text.secondary",sx:{mt:-1,display:"block"},children:e("admin.paymentMethod.app_store.serverApi.tip")}),t.jsx(a,{name:"settings.app_store.issuer_id",type:"text",label:e("admin.paymentMethod.app_store.issuer_id.label"),placeholder:e("admin.paymentMethod.app_store.issuer_id.tip"),disabled:n("settings.app_store.issuer_id")}),t.jsx(a,{name:"settings.app_store.key_id",type:"text",label:e("admin.paymentMethod.app_store.key_id.label"),placeholder:e("admin.paymentMethod.app_store.key_id.tip"),disabled:n("settings.app_store.key_id")}),t.jsx(a,{name:"settings.app_store.private_key_pem",type:"text",multiline:!0,rows:5,label:e("admin.paymentMethod.app_store.private_key_pem.label"),placeholder:e("admin.paymentMethod.app_store.private_key_pem.tip"),disabled:n("settings.app_store.private_key_pem")})]})}function U({checkDisabled:n}){const{t:e}=u(),{control:d,setValue:s}=h(),i=b({control:d,name:"logo"}),r=o=>{if(!o.url){s("logo","");return}const l=new URL(o.url);s("logo",l.pathname)};return t.jsxs(t.Fragment,{children:[t.jsx(a,{name:"name",type:"text",rules:{required:!0},label:e("admin.paymentMethod.name.label"),placeholder:e("admin.paymentMethod.name.tip"),disabled:n("name"),inputProps:{maxLength:32}},"name"),t.jsx(a,{name:"description",type:"text",rules:{required:!0},label:e("admin.paymentMethod.description.label"),placeholder:e("admin.paymentMethod.description.tip"),disabled:n("description"),inputProps:{maxLength:255}},"description"),t.jsx(a,{name:"settings.arcblock.chain_id",type:"text",rules:{required:!0},label:e("admin.paymentMethod.arcblock.chain_id.label"),placeholder:e("admin.paymentMethod.arcblock.chain_id.tip"),disabled:n("settings.arcblock.chain_id")},"secret_key"),t.jsx(a,{name:"settings.arcblock.api_host",type:"text",rules:{required:!0},label:e("admin.paymentMethod.arcblock.api_host.label"),placeholder:e("admin.paymentMethod.arcblock.api_host.tip"),disabled:n("settings.arcblock.api_host")},"api_host"),t.jsx(a,{name:"settings.arcblock.explorer_host",type:"text",rules:{required:!0},label:e("admin.paymentMethod.arcblock.explorer_host.label"),placeholder:e("admin.paymentMethod.arcblock.explorer_host.tip"),disabled:n("settings.arcblock.explorer_host")},"explorer_host"),t.jsxs(x,{direction:"column",children:[t.jsx(p,{sx:{mb:1},children:e("admin.paymentCurrency.logo.label")}),t.jsx(j,{onUploaded:r,preview:i,disabled:n("logo")})]})]})}let g=null;const V=()=>(g||(g=B(()=>import("./index-SYTpMMMH.js"),[]).then(n=>n.default).catch(n=>{throw g=null,n})),g);function T(n,e={debounce:500,pollInterval:2e3}){const[d,s]=y.useState({loading:!1,connected:!1}),i=y.useRef(!1),r=y.useRef(!1),o=y.useCallback(async(_=!1)=>{if(!n){s({loading:!1,connected:!1});return}if(!r.current){r.current=!0,!_&&!i.current&&s(m=>({...m,loading:!0}));try{const m=await V(),P=new m(n),F=new Promise((X,L)=>{setTimeout(()=>L(new Error("Connection timeout")),5e3)}),w=await Promise.race([P.eth.getBlockNumber(),F]);s({loading:!1,connected:!0,blockNumber:w}),i.current=!0}catch(m){s({loading:!1,connected:!1,error:m.message})}finally{r.current=!1}}},[n]),l=y.useMemo(()=>S(o,e.debounce),[o,e.debounce]);return y.useEffect(()=>{const _=e.debounce>0?l:o;i.current=!1,_();let m=null;return e.pollInterval>0&&(m=setInterval(()=>o(!0),e.pollInterval)),()=>{e.debounce>0&&l.cancel(),m&&clearInterval(m),r.current=!1}},[n,e.debounce,e.pollInterval,o,l]),{status:d,checkConnection:o}}function q({name:n,label:e,placeholder:d,disabled:s=!1}){const{t:i}=u(),{control:r}=h(),o=b({control:r,name:n}),{status:l}=T(o,{debounce:500,pollInterval:2e3});return t.jsx(a,{name:n,type:"text",rules:{required:!0},disabled:s,label:t.jsxs(M,{sx:{display:"flex",alignItems:"center",gap:1},children:[e,o&&t.jsx(M,{sx:{display:"flex",alignItems:"center",gap:.5},children:l.loading?t.jsxs(t.Fragment,{children:[t.jsx(k,{size:14}),t.jsx(p,{variant:"caption",sx:{color:"text.secondary"},children:i("admin.paymentMethod.evm.checking")})]}):l.connected?t.jsxs(t.Fragment,{children:[t.jsx(C,{sx:{fontSize:14},color:"success"}),t.jsxs(p,{variant:"caption",sx:{color:"text.secondary"},children:[i("admin.paymentMethod.evm.connected")," | ",i("admin.paymentMethod.evm.blockHeight"),":"," ",l.blockNumber?.toLocaleString()]})]}):l.error?t.jsxs(t.Fragment,{children:[t.jsx(E,{sx:{fontSize:14},color:"error"}),t.jsx(p,{variant:"caption",color:"error",children:i("admin.paymentMethod.evm.connectionError")})]}):null})]}),placeholder:d},"api_host")}function W({checkDisabled:n}){const{t:e}=u(),{control:d,setValue:s}=h(),i=b({control:d,name:"logo"}),r=o=>{if(!o.url){s("logo","");return}const l=new URL(o.url);s("logo",l.pathname)};return t.jsxs(t.Fragment,{children:[t.jsx(a,{name:"name",type:"text",rules:{required:!0},label:e("admin.paymentMethod.name.label"),placeholder:e("admin.paymentMethod.name.tip"),disabled:n("name"),inputProps:{maxLength:32}},"name"),t.jsx(a,{name:"description",type:"text",rules:{required:!0},label:e("admin.paymentMethod.description.label"),placeholder:e("admin.paymentMethod.description.tip"),disabled:n("description"),inputProps:{maxLength:255}},"description"),t.jsx(q,{name:"settings.base.api_host",label:e("admin.paymentMethod.base.api_host.label"),placeholder:e("admin.paymentMethod.base.api_host.tip"),disabled:n("settings.base.api_host")}),t.jsx(a,{name:"settings.base.explorer_host",type:"text",rules:{required:!0},label:e("admin.paymentMethod.base.explorer_host.label"),placeholder:e("admin.paymentMethod.base.explorer_host.tip"),disabled:n("settings.base.explorer_host")},"explorer_host"),t.jsx(a,{name:"settings.base.native_symbol",type:"text",rules:{required:!0},label:e("admin.paymentMethod.base.native_symbol.label"),placeholder:e("admin.paymentMethod.base.native_symbol.tip"),disabled:n("settings.base.native_symbol")},"native_symbol"),t.jsx(a,{name:"settings.base.confirmation",type:"number",rules:{required:!0},label:e("admin.paymentMethod.base.confirmation.label"),placeholder:e("admin.paymentMethod.base.confirmation.tip"),disabled:n("settings.base.confirmation")},"confirmation"),t.jsxs(x,{direction:"column",children:[t.jsx(p,{sx:{mb:1},children:e("admin.paymentCurrency.logo.label")}),t.jsx(j,{onUploaded:r,preview:i,disabled:n("logo")})]})]})}function z({checkDisabled:n}){const{t:e}=u(),{control:d,setValue:s}=h(),i=b({control:d,name:"logo"}),r=o=>{if(!o.url){s("logo","");return}const l=new URL(o.url);s("logo",l.pathname)};return t.jsxs(t.Fragment,{children:[t.jsx(a,{name:"name",type:"text",rules:{required:!0},label:e("admin.paymentMethod.name.label"),placeholder:e("admin.paymentMethod.name.tip"),disabled:n("name"),inputProps:{maxLength:32}},"name"),t.jsx(a,{name:"description",type:"text",rules:{required:!0},label:e("admin.paymentMethod.description.label"),placeholder:e("admin.paymentMethod.description.tip"),disabled:n("description"),inputProps:{maxLength:255}},"description"),t.jsx(a,{name:"settings.bitcoin.chain_id",type:"text",rules:{required:!0},label:e("admin.paymentMethod.bitcoin.chain_id.label"),placeholder:e("admin.paymentMethod.bitcoin.chain_id.tip"),disabled:n("settings.bitcoin.chain_id")},"chain_id"),t.jsx(a,{name:"settings.bitcoin.api_host",type:"text",rules:{required:!0},label:e("admin.paymentMethod.bitcoin.api_host.label"),placeholder:e("admin.paymentMethod.bitcoin.api_host.tip"),disabled:n("settings.bitcoin.api_host")},"api_host"),t.jsx(a,{name:"settings.bitcoin.explorer_host",type:"text",rules:{required:!0},label:e("admin.paymentMethod.bitcoin.explorer_host.label"),placeholder:e("admin.paymentMethod.bitcoin.explorer_host.tip"),disabled:n("settings.bitcoin.explorer_host")},"explorer_host"),t.jsxs(x,{direction:"column",children:[t.jsx(p,{sx:{mb:1},children:e("admin.paymentCurrency.logo.label")}),t.jsx(j,{onUploaded:r,preview:i,disabled:n("logo")})]})]})}function N({checkDisabled:n}){const{t:e}=u(),{control:d,setValue:s}=h(),i=b({control:d,name:"logo"}),r=o=>{if(!o.url){s("logo","");return}const l=new URL(o.url);s("logo",l.pathname)};return t.jsxs(t.Fragment,{children:[t.jsx(a,{name:"name",type:"text",rules:{required:!0},label:e("admin.paymentMethod.name.label"),placeholder:e("admin.paymentMethod.name.tip"),disabled:n("name"),inputProps:{maxLength:32}},"name"),t.jsx(a,{name:"description",type:"text",rules:{required:!0},label:e("admin.paymentMethod.description.label"),placeholder:e("admin.paymentMethod.description.tip"),disabled:n("description"),inputProps:{maxLength:255}},"description"),t.jsx(q,{name:"settings.ethereum.api_host",label:e("admin.paymentMethod.ethereum.api_host.label"),placeholder:e("admin.paymentMethod.ethereum.api_host.tip"),disabled:n("settings.ethereum.api_host")}),t.jsx(a,{name:"settings.ethereum.explorer_host",type:"text",rules:{required:!0},label:e("admin.paymentMethod.ethereum.explorer_host.label"),placeholder:e("admin.paymentMethod.ethereum.explorer_host.tip"),disabled:n("settings.ethereum.explorer_host")},"explorer_host"),t.jsx(a,{name:"settings.ethereum.native_symbol",type:"text",rules:{required:!0},label:e("admin.paymentMethod.ethereum.native_symbol.label"),placeholder:e("admin.paymentMethod.ethereum.native_symbol.tip"),disabled:n("settings.ethereum.native_symbol")},"native_symbol"),t.jsx(a,{name:"settings.ethereum.confirmation",type:"number",rules:{required:!0},label:e("admin.paymentMethod.ethereum.confirmation.label"),placeholder:e("admin.paymentMethod.ethereum.confirmation.tip"),disabled:n("settings.ethereum.confirmation")},"confirmation"),t.jsxs(x,{direction:"column",children:[t.jsx(p,{sx:{mb:1},children:e("admin.paymentCurrency.logo.label")}),t.jsx(j,{onUploaded:r,preview:i,disabled:n("logo")})]})]})}function O({checkDisabled:n}){const{t:e}=u(),{control:d}=h(),s=b({control:d,name:"settings.google_play.service_account_json"});let i=null,r=null;if(s)try{const o=JSON.parse(s);!o.client_email||!o.private_key?i=e("admin.paymentMethod.google_play.service_account_json.missingFields"):r=o.client_email}catch{i=e("admin.paymentMethod.google_play.service_account_json.invalidJson")}return t.jsxs(t.Fragment,{children:[t.jsx(a,{name:"name",type:"text",rules:{required:!0},label:e("admin.paymentMethod.name.label"),placeholder:e("admin.paymentMethod.name.tip"),disabled:n("name"),inputProps:{maxLength:32}}),t.jsx(a,{name:"description",type:"text",rules:{required:!0},label:e("admin.paymentMethod.description.label"),placeholder:e("admin.paymentMethod.description.tip"),inputProps:{maxLength:255}}),t.jsx(a,{name:"settings.google_play.package_name",type:"text",rules:{required:!0},label:e("admin.paymentMethod.google_play.package_name.label"),placeholder:e("admin.paymentMethod.google_play.package_name.tip"),disabled:n("settings.google_play.package_name")}),t.jsx(a,{name:"settings.google_play.service_account_json",type:"text",multiline:!0,rows:6,rules:{required:!0},label:e("admin.paymentMethod.google_play.service_account_json.label"),placeholder:e("admin.paymentMethod.google_play.service_account_json.tip"),disabled:n("settings.google_play.service_account_json")}),i&&t.jsx(I,{severity:"error",sx:{mt:-1},children:i}),r&&t.jsxs(p,{variant:"caption",color:"text.secondary",sx:{mt:-1,display:"block"},children:[e("admin.paymentMethod.google_play.service_account_json.detectedClient"),": ",r]}),t.jsx(a,{name:"settings.google_play.pubsub_topic_name",type:"text",label:e("admin.paymentMethod.google_play.pubsub_topic_name.label"),placeholder:e("admin.paymentMethod.google_play.pubsub_topic_name.tip"),disabled:n("settings.google_play.pubsub_topic_name")})]})}function G({checkDisabled:n}){const{t:e}=u();return t.jsxs(t.Fragment,{children:[t.jsx(a,{name:"name",type:"text",rules:{required:!0},label:e("admin.paymentMethod.name.label"),placeholder:e("admin.paymentMethod.name.tip"),disabled:n("name"),inputProps:{maxLength:32}}),t.jsx(a,{name:"description",type:"text",rules:{required:!0},label:e("admin.paymentMethod.description.label"),placeholder:e("admin.paymentMethod.description.tip"),inputProps:{maxLength:255}}),t.jsx(a,{name:"settings.stripe.dashboard",type:"text",rules:{required:!0},label:e("admin.paymentMethod.stripe.dashboard.label"),placeholder:e("admin.paymentMethod.stripe.dashboard.tip"),disabled:n("settings.stripe.dashboard")}),t.jsx(a,{name:"settings.stripe.publishable_key",type:"text",rules:{required:!0},label:e("admin.paymentMethod.stripe.publishable_key.label"),placeholder:e("admin.paymentMethod.stripe.publishable_key.tip"),disabled:n("settings.stripe.publishable_key")}),t.jsx(a,{name:"settings.stripe.secret_key",type:"password",rules:{required:!0},label:e("admin.paymentMethod.stripe.secret_key.label"),placeholder:e("admin.paymentMethod.stripe.secret_key.tip"),disabled:n("settings.stripe.secret_key")})]})}function Z({action:n="create",editableKeys:e=[]}){const{t:d}=u(),{control:s,setValue:i}=h(),r=b({control:s,name:"type"}),o=l=>n==="edit"?!e?.includes(l):!1;return t.jsxs(J,{direction:"column",alignItems:"flex-start",spacing:2,children:[t.jsx(f,{name:"type",control:s,render:({field:l})=>t.jsxs(v,{...l,disabled:o(l.name),onChange:(_,m)=>{m!==null&&i(l.name,m)},exclusive:!0,children:[t.jsx(c,{value:"arcblock",children:"ArcBlock"}),t.jsx(c,{value:"stripe",children:"Stripe"}),t.jsx(c,{value:"ethereum",children:"Ethereum"}),t.jsx(c,{value:"base",children:"Base"}),t.jsx(c,{value:"google_play",children:"Google Play"}),t.jsx(c,{value:"app_store",children:"App Store"}),t.jsx(c,{value:"bitcoin",disabled:!0,children:"Bitcoin"})]})}),t.jsx(p,{variant:"h6",sx:{mb:3,fontWeight:600},children:d("admin.paymentMethod.settings")}),r==="stripe"&&t.jsx(G,{checkDisabled:o}),r==="arcblock"&&t.jsx(U,{checkDisabled:o}),r==="ethereum"&&t.jsx(N,{checkDisabled:o}),r==="base"&&t.jsx(W,{checkDisabled:o}),r==="google_play"&&t.jsx(O,{checkDisabled:o}),r==="app_store"&&t.jsx(A,{checkDisabled:o}),r==="bitcoin"&&t.jsx(z,{checkDisabled:o})]})}const J=R(x)`
2
- select {
3
- border: none;
4
- &:active,
5
- &:focus {
6
- border: none;
7
- }
8
- }
9
- `;export{Z as P,T as u};
@@ -1 +0,0 @@
1
- import{V as d,an as m,y as o}from"./vendor-blocklet-D_i_QeSo.js";import{j as r,r as p,e}from"./vendor-mui-BXZut9Pz.js";import{b as v}from"./index-DgSc1Qy8.js";import{a as x,e as T}from"./vendor-react-BPknnnEA.js";const b=e.lazy(()=>o(()=>import("./detail-D5KRrQDx.js"),[])),E=e.lazy(()=>o(()=>import("./detail-DB56SG-k.js"),[])),f=e.lazy(()=>o(()=>import("./detail-Cr2wG4Th.js"),[])),a={overview:e.lazy(()=>o(()=>import("./index-2l22EYw9.js"),[]))};function C(){const s=x(),{t:n}=d(),{page:t="overview"}=T(),{startTransition:c}=v();if(t.startsWith("cus_"))return r.jsx(b,{id:t});if(t.startsWith("credgr_"))return r.jsx(E,{id:t});if(t.startsWith("cbtxn_"))return r.jsx(f,{id:t});const l=_=>{c(()=>{s(`/admin/customers/${_}`)})},i=a[t]||a.overview,u=[{label:n("admin.overview"),value:"overview"}];return r.jsxs("div",{children:[r.jsx(m,{tabs:u,current:t,onChange:l,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"}}}),p.isValidElement(i)?i:r.jsx(i,{})]})}export{C as default};
@@ -1 +0,0 @@
1
- import{V as b,am as y,an as E,y as i}from"./vendor-blocklet-D_i_QeSo.js";import{r as c,j as o,a3 as u,a7 as j,e as s}from"./vendor-mui-BXZut9Pz.js";import{u as T,a as w,b as P,c as C,S as L}from"./index-DgSc1Qy8.js";import{L as z}from"./admin-_nEB-lHn.js";import{a as p,e as A}from"./vendor-react-BPknnnEA.js";const v={overview:s.lazy(()=>i(()=>import("./overview-Cs3-8n4e.js").then(t=>t.o),[])),payments:s.lazy(()=>i(()=>import("./index-DU39aG5u.js"),[])),customers:s.lazy(()=>i(()=>import("./index-0HK7CYm4.js"),[])),products:s.lazy(()=>i(()=>import("./index-Clbt8nRm.js").then(t=>t.i),[])),billing:s.lazy(()=>i(()=>import("./index-BP53rZV9.js"),[])),tax:s.lazy(()=>i(()=>import("./index-Br7_mvEw.js").then(t=>t.i),[])),developers:s.lazy(()=>i(()=>import("./index-C8s2QKoe.js"),[])),settings:s.lazy(()=>i(()=>import("./index-Dc954mDP.js"),[]))},I=(t,e,n)=>n.map(a=>o.jsx(j,{variant:t===a.value?"filled":"outlined",color:t===a.value?"primary":"default",size:"small",label:a.label,onClick:()=>e(a.value),sx:{mr:2,fontSize:14,fontWeight:600,border:"none",cursor:"pointer","&:hover":t===a.value?{}:{backgroundColor:"grey.100"}}},a.value));function R(){const t=p(),{t:e}=b(),{updateAppInfo:n}=y(),a=w(),{group:r="overview"}=A(),{isPending:_,startTransition:g}=P(),h=m=>{a.setLivemode(!m.target.checked)},d=m=>{g(()=>{t(`/admin/${m}`)})},l=v[r]||v.overview,x=[{label:e("admin.overview"),value:"overview"},{label:e("admin.payments"),value:"payments"},{label:e("admin.customers"),value:"customers"},{label:e("admin.products"),value:"products"},{label:e("admin.tax"),value:"tax"},{label:e("admin.billing"),value:"billing"},{label:e("admin.settings"),value:"settings"}],f=[{label:e("admin.developers"),value:"developers"}];return c.useEffect(()=>{n({description:e("admin.description")})},[e]),o.jsxs(o.Fragment,{children:[o.jsx(C,{pending:_}),o.jsxs(u,{direction:"row",spacing:1,sx:{alignItems:"center",justifyContent:"end",flexWrap:"wrap",mt:1,pb:2},children:[o.jsx(E,{tabs:x,current:r,onChange:d,scrollButtons:"auto",variant:"scrollable",sx:{flex:"1 0 auto",maxWidth:"100%",".MuiTab-root":{marginBottom:"12px",fontWeight:"500",color:"text.lighter","&.Mui-selected":{color:"primary.main"}},".MuiTouchRipple-root":{display:"none"}}}),o.jsxs(u,{direction:"row",sx:{alignItems:"center"},children:[I(r,d,f),o.jsxs("label",{htmlFor:"livemode-switch",style:{fontSize:14,fontWeight:600,cursor:"pointer",color:a.livemode?"text.primary":"warning.light"},children:[e("common.livemode"),o.jsx(L,{id:"livemode-switch",sx:{ml:1},variant:"warning",checked:!a.livemode,onChange:h})]})]})]}),o.jsx("div",{className:"page-content",children:c.isValidElement(l)?l:o.jsx(l,{})},a.livemode?"live":"test")]})}function k(){const t=p(),{session:e}=T();return c.useEffect(()=>{e.user&&["owner","admin"].includes(e.user.role)===!1&&t("/customer")},[e.user]),o.jsx(z,{children:o.jsx(R,{})})}export{k as default};
@@ -1 +0,0 @@
1
- import{j as t}from"./vendor-mui-BXZut9Pz.js";import{P as r}from"./list-1OG83xc4.js";import"./vendor-blocklet-D_i_QeSo.js";import"./vendor-react-BPknnnEA.js";import"./index-DgSc1Qy8.js";import"./table-BRU4Enia.js";import"./util-mDHAL0lx.js";import"./lodash-B4Ozcv0x.js";import"./cache-state-lld4zuDg.js";import"./link-3eeclTeS.js";import"./filter-toolbar-BydfQ-79.js";import"./product-select-0ScZE2e8.js";import"./info-card-C1yxhxJG.js";import"./actions-EPYeS5p4.js";import"./actions-jxGAdGfb.js";import"./click-boundary-y8dVA_tr.js";function d(){return t.jsx(r,{})}export{d as default};
@@ -1 +0,0 @@
1
- import{y as n}from"./vendor-blocklet-D_i_QeSo.js";import{j as e,e as r}from"./vendor-mui-BXZut9Pz.js";import{u as i,P as a}from"./index-DgSc1Qy8.js";import{e as c}from"./vendor-react-BPknnnEA.js";const m={pay:r.lazy(()=>n(()=>import("./pay-CSpHBUh_.js"),[])),"pricing-table":r.lazy(()=>n(()=>import("./pricing-table-edE6TJGX.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 +0,0 @@
1
- import{j as t}from"./vendor-mui-BXZut9Pz.js";import{P as o}from"./list-DnePqZ2K.js";import"./vendor-blocklet-D_i_QeSo.js";import"./vendor-react-BPknnnEA.js";import"./index-DgSc1Qy8.js";import"./table-BRU4Enia.js";import"./util-mDHAL0lx.js";import"./lodash-B4Ozcv0x.js";import"./cache-state-lld4zuDg.js";import"./link-3eeclTeS.js";import"./filter-toolbar-BydfQ-79.js";import"./product-select-0ScZE2e8.js";import"./info-card-C1yxhxJG.js";import"./actions-jxGAdGfb.js";import"./click-boundary-y8dVA_tr.js";function c(){return t.jsx(o,{})}export{c as default};
@@ -1 +0,0 @@
1
- import{V as p,an as v,y as s}from"./vendor-blocklet-D_i_QeSo.js";import{j as e,q as u,r as c,e as o}from"./vendor-mui-BXZut9Pz.js";import{b as h}from"./index-DgSc1Qy8.js";import{a as b,e as x}from"./vendor-react-BPknnnEA.js";const E=o.lazy(()=>s(()=>import("./detail-K9EVY3r2.js"),[])),T=o.lazy(()=>s(()=>import("./detail-DG4l2CqN.js"),[])),r={webhooks:o.lazy(()=>s(()=>import("./index-1y9kjPIr.js"),[])),events:o.lazy(()=>s(()=>import("./index-DtbqgSK4.js"),[]))};function D(){const i=b(),{t:a}=p(),{page:t="webhooks"}=x(),{startTransition:l}=h();if(t.startsWith("evt_"))return e.jsx(E,{id:t});if(t.startsWith("we_"))return e.jsx(T,{id:t});const _=d=>{l(()=>{i(`/admin/developers/${d}`)})},n=r[t]||r.webhooks,m=[{label:a("admin.webhooks"),value:"webhooks"},{label:a("admin.events.title"),value:"events"}];return e.jsxs("div",{children:[e.jsx(u,{variant:"h5",sx:{mb:1},children:a("admin.developers")}),e.jsx(v,{tabs:m,current:t,onChange:_,scrollButtons:"auto"}),c.isValidElement(n)?n:e.jsx(n,{})]})}export{D as default};