@dcl/shop 0.1.0-30830755583.commit-4658b42 → 0.1.0-30835612462.commit-48765f9

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 (172) hide show
  1. package/_assets/{Activity-DkK_V4sh.js → Activity-C96oKaM7.js} +1 -1
  2. package/_assets/{AnimatedBackground-CQDKI-H_.js → AnimatedBackground-Cg4YrmHy.js} +1 -1
  3. package/_assets/{Assets-DT-d-qaQ.js → Assets-BUbwNh-5.js} +2 -2
  4. package/_assets/{Assets.styles-EoOzQAcv.js → Assets.styles-BO8jltml.js} +1 -1
  5. package/_assets/{Authorizations-GSUZWQda.js → Authorizations-D7hfFylo.js} +1 -1
  6. package/_assets/{Cart-fGoe5beM.js → Cart-DPW25tAG.js} +2 -2
  7. package/_assets/{CircularProgress-3u1que6i.js → CircularProgress-B2h31Yy9.js} +1 -1
  8. package/_assets/{Collection-vcx-3qSp.js → Collection-BS21SN6A.js} +1 -1
  9. package/_assets/{CollectionCarousel-DrpF7Bml.js → CollectionCarousel-WI45XOFA.js} +1 -1
  10. package/_assets/{Creator-CMtCjYcd.js → Creator-DQZ74uf0.js} +1 -1
  11. package/_assets/{ErrorNotice-BZqsZ4rX.js → ErrorNotice-q0dn0iRL.js} +1 -1
  12. package/_assets/{ExchangeController-DU88Z9dU.js → ExchangeController-Dtgh1od6.js} +1 -1
  13. package/_assets/{GetCredits-C8a5FpoV.js → GetCredits-D-jeDJ75.js} +1 -1
  14. package/_assets/{HelpersUtil-DR2mBYdx.js → HelpersUtil-D2_GPqxX.js} +1 -1
  15. package/_assets/{ImportListings-Du6YU7d7.js → ImportListings-BNjL24xn.js} +1 -1
  16. package/_assets/{ItemDetail-CXKhhh8X.js → ItemDetail-BXpWKwPY.js} +13 -13
  17. package/_assets/{LoadMore-Bqx1IcKy.js → LoadMore-DoQvuFO_.js} +1 -1
  18. package/_assets/{MenuList-BEvHySxI.js → MenuList-DOJfvyqr.js} +1 -1
  19. package/_assets/{MyAssets-CPWoT2VA.js → MyAssets-DpQnCJPT.js} +1 -1
  20. package/_assets/{MyFavorites-Igl25Nek.js → MyFavorites-DFO63j-P.js} +1 -1
  21. package/_assets/{NotFound-B4Q6cIl5.js → NotFound-BocUG6Wo.js} +1 -1
  22. package/_assets/{NotificationsBell-BqdBDBcG.js → NotificationsBell-iaGtBsC9.js} +1 -1
  23. package/_assets/{StoreSettings-C_8-hM88.js → StoreSettings-Bc_NBrxI.js} +1 -1
  24. package/_assets/{Success-GH1eUkKP.js → Success-BIMxdHvn.js} +1 -1
  25. package/_assets/{SwapController-DqIyjDwe.js → SwapController-DeKeu3FE.js} +1 -1
  26. package/_assets/{Tooltip-BqiXiZUp.js → Tooltip-BLyu7Dfk.js} +1 -1
  27. package/_assets/{TradeService-BrwKrYrV.js → TradeService-CWqv5slk.js} +1 -1
  28. package/_assets/{W3MFrameProviderSingleton-wKXZD-Zq.js → W3MFrameProviderSingleton-1MRMKUrL.js} +3 -3
  29. package/_assets/{WebCryptoP256-BO1VNOgp.js → WebCryptoP256-BAvl6xkt.js} +1 -1
  30. package/_assets/{authorizations-Bz3S6EIM.js → authorizations-DDsnY_Zf.js} +1 -1
  31. package/_assets/{basic-EJUnZYJe.js → basic-BzVRhtZ-.js} +1 -1
  32. package/_assets/{biconomy-DotXQm2m.js → biconomy-yl7EuW3B.js} +1 -1
  33. package/_assets/{browseLayout.styles-DKcUvFq-.js → browseLayout.styles-u63rKyzf.js} +1 -1
  34. package/_assets/{builder-78T8aZCf.js → builder-BO6I7uZQ.js} +1 -1
  35. package/_assets/{buy-F7fYGwQJ.js → buy-DN9Q4fmJ.js} +1 -1
  36. package/_assets/{buy-gasless-BM1gL-pK.js → buy-gasless-Cxl5QDDd.js} +1 -1
  37. package/_assets/{categories-BU8sQA4o.js → categories-DFgZJeSL.js} +1 -1
  38. package/_assets/{ccip-C_kT-OVZ.js → ccip-5db1OYaq.js} +1 -1
  39. package/_assets/{ccip-tCVfGtP3.js → ccip-C9MO7Vbh.js} +1 -1
  40. package/_assets/{clsx-BJUFu5Pv.js → clsx-Dv5E4mS4.js} +1 -1
  41. package/_assets/{controller-m4Wxh5sS.js → controller-DNuVvFDa.js} +2 -2
  42. package/_assets/{core-B1V31SCn.js → core-Do4xTqpU.js} +4 -4
  43. package/_assets/{createSvgIcon-Dj_5_lVz.js → createSvgIcon-TyRUGFdQ.js} +1 -1
  44. package/_assets/{custom-D1K_TxPK.js → custom-Cdk30JmS.js} +1 -1
  45. package/_assets/{data-capture-C1-byNHR.js → data-capture-DwwEo9Zw.js} +1 -1
  46. package/_assets/{email-roLnzw98.js → email-DiU12yVh.js} +1 -1
  47. package/_assets/{embedded-wallet-CaSrX8RO.js → embedded-wallet-Gkjm7p7P.js} +1 -1
  48. package/_assets/{emotion-styled.browser.esm-B_GcKaUo.js → emotion-styled.browser.esm-1jXvUKUZ.js} +1 -1
  49. package/_assets/{engine-BQKnbku7.js → engine-BlXXh7Bj.js} +1 -1
  50. package/_assets/{errors-BkMwx-kf.js → errors-BshsHqbY.js} +1 -1
  51. package/_assets/{estimate-l1-fee-C8wjooi8.js → estimate-l1-fee-Jhm2Yxur.js} +1 -1
  52. package/_assets/{execute-6yOQQvcJ.js → execute-BrbMEhFX.js} +2 -2
  53. package/_assets/{features-oMzmfq5l.js → features-WtRCFBGN.js} +1 -1
  54. package/_assets/{fetchTokenMetadata-BdDn5xlV.js → fetchTokenMetadata-Bm5qOhHz.js} +2 -2
  55. package/_assets/{get-ecosystem-wallet-info-BJqFfkxV.js → get-ecosystem-wallet-info-Bk3TC-8s.js} +1 -1
  56. package/_assets/{getBalance-RNu0dFGc.js → getBalance-D5TAQGrF.js} +1 -1
  57. package/_assets/{getNFT-BZyzOHB8.js → getNFT-BXhNmL18.js} +1 -1
  58. package/_assets/{getNFT-CULdzRPK.js → getNFT-CCYMJGO3.js} +1 -1
  59. package/_assets/{getThemeProps-DXnNGMw5.js → getThemeProps-jxkK7aJF.js} +1 -1
  60. package/_assets/{grid.styles-BlUHs1Am.js → grid.styles-Dc-BunHd.js} +1 -1
  61. package/_assets/{hashTypedData-B9S9l2wb.js → hashTypedData-Ca0HEadf.js} +1 -1
  62. package/_assets/{hashTypedData-IHUBPkR0.js → hashTypedData-DVgRVFNg.js} +1 -1
  63. package/_assets/{import-HMOgDc9D.js → import-DOwZHLAr.js} +1 -1
  64. package/_assets/{in-app-CWL9UnZu.js → in-app-5OmWNOhY.js} +1 -1
  65. package/_assets/{in-app-wallet-calls-iG9TrQSV.js → in-app-wallet-calls-BRQJJecy.js} +1 -1
  66. package/_assets/{index-SnHJ4jHh.js → index-2OVx4iJi.js} +3 -3
  67. package/_assets/{index-D6qSnzWv.js → index-B0qtsAE-.js} +1 -1
  68. package/_assets/{index-BPZFvxpS.js → index-B4VI0jMN.js} +1 -1
  69. package/_assets/{index-BjqyR397.js → index-BE_Ebetr.js} +1 -1
  70. package/_assets/{index-DUFof9sW.js → index-BFBjDoQ6.js} +1 -1
  71. package/_assets/{index-CqcnnSEX.js → index-BJOGj8uX.js} +1 -1
  72. package/_assets/{index-byCABXEb.js → index-BUWXcU3w.js} +1 -1
  73. package/_assets/{index-BwhFJbcv.js → index-BVkfXvB0.js} +1 -1
  74. package/_assets/{index-D15ZxYWQ.js → index-Be0TtwRh.js} +1 -1
  75. package/_assets/{index-D_r4rek8.js → index-BgkliADR.js} +1 -1
  76. package/_assets/{index-yl2QMKNC.js → index-BhozS4qR.js} +1 -1
  77. package/_assets/{index-6BrQFoiH.js → index-Bjz1afXG.js} +1 -1
  78. package/_assets/{index-CuE5Oadu.js → index-C24ZPX4S.js} +1 -1
  79. package/_assets/{index-B_LMReRp.js → index-CKNfn6Vk.js} +3 -3
  80. package/_assets/{index-CQcgp1iN.js → index-CKvAeyW_.js} +15 -15
  81. package/_assets/{index-r5mI5kyM.js → index-CLwiHF4x.js} +1 -1
  82. package/_assets/{index-0BDpDIn2.js → index-COIPDAvM.js} +1 -1
  83. package/_assets/{index-bzRnRmth.js → index-COvhkZx4.js} +1 -1
  84. package/_assets/{index-A2WELz1i.js → index-CUdjYgOL.js} +1 -1
  85. package/_assets/{index-DyZd30cj.js → index-CX9Whfxj.js} +1 -1
  86. package/_assets/{index-DvjiRC2A.js → index-C_QkMk4V.js} +2 -2
  87. package/_assets/{index-BBbwmK0l.js → index-Clxl6O3m.js} +1 -1
  88. package/_assets/{index-B5B624ZI.js → index-Cp14nZEB.js} +1 -1
  89. package/_assets/{index-CeL4_s5U.js → index-CrrW0USV.js} +1 -1
  90. package/_assets/{index-BQnu9AAN.js → index-CyM-uKEn.js} +1 -1
  91. package/_assets/{index-CgaQ8N3l.js → index-D6QGQCMT.js} +1 -1
  92. package/_assets/{index-CF9LZ4Pk.js → index-D7m3HL9N.js} +1 -1
  93. package/_assets/{index-sZGu86_-.js → index-DBb0SZED.js} +1 -1
  94. package/_assets/{index-CTzgZDYk.js → index-DCJUcLs-.js} +1 -1
  95. package/_assets/{index-sFbWswBz.js → index-DCTmqT9n.js} +1 -1
  96. package/_assets/{index-lPvPUzvE.js → index-DDY4z1Qo.js} +1 -1
  97. package/_assets/{index-D6_3K--Q.js → index-DFWSTox1.js} +3 -3
  98. package/_assets/{index-CFAC64qh.js → index-DQ3nh_Gh.js} +1 -1
  99. package/_assets/{index-Dn2HPDMP.js → index-Da6pHJ2U.js} +1 -1
  100. package/_assets/{index-9gH7d1pw.js → index-Ddv8zF_v.js} +1 -1
  101. package/_assets/{index-BEnF4ZEt.js → index-DgkhTIuB.js} +1 -1
  102. package/_assets/{index-BI5VO1OO.js → index-DmlmMlHx.js} +1 -1
  103. package/_assets/{index-DdVd4SPR.js → index-Dx8DDVd9.js} +1 -1
  104. package/_assets/{index-CPtRg_C7.js → index-DyTr5Odp.js} +1 -1
  105. package/_assets/{index-DnRSWMRH.js → index-E6nd8w7r.js} +1 -1
  106. package/_assets/{index-lx4soo8p.js → index-EDfm-4gk.js} +1 -1
  107. package/_assets/{index-B6og8PZ_.js → index-Fy8-NNgy.js} +1 -1
  108. package/_assets/{index-BZYSB-y8.js → index-M_xvfKlg.js} +1 -1
  109. package/_assets/{index-Clwpm5rF.js → index-PVirg3CC.js} +2 -2
  110. package/_assets/{index-QA15YkrB.js → index-SIu0g-iY.js} +1 -1
  111. package/_assets/{index-BhiVsshr.js → index-Yqi1mlp4.js} +1 -1
  112. package/_assets/{index-DMwxmOC-.js → index-a4DwWHMC.js} +2 -2
  113. package/_assets/{index-zMk1bCKk.js → index-hUwYbJaz.js} +1 -1
  114. package/_assets/{index-ZsOxcn-V.js → index-hycTvNv9.js} +1 -1
  115. package/_assets/{index-0EiwzvGv.js → index-p4aiSGwy.js} +1 -1
  116. package/_assets/{index-NhZwqKdi.js → index-tDQizk_n.js} +1 -1
  117. package/_assets/{index.es-DCKq1Q4u.js → index.es-4BnFbLIq.js} +1 -1
  118. package/_assets/{index.es-DC3-p8oq.js → index.es-CHF2aRm8.js} +1 -1
  119. package/_assets/{index.es-Cery6vYx.js → index.es-CuQzAuJf.js} +4 -4
  120. package/_assets/{localBatchGatewayRequest-CakoVxEr.js → localBatchGatewayRequest-BiaZ99qV.js} +1 -1
  121. package/_assets/{mana-convert-CM0Q2I_C.js → mana-convert-fQ28xr65.js} +1 -1
  122. package/_assets/{mana-rate-CeJoK8Ap.js → mana-rate-CX4vkbTv.js} +1 -1
  123. package/_assets/{networks--__aHdrr.js → networks-BLWCcklV.js} +1 -1
  124. package/_assets/{onramp-wc4LPqM7.js → onramp-ofeNemBP.js} +1 -1
  125. package/_assets/{openzeppelin-zwMHXsd3.js → openzeppelin-CQ4xxvCW.js} +1 -1
  126. package/_assets/{parseNft-BUu0QaJy.js → parseNft-BA1YqoMO.js} +2 -2
  127. package/_assets/{parseSignature-BZlrbItT.js → parseSignature-Bv3a-ckt.js} +1 -1
  128. package/_assets/{parseSignature-CCc3N6DW.js → parseSignature-CdZk3HUU.js} +3 -3
  129. package/_assets/{passkeys-CMzs7qc5.js → passkeys-cIb8SYvN.js} +1 -1
  130. package/_assets/{pay-with-exchange-Dd49V9Dt.js → pay-with-exchange-DgR6jsOE.js} +1 -1
  131. package/_assets/{qr-overlay-X953Lq1h.js → qr-overlay-Cfft7a0M.js} +1 -1
  132. package/_assets/{receive-CYngkOdA.js → receive-BKMf0MUc.js} +1 -1
  133. package/_assets/{resolveImplementation-CyNwBdrv.js → resolveImplementation-BUhQkFuG.js} +1 -1
  134. package/_assets/{rpc-A101vo1F.js → rpc-BSCW9r0K.js} +1 -1
  135. package/_assets/{secp256k1-DiREPdz-.js → secp256k1-Cc7ZGphI.js} +1 -1
  136. package/_assets/{secp256k1-C1ir3QUf.js → secp256k1-D7Ic1AnI.js} +1 -1
  137. package/_assets/{secp256k1-ZO5i3UBI.js → secp256k1-DZ_AtAE9.js} +1 -1
  138. package/_assets/{send-BjMRCe3K.js → send-D0GDu_vS.js} +1 -1
  139. package/_assets/{send-batch-transaction-Da1R2WBg.js → send-batch-transaction-Bx_S55BL.js} +1 -1
  140. package/_assets/{send-eip712-transaction-B5gxvF81.js → send-eip712-transaction-BeQ_HoA6.js} +2 -2
  141. package/_assets/{send-gasless-transaction-BfnxJUcj.js → send-gasless-transaction-mq5auYkP.js} +2 -2
  142. package/_assets/{send-transaction-dG8UnQfd.js → send-transaction-D3g0h3x8.js} +2 -2
  143. package/_assets/{sendMetaTransaction-BGqAABs-.js → sendMetaTransaction-CfYBmJqE.js} +1 -1
  144. package/_assets/{sendRawTransaction-C5vaHC9F.js → sendRawTransaction-Bdfd1V50.js} +3 -3
  145. package/_assets/{serializeTransaction-Cvt7VAIM.js → serializeTransaction-Bq1icuDU.js} +1 -1
  146. package/_assets/{session-proposal-DA6rberG.js → session-proposal-CeKp7mKZ.js} +1 -1
  147. package/_assets/{session-request-BaWpiqBo.js → session-request-CZ68hd2h.js} +2 -2
  148. package/_assets/{signing-Chnvri1K.js → signing-C7pGWbAD.js} +3 -3
  149. package/_assets/{socials-hE6J6zOy.js → socials-DVfxwwog.js} +1 -1
  150. package/_assets/{swaps-D_Lt2d6x.js → swaps-BHlzfOa6.js} +1 -1
  151. package/_assets/{thirdweb-Tb-ufCdH.js → thirdweb-PU38RH0J.js} +3 -3
  152. package/_assets/{to-serializable-transaction-W4CacvUz.js → to-serializable-transaction-gDnQ8f6A.js} +2 -2
  153. package/_assets/{trade-encoding-B96eH7PK.js → trade-encoding-DPKBDNkR.js} +1 -1
  154. package/_assets/{transactionReceipt-DnMO0Z8h.js → transactionReceipt-CkDBxTqo.js} +1 -1
  155. package/_assets/{transactions-6WSEOyUR.js → transactions-CC5Z4LdW.js} +1 -1
  156. package/_assets/{useCreditPacks-BZBHQn_t.js → useCreditPacks-CQXC1itx.js} +1 -1
  157. package/_assets/{useInfiniteGrid-qZQR98Xh.js → useInfiniteGrid-CK8TA2xA.js} +1 -1
  158. package/_assets/useManaRate-DvHMbg5D.js +1 -0
  159. package/_assets/{useSecondarySales-zW5jqf5K.js → useSecondarySales-BVKMem4L.js} +1 -1
  160. package/_assets/{useStore-DwuNHIk7.js → useStore-55b8sEvt.js} +1 -1
  161. package/_assets/{useTheme-tTpRSzCd.js → useTheme-s40vMPeT.js} +1 -1
  162. package/_assets/{verifyHash-Dcr5MdX9.js → verifyHash-UTScJ5vY.js} +1 -1
  163. package/_assets/{w3m-modal-DMVGcuSf.js → w3m-modal-BcGHx_GU.js} +1 -1
  164. package/_assets/{w3m-modal-DPuioRY2.js → w3m-modal-DvvX0FR6.js} +1 -1
  165. package/_assets/{wait-for-tx-receipt-BPEAu1db.js → wait-for-tx-receipt-DeBOMM1R.js} +1 -1
  166. package/_assets/{wallets-CuSH1SoT.js → wallets-JW3aPEWT.js} +5 -5
  167. package/_assets/{web-connector-_VNzZMNS.js → web-connector-RvG-aCdp.js} +3 -3
  168. package/_assets/{writeContract-DHS3WdjH.js → writeContract-Dqe7Ta-l.js} +1 -1
  169. package/_assets/{zoraTestnet-B4hShQFd.js → zoraTestnet-DDg_i6X6.js} +1 -1
  170. package/index.html +11 -11
  171. package/package.json +2 -2
  172. package/_assets/useManaRate-oLihTkP0.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{aJ 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,aK as G,aL as K,aM as pt,z as k,aN as gt,ap as T,K as ft,aO as yt,aP as C}from"./index-CQcgp1iN.js";import{m as bt}from"./mana-convert-CM0Q2I_C.js";import{u as jt}from"./useManaRate-oLihTkP0.js";import{L as vt}from"./LoadMore-Bqx1IcKy.js";import{u as y}from"./useInfiniteGrid-qZQR98Xh.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-CeJoK8Ap.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-30830755583.commit-4658b42/_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{aJ 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,aK as G,aL as K,aM as pt,z as k,aN as gt,ap as T,K as ft,aO as yt,aP as C}from"./index-CKvAeyW_.js";import{m as bt}from"./mana-convert-fQ28xr65.js";import{u as jt}from"./useManaRate-DvHMbg5D.js";import{L as vt}from"./LoadMore-DoQvuFO_.js";import{u as y}from"./useInfiniteGrid-CK8TA2xA.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-CX4vkbTv.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-30835612462.commit-48765f9/_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-CQcgp1iN.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-30830755583.commit-4658b42/_assets/custom-welcome-background-BxlFQma9.webp",b="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830755583.commit-4658b42/_assets/DCL_LogoPattern-BryBPc3d.png",U=`
1
+ import{r as l,j as v}from"./react-vyZjIDcS.js";import{s as u}from"./index-CKvAeyW_.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-30835612462.commit-48765f9/_assets/custom-welcome-background-BxlFQma9.webp",b="https://cdn.decentraland.org/@dcl/shop/0.1.0-30835612462.commit-48765f9/_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,av as Ke,aw as Ze,d as Je,s as n,t,n as Ie,al as Qe,D as Xe,K as Ae,y as Ye,e as s,I as _,z as W,aS as he,aj as et,ar as J,az as tt,ay as nt,m as Ne,o as st,S as fe,A as O,aT as ot,aU as it}from"./index-CQcgp1iN.js";import{u as rt}from"./useSecondarySales-zW5jqf5K.js";import{a as at,m as Me}from"./mana-convert-CM0Q2I_C.js";import{u as Pe}from"./useManaRate-oLihTkP0.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-EoOzQAcv.js";import{c as me,R as Et,F as _t,S as Tt}from"./categories-BU8sQA4o.js";import{L as Rt}from"./LoadMore-Bqx1IcKy.js";import{u as zt}from"./useInfiniteGrid-qZQR98Xh.js";import{E as It}from"./ErrorNotice-BZqsZ4rX.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-BM1gL-pK.js";import{s as Bt}from"./buy-F7fYGwQJ.js";import{i as Ft}from"./trade-encoding-B96eH7PK.js";import{r as Lt}from"./mana-rate-CeJoK8Ap.js";import{f as Ut}from"./errors-BkMwx-kf.js";import{J as Ht,C as Ot,B as ee}from"./ethers-CXBJm_wN.js";import{n as Dt}from"./Tooltip-BqiXiZUp.js";import{G as Gt}from"./grid.styles-BlUHs1Am.js";import"./sentry-B35L1FdR.js";import"./intl-CBcMB1D2.js";import"./authorizations-Bz3S6EIM.js";import"./sendMetaTransaction-BGqAABs-.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 Kt=["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 Zt(){return B.chainId===Number(At.ChainId.MATIC_MAINNET)?ge.mainnet:ge.sepolia}async function Jt(o,i={}){var p;const{rpc:l,address:x}=Zt(),c=new Ht(l),d=new Ot(x,Kt,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 Ke(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 Ze(l,[p]).catch(()=>{}),u instanceof Be)throw u;const b=new Error(Ut(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,av as Ke,aw as Ze,d as Je,s as n,t,n as Ie,al as Qe,D as Xe,K as Ae,y as Ye,e as s,I as _,z as W,aS as he,aj as et,ar as J,az as tt,ay as nt,m as Ne,o as st,S as fe,A as O,aT as ot,aU as it}from"./index-CKvAeyW_.js";import{u as rt}from"./useSecondarySales-BVKMem4L.js";import{a as at,m as Me}from"./mana-convert-fQ28xr65.js";import{u as Pe}from"./useManaRate-DvHMbg5D.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-BO8jltml.js";import{c as me,R as Et,F as _t,S as Tt}from"./categories-DFgZJeSL.js";import{L as Rt}from"./LoadMore-DoQvuFO_.js";import{u as zt}from"./useInfiniteGrid-CK8TA2xA.js";import{E as It}from"./ErrorNotice-q0dn0iRL.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-Cxl5QDDd.js";import{s as Bt}from"./buy-DN9Q4fmJ.js";import{i as Ft}from"./trade-encoding-DPKBDNkR.js";import{r as Lt}from"./mana-rate-CX4vkbTv.js";import{f as Ut}from"./errors-BshsHqbY.js";import{J as Ht,C as Ot,B as ee}from"./ethers-CXBJm_wN.js";import{n as Dt}from"./Tooltip-BLyu7Dfk.js";import{G as Gt}from"./grid.styles-Dc-BunHd.js";import"./sentry-B35L1FdR.js";import"./intl-CBcMB1D2.js";import"./authorizations-DDsnY_Zf.js";import"./sendMetaTransaction-CfYBmJqE.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 Kt=["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 Zt(){return B.chainId===Number(At.ChainId.MATIC_MAINNET)?ge.mainnet:ge.sepolia}async function Jt(o,i={}){var p;const{rpc:l,address:x}=Zt(),c=new Ht(l),d=new Ot(x,Kt,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 Ke(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 Ze(l,[p]).catch(()=>{}),u instanceof Be)throw u;const b=new Error(Ut(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,av
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=T=>{T.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(Te,{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(Te,{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-30830755583.commit-4658b42/_assets/identity-B4DXDuJP.webp",Tn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830755583.commit-4658b42/_assets/world-B-9aPlxu.webp",Rn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830755583.commit-4658b42/_assets/invite-BfwIhP2C.webp",zn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830755583.commit-4658b42/_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=T=>{T.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(Te,{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(Te,{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-30835612462.commit-48765f9/_assets/identity-B4DXDuJP.webp",Tn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30835612462.commit-48765f9/_assets/world-B-9aPlxu.webp",Rn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30835612462.commit-48765f9/_assets/invite-BfwIhP2C.webp",zn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30835612462.commit-48765f9/_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-BU8sQA4o.js";import{n as c,T as se}from"./Tooltip-BqiXiZUp.js";import{t as e,s as o,I as g,e as s,o as ae,h as v}from"./index-CQcgp1iN.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-DFgZJeSL.js";import{n as c,T as se}from"./Tooltip-BLyu7Dfk.js";import{t as e,s as o,I as g,e as s,o as ae,h as v}from"./index-CKvAeyW_.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 i,L as _,r as F}from"./react-vyZjIDcS.js";import{s as n,B as G,t as a,x as D,m as P,e,n as W,y as O,I as b,z as B,u as w,D as K,c as Q,E as H,F as A,l as X,G as Z,q as E}from"./index-CQcgp1iN.js";import{a as J,b as U,c as V,d as Y,s as tt,f as it}from"./authorizations-Bz3S6EIM.js";import{a as et}from"./builder-78T8aZCf.js";import{m as ot}from"./mana-matic-C4e1sNO3.js";import{f as at}from"./errors-BkMwx-kf.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-BGqAABs-.js";const nt=D`
1
+ import{j as i,L as _,r as F}from"./react-vyZjIDcS.js";import{s as n,B as G,t as a,x as D,m as P,e,n as W,y as O,I as b,z as B,u as w,D as K,c as Q,E as H,F as A,l as X,G as Z,q as E}from"./index-CKvAeyW_.js";import{a as J,b as U,c as V,d as Y,s as tt,f as it}from"./authorizations-DDsnY_Zf.js";import{a as et}from"./builder-BO6I7uZQ.js";import{m as ot}from"./mana-matic-C4e1sNO3.js";import{f as at}from"./errors-BshsHqbY.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-CfYBmJqE.js";const nt=D`
2
2
  to { transform: rotate(360deg); }
3
3
  `,st=D`
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,K as de,aj as aa,H as sa,I as H,z as Mt,J as Ue,m as na,ak as Q,R as dt,n as ia,u as ra,al as oa,D as ca,am as da,an as la,ao as ua,ap as ha,y as pa,aq as lt,ar as G,as as ut,at as ga,l as ae,c as ht,au as xa,h as ma,av as pt,aw as _e,ax as ye,ay as be,az as gt,a as ve,b as fa,C as We,aA as ya}from"./index-CQcgp1iN.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 Ra,n as mt,o as ft,W as Ba,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-DrpF7Bml.js";import{u as cs}from"./useManaRate-oLihTkP0.js";import{r as ds}from"./mana-rate-CeJoK8Ap.js";import{i as ls,j as us,f as hs,n as ps,h as gs,A as xs}from"./authorizations-Bz3S6EIM.js";import{g as ms,b as Le}from"./buy-F7fYGwQJ.js";import{b as fs,w as ys,S as vt,G as bs}from"./buy-gasless-BM1gL-pK.js";import{u as vs,M as ws,R as we,r as Cs,c as js,p as wt}from"./useCreditPacks-BZBHQn_t.js";import{i as ks,a as $s}from"./errors-BkMwx-kf.js";import{E as Ss}from"./ErrorNotice-BZqsZ4rX.js";import{u as Ct}from"./mana-convert-CM0Q2I_C.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-B96eH7PK.js";import"./sendMetaTransaction-BGqAABs-.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,K as de,aj as aa,H as sa,I as H,z as Mt,J as Ue,m as na,ak as Q,R as dt,n as ia,u as ra,al as oa,D as ca,am as da,an as la,ao as ua,ap as ha,y as pa,aq as lt,ar as G,as as ut,at as ga,l as ae,c as ht,au as xa,h as ma,av as pt,aw as _e,ax as ye,ay as be,az as gt,a as ve,b as fa,C as We,aA as ya}from"./index-CKvAeyW_.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 Ra,n as mt,o as ft,W as Ba,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-WI45XOFA.js";import{u as cs}from"./useManaRate-DvHMbg5D.js";import{r as ds}from"./mana-rate-CX4vkbTv.js";import{i as ls,j as us,f as hs,n as ps,h as gs,A as xs}from"./authorizations-DDsnY_Zf.js";import{g as ms,b as Le}from"./buy-DN9Q4fmJ.js";import{b as fs,w as ys,S as vt,G as bs}from"./buy-gasless-Cxl5QDDd.js";import{u as vs,M as ws,R as we,r as Cs,c as js,p as wt}from"./useCreditPacks-CQXC1itx.js";import{i as ks,a as $s}from"./errors-BshsHqbY.js";import{E as Ss}from"./ErrorNotice-q0dn0iRL.js";import{u as Ct}from"./mana-convert-fQ28xr65.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-DPKBDNkR.js";import"./sendMetaTransaction-CfYBmJqE.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-30830755583.commit-4658b42/_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(Rs,{stage:o.stage??"reserving",step:o.step??1,total:o.total??1,isSelfCustody:!!o.isSelfCustody,signatures:o.signatures}),l==="nofunds"&&e.jsx(Bs,{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 Rs({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(Ra,{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 Bs({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(Ba,{"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-30835612462.commit-48765f9/_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(Rs,{stage:o.stage??"reserving",step:o.step??1,total:o.total??1,isSelfCustody:!!o.isSelfCustody,signatures:o.signatures}),l==="nofunds"&&e.jsx(Bs,{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 Rs({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(Ra,{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 Bs({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(Ba,{"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{N,O as U,P as o,Q as n,J as D,x as M}from"./index-CQcgp1iN.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-BJUFu5Pv.js";function K(r){return z("MuiCircularProgress",r)}E("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const W=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,b,S,$;const t=44,B=M(P||(P=l`
1
+ import{N,O as U,P as o,Q as n,J as D,x as M}from"./index-CKvAeyW_.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-Dv5E4mS4.js";function K(r){return z("MuiCircularProgress",r)}E("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const W=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,b,S,$;const t=44,B=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,ag as J,E,I as X,e as a,c as ee,l as te,u as ae,m as re,h as oe,S as z,A as ie,ah as se,ai as ne}from"./index-CQcgp1iN.js";import{E as ce}from"./ErrorNotice-BZqsZ4rX.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-DKcUvFq-.js";import{u as ve}from"./useStore-DwuNHIk7.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-BU8sQA4o.js";import{L as $e}from"./LoadMore-Bqx1IcKy.js";import{u as Pe}from"./useInfiniteGrid-qZQR98Xh.js";import{G as Me}from"./grid.styles-BlUHs1Am.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,ag as J,E,I as X,e as a,c as ee,l as te,u as ae,m as re,h as oe,S as z,A as ie,ah as se,ai as ne}from"./index-CKvAeyW_.js";import{E as ce}from"./ErrorNotice-q0dn0iRL.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-u63rKyzf.js";import{u as ve}from"./useStore-55b8sEvt.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-DFgZJeSL.js";import{L as $e}from"./LoadMore-DoQvuFO_.js";import{u as Pe}from"./useInfiniteGrid-CK8TA2xA.js";import{G as Me}from"./grid.styles-Dc-BunHd.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,K as j,bd as C,h as G,x as Y,I as Q,l as X,a as W,C as E,b as Z,be as J,bf as F,A as q}from"./index-CQcgp1iN.js";import{s as ee,h as U,A as H,g as K,r as te,m as ne,e as ae}from"./authorizations-Bz3S6EIM.js";import{i as ie}from"./errors-BkMwx-kf.js";import{E as oe}from"./ErrorNotice-BZqsZ4rX.js";import{a as se}from"./buy-F7fYGwQJ.js";import{g as re,d as ce}from"./trade-encoding-B96eH7PK.js";import{s as de,M as le,E as pe}from"./sendMetaTransaction-BGqAABs-.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,K as j,bd as C,h as G,x as Y,I as Q,l as X,a as W,C as E,b as Z,be as J,bf as F,A as q}from"./index-CKvAeyW_.js";import{s as ee,h as U,A as H,g as K,r as te,m as ne,e as ae}from"./authorizations-DDsnY_Zf.js";import{i as ie}from"./errors-BshsHqbY.js";import{E as oe}from"./ErrorNotice-q0dn0iRL.js";import{a as se}from"./buy-DN9Q4fmJ.js";import{g as re,d as ce}from"./trade-encoding-DPKBDNkR.js";import{s as de,M as le,E as pe}from"./sendMetaTransaction-CfYBmJqE.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 J,aB as we,aC as R,aD as _,s as a,aE as je,H as ve,aF as Ce,e as t,aG as W,B as ye,J as Z,ag as q,n as $e,E as Q,I as T,c as ke,m as Ne,S,h as Pe,A as Se,aA as Le,aH as Ae}from"./index-CQcgp1iN.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 He,e as Ge,f as Ue}from"./browseLayout.styles-DKcUvFq-.js";import{u as De,L as Ke}from"./useStore-DwuNHIk7.js";import{c as H,a as Oe,F as Ve,d as Ye,P as Je,e as Ze,H as qe,S as Qe}from"./categories-BU8sQA4o.js";import{L as G}from"./LoadMore-Bqx1IcKy.js";import{u as U}from"./useInfiniteGrid-qZQR98Xh.js";import{E as D}from"./ErrorNotice-BZqsZ4rX.js";import{G as K}from"./grid.styles-BlUHs1Am.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}=J,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 J,aB as we,aC as R,aD as _,s as a,aE as je,H as ve,aF as Ce,e as t,aG as W,B as ye,J as Z,ag as q,n as $e,E as Q,I as T,c as ke,m as Ne,S,h as Pe,A as Se,aA as Le,aH as Ae}from"./index-CKvAeyW_.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 He,e as Ge,f as Ue}from"./browseLayout.styles-u63rKyzf.js";import{u as De,L as Ke}from"./useStore-55b8sEvt.js";import{c as H,a as Oe,F as Ve,d as Ye,P as Je,e as Ze,H as qe,S as Qe}from"./categories-DFgZJeSL.js";import{L as G}from"./LoadMore-DoQvuFO_.js";import{u as U}from"./useInfiniteGrid-CK8TA2xA.js";import{E as D}from"./ErrorNotice-q0dn0iRL.js";import{G as K}from"./grid.styles-Dc-BunHd.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}=J,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-CQcgp1iN.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-CKvAeyW_.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-wKXZD-Zq.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-SnHJ4jHh.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-1MRMKUrL.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-2OVx4iJi.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,ar as f,ap as me,l as N,az as H,I as re,aj as D,z as E,aR as K}from"./index-CQcgp1iN.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-BZBHQn_t.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./mana-convert-CM0Q2I_C.js";const P="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830755583.commit-4658b42/_assets/pack-coins-BDh1ZDbh.webp",ne="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830755583.commit-4658b42/_assets/pack-stacks-D-V2jSHW.webp",se="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830755583.commit-4658b42/_assets/pack-chest-BX_j84xW.webp",$e="https://cdn.decentraland.org/@dcl/shop/0.1.0-30830755583.commit-4658b42/_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-30830755583.commit-4658b42/_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,ar as f,ap as me,l as N,az as H,I as re,aj as D,z as E,aR as K}from"./index-CKvAeyW_.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-CQXC1itx.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./mana-convert-fQ28xr65.js";const P="https://cdn.decentraland.org/@dcl/shop/0.1.0-30835612462.commit-48765f9/_assets/pack-coins-BDh1ZDbh.webp",ne="https://cdn.decentraland.org/@dcl/shop/0.1.0-30835612462.commit-48765f9/_assets/pack-stacks-D-V2jSHW.webp",se="https://cdn.decentraland.org/@dcl/shop/0.1.0-30835612462.commit-48765f9/_assets/pack-chest-BX_j84xW.webp",$e="https://cdn.decentraland.org/@dcl/shop/0.1.0-30835612462.commit-48765f9/_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-30835612462.commit-48765f9/_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-6BrQFoiH.js";import{d as g,r as v}from"./index-SnHJ4jHh.js";import{C as c}from"./ConstantsUtil-Dfwpy1eP.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-wKXZD-Zq.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-Bjz1afXG.js";import{d as g,r as v}from"./index-2OVx4iJi.js";import{C as c}from"./ConstantsUtil-Dfwpy1eP.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-1MRMKUrL.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 Q,B as I,z,ar as ne,aQ as K,l as W,m as re,n as oe,D as ae,u as de,F as ce}from"./index-CQcgp1iN.js";import{i as le,R as pe,f as ge}from"./import-HMOgDc9D.js";import{u as xe}from"./useSecondarySales-zW5jqf5K.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./buy-F7fYGwQJ.js";import"./authorizations-Bz3S6EIM.js";import"./sendMetaTransaction-BGqAABs-.js";import"./trade-encoding-B96eH7PK.js";import"./mana-rate-CeJoK8Ap.js";import"./mana-convert-CM0Q2I_C.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 Q,B as I,z,ar as ne,aQ as K,l as W,m as re,n as oe,D as ae,u as de,F as ce}from"./index-CKvAeyW_.js";import{i as le,R as pe,f as ge}from"./import-DOwZHLAr.js";import{u as xe}from"./useSecondarySales-BVKMem4L.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./buy-DN9Q4fmJ.js";import"./authorizations-DDsnY_Zf.js";import"./sendMetaTransaction-CfYBmJqE.js";import"./trade-encoding-DPKBDNkR.js";import"./mana-rate-CX4vkbTv.js";import"./mana-convert-fQ28xr65.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;