@dcl/shop 0.1.0-30277401547.commit-e877307 → 0.1.0-30279564518.commit-0ea36ab

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 (171) hide show
  1. package/assets/{Activity-_qlXQij1.js → Activity-CjKP24SM.js} +2 -2
  2. package/assets/{AnimatedBackground-DO49gSw8.js → AnimatedBackground-D2jsXv_Q.js} +3 -3
  3. package/assets/{Assets-D-VpkQ1l.js → Assets-DjrlGGuo.js} +2 -2
  4. package/assets/{Assets.styles-BZMkOQeI.js → Assets.styles-DKu0M-fo.js} +1 -1
  5. package/assets/{Authorizations-BFWG3QA_.js → Authorizations-DfNkZpjD.js} +1 -1
  6. package/assets/{Button-DvhW1Z1S.js → Button-DUuwMw2g.js} +1 -1
  7. package/assets/{Cart-Cz7NK8QL.js → Cart-DYkqiuyJ.js} +1 -1
  8. package/assets/{CircularProgress-BmwVvF17.js → CircularProgress-BOITSQXA.js} +1 -1
  9. package/assets/{Collection-Bc2CvIur.js → Collection-0X39SWqr.js} +1 -1
  10. package/assets/{CollectionCarousel-DEYFBykF.js → CollectionCarousel-B0A1YOX-.js} +1 -1
  11. package/assets/{Creator-7vyVsWtE.js → Creator-BjoPunwO.js} +1 -1
  12. package/assets/{ExchangeController-icK8vQc1.js → ExchangeController--3J53YgS.js} +1 -1
  13. package/assets/{GetCredits-BE-bIUdj.js → GetCredits-BcZpGmti.js} +1 -1
  14. package/assets/{HelpersUtil-C_aV_Y-W.js → HelpersUtil-DWI18gI9.js} +1 -1
  15. package/assets/{ImportListings-CusN2RYj.js → ImportListings-DNcnjuRU.js} +1 -1
  16. package/assets/{ItemDetail-blewhWwg.js → ItemDetail-By9hJU7O.js} +3 -3
  17. package/assets/{LoadMore-C2uaqP2N.js → LoadMore-Cv8ieNqf.js} +1 -1
  18. package/assets/{MarketCheckout-CW6mGgHt.js → MarketCheckout-B7kj-ofT.js} +1 -1
  19. package/assets/{MenuList-mbP1RxaG.js → MenuList-Dpn2ZgKk.js} +1 -1
  20. package/assets/{MyAssets-HcHA9d8L.js → MyAssets-yXg0a1Zj.js} +1 -1
  21. package/assets/{MyFavorites-DkEAv96J.js → MyFavorites-C6oOSvkj.js} +1 -1
  22. package/assets/{NotFound-B2W2MHR8.js → NotFound-BMCYiONc.js} +1 -1
  23. package/assets/{NotificationsBell-BEAvIZcq.js → NotificationsBell-5E6mEGEn.js} +1 -1
  24. package/assets/{StoreSettings-CGc7i0kZ.js → StoreSettings-DbdH6mzE.js} +1 -1
  25. package/assets/{Success-5LiVLOny.js → Success-D7KdjdBY.js} +1 -1
  26. package/assets/{SwapController-BZT-uJE0.js → SwapController-C0FvCHWq.js} +1 -1
  27. package/assets/{Tooltip-V9fXstBY.js → Tooltip-DSEH6tal.js} +1 -1
  28. package/assets/{TradeService-D9nuCaGq.js → TradeService-CbFSATer.js} +1 -1
  29. package/assets/{W3MFrameProviderSingleton-Ccq1reIt.js → W3MFrameProviderSingleton-CCVyEXOJ.js} +3 -3
  30. package/assets/{WebCryptoP256-CrgJppag.js → WebCryptoP256-CxdV7gm_.js} +1 -1
  31. package/assets/{authorizations-t9AL68YM.js → authorizations-Bt-yiKpU.js} +1 -1
  32. package/assets/{basic-BIbSgqQe.js → basic-1GkOUAUg.js} +1 -1
  33. package/assets/{biconomy-JEnDnFaz.js → biconomy-CEgRNCV3.js} +1 -1
  34. package/assets/{builder-uUlDA8Em.js → builder-ChMzGlEf.js} +1 -1
  35. package/assets/{buy-84sizoxr.js → buy-C8thJCOQ.js} +1 -1
  36. package/assets/{buy-gasless-oF_YJX_W.js → buy-gasless-kzWGfidX.js} +1 -1
  37. package/assets/{cart-checkout-K77UDHy3.js → cart-checkout-DtChJ5jV.js} +1 -1
  38. package/assets/{categories-BwvbYi6M.js → categories-CQDU6eKt.js} +1 -1
  39. package/assets/{ccip-5L0bsS_C.js → ccip-D0x94rIy.js} +1 -1
  40. package/assets/{ccip-wypw12me.js → ccip-DHMKr_5U.js} +1 -1
  41. package/assets/collection-4qJRowPN.js +1 -0
  42. package/assets/{controller-Cwg1NxXB.js → controller-BkyUM4Zl.js} +2 -2
  43. package/assets/{core-3ZRiSdvl.js → core-xNSXcK8v.js} +4 -4
  44. package/assets/{custom-BVE_f5dD.js → custom-DbKBJS0m.js} +1 -1
  45. package/assets/{data-capture-BRhsLQVv.js → data-capture-DDPGGwVG.js} +1 -1
  46. package/assets/{email-CldXoMar.js → email-Bdh6R3aN.js} +1 -1
  47. package/assets/{embedded-wallet-vSjh73AM.js → embedded-wallet-D6Oykct7.js} +1 -1
  48. package/assets/{emotion-styled.browser.esm-vQZV14Nf.js → emotion-styled.browser.esm-D7LnnFGM.js} +1 -1
  49. package/assets/{engine-BPP9EW4Q.js → engine-DKBZ9rvO.js} +1 -1
  50. package/assets/{errors-D-hio89k.js → errors-CGr_h4qk.js} +1 -1
  51. package/assets/{estimate-l1-fee-BLZxmPJY.js → estimate-l1-fee-CoGVlirt.js} +1 -1
  52. package/assets/{execute-cH8V-8nL.js → execute-BNAgRbv2.js} +2 -2
  53. package/assets/{features-CJ1tq5LL.js → features-yBnE0kv6.js} +1 -1
  54. package/assets/{fetchTokenMetadata-hD4VNXHw.js → fetchTokenMetadata-BgTzU1uv.js} +2 -2
  55. package/assets/{get-ecosystem-wallet-info-3DZHpSG2.js → get-ecosystem-wallet-info-DCVnaTdL.js} +1 -1
  56. package/assets/{getBalance-vjJ5CXDC.js → getBalance-Ck3AgdKh.js} +1 -1
  57. package/assets/{getNFT-BTjIkFXY.js → getNFT-Ticzp8Hs.js} +1 -1
  58. package/assets/{getNFT-D8HIjTde.js → getNFT-v9ULC-Df.js} +1 -1
  59. package/assets/{getThemeProps-qmqFWvou.js → getThemeProps-BcAfOiiP.js} +1 -1
  60. package/assets/{hashTypedData-Y2DJnKI9.js → hashTypedData-D-QtOqRa.js} +1 -1
  61. package/assets/{hashTypedData-BrvDnrgK.js → hashTypedData-vyJGLMpP.js} +1 -1
  62. package/assets/{import-AgO0v-a5.js → import-DaK3l2L4.js} +1 -1
  63. package/assets/{in-app-C4N5lFwd.js → in-app-VsfJDWao.js} +1 -1
  64. package/assets/{in-app-wallet-calls-CMBsSG6j.js → in-app-wallet-calls-Cc6TEySq.js} +1 -1
  65. package/assets/{index-1cJq3bUz.js → index--P2VwVy3.js} +1 -1
  66. package/assets/{index-B96cJA0d.js → index-32dihjZM.js} +1 -1
  67. package/assets/{index--8tZMj8Y.js → index-6uEdFIR0.js} +1 -1
  68. package/assets/{index-C8Ua1g52.js → index-7KtzBMW3.js} +1 -1
  69. package/assets/{index-Hb4Ys2Tq.js → index-8eIQG8Kl.js} +1 -1
  70. package/assets/{index-BQOr-Vwz.js → index-B13clZOY.js} +1 -1
  71. package/assets/{index-D0cj2XsC.js → index-B56Mz2YS.js} +1 -1
  72. package/assets/{index-D2iLR1Fl.js → index-BCx0SxC7.js} +1 -1
  73. package/assets/{index-jPOTr4Wq.js → index-BIgVkoHN.js} +1 -1
  74. package/assets/{index-CV39-lnY.js → index-BVMw5QjZ.js} +1 -1
  75. package/assets/{index-Dz0EI57w.js → index-BYz2fOpG.js} +1 -1
  76. package/assets/{index-BcgMkg8Z.js → index-Bd6gPKw4.js} +1 -1
  77. package/assets/{index-CcARyxeB.js → index-Bek4_t_L.js} +1 -1
  78. package/assets/{index-qDfBJZD7.js → index-Bf27DWaL.js} +1 -1
  79. package/assets/{index-BjQNL760.js → index-Bx2U1tYr.js} +1 -1
  80. package/assets/{index-CnIGe1GZ.js → index-Bxhq99ht.js} +1 -1
  81. package/assets/{index-Dx4EbFs-.js → index-BzD7Ebgn.js} +1 -1
  82. package/assets/{index-trxbKGTp.js → index-C6PL2Fdt.js} +1 -1
  83. package/assets/{index-rjU6xZd8.js → index-C8RikeW4.js} +1 -1
  84. package/assets/{index-DCFYAbF4.js → index-C9AUsopd.js} +1 -1
  85. package/assets/{index-BFPNYe8x.js → index-CEUqEDHj.js} +10 -10
  86. package/assets/{index-CI-UnS2-.js → index-CJxmpG1K.js} +1 -1
  87. package/assets/{index-C7gHM4wY.js → index-CKwiZFh4.js} +1 -1
  88. package/assets/{index-E3wxKJyS.js → index-COEkUMH9.js} +1 -1
  89. package/assets/{index-HMuz0PhO.js → index-CWzvA55Z.js} +1 -1
  90. package/assets/{index-bqj_5mVc.js → index-CZQ2_otu.js} +1 -1
  91. package/assets/{index-DGwFgPlc.js → index-Ceh4tqVd.js} +1 -1
  92. package/assets/{index-CiKWw9L3.js → index-Cf5UQJ_k.js} +2 -2
  93. package/assets/{index-CsSypry2.js → index-Cmu7kehM.js} +1 -1
  94. package/assets/{index-BlBoDOVY.js → index-ColsJYiD.js} +1 -1
  95. package/assets/{index-D96o2dcC.js → index-Cpv_qKx8.js} +1 -1
  96. package/assets/{index-DN-OLR2r.js → index-DB0uJXc-.js} +3 -3
  97. package/assets/{index-B_jKVCv0.js → index-DEKVNi4L.js} +1 -1
  98. package/assets/{index-Ch88GJdD.js → index-DGZZiECR.js} +1 -1
  99. package/assets/{index-Dq7pc9gT.js → index-DGwlKYP1.js} +1 -1
  100. package/assets/{index-B8GAuQX3.js → index-DHxeKfAR.js} +3 -3
  101. package/assets/{index-YHVXMMbH.js → index-DNoUzleZ.js} +1 -1
  102. package/assets/{index-BGTbU_0B.js → index-DUxDUxur.js} +2 -2
  103. package/assets/{index-CvkWE_vF.js → index-D_DMIRz9.js} +1 -1
  104. package/assets/{index-C-2OENmH.js → index-DbSgqncZ.js} +1 -1
  105. package/assets/{index-DNLIdOOI.js → index-Dcg9IkwS.js} +1 -1
  106. package/assets/{index-Vlg-GpRL.js → index-DdJ_OK_4.js} +1 -1
  107. package/assets/{index-B9AUDrI9.js → index-DsgKSUtS.js} +1 -1
  108. package/assets/{index-r7kjVwFs.js → index-L08mwnOc.js} +1 -1
  109. package/assets/{index-C7UEmKEb.js → index-SvOsIc3H.js} +3 -3
  110. package/assets/{index-D2-V-v9q.js → index-ehEPbUUu.js} +1 -1
  111. package/assets/{index-BWgCJZHy.js → index-jX2jQJPr.js} +2 -2
  112. package/assets/{index-CmhYJKse.js → index-jsB1K3Ty.js} +1 -1
  113. package/assets/{index-DZxRXkvI.js → index-n-ml-ClE.js} +1 -1
  114. package/assets/{index-BQuXaLZX.js → index-unwNWDy6.js} +1 -1
  115. package/assets/{index-BKvaZQRw.js → index-z80r03Cx.js} +1 -1
  116. package/assets/{index.es-DvYEMDdQ.js → index.es-BZebHuYA.js} +4 -4
  117. package/assets/{index.es-magZDVqq.js → index.es-DI7x2TJx.js} +1 -1
  118. package/assets/{index.es-BKhU-mgO.js → index.es-DpokeYPv.js} +1 -1
  119. package/assets/{localBatchGatewayRequest-CnLOTida.js → localBatchGatewayRequest-B9Ybd7dg.js} +1 -1
  120. package/assets/{mana-rate-BpgRIQMS.js → mana-rate-D7GRB_Ot.js} +1 -1
  121. package/assets/{networks-BNqJWbtk.js → networks-fMdVA1sr.js} +1 -1
  122. package/assets/{onramp-BYjThZVX.js → onramp-B2Q3gTV8.js} +1 -1
  123. package/assets/{openzeppelin-Ba3p7TP4.js → openzeppelin-Dfbjq166.js} +1 -1
  124. package/assets/{parseNft-CfH76UUp.js → parseNft-D4L1MnwK.js} +2 -2
  125. package/assets/{parseSignature-D3qKk3uH.js → parseSignature-B2YsV13I.js} +3 -3
  126. package/assets/{parseSignature-CuL9-kIi.js → parseSignature-Ch8Ikh9R.js} +1 -1
  127. package/assets/{passkeys-DPVQjClK.js → passkeys-CRQs5lh-.js} +1 -1
  128. package/assets/{pay-with-exchange-MNFdDdCT.js → pay-with-exchange-DwcPixRd.js} +1 -1
  129. package/assets/{qr-overlay-DDDT3Q-c.js → qr-overlay-WecOYNdc.js} +1 -1
  130. package/assets/{receive-BU9aVDlN.js → receive-r6itEu_X.js} +1 -1
  131. package/assets/{resolveImplementation-OjvLy3T5.js → resolveImplementation-DuORFImi.js} +1 -1
  132. package/assets/{rpc-DjbYCcnH.js → rpc--KkC2qWz.js} +1 -1
  133. package/assets/{secp256k1-w4Bql-wA.js → secp256k1-7vUkF5ib.js} +1 -1
  134. package/assets/{secp256k1-X13vDEXt.js → secp256k1-CSfTjZp_.js} +1 -1
  135. package/assets/{secp256k1-Cz5kqQCg.js → secp256k1-DRVSRXu6.js} +1 -1
  136. package/assets/{send-oOaeKGnc.js → send-BRRQlzci.js} +1 -1
  137. package/assets/{send-batch-transaction-Dxt9X3nj.js → send-batch-transaction-BASQMYYn.js} +1 -1
  138. package/assets/{send-eip712-transaction-DaAvg9MZ.js → send-eip712-transaction-Cb0e5jgJ.js} +2 -2
  139. package/assets/{send-gasless-transaction-BquzQGsb.js → send-gasless-transaction-TLFFm8L4.js} +2 -2
  140. package/assets/{send-transaction-BHdPLXiu.js → send-transaction-URhXksgR.js} +2 -2
  141. package/assets/{sendMetaTransaction-DNedK3Cr.js → sendMetaTransaction-DnNlMy1f.js} +1 -1
  142. package/assets/{sendRawTransaction-DUzMWVdQ.js → sendRawTransaction-Cp9PwWbz.js} +3 -3
  143. package/assets/{serializeTransaction-BfDfoMJJ.js → serializeTransaction-D6bPY-5e.js} +1 -1
  144. package/assets/{session-proposal-CuVqfqoo.js → session-proposal-CO8C9FgE.js} +1 -1
  145. package/assets/{session-request-CKwxSrqb.js → session-request-CU3My76o.js} +2 -2
  146. package/assets/{signing-BjyyWrkp.js → signing-C1foQi87.js} +3 -3
  147. package/assets/{socials-pvmMMGV3.js → socials-Bsjh-kcj.js} +1 -1
  148. package/assets/{swaps-padIwW3Y.js → swaps-D4LpMI-N.js} +1 -1
  149. package/assets/{thirdweb-kveVeUIA.js → thirdweb-D1z-XTZ-.js} +3 -3
  150. package/assets/{to-serializable-transaction-108u7zPg.js → to-serializable-transaction-B7zKZp3o.js} +2 -2
  151. package/assets/{trade-encoding-DcECym8l.js → trade-encoding-rbwEO5I2.js} +1 -1
  152. package/assets/{transactionReceipt-Bs-2Cglz.js → transactionReceipt-TiskXrB6.js} +1 -1
  153. package/assets/{transactions-dcat6MM1.js → transactions-B5kAYK1L.js} +1 -1
  154. package/assets/useCreditPacks-DPTBuCyg.js +1 -0
  155. package/assets/{useInfiniteGrid-BBNOO0mR.js → useInfiniteGrid-CiDuQRnP.js} +1 -1
  156. package/assets/useManaRate-WxBKKUcB.js +1 -0
  157. package/assets/{useStore-Bo6L1SFA.js → useStore-BF0NEfcO.js} +1 -1
  158. package/assets/{useTheme-CQjQJ5Is.js → useTheme-BhK6j6Fd.js} +1 -1
  159. package/assets/{verifyHash-BfupbUWA.js → verifyHash-BLnnKj_-.js} +1 -1
  160. package/assets/{w3m-modal-CdtZ4EYL.js → w3m-modal-CRKh97nT.js} +1 -1
  161. package/assets/{w3m-modal-C2yr-A_-.js → w3m-modal-D2jSpmw2.js} +1 -1
  162. package/assets/{wait-for-tx-receipt-BBOv1oQx.js → wait-for-tx-receipt-CUP8flYl.js} +1 -1
  163. package/assets/{wallets-CcitqMTg.js → wallets-CBncd5Al.js} +5 -5
  164. package/assets/{web-connector-BLbBOK88.js → web-connector-BbbFAPbG.js} +3 -3
  165. package/assets/{writeContract-Cke2dgme.js → writeContract-DeZcPQuU.js} +1 -1
  166. package/assets/{zoraTestnet-NeGGigN-.js → zoraTestnet-Dea0RHqm.js} +1 -1
  167. package/index.html +11 -11
  168. package/package.json +2 -2
  169. package/assets/collection-D7HQMUIe.js +0 -1
  170. package/assets/useCreditPacks-BAZLy3JX.js +0 -1
  171. package/assets/useManaRate-CGtpZZBQ.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as j,j as e,L as _,e as dt}from"./react-BW1xvPTF.js";import{s as l,K as o,R as lt,B as ht,x as ut,t as d,u as xt,n as b,I as g,aG as G,aH as B,aI as pt,C as v,an as E,S as X,A as mt,aJ as gt,aK as Q}from"./index-BFPNYe8x.js";import{a as ft}from"./mana-rate-BpgRIQMS.js";import{u as yt}from"./useManaRate-CGtpZZBQ.js";import{L as jt}from"./LoadMore-C2uaqP2N.js";import{u as f}from"./useInfiniteGrid-BBNOO0mR.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";const bt=15e3;function vt(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)<=bt}function kt(t){const i=[...t].sort((n,a)=>a.createdAt-n.createdAt),r=[];for(const n of i){const a=r[r.length-1];a&&vt(a[a.length-1],n)?a.push(n):r.push([n])}return r.map(n=>{var a;return{id:((a=n.find(c=>c.txHash))==null?void 0:a.txHash)??n[n.length-1].id,createdAt:Math.max(...n.map(c=>c.createdAt)),status:n.some(c=>c.status==="PENDING")?"PENDING":"SETTLED",totalCredits:n.reduce((c,u)=>c+u.credits,0),lines:n}})}function wt(t){const i=[],r=new Map;for(const n of t)if(n.tradeId){const a=r.get(n.tradeId);if(a){a.quantity+=1,a.credits+=n.credits;continue}const c={key:n.tradeId,tradeId:n.tradeId,quantity:1,credits:n.credits};r.set(n.tradeId,c),i.push(c)}else i.push({key:n.id,tradeId:null,quantity:1,credits:n.credits});return i}function It(t,i){return{id:t.id,contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId,counterparty:t.buyer,credits:i?ft(t.manaWei,i):null,manaWei:t.manaWei,createdAt:t.createdAt,txHash:t.txHash}}function At(t){const r=kt(t.purchases.filter(s=>s.status!=="EXPIRED")).map(s=>({kind:"purchase",id:`purchase:${s.id}`,createdAt:s.createdAt,order:s})),n=t.sales.map(s=>{const x=It(s,t.rate);return{kind:"sale",id:`sale:${x.id}`,createdAt:x.createdAt,sale:x}}),a=(t.creditOrders??[]).filter(s=>s.status!=="EXPIRED").map(s=>({kind:"credit",id:`credit:${s.id}`,createdAt:s.createdAt,order:s})),c=new Set(t.purchases.filter(s=>s.txHash).map(s=>s.txHash.toLowerCase())),u=(t.manaPurchases??[]).filter(s=>!c.has(s.txHash.toLowerCase())).map(s=>({kind:"mana-purchase",id:`mana-purchase:${s.id}`,createdAt:s.createdAt,sale:s}));return[...r,...n,...a,...u].sort((s,x)=>x.createdAt-s.createdAt||(s.id<x.id?-1:1))}function $t(t,i){return i==="all"?t:i==="sales"?t.filter(r=>r.kind==="sale"):t.filter(r=>r.kind==="purchase"||r.kind==="credit"||r.kind==="mana-purchase")}const J=t=>t.trim().toLowerCase();function Pt(t){const i=new Map;for(const r of t??[]){const n=J(r.txHash??"");if(!n)continue;const a=i.get(n);a?a.push(r):i.set(n,[r])}return i}function Nt(t,i,r=Date.now()){const n=i.txHash?t.get(J(i.txHash)):void 0;if(!n||n.length===0)return{kind:"direct"};const a=n.length===1?Lt(n[0].netCents):null,c=n.filter(s=>!s.available&&s.availableAt>r);if(c.length===0)return{kind:"credited",credits:a};const u=c.reduce((s,x)=>Math.max(s,x.availableAt),0);return{kind:"pending",credits:a,availableAt:u}}function Lt(t){return Math.floor(t/10)}const Et="https://cdn.decentraland.org/@dcl/shop/0.1.0-30277401547.commit-e877307/assets/credits-product-vs4Q6u6l.svg",T=lt`
1
+ import{r as b,j as e,L as _,e as dt}from"./react-BW1xvPTF.js";import{s as l,K as o,R as lt,B as ht,x as ut,t as d,u as xt,n as j,I as g,aG as G,aH as B,aI as pt,C as v,an as E,S as X,A as mt,aJ as gt,aK as Q}from"./index-CEUqEDHj.js";import{a as ft}from"./mana-rate-D7GRB_Ot.js";import{u as yt}from"./useManaRate-WxBKKUcB.js";import{L as bt}from"./LoadMore-Cv8ieNqf.js";import{u as f}from"./useInfiniteGrid-CiDuQRnP.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";const jt=15e3;function vt(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)<=jt}function kt(t){const i=[...t].sort((n,a)=>a.createdAt-n.createdAt),r=[];for(const n of i){const a=r[r.length-1];a&&vt(a[a.length-1],n)?a.push(n):r.push([n])}return r.map(n=>{var a;return{id:((a=n.find(c=>c.txHash))==null?void 0:a.txHash)??n[n.length-1].id,createdAt:Math.max(...n.map(c=>c.createdAt)),status:n.some(c=>c.status==="PENDING")?"PENDING":"SETTLED",totalCredits:n.reduce((c,u)=>c+u.credits,0),lines:n}})}function wt(t){const i=[],r=new Map;for(const n of t)if(n.tradeId){const a=r.get(n.tradeId);if(a){a.quantity+=1,a.credits+=n.credits;continue}const c={key:n.tradeId,tradeId:n.tradeId,quantity:1,credits:n.credits};r.set(n.tradeId,c),i.push(c)}else i.push({key:n.id,tradeId:null,quantity:1,credits:n.credits});return i}function It(t,i){return{id:t.id,contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId,counterparty:t.buyer,credits:i?ft(t.manaWei,i):null,manaWei:t.manaWei,createdAt:t.createdAt,txHash:t.txHash}}function At(t){const r=kt(t.purchases.filter(s=>s.status!=="EXPIRED")).map(s=>({kind:"purchase",id:`purchase:${s.id}`,createdAt:s.createdAt,order:s})),n=t.sales.map(s=>{const x=It(s,t.rate);return{kind:"sale",id:`sale:${x.id}`,createdAt:x.createdAt,sale:x}}),a=(t.creditOrders??[]).filter(s=>s.status!=="EXPIRED").map(s=>({kind:"credit",id:`credit:${s.id}`,createdAt:s.createdAt,order:s})),c=new Set(t.purchases.filter(s=>s.txHash).map(s=>s.txHash.toLowerCase())),u=(t.manaPurchases??[]).filter(s=>!c.has(s.txHash.toLowerCase())).map(s=>({kind:"mana-purchase",id:`mana-purchase:${s.id}`,createdAt:s.createdAt,sale:s}));return[...r,...n,...a,...u].sort((s,x)=>x.createdAt-s.createdAt||(s.id<x.id?-1:1))}function $t(t,i){return i==="all"?t:i==="sales"?t.filter(r=>r.kind==="sale"):t.filter(r=>r.kind==="purchase"||r.kind==="credit"||r.kind==="mana-purchase")}const J=t=>t.trim().toLowerCase();function Pt(t){const i=new Map;for(const r of t??[]){const n=J(r.txHash??"");if(!n)continue;const a=i.get(n);a?a.push(r):i.set(n,[r])}return i}function Nt(t,i,r=Date.now()){const n=i.txHash?t.get(J(i.txHash)):void 0;if(!n||n.length===0)return{kind:"direct"};const a=n.length===1?Lt(n[0].netCents):null,c=n.filter(s=>!s.available&&s.availableAt>r);if(c.length===0)return{kind:"credited",credits:a};const u=c.reduce((s,x)=>Math.max(s,x.availableAt),0);return{kind:"pending",credits:a,availableAt:u}}function Lt(t){return Math.floor(t/10)}const Et="https://cdn.decentraland.org/@dcl/shop/0.1.0-30279564518.commit-0ea36ab/assets/credits-product-vs4Q6u6l.svg",T=lt`
2
2
  0% { background-position: 200% 0; }
3
3
  100% { background-position: -200% 0; }
4
4
  `,Tt=l.section`
@@ -284,4 +284,4 @@ import{r as j,j as e,L as _,e as dt}from"./react-BW1xvPTF.js";import{s as l,K as
284
284
  margin: 6px 0 0;
285
285
  `,Ot=l(ht)`
286
286
  margin-top: 12px;
287
- `,q=L.withComponent(_),y=24,Rt=["all","purchases","sales"];function m(t){try{return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function tt(t){return t.length>10?`${t.slice(0,6)}…${t.slice(-4)}`:t}function et(t){const i=Number(t)/1e18;return Number.isFinite(i)?i.toLocaleString("en",{maximumFractionDigits:2}):"0"}function it({children:t}){const i=j.useRef(null),[r,n]=j.useState(null),a=()=>{var u;const c=(u=i.current)==null?void 0:u.getBoundingClientRect();c&&n({top:c.bottom+8,left:c.left+c.width/2})};return e.jsxs(Ht,{ref:i,tabIndex:0,onMouseEnter:a,onMouseLeave:()=>n(null),onFocus:a,onBlur:()=>n(null),children:[t,r?dt.createPortal(e.jsx(zt,{style:{top:r.top,left:r.left},role:"tooltip",children:d("activity.polygonMana")}),document.body):null]})}function Wt({item:t}){const{data:i,isLoading:r}=b({queryKey:["trade-display",t.tradeId],queryFn:()=>gt(t.tradeId),enabled:!!t.tradeId,staleTime:3e5}),n=!!t.tradeId&&r,a=(i==null?void 0:i.name)??d("activity.itemFallback"),c=(i==null?void 0:i.thumbnail)??"",u=E({contractAddress:i==null?void 0:i.contractAddress,tokenId:i==null?void 0:i.tokenId,itemId:i==null?void 0:i.itemId})??void 0,s=e.jsxs(e.Fragment,{children:[n?e.jsx(F,{}):e.jsx(S,{children:c?e.jsx("img",{src:c,alt:a}):e.jsx(g,{name:"cart",size:20})}),e.jsxs(M,{children:[n?e.jsx(H,{}):e.jsx(D,{title:a,children:a}),t.quantity>1?e.jsx(z,{children:d("activity.quantity",{count:t.quantity})}):null]}),e.jsxs(qt,{children:[e.jsx(v,{className:"ccy-mark"})," ",t.credits]})]});return u?e.jsx(q,{to:u,"data-link":"true",children:s}):e.jsx(L,{children:s})}function Gt({order:t}){const i=wt(t.lines),r=i.reduce((n,a)=>n+a.quantity,0);return e.jsxs(k,{"data-testid":"purchase-order",children:[e.jsxs(w,{children:[e.jsxs(I,{children:[e.jsx(A,{children:m(t.createdAt)}),e.jsxs($,{children:[d("activity.purchaseLabel")," · ",d("activity.itemCount",{count:r})]})]}),e.jsxs(P,{children:[e.jsx(N,{"data-status":t.status,children:t.status==="PENDING"?d("activity.processing"):d("activity.completed")}),e.jsxs(p,{children:[e.jsx(v,{className:"ccy-mark"})," ",t.totalCredits]})]})]}),e.jsx(C,{children:i.map(n=>e.jsx(Wt,{item:n},n.key))})]})}function Bt({sale:t}){const{data:i,isLoading:r}=b({queryKey:["asset-display",t.contractAddress,t.tokenId,t.itemId],queryFn:()=>Q(t.contractAddress,{tokenId:t.tokenId,itemId:t.itemId}),enabled:!!t.contractAddress,staleTime:3e5}),n=(i==null?void 0:i.name)??d("activity.itemFallback"),a=(i==null?void 0:i.thumbnail)??"",c=E({contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId})??void 0,u=e.jsxs(e.Fragment,{children:[r?e.jsx(F,{}):e.jsx(S,{children:a?e.jsx("img",{src:a,alt:n}):e.jsx(g,{name:"offer",size:20})}),e.jsxs(M,{children:[r?e.jsx(H,{}):e.jsx(D,{title:n,children:n}),e.jsx(z,{children:d("activity.boughtFrom",{account:tt(t.seller)})})]})]});return e.jsxs(k,{"data-testid":"activity-mana-purchase",children:[e.jsxs(w,{children:[e.jsxs(I,{children:[e.jsx(A,{children:m(t.createdAt)}),e.jsx($,{children:d("activity.paidWithMana")})]}),e.jsxs(P,{children:[e.jsx(N,{"data-status":"SETTLED",children:d("activity.completed")}),e.jsxs(p,{children:[et(t.manaWei)," ",e.jsx(it,{children:e.jsx(Z,{src:X,alt:"MANA"})})]})]})]}),e.jsx(C,{children:c?e.jsx(q,{to:c,"data-link":"true",children:u}):e.jsx(L,{children:u})})]})}function Kt({sale:t,payout:i}){const{data:r,isLoading:n}=b({queryKey:["asset-display",t.contractAddress,t.tokenId,t.itemId],queryFn:()=>Q(t.contractAddress,{tokenId:t.tokenId,itemId:t.itemId}),enabled:!!t.contractAddress,staleTime:3e5}),a=(r==null?void 0:r.name)??d("activity.itemFallback"),c=(r==null?void 0:r.thumbnail)??"",u=E({contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId})??void 0,s=e.jsxs(e.Fragment,{children:[n?e.jsx(F,{}):e.jsx(S,{children:c?e.jsx("img",{src:c,alt:a}):e.jsx(g,{name:"offer",size:20})}),e.jsxs(M,{children:[n?e.jsx(H,{}):e.jsx(D,{title:a,children:a}),e.jsxs(z,{children:[d("activity.soldTo",{account:tt(t.counterparty)}),i.kind==="pending"?` · ${d("activity.payoutPendingOn",{date:m(i.availableAt)})}`:""]})]})]});return e.jsxs(k,{"data-testid":"activity-sale",children:[e.jsxs(w,{children:[e.jsxs(I,{children:[e.jsx(A,{children:m(t.createdAt)}),e.jsx($,{children:d("activity.saleLabel")})]}),e.jsxs(P,{children:[e.jsx(N,{"data-status":i.kind==="pending"?"PENDING":"SOLD",children:i.kind==="pending"?d("activity.payoutPending"):d("activity.sold")}),i.kind==="direct"?e.jsxs(p,{"data-kind":"income",children:["+",et(t.manaWei)," ",e.jsx(it,{children:e.jsx(Z,{src:X,alt:"MANA"})})]}):i.credits!==null?e.jsxs(p,{"data-kind":"income",children:[e.jsx(v,{className:"ccy-mark"})," +",mt(i.credits)]}):e.jsx(p,{"data-kind":"income",children:d("activity.payoutCredited")})]})]}),e.jsx(C,{children:u?e.jsx(q,{to:u,"data-link":"true",children:s}):e.jsx(L,{children:s})})]})}function Ut({order:t}){const i=`$${(t.usdCents/100).toFixed(2)}`;return e.jsx(k,{"data-testid":"credit-order",children:e.jsxs(w,{children:[e.jsx(Dt,{children:e.jsx("img",{src:Et,alt:"","aria-hidden":!0})}),e.jsxs(I,{children:[e.jsx(A,{children:m(t.createdAt)}),e.jsxs($,{children:[d("activity.creditPurchaseLabel")," · ",d("activity.creditPaid",{usd:i})]})]}),e.jsxs(P,{children:[e.jsx(N,{"data-status":t.status,children:t.status==="PENDING"?d("activity.processing"):d("activity.completed")}),e.jsxs(p,{"data-kind":"income",children:["+",e.jsx(v,{className:"ccy-mark"})," ",t.credits]})]})]})})}function _t({filter:t}){const i={all:{icon:"clock",title:d("activity.emptyAllTitle"),body:d("activity.emptyAllBody")},purchases:{icon:"cart",title:d("activity.emptyPurchasesTitle"),body:d("activity.emptyPurchasesBody")},sales:{icon:"offer",title:d("activity.emptySalesTitle"),body:d("activity.emptySalesBody")}}[t];return e.jsxs(V,{children:[e.jsx(g,{name:i.icon,size:40,color:"var(--muted-2)"}),e.jsx(Y,{children:i.title}),e.jsx("p",{className:"muted",children:i.body}),t!=="sales"?e.jsx(Ot,{as:_,to:"/assets",variant:"purple",children:d("notFound.cta")}):null]})}function ae(){ut({title:d("nav.activity"),noindex:!0});const{session:t}=xt(),[i,r]=j.useState("all"),n=!!t&&i!=="sales",a=!!t&&i!=="purchases",c=f(["purchases",t==null?void 0:t.address],h=>pt(t.address,t.identity,{first:y,skip:h}),{enabled:n}),u=f(["sales",t==null?void 0:t.address],h=>G(t.address,{role:"seller",first:y,skip:h}),{enabled:a}),s=f(["credit-orders",t==null?void 0:t.address],h=>B(t.address,t.identity,{first:y,skip:h}),{enabled:n}),x=f(["mana-purchases",t==null?void 0:t.address],h=>G(t.address,{role:"buyer",first:y,skip:h}),{enabled:n}),{data:O}=b({queryKey:["sale-payouts",t==null?void 0:t.address],queryFn:()=>B(t.address,t.identity,{first:200}).then(h=>h.payouts),enabled:a,staleTime:6e4}),nt=j.useMemo(()=>Pt(O),[O]),{data:at}=yt(a);if(!t)return e.jsxs(V,{children:[e.jsx(g,{name:"clock",size:40,color:"var(--muted-2)"}),e.jsx(Y,{children:d("activity.signInTitle")}),e.jsx("p",{className:"muted",children:d("activity.signInBody")})]});const R=$t(At({purchases:n?c.items:[],sales:a?u.items:[],creditOrders:n?s.items:[],manaPurchases:n?x.items:[],rate:at}),i),st=n&&(c.isLoading||s.isLoading||x.isLoading)||a&&u.isLoading,W=n&&(c.isFetchingNextPage||s.isFetchingNextPage||x.isFetchingNextPage)||a&&u.isFetchingNextPage,rt=n&&(c.hasNextPage||s.hasNextPage||x.hasNextPage)||a&&u.hasNextPage;function ot(){n&&c.hasNextPage&&c.fetchNextPage(),n&&s.hasNextPage&&s.fetchNextPage(),n&&x.hasNextPage&&x.fetchNextPage(),a&&u.hasNextPage&&u.fetchNextPage()}return e.jsxs(Tt,{children:[e.jsx(Ct,{children:e.jsx(St,{children:d("nav.activity")})}),e.jsx(Ft,{role:"tablist","aria-label":d("nav.activity"),children:Rt.map(h=>e.jsx(Mt,{type:"button",role:"tab","aria-selected":i===h,"data-active":i===h,"data-testid":`activity-filter-${h}`,onClick:()=>r(h),children:d(`activity.filter.${h}`)},h))}),st?e.jsx(K,{children:Array.from({length:5}).map((h,ct)=>e.jsx(U,{},ct))}):R.length===0?e.jsx(_t,{filter:i}):e.jsxs(e.Fragment,{children:[e.jsxs(K,{children:[R.map(h=>h.kind==="purchase"?e.jsx(Gt,{order:h.order},h.id):h.kind==="credit"?e.jsx(Ut,{order:h.order},h.id):h.kind==="mana-purchase"?e.jsx(Bt,{sale:h.sale},h.id):e.jsx(Kt,{sale:h.sale,payout:Nt(nt,h.sale)},h.id)),W?e.jsx(U,{}):null]}),e.jsx(jt,{hasNextPage:rt,isFetching:W,onLoadMore:ot})]})]})}export{ae as Activity};
287
+ `,q=L.withComponent(_),y=24,Rt=["all","purchases","sales"];function m(t){try{return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function tt(t){return t.length>10?`${t.slice(0,6)}…${t.slice(-4)}`:t}function et(t){const i=Number(t)/1e18;return Number.isFinite(i)?i.toLocaleString("en",{maximumFractionDigits:2}):"0"}function it({children:t}){const i=b.useRef(null),[r,n]=b.useState(null),a=()=>{var u;const c=(u=i.current)==null?void 0:u.getBoundingClientRect();c&&n({top:c.bottom+8,left:c.left+c.width/2})};return e.jsxs(Ht,{ref:i,tabIndex:0,onMouseEnter:a,onMouseLeave:()=>n(null),onFocus:a,onBlur:()=>n(null),children:[t,r?dt.createPortal(e.jsx(zt,{style:{top:r.top,left:r.left},role:"tooltip",children:d("activity.polygonMana")}),document.body):null]})}function Wt({item:t}){const{data:i,isLoading:r}=j({queryKey:["trade-display",t.tradeId],queryFn:()=>gt(t.tradeId),enabled:!!t.tradeId,staleTime:3e5}),n=!!t.tradeId&&r,a=(i==null?void 0:i.name)??d("activity.itemFallback"),c=(i==null?void 0:i.thumbnail)??"",u=E({contractAddress:i==null?void 0:i.contractAddress,tokenId:i==null?void 0:i.tokenId,itemId:i==null?void 0:i.itemId})??void 0,s=e.jsxs(e.Fragment,{children:[n?e.jsx(F,{}):e.jsx(S,{children:c?e.jsx("img",{src:c,alt:a}):e.jsx(g,{name:"cart",size:20})}),e.jsxs(M,{children:[n?e.jsx(H,{}):e.jsx(D,{title:a,children:a}),t.quantity>1?e.jsx(z,{children:d("activity.quantity",{count:t.quantity})}):null]}),e.jsxs(qt,{children:[e.jsx(v,{className:"ccy-mark"})," ",t.credits]})]});return u?e.jsx(q,{to:u,"data-link":"true",children:s}):e.jsx(L,{children:s})}function Gt({order:t}){const i=wt(t.lines),r=i.reduce((n,a)=>n+a.quantity,0);return e.jsxs(k,{"data-testid":"purchase-order",children:[e.jsxs(w,{children:[e.jsxs(I,{children:[e.jsx(A,{children:m(t.createdAt)}),e.jsxs($,{children:[d("activity.purchaseLabel")," · ",d("activity.itemCount",{count:r})]})]}),e.jsxs(P,{children:[e.jsx(N,{"data-status":t.status,children:t.status==="PENDING"?d("activity.processing"):d("activity.completed")}),e.jsxs(p,{children:[e.jsx(v,{className:"ccy-mark"})," ",t.totalCredits]})]})]}),e.jsx(C,{children:i.map(n=>e.jsx(Wt,{item:n},n.key))})]})}function Bt({sale:t}){const{data:i,isLoading:r}=j({queryKey:["asset-display",t.contractAddress,t.tokenId,t.itemId],queryFn:()=>Q(t.contractAddress,{tokenId:t.tokenId,itemId:t.itemId}),enabled:!!t.contractAddress,staleTime:3e5}),n=(i==null?void 0:i.name)??d("activity.itemFallback"),a=(i==null?void 0:i.thumbnail)??"",c=E({contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId})??void 0,u=e.jsxs(e.Fragment,{children:[r?e.jsx(F,{}):e.jsx(S,{children:a?e.jsx("img",{src:a,alt:n}):e.jsx(g,{name:"offer",size:20})}),e.jsxs(M,{children:[r?e.jsx(H,{}):e.jsx(D,{title:n,children:n}),e.jsx(z,{children:d("activity.boughtFrom",{account:tt(t.seller)})})]})]});return e.jsxs(k,{"data-testid":"activity-mana-purchase",children:[e.jsxs(w,{children:[e.jsxs(I,{children:[e.jsx(A,{children:m(t.createdAt)}),e.jsx($,{children:d("activity.paidWithMana")})]}),e.jsxs(P,{children:[e.jsx(N,{"data-status":"SETTLED",children:d("activity.completed")}),e.jsxs(p,{children:[et(t.manaWei)," ",e.jsx(it,{children:e.jsx(Z,{src:X,alt:"MANA"})})]})]})]}),e.jsx(C,{children:c?e.jsx(q,{to:c,"data-link":"true",children:u}):e.jsx(L,{children:u})})]})}function Kt({sale:t,payout:i}){const{data:r,isLoading:n}=j({queryKey:["asset-display",t.contractAddress,t.tokenId,t.itemId],queryFn:()=>Q(t.contractAddress,{tokenId:t.tokenId,itemId:t.itemId}),enabled:!!t.contractAddress,staleTime:3e5}),a=(r==null?void 0:r.name)??d("activity.itemFallback"),c=(r==null?void 0:r.thumbnail)??"",u=E({contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId})??void 0,s=e.jsxs(e.Fragment,{children:[n?e.jsx(F,{}):e.jsx(S,{children:c?e.jsx("img",{src:c,alt:a}):e.jsx(g,{name:"offer",size:20})}),e.jsxs(M,{children:[n?e.jsx(H,{}):e.jsx(D,{title:a,children:a}),e.jsxs(z,{children:[d("activity.soldTo",{account:tt(t.counterparty)}),i.kind==="pending"?` · ${d("activity.payoutPendingOn",{date:m(i.availableAt)})}`:""]})]})]});return e.jsxs(k,{"data-testid":"activity-sale",children:[e.jsxs(w,{children:[e.jsxs(I,{children:[e.jsx(A,{children:m(t.createdAt)}),e.jsx($,{children:d("activity.saleLabel")})]}),e.jsxs(P,{children:[e.jsx(N,{"data-status":i.kind==="pending"?"PENDING":"SOLD",children:i.kind==="pending"?d("activity.payoutPending"):d("activity.sold")}),i.kind==="direct"?e.jsxs(p,{"data-kind":"income",children:["+",et(t.manaWei)," ",e.jsx(it,{children:e.jsx(Z,{src:X,alt:"MANA"})})]}):i.credits!==null?e.jsxs(p,{"data-kind":"income",children:[e.jsx(v,{className:"ccy-mark"})," +",mt(i.credits)]}):e.jsx(p,{"data-kind":"income",children:d("activity.payoutCredited")})]})]}),e.jsx(C,{children:u?e.jsx(q,{to:u,"data-link":"true",children:s}):e.jsx(L,{children:s})})]})}function Ut({order:t}){const i=`$${(t.usdCents/100).toFixed(2)}`;return e.jsx(k,{"data-testid":"credit-order",children:e.jsxs(w,{children:[e.jsx(Dt,{children:e.jsx("img",{src:Et,alt:"","aria-hidden":!0})}),e.jsxs(I,{children:[e.jsx(A,{children:m(t.createdAt)}),e.jsxs($,{children:[d("activity.creditPurchaseLabel")," · ",d("activity.creditPaid",{usd:i})]})]}),e.jsxs(P,{children:[e.jsx(N,{"data-status":t.status,children:t.status==="PENDING"?d("activity.processing"):d("activity.completed")}),e.jsxs(p,{"data-kind":"income",children:["+",e.jsx(v,{className:"ccy-mark"})," ",t.credits]})]})]})})}function _t({filter:t}){const i={all:{icon:"clock",title:d("activity.emptyAllTitle"),body:d("activity.emptyAllBody")},purchases:{icon:"cart",title:d("activity.emptyPurchasesTitle"),body:d("activity.emptyPurchasesBody")},sales:{icon:"offer",title:d("activity.emptySalesTitle"),body:d("activity.emptySalesBody")}}[t];return e.jsxs(V,{children:[e.jsx(g,{name:i.icon,size:40,color:"var(--muted-2)"}),e.jsx(Y,{children:i.title}),e.jsx("p",{className:"muted",children:i.body}),t!=="sales"?e.jsx(Ot,{as:_,to:"/assets",variant:"purple",children:d("notFound.cta")}):null]})}function ae(){ut({title:d("nav.activity"),noindex:!0});const{session:t}=xt(),[i,r]=b.useState("all"),n=!!t&&i!=="sales",a=!!t&&i!=="purchases",c=f(["purchases",t==null?void 0:t.address],h=>pt(t.address,t.identity,{first:y,skip:h}),{enabled:n}),u=f(["sales",t==null?void 0:t.address],h=>G(t.address,{role:"seller",first:y,skip:h}),{enabled:a}),s=f(["credit-orders",t==null?void 0:t.address],h=>B(t.address,t.identity,{first:y,skip:h}),{enabled:n}),x=f(["mana-purchases",t==null?void 0:t.address],h=>G(t.address,{role:"buyer",first:y,skip:h}),{enabled:n}),{data:O}=j({queryKey:["sale-payouts",t==null?void 0:t.address],queryFn:()=>B(t.address,t.identity,{first:200}).then(h=>h.payouts),enabled:a,staleTime:6e4}),nt=b.useMemo(()=>Pt(O),[O]),{data:at}=yt(a);if(!t)return e.jsxs(V,{children:[e.jsx(g,{name:"clock",size:40,color:"var(--muted-2)"}),e.jsx(Y,{children:d("activity.signInTitle")}),e.jsx("p",{className:"muted",children:d("activity.signInBody")})]});const R=$t(At({purchases:n?c.items:[],sales:a?u.items:[],creditOrders:n?s.items:[],manaPurchases:n?x.items:[],rate:at}),i),st=n&&(c.isLoading||s.isLoading||x.isLoading)||a&&u.isLoading,W=n&&(c.isFetchingNextPage||s.isFetchingNextPage||x.isFetchingNextPage)||a&&u.isFetchingNextPage,rt=n&&(c.hasNextPage||s.hasNextPage||x.hasNextPage)||a&&u.hasNextPage;function ot(){n&&c.hasNextPage&&c.fetchNextPage(),n&&s.hasNextPage&&s.fetchNextPage(),n&&x.hasNextPage&&x.fetchNextPage(),a&&u.hasNextPage&&u.fetchNextPage()}return e.jsxs(Tt,{children:[e.jsx(Ct,{children:e.jsx(St,{children:d("nav.activity")})}),e.jsx(Ft,{role:"tablist","aria-label":d("nav.activity"),children:Rt.map(h=>e.jsx(Mt,{type:"button",role:"tab","aria-selected":i===h,"data-active":i===h,"data-testid":`activity-filter-${h}`,onClick:()=>r(h),children:d(`activity.filter.${h}`)},h))}),st?e.jsx(K,{children:Array.from({length:5}).map((h,ct)=>e.jsx(U,{},ct))}):R.length===0?e.jsx(_t,{filter:i}):e.jsxs(e.Fragment,{children:[e.jsxs(K,{children:[R.map(h=>h.kind==="purchase"?e.jsx(Gt,{order:h.order},h.id):h.kind==="credit"?e.jsx(Ut,{order:h.order},h.id):h.kind==="mana-purchase"?e.jsx(Bt,{sale:h.sale},h.id):e.jsx(Kt,{sale:h.sale,payout:Nt(nt,h.sale)},h.id)),W?e.jsx(U,{}):null]}),e.jsx(bt,{hasNextPage:rt,isFetching:W,onLoadMore:ot})]})]})}export{ae as Activity};
@@ -1,11 +1,11 @@
1
- import{r as l,j as v}from"./react-BW1xvPTF.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-30277401547.commit-e877307/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-30277401547.commit-e877307/assets/DCL_LogoPattern-BryBPc3d.png",U=`
1
+ import{r as l,j as v}from"./react-BW1xvPTF.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-30279564518.commit-0ea36ab/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-30279564518.commit-0ea36ab/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 Le,r as f,j as e,b as et}from"./react-BW1xvPTF.js";import{m as W,h as tt,c as nt,v as st,s,K as t,u as ie,a as ot,b as Be,A as Fe,y as rt,t as o,I,C as F,d as ye,j as J,k as it,l as at,x as We,L as lt,M as te,aN as ct,aO as dt}from"./index-BFPNYe8x.js";import{r as pt,m as ft,a as He}from"./mana-rate-BpgRIQMS.js";import{u as Oe}from"./useManaRate-CGtpZZBQ.js";import{g as ht,h as xt,i as ut,j as mt,k as gt,C as bt,l as yt,o as wt,m as jt,n as vt,M as Ct,E as $t,p as kt,q as St,r as Et,s as It,t as Tt,u as _t}from"./Assets.styles-BZMkOQeI.js";import{d as we,R as Rt,F as zt,S as je,b as At}from"./categories-BwvbYi6M.js";import{L as Nt}from"./LoadMore-C2uaqP2N.js";import{M as Mt}from"./MarketCheckout-CW6mGgHt.js";import{u as Pt}from"./useInfiniteGrid-BBNOO0mR.js";import{E as Lt}from"./ErrorNotice-BG40E5Ff.js";import{d as Bt}from"./dcl-schemas-BICTSpB5.js";import{u as Ft,G as Wt,w as Ht,S as Ot}from"./buy-gasless-oF_YJX_W.js";import{s as Ut}from"./buy-84sizoxr.js";import{i as Dt}from"./trade-encoding-DcECym8l.js";import{f as Gt}from"./errors-D-hio89k.js";import{J as qt,C as Vt,B as re}from"./ethers-CtVvB8eG.js";import{l as Kt}from"./loader-logo-BzY9EKdC.js";import{n as Zt}from"./emotion-CSxEP8yM.js";import"./sentry-BV_ZSgtd.js";import"./intl-CBcMB1D2.js";import"./Tooltip-V9fXstBY.js";import"./authorizations-t9AL68YM.js";import"./sendMetaTransaction-DNedK3Cr.js";function ne(n){const r=n.source??"item",l=n.tradeId||`${n.contractAddress}-${n.tokenId??n.itemId??""}`;return`${r}:${l}`}const H="100000000000000000000",Ue=2,X=15,Qt=/^[a-zA-Z0-9]+$/;function ve(n){const r=n.trim();return r.length===0?{ok:!1,reason:"empty"}:Qt.test(r)?r.length<Ue?{ok:!1,reason:"too-short"}:r.length>X?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Jt(n){return n.replace(/[^a-zA-Z0-9]/g,"").slice(0,X)}const Xt=["function available(string _subdomain) view returns (bool)"],Ce={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Yt(){return W.chainId===Bt.ChainId.MATIC_MAINNET?Ce.mainnet:Ce.sepolia}async function en(n,r={}){var a;const{rpc:l,address:h}=Yt(),u=new qt(l),c=new Vt(h,Xt,u);console.info(`[names] availability check → DCLRegistrar(${h}).available("${n}") on ${l}`);const x=await c.available(n);if((a=r.signal)!=null&&a.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${n}" available=${x}`),x?"available":"taken"}const tn="https://app.across.to/api";class De extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function nn(n){return ft(H,n)}async function sn(n,r,l={}){var a;const h=l.chainId??W.chainId,u=l.provider??"across",c=`${W.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(r)}&chainId=${h}&provider=${u}`,x=await st(c,{method:"GET",identity:n,metadata:{}});if(!x.ok){let d;try{d=(a=await x.json())==null?void 0:a.code}catch{}throw d==="ROUTE_COST_TOO_HIGH"?new De:new Error(`fetchNameCreditRoute ${x.status}`)}return x.json()}function on(n,r){const l=re.from(n.availableAmount),u=re.from(H).sub(l);return{credits:[{value:n.amount,expiresAt:Number(n.expiresAt),salt:Dt(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:u.isNegative()?"0":u.toString(),maxCreditedValue:H}}async function rn(n,r={}){const l=tn,h=r.intervalMs??1e4,u=r.maxAttempts??60;let c={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let x=0;x<u;x++){try{const a=await fetch(`${l}/deposit/status?originChainId=137&depositTxHash=${n}`);if(a.ok){const d=await a.json(),p=(d.status??"pending").toLowerCase(),w=d.fillTx??d.fillTxnRef??null,m=d.actionsSucceeded!==!1;if(p==="filled")return{status:"filled",destinationTxHash:w,actionsSucceeded:m};if(p==="refunded"||p==="expired")return{status:p,destinationTxHash:null,actionsSucceeded:!1};c={status:"pending",destinationTxHash:w,actionsSucceeded:m}}}catch{}x<u-1&&await new Promise(a=>setTimeout(a,h))}return c}async function an(n){const{name:r,identity:l,signer:h}=n,u=n.chainId??W.chainId,c=n.provider??"across",x=(n.beneficiary??await h.getAddress()).toLowerCase();let a=null,d=!1;console.info("[names] register start",{name:r,buyer:x,chainId:u,provider:c});try{const p=await pt(u),w=nn(p);console.info("[names] step 1/6 sized reservation",{usdCents:w,manaRate:p});const m=await sn(l,r,{chainId:u,provider:c});console.info("[names] step 2/6 route fetched",{target:m.externalCall.target,selector:m.externalCall.selector,provider:m.provider,quoteId:m.quoteId});const C=await tt(l,w);if(a=C.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:C.credit.id,maxCreditedValue:C.maxCreditedValue}),re.from(C.maxCreditedValue).lt(H))throw new Error("Credit under-sized for the name price");const $=on(C.credit,m);let b;try{b=await Ft({chainId:u,buyer:x,signer:h,args:$})}catch(y){if(!(y instanceof Wt))throw y;b=await Ut(u,$,h)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:b}),await Ht(b),d=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:b}),c==="across"){const y=await rn(b,n.acrossPoll);if(console.info("[names] step 6/6 across status",y),y.status==="pending")return{status:"pending",originTxHash:b};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:b,destinationTxHash:y.destinationTxHash}}return{status:"pending",originTxHash:b}}catch(p){if(console.error("[names] register failed — raw error:",p,{name:r,buyer:x,originConfirmed:d}),p instanceof Ot)return{status:"pending",originTxHash:p.txHash};throw a&&!d&&await nt(l,[a]).catch(()=>{}),p instanceof De?p:new Error(Gt(p,"Couldn't register the name. Please try again.",{sale:!0}))}}const ln=s.div`
1
+ import{u as Le,r as f,j as e,b as et}from"./react-BW1xvPTF.js";import{m as W,h as tt,c as nt,v as st,s,K as t,u as ie,a as ot,b as Be,A as Fe,y as rt,t as o,I,C as F,d as ye,j as J,k as it,l as at,x as We,L as lt,M as te,aN as ct,aO as dt}from"./index-CEUqEDHj.js";import{r as pt,m as ft,a as He}from"./mana-rate-D7GRB_Ot.js";import{u as Oe}from"./useManaRate-WxBKKUcB.js";import{g as ht,h as xt,i as ut,j as mt,k as gt,C as bt,l as yt,o as wt,m as jt,n as vt,M as Ct,E as $t,p as kt,q as St,r as Et,s as It,t as Tt,u as _t}from"./Assets.styles-DKu0M-fo.js";import{d as we,R as Rt,F as zt,S as je,b as At}from"./categories-CQDU6eKt.js";import{L as Nt}from"./LoadMore-Cv8ieNqf.js";import{M as Mt}from"./MarketCheckout-B7kj-ofT.js";import{u as Pt}from"./useInfiniteGrid-CiDuQRnP.js";import{E as Lt}from"./ErrorNotice-BG40E5Ff.js";import{d as Bt}from"./dcl-schemas-BICTSpB5.js";import{u as Ft,G as Wt,w as Ht,S as Ot}from"./buy-gasless-kzWGfidX.js";import{s as Ut}from"./buy-C8thJCOQ.js";import{i as Dt}from"./trade-encoding-rbwEO5I2.js";import{f as Gt}from"./errors-CGr_h4qk.js";import{J as qt,C as Vt,B as re}from"./ethers-CtVvB8eG.js";import{l as Kt}from"./loader-logo-BzY9EKdC.js";import{n as Zt}from"./emotion-CSxEP8yM.js";import"./sentry-BV_ZSgtd.js";import"./intl-CBcMB1D2.js";import"./Tooltip-DSEH6tal.js";import"./authorizations-Bt-yiKpU.js";import"./sendMetaTransaction-DnNlMy1f.js";function ne(n){const r=n.source??"item",l=n.tradeId||`${n.contractAddress}-${n.tokenId??n.itemId??""}`;return`${r}:${l}`}const H="100000000000000000000",Ue=2,X=15,Qt=/^[a-zA-Z0-9]+$/;function ve(n){const r=n.trim();return r.length===0?{ok:!1,reason:"empty"}:Qt.test(r)?r.length<Ue?{ok:!1,reason:"too-short"}:r.length>X?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Jt(n){return n.replace(/[^a-zA-Z0-9]/g,"").slice(0,X)}const Xt=["function available(string _subdomain) view returns (bool)"],Ce={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Yt(){return W.chainId===Bt.ChainId.MATIC_MAINNET?Ce.mainnet:Ce.sepolia}async function en(n,r={}){var a;const{rpc:l,address:h}=Yt(),u=new qt(l),c=new Vt(h,Xt,u);console.info(`[names] availability check → DCLRegistrar(${h}).available("${n}") on ${l}`);const x=await c.available(n);if((a=r.signal)!=null&&a.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${n}" available=${x}`),x?"available":"taken"}const tn="https://app.across.to/api";class De extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function nn(n){return ft(H,n)}async function sn(n,r,l={}){var a;const h=l.chainId??W.chainId,u=l.provider??"across",c=`${W.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(r)}&chainId=${h}&provider=${u}`,x=await st(c,{method:"GET",identity:n,metadata:{}});if(!x.ok){let d;try{d=(a=await x.json())==null?void 0:a.code}catch{}throw d==="ROUTE_COST_TOO_HIGH"?new De:new Error(`fetchNameCreditRoute ${x.status}`)}return x.json()}function on(n,r){const l=re.from(n.availableAmount),u=re.from(H).sub(l);return{credits:[{value:n.amount,expiresAt:Number(n.expiresAt),salt:Dt(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:u.isNegative()?"0":u.toString(),maxCreditedValue:H}}async function rn(n,r={}){const l=tn,h=r.intervalMs??1e4,u=r.maxAttempts??60;let c={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let x=0;x<u;x++){try{const a=await fetch(`${l}/deposit/status?originChainId=137&depositTxHash=${n}`);if(a.ok){const d=await a.json(),p=(d.status??"pending").toLowerCase(),w=d.fillTx??d.fillTxnRef??null,m=d.actionsSucceeded!==!1;if(p==="filled")return{status:"filled",destinationTxHash:w,actionsSucceeded:m};if(p==="refunded"||p==="expired")return{status:p,destinationTxHash:null,actionsSucceeded:!1};c={status:"pending",destinationTxHash:w,actionsSucceeded:m}}}catch{}x<u-1&&await new Promise(a=>setTimeout(a,h))}return c}async function an(n){const{name:r,identity:l,signer:h}=n,u=n.chainId??W.chainId,c=n.provider??"across",x=(n.beneficiary??await h.getAddress()).toLowerCase();let a=null,d=!1;console.info("[names] register start",{name:r,buyer:x,chainId:u,provider:c});try{const p=await pt(u),w=nn(p);console.info("[names] step 1/6 sized reservation",{usdCents:w,manaRate:p});const m=await sn(l,r,{chainId:u,provider:c});console.info("[names] step 2/6 route fetched",{target:m.externalCall.target,selector:m.externalCall.selector,provider:m.provider,quoteId:m.quoteId});const C=await tt(l,w);if(a=C.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:C.credit.id,maxCreditedValue:C.maxCreditedValue}),re.from(C.maxCreditedValue).lt(H))throw new Error("Credit under-sized for the name price");const $=on(C.credit,m);let b;try{b=await Ft({chainId:u,buyer:x,signer:h,args:$})}catch(y){if(!(y instanceof Wt))throw y;b=await Ut(u,$,h)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:b}),await Ht(b),d=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:b}),c==="across"){const y=await rn(b,n.acrossPoll);if(console.info("[names] step 6/6 across status",y),y.status==="pending")return{status:"pending",originTxHash:b};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:b,destinationTxHash:y.destinationTxHash}}return{status:"pending",originTxHash:b}}catch(p){if(console.error("[names] register failed — raw error:",p,{name:r,buyer:x,originConfirmed:d}),p instanceof Ot)return{status:"pending",originTxHash:p.txHash};throw a&&!d&&await nt(l,[a]).catch(()=>{}),p instanceof De?p:new Error(Gt(p,"Couldn't register the name. Please try again.",{sale:!0}))}}const ln=s.div`
2
2
  position: fixed;
3
3
  inset: 0;
4
4
  z-index: 10000;
@@ -366,7 +366,7 @@ import{u as Le,r as f,j as e,b as et}from"./react-BW1xvPTF.js";import{m as W,h a
366
366
  flex: none;
367
367
  color: ${t.colors.dclRed};
368
368
  }
369
- `;function _n({name:n,priceCredits:r,onClose:l}){const{session:h}=ie(),{data:u,isError:c}=ot(h),x=Be(),a=Le(),[d,p]=f.useState("confirm"),[w,m]=f.useState(""),[C,$]=f.useState(null),b=f.useRef(!1),y=w.trim().toLowerCase()===n.toLowerCase(),S=d==="completing",j=r!=null?Fe(r):"—";f.useEffect(()=>{const g=R=>{R.key==="Escape"&&!S&&l()};document.addEventListener("keydown",g);const Y=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",g),document.body.style.overflow=Y}},[S,l]);async function E(){if(!(!h||!y||b.current)){b.current=!0,p("completing"),$(null);try{await an({name:n,identity:h.identity,signer:h.signer}),J("Shop Completed Purchase",{purchase_type:"name",is_primary:!0,payment_type:"credits",value_credits:r??null}),x.invalidateQueries({queryKey:["usd-balance"]}),x.invalidateQueries({queryKey:["my-assets"]}),p("success")}catch(g){J(at(g)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:it(g),purchase_type:"name"}),$((g==null?void 0:g.message)||o("names.errorGeneric")),p("error")}finally{b.current=!1}}}const k=d!=="success",T=rt(h==null?void 0:h.providerType);return e.jsx(ln,{onClick:S?void 0:l,role:"presentation",children:e.jsxs(cn,{role:"dialog","aria-modal":"true","aria-label":o("names.buyTitle"),onClick:g=>g.stopPropagation(),children:[k&&e.jsxs(e.Fragment,{children:[e.jsxs($e,{children:[e.jsx(ke,{children:d==="error"?o("names.errorTitle"):o("names.buyTitle")}),e.jsx(Se,{onClick:l,disabled:S,"aria-label":o("buyModal.close"),children:e.jsx(I,{name:"close"})})]}),e.jsxs(Ee,{children:[o("names.myCreditsBalance")," ",e.jsx(F,{})," ",ye(u,c)]}),e.jsx(Ie,{})]}),(d==="confirm"||d==="error")&&e.jsxs(e.Fragment,{children:[e.jsxs(Te,{children:[e.jsx(_e,{"aria-hidden":!0,children:"@"}),e.jsxs(Re,{children:[e.jsxs(ze,{children:[n,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ae,{children:o("names.subtitle")})]}),e.jsxs(Ne,{children:[e.jsx(F,{}),j]})]}),d==="error"?e.jsxs(e.Fragment,{children:[e.jsxs(Tn,{children:[e.jsx(I,{name:"info","aria-hidden":!0}),e.jsx("span",{children:C})]}),e.jsx(Me,{onClick:()=>p("confirm"),children:o("names.tryAgain")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(dn,{children:[e.jsx(pn,{children:o("names.confirmTitle")}),e.jsx(fn,{dangerouslySetInnerHTML:{__html:o("names.confirmBody",{name:`<b>@${Rn(n)}</b>`})}}),e.jsxs(hn,{children:[e.jsx(xn,{"aria-hidden":!0,children:"@"}),e.jsx(un,{value:w,onChange:g=>m(g.target.value.replace(/[^a-zA-Z0-9]/g,"")),placeholder:"yourname","aria-label":o("names.reenterAria"),autoComplete:"off",spellCheck:!1,style:{width:`${Math.max(w.length,8)}ch`}}),e.jsx(mn,{children:".dcl.eth"})]})]}),e.jsx(Me,{onClick:()=>void E(),disabled:!y||!h,children:o("names.buyCta")})]})]}),d==="completing"&&e.jsxs(gn,{children:[e.jsx(bn,{src:Kt,alt:"",width:56,height:56}),e.jsx(yn,{children:T?o("names.confirming"):o("names.completing")}),e.jsxs(wn,{children:[e.jsx(jn,{"aria-hidden":!0,children:e.jsx("span",{})}),e.jsx(vn,{children:"1/1"})]})]}),d==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs($e,{children:[e.jsx(ke,{children:o("names.successHeaderTitle")}),e.jsx(Se,{onClick:l,"aria-label":o("buyModal.close"),children:e.jsx(I,{name:"close"})})]}),e.jsxs(Ee,{children:[o("names.myCreditsBalance")," ",e.jsx(F,{})," ",ye(u,c)]}),e.jsx(Ie,{}),e.jsxs(Cn,{children:[e.jsx($n,{"aria-hidden":!0,children:e.jsx(I,{name:"check"})}),e.jsxs(kn,{children:[e.jsx("b",{children:o("names.successBannerBold")})," ",o("names.successBannerRest")]})]}),e.jsxs(Te,{style:{marginTop:20},children:[e.jsx(_e,{"aria-hidden":!0,children:"@"}),e.jsxs(Re,{children:[e.jsxs(ze,{children:[n,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ae,{children:o("names.subtitle")})]}),e.jsxs(Ne,{children:[e.jsx(F,{}),j]})]}),e.jsxs(Sn,{children:[e.jsx(En,{onClick:()=>{l(),a("/my-assets")},children:o("names.myItems")}),e.jsx(In,{href:W.profileUrl,target:"_blank",rel:"noopener noreferrer",children:o("names.assignToAvatar")})]})]})]})})}function Rn(n){return n.replace(/[&<>"']/g,r=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[r])}const zn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30277401547.commit-e877307/assets/identity-B4DXDuJP.webp",An="https://cdn.decentraland.org/@dcl/shop/0.1.0-30277401547.commit-e877307/assets/world-B-9aPlxu.webp",Nn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30277401547.commit-e877307/assets/invite-BfwIhP2C.webp",Mn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30277401547.commit-e877307/assets/governance-DnazlIjy.webp",Pn=s.div`
369
+ `;function _n({name:n,priceCredits:r,onClose:l}){const{session:h}=ie(),{data:u,isError:c}=ot(h),x=Be(),a=Le(),[d,p]=f.useState("confirm"),[w,m]=f.useState(""),[C,$]=f.useState(null),b=f.useRef(!1),y=w.trim().toLowerCase()===n.toLowerCase(),S=d==="completing",j=r!=null?Fe(r):"—";f.useEffect(()=>{const g=R=>{R.key==="Escape"&&!S&&l()};document.addEventListener("keydown",g);const Y=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",g),document.body.style.overflow=Y}},[S,l]);async function E(){if(!(!h||!y||b.current)){b.current=!0,p("completing"),$(null);try{await an({name:n,identity:h.identity,signer:h.signer}),J("Shop Completed Purchase",{purchase_type:"name",is_primary:!0,payment_type:"credits",value_credits:r??null}),x.invalidateQueries({queryKey:["usd-balance"]}),x.invalidateQueries({queryKey:["my-assets"]}),p("success")}catch(g){J(at(g)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:it(g),purchase_type:"name"}),$((g==null?void 0:g.message)||o("names.errorGeneric")),p("error")}finally{b.current=!1}}}const k=d!=="success",T=rt(h==null?void 0:h.providerType);return e.jsx(ln,{onClick:S?void 0:l,role:"presentation",children:e.jsxs(cn,{role:"dialog","aria-modal":"true","aria-label":o("names.buyTitle"),onClick:g=>g.stopPropagation(),children:[k&&e.jsxs(e.Fragment,{children:[e.jsxs($e,{children:[e.jsx(ke,{children:d==="error"?o("names.errorTitle"):o("names.buyTitle")}),e.jsx(Se,{onClick:l,disabled:S,"aria-label":o("buyModal.close"),children:e.jsx(I,{name:"close"})})]}),e.jsxs(Ee,{children:[o("names.myCreditsBalance")," ",e.jsx(F,{})," ",ye(u,c)]}),e.jsx(Ie,{})]}),(d==="confirm"||d==="error")&&e.jsxs(e.Fragment,{children:[e.jsxs(Te,{children:[e.jsx(_e,{"aria-hidden":!0,children:"@"}),e.jsxs(Re,{children:[e.jsxs(ze,{children:[n,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ae,{children:o("names.subtitle")})]}),e.jsxs(Ne,{children:[e.jsx(F,{}),j]})]}),d==="error"?e.jsxs(e.Fragment,{children:[e.jsxs(Tn,{children:[e.jsx(I,{name:"info","aria-hidden":!0}),e.jsx("span",{children:C})]}),e.jsx(Me,{onClick:()=>p("confirm"),children:o("names.tryAgain")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(dn,{children:[e.jsx(pn,{children:o("names.confirmTitle")}),e.jsx(fn,{dangerouslySetInnerHTML:{__html:o("names.confirmBody",{name:`<b>@${Rn(n)}</b>`})}}),e.jsxs(hn,{children:[e.jsx(xn,{"aria-hidden":!0,children:"@"}),e.jsx(un,{value:w,onChange:g=>m(g.target.value.replace(/[^a-zA-Z0-9]/g,"")),placeholder:"yourname","aria-label":o("names.reenterAria"),autoComplete:"off",spellCheck:!1,style:{width:`${Math.max(w.length,8)}ch`}}),e.jsx(mn,{children:".dcl.eth"})]})]}),e.jsx(Me,{onClick:()=>void E(),disabled:!y||!h,children:o("names.buyCta")})]})]}),d==="completing"&&e.jsxs(gn,{children:[e.jsx(bn,{src:Kt,alt:"",width:56,height:56}),e.jsx(yn,{children:T?o("names.confirming"):o("names.completing")}),e.jsxs(wn,{children:[e.jsx(jn,{"aria-hidden":!0,children:e.jsx("span",{})}),e.jsx(vn,{children:"1/1"})]})]}),d==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs($e,{children:[e.jsx(ke,{children:o("names.successHeaderTitle")}),e.jsx(Se,{onClick:l,"aria-label":o("buyModal.close"),children:e.jsx(I,{name:"close"})})]}),e.jsxs(Ee,{children:[o("names.myCreditsBalance")," ",e.jsx(F,{})," ",ye(u,c)]}),e.jsx(Ie,{}),e.jsxs(Cn,{children:[e.jsx($n,{"aria-hidden":!0,children:e.jsx(I,{name:"check"})}),e.jsxs(kn,{children:[e.jsx("b",{children:o("names.successBannerBold")})," ",o("names.successBannerRest")]})]}),e.jsxs(Te,{style:{marginTop:20},children:[e.jsx(_e,{"aria-hidden":!0,children:"@"}),e.jsxs(Re,{children:[e.jsxs(ze,{children:[n,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ae,{children:o("names.subtitle")})]}),e.jsxs(Ne,{children:[e.jsx(F,{}),j]})]}),e.jsxs(Sn,{children:[e.jsx(En,{onClick:()=>{l(),a("/my-assets")},children:o("names.myItems")}),e.jsx(In,{href:W.profileUrl,target:"_blank",rel:"noopener noreferrer",children:o("names.assignToAvatar")})]})]})]})})}function Rn(n){return n.replace(/[&<>"']/g,r=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[r])}const zn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30279564518.commit-0ea36ab/assets/identity-B4DXDuJP.webp",An="https://cdn.decentraland.org/@dcl/shop/0.1.0-30279564518.commit-0ea36ab/assets/world-B-9aPlxu.webp",Nn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30279564518.commit-0ea36ab/assets/invite-BfwIhP2C.webp",Mn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30279564518.commit-0ea36ab/assets/governance-DnazlIjy.webp",Pn=s.div`
370
370
  width: 100%;
371
371
  min-width: 0;
372
372
  `,Ln=s.nav`
@@ -1,4 +1,4 @@
1
- import{r as $,j as t}from"./react-BW1xvPTF.js";import{R as C,a as oe,C as ie,c as ne}from"./categories-BwvbYi6M.js";import{T as se}from"./Tooltip-V9fXstBY.js";import{K as e,s as o,I as m,t as s,L as re,e as v}from"./index-BFPNYe8x.js";import{n as c}from"./emotion-CSxEP8yM.js";const ae=o.div`
1
+ import{r as $,j as t}from"./react-BW1xvPTF.js";import{R as C,a as oe,C as ie,c as ne}from"./categories-CQDU6eKt.js";import{T as se}from"./Tooltip-DSEH6tal.js";import{K as e,s as o,I as m,t as s,L as re,e as v}from"./index-CEUqEDHj.js";import{n as c}from"./emotion-CSxEP8yM.js";const ae=o.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 12px;
@@ -1,4 +1,4 @@
1
- import{j as t,L as q,r as D}from"./react-BW1xvPTF.js";import{s as a,B as M,K as o,R as I,x as B,t as e,u as F,y as K,I as f,C as G,S as P,n as w,b as Q,m as H,U as k,J as O,N as $}from"./index-BFPNYe8x.js";import{b as W,c as _,d as J,f as U,s as X,h as V}from"./authorizations-t9AL68YM.js";import{a as Y}from"./builder-uUlDA8Em.js";import{f as Z}from"./errors-D-hio89k.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-DNedK3Cr.js";const tt=I`
1
+ import{j as t,L as q,r as D}from"./react-BW1xvPTF.js";import{s as a,B as M,K as o,R as I,x as B,t as e,u as F,y as K,I as f,C as G,S as P,n as w,b as Q,m as H,U as k,J as O,N as $}from"./index-CEUqEDHj.js";import{b as W,c as _,d as J,f as U,s as X,h as V}from"./authorizations-Bt-yiKpU.js";import{a as Y}from"./builder-ChMzGlEf.js";import{f as Z}from"./errors-CGr_h4qk.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-DnNlMy1f.js";const tt=I`
2
2
  to { transform: rotate(360deg); }
3
3
  `,it=I`
4
4
  to { background-position: -200% 0; }
@@ -1,4 +1,4 @@
1
- import{bb as Xe,bc as Ye,F as Ge,bd as qe,Y as G,Z as b,$ as z,W as ee,X as se,be as Ze,a2 as H,R as le,V as Ce,bf as be,bg as we,bh as w,a1 as Re,bi as Je,T as Qe,aT as eo,E as oo,a0 as B,bj as to,bk as J}from"./index-BFPNYe8x.js";import{r as l,j as T,R as Y}from"./react-BW1xvPTF.js";function Me(e){var o,t,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(o=0;o<n;o++)e[o]&&(t=Me(e[o]))&&(i&&(i+=" "),i+=t)}else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function no(){for(var e,o,t=0,i="",n=arguments.length;t<n;t++)(e=arguments[t])&&(o=Me(e))&&(i&&(i+=" "),i+=o);return i}const io=["className","component"];function ao(e={}){const{themeId:o,defaultTheme:t,defaultClassName:i="MuiBox-root",generateClassName:n}=e,a=Xe("div",{shouldForwardProp:u=>u!=="theme"&&u!=="sx"&&u!=="as"})(Ye);return l.forwardRef(function(c,p){const f=Ge(t),g=qe(c),{className:m,component:v="div"}=g,h=G(g,io);return T.jsx(a,b({as:v,ref:p,className:no(m,n?n(i):i),theme:o&&f[o]||f},h))})}function ae(e,o){return ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},ae(e,o)}function ro(e,o){e.prototype=Object.create(o.prototype),e.prototype.constructor=e,ae(e,o)}const ge=Y.createContext(null);function so(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ce(e,o){var t=function(a){return o&&l.isValidElement(a)?o(a):a},i=Object.create(null);return e&&l.Children.map(e,function(n){return n}).forEach(function(n){i[n.key]=t(n)}),i}function lo(e,o){e=e||{},o=o||{};function t(f){return f in o?o[f]:e[f]}var i=Object.create(null),n=[];for(var a in e)a in o?n.length&&(i[a]=n,n=[]):n.push(a);var r,u={};for(var c in o){if(i[c])for(r=0;r<i[c].length;r++){var p=i[c][r];u[i[c][r]]=t(p)}u[c]=t(c)}for(r=0;r<n.length;r++)u[n[r]]=t(n[r]);return u}function A(e,o,t){return t[o]!=null?t[o]:e.props[o]}function co(e,o){return ce(e.children,function(t){return l.cloneElement(t,{onExited:o.bind(null,t),in:!0,appear:A(t,"appear",e),enter:A(t,"enter",e),exit:A(t,"exit",e)})})}function uo(e,o,t){var i=ce(e.children),n=lo(o,i);return Object.keys(n).forEach(function(a){var r=n[a];if(l.isValidElement(r)){var u=a in o,c=a in i,p=o[a],f=l.isValidElement(p)&&!p.props.in;c&&(!u||f)?n[a]=l.cloneElement(r,{onExited:t.bind(null,r),in:!0,exit:A(r,"exit",e),enter:A(r,"enter",e)}):!c&&u&&!f?n[a]=l.cloneElement(r,{in:!1}):c&&u&&l.isValidElement(p)&&(n[a]=l.cloneElement(r,{onExited:t.bind(null,r),in:p.props.in,exit:A(r,"exit",e),enter:A(r,"enter",e)}))}}),n}var po=Object.values||function(e){return Object.keys(e).map(function(o){return e[o]})},fo={component:"div",childFactory:function(o){return o}},ue=(function(e){ro(o,e);function o(i,n){var a;a=e.call(this,i,n)||this;var r=a.handleExited.bind(so(a));return a.state={contextValue:{isMounting:!0},handleExited:r,firstRender:!0},a}var t=o.prototype;return t.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},t.componentWillUnmount=function(){this.mounted=!1},o.getDerivedStateFromProps=function(n,a){var r=a.children,u=a.handleExited,c=a.firstRender;return{children:c?co(n,u):uo(n,r,u),firstRender:!1}},t.handleExited=function(n,a){var r=ce(this.props.children);n.key in r||(n.props.onExited&&n.props.onExited(a),this.mounted&&this.setState(function(u){var c=b({},u.children);return delete c[n.key],{children:c}}))},t.render=function(){var n=this.props,a=n.component,r=n.childFactory,u=G(n,["component","childFactory"]),c=this.state.contextValue,p=po(this.state.children).map(r);return delete u.appear,delete u.enter,delete u.exit,a===null?Y.createElement(ge.Provider,{value:c},p):Y.createElement(ge.Provider,{value:c},Y.createElement(a,u,p))},o})(Y.Component);ue.propTypes={};ue.defaultProps=fo;function ho(e){const{className:o,classes:t,pulsate:i=!1,rippleX:n,rippleY:a,rippleSize:r,in:u,onExited:c,timeout:p}=e,[f,g]=l.useState(!1),m=z(o,t.ripple,t.rippleVisible,i&&t.ripplePulsate),v={width:r,height:r,top:-(r/2)+a,left:-(r/2)+n},h=z(t.child,f&&t.childLeaving,i&&t.childPulsate);return!u&&!f&&g(!0),l.useEffect(()=>{if(!u&&c!=null){const C=setTimeout(c,p);return()=>{clearTimeout(C)}}},[c,u,p]),T.jsx("span",{className:m,style:v,children:T.jsx("span",{className:h})})}const E=ee("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),bo=["center","classes","className"];let oe=e=>e,me,xe,ve,ye;const re=550,go=80,mo=le(me||(me=oe`
1
+ import{bb as Xe,bc as Ye,F as Ge,bd as qe,Y as G,Z as b,$ as z,W as ee,X as se,be as Ze,a2 as H,R as le,V as Ce,bf as be,bg as we,bh as w,a1 as Re,bi as Je,T as Qe,aT as eo,E as oo,a0 as B,bj as to,bk as J}from"./index-CEUqEDHj.js";import{r as l,j as T,R as Y}from"./react-BW1xvPTF.js";function Me(e){var o,t,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var n=e.length;for(o=0;o<n;o++)e[o]&&(t=Me(e[o]))&&(i&&(i+=" "),i+=t)}else for(t in e)e[t]&&(i&&(i+=" "),i+=t);return i}function no(){for(var e,o,t=0,i="",n=arguments.length;t<n;t++)(e=arguments[t])&&(o=Me(e))&&(i&&(i+=" "),i+=o);return i}const io=["className","component"];function ao(e={}){const{themeId:o,defaultTheme:t,defaultClassName:i="MuiBox-root",generateClassName:n}=e,a=Xe("div",{shouldForwardProp:u=>u!=="theme"&&u!=="sx"&&u!=="as"})(Ye);return l.forwardRef(function(c,p){const f=Ge(t),g=qe(c),{className:m,component:v="div"}=g,h=G(g,io);return T.jsx(a,b({as:v,ref:p,className:no(m,n?n(i):i),theme:o&&f[o]||f},h))})}function ae(e,o){return ae=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,i){return t.__proto__=i,t},ae(e,o)}function ro(e,o){e.prototype=Object.create(o.prototype),e.prototype.constructor=e,ae(e,o)}const ge=Y.createContext(null);function so(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function ce(e,o){var t=function(a){return o&&l.isValidElement(a)?o(a):a},i=Object.create(null);return e&&l.Children.map(e,function(n){return n}).forEach(function(n){i[n.key]=t(n)}),i}function lo(e,o){e=e||{},o=o||{};function t(f){return f in o?o[f]:e[f]}var i=Object.create(null),n=[];for(var a in e)a in o?n.length&&(i[a]=n,n=[]):n.push(a);var r,u={};for(var c in o){if(i[c])for(r=0;r<i[c].length;r++){var p=i[c][r];u[i[c][r]]=t(p)}u[c]=t(c)}for(r=0;r<n.length;r++)u[n[r]]=t(n[r]);return u}function A(e,o,t){return t[o]!=null?t[o]:e.props[o]}function co(e,o){return ce(e.children,function(t){return l.cloneElement(t,{onExited:o.bind(null,t),in:!0,appear:A(t,"appear",e),enter:A(t,"enter",e),exit:A(t,"exit",e)})})}function uo(e,o,t){var i=ce(e.children),n=lo(o,i);return Object.keys(n).forEach(function(a){var r=n[a];if(l.isValidElement(r)){var u=a in o,c=a in i,p=o[a],f=l.isValidElement(p)&&!p.props.in;c&&(!u||f)?n[a]=l.cloneElement(r,{onExited:t.bind(null,r),in:!0,exit:A(r,"exit",e),enter:A(r,"enter",e)}):!c&&u&&!f?n[a]=l.cloneElement(r,{in:!1}):c&&u&&l.isValidElement(p)&&(n[a]=l.cloneElement(r,{onExited:t.bind(null,r),in:p.props.in,exit:A(r,"exit",e),enter:A(r,"enter",e)}))}}),n}var po=Object.values||function(e){return Object.keys(e).map(function(o){return e[o]})},fo={component:"div",childFactory:function(o){return o}},ue=(function(e){ro(o,e);function o(i,n){var a;a=e.call(this,i,n)||this;var r=a.handleExited.bind(so(a));return a.state={contextValue:{isMounting:!0},handleExited:r,firstRender:!0},a}var t=o.prototype;return t.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},t.componentWillUnmount=function(){this.mounted=!1},o.getDerivedStateFromProps=function(n,a){var r=a.children,u=a.handleExited,c=a.firstRender;return{children:c?co(n,u):uo(n,r,u),firstRender:!1}},t.handleExited=function(n,a){var r=ce(this.props.children);n.key in r||(n.props.onExited&&n.props.onExited(a),this.mounted&&this.setState(function(u){var c=b({},u.children);return delete c[n.key],{children:c}}))},t.render=function(){var n=this.props,a=n.component,r=n.childFactory,u=G(n,["component","childFactory"]),c=this.state.contextValue,p=po(this.state.children).map(r);return delete u.appear,delete u.enter,delete u.exit,a===null?Y.createElement(ge.Provider,{value:c},p):Y.createElement(ge.Provider,{value:c},Y.createElement(a,u,p))},o})(Y.Component);ue.propTypes={};ue.defaultProps=fo;function ho(e){const{className:o,classes:t,pulsate:i=!1,rippleX:n,rippleY:a,rippleSize:r,in:u,onExited:c,timeout:p}=e,[f,g]=l.useState(!1),m=z(o,t.ripple,t.rippleVisible,i&&t.ripplePulsate),v={width:r,height:r,top:-(r/2)+a,left:-(r/2)+n},h=z(t.child,f&&t.childLeaving,i&&t.childPulsate);return!u&&!f&&g(!0),l.useEffect(()=>{if(!u&&c!=null){const C=setTimeout(c,p);return()=>{clearTimeout(C)}}},[c,u,p]),T.jsx("span",{className:m,style:v,children:T.jsx("span",{className:h})})}const E=ee("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),bo=["center","classes","className"];let oe=e=>e,me,xe,ve,ye;const re=550,go=80,mo=le(me||(me=oe`
2
2
  0% {
3
3
  transform: scale(0);
4
4
  opacity: 0.1;
@@ -1 +1 @@
1
- import{j as e,r as j,u as pa,a as _a,L as te}from"./react-BW1xvPTF.js";import{t,C as L,A as G,ak as ga,x as ba,ai as P,Q as Ue,u as va,n as fa,a as xa,b as Ca,al as ja,am as ka,I as A,an as Na,z as wa,y as Ma,ao as Oe,j as W,ap as $e,aq as Sa,J as O,e as qa,h as Ve,c as pe,ar as _e,l as se,k as De,o as ne,q as Pa,r as ge,m as Ge,as as Aa}from"./index-BFPNYe8x.js";import{P as Ye,m as Xe,W as Ia,c as be,t as Ka,C as Qa,A as Ra,a as Ta,s as He,b as Fa,d as Ea,e as Wa}from"./CollectionCarousel-DEYFBykF.js";import{u as La}from"./useManaRate-CGtpZZBQ.js";import{u as Je,r as Ba}from"./mana-rate-BpgRIQMS.js";import{g as za,j as Ua,h as Oa,n as $a,i as Va,A as Da}from"./authorizations-t9AL68YM.js";import{a as ve}from"./buy-84sizoxr.js";import{a as Ga,w as Ha,S as Ja,G as Ya}from"./buy-gasless-oF_YJX_W.js";import{R as re,r as Xa}from"./cart-checkout-K77UDHy3.js";import{u as Za,M as et,c as at}from"./useCreditPacks-BAZLy3JX.js";import{l as tt}from"./loader-logo-BzY9EKdC.js";import{i as st,a as nt}from"./errors-D-hio89k.js";import{E as rt}from"./ErrorNotice-BG40E5Ff.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-DcECym8l.js";import"./sendMetaTransaction-DNedK3Cr.js";const it="https://cdn.decentraland.org/@dcl/shop/0.1.0-30277401547.commit-e877307/assets/buy-error-22UunaPC.png";function ct(i){const{phase:o,balanceCredits:C,onClose:N}=i,I=o==="processing",R=o==="error"?t("cartCheckout.errorTitle"):o==="nofunds"?t("cartCheckout.titleNoFunds"):o==="choose"?t("buyModal.choosePayment"):t("cartCheckout.titleBuy"),T=o==="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:I?void 0:N,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${T?" 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:R}),!I&&e.jsx("button",{className:"buy-modal__x",onClick:N,"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:o==="nofunds"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(L,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:G(C)})]})]}),o==="choose"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"cart-checkout__choose-total",children:[e.jsx("span",{children:t("cart.purchaseSummary")}),e.jsxs("strong",{children:[e.jsx(L,{className:"buy-modal__balance-ico"}),G(i.totalCredits??0)]})]}),e.jsx(Ye,{options:i.options??[],totalCents:i.totalCents??0,onPay:i.onPay??(()=>{}),rateNote:(()=>{const M=Xe(i.totalCents??0,i.totalManaWei??0n);return M!=null?t("buyModal.manaRate",{mana:M.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),o==="processing"&&e.jsx(ot,{stage:i.stage??"reserving",step:i.step??1,total:i.total??1,isSelfCustody:!!i.isSelfCustody}),o==="nofunds"&&e.jsx(lt,{lines:i.lines??[],shortfallCredits:i.shortfallCredits??0,packs:i.packs??[],selectedPack:i.selectedPack??"",onSelectPack:i.onSelectPack??(()=>{}),onBuyPacks:i.onBuyPacks??(()=>{}),onCancel:N}),o==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-error",children:[e.jsx("img",{className:"buy-error__art",src:it,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:N,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:i.onRetry??N,children:t("cartCheckout.tryAgain")})]})]})]})]})}function ot({stage:i,step:o,total:C,isSelfCustody:N}){const I=i==="reserving",R=C>0?Math.min(100,Math.round(o/C*100)):0,T=i==="awaiting-signature"?N?t("buyModal.confirmToContinue"):t("buyModal.completingTransaction"):i==="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:tt,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:T}),I?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:`${R}%`}})}),C>1?e.jsxs("span",{className:"cart-checkout__step",children:[o,"/",C]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function lt({lines:i,shortfallCredits:o,packs:C,selectedPack:N,onSelectPack:I,onBuyPacks:R,onCancel:T}){const M=C.find(n=>n.id===N),ce=i.reduce((n,q)=>n+(q.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(Ia,{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,o)})})," ",t("buyModal.warningToPurchase",{count:ce})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:i.map(n=>{const q=n.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:n.item.thumbnail?e.jsx("img",{src:n.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:n.item.name,children:[n.item.name||t("buyModal.itemFallback"),q>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:t("cartCheckout.qty",{count:q})}):null]}),n.item.creator?e.jsx(ga,{address:n.item.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(L,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:G(n.priceCredits*q)})]})]})]},n.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:C.map(n=>{const q=n.id===N;return e.jsxs("button",{className:`buy-modal__pack${q?" buy-modal__pack--on":""}`,onClick:()=>I(n.id),children:[e.jsx(L,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:G(n.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(L,{className:"buy-modal__total-ico"}),e.jsx("span",{children:G((M==null?void 0:M.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((M==null?void 0:M.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:T,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:R,children:t("buyModal.buy")})]})]})}function fe(i){if(st(i))return t("errors.rejected");const o=(i.message??"").toLowerCase();return o.includes("insufficient")?t("cart.error.insufficient",{currency:qa.name}):o.includes("no active listing")||o.includes("your own listing")?t("cart.error.listingChanged"):t("marketCheckout.error.generic")}const dt=12e4;function ut(i){const o=[];return i.unavailable.length&&o.push(t("cart.drop.unavailable",{count:i.unavailable.length})),i.own.length&&o.push(t("cart.drop.own",{count:i.own.length})),t("cart.drop.removed",{items:o.join(` ${t("cart.drop.and")} `)})}const xe=i=>i.reduce((o,C)=>o+C.priceCredits*C.quantity,0),ie=i=>i.flatMap(o=>Array.from({length:o.quantity},()=>({...o,quantity:1})));function At(){ba({title:t("nav.cart"),noindex:!0});const i=P(a=>a.items),o=P(a=>a.remove),C=P(a=>a.increment),N=P(a=>a.decrement),I=P(a=>a.clear),R=P(a=>a.restore),T=P(a=>a.setFittingOpen),M=Ue(a=>a.items),ce=Ue(a=>a.toggle),{session:n,signIn:q}=va(),H=Za().packs.slice(0,et);j.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const Ze=i.some(a=>a.category!=="emote"),{data:oe}=fa({queryKey:["upsell-listings"],queryFn:()=>Aa({first:40}),staleTime:6e4}),{data:v}=xa(n),d=Ca(),B=pa(),{state:F}=_a(),[ea,$]=j.useState(null),[Ce,J]=j.useState(null),[aa,S]=j.useState(!1),[w,E]=j.useState(null),je=j.useRef(0),[h,g]=j.useState(null),{data:V}=ja(n),{data:le}=La(!0),[de,ke]=j.useState(""),D=j.useRef(null),Ne=ka(i),we=a=>Oe(Ne[a.id]),ue=i.filter(we),he=i.length>0&&ue.length===0,ta=ue.reduce((a,s)=>a+s.priceCredits*s.quantity,0),sa=i.reduce((a,s)=>a+s.quantity,0),na=ue.reduce((a,s)=>a+s.quantity,0),Me=w?w.liveTotalCredits:ta,ra=new Set(i.map(a=>a.id)),Se=((oe==null?void 0:oe.items)??[]).filter(a=>!ra.has(a.id)).slice(0,12),ia=new Map(w==null?void 0:w.buyable.map(a=>[a.item.id,a])),Y=(v==null?void 0:v.credits)??0,X=Me*10,qe=le?Je(X,le):0n,Z=be({priceCents:X,priceManaWei:qe,balanceCents:(v==null?void 0:v.balanceCents)??0,manaBalanceWei:V??0n}),Pe=Xe(X,qe),Ae=Pe!=null?t("buyModal.manaRate",{mana:Pe.toLocaleString("en",{maximumFractionDigits:2})}):null,ca=Sa;function ee(a){a(),E(null),J(null),$(null)}function oa(){g(null),S(!1)}function Ie(a){const s=xe(a),c=Math.max(0,s-Y),r=H.find(l=>l.credits>=c)??H[H.length-1];ke(r.id),W("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:s,credits_balance:Y,shortfall:c}),g({phase:"nofunds",lines:a.map(l=>({item:l.item,priceCredits:l.priceCredits,quantity:l.quantity})),shortfall:c}),S(!1)}async function me(a){if(!n||a.length===0)return;const s=ie(a),c=s.map(y=>({...y.item,priceCredits:y.priceCredits})),r=a.map(y=>({...y.item,priceCredits:y.priceCredits,quantity:y.quantity})),l=[];let u="authorize",p=!1;g({phase:"processing",stage:"reserving",step:1,total:s.length});try{const y=[];for(let x=0;x<s.length;x++){const b=s[x];g({phase:"processing",stage:"reserving",step:x+1,total:s.length});try{const{credit:f,maxCreditedValue:U}=await Ve(n.identity,b.usdCents,b.trade.id);l.push(f.id),y.push({trade:b.trade,credits:[f],maxCreditedValue:U})}catch(f){if(nt(f)){if(l.length){try{await pe(n.identity,l)}catch(U){O(U,{flow:"cart_checkout",step:"release"})}d.invalidateQueries({queryKey:["usd-balance"]})}Ie(a);return}throw f}}u="submit";const k=()=>g({phase:"processing",stage:"settling",step:s.length,total:s.length});g({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});let _=[];if(za())try{_=await Ga({purchases:y,buyer:n.address,signer:n.signer,onSigned:k});const b=(await Promise.allSettled(_.map(f=>Ha(f)))).flatMap(f=>f.status==="rejected"?[f.reason]:[]);if(b.length&&!b.some(f=>f instanceof Ja))throw b[0];p=!0}catch(x){if(!(x instanceof Ya))throw x;_=await ve({purchases:y,buyer:n.address,signer:n.signer,onSigned:k})}else _=await ve({purchases:y,buyer:n.address,signer:n.signer});a.forEach(x=>o(x.item.id)),E(null),W("Shop Completed Purchase",{..._e(c),payment_type:"credits",no_crypto_step:p,transaction_hash:_[0]??null}),d.invalidateQueries({queryKey:["usd-balance"]}),d.invalidateQueries({queryKey:["detail-trade"]}),d.invalidateQueries({queryKey:["shop-item"]}),d.invalidateQueries({queryKey:["owned-token"]}),d.invalidateQueries({queryKey:["public-token"]}),d.invalidateQueries({queryKey:["item-resales"]}),d.invalidateQueries({queryKey:["shop-items"]}),d.invalidateQueries({queryKey:["catalog-items"]}),d.invalidateQueries({queryKey:["my-assets"]}),d.invalidateQueries({queryKey:["purchases"]}),d.invalidateQueries({queryKey:["owned-item-count"]}),d.invalidateQueries({queryKey:["overview-listings"]}),d.invalidateQueries({queryKey:["upsell-listings"]});const m=D.current;D.current=null,g(null),S(!1);const Q={items:r,txHash:_[0]??void 0,settled:!0,...m?{creditsAdded:m}:{}};B("/success",{state:Q,replace:!0})}catch(y){if(se(y)||O(y,{flow:"cart_checkout",step:u,cart_size:a.length}),W(se(y)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:u,error_code:De(y),value_usd:$e(c.reduce((k,_)=>k+_.priceCredits,0)),cart_size:s.length}),l.length){try{await pe(n.identity,l)}catch(k){O(k,{flow:"cart_checkout",step:"release"})}d.invalidateQueries({queryKey:["usd-balance"]})}g({phase:"error",message:fe(y)})}}function Ke(a,s){d.invalidateQueries({queryKey:["usd-balance"]}),d.invalidateQueries({queryKey:["detail-trade"]}),d.invalidateQueries({queryKey:["shop-item"]}),d.invalidateQueries({queryKey:["owned-token"]}),d.invalidateQueries({queryKey:["public-token"]}),d.invalidateQueries({queryKey:["item-resales"]}),d.invalidateQueries({queryKey:["shop-items"]}),d.invalidateQueries({queryKey:["catalog-items"]}),d.invalidateQueries({queryKey:["my-assets"]}),d.invalidateQueries({queryKey:["purchases"]}),d.invalidateQueries({queryKey:["owned-item-count"]}),d.invalidateQueries({queryKey:["overview-listings"]}),d.invalidateQueries({queryKey:["upsell-listings"]});const c=D.current;D.current=null,g(null),S(!1);const r={items:a,txHash:s[0]??void 0,settled:!0,...c?{creditsAdded:c}:{}};B("/success",{state:r,replace:!0})}function Qe(a,s){se(a)||O(a,{flow:s,step:"submit"}),W(se(a)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:De(a)}),g({phase:"error",message:fe(a)}),S(!1)}async function la(a,s){const c=ne(ge.MANAToken,s),r=ne(ge.CreditsManager,s);await Va({auth:{kind:Da.Allowance,contractAddress:c.address,spenderAddress:r.address,chainId:s},signer:a})}async function da(a){const s=ie(a).reduce((u,p)=>u+p.usdCents,0),c=(V??0n)>0n;let r=le;if(!r&&c)try{r=await d.fetchQuery({queryKey:["mana-rate",Ge.chainId],queryFn:()=>Ba(Ge.chainId),staleTime:6e4})}catch{r=void 0}const l=r?Je(s,r):0n;return{totalCents:s,manaWei:l}}async function Re(a,s){const c=xe(a),{totalCents:r,manaWei:l}=await da(a),u=be({priceCents:r,priceManaWei:l,balanceCents:(v==null?void 0:v.balanceCents)??0,manaBalanceWei:V??0n});if(s&&u.options.some(p=>p.method===s)){if(s==="credits"){me(a);return}const{spender:p,chainId:y}=Te(s,a);await Fe(p,y,()=>s==="mana"?void Ee(a):void We(a,r,l));return}if(u.options.some(p=>p.method==="mana"||p.method==="combined")){g({phase:"choose",lines:a,totalCents:r,manaWei:l}),S(!1);return}if(v!=null&&v.credits<c){Ie(a);return}me(a)}function ua(a){return be({priceCents:a.totalCents,priceManaWei:a.manaWei,balanceCents:(v==null?void 0:v.balanceCents)??0,manaBalanceWei:V??0n})}const[ye,ae]=j.useState(null);function Te(a,s){const c=s[0].trade;return{spender:a==="mana"?ne(Pa(c.contract),c.chainId).address:ne(ge.CreditsManager,c.chainId).address,chainId:c.chainId}}async function Fe(a,s,c){const r=Ua(s,a),l=n?await Oa(r,n.address).catch(()=>!0):!0;if($a(n==null?void 0:n.providerType,l)){S(!1),ae({auth:r,run:c});return}c()}function ha(a){if((h==null?void 0:h.phase)!=="choose")return;const{lines:s,totalCents:c,manaWei:r}=h;if(a==="credits"){me(s);return}const{spender:l,chainId:u}=Te(a,s);Fe(l,u,()=>a==="mana"?void Ee(s):void We(s,c,r))}async function Ee(a){if(!n||a.length===0)return;const s=ie(a),c=s.map(u=>({...u.item,priceCredits:u.priceCredits})),r=a.map(u=>({...u.item,priceCredits:u.priceCredits,quantity:u.quantity})),l=()=>g({phase:"processing",stage:"settling",step:s.length,total:s.length});g({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});try{const u=await Fa({trades:s.map(p=>p.trade),buyer:n.address,signer:n.signer,onSigned:l});a.forEach(p=>o(p.item.id)),E(null),W("Shop Completed Purchase",{..._e(c),payment_type:"mana",transaction_hash:u[0]??null}),d.invalidateQueries({queryKey:["mana-balance"]}),Ke(r,u)}catch(u){Qe(u,"buy_cart_mana")}}async function We(a,s,c){if(!n||a.length===0)return;const r=ie(a),l=r.map(m=>({...m.item,priceCredits:m.priceCredits})),u=a.map(m=>({...m.item,priceCredits:m.priceCredits,quantity:m.quantity})),p=Ea(r.map(m=>m.usdCents),(v==null?void 0:v.balanceCents)??0),y=p.reduce((m,Q)=>m+Q,0),k=Wa(Math.max(0,s-y),s,c),_=[];g({phase:"processing",stage:"reserving",step:1,total:r.length});try{const m=[];for(let b=0;b<r.length;b++){const f=p[b];if(f<=0)continue;g({phase:"processing",stage:"reserving",step:b+1,total:r.length});const{credit:U,maxCreditedValue:ya}=await Ve(n.identity,f,r[b].trade.id);_.push(U.id),m.push({trade:r[b].trade,credits:[U],maxCreditedValue:ya})}r.forEach((b,f)=>{p[f]<=0&&m.push({trade:b.trade,credits:[],maxCreditedValue:"0"})}),m[0]={...m[0],maxCreditedValue:(BigInt(m[0].maxCreditedValue)+k).toString()},await la(n.signer,r[0].trade.chainId);const Q=()=>g({phase:"processing",stage:"settling",step:r.length,total:r.length});g({phase:"processing",stage:"awaiting-signature",step:r.length,total:r.length});const x=await ve({purchases:m,buyer:n.address,signer:n.signer,onSigned:Q});a.forEach(b=>o(b.item.id)),E(null),W("Shop Completed Purchase",{..._e(l),payment_type:"credits_and_mana",transaction_hash:x[0]??null}),d.invalidateQueries({queryKey:["mana-balance"]}),Ke(u,x)}catch(m){_.length&&(pe(n.identity,_).catch(()=>{}),d.invalidateQueries({queryKey:["usd-balance"]})),Qe(m,"buy_cart_combined")}}async function z(a){if(!n){He({type:"cart-checkout"}),q();return}const s=P.getState().items.filter(we);if(s.length===0)return;$(null),J(null),S(!0);const c=s.reduce((r,l)=>r+l.priceCredits*l.quantity,0);W("Shop Started Checkout",{cart_size:s.length,cart_value_credits:c,cart_value_usd:$e(c),has_sufficient_credits:Y>=c});try{const r=await Xa(s,n.address,ca),l=[...r.unavailable,...r.own];if(l.length&&(l.forEach(u=>o(u.id)),J(ut(r))),r.buyable.length===0){$(t("cart.error.noneAvailable")),E(null);return}if(r.orderChanged){E(r),je.current=Date.now();return}await Re(r.buyable,a)}catch(r){O(r,{flow:"cart_checkout",step:"review",cart_size:s.length}),$(fe(r))}finally{S(!1)}}async function Le(){if(w){if(!n){He({type:"cart-checkout"}),q();return}if(Date.now()-je.current>dt){E(null),J(null),await z();return}$(null),Re(w.buyable)}}async function ma(){if(de){try{sessionStorage.setItem(re,JSON.stringify(P.getState().items))}catch{}S(!0);try{const a=await at(de,n?{address:n.address,identity:n.identity}:void 0);if(a.url){window.location.href=a.url;return}B("/credits")}catch(a){try{sessionStorage.removeItem(re)}catch{}O(a,{flow:"cart_buy_credits"}),g({phase:"error",message:t("buyModal.error.creditsCheckout")})}finally{S(!1)}}}const Be=j.useRef(!1);j.useEffect(()=>{if(!n||Be.current||!Ka("cart-checkout"))return;Be.current=!0;const a=setTimeout(()=>void z(),0);return()=>clearTimeout(a)},[n]);const ze=j.useRef(!1);j.useEffect(()=>{if(!(F!=null&&F.resumeCheckout)||ze.current)return;ze.current=!0,D.current=F.creditsAdded??null;try{const s=sessionStorage.getItem(re);if(s){sessionStorage.removeItem(re);const c=JSON.parse(s);Array.isArray(c)&&c.length&&R(c)}}catch{}d.invalidateQueries({queryKey:["usd-balance"]});const a=setTimeout(()=>void z(),0);return()=>clearTimeout(a)},[F==null?void 0:F.resumeCheckout]);const K=aa||(h==null?void 0:h.phase)==="processing";return i.length===0&&!h?e.jsx("div",{className:"checkout checkout--empty",children:e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>B(-1),type:"button",children:[e.jsx(A,{name:"arrow-left"}),t("nav.cart")]}),e.jsxs("section",{className:"checkout__panel cart-empty","data-testid":"cart-empty",children:[e.jsx(A,{name:"cart-plus",size:110,className:"cart-empty__icon"}),e.jsxs("div",{className:"cart-empty__text",children:[e.jsx("p",{className:"cart-empty__title",children:t("cart.empty.title")}),e.jsx("p",{className:"cart-empty__body",children:t("cart.empty.body")})]}),e.jsx(te,{className:"cart-empty__cta",to:"/assets",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:()=>B(-1),type:"button",children:[e.jsx(A,{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:()=>B(-1),type:"button","aria-label":t("cart.goBack"),children:e.jsx(A,{name:"arrow-left"})}),e.jsx("h1",{className:"checkout__panel-title",children:t("cart.panelTitle",{count:sa})}),Ze?e.jsxs("button",{className:"checkout__fitting",onClick:()=>T(!0),disabled:K,children:[e.jsx(A,{name:"fitting-room"}),t("cart.fittingRoom")]}):null]}),e.jsxs("section",{className:"checkout__panel",children:[e.jsx("div",{className:"checkout__list",children:i.map(a=>{const s=ia.get(a.id),c=s?s.priceCredits:a.priceCredits,r=!!s&&s.priceCredits!==a.priceCredits,l=!a.tokenId,u=a.quantity,p=typeof a.available=="number"&&u>=a.available,y=c*u,k=!!M[a.id],_=Na(a),m=Ne[a.id],Q=!Oe(m),x=m==="sold-out"?t("cart.availability.soldOut"):t("cart.availability.unavailable");return e.jsxs("div",{className:`checkout__card${Q?" is-unavailable":""}`,children:[e.jsxs("div",{className:"checkout__thumb",children:[_?e.jsx(te,{className:"checkout__thumb-link",to:_,state:{item:a,tradeId:a.tradeId},"aria-label":a.name,children:a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:a.name}):null}):a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:a.name}):null,e.jsx("span",{className:"checkout__thumb-check","aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"checkout__info",children:[e.jsxs("div",{className:"checkout__desc",children:[_?e.jsx(te,{className:"checkout__name",to:_,state:{item:a,tradeId:a.tradeId},title:a.name,children:a.name}):e.jsx("div",{className:"checkout__name",title:a.name,children:a.name}),a.creator?e.jsx(wa,{address:a.creator,className:"checkout__creator",linkToProfile:!0}):null,l?e.jsxs("span",{className:"checkout__creator-tag","data-testid":"cart-creator-tag",children:[e.jsx(A,{name:"buy-from-creator",className:"checkout__creator-tag-ico","aria-hidden":!0}),t("cart.creatorTag")]}):null]}),e.jsx("div",{className:"checkout__foot",children:Q?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"checkout__unavailable",children:[e.jsx(A,{name:"warning-fill",size:24,className:"checkout__warn","aria-hidden":!0}),x]}),_?e.jsx(te,{className:"checkout__resales",to:_,state:{item:a,tradeId:a.tradeId},children:t("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[l?e.jsxs("div",{className:"checkout__stepper",children:[e.jsx("button",{className:"checkout__step",onClick:()=>ee(()=>N(a.id)),disabled:K||u<=1,"aria-label":t("cart.decreaseQuantity",{name:a.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:u}),e.jsx("button",{className:"checkout__step",onClick:()=>ee(()=>C(a.id)),disabled:K||p,"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(L,{className:"checkout__price-ico"})," ",y,r?e.jsx("span",{className:"checkout__price-was",children:a.priceCredits*u}):null]})]})})]}),e.jsxs("div",{className:"checkout__actions",children:[e.jsx("button",{className:`checkout__fav${k?" is-on":""}`,onClick:()=>ce(a),"aria-label":k?t("cart.removeFromFavorites",{name:a.name}):t("cart.addToFavorites",{name:a.name}),title:k?t("assetCard.removeFromFavorites"):t("assetCard.addToFavorites"),children:e.jsx(A,{name:k?"heart-solid":"heart"})}),e.jsx("button",{className:"checkout__remove",onClick:()=>ee(()=>o(a.id)),disabled:K,"aria-label":t("cart.remove",{name:a.name}),title:t("cart.removeTitle"),children:e.jsx(A,{name:"trash",size:24})})]})]},a.id)})}),e.jsx("div",{className:"checkout__utils",children:e.jsx("button",{className:"link",onClick:()=>ee(I),disabled:K,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:na})}),e.jsxs("span",{className:"checkout__total-side",children:[e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(L,{className:"checkout__total-ico"})," ",Me]}),Ae&&(V??0n)>0n?e.jsx("span",{className:"checkout__total-rate","data-testid":"cart-mana-rate",children:Ae}):null]})]}),Z.options.length>0||Z.manaShortfall?e.jsx(Ye,{options:Z.options,totalCents:X,shortfall:Z.manaShortfall,creditsLabel:w?t("marketCheckout.confirmPurchase"):t("cart.buyWithCredits"),busy:K||he,onPay:a=>void(w?Le():z(a))}):e.jsx("button",{className:"checkout__cta",onClick:()=>void(w?Le():z()),disabled:K||he,children:K?t("cart.working"):w?t("marketCheckout.confirmPurchase"):t("assetCard.buyNow")}),he?e.jsx("p",{className:"muted checkout__msg",children:t("cart.allUnavailable")}):null,n?null:e.jsx("p",{className:"muted checkout__msg",children:t("cart.signInHint")}),w?e.jsx("p",{className:"muted checkout__msg",children:t("cart.priceChanged")}):null,Ce?e.jsx("p",{className:"muted checkout__msg",children:Ce}):null,e.jsx(rt,{message:ea,className:"checkout__msg"})]})]})]})]}),Se.length>0?e.jsx("div",{className:"cart-upsell",children:e.jsx(Qa,{title:t("cart.youMightAlsoLike"),items:Se})}):null,ye&&n?e.jsx(Ra,{auth:ye.auth,signer:n.signer,title:t("authorizeStep.manaTitle"),name:t("authorizeStep.manaName"),reason:t("authorizeStep.manaReason"),icon:e.jsx("img",{src:Ta,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:a}=ye;ae(null),a()},onCancel:()=>ae(null),onClose:()=>ae(null)}):null,h?e.jsx(ct,{phase:h.phase,balanceCredits:Y,onClose:oa,stage:h.phase==="processing"?h.stage:void 0,step:h.phase==="processing"?h.step:void 0,total:h.phase==="processing"?h.total:void 0,isSelfCustody:Ma(n==null?void 0:n.providerType),options:h.phase==="choose"?ua(h).options:void 0,onPay:ha,totalCents:h.phase==="choose"?h.totalCents:void 0,totalManaWei:h.phase==="choose"?h.manaWei:void 0,totalCredits:h.phase==="choose"?xe(h.lines):void 0,lines:h.phase==="nofunds"?h.lines:void 0,shortfallCredits:h.phase==="nofunds"?h.shortfall:void 0,packs:H,selectedPack:de,onSelectPack:ke,onBuyPacks:()=>void ma(),message:h.phase==="error"?h.message:void 0,onRetry:()=>void z()}):null]})}export{At as Cart};
1
+ import{j as e,r as j,u as pa,a as _a,L as te}from"./react-BW1xvPTF.js";import{t,C as L,A as G,ak as ga,x as ba,ai as P,Q as Ue,u as va,n as fa,a as xa,b as Ca,al as ja,am as ka,I as A,an as Na,z as wa,y as Ma,ao as Oe,j as W,ap as $e,aq as Sa,J as O,e as qa,h as Ve,c as pe,ar as _e,l as se,k as De,o as ne,q as Pa,r as ge,m as Ge,as as Aa}from"./index-CEUqEDHj.js";import{P as Ye,m as Xe,W as Ia,c as be,t as Ka,C as Qa,A as Ra,a as Ta,s as He,b as Fa,d as Ea,e as Wa}from"./CollectionCarousel-B0A1YOX-.js";import{u as La}from"./useManaRate-WxBKKUcB.js";import{u as Je,r as Ba}from"./mana-rate-D7GRB_Ot.js";import{g as za,j as Ua,h as Oa,n as $a,i as Va,A as Da}from"./authorizations-Bt-yiKpU.js";import{a as ve}from"./buy-C8thJCOQ.js";import{a as Ga,w as Ha,S as Ja,G as Ya}from"./buy-gasless-kzWGfidX.js";import{R as re,r as Xa}from"./cart-checkout-DtChJ5jV.js";import{u as Za,M as et,c as at}from"./useCreditPacks-DPTBuCyg.js";import{l as tt}from"./loader-logo-BzY9EKdC.js";import{i as st,a as nt}from"./errors-CGr_h4qk.js";import{E as rt}from"./ErrorNotice-BG40E5Ff.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-rbwEO5I2.js";import"./sendMetaTransaction-DnNlMy1f.js";const it="https://cdn.decentraland.org/@dcl/shop/0.1.0-30279564518.commit-0ea36ab/assets/buy-error-22UunaPC.png";function ct(i){const{phase:o,balanceCredits:C,onClose:N}=i,I=o==="processing",R=o==="error"?t("cartCheckout.errorTitle"):o==="nofunds"?t("cartCheckout.titleNoFunds"):o==="choose"?t("buyModal.choosePayment"):t("cartCheckout.titleBuy"),T=o==="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:I?void 0:N,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${T?" 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:R}),!I&&e.jsx("button",{className:"buy-modal__x",onClick:N,"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:o==="nofunds"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(L,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:G(C)})]})]}),o==="choose"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"cart-checkout__choose-total",children:[e.jsx("span",{children:t("cart.purchaseSummary")}),e.jsxs("strong",{children:[e.jsx(L,{className:"buy-modal__balance-ico"}),G(i.totalCredits??0)]})]}),e.jsx(Ye,{options:i.options??[],totalCents:i.totalCents??0,onPay:i.onPay??(()=>{}),rateNote:(()=>{const M=Xe(i.totalCents??0,i.totalManaWei??0n);return M!=null?t("buyModal.manaRate",{mana:M.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),o==="processing"&&e.jsx(ot,{stage:i.stage??"reserving",step:i.step??1,total:i.total??1,isSelfCustody:!!i.isSelfCustody}),o==="nofunds"&&e.jsx(lt,{lines:i.lines??[],shortfallCredits:i.shortfallCredits??0,packs:i.packs??[],selectedPack:i.selectedPack??"",onSelectPack:i.onSelectPack??(()=>{}),onBuyPacks:i.onBuyPacks??(()=>{}),onCancel:N}),o==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-error",children:[e.jsx("img",{className:"buy-error__art",src:it,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:N,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:i.onRetry??N,children:t("cartCheckout.tryAgain")})]})]})]})]})}function ot({stage:i,step:o,total:C,isSelfCustody:N}){const I=i==="reserving",R=C>0?Math.min(100,Math.round(o/C*100)):0,T=i==="awaiting-signature"?N?t("buyModal.confirmToContinue"):t("buyModal.completingTransaction"):i==="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:tt,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:T}),I?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:`${R}%`}})}),C>1?e.jsxs("span",{className:"cart-checkout__step",children:[o,"/",C]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function lt({lines:i,shortfallCredits:o,packs:C,selectedPack:N,onSelectPack:I,onBuyPacks:R,onCancel:T}){const M=C.find(n=>n.id===N),ce=i.reduce((n,q)=>n+(q.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(Ia,{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,o)})})," ",t("buyModal.warningToPurchase",{count:ce})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:i.map(n=>{const q=n.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:n.item.thumbnail?e.jsx("img",{src:n.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:n.item.name,children:[n.item.name||t("buyModal.itemFallback"),q>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:t("cartCheckout.qty",{count:q})}):null]}),n.item.creator?e.jsx(ga,{address:n.item.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(L,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:G(n.priceCredits*q)})]})]})]},n.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:C.map(n=>{const q=n.id===N;return e.jsxs("button",{className:`buy-modal__pack${q?" buy-modal__pack--on":""}`,onClick:()=>I(n.id),children:[e.jsx(L,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:G(n.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(L,{className:"buy-modal__total-ico"}),e.jsx("span",{children:G((M==null?void 0:M.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((M==null?void 0:M.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:T,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:R,children:t("buyModal.buy")})]})]})}function fe(i){if(st(i))return t("errors.rejected");const o=(i.message??"").toLowerCase();return o.includes("insufficient")?t("cart.error.insufficient",{currency:qa.name}):o.includes("no active listing")||o.includes("your own listing")?t("cart.error.listingChanged"):t("marketCheckout.error.generic")}const dt=12e4;function ut(i){const o=[];return i.unavailable.length&&o.push(t("cart.drop.unavailable",{count:i.unavailable.length})),i.own.length&&o.push(t("cart.drop.own",{count:i.own.length})),t("cart.drop.removed",{items:o.join(` ${t("cart.drop.and")} `)})}const xe=i=>i.reduce((o,C)=>o+C.priceCredits*C.quantity,0),ie=i=>i.flatMap(o=>Array.from({length:o.quantity},()=>({...o,quantity:1})));function At(){ba({title:t("nav.cart"),noindex:!0});const i=P(a=>a.items),o=P(a=>a.remove),C=P(a=>a.increment),N=P(a=>a.decrement),I=P(a=>a.clear),R=P(a=>a.restore),T=P(a=>a.setFittingOpen),M=Ue(a=>a.items),ce=Ue(a=>a.toggle),{session:n,signIn:q}=va(),H=Za().packs.slice(0,et);j.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const Ze=i.some(a=>a.category!=="emote"),{data:oe}=fa({queryKey:["upsell-listings"],queryFn:()=>Aa({first:40}),staleTime:6e4}),{data:v}=xa(n),d=Ca(),B=pa(),{state:F}=_a(),[ea,$]=j.useState(null),[Ce,J]=j.useState(null),[aa,S]=j.useState(!1),[w,E]=j.useState(null),je=j.useRef(0),[h,g]=j.useState(null),{data:V}=ja(n),{data:le}=La(!0),[de,ke]=j.useState(""),D=j.useRef(null),Ne=ka(i),we=a=>Oe(Ne[a.id]),ue=i.filter(we),he=i.length>0&&ue.length===0,ta=ue.reduce((a,s)=>a+s.priceCredits*s.quantity,0),sa=i.reduce((a,s)=>a+s.quantity,0),na=ue.reduce((a,s)=>a+s.quantity,0),Me=w?w.liveTotalCredits:ta,ra=new Set(i.map(a=>a.id)),Se=((oe==null?void 0:oe.items)??[]).filter(a=>!ra.has(a.id)).slice(0,12),ia=new Map(w==null?void 0:w.buyable.map(a=>[a.item.id,a])),Y=(v==null?void 0:v.credits)??0,X=Me*10,qe=le?Je(X,le):0n,Z=be({priceCents:X,priceManaWei:qe,balanceCents:(v==null?void 0:v.balanceCents)??0,manaBalanceWei:V??0n}),Pe=Xe(X,qe),Ae=Pe!=null?t("buyModal.manaRate",{mana:Pe.toLocaleString("en",{maximumFractionDigits:2})}):null,ca=Sa;function ee(a){a(),E(null),J(null),$(null)}function oa(){g(null),S(!1)}function Ie(a){const s=xe(a),c=Math.max(0,s-Y),r=H.find(l=>l.credits>=c)??H[H.length-1];ke(r.id),W("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:s,credits_balance:Y,shortfall:c}),g({phase:"nofunds",lines:a.map(l=>({item:l.item,priceCredits:l.priceCredits,quantity:l.quantity})),shortfall:c}),S(!1)}async function me(a){if(!n||a.length===0)return;const s=ie(a),c=s.map(y=>({...y.item,priceCredits:y.priceCredits})),r=a.map(y=>({...y.item,priceCredits:y.priceCredits,quantity:y.quantity})),l=[];let u="authorize",p=!1;g({phase:"processing",stage:"reserving",step:1,total:s.length});try{const y=[];for(let x=0;x<s.length;x++){const b=s[x];g({phase:"processing",stage:"reserving",step:x+1,total:s.length});try{const{credit:f,maxCreditedValue:U}=await Ve(n.identity,b.usdCents,b.trade.id);l.push(f.id),y.push({trade:b.trade,credits:[f],maxCreditedValue:U})}catch(f){if(nt(f)){if(l.length){try{await pe(n.identity,l)}catch(U){O(U,{flow:"cart_checkout",step:"release"})}d.invalidateQueries({queryKey:["usd-balance"]})}Ie(a);return}throw f}}u="submit";const k=()=>g({phase:"processing",stage:"settling",step:s.length,total:s.length});g({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});let _=[];if(za())try{_=await Ga({purchases:y,buyer:n.address,signer:n.signer,onSigned:k});const b=(await Promise.allSettled(_.map(f=>Ha(f)))).flatMap(f=>f.status==="rejected"?[f.reason]:[]);if(b.length&&!b.some(f=>f instanceof Ja))throw b[0];p=!0}catch(x){if(!(x instanceof Ya))throw x;_=await ve({purchases:y,buyer:n.address,signer:n.signer,onSigned:k})}else _=await ve({purchases:y,buyer:n.address,signer:n.signer});a.forEach(x=>o(x.item.id)),E(null),W("Shop Completed Purchase",{..._e(c),payment_type:"credits",no_crypto_step:p,transaction_hash:_[0]??null}),d.invalidateQueries({queryKey:["usd-balance"]}),d.invalidateQueries({queryKey:["detail-trade"]}),d.invalidateQueries({queryKey:["shop-item"]}),d.invalidateQueries({queryKey:["owned-token"]}),d.invalidateQueries({queryKey:["public-token"]}),d.invalidateQueries({queryKey:["item-resales"]}),d.invalidateQueries({queryKey:["shop-items"]}),d.invalidateQueries({queryKey:["catalog-items"]}),d.invalidateQueries({queryKey:["my-assets"]}),d.invalidateQueries({queryKey:["purchases"]}),d.invalidateQueries({queryKey:["owned-item-count"]}),d.invalidateQueries({queryKey:["overview-listings"]}),d.invalidateQueries({queryKey:["upsell-listings"]});const m=D.current;D.current=null,g(null),S(!1);const Q={items:r,txHash:_[0]??void 0,settled:!0,...m?{creditsAdded:m}:{}};B("/success",{state:Q,replace:!0})}catch(y){if(se(y)||O(y,{flow:"cart_checkout",step:u,cart_size:a.length}),W(se(y)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:u,error_code:De(y),value_usd:$e(c.reduce((k,_)=>k+_.priceCredits,0)),cart_size:s.length}),l.length){try{await pe(n.identity,l)}catch(k){O(k,{flow:"cart_checkout",step:"release"})}d.invalidateQueries({queryKey:["usd-balance"]})}g({phase:"error",message:fe(y)})}}function Ke(a,s){d.invalidateQueries({queryKey:["usd-balance"]}),d.invalidateQueries({queryKey:["detail-trade"]}),d.invalidateQueries({queryKey:["shop-item"]}),d.invalidateQueries({queryKey:["owned-token"]}),d.invalidateQueries({queryKey:["public-token"]}),d.invalidateQueries({queryKey:["item-resales"]}),d.invalidateQueries({queryKey:["shop-items"]}),d.invalidateQueries({queryKey:["catalog-items"]}),d.invalidateQueries({queryKey:["my-assets"]}),d.invalidateQueries({queryKey:["purchases"]}),d.invalidateQueries({queryKey:["owned-item-count"]}),d.invalidateQueries({queryKey:["overview-listings"]}),d.invalidateQueries({queryKey:["upsell-listings"]});const c=D.current;D.current=null,g(null),S(!1);const r={items:a,txHash:s[0]??void 0,settled:!0,...c?{creditsAdded:c}:{}};B("/success",{state:r,replace:!0})}function Qe(a,s){se(a)||O(a,{flow:s,step:"submit"}),W(se(a)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:De(a)}),g({phase:"error",message:fe(a)}),S(!1)}async function la(a,s){const c=ne(ge.MANAToken,s),r=ne(ge.CreditsManager,s);await Va({auth:{kind:Da.Allowance,contractAddress:c.address,spenderAddress:r.address,chainId:s},signer:a})}async function da(a){const s=ie(a).reduce((u,p)=>u+p.usdCents,0),c=(V??0n)>0n;let r=le;if(!r&&c)try{r=await d.fetchQuery({queryKey:["mana-rate",Ge.chainId],queryFn:()=>Ba(Ge.chainId),staleTime:6e4})}catch{r=void 0}const l=r?Je(s,r):0n;return{totalCents:s,manaWei:l}}async function Re(a,s){const c=xe(a),{totalCents:r,manaWei:l}=await da(a),u=be({priceCents:r,priceManaWei:l,balanceCents:(v==null?void 0:v.balanceCents)??0,manaBalanceWei:V??0n});if(s&&u.options.some(p=>p.method===s)){if(s==="credits"){me(a);return}const{spender:p,chainId:y}=Te(s,a);await Fe(p,y,()=>s==="mana"?void Ee(a):void We(a,r,l));return}if(u.options.some(p=>p.method==="mana"||p.method==="combined")){g({phase:"choose",lines:a,totalCents:r,manaWei:l}),S(!1);return}if(v!=null&&v.credits<c){Ie(a);return}me(a)}function ua(a){return be({priceCents:a.totalCents,priceManaWei:a.manaWei,balanceCents:(v==null?void 0:v.balanceCents)??0,manaBalanceWei:V??0n})}const[ye,ae]=j.useState(null);function Te(a,s){const c=s[0].trade;return{spender:a==="mana"?ne(Pa(c.contract),c.chainId).address:ne(ge.CreditsManager,c.chainId).address,chainId:c.chainId}}async function Fe(a,s,c){const r=Ua(s,a),l=n?await Oa(r,n.address).catch(()=>!0):!0;if($a(n==null?void 0:n.providerType,l)){S(!1),ae({auth:r,run:c});return}c()}function ha(a){if((h==null?void 0:h.phase)!=="choose")return;const{lines:s,totalCents:c,manaWei:r}=h;if(a==="credits"){me(s);return}const{spender:l,chainId:u}=Te(a,s);Fe(l,u,()=>a==="mana"?void Ee(s):void We(s,c,r))}async function Ee(a){if(!n||a.length===0)return;const s=ie(a),c=s.map(u=>({...u.item,priceCredits:u.priceCredits})),r=a.map(u=>({...u.item,priceCredits:u.priceCredits,quantity:u.quantity})),l=()=>g({phase:"processing",stage:"settling",step:s.length,total:s.length});g({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});try{const u=await Fa({trades:s.map(p=>p.trade),buyer:n.address,signer:n.signer,onSigned:l});a.forEach(p=>o(p.item.id)),E(null),W("Shop Completed Purchase",{..._e(c),payment_type:"mana",transaction_hash:u[0]??null}),d.invalidateQueries({queryKey:["mana-balance"]}),Ke(r,u)}catch(u){Qe(u,"buy_cart_mana")}}async function We(a,s,c){if(!n||a.length===0)return;const r=ie(a),l=r.map(m=>({...m.item,priceCredits:m.priceCredits})),u=a.map(m=>({...m.item,priceCredits:m.priceCredits,quantity:m.quantity})),p=Ea(r.map(m=>m.usdCents),(v==null?void 0:v.balanceCents)??0),y=p.reduce((m,Q)=>m+Q,0),k=Wa(Math.max(0,s-y),s,c),_=[];g({phase:"processing",stage:"reserving",step:1,total:r.length});try{const m=[];for(let b=0;b<r.length;b++){const f=p[b];if(f<=0)continue;g({phase:"processing",stage:"reserving",step:b+1,total:r.length});const{credit:U,maxCreditedValue:ya}=await Ve(n.identity,f,r[b].trade.id);_.push(U.id),m.push({trade:r[b].trade,credits:[U],maxCreditedValue:ya})}r.forEach((b,f)=>{p[f]<=0&&m.push({trade:b.trade,credits:[],maxCreditedValue:"0"})}),m[0]={...m[0],maxCreditedValue:(BigInt(m[0].maxCreditedValue)+k).toString()},await la(n.signer,r[0].trade.chainId);const Q=()=>g({phase:"processing",stage:"settling",step:r.length,total:r.length});g({phase:"processing",stage:"awaiting-signature",step:r.length,total:r.length});const x=await ve({purchases:m,buyer:n.address,signer:n.signer,onSigned:Q});a.forEach(b=>o(b.item.id)),E(null),W("Shop Completed Purchase",{..._e(l),payment_type:"credits_and_mana",transaction_hash:x[0]??null}),d.invalidateQueries({queryKey:["mana-balance"]}),Ke(u,x)}catch(m){_.length&&(pe(n.identity,_).catch(()=>{}),d.invalidateQueries({queryKey:["usd-balance"]})),Qe(m,"buy_cart_combined")}}async function z(a){if(!n){He({type:"cart-checkout"}),q();return}const s=P.getState().items.filter(we);if(s.length===0)return;$(null),J(null),S(!0);const c=s.reduce((r,l)=>r+l.priceCredits*l.quantity,0);W("Shop Started Checkout",{cart_size:s.length,cart_value_credits:c,cart_value_usd:$e(c),has_sufficient_credits:Y>=c});try{const r=await Xa(s,n.address,ca),l=[...r.unavailable,...r.own];if(l.length&&(l.forEach(u=>o(u.id)),J(ut(r))),r.buyable.length===0){$(t("cart.error.noneAvailable")),E(null);return}if(r.orderChanged){E(r),je.current=Date.now();return}await Re(r.buyable,a)}catch(r){O(r,{flow:"cart_checkout",step:"review",cart_size:s.length}),$(fe(r))}finally{S(!1)}}async function Le(){if(w){if(!n){He({type:"cart-checkout"}),q();return}if(Date.now()-je.current>dt){E(null),J(null),await z();return}$(null),Re(w.buyable)}}async function ma(){if(de){try{sessionStorage.setItem(re,JSON.stringify(P.getState().items))}catch{}S(!0);try{const a=await at(de,n?{address:n.address,identity:n.identity}:void 0);if(a.url){window.location.href=a.url;return}B("/credits")}catch(a){try{sessionStorage.removeItem(re)}catch{}O(a,{flow:"cart_buy_credits"}),g({phase:"error",message:t("buyModal.error.creditsCheckout")})}finally{S(!1)}}}const Be=j.useRef(!1);j.useEffect(()=>{if(!n||Be.current||!Ka("cart-checkout"))return;Be.current=!0;const a=setTimeout(()=>void z(),0);return()=>clearTimeout(a)},[n]);const ze=j.useRef(!1);j.useEffect(()=>{if(!(F!=null&&F.resumeCheckout)||ze.current)return;ze.current=!0,D.current=F.creditsAdded??null;try{const s=sessionStorage.getItem(re);if(s){sessionStorage.removeItem(re);const c=JSON.parse(s);Array.isArray(c)&&c.length&&R(c)}}catch{}d.invalidateQueries({queryKey:["usd-balance"]});const a=setTimeout(()=>void z(),0);return()=>clearTimeout(a)},[F==null?void 0:F.resumeCheckout]);const K=aa||(h==null?void 0:h.phase)==="processing";return i.length===0&&!h?e.jsx("div",{className:"checkout checkout--empty",children:e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>B(-1),type:"button",children:[e.jsx(A,{name:"arrow-left"}),t("nav.cart")]}),e.jsxs("section",{className:"checkout__panel cart-empty","data-testid":"cart-empty",children:[e.jsx(A,{name:"cart-plus",size:110,className:"cart-empty__icon"}),e.jsxs("div",{className:"cart-empty__text",children:[e.jsx("p",{className:"cart-empty__title",children:t("cart.empty.title")}),e.jsx("p",{className:"cart-empty__body",children:t("cart.empty.body")})]}),e.jsx(te,{className:"cart-empty__cta",to:"/assets",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:()=>B(-1),type:"button",children:[e.jsx(A,{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:()=>B(-1),type:"button","aria-label":t("cart.goBack"),children:e.jsx(A,{name:"arrow-left"})}),e.jsx("h1",{className:"checkout__panel-title",children:t("cart.panelTitle",{count:sa})}),Ze?e.jsxs("button",{className:"checkout__fitting",onClick:()=>T(!0),disabled:K,children:[e.jsx(A,{name:"fitting-room"}),t("cart.fittingRoom")]}):null]}),e.jsxs("section",{className:"checkout__panel",children:[e.jsx("div",{className:"checkout__list",children:i.map(a=>{const s=ia.get(a.id),c=s?s.priceCredits:a.priceCredits,r=!!s&&s.priceCredits!==a.priceCredits,l=!a.tokenId,u=a.quantity,p=typeof a.available=="number"&&u>=a.available,y=c*u,k=!!M[a.id],_=Na(a),m=Ne[a.id],Q=!Oe(m),x=m==="sold-out"?t("cart.availability.soldOut"):t("cart.availability.unavailable");return e.jsxs("div",{className:`checkout__card${Q?" is-unavailable":""}`,children:[e.jsxs("div",{className:"checkout__thumb",children:[_?e.jsx(te,{className:"checkout__thumb-link",to:_,state:{item:a,tradeId:a.tradeId},"aria-label":a.name,children:a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:a.name}):null}):a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:a.name}):null,e.jsx("span",{className:"checkout__thumb-check","aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"checkout__info",children:[e.jsxs("div",{className:"checkout__desc",children:[_?e.jsx(te,{className:"checkout__name",to:_,state:{item:a,tradeId:a.tradeId},title:a.name,children:a.name}):e.jsx("div",{className:"checkout__name",title:a.name,children:a.name}),a.creator?e.jsx(wa,{address:a.creator,className:"checkout__creator",linkToProfile:!0}):null,l?e.jsxs("span",{className:"checkout__creator-tag","data-testid":"cart-creator-tag",children:[e.jsx(A,{name:"buy-from-creator",className:"checkout__creator-tag-ico","aria-hidden":!0}),t("cart.creatorTag")]}):null]}),e.jsx("div",{className:"checkout__foot",children:Q?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"checkout__unavailable",children:[e.jsx(A,{name:"warning-fill",size:24,className:"checkout__warn","aria-hidden":!0}),x]}),_?e.jsx(te,{className:"checkout__resales",to:_,state:{item:a,tradeId:a.tradeId},children:t("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[l?e.jsxs("div",{className:"checkout__stepper",children:[e.jsx("button",{className:"checkout__step",onClick:()=>ee(()=>N(a.id)),disabled:K||u<=1,"aria-label":t("cart.decreaseQuantity",{name:a.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:u}),e.jsx("button",{className:"checkout__step",onClick:()=>ee(()=>C(a.id)),disabled:K||p,"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(L,{className:"checkout__price-ico"})," ",y,r?e.jsx("span",{className:"checkout__price-was",children:a.priceCredits*u}):null]})]})})]}),e.jsxs("div",{className:"checkout__actions",children:[e.jsx("button",{className:`checkout__fav${k?" is-on":""}`,onClick:()=>ce(a),"aria-label":k?t("cart.removeFromFavorites",{name:a.name}):t("cart.addToFavorites",{name:a.name}),title:k?t("assetCard.removeFromFavorites"):t("assetCard.addToFavorites"),children:e.jsx(A,{name:k?"heart-solid":"heart"})}),e.jsx("button",{className:"checkout__remove",onClick:()=>ee(()=>o(a.id)),disabled:K,"aria-label":t("cart.remove",{name:a.name}),title:t("cart.removeTitle"),children:e.jsx(A,{name:"trash",size:24})})]})]},a.id)})}),e.jsx("div",{className:"checkout__utils",children:e.jsx("button",{className:"link",onClick:()=>ee(I),disabled:K,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:na})}),e.jsxs("span",{className:"checkout__total-side",children:[e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(L,{className:"checkout__total-ico"})," ",Me]}),Ae&&(V??0n)>0n?e.jsx("span",{className:"checkout__total-rate","data-testid":"cart-mana-rate",children:Ae}):null]})]}),Z.options.length>0||Z.manaShortfall?e.jsx(Ye,{options:Z.options,totalCents:X,shortfall:Z.manaShortfall,creditsLabel:w?t("marketCheckout.confirmPurchase"):t("cart.buyWithCredits"),busy:K||he,onPay:a=>void(w?Le():z(a))}):e.jsx("button",{className:"checkout__cta",onClick:()=>void(w?Le():z()),disabled:K||he,children:K?t("cart.working"):w?t("marketCheckout.confirmPurchase"):t("assetCard.buyNow")}),he?e.jsx("p",{className:"muted checkout__msg",children:t("cart.allUnavailable")}):null,n?null:e.jsx("p",{className:"muted checkout__msg",children:t("cart.signInHint")}),w?e.jsx("p",{className:"muted checkout__msg",children:t("cart.priceChanged")}):null,Ce?e.jsx("p",{className:"muted checkout__msg",children:Ce}):null,e.jsx(rt,{message:ea,className:"checkout__msg"})]})]})]})]}),Se.length>0?e.jsx("div",{className:"cart-upsell",children:e.jsx(Qa,{title:t("cart.youMightAlsoLike"),items:Se})}):null,ye&&n?e.jsx(Ra,{auth:ye.auth,signer:n.signer,title:t("authorizeStep.manaTitle"),name:t("authorizeStep.manaName"),reason:t("authorizeStep.manaReason"),icon:e.jsx("img",{src:Ta,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:a}=ye;ae(null),a()},onCancel:()=>ae(null),onClose:()=>ae(null)}):null,h?e.jsx(ct,{phase:h.phase,balanceCredits:Y,onClose:oa,stage:h.phase==="processing"?h.stage:void 0,step:h.phase==="processing"?h.step:void 0,total:h.phase==="processing"?h.total:void 0,isSelfCustody:Ma(n==null?void 0:n.providerType),options:h.phase==="choose"?ua(h).options:void 0,onPay:ha,totalCents:h.phase==="choose"?h.totalCents:void 0,totalManaWei:h.phase==="choose"?h.manaWei:void 0,totalCredits:h.phase==="choose"?xe(h.lines):void 0,lines:h.phase==="nofunds"?h.lines:void 0,shortfallCredits:h.phase==="nofunds"?h.shortfall:void 0,packs:H,selectedPack:de,onSelectPack:ke,onBuyPacks:()=>void ma(),message:h.phase==="error"?h.message:void 0,onRetry:()=>void z()}):null]})}export{At as Cart};
@@ -1,4 +1,4 @@
1
- import{V as N,W as U,X as w,Y as z,Z as o,$ as E,a0 as c,a1 as I,a2 as g,a3 as D,R}from"./index-BFPNYe8x.js";import{r as W,j as v}from"./react-BW1xvPTF.js";function F(r){return N("MuiCircularProgress",r)}U("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const K=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,S,b,$;const t=44,V=R(P||(P=l`
1
+ import{V as N,W as U,X as w,Y as z,Z as o,$ as E,a0 as c,a1 as I,a2 as g,a3 as D,R}from"./index-CEUqEDHj.js";import{r as W,j as v}from"./react-BW1xvPTF.js";function F(r){return N("MuiCircularProgress",r)}U("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const K=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,S,b,$;const t=44,V=R(P||(P=l`
2
2
  0% {
3
3
  transform: rotate(0deg);
4
4
  }
@@ -1,4 +1,4 @@
1
- import{j as e,r as p,d as O,u as Q}from"./react-BW1xvPTF.js";import{K as N,s as v,ay as Y,az as E,I as Z,t,m as V,J as W,n as X,x as ee,M as ae,aA as te,e as re,aB as se}from"./index-BFPNYe8x.js";import{E as oe}from"./ErrorNotice-BG40E5Ff.js";import{d as ie,g as ce,a as ne,A as le}from"./collection-D7HQMUIe.js";import{u as de}from"./useStore-Bo6L1SFA.js";import{d as F,a as me,F as pe,e as ue,S as R,b as ge}from"./categories-BwvbYi6M.js";import{L as xe}from"./LoadMore-C2uaqP2N.js";import{u as he}from"./useInfiniteGrid-BBNOO0mR.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";const be=v.section`
1
+ import{j as e,r as p,d as O,u as Q}from"./react-BW1xvPTF.js";import{K as N,s as v,ay as Y,az as E,I as Z,t,m as V,J as W,n as X,x as ee,M as ae,aA as te,e as re,aB as se}from"./index-CEUqEDHj.js";import{E as oe}from"./ErrorNotice-BG40E5Ff.js";import{d as ie,g as ce,a as ne,A as le}from"./collection-4qJRowPN.js";import{u as de}from"./useStore-BF0NEfcO.js";import{d as F,a as me,F as pe,e as ue,S as R,b as ge}from"./categories-CQDU6eKt.js";import{L as xe}from"./LoadMore-Cv8ieNqf.js";import{u as he}from"./useInfiniteGrid-CiDuQRnP.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.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,4 +1,4 @@
1
- import{j as e,r as w}from"./react-BW1xvPTF.js";import{s as l,K as r,t as m,C as R,A as v,aL as C,e as O,R as U,I as T,J as G,o as $,r as _,q as H,aM as L,M as J}from"./index-BFPNYe8x.js";import{s as K,i as F,A as P,a as B,r as V,m as Y,e as Z}from"./authorizations-t9AL68YM.js";import{i as q}from"./errors-D-hio89k.js";import{E as X}from"./ErrorNotice-BG40E5Ff.js";import{b as Q}from"./buy-84sizoxr.js";import{g as ee,d as te}from"./trade-encoding-DcECym8l.js";import{s as ne,M as ae,E as re}from"./sendMetaTransaction-DNedK3Cr.js";import{I as se,C as oe}from"./ethers-CtVvB8eG.js";const S="shop:resume_after_signin",ie=900*1e3;function Ge(n){try{sessionStorage.setItem(S,JSON.stringify({...n,at:Date.now()}))}catch{}}function He(n){let t;try{t=sessionStorage.getItem(S)}catch{return null}if(!t)return null;try{sessionStorage.removeItem(S)}catch{}let a;try{a=JSON.parse(t)}catch{return null}return!a||a.type!==n||typeof a.at!="number"||Date.now()-a.at>ie?null:a.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:a.path}}function ce(n,t){return(n+t-1n)/t}function le(n,t,a){return n<=0||t<=0?0n:n>=t?a:ce(a*BigInt(n),BigInt(t))}function Je(n){var x,f,y;const t=Number.isFinite(n.priceCents)?Math.max(0,Math.trunc(n.priceCents)):0,a=Number.isFinite(n.balanceCents)?Math.max(0,Math.trunc(n.balanceCents)):0,s=n.priceManaWei>0n?n.priceManaWei:0n,i=n.manaBalanceWei>0n?n.manaBalanceWei:0n;if(t<=0)return{options:[],preferred:null,manaShortfall:null};const o=[];if(a>=t&&o.push({method:"credits",creditsCents:t,manaWei:0n}),s>0n&&a>0&&a<t){const c=t-a,g=le(c,t,s);i>=g&&o.push({method:"combined",creditsCents:a,manaWei:g})}s>0n&&i>=s&&o.push({method:"mana",creditsCents:0,manaWei:s});const d=((x=o.find(c=>c.method==="credits"))==null?void 0:x.method)??((f=o.find(c=>c.method==="combined"))==null?void 0:f.method)??((y=o.find(c=>c.method==="mana"))==null?void 0:y.method)??null,b=!o.some(c=>c.method==="mana"||c.method==="combined")&&s>0n&&i>0n?{manaWei:i,manaCents:de(i,t,s),priceCents:t}:null;return{options:o,preferred:d,manaShortfall:b}}function de(n,t,a){return Number(n*BigInt(t)/a)}function Ke(n,t){let a=Number.isFinite(t)?Math.max(0,Math.trunc(t)):0;return n.map(s=>{const i=Number.isFinite(s)?Math.max(0,Math.trunc(s)):0,o=Math.min(i,a);return a-=o,o})}function k(n){return Number.isFinite(n)?Math.max(0,n)/10:0}function Ve(n,t){return n.options.find(a=>a.method===t)??null}function Ye(n,t){if(!Number.isFinite(n)||n<=0||t<=0n)return null;const a=n/10;return Number(t)/1e18/a}const A="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group%201'%3e%3cpath%20id='Vector'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%202L22%2012L12%2022L2%2012L12%202ZM12%204.8L19.2%2012L12%2019.2L4.8%2012L12%204.8ZM12%2015.6C12.9548%2015.6001%2013.8705%2015.2209%2014.5457%2014.5459C15.2209%2013.8708%2015.6003%2012.9552%2015.6004%2012.0004C15.6005%2011.0456%2015.2213%2010.1299%2014.5463%209.45471C13.8712%208.7795%2012.9556%208.40011%2012.0008%208.4C11.0461%208.4%2010.1304%208.77928%209.45525%209.45442C8.78012%2010.1295%208.40083%2011.0452%208.40083%2012C8.40083%2012.9548%208.78012%2013.8705%209.45525%2014.5456C10.1304%2015.2207%2011.0461%2015.6%2012.0008%2015.6H12Z'%20fill='white'/%3e%3cg%20id='Rectangle%201'%3e%3c/g%3e%3c/g%3e%3c/svg%3e",ue=l.div`
1
+ import{j as e,r as w}from"./react-BW1xvPTF.js";import{s as l,K as r,t as m,C as R,A as v,aL as C,e as O,R as U,I as T,J as G,o as $,r as _,q as H,aM as L,M as J}from"./index-CEUqEDHj.js";import{s as K,i as F,A as P,a as B,r as V,m as Y,e as Z}from"./authorizations-Bt-yiKpU.js";import{i as q}from"./errors-CGr_h4qk.js";import{E as X}from"./ErrorNotice-BG40E5Ff.js";import{b as Q}from"./buy-C8thJCOQ.js";import{g as ee,d as te}from"./trade-encoding-rbwEO5I2.js";import{s as ne,M as ae,E as re}from"./sendMetaTransaction-DnNlMy1f.js";import{I as se,C as oe}from"./ethers-CtVvB8eG.js";const S="shop:resume_after_signin",ie=900*1e3;function Ge(n){try{sessionStorage.setItem(S,JSON.stringify({...n,at:Date.now()}))}catch{}}function He(n){let t;try{t=sessionStorage.getItem(S)}catch{return null}if(!t)return null;try{sessionStorage.removeItem(S)}catch{}let a;try{a=JSON.parse(t)}catch{return null}return!a||a.type!==n||typeof a.at!="number"||Date.now()-a.at>ie?null:a.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:a.path}}function ce(n,t){return(n+t-1n)/t}function le(n,t,a){return n<=0||t<=0?0n:n>=t?a:ce(a*BigInt(n),BigInt(t))}function Je(n){var x,f,y;const t=Number.isFinite(n.priceCents)?Math.max(0,Math.trunc(n.priceCents)):0,a=Number.isFinite(n.balanceCents)?Math.max(0,Math.trunc(n.balanceCents)):0,s=n.priceManaWei>0n?n.priceManaWei:0n,i=n.manaBalanceWei>0n?n.manaBalanceWei:0n;if(t<=0)return{options:[],preferred:null,manaShortfall:null};const o=[];if(a>=t&&o.push({method:"credits",creditsCents:t,manaWei:0n}),s>0n&&a>0&&a<t){const c=t-a,g=le(c,t,s);i>=g&&o.push({method:"combined",creditsCents:a,manaWei:g})}s>0n&&i>=s&&o.push({method:"mana",creditsCents:0,manaWei:s});const d=((x=o.find(c=>c.method==="credits"))==null?void 0:x.method)??((f=o.find(c=>c.method==="combined"))==null?void 0:f.method)??((y=o.find(c=>c.method==="mana"))==null?void 0:y.method)??null,b=!o.some(c=>c.method==="mana"||c.method==="combined")&&s>0n&&i>0n?{manaWei:i,manaCents:de(i,t,s),priceCents:t}:null;return{options:o,preferred:d,manaShortfall:b}}function de(n,t,a){return Number(n*BigInt(t)/a)}function Ke(n,t){let a=Number.isFinite(t)?Math.max(0,Math.trunc(t)):0;return n.map(s=>{const i=Number.isFinite(s)?Math.max(0,Math.trunc(s)):0,o=Math.min(i,a);return a-=o,o})}function k(n){return Number.isFinite(n)?Math.max(0,n)/10:0}function Ve(n,t){return n.options.find(a=>a.method===t)??null}function Ye(n,t){if(!Number.isFinite(n)||n<=0||t<=0n)return null;const a=n/10;return Number(t)/1e18/a}const A="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group%201'%3e%3cpath%20id='Vector'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%202L22%2012L12%2022L2%2012L12%202ZM12%204.8L19.2%2012L12%2019.2L4.8%2012L12%204.8ZM12%2015.6C12.9548%2015.6001%2013.8705%2015.2209%2014.5457%2014.5459C15.2209%2013.8708%2015.6003%2012.9552%2015.6004%2012.0004C15.6005%2011.0456%2015.2213%2010.1299%2014.5463%209.45471C13.8712%208.7795%2012.9556%208.40011%2012.0008%208.4C11.0461%208.4%2010.1304%208.77928%209.45525%209.45442C8.78012%2010.1295%208.40083%2011.0452%208.40083%2012C8.40083%2012.9548%208.78012%2013.8705%209.45525%2014.5456C10.1304%2015.2207%2011.0461%2015.6%2012.0008%2015.6H12Z'%20fill='white'/%3e%3cg%20id='Rectangle%201'%3e%3c/g%3e%3c/g%3e%3c/svg%3e",ue=l.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 12px;
@@ -1 +1 @@
1
- import{u as z,j as e,L as re,d as se,b as te,r as j}from"./react-BW1xvPTF.js";import{aC as oe,aD as ce,z as le,t as a,aE as E,B as ne,ay as D,u as ie,az as K,I,m as de,x as me,M as ue,as as he,aF as ge,e as xe}from"./index-BFPNYe8x.js";import{d as _e,g as pe,a as Ne,A as je}from"./collection-D7HQMUIe.js";import{u as be,L as fe}from"./useStore-Bo6L1SFA.js";import{d as $,a as ve,S as w,F as Ce,e as we,b as ke}from"./categories-BwvbYi6M.js";import{L as B}from"./LoadMore-C2uaqP2N.js";import{u as R}from"./useInfiniteGrid-BBNOO0mR.js";import{E as T}from"./ErrorNotice-BG40E5Ff.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";function Pe({collection:t,cover:r,itemCount:o}){const n=z(),{contractAddress:m,name:g,creator:x}=t,N=r==null||o==null,{data:i}=oe(m,N),p=r==null?(i==null?void 0:i.items)??[]:[],h=o??(i==null?void 0:i.total);function _(){n(`/collection/${m}`)}return e.jsxs("article",{className:"coll-card",role:"link",tabIndex:0,onClick:_,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),_())},children:[e.jsx("div",{className:"coll-card__media",children:r?e.jsx("img",{className:"coll-card__img","data-testid":"coll-card-img",src:r,alt:"",loading:"lazy"}):p.length>0?e.jsx(ce,{items:p,className:"coll-card__cover"}):null}),e.jsxs("div",{className:"coll-card__body",children:[e.jsx("h3",{className:"coll-card__name",title:g,children:g}),e.jsxs("div",{className:"coll-card__meta",children:[x?e.jsx(le,{address:x,className:"coll-card__creator",linkToProfile:!0}):e.jsx("span",{className:"coll-card__creator",children:" "}),e.jsx("span",{className:"coll-card__count",children:h==null?"…":a("collectionCard.itemCount",{count:h})})]}),e.jsx("button",{className:"coll-card__view",onClick:d=>{d.stopPropagation(),_()},tabIndex:-1,children:a("collectionCard.viewCollection")})]})]})}function ye({address:t,className:r=""}){const o=E(m=>m.followed.includes(t.toLowerCase())),n=E(m=>m.toggle);return t?e.jsx(ne,{type:"button",size:"sm",variant:o?"ghost":"outline",className:r||void 0,"aria-pressed":o,title:o?a("creator.unfollowTitle"):a("creator.followTitle"),onClick:()=>n(t),children:o?a("creator.following"):a("creator.follow")}):null}const Se={website:"website",twitter:"twitter",discord:"discord",facebook:"facebook"};function Le({address:t}){var d,b;const{data:r}=D(t),{data:o}=be(t),n=ie(l=>{var f;return(f=l.session)==null?void 0:f.address}),m=!!n&&n.toLowerCase()===t.toLowerCase(),g=(r==null?void 0:r.name)||K(t),x=(b=(d=r==null?void 0:r.avatar)==null?void 0:d.snapshots)==null?void 0:b.face256,N=(o==null?void 0:o.cover)||_e,i=o==null?void 0:o.description,p=`${de.profileUrl}/${t}`,h=fe.filter(l=>o==null?void 0:o.links[l]),_=pe(Ne({name:r==null?void 0:r.name,hasClaimedName:r==null?void 0:r.hasClaimedName,ethAddress:(r==null?void 0:r.ethAddress)??t}));return e.jsxs("section",{className:"creator-hero","aria-label":`${g} storefront`,children:[e.jsxs("div",{className:"creator-hero__cover",children:[e.jsx("img",{className:"creator-hero__cover-img",src:N,alt:"",loading:"eager"}),e.jsx("div",{className:"creator-hero__scrim","aria-hidden":!0})]}),(h.length>0||m)&&e.jsxs("div",{className:"creator-hero__links",children:[h.map(l=>e.jsx("a",{className:"creator-hero__link","data-testid":"creator-hero-link",href:(o==null?void 0:o.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:a(`creator.link.${l}`),"aria-label":a(`creator.link.${l}`),children:e.jsx(I,{name:Se[l]})},l)),m&&e.jsx(re,{className:"creator-hero__link creator-hero__edit",to:"/store-settings",title:a("creator.editStore"),"aria-label":a("creator.editStore"),children:e.jsx(I,{name:"pen"})})]}),e.jsxs("div",{className:"creator-hero__body",children:[x?e.jsx("img",{className:"creator-hero__ava",src:x,alt:"",loading:"eager",style:{backgroundColor:_}}):e.jsx("span",{className:"creator-hero__ava creator-hero__ava--ph","aria-hidden":!0,style:{backgroundColor:_}}),e.jsxs("div",{children:[e.jsx("h2",{className:"creator-hero__name",children:g}),i?e.jsx("p",{className:"creator-hero__desc",children:i}):null]}),e.jsxs("div",{className:"creator-hero__actions",children:[e.jsx("a",{className:"creator-hero__view","data-testid":"creator-hero-view",href:p,target:"_blank",rel:"noopener noreferrer",children:a("creator.viewProfile")}),e.jsx(ye,{address:t,className:"creator-hero__follow"})]})]})]})}const U=48;function Oe(){const{address:t}=se(),r=z(),[o]=te(),n=o.has("collections"),{data:m}=D(t),g=(m==null?void 0:m.name)||(t?K(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,O]=j.useState("newest"),y=d&&!Number.isNaN(Number(d))?Number(d):void 0,S=l&&!Number.isNaN(Number(l))?Number(l):void 0,G=i?ke[i]:void 0,H=($.find(s=>s.key===P)??$[0]).server,L={creator:t,category:x,rarities:h.length?h:void 0,wearableCategories:G,minPriceCredits:y,maxPriceCredits:S,sortBy:H},{items:v,total:Y,isLoading:C,error:A,hasNextPage:W,isFetchingNextPage:F,fetchNextPage:Z}=R(["creator-listings",L],s=>he({...L,first:U,skip:s}),{enabled:!!t&&!n}),u=R(["creator-collections",t],s=>ge(t,{first:U,skip:s}).then(c=>({items:c.collections,total:c.total})),{enabled:!!t&&n});function q(s){N(s),p(null),n&&M()}function M(){const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}`:""},{replace:!0})}function J(){if(n){M();return}const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function Q(s){_(c=>c.includes(s)?c.filter(ae=>ae!==s):[...c,s])}function V(){N("wearable"),p(null),_([]),b(""),f("")}const k=!!(y||S),X=k?`${d||"0"}–${l||"∞"}`:a("filter.price"),ee=x!=="wearable"||!!i||h.length>0||k;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":a("creator.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>r("/assets"),children:a("creator.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:g})]}),t?e.jsx(Le,{address:t}):null,!n&&!C&&v.length>0?e.jsx(je,{items:v,source:"creator"}):null,e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(ve,{category:x,subCategory:i,onCategory:q,onSub:p,title:a("creator.category"),flat:!0,collections:n,onCollections:J})}),e.jsx("div",{className:"browse__main",children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"creator-collections__bar",children:e.jsx("span",{className:"assets__count",children:u.isLoading?"…":a("creator.collectionsCount",{count:u.total})})}),u.error?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid grid--collections",children:u.isLoading?e.jsx(w,{count:9}):e.jsxs(e.Fragment,{children:[u.items.map(s=>e.jsx(Pe,{collection:s,itemCount:s.itemCount},s.contractAddress)),u.isFetchingNextPage?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:u.hasNextPage,isFetching:u.isFetchingNextPage,onLoadMore:()=>void u.fetchNextPage()}),!u.isLoading&&!u.error&&u.items.length===0?e.jsx("p",{className:"muted",children:a("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{rarities:h,onToggleRarity:Q,sort:P,onSort:O,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{Oe as Creator,Oe as default};
1
+ import{u as z,j as e,L as re,d as se,b as te,r as j}from"./react-BW1xvPTF.js";import{aC as oe,aD as ce,z as le,t as a,aE as E,B as ne,ay as D,u as ie,az as K,I,m as de,x as me,M as ue,as as he,aF as ge,e as xe}from"./index-CEUqEDHj.js";import{d as _e,g as pe,a as Ne,A as je}from"./collection-4qJRowPN.js";import{u as be,L as fe}from"./useStore-BF0NEfcO.js";import{d as $,a as ve,S as w,F as Ce,e as we,b as ke}from"./categories-CQDU6eKt.js";import{L as B}from"./LoadMore-Cv8ieNqf.js";import{u as R}from"./useInfiniteGrid-CiDuQRnP.js";import{E as T}from"./ErrorNotice-BG40E5Ff.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";function Pe({collection:t,cover:r,itemCount:o}){const n=z(),{contractAddress:m,name:g,creator:x}=t,N=r==null||o==null,{data:i}=oe(m,N),p=r==null?(i==null?void 0:i.items)??[]:[],h=o??(i==null?void 0:i.total);function _(){n(`/collection/${m}`)}return e.jsxs("article",{className:"coll-card",role:"link",tabIndex:0,onClick:_,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),_())},children:[e.jsx("div",{className:"coll-card__media",children:r?e.jsx("img",{className:"coll-card__img","data-testid":"coll-card-img",src:r,alt:"",loading:"lazy"}):p.length>0?e.jsx(ce,{items:p,className:"coll-card__cover"}):null}),e.jsxs("div",{className:"coll-card__body",children:[e.jsx("h3",{className:"coll-card__name",title:g,children:g}),e.jsxs("div",{className:"coll-card__meta",children:[x?e.jsx(le,{address:x,className:"coll-card__creator",linkToProfile:!0}):e.jsx("span",{className:"coll-card__creator",children:" "}),e.jsx("span",{className:"coll-card__count",children:h==null?"…":a("collectionCard.itemCount",{count:h})})]}),e.jsx("button",{className:"coll-card__view",onClick:d=>{d.stopPropagation(),_()},tabIndex:-1,children:a("collectionCard.viewCollection")})]})]})}function ye({address:t,className:r=""}){const o=E(m=>m.followed.includes(t.toLowerCase())),n=E(m=>m.toggle);return t?e.jsx(ne,{type:"button",size:"sm",variant:o?"ghost":"outline",className:r||void 0,"aria-pressed":o,title:o?a("creator.unfollowTitle"):a("creator.followTitle"),onClick:()=>n(t),children:o?a("creator.following"):a("creator.follow")}):null}const Se={website:"website",twitter:"twitter",discord:"discord",facebook:"facebook"};function Le({address:t}){var d,b;const{data:r}=D(t),{data:o}=be(t),n=ie(l=>{var f;return(f=l.session)==null?void 0:f.address}),m=!!n&&n.toLowerCase()===t.toLowerCase(),g=(r==null?void 0:r.name)||K(t),x=(b=(d=r==null?void 0:r.avatar)==null?void 0:d.snapshots)==null?void 0:b.face256,N=(o==null?void 0:o.cover)||_e,i=o==null?void 0:o.description,p=`${de.profileUrl}/${t}`,h=fe.filter(l=>o==null?void 0:o.links[l]),_=pe(Ne({name:r==null?void 0:r.name,hasClaimedName:r==null?void 0:r.hasClaimedName,ethAddress:(r==null?void 0:r.ethAddress)??t}));return e.jsxs("section",{className:"creator-hero","aria-label":`${g} storefront`,children:[e.jsxs("div",{className:"creator-hero__cover",children:[e.jsx("img",{className:"creator-hero__cover-img",src:N,alt:"",loading:"eager"}),e.jsx("div",{className:"creator-hero__scrim","aria-hidden":!0})]}),(h.length>0||m)&&e.jsxs("div",{className:"creator-hero__links",children:[h.map(l=>e.jsx("a",{className:"creator-hero__link","data-testid":"creator-hero-link",href:(o==null?void 0:o.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:a(`creator.link.${l}`),"aria-label":a(`creator.link.${l}`),children:e.jsx(I,{name:Se[l]})},l)),m&&e.jsx(re,{className:"creator-hero__link creator-hero__edit",to:"/store-settings",title:a("creator.editStore"),"aria-label":a("creator.editStore"),children:e.jsx(I,{name:"pen"})})]}),e.jsxs("div",{className:"creator-hero__body",children:[x?e.jsx("img",{className:"creator-hero__ava",src:x,alt:"",loading:"eager",style:{backgroundColor:_}}):e.jsx("span",{className:"creator-hero__ava creator-hero__ava--ph","aria-hidden":!0,style:{backgroundColor:_}}),e.jsxs("div",{children:[e.jsx("h2",{className:"creator-hero__name",children:g}),i?e.jsx("p",{className:"creator-hero__desc",children:i}):null]}),e.jsxs("div",{className:"creator-hero__actions",children:[e.jsx("a",{className:"creator-hero__view","data-testid":"creator-hero-view",href:p,target:"_blank",rel:"noopener noreferrer",children:a("creator.viewProfile")}),e.jsx(ye,{address:t,className:"creator-hero__follow"})]})]})]})}const U=48;function Oe(){const{address:t}=se(),r=z(),[o]=te(),n=o.has("collections"),{data:m}=D(t),g=(m==null?void 0:m.name)||(t?K(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,O]=j.useState("newest"),y=d&&!Number.isNaN(Number(d))?Number(d):void 0,S=l&&!Number.isNaN(Number(l))?Number(l):void 0,G=i?ke[i]:void 0,H=($.find(s=>s.key===P)??$[0]).server,L={creator:t,category:x,rarities:h.length?h:void 0,wearableCategories:G,minPriceCredits:y,maxPriceCredits:S,sortBy:H},{items:v,total:Y,isLoading:C,error:A,hasNextPage:W,isFetchingNextPage:F,fetchNextPage:Z}=R(["creator-listings",L],s=>he({...L,first:U,skip:s}),{enabled:!!t&&!n}),u=R(["creator-collections",t],s=>ge(t,{first:U,skip:s}).then(c=>({items:c.collections,total:c.total})),{enabled:!!t&&n});function q(s){N(s),p(null),n&&M()}function M(){const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}`:""},{replace:!0})}function J(){if(n){M();return}const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function Q(s){_(c=>c.includes(s)?c.filter(ae=>ae!==s):[...c,s])}function V(){N("wearable"),p(null),_([]),b(""),f("")}const k=!!(y||S),X=k?`${d||"0"}–${l||"∞"}`:a("filter.price"),ee=x!=="wearable"||!!i||h.length>0||k;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":a("creator.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>r("/assets"),children:a("creator.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:g})]}),t?e.jsx(Le,{address:t}):null,!n&&!C&&v.length>0?e.jsx(je,{items:v,source:"creator"}):null,e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(ve,{category:x,subCategory:i,onCategory:q,onSub:p,title:a("creator.category"),flat:!0,collections:n,onCollections:J})}),e.jsx("div",{className:"browse__main",children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"creator-collections__bar",children:e.jsx("span",{className:"assets__count",children:u.isLoading?"…":a("creator.collectionsCount",{count:u.total})})}),u.error?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid grid--collections",children:u.isLoading?e.jsx(w,{count:9}):e.jsxs(e.Fragment,{children:[u.items.map(s=>e.jsx(Pe,{collection:s,itemCount:s.itemCount},s.contractAddress)),u.isFetchingNextPage?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:u.hasNextPage,isFetching:u.isFetchingNextPage,onLoadMore:()=>void u.fetchNextPage()}),!u.isLoading&&!u.error&&u.items.length===0?e.jsx("p",{className:"muted",children:a("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{rarities:h,onToggleRarity:Q,sort:P,onSort:O,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{Oe as Creator,Oe as default};
@@ -1 +1 @@
1
- import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-Ccq1reIt.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-DN-OLR2r.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-CCVyEXOJ.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-DB0uJXc-.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
@@ -1,4 +1,4 @@
1
- import{u as ae,b as de,r as c,j as t}from"./react-BW1xvPTF.js";import{s as i,K as e,R,x as ce,t as r,u as le,b as pe,j as g,an as xe,e as l,J as G,k as H,I as J,C as Z,f as ue}from"./index-BFPNYe8x.js";import{R as M}from"./resume-buy-Bf0zIH7y.js";import{R as ge}from"./cart-checkout-K77UDHy3.js";import{l as he}from"./loader-logo-BzY9EKdC.js";import{u as fe,p as me,c as be,i as we}from"./useCreditPacks-BAZLy3JX.js";import{C as ye}from"./CircularProgress-BmwVvF17.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";const j="https://cdn.decentraland.org/@dcl/shop/0.1.0-30277401547.commit-e877307/assets/pack-coins-BDh1ZDbh.webp",ee="https://cdn.decentraland.org/@dcl/shop/0.1.0-30277401547.commit-e877307/assets/pack-stacks-D-V2jSHW.webp",te="https://cdn.decentraland.org/@dcl/shop/0.1.0-30277401547.commit-e877307/assets/pack-chest-BX_j84xW.webp",ke="https://cdn.decentraland.org/@dcl/shop/0.1.0-30277401547.commit-e877307/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",je="https://cdn.decentraland.org/@dcl/shop/0.1.0-30277401547.commit-e877307/assets/packs-backdrop-BcXiUPeP.webp",N="linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)",$e=i.div`
1
+ import{u as ae,b as de,r as c,j as t}from"./react-BW1xvPTF.js";import{s as i,K as e,R,x as ce,t as r,u as le,b as pe,j as g,an as xe,e as l,J as G,k as H,I as J,C as Z,f as ue}from"./index-CEUqEDHj.js";import{R as M}from"./resume-buy-Bf0zIH7y.js";import{R as ge}from"./cart-checkout-DtChJ5jV.js";import{l as he}from"./loader-logo-BzY9EKdC.js";import{u as fe,p as me,c as be,i as we}from"./useCreditPacks-DPTBuCyg.js";import{C as ye}from"./CircularProgress-BOITSQXA.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";const j="https://cdn.decentraland.org/@dcl/shop/0.1.0-30279564518.commit-0ea36ab/assets/pack-coins-BDh1ZDbh.webp",ee="https://cdn.decentraland.org/@dcl/shop/0.1.0-30279564518.commit-0ea36ab/assets/pack-stacks-D-V2jSHW.webp",te="https://cdn.decentraland.org/@dcl/shop/0.1.0-30279564518.commit-0ea36ab/assets/pack-chest-BX_j84xW.webp",ke="https://cdn.decentraland.org/@dcl/shop/0.1.0-30279564518.commit-0ea36ab/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",je="https://cdn.decentraland.org/@dcl/shop/0.1.0-30279564518.commit-0ea36ab/assets/packs-backdrop-BcXiUPeP.webp",N="linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)",$e=i.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 24px;
@@ -1,4 +1,4 @@
1
- import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-C7gHM4wY.js";import{d as g,r as v}from"./index-DN-OLR2r.js";import{C as c}from"./ConstantsUtil-DTrOBzCe.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-Ccq1reIt.js";import{au as y}from"./NetworkUtil-C1aEwuOK.js";const b=g`
1
+ import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-CKwiZFh4.js";import{d as g,r as v}from"./index-DB0uJXc-.js";import{C as c}from"./ConstantsUtil-DTrOBzCe.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-CCVyEXOJ.js";import{au as y}from"./NetworkUtil-C1aEwuOK.js";const b=g`
2
2
  :host {
3
3
  display: flex;
4
4
  justify-content: center;
@@ -1,4 +1,4 @@
1
- import{u as R,r as h,j as e,L as B}from"./react-BW1xvPTF.js";import{y as U,t as s,e as S,B as k,C as L,j as $,J as Q,x as P,u as W,b as O,n as z,s as F,U as J}from"./index-BFPNYe8x.js";import{i as Y,R as D,f as G}from"./import-AgO0v-a5.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./buy-84sizoxr.js";import"./authorizations-t9AL68YM.js";import"./sendMetaTransaction-DNedK3Cr.js";import"./trade-encoding-DcECym8l.js";import"./mana-rate-BpgRIQMS.js";function H({queue:n,session:T,onClose:j,onDone:o}){const N=R(),d=U(T.providerType),[m,f]=h.useState(()=>n.map(()=>"pending")),[I,M]=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),$("Shop Migrated Listing",{item_id:n[r].item.itemId??n[r].item.oldTradeId??null,contract_address:n[r].item.contractAddress,new_price_credits:n[r].priceCredits,new_price_usd:n[r].priceCredits/10}),t||f(u=>u.map((g,p)=>p===r?"done":g))}catch(u){if(u instanceof D)Q(u,{flow:"import_listing",step:"relist",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(g=>g.map((p,b)=>b===r?"unlisted":p));else{const g=u,p=g.code===4001||/reject|denied|cancel/i.test(g.message??"");p||Q(u,{flow:"import_listing",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(b=>b.map((a,l)=>l===r?p?"skipped":"failed":a))}}}t||M("finished")})(),()=>{t=!0}},[]);const _=m.filter(t=>t==="done").length,v=m.findIndex(t=>t==="active"),x=Math.round(m.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function y(){o(),j()}if(I==="finished"){const t=m.filter(r=>r==="skipped"||r==="failed").length,c=m.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:_>0?s("migrate.successTitle"):s("migrate.nothingTitle")}),e.jsxs("p",{className:"muted",style:{margin:0},children:[_>0?s("migrate.listedSummary",{count:_,currency:S.name}):s("migrate.noneListed"),t>0?" "+s("migrate.skippedSummary",{count:t}):"",c>0?" "+s("migrate.unlistedSummary",{count:c}):""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(k,{variant:"ghost",onClick:y,children:s("getCredits.done")}),c>0?e.jsx(k,{variant:"purple",onClick:()=>{o(),j(),N("/my-assets")},children:s("migrate.goToMyAssets")}):_>0?e.jsx(k,{variant:"purple",onClick:()=>{o(),j(),N("/assets")},children:s("migrate.viewInShop")}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate","data-testid":"modal",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:s("migrate.listingTitle")}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[d?s("migrate.subConfirm"):s("migrate.subManaged")," ",v>=0?s("migrate.progressCount",{current:v+1,total:n.length}):""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${x}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,c)=>e.jsxs("li",{className:`migrate__row migrate__row--${m[c]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||s("migrate.itemFallback")}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(L,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:m[c]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",d?s("migrate.statusConfirm"):s("migrate.statusAdding")]}):m[c]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):m[c]==="skipped"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusSkipped")}):m[c]==="failed"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusFailed")}):m[c]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:s("migrate.unlistedTooltip"),children:s("migrate.statusUnlisted")}):e.jsx("span",{className:"migrate__wait",children:s("migrate.statusWaiting")})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:d?s("migrate.hintConfirm"):s("migrate.hintManaged")})]})})}const A=F(k)`
1
+ import{u as R,r as h,j as e,L as B}from"./react-BW1xvPTF.js";import{y as U,t as s,e as S,B as k,C as L,j as $,J as Q,x as P,u as W,b as O,n as z,s as F,U as J}from"./index-CEUqEDHj.js";import{i as Y,R as D,f as G}from"./import-DaK3l2L4.js";import"./sentry-BV_ZSgtd.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CtVvB8eG.js";import"./intl-CBcMB1D2.js";import"./buy-C8thJCOQ.js";import"./authorizations-Bt-yiKpU.js";import"./sendMetaTransaction-DnNlMy1f.js";import"./trade-encoding-rbwEO5I2.js";import"./mana-rate-D7GRB_Ot.js";function H({queue:n,session:T,onClose:j,onDone:o}){const N=R(),d=U(T.providerType),[m,f]=h.useState(()=>n.map(()=>"pending")),[I,M]=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),$("Shop Migrated Listing",{item_id:n[r].item.itemId??n[r].item.oldTradeId??null,contract_address:n[r].item.contractAddress,new_price_credits:n[r].priceCredits,new_price_usd:n[r].priceCredits/10}),t||f(u=>u.map((g,p)=>p===r?"done":g))}catch(u){if(u instanceof D)Q(u,{flow:"import_listing",step:"relist",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(g=>g.map((p,b)=>b===r?"unlisted":p));else{const g=u,p=g.code===4001||/reject|denied|cancel/i.test(g.message??"");p||Q(u,{flow:"import_listing",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(b=>b.map((a,l)=>l===r?p?"skipped":"failed":a))}}}t||M("finished")})(),()=>{t=!0}},[]);const _=m.filter(t=>t==="done").length,v=m.findIndex(t=>t==="active"),x=Math.round(m.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function y(){o(),j()}if(I==="finished"){const t=m.filter(r=>r==="skipped"||r==="failed").length,c=m.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:_>0?s("migrate.successTitle"):s("migrate.nothingTitle")}),e.jsxs("p",{className:"muted",style:{margin:0},children:[_>0?s("migrate.listedSummary",{count:_,currency:S.name}):s("migrate.noneListed"),t>0?" "+s("migrate.skippedSummary",{count:t}):"",c>0?" "+s("migrate.unlistedSummary",{count:c}):""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(k,{variant:"ghost",onClick:y,children:s("getCredits.done")}),c>0?e.jsx(k,{variant:"purple",onClick:()=>{o(),j(),N("/my-assets")},children:s("migrate.goToMyAssets")}):_>0?e.jsx(k,{variant:"purple",onClick:()=>{o(),j(),N("/assets")},children:s("migrate.viewInShop")}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate","data-testid":"modal",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:s("migrate.listingTitle")}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[d?s("migrate.subConfirm"):s("migrate.subManaged")," ",v>=0?s("migrate.progressCount",{current:v+1,total:n.length}):""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${x}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,c)=>e.jsxs("li",{className:`migrate__row migrate__row--${m[c]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||s("migrate.itemFallback")}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(L,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:m[c]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",d?s("migrate.statusConfirm"):s("migrate.statusAdding")]}):m[c]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):m[c]==="skipped"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusSkipped")}):m[c]==="failed"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusFailed")}):m[c]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:s("migrate.unlistedTooltip"),children:s("migrate.statusUnlisted")}):e.jsx("span",{className:"migrate__wait",children:s("migrate.statusWaiting")})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:d?s("migrate.hintConfirm"):s("migrate.hintManaged")})]})})}const A=F(k)`
2
2
  margin-top: 10px;
3
3
  `,V=F(k)`
4
4
  padding: 13px 24px;