@dcl/shop 0.1.0-30835612462.commit-48765f9 → 0.1.0-30846189899.commit-4a8ddfb

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/_assets/{Activity-C96oKaM7.js → Activity--xIML69z.js} +3 -3
  2. package/_assets/{AnimatedBackground-Cg4YrmHy.js → AnimatedBackground-COxl8338.js} +1 -1
  3. package/_assets/{Assets-BUbwNh-5.js → Assets-DeYwJmco.js} +2 -2
  4. package/_assets/{Assets.styles-BO8jltml.js → Assets.styles-C4uc13ku.js} +1 -1
  5. package/_assets/{Authorizations-D7hfFylo.js → Authorizations-BNvzVxCi.js} +1 -1
  6. package/_assets/{Cart-DPW25tAG.js → Cart-0pIyJIoa.js} +2 -2
  7. package/_assets/{CircularProgress-B2h31Yy9.js → CircularProgress-BtTBZv-J.js} +1 -1
  8. package/_assets/{Collection-BS21SN6A.js → Collection-CoFyHo3H.js} +1 -1
  9. package/_assets/{CollectionCarousel-WI45XOFA.js → CollectionCarousel-D_-sxfGs.js} +1 -1
  10. package/_assets/Creator-Bz_W5s1y.js +306 -0
  11. package/_assets/{ErrorNotice-q0dn0iRL.js → ErrorNotice-Cx0COdAr.js} +1 -1
  12. package/_assets/{ExchangeController-Dtgh1od6.js → ExchangeController-DmhQDrPJ.js} +1 -1
  13. package/_assets/{GetCredits-D-jeDJ75.js → GetCredits-DoV0Rnfd.js} +1 -1
  14. package/_assets/{HelpersUtil-D2_GPqxX.js → HelpersUtil-CPZu5R17.js} +1 -1
  15. package/_assets/{ImportListings-BNjL24xn.js → ImportListings-ev2izkxg.js} +6 -6
  16. package/_assets/{ItemDetail-BXpWKwPY.js → ItemDetail-C2cicWV9.js} +3 -3
  17. package/_assets/{LoadMore-DoQvuFO_.js → LoadMore-ConDrtOT.js} +1 -1
  18. package/_assets/{MenuList-DOJfvyqr.js → MenuList-DlDqrk3u.js} +1 -1
  19. package/_assets/{MyAssets-DpQnCJPT.js → MyAssets-DkOhTUsa.js} +1 -1
  20. package/_assets/{MyFavorites-DFO63j-P.js → MyFavorites-Ckuq227S.js} +1 -1
  21. package/_assets/{NotFound-BocUG6Wo.js → NotFound-B9xruk4f.js} +1 -1
  22. package/_assets/{NotificationsBell-iaGtBsC9.js → NotificationsBell-CtRATM4e.js} +1 -1
  23. package/_assets/{StoreSettings-Bc_NBrxI.js → StoreSettings-CjoFpkP5.js} +1 -1
  24. package/_assets/{Success-BIMxdHvn.js → Success-BacGrGKk.js} +1 -1
  25. package/_assets/{SwapController-DeKeu3FE.js → SwapController-BHGG_Epq.js} +1 -1
  26. package/_assets/{Tooltip-BLyu7Dfk.js → Tooltip-DWPneKP_.js} +1 -1
  27. package/_assets/{TradeService-CWqv5slk.js → TradeService-Cgcgxq0A.js} +1 -1
  28. package/_assets/{W3MFrameProviderSingleton-1MRMKUrL.js → W3MFrameProviderSingleton-w-RSM5AL.js} +3 -3
  29. package/_assets/{WebCryptoP256-BAvl6xkt.js → WebCryptoP256-CLVtgMXf.js} +1 -1
  30. package/_assets/{authorizations-DDsnY_Zf.js → authorizations-epxR5pjl.js} +1 -1
  31. package/_assets/{basic-BzVRhtZ-.js → basic-BgrqP-TA.js} +1 -1
  32. package/_assets/{biconomy-yl7EuW3B.js → biconomy-Bv1UCxcF.js} +1 -1
  33. package/_assets/{browseLayout.styles-u63rKyzf.js → browseLayout.styles-ChD_QYf4.js} +1 -1
  34. package/_assets/{builder-BO6I7uZQ.js → builder-BY1-lATK.js} +1 -1
  35. package/_assets/{buy-DN9Q4fmJ.js → buy-BI5VTk92.js} +1 -1
  36. package/_assets/{buy-gasless-Cxl5QDDd.js → buy-gasless-CwH-UbWq.js} +1 -1
  37. package/_assets/{categories-DFgZJeSL.js → categories-CeBHtq1-.js} +1 -1
  38. package/_assets/{ccip-5db1OYaq.js → ccip-Bm7ioRrH.js} +1 -1
  39. package/_assets/{ccip-C9MO7Vbh.js → ccip-DILsZUfP.js} +1 -1
  40. package/_assets/{clsx-Dv5E4mS4.js → clsx-BcR9gED7.js} +2 -2
  41. package/_assets/{controller-DNuVvFDa.js → controller-D3R-xyiE.js} +2 -2
  42. package/_assets/{core-Do4xTqpU.js → core-Ce4ORvRb.js} +4 -4
  43. package/_assets/{createSvgIcon-TyRUGFdQ.js → createSvgIcon-CIqvD8A3.js} +4 -4
  44. package/_assets/{custom-Cdk30JmS.js → custom-J02AwXNB.js} +1 -1
  45. package/_assets/{data-capture-DwwEo9Zw.js → data-capture-98wGTR7Y.js} +1 -1
  46. package/_assets/{email-DiU12yVh.js → email-AkcBNJmx.js} +1 -1
  47. package/_assets/{embedded-wallet-Gkjm7p7P.js → embedded-wallet-C1FwO5au.js} +1 -1
  48. package/_assets/{emotion-styled.browser.esm-1jXvUKUZ.js → emotion-styled.browser.esm-Bk3DOklv.js} +1 -1
  49. package/_assets/{engine-BlXXh7Bj.js → engine-CpeXNQNG.js} +1 -1
  50. package/_assets/{errors-BshsHqbY.js → errors-CQ3rltSg.js} +1 -1
  51. package/_assets/{estimate-l1-fee-Jhm2Yxur.js → estimate-l1-fee-D4EobY0t.js} +1 -1
  52. package/_assets/{execute-BrbMEhFX.js → execute-CoTzdWPI.js} +2 -2
  53. package/_assets/{features-WtRCFBGN.js → features-BwG-URCN.js} +1 -1
  54. package/_assets/{fetchTokenMetadata-Bm5qOhHz.js → fetchTokenMetadata-BkvrDuzW.js} +2 -2
  55. package/_assets/{get-ecosystem-wallet-info-Bk3TC-8s.js → get-ecosystem-wallet-info-DBSebSs5.js} +1 -1
  56. package/_assets/{getBalance-D5TAQGrF.js → getBalance-W1kDcffZ.js} +1 -1
  57. package/_assets/{getNFT-CCYMJGO3.js → getNFT-B5NiXJ-r.js} +1 -1
  58. package/_assets/{getNFT-BXhNmL18.js → getNFT-BgKBStfZ.js} +1 -1
  59. package/_assets/{getThemeProps-jxkK7aJF.js → getThemeProps-D9MV0ore.js} +1 -1
  60. package/_assets/{grid.styles-Dc-BunHd.js → grid.styles-BdBYqxJR.js} +1 -1
  61. package/_assets/{hashTypedData-Ca0HEadf.js → hashTypedData-BxxK8aGQ.js} +1 -1
  62. package/_assets/{hashTypedData-DVgRVFNg.js → hashTypedData-Cm-awrYD.js} +1 -1
  63. package/_assets/{import-DOwZHLAr.js → import-B25CKzlS.js} +1 -1
  64. package/_assets/{in-app-5OmWNOhY.js → in-app-NAdj5lCP.js} +1 -1
  65. package/_assets/{in-app-wallet-calls-BRQJJecy.js → in-app-wallet-calls-CpzGycsr.js} +1 -1
  66. package/_assets/{index-PVirg3CC.js → index-6hzc-GnS.js} +2 -2
  67. package/_assets/{index-BJOGj8uX.js → index-9v3H5hPY.js} +1 -1
  68. package/_assets/{index-CyM-uKEn.js → index-AqK03-LB.js} +1 -1
  69. package/_assets/{index-a4DwWHMC.js → index-B0tCillH.js} +2 -2
  70. package/_assets/{index-DBb0SZED.js → index-B6PcqfHB.js} +1 -1
  71. package/_assets/{index-DQ3nh_Gh.js → index-B9MT_MB9.js} +1 -1
  72. package/_assets/{index-hycTvNv9.js → index-BDNkhDJO.js} +1 -1
  73. package/_assets/{index-SIu0g-iY.js → index-BHI32oX_.js} +1 -1
  74. package/_assets/{index-Cp14nZEB.js → index-BKICMIZT.js} +1 -1
  75. package/_assets/{index-D7m3HL9N.js → index-BKSkru-M.js} +1 -1
  76. package/_assets/{index-EDfm-4gk.js → index-BKc1lwsO.js} +1 -1
  77. package/_assets/{index-BVkfXvB0.js → index-BLbPcDXT.js} +1 -1
  78. package/_assets/{index-Dx8DDVd9.js → index-BQ9B8U3w.js} +1 -1
  79. package/_assets/{index-Da6pHJ2U.js → index-BVrE4quq.js} +1 -1
  80. package/_assets/{index-tDQizk_n.js → index-BtwgxwHq.js} +1 -1
  81. package/_assets/{index-COvhkZx4.js → index-BxqE_v_k.js} +1 -1
  82. package/_assets/{index-CUdjYgOL.js → index-C1yjSclR.js} +1 -1
  83. package/_assets/{index-C_QkMk4V.js → index-C3O2judC.js} +2 -2
  84. package/_assets/{index-Clxl6O3m.js → index-C532fyTR.js} +1 -1
  85. package/_assets/{index-DgkhTIuB.js → index-CA1pdiTI.js} +1 -1
  86. package/_assets/{index-Fy8-NNgy.js → index-CF64rl6y.js} +1 -1
  87. package/_assets/{index-BgkliADR.js → index-CFIryEo0.js} +1 -1
  88. package/_assets/{index-2OVx4iJi.js → index-CHT5h1YD.js} +3 -3
  89. package/_assets/{index-DyTr5Odp.js → index-CQUKp9s3.js} +2 -2
  90. package/_assets/{index-p4aiSGwy.js → index-CS5vL3nz.js} +1 -1
  91. package/_assets/{index-DCTmqT9n.js → index-CTdrJ4oL.js} +1 -1
  92. package/_assets/{index-E6nd8w7r.js → index-CVd-CvyB.js} +1 -1
  93. package/_assets/{index-Yqi1mlp4.js → index-CZuVkoLd.js} +1 -1
  94. package/_assets/{index-DCJUcLs-.js → index-ChmcTLu_.js} +1 -1
  95. package/_assets/{index-CX9Whfxj.js → index-CjYcxJyk.js} +1 -1
  96. package/_assets/{index-DDY4z1Qo.js → index-D16mzzVn.js} +1 -1
  97. package/_assets/{index-D6QGQCMT.js → index-D8iklv7s.js} +1 -1
  98. package/_assets/{index-Be0TtwRh.js → index-DC1fq39A.js} +1 -1
  99. package/_assets/{index-CLwiHF4x.js → index-DKPPTRpY.js} +1 -1
  100. package/_assets/{index-BUWXcU3w.js → index-DKk1pc3n.js} +1 -1
  101. package/_assets/{index-M_xvfKlg.js → index-DPLsz-9z.js} +1 -1
  102. package/_assets/{index-CrrW0USV.js → index-DRU29mYR.js} +1 -1
  103. package/_assets/{index-CKNfn6Vk.js → index-DgX6c0uG.js} +3 -3
  104. package/_assets/{index-DmlmMlHx.js → index-DpTSanxf.js} +1 -1
  105. package/_assets/{index-B4VI0jMN.js → index-DrnGHRKJ.js} +1 -1
  106. package/_assets/{index-BhozS4qR.js → index-Du4gkBvR.js} +1 -1
  107. package/_assets/{index-BFBjDoQ6.js → index-DwQ9zfke.js} +1 -1
  108. package/_assets/{index-Bjz1afXG.js → index-Dy2g978X.js} +1 -1
  109. package/_assets/{index-BE_Ebetr.js → index-Dz1OuWp5.js} +1 -1
  110. package/_assets/{index-Ddv8zF_v.js → index-EiC_Szof.js} +1 -1
  111. package/_assets/{index-COIPDAvM.js → index-FuqC8LCi.js} +1 -1
  112. package/_assets/{index-hUwYbJaz.js → index-HY0POgHw.js} +2 -2
  113. package/_assets/{index-B0qtsAE-.js → index-K3GpFcMv.js} +1 -1
  114. package/_assets/{index-DFWSTox1.js → index-NyoHQ3Hg.js} +3 -3
  115. package/_assets/{index-CKvAeyW_.js → index-kSY8zCTD.js} +88 -88
  116. package/_assets/{index-C24ZPX4S.js → index-wz8PBj21.js} +1 -1
  117. package/_assets/{index.es-CuQzAuJf.js → index.es-BBVPisv6.js} +4 -4
  118. package/_assets/{index.es-CHF2aRm8.js → index.es-Da5RZk4t.js} +1 -1
  119. package/_assets/{index.es-4BnFbLIq.js → index.es-DiRhFFGQ.js} +1 -1
  120. package/_assets/{localBatchGatewayRequest-BiaZ99qV.js → localBatchGatewayRequest-C-p2tm05.js} +1 -1
  121. package/_assets/{mana-convert-fQ28xr65.js → mana-convert-D1hsZ2E6.js} +1 -1
  122. package/_assets/{mana-rate-CX4vkbTv.js → mana-rate-Bnci-S8V.js} +1 -1
  123. package/_assets/{networks-BLWCcklV.js → networks-BJU6f_cY.js} +1 -1
  124. package/_assets/{onramp-ofeNemBP.js → onramp-Bzzm06hv.js} +1 -1
  125. package/_assets/{openzeppelin-CQ4xxvCW.js → openzeppelin-DFiLpFgH.js} +1 -1
  126. package/_assets/{parseNft-BA1YqoMO.js → parseNft-CCbTEGwV.js} +2 -2
  127. package/_assets/{parseSignature-Bv3a-ckt.js → parseSignature-BOSKOro2.js} +1 -1
  128. package/_assets/{parseSignature-CdZk3HUU.js → parseSignature-DD99BMNb.js} +3 -3
  129. package/_assets/{passkeys-cIb8SYvN.js → passkeys-92GO4_AS.js} +1 -1
  130. package/_assets/{pay-with-exchange-DgR6jsOE.js → pay-with-exchange-DX-xSLr7.js} +1 -1
  131. package/_assets/{qr-overlay-Cfft7a0M.js → qr-overlay-eh8MTm5X.js} +1 -1
  132. package/_assets/{receive-BKMf0MUc.js → receive-gG18LKlB.js} +1 -1
  133. package/_assets/{resolveImplementation-BUhQkFuG.js → resolveImplementation-D1geF9pd.js} +1 -1
  134. package/_assets/{rpc-BSCW9r0K.js → rpc-BrRB7NAj.js} +1 -1
  135. package/_assets/{secp256k1-DZ_AtAE9.js → secp256k1-BG1vt8D2.js} +1 -1
  136. package/_assets/{secp256k1-D7Ic1AnI.js → secp256k1-C_5KB_ss.js} +1 -1
  137. package/_assets/{secp256k1-Cc7ZGphI.js → secp256k1-DX1MiMfj.js} +1 -1
  138. package/_assets/{send-D0GDu_vS.js → send-HdWX4Vf8.js} +1 -1
  139. package/_assets/{send-batch-transaction-Bx_S55BL.js → send-batch-transaction--UYo-MfS.js} +1 -1
  140. package/_assets/{send-eip712-transaction-BeQ_HoA6.js → send-eip712-transaction-ylAy9C9V.js} +2 -2
  141. package/_assets/{send-gasless-transaction-mq5auYkP.js → send-gasless-transaction-D8jV3JY1.js} +2 -2
  142. package/_assets/{send-transaction-D3g0h3x8.js → send-transaction-A8da-F-0.js} +2 -2
  143. package/_assets/{sendMetaTransaction-CfYBmJqE.js → sendMetaTransaction-DwwWcytG.js} +1 -1
  144. package/_assets/{sendRawTransaction-Bdfd1V50.js → sendRawTransaction-CRteP_VF.js} +3 -3
  145. package/_assets/{serializeTransaction-Bq1icuDU.js → serializeTransaction-CP2suneH.js} +1 -1
  146. package/_assets/{session-proposal-CeKp7mKZ.js → session-proposal-BEwyn_1a.js} +1 -1
  147. package/_assets/{session-request-CZ68hd2h.js → session-request-D98_vJeF.js} +2 -2
  148. package/_assets/{signing-C7pGWbAD.js → signing-ByWEzda7.js} +3 -3
  149. package/_assets/{socials-DVfxwwog.js → socials-Dw9x9jIa.js} +1 -1
  150. package/_assets/{swaps-BHlzfOa6.js → swaps-Cg4ubSW8.js} +1 -1
  151. package/_assets/{thirdweb-PU38RH0J.js → thirdweb-B5eOPxT2.js} +3 -3
  152. package/_assets/{to-serializable-transaction-gDnQ8f6A.js → to-serializable-transaction-Bug9hdHL.js} +2 -2
  153. package/_assets/{trade-encoding-DPKBDNkR.js → trade-encoding-D1HYs4M1.js} +1 -1
  154. package/_assets/{transactionReceipt-CkDBxTqo.js → transactionReceipt-BCGTxm9P.js} +1 -1
  155. package/_assets/{transactions-CC5Z4LdW.js → transactions-BjCUlQJE.js} +1 -1
  156. package/_assets/{useCreditPacks-CQXC1itx.js → useCreditPacks-DGRmK8hf.js} +1 -1
  157. package/_assets/{useInfiniteGrid-CK8TA2xA.js → useInfiniteGrid-CY-Kev2J.js} +1 -1
  158. package/_assets/useManaRate-CXdHjXW7.js +1 -0
  159. package/_assets/{useSecondarySales-BVKMem4L.js → useSecondarySales-CiIhx9_Z.js} +1 -1
  160. package/_assets/{useStore-55b8sEvt.js → useStore-DUeF63tD.js} +1 -1
  161. package/_assets/{useTheme-s40vMPeT.js → useTheme-Cvhw021z.js} +1 -1
  162. package/_assets/{verifyHash-UTScJ5vY.js → verifyHash-C9OKo_wr.js} +1 -1
  163. package/_assets/{w3m-modal-DvvX0FR6.js → w3m-modal-CPyeblNY.js} +1 -1
  164. package/_assets/{w3m-modal-BcGHx_GU.js → w3m-modal-Du_9ZBUK.js} +1 -1
  165. package/_assets/{wait-for-tx-receipt-DeBOMM1R.js → wait-for-tx-receipt-DpR9zAvK.js} +1 -1
  166. package/_assets/{wallets-JW3aPEWT.js → wallets-BrL616p3.js} +5 -5
  167. package/_assets/{web-connector-RvG-aCdp.js → web-connector-RgfFD4s5.js} +3 -3
  168. package/_assets/{writeContract-Dqe7Ta-l.js → writeContract-BndPP9zt.js} +1 -1
  169. package/_assets/{zoraTestnet-DDg_i6X6.js → zoraTestnet-Dfh7-p3m.js} +1 -1
  170. package/index.html +11 -11
  171. package/package.json +2 -2
  172. package/_assets/Creator-DQZ74uf0.js +0 -306
  173. package/_assets/useManaRate-DvHMbg5D.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as j,j as e,L as Q,d as dt}from"./react-vyZjIDcS.js";import{aJ as lt,s as l,t as o,x as ut,B as ht,m as xt,e as d,n as mt,u as v,I as f,aK as G,aL as K,aM as pt,z as k,aN as gt,ap as T,K as ft,aO as yt,aP as C}from"./index-CKvAeyW_.js";import{m as bt}from"./mana-convert-fQ28xr65.js";import{u as jt}from"./useManaRate-DvHMbg5D.js";import{L as vt}from"./LoadMore-DoQvuFO_.js";import{u as y}from"./useInfiniteGrid-CK8TA2xA.js";import{m as X}from"./mana-matic-C4e1sNO3.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./mana-rate-CX4vkbTv.js";const kt=15e3;function It(t,n){return t.txHash&&n.txHash?t.txHash===n.txHash:t.txHash||n.txHash?!1:t.status===n.status&&Math.abs(t.createdAt-n.createdAt)<=kt}function At(t){const n=[...t].sort((i,a)=>a.createdAt-i.createdAt),s=[];for(const i of n){const a=s[s.length-1];a&&It(a[a.length-1],i)?a.push(i):s.push([i])}return s.map(i=>{var a;return{id:((a=i.find(c=>c.txHash))==null?void 0:a.txHash)??i[i.length-1].id,createdAt:Math.max(...i.map(c=>c.createdAt)),status:i.some(c=>c.status==="PENDING")?"PENDING":"SETTLED",totalCredits:i.reduce((c,h)=>c+h.credits,0),lines:i}})}function wt(t){return t.tradeId?`trade:${t.tradeId}`:t.contractAddress&&t.itemId?`item:${t.contractAddress.toLowerCase()}:${t.itemId}`:null}function $t(t){const n=[],s=new Map;for(const i of t){const a=wt(i);if(!a){n.push({key:i.id,tradeId:null,contractAddress:i.contractAddress??null,itemId:i.itemId??null,quantity:1,credits:i.credits});continue}const c=s.get(a);if(c){c.quantity+=1,c.credits+=i.credits;continue}const h={key:a,tradeId:i.tradeId,contractAddress:i.contractAddress??null,itemId:i.itemId??null,quantity:1,credits:i.credits};s.set(a,h),n.push(h)}return n}function Pt(t,n){return{id:t.id,contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId,counterparty:t.buyer,credits:n?bt(t.manaWei,n):null,manaWei:t.manaWei,createdAt:t.createdAt,txHash:t.txHash}}function Lt(t){const s=At(t.purchases.filter(r=>r.status!=="EXPIRED")).map(r=>({kind:"purchase",id:`purchase:${r.id}`,createdAt:r.createdAt,order:r})),i=t.sales.map(r=>{const x=Pt(r,t.rate);return{kind:"sale",id:`sale:${x.id}`,createdAt:x.createdAt,sale:x}}),a=(t.creditOrders??[]).filter(r=>r.status!=="failed"&&r.status!=="abandoned").map(r=>({kind:"credit",id:`credit:${r.id}`,createdAt:r.createdAt,order:r})),c=new Set(t.purchases.filter(r=>r.txHash).map(r=>r.txHash.toLowerCase())),h=(t.manaPurchases??[]).filter(r=>!c.has(r.txHash.toLowerCase())).map(r=>({kind:"mana-purchase",id:`mana-purchase:${r.id}`,createdAt:r.createdAt,sale:r}));return[...s,...i,...a,...h].sort((r,x)=>x.createdAt-r.createdAt||(r.id<x.id?-1:1))}function Nt(t,n){return n==="all"?t:n==="sales"?t.filter(s=>s.kind==="sale"):t.filter(s=>s.kind==="purchase"||s.kind==="credit"||s.kind==="mana-purchase")}const J=t=>t.trim().toLowerCase();function Et(t){const n=new Map;for(const s of t??[]){const i=J(s.txHash??"");if(!i)continue;const a=n.get(i);a?a.push(s):n.set(i,[s])}return n}function Tt(t,n,s=Date.now()){const i=n.txHash?t.get(J(n.txHash)):void 0;if(!i||i.length===0)return{kind:"direct"};const a=i.length===1?Ct(i[0].netCents):null,c=i.filter(r=>!r.available&&r.availableAt>s);if(c.length===0)return{kind:"credited",credits:a};const h=c.reduce((r,x)=>Math.max(r,x.availableAt),0);return{kind:"pending",credits:a,availableAt:h}}function Ct(t){return lt(t)}const Ft="https://cdn.decentraland.org/@dcl/shop/0.1.0-30835612462.commit-48765f9/_assets/credits-product-vs4Q6u6l.svg",F=ut`
1
+ import{r as j,j as e,L as Q,d as dt}from"./react-vyZjIDcS.js";import{aK as lt,s as l,t as o,x as ut,B as ht,m as xt,e as d,n as mt,u as v,I as f,aL as G,aM as K,aN as pt,z as k,aO as gt,ap as T,K as ft,aP as yt,aQ as C}from"./index-kSY8zCTD.js";import{m as bt}from"./mana-convert-D1hsZ2E6.js";import{u as jt}from"./useManaRate-CXdHjXW7.js";import{L as vt}from"./LoadMore-ConDrtOT.js";import{u as y}from"./useInfiniteGrid-CY-Kev2J.js";import{m as X}from"./mana-matic-C4e1sNO3.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./mana-rate-Bnci-S8V.js";const kt=15e3;function It(t,n){return t.txHash&&n.txHash?t.txHash===n.txHash:t.txHash||n.txHash?!1:t.status===n.status&&Math.abs(t.createdAt-n.createdAt)<=kt}function At(t){const n=[...t].sort((i,a)=>a.createdAt-i.createdAt),s=[];for(const i of n){const a=s[s.length-1];a&&It(a[a.length-1],i)?a.push(i):s.push([i])}return s.map(i=>{var a;return{id:((a=i.find(c=>c.txHash))==null?void 0:a.txHash)??i[i.length-1].id,createdAt:Math.max(...i.map(c=>c.createdAt)),status:i.some(c=>c.status==="PENDING")?"PENDING":"SETTLED",totalCredits:i.reduce((c,h)=>c+h.credits,0),lines:i}})}function wt(t){return t.tradeId?`trade:${t.tradeId}`:t.contractAddress&&t.itemId?`item:${t.contractAddress.toLowerCase()}:${t.itemId}`:null}function $t(t){const n=[],s=new Map;for(const i of t){const a=wt(i);if(!a){n.push({key:i.id,tradeId:null,contractAddress:i.contractAddress??null,itemId:i.itemId??null,quantity:1,credits:i.credits});continue}const c=s.get(a);if(c){c.quantity+=1,c.credits+=i.credits;continue}const h={key:a,tradeId:i.tradeId,contractAddress:i.contractAddress??null,itemId:i.itemId??null,quantity:1,credits:i.credits};s.set(a,h),n.push(h)}return n}function Pt(t,n){return{id:t.id,contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId,counterparty:t.buyer,credits:n?bt(t.manaWei,n):null,manaWei:t.manaWei,createdAt:t.createdAt,txHash:t.txHash}}function Lt(t){const s=At(t.purchases.filter(r=>r.status!=="EXPIRED")).map(r=>({kind:"purchase",id:`purchase:${r.id}`,createdAt:r.createdAt,order:r})),i=t.sales.map(r=>{const x=Pt(r,t.rate);return{kind:"sale",id:`sale:${x.id}`,createdAt:x.createdAt,sale:x}}),a=(t.creditOrders??[]).filter(r=>r.status!=="failed"&&r.status!=="abandoned").map(r=>({kind:"credit",id:`credit:${r.id}`,createdAt:r.createdAt,order:r})),c=new Set(t.purchases.filter(r=>r.txHash).map(r=>r.txHash.toLowerCase())),h=(t.manaPurchases??[]).filter(r=>!c.has(r.txHash.toLowerCase())).map(r=>({kind:"mana-purchase",id:`mana-purchase:${r.id}`,createdAt:r.createdAt,sale:r}));return[...s,...i,...a,...h].sort((r,x)=>x.createdAt-r.createdAt||(r.id<x.id?-1:1))}function Nt(t,n){return n==="all"?t:n==="sales"?t.filter(s=>s.kind==="sale"):t.filter(s=>s.kind==="purchase"||s.kind==="credit"||s.kind==="mana-purchase")}const Z=t=>t.trim().toLowerCase();function Et(t){const n=new Map;for(const s of t??[]){const i=Z(s.txHash??"");if(!i)continue;const a=n.get(i);a?a.push(s):n.set(i,[s])}return n}function Tt(t,n,s=Date.now()){const i=n.txHash?t.get(Z(n.txHash)):void 0;if(!i||i.length===0)return{kind:"direct"};const a=i.length===1?Ct(i[0].netCents):null,c=i.filter(r=>!r.available&&r.availableAt>s);if(c.length===0)return{kind:"credited",credits:a};const h=c.reduce((r,x)=>Math.max(r,x.availableAt),0);return{kind:"pending",credits:a,availableAt:h}}function Ct(t){return lt(t)}const Ft="https://cdn.decentraland.org/@dcl/shop/0.1.0-30846189899.commit-4a8ddfb/_assets/credits-product-vs4Q6u6l.svg",F=ut`
2
2
  0% { background-position: 200% 0; }
3
3
  100% { background-position: -200% 0; }
4
4
  `,St=l.section`
@@ -150,7 +150,7 @@ import{r as j,j as e,L as Q,d as dt}from"./react-vyZjIDcS.js";import{aJ as lt,s
150
150
  &[data-kind='income'] {
151
151
  color: ${o.colors.okStrong};
152
152
  }
153
- `,Z=l.img`
153
+ `,J=l.img`
154
154
  width: 16px;
155
155
  height: 16px;
156
156
  vertical-align: -0.15em;
@@ -288,4 +288,4 @@ import{r as j,j as e,L as Q,d as dt}from"./react-vyZjIDcS.js";import{aJ as lt,s
288
288
  margin: 6px 0 0;
289
289
  `,Rt=l(ht)`
290
290
  margin-top: 12px;
291
- `,W=E.withComponent(Q),b=24,Gt=["all","purchases","sales"];function g(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 n=Number(t)/1e18;return Number.isFinite(n)?n.toLocaleString("en",{maximumFractionDigits:2}):"0"}function it({children:t}){const n=j.useRef(null),[s,i]=j.useState(null),a=()=>{var h;const c=(h=n.current)==null?void 0:h.getBoundingClientRect();c&&i({top:c.bottom+8,left:c.left+c.width/2})};return e.jsxs(qt,{ref:n,tabIndex:0,onMouseEnter:a,onMouseLeave:()=>i(null),onFocus:a,onBlur:()=>i(null),children:[t,s?dt.createPortal(e.jsx(Wt,{style:{top:s.top,left:s.left},role:"tooltip",children:d("activity.polygonMana")}),document.body):null]})}function Kt({item:t}){const n=!!t.contractAddress&&!!t.itemId,s=!!t.tradeId||n,{data:i,isLoading:a}=v({queryKey:["order-line-display",t.tradeId,t.contractAddress,t.itemId],queryFn:()=>t.tradeId?yt(t.tradeId):C(t.contractAddress,{itemId:t.itemId}),enabled:s,staleTime:5*6e4}),c=s&&a,h=(i==null?void 0:i.name)??d("activity.itemFallback"),r=(i==null?void 0:i.thumbnail)??"",x=T({contractAddress:i==null?void 0:i.contractAddress,tokenId:i==null?void 0:i.tokenId,itemId:i==null?void 0:i.itemId})??void 0,p=e.jsxs(e.Fragment,{children:[c?e.jsx(D,{}):e.jsx(M,{children:r?e.jsx("img",{src:r,alt:h}):e.jsx(f,{name:"cart",size:20})}),e.jsxs(H,{children:[c?e.jsx(O,{}):e.jsx(z,{title:h,children:h}),t.quantity>1?e.jsx(q,{children:d("activity.quantity",{count:t.quantity})}):null]}),e.jsxs(Bt,{children:[e.jsx(k,{className:"ccy-mark"})," ",t.credits]})]});return x?e.jsx(W,{to:x,"data-link":"true",children:p}):e.jsx(E,{children:p})}function _t({order:t}){const n=$t(t.lines),s=n.reduce((i,a)=>i+a.quantity,0);return e.jsxs(I,{"data-testid":"purchase-order",children:[e.jsxs(A,{children:[e.jsxs(w,{children:[e.jsx($,{children:g(t.createdAt)}),e.jsxs(P,{children:[d("activity.purchaseLabel")," · ",d("activity.itemCount",{count:s})]})]}),e.jsxs(L,{children:[e.jsx(N,{"data-status":t.status,children:t.status==="PENDING"?d("activity.processing"):d("activity.completed")}),e.jsxs(m,{children:[e.jsx(k,{className:"ccy-mark"})," ",t.totalCredits]})]})]}),e.jsx(S,{children:n.map(i=>e.jsx(Kt,{item:i},i.key))})]})}function Ut({sale:t}){const{data:n,isLoading:s}=v({queryKey:["asset-display",t.contractAddress,t.tokenId,t.itemId],queryFn:()=>C(t.contractAddress,{tokenId:t.tokenId,itemId:t.itemId}),enabled:!!t.contractAddress,staleTime:3e5}),i=(n==null?void 0:n.name)??d("activity.itemFallback"),a=(n==null?void 0:n.thumbnail)??"",c=T({contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId})??void 0,h=e.jsxs(e.Fragment,{children:[s?e.jsx(D,{}):e.jsx(M,{children:a?e.jsx("img",{src:a,alt:i}):e.jsx(f,{name:"offer",size:20})}),e.jsxs(H,{children:[s?e.jsx(O,{}):e.jsx(z,{title:i,children:i}),e.jsx(q,{children:d("activity.boughtFrom",{account:tt(t.seller)})})]})]});return e.jsxs(I,{"data-testid":"activity-mana-purchase",children:[e.jsxs(A,{children:[e.jsxs(w,{children:[e.jsx($,{children:g(t.createdAt)}),e.jsx(P,{children:d("activity.paidWithMana")})]}),e.jsxs(L,{children:[e.jsx(N,{"data-status":"SETTLED",children:d("activity.completed")}),e.jsxs(m,{children:[et(t.manaWei)," ",e.jsx(it,{children:e.jsx(Z,{src:X,alt:"MANA"})})]})]})]}),e.jsx(S,{children:c?e.jsx(W,{to:c,"data-link":"true",children:h}):e.jsx(E,{children:h})})]})}function Qt({sale:t,payout:n}){const{data:s,isLoading:i}=v({queryKey:["asset-display",t.contractAddress,t.tokenId,t.itemId],queryFn:()=>C(t.contractAddress,{tokenId:t.tokenId,itemId:t.itemId}),enabled:!!t.contractAddress,staleTime:3e5}),a=(s==null?void 0:s.name)??d("activity.itemFallback"),c=(s==null?void 0:s.thumbnail)??"",h=T({contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId})??void 0,r=e.jsxs(e.Fragment,{children:[i?e.jsx(D,{}):e.jsx(M,{children:c?e.jsx("img",{src:c,alt:a}):e.jsx(f,{name:"offer",size:20})}),e.jsxs(H,{children:[i?e.jsx(O,{}):e.jsx(z,{title:a,children:a}),e.jsxs(q,{children:[d("activity.soldTo",{account:tt(t.counterparty)}),n.kind==="pending"?` · ${d("activity.payoutPendingOn",{date:g(n.availableAt)})}`:""]})]})]});return e.jsxs(I,{"data-testid":"activity-sale",children:[e.jsxs(A,{children:[e.jsxs(w,{children:[e.jsx($,{children:g(t.createdAt)}),e.jsx(P,{children:d("activity.saleLabel")})]}),e.jsxs(L,{children:[e.jsx(N,{"data-status":n.kind==="pending"?"PENDING":"SOLD",children:n.kind==="pending"?d("activity.payoutPending"):d("activity.sold")}),n.kind==="direct"?e.jsxs(m,{"data-kind":"income",children:["+",et(t.manaWei)," ",e.jsx(it,{children:e.jsx(Z,{src:X,alt:"MANA"})})]}):n.credits!==null?e.jsxs(m,{"data-kind":"income",children:[e.jsx(k,{className:"ccy-mark"})," +",ft(n.credits)]}):e.jsx(m,{"data-kind":"income",children:d("activity.payoutCredited")})]})]}),e.jsx(S,{children:h?e.jsx(W,{to:h,"data-link":"true",children:r}):e.jsx(E,{children:r})})]})}function Xt({order:t}){const n=`$${(t.usdCents/100).toFixed(2)}`,s=gt(t.status),i=s==="SETTLED"?d("activity.completed"):s==="FAILED"?d("activity.failed"):d("activity.processing");return e.jsx(I,{"data-testid":"credit-order",children:e.jsxs(A,{children:[e.jsx(Ot,{children:e.jsx("img",{src:Ft,alt:"","aria-hidden":!0})}),e.jsxs(w,{children:[e.jsx($,{children:g(t.createdAt)}),e.jsxs(P,{children:[d("activity.creditPurchaseLabel")," · ",d("activity.creditPaid",{usd:n})]})]}),e.jsxs(L,{children:[e.jsx(N,{"data-status":s,children:i}),e.jsxs(m,{"data-kind":"income",children:["+",e.jsx(k,{className:"ccy-mark"})," ",t.credits]})]})]})})}function Jt({filter:t}){const n={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(f,{name:n.icon,size:40,color:o.colors.muted2}),e.jsx(Y,{children:n.title}),e.jsx("p",{className:"muted",children:n.body}),t!=="sales"?e.jsx(Rt,{as:Q,to:"/assets",variant:"purple",children:d("notFound.cta")}):null]})}function de(){xt({title:d("nav.activity"),noindex:!0});const{session:t}=mt(),[n,s]=j.useState("all"),i=!!t&&n!=="sales",a=!!t&&n!=="purchases",c=y(["purchases",t==null?void 0:t.address],u=>pt(t.address,t.identity,{first:b,skip:u}),{enabled:i}),h=y(["sales",t==null?void 0:t.address],u=>G(t.address,{role:"seller",first:b,skip:u}),{enabled:a}),r=y(["credit-orders",t==null?void 0:t.address],u=>K(t.address,t.identity,{first:b,skip:u}),{enabled:i}),x=y(["mana-purchases",t==null?void 0:t.address],u=>G(t.address,{role:"buyer",first:b,skip:u}),{enabled:i}),{data:p}=v({queryKey:["sale-payouts",t==null?void 0:t.address],queryFn:()=>K(t.address,t.identity,{first:200}).then(u=>u.payouts),enabled:a,staleTime:6e4}),nt=j.useMemo(()=>Et(p),[p]),{data:st}=jt(a);if(!t)return e.jsxs(V,{children:[e.jsx(f,{name:"clock",size:40,color:o.colors.muted2}),e.jsx(Y,{children:d("activity.signInTitle")}),e.jsx("p",{className:"muted",children:d("activity.signInBody")})]});const B=Nt(Lt({purchases:i?c.items:[],sales:a?h.items:[],creditOrders:i?r.items:[],manaPurchases:i?x.items:[],rate:st}),n),at=i&&(c.isLoading||r.isLoading||x.isLoading)||a&&h.isLoading,R=i&&(c.isFetchingNextPage||r.isFetchingNextPage||x.isFetchingNextPage)||a&&h.isFetchingNextPage,rt=i&&(c.hasNextPage||r.hasNextPage||x.hasNextPage)||a&&h.hasNextPage;function ot(){i&&c.hasNextPage&&c.fetchNextPage(),i&&r.hasNextPage&&r.fetchNextPage(),i&&x.hasNextPage&&x.fetchNextPage(),a&&h.hasNextPage&&h.fetchNextPage()}return e.jsxs(St,{children:[e.jsx(Mt,{children:e.jsx(Dt,{children:d("nav.activity")})}),e.jsx(Ht,{role:"tablist","aria-label":d("nav.activity"),children:Gt.map(u=>e.jsx(zt,{type:"button",role:"tab","aria-selected":n===u,"data-active":n===u,"data-testid":`activity-filter-${u}`,onClick:()=>s(u),children:d(`activity.filter.${u}`)},u))}),at?e.jsx(_,{children:Array.from({length:5}).map((u,ct)=>e.jsx(U,{},ct))}):B.length===0?e.jsx(Jt,{filter:n}):e.jsxs(e.Fragment,{children:[e.jsxs(_,{children:[B.map(u=>u.kind==="purchase"?e.jsx(_t,{order:u.order},u.id):u.kind==="credit"?e.jsx(Xt,{order:u.order},u.id):u.kind==="mana-purchase"?e.jsx(Ut,{sale:u.sale},u.id):e.jsx(Qt,{sale:u.sale,payout:Tt(nt,u.sale)},u.id)),R?e.jsx(U,{}):null]}),e.jsx(vt,{hasNextPage:rt,isFetching:R,onLoadMore:ot})]})]})}export{de as Activity};
291
+ `,W=E.withComponent(Q),b=24,Gt=["all","purchases","sales"];function g(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 n=Number(t)/1e18;return Number.isFinite(n)?n.toLocaleString("en",{maximumFractionDigits:2}):"0"}function it({children:t}){const n=j.useRef(null),[s,i]=j.useState(null),a=()=>{var h;const c=(h=n.current)==null?void 0:h.getBoundingClientRect();c&&i({top:c.bottom+8,left:c.left+c.width/2})};return e.jsxs(qt,{ref:n,tabIndex:0,onMouseEnter:a,onMouseLeave:()=>i(null),onFocus:a,onBlur:()=>i(null),children:[t,s?dt.createPortal(e.jsx(Wt,{style:{top:s.top,left:s.left},role:"tooltip",children:d("activity.polygonMana")}),document.body):null]})}function Kt({item:t}){const n=!!t.contractAddress&&!!t.itemId,s=!!t.tradeId||n,{data:i,isLoading:a}=v({queryKey:["order-line-display",t.tradeId,t.contractAddress,t.itemId],queryFn:()=>t.tradeId?yt(t.tradeId):C(t.contractAddress,{itemId:t.itemId}),enabled:s,staleTime:5*6e4}),c=s&&a,h=(i==null?void 0:i.name)??d("activity.itemFallback"),r=(i==null?void 0:i.thumbnail)??"",x=T({contractAddress:i==null?void 0:i.contractAddress,tokenId:i==null?void 0:i.tokenId,itemId:i==null?void 0:i.itemId})??void 0,p=e.jsxs(e.Fragment,{children:[c?e.jsx(D,{}):e.jsx(M,{children:r?e.jsx("img",{src:r,alt:h}):e.jsx(f,{name:"cart",size:20})}),e.jsxs(H,{children:[c?e.jsx(O,{}):e.jsx(z,{title:h,children:h}),t.quantity>1?e.jsx(q,{children:d("activity.quantity",{count:t.quantity})}):null]}),e.jsxs(Bt,{children:[e.jsx(k,{className:"ccy-mark"})," ",t.credits]})]});return x?e.jsx(W,{to:x,"data-link":"true",children:p}):e.jsx(E,{children:p})}function _t({order:t}){const n=$t(t.lines),s=n.reduce((i,a)=>i+a.quantity,0);return e.jsxs(I,{"data-testid":"purchase-order",children:[e.jsxs(A,{children:[e.jsxs(w,{children:[e.jsx($,{children:g(t.createdAt)}),e.jsxs(P,{children:[d("activity.purchaseLabel")," · ",d("activity.itemCount",{count:s})]})]}),e.jsxs(L,{children:[e.jsx(N,{"data-status":t.status,children:t.status==="PENDING"?d("activity.processing"):d("activity.completed")}),e.jsxs(m,{children:[e.jsx(k,{className:"ccy-mark"})," ",t.totalCredits]})]})]}),e.jsx(S,{children:n.map(i=>e.jsx(Kt,{item:i},i.key))})]})}function Ut({sale:t}){const{data:n,isLoading:s}=v({queryKey:["asset-display",t.contractAddress,t.tokenId,t.itemId],queryFn:()=>C(t.contractAddress,{tokenId:t.tokenId,itemId:t.itemId}),enabled:!!t.contractAddress,staleTime:3e5}),i=(n==null?void 0:n.name)??d("activity.itemFallback"),a=(n==null?void 0:n.thumbnail)??"",c=T({contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId})??void 0,h=e.jsxs(e.Fragment,{children:[s?e.jsx(D,{}):e.jsx(M,{children:a?e.jsx("img",{src:a,alt:i}):e.jsx(f,{name:"offer",size:20})}),e.jsxs(H,{children:[s?e.jsx(O,{}):e.jsx(z,{title:i,children:i}),e.jsx(q,{children:d("activity.boughtFrom",{account:tt(t.seller)})})]})]});return e.jsxs(I,{"data-testid":"activity-mana-purchase",children:[e.jsxs(A,{children:[e.jsxs(w,{children:[e.jsx($,{children:g(t.createdAt)}),e.jsx(P,{children:d("activity.paidWithMana")})]}),e.jsxs(L,{children:[e.jsx(N,{"data-status":"SETTLED",children:d("activity.completed")}),e.jsxs(m,{children:[et(t.manaWei)," ",e.jsx(it,{children:e.jsx(J,{src:X,alt:"MANA"})})]})]})]}),e.jsx(S,{children:c?e.jsx(W,{to:c,"data-link":"true",children:h}):e.jsx(E,{children:h})})]})}function Qt({sale:t,payout:n}){const{data:s,isLoading:i}=v({queryKey:["asset-display",t.contractAddress,t.tokenId,t.itemId],queryFn:()=>C(t.contractAddress,{tokenId:t.tokenId,itemId:t.itemId}),enabled:!!t.contractAddress,staleTime:3e5}),a=(s==null?void 0:s.name)??d("activity.itemFallback"),c=(s==null?void 0:s.thumbnail)??"",h=T({contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId})??void 0,r=e.jsxs(e.Fragment,{children:[i?e.jsx(D,{}):e.jsx(M,{children:c?e.jsx("img",{src:c,alt:a}):e.jsx(f,{name:"offer",size:20})}),e.jsxs(H,{children:[i?e.jsx(O,{}):e.jsx(z,{title:a,children:a}),e.jsxs(q,{children:[d("activity.soldTo",{account:tt(t.counterparty)}),n.kind==="pending"?` · ${d("activity.payoutPendingOn",{date:g(n.availableAt)})}`:""]})]})]});return e.jsxs(I,{"data-testid":"activity-sale",children:[e.jsxs(A,{children:[e.jsxs(w,{children:[e.jsx($,{children:g(t.createdAt)}),e.jsx(P,{children:d("activity.saleLabel")})]}),e.jsxs(L,{children:[e.jsx(N,{"data-status":n.kind==="pending"?"PENDING":"SOLD",children:n.kind==="pending"?d("activity.payoutPending"):d("activity.sold")}),n.kind==="direct"?e.jsxs(m,{"data-kind":"income",children:["+",et(t.manaWei)," ",e.jsx(it,{children:e.jsx(J,{src:X,alt:"MANA"})})]}):n.credits!==null?e.jsxs(m,{"data-kind":"income",children:[e.jsx(k,{className:"ccy-mark"})," +",ft(n.credits)]}):e.jsx(m,{"data-kind":"income",children:d("activity.payoutCredited")})]})]}),e.jsx(S,{children:h?e.jsx(W,{to:h,"data-link":"true",children:r}):e.jsx(E,{children:r})})]})}function Xt({order:t}){const n=`$${(t.usdCents/100).toFixed(2)}`,s=gt(t.status),i=s==="SETTLED"?d("activity.completed"):s==="FAILED"?d("activity.failed"):d("activity.processing");return e.jsx(I,{"data-testid":"credit-order",children:e.jsxs(A,{children:[e.jsx(Ot,{children:e.jsx("img",{src:Ft,alt:"","aria-hidden":!0})}),e.jsxs(w,{children:[e.jsx($,{children:g(t.createdAt)}),e.jsxs(P,{children:[d("activity.creditPurchaseLabel")," · ",d("activity.creditPaid",{usd:n})]})]}),e.jsxs(L,{children:[e.jsx(N,{"data-status":s,children:i}),e.jsxs(m,{"data-kind":"income",children:["+",e.jsx(k,{className:"ccy-mark"})," ",t.credits]})]})]})})}function Zt({filter:t}){const n={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(f,{name:n.icon,size:40,color:o.colors.muted2}),e.jsx(Y,{children:n.title}),e.jsx("p",{className:"muted",children:n.body}),t!=="sales"?e.jsx(Rt,{as:Q,to:"/assets",variant:"purple",children:d("notFound.cta")}):null]})}function de(){xt({title:d("nav.activity"),noindex:!0});const{session:t}=mt(),[n,s]=j.useState("all"),i=!!t&&n!=="sales",a=!!t&&n!=="purchases",c=y(["purchases",t==null?void 0:t.address],u=>pt(t.address,t.identity,{first:b,skip:u}),{enabled:i}),h=y(["sales",t==null?void 0:t.address],u=>G(t.address,{role:"seller",first:b,skip:u}),{enabled:a}),r=y(["credit-orders",t==null?void 0:t.address],u=>K(t.address,t.identity,{first:b,skip:u}),{enabled:i}),x=y(["mana-purchases",t==null?void 0:t.address],u=>G(t.address,{role:"buyer",first:b,skip:u}),{enabled:i}),{data:p}=v({queryKey:["sale-payouts",t==null?void 0:t.address],queryFn:()=>K(t.address,t.identity,{first:200}).then(u=>u.payouts),enabled:a,staleTime:6e4}),nt=j.useMemo(()=>Et(p),[p]),{data:st}=jt(a);if(!t)return e.jsxs(V,{children:[e.jsx(f,{name:"clock",size:40,color:o.colors.muted2}),e.jsx(Y,{children:d("activity.signInTitle")}),e.jsx("p",{className:"muted",children:d("activity.signInBody")})]});const B=Nt(Lt({purchases:i?c.items:[],sales:a?h.items:[],creditOrders:i?r.items:[],manaPurchases:i?x.items:[],rate:st}),n),at=i&&(c.isLoading||r.isLoading||x.isLoading)||a&&h.isLoading,R=i&&(c.isFetchingNextPage||r.isFetchingNextPage||x.isFetchingNextPage)||a&&h.isFetchingNextPage,rt=i&&(c.hasNextPage||r.hasNextPage||x.hasNextPage)||a&&h.hasNextPage;function ot(){i&&c.hasNextPage&&c.fetchNextPage(),i&&r.hasNextPage&&r.fetchNextPage(),i&&x.hasNextPage&&x.fetchNextPage(),a&&h.hasNextPage&&h.fetchNextPage()}return e.jsxs(St,{children:[e.jsx(Mt,{children:e.jsx(Dt,{children:d("nav.activity")})}),e.jsx(Ht,{role:"tablist","aria-label":d("nav.activity"),children:Gt.map(u=>e.jsx(zt,{type:"button",role:"tab","aria-selected":n===u,"data-active":n===u,"data-testid":`activity-filter-${u}`,onClick:()=>s(u),children:d(`activity.filter.${u}`)},u))}),at?e.jsx(_,{children:Array.from({length:5}).map((u,ct)=>e.jsx(U,{},ct))}):B.length===0?e.jsx(Zt,{filter:n}):e.jsxs(e.Fragment,{children:[e.jsxs(_,{children:[B.map(u=>u.kind==="purchase"?e.jsx(_t,{order:u.order},u.id):u.kind==="credit"?e.jsx(Xt,{order:u.order},u.id):u.kind==="mana-purchase"?e.jsx(Ut,{sale:u.sale},u.id):e.jsx(Qt,{sale:u.sale,payout:Tt(nt,u.sale)},u.id)),R?e.jsx(U,{}):null]}),e.jsx(vt,{hasNextPage:rt,isFetching:R,onLoadMore:ot})]})]})}export{de as Activity};
@@ -1,4 +1,4 @@
1
- import{r as l,j as v}from"./react-vyZjIDcS.js";import{s as u}from"./index-CKvAeyW_.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";const S="https://cdn.decentraland.org/@dcl/shop/0.1.0-30835612462.commit-48765f9/_assets/custom-welcome-background-BxlFQma9.webp",b="https://cdn.decentraland.org/@dcl/shop/0.1.0-30835612462.commit-48765f9/_assets/DCL_LogoPattern-BryBPc3d.png",U=`
1
+ import{r as l,j as v}from"./react-vyZjIDcS.js";import{s as u}from"./index-kSY8zCTD.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";const S="https://cdn.decentraland.org/@dcl/shop/0.1.0-30846189899.commit-4a8ddfb/_assets/custom-welcome-background-BxlFQma9.webp",b="https://cdn.decentraland.org/@dcl/shop/0.1.0-30846189899.commit-4a8ddfb/_assets/DCL_LogoPattern-BryBPc3d.png",U=`
2
2
  attribute vec2 a_position;
3
3
  varying vec2 v_uv;
4
4
  void main() {
@@ -1,4 +1,4 @@
1
- import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,av as Ke,aw as Ze,d as Je,s as n,t,n as Ie,al as Qe,D as Xe,K as Ae,y as Ye,e as s,I as _,z as W,aS as he,aj as et,ar as J,az as tt,ay as nt,m as Ne,o as st,S as fe,A as O,aT as ot,aU as it}from"./index-CKvAeyW_.js";import{u as rt}from"./useSecondarySales-BVKMem4L.js";import{a as at,m as Me}from"./mana-convert-fQ28xr65.js";import{u as Pe}from"./useManaRate-DvHMbg5D.js";import{g as lt,h as ct,i as dt,j as pt,k as xt,C as ht,l as ft,o as mt,m as ut,n as gt,M as bt,p as yt,E as wt,q as jt,r as vt,s as $t,t as Ct,u as kt,v as St}from"./Assets.styles-BO8jltml.js";import{c as me,R as Et,F as _t,S as Tt}from"./categories-DFgZJeSL.js";import{L as Rt}from"./LoadMore-DoQvuFO_.js";import{u as zt}from"./useInfiniteGrid-CK8TA2xA.js";import{E as It}from"./ErrorNotice-q0dn0iRL.js";import{d as At}from"./dcl-schemas-BICTSpB5.js";import{s as Nt,G as Mt,w as Pt,S as Wt}from"./buy-gasless-Cxl5QDDd.js";import{s as Bt}from"./buy-DN9Q4fmJ.js";import{i as Ft}from"./trade-encoding-DPKBDNkR.js";import{r as Lt}from"./mana-rate-CX4vkbTv.js";import{f as Ut}from"./errors-BshsHqbY.js";import{J as Ht,C as Ot,B as ee}from"./ethers-CXBJm_wN.js";import{n as Dt}from"./Tooltip-BLyu7Dfk.js";import{G as Gt}from"./grid.styles-Dc-BunHd.js";import"./sentry-B35L1FdR.js";import"./intl-CBcMB1D2.js";import"./authorizations-DDsnY_Zf.js";import"./sendMetaTransaction-CfYBmJqE.js";function D(o){const i=o.source??"item",l=o.tradeId||`${o.contractAddress}-${o.tokenId??o.itemId??""}`;return`${i}:${l}`}const F="100000000000000000000",We=2,Q=15,qt=/^[a-zA-Z0-9]+$/;function ue(o){const i=o.trim();return i.length===0?{ok:!1,reason:"empty"}:qt.test(i)?i.length<We?{ok:!1,reason:"too-short"}:i.length>Q?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Vt(o){return o.replace(/[^a-zA-Z0-9]/g,"").slice(0,Q)}const Kt=["function available(string _subdomain) view returns (bool)"],ge={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Zt(){return B.chainId===Number(At.ChainId.MATIC_MAINNET)?ge.mainnet:ge.sepolia}async function Jt(o,i={}){var p;const{rpc:l,address:x}=Zt(),c=new Ht(l),d=new Ot(x,Kt,c);console.info(`[names] availability check → DCLRegistrar(${x}).available("${o}") on ${l}`);const h=await d.available(o);if((p=i.signal)!=null&&p.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${o}" available=${h}`),h?"available":"taken"}const Qt="https://app.across.to/api";class Be extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function Xt(o){return at(F,o)}async function Yt(o,i,l={}){var p;const x=l.chainId??B.chainId,c=l.provider??"across",d=`${B.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(i)}&chainId=${x}&provider=${c}`,h=await Je(d,{method:"GET",identity:o,metadata:{}});if(!h.ok){let a;try{a=(p=await h.json())==null?void 0:p.code}catch{}throw a==="ROUTE_COST_TOO_HIGH"?new Be:new Error(`fetchNameCreditRoute ${h.status}`)}return h.json()}function en(o,i){const l=ee.from(o.availableAmount),c=ee.from(F).sub(l);return{credits:[{value:o.amount,expiresAt:Number(o.expiresAt),salt:Ft(o.id)}],creditsSignatures:[o.signature],externalCall:{target:i.externalCall.target,selector:i.externalCall.selector,data:i.externalCall.data,expiresAt:i.externalCall.expiresAt,salt:i.externalCall.salt},customExternalCallSignature:i.customExternalCallSignature,maxUncreditedValue:c.isNegative()?"0":c.toString(),maxCreditedValue:F}}async function tn(o,i={}){const l=Qt,x=i.intervalMs??1e4,c=i.maxAttempts??60;let d={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let h=0;h<c;h++){try{const p=await fetch(`${l}/deposit/status?originChainId=137&depositTxHash=${o}`);if(p.ok){const a=await p.json(),u=(a.status??"pending").toLowerCase(),b=a.fillTx??a.fillTxnRef??null,w=a.actionsSucceeded!==!1;if(u==="filled")return{status:"filled",destinationTxHash:b,actionsSucceeded:w};if(u==="refunded"||u==="expired")return{status:u,destinationTxHash:null,actionsSucceeded:!1};d={status:"pending",destinationTxHash:b,actionsSucceeded:w}}}catch{}h<c-1&&await new Promise(p=>setTimeout(p,x))}return d}async function nn(o){const{name:i,identity:l,signer:x}=o,c=o.chainId??B.chainId,d=o.provider??"across",h=(o.beneficiary??await x.getAddress()).toLowerCase();let p=null,a=!1;console.info("[names] register start",{name:i,buyer:h,chainId:c,provider:d});try{const u=await Lt(c),b=Xt(u);console.info("[names] step 1/6 sized reservation",{usdCents:b,manaRate:u});const w=await Yt(l,i,{chainId:c,provider:d});console.info("[names] step 2/6 route fetched",{target:w.externalCall.target,selector:w.externalCall.selector,provider:w.provider,quoteId:w.quoteId});const j=await Ke(l,b);if(p=j.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:j.credit.id,maxCreditedValue:j.maxCreditedValue}),ee.from(j.maxCreditedValue).lt(F))throw new Error("Credit under-sized for the name price");const $=en(j.credit,w);let f;try{f=await Nt({chainId:c,buyer:h,signer:x,args:$})}catch(y){if(!(y instanceof Mt))throw y;f=await Bt(c,$,x)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:f}),await Pt(f),a=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:f}),d==="across"){const y=await tn(f,o.acrossPoll);if(console.info("[names] step 6/6 across status",y),y.status==="pending")return{status:"pending",originTxHash:f};if(y.status!=="filled"||!y.actionsSucceeded)throw new Error("The name could not be registered on Ethereum; your funds were recovered.");return{status:"registered",originTxHash:f,destinationTxHash:y.destinationTxHash}}return{status:"pending",originTxHash:f}}catch(u){if(console.error("[names] register failed — raw error:",u,{name:i,buyer:h,originConfirmed:a}),u instanceof Wt)return{status:"pending",originTxHash:u.txHash};if(p&&!a&&await Ze(l,[p]).catch(()=>{}),u instanceof Be)throw u;const b=new Error(Ut(u,"Couldn't register the name. Please try again.",{sale:!0}));throw b.cause=u,b}}const sn=n.div`
1
+ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,av as Ke,aw as Ze,d as Je,s as n,t,n as Ie,al as Qe,D as Xe,K as Ae,y as Ye,e as s,I as _,z as W,aT as he,aj as et,ar as J,az as tt,ay as nt,m as Ne,o as st,S as fe,A as O,aU as ot,aV as it}from"./index-kSY8zCTD.js";import{u as rt}from"./useSecondarySales-CiIhx9_Z.js";import{a as at,m as Me}from"./mana-convert-D1hsZ2E6.js";import{u as Pe}from"./useManaRate-CXdHjXW7.js";import{g as lt,h as ct,i as dt,j as pt,k as xt,C as ht,l as ft,o as mt,m as ut,n as gt,M as bt,p as yt,E as wt,q as jt,r as vt,s as $t,t as Ct,u as kt,v as St}from"./Assets.styles-C4uc13ku.js";import{c as me,R as Et,F as _t,S as Tt}from"./categories-CeBHtq1-.js";import{L as Rt}from"./LoadMore-ConDrtOT.js";import{u as zt}from"./useInfiniteGrid-CY-Kev2J.js";import{E as It}from"./ErrorNotice-Cx0COdAr.js";import{d as At}from"./dcl-schemas-BICTSpB5.js";import{s as Nt,G as Mt,w as Pt,S as Wt}from"./buy-gasless-CwH-UbWq.js";import{s as Bt}from"./buy-BI5VTk92.js";import{i as Ft}from"./trade-encoding-D1HYs4M1.js";import{r as Lt}from"./mana-rate-Bnci-S8V.js";import{f as Ut}from"./errors-CQ3rltSg.js";import{J as Ht,C as Ot,B as ee}from"./ethers-CXBJm_wN.js";import{n as Dt}from"./Tooltip-DWPneKP_.js";import{G as Gt}from"./grid.styles-BdBYqxJR.js";import"./sentry-B35L1FdR.js";import"./intl-CBcMB1D2.js";import"./authorizations-epxR5pjl.js";import"./sendMetaTransaction-DwwWcytG.js";function D(o){const i=o.source??"item",l=o.tradeId||`${o.contractAddress}-${o.tokenId??o.itemId??""}`;return`${i}:${l}`}const F="100000000000000000000",We=2,Q=15,qt=/^[a-zA-Z0-9]+$/;function ue(o){const i=o.trim();return i.length===0?{ok:!1,reason:"empty"}:qt.test(i)?i.length<We?{ok:!1,reason:"too-short"}:i.length>Q?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Vt(o){return o.replace(/[^a-zA-Z0-9]/g,"").slice(0,Q)}const Kt=["function available(string _subdomain) view returns (bool)"],ge={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Zt(){return B.chainId===Number(At.ChainId.MATIC_MAINNET)?ge.mainnet:ge.sepolia}async function Jt(o,i={}){var p;const{rpc:l,address:x}=Zt(),c=new Ht(l),d=new Ot(x,Kt,c);console.info(`[names] availability check → DCLRegistrar(${x}).available("${o}") on ${l}`);const h=await d.available(o);if((p=i.signal)!=null&&p.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${o}" available=${h}`),h?"available":"taken"}const Qt="https://app.across.to/api";class Be extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function Xt(o){return at(F,o)}async function Yt(o,i,l={}){var p;const x=l.chainId??B.chainId,c=l.provider??"across",d=`${B.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(i)}&chainId=${x}&provider=${c}`,h=await Je(d,{method:"GET",identity:o,metadata:{}});if(!h.ok){let a;try{a=(p=await h.json())==null?void 0:p.code}catch{}throw a==="ROUTE_COST_TOO_HIGH"?new Be:new Error(`fetchNameCreditRoute ${h.status}`)}return h.json()}function en(o,i){const l=ee.from(o.availableAmount),c=ee.from(F).sub(l);return{credits:[{value:o.amount,expiresAt:Number(o.expiresAt),salt:Ft(o.id)}],creditsSignatures:[o.signature],externalCall:{target:i.externalCall.target,selector:i.externalCall.selector,data:i.externalCall.data,expiresAt:i.externalCall.expiresAt,salt:i.externalCall.salt},customExternalCallSignature:i.customExternalCallSignature,maxUncreditedValue:c.isNegative()?"0":c.toString(),maxCreditedValue:F}}async function tn(o,i={}){const l=Qt,x=i.intervalMs??1e4,c=i.maxAttempts??60;let d={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let h=0;h<c;h++){try{const p=await fetch(`${l}/deposit/status?originChainId=137&depositTxHash=${o}`);if(p.ok){const a=await p.json(),u=(a.status??"pending").toLowerCase(),b=a.fillTx??a.fillTxnRef??null,w=a.actionsSucceeded!==!1;if(u==="filled")return{status:"filled",destinationTxHash:b,actionsSucceeded:w};if(u==="refunded"||u==="expired")return{status:u,destinationTxHash:null,actionsSucceeded:!1};d={status:"pending",destinationTxHash:b,actionsSucceeded:w}}}catch{}h<c-1&&await new Promise(p=>setTimeout(p,x))}return d}async function nn(o){const{name:i,identity:l,signer:x}=o,c=o.chainId??B.chainId,d=o.provider??"across",h=(o.beneficiary??await x.getAddress()).toLowerCase();let p=null,a=!1;console.info("[names] register start",{name:i,buyer:h,chainId:c,provider:d});try{const u=await Lt(c),b=Xt(u);console.info("[names] step 1/6 sized reservation",{usdCents:b,manaRate:u});const w=await Yt(l,i,{chainId:c,provider:d});console.info("[names] step 2/6 route fetched",{target:w.externalCall.target,selector:w.externalCall.selector,provider:w.provider,quoteId:w.quoteId});const j=await Ke(l,b);if(p=j.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:j.credit.id,maxCreditedValue:j.maxCreditedValue}),ee.from(j.maxCreditedValue).lt(F))throw new Error("Credit under-sized for the name price");const $=en(j.credit,w);let f;try{f=await Nt({chainId:c,buyer:h,signer:x,args:$})}catch(y){if(!(y instanceof Mt))throw y;f=await Bt(c,$,x)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:f}),await Pt(f),a=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:f}),d==="across"){const y=await tn(f,o.acrossPoll);if(console.info("[names] step 6/6 across status",y),y.status==="pending")return{status:"pending",originTxHash:f};if(y.status!=="filled"||!y.actionsSucceeded)throw new Error("The name could not be registered on Ethereum; your funds were recovered.");return{status:"registered",originTxHash:f,destinationTxHash:y.destinationTxHash}}return{status:"pending",originTxHash:f}}catch(u){if(console.error("[names] register failed — raw error:",u,{name:i,buyer:h,originConfirmed:a}),u instanceof Wt)return{status:"pending",originTxHash:u.txHash};if(p&&!a&&await Ze(l,[p]).catch(()=>{}),u instanceof Be)throw u;const b=new Error(Ut(u,"Couldn't register the name. Please try again.",{sale:!0}));throw b.cause=u,b}}const sn=n.div`
2
2
  position: fixed;
3
3
  inset: 0;
4
4
  z-index: 10000;
@@ -366,7 +366,7 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,av
366
366
  flex: none;
367
367
  color: ${t.colors.dclRed};
368
368
  }
369
- `;function Sn({name:o,priceCredits:i,onClose:l}){const{session:x}=Ie(),{data:c,isError:d}=Qe(x),h=Xe(),p=ze(),[a,u]=m.useState("confirm"),[b,w]=m.useState(""),[j,$]=m.useState(null),f=m.useRef(!1),y=b.trim().toLowerCase()===o.toLowerCase(),v=a==="completing",k=i!=null?Ae(i):"—";m.useEffect(()=>{const g=T=>{T.key==="Escape"&&!v&&l()};document.addEventListener("keydown",g);const I=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",g),document.body.style.overflow=I}},[v,l]);async function C(){if(!(!x||!y||f.current)){f.current=!0,u("completing"),$(null);try{await nn({name:o,identity:x.identity,signer:x.signer}),J("Shop Completed Purchase",{purchase_type:"name",is_primary:!0,payment_type:"credits",value_credits:i??null}),h.invalidateQueries({queryKey:["usd-balance"]}),h.invalidateQueries({queryKey:["my-assets"]}),u("success")}catch(g){J(nt(g)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:tt(g),purchase_type:"name"}),$((g==null?void 0:g.message)||s("names.errorGeneric")),u("error")}finally{f.current=!1}}}const z=a!=="success",E=Ye(x==null?void 0:x.providerType);return e.jsx(sn,{onClick:v?void 0:l,role:"presentation",children:e.jsxs(on,{role:"dialog","aria-modal":"true","aria-label":s("names.buyTitle"),onClick:g=>g.stopPropagation(),children:[z&&e.jsxs(e.Fragment,{children:[e.jsxs(be,{children:[e.jsx(ye,{children:a==="error"?s("names.errorTitle"):s("names.buyTitle")}),e.jsx(we,{onClick:l,disabled:v,"aria-label":s("buyModal.close"),children:e.jsx(_,{name:"close"})})]}),e.jsxs(je,{children:[s("names.myCreditsBalance")," ",e.jsx(W,{})," ",he(c,d)]}),e.jsx(ve,{})]}),(a==="confirm"||a==="error")&&e.jsxs(e.Fragment,{children:[e.jsxs($e,{children:[e.jsx(Ce,{"aria-hidden":!0,children:"@"}),e.jsxs(ke,{children:[e.jsxs(Se,{children:[o,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ee,{children:s("names.subtitle")})]}),e.jsxs(_e,{children:[e.jsx(W,{}),k]})]}),a==="error"?e.jsxs(e.Fragment,{children:[e.jsxs(kn,{children:[e.jsx(_,{name:"info","aria-hidden":!0}),e.jsx("span",{children:j})]}),e.jsx(Te,{onClick:()=>u("confirm"),children:s("names.tryAgain")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(rn,{children:[e.jsx(an,{children:s("names.confirmTitle")}),e.jsx(ln,{dangerouslySetInnerHTML:{__html:s("names.confirmBody",{name:`<b>@${En(o)}</b>`})}}),e.jsxs(cn,{children:[e.jsx(dn,{"aria-hidden":!0,children:"@"}),e.jsx(pn,{value:b,onChange:g=>w(g.target.value.replace(/[^a-zA-Z0-9]/g,"")),placeholder:"yourname","aria-label":s("names.reenterAria"),autoComplete:"off",spellCheck:!1,style:{width:`${Math.max(b.length,8)}ch`}}),e.jsx(xn,{children:".dcl.eth"})]})]}),e.jsx(Te,{onClick:()=>void C(),disabled:!y||!x,children:s("names.buyCta")})]})]}),a==="completing"&&e.jsxs(hn,{children:[e.jsx(fn,{src:et,alt:"",width:56,height:56}),e.jsx(mn,{children:E?s("names.confirming"):s("names.completing")}),e.jsxs(un,{children:[e.jsx(gn,{"aria-hidden":!0,children:e.jsx("span",{})}),e.jsx(bn,{children:"1/1"})]})]}),a==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs(be,{children:[e.jsx(ye,{children:s("names.successHeaderTitle")}),e.jsx(we,{onClick:l,"aria-label":s("buyModal.close"),children:e.jsx(_,{name:"close"})})]}),e.jsxs(je,{children:[s("names.myCreditsBalance")," ",e.jsx(W,{})," ",he(c,d)]}),e.jsx(ve,{}),e.jsxs(yn,{children:[e.jsx(wn,{"aria-hidden":!0,children:e.jsx(_,{name:"check"})}),e.jsxs(jn,{children:[e.jsx("b",{children:s("names.successBannerBold")})," ",s("names.successBannerRest")]})]}),e.jsxs($e,{style:{marginTop:20},children:[e.jsx(Ce,{"aria-hidden":!0,children:"@"}),e.jsxs(ke,{children:[e.jsxs(Se,{children:[o,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ee,{children:s("names.subtitle")})]}),e.jsxs(_e,{children:[e.jsx(W,{}),k]})]}),e.jsxs(vn,{children:[e.jsx($n,{onClick:()=>{l(),p("/my-assets")},children:s("names.myItems")}),e.jsx(Cn,{href:B.profileUrl,target:"_blank",rel:"noopener noreferrer",children:s("names.assignToAvatar")})]})]})]})})}function En(o){return o.replace(/[&<>"']/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[i])}const _n="https://cdn.decentraland.org/@dcl/shop/0.1.0-30835612462.commit-48765f9/_assets/identity-B4DXDuJP.webp",Tn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30835612462.commit-48765f9/_assets/world-B-9aPlxu.webp",Rn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30835612462.commit-48765f9/_assets/invite-BfwIhP2C.webp",zn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30835612462.commit-48765f9/_assets/governance-DnazlIjy.webp",In=n.div`
369
+ `;function Sn({name:o,priceCredits:i,onClose:l}){const{session:x}=Ie(),{data:c,isError:d}=Qe(x),h=Xe(),p=ze(),[a,u]=m.useState("confirm"),[b,w]=m.useState(""),[j,$]=m.useState(null),f=m.useRef(!1),y=b.trim().toLowerCase()===o.toLowerCase(),v=a==="completing",k=i!=null?Ae(i):"—";m.useEffect(()=>{const g=T=>{T.key==="Escape"&&!v&&l()};document.addEventListener("keydown",g);const I=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",g),document.body.style.overflow=I}},[v,l]);async function C(){if(!(!x||!y||f.current)){f.current=!0,u("completing"),$(null);try{await nn({name:o,identity:x.identity,signer:x.signer}),J("Shop Completed Purchase",{purchase_type:"name",is_primary:!0,payment_type:"credits",value_credits:i??null}),h.invalidateQueries({queryKey:["usd-balance"]}),h.invalidateQueries({queryKey:["my-assets"]}),u("success")}catch(g){J(nt(g)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:tt(g),purchase_type:"name"}),$((g==null?void 0:g.message)||s("names.errorGeneric")),u("error")}finally{f.current=!1}}}const z=a!=="success",E=Ye(x==null?void 0:x.providerType);return e.jsx(sn,{onClick:v?void 0:l,role:"presentation",children:e.jsxs(on,{role:"dialog","aria-modal":"true","aria-label":s("names.buyTitle"),onClick:g=>g.stopPropagation(),children:[z&&e.jsxs(e.Fragment,{children:[e.jsxs(be,{children:[e.jsx(ye,{children:a==="error"?s("names.errorTitle"):s("names.buyTitle")}),e.jsx(we,{onClick:l,disabled:v,"aria-label":s("buyModal.close"),children:e.jsx(_,{name:"close"})})]}),e.jsxs(je,{children:[s("names.myCreditsBalance")," ",e.jsx(W,{})," ",he(c,d)]}),e.jsx(ve,{})]}),(a==="confirm"||a==="error")&&e.jsxs(e.Fragment,{children:[e.jsxs($e,{children:[e.jsx(Ce,{"aria-hidden":!0,children:"@"}),e.jsxs(ke,{children:[e.jsxs(Se,{children:[o,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ee,{children:s("names.subtitle")})]}),e.jsxs(_e,{children:[e.jsx(W,{}),k]})]}),a==="error"?e.jsxs(e.Fragment,{children:[e.jsxs(kn,{children:[e.jsx(_,{name:"info","aria-hidden":!0}),e.jsx("span",{children:j})]}),e.jsx(Te,{onClick:()=>u("confirm"),children:s("names.tryAgain")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(rn,{children:[e.jsx(an,{children:s("names.confirmTitle")}),e.jsx(ln,{dangerouslySetInnerHTML:{__html:s("names.confirmBody",{name:`<b>@${En(o)}</b>`})}}),e.jsxs(cn,{children:[e.jsx(dn,{"aria-hidden":!0,children:"@"}),e.jsx(pn,{value:b,onChange:g=>w(g.target.value.replace(/[^a-zA-Z0-9]/g,"")),placeholder:"yourname","aria-label":s("names.reenterAria"),autoComplete:"off",spellCheck:!1,style:{width:`${Math.max(b.length,8)}ch`}}),e.jsx(xn,{children:".dcl.eth"})]})]}),e.jsx(Te,{onClick:()=>void C(),disabled:!y||!x,children:s("names.buyCta")})]})]}),a==="completing"&&e.jsxs(hn,{children:[e.jsx(fn,{src:et,alt:"",width:56,height:56}),e.jsx(mn,{children:E?s("names.confirming"):s("names.completing")}),e.jsxs(un,{children:[e.jsx(gn,{"aria-hidden":!0,children:e.jsx("span",{})}),e.jsx(bn,{children:"1/1"})]})]}),a==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs(be,{children:[e.jsx(ye,{children:s("names.successHeaderTitle")}),e.jsx(we,{onClick:l,"aria-label":s("buyModal.close"),children:e.jsx(_,{name:"close"})})]}),e.jsxs(je,{children:[s("names.myCreditsBalance")," ",e.jsx(W,{})," ",he(c,d)]}),e.jsx(ve,{}),e.jsxs(yn,{children:[e.jsx(wn,{"aria-hidden":!0,children:e.jsx(_,{name:"check"})}),e.jsxs(jn,{children:[e.jsx("b",{children:s("names.successBannerBold")})," ",s("names.successBannerRest")]})]}),e.jsxs($e,{style:{marginTop:20},children:[e.jsx(Ce,{"aria-hidden":!0,children:"@"}),e.jsxs(ke,{children:[e.jsxs(Se,{children:[o,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ee,{children:s("names.subtitle")})]}),e.jsxs(_e,{children:[e.jsx(W,{}),k]})]}),e.jsxs(vn,{children:[e.jsx($n,{onClick:()=>{l(),p("/my-assets")},children:s("names.myItems")}),e.jsx(Cn,{href:B.profileUrl,target:"_blank",rel:"noopener noreferrer",children:s("names.assignToAvatar")})]})]})]})})}function En(o){return o.replace(/[&<>"']/g,i=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[i])}const _n="https://cdn.decentraland.org/@dcl/shop/0.1.0-30846189899.commit-4a8ddfb/_assets/identity-B4DXDuJP.webp",Tn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30846189899.commit-4a8ddfb/_assets/world-B-9aPlxu.webp",Rn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30846189899.commit-4a8ddfb/_assets/invite-BfwIhP2C.webp",zn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30846189899.commit-4a8ddfb/_assets/governance-DnazlIjy.webp",In=n.div`
370
370
  width: 100%;
371
371
  min-width: 0;
372
372
  `,An=n.nav`
@@ -1,4 +1,4 @@
1
- import{r as $,j as t}from"./react-vyZjIDcS.js";import{R as C,a as oe,C as ie,b as ne}from"./categories-DFgZJeSL.js";import{n as c,T as se}from"./Tooltip-BLyu7Dfk.js";import{t as e,s as o,I as g,e as s,o as ae,h as v}from"./index-CKvAeyW_.js";const re=o.div`
1
+ import{r as $,j as t}from"./react-vyZjIDcS.js";import{R as C,a as oe,C as ie,b as ne}from"./categories-CeBHtq1-.js";import{n as c,T as se}from"./Tooltip-DWPneKP_.js";import{t as e,s as o,I as g,e as s,o as ae,h as v}from"./index-kSY8zCTD.js";const re=o.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 12px;
@@ -1,4 +1,4 @@
1
- import{j as i,L as _,r as F}from"./react-vyZjIDcS.js";import{s as n,B as G,t as a,x as D,m as P,e,n as W,y as O,I as b,z as B,u as w,D as K,c as Q,E as H,F as A,l as X,G as Z,q as E}from"./index-CKvAeyW_.js";import{a as J,b as U,c as V,d as Y,s as tt,f as it}from"./authorizations-DDsnY_Zf.js";import{a as et}from"./builder-BO6I7uZQ.js";import{m as ot}from"./mana-matic-C4e1sNO3.js";import{f as at}from"./errors-BshsHqbY.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-CfYBmJqE.js";const nt=D`
1
+ import{j as i,L as _,r as F}from"./react-vyZjIDcS.js";import{s as n,B as G,t as a,x as D,m as P,e,n as W,y as O,I as b,z as B,u as w,D as K,c as Q,E as H,F as A,l as X,G as Z,q as E}from"./index-kSY8zCTD.js";import{a as J,b as U,c as V,d as Y,s as tt,f as it}from"./authorizations-epxR5pjl.js";import{a as et}from"./builder-BY1-lATK.js";import{m as ot}from"./mana-matic-C4e1sNO3.js";import{f as at}from"./errors-CQ3rltSg.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-DwwWcytG.js";const nt=D`
2
2
  to { transform: rotate(360deg); }
3
3
  `,st=D`
4
4
  to { background-position: -200% 0; }
@@ -1,4 +1,4 @@
1
- import{j as e,L as Se,r as P,b as ea,a as ta}from"./react-vyZjIDcS.js";import{t as le,s as i,e as s,K as de,aj as aa,H as sa,I as H,z as Mt,J as Ue,m as na,ak as Q,R as dt,n as ia,u as ra,al as oa,D as ca,am as da,an as la,ao as ua,ap as ha,y as pa,aq as lt,ar as G,as as ut,at as ga,l as ae,c as ht,au as xa,h as ma,av as pt,aw as _e,ax as ye,ay as be,az as gt,a as ve,b as fa,C as We,aA as ya}from"./index-CKvAeyW_.js";import{M as ba,S as va,C as wa,H as Ca,a as ja,T as ka,X as $a,b as Sa,B as Ma,c as Ta,d as xt,e as Ia,f as ke,P as Tt,m as Pa,g as za,h as Aa,i as Ea,j as It,k as $e,L as qa,l as Ra,n as mt,o as ft,W as Ba,p as _a,q as Wa,A as Fa,r as La,s as Ka,t as Na,u as Ua,v as Qa,w as Ha,x as Oa,y as Va,z as Ga,D as Da,E as Ya,F as Ja,G as Xa,I as Za,J as es,K as Fe,N as ts,O as as,Q as ss,R as ns,U as yt,V as bt,Y as is,Z as rs,_ as os}from"./CollectionCarousel-WI45XOFA.js";import{u as cs}from"./useManaRate-DvHMbg5D.js";import{r as ds}from"./mana-rate-CX4vkbTv.js";import{i as ls,j as us,f as hs,n as ps,h as gs,A as xs}from"./authorizations-DDsnY_Zf.js";import{g as ms,b as Le}from"./buy-DN9Q4fmJ.js";import{b as fs,w as ys,S as vt,G as bs}from"./buy-gasless-Cxl5QDDd.js";import{u as vs,M as ws,R as we,r as Cs,c as js,p as wt}from"./useCreditPacks-CQXC1itx.js";import{i as ks,a as $s}from"./errors-BshsHqbY.js";import{E as Ss}from"./ErrorNotice-q0dn0iRL.js";import{u as Ct}from"./mana-convert-fQ28xr65.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-DPKBDNkR.js";import"./sendMetaTransaction-CfYBmJqE.js";const{colors:se,radius:Ms}=le,Ts=i.div`
1
+ import{j as e,L as Se,r as P,b as ea,a as ta}from"./react-vyZjIDcS.js";import{t as le,s as i,e as s,K as de,aj as aa,H as sa,I as H,z as Mt,J as Ue,m as na,ak as Q,R as dt,n as ia,u as ra,al as oa,D as ca,am as da,an as la,ao as ua,ap as ha,y as pa,aq as lt,ar as G,as as ut,at as ga,l as ae,c as ht,au as xa,h as ma,av as pt,aw as _e,ax as ye,ay as be,az as gt,a as ve,b as fa,C as We,aA as ya}from"./index-kSY8zCTD.js";import{M as ba,S as va,C as wa,H as Ca,a as ja,T as ka,X as $a,b as Sa,B as Ma,c as Ta,d as xt,e as Ia,f as ke,P as Tt,m as Pa,g as za,h as Aa,i as Ea,j as It,k as $e,L as qa,l as Ra,n as mt,o as ft,W as Ba,p as _a,q as Wa,A as Fa,r as La,s as Ka,t as Na,u as Ua,v as Qa,w as Ha,x as Oa,y as Va,z as Ga,D as Da,E as Ya,F as Ja,G as Xa,I as Za,J as es,K as Fe,N as ts,O as as,Q as ss,R as ns,U as yt,V as bt,Y as is,Z as rs,_ as os}from"./CollectionCarousel-D_-sxfGs.js";import{u as cs}from"./useManaRate-CXdHjXW7.js";import{r as ds}from"./mana-rate-Bnci-S8V.js";import{i as ls,j as us,f as hs,n as ps,h as gs,A as xs}from"./authorizations-epxR5pjl.js";import{g as ms,b as Le}from"./buy-BI5VTk92.js";import{b as fs,w as ys,S as vt,G as bs}from"./buy-gasless-CwH-UbWq.js";import{u as vs,M as ws,R as we,r as Cs,c as js,p as wt}from"./useCreditPacks-DGRmK8hf.js";import{i as ks,a as $s}from"./errors-CQ3rltSg.js";import{E as Ss}from"./ErrorNotice-Cx0COdAr.js";import{u as Ct}from"./mana-convert-D1hsZ2E6.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-D1HYs4M1.js";import"./sendMetaTransaction-DwwWcytG.js";const{colors:se,radius:Ms}=le,Ts=i.div`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
@@ -58,7 +58,7 @@ import{j as e,L as Se,r as P,b as ea,a as ta}from"./react-vyZjIDcS.js";import{t
58
58
  font-weight: 700;
59
59
  color: ${se.text};
60
60
  }
61
- `,Es="https://cdn.decentraland.org/@dcl/shop/0.1.0-30835612462.commit-48765f9/_assets/buy-error-22UunaPC.png";function qs(o){const{phase:l,balanceCredits:I,onClose:z}=o,W=l==="processing",D=l==="error"?s("cartCheckout.errorTitle"):l==="nofunds"?s("cartCheckout.titleNoFunds"):l==="choose"?s("buyModal.choosePayment"):s("cartCheckout.titleBuy"),Y=l==="processing";return e.jsxs(ba,{role:"dialog","aria-modal":"true","aria-label":s("cartCheckout.dialogAria"),children:[e.jsx(va,{onClick:W?void 0:z,"aria-hidden":!0}),e.jsxs(wa,{"data-tall":Y||void 0,children:[e.jsxs(Ca,{children:[e.jsxs(ja,{children:[e.jsx(ka,{children:D}),!W&&e.jsx($a,{onClick:z,"aria-label":s("buyModal.close"),children:e.jsx(Sa,{})})]}),e.jsxs(Ma,{children:[e.jsx(Ta,{children:l==="nofunds"?s("buyModal.dclBalance"):s("buyModal.myCreditsBalance")}),e.jsx(xt,{}),e.jsx(Ia,{children:de(I)})]})]}),l==="choose"&&e.jsxs(ke,{children:[e.jsxs(As,{children:[e.jsx("span",{children:s("cart.purchaseSummary")}),e.jsxs("strong",{children:[e.jsx(xt,{}),de(o.totalCredits??0)]})]}),e.jsx(Tt,{options:o.options??[],totalCents:o.totalCents??0,onPay:o.onPay??(()=>{}),rateNote:(()=>{const A=Pa(o.totalCents??0,o.totalManaWei??0n);return A!=null?s("buyModal.manaRate",{mana:A.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),l==="processing"&&e.jsx(Rs,{stage:o.stage??"reserving",step:o.step??1,total:o.total??1,isSelfCustody:!!o.isSelfCustody,signatures:o.signatures}),l==="nofunds"&&e.jsx(Bs,{lines:o.lines??[],shortfallCredits:o.shortfallCredits??0,packs:o.packs??[],selectedPack:o.selectedPack??"",onSelectPack:o.onSelectPack??(()=>{}),onBuyPacks:o.onBuyPacks??(()=>{}),onCancel:z}),l==="error"&&e.jsxs(ke,{children:[e.jsxs(za,{"data-testid":"buy-error",children:[e.jsx(Aa,{src:Es,alt:"",width:64,height:80}),e.jsxs(Ea,{children:[e.jsx("b",{children:s("cartCheckout.errorHeadline")})," ",o.message??s("cartCheckout.errorBody")]})]}),e.jsxs(It,{children:[e.jsx($e,{"data-variant":"outline",onClick:z,children:s("buyModal.cancel")}),e.jsx($e,{"data-variant":"purple",onClick:o.onRetry??z,children:s("cartCheckout.tryAgain")})]})]})]})]})}function Rs({stage:o,step:l,total:I,isSelfCustody:z,signatures:W}){const D=o==="reserving",Y=I>0?Math.min(100,Math.round(l/I*100)):0,A=z&&W&&W.total>1,ne=o==="awaiting-signature"?z?A?s("cartCheckout.confirmMultiple",{current:W.current,total:W.total}):s("buyModal.confirmToContinue"):s("buyModal.completingTransaction"):o==="settling"?s("buyModal.completingTransaction"):s("cartCheckout.preparing");return e.jsxs(ke,{"data-processing":!0,children:[e.jsx(qa,{src:aa,alt:"",width:61,height:61}),e.jsx(Ra,{children:ne}),D?e.jsxs(Ts,{children:[e.jsx(mt,{"aria-hidden":!0,children:e.jsx(ft,{"data-step":!0,style:{width:`${Y}%`}})}),I>1?e.jsxs(Is,{children:[l,"/",I]}):null]}):e.jsx(mt,{"aria-hidden":!0,children:e.jsx(ft,{})})]})}function Bs({lines:o,shortfallCredits:l,packs:I,selectedPack:z,onSelectPack:W,onBuyPacks:D,onCancel:Y}){const A=I.find(n=>n.id===z),ne=o.reduce((n,L)=>n+(L.quantity??1),0);return e.jsxs(ke,{children:[e.jsxs(Ba,{"data-testid":"nofunds-warning",children:[e.jsx(_a,{}),e.jsxs(Wa,{children:[e.jsx("b",{children:s("buyModal.insufficientFunds")})," ",s("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:s("buyModal.warningCreditsAmount",{count:Math.max(0,l)})})," ",s("buyModal.warningToPurchase",{count:ne})]})]}),e.jsx(Ps,{children:o.map(n=>{const L=n.quantity??1;return e.jsxs(Fa,{children:[e.jsx(La,{children:n.item.thumbnail?e.jsx("img",{src:n.item.thumbnail,alt:""}):null}),e.jsxs(Ka,{children:[e.jsxs("div",{children:[e.jsxs(Na,{title:n.item.name,children:[n.item.name||s("buyModal.itemFallback"),L>1?e.jsx(zs,{children:s("cartCheckout.qty",{count:L})}):null]}),n.item.creator?e.jsx(Ua,{address:n.item.creator}):null]}),e.jsxs(Qa,{children:[e.jsx(Ha,{}),e.jsx("span",{children:de(n.priceCredits*L)})]})]})]},n.item.id)})}),e.jsx(Oa,{children:I.map(n=>{const L=n.id===z;return e.jsxs(Va,{"data-testid":"credit-pack","data-on":L||void 0,onClick:()=>W(n.id),children:[e.jsx(Ga,{}),e.jsx(Da,{children:de(n.credits)}),e.jsxs(Ya,{children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs(Ja,{children:[e.jsxs(Xa,{children:[e.jsx(Za,{}),e.jsx("span",{children:de((A==null?void 0:A.credits)??0)})]}),e.jsxs(es,{children:["$",((A==null?void 0:A.usd)??0).toFixed(2)]})]}),e.jsxs(It,{children:[e.jsx($e,{"data-variant":"outline",onClick:Y,children:s("buyModal.cancel")}),e.jsx($e,{"data-variant":"gradient",onClick:D,children:s("buyModal.buy")})]})]})}const{colors:r,gradients:Pt,radius:Z}=le,zt="@media (max-width: 1080px)",T="@media (max-width: 880px)",jt=i.div`
61
+ `,Es="https://cdn.decentraland.org/@dcl/shop/0.1.0-30846189899.commit-4a8ddfb/_assets/buy-error-22UunaPC.png";function qs(o){const{phase:l,balanceCredits:I,onClose:z}=o,W=l==="processing",D=l==="error"?s("cartCheckout.errorTitle"):l==="nofunds"?s("cartCheckout.titleNoFunds"):l==="choose"?s("buyModal.choosePayment"):s("cartCheckout.titleBuy"),Y=l==="processing";return e.jsxs(ba,{role:"dialog","aria-modal":"true","aria-label":s("cartCheckout.dialogAria"),children:[e.jsx(va,{onClick:W?void 0:z,"aria-hidden":!0}),e.jsxs(wa,{"data-tall":Y||void 0,children:[e.jsxs(Ca,{children:[e.jsxs(ja,{children:[e.jsx(ka,{children:D}),!W&&e.jsx($a,{onClick:z,"aria-label":s("buyModal.close"),children:e.jsx(Sa,{})})]}),e.jsxs(Ma,{children:[e.jsx(Ta,{children:l==="nofunds"?s("buyModal.dclBalance"):s("buyModal.myCreditsBalance")}),e.jsx(xt,{}),e.jsx(Ia,{children:de(I)})]})]}),l==="choose"&&e.jsxs(ke,{children:[e.jsxs(As,{children:[e.jsx("span",{children:s("cart.purchaseSummary")}),e.jsxs("strong",{children:[e.jsx(xt,{}),de(o.totalCredits??0)]})]}),e.jsx(Tt,{options:o.options??[],totalCents:o.totalCents??0,onPay:o.onPay??(()=>{}),rateNote:(()=>{const A=Pa(o.totalCents??0,o.totalManaWei??0n);return A!=null?s("buyModal.manaRate",{mana:A.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),l==="processing"&&e.jsx(Rs,{stage:o.stage??"reserving",step:o.step??1,total:o.total??1,isSelfCustody:!!o.isSelfCustody,signatures:o.signatures}),l==="nofunds"&&e.jsx(Bs,{lines:o.lines??[],shortfallCredits:o.shortfallCredits??0,packs:o.packs??[],selectedPack:o.selectedPack??"",onSelectPack:o.onSelectPack??(()=>{}),onBuyPacks:o.onBuyPacks??(()=>{}),onCancel:z}),l==="error"&&e.jsxs(ke,{children:[e.jsxs(za,{"data-testid":"buy-error",children:[e.jsx(Aa,{src:Es,alt:"",width:64,height:80}),e.jsxs(Ea,{children:[e.jsx("b",{children:s("cartCheckout.errorHeadline")})," ",o.message??s("cartCheckout.errorBody")]})]}),e.jsxs(It,{children:[e.jsx($e,{"data-variant":"outline",onClick:z,children:s("buyModal.cancel")}),e.jsx($e,{"data-variant":"purple",onClick:o.onRetry??z,children:s("cartCheckout.tryAgain")})]})]})]})]})}function Rs({stage:o,step:l,total:I,isSelfCustody:z,signatures:W}){const D=o==="reserving",Y=I>0?Math.min(100,Math.round(l/I*100)):0,A=z&&W&&W.total>1,ne=o==="awaiting-signature"?z?A?s("cartCheckout.confirmMultiple",{current:W.current,total:W.total}):s("buyModal.confirmToContinue"):s("buyModal.completingTransaction"):o==="settling"?s("buyModal.completingTransaction"):s("cartCheckout.preparing");return e.jsxs(ke,{"data-processing":!0,children:[e.jsx(qa,{src:aa,alt:"",width:61,height:61}),e.jsx(Ra,{children:ne}),D?e.jsxs(Ts,{children:[e.jsx(mt,{"aria-hidden":!0,children:e.jsx(ft,{"data-step":!0,style:{width:`${Y}%`}})}),I>1?e.jsxs(Is,{children:[l,"/",I]}):null]}):e.jsx(mt,{"aria-hidden":!0,children:e.jsx(ft,{})})]})}function Bs({lines:o,shortfallCredits:l,packs:I,selectedPack:z,onSelectPack:W,onBuyPacks:D,onCancel:Y}){const A=I.find(n=>n.id===z),ne=o.reduce((n,L)=>n+(L.quantity??1),0);return e.jsxs(ke,{children:[e.jsxs(Ba,{"data-testid":"nofunds-warning",children:[e.jsx(_a,{}),e.jsxs(Wa,{children:[e.jsx("b",{children:s("buyModal.insufficientFunds")})," ",s("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:s("buyModal.warningCreditsAmount",{count:Math.max(0,l)})})," ",s("buyModal.warningToPurchase",{count:ne})]})]}),e.jsx(Ps,{children:o.map(n=>{const L=n.quantity??1;return e.jsxs(Fa,{children:[e.jsx(La,{children:n.item.thumbnail?e.jsx("img",{src:n.item.thumbnail,alt:""}):null}),e.jsxs(Ka,{children:[e.jsxs("div",{children:[e.jsxs(Na,{title:n.item.name,children:[n.item.name||s("buyModal.itemFallback"),L>1?e.jsx(zs,{children:s("cartCheckout.qty",{count:L})}):null]}),n.item.creator?e.jsx(Ua,{address:n.item.creator}):null]}),e.jsxs(Qa,{children:[e.jsx(Ha,{}),e.jsx("span",{children:de(n.priceCredits*L)})]})]})]},n.item.id)})}),e.jsx(Oa,{children:I.map(n=>{const L=n.id===z;return e.jsxs(Va,{"data-testid":"credit-pack","data-on":L||void 0,onClick:()=>W(n.id),children:[e.jsx(Ga,{}),e.jsx(Da,{children:de(n.credits)}),e.jsxs(Ya,{children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs(Ja,{children:[e.jsxs(Xa,{children:[e.jsx(Za,{}),e.jsx("span",{children:de((A==null?void 0:A.credits)??0)})]}),e.jsxs(es,{children:["$",((A==null?void 0:A.usd)??0).toFixed(2)]})]}),e.jsxs(It,{children:[e.jsx($e,{"data-variant":"outline",onClick:Y,children:s("buyModal.cancel")}),e.jsx($e,{"data-variant":"gradient",onClick:D,children:s("buyModal.buy")})]})]})}const{colors:r,gradients:Pt,radius:Z}=le,zt="@media (max-width: 1080px)",T="@media (max-width: 880px)",jt=i.div`
62
62
  max-width: 1510px;
63
63
  margin: 0 auto;
64
64
  /* Grows into the page's leftover height and passes it down to Upsell, so the white cross-sell band ends at
@@ -1,4 +1,4 @@
1
- import{N,O as U,P as o,Q as n,J as D,x as M}from"./index-CKvAeyW_.js";import{r as w,j as g}from"./react-vyZjIDcS.js";import{g as z,a as E,c as I,b as F,s as v}from"./clsx-Dv5E4mS4.js";function K(r){return z("MuiCircularProgress",r)}E("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const W=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,b,S,$;const t=44,B=M(P||(P=l`
1
+ import{N,O as U,P as o,Q as n,J as D,x as M}from"./index-kSY8zCTD.js";import{r as w,j as g}from"./react-vyZjIDcS.js";import{g as z,a as E,c as I,b as F,s as v}from"./clsx-BcR9gED7.js";function K(r){return z("MuiCircularProgress",r)}E("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const W=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,b,S,$;const t=44,B=M(P||(P=l`
2
2
  0% {
3
3
  transform: rotate(0deg);
4
4
  }
@@ -1,4 +1,4 @@
1
- import{j as e,r as m,e as Y,b as Z}from"./react-vyZjIDcS.js";import{t as v,s as c,ag as J,E,I as X,e as a,c as ee,l as te,u as ae,m as re,h as oe,S as z,A as ie,ah as se,ai as ne}from"./index-CKvAeyW_.js";import{E as ce}from"./ErrorNotice-q0dn0iRL.js";import{d as le,g as de,a as pe,P as xe,C as ue,b as me,c as ge,B as he,S as be,M as fe,A as je}from"./browseLayout.styles-u63rKyzf.js";import{u as ve}from"./useStore-55b8sEvt.js";import{c as F,a as ye,F as Ce,d as we,P as Se,e as ke,H as Ae,S as Ne}from"./categories-DFgZJeSL.js";import{L as $e}from"./LoadMore-DoQvuFO_.js";import{u as Pe}from"./useInfiniteGrid-CK8TA2xA.js";import{G as Me}from"./grid.styles-Dc-BunHd.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";const Re=c.section`
1
+ import{j as e,r as m,e as Y,b as Z}from"./react-vyZjIDcS.js";import{t as v,s as c,ag as J,E,I as X,e as a,c as ee,l as te,u as ae,m as re,h as oe,S as z,A as ie,ah as se,ai as ne}from"./index-kSY8zCTD.js";import{E as ce}from"./ErrorNotice-Cx0COdAr.js";import{d as le,g as de,a as pe,P as xe,C as ue,b as me,c as ge,B as he,S as be,M as fe,A as je}from"./browseLayout.styles-ChD_QYf4.js";import{u as ve}from"./useStore-DUeF63tD.js";import{c as F,a as ye,F as Ce,d as we,P as Se,e as ke,H as Ae,S as Ne}from"./categories-CeBHtq1-.js";import{L as $e}from"./LoadMore-ConDrtOT.js";import{u as Pe}from"./useInfiniteGrid-CY-Kev2J.js";import{G as Me}from"./grid.styles-BdBYqxJR.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";const Re=c.section`
2
2
  position: relative;
3
3
  border-radius: ${v.radius.card};
4
4
  overflow: hidden;
@@ -1,4 +1,4 @@
1
- import{j as t,r as v}from"./react-vyZjIDcS.js";import{s as e,t as o,e as g,z as k,K as j,bd as C,h as G,x as Y,I as Q,l as X,a as W,C as E,b as Z,be as J,bf as F,A as q}from"./index-CKvAeyW_.js";import{s as ee,h as U,A as H,g as K,r as te,m as ne,e as ae}from"./authorizations-DDsnY_Zf.js";import{i as ie}from"./errors-BshsHqbY.js";import{E as oe}from"./ErrorNotice-q0dn0iRL.js";import{a as se}from"./buy-DN9Q4fmJ.js";import{g as re,d as ce}from"./trade-encoding-DPKBDNkR.js";import{s as de,M as le,E as pe}from"./sendMetaTransaction-CfYBmJqE.js";import{I as he,C as ue}from"./ethers-CXBJm_wN.js";const R="shop:resume_after_signin",xe=900*1e3;function rt(a){try{sessionStorage.setItem(R,JSON.stringify({...a,at:Date.now()}))}catch{}}function ct(a){let n;try{n=sessionStorage.getItem(R)}catch{return null}if(!n)return null;try{sessionStorage.removeItem(R)}catch{}let i;try{i=JSON.parse(n)}catch{return null}return!i||i.type!==a||typeof i.at!="number"||Date.now()-i.at>xe?null:i.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:i.path}}function ge(a,n){return(a+n-1n)/n}function fe(a,n,i){return a<=0||n<=0?0n:a>=n?i:ge(i*BigInt(a),BigInt(n))}function dt(a){var b,y,w;const n=Number.isFinite(a.priceCents)?Math.max(0,Math.trunc(a.priceCents)):0,i=Number.isFinite(a.balanceCents)?Math.max(0,Math.trunc(a.balanceCents)):0,s=a.priceManaWei>0n?a.priceManaWei:0n,d=a.manaBalanceWei>0n?a.manaBalanceWei:0n;if(n<=0)return{options:[],preferred:null,manaShortfall:null};const c=[];if(i>=n&&c.push({method:"credits",creditsCents:n,manaWei:0n}),s>0n&&i>0&&i<n){const l=n-i,f=fe(l,n,s);d>=f&&c.push({method:"combined",creditsCents:i,manaWei:f})}s>0n&&d>=s&&c.push({method:"mana",creditsCents:0,manaWei:s});const p=((b=c.find(l=>l.method==="credits"))==null?void 0:b.method)??((y=c.find(l=>l.method==="combined"))==null?void 0:y.method)??((w=c.find(l=>l.method==="mana"))==null?void 0:w.method)??null,m=!c.some(l=>l.method==="mana"||l.method==="combined")&&s>0n&&d>0n?{manaWei:d,manaCents:me(d,n,s),priceCents:n}:null;return{options:c,preferred:p,manaShortfall:m}}function me(a,n,i){return Number(a*BigInt(n)/i)}function lt(a,n){let i=Number.isFinite(n)?Math.max(0,Math.trunc(n)):0;return a.map(s=>{const d=Number.isFinite(s)?Math.max(0,Math.trunc(s)):0,c=Math.min(d,i);return i-=c,c})}function z(a){return Number.isFinite(a)?Math.max(0,a)/10:0}function pt(a,n){return a.options.find(i=>i.method===n)??null}function ht(a,n){if(!Number.isFinite(a)||a<=0||n<=0n)return null;const i=a/10;return Number(n)/1e18/i}const T="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group%201'%3e%3cpath%20id='Vector'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%202L22%2012L12%2022L2%2012L12%202ZM12%204.8L19.2%2012L12%2019.2L4.8%2012L12%204.8ZM12%2015.6C12.9548%2015.6001%2013.8705%2015.2209%2014.5457%2014.5459C15.2209%2013.8708%2015.6003%2012.9552%2015.6004%2012.0004C15.6005%2011.0456%2015.2213%2010.1299%2014.5463%209.45471C13.8712%208.7795%2012.9556%208.40011%2012.0008%208.4C11.0461%208.4%2010.1304%208.77928%209.45525%209.45442C8.78012%2010.1295%208.40083%2011.0452%208.40083%2012C8.40083%2012.9548%208.78012%2013.8705%209.45525%2014.5456C10.1304%2015.2207%2011.0461%2015.6%2012.0008%2015.6H12Z'%20fill='white'/%3e%3cg%20id='Rectangle%201'%3e%3c/g%3e%3c/g%3e%3c/svg%3e",be=e.div`
1
+ import{j as t,r as v}from"./react-vyZjIDcS.js";import{s as e,t as o,e as g,z as k,K as j,be as C,h as G,x as Y,I as Q,l as X,a as W,C as E,b as Z,bf as J,bg as F,A as q}from"./index-kSY8zCTD.js";import{s as ee,h as U,A as H,g as K,r as te,m as ne,e as ae}from"./authorizations-epxR5pjl.js";import{i as ie}from"./errors-CQ3rltSg.js";import{E as oe}from"./ErrorNotice-Cx0COdAr.js";import{a as se}from"./buy-BI5VTk92.js";import{g as re,d as ce}from"./trade-encoding-D1HYs4M1.js";import{s as de,M as le,E as pe}from"./sendMetaTransaction-DwwWcytG.js";import{I as he,C as ue}from"./ethers-CXBJm_wN.js";const R="shop:resume_after_signin",xe=900*1e3;function rt(a){try{sessionStorage.setItem(R,JSON.stringify({...a,at:Date.now()}))}catch{}}function ct(a){let n;try{n=sessionStorage.getItem(R)}catch{return null}if(!n)return null;try{sessionStorage.removeItem(R)}catch{}let i;try{i=JSON.parse(n)}catch{return null}return!i||i.type!==a||typeof i.at!="number"||Date.now()-i.at>xe?null:i.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:i.path}}function ge(a,n){return(a+n-1n)/n}function fe(a,n,i){return a<=0||n<=0?0n:a>=n?i:ge(i*BigInt(a),BigInt(n))}function dt(a){var b,y,w;const n=Number.isFinite(a.priceCents)?Math.max(0,Math.trunc(a.priceCents)):0,i=Number.isFinite(a.balanceCents)?Math.max(0,Math.trunc(a.balanceCents)):0,s=a.priceManaWei>0n?a.priceManaWei:0n,d=a.manaBalanceWei>0n?a.manaBalanceWei:0n;if(n<=0)return{options:[],preferred:null,manaShortfall:null};const c=[];if(i>=n&&c.push({method:"credits",creditsCents:n,manaWei:0n}),s>0n&&i>0&&i<n){const l=n-i,f=fe(l,n,s);d>=f&&c.push({method:"combined",creditsCents:i,manaWei:f})}s>0n&&d>=s&&c.push({method:"mana",creditsCents:0,manaWei:s});const p=((b=c.find(l=>l.method==="credits"))==null?void 0:b.method)??((y=c.find(l=>l.method==="combined"))==null?void 0:y.method)??((w=c.find(l=>l.method==="mana"))==null?void 0:w.method)??null,m=!c.some(l=>l.method==="mana"||l.method==="combined")&&s>0n&&d>0n?{manaWei:d,manaCents:me(d,n,s),priceCents:n}:null;return{options:c,preferred:p,manaShortfall:m}}function me(a,n,i){return Number(a*BigInt(n)/i)}function lt(a,n){let i=Number.isFinite(n)?Math.max(0,Math.trunc(n)):0;return a.map(s=>{const d=Number.isFinite(s)?Math.max(0,Math.trunc(s)):0,c=Math.min(d,i);return i-=c,c})}function z(a){return Number.isFinite(a)?Math.max(0,a)/10:0}function pt(a,n){return a.options.find(i=>i.method===n)??null}function ht(a,n){if(!Number.isFinite(a)||a<=0||n<=0n)return null;const i=a/10;return Number(n)/1e18/i}const T="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group%201'%3e%3cpath%20id='Vector'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%202L22%2012L12%2022L2%2012L12%202ZM12%204.8L19.2%2012L12%2019.2L4.8%2012L12%204.8ZM12%2015.6C12.9548%2015.6001%2013.8705%2015.2209%2014.5457%2014.5459C15.2209%2013.8708%2015.6003%2012.9552%2015.6004%2012.0004C15.6005%2011.0456%2015.2213%2010.1299%2014.5463%209.45471C13.8712%208.7795%2012.9556%208.40011%2012.0008%208.4C11.0461%208.4%2010.1304%208.77928%209.45525%209.45442C8.78012%2010.1295%208.40083%2011.0452%208.40083%2012C8.40083%2012.9548%208.78012%2013.8705%209.45525%2014.5456C10.1304%2015.2207%2011.0461%2015.6%2012.0008%2015.6H12Z'%20fill='white'/%3e%3cg%20id='Rectangle%201'%3e%3c/g%3e%3c/g%3e%3c/svg%3e",be=e.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 12px;
@@ -0,0 +1,306 @@
1
+ import{b as Y,j as e,L as ue,e as fe,u as be,r as y}from"./react-vyZjIDcS.js";import{t as J,aB as we,aC as R,aD as _,s as a,aE as je,H as ve,aF as Ce,e as t,aG as ye,aH as W,B as $e,J as Z,ag as q,n as ke,E as Q,I as T,c as Ne,m as Pe,S,h as Se,A as Le,aA as Ae,aI as Me}from"./index-kSY8zCTD.js";import{d as Fe,g as Ee,a as ze,P as Be,C as Ie,b as Re,c as _e,A as We,B as Te,S as He,M as Ge,e as Ue,f as De}from"./browseLayout.styles-ChD_QYf4.js";import{u as Ke,L as Oe}from"./useStore-DUeF63tD.js";import{c as H,a as Ve,F as Ye,d as Je,P as Ze,e as qe,H as Qe,S as Xe}from"./categories-CeBHtq1-.js";import{L as G}from"./LoadMore-ConDrtOT.js";import{u as U}from"./useInfiniteGrid-CY-Kev2J.js";import{E as D}from"./ErrorNotice-Cx0COdAr.js";import{G as K}from"./grid.styles-BdBYqxJR.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";const{colors:u,radius:X,media:et}=J,tt=a.article`
2
+ height: 300px;
3
+ background: ${u.bg};
4
+ border-radius: ${X.card};
5
+ overflow: hidden;
6
+ position: relative;
7
+ isolation: isolate;
8
+ display: flex;
9
+ flex-direction: column;
10
+ cursor: pointer;
11
+ transition: box-shadow 0.15s ease;
12
+
13
+ &::after {
14
+ ${we};
15
+ }
16
+
17
+ &:focus-visible {
18
+ ${R};
19
+ }
20
+ &:focus-visible::after {
21
+ ${_};
22
+ }
23
+
24
+ // The swap is a pointer affordance only: keyboard focus must not hide the creator row, whose profile
25
+ // link is focusable (visibility: hidden would drop it from the tab order). Enter/Space on the card
26
+ // already opens the collection.
27
+ @media (hover: hover) {
28
+ &:hover {
29
+ ${R};
30
+ }
31
+ &:hover::after {
32
+ ${_};
33
+ }
34
+ &:hover [data-view] {
35
+ visibility: visible;
36
+ }
37
+ &:hover [data-meta] {
38
+ visibility: hidden;
39
+ }
40
+ }
41
+ `,it=a.div`
42
+ position: relative;
43
+ flex: 1;
44
+ min-height: 0;
45
+ background: ${u.media};
46
+ overflow: hidden;
47
+ `,ot=a.img`
48
+ width: 100%;
49
+ height: 100%;
50
+ object-fit: cover;
51
+ display: block;
52
+ `,at=a(je)`
53
+ & [data-testid='coll-thumb-cell'] img {
54
+ object-fit: contain;
55
+ padding: 10px;
56
+ }
57
+ `,rt=a.div`
58
+ flex: 0 0 102px;
59
+ height: 102px;
60
+ padding: 12px 14px;
61
+ display: flex;
62
+ flex-direction: column;
63
+ gap: 8px;
64
+ `,st=a.h3`
65
+ margin: 0;
66
+ font-weight: 700;
67
+ font-size: 18px;
68
+ line-height: 1.3;
69
+ color: ${u.text};
70
+ white-space: nowrap;
71
+ overflow: hidden;
72
+ text-overflow: ellipsis;
73
+
74
+ ${et.maxWidth("mobile")} {
75
+ font-size: 16px;
76
+ }
77
+ `,nt=a.div`
78
+ flex: 1;
79
+ min-height: 0;
80
+ display: grid;
81
+ grid-template-areas: 'stack';
82
+ align-items: center;
83
+
84
+ & > * {
85
+ grid-area: stack;
86
+ }
87
+ `,ct=a.div`
88
+ display: flex;
89
+ align-items: center;
90
+ justify-content: space-between;
91
+ gap: 10px;
92
+ `,lt=a(ve)`
93
+ min-width: 0;
94
+ color: ${u.muted};
95
+
96
+ & [data-avatar] {
97
+ width: 24px;
98
+ height: 24px;
99
+ }
100
+ & [data-testid='creator-name'] {
101
+ font-size: 14px;
102
+ }
103
+ & [data-testid='creator-display'] {
104
+ color: ${u.dclRed};
105
+ font-weight: 700;
106
+ }
107
+ `,dt=a.span`
108
+ min-width: 0;
109
+ `,ht=a.span`
110
+ flex: none;
111
+ color: ${u.text};
112
+ font-weight: 600;
113
+ font-size: 14px;
114
+ white-space: nowrap;
115
+ `,xt=a.button`
116
+ visibility: hidden;
117
+ width: 100%;
118
+ height: 44px;
119
+ display: flex;
120
+ align-items: center;
121
+ justify-content: center;
122
+ background: ${u.accent};
123
+ color: ${u.softWhite};
124
+ border: 0;
125
+ border-radius: ${X.btn};
126
+ font-weight: 700;
127
+ font-size: 13px;
128
+ text-transform: uppercase;
129
+ letter-spacing: 0.046em;
130
+ transition: background 0.15s ease;
131
+
132
+ &:hover {
133
+ background: ${u.accentHover};
134
+ }
135
+ &:active {
136
+ background: ${u.accentActive};
137
+ }
138
+ `;function pt({collection:r,cover:i,itemCount:s}){const n=Y(),{contractAddress:g,name:x,creator:f}=r,C=i==null||s==null,{data:d}=Ce(g,C),w=i==null?(d==null?void 0:d.items)??[]:[],m=s??(d==null?void 0:d.total);function b(){n(`/collection/${g}`)}return e.jsxs(tt,{"data-testid":"coll-card",role:"link",tabIndex:0,onClick:b,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),b())},children:[e.jsx(it,{children:i?e.jsx(ot,{"data-testid":"coll-card-img",src:i,alt:"",loading:"lazy"}):w.length>0?e.jsx(at,{items:w,tinted:!1}):null}),e.jsxs(rt,{children:[e.jsx(st,{title:x,children:x}),e.jsxs(nt,{children:[e.jsxs(ct,{"data-meta":!0,"data-testid":"coll-card-meta",children:[f?e.jsx(lt,{address:f,linkToProfile:!0}):e.jsx(dt,{children:" "}),e.jsx(ht,{children:m==null?"…":t("collectionCard.itemCount",{count:m})})]}),e.jsx(xt,{"data-view":!0,"data-testid":"coll-card-view",onClick:h=>{h.stopPropagation(),b()},tabIndex:-1,children:t("collectionCard.viewCollection")})]})]})]})}function gt({address:r,className:i=""}){const s=ye(),n=W(x=>x.followed.includes(r.toLowerCase())),g=W(x=>x.toggle);return!s||!r?null:e.jsx($e,{type:"button",size:"sm",variant:n?"ghost":"outline",className:i||void 0,"aria-pressed":n,title:n?t("creator.unfollowTitle"):t("creator.followTitle"),onClick:()=>g(r),children:n?t("creator.following"):t("creator.follow")})}const{colors:v,radius:ee,media:j}=J,te=Z`
139
+ display: inline-flex;
140
+ align-items: center;
141
+ justify-content: center;
142
+ height: 44px;
143
+ padding: 0 28px;
144
+ border: 2px solid ${v.white};
145
+ border-radius: ${ee.btn};
146
+ background: transparent;
147
+ color: ${v.white};
148
+ font-weight: 600;
149
+ font-size: 13px;
150
+ text-transform: uppercase;
151
+ letter-spacing: 0.046em;
152
+ text-decoration: none;
153
+ `,mt=a.section`
154
+ position: relative;
155
+ border-radius: ${ee.card};
156
+ overflow: hidden;
157
+ margin-bottom: 24px;
158
+ min-height: 360px;
159
+ display: flex;
160
+ align-items: center;
161
+ justify-content: center;
162
+
163
+ && .creator-hero__follow {
164
+ ${te};
165
+ }
166
+ && .creator-hero__follow:hover:not(:disabled) {
167
+ background: rgba(255, 255, 255, 0.14);
168
+ }
169
+
170
+ ${j.maxWidth("mobile")} {
171
+ min-height: 260px;
172
+ }
173
+ `,ut=a.div`
174
+ position: absolute;
175
+ inset: 0;
176
+ z-index: 0;
177
+ `,ft=a.img`
178
+ width: 100%;
179
+ height: 100%;
180
+ object-fit: cover;
181
+ display: block;
182
+ `,bt=a.div`
183
+ position: absolute;
184
+ inset: 0;
185
+ background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.55) 100%);
186
+ `,wt=a.div`
187
+ position: absolute;
188
+ top: 16px;
189
+ right: 16px;
190
+ z-index: 2;
191
+ display: flex;
192
+ align-items: center;
193
+ gap: 8px;
194
+
195
+ ${j.maxWidth("mobile")} {
196
+ top: 12px;
197
+ right: 12px;
198
+ gap: 6px;
199
+ }
200
+ `,ie=Z`
201
+ display: flex;
202
+ align-items: center;
203
+ justify-content: center;
204
+ color: ${v.white};
205
+ transition: opacity 0.15s linear;
206
+
207
+ &:hover {
208
+ opacity: 0.8;
209
+ }
210
+ & .ico {
211
+ width: 36px;
212
+ height: 36px;
213
+ }
214
+ ${j.maxWidth("mobile")} {
215
+ & .ico {
216
+ width: 30px;
217
+ height: 30px;
218
+ }
219
+ }
220
+ `,jt=a.a`
221
+ ${ie};
222
+ `,vt=a(ue)`
223
+ ${ie};
224
+ width: 32px;
225
+ height: 32px;
226
+ border-radius: 50%;
227
+ border: 2px solid ${v.white};
228
+ transition: background-color 0.15s linear;
229
+
230
+ &:hover {
231
+ opacity: 1;
232
+ background: rgba(255, 255, 255, 0.24);
233
+ }
234
+ & .ico {
235
+ width: 16px;
236
+ height: 16px;
237
+ }
238
+ ${j.maxWidth("mobile")} {
239
+ width: 28px;
240
+ height: 28px;
241
+ & .ico {
242
+ width: 14px;
243
+ height: 14px;
244
+ }
245
+ }
246
+ `,Ct=a.div`
247
+ position: relative;
248
+ z-index: 1;
249
+ display: flex;
250
+ flex-direction: column;
251
+ align-items: center;
252
+ text-align: center;
253
+ gap: 24px;
254
+ padding: 32px 20px;
255
+
256
+ ${j.maxWidth("mobile")} {
257
+ padding: 56px 16px 24px;
258
+ }
259
+ `,O=a.img`
260
+ display: block;
261
+ width: 112px;
262
+ height: 112px;
263
+ border-radius: 50%;
264
+ object-fit: cover;
265
+ border: 4px solid ${v.white};
266
+ box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
267
+ background: #ff4bed;
268
+
269
+ ${j.maxWidth("mobile")} {
270
+ width: 88px;
271
+ height: 88px;
272
+ }
273
+ `,yt=a.h2`
274
+ margin: 0;
275
+ font-size: 18px;
276
+ font-weight: 700;
277
+ color: ${v.white};
278
+ line-height: 1.6;
279
+
280
+ ${j.maxWidth("mobile")} {
281
+ font-size: 16px;
282
+ }
283
+ `,$t=a.p`
284
+ margin: 0;
285
+ font-size: 15px;
286
+ color: ${v.white};
287
+ line-height: 1.6;
288
+ max-width: 520px;
289
+
290
+ ${j.maxWidth("mobile")} {
291
+ font-size: 14px;
292
+ }
293
+ `,kt=a.div`
294
+ display: flex;
295
+ align-items: center;
296
+ gap: 12px;
297
+ flex-wrap: wrap;
298
+ justify-content: center;
299
+ `,Nt=a.a`
300
+ ${te};
301
+ transition: background 0.15s ease;
302
+
303
+ &:hover {
304
+ background: rgba(255, 255, 255, 0.14);
305
+ }
306
+ `,Pt={website:"website",twitter:"twitter",discord:"discord",facebook:"facebook"};function St({address:r}){var h,$;const{data:i}=q(r),{data:s}=Ke(r),n=ke(l=>{var k;return(k=l.session)==null?void 0:k.address}),g=!!n&&n.toLowerCase()===r.toLowerCase(),x=(i==null?void 0:i.name)||Q(r),f=($=(h=i==null?void 0:i.avatar)==null?void 0:h.snapshots)==null?void 0:$.face256,C=(s==null?void 0:s.cover)||Fe,d=s==null?void 0:s.description,w=`${Ne.profileUrl}/${r}`,m=Oe.filter(l=>s==null?void 0:s.links[l]),b=Ee(ze({name:i==null?void 0:i.name,hasClaimedName:i==null?void 0:i.hasClaimedName,ethAddress:(i==null?void 0:i.ethAddress)??r}));return e.jsxs(mt,{"aria-label":`${x} storefront`,children:[e.jsxs(ut,{children:[e.jsx(ft,{src:C,alt:"",loading:"eager"}),e.jsx(bt,{"aria-hidden":!0})]}),(m.length>0||g)&&e.jsxs(wt,{children:[m.map(l=>e.jsx(jt,{"data-testid":"creator-hero-link",href:(s==null?void 0:s.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:t(`creator.link.${l}`),"aria-label":t(`creator.link.${l}`),children:e.jsx(T,{name:Pt[l]})},l)),g&&e.jsx(vt,{to:"/store-settings",title:t("creator.editStore"),"aria-label":t("creator.editStore"),children:e.jsx(T,{name:"pen"})})]}),e.jsxs(Ct,{children:[f?e.jsx(O,{src:f,alt:"",loading:"eager",style:{backgroundColor:b}}):e.jsx(O,{as:"span","aria-hidden":!0,style:{backgroundColor:b}}),e.jsxs("div",{children:[e.jsx(yt,{children:x}),d?e.jsx($t,{children:d}):null]}),e.jsxs(kt,{children:[e.jsx(Nt,{"data-testid":"creator-hero-view",href:w,target:"_blank",rel:"noopener noreferrer",children:t("creator.viewProfile")}),e.jsx(gt,{address:r,className:"creator-hero__follow"})]})]})]})}const V=48;function Gt(){const{address:r}=fe(),i=Y(),[s]=be(),n=s.has("collections"),{data:g}=q(r),x=(g==null?void 0:g.name)||(r?Q(r):t("creator.fallbackName"));Pe({title:x,description:t("seo.creator.description",{name:x})});const[f,C]=y.useState("wearable"),[d,w]=y.useState(null),[m,b]=y.useState([]),[h,$]=y.useState(""),[l,k]=y.useState(""),[A,oe]=y.useState("newest"),M=h&&!Number.isNaN(Number(h))?Number(h):void 0,F=l&&!Number.isNaN(Number(l))?Number(l):void 0,ae=d?Xe[d]:void 0,re=(H.find(o=>o.key===A)??H[0]).server,E={creator:r,category:f,rarities:m.length?m:void 0,wearableCategories:ae,minPriceCredits:M,maxPriceCredits:F,sortBy:re},{items:N,total:se,isLoading:P,error:z,hasNextPage:ne,isFetchingNextPage:B,fetchNextPage:ce}=U(["creator-listings",E],o=>Ae({...E,first:V,skip:o}),{enabled:!!r&&!n}),p=U(["creator-collections",r],o=>Me(r,{first:V,skip:o}).then(c=>({items:c.collections,total:c.total})),{enabled:!!r&&n});function le(o){C(o),w(null),n&&I()}function I(){const o=new URLSearchParams(s);o.delete("collections");const c=o.toString();i({search:c?`?${c}`:""},{replace:!0})}function de(){if(n){I();return}const o=new URLSearchParams(s);o.delete("collections");const c=o.toString();i({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function he(o){b(c=>c.includes(o)?c.filter(me=>me!==o):[...c,o])}function xe(){C("wearable"),w(null),b([]),$(""),k("")}const L=!!(M||F),pe=L?`${h||"0"}–${l||"∞"}`:t("filter.price"),ge=f!=="wearable"||!!d||m.length>0||L;return e.jsxs(Be,{children:[e.jsxs(Ie,{"aria-label":t("creator.breadcrumbAria"),children:[e.jsx(Re,{onClick:()=>i("/assets"),children:t("creator.breadcrumb")}),e.jsx("span",{children:"/"}),e.jsx(_e,{children:x})]}),r?e.jsx(St,{address:r}):null,!n&&!P&&N.length>0?e.jsx(We,{items:N,source:"creator"}):null,e.jsxs(Te,{children:[e.jsx(He,{children:e.jsx(Ve,{category:f,subCategory:d,onCategory:le,onSub:w,title:t("creator.category"),flat:!0,collections:n,onCollections:de})}),e.jsx(Ge,{children:n?e.jsxs(e.Fragment,{children:[e.jsx(Ue,{children:e.jsx(De,{children:p.isLoading?"…":t("creator.collectionsCount",{count:p.total})})}),p.error?e.jsx(D,{message:t("creator.error")}):null,e.jsx(K,{"data-variant":"collections",children:p.isLoading?e.jsx(S,{count:9}):e.jsxs(e.Fragment,{children:[p.items.map(o=>e.jsx(pt,{collection:o,itemCount:o.itemCount},o.contractAddress)),p.isFetchingNextPage?e.jsx(S,{count:6}):null]})}),e.jsx(G,{hasNextPage:p.hasNextPage,isFetching:p.isFetchingNextPage,onLoadMore:()=>void p.fetchNextPage()}),!p.isLoading&&!p.error&&p.items.length===0?e.jsx("p",{className:"muted",children:t("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(Ye,{rarities:m,onToggleRarity:he,sort:A,onSort:oe,total:se,loading:P,anyActive:ge,onClear:xe,renderTrailing:o=>e.jsx(Je,{panelKey:"price",label:pe,active:L,panel:o,children:e.jsxs(Ze,{"data-variant":"price",children:[e.jsxs(qe,{children:[e.jsx("input",{type:"number",min:"0","aria-label":t("creator.priceMin"),placeholder:t("creator.priceMinPlaceholder"),value:h,onChange:c=>$(c.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":t("creator.priceMax"),placeholder:t("creator.priceMaxPlaceholder"),value:l,onChange:c=>k(c.target.value)})]}),e.jsx(Qe,{children:t("creator.priceHint",{currency:Se.name})})]})})}),z?e.jsx(D,{message:t("creator.error")}):null,e.jsx(K,{children:P?e.jsx(S,{count:15}):e.jsxs(e.Fragment,{children:[N.map(o=>e.jsx(Le,{item:o},o.id)),B?e.jsx(S,{count:6}):null]})}),e.jsx(G,{hasNextPage:ne,isFetching:B,onLoadMore:()=>void ce()}),!P&&!z&&N.length===0?e.jsx("p",{className:"muted",children:t("creator.empty")}):null]})})]})]})}export{Gt as Creator,Gt as default};
@@ -1 +1 @@
1
- import{j as r}from"./react-vyZjIDcS.js";import{I as i}from"./index-CKvAeyW_.js";function a({message:e,className:o,testId:t}){return e?r.jsxs("p",{className:o?`error-notice ${o}`:"error-notice","data-testid":t,role:"alert",children:[r.jsx(i,{name:"alert",className:"error-notice__ico",size:18}),r.jsx("span",{className:"error-notice__msg",children:e})]}):null}export{a as E};
1
+ import{j as r}from"./react-vyZjIDcS.js";import{I as i}from"./index-kSY8zCTD.js";function a({message:e,className:o,testId:t}){return e?r.jsxs("p",{className:o?`error-notice ${o}`:"error-notice","data-testid":t,role:"alert",children:[r.jsx(i,{name:"alert",className:"error-notice__ico",size:18}),r.jsx("span",{className:"error-notice__msg",children:e})]}):null}export{a as E};
@@ -1 +1 @@
1
- import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-1MRMKUrL.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-2OVx4iJi.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
1
+ 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-w-RSM5AL.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-CHT5h1YD.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};