@dcl/shop 0.1.0-30043904010.commit-d846220 → 0.1.0-30043934931.commit-86cfb70

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-CfoMiprq.js → Activity-8h0PnDHr.js} +1 -1
  2. package/assets/{AnimatedBackground-CTAvRdMs.js → AnimatedBackground-B2tpt3H8.js} +3 -3
  3. package/assets/{Assets-DKNqWFtf.js → Assets-JAbEbh8R.js} +1 -1
  4. package/assets/{Assets.styles-C6sIyjWO.js → Assets.styles-C4Rs5ygY.js} +1 -1
  5. package/assets/{Authorizations-Cfrn9UvQ.js → Authorizations-D5JQf81y.js} +1 -1
  6. package/assets/{Cart-hpLb5BKF.js → Cart-9olEdU9T.js} +1 -1
  7. package/assets/{CircularProgress-AupKGvsC.js → CircularProgress-BCIDrAUj.js} +1 -1
  8. package/assets/{Collection-_--unMIu.js → Collection-uVY-DBww.js} +1 -1
  9. package/assets/{CollectionCarousel-Cv3IS7v1.js → CollectionCarousel-BLJo34Qz.js} +1 -1
  10. package/assets/{Creator-BLLEhqDI.js → Creator-DezTSvuj.js} +1 -1
  11. package/assets/{CssVarsProvider-C2bobZqX.js → CssVarsProvider-Df7pmJ7_.js} +1 -1
  12. package/assets/{ExchangeController-DvIeDCUh.js → ExchangeController-Ck3jmVFu.js} +1 -1
  13. package/assets/{GetCredits-CrWYBrln.js → GetCredits-CTApCDEg.js} +1 -1
  14. package/assets/{HelpersUtil-bC5DgR2K.js → HelpersUtil-CADgG-tM.js} +1 -1
  15. package/assets/{ImportListings-wr3inb3D.js → ImportListings-CqvvgQ31.js} +1 -1
  16. package/assets/{ItemDetail-BvNr-Bqr.js → ItemDetail-VTK9WwTS.js} +2 -2
  17. package/assets/{LoadMore-DieY8n7S.js → LoadMore-BFcYEWu0.js} +1 -1
  18. package/assets/{MarketCheckout-DtRw4jJL.js → MarketCheckout-uOeOE4-j.js} +1 -1
  19. package/assets/{MyAssets-C6jy4dd6.js → MyAssets-DF2Xczx2.js} +1 -1
  20. package/assets/{MyFavorites-PW6_jnXn.js → MyFavorites-CSGSTVWR.js} +1 -1
  21. package/assets/{NotFound-D9VSYE79.js → NotFound-CILXHuFq.js} +1 -1
  22. package/assets/{PrimaryListModal-C6oCKlmk.js → PrimaryListModal-D_R1yy5e.js} +1 -1
  23. package/assets/{StoreSettings-DVbEeImF.js → StoreSettings-MI6Dg1qk.js} +5 -5
  24. package/assets/{Success-ByU0zgv0.js → Success-BGOEYcYz.js} +1 -1
  25. package/assets/{SwapController-D4uDIpKL.js → SwapController-BMMcVdc7.js} +1 -1
  26. package/assets/{Tooltip-C07IWHCJ.js → Tooltip-Bf7dvs4M.js} +1 -1
  27. package/assets/{TradeService-ZEtpgAIl.js → TradeService-Bv-btvj6.js} +1 -1
  28. package/assets/{W3MFrameProviderSingleton-D1LJTB8Q.js → W3MFrameProviderSingleton-OfY9y0WI.js} +3 -3
  29. package/assets/{WebCryptoP256-cR4KAhPY.js → WebCryptoP256-CKYw7uLn.js} +1 -1
  30. package/assets/{authorizations-BV0VRJbP.js → authorizations-C0u3KwlE.js} +1 -1
  31. package/assets/{basic-BEKOM15_.js → basic-D7c4U-i2.js} +1 -1
  32. package/assets/{biconomy-Hs2VYfbY.js → biconomy-CZ-4ATKL.js} +1 -1
  33. package/assets/{buy-BAwpkHiu.js → buy-CKXN4iAy.js} +1 -1
  34. package/assets/{buy-gasless-CBgDMk_P.js → buy-gasless-Ux4LIj_T.js} +1 -1
  35. package/assets/{cart-checkout-b6rH0J-R.js → cart-checkout-DDMa9Rc9.js} +1 -1
  36. package/assets/{categories-B6F31f63.js → categories-Cj5ch47n.js} +1 -1
  37. package/assets/{ccip-QXtL5Uvm.js → ccip-BcKsymyh.js} +1 -1
  38. package/assets/{ccip-BazdBgUW.js → ccip-eK2cgHgp.js} +1 -1
  39. package/assets/{collection-GFSR-DkZ.js → collection-CL98A06v.js} +1 -1
  40. package/assets/{controller-CV-bZG0x.js → controller-Dq2CKgnH.js} +2 -2
  41. package/assets/{core-DFrvWji_.js → core-jItY3MAn.js} +4 -4
  42. package/assets/{custom-ugD8uQsl.js → custom-DoHksPQg.js} +1 -1
  43. package/assets/{data-capture-0PjpdLt0.js → data-capture-DFmIAcvZ.js} +1 -1
  44. package/assets/{email-BtCYSHvy.js → email-E171Nxv5.js} +1 -1
  45. package/assets/{embedded-wallet-7Uo9CVv4.js → embedded-wallet-DatHO7Va.js} +1 -1
  46. package/assets/{emotion-styled.browser.esm-DTAoSEBg.js → emotion-styled.browser.esm-C1n_nDP1.js} +1 -1
  47. package/assets/{engine-2nF1fHP_.js → engine-IpXAT_EC.js} +1 -1
  48. package/assets/{errors-C3ieTqjz.js → errors-WIWAkE9j.js} +1 -1
  49. package/assets/{estimate-l1-fee-p4EH5xmb.js → estimate-l1-fee-BqnjK5jH.js} +1 -1
  50. package/assets/{execute-BxX9DUWM.js → execute-D1-LQcbh.js} +2 -2
  51. package/assets/{features-DIhQ0-RV.js → features-q_rt190A.js} +1 -1
  52. package/assets/{fetchTokenMetadata-BdBaS0bS.js → fetchTokenMetadata-DFbnz5Zj.js} +2 -2
  53. package/assets/{get-ecosystem-wallet-info-Ixv-HVXj.js → get-ecosystem-wallet-info-BxpvTgAS.js} +1 -1
  54. package/assets/{getBalance-CNSH7nNU.js → getBalance-Df_QqTVi.js} +1 -1
  55. package/assets/{getNFT-Ck9nGmAZ.js → getNFT-9CbRznKk.js} +1 -1
  56. package/assets/{getNFT-C9LYC3Yd.js → getNFT-CJMib_Uu.js} +1 -1
  57. package/assets/{getOverlayAlpha-B3r4B2PY.js → getOverlayAlpha-B2lvaXjs.js} +1 -1
  58. package/assets/{hashTypedData-cHIrBNYx.js → hashTypedData-CeXUf3_L.js} +1 -1
  59. package/assets/{hashTypedData-C6uREFRJ.js → hashTypedData-jk2c_jrw.js} +1 -1
  60. package/assets/{import-CAQj-dM2.js → import-Cw8zAtic.js} +1 -1
  61. package/assets/{in-app-DPM7SMxi.js → in-app-CDKFlfCr.js} +1 -1
  62. package/assets/{in-app-wallet-calls-DZ-hTUOJ.js → in-app-wallet-calls--KSpBomA.js} +1 -1
  63. package/assets/{index-CltlnEYp.js → index-3MKfWXA4.js} +1 -1
  64. package/assets/{index-BVKphh6h.js → index-7Ty_aUtC.js} +1 -1
  65. package/assets/{index-DYRw2UXa.js → index-8BWuHMTg.js} +3 -3
  66. package/assets/{index-vE7g9-sI.js → index-B2scmDy0.js} +1 -1
  67. package/assets/{index-CtDPYY7l.js → index-BCO57bcJ.js} +1 -1
  68. package/assets/{index-BKrZ99aa.js → index-BFXV0piD.js} +1 -1
  69. package/assets/{index-Cqdfn5Z9.js → index-BGF8Bh0a.js} +1 -1
  70. package/assets/{index-Bk2mL-N9.js → index-BH6WYqOl.js} +1 -1
  71. package/assets/{index-BEbNl7Da.js → index-Bb-NCnTE.js} +1 -1
  72. package/assets/{index-BDaUM5PE.js → index-BbhMrOY-.js} +1 -1
  73. package/assets/{index-Dt8YtPvX.js → index-BfRP3f9K.js} +1 -1
  74. package/assets/{index-kWgeWchW.js → index-BhMaUuNP.js} +1 -1
  75. package/assets/{index-ChcRkFvT.js → index-Bv2i0yRB.js} +1 -1
  76. package/assets/{index-C6iFJkiu.js → index-C08l-0a6.js} +1 -1
  77. package/assets/{index-CkKBRMeq.js → index-CMr_6Nyd.js} +1 -1
  78. package/assets/{index-CcTJSQPG.js → index-CPraHggI.js} +1 -1
  79. package/assets/{index-DQKyfE1B.js → index-CRYF3QQX.js} +1 -1
  80. package/assets/{index-Dwid47sK.js → index-CWD-MMEQ.js} +1 -1
  81. package/assets/{index-CzYTv_op.js → index-CpG2nfOs.js} +1 -1
  82. package/assets/{index-DwvpNwX5.js → index-CpHpi1So.js} +1 -1
  83. package/assets/{index-XI6S8l3U.js → index-Cqv6DSq6.js} +1 -1
  84. package/assets/{index-CqYj0Wnc.js → index-CvQyW_QP.js} +9 -9
  85. package/assets/{index-BDGft3Ii.js → index-CxrMEUzn.js} +1 -1
  86. package/assets/{index-BO2IQVQf.js → index-CyGNYmLd.js} +1 -1
  87. package/assets/{index-BSsBrgCk.js → index-D00yAFhE.js} +1 -1
  88. package/assets/{index-BkyeX6HG.js → index-D0_rZ4O9.js} +2 -2
  89. package/assets/{index-_FP-gMqk.js → index-D4_Ayopn.js} +1 -1
  90. package/assets/{index-CC_Y385a.js → index-D82OkBHq.js} +1 -1
  91. package/assets/{index-oIexitis.js → index-DF8IABwY.js} +1 -1
  92. package/assets/{index-BmocOmw9.js → index-DGLFZxHq.js} +1 -1
  93. package/assets/{index-CUSJUiTt.js → index-DSR0BqSl.js} +2 -2
  94. package/assets/{index-CBAMh7K3.js → index-DWSkJR1L.js} +1 -1
  95. package/assets/{index-DQJvIYh3.js → index-DeXcJaEk.js} +1 -1
  96. package/assets/{index-CDv8dIJ0.js → index-DjkMN-SJ.js} +1 -1
  97. package/assets/{index-BEu2er-j.js → index-DjnMmAy_.js} +1 -1
  98. package/assets/{index-BRehhwYQ.js → index-DpTkJP3T.js} +1 -1
  99. package/assets/{index-BF6btLnK.js → index-DskugOVc.js} +1 -1
  100. package/assets/{index-Bxv9Qsyr.js → index-Dy3C3Hqg.js} +1 -1
  101. package/assets/{index-Drnt_mRw.js → index-IOMW6fbv.js} +1 -1
  102. package/assets/{index-Bi2gh-XF.js → index-Iw4-LBlt.js} +1 -1
  103. package/assets/{index-D59_J0ta.js → index-Lgbp47OP.js} +1 -1
  104. package/assets/{index-B293q--y.js → index-Lm4pQ1Y-.js} +2 -2
  105. package/assets/{index-IFOSUl9_.js → index-N00j--sP.js} +1 -1
  106. package/assets/{index-DBzJaULm.js → index-_SJmzAuP.js} +1 -1
  107. package/assets/{index-DfssMaoW.js → index-aj7WBBGO.js} +3 -3
  108. package/assets/{index-CuiEOKUP.js → index-eV9t7_lJ.js} +1 -1
  109. package/assets/{index-B_L_h5GX.js → index-mOzi9u6O.js} +1 -1
  110. package/assets/{index-B2UfRPZr.js → index-mZyQ1Ibu.js} +1 -1
  111. package/assets/{index-BKRJ1I2O.js → index-r0SLNwm4.js} +1 -1
  112. package/assets/{index-D7VAdjct.js → index-riId7y3P.js} +3 -3
  113. package/assets/{index-BOlb7l4z.js → index-vfROHbQr.js} +1 -1
  114. package/assets/{index-q_nf0XWN.js → index-w9yCBfLX.js} +1 -1
  115. package/assets/{index.es-BBXLQWFt.js → index.es-CJnXZzFR.js} +1 -1
  116. package/assets/{index.es-jHzdsCzB.js → index.es-CoB86LUr.js} +1 -1
  117. package/assets/{index.es-B5VA0C1k.js → index.es-D1A-0MBl.js} +4 -4
  118. package/assets/{localBatchGatewayRequest-C-l-nAWK.js → localBatchGatewayRequest-CYH1f-CL.js} +1 -1
  119. package/assets/{mana-rate-DO_0nFzU.js → mana-rate-XqhyW2JQ.js} +1 -1
  120. package/assets/{networks-yLF4BK8_.js → networks-C9xY-gDt.js} +1 -1
  121. package/assets/{onramp-CK5JUJHL.js → onramp-BtfXJa9X.js} +1 -1
  122. package/assets/{openzeppelin-DVJ_Rucz.js → openzeppelin-rmKdIApS.js} +1 -1
  123. package/assets/{parseNft-DocYLo3p.js → parseNft-bEshnWi6.js} +2 -2
  124. package/assets/{parseSignature-60gWPJK1.js → parseSignature-CO0Rh_IN.js} +1 -1
  125. package/assets/{parseSignature-Clt_jMmJ.js → parseSignature-HmetL7KF.js} +3 -3
  126. package/assets/{passkeys-C7NdQhxe.js → passkeys-Bpgjlfr5.js} +1 -1
  127. package/assets/{pay-with-exchange-DAYzEJE4.js → pay-with-exchange-coJuNx_q.js} +1 -1
  128. package/assets/{qr-overlay-DRbms5lD.js → qr-overlay-CRVWKdeg.js} +1 -1
  129. package/assets/{receive-BlKHI8-v.js → receive-ClnNFphm.js} +1 -1
  130. package/assets/{resolveImplementation-BTdoox5Q.js → resolveImplementation-BoOmEk4a.js} +1 -1
  131. package/assets/{rpc-BNYWG8Xk.js → rpc-B4t01nOT.js} +1 -1
  132. package/assets/{secp256k1-BbSYUPGQ.js → secp256k1-B1L-Gp0w.js} +1 -1
  133. package/assets/{secp256k1-DLj5ZhK-.js → secp256k1-BZHuAd-j.js} +1 -1
  134. package/assets/{secp256k1-4Hen77iV.js → secp256k1-CKrHJHcc.js} +1 -1
  135. package/assets/{send-BLdu8d9Q.js → send-Dw2J5eX6.js} +1 -1
  136. package/assets/{send-batch-transaction-BYU5WtyT.js → send-batch-transaction-CE4rirZB.js} +1 -1
  137. package/assets/{send-eip712-transaction-DYQtgtg3.js → send-eip712-transaction-D7kP9m4n.js} +2 -2
  138. package/assets/{send-gasless-transaction-TCFEHRAI.js → send-gasless-transaction-DR86eoPq.js} +2 -2
  139. package/assets/{send-transaction-B3lNpkEI.js → send-transaction-DtOjXGpa.js} +2 -2
  140. package/assets/{sendRawTransaction-CoPr2Xby.js → sendRawTransaction-DQ57y2Qs.js} +3 -3
  141. package/assets/{serializeTransaction-CqUdvLxB.js → serializeTransaction-DHLthhC9.js} +1 -1
  142. package/assets/{session-proposal-Bvv_Koql.js → session-proposal-B4-Rqoqa.js} +1 -1
  143. package/assets/{session-request-BXyQ3aSm.js → session-request-Cb2nHjaq.js} +2 -2
  144. package/assets/{signing-Chd49nry.js → signing-ZU0i6MG2.js} +3 -3
  145. package/assets/{socials-BHcznQJ2.js → socials-Bjnbaevg.js} +1 -1
  146. package/assets/{swaps-CfF1uSNv.js → swaps-CI0PpthY.js} +1 -1
  147. package/assets/{thirdweb-SfIwpr7e.js → thirdweb-CD218UTj.js} +3 -3
  148. package/assets/{to-serializable-transaction-D-H70tOQ.js → to-serializable-transaction-CvsHgrd4.js} +2 -2
  149. package/assets/{trade-encoding-DML-9EOG.js → trade-encoding-pUwpxnzm.js} +1 -1
  150. package/assets/{transactionReceipt-UO6w58Y3.js → transactionReceipt-ivXhUvmo.js} +1 -1
  151. package/assets/{transactions-_ffVpirS.js → transactions-D00QGIHl.js} +1 -1
  152. package/assets/{useCreditPacks-B_ZTg1et.js → useCreditPacks-B55O8DxS.js} +1 -1
  153. package/assets/{useInfiniteGrid-C_eF7Ybb.js → useInfiniteGrid-DsLCnUAK.js} +1 -1
  154. package/assets/useManaRate-CGxQhdI6.js +1 -0
  155. package/assets/{useStore-CGylzs4i.js → useStore-BgAQDAFj.js} +1 -1
  156. package/assets/useTheme-DKKjQNt6.js +1 -0
  157. package/assets/{useTheme-DIH_4JLE.js → useTheme-Du2ZuXGU.js} +1 -1
  158. package/assets/{verifyHash-Ce0mhn6s.js → verifyHash-C9-mzm0O.js} +1 -1
  159. package/assets/{w3m-modal-D-KLVmSF.js → w3m-modal-CZpfx3jO.js} +1 -1
  160. package/assets/{w3m-modal-D7EYp_-6.js → w3m-modal-GiVu2mpt.js} +1 -1
  161. package/assets/{wait-for-tx-receipt-CcL7boc8.js → wait-for-tx-receipt-w1jC1DY2.js} +1 -1
  162. package/assets/{wallets-RlYlNkFo.js → wallets-Ca_Ji5pU.js} +5 -5
  163. package/assets/{web-connector-Clsvv5p6.js → web-connector-Bhwjnfun.js} +3 -3
  164. package/assets/{writeContract-BCrjhXeZ.js → writeContract-B8rFGFzt.js} +1 -1
  165. package/assets/{zoraTestnet-DSU_Xfmx.js → zoraTestnet-DlGzU3rH.js} +1 -1
  166. package/index.html +11 -11
  167. package/package.json +2 -2
  168. package/assets/useManaRate-BgOOo-HT.js +0 -1
  169. package/assets/useTheme-OORw6PVg.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as Q,j as e,L as $}from"./react-C51i12iP.js";import{s as o,F as a,N as V,B as X,m as Z,t as c,u as J,I as h,af as Y,ag as tt,C as m,o as w,ah as et,ai as it}from"./index-CqYj0Wnc.js";import{a as st}from"./mana-rate-DO_0nFzU.js";import{u as nt}from"./useManaRate-BgOOo-HT.js";import{L as at}from"./LoadMore-DieY8n7S.js";import{u as b}from"./useInfiniteGrid-C_eF7Ybb.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";const rt=15e3;function ot(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)<=rt}function ct(t){const i=[...t].sort((s,n)=>n.createdAt-s.createdAt),d=[];for(const s of i){const n=d[d.length-1];n&&ot(n[n.length-1],s)?n.push(s):d.push([s])}return d.map(s=>{var n;return{id:((n=s.find(r=>r.txHash))==null?void 0:n.txHash)??s[s.length-1].id,createdAt:Math.max(...s.map(r=>r.createdAt)),status:s.some(r=>r.status==="PENDING")?"PENDING":"SETTLED",totalCredits:s.reduce((r,u)=>r+u.credits,0),lines:s}})}function dt(t){const i=[],d=new Map;for(const s of t)if(s.tradeId){const n=d.get(s.tradeId);if(n){n.quantity+=1,n.credits+=s.credits;continue}const r={key:s.tradeId,tradeId:s.tradeId,quantity:1,credits:s.credits};d.set(s.tradeId,r),i.push(r)}else i.push({key:s.id,tradeId:null,quantity:1,credits:s.credits});return i}function lt(t,i){return{id:t.id,contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId,counterparty:t.buyer,credits:i?st(t.manaWei,i):null,createdAt:t.createdAt}}function ut(t){const d=ct(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 r=lt(n,t.rate);return{kind:"sale",id:`sale:${r.id}`,createdAt:r.createdAt,sale:r}});return[...d,...s].sort((n,r)=>r.createdAt-n.createdAt||(n.id<r.id?-1:1))}function pt(t,i){if(i==="all")return t;const d=i==="purchases"?"purchase":"sale";return t.filter(s=>s.kind===d)}const g=V`
1
+ import{r as Q,j as e,L as $}from"./react-C51i12iP.js";import{s as o,F as a,N as V,B as X,m as Z,t as c,u as J,I as h,af as Y,ag as tt,C as m,o as w,ah as et,ai as it}from"./index-CvQyW_QP.js";import{a as st}from"./mana-rate-XqhyW2JQ.js";import{u as nt}from"./useManaRate-CGxQhdI6.js";import{L as at}from"./LoadMore-BFcYEWu0.js";import{u as b}from"./useInfiniteGrid-DsLCnUAK.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";const rt=15e3;function ot(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)<=rt}function ct(t){const i=[...t].sort((s,n)=>n.createdAt-s.createdAt),d=[];for(const s of i){const n=d[d.length-1];n&&ot(n[n.length-1],s)?n.push(s):d.push([s])}return d.map(s=>{var n;return{id:((n=s.find(r=>r.txHash))==null?void 0:n.txHash)??s[s.length-1].id,createdAt:Math.max(...s.map(r=>r.createdAt)),status:s.some(r=>r.status==="PENDING")?"PENDING":"SETTLED",totalCredits:s.reduce((r,u)=>r+u.credits,0),lines:s}})}function dt(t){const i=[],d=new Map;for(const s of t)if(s.tradeId){const n=d.get(s.tradeId);if(n){n.quantity+=1,n.credits+=s.credits;continue}const r={key:s.tradeId,tradeId:s.tradeId,quantity:1,credits:s.credits};d.set(s.tradeId,r),i.push(r)}else i.push({key:s.id,tradeId:null,quantity:1,credits:s.credits});return i}function lt(t,i){return{id:t.id,contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId,counterparty:t.buyer,credits:i?st(t.manaWei,i):null,createdAt:t.createdAt}}function ut(t){const d=ct(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 r=lt(n,t.rate);return{kind:"sale",id:`sale:${r.id}`,createdAt:r.createdAt,sale:r}});return[...d,...s].sort((n,r)=>r.createdAt-n.createdAt||(n.id<r.id?-1:1))}function pt(t,i){if(i==="all")return t;const d=i==="purchases"?"purchase":"sale";return t.filter(s=>s.kind===d)}const g=V`
2
2
  0% { background-position: 200% 0; }
3
3
  100% { background-position: -200% 0; }
4
4
  `,xt=o.section`
@@ -1,11 +1,11 @@
1
- import{r as l,j as v}from"./react-C51i12iP.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-30043904010.commit-d846220/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-30043904010.commit-d846220/assets/DCL_LogoPattern-BryBPc3d.png",U=`
1
+ import{r as l,j as v}from"./react-C51i12iP.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-30043934931.commit-86cfb70/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-30043934931.commit-86cfb70/assets/DCL_LogoPattern-BryBPc3d.png",b=`
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
- `,b=`
8
+ `,U=`
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,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};
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};
@@ -1,4 +1,4 @@
1
- import{u as Ze,r as p,j as e,b as Je}from"./react-C51i12iP.js";import{p as W,h as Xe,c as Ye,M as et,s,F as t,u as oe,a as tt,b as Ne,x as _e,v 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,G as rt,A as Q,ax as it,ay as at}from"./index-CqYj0Wnc.js";import{r as lt,m as ct,a as Pe}from"./mana-rate-DO_0nFzU.js";import{u as Me}from"./useManaRate-BgOOo-HT.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-C6sIyjWO.js";import{d as me,R as vt,F as jt,S as ge,b as $t}from"./categories-B6F31f63.js";import{L as Ct}from"./LoadMore-DieY8n7S.js";import{M as kt}from"./MarketCheckout-DtRw4jJL.js";import{u as St}from"./useInfiniteGrid-C_eF7Ybb.js";import{E as Rt}from"./ErrorNotice-C7soUjRV.js";import{d as It}from"./dcl-schemas-BICTSpB5.js";import{u as Et,G as Tt,w as zt,S as Nt}from"./buy-gasless-CBgDMk_P.js";import{s as _t}from"./buy-BAwpkHiu.js";import{h as At}from"./trade-encoding-DML-9EOG.js";import{f as Pt}from"./errors-C3ieTqjz.js";import{J as Mt,C as Lt,B as se}from"./ethers-w5dOkonM.js";import{l as Bt}from"./loader-logo-BzY9EKdC.js";import{n as Ft}from"./emotion-CSxEP8yM.js";import"./sentry-DKBoGDXH.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./Tooltip-C07IWHCJ.js";import"./authorizations-BV0VRJbP.js";import"./sendMetaTransaction-CiO3jI6F.js";function Z(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===It.ChainId.MATIC_MAINNET?ye.mainnet:ye.sepolia}async function Gt(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 qt="https://app.across.to/api";class Be extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function 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=qt,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 Zt(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 Et({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 Jt=s.div`
1
+ import{u as Ze,r as p,j as e,b as Je}from"./react-C51i12iP.js";import{p as W,h as Xe,c as Ye,M as et,s,F as t,u as oe,a as tt,b as Ne,x as _e,v 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,G as rt,A as Q,ax as it,ay as at}from"./index-CvQyW_QP.js";import{r as lt,m as ct,a as Pe}from"./mana-rate-XqhyW2JQ.js";import{u as Me}from"./useManaRate-CGxQhdI6.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-C4Rs5ygY.js";import{d as me,R as vt,F as jt,S as ge,b as $t}from"./categories-Cj5ch47n.js";import{L as Ct}from"./LoadMore-BFcYEWu0.js";import{M as kt}from"./MarketCheckout-uOeOE4-j.js";import{u as St}from"./useInfiniteGrid-DsLCnUAK.js";import{E as Rt}from"./ErrorNotice-C7soUjRV.js";import{d as It}from"./dcl-schemas-BICTSpB5.js";import{u as Et,G as Tt,w as zt,S as Nt}from"./buy-gasless-Ux4LIj_T.js";import{s as _t}from"./buy-CKXN4iAy.js";import{h as At}from"./trade-encoding-pUwpxnzm.js";import{f as Pt}from"./errors-WIWAkE9j.js";import{J as Mt,C as Lt,B as se}from"./ethers-w5dOkonM.js";import{l as Bt}from"./loader-logo-BzY9EKdC.js";import{n as Ft}from"./emotion-CSxEP8yM.js";import"./sentry-DKBoGDXH.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./Tooltip-Bf7dvs4M.js";import"./authorizations-C0u3KwlE.js";import"./sendMetaTransaction-CiO3jI6F.js";function Z(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===It.ChainId.MATIC_MAINNET?ye.mainnet:ye.sepolia}async function Gt(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 qt="https://app.across.to/api";class Be extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function 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=qt,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 Zt(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 Et({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 Jt=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-C51i12iP.js";import{R as z,a as oe,C as ie,c as ne}from"./categories-B6F31f63.js";import{T as se}from"./Tooltip-C07IWHCJ.js";import{F as e,s as o,I as m,t as s,G as re,e as v}from"./index-CqYj0Wnc.js";import{n as c}from"./emotion-CSxEP8yM.js";const ae=o.div`
1
+ import{r as y,j as t}from"./react-C51i12iP.js";import{R as z,a as oe,C as ie,c as ne}from"./categories-Cj5ch47n.js";import{T as se}from"./Tooltip-Bf7dvs4M.js";import{F as e,s as o,I as m,t as s,G as re,e as v}from"./index-CvQyW_QP.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,r as N}from"./react-C51i12iP.js";import{s,B as q,F as e,N as B,m as D,t as i,u as F,v as G,I as m,C as H,o as I,b as Q,p as K,J as z,E as M,H as j}from"./index-CqYj0Wnc.js";import{b as W,c as J,s as O,d as P}from"./authorizations-BV0VRJbP.js";import{f as X}from"./errors-C3ieTqjz.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";const U=B`
1
+ import{j as t,L,r as N}from"./react-C51i12iP.js";import{s,B as q,F as e,N as B,m as D,t as i,u as F,v as G,I as m,C as H,o as I,b as Q,p as K,J as z,E as M,H as j}from"./index-CvQyW_QP.js";import{b as W,c as J,s as O,d as P}from"./authorizations-C0u3KwlE.js";import{f as X}from"./errors-WIWAkE9j.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";const U=B`
2
2
  to { transform: rotate(360deg); }
3
3
  `,V=s.section`
4
4
  width: 100%;
@@ -1,3 +1,3 @@
1
- import{j as e,r as h,u as Te,a as Fe,L as te}from"./react-C51i12iP.js";import{t,C as F,x as V,m as Ae,ad as N,n as me,u as Be,o as Le,a as Ke,b as Qe,I as T,w as Ue,v as We,j as D,aj as _e,ak as $e,E as U,s as ze,B as Oe,e as Ge,h as He,c as ye,al as De,l as pe,k as Je,am as Ve}from"./index-CqYj0Wnc.js";import{W as Ye,C as Xe,t as Ze,a as es,s as be}from"./CollectionCarousel-Cv3IS7v1.js";import{a as ge}from"./buy-BAwpkHiu.js";import{a as ss,w as ts,S as as,G as rs}from"./buy-gasless-CBgDMk_P.js";import{R as J,r as cs}from"./cart-checkout-b6rH0J-R.js";import{g as ns}from"./authorizations-BV0VRJbP.js";import{u as is,M as os,c as ls}from"./useCreditPacks-B_ZTg1et.js";import{l as ds}from"./loader-logo-BzY9EKdC.js";import{i as us,a as hs}from"./errors-C3ieTqjz.js";import{E as ms}from"./ErrorNotice-C7soUjRV.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./address-DrURAr9O.js";import"./trade-encoding-DML-9EOG.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";const _s="https://cdn.decentraland.org/@dcl/shop/0.1.0-30043904010.commit-d846220/assets/buy-error-22UunaPC.png";function ys(r){const{phase:n,balanceCredits:u,onClose:_}=r,C=n==="processing",S=n==="error"?t("cartCheckout.errorTitle"):n==="nofunds"?t("cartCheckout.titleNoFunds"):t("cartCheckout.titleBuy"),M=n==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":t("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:C?void 0:_,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${M?" 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:_,"aria-label":t("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"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(F,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:V(u)})]})]}),n==="processing"&&e.jsx(ps,{stage:r.stage??"reserving",step:r.step??1,total:r.total??1,isSelfCustody:!!r.isSelfCustody}),n==="nofunds"&&e.jsx(bs,{lines:r.lines??[],shortfallCredits:r.shortfallCredits??0,packs:r.packs??[],selectedPack:r.selectedPack??"",onSelectPack:r.onSelectPack??(()=>{}),onBuyPacks:r.onBuyPacks??(()=>{}),onCancel:_}),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:_s,alt:"",width:64,height:80}),e.jsxs("p",{className:"buy-error__text",children:[e.jsx("b",{children:t("cartCheckout.errorHeadline")})," ",t("cartCheckout.errorBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:_,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:r.onRetry??_,children:t("cartCheckout.tryAgain")})]})]})]})]})}function ps({stage:r,step:n,total:u,isSelfCustody:_}){const C=r==="reserving",S=u>0?Math.min(100,Math.round(n/u*100)):0,M=r==="awaiting-signature"?_?t("buyModal.confirmToContinue"):t("buyModal.completingTransaction"):r==="settling"?t("buyModal.completingTransaction"):t("cartCheckout.preparing");return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:ds,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:M}),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}%`}})}),u>1?e.jsxs("span",{className:"cart-checkout__step",children:[n,"/",u]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function bs({lines:r,shortfallCredits:n,packs:u,selectedPack:_,onSelectPack:C,onBuyPacks:S,onCancel:M}){const w=u.find(a=>a.id===_),Y=r.reduce((a,f)=>a+(f.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(Ye,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:t("buyModal.insufficientFunds")})," ",t("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:t("buyModal.warningCreditsAmount",{count:Math.max(0,n)})})," ",t("buyModal.warningToPurchase",{count:Y})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:r.map(a=>{const f=a.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:a.item.thumbnail?e.jsx("img",{src:a.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:a.item.name,children:[a.item.name||t("buyModal.itemFallback"),f>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:t("cartCheckout.qty",{count:f})}):null]}),a.item.creator?e.jsx(Xe,{address:a.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:V(a.priceCredits*f)})]})]})]},a.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:u.map(a=>{const f=a.id===_;return e.jsxs("button",{className:`buy-modal__pack${f?" buy-modal__pack--on":""}`,onClick:()=>C(a.id),children:[e.jsx(F,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:V(a.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",a.usd.toFixed(2),")"]})]},a.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:V((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:M,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:S,children:t("buyModal.buy")})]})]})}const gs=ze(Oe)`
1
+ import{j as e,r as h,u as Te,a as Fe,L as te}from"./react-C51i12iP.js";import{t,C as F,x as V,m as Ae,ad as N,n as me,u as Be,o as Le,a as Ke,b as Qe,I as T,w as Ue,v as We,j as D,aj as _e,ak as $e,E as U,s as ze,B as Oe,e as Ge,h as He,c as ye,al as De,l as pe,k as Je,am as Ve}from"./index-CvQyW_QP.js";import{W as Ye,C as Xe,t as Ze,a as es,s as be}from"./CollectionCarousel-BLJo34Qz.js";import{a as ge}from"./buy-CKXN4iAy.js";import{a as ss,w as ts,S as as,G as rs}from"./buy-gasless-Ux4LIj_T.js";import{R as J,r as cs}from"./cart-checkout-DDMa9Rc9.js";import{g as ns}from"./authorizations-C0u3KwlE.js";import{u as is,M as os,c as ls}from"./useCreditPacks-B55O8DxS.js";import{l as ds}from"./loader-logo-BzY9EKdC.js";import{i as us,a as hs}from"./errors-WIWAkE9j.js";import{E as ms}from"./ErrorNotice-C7soUjRV.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./address-DrURAr9O.js";import"./trade-encoding-pUwpxnzm.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";const _s="https://cdn.decentraland.org/@dcl/shop/0.1.0-30043934931.commit-86cfb70/assets/buy-error-22UunaPC.png";function ys(r){const{phase:n,balanceCredits:u,onClose:_}=r,C=n==="processing",S=n==="error"?t("cartCheckout.errorTitle"):n==="nofunds"?t("cartCheckout.titleNoFunds"):t("cartCheckout.titleBuy"),M=n==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":t("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:C?void 0:_,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${M?" 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:_,"aria-label":t("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"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(F,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:V(u)})]})]}),n==="processing"&&e.jsx(ps,{stage:r.stage??"reserving",step:r.step??1,total:r.total??1,isSelfCustody:!!r.isSelfCustody}),n==="nofunds"&&e.jsx(bs,{lines:r.lines??[],shortfallCredits:r.shortfallCredits??0,packs:r.packs??[],selectedPack:r.selectedPack??"",onSelectPack:r.onSelectPack??(()=>{}),onBuyPacks:r.onBuyPacks??(()=>{}),onCancel:_}),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:_s,alt:"",width:64,height:80}),e.jsxs("p",{className:"buy-error__text",children:[e.jsx("b",{children:t("cartCheckout.errorHeadline")})," ",t("cartCheckout.errorBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:_,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:r.onRetry??_,children:t("cartCheckout.tryAgain")})]})]})]})]})}function ps({stage:r,step:n,total:u,isSelfCustody:_}){const C=r==="reserving",S=u>0?Math.min(100,Math.round(n/u*100)):0,M=r==="awaiting-signature"?_?t("buyModal.confirmToContinue"):t("buyModal.completingTransaction"):r==="settling"?t("buyModal.completingTransaction"):t("cartCheckout.preparing");return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:ds,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:M}),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}%`}})}),u>1?e.jsxs("span",{className:"cart-checkout__step",children:[n,"/",u]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function bs({lines:r,shortfallCredits:n,packs:u,selectedPack:_,onSelectPack:C,onBuyPacks:S,onCancel:M}){const w=u.find(a=>a.id===_),Y=r.reduce((a,f)=>a+(f.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(Ye,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:t("buyModal.insufficientFunds")})," ",t("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:t("buyModal.warningCreditsAmount",{count:Math.max(0,n)})})," ",t("buyModal.warningToPurchase",{count:Y})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:r.map(a=>{const f=a.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:a.item.thumbnail?e.jsx("img",{src:a.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:a.item.name,children:[a.item.name||t("buyModal.itemFallback"),f>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:t("cartCheckout.qty",{count:f})}):null]}),a.item.creator?e.jsx(Xe,{address:a.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:V(a.priceCredits*f)})]})]})]},a.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:u.map(a=>{const f=a.id===_;return e.jsxs("button",{className:`buy-modal__pack${f?" buy-modal__pack--on":""}`,onClick:()=>C(a.id),children:[e.jsx(F,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:V(a.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",a.usd.toFixed(2),")"]})]},a.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:V((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:M,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:S,children:t("buyModal.buy")})]})]})}const gs=ze(Oe)`
2
2
  margin-top: 12px;
3
3
  `;function fe(r){if(us(r))return t("errors.rejected");const n=(r.message??"").toLowerCase();return n.includes("insufficient")?t("cart.error.insufficient",{currency:Ge.name}):n.includes("no active listing")||n.includes("your own listing")?t("cart.error.listingChanged"):t("marketCheckout.error.generic")}const fs=12e4;function vs(r){const n=[];return r.unavailable.length&&n.push(t("cart.drop.unavailable",{count:r.unavailable.length})),r.own.length&&n.push(t("cart.drop.own",{count:r.own.length})),t("cart.drop.removed",{items:n.join(` ${t("cart.drop.and")} `)})}const ve=r=>r.reduce((n,u)=>n+u.priceCredits*u.quantity,0),xs=r=>r.flatMap(n=>Array.from({length:n.quantity},()=>({...n,quantity:1})));function Us(){Ae({title:t("nav.cart"),noindex:!0});const r=N(s=>s.items),n=N(s=>s.remove),u=N(s=>s.increment),_=N(s=>s.decrement),C=N(s=>s.clear),S=N(s=>s.restore),M=N(s=>s.setFittingOpen),w=me(s=>s.items),Y=me(s=>s.toggle),{session:a,signIn:f}=Be(),W=is().packs.slice(0,os);h.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const xe=r.some(s=>s.category!=="emote"),{data:X}=Le({queryKey:["upsell-listings"],queryFn:()=>Ve({first:40}),staleTime:6e4}),{data:A}=Ke(a),m=Qe(),$=Te(),{state:q}=Fe(),[ae,B]=h.useState(null),[ke,L]=h.useState(null),[re,z]=h.useState(null),[je,E]=h.useState(!1),[v,K]=h.useState(null),ce=h.useRef(0),[l,k]=h.useState(null),[Z,ne]=h.useState(""),ee=h.useRef(null),Ne=r.reduce((s,c)=>s+c.priceCredits*c.quantity,0),ie=r.reduce((s,c)=>s+c.quantity,0),Ce=v?v.liveTotalCredits:Ne,we=new Set(r.map(s=>s.id)),oe=((X==null?void 0:X.items)??[]).filter(s=>!we.has(s.id)).slice(0,12),Se=new Map(v==null?void 0:v.buyable.map(s=>[s.item.id,s])),O=(A==null?void 0:A.credits)??0,Me=$e;function G(s){s(),K(null),z(null),L(null)}function qe(){k(null),E(!1)}function le(s){const c=ve(s),i=Math.max(0,c-O),p=W.find(d=>d.credits>=i)??W[W.length-1];ne(p.id),D("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:c,credits_balance:O,shortfall:i}),k({phase:"nofunds",lines:s.map(d=>({item:d.item,priceCredits:d.priceCredits,quantity:d.quantity})),shortfall:i}),E(!1)}async function Ee(s){if(!a||s.length===0)return;const c=xs(s),i=c.map(o=>({...o.item,priceCredits:o.priceCredits})),p=s.map(o=>({...o.item,priceCredits:o.priceCredits,quantity:o.quantity})),d=[];let j="authorize",H=!1;k({phase:"processing",stage:"reserving",step:1,total:c.length});try{const o=[];for(let x=0;x<c.length;x++){const R=c[x];k({phase:"processing",stage:"reserving",step:x+1,total:c.length});try{const{credit:y,maxCreditedValue:se}=await He(a.identity,R.usdCents,R.trade.id);d.push(y.id),o.push({trade:R.trade,credits:[y],maxCreditedValue:se})}catch(y){if(hs(y)){if(d.length){try{await ye(a.identity,d)}catch(se){U(se,{flow:"cart_checkout",step:"release"})}m.invalidateQueries({queryKey:["usd-balance"]})}le(s);return}throw y}}j="submit";const b=()=>k({phase:"processing",stage:"settling",step:c.length,total:c.length});k({phase:"processing",stage:"awaiting-signature",step:c.length,total:c.length});let g=[];if(ns())try{g=await ss({purchases:o,buyer:a.address,signer:a.signer,onSigned:b});const R=(await Promise.allSettled(g.map(y=>ts(y)))).flatMap(y=>y.status==="rejected"?[y.reason]:[]);if(R.length&&!R.some(y=>y instanceof as))throw R[0];H=!0}catch(x){if(!(x instanceof rs))throw x;g=await ge({purchases:o,buyer:a.address,signer:a.signer,onSigned:b})}else g=await ge({purchases:o,buyer:a.address,signer:a.signer});s.forEach(x=>n(x.item.id)),K(null),D("Shop Completed Purchase",{...De(i),payment_type:"credits",no_crypto_step:H,transaction_hash:g[0]??null}),m.invalidateQueries({queryKey:["usd-balance"]}),m.invalidateQueries({queryKey:["detail-trade"]}),m.invalidateQueries({queryKey:["shop-item"]}),m.invalidateQueries({queryKey:["owned-token"]}),m.invalidateQueries({queryKey:["public-token"]}),m.invalidateQueries({queryKey:["item-resales"]}),m.invalidateQueries({queryKey:["shop-items"]}),m.invalidateQueries({queryKey:["catalog-items"]}),m.invalidateQueries({queryKey:["my-assets"]}),m.invalidateQueries({queryKey:["purchases"]});const P=ee.current;ee.current=null,k(null),E(!1);const Re={items:p,txHash:g[0]??void 0,settled:!0,...P?{creditsAdded:P}:{}};$("/success",{state:Re,replace:!0})}catch(o){if(pe(o)||U(o,{flow:"cart_checkout",step:j,cart_size:s.length}),D(pe(o)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:j,error_code:Je(o),value_usd:_e(i.reduce((b,g)=>b+g.priceCredits,0)),cart_size:c.length}),d.length){try{await ye(a.identity,d)}catch(b){U(b,{flow:"cart_checkout",step:"release"})}m.invalidateQueries({queryKey:["usd-balance"]})}k({phase:"error",message:fe(o)})}}function de(s){const c=ve(s);if(A!=null&&A.credits<c){le(s);return}Ee(s)}async function Q(){if(!a){be({type:"cart-checkout"}),f();return}const s=N.getState().items;if(s.length===0)return;L(null),z(null),E(!0);const c=s.reduce((i,p)=>i+p.priceCredits*p.quantity,0);D("Shop Started Checkout",{cart_size:s.length,cart_value_credits:c,cart_value_usd:_e(c),has_sufficient_credits:O>=c});try{B(t("cart.status.reviewing"));const i=await cs(s,a.address,Me),p=[...i.unavailable,...i.own];if(p.length&&(p.forEach(d=>n(d.id)),z(vs(i))),i.buyable.length===0){L(t("cart.error.noneAvailable")),K(null),B(null);return}if(i.orderChanged){K(i),ce.current=Date.now(),B(null);return}B(null),de(i.buyable)}catch(i){U(i,{flow:"cart_checkout",step:"review",cart_size:s.length}),L(fe(i)),B(null)}finally{E(!1)}}async function Ie(){if(v){if(!a){be({type:"cart-checkout"}),f();return}if(Date.now()-ce.current>fs){K(null),z(null),await Q();return}L(null),de(v.buyable)}}async function Pe(){if(Z){try{sessionStorage.setItem(J,JSON.stringify(N.getState().items))}catch{}E(!0);try{const s=await ls(Z,a?{address:a.address,identity:a.identity}:void 0);if(s.url){window.location.href=s.url;return}$("/credits")}catch(s){try{sessionStorage.removeItem(J)}catch{}U(s,{flow:"cart_buy_credits"}),k({phase:"error",message:t("buyModal.error.creditsCheckout")})}finally{E(!1)}}}const ue=h.useRef(!1);h.useEffect(()=>{if(!a||ue.current||!Ze("cart-checkout"))return;ue.current=!0;const s=setTimeout(()=>void Q(),0);return()=>clearTimeout(s)},[a]);const he=h.useRef(!1);h.useEffect(()=>{if(!(q!=null&&q.resumeCheckout)||he.current)return;he.current=!0,ee.current=q.creditsAdded??null;try{const c=sessionStorage.getItem(J);if(c){sessionStorage.removeItem(J);const i=JSON.parse(c);Array.isArray(i)&&i.length&&S(i)}}catch{}m.invalidateQueries({queryKey:["usd-balance"]});const s=setTimeout(()=>void Q(),0);return()=>clearTimeout(s)},[q==null?void 0:q.resumeCheckout]);const I=je||(l==null?void 0:l.phase)==="processing";return r.length===0&&!l?e.jsxs("div",{className:"cart cart--empty",children:[e.jsx(T,{name:"cart",size:44,color:"var(--muted-2)"}),e.jsx("p",{className:"cart-empty__title",children:t("cart.empty.title")}),e.jsx("p",{className:"muted",children:t("cart.empty.body")}),e.jsx(gs,{as:te,to:"/assets",variant:"purple",children:t("cart.empty.cta")})]}):e.jsxs("div",{className:"checkout",children:[e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>$(-1),type:"button",children:[e.jsx(T,{name:"arrow-left"}),t("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:()=>$(-1),type:"button","aria-label":t("cart.goBack"),children:e.jsx(T,{name:"arrow-left"})}),e.jsx("h1",{className:"checkout__panel-title",children:t("cart.panelTitle",{count:ie})}),xe?e.jsxs("button",{className:"checkout__fitting",onClick:()=>M(!0),disabled:I,children:[e.jsx(T,{name:"fitting-room"}),t("cart.fittingRoom")]}):null]}),e.jsxs("section",{className:"checkout__panel",children:[e.jsx("div",{className:"checkout__list",children:r.map(s=>{const c=Se.get(s.id),i=c?c.priceCredits:s.priceCredits,p=!!c&&c.priceCredits!==s.priceCredits,d=!s.tokenId,j=s.quantity,H=typeof s.available=="number"&&j>=s.available,o=i*j,b=!!w[s.id],g=s.tokenId??s.itemId,P=s.contractAddress&&g?`/item/${s.contractAddress}/${g}`:null;return e.jsxs("div",{className:"checkout__card",children:[e.jsxs("div",{className:"checkout__thumb",children:[P?e.jsx(te,{className:"checkout__thumb-link",to:P,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:[P?e.jsx(te,{className:"checkout__name",to:P,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(Ue,{address:s.creator,className:"checkout__creator",linkToProfile:!0}):null]}),e.jsxs("div",{className:"checkout__foot",children:[d?e.jsxs("div",{className:"checkout__stepper",children:[e.jsx("button",{className:"checkout__step",onClick:()=>G(()=>_(s.id)),disabled:I||j<=1,"aria-label":t("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(()=>u(s.id)),disabled:I||H,"aria-label":t("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"})," ",o,p?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${b?" is-on":""}`,onClick:()=>Y(s),"aria-label":b?t("cart.removeFromFavorites",{name:s.name}):t("cart.addToFavorites",{name:s.name}),title:b?t("assetCard.removeFromFavorites"):t("assetCard.addToFavorites"),children:e.jsx(T,{name:b?"heart-solid":"heart"})}),e.jsx("button",{className:"checkout__remove",onClick:()=>G(()=>n(s.id)),disabled:I,"aria-label":t("cart.remove",{name:s.name}),title:t("cart.removeTitle"),children:e.jsx(T,{name:"trash",size:24})})]})]},s.id)})}),e.jsx("div",{className:"checkout__utils",children:e.jsx("button",{className:"link",onClick:()=>G(C),disabled:I,children:t("cart.clearCart")})})]})]}),e.jsxs("aside",{className:"checkout__summary",children:[e.jsx("h2",{className:"checkout__summary-title",children:t("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:t("cart.totalItems",{count:ie})}),e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(F,{className:"checkout__total-ico"})," ",Ce]})]}),e.jsx("button",{className:"checkout__cta",onClick:()=>void(v?Ie():Q()),disabled:I,children:I?t("cart.working"):v?t("marketCheckout.confirmPurchase"):t("assetCard.buyNow")}),a?null:e.jsx("p",{className:"muted checkout__msg",children:t("cart.signInHint")}),v?e.jsx("p",{className:"muted checkout__msg",children:t("cart.priceChanged")}):null,re?e.jsx("p",{className:"muted checkout__msg",children:re}):null,ae?e.jsx("p",{className:"muted checkout__msg",children:ae}):null,e.jsx(ms,{message:ke,className:"checkout__msg"})]})]})]})]}),oe.length>0?e.jsx("div",{className:"cart-upsell",children:e.jsx(es,{title:t("cart.youMightAlsoLike"),items:oe})}):null,l?e.jsx(ys,{phase:l.phase,balanceCredits:O,onClose:qe,stage:l.phase==="processing"?l.stage:void 0,step:l.phase==="processing"?l.step:void 0,total:l.phase==="processing"?l.total:void 0,isSelfCustody:We(a==null?void 0:a.providerType),lines:l.phase==="nofunds"?l.lines:void 0,shortfallCredits:l.phase==="nofunds"?l.shortfall:void 0,packs:W,selectedPack:Z,onSelectPack:ne,onBuyPacks:()=>void Pe(),message:l.phase==="error"?l.message:void 0,onRetry:()=>void Q()}):null]})}export{Us as Cart};
@@ -1,4 +1,4 @@
1
- import{O as N,P as U,Q as w,R as z,S as o,U as E,V as c,W as I,X as g,Y as D,N as R}from"./index-CqYj0Wnc.js";import{r as W,j as v}from"./react-C51i12iP.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{O as N,P as U,Q as w,R as z,S as o,U as E,V as c,W as I,X as g,Y as D,N as R}from"./index-CvQyW_QP.js";import{r as W,j as v}from"./react-C51i12iP.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 Q,u as Y}from"./react-C51i12iP.js";import{F as N,s as v,ap as Z,I as J,t,p as V,E as W,o as X,m as ee,A as ae,aq as te,e as re,ar as se}from"./index-CqYj0Wnc.js";import{E as oe}from"./ErrorNotice-C7soUjRV.js";import{d as ie,g as ce,a as ne,A as le}from"./collection-GFSR-DkZ.js";import{u as de}from"./useStore-CGylzs4i.js";import{s as E}from"./address-DrURAr9O.js";import{d as F,a as me,F as pe,e as ue,S as R,b as ge}from"./categories-B6F31f63.js";import{L as xe}from"./LoadMore-DieY8n7S.js";import{u as he}from"./useInfiniteGrid-C_eF7Ybb.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";const be=v.section`
1
+ import{j as e,r as p,d as Q,u as Y}from"./react-C51i12iP.js";import{F as N,s as v,ap as Z,I as J,t,p as V,E as W,o as X,m as ee,A as ae,aq as te,e as re,ar as se}from"./index-CvQyW_QP.js";import{E as oe}from"./ErrorNotice-C7soUjRV.js";import{d as ie,g as ce,a as ne,A as le}from"./collection-CL98A06v.js";import{u as de}from"./useStore-BgAQDAFj.js";import{s as E}from"./address-DrURAr9O.js";import{d as F,a as me,F as pe,e as ue,S as R,b as ge}from"./categories-Cj5ch47n.js";import{L as xe}from"./LoadMore-BFcYEWu0.js";import{u as he}from"./useInfiniteGrid-DsLCnUAK.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.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 l}from"./react-C51i12iP.js";import{ap as C,G as N,t as i,I as E,as as x,A as S}from"./index-CqYj0Wnc.js";import{s as A}from"./address-DrURAr9O.js";const h="shop:resume_after_signin",I=900*1e3;function R(a){try{sessionStorage.setItem(h,JSON.stringify({...a,at:Date.now()}))}catch{}}function P(a){let o;try{o=sessionStorage.getItem(h)}catch{return null}if(!o)return null;try{sessionStorage.removeItem(h)}catch{}let r;try{r=JSON.parse(o)}catch{return null}return!r||r.type!==a||typeof r.at!="number"||Date.now()-r.at>I?null:r.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:r.path}}function z({address:a,className:o}){const{data:r}=C(a),c=r!=null&&r.name?N(r.name):A(a);return e.jsx("div",{className:o,children:i("search.byCreator",{name:c})})}function B({className:a}){return e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:a,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 D({title:a,items:o,onViewAll:r}){const c=l.useRef(null),[d,g]=l.useState(1),[m,v]=l.useState(0),[j,k]=l.useState(!0),[w,y]=l.useState(!1),n=l.useCallback(()=>{const s=c.current;if(!s)return;const{scrollLeft:t,scrollWidth:_,clientWidth:u}=s,p=Math.max(1,Math.ceil(_/u));g(p),v(Math.min(p-1,Math.round(t/u))),k(t<=1),y(t+u>=_-1)},[]);if(l.useEffect(()=>{n();const s=c.current;if(s)return s.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n),()=>{s.removeEventListener("scroll",n),window.removeEventListener("resize",n)}},[n,o.length]),o.length===0)return null;function f(s){const t=c.current;t&&t.scrollBy({left:s*t.clientWidth,behavior:"smooth"})}function b(s){const t=c.current;t&&t.scrollTo({left:s*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:a}),r?e.jsxs("button",{className:"collection-carousel__viewall",onClick:r,children:[i("collectionCarousel.viewAll"),e.jsx(E,{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:()=>f(-1),"aria-label":i("collectionCarousel.scrollLeft"),disabled:j,children:e.jsx("img",{src:x,alt:"","aria-hidden":!0})}),e.jsx("div",{className:"collection-carousel__track",ref:c,children:o.map(s=>e.jsx(S,{item:s},s.id))}),e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--right",onClick:()=>f(1),"aria-label":i("collectionCarousel.scrollRight"),disabled:w,children:e.jsx("img",{src:x,alt:"","aria-hidden":!0})})]}),d>1?e.jsx("div",{className:"collection-carousel__dots","aria-label":i("collectionCarousel.pages"),children:Array.from({length:d}).map((s,t)=>e.jsx("button",{className:`collection-carousel__dot${t===m?" is-active":""}`,"aria-label":i("collectionCarousel.goToPage",{page:t+1}),"aria-current":t===m?"true":void 0,onClick:()=>b(t)},t))}):null]})}export{z as C,B as W,D as a,R as s,P as t};
1
+ import{j as e,r as l}from"./react-C51i12iP.js";import{ap as C,G as N,t as i,I as E,as as x,A as S}from"./index-CvQyW_QP.js";import{s as A}from"./address-DrURAr9O.js";const h="shop:resume_after_signin",I=900*1e3;function R(a){try{sessionStorage.setItem(h,JSON.stringify({...a,at:Date.now()}))}catch{}}function P(a){let o;try{o=sessionStorage.getItem(h)}catch{return null}if(!o)return null;try{sessionStorage.removeItem(h)}catch{}let r;try{r=JSON.parse(o)}catch{return null}return!r||r.type!==a||typeof r.at!="number"||Date.now()-r.at>I?null:r.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:r.path}}function z({address:a,className:o}){const{data:r}=C(a),c=r!=null&&r.name?N(r.name):A(a);return e.jsx("div",{className:o,children:i("search.byCreator",{name:c})})}function B({className:a}){return e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:a,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 D({title:a,items:o,onViewAll:r}){const c=l.useRef(null),[d,g]=l.useState(1),[m,v]=l.useState(0),[j,k]=l.useState(!0),[w,y]=l.useState(!1),n=l.useCallback(()=>{const s=c.current;if(!s)return;const{scrollLeft:t,scrollWidth:_,clientWidth:u}=s,p=Math.max(1,Math.ceil(_/u));g(p),v(Math.min(p-1,Math.round(t/u))),k(t<=1),y(t+u>=_-1)},[]);if(l.useEffect(()=>{n();const s=c.current;if(s)return s.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n),()=>{s.removeEventListener("scroll",n),window.removeEventListener("resize",n)}},[n,o.length]),o.length===0)return null;function f(s){const t=c.current;t&&t.scrollBy({left:s*t.clientWidth,behavior:"smooth"})}function b(s){const t=c.current;t&&t.scrollTo({left:s*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:a}),r?e.jsxs("button",{className:"collection-carousel__viewall",onClick:r,children:[i("collectionCarousel.viewAll"),e.jsx(E,{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:()=>f(-1),"aria-label":i("collectionCarousel.scrollLeft"),disabled:j,children:e.jsx("img",{src:x,alt:"","aria-hidden":!0})}),e.jsx("div",{className:"collection-carousel__track",ref:c,children:o.map(s=>e.jsx(S,{item:s},s.id))}),e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--right",onClick:()=>f(1),"aria-label":i("collectionCarousel.scrollRight"),disabled:w,children:e.jsx("img",{src:x,alt:"","aria-hidden":!0})})]}),d>1?e.jsx("div",{className:"collection-carousel__dots","aria-label":i("collectionCarousel.pages"),children:Array.from({length:d}).map((s,t)=>e.jsx("button",{className:`collection-carousel__dot${t===m?" is-active":""}`,"aria-label":i("collectionCarousel.goToPage",{page:t+1}),"aria-current":t===m?"true":void 0,onClick:()=>b(t)},t))}):null]})}export{z as C,B as W,D as a,R as s,P 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-C51i12iP.js";import{at as oe,au as ce,w as le,t as a,av as E,B as ne,ap as D,u as ie,I,p as de,m as me,A as ue,am as he,aw as ge,e as xe}from"./index-CqYj0Wnc.js";import{d as _e,g as pe,a as Ne,A as je}from"./collection-GFSR-DkZ.js";import{u as be,L as fe}from"./useStore-CGylzs4i.js";import{s as O}from"./address-DrURAr9O.js";import{d as $,a as ve,S as w,F as Ce,e as we,b as ke}from"./categories-B6F31f63.js";import{L as B}from"./LoadMore-DieY8n7S.js";import{u as R}from"./useInfiniteGrid-C_eF7Ybb.js";import{E as T}from"./ErrorNotice-C7soUjRV.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.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 Se({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 ye={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:ye[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(Se,{address:t,className:"creator-hero__follow"})]})]})]})}const U=48;function Ge(){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"),S=d&&!Number.isNaN(Number(d))?Number(d):void 0,y=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:S,maxPriceCredits:y,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=!!(S||y),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{Ge as Creator,Ge as default};
1
+ import{u as K,j as e,L as re,d as se,b as te,r as j}from"./react-C51i12iP.js";import{at as oe,au as ce,w as le,t as a,av as E,B as ne,ap as D,u as ie,I,p as de,m as me,A as ue,am as he,aw as ge,e as xe}from"./index-CvQyW_QP.js";import{d as _e,g as pe,a as Ne,A as je}from"./collection-CL98A06v.js";import{u as be,L as fe}from"./useStore-BgAQDAFj.js";import{s as O}from"./address-DrURAr9O.js";import{d as $,a as ve,S as w,F as Ce,e as we,b as ke}from"./categories-Cj5ch47n.js";import{L as B}from"./LoadMore-BFcYEWu0.js";import{u as R}from"./useInfiniteGrid-DsLCnUAK.js";import{E as T}from"./ErrorNotice-C7soUjRV.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.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 Se({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 ye={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:ye[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(Se,{address:t,className:"creator-hero__follow"})]})]})]})}const U=48;function Ge(){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"),S=d&&!Number.isNaN(Number(d))?Number(d):void 0,y=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:S,maxPriceCredits:y,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=!!(S||y),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{Ge as Creator,Ge as default};
@@ -1,4 +1,4 @@
1
- import{be as U,bf as Ue,S as C,bg as qe,bh as Ye,a0 as Qe,bi as Je,aC as Xe,R as W,aH as K,aG as Te,bj as a,bk as Ze,bl as Le,T as et,aN as tt}from"./index-CqYj0Wnc.js";import{R as rt,g as ot}from"./getOverlayAlpha-B3r4B2PY.js";import{j as T,r as y}from"./react-C51i12iP.js";import{u as nt,a as Be}from"./useTheme-DIH_4JLE.js";function ne(r){const o=Ue(r);return r!==o&&o.styles?(o.styles.match(/^@layer\s+[^{]*$/)||(o.styles=`@layer global{${o.styles}}`),o):r}function at({styles:r,themeId:o,defaultTheme:n={}}){const i=nt(n),s=o&&i[o]||i;let l=typeof r=="function"?r(s):r;return s.modularCssLayers&&(Array.isArray(l)?l=l.map(d=>ne(typeof d=="function"?d(s):d)):l=ne(l)),T.jsx(U,{styles:l})}const Ee=y.createContext(null);function se(){return y.useContext(Ee)}const it=typeof Symbol=="function"&&Symbol.for,st=it?Symbol.for("mui.nested"):"__THEME_NESTED__";function lt(r,o){return typeof o=="function"?o(r):C({},r,o)}function ct(r){const{children:o,theme:n}=r,i=se(),s=y.useMemo(()=>{const l=i===null?n:lt(i,n);return l!=null&&(l[st]=i!==null),l},[n,i]);return T.jsx(Ee.Provider,{value:s,children:o})}function dt(r){const o=Be(),n=qe()||"",{modularCssLayers:i}=r;let s="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!i||o!==null?s="":typeof i=="string"?s=i.replace(/mui(?!\.)/g,s):s=`@layer ${s};`,Ye(()=>{const l=document.querySelector("head");if(!l)return;const d=l.firstChild;if(s){var m;if(d&&(m=d.hasAttribute)!=null&&m.call(d,"data-mui-layer-order")&&d.getAttribute("data-mui-layer-order")===n)return;const S=document.createElement("style");S.setAttribute("data-mui-layer-order",n),S.textContent=s,l.prepend(S)}else{var f;(f=l.querySelector(`style[data-mui-layer-order="${n}"]`))==null||f.remove()}},[s,n]),s?T.jsx(at,{styles:s}):null}const $e={};function xe(r,o,n,i=!1){return y.useMemo(()=>{const s=r&&o[r]||o;if(typeof n=="function"){const l=n(s),d=r?C({},o,{[r]:l}):l;return i?()=>d:d}return r?C({},o,{[r]:n}):C({},o,n)},[r,o,n,i])}function ut(r){const{children:o,theme:n,themeId:i}=r,s=Be($e),l=se()||$e,d=xe(i,s,n),m=xe(i,l,n,!0),f=d.direction==="rtl",S=dt(d);return T.jsx(ct,{theme:m,children:T.jsx(Qe.Provider,{value:d,children:T.jsx(rt,{value:f,children:T.jsxs(Je,{value:d==null?void 0:d.components,children:[S,o]})})})})}const le="mode",ce="color-scheme",Ie="data-color-scheme";function mt(r){const{defaultMode:o="light",defaultLightColorScheme:n="light",defaultDarkColorScheme:i="dark",modeStorageKey:s=le,colorSchemeStorageKey:l=ce,attribute:d=Ie,colorSchemeNode:m="document.documentElement",nonce:f}=r||{};return T.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?f:"",dangerouslySetInnerHTML:{__html:`(function() {
1
+ import{be as U,bf as Ue,S as C,bg as qe,bh as Ye,a0 as Qe,bi as Je,aC as Xe,R as W,aH as K,aG as Te,bj as a,bk as Ze,bl as Le,T as et,aN as tt}from"./index-CvQyW_QP.js";import{R as rt,g as ot}from"./getOverlayAlpha-B2lvaXjs.js";import{j as T,r as y}from"./react-C51i12iP.js";import{u as nt,a as Be}from"./useTheme-Du2ZuXGU.js";function ne(r){const o=Ue(r);return r!==o&&o.styles?(o.styles.match(/^@layer\s+[^{]*$/)||(o.styles=`@layer global{${o.styles}}`),o):r}function at({styles:r,themeId:o,defaultTheme:n={}}){const i=nt(n),s=o&&i[o]||i;let l=typeof r=="function"?r(s):r;return s.modularCssLayers&&(Array.isArray(l)?l=l.map(d=>ne(typeof d=="function"?d(s):d)):l=ne(l)),T.jsx(U,{styles:l})}const Ee=y.createContext(null);function se(){return y.useContext(Ee)}const it=typeof Symbol=="function"&&Symbol.for,st=it?Symbol.for("mui.nested"):"__THEME_NESTED__";function lt(r,o){return typeof o=="function"?o(r):C({},r,o)}function ct(r){const{children:o,theme:n}=r,i=se(),s=y.useMemo(()=>{const l=i===null?n:lt(i,n);return l!=null&&(l[st]=i!==null),l},[n,i]);return T.jsx(Ee.Provider,{value:s,children:o})}function dt(r){const o=Be(),n=qe()||"",{modularCssLayers:i}=r;let s="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!i||o!==null?s="":typeof i=="string"?s=i.replace(/mui(?!\.)/g,s):s=`@layer ${s};`,Ye(()=>{const l=document.querySelector("head");if(!l)return;const d=l.firstChild;if(s){var m;if(d&&(m=d.hasAttribute)!=null&&m.call(d,"data-mui-layer-order")&&d.getAttribute("data-mui-layer-order")===n)return;const S=document.createElement("style");S.setAttribute("data-mui-layer-order",n),S.textContent=s,l.prepend(S)}else{var f;(f=l.querySelector(`style[data-mui-layer-order="${n}"]`))==null||f.remove()}},[s,n]),s?T.jsx(at,{styles:s}):null}const $e={};function xe(r,o,n,i=!1){return y.useMemo(()=>{const s=r&&o[r]||o;if(typeof n=="function"){const l=n(s),d=r?C({},o,{[r]:l}):l;return i?()=>d:d}return r?C({},o,{[r]:n}):C({},o,n)},[r,o,n,i])}function ut(r){const{children:o,theme:n,themeId:i}=r,s=Be($e),l=se()||$e,d=xe(i,s,n),m=xe(i,l,n,!0),f=d.direction==="rtl",S=dt(d);return T.jsx(ct,{theme:m,children:T.jsx(Qe.Provider,{value:d,children:T.jsx(rt,{value:f,children:T.jsxs(Je,{value:d==null?void 0:d.components,children:[S,o]})})})})}const le="mode",ce="color-scheme",Ie="data-color-scheme";function mt(r){const{defaultMode:o="light",defaultLightColorScheme:n="light",defaultDarkColorScheme:i="dark",modeStorageKey:s=le,colorSchemeStorageKey:l=ce,attribute:d=Ie,colorSchemeNode:m="document.documentElement",nonce:f}=r||{};return T.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?f:"",dangerouslySetInnerHTML:{__html:`(function() {
2
2
  try {
3
3
  var mode = localStorage.getItem('${s}') || '${o}';
4
4
  var colorScheme = '';
@@ -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-D1LJTB8Q.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-DYRw2UXa.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-OfY9y0WI.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-8BWuHMTg.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 $,b as q,r as i,j as e}from"./react-C51i12iP.js";import{m as H,t as s,u as Q,b as V,j as g,e as d,E as P,k as I,C as W,f as z}from"./index-CqYj0Wnc.js";import{R as G}from"./resume-buy-Bf0zIH7y.js";import{R as D}from"./cart-checkout-b6rH0J-R.js";import{l as J}from"./loader-logo-BzY9EKdC.js";import{u as Z,p as X,c as ee,i as se}from"./useCreditPacks-B_ZTg1et.js";import{C as te}from"./CircularProgress-AupKGvsC.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";const j="https://cdn.decentraland.org/@dcl/shop/0.1.0-30043904010.commit-d846220/assets/pack-chips--HnOpf5U.webp",re="https://cdn.decentraland.org/@dcl/shop/0.1.0-30043904010.commit-d846220/assets/credit-coin-CmcTCd5i.webp",ae="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",x=se()?"mock":"stripe",ce={pack_5:j,pack_10:j,pack_25:j,pack_50:j},ne="https://docs.decentraland.org";function M(l){const r=l;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 je(){H({title:s("nav.getCredits",{currency:d.name}),noindex:!0});const l=$(),{session:r,signIn:m}=Q(),n=V(),[N,w]=q(),{packs:F,isLoading:T}=Z(),[p,o]=i.useState("select"),[c,E]=i.useState(null),[R,L]=i.useState(null),[U,h]=i.useState(null),[K,f]=i.useState(!1),b=i.useRef(null);i.useEffect(()=>()=>{var t;return(t=b.current)==null?void 0:t.abort()},[]);const A=i.useCallback(()=>{w(t=>{const a=new URLSearchParams(t);return a.delete("order"),a.delete("canceled"),a},{replace:!0})},[w]),y=i.useCallback(async t=>{o("processing");const a=new AbortController;b.current=a;try{const u=await X(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;L(_>0?_:null),o("success"),g("Shop Completed Buy Credits",{order_id:t,pack_usd:(c==null?void 0:c.usd)??null,credits:_>0?_:null,provider:x}),n.invalidateQueries({queryKey:["usd-balance"]});try{if(sessionStorage.getItem(D)){const k={resumeCheckout:!0,..._>0?{creditsAdded:_}:{}};l("/cart",{state:k});return}}catch{}try{const k=sessionStorage.getItem(G);if(k){sessionStorage.removeItem(G);const C=JSON.parse(k),B=C.tokenId??C.itemId;if(C.contractAddress&&B){l(`/item/${C.contractAddress}/${B}`,{state:{item:C,resumeBuy:!0}});return}}}catch{}}else u.status==="pending"?(g("Shop Buy Credits Pending",{step:"grant",pack_usd:(c==null?void 0:c.usd)??null}),n.invalidateQueries({queryKey:["usd-balance"]}),o("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})),o("error"))}catch(u){P(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(M(u)),o("error")}},[c,r,n,l]),O=i.useCallback(async t=>{if(!r){m();return}h(null),f(!1),E(t),o(x==="mock"?"processing":"redirecting"),g("Shop Started Buy Credits",{pack_usd:t.usd,credits:t.credits,provider:x});try{const a=await ee(t.id,{address:r.address,identity:r.identity});if(a.mock)y(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){P(a,{flow:"get_credits",step:"checkout",provider:x}),g("Shop Buy Credits Failed",{step:"checkout",error_code:I(a),pack_usd:t.usd}),h(M(a)),o("error")}},[r,m,y]),v=i.useRef(!1);i.useEffect(()=>{if(v.current)return;const t=N.get("order");if(N.get("canceled")!=null){v.current=!0,g("Shop Buy Credits Cancelled",{order_id:t,provider:x}),A(),f(!0),o("select");return}t&&(o("processing"),r&&(v.current=!0,A(),y(t)))},[N,r]);function S(){var t;(t=b.current)==null||t.abort(),o("select"),E(null),L(null),h(null),f(!1)}const Y=p==="select";return e.jsxs("div",{className:"getcredits",children:[Y&&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(ie,{packs:F,loading:T,onSelect:t=>void O(t)})]}),p==="redirecting"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(te,{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:J,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:ae,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})]})]}),R!=null&&e.jsx("div",{className:"gc-credits",children:e.jsxs("div",{className:"gc-credits__row",children:[e.jsx("img",{className:"gc-credits__coin",src:re,alt:"",width:93,height:93}),e.jsxs("p",{className:"gc-credits__text",children:[e.jsx(W,{className:"gc-credits__diamond"}),e.jsxs("span",{children:[e.jsx("strong",{className:"gc-credits__amount",children:s("getCredits.creditsAmount",{credits:R,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:S,children:s("getCredits.buyMore",{currency:d.name})}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/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:()=>l("/assets"),children:s("getCredits.startShopping")}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:S,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:S,children:s("getCredits.tryAgain")})})]})]})}function ie({packs:l,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(n=>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"})]})},n))}):e.jsx("div",{className:"packs",children:l.map(n=>e.jsxs("button",{type:"button",className:`pack${n.bestValue?" pack--best":""}`,"data-testid":"pack",onClick:()=>m(n),"aria-label":s("getCredits.packAria",{amount:z(n.credits),usd:n.usd}),children:[n.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:n.credits,currency:d.name})}),e.jsx("span",{className:"pack__art",children:e.jsx("img",{src:ce[n.id]??j,alt:"",loading:"lazy"})}),e.jsx("span",{className:"pack__cta-wrap",children:e.jsxs("span",{className:"pack__cta",children:["$",n.usd.toFixed(2)]})})]})]},n.id))})}export{je as GetCredits,je as default};
1
+ import{u as $,b as q,r as i,j as e}from"./react-C51i12iP.js";import{m as H,t as s,u as Q,b as V,j as g,e as d,E as P,k as I,C as W,f as z}from"./index-CvQyW_QP.js";import{R as G}from"./resume-buy-Bf0zIH7y.js";import{R as D}from"./cart-checkout-DDMa9Rc9.js";import{l as J}from"./loader-logo-BzY9EKdC.js";import{u as Z,p as X,c as ee,i as se}from"./useCreditPacks-B55O8DxS.js";import{C as te}from"./CircularProgress-BCIDrAUj.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";const j="https://cdn.decentraland.org/@dcl/shop/0.1.0-30043934931.commit-86cfb70/assets/pack-chips--HnOpf5U.webp",re="https://cdn.decentraland.org/@dcl/shop/0.1.0-30043934931.commit-86cfb70/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",x=se()?"mock":"stripe",ae={pack_5:j,pack_10:j,pack_25:j,pack_50:j},ne="https://docs.decentraland.org";function M(l){const r=l;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 je(){H({title:s("nav.getCredits",{currency:d.name}),noindex:!0});const l=$(),{session:r,signIn:m}=Q(),n=V(),[N,w]=q(),{packs:F,isLoading:T}=Z(),[p,o]=i.useState("select"),[a,E]=i.useState(null),[R,L]=i.useState(null),[U,h]=i.useState(null),[K,f]=i.useState(!1),b=i.useRef(null);i.useEffect(()=>()=>{var t;return(t=b.current)==null?void 0:t.abort()},[]);const A=i.useCallback(()=>{w(t=>{const c=new URLSearchParams(t);return c.delete("order"),c.delete("canceled"),c},{replace:!0})},[w]),y=i.useCallback(async t=>{o("processing");const c=new AbortController;b.current=c;try{const u=await X(t,{signal:c.signal,address:r==null?void 0:r.address,identity:r==null?void 0:r.identity});if(u.status==="credited"){const _=u.creditsGranted??(a==null?void 0:a.credits)??0;L(_>0?_:null),o("success"),g("Shop Completed Buy Credits",{order_id:t,pack_usd:(a==null?void 0:a.usd)??null,credits:_>0?_:null,provider:x}),n.invalidateQueries({queryKey:["usd-balance"]});try{if(sessionStorage.getItem(D)){const k={resumeCheckout:!0,..._>0?{creditsAdded:_}:{}};l("/cart",{state:k});return}}catch{}try{const k=sessionStorage.getItem(G);if(k){sessionStorage.removeItem(G);const C=JSON.parse(k),B=C.tokenId??C.itemId;if(C.contractAddress&&B){l(`/item/${C.contractAddress}/${B}`,{state:{item:C,resumeBuy:!0}});return}}}catch{}}else u.status==="pending"?(g("Shop Buy Credits Pending",{step:"grant",pack_usd:(a==null?void 0:a.usd)??null}),n.invalidateQueries({queryKey:["usd-balance"]}),o("pending")):(g("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(a==null?void 0:a.usd)??null}),h(u.error??s("getCredits.errorGrant",{currency:d.name})),o("error"))}catch(u){P(u,{flow:"get_credits",step:"grant",order_id:t}),g("Shop Buy Credits Failed",{step:"grant",error_code:I(u),pack_usd:(a==null?void 0:a.usd)??null}),h(M(u)),o("error")}},[a,r,n,l]),O=i.useCallback(async t=>{if(!r){m();return}h(null),f(!1),E(t),o(x==="mock"?"processing":"redirecting"),g("Shop Started Buy Credits",{pack_usd:t.usd,credits:t.credits,provider:x});try{const c=await ee(t.id,{address:r.address,identity:r.identity});if(c.mock)y(c.orderId);else if(c.url)g("Shop Redirected To Stripe",{order_id:c.orderId,pack_usd:t.usd,credits:t.credits}),window.location.href=c.url;else throw new Error("Checkout did not return a redirect url")}catch(c){P(c,{flow:"get_credits",step:"checkout",provider:x}),g("Shop Buy Credits Failed",{step:"checkout",error_code:I(c),pack_usd:t.usd}),h(M(c)),o("error")}},[r,m,y]),v=i.useRef(!1);i.useEffect(()=>{if(v.current)return;const t=N.get("order");if(N.get("canceled")!=null){v.current=!0,g("Shop Buy Credits Cancelled",{order_id:t,provider:x}),A(),f(!0),o("select");return}t&&(o("processing"),r&&(v.current=!0,A(),y(t)))},[N,r]);function S(){var t;(t=b.current)==null||t.abort(),o("select"),E(null),L(null),h(null),f(!1)}const Y=p==="select";return e.jsxs("div",{className:"getcredits",children:[Y&&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(ie,{packs:F,loading:T,onSelect:t=>void O(t)})]}),p==="redirecting"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(te,{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:J,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})]})]}),R!=null&&e.jsx("div",{className:"gc-credits",children:e.jsxs("div",{className:"gc-credits__row",children:[e.jsx("img",{className:"gc-credits__coin",src:re,alt:"",width:93,height:93}),e.jsxs("p",{className:"gc-credits__text",children:[e.jsx(W,{className:"gc-credits__diamond"}),e.jsxs("span",{children:[e.jsx("strong",{className:"gc-credits__amount",children:s("getCredits.creditsAmount",{credits:R,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:S,children:s("getCredits.buyMore",{currency:d.name})}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/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:()=>l("/assets"),children:s("getCredits.startShopping")}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:S,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:S,children:s("getCredits.tryAgain")})})]})]})}function ie({packs:l,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(n=>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"})]})},n))}):e.jsx("div",{className:"packs",children:l.map(n=>e.jsxs("button",{type:"button",className:`pack${n.bestValue?" pack--best":""}`,"data-testid":"pack",onClick:()=>m(n),"aria-label":s("getCredits.packAria",{amount:z(n.credits),usd:n.usd}),children:[n.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:n.credits,currency:d.name})}),e.jsx("span",{className:"pack__art",children:e.jsx("img",{src:ae[n.id]??j,alt:"",loading:"lazy"})}),e.jsx("span",{className:"pack__cta-wrap",children:e.jsxs("span",{className:"pack__cta",children:["$",n.usd.toFixed(2)]})})]})]},n.id))})}export{je as GetCredits,je 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-CkKBRMeq.js";import{d as g,r as v}from"./index-DYRw2UXa.js";import{C as c}from"./ConstantsUtil-CJUlyS7R.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-D1LJTB8Q.js";import{au as y}from"./NetworkUtil-Xp0fNa8X.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-CMr_6Nyd.js";import{d as g,r as v}from"./index-8BWuHMTg.js";import{C as c}from"./ConstantsUtil-CJUlyS7R.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-OfY9y0WI.js";import{au as y}from"./NetworkUtil-Xp0fNa8X.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-C51i12iP.js";import{v as $,t as s,e as S,B as k,C as L,j as P,E as Q,m as U,u as W,b as O,o as z,s as F,J}from"./index-CqYj0Wnc.js";import{i as Y,R as D,f as G}from"./import-CAQj-dM2.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./buy-BAwpkHiu.js";import"./authorizations-BV0VRJbP.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";import"./trade-encoding-DML-9EOG.js";import"./mana-rate-DO_0nFzU.js";function H({queue:n,session:T,onClose:j,onDone:o}){const N=R(),d=$(T.providerType),[m,f]=h.useState(()=>n.map(()=>"pending")),[I,E]=h.useState("running"),w=h.useRef(!1);h.useEffect(()=>{if(w.current)return;w.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,T),P("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||E("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-C51i12iP.js";import{v as $,t as s,e as S,B as k,C as L,j as P,E as Q,m as U,u as W,b as O,o as z,s as F,J}from"./index-CvQyW_QP.js";import{i as Y,R as D,f as G}from"./import-Cw8zAtic.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./buy-CKXN4iAy.js";import"./authorizations-C0u3KwlE.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";import"./trade-encoding-pUwpxnzm.js";import"./mana-rate-XqhyW2JQ.js";function H({queue:n,session:T,onClose:j,onDone:o}){const N=R(),d=$(T.providerType),[m,f]=h.useState(()=>n.map(()=>"pending")),[I,E]=h.useState("running"),w=h.useRef(!1);h.useEffect(()=>{if(w.current)return;w.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,T),P("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||E("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;