@dcl/shop 0.1.0-30897342413.commit-036e931 → 0.1.0-30903100943.commit-cfb5121
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.
- package/_assets/{Activity-DUBRQnWV.js → Activity-COPN1oEb.js} +1 -1
- package/_assets/{AnimatedBackground-CmAZhAYA.js → AnimatedBackground-D4Ktoyt4.js} +1 -1
- package/_assets/{Assets-NRrjcYA5.js → Assets-CzRI4yu1.js} +7 -7
- package/_assets/{Assets.styles-3wC-xeWp.js → Assets.styles-DEZ9a_GD.js} +1 -1
- package/_assets/{Authorizations-aNMRQo6Q.js → Authorizations-B0Pwosn7.js} +1 -1
- package/_assets/{Cart-zIOhAh9c.js → Cart-8yxyOMFq.js} +2 -2
- package/_assets/{CircularProgress-LjKPNQUw.js → CircularProgress-_0gSPNcC.js} +1 -1
- package/_assets/{Collection-C46Ze7ov.js → Collection-BNupOSqS.js} +1 -1
- package/_assets/{CollectionCarousel-B71TAj46.js → CollectionCarousel-CDNotQwG.js} +1 -1
- package/_assets/{Creator-D7kFPPn9.js → Creator-kdxiJJNF.js} +1 -1
- package/_assets/{ErrorNotice-DNbl0Lx6.js → ErrorNotice-6S2ayRHK.js} +1 -1
- package/_assets/{ExchangeController-B1JcnenY.js → ExchangeController-11B8Didx.js} +1 -1
- package/_assets/{GetCredits-BLKTlUHn.js → GetCredits-eFL8Gd7X.js} +60 -24
- package/_assets/{HelpersUtil-B004FVhm.js → HelpersUtil-Bto4kwHu.js} +1 -1
- package/_assets/{ImportListings-CyzEyfcm.js → ImportListings-D3H-40Vh.js} +1 -1
- package/_assets/{ItemDetail-apY0RKkT.js → ItemDetail-qMRlyp0m.js} +3 -3
- package/_assets/{LoadMore-CvF1ryR6.js → LoadMore-COkJGWsB.js} +1 -1
- package/_assets/{MenuList-BmbNiqyv.js → MenuList-BVkS7rPq.js} +1 -1
- package/_assets/{MyAssets-ClsL7CoM.js → MyAssets-Bk8E7-3O.js} +1 -1
- package/_assets/{MyFavorites-VWLNpe0r.js → MyFavorites-DxsLDfOF.js} +1 -1
- package/_assets/{NotFound-DQHwDF1N.js → NotFound-BGXTL5g4.js} +1 -1
- package/_assets/{NotificationsBell-C5ky0lqZ.js → NotificationsBell-BdXSXxoi.js} +1 -1
- package/_assets/{StoreSettings-CgbxKhUS.js → StoreSettings-Ct8rsmjt.js} +1 -1
- package/_assets/{Success-C_SNXVeS.js → Success-CVU4jEw2.js} +1 -1
- package/_assets/{SwapController-DjUyjCYK.js → SwapController-DKM9_drr.js} +1 -1
- package/_assets/{Tooltip-VDc8mbHU.js → Tooltip-3y4DnUZl.js} +1 -1
- package/_assets/{TradeService-T7Ac3zPB.js → TradeService-M0ORTST0.js} +1 -1
- package/_assets/{W3MFrameProviderSingleton-BGLSOpiV.js → W3MFrameProviderSingleton-BJW4ebEt.js} +3 -3
- package/_assets/{WebCryptoP256-D7qVD_y0.js → WebCryptoP256-Q8DCxoH7.js} +1 -1
- package/_assets/{authorizations-BTC_bFln.js → authorizations-JSOY6ArB.js} +1 -1
- package/_assets/{basic-8iVIK2Fo.js → basic-CL-AAo1G.js} +1 -1
- package/_assets/{biconomy-BreMnkVT.js → biconomy-8Mt6lCpX.js} +1 -1
- package/_assets/{browseLayout.styles-De0FGl5x.js → browseLayout.styles-CwDiK1mG.js} +1 -1
- package/_assets/{builder-C4njBf3q.js → builder-Biq1yQgT.js} +1 -1
- package/_assets/{buy-myGa3uAa.js → buy-DTB3xpDX.js} +1 -1
- package/_assets/{buy-gasless-aqj0tOF3.js → buy-gasless-C9C0u3NU.js} +1 -1
- package/_assets/{categories-A3Tq54j-.js → categories-BqS-qyq6.js} +1 -1
- package/_assets/{ccip-BeYige_y.js → ccip-C-gvRqi4.js} +1 -1
- package/_assets/{ccip-NXlbV8_q.js → ccip-Dg2AIV_h.js} +1 -1
- package/_assets/{clsx-BETN9X51.js → clsx-3D8Gvjd6.js} +1 -1
- package/_assets/{controller-DL4fylV8.js → controller-zP9LZHG8.js} +2 -2
- package/_assets/{core-D8ptIKw3.js → core-ByomFIcR.js} +4 -4
- package/_assets/{createSvgIcon-sbUQV66i.js → createSvgIcon--KCu3mQi.js} +1 -1
- package/_assets/{custom-BgXN6B3q.js → custom-DVYkMp5n.js} +1 -1
- package/_assets/{data-capture-C-JR2KzF.js → data-capture-EB6mxn_K.js} +1 -1
- package/_assets/{email-DpFveLJ0.js → email-Ye0p9P8Q.js} +1 -1
- package/_assets/{embedded-wallet-C2gUO5wT.js → embedded-wallet-CGoVzP7f.js} +1 -1
- package/_assets/{emotion-styled.browser.esm-DH8Xabrh.js → emotion-styled.browser.esm-Dn08UyTd.js} +1 -1
- package/_assets/{engine-5oCjjcrK.js → engine-Dp6sxgpw.js} +1 -1
- package/_assets/{errors-DqL59l4z.js → errors-Bj3SjlpX.js} +1 -1
- package/_assets/{estimate-l1-fee-BujsJkmp.js → estimate-l1-fee-Cc-Hn0JH.js} +1 -1
- package/_assets/{execute-BvpVcytD.js → execute-DEi9TgB2.js} +2 -2
- package/_assets/{features-hynqqeoJ.js → features-gpHPkHzw.js} +1 -1
- package/_assets/{fetchTokenMetadata-BnJnLsZ6.js → fetchTokenMetadata-Ra0c0GwR.js} +2 -2
- package/_assets/{get-ecosystem-wallet-info-DQdOd1yi.js → get-ecosystem-wallet-info-9p7i45R2.js} +1 -1
- package/_assets/{getBalance-x0HlsVC8.js → getBalance-BPqaF9kw.js} +1 -1
- package/_assets/{getNFT-U6fW1c3o.js → getNFT-Bfk2HgRC.js} +1 -1
- package/_assets/{getNFT-BmIGxF2X.js → getNFT-DLY4PgPX.js} +1 -1
- package/_assets/{getThemeProps-BzsYMuYq.js → getThemeProps-CnXSHx3q.js} +1 -1
- package/_assets/{grid.styles-B36wgJRU.js → grid.styles-Dnnyw76z.js} +1 -1
- package/_assets/{hashTypedData-D5cKiuOe.js → hashTypedData-Dg1gWYZ1.js} +1 -1
- package/_assets/{hashTypedData-BtyGAAso.js → hashTypedData-h1iD1tUS.js} +1 -1
- package/_assets/{import-Da0nCdcK.js → import-C0DSObrV.js} +1 -1
- package/_assets/{in-app-tkTqoTeW.js → in-app-Dc0ubTKN.js} +1 -1
- package/_assets/{in-app-wallet-calls-Dyb8JyC6.js → in-app-wallet-calls-DAEOP0UK.js} +1 -1
- package/_assets/{index-BGOR7uqp.js → index-1pLrpdjR.js} +1 -1
- package/_assets/{index-C3EyLY1t.js → index-2pVHJLxW.js} +1 -1
- package/_assets/{index-BrAm6VBC.js → index-Ao5E92z8.js} +1 -1
- package/_assets/{index-Sc6q1Ecn.js → index-B3HbKd_C.js} +1 -1
- package/_assets/{index-BnaX4TbU.js → index-B6Fs-ly-.js} +1 -1
- package/_assets/{index-DI_IjAcF.js → index-B8qQ9Xxb.js} +186 -136
- package/_assets/{index-DFUj2qC_.js → index-BM1FRjnS.js} +1 -1
- package/_assets/{index-D05mgWf9.js → index-BNtMsGNE.js} +1 -1
- package/_assets/{index-B6RSvfuU.js → index-BOnfcMc4.js} +1 -1
- package/_assets/{index-rT-FK12h.js → index-BQCPF_JE.js} +1 -1
- package/_assets/{index-Dc05m3c2.js → index-BUZUrnlT.js} +1 -1
- package/_assets/{index-DfFeZ6Vp.js → index-BamkywF1.js} +1 -1
- package/_assets/{index-D_k1yIWZ.js → index-BbnJ0vOM.js} +1 -1
- package/_assets/{index-BCMTVfZb.js → index-BdOwsIe5.js} +1 -1
- package/_assets/{index-CCOhxr4Y.js → index-BhJHWAVJ.js} +3 -3
- package/_assets/{index-D8MKf1c9.js → index-Bl758CqY.js} +1 -1
- package/_assets/{index-HLQrRyOg.js → index-BxIpnJ-e.js} +1 -1
- package/_assets/{index-DeajtqZQ.js → index-C-b_AO6R.js} +1 -1
- package/_assets/{index-B_EmM_OX.js → index-CG7tIraF.js} +1 -1
- package/_assets/{index-Beqa_Gje.js → index-CGW79JV0.js} +1 -1
- package/_assets/{index-CPOONJNk.js → index-CKkr1ttw.js} +1 -1
- package/_assets/{index-DxM-to32.js → index-CMIJ-ZVj.js} +3 -3
- package/_assets/{index-C184oxsV.js → index-COHrUo7z.js} +1 -1
- package/_assets/{index-BNnslvoC.js → index-CXgEBMJX.js} +1 -1
- package/_assets/{index-DheZlekn.js → index-CbtJGEzL.js} +3 -3
- package/_assets/{index-BarS2mgL.js → index-CduQbEdH.js} +1 -1
- package/_assets/{index-UHqRfL2i.js → index-CfekU9H3.js} +1 -1
- package/_assets/{index-BX7nt43X.js → index-Ck2_-x0t.js} +1 -1
- package/_assets/{index-VL-eJTDX.js → index-CvBvIAAr.js} +1 -1
- package/_assets/{index-BJhXMkl3.js → index-CxY85bhM.js} +2 -2
- package/_assets/{index-hdy1vdaF.js → index-D0MHCwdz.js} +1 -1
- package/_assets/{index-Dent5zap.js → index-D3oCO2M2.js} +1 -1
- package/_assets/{index-ByCGiKUv.js → index-D4coZIYk.js} +1 -1
- package/_assets/{index-Cd7uOoEN.js → index-D8KhhQnq.js} +1 -1
- package/_assets/{index-VOzIxfGw.js → index-D8q7Jz9s.js} +1 -1
- package/_assets/{index-BSfKLWot.js → index-DDvI0nc8.js} +1 -1
- package/_assets/{index-DCH4Sk36.js → index-DH0c2sDT.js} +1 -1
- package/_assets/{index-DxM-zc2w.js → index-DIxy9dSs.js} +1 -1
- package/_assets/{index-BJaBIZon.js → index-DKa2ijHa.js} +2 -2
- package/_assets/{index-CZuEgdES.js → index-DMj5fO9M.js} +1 -1
- package/_assets/{index-uIjOgtMi.js → index-DaOQeGvk.js} +1 -1
- package/_assets/{index-Dya8ahcx.js → index-DftWUdZW.js} +1 -1
- package/_assets/{index-8AINMf2V.js → index-DwkSO4Fj.js} +1 -1
- package/_assets/{index-CnNlT6GN.js → index-Dy_LMTRI.js} +1 -1
- package/_assets/{index-Nj11N1Vp.js → index-DztT3S7O.js} +1 -1
- package/_assets/{index-B-ELrI2-.js → index-J95gyscE.js} +1 -1
- package/_assets/{index-Bg9_Rb37.js → index-LeLZ_uWV.js} +1 -1
- package/_assets/{index-mSffj-0T.js → index-gE5SSQSY.js} +2 -2
- package/_assets/{index-FsUhf4jJ.js → index-hqGVy2_2.js} +1 -1
- package/_assets/{index-C7Dd_OFn.js → index-m2y-Tbkf.js} +1 -1
- package/_assets/{index--n_fMjyX.js → index-pFuDxg7C.js} +1 -1
- package/_assets/{index.es-Ca2F0FMx.js → index.es-CJ664SSa.js} +4 -4
- package/_assets/{index.es-DIF91egA.js → index.es-Da4QGzPK.js} +1 -1
- package/_assets/{index.es-creG5doh.js → index.es-euS_bME-.js} +1 -1
- package/_assets/{localBatchGatewayRequest-DsmOioor.js → localBatchGatewayRequest-B0RWHv93.js} +1 -1
- package/_assets/{mana-convert-CTsfw0Op.js → mana-convert-Bbf4K53E.js} +1 -1
- package/_assets/{mana-rate-BxYQ9xUU.js → mana-rate-LTr19y4S.js} +1 -1
- package/_assets/{networks-cAv5X6o3.js → networks--5_T3A9T.js} +1 -1
- package/_assets/{onramp-g7sfARS-.js → onramp-9Nrqe-Pb.js} +1 -1
- package/_assets/{openzeppelin-BCr3n-Wo.js → openzeppelin-D0j0nh8u.js} +1 -1
- package/_assets/{parseNft-BhL_ChhV.js → parseNft-BSSsDQ8Z.js} +2 -2
- package/_assets/{parseSignature-DvfiZIZV.js → parseSignature-BQoanGXT.js} +1 -1
- package/_assets/{parseSignature--tz_iwev.js → parseSignature-DItIXRz8.js} +3 -3
- package/_assets/{passkeys-Bvs56mq5.js → passkeys-DVMTGRYE.js} +1 -1
- package/_assets/{pay-with-exchange-XkI8_OCE.js → pay-with-exchange-iX-Lps6l.js} +1 -1
- package/_assets/{qr-overlay-Bk2XZPWy.js → qr-overlay-CVyo7Lhb.js} +1 -1
- package/_assets/{receive-BMeT0Lz-.js → receive-BsGerVVU.js} +1 -1
- package/_assets/{resolveImplementation-Bx83F7NY.js → resolveImplementation-BdMovGG8.js} +1 -1
- package/_assets/{rpc-DbNw9jL1.js → rpc-C1Rk473V.js} +1 -1
- package/_assets/{secp256k1-gVzAYZdt.js → secp256k1-9MwhCLRe.js} +1 -1
- package/_assets/{secp256k1-k_sy808b.js → secp256k1-CXpi7m_i.js} +1 -1
- package/_assets/{secp256k1-BEusWpwQ.js → secp256k1-CwDWkDbO.js} +1 -1
- package/_assets/{send-CXMx0Ee3.js → send-C1TRj4n-.js} +1 -1
- package/_assets/{send-batch-transaction-CDuCIKM-.js → send-batch-transaction-CDPqPn4J.js} +1 -1
- package/_assets/{send-eip712-transaction-BeDgEcMv.js → send-eip712-transaction-Mh2T82Oq.js} +2 -2
- package/_assets/{send-gasless-transaction-B3NobiIc.js → send-gasless-transaction-DtFmbkdG.js} +2 -2
- package/_assets/{send-transaction-SAvzY1Zv.js → send-transaction-DHjJaG56.js} +2 -2
- package/_assets/{sendMetaTransaction-BLHMOdHq.js → sendMetaTransaction-B3nckO8c.js} +1 -1
- package/_assets/{sendRawTransaction-DEpVlnFQ.js → sendRawTransaction-D6RRi1sI.js} +3 -3
- package/_assets/{serializeTransaction-BeikLUOw.js → serializeTransaction-Cd3BF0ey.js} +1 -1
- package/_assets/{session-proposal-CXFPx6Nc.js → session-proposal-DDdOs_nB.js} +1 -1
- package/_assets/{session-request-yTpVxJp5.js → session-request-DXQbFUGh.js} +2 -2
- package/_assets/{signing-ClnsTXrn.js → signing-DPyzvfGK.js} +3 -3
- package/_assets/{socials-vhiZxWBx.js → socials-Bxqg_eUk.js} +1 -1
- package/_assets/{swaps-BYey02hd.js → swaps-C-Cb_93V.js} +1 -1
- package/_assets/{thirdweb-M2_jjUS_.js → thirdweb-B_cmyHun.js} +3 -3
- package/_assets/{to-serializable-transaction-BTD2tsYD.js → to-serializable-transaction-Ccol8OTd.js} +2 -2
- package/_assets/{trade-encoding-BVlmzFE-.js → trade-encoding-CjafzO-R.js} +1 -1
- package/_assets/{transactionReceipt-OZUBm-CR.js → transactionReceipt-DjSnbHOR.js} +1 -1
- package/_assets/{transactions-CHSrtQ-4.js → transactions-Cwjx3u4Y.js} +1 -1
- package/_assets/{useCreditPacks-DkU8BJEb.js → useCreditPacks-CcsRRofr.js} +1 -1
- package/_assets/{useInfiniteGrid-NfDPHWXi.js → useInfiniteGrid-jYXiF9Ls.js} +1 -1
- package/_assets/useManaRate-BezWDX4Q.js +1 -0
- package/_assets/{useSecondarySales-Caon2E63.js → useSecondarySales-DVrg7pqD.js} +1 -1
- package/_assets/{useStore-TorFHABK.js → useStore-Du3YYL1J.js} +1 -1
- package/_assets/{useTheme-D346drKA.js → useTheme-DPli5iET.js} +1 -1
- package/_assets/{verifyHash-C_z3J9Yf.js → verifyHash-BJtX_GOJ.js} +1 -1
- package/_assets/{w3m-modal-BCtgJ1Ma.js → w3m-modal-BGOVySb5.js} +1 -1
- package/_assets/{w3m-modal-DyyYMui-.js → w3m-modal-CkXrZjMo.js} +1 -1
- package/_assets/{wait-for-tx-receipt-SA_Mo0zv.js → wait-for-tx-receipt-BXzCDbp8.js} +1 -1
- package/_assets/{wallets-CiVaPBHB.js → wallets-lC7V_6IF.js} +5 -5
- package/_assets/{web-connector-Cc9dNw1Y.js → web-connector-Cy9zFti1.js} +3 -3
- package/_assets/{writeContract-BSMHcTCt.js → writeContract-BZaMqPJ8.js} +1 -1
- package/_assets/{zoraTestnet-CftGmIvi.js → zoraTestnet-CDtuoGbV.js} +1 -1
- package/dcl-mark.png +0 -0
- package/index.html +15 -15
- package/package.json +2 -2
- package/site.webmanifest +11 -22
- package/_assets/useManaRate-BV_Xzv0_.js +0 -1
- package/apple-touch-icon.png +0 -0
- package/favicon-maskable.svg +0 -17
- package/favicon.svg +0 -17
- package/icon-192.png +0 -0
- package/icon-512.png +0 -0
- package/icon-maskable-512.png +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
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-
|
|
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-B8qQ9Xxb.js";import{m as bt}from"./mana-convert-Bbf4K53E.js";import{u as jt}from"./useManaRate-BezWDX4Q.js";import{L as vt}from"./LoadMore-COkJGWsB.js";import{u as y}from"./useInfiniteGrid-jYXiF9Ls.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-LTr19y4S.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-30903100943.commit-cfb5121/_assets/credits-product-vs4Q6u6l.svg",F=ut`
|
|
2
2
|
0% { background-position: 200% 0; }
|
|
3
3
|
100% { background-position: -200% 0; }
|
|
4
4
|
`,St=l.section`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,j as v}from"./react-vyZjIDcS.js";import{s as u}from"./index-
|
|
1
|
+
import{r as l,j as v}from"./react-vyZjIDcS.js";import{s as u}from"./index-B8qQ9Xxb.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-30903100943.commit-cfb5121/_assets/custom-welcome-background-BxlFQma9.webp",b="https://cdn.decentraland.org/@dcl/shop/0.1.0-30903100943.commit-cfb5121/_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 We,r as
|
|
1
|
+
import{b as We,r as m,j as e,u as Je}from"./react-vyZjIDcS.js";import{c as F,av as Qe,aw as Xe,d as Ye,s,t,n as Be,al as et,D as tt,K as ge,e as n,y as nt,I as S,z as M,aT as ne,aj as st,ar as Y,az as ot,ay as it,m as Fe,o as rt,S as Te,A as q,aU as at,aV as lt}from"./index-B8qQ9Xxb.js";import{u as ct}from"./useSecondarySales-DVrg7pqD.js";import{a as dt,m as Le}from"./mana-convert-Bbf4K53E.js";import{u as Ue}from"./useManaRate-BezWDX4Q.js";import{g as pt,h as ht,i as xt,j as ft,k as mt,C as ut,l as gt,o as bt,m as yt,n as wt,M as jt,p as vt,E as $t,q as Ct,r as kt,s as St,t as Et,u as Rt,v as Tt}from"./Assets.styles-DEZ9a_GD.js";import{c as _e,R as _t,F as zt,S as It}from"./categories-BqS-qyq6.js";import{L as At}from"./LoadMore-COkJGWsB.js";import{u as Nt}from"./useInfiniteGrid-jYXiF9Ls.js";import{E as Mt}from"./ErrorNotice-6S2ayRHK.js";import{d as Pt}from"./dcl-schemas-BICTSpB5.js";import{s as Wt,G as Bt,w as Ft,S as Lt}from"./buy-gasless-C9C0u3NU.js";import{s as Ut}from"./buy-DTB3xpDX.js";import{i as Ht}from"./trade-encoding-CjafzO-R.js";import{r as Ot}from"./mana-rate-LTr19y4S.js";import{f as Dt}from"./errors-Bj3SjlpX.js";import{J as Gt,C as qt,B as be}from"./ethers-CXBJm_wN.js";import{n as Vt}from"./Tooltip-3y4DnUZl.js";import{G as Kt}from"./grid.styles-Dnnyw76z.js";import"./sentry-B35L1FdR.js";import"./intl-CBcMB1D2.js";import"./authorizations-JSOY6ArB.js";import"./sendMetaTransaction-B3nckO8c.js";function V(o){const i=o.source??"item",a=o.tradeId||`${o.contractAddress}-${o.tokenId??o.itemId??""}`;return`${i}:${a}`}const L="100000000000000000000",He=2,ee=15,Zt=/^[a-zA-Z0-9]+$/;function ze(o){const i=o.trim();return i.length===0?{ok:!1,reason:"empty"}:Zt.test(i)?i.length<He?{ok:!1,reason:"too-short"}:i.length>ee?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Jt(o){return o.replace(/[^a-zA-Z0-9]/g,"").slice(0,ee)}const Qt=["function available(string _subdomain) view returns (bool)"],Ie={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Xt(){return F.chainId===Number(Pt.ChainId.MATIC_MAINNET)?Ie.mainnet:Ie.sepolia}async function Yt(o,i={}){var p;const{rpc:a,address:h}=Xt(),l=new Gt(a),d=new qt(h,Qt,l);console.info(`[names] availability check → DCLRegistrar(${h}).available("${o}") on ${a}`);const x=await d.available(o);if((p=i.signal)!=null&&p.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${o}" available=${x}`),x?"available":"taken"}const en="https://app.across.to/api";class ye extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function tn(o){return dt(L,o)}async function nn(o,i,a={}){var p;const h=a.chainId??F.chainId,l=a.provider??"across",d=`${F.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(i)}&chainId=${h}&provider=${l}`,x=await Ye(d,{method:"GET",identity:o,metadata:{}});if(!x.ok){let r;try{r=(p=await x.json())==null?void 0:p.code}catch{}throw r==="ROUTE_COST_TOO_HIGH"?new ye:new Error(`fetchNameCreditRoute ${x.status}`)}return x.json()}function sn(o,i){const a=be.from(o.availableAmount),l=be.from(L).sub(a);return{credits:[{value:o.amount,expiresAt:Number(o.expiresAt),salt:Ht(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:l.isNegative()?"0":l.toString(),maxCreditedValue:L}}async function on(o,i={}){const a=en,h=i.intervalMs??1e4,l=i.maxAttempts??60;let d={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let x=0;x<l;x++){try{const p=await fetch(`${a}/deposit/status?originChainId=137&depositTxHash=${o}`);if(p.ok){const r=await p.json(),u=(r.status??"pending").toLowerCase(),g=r.fillTx??r.fillTxnRef??null,w=r.actionsSucceeded!==!1;if(u==="filled")return{status:"filled",destinationTxHash:g,actionsSucceeded:w};if(u==="refunded"||u==="expired")return{status:u,destinationTxHash:null,actionsSucceeded:!1};d={status:"pending",destinationTxHash:g,actionsSucceeded:w}}}catch{}x<l-1&&await new Promise(p=>setTimeout(p,h))}return d}async function rn(o){const{name:i,identity:a,signer:h}=o,l=o.chainId??F.chainId,d=o.provider??"across",x=(o.beneficiary??await h.getAddress()).toLowerCase();let p=null,r=!1;console.info("[names] register start",{name:i,buyer:x,chainId:l,provider:d});try{const u=await Ot(l),g=tn(u);console.info("[names] step 1/6 sized reservation",{usdCents:g,manaRate:u});const w=await nn(a,i,{chainId:l,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 Qe(a,g);if(p=j.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:j.credit.id,maxCreditedValue:j.maxCreditedValue}),be.from(j.maxCreditedValue).lt(L))throw new Error("Credit under-sized for the name price");const k=sn(j.credit,w);let f;try{f=await Wt({chainId:l,buyer:x,signer:h,args:k})}catch(b){if(!(b instanceof Bt))throw b;f=await Ut(l,k,h)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:f}),await Ft(f),r=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:f}),d==="across"){const b=await on(f,o.acrossPoll);if(console.info("[names] step 6/6 across status",b),b.status==="pending")return{status:"pending",originTxHash:f};if(b.status!=="filled"||!b.actionsSucceeded)throw new Error("The name could not be registered on Ethereum; your funds were recovered.");return{status:"registered",originTxHash:f,destinationTxHash:b.destinationTxHash}}return{status:"pending",originTxHash:f}}catch(u){if(console.error("[names] register failed — raw error:",u,{name:i,buyer:x,originConfirmed:r}),u instanceof Lt)return{status:"pending",originTxHash:u.txHash};if(p&&!r&&await Xe(a,[p]).catch(()=>{}),u instanceof ye)throw u;const g=new Error(Dt(u,"Couldn't register the name. Please try again.",{sale:!0}));throw g.cause=u,g}}const an=s.div`
|
|
2
2
|
position: fixed;
|
|
3
3
|
inset: 0;
|
|
4
4
|
z-index: 10000;
|
|
@@ -166,7 +166,7 @@ import{b as We,r as f,j as e,u as Je}from"./react-vyZjIDcS.js";import{c as F,av
|
|
|
166
166
|
font-family: ${t.font.sans};
|
|
167
167
|
font-size: 18px;
|
|
168
168
|
color: ${t.colors.muted2};
|
|
169
|
-
`,
|
|
169
|
+
`,fn=s.input`
|
|
170
170
|
flex: 0 1 auto;
|
|
171
171
|
min-width: 0;
|
|
172
172
|
border: 0;
|
|
@@ -181,7 +181,7 @@ import{b as We,r as f,j as e,u as Je}from"./react-vyZjIDcS.js";import{c as F,av
|
|
|
181
181
|
color: ${t.colors.muted2};
|
|
182
182
|
font-weight: 400;
|
|
183
183
|
}
|
|
184
|
-
`,
|
|
184
|
+
`,mn=s.span`
|
|
185
185
|
flex: none;
|
|
186
186
|
font-family: ${t.font.sans};
|
|
187
187
|
font-size: 16px;
|
|
@@ -347,7 +347,7 @@ import{b as We,r as f,j as e,u as Je}from"./react-vyZjIDcS.js";import{c as F,av
|
|
|
347
347
|
outline: 2px solid ${t.colors.accent};
|
|
348
348
|
outline-offset: 2px;
|
|
349
349
|
}
|
|
350
|
-
`,
|
|
350
|
+
`,fe=s.div`
|
|
351
351
|
display: flex;
|
|
352
352
|
align-items: flex-start;
|
|
353
353
|
gap: 12px;
|
|
@@ -379,7 +379,7 @@ import{b as We,r as f,j as e,u as Je}from"./react-vyZjIDcS.js";import{c as F,av
|
|
|
379
379
|
color: ${t.colors.accent};
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
-
`;function Sn({name:o,priceCredits:i,onClose:a}){const{session:h}=Be(),{data:l,isError:d}=et(h),x=tt(),p=We(),[r,u]=
|
|
382
|
+
`;function Sn({name:o,priceCredits:i,onClose:a}){const{session:h}=Be(),{data:l,isError:d}=et(h),x=tt(),p=We(),[r,u]=m.useState("confirm"),[g,w]=m.useState(""),[j,k]=m.useState(null),f=m.useRef(!1),b=g.trim().toLowerCase()===o.toLowerCase(),v=r==="completing",E=i!=null?ge(i):"—",C=i==null,_=l==null?void 0:l.credits,R=i!=null&&_!=null?i-_:0,$=R>0,z=C?n("names.priceUnavailable"):$?n("names.insufficientCredits",{credits:ge(R)}):null;m.useEffect(()=>{const y=H=>{H.key==="Escape"&&!v&&a()};document.addEventListener("keydown",y);const U=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",y),document.body.style.overflow=U}},[v,a]);async function I(){if(!(!h||!b||C||$||f.current)){f.current=!0,u("completing"),k(null);try{const y=await rn({name:o,identity:h.identity,signer:h.signer});Y("Shop Completed Purchase",{purchase_type:"name",is_primary:!0,payment_type:"credits",value_credits:i??null,settlement:y.status}),x.invalidateQueries({queryKey:["usd-balance"]}),x.invalidateQueries({queryKey:["my-assets"]}),u(y.status==="registered"?"success":"pending")}catch(y){Y(it(y)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:ot(y),purchase_type:"name"}),k(y instanceof ye?n("names.errorRouteCost"):(y==null?void 0:y.message)||n("names.errorGeneric")),u("error")}finally{f.current=!1}}}const A=r!=="success"&&r!=="pending",te=nt(h==null?void 0:h.providerType);return e.jsx(an,{onClick:v?void 0:a,role:"presentation",children:e.jsxs(ln,{role:"dialog","aria-modal":"true","aria-label":n("names.buyTitle"),onClick:y=>y.stopPropagation(),children:[A&&e.jsxs(e.Fragment,{children:[e.jsxs(se,{children:[e.jsx(oe,{children:r==="error"?n("names.errorTitle"):n("names.buyTitle")}),e.jsx(ie,{onClick:a,disabled:v,"aria-label":n("buyModal.close"),children:e.jsx(S,{name:"close"})})]}),e.jsxs(re,{children:[n("names.myCreditsBalance")," ",e.jsx(M,{})," ",ne(l,d)]}),e.jsx(ae,{})]}),(r==="confirm"||r==="error")&&e.jsxs(e.Fragment,{children:[e.jsxs(le,{children:[e.jsx(ce,{"aria-hidden":!0,children:"@"}),e.jsxs(de,{children:[e.jsxs(pe,{children:[o,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(he,{children:n("names.subtitle")})]}),e.jsxs(xe,{children:[e.jsx(M,{}),E]})]}),r==="error"?e.jsxs(e.Fragment,{children:[e.jsxs(fe,{children:[e.jsx(S,{name:"info","aria-hidden":!0}),e.jsx("span",{children:j})]}),e.jsx(Ae,{onClick:()=>u("confirm"),children:n("names.tryAgain")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(cn,{children:[e.jsx(dn,{children:n("names.confirmTitle")}),e.jsx(pn,{dangerouslySetInnerHTML:{__html:n("names.confirmBody",{name:`<b>@${En(o)}</b>`})}}),e.jsxs(hn,{children:[e.jsx(xn,{"aria-hidden":!0,children:"@"}),e.jsx(fn,{value:g,onChange:y=>w(y.target.value.replace(/[^a-zA-Z0-9]/g,"")),placeholder:"yourname","aria-label":n("names.reenterAria"),autoComplete:"off",spellCheck:!1,style:{width:`${Math.max(g.length,8)}ch`}}),e.jsx(mn,{children:".dcl.eth"})]})]}),z?e.jsxs(fe,{"data-tone":"info","data-testid":"name-blocked-reason",children:[e.jsx(S,{name:"info","aria-hidden":!0}),e.jsx("span",{children:z})]}):null,e.jsx(Ae,{onClick:()=>void I(),disabled:!b||!h||C||$,children:n("names.buyCta")})]})]}),r==="completing"&&e.jsxs(un,{children:[e.jsx(gn,{src:st,alt:"",width:56,height:56}),e.jsx(bn,{children:te?n("names.confirming"):n("names.completing")}),e.jsxs(yn,{children:[e.jsx(wn,{"aria-hidden":!0,children:e.jsx("span",{})}),e.jsx(jn,{children:"1/1"})]})]}),r==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(se,{children:[e.jsx(oe,{children:n("names.pendingHeaderTitle")}),e.jsx(ie,{onClick:a,"aria-label":n("buyModal.close"),children:e.jsx(S,{name:"close"})})]}),e.jsxs(re,{children:[n("names.myCreditsBalance")," ",e.jsx(M,{})," ",ne(l,d)]}),e.jsx(ae,{}),e.jsxs(fe,{"data-tone":"info",children:[e.jsx(S,{name:"info","aria-hidden":!0}),e.jsxs("span",{children:[e.jsx("b",{children:n("names.pendingBannerBold")})," ",n("names.pendingBannerRest")]})]}),e.jsxs(le,{style:{marginTop:20},children:[e.jsx(ce,{"aria-hidden":!0,children:"@"}),e.jsxs(de,{children:[e.jsxs(pe,{children:[o,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(he,{children:n("names.subtitle")})]}),e.jsxs(xe,{children:[e.jsx(M,{}),E]})]}),e.jsx(Ne,{children:e.jsx(Me,{onClick:()=>{a(),p("/my-assets")},children:n("names.myItems")})})]}),r==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs(se,{children:[e.jsx(oe,{children:n("names.successHeaderTitle")}),e.jsx(ie,{onClick:a,"aria-label":n("buyModal.close"),children:e.jsx(S,{name:"close"})})]}),e.jsxs(re,{children:[n("names.myCreditsBalance")," ",e.jsx(M,{})," ",ne(l,d)]}),e.jsx(ae,{}),e.jsxs(vn,{children:[e.jsx($n,{"aria-hidden":!0,children:e.jsx(S,{name:"check"})}),e.jsxs(Cn,{children:[e.jsx("b",{children:n("names.successBannerBold")})," ",n("names.successBannerRest")]})]}),e.jsxs(le,{style:{marginTop:20},children:[e.jsx(ce,{"aria-hidden":!0,children:"@"}),e.jsxs(de,{children:[e.jsxs(pe,{children:[o,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(he,{children:n("names.subtitle")})]}),e.jsxs(xe,{children:[e.jsx(M,{}),E]})]}),e.jsxs(Ne,{children:[e.jsx(Me,{onClick:()=>{a(),p("/my-assets")},children:n("names.myItems")}),e.jsx(kn,{href:F.profileUrl,target:"_blank",rel:"noopener noreferrer",children:n("names.assignToAvatar")})]})]})]})})}function En(o){return o.replace(/[&<>"']/g,i=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[i])}const Rn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30903100943.commit-cfb5121/_assets/identity-B4DXDuJP.webp",Tn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30903100943.commit-cfb5121/_assets/world-B-9aPlxu.webp",_n="https://cdn.decentraland.org/@dcl/shop/0.1.0-30903100943.commit-cfb5121/_assets/invite-BfwIhP2C.webp",zn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30903100943.commit-cfb5121/_assets/governance-DnazlIjy.webp",In=s.div`
|
|
383
383
|
width: 100%;
|
|
384
384
|
min-width: 0;
|
|
385
385
|
`,An=s.nav`
|
|
@@ -658,7 +658,7 @@ import{b as We,r as f,j as e,u as Je}from"./react-vyZjIDcS.js";import{c as F,av
|
|
|
658
658
|
width: 16px;
|
|
659
659
|
height: 16px;
|
|
660
660
|
}
|
|
661
|
-
`,
|
|
661
|
+
`,me=s.div`
|
|
662
662
|
display: flex;
|
|
663
663
|
align-items: center;
|
|
664
664
|
gap: 8px;
|
|
@@ -797,4 +797,4 @@ import{b as We,r as f,j as e,u as Je}from"./react-vyZjIDcS.js";import{c as F,av
|
|
|
797
797
|
clip: rect(0, 0, 0, 0);
|
|
798
798
|
white-space: nowrap;
|
|
799
799
|
border: 0;
|
|
800
|
-
`,as="https://docs.decentraland.org/creator/worlds/about/",ls="https://governance.decentraland.org";function cs(o){const i=typeof window<"u"?window.location.hostname:"";return`${i.endsWith("decentraland.org")?"https://decentraland.org":i.endsWith("decentraland.today")?"https://decentraland.today":"https://decentraland.zone"}/marketplace/names/browse?search=${encodeURIComponent(o)}`}function ds({onBack:o}){Fe({title:n("seo.names.title"),description:n("seo.names.description")});const{session:i,signIn:a}=Be(),{data:h}=Ue(),l=h?Le(L,h):null,[d,x]=f.useState(""),[p,r]=f.useState("idle"),[u,g]=f.useState(!1),w=f.useRef(null),[j,k]=f.useState(void 0);f.useLayoutEffect(()=>{w.current&&k(w.current.offsetWidth)},[d]),f.useEffect(()=>{if(!ze(d).ok){r(d.length===0?"idle":"invalid");return}r("checking");const _=new AbortController,R=setTimeout(()=>{(async()=>{try{const $=await Yt(d,{signal:_.signal});r($)}catch($){if(($==null?void 0:$.name)==="AbortError")return;r("error")}})()},400);return()=>{clearTimeout(R),_.abort()}},[d]);const m=ze(d),b=m.ok&&(p==="available"||p==="error");function v(){if(b){if(!i){a();return}g(!0)}}const E=e.jsxs(e.Fragment,{children:[n("names.claim"),l!=null?e.jsxs(Yn,{children:[e.jsx(M,{}),ge(l)]}):null]});return e.jsxs(In,{"data-testid":"names-page",children:[e.jsxs(An,{"aria-label":n("names.breadcrumbAria"),children:[e.jsx(Nn,{onClick:o,children:n("names.breadcrumbCollectibles")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(Mn,{children:n("names.breadcrumbCurrent")})]}),e.jsxs(Pn,{children:[e.jsxs(Wn,{children:[e.jsxs(Bn,{children:[e.jsx(Fn,{children:n("names.heroTitle")}),e.jsx(Ln,{children:n("names.heroSubtitle")})]}),e.jsxs(Un,{children:[e.jsxs(Hn,{children:[e.jsxs(On,{invalid:p==="taken",children:[e.jsxs(Vn,{children:[e.jsx(Kn,{"aria-hidden":!0,children:"@"}),e.jsx(Zn,{value:d,onChange:C=>x(Jt(C.target.value)),placeholder:n("names.inputPlaceholder"),"aria-label":n("names.inputAria"),autoComplete:"off",spellCheck:!1,maxLength:ee,style:{width:j!=null?`${j}px`:void 0}}),e.jsx(Dn,{ref:w,"aria-hidden":!0,children:d||n("names.inputPlaceholder")}),e.jsx(Jn,{children:n("names.suffix")})]}),d.length>0?e.jsxs(Qn,{"aria-hidden":!0,children:[d.length,"/",ee]}):null,e.jsx(Oe,{onClick:v,disabled:!b,"data-testid":"names-claim",children:E})]}),p==="taken"?e.jsxs(Gn,{role:"status","data-testid":"names-taken",children:[e.jsx(S,{name:"info",size:16,"aria-hidden":!0}),e.jsx("span",{children:n("names.taken")}),e.jsxs(qn,{href:cs(d),target:"_blank",rel:"noopener noreferrer",children:[n("names.takenMakeOffer"),e.jsx(S,{name:"external-link",size:13,"aria-hidden":!0})]})]}):null]}),e.jsx(Xn,{onClick:v,disabled:!b,children:E}),p==="checking"?e.jsx(fe,{tone:"muted",role:"status","data-testid":"names-checking",children:n("names.checking")}):p==="error"?e.jsx(fe,{tone:"muted",role:"status",children:n("names.checkError")}):p==="invalid"&&!m.ok&&m.reason==="too-short"?e.jsx(fe,{tone:"muted",role:"status",children:n("names.tooShort",{min:He})}):null,e.jsx(rs,{role:"status","aria-live":"polite",children:p==="available"?n("names.available",{name:d}):""})]})]}),e.jsxs(es,{children:[e.jsxs(ts,{children:[e.jsx(ns,{children:n("names.whyTitle")}),e.jsx(ss,{children:n("names.whyIntro")})]}),e.jsxs(os,{children:[e.jsxs(K,{children:[e.jsx(Z,{src:Rn,alt:""}),e.jsxs(J,{children:[e.jsx(Q,{children:n("names.why1Title")}),e.jsx(X,{children:n("names.why1")})]})]}),e.jsxs(K,{children:[e.jsx(Z,{src:Tn,alt:""}),e.jsxs(J,{children:[e.jsx(Q,{children:n("names.why2Title")}),e.jsxs(X,{children:[n("names.why2")," ",e.jsx(is,{children:n("names.why2Address")})]}),e.jsxs(Pe,{href:as,target:"_blank",rel:"noopener noreferrer",children:[n("names.learnMore"),e.jsx(S,{name:"external-link","aria-hidden":!0})]})]})]}),e.jsxs(K,{children:[e.jsx(Z,{src:_n,alt:""}),e.jsxs(J,{children:[e.jsx(Q,{children:n("names.why3Title")}),e.jsx(X,{children:n("names.why3")})]})]}),e.jsxs(K,{children:[e.jsx(Z,{src:zn,alt:""}),e.jsxs(J,{children:[e.jsx(Q,{children:n("names.why4Title")}),e.jsx(X,{children:n("names.why4")}),e.jsxs(Pe,{href:ls,target:"_blank",rel:"noopener noreferrer",children:[n("names.learnMore"),e.jsx(S,{name:"external-link","aria-hidden":!0})]})]})]})]})]})]}),u?e.jsx(Sn,{name:d,priceCredits:l,onClose:()=>g(!1)}):null]})}const ps="data:image/svg+xml,%3csvg%20width='101'%20height='101'%20viewBox='0%200%20101%20101'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M42.4493%2040.9855L30.7394%2052.6954'%20stroke='%23FF5A57'%20stroke-width='3.15625'%20stroke-linecap='round'/%3e%3cpath%20d='M30.7391%2040.9855L42.449%2052.6954'%20stroke='%23FF5A57'%20stroke-width='3.15625'%20stroke-linecap='round'/%3e%3cpath%20d='M36.2621%2071.0604C29.6047%2071.0604%2023.9709%2068.7542%2019.3608%2064.1416C14.7507%2059.5291%2012.4445%2053.8953%2012.442%2047.2404C12.4396%2040.5854%2014.7459%2034.9516%2019.3608%2030.3391C23.9758%2025.7266%2029.6096%2023.4203%2036.2621%2023.4203C42.9146%2023.4203%2048.5496%2025.7266%2053.167%2030.3391C57.7844%2034.9516%2060.0895%2040.5854%2060.0822%2047.2404C60.0822%2049.9277%2059.6546%2052.4624%2058.7995%2054.8445C57.9445%2057.2265%2056.784%2059.3336%2055.3181%2061.1659L75.84%2081.6878C76.5119%2082.3597%2076.8478%2083.2148%2076.8478%2084.2531C76.8478%2085.2914%2076.5119%2086.1465%2075.84%2086.8183C75.1682%2087.4902%2074.3131%2087.8261%2073.2748%2087.8261C72.2365%2087.8261%2071.3814%2087.4902%2070.7096%2086.8183L50.1877%2066.2964C48.3554%2067.7623%2046.2482%2068.9227%2043.8662%2069.7778C41.4842%2070.6329%2038.9495%2071.0604%2036.2621%2071.0604ZM36.2621%2063.7312C40.8429%2063.7312%2044.7372%2062.1285%2047.9449%2058.9232C51.1527%2055.7179%2052.7554%2051.8236%2052.7529%2047.2404C52.7505%2042.6571%2051.1478%2038.7641%2047.9449%2035.5612C44.742%2032.3583%2040.8478%2030.7544%2036.2621%2030.7495C31.6764%2030.7447%2027.7834%2032.3485%2024.5829%2035.5612C21.3825%2038.7739%2019.7786%2042.6669%2019.7713%2047.2404C19.764%2051.8138%2021.3678%2055.7081%2024.5829%2058.9232C27.798%2062.1383%2031.6911%2063.7409%2036.2621%2063.7312Z'%20fill='url(%23paint0_linear_search_empty)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_search_empty'%20x1='10.4127'%20y1='55.6273'%20x2='124.009'%20y2='44.925'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FF2D55'/%3e%3cstop%20offset='1'%20stop-color='%23FFBC5B'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",ue=48;function Ms(){const[o]=Je(),i=We(),a=(o.get("q")??"").trim().toLowerCase(),h=(o.get("q")??"").trim();Fe({title:h?n("seo.collectibles.searchTitle",{query:h}):n("seo.collectibles.title"),description:n("seo.collectibles.description")});const[l,d]=f.useState("wearable"),[x,p]=f.useState(null),[r,u]=f.useState([]),[g,w]=f.useState(""),[j,k]=f.useState(""),[m,b]=f.useState("on_sale"),[v,E]=f.useState(!1),[C,_]=f.useState("newest"),[R,$]=f.useState(!1);f.useEffect(()=>{if(!R)return;const c=W=>{W.key==="Escape"&&$(!1)};document.addEventListener("keydown",c);const T=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",c),document.body.style.overflow=T}},[R]);const z=m==="on_sale",I=g&&!Number.isNaN(Number(g))?Number(g):void 0,A=j&&!Number.isNaN(Number(j))?Number(j):void 0,te=ct(),y=x?It[x]:void 0,U=(_e.find(c=>c.key===C)??_e[0]).server,H={category:l,rarities:r.length?r:void 0,wearableCategories:y,minPriceCredits:I,maxPriceCredits:A,search:a||void 0,sortBy:U,isSmart:v||void 0,onSale:!0,listingType:te?void 0:"primary"},we={category:l,rarities:r.length?r:void 0,wearableCategories:y,search:a||void 0,sortBy:U,isWearableSmart:v||void 0,isOnSale:m==="not_for_sale"?!1:void 0},{items:O,total:je,isLoading:N,isPlaceholderData:P,error:ve,hasNextPage:De,isFetchingNextPage:$e,fetchNextPage:Ge}=Nt(z?["shop-items",H]:["catalog-items",we],c=>z?at({...H,first:ue,skip:c}):lt({...we,first:ue,skip:c}),{enabled:l!=="names"}),D=je,Ce=N||P,qe=N?15:Math.min(Math.max(O.length,1),ue),{data:ke,isError:Ve}=Ue(),Ke=c=>ke&&c.manaWei?Le(c.manaWei,ke):null,Se=f.useRef(null);f.useEffect(()=>{N||P||!a||Se.current===a||(Se.current=a,Y("Shop Searched",{query:a,result_count:D}))},[a,N,P,D]);const G=f.useRef("__init__");f.useEffect(()=>{if(N||P)return;const c=JSON.stringify({category:l,subCategory:x,rarities:r,min:I,max:A,sort:C,status:m,smart:v});if(G.current==="__init__"||G.current===c){G.current=c;return}G.current=c,Y("Shop Applied Filter",{filters:{category:l,sub_category:x,rarities:r,min_price_credits:I??null,max_price_credits:A??null,status:m,smart:v,sort:C},result_count:D})},[l,x,r,I,A,C,m,v,N,P,D]);function Ee(c){d(c),p(null)}function Re(c){u(T=>T.includes(c)?T.filter(W=>W!==c):[...T,c])}function Ze(){d("wearable"),p(null),u([]),w(""),k(""),b("on_sale"),E(!1)}const B=[];(I!=null||A!=null)&&B.push({key:"price",label:n("filter.price"),onRemove:()=>{w(""),k("")}});for(const c of _t)r.includes(c)&&B.push({key:`rarity-${c}`,label:rt(c),onRemove:()=>Re(c)});return v&&B.push({key:"smart",label:n("filter.smart"),onRemove:()=>E(!1)}),m!=="on_sale"&&B.push({key:"status",label:m==="all"?n("filter.statusAll"):n("filter.notForSale"),onRemove:()=>b("on_sale")}),e.jsxs(pt,{"data-testid":"browse",children:[l!=="names"&&e.jsxs(e.Fragment,{children:[R?e.jsx(ht,{onClick:()=>$(!1),"aria-hidden":!0}):null,e.jsxs(xt,{"data-open":R||void 0,"data-testid":"browse-sidebar",children:[e.jsxs(mt,{children:[e.jsx(ft,{children:n("assets.filters")}),e.jsx(ut,{onClick:()=>$(!1),"aria-label":n("assets.closeFilters"),children:"✕"})]}),e.jsx(gt,{children:e.jsx(bt,{category:l,subCategory:x,onCategory:Ee,onSub:p,priceMin:g,priceMax:j,onPriceMin:w,onPriceMax:k,rarities:r,onToggleRarity:Re,status:m,onStatus:b,smart:v,onSmart:E})}),e.jsx(yt,{children:e.jsx(wt,{type:"button",onClick:()=>$(!1),children:n("assets.showItems")})})]})]}),e.jsx(jt,{children:l==="names"?e.jsx(ds,{onBack:()=>Ee("wearable")}):e.jsxs(e.Fragment,{children:[e.jsx(zt,{sort:C,onSort:_,total:je,loading:N||P,query:a,onOpenFilters:()=>$(!0),chips:B,onClearChips:Ze}),Ve&&z&&O.some(c=>c.source==="legacy")?e.jsx(vt,{"data-variant":"warn",children:n("assets.marketUnavailable")}):null,ve?e.jsx(Mt,{message:n("assets.loadError"),testId:"browse-error"}):null,!Ce&&O.length===0&&!ve?e.jsxs($t,{"data-testid":"browse-empty",children:[e.jsx(Ct,{src:ps,alt:""}),e.jsxs(kt,{children:[e.jsx(St,{children:n("assets.empty.title")}),e.jsx(Et,{children:h?e.jsxs(e.Fragment,{children:[n("assets.empty.searchBefore"),e.jsx("b",{children:h}),n("assets.empty.searchAfter")]}):n("assets.empty.filters")})]}),e.jsx(Rt,{children:e.jsx(Tt,{type:"button",onClick:()=>i("/overview"),children:n("assets.empty.cta")})})]}):e.jsxs(e.Fragment,{children:[e.jsx(Kt,{"data-testid":"grid",children:Ce?e.jsx(Te,{count:qe}):e.jsxs(e.Fragment,{children:[O.map(c=>{if(!z)return e.jsx(q,{item:c,mode:"view"},V(c));const T=c;if(T.source!=="legacy")return e.jsx(q,{item:c},V(c));const W=Ke(T);return W==null?e.jsx(q,{item:c,mode:"view"},V(c)):e.jsx(q,{item:{...T,priceCredits:W}},V(c))}),$e?e.jsx(Te,{count:6}):null]})}),e.jsx(At,{hasNextPage:De,isFetching:$e,onLoadMore:()=>void Ge()})]})]})})]})}export{Ms as Assets};
|
|
800
|
+
`,as="https://docs.decentraland.org/creator/worlds/about/",ls="https://governance.decentraland.org";function cs(o){const i=typeof window<"u"?window.location.hostname:"";return`${i.endsWith("decentraland.org")?"https://decentraland.org":i.endsWith("decentraland.today")?"https://decentraland.today":"https://decentraland.zone"}/marketplace/names/browse?search=${encodeURIComponent(o)}`}function ds({onBack:o}){Fe({title:n("seo.names.title"),description:n("seo.names.description")});const{session:i,signIn:a}=Be(),{data:h}=Ue(),l=h?Le(L,h):null,[d,x]=m.useState(""),[p,r]=m.useState("idle"),[u,g]=m.useState(!1),w=m.useRef(null),[j,k]=m.useState(void 0);m.useLayoutEffect(()=>{w.current&&k(w.current.offsetWidth)},[d]),m.useEffect(()=>{if(!ze(d).ok){r(d.length===0?"idle":"invalid");return}r("checking");const _=new AbortController,R=setTimeout(()=>{(async()=>{try{const $=await Yt(d,{signal:_.signal});r($)}catch($){if(($==null?void 0:$.name)==="AbortError")return;r("error")}})()},400);return()=>{clearTimeout(R),_.abort()}},[d]);const f=ze(d),b=f.ok&&(p==="available"||p==="error");function v(){if(b){if(!i){a();return}g(!0)}}const E=e.jsxs(e.Fragment,{children:[n("names.claim"),l!=null?e.jsxs(Yn,{children:[e.jsx(M,{}),ge(l)]}):null]});return e.jsxs(In,{"data-testid":"names-page",children:[e.jsxs(An,{"aria-label":n("names.breadcrumbAria"),children:[e.jsx(Nn,{onClick:o,children:n("names.breadcrumbCollectibles")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(Mn,{children:n("names.breadcrumbCurrent")})]}),e.jsxs(Pn,{children:[e.jsxs(Wn,{children:[e.jsxs(Bn,{children:[e.jsx(Fn,{children:n("names.heroTitle")}),e.jsx(Ln,{children:n("names.heroSubtitle")})]}),e.jsxs(Un,{children:[e.jsxs(Hn,{children:[e.jsxs(On,{invalid:p==="taken",children:[e.jsxs(Vn,{children:[e.jsx(Kn,{"aria-hidden":!0,children:"@"}),e.jsx(Zn,{value:d,onChange:C=>x(Jt(C.target.value)),placeholder:n("names.inputPlaceholder"),"aria-label":n("names.inputAria"),autoComplete:"off",spellCheck:!1,maxLength:ee,style:{width:j!=null?`${j}px`:void 0}}),e.jsx(Dn,{ref:w,"aria-hidden":!0,children:d||n("names.inputPlaceholder")}),e.jsx(Jn,{children:n("names.suffix")})]}),d.length>0?e.jsxs(Qn,{"aria-hidden":!0,children:[d.length,"/",ee]}):null,e.jsx(Oe,{onClick:v,disabled:!b,"data-testid":"names-claim",children:E})]}),p==="taken"?e.jsxs(Gn,{role:"status","data-testid":"names-taken",children:[e.jsx(S,{name:"info",size:16,"aria-hidden":!0}),e.jsx("span",{children:n("names.taken")}),e.jsxs(qn,{href:cs(d),target:"_blank",rel:"noopener noreferrer",children:[n("names.takenMakeOffer"),e.jsx(S,{name:"external-link",size:13,"aria-hidden":!0})]})]}):null]}),e.jsx(Xn,{onClick:v,disabled:!b,children:E}),p==="checking"?e.jsx(me,{tone:"muted",role:"status","data-testid":"names-checking",children:n("names.checking")}):p==="error"?e.jsx(me,{tone:"muted",role:"status",children:n("names.checkError")}):p==="invalid"&&!f.ok&&f.reason==="too-short"?e.jsx(me,{tone:"muted",role:"status",children:n("names.tooShort",{min:He})}):null,e.jsx(rs,{role:"status","aria-live":"polite",children:p==="available"?n("names.available",{name:d}):""})]})]}),e.jsxs(es,{children:[e.jsxs(ts,{children:[e.jsx(ns,{children:n("names.whyTitle")}),e.jsx(ss,{children:n("names.whyIntro")})]}),e.jsxs(os,{children:[e.jsxs(K,{children:[e.jsx(Z,{src:Rn,alt:""}),e.jsxs(J,{children:[e.jsx(Q,{children:n("names.why1Title")}),e.jsx(X,{children:n("names.why1")})]})]}),e.jsxs(K,{children:[e.jsx(Z,{src:Tn,alt:""}),e.jsxs(J,{children:[e.jsx(Q,{children:n("names.why2Title")}),e.jsxs(X,{children:[n("names.why2")," ",e.jsx(is,{children:n("names.why2Address")})]}),e.jsxs(Pe,{href:as,target:"_blank",rel:"noopener noreferrer",children:[n("names.learnMore"),e.jsx(S,{name:"external-link","aria-hidden":!0})]})]})]}),e.jsxs(K,{children:[e.jsx(Z,{src:_n,alt:""}),e.jsxs(J,{children:[e.jsx(Q,{children:n("names.why3Title")}),e.jsx(X,{children:n("names.why3")})]})]}),e.jsxs(K,{children:[e.jsx(Z,{src:zn,alt:""}),e.jsxs(J,{children:[e.jsx(Q,{children:n("names.why4Title")}),e.jsx(X,{children:n("names.why4")}),e.jsxs(Pe,{href:ls,target:"_blank",rel:"noopener noreferrer",children:[n("names.learnMore"),e.jsx(S,{name:"external-link","aria-hidden":!0})]})]})]})]})]})]}),u?e.jsx(Sn,{name:d,priceCredits:l,onClose:()=>g(!1)}):null]})}const ps="data:image/svg+xml,%3csvg%20width='101'%20height='101'%20viewBox='0%200%20101%20101'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M42.4493%2040.9855L30.7394%2052.6954'%20stroke='%23FF5A57'%20stroke-width='3.15625'%20stroke-linecap='round'/%3e%3cpath%20d='M30.7391%2040.9855L42.449%2052.6954'%20stroke='%23FF5A57'%20stroke-width='3.15625'%20stroke-linecap='round'/%3e%3cpath%20d='M36.2621%2071.0604C29.6047%2071.0604%2023.9709%2068.7542%2019.3608%2064.1416C14.7507%2059.5291%2012.4445%2053.8953%2012.442%2047.2404C12.4396%2040.5854%2014.7459%2034.9516%2019.3608%2030.3391C23.9758%2025.7266%2029.6096%2023.4203%2036.2621%2023.4203C42.9146%2023.4203%2048.5496%2025.7266%2053.167%2030.3391C57.7844%2034.9516%2060.0895%2040.5854%2060.0822%2047.2404C60.0822%2049.9277%2059.6546%2052.4624%2058.7995%2054.8445C57.9445%2057.2265%2056.784%2059.3336%2055.3181%2061.1659L75.84%2081.6878C76.5119%2082.3597%2076.8478%2083.2148%2076.8478%2084.2531C76.8478%2085.2914%2076.5119%2086.1465%2075.84%2086.8183C75.1682%2087.4902%2074.3131%2087.8261%2073.2748%2087.8261C72.2365%2087.8261%2071.3814%2087.4902%2070.7096%2086.8183L50.1877%2066.2964C48.3554%2067.7623%2046.2482%2068.9227%2043.8662%2069.7778C41.4842%2070.6329%2038.9495%2071.0604%2036.2621%2071.0604ZM36.2621%2063.7312C40.8429%2063.7312%2044.7372%2062.1285%2047.9449%2058.9232C51.1527%2055.7179%2052.7554%2051.8236%2052.7529%2047.2404C52.7505%2042.6571%2051.1478%2038.7641%2047.9449%2035.5612C44.742%2032.3583%2040.8478%2030.7544%2036.2621%2030.7495C31.6764%2030.7447%2027.7834%2032.3485%2024.5829%2035.5612C21.3825%2038.7739%2019.7786%2042.6669%2019.7713%2047.2404C19.764%2051.8138%2021.3678%2055.7081%2024.5829%2058.9232C27.798%2062.1383%2031.6911%2063.7409%2036.2621%2063.7312Z'%20fill='url(%23paint0_linear_search_empty)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_search_empty'%20x1='10.4127'%20y1='55.6273'%20x2='124.009'%20y2='44.925'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FF2D55'/%3e%3cstop%20offset='1'%20stop-color='%23FFBC5B'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",ue=48;function Ms(){const[o]=Je(),i=We(),a=(o.get("q")??"").trim().toLowerCase(),h=(o.get("q")??"").trim();Fe({title:h?n("seo.collectibles.searchTitle",{query:h}):n("seo.collectibles.title"),description:n("seo.collectibles.description")});const[l,d]=m.useState("wearable"),[x,p]=m.useState(null),[r,u]=m.useState([]),[g,w]=m.useState(""),[j,k]=m.useState(""),[f,b]=m.useState("on_sale"),[v,E]=m.useState(!1),[C,_]=m.useState("newest"),[R,$]=m.useState(!1);m.useEffect(()=>{if(!R)return;const c=W=>{W.key==="Escape"&&$(!1)};document.addEventListener("keydown",c);const T=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",c),document.body.style.overflow=T}},[R]);const z=f==="on_sale",I=g&&!Number.isNaN(Number(g))?Number(g):void 0,A=j&&!Number.isNaN(Number(j))?Number(j):void 0,te=ct(),y=x?It[x]:void 0,U=(_e.find(c=>c.key===C)??_e[0]).server,H={category:l,rarities:r.length?r:void 0,wearableCategories:y,minPriceCredits:I,maxPriceCredits:A,search:a||void 0,sortBy:U,isSmart:v||void 0,onSale:!0,listingType:te?void 0:"primary"},we={category:l,rarities:r.length?r:void 0,wearableCategories:y,search:a||void 0,sortBy:U,isWearableSmart:v||void 0,isOnSale:f==="not_for_sale"?!1:void 0},{items:O,total:je,isLoading:N,isPlaceholderData:P,error:ve,hasNextPage:De,isFetchingNextPage:$e,fetchNextPage:Ge}=Nt(z?["shop-items",H]:["catalog-items",we],c=>z?at({...H,first:ue,skip:c}):lt({...we,first:ue,skip:c}),{enabled:l!=="names"}),D=je,Ce=N||P,qe=N?15:Math.min(Math.max(O.length,1),ue),{data:ke,isError:Ve}=Ue(),Ke=c=>ke&&c.manaWei?Le(c.manaWei,ke):null,Se=m.useRef(null);m.useEffect(()=>{N||P||!a||Se.current===a||(Se.current=a,Y("Shop Searched",{query:a,result_count:D}))},[a,N,P,D]);const G=m.useRef("__init__");m.useEffect(()=>{if(N||P)return;const c=JSON.stringify({category:l,subCategory:x,rarities:r,min:I,max:A,sort:C,status:f,smart:v});if(G.current==="__init__"||G.current===c){G.current=c;return}G.current=c,Y("Shop Applied Filter",{filters:{category:l,sub_category:x,rarities:r,min_price_credits:I??null,max_price_credits:A??null,status:f,smart:v,sort:C},result_count:D})},[l,x,r,I,A,C,f,v,N,P,D]);function Ee(c){d(c),p(null)}function Re(c){u(T=>T.includes(c)?T.filter(W=>W!==c):[...T,c])}function Ze(){d("wearable"),p(null),u([]),w(""),k(""),b("on_sale"),E(!1)}const B=[];(I!=null||A!=null)&&B.push({key:"price",label:n("filter.price"),onRemove:()=>{w(""),k("")}});for(const c of _t)r.includes(c)&&B.push({key:`rarity-${c}`,label:rt(c),onRemove:()=>Re(c)});return v&&B.push({key:"smart",label:n("filter.smart"),onRemove:()=>E(!1)}),f!=="on_sale"&&B.push({key:"status",label:f==="all"?n("filter.statusAll"):n("filter.notForSale"),onRemove:()=>b("on_sale")}),e.jsxs(pt,{"data-testid":"browse",children:[l!=="names"&&e.jsxs(e.Fragment,{children:[R?e.jsx(ht,{onClick:()=>$(!1),"aria-hidden":!0}):null,e.jsxs(xt,{"data-open":R||void 0,"data-testid":"browse-sidebar",children:[e.jsxs(ft,{children:[e.jsx(mt,{children:n("assets.filters")}),e.jsx(ut,{onClick:()=>$(!1),"aria-label":n("assets.closeFilters"),children:"✕"})]}),e.jsx(gt,{children:e.jsx(bt,{category:l,subCategory:x,onCategory:Ee,onSub:p,priceMin:g,priceMax:j,onPriceMin:w,onPriceMax:k,rarities:r,onToggleRarity:Re,status:f,onStatus:b,smart:v,onSmart:E})}),e.jsx(yt,{children:e.jsx(wt,{type:"button",onClick:()=>$(!1),children:n("assets.showItems")})})]})]}),e.jsx(jt,{children:l==="names"?e.jsx(ds,{onBack:()=>Ee("wearable")}):e.jsxs(e.Fragment,{children:[e.jsx(zt,{sort:C,onSort:_,total:je,loading:N||P,query:a,onOpenFilters:()=>$(!0),chips:B,onClearChips:Ze}),Ve&&z&&O.some(c=>c.source==="legacy")?e.jsx(vt,{"data-variant":"warn",children:n("assets.marketUnavailable")}):null,ve?e.jsx(Mt,{message:n("assets.loadError"),testId:"browse-error"}):null,!Ce&&O.length===0&&!ve?e.jsxs($t,{"data-testid":"browse-empty",children:[e.jsx(Ct,{src:ps,alt:""}),e.jsxs(kt,{children:[e.jsx(St,{children:n("assets.empty.title")}),e.jsx(Et,{children:h?e.jsxs(e.Fragment,{children:[n("assets.empty.searchBefore"),e.jsx("b",{children:h}),n("assets.empty.searchAfter")]}):n("assets.empty.filters")})]}),e.jsx(Rt,{children:e.jsx(Tt,{type:"button",onClick:()=>i("/overview"),children:n("assets.empty.cta")})})]}):e.jsxs(e.Fragment,{children:[e.jsx(Kt,{"data-testid":"grid",children:Ce?e.jsx(Te,{count:qe}):e.jsxs(e.Fragment,{children:[O.map(c=>{if(!z)return e.jsx(q,{item:c,mode:"view"},V(c));const T=c;if(T.source!=="legacy")return e.jsx(q,{item:c},V(c));const W=Ke(T);return W==null?e.jsx(q,{item:c,mode:"view"},V(c)):e.jsx(q,{item:{...T,priceCredits:W}},V(c))}),$e?e.jsx(Te,{count:6}):null]})}),e.jsx(At,{hasNextPage:De,isFetching:$e,onLoadMore:()=>void Ge()})]})]})})]})}export{Ms as Assets};
|
|
@@ -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-
|
|
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-BqS-qyq6.js";import{n as c,T as se}from"./Tooltip-3y4DnUZl.js";import{t as e,s as o,I as g,e as s,o as ae,h as v}from"./index-B8qQ9Xxb.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-
|
|
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-B8qQ9Xxb.js";import{a as J,b as U,c as V,d as Y,s as tt,f as it}from"./authorizations-JSOY6ArB.js";import{a as et}from"./builder-Biq1yQgT.js";import{m as ot}from"./mana-matic-C4e1sNO3.js";import{f as at}from"./errors-Bj3SjlpX.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-B3nckO8c.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-
|
|
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-B8qQ9Xxb.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-CDNotQwG.js";import{u as cs}from"./useManaRate-BezWDX4Q.js";import{r as ds}from"./mana-rate-LTr19y4S.js";import{i as ls,j as us,f as hs,n as ps,h as gs,A as xs}from"./authorizations-JSOY6ArB.js";import{g as ms,b as Le}from"./buy-DTB3xpDX.js";import{b as fs,w as ys,S as vt,G as bs}from"./buy-gasless-C9C0u3NU.js";import{u as vs,M as ws,R as we,r as Cs,c as js,p as wt}from"./useCreditPacks-CcsRRofr.js";import{i as ks,a as $s}from"./errors-Bj3SjlpX.js";import{E as Ss}from"./ErrorNotice-6S2ayRHK.js";import{u as Ct}from"./mana-convert-Bbf4K53E.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-CjafzO-R.js";import"./sendMetaTransaction-B3nckO8c.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-
|
|
61
|
+
`,Es="https://cdn.decentraland.org/@dcl/shop/0.1.0-30903100943.commit-cfb5121/_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-
|
|
1
|
+
import{N,O as U,P as o,Q as n,J as D,x as M}from"./index-B8qQ9Xxb.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-3D8Gvjd6.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-
|
|
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-B8qQ9Xxb.js";import{E as ce}from"./ErrorNotice-6S2ayRHK.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-CwDiK1mG.js";import{u as ve}from"./useStore-Du3YYL1J.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-BqS-qyq6.js";import{L as $e}from"./LoadMore-COkJGWsB.js";import{u as Pe}from"./useInfiniteGrid-jYXiF9Ls.js";import{G as Me}from"./grid.styles-Dnnyw76z.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,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-
|
|
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-B8qQ9Xxb.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-JSOY6ArB.js";import{i as ie}from"./errors-Bj3SjlpX.js";import{E as oe}from"./ErrorNotice-6S2ayRHK.js";import{a as se}from"./buy-DTB3xpDX.js";import{g as re,d as ce}from"./trade-encoding-CjafzO-R.js";import{s as de,M as le,E as pe}from"./sendMetaTransaction-B3nckO8c.js";import{I as he,C as ue}from"./ethers-CXBJm_wN.js";const R="shop:resume_after_signin",xe=900*1e3;function rt(a){try{sessionStorage.setItem(R,JSON.stringify({...a,at:Date.now()}))}catch{}}function ct(a){let n;try{n=sessionStorage.getItem(R)}catch{return null}if(!n)return null;try{sessionStorage.removeItem(R)}catch{}let i;try{i=JSON.parse(n)}catch{return null}return!i||i.type!==a||typeof i.at!="number"||Date.now()-i.at>xe?null:i.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:i.path}}function ge(a,n){return(a+n-1n)/n}function fe(a,n,i){return a<=0||n<=0?0n:a>=n?i:ge(i*BigInt(a),BigInt(n))}function dt(a){var b,y,w;const n=Number.isFinite(a.priceCents)?Math.max(0,Math.trunc(a.priceCents)):0,i=Number.isFinite(a.balanceCents)?Math.max(0,Math.trunc(a.balanceCents)):0,s=a.priceManaWei>0n?a.priceManaWei:0n,d=a.manaBalanceWei>0n?a.manaBalanceWei:0n;if(n<=0)return{options:[],preferred:null,manaShortfall:null};const c=[];if(i>=n&&c.push({method:"credits",creditsCents:n,manaWei:0n}),s>0n&&i>0&&i<n){const l=n-i,f=fe(l,n,s);d>=f&&c.push({method:"combined",creditsCents:i,manaWei:f})}s>0n&&d>=s&&c.push({method:"mana",creditsCents:0,manaWei:s});const p=((b=c.find(l=>l.method==="credits"))==null?void 0:b.method)??((y=c.find(l=>l.method==="combined"))==null?void 0:y.method)??((w=c.find(l=>l.method==="mana"))==null?void 0:w.method)??null,m=!c.some(l=>l.method==="mana"||l.method==="combined")&&s>0n&&d>0n?{manaWei:d,manaCents:me(d,n,s),priceCents:n}:null;return{options:c,preferred:p,manaShortfall:m}}function me(a,n,i){return Number(a*BigInt(n)/i)}function lt(a,n){let i=Number.isFinite(n)?Math.max(0,Math.trunc(n)):0;return a.map(s=>{const d=Number.isFinite(s)?Math.max(0,Math.trunc(s)):0,c=Math.min(d,i);return i-=c,c})}function z(a){return Number.isFinite(a)?Math.max(0,a)/10:0}function pt(a,n){return a.options.find(i=>i.method===n)??null}function ht(a,n){if(!Number.isFinite(a)||a<=0||n<=0n)return null;const i=a/10;return Number(n)/1e18/i}const T="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group%201'%3e%3cpath%20id='Vector'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%202L22%2012L12%2022L2%2012L12%202ZM12%204.8L19.2%2012L12%2019.2L4.8%2012L12%204.8ZM12%2015.6C12.9548%2015.6001%2013.8705%2015.2209%2014.5457%2014.5459C15.2209%2013.8708%2015.6003%2012.9552%2015.6004%2012.0004C15.6005%2011.0456%2015.2213%2010.1299%2014.5463%209.45471C13.8712%208.7795%2012.9556%208.40011%2012.0008%208.4C11.0461%208.4%2010.1304%208.77928%209.45525%209.45442C8.78012%2010.1295%208.40083%2011.0452%208.40083%2012C8.40083%2012.9548%208.78012%2013.8705%209.45525%2014.5456C10.1304%2015.2207%2011.0461%2015.6%2012.0008%2015.6H12Z'%20fill='white'/%3e%3cg%20id='Rectangle%201'%3e%3c/g%3e%3c/g%3e%3c/svg%3e",be=e.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 12px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as Y,j as e,L as ue,e as fe,u as be,r as y}from"./react-vyZjIDcS.js";import{t as J,aB as we,aC as R,aD as _,s as a,aE as je,H as ve,aF as Ce,e as t,aG as 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-
|
|
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-B8qQ9Xxb.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-CwDiK1mG.js";import{u as Ke,L as Oe}from"./useStore-Du3YYL1J.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-BqS-qyq6.js";import{L as G}from"./LoadMore-COkJGWsB.js";import{u as U}from"./useInfiniteGrid-jYXiF9Ls.js";import{E as D}from"./ErrorNotice-6S2ayRHK.js";import{G as K}from"./grid.styles-Dnnyw76z.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
2
|
height: 300px;
|
|
3
3
|
background: ${u.bg};
|
|
4
4
|
border-radius: ${X.card};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as r}from"./react-vyZjIDcS.js";import{I as i}from"./index-
|
|
1
|
+
import{j as r}from"./react-vyZjIDcS.js";import{I as i}from"./index-B8qQ9Xxb.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-
|
|
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-BJW4ebEt.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-CbtJGEzL.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};
|