@arcblock/payment-service 1.29.9 → 1.29.10

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 (170) hide show
  1. package/dist/cf.js +51 -51
  2. package/dist/index.js +195 -43
  3. package/package.json +3 -3
  4. package/web/assets/{account-Clbqiiw3.js → account-DrsnH5wP.js} +1 -1
  5. package/web/assets/{action-DENqSeOa.js → action-C2c0yWuW.js} +1 -1
  6. package/web/assets/{actions-CDsj5j8l.js → actions--FNKSNIs.js} +1 -1
  7. package/web/assets/{actions-BJDN6Op2.js → actions-BEUwbsq1.js} +1 -1
  8. package/web/assets/{actions-CSpJGOX7.js → actions-C9AfME83.js} +1 -1
  9. package/web/assets/{actions-BD9BAp3M.js → actions-D2-s31n3.js} +1 -1
  10. package/web/assets/{actions-BSNy5bOd.js → actions-DXMceTgd.js} +1 -1
  11. package/web/assets/{actions-0iWP2mcx.js → actions-DeCPtfTK.js} +1 -1
  12. package/web/assets/{actions-DGQs8fFF.js → actions-DtNZGZWf.js} +1 -1
  13. package/web/assets/{actions-D3tJgrUn.js → actions-JHsqbHpB.js} +1 -1
  14. package/web/assets/{actions-CZL47E9r.js → actions-izdZ2Mn4.js} +1 -1
  15. package/web/assets/{add-price-BpnICuHO.js → add-price-TdXAR3NW.js} +1 -1
  16. package/web/assets/{admin-CD8ViZ7D.js → admin-BpFv3eF5.js} +1 -1
  17. package/web/assets/{assign-0vMUDW_C.js → assign-DKRfmN7W.js} +1 -1
  18. package/web/assets/{attempts-CKlxkJuE.js → attempts-BfbYfiJa.js} +1 -1
  19. package/web/assets/browser-DF2vfpBa.js +1 -0
  20. package/web/assets/{change-payment-gAlRmJpv.js → change-payment-j5UC8_h0.js} +1 -1
  21. package/web/assets/{change-plan-C47wfWH8.js → change-plan-CtXvsIDw.js} +1 -1
  22. package/web/assets/{click-boundary-CafubiPp.js → click-boundary-Bi28Y0Fq.js} +1 -1
  23. package/web/assets/{connect-BHHzrwLA.js → connect-CXek4LAE.js} +1 -1
  24. package/web/assets/{copyable-QrCyyiou.js → copyable-CprMHdhV.js} +1 -1
  25. package/web/assets/{create-ke4FrPx1.js → create-B-Ubepl_.js} +1 -1
  26. package/web/assets/{create-DNar5UQD.js → create-BVt_sQ_7.js} +1 -1
  27. package/web/assets/{create-0PUtkJZY.js → create-BWviSWbC.js} +1 -1
  28. package/web/assets/{create-BJ1asdcy.js → create-C6jihslA.js} +1 -1
  29. package/web/assets/{create-C7GOgZZM.js → create-IaalYGmm.js} +1 -1
  30. package/web/assets/{create-Bgv5ux17.js → create-jzl1m8ZK.js} +1 -1
  31. package/web/assets/{credit-grant-item-list-CeDAM3qV.js → credit-grant-item-list-DQcvdSRs.js} +1 -1
  32. package/web/assets/{credit-overview-4zh0H02x.js → credit-overview-CPId2vzk.js} +1 -1
  33. package/web/assets/{currency-restrictions-BcEm8W45.js → currency-restrictions-Dsupz2ce.js} +1 -1
  34. package/web/assets/{currency-select-B4ieQBvv.js → currency-select-C8j7QQMP.js} +1 -1
  35. package/web/assets/{dayjs-DUTDpcNU.js → dayjs-DUNWtvju.js} +1 -1
  36. package/web/assets/{description-SnR5WxWT.js → description-BHxdy5I3.js} +1 -1
  37. package/web/assets/{detail-DNcp_u5S.js → detail-B17BN6kU.js} +1 -1
  38. package/web/assets/detail-BJ-hl5PK.js +10 -0
  39. package/web/assets/{detail-46aLUdJj.js → detail-BJEqTXDS.js} +1 -1
  40. package/web/assets/{detail-BQpDGZJQ.js → detail-BdC9VIc6.js} +1 -1
  41. package/web/assets/{detail-DbU3p040.js → detail-BkRkrKyw.js} +1 -1
  42. package/web/assets/{detail-DACnmls3.js → detail-BvcI9cB_.js} +1 -1
  43. package/web/assets/detail-C--ATvwm.js +24 -0
  44. package/web/assets/{detail-Cg505nKX.js → detail-CHJqYZ0W.js} +1 -1
  45. package/web/assets/{detail-B0IHl4MI.js → detail-CfvKZ7IV.js} +1 -1
  46. package/web/assets/{detail-Ct5QNBqu.js → detail-CmIweOLE.js} +1 -1
  47. package/web/assets/{detail-BXTsnQny.js → detail-D729Bgs6.js} +1 -1
  48. package/web/assets/{detail-C_Zdfa0y.js → detail-DD1YBtex.js} +1 -1
  49. package/web/assets/detail-DOcm4Kqg.js +15 -0
  50. package/web/assets/{detail-Bfnkg0A1.js → detail-DQj1mbhA.js} +1 -1
  51. package/web/assets/detail-DTXDMIR9.js +15 -0
  52. package/web/assets/{detail-CsGZMimg.js → detail-DUAJzKsu.js} +1 -1
  53. package/web/assets/{detail-BwH0DwAi.js → detail-De8PyTyx.js} +1 -1
  54. package/web/assets/{detail-B_lpOomD.js → detail-DqfxOHky.js} +1 -1
  55. package/web/assets/{detail-CMBRd4Ct.js → detail-Dzt5tfyZ.js} +1 -1
  56. package/web/assets/{detail-Tn2R5C8i.js → detail-H0dkKVyS.js} +1 -1
  57. package/web/assets/{detail-CyMhK5K_.js → detail-MgdgGj5J.js} +1 -1
  58. package/web/assets/{detail-DCTb8R7F.js → detail-WAmPM6yq.js} +1 -1
  59. package/web/assets/{detail-B-ceWfZr.js → detail-g6el9Fxj.js} +1 -1
  60. package/web/assets/did-Bqcz-NjH.js +1 -0
  61. package/web/assets/{drawer-form-DspWWj3x.js → drawer-form-CQjNFFWk.js} +1 -1
  62. package/web/assets/{edit-Bkj-OTJh.js → edit-DAU8AWzT.js} +1 -1
  63. package/web/assets/{editor-AmthipP2.js → editor-vZvxDUTl.js} +1 -1
  64. package/web/assets/{embed-rRKjDoHi.js → embed-ClYNqZbf.js} +1 -1
  65. package/web/assets/{filter-toolbar-DXGSTq57.js → filter-toolbar-VvmMATj0.js} +1 -1
  66. package/web/assets/{form-BmQlJZ84.js → form-4_MzglPj.js} +1 -1
  67. package/web/assets/{form-cX026J4G.js → form-AFzUvoFE.js} +1 -1
  68. package/web/assets/{form-B5WW-lS5.js → form-Bro99BjK.js} +1 -1
  69. package/web/assets/{form-CAPjlw7l.js → form-CnrBCyTJ.js} +1 -1
  70. package/web/assets/form-Cuvruf4H.js +16 -0
  71. package/web/assets/{gas-nyR96dB0.js → gas-kw2KMH1u.js} +1 -1
  72. package/web/assets/{generateCategoricalChart-BadryV3H.js → generateCategoricalChart-BCpuUeC_.js} +1 -1
  73. package/web/assets/{home-_eX1aim8.js → home-ZNJREzbw.js} +1 -1
  74. package/web/assets/{index-CbSXdD6E.js → index-ASk8vU2H.js} +1 -1
  75. package/web/assets/{index-ajD9Iotk.js → index-B4n6PvPu.js} +1 -1
  76. package/web/assets/{index-BarN7DfU.js → index-B4yaPb7B.js} +5 -5
  77. package/web/assets/{index-DSe7Dot_.js → index-BHwID_s4.js} +1 -1
  78. package/web/assets/index-BMcnd_jZ.js +1 -0
  79. package/web/assets/{index-BTfJ08JU.js → index-BRmN8ViQ.js} +1 -1
  80. package/web/assets/index-BdbLl6St.js +1 -0
  81. package/web/assets/{index-CCVDDX0c.js → index-BjKRyxNQ.js} +1 -1
  82. package/web/assets/index-BjLJQRKY.js +1 -0
  83. package/web/assets/index-BkNCPnTn.js +1 -0
  84. package/web/assets/index-BlAwTTmu.js +1 -0
  85. package/web/assets/{index-C136x0O2.js → index-BtWfmATr.js} +1 -1
  86. package/web/assets/{index-DNGmCIRP.js → index-C-5n472s.js} +1 -1
  87. package/web/assets/{index-CW8VfoJO.js → index-C3AP4jq0.js} +1 -1
  88. package/web/assets/{index-C-RT84yb.js → index-C3Rh1SaB.js} +1 -1
  89. package/web/assets/index-CDyxbCzc.js +1 -0
  90. package/web/assets/{index-SOzRg0yJ.js → index-CH_k9MVv.js} +1 -1
  91. package/web/assets/{index-XaFn2ySq.js → index-CKPfOW6M.js} +1 -1
  92. package/web/assets/{index-BQjlhCSt.js → index-CPFlZhA2.js} +1 -1
  93. package/web/assets/{index-Du0Ieh1F.js → index-CPyGjEd3.js} +2 -2
  94. package/web/assets/index-ChC-jsE2.js +1 -0
  95. package/web/assets/{index-D-bx9Kam.js → index-CiWvs3j9.js} +1 -1
  96. package/web/assets/{index-mn5Zdrtn.js → index-D6gv9jHh.js} +1 -1
  97. package/web/assets/{index-Cd_BD9TM.js → index-D7pWd60Z.js} +1 -1
  98. package/web/assets/{index-YG5oc8O3.js → index-DAen2-cr.js} +1 -1
  99. package/web/assets/{index-BRENdB5m.js → index-DNobX-Tr.js} +1 -1
  100. package/web/assets/{index-Kd_qCyRG.js → index-DY-g0BPU.js} +1 -1
  101. package/web/assets/{index-D0mynT6_.js → index-DZkpxY-C.js} +1 -1
  102. package/web/assets/{index-DcddP3R9.js → index-Dh9agU9O.js} +1 -1
  103. package/web/assets/{index-BBHMsIxJ.js → index-Dju8k6mq.js} +1 -1
  104. package/web/assets/{index-DeK5Pqjv.js → index-DwDNPqjF.js} +1 -1
  105. package/web/assets/{index-DEiuhiEo.js → index-Dze0CpfQ.js} +1 -1
  106. package/web/assets/{index-UYeD8rTJ.js → index-eDERHpkr.js} +1 -1
  107. package/web/assets/{index-BzABukCz.js → index-mgPU1lyd.js} +1 -1
  108. package/web/assets/{index-W2uZUlFs.js → index-olGOY5KB.js} +1 -1
  109. package/web/assets/{index-DoX0A-rP.js → index-oy7LrXGT.js} +1 -1
  110. package/web/assets/{index-qulrJQ4J.js → index-x7sBb6oM.js} +1 -1
  111. package/web/assets/{index.es-C8dcCHdW.js → index.es-C2Q6Owow.js} +1 -1
  112. package/web/assets/{info-card-BvIMFQo5.js → info-card-C9dRgztS.js} +1 -1
  113. package/web/assets/{info-metric-Dl4ZDm0Z.js → info-metric-ukWq8INi.js} +1 -1
  114. package/web/assets/{info-row-jI0h_hv4.js → info-row-CaPaNF4L.js} +1 -1
  115. package/web/assets/{info-row-group-CFuMWJf1.js → info-row-group-Cxo-4Gk5.js} +1 -1
  116. package/web/assets/{libphonenumber-Qs8PCdM-.js → libphonenumber-CTvobi0D.js} +1 -1
  117. package/web/assets/{link-CmPoIweR.js → link-DsltSF2Q.js} +1 -1
  118. package/web/assets/{list-CkHExntK.js → list-B2b-s8wM.js} +1 -1
  119. package/web/assets/{list-DLB_hd0Q.js → list-BzgF4i3i.js} +1 -1
  120. package/web/assets/{list-BdSkPjIa.js → list-Cd1O-aDi.js} +1 -1
  121. package/web/assets/{list-DaK9287Y.js → list-CvM46TsP.js} +1 -1
  122. package/web/assets/{list-CWMEf-_C.js → list-DtEjqlED.js} +1 -1
  123. package/web/assets/{list-DVFJwd_I.js → list-O_uCSLFq.js} +1 -1
  124. package/web/assets/{list-DghnUOc4.js → list-YNWVqjwW.js} +1 -1
  125. package/web/assets/{list-eFkvVlp5.js → list-ZaBapEXW.js} +1 -1
  126. package/web/assets/{metadata-BmQTVFku.js → metadata-_hV0ZaVh.js} +1 -1
  127. package/web/assets/{meter-event-B1JIhVpb.js → meter-event-CPVBpekF.js} +1 -1
  128. package/web/assets/{metrics-UvxyQbUF.js → metrics-DVPdwpyf.js} +1 -1
  129. package/web/assets/{overview-Cxc6WKba.js → overview-CGdVIJrJ.js} +1 -1
  130. package/web/assets/{overview-DrMaIptb.js → overview-CN59I5Sc.js} +1 -1
  131. package/web/assets/{past-due-CUXkxns0.js → past-due-C3PtU8uo.js} +1 -1
  132. package/web/assets/pay-XVdSNq__.js +4 -0
  133. package/web/assets/{payment-method-info-Bsf89VxV.js → payment-method-info-D_qR04xC.js} +1 -1
  134. package/web/assets/{preview-C-H8pGVw.js → preview-Bdtbh-xk.js} +1 -1
  135. package/web/assets/{preview-BifsgUGT.js → preview-F3lma170.js} +1 -1
  136. package/web/assets/{pricing-table-BUJdtkMq.js → pricing-table-Bt2WljzE.js} +1 -1
  137. package/web/assets/{pricing-table-B3QOaAB5.js → pricing-table-D9FGYBVa.js} +1 -1
  138. package/web/assets/{product-select-ChEyoJqJ.js → product-select-_72p-5lF.js} +1 -1
  139. package/web/assets/{recharge-BVT4USAO.js → recharge-CSlKshbU.js} +1 -1
  140. package/web/assets/{related-credit-grants-JV2ICsR5.js → related-credit-grants-DnKdAit6.js} +3 -3
  141. package/web/assets/{safe-did-address-CiG_V6Gy.js → safe-did-address-CRTPYo34.js} +1 -1
  142. package/web/assets/{source-data-viewer-i1q9wNIG.js → source-data-viewer-D1GShrs5.js} +1 -1
  143. package/web/assets/{status-CUVYrUIG.js → status-3Swm2gK5.js} +1 -1
  144. package/web/assets/subscription-BX00k6FU.js +1 -0
  145. package/web/assets/{subscription-DrnSPIfs.js → subscription-Bzeblscr.js} +1 -1
  146. package/web/assets/table-BN3WBnr3.js +1 -0
  147. package/web/assets/{tax-code-select-TS07I0rB.js → tax-code-select-j2arPbaE.js} +1 -1
  148. package/web/assets/{tax-utils-bPjALcVG.js → tax-utils-B8J0Kfnz.js} +1 -1
  149. package/web/assets/{uploader-CsQNHG4I.js → uploader-BLdAbLR6.js} +1 -1
  150. package/web/assets/{usage-records-DAUQMJAW.js → usage-records-BAwNs1y8.js} +1 -1
  151. package/web/assets/{util-DxXTXkeY.js → util-B8B3fsMa.js} +1 -1
  152. package/web/assets/{vendor-arcblock-BTCAQSUK.js → vendor-arcblock-D1drrE7q.js} +1 -1
  153. package/web/assets/{vendor-blocklet-DcLR2Cyf.js → vendor-blocklet-B67R14so.js} +2 -2
  154. package/web/index.html +1 -1
  155. package/web/assets/browser-DDv4_sgY.js +0 -1
  156. package/web/assets/detail-B8eOBVSQ.js +0 -15
  157. package/web/assets/detail-BO3zglCn.js +0 -15
  158. package/web/assets/detail-C1FupF1D.js +0 -24
  159. package/web/assets/detail-wU4wNf4s.js +0 -10
  160. package/web/assets/form-DD-EiA7W.js +0 -16
  161. package/web/assets/index-BhcoukR2.js +0 -1
  162. package/web/assets/index-BturOfxo.js +0 -1
  163. package/web/assets/index-CDVogp6E.js +0 -1
  164. package/web/assets/index-DcrGSDby.js +0 -1
  165. package/web/assets/index-Dybqd298.js +0 -1
  166. package/web/assets/index-EXZPddtw.js +0 -1
  167. package/web/assets/index-brUCsnBA.js +0 -1
  168. package/web/assets/pay-omLYkqRA.js +0 -4
  169. package/web/assets/subscription-BYz_k9dq.js +0 -1
  170. package/web/assets/table-BrtHemkA.js +0 -1
@@ -0,0 +1 @@
1
+ import{j as t}from"./vendor-mui-BXZut9Pz.js";import{E as r}from"./list-CvM46TsP.js";import"./vendor-blocklet-B67R14so.js";import"./vendor-react-BPknnnEA.js";import"./index-B4yaPb7B.js";import"./table-BN3WBnr3.js";function a(){return t.jsx(r,{features:{toolbar:!1}})}export{a as default};
@@ -1 +1 @@
1
- import{V as d,ao as m,A as r}from"./vendor-blocklet-DcLR2Cyf.js";import{j as o,r as p,e}from"./vendor-mui-BXZut9Pz.js";import{b as v}from"./index-BarN7DfU.js";import{a as x,e as T}from"./vendor-react-BPknnnEA.js";const b=e.lazy(()=>r(()=>import("./detail-Tn2R5C8i.js"),[])),E=e.lazy(()=>r(()=>import("./detail-CsGZMimg.js"),[])),f=e.lazy(()=>r(()=>import("./detail-B-ceWfZr.js"),[])),a={overview:e.lazy(()=>r(()=>import("./index-C-RT84yb.js"),[]))};function y(){const s=x(),{t:n}=d(),{page:t="overview"}=T(),{startTransition:c}=v();if(t.startsWith("cus_"))return o.jsx(b,{id:t});if(t.startsWith("credgr_"))return o.jsx(E,{id:t});if(t.startsWith("cbtxn_"))return o.jsx(f,{id:t});const l=_=>{c(()=>{s(`/admin/customers/${_}`)})},i=a[t]||a.overview,u=[{label:n("admin.overview"),value:"overview"}];return o.jsxs("div",{children:[o.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:o.jsx(i,{})]})}export{y as default};
1
+ import{V as d,ao as m,A as r}from"./vendor-blocklet-B67R14so.js";import{j as o,r as p,e}from"./vendor-mui-BXZut9Pz.js";import{b as v}from"./index-B4yaPb7B.js";import{a as x,e as T}from"./vendor-react-BPknnnEA.js";const b=e.lazy(()=>r(()=>import("./detail-H0dkKVyS.js"),[])),E=e.lazy(()=>r(()=>import("./detail-DUAJzKsu.js"),[])),f=e.lazy(()=>r(()=>import("./detail-g6el9Fxj.js"),[])),a={overview:e.lazy(()=>r(()=>import("./index-C3Rh1SaB.js"),[]))};function y(){const s=x(),{t:n}=d(),{page:t="overview"}=T(),{startTransition:c}=v();if(t.startsWith("cus_"))return o.jsx(b,{id:t});if(t.startsWith("credgr_"))return o.jsx(E,{id:t});if(t.startsWith("cbtxn_"))return o.jsx(f,{id:t});const l=_=>{c(()=>{s(`/admin/customers/${_}`)})},i=a[t]||a.overview,u=[{label:n("admin.overview"),value:"overview"}];return o.jsxs("div",{children:[o.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:o.jsx(i,{})]})}export{y as default};
@@ -1 +1 @@
1
- import{V as d,ao as p,A as i}from"./vendor-blocklet-DcLR2Cyf.js";import{j as e,a3 as v,B as x,r as E,e as r}from"./vendor-mui-BXZut9Pz.js";import{b}from"./index-BarN7DfU.js";import{a as T,e as f}from"./vendor-react-BPknnnEA.js";const y=r.lazy(()=>i(()=>import("./detail-CyMhK5K_.js"),[])),D=r.lazy(()=>i(()=>import("./detail-C_Zdfa0y.js"),[])),h=r.lazy(()=>i(()=>import("./detail-BwH0DwAi.js"),[])),j=r.lazy(()=>i(()=>import("./create-BJ1asdcy.js"),[])),I=r.lazy(()=>i(()=>import("./meter-event-B1JIhVpb.js"),[])),n={invoices:r.lazy(()=>i(()=>import("./index-BturOfxo.js"),[])),subscriptions:r.lazy(()=>i(()=>import("./index-CDVogp6E.js"),[])),meters:r.lazy(()=>i(()=>import("./index-DSe7Dot_.js"),[])),"meter-events":r.lazy(()=>i(()=>import("./index-C136x0O2.js"),[])),overdue:r.lazy(()=>i(()=>import("./index-BQjlhCSt.js"),[]))};function z(){const l=T(),{t:s}=d(),{page:t="invoices"}=f(),{startTransition:_}=b();if(t.startsWith("sub_"))return e.jsx(y,{id:t});if(t.startsWith("in_"))return e.jsx(D,{id:t});if(t.startsWith("mtr_"))return e.jsx(h,{id:t});if(t.startsWith("mevt_"))return e.jsx(I,{id:t});const u=c=>{_(()=>{l(`/admin/billing/${c}`)})},a=n[t]||n.subscriptions,m=[{label:s("admin.invoices"),value:"invoices"},{label:s("admin.subscriptions"),value:"subscriptions"},{label:s("admin.meters"),value:"meters"},{label:s("admin.meterEvents.title"),value:"meter-events"},{label:s("admin.overdue.title"),value:"overdue"}];let o=null;return t==="meters"&&(o=e.jsx(j,{})),e.jsxs(e.Fragment,{children:[e.jsxs(v,{direction:"row",spacing:1,sx:{alignItems:"flex-start",justifyContent:"end",flexWrap:"wrap"},children:[e.jsx(p,{tabs:m,current:t,onChange:u,scrollButtons:"auto",variant:"scrollable",sx:{flex:"1 0 auto",maxWidth:"100%",".MuiTab-root":{color:"text.lighter"},".MuiTabs-indicator":{display:"none"},".Mui-selected":{fontSize:24,color:"text.primary"},".MuiTabs-hideScrollbar":{border:"none !important"},".MuiTouchRipple-root":{display:"none"}}}),e.jsx(x,{children:o})]}),E.isValidElement(a)?a:e.jsx(a,{})]})}export{z as default};
1
+ import{V as d,ao as p,A as i}from"./vendor-blocklet-B67R14so.js";import{j as e,a3 as v,B as x,r as E,e as r}from"./vendor-mui-BXZut9Pz.js";import{b}from"./index-B4yaPb7B.js";import{a as T,e as f}from"./vendor-react-BPknnnEA.js";const y=r.lazy(()=>i(()=>import("./detail-MgdgGj5J.js"),[])),D=r.lazy(()=>i(()=>import("./detail-DD1YBtex.js"),[])),h=r.lazy(()=>i(()=>import("./detail-De8PyTyx.js"),[])),j=r.lazy(()=>i(()=>import("./create-C6jihslA.js"),[])),I=r.lazy(()=>i(()=>import("./meter-event-CPVBpekF.js"),[])),n={invoices:r.lazy(()=>i(()=>import("./index-BjLJQRKY.js"),[])),subscriptions:r.lazy(()=>i(()=>import("./index-BlAwTTmu.js"),[])),meters:r.lazy(()=>i(()=>import("./index-BHwID_s4.js"),[])),"meter-events":r.lazy(()=>i(()=>import("./index-BtWfmATr.js"),[])),overdue:r.lazy(()=>i(()=>import("./index-CPFlZhA2.js"),[]))};function z(){const l=T(),{t:s}=d(),{page:t="invoices"}=f(),{startTransition:_}=b();if(t.startsWith("sub_"))return e.jsx(y,{id:t});if(t.startsWith("in_"))return e.jsx(D,{id:t});if(t.startsWith("mtr_"))return e.jsx(h,{id:t});if(t.startsWith("mevt_"))return e.jsx(I,{id:t});const u=c=>{_(()=>{l(`/admin/billing/${c}`)})},a=n[t]||n.subscriptions,m=[{label:s("admin.invoices"),value:"invoices"},{label:s("admin.subscriptions"),value:"subscriptions"},{label:s("admin.meters"),value:"meters"},{label:s("admin.meterEvents.title"),value:"meter-events"},{label:s("admin.overdue.title"),value:"overdue"}];let o=null;return t==="meters"&&(o=e.jsx(j,{})),e.jsxs(e.Fragment,{children:[e.jsxs(v,{direction:"row",spacing:1,sx:{alignItems:"flex-start",justifyContent:"end",flexWrap:"wrap"},children:[e.jsx(p,{tabs:m,current:t,onChange:u,scrollButtons:"auto",variant:"scrollable",sx:{flex:"1 0 auto",maxWidth:"100%",".MuiTab-root":{color:"text.lighter"},".MuiTabs-indicator":{display:"none"},".Mui-selected":{fontSize:24,color:"text.primary"},".MuiTabs-hideScrollbar":{border:"none !important"},".MuiTouchRipple-root":{display:"none"}}}),e.jsx(x,{children:o})]}),E.isValidElement(a)?a:e.jsx(a,{})]})}export{z as default};
@@ -1 +1 @@
1
- import{j as n,A as x,w as h,q as c}from"./vendor-mui-BXZut9Pz.js";import{V as u,Y as g,Z as d,P as y}from"./vendor-blocklet-DcLR2Cyf.js";import{I as j,e as f,k as b,T as k}from"./index-BarN7DfU.js";import{L as p}from"./vendor-react-BPknnnEA.js";import{A as L}from"./actions-BJDN6Op2.js";import{C as _}from"./click-boundary-CafubiPp.js";function v(r){const t=Object.assign({variant:"compact"},r),{t:a}=u(),[l,o]=g({action:"",loading:!1}),m=async()=>{try{o({loading:!0}),await f.delete(`/api/passports/assign/${t.data.name}`).then(e=>e.data),d.success(a("common.saved"))}catch(e){console.error(e),d.error(b(e))}finally{o({loading:!1,action:""})}},i=[{label:a("admin.passport.unassign"),handler:()=>o({action:"unassign"}),color:"error"}];return n.jsxs(_,{children:[n.jsx(L,{variant:t.variant,actions:i}),l.action==="unassign"&&n.jsx(j,{onConfirm:m,onCancel:()=>o({action:""}),title:a("admin.passport.unassign"),message:a("admin.passport.unassignTip")})]})}const P=(r={})=>{const t=new URLSearchParams;return Object.keys(r).forEach(a=>{t.set(a,String(r[a]))}),f.get(`/api/passports?${t.toString()}`).then(a=>a.data)};function A(){const r="passports",{t}=u(),{loading:a,error:l,data:o}=y(P);if(l)return n.jsx(x,{severity:"error",children:l.message});if(a||!o)return n.jsx(h,{});if(o&&o.length===0)return n.jsx(c,{sx:{color:"text.secondary"},children:t("admin.event.empty")});const m=[{label:t("common.title"),name:"title",options:{sort:!1}},{label:t("common.description"),name:"description",options:{sort:!1}},{label:t("admin.products"),name:"",options:{sort:!1,customBodyRenderLite:(i,e)=>{const s=o[e].extra?.payment?.product;return s?n.jsx(p,{to:`/admin/products/${s}`,children:s}):n.jsx(c,{component:"span",sx:{color:"text.secondary"},children:t("common.none")})}}},{label:t("admin.passport.payLink"),name:"",options:{sort:!1,customBodyRenderLite:(i,e)=>{const s=o[e].extra?.acquire?.pay;return s&&(s.startsWith("plink_")||s.startsWith("prctbl_"))?n.jsx(p,{to:`/admin/products/${s}`,children:s}):n.jsx(c,{component:"span",sx:{color:"text.secondary"},children:t("common.none")})}}},{label:t("admin.passport.payPreview"),name:"",options:{sort:!1,customBodyRenderLite:(i,e)=>{const s=o[e].extra?.acquire?.pay;if(s){if(s.startsWith("plink_"))return n.jsx(p,{to:`/checkout/pay/${s}`,target:"_blank",children:s});if(s.startsWith("prctbl_"))return n.jsx(p,{to:`/checkout/pricing-table/${s}`,target:"_blank",children:s})}return n.jsx(c,{component:"span",sx:{color:"text.secondary"},children:t("common.none")})}}},{label:t("common.actions"),name:"",options:{sort:!1,customBodyRenderLite:(i,e)=>n.jsx(v,{data:o[e]})}}].filter(Boolean);return n.jsx(k,{durable:r,data:o,columns:m,loading:a,title:n.jsx(c,{variant:"subtitle1",sx:{color:"text.secondary",whiteSpace:"break-spaces"},children:t("admin.passport.intro")}),options:{count:o.length,page:1,rowsPerPage:100}})}export{A as default};
1
+ import{j as n,A as x,w as h,q as c}from"./vendor-mui-BXZut9Pz.js";import{V as u,Y as g,Z as d,P as y}from"./vendor-blocklet-B67R14so.js";import{I as j,e as f,k as b,T as k}from"./index-B4yaPb7B.js";import{L as p}from"./vendor-react-BPknnnEA.js";import{A as L}from"./actions-BEUwbsq1.js";import{C as _}from"./click-boundary-Bi28Y0Fq.js";function v(r){const t=Object.assign({variant:"compact"},r),{t:a}=u(),[l,o]=g({action:"",loading:!1}),m=async()=>{try{o({loading:!0}),await f.delete(`/api/passports/assign/${t.data.name}`).then(e=>e.data),d.success(a("common.saved"))}catch(e){console.error(e),d.error(b(e))}finally{o({loading:!1,action:""})}},i=[{label:a("admin.passport.unassign"),handler:()=>o({action:"unassign"}),color:"error"}];return n.jsxs(_,{children:[n.jsx(L,{variant:t.variant,actions:i}),l.action==="unassign"&&n.jsx(j,{onConfirm:m,onCancel:()=>o({action:""}),title:a("admin.passport.unassign"),message:a("admin.passport.unassignTip")})]})}const P=(r={})=>{const t=new URLSearchParams;return Object.keys(r).forEach(a=>{t.set(a,String(r[a]))}),f.get(`/api/passports?${t.toString()}`).then(a=>a.data)};function A(){const r="passports",{t}=u(),{loading:a,error:l,data:o}=y(P);if(l)return n.jsx(x,{severity:"error",children:l.message});if(a||!o)return n.jsx(h,{});if(o&&o.length===0)return n.jsx(c,{sx:{color:"text.secondary"},children:t("admin.event.empty")});const m=[{label:t("common.title"),name:"title",options:{sort:!1}},{label:t("common.description"),name:"description",options:{sort:!1}},{label:t("admin.products"),name:"",options:{sort:!1,customBodyRenderLite:(i,e)=>{const s=o[e].extra?.payment?.product;return s?n.jsx(p,{to:`/admin/products/${s}`,children:s}):n.jsx(c,{component:"span",sx:{color:"text.secondary"},children:t("common.none")})}}},{label:t("admin.passport.payLink"),name:"",options:{sort:!1,customBodyRenderLite:(i,e)=>{const s=o[e].extra?.acquire?.pay;return s&&(s.startsWith("plink_")||s.startsWith("prctbl_"))?n.jsx(p,{to:`/admin/products/${s}`,children:s}):n.jsx(c,{component:"span",sx:{color:"text.secondary"},children:t("common.none")})}}},{label:t("admin.passport.payPreview"),name:"",options:{sort:!1,customBodyRenderLite:(i,e)=>{const s=o[e].extra?.acquire?.pay;if(s){if(s.startsWith("plink_"))return n.jsx(p,{to:`/checkout/pay/${s}`,target:"_blank",children:s});if(s.startsWith("prctbl_"))return n.jsx(p,{to:`/checkout/pricing-table/${s}`,target:"_blank",children:s})}return n.jsx(c,{component:"span",sx:{color:"text.secondary"},children:t("common.none")})}}},{label:t("common.actions"),name:"",options:{sort:!1,customBodyRenderLite:(i,e)=>n.jsx(v,{data:o[e]})}}].filter(Boolean);return n.jsx(k,{durable:r,data:o,columns:m,loading:a,title:n.jsx(c,{variant:"subtitle1",sx:{color:"text.secondary",whiteSpace:"break-spaces"},children:t("admin.passport.intro")}),options:{count:o.length,page:1,rowsPerPage:100}})}export{A as default};
@@ -1 +1 @@
1
- import{r as f,j as s,w as x}from"./vendor-mui-BXZut9Pz.js";import{cv as y,V as P,O as C}from"./vendor-blocklet-DcLR2Cyf.js";import{a as L,b9 as g,Y as v,n as R,j as h,T as w,e as z}from"./index-BarN7DfU.js";import{L as l}from"./vendor-react-BPknnnEA.js";import{F as B}from"./filter-toolbar-DXGSTq57.js";import{I as T}from"./info-card-BvIMFQo5.js";import{P as $}from"./actions-CSpJGOX7.js";import{n as q}from"./util-DxXTXkeY.js";import"./lodash-B4Ozcv0x.js";import"./product-select-ChEyoJqJ.js";import"./actions-BJDN6Op2.js";import"./click-boundary-CafubiPp.js";import"./assign-0vMUDW_C.js";import"./edit-Bkj-OTJh.js";import"./form-cX026J4G.js";import"./collapse-CSrlJ0eG.js";import"./currency-select-B4ieQBvv.js";import"./currency-GstdXsJf.js";import"./form-CAPjlw7l.js";import"./uploader-CsQNHG4I.js";import"./tax-code-select-TS07I0rB.js";import"./collapse-BvbJGg1V.js";const A=(n={})=>{const c=new URLSearchParams;return Object.keys(n).forEach(a=>{let m=n[a];a==="q"&&(m=Object.entries(m).map(u=>u.join(":")).join(" ")),c.set(a,String(m))}),z.get(`/api/products?${c.toString()}`).then(a=>a.data)};function at(){const n="products",c=y(n),{t:a,locale:m}=P(),{settings:u}=L(),[r,d]=C(n,{defaultValue:{active:"",pageSize:c.rowsPerPage||20,page:c.page?c.page+1:1,donation:"hide"}}),[i,j]=f.useState({}),p=()=>A(r).then(e=>{j(e)});if(g("product.created",()=>p(),[]),g("product.updated",()=>p(),[]),g("product.deleted",()=>p(),[]),f.useEffect(()=>{p()},[r]),!i.list)return s.jsx(x,{});const b=[{label:a("admin.product.name.label"),name:"name",options:{filter:!0,customBodyRenderLite:(e,o)=>{const t=i.list[o],_=v(u.paymentMethods,t.prices[0]?.currency_id??"")||u.baseCurrency;return s.jsx(l,{to:`/admin/products/${t.id}`,children:s.jsx(T,{name:t.name,description:q(t,_,m),logo:t.images[0]})})}}},{label:a("common.status"),name:"active",options:{filter:!0,customBodyRenderLite:(e,o)=>{const t=i.list[o];return s.jsx(l,{to:`/admin/products/${t.id}`,children:s.jsx(R,{label:t?.active?"Active":"Archived",color:t?.active?"success":"default"})})}}},{label:a("common.createdAt"),name:"created_at",options:{sort:!0,customBodyRenderLite:(e,o)=>{const t=i.list[o];return s.jsx(l,{to:`/admin/products/${t.id}`,children:h(t.created_at)})}}},{label:a("common.updatedAt"),name:"updated_at",options:{sort:!0,customBodyRenderLite:(e,o)=>{const t=i.list[o];return s.jsx(l,{to:`/admin/products/${t.id}`,children:h(t.updated_at)})}}},{label:a("common.actions"),name:"id",width:100,align:"center",options:{sort:!1,customBodyRenderLite:(e,o)=>{const t=i.list[o];return s.jsx($,{data:t,onChange:p})}}}],S=({page:e,rowsPerPage:o})=>{r.pageSize!==o?d(t=>({...t,pageSize:o,page:1})):r.page!==e+1&&d(t=>({...t,page:e+1}))};return s.jsx(w,{hasRowLink:!0,durable:`__${n}__`,durableKeys:["page","rowsPerPage","searchText"],title:s.jsx(B,{setSearch:d,search:r,status:["active","archived"]}),data:i.list,columns:b,options:{count:i.count,page:r.page-1,rowsPerPage:r.pageSize,onColumnSortChange(e,o){d({...r,q:r.q||{},o})},onSearchChange:e=>{d(e?{...r,q:{"like-description":e,"like-name":e},pageSize:100,page:1}:{...r,pageSize:100,page:1,q:{}})}},loading:!i.list,onChange:S})}export{at as default};
1
+ import{r as f,j as s,w as x}from"./vendor-mui-BXZut9Pz.js";import{cv as y,V as P,O as C}from"./vendor-blocklet-B67R14so.js";import{a as L,b9 as g,Y as v,n as R,j as h,T as w,e as z}from"./index-B4yaPb7B.js";import{L as l}from"./vendor-react-BPknnnEA.js";import{F as B}from"./filter-toolbar-VvmMATj0.js";import{I as T}from"./info-card-C9dRgztS.js";import{P as $}from"./actions-C9AfME83.js";import{n as q}from"./util-B8B3fsMa.js";import"./lodash-B4Ozcv0x.js";import"./product-select-_72p-5lF.js";import"./actions-BEUwbsq1.js";import"./click-boundary-Bi28Y0Fq.js";import"./assign-DKRfmN7W.js";import"./edit-DAU8AWzT.js";import"./form-AFzUvoFE.js";import"./collapse-CSrlJ0eG.js";import"./currency-select-C8j7QQMP.js";import"./currency-GstdXsJf.js";import"./form-CnrBCyTJ.js";import"./uploader-BLdAbLR6.js";import"./tax-code-select-j2arPbaE.js";import"./collapse-BvbJGg1V.js";const A=(n={})=>{const c=new URLSearchParams;return Object.keys(n).forEach(a=>{let m=n[a];a==="q"&&(m=Object.entries(m).map(u=>u.join(":")).join(" ")),c.set(a,String(m))}),z.get(`/api/products?${c.toString()}`).then(a=>a.data)};function at(){const n="products",c=y(n),{t:a,locale:m}=P(),{settings:u}=L(),[r,d]=C(n,{defaultValue:{active:"",pageSize:c.rowsPerPage||20,page:c.page?c.page+1:1,donation:"hide"}}),[i,j]=f.useState({}),p=()=>A(r).then(e=>{j(e)});if(g("product.created",()=>p(),[]),g("product.updated",()=>p(),[]),g("product.deleted",()=>p(),[]),f.useEffect(()=>{p()},[r]),!i.list)return s.jsx(x,{});const b=[{label:a("admin.product.name.label"),name:"name",options:{filter:!0,customBodyRenderLite:(e,o)=>{const t=i.list[o],_=v(u.paymentMethods,t.prices[0]?.currency_id??"")||u.baseCurrency;return s.jsx(l,{to:`/admin/products/${t.id}`,children:s.jsx(T,{name:t.name,description:q(t,_,m),logo:t.images[0]})})}}},{label:a("common.status"),name:"active",options:{filter:!0,customBodyRenderLite:(e,o)=>{const t=i.list[o];return s.jsx(l,{to:`/admin/products/${t.id}`,children:s.jsx(R,{label:t?.active?"Active":"Archived",color:t?.active?"success":"default"})})}}},{label:a("common.createdAt"),name:"created_at",options:{sort:!0,customBodyRenderLite:(e,o)=>{const t=i.list[o];return s.jsx(l,{to:`/admin/products/${t.id}`,children:h(t.created_at)})}}},{label:a("common.updatedAt"),name:"updated_at",options:{sort:!0,customBodyRenderLite:(e,o)=>{const t=i.list[o];return s.jsx(l,{to:`/admin/products/${t.id}`,children:h(t.updated_at)})}}},{label:a("common.actions"),name:"id",width:100,align:"center",options:{sort:!1,customBodyRenderLite:(e,o)=>{const t=i.list[o];return s.jsx($,{data:t,onChange:p})}}}],S=({page:e,rowsPerPage:o})=>{r.pageSize!==o?d(t=>({...t,pageSize:o,page:1})):r.page!==e+1&&d(t=>({...t,page:e+1}))};return s.jsx(w,{hasRowLink:!0,durable:`__${n}__`,durableKeys:["page","rowsPerPage","searchText"],title:s.jsx(B,{setSearch:d,search:r,status:["active","archived"]}),data:i.list,columns:b,options:{count:i.count,page:r.page-1,rowsPerPage:r.pageSize,onColumnSortChange(e,o){d({...r,q:r.q||{},o})},onSearchChange:e=>{d(e?{...r,q:{"like-description":e,"like-name":e},pageSize:100,page:1}:{...r,pageSize:100,page:1,q:{}})}},loading:!i.list,onChange:S})}export{at as default};
@@ -1 +1 @@
1
- import{V as f,an as v,ao as _,A as r}from"./vendor-blocklet-DcLR2Cyf.js";import{r as c,j as t,a3 as j,e as n}from"./vendor-mui-BXZut9Pz.js";import{L as h}from"./admin-CD8ViZ7D.js";import{u as b,b as E,c as T}from"./index-BarN7DfU.js";import{a as l,e as w}from"./vendor-react-BPknnnEA.js";const i={overview:n.lazy(()=>r(()=>import("./overview-DrMaIptb.js"),[])),donations:n.lazy(()=>r(()=>import("./index-UYeD8rTJ.js"),[]))};function y(){const o=l(),{t:e}=f(),{updateAppInfo:u}=v(),{group:a="overview"}=w(),{isPending:p,startTransition:m}=E(),d=x=>{m(()=>{o(`/integrations/${x}`)})},s=i[a]||i.overview,g=[{label:e("common.quickStarts"),value:"overview"},{label:e("admin.donate.title"),value:"donations"}];return c.useEffect(()=>{u({description:e("integrations.description")})},[e]),t.jsxs(t.Fragment,{children:[t.jsx(T,{pending:p}),t.jsx(j,{direction:"row",spacing:1,sx:{alignItems:"center",justifyContent:"end",flexWrap:"wrap",mt:1,pb:2},children:t.jsx(_,{tabs:g,current:a,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"}}})}),t.jsx("div",{className:"page-content",children:n.isValidElement(s)?s:t.jsx(s,{})})]})}function L(){const{session:o}=b(),e=l();return c.useEffect(()=>{o.user&&["owner","admin"].includes(o.user.role)===!1&&e("/customer")},[o.user]),t.jsx(h,{children:t.jsx(y,{})})}export{L as default};
1
+ import{V as f,an as v,ao as _,A as r}from"./vendor-blocklet-B67R14so.js";import{r as c,j as t,a3 as j,e as n}from"./vendor-mui-BXZut9Pz.js";import{L as h}from"./admin-BpFv3eF5.js";import{u as b,b as E,c as T}from"./index-B4yaPb7B.js";import{a as l,e as w}from"./vendor-react-BPknnnEA.js";const i={overview:n.lazy(()=>r(()=>import("./overview-CN59I5Sc.js"),[])),donations:n.lazy(()=>r(()=>import("./index-eDERHpkr.js"),[]))};function y(){const o=l(),{t:e}=f(),{updateAppInfo:u}=v(),{group:a="overview"}=w(),{isPending:p,startTransition:m}=E(),d=x=>{m(()=>{o(`/integrations/${x}`)})},s=i[a]||i.overview,g=[{label:e("common.quickStarts"),value:"overview"},{label:e("admin.donate.title"),value:"donations"}];return c.useEffect(()=>{u({description:e("integrations.description")})},[e]),t.jsxs(t.Fragment,{children:[t.jsx(T,{pending:p}),t.jsx(j,{direction:"row",spacing:1,sx:{alignItems:"center",justifyContent:"end",flexWrap:"wrap",mt:1,pb:2},children:t.jsx(_,{tabs:g,current:a,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"}}})}),t.jsx("div",{className:"page-content",children:n.isValidElement(s)?s:t.jsx(s,{})})]})}function L(){const{session:o}=b(),e=l();return c.useEffect(()=>{o.user&&["owner","admin"].includes(o.user.role)===!1&&e("/customer")},[o.user]),t.jsx(h,{children:t.jsx(y,{})})}export{L as default};
@@ -1,4 +1,4 @@
1
- import{r as y,j as e,w as K,a3 as g,N as W,bE as ge,B as i,q as p,Y as H,x as D,e as ye,bF as G,A as Y,aQ as ie,aT as J,ad as _,bG as je,ab as be,n as ve,a0 as Se,a2 as we,bf as X,L as Ce,O as ee,bH as ke,a1 as q,be as ze,bI as Te,bJ as De,bK as Ie,bL as Ae}from"./vendor-mui-BXZut9Pz.js";import{V as L,ah as Re,af as Ne,P as Q,$ as Me,O as Oe,Y as te,F as _e}from"./vendor-blocklet-DcLR2Cyf.js";import{d as Z,g as Le,f as Pe,e as P,h as Ee,F as $e,C as oe,i as ce,j as Fe,T as We,u as qe,a as ne,b as Be,k as Ue,l as Ve,m as Ke,O as He}from"./index-BarN7DfU.js";import{L as se,b as Ge,a as Ye}from"./vendor-react-BPknnnEA.js";import{l as U}from"./lodash-B4Ozcv0x.js";import{u as Je,C as ae,a as Qe}from"./credit-overview-4zh0H02x.js";import{S as Xe}from"./description-SnR5WxWT.js";import{S as re}from"./actions-DGQs8fFF.js";import{S as Ze}from"./status-CUVYrUIG.js";import{f as et,i as tt,d as nt}from"./util-DxXTXkeY.js";import{u as st}from"./table-BrtHemkA.js";import{C as at}from"./link-CmPoIweR.js";import"./collapse-CSrlJ0eG.js";import"./currency-GstdXsJf.js";import"./dayjs-DUTDpcNU.js";import"./actions-BJDN6Op2.js";import"./subscription-DrnSPIfs.js";function rt(t,a=300){const[n,r]=y.useState(!1),c=y.useRef(null);return y.useEffect(()=>(c.current&&clearTimeout(c.current),t?c.current=setTimeout(()=>{r(!0)},a):r(!1),()=>{c.current&&clearTimeout(c.current)}),[t,a]),n}const it=(t={})=>{const a=new URLSearchParams;return Object.keys(t).forEach(n=>{a.set(n,String(t[n]))}),P.get(`/api/subscriptions?${a.toString()}`).then(n=>n.data)},V=2;function ot({id:t,status:a,onChange:n=()=>{},onClickSubscription:r,onlyActive:c=!1,changeActive:d=()=>{},setStatusState:b=()=>{},setHasSubscriptions:k=()=>{},...h}){const{t:x,locale:C}=L(),{isMobile:S}=Z(),z=y.useRef(null),I=S?5:10,{data:l,loadMore:j,loadingMore:u,loading:N,reload:M}=Re(s=>{const v=s?Math.ceil(s.list.length/I)+1:1;return it({page:v,pageSize:I,status:a,customer_id:t,activeFirst:!0,showTotalCount:!0})},{reloadDeps:[t,a],onSuccess(s){s.totalCount>0||s.count>0?(b?.(!0),k?.(!0)):k?.(!1)},...S?{}:{target:z,isNoMore:s=>s?.list?.length===0||(s?.list?.length??0)>=(s?.count??0)}}),E=rt(u);if(!l||N)return e.jsx(K,{});const m=l.totalCount>0,R=l&&l.list?.length<l.count,T=S?{width:42,height:42}:{width:44,height:44};return e.jsx(g,{direction:"column",spacing:2,sx:{mt:2,containerType:"inline-size"},children:l.list?.length>0?e.jsxs(e.Fragment,{children:[e.jsx(g,{ref:z,sx:{maxHeight:{xs:"100%",md:"700px"},overflowY:"auto",webkitOverflowScrolling:"touch",display:"grid",gridTemplateColumns:{xs:"repeat(1, 1fr)",md:"repeat(2, 1fr)"},"@container (max-width: 600px)":{gridTemplateColumns:"repeat(1, 1fr)"},gap:2},children:l.list.map(s=>{const v=Le(s,C),$=v?x(`admin.subscription.${v?.action}`,{date:v?.time,prefix:v?.isToday?"at":"on"}):"";return e.jsxs(g,{sx:{flexWrap:"wrap",padding:2,borderRadius:1,border:"1px solid",borderColor:"divider",boxShadow:1,display:"flex",flexDirection:"column",justifyContent:"space-between",gap:2,width:"100%","&:hover":{backgroundColor:"grey.50",transition:"background-color 200ms linear",cursor:"pointer"}},children:[e.jsxs(g,{direction:"column",spacing:2,...h,sx:[{flex:1,width:"100%"},...Array.isArray(h.sx)?h.sx:[h.sx]],children:[e.jsx(g,{direction:"row",spacing:1,onClick:()=>r(s),sx:{alignItems:"flex-start",justifyContent:"space-between",width:"100%"},children:e.jsxs(g,{direction:"row",spacing:1.5,sx:{alignItems:"center",width:"100%"},children:[s.metadata?.appLogo?e.jsx(W,{src:et(s.metadata?.appLogo),alt:s.metadata?.appName,variant:"rounded",sx:T}):e.jsx(ge,{max:2,sx:{"& .MuiAvatar-colorDefault":{...T,boxSizing:"border-box"}},children:s.items.slice(0,2).map(f=>f.price.product.images.length>0?e.jsx(W,{src:f.price.product.images[0],alt:f.price.product.name,variant:"rounded",sx:T},f.price.product_id):e.jsx(W,{variant:"rounded",sx:T,children:f.price.product.name.slice(0,1)},f.price.product_id))}),e.jsxs(g,{direction:"column",spacing:.25,sx:{width:"100%"},children:[e.jsx(Xe,{subscription:s,hideSubscription:!0,maxLength:S?30:40,variant:S?"subtitle2":"subtitle1"}),e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"space-between"},children:[e.jsx(Ze,{subscription:s,sx:{height:18,width:"fit-content"},size:"small"}),(()=>{const f=s.items?.[0]?.price?.product?.vendor_config;return!f||f.length===0?null:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[f.slice(0,V).map((F,B)=>e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:.25,px:.5,py:.25,bgcolor:"action.hover",borderRadius:.5,border:"1px solid",borderColor:"divider"},children:[e.jsx(i,{sx:{width:4,height:4,borderRadius:"50%",bgcolor:"success.main"}}),e.jsx(p,{variant:"caption",sx:{color:"text.secondary",fontSize:"0.7rem",fontWeight:500,whiteSpace:"nowrap"},children:F.name||F.vendor_key})]},F.vendor_id||B)),f.length>V&&e.jsxs(p,{variant:"caption",sx:{color:"text.secondary",fontSize:"0.7rem",fontStyle:"italic",px:.5},children:["+",f.length-V," more"]})]})})()]})]})]})}),e.jsx(H,{}),e.jsxs(g,{sx:{gap:1,justifyContent:"space-between",flexWrap:"nowrap",flexDirection:"row",alignItems:"center"},children:[e.jsxs(i,{component:"div",onClick:()=>r(s),sx:{display:"flex",gap:{xs:.5,md:1},flexDirection:"row",flexWrap:"wrap"},children:[e.jsx(p,{variant:S?"subtitle2":"subtitle1",sx:{whiteSpace:"nowrap"},children:Pe(s.items?.[0]?.price,s.paymentCurrency,s.items?.[0]?.price?.product?.unit_label)}),$&&e.jsxs(p,{variant:"body2",sx:{color:"text.secondary"},children:["(",$,")"]})]}),e.jsx(re,{subscription:s,onChange:f=>{M(),n&&n(f)},showUnsubscribe:!1,showRecharge:!tt(s),showBalanceInfo:!0,includeActions:["recharge"],actionProps:{recharge:{variant:"text",color:"primary",sx:{whiteSpace:"nowrap"}}}})]})]}),e.jsx(g,{sx:{display:"flex",justifyContent:"flex-end",".action-button":{flex:1}},children:e.jsx(re,{subscription:s,onChange:f=>{M(),n&&n(f)},forceShowDetailAction:!0,showUnsubscribe:!1,excludeActions:["recharge"],actionProps:{cancel:{variant:"outlined",color:"primary"},recover:{variant:"outlined",color:"info"},pastDue:{variant:"outlined",color:"primary"},detail:{variant:"contained",sx:{color:"text.primary",backgroundColor:"grey.100","&:hover":{backgroundColor:"grey.200"}}},menu:{sx:{color:"text.primary"}}},mode:"menu-only",buttonSize:"medium"})})]},s.id)})}),R&&!S&&E&&e.jsx(i,{sx:{alignItems:"center",gap:.5,display:"flex",mt:.5},children:x("common.loadingMore",{resource:x("admin.subscriptions")})}),S&&e.jsxs(i,{children:[R&&e.jsx(D,{variant:"text",type:"button",color:"inherit",onClick:j,disabled:u,children:u?x("common.loadingMore",{resource:x("admin.subscriptions")}):x("common.loadMore",{resource:x("admin.subscriptions")})}),!R&&l.count>I&&e.jsx(p,{sx:{color:"text.secondary"},children:x("common.noMore",{resource:x("admin.subscriptions")})})]})]}):e.jsx(Ne,{children:c&&m?e.jsxs(i,{sx:{textAlign:"center"},children:[e.jsx(p,{children:x("admin.subscription.noActiveEmpty")}),d&&e.jsx(D,{onClick:()=>d(!1),variant:"text",sx:{color:"text.link"},children:x("admin.subscription.viewAll")})]}):x("admin.subscription.empty")})})}const ct=async()=>{const{data:t}=await P.get("/api/customers/me");return t.preference||{notification:{frequency:"default"}}},lt=async t=>{const{data:a}=await P.put("/api/customers/preference",t);return a},dt=t=>/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/.test(t);function ut({name:t,control:a,required:n,timeFormatErrorMessage:r}){return e.jsx(oe,{name:t,control:a,rules:{required:n,validate:c=>dt(c)||r},render:({field:c,fieldState:d})=>e.jsx(we,{type:"time",size:"small",sx:{minWidth:"fit-content","& input::-webkit-calendar-picker-indicator":{filter:b=>b.palette.mode==="dark"?"invert(1) brightness(80%)":"none"}},...c,error:!!d.error,helperText:d.error?.message})})}function mt({value:t,onChange:a,onBlur:n=()=>{}}){const{t:r}=L(),[c,d]=y.useState(!1),b=y.useRef(null),k=()=>{d(!1),n?.()};return e.jsxs(i,{children:[e.jsx(D,{ref:b,variant:"outlined",onClick:()=>d(!c),sx:{minWidth:"fit-content",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"grey.50","&:hover, &:focus":{borderColor:"primary.main"},color:"text.secondary"},size:"large",startIcon:e.jsx(je,{fontSize:"small",color:"action",sx:{fontSize:"1rem !important"}}),endIcon:e.jsx(p,{variant:"caption",color:"action",sx:{fontSize:"0.75rem !important",lineHeight:"normal"},children:r("notification.preferences.day")}),children:t||1}),e.jsx(be,{open:c,anchorEl:b.current,placement:"bottom-start",style:{zIndex:1300},modifiers:[{name:"offset",options:{offset:[0,8]}}],children:e.jsx(ve,{onClickAway:k,children:e.jsx(Se,{variant:"outlined",sx:{p:1,borderRadius:1,width:"280px",boxShadow:3},children:e.jsx(i,{sx:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:.5},children:Array.from({length:31},(h,x)=>x+1).map(h=>e.jsx(D,{size:"small",variant:t===h?"contained":"text",onClick:()=>{a(h),d(!1)},sx:{minWidth:30,height:30,p:0},children:h},h))})})})})]})}function xt({open:t,onClose:a}){const{t:n}=L(),[r,c]=y.useState(1),{data:d,loading:b}=Q(ct,{manual:!1,refreshDeps:[t]}),k=Ee({mode:"onChange",defaultValues:{notification:{frequency:"default",schedule:{time:"10:00",date:1}}}}),{handleSubmit:h,watch:x,reset:C,control:S,setValue:z,formState:{isValid:I}}=k,l=x("notification.frequency"),j=x("notification.schedule.date"),u=l!=="default";y.useEffect(()=>{d&&t&&(C(d),d.notification?.schedule?.date&&c(d.notification.schedule.date))},[d,C,t]),y.useEffect(()=>{j&&c(j)},[j]);const{loading:N,runAsync:M}=Q(lt,{manual:!0,onSuccess:()=>{a()}}),E=s=>{M(s)},m=s=>{z("notification.schedule.date",s,{shouldValidate:!0}),c(s)},R=s=>n(`common.days.${["sunday","monday","tuesday","wednesday","thursday","friday","saturday"][s]}`),T=s=>{z("notification.frequency",s.target.value)};return e.jsx(Me,{open:t,onClose:a,disableEscapeKeyDown:!0,title:e.jsxs(g,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(G,{fontSize:"small"}),e.jsx(p,{variant:"h6",component:"span",children:n("notification.preferences.title")})]}),maxWidth:"sm",fullWidth:!0,className:"base-dialog",actions:e.jsxs(g,{direction:"row",spacing:2,children:[e.jsx(D,{variant:"outlined",color:"inherit",onClick:a,children:n("common.cancel")}),e.jsxs(D,{variant:"contained",color:"primary",disabled:b||N||!I,onClick:h(E),children:[N&&e.jsx(K,{size:20,sx:{mr:1}}),n("common.save")]})]}),children:b?e.jsx(g,{sx:{alignItems:"center",justifyContent:"center",height:200},children:e.jsx(K,{})}):e.jsx($e,{...k,children:e.jsxs(i,{children:[e.jsx(Y,{severity:"info",children:n("notification.preferences.subscriptionRenewalNote")}),e.jsx(p,{id:"frequency-label",sx:{color:"text.primary",mt:2,mb:1},children:n("notification.preferences.frequency.label")}),e.jsx(g,{sx:{flexDirection:"row"},children:e.jsxs(i,{sx:{display:"flex",alignItems:"center",flexWrap:"nowrap",gap:{xs:.5,sm:1,md:2},width:"100%",overflow:"auto",pb:1},children:[e.jsx(ie,{sx:{width:{xs:"100px",sm:"120px"},minWidth:"fit-content"},children:e.jsxs(J,{value:l,onChange:T,size:"small",displayEmpty:!0,sx:{fontSize:{xs:"0.85rem",sm:"0.9rem"}},children:[e.jsx(_,{value:"default",children:n("notification.preferences.frequency.default")}),e.jsx(_,{value:"daily",children:n("notification.preferences.frequency.daily")}),e.jsx(_,{value:"weekly",children:n("notification.preferences.frequency.weekly")}),e.jsx(_,{value:"monthly",children:n("notification.preferences.frequency.monthly")})]})}),l!=="default"&&e.jsxs(e.Fragment,{children:[l==="weekly"&&e.jsx(oe,{name:"notification.schedule.date",control:S,render:({field:s})=>e.jsx(J,{size:"small",sx:{minWidth:120},value:s.value,onChange:s.onChange,children:[0,1,2,3,4,5,6].map(v=>e.jsx(_,{value:v,children:R(v)},v))})}),l==="monthly"&&e.jsx(mt,{value:j||1,onChange:m}),e.jsx(ut,{name:"notification.schedule.time",control:S,required:u,timeFormatErrorMessage:n("notification.preferences.timeFormatError")})]})]})}),r>28&&l==="monthly"&&e.jsxs(p,{variant:"caption",sx:{color:"text.secondary",fontStyle:"italic",display:"flex",alignItems:"center",gap:.5},children:[e.jsx(i,{component:"span",sx:{fontSize:"0.8rem"},children:"⚠️"}),n("notification.preferences.monthlyHelp")]})]})})})}function pt(){const{t}=L(),{isMobile:a}=Z(),[n,r]=ye.useState(!1);return e.jsxs(e.Fragment,{children:[a?e.jsx(D,{size:"small",variant:"outlined",sx:{minWidth:0,width:32,height:32,borderRadius:"50%"},onClick:()=>r(!0),children:e.jsx(G,{fontSize:"small"})}):e.jsx(D,{startIcon:e.jsx(G,{}),size:"small",onClick:()=>r(!0),variant:"outlined",sx:{whiteSpace:"nowrap"},children:t("notification.preferences.button")}),e.jsx(xt,{open:n,onClose:()=>r(!1)})]})}const ht=(t={})=>{const a=new URLSearchParams;return Object.keys(t).forEach(n=>{let r=t[n];n==="q"&&(r=Object.entries(r).map(c=>c.join(":")).join(" ")),a.set(n,String(r))}),P.get(`/api/payouts/mine?${a.toString()}`).then(n=>n.data)},ft=t=>t.customer_id?`customer-payouts-${t.customer_id}`:"payouts-mine";function gt({currency_id:t="",status:a="",customer_id:n=""}){const{t:r}=L(),{isMobile:c}=Z("sm"),d=Je(),b=ft({customer_id:n}),k=st(10),[h,x]=Oe(b,{defaultValue:{status:a,customer_id:n,currency_id:t,pageSize:k,page:1}}),[C,S]=y.useState({list:[],count:0});y.useEffect(()=>{nt(()=>{ht(h).then(l=>{S(l);const j=l.count>0;d?.hideRender(!j)})},300)()},[h,d]);const z=[{label:r("common.amount"),name:"id",align:"right",width:80,options:{customBodyRenderLite:(l,j)=>{const u=C.list[j];return e.jsx(se,{to:`/customer/payout/${u.id}`,children:e.jsxs(p,{component:"strong",sx:{fontWeight:600},children:[ce(u.amount,u?.paymentCurrency.decimal)," ",u?.paymentCurrency.symbol]})})}}},{label:r("customer.payout.payer"),name:"customer_id",options:{customBodyRenderLite:(l,j)=>{const u=C.list[j];return u?.paymentIntent?.customer?e.jsx(at,{customer:u.paymentIntent.customer,linkTo:`/customer/payout/${u.id}`,size:c?"small":"default"}):r("common.none")}}},{label:r("common.createdAt"),name:"created_at",options:{customBodyRenderLite:(l,j)=>{const u=C.list[j];return e.jsx(se,{to:`/customer/payout/${u.id}`,children:Fe(u.created_at)})}}}],I=({page:l,rowsPerPage:j})=>{h.pageSize!==j?x(u=>({...u,pageSize:j,page:1})):h.page!==l+1&&x(u=>({...u,page:l+1}))};return e.jsx(yt,{children:e.jsx(We,{hasRowLink:!0,durable:`__${b}__`,data:C.list||[],columns:z,loading:!C.list,onChange:I,options:{count:C.count,page:h.page-1,rowsPerPage:h.pageSize},toolbar:!1,showMobile:!1,mobileTDFlexDirection:"row",emptyNodeText:r("customer.payout.empty"),sx:{mt:2}})})}const yt=X(i)`
1
+ import{r as y,j as e,w as K,a3 as g,N as W,bE as ge,B as i,q as p,Y as H,x as D,e as ye,bF as G,A as Y,aQ as ie,aT as J,ad as _,bG as je,ab as be,n as ve,a0 as Se,a2 as we,bf as X,L as Ce,O as ee,bH as ke,a1 as q,be as ze,bI as Te,bJ as De,bK as Ie,bL as Ae}from"./vendor-mui-BXZut9Pz.js";import{V as L,ah as Re,af as Ne,P as Q,$ as Me,O as Oe,Y as te,F as _e}from"./vendor-blocklet-B67R14so.js";import{d as Z,g as Le,f as Pe,e as P,h as Ee,F as $e,C as oe,i as ce,j as Fe,T as We,u as qe,a as ne,b as Be,k as Ue,l as Ve,m as Ke,O as He}from"./index-B4yaPb7B.js";import{L as se,b as Ge,a as Ye}from"./vendor-react-BPknnnEA.js";import{l as U}from"./lodash-B4Ozcv0x.js";import{u as Je,C as ae,a as Qe}from"./credit-overview-CPId2vzk.js";import{S as Xe}from"./description-BHxdy5I3.js";import{S as re}from"./actions-DtNZGZWf.js";import{S as Ze}from"./status-3Swm2gK5.js";import{f as et,i as tt,d as nt}from"./util-B8B3fsMa.js";import{u as st}from"./table-BN3WBnr3.js";import{C as at}from"./link-DsltSF2Q.js";import"./collapse-CSrlJ0eG.js";import"./currency-GstdXsJf.js";import"./dayjs-DUNWtvju.js";import"./actions-BEUwbsq1.js";import"./subscription-Bzeblscr.js";function rt(t,a=300){const[n,r]=y.useState(!1),c=y.useRef(null);return y.useEffect(()=>(c.current&&clearTimeout(c.current),t?c.current=setTimeout(()=>{r(!0)},a):r(!1),()=>{c.current&&clearTimeout(c.current)}),[t,a]),n}const it=(t={})=>{const a=new URLSearchParams;return Object.keys(t).forEach(n=>{a.set(n,String(t[n]))}),P.get(`/api/subscriptions?${a.toString()}`).then(n=>n.data)},V=2;function ot({id:t,status:a,onChange:n=()=>{},onClickSubscription:r,onlyActive:c=!1,changeActive:d=()=>{},setStatusState:b=()=>{},setHasSubscriptions:k=()=>{},...h}){const{t:x,locale:C}=L(),{isMobile:S}=Z(),z=y.useRef(null),I=S?5:10,{data:l,loadMore:j,loadingMore:u,loading:N,reload:M}=Re(s=>{const v=s?Math.ceil(s.list.length/I)+1:1;return it({page:v,pageSize:I,status:a,customer_id:t,activeFirst:!0,showTotalCount:!0})},{reloadDeps:[t,a],onSuccess(s){s.totalCount>0||s.count>0?(b?.(!0),k?.(!0)):k?.(!1)},...S?{}:{target:z,isNoMore:s=>s?.list?.length===0||(s?.list?.length??0)>=(s?.count??0)}}),E=rt(u);if(!l||N)return e.jsx(K,{});const m=l.totalCount>0,R=l&&l.list?.length<l.count,T=S?{width:42,height:42}:{width:44,height:44};return e.jsx(g,{direction:"column",spacing:2,sx:{mt:2,containerType:"inline-size"},children:l.list?.length>0?e.jsxs(e.Fragment,{children:[e.jsx(g,{ref:z,sx:{maxHeight:{xs:"100%",md:"700px"},overflowY:"auto",webkitOverflowScrolling:"touch",display:"grid",gridTemplateColumns:{xs:"repeat(1, 1fr)",md:"repeat(2, 1fr)"},"@container (max-width: 600px)":{gridTemplateColumns:"repeat(1, 1fr)"},gap:2},children:l.list.map(s=>{const v=Le(s,C),$=v?x(`admin.subscription.${v?.action}`,{date:v?.time,prefix:v?.isToday?"at":"on"}):"";return e.jsxs(g,{sx:{flexWrap:"wrap",padding:2,borderRadius:1,border:"1px solid",borderColor:"divider",boxShadow:1,display:"flex",flexDirection:"column",justifyContent:"space-between",gap:2,width:"100%","&:hover":{backgroundColor:"grey.50",transition:"background-color 200ms linear",cursor:"pointer"}},children:[e.jsxs(g,{direction:"column",spacing:2,...h,sx:[{flex:1,width:"100%"},...Array.isArray(h.sx)?h.sx:[h.sx]],children:[e.jsx(g,{direction:"row",spacing:1,onClick:()=>r(s),sx:{alignItems:"flex-start",justifyContent:"space-between",width:"100%"},children:e.jsxs(g,{direction:"row",spacing:1.5,sx:{alignItems:"center",width:"100%"},children:[s.metadata?.appLogo?e.jsx(W,{src:et(s.metadata?.appLogo),alt:s.metadata?.appName,variant:"rounded",sx:T}):e.jsx(ge,{max:2,sx:{"& .MuiAvatar-colorDefault":{...T,boxSizing:"border-box"}},children:s.items.slice(0,2).map(f=>f.price.product.images.length>0?e.jsx(W,{src:f.price.product.images[0],alt:f.price.product.name,variant:"rounded",sx:T},f.price.product_id):e.jsx(W,{variant:"rounded",sx:T,children:f.price.product.name.slice(0,1)},f.price.product_id))}),e.jsxs(g,{direction:"column",spacing:.25,sx:{width:"100%"},children:[e.jsx(Xe,{subscription:s,hideSubscription:!0,maxLength:S?30:40,variant:S?"subtitle2":"subtitle1"}),e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"space-between"},children:[e.jsx(Ze,{subscription:s,sx:{height:18,width:"fit-content"},size:"small"}),(()=>{const f=s.items?.[0]?.price?.product?.vendor_config;return!f||f.length===0?null:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:.5,flexWrap:"wrap"},children:[f.slice(0,V).map((F,B)=>e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:.25,px:.5,py:.25,bgcolor:"action.hover",borderRadius:.5,border:"1px solid",borderColor:"divider"},children:[e.jsx(i,{sx:{width:4,height:4,borderRadius:"50%",bgcolor:"success.main"}}),e.jsx(p,{variant:"caption",sx:{color:"text.secondary",fontSize:"0.7rem",fontWeight:500,whiteSpace:"nowrap"},children:F.name||F.vendor_key})]},F.vendor_id||B)),f.length>V&&e.jsxs(p,{variant:"caption",sx:{color:"text.secondary",fontSize:"0.7rem",fontStyle:"italic",px:.5},children:["+",f.length-V," more"]})]})})()]})]})]})}),e.jsx(H,{}),e.jsxs(g,{sx:{gap:1,justifyContent:"space-between",flexWrap:"nowrap",flexDirection:"row",alignItems:"center"},children:[e.jsxs(i,{component:"div",onClick:()=>r(s),sx:{display:"flex",gap:{xs:.5,md:1},flexDirection:"row",flexWrap:"wrap"},children:[e.jsx(p,{variant:S?"subtitle2":"subtitle1",sx:{whiteSpace:"nowrap"},children:Pe(s.items?.[0]?.price,s.paymentCurrency,s.items?.[0]?.price?.product?.unit_label)}),$&&e.jsxs(p,{variant:"body2",sx:{color:"text.secondary"},children:["(",$,")"]})]}),e.jsx(re,{subscription:s,onChange:f=>{M(),n&&n(f)},showUnsubscribe:!1,showRecharge:!tt(s),showBalanceInfo:!0,includeActions:["recharge"],actionProps:{recharge:{variant:"text",color:"primary",sx:{whiteSpace:"nowrap"}}}})]})]}),e.jsx(g,{sx:{display:"flex",justifyContent:"flex-end",".action-button":{flex:1}},children:e.jsx(re,{subscription:s,onChange:f=>{M(),n&&n(f)},forceShowDetailAction:!0,showUnsubscribe:!1,excludeActions:["recharge"],actionProps:{cancel:{variant:"outlined",color:"primary"},recover:{variant:"outlined",color:"info"},pastDue:{variant:"outlined",color:"primary"},detail:{variant:"contained",sx:{color:"text.primary",backgroundColor:"grey.100","&:hover":{backgroundColor:"grey.200"}}},menu:{sx:{color:"text.primary"}}},mode:"menu-only",buttonSize:"medium"})})]},s.id)})}),R&&!S&&E&&e.jsx(i,{sx:{alignItems:"center",gap:.5,display:"flex",mt:.5},children:x("common.loadingMore",{resource:x("admin.subscriptions")})}),S&&e.jsxs(i,{children:[R&&e.jsx(D,{variant:"text",type:"button",color:"inherit",onClick:j,disabled:u,children:u?x("common.loadingMore",{resource:x("admin.subscriptions")}):x("common.loadMore",{resource:x("admin.subscriptions")})}),!R&&l.count>I&&e.jsx(p,{sx:{color:"text.secondary"},children:x("common.noMore",{resource:x("admin.subscriptions")})})]})]}):e.jsx(Ne,{children:c&&m?e.jsxs(i,{sx:{textAlign:"center"},children:[e.jsx(p,{children:x("admin.subscription.noActiveEmpty")}),d&&e.jsx(D,{onClick:()=>d(!1),variant:"text",sx:{color:"text.link"},children:x("admin.subscription.viewAll")})]}):x("admin.subscription.empty")})})}const ct=async()=>{const{data:t}=await P.get("/api/customers/me");return t.preference||{notification:{frequency:"default"}}},lt=async t=>{const{data:a}=await P.put("/api/customers/preference",t);return a},dt=t=>/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/.test(t);function ut({name:t,control:a,required:n,timeFormatErrorMessage:r}){return e.jsx(oe,{name:t,control:a,rules:{required:n,validate:c=>dt(c)||r},render:({field:c,fieldState:d})=>e.jsx(we,{type:"time",size:"small",sx:{minWidth:"fit-content","& input::-webkit-calendar-picker-indicator":{filter:b=>b.palette.mode==="dark"?"invert(1) brightness(80%)":"none"}},...c,error:!!d.error,helperText:d.error?.message})})}function mt({value:t,onChange:a,onBlur:n=()=>{}}){const{t:r}=L(),[c,d]=y.useState(!1),b=y.useRef(null),k=()=>{d(!1),n?.()};return e.jsxs(i,{children:[e.jsx(D,{ref:b,variant:"outlined",onClick:()=>d(!c),sx:{minWidth:"fit-content",display:"flex",alignItems:"center",justifyContent:"space-between",backgroundColor:"grey.50","&:hover, &:focus":{borderColor:"primary.main"},color:"text.secondary"},size:"large",startIcon:e.jsx(je,{fontSize:"small",color:"action",sx:{fontSize:"1rem !important"}}),endIcon:e.jsx(p,{variant:"caption",color:"action",sx:{fontSize:"0.75rem !important",lineHeight:"normal"},children:r("notification.preferences.day")}),children:t||1}),e.jsx(be,{open:c,anchorEl:b.current,placement:"bottom-start",style:{zIndex:1300},modifiers:[{name:"offset",options:{offset:[0,8]}}],children:e.jsx(ve,{onClickAway:k,children:e.jsx(Se,{variant:"outlined",sx:{p:1,borderRadius:1,width:"280px",boxShadow:3},children:e.jsx(i,{sx:{display:"grid",gridTemplateColumns:"repeat(7, 1fr)",gap:.5},children:Array.from({length:31},(h,x)=>x+1).map(h=>e.jsx(D,{size:"small",variant:t===h?"contained":"text",onClick:()=>{a(h),d(!1)},sx:{minWidth:30,height:30,p:0},children:h},h))})})})})]})}function xt({open:t,onClose:a}){const{t:n}=L(),[r,c]=y.useState(1),{data:d,loading:b}=Q(ct,{manual:!1,refreshDeps:[t]}),k=Ee({mode:"onChange",defaultValues:{notification:{frequency:"default",schedule:{time:"10:00",date:1}}}}),{handleSubmit:h,watch:x,reset:C,control:S,setValue:z,formState:{isValid:I}}=k,l=x("notification.frequency"),j=x("notification.schedule.date"),u=l!=="default";y.useEffect(()=>{d&&t&&(C(d),d.notification?.schedule?.date&&c(d.notification.schedule.date))},[d,C,t]),y.useEffect(()=>{j&&c(j)},[j]);const{loading:N,runAsync:M}=Q(lt,{manual:!0,onSuccess:()=>{a()}}),E=s=>{M(s)},m=s=>{z("notification.schedule.date",s,{shouldValidate:!0}),c(s)},R=s=>n(`common.days.${["sunday","monday","tuesday","wednesday","thursday","friday","saturday"][s]}`),T=s=>{z("notification.frequency",s.target.value)};return e.jsx(Me,{open:t,onClose:a,disableEscapeKeyDown:!0,title:e.jsxs(g,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(G,{fontSize:"small"}),e.jsx(p,{variant:"h6",component:"span",children:n("notification.preferences.title")})]}),maxWidth:"sm",fullWidth:!0,className:"base-dialog",actions:e.jsxs(g,{direction:"row",spacing:2,children:[e.jsx(D,{variant:"outlined",color:"inherit",onClick:a,children:n("common.cancel")}),e.jsxs(D,{variant:"contained",color:"primary",disabled:b||N||!I,onClick:h(E),children:[N&&e.jsx(K,{size:20,sx:{mr:1}}),n("common.save")]})]}),children:b?e.jsx(g,{sx:{alignItems:"center",justifyContent:"center",height:200},children:e.jsx(K,{})}):e.jsx($e,{...k,children:e.jsxs(i,{children:[e.jsx(Y,{severity:"info",children:n("notification.preferences.subscriptionRenewalNote")}),e.jsx(p,{id:"frequency-label",sx:{color:"text.primary",mt:2,mb:1},children:n("notification.preferences.frequency.label")}),e.jsx(g,{sx:{flexDirection:"row"},children:e.jsxs(i,{sx:{display:"flex",alignItems:"center",flexWrap:"nowrap",gap:{xs:.5,sm:1,md:2},width:"100%",overflow:"auto",pb:1},children:[e.jsx(ie,{sx:{width:{xs:"100px",sm:"120px"},minWidth:"fit-content"},children:e.jsxs(J,{value:l,onChange:T,size:"small",displayEmpty:!0,sx:{fontSize:{xs:"0.85rem",sm:"0.9rem"}},children:[e.jsx(_,{value:"default",children:n("notification.preferences.frequency.default")}),e.jsx(_,{value:"daily",children:n("notification.preferences.frequency.daily")}),e.jsx(_,{value:"weekly",children:n("notification.preferences.frequency.weekly")}),e.jsx(_,{value:"monthly",children:n("notification.preferences.frequency.monthly")})]})}),l!=="default"&&e.jsxs(e.Fragment,{children:[l==="weekly"&&e.jsx(oe,{name:"notification.schedule.date",control:S,render:({field:s})=>e.jsx(J,{size:"small",sx:{minWidth:120},value:s.value,onChange:s.onChange,children:[0,1,2,3,4,5,6].map(v=>e.jsx(_,{value:v,children:R(v)},v))})}),l==="monthly"&&e.jsx(mt,{value:j||1,onChange:m}),e.jsx(ut,{name:"notification.schedule.time",control:S,required:u,timeFormatErrorMessage:n("notification.preferences.timeFormatError")})]})]})}),r>28&&l==="monthly"&&e.jsxs(p,{variant:"caption",sx:{color:"text.secondary",fontStyle:"italic",display:"flex",alignItems:"center",gap:.5},children:[e.jsx(i,{component:"span",sx:{fontSize:"0.8rem"},children:"⚠️"}),n("notification.preferences.monthlyHelp")]})]})})})}function pt(){const{t}=L(),{isMobile:a}=Z(),[n,r]=ye.useState(!1);return e.jsxs(e.Fragment,{children:[a?e.jsx(D,{size:"small",variant:"outlined",sx:{minWidth:0,width:32,height:32,borderRadius:"50%"},onClick:()=>r(!0),children:e.jsx(G,{fontSize:"small"})}):e.jsx(D,{startIcon:e.jsx(G,{}),size:"small",onClick:()=>r(!0),variant:"outlined",sx:{whiteSpace:"nowrap"},children:t("notification.preferences.button")}),e.jsx(xt,{open:n,onClose:()=>r(!1)})]})}const ht=(t={})=>{const a=new URLSearchParams;return Object.keys(t).forEach(n=>{let r=t[n];n==="q"&&(r=Object.entries(r).map(c=>c.join(":")).join(" ")),a.set(n,String(r))}),P.get(`/api/payouts/mine?${a.toString()}`).then(n=>n.data)},ft=t=>t.customer_id?`customer-payouts-${t.customer_id}`:"payouts-mine";function gt({currency_id:t="",status:a="",customer_id:n=""}){const{t:r}=L(),{isMobile:c}=Z("sm"),d=Je(),b=ft({customer_id:n}),k=st(10),[h,x]=Oe(b,{defaultValue:{status:a,customer_id:n,currency_id:t,pageSize:k,page:1}}),[C,S]=y.useState({list:[],count:0});y.useEffect(()=>{nt(()=>{ht(h).then(l=>{S(l);const j=l.count>0;d?.hideRender(!j)})},300)()},[h,d]);const z=[{label:r("common.amount"),name:"id",align:"right",width:80,options:{customBodyRenderLite:(l,j)=>{const u=C.list[j];return e.jsx(se,{to:`/customer/payout/${u.id}`,children:e.jsxs(p,{component:"strong",sx:{fontWeight:600},children:[ce(u.amount,u?.paymentCurrency.decimal)," ",u?.paymentCurrency.symbol]})})}}},{label:r("customer.payout.payer"),name:"customer_id",options:{customBodyRenderLite:(l,j)=>{const u=C.list[j];return u?.paymentIntent?.customer?e.jsx(at,{customer:u.paymentIntent.customer,linkTo:`/customer/payout/${u.id}`,size:c?"small":"default"}):r("common.none")}}},{label:r("common.createdAt"),name:"created_at",options:{customBodyRenderLite:(l,j)=>{const u=C.list[j];return e.jsx(se,{to:`/customer/payout/${u.id}`,children:Fe(u.created_at)})}}}],I=({page:l,rowsPerPage:j})=>{h.pageSize!==j?x(u=>({...u,pageSize:j,page:1})):h.page!==l+1&&x(u=>({...u,page:l+1}))};return e.jsx(yt,{children:e.jsx(We,{hasRowLink:!0,durable:`__${b}__`,data:C.list||[],columns:z,loading:!C.list,onChange:I,options:{count:C.count,page:h.page-1,rowsPerPage:h.pageSize},toolbar:!1,showMobile:!1,mobileTDFlexDirection:"row",emptyNodeText:r("customer.payout.empty"),sx:{mt:2}})})}const yt=X(i)`
2
2
  @media (max-width: ${({theme:t})=>t.breakpoints.values.md}px) {
3
3
  .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > td.MuiTableCell-root {
4
4
  > div {
@@ -1 +1 @@
1
- import{V as p,ao as v,A as o}from"./vendor-blocklet-DcLR2Cyf.js";import{j as e,q as u,r as c,e as s}from"./vendor-mui-BXZut9Pz.js";import{b as h}from"./index-BarN7DfU.js";import{a as b,e as x}from"./vendor-react-BPknnnEA.js";const E=s.lazy(()=>o(()=>import("./detail-Ct5QNBqu.js"),[])),T=s.lazy(()=>o(()=>import("./detail-BQpDGZJQ.js"),[])),n={webhooks:s.lazy(()=>o(()=>import("./index-XaFn2ySq.js"),[])),events:s.lazy(()=>o(()=>import("./index-BhcoukR2.js"),[]))};function k(){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}`)})},r=n[t]||n.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(r)?r:e.jsx(r,{})]})}export{k as default};
1
+ import{V as p,ao as v,A as o}from"./vendor-blocklet-B67R14so.js";import{j as e,q as u,r as c,e as s}from"./vendor-mui-BXZut9Pz.js";import{b as h}from"./index-B4yaPb7B.js";import{a as b,e as x}from"./vendor-react-BPknnnEA.js";const E=s.lazy(()=>o(()=>import("./detail-CmIweOLE.js"),[])),T=s.lazy(()=>o(()=>import("./detail-BdC9VIc6.js"),[])),n={webhooks:s.lazy(()=>o(()=>import("./index-CKPfOW6M.js"),[])),events:s.lazy(()=>o(()=>import("./index-ChC-jsE2.js"),[]))};function k(){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}`)})},r=n[t]||n.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(r)?r:e.jsx(r,{})]})}export{k as default};
@@ -1,4 +1,4 @@
1
- import{r as pe,j as q,B as oe,q as me,a2 as ir,aQ as sr,aT as or,ad as ar,x as ut,X as be,a1 as zt,cq as ur,cK as cr,cL as lr,I as fr,cM as pr,u as gr,$ as ye,o as Ar,g as dr,w as hr}from"./vendor-mui-BXZut9Pz.js";import{cP as yr,k as br,aH as ct,bO as mr,cQ as Cr,A as ve,cR as Er,cS as Rr,cT as Ce,cU as Kt,cV as xr,cW as wr,cX as Xt,cY as vr,cZ as lt,bn as Sr,P as Ir}from"./vendor-blocklet-DcLR2Cyf.js";import{k as Br,m as Tr}from"./index-Du0Ieh1F.js";import"./vendor-react-BPknnnEA.js";import"./index-BarN7DfU.js";import"./browser-Bb9g-cvG.js";const Jt=pe.createContext({}),$t=()=>pe.useContext(Jt);function Or({children:n,restrictions:u,i18n:w,theme:C}){const[A,S]=yr({loading:!1}),s=i=>S(o=>({...o,loading:i})),t=pe.useMemo(()=>({...A,onLoading:s,restrictions:u,i18n:w}),[A]);return q.jsx(br,{theme:C,children:q.jsx(Jt.Provider,{value:t,children:n})})}const Lr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAskSURBVHgB7d3RcdTIGoZhcSJYMoAMIAIgAiACIALIwBCBIQIgA4jAkAEZQAYmAx+6iqnjM+vxjD3qX/qk56niYm92wYve6W790ty5+GMACPCfASCEYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYghWsG/fvg137twp+/X8+fOhh9+/f5f9GdrPjFyCFezz589DpXaxt7iM7Z9//hkeP348VPj69etALsEK9uXLl6FSi1WvSL5+/Xqo8OnTpy7RpYZghZrqwusVybbCaiut3trPzCorl2CFqt4ObrRt4Y8fP4axtVi9fPlyqNBiTybBCvTr169JD497rVCePn06VOh1Fkd/ghVo6i3N+/fvhx7atvDBgwdDhQ8fPgzkEaxAvYJxqLY66bXCe/bs2VDBtjCTYIVpoWhbwqn1WqFU3S2celvN7QhWmKkO27eZyWIKghWmevZqFzNZTEGwgsztAjOTRTXBCjKX7eCGmSyqCVaIuR4Sm8mikmCFmOvWpedM1r1794YKZrJyCFaIqWevduk5k2VbyDbBCjCX2atdzGRRRbACzO2wfZuZLKoIVoC5zF7t0nMm68WLF0MFM1kZBGvmUi6kXlFtzxaayWJDsGZu7tvBDTNZVBCsGUs7DDaTRW+CNWNpWxQzWfQmWDM219mrXcxk0ZtgzdTcZ692MZNFT4I1UymH7dvMZNGTYM3U3GevdjGTRU+CN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DNZyyNYf1XOXq39e+gqZ8/MZC2LYP1VOXu1truD2yof1TGTtSyC9VfVp9jS38xwKDNZhzOT9T+CNdTOXlWdfcxd5aM6ZrKWQ7CG2k+wtd4d3Fb9qI6ZrGVYfbCq33u1pkdx9qncFprJWobVB6tyqb32w/ZtlfNMZrKWYfXB8maGaVWd6ZnJWgZfVQ/EcOgOxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWECM/wKc/Y0zpWLfuAAAAABJRU5ErkJggg==",_r="/.well-known/payment/assets/bedrock-yFRPpe__.png",jr="/.well-known/payment/assets/deepseek-C3x42pq3.png",Nr="/.well-known/payment/assets/doubao-yPqHSkLx.png",Hr="/.well-known/payment/assets/gemini-DffKpc81.png",qr="/.well-known/payment/assets/google-DT1VSJ0m.png",Mr="/.well-known/payment/assets/ideogram-REIjy0Er.png",Wr="/.well-known/payment/assets/ollama-C7MZn2d_.png",Dr="/.well-known/payment/assets/openai-DlpqJdrb.png",Qr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0dSURBVHgB7d1Nb1XXucDxlahAogQUUi6VSG+iQCT7CmJyS0FB5WYQRreT209wP1w7yqhpB3QS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BAtIQLCANwQLSECwgDcEC0hAsIA3BAtIQLCANwQLSECwgDcEC0hAsIA3BAtIQLCANwQLSECwgDcEC0vgXkv5P8wQTb/sAAAAASUVORK5CYII=",Fr="/.well-known/payment/assets/poe-B588TgZu.png",kr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA1dSURBVHgB7d3tbRXXFgbg8dX9T1wBoQPSQejAVBBTgXEFSSogqQBcgdMBdAAdkA6gg3O9kCwhX3POfO5Za+Z5JCdSZBIfO+f1Xnve2XN2uNMBFPCfDqAIgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoAyBBZQhsIAyBBZQhsACyhBYQBkCCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoAyBBZQhsIAyBBZQhsACyhBYQBkCCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoAyBBZQhsIAyBBZQhsACyhBYQBkCCyhDYAFlCCygDIEFlCGw2J1///23e/bsWXd2drb6x6tXrzr6Ozvc6WBHXrx40X348KFb288//9y9f//+29/pxwqLXfnzzz9ThFV48+aNsBrICovduB8FM7i6uur++uuvjmEEFrsRYRWhtbZYVX3+/LljOCMhuxCjYIawCrFvxTgCi82LPas//vijy+D333+3bzWBkZBNi1VVXBXMsLp6/vx59/Hjx47xrLDYtCyj4E8//dTd3t52TCOw2Kx37959+8hAhWEeRkI2KdMoeHl52b19+7ZjOoHFJmmzb5ORkM3J1GY/dVUwS9WiCissNqVam/3ly5c24wcQWGxKpjZ7VBji6uCP/P33393r1687b8H+jIRsRrY2+7Gwiq8zwophBBabUK3NHhcFGE5gUV6sVrIchBdBdSo4v18Juno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f5CKyRMrXZs5xkei/LaKgFvz0Ca4S9tNnHylR1mNKC10bPR2ANtLc2+1jZWvBGw20QWAPstc0+VqYWfJxNRn0Ca4C9ttnHynSDdLTgs5z+GlwlHOfscKcDKMAKCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoAyBBZQhsIAyBBZQhsACyhBYQBkCCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoAyBBZQhsIAyBBZQhsACyhBYQBkCCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoIz/AWP7oZ6cDDZCAAAAAElFTkSuQmCC",xe={anthropic:Lr,bedrock:_r,deepseek:jr,doubao:Nr,gemini:Hr,google:qr,ideogram:Mr,ollama:Wr,openai:Dr,openrouter:Qr,poe:Fr,xai:kr},At={width:16,height:16,borderRadius:"2px",objectFit:"contain",backgroundColor:"transparent"};function Zr({onSubmit:n,models:u}){const{loading:w,i18n:C}=$t(),A=ct({model:"",prompt:"",number:1}),S=()=>{const i=JSON.parse(JSON.stringify(A));Object.values(A).every(E=>!!E)&&n(i)},{run:s}=mr(S,{wait:500}),t=pe.useMemo(()=>{const i=JSON.parse(JSON.stringify(A));return Object.values(i).some(o=>!o)},[JSON.stringify(A)]);return q.jsxs(Pr,{onSubmit:i=>i.preventDefault(),children:[q.jsxs(oe,{sx:{flex:1,height:"100%",overflow:"hidden",flexDirection:"column",display:"flex",mt:2,gap:2},children:[q.jsxs(oe,{sx:{mx:2,display:"flex",flexDirection:"column",gap:1},children:[q.jsx(me,{gutterBottom:!0,className:"title label",sx:{color:"text.primary"},children:C("aiImagePrompt")}),q.jsx(ir,{sx:{width:1},size:"small",type:"text",required:!0,placeholder:C("aiImagePromptTip"),multiline:!0,minRows:5,maxRows:6,value:A.prompt??"",onChange:i=>{i.stopPropagation(),A.prompt=i.target.value},slotProps:{htmlInput:{maxLength:1e3}}})]}),q.jsxs(oe,{sx:{px:2,display:"flex",flexDirection:"column",gap:1},children:[q.jsx(me,{gutterBottom:!0,className:"title label",sx:{color:"text.primary"},children:`${C("aiImageModel")}`}),q.jsx(sr,{fullWidth:!0,size:"small",children:q.jsx(or,{sx:{width:1},value:A.model,onChange:i=>{A.number=1,A.model=i.target.value},MenuProps:{disablePortal:!0},renderValue:i=>{const o=u.find(R=>`${R.provider}/${R.model}`===i);return o?q.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:1},children:[xe[o.provider]&&q.jsx(oe,{component:"img",src:xe[o.provider],alt:o.provider,style:At}),q.jsx(me,{variant:"body2",children:o.model})]}):i},children:u.map(i=>q.jsx(ar,{value:`${i.provider}/${i.model}`,children:q.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%"},children:[xe[i.provider]&&q.jsx(oe,{component:"img",src:xe[i.provider],alt:i.provider,style:At}),q.jsx(me,{variant:"body2",sx:{flex:1},children:i.model})]})},`${i.provider}/${i.model}`))})})]})]}),q.jsx(ut,{sx:{m:2,transition:"all 0.3s"},className:"submit-ai",variant:"contained",onClick:s,disabled:w||t,children:C(w?"aiImageGenerating":"aiImageGenerate")},w?"loading-submit":"submit")]})}const Pr=be(oe)`
1
+ import{r as pe,j as q,B as oe,q as me,a2 as ir,aQ as sr,aT as or,ad as ar,x as ut,X as be,a1 as zt,cq as ur,cK as cr,cL as lr,I as fr,cM as pr,u as gr,$ as ye,o as Ar,g as dr,w as hr}from"./vendor-mui-BXZut9Pz.js";import{cP as yr,k as br,aH as ct,bO as mr,cQ as Cr,A as ve,cR as Er,cS as Rr,cT as Ce,cU as Kt,cV as xr,cW as wr,cX as Xt,cY as vr,cZ as lt,bn as Sr,P as Ir}from"./vendor-blocklet-B67R14so.js";import{k as Br,m as Tr}from"./index-CPyGjEd3.js";import"./vendor-react-BPknnnEA.js";import"./index-B4yaPb7B.js";import"./browser-Bb9g-cvG.js";const Jt=pe.createContext({}),$t=()=>pe.useContext(Jt);function Or({children:n,restrictions:u,i18n:w,theme:C}){const[A,S]=yr({loading:!1}),s=i=>S(o=>({...o,loading:i})),t=pe.useMemo(()=>({...A,onLoading:s,restrictions:u,i18n:w}),[A]);return q.jsx(br,{theme:C,children:q.jsx(Jt.Provider,{value:t,children:n})})}const Lr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAskSURBVHgB7d3RcdTIGoZhcSJYMoAMIAIgAiACIALIwBCBIQIgA4jAkAEZQAYmAx+6iqnjM+vxjD3qX/qk56niYm92wYve6W790ty5+GMACPCfASCEYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYggWEEOwgBiCBcQQLCCGYAExBAuIIVhADMECYghWsG/fvg137twp+/X8+fOhh9+/f5f9GdrPjFyCFezz589DpXaxt7iM7Z9//hkeP348VPj69etALsEK9uXLl6FSi1WvSL5+/Xqo8OnTpy7RpYZghZrqwusVybbCaiut3trPzCorl2CFqt4ObrRt4Y8fP4axtVi9fPlyqNBiTybBCvTr169JD497rVCePn06VOh1Fkd/ghVo6i3N+/fvhx7atvDBgwdDhQ8fPgzkEaxAvYJxqLY66bXCe/bs2VDBtjCTY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XbjumUBksM1nLJlg7VL73aukPv75+/Xqo4j1ZyyZYO1TesTk5ORmWrPILHnqdA1Xe8ez1fOQSCNYOVXcHHzx4sKjZq10qZ7J6nQNV3fH0RtvdBOsK7S981eFn5XZpSu0MyEzWYcxk7SZYV6h879VaXt5WeXBtJmu5BOsKVZ9u7S//GraDG5WjG0uYyeLfBGtL+2Qze9VH5cH1EmaybAv/TbC2VH6yLXW6/TqVj+qYyVoewbqkcvaqPTe4xvcfVT6qYyZreQTrksol+NLezHCoykd1zGQtj2BdUnV3sB20r3E7uFEVLDNZyyNYf1XOXq39e+gqZ8/MZC2LYP1VOXu1truD2yof1TGTtSyC9VfVp9jS38xwKDNZhzOT9T+CNdTOXlWdfcxd5aM6ZrKWQ7CG2k+wtd4d3Fb9qI6ZrGVYfbCq33u1pkdx9qncFprJWobVB6tyqb32w/ZtlfNMZrKWYfXB8maGaVWd6ZnJWgZfVQ/EcOgOxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWEAMwQJiCBYQQ7CAGIIFxBAsIIZgATEEC4ghWECM/wKc/Y0zpWLfuAAAAABJRU5ErkJggg==",_r="/.well-known/payment/assets/bedrock-yFRPpe__.png",jr="/.well-known/payment/assets/deepseek-C3x42pq3.png",Nr="/.well-known/payment/assets/doubao-yPqHSkLx.png",Hr="/.well-known/payment/assets/gemini-DffKpc81.png",qr="/.well-known/payment/assets/google-DT1VSJ0m.png",Mr="/.well-known/payment/assets/ideogram-REIjy0Er.png",Wr="/.well-known/payment/assets/ollama-C7MZn2d_.png",Dr="/.well-known/payment/assets/openai-DlpqJdrb.png",Qr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0dSURBVHgB7d1Nb1XXucDxlahAogQUUi6VSG+iQCT7CmJyS0FB5WYQRreT209wP1w7yqhpB3QSKrUgEYWQFkIlLCW4aTASxrGRbRryIqX7OXBSILzY2Od4P2v9ftIRBKkDv5x/13r23us89V2nACTwdAFIQrCANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwgDQEC0hDsIA0BAtIQ7CANAQLSEOwqM7J9y+Wy1fmCvURLKqzvHKr/OHPfx2Ea2nly0I9flSgUpcuXx28jry+r0y8uqfseP7ZQm5WWFTvg48/Le+e/HAQL3ITLJqwfPPLwRbx1787ZZuYmGDRlAjXb35/ynwrKcGiSbE9jHCd7baL5CFYNC3mW7FNNN/KQbBo3nC+9c6JM7aJPSdYcMf8jWXzrZ5zHxbcJ7aHs9cWyxuTL5epiVcK/WGFBQ8Q28RT56bNt3pGsOARhvMt28R+sCWk15ZuPjoS27ZsKdu2jv7XePiYz8GJ29tEj/lsjqe+6xQYkwhQrFqWu9XK0s1b3d9vDf799n/fjtP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I7LNkebrxnH2qTC34GLVvbm469kNgLSBDm/1ehMvcY1ymFnx8LVrw+yGwFpClzR6roaWCUwueNQismVVrs4+1hxb8kvtYag3jCKwZxRsn0yi49JsiUws+vu9z7xnaeM9HYM0k0xOMozPVKjiztODvR0Mt+G0TWDPJMgq2bqVnasH3OVGV2gTWDDK12aON3nrFowVPKwJrokz3ts3RZh9riy14e1j5CKyJ4s2R5cbmtQudmVrwc/wSWfK1eFDrOAJrgnhTZBk/1hgFH8rUgo/RMM4gy8rqbRyBNVKmNvvV1VWq5nmWryXL6pf5CKyRMrXZs5xkei/LaKgFvz0Ca4S9tNnHylR1mNKC10bPR2ANtLc2+1jZWvBGw20QWAPstc0+VqYWfJxNRn0Ca4C9ttnHynSDdLTgs5z+GlwlHOfscKcDKMAKCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoAyBBZQhsIAyBBZQhsACyhBYQBkCCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoAyBBZQhsIAyBBZQhsACyhBYQBkCCyhDYAFlCCygDIEFlCGwgDIEFlCGwALKEFhAGQILKENgAWUILKAMgQWUIbCAMgQWUIbAAsoQWEAZAgsoQ2ABZQgsoIz/AWP7oZ6cDDZCAAAAAElFTkSuQmCC",xe={anthropic:Lr,bedrock:_r,deepseek:jr,doubao:Nr,gemini:Hr,google:qr,ideogram:Mr,ollama:Wr,openai:Dr,openrouter:Qr,poe:Fr,xai:kr},At={width:16,height:16,borderRadius:"2px",objectFit:"contain",backgroundColor:"transparent"};function Zr({onSubmit:n,models:u}){const{loading:w,i18n:C}=$t(),A=ct({model:"",prompt:"",number:1}),S=()=>{const i=JSON.parse(JSON.stringify(A));Object.values(A).every(E=>!!E)&&n(i)},{run:s}=mr(S,{wait:500}),t=pe.useMemo(()=>{const i=JSON.parse(JSON.stringify(A));return Object.values(i).some(o=>!o)},[JSON.stringify(A)]);return q.jsxs(Pr,{onSubmit:i=>i.preventDefault(),children:[q.jsxs(oe,{sx:{flex:1,height:"100%",overflow:"hidden",flexDirection:"column",display:"flex",mt:2,gap:2},children:[q.jsxs(oe,{sx:{mx:2,display:"flex",flexDirection:"column",gap:1},children:[q.jsx(me,{gutterBottom:!0,className:"title label",sx:{color:"text.primary"},children:C("aiImagePrompt")}),q.jsx(ir,{sx:{width:1},size:"small",type:"text",required:!0,placeholder:C("aiImagePromptTip"),multiline:!0,minRows:5,maxRows:6,value:A.prompt??"",onChange:i=>{i.stopPropagation(),A.prompt=i.target.value},slotProps:{htmlInput:{maxLength:1e3}}})]}),q.jsxs(oe,{sx:{px:2,display:"flex",flexDirection:"column",gap:1},children:[q.jsx(me,{gutterBottom:!0,className:"title label",sx:{color:"text.primary"},children:`${C("aiImageModel")}`}),q.jsx(sr,{fullWidth:!0,size:"small",children:q.jsx(or,{sx:{width:1},value:A.model,onChange:i=>{A.number=1,A.model=i.target.value},MenuProps:{disablePortal:!0},renderValue:i=>{const o=u.find(R=>`${R.provider}/${R.model}`===i);return o?q.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:1},children:[xe[o.provider]&&q.jsx(oe,{component:"img",src:xe[o.provider],alt:o.provider,style:At}),q.jsx(me,{variant:"body2",children:o.model})]}):i},children:u.map(i=>q.jsx(ar,{value:`${i.provider}/${i.model}`,children:q.jsxs(oe,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%"},children:[xe[i.provider]&&q.jsx(oe,{component:"img",src:xe[i.provider],alt:i.provider,style:At}),q.jsx(me,{variant:"body2",sx:{flex:1},children:i.model})]})},`${i.provider}/${i.model}`))})})]})]}),q.jsx(ut,{sx:{m:2,transition:"all 0.3s"},className:"submit-ai",variant:"contained",onClick:s,disabled:w||t,children:C(w?"aiImageGenerating":"aiImageGenerate")},w?"loading-submit":"submit")]})}const Pr=be(oe)`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  height: 100%;
@@ -1 +1 @@
1
- import{V as b,an as E,ao as y,A as i}from"./vendor-blocklet-DcLR2Cyf.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 A,S as C}from"./index-BarN7DfU.js";import{L}from"./admin-CD8ViZ7D.js";import{a as p,e as z}from"./vendor-react-BPknnnEA.js";const v={overview:s.lazy(()=>i(()=>import("./overview-Cxc6WKba.js").then(t=>t.o),[])),payments:s.lazy(()=>i(()=>import("./index-qulrJQ4J.js"),[])),customers:s.lazy(()=>i(()=>import("./index-D-bx9Kam.js"),[])),products:s.lazy(()=>i(()=>import("./index-DoX0A-rP.js").then(t=>t.i),[])),billing:s.lazy(()=>i(()=>import("./index-mn5Zdrtn.js"),[])),tax:s.lazy(()=>i(()=>import("./index-CW8VfoJO.js").then(t=>t.i),[])),developers:s.lazy(()=>i(()=>import("./index-D0mynT6_.js"),[])),settings:s.lazy(()=>i(()=>import("./index-SOzRg0yJ.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}=E(),a=w(),{group:r="overview"}=z(),{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(A,{pending:_}),o.jsxs(u,{direction:"row",spacing:1,sx:{alignItems:"center",justifyContent:"end",flexWrap:"wrap",mt:1,pb:2},children:[o.jsx(y,{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(C,{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(L,{children:o.jsx(R,{})})}export{k as default};
1
+ import{V as b,an as E,ao as y,A as i}from"./vendor-blocklet-B67R14so.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 A,S as C}from"./index-B4yaPb7B.js";import{L}from"./admin-BpFv3eF5.js";import{a as p,e as z}from"./vendor-react-BPknnnEA.js";const v={overview:s.lazy(()=>i(()=>import("./overview-CGdVIJrJ.js").then(t=>t.o),[])),payments:s.lazy(()=>i(()=>import("./index-x7sBb6oM.js"),[])),customers:s.lazy(()=>i(()=>import("./index-CiWvs3j9.js"),[])),products:s.lazy(()=>i(()=>import("./index-oy7LrXGT.js").then(t=>t.i),[])),billing:s.lazy(()=>i(()=>import("./index-D6gv9jHh.js"),[])),tax:s.lazy(()=>i(()=>import("./index-C3AP4jq0.js").then(t=>t.i),[])),developers:s.lazy(()=>i(()=>import("./index-DZkpxY-C.js"),[])),settings:s.lazy(()=>i(()=>import("./index-CH_k9MVv.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}=E(),a=w(),{group:r="overview"}=z(),{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(A,{pending:_}),o.jsxs(u,{direction:"row",spacing:1,sx:{alignItems:"center",justifyContent:"end",flexWrap:"wrap",mt:1,pb:2},children:[o.jsx(y,{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(C,{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(L,{children:o.jsx(R,{})})}export{k as default};
@@ -1 +1 @@
1
- import{j as e,a3 as S,q as j,r as E,B as w,ck as me,N as K,a2 as ae,Y as re,x as Y,w as $,bH as H,I as R,Q as xe,o as he,cA as Q,u as ye,A as ge,$ as ee,O as X,be as oe,a8 as fe,a9 as te,cI as ne,aH as se,cB as je,a1 as q,by as be,cJ as ve,cH as ke,br as Ce}from"./vendor-mui-BXZut9Pz.js";import{V as M,Y as O,F as V,Z as _,A as ie,cN as we,P as Ie,cO as Se,H as _e}from"./vendor-blocklet-DcLR2Cyf.js";import{E as Me,X as Le,aX as N,h as G,F as J,l as ce,e as D,b8 as A,k as F,ba as Te,a as Ee,b9 as B,I as Re,S as Pe}from"./index-BarN7DfU.js";import{I as ze}from"./collapse-BvbJGg1V.js";import{I as Oe}from"./info-card-BvIMFQo5.js";import{I as b}from"./info-row-jI0h_hv4.js";import{D as Z}from"./drawer-form-DspWWj3x.js";import{U as Ae}from"./uploader-CsQNHG4I.js";import{P as De,u as Fe}from"./form-BmQlJZ84.js";import"./vendor-react-BPknnnEA.js";import"./util-DxXTXkeY.js";import"./lodash-B4Ozcv0x.js";function le({disableKeys:t=[]}){const{t:s}=M(),{control:n,setValue:c}=Me(),l=Le({control:n,name:"logo"}),i=d=>{if(!d.url){c("logo","");return}const p=new URL(d.url);c("logo",p.pathname)};return e.jsxs(S,{direction:"column",spacing:2,sx:{alignItems:"flex-start"},children:[e.jsx(N,{name:"name",type:"text",rules:{required:!0},label:s("admin.paymentMethod.name.label"),placeholder:s("admin.paymentMethod.name.tip"),disabled:t.includes("name"),inputProps:{maxLength:32}},"name"),e.jsx(N,{name:"description",type:"text",rules:{required:!0},label:s("admin.paymentMethod.description.label"),placeholder:s("admin.paymentMethod.description.tip"),disabled:t.includes("description"),inputProps:{maxLength:255}},"description"),e.jsx(N,{name:"contract",type:"text",rules:{required:!0},label:s("admin.paymentCurrency.contract.label"),placeholder:s("admin.paymentCurrency.contract.tip"),disabled:t.includes("contract")},"contract"),e.jsxs(S,{direction:"column",children:[e.jsx(j,{sx:{mb:1},children:s("admin.paymentCurrency.logo.label")}),e.jsx(Ae,{onUploaded:i,preview:l})]})]})}const Ue=()=>ie(()=>import("./tokenList-9PBdKlKn.js"),[]);function qe({method:t,onClose:s}){const{t:n}=M(),[c,l]=O({loading:!1,tokenListLoading:!1,availableTokens:[]}),i=G({defaultValues:{payment_method_id:t.id,name:"",description:"",logo:"",contract:""}}),{handleSubmit:d,setValue:p}=i,y=["ethereum","base"].includes(t.type),m=t?.settings?.[t.type]?.chain_id||"";E.useEffect(()=>{y&&!c.availableTokens.length&&(l({tokenListLoading:!0}),Ue().then(a=>{const o=y?(a.default?.[m]||[]).filter(u=>!(t.payment_currencies||[]).find(g=>g.contract===u.address)):[];l({availableTokens:o,tokenListLoading:!1})}))},[y,m]);const f=a=>a.localLogoURI?V(ce(),a.localLogoURI):a.logoURI||"",C=a=>{a&&(p("name",a.name),p("description",`${a.name} (${a.symbol})`),p("logo",f(a)),p("contract",a.address))},v=a=>{l({loading:!0}),D.post("/api/payment-currencies",a).then(()=>{l({loading:!1}),_.success(n("admin.paymentCurrency.saved")),i.reset(),A("drawer.submitted"),A("paymentCurrency.added")}).catch(o=>{l({loading:!1}),console.error(o),_.error(F(o))})};return e.jsx(Z,{open:!0,icon:e.jsx(H,{}),onClose:s,text:n("admin.paymentCurrency.add"),width:640,footer:e.jsxs(Y,{variant:"contained",size:"large",onClick:d(v),disabled:c.loading,sx:{width:"100%"},children:[c.loading&&e.jsx($,{size:20})," ",n("common.save")]}),children:e.jsxs(J,{...i,children:[y&&e.jsxs(w,{sx:{mb:3},children:[e.jsx(me,{disablePortal:!0,options:c.availableTokens,loading:c.tokenListLoading,getOptionLabel:a=>a.symbol,onChange:(a,o)=>C(o),renderInput:a=>e.jsx(ae,{...a,label:n("admin.paymentCurrency.quickAdd"),placeholder:n("admin.paymentCurrency.searchToken"),fullWidth:!0}),renderOption:(a,o)=>e.jsxs(w,{component:"li",...a,sx:{display:"flex",alignItems:"center",gap:1,cursor:"pointer","&:hover":{backgroundColor:"action.hover"}},children:[e.jsx(K,{src:f(o)||o.symbol,alt:o.symbol,sx:{width:24,height:24}}),e.jsxs(S,{children:[e.jsx(j,{sx:{fontWeight:500},children:o.name}),e.jsx(j,{variant:"caption",sx:{color:"text.secondary"},children:o.symbol})]})]}),isOptionEqualToValue:(a,o)=>a.address===o.address}),e.jsx(re,{sx:{my:3},children:e.jsx(j,{variant:"caption",sx:{color:"text.secondary"},children:n("admin.paymentCurrency.orManualInput")})})]}),e.jsx(le,{})]})})}const Be=()=>ie(()=>import("./tokenList-9PBdKlKn.js"),[]);function Ve({method:t,onClose:s,value:n}){const{t:c}=M(),[l,i]=O({loading:!1,tokenListLoading:!1,contractToTokenMap:new Map}),d=G({defaultValues:{payment_method_id:t.id,name:n?.name,description:n?.description,logo:n?.logo,contract:n?.contract}}),{handleSubmit:p,setValue:y}=d,m=["ethereum","base"].includes(t.type),f=t?.settings?.[t.type]?.chain_id||"",C=a=>a.localLogoURI?V(ce(),a.localLogoURI):a.logoURI||"";E.useEffect(()=>{m&&f&&(i({tokenListLoading:!0}),new Te(`tokenMap_${f}`,async()=>{const u=(await Be()).default?.[f]||[],g={};return u.forEach(k=>{k.address&&(g[k.address.toLowerCase()]=k)}),{data:g}},{strategy:"session",ttl:1800*1e3}).fetch().then(o=>{const u=new Map(Object.entries(o));if(i({contractToTokenMap:u,tokenListLoading:!1}),n?.contract){const g=u.get(n.contract.toLowerCase());if(g&&g.localLogoURI){const k=C(g);y("logo",k)}}}).catch(o=>{console.error("Failed to load token map:",o),i({tokenListLoading:!1})}))},[m,f,n?.contract]);const v=a=>{i({loading:!0}),D.put(`/api/payment-currencies/${n.id}`,a).then(()=>{i({loading:!1}),_.success(c("admin.paymentCurrency.saved")),d.reset(),A("drawer.submitted"),A("paymentCurrency.updated")}).catch(o=>{i({loading:!1}),console.error(o),_.error(F(o))})};return e.jsx(Z,{open:!0,icon:e.jsx(H,{}),onClose:s,text:c("admin.paymentCurrency.edit"),width:640,footer:e.jsxs(Y,{variant:"contained",size:"large",onClick:p(v),disabled:l.loading,sx:{width:"100%"},children:[l.loading&&e.jsx($,{size:20})," ",c("common.save")]}),children:e.jsx(J,{...d,children:e.jsx(le,{disableKeys:["contract"]})})})}function de({value:t,onSave:s,placeholder:n="",required:c=!0,disabled:l=!1,multiline:i=!1,maxLength:d=255,validate:p=()=>null,successMessage:y="",autoFocus:m=!1,onEdit:f=()=>{},onCancel:C=()=>{},hideSuccessToast:v=!1}){const[a,o]=E.useState(!1),[u,g]=E.useState(t),[k,T]=E.useState(""),[P,U]=E.useState(!1),{t:L}=M();E.useEffect(()=>{a||g(t)},[t,a]);const I=h=>{if(c&&!h.trim())return L("common.required");if(d&&h.length>d)return L("common.maxLength",{len:d});if(p){const z=p(h);if(z)return z}return""},r=async()=>{const h=I(u);if(h){T(h);return}U(!0);try{await s(u),v||_.success(y||L("common.saved")),o(!1),T("")}catch(z){_.error(F(z))}finally{U(!1)}},x=()=>{g(t),o(!1),T(""),C?.()},W=h=>{g(h);const z=I(h);T(z)},ue=()=>{o(!0),g(t),T(""),f?.()};return l?e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t||e.jsx("span",{style:{fontStyle:"italic"},children:n})}):e.jsx(S,{direction:"row",spacing:1,sx:{alignItems:i?"flex-start":"center",flexWrap:"wrap",width:"100%"},children:a?e.jsxs(e.Fragment,{children:[e.jsx(ae,{value:u,onChange:h=>W(h.target.value),variant:"outlined",size:"small",multiline:i,rows:i?3:1,sx:{flex:1,minWidth:"200px"},placeholder:n,error:!!k,disabled:P,autoFocus:m,slotProps:{input:{endAdornment:k?e.jsx(j,{color:"error",sx:{whiteSpace:"nowrap"},children:k}):void 0},htmlInput:{maxLength:d}},onKeyDown:h=>{h.key==="Enter"&&!i&&!h.shiftKey&&(h.preventDefault(),r()),h.key==="Escape"&&(h.preventDefault(),x())}}),e.jsxs(S,{direction:"row",spacing:.5,children:[e.jsx(R,{onClick:r,size:"small",disabled:!!k||P,color:"primary",title:L("common.save"),children:e.jsx(xe,{})}),e.jsx(R,{onClick:x,size:"small",disabled:P,title:L("common.cancel"),children:e.jsx(he,{})})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(j,{variant:"body2",sx:{wordBreak:"break-word",whiteSpace:i?"pre-wrap":"nowrap",overflow:i?"visible":"hidden",textOverflow:i?"clip":"ellipsis"},children:t||e.jsx("span",{style:{color:"#999",fontStyle:"italic"},children:n})}),e.jsx(R,{onClick:ue,size:"small",title:L("common.edit"),children:e.jsx(Q,{fontSize:"small"})})]})})}function $e({onClose:t,value:s}){const{t:n}=M(),[c,l]=O({loading:!1}),i=G({defaultValues:{type:s?.type,name:s?.name,description:s?.description,logo:s?.logo,settings:s?.settings}}),{handleSubmit:d}=i,p=y=>{l({loading:!0}),D.put(`/api/payment-methods/${s?.id}`,y).then(()=>{l({loading:!1}),_.success(n("admin.paymentMethod.saved")),i.reset(),A("drawer.submitted"),A("paymentMethod.updated")}).catch(m=>{l({loading:!1}),console.error(m),_.error(F(m))})};return e.jsx(Z,{open:!0,icon:e.jsx(H,{}),onClose:t,text:n("admin.paymentMethod.edit"),width:640,footer:e.jsxs(Y,{variant:"contained",size:"large",onClick:d(p),disabled:c.loading,sx:{width:"100%"},children:[c.loading&&e.jsx($,{size:20})," ",n("common.save")]}),children:e.jsx(J,{...i,children:e.jsx(De,{action:"edit",editableKeys:["name","description","logo","settings.base.api_host","settings.base.explorer_host","settings.ethereum.api_host","settings.ethereum.explorer_host","settings.stripe.publishable_key","settings.stripe.secret_key","settings.stripe.dashboard"]})})})}const He=(t={})=>{const s=new URLSearchParams;return Object.keys(t).forEach(n=>{s.set(n,String(t[n]))}),D.get(`/api/payment-methods?${s.toString()}`).then(n=>n.data)},pe=(t,s)=>D.put(`/api/payment-methods/${t}/settings`,{arcblock:s}).then(n=>n.data);function We({method:t,refresh:s}){const{t:n}=M(),c=async l=>{await pe(t.id,{api_host:l}),s()};return e.jsx(b,{label:n("admin.paymentMethod.arcblock.api_host.label"),value:e.jsx(de,{value:t.settings?.arcblock?.api_host||"",onSave:c,placeholder:n("admin.paymentMethod.arcblock.api_host.tip"),required:!0})})}function Ne({method:t,refresh:s}){const{t:n}=M(),c=async l=>{await pe(t.id,{explorer_host:l}),s()};return e.jsx(b,{label:n("admin.paymentMethod.arcblock.explorer_host.label"),value:e.jsx(de,{value:t.settings?.arcblock?.explorer_host||"",onSave:c,placeholder:n("admin.paymentMethod.arcblock.explorer_host.tip"),required:!0})})}const Ke=t=>{const s={};return t.forEach(n=>{s[n.type]=s[n.type]||[],s[n.type].push(n)}),s};function Qe({method:t}){const{t:s}=M(),n=t.settings?.[t.type]?.api_host,{status:c}=Fe(n,{debounce:0,pollInterval:2e3}),l=()=>c.loading?e.jsxs(w,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx($,{size:14}),e.jsx(j,{sx:{color:"text.secondary"},children:s("admin.paymentMethod.evm.checking")})]}):c.connected?e.jsxs(w,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(ke,{sx:{fontSize:14},color:"success"}),e.jsx(j,{sx:{color:"text.secondary"},children:s("admin.paymentMethod.evm.connected")})]}):e.jsxs(w,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(Ce,{sx:{fontSize:14},color:"error"}),e.jsx(j,{color:"error",children:s("admin.paymentMethod.evm.connectionError")})]});return e.jsxs(e.Fragment,{children:[e.jsx(b,{label:s(`admin.paymentMethod.${t.type}.api_host.label`),value:n}),e.jsx(b,{label:s("admin.paymentMethod.evm.rpcStatus"),value:l()}),e.jsx(b,{label:s("admin.paymentMethod.evm.blockHeight"),value:c.blockNumber?.toLocaleString()})]})}function Xe({method:t,balances:s,addresses:n,setDidDialog:c,refresh:l}){const{t:i}=M(),d=(t.payment_currencies||[])?.find(v=>v.id===t.default_currency_id),p=_e(s?.[d?.id]||"0",d?.decimal),y=t?.settings?.[t?.type]?.explorer_host||"",m=()=>t.type==="arcblock"&&n?.arcblock?V(y,"accounts",n?.arcblock,"tokens"):["ethereum","base"].includes(t.type)&&n?.ethereum?V(y,"address",n?.ethereum):"",f=["ethereum","base"].includes(t.type)&&s?.[d?.id]&&s?.[d?.id]==="0",C=v=>["ethereum","base"].includes(v)?n?.ethereum||"":n?.arcblock||"";return e.jsxs(e.Fragment,{children:[t.type==="arcblock"?e.jsx(Ne,{method:t,refresh:l}):e.jsx(b,{label:i("admin.paymentMethod.props.explorer_host"),value:y}),e.jsx(b,{label:e.jsxs(w,{sx:{display:"flex",alignItems:"center",gap:.5},children:[i("admin.paymentMethod.props.balance"),["ethereum","base"].includes(t.type)&&e.jsx(X,{title:i("admin.paymentMethod.gasTip",{method:t.type,chain:t.name}),children:e.jsx(oe,{sx:{fontSize:16,cursor:"pointer",color:f?"error.main":"text.secondary"}})})]}),value:e.jsxs(S,{direction:"row",sx:{alignItems:"center",display:"inline-flex",borderRadius:1},children:[e.jsxs(j,{component:"a",href:m(),target:"_blank",rel:"noreferrer",sx:{display:"flex",alignItems:"center",gap:.5,"&.MuiTypography-root":{color:f?"error.main":"text.link"}},children:[p," ",d?.symbol,e.jsx(be,{sx:{fontSize:14}})]}),e.jsx(re,{orientation:"vertical",flexItem:!0,sx:{mx:1}}),e.jsx(X,{title:i("admin.paymentMethod.recharge"),children:e.jsx(R,{size:"small",onClick:()=>c({open:!0,chainId:t.settings?.[t.type]?.chain_id,did:C(t.type)}),sx:{p:.5},children:e.jsx(ve,{sx:{fontSize:16}})})})]})})]})}function Ye(){return e.jsx(e.Fragment,{children:[1].map(t=>e.jsxs(w,{sx:{mt:3},children:[e.jsx(S,{direction:"row",sx:{alignItems:"center",mb:1,flexWrap:"wrap",gap:1},children:e.jsx(q,{variant:"text",width:120,height:32})}),e.jsx(w,{sx:{py:1,borderTop:"1px solid",borderBottom:"1px solid",borderColor:"divider",mb:1},children:e.jsx(S,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center"},children:e.jsxs(S,{direction:"row",spacing:2,sx:{alignItems:"center",flex:1},children:[e.jsx(q,{variant:"rectangular",width:40,height:40}),e.jsxs(w,{sx:{flex:1},children:[e.jsx(q,{variant:"text",width:"20%",height:24}),e.jsx(q,{variant:"text",width:"40%",height:20})]})]})})})]},t))})}function lt(){const{t}=M(),{palette:s}=ye(),[n,c]=we("payment-method-expanded-id",{defaultValue:""}),{loading:l,error:i,data:d={list:[],addresses:{},balances:{}},runAsync:p}=Ie(()=>He({addresses:!0})),y=(I,r)=>{c(r?I:"")},[m,f]=O({open:!1,chainId:"",did:""}),[C,v]=O({open:!1,value:null}),{refresh:a}=Ee(),[o,u]=O({action:"",value:null,method:""}),{list:g,addresses:k,balances:T}=d;if(B("paymentMethod.created",()=>{p(),a(!0)},[]),B("paymentMethod.updated",()=>{p(),a(!0)},[]),B("paymentCurrency.added",()=>{p().then(()=>{u({action:"",method:""})}),a(!0)},[]),B("paymentCurrency.updated",()=>{p().then(()=>{u({action:"",method:""})}),a(!0)},[]),i)return e.jsx(ge,{severity:"error",children:i.message});if(l||!d||g?.length===0)return e.jsx(Ye,{});const P=Ke(g),U=async I=>{try{await D.delete(`/api/payment-currencies/${I.id}`),p(),a(!0),_.success(t("admin.paymentCurrency.deleted"))}catch(r){_.error(F(r))}finally{u({action:"",method:""})}},L=()=>{p(),a(!0)};return e.jsxs(e.Fragment,{children:[Object.keys(P).map(I=>e.jsxs(w,{sx:{mt:3},children:[e.jsx(S,{direction:"row",sx:{alignItems:"center",mb:1,flexWrap:"wrap",gap:1},children:e.jsx(j,{variant:"subtitle2",sx:{textTransform:"uppercase"},children:I})}),P[I].map(r=>e.jsx(ze,{trigger:e.jsx(Oe,{...r}),addons:e.jsxs(e.Fragment,{children:[e.jsx(Pe,{checked:r.active,disabled:!0,sx:{cursor:"default"}}),!["arcblock","google_play","app_store"].includes(r.type)&&e.jsx(R,{onClick:x=>{x.stopPropagation(),v({open:!0,value:r})},children:e.jsx(Q,{})})]}),style:{py:1,borderTop:`1px solid ${s.divider}`,borderBottom:`1px solid ${s.divider}`,"& :hover":{color:"text.primary"}},value:r.id,expanded:n===r.id,onChange:(x,W)=>y(x,W),lazy:!1,children:e.jsx(ee,{container:!0,spacing:2,sx:{mt:1},children:e.jsxs(ee,{size:{xs:12,md:6},children:[e.jsx(b,{label:t("admin.paymentMethod.props.type"),value:r.type}),r.type==="arcblock"&&e.jsx(We,{method:r,refresh:L}),["ethereum","base"].includes(r.type)&&e.jsx(Qe,{method:r}),["arcblock","ethereum","base"].includes(r.type)&&e.jsx(Xe,{method:r,balances:T,addresses:k,setDidDialog:f,refresh:L}),e.jsx(b,{label:t("admin.paymentMethod.props.confirmation"),value:e.jsxs(w,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(j,{variant:"body2",children:r.confirmation.type}),r.type==="stripe"&&r.confirmation.type==="callback"&&e.jsx(X,{title:e.jsxs(j,{variant:"body2",component:"span",children:[t("admin.paymentMethod.stripe.webhookHint")," ",e.jsx(j,{variant:"body2",component:"a",href:"/.well-known/service/admin/overview/components",target:"_blank",rel:"noopener noreferrer",sx:{color:"primary.light",textDecoration:"underline","&:hover":{color:"primary.main"}},children:t("admin.paymentMethod.stripe.configureEnv")})]}),placement:"right",arrow:!0,children:e.jsx(oe,{sx:{fontSize:16,color:"info.main",cursor:"help",transition:"color 0.2s","&:hover":{color:"info.dark"}}})})]})}),e.jsx(b,{label:t("admin.paymentMethod.props.recurring"),value:r.features.recurring?t("common.yes"):t("common.no")}),e.jsx(b,{label:t("admin.paymentMethod.props.refund"),value:r.features.refund?t("common.yes"):t("common.no")}),e.jsx(b,{label:t("admin.paymentMethod.props.dispute"),value:r.features.dispute?t("common.yes"):t("common.no")}),e.jsx(b,{alignItems:"flex-start",label:t("admin.paymentMethod.props.currencies"),value:e.jsxs(fe,{children:[r.payment_currencies.map(x=>!x||x.type==="credit"?null:e.jsxs(te,{disablePadding:!0,secondaryAction:x.locked||r.default_currency_id===x.id?null:e.jsxs(e.Fragment,{children:[e.jsx(R,{edge:"end",onClick:()=>{u({action:"edit",value:x,method:r.id})},children:e.jsx(Q,{})}),e.jsx(R,{edge:"end",onClick:()=>{u({action:"delete",value:x,method:r.id})},children:e.jsx(je,{})})]}),children:[e.jsx(ne,{children:e.jsx(K,{src:x.logo,alt:x.symbol})}),e.jsx(se,{primary:x.name,secondary:x.description})]},x.id)),r.type!=="stripe"&&e.jsxs(te,{disablePadding:!0,sx:{cursor:"pointer"},onClick:()=>{u({action:"create",method:r.id})},children:[e.jsx(ne,{children:e.jsx(K,{children:e.jsx(H,{fontSize:"small"})})}),e.jsx(se,{primary:t("admin.paymentCurrency.add")})]},"add-currency"),o.method===r.id&&o.action==="create"&&e.jsx(qe,{method:r,onClose:()=>u({action:"",method:""})}),o.method===r.id&&o.action==="edit"&&e.jsx(Ve,{method:r,onClose:()=>u({action:"",method:""}),value:o.value}),o.method===r.id&&o.action==="delete"&&e.jsx(Re,{onConfirm:()=>U(o.value),onCancel:()=>u({action:"",method:""}),title:t("admin.paymentCurrency.delete"),message:t("admin.paymentCurrency.deleteConfirm")})]})})]})})},r.id))]},I)),m.open&&m.did&&e.jsx(Se,{open:m.open,onClose:()=>f({open:!1,chainId:"",did:""}),did:m.did,chainId:m.chainId}),C.open&&C.value&&e.jsx($e,{value:C.value,onClose:()=>v({open:!1,value:null})})]})}export{lt as default};
1
+ import{j as e,a3 as S,q as j,r as E,B as w,ck as me,N as K,a2 as ae,Y as re,x as Y,w as $,bH as H,I as R,Q as xe,o as he,cA as Q,u as ye,A as ge,$ as ee,O as X,be as oe,a8 as fe,a9 as te,cI as ne,aH as se,cB as je,a1 as q,by as be,cJ as ve,cH as ke,br as Ce}from"./vendor-mui-BXZut9Pz.js";import{V as M,Y as O,F as V,Z as _,A as ie,cN as we,P as Ie,cO as Se,H as _e}from"./vendor-blocklet-B67R14so.js";import{E as Me,X as Le,aX as N,h as G,F as J,l as ce,e as D,b8 as A,k as F,ba as Te,a as Ee,b9 as B,I as Re,S as Pe}from"./index-B4yaPb7B.js";import{I as ze}from"./collapse-BvbJGg1V.js";import{I as Oe}from"./info-card-C9dRgztS.js";import{I as b}from"./info-row-CaPaNF4L.js";import{D as Z}from"./drawer-form-CQjNFFWk.js";import{U as Ae}from"./uploader-BLdAbLR6.js";import{P as De,u as Fe}from"./form-4_MzglPj.js";import"./vendor-react-BPknnnEA.js";import"./util-B8B3fsMa.js";import"./lodash-B4Ozcv0x.js";function le({disableKeys:t=[]}){const{t:s}=M(),{control:n,setValue:c}=Me(),l=Le({control:n,name:"logo"}),i=d=>{if(!d.url){c("logo","");return}const p=new URL(d.url);c("logo",p.pathname)};return e.jsxs(S,{direction:"column",spacing:2,sx:{alignItems:"flex-start"},children:[e.jsx(N,{name:"name",type:"text",rules:{required:!0},label:s("admin.paymentMethod.name.label"),placeholder:s("admin.paymentMethod.name.tip"),disabled:t.includes("name"),inputProps:{maxLength:32}},"name"),e.jsx(N,{name:"description",type:"text",rules:{required:!0},label:s("admin.paymentMethod.description.label"),placeholder:s("admin.paymentMethod.description.tip"),disabled:t.includes("description"),inputProps:{maxLength:255}},"description"),e.jsx(N,{name:"contract",type:"text",rules:{required:!0},label:s("admin.paymentCurrency.contract.label"),placeholder:s("admin.paymentCurrency.contract.tip"),disabled:t.includes("contract")},"contract"),e.jsxs(S,{direction:"column",children:[e.jsx(j,{sx:{mb:1},children:s("admin.paymentCurrency.logo.label")}),e.jsx(Ae,{onUploaded:i,preview:l})]})]})}const Ue=()=>ie(()=>import("./tokenList-9PBdKlKn.js"),[]);function qe({method:t,onClose:s}){const{t:n}=M(),[c,l]=O({loading:!1,tokenListLoading:!1,availableTokens:[]}),i=G({defaultValues:{payment_method_id:t.id,name:"",description:"",logo:"",contract:""}}),{handleSubmit:d,setValue:p}=i,y=["ethereum","base"].includes(t.type),m=t?.settings?.[t.type]?.chain_id||"";E.useEffect(()=>{y&&!c.availableTokens.length&&(l({tokenListLoading:!0}),Ue().then(a=>{const o=y?(a.default?.[m]||[]).filter(u=>!(t.payment_currencies||[]).find(g=>g.contract===u.address)):[];l({availableTokens:o,tokenListLoading:!1})}))},[y,m]);const f=a=>a.localLogoURI?V(ce(),a.localLogoURI):a.logoURI||"",C=a=>{a&&(p("name",a.name),p("description",`${a.name} (${a.symbol})`),p("logo",f(a)),p("contract",a.address))},v=a=>{l({loading:!0}),D.post("/api/payment-currencies",a).then(()=>{l({loading:!1}),_.success(n("admin.paymentCurrency.saved")),i.reset(),A("drawer.submitted"),A("paymentCurrency.added")}).catch(o=>{l({loading:!1}),console.error(o),_.error(F(o))})};return e.jsx(Z,{open:!0,icon:e.jsx(H,{}),onClose:s,text:n("admin.paymentCurrency.add"),width:640,footer:e.jsxs(Y,{variant:"contained",size:"large",onClick:d(v),disabled:c.loading,sx:{width:"100%"},children:[c.loading&&e.jsx($,{size:20})," ",n("common.save")]}),children:e.jsxs(J,{...i,children:[y&&e.jsxs(w,{sx:{mb:3},children:[e.jsx(me,{disablePortal:!0,options:c.availableTokens,loading:c.tokenListLoading,getOptionLabel:a=>a.symbol,onChange:(a,o)=>C(o),renderInput:a=>e.jsx(ae,{...a,label:n("admin.paymentCurrency.quickAdd"),placeholder:n("admin.paymentCurrency.searchToken"),fullWidth:!0}),renderOption:(a,o)=>e.jsxs(w,{component:"li",...a,sx:{display:"flex",alignItems:"center",gap:1,cursor:"pointer","&:hover":{backgroundColor:"action.hover"}},children:[e.jsx(K,{src:f(o)||o.symbol,alt:o.symbol,sx:{width:24,height:24}}),e.jsxs(S,{children:[e.jsx(j,{sx:{fontWeight:500},children:o.name}),e.jsx(j,{variant:"caption",sx:{color:"text.secondary"},children:o.symbol})]})]}),isOptionEqualToValue:(a,o)=>a.address===o.address}),e.jsx(re,{sx:{my:3},children:e.jsx(j,{variant:"caption",sx:{color:"text.secondary"},children:n("admin.paymentCurrency.orManualInput")})})]}),e.jsx(le,{})]})})}const Be=()=>ie(()=>import("./tokenList-9PBdKlKn.js"),[]);function Ve({method:t,onClose:s,value:n}){const{t:c}=M(),[l,i]=O({loading:!1,tokenListLoading:!1,contractToTokenMap:new Map}),d=G({defaultValues:{payment_method_id:t.id,name:n?.name,description:n?.description,logo:n?.logo,contract:n?.contract}}),{handleSubmit:p,setValue:y}=d,m=["ethereum","base"].includes(t.type),f=t?.settings?.[t.type]?.chain_id||"",C=a=>a.localLogoURI?V(ce(),a.localLogoURI):a.logoURI||"";E.useEffect(()=>{m&&f&&(i({tokenListLoading:!0}),new Te(`tokenMap_${f}`,async()=>{const u=(await Be()).default?.[f]||[],g={};return u.forEach(k=>{k.address&&(g[k.address.toLowerCase()]=k)}),{data:g}},{strategy:"session",ttl:1800*1e3}).fetch().then(o=>{const u=new Map(Object.entries(o));if(i({contractToTokenMap:u,tokenListLoading:!1}),n?.contract){const g=u.get(n.contract.toLowerCase());if(g&&g.localLogoURI){const k=C(g);y("logo",k)}}}).catch(o=>{console.error("Failed to load token map:",o),i({tokenListLoading:!1})}))},[m,f,n?.contract]);const v=a=>{i({loading:!0}),D.put(`/api/payment-currencies/${n.id}`,a).then(()=>{i({loading:!1}),_.success(c("admin.paymentCurrency.saved")),d.reset(),A("drawer.submitted"),A("paymentCurrency.updated")}).catch(o=>{i({loading:!1}),console.error(o),_.error(F(o))})};return e.jsx(Z,{open:!0,icon:e.jsx(H,{}),onClose:s,text:c("admin.paymentCurrency.edit"),width:640,footer:e.jsxs(Y,{variant:"contained",size:"large",onClick:p(v),disabled:l.loading,sx:{width:"100%"},children:[l.loading&&e.jsx($,{size:20})," ",c("common.save")]}),children:e.jsx(J,{...d,children:e.jsx(le,{disableKeys:["contract"]})})})}function de({value:t,onSave:s,placeholder:n="",required:c=!0,disabled:l=!1,multiline:i=!1,maxLength:d=255,validate:p=()=>null,successMessage:y="",autoFocus:m=!1,onEdit:f=()=>{},onCancel:C=()=>{},hideSuccessToast:v=!1}){const[a,o]=E.useState(!1),[u,g]=E.useState(t),[k,T]=E.useState(""),[P,U]=E.useState(!1),{t:L}=M();E.useEffect(()=>{a||g(t)},[t,a]);const I=h=>{if(c&&!h.trim())return L("common.required");if(d&&h.length>d)return L("common.maxLength",{len:d});if(p){const z=p(h);if(z)return z}return""},r=async()=>{const h=I(u);if(h){T(h);return}U(!0);try{await s(u),v||_.success(y||L("common.saved")),o(!1),T("")}catch(z){_.error(F(z))}finally{U(!1)}},x=()=>{g(t),o(!1),T(""),C?.()},W=h=>{g(h);const z=I(h);T(z)},ue=()=>{o(!0),g(t),T(""),f?.()};return l?e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t||e.jsx("span",{style:{fontStyle:"italic"},children:n})}):e.jsx(S,{direction:"row",spacing:1,sx:{alignItems:i?"flex-start":"center",flexWrap:"wrap",width:"100%"},children:a?e.jsxs(e.Fragment,{children:[e.jsx(ae,{value:u,onChange:h=>W(h.target.value),variant:"outlined",size:"small",multiline:i,rows:i?3:1,sx:{flex:1,minWidth:"200px"},placeholder:n,error:!!k,disabled:P,autoFocus:m,slotProps:{input:{endAdornment:k?e.jsx(j,{color:"error",sx:{whiteSpace:"nowrap"},children:k}):void 0},htmlInput:{maxLength:d}},onKeyDown:h=>{h.key==="Enter"&&!i&&!h.shiftKey&&(h.preventDefault(),r()),h.key==="Escape"&&(h.preventDefault(),x())}}),e.jsxs(S,{direction:"row",spacing:.5,children:[e.jsx(R,{onClick:r,size:"small",disabled:!!k||P,color:"primary",title:L("common.save"),children:e.jsx(xe,{})}),e.jsx(R,{onClick:x,size:"small",disabled:P,title:L("common.cancel"),children:e.jsx(he,{})})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(j,{variant:"body2",sx:{wordBreak:"break-word",whiteSpace:i?"pre-wrap":"nowrap",overflow:i?"visible":"hidden",textOverflow:i?"clip":"ellipsis"},children:t||e.jsx("span",{style:{color:"#999",fontStyle:"italic"},children:n})}),e.jsx(R,{onClick:ue,size:"small",title:L("common.edit"),children:e.jsx(Q,{fontSize:"small"})})]})})}function $e({onClose:t,value:s}){const{t:n}=M(),[c,l]=O({loading:!1}),i=G({defaultValues:{type:s?.type,name:s?.name,description:s?.description,logo:s?.logo,settings:s?.settings}}),{handleSubmit:d}=i,p=y=>{l({loading:!0}),D.put(`/api/payment-methods/${s?.id}`,y).then(()=>{l({loading:!1}),_.success(n("admin.paymentMethod.saved")),i.reset(),A("drawer.submitted"),A("paymentMethod.updated")}).catch(m=>{l({loading:!1}),console.error(m),_.error(F(m))})};return e.jsx(Z,{open:!0,icon:e.jsx(H,{}),onClose:t,text:n("admin.paymentMethod.edit"),width:640,footer:e.jsxs(Y,{variant:"contained",size:"large",onClick:d(p),disabled:c.loading,sx:{width:"100%"},children:[c.loading&&e.jsx($,{size:20})," ",n("common.save")]}),children:e.jsx(J,{...i,children:e.jsx(De,{action:"edit",editableKeys:["name","description","logo","settings.base.api_host","settings.base.explorer_host","settings.ethereum.api_host","settings.ethereum.explorer_host","settings.stripe.publishable_key","settings.stripe.secret_key","settings.stripe.dashboard"]})})})}const He=(t={})=>{const s=new URLSearchParams;return Object.keys(t).forEach(n=>{s.set(n,String(t[n]))}),D.get(`/api/payment-methods?${s.toString()}`).then(n=>n.data)},pe=(t,s)=>D.put(`/api/payment-methods/${t}/settings`,{arcblock:s}).then(n=>n.data);function We({method:t,refresh:s}){const{t:n}=M(),c=async l=>{await pe(t.id,{api_host:l}),s()};return e.jsx(b,{label:n("admin.paymentMethod.arcblock.api_host.label"),value:e.jsx(de,{value:t.settings?.arcblock?.api_host||"",onSave:c,placeholder:n("admin.paymentMethod.arcblock.api_host.tip"),required:!0})})}function Ne({method:t,refresh:s}){const{t:n}=M(),c=async l=>{await pe(t.id,{explorer_host:l}),s()};return e.jsx(b,{label:n("admin.paymentMethod.arcblock.explorer_host.label"),value:e.jsx(de,{value:t.settings?.arcblock?.explorer_host||"",onSave:c,placeholder:n("admin.paymentMethod.arcblock.explorer_host.tip"),required:!0})})}const Ke=t=>{const s={};return t.forEach(n=>{s[n.type]=s[n.type]||[],s[n.type].push(n)}),s};function Qe({method:t}){const{t:s}=M(),n=t.settings?.[t.type]?.api_host,{status:c}=Fe(n,{debounce:0,pollInterval:2e3}),l=()=>c.loading?e.jsxs(w,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx($,{size:14}),e.jsx(j,{sx:{color:"text.secondary"},children:s("admin.paymentMethod.evm.checking")})]}):c.connected?e.jsxs(w,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(ke,{sx:{fontSize:14},color:"success"}),e.jsx(j,{sx:{color:"text.secondary"},children:s("admin.paymentMethod.evm.connected")})]}):e.jsxs(w,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(Ce,{sx:{fontSize:14},color:"error"}),e.jsx(j,{color:"error",children:s("admin.paymentMethod.evm.connectionError")})]});return e.jsxs(e.Fragment,{children:[e.jsx(b,{label:s(`admin.paymentMethod.${t.type}.api_host.label`),value:n}),e.jsx(b,{label:s("admin.paymentMethod.evm.rpcStatus"),value:l()}),e.jsx(b,{label:s("admin.paymentMethod.evm.blockHeight"),value:c.blockNumber?.toLocaleString()})]})}function Xe({method:t,balances:s,addresses:n,setDidDialog:c,refresh:l}){const{t:i}=M(),d=(t.payment_currencies||[])?.find(v=>v.id===t.default_currency_id),p=_e(s?.[d?.id]||"0",d?.decimal),y=t?.settings?.[t?.type]?.explorer_host||"",m=()=>t.type==="arcblock"&&n?.arcblock?V(y,"accounts",n?.arcblock,"tokens"):["ethereum","base"].includes(t.type)&&n?.ethereum?V(y,"address",n?.ethereum):"",f=["ethereum","base"].includes(t.type)&&s?.[d?.id]&&s?.[d?.id]==="0",C=v=>["ethereum","base"].includes(v)?n?.ethereum||"":n?.arcblock||"";return e.jsxs(e.Fragment,{children:[t.type==="arcblock"?e.jsx(Ne,{method:t,refresh:l}):e.jsx(b,{label:i("admin.paymentMethod.props.explorer_host"),value:y}),e.jsx(b,{label:e.jsxs(w,{sx:{display:"flex",alignItems:"center",gap:.5},children:[i("admin.paymentMethod.props.balance"),["ethereum","base"].includes(t.type)&&e.jsx(X,{title:i("admin.paymentMethod.gasTip",{method:t.type,chain:t.name}),children:e.jsx(oe,{sx:{fontSize:16,cursor:"pointer",color:f?"error.main":"text.secondary"}})})]}),value:e.jsxs(S,{direction:"row",sx:{alignItems:"center",display:"inline-flex",borderRadius:1},children:[e.jsxs(j,{component:"a",href:m(),target:"_blank",rel:"noreferrer",sx:{display:"flex",alignItems:"center",gap:.5,"&.MuiTypography-root":{color:f?"error.main":"text.link"}},children:[p," ",d?.symbol,e.jsx(be,{sx:{fontSize:14}})]}),e.jsx(re,{orientation:"vertical",flexItem:!0,sx:{mx:1}}),e.jsx(X,{title:i("admin.paymentMethod.recharge"),children:e.jsx(R,{size:"small",onClick:()=>c({open:!0,chainId:t.settings?.[t.type]?.chain_id,did:C(t.type)}),sx:{p:.5},children:e.jsx(ve,{sx:{fontSize:16}})})})]})})]})}function Ye(){return e.jsx(e.Fragment,{children:[1].map(t=>e.jsxs(w,{sx:{mt:3},children:[e.jsx(S,{direction:"row",sx:{alignItems:"center",mb:1,flexWrap:"wrap",gap:1},children:e.jsx(q,{variant:"text",width:120,height:32})}),e.jsx(w,{sx:{py:1,borderTop:"1px solid",borderBottom:"1px solid",borderColor:"divider",mb:1},children:e.jsx(S,{direction:"row",sx:{justifyContent:"space-between",alignItems:"center"},children:e.jsxs(S,{direction:"row",spacing:2,sx:{alignItems:"center",flex:1},children:[e.jsx(q,{variant:"rectangular",width:40,height:40}),e.jsxs(w,{sx:{flex:1},children:[e.jsx(q,{variant:"text",width:"20%",height:24}),e.jsx(q,{variant:"text",width:"40%",height:20})]})]})})})]},t))})}function lt(){const{t}=M(),{palette:s}=ye(),[n,c]=we("payment-method-expanded-id",{defaultValue:""}),{loading:l,error:i,data:d={list:[],addresses:{},balances:{}},runAsync:p}=Ie(()=>He({addresses:!0})),y=(I,r)=>{c(r?I:"")},[m,f]=O({open:!1,chainId:"",did:""}),[C,v]=O({open:!1,value:null}),{refresh:a}=Ee(),[o,u]=O({action:"",value:null,method:""}),{list:g,addresses:k,balances:T}=d;if(B("paymentMethod.created",()=>{p(),a(!0)},[]),B("paymentMethod.updated",()=>{p(),a(!0)},[]),B("paymentCurrency.added",()=>{p().then(()=>{u({action:"",method:""})}),a(!0)},[]),B("paymentCurrency.updated",()=>{p().then(()=>{u({action:"",method:""})}),a(!0)},[]),i)return e.jsx(ge,{severity:"error",children:i.message});if(l||!d||g?.length===0)return e.jsx(Ye,{});const P=Ke(g),U=async I=>{try{await D.delete(`/api/payment-currencies/${I.id}`),p(),a(!0),_.success(t("admin.paymentCurrency.deleted"))}catch(r){_.error(F(r))}finally{u({action:"",method:""})}},L=()=>{p(),a(!0)};return e.jsxs(e.Fragment,{children:[Object.keys(P).map(I=>e.jsxs(w,{sx:{mt:3},children:[e.jsx(S,{direction:"row",sx:{alignItems:"center",mb:1,flexWrap:"wrap",gap:1},children:e.jsx(j,{variant:"subtitle2",sx:{textTransform:"uppercase"},children:I})}),P[I].map(r=>e.jsx(ze,{trigger:e.jsx(Oe,{...r}),addons:e.jsxs(e.Fragment,{children:[e.jsx(Pe,{checked:r.active,disabled:!0,sx:{cursor:"default"}}),!["arcblock","google_play","app_store"].includes(r.type)&&e.jsx(R,{onClick:x=>{x.stopPropagation(),v({open:!0,value:r})},children:e.jsx(Q,{})})]}),style:{py:1,borderTop:`1px solid ${s.divider}`,borderBottom:`1px solid ${s.divider}`,"& :hover":{color:"text.primary"}},value:r.id,expanded:n===r.id,onChange:(x,W)=>y(x,W),lazy:!1,children:e.jsx(ee,{container:!0,spacing:2,sx:{mt:1},children:e.jsxs(ee,{size:{xs:12,md:6},children:[e.jsx(b,{label:t("admin.paymentMethod.props.type"),value:r.type}),r.type==="arcblock"&&e.jsx(We,{method:r,refresh:L}),["ethereum","base"].includes(r.type)&&e.jsx(Qe,{method:r}),["arcblock","ethereum","base"].includes(r.type)&&e.jsx(Xe,{method:r,balances:T,addresses:k,setDidDialog:f,refresh:L}),e.jsx(b,{label:t("admin.paymentMethod.props.confirmation"),value:e.jsxs(w,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(j,{variant:"body2",children:r.confirmation.type}),r.type==="stripe"&&r.confirmation.type==="callback"&&e.jsx(X,{title:e.jsxs(j,{variant:"body2",component:"span",children:[t("admin.paymentMethod.stripe.webhookHint")," ",e.jsx(j,{variant:"body2",component:"a",href:"/.well-known/service/admin/overview/components",target:"_blank",rel:"noopener noreferrer",sx:{color:"primary.light",textDecoration:"underline","&:hover":{color:"primary.main"}},children:t("admin.paymentMethod.stripe.configureEnv")})]}),placement:"right",arrow:!0,children:e.jsx(oe,{sx:{fontSize:16,color:"info.main",cursor:"help",transition:"color 0.2s","&:hover":{color:"info.dark"}}})})]})}),e.jsx(b,{label:t("admin.paymentMethod.props.recurring"),value:r.features.recurring?t("common.yes"):t("common.no")}),e.jsx(b,{label:t("admin.paymentMethod.props.refund"),value:r.features.refund?t("common.yes"):t("common.no")}),e.jsx(b,{label:t("admin.paymentMethod.props.dispute"),value:r.features.dispute?t("common.yes"):t("common.no")}),e.jsx(b,{alignItems:"flex-start",label:t("admin.paymentMethod.props.currencies"),value:e.jsxs(fe,{children:[r.payment_currencies.map(x=>!x||x.type==="credit"?null:e.jsxs(te,{disablePadding:!0,secondaryAction:x.locked||r.default_currency_id===x.id?null:e.jsxs(e.Fragment,{children:[e.jsx(R,{edge:"end",onClick:()=>{u({action:"edit",value:x,method:r.id})},children:e.jsx(Q,{})}),e.jsx(R,{edge:"end",onClick:()=>{u({action:"delete",value:x,method:r.id})},children:e.jsx(je,{})})]}),children:[e.jsx(ne,{children:e.jsx(K,{src:x.logo,alt:x.symbol})}),e.jsx(se,{primary:x.name,secondary:x.description})]},x.id)),r.type!=="stripe"&&e.jsxs(te,{disablePadding:!0,sx:{cursor:"pointer"},onClick:()=>{u({action:"create",method:r.id})},children:[e.jsx(ne,{children:e.jsx(K,{children:e.jsx(H,{fontSize:"small"})})}),e.jsx(se,{primary:t("admin.paymentCurrency.add")})]},"add-currency"),o.method===r.id&&o.action==="create"&&e.jsx(qe,{method:r,onClose:()=>u({action:"",method:""})}),o.method===r.id&&o.action==="edit"&&e.jsx(Ve,{method:r,onClose:()=>u({action:"",method:""}),value:o.value}),o.method===r.id&&o.action==="delete"&&e.jsx(Re,{onConfirm:()=>U(o.value),onCancel:()=>u({action:"",method:""}),title:t("admin.paymentCurrency.delete"),message:t("admin.paymentCurrency.deleteConfirm")})]})})]})})},r.id))]},I)),m.open&&m.did&&e.jsx(Se,{open:m.open,onClose:()=>f({open:!1,chainId:"",did:""}),did:m.did,chainId:m.chainId}),C.open&&C.value&&e.jsx($e,{value:C.value,onClose:()=>v({open:!1,value:null})})]})}export{lt as default};
@@ -1,4 +1,4 @@
1
- import{j as e,B as l,A as R,a3 as x,q as a,Y as $,a2 as F,aZ as M,x as N,O as H,b4 as B,u as q,N as z,w as U,bf as W}from"./vendor-mui-BXZut9Pz.js";import{V as O,P as I,$ as Y,Z as y,Y as Z,af as G}from"./vendor-blocklet-DcLR2Cyf.js";import{h as Q,i as p,C as L,S as X,G as V,L as J,e as C,u as K,d as ee,T as ne,I as te,bk as oe}from"./index-BarN7DfU.js";import{L as se}from"./link-DMWJcQvZ.js";import{C as D}from"./currency-GstdXsJf.js";import{M as h}from"./util-DxXTXkeY.js";import"./vendor-react-BPknnnEA.js";import"./lodash-B4Ozcv0x.js";const P="100",E="10",ie=async(n,m)=>(await C.put(`/api/payment-currencies/${n}/vault-config`,m)).data;function re({item:n,onClose:m,onSuccess:g,isOwner:j}){const{t:i,locale:r}=O(),{control:c,handleSubmit:d,watch:_,formState:{errors:f}}=Q({defaultValues:{enabled:!0,deposit_threshold:n?.vault_config?.deposit_threshold&&n?.vault_config?.deposit_threshold!=="0"?p(n.vault_config.deposit_threshold,n?.decimal||18):P,withdraw_threshold:n?.vault_config?.withdraw_threshold?p(n.vault_config.withdraw_threshold,n?.decimal||18):"0",buffer_threshold:n?.vault_config?.buffer_threshold?p(n.vault_config.buffer_threshold,n?.decimal||18):E},mode:"onChange"}),T=_("enabled"),w=s=>s?s.message:i("admin.vaultConfig.depositThresholdHelp"),S=s=>s?s.message:i("admin.vaultConfig.bufferThresholdHelp"),{runAsync:b,loading:k}=I(ie,{manual:!0}),A=s=>{if(!n)return;const o=()=>{const t=n.vault_config?.enabled;return!t&&s.enabled?i("admin.vaultConfig.enableSuccess",{currency:n.symbol}):t&&!s.enabled?i("admin.vaultConfig.disableSuccess",{currency:n.symbol}):i("admin.vaultConfig.updateSuccess",{currency:n.symbol})};b(n.id,s).then(()=>{y.success(o()),g()})};if(!n)return null;const v=(s,o)=>e.jsxs(x,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(a,{variant:"subtitle2",children:s}),e.jsx(H,{title:o,children:e.jsx(B,{fontSize:"small",sx:{color:"text.secondary"}})})]});return e.jsx(Y,{open:!0,fullWidth:!0,onClose:m,className:"base-dialog",title:n.vault_config?.enabled?i("admin.vaultConfig.editTitle",{currency:n.symbol}):i("admin.vaultConfig.enableTitle",{currency:n.symbol}),actions:e.jsxs(x,{direction:"row",spacing:2,children:[e.jsx(N,{variant:"outlined",onClick:m,children:i("common.cancel")}),e.jsx(J,{variant:"contained",color:"primary",disabled:k||!j,onClick:d(A),children:i("common.save")})]}),children:e.jsxs(l,{sx:{pb:2},children:[e.jsx(R,{severity:"info",sx:{mb:3},children:i("admin.vaultConfig.enableVaultHelp")}),e.jsxs(x,{spacing:3,children:[e.jsxs(x,{direction:"row",sx:{alignItems:"center",gap:2},children:[e.jsx(a,{variant:"subtitle1",children:i("admin.vaultConfig.enableVault")}),e.jsx(L,{name:"enabled",control:c,render:({field:s})=>e.jsx(X,{checked:s.value,onChange:o=>s.onChange(o.target.checked)})})]}),T&&e.jsxs(e.Fragment,{children:[e.jsx($,{sx:{my:1}}),e.jsxs(l,{children:[v(i("admin.vaultConfig.depositThreshold"),i("admin.vaultConfig.depositThresholdHelp")),e.jsx(L,{name:"deposit_threshold",control:c,rules:{required:!0,validate:s=>Number(s)<=0?i("admin.vaultConfig.depositThresholdRequired"):Number(s)>h?i("common.maxAmount",{max:h}):V(s.toString(),r,n.decimal||6)||!0},render:({field:s})=>e.jsx(F,{...s,fullWidth:!0,type:"number",error:!!f.deposit_threshold,helperText:w(f.deposit_threshold),sx:{mt:1},placeholder:P,slotProps:{input:{endAdornment:e.jsx(M,{position:"end",children:e.jsx(l,{sx:{display:"flex",alignItems:"center",ml:1},children:e.jsx(D,{logo:n.logo,name:n.symbol})})})},htmlInput:{min:0,max:h}}})})]}),e.jsxs(l,{children:[v(i("admin.vaultConfig.bufferThreshold"),i("admin.vaultConfig.bufferThresholdHelp")),e.jsx(L,{name:"buffer_threshold",control:c,rules:{required:!0,validate:s=>Number(s)<0?i("admin.vaultConfig.bufferThresholdInvalid"):Number(s)>h?i("common.maxAmount",{max:h}):V(s.toString(),r,n.decimal||6)||!0},render:({field:s})=>e.jsx(F,{...s,fullWidth:!0,type:"number",error:!!f.buffer_threshold,helperText:S(f.buffer_threshold),sx:{mt:1},placeholder:E,slotProps:{input:{endAdornment:e.jsx(M,{position:"end",children:e.jsx(l,{sx:{display:"flex",alignItems:"center",ml:1},children:e.jsx(D,{logo:n.logo,name:n.symbol})})})},htmlInput:{min:0,max:h}}})})]})]})]})]})})}const ae=async()=>(await C.get("/api/payment-currencies/vault-config")).data,le=async n=>(await C.get(`/api/payment-currencies/${n}/deposit-vault`)).data,de=async n=>(await C.put(`/api/payment-currencies/${n}/deposit-vault`)).data;function ve(){const{t:n}=O(),{session:m}=K(),{isMobile:g}=ee(),j=q(),i=m?.user?.role==="owner",[r,c]=Z({item:null,edit:!1,confirm:!1}),{data:d={list:[],balances:{}},loading:_,error:f,refresh:T}=I(ae,{onSuccess:o=>{o.error&&y.error(o.error)}}),{runAsync:w}=I(le,{manual:!0,onSuccess:o=>{o.depositAmount&&o.depositAmount!=="0"&&c({confirm:!0})}}),S=o=>{c({item:o,edit:!0})},b=()=>{c({edit:!1})},k=async()=>{if(r.item)try{c({confirm:!1}),await de(r.item.id),y.success(n("admin.vaultConfig.depositQueued"))}catch{y.error(n("admin.vaultConfig.depositFailed"))}},A=()=>{r.item&&w(r.item.id),T(),b()},v=[{label:n("common.currency"),name:"symbol",options:{customBodyRenderLite:o=>{const t=d.list?.[o];return t?e.jsxs(x,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(z,{src:t.logo,alt:t.symbol,style:{width:24,height:24}}),e.jsxs(l,{children:[e.jsx(a,{variant:"body2",children:t.symbol}),!g&&e.jsx(a,{variant:"caption",sx:{color:"text.secondary"},children:t.payment_method?.name})]})]}):"-"}}},{label:n("admin.vaultConfig.appBalance"),name:"id",options:{customBodyRenderLite:o=>{const t=d.list?.[o];return t?e.jsxs(a,{variant:"body1",children:[p(d.balances?.[t.id]||"0",t.decimal)," ",t.symbol]}):"-"}}},{label:n("admin.vaultConfig.enabled"),name:"vault_enabled",options:{customBodyRenderLite:o=>{const t=d.list?.[o];if(!t)return"-";const u=t.vault_config?.enabled;return e.jsxs(x,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(l,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:u?"success.main":"text.lighter"}}),e.jsx(a,{variant:"body2",sx:{color:"text.secondary"},children:n(u?"admin.vaultConfig.enabledYes":"admin.vaultConfig.enabledNo")})]})}}},{label:n("admin.vaultConfig.depositThreshold"),name:"deposit_threshold",options:{customBodyRenderLite:o=>{const t=d.list?.[o];return t?t?.vault_config?e.jsxs(a,{variant:"body1",children:[p(t.vault_config?.deposit_threshold||"0",t.decimal)," ",t.symbol]}):e.jsx(a,{variant:"body2",sx:{color:"text.secondary"},children:n("admin.vaultConfig.notConfig")}):"-"},customHeadLabelRender:()=>e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1},children:[n("admin.vaultConfig.depositThreshold"),e.jsx(H,{title:n("admin.vaultConfig.depositThresholdHelp"),children:e.jsx(B,{fontSize:"small",sx:{color:"text.lighter"}})})]})}},{label:n("admin.vaultConfig.bufferThreshold"),name:"buffer_threshold",options:{customBodyRenderLite:o=>{const t=d.list?.[o];return t?t?.vault_config?e.jsxs(a,{variant:"body1",children:[p(t.vault_config?.buffer_threshold||"0",t.decimal)," ",t.symbol]}):e.jsx(a,{variant:"body2",sx:{color:"text.secondary"},children:n("admin.vaultConfig.notConfig")}):"-"},customHeadLabelRender:()=>e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1},children:[n("admin.vaultConfig.bufferThreshold"),e.jsx(H,{title:n("admin.vaultConfig.bufferThresholdHelp"),children:e.jsx(B,{fontSize:"small",sx:{color:"text.lighter"}})})]})}},...i?[{label:n("common.actions"),name:"actions",options:{customBodyRenderLite:o=>{const t=d.list?.[o];if(!t)return null;const u=t.vault_config?.enabled;return e.jsx(N,{size:"small",variant:"text",onClick:()=>S(t),sx:{color:"text.link",minWidth:"fit-content"},children:n(u?"common.edit":"admin.vaultConfig.enable")})}}}]:[]];if(_)return e.jsx(U,{});if(f)return e.jsx(R,{severity:"error",children:f.message});const s=()=>{const o=n("admin.vaultConfig.configureFirst"),t=oe(o);return e.jsxs(G,{children:[e.jsx(a,{variant:"body1",children:n("admin.vaultConfig.notConfigured")}),e.jsx(a,{variant:"body2",sx:{mt:1,display:"flex",alignItems:"center",gap:.5},children:t.map(u=>u.type==="text"?u.content:e.jsx(se,{to:`${window.location.origin}/.well-known/service/admin/operations/advanced`,style:{color:j.palette.text.link},children:u.content},u.content))})]})};return e.jsxs(ce,{children:[e.jsxs(l,{sx:{mb:2},children:[e.jsxs(a,{variant:"body2",sx:{color:"text.secondary",mt:1},children:[n("admin.vaultConfig.description"),e.jsx(l,{component:"a",href:"https://www.arcblock.io/docs/arcblock-payment-kit/en/vault-config",target:"_blank",rel:"noopener noreferrer",sx:{color:"text.link",textDecoration:"none",ml:.5},children:n("admin.vaultConfig.learnMore")})]}),!i&&e.jsx(R,{severity:"warning",sx:{mt:2},children:n("admin.vaultConfig.ownerOnly")})]}),e.jsx(ne,{data:Array.isArray(d.list)?d.list:[],columns:v,options:{pagination:!1,selectableRows:"none"},mobileTDFlexDirection:"row",toolbar:!1,footer:!1,emptyNode:s()}),r.edit&&r.item&&e.jsx(re,{item:r.item,onClose:b,onSuccess:A,isOwner:i}),r.confirm&&r.item&&e.jsx(te,{title:n("admin.vaultConfig.depositConfirmTitle"),message:n("admin.vaultConfig.depositConfirmMessage",{currency:r.item.symbol}),onCancel:()=>c({confirm:!1}),onConfirm:k,color:"primary"})]})}const ce=W(l)`
1
+ import{j as e,B as l,A as R,a3 as x,q as a,Y as $,a2 as F,aZ as M,x as N,O as H,b4 as B,u as q,N as z,w as U,bf as W}from"./vendor-mui-BXZut9Pz.js";import{V as O,P as I,$ as Y,Z as y,Y as Z,af as G}from"./vendor-blocklet-B67R14so.js";import{h as Q,i as p,C as L,S as X,G as V,L as J,e as C,u as K,d as ee,T as ne,I as te,bk as oe}from"./index-B4yaPb7B.js";import{L as se}from"./link-DMWJcQvZ.js";import{C as D}from"./currency-GstdXsJf.js";import{M as h}from"./util-B8B3fsMa.js";import"./vendor-react-BPknnnEA.js";import"./lodash-B4Ozcv0x.js";const P="100",E="10",ie=async(n,m)=>(await C.put(`/api/payment-currencies/${n}/vault-config`,m)).data;function re({item:n,onClose:m,onSuccess:g,isOwner:j}){const{t:i,locale:r}=O(),{control:c,handleSubmit:d,watch:_,formState:{errors:f}}=Q({defaultValues:{enabled:!0,deposit_threshold:n?.vault_config?.deposit_threshold&&n?.vault_config?.deposit_threshold!=="0"?p(n.vault_config.deposit_threshold,n?.decimal||18):P,withdraw_threshold:n?.vault_config?.withdraw_threshold?p(n.vault_config.withdraw_threshold,n?.decimal||18):"0",buffer_threshold:n?.vault_config?.buffer_threshold?p(n.vault_config.buffer_threshold,n?.decimal||18):E},mode:"onChange"}),T=_("enabled"),w=s=>s?s.message:i("admin.vaultConfig.depositThresholdHelp"),S=s=>s?s.message:i("admin.vaultConfig.bufferThresholdHelp"),{runAsync:b,loading:k}=I(ie,{manual:!0}),A=s=>{if(!n)return;const o=()=>{const t=n.vault_config?.enabled;return!t&&s.enabled?i("admin.vaultConfig.enableSuccess",{currency:n.symbol}):t&&!s.enabled?i("admin.vaultConfig.disableSuccess",{currency:n.symbol}):i("admin.vaultConfig.updateSuccess",{currency:n.symbol})};b(n.id,s).then(()=>{y.success(o()),g()})};if(!n)return null;const v=(s,o)=>e.jsxs(x,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(a,{variant:"subtitle2",children:s}),e.jsx(H,{title:o,children:e.jsx(B,{fontSize:"small",sx:{color:"text.secondary"}})})]});return e.jsx(Y,{open:!0,fullWidth:!0,onClose:m,className:"base-dialog",title:n.vault_config?.enabled?i("admin.vaultConfig.editTitle",{currency:n.symbol}):i("admin.vaultConfig.enableTitle",{currency:n.symbol}),actions:e.jsxs(x,{direction:"row",spacing:2,children:[e.jsx(N,{variant:"outlined",onClick:m,children:i("common.cancel")}),e.jsx(J,{variant:"contained",color:"primary",disabled:k||!j,onClick:d(A),children:i("common.save")})]}),children:e.jsxs(l,{sx:{pb:2},children:[e.jsx(R,{severity:"info",sx:{mb:3},children:i("admin.vaultConfig.enableVaultHelp")}),e.jsxs(x,{spacing:3,children:[e.jsxs(x,{direction:"row",sx:{alignItems:"center",gap:2},children:[e.jsx(a,{variant:"subtitle1",children:i("admin.vaultConfig.enableVault")}),e.jsx(L,{name:"enabled",control:c,render:({field:s})=>e.jsx(X,{checked:s.value,onChange:o=>s.onChange(o.target.checked)})})]}),T&&e.jsxs(e.Fragment,{children:[e.jsx($,{sx:{my:1}}),e.jsxs(l,{children:[v(i("admin.vaultConfig.depositThreshold"),i("admin.vaultConfig.depositThresholdHelp")),e.jsx(L,{name:"deposit_threshold",control:c,rules:{required:!0,validate:s=>Number(s)<=0?i("admin.vaultConfig.depositThresholdRequired"):Number(s)>h?i("common.maxAmount",{max:h}):V(s.toString(),r,n.decimal||6)||!0},render:({field:s})=>e.jsx(F,{...s,fullWidth:!0,type:"number",error:!!f.deposit_threshold,helperText:w(f.deposit_threshold),sx:{mt:1},placeholder:P,slotProps:{input:{endAdornment:e.jsx(M,{position:"end",children:e.jsx(l,{sx:{display:"flex",alignItems:"center",ml:1},children:e.jsx(D,{logo:n.logo,name:n.symbol})})})},htmlInput:{min:0,max:h}}})})]}),e.jsxs(l,{children:[v(i("admin.vaultConfig.bufferThreshold"),i("admin.vaultConfig.bufferThresholdHelp")),e.jsx(L,{name:"buffer_threshold",control:c,rules:{required:!0,validate:s=>Number(s)<0?i("admin.vaultConfig.bufferThresholdInvalid"):Number(s)>h?i("common.maxAmount",{max:h}):V(s.toString(),r,n.decimal||6)||!0},render:({field:s})=>e.jsx(F,{...s,fullWidth:!0,type:"number",error:!!f.buffer_threshold,helperText:S(f.buffer_threshold),sx:{mt:1},placeholder:E,slotProps:{input:{endAdornment:e.jsx(M,{position:"end",children:e.jsx(l,{sx:{display:"flex",alignItems:"center",ml:1},children:e.jsx(D,{logo:n.logo,name:n.symbol})})})},htmlInput:{min:0,max:h}}})})]})]})]})]})})}const ae=async()=>(await C.get("/api/payment-currencies/vault-config")).data,le=async n=>(await C.get(`/api/payment-currencies/${n}/deposit-vault`)).data,de=async n=>(await C.put(`/api/payment-currencies/${n}/deposit-vault`)).data;function ve(){const{t:n}=O(),{session:m}=K(),{isMobile:g}=ee(),j=q(),i=m?.user?.role==="owner",[r,c]=Z({item:null,edit:!1,confirm:!1}),{data:d={list:[],balances:{}},loading:_,error:f,refresh:T}=I(ae,{onSuccess:o=>{o.error&&y.error(o.error)}}),{runAsync:w}=I(le,{manual:!0,onSuccess:o=>{o.depositAmount&&o.depositAmount!=="0"&&c({confirm:!0})}}),S=o=>{c({item:o,edit:!0})},b=()=>{c({edit:!1})},k=async()=>{if(r.item)try{c({confirm:!1}),await de(r.item.id),y.success(n("admin.vaultConfig.depositQueued"))}catch{y.error(n("admin.vaultConfig.depositFailed"))}},A=()=>{r.item&&w(r.item.id),T(),b()},v=[{label:n("common.currency"),name:"symbol",options:{customBodyRenderLite:o=>{const t=d.list?.[o];return t?e.jsxs(x,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(z,{src:t.logo,alt:t.symbol,style:{width:24,height:24}}),e.jsxs(l,{children:[e.jsx(a,{variant:"body2",children:t.symbol}),!g&&e.jsx(a,{variant:"caption",sx:{color:"text.secondary"},children:t.payment_method?.name})]})]}):"-"}}},{label:n("admin.vaultConfig.appBalance"),name:"id",options:{customBodyRenderLite:o=>{const t=d.list?.[o];return t?e.jsxs(a,{variant:"body1",children:[p(d.balances?.[t.id]||"0",t.decimal)," ",t.symbol]}):"-"}}},{label:n("admin.vaultConfig.enabled"),name:"vault_enabled",options:{customBodyRenderLite:o=>{const t=d.list?.[o];if(!t)return"-";const u=t.vault_config?.enabled;return e.jsxs(x,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(l,{sx:{width:8,height:8,borderRadius:"50%",bgcolor:u?"success.main":"text.lighter"}}),e.jsx(a,{variant:"body2",sx:{color:"text.secondary"},children:n(u?"admin.vaultConfig.enabledYes":"admin.vaultConfig.enabledNo")})]})}}},{label:n("admin.vaultConfig.depositThreshold"),name:"deposit_threshold",options:{customBodyRenderLite:o=>{const t=d.list?.[o];return t?t?.vault_config?e.jsxs(a,{variant:"body1",children:[p(t.vault_config?.deposit_threshold||"0",t.decimal)," ",t.symbol]}):e.jsx(a,{variant:"body2",sx:{color:"text.secondary"},children:n("admin.vaultConfig.notConfig")}):"-"},customHeadLabelRender:()=>e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1},children:[n("admin.vaultConfig.depositThreshold"),e.jsx(H,{title:n("admin.vaultConfig.depositThresholdHelp"),children:e.jsx(B,{fontSize:"small",sx:{color:"text.lighter"}})})]})}},{label:n("admin.vaultConfig.bufferThreshold"),name:"buffer_threshold",options:{customBodyRenderLite:o=>{const t=d.list?.[o];return t?t?.vault_config?e.jsxs(a,{variant:"body1",children:[p(t.vault_config?.buffer_threshold||"0",t.decimal)," ",t.symbol]}):e.jsx(a,{variant:"body2",sx:{color:"text.secondary"},children:n("admin.vaultConfig.notConfig")}):"-"},customHeadLabelRender:()=>e.jsxs(l,{sx:{display:"flex",alignItems:"center",gap:1},children:[n("admin.vaultConfig.bufferThreshold"),e.jsx(H,{title:n("admin.vaultConfig.bufferThresholdHelp"),children:e.jsx(B,{fontSize:"small",sx:{color:"text.lighter"}})})]})}},...i?[{label:n("common.actions"),name:"actions",options:{customBodyRenderLite:o=>{const t=d.list?.[o];if(!t)return null;const u=t.vault_config?.enabled;return e.jsx(N,{size:"small",variant:"text",onClick:()=>S(t),sx:{color:"text.link",minWidth:"fit-content"},children:n(u?"common.edit":"admin.vaultConfig.enable")})}}}]:[]];if(_)return e.jsx(U,{});if(f)return e.jsx(R,{severity:"error",children:f.message});const s=()=>{const o=n("admin.vaultConfig.configureFirst"),t=oe(o);return e.jsxs(G,{children:[e.jsx(a,{variant:"body1",children:n("admin.vaultConfig.notConfigured")}),e.jsx(a,{variant:"body2",sx:{mt:1,display:"flex",alignItems:"center",gap:.5},children:t.map(u=>u.type==="text"?u.content:e.jsx(se,{to:`${window.location.origin}/.well-known/service/admin/operations/advanced`,style:{color:j.palette.text.link},children:u.content},u.content))})]})};return e.jsxs(ce,{children:[e.jsxs(l,{sx:{mb:2},children:[e.jsxs(a,{variant:"body2",sx:{color:"text.secondary",mt:1},children:[n("admin.vaultConfig.description"),e.jsx(l,{component:"a",href:"https://www.arcblock.io/docs/arcblock-payment-kit/en/vault-config",target:"_blank",rel:"noopener noreferrer",sx:{color:"text.link",textDecoration:"none",ml:.5},children:n("admin.vaultConfig.learnMore")})]}),!i&&e.jsx(R,{severity:"warning",sx:{mt:2},children:n("admin.vaultConfig.ownerOnly")})]}),e.jsx(ne,{data:Array.isArray(d.list)?d.list:[],columns:v,options:{pagination:!1,selectableRows:"none"},mobileTDFlexDirection:"row",toolbar:!1,footer:!1,emptyNode:s()}),r.edit&&r.item&&e.jsx(re,{item:r.item,onClose:b,onSuccess:A,isOwner:i}),r.confirm&&r.item&&e.jsx(te,{title:n("admin.vaultConfig.depositConfirmTitle"),message:n("admin.vaultConfig.depositConfirmMessage",{currency:r.item.symbol}),onCancel:()=>c({confirm:!1}),onConfirm:k,color:"primary"})]})}const ce=W(l)`
2
2
  @media (max-width: ${({theme:n})=>n.breakpoints.values.md}px) {
3
3
  .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > td.MuiTableCell-root {
4
4
  > div {
@@ -1,4 +1,4 @@
1
- import{r as j,j as e,a3 as b,q as h,a0 as B,x as k,B as a,a2 as T,Y as W,$ as A,bs as $,bt as z,aY as V,N,A as H,w as O,O as M,I as U,V as Y}from"./vendor-mui-BXZut9Pz.js";import{V as P,Z as y,cv as G,O as K,P as X,F as Z,$ as F}from"./vendor-blocklet-DcLR2Cyf.js";import{h as J,F as Q,C as w,e as D,bc as I,k as R,b9 as ee,l as te,S as ne,T as oe,I as se}from"./index-BarN7DfU.js";import"./vendor-react-BPknnnEA.js";function re({count:t}){return e.jsxs(b,{sx:{flexDirection:"row",justifyContent:"center",alignItems:"center"},children:[e.jsx(a,{sx:{display:"flex",position:"relative"},children:Array(Math.min(t,5)).fill(0).map((n,i)=>e.jsx(a,{sx:{width:"24px",height:"24px",borderRadius:"50%",bgcolor:"grey.200",border:"2px solid",borderColor:"divider",position:"relative",marginLeft:i===0?0:"-8px",zIndex:t-i}},i))}),e.jsx(a,{sx:{fontSize:"14px",color:"text.secondary",pl:1.5,pr:1,ml:-1,borderRadius:"8px",backgroundColor:"background.paper",height:"24px",display:"flex",alignItems:"center"},children:`${t} supporter${t>1?"s":""} (XX ABT)`})]})}function ae({config:t}){const{t:n}=P(),i=t.settings.amount.presets?.length>0,[o,c]=j.useState(t.settings.amount.preset),[f,g]=j.useState(""),[u,p]=j.useState(i?!1:t.settings.amount.custom),s=l=>{c(l),p(!1),g("")},m=()=>{p(!0),c("")};return e.jsxs(b,{spacing:3,children:[e.jsx(h,{variant:"h6",gutterBottom:!0,sx:{color:"text.primary"},children:n("admin.donate.previewTitle")}),e.jsxs(B,{elevation:0,sx:{p:2,bgcolor:"background.paper",border:"1px dashed",borderColor:"divider",borderRadius:1},children:[e.jsx(h,{variant:"caption",gutterBottom:!0,sx:{display:"block",color:"text.secondary",mb:1},children:n("admin.donate.btn.preview")}),e.jsxs(b,{spacing:2,sx:{alignItems:"center"},children:[e.jsx(k,{variant:"outlined",color:"primary",children:t.settings.btnText}),e.jsx(re,{count:3}),e.jsx(a,{sx:{width:"100%",maxWidth:300},children:t.settings.historyType==="table"&&e.jsx(a,{sx:{borderRadius:1,p:1.5,display:"flex",flexDirection:"column",alignItems:"center",gap:1.5},children:Array(3).fill(0).map((l,x)=>e.jsxs(a,{sx:{display:"flex",justifyContent:"center",alignItems:"center",gap:1,opacity:1-x*.2,width:"100%",maxWidth:240},children:[e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:.5,width:"75%"},children:[e.jsx(a,{sx:{width:"16px",height:"16px",borderRadius:"50%",bgcolor:"grey.200",border:"2px solid",borderColor:"divider",position:"relative"}},x),e.jsx(a,{sx:{width:"100%",height:8,borderRadius:1,bgcolor:"grey.200"}})]}),e.jsx(a,{sx:{width:"25%",height:8,borderRadius:1,bgcolor:"grey.200"}})]},x))})})]})]}),e.jsxs(B,{elevation:0,sx:{p:2,bgcolor:"background.paper",border:"1px dashed",borderColor:"divider",borderRadius:1},children:[e.jsx(h,{variant:"caption",gutterBottom:!0,sx:{display:"block",color:"text.secondary",mb:1},children:n("admin.donate.dialog.preview")}),e.jsxs(b,{spacing:3,children:[e.jsxs(a,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:[t.settings.amount.presets?.map(l=>e.jsx(k,{variant:"outlined",size:"small",sx:{borderColor:o===l?"primary.main":"divider",borderWidth:o===l?2:1,color:o===l?"primary.main":"text.primary"},onClick:()=>s(l),children:`${l} ABT`},l)),t.settings.amount.custom&&i&&e.jsx(k,{variant:"outlined",size:"small",sx:{borderColor:u?"primary.main":"divider",borderWidth:u?2:1,color:u?"primary.main":"text.primary"},onClick:m,children:n("common.custom")})]}),u&&t.settings.amount.custom&&e.jsx(T,{fullWidth:!0,size:"small",autoFocus:!0,label:n("admin.donate.customAmount"),value:f,onChange:l=>{const{value:x}=l.target;g(x)},helperText:n("admin.donate.amountRange",{min:t.settings.amount.minimum,max:t.settings.amount.maximum}),slotProps:{input:{endAdornment:e.jsx(h,{sx:{ml:1},children:"ABT"})}},autoComplete:"off"})]}),e.jsx(W,{sx:{my:2}}),e.jsxs(a,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:1},children:[e.jsx(a,{sx:{px:2,py:.5,bgcolor:"grey.200",borderRadius:1,width:40,height:24}}),e.jsx(a,{sx:{px:2,py:.5,bgcolor:"primary.main",borderRadius:1,width:40,height:24,opacity:.5}})]})]})]})}function ie({value:t,onChange:n}){const{t:i}=P(),[o,c]=j.useState(t.join(", ")),f=j.useRef(!1);j.useEffect(()=>{if(f.current){f.current=!1;return}c(t.join(", "))},[t]);const g=u=>{const{value:p}=u.target;if(!/^[\d,.\s]*$/.test(p))return;c(p);const m=p.split(/[,\s]+/).filter(Boolean).map(l=>l.trim()).filter(l=>!Number.isNaN(Number(l))).map(Number).filter((l,x,v)=>v.indexOf(l)===x);f.current=!0,n(m.map(String))};return e.jsx(T,{fullWidth:!0,label:i("admin.donate.presets"),helperText:i("admin.donate.presetsHelper"),value:o,onChange:g,placeholder:"1, 5, 10",sx:{bgcolor:"background.paper"},onBlur:()=>{const u=(o.match(/[\d.]+/g)||[]).join(", ");c(u)}})}function le({item:t,onSuccess:n,onCancel:i}){const{t:o}=P(),c=J({defaultValues:{settings:{amount:{presets:t?.settings?.amount?.presets,preset:t?.settings?.amount?.preset,minimum:t?.settings?.amount?.minimum,maximum:t?.settings?.amount?.maximum,custom:t?.settings?.amount?.custom},btnText:t?.settings?.btnText,historyType:t?.settings?.historyType}}}),{handleSubmit:f,watch:g}=c,u=g(),p=async s=>{if(s.settings.amount.presets?.length>0&&s.settings.amount.preset&&!s.settings.amount.presets.includes(s.settings.amount.preset)){y.error(o("admin.donate.validation.invalidPreset"));return}try{await D.put(`/api/settings/${t.id}`,s),I(t.mount_location),y.success(o("admin.donate.updateSuccess")),n()}catch(m){y.error(R(m))}};return e.jsxs(a,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[e.jsx(a,{sx:{flex:1,overflow:{xs:"visible",md:"auto"},pb:2,display:"flex",flexDirection:"column"},children:e.jsx(Q,{...c,children:e.jsxs(A,{container:!0,spacing:3,sx:{flex:1,minHeight:0},children:[e.jsx(A,{sx:{height:"100%"},size:{xs:12,md:6},children:e.jsx(B,{elevation:0,sx:{p:{xs:2,md:3},bgcolor:"background.neutral",height:"100%",overflow:"auto"},children:e.jsxs(b,{spacing:4,children:[e.jsxs(a,{children:[e.jsx(h,{variant:"h6",gutterBottom:!0,sx:{color:"text.primary",mb:3},children:o("admin.donate.buttonSettings")}),e.jsxs(b,{spacing:3,children:[e.jsx(w,{name:"settings.btnText",render:({field:s})=>e.jsx(T,{...s,fullWidth:!0,label:o("admin.donate.btn.text"),helperText:o("admin.donate.btn.helper"),sx:{bgcolor:"background.paper"}})}),e.jsxs(b,{sx:{gap:1},children:[e.jsx(h,{variant:"subtitle2",gutterBottom:!0,children:o("admin.donate.historyType.title")}),e.jsx(w,{name:"settings.historyType",render:({field:s})=>e.jsxs($,{value:s.value,exclusive:!0,onChange:(m,l)=>s.onChange(l),size:"small",sx:{bgcolor:"background.paper"},children:[e.jsx(z,{value:"table",size:"small",children:o("admin.donate.historyType.list")}),e.jsx(z,{value:"avatar",size:"small",children:o("admin.donate.historyType.avatar")})]})})]})]})]}),e.jsx(W,{}),e.jsxs(a,{children:[e.jsx(h,{variant:"h6",gutterBottom:!0,sx:{color:"text.primary",mb:3},children:o("admin.donate.amountSettings")}),e.jsxs(b,{spacing:3,children:[e.jsx(w,{control:c.control,name:"settings.amount.presets",render:({field:s})=>e.jsx(ie,{value:s.value||[],onChange:s.onChange})}),e.jsx(w,{name:"settings.amount.preset",render:({field:s})=>e.jsx(T,{...s,fullWidth:!0,label:o("admin.donate.preset"),helperText:o("admin.donate.presetHelper"),sx:{bgcolor:"background.paper"}})}),e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(h,{variant:"subtitle2",gutterBottom:!0,children:o("admin.donate.custom")}),e.jsx(w,{name:"settings.amount.custom",render:({field:s})=>e.jsx(V,{checked:s.value,onChange:m=>s.onChange(m.target.checked),size:"small"})})]}),u.settings.amount.custom&&e.jsxs(b,{spacing:2,sx:{mt:2},children:[e.jsx(w,{name:"settings.amount.minimum",render:({field:s})=>e.jsx(T,{...s,fullWidth:!0,label:o("admin.donate.minimum"),type:"number",sx:{bgcolor:"background.paper"}})}),e.jsx(w,{name:"settings.amount.maximum",render:({field:s})=>e.jsx(T,{...s,fullWidth:!0,label:o("admin.donate.maximum"),type:"number",sx:{bgcolor:"background.paper"}})})]})]})]})]})})}),e.jsx(A,{sx:{display:{xs:"none",md:"block"},height:"100%"},size:{md:6},children:e.jsx(B,{elevation:0,sx:{p:3,bgcolor:"background.neutral",height:"100%",overflow:"auto"},children:e.jsx(ae,{config:c.watch()})})})]})})}),e.jsxs(a,{sx:{mt:2,pt:2,pb:2,px:2,borderTop:1,borderColor:"divider",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"background.paper",position:"sticky",bottom:0,left:0,right:0,zIndex:1},children:[e.jsx(k,{onClick:i,variant:"outlined",children:o("common.cancel")}),e.jsx(k,{variant:"contained",onClick:f(p),children:o("common.save")})]})]})}const de=`import { PaymentProvider, DonateProvider, CheckoutDonate } from '@blocklet/payment-react';
1
+ import{r as j,j as e,a3 as b,q as h,a0 as B,x as k,B as a,a2 as T,Y as W,$ as A,bs as $,bt as z,aY as V,N,A as H,w as O,O as M,I as U,V as Y}from"./vendor-mui-BXZut9Pz.js";import{V as P,Z as y,cv as G,O as K,P as X,F as Z,$ as F}from"./vendor-blocklet-B67R14so.js";import{h as J,F as Q,C as w,e as D,bc as I,k as R,b9 as ee,l as te,S as ne,T as oe,I as se}from"./index-B4yaPb7B.js";import"./vendor-react-BPknnnEA.js";function re({count:t}){return e.jsxs(b,{sx:{flexDirection:"row",justifyContent:"center",alignItems:"center"},children:[e.jsx(a,{sx:{display:"flex",position:"relative"},children:Array(Math.min(t,5)).fill(0).map((n,i)=>e.jsx(a,{sx:{width:"24px",height:"24px",borderRadius:"50%",bgcolor:"grey.200",border:"2px solid",borderColor:"divider",position:"relative",marginLeft:i===0?0:"-8px",zIndex:t-i}},i))}),e.jsx(a,{sx:{fontSize:"14px",color:"text.secondary",pl:1.5,pr:1,ml:-1,borderRadius:"8px",backgroundColor:"background.paper",height:"24px",display:"flex",alignItems:"center"},children:`${t} supporter${t>1?"s":""} (XX ABT)`})]})}function ae({config:t}){const{t:n}=P(),i=t.settings.amount.presets?.length>0,[o,c]=j.useState(t.settings.amount.preset),[f,g]=j.useState(""),[u,p]=j.useState(i?!1:t.settings.amount.custom),s=l=>{c(l),p(!1),g("")},m=()=>{p(!0),c("")};return e.jsxs(b,{spacing:3,children:[e.jsx(h,{variant:"h6",gutterBottom:!0,sx:{color:"text.primary"},children:n("admin.donate.previewTitle")}),e.jsxs(B,{elevation:0,sx:{p:2,bgcolor:"background.paper",border:"1px dashed",borderColor:"divider",borderRadius:1},children:[e.jsx(h,{variant:"caption",gutterBottom:!0,sx:{display:"block",color:"text.secondary",mb:1},children:n("admin.donate.btn.preview")}),e.jsxs(b,{spacing:2,sx:{alignItems:"center"},children:[e.jsx(k,{variant:"outlined",color:"primary",children:t.settings.btnText}),e.jsx(re,{count:3}),e.jsx(a,{sx:{width:"100%",maxWidth:300},children:t.settings.historyType==="table"&&e.jsx(a,{sx:{borderRadius:1,p:1.5,display:"flex",flexDirection:"column",alignItems:"center",gap:1.5},children:Array(3).fill(0).map((l,x)=>e.jsxs(a,{sx:{display:"flex",justifyContent:"center",alignItems:"center",gap:1,opacity:1-x*.2,width:"100%",maxWidth:240},children:[e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:.5,width:"75%"},children:[e.jsx(a,{sx:{width:"16px",height:"16px",borderRadius:"50%",bgcolor:"grey.200",border:"2px solid",borderColor:"divider",position:"relative"}},x),e.jsx(a,{sx:{width:"100%",height:8,borderRadius:1,bgcolor:"grey.200"}})]}),e.jsx(a,{sx:{width:"25%",height:8,borderRadius:1,bgcolor:"grey.200"}})]},x))})})]})]}),e.jsxs(B,{elevation:0,sx:{p:2,bgcolor:"background.paper",border:"1px dashed",borderColor:"divider",borderRadius:1},children:[e.jsx(h,{variant:"caption",gutterBottom:!0,sx:{display:"block",color:"text.secondary",mb:1},children:n("admin.donate.dialog.preview")}),e.jsxs(b,{spacing:3,children:[e.jsxs(a,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:[t.settings.amount.presets?.map(l=>e.jsx(k,{variant:"outlined",size:"small",sx:{borderColor:o===l?"primary.main":"divider",borderWidth:o===l?2:1,color:o===l?"primary.main":"text.primary"},onClick:()=>s(l),children:`${l} ABT`},l)),t.settings.amount.custom&&i&&e.jsx(k,{variant:"outlined",size:"small",sx:{borderColor:u?"primary.main":"divider",borderWidth:u?2:1,color:u?"primary.main":"text.primary"},onClick:m,children:n("common.custom")})]}),u&&t.settings.amount.custom&&e.jsx(T,{fullWidth:!0,size:"small",autoFocus:!0,label:n("admin.donate.customAmount"),value:f,onChange:l=>{const{value:x}=l.target;g(x)},helperText:n("admin.donate.amountRange",{min:t.settings.amount.minimum,max:t.settings.amount.maximum}),slotProps:{input:{endAdornment:e.jsx(h,{sx:{ml:1},children:"ABT"})}},autoComplete:"off"})]}),e.jsx(W,{sx:{my:2}}),e.jsxs(a,{sx:{display:"flex",justifyContent:"flex-end",alignItems:"center",gap:1},children:[e.jsx(a,{sx:{px:2,py:.5,bgcolor:"grey.200",borderRadius:1,width:40,height:24}}),e.jsx(a,{sx:{px:2,py:.5,bgcolor:"primary.main",borderRadius:1,width:40,height:24,opacity:.5}})]})]})]})}function ie({value:t,onChange:n}){const{t:i}=P(),[o,c]=j.useState(t.join(", ")),f=j.useRef(!1);j.useEffect(()=>{if(f.current){f.current=!1;return}c(t.join(", "))},[t]);const g=u=>{const{value:p}=u.target;if(!/^[\d,.\s]*$/.test(p))return;c(p);const m=p.split(/[,\s]+/).filter(Boolean).map(l=>l.trim()).filter(l=>!Number.isNaN(Number(l))).map(Number).filter((l,x,v)=>v.indexOf(l)===x);f.current=!0,n(m.map(String))};return e.jsx(T,{fullWidth:!0,label:i("admin.donate.presets"),helperText:i("admin.donate.presetsHelper"),value:o,onChange:g,placeholder:"1, 5, 10",sx:{bgcolor:"background.paper"},onBlur:()=>{const u=(o.match(/[\d.]+/g)||[]).join(", ");c(u)}})}function le({item:t,onSuccess:n,onCancel:i}){const{t:o}=P(),c=J({defaultValues:{settings:{amount:{presets:t?.settings?.amount?.presets,preset:t?.settings?.amount?.preset,minimum:t?.settings?.amount?.minimum,maximum:t?.settings?.amount?.maximum,custom:t?.settings?.amount?.custom},btnText:t?.settings?.btnText,historyType:t?.settings?.historyType}}}),{handleSubmit:f,watch:g}=c,u=g(),p=async s=>{if(s.settings.amount.presets?.length>0&&s.settings.amount.preset&&!s.settings.amount.presets.includes(s.settings.amount.preset)){y.error(o("admin.donate.validation.invalidPreset"));return}try{await D.put(`/api/settings/${t.id}`,s),I(t.mount_location),y.success(o("admin.donate.updateSuccess")),n()}catch(m){y.error(R(m))}};return e.jsxs(a,{sx:{display:"flex",flexDirection:"column",height:"100%"},children:[e.jsx(a,{sx:{flex:1,overflow:{xs:"visible",md:"auto"},pb:2,display:"flex",flexDirection:"column"},children:e.jsx(Q,{...c,children:e.jsxs(A,{container:!0,spacing:3,sx:{flex:1,minHeight:0},children:[e.jsx(A,{sx:{height:"100%"},size:{xs:12,md:6},children:e.jsx(B,{elevation:0,sx:{p:{xs:2,md:3},bgcolor:"background.neutral",height:"100%",overflow:"auto"},children:e.jsxs(b,{spacing:4,children:[e.jsxs(a,{children:[e.jsx(h,{variant:"h6",gutterBottom:!0,sx:{color:"text.primary",mb:3},children:o("admin.donate.buttonSettings")}),e.jsxs(b,{spacing:3,children:[e.jsx(w,{name:"settings.btnText",render:({field:s})=>e.jsx(T,{...s,fullWidth:!0,label:o("admin.donate.btn.text"),helperText:o("admin.donate.btn.helper"),sx:{bgcolor:"background.paper"}})}),e.jsxs(b,{sx:{gap:1},children:[e.jsx(h,{variant:"subtitle2",gutterBottom:!0,children:o("admin.donate.historyType.title")}),e.jsx(w,{name:"settings.historyType",render:({field:s})=>e.jsxs($,{value:s.value,exclusive:!0,onChange:(m,l)=>s.onChange(l),size:"small",sx:{bgcolor:"background.paper"},children:[e.jsx(z,{value:"table",size:"small",children:o("admin.donate.historyType.list")}),e.jsx(z,{value:"avatar",size:"small",children:o("admin.donate.historyType.avatar")})]})})]})]})]}),e.jsx(W,{}),e.jsxs(a,{children:[e.jsx(h,{variant:"h6",gutterBottom:!0,sx:{color:"text.primary",mb:3},children:o("admin.donate.amountSettings")}),e.jsxs(b,{spacing:3,children:[e.jsx(w,{control:c.control,name:"settings.amount.presets",render:({field:s})=>e.jsx(ie,{value:s.value||[],onChange:s.onChange})}),e.jsx(w,{name:"settings.amount.preset",render:({field:s})=>e.jsx(T,{...s,fullWidth:!0,label:o("admin.donate.preset"),helperText:o("admin.donate.presetHelper"),sx:{bgcolor:"background.paper"}})}),e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(h,{variant:"subtitle2",gutterBottom:!0,children:o("admin.donate.custom")}),e.jsx(w,{name:"settings.amount.custom",render:({field:s})=>e.jsx(V,{checked:s.value,onChange:m=>s.onChange(m.target.checked),size:"small"})})]}),u.settings.amount.custom&&e.jsxs(b,{spacing:2,sx:{mt:2},children:[e.jsx(w,{name:"settings.amount.minimum",render:({field:s})=>e.jsx(T,{...s,fullWidth:!0,label:o("admin.donate.minimum"),type:"number",sx:{bgcolor:"background.paper"}})}),e.jsx(w,{name:"settings.amount.maximum",render:({field:s})=>e.jsx(T,{...s,fullWidth:!0,label:o("admin.donate.maximum"),type:"number",sx:{bgcolor:"background.paper"}})})]})]})]})]})})}),e.jsx(A,{sx:{display:{xs:"none",md:"block"},height:"100%"},size:{md:6},children:e.jsx(B,{elevation:0,sx:{p:3,bgcolor:"background.neutral",height:"100%",overflow:"auto"},children:e.jsx(ae,{config:c.watch()})})})]})})}),e.jsxs(a,{sx:{mt:2,pt:2,pb:2,px:2,borderTop:1,borderColor:"divider",display:"flex",justifyContent:"flex-end",gap:2,bgcolor:"background.paper",position:"sticky",bottom:0,left:0,right:0,zIndex:1},children:[e.jsx(k,{onClick:i,variant:"outlined",children:o("common.cancel")}),e.jsx(k,{variant:"contained",onClick:f(p),children:o("common.save")})]})]})}const de=`import { PaymentProvider, DonateProvider, CheckoutDonate } from '@blocklet/payment-react';
2
2
 
3
3
  // In your component
4
4
  function YourComponent() {