@dcl/shop 0.1.0-30133871697.commit-2ebb498 → 0.1.0-30216809991.commit-6a5fe36

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 (169) hide show
  1. package/assets/{Activity-gX01fOn1.js → Activity-p0Gv2QHT.js} +1 -1
  2. package/assets/{AnimatedBackground-BcZFP3Pq.js → AnimatedBackground-DnQr-9Mq.js} +3 -3
  3. package/assets/{Assets-Dq1jEm1M.js → Assets-Dcq0ZtLs.js} +1 -1
  4. package/assets/{Assets.styles-BjRnkieR.js → Assets.styles-D1Wq-TGU.js} +1 -1
  5. package/assets/{Authorizations-ST2Ksxu2.js → Authorizations-h0EkrJ0e.js} +1 -1
  6. package/assets/{Button-B5fJsLQz.js → Button-C483PxiV.js} +1 -1
  7. package/assets/{Cart-Cm7Ro9Zg.js → Cart-yl6RsJLo.js} +1 -1
  8. package/assets/{CircularProgress-BOlrlIsy.js → CircularProgress-CD6e_OY0.js} +1 -1
  9. package/assets/{Collection-CVnDwKTq.js → Collection-BuNkbz0w.js} +1 -1
  10. package/assets/{CollectionCarousel-CrNhWA-o.js → CollectionCarousel-b8Pkk8Km.js} +1 -1
  11. package/assets/{Creator-BJQdfcDy.js → Creator-Bum8upfQ.js} +1 -1
  12. package/assets/{ExchangeController-BMLTvv35.js → ExchangeController-BP6YJw76.js} +1 -1
  13. package/assets/{GetCredits-NwyjnfXT.js → GetCredits-QZ5OleLz.js} +1 -1
  14. package/assets/{HelpersUtil-blirPsD-.js → HelpersUtil-DuOrR9po.js} +1 -1
  15. package/assets/{ImportListings-bh6vN4Da.js → ImportListings-ChXKaCQz.js} +1 -1
  16. package/assets/{ItemDetail-BMSsPEpH.js → ItemDetail-kt1pYKGI.js} +94 -88
  17. package/assets/{LoadMore-B-s5G0me.js → LoadMore-D8ty75NY.js} +1 -1
  18. package/assets/{MarketCheckout-B49jmgSp.js → MarketCheckout-D0iyzaVw.js} +1 -1
  19. package/assets/{MenuList-FlHFmpzz.js → MenuList-BlgDyhwx.js} +1 -1
  20. package/assets/{MyAssets-B1ayGmqi.js → MyAssets-mMvbaZIu.js} +1 -1
  21. package/assets/{MyFavorites-5fee_O_x.js → MyFavorites-DrFwMGOz.js} +1 -1
  22. package/assets/{NotFound-CrXtR1yD.js → NotFound-irCZ2J9j.js} +1 -1
  23. package/assets/{NotificationsBell-C1ruQm-B.js → NotificationsBell-CWM_V8VA.js} +1 -1
  24. package/assets/{StoreSettings-hmXrDY12.js → StoreSettings-DO0XM0zv.js} +6 -6
  25. package/assets/{Success-C9uPuvRL.js → Success-Deh0S9r8.js} +1 -1
  26. package/assets/{SwapController-7nCdO1U5.js → SwapController-eYsqHQVq.js} +1 -1
  27. package/assets/{Tooltip-g1zVFNbN.js → Tooltip-D5x9mtLq.js} +1 -1
  28. package/assets/{TradeService-DDaxyeeY.js → TradeService-CyVIwnXr.js} +1 -1
  29. package/assets/{W3MFrameProviderSingleton-CSS0v250.js → W3MFrameProviderSingleton-8Loh-tcg.js} +3 -3
  30. package/assets/{WebCryptoP256-Dd-qNk1N.js → WebCryptoP256-_5YOzGku.js} +1 -1
  31. package/assets/{authorizations-CfRBicRM.js → authorizations-DRmWTFDz.js} +1 -1
  32. package/assets/{basic-cXgzHrk4.js → basic-Dgdmjvu-.js} +1 -1
  33. package/assets/{biconomy-BD95tc6J.js → biconomy-CTB1iEZo.js} +1 -1
  34. package/assets/{builder-InlokaP6.js → builder-C82LQxNu.js} +1 -1
  35. package/assets/{buy-BIt1DjVh.js → buy-CXClikLg.js} +1 -1
  36. package/assets/{buy-gasless-DEhbR0zX.js → buy-gasless-Bw8QJ3nL.js} +1 -1
  37. package/assets/{cart-checkout-DbfpnMCR.js → cart-checkout-BLQod-hb.js} +1 -1
  38. package/assets/{categories-BhIJhSSv.js → categories-7z3tYoma.js} +1 -1
  39. package/assets/{ccip-Bv1a4Yma.js → ccip-D-ohWyZn.js} +1 -1
  40. package/assets/{ccip-Cw-8qrBn.js → ccip-bWj-X9bi.js} +1 -1
  41. package/assets/{collection-C81dinEb.js → collection-COS6jpIf.js} +1 -1
  42. package/assets/{controller-BylrM6_v.js → controller-BZD1JOom.js} +2 -2
  43. package/assets/{core-eHNalNm4.js → core-C_GtTJNN.js} +4 -4
  44. package/assets/{custom-_W6fFDpX.js → custom-CAN35ixC.js} +1 -1
  45. package/assets/{data-capture-BxdAy2sl.js → data-capture-B-5GIEdn.js} +1 -1
  46. package/assets/{email-bZ6wRCkD.js → email-7cQ5BcKt.js} +1 -1
  47. package/assets/{embedded-wallet-DbI0v7TE.js → embedded-wallet-CSbr0hGE.js} +1 -1
  48. package/assets/{emotion-styled.browser.esm-B91CdXZp.js → emotion-styled.browser.esm-CqAclZX0.js} +1 -1
  49. package/assets/{engine-B01gKfmv.js → engine-InYIweSO.js} +1 -1
  50. package/assets/{errors-CevO4-B_.js → errors-BoZbc8ja.js} +1 -1
  51. package/assets/{estimate-l1-fee-V0nqca67.js → estimate-l1-fee-DCl5Ufw3.js} +1 -1
  52. package/assets/{execute-CtC0aukb.js → execute-DpamAJLp.js} +2 -2
  53. package/assets/{features-DobOb6a4.js → features-Rjg-ANH0.js} +1 -1
  54. package/assets/{fetchTokenMetadata-BDfA4fxa.js → fetchTokenMetadata-AJ4lKXX9.js} +2 -2
  55. package/assets/{get-ecosystem-wallet-info-CRAxsX5A.js → get-ecosystem-wallet-info-CKj02gSt.js} +1 -1
  56. package/assets/{getBalance-IhjxbhOH.js → getBalance-BqYttXHj.js} +1 -1
  57. package/assets/{getNFT-D3q95MH5.js → getNFT-BJkpOLzg.js} +1 -1
  58. package/assets/{getNFT-Cy_TLxNg.js → getNFT-BOt74c7e.js} +1 -1
  59. package/assets/{getThemeProps-DXO8GAe-.js → getThemeProps-mcuaUO8y.js} +1 -1
  60. package/assets/{hashTypedData-0ex2klzG.js → hashTypedData-BFbifruY.js} +1 -1
  61. package/assets/{hashTypedData-BvnMw7-W.js → hashTypedData-Dwz0CvVq.js} +1 -1
  62. package/assets/{import-DCJnhgeF.js → import-CMJHvuBQ.js} +1 -1
  63. package/assets/{in-app-d1EIziHl.js → in-app-DGKkRjiU.js} +1 -1
  64. package/assets/{in-app-wallet-calls-B_X-nI2j.js → in-app-wallet-calls-DsURwMZt.js} +1 -1
  65. package/assets/{index-Bg1ZNPTw.js → index-0dt_-EWV.js} +1 -1
  66. package/assets/{index-BvFAHBPw.js → index-B3usVPuW.js} +1 -1
  67. package/assets/{index-DAkVX2rn.js → index-B9DJzC9W.js} +1 -1
  68. package/assets/{index-BVNUCwoW.js → index-BFbFleR2.js} +1 -1
  69. package/assets/{index-2sUFrijZ.js → index-BLYcSCqE.js} +1 -1
  70. package/assets/{index-D7WOoyG2.js → index-BOkJyEiZ.js} +1 -1
  71. package/assets/{index-CFAO03Mm.js → index-BRp1Hi5c.js} +3 -3
  72. package/assets/{index-lonwQF-A.js → index-Bh3QXfF7.js} +1 -1
  73. package/assets/{index-4QjFMRJM.js → index-BmG2cJb0.js} +1 -1
  74. package/assets/{index-C1iu8iFi.js → index-BmhN1IpY.js} +1 -1
  75. package/assets/{index-BbpXvktu.js → index-BovcADsh.js} +1 -1
  76. package/assets/{index-Bs0gslDD.js → index-BqPFEzHK.js} +1 -1
  77. package/assets/{index-BK8hpvmz.js → index-ByBK3zAq.js} +1 -1
  78. package/assets/{index-nFVdOOJ4.js → index-C91ic8D1.js} +1 -1
  79. package/assets/{index-B_qqDPlw.js → index-CHMAXqpk.js} +1 -1
  80. package/assets/{index-DyKUzG8Y.js → index-CJqz0URZ.js} +1 -1
  81. package/assets/{index-CtKD8E50.js → index-CMPZPIlN.js} +1 -1
  82. package/assets/{index-BNE2syyg.js → index-CO-S9ny1.js} +1 -1
  83. package/assets/{index-s056mQ5V.js → index-CQ7zHnQz.js} +25 -25
  84. package/assets/{index-CvkS52F9.js → index-CUfExZ9o.js} +1 -1
  85. package/assets/{index-BY4jMTMx.js → index-CYPyPkPv.js} +1 -1
  86. package/assets/{index-DcRGF9AB.js → index-CYylIN_g.js} +1 -1
  87. package/assets/{index-C1ObOz4r.js → index-CZJgPwNX.js} +1 -1
  88. package/assets/{index-CF75eDmC.js → index-CanXSl5D.js} +2 -2
  89. package/assets/{index-C1kCjuW_.js → index-CcKCkHsm.js} +1 -1
  90. package/assets/{index-CfZU7JZ8.js → index-CfvEFeJy.js} +1 -1
  91. package/assets/{index-DD481f9l.js → index-CpWvcPRx.js} +3 -3
  92. package/assets/{index-DHRIl4kO.js → index-CqIPLlwY.js} +1 -1
  93. package/assets/{index-DyEhiyex.js → index-CuQBA8zv.js} +1 -1
  94. package/assets/{index-CqTyoGcx.js → index-CxAUKMI5.js} +1 -1
  95. package/assets/{index-C1HJ4_9f.js → index-Cyg21C4C.js} +1 -1
  96. package/assets/{index-CQ6Kx0mL.js → index-CzrbZ0gX.js} +1 -1
  97. package/assets/{index-Dk71d1Cj.js → index-D9VGAjdG.js} +1 -1
  98. package/assets/{index-DA95kUS1.js → index-DDUD_YNg.js} +1 -1
  99. package/assets/{index-ChH5Jg4B.js → index-DL6bFhJF.js} +2 -2
  100. package/assets/{index-BwV4V8ew.js → index-DPrFtnxd.js} +1 -1
  101. package/assets/{index-Dd36z0m0.js → index-DRP0urBC.js} +1 -1
  102. package/assets/{index-D3TOJ6mv.js → index-DX8NS5sw.js} +1 -1
  103. package/assets/{index-BKlRsJAx.js → index-DXpvdibF.js} +1 -1
  104. package/assets/{index-aAl_aW1H.js → index-DZj_LkVv.js} +1 -1
  105. package/assets/{index-CGJaoBK1.js → index-Da6TtbpY.js} +3 -3
  106. package/assets/{index-CX5CK71g.js → index-Drmzd35g.js} +1 -1
  107. package/assets/{index-zKsnnSgr.js → index-Ef29yGW8.js} +1 -1
  108. package/assets/{index-BDd-bL6J.js → index-H-r202nh.js} +2 -2
  109. package/assets/{index-DFo_ZRYH.js → index-L7YgxqTz.js} +1 -1
  110. package/assets/{index-CgvcHmR7.js → index-YyewAtxu.js} +1 -1
  111. package/assets/{index-DCy3UdsY.js → index-a62MEGzC.js} +1 -1
  112. package/assets/{index-ZsWOupBf.js → index-crVxZA-3.js} +1 -1
  113. package/assets/{index-atL8DMAD.js → index-eR2BQEn3.js} +1 -1
  114. package/assets/{index-lia1DHpb.js → index-pCZmKsUc.js} +1 -1
  115. package/assets/{index-BMfvPaeE.js → index-ycAekMh-.js} +1 -1
  116. package/assets/{index.es-BdVIt87u.js → index.es-Clfd8n9X.js} +1 -1
  117. package/assets/{index.es-Df5aw0SC.js → index.es-DlF_3uv_.js} +4 -4
  118. package/assets/{index.es-DN16GURc.js → index.es-xajRQQ-9.js} +1 -1
  119. package/assets/{localBatchGatewayRequest-IqnQgBVr.js → localBatchGatewayRequest-CxV7CkF0.js} +1 -1
  120. package/assets/{mana-rate-C7Xb6QOI.js → mana-rate-HiPPfJwE.js} +1 -1
  121. package/assets/{networks-DN2XAief.js → networks-DqfX9Mw6.js} +1 -1
  122. package/assets/{onramp-B19K6tdH.js → onramp-ysJm9_I2.js} +1 -1
  123. package/assets/{openzeppelin-DGZusii6.js → openzeppelin-C8BwugSd.js} +1 -1
  124. package/assets/{parseNft-DMGK6Taa.js → parseNft-ttELvFXh.js} +2 -2
  125. package/assets/{parseSignature-Cp_SEN37.js → parseSignature-BUMEnAVd.js} +3 -3
  126. package/assets/{parseSignature-BN4GI5Gq.js → parseSignature-BY4ETsCJ.js} +1 -1
  127. package/assets/{passkeys-D_kmBKbc.js → passkeys-cKtVgLWy.js} +1 -1
  128. package/assets/{pay-with-exchange-BOHZzA4e.js → pay-with-exchange-_biZz1bs.js} +1 -1
  129. package/assets/{qr-overlay-CxQ_5fgo.js → qr-overlay-CUUyyjB4.js} +1 -1
  130. package/assets/{receive-DH_J_1l9.js → receive-Ct0p2V6_.js} +1 -1
  131. package/assets/{resolveImplementation-D8Xd3SU4.js → resolveImplementation-CrXCyIA3.js} +1 -1
  132. package/assets/{rpc-CLZOpWR4.js → rpc-B_PtwG8P.js} +1 -1
  133. package/assets/{secp256k1-BJpXPJIB.js → secp256k1-BHpk8kxj.js} +1 -1
  134. package/assets/{secp256k1-BBSuqIwv.js → secp256k1-C2YG7CTs.js} +1 -1
  135. package/assets/{secp256k1-Bt0GketY.js → secp256k1-DvHkD7Ln.js} +1 -1
  136. package/assets/{send-BOh425tb.js → send-B4-vLgbZ.js} +1 -1
  137. package/assets/{send-batch-transaction-DONfz9fC.js → send-batch-transaction-Dr_1zK2x.js} +1 -1
  138. package/assets/{send-eip712-transaction-C-ftAsHC.js → send-eip712-transaction-e5d3-I5n.js} +2 -2
  139. package/assets/{send-gasless-transaction-DvIC4XMf.js → send-gasless-transaction-hfNVmFuC.js} +2 -2
  140. package/assets/{send-transaction-4Pzr9Is4.js → send-transaction-AE4gbLbx.js} +2 -2
  141. package/assets/{sendRawTransaction-Beep3a_c.js → sendRawTransaction-BuFkD4rL.js} +3 -3
  142. package/assets/{serializeTransaction-DSKyq4zg.js → serializeTransaction-DbtSO7eG.js} +1 -1
  143. package/assets/{session-proposal-EjRZl42C.js → session-proposal-Z_hvYy-l.js} +1 -1
  144. package/assets/{session-request-Bu1VWYTD.js → session-request-Di-qGpws.js} +2 -2
  145. package/assets/{signing-BzQX0vi3.js → signing-ByY-PbpF.js} +3 -3
  146. package/assets/{socials-Dl4vkgvy.js → socials-C2_Ry2Pa.js} +1 -1
  147. package/assets/{swaps-B1fxMUbG.js → swaps-atTRyi6S.js} +1 -1
  148. package/assets/{thirdweb-D8mff26M.js → thirdweb-JUf4I4fd.js} +3 -3
  149. package/assets/{to-serializable-transaction-D0Ot62NY.js → to-serializable-transaction-DG4LO8kM.js} +2 -2
  150. package/assets/trade-encoding-DB6daWEb.js +1 -0
  151. package/assets/{transactionReceipt-CsXKmeJS.js → transactionReceipt-yJTxkzP2.js} +1 -1
  152. package/assets/{transactions-EPT_g3Bm.js → transactions-DHUK-2qW.js} +1 -1
  153. package/assets/{useCreditPacks-19hJrzxg.js → useCreditPacks-BYlDej2O.js} +1 -1
  154. package/assets/{useInfiniteGrid-DzWtFyHK.js → useInfiniteGrid-DWshFIqR.js} +1 -1
  155. package/assets/useManaRate-_PfWfJdh.js +1 -0
  156. package/assets/{useStore-B63Yqu_R.js → useStore-B33TojLf.js} +1 -1
  157. package/assets/{useTheme-PoMzVS0s.js → useTheme-He91kBbi.js} +1 -1
  158. package/assets/{verifyHash-BEO4ZrCQ.js → verifyHash-P48QT828.js} +1 -1
  159. package/assets/{w3m-modal-rFWYtees.js → w3m-modal-4i7wgjUL.js} +1 -1
  160. package/assets/{w3m-modal-ClmixmsH.js → w3m-modal-Bg_urlfN.js} +1 -1
  161. package/assets/{wait-for-tx-receipt-B8_pgfcA.js → wait-for-tx-receipt-CtN0J51M.js} +1 -1
  162. package/assets/{wallets-Dm-solJh.js → wallets-CkQyCjuq.js} +5 -5
  163. package/assets/{web-connector-DBjxfQt_.js → web-connector-ClVjflKq.js} +3 -3
  164. package/assets/{writeContract-CrX86u2O.js → writeContract-ZYH-yaYg.js} +1 -1
  165. package/assets/{zoraTestnet-AwQWrKOY.js → zoraTestnet-B95WaAkB.js} +1 -1
  166. package/index.html +11 -11
  167. package/package.json +2 -2
  168. package/assets/trade-encoding-C87iaBkc.js +0 -1
  169. package/assets/useManaRate-rTAxqnrj.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as g,j as e,L as S,e as J}from"./react-BW1xvPTF.js";import{s as o,J as a,O as V,B as Y,m as tt,t as c,u as et,I as h,az as it,aA as st,aB as nt,C as f,o as M,ai as D,aC as at,aD as rt}from"./index-s056mQ5V.js";import{a as ot}from"./mana-rate-C7Xb6QOI.js";import{u as ct}from"./useManaRate-rTAxqnrj.js";import{L as dt}from"./LoadMore-B-s5G0me.js";import{u as x}from"./useInfiniteGrid-DzWtFyHK.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BcZhdsUx.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";const lt=15e3;function ut(t,i){return t.txHash&&i.txHash?t.txHash===i.txHash:t.txHash||i.txHash?!1:t.status===i.status&&Math.abs(t.createdAt-i.createdAt)<=lt}function pt(t){const i=[...t].sort((s,r)=>r.createdAt-s.createdAt),d=[];for(const s of i){const r=d[d.length-1];r&&ut(r[r.length-1],s)?r.push(s):d.push([s])}return d.map(s=>{var r;return{id:((r=s.find(n=>n.txHash))==null?void 0:r.txHash)??s[s.length-1].id,createdAt:Math.max(...s.map(n=>n.createdAt)),status:s.some(n=>n.status==="PENDING")?"PENDING":"SETTLED",totalCredits:s.reduce((n,l)=>n+l.credits,0),lines:s}})}function ht(t){const i=[],d=new Map;for(const s of t)if(s.tradeId){const r=d.get(s.tradeId);if(r){r.quantity+=1,r.credits+=s.credits;continue}const n={key:s.tradeId,tradeId:s.tradeId,quantity:1,credits:s.credits};d.set(s.tradeId,n),i.push(n)}else i.push({key:s.id,tradeId:null,quantity:1,credits:s.credits});return i}function xt(t,i){return{id:t.id,contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId,counterparty:t.buyer,credits:i?ot(t.manaWei,i):null,manaWei:t.manaWei,createdAt:t.createdAt}}function mt(t){const d=pt(t.purchases.filter(n=>n.status!=="EXPIRED")).map(n=>({kind:"purchase",id:`purchase:${n.id}`,createdAt:n.createdAt,order:n})),s=t.sales.map(n=>{const l=xt(n,t.rate);return{kind:"sale",id:`sale:${l.id}`,createdAt:l.createdAt,sale:l}}),r=(t.creditOrders??[]).filter(n=>n.status!=="EXPIRED").map(n=>({kind:"credit",id:`credit:${n.id}`,createdAt:n.createdAt,order:n}));return[...d,...s,...r].sort((n,l)=>l.createdAt-n.createdAt||(n.id<l.id?-1:1))}function gt(t,i){return i==="all"?t:i==="sales"?t.filter(d=>d.kind==="sale"):t.filter(d=>d.kind==="purchase"||d.kind==="credit")}const ft="https://cdn.decentraland.org/@dcl/shop/0.1.0-30133871697.commit-2ebb498/assets/credits-product-vs4Q6u6l.svg",yt="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%200L24%2012L12%2024L0%2012L12%200ZM12.0002%203.36001L20.6402%2012L12.0002%2020.64L3.36023%2012L12.0002%203.36001ZM12.0009%2016.32C14.3868%2016.32%2016.3209%2014.3859%2016.3209%2012C16.3209%209.61415%2014.3868%207.68002%2012.0009%207.68002C9.61507%207.68002%207.68094%209.61415%207.68094%2012C7.68094%2014.3859%209.61507%2016.32%2012.0009%2016.32Z'%20fill='%2316141A'/%3e%3c/svg%3e",y=V`
1
+ import{r as g,j as e,L as S,e as J}from"./react-BW1xvPTF.js";import{s as o,J as a,O as V,B as Y,m as tt,t as c,u as et,I as h,az as it,aA as st,aB as nt,C as f,o as M,ai as D,aC as at,aD as rt}from"./index-CQ7zHnQz.js";import{a as ot}from"./mana-rate-HiPPfJwE.js";import{u as ct}from"./useManaRate-_PfWfJdh.js";import{L as dt}from"./LoadMore-D8ty75NY.js";import{u as x}from"./useInfiniteGrid-DWshFIqR.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BcZhdsUx.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";const lt=15e3;function ut(t,i){return t.txHash&&i.txHash?t.txHash===i.txHash:t.txHash||i.txHash?!1:t.status===i.status&&Math.abs(t.createdAt-i.createdAt)<=lt}function pt(t){const i=[...t].sort((s,r)=>r.createdAt-s.createdAt),d=[];for(const s of i){const r=d[d.length-1];r&&ut(r[r.length-1],s)?r.push(s):d.push([s])}return d.map(s=>{var r;return{id:((r=s.find(n=>n.txHash))==null?void 0:r.txHash)??s[s.length-1].id,createdAt:Math.max(...s.map(n=>n.createdAt)),status:s.some(n=>n.status==="PENDING")?"PENDING":"SETTLED",totalCredits:s.reduce((n,l)=>n+l.credits,0),lines:s}})}function ht(t){const i=[],d=new Map;for(const s of t)if(s.tradeId){const r=d.get(s.tradeId);if(r){r.quantity+=1,r.credits+=s.credits;continue}const n={key:s.tradeId,tradeId:s.tradeId,quantity:1,credits:s.credits};d.set(s.tradeId,n),i.push(n)}else i.push({key:s.id,tradeId:null,quantity:1,credits:s.credits});return i}function xt(t,i){return{id:t.id,contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId,counterparty:t.buyer,credits:i?ot(t.manaWei,i):null,manaWei:t.manaWei,createdAt:t.createdAt}}function mt(t){const d=pt(t.purchases.filter(n=>n.status!=="EXPIRED")).map(n=>({kind:"purchase",id:`purchase:${n.id}`,createdAt:n.createdAt,order:n})),s=t.sales.map(n=>{const l=xt(n,t.rate);return{kind:"sale",id:`sale:${l.id}`,createdAt:l.createdAt,sale:l}}),r=(t.creditOrders??[]).filter(n=>n.status!=="EXPIRED").map(n=>({kind:"credit",id:`credit:${n.id}`,createdAt:n.createdAt,order:n}));return[...d,...s,...r].sort((n,l)=>l.createdAt-n.createdAt||(n.id<l.id?-1:1))}function gt(t,i){return i==="all"?t:i==="sales"?t.filter(d=>d.kind==="sale"):t.filter(d=>d.kind==="purchase"||d.kind==="credit")}const ft="https://cdn.decentraland.org/@dcl/shop/0.1.0-30216809991.commit-6a5fe36/assets/credits-product-vs4Q6u6l.svg",yt="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%200L24%2012L12%2024L0%2012L12%200ZM12.0002%203.36001L20.6402%2012L12.0002%2020.64L3.36023%2012L12.0002%203.36001ZM12.0009%2016.32C14.3868%2016.32%2016.3209%2014.3859%2016.3209%2012C16.3209%209.61415%2014.3868%207.68002%2012.0009%207.68002C9.61507%207.68002%207.68094%209.61415%207.68094%2012C7.68094%2014.3859%209.61507%2016.32%2012.0009%2016.32Z'%20fill='%2316141A'/%3e%3c/svg%3e",y=V`
2
2
  0% { background-position: 200% 0; }
3
3
  100% { background-position: -200% 0; }
4
4
  `,bt=o.section`
@@ -1,11 +1,11 @@
1
- import{r as l,j as v}from"./react-BW1xvPTF.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-30133871697.commit-2ebb498/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-30133871697.commit-2ebb498/assets/DCL_LogoPattern-BryBPc3d.png",b=`
1
+ import{r as l,j as v}from"./react-BW1xvPTF.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-30216809991.commit-6a5fe36/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-30216809991.commit-6a5fe36/assets/DCL_LogoPattern-BryBPc3d.png",U=`
2
2
  attribute vec2 a_position;
3
3
  varying vec2 v_uv;
4
4
  void main() {
5
5
  v_uv = a_position * 0.5 + 0.5;
6
6
  gl_Position = vec4(a_position, 0.0, 1.0);
7
7
  }
8
- `,U=`
8
+ `,b=`
9
9
  precision highp float;
10
10
 
11
11
  uniform float u_time;
@@ -77,4 +77,4 @@ void main() {
77
77
 
78
78
  gl_FragColor = result;
79
79
  }
80
- `;function g(t,a,r){const e=t.createShader(a);return e?(t.shaderSource(e,r),t.compileShader(e),t.getShaderParameter(e,t.COMPILE_STATUS)?e:(console.error("Shader compile error:",t.getShaderInfoLog(e)),t.deleteShader(e),null)):null}function P(t,a,r){const e=t.createProgram();return e?(t.attachShader(e,a),t.attachShader(e,r),t.linkProgram(e),t.getProgramParameter(e,t.LINK_STATUS)?e:(console.error("Program link error:",t.getProgramInfoLog(e)),t.deleteProgram(e),null)):null}function D(t,a,r){const e=t.createTexture();if(!e)return null;t.bindTexture(t.TEXTURE_2D,e),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array([128,128,128,255]));const o=new Image;return o.crossOrigin="anonymous",o.onload=()=>{r!=null&&r()||(t.bindTexture(t.TEXTURE_2D,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,o),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.generateMipmap(t.TEXTURE_2D))},o.src=a,e}function L(){const t=l.useRef(null),a=l.useRef(0);return l.useEffect(()=>{var h;const r=t.current;if(!r||(h=window.matchMedia)!=null&&h.call(window,"(prefers-reduced-motion: reduce)").matches)return;const e=r.getContext("webgl",{alpha:!1,antialias:!1});if(!e)return;const o=g(e,e.VERTEX_SHADER,b),c=g(e,e.FRAGMENT_SHADER,U);if(!o||!c){o&&e.deleteShader(o),c&&e.deleteShader(c);return}const n=P(e,o,c);if(!n){e.deleteShader(o),e.deleteShader(c);return}const u=e.getAttribLocation(n,"a_position"),_=e.getUniformLocation(n,"u_time"),R=e.getUniformLocation(n,"u_resolution"),y=e.getUniformLocation(n,"u_overlayTex"),s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW);let m=!1;const d=D(e,S,()=>m),A=()=>{const i=window.devicePixelRatio||1,x=r.clientWidth*i,E=r.clientHeight*i;(r.width!==x||r.height!==E)&&(r.width=x,r.height=E)},p=performance.now()/1e3,f=()=>{A(),e.viewport(0,0,r.width,r.height),e.useProgram(n),e.uniform1f(_,performance.now()/1e3-p),e.uniform2f(R,r.width,r.height),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,d),e.uniform1i(y,0),e.enableVertexAttribArray(u),e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(u,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLES,0,6),a.current=requestAnimationFrame(f)},T=i=>{i.preventDefault(),cancelAnimationFrame(a.current),r.style.opacity="0"};return r.addEventListener("webglcontextlost",T,!1),a.current=requestAnimationFrame(f),()=>{m=!0,cancelAnimationFrame(a.current),r.removeEventListener("webglcontextlost",T),e.deleteProgram(n),e.deleteShader(o),e.deleteShader(c),e.deleteBuffer(s),e.deleteTexture(d)}},[]),v.jsxs("div",{className:"AnimatedBackground","aria-hidden":!0,children:[v.jsx("div",{className:"AnimatedBackground__fallback",style:{backgroundImage:`url(${w})`}}),v.jsx("canvas",{ref:t,className:"AnimatedBackground__canvas"})]})}export{L as default};
80
+ `;function g(t,a,r){const e=t.createShader(a);return e?(t.shaderSource(e,r),t.compileShader(e),t.getShaderParameter(e,t.COMPILE_STATUS)?e:(console.error("Shader compile error:",t.getShaderInfoLog(e)),t.deleteShader(e),null)):null}function P(t,a,r){const e=t.createProgram();return e?(t.attachShader(e,a),t.attachShader(e,r),t.linkProgram(e),t.getProgramParameter(e,t.LINK_STATUS)?e:(console.error("Program link error:",t.getProgramInfoLog(e)),t.deleteProgram(e),null)):null}function D(t,a,r){const e=t.createTexture();if(!e)return null;t.bindTexture(t.TEXTURE_2D,e),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array([128,128,128,255]));const o=new Image;return o.crossOrigin="anonymous",o.onload=()=>{r!=null&&r()||(t.bindTexture(t.TEXTURE_2D,e),t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,o),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR_MIPMAP_LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.generateMipmap(t.TEXTURE_2D))},o.src=a,e}function L(){const t=l.useRef(null),a=l.useRef(0);return l.useEffect(()=>{var h;const r=t.current;if(!r||(h=window.matchMedia)!=null&&h.call(window,"(prefers-reduced-motion: reduce)").matches)return;const e=r.getContext("webgl",{alpha:!1,antialias:!1});if(!e)return;const o=g(e,e.VERTEX_SHADER,U),c=g(e,e.FRAGMENT_SHADER,b);if(!o||!c){o&&e.deleteShader(o),c&&e.deleteShader(c);return}const n=P(e,o,c);if(!n){e.deleteShader(o),e.deleteShader(c);return}const u=e.getAttribLocation(n,"a_position"),_=e.getUniformLocation(n,"u_time"),R=e.getUniformLocation(n,"u_resolution"),y=e.getUniformLocation(n,"u_overlayTex"),s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW);let m=!1;const d=D(e,S,()=>m),A=()=>{const i=window.devicePixelRatio||1,x=r.clientWidth*i,E=r.clientHeight*i;(r.width!==x||r.height!==E)&&(r.width=x,r.height=E)},p=performance.now()/1e3,f=()=>{A(),e.viewport(0,0,r.width,r.height),e.useProgram(n),e.uniform1f(_,performance.now()/1e3-p),e.uniform2f(R,r.width,r.height),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,d),e.uniform1i(y,0),e.enableVertexAttribArray(u),e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(u,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLES,0,6),a.current=requestAnimationFrame(f)},T=i=>{i.preventDefault(),cancelAnimationFrame(a.current),r.style.opacity="0"};return r.addEventListener("webglcontextlost",T,!1),a.current=requestAnimationFrame(f),()=>{m=!0,cancelAnimationFrame(a.current),r.removeEventListener("webglcontextlost",T),e.deleteProgram(n),e.deleteShader(o),e.deleteShader(c),e.deleteBuffer(s),e.deleteTexture(d)}},[]),v.jsxs("div",{className:"AnimatedBackground","aria-hidden":!0,children:[v.jsx("div",{className:"AnimatedBackground__fallback",style:{backgroundImage:`url(${w})`}}),v.jsx("canvas",{ref:t,className:"AnimatedBackground__canvas"})]})}export{L as default};
@@ -1,4 +1,4 @@
1
- import{u as Je,r as p,j as e,b as Ze}from"./react-BW1xvPTF.js";import{p as W,h as Xe,c as Ye,r as et,s,J as t,u as oe,a as tt,b as Ne,y as _e,w as nt,t as o,I as N,C as F,d as he,j as D,k as st,l as ot,m as Ae,K as rt,A as Q,aE as it,aF as at}from"./index-s056mQ5V.js";import{r as lt,m as ct,a as Pe}from"./mana-rate-C7Xb6QOI.js";import{u as Me}from"./useManaRate-rTAxqnrj.js";import{g as dt,h as ft,i as pt,j as ut,k as xt,C as ht,l as mt,o as gt,m as bt,n as yt,M as wt}from"./Assets.styles-BjRnkieR.js";import{d as me,R as vt,F as jt,S as ge,b as $t}from"./categories-BhIJhSSv.js";import{L as Ct}from"./LoadMore-B-s5G0me.js";import{M as kt}from"./MarketCheckout-B49jmgSp.js";import{u as St}from"./useInfiniteGrid-DzWtFyHK.js";import{E as Rt}from"./ErrorNotice-BG40E5Ff.js";import{d as Et}from"./dcl-schemas-BICTSpB5.js";import{u as It,G as Tt,w as zt,S as Nt}from"./buy-gasless-DEhbR0zX.js";import{s as _t}from"./buy-BIt1DjVh.js";import{i as At}from"./trade-encoding-C87iaBkc.js";import{f as Pt}from"./errors-CevO4-B_.js";import{J as Mt,C as Lt,B as se}from"./ethers-BcZhdsUx.js";import{l as Bt}from"./loader-logo-BzY9EKdC.js";import{n as Ft}from"./emotion-CSxEP8yM.js";import"./sentry-BV_ZSgtd.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./Tooltip-g1zVFNbN.js";import"./authorizations-CfRBicRM.js";import"./sendMetaTransaction-CiO3jI6F.js";function J(n){const r=n.source??"item",f=n.tradeId||`${n.contractAddress}-${n.tokenId??n.itemId??""}`;return`${r}:${f}`}const H="100000000000000000000",Le=2,V=15,Wt=/^[a-zA-Z0-9]+$/;function be(n){const r=n.trim();return r.length===0?{ok:!1,reason:"empty"}:Wt.test(r)?r.length<Le?{ok:!1,reason:"too-short"}:r.length>V?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Ht(n){return n.replace(/[^a-zA-Z0-9]/g,"").slice(0,V)}const Ot=["function available(string _subdomain) view returns (bool)"],ye={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Ut(){return W.chainId===Et.ChainId.MATIC_MAINNET?ye.mainnet:ye.sepolia}async function qt(n,r={}){var d;const{rpc:f,address:u}=Ut(),h=new Mt(f),l=new Lt(u,Ot,h);console.info(`[names] availability check → DCLRegistrar(${u}).available("${n}") on ${f}`);const c=await l.available(n);if((d=r.signal)!=null&&d.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${n}" available=${c}`),c?"available":"taken"}const Gt="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 Dt(n){return ct(H,n)}async function Vt(n,r,f={}){var d;const u=f.chainId??W.chainId,h=f.provider??"across",l=`${W.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(r)}&chainId=${u}&provider=${h}`,c=await et(l,{method:"GET",identity:n,metadata:{}});if(!c.ok){let a;try{a=(d=await c.json())==null?void 0:d.code}catch{}throw a==="ROUTE_COST_TOO_HIGH"?new Be:new Error(`fetchNameCreditRoute ${c.status}`)}return c.json()}function Kt(n,r){const f=se.from(n.availableAmount),h=se.from(H).sub(f);return{credits:[{value:n.amount,expiresAt:Number(n.expiresAt),salt:At(n.id)}],creditsSignatures:[n.signature],externalCall:{target:r.externalCall.target,selector:r.externalCall.selector,data:r.externalCall.data,expiresAt:r.externalCall.expiresAt,salt:r.externalCall.salt},customExternalCallSignature:r.customExternalCallSignature,maxUncreditedValue:h.isNegative()?"0":h.toString(),maxCreditedValue:H}}async function Qt(n,r={}){const f=Gt,u=r.intervalMs??1e4,h=r.maxAttempts??60;let l={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let c=0;c<h;c++){try{const d=await fetch(`${f}/deposit/status?originChainId=137&depositTxHash=${n}`);if(d.ok){const a=await d.json(),x=(a.status??"pending").toLowerCase(),m=a.fillTx??a.fillTxnRef??null,w=a.actionsSucceeded!==!1;if(x==="filled")return{status:"filled",destinationTxHash:m,actionsSucceeded:w};if(x==="refunded"||x==="expired")return{status:x,destinationTxHash:null,actionsSucceeded:!1};l={status:"pending",destinationTxHash:m,actionsSucceeded:w}}}catch{}c<h-1&&await new Promise(d=>setTimeout(d,u))}return l}async function Jt(n){const{name:r,identity:f,signer:u}=n,h=n.chainId??W.chainId,l=n.provider??"across",c=(n.beneficiary??await u.getAddress()).toLowerCase();let d=null,a=!1;console.info("[names] register start",{name:r,buyer:c,chainId:h,provider:l});try{const x=await lt(h),m=Dt(x);console.info("[names] step 1/6 sized reservation",{usdCents:m,manaRate:x});const w=await Vt(f,r,{chainId:h,provider:l});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 Xe(f,m);if(d=j.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:j.credit.id,maxCreditedValue:j.maxCreditedValue}),se.from(j.maxCreditedValue).lt(H))throw new Error("Credit under-sized for the name price");const k=Kt(j.credit,w);let g;try{g=await It({chainId:h,buyer:c,signer:u,args:k})}catch(y){if(!(y instanceof Tt))throw y;g=await _t(h,k,u)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:g}),await zt(g),a=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:g}),l==="across"){const y=await Qt(g,n.acrossPoll);if(console.info("[names] step 6/6 across status",y),y.status==="pending")return{status:"pending",originTxHash:g};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:g,destinationTxHash:y.destinationTxHash}}return{status:"pending",originTxHash:g}}catch(x){if(console.error("[names] register failed — raw error:",x,{name:r,buyer:c,originConfirmed:a}),x instanceof Nt)return{status:"pending",originTxHash:x.txHash};throw d&&!a&&await Ye(f,[d]).catch(()=>{}),x instanceof Be?x:new Error(Pt(x,"Couldn't register the name. Please try again.",{sale:!0}))}}const Zt=s.div`
1
+ import{u as Je,r as p,j as e,b as Ze}from"./react-BW1xvPTF.js";import{p as W,h as Xe,c as Ye,r as et,s,J as t,u as oe,a as tt,b as Ne,y as _e,w as nt,t as o,I as N,C as F,d as he,j as D,k as st,l as ot,m as Ae,K as rt,A as Q,aE as it,aF as at}from"./index-CQ7zHnQz.js";import{r as lt,m as ct,a as Pe}from"./mana-rate-HiPPfJwE.js";import{u as Me}from"./useManaRate-_PfWfJdh.js";import{g as dt,h as ft,i as pt,j as ut,k as xt,C as ht,l as mt,o as gt,m as bt,n as yt,M as wt}from"./Assets.styles-D1Wq-TGU.js";import{d as me,R as vt,F as jt,S as ge,b as $t}from"./categories-7z3tYoma.js";import{L as Ct}from"./LoadMore-D8ty75NY.js";import{M as kt}from"./MarketCheckout-D0iyzaVw.js";import{u as St}from"./useInfiniteGrid-DWshFIqR.js";import{E as Rt}from"./ErrorNotice-BG40E5Ff.js";import{d as Et}from"./dcl-schemas-BICTSpB5.js";import{u as It,G as Tt,w as zt,S as Nt}from"./buy-gasless-Bw8QJ3nL.js";import{s as _t}from"./buy-CXClikLg.js";import{i as At}from"./trade-encoding-DB6daWEb.js";import{f as Pt}from"./errors-BoZbc8ja.js";import{J as Mt,C as Lt,B as se}from"./ethers-BcZhdsUx.js";import{l as Bt}from"./loader-logo-BzY9EKdC.js";import{n as Ft}from"./emotion-CSxEP8yM.js";import"./sentry-BV_ZSgtd.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./Tooltip-D5x9mtLq.js";import"./authorizations-DRmWTFDz.js";import"./sendMetaTransaction-CiO3jI6F.js";function J(n){const r=n.source??"item",f=n.tradeId||`${n.contractAddress}-${n.tokenId??n.itemId??""}`;return`${r}:${f}`}const H="100000000000000000000",Le=2,V=15,Wt=/^[a-zA-Z0-9]+$/;function be(n){const r=n.trim();return r.length===0?{ok:!1,reason:"empty"}:Wt.test(r)?r.length<Le?{ok:!1,reason:"too-short"}:r.length>V?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Ht(n){return n.replace(/[^a-zA-Z0-9]/g,"").slice(0,V)}const Ot=["function available(string _subdomain) view returns (bool)"],ye={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Ut(){return W.chainId===Et.ChainId.MATIC_MAINNET?ye.mainnet:ye.sepolia}async function qt(n,r={}){var d;const{rpc:f,address:u}=Ut(),h=new Mt(f),l=new Lt(u,Ot,h);console.info(`[names] availability check → DCLRegistrar(${u}).available("${n}") on ${f}`);const c=await l.available(n);if((d=r.signal)!=null&&d.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${n}" available=${c}`),c?"available":"taken"}const Gt="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 Dt(n){return ct(H,n)}async function Vt(n,r,f={}){var d;const u=f.chainId??W.chainId,h=f.provider??"across",l=`${W.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(r)}&chainId=${u}&provider=${h}`,c=await et(l,{method:"GET",identity:n,metadata:{}});if(!c.ok){let a;try{a=(d=await c.json())==null?void 0:d.code}catch{}throw a==="ROUTE_COST_TOO_HIGH"?new Be:new Error(`fetchNameCreditRoute ${c.status}`)}return c.json()}function Kt(n,r){const f=se.from(n.availableAmount),h=se.from(H).sub(f);return{credits:[{value:n.amount,expiresAt:Number(n.expiresAt),salt:At(n.id)}],creditsSignatures:[n.signature],externalCall:{target:r.externalCall.target,selector:r.externalCall.selector,data:r.externalCall.data,expiresAt:r.externalCall.expiresAt,salt:r.externalCall.salt},customExternalCallSignature:r.customExternalCallSignature,maxUncreditedValue:h.isNegative()?"0":h.toString(),maxCreditedValue:H}}async function Qt(n,r={}){const f=Gt,u=r.intervalMs??1e4,h=r.maxAttempts??60;let l={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let c=0;c<h;c++){try{const d=await fetch(`${f}/deposit/status?originChainId=137&depositTxHash=${n}`);if(d.ok){const a=await d.json(),x=(a.status??"pending").toLowerCase(),m=a.fillTx??a.fillTxnRef??null,w=a.actionsSucceeded!==!1;if(x==="filled")return{status:"filled",destinationTxHash:m,actionsSucceeded:w};if(x==="refunded"||x==="expired")return{status:x,destinationTxHash:null,actionsSucceeded:!1};l={status:"pending",destinationTxHash:m,actionsSucceeded:w}}}catch{}c<h-1&&await new Promise(d=>setTimeout(d,u))}return l}async function Jt(n){const{name:r,identity:f,signer:u}=n,h=n.chainId??W.chainId,l=n.provider??"across",c=(n.beneficiary??await u.getAddress()).toLowerCase();let d=null,a=!1;console.info("[names] register start",{name:r,buyer:c,chainId:h,provider:l});try{const x=await lt(h),m=Dt(x);console.info("[names] step 1/6 sized reservation",{usdCents:m,manaRate:x});const w=await Vt(f,r,{chainId:h,provider:l});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 Xe(f,m);if(d=j.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:j.credit.id,maxCreditedValue:j.maxCreditedValue}),se.from(j.maxCreditedValue).lt(H))throw new Error("Credit under-sized for the name price");const k=Kt(j.credit,w);let g;try{g=await It({chainId:h,buyer:c,signer:u,args:k})}catch(y){if(!(y instanceof Tt))throw y;g=await _t(h,k,u)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:g}),await zt(g),a=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:g}),l==="across"){const y=await Qt(g,n.acrossPoll);if(console.info("[names] step 6/6 across status",y),y.status==="pending")return{status:"pending",originTxHash:g};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:g,destinationTxHash:y.destinationTxHash}}return{status:"pending",originTxHash:g}}catch(x){if(console.error("[names] register failed — raw error:",x,{name:r,buyer:c,originConfirmed:a}),x instanceof Nt)return{status:"pending",originTxHash:x.txHash};throw d&&!a&&await Ye(f,[d]).catch(()=>{}),x instanceof Be?x:new Error(Pt(x,"Couldn't register the name. Please try again.",{sale:!0}))}}const Zt=s.div`
2
2
  position: fixed;
3
3
  inset: 0;
4
4
  z-index: 10000;
@@ -1,4 +1,4 @@
1
- import{r as y,j as t}from"./react-BW1xvPTF.js";import{R as z,a as oe,C as ie,c as ne}from"./categories-BhIJhSSv.js";import{T as se}from"./Tooltip-g1zVFNbN.js";import{J as e,s as o,I as m,t as s,K as re,e as v}from"./index-s056mQ5V.js";import{n as c}from"./emotion-CSxEP8yM.js";const ae=o.div`
1
+ import{r as y,j as t}from"./react-BW1xvPTF.js";import{R as z,a as oe,C as ie,c as ne}from"./categories-7z3tYoma.js";import{T as se}from"./Tooltip-D5x9mtLq.js";import{J as e,s as o,I as m,t as s,K as re,e as v}from"./index-CQ7zHnQz.js";import{n as c}from"./emotion-CSxEP8yM.js";const ae=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 D,r as B}from"./react-BW1xvPTF.js";import{s as a,B as F,J as o,O as S,m as N,t as e,u as M,w as P,I as g,C as G,o as w,b as H,p as K,P as k,H as Q,L as $}from"./index-s056mQ5V.js";import{b as O,c as W,d as _,s as J,f as X}from"./authorizations-CfRBicRM.js";import{a as U}from"./builder-InlokaP6.js";import{f as V}from"./errors-CevO4-B_.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BcZhdsUx.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";const Y=S`
1
+ import{j as t,L as D,r as B}from"./react-BW1xvPTF.js";import{s as a,B as F,J as o,O as S,m as N,t as e,u as M,w as P,I as g,C as G,o as w,b as H,p as K,P as k,H as Q,L as $}from"./index-CQ7zHnQz.js";import{b as O,c as W,d as _,s as J,f as X}from"./authorizations-DRmWTFDz.js";import{a as U}from"./builder-C82LQxNu.js";import{f as V}from"./errors-BoZbc8ja.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BcZhdsUx.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";const Y=S`
2
2
  to { transform: rotate(360deg); }
3
3
  `,Z=S`
4
4
  to { background-position: -200% 0; }
@@ -1,4 +1,4 @@
1
- import{b2 as Xe,b3 as Ye,E as Ge,b4 as qe,U as G,V as b,W as z,R as ee,S as se,b5 as Qe,Z as K,O as le,Q as Ce,b6 as be,b7 as Ze,b8 as Z,Y as Re,b9 as we,T as Je,aK as eo,D as oo,X as B,ba as to,bb as w}from"./index-s056mQ5V.js";import{r as l,j as T,R as Y}from"./react-BW1xvPTF.js";function Me(e){var o,t,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(o=0;o<n;o++)e[o]&&(t=Me(e[o]))&&(i&&(i+=" "),i+=t)}else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function no(){for(var e,o,t=0,i="",n=arguments.length;t<n;t++)(e=arguments[t])&&(o=Me(e))&&(i&&(i+=" "),i+=o);return i}const io=["className","component"];function ao(e={}){const{themeId:o,defaultTheme:t,defaultClassName:i="MuiBox-root",generateClassName:n}=e,a=Xe("div",{shouldForwardProp:u=>u!=="theme"&&u!=="sx"&&u!=="as"})(Ye);return l.forwardRef(function(c,p){const f=Ge(t),g=qe(c),{className:m,component:v="div"}=g,h=G(g,io);return T.jsx(a,b({as:v,ref:p,className:no(m,n?n(i):i),theme:o&&f[o]||f},h))})}function ae(e,o){return ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},ae(e,o)}function ro(e,o){e.prototype=Object.create(o.prototype),e.prototype.constructor=e,ae(e,o)}const ge=Y.createContext(null);function so(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ce(e,o){var t=function(a){return o&&l.isValidElement(a)?o(a):a},i=Object.create(null);return e&&l.Children.map(e,function(n){return n}).forEach(function(n){i[n.key]=t(n)}),i}function lo(e,o){e=e||{},o=o||{};function t(f){return f in o?o[f]:e[f]}var i=Object.create(null),n=[];for(var a in e)a in o?n.length&&(i[a]=n,n=[]):n.push(a);var r,u={};for(var c in o){if(i[c])for(r=0;r<i[c].length;r++){var p=i[c][r];u[i[c][r]]=t(p)}u[c]=t(c)}for(r=0;r<n.length;r++)u[n[r]]=t(n[r]);return u}function A(e,o,t){return t[o]!=null?t[o]:e.props[o]}function co(e,o){return ce(e.children,function(t){return l.cloneElement(t,{onExited:o.bind(null,t),in:!0,appear:A(t,"appear",e),enter:A(t,"enter",e),exit:A(t,"exit",e)})})}function uo(e,o,t){var i=ce(e.children),n=lo(o,i);return Object.keys(n).forEach(function(a){var r=n[a];if(l.isValidElement(r)){var u=a in o,c=a in i,p=o[a],f=l.isValidElement(p)&&!p.props.in;c&&(!u||f)?n[a]=l.cloneElement(r,{onExited:t.bind(null,r),in:!0,exit:A(r,"exit",e),enter:A(r,"enter",e)}):!c&&u&&!f?n[a]=l.cloneElement(r,{in:!1}):c&&u&&l.isValidElement(p)&&(n[a]=l.cloneElement(r,{onExited:t.bind(null,r),in:p.props.in,exit:A(r,"exit",e),enter:A(r,"enter",e)}))}}),n}var po=Object.values||function(e){return Object.keys(e).map(function(o){return e[o]})},fo={component:"div",childFactory:function(o){return o}},ue=(function(e){ro(o,e);function o(i,n){var a;a=e.call(this,i,n)||this;var r=a.handleExited.bind(so(a));return a.state={contextValue:{isMounting:!0},handleExited:r,firstRender:!0},a}var t=o.prototype;return t.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},t.componentWillUnmount=function(){this.mounted=!1},o.getDerivedStateFromProps=function(n,a){var r=a.children,u=a.handleExited,c=a.firstRender;return{children:c?co(n,u):uo(n,r,u),firstRender:!1}},t.handleExited=function(n,a){var r=ce(this.props.children);n.key in r||(n.props.onExited&&n.props.onExited(a),this.mounted&&this.setState(function(u){var c=b({},u.children);return delete c[n.key],{children:c}}))},t.render=function(){var n=this.props,a=n.component,r=n.childFactory,u=G(n,["component","childFactory"]),c=this.state.contextValue,p=po(this.state.children).map(r);return delete u.appear,delete u.enter,delete u.exit,a===null?Y.createElement(ge.Provider,{value:c},p):Y.createElement(ge.Provider,{value:c},Y.createElement(a,u,p))},o})(Y.Component);ue.propTypes={};ue.defaultProps=fo;function ho(e){const{className:o,classes:t,pulsate:i=!1,rippleX:n,rippleY:a,rippleSize:r,in:u,onExited:c,timeout:p}=e,[f,g]=l.useState(!1),m=z(o,t.ripple,t.rippleVisible,i&&t.ripplePulsate),v={width:r,height:r,top:-(r/2)+a,left:-(r/2)+n},h=z(t.child,f&&t.childLeaving,i&&t.childPulsate);return!u&&!f&&g(!0),l.useEffect(()=>{if(!u&&c!=null){const C=setTimeout(c,p);return()=>{clearTimeout(C)}}},[c,u,p]),T.jsx("span",{className:m,style:v,children:T.jsx("span",{className:h})})}const E=ee("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),bo=["center","classes","className"];let oe=e=>e,me,xe,ve,ye;const re=550,go=80,mo=le(me||(me=oe`
1
+ import{b2 as Xe,b3 as Ye,E as Ge,b4 as qe,U as G,V as b,W as z,R as ee,S as se,b5 as Qe,Z as K,O as le,Q as Ce,b6 as be,b7 as Ze,b8 as Z,Y as Re,b9 as we,T as Je,aK as eo,D as oo,X as B,ba as to,bb as w}from"./index-CQ7zHnQz.js";import{r as l,j as T,R as Y}from"./react-BW1xvPTF.js";function Me(e){var o,t,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(o=0;o<n;o++)e[o]&&(t=Me(e[o]))&&(i&&(i+=" "),i+=t)}else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function no(){for(var e,o,t=0,i="",n=arguments.length;t<n;t++)(e=arguments[t])&&(o=Me(e))&&(i&&(i+=" "),i+=o);return i}const io=["className","component"];function ao(e={}){const{themeId:o,defaultTheme:t,defaultClassName:i="MuiBox-root",generateClassName:n}=e,a=Xe("div",{shouldForwardProp:u=>u!=="theme"&&u!=="sx"&&u!=="as"})(Ye);return l.forwardRef(function(c,p){const f=Ge(t),g=qe(c),{className:m,component:v="div"}=g,h=G(g,io);return T.jsx(a,b({as:v,ref:p,className:no(m,n?n(i):i),theme:o&&f[o]||f},h))})}function ae(e,o){return ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},ae(e,o)}function ro(e,o){e.prototype=Object.create(o.prototype),e.prototype.constructor=e,ae(e,o)}const ge=Y.createContext(null);function so(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ce(e,o){var t=function(a){return o&&l.isValidElement(a)?o(a):a},i=Object.create(null);return e&&l.Children.map(e,function(n){return n}).forEach(function(n){i[n.key]=t(n)}),i}function lo(e,o){e=e||{},o=o||{};function t(f){return f in o?o[f]:e[f]}var i=Object.create(null),n=[];for(var a in e)a in o?n.length&&(i[a]=n,n=[]):n.push(a);var r,u={};for(var c in o){if(i[c])for(r=0;r<i[c].length;r++){var p=i[c][r];u[i[c][r]]=t(p)}u[c]=t(c)}for(r=0;r<n.length;r++)u[n[r]]=t(n[r]);return u}function A(e,o,t){return t[o]!=null?t[o]:e.props[o]}function co(e,o){return ce(e.children,function(t){return l.cloneElement(t,{onExited:o.bind(null,t),in:!0,appear:A(t,"appear",e),enter:A(t,"enter",e),exit:A(t,"exit",e)})})}function uo(e,o,t){var i=ce(e.children),n=lo(o,i);return Object.keys(n).forEach(function(a){var r=n[a];if(l.isValidElement(r)){var u=a in o,c=a in i,p=o[a],f=l.isValidElement(p)&&!p.props.in;c&&(!u||f)?n[a]=l.cloneElement(r,{onExited:t.bind(null,r),in:!0,exit:A(r,"exit",e),enter:A(r,"enter",e)}):!c&&u&&!f?n[a]=l.cloneElement(r,{in:!1}):c&&u&&l.isValidElement(p)&&(n[a]=l.cloneElement(r,{onExited:t.bind(null,r),in:p.props.in,exit:A(r,"exit",e),enter:A(r,"enter",e)}))}}),n}var po=Object.values||function(e){return Object.keys(e).map(function(o){return e[o]})},fo={component:"div",childFactory:function(o){return o}},ue=(function(e){ro(o,e);function o(i,n){var a;a=e.call(this,i,n)||this;var r=a.handleExited.bind(so(a));return a.state={contextValue:{isMounting:!0},handleExited:r,firstRender:!0},a}var t=o.prototype;return t.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},t.componentWillUnmount=function(){this.mounted=!1},o.getDerivedStateFromProps=function(n,a){var r=a.children,u=a.handleExited,c=a.firstRender;return{children:c?co(n,u):uo(n,r,u),firstRender:!1}},t.handleExited=function(n,a){var r=ce(this.props.children);n.key in r||(n.props.onExited&&n.props.onExited(a),this.mounted&&this.setState(function(u){var c=b({},u.children);return delete c[n.key],{children:c}}))},t.render=function(){var n=this.props,a=n.component,r=n.childFactory,u=G(n,["component","childFactory"]),c=this.state.contextValue,p=po(this.state.children).map(r);return delete u.appear,delete u.enter,delete u.exit,a===null?Y.createElement(ge.Provider,{value:c},p):Y.createElement(ge.Provider,{value:c},Y.createElement(a,u,p))},o})(Y.Component);ue.propTypes={};ue.defaultProps=fo;function ho(e){const{className:o,classes:t,pulsate:i=!1,rippleX:n,rippleY:a,rippleSize:r,in:u,onExited:c,timeout:p}=e,[f,g]=l.useState(!1),m=z(o,t.ripple,t.rippleVisible,i&&t.ripplePulsate),v={width:r,height:r,top:-(r/2)+a,left:-(r/2)+n},h=z(t.child,f&&t.childLeaving,i&&t.childPulsate);return!u&&!f&&g(!0),l.useEffect(()=>{if(!u&&c!=null){const C=setTimeout(c,p);return()=>{clearTimeout(C)}}},[c,u,p]),T.jsx("span",{className:m,style:v,children:T.jsx("span",{className:h})})}const E=ee("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),bo=["center","classes","className"];let oe=e=>e,me,xe,ve,ye;const re=550,go=80,mo=le(me||(me=oe`
2
2
  0% {
3
3
  transform: scale(0);
4
4
  opacity: 0.1;
@@ -1,3 +1,3 @@
1
- import{j as e,r as m,u as Ae,a as Ue,L as re}from"./react-BW1xvPTF.js";import{t as a,C as F,y as Y,ag as We,m as ze,ae as N,n as pe,u as Oe,o as $e,a as Ge,b as He,ah as De,I as R,ai as Je,x as Ve,w as Ye,aj as ge,j as J,ak as ve,al as Xe,H as U,s as Ze,B as es,e as ss,h as as,c as fe,am as ts,l as xe,k as rs,an as cs}from"./index-s056mQ5V.js";import{W as ns,t as is,C as ls,s as ke}from"./CollectionCarousel-CrNhWA-o.js";import{a as je}from"./buy-BIt1DjVh.js";import{a as os,w as ds,S as us,G as hs}from"./buy-gasless-DEhbR0zX.js";import{R as V,r as ms}from"./cart-checkout-DbfpnMCR.js";import{g as _s}from"./authorizations-CfRBicRM.js";import{u as ys,M as bs,c as ps}from"./useCreditPacks-19hJrzxg.js";import{l as gs}from"./loader-logo-BzY9EKdC.js";import{i as vs,a as fs}from"./errors-CevO4-B_.js";import{E as xs}from"./ErrorNotice-BG40E5Ff.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BcZhdsUx.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-C87iaBkc.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";const ks="https://cdn.decentraland.org/@dcl/shop/0.1.0-30133871697.commit-2ebb498/assets/buy-error-22UunaPC.png";function js(r){const{phase:n,balanceCredits:h,onClose:y}=r,C=n==="processing",S=n==="error"?a("cartCheckout.errorTitle"):n==="nofunds"?a("cartCheckout.titleNoFunds"):a("cartCheckout.titleBuy"),q=n==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":a("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:C?void 0:y,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${q?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:S}),!C&&e.jsx("button",{className:"buy-modal__x",onClick:y,"aria-label":a("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:n==="nofunds"?a("buyModal.dclBalance"):a("buyModal.myCreditsBalance")}),e.jsx(F,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:Y(h)})]})]}),n==="processing"&&e.jsx(Ns,{stage:r.stage??"reserving",step:r.step??1,total:r.total??1,isSelfCustody:!!r.isSelfCustody}),n==="nofunds"&&e.jsx(Cs,{lines:r.lines??[],shortfallCredits:r.shortfallCredits??0,packs:r.packs??[],selectedPack:r.selectedPack??"",onSelectPack:r.onSelectPack??(()=>{}),onBuyPacks:r.onBuyPacks??(()=>{}),onCancel:y}),n==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-error",children:[e.jsx("img",{className:"buy-error__art",src:ks,alt:"",width:64,height:80}),e.jsxs("p",{className:"buy-error__text",children:[e.jsx("b",{children:a("cartCheckout.errorHeadline")})," ",a("cartCheckout.errorBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:y,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:r.onRetry??y,children:a("cartCheckout.tryAgain")})]})]})]})]})}function Ns({stage:r,step:n,total:h,isSelfCustody:y}){const C=r==="reserving",S=h>0?Math.min(100,Math.round(n/h*100)):0,q=r==="awaiting-signature"?y?a("buyModal.confirmToContinue"):a("buyModal.completingTransaction"):r==="settling"?a("buyModal.completingTransaction"):a("cartCheckout.preparing");return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:gs,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:q}),C?e.jsxs("div",{className:"cart-checkout__progress-row",children:[e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill buy-modal__progress-fill--step",style:{width:`${S}%`}})}),h>1?e.jsxs("span",{className:"cart-checkout__step",children:[n,"/",h]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function Cs({lines:r,shortfallCredits:n,packs:h,selectedPack:y,onSelectPack:C,onBuyPacks:S,onCancel:q}){const w=h.find(t=>t.id===y),X=r.reduce((t,f)=>t+(f.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(ns,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:a("buyModal.insufficientFunds")})," ",a("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:a("buyModal.warningCreditsAmount",{count:Math.max(0,n)})})," ",a("buyModal.warningToPurchase",{count:X})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:r.map(t=>{const f=t.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"buy-modal__asset-name",title:t.item.name,children:[t.item.name||a("buyModal.itemFallback"),f>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:a("cartCheckout.qty",{count:f})}):null]}),t.item.creator?e.jsx(We,{address:t.item.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(F,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:Y(t.priceCredits*f)})]})]})]},t.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:h.map(t=>{const f=t.id===y;return e.jsxs("button",{className:`buy-modal__pack${f?" buy-modal__pack--on":""}`,onClick:()=>C(t.id),children:[e.jsx(F,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:Y(t.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",t.usd.toFixed(2),")"]})]},t.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(F,{className:"buy-modal__total-ico"}),e.jsx("span",{children:Y((w==null?void 0:w.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((w==null?void 0:w.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:q,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:S,children:a("buyModal.buy")})]})]})}const ws=Ze(es)`
1
+ import{j as e,r as m,u as Ae,a as Ue,L as re}from"./react-BW1xvPTF.js";import{t as a,C as F,y as Y,ag as We,m as ze,ae as N,n as pe,u as Oe,o as $e,a as Ge,b as He,ah as De,I as R,ai as Je,x as Ve,w as Ye,aj as ge,j as J,ak as ve,al as Xe,H as U,s as Ze,B as es,e as ss,h as as,c as fe,am as ts,l as xe,k as rs,an as cs}from"./index-CQ7zHnQz.js";import{W as ns,t as is,C as ls,s as ke}from"./CollectionCarousel-b8Pkk8Km.js";import{a as je}from"./buy-CXClikLg.js";import{a as os,w as ds,S as us,G as hs}from"./buy-gasless-Bw8QJ3nL.js";import{R as V,r as ms}from"./cart-checkout-BLQod-hb.js";import{g as _s}from"./authorizations-DRmWTFDz.js";import{u as ys,M as bs,c as ps}from"./useCreditPacks-BYlDej2O.js";import{l as gs}from"./loader-logo-BzY9EKdC.js";import{i as vs,a as fs}from"./errors-BoZbc8ja.js";import{E as xs}from"./ErrorNotice-BG40E5Ff.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BcZhdsUx.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-DB6daWEb.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";const ks="https://cdn.decentraland.org/@dcl/shop/0.1.0-30216809991.commit-6a5fe36/assets/buy-error-22UunaPC.png";function js(r){const{phase:n,balanceCredits:h,onClose:y}=r,C=n==="processing",S=n==="error"?a("cartCheckout.errorTitle"):n==="nofunds"?a("cartCheckout.titleNoFunds"):a("cartCheckout.titleBuy"),q=n==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":a("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:C?void 0:y,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${q?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:S}),!C&&e.jsx("button",{className:"buy-modal__x",onClick:y,"aria-label":a("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:n==="nofunds"?a("buyModal.dclBalance"):a("buyModal.myCreditsBalance")}),e.jsx(F,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:Y(h)})]})]}),n==="processing"&&e.jsx(Ns,{stage:r.stage??"reserving",step:r.step??1,total:r.total??1,isSelfCustody:!!r.isSelfCustody}),n==="nofunds"&&e.jsx(Cs,{lines:r.lines??[],shortfallCredits:r.shortfallCredits??0,packs:r.packs??[],selectedPack:r.selectedPack??"",onSelectPack:r.onSelectPack??(()=>{}),onBuyPacks:r.onBuyPacks??(()=>{}),onCancel:y}),n==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-error",children:[e.jsx("img",{className:"buy-error__art",src:ks,alt:"",width:64,height:80}),e.jsxs("p",{className:"buy-error__text",children:[e.jsx("b",{children:a("cartCheckout.errorHeadline")})," ",a("cartCheckout.errorBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:y,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:r.onRetry??y,children:a("cartCheckout.tryAgain")})]})]})]})]})}function Ns({stage:r,step:n,total:h,isSelfCustody:y}){const C=r==="reserving",S=h>0?Math.min(100,Math.round(n/h*100)):0,q=r==="awaiting-signature"?y?a("buyModal.confirmToContinue"):a("buyModal.completingTransaction"):r==="settling"?a("buyModal.completingTransaction"):a("cartCheckout.preparing");return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:gs,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:q}),C?e.jsxs("div",{className:"cart-checkout__progress-row",children:[e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill buy-modal__progress-fill--step",style:{width:`${S}%`}})}),h>1?e.jsxs("span",{className:"cart-checkout__step",children:[n,"/",h]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function Cs({lines:r,shortfallCredits:n,packs:h,selectedPack:y,onSelectPack:C,onBuyPacks:S,onCancel:q}){const w=h.find(t=>t.id===y),X=r.reduce((t,f)=>t+(f.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(ns,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:a("buyModal.insufficientFunds")})," ",a("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:a("buyModal.warningCreditsAmount",{count:Math.max(0,n)})})," ",a("buyModal.warningToPurchase",{count:X})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:r.map(t=>{const f=t.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"buy-modal__asset-name",title:t.item.name,children:[t.item.name||a("buyModal.itemFallback"),f>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:a("cartCheckout.qty",{count:f})}):null]}),t.item.creator?e.jsx(We,{address:t.item.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(F,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:Y(t.priceCredits*f)})]})]})]},t.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:h.map(t=>{const f=t.id===y;return e.jsxs("button",{className:`buy-modal__pack${f?" buy-modal__pack--on":""}`,onClick:()=>C(t.id),children:[e.jsx(F,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:Y(t.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",t.usd.toFixed(2),")"]})]},t.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(F,{className:"buy-modal__total-ico"}),e.jsx("span",{children:Y((w==null?void 0:w.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((w==null?void 0:w.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:q,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:S,children:a("buyModal.buy")})]})]})}const ws=Ze(es)`
2
2
  margin-top: 12px;
3
3
  `;function Ne(r){if(vs(r))return a("errors.rejected");const n=(r.message??"").toLowerCase();return n.includes("insufficient")?a("cart.error.insufficient",{currency:ss.name}):n.includes("no active listing")||n.includes("your own listing")?a("cart.error.listingChanged"):a("marketCheckout.error.generic")}const Ss=12e4;function qs(r){const n=[];return r.unavailable.length&&n.push(a("cart.drop.unavailable",{count:r.unavailable.length})),r.own.length&&n.push(a("cart.drop.own",{count:r.own.length})),a("cart.drop.removed",{items:n.join(` ${a("cart.drop.and")} `)})}const Ce=r=>r.reduce((n,h)=>n+h.priceCredits*h.quantity,0),Ms=r=>r.flatMap(n=>Array.from({length:n.quantity},()=>({...n,quantity:1})));function Ds(){ze({title:a("nav.cart"),noindex:!0});const r=N(s=>s.items),n=N(s=>s.remove),h=N(s=>s.increment),y=N(s=>s.decrement),C=N(s=>s.clear),S=N(s=>s.restore),q=N(s=>s.setFittingOpen),w=pe(s=>s.items),X=pe(s=>s.toggle),{session:t,signIn:f}=Oe(),W=ys().packs.slice(0,bs);m.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const we=r.some(s=>s.category!=="emote"),{data:Z}=$e({queryKey:["upsell-listings"],queryFn:()=>cs({first:40}),staleTime:6e4}),{data:T}=Ge(t),d=He(),z=Ae(),{state:M}=Ue(),[ce,B]=m.useState(null),[Se,L]=m.useState(null),[ne,O]=m.useState(null),[qe,E]=m.useState(!1),[x,K]=m.useState(null),ie=m.useRef(0),[o,k]=m.useState(null),[ee,le]=m.useState(""),se=m.useRef(null),oe=De(r),de=s=>ge(oe[s.id]),ae=r.filter(de),ue=r.length>0&&ae.length===0,Me=ae.reduce((s,c)=>s+c.priceCredits*c.quantity,0),Ee=r.reduce((s,c)=>s+c.quantity,0),Pe=ae.reduce((s,c)=>s+c.quantity,0),Ie=x?x.liveTotalCredits:Me,Re=new Set(r.map(s=>s.id)),he=((Z==null?void 0:Z.items)??[]).filter(s=>!Re.has(s.id)).slice(0,12),Fe=new Map(x==null?void 0:x.buyable.map(s=>[s.item.id,s])),$=(T==null?void 0:T.credits)??0,Te=Xe;function G(s){s(),K(null),O(null),L(null)}function Be(){k(null),E(!1)}function me(s){const c=Ce(s),i=Math.max(0,c-$),g=W.find(u=>u.credits>=i)??W[W.length-1];le(g.id),J("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:c,credits_balance:$,shortfall:i}),k({phase:"nofunds",lines:s.map(u=>({item:u.item,priceCredits:u.priceCredits,quantity:u.quantity})),shortfall:i}),E(!1)}async function Le(s){if(!t||s.length===0)return;const c=Ms(s),i=c.map(l=>({...l.item,priceCredits:l.priceCredits})),g=s.map(l=>({...l.item,priceCredits:l.priceCredits,quantity:l.quantity})),u=[];let j="authorize",H=!1;k({phase:"processing",stage:"reserving",step:1,total:c.length});try{const l=[];for(let b=0;b<c.length;b++){const I=c[b];k({phase:"processing",stage:"reserving",step:b+1,total:c.length});try{const{credit:p,maxCreditedValue:te}=await as(t.identity,I.usdCents,I.trade.id);u.push(p.id),l.push({trade:I.trade,credits:[p],maxCreditedValue:te})}catch(p){if(fs(p)){if(u.length){try{await fe(t.identity,u)}catch(te){U(te,{flow:"cart_checkout",step:"release"})}d.invalidateQueries({queryKey:["usd-balance"]})}me(s);return}throw p}}j="submit";const v=()=>k({phase:"processing",stage:"settling",step:c.length,total:c.length});k({phase:"processing",stage:"awaiting-signature",step:c.length,total:c.length});let _=[];if(_s())try{_=await os({purchases:l,buyer:t.address,signer:t.signer,onSigned:v});const I=(await Promise.allSettled(_.map(p=>ds(p)))).flatMap(p=>p.status==="rejected"?[p.reason]:[]);if(I.length&&!I.some(p=>p instanceof us))throw I[0];H=!0}catch(b){if(!(b instanceof hs))throw b;_=await je({purchases:l,buyer:t.address,signer:t.signer,onSigned:v})}else _=await je({purchases:l,buyer:t.address,signer:t.signer});s.forEach(b=>n(b.item.id)),K(null),J("Shop Completed Purchase",{...ts(i),payment_type:"credits",no_crypto_step:H,transaction_hash:_[0]??null}),d.invalidateQueries({queryKey:["usd-balance"]}),d.invalidateQueries({queryKey:["detail-trade"]}),d.invalidateQueries({queryKey:["shop-item"]}),d.invalidateQueries({queryKey:["owned-token"]}),d.invalidateQueries({queryKey:["public-token"]}),d.invalidateQueries({queryKey:["item-resales"]}),d.invalidateQueries({queryKey:["shop-items"]}),d.invalidateQueries({queryKey:["catalog-items"]}),d.invalidateQueries({queryKey:["my-assets"]}),d.invalidateQueries({queryKey:["purchases"]}),d.invalidateQueries({queryKey:["owned-item-count"]}),d.invalidateQueries({queryKey:["overview-listings"]}),d.invalidateQueries({queryKey:["upsell-listings"]});const A=se.current;se.current=null,k(null),E(!1);const D={items:g,txHash:_[0]??void 0,settled:!0,...A?{creditsAdded:A}:{}};z("/success",{state:D,replace:!0})}catch(l){if(xe(l)||U(l,{flow:"cart_checkout",step:j,cart_size:s.length}),J(xe(l)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:j,error_code:rs(l),value_usd:ve(i.reduce((v,_)=>v+_.priceCredits,0)),cart_size:c.length}),u.length){try{await fe(t.identity,u)}catch(v){U(v,{flow:"cart_checkout",step:"release"})}d.invalidateQueries({queryKey:["usd-balance"]})}k({phase:"error",message:Ne(l)})}}function _e(s){const c=Ce(s);if(T!=null&&T.credits<c){me(s);return}Le(s)}async function Q(){if(!t){ke({type:"cart-checkout"}),f();return}const s=N.getState().items.filter(de);if(s.length===0)return;L(null),O(null),E(!0);const c=s.reduce((i,g)=>i+g.priceCredits*g.quantity,0);J("Shop Started Checkout",{cart_size:s.length,cart_value_credits:c,cart_value_usd:ve(c),has_sufficient_credits:$>=c});try{B(a("cart.status.reviewing"));const i=await ms(s,t.address,Te),g=[...i.unavailable,...i.own];if(g.length&&(g.forEach(u=>n(u.id)),O(qs(i))),i.buyable.length===0){L(a("cart.error.noneAvailable")),K(null),B(null);return}if(i.orderChanged){K(i),ie.current=Date.now(),B(null);return}B(null),_e(i.buyable)}catch(i){U(i,{flow:"cart_checkout",step:"review",cart_size:s.length}),L(Ne(i)),B(null)}finally{E(!1)}}async function Ke(){if(x){if(!t){ke({type:"cart-checkout"}),f();return}if(Date.now()-ie.current>Ss){K(null),O(null),await Q();return}L(null),_e(x.buyable)}}async function Qe(){if(ee){try{sessionStorage.setItem(V,JSON.stringify(N.getState().items))}catch{}E(!0);try{const s=await ps(ee,t?{address:t.address,identity:t.identity}:void 0);if(s.url){window.location.href=s.url;return}z("/credits")}catch(s){try{sessionStorage.removeItem(V)}catch{}U(s,{flow:"cart_buy_credits"}),k({phase:"error",message:a("buyModal.error.creditsCheckout")})}finally{E(!1)}}}const ye=m.useRef(!1);m.useEffect(()=>{if(!t||ye.current||!is("cart-checkout"))return;ye.current=!0;const s=setTimeout(()=>void Q(),0);return()=>clearTimeout(s)},[t]);const be=m.useRef(!1);m.useEffect(()=>{if(!(M!=null&&M.resumeCheckout)||be.current)return;be.current=!0,se.current=M.creditsAdded??null;try{const c=sessionStorage.getItem(V);if(c){sessionStorage.removeItem(V);const i=JSON.parse(c);Array.isArray(i)&&i.length&&S(i)}}catch{}d.invalidateQueries({queryKey:["usd-balance"]});const s=setTimeout(()=>void Q(),0);return()=>clearTimeout(s)},[M==null?void 0:M.resumeCheckout]);const P=qe||(o==null?void 0:o.phase)==="processing";return r.length===0&&!o?e.jsxs("div",{className:"cart cart--empty",children:[e.jsx(R,{name:"cart",size:44,color:"var(--muted-2)"}),e.jsx("p",{className:"cart-empty__title",children:a("cart.empty.title")}),e.jsx("p",{className:"muted",children:a("cart.empty.body")}),e.jsx(ws,{as:re,to:"/assets",variant:"purple",children:a("cart.empty.cta")})]}):e.jsxs("div",{className:"checkout",children:[e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>z(-1),type:"button",children:[e.jsx(R,{name:"arrow-left"}),a("nav.cart")]}),e.jsxs("div",{className:"checkout__body",children:[e.jsxs("div",{className:"checkout__left",children:[e.jsxs("div",{className:"checkout__head-card",children:[e.jsx("button",{className:"checkout__panel-back",onClick:()=>z(-1),type:"button","aria-label":a("cart.goBack"),children:e.jsx(R,{name:"arrow-left"})}),e.jsx("h1",{className:"checkout__panel-title",children:a("cart.panelTitle",{count:Ee})}),we?e.jsxs("button",{className:"checkout__fitting",onClick:()=>q(!0),disabled:P,children:[e.jsx(R,{name:"fitting-room"}),a("cart.fittingRoom")]}):null]}),e.jsxs("section",{className:"checkout__panel",children:[e.jsx("div",{className:"checkout__list",children:r.map(s=>{const c=Fe.get(s.id),i=c?c.priceCredits:s.priceCredits,g=!!c&&c.priceCredits!==s.priceCredits,u=!s.tokenId,j=s.quantity,H=typeof s.available=="number"&&j>=s.available,l=i*j,v=!!w[s.id],_=Je(s),A=oe[s.id],D=!ge(A),b=A==="sold-out"?a("cart.availability.soldOut"):a("cart.availability.unavailable");return e.jsxs("div",{className:`checkout__card${D?" is-unavailable":""}`,children:[e.jsxs("div",{className:"checkout__thumb",children:[_?e.jsx(re,{className:"checkout__thumb-link",to:_,state:{item:s,tradeId:s.tradeId},"aria-label":s.name,children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null}):s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null,e.jsx("span",{className:"checkout__thumb-check","aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"checkout__info",children:[e.jsxs("div",{className:"checkout__desc",children:[_?e.jsx(re,{className:"checkout__name",to:_,state:{item:s,tradeId:s.tradeId},title:s.name,children:s.name}):e.jsx("div",{className:"checkout__name",title:s.name,children:s.name}),s.creator?e.jsx(Ve,{address:s.creator,className:"checkout__creator",linkToProfile:!0}):null]}),e.jsx("div",{className:"checkout__foot",children:D?e.jsx("span",{className:"checkout__unavailable",children:b}):e.jsxs(e.Fragment,{children:[u?e.jsxs("div",{className:"checkout__stepper",children:[e.jsx("button",{className:"checkout__step",onClick:()=>G(()=>y(s.id)),disabled:P||j<=1,"aria-label":a("cart.decreaseQuantity",{name:s.name}),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsx("span",{className:"checkout__qty",children:j}),e.jsx("button",{className:"checkout__step",onClick:()=>G(()=>h(s.id)),disabled:P||H,"aria-label":a("cart.increaseQuantity"),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null,e.jsxs("div",{className:"checkout__price",children:[e.jsx(F,{className:"checkout__price-ico"})," ",l,g?e.jsx("span",{className:"checkout__price-was",children:s.priceCredits*j}):null]})]})})]}),e.jsxs("div",{className:"checkout__actions",children:[e.jsx("button",{className:`checkout__fav${v?" is-on":""}`,onClick:()=>X(s),"aria-label":v?a("cart.removeFromFavorites",{name:s.name}):a("cart.addToFavorites",{name:s.name}),title:v?a("assetCard.removeFromFavorites"):a("assetCard.addToFavorites"),children:e.jsx(R,{name:v?"heart-solid":"heart"})}),e.jsx("button",{className:"checkout__remove",onClick:()=>G(()=>n(s.id)),disabled:P,"aria-label":a("cart.remove",{name:s.name}),title:a("cart.removeTitle"),children:e.jsx(R,{name:"trash",size:24})})]})]},s.id)})}),e.jsx("div",{className:"checkout__utils",children:e.jsx("button",{className:"link",onClick:()=>G(C),disabled:P,children:a("cart.clearCart")})})]})]}),e.jsxs("aside",{className:"checkout__summary",children:[e.jsx("h2",{className:"checkout__summary-title",children:a("cart.purchaseSummary")}),e.jsxs("div",{className:"checkout__summary-body",children:[e.jsxs("div",{className:"checkout__total-line",children:[e.jsx("span",{className:"checkout__total-label",children:a("cart.totalItems",{count:Pe})}),e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(F,{className:"checkout__total-ico"})," ",Ie]})]}),e.jsx("button",{className:"checkout__cta",onClick:()=>void(x?Ke():Q()),disabled:P||ue,children:P?a("cart.working"):x?a("marketCheckout.confirmPurchase"):a("assetCard.buyNow")}),ue?e.jsx("p",{className:"muted checkout__msg",children:a("cart.allUnavailable")}):null,t?null:e.jsx("p",{className:"muted checkout__msg",children:a("cart.signInHint")}),x?e.jsx("p",{className:"muted checkout__msg",children:a("cart.priceChanged")}):null,ne?e.jsx("p",{className:"muted checkout__msg",children:ne}):null,ce?e.jsx("p",{className:"muted checkout__msg",children:ce}):null,e.jsx(xs,{message:Se,className:"checkout__msg"})]})]})]})]}),he.length>0?e.jsx("div",{className:"cart-upsell",children:e.jsx(ls,{title:a("cart.youMightAlsoLike"),items:he})}):null,o?e.jsx(js,{phase:o.phase,balanceCredits:$,onClose:Be,stage:o.phase==="processing"?o.stage:void 0,step:o.phase==="processing"?o.step:void 0,total:o.phase==="processing"?o.total:void 0,isSelfCustody:Ye(t==null?void 0:t.providerType),lines:o.phase==="nofunds"?o.lines:void 0,shortfallCredits:o.phase==="nofunds"?o.shortfall:void 0,packs:W,selectedPack:ee,onSelectPack:le,onBuyPacks:()=>void Qe(),message:o.phase==="error"?o.message:void 0,onRetry:()=>void Q()}):null]})}export{Ds as Cart};
@@ -1,4 +1,4 @@
1
- import{Q as N,R as U,S as w,U as z,V as o,W as E,X as c,Y as I,Z as g,$ as D,O as R}from"./index-s056mQ5V.js";import{r as W,j as v}from"./react-BW1xvPTF.js";function F(r){return N("MuiCircularProgress",r)}U("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,S,b,$;const t=44,V=R(P||(P=l`
1
+ import{Q as N,R as U,S as w,U as z,V as o,W as E,X as c,Y as I,Z as g,$ as D,O as R}from"./index-CQ7zHnQz.js";import{r as W,j as v}from"./react-BW1xvPTF.js";function F(r){return N("MuiCircularProgress",r)}U("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,S,b,$;const t=44,V=R(P||(P=l`
2
2
  0% {
3
3
  transform: rotate(0deg);
4
4
  }
@@ -1,4 +1,4 @@
1
- import{j as e,r as p,d as O,u as Q}from"./react-BW1xvPTF.js";import{J as N,s as v,ar as Y,as as E,I as Z,t,p as V,H as W,o as X,m as ee,A as ae,at as te,e as re,au as se}from"./index-s056mQ5V.js";import{E as oe}from"./ErrorNotice-BG40E5Ff.js";import{d as ie,g as ce,a as ne,A as le}from"./collection-C81dinEb.js";import{u as de}from"./useStore-B63Yqu_R.js";import{d as F,a as me,F as pe,e as ue,S as R,b as ge}from"./categories-BhIJhSSv.js";import{L as xe}from"./LoadMore-B-s5G0me.js";import{u as he}from"./useInfiniteGrid-DzWtFyHK.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BcZhdsUx.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";const be=v.section`
1
+ import{j as e,r as p,d as O,u as Q}from"./react-BW1xvPTF.js";import{J as N,s as v,ar as Y,as as E,I as Z,t,p as V,H as W,o as X,m as ee,A as ae,at as te,e as re,au as se}from"./index-CQ7zHnQz.js";import{E as oe}from"./ErrorNotice-BG40E5Ff.js";import{d as ie,g as ce,a as ne,A as le}from"./collection-COS6jpIf.js";import{u as de}from"./useStore-B33TojLf.js";import{d as F,a as me,F as pe,e as ue,S as R,b as ge}from"./categories-7z3tYoma.js";import{L as xe}from"./LoadMore-D8ty75NY.js";import{u as he}from"./useInfiniteGrid-DWshFIqR.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BcZhdsUx.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";const be=v.section`
2
2
  position: relative;
3
3
  border-radius: ${N.radius.card};
4
4
  overflow: hidden;
@@ -1 +1 @@
1
- import{j as e,r as o}from"./react-BW1xvPTF.js";import{t as i,I as C,ao as g,A as E}from"./index-s056mQ5V.js";const d="shop:resume_after_signin",N=900*1e3;function I(l){try{sessionStorage.setItem(d,JSON.stringify({...l,at:Date.now()}))}catch{}}function M(l){let c;try{c=sessionStorage.getItem(d)}catch{return null}if(!c)return null;try{sessionStorage.removeItem(d)}catch{}let s;try{s=JSON.parse(c)}catch{return null}return!s||s.type!==l||typeof s.at!="number"||Date.now()-s.at>N?null:s.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:s.path}}function W({className:l}){return e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:l,children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"#691fa9",strokeWidth:"1.8"}),e.jsx("path",{d:"M12 7v6",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"16.5",r:"1.1",fill:"#691fa9"})]})}function L({title:l,items:c,onViewAll:s}){const a=o.useRef(null),[h,p]=o.useState(1),[f,v]=o.useState(0),[j,k]=o.useState(!0),[w,y]=o.useState(!1),n=o.useCallback(()=>{const r=a.current;if(!r)return;const{scrollLeft:t,scrollWidth:_,clientWidth:u}=r,x=Math.max(1,Math.ceil(_/u));p(x),v(Math.min(x-1,Math.round(t/u))),k(t<=1),y(t+u>=_-1)},[]);if(o.useEffect(()=>{n();const r=a.current;if(r)return r.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n),()=>{r.removeEventListener("scroll",n),window.removeEventListener("resize",n)}},[n,c.length]),c.length===0)return null;function m(r){const t=a.current;t&&t.scrollBy({left:r*t.clientWidth,behavior:"smooth"})}function b(r){const t=a.current;t&&t.scrollTo({left:r*t.clientWidth,behavior:"smooth"})}return e.jsxs("section",{className:"collection-carousel",children:[e.jsxs("div",{className:"collection-carousel__head",children:[e.jsx("h2",{className:"collection-carousel__title",children:l}),s?e.jsxs("button",{className:"collection-carousel__viewall",onClick:s,children:[i("collectionCarousel.viewAll"),e.jsx(C,{name:"chevron-down",size:16,className:"collection-carousel__viewall-ico"})]}):null]}),e.jsxs("div",{className:"collection-carousel__viewport",children:[e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--left",onClick:()=>m(-1),"aria-label":i("collectionCarousel.scrollLeft"),disabled:j,children:e.jsx("img",{src:g,alt:"","aria-hidden":!0})}),e.jsx("div",{className:"collection-carousel__track",ref:a,children:c.map(r=>e.jsx(E,{item:r},r.id))}),e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--right",onClick:()=>m(1),"aria-label":i("collectionCarousel.scrollRight"),disabled:w,children:e.jsx("img",{src:g,alt:"","aria-hidden":!0})})]}),h>1?e.jsx("div",{className:"collection-carousel__dots","aria-label":i("collectionCarousel.pages"),children:Array.from({length:h}).map((r,t)=>e.jsx("button",{className:`collection-carousel__dot${t===f?" is-active":""}`,"aria-label":i("collectionCarousel.goToPage",{page:t+1}),"aria-current":t===f?"true":void 0,onClick:()=>b(t)},t))}):null]})}export{L as C,W,I as s,M as t};
1
+ import{j as e,r as o}from"./react-BW1xvPTF.js";import{t as i,I as C,ao as g,A as E}from"./index-CQ7zHnQz.js";const d="shop:resume_after_signin",N=900*1e3;function I(l){try{sessionStorage.setItem(d,JSON.stringify({...l,at:Date.now()}))}catch{}}function M(l){let c;try{c=sessionStorage.getItem(d)}catch{return null}if(!c)return null;try{sessionStorage.removeItem(d)}catch{}let s;try{s=JSON.parse(c)}catch{return null}return!s||s.type!==l||typeof s.at!="number"||Date.now()-s.at>N?null:s.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:s.path}}function W({className:l}){return e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:l,children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"#691fa9",strokeWidth:"1.8"}),e.jsx("path",{d:"M12 7v6",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"16.5",r:"1.1",fill:"#691fa9"})]})}function L({title:l,items:c,onViewAll:s}){const a=o.useRef(null),[h,p]=o.useState(1),[f,v]=o.useState(0),[j,k]=o.useState(!0),[w,y]=o.useState(!1),n=o.useCallback(()=>{const r=a.current;if(!r)return;const{scrollLeft:t,scrollWidth:_,clientWidth:u}=r,x=Math.max(1,Math.ceil(_/u));p(x),v(Math.min(x-1,Math.round(t/u))),k(t<=1),y(t+u>=_-1)},[]);if(o.useEffect(()=>{n();const r=a.current;if(r)return r.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n),()=>{r.removeEventListener("scroll",n),window.removeEventListener("resize",n)}},[n,c.length]),c.length===0)return null;function m(r){const t=a.current;t&&t.scrollBy({left:r*t.clientWidth,behavior:"smooth"})}function b(r){const t=a.current;t&&t.scrollTo({left:r*t.clientWidth,behavior:"smooth"})}return e.jsxs("section",{className:"collection-carousel",children:[e.jsxs("div",{className:"collection-carousel__head",children:[e.jsx("h2",{className:"collection-carousel__title",children:l}),s?e.jsxs("button",{className:"collection-carousel__viewall",onClick:s,children:[i("collectionCarousel.viewAll"),e.jsx(C,{name:"chevron-down",size:16,className:"collection-carousel__viewall-ico"})]}):null]}),e.jsxs("div",{className:"collection-carousel__viewport",children:[e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--left",onClick:()=>m(-1),"aria-label":i("collectionCarousel.scrollLeft"),disabled:j,children:e.jsx("img",{src:g,alt:"","aria-hidden":!0})}),e.jsx("div",{className:"collection-carousel__track",ref:a,children:c.map(r=>e.jsx(E,{item:r},r.id))}),e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--right",onClick:()=>m(1),"aria-label":i("collectionCarousel.scrollRight"),disabled:w,children:e.jsx("img",{src:g,alt:"","aria-hidden":!0})})]}),h>1?e.jsx("div",{className:"collection-carousel__dots","aria-label":i("collectionCarousel.pages"),children:Array.from({length:h}).map((r,t)=>e.jsx("button",{className:`collection-carousel__dot${t===f?" is-active":""}`,"aria-label":i("collectionCarousel.goToPage",{page:t+1}),"aria-current":t===f?"true":void 0,onClick:()=>b(t)},t))}):null]})}export{L as C,W,I as s,M as t};
@@ -1 +1 @@
1
- import{u as K,j as e,L as re,d as se,b as te,r as j}from"./react-BW1xvPTF.js";import{av as oe,aw as ce,x as le,t as a,ax as E,B as ne,ar as D,u as ie,as as O,I,p as de,m as me,A as ue,an as he,ay as ge,e as xe}from"./index-s056mQ5V.js";import{d as _e,g as pe,a as Ne,A as je}from"./collection-C81dinEb.js";import{u as be,L as fe}from"./useStore-B63Yqu_R.js";import{d as $,a as ve,S as w,F as Ce,e as we,b as ke}from"./categories-BhIJhSSv.js";import{L as B}from"./LoadMore-B-s5G0me.js";import{u as R}from"./useInfiniteGrid-DzWtFyHK.js";import{E as T}from"./ErrorNotice-BG40E5Ff.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BcZhdsUx.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";function Pe({collection:t,cover:r,itemCount:o}){const n=K(),{contractAddress:m,name:g,creator:x}=t,N=r==null||o==null,{data:i}=oe(m,N),p=r==null?(i==null?void 0:i.items)??[]:[],h=o??(i==null?void 0:i.total);function _(){n(`/collection/${m}`)}return e.jsxs("article",{className:"coll-card",role:"link",tabIndex:0,onClick:_,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),_())},children:[e.jsx("div",{className:"coll-card__media",children:r?e.jsx("img",{className:"coll-card__img","data-testid":"coll-card-img",src:r,alt:"",loading:"lazy"}):p.length>0?e.jsx(ce,{items:p,className:"coll-card__cover"}):null}),e.jsxs("div",{className:"coll-card__body",children:[e.jsx("h3",{className:"coll-card__name",title:g,children:g}),e.jsxs("div",{className:"coll-card__meta",children:[x?e.jsx(le,{address:x,className:"coll-card__creator",linkToProfile:!0}):e.jsx("span",{className:"coll-card__creator",children:" "}),e.jsx("span",{className:"coll-card__count",children:h==null?"…":a("collectionCard.itemCount",{count:h})})]}),e.jsx("button",{className:"coll-card__view",onClick:d=>{d.stopPropagation(),_()},tabIndex:-1,children:a("collectionCard.viewCollection")})]})]})}function ye({address:t,className:r=""}){const o=E(m=>m.followed.includes(t.toLowerCase())),n=E(m=>m.toggle);return t?e.jsx(ne,{type:"button",size:"sm",variant:o?"ghost":"outline",className:r||void 0,"aria-pressed":o,title:o?a("creator.unfollowTitle"):a("creator.followTitle"),onClick:()=>n(t),children:o?a("creator.following"):a("creator.follow")}):null}const Se={website:"website",twitter:"twitter",discord:"discord",facebook:"facebook"};function Le({address:t}){var d,b;const{data:r}=D(t),{data:o}=be(t),n=ie(l=>{var f;return(f=l.session)==null?void 0:f.address}),m=!!n&&n.toLowerCase()===t.toLowerCase(),g=(r==null?void 0:r.name)||O(t),x=(b=(d=r==null?void 0:r.avatar)==null?void 0:d.snapshots)==null?void 0:b.face256,N=(o==null?void 0:o.cover)||_e,i=o==null?void 0:o.description,p=`${de.profileUrl}/${t}`,h=fe.filter(l=>o==null?void 0:o.links[l]),_=pe(Ne({name:r==null?void 0:r.name,hasClaimedName:r==null?void 0:r.hasClaimedName,ethAddress:(r==null?void 0:r.ethAddress)??t}));return e.jsxs("section",{className:"creator-hero","aria-label":`${g} storefront`,children:[e.jsxs("div",{className:"creator-hero__cover",children:[e.jsx("img",{className:"creator-hero__cover-img",src:N,alt:"",loading:"eager"}),e.jsx("div",{className:"creator-hero__scrim","aria-hidden":!0})]}),(h.length>0||m)&&e.jsxs("div",{className:"creator-hero__links",children:[h.map(l=>e.jsx("a",{className:"creator-hero__link","data-testid":"creator-hero-link",href:(o==null?void 0:o.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:a(`creator.link.${l}`),"aria-label":a(`creator.link.${l}`),children:e.jsx(I,{name:Se[l]})},l)),m&&e.jsx(re,{className:"creator-hero__link creator-hero__edit",to:"/store-settings",title:a("creator.editStore"),"aria-label":a("creator.editStore"),children:e.jsx(I,{name:"pen"})})]}),e.jsxs("div",{className:"creator-hero__body",children:[x?e.jsx("img",{className:"creator-hero__ava",src:x,alt:"",loading:"eager",style:{backgroundColor:_}}):e.jsx("span",{className:"creator-hero__ava creator-hero__ava--ph","aria-hidden":!0,style:{backgroundColor:_}}),e.jsxs("div",{children:[e.jsx("h2",{className:"creator-hero__name",children:g}),i?e.jsx("p",{className:"creator-hero__desc",children:i}):null]}),e.jsxs("div",{className:"creator-hero__actions",children:[e.jsx("a",{className:"creator-hero__view","data-testid":"creator-hero-view",href:p,target:"_blank",rel:"noopener noreferrer",children:a("creator.viewProfile")}),e.jsx(ye,{address:t,className:"creator-hero__follow"})]})]})]})}const U=48;function ze(){const{address:t}=se(),r=K(),[o]=te(),n=o.has("collections"),{data:m}=D(t),g=(m==null?void 0:m.name)||(t?O(t):a("creator.fallbackName"));me({title:g,description:a("seo.creator.description",{name:g})});const[x,N]=j.useState("wearable"),[i,p]=j.useState(null),[h,_]=j.useState([]),[d,b]=j.useState(""),[l,f]=j.useState(""),[P,z]=j.useState("newest"),y=d&&!Number.isNaN(Number(d))?Number(d):void 0,S=l&&!Number.isNaN(Number(l))?Number(l):void 0,G=i?ke[i]:void 0,H=($.find(s=>s.key===P)??$[0]).server,L={creator:t,category:x,rarities:h.length?h:void 0,wearableCategories:G,minPriceCredits:y,maxPriceCredits:S,sortBy:H},{items:v,total:Y,isLoading:C,error:A,hasNextPage:W,isFetchingNextPage:F,fetchNextPage:Z}=R(["creator-listings",L],s=>he({...L,first:U,skip:s}),{enabled:!!t&&!n}),u=R(["creator-collections",t],s=>ge(t,{first:U,skip:s}).then(c=>({items:c.collections,total:c.total})),{enabled:!!t&&n});function q(s){N(s),p(null),n&&M()}function M(){const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}`:""},{replace:!0})}function J(){if(n){M();return}const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function Q(s){_(c=>c.includes(s)?c.filter(ae=>ae!==s):[...c,s])}function V(){N("wearable"),p(null),_([]),b(""),f("")}const k=!!(y||S),X=k?`${d||"0"}–${l||"∞"}`:a("filter.price"),ee=x!=="wearable"||!!i||h.length>0||k;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":a("creator.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>r("/assets"),children:a("creator.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:g})]}),t?e.jsx(Le,{address:t}):null,!n&&!C&&v.length>0?e.jsx(je,{items:v,source:"creator"}):null,e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(ve,{category:x,subCategory:i,onCategory:q,onSub:p,title:a("creator.category"),flat:!0,collections:n,onCollections:J})}),e.jsx("div",{className:"browse__main",children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"creator-collections__bar",children:e.jsx("span",{className:"assets__count",children:u.isLoading?"…":a("creator.collectionsCount",{count:u.total})})}),u.error?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid grid--collections",children:u.isLoading?e.jsx(w,{count:9}):e.jsxs(e.Fragment,{children:[u.items.map(s=>e.jsx(Pe,{collection:s,itemCount:s.itemCount},s.contractAddress)),u.isFetchingNextPage?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:u.hasNextPage,isFetching:u.isFetchingNextPage,onLoadMore:()=>void u.fetchNextPage()}),!u.isLoading&&!u.error&&u.items.length===0?e.jsx("p",{className:"muted",children:a("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{rarities:h,onToggleRarity:Q,sort:P,onSort:z,total:Y,loading:C,anyActive:ee,onClear:V,renderTrailing:s=>e.jsx(we,{panelKey:"price",label:X,active:k,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMin"),placeholder:a("creator.priceMinPlaceholder"),value:d,onChange:c=>b(c.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMax"),placeholder:a("creator.priceMaxPlaceholder"),value:l,onChange:c=>f(c.target.value)})]}),e.jsx("p",{className:"filter-pop__hint",children:a("creator.priceHint",{currency:xe.name})})]})})}),A?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid",children:C?e.jsx(w,{count:15}):e.jsxs(e.Fragment,{children:[v.map(s=>e.jsx(ue,{item:s},s.id)),F?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:W,isFetching:F,onLoadMore:()=>void Z()}),!C&&!A&&v.length===0?e.jsx("p",{className:"muted",children:a("creator.empty")}):null]})})]})]})}export{ze as Creator,ze as default};
1
+ import{u as K,j as e,L as re,d as se,b as te,r as j}from"./react-BW1xvPTF.js";import{av as oe,aw as ce,x as le,t as a,ax as E,B as ne,ar as D,u as ie,as as O,I,p as de,m as me,A as ue,an as he,ay as ge,e as xe}from"./index-CQ7zHnQz.js";import{d as _e,g as pe,a as Ne,A as je}from"./collection-COS6jpIf.js";import{u as be,L as fe}from"./useStore-B33TojLf.js";import{d as $,a as ve,S as w,F as Ce,e as we,b as ke}from"./categories-7z3tYoma.js";import{L as B}from"./LoadMore-D8ty75NY.js";import{u as R}from"./useInfiniteGrid-DWshFIqR.js";import{E as T}from"./ErrorNotice-BG40E5Ff.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BcZhdsUx.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";function Pe({collection:t,cover:r,itemCount:o}){const n=K(),{contractAddress:m,name:g,creator:x}=t,N=r==null||o==null,{data:i}=oe(m,N),p=r==null?(i==null?void 0:i.items)??[]:[],h=o??(i==null?void 0:i.total);function _(){n(`/collection/${m}`)}return e.jsxs("article",{className:"coll-card",role:"link",tabIndex:0,onClick:_,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),_())},children:[e.jsx("div",{className:"coll-card__media",children:r?e.jsx("img",{className:"coll-card__img","data-testid":"coll-card-img",src:r,alt:"",loading:"lazy"}):p.length>0?e.jsx(ce,{items:p,className:"coll-card__cover"}):null}),e.jsxs("div",{className:"coll-card__body",children:[e.jsx("h3",{className:"coll-card__name",title:g,children:g}),e.jsxs("div",{className:"coll-card__meta",children:[x?e.jsx(le,{address:x,className:"coll-card__creator",linkToProfile:!0}):e.jsx("span",{className:"coll-card__creator",children:" "}),e.jsx("span",{className:"coll-card__count",children:h==null?"…":a("collectionCard.itemCount",{count:h})})]}),e.jsx("button",{className:"coll-card__view",onClick:d=>{d.stopPropagation(),_()},tabIndex:-1,children:a("collectionCard.viewCollection")})]})]})}function ye({address:t,className:r=""}){const o=E(m=>m.followed.includes(t.toLowerCase())),n=E(m=>m.toggle);return t?e.jsx(ne,{type:"button",size:"sm",variant:o?"ghost":"outline",className:r||void 0,"aria-pressed":o,title:o?a("creator.unfollowTitle"):a("creator.followTitle"),onClick:()=>n(t),children:o?a("creator.following"):a("creator.follow")}):null}const Se={website:"website",twitter:"twitter",discord:"discord",facebook:"facebook"};function Le({address:t}){var d,b;const{data:r}=D(t),{data:o}=be(t),n=ie(l=>{var f;return(f=l.session)==null?void 0:f.address}),m=!!n&&n.toLowerCase()===t.toLowerCase(),g=(r==null?void 0:r.name)||O(t),x=(b=(d=r==null?void 0:r.avatar)==null?void 0:d.snapshots)==null?void 0:b.face256,N=(o==null?void 0:o.cover)||_e,i=o==null?void 0:o.description,p=`${de.profileUrl}/${t}`,h=fe.filter(l=>o==null?void 0:o.links[l]),_=pe(Ne({name:r==null?void 0:r.name,hasClaimedName:r==null?void 0:r.hasClaimedName,ethAddress:(r==null?void 0:r.ethAddress)??t}));return e.jsxs("section",{className:"creator-hero","aria-label":`${g} storefront`,children:[e.jsxs("div",{className:"creator-hero__cover",children:[e.jsx("img",{className:"creator-hero__cover-img",src:N,alt:"",loading:"eager"}),e.jsx("div",{className:"creator-hero__scrim","aria-hidden":!0})]}),(h.length>0||m)&&e.jsxs("div",{className:"creator-hero__links",children:[h.map(l=>e.jsx("a",{className:"creator-hero__link","data-testid":"creator-hero-link",href:(o==null?void 0:o.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:a(`creator.link.${l}`),"aria-label":a(`creator.link.${l}`),children:e.jsx(I,{name:Se[l]})},l)),m&&e.jsx(re,{className:"creator-hero__link creator-hero__edit",to:"/store-settings",title:a("creator.editStore"),"aria-label":a("creator.editStore"),children:e.jsx(I,{name:"pen"})})]}),e.jsxs("div",{className:"creator-hero__body",children:[x?e.jsx("img",{className:"creator-hero__ava",src:x,alt:"",loading:"eager",style:{backgroundColor:_}}):e.jsx("span",{className:"creator-hero__ava creator-hero__ava--ph","aria-hidden":!0,style:{backgroundColor:_}}),e.jsxs("div",{children:[e.jsx("h2",{className:"creator-hero__name",children:g}),i?e.jsx("p",{className:"creator-hero__desc",children:i}):null]}),e.jsxs("div",{className:"creator-hero__actions",children:[e.jsx("a",{className:"creator-hero__view","data-testid":"creator-hero-view",href:p,target:"_blank",rel:"noopener noreferrer",children:a("creator.viewProfile")}),e.jsx(ye,{address:t,className:"creator-hero__follow"})]})]})]})}const U=48;function ze(){const{address:t}=se(),r=K(),[o]=te(),n=o.has("collections"),{data:m}=D(t),g=(m==null?void 0:m.name)||(t?O(t):a("creator.fallbackName"));me({title:g,description:a("seo.creator.description",{name:g})});const[x,N]=j.useState("wearable"),[i,p]=j.useState(null),[h,_]=j.useState([]),[d,b]=j.useState(""),[l,f]=j.useState(""),[P,z]=j.useState("newest"),y=d&&!Number.isNaN(Number(d))?Number(d):void 0,S=l&&!Number.isNaN(Number(l))?Number(l):void 0,G=i?ke[i]:void 0,H=($.find(s=>s.key===P)??$[0]).server,L={creator:t,category:x,rarities:h.length?h:void 0,wearableCategories:G,minPriceCredits:y,maxPriceCredits:S,sortBy:H},{items:v,total:Y,isLoading:C,error:A,hasNextPage:W,isFetchingNextPage:F,fetchNextPage:Z}=R(["creator-listings",L],s=>he({...L,first:U,skip:s}),{enabled:!!t&&!n}),u=R(["creator-collections",t],s=>ge(t,{first:U,skip:s}).then(c=>({items:c.collections,total:c.total})),{enabled:!!t&&n});function q(s){N(s),p(null),n&&M()}function M(){const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}`:""},{replace:!0})}function J(){if(n){M();return}const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function Q(s){_(c=>c.includes(s)?c.filter(ae=>ae!==s):[...c,s])}function V(){N("wearable"),p(null),_([]),b(""),f("")}const k=!!(y||S),X=k?`${d||"0"}–${l||"∞"}`:a("filter.price"),ee=x!=="wearable"||!!i||h.length>0||k;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":a("creator.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>r("/assets"),children:a("creator.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:g})]}),t?e.jsx(Le,{address:t}):null,!n&&!C&&v.length>0?e.jsx(je,{items:v,source:"creator"}):null,e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(ve,{category:x,subCategory:i,onCategory:q,onSub:p,title:a("creator.category"),flat:!0,collections:n,onCollections:J})}),e.jsx("div",{className:"browse__main",children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"creator-collections__bar",children:e.jsx("span",{className:"assets__count",children:u.isLoading?"…":a("creator.collectionsCount",{count:u.total})})}),u.error?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid grid--collections",children:u.isLoading?e.jsx(w,{count:9}):e.jsxs(e.Fragment,{children:[u.items.map(s=>e.jsx(Pe,{collection:s,itemCount:s.itemCount},s.contractAddress)),u.isFetchingNextPage?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:u.hasNextPage,isFetching:u.isFetchingNextPage,onLoadMore:()=>void u.fetchNextPage()}),!u.isLoading&&!u.error&&u.items.length===0?e.jsx("p",{className:"muted",children:a("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{rarities:h,onToggleRarity:Q,sort:P,onSort:z,total:Y,loading:C,anyActive:ee,onClear:V,renderTrailing:s=>e.jsx(we,{panelKey:"price",label:X,active:k,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMin"),placeholder:a("creator.priceMinPlaceholder"),value:d,onChange:c=>b(c.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMax"),placeholder:a("creator.priceMaxPlaceholder"),value:l,onChange:c=>f(c.target.value)})]}),e.jsx("p",{className:"filter-pop__hint",children:a("creator.priceHint",{currency:xe.name})})]})})}),A?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid",children:C?e.jsx(w,{count:15}):e.jsxs(e.Fragment,{children:[v.map(s=>e.jsx(ue,{item:s},s.id)),F?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:W,isFetching:F,onLoadMore:()=>void Z()}),!C&&!A&&v.length===0?e.jsx("p",{className:"muted",children:a("creator.empty")}):null]})})]})]})}export{ze as Creator,ze as default};
@@ -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-CSS0v250.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-CFAO03Mm.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-8Loh-tcg.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-BRp1Hi5c.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 +1 @@
1
- import{u as Y,b as q,r as n,j as e}from"./react-BW1xvPTF.js";import{m as Q,t as s,u as V,b as W,j as g,ai as z,e as d,H as A,k as I,C as D,f as $}from"./index-s056mQ5V.js";import{R as F}from"./resume-buy-Bf0zIH7y.js";import{R as J}from"./cart-checkout-DbfpnMCR.js";import{l as Z}from"./loader-logo-BzY9EKdC.js";import{u as X,p as ee,c as se,i as te}from"./useCreditPacks-19hJrzxg.js";import{C as re}from"./CircularProgress-BOlrlIsy.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BcZhdsUx.js";import"./intl-CBcMB1D2.js";const x="https://cdn.decentraland.org/@dcl/shop/0.1.0-30133871697.commit-2ebb498/assets/pack-chips--HnOpf5U.webp",ae="https://cdn.decentraland.org/@dcl/shop/0.1.0-30133871697.commit-2ebb498/assets/credit-coin-CmcTCd5i.webp",ce="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",C=te()?"mock":"stripe",ie={pack_5:x,pack_10:x,pack_25:x,pack_50:x},ne="https://docs.decentraland.org";function G(o){const r=o;if((r==null?void 0:r.name)==="AbortError")return s("getCredits.errorCanceled");const m=((r==null?void 0:r.message)??"").toLowerCase();return m.includes("sign in")?s("getCredits.errorSignIn",{currency:d.name}):m.includes("timed out")?s("getCredits.errorTimeout",{currency:d.name}):s("getCredits.errorGeneric")}function ke(){Q({title:s("nav.getCredits",{currency:d.name}),noindex:!0});const o=Y(),{session:r,signIn:m}=V(),i=W(),[k,S]=q(),{packs:M,isLoading:T}=X(),[p,l]=n.useState("select"),[c,w]=n.useState(null),[E,R]=n.useState(null),[U,h]=n.useState(null),[K,N]=n.useState(!1),f=n.useRef(null);n.useEffect(()=>()=>{var t;return(t=f.current)==null?void 0:t.abort()},[]);const L=n.useCallback(()=>{S(t=>{const a=new URLSearchParams(t);return a.delete("order"),a.delete("canceled"),a},{replace:!0})},[S]),b=n.useCallback(async t=>{l("processing");const a=new AbortController;f.current=a;try{const u=await ee(t,{signal:a.signal,address:r==null?void 0:r.address,identity:r==null?void 0:r.identity});if(u.status==="credited"){const _=u.creditsGranted??(c==null?void 0:c.credits)??0;R(_>0?_:null),l("success"),g("Shop Completed Buy Credits",{order_id:t,pack_usd:(c==null?void 0:c.usd)??null,credits:_>0?_:null,provider:C}),i.invalidateQueries({queryKey:["usd-balance"]});try{if(sessionStorage.getItem(J)){const j={resumeCheckout:!0,..._>0?{creditsAdded:_}:{}};o("/cart",{state:j});return}}catch{}try{const j=sessionStorage.getItem(F);if(j){sessionStorage.removeItem(F);const P=JSON.parse(j),B=z(P);if(B){o(B,{state:{item:P,resumeBuy:!0}});return}}}catch{}}else u.status==="pending"?(g("Shop Buy Credits Pending",{step:"grant",pack_usd:(c==null?void 0:c.usd)??null}),i.invalidateQueries({queryKey:["usd-balance"]}),l("pending")):(g("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(c==null?void 0:c.usd)??null}),h(u.error??s("getCredits.errorGrant",{currency:d.name})),l("error"))}catch(u){A(u,{flow:"get_credits",step:"grant",order_id:t}),g("Shop Buy Credits Failed",{step:"grant",error_code:I(u),pack_usd:(c==null?void 0:c.usd)??null}),h(G(u)),l("error")}},[c,r,i,o]),H=n.useCallback(async t=>{if(!r){m();return}h(null),N(!1),w(t),l(C==="mock"?"processing":"redirecting"),g("Shop Started Buy Credits",{pack_usd:t.usd,credits:t.credits,provider:C});try{const a=await se(t.id,{address:r.address,identity:r.identity});if(a.mock)b(a.orderId);else if(a.url)g("Shop Redirected To Stripe",{order_id:a.orderId,pack_usd:t.usd,credits:t.credits}),window.location.href=a.url;else throw new Error("Checkout did not return a redirect url")}catch(a){A(a,{flow:"get_credits",step:"checkout",provider:C}),g("Shop Buy Credits Failed",{step:"checkout",error_code:I(a),pack_usd:t.usd}),h(G(a)),l("error")}},[r,m,b]),y=n.useRef(!1);n.useEffect(()=>{if(y.current)return;const t=k.get("order");if(k.get("canceled")!=null){y.current=!0,g("Shop Buy Credits Cancelled",{order_id:t,provider:C}),L(),N(!0),l("select");return}t&&(l("processing"),r&&(y.current=!0,L(),b(t)))},[k,r]);function v(){var t;(t=f.current)==null||t.abort(),l("select"),w(null),R(null),h(null),N(!1)}const O=p==="select";return e.jsxs("div",{className:"getcredits",children:[O&&e.jsxs("header",{className:"getcredits__head",children:[e.jsx("h1",{className:"getcredits__title",children:s("getCredits.title",{currency:d.name})}),e.jsxs("p",{className:"getcredits__sub",children:[s("getCredits.subtitle",{currency:d.name})," ",e.jsxs("a",{className:"getcredits__learn",href:ne,target:"_blank",rel:"noreferrer",children:[s("getCredits.learnMore"),e.jsxs("svg",{className:"getcredits__learn-ico",viewBox:"0 0 13 13","aria-hidden":!0,fill:"none",children:[e.jsx("path",{d:"M4 2h7v7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M11 2 2 11",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]})]})]})]}),p==="select"&&e.jsxs(e.Fragment,{children:[K&&e.jsx("p",{className:"getcredits__note muted",role:"status",children:s("getCredits.canceledNote")}),e.jsx(de,{packs:M,loading:T,onSelect:t=>void H(t)})]}),p==="redirecting"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(re,{size:32}),e.jsx("p",{className:"muted",children:s("getCredits.redirecting")})]}),p==="processing"&&e.jsxs("div",{className:"gc-processing",role:"status","aria-live":"polite",children:[e.jsx("img",{className:"gc-processing__logo",src:Z,alt:"",width:61,height:61}),e.jsxs("div",{className:"gc-processing__body",children:[e.jsxs("p",{className:"gc-processing__title",children:[e.jsx("strong",{children:s("getCredits.processing")}),"…"]}),e.jsxs("div",{className:"gc-progress","aria-hidden":!0,children:[e.jsx("span",{className:"gc-progress__track",children:e.jsx("span",{className:"gc-progress__fill"})}),e.jsx("span",{className:"gc-progress__count",children:"1/1"})]})]})]}),p==="success"&&e.jsxs("div",{className:"gc-success",role:"status","aria-live":"polite",children:[e.jsxs("div",{className:"gc-banner",children:[e.jsx("img",{className:"gc-banner__icon",src:ce,alt:"",width:60,height:60}),e.jsxs("p",{className:"gc-banner__text",children:[e.jsx("strong",{children:s("getCredits.successTitle")})," ",s("getCredits.successBody",{currency:d.name})]})]}),E!=null&&e.jsx("div",{className:"gc-credits",children:e.jsxs("div",{className:"gc-credits__row",children:[e.jsx("img",{className:"gc-credits__coin",src:ae,alt:"",width:93,height:93}),e.jsxs("p",{className:"gc-credits__text",children:[e.jsx(D,{className:"gc-credits__diamond"}),e.jsxs("span",{children:[e.jsx("strong",{className:"gc-credits__amount",children:s("getCredits.creditsAmount",{credits:E,currency:d.name})})," ",e.jsx("span",{className:"gc-credits__added",children:s("getCredits.creditsAdded")})]})]})]})}),e.jsxs("div",{className:"gc-actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:v,children:s("getCredits.buyMore",{currency:d.name})}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>o("/assets"),children:s("getCredits.startShopping")})]})]}),p==="pending"&&e.jsxs("div",{className:"gc-status",role:"status","aria-live":"polite",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.pendingTitle",{currency:d.name})}),e.jsx("p",{className:"muted",children:s("getCredits.pendingBody")}),e.jsxs("div",{className:"gc-status__actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>o("/assets"),children:s("getCredits.startShopping")}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:v,children:s("getCredits.done")})]})]}),p==="error"&&e.jsxs("div",{className:"gc-status gc-status--err",role:"alert",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.errorTitle")}),e.jsx("p",{className:"error",children:U}),e.jsx("div",{className:"gc-status__actions",children:e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:v,children:s("getCredits.tryAgain")})})]})]})}function de({packs:o,loading:r,onSelect:m}){return r?e.jsx("div",{className:"packs","aria-busy":"true","aria-label":s("getCredits.packsLoading",{currency:d.name}),children:[0,1,2,3].map(i=>e.jsx("div",{className:"pack pack--skeleton","aria-hidden":!0,children:e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"skeleton pack__label-sk"}),e.jsx("span",{className:"skeleton pack__art-sk"}),e.jsx("span",{className:"skeleton pack__cta-sk"})]})},i))}):e.jsx("div",{className:"packs",children:o.map(i=>e.jsxs("button",{type:"button",className:`pack${i.bestValue?" pack--best":""}`,"data-testid":"pack",onClick:()=>m(i),"aria-label":s("getCredits.packAria",{amount:$(i.credits),usd:i.usd}),children:[i.bestValue&&e.jsx("span",{className:"pack__badge",children:s("getCredits.packBadge")}),e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"pack__label",children:s("getCredits.creditsAmount",{credits:i.credits,currency:d.name})}),e.jsx("span",{className:"pack__art",children:e.jsx("img",{src:ie[i.id]??x,alt:"",loading:"lazy"})}),e.jsx("span",{className:"pack__cta-wrap",children:e.jsxs("span",{className:"pack__cta",children:["$",i.usd.toFixed(2)]})})]})]},i.id))})}export{ke as GetCredits,ke as default};
1
+ import{u as Y,b as q,r as n,j as e}from"./react-BW1xvPTF.js";import{m as Q,t as s,u as V,b as W,j as g,ai as z,e as d,H as A,k as I,C as D,f as $}from"./index-CQ7zHnQz.js";import{R as F}from"./resume-buy-Bf0zIH7y.js";import{R as J}from"./cart-checkout-BLQod-hb.js";import{l as Z}from"./loader-logo-BzY9EKdC.js";import{u as X,p as ee,c as se,i as te}from"./useCreditPacks-BYlDej2O.js";import{C as re}from"./CircularProgress-CD6e_OY0.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BcZhdsUx.js";import"./intl-CBcMB1D2.js";const x="https://cdn.decentraland.org/@dcl/shop/0.1.0-30216809991.commit-6a5fe36/assets/pack-chips--HnOpf5U.webp",ae="https://cdn.decentraland.org/@dcl/shop/0.1.0-30216809991.commit-6a5fe36/assets/credit-coin-CmcTCd5i.webp",ce="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",C=te()?"mock":"stripe",ie={pack_5:x,pack_10:x,pack_25:x,pack_50:x},ne="https://docs.decentraland.org";function G(o){const r=o;if((r==null?void 0:r.name)==="AbortError")return s("getCredits.errorCanceled");const m=((r==null?void 0:r.message)??"").toLowerCase();return m.includes("sign in")?s("getCredits.errorSignIn",{currency:d.name}):m.includes("timed out")?s("getCredits.errorTimeout",{currency:d.name}):s("getCredits.errorGeneric")}function ke(){Q({title:s("nav.getCredits",{currency:d.name}),noindex:!0});const o=Y(),{session:r,signIn:m}=V(),i=W(),[k,S]=q(),{packs:M,isLoading:T}=X(),[p,l]=n.useState("select"),[c,w]=n.useState(null),[E,R]=n.useState(null),[U,h]=n.useState(null),[K,N]=n.useState(!1),f=n.useRef(null);n.useEffect(()=>()=>{var t;return(t=f.current)==null?void 0:t.abort()},[]);const L=n.useCallback(()=>{S(t=>{const a=new URLSearchParams(t);return a.delete("order"),a.delete("canceled"),a},{replace:!0})},[S]),b=n.useCallback(async t=>{l("processing");const a=new AbortController;f.current=a;try{const u=await ee(t,{signal:a.signal,address:r==null?void 0:r.address,identity:r==null?void 0:r.identity});if(u.status==="credited"){const _=u.creditsGranted??(c==null?void 0:c.credits)??0;R(_>0?_:null),l("success"),g("Shop Completed Buy Credits",{order_id:t,pack_usd:(c==null?void 0:c.usd)??null,credits:_>0?_:null,provider:C}),i.invalidateQueries({queryKey:["usd-balance"]});try{if(sessionStorage.getItem(J)){const j={resumeCheckout:!0,..._>0?{creditsAdded:_}:{}};o("/cart",{state:j});return}}catch{}try{const j=sessionStorage.getItem(F);if(j){sessionStorage.removeItem(F);const P=JSON.parse(j),B=z(P);if(B){o(B,{state:{item:P,resumeBuy:!0}});return}}}catch{}}else u.status==="pending"?(g("Shop Buy Credits Pending",{step:"grant",pack_usd:(c==null?void 0:c.usd)??null}),i.invalidateQueries({queryKey:["usd-balance"]}),l("pending")):(g("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(c==null?void 0:c.usd)??null}),h(u.error??s("getCredits.errorGrant",{currency:d.name})),l("error"))}catch(u){A(u,{flow:"get_credits",step:"grant",order_id:t}),g("Shop Buy Credits Failed",{step:"grant",error_code:I(u),pack_usd:(c==null?void 0:c.usd)??null}),h(G(u)),l("error")}},[c,r,i,o]),H=n.useCallback(async t=>{if(!r){m();return}h(null),N(!1),w(t),l(C==="mock"?"processing":"redirecting"),g("Shop Started Buy Credits",{pack_usd:t.usd,credits:t.credits,provider:C});try{const a=await se(t.id,{address:r.address,identity:r.identity});if(a.mock)b(a.orderId);else if(a.url)g("Shop Redirected To Stripe",{order_id:a.orderId,pack_usd:t.usd,credits:t.credits}),window.location.href=a.url;else throw new Error("Checkout did not return a redirect url")}catch(a){A(a,{flow:"get_credits",step:"checkout",provider:C}),g("Shop Buy Credits Failed",{step:"checkout",error_code:I(a),pack_usd:t.usd}),h(G(a)),l("error")}},[r,m,b]),y=n.useRef(!1);n.useEffect(()=>{if(y.current)return;const t=k.get("order");if(k.get("canceled")!=null){y.current=!0,g("Shop Buy Credits Cancelled",{order_id:t,provider:C}),L(),N(!0),l("select");return}t&&(l("processing"),r&&(y.current=!0,L(),b(t)))},[k,r]);function v(){var t;(t=f.current)==null||t.abort(),l("select"),w(null),R(null),h(null),N(!1)}const O=p==="select";return e.jsxs("div",{className:"getcredits",children:[O&&e.jsxs("header",{className:"getcredits__head",children:[e.jsx("h1",{className:"getcredits__title",children:s("getCredits.title",{currency:d.name})}),e.jsxs("p",{className:"getcredits__sub",children:[s("getCredits.subtitle",{currency:d.name})," ",e.jsxs("a",{className:"getcredits__learn",href:ne,target:"_blank",rel:"noreferrer",children:[s("getCredits.learnMore"),e.jsxs("svg",{className:"getcredits__learn-ico",viewBox:"0 0 13 13","aria-hidden":!0,fill:"none",children:[e.jsx("path",{d:"M4 2h7v7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M11 2 2 11",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]})]})]})]}),p==="select"&&e.jsxs(e.Fragment,{children:[K&&e.jsx("p",{className:"getcredits__note muted",role:"status",children:s("getCredits.canceledNote")}),e.jsx(de,{packs:M,loading:T,onSelect:t=>void H(t)})]}),p==="redirecting"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(re,{size:32}),e.jsx("p",{className:"muted",children:s("getCredits.redirecting")})]}),p==="processing"&&e.jsxs("div",{className:"gc-processing",role:"status","aria-live":"polite",children:[e.jsx("img",{className:"gc-processing__logo",src:Z,alt:"",width:61,height:61}),e.jsxs("div",{className:"gc-processing__body",children:[e.jsxs("p",{className:"gc-processing__title",children:[e.jsx("strong",{children:s("getCredits.processing")}),"…"]}),e.jsxs("div",{className:"gc-progress","aria-hidden":!0,children:[e.jsx("span",{className:"gc-progress__track",children:e.jsx("span",{className:"gc-progress__fill"})}),e.jsx("span",{className:"gc-progress__count",children:"1/1"})]})]})]}),p==="success"&&e.jsxs("div",{className:"gc-success",role:"status","aria-live":"polite",children:[e.jsxs("div",{className:"gc-banner",children:[e.jsx("img",{className:"gc-banner__icon",src:ce,alt:"",width:60,height:60}),e.jsxs("p",{className:"gc-banner__text",children:[e.jsx("strong",{children:s("getCredits.successTitle")})," ",s("getCredits.successBody",{currency:d.name})]})]}),E!=null&&e.jsx("div",{className:"gc-credits",children:e.jsxs("div",{className:"gc-credits__row",children:[e.jsx("img",{className:"gc-credits__coin",src:ae,alt:"",width:93,height:93}),e.jsxs("p",{className:"gc-credits__text",children:[e.jsx(D,{className:"gc-credits__diamond"}),e.jsxs("span",{children:[e.jsx("strong",{className:"gc-credits__amount",children:s("getCredits.creditsAmount",{credits:E,currency:d.name})})," ",e.jsx("span",{className:"gc-credits__added",children:s("getCredits.creditsAdded")})]})]})]})}),e.jsxs("div",{className:"gc-actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:v,children:s("getCredits.buyMore",{currency:d.name})}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>o("/assets"),children:s("getCredits.startShopping")})]})]}),p==="pending"&&e.jsxs("div",{className:"gc-status",role:"status","aria-live":"polite",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.pendingTitle",{currency:d.name})}),e.jsx("p",{className:"muted",children:s("getCredits.pendingBody")}),e.jsxs("div",{className:"gc-status__actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>o("/assets"),children:s("getCredits.startShopping")}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:v,children:s("getCredits.done")})]})]}),p==="error"&&e.jsxs("div",{className:"gc-status gc-status--err",role:"alert",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.errorTitle")}),e.jsx("p",{className:"error",children:U}),e.jsx("div",{className:"gc-status__actions",children:e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:v,children:s("getCredits.tryAgain")})})]})]})}function de({packs:o,loading:r,onSelect:m}){return r?e.jsx("div",{className:"packs","aria-busy":"true","aria-label":s("getCredits.packsLoading",{currency:d.name}),children:[0,1,2,3].map(i=>e.jsx("div",{className:"pack pack--skeleton","aria-hidden":!0,children:e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"skeleton pack__label-sk"}),e.jsx("span",{className:"skeleton pack__art-sk"}),e.jsx("span",{className:"skeleton pack__cta-sk"})]})},i))}):e.jsx("div",{className:"packs",children:o.map(i=>e.jsxs("button",{type:"button",className:`pack${i.bestValue?" pack--best":""}`,"data-testid":"pack",onClick:()=>m(i),"aria-label":s("getCredits.packAria",{amount:$(i.credits),usd:i.usd}),children:[i.bestValue&&e.jsx("span",{className:"pack__badge",children:s("getCredits.packBadge")}),e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"pack__label",children:s("getCredits.creditsAmount",{credits:i.credits,currency:d.name})}),e.jsx("span",{className:"pack__art",children:e.jsx("img",{src:ie[i.id]??x,alt:"",loading:"lazy"})}),e.jsx("span",{className:"pack__cta-wrap",children:e.jsxs("span",{className:"pack__cta",children:["$",i.usd.toFixed(2)]})})]})]},i.id))})}export{ke as GetCredits,ke as default};
@@ -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-BbpXvktu.js";import{d as g,r as v}from"./index-CFAO03Mm.js";import{C as c}from"./ConstantsUtil-DTrOBzCe.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-CSS0v250.js";import{au as y}from"./NetworkUtil-C1aEwuOK.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-BovcADsh.js";import{d as g,r as v}from"./index-BRp1Hi5c.js";import{C as c}from"./ConstantsUtil-DTrOBzCe.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-8Loh-tcg.js";import{au as y}from"./NetworkUtil-C1aEwuOK.js";const b=g`
2
2
  :host {
3
3
  display: flex;
4
4
  justify-content: center;
@@ -1,4 +1,4 @@
1
- import{u as R,r as h,j as e,L as B}from"./react-BW1xvPTF.js";import{w as P,t as s,e as S,B as k,C as L,j as $,H as Q,m as U,u as W,b as O,o as z,s as F,P as H}from"./index-s056mQ5V.js";import{i as Y,R as D,f as G}from"./import-DCJnhgeF.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BcZhdsUx.js";import"./intl-CBcMB1D2.js";import"./buy-BIt1DjVh.js";import"./authorizations-CfRBicRM.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";import"./trade-encoding-C87iaBkc.js";import"./mana-rate-C7Xb6QOI.js";function J({queue:n,session:w,onClose:j,onDone:o}){const N=R(),d=P(w.providerType),[m,f]=h.useState(()=>n.map(()=>"pending")),[I,M]=h.useState("running"),T=h.useRef(!1);h.useEffect(()=>{if(T.current)return;T.current=!0;let t=!1;return(async()=>{for(let r=0;r<n.length;r++){if(t)return;f(u=>u.map((g,p)=>p===r?"active":g));try{await Y(n[r].item,n[r].priceCredits,w),$("Shop Migrated Listing",{item_id:n[r].item.itemId??n[r].item.oldTradeId??null,contract_address:n[r].item.contractAddress,new_price_credits:n[r].priceCredits,new_price_usd:n[r].priceCredits/10}),t||f(u=>u.map((g,p)=>p===r?"done":g))}catch(u){if(u instanceof D)Q(u,{flow:"import_listing",step:"relist",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(g=>g.map((p,b)=>b===r?"unlisted":p));else{const g=u,p=g.code===4001||/reject|denied|cancel/i.test(g.message??"");p||Q(u,{flow:"import_listing",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(b=>b.map((a,l)=>l===r?p?"skipped":"failed":a))}}}t||M("finished")})(),()=>{t=!0}},[]);const _=m.filter(t=>t==="done").length,v=m.findIndex(t=>t==="active"),x=Math.round(m.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function y(){o(),j()}if(I==="finished"){const t=m.filter(r=>r==="skipped"||r==="failed").length,c=m.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:_>0?s("migrate.successTitle"):s("migrate.nothingTitle")}),e.jsxs("p",{className:"muted",style:{margin:0},children:[_>0?s("migrate.listedSummary",{count:_,currency:S.name}):s("migrate.noneListed"),t>0?" "+s("migrate.skippedSummary",{count:t}):"",c>0?" "+s("migrate.unlistedSummary",{count:c}):""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(k,{variant:"ghost",onClick:y,children:s("getCredits.done")}),c>0?e.jsx(k,{variant:"purple",onClick:()=>{o(),j(),N("/my-assets")},children:s("migrate.goToMyAssets")}):_>0?e.jsx(k,{variant:"purple",onClick:()=>{o(),j(),N("/assets")},children:s("migrate.viewInShop")}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate","data-testid":"modal",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:s("migrate.listingTitle")}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[d?s("migrate.subConfirm"):s("migrate.subManaged")," ",v>=0?s("migrate.progressCount",{current:v+1,total:n.length}):""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${x}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,c)=>e.jsxs("li",{className:`migrate__row migrate__row--${m[c]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||s("migrate.itemFallback")}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(L,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:m[c]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",d?s("migrate.statusConfirm"):s("migrate.statusAdding")]}):m[c]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):m[c]==="skipped"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusSkipped")}):m[c]==="failed"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusFailed")}):m[c]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:s("migrate.unlistedTooltip"),children:s("migrate.statusUnlisted")}):e.jsx("span",{className:"migrate__wait",children:s("migrate.statusWaiting")})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:d?s("migrate.hintConfirm"):s("migrate.hintManaged")})]})})}const A=F(k)`
1
+ import{u as R,r as h,j as e,L as B}from"./react-BW1xvPTF.js";import{w as P,t as s,e as S,B as k,C as L,j as $,H as Q,m as U,u as W,b as O,o as z,s as F,P as H}from"./index-CQ7zHnQz.js";import{i as Y,R as D,f as G}from"./import-CMJHvuBQ.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BcZhdsUx.js";import"./intl-CBcMB1D2.js";import"./buy-CXClikLg.js";import"./authorizations-DRmWTFDz.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";import"./trade-encoding-DB6daWEb.js";import"./mana-rate-HiPPfJwE.js";function J({queue:n,session:w,onClose:j,onDone:o}){const N=R(),d=P(w.providerType),[m,f]=h.useState(()=>n.map(()=>"pending")),[I,M]=h.useState("running"),T=h.useRef(!1);h.useEffect(()=>{if(T.current)return;T.current=!0;let t=!1;return(async()=>{for(let r=0;r<n.length;r++){if(t)return;f(u=>u.map((g,p)=>p===r?"active":g));try{await Y(n[r].item,n[r].priceCredits,w),$("Shop Migrated Listing",{item_id:n[r].item.itemId??n[r].item.oldTradeId??null,contract_address:n[r].item.contractAddress,new_price_credits:n[r].priceCredits,new_price_usd:n[r].priceCredits/10}),t||f(u=>u.map((g,p)=>p===r?"done":g))}catch(u){if(u instanceof D)Q(u,{flow:"import_listing",step:"relist",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(g=>g.map((p,b)=>b===r?"unlisted":p));else{const g=u,p=g.code===4001||/reject|denied|cancel/i.test(g.message??"");p||Q(u,{flow:"import_listing",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(b=>b.map((a,l)=>l===r?p?"skipped":"failed":a))}}}t||M("finished")})(),()=>{t=!0}},[]);const _=m.filter(t=>t==="done").length,v=m.findIndex(t=>t==="active"),x=Math.round(m.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function y(){o(),j()}if(I==="finished"){const t=m.filter(r=>r==="skipped"||r==="failed").length,c=m.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:_>0?s("migrate.successTitle"):s("migrate.nothingTitle")}),e.jsxs("p",{className:"muted",style:{margin:0},children:[_>0?s("migrate.listedSummary",{count:_,currency:S.name}):s("migrate.noneListed"),t>0?" "+s("migrate.skippedSummary",{count:t}):"",c>0?" "+s("migrate.unlistedSummary",{count:c}):""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(k,{variant:"ghost",onClick:y,children:s("getCredits.done")}),c>0?e.jsx(k,{variant:"purple",onClick:()=>{o(),j(),N("/my-assets")},children:s("migrate.goToMyAssets")}):_>0?e.jsx(k,{variant:"purple",onClick:()=>{o(),j(),N("/assets")},children:s("migrate.viewInShop")}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate","data-testid":"modal",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:s("migrate.listingTitle")}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[d?s("migrate.subConfirm"):s("migrate.subManaged")," ",v>=0?s("migrate.progressCount",{current:v+1,total:n.length}):""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${x}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,c)=>e.jsxs("li",{className:`migrate__row migrate__row--${m[c]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||s("migrate.itemFallback")}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(L,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:m[c]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",d?s("migrate.statusConfirm"):s("migrate.statusAdding")]}):m[c]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):m[c]==="skipped"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusSkipped")}):m[c]==="failed"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusFailed")}):m[c]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:s("migrate.unlistedTooltip"),children:s("migrate.statusUnlisted")}):e.jsx("span",{className:"migrate__wait",children:s("migrate.statusWaiting")})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:d?s("migrate.hintConfirm"):s("migrate.hintManaged")})]})})}const A=F(k)`
2
2
  margin-top: 10px;
3
3
  `,V=F(k)`
4
4
  padding: 13px 24px;