@dcl/shop 0.1.0-30830708286.commit-6900e32 → 0.1.0-30835612462.commit-48765f9
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-MnXzrB9W.js → Activity-C96oKaM7.js} +1 -1
- package/_assets/{AnimatedBackground-htl_aksK.js → AnimatedBackground-Cg4YrmHy.js} +1 -1
- package/_assets/{Assets-CBDYtRid.js → Assets-BUbwNh-5.js} +11 -11
- package/_assets/{Assets.styles-BJpp2Oe0.js → Assets.styles-BO8jltml.js} +1 -1
- package/_assets/Authorizations-D7hfFylo.js +186 -0
- package/_assets/{Cart-e1KMPGgH.js → Cart-DPW25tAG.js} +6 -6
- package/_assets/{CircularProgress-nhFw9veT.js → CircularProgress-B2h31Yy9.js} +5 -5
- package/_assets/{Collection--mvJQAHb.js → Collection-BS21SN6A.js} +5 -5
- package/_assets/{CollectionCarousel-CEkqQ1PE.js → CollectionCarousel-WI45XOFA.js} +7 -7
- package/_assets/{Creator-CDsnYW7x.js → Creator-DQZ74uf0.js} +4 -4
- package/_assets/{ErrorNotice-FoLpDD1-.js → ErrorNotice-q0dn0iRL.js} +1 -1
- package/_assets/{ExchangeController-C5od18cc.js → ExchangeController-Dtgh1od6.js} +1 -1
- package/_assets/{GetCredits-UC4ETtf6.js → GetCredits-D-jeDJ75.js} +8 -8
- package/_assets/{HelpersUtil-DN2EdyXJ.js → HelpersUtil-D2_GPqxX.js} +1 -1
- package/_assets/{ImportListings-CNRuPtew.js → ImportListings-BNjL24xn.js} +10 -10
- package/_assets/{ItemDetail-Cb5zRdZJ.js → ItemDetail-BXpWKwPY.js} +13 -13
- package/_assets/{LoadMore-8od0F5L9.js → LoadMore-DoQvuFO_.js} +1 -1
- package/_assets/{MenuList-DS3r7IBB.js → MenuList-DOJfvyqr.js} +1 -1
- package/_assets/{MyAssets-Dm7z3LNq.js → MyAssets-DpQnCJPT.js} +1 -1
- package/_assets/{MyFavorites-CJ9BdUjm.js → MyFavorites-DFO63j-P.js} +1 -1
- package/_assets/{NotFound-B0AaFvrv.js → NotFound-BocUG6Wo.js} +1 -1
- package/_assets/NotificationsBell-iaGtBsC9.js +34 -0
- package/_assets/{StoreSettings-BGnmAotG.js → StoreSettings-Bc_NBrxI.js} +4 -4
- package/_assets/{Success-BvFPVtXh.js → Success-BIMxdHvn.js} +10 -10
- package/_assets/{SwapController-Ce813SnO.js → SwapController-DeKeu3FE.js} +1 -1
- package/_assets/{Tooltip-Dy87pXpy.js → Tooltip-BLyu7Dfk.js} +1 -1
- package/_assets/{TradeService-BbXC6H5_.js → TradeService-CWqv5slk.js} +1 -1
- package/_assets/{W3MFrameProviderSingleton-CrdKu7xI.js → W3MFrameProviderSingleton-1MRMKUrL.js} +3 -3
- package/_assets/{WebCryptoP256-XeUqCFp1.js → WebCryptoP256-BAvl6xkt.js} +1 -1
- package/_assets/{authorizations-E8_0NGng.js → authorizations-DDsnY_Zf.js} +1 -1
- package/_assets/{basic-BgmhLeYh.js → basic-BzVRhtZ-.js} +1 -1
- package/_assets/{biconomy-CoRUSW3F.js → biconomy-yl7EuW3B.js} +1 -1
- package/_assets/{browseLayout.styles-BuE8ZzH7.js → browseLayout.styles-u63rKyzf.js} +6 -6
- package/_assets/{builder-CSTbRG1g.js → builder-BO6I7uZQ.js} +1 -1
- package/_assets/{buy-CFAg0mL8.js → buy-DN9Q4fmJ.js} +1 -1
- package/_assets/{buy-gasless-B2L69ya6.js → buy-gasless-Cxl5QDDd.js} +1 -1
- package/_assets/{categories-wrk9ttY6.js → categories-DFgZJeSL.js} +7 -7
- package/_assets/{ccip-YM_kCBLY.js → ccip-5db1OYaq.js} +1 -1
- package/_assets/{ccip-gnBPW_-R.js → ccip-C9MO7Vbh.js} +1 -1
- package/_assets/{clsx-CqIwIRCQ.js → clsx-Dv5E4mS4.js} +2 -2
- package/_assets/{controller-yZy75Z7P.js → controller-DNuVvFDa.js} +2 -2
- package/_assets/{core-DkD31Zjb.js → core-Do4xTqpU.js} +4 -4
- package/_assets/{createSvgIcon-CMMzm3U0.js → createSvgIcon-TyRUGFdQ.js} +4 -4
- package/_assets/{custom-B-orziPC.js → custom-Cdk30JmS.js} +1 -1
- package/_assets/{data-capture-nSLWVv-w.js → data-capture-DwwEo9Zw.js} +1 -1
- package/_assets/{email-Bj103v1P.js → email-DiU12yVh.js} +1 -1
- package/_assets/{embedded-wallet-BcQlnpmz.js → embedded-wallet-Gkjm7p7P.js} +1 -1
- package/_assets/{emotion-styled.browser.esm-Cx7yWxVd.js → emotion-styled.browser.esm-1jXvUKUZ.js} +1 -1
- package/_assets/{engine-DDk1gbcP.js → engine-BlXXh7Bj.js} +1 -1
- package/_assets/{errors-CPDOUeQU.js → errors-BshsHqbY.js} +1 -1
- package/_assets/{estimate-l1-fee-COUDSnTC.js → estimate-l1-fee-Jhm2Yxur.js} +1 -1
- package/_assets/{execute-CmAmYuhz.js → execute-BrbMEhFX.js} +2 -2
- package/_assets/{features-B3EUOZIc.js → features-WtRCFBGN.js} +1 -1
- package/_assets/{fetchTokenMetadata-CfOxP6Xt.js → fetchTokenMetadata-Bm5qOhHz.js} +2 -2
- package/_assets/{get-ecosystem-wallet-info-CT8m7arg.js → get-ecosystem-wallet-info-Bk3TC-8s.js} +1 -1
- package/_assets/{getBalance-sSJeAfPA.js → getBalance-D5TAQGrF.js} +1 -1
- package/_assets/{getNFT-DQ56iXLL.js → getNFT-BXhNmL18.js} +1 -1
- package/_assets/{getNFT-CaRZc3jP.js → getNFT-CCYMJGO3.js} +1 -1
- package/_assets/{getThemeProps-DMuo3coh.js → getThemeProps-jxkK7aJF.js} +1 -1
- package/_assets/{grid.styles-D-gTOGBC.js → grid.styles-Dc-BunHd.js} +1 -1
- package/_assets/{hashTypedData-BiYwzMSX.js → hashTypedData-Ca0HEadf.js} +1 -1
- package/_assets/{hashTypedData-DTFMLH-r.js → hashTypedData-DVgRVFNg.js} +1 -1
- package/_assets/{import-DdbcQXPQ.js → import-DOwZHLAr.js} +1 -1
- package/_assets/{in-app-DqFHpjTV.js → in-app-5OmWNOhY.js} +1 -1
- package/_assets/{in-app-wallet-calls-DHqdMTHg.js → in-app-wallet-calls-BRQJJecy.js} +1 -1
- package/_assets/{index-Dyfkmcym.js → index-2OVx4iJi.js} +3 -3
- package/_assets/{index-HH9YYVaK.js → index-B0qtsAE-.js} +1 -1
- package/_assets/{index-BcG9G8Eg.js → index-B4VI0jMN.js} +1 -1
- package/_assets/{index-DIQz8cOu.js → index-BE_Ebetr.js} +1 -1
- package/_assets/{index-Dd6JKVr9.js → index-BFBjDoQ6.js} +1 -1
- package/_assets/{index-axEGwhSI.js → index-BJOGj8uX.js} +1 -1
- package/_assets/{index-CgPnggHq.js → index-BUWXcU3w.js} +1 -1
- package/_assets/{index-BHap0Pt7.js → index-BVkfXvB0.js} +1 -1
- package/_assets/{index-SLZL1DoR.js → index-Be0TtwRh.js} +1 -1
- package/_assets/{index-BPe_F07L.js → index-BgkliADR.js} +1 -1
- package/_assets/{index-C-mOh_a2.js → index-BhozS4qR.js} +1 -1
- package/_assets/{index-BJpdqx6Q.js → index-Bjz1afXG.js} +1 -1
- package/_assets/{index-B-GIGHBi.js → index-C24ZPX4S.js} +1 -1
- package/_assets/{index-B1oCsNE3.js → index-CKNfn6Vk.js} +3 -3
- package/_assets/{index-ZLrp5Bhh.js → index-CKvAeyW_.js} +26 -26
- package/_assets/{index-B4TEatQl.js → index-CLwiHF4x.js} +1 -1
- package/_assets/{index-Qo51btPd.js → index-COIPDAvM.js} +1 -1
- package/_assets/{index-DOMV_UlQ.js → index-COvhkZx4.js} +1 -1
- package/_assets/{index-Cywb3mZG.js → index-CUdjYgOL.js} +1 -1
- package/_assets/{index-CFcgb0ax.js → index-CX9Whfxj.js} +1 -1
- package/_assets/{index-CBEktmuo.js → index-C_QkMk4V.js} +2 -2
- package/_assets/{index-WFqqjFcS.js → index-Clxl6O3m.js} +1 -1
- package/_assets/{index-B1Vw7Ce7.js → index-Cp14nZEB.js} +1 -1
- package/_assets/{index-DNqM2cRp.js → index-CrrW0USV.js} +1 -1
- package/_assets/{index-CeiZi1Mv.js → index-CyM-uKEn.js} +1 -1
- package/_assets/{index-m9ABB7av.js → index-D6QGQCMT.js} +1 -1
- package/_assets/{index-uti914D5.js → index-D7m3HL9N.js} +1 -1
- package/_assets/{index-gzgGbBGj.js → index-DBb0SZED.js} +1 -1
- package/_assets/{index-BxayUwju.js → index-DCJUcLs-.js} +1 -1
- package/_assets/{index-CbJMa4Yh.js → index-DCTmqT9n.js} +1 -1
- package/_assets/{index-BuvImOwE.js → index-DDY4z1Qo.js} +1 -1
- package/_assets/{index-Gb1PiPiA.js → index-DFWSTox1.js} +3 -3
- package/_assets/{index-hDbN63Ln.js → index-DQ3nh_Gh.js} +1 -1
- package/_assets/{index-DY8ZC3eZ.js → index-Da6pHJ2U.js} +1 -1
- package/_assets/{index-Bjtki3zK.js → index-Ddv8zF_v.js} +1 -1
- package/_assets/{index-B6qnJTMp.js → index-DgkhTIuB.js} +1 -1
- package/_assets/{index-DJeGZsWn.js → index-DmlmMlHx.js} +1 -1
- package/_assets/{index-BmscqdKV.js → index-Dx8DDVd9.js} +1 -1
- package/_assets/{index-IH5Acvug.js → index-DyTr5Odp.js} +2 -2
- package/_assets/{index-CBHL2bKV.js → index-E6nd8w7r.js} +1 -1
- package/_assets/{index-CTFvSyNV.js → index-EDfm-4gk.js} +1 -1
- package/_assets/{index-DZu4-xVf.js → index-Fy8-NNgy.js} +1 -1
- package/_assets/{index-CiqXMsjr.js → index-M_xvfKlg.js} +1 -1
- package/_assets/{index-BkDnPBy0.js → index-PVirg3CC.js} +2 -2
- package/_assets/{index-zJQqEgUQ.js → index-SIu0g-iY.js} +1 -1
- package/_assets/{index-BbV5I-Nq.js → index-Yqi1mlp4.js} +1 -1
- package/_assets/{index-T2J3uY-Z.js → index-a4DwWHMC.js} +2 -2
- package/_assets/{index-D-ZDvJCP.js → index-hUwYbJaz.js} +2 -2
- package/_assets/{index-DZ_0HpBO.js → index-hycTvNv9.js} +1 -1
- package/_assets/{index-BoKPwZrb.js → index-p4aiSGwy.js} +1 -1
- package/_assets/{index-CTG34-7k.js → index-tDQizk_n.js} +1 -1
- package/_assets/{index.es-CpdpPZ5k.js → index.es-4BnFbLIq.js} +1 -1
- package/_assets/{index.es-D877V0ui.js → index.es-CHF2aRm8.js} +1 -1
- package/_assets/{index.es-cnYw8KNm.js → index.es-CuQzAuJf.js} +4 -4
- package/_assets/{localBatchGatewayRequest-Cm_Q3xcs.js → localBatchGatewayRequest-BiaZ99qV.js} +1 -1
- package/_assets/{mana-convert-BD8UMnC-.js → mana-convert-fQ28xr65.js} +1 -1
- package/_assets/{mana-rate-DsLc4315.js → mana-rate-CX4vkbTv.js} +1 -1
- package/_assets/{networks-BSQfuOw7.js → networks-BLWCcklV.js} +1 -1
- package/_assets/{onramp-PSISd-iT.js → onramp-ofeNemBP.js} +1 -1
- package/_assets/{openzeppelin-BVepIV31.js → openzeppelin-CQ4xxvCW.js} +1 -1
- package/_assets/{parseNft-DdQmcS_8.js → parseNft-BA1YqoMO.js} +2 -2
- package/_assets/{parseSignature-5g9oB04J.js → parseSignature-Bv3a-ckt.js} +1 -1
- package/_assets/{parseSignature-CtzX7AqF.js → parseSignature-CdZk3HUU.js} +3 -3
- package/_assets/{passkeys-tloHjtZY.js → passkeys-cIb8SYvN.js} +1 -1
- package/_assets/{pay-with-exchange-DhTTxcu5.js → pay-with-exchange-DgR6jsOE.js} +1 -1
- package/_assets/{qr-overlay-BvHuZZBy.js → qr-overlay-Cfft7a0M.js} +1 -1
- package/_assets/{receive-BdMbDZpD.js → receive-BKMf0MUc.js} +1 -1
- package/_assets/{resolveImplementation-CFPs_1ly.js → resolveImplementation-BUhQkFuG.js} +1 -1
- package/_assets/{rpc-BGNwjJyh.js → rpc-BSCW9r0K.js} +1 -1
- package/_assets/{secp256k1-COhPDJ4u.js → secp256k1-Cc7ZGphI.js} +1 -1
- package/_assets/{secp256k1-DZ2SAej-.js → secp256k1-D7Ic1AnI.js} +1 -1
- package/_assets/{secp256k1-705CLADe.js → secp256k1-DZ_AtAE9.js} +1 -1
- package/_assets/{send-cMULZVUl.js → send-D0GDu_vS.js} +1 -1
- package/_assets/{send-batch-transaction-DKis0-QF.js → send-batch-transaction-Bx_S55BL.js} +1 -1
- package/_assets/{send-eip712-transaction-VdYRVrqY.js → send-eip712-transaction-BeQ_HoA6.js} +2 -2
- package/_assets/{send-gasless-transaction-D9DvumJW.js → send-gasless-transaction-mq5auYkP.js} +2 -2
- package/_assets/{send-transaction-CXK5_GYH.js → send-transaction-D3g0h3x8.js} +2 -2
- package/_assets/{sendMetaTransaction-CQ1T_6-I.js → sendMetaTransaction-CfYBmJqE.js} +1 -1
- package/_assets/{sendRawTransaction-DvGIcbqV.js → sendRawTransaction-Bdfd1V50.js} +3 -3
- package/_assets/{serializeTransaction-DUdNUuM4.js → serializeTransaction-Bq1icuDU.js} +1 -1
- package/_assets/{session-proposal-nFRfFF1d.js → session-proposal-CeKp7mKZ.js} +1 -1
- package/_assets/{session-request-CorlzLX5.js → session-request-CZ68hd2h.js} +2 -2
- package/_assets/{signing-VlUa-Oq7.js → signing-C7pGWbAD.js} +3 -3
- package/_assets/{socials-B5kFlk2f.js → socials-DVfxwwog.js} +1 -1
- package/_assets/{swaps-Yhyu65X0.js → swaps-BHlzfOa6.js} +1 -1
- package/_assets/{thirdweb-80s_5RM_.js → thirdweb-PU38RH0J.js} +3 -3
- package/_assets/{to-serializable-transaction-BvXKdTbz.js → to-serializable-transaction-gDnQ8f6A.js} +2 -2
- package/_assets/{trade-encoding-BJQNrSRU.js → trade-encoding-DPKBDNkR.js} +1 -1
- package/_assets/{transactionReceipt-D9UoeNG0.js → transactionReceipt-CkDBxTqo.js} +1 -1
- package/_assets/{transactions-BR_gP4fB.js → transactions-CC5Z4LdW.js} +1 -1
- package/_assets/useCreditPacks-CQXC1itx.js +1 -0
- package/_assets/{useInfiniteGrid-SEfbanDp.js → useInfiniteGrid-CK8TA2xA.js} +1 -1
- package/_assets/useManaRate-DvHMbg5D.js +1 -0
- package/_assets/{useSecondarySales-BdMq83Pz.js → useSecondarySales-BVKMem4L.js} +1 -1
- package/_assets/{useStore-BC3A7db6.js → useStore-55b8sEvt.js} +1 -1
- package/_assets/{useTheme-BHUAoIEZ.js → useTheme-s40vMPeT.js} +1 -1
- package/_assets/{verifyHash-VvjDkBws.js → verifyHash-UTScJ5vY.js} +1 -1
- package/_assets/{w3m-modal-CU7ELmQd.js → w3m-modal-BcGHx_GU.js} +1 -1
- package/_assets/{w3m-modal-ODQEBY_r.js → w3m-modal-DvvX0FR6.js} +1 -1
- package/_assets/{wait-for-tx-receipt-DUUNmO1K.js → wait-for-tx-receipt-DeBOMM1R.js} +1 -1
- package/_assets/{wallets-BWg5VZy0.js → wallets-JW3aPEWT.js} +5 -5
- package/_assets/{web-connector-B1PoaR_B.js → web-connector-RvG-aCdp.js} +3 -3
- package/_assets/{writeContract-Dk_8bpTb.js → writeContract-Dqe7Ta-l.js} +1 -1
- package/_assets/{zoraTestnet-C94OTMqe.js → zoraTestnet-DDg_i6X6.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/_assets/Authorizations-lE31EPN4.js +0 -182
- package/_assets/NotificationsBell-T4VZFoIu.js +0 -34
- package/_assets/useCreditPacks-Diy15u3Q.js +0 -1
- package/_assets/useManaRate-DNC9BmC1.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{
|
|
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`
|
|
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-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=`
|
|
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,
|
|
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`
|
|
2
2
|
position: fixed;
|
|
3
3
|
inset: 0;
|
|
4
4
|
z-index: 10000;
|
|
@@ -186,7 +186,7 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,au
|
|
|
186
186
|
font-family: ${t.font.sans};
|
|
187
187
|
font-size: 16px;
|
|
188
188
|
color: ${t.colors.muted2};
|
|
189
|
-
`,
|
|
189
|
+
`,Te=n.button`
|
|
190
190
|
margin-top: 16px;
|
|
191
191
|
width: 100%;
|
|
192
192
|
height: 52px;
|
|
@@ -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,au
|
|
|
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=
|
|
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=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[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`
|
|
370
370
|
width: 100%;
|
|
371
371
|
min-width: 0;
|
|
372
372
|
`,An=n.nav`
|
|
@@ -453,12 +453,12 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,au
|
|
|
453
453
|
${t.media.maxWidth("mobile")} {
|
|
454
454
|
font-size: 16px;
|
|
455
455
|
}
|
|
456
|
-
`,
|
|
456
|
+
`,Un=n.div`
|
|
457
457
|
width: min(785px, 100%);
|
|
458
458
|
display: flex;
|
|
459
459
|
flex-direction: column;
|
|
460
460
|
gap: 12px;
|
|
461
|
-
`,
|
|
461
|
+
`,Hn=n.div`
|
|
462
462
|
position: relative;
|
|
463
463
|
`,On=n("div",Dt("invalid"))`
|
|
464
464
|
display: flex;
|
|
@@ -538,7 +538,7 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,au
|
|
|
538
538
|
gap: 0;
|
|
539
539
|
cursor: text;
|
|
540
540
|
overflow: hidden;
|
|
541
|
-
`,
|
|
541
|
+
`,Kn=n.span`
|
|
542
542
|
flex: none;
|
|
543
543
|
margin-right: 8px;
|
|
544
544
|
font-family: ${t.font.sans};
|
|
@@ -550,7 +550,7 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,au
|
|
|
550
550
|
${t.media.maxWidth("mobile")} {
|
|
551
551
|
font-size: 20px;
|
|
552
552
|
}
|
|
553
|
-
`,
|
|
553
|
+
`,Zn=n.input`
|
|
554
554
|
flex: 0 1 auto;
|
|
555
555
|
min-width: 0;
|
|
556
556
|
max-width: 100%;
|
|
@@ -735,7 +735,7 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,au
|
|
|
735
735
|
flex-direction: column;
|
|
736
736
|
gap: 6px;
|
|
737
737
|
padding: 12px 16px;
|
|
738
|
-
`,
|
|
738
|
+
`,K=n.h3`
|
|
739
739
|
margin: 0;
|
|
740
740
|
font-family: ${t.font.sans};
|
|
741
741
|
font-weight: 700;
|
|
@@ -743,7 +743,7 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,au
|
|
|
743
743
|
line-height: 1.57;
|
|
744
744
|
text-transform: uppercase;
|
|
745
745
|
color: ${t.colors.text};
|
|
746
|
-
`,
|
|
746
|
+
`,Z=n.p`
|
|
747
747
|
margin: 0;
|
|
748
748
|
font-family: ${t.font.sans};
|
|
749
749
|
font-weight: 400;
|
|
@@ -753,7 +753,7 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,au
|
|
|
753
753
|
`,is=n.span`
|
|
754
754
|
font-weight: 600;
|
|
755
755
|
color: ${t.colors.accent};
|
|
756
|
-
`,
|
|
756
|
+
`,Re=n.a`
|
|
757
757
|
display: inline-flex;
|
|
758
758
|
align-items: center;
|
|
759
759
|
gap: 2px;
|
|
@@ -784,4 +784,4 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,au
|
|
|
784
784
|
clip: rect(0, 0, 0, 0);
|
|
785
785
|
white-space: nowrap;
|
|
786
786
|
border: 0;
|
|
787
|
-
`,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}){Ne({title:s("seo.names.title"),description:s("seo.names.description")});const{session:i,signIn:l}=Ie(),{data:x}=Pe(),c=x?Me(F,x):null,[d,h]=m.useState(""),[p,a]=m.useState("idle"),[u,b]=m.useState(!1),w=m.useRef(null),[j,$]=m.useState(void 0);m.useLayoutEffect(()=>{w.current&&$(w.current.offsetWidth)},[d]),m.useEffect(()=>{if(!ue(d).ok){a(d.length===0?"idle":"invalid");return}a("checking");const z=new AbortController,E=setTimeout(()=>{(async()=>{try{const g=await Jt(d,{signal:z.signal});a(g)}catch(g){if((g==null?void 0:g.name)==="AbortError")return;a("error")}})()},400);return()=>{clearTimeout(E),z.abort()}},[d]);const f=ue(d),y=f.ok&&(p==="available"||p==="error");function v(){if(y){if(!i){l();return}b(!0)}}const k=e.jsxs(e.Fragment,{children:[s("names.claim"),c!=null?e.jsxs(Yn,{children:[e.jsx(W,{}),Ae(c)]}):null]});return e.jsxs(In,{"data-testid":"names-page",children:[e.jsxs(An,{"aria-label":s("names.breadcrumbAria"),children:[e.jsx(Nn,{onClick:o,children:s("names.breadcrumbCollectibles")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(Mn,{children:s("names.breadcrumbCurrent")})]}),e.jsxs(Pn,{children:[e.jsxs(Wn,{children:[e.jsxs(Bn,{children:[e.jsx(Fn,{children:s("names.heroTitle")}),e.jsx(Ln,{children:s("names.heroSubtitle")})]}),e.jsxs(Hn,{children:[e.jsxs(Un,{children:[e.jsxs(On,{invalid:p==="taken",children:[e.jsxs(Vn,{children:[e.jsx(Zn,{"aria-hidden":!0,children:"@"}),e.jsx(Kn,{value:d,onChange:C=>h(Vt(C.target.value)),placeholder:s("names.inputPlaceholder"),"aria-label":s("names.inputAria"),autoComplete:"off",spellCheck:!1,maxLength:Q,style:{width:j!=null?`${j}px`:void 0}}),e.jsx(Dn,{ref:w,"aria-hidden":!0,children:d||s("names.inputPlaceholder")}),e.jsx(Jn,{children:s("names.suffix")})]}),d.length>0?e.jsxs(Qn,{"aria-hidden":!0,children:[d.length,"/",Q]}):null,e.jsx(Fe,{onClick:v,disabled:!y,"data-testid":"names-claim",children:k})]}),p==="taken"?e.jsxs(Gn,{role:"status","data-testid":"names-taken",children:[e.jsx(_,{name:"info",size:16,"aria-hidden":!0}),e.jsx("span",{children:s("names.taken")}),e.jsxs(qn,{href:cs(d),target:"_blank",rel:"noopener noreferrer",children:[s("names.takenMakeOffer"),e.jsx(_,{name:"external-link",size:13,"aria-hidden":!0})]})]}):null]}),e.jsx(Xn,{onClick:v,disabled:!y,children:k}),p==="checking"?e.jsx(X,{tone:"muted",role:"status","data-testid":"names-checking",children:s("names.checking")}):p==="error"?e.jsx(X,{tone:"muted",role:"status",children:s("names.checkError")}):p==="invalid"&&!f.ok&&f.reason==="too-short"?e.jsx(X,{tone:"muted",role:"status",children:s("names.tooShort",{min:We})}):null,e.jsx(rs,{role:"status","aria-live":"polite",children:p==="available"?s("names.available",{name:d}):""})]})]}),e.jsxs(es,{children:[e.jsxs(ts,{children:[e.jsx(ns,{children:s("names.whyTitle")}),e.jsx(ss,{children:s("names.whyIntro")})]}),e.jsxs(os,{children:[e.jsxs(G,{children:[e.jsx(q,{src:_n,alt:""}),e.jsxs(V,{children:[e.jsx(Z,{children:s("names.why1Title")}),e.jsx(K,{children:s("names.why1")})]})]}),e.jsxs(G,{children:[e.jsx(q,{src:Rn,alt:""}),e.jsxs(V,{children:[e.jsx(Z,{children:s("names.why2Title")}),e.jsxs(K,{children:[s("names.why2")," ",e.jsx(is,{children:s("names.why2Address")})]}),e.jsxs(Te,{href:as,target:"_blank",rel:"noopener noreferrer",children:[s("names.learnMore"),e.jsx(_,{name:"external-link","aria-hidden":!0})]})]})]}),e.jsxs(G,{children:[e.jsx(q,{src:Tn,alt:""}),e.jsxs(V,{children:[e.jsx(Z,{children:s("names.why3Title")}),e.jsx(K,{children:s("names.why3")})]})]}),e.jsxs(G,{children:[e.jsx(q,{src:zn,alt:""}),e.jsxs(V,{children:[e.jsx(Z,{children:s("names.why4Title")}),e.jsx(K,{children:s("names.why4")}),e.jsxs(Te,{href:ls,target:"_blank",rel:"noopener noreferrer",children:[s("names.learnMore"),e.jsx(_,{name:"external-link","aria-hidden":!0})]})]})]})]})]})]}),u?e.jsx(Sn,{name:d,priceCredits:c,onClose:()=>b(!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",Y=48;function Ms(){const[o]=Ve(),i=ze(),l=(o.get("q")??"").trim().toLowerCase(),x=(o.get("q")??"").trim();Ne({title:x?s("seo.collectibles.searchTitle",{query:x}):s("seo.collectibles.title"),description:s("seo.collectibles.description")});const[c,d]=m.useState("wearable"),[h,p]=m.useState(null),[a,u]=m.useState([]),[b,w]=m.useState(""),[j,$]=m.useState(""),[f,y]=m.useState("on_sale"),[v,k]=m.useState(!1),[C,z]=m.useState("newest"),[E,g]=m.useState(!1);m.useEffect(()=>{if(!E)return;const r=N=>{N.key==="Escape"&&g(!1)};document.addEventListener("keydown",r);const S=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",r),document.body.style.overflow=S}},[E]);const I=f==="on_sale",R=b&&!Number.isNaN(Number(b))?Number(b):void 0,M=j&&!Number.isNaN(Number(j))?Number(j):void 0,Le=rt(),te=h?Rt[h]:void 0,ne=(me.find(r=>r.key===C)??me[0]).server,se={category:c,rarities:a.length?a:void 0,wearableCategories:te,minPriceCredits:R,maxPriceCredits:M,search:l||void 0,sortBy:ne,isSmart:v||void 0,onSale:!0,listingType:Le?void 0:"primary"},oe={category:c,rarities:a.length?a:void 0,wearableCategories:te,search:l||void 0,sortBy:ne,isWearableSmart:v||void 0,isOnSale:f==="not_for_sale"?!1:void 0},{items:L,total:ie,isLoading:T,isPlaceholderData:A,error:re,hasNextPage:He,isFetchingNextPage:ae,fetchNextPage:Ue}=zt(I?["shop-items",se]:["catalog-items",oe],r=>I?ot({...se,first:Y,skip:r}):it({...oe,first:Y,skip:r}),{enabled:c!=="names"}),H=ie,le=T||A,Oe=T?15:Math.min(Math.max(L.length,1),Y),{data:ce,isError:De}=Pe(),Ge=r=>ce&&r.manaWei?Me(r.manaWei,ce):null,de=m.useRef(null);m.useEffect(()=>{T||A||!l||de.current===l||(de.current=l,J("Shop Searched",{query:l,result_count:H}))},[l,T,A,H]);const U=m.useRef("__init__");m.useEffect(()=>{if(T||A)return;const r=JSON.stringify({category:c,subCategory:h,rarities:a,min:R,max:M,sort:C,status:f,smart:v});if(U.current==="__init__"||U.current===r){U.current=r;return}U.current=r,J("Shop Applied Filter",{filters:{category:c,sub_category:h,rarities:a,min_price_credits:R??null,max_price_credits:M??null,status:f,smart:v,sort:C},result_count:H})},[c,h,a,R,M,C,f,v,T,A,H]);function pe(r){d(r),p(null)}function xe(r){u(S=>S.includes(r)?S.filter(N=>N!==r):[...S,r])}function qe(){d("wearable"),p(null),u([]),w(""),$(""),y("on_sale"),k(!1)}const P=[];(R!=null||M!=null)&&P.push({key:"price",label:s("filter.price"),onRemove:()=>{w(""),$("")}});for(const r of Et)a.includes(r)&&P.push({key:`rarity-${r}`,label:st(r),onRemove:()=>xe(r)});return v&&P.push({key:"smart",label:s("filter.smart"),onRemove:()=>k(!1)}),f!=="on_sale"&&P.push({key:"status",label:f==="all"?s("filter.statusAll"):s("filter.notForSale"),onRemove:()=>y("on_sale")}),e.jsxs(lt,{"data-testid":"browse",children:[c!=="names"&&e.jsxs(e.Fragment,{children:[E?e.jsx(ct,{onClick:()=>g(!1),"aria-hidden":!0}):null,e.jsxs(dt,{"data-open":E||void 0,"data-testid":"browse-sidebar",children:[e.jsxs(pt,{children:[e.jsx(xt,{children:s("assets.filters")}),e.jsx(ht,{onClick:()=>g(!1),"aria-label":s("assets.closeFilters"),children:"✕"})]}),e.jsx(ft,{children:e.jsx(mt,{category:c,subCategory:h,onCategory:pe,onSub:p,priceMin:b,priceMax:j,onPriceMin:w,onPriceMax:$,rarities:a,onToggleRarity:xe,status:f,onStatus:y,smart:v,onSmart:k})}),e.jsx(ut,{children:e.jsx(gt,{type:"button",onClick:()=>g(!1),children:s("assets.showItems")})})]})]}),e.jsx(bt,{children:c==="names"?e.jsx(ds,{onBack:()=>pe("wearable")}):e.jsxs(e.Fragment,{children:[e.jsx(_t,{sort:C,onSort:z,total:ie,loading:T||A,query:l,onOpenFilters:()=>g(!0),chips:P,onClearChips:qe}),De&&I&&L.some(r=>r.source==="legacy")?e.jsx(yt,{"data-variant":"warn",children:s("assets.marketUnavailable")}):null,re?e.jsx(It,{message:s("assets.loadError"),testId:"browse-error"}):null,!le&&L.length===0&&!re?e.jsxs(wt,{"data-testid":"browse-empty",children:[e.jsx(jt,{src:ps,alt:""}),e.jsxs(vt,{children:[e.jsx($t,{children:s("assets.empty.title")}),e.jsx(Ct,{children:x?e.jsxs(e.Fragment,{children:[s("assets.empty.searchBefore"),e.jsx("b",{children:x}),s("assets.empty.searchAfter")]}):s("assets.empty.filters")})]}),e.jsx(kt,{children:e.jsx(St,{type:"button",onClick:()=>i("/overview"),children:s("assets.empty.cta")})})]}):e.jsxs(e.Fragment,{children:[e.jsx(Gt,{"data-testid":"grid",children:le?e.jsx(fe,{count:Oe}):e.jsxs(e.Fragment,{children:[L.map(r=>{if(!I)return e.jsx(O,{item:r,mode:"view"},D(r));const S=r;if(S.source!=="legacy")return e.jsx(O,{item:r},D(r));const N=Ge(S);return N==null?e.jsx(O,{item:r,mode:"view"},D(r)):e.jsx(O,{item:{...S,priceCredits:N}},D(r))}),ae?e.jsx(fe,{count:6}):null]})}),e.jsx(Tt,{hasNextPage:He,isFetching:ae,onLoadMore:()=>void Ue()})]})]})})]})}export{Ms as Assets};
|
|
787
|
+
`,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}){Ne({title:s("seo.names.title"),description:s("seo.names.description")});const{session:i,signIn:l}=Ie(),{data:x}=Pe(),c=x?Me(F,x):null,[d,h]=m.useState(""),[p,a]=m.useState("idle"),[u,b]=m.useState(!1),w=m.useRef(null),[j,$]=m.useState(void 0);m.useLayoutEffect(()=>{w.current&&$(w.current.offsetWidth)},[d]),m.useEffect(()=>{if(!ue(d).ok){a(d.length===0?"idle":"invalid");return}a("checking");const z=new AbortController,E=setTimeout(()=>{(async()=>{try{const g=await Jt(d,{signal:z.signal});a(g)}catch(g){if((g==null?void 0:g.name)==="AbortError")return;a("error")}})()},400);return()=>{clearTimeout(E),z.abort()}},[d]);const f=ue(d),y=f.ok&&(p==="available"||p==="error");function v(){if(y){if(!i){l();return}b(!0)}}const k=e.jsxs(e.Fragment,{children:[s("names.claim"),c!=null?e.jsxs(Yn,{children:[e.jsx(W,{}),Ae(c)]}):null]});return e.jsxs(In,{"data-testid":"names-page",children:[e.jsxs(An,{"aria-label":s("names.breadcrumbAria"),children:[e.jsx(Nn,{onClick:o,children:s("names.breadcrumbCollectibles")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(Mn,{children:s("names.breadcrumbCurrent")})]}),e.jsxs(Pn,{children:[e.jsxs(Wn,{children:[e.jsxs(Bn,{children:[e.jsx(Fn,{children:s("names.heroTitle")}),e.jsx(Ln,{children:s("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=>h(Vt(C.target.value)),placeholder:s("names.inputPlaceholder"),"aria-label":s("names.inputAria"),autoComplete:"off",spellCheck:!1,maxLength:Q,style:{width:j!=null?`${j}px`:void 0}}),e.jsx(Dn,{ref:w,"aria-hidden":!0,children:d||s("names.inputPlaceholder")}),e.jsx(Jn,{children:s("names.suffix")})]}),d.length>0?e.jsxs(Qn,{"aria-hidden":!0,children:[d.length,"/",Q]}):null,e.jsx(Fe,{onClick:v,disabled:!y,"data-testid":"names-claim",children:k})]}),p==="taken"?e.jsxs(Gn,{role:"status","data-testid":"names-taken",children:[e.jsx(_,{name:"info",size:16,"aria-hidden":!0}),e.jsx("span",{children:s("names.taken")}),e.jsxs(qn,{href:cs(d),target:"_blank",rel:"noopener noreferrer",children:[s("names.takenMakeOffer"),e.jsx(_,{name:"external-link",size:13,"aria-hidden":!0})]})]}):null]}),e.jsx(Xn,{onClick:v,disabled:!y,children:k}),p==="checking"?e.jsx(X,{tone:"muted",role:"status","data-testid":"names-checking",children:s("names.checking")}):p==="error"?e.jsx(X,{tone:"muted",role:"status",children:s("names.checkError")}):p==="invalid"&&!f.ok&&f.reason==="too-short"?e.jsx(X,{tone:"muted",role:"status",children:s("names.tooShort",{min:We})}):null,e.jsx(rs,{role:"status","aria-live":"polite",children:p==="available"?s("names.available",{name:d}):""})]})]}),e.jsxs(es,{children:[e.jsxs(ts,{children:[e.jsx(ns,{children:s("names.whyTitle")}),e.jsx(ss,{children:s("names.whyIntro")})]}),e.jsxs(os,{children:[e.jsxs(G,{children:[e.jsx(q,{src:_n,alt:""}),e.jsxs(V,{children:[e.jsx(K,{children:s("names.why1Title")}),e.jsx(Z,{children:s("names.why1")})]})]}),e.jsxs(G,{children:[e.jsx(q,{src:Tn,alt:""}),e.jsxs(V,{children:[e.jsx(K,{children:s("names.why2Title")}),e.jsxs(Z,{children:[s("names.why2")," ",e.jsx(is,{children:s("names.why2Address")})]}),e.jsxs(Re,{href:as,target:"_blank",rel:"noopener noreferrer",children:[s("names.learnMore"),e.jsx(_,{name:"external-link","aria-hidden":!0})]})]})]}),e.jsxs(G,{children:[e.jsx(q,{src:Rn,alt:""}),e.jsxs(V,{children:[e.jsx(K,{children:s("names.why3Title")}),e.jsx(Z,{children:s("names.why3")})]})]}),e.jsxs(G,{children:[e.jsx(q,{src:zn,alt:""}),e.jsxs(V,{children:[e.jsx(K,{children:s("names.why4Title")}),e.jsx(Z,{children:s("names.why4")}),e.jsxs(Re,{href:ls,target:"_blank",rel:"noopener noreferrer",children:[s("names.learnMore"),e.jsx(_,{name:"external-link","aria-hidden":!0})]})]})]})]})]})]}),u?e.jsx(Sn,{name:d,priceCredits:c,onClose:()=>b(!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",Y=48;function Ms(){const[o]=Ve(),i=ze(),l=(o.get("q")??"").trim().toLowerCase(),x=(o.get("q")??"").trim();Ne({title:x?s("seo.collectibles.searchTitle",{query:x}):s("seo.collectibles.title"),description:s("seo.collectibles.description")});const[c,d]=m.useState("wearable"),[h,p]=m.useState(null),[a,u]=m.useState([]),[b,w]=m.useState(""),[j,$]=m.useState(""),[f,y]=m.useState("on_sale"),[v,k]=m.useState(!1),[C,z]=m.useState("newest"),[E,g]=m.useState(!1);m.useEffect(()=>{if(!E)return;const r=N=>{N.key==="Escape"&&g(!1)};document.addEventListener("keydown",r);const S=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",r),document.body.style.overflow=S}},[E]);const I=f==="on_sale",T=b&&!Number.isNaN(Number(b))?Number(b):void 0,M=j&&!Number.isNaN(Number(j))?Number(j):void 0,Le=rt(),te=h?Tt[h]:void 0,ne=(me.find(r=>r.key===C)??me[0]).server,se={category:c,rarities:a.length?a:void 0,wearableCategories:te,minPriceCredits:T,maxPriceCredits:M,search:l||void 0,sortBy:ne,isSmart:v||void 0,onSale:!0,listingType:Le?void 0:"primary"},oe={category:c,rarities:a.length?a:void 0,wearableCategories:te,search:l||void 0,sortBy:ne,isWearableSmart:v||void 0,isOnSale:f==="not_for_sale"?!1:void 0},{items:L,total:ie,isLoading:R,isPlaceholderData:A,error:re,hasNextPage:Ue,isFetchingNextPage:ae,fetchNextPage:He}=zt(I?["shop-items",se]:["catalog-items",oe],r=>I?ot({...se,first:Y,skip:r}):it({...oe,first:Y,skip:r}),{enabled:c!=="names"}),U=ie,le=R||A,Oe=R?15:Math.min(Math.max(L.length,1),Y),{data:ce,isError:De}=Pe(),Ge=r=>ce&&r.manaWei?Me(r.manaWei,ce):null,de=m.useRef(null);m.useEffect(()=>{R||A||!l||de.current===l||(de.current=l,J("Shop Searched",{query:l,result_count:U}))},[l,R,A,U]);const H=m.useRef("__init__");m.useEffect(()=>{if(R||A)return;const r=JSON.stringify({category:c,subCategory:h,rarities:a,min:T,max:M,sort:C,status:f,smart:v});if(H.current==="__init__"||H.current===r){H.current=r;return}H.current=r,J("Shop Applied Filter",{filters:{category:c,sub_category:h,rarities:a,min_price_credits:T??null,max_price_credits:M??null,status:f,smart:v,sort:C},result_count:U})},[c,h,a,T,M,C,f,v,R,A,U]);function pe(r){d(r),p(null)}function xe(r){u(S=>S.includes(r)?S.filter(N=>N!==r):[...S,r])}function qe(){d("wearable"),p(null),u([]),w(""),$(""),y("on_sale"),k(!1)}const P=[];(T!=null||M!=null)&&P.push({key:"price",label:s("filter.price"),onRemove:()=>{w(""),$("")}});for(const r of Et)a.includes(r)&&P.push({key:`rarity-${r}`,label:st(r),onRemove:()=>xe(r)});return v&&P.push({key:"smart",label:s("filter.smart"),onRemove:()=>k(!1)}),f!=="on_sale"&&P.push({key:"status",label:f==="all"?s("filter.statusAll"):s("filter.notForSale"),onRemove:()=>y("on_sale")}),e.jsxs(lt,{"data-testid":"browse",children:[c!=="names"&&e.jsxs(e.Fragment,{children:[E?e.jsx(ct,{onClick:()=>g(!1),"aria-hidden":!0}):null,e.jsxs(dt,{"data-open":E||void 0,"data-testid":"browse-sidebar",children:[e.jsxs(pt,{children:[e.jsx(xt,{children:s("assets.filters")}),e.jsx(ht,{onClick:()=>g(!1),"aria-label":s("assets.closeFilters"),children:"✕"})]}),e.jsx(ft,{children:e.jsx(mt,{category:c,subCategory:h,onCategory:pe,onSub:p,priceMin:b,priceMax:j,onPriceMin:w,onPriceMax:$,rarities:a,onToggleRarity:xe,status:f,onStatus:y,smart:v,onSmart:k})}),e.jsx(ut,{children:e.jsx(gt,{type:"button",onClick:()=>g(!1),children:s("assets.showItems")})})]})]}),e.jsx(bt,{children:c==="names"?e.jsx(ds,{onBack:()=>pe("wearable")}):e.jsxs(e.Fragment,{children:[e.jsx(_t,{sort:C,onSort:z,total:ie,loading:R||A,query:l,onOpenFilters:()=>g(!0),chips:P,onClearChips:qe}),De&&I&&L.some(r=>r.source==="legacy")?e.jsx(yt,{"data-variant":"warn",children:s("assets.marketUnavailable")}):null,re?e.jsx(It,{message:s("assets.loadError"),testId:"browse-error"}):null,!le&&L.length===0&&!re?e.jsxs(wt,{"data-testid":"browse-empty",children:[e.jsx(jt,{src:ps,alt:""}),e.jsxs(vt,{children:[e.jsx($t,{children:s("assets.empty.title")}),e.jsx(Ct,{children:x?e.jsxs(e.Fragment,{children:[s("assets.empty.searchBefore"),e.jsx("b",{children:x}),s("assets.empty.searchAfter")]}):s("assets.empty.filters")})]}),e.jsx(kt,{children:e.jsx(St,{type:"button",onClick:()=>i("/overview"),children:s("assets.empty.cta")})})]}):e.jsxs(e.Fragment,{children:[e.jsx(Gt,{"data-testid":"grid",children:le?e.jsx(fe,{count:Oe}):e.jsxs(e.Fragment,{children:[L.map(r=>{if(!I)return e.jsx(O,{item:r,mode:"view"},D(r));const S=r;if(S.source!=="legacy")return e.jsx(O,{item:r},D(r));const N=Ge(S);return N==null?e.jsx(O,{item:r,mode:"view"},D(r)):e.jsx(O,{item:{...S,priceCredits:N}},D(r))}),ae?e.jsx(fe,{count:6}):null]})}),e.jsx(Rt,{hasNextPage:Ue,isFetching:ae,onLoadMore:()=>void He()})]})]})})]})}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-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`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 12px;
|
|
@@ -0,0 +1,186 @@
|
|
|
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`
|
|
2
|
+
to { transform: rotate(360deg); }
|
|
3
|
+
`,st=D`
|
|
4
|
+
to { background-position: -200% 0; }
|
|
5
|
+
`,rt=n.section`
|
|
6
|
+
width: 100%;
|
|
7
|
+
min-width: 0;
|
|
8
|
+
/* Centre heading, intro and rows as ONE block, so the list isn't parked against the left edge of a
|
|
9
|
+
wide page (same treatment as the Activity feed). */
|
|
10
|
+
max-width: 760px;
|
|
11
|
+
margin-inline: auto;
|
|
12
|
+
`,ct=n.div`
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
gap: 6px;
|
|
16
|
+
margin-bottom: 24px;
|
|
17
|
+
`,lt=n.h1`
|
|
18
|
+
font-family: ${a.font.sans};
|
|
19
|
+
margin: 0;
|
|
20
|
+
`,dt=n.p`
|
|
21
|
+
color: ${a.colors.muted};
|
|
22
|
+
font-size: 14px;
|
|
23
|
+
margin: 0;
|
|
24
|
+
max-width: 60ch;
|
|
25
|
+
`,k=n.div`
|
|
26
|
+
margin-bottom: 28px;
|
|
27
|
+
`,C=n.h2`
|
|
28
|
+
font-family: ${a.font.sans};
|
|
29
|
+
font-size: 15px;
|
|
30
|
+
font-weight: 700;
|
|
31
|
+
color: ${a.colors.text};
|
|
32
|
+
margin: 0 0 10px;
|
|
33
|
+
`,x=n.div`
|
|
34
|
+
display: flex;
|
|
35
|
+
flex-direction: column;
|
|
36
|
+
gap: 12px;
|
|
37
|
+
`,ut=n.div`
|
|
38
|
+
display: grid;
|
|
39
|
+
grid-template-columns: 44px 1fr auto;
|
|
40
|
+
align-items: center;
|
|
41
|
+
gap: 14px;
|
|
42
|
+
padding: 14px 18px;
|
|
43
|
+
background: ${a.colors.white};
|
|
44
|
+
border: 1px solid ${a.colors.line};
|
|
45
|
+
border-radius: 16px;
|
|
46
|
+
|
|
47
|
+
${a.media.maxWidth("mobile")} {
|
|
48
|
+
grid-template-columns: 44px 1fr;
|
|
49
|
+
grid-row-gap: 10px;
|
|
50
|
+
}
|
|
51
|
+
`,T=n.div`
|
|
52
|
+
height: 74px;
|
|
53
|
+
border-radius: 16px;
|
|
54
|
+
background: linear-gradient(100deg, #efeef2 30%, #e2e0e7 50%, #efeef2 70%);
|
|
55
|
+
background-size: 200% 100%;
|
|
56
|
+
animation: ${st} 1.4s infinite linear;
|
|
57
|
+
|
|
58
|
+
@media (prefers-reduced-motion: reduce) {
|
|
59
|
+
animation: none;
|
|
60
|
+
}
|
|
61
|
+
`,ht=n.img`
|
|
62
|
+
width: 22px !important;
|
|
63
|
+
height: 22px !important;
|
|
64
|
+
object-fit: contain;
|
|
65
|
+
`,pt=n.div`
|
|
66
|
+
width: 44px;
|
|
67
|
+
height: 44px;
|
|
68
|
+
border-radius: 10px;
|
|
69
|
+
background: ${a.colors.media};
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
color: ${a.colors.muted2};
|
|
75
|
+
|
|
76
|
+
img {
|
|
77
|
+
width: 100%;
|
|
78
|
+
height: 100%;
|
|
79
|
+
object-fit: contain;
|
|
80
|
+
}
|
|
81
|
+
`,mt=n.div`
|
|
82
|
+
min-width: 0;
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
gap: 3px;
|
|
86
|
+
`,gt=n.span`
|
|
87
|
+
font-weight: 700;
|
|
88
|
+
color: ${a.colors.text};
|
|
89
|
+
white-space: nowrap;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
text-overflow: ellipsis;
|
|
92
|
+
`,xt=n.span`
|
|
93
|
+
font-size: 13px;
|
|
94
|
+
color: ${a.colors.muted};
|
|
95
|
+
`,ft=n.span`
|
|
96
|
+
font-size: 12px;
|
|
97
|
+
font-weight: 700;
|
|
98
|
+
color: ${a.colors.muted2};
|
|
99
|
+
|
|
100
|
+
&[data-active='true'] {
|
|
101
|
+
color: ${a.colors.okStrong};
|
|
102
|
+
}
|
|
103
|
+
`,yt=n.div`
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
gap: 10px;
|
|
107
|
+
justify-self: end;
|
|
108
|
+
|
|
109
|
+
${a.media.maxWidth("mobile")} {
|
|
110
|
+
grid-column: 1 / -1;
|
|
111
|
+
justify-self: start;
|
|
112
|
+
}
|
|
113
|
+
`,zt=n.button`
|
|
114
|
+
position: relative;
|
|
115
|
+
width: 46px;
|
|
116
|
+
height: 26px;
|
|
117
|
+
flex: 0 0 auto;
|
|
118
|
+
border-radius: ${a.radius.pill};
|
|
119
|
+
border: none;
|
|
120
|
+
background: ${a.colors.gray4};
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
transition: background 0.15s;
|
|
123
|
+
padding: 0;
|
|
124
|
+
|
|
125
|
+
&::after {
|
|
126
|
+
content: '';
|
|
127
|
+
position: absolute;
|
|
128
|
+
top: 3px;
|
|
129
|
+
left: 3px;
|
|
130
|
+
width: 20px;
|
|
131
|
+
height: 20px;
|
|
132
|
+
border-radius: 50%;
|
|
133
|
+
background: ${a.colors.white};
|
|
134
|
+
transition: transform 0.15s;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&[data-active='true'] {
|
|
138
|
+
background: ${a.colors.accent};
|
|
139
|
+
}
|
|
140
|
+
&[data-active='true']::after {
|
|
141
|
+
transform: translateX(20px);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&:disabled {
|
|
145
|
+
cursor: default;
|
|
146
|
+
opacity: 0.6;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&:focus-visible {
|
|
150
|
+
outline: 2px solid ${a.colors.accent};
|
|
151
|
+
outline-offset: 2px;
|
|
152
|
+
}
|
|
153
|
+
`,bt=n.span`
|
|
154
|
+
width: 16px;
|
|
155
|
+
height: 16px;
|
|
156
|
+
border-radius: 50%;
|
|
157
|
+
border: 2px solid ${a.colors.gray4};
|
|
158
|
+
border-top-color: ${a.colors.accent};
|
|
159
|
+
animation: ${nt} 0.7s linear infinite;
|
|
160
|
+
|
|
161
|
+
@media (prefers-reduced-motion: reduce) {
|
|
162
|
+
animation: none;
|
|
163
|
+
}
|
|
164
|
+
`,I=n.p`
|
|
165
|
+
color: ${a.colors.muted};
|
|
166
|
+
font-size: 14px;
|
|
167
|
+
margin: 0;
|
|
168
|
+
`,jt=n.p`
|
|
169
|
+
color: ${a.colors.muted};
|
|
170
|
+
font-size: 14px;
|
|
171
|
+
margin: 0 0 12px;
|
|
172
|
+
`,S=n.div`
|
|
173
|
+
display: flex;
|
|
174
|
+
flex-direction: column;
|
|
175
|
+
align-items: center;
|
|
176
|
+
gap: 8px;
|
|
177
|
+
text-align: center;
|
|
178
|
+
padding: 90px 20px;
|
|
179
|
+
min-height: 50vh;
|
|
180
|
+
`,L=n.p`
|
|
181
|
+
font-size: 22px;
|
|
182
|
+
font-weight: 700;
|
|
183
|
+
margin: 6px 0 0;
|
|
184
|
+
`,M=n(G)`
|
|
185
|
+
margin-top: 12px;
|
|
186
|
+
`;function j({descriptor:t,owner:s,signer:r,name:o,description:c,image:l,icon:p}){const v=K(),[h,y]=F.useState(!1),{data:u,isLoading:m,refetch:d}=w({queryKey:["authorization",t.id,s],queryFn:()=>it(t,s),staleTime:3e4});async function g(){if(h||m)return;const z=!u;y(!0);try{await tt({auth:t,signer:r,active:z}),await d(),v.setQueryData(["authorization",t.id,s],z),A.success(z?e("authorizations.toastActivated",{name:o}):e("authorizations.toastDeactivated",{name:o}))}catch($){X($,{flow:"authorizations",step:z?"grant":"revoke"}),A.error(at($,e("authorizations.errorGeneric")))}finally{y(!1)}}const q=m?e("authorizations.checking"):u?e("authorizations.active"):e("authorizations.inactive");return i.jsxs(ut,{"data-testid":`authorization-${t.id}`,"data-active":!!u,children:[i.jsx(pt,{children:l?i.jsx("img",{src:l,alt:""}):p}),i.jsxs(mt,{children:[i.jsx(gt,{title:o,children:o}),i.jsx(xt,{children:c})]}),i.jsxs(yt,{children:[i.jsx(ft,{"data-active":!!u,children:q}),h?i.jsx(bt,{"aria-label":e("authorizations.working")}):i.jsx(zt,{type:"button","data-testid":`authorization-toggle-${t.id}`,"data-active":!!u,role:"switch","aria-checked":!!u,"aria-label":u?e("authorizations.deactivateAria",{name:o}):e("authorizations.activateAria",{name:o}),disabled:m,onClick:()=>void g()})]})]})}const f=500,R=10,wt=f*R;async function N(t,s){const r=await E(t,{category:s,first:f}),o=Math.min(Math.ceil(r.total/f),R),c=await Promise.all(Array.from({length:Math.max(0,o-1)},(l,p)=>E(t,{category:s,first:f,skip:(p+1)*f})));return{assets:[...r.assets,...c.flatMap(l=>l.assets)],truncated:r.total>wt}}function vt(t){return w({queryKey:["owned-collections",t],enabled:!!t,staleTime:6e4,queryFn:async()=>{const[s,r]=await Promise.all([N(t,"wearable"),N(t,"emote")]),o=new Map;for(const c of[...s.assets,...r.assets]){const l=c.contractAddress.toLowerCase();o.has(l)||o.set(l,c)}return{collections:[...o.values()],truncated:s.truncated||r.truncated,scanned:s.assets.length+r.assets.length}}})}function kt(t){return w({queryKey:["contract-registry"],enabled:t,staleTime:1/0,gcTime:1/0,queryFn:Z})}function Ct(t,s){const r=s==null?void 0:s.get(t.toLowerCase());if(r)return r;const o=H(t);return o===t?e("authorizations.collectionFallback"):o}function $t(t,s){return w({queryKey:["creator-collections",t],enabled:!!t&&!!s,staleTime:6e4,queryFn:async()=>{const r=await et(t,s),o=new Map;for(const c of r){const l=c.contractAddress.toLowerCase();o.has(l)||o.set(l,c)}return[...o.values()]}})}function _t(){P({title:e("authorizations.title"),noindex:!0});const{session:t,signIn:s}=W(),r=Q.chainId,o=O(t==null?void 0:t.providerType),{data:c,isLoading:l}=vt(o?t==null?void 0:t.address:void 0),{data:p,isLoading:v}=kt(!!o&&!!(t!=null&&t.address)),{data:h,isLoading:y}=$t(o?t==null?void 0:t.address:void 0,o?t==null?void 0:t.identity:void 0);if(!t)return i.jsxs(S,{children:[i.jsx(b,{name:"info",size:40,color:a.colors.muted2}),i.jsx(L,{children:e("authorizations.signInTitle")}),i.jsx("p",{className:"muted",children:e("authorizations.signInBody")}),i.jsx(M,{variant:"purple",onClick:()=>s(),children:e("storeSettings.signIn")})]});if(!o)return i.jsxs(S,{children:[i.jsx(b,{name:"check",size:40,color:a.colors.ok}),i.jsx(L,{children:e("authorizations.managedTitle")}),i.jsx("p",{className:"muted",children:e("authorizations.managedBody")}),i.jsx(M,{as:_,to:"/assets",variant:"purple",children:e("authorizations.managedCta")})]});const u=J(r),m=U(r);return i.jsxs(rt,{children:[i.jsxs(ct,{children:[i.jsx(lt,{children:e("authorizations.title")}),i.jsx(dt,{children:e("authorizations.intro")})]}),i.jsxs(k,{children:[i.jsx(C,{children:e("authorizations.buyingTitle")}),i.jsxs(x,{children:[i.jsx(j,{descriptor:u,owner:t.address,signer:t.signer,name:e("authorizations.creditsName"),description:e("authorizations.creditsDesc"),icon:i.jsx(B,{className:"ccy-mark"})}),i.jsx(j,{descriptor:m,owner:t.address,signer:t.signer,name:e("authorizations.manaName"),description:e("authorizations.manaDesc"),icon:i.jsx(ht,{src:ot,alt:"","aria-hidden":!0})})]})]}),i.jsxs(k,{children:[i.jsx(C,{children:e("authorizations.sellingTitle")}),c!=null&&c.truncated?i.jsx(jt,{"data-testid":"authorizations-selling-truncated",children:e("authorizations.sellingTruncated",{count:c.scanned})}):null,l||v?i.jsx(x,{"aria-busy":"true","aria-label":e("authorizations.checking"),children:Array.from({length:3}).map((d,g)=>i.jsx(T,{"aria-hidden":!0},g))}):c&&c.collections.length>0?i.jsx(x,{children:c.collections.map(d=>i.jsx(j,{descriptor:V(d.contractAddress,r),owner:t.address,signer:t.signer,name:Ct(d.contractAddress,p),description:e("authorizations.sellingDesc"),image:d.image,icon:i.jsx(b,{name:"pen",size:18})},d.contractAddress))}):i.jsx(I,{children:e("authorizations.sellingEmpty")})]}),i.jsxs(k,{children:[i.jsx(C,{children:e("authorizations.mintingTitle")}),y?i.jsx(x,{"aria-busy":"true","aria-label":e("authorizations.checking"),children:Array.from({length:3}).map((d,g)=>i.jsx(T,{"aria-hidden":!0},g))}):h&&h.length>0?i.jsx(x,{children:h.map(d=>i.jsx(j,{descriptor:Y(d.contractAddress,r),owner:t.address,signer:t.signer,name:d.name||e("authorizations.collectionFallback"),description:e("authorizations.mintingDesc"),icon:i.jsx(b,{name:"pen",size:18})},d.contractAddress))}):i.jsx(I,{children:e("authorizations.mintingEmpty")})]})]})}export{_t as Authorizations};
|
|
@@ -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,
|
|
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`
|
|
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-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`
|
|
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
|
|
@@ -658,13 +658,13 @@ import{j as e,L as Se,r as P,b as ea,a as ta}from"./react-vyZjIDcS.js";import{t
|
|
|
658
658
|
opacity: 0.6;
|
|
659
659
|
cursor: default;
|
|
660
660
|
}
|
|
661
|
-
`,
|
|
661
|
+
`,Rt=Ue`
|
|
662
662
|
margin: 0;
|
|
663
663
|
font-size: 13px;
|
|
664
664
|
`,Ce=i.p`
|
|
665
|
-
${
|
|
665
|
+
${Rt};
|
|
666
666
|
`,In=i(Ss)`
|
|
667
|
-
${
|
|
667
|
+
${Rt};
|
|
668
668
|
`,Pn=i.div`
|
|
669
669
|
position: relative;
|
|
670
670
|
/* Takes the leftover height so its white ::before covers it — see .page[data-route="/cart"]. */
|
|
@@ -692,4 +692,4 @@ import{j as e,L as Se,r as P,b as ea,a as ta}from"./react-vyZjIDcS.js";import{t
|
|
|
692
692
|
& section {
|
|
693
693
|
margin-top: 0;
|
|
694
694
|
}
|
|
695
|
-
`;function Ke(o){if(ks(o))return s("errors.rejected");const l=(o.message??"").toLowerCase();return l.includes("insufficient")?s("cart.error.insufficient",{currency:ma.name}):l.includes("no active listing")||l.includes("your own listing")?s("cart.error.listingChanged"):s("marketCheckout.error.generic")}const zn=12e4;function An(o){const l=[];return o.unavailable.length&&l.push(s("cart.drop.unavailable",{count:o.unavailable.length})),o.own.length&&l.push(s("cart.drop.own",{count:o.own.length})),s("cart.drop.removed",{items:l.join(` ${s("cart.drop.and")} `)})}const Ne=o=>o.reduce((l,I)=>l+I.priceCredits*I.quantity,0),je=o=>o.flatMap(l=>Array.from({length:l.quantity},()=>({...l,quantity:1})));function Jn(){na({title:s("nav.cart"),noindex:!0});const o=Q(t=>t.items),l=Q(t=>t.remove),I=Q(t=>t.increment),z=Q(t=>t.decrement),W=Q(t=>t.clear),D=Q(t=>t.restore),Y=Q(t=>t.setFittingOpen),A=dt(t=>t.items),ne=dt(t=>t.toggle),{session:n,signIn:L}=ia(),ue=vs().packs.slice(0,ws);P.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const Rt=o.some(t=>t.category!=="emote"),{data:Me}=ra({queryKey:["upsell-listings"],queryFn:()=>ya({first:40}),staleTime:6e4}),{data:$}=oa(n),b=ca(),ee=ea(),{state:J}=ta(),[_t,ie]=P.useState(null),[Qe,he]=P.useState(null),[Wt,B]=P.useState(!1),[R,O]=P.useState(null),He=P.useRef(0),[p,j]=P.useState(null),{data:pe}=da(n),{data:re}=cs(!0),[Te,Oe]=P.useState(""),oe=P.useRef(null),Ve=la(o),Ge=t=>lt(Ve[t.id]),Ie=o.filter(Ge),Pe=o.length>0&&Ie.length===0,Ft=Ie.reduce((t,a)=>t+a.priceCredits*a.quantity,0),Lt=o.reduce((t,a)=>t+a.quantity,0),Kt=Ie.reduce((t,a)=>t+a.quantity,0),De=R?R.liveTotalCredits:Ft,Nt=new Set(o.map(t=>t.id)),Ye=((Me==null?void 0:Me.items)??[]).filter(t=>!Nt.has(t.id)).slice(0,12),Ut=new Map(R==null?void 0:R.buyable.map(t=>[t.item.id,t])),ge=($==null?void 0:$.credits)??0,ze=De*10,Qt=re?Ct(ze,re):0n,xe=Fe({priceCents:ze,priceManaWei:Qt,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n}),Ht=t=>t.some(a=>a.acquisition==="store"),Ae=t=>t.flatMap(a=>a.acquisition==="trade"?[a]:[]),Ot=ga,Vt=t=>xa(t.contractAddress,String(t.itemId));function me(t){t(),O(null),he(null),ie(null)}function Gt(){j(null),B(!1)}function Je(t){const a=Ne(t),d=Math.max(0,a-ge),c=ue.find(u=>u.credits>=d)??ue[ue.length-1];Oe(c.id),G("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:a,credits_balance:ge,shortfall:d}),j({phase:"nofunds",lines:t.map(u=>({item:u.item,priceCredits:u.priceCredits,quantity:u.quantity})),shortfall:d}),B(!1)}async function Ee(t){if(!n||t.length===0)return;const a=je(t),d=a.map(y=>({...y.item,priceCredits:y.priceCredits})),c=t.map(y=>({...y.item,priceCredits:y.priceCredits,quantity:y.quantity})),u=[];let h="authorize";const w=new Set,S=new Set,_=new Set,E=[];let q=!1;j({phase:"processing",stage:"reserving",step:1,total:a.length});try{const y=[];for(let m=0;m<a.length;m++){const x=a[m];j({phase:"processing",stage:"reserving",step:m+1,total:a.length});try{const M=x.acquisition==="trade"?x.trade.id:void 0,C=x.item.contractAddress&&x.item.itemId!=null?{contractAddress:x.item.contractAddress,itemId:String(x.item.itemId)}:void 0,{credit:U,maxCreditedValue:X}=await pt(n.identity,x.usdCents,M,C);u.push({salt:U.id,itemId:x.item.id}),y.push(x.acquisition==="store"?{kind:"store",item:{collection:x.item.contractAddress,itemId:String(x.item.itemId),priceWei:x.priceWei},credits:[U],maxCreditedValue:X,chainId:x.item.chainId}:{kind:"trade",trade:x.trade,credits:[U],maxCreditedValue:X})}catch(M){if($s(M)){if(u.length){try{await _e(n.identity,u.map(C=>C.salt))}catch(C){ae(C,{flow:"cart_checkout",step:"release"})}b.invalidateQueries({queryKey:["usd-balance"]})}Je(t);return}throw M}}h="submit";const g=ms(y).length,k=m=>g>1?{current:m,total:g}:void 0,F=(m,x)=>j({phase:"processing",stage:m,step:a.length,total:a.length,signatures:k(x)}),K=m=>m<g?F("awaiting-signature",m+1):F("settling",g);F("awaiting-signature",1);let f=[];const v=y.some(m=>m.kind==="store"),N=y.flatMap(m=>m.kind==="trade"?[m]:[]);if(ls()&&!v)try{const m=new Map;f=await fs({purchases:N,buyer:n.address,signer:n.signer,onSigned:()=>K(g),onBroadcast:({txHash:C,salts:U})=>{m.set(C,U),U.forEach(X=>w.add(X))}});const x=await Promise.allSettled(f.map(C=>ys(C)));x.forEach((C,U)=>{const X=m.get(f[U])??[];C.status==="fulfilled"?(X.forEach(Re=>S.add(Re)),E.push(f[U])):C.reason instanceof vt||X.forEach(Re=>_.add(Re))});const M=x.flatMap(C=>C.status==="rejected"?[C.reason]:[]);if(M.length&&!M.some(C=>C instanceof vt))throw M[0];q=!0}catch(m){if(!(m instanceof bs))throw m;f=await Le({purchases:y,buyer:n.address,signer:n.signer,onSigned:K,onBroadcast:({salts:x})=>x.forEach(M=>w.add(M)),onSettled:({txHash:x,salts:M})=>{M.forEach(C=>S.add(C)),E.push(x)},onReverted:({salts:x})=>x.forEach(M=>_.add(M))})}else f=await Le({purchases:y,buyer:n.address,signer:n.signer,onSigned:K,onBroadcast:({salts:m})=>m.forEach(x=>w.add(x)),onSettled:({txHash:m,salts:x})=>{x.forEach(M=>S.add(M)),E.push(m)},onReverted:({salts:m})=>m.forEach(x=>_.add(x))});t.forEach(m=>l(m.item.id)),O(null),G("Shop Completed Purchase",{...ye(d),payment_type:"credits",no_crypto_step:q,transaction_hash:f[0]??null}),bt(b);const ce=oe.current;oe.current=null,j(null),B(!1);const Be={items:c,txHash:f[0]??void 0,txHashes:f,settled:!0,...ce?{creditsAdded:ce}:{}};ee("/success",{state:Be,replace:!0})}catch(y){be(y)||ae(y,{flow:"cart_checkout",step:h,cart_size:t.length});const g=new Set([...w].filter(v=>!_.has(v))),{toRelease:k,boughtItemIds:F}=wt({reservations:u,spent:g,settled:S}),K=d.filter(v=>F.includes(v.id)),f=d.filter(v=>!F.includes(v.id));if(G(be(y)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:h,error_code:gt(y),value_usd:ut(f.reduce((v,N)=>v+N.priceCredits,0)),cart_size:a.length,partial:K.length>0}),k.length)try{await _e(n.identity,k)}catch(v){ae(v,{flow:"cart_checkout",step:"release"})}if(b.invalidateQueries({queryKey:["usd-balance"]}),K.length>0){F.forEach(v=>l(v)),O(null),bt(b),G("Shop Completed Purchase",{...ye(K),payment_type:"credits",no_crypto_step:q,transaction_hash:E[0]??null,partial:!0}),j({phase:"error",message:s("cart.error.partiallyBought")}),B(!1);return}j({phase:"error",message:Ke(y)})}}function Xe(t,a){b.invalidateQueries({queryKey:["usd-balance"]}),b.invalidateQueries({queryKey:["detail-trade"]}),b.invalidateQueries({queryKey:["shop-item"]}),b.invalidateQueries({queryKey:["owned-token"]}),b.invalidateQueries({queryKey:["public-token"]}),b.invalidateQueries({queryKey:["item-resales"]}),b.invalidateQueries({queryKey:["shop-items"]}),b.invalidateQueries({queryKey:["catalog-items"]}),b.invalidateQueries({queryKey:["my-assets"]}),b.invalidateQueries({queryKey:["purchases"]}),b.invalidateQueries({queryKey:["owned-item-count"]}),b.invalidateQueries({queryKey:["overview-listings"]}),b.invalidateQueries({queryKey:["upsell-listings"]});const d=oe.current;oe.current=null,j(null),B(!1);const c={items:t,txHash:a[0]??void 0,txHashes:a,settled:!0,...d?{creditsAdded:d}:{}};ee("/success",{state:c,replace:!0})}function Ze(t,a){be(t)||ae(t,{flow:a,step:"submit"}),G(be(t)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:gt(t)}),j({phase:"error",message:Ke(t)}),B(!1)}async function Dt(t,a){const d=ve(We.MANAToken,a),c=ve(We.CreditsManager,a);await gs({auth:{kind:xs.Allowance,contractAddress:d.address,spenderAddress:c.address,chainId:a},signer:t})}async function et(){if(re)return re;try{return await b.fetchQuery({queryKey:["mana-rate",ht.chainId],queryFn:()=>ds(ht.chainId),staleTime:6e4})}catch{return}}async function Yt(t){const a=je(t).reduce((h,w)=>h+w.usdCents,0),c=(pe??0n)>0n?await et():re,u=c?Ct(a,c):0n;return{totalCents:a,manaWei:u}}async function tt(t,a){const d=Ne(t),{totalCents:c,manaWei:u}=await Yt(t),h=Fe({priceCents:c,priceManaWei:u,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n}),w=Ht(t)?{...h,options:h.options.filter(S=>S.method==="credits")}:h;if(a&&w.options.some(S=>S.method===a)){if(a==="credits"){Ee(t);return}const{spender:S,chainId:_}=at(a,t);await st(S,_,()=>a==="mana"?void nt(t):void it(t,c,u));return}if(w.options.some(S=>S.method==="mana"||S.method==="combined")){j({phase:"choose",lines:t,totalCents:c,manaWei:u}),B(!1);return}if($!=null&&$.credits<d){Je(t);return}Ee(t)}function Jt(t){return Fe({priceCents:t.totalCents,priceManaWei:t.manaWei,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n})}const[qe,fe]=P.useState(null);function at(t,a){const d=Ae(a)[0].trade;return{spender:t==="mana"?ve(fa(d.contract),d.chainId).address:ve(We.CreditsManager,d.chainId).address,chainId:d.chainId}}async function st(t,a,d){const c=us(a,t),u=n?await hs(c,n.address).catch(()=>!0):!0;if(ps(n==null?void 0:n.providerType,u)){B(!1),fe({auth:c,run:d});return}d()}function Xt(t){if((p==null?void 0:p.phase)!=="choose")return;const{lines:a,totalCents:d,manaWei:c}=p;if(t==="credits"){Ee(a);return}const{spender:u,chainId:h}=at(t,a);st(u,h,()=>t==="mana"?void nt(a):void it(a,d,c))}async function nt(t){if(!n||t.length===0)return;const a=je(t),d=a.map(h=>({...h.item,priceCredits:h.priceCredits})),c=t.map(h=>({...h.item,priceCredits:h.priceCredits,quantity:h.quantity})),u=()=>j({phase:"processing",stage:"settling",step:a.length,total:a.length});j({phase:"processing",stage:"awaiting-signature",step:a.length,total:a.length});try{const h=await is({trades:Ae(a).map(w=>w.trade),buyer:n.address,signer:n.signer,onSigned:u});t.forEach(w=>l(w.item.id)),O(null),G("Shop Completed Purchase",{...ye(d),payment_type:"mana",transaction_hash:h[0]??null}),b.invalidateQueries({queryKey:["mana-balance"]}),Xe(c,h)}catch(h){Ze(h,"buy_cart_mana")}}async function it(t,a,d){if(!n||t.length===0)return;const c=je(t),u=c.map(g=>({...g.item,priceCredits:g.priceCredits})),h=t.map(g=>({...g.item,priceCredits:g.priceCredits,quantity:g.quantity})),w=rs(c.map(g=>g.usdCents),($==null?void 0:$.balanceCents)??0),S=w.reduce((g,k)=>g+k,0),_=os(Math.max(0,a-S),a,d),E=[],q=new Set,y=new Set;j({phase:"processing",stage:"reserving",step:1,total:c.length});try{const g=Ae(c),k=[];for(let f=0;f<g.length;f++){const v=w[f];if(v<=0)continue;j({phase:"processing",stage:"reserving",step:f+1,total:g.length});const N=g[f].item,{credit:ce,maxCreditedValue:Be}=await pt(n.identity,v,g[f].trade.id,N.contractAddress&&N.itemId!=null?{contractAddress:N.contractAddress,itemId:String(N.itemId)}:void 0);E.push({salt:ce.id,itemId:N.id}),k.push({kind:"trade",trade:g[f].trade,credits:[ce],maxCreditedValue:Be})}g.forEach((f,v)=>{w[v]<=0&&k.push({kind:"trade",trade:f.trade,credits:[],maxCreditedValue:"0"})}),k[0]={...k[0],maxCreditedValue:(BigInt(k[0].maxCreditedValue)+_).toString()},await Dt(n.signer,g[0].trade.chainId);const F=()=>j({phase:"processing",stage:"settling",step:c.length,total:c.length});j({phase:"processing",stage:"awaiting-signature",step:c.length,total:c.length});const K=await Le({purchases:k,buyer:n.address,signer:n.signer,onSigned:F,onBroadcast:({salts:f})=>f.forEach(v=>q.add(v)),onReverted:({salts:f})=>f.forEach(v=>y.add(v))});t.forEach(f=>l(f.item.id)),O(null),G("Shop Completed Purchase",{...ye(u),payment_type:"credits_and_mana",transaction_hash:K[0]??null}),b.invalidateQueries({queryKey:["mana-balance"]}),Xe(h,K)}catch(g){const{toRelease:k}=wt({reservations:E,spent:new Set([...q].filter(F=>!y.has(F))),settled:new Set});k.length&&_e(n.identity,k).catch(()=>{}),E.length&&b.invalidateQueries({queryKey:["usd-balance"]}),Ze(g,"buy_cart_combined")}}async function te(t){if(!n){yt({type:"cart-checkout"}),L();return}const a=Q.getState().items.filter(Ge);if(a.length===0)return;ie(null),he(null),B(!0);const d=a.reduce((c,u)=>c+u.priceCredits*u.quantity,0);G("Shop Started Checkout",{cart_size:a.length,cart_value_credits:d,cart_value_usd:ut(d),has_sufficient_credits:ge>=d});try{const c=await Cs(a,n.address,Ot,await et(),Vt),u=[...c.unavailable,...c.own];if(u.length&&(u.forEach(h=>l(h.id)),he(An(c))),c.buyable.length===0){ie(s("cart.error.noneAvailable")),O(null);return}if(c.orderChanged){O(c),He.current=Date.now();return}await tt(c.buyable,t)}catch(c){ae(c,{flow:"cart_checkout",step:"review",cart_size:a.length}),ie(Ke(c))}finally{B(!1)}}async function rt(){if(R){if(!n){yt({type:"cart-checkout"}),L();return}if(Date.now()-He.current>zn){O(null),he(null),await te();return}ie(null),tt(R.buyable)}}async function Zt(){if(Te){try{sessionStorage.setItem(we,JSON.stringify(Q.getState().items))}catch{}B(!0);try{const t=await js(Te,n?{address:n.address,identity:n.identity}:void 0);if(t.url){window.location.href=t.url;return}ee("/credits")}catch(t){try{sessionStorage.removeItem(we)}catch{}ae(t,{flow:"cart_buy_credits"}),j({phase:"error",message:s("buyModal.error.creditsCheckout")})}finally{B(!1)}}}const ot=P.useRef(!1);P.useEffect(()=>{if(!n||ot.current||!ts("cart-checkout"))return;ot.current=!0;const t=setTimeout(()=>void te(),0);return()=>clearTimeout(t)},[n]);const ct=P.useRef(!1);P.useEffect(()=>{if(!(J!=null&&J.resumeCheckout)||ct.current)return;ct.current=!0,oe.current=J.creditsAdded??null;try{const a=sessionStorage.getItem(we);if(a){sessionStorage.removeItem(we);const d=JSON.parse(a);Array.isArray(d)&&d.length&&D(d)}}catch{}b.invalidateQueries({queryKey:["usd-balance"]});const t=setTimeout(()=>void te(),0);return()=>clearTimeout(t)},[J==null?void 0:J.resumeCheckout]);const V=Wt||(p==null?void 0:p.phase)==="processing";return o.length===0&&!p?e.jsx(jt,{children:e.jsxs($t,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(H,{name:"arrow-left"}),s("nav.cart")]}),e.jsxs(Ls,{"data-testid":"cart-empty",children:[e.jsx(H,{name:"cart-plus",size:110}),e.jsxs(Ks,{children:[e.jsx(Ns,{children:s("cart.empty.title")}),e.jsx(Us,{children:s("cart.empty.body")})]}),e.jsx(Qs,{to:"/assets",children:s("cart.empty.cta")})]})]})}):e.jsxs(jt,{children:[e.jsxs($t,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(H,{name:"arrow-left"}),s("nav.cart")]}),e.jsxs(_s,{children:[e.jsxs(Ws,{children:[e.jsxs(Fs,{children:[e.jsx(Hs,{onClick:()=>ee(-1),type:"button","aria-label":s("cart.goBack"),children:e.jsx(H,{name:"arrow-left"})}),e.jsx(Os,{children:s("cart.panelTitle",{count:Lt})}),Rt?e.jsxs(Vs,{onClick:()=>Y(!0),disabled:V,children:[e.jsx(H,{name:"fitting-room"}),s("cart.fittingRoom")]}):null]}),e.jsxs(At,{children:[e.jsx(Gs,{children:o.map(t=>{const a=Ut.get(t.id),d=a?a.priceCredits:t.priceCredits,c=!!a&&a.priceCredits!==t.priceCredits,u=!t.tokenId,h=t.quantity,w=typeof t.available=="number"&&h>=t.available,S=d*h,_=ua(t),E=!!_&&!!A[_],q=ha(t),y=Ve[t.id],g=!lt(y),k=y==="sold-out"?s("cart.availability.soldOut"):s("cart.availability.unavailable");return e.jsxs(Ds,{"data-unavailable":g||void 0,children:[e.jsxs(Ys,{"data-thumb":!0,children:[q?e.jsx(Js,{to:q,state:{item:t,tradeId:t.tradeId},"aria-label":t.name,children:t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:t.name}):null}):t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:t.name}):null,e.jsx(Xs,{"data-check":!0,"aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs(Zs,{children:[e.jsxs(en,{"data-desc":!0,children:[q?e.jsx(an,{to:q,state:{item:t,tradeId:t.tradeId},title:t.name,children:t.name}):e.jsx(tn,{title:t.name,children:t.name}),t.creator?e.jsx(sn,{address:t.creator,linkToProfile:!0}):null,u?e.jsxs(xn,{"data-testid":"cart-creator-tag",children:[e.jsx(mn,{name:"buy-from-creator"}),s("cart.creatorTag")]}):null]}),e.jsx(nn,{children:g?e.jsxs(e.Fragment,{children:[e.jsxs(hn,{children:[e.jsx(pn,{name:"warning-fill",size:24}),k]}),q?e.jsx(gn,{to:q,state:{item:t,tradeId:t.tradeId},children:s("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[u?e.jsxs(rn,{children:[e.jsx(St,{onClick:()=>me(()=>z(t.id)),disabled:V||h<=1,"aria-label":s("cart.decreaseQuantity",{name:t.name}),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsx(on,{children:h}),e.jsx(St,{onClick:()=>me(()=>I(t.id)),disabled:V||w,"aria-label":s("cart.increaseQuantity"),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null,e.jsxs(cn,{children:[e.jsx(dn,{})," ",S,c?e.jsx(ln,{children:t.priceCredits*h}):null]})]})})]}),e.jsxs(un,{children:[_?e.jsx(fn,{"data-on":E||void 0,onClick:()=>ne(t),"aria-label":E?s("cart.removeFromFavorites",{name:t.name}):s("cart.addToFavorites",{name:t.name}),title:E?s("assetCard.removeFromFavorites"):s("assetCard.addToFavorites"),children:e.jsx(H,{name:E?"heart-solid":"heart"})}):null,e.jsx(yn,{onClick:()=>me(()=>l(t.id)),disabled:V,"aria-label":s("cart.remove",{name:t.name}),title:s("cart.removeTitle"),children:e.jsx(H,{name:"trash",size:24})})]})]},t.id)})}),e.jsx(bn,{children:e.jsx("button",{className:"link",onClick:()=>me(W),disabled:V,children:s("cart.clearCart")})})]})]}),e.jsxs(vn,{children:[e.jsx(wn,{children:s("cart.purchaseSummary")}),e.jsxs(Cn,{children:[e.jsxs(jn,{children:[e.jsx(kn,{children:s("cart.totalItems",{count:Kt})}),e.jsx(Sn,{children:e.jsxs($n,{children:[e.jsx(Mn,{})," ",De]})})]}),xe.options.length>0||xe.manaShortfall?e.jsx(Tt,{options:xe.options,totalCents:ze,shortfall:xe.manaShortfall,creditsLabel:R?s("marketCheckout.confirmPurchase"):s("cart.buyWithCredits"),busy:V||Pe,onPay:t=>void(R?rt():te(t))}):e.jsx(Tn,{onClick:()=>void(R?rt():te()),disabled:V||Pe,children:V?s("cart.working"):R?s("marketCheckout.confirmPurchase"):s("assetCard.buyNow")}),Pe?e.jsx(Ce,{className:"muted",children:s("cart.allUnavailable")}):null,n?null:e.jsx(Ce,{className:"muted",children:s("cart.signInHint")}),R?e.jsx(Ce,{className:"muted",children:s("cart.priceChanged")}):null,Qe?e.jsx(Ce,{className:"muted",children:Qe}):null,e.jsx(In,{message:_t})]})]})]})]}),Ye.length>0?e.jsx(Pn,{children:e.jsx(as,{title:s("cart.youMightAlsoLike"),items:Ye})}):null,qe&&n?e.jsx(ss,{auth:qe.auth,signer:n.signer,title:s("authorizeStep.manaTitle"),name:s("authorizeStep.manaName"),reason:s("authorizeStep.manaReason"),icon:e.jsx("img",{src:ns,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:t}=qe;fe(null),t()},onCancel:()=>fe(null),onClose:()=>fe(null)}):null,p?e.jsx(qs,{phase:p.phase,balanceCredits:ge,onClose:Gt,stage:p.phase==="processing"?p.stage:void 0,step:p.phase==="processing"?p.step:void 0,total:p.phase==="processing"?p.total:void 0,isSelfCustody:pa(n==null?void 0:n.providerType),signatures:p.phase==="processing"?p.signatures:void 0,options:p.phase==="choose"?Jt(p).options:void 0,onPay:Xt,totalCents:p.phase==="choose"?p.totalCents:void 0,totalManaWei:p.phase==="choose"?p.manaWei:void 0,totalCredits:p.phase==="choose"?Ne(p.lines):void 0,lines:p.phase==="nofunds"?p.lines:void 0,shortfallCredits:p.phase==="nofunds"?p.shortfall:void 0,packs:ue,selectedPack:Te,onSelectPack:Oe,onBuyPacks:()=>void Zt(),message:p.phase==="error"?p.message:void 0,onRetry:()=>void te()}):null]})}export{Jn as Cart};
|
|
695
|
+
`;function Ke(o){if(ks(o))return s("errors.rejected");const l=(o.message??"").toLowerCase();return l.includes("insufficient")?s("cart.error.insufficient",{currency:ma.name}):l.includes("no active listing")||l.includes("your own listing")?s("cart.error.listingChanged"):s("marketCheckout.error.generic")}const zn=12e4;function An(o){const l=[];return o.unavailable.length&&l.push(s("cart.drop.unavailable",{count:o.unavailable.length})),o.own.length&&l.push(s("cart.drop.own",{count:o.own.length})),s("cart.drop.removed",{items:l.join(` ${s("cart.drop.and")} `)})}const Ne=o=>o.reduce((l,I)=>l+I.priceCredits*I.quantity,0),je=o=>o.flatMap(l=>Array.from({length:l.quantity},()=>({...l,quantity:1})));function Jn(){na({title:s("nav.cart"),noindex:!0});const o=Q(t=>t.items),l=Q(t=>t.remove),I=Q(t=>t.increment),z=Q(t=>t.decrement),W=Q(t=>t.clear),D=Q(t=>t.restore),Y=Q(t=>t.setFittingOpen),A=dt(t=>t.items),ne=dt(t=>t.toggle),{session:n,signIn:L}=ia(),ue=vs().packs.slice(0,ws);P.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const Bt=o.some(t=>t.category!=="emote"),{data:Me}=ra({queryKey:["upsell-listings"],queryFn:()=>ya({first:40}),staleTime:6e4}),{data:$}=oa(n),b=ca(),ee=ea(),{state:J}=ta(),[_t,ie]=P.useState(null),[Qe,he]=P.useState(null),[Wt,R]=P.useState(!1),[B,O]=P.useState(null),He=P.useRef(0),[p,j]=P.useState(null),{data:pe}=da(n),{data:re}=cs(!0),[Te,Oe]=P.useState(""),oe=P.useRef(null),Ve=la(o),Ge=t=>lt(Ve[t.id]),Ie=o.filter(Ge),Pe=o.length>0&&Ie.length===0,Ft=Ie.reduce((t,a)=>t+a.priceCredits*a.quantity,0),Lt=o.reduce((t,a)=>t+a.quantity,0),Kt=Ie.reduce((t,a)=>t+a.quantity,0),De=B?B.liveTotalCredits:Ft,Nt=new Set(o.map(t=>t.id)),Ye=((Me==null?void 0:Me.items)??[]).filter(t=>!Nt.has(t.id)).slice(0,12),Ut=new Map(B==null?void 0:B.buyable.map(t=>[t.item.id,t])),ge=($==null?void 0:$.credits)??0,ze=De*10,Qt=re?Ct(ze,re):0n,xe=Fe({priceCents:ze,priceManaWei:Qt,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n}),Ht=t=>t.some(a=>a.acquisition==="store"),Ae=t=>t.flatMap(a=>a.acquisition==="trade"?[a]:[]),Ot=ga,Vt=t=>xa(t.contractAddress,String(t.itemId));function me(t){t(),O(null),he(null),ie(null)}function Gt(){j(null),R(!1)}function Je(t){const a=Ne(t),d=Math.max(0,a-ge),c=ue.find(u=>u.credits>=d)??ue[ue.length-1];Oe(c.id),G("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:a,credits_balance:ge,shortfall:d}),j({phase:"nofunds",lines:t.map(u=>({item:u.item,priceCredits:u.priceCredits,quantity:u.quantity})),shortfall:d}),R(!1)}async function Ee(t){if(!n||t.length===0)return;const a=je(t),d=a.map(y=>({...y.item,priceCredits:y.priceCredits})),c=t.map(y=>({...y.item,priceCredits:y.priceCredits,quantity:y.quantity})),u=[];let h="authorize";const w=new Set,S=new Set,_=new Set,E=[];let q=!1;j({phase:"processing",stage:"reserving",step:1,total:a.length});try{const y=[];for(let m=0;m<a.length;m++){const x=a[m];j({phase:"processing",stage:"reserving",step:m+1,total:a.length});try{const M=x.acquisition==="trade"?x.trade.id:void 0,C=x.item.contractAddress&&x.item.itemId!=null?{contractAddress:x.item.contractAddress,itemId:String(x.item.itemId)}:void 0,{credit:U,maxCreditedValue:X}=await pt(n.identity,x.usdCents,M,C);u.push({salt:U.id,itemId:x.item.id}),y.push(x.acquisition==="store"?{kind:"store",item:{collection:x.item.contractAddress,itemId:String(x.item.itemId),priceWei:x.priceWei},credits:[U],maxCreditedValue:X,chainId:x.item.chainId}:{kind:"trade",trade:x.trade,credits:[U],maxCreditedValue:X})}catch(M){if($s(M)){if(u.length){try{await _e(n.identity,u.map(C=>C.salt))}catch(C){ae(C,{flow:"cart_checkout",step:"release"})}b.invalidateQueries({queryKey:["usd-balance"]})}Je(t);return}throw M}}h="submit";const g=ms(y).length,k=m=>g>1?{current:m,total:g}:void 0,F=(m,x)=>j({phase:"processing",stage:m,step:a.length,total:a.length,signatures:k(x)}),K=m=>m<g?F("awaiting-signature",m+1):F("settling",g);F("awaiting-signature",1);let f=[];const v=y.some(m=>m.kind==="store"),N=y.flatMap(m=>m.kind==="trade"?[m]:[]);if(ls()&&!v)try{const m=new Map;f=await fs({purchases:N,buyer:n.address,signer:n.signer,onSigned:()=>K(g),onBroadcast:({txHash:C,salts:U})=>{m.set(C,U),U.forEach(X=>w.add(X))}});const x=await Promise.allSettled(f.map(C=>ys(C)));x.forEach((C,U)=>{const X=m.get(f[U])??[];C.status==="fulfilled"?(X.forEach(Be=>S.add(Be)),E.push(f[U])):C.reason instanceof vt||X.forEach(Be=>_.add(Be))});const M=x.flatMap(C=>C.status==="rejected"?[C.reason]:[]);if(M.length&&!M.some(C=>C instanceof vt))throw M[0];q=!0}catch(m){if(!(m instanceof bs))throw m;f=await Le({purchases:y,buyer:n.address,signer:n.signer,onSigned:K,onBroadcast:({salts:x})=>x.forEach(M=>w.add(M)),onSettled:({txHash:x,salts:M})=>{M.forEach(C=>S.add(C)),E.push(x)},onReverted:({salts:x})=>x.forEach(M=>_.add(M))})}else f=await Le({purchases:y,buyer:n.address,signer:n.signer,onSigned:K,onBroadcast:({salts:m})=>m.forEach(x=>w.add(x)),onSettled:({txHash:m,salts:x})=>{x.forEach(M=>S.add(M)),E.push(m)},onReverted:({salts:m})=>m.forEach(x=>_.add(x))});t.forEach(m=>l(m.item.id)),O(null),G("Shop Completed Purchase",{...ye(d),payment_type:"credits",no_crypto_step:q,transaction_hash:f[0]??null}),bt(b);const ce=oe.current;oe.current=null,j(null),R(!1);const Re={items:c,txHash:f[0]??void 0,txHashes:f,settled:!0,...ce?{creditsAdded:ce}:{}};ee("/success",{state:Re,replace:!0})}catch(y){be(y)||ae(y,{flow:"cart_checkout",step:h,cart_size:t.length});const g=new Set([...w].filter(v=>!_.has(v))),{toRelease:k,boughtItemIds:F}=wt({reservations:u,spent:g,settled:S}),K=d.filter(v=>F.includes(v.id)),f=d.filter(v=>!F.includes(v.id));if(G(be(y)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:h,error_code:gt(y),value_usd:ut(f.reduce((v,N)=>v+N.priceCredits,0)),cart_size:a.length,partial:K.length>0}),k.length)try{await _e(n.identity,k)}catch(v){ae(v,{flow:"cart_checkout",step:"release"})}if(b.invalidateQueries({queryKey:["usd-balance"]}),K.length>0){F.forEach(v=>l(v)),O(null),bt(b),G("Shop Completed Purchase",{...ye(K),payment_type:"credits",no_crypto_step:q,transaction_hash:E[0]??null,partial:!0}),j({phase:"error",message:s("cart.error.partiallyBought")}),R(!1);return}j({phase:"error",message:Ke(y)})}}function Xe(t,a){b.invalidateQueries({queryKey:["usd-balance"]}),b.invalidateQueries({queryKey:["detail-trade"]}),b.invalidateQueries({queryKey:["shop-item"]}),b.invalidateQueries({queryKey:["owned-token"]}),b.invalidateQueries({queryKey:["public-token"]}),b.invalidateQueries({queryKey:["item-resales"]}),b.invalidateQueries({queryKey:["shop-items"]}),b.invalidateQueries({queryKey:["catalog-items"]}),b.invalidateQueries({queryKey:["my-assets"]}),b.invalidateQueries({queryKey:["purchases"]}),b.invalidateQueries({queryKey:["owned-item-count"]}),b.invalidateQueries({queryKey:["overview-listings"]}),b.invalidateQueries({queryKey:["upsell-listings"]});const d=oe.current;oe.current=null,j(null),R(!1);const c={items:t,txHash:a[0]??void 0,txHashes:a,settled:!0,...d?{creditsAdded:d}:{}};ee("/success",{state:c,replace:!0})}function Ze(t,a){be(t)||ae(t,{flow:a,step:"submit"}),G(be(t)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:gt(t)}),j({phase:"error",message:Ke(t)}),R(!1)}async function Dt(t,a){const d=ve(We.MANAToken,a),c=ve(We.CreditsManager,a);await gs({auth:{kind:xs.Allowance,contractAddress:d.address,spenderAddress:c.address,chainId:a},signer:t})}async function et(){if(re)return re;try{return await b.fetchQuery({queryKey:["mana-rate",ht.chainId],queryFn:()=>ds(ht.chainId),staleTime:6e4})}catch{return}}async function Yt(t){const a=je(t).reduce((h,w)=>h+w.usdCents,0),c=(pe??0n)>0n?await et():re,u=c?Ct(a,c):0n;return{totalCents:a,manaWei:u}}async function tt(t,a){const d=Ne(t),{totalCents:c,manaWei:u}=await Yt(t),h=Fe({priceCents:c,priceManaWei:u,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n}),w=Ht(t)?{...h,options:h.options.filter(S=>S.method==="credits")}:h;if(a&&w.options.some(S=>S.method===a)){if(a==="credits"){Ee(t);return}const{spender:S,chainId:_}=at(a,t);await st(S,_,()=>a==="mana"?void nt(t):void it(t,c,u));return}if(w.options.some(S=>S.method==="mana"||S.method==="combined")){j({phase:"choose",lines:t,totalCents:c,manaWei:u}),R(!1);return}if($!=null&&$.credits<d){Je(t);return}Ee(t)}function Jt(t){return Fe({priceCents:t.totalCents,priceManaWei:t.manaWei,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n})}const[qe,fe]=P.useState(null);function at(t,a){const d=Ae(a)[0].trade;return{spender:t==="mana"?ve(fa(d.contract),d.chainId).address:ve(We.CreditsManager,d.chainId).address,chainId:d.chainId}}async function st(t,a,d){const c=us(a,t),u=n?await hs(c,n.address).catch(()=>!0):!0;if(ps(n==null?void 0:n.providerType,u)){R(!1),fe({auth:c,run:d});return}d()}function Xt(t){if((p==null?void 0:p.phase)!=="choose")return;const{lines:a,totalCents:d,manaWei:c}=p;if(t==="credits"){Ee(a);return}const{spender:u,chainId:h}=at(t,a);st(u,h,()=>t==="mana"?void nt(a):void it(a,d,c))}async function nt(t){if(!n||t.length===0)return;const a=je(t),d=a.map(h=>({...h.item,priceCredits:h.priceCredits})),c=t.map(h=>({...h.item,priceCredits:h.priceCredits,quantity:h.quantity})),u=()=>j({phase:"processing",stage:"settling",step:a.length,total:a.length});j({phase:"processing",stage:"awaiting-signature",step:a.length,total:a.length});try{const h=await is({trades:Ae(a).map(w=>w.trade),buyer:n.address,signer:n.signer,onSigned:u});t.forEach(w=>l(w.item.id)),O(null),G("Shop Completed Purchase",{...ye(d),payment_type:"mana",transaction_hash:h[0]??null}),b.invalidateQueries({queryKey:["mana-balance"]}),Xe(c,h)}catch(h){Ze(h,"buy_cart_mana")}}async function it(t,a,d){if(!n||t.length===0)return;const c=je(t),u=c.map(g=>({...g.item,priceCredits:g.priceCredits})),h=t.map(g=>({...g.item,priceCredits:g.priceCredits,quantity:g.quantity})),w=rs(c.map(g=>g.usdCents),($==null?void 0:$.balanceCents)??0),S=w.reduce((g,k)=>g+k,0),_=os(Math.max(0,a-S),a,d),E=[],q=new Set,y=new Set;j({phase:"processing",stage:"reserving",step:1,total:c.length});try{const g=Ae(c),k=[];for(let f=0;f<g.length;f++){const v=w[f];if(v<=0)continue;j({phase:"processing",stage:"reserving",step:f+1,total:g.length});const N=g[f].item,{credit:ce,maxCreditedValue:Re}=await pt(n.identity,v,g[f].trade.id,N.contractAddress&&N.itemId!=null?{contractAddress:N.contractAddress,itemId:String(N.itemId)}:void 0);E.push({salt:ce.id,itemId:N.id}),k.push({kind:"trade",trade:g[f].trade,credits:[ce],maxCreditedValue:Re})}g.forEach((f,v)=>{w[v]<=0&&k.push({kind:"trade",trade:f.trade,credits:[],maxCreditedValue:"0"})}),k[0]={...k[0],maxCreditedValue:(BigInt(k[0].maxCreditedValue)+_).toString()},await Dt(n.signer,g[0].trade.chainId);const F=()=>j({phase:"processing",stage:"settling",step:c.length,total:c.length});j({phase:"processing",stage:"awaiting-signature",step:c.length,total:c.length});const K=await Le({purchases:k,buyer:n.address,signer:n.signer,onSigned:F,onBroadcast:({salts:f})=>f.forEach(v=>q.add(v)),onReverted:({salts:f})=>f.forEach(v=>y.add(v))});t.forEach(f=>l(f.item.id)),O(null),G("Shop Completed Purchase",{...ye(u),payment_type:"credits_and_mana",transaction_hash:K[0]??null}),b.invalidateQueries({queryKey:["mana-balance"]}),Xe(h,K)}catch(g){const{toRelease:k}=wt({reservations:E,spent:new Set([...q].filter(F=>!y.has(F))),settled:new Set});k.length&&_e(n.identity,k).catch(()=>{}),E.length&&b.invalidateQueries({queryKey:["usd-balance"]}),Ze(g,"buy_cart_combined")}}async function te(t){if(!n){yt({type:"cart-checkout"}),L();return}const a=Q.getState().items.filter(Ge);if(a.length===0)return;ie(null),he(null),R(!0);const d=a.reduce((c,u)=>c+u.priceCredits*u.quantity,0);G("Shop Started Checkout",{cart_size:a.length,cart_value_credits:d,cart_value_usd:ut(d),has_sufficient_credits:ge>=d});try{const c=await Cs(a,n.address,Ot,await et(),Vt),u=[...c.unavailable,...c.own];if(u.length&&(u.forEach(h=>l(h.id)),he(An(c))),c.buyable.length===0){ie(s("cart.error.noneAvailable")),O(null);return}if(c.orderChanged){O(c),He.current=Date.now();return}await tt(c.buyable,t)}catch(c){ae(c,{flow:"cart_checkout",step:"review",cart_size:a.length}),ie(Ke(c))}finally{R(!1)}}async function rt(){if(B){if(!n){yt({type:"cart-checkout"}),L();return}if(Date.now()-He.current>zn){O(null),he(null),await te();return}ie(null),tt(B.buyable)}}async function Zt(){if(Te){try{sessionStorage.setItem(we,JSON.stringify(Q.getState().items))}catch{}R(!0);try{const t=await js(Te,n?{address:n.address,identity:n.identity}:void 0);if(t.url){window.location.href=t.url;return}ee("/credits")}catch(t){try{sessionStorage.removeItem(we)}catch{}ae(t,{flow:"cart_buy_credits"}),j({phase:"error",message:s("buyModal.error.creditsCheckout")})}finally{R(!1)}}}const ot=P.useRef(!1);P.useEffect(()=>{if(!n||ot.current||!ts("cart-checkout"))return;ot.current=!0;const t=setTimeout(()=>void te(),0);return()=>clearTimeout(t)},[n]);const ct=P.useRef(!1);P.useEffect(()=>{if(!(J!=null&&J.resumeCheckout)||ct.current)return;ct.current=!0,oe.current=J.creditsAdded??null;try{const a=sessionStorage.getItem(we);if(a){sessionStorage.removeItem(we);const d=JSON.parse(a);Array.isArray(d)&&d.length&&D(d)}}catch{}b.invalidateQueries({queryKey:["usd-balance"]});const t=setTimeout(()=>void te(),0);return()=>clearTimeout(t)},[J==null?void 0:J.resumeCheckout]);const V=Wt||(p==null?void 0:p.phase)==="processing";return o.length===0&&!p?e.jsx(jt,{children:e.jsxs($t,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(H,{name:"arrow-left"}),s("nav.cart")]}),e.jsxs(Ls,{"data-testid":"cart-empty",children:[e.jsx(H,{name:"cart-plus",size:110}),e.jsxs(Ks,{children:[e.jsx(Ns,{children:s("cart.empty.title")}),e.jsx(Us,{children:s("cart.empty.body")})]}),e.jsx(Qs,{to:"/assets",children:s("cart.empty.cta")})]})]})}):e.jsxs(jt,{children:[e.jsxs($t,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(H,{name:"arrow-left"}),s("nav.cart")]}),e.jsxs(_s,{children:[e.jsxs(Ws,{children:[e.jsxs(Fs,{children:[e.jsx(Hs,{onClick:()=>ee(-1),type:"button","aria-label":s("cart.goBack"),children:e.jsx(H,{name:"arrow-left"})}),e.jsx(Os,{children:s("cart.panelTitle",{count:Lt})}),Bt?e.jsxs(Vs,{onClick:()=>Y(!0),disabled:V,children:[e.jsx(H,{name:"fitting-room"}),s("cart.fittingRoom")]}):null]}),e.jsxs(At,{children:[e.jsx(Gs,{children:o.map(t=>{const a=Ut.get(t.id),d=a?a.priceCredits:t.priceCredits,c=!!a&&a.priceCredits!==t.priceCredits,u=!t.tokenId,h=t.quantity,w=typeof t.available=="number"&&h>=t.available,S=d*h,_=ua(t),E=!!_&&!!A[_],q=ha(t),y=Ve[t.id],g=!lt(y),k=y==="sold-out"?s("cart.availability.soldOut"):s("cart.availability.unavailable");return e.jsxs(Ds,{"data-unavailable":g||void 0,children:[e.jsxs(Ys,{"data-thumb":!0,children:[q?e.jsx(Js,{to:q,state:{item:t,tradeId:t.tradeId},"aria-label":t.name,children:t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:t.name}):null}):t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:t.name}):null,e.jsx(Xs,{"data-check":!0,"aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs(Zs,{children:[e.jsxs(en,{"data-desc":!0,children:[q?e.jsx(an,{to:q,state:{item:t,tradeId:t.tradeId},title:t.name,children:t.name}):e.jsx(tn,{title:t.name,children:t.name}),t.creator?e.jsx(sn,{address:t.creator,linkToProfile:!0}):null,u?e.jsxs(xn,{"data-testid":"cart-creator-tag",children:[e.jsx(mn,{name:"buy-from-creator"}),s("cart.creatorTag")]}):null]}),e.jsx(nn,{children:g?e.jsxs(e.Fragment,{children:[e.jsxs(hn,{children:[e.jsx(pn,{name:"warning-fill",size:24}),k]}),q?e.jsx(gn,{to:q,state:{item:t,tradeId:t.tradeId},children:s("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[u?e.jsxs(rn,{children:[e.jsx(St,{onClick:()=>me(()=>z(t.id)),disabled:V||h<=1,"aria-label":s("cart.decreaseQuantity",{name:t.name}),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsx(on,{children:h}),e.jsx(St,{onClick:()=>me(()=>I(t.id)),disabled:V||w,"aria-label":s("cart.increaseQuantity"),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null,e.jsxs(cn,{children:[e.jsx(dn,{})," ",S,c?e.jsx(ln,{children:t.priceCredits*h}):null]})]})})]}),e.jsxs(un,{children:[_?e.jsx(fn,{"data-on":E||void 0,onClick:()=>ne(t),"aria-label":E?s("cart.removeFromFavorites",{name:t.name}):s("cart.addToFavorites",{name:t.name}),title:E?s("assetCard.removeFromFavorites"):s("assetCard.addToFavorites"),children:e.jsx(H,{name:E?"heart-solid":"heart"})}):null,e.jsx(yn,{onClick:()=>me(()=>l(t.id)),disabled:V,"aria-label":s("cart.remove",{name:t.name}),title:s("cart.removeTitle"),children:e.jsx(H,{name:"trash",size:24})})]})]},t.id)})}),e.jsx(bn,{children:e.jsx("button",{className:"link",onClick:()=>me(W),disabled:V,children:s("cart.clearCart")})})]})]}),e.jsxs(vn,{children:[e.jsx(wn,{children:s("cart.purchaseSummary")}),e.jsxs(Cn,{children:[e.jsxs(jn,{children:[e.jsx(kn,{children:s("cart.totalItems",{count:Kt})}),e.jsx(Sn,{children:e.jsxs($n,{children:[e.jsx(Mn,{})," ",De]})})]}),xe.options.length>0||xe.manaShortfall?e.jsx(Tt,{options:xe.options,totalCents:ze,shortfall:xe.manaShortfall,creditsLabel:B?s("marketCheckout.confirmPurchase"):s("cart.buyWithCredits"),busy:V||Pe,onPay:t=>void(B?rt():te(t))}):e.jsx(Tn,{onClick:()=>void(B?rt():te()),disabled:V||Pe,children:V?s("cart.working"):B?s("marketCheckout.confirmPurchase"):s("assetCard.buyNow")}),Pe?e.jsx(Ce,{className:"muted",children:s("cart.allUnavailable")}):null,n?null:e.jsx(Ce,{className:"muted",children:s("cart.signInHint")}),B?e.jsx(Ce,{className:"muted",children:s("cart.priceChanged")}):null,Qe?e.jsx(Ce,{className:"muted",children:Qe}):null,e.jsx(In,{message:_t})]})]})]})]}),Ye.length>0?e.jsx(Pn,{children:e.jsx(as,{title:s("cart.youMightAlsoLike"),items:Ye})}):null,qe&&n?e.jsx(ss,{auth:qe.auth,signer:n.signer,title:s("authorizeStep.manaTitle"),name:s("authorizeStep.manaName"),reason:s("authorizeStep.manaReason"),icon:e.jsx("img",{src:ns,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:t}=qe;fe(null),t()},onCancel:()=>fe(null),onClose:()=>fe(null)}):null,p?e.jsx(qs,{phase:p.phase,balanceCredits:ge,onClose:Gt,stage:p.phase==="processing"?p.stage:void 0,step:p.phase==="processing"?p.step:void 0,total:p.phase==="processing"?p.total:void 0,isSelfCustody:pa(n==null?void 0:n.providerType),signatures:p.phase==="processing"?p.signatures:void 0,options:p.phase==="choose"?Jt(p).options:void 0,onPay:Xt,totalCents:p.phase==="choose"?p.totalCents:void 0,totalManaWei:p.phase==="choose"?p.manaWei:void 0,totalCredits:p.phase==="choose"?Ne(p.lines):void 0,lines:p.phase==="nofunds"?p.lines:void 0,shortfallCredits:p.phase==="nofunds"?p.shortfall:void 0,packs:ue,selectedPack:Te,onSelectPack:Oe,onBuyPacks:()=>void Zt(),message:p.phase==="error"?p.message:void 0,onRetry:()=>void te()}):null]})}export{Jn as Cart};
|