@dcl/shop 0.1.0-30830629458.commit-f262460 → 0.1.0-30830708286.commit-6900e32

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 (173) hide show
  1. package/_assets/{Activity-CjacNjRa.js → Activity-MnXzrB9W.js} +1 -1
  2. package/_assets/{AnimatedBackground-PkIZl5hm.js → AnimatedBackground-htl_aksK.js} +1 -1
  3. package/_assets/{Assets-5wAFGxcK.js → Assets-CBDYtRid.js} +2 -2
  4. package/_assets/{Assets.styles-Dmr7Nx8g.js → Assets.styles-BJpp2Oe0.js} +1 -1
  5. package/_assets/{Authorizations-BwlLD3qy.js → Authorizations-lE31EPN4.js} +1 -1
  6. package/_assets/{Cart-DnbzsALm.js → Cart-e1KMPGgH.js} +2 -2
  7. package/_assets/{CircularProgress-DRxUSHk1.js → CircularProgress-nhFw9veT.js} +1 -1
  8. package/_assets/{Collection-DU7G3g82.js → Collection--mvJQAHb.js} +1 -1
  9. package/_assets/{CollectionCarousel-CQfEMkUH.js → CollectionCarousel-CEkqQ1PE.js} +1 -1
  10. package/_assets/{Creator-CVS6aYZQ.js → Creator-CDsnYW7x.js} +1 -1
  11. package/_assets/{ErrorNotice-DrZAUSEy.js → ErrorNotice-FoLpDD1-.js} +1 -1
  12. package/_assets/{ExchangeController-2ScniXrJ.js → ExchangeController-C5od18cc.js} +1 -1
  13. package/_assets/{GetCredits-C83hLyJ8.js → GetCredits-UC4ETtf6.js} +1 -1
  14. package/_assets/{HelpersUtil-DcVfTCy4.js → HelpersUtil-DN2EdyXJ.js} +1 -1
  15. package/_assets/{ImportListings-CRd3Did-.js → ImportListings-CNRuPtew.js} +1 -1
  16. package/_assets/ItemDetail-Cb5zRdZJ.js +3354 -0
  17. package/_assets/{LoadMore-C0qTp7ND.js → LoadMore-8od0F5L9.js} +1 -1
  18. package/_assets/{MenuList-CYR6stfs.js → MenuList-DS3r7IBB.js} +1 -1
  19. package/_assets/{MyAssets-CE_mdbtb.js → MyAssets-Dm7z3LNq.js} +1 -1
  20. package/_assets/{MyFavorites-B97kx1Cl.js → MyFavorites-CJ9BdUjm.js} +1 -1
  21. package/_assets/{NotFound-TUdgB3vx.js → NotFound-B0AaFvrv.js} +1 -1
  22. package/_assets/{NotificationsBell-EcXXvnac.js → NotificationsBell-T4VZFoIu.js} +1 -1
  23. package/_assets/{StoreSettings-CD-xMM0H.js → StoreSettings-BGnmAotG.js} +1 -1
  24. package/_assets/{Success-DMTX65g5.js → Success-BvFPVtXh.js} +1 -1
  25. package/_assets/{SwapController-BNXBHmCP.js → SwapController-Ce813SnO.js} +1 -1
  26. package/_assets/{Tooltip-Bp91aI0Y.js → Tooltip-Dy87pXpy.js} +1 -1
  27. package/_assets/{TradeService-D5IZhyEM.js → TradeService-BbXC6H5_.js} +1 -1
  28. package/_assets/{W3MFrameProviderSingleton-4IvPGz6h.js → W3MFrameProviderSingleton-CrdKu7xI.js} +3 -3
  29. package/_assets/{WebCryptoP256-rFLt39m-.js → WebCryptoP256-XeUqCFp1.js} +1 -1
  30. package/_assets/{authorizations-CyYFEcSa.js → authorizations-E8_0NGng.js} +1 -1
  31. package/_assets/{basic-DMYt1urV.js → basic-BgmhLeYh.js} +1 -1
  32. package/_assets/{biconomy-Bscfv1UQ.js → biconomy-CoRUSW3F.js} +1 -1
  33. package/_assets/{browseLayout.styles-B9qeOgPd.js → browseLayout.styles-BuE8ZzH7.js} +1 -1
  34. package/_assets/{builder-DmX3M212.js → builder-CSTbRG1g.js} +1 -1
  35. package/_assets/{buy-Cva9EYX4.js → buy-CFAg0mL8.js} +1 -1
  36. package/_assets/{buy-gasless-DQdl_Uxy.js → buy-gasless-B2L69ya6.js} +1 -1
  37. package/_assets/{categories-D_mk1mr7.js → categories-wrk9ttY6.js} +1 -1
  38. package/_assets/{ccip-CVAstCzZ.js → ccip-YM_kCBLY.js} +1 -1
  39. package/_assets/{ccip-VD9kq8RI.js → ccip-gnBPW_-R.js} +1 -1
  40. package/_assets/{clsx-DERZ5aic.js → clsx-CqIwIRCQ.js} +1 -1
  41. package/_assets/{controller-CaScyb3o.js → controller-yZy75Z7P.js} +2 -2
  42. package/_assets/{core-045hB8fK.js → core-DkD31Zjb.js} +4 -4
  43. package/_assets/{createSvgIcon-D2wotWJT.js → createSvgIcon-CMMzm3U0.js} +1 -1
  44. package/_assets/{custom-BwBa5GNT.js → custom-B-orziPC.js} +1 -1
  45. package/_assets/{data-capture-BumF7KJT.js → data-capture-nSLWVv-w.js} +1 -1
  46. package/_assets/{email-DwuUL6Y5.js → email-Bj103v1P.js} +1 -1
  47. package/_assets/{embedded-wallet-YVHu-4H2.js → embedded-wallet-BcQlnpmz.js} +1 -1
  48. package/_assets/{emotion-styled.browser.esm-BRsVIyWl.js → emotion-styled.browser.esm-Cx7yWxVd.js} +1 -1
  49. package/_assets/{engine-mA2PHPYA.js → engine-DDk1gbcP.js} +1 -1
  50. package/_assets/{errors-DO4IpB78.js → errors-CPDOUeQU.js} +1 -1
  51. package/_assets/{estimate-l1-fee-D6HU4JJb.js → estimate-l1-fee-COUDSnTC.js} +1 -1
  52. package/_assets/{execute-CXWBSLAV.js → execute-CmAmYuhz.js} +2 -2
  53. package/_assets/{features-BZHSZE5B.js → features-B3EUOZIc.js} +1 -1
  54. package/_assets/{fetchTokenMetadata-7Z00ARdH.js → fetchTokenMetadata-CfOxP6Xt.js} +2 -2
  55. package/_assets/{get-ecosystem-wallet-info-DkTE-3bd.js → get-ecosystem-wallet-info-CT8m7arg.js} +1 -1
  56. package/_assets/{getBalance-DAQ7MPk5.js → getBalance-sSJeAfPA.js} +1 -1
  57. package/_assets/{getNFT-DP6JSJ0N.js → getNFT-CaRZc3jP.js} +1 -1
  58. package/_assets/{getNFT-Qlf-NTZ7.js → getNFT-DQ56iXLL.js} +1 -1
  59. package/_assets/{getThemeProps-C_g-oZEK.js → getThemeProps-DMuo3coh.js} +1 -1
  60. package/_assets/{grid.styles-HC96xAOy.js → grid.styles-D-gTOGBC.js} +1 -1
  61. package/_assets/{hashTypedData-CUVRu2cl.js → hashTypedData-BiYwzMSX.js} +1 -1
  62. package/_assets/{hashTypedData-C5vfh3Nq.js → hashTypedData-DTFMLH-r.js} +1 -1
  63. package/_assets/{import-DXnpuPId.js → import-DdbcQXPQ.js} +1 -1
  64. package/_assets/{in-app-BnyksczV.js → in-app-DqFHpjTV.js} +1 -1
  65. package/_assets/{in-app-wallet-calls-BIhW4akc.js → in-app-wallet-calls-DHqdMTHg.js} +1 -1
  66. package/_assets/{index-BWlxd95s.js → index-B-GIGHBi.js} +1 -1
  67. package/_assets/{index-BLQwO4Nt.js → index-B1Vw7Ce7.js} +1 -1
  68. package/_assets/{index-Ctbmwpd0.js → index-B1oCsNE3.js} +3 -3
  69. package/_assets/{index-BwlqGSA9.js → index-B4TEatQl.js} +1 -1
  70. package/_assets/{index-D20c8kvd.js → index-B6qnJTMp.js} +1 -1
  71. package/_assets/{index-DvVAPPxB.js → index-BHap0Pt7.js} +1 -1
  72. package/_assets/{index-D5-5jcck.js → index-BJpdqx6Q.js} +1 -1
  73. package/_assets/{index-kR8ygsw5.js → index-BPe_F07L.js} +1 -1
  74. package/_assets/{index-BqG15SXU.js → index-BbV5I-Nq.js} +1 -1
  75. package/_assets/{index-5lWOMhhZ.js → index-BcG9G8Eg.js} +1 -1
  76. package/_assets/{index-WI4VSf6p.js → index-Bjtki3zK.js} +1 -1
  77. package/_assets/{index-Bn80c8yA.js → index-BkDnPBy0.js} +2 -2
  78. package/_assets/{index-He4E6KZm.js → index-BmscqdKV.js} +1 -1
  79. package/_assets/{index-BmoHTI5G.js → index-BoKPwZrb.js} +1 -1
  80. package/_assets/{index-DETCGrXn.js → index-BuvImOwE.js} +1 -1
  81. package/_assets/{index-DsO7QFpa.js → index-BxayUwju.js} +1 -1
  82. package/_assets/{index-DpTQClkk.js → index-C-mOh_a2.js} +1 -1
  83. package/_assets/{index-DBpOtcgF.js → index-CBEktmuo.js} +2 -2
  84. package/_assets/{index-Dq_CrhLh.js → index-CBHL2bKV.js} +1 -1
  85. package/_assets/{index-DCKo3ZFt.js → index-CFcgb0ax.js} +1 -1
  86. package/_assets/{index-CoZMII25.js → index-CTFvSyNV.js} +1 -1
  87. package/_assets/{index-D8mbgnFf.js → index-CTG34-7k.js} +1 -1
  88. package/_assets/{index-BP7eeR80.js → index-CbJMa4Yh.js} +1 -1
  89. package/_assets/{index-YHLkcndY.js → index-CeiZi1Mv.js} +1 -1
  90. package/_assets/{index-CyhHWm-_.js → index-CgPnggHq.js} +1 -1
  91. package/_assets/{index-BWZW3j3J.js → index-CiqXMsjr.js} +1 -1
  92. package/_assets/{index-BDNMoeiU.js → index-Cywb3mZG.js} +1 -1
  93. package/_assets/{index-pAWTMttb.js → index-D-ZDvJCP.js} +1 -1
  94. package/_assets/{index-caRbBa_r.js → index-DIQz8cOu.js} +1 -1
  95. package/_assets/{index-Bml7jgmO.js → index-DJeGZsWn.js} +1 -1
  96. package/_assets/{index-IQENxrBC.js → index-DNqM2cRp.js} +1 -1
  97. package/_assets/{index-CsgOgrFX.js → index-DOMV_UlQ.js} +1 -1
  98. package/_assets/{index-guKU3CxJ.js → index-DY8ZC3eZ.js} +1 -1
  99. package/_assets/{index-8leBJCeh.js → index-DZ_0HpBO.js} +1 -1
  100. package/_assets/{index-Dk3_fBWb.js → index-DZu4-xVf.js} +1 -1
  101. package/_assets/{index-CbIcO1ec.js → index-Dd6JKVr9.js} +1 -1
  102. package/_assets/{index-0jJE5d0L.js → index-Dyfkmcym.js} +3 -3
  103. package/_assets/{index-BGI-2e68.js → index-Gb1PiPiA.js} +3 -3
  104. package/_assets/{index-2TQxLmBs.js → index-HH9YYVaK.js} +1 -1
  105. package/_assets/{index-ptoEedvQ.js → index-IH5Acvug.js} +1 -1
  106. package/_assets/{index-D6GQAd8j.js → index-Qo51btPd.js} +1 -1
  107. package/_assets/{index-ZJkpN3YG.js → index-SLZL1DoR.js} +1 -1
  108. package/_assets/{index-DCuC2lhm.js → index-T2J3uY-Z.js} +2 -2
  109. package/_assets/{index-OS9rZBnH.js → index-WFqqjFcS.js} +1 -1
  110. package/_assets/{index-_fVd2-rJ.js → index-ZLrp5Bhh.js} +63 -63
  111. package/_assets/{index-BEs6O80y.js → index-axEGwhSI.js} +1 -1
  112. package/_assets/{index-CZxfHRQi.js → index-gzgGbBGj.js} +1 -1
  113. package/_assets/{index-Bwu8oQgc.js → index-hDbN63Ln.js} +1 -1
  114. package/_assets/{index-DtSreRq-.js → index-m9ABB7av.js} +1 -1
  115. package/_assets/{index-CjmTcFvk.js → index-uti914D5.js} +1 -1
  116. package/_assets/{index-BZEdbwEF.js → index-zJQqEgUQ.js} +1 -1
  117. package/_assets/{index.es-DjtDkaot.js → index.es-CpdpPZ5k.js} +1 -1
  118. package/_assets/{index.es-C3rZfh2i.js → index.es-D877V0ui.js} +1 -1
  119. package/_assets/{index.es-2SUdwAo-.js → index.es-cnYw8KNm.js} +4 -4
  120. package/_assets/{localBatchGatewayRequest-7F9yj9Kp.js → localBatchGatewayRequest-Cm_Q3xcs.js} +1 -1
  121. package/_assets/{mana-convert-CRzSStq1.js → mana-convert-BD8UMnC-.js} +1 -1
  122. package/_assets/{mana-rate-CXxuEUr3.js → mana-rate-DsLc4315.js} +1 -1
  123. package/_assets/{networks-seNgr9C6.js → networks-BSQfuOw7.js} +1 -1
  124. package/_assets/{onramp-BD02Aw_-.js → onramp-PSISd-iT.js} +1 -1
  125. package/_assets/{openzeppelin-DjgZCG9x.js → openzeppelin-BVepIV31.js} +1 -1
  126. package/_assets/{parseNft-Bqp9HxNV.js → parseNft-DdQmcS_8.js} +2 -2
  127. package/_assets/{parseSignature-CK6OXsXU.js → parseSignature-5g9oB04J.js} +1 -1
  128. package/_assets/{parseSignature-C39sBe7y.js → parseSignature-CtzX7AqF.js} +3 -3
  129. package/_assets/{passkeys-D3WWU4NZ.js → passkeys-tloHjtZY.js} +1 -1
  130. package/_assets/{pay-with-exchange--oAfZYPt.js → pay-with-exchange-DhTTxcu5.js} +1 -1
  131. package/_assets/{qr-overlay-Bb1SoPIE.js → qr-overlay-BvHuZZBy.js} +1 -1
  132. package/_assets/{receive-Bx-lv85a.js → receive-BdMbDZpD.js} +1 -1
  133. package/_assets/{resolveImplementation-DDQIALtX.js → resolveImplementation-CFPs_1ly.js} +1 -1
  134. package/_assets/{rpc-_XgqNXmg.js → rpc-BGNwjJyh.js} +1 -1
  135. package/_assets/{secp256k1-33gXMjxU.js → secp256k1-705CLADe.js} +1 -1
  136. package/_assets/{secp256k1-Dqn1pBnH.js → secp256k1-COhPDJ4u.js} +1 -1
  137. package/_assets/{secp256k1-DxBieGob.js → secp256k1-DZ2SAej-.js} +1 -1
  138. package/_assets/{send-batch-transaction-B1rodPAP.js → send-batch-transaction-DKis0-QF.js} +1 -1
  139. package/_assets/{send-BdKuEmMW.js → send-cMULZVUl.js} +1 -1
  140. package/_assets/{send-eip712-transaction-Cnc6HGzW.js → send-eip712-transaction-VdYRVrqY.js} +2 -2
  141. package/_assets/{send-gasless-transaction-C8XDjST9.js → send-gasless-transaction-D9DvumJW.js} +2 -2
  142. package/_assets/{send-transaction-rYqEwtd1.js → send-transaction-CXK5_GYH.js} +2 -2
  143. package/_assets/{sendMetaTransaction-CzKSbuyF.js → sendMetaTransaction-CQ1T_6-I.js} +1 -1
  144. package/_assets/{sendRawTransaction-BEQyz2Ij.js → sendRawTransaction-DvGIcbqV.js} +3 -3
  145. package/_assets/{serializeTransaction-BbNd3zS0.js → serializeTransaction-DUdNUuM4.js} +1 -1
  146. package/_assets/{session-proposal-8HR90Bge.js → session-proposal-nFRfFF1d.js} +1 -1
  147. package/_assets/{session-request-Dw2FL3ZB.js → session-request-CorlzLX5.js} +2 -2
  148. package/_assets/{signing-B8a-ugsD.js → signing-VlUa-Oq7.js} +3 -3
  149. package/_assets/{socials-RPUjPnGG.js → socials-B5kFlk2f.js} +1 -1
  150. package/_assets/{swaps-BZyLGO9p.js → swaps-Yhyu65X0.js} +1 -1
  151. package/_assets/{thirdweb-Br0vMCgp.js → thirdweb-80s_5RM_.js} +3 -3
  152. package/_assets/{to-serializable-transaction-D9b-OXs-.js → to-serializable-transaction-BvXKdTbz.js} +2 -2
  153. package/_assets/{trade-encoding-C-S0B0xE.js → trade-encoding-BJQNrSRU.js} +1 -1
  154. package/_assets/{transactionReceipt-Es8MO_8r.js → transactionReceipt-D9UoeNG0.js} +1 -1
  155. package/_assets/{transactions-Dw9sF939.js → transactions-BR_gP4fB.js} +1 -1
  156. package/_assets/{useCreditPacks-BYlwZVOz.js → useCreditPacks-Diy15u3Q.js} +1 -1
  157. package/_assets/{useInfiniteGrid-CSjVmw_O.js → useInfiniteGrid-SEfbanDp.js} +1 -1
  158. package/_assets/useManaRate-DNC9BmC1.js +1 -0
  159. package/_assets/{useSecondarySales-CCBc4I5y.js → useSecondarySales-BdMq83Pz.js} +1 -1
  160. package/_assets/{useStore-DrrSGrKX.js → useStore-BC3A7db6.js} +1 -1
  161. package/_assets/{useTheme-VnMTOQwq.js → useTheme-BHUAoIEZ.js} +1 -1
  162. package/_assets/{verifyHash-B6PqXFp0.js → verifyHash-VvjDkBws.js} +1 -1
  163. package/_assets/{w3m-modal-DL64iwDM.js → w3m-modal-CU7ELmQd.js} +1 -1
  164. package/_assets/{w3m-modal-C9OXVHd2.js → w3m-modal-ODQEBY_r.js} +1 -1
  165. package/_assets/{wait-for-tx-receipt-D1F0cTIk.js → wait-for-tx-receipt-DUUNmO1K.js} +1 -1
  166. package/_assets/{wallets-C2VHUJg3.js → wallets-BWg5VZy0.js} +5 -5
  167. package/_assets/{web-connector-DAKw9atq.js → web-connector-B1PoaR_B.js} +3 -3
  168. package/_assets/{writeContract-DJjdFW5w.js → writeContract-Dk_8bpTb.js} +1 -1
  169. package/_assets/{zoraTestnet-BB-b9Y7R.js → zoraTestnet-C94OTMqe.js} +1 -1
  170. package/index.html +11 -11
  171. package/package.json +2 -2
  172. package/_assets/ItemDetail-DrH-bPQt.js +0 -3354
  173. package/_assets/useManaRate-DLKK71oe.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as j,j as e,L as Q,d as dt}from"./react-vyZjIDcS.js";import{aI as lt,s as l,t as o,x as ut,B as ht,m as xt,e as d,n as mt,u as v,I as f,aJ as G,aK as K,aL as pt,z as k,aM as gt,ao as T,H as ft,aN as yt,aO as C}from"./index-_fVd2-rJ.js";import{m as bt}from"./mana-convert-CRzSStq1.js";import{u as jt}from"./useManaRate-DLKK71oe.js";import{L as vt}from"./LoadMore-C0qTp7ND.js";import{u as y}from"./useInfiniteGrid-CSjVmw_O.js";import{m as X}from"./mana-matic-C4e1sNO3.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./mana-rate-CXxuEUr3.js";const kt=15e3;function It(t,n){return t.txHash&&n.txHash?t.txHash===n.txHash:t.txHash||n.txHash?!1:t.status===n.status&&Math.abs(t.createdAt-n.createdAt)<=kt}function At(t){const n=[...t].sort((i,a)=>a.createdAt-i.createdAt),s=[];for(const i of n){const a=s[s.length-1];a&&It(a[a.length-1],i)?a.push(i):s.push([i])}return s.map(i=>{var a;return{id:((a=i.find(c=>c.txHash))==null?void 0:a.txHash)??i[i.length-1].id,createdAt:Math.max(...i.map(c=>c.createdAt)),status:i.some(c=>c.status==="PENDING")?"PENDING":"SETTLED",totalCredits:i.reduce((c,h)=>c+h.credits,0),lines:i}})}function wt(t){return t.tradeId?`trade:${t.tradeId}`:t.contractAddress&&t.itemId?`item:${t.contractAddress.toLowerCase()}:${t.itemId}`:null}function $t(t){const n=[],s=new Map;for(const i of t){const a=wt(i);if(!a){n.push({key:i.id,tradeId:null,contractAddress:i.contractAddress??null,itemId:i.itemId??null,quantity:1,credits:i.credits});continue}const c=s.get(a);if(c){c.quantity+=1,c.credits+=i.credits;continue}const h={key:a,tradeId:i.tradeId,contractAddress:i.contractAddress??null,itemId:i.itemId??null,quantity:1,credits:i.credits};s.set(a,h),n.push(h)}return n}function Pt(t,n){return{id:t.id,contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId,counterparty:t.buyer,credits:n?bt(t.manaWei,n):null,manaWei:t.manaWei,createdAt:t.createdAt,txHash:t.txHash}}function Lt(t){const s=At(t.purchases.filter(r=>r.status!=="EXPIRED")).map(r=>({kind:"purchase",id:`purchase:${r.id}`,createdAt:r.createdAt,order:r})),i=t.sales.map(r=>{const x=Pt(r,t.rate);return{kind:"sale",id:`sale:${x.id}`,createdAt:x.createdAt,sale:x}}),a=(t.creditOrders??[]).filter(r=>r.status!=="failed"&&r.status!=="abandoned").map(r=>({kind:"credit",id:`credit:${r.id}`,createdAt:r.createdAt,order:r})),c=new Set(t.purchases.filter(r=>r.txHash).map(r=>r.txHash.toLowerCase())),h=(t.manaPurchases??[]).filter(r=>!c.has(r.txHash.toLowerCase())).map(r=>({kind:"mana-purchase",id:`mana-purchase:${r.id}`,createdAt:r.createdAt,sale:r}));return[...s,...i,...a,...h].sort((r,x)=>x.createdAt-r.createdAt||(r.id<x.id?-1:1))}function Nt(t,n){return n==="all"?t:n==="sales"?t.filter(s=>s.kind==="sale"):t.filter(s=>s.kind==="purchase"||s.kind==="credit"||s.kind==="mana-purchase")}const J=t=>t.trim().toLowerCase();function Et(t){const n=new Map;for(const s of t??[]){const i=J(s.txHash??"");if(!i)continue;const a=n.get(i);a?a.push(s):n.set(i,[s])}return n}function Tt(t,n,s=Date.now()){const i=n.txHash?t.get(J(n.txHash)):void 0;if(!i||i.length===0)return{kind:"direct"};const a=i.length===1?Ct(i[0].netCents):null,c=i.filter(r=>!r.available&&r.availableAt>s);if(c.length===0)return{kind:"credited",credits:a};const h=c.reduce((r,x)=>Math.max(r,x.availableAt),0);return{kind:"pending",credits:a,availableAt:h}}function Ct(t){return lt(t)}const Ft="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830629458.commit-f262460/_assets/credits-product-vs4Q6u6l.svg",F=ut`
1
+ import{r as j,j as e,L as Q,d as dt}from"./react-vyZjIDcS.js";import{aI as lt,s as l,t as o,x as ut,B as ht,m as xt,e as d,n as mt,u as v,I as f,aJ as G,aK as K,aL as pt,z as k,aM as gt,ao as T,H as ft,aN as yt,aO as C}from"./index-ZLrp5Bhh.js";import{m as bt}from"./mana-convert-BD8UMnC-.js";import{u as jt}from"./useManaRate-DNC9BmC1.js";import{L as vt}from"./LoadMore-8od0F5L9.js";import{u as y}from"./useInfiniteGrid-SEfbanDp.js";import{m as X}from"./mana-matic-C4e1sNO3.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./mana-rate-DsLc4315.js";const kt=15e3;function It(t,n){return t.txHash&&n.txHash?t.txHash===n.txHash:t.txHash||n.txHash?!1:t.status===n.status&&Math.abs(t.createdAt-n.createdAt)<=kt}function At(t){const n=[...t].sort((i,a)=>a.createdAt-i.createdAt),s=[];for(const i of n){const a=s[s.length-1];a&&It(a[a.length-1],i)?a.push(i):s.push([i])}return s.map(i=>{var a;return{id:((a=i.find(c=>c.txHash))==null?void 0:a.txHash)??i[i.length-1].id,createdAt:Math.max(...i.map(c=>c.createdAt)),status:i.some(c=>c.status==="PENDING")?"PENDING":"SETTLED",totalCredits:i.reduce((c,h)=>c+h.credits,0),lines:i}})}function wt(t){return t.tradeId?`trade:${t.tradeId}`:t.contractAddress&&t.itemId?`item:${t.contractAddress.toLowerCase()}:${t.itemId}`:null}function $t(t){const n=[],s=new Map;for(const i of t){const a=wt(i);if(!a){n.push({key:i.id,tradeId:null,contractAddress:i.contractAddress??null,itemId:i.itemId??null,quantity:1,credits:i.credits});continue}const c=s.get(a);if(c){c.quantity+=1,c.credits+=i.credits;continue}const h={key:a,tradeId:i.tradeId,contractAddress:i.contractAddress??null,itemId:i.itemId??null,quantity:1,credits:i.credits};s.set(a,h),n.push(h)}return n}function Pt(t,n){return{id:t.id,contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId,counterparty:t.buyer,credits:n?bt(t.manaWei,n):null,manaWei:t.manaWei,createdAt:t.createdAt,txHash:t.txHash}}function Lt(t){const s=At(t.purchases.filter(r=>r.status!=="EXPIRED")).map(r=>({kind:"purchase",id:`purchase:${r.id}`,createdAt:r.createdAt,order:r})),i=t.sales.map(r=>{const x=Pt(r,t.rate);return{kind:"sale",id:`sale:${x.id}`,createdAt:x.createdAt,sale:x}}),a=(t.creditOrders??[]).filter(r=>r.status!=="failed"&&r.status!=="abandoned").map(r=>({kind:"credit",id:`credit:${r.id}`,createdAt:r.createdAt,order:r})),c=new Set(t.purchases.filter(r=>r.txHash).map(r=>r.txHash.toLowerCase())),h=(t.manaPurchases??[]).filter(r=>!c.has(r.txHash.toLowerCase())).map(r=>({kind:"mana-purchase",id:`mana-purchase:${r.id}`,createdAt:r.createdAt,sale:r}));return[...s,...i,...a,...h].sort((r,x)=>x.createdAt-r.createdAt||(r.id<x.id?-1:1))}function Nt(t,n){return n==="all"?t:n==="sales"?t.filter(s=>s.kind==="sale"):t.filter(s=>s.kind==="purchase"||s.kind==="credit"||s.kind==="mana-purchase")}const J=t=>t.trim().toLowerCase();function Et(t){const n=new Map;for(const s of t??[]){const i=J(s.txHash??"");if(!i)continue;const a=n.get(i);a?a.push(s):n.set(i,[s])}return n}function Tt(t,n,s=Date.now()){const i=n.txHash?t.get(J(n.txHash)):void 0;if(!i||i.length===0)return{kind:"direct"};const a=i.length===1?Ct(i[0].netCents):null,c=i.filter(r=>!r.available&&r.availableAt>s);if(c.length===0)return{kind:"credited",credits:a};const h=c.reduce((r,x)=>Math.max(r,x.availableAt),0);return{kind:"pending",credits:a,availableAt:h}}function Ct(t){return lt(t)}const Ft="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830708286.commit-6900e32/_assets/credits-product-vs4Q6u6l.svg",F=ut`
2
2
  0% { background-position: 200% 0; }
3
3
  100% { background-position: -200% 0; }
4
4
  `,St=l.section`
@@ -1,4 +1,4 @@
1
- import{r as l,j as v}from"./react-vyZjIDcS.js";import{s as u}from"./index-_fVd2-rJ.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";const S="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830629458.commit-f262460/_assets/custom-welcome-background-BxlFQma9.webp",b="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830629458.commit-f262460/_assets/DCL_LogoPattern-BryBPc3d.png",U=`
1
+ import{r as l,j as v}from"./react-vyZjIDcS.js";import{s as u}from"./index-ZLrp5Bhh.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";const S="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830708286.commit-6900e32/_assets/custom-welcome-background-BxlFQma9.webp",b="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830708286.commit-6900e32/_assets/DCL_LogoPattern-BryBPc3d.png",U=`
2
2
  attribute vec2 a_position;
3
3
  varying vec2 v_uv;
4
4
  void main() {
@@ -1,4 +1,4 @@
1
- import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,au as Ze,av as Ke,d as Je,s as n,t,n as Ie,ak as Qe,D as Xe,H as Ae,y as Ye,e as s,I as _,z as W,aR as he,ai as et,aq as J,ay as tt,ax as nt,m as Ne,o as st,S as fe,A as O,aS as ot,aT as it}from"./index-_fVd2-rJ.js";import{u as rt}from"./useSecondarySales-CCBc4I5y.js";import{a as at,m as Me}from"./mana-convert-CRzSStq1.js";import{u as Pe}from"./useManaRate-DLKK71oe.js";import{g as lt,h as ct,i as dt,j as pt,k as xt,C as ht,l as ft,o as mt,m as ut,n as gt,M as bt,p as yt,E as wt,q as jt,r as vt,s as $t,t as Ct,u as kt,v as St}from"./Assets.styles-Dmr7Nx8g.js";import{c as me,R as Et,F as _t,S as Rt}from"./categories-D_mk1mr7.js";import{L as Tt}from"./LoadMore-C0qTp7ND.js";import{u as zt}from"./useInfiniteGrid-CSjVmw_O.js";import{E as It}from"./ErrorNotice-DrZAUSEy.js";import{d as At}from"./dcl-schemas-BICTSpB5.js";import{s as Nt,G as Mt,w as Pt,S as Wt}from"./buy-gasless-DQdl_Uxy.js";import{s as Bt}from"./buy-Cva9EYX4.js";import{i as Ft}from"./trade-encoding-C-S0B0xE.js";import{r as Lt}from"./mana-rate-CXxuEUr3.js";import{f as Ht}from"./errors-DO4IpB78.js";import{J as Ut,C as Ot,B as ee}from"./ethers-CXBJm_wN.js";import{n as Dt}from"./Tooltip-Bp91aI0Y.js";import{G as Gt}from"./grid.styles-HC96xAOy.js";import"./sentry-B35L1FdR.js";import"./intl-CBcMB1D2.js";import"./authorizations-CyYFEcSa.js";import"./sendMetaTransaction-CzKSbuyF.js";function D(o){const i=o.source??"item",l=o.tradeId||`${o.contractAddress}-${o.tokenId??o.itemId??""}`;return`${i}:${l}`}const F="100000000000000000000",We=2,Q=15,qt=/^[a-zA-Z0-9]+$/;function ue(o){const i=o.trim();return i.length===0?{ok:!1,reason:"empty"}:qt.test(i)?i.length<We?{ok:!1,reason:"too-short"}:i.length>Q?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Vt(o){return o.replace(/[^a-zA-Z0-9]/g,"").slice(0,Q)}const Zt=["function available(string _subdomain) view returns (bool)"],ge={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Kt(){return B.chainId===Number(At.ChainId.MATIC_MAINNET)?ge.mainnet:ge.sepolia}async function Jt(o,i={}){var p;const{rpc:l,address:x}=Kt(),c=new Ut(l),d=new Ot(x,Zt,c);console.info(`[names] availability check → DCLRegistrar(${x}).available("${o}") on ${l}`);const h=await d.available(o);if((p=i.signal)!=null&&p.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${o}" available=${h}`),h?"available":"taken"}const Qt="https://app.across.to/api";class Be extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function Xt(o){return at(F,o)}async function Yt(o,i,l={}){var p;const x=l.chainId??B.chainId,c=l.provider??"across",d=`${B.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(i)}&chainId=${x}&provider=${c}`,h=await Je(d,{method:"GET",identity:o,metadata:{}});if(!h.ok){let a;try{a=(p=await h.json())==null?void 0:p.code}catch{}throw a==="ROUTE_COST_TOO_HIGH"?new Be:new Error(`fetchNameCreditRoute ${h.status}`)}return h.json()}function en(o,i){const l=ee.from(o.availableAmount),c=ee.from(F).sub(l);return{credits:[{value:o.amount,expiresAt:Number(o.expiresAt),salt:Ft(o.id)}],creditsSignatures:[o.signature],externalCall:{target:i.externalCall.target,selector:i.externalCall.selector,data:i.externalCall.data,expiresAt:i.externalCall.expiresAt,salt:i.externalCall.salt},customExternalCallSignature:i.customExternalCallSignature,maxUncreditedValue:c.isNegative()?"0":c.toString(),maxCreditedValue:F}}async function tn(o,i={}){const l=Qt,x=i.intervalMs??1e4,c=i.maxAttempts??60;let d={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let h=0;h<c;h++){try{const p=await fetch(`${l}/deposit/status?originChainId=137&depositTxHash=${o}`);if(p.ok){const a=await p.json(),u=(a.status??"pending").toLowerCase(),b=a.fillTx??a.fillTxnRef??null,w=a.actionsSucceeded!==!1;if(u==="filled")return{status:"filled",destinationTxHash:b,actionsSucceeded:w};if(u==="refunded"||u==="expired")return{status:u,destinationTxHash:null,actionsSucceeded:!1};d={status:"pending",destinationTxHash:b,actionsSucceeded:w}}}catch{}h<c-1&&await new Promise(p=>setTimeout(p,x))}return d}async function nn(o){const{name:i,identity:l,signer:x}=o,c=o.chainId??B.chainId,d=o.provider??"across",h=(o.beneficiary??await x.getAddress()).toLowerCase();let p=null,a=!1;console.info("[names] register start",{name:i,buyer:h,chainId:c,provider:d});try{const u=await Lt(c),b=Xt(u);console.info("[names] step 1/6 sized reservation",{usdCents:b,manaRate:u});const w=await Yt(l,i,{chainId:c,provider:d});console.info("[names] step 2/6 route fetched",{target:w.externalCall.target,selector:w.externalCall.selector,provider:w.provider,quoteId:w.quoteId});const j=await Ze(l,b);if(p=j.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:j.credit.id,maxCreditedValue:j.maxCreditedValue}),ee.from(j.maxCreditedValue).lt(F))throw new Error("Credit under-sized for the name price");const $=en(j.credit,w);let f;try{f=await Nt({chainId:c,buyer:h,signer:x,args:$})}catch(y){if(!(y instanceof Mt))throw y;f=await Bt(c,$,x)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:f}),await Pt(f),a=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:f}),d==="across"){const y=await tn(f,o.acrossPoll);if(console.info("[names] step 6/6 across status",y),y.status==="pending")return{status:"pending",originTxHash:f};if(y.status!=="filled"||!y.actionsSucceeded)throw new Error("The name could not be registered on Ethereum; your funds were recovered.");return{status:"registered",originTxHash:f,destinationTxHash:y.destinationTxHash}}return{status:"pending",originTxHash:f}}catch(u){if(console.error("[names] register failed — raw error:",u,{name:i,buyer:h,originConfirmed:a}),u instanceof Wt)return{status:"pending",originTxHash:u.txHash};if(p&&!a&&await Ke(l,[p]).catch(()=>{}),u instanceof Be)throw u;const b=new Error(Ht(u,"Couldn't register the name. Please try again.",{sale:!0}));throw b.cause=u,b}}const sn=n.div`
1
+ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,au as Ze,av as Ke,d as Je,s as n,t,n as Ie,ak as Qe,D as Xe,H as Ae,y as Ye,e as s,I as _,z as W,aR as he,ai as et,aq as J,ay as tt,ax as nt,m as Ne,o as st,S as fe,A as O,aS as ot,aT as it}from"./index-ZLrp5Bhh.js";import{u as rt}from"./useSecondarySales-BdMq83Pz.js";import{a as at,m as Me}from"./mana-convert-BD8UMnC-.js";import{u as Pe}from"./useManaRate-DNC9BmC1.js";import{g as lt,h as ct,i as dt,j as pt,k as xt,C as ht,l as ft,o as mt,m as ut,n as gt,M as bt,p as yt,E as wt,q as jt,r as vt,s as $t,t as Ct,u as kt,v as St}from"./Assets.styles-BJpp2Oe0.js";import{c as me,R as Et,F as _t,S as Rt}from"./categories-wrk9ttY6.js";import{L as Tt}from"./LoadMore-8od0F5L9.js";import{u as zt}from"./useInfiniteGrid-SEfbanDp.js";import{E as It}from"./ErrorNotice-FoLpDD1-.js";import{d as At}from"./dcl-schemas-BICTSpB5.js";import{s as Nt,G as Mt,w as Pt,S as Wt}from"./buy-gasless-B2L69ya6.js";import{s as Bt}from"./buy-CFAg0mL8.js";import{i as Ft}from"./trade-encoding-BJQNrSRU.js";import{r as Lt}from"./mana-rate-DsLc4315.js";import{f as Ht}from"./errors-CPDOUeQU.js";import{J as Ut,C as Ot,B as ee}from"./ethers-CXBJm_wN.js";import{n as Dt}from"./Tooltip-Dy87pXpy.js";import{G as Gt}from"./grid.styles-D-gTOGBC.js";import"./sentry-B35L1FdR.js";import"./intl-CBcMB1D2.js";import"./authorizations-E8_0NGng.js";import"./sendMetaTransaction-CQ1T_6-I.js";function D(o){const i=o.source??"item",l=o.tradeId||`${o.contractAddress}-${o.tokenId??o.itemId??""}`;return`${i}:${l}`}const F="100000000000000000000",We=2,Q=15,qt=/^[a-zA-Z0-9]+$/;function ue(o){const i=o.trim();return i.length===0?{ok:!1,reason:"empty"}:qt.test(i)?i.length<We?{ok:!1,reason:"too-short"}:i.length>Q?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Vt(o){return o.replace(/[^a-zA-Z0-9]/g,"").slice(0,Q)}const Zt=["function available(string _subdomain) view returns (bool)"],ge={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Kt(){return B.chainId===Number(At.ChainId.MATIC_MAINNET)?ge.mainnet:ge.sepolia}async function Jt(o,i={}){var p;const{rpc:l,address:x}=Kt(),c=new Ut(l),d=new Ot(x,Zt,c);console.info(`[names] availability check → DCLRegistrar(${x}).available("${o}") on ${l}`);const h=await d.available(o);if((p=i.signal)!=null&&p.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${o}" available=${h}`),h?"available":"taken"}const Qt="https://app.across.to/api";class Be extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function Xt(o){return at(F,o)}async function Yt(o,i,l={}){var p;const x=l.chainId??B.chainId,c=l.provider??"across",d=`${B.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(i)}&chainId=${x}&provider=${c}`,h=await Je(d,{method:"GET",identity:o,metadata:{}});if(!h.ok){let a;try{a=(p=await h.json())==null?void 0:p.code}catch{}throw a==="ROUTE_COST_TOO_HIGH"?new Be:new Error(`fetchNameCreditRoute ${h.status}`)}return h.json()}function en(o,i){const l=ee.from(o.availableAmount),c=ee.from(F).sub(l);return{credits:[{value:o.amount,expiresAt:Number(o.expiresAt),salt:Ft(o.id)}],creditsSignatures:[o.signature],externalCall:{target:i.externalCall.target,selector:i.externalCall.selector,data:i.externalCall.data,expiresAt:i.externalCall.expiresAt,salt:i.externalCall.salt},customExternalCallSignature:i.customExternalCallSignature,maxUncreditedValue:c.isNegative()?"0":c.toString(),maxCreditedValue:F}}async function tn(o,i={}){const l=Qt,x=i.intervalMs??1e4,c=i.maxAttempts??60;let d={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let h=0;h<c;h++){try{const p=await fetch(`${l}/deposit/status?originChainId=137&depositTxHash=${o}`);if(p.ok){const a=await p.json(),u=(a.status??"pending").toLowerCase(),b=a.fillTx??a.fillTxnRef??null,w=a.actionsSucceeded!==!1;if(u==="filled")return{status:"filled",destinationTxHash:b,actionsSucceeded:w};if(u==="refunded"||u==="expired")return{status:u,destinationTxHash:null,actionsSucceeded:!1};d={status:"pending",destinationTxHash:b,actionsSucceeded:w}}}catch{}h<c-1&&await new Promise(p=>setTimeout(p,x))}return d}async function nn(o){const{name:i,identity:l,signer:x}=o,c=o.chainId??B.chainId,d=o.provider??"across",h=(o.beneficiary??await x.getAddress()).toLowerCase();let p=null,a=!1;console.info("[names] register start",{name:i,buyer:h,chainId:c,provider:d});try{const u=await Lt(c),b=Xt(u);console.info("[names] step 1/6 sized reservation",{usdCents:b,manaRate:u});const w=await Yt(l,i,{chainId:c,provider:d});console.info("[names] step 2/6 route fetched",{target:w.externalCall.target,selector:w.externalCall.selector,provider:w.provider,quoteId:w.quoteId});const j=await Ze(l,b);if(p=j.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:j.credit.id,maxCreditedValue:j.maxCreditedValue}),ee.from(j.maxCreditedValue).lt(F))throw new Error("Credit under-sized for the name price");const $=en(j.credit,w);let f;try{f=await Nt({chainId:c,buyer:h,signer:x,args:$})}catch(y){if(!(y instanceof Mt))throw y;f=await Bt(c,$,x)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:f}),await Pt(f),a=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:f}),d==="across"){const y=await tn(f,o.acrossPoll);if(console.info("[names] step 6/6 across status",y),y.status==="pending")return{status:"pending",originTxHash:f};if(y.status!=="filled"||!y.actionsSucceeded)throw new Error("The name could not be registered on Ethereum; your funds were recovered.");return{status:"registered",originTxHash:f,destinationTxHash:y.destinationTxHash}}return{status:"pending",originTxHash:f}}catch(u){if(console.error("[names] register failed — raw error:",u,{name:i,buyer:h,originConfirmed:a}),u instanceof Wt)return{status:"pending",originTxHash:u.txHash};if(p&&!a&&await Ke(l,[p]).catch(()=>{}),u instanceof Be)throw u;const b=new Error(Ht(u,"Couldn't register the name. Please try again.",{sale:!0}));throw b.cause=u,b}}const sn=n.div`
2
2
  position: fixed;
3
3
  inset: 0;
4
4
  z-index: 10000;
@@ -366,7 +366,7 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,au
366
366
  flex: none;
367
367
  color: ${t.colors.dclRed};
368
368
  }
369
- `;function Sn({name:o,priceCredits:i,onClose:l}){const{session:x}=Ie(),{data:c,isError:d}=Qe(x),h=Xe(),p=ze(),[a,u]=m.useState("confirm"),[b,w]=m.useState(""),[j,$]=m.useState(null),f=m.useRef(!1),y=b.trim().toLowerCase()===o.toLowerCase(),v=a==="completing",k=i!=null?Ae(i):"—";m.useEffect(()=>{const g=R=>{R.key==="Escape"&&!v&&l()};document.addEventListener("keydown",g);const I=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",g),document.body.style.overflow=I}},[v,l]);async function C(){if(!(!x||!y||f.current)){f.current=!0,u("completing"),$(null);try{await nn({name:o,identity:x.identity,signer:x.signer}),J("Shop Completed Purchase",{purchase_type:"name",is_primary:!0,payment_type:"credits",value_credits:i??null}),h.invalidateQueries({queryKey:["usd-balance"]}),h.invalidateQueries({queryKey:["my-assets"]}),u("success")}catch(g){J(nt(g)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:tt(g),purchase_type:"name"}),$((g==null?void 0:g.message)||s("names.errorGeneric")),u("error")}finally{f.current=!1}}}const z=a!=="success",E=Ye(x==null?void 0:x.providerType);return e.jsx(sn,{onClick:v?void 0:l,role:"presentation",children:e.jsxs(on,{role:"dialog","aria-modal":"true","aria-label":s("names.buyTitle"),onClick:g=>g.stopPropagation(),children:[z&&e.jsxs(e.Fragment,{children:[e.jsxs(be,{children:[e.jsx(ye,{children:a==="error"?s("names.errorTitle"):s("names.buyTitle")}),e.jsx(we,{onClick:l,disabled:v,"aria-label":s("buyModal.close"),children:e.jsx(_,{name:"close"})})]}),e.jsxs(je,{children:[s("names.myCreditsBalance")," ",e.jsx(W,{})," ",he(c,d)]}),e.jsx(ve,{})]}),(a==="confirm"||a==="error")&&e.jsxs(e.Fragment,{children:[e.jsxs($e,{children:[e.jsx(Ce,{"aria-hidden":!0,children:"@"}),e.jsxs(ke,{children:[e.jsxs(Se,{children:[o,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ee,{children:s("names.subtitle")})]}),e.jsxs(_e,{children:[e.jsx(W,{}),k]})]}),a==="error"?e.jsxs(e.Fragment,{children:[e.jsxs(kn,{children:[e.jsx(_,{name:"info","aria-hidden":!0}),e.jsx("span",{children:j})]}),e.jsx(Re,{onClick:()=>u("confirm"),children:s("names.tryAgain")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(rn,{children:[e.jsx(an,{children:s("names.confirmTitle")}),e.jsx(ln,{dangerouslySetInnerHTML:{__html:s("names.confirmBody",{name:`<b>@${En(o)}</b>`})}}),e.jsxs(cn,{children:[e.jsx(dn,{"aria-hidden":!0,children:"@"}),e.jsx(pn,{value:b,onChange:g=>w(g.target.value.replace(/[^a-zA-Z0-9]/g,"")),placeholder:"yourname","aria-label":s("names.reenterAria"),autoComplete:"off",spellCheck:!1,style:{width:`${Math.max(b.length,8)}ch`}}),e.jsx(xn,{children:".dcl.eth"})]})]}),e.jsx(Re,{onClick:()=>void C(),disabled:!y||!x,children:s("names.buyCta")})]})]}),a==="completing"&&e.jsxs(hn,{children:[e.jsx(fn,{src:et,alt:"",width:56,height:56}),e.jsx(mn,{children:E?s("names.confirming"):s("names.completing")}),e.jsxs(un,{children:[e.jsx(gn,{"aria-hidden":!0,children:e.jsx("span",{})}),e.jsx(bn,{children:"1/1"})]})]}),a==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs(be,{children:[e.jsx(ye,{children:s("names.successHeaderTitle")}),e.jsx(we,{onClick:l,"aria-label":s("buyModal.close"),children:e.jsx(_,{name:"close"})})]}),e.jsxs(je,{children:[s("names.myCreditsBalance")," ",e.jsx(W,{})," ",he(c,d)]}),e.jsx(ve,{}),e.jsxs(yn,{children:[e.jsx(wn,{"aria-hidden":!0,children:e.jsx(_,{name:"check"})}),e.jsxs(jn,{children:[e.jsx("b",{children:s("names.successBannerBold")})," ",s("names.successBannerRest")]})]}),e.jsxs($e,{style:{marginTop:20},children:[e.jsx(Ce,{"aria-hidden":!0,children:"@"}),e.jsxs(ke,{children:[e.jsxs(Se,{children:[o,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ee,{children:s("names.subtitle")})]}),e.jsxs(_e,{children:[e.jsx(W,{}),k]})]}),e.jsxs(vn,{children:[e.jsx($n,{onClick:()=>{l(),p("/my-assets")},children:s("names.myItems")}),e.jsx(Cn,{href:B.profileUrl,target:"_blank",rel:"noopener noreferrer",children:s("names.assignToAvatar")})]})]})]})})}function En(o){return o.replace(/[&<>"']/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[i])}const _n="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830629458.commit-f262460/_assets/identity-B4DXDuJP.webp",Rn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830629458.commit-f262460/_assets/world-B-9aPlxu.webp",Tn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830629458.commit-f262460/_assets/invite-BfwIhP2C.webp",zn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830629458.commit-f262460/_assets/governance-DnazlIjy.webp",In=n.div`
369
+ `;function Sn({name:o,priceCredits:i,onClose:l}){const{session:x}=Ie(),{data:c,isError:d}=Qe(x),h=Xe(),p=ze(),[a,u]=m.useState("confirm"),[b,w]=m.useState(""),[j,$]=m.useState(null),f=m.useRef(!1),y=b.trim().toLowerCase()===o.toLowerCase(),v=a==="completing",k=i!=null?Ae(i):"—";m.useEffect(()=>{const g=R=>{R.key==="Escape"&&!v&&l()};document.addEventListener("keydown",g);const I=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",g),document.body.style.overflow=I}},[v,l]);async function C(){if(!(!x||!y||f.current)){f.current=!0,u("completing"),$(null);try{await nn({name:o,identity:x.identity,signer:x.signer}),J("Shop Completed Purchase",{purchase_type:"name",is_primary:!0,payment_type:"credits",value_credits:i??null}),h.invalidateQueries({queryKey:["usd-balance"]}),h.invalidateQueries({queryKey:["my-assets"]}),u("success")}catch(g){J(nt(g)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:tt(g),purchase_type:"name"}),$((g==null?void 0:g.message)||s("names.errorGeneric")),u("error")}finally{f.current=!1}}}const z=a!=="success",E=Ye(x==null?void 0:x.providerType);return e.jsx(sn,{onClick:v?void 0:l,role:"presentation",children:e.jsxs(on,{role:"dialog","aria-modal":"true","aria-label":s("names.buyTitle"),onClick:g=>g.stopPropagation(),children:[z&&e.jsxs(e.Fragment,{children:[e.jsxs(be,{children:[e.jsx(ye,{children:a==="error"?s("names.errorTitle"):s("names.buyTitle")}),e.jsx(we,{onClick:l,disabled:v,"aria-label":s("buyModal.close"),children:e.jsx(_,{name:"close"})})]}),e.jsxs(je,{children:[s("names.myCreditsBalance")," ",e.jsx(W,{})," ",he(c,d)]}),e.jsx(ve,{})]}),(a==="confirm"||a==="error")&&e.jsxs(e.Fragment,{children:[e.jsxs($e,{children:[e.jsx(Ce,{"aria-hidden":!0,children:"@"}),e.jsxs(ke,{children:[e.jsxs(Se,{children:[o,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ee,{children:s("names.subtitle")})]}),e.jsxs(_e,{children:[e.jsx(W,{}),k]})]}),a==="error"?e.jsxs(e.Fragment,{children:[e.jsxs(kn,{children:[e.jsx(_,{name:"info","aria-hidden":!0}),e.jsx("span",{children:j})]}),e.jsx(Re,{onClick:()=>u("confirm"),children:s("names.tryAgain")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(rn,{children:[e.jsx(an,{children:s("names.confirmTitle")}),e.jsx(ln,{dangerouslySetInnerHTML:{__html:s("names.confirmBody",{name:`<b>@${En(o)}</b>`})}}),e.jsxs(cn,{children:[e.jsx(dn,{"aria-hidden":!0,children:"@"}),e.jsx(pn,{value:b,onChange:g=>w(g.target.value.replace(/[^a-zA-Z0-9]/g,"")),placeholder:"yourname","aria-label":s("names.reenterAria"),autoComplete:"off",spellCheck:!1,style:{width:`${Math.max(b.length,8)}ch`}}),e.jsx(xn,{children:".dcl.eth"})]})]}),e.jsx(Re,{onClick:()=>void C(),disabled:!y||!x,children:s("names.buyCta")})]})]}),a==="completing"&&e.jsxs(hn,{children:[e.jsx(fn,{src:et,alt:"",width:56,height:56}),e.jsx(mn,{children:E?s("names.confirming"):s("names.completing")}),e.jsxs(un,{children:[e.jsx(gn,{"aria-hidden":!0,children:e.jsx("span",{})}),e.jsx(bn,{children:"1/1"})]})]}),a==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs(be,{children:[e.jsx(ye,{children:s("names.successHeaderTitle")}),e.jsx(we,{onClick:l,"aria-label":s("buyModal.close"),children:e.jsx(_,{name:"close"})})]}),e.jsxs(je,{children:[s("names.myCreditsBalance")," ",e.jsx(W,{})," ",he(c,d)]}),e.jsx(ve,{}),e.jsxs(yn,{children:[e.jsx(wn,{"aria-hidden":!0,children:e.jsx(_,{name:"check"})}),e.jsxs(jn,{children:[e.jsx("b",{children:s("names.successBannerBold")})," ",s("names.successBannerRest")]})]}),e.jsxs($e,{style:{marginTop:20},children:[e.jsx(Ce,{"aria-hidden":!0,children:"@"}),e.jsxs(ke,{children:[e.jsxs(Se,{children:[o,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ee,{children:s("names.subtitle")})]}),e.jsxs(_e,{children:[e.jsx(W,{}),k]})]}),e.jsxs(vn,{children:[e.jsx($n,{onClick:()=>{l(),p("/my-assets")},children:s("names.myItems")}),e.jsx(Cn,{href:B.profileUrl,target:"_blank",rel:"noopener noreferrer",children:s("names.assignToAvatar")})]})]})]})})}function En(o){return o.replace(/[&<>"']/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[i])}const _n="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830708286.commit-6900e32/_assets/identity-B4DXDuJP.webp",Rn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830708286.commit-6900e32/_assets/world-B-9aPlxu.webp",Tn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830708286.commit-6900e32/_assets/invite-BfwIhP2C.webp",zn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830708286.commit-6900e32/_assets/governance-DnazlIjy.webp",In=n.div`
370
370
  width: 100%;
371
371
  min-width: 0;
372
372
  `,An=n.nav`
@@ -1,4 +1,4 @@
1
- import{r as $,j as t}from"./react-vyZjIDcS.js";import{R as C,a as oe,C as ie,b as ne}from"./categories-D_mk1mr7.js";import{n as c,T as se}from"./Tooltip-Bp91aI0Y.js";import{t as e,s as o,I as g,e as s,o as ae,h as v}from"./index-_fVd2-rJ.js";const re=o.div`
1
+ import{r as $,j as t}from"./react-vyZjIDcS.js";import{R as C,a as oe,C as ie,b as ne}from"./categories-wrk9ttY6.js";import{n as c,T as se}from"./Tooltip-Dy87pXpy.js";import{t as e,s as o,I as g,e as s,o as ae,h as v}from"./index-ZLrp5Bhh.js";const re=o.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 12px;
@@ -1,4 +1,4 @@
1
- import{j as t,L as R,r as M}from"./react-vyZjIDcS.js";import{s as a,B as N,t as o,x as I,m as B,e,n as F,y as W,I as f,z as G,u as w,D as K,c as P,E as k,l as Q,q as $}from"./index-_fVd2-rJ.js";import{a as H,b as O,c as _,d as X,s as J,f as U}from"./authorizations-CyYFEcSa.js";import{a as V}from"./builder-DmX3M212.js";import{m as Y}from"./mana-matic-C4e1sNO3.js";import{f as Z}from"./errors-DO4IpB78.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-CzKSbuyF.js";const tt=I`
1
+ import{j as t,L as R,r as M}from"./react-vyZjIDcS.js";import{s as a,B as N,t as o,x as I,m as B,e,n as F,y as W,I as f,z as G,u as w,D as K,c as P,E as k,l as Q,q as $}from"./index-ZLrp5Bhh.js";import{a as H,b as O,c as _,d as X,s as J,f as U}from"./authorizations-E8_0NGng.js";import{a as V}from"./builder-CSTbRG1g.js";import{m as Y}from"./mana-matic-C4e1sNO3.js";import{f as Z}from"./errors-CPDOUeQU.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-CQ1T_6-I.js";const tt=I`
2
2
  to { transform: rotate(360deg); }
3
3
  `,it=I`
4
4
  to { background-position: -200% 0; }
@@ -1,4 +1,4 @@
1
- import{j as e,L as Se,r as P,b as ea,a as ta}from"./react-vyZjIDcS.js";import{t as le,s as i,e as s,H as de,ai as aa,F as sa,I as H,z as Mt,G as Ue,m as na,aj as Q,P as dt,n as ia,u as ra,ak as oa,D as ca,al as da,am as la,an as ua,ao as ha,y as pa,ap as lt,aq as G,ar as ut,as as ga,l as ae,c as ht,at as xa,h as ma,au as pt,av as _e,aw as ye,ax as be,ay as gt,a as ve,b as fa,C as We,az as ya}from"./index-_fVd2-rJ.js";import{M as ba,S as va,C as wa,H as Ca,a as ja,T as ka,X as $a,b as Sa,B as Ma,c as Ta,d as xt,e as Ia,f as ke,P as Tt,m as Pa,g as za,h as Aa,i as Ea,j as It,k as $e,L as qa,l as Ba,n as mt,o as ft,W as Ra,p as _a,q as Wa,A as Fa,r as La,s as Ka,t as Na,u as Ua,v as Qa,w as Ha,x as Oa,y as Va,z as Ga,D as Da,E as Ya,F as Ja,G as Xa,I as Za,J as es,K as Fe,N as ts,O as as,Q as ss,R as ns,U as yt,V as bt,Y as is,Z as rs,_ as os}from"./CollectionCarousel-CQfEMkUH.js";import{u as cs}from"./useManaRate-DLKK71oe.js";import{r as ds}from"./mana-rate-CXxuEUr3.js";import{i as ls,j as us,f as hs,n as ps,h as gs,A as xs}from"./authorizations-CyYFEcSa.js";import{g as ms,b as Le}from"./buy-Cva9EYX4.js";import{b as fs,w as ys,S as vt,G as bs}from"./buy-gasless-DQdl_Uxy.js";import{u as vs,M as ws,R as we,r as Cs,c as js,p as wt}from"./useCreditPacks-BYlwZVOz.js";import{i as ks,a as $s}from"./errors-DO4IpB78.js";import{E as Ss}from"./ErrorNotice-DrZAUSEy.js";import{u as Ct}from"./mana-convert-CRzSStq1.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-C-S0B0xE.js";import"./sendMetaTransaction-CzKSbuyF.js";const{colors:se,radius:Ms}=le,Ts=i.div`
1
+ import{j as e,L as Se,r as P,b as ea,a as ta}from"./react-vyZjIDcS.js";import{t as le,s as i,e as s,H as de,ai as aa,F as sa,I as H,z as Mt,G as Ue,m as na,aj as Q,P as dt,n as ia,u as ra,ak as oa,D as ca,al as da,am as la,an as ua,ao as ha,y as pa,ap as lt,aq as G,ar as ut,as as ga,l as ae,c as ht,at as xa,h as ma,au as pt,av as _e,aw as ye,ax as be,ay as gt,a as ve,b as fa,C as We,az as ya}from"./index-ZLrp5Bhh.js";import{M as ba,S as va,C as wa,H as Ca,a as ja,T as ka,X as $a,b as Sa,B as Ma,c as Ta,d as xt,e as Ia,f as ke,P as Tt,m as Pa,g as za,h as Aa,i as Ea,j as It,k as $e,L as qa,l as Ba,n as mt,o as ft,W as Ra,p as _a,q as Wa,A as Fa,r as La,s as Ka,t as Na,u as Ua,v as Qa,w as Ha,x as Oa,y as Va,z as Ga,D as Da,E as Ya,F as Ja,G as Xa,I as Za,J as es,K as Fe,N as ts,O as as,Q as ss,R as ns,U as yt,V as bt,Y as is,Z as rs,_ as os}from"./CollectionCarousel-CEkqQ1PE.js";import{u as cs}from"./useManaRate-DNC9BmC1.js";import{r as ds}from"./mana-rate-DsLc4315.js";import{i as ls,j as us,f as hs,n as ps,h as gs,A as xs}from"./authorizations-E8_0NGng.js";import{g as ms,b as Le}from"./buy-CFAg0mL8.js";import{b as fs,w as ys,S as vt,G as bs}from"./buy-gasless-B2L69ya6.js";import{u as vs,M as ws,R as we,r as Cs,c as js,p as wt}from"./useCreditPacks-Diy15u3Q.js";import{i as ks,a as $s}from"./errors-CPDOUeQU.js";import{E as Ss}from"./ErrorNotice-FoLpDD1-.js";import{u as Ct}from"./mana-convert-BD8UMnC-.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-BJQNrSRU.js";import"./sendMetaTransaction-CQ1T_6-I.js";const{colors:se,radius:Ms}=le,Ts=i.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
@@ -58,7 +58,7 @@ import{j as e,L as Se,r as P,b as ea,a as ta}from"./react-vyZjIDcS.js";import{t
58
58
  font-weight: 700;
59
59
  color: ${se.text};
60
60
  }
61
- `,Es="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830629458.commit-f262460/_assets/buy-error-22UunaPC.png";function qs(o){const{phase:l,balanceCredits:I,onClose:z}=o,W=l==="processing",D=l==="error"?s("cartCheckout.errorTitle"):l==="nofunds"?s("cartCheckout.titleNoFunds"):l==="choose"?s("buyModal.choosePayment"):s("cartCheckout.titleBuy"),Y=l==="processing";return e.jsxs(ba,{role:"dialog","aria-modal":"true","aria-label":s("cartCheckout.dialogAria"),children:[e.jsx(va,{onClick:W?void 0:z,"aria-hidden":!0}),e.jsxs(wa,{"data-tall":Y||void 0,children:[e.jsxs(Ca,{children:[e.jsxs(ja,{children:[e.jsx(ka,{children:D}),!W&&e.jsx($a,{onClick:z,"aria-label":s("buyModal.close"),children:e.jsx(Sa,{})})]}),e.jsxs(Ma,{children:[e.jsx(Ta,{children:l==="nofunds"?s("buyModal.dclBalance"):s("buyModal.myCreditsBalance")}),e.jsx(xt,{}),e.jsx(Ia,{children:de(I)})]})]}),l==="choose"&&e.jsxs(ke,{children:[e.jsxs(As,{children:[e.jsx("span",{children:s("cart.purchaseSummary")}),e.jsxs("strong",{children:[e.jsx(xt,{}),de(o.totalCredits??0)]})]}),e.jsx(Tt,{options:o.options??[],totalCents:o.totalCents??0,onPay:o.onPay??(()=>{}),rateNote:(()=>{const A=Pa(o.totalCents??0,o.totalManaWei??0n);return A!=null?s("buyModal.manaRate",{mana:A.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),l==="processing"&&e.jsx(Bs,{stage:o.stage??"reserving",step:o.step??1,total:o.total??1,isSelfCustody:!!o.isSelfCustody,signatures:o.signatures}),l==="nofunds"&&e.jsx(Rs,{lines:o.lines??[],shortfallCredits:o.shortfallCredits??0,packs:o.packs??[],selectedPack:o.selectedPack??"",onSelectPack:o.onSelectPack??(()=>{}),onBuyPacks:o.onBuyPacks??(()=>{}),onCancel:z}),l==="error"&&e.jsxs(ke,{children:[e.jsxs(za,{"data-testid":"buy-error",children:[e.jsx(Aa,{src:Es,alt:"",width:64,height:80}),e.jsxs(Ea,{children:[e.jsx("b",{children:s("cartCheckout.errorHeadline")})," ",o.message??s("cartCheckout.errorBody")]})]}),e.jsxs(It,{children:[e.jsx($e,{"data-variant":"outline",onClick:z,children:s("buyModal.cancel")}),e.jsx($e,{"data-variant":"purple",onClick:o.onRetry??z,children:s("cartCheckout.tryAgain")})]})]})]})]})}function Bs({stage:o,step:l,total:I,isSelfCustody:z,signatures:W}){const D=o==="reserving",Y=I>0?Math.min(100,Math.round(l/I*100)):0,A=z&&W&&W.total>1,ne=o==="awaiting-signature"?z?A?s("cartCheckout.confirmMultiple",{current:W.current,total:W.total}):s("buyModal.confirmToContinue"):s("buyModal.completingTransaction"):o==="settling"?s("buyModal.completingTransaction"):s("cartCheckout.preparing");return e.jsxs(ke,{"data-processing":!0,children:[e.jsx(qa,{src:aa,alt:"",width:61,height:61}),e.jsx(Ba,{children:ne}),D?e.jsxs(Ts,{children:[e.jsx(mt,{"aria-hidden":!0,children:e.jsx(ft,{"data-step":!0,style:{width:`${Y}%`}})}),I>1?e.jsxs(Is,{children:[l,"/",I]}):null]}):e.jsx(mt,{"aria-hidden":!0,children:e.jsx(ft,{})})]})}function Rs({lines:o,shortfallCredits:l,packs:I,selectedPack:z,onSelectPack:W,onBuyPacks:D,onCancel:Y}){const A=I.find(n=>n.id===z),ne=o.reduce((n,L)=>n+(L.quantity??1),0);return e.jsxs(ke,{children:[e.jsxs(Ra,{"data-testid":"nofunds-warning",children:[e.jsx(_a,{}),e.jsxs(Wa,{children:[e.jsx("b",{children:s("buyModal.insufficientFunds")})," ",s("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:s("buyModal.warningCreditsAmount",{count:Math.max(0,l)})})," ",s("buyModal.warningToPurchase",{count:ne})]})]}),e.jsx(Ps,{children:o.map(n=>{const L=n.quantity??1;return e.jsxs(Fa,{children:[e.jsx(La,{children:n.item.thumbnail?e.jsx("img",{src:n.item.thumbnail,alt:""}):null}),e.jsxs(Ka,{children:[e.jsxs("div",{children:[e.jsxs(Na,{title:n.item.name,children:[n.item.name||s("buyModal.itemFallback"),L>1?e.jsx(zs,{children:s("cartCheckout.qty",{count:L})}):null]}),n.item.creator?e.jsx(Ua,{address:n.item.creator}):null]}),e.jsxs(Qa,{children:[e.jsx(Ha,{}),e.jsx("span",{children:de(n.priceCredits*L)})]})]})]},n.item.id)})}),e.jsx(Oa,{children:I.map(n=>{const L=n.id===z;return e.jsxs(Va,{"data-testid":"credit-pack","data-on":L||void 0,onClick:()=>W(n.id),children:[e.jsx(Ga,{}),e.jsx(Da,{children:de(n.credits)}),e.jsxs(Ya,{children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs(Ja,{children:[e.jsxs(Xa,{children:[e.jsx(Za,{}),e.jsx("span",{children:de((A==null?void 0:A.credits)??0)})]}),e.jsxs(es,{children:["$",((A==null?void 0:A.usd)??0).toFixed(2)]})]}),e.jsxs(It,{children:[e.jsx($e,{"data-variant":"outline",onClick:Y,children:s("buyModal.cancel")}),e.jsx($e,{"data-variant":"gradient",onClick:D,children:s("buyModal.buy")})]})]})}const{colors:r,gradients:Pt,radius:Z}=le,zt="@media (max-width: 1080px)",T="@media (max-width: 880px)",jt=i.div`
61
+ `,Es="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830708286.commit-6900e32/_assets/buy-error-22UunaPC.png";function qs(o){const{phase:l,balanceCredits:I,onClose:z}=o,W=l==="processing",D=l==="error"?s("cartCheckout.errorTitle"):l==="nofunds"?s("cartCheckout.titleNoFunds"):l==="choose"?s("buyModal.choosePayment"):s("cartCheckout.titleBuy"),Y=l==="processing";return e.jsxs(ba,{role:"dialog","aria-modal":"true","aria-label":s("cartCheckout.dialogAria"),children:[e.jsx(va,{onClick:W?void 0:z,"aria-hidden":!0}),e.jsxs(wa,{"data-tall":Y||void 0,children:[e.jsxs(Ca,{children:[e.jsxs(ja,{children:[e.jsx(ka,{children:D}),!W&&e.jsx($a,{onClick:z,"aria-label":s("buyModal.close"),children:e.jsx(Sa,{})})]}),e.jsxs(Ma,{children:[e.jsx(Ta,{children:l==="nofunds"?s("buyModal.dclBalance"):s("buyModal.myCreditsBalance")}),e.jsx(xt,{}),e.jsx(Ia,{children:de(I)})]})]}),l==="choose"&&e.jsxs(ke,{children:[e.jsxs(As,{children:[e.jsx("span",{children:s("cart.purchaseSummary")}),e.jsxs("strong",{children:[e.jsx(xt,{}),de(o.totalCredits??0)]})]}),e.jsx(Tt,{options:o.options??[],totalCents:o.totalCents??0,onPay:o.onPay??(()=>{}),rateNote:(()=>{const A=Pa(o.totalCents??0,o.totalManaWei??0n);return A!=null?s("buyModal.manaRate",{mana:A.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),l==="processing"&&e.jsx(Bs,{stage:o.stage??"reserving",step:o.step??1,total:o.total??1,isSelfCustody:!!o.isSelfCustody,signatures:o.signatures}),l==="nofunds"&&e.jsx(Rs,{lines:o.lines??[],shortfallCredits:o.shortfallCredits??0,packs:o.packs??[],selectedPack:o.selectedPack??"",onSelectPack:o.onSelectPack??(()=>{}),onBuyPacks:o.onBuyPacks??(()=>{}),onCancel:z}),l==="error"&&e.jsxs(ke,{children:[e.jsxs(za,{"data-testid":"buy-error",children:[e.jsx(Aa,{src:Es,alt:"",width:64,height:80}),e.jsxs(Ea,{children:[e.jsx("b",{children:s("cartCheckout.errorHeadline")})," ",o.message??s("cartCheckout.errorBody")]})]}),e.jsxs(It,{children:[e.jsx($e,{"data-variant":"outline",onClick:z,children:s("buyModal.cancel")}),e.jsx($e,{"data-variant":"purple",onClick:o.onRetry??z,children:s("cartCheckout.tryAgain")})]})]})]})]})}function Bs({stage:o,step:l,total:I,isSelfCustody:z,signatures:W}){const D=o==="reserving",Y=I>0?Math.min(100,Math.round(l/I*100)):0,A=z&&W&&W.total>1,ne=o==="awaiting-signature"?z?A?s("cartCheckout.confirmMultiple",{current:W.current,total:W.total}):s("buyModal.confirmToContinue"):s("buyModal.completingTransaction"):o==="settling"?s("buyModal.completingTransaction"):s("cartCheckout.preparing");return e.jsxs(ke,{"data-processing":!0,children:[e.jsx(qa,{src:aa,alt:"",width:61,height:61}),e.jsx(Ba,{children:ne}),D?e.jsxs(Ts,{children:[e.jsx(mt,{"aria-hidden":!0,children:e.jsx(ft,{"data-step":!0,style:{width:`${Y}%`}})}),I>1?e.jsxs(Is,{children:[l,"/",I]}):null]}):e.jsx(mt,{"aria-hidden":!0,children:e.jsx(ft,{})})]})}function Rs({lines:o,shortfallCredits:l,packs:I,selectedPack:z,onSelectPack:W,onBuyPacks:D,onCancel:Y}){const A=I.find(n=>n.id===z),ne=o.reduce((n,L)=>n+(L.quantity??1),0);return e.jsxs(ke,{children:[e.jsxs(Ra,{"data-testid":"nofunds-warning",children:[e.jsx(_a,{}),e.jsxs(Wa,{children:[e.jsx("b",{children:s("buyModal.insufficientFunds")})," ",s("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:s("buyModal.warningCreditsAmount",{count:Math.max(0,l)})})," ",s("buyModal.warningToPurchase",{count:ne})]})]}),e.jsx(Ps,{children:o.map(n=>{const L=n.quantity??1;return e.jsxs(Fa,{children:[e.jsx(La,{children:n.item.thumbnail?e.jsx("img",{src:n.item.thumbnail,alt:""}):null}),e.jsxs(Ka,{children:[e.jsxs("div",{children:[e.jsxs(Na,{title:n.item.name,children:[n.item.name||s("buyModal.itemFallback"),L>1?e.jsx(zs,{children:s("cartCheckout.qty",{count:L})}):null]}),n.item.creator?e.jsx(Ua,{address:n.item.creator}):null]}),e.jsxs(Qa,{children:[e.jsx(Ha,{}),e.jsx("span",{children:de(n.priceCredits*L)})]})]})]},n.item.id)})}),e.jsx(Oa,{children:I.map(n=>{const L=n.id===z;return e.jsxs(Va,{"data-testid":"credit-pack","data-on":L||void 0,onClick:()=>W(n.id),children:[e.jsx(Ga,{}),e.jsx(Da,{children:de(n.credits)}),e.jsxs(Ya,{children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs(Ja,{children:[e.jsxs(Xa,{children:[e.jsx(Za,{}),e.jsx("span",{children:de((A==null?void 0:A.credits)??0)})]}),e.jsxs(es,{children:["$",((A==null?void 0:A.usd)??0).toFixed(2)]})]}),e.jsxs(It,{children:[e.jsx($e,{"data-variant":"outline",onClick:Y,children:s("buyModal.cancel")}),e.jsx($e,{"data-variant":"gradient",onClick:D,children:s("buyModal.buy")})]})]})}const{colors:r,gradients:Pt,radius:Z}=le,zt="@media (max-width: 1080px)",T="@media (max-width: 880px)",jt=i.div`
62
62
  max-width: 1510px;
63
63
  margin: 0 auto;
64
64
  /* Grows into the page's leftover height and passes it down to Upsell, so the white cross-sell band ends at
@@ -1,4 +1,4 @@
1
- import{L as N,M as U,N as o,O as n,G as D,x as M}from"./index-_fVd2-rJ.js";import{r as w,j as g}from"./react-vyZjIDcS.js";import{g as z,a as E,c as I,b as F,s as v}from"./clsx-DERZ5aic.js";function G(r){return z("MuiCircularProgress",r)}E("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const K=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,b,S,$;const t=44,L=M(P||(P=l`
1
+ import{L as N,M as U,N as o,O as n,G as D,x as M}from"./index-ZLrp5Bhh.js";import{r as w,j as g}from"./react-vyZjIDcS.js";import{g as z,a as E,c as I,b as F,s as v}from"./clsx-CqIwIRCQ.js";function G(r){return z("MuiCircularProgress",r)}E("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const K=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,b,S,$;const t=44,L=M(P||(P=l`
2
2
  0% {
3
3
  transform: rotate(0deg);
4
4
  }
@@ -1,4 +1,4 @@
1
- import{j as e,r as m,e as Y,b as Z}from"./react-vyZjIDcS.js";import{t as v,s as c,ae as J,af as z,I as X,e as a,c as ee,l as te,u as ae,m as re,h as oe,S as E,A as ie,ag as se,ah as ne}from"./index-_fVd2-rJ.js";import{E as ce}from"./ErrorNotice-DrZAUSEy.js";import{d as le,g as de,a as pe,P as xe,C as ue,b as me,c as ge,B as he,S as be,M as fe,A as je}from"./browseLayout.styles-B9qeOgPd.js";import{u as ve}from"./useStore-DrrSGrKX.js";import{c as F,a as ye,F as Ce,d as we,P as Se,e as ke,H as Ae,S as Ne}from"./categories-D_mk1mr7.js";import{L as $e}from"./LoadMore-C0qTp7ND.js";import{u as Pe}from"./useInfiniteGrid-CSjVmw_O.js";import{G as Me}from"./grid.styles-HC96xAOy.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";const Re=c.section`
1
+ import{j as e,r as m,e as Y,b as Z}from"./react-vyZjIDcS.js";import{t as v,s as c,ae as J,af as z,I as X,e as a,c as ee,l as te,u as ae,m as re,h as oe,S as E,A as ie,ag as se,ah as ne}from"./index-ZLrp5Bhh.js";import{E as ce}from"./ErrorNotice-FoLpDD1-.js";import{d as le,g as de,a as pe,P as xe,C as ue,b as me,c as ge,B as he,S as be,M as fe,A as je}from"./browseLayout.styles-BuE8ZzH7.js";import{u as ve}from"./useStore-BC3A7db6.js";import{c as F,a as ye,F as Ce,d as we,P as Se,e as ke,H as Ae,S as Ne}from"./categories-wrk9ttY6.js";import{L as $e}from"./LoadMore-8od0F5L9.js";import{u as Pe}from"./useInfiniteGrid-SEfbanDp.js";import{G as Me}from"./grid.styles-D-gTOGBC.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";const Re=c.section`
2
2
  position: relative;
3
3
  border-radius: ${v.radius.card};
4
4
  overflow: hidden;
@@ -1,4 +1,4 @@
1
- import{j as t,r as v}from"./react-vyZjIDcS.js";import{s as e,t as o,e as g,z as k,H as j,bc as C,h as G,x as Y,I as Q,l as X,a as W,C as E,b as Z,bd as J,be as F,A as q}from"./index-_fVd2-rJ.js";import{s as ee,h as H,A as U,g as K,r as te,m as ne,e as ae}from"./authorizations-CyYFEcSa.js";import{i as ie}from"./errors-DO4IpB78.js";import{E as oe}from"./ErrorNotice-DrZAUSEy.js";import{a as se}from"./buy-Cva9EYX4.js";import{g as re,d as ce}from"./trade-encoding-C-S0B0xE.js";import{s as de,M as le,E as pe}from"./sendMetaTransaction-CzKSbuyF.js";import{I as he,C as ue}from"./ethers-CXBJm_wN.js";const R="shop:resume_after_signin",xe=900*1e3;function rt(a){try{sessionStorage.setItem(R,JSON.stringify({...a,at:Date.now()}))}catch{}}function ct(a){let n;try{n=sessionStorage.getItem(R)}catch{return null}if(!n)return null;try{sessionStorage.removeItem(R)}catch{}let i;try{i=JSON.parse(n)}catch{return null}return!i||i.type!==a||typeof i.at!="number"||Date.now()-i.at>xe?null:i.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:i.path}}function ge(a,n){return(a+n-1n)/n}function fe(a,n,i){return a<=0||n<=0?0n:a>=n?i:ge(i*BigInt(a),BigInt(n))}function dt(a){var b,y,w;const n=Number.isFinite(a.priceCents)?Math.max(0,Math.trunc(a.priceCents)):0,i=Number.isFinite(a.balanceCents)?Math.max(0,Math.trunc(a.balanceCents)):0,s=a.priceManaWei>0n?a.priceManaWei:0n,d=a.manaBalanceWei>0n?a.manaBalanceWei:0n;if(n<=0)return{options:[],preferred:null,manaShortfall:null};const c=[];if(i>=n&&c.push({method:"credits",creditsCents:n,manaWei:0n}),s>0n&&i>0&&i<n){const l=n-i,f=fe(l,n,s);d>=f&&c.push({method:"combined",creditsCents:i,manaWei:f})}s>0n&&d>=s&&c.push({method:"mana",creditsCents:0,manaWei:s});const p=((b=c.find(l=>l.method==="credits"))==null?void 0:b.method)??((y=c.find(l=>l.method==="combined"))==null?void 0:y.method)??((w=c.find(l=>l.method==="mana"))==null?void 0:w.method)??null,m=!c.some(l=>l.method==="mana"||l.method==="combined")&&s>0n&&d>0n?{manaWei:d,manaCents:me(d,n,s),priceCents:n}:null;return{options:c,preferred:p,manaShortfall:m}}function me(a,n,i){return Number(a*BigInt(n)/i)}function lt(a,n){let i=Number.isFinite(n)?Math.max(0,Math.trunc(n)):0;return a.map(s=>{const d=Number.isFinite(s)?Math.max(0,Math.trunc(s)):0,c=Math.min(d,i);return i-=c,c})}function z(a){return Number.isFinite(a)?Math.max(0,a)/10:0}function pt(a,n){return a.options.find(i=>i.method===n)??null}function ht(a,n){if(!Number.isFinite(a)||a<=0||n<=0n)return null;const i=a/10;return Number(n)/1e18/i}const T="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group%201'%3e%3cpath%20id='Vector'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%202L22%2012L12%2022L2%2012L12%202ZM12%204.8L19.2%2012L12%2019.2L4.8%2012L12%204.8ZM12%2015.6C12.9548%2015.6001%2013.8705%2015.2209%2014.5457%2014.5459C15.2209%2013.8708%2015.6003%2012.9552%2015.6004%2012.0004C15.6005%2011.0456%2015.2213%2010.1299%2014.5463%209.45471C13.8712%208.7795%2012.9556%208.40011%2012.0008%208.4C11.0461%208.4%2010.1304%208.77928%209.45525%209.45442C8.78012%2010.1295%208.40083%2011.0452%208.40083%2012C8.40083%2012.9548%208.78012%2013.8705%209.45525%2014.5456C10.1304%2015.2207%2011.0461%2015.6%2012.0008%2015.6H12Z'%20fill='white'/%3e%3cg%20id='Rectangle%201'%3e%3c/g%3e%3c/g%3e%3c/svg%3e",be=e.div`
1
+ import{j as t,r as v}from"./react-vyZjIDcS.js";import{s as e,t as o,e as g,z as k,H as j,bc as C,h as G,x as Y,I as Q,l as X,a as W,C as E,b as Z,bd as J,be as F,A as q}from"./index-ZLrp5Bhh.js";import{s as ee,h as H,A as U,g as K,r as te,m as ne,e as ae}from"./authorizations-E8_0NGng.js";import{i as ie}from"./errors-CPDOUeQU.js";import{E as oe}from"./ErrorNotice-FoLpDD1-.js";import{a as se}from"./buy-CFAg0mL8.js";import{g as re,d as ce}from"./trade-encoding-BJQNrSRU.js";import{s as de,M as le,E as pe}from"./sendMetaTransaction-CQ1T_6-I.js";import{I as he,C as ue}from"./ethers-CXBJm_wN.js";const R="shop:resume_after_signin",xe=900*1e3;function rt(a){try{sessionStorage.setItem(R,JSON.stringify({...a,at:Date.now()}))}catch{}}function ct(a){let n;try{n=sessionStorage.getItem(R)}catch{return null}if(!n)return null;try{sessionStorage.removeItem(R)}catch{}let i;try{i=JSON.parse(n)}catch{return null}return!i||i.type!==a||typeof i.at!="number"||Date.now()-i.at>xe?null:i.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:i.path}}function ge(a,n){return(a+n-1n)/n}function fe(a,n,i){return a<=0||n<=0?0n:a>=n?i:ge(i*BigInt(a),BigInt(n))}function dt(a){var b,y,w;const n=Number.isFinite(a.priceCents)?Math.max(0,Math.trunc(a.priceCents)):0,i=Number.isFinite(a.balanceCents)?Math.max(0,Math.trunc(a.balanceCents)):0,s=a.priceManaWei>0n?a.priceManaWei:0n,d=a.manaBalanceWei>0n?a.manaBalanceWei:0n;if(n<=0)return{options:[],preferred:null,manaShortfall:null};const c=[];if(i>=n&&c.push({method:"credits",creditsCents:n,manaWei:0n}),s>0n&&i>0&&i<n){const l=n-i,f=fe(l,n,s);d>=f&&c.push({method:"combined",creditsCents:i,manaWei:f})}s>0n&&d>=s&&c.push({method:"mana",creditsCents:0,manaWei:s});const p=((b=c.find(l=>l.method==="credits"))==null?void 0:b.method)??((y=c.find(l=>l.method==="combined"))==null?void 0:y.method)??((w=c.find(l=>l.method==="mana"))==null?void 0:w.method)??null,m=!c.some(l=>l.method==="mana"||l.method==="combined")&&s>0n&&d>0n?{manaWei:d,manaCents:me(d,n,s),priceCents:n}:null;return{options:c,preferred:p,manaShortfall:m}}function me(a,n,i){return Number(a*BigInt(n)/i)}function lt(a,n){let i=Number.isFinite(n)?Math.max(0,Math.trunc(n)):0;return a.map(s=>{const d=Number.isFinite(s)?Math.max(0,Math.trunc(s)):0,c=Math.min(d,i);return i-=c,c})}function z(a){return Number.isFinite(a)?Math.max(0,a)/10:0}function pt(a,n){return a.options.find(i=>i.method===n)??null}function ht(a,n){if(!Number.isFinite(a)||a<=0||n<=0n)return null;const i=a/10;return Number(n)/1e18/i}const T="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group%201'%3e%3cpath%20id='Vector'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%202L22%2012L12%2022L2%2012L12%202ZM12%204.8L19.2%2012L12%2019.2L4.8%2012L12%204.8ZM12%2015.6C12.9548%2015.6001%2013.8705%2015.2209%2014.5457%2014.5459C15.2209%2013.8708%2015.6003%2012.9552%2015.6004%2012.0004C15.6005%2011.0456%2015.2213%2010.1299%2014.5463%209.45471C13.8712%208.7795%2012.9556%208.40011%2012.0008%208.4C11.0461%208.4%2010.1304%208.77928%209.45525%209.45442C8.78012%2010.1295%208.40083%2011.0452%208.40083%2012C8.40083%2012.9548%208.78012%2013.8705%209.45525%2014.5456C10.1304%2015.2207%2011.0461%2015.6%2012.0008%2015.6H12Z'%20fill='white'/%3e%3cg%20id='Rectangle%201'%3e%3c/g%3e%3c/g%3e%3c/svg%3e",be=e.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 12px;
@@ -1,4 +1,4 @@
1
- import{b as Y,j as e,L as ue,e as fe,u as be,r as y}from"./react-vyZjIDcS.js";import{t as Z,aA as we,aB as R,aC as _,s as a,aD as je,F as ve,aE as Ce,e as t,aF as W,B as ye,G as q,ae as J,n as $e,af as Q,I as T,c as ke,m as Ne,S,h as Pe,A as Se,az as Le,aG as Ae}from"./index-_fVd2-rJ.js";import{d as Me,g as Fe,a as ze,P as Be,C as Ee,b as Ie,c as Re,A as _e,B as We,S as Te,M as Ge,e as He,f as Ue}from"./browseLayout.styles-B9qeOgPd.js";import{u as De,L as Ke}from"./useStore-DrrSGrKX.js";import{c as G,a as Oe,F as Ve,d as Ye,P as Ze,e as qe,H as Je,S as Qe}from"./categories-D_mk1mr7.js";import{L as H}from"./LoadMore-C0qTp7ND.js";import{u as U}from"./useInfiniteGrid-CSjVmw_O.js";import{E as D}from"./ErrorNotice-DrZAUSEy.js";import{G as K}from"./grid.styles-HC96xAOy.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";const{colors:m,radius:X,media:Xe}=Z,et=a.article`
1
+ import{b as Y,j as e,L as ue,e as fe,u as be,r as y}from"./react-vyZjIDcS.js";import{t as Z,aA as we,aB as R,aC as _,s as a,aD as je,F as ve,aE as Ce,e as t,aF as W,B as ye,G as q,ae as J,n as $e,af as Q,I as T,c as ke,m as Ne,S,h as Pe,A as Se,az as Le,aG as Ae}from"./index-ZLrp5Bhh.js";import{d as Me,g as Fe,a as ze,P as Be,C as Ee,b as Ie,c as Re,A as _e,B as We,S as Te,M as Ge,e as He,f as Ue}from"./browseLayout.styles-BuE8ZzH7.js";import{u as De,L as Ke}from"./useStore-BC3A7db6.js";import{c as G,a as Oe,F as Ve,d as Ye,P as Ze,e as qe,H as Je,S as Qe}from"./categories-wrk9ttY6.js";import{L as H}from"./LoadMore-8od0F5L9.js";import{u as U}from"./useInfiniteGrid-SEfbanDp.js";import{E as D}from"./ErrorNotice-FoLpDD1-.js";import{G as K}from"./grid.styles-D-gTOGBC.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";const{colors:m,radius:X,media:Xe}=Z,et=a.article`
2
2
  height: 300px;
3
3
  background: ${m.bg};
4
4
  border-radius: ${X.card};
@@ -1 +1 @@
1
- import{j as r}from"./react-vyZjIDcS.js";import{I as i}from"./index-_fVd2-rJ.js";function a({message:e,className:o,testId:t}){return e?r.jsxs("p",{className:o?`error-notice ${o}`:"error-notice","data-testid":t,role:"alert",children:[r.jsx(i,{name:"alert",className:"error-notice__ico",size:18}),r.jsx("span",{className:"error-notice__msg",children:e})]}):null}export{a as E};
1
+ import{j as r}from"./react-vyZjIDcS.js";import{I as i}from"./index-ZLrp5Bhh.js";function a({message:e,className:o,testId:t}){return e?r.jsxs("p",{className:o?`error-notice ${o}`:"error-notice","data-testid":t,role:"alert",children:[r.jsx(i,{name:"alert",className:"error-notice__ico",size:18}),r.jsx("span",{className:"error-notice__msg",children:e})]}):null}export{a as E};
@@ -1 +1 @@
1
- import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-4IvPGz6h.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-0jJE5d0L.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
1
+ import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-CrdKu7xI.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-Dyfkmcym.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
@@ -1,4 +1,4 @@
1
- import{b as xe,u as ue,r as l,j as t}from"./react-vyZjIDcS.js";import{s as i,t as e,x as T,m as he,e as r,h as p,n as ge,D as fe,aq as f,ao as me,l as N,ay as H,I as re,ai as D,z as E,aQ as K}from"./index-_fVd2-rJ.js";import{R as O}from"./resume-buy-Bf0zIH7y.js";import{u as be,a as we,R as ye,c as ke,i as Ce,b as je}from"./useCreditPacks-BYlwZVOz.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./mana-convert-CRzSStq1.js";const P="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830629458.commit-f262460/_assets/pack-coins-BDh1ZDbh.webp",ne="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830629458.commit-f262460/_assets/pack-stacks-D-V2jSHW.webp",se="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830629458.commit-f262460/_assets/pack-chest-BX_j84xW.webp",$e="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830629458.commit-f262460/_assets/credit-coin-CmcTCd5i.webp",ve="data:image/svg+xml,%3csvg%20width='60'%20height='60'%20viewBox='0%200%2060%2060'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='60'%20height='60'%20rx='30'%20fill='%2334CE77'/%3e%3cpath%20d='M21.6583%2046.1067L11.4656%2036.0591C10.1688%2034.829%2010.1905%2032.7207%2011.4769%2031.4622L13.6868%2029.3591C14.9732%2028.1006%2017.1615%2028.1058%2018.4582%2029.3359L23.8747%2034.6197L41.9704%2015.6527C43.2568%2014.3942%2045.4291%2014.2093%2046.7258%2015.4394L48.8765%2017.3628C50.1732%2018.5929%2050.3491%2020.6844%2049.0626%2021.9429L26.6112%2045.8766C25.1433%2047.342%2022.955%2047.3368%2021.6583%2046.1067Z'%20fill='%23FCFCFC'/%3e%3c/svg%3e",Se="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830629458.commit-f262460/_assets/packs-backdrop-BcXiUPeP.webp",Y="linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)",Pe=i.div`
1
+ import{b as xe,u as ue,r as l,j as t}from"./react-vyZjIDcS.js";import{s as i,t as e,x as T,m as he,e as r,h as p,n as ge,D as fe,aq as f,ao as me,l as N,ay as H,I as re,ai as D,z as E,aQ as K}from"./index-ZLrp5Bhh.js";import{R as O}from"./resume-buy-Bf0zIH7y.js";import{u as be,a as we,R as ye,c as ke,i as Ce,b as je}from"./useCreditPacks-Diy15u3Q.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./mana-convert-BD8UMnC-.js";const P="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830708286.commit-6900e32/_assets/pack-coins-BDh1ZDbh.webp",ne="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830708286.commit-6900e32/_assets/pack-stacks-D-V2jSHW.webp",se="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830708286.commit-6900e32/_assets/pack-chest-BX_j84xW.webp",$e="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830708286.commit-6900e32/_assets/credit-coin-CmcTCd5i.webp",ve="data:image/svg+xml,%3csvg%20width='60'%20height='60'%20viewBox='0%200%2060%2060'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='60'%20height='60'%20rx='30'%20fill='%2334CE77'/%3e%3cpath%20d='M21.6583%2046.1067L11.4656%2036.0591C10.1688%2034.829%2010.1905%2032.7207%2011.4769%2031.4622L13.6868%2029.3591C14.9732%2028.1006%2017.1615%2028.1058%2018.4582%2029.3359L23.8747%2034.6197L41.9704%2015.6527C43.2568%2014.3942%2045.4291%2014.2093%2046.7258%2015.4394L48.8765%2017.3628C50.1732%2018.5929%2050.3491%2020.6844%2049.0626%2021.9429L26.6112%2045.8766C25.1433%2047.342%2022.955%2047.3368%2021.6583%2046.1067Z'%20fill='%23FCFCFC'/%3e%3c/svg%3e",Se="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830708286.commit-6900e32/_assets/packs-backdrop-BcXiUPeP.webp",Y="linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)",Pe=i.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 24px;
@@ -1,4 +1,4 @@
1
- import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-D5-5jcck.js";import{d as g,r as v}from"./index-0jJE5d0L.js";import{C as c}from"./ConstantsUtil-Dfwpy1eP.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-4IvPGz6h.js";import{au as y}from"./NetworkUtil-HlUKXKcF.js";const b=g`
1
+ import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-BJpdqx6Q.js";import{d as g,r as v}from"./index-Dyfkmcym.js";import{C as c}from"./ConstantsUtil-Dfwpy1eP.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-CrdKu7xI.js";import{au as y}from"./NetworkUtil-HlUKXKcF.js";const b=g`
2
2
  :host {
3
3
  display: flex;
4
4
  justify-content: center;
@@ -1,4 +1,4 @@
1
- import{j as e,b as ee,r as h,L as te}from"./react-vyZjIDcS.js";import{t as S,s as t,x as ie,y as se,e as i,h as R,B as I,z,aq as ne,aP as K,l as W,m as re,n as oe,D as ae,u as de,E as ce}from"./index-_fVd2-rJ.js";import{i as le,R as pe,f as ge}from"./import-DXnpuPId.js";import{u as xe}from"./useSecondarySales-CCBc4I5y.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./buy-Cva9EYX4.js";import"./authorizations-CyYFEcSa.js";import"./sendMetaTransaction-CzKSbuyF.js";import"./trade-encoding-C-S0B0xE.js";import"./mana-rate-CXxuEUr3.js";import"./mana-convert-CRzSStq1.js";function U({size:o=12,...w}){return e.jsx("svg",{viewBox:"0 0 20 20",width:o,height:o,fill:"none","aria-hidden":!0,focusable:"false",...w,children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const{colors:M,radius:me,z:ue}=S,he=ie`
1
+ import{j as e,b as ee,r as h,L as te}from"./react-vyZjIDcS.js";import{t as S,s as t,x as ie,y as se,e as i,h as R,B as I,z,aq as ne,aP as K,l as W,m as re,n as oe,D as ae,u as de,E as ce}from"./index-ZLrp5Bhh.js";import{i as le,R as pe,f as ge}from"./import-DdbcQXPQ.js";import{u as xe}from"./useSecondarySales-BdMq83Pz.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./buy-CFAg0mL8.js";import"./authorizations-E8_0NGng.js";import"./sendMetaTransaction-CQ1T_6-I.js";import"./trade-encoding-BJQNrSRU.js";import"./mana-rate-DsLc4315.js";import"./mana-convert-BD8UMnC-.js";function U({size:o=12,...w}){return e.jsx("svg",{viewBox:"0 0 20 20",width:o,height:o,fill:"none","aria-hidden":!0,focusable:"false",...w,children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})}const{colors:M,radius:me,z:ue}=S,he=ie`
2
2
  0% {
3
3
  transform: scale(0);
4
4
  opacity: 0;