@dcl/shop 0.3.0 → 0.4.0
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-CysvRMDH.js → Activity-CSDWiFkq.js} +1 -1
- package/_assets/{AnimatedBackground-1KvWirPP.js → AnimatedBackground-vKrEOHA5.js} +1 -1
- package/_assets/{Assets-CmA7g8ft.js → Assets-Cogahyqe.js} +3 -3
- package/_assets/{Assets.styles-BwMj4485.js → Assets.styles-B2EWL6JB.js} +1 -1
- package/_assets/{Authorizations-CfvVeEJl.js → Authorizations-BrKYlkZG.js} +1 -1
- package/_assets/{Cart-CYHKPPD-.js → Cart-W8w3sCuV.js} +5 -5
- package/_assets/{CircularProgress-oGg4qqHc.js → CircularProgress--GC-6I6k.js} +1 -1
- package/_assets/{Collection-Dmap3sR_.js → Collection-D16pjJSe.js} +1 -1
- package/_assets/{CollectionCarousel-DiADjTg-.js → CollectionCarousel-BeuBL17J.js} +77 -77
- package/_assets/{Creator-DB4BIeTa.js → Creator-BLsHzXRL.js} +1 -1
- package/_assets/{ErrorNotice-CBx78pQu.js → ErrorNotice-Cvc0nTjw.js} +1 -1
- package/_assets/{ExchangeController-DOvKzvyb.js → ExchangeController-DoFEzXko.js} +1 -1
- package/_assets/{GetCredits-Ch_OO41P.js → GetCredits-bxJh6m8F.js} +94 -130
- package/_assets/{HelpersUtil-CFCkU-g3.js → HelpersUtil-BFgierZ-.js} +1 -1
- package/_assets/{ImportListings-BGmtSIDb.js → ImportListings-BwORJ3CC.js} +13 -13
- package/_assets/{ItemDetail-ramYOGDR.js → ItemDetail-PoeIzOPp.js} +194 -194
- package/_assets/{ItemPreview.styles-D8aGYVBK.js → ItemPreview.styles-DtAUND9N.js} +1 -1
- package/_assets/{LoadMore-BSE8BKwI.js → LoadMore-DsWSQHxD.js} +1 -1
- package/_assets/ManaPricingBanner.styles-CF0iOeeS.js +74 -0
- package/_assets/{MenuList-qnDzTtfz.js → MenuList-DNOqfxHx.js} +1 -1
- package/_assets/{MyAssets-CgneL-KA.js → MyAssets-2XwaE-SE.js} +4 -4
- package/_assets/{MyFavorites-DrPT--am.js → MyFavorites-DIi3ztNe.js} +1 -1
- package/_assets/{NotFound-4IJj-QH6.js → NotFound-jHtQUp44.js} +1 -1
- package/_assets/{NotificationsBell-BOg2j5-7.js → NotificationsBell-By0uu4SI.js} +1 -1
- package/_assets/{OutfitDetail-DAfw3jDe.js → OutfitDetail-BQr6vhnT.js} +1 -1
- package/_assets/{OutfitPreview-DMQpfBpS.js → OutfitPreview-D6Z7-XEK.js} +1 -1
- package/_assets/{OutfitStudio-qASOqFO4.js → OutfitStudio-BFWU775v.js} +1 -1
- package/_assets/{StoreSettings-CjbyuHVf.js → StoreSettings-BJTpsKoX.js} +1 -1
- package/_assets/{Success-Ba2GyRY_.js → Success-CIQKaiOo.js} +1 -1
- package/_assets/{SwapController-B823Ep4J.js → SwapController-XcLKHFDT.js} +1 -1
- package/_assets/{Tooltip-2XcUkoOj.js → Tooltip-fS4VCxQs.js} +1 -1
- package/_assets/{TradeService-lYuRlk4v.js → TradeService-BgfeT0JQ.js} +1 -1
- package/_assets/{W3MFrameProviderSingleton-B8ZAc5Tp.js → W3MFrameProviderSingleton-BJE-tnmd.js} +3 -3
- package/_assets/{WebCryptoP256-CrjjL3U7.js → WebCryptoP256-P_MkVOZf.js} +1 -1
- package/_assets/authorizations-Bm65kFBw.js +1 -0
- package/_assets/{basic-3OIT7lDP.js → basic-BzdDurZu.js} +1 -1
- package/_assets/{biconomy-CLvfOfCg.js → biconomy-BHLIxKXm.js} +1 -1
- package/_assets/{browseLayout.styles-DCwE16ZG.js → browseLayout.styles-D_JQHeMK.js} +4 -4
- package/_assets/{builder-CoZ9B86k.js → builder-CPpn-LV6.js} +1 -1
- package/_assets/buy-CfVy6xwA.js +1 -0
- package/_assets/{buy-gasless-uIQiLsX8.js → buy-gasless-DmFIjDH7.js} +1 -1
- package/_assets/categories-D2JgaepG.js +448 -0
- package/_assets/{ccip-C8TW-3ey.js → ccip-BGuL2CTW.js} +1 -1
- package/_assets/{ccip-C4f9EXfY.js → ccip-japHsC-d.js} +1 -1
- package/_assets/{clsx-BsYHeX03.js → clsx-DY37pDvc.js} +1 -1
- package/_assets/{controller-ASkKeRkX.js → controller-CEuTNpMI.js} +2 -2
- package/_assets/{core-X_wu6_Dy.js → core-DFTtNj6Y.js} +4 -4
- package/_assets/{createSvgIcon-D4cpIqvx.js → createSvgIcon-BFo-10ds.js} +3 -3
- package/_assets/{custom-BVAi4D5H.js → custom-DyS8vC8K.js} +1 -1
- package/_assets/{data-capture-C23iRBhs.js → data-capture-CpqP5gpO.js} +1 -1
- package/_assets/{email-CB03fcCQ.js → email-DOkwtMrW.js} +1 -1
- package/_assets/{embedded-wallet-CnMDk9db.js → embedded-wallet-BI0I-FyI.js} +1 -1
- package/_assets/{emotion-styled.browser.esm-CNluusdx.js → emotion-styled.browser.esm-nmKSs9QV.js} +1 -1
- package/_assets/{engine-DaJGLPH7.js → engine-BsCDGGhp.js} +1 -1
- package/_assets/{errors-CJ4NHTPm.js → errors-CVWX9epA.js} +1 -1
- package/_assets/{estimate-l1-fee-DC2eYWPQ.js → estimate-l1-fee-BwVQYvPZ.js} +1 -1
- package/_assets/{execute-vh_I47EG.js → execute-DCjeHtk2.js} +2 -2
- package/_assets/{features-i2gsSk7q.js → features-DmQF08Nd.js} +1 -1
- package/_assets/{fetchTokenMetadata-DpicXKCe.js → fetchTokenMetadata-DtvlyEpN.js} +2 -2
- package/_assets/{field.styles-DPC95Ntd.js → field.styles-ZqzDOrCY.js} +1 -1
- package/_assets/{get-ecosystem-wallet-info-B8_se1pi.js → get-ecosystem-wallet-info-glXHSBBX.js} +1 -1
- package/_assets/{getBalance-Cee2d5fc.js → getBalance-D4uOuyXp.js} +1 -1
- package/_assets/{getNFT-CUD-atXT.js → getNFT-D9u1poHS.js} +1 -1
- package/_assets/{getNFT-BjnrEAq8.js → getNFT-VYQvQv4K.js} +1 -1
- package/_assets/{getThemeProps-B71MHgCC.js → getThemeProps-BOJ8W9dy.js} +1 -1
- package/_assets/{grid.styles-q_RkLJKv.js → grid.styles-C92STzz7.js} +1 -1
- package/_assets/{hashTypedData-Bclxfb96.js → hashTypedData-CU4XEihs.js} +1 -1
- package/_assets/{hashTypedData-CiuZE5MB.js → hashTypedData-Cmk_4l7W.js} +1 -1
- package/_assets/hero-credits-outfits-DeMMQYZj.webp +0 -0
- package/_assets/{in-app-DoTVgkA7.js → in-app-n2C_GYjN.js} +1 -1
- package/_assets/{in-app-wallet-calls-aTpQmtYp.js → in-app-wallet-calls-BH4EHvoE.js} +1 -1
- package/_assets/{index-DJ0Ox_g6.js → index-1DlQc04C.js} +1 -1
- package/_assets/{index-oYINO7Gh.js → index-1E3TZOEp.js} +3 -3
- package/_assets/{index-ZtNObKUx.js → index-3G1ZZRHy.js} +1 -1
- package/_assets/{index-C_quGuYS.js → index-5ZQ75r5A.js} +2 -2
- package/_assets/{index-BOqO3K08.js → index-5oJAYQpS.js} +1 -1
- package/_assets/{index-DnUnGNK1.js → index-8ahFN9pV.js} +1 -1
- package/_assets/{index-BLIOngWK.js → index-9ZSFZyk5.js} +1 -1
- package/_assets/{index-CkdrAVd7.js → index-B-0owZIE.js} +1 -1
- package/_assets/{index-KhxRGpab.js → index-B-2A_xJK.js} +1 -1
- package/_assets/index-B0wrSWVL.js +3467 -0
- package/_assets/{index-DxbeSgwP.js → index-B33pX4sx.js} +1 -1
- package/_assets/{index-CnAxZm7a.js → index-B6HLteu2.js} +1 -1
- package/_assets/{index-C-ZPerkC.js → index-B95j5ECm.js} +1 -1
- package/_assets/{index-D2Hh-irJ.js → index-BAGHoKjd.js} +1 -1
- package/_assets/{index-BdZJNMhf.js → index-BAKuuHpY.js} +1 -1
- package/_assets/{index-Br-QxSL4.js → index-BBLwTza9.js} +1 -1
- package/_assets/{index-CLm5_lcW.js → index-BFbvmloZ.js} +1 -1
- package/_assets/{index-DREmVGyP.js → index-BKB9eVo_.js} +1 -1
- package/_assets/{index-CShk5nTD.js → index-Bdk6ierZ.js} +1 -1
- package/_assets/{index-pDIZRYxP.js → index-BmtMJnoP.js} +2 -2
- package/_assets/{index-DzoYWAIJ.js → index-Bnnl1_Pn.js} +1 -1
- package/_assets/{index-CHLJVbwu.js → index-BpfebiBi.js} +1 -1
- package/_assets/{index-Dqt4TaYh.js → index-BvzZi8lQ.js} +1 -1
- package/_assets/{index-BnVjsoyV.js → index-C1Zza7kR.js} +3 -3
- package/_assets/{index-LbRdNAf3.js → index-C75VmoUV.js} +1 -1
- package/_assets/{index-CiqC5vqm.js → index-CCQWBULG.js} +1 -1
- package/_assets/{index-DAKpmmlR.js → index-CDzrsoju.js} +1 -1
- package/_assets/{index-DpAZRpHS.js → index-CFJ4759x.js} +1 -1
- package/_assets/{index-DmmqNlbI.js → index-CMiDANew.js} +1 -1
- package/_assets/{index-6U0_groo.js → index-CNek90qs.js} +1 -1
- package/_assets/{index-BIMSqj0E.js → index-CS26D5br.js} +1 -1
- package/_assets/index-D-NhBWWr.css +1 -0
- package/_assets/{index-Da9c_8XH.js → index-DCJFwzag.js} +1 -1
- package/_assets/{index-B8WxnCSZ.js → index-DCkPd79h.js} +1 -1
- package/_assets/{index-AvMVq3p5.js → index-DO-41U6s.js} +1 -1
- package/_assets/{index-Zni41xRh.js → index-DU7iVDBh.js} +3 -3
- package/_assets/{index-X-5FVXow.js → index-DUOePrjP.js} +1 -1
- package/_assets/{index-BmR9lQvd.js → index-DWyeO73d.js} +1 -1
- package/_assets/{index-CqqbmEIM.js → index-Das01MWO.js} +2 -2
- package/_assets/{index-CKgjOb17.js → index-DcW0aOo_.js} +1 -1
- package/_assets/{index-D2cHV9P4.js → index-Dg3cba8i.js} +1 -1
- package/_assets/{index-umhEn8if.js → index-DgIUvj1u.js} +1 -1
- package/_assets/{index-B-yk4_og.js → index-Drzr7GIe.js} +1 -1
- package/_assets/{index-DhW6Eiq4.js → index-DuYquyJk.js} +1 -1
- package/_assets/{index-grey-Hql.js → index-Dyb9tM0L.js} +1 -1
- package/_assets/{index-CQd88f4P.js → index-S5ytn1G_.js} +1 -1
- package/_assets/{index-pkIYUyEs.js → index-X1g5-mc1.js} +2 -2
- package/_assets/{index-Bm4qVnUT.js → index-YlEZ0MB-.js} +1 -1
- package/_assets/{index-Dk_Ivei2.js → index-gO1p5U4e.js} +1 -1
- package/_assets/{index-BMHjpFTY.js → index-iVhRHvGC.js} +1 -1
- package/_assets/{index-5tjsFjOD.js → index-lc1BgLRJ.js} +1 -1
- package/_assets/{index-tvenjK5z.js → index-x_f1XpFN.js} +1 -1
- package/_assets/{index.es-C5-qOo53.js → index.es-CYrm9JiK.js} +4 -4
- package/_assets/{index.es-C4q67lvL.js → index.es-D-Hj-yaE.js} +1 -1
- package/_assets/{index.es-gI39JHkd.js → index.es-DlCKcYQh.js} +1 -1
- package/_assets/{localBatchGatewayRequest-CYWicxBl.js → localBatchGatewayRequest-D-M3uJjn.js} +1 -1
- package/_assets/{mana-convert-C239nuRR.js → mana-convert-XtWFaGCt.js} +1 -1
- package/_assets/{mana-rate-CWXyJ6Qt.js → mana-rate-CLS7fjKR.js} +1 -1
- package/_assets/{networks-CdC9lKkb.js → networks-DLkt_HOu.js} +1 -1
- package/_assets/{onramp-B6zv6owZ.js → onramp-B9C9zg8X.js} +1 -1
- package/_assets/{openzeppelin-fBZEbwFp.js → openzeppelin-Czmq9Q8z.js} +1 -1
- package/_assets/{parseNft-Dn6QDQHN.js → parseNft-Df0bG2_u.js} +2 -2
- package/_assets/{parseSignature-DecBV3iH.js → parseSignature-Cu3sQgfL.js} +1 -1
- package/_assets/{parseSignature-DAHrPk4v.js → parseSignature-nbJG9PDg.js} +3 -3
- package/_assets/{passkeys-KiBei2LX.js → passkeys-UkbavCkH.js} +1 -1
- package/_assets/{pay-with-exchange-D9SNWmjx.js → pay-with-exchange-BZkWaWxT.js} +1 -1
- package/_assets/{qr-overlay-2zAa6fld.js → qr-overlay-BE8jnAiO.js} +1 -1
- package/_assets/{receive-ChxNL97S.js → receive-B2e1QRi3.js} +1 -1
- package/_assets/{resolveImplementation-BNaLKkof.js → resolveImplementation-BBe0akeh.js} +1 -1
- package/_assets/{rpc-DBHsoP5N.js → rpc-iEVF2nz4.js} +1 -1
- package/_assets/{secp256k1-C8JTXBnF.js → secp256k1-Ba2kPpNf.js} +1 -1
- package/_assets/{secp256k1-C2pLUi5w.js → secp256k1-ClQ_G_RL.js} +1 -1
- package/_assets/{secp256k1-xOB6yMRi.js → secp256k1-e7mCjC3J.js} +1 -1
- package/_assets/{send-BLmLJ3eA.js → send-BOmHA5ER.js} +1 -1
- package/_assets/{send-batch-transaction-120lF45D.js → send-batch-transaction-C1STwRsa.js} +1 -1
- package/_assets/{send-eip712-transaction-B2w1ZAOY.js → send-eip712-transaction-Dy9FgG1n.js} +2 -2
- package/_assets/{send-gasless-transaction-oH9WEYVY.js → send-gasless-transaction-C66wRlKz.js} +2 -2
- package/_assets/{send-transaction-CLaO8DmY.js → send-transaction-CLuOLZ7t.js} +2 -2
- package/_assets/{sendMetaTransaction-OKd_ifNL.js → sendMetaTransaction-DvDr2bCi.js} +1 -1
- package/_assets/{sendRawTransaction-BP5hNXP6.js → sendRawTransaction-DqkFhazS.js} +3 -3
- package/_assets/{serializeTransaction--Dr7RtAU.js → serializeTransaction-BEOUomEz.js} +1 -1
- package/_assets/{session-proposal-CiYz-jZC.js → session-proposal-UXG0f185.js} +1 -1
- package/_assets/{session-request-Clv9A0oy.js → session-request-DIqK3WRK.js} +2 -2
- package/_assets/{signing-CJ5kWk7o.js → signing-DReJZKDs.js} +3 -3
- package/_assets/{socials-CeLfiCF9.js → socials-CdGrw0ok.js} +1 -1
- package/_assets/{swaps-DkDPQf9R.js → swaps-CycOd3sO.js} +1 -1
- package/_assets/{thirdweb-BcTKOQfU.js → thirdweb-D5w8-dkS.js} +3 -3
- package/_assets/{to-serializable-transaction-CVgEJJoF.js → to-serializable-transaction-C1TwC6Ti.js} +2 -2
- package/_assets/{trade-encoding-COAHYjJi.js → trade-encoding-Mw7kNWLf.js} +1 -1
- package/_assets/{transactionReceipt-dayojTpn.js → transactionReceipt-DyOMk-YN.js} +1 -1
- package/_assets/{transactions-BqxmWzZz.js → transactions-VmU1Fomk.js} +1 -1
- package/_assets/{useCreditPacks-CHpQ4LEN.js → useCreditPacks-D1yz9_D9.js} +1 -1
- package/_assets/{useInfiniteGrid-sc2vmuxU.js → useInfiniteGrid-C-7TbIWI.js} +1 -1
- package/_assets/useManaRate-6JYRR5Sm.js +1 -0
- package/_assets/{useSecondarySales-C8BuUV_s.js → useSecondarySales-BhfHOcZl.js} +1 -1
- package/_assets/{useStore-D3ONm_sP.js → useStore-DCWOq5iS.js} +1 -1
- package/_assets/{useTheme-D8ClSCiJ.js → useTheme-DoVQgCCM.js} +1 -1
- package/_assets/{verifyHash-tNHFcENz.js → verifyHash-B-nszbU3.js} +1 -1
- package/_assets/{w3m-modal-D0qE5VS7.js → w3m-modal-C9EOWDq3.js} +1 -1
- package/_assets/{w3m-modal-BYIDrkH-.js → w3m-modal-y9ZrKukQ.js} +1 -1
- package/_assets/{wait-for-tx-receipt-C3lxZWQH.js → wait-for-tx-receipt-DL1snjgl.js} +1 -1
- package/_assets/{wallets-BlFrUv2a.js → wallets-CExmmU6y.js} +5 -5
- package/_assets/{web-connector-DzEBomI8.js → web-connector-vE0RE6CB.js} +3 -3
- package/_assets/{writeContract-CaaID3Lc.js → writeContract-B0sDSczf.js} +1 -1
- package/_assets/{zoraTestnet-Da9dTQUp.js → zoraTestnet-B_NFi9S-.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/_assets/ManaPricingBanner.styles-bQxgJp4R.js +0 -74
- package/_assets/authorizations-BeJcD0Ty.js +0 -1
- package/_assets/buy-5BIPC7Eq.js +0 -1
- package/_assets/categories-CmiNaFHh.js +0 -427
- package/_assets/hero-fashion-week-B9LOzkde.png +0 -0
- package/_assets/index-9_8O7Lhc.js +0 -3488
- package/_assets/index-BMzstP-8.css +0 -1
- package/_assets/promo-best-rated-emotes-C6kNvB-a.png +0 -0
- package/_assets/promo-week-selected-outfits-BBmkZYZx.png +0 -0
- package/_assets/useManaRate-Ceh_R3VR.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as j,j as e,L as Q,a as dt}from"./react-DehiWSvs.js";import{
|
|
1
|
+
import{r as j,j as e,L as Q,a as dt}from"./react-DehiWSvs.js";import{bm as lt,s as l,t as o,k as ut,B as ht,m as xt,e as d,n as mt,u as v,I as f,bn as G,bo as K,bp as pt,p as k,bq as gt,b2 as T,ao as ft,br as bt,bs as C}from"./index-B0wrSWVL.js";import{a as yt}from"./mana-convert-XtWFaGCt.js";import{u as jt}from"./useManaRate-6JYRR5Sm.js";import{L as vt}from"./LoadMore-DsWSQHxD.js";import{u as b}from"./useInfiniteGrid-C-7TbIWI.js";import{m as X}from"./mana-matic-C4e1sNO3.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";import"./mana-rate-CLS7fjKR.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?yt(t.manaWei,n):null,manaWei:t.manaWei,createdAt:t.createdAt,txHash:t.txHash}}function Lt(t){const s=At(t.purchases.filter(r=>r.status!=="EXPIRED")).map(r=>({kind:"purchase",id:`purchase:${r.id}`,createdAt:r.createdAt,order:r})),i=t.sales.map(r=>{const x=Pt(r,t.rate);return{kind:"sale",id:`sale:${x.id}`,createdAt:x.createdAt,sale:x}}),a=(t.creditOrders??[]).filter(r=>r.status!=="failed"&&r.status!=="abandoned").map(r=>({kind:"credit",id:`credit:${r.id}`,createdAt:r.createdAt,order:r})),c=new Set(t.purchases.filter(r=>r.txHash).map(r=>r.txHash.toLowerCase())),h=(t.manaPurchases??[]).filter(r=>!c.has(r.txHash.toLowerCase())).map(r=>({kind:"mana-purchase",id:`mana-purchase:${r.id}`,createdAt:r.createdAt,sale:r}));return[...s,...i,...a,...h].sort((r,x)=>x.createdAt-r.createdAt||(r.id<x.id?-1:1))}function Nt(t,n){return n==="all"?t:n==="sales"?t.filter(s=>s.kind==="sale"):t.filter(s=>s.kind==="purchase"||s.kind==="credit"||s.kind==="mana-purchase")}const Z=t=>t.trim().toLowerCase();function Et(t){const n=new Map;for(const s of t??[]){const i=Z(s.txHash??"");if(!i)continue;const a=n.get(i);a?a.push(s):n.set(i,[s])}return n}function Tt(t,n,s=Date.now()){const i=n.txHash?t.get(Z(n.txHash)):void 0;if(!i||i.length===0)return{kind:"direct"};const a=i.length===1?Ct(i[0].netCents):null,c=i.filter(r=>!r.available&&r.availableAt>s);if(c.length===0)return{kind:"credited",credits:a};const h=c.reduce((r,x)=>Math.max(r,x.availableAt),0);return{kind:"pending",credits:a,availableAt:h}}function Ct(t){return lt(t)}const Ft="https://cdn.decentraland.org/@dcl/shop/0.4.0/_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-DehiWSvs.js";import{s as u}from"./index-
|
|
1
|
+
import{r as l,j as v}from"./react-DehiWSvs.js";import{s as u}from"./index-B0wrSWVL.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";const S="https://cdn.decentraland.org/@dcl/shop/0.4.0/_assets/custom-welcome-background-BxlFQma9.webp",b="https://cdn.decentraland.org/@dcl/shop/0.4.0/_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{d as We,r as m,j as e,e as Qe}from"./react-DehiWSvs.js";import{c as F,
|
|
1
|
+
import{d as We,r as m,j as e,e as Qe}from"./react-DehiWSvs.js";import{c as F,b7 as Xe,b8 as Ye,d as et,s,t,n as Be,a_ as tt,q as nt,ao as ge,e as n,o as st,I as S,p as M,bv as ne,aZ as ot,O as Y,bb as it,ba as rt,m as Fe,aa as at,ac as _e,ad as q,aq as lt,bw as ct}from"./index-B0wrSWVL.js";import{u as dt}from"./useSecondarySales-BhfHOcZl.js";import{m as pt,a as Le}from"./mana-convert-XtWFaGCt.js";import{u as Ue}from"./useManaRate-6JYRR5Sm.js";import{g as ht,h as xt,i as ft,j as mt,k as ut,C as gt,l as bt,o as yt,m as wt,n as jt,M as vt,p as $t,E as Ct,q as kt,r as St,s as Et,t as Rt,u as _t,v as Tt}from"./Assets.styles-B2EWL6JB.js";import{S as Te,R as zt,F as It,e as At}from"./categories-D2JgaepG.js";import{L as Nt}from"./LoadMore-DsWSQHxD.js";import{u as Mt}from"./useInfiniteGrid-C-7TbIWI.js";import{E as Pt}from"./ErrorNotice-Cvc0nTjw.js";import{d as Wt}from"./dcl-schemas-Dr9BTjb7.js";import{s as Bt,G as Ft,w as Lt,S as Ut}from"./buy-gasless-DmFIjDH7.js";import{s as Ht}from"./buy-CfVy6xwA.js";import{i as Ot}from"./trade-encoding-Mw7kNWLf.js";import{r as Gt}from"./mana-rate-CLS7fjKR.js";import{f as Dt}from"./errors-CVWX9epA.js";import{J as qt,C as Vt,B as be}from"./ethers-CtNGBird.js";import{n as Zt}from"./Tooltip-fS4VCxQs.js";import{G as Kt}from"./grid.styles-C92STzz7.js";import"./sentry-973sfbO9.js";import"./intl-CBcMB1D2.js";import"./authorizations-Bm65kFBw.js";import"./sendMetaTransaction-DvDr2bCi.js";function V(o){const i=o.source??"item",a=o.tradeId||`${o.contractAddress}-${o.tokenId??o.itemId??""}`;return`${i}:${a}`}const L="100000000000000000000",He=2,ee=15,Jt=/^[a-zA-Z0-9]+$/;function ze(o){const i=o.trim();return i.length===0?{ok:!1,reason:"empty"}:Jt.test(i)?i.length<He?{ok:!1,reason:"too-short"}:i.length>ee?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Qt(o){return o.replace(/[^a-zA-Z0-9]/g,"").slice(0,ee)}const Xt=["function available(string _subdomain) view returns (bool)"],Ie={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Yt(){return F.chainId===Number(Wt.ChainId.MATIC_MAINNET)?Ie.mainnet:Ie.sepolia}async function en(o,i={}){var p;const{rpc:a,address:h}=Yt(),l=new qt(a),d=new Vt(h,Xt,l);console.info(`[names] availability check → DCLRegistrar(${h}).available("${o}") on ${a}`);const x=await d.available(o);if((p=i.signal)!=null&&p.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${o}" available=${x}`),x?"available":"taken"}const tn="https://app.across.to/api";class ye extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function nn(o){return pt(L,o)}async function sn(o,i,a={}){var p;const h=a.chainId??F.chainId,l=a.provider??"across",d=`${F.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(i)}&chainId=${h}&provider=${l}`,x=await et(d,{method:"GET",identity:o,metadata:{}});if(!x.ok){let r;try{r=(p=await x.json())==null?void 0:p.code}catch{}throw r==="ROUTE_COST_TOO_HIGH"?new ye:new Error(`fetchNameCreditRoute ${x.status}`)}return x.json()}function on(o,i){const a=be.from(o.availableAmount),l=be.from(L).sub(a);return{credits:[{value:o.amount,expiresAt:Number(o.expiresAt),salt:Ot(o.id)}],creditsSignatures:[o.signature],externalCall:{target:i.externalCall.target,selector:i.externalCall.selector,data:i.externalCall.data,expiresAt:i.externalCall.expiresAt,salt:i.externalCall.salt},customExternalCallSignature:i.customExternalCallSignature,maxUncreditedValue:l.isNegative()?"0":l.toString(),maxCreditedValue:L}}async function rn(o,i={}){const a=tn,h=i.intervalMs??1e4,l=i.maxAttempts??60;let d={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let x=0;x<l;x++){try{const p=await fetch(`${a}/deposit/status?originChainId=137&depositTxHash=${o}`);if(p.ok){const r=await p.json(),u=(r.status??"pending").toLowerCase(),g=r.fillTx??r.fillTxnRef??null,w=r.actionsSucceeded!==!1;if(u==="filled")return{status:"filled",destinationTxHash:g,actionsSucceeded:w};if(u==="refunded"||u==="expired")return{status:u,destinationTxHash:null,actionsSucceeded:!1};d={status:"pending",destinationTxHash:g,actionsSucceeded:w}}}catch{}x<l-1&&await new Promise(p=>setTimeout(p,h))}return d}async function an(o){const{name:i,identity:a,signer:h}=o,l=o.chainId??F.chainId,d=o.provider??"across",x=(o.beneficiary??await h.getAddress()).toLowerCase();let p=null,r=!1;console.info("[names] register start",{name:i,buyer:x,chainId:l,provider:d});try{const u=await Gt(l),g=nn(u);console.info("[names] step 1/6 sized reservation",{usdCents:g,manaRate:u});const w=await sn(a,i,{chainId:l,provider:d});console.info("[names] step 2/6 route fetched",{target:w.externalCall.target,selector:w.externalCall.selector,provider:w.provider,quoteId:w.quoteId});const j=await Xe(a,g);if(p=j.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:j.credit.id,maxCreditedValue:j.maxCreditedValue}),be.from(j.maxCreditedValue).lt(L))throw new Error("Credit under-sized for the name price");const k=on(j.credit,w);let f;try{f=await Bt({chainId:l,buyer:x,signer:h,args:k})}catch(b){if(!(b instanceof Ft))throw b;f=await Ht(l,k,h)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:f}),await Lt(f),r=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:f}),d==="across"){const b=await rn(f,o.acrossPoll);if(console.info("[names] step 6/6 across status",b),b.status==="pending")return{status:"pending",originTxHash:f};if(b.status!=="filled"||!b.actionsSucceeded)throw new Error("The name could not be registered on Ethereum; your funds were recovered.");return{status:"registered",originTxHash:f,destinationTxHash:b.destinationTxHash}}return{status:"pending",originTxHash:f}}catch(u){if(console.error("[names] register failed — raw error:",u,{name:i,buyer:x,originConfirmed:r}),u instanceof Ut)return{status:"pending",originTxHash:u.txHash};if(p&&!r&&await Ye(a,[p]).catch(()=>{}),u instanceof ye)throw u;const g=new Error(Dt(u,"Couldn't register the name. Please try again.",{sale:!0}));throw g.cause=u,g}}const ln=s.div`
|
|
2
2
|
position: fixed;
|
|
3
3
|
inset: 0;
|
|
4
4
|
z-index: 10000;
|
|
@@ -379,7 +379,7 @@ import{d as We,r as m,j as e,e as Qe}from"./react-DehiWSvs.js";import{c as F,b6
|
|
|
379
379
|
color: ${t.colors.accent};
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
-
`;function En({name:o,priceCredits:i,onClose:a}){const{session:h}=Be(),{data:l,isError:d}=tt(h),x=nt(),p=We(),[r,u]=m.useState("confirm"),[g,w]=m.useState(""),[j,k]=m.useState(null),f=m.useRef(!1),b=g.trim().toLowerCase()===o.toLowerCase(),v=r==="completing",E=i!=null?ge(i):"—",C=i==null,
|
|
382
|
+
`;function En({name:o,priceCredits:i,onClose:a}){const{session:h}=Be(),{data:l,isError:d}=tt(h),x=nt(),p=We(),[r,u]=m.useState("confirm"),[g,w]=m.useState(""),[j,k]=m.useState(null),f=m.useRef(!1),b=g.trim().toLowerCase()===o.toLowerCase(),v=r==="completing",E=i!=null?ge(i):"—",C=i==null,T=l==null?void 0:l.credits,R=i!=null&&T!=null?i-T:0,$=R>0,z=C?n("names.priceUnavailable"):$?n("names.insufficientCredits",{credits:ge(R)}):null;m.useEffect(()=>{const y=H=>{H.key==="Escape"&&!v&&a()};document.addEventListener("keydown",y);const U=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",y),document.body.style.overflow=U}},[v,a]);async function I(){if(!(!h||!b||C||$||f.current)){f.current=!0,u("completing"),k(null);try{const y=await an({name:o,identity:h.identity,signer:h.signer});Y("Shop Completed Purchase",{purchase_type:"name",is_primary:!0,payment_type:"credits",value_credits:i??null,settlement:y.status}),x.invalidateQueries({queryKey:["usd-balance"]}),x.invalidateQueries({queryKey:["my-assets"]}),u(y.status==="registered"?"success":"pending")}catch(y){Y(rt(y)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:it(y),purchase_type:"name"}),k(y instanceof ye?n("names.errorRouteCost"):(y==null?void 0:y.message)||n("names.errorGeneric")),u("error")}finally{f.current=!1}}}const A=r!=="success"&&r!=="pending",te=st(h==null?void 0:h.providerType);return e.jsx(ln,{onClick:v?void 0:a,role:"presentation",children:e.jsxs(cn,{role:"dialog","aria-modal":"true","aria-label":n("names.buyTitle"),onClick:y=>y.stopPropagation(),children:[A&&e.jsxs(e.Fragment,{children:[e.jsxs(se,{children:[e.jsx(oe,{children:r==="error"?n("names.errorTitle"):n("names.buyTitle")}),e.jsx(ie,{onClick:a,disabled:v,"aria-label":n("buyModal.close"),children:e.jsx(S,{name:"close"})})]}),e.jsxs(re,{children:[n("names.myCreditsBalance")," ",e.jsx(M,{})," ",ne(l,d)]}),e.jsx(ae,{})]}),(r==="confirm"||r==="error")&&e.jsxs(e.Fragment,{children:[e.jsxs(le,{children:[e.jsx(ce,{"aria-hidden":!0,children:"@"}),e.jsxs(de,{children:[e.jsxs(pe,{children:[o,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(he,{children:n("names.subtitle")})]}),e.jsxs(xe,{children:[e.jsx(M,{}),E]})]}),r==="error"?e.jsxs(e.Fragment,{children:[e.jsxs(fe,{children:[e.jsx(S,{name:"info","aria-hidden":!0}),e.jsx("span",{children:j})]}),e.jsx(Ae,{onClick:()=>u("confirm"),children:n("names.tryAgain")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(dn,{children:[e.jsx(pn,{children:n("names.confirmTitle")}),e.jsx(hn,{dangerouslySetInnerHTML:{__html:n("names.confirmBody",{name:`<b>@${Rn(o)}</b>`})}}),e.jsxs(xn,{children:[e.jsx(fn,{"aria-hidden":!0,children:"@"}),e.jsx(mn,{value:g,onChange:y=>w(y.target.value.replace(/[^a-zA-Z0-9]/g,"")),placeholder:"yourname","aria-label":n("names.reenterAria"),autoComplete:"off",spellCheck:!1,style:{width:`${Math.max(g.length,8)}ch`}}),e.jsx(un,{children:".dcl.eth"})]})]}),z?e.jsxs(fe,{"data-tone":"info","data-testid":"name-blocked-reason",children:[e.jsx(S,{name:"info","aria-hidden":!0}),e.jsx("span",{children:z})]}):null,e.jsx(Ae,{onClick:()=>void I(),disabled:!b||!h||C||$,children:n("names.buyCta")})]})]}),r==="completing"&&e.jsxs(gn,{children:[e.jsx(bn,{src:ot,alt:"",width:56,height:56}),e.jsx(yn,{children:te?n("names.confirming"):n("names.completing")}),e.jsxs(wn,{children:[e.jsx(jn,{"aria-hidden":!0,children:e.jsx("span",{})}),e.jsx(vn,{children:"1/1"})]})]}),r==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(se,{children:[e.jsx(oe,{children:n("names.pendingHeaderTitle")}),e.jsx(ie,{onClick:a,"aria-label":n("buyModal.close"),children:e.jsx(S,{name:"close"})})]}),e.jsxs(re,{children:[n("names.myCreditsBalance")," ",e.jsx(M,{})," ",ne(l,d)]}),e.jsx(ae,{}),e.jsxs(fe,{"data-tone":"info",children:[e.jsx(S,{name:"info","aria-hidden":!0}),e.jsxs("span",{children:[e.jsx("b",{children:n("names.pendingBannerBold")})," ",n("names.pendingBannerRest")]})]}),e.jsxs(le,{style:{marginTop:20},children:[e.jsx(ce,{"aria-hidden":!0,children:"@"}),e.jsxs(de,{children:[e.jsxs(pe,{children:[o,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(he,{children:n("names.subtitle")})]}),e.jsxs(xe,{children:[e.jsx(M,{}),E]})]}),e.jsx(Ne,{children:e.jsx(Me,{onClick:()=>{a(),p("/my-items")},children:n("names.myItems")})})]}),r==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs(se,{children:[e.jsx(oe,{children:n("names.successHeaderTitle")}),e.jsx(ie,{onClick:a,"aria-label":n("buyModal.close"),children:e.jsx(S,{name:"close"})})]}),e.jsxs(re,{children:[n("names.myCreditsBalance")," ",e.jsx(M,{})," ",ne(l,d)]}),e.jsx(ae,{}),e.jsxs($n,{children:[e.jsx(Cn,{"aria-hidden":!0,children:e.jsx(S,{name:"check"})}),e.jsxs(kn,{children:[e.jsx("b",{children:n("names.successBannerBold")})," ",n("names.successBannerRest")]})]}),e.jsxs(le,{style:{marginTop:20},children:[e.jsx(ce,{"aria-hidden":!0,children:"@"}),e.jsxs(de,{children:[e.jsxs(pe,{children:[o,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(he,{children:n("names.subtitle")})]}),e.jsxs(xe,{children:[e.jsx(M,{}),E]})]}),e.jsxs(Ne,{children:[e.jsx(Me,{onClick:()=>{a(),p("/my-items")},children:n("names.myItems")}),e.jsx(Sn,{href:F.profileUrl,target:"_blank",rel:"noopener noreferrer",children:n("names.assignToAvatar")})]})]})]})})}function Rn(o){return o.replace(/[&<>"']/g,i=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[i])}const _n="https://cdn.decentraland.org/@dcl/shop/0.4.0/_assets/identity-B4DXDuJP.webp",Tn="https://cdn.decentraland.org/@dcl/shop/0.4.0/_assets/world-B-9aPlxu.webp",zn="https://cdn.decentraland.org/@dcl/shop/0.4.0/_assets/invite-BfwIhP2C.webp",In="https://cdn.decentraland.org/@dcl/shop/0.4.0/_assets/governance-DnazlIjy.webp",An=s.div`
|
|
383
383
|
width: 100%;
|
|
384
384
|
min-width: 0;
|
|
385
385
|
`,Nn=s.nav`
|
|
@@ -797,4 +797,4 @@ import{d as We,r as m,j as e,e as Qe}from"./react-DehiWSvs.js";import{c as F,b6
|
|
|
797
797
|
clip: rect(0, 0, 0, 0);
|
|
798
798
|
white-space: nowrap;
|
|
799
799
|
border: 0;
|
|
800
|
-
`,ls="https://docs.decentraland.org/creator/worlds/about/",cs="https://governance.decentraland.org";function ds(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 ps({onBack:o}){Fe({title:n("seo.names.title"),description:n("seo.names.description")});const{session:i,signIn:a}=Be(),{data:h}=Ue(),l=h?Le(L,h):null,[d,x]=m.useState(""),[p,r]=m.useState("idle"),[u,g]=m.useState(!1),w=m.useRef(null),[j,k]=m.useState(void 0);m.useLayoutEffect(()=>{w.current&&k(w.current.offsetWidth)},[d]),m.useEffect(()=>{if(!ze(d).ok){r(d.length===0?"idle":"invalid");return}r("checking");const _=new AbortController,R=setTimeout(()=>{(async()=>{try{const $=await en(d,{signal:_.signal});r($)}catch($){if(($==null?void 0:$.name)==="AbortError")return;r("error")}})()},400);return()=>{clearTimeout(R),_.abort()}},[d]);const f=ze(d),b=f.ok&&(p==="available"||p==="error");function v(){if(b){if(!i){a();return}g(!0)}}const E=e.jsxs(e.Fragment,{children:[n("names.claim"),l!=null?e.jsxs(es,{children:[e.jsx(M,{}),ge(l)]}):null]});return e.jsxs(An,{"data-testid":"names-page",children:[e.jsxs(Nn,{"aria-label":n("names.breadcrumbAria"),children:[e.jsx(Mn,{onClick:o,children:n("names.breadcrumbCollectibles")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(Pn,{children:n("names.breadcrumbCurrent")})]}),e.jsxs(Wn,{children:[e.jsxs(Bn,{children:[e.jsxs(Fn,{children:[e.jsx(Ln,{children:n("names.heroTitle")}),e.jsx(Un,{children:n("names.heroSubtitle")})]}),e.jsxs(Hn,{children:[e.jsxs(On,{children:[e.jsxs(Gn,{invalid:p==="taken",children:[e.jsxs(Zn,{children:[e.jsx(Kn,{"aria-hidden":!0,children:"@"}),e.jsx(Jn,{value:d,onChange:C=>x(Qt(C.target.value)),placeholder:n("names.inputPlaceholder"),"aria-label":n("names.inputAria"),autoComplete:"off",spellCheck:!1,maxLength:ee,style:{width:j!=null?`${j}px`:void 0}}),e.jsx(Dn,{ref:w,"aria-hidden":!0,children:d||n("names.inputPlaceholder")}),e.jsx(Qn,{children:n("names.suffix")})]}),d.length>0?e.jsxs(Xn,{"aria-hidden":!0,children:[d.length,"/",ee]}):null,e.jsx(Oe,{onClick:v,disabled:!b,"data-testid":"names-claim",children:E})]}),p==="taken"?e.jsxs(qn,{role:"status","data-testid":"names-taken",children:[e.jsx(S,{name:"info",size:16,"aria-hidden":!0}),e.jsx("span",{children:n("names.taken")}),e.jsxs(Vn,{href:ds(d),target:"_blank",rel:"noopener noreferrer",children:[n("names.takenMakeOffer"),e.jsx(S,{name:"external-link",size:13,"aria-hidden":!0})]})]}):null]}),e.jsx(Yn,{onClick:v,disabled:!b,children:E}),p==="checking"?e.jsx(me,{tone:"muted",role:"status","data-testid":"names-checking",children:n("names.checking")}):p==="error"?e.jsx(me,{tone:"muted",role:"status",children:n("names.checkError")}):p==="invalid"&&!f.ok&&f.reason==="too-short"?e.jsx(me,{tone:"muted",role:"status",children:n("names.tooShort",{min:He})}):null,e.jsx(as,{role:"status","aria-live":"polite",children:p==="available"?n("names.available",{name:d}):""})]})]}),e.jsxs(ts,{children:[e.jsxs(ns,{children:[e.jsx(ss,{children:n("names.whyTitle")}),e.jsx(os,{children:n("names.whyIntro")})]}),e.jsxs(is,{children:[e.jsxs(Z,{children:[e.jsx(K,{src:Tn,alt:""}),e.jsxs(J,{children:[e.jsx(Q,{children:n("names.why1Title")}),e.jsx(X,{children:n("names.why1")})]})]}),e.jsxs(Z,{children:[e.jsx(K,{src:_n,alt:""}),e.jsxs(J,{children:[e.jsx(Q,{children:n("names.why2Title")}),e.jsxs(X,{children:[n("names.why2")," ",e.jsx(rs,{children:n("names.why2Address")})]}),e.jsxs(Pe,{href:ls,target:"_blank",rel:"noopener noreferrer",children:[n("names.learnMore"),e.jsx(S,{name:"external-link","aria-hidden":!0})]})]})]}),e.jsxs(Z,{children:[e.jsx(K,{src:zn,alt:""}),e.jsxs(J,{children:[e.jsx(Q,{children:n("names.why3Title")}),e.jsx(X,{children:n("names.why3")})]})]}),e.jsxs(Z,{children:[e.jsx(K,{src:In,alt:""}),e.jsxs(J,{children:[e.jsx(Q,{children:n("names.why4Title")}),e.jsx(X,{children:n("names.why4")}),e.jsxs(Pe,{href:cs,target:"_blank",rel:"noopener noreferrer",children:[n("names.learnMore"),e.jsx(S,{name:"external-link","aria-hidden":!0})]})]})]})]})]})]}),u?e.jsx(En,{name:d,priceCredits:l,onClose:()=>g(!1)}):null]})}const hs="data:image/svg+xml,%3csvg%20width='101'%20height='101'%20viewBox='0%200%20101%20101'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M42.4493%2040.9855L30.7394%2052.6954'%20stroke='%23FF5A57'%20stroke-width='3.15625'%20stroke-linecap='round'/%3e%3cpath%20d='M30.7391%2040.9855L42.449%2052.6954'%20stroke='%23FF5A57'%20stroke-width='3.15625'%20stroke-linecap='round'/%3e%3cpath%20d='M36.2621%2071.0604C29.6047%2071.0604%2023.9709%2068.7542%2019.3608%2064.1416C14.7507%2059.5291%2012.4445%2053.8953%2012.442%2047.2404C12.4396%2040.5854%2014.7459%2034.9516%2019.3608%2030.3391C23.9758%2025.7266%2029.6096%2023.4203%2036.2621%2023.4203C42.9146%2023.4203%2048.5496%2025.7266%2053.167%2030.3391C57.7844%2034.9516%2060.0895%2040.5854%2060.0822%2047.2404C60.0822%2049.9277%2059.6546%2052.4624%2058.7995%2054.8445C57.9445%2057.2265%2056.784%2059.3336%2055.3181%2061.1659L75.84%2081.6878C76.5119%2082.3597%2076.8478%2083.2148%2076.8478%2084.2531C76.8478%2085.2914%2076.5119%2086.1465%2075.84%2086.8183C75.1682%2087.4902%2074.3131%2087.8261%2073.2748%2087.8261C72.2365%2087.8261%2071.3814%2087.4902%2070.7096%2086.8183L50.1877%2066.2964C48.3554%2067.7623%2046.2482%2068.9227%2043.8662%2069.7778C41.4842%2070.6329%2038.9495%2071.0604%2036.2621%2071.0604ZM36.2621%2063.7312C40.8429%2063.7312%2044.7372%2062.1285%2047.9449%2058.9232C51.1527%2055.7179%2052.7554%2051.8236%2052.7529%2047.2404C52.7505%2042.6571%2051.1478%2038.7641%2047.9449%2035.5612C44.742%2032.3583%2040.8478%2030.7544%2036.2621%2030.7495C31.6764%2030.7447%2027.7834%2032.3485%2024.5829%2035.5612C21.3825%2038.7739%2019.7786%2042.6669%2019.7713%2047.2404C19.764%2051.8138%2021.3678%2055.7081%2024.5829%2058.9232C27.798%2062.1383%2031.6911%2063.7409%2036.2621%2063.7312Z'%20fill='url(%23paint0_linear_search_empty)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_search_empty'%20x1='10.4127'%20y1='55.6273'%20x2='124.009'%20y2='44.925'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FF2D55'/%3e%3cstop%20offset='1'%20stop-color='%23FFBC5B'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",ue=48;function Ps(){const[o]=Qe(),i=We(),a=(o.get("q")??"").trim().toLowerCase(),h=(o.get("q")??"").trim();Fe({title:h?n("seo.collectibles.searchTitle",{query:h}):n("seo.collectibles.title"),description:n("seo.collectibles.description")});const[l,d]=m.useState("wearable"),[x,p]=m.useState(null),[r,u]=m.useState([]),[g,w]=m.useState(""),[j,k]=m.useState(""),[f,b]=m.useState("on_sale"),[v,E]=m.useState(!1),[C,_]=m.useState("newest"),[R,$]=m.useState(!1);m.useEffect(()=>{if(!R)return;const c=W=>{W.key==="Escape"&&$(!1)};document.addEventListener("keydown",c);const T=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",c),document.body.style.overflow=T}},[R]);const z=f==="on_sale",I=g&&!Number.isNaN(Number(g))?Number(g):void 0,A=j&&!Number.isNaN(Number(j))?Number(j):void 0,te=dt(),y=x?At[x]:void 0,U=(_e.find(c=>c.key===C)??_e[0]).server,H={category:l,rarities:r.length?r:void 0,wearableCategories:y,minPriceCredits:I,maxPriceCredits:A,search:a||void 0,sortBy:U,isSmart:v||void 0,onSale:!0,listingType:te?void 0:"primary"},we={category:l,rarities:r.length?r:void 0,wearableCategories:y,search:a||void 0,sortBy:U,isWearableSmart:v||void 0,isOnSale:f==="not_for_sale"?!1:void 0},{items:O,total:je,isLoading:N,isPlaceholderData:P,error:ve,hasNextPage:Ge,isFetchingNextPage:$e,isFetchNextPageError:De,fetchNextPage:qe}=Mt(z?["shop-items",H]:["catalog-items",we],c=>z?lt({...H,first:ue,skip:c}):ct({...we,first:ue,skip:c}),{enabled:l!=="names"}),G=je,Ce=N||P,Ve=N?15:Math.min(Math.max(O.length,1),ue),{data:ke,isError:Ze}=Ue(),Ke=c=>ke&&c.manaWei?Le(c.manaWei,ke):null,Se=m.useRef(null);m.useEffect(()=>{N||P||!a||Se.current===a||(Se.current=a,Y("Shop Searched",{query:a,result_count:G}))},[a,N,P,G]);const D=m.useRef("__init__");m.useEffect(()=>{if(N||P)return;const c=JSON.stringify({category:l,subCategory:x,rarities:r,min:I,max:A,sort:C,status:f,smart:v});if(D.current==="__init__"||D.current===c){D.current=c;return}D.current=c,Y("Shop Applied Filter",{filters:{category:l,sub_category:x,rarities:r,min_price_credits:I??null,max_price_credits:A??null,status:f,smart:v,sort:C},result_count:G})},[l,x,r,I,A,C,f,v,N,P,G]);function Ee(c){d(c),p(null)}function Re(c){u(T=>T.includes(c)?T.filter(W=>W!==c):[...T,c])}function Je(){d("wearable"),p(null),u([]),w(""),k(""),b("on_sale"),E(!1)}const B=[];(I!=null||A!=null)&&B.push({key:"price",label:n("filter.price"),onRemove:()=>{w(""),k("")}});for(const c of zt)r.includes(c)&&B.push({key:`rarity-${c}`,label:at(c),onRemove:()=>Re(c)});return v&&B.push({key:"smart",label:n("filter.smart"),onRemove:()=>E(!1)}),f!=="on_sale"&&B.push({key:"status",label:f==="all"?n("filter.statusAll"):n("filter.notForSale"),onRemove:()=>b("on_sale")}),e.jsxs(ht,{"data-testid":"browse",children:[l!=="names"&&e.jsxs(e.Fragment,{children:[R?e.jsx(xt,{onClick:()=>$(!1),"aria-hidden":!0}):null,e.jsxs(ft,{"data-open":R||void 0,"data-testid":"browse-sidebar",children:[e.jsxs(mt,{children:[e.jsx(ut,{children:n("assets.filters")}),e.jsx(gt,{onClick:()=>$(!1),"aria-label":n("assets.closeFilters"),children:"✕"})]}),e.jsx(bt,{children:e.jsx(yt,{category:l,subCategory:x,onCategory:Ee,onSub:p,priceMin:g,priceMax:j,onPriceMin:w,onPriceMax:k,rarities:r,onToggleRarity:Re,status:f,onStatus:b,smart:v,onSmart:E})}),e.jsx(wt,{children:e.jsx(jt,{type:"button",onClick:()=>$(!1),children:n("assets.showItems")})})]})]}),e.jsx(vt,{children:l==="names"?e.jsx(ps,{onBack:()=>Ee("wearable")}):e.jsxs(e.Fragment,{children:[e.jsx(It,{sort:C,onSort:_,total:je,loading:N||P,query:a,onOpenFilters:()=>$(!0),chips:B,onClearChips:Je}),Ze&&z&&O.some(c=>c.source==="legacy")?e.jsx($t,{"data-variant":"warn",children:n("assets.marketUnavailable")}):null,ve?e.jsx(Pt,{message:n("assets.loadError"),testId:"browse-error"}):null,!Ce&&O.length===0&&!ve?e.jsxs(Ct,{"data-testid":"browse-empty",children:[e.jsx(kt,{src:hs,alt:""}),e.jsxs(St,{children:[e.jsx(Et,{children:n("assets.empty.title")}),e.jsx(Rt,{children:h?e.jsxs(e.Fragment,{children:[n("assets.empty.searchBefore"),e.jsx("b",{children:h}),n("assets.empty.searchAfter")]}):n("assets.empty.filters")})]}),e.jsx(Tt,{children:e.jsx(_t,{type:"button",onClick:()=>i("/overview"),children:n("assets.empty.cta")})})]}):e.jsxs(e.Fragment,{children:[e.jsx(Kt,{"data-testid":"grid",children:Ce?e.jsx(Te,{count:Ve}):e.jsxs(e.Fragment,{children:[O.map(c=>{if(!z)return e.jsx(q,{item:c,mode:"view"},V(c));const T=c;if(T.source!=="legacy")return e.jsx(q,{item:c},V(c));const W=Ke(T);return W==null?e.jsx(q,{item:c,mode:"view"},V(c)):e.jsx(q,{item:{...T,priceCredits:W}},V(c))}),$e?e.jsx(Te,{count:6}):null]})}),e.jsx(Nt,{hasNextPage:Ge,isFetching:$e,isError:De,onLoadMore:()=>void qe()})]})]})})]})}export{Ps as Assets};
|
|
800
|
+
`,ls="https://docs.decentraland.org/creator/worlds/about/",cs="https://governance.decentraland.org";function ds(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 ps({onBack:o}){Fe({title:n("seo.names.title"),description:n("seo.names.description")});const{session:i,signIn:a}=Be(),{data:h}=Ue(),l=h?Le(L,h):null,[d,x]=m.useState(""),[p,r]=m.useState("idle"),[u,g]=m.useState(!1),w=m.useRef(null),[j,k]=m.useState(void 0);m.useLayoutEffect(()=>{w.current&&k(w.current.offsetWidth)},[d]),m.useEffect(()=>{if(!ze(d).ok){r(d.length===0?"idle":"invalid");return}r("checking");const T=new AbortController,R=setTimeout(()=>{(async()=>{try{const $=await en(d,{signal:T.signal});r($)}catch($){if(($==null?void 0:$.name)==="AbortError")return;r("error")}})()},400);return()=>{clearTimeout(R),T.abort()}},[d]);const f=ze(d),b=f.ok&&(p==="available"||p==="error");function v(){if(b){if(!i){a();return}g(!0)}}const E=e.jsxs(e.Fragment,{children:[n("names.claim"),l!=null?e.jsxs(es,{children:[e.jsx(M,{}),ge(l)]}):null]});return e.jsxs(An,{"data-testid":"names-page",children:[e.jsxs(Nn,{"aria-label":n("names.breadcrumbAria"),children:[e.jsx(Mn,{onClick:o,children:n("names.breadcrumbCollectibles")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(Pn,{children:n("names.breadcrumbCurrent")})]}),e.jsxs(Wn,{children:[e.jsxs(Bn,{children:[e.jsxs(Fn,{children:[e.jsx(Ln,{children:n("names.heroTitle")}),e.jsx(Un,{children:n("names.heroSubtitle")})]}),e.jsxs(Hn,{children:[e.jsxs(On,{children:[e.jsxs(Gn,{invalid:p==="taken",children:[e.jsxs(Zn,{children:[e.jsx(Kn,{"aria-hidden":!0,children:"@"}),e.jsx(Jn,{value:d,onChange:C=>x(Qt(C.target.value)),placeholder:n("names.inputPlaceholder"),"aria-label":n("names.inputAria"),autoComplete:"off",spellCheck:!1,maxLength:ee,style:{width:j!=null?`${j}px`:void 0}}),e.jsx(Dn,{ref:w,"aria-hidden":!0,children:d||n("names.inputPlaceholder")}),e.jsx(Qn,{children:n("names.suffix")})]}),d.length>0?e.jsxs(Xn,{"aria-hidden":!0,children:[d.length,"/",ee]}):null,e.jsx(Oe,{onClick:v,disabled:!b,"data-testid":"names-claim",children:E})]}),p==="taken"?e.jsxs(qn,{role:"status","data-testid":"names-taken",children:[e.jsx(S,{name:"info",size:16,"aria-hidden":!0}),e.jsx("span",{children:n("names.taken")}),e.jsxs(Vn,{href:ds(d),target:"_blank",rel:"noopener noreferrer",children:[n("names.takenMakeOffer"),e.jsx(S,{name:"external-link",size:13,"aria-hidden":!0})]})]}):null]}),e.jsx(Yn,{onClick:v,disabled:!b,children:E}),p==="checking"?e.jsx(me,{tone:"muted",role:"status","data-testid":"names-checking",children:n("names.checking")}):p==="error"?e.jsx(me,{tone:"muted",role:"status",children:n("names.checkError")}):p==="invalid"&&!f.ok&&f.reason==="too-short"?e.jsx(me,{tone:"muted",role:"status",children:n("names.tooShort",{min:He})}):null,e.jsx(as,{role:"status","aria-live":"polite",children:p==="available"?n("names.available",{name:d}):""})]})]}),e.jsxs(ts,{children:[e.jsxs(ns,{children:[e.jsx(ss,{children:n("names.whyTitle")}),e.jsx(os,{children:n("names.whyIntro")})]}),e.jsxs(is,{children:[e.jsxs(Z,{children:[e.jsx(K,{src:_n,alt:""}),e.jsxs(J,{children:[e.jsx(Q,{children:n("names.why1Title")}),e.jsx(X,{children:n("names.why1")})]})]}),e.jsxs(Z,{children:[e.jsx(K,{src:Tn,alt:""}),e.jsxs(J,{children:[e.jsx(Q,{children:n("names.why2Title")}),e.jsxs(X,{children:[n("names.why2")," ",e.jsx(rs,{children:n("names.why2Address")})]}),e.jsxs(Pe,{href:ls,target:"_blank",rel:"noopener noreferrer",children:[n("names.learnMore"),e.jsx(S,{name:"external-link","aria-hidden":!0})]})]})]}),e.jsxs(Z,{children:[e.jsx(K,{src:zn,alt:""}),e.jsxs(J,{children:[e.jsx(Q,{children:n("names.why3Title")}),e.jsx(X,{children:n("names.why3")})]})]}),e.jsxs(Z,{children:[e.jsx(K,{src:In,alt:""}),e.jsxs(J,{children:[e.jsx(Q,{children:n("names.why4Title")}),e.jsx(X,{children:n("names.why4")}),e.jsxs(Pe,{href:cs,target:"_blank",rel:"noopener noreferrer",children:[n("names.learnMore"),e.jsx(S,{name:"external-link","aria-hidden":!0})]})]})]})]})]})]}),u?e.jsx(En,{name:d,priceCredits:l,onClose:()=>g(!1)}):null]})}const hs="data:image/svg+xml,%3csvg%20width='101'%20height='101'%20viewBox='0%200%20101%20101'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M42.4493%2040.9855L30.7394%2052.6954'%20stroke='%23FF5A57'%20stroke-width='3.15625'%20stroke-linecap='round'/%3e%3cpath%20d='M30.7391%2040.9855L42.449%2052.6954'%20stroke='%23FF5A57'%20stroke-width='3.15625'%20stroke-linecap='round'/%3e%3cpath%20d='M36.2621%2071.0604C29.6047%2071.0604%2023.9709%2068.7542%2019.3608%2064.1416C14.7507%2059.5291%2012.4445%2053.8953%2012.442%2047.2404C12.4396%2040.5854%2014.7459%2034.9516%2019.3608%2030.3391C23.9758%2025.7266%2029.6096%2023.4203%2036.2621%2023.4203C42.9146%2023.4203%2048.5496%2025.7266%2053.167%2030.3391C57.7844%2034.9516%2060.0895%2040.5854%2060.0822%2047.2404C60.0822%2049.9277%2059.6546%2052.4624%2058.7995%2054.8445C57.9445%2057.2265%2056.784%2059.3336%2055.3181%2061.1659L75.84%2081.6878C76.5119%2082.3597%2076.8478%2083.2148%2076.8478%2084.2531C76.8478%2085.2914%2076.5119%2086.1465%2075.84%2086.8183C75.1682%2087.4902%2074.3131%2087.8261%2073.2748%2087.8261C72.2365%2087.8261%2071.3814%2087.4902%2070.7096%2086.8183L50.1877%2066.2964C48.3554%2067.7623%2046.2482%2068.9227%2043.8662%2069.7778C41.4842%2070.6329%2038.9495%2071.0604%2036.2621%2071.0604ZM36.2621%2063.7312C40.8429%2063.7312%2044.7372%2062.1285%2047.9449%2058.9232C51.1527%2055.7179%2052.7554%2051.8236%2052.7529%2047.2404C52.7505%2042.6571%2051.1478%2038.7641%2047.9449%2035.5612C44.742%2032.3583%2040.8478%2030.7544%2036.2621%2030.7495C31.6764%2030.7447%2027.7834%2032.3485%2024.5829%2035.5612C21.3825%2038.7739%2019.7786%2042.6669%2019.7713%2047.2404C19.764%2051.8138%2021.3678%2055.7081%2024.5829%2058.9232C27.798%2062.1383%2031.6911%2063.7409%2036.2621%2063.7312Z'%20fill='url(%23paint0_linear_search_empty)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_search_empty'%20x1='10.4127'%20y1='55.6273'%20x2='124.009'%20y2='44.925'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FF2D55'/%3e%3cstop%20offset='1'%20stop-color='%23FFBC5B'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",ue=48;function Ps(){const[o]=Qe(),i=We(),a=(o.get("q")??"").trim().toLowerCase(),h=(o.get("q")??"").trim();Fe({title:h?n("seo.collectibles.searchTitle",{query:h}):n("seo.collectibles.title"),description:n("seo.collectibles.description")});const[l,d]=m.useState("wearable"),[x,p]=m.useState(null),[r,u]=m.useState([]),[g,w]=m.useState(""),[j,k]=m.useState(""),[f,b]=m.useState("on_sale"),[v,E]=m.useState(!1),[C,T]=m.useState("newest"),[R,$]=m.useState(!1);m.useEffect(()=>{if(!R)return;const c=W=>{W.key==="Escape"&&$(!1)};document.addEventListener("keydown",c);const _=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",c),document.body.style.overflow=_}},[R]);const z=f==="on_sale",I=g&&!Number.isNaN(Number(g))?Number(g):void 0,A=j&&!Number.isNaN(Number(j))?Number(j):void 0,te=dt(),y=x?At[x]:void 0,U=(Te.find(c=>c.key===C)??Te[0]).server,H={category:l,rarities:r.length?r:void 0,wearableCategories:y,minPriceCredits:I,maxPriceCredits:A,search:a||void 0,sortBy:U,isSmart:v||void 0,onSale:!0,listingType:te?void 0:"primary"},we={category:l,rarities:r.length?r:void 0,wearableCategories:y,search:a||void 0,sortBy:U,isWearableSmart:v||void 0,isOnSale:f==="not_for_sale"?!1:void 0},{items:O,total:je,isLoading:N,isPlaceholderData:P,error:ve,hasNextPage:Ge,isFetchingNextPage:$e,isFetchNextPageError:De,fetchNextPage:qe}=Mt(z?["shop-items",H]:["catalog-items",we],c=>z?lt({...H,first:ue,skip:c}):ct({...we,first:ue,skip:c}),{enabled:l!=="names"}),G=je,Ce=N||P,Ve=N?15:Math.min(Math.max(O.length,1),ue),{data:ke,isError:Ze}=Ue(),Ke=c=>ke&&c.manaWei?Le(c.manaWei,ke):null,Se=m.useRef(null);m.useEffect(()=>{N||P||!a||Se.current===a||(Se.current=a,Y("Shop Searched",{query:a,result_count:G}))},[a,N,P,G]);const D=m.useRef("__init__");m.useEffect(()=>{if(N||P)return;const c=JSON.stringify({category:l,subCategory:x,rarities:r,min:I,max:A,sort:C,status:f,smart:v});if(D.current==="__init__"||D.current===c){D.current=c;return}D.current=c,Y("Shop Applied Filter",{filters:{category:l,sub_category:x,rarities:r,min_price_credits:I??null,max_price_credits:A??null,status:f,smart:v,sort:C},result_count:G})},[l,x,r,I,A,C,f,v,N,P,G]);function Ee(c){d(c),p(null)}function Re(c){u(_=>_.includes(c)?_.filter(W=>W!==c):[..._,c])}function Je(){d("wearable"),p(null),u([]),w(""),k(""),b("on_sale"),E(!1)}const B=[];(I!=null||A!=null)&&B.push({key:"price",label:n("filter.price"),onRemove:()=>{w(""),k("")}});for(const c of zt)r.includes(c)&&B.push({key:`rarity-${c}`,label:at(c),onRemove:()=>Re(c)});return v&&B.push({key:"smart",label:n("filter.smart"),onRemove:()=>E(!1)}),f!=="on_sale"&&B.push({key:"status",label:f==="all"?n("filter.statusAll"):n("filter.notForSale"),onRemove:()=>b("on_sale")}),e.jsxs(ht,{"data-testid":"browse",children:[l!=="names"&&e.jsxs(e.Fragment,{children:[R?e.jsx(xt,{onClick:()=>$(!1),"aria-hidden":!0}):null,e.jsxs(ft,{"data-open":R||void 0,"data-testid":"browse-sidebar",children:[e.jsxs(mt,{children:[e.jsx(ut,{children:n("assets.filters")}),e.jsx(gt,{onClick:()=>$(!1),"aria-label":n("assets.closeFilters"),children:"✕"})]}),e.jsx(bt,{children:e.jsx(yt,{category:l,subCategory:x,onCategory:Ee,onSub:p,priceMin:g,priceMax:j,onPriceMin:w,onPriceMax:k,rarities:r,onToggleRarity:Re,status:f,onStatus:b,smart:v,onSmart:E})}),e.jsx(wt,{children:e.jsx(jt,{type:"button",onClick:()=>$(!1),children:n("assets.showItems")})})]})]}),e.jsx(vt,{children:l==="names"?e.jsx(ps,{onBack:()=>Ee("wearable")}):e.jsxs(e.Fragment,{children:[e.jsx(It,{sort:C,onSort:T,total:je,loading:N||P,query:a,onOpenFilters:()=>$(!0),chips:B,onClearChips:Je}),Ze&&z&&O.some(c=>c.source==="legacy")?e.jsx($t,{"data-variant":"warn",children:n("assets.marketUnavailable")}):null,ve?e.jsx(Pt,{message:n("assets.loadError"),testId:"browse-error"}):null,!Ce&&O.length===0&&!ve?e.jsxs(Ct,{"data-testid":"browse-empty",children:[e.jsx(kt,{src:hs,alt:""}),e.jsxs(St,{children:[e.jsx(Et,{children:n("assets.empty.title")}),e.jsx(Rt,{children:h?e.jsxs(e.Fragment,{children:[n("assets.empty.searchBefore"),e.jsx("b",{children:h}),n("assets.empty.searchAfter")]}):n("assets.empty.filters")})]}),e.jsx(_t,{children:e.jsx(Tt,{type:"button",onClick:()=>i("/overview"),children:n("assets.empty.cta")})})]}):e.jsxs(e.Fragment,{children:[e.jsx(Kt,{"data-testid":"grid",children:Ce?e.jsx(_e,{count:Ve}):e.jsxs(e.Fragment,{children:[O.map(c=>{if(!z)return e.jsx(q,{item:c,mode:"view"},V(c));const _=c;if(_.source!=="legacy")return e.jsx(q,{item:c},V(c));const W=Ke(_);return W==null?e.jsx(q,{item:c,mode:"view"},V(c)):e.jsx(q,{item:{..._,priceCredits:W}},V(c))}),$e?e.jsx(_e,{count:6}):null]})}),e.jsx(Nt,{hasNextPage:Ge,isFetching:$e,isError:De,onLoadMore:()=>void qe()})]})]})})]})}export{Ps as Assets};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as $,j as t}from"./react-DehiWSvs.js";import{R as C,C as oe,a as ie,b as ne}from"./categories-
|
|
1
|
+
import{r as $,j as t}from"./react-DehiWSvs.js";import{R as C,C as oe,a as ie,b as ne}from"./categories-D2JgaepG.js";import{n as c,T as se}from"./Tooltip-fS4VCxQs.js";import{t as e,s as o,I as g,e as s,aa as ae,f as v}from"./index-B0wrSWVL.js";const re=o.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 12px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as i,L as _,r as P}from"./react-DehiWSvs.js";import{s as n,B as W,t as a,k as R,m as F,e,n as G,o as O,I as z,p as B,u as w,q as K,c as Q,v as H,w as A,l as X,x as Z,y as T}from"./index-
|
|
1
|
+
import{j as i,L as _,r as P}from"./react-DehiWSvs.js";import{s as n,B as W,t as a,k as R,m as F,e,n as G,o as O,I as z,p as B,u as w,q as K,c as Q,v as H,w as A,l as X,x as Z,y as T}from"./index-B0wrSWVL.js";import{a as J,b as U,d as V,f as Y,s as tt,h as it}from"./authorizations-Bm65kFBw.js";import{f as et}from"./builder-CPpn-LV6.js";import{m as ot}from"./mana-matic-C4e1sNO3.js";import{f as at}from"./errors-CVWX9epA.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-DvDr2bCi.js";const nt=R`
|
|
2
2
|
to { transform: rotate(360deg); }
|
|
3
3
|
`,st=R`
|
|
4
4
|
to { background-position: -200% 0; }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,L as Se,r as P,d as ea,b as ta}from"./react-DehiWSvs.js";import{t as le,s as i,e as s,ao as de,
|
|
1
|
+
import{j as e,L as Se,r as P,d as ea,b as ta}from"./react-DehiWSvs.js";import{t as le,s as i,e as s,ao as de,aZ as aa,an as sa,I as O,p as Mt,a9 as Ne,m as na,L as Q,ab as dt,n as ia,u as ra,a_ as oa,q as ca,a$ as da,b0 as la,b1 as ua,b2 as ha,o as pa,b3 as lt,O as G,b4 as ut,b5 as ga,l as ae,c as ht,b6 as xa,f as ma,b7 as pt,b8 as Re,b9 as ye,ba as be,bb as gt,a as ve,b as fa,C as We,bc as ya}from"./index-B0wrSWVL.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 _a,n as mt,o as ft,W as Ba,p as Ra,q as Wa,A as Fa,r as La,s as Ka,t as Ua,u as Na,v as Qa,w as Oa,x as Ha,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-BeuBL17J.js";import{u as cs}from"./useManaRate-6JYRR5Sm.js";import{r as ds}from"./mana-rate-CLS7fjKR.js";import{j as ls,k as us,h as hs,n as ps,i as gs,A as xs}from"./authorizations-Bm65kFBw.js";import{g as ms,b as Le}from"./buy-CfVy6xwA.js";import{b as fs,w as ys,S as vt,G as bs}from"./buy-gasless-DmFIjDH7.js";import{u as vs,M as ws,R as we,r as Cs,c as js,p as wt}from"./useCreditPacks-D1yz9_D9.js";import{i as ks,a as $s}from"./errors-CVWX9epA.js";import{E as Ss}from"./ErrorNotice-Cvc0nTjw.js";import{u as Ct}from"./mana-convert-XtWFaGCt.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-Mw7kNWLf.js";import"./sendMetaTransaction-DvDr2bCi.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,d as ea,b as ta}from"./react-DehiWSvs.js";import{t
|
|
|
58
58
|
font-weight: 700;
|
|
59
59
|
color: ${se.text};
|
|
60
60
|
}
|
|
61
|
-
`,Es="https://cdn.decentraland.org/@dcl/shop/0.
|
|
61
|
+
`,Es="https://cdn.decentraland.org/@dcl/shop/0.4.0/_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(_s,{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 _s({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(_a,{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(Ra,{}),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(Ua,{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(Na,{address:n.item.creator}):null]}),e.jsxs(Qa,{children:[e.jsx(Oa,{}),e.jsx("span",{children:de(n.priceCredits*L)})]})]})]},n.item.id)})}),e.jsx(Ha,{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
|
|
@@ -286,7 +286,7 @@ import{j as e,L as Se,r as P,d as ea,b as ta}from"./react-DehiWSvs.js";import{t
|
|
|
286
286
|
display: flex;
|
|
287
287
|
flex-direction: column;
|
|
288
288
|
gap: 24px;
|
|
289
|
-
`,
|
|
289
|
+
`,Ds=i.div`
|
|
290
290
|
position: relative;
|
|
291
291
|
display: flex;
|
|
292
292
|
align-items: stretch;
|
|
@@ -305,7 +305,7 @@ import{j as e,L as Se,r as P,d as ea,b as ta}from"./react-DehiWSvs.js";import{t
|
|
|
305
305
|
&[data-unavailable] [data-desc] {
|
|
306
306
|
opacity: 0.7;
|
|
307
307
|
}
|
|
308
|
-
`,
|
|
308
|
+
`,Ys=i.div`
|
|
309
309
|
position: relative;
|
|
310
310
|
flex-shrink: 0;
|
|
311
311
|
width: 137.5px;
|
|
@@ -692,4 +692,4 @@ import{j as e,L as Se,r as P,d as ea,b as ta}from"./react-DehiWSvs.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 Ue=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),Y=Q(t=>t.restore),D=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(),[Rt,ie]=P.useState(null),[Qe,he]=P.useState(null),[Wt,_]=P.useState(!1),[B,H]=P.useState(null),Oe=P.useRef(0),[p,j]=P.useState(null),{data:pe}=da(n),{data:re}=cs(!0),[Te,He]=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),Ye=B?B.liveTotalCredits:Ft,Ut=new Set(o.map(t=>t.id)),De=((Me==null?void 0:Me.items)??[]).filter(t=>!Ut.has(t.id)).slice(0,12),Nt=new Map(B==null?void 0:B.buyable.map(t=>[t.item.id,t])),ge=($==null?void 0:$.credits)??0,ze=Ye*10,Qt=re?Ct(ze,re):0n,xe=Fe({priceCents:ze,priceManaWei:Qt,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n}),Ot=t=>t.some(a=>a.acquisition==="store"),Ae=t=>t.flatMap(a=>a.acquisition==="trade"?[a]:[]),Ht=ga,Vt=t=>xa(t.contractAddress,String(t.itemId));function me(t){t(),H(null),he(null),ie(null)}function Gt(){j(null),_(!1)}function Je(t){const a=Ue(t),d=Math.max(0,a-ge),c=ue.find(u=>u.credits>=d)??ue[ue.length-1];He(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}),_(!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,R=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:N,maxCreditedValue:X}=await pt(n.identity,x.usdCents,M,C);u.push({salt:N.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:[N],maxCreditedValue:X,chainId:x.item.chainId}:{kind:"trade",trade:x.trade,credits:[N],maxCreditedValue:X})}catch(M){if($s(M)){if(u.length){try{await Re(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"),U=y.flatMap(m=>m.kind==="trade"?[m]:[]);if(ls()&&!v)try{const m=new Map;f=await fs({purchases:U,buyer:n.address,signer:n.signer,onSigned:()=>K(g),onBroadcast:({txHash:C,salts:N})=>{m.set(C,N),N.forEach(X=>w.add(X))}});const x=await Promise.allSettled(f.map(C=>ys(C)));x.forEach((C,N)=>{const X=m.get(f[N])??[];C.status==="fulfilled"?(X.forEach(Be=>S.add(Be)),E.push(f[N])):C.reason instanceof vt||X.forEach(Be=>R.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=>R.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=>R.add(x))});t.forEach(m=>l(m.item.id)),H(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),_(!1);const _e={items:c,txHash:f[0]??void 0,txHashes:f,settled:!0,...ce?{creditsAdded:ce}:{}};ee("/success",{state:_e,replace:!0})}catch(y){be(y)||ae(y,{flow:"cart_checkout",step:h,cart_size:t.length});const g=new Set([...w].filter(v=>!R.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,U)=>v+U.priceCredits,0)),cart_size:a.length,partial:K.length>0}),k.length)try{await Re(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)),H(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")}),_(!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),_(!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)}),_(!1)}async function Yt(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 Dt(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=Ue(t),{totalCents:c,manaWei:u}=await Dt(t),h=Fe({priceCents:c,priceManaWei:u,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n}),w=Ot(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:R}=at(a,t);await st(S,R,()=>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}),_(!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)){_(!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)),H(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),R=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 U=g[f].item,{credit:ce,maxCreditedValue:_e}=await pt(n.identity,v,g[f].trade.id,U.contractAddress&&U.itemId!=null?{contractAddress:U.contractAddress,itemId:String(U.itemId)}:void 0);E.push({salt:ce.id,itemId:U.id}),k.push({kind:"trade",trade:g[f].trade,credits:[ce],maxCreditedValue:_e})}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)+R).toString()},await Yt(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)),H(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&&Re(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),_(!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,Ht,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")),H(null);return}if(c.orderChanged){H(c),Oe.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{_(!1)}}async function rt(){if(B){if(!n){yt({type:"cart-checkout"}),L();return}if(Date.now()-Oe.current>zn){H(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{}_(!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{_(!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&&Y(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(O,{name:"arrow-left"}),s("nav.cart")]}),e.jsxs(Ls,{"data-testid":"cart-empty",children:[e.jsx(O,{name:"cart-plus",size:110}),e.jsxs(Ks,{children:[e.jsx(Us,{children:s("cart.empty.title")}),e.jsx(Ns,{children:s("cart.empty.body")})]}),e.jsx(Qs,{to:"/items",children:s("cart.empty.cta")})]})]})}):e.jsxs(jt,{children:[e.jsxs($t,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(O,{name:"arrow-left"}),s("nav.cart")]}),e.jsxs(Rs,{children:[e.jsxs(Ws,{children:[e.jsxs(Fs,{children:[e.jsx(Os,{onClick:()=>ee(-1),type:"button","aria-label":s("cart.goBack"),children:e.jsx(O,{name:"arrow-left"})}),e.jsx(Hs,{children:s("cart.panelTitle",{count:Lt})}),Bt?e.jsxs(Vs,{onClick:()=>D(!0),disabled:V,children:[e.jsx(O,{name:"fitting-room"}),s("cart.fittingRoom")]}):null]}),e.jsxs(At,{children:[e.jsx(Gs,{children:o.map(t=>{const a=Nt.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,R=ua(t),E=!!R&&!!A[R],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(Ys,{"data-unavailable":g||void 0,children:[e.jsxs(Ds,{"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:[R?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(O,{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(O,{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,{})," ",Ye]})})]}),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("cart.checkout")}),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:Rt})]})]})]})]}),De.length>0?e.jsx(Pn,{children:e.jsx(as,{title:s("cart.youMightAlsoLike"),items:De})}):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"?Ue(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:He,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 Ue=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(),[Rt,ie]=P.useState(null),[Qe,he]=P.useState(null),[Wt,_]=P.useState(!1),[B,H]=P.useState(null),Oe=P.useRef(0),[p,j]=P.useState(null),{data:pe}=da(n),{data:re}=cs(!0),[Te,He]=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,Ut=new Set(o.map(t=>t.id)),Ye=((Me==null?void 0:Me.items)??[]).filter(t=>!Ut.has(t.id)).slice(0,12),Nt=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}),Ot=t=>t.some(a=>a.acquisition==="store"),Ae=t=>t.flatMap(a=>a.acquisition==="trade"?[a]:[]),Ht=ga,Vt=t=>xa(t.contractAddress,String(t.itemId));function me(t){t(),H(null),he(null),ie(null)}function Gt(){j(null),_(!1)}function Je(t){const a=Ue(t),d=Math.max(0,a-ge),c=ue.find(u=>u.credits>=d)??ue[ue.length-1];He(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}),_(!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,R=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:N,maxCreditedValue:X}=await pt(n.identity,x.usdCents,M,C);u.push({salt:N.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:[N],maxCreditedValue:X,chainId:x.item.chainId}:{kind:"trade",trade:x.trade,credits:[N],maxCreditedValue:X})}catch(M){if($s(M)){if(u.length){try{await Re(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"),U=y.flatMap(m=>m.kind==="trade"?[m]:[]);if(ls()&&!v)try{const m=new Map;f=await fs({purchases:U,buyer:n.address,signer:n.signer,onSigned:()=>K(g),onBroadcast:({txHash:C,salts:N})=>{m.set(C,N),N.forEach(X=>w.add(X))}});const x=await Promise.allSettled(f.map(C=>ys(C)));x.forEach((C,N)=>{const X=m.get(f[N])??[];C.status==="fulfilled"?(X.forEach(Be=>S.add(Be)),E.push(f[N])):C.reason instanceof vt||X.forEach(Be=>R.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=>R.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=>R.add(x))});t.forEach(m=>l(m.item.id)),H(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),_(!1);const _e={items:c,txHash:f[0]??void 0,txHashes:f,settled:!0,...ce?{creditsAdded:ce}:{}};ee("/success",{state:_e,replace:!0})}catch(y){be(y)||ae(y,{flow:"cart_checkout",step:h,cart_size:t.length});const g=new Set([...w].filter(v=>!R.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,U)=>v+U.priceCredits,0)),cart_size:a.length,partial:K.length>0}),k.length)try{await Re(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)),H(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")}),_(!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),_(!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)}),_(!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=Ue(t),{totalCents:c,manaWei:u}=await Yt(t),h=Fe({priceCents:c,priceManaWei:u,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n}),w=Ot(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:R}=at(a,t);await st(S,R,()=>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}),_(!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)){_(!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)),H(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),R=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 U=g[f].item,{credit:ce,maxCreditedValue:_e}=await pt(n.identity,v,g[f].trade.id,U.contractAddress&&U.itemId!=null?{contractAddress:U.contractAddress,itemId:String(U.itemId)}:void 0);E.push({salt:ce.id,itemId:U.id}),k.push({kind:"trade",trade:g[f].trade,credits:[ce],maxCreditedValue:_e})}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)+R).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)),H(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&&Re(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),_(!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,Ht,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")),H(null);return}if(c.orderChanged){H(c),Oe.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{_(!1)}}async function rt(){if(B){if(!n){yt({type:"cart-checkout"}),L();return}if(Date.now()-Oe.current>zn){H(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{}_(!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{_(!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(O,{name:"arrow-left"}),s("nav.cart")]}),e.jsxs(Ls,{"data-testid":"cart-empty",children:[e.jsx(O,{name:"cart-plus",size:110}),e.jsxs(Ks,{children:[e.jsx(Us,{children:s("cart.empty.title")}),e.jsx(Ns,{children:s("cart.empty.body")})]}),e.jsx(Qs,{to:"/items",children:s("cart.empty.cta")})]})]})}):e.jsxs(jt,{children:[e.jsxs($t,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(O,{name:"arrow-left"}),s("nav.cart")]}),e.jsxs(Rs,{children:[e.jsxs(Ws,{children:[e.jsxs(Fs,{children:[e.jsx(Os,{onClick:()=>ee(-1),type:"button","aria-label":s("cart.goBack"),children:e.jsx(O,{name:"arrow-left"})}),e.jsx(Hs,{children:s("cart.panelTitle",{count:Lt})}),Bt?e.jsxs(Vs,{onClick:()=>Y(!0),disabled:V,children:[e.jsx(O,{name:"fitting-room"}),s("cart.fittingRoom")]}):null]}),e.jsxs(At,{children:[e.jsx(Gs,{children:o.map(t=>{const a=Nt.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,R=ua(t),E=!!R&&!!A[R],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:[R?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(O,{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(O,{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("cart.checkout")}),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:Rt})]})]})]})]}),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"?Ue(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:He,onBuyPacks:()=>void Zt(),message:p.phase==="error"?p.message:void 0,onRetry:()=>void te()}):null]})}export{Jn as Cart};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a5 as N,a6 as U,a7 as o,a8 as n,a9 as D,k as M}from"./index-
|
|
1
|
+
import{a5 as N,a6 as U,a7 as o,a8 as n,a9 as D,k as M}from"./index-B0wrSWVL.js";import{r as w,j as g}from"./react-DehiWSvs.js";import{g as z,a as E,c as I,b as F,s as v}from"./clsx-DY37pDvc.js";function K(r){return z("MuiCircularProgress",r)}E("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const W=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,b,S,$;const a=44,B=M(P||(P=l`
|
|
2
2
|
0% {
|
|
3
3
|
transform: rotate(0deg);
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,r as m,u as Z,d as J}from"./react-DehiWSvs.js";import{t as v,s as c,R as X,v as E,I as ee,e as a,c as te,l as ae,u as re,m as oe,f as ie,ac as F,ad as se,aT as ne,aU as ce}from"./index-
|
|
1
|
+
import{j as e,r as m,u as Z,d as J}from"./react-DehiWSvs.js";import{t as v,s as c,R as X,v as E,I as ee,e as a,c as te,l as ae,u as re,m as oe,f as ie,ac as F,ad as se,aT as ne,aU as ce}from"./index-B0wrSWVL.js";import{E as le}from"./ErrorNotice-Cvc0nTjw.js";import{d as de,g as pe,a as xe,P as ue,C as me,b as ge,c as he,B as be,S as fe,M as je,A as ve}from"./browseLayout.styles-D_JQHeMK.js";import{u as ye}from"./useStore-DCWOq5iS.js";import{S as z,C as Ce,F as we,c as Ne,P as Se,d as ke,H as Pe,e as $e}from"./categories-D2JgaepG.js";import{L as Ae}from"./LoadMore-DsWSQHxD.js";import{u as Me}from"./useInfiniteGrid-C-7TbIWI.js";import{G as Re}from"./grid.styles-C92STzz7.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";const Te=c.section`
|
|
2
2
|
position: relative;
|
|
3
3
|
border-radius: ${v.radius.card};
|
|
4
4
|
overflow: hidden;
|