@dcl/shop 0.7.0 → 0.7.1-30990238548.commit-e1a9b44
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-Bfm7kRfv.js → Activity-lT0YcBpp.js} +3 -3
- package/_assets/{AnimatedBackground-C-bhqVsp.js → AnimatedBackground-Bh9yqqyo.js} +1 -1
- package/_assets/{Assets-B55dtQQJ.js → Assets-W2K17DNE.js} +16 -16
- package/_assets/{Assets.styles-NQkvfYq_.js → Assets.styles-BRKxjoKt.js} +1 -1
- package/_assets/{Authorizations-CiQtw5K-.js → Authorizations-Dr5yItAg.js} +1 -1
- package/_assets/{Cart-D7wbUiTa.js → Cart-BtPPlKT-.js} +9 -9
- package/_assets/{CircularProgress-ZsDKUKD2.js → CircularProgress-C7VsHWMt.js} +3 -3
- package/_assets/{Collection-DwFpgZbC.js → Collection-DCViY_t8.js} +6 -6
- package/_assets/{CollectionCarousel-DENDQYmz.js → CollectionCarousel-GCvOV-Gg.js} +6 -6
- package/_assets/Creator-ObMkZYpP.js +306 -0
- package/_assets/{ErrorNotice-BEc3g8r8.js → ErrorNotice-Dqta24N5.js} +1 -1
- package/_assets/{ExchangeController-BCP2fWjj.js → ExchangeController-C6LZJwa3.js} +1 -1
- package/_assets/{GetCredits-Vnk46xfQ.js → GetCredits-BNaaxb_0.js} +55 -39
- package/_assets/{Grow-DuBI26R-.js → Grow-CATzMRtE.js} +1 -1
- package/_assets/{HelpersUtil-ClfhYE3l.js → HelpersUtil-D2Ila5RU.js} +1 -1
- package/_assets/ItemDetail-_mEj7gSJ.js +3497 -0
- package/_assets/LazyEmoteControls-B5RzSFrl.js +2 -0
- package/_assets/{LoadMore-CC_UzQ34.js → LoadMore-zQFtk18D.js} +1 -1
- package/_assets/{ManaPricingBanner.styles-BokPI2D_.js → ManaPricingBanner.styles-BsPkCKm-.js} +3 -3
- package/_assets/{MyAssets-Bo37jIwn.js → MyAssets-DFaqVFd_.js} +1 -1
- package/_assets/{MyFavorites-B2TJaZUB.js → MyFavorites-DTRK9wy4.js} +1 -1
- package/_assets/{NotFound-DLx8jzvN.js → NotFound-rz9bDfss.js} +1 -1
- package/_assets/{NotificationsBell-BtCXxoM8.js → NotificationsBell-pjjuLM3-.js} +1 -1
- package/_assets/OutfitDetail-D9rz_FXb.js +334 -0
- package/_assets/{OutfitPreview-D5_qH5Ln.js → OutfitPreview-1iIXROBH.js} +2 -2
- package/_assets/{OutfitStudio-qONuf5K7.js → OutfitStudio-NFaobXxq.js} +7 -7
- package/_assets/{StoreSettings-vN3UO986.js → StoreSettings-DFHzGBrT.js} +9 -9
- package/_assets/{Success-f5eJlnKx.js → Success-M_g5nCEa.js} +1 -1
- package/_assets/{SwapController-B9sRrkAK.js → SwapController-6cgiWXlf.js} +1 -1
- package/_assets/{Tooltip-D1ZBIqYA.js → Tooltip-CAQFB2Mi.js} +1 -1
- package/_assets/{TradeService-DvFVQpxx.js → TradeService-BJMRBu2H.js} +1 -1
- package/_assets/{W3MFrameProviderSingleton-mcKRqTfP.js → W3MFrameProviderSingleton-DRzedFJw.js} +3 -3
- package/_assets/{WebCryptoP256-B7MhXWuH.js → WebCryptoP256-CuXiQMoj.js} +1 -1
- package/_assets/{authorizations-D_1liO7d.js → authorizations-CsaESAMY.js} +1 -1
- package/_assets/{basic-CqEh5duU.js → basic-DrG6US4m.js} +1 -1
- package/_assets/{biconomy-D_Y6_R5H.js → biconomy-Bw9zijip.js} +1 -1
- package/_assets/builder-DObMg-l1.js +1 -0
- package/_assets/{buy-D5A2EHRt.js → buy-A9t_7x8k.js} +1 -1
- package/_assets/{buy-gasless-DOjyxrOK.js → buy-gasless-Bniq3BQd.js} +1 -1
- package/_assets/{categories-2VrlGaC_.js → categories-CACS82PB.js} +1 -1
- package/_assets/{ccip-BOQWcrsE.js → ccip-DTTKO4dA.js} +1 -1
- package/_assets/{ccip-Bmb04-XK.js → ccip-D_AicfsF.js} +1 -1
- package/_assets/{collectionPage.styles-DaKP3DX-.js → collectionPage.styles-BLKh8kgS.js} +4 -4
- package/_assets/{controller-BQ-e2rGO.js → controller-wPbIlyGc.js} +2 -2
- package/_assets/{core-CTr2fRUy.js → core-DduQEkEO.js} +4 -4
- package/_assets/{createSvgIcon-BhCc-35g.js → createSvgIcon-BjHwMHo7.js} +3 -3
- package/_assets/{custom-DG1qkiJE.js → custom-yh8XQIwQ.js} +1 -1
- package/_assets/{data-capture-Ba2U2y5O.js → data-capture-abbil-R3.js} +1 -1
- package/_assets/disposePreview-8oEf57G7.js +1 -0
- package/_assets/{email-Wxqgx6Lj.js → email-j0aiyR31.js} +1 -1
- package/_assets/{embedded-wallet-DR6Si6kV.js → embedded-wallet-Cs1h0aLj.js} +1 -1
- package/_assets/{emotion-styled.browser.esm-Ce_kaTO_.js → emotion-styled.browser.esm-Sg3iPTht.js} +1 -1
- package/_assets/{engine-CT5J10tT.js → engine-DM5D2Uq4.js} +1 -1
- package/_assets/{errors-BQ78iy4c.js → errors-CQRcoIkN.js} +1 -1
- package/_assets/{estimate-l1-fee-BWX6n2wW.js → estimate-l1-fee-Ycd9FIYl.js} +1 -1
- package/_assets/{execute-C6tBpvgs.js → execute-l4aF_0Ld.js} +2 -2
- package/_assets/{features-BmPELMhg.js → features-CalqElSm.js} +1 -1
- package/_assets/{fetchTokenMetadata-Mg3wjHG6.js → fetchTokenMetadata-EczpIxcg.js} +2 -2
- package/_assets/{field.styles-5z9eWAwV.js → field.styles-Fhju3zb5.js} +1 -1
- package/_assets/{get-ecosystem-wallet-info-Blc_71v0.js → get-ecosystem-wallet-info-N6LPaAsb.js} +1 -1
- package/_assets/{getBalance-mM7D97ev.js → getBalance-M_5rOtSU.js} +1 -1
- package/_assets/{getNFT-CbZgRluJ.js → getNFT-BAT9wUXy.js} +1 -1
- package/_assets/{getNFT-zt_0lqjp.js → getNFT-Bfwr2BNe.js} +1 -1
- package/_assets/{grid.styles-B1gNJ9t8.js → grid.styles-BD7r5B0S.js} +1 -1
- package/_assets/{hashTypedData-BmTdbBr7.js → hashTypedData-B63b7f8K.js} +1 -1
- package/_assets/{hashTypedData-xC0RrFzF.js → hashTypedData-DEFWdnT-.js} +1 -1
- package/_assets/{in-app-D6xPBmdK.js → in-app-CNjdS9ZC.js} +1 -1
- package/_assets/{in-app-wallet-calls-DRD1x_CO.js → in-app-wallet-calls-C0jWGRxR.js} +1 -1
- package/_assets/{index-Db5yIiwQ.js → index--SKZRljP.js} +1 -1
- package/_assets/{index-Dmg93p28.js → index-6Wrh9Kai.js} +1 -1
- package/_assets/{index-CYAsq_LJ.js → index-B0F-Qo6Q.js} +1 -1
- package/_assets/{index-Cx2Xs8TS.js → index-B0HmfVfO.js} +1 -1
- package/_assets/{index-dwg60Gnv.js → index-B8rwZzQL.js} +1 -1
- package/_assets/{index-SH2zEbyV.js → index-BAlfUXsd.js} +1 -1
- package/_assets/{index-D-lT6ZHp.js → index-BE34WHN2.js} +1 -1
- package/_assets/{index-By7h7Ees.js → index-BFbEWZWw.js} +1 -1
- package/_assets/{index-Ds0nhWl1.js → index-BJ8iPJdz.js} +1 -1
- package/_assets/{index-MmMSnATW.js → index-BJz5xy70.js} +1 -1
- package/_assets/{index-GiJ7q8m3.js → index-BWqhzExD.js} +1 -1
- package/_assets/{index-CxFaiS6B.js → index-BbgH0vql.js} +1 -1
- package/_assets/{index-4odeU1-q.js → index-Bg95ZIy4.js} +8 -8
- package/_assets/{index-Bmjy2mpL.js → index-BhodIcxQ.js} +1 -1
- package/_assets/{index-DUxAD7Ds.js → index-BudXe0Zf.js} +2 -2
- package/_assets/{index-D6orrgpK.js → index-C-iEg3PE.js} +1 -1
- package/_assets/{index-Cpx6YfS5.js → index-C0HK-rFf.js} +1 -1
- package/_assets/{index-CdIpnfG_.js → index-C65Vl3Le.js} +1 -1
- package/_assets/{index-CXdifgIh.js → index-CAMztIzm.js} +1 -1
- package/_assets/{index-DqLl5DCg.js → index-CCITqXrq.js} +1 -1
- package/_assets/{index-GeaRFVYH.js → index-CGk17036.js} +3 -3
- package/_assets/{index-CakvWn8X.js → index-CJLenggL.js} +2 -2
- package/_assets/{index-eU7Hyz9Z.js → index-COqQnkSf.js} +1 -1
- package/_assets/{index-BQt-UtVW.js → index-Ch-BrDAg.js} +1 -1
- package/_assets/{index-AUd3llLa.js → index-D48N8sIT.js} +3 -3
- package/_assets/{index-DmJ1WEe8.js → index-D5PrWkIn.js} +1 -1
- package/_assets/{index-Qgfkcf-Z.js → index-DNVaqRDo.js} +1 -1
- package/_assets/{index-xhul-9iX.js → index-DOJOXA-T.js} +1 -1
- package/_assets/{index-BG_zxl6p.js → index-DPxLkKvX.js} +1 -1
- package/_assets/{index-CFCPlMvn.js → index-DThuF6Ex.js} +1 -1
- package/_assets/{index-Dtczzkr-.js → index-DVgclETH.js} +1 -1
- package/_assets/{index-CRwuFsYT.js → index-DbZO05Vw.js} +1 -1
- package/_assets/index-DfPAN1ow.js +3378 -0
- package/_assets/{index-CrA-gT12.js → index-DmzMEQcU.js} +2 -2
- package/_assets/{index-HfSTYCId.js → index-DqSNzB9T.js} +1 -1
- package/_assets/{index-B9ZWePj8.js → index-Du0A95U9.js} +3 -3
- package/_assets/{index-Cqx_iE06.js → index-DwjQ138f.js} +1 -1
- package/_assets/{index-pNEW50qZ.js → index-DwmV1baZ.js} +1 -1
- package/_assets/{index-DzF05fXw.js → index-DzfGdtgi.js} +1 -1
- package/_assets/{index-C2GswxH6.js → index-R47VIjvo.js} +1 -1
- package/_assets/{index--2hu34yL.js → index-Rwe4WvW3.js} +1 -1
- package/_assets/{index-D56APiYW.js → index-awmHKjef.js} +1 -1
- package/_assets/{index-B3IuheKM.js → index-df7rM2ZG.js} +1 -1
- package/_assets/{index-nBe_oU0G.js → index-f1aIZYip.js} +1 -1
- package/_assets/{index-8jpO9R0L.js → index-gN0r8JKj.js} +1 -1
- package/_assets/{index-BnRijaO7.js → index-iTtTw9sW.js} +2 -2
- package/_assets/{index-CVRID3Zs.js → index-kNYcP4KH.js} +1 -1
- package/_assets/{index-C1UOaaoO.js → index-kRLZpGY9.js} +1 -1
- package/_assets/{index-Cu7cZeif.js → index-llPHcBal.js} +1 -1
- package/_assets/{index-B47z7qMq.js → index-ogEMHO1z.js} +1 -1
- package/_assets/{index-CgAxepZC.js → index-sg34_h5l.js} +1 -1
- package/_assets/{index-p6LU--BY.js → index-wvhQFoFW.js} +3 -3
- package/_assets/{index.es-Cn1zNa1z.js → index.es-BQO39kZk.js} +4 -4
- package/_assets/{index.es-DHidcgy5.js → index.es-BRPJG5tW.js} +1 -1
- package/_assets/{index.es-GVwle0q7.js → index.es-DL3WXRQt.js} +1 -1
- package/_assets/{localBatchGatewayRequest-VWgW7Rrx.js → localBatchGatewayRequest-HuzFEIh0.js} +1 -1
- package/_assets/{networks-CDvdXnK2.js → networks-DtwiNiJj.js} +1 -1
- package/_assets/{onramp-DLXpeqxV.js → onramp-C_eH_bxk.js} +1 -1
- package/_assets/{openzeppelin-F7uG1PQF.js → openzeppelin-CMlIa3Qr.js} +1 -1
- package/_assets/{parseNft-D-HVZytL.js → parseNft-BbaspLCo.js} +2 -2
- package/_assets/{parseSignature-Ck0-hAYX.js → parseSignature-CWRN_yrL.js} +1 -1
- package/_assets/{parseSignature-Bajk-MJ2.js → parseSignature-CWpfgQlT.js} +3 -3
- package/_assets/{passkeys-DTp9eXzY.js → passkeys-DctflXdw.js} +1 -1
- package/_assets/{pay-with-exchange-B7T027Na.js → pay-with-exchange-Colnzhcj.js} +1 -1
- package/_assets/{qr-overlay-D24Rmf2y.js → qr-overlay-DK2TfoAk.js} +1 -1
- package/_assets/{receive-Dpi-pR18.js → receive-qEYWSHU5.js} +1 -1
- package/_assets/{resolveImplementation-zRiJR6hj.js → resolveImplementation-57blElzM.js} +1 -1
- package/_assets/{rpc-DBs1enVe.js → rpc-C_Mvv8rf.js} +1 -1
- package/_assets/{secp256k1-D988VQxR.js → secp256k1-C1Eceu4W.js} +1 -1
- package/_assets/{secp256k1-CFlVBTcQ.js → secp256k1-CmoK4Jr7.js} +1 -1
- package/_assets/{secp256k1-DlBFD_9l.js → secp256k1-Czx1nfJQ.js} +1 -1
- package/_assets/{send-batch-transaction-BsTouWWn.js → send-batch-transaction-BVOYw8tU.js} +1 -1
- package/_assets/{send-eip712-transaction-CVPyso6U.js → send-eip712-transaction-CF-WVf20.js} +2 -2
- package/_assets/{send-gasless-transaction-B_ncM11b.js → send-gasless-transaction-CndNPHx6.js} +2 -2
- package/_assets/{send-transaction-CQNEiR4D.js → send-transaction-CZTBc5K5.js} +2 -2
- package/_assets/{send-C--S0H3a.js → send-y2BzMQTL.js} +1 -1
- package/_assets/{sendMetaTransaction-BkMNQLKq.js → sendMetaTransaction-DKOg7kXu.js} +1 -1
- package/_assets/{sendRawTransaction-eF-4-IOR.js → sendRawTransaction-BxmW3FG3.js} +3 -3
- package/_assets/{serializeTransaction-E8IX_hjf.js → serializeTransaction-BkwnOsCe.js} +1 -1
- package/_assets/{session-proposal-B5Vbxh9X.js → session-proposal-D47Bz-f3.js} +1 -1
- package/_assets/{session-request-YtoGiiaC.js → session-request-D2kh8z-R.js} +2 -2
- package/_assets/{signing-ChPpUSja.js → signing-DvhyKt0I.js} +3 -3
- package/_assets/{socials-OPF-4Wmw.js → socials-CtLmB3cr.js} +1 -1
- package/_assets/{styled-CI0T6-yj.js → styled-Cwh1vUwH.js} +2 -2
- package/_assets/{swaps-D9XgTxrT.js → swaps-WY7EvB6P.js} +1 -1
- package/_assets/{thirdweb-CJavbJGB.js → thirdweb-C5QHxZcL.js} +3 -3
- package/_assets/{to-serializable-transaction-Capw1hGa.js → to-serializable-transaction-MIkxL2EW.js} +2 -2
- package/_assets/{trade-encoding-CS-l5HWK.js → trade-encoding-WMxi4i0g.js} +1 -1
- package/_assets/{transactionReceipt-DoRy-YCC.js → transactionReceipt-nwC_Dd4B.js} +1 -1
- package/_assets/{transactions-DlPEEm5e.js → transactions-C6uaCBev.js} +1 -1
- package/_assets/{useCreditPacks-_PiP2Q_K.js → useCreditPacks-D9xD4P3c.js} +1 -1
- package/_assets/{useImportable-Dur9WNgJ.js → useImportable-DGBvF5gT.js} +1 -1
- package/_assets/{useInfiniteGrid-OWa5mJdJ.js → useInfiniteGrid-3DuVZLHn.js} +1 -1
- package/_assets/{useTheme-DpoJyopi.js → useTheme-BevJKqBG.js} +1 -1
- package/_assets/{verifyHash-BZZQrCdK.js → verifyHash-XCQkQwOv.js} +1 -1
- package/_assets/{w3m-modal-DVcmDyvT.js → w3m-modal-D5_GYndR.js} +1 -1
- package/_assets/{w3m-modal-BurrNe_2.js → w3m-modal-DujoDCoT.js} +1 -1
- package/_assets/{wait-for-tx-receipt-DABDEQLt.js → wait-for-tx-receipt-BN93Lggh.js} +1 -1
- package/_assets/{wallets-DsQIZNUu.js → wallets-wlGAcREW.js} +5 -5
- package/_assets/{web-connector-CBr7K2EN.js → web-connector-c3Gtbn1T.js} +3 -3
- package/_assets/{writeContract-Clw7zVob.js → writeContract-CZgSr7vU.js} +1 -1
- package/_assets/{zoraTestnet-Dofh77OY.js → zoraTestnet-_AM-GTfF.js} +1 -1
- package/index.html +22 -12
- package/package.json +2 -2
- package/sitemap.xml +7 -6
- package/_assets/Creator-CVJd5TOb.js +0 -306
- package/_assets/ItemDetail-CacEb2nn.js +0 -3392
- package/_assets/LazyEmoteControls-DOn7IxHq.js +0 -2
- package/_assets/OutfitDetail-CSx4d1E1.js +0 -334
- package/_assets/builder-dRN2Kgse.js +0 -1
- package/_assets/disposePreview-DIA1G1eQ.js +0 -1
- package/_assets/index-CpUnpBQ7.js +0 -3378
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_assets/index-
|
|
2
|
-
import{m as ye,
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_assets/index-Bg95ZIy4.js","_assets/react-DehiWSvs.js","_assets/index-DfPAN1ow.js","_assets/sentry-973sfbO9.js","_assets/dcl-schemas-Dr9BTjb7.js","_assets/ethers-CtNGBird.js","_assets/intl-CBcMB1D2.js","_assets/index-D-NhBWWr.css","_assets/useImportable-DGBvF5gT.js","_assets/buy-A9t_7x8k.js","_assets/authorizations-CsaESAMY.js","_assets/sendMetaTransaction-DKOg7kXu.js","_assets/trade-encoding-WMxi4i0g.js","_assets/ManaPricingBanner.styles-BsPkCKm-.js","_assets/field.styles-Fhju3zb5.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{m as ye,bz as ve,s as l,t as s,o as we,B as je,k as te,q as ke,d as c,n as $,ai as Ie,I as j,bA as Z,bB as J,bC as Ae,_ as $e,w as P,bD as Pe,x as Le,bb as z,az as Ne,bE as Ee,z as Te,bF as Ce,bG as H}from"./index-DfPAN1ow.js";import{r as g,e as Se,j as t,L as ie,a as Fe}from"./react-DehiWSvs.js";import{u as De}from"./useImportable-DGBvF5gT.js";import{L as Me}from"./LoadMore-zQFtk18D.js";import{u as I}from"./useInfiniteGrid-3DuVZLHn.js";import{m as ae}from"./mana-matic-C4e1sNO3.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";import"./buy-A9t_7x8k.js";import"./authorizations-CsaESAMY.js";import"./sendMetaTransaction-DKOg7kXu.js";import"./trade-encoding-WMxi4i0g.js";const ze=15e3;function He(e,a){return e.txHash&&a.txHash?e.txHash===a.txHash:e.txHash||a.txHash?!1:e.status===a.status&&Math.abs(e.createdAt-a.createdAt)<=ze}function qe(e){const a=[...e].sort((i,o)=>o.createdAt-i.createdAt),n=[];for(const i of a){const o=n[n.length-1];o&&He(o[o.length-1],i)?o.push(i):n.push([i])}return n.map(i=>{var o;return{id:((o=i.find(r=>r.txHash))==null?void 0:o.txHash)??i[i.length-1].id,createdAt:Math.max(...i.map(r=>r.createdAt)),status:i.some(r=>r.status==="PENDING")?"PENDING":"SETTLED",totalCredits:i.reduce((r,u)=>r+u.credits,0),lines:i}})}function Oe(e){return e.tradeId?`trade:${e.tradeId}`:e.contractAddress&&e.itemId?`item:${e.contractAddress.toLowerCase()}:${e.itemId}`:null}function Re(e){const a=[],n=new Map;for(const i of e){const o=Oe(i);if(!o){a.push({key:i.id,tradeId:null,contractAddress:i.contractAddress??null,itemId:i.itemId??null,quantity:1,credits:i.credits});continue}const r=n.get(o);if(r){r.quantity+=1,r.credits+=i.credits;continue}const u={key:o,tradeId:i.tradeId,contractAddress:i.contractAddress??null,itemId:i.itemId??null,quantity:1,credits:i.credits};n.set(o,u),a.push(u)}return a}function We(e,a){return{id:e.id,contractAddress:e.contractAddress,tokenId:e.tokenId,itemId:e.itemId,counterparty:e.buyer,credits:a?ye(e.manaWei,a):null,manaWei:e.manaWei,createdAt:e.createdAt,txHash:e.txHash}}function _e(e){const n=qe(e.purchases.filter(d=>d.status!=="EXPIRED")).map(d=>({kind:"purchase",id:`purchase:${d.id}`,createdAt:d.createdAt,order:d})),i=e.sales.map(d=>{const p=We(d,e.rate);return{kind:"sale",id:`sale:${p.id}`,createdAt:p.createdAt,sale:p}}),o=(e.creditOrders??[]).filter(d=>d.status!=="failed"&&d.status!=="abandoned").map(d=>({kind:"credit",id:`credit:${d.id}`,createdAt:d.createdAt,order:d})),r=new Set(e.purchases.filter(d=>d.txHash).map(d=>d.txHash.toLowerCase())),u=(e.manaPurchases??[]).filter(d=>!r.has(d.txHash.toLowerCase())).map(d=>({kind:"mana-purchase",id:`mana-purchase:${d.id}`,createdAt:d.createdAt,sale:d}));return[...n,...i,...o,...u].sort((d,p)=>p.createdAt-d.createdAt||(d.id<p.id?-1:1))}function Be(e,a){return a==="all"?e:a==="sales"?e.filter(n=>n.kind==="sale"):e.filter(n=>n.kind==="purchase"||n.kind==="credit"||n.kind==="mana-purchase")}const se=e=>e.trim().toLowerCase();function Ge(e){const a=new Map;for(const n of e??[]){const i=se(n.txHash??"");if(!i)continue;const o=a.get(i);o?o.push(n):a.set(i,[n])}return a}function Ue(e,a,n=Date.now()){const i=a.txHash?e.get(se(a.txHash)):void 0;if(!i||i.length===0)return{kind:"direct"};const o=i.length===1?Ke(i[0].netCents):null,r=i.filter(d=>!d.available&&d.availableAt>n);if(r.length===0)return{kind:"credited",credits:o};const u=r.reduce((d,p)=>Math.max(d,p.availableAt),0);return{kind:"pending",credits:o,availableAt:u}}function Ke(e){return ve(e)}const Qe="https://cdn.decentraland.org/@dcl/shop/0.7.1-30990238548.commit-e1a9b44/_assets/credits-product-vs4Q6u6l.svg",q=we`
|
|
3
3
|
0% { background-position: 200% 0; }
|
|
4
4
|
100% { background-position: -200% 0; }
|
|
5
5
|
`,Ve=l.section`
|
|
@@ -381,4 +381,4 @@ import{m as ye,bx as ve,s as l,t as s,o as we,B as je,k as te,q as ke,d as c,n a
|
|
|
381
381
|
margin: 6px 0 0;
|
|
382
382
|
`,ot=l(je)`
|
|
383
383
|
margin-top: 12px;
|
|
384
|
-
`,K=D.withComponent(ie),dt=g.lazy(()=>$e(()=>import("./index-
|
|
384
|
+
`,K=D.withComponent(ie),dt=g.lazy(()=>$e(()=>import("./index-Bg95ZIy4.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14])).then(e=>({default:e.ImportListings}))),A=24,ct=["all","purchases","sales"],M="migrate";function w(e){try{return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function ce(e){return e.length>10?`${e.slice(0,6)}…${e.slice(-4)}`:e}function le(e){const a=Number(e)/1e18;return Number.isFinite(a)?a.toLocaleString("en",{maximumFractionDigits:2}):"0"}function he({children:e}){const a=g.useRef(null),[n,i]=g.useState(null),o=()=>{var u;const r=(u=a.current)==null?void 0:u.getBoundingClientRect();r&&i({top:r.bottom+8,left:r.left+r.width/2})};return t.jsxs(st,{ref:a,tabIndex:0,onMouseEnter:o,onMouseLeave:()=>i(null),onFocus:o,onBlur:()=>i(null),children:[e,n?Fe.createPortal(t.jsx(nt,{style:{top:n.top,left:n.left},role:"tooltip",children:c("activity.polygonMana")}),document.body):null]})}function lt({item:e}){const a=!!e.contractAddress&&!!e.itemId,n=!!e.tradeId||a,{data:i,isLoading:o}=$({queryKey:["order-line-display",e.tradeId,e.contractAddress,e.itemId],queryFn:()=>e.tradeId?Ce(e.tradeId):H(e.contractAddress,{itemId:e.itemId}),enabled:n,staleTime:5*6e4}),r=n&&o,u=(i==null?void 0:i.name)??c("activity.itemFallback"),d=(i==null?void 0:i.thumbnail)??"",p=z({contractAddress:i==null?void 0:i.contractAddress,tokenId:i==null?void 0:i.tokenId,itemId:i==null?void 0:i.itemId})??void 0,x=t.jsxs(t.Fragment,{children:[r?t.jsx(W,{}):t.jsx(R,{children:d?t.jsx("img",{src:d,alt:u}):t.jsx(j,{name:"cart",size:20})}),t.jsxs(_,{children:[r?t.jsx(G,{}):t.jsx(B,{title:u,children:u}),e.quantity>1?t.jsx(U,{children:c("activity.quantity",{count:e.quantity})}):null]}),t.jsxs(rt,{children:[t.jsx(P,{className:"ccy-mark"})," ",e.credits]})]});return p?t.jsx(K,{to:p,"data-link":"true",children:x}):t.jsx(D,{children:x})}function ht({order:e}){const a=Re(e.lines),n=a.reduce((i,o)=>i+o.quantity,0);return t.jsxs(L,{"data-testid":"purchase-order",children:[t.jsxs(N,{children:[t.jsxs(E,{children:[t.jsx(T,{children:w(e.createdAt)}),t.jsxs(C,{children:[c("activity.purchaseLabel")," · ",c("activity.itemCount",{count:n})]})]}),t.jsxs(S,{children:[t.jsx(F,{"data-status":e.status,children:e.status==="PENDING"?c("activity.processing"):c("activity.completed")}),t.jsxs(v,{children:[t.jsx(P,{className:"ccy-mark"})," ",e.totalCredits]})]})]}),t.jsx(O,{children:a.map(i=>t.jsx(lt,{item:i},i.key))})]})}function ut({sale:e}){const{data:a,isLoading:n}=$({queryKey:["asset-display",e.contractAddress,e.tokenId,e.itemId],queryFn:()=>H(e.contractAddress,{tokenId:e.tokenId,itemId:e.itemId}),enabled:!!e.contractAddress,staleTime:3e5}),i=(a==null?void 0:a.name)??c("activity.itemFallback"),o=(a==null?void 0:a.thumbnail)??"",r=z({contractAddress:e.contractAddress,tokenId:e.tokenId,itemId:e.itemId})??void 0,u=t.jsxs(t.Fragment,{children:[n?t.jsx(W,{}):t.jsx(R,{children:o?t.jsx("img",{src:o,alt:i}):t.jsx(j,{name:"offer",size:20})}),t.jsxs(_,{children:[n?t.jsx(G,{}):t.jsx(B,{title:i,children:i}),t.jsx(U,{children:c("activity.boughtFrom",{account:ce(e.seller)})})]})]});return t.jsxs(L,{"data-testid":"activity-mana-purchase",children:[t.jsxs(N,{children:[t.jsxs(E,{children:[t.jsx(T,{children:w(e.createdAt)}),t.jsx(C,{children:c("activity.paidWithMana")})]}),t.jsxs(S,{children:[t.jsx(F,{"data-status":"SETTLED",children:c("activity.completed")}),t.jsxs(v,{children:[le(e.manaWei)," ",t.jsx(he,{children:t.jsx(re,{src:ae,alt:"MANA"})})]})]})]}),t.jsx(O,{children:r?t.jsx(K,{to:r,"data-link":"true",children:u}):t.jsx(D,{children:u})})]})}function pt({sale:e,payout:a}){const{data:n,isLoading:i}=$({queryKey:["asset-display",e.contractAddress,e.tokenId,e.itemId],queryFn:()=>H(e.contractAddress,{tokenId:e.tokenId,itemId:e.itemId}),enabled:!!e.contractAddress,staleTime:3e5}),o=(n==null?void 0:n.name)??c("activity.itemFallback"),r=(n==null?void 0:n.thumbnail)??"",u=z({contractAddress:e.contractAddress,tokenId:e.tokenId,itemId:e.itemId})??void 0,d=t.jsxs(t.Fragment,{children:[i?t.jsx(W,{}):t.jsx(R,{children:r?t.jsx("img",{src:r,alt:o}):t.jsx(j,{name:"offer",size:20})}),t.jsxs(_,{children:[i?t.jsx(G,{}):t.jsx(B,{title:o,children:o}),t.jsxs(U,{children:[c("activity.soldTo",{account:ce(e.counterparty)}),a.kind==="pending"?` · ${c("activity.payoutPendingOn",{date:w(a.availableAt)})}`:""]})]})]});return t.jsxs(L,{"data-testid":"activity-sale",children:[t.jsxs(N,{children:[t.jsxs(E,{children:[t.jsx(T,{children:w(e.createdAt)}),t.jsx(C,{children:c("activity.saleLabel")})]}),t.jsxs(S,{children:[t.jsx(F,{"data-status":a.kind==="pending"?"PENDING":"SOLD",children:a.kind==="pending"?c("activity.payoutPending"):c("activity.sold")}),a.kind==="direct"?t.jsxs(v,{"data-kind":"income",children:["+",le(e.manaWei)," ",t.jsx(he,{children:t.jsx(re,{src:ae,alt:"MANA"})})]}):a.credits!==null?t.jsxs(v,{"data-kind":"income",children:[t.jsx(P,{className:"ccy-mark"})," +",Ne(a.credits)]}):t.jsx(v,{"data-kind":"income",children:c("activity.payoutCredited")})]})]}),t.jsx(O,{children:u?t.jsx(K,{to:u,"data-link":"true",children:d}):t.jsx(D,{children:d})})]})}function xt({order:e}){const a=`$${(e.usdCents/100).toFixed(2)}`,n=Pe(e.status),i=n==="SETTLED"?c("activity.completed"):n==="FAILED"?c("activity.failed"):n==="UNFINISHED"?c("activity.unfinished"):c("activity.processing"),o=te(m=>m.session),r=Le(),[u,d]=g.useState(!1),p=e.status==="initiated"&&!!o;async function x(){if(!(!o||u)){d(!0);try{const m=await Ee(e.id,o.identity);if(m){window.location.href=m;return}Te.info(c("activity.resumeExpired")),r.invalidateQueries({queryKey:["credit-orders"]})}finally{d(!1)}}}return t.jsx(L,{"data-testid":"credit-order",children:t.jsxs(N,{children:[t.jsx(it,{children:t.jsx("img",{src:Qe,alt:"","aria-hidden":!0})}),t.jsxs(E,{children:[t.jsx(T,{children:w(e.createdAt)}),t.jsxs(C,{children:[c("activity.creditPurchaseLabel")," · ",c("activity.creditPaid",{usd:a})]})]}),t.jsxs(S,{children:[p?t.jsx(at,{type:"button",onClick:()=>void x(),disabled:u,"data-testid":"resume-order",children:u?c("activity.resuming"):c("activity.resume")}):null,t.jsx(F,{"data-status":n,children:i}),t.jsxs(v,{"data-kind":"income",children:["+",t.jsx(P,{className:"ccy-mark"})," ",e.credits]})]})]})})}function mt({filter:e}){const a={all:{icon:"clock",title:c("activity.emptyAllTitle"),body:c("activity.emptyAllBody")},purchases:{icon:"cart",title:c("activity.emptyPurchasesTitle"),body:c("activity.emptyPurchasesBody")},sales:{icon:"offer",title:c("activity.emptySalesTitle"),body:c("activity.emptySalesBody")}}[e];return t.jsxs(oe,{children:[t.jsx(j,{name:a.icon,size:40,color:s.colors.muted2}),t.jsx(de,{children:a.title}),t.jsx("p",{className:"muted",children:a.body}),e!=="sales"?t.jsx(ot,{as:ie,to:"/items",variant:"purple",children:c("notFound.cta")}):null]})}function Et(){const{session:e}=te(),[a,n]=g.useState("all"),[i,o]=Se(),r=i.get("view")===M;ke({title:r?c("seo.import.title"):c("nav.activity"),noindex:!0});const{count:u}=De(),d=u!==void 0&&(u>0||r),p=!!e&&!r&&a!=="sales",x=!!e&&!r&&a!=="purchases",m=I(["purchases",e==null?void 0:e.address],h=>Ae(e.address,e.identity,{first:A,skip:h}),{enabled:p}),f=I(["sales",e==null?void 0:e.address],h=>Z(e.address,{role:"seller",first:A,skip:h}),{enabled:x}),b=I(["credit-orders",e==null?void 0:e.address],h=>J(e.address,e.identity,{first:A,skip:h}),{enabled:p}),y=I(["mana-purchases",e==null?void 0:e.address],h=>Z(e.address,{role:"buyer",first:A,skip:h}),{enabled:p}),{data:Q}=$({queryKey:["sale-payouts",e==null?void 0:e.address],queryFn:()=>J(e.address,e.identity,{first:200}).then(h=>h.payouts),enabled:x,staleTime:6e4}),ue=g.useMemo(()=>Ge(Q),[Q]),{data:pe}=Ie(x);if(!e)return t.jsxs(oe,{children:[t.jsx(j,{name:"clock",size:40,color:s.colors.muted2}),t.jsx(de,{children:c("activity.signInTitle")}),t.jsx("p",{className:"muted",children:c("activity.signInBody")})]});const V=Be(_e({purchases:p?m.items:[],sales:x?f.items:[],creditOrders:p?b.items:[],manaPurchases:p?y.items:[],rate:pe}),a),xe=p&&(m.isLoading||b.isLoading||y.isLoading)||x&&f.isLoading,X=p&&(m.isFetchingNextPage||b.isFetchingNextPage||y.isFetchingNextPage)||x&&f.isFetchingNextPage,me=p&&(m.hasNextPage||b.hasNextPage||y.hasNextPage)||x&&f.hasNextPage;function ge(){p&&m.hasNextPage&&m.fetchNextPage(),p&&b.hasNextPage&&b.fetchNextPage(),p&&y.hasNextPage&&y.fetchNextPage(),x&&f.hasNextPage&&f.fetchNextPage()}function fe(h){if(n(h),!r)return;const k=new URLSearchParams(i);k.delete("view"),o(k,{replace:!0})}function be(){const h=new URLSearchParams(i);h.set("view",M),o(h,{replace:!0})}return t.jsxs(Ve,{"data-view":r?M:"feed",children:[t.jsx(Xe,{children:t.jsx(Ze,{children:c("nav.activity")})}),t.jsxs(Je,{role:"tablist","aria-label":c("nav.activity"),children:[ct.map(h=>t.jsx(ne,{type:"button",role:"tab","aria-selected":!r&&a===h,"data-active":!r&&a===h,"data-testid":`activity-filter-${h}`,onClick:()=>fe(h),children:c(`activity.filter.${h}`)},h)),d?t.jsxs(Ye,{type:"button",role:"tab","aria-selected":r,"data-active":r,"data-testid":"activity-filter-migrate","aria-label":u?c("activity.migrate.chipAria",{count:u}):void 0,onClick:be,children:[c("activity.migrate.chip"),u?t.jsx(et,{"data-testid":"activity-migrate-count","aria-hidden":!0,children:u}):null]}):null]}),r?t.jsx(g.Suspense,{fallback:t.jsx(tt,{"aria-busy":"true"}),children:t.jsx(dt,{})}):xe?t.jsx(Y,{children:Array.from({length:5}).map((h,k)=>t.jsx(ee,{},k))}):V.length===0?t.jsx(mt,{filter:a}):t.jsxs(t.Fragment,{children:[t.jsxs(Y,{children:[V.map(h=>h.kind==="purchase"?t.jsx(ht,{order:h.order},h.id):h.kind==="credit"?t.jsx(xt,{order:h.order},h.id):h.kind==="mana-purchase"?t.jsx(ut,{sale:h.sale},h.id):t.jsx(pt,{sale:h.sale,payout:Ue(ue,h.sale)},h.id)),X?t.jsx(ee,{}):null]}),t.jsx(Me,{hasNextPage:me,isFetching:X,onLoadMore:ge})]})]})}export{Et as Activity};
|
|
@@ -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-DfPAN1ow.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.7.1-30990238548.commit-e1a9b44/_assets/custom-welcome-background-BxlFQma9.webp",b="https://cdn.decentraland.org/@dcl/shop/0.7.1-30990238548.commit-e1a9b44/_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 Le,r as u,j as e,e as nt}from"./react-DehiWSvs.js";import{c as U,r as st,
|
|
1
|
+
import{d as Le,r as u,j as e,e as nt}from"./react-DehiWSvs.js";import{c as U,r as st,bg as rt,bh as ot,au as it,b as at,s,t,k as Ue,b6 as lt,x as ct,az as be,d as n,v as dt,I as R,w as M,bQ as se,b5 as pt,S as ee,bk as ht,bj as xt,q as He,ai as Oe,m as Ge,l as mt,ag as ft,ak as Ie,al as V,aB as ut,bM as gt}from"./index-DfPAN1ow.js";import{g as bt,h as yt,i as wt,j as jt,k as vt,C as $t,l as Ct,o as kt,m as St,n as Et,M as Rt,u as _t,E as Tt,v as zt,p as It,q as At,r as Nt,s as Pt,t as Mt}from"./Assets.styles-BRKxjoKt.js";import{S as Ae,R as Bt,F as Wt,e as Ft}from"./categories-CACS82PB.js";import{L as Lt}from"./LoadMore-zQFtk18D.js";import{u as Ut}from"./useInfiniteGrid-3DuVZLHn.js";import{E as Ht}from"./ErrorNotice-Dqta24N5.js";import{d as Ot}from"./dcl-schemas-Dr9BTjb7.js";import{s as Gt,G as Dt,w as qt,S as Vt}from"./buy-gasless-Bniq3BQd.js";import{s as Zt}from"./buy-A9t_7x8k.js";import{j as Kt}from"./trade-encoding-WMxi4i0g.js";import{f as Qt}from"./errors-CQRcoIkN.js";import{J as Jt,C as Xt,B as ye}from"./ethers-CtNGBird.js";import{n as Yt}from"./Tooltip-CAQFB2Mi.js";import{G as en}from"./grid.styles-BD7r5B0S.js";import"./sentry-973sfbO9.js";import"./intl-CBcMB1D2.js";import"./authorizations-CsaESAMY.js";import"./sendMetaTransaction-DKOg7kXu.js";function Z(r){const i=r.source??"item",h=r.tradeId||`${r.contractAddress}-${r.tokenId??r.itemId??""}`;return`${i}:${h}`}const H="100000000000000000000",De=2,te=15,tn=/^[a-zA-Z0-9]+$/;function Ne(r){const i=r.trim();return i.length===0?{ok:!1,reason:"empty"}:tn.test(i)?i.length<De?{ok:!1,reason:"too-short"}:i.length>te?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function nn(r){return r.replace(/[^a-zA-Z0-9]/g,"").slice(0,te)}const sn=["function available(string _subdomain) view returns (bool)"],Pe={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function rn(){return U.chainId===Number(Ot.ChainId.MATIC_MAINNET)?Pe.mainnet:Pe.sepolia}async function on(r,i={}){var l;const{rpc:h,address:c}=rn(),d=new Jt(h),a=new Xt(c,sn,d);console.info(`[names] availability check → DCLRegistrar(${c}).available("${r}") on ${h}`);const m=await a.available(r);if((l=i.signal)!=null&&l.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${r}" available=${m}`),m?"available":"taken"}const an="https://app.across.to/api";class we extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function ln(r){return it(H,r)}async function cn(r,i,h={}){var l;const c=h.chainId??U.chainId,d=h.provider??"across",a=`${U.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(i)}&chainId=${c}&provider=${d}`,m=await at(a,{method:"GET",identity:r,metadata:{}});if(!m.ok){let p;try{p=(l=await m.json())==null?void 0:l.code}catch{}throw p==="ROUTE_COST_TOO_HIGH"?new we:new Error(`fetchNameCreditRoute ${m.status}`)}return m.json()}function dn(r,i){const h=ye.from(r.availableAmount),d=ye.from(H).sub(h);return{credits:[{value:r.amount,expiresAt:Number(r.expiresAt),salt:Kt(r.id)}],creditsSignatures:[r.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:d.isNegative()?"0":d.toString(),maxCreditedValue:H}}async function pn(r,i={}){const h=an,c=i.intervalMs??1e4,d=i.maxAttempts??60;let a={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let m=0;m<d;m++){try{const l=await fetch(`${h}/deposit/status?originChainId=137&depositTxHash=${r}`);if(l.ok){const p=await l.json(),x=(p.status??"pending").toLowerCase(),y=p.fillTx??p.fillTxnRef??null,f=p.actionsSucceeded!==!1;if(x==="filled")return{status:"filled",destinationTxHash:y,actionsSucceeded:f};if(x==="refunded"||x==="expired")return{status:x,destinationTxHash:null,actionsSucceeded:!1};a={status:"pending",destinationTxHash:y,actionsSucceeded:f}}}catch{}m<d-1&&await new Promise(l=>setTimeout(l,c))}return a}async function hn(r){const{name:i,identity:h,signer:c}=r,d=r.chainId??U.chainId,a=r.provider??"across",m=(r.beneficiary??await c.getAddress()).toLowerCase();let l=null,p=!1;console.info("[names] register start",{name:i,buyer:m,chainId:d,provider:a});try{const x=await st(d),y=ln(x);console.info("[names] step 1/6 sized reservation",{usdCents:y,manaRate:x});const f=await cn(h,i,{chainId:d,provider:a});console.info("[names] step 2/6 route fetched",{target:f.externalCall.target,selector:f.externalCall.selector,provider:f.provider,quoteId:f.quoteId});const C=await rt(h,y);if(l=C.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:C.credit.id,maxCreditedValue:C.maxCreditedValue}),ye.from(C.maxCreditedValue).lt(H))throw new Error("Credit under-sized for the name price");const k=dn(C.credit,f);let g;try{g=await Gt({chainId:d,buyer:m,signer:c,args:k})}catch(b){if(!(b instanceof Dt))throw b;g=await Zt(d,k,c)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:g}),await qt(g),p=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:g}),a==="across"){const b=await pn(g,r.acrossPoll);if(console.info("[names] step 6/6 across status",b),b.status==="pending")return{status:"pending",originTxHash:g};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:g,destinationTxHash:b.destinationTxHash}}return{status:"pending",originTxHash:g}}catch(x){if(console.error("[names] register failed — raw error:",x,{name:i,buyer:m,originConfirmed:p}),x instanceof Vt)return{status:"pending",originTxHash:x.txHash};if(l&&!p&&await ot(h,[l]).catch(()=>{}),x instanceof we)throw x;const y=new Error(Qt(x,"Couldn't register the name. Please try again.",{sale:!0}));throw y.cause=x,y}}const xn=s.div`
|
|
2
2
|
position: fixed;
|
|
3
3
|
inset: 0;
|
|
4
4
|
z-index: 10000;
|
|
@@ -7,7 +7,7 @@ import{d as Le,r as u,j as e,e as nt}from"./react-DehiWSvs.js";import{c as U,r a
|
|
|
7
7
|
justify-content: center;
|
|
8
8
|
padding: 16px;
|
|
9
9
|
background: rgba(22, 21, 24, 0.55);
|
|
10
|
-
`,
|
|
10
|
+
`,mn=s.div`
|
|
11
11
|
width: 560px;
|
|
12
12
|
max-width: 100%;
|
|
13
13
|
max-height: 92vh;
|
|
@@ -112,7 +112,7 @@ import{d as Le,r as u,j as e,e as nt}from"./react-DehiWSvs.js";import{c as U,r a
|
|
|
112
112
|
font-family: ${t.font.sans};
|
|
113
113
|
font-size: 14px;
|
|
114
114
|
color: ${t.colors.muted2};
|
|
115
|
-
`,
|
|
115
|
+
`,me=s.div`
|
|
116
116
|
flex: none;
|
|
117
117
|
display: flex;
|
|
118
118
|
align-items: center;
|
|
@@ -127,7 +127,7 @@ import{d as Le,r as u,j as e,e as nt}from"./react-DehiWSvs.js";import{c as U,r a
|
|
|
127
127
|
height: 22px;
|
|
128
128
|
color: ${t.colors.brandViolet};
|
|
129
129
|
}
|
|
130
|
-
`,
|
|
130
|
+
`,fn=s.div`
|
|
131
131
|
margin-top: 16px;
|
|
132
132
|
padding: 16px;
|
|
133
133
|
border-radius: 12px;
|
|
@@ -294,7 +294,7 @@ import{d as Le,r as u,j as e,e as nt}from"./react-DehiWSvs.js";import{c as U,r a
|
|
|
294
294
|
b {
|
|
295
295
|
font-weight: 700;
|
|
296
296
|
}
|
|
297
|
-
`,
|
|
297
|
+
`,Be=s.div`
|
|
298
298
|
display: flex;
|
|
299
299
|
gap: 16px;
|
|
300
300
|
margin-top: 20px;
|
|
@@ -302,7 +302,7 @@ import{d as Le,r as u,j as e,e as nt}from"./react-DehiWSvs.js";import{c as U,r a
|
|
|
302
302
|
${t.media.maxWidth("mobile")} {
|
|
303
303
|
flex-direction: column;
|
|
304
304
|
}
|
|
305
|
-
`,
|
|
305
|
+
`,We=s.button`
|
|
306
306
|
flex: 1;
|
|
307
307
|
height: 48px;
|
|
308
308
|
border: 1px solid ${t.colors.accent};
|
|
@@ -347,7 +347,7 @@ import{d as Le,r as u,j as e,e as nt}from"./react-DehiWSvs.js";import{c as U,r a
|
|
|
347
347
|
outline: 2px solid ${t.colors.accent};
|
|
348
348
|
outline-offset: 2px;
|
|
349
349
|
}
|
|
350
|
-
`,
|
|
350
|
+
`,fe=s.div`
|
|
351
351
|
display: flex;
|
|
352
352
|
align-items: flex-start;
|
|
353
353
|
gap: 12px;
|
|
@@ -379,7 +379,7 @@ import{d as Le,r as u,j as e,e as nt}from"./react-DehiWSvs.js";import{c as U,r a
|
|
|
379
379
|
color: ${t.colors.accent};
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
-
`;function In({name:r,priceCredits:i,onClose:h}){const{session:c}=Ue(),{data:d,isError:a}=lt(c),
|
|
382
|
+
`;function In({name:r,priceCredits:i,onClose:h}){const{session:c}=Ue(),{data:d,isError:a}=lt(c),m=ct(),l=Le(),[p,x]=u.useState("confirm"),[y,f]=u.useState(""),[C,k]=u.useState(null),g=u.useRef(!1),b=y.trim().toLowerCase()===r.toLowerCase(),S=p==="completing",v=i!=null?be(i):"—",_=i==null,E=d==null?void 0:d.credits,B=i!=null&&E!=null?i-E:0,$=B>0,T=_?n("names.priceUnavailable"):$?n("names.insufficientCredits",{credits:be(B)}):null;u.useEffect(()=>{const w=G=>{G.key==="Escape"&&!S&&h()};document.addEventListener("keydown",w);const O=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",w),document.body.style.overflow=O}},[S,h]);async function I(){if(!(!c||!b||_||$||g.current)){g.current=!0,x("completing"),k(null);try{const w=await hn({name:r,identity:c.identity,signer:c.signer});ee("Shop Completed Purchase",{purchase_type:"name",is_primary:!0,payment_type:"credits",value_credits:i??null,settlement:w.status}),m.invalidateQueries({queryKey:["usd-balance"]}),m.invalidateQueries({queryKey:["my-assets"]}),x(w.status==="registered"?"success":"pending")}catch(w){ee(xt(w)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:ht(w),purchase_type:"name"}),k(w instanceof we?n("names.errorRouteCost"):(w==null?void 0:w.message)||n("names.errorGeneric")),x("error")}finally{g.current=!1}}}const A=p!=="success"&&p!=="pending",N=dt(c==null?void 0:c.providerType);return e.jsx(xn,{onClick:S?void 0:h,role:"presentation",children:e.jsxs(mn,{role:"dialog","aria-modal":"true","aria-label":n("names.buyTitle"),onClick:w=>w.stopPropagation(),children:[A&&e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[e.jsx(oe,{children:p==="error"?n("names.errorTitle"):n("names.buyTitle")}),e.jsx(ie,{onClick:h,disabled:S,"aria-label":n("buyModal.close"),children:e.jsx(R,{name:"close"})})]}),e.jsxs(ae,{children:[n("names.myCreditsBalance")," ",e.jsx(M,{})," ",se(d,a)]}),e.jsx(le,{})]}),(p==="confirm"||p==="error")&&e.jsxs(e.Fragment,{children:[e.jsxs(ce,{children:[e.jsx(de,{"aria-hidden":!0,children:"@"}),e.jsxs(pe,{children:[e.jsxs(he,{children:[r,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(xe,{children:n("names.subtitle")})]}),e.jsxs(me,{children:[e.jsx(M,{}),v]})]}),p==="error"?e.jsxs(e.Fragment,{children:[e.jsxs(fe,{children:[e.jsx(R,{name:"info","aria-hidden":!0}),e.jsx("span",{children:C})]}),e.jsx(Me,{onClick:()=>x("confirm"),children:n("names.tryAgain")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(fn,{children:[e.jsx(un,{children:n("names.confirmTitle")}),e.jsx(gn,{dangerouslySetInnerHTML:{__html:n("names.confirmBody",{name:`<b>@${An(r)}</b>`})}}),e.jsxs(bn,{children:[e.jsx(yn,{"aria-hidden":!0,children:"@"}),e.jsx(wn,{value:y,onChange:w=>f(w.target.value.replace(/[^a-zA-Z0-9]/g,"")),placeholder:"yourname","aria-label":n("names.reenterAria"),autoComplete:"off",spellCheck:!1,style:{width:`${Math.max(y.length,8)}ch`}}),e.jsx(jn,{children:".dcl.eth"})]})]}),T?e.jsxs(fe,{"data-tone":"info","data-testid":"name-blocked-reason",children:[e.jsx(R,{name:"info","aria-hidden":!0}),e.jsx("span",{children:T})]}):null,e.jsx(Me,{onClick:()=>void I(),disabled:!b||!c||_||$,children:n("names.buyCta")})]})]}),p==="completing"&&e.jsxs(vn,{children:[e.jsx($n,{src:pt,alt:"",width:56,height:56}),e.jsx(Cn,{children:N?n("names.confirming"):n("names.completing")}),e.jsxs(kn,{children:[e.jsx(Sn,{"aria-hidden":!0,children:e.jsx("span",{})}),e.jsx(En,{children:"1/1"})]})]}),p==="pending"&&e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[e.jsx(oe,{children:n("names.pendingHeaderTitle")}),e.jsx(ie,{onClick:h,"aria-label":n("buyModal.close"),children:e.jsx(R,{name:"close"})})]}),e.jsxs(ae,{children:[n("names.myCreditsBalance")," ",e.jsx(M,{})," ",se(d,a)]}),e.jsx(le,{}),e.jsxs(fe,{"data-tone":"info",children:[e.jsx(R,{name:"info","aria-hidden":!0}),e.jsxs("span",{children:[e.jsx("b",{children:n("names.pendingBannerBold")})," ",n("names.pendingBannerRest")]})]}),e.jsxs(ce,{style:{marginTop:20},children:[e.jsx(de,{"aria-hidden":!0,children:"@"}),e.jsxs(pe,{children:[e.jsxs(he,{children:[r,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(xe,{children:n("names.subtitle")})]}),e.jsxs(me,{children:[e.jsx(M,{}),v]})]}),e.jsx(Be,{children:e.jsx(We,{onClick:()=>{h(),l("/my-items")},children:n("names.myItems")})})]}),p==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs(re,{children:[e.jsx(oe,{children:n("names.successHeaderTitle")}),e.jsx(ie,{onClick:h,"aria-label":n("buyModal.close"),children:e.jsx(R,{name:"close"})})]}),e.jsxs(ae,{children:[n("names.myCreditsBalance")," ",e.jsx(M,{})," ",se(d,a)]}),e.jsx(le,{}),e.jsxs(Rn,{children:[e.jsx(_n,{"aria-hidden":!0,children:e.jsx(R,{name:"check"})}),e.jsxs(Tn,{children:[e.jsx("b",{children:n("names.successBannerBold")})," ",n("names.successBannerRest")]})]}),e.jsxs(ce,{style:{marginTop:20},children:[e.jsx(de,{"aria-hidden":!0,children:"@"}),e.jsxs(pe,{children:[e.jsxs(he,{children:[r,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(xe,{children:n("names.subtitle")})]}),e.jsxs(me,{children:[e.jsx(M,{}),v]})]}),e.jsxs(Be,{children:[e.jsx(We,{onClick:()=>{h(),l("/my-items")},children:n("names.myItems")}),e.jsx(zn,{href:U.profileUrl,target:"_blank",rel:"noopener noreferrer",children:n("names.assignToAvatar")})]})]})]})})}function An(r){return r.replace(/[&<>"']/g,i=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[i])}const Nn="https://cdn.decentraland.org/@dcl/shop/0.7.1-30990238548.commit-e1a9b44/_assets/identity-B4DXDuJP.webp",Pn="https://cdn.decentraland.org/@dcl/shop/0.7.1-30990238548.commit-e1a9b44/_assets/world-B-9aPlxu.webp",Mn="https://cdn.decentraland.org/@dcl/shop/0.7.1-30990238548.commit-e1a9b44/_assets/invite-BfwIhP2C.webp",Bn="https://cdn.decentraland.org/@dcl/shop/0.7.1-30990238548.commit-e1a9b44/_assets/governance-DnazlIjy.webp",Wn=s.div`
|
|
383
383
|
width: 100%;
|
|
384
384
|
min-width: 0;
|
|
385
385
|
`,Fn=s.nav`
|
|
@@ -471,9 +471,9 @@ import{d as Le,r as u,j as e,e as nt}from"./react-DehiWSvs.js";import{c as U,r a
|
|
|
471
471
|
display: flex;
|
|
472
472
|
flex-direction: column;
|
|
473
473
|
gap: 12px;
|
|
474
|
-
`,
|
|
474
|
+
`,Zn=s.div`
|
|
475
475
|
position: relative;
|
|
476
|
-
`,
|
|
476
|
+
`,Kn=s("div",Yt("invalid"))`
|
|
477
477
|
display: flex;
|
|
478
478
|
align-items: center;
|
|
479
479
|
gap: 8px;
|
|
@@ -489,7 +489,7 @@ import{d as Le,r as u,j as e,e as nt}from"./react-DehiWSvs.js";import{c as U,r a
|
|
|
489
489
|
${t.media.maxWidth("mobile")} {
|
|
490
490
|
border-radius: 16px;
|
|
491
491
|
}
|
|
492
|
-
`,
|
|
492
|
+
`,Qn=s.span`
|
|
493
493
|
position: absolute;
|
|
494
494
|
left: -9999px;
|
|
495
495
|
top: 0;
|
|
@@ -504,7 +504,7 @@ import{d as Le,r as u,j as e,e as nt}from"./react-DehiWSvs.js";import{c as U,r a
|
|
|
504
504
|
${t.media.maxWidth("mobile")} {
|
|
505
505
|
font-size: 16px;
|
|
506
506
|
}
|
|
507
|
-
`,
|
|
507
|
+
`,Jn=s.div`
|
|
508
508
|
position: absolute;
|
|
509
509
|
top: calc(100% + 8px);
|
|
510
510
|
left: 0;
|
|
@@ -729,7 +729,7 @@ import{d as Le,r as u,j as e,e as nt}from"./react-DehiWSvs.js";import{c as U,r a
|
|
|
729
729
|
${t.media.maxWidth("mobile")} {
|
|
730
730
|
grid-template-columns: 1fr;
|
|
731
731
|
}
|
|
732
|
-
`,
|
|
732
|
+
`,K=s.article`
|
|
733
733
|
min-width: 0;
|
|
734
734
|
display: flex;
|
|
735
735
|
flex-direction: column;
|
|
@@ -737,13 +737,13 @@ import{d as Le,r as u,j as e,e as nt}from"./react-DehiWSvs.js";import{c as U,r a
|
|
|
737
737
|
border: 0.25px solid ${t.colors.muted2};
|
|
738
738
|
border-radius: ${t.radius.card};
|
|
739
739
|
overflow: hidden;
|
|
740
|
-
`,
|
|
740
|
+
`,Q=s.img`
|
|
741
741
|
display: block;
|
|
742
742
|
width: calc(100% + 0.5px);
|
|
743
743
|
margin: -0.25px -0.25px 0;
|
|
744
744
|
aspect-ratio: 388 / 235;
|
|
745
745
|
object-fit: cover;
|
|
746
|
-
`,
|
|
746
|
+
`,J=s.div`
|
|
747
747
|
flex: 1;
|
|
748
748
|
display: flex;
|
|
749
749
|
flex-direction: column;
|
|
@@ -798,4 +798,4 @@ import{d as Le,r as u,j as e,e as nt}from"./react-DehiWSvs.js";import{c as U,r a
|
|
|
798
798
|
clip: rect(0, 0, 0, 0);
|
|
799
799
|
white-space: nowrap;
|
|
800
800
|
border: 0;
|
|
801
|
-
`,xs="https://docs.decentraland.org/creator/worlds/about/",fs="https://governance.decentraland.org";function ms(r){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(r)}`}function us({onBack:r}){He({title:n("seo.names.title"),description:n("seo.names.description")});const{session:i,signIn:h}=Ue(),{data:c}=Oe(),d=c?Ge(H,c):null,[a,f]=u.useState(""),[l,p]=u.useState("idle"),[x,y]=u.useState(!1),m=u.useRef(null),[C,k]=u.useState(void 0);u.useLayoutEffect(()=>{m.current&&k(m.current.offsetWidth)},[a]),u.useEffect(()=>{if(!Ne(a).ok){p(a.length===0?"idle":"invalid");return}p("checking");const E=new AbortController,W=setTimeout(()=>{(async()=>{try{const $=await on(a,{signal:E.signal});p($)}catch($){if(($==null?void 0:$.name)==="AbortError")return;p("error")}})()},400);return()=>{clearTimeout(W),E.abort()}},[a]);const g=Ne(a),b=g.ok&&(l==="available"||l==="error");function S(){if(b){if(!i){h();return}y(!0)}}const v=e.jsxs(e.Fragment,{children:[n("names.claim"),d!=null?e.jsxs(os,{children:[e.jsx(M,{}),be(d)]}):null]});return e.jsxs(Bn,{"data-testid":"names-page",children:[e.jsxs(Fn,{"aria-label":n("names.breadcrumbAria"),children:[e.jsx(Ln,{onClick:r,children:n("names.breadcrumbCollectibles")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(Un,{children:n("names.breadcrumbCurrent")})]}),e.jsxs(Hn,{children:[e.jsxs(On,{children:[e.jsxs(Gn,{children:[e.jsx(Dn,{children:n("names.heroTitle")}),e.jsx(qn,{children:n("names.heroSubtitle")})]}),e.jsxs(Vn,{children:[e.jsxs(Kn,{children:[e.jsxs(Zn,{invalid:l==="taken",children:[e.jsxs(Yn,{children:[e.jsx(es,{"aria-hidden":!0,children:"@"}),e.jsx(ts,{value:a,onChange:_=>f(nn(_.target.value)),placeholder:n("names.inputPlaceholder"),"aria-label":n("names.inputAria"),autoComplete:"off",spellCheck:!1,maxLength:te,style:{width:C!=null?`${C}px`:void 0}}),e.jsx(Jn,{ref:m,"aria-hidden":!0,children:a||n("names.inputPlaceholder")}),e.jsx(ns,{children:n("names.suffix")})]}),a.length>0?e.jsxs(ss,{"aria-hidden":!0,children:[a.length,"/",te]}):null,e.jsx(qe,{onClick:S,disabled:!b,"data-testid":"names-claim",children:v})]}),l==="taken"?e.jsxs(Qn,{role:"status","data-testid":"names-taken",children:[e.jsx(R,{name:"info",size:16,"aria-hidden":!0}),e.jsx("span",{children:n("names.taken")}),e.jsxs(Xn,{href:ms(a),target:"_blank",rel:"noopener noreferrer",children:[n("names.takenMakeOffer"),e.jsx(R,{name:"external-link",size:13,"aria-hidden":!0})]})]}):null]}),e.jsx(rs,{onClick:S,disabled:!b,children:v}),l==="checking"?e.jsx(ue,{tone:"muted",role:"status","data-testid":"names-checking",children:n("names.checking")}):l==="error"?e.jsx(ue,{tone:"muted",role:"status",children:n("names.checkError")}):l==="invalid"&&!g.ok&&g.reason==="too-short"?e.jsx(ue,{tone:"muted",role:"status",children:n("names.tooShort",{min:De})}):null,e.jsx(hs,{role:"status","aria-live":"polite",children:l==="available"?n("names.available",{name:a}):""})]})]}),e.jsxs(is,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:n("names.whyTitle")}),e.jsx(cs,{children:n("names.whyIntro")})]}),e.jsxs(ds,{children:[e.jsxs(Z,{children:[e.jsx(J,{src:Nn,alt:""}),e.jsxs(Q,{children:[e.jsx(X,{children:n("names.why1Title")}),e.jsx(Y,{children:n("names.why1")})]})]}),e.jsxs(Z,{children:[e.jsx(J,{src:Pn,alt:""}),e.jsxs(Q,{children:[e.jsx(X,{children:n("names.why2Title")}),e.jsxs(Y,{children:[n("names.why2")," ",e.jsx(ps,{children:n("names.why2Address")})]}),e.jsxs(Fe,{href:xs,target:"_blank",rel:"noopener noreferrer",children:[n("names.learnMore"),e.jsx(R,{name:"external-link","aria-hidden":!0})]})]})]}),e.jsxs(Z,{children:[e.jsx(J,{src:Mn,alt:""}),e.jsxs(Q,{children:[e.jsx(X,{children:n("names.why3Title")}),e.jsx(Y,{children:n("names.why3")})]})]}),e.jsxs(Z,{children:[e.jsx(J,{src:Wn,alt:""}),e.jsxs(Q,{children:[e.jsx(X,{children:n("names.why4Title")}),e.jsx(Y,{children:n("names.why4")}),e.jsxs(Fe,{href:fs,target:"_blank",rel:"noopener noreferrer",children:[n("names.learnMore"),e.jsx(R,{name:"external-link","aria-hidden":!0})]})]})]})]})]})]}),x?e.jsx(In,{name:a,priceCredits:d,onClose:()=>y(!1)}):null]})}const gs="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",ge=48,bs=["all","on_sale","not_for_sale"];function Bs(){const[r,i]=nt(),h=Le(),c=(r.get("q")??"").trim().toLowerCase(),d=(r.get("q")??"").trim();He({title:d?n("seo.collectibles.searchTitle",{query:d}):n("seo.collectibles.title"),description:n("seo.collectibles.description")});const a=r.get("category")??(c?"all":"wearable"),f=r.get("status"),l=f&&bs.includes(f)?f:"on_sale",p=(o,j)=>i(z=>{const ne=new URLSearchParams(z);return j==null?ne.delete(o):ne.set(o,j),ne},{replace:!0}),[x,y]=u.useState(null),[m,C]=u.useState([]),[k,g]=u.useState(""),[b,S]=u.useState(""),[v,_]=u.useState(!1),[E,W]=u.useState("newest"),[$,T]=u.useState(!1);u.useEffect(()=>{if(!$)return;const o=z=>{z.key==="Escape"&&T(!1)};document.addEventListener("keydown",o);const j=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",o),document.body.style.overflow=j}},[$]);const I=l==="on_sale",A=k&&!Number.isNaN(Number(k))?Number(k):void 0,N=b&&!Number.isNaN(Number(b))?Number(b):void 0,w=ft(),O=x?Ft[x]:void 0,G=(Ae.find(o=>o.key===E)??Ae[0]).server,je={category:a,rarities:m.length?m:void 0,wearableCategories:O,minPriceCredits:A,maxPriceCredits:N,search:c||void 0,sortBy:G,isSmart:v||void 0,onSale:!0,listingType:w?void 0:"primary"},ve={category:a,rarities:m.length?m:void 0,wearableCategories:O,search:c||void 0,sortBy:G,isWearableSmart:v||void 0,isOnSale:l==="not_for_sale"?!1:void 0},{items:F,total:$e,isLoading:P,isPlaceholderData:B,error:Ce,hasNextPage:Ve,isFetchingNextPage:ke,isFetchNextPageError:Ke,fetchNextPage:Ze}=Ut(I?["shop-items",je]:["catalog-items",ve],o=>I?ut({...je,first:ge,skip:o}):gt({...ve,first:ge,skip:o}),{enabled:a!=="names"}),D=$e,{data:Se,isError:Je,isPending:Qe}=Oe(),Xe=o=>Se&&o.manaWei?Ge(o.manaWei,Se):null,Ye=I&&Qe&&F.some(o=>o.source==="legacy"),Ee=P||B||Ye,et=P?15:Math.min(Math.max(F.length,1),ge),Re=u.useRef(null);u.useEffect(()=>{P||B||!c||Re.current===c||(Re.current=c,ee("Shop Searched",{query:c,result_count:D}))},[c,P,B,D]);const q=u.useRef("__init__");u.useEffect(()=>{if(P||B)return;const o=JSON.stringify({category:a,subCategory:x,rarities:m,min:A,max:N,sort:E,status:l,smart:v});if(q.current==="__init__"||q.current===o){q.current=o;return}q.current=o,ee("Shop Applied Filter",{filters:{category:a,sub_category:x,rarities:m,min_price_credits:A??null,max_price_credits:N??null,status:l,smart:v,sort:E},result_count:D})},[a,x,m,A,N,E,l,v,P,B,D]);function _e(o){p("category",o),y(null)}function Te(o){p("status",o==="on_sale"?null:o)}function ze(o){C(j=>j.includes(o)?j.filter(z=>z!==o):[...j,o])}function tt(){i(o=>{const j=new URLSearchParams(o);return j.delete("category"),j.delete("status"),j},{replace:!0}),y(null),C([]),g(""),S(""),_(!1)}const L=[];(A!=null||N!=null)&&L.push({key:"price",label:n("filter.price"),onRemove:()=>{g(""),S("")}});for(const o of Wt)m.includes(o)&&L.push({key:`rarity-${o}`,label:mt(o),onRemove:()=>ze(o)});return v&&L.push({key:"smart",label:n("filter.smart"),onRemove:()=>_(!1)}),l!=="on_sale"&&L.push({key:"status",label:l==="all"?n("filter.statusAll"):n("filter.notForSale"),onRemove:()=>Te("on_sale")}),e.jsxs(bt,{"data-testid":"browse",children:[a!=="names"&&e.jsxs(e.Fragment,{children:[$?e.jsx(yt,{onClick:()=>T(!1),"aria-hidden":!0}):null,e.jsxs(wt,{"data-open":$||void 0,"data-testid":"browse-sidebar",children:[e.jsxs(jt,{children:[e.jsx(vt,{children:n("assets.filters")}),e.jsx($t,{onClick:()=>T(!1),"aria-label":n("assets.closeFilters"),children:"✕"})]}),e.jsx(Ct,{children:e.jsx(kt,{category:a,subCategory:x,onCategory:_e,onSub:y,priceMin:k,priceMax:b,onPriceMin:g,onPriceMax:S,rarities:m,onToggleRarity:ze,status:l,onStatus:Te,smart:v,onSmart:_})}),e.jsx(St,{children:e.jsx(Et,{type:"button",onClick:()=>T(!1),children:n("assets.showItems")})})]})]}),e.jsx(Rt,{children:a==="names"?e.jsx(us,{onBack:()=>_e("wearable")}):e.jsxs(e.Fragment,{children:[e.jsx(Bt,{sort:E,onSort:W,total:$e,loading:P||B,query:c,onOpenFilters:()=>T(!0),chips:L,onClearChips:tt}),Je&&I&&F.some(o=>o.source==="legacy")?e.jsx(_t,{"data-variant":"warn",children:n("assets.marketUnavailable")}):null,Ce?e.jsx(Ht,{message:n("assets.loadError"),testId:"browse-error"}):null,!Ee&&F.length===0&&!Ce?e.jsxs(Tt,{"data-testid":"browse-empty",children:[e.jsx(zt,{src:gs,alt:""}),e.jsxs(It,{children:[e.jsx(At,{children:n("assets.empty.title")}),e.jsx(Nt,{children:d?e.jsxs(e.Fragment,{children:[n("assets.empty.searchBefore"),e.jsx("b",{children:d}),n("assets.empty.searchAfter")]}):n("assets.empty.filters")})]}),e.jsx(Pt,{children:e.jsx(Mt,{type:"button",onClick:()=>h("/overview"),children:n("assets.empty.cta")})})]}):e.jsxs(e.Fragment,{children:[e.jsx(en,{"data-testid":"grid",children:Ee?e.jsx(Ie,{count:et}):e.jsxs(e.Fragment,{children:[F.map(o=>{if(!I)return e.jsx(V,{item:o,mode:"view"},K(o));const j=o;if(j.source!=="legacy")return e.jsx(V,{item:o},K(o));const z=Xe(j);return z==null?e.jsx(V,{item:o,mode:"view"},K(o)):e.jsx(V,{item:{...j,priceCredits:z}},K(o))}),ke?e.jsx(Ie,{count:6}):null]})}),e.jsx(Lt,{hasNextPage:Ve,isFetching:ke,isError:Ke,onLoadMore:()=>void Ze()})]})]})})]})}export{Bs as Assets};
|
|
801
|
+
`,xs="https://docs.decentraland.org/creator/worlds/about/",ms="https://governance.decentraland.org";function fs(r){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(r)}`}function us({onBack:r}){He({title:n("seo.names.title"),description:n("seo.names.description")});const{session:i,signIn:h}=Ue(),{data:c}=Oe(),d=c?Ge(H,c):null,[a,m]=u.useState(""),[l,p]=u.useState("idle"),[x,y]=u.useState(!1),f=u.useRef(null),[C,k]=u.useState(void 0);u.useLayoutEffect(()=>{f.current&&k(f.current.offsetWidth)},[a]),u.useEffect(()=>{if(!Ne(a).ok){p(a.length===0?"idle":"invalid");return}p("checking");const E=new AbortController,B=setTimeout(()=>{(async()=>{try{const $=await on(a,{signal:E.signal});p($)}catch($){if(($==null?void 0:$.name)==="AbortError")return;p("error")}})()},400);return()=>{clearTimeout(B),E.abort()}},[a]);const g=Ne(a),b=g.ok&&(l==="available"||l==="error");function S(){if(b){if(!i){h();return}y(!0)}}const v=e.jsxs(e.Fragment,{children:[n("names.claim"),d!=null?e.jsxs(os,{children:[e.jsx(M,{}),be(d)]}):null]});return e.jsxs(Wn,{"data-testid":"names-page",children:[e.jsxs(Fn,{"aria-label":n("names.breadcrumbAria"),children:[e.jsx(Ln,{onClick:r,children:n("names.breadcrumbCollectibles")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(Un,{children:n("names.breadcrumbCurrent")})]}),e.jsxs(Hn,{children:[e.jsxs(On,{children:[e.jsxs(Gn,{children:[e.jsx(Dn,{children:n("names.heroTitle")}),e.jsx(qn,{children:n("names.heroSubtitle")})]}),e.jsxs(Vn,{children:[e.jsxs(Zn,{children:[e.jsxs(Kn,{invalid:l==="taken",children:[e.jsxs(Yn,{children:[e.jsx(es,{"aria-hidden":!0,children:"@"}),e.jsx(ts,{value:a,onChange:_=>m(nn(_.target.value)),placeholder:n("names.inputPlaceholder"),"aria-label":n("names.inputAria"),autoComplete:"off",spellCheck:!1,maxLength:te,style:{width:C!=null?`${C}px`:void 0}}),e.jsx(Qn,{ref:f,"aria-hidden":!0,children:a||n("names.inputPlaceholder")}),e.jsx(ns,{children:n("names.suffix")})]}),a.length>0?e.jsxs(ss,{"aria-hidden":!0,children:[a.length,"/",te]}):null,e.jsx(qe,{onClick:S,disabled:!b,"data-testid":"names-claim",children:v})]}),l==="taken"?e.jsxs(Jn,{role:"status","data-testid":"names-taken",children:[e.jsx(R,{name:"info",size:16,"aria-hidden":!0}),e.jsx("span",{children:n("names.taken")}),e.jsxs(Xn,{href:fs(a),target:"_blank",rel:"noopener noreferrer",children:[n("names.takenMakeOffer"),e.jsx(R,{name:"external-link",size:13,"aria-hidden":!0})]})]}):null]}),e.jsx(rs,{onClick:S,disabled:!b,children:v}),l==="checking"?e.jsx(ue,{tone:"muted",role:"status","data-testid":"names-checking",children:n("names.checking")}):l==="error"?e.jsx(ue,{tone:"muted",role:"status",children:n("names.checkError")}):l==="invalid"&&!g.ok&&g.reason==="too-short"?e.jsx(ue,{tone:"muted",role:"status",children:n("names.tooShort",{min:De})}):null,e.jsx(hs,{role:"status","aria-live":"polite",children:l==="available"?n("names.available",{name:a}):""})]})]}),e.jsxs(is,{children:[e.jsxs(as,{children:[e.jsx(ls,{children:n("names.whyTitle")}),e.jsx(cs,{children:n("names.whyIntro")})]}),e.jsxs(ds,{children:[e.jsxs(K,{children:[e.jsx(Q,{src:Nn,alt:""}),e.jsxs(J,{children:[e.jsx(X,{children:n("names.why1Title")}),e.jsx(Y,{children:n("names.why1")})]})]}),e.jsxs(K,{children:[e.jsx(Q,{src:Pn,alt:""}),e.jsxs(J,{children:[e.jsx(X,{children:n("names.why2Title")}),e.jsxs(Y,{children:[n("names.why2")," ",e.jsx(ps,{children:n("names.why2Address")})]}),e.jsxs(Fe,{href:xs,target:"_blank",rel:"noopener noreferrer",children:[n("names.learnMore"),e.jsx(R,{name:"external-link","aria-hidden":!0})]})]})]}),e.jsxs(K,{children:[e.jsx(Q,{src:Mn,alt:""}),e.jsxs(J,{children:[e.jsx(X,{children:n("names.why3Title")}),e.jsx(Y,{children:n("names.why3")})]})]}),e.jsxs(K,{children:[e.jsx(Q,{src:Bn,alt:""}),e.jsxs(J,{children:[e.jsx(X,{children:n("names.why4Title")}),e.jsx(Y,{children:n("names.why4")}),e.jsxs(Fe,{href:ms,target:"_blank",rel:"noopener noreferrer",children:[n("names.learnMore"),e.jsx(R,{name:"external-link","aria-hidden":!0})]})]})]})]})]})]}),x?e.jsx(In,{name:a,priceCredits:d,onClose:()=>y(!1)}):null]})}const gs="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",ge=48,bs=["all","on_sale","not_for_sale"];function Ws(){const[r,i]=nt(),h=Le(),c=(r.get("q")??"").trim().toLowerCase(),d=(r.get("q")??"").trim();He({title:d?n("seo.collectibles.searchTitle",{query:d}):n("seo.collectibles.title"),description:n("seo.collectibles.description")});const a=r.get("category")??(c?"all":"wearable"),m=r.get("status"),l=m&&bs.includes(m)?m:"on_sale",p=(o,j)=>i(z=>{const ne=new URLSearchParams(z);return j==null?ne.delete(o):ne.set(o,j),ne},{replace:!0}),[x,y]=u.useState(null),[f,C]=u.useState([]),[k,g]=u.useState(""),[b,S]=u.useState(""),[v,_]=u.useState(!1),[E,B]=u.useState("newest"),[$,T]=u.useState(!1);u.useEffect(()=>{if(!$)return;const o=z=>{z.key==="Escape"&&T(!1)};document.addEventListener("keydown",o);const j=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",o),document.body.style.overflow=j}},[$]);const I=l==="on_sale",A=k&&!Number.isNaN(Number(k))?Number(k):void 0,N=b&&!Number.isNaN(Number(b))?Number(b):void 0,w=mt(),O=x?Ft[x]:void 0,G=(Ae.find(o=>o.key===E)??Ae[0]).server,je={category:a,rarities:f.length?f:void 0,wearableCategories:O,minPriceCredits:A,maxPriceCredits:N,search:c||void 0,sortBy:G,isSmart:v||void 0,onSale:!0,listingType:w?void 0:"primary"},ve={category:a,rarities:f.length?f:void 0,wearableCategories:O,search:c||void 0,sortBy:G,isWearableSmart:v||void 0,isOnSale:l==="not_for_sale"?!1:void 0},{items:F,total:$e,isLoading:P,isPlaceholderData:W,error:Ce,hasNextPage:Ve,isFetchingNextPage:ke,isFetchNextPageError:Ze,fetchNextPage:Ke}=Ut(I?["shop-items",je]:["catalog-items",ve],o=>I?ut({...je,first:ge,skip:o}):gt({...ve,first:ge,skip:o}),{enabled:a!=="names"}),D=$e,{data:Se,isError:Qe,isPending:Je}=Oe(),Xe=o=>Se&&o.manaWei?Ge(o.manaWei,Se):null,Ye=I&&Je&&F.some(o=>o.source==="legacy"),Ee=P||W||Ye,et=P?15:Math.min(Math.max(F.length,1),ge),Re=u.useRef(null);u.useEffect(()=>{P||W||!c||Re.current===c||(Re.current=c,ee("Shop Searched",{query:c,result_count:D}))},[c,P,W,D]);const q=u.useRef("__init__");u.useEffect(()=>{if(P||W)return;const o=JSON.stringify({category:a,subCategory:x,rarities:f,min:A,max:N,sort:E,status:l,smart:v});if(q.current==="__init__"||q.current===o){q.current=o;return}q.current=o,ee("Shop Applied Filter",{filters:{category:a,sub_category:x,rarities:f,min_price_credits:A??null,max_price_credits:N??null,status:l,smart:v,sort:E},result_count:D})},[a,x,f,A,N,E,l,v,P,W,D]);function _e(o){p("category",o),y(null)}function Te(o){p("status",o==="on_sale"?null:o)}function ze(o){C(j=>j.includes(o)?j.filter(z=>z!==o):[...j,o])}function tt(){i(o=>{const j=new URLSearchParams(o);return j.delete("category"),j.delete("status"),j},{replace:!0}),y(null),C([]),g(""),S(""),_(!1)}const L=[];(A!=null||N!=null)&&L.push({key:"price",label:n("filter.price"),onRemove:()=>{g(""),S("")}});for(const o of Bt)f.includes(o)&&L.push({key:`rarity-${o}`,label:ft(o),onRemove:()=>ze(o)});return v&&L.push({key:"smart",label:n("filter.smart"),onRemove:()=>_(!1)}),l!=="on_sale"&&L.push({key:"status",label:l==="all"?n("filter.statusAll"):n("filter.notForSale"),onRemove:()=>Te("on_sale")}),e.jsxs(bt,{"data-testid":"browse",children:[a!=="names"&&e.jsxs(e.Fragment,{children:[$?e.jsx(yt,{onClick:()=>T(!1),"aria-hidden":!0}):null,e.jsxs(wt,{"data-open":$||void 0,"data-testid":"browse-sidebar",children:[e.jsxs(jt,{children:[e.jsx(vt,{children:n("assets.filters")}),e.jsx($t,{onClick:()=>T(!1),"aria-label":n("assets.closeFilters"),children:"✕"})]}),e.jsx(Ct,{children:e.jsx(kt,{category:a,subCategory:x,onCategory:_e,onSub:y,priceMin:k,priceMax:b,onPriceMin:g,onPriceMax:S,rarities:f,onToggleRarity:ze,status:l,onStatus:Te,smart:v,onSmart:_})}),e.jsx(St,{children:e.jsx(Et,{type:"button",onClick:()=>T(!1),children:n("assets.showItems")})})]})]}),e.jsx(Rt,{children:a==="names"?e.jsx(us,{onBack:()=>_e("wearable")}):e.jsxs(e.Fragment,{children:[e.jsx(Wt,{sort:E,onSort:B,total:$e,loading:P||W,query:c,onOpenFilters:()=>T(!0),chips:L,onClearChips:tt}),Qe&&I&&F.some(o=>o.source==="legacy")?e.jsx(_t,{"data-variant":"warn",children:n("assets.marketUnavailable")}):null,Ce?e.jsx(Ht,{message:n("assets.loadError"),testId:"browse-error"}):null,!Ee&&F.length===0&&!Ce?e.jsxs(Tt,{"data-testid":"browse-empty",children:[e.jsx(zt,{src:gs,alt:""}),e.jsxs(It,{children:[e.jsx(At,{children:n("assets.empty.title")}),e.jsx(Nt,{children:d?e.jsxs(e.Fragment,{children:[n("assets.empty.searchBefore"),e.jsx("b",{children:d}),n("assets.empty.searchAfter")]}):n("assets.empty.filters")})]}),e.jsx(Pt,{children:e.jsx(Mt,{type:"button",onClick:()=>h("/overview"),children:n("assets.empty.cta")})})]}):e.jsxs(e.Fragment,{children:[e.jsx(en,{"data-testid":"grid",children:Ee?e.jsx(Ie,{count:et}):e.jsxs(e.Fragment,{children:[F.map(o=>{if(!I)return e.jsx(V,{item:o,mode:"view"},Z(o));const j=o;if(j.source!=="legacy")return e.jsx(V,{item:o},Z(o));const z=Xe(j);return z==null?e.jsx(V,{item:o,mode:"view"},Z(o)):e.jsx(V,{item:{...j,priceCredits:z}},Z(o))}),ke?e.jsx(Ie,{count:6}):null]})}),e.jsx(Lt,{hasNextPage:Ve,isFetching:ke,isError:Ze,onLoadMore:()=>void Ke()})]})]})})]})}export{Ws as Assets};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as $,j as t}from"./react-DehiWSvs.js";import{R as T,C as se,a as ae,b as re}from"./categories-
|
|
1
|
+
import{r as $,j as t}from"./react-DehiWSvs.js";import{R as T,C as se,a as ae,b as re}from"./categories-CACS82PB.js";import{n as c,T as le}from"./Tooltip-CAQFB2Mi.js";import{t as e,s as o,I as g,d as s,ag as ce,e as v}from"./index-DfPAN1ow.js";const de=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,o as D,q as F,d as e,k as G,v as O,I as b,w as B,n as w,x as K,c as Q,y as H,z as A,A as X,D as Z,E}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,o as D,q as F,d as e,k as G,v as O,I as b,w as B,n as w,x as K,c as Q,y as H,z as A,A as X,D as Z,E}from"./index-DfPAN1ow.js";import{d as J,f as U,b as V,h as Y,s as tt,a as it}from"./authorizations-CsaESAMY.js";import{f as et}from"./builder-DObMg-l1.js";import{m as ot}from"./mana-matic-C4e1sNO3.js";import{f as at}from"./errors-CQRcoIkN.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-DKOg7kXu.js";const nt=D`
|
|
2
2
|
to { transform: rotate(360deg); }
|
|
3
3
|
`,st=D`
|
|
4
4
|
to { background-position: -200% 0; }
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,L as $e,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t as ue,s as i,d as a,
|
|
1
|
+
import{j as e,L as $e,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t as ue,s as i,d as a,az as le,b5 as sa,ay as na,I as H,w as Mt,af as Ue,q as ia,Q as N,ah as dt,k as ra,l as oa,n as ca,b6 as da,x as la,b7 as ua,ai as ha,b8 as pa,b9 as lt,ba as ga,bb as xa,v as ma,bc as ut,S as G,bd as ht,be as fa,A as ae,r as ya,c as pt,bf as ba,e as va,bg as gt,bh as _e,bi as ye,bj as be,bk as xt,g as ve,a as wa,C as We,bl as Ca}from"./index-DfPAN1ow.js";import{M as ja,S as ka,C as Sa,H as $a,a as Ma,T as Ta,X as Ia,b as Pa,B as za,c as Aa,d as mt,e as Ea,f as ke,P as Tt,m as qa,g as Ba,h as Ra,i as _a,j as It,k as Se,L as Wa,l as Fa,n as ft,o as yt,W as La,p as Ka,q as Qa,A as Ua,r as Na,s as Ha,t as Oa,u as Va,v as Ga,w as Da,x as Ya,y as Ja,z as Xa,D as Za,E as es,F as ts,G as as,I as ss,J as ns,K as Fe,N as is,O as rs,Q as os,R as cs,U as bt,V as vt,Y as ds,Z as ls,_ as us}from"./CollectionCarousel-GCvOV-Gg.js";import{j as hs,k as ps,a as gs,n as xs,i as ms,A as fs}from"./authorizations-CsaESAMY.js";import{g as ys,b as Le}from"./buy-A9t_7x8k.js";import{b as bs,w as vs,S as wt,G as ws}from"./buy-gasless-Bniq3BQd.js";import{u as Cs,M as js,R as we,r as ks,c as Ss,p as Ct}from"./useCreditPacks-D9xD4P3c.js";import{i as $s,a as Ms}from"./errors-CQRcoIkN.js";import{E as Ts}from"./ErrorNotice-Dqta24N5.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-WMxi4i0g.js";import"./sendMetaTransaction-DKOg7kXu.js";const{colors:se,radius:Is}=ue,Ps=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 $e,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
58
58
|
font-weight: 700;
|
|
59
59
|
color: ${se.text};
|
|
60
60
|
}
|
|
61
|
-
`,Bs="https://cdn.decentraland.org/@dcl/shop/0.7.
|
|
61
|
+
`,Bs="https://cdn.decentraland.org/@dcl/shop/0.7.1-30990238548.commit-e1a9b44/_assets/buy-error-22UunaPC.png";function Rs(o){const{phase:l,balanceCredits:I,onClose:z}=o,W=l==="processing",D=l==="error"?a("cartCheckout.errorTitle"):l==="nofunds"?a("cartCheckout.titleNoFunds"):l==="choose"?a("buyModal.choosePayment"):a("cartCheckout.titleBuy"),Y=l==="processing";return e.jsxs(ja,{role:"dialog","aria-modal":"true","aria-label":a("cartCheckout.dialogAria"),children:[e.jsx(ka,{onClick:W?void 0:z,"aria-hidden":!0}),e.jsxs(Sa,{"data-tall":Y||void 0,children:[e.jsxs($a,{children:[e.jsxs(Ma,{children:[e.jsx(Ta,{children:D}),!W&&e.jsx(Ia,{onClick:z,"aria-label":a("buyModal.close"),children:e.jsx(Pa,{})})]}),e.jsxs(za,{children:[e.jsx(Aa,{children:l==="nofunds"?a("buyModal.dclBalance"):a("buyModal.myCreditsBalance")}),e.jsx(mt,{}),e.jsx(Ea,{children:le(I)})]})]}),l==="choose"&&e.jsxs(ke,{children:[e.jsxs(qs,{children:[e.jsx("span",{children:a("cart.purchaseSummary")}),e.jsxs("strong",{children:[e.jsx(mt,{}),le(o.totalCredits??0)]})]}),e.jsx(Tt,{options:o.options??[],totalCents:o.totalCents??0,onPay:o.onPay??(()=>{}),rateNote:(()=>{const A=qa(o.totalCents??0,o.totalManaWei??0n);return A!=null?a("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(Ws,{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(Ba,{"data-testid":"buy-error",children:[e.jsx(Ra,{src:Bs,alt:"",width:64,height:80}),e.jsxs(_a,{children:[e.jsx("b",{children:a("cartCheckout.errorHeadline")})," ",o.message??a("cartCheckout.errorBody")]})]}),e.jsxs(It,{children:[e.jsx(Se,{"data-variant":"outline",onClick:z,children:a("buyModal.cancel")}),e.jsx(Se,{"data-variant":"purple",onClick:o.onRetry??z,children:a("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?a("cartCheckout.confirmMultiple",{current:W.current,total:W.total}):a("buyModal.confirmToContinue"):a("buyModal.completingTransaction"):o==="settling"?a("buyModal.completingTransaction"):a("cartCheckout.preparing");return e.jsxs(ke,{"data-processing":!0,children:[e.jsx(Wa,{src:sa,alt:"",width:61,height:61}),e.jsx(Fa,{children:ne}),D?e.jsxs(Ps,{children:[e.jsx(ft,{"aria-hidden":!0,children:e.jsx(yt,{"data-step":!0,style:{width:`${Y}%`}})}),I>1?e.jsxs(zs,{children:[l,"/",I]}):null]}):e.jsx(ft,{"aria-hidden":!0,children:e.jsx(yt,{})})]})}function Ws({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(La,{"data-testid":"nofunds-warning",children:[e.jsx(Ka,{}),e.jsxs(Qa,{children:[e.jsx("b",{children:a("buyModal.insufficientFunds")})," ",a("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:a("buyModal.warningCreditsAmount",{count:Math.max(0,l)})})," ",a("buyModal.warningToPurchase",{count:ne})]})]}),e.jsx(As,{children:o.map(n=>{const L=n.quantity??1;return e.jsxs(Ua,{children:[e.jsx(Na,{children:n.item.thumbnail?e.jsx("img",{src:n.item.thumbnail,alt:""}):null}),e.jsxs(Ha,{children:[e.jsxs("div",{children:[e.jsxs(Oa,{title:n.item.name,children:[n.item.name||a("buyModal.itemFallback"),L>1?e.jsx(Es,{children:a("cartCheckout.qty",{count:L})}):null]}),n.item.creator?e.jsx(Va,{address:n.item.creator}):null]}),e.jsxs(Ga,{children:[e.jsx(Da,{}),e.jsx("span",{children:le(n.priceCredits*L)})]})]})]},n.item.id)})}),e.jsx(Ya,{children:I.map(n=>{const L=n.id===z;return e.jsxs(Ja,{"data-testid":"credit-pack","data-on":L||void 0,onClick:()=>W(n.id),children:[e.jsx(Xa,{}),e.jsx(Za,{children:le(n.credits)}),e.jsxs(es,{children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ss,{}),e.jsx("span",{children:le((A==null?void 0:A.credits)??0)})]}),e.jsxs(ns,{children:["$",((A==null?void 0:A.usd)??0).toFixed(2)]})]}),e.jsxs(It,{children:[e.jsx(Se,{"data-variant":"outline",onClick:Y,children:a("buyModal.cancel")}),e.jsx(Se,{"data-variant":"gradient",onClick:D,children:a("buyModal.buy")})]})]})}const{colors:r,gradients:Pt,radius:Z}=ue,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
|
|
@@ -147,7 +147,7 @@ import{j as e,L as $e,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
147
147
|
${T} {
|
|
148
148
|
padding: 16px;
|
|
149
149
|
}
|
|
150
|
-
`,
|
|
150
|
+
`,Qs=i(At)`
|
|
151
151
|
display: flex;
|
|
152
152
|
flex-direction: column;
|
|
153
153
|
align-items: center;
|
|
@@ -162,13 +162,13 @@ import{j as e,L as $e,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
162
162
|
min-height: 320px;
|
|
163
163
|
padding: 32px 16px;
|
|
164
164
|
}
|
|
165
|
-
`,
|
|
165
|
+
`,Us=i.div`
|
|
166
166
|
display: flex;
|
|
167
167
|
flex-direction: column;
|
|
168
168
|
align-items: center;
|
|
169
169
|
gap: 12px;
|
|
170
170
|
padding-bottom: 16px;
|
|
171
|
-
`,
|
|
171
|
+
`,Ns=i.p`
|
|
172
172
|
margin: 0;
|
|
173
173
|
font-size: 24px;
|
|
174
174
|
font-weight: 700;
|
|
@@ -360,7 +360,7 @@ import{j as e,L as $e,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
360
360
|
gap: 4px;
|
|
361
361
|
min-width: 0;
|
|
362
362
|
padding-right: 64px; /* clear the top-right favourite + remove group */
|
|
363
|
-
`,Et=
|
|
363
|
+
`,Et=Ue`
|
|
364
364
|
display: block;
|
|
365
365
|
font-size: 16px;
|
|
366
366
|
font-weight: 600;
|
|
@@ -512,7 +512,7 @@ import{j as e,L as $e,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
512
512
|
width: 11.31px;
|
|
513
513
|
height: 10.94px;
|
|
514
514
|
background: ${r.text};
|
|
515
|
-
`,qt=
|
|
515
|
+
`,qt=Ue`
|
|
516
516
|
display: grid;
|
|
517
517
|
place-items: center;
|
|
518
518
|
width: 24px;
|
|
@@ -658,7 +658,7 @@ import{j as e,L as $e,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
658
658
|
opacity: 0.6;
|
|
659
659
|
cursor: default;
|
|
660
660
|
}
|
|
661
|
-
`,Bt=
|
|
661
|
+
`,Bt=Ue`
|
|
662
662
|
margin: 0;
|
|
663
663
|
font-size: 13px;
|
|
664
664
|
`,Ce=i.p`
|
|
@@ -692,4 +692,4 @@ import{j as e,L as $e,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
692
692
|
& section {
|
|
693
693
|
margin-top: 0;
|
|
694
694
|
}
|
|
695
|
-
`;function Ke(o){if($s(o))return a("errors.rejected");const l=(o.message??"").toLowerCase();return l.includes("insufficient")?a("cart.error.insufficient",{currency:va.name}):l.includes("no active listing")||l.includes("your own listing")?a("cart.error.listingChanged"):a("marketCheckout.error.generic")}const En=12e4;function qn(o){const l=[];return o.unavailable.length&&l.push(a("cart.drop.unavailable",{count:o.unavailable.length})),o.own.length&&l.push(a("cart.drop.own",{count:o.own.length})),a("cart.drop.removed",{items:l.join(` ${a("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 Yn(){ia({title:a("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}=ra(),Rt=oa(),he=Cs().packs.slice(0,js);P.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const _t=o.some(t=>t.category!=="emote"),{data:Me}=ca({queryKey:["upsell-listings"],queryFn:()=>Ca({first:40}),staleTime:6e4}),{data:S}=da(n),b=la(),ee=ta(),{state:J}=aa(),[Wt,ie]=P.useState(null),[Qe,pe]=P.useState(null),[Ft,B]=P.useState(!1),[R,O]=P.useState(null),He=P.useRef(0),[p,j]=P.useState(null),{data:ge}=ua(n),{data:re}=ha(!0),[Te,Oe]=P.useState(""),oe=P.useRef(null),Ve=pa(o),Ge=t=>ut(Ve[t.id]),Ie=o.filter(Ge),Pe=o.length>0&&Ie.length===0,Lt=Ie.reduce((t,s)=>t+s.priceCredits*s.quantity,0),Kt=o.reduce((t,s)=>t+s.quantity,0),Ut=Ie.reduce((t,s)=>t+s.quantity,0),De=R?R.liveTotalCredits:Lt,Nt=new Set(o.map(t=>t.id)),Ye=((Me==null?void 0:Me.items)??[]).filter(t=>!Nt.has(t.id)).slice(0,12),Qt=new Map(R==null?void 0:R.buyable.map(t=>[t.item.id,t])),xe=(S==null?void 0:S.credits)??0,ze=De*10,Ht=re?lt(ze,re):0n,ce=Fe({priceCents:ze,priceManaWei:Ht,balanceCents:(S==null?void 0:S.balanceCents)??0,manaBalanceWei:ge??0n}),Ot=t=>t.some(s=>s.acquisition==="store"),Ae=t=>t.flatMap(s=>s.acquisition==="trade"?[s]:[]),Vt=fa,Gt=t=>ba(t.contractAddress,String(t.itemId));function me(t){t(),O(null),pe(null),ie(null)}function Dt(){j(null),B(!1)}function Je(t){const s=Ue(t),d=Math.max(0,s-xe),c=he.find(u=>u.credits>=d)??he[he.length-1];Oe(c.id),G("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:s,credits_balance:xe,shortfall:d}),j({phase:"nofunds",lines:t.map(u=>({item:u.item,priceCredits:u.priceCredits,quantity:u.quantity})),shortfall:d}),B(!1)}async function Ee(t){if(!n||t.length===0)return;const s=je(t),d=s.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,$=new Set,_=new Set,E=[];let q=!1;j({phase:"processing",stage:"reserving",step:1,total:s.length});try{const y=[];for(let m=0;m<s.length;m++){const x=s[m];j({phase:"processing",stage:"reserving",step:m+1,total:s.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 gt(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(Ms(M)){if(u.length){try{await _e(n.identity,u.map(C=>C.salt))}catch(C){ae(C,{flow:"cart_checkout",step:"release"})}b.invalidateQueries({queryKey:["usd-balance"]})}Je(t);return}throw M}}h="submit";const g=ys(y).length,k=m=>g>1?{current:m,total:g}:void 0,F=(m,x)=>j({phase:"processing",stage:m,step:s.length,total:s.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(hs()&&!v)try{const m=new Map;f=await bs({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=>vs(C)));x.forEach((C,N)=>{const X=m.get(f[N])??[];C.status==="fulfilled"?(X.forEach(Re=>$.add(Re)),E.push(f[N])):C.reason instanceof wt||X.forEach(Re=>_.add(Re))});const M=x.flatMap(C=>C.status==="rejected"?[C.reason]:[]);if(M.length&&!M.some(C=>C instanceof wt))throw M[0];q=!0}catch(m){if(!(m instanceof ws))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=>$.add(C)),E.push(x)},onReverted:({salts:x})=>x.forEach(M=>_.add(M))})}else f=await Le({purchases:y,buyer:n.address,signer:n.signer,onSigned:K,onBroadcast:({salts:m})=>m.forEach(x=>w.add(x)),onSettled:({txHash:m,salts:x})=>{x.forEach(M=>$.add(M)),E.push(m)},onReverted:({salts:m})=>m.forEach(x=>_.add(x))});t.forEach(m=>l(m.item.id)),O(null),G("Shop Completed Purchase",{...ye(d),payment_type:"credits",no_crypto_step:q,transaction_hash:f[0]??null}),vt(b);const de=oe.current;oe.current=null,j(null),B(!1);const Be={items:c,txHash:f[0]??void 0,txHashes:f,settled:!0,...de?{creditsAdded:de}:{}};ee("/success",{state:Be,replace:!0})}catch(y){be(y)||ae(y,{flow:"cart_checkout",step:h,cart_size:t.length});const g=new Set([...w].filter(v=>!_.has(v))),{toRelease:k,boughtItemIds:F}=Ct({reservations:u,spent:g,settled:$}),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:xt(y),value_usd:ht(f.reduce((v,U)=>v+U.priceCredits,0)),cart_size:s.length,partial:K.length>0}),k.length)try{await _e(n.identity,k)}catch(v){ae(v,{flow:"cart_checkout",step:"release"})}if(b.invalidateQueries({queryKey:["usd-balance"]}),K.length>0){F.forEach(v=>l(v)),O(null),vt(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:a("cart.error.partiallyBought")}),B(!1);return}j({phase:"error",message:Ke(y)})}}function Xe(t,s){b.invalidateQueries({queryKey:["usd-balance"]}),b.invalidateQueries({queryKey:["detail-trade"]}),b.invalidateQueries({queryKey:["shop-item"]}),b.invalidateQueries({queryKey:["owned-token"]}),b.invalidateQueries({queryKey:["public-token"]}),b.invalidateQueries({queryKey:["item-resales"]}),b.invalidateQueries({queryKey:["shop-items"]}),b.invalidateQueries({queryKey:["catalog-items"]}),b.invalidateQueries({queryKey:["my-assets"]}),b.invalidateQueries({queryKey:["purchases"]}),b.invalidateQueries({queryKey:["owned-item-count"]}),b.invalidateQueries({queryKey:["overview-listings"]}),b.invalidateQueries({queryKey:["upsell-listings"]});const d=oe.current;oe.current=null,j(null),B(!1);const c={items:t,txHash:s[0]??void 0,txHashes:s,settled:!0,...d?{creditsAdded:d}:{}};ee("/success",{state:c,replace:!0})}function Ze(t,s){be(t)||ae(t,{flow:s,step:"submit"}),G(be(t)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:xt(t)}),j({phase:"error",message:Ke(t)}),B(!1)}async function Yt(t,s){const d=ve(We.MANAToken,s),c=ve(We.CreditsManager,s);await ms({auth:{kind:fs.Allowance,contractAddress:d.address,spenderAddress:c.address,chainId:s},signer:t})}async function et(){if(re)return re;try{return await b.fetchQuery({queryKey:["mana-rate",pt.chainId],queryFn:()=>ya(pt.chainId),staleTime:6e4})}catch{return}}async function Jt(t){const s=je(t).reduce((h,w)=>h+w.usdCents,0),c=(ge??0n)>0n?await et():re,u=c?lt(s,c):0n;return{totalCents:s,manaWei:u}}async function tt(t,s){const d=Ue(t),{totalCents:c,manaWei:u}=await Jt(t),h=Fe({priceCents:c,priceManaWei:u,balanceCents:(S==null?void 0:S.balanceCents)??0,manaBalanceWei:ge??0n}),w=Ot(t)?{...h,options:h.options.filter($=>$.method==="credits")}:h;if(s&&w.options.some($=>$.method===s)){if(s==="credits"){Ee(t);return}const{spender:$,chainId:_}=at(s,t);await st($,_,()=>s==="mana"?void nt(t):void it(t,c,u));return}if(w.options.some($=>$.method==="mana"||$.method==="combined")){j({phase:"choose",lines:t,totalCents:c,manaWei:u}),B(!1);return}if(S!=null&&S.credits<d){Je(t);return}Ee(t)}function Xt(t){return Fe({priceCents:t.totalCents,priceManaWei:t.manaWei,balanceCents:(S==null?void 0:S.balanceCents)??0,manaBalanceWei:ge??0n})}const[qe,fe]=P.useState(null);function at(t,s){const d=Ae(s)[0].trade;return{spender:t==="mana"?ve(wa(d.contract),d.chainId).address:ve(We.CreditsManager,d.chainId).address,chainId:d.chainId}}async function st(t,s,d){const c=ps(s,t),u=n?await gs(c,n.address).catch(()=>!0):!0;if(xs(n==null?void 0:n.providerType,u)){B(!1),fe({auth:c,run:d});return}d()}function Zt(t){if((p==null?void 0:p.phase)!=="choose")return;const{lines:s,totalCents:d,manaWei:c}=p;if(t==="credits"){Ee(s);return}const{spender:u,chainId:h}=at(t,s);st(u,h,()=>t==="mana"?void nt(s):void it(s,d,c))}async function nt(t){if(!n||t.length===0)return;const s=je(t),d=s.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:s.length,total:s.length});j({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});try{const h=await ds({trades:Ae(s).map(w=>w.trade),buyer:n.address,signer:n.signer,onSigned:u});t.forEach(w=>l(w.item.id)),O(null),G("Shop Completed Purchase",{...ye(d),payment_type:"mana",transaction_hash:h[0]??null}),b.invalidateQueries({queryKey:["mana-balance"]}),Xe(c,h)}catch(h){Ze(h,"buy_cart_mana")}}async function it(t,s,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=ls(c.map(g=>g.usdCents),(S==null?void 0:S.balanceCents)??0),$=w.reduce((g,k)=>g+k,0),_=us(Math.max(0,s-$),s,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:de,maxCreditedValue:Be}=await gt(n.identity,v,g[f].trade.id,U.contractAddress&&U.itemId!=null?{contractAddress:U.contractAddress,itemId:String(U.itemId)}:void 0);E.push({salt:de.id,itemId:U.id}),k.push({kind:"trade",trade:g[f].trade,credits:[de],maxCreditedValue:Be})}g.forEach((f,v)=>{w[v]<=0&&k.push({kind:"trade",trade:f.trade,credits:[],maxCreditedValue:"0"})}),k[0]={...k[0],maxCreditedValue:(BigInt(k[0].maxCreditedValue)+_).toString()},await 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)),O(null),G("Shop Completed Purchase",{...ye(u),payment_type:"credits_and_mana",transaction_hash:K[0]??null}),b.invalidateQueries({queryKey:["mana-balance"]}),Xe(h,K)}catch(g){const{toRelease:k}=Ct({reservations:E,spent:new Set([...q].filter(F=>!y.has(F))),settled:new Set});k.length&&_e(n.identity,k).catch(()=>{}),E.length&&b.invalidateQueries({queryKey:["usd-balance"]}),Ze(g,"buy_cart_combined")}}async function te(t){if(!n){bt({type:"cart-checkout"}),L();return}const s=Q.getState().items.filter(Ge);if(s.length===0)return;ie(null),pe(null),B(!0);const d=s.reduce((c,u)=>c+u.priceCredits*u.quantity,0);G("Shop Started Checkout",{cart_size:s.length,cart_value_credits:d,cart_value_usd:ht(d),has_sufficient_credits:xe>=d});try{const c=await ks(s,n.address,Vt,await et(),Gt),u=[...c.unavailable,...c.own];if(u.length&&(u.forEach(h=>l(h.id)),pe(qn(c))),c.buyable.length===0){ie(a("cart.error.noneAvailable")),O(null);return}if(c.orderChanged){O(c),He.current=Date.now();return}await tt(c.buyable,t)}catch(c){ae(c,{flow:"cart_checkout",step:"review",cart_size:s.length}),ie(Ke(c))}finally{B(!1)}}async function rt(){if(R){if(!n){bt({type:"cart-checkout"}),L();return}if(Date.now()-He.current>En){O(null),pe(null),await te();return}ie(null),tt(R.buyable)}}async function ea(){if(Te){try{sessionStorage.setItem(we,JSON.stringify(Q.getState().items))}catch{}B(!0);try{const t=await Ss(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:a("buyModal.error.creditsCheckout")})}finally{B(!1)}}}const ot=P.useRef(!1);P.useEffect(()=>{if(!n||ot.current||!is("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 s=sessionStorage.getItem(we);if(s){sessionStorage.removeItem(we);const d=JSON.parse(s);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=Ft||(p==null?void 0:p.phase)==="processing";return o.length===0&&!p?e.jsx(jt,{children:e.jsxs(St,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(H,{name:"arrow-left"}),a("nav.cart")]}),e.jsxs(Us,{"data-testid":"cart-empty",children:[e.jsx(H,{name:"cart-plus",size:110}),e.jsxs(Ns,{children:[e.jsx(Qs,{children:a("cart.empty.title")}),e.jsx(Hs,{children:a("cart.empty.body")})]}),e.jsx(Os,{to:"/items",children:a("cart.empty.cta")})]})]})}):e.jsxs(jt,{children:[e.jsxs(St,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(H,{name:"arrow-left"}),a("nav.cart")]}),e.jsxs(Fs,{children:[e.jsxs(Ls,{children:[e.jsxs(Ks,{children:[e.jsx(Vs,{onClick:()=>ee(-1),type:"button","aria-label":a("cart.goBack"),children:e.jsx(H,{name:"arrow-left"})}),e.jsx(Gs,{children:a("cart.panelTitle",{count:Kt})}),_t?e.jsxs(Ds,{onClick:()=>Y(!0),disabled:V,children:[e.jsx(H,{name:"fitting-room"}),a("cart.fittingRoom")]}):null]}),e.jsxs(At,{children:[e.jsx(Ys,{children:o.map(t=>{const s=Qt.get(t.id),d=s?s.priceCredits:t.priceCredits,c=!!s&&s.priceCredits!==t.priceCredits,u=!t.tokenId,h=t.quantity,w=typeof t.available=="number"&&h>=t.available,$=d*h,_=ga(t),E=!!_&&!!A[_],q=xa(t),y=Ve[t.id],g=!ut(y),k=y==="sold-out"?a("cart.availability.soldOut"):a("cart.availability.unavailable");return e.jsxs(Js,{"data-unavailable":g||void 0,children:[e.jsxs(Xs,{"data-thumb":!0,children:[q?e.jsx(Zs,{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(en,{"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(tn,{children:[e.jsxs(an,{"data-desc":!0,children:[q?e.jsx(nn,{to:q,state:{item:t,tradeId:t.tradeId},title:t.name,children:t.name}):e.jsx(sn,{title:t.name,children:t.name}),t.creator?e.jsx(rn,{address:t.creator,linkToProfile:!0}):null,Rt&&u?e.jsxs(fn,{"data-testid":"cart-creator-tag",children:[e.jsx(yn,{name:"buy-from-creator"}),a("cart.creatorTag")]}):null]}),e.jsx(on,{children:g?e.jsxs(e.Fragment,{children:[e.jsxs(gn,{children:[e.jsx(xn,{name:"warning-fill",size:24}),k]}),q?e.jsx(mn,{to:q,state:{item:t,tradeId:t.tradeId},children:a("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[u?e.jsxs(cn,{children:[e.jsx($t,{onClick:()=>me(()=>z(t.id)),disabled:V||h<=1,"aria-label":a("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(dn,{children:h}),e.jsx($t,{onClick:()=>me(()=>I(t.id)),disabled:V||w,"aria-label":a("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(ln,{children:[e.jsx(un,{})," ",$,c?e.jsx(hn,{children:t.priceCredits*h}):null]})]})})]}),e.jsxs(pn,{children:[_?e.jsx(bn,{"data-on":E||void 0,onClick:()=>ne(t),"aria-label":E?a("cart.removeFromFavorites",{name:t.name}):a("cart.addToFavorites",{name:t.name}),title:E?a("assetCard.removeFromFavorites"):a("assetCard.addToFavorites"),children:e.jsx(H,{name:E?"heart-solid":"heart"})}):null,e.jsx(vn,{onClick:()=>me(()=>l(t.id)),disabled:V,"aria-label":a("cart.remove",{name:t.name}),title:a("cart.removeTitle"),children:e.jsx(H,{name:"trash",size:24})})]})]},t.id)})}),e.jsx(wn,{children:e.jsx("button",{className:"link",onClick:()=>me(W),disabled:V,children:a("cart.clearCart")})})]})]}),e.jsxs(Cn,{children:[e.jsx(jn,{children:a("cart.purchaseSummary")}),e.jsxs(kn,{children:[e.jsxs(Sn,{children:[e.jsx($n,{children:a("cart.totalItems",{count:Ut})}),e.jsx(Tn,{children:e.jsxs(Mn,{children:[e.jsx(In,{})," ",De]})})]}),ce.options.length>0||ce.manaShortfall?e.jsx(Tt,{options:ce.options,totalCents:ze,shortfall:ce.manaShortfall,showCreditsAmount:!1,creditsLabel:R?a("marketCheckout.confirmPurchase"):ce.options.length>1?a("cart.buyWithCredits"):a("cart.checkout"),busy:V||Pe,onPay:t=>void(R?rt():te(t))}):e.jsx(Pn,{onClick:()=>void(R?rt():te()),disabled:V||Pe,children:V?a("cart.working"):R?a("marketCheckout.confirmPurchase"):a("cart.checkout")}),Pe?e.jsx(Ce,{className:"muted",children:a("cart.allUnavailable")}):null,n?null:e.jsx(Ce,{className:"muted",children:a("cart.signInHint")}),R?e.jsx(Ce,{className:"muted",children:a("cart.priceChanged")}):null,Qe?e.jsx(Ce,{className:"muted",children:Qe}):null,e.jsx(zn,{message:Wt})]})]})]})]}),Ye.length>0?e.jsx(An,{children:e.jsx(rs,{title:a("cart.youMightAlsoLike"),items:Ye})}):null,qe&&n?e.jsx(os,{auth:qe.auth,signer:n.signer,title:a("authorizeStep.manaTitle"),name:a("authorizeStep.manaName"),reason:a("authorizeStep.manaReason"),icon:e.jsx("img",{src:cs,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(Rs,{phase:p.phase,balanceCredits:xe,onClose:Dt,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:ma(n==null?void 0:n.providerType),signatures:p.phase==="processing"?p.signatures:void 0,options:p.phase==="choose"?Xt(p).options:void 0,onPay:Zt,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:he,selectedPack:Te,onSelectPack:Oe,onBuyPacks:()=>void ea(),message:p.phase==="error"?p.message:void 0,onRetry:()=>void te()}):null]})}export{Yn as Cart};
|
|
695
|
+
`;function Ke(o){if($s(o))return a("errors.rejected");const l=(o.message??"").toLowerCase();return l.includes("insufficient")?a("cart.error.insufficient",{currency:va.name}):l.includes("no active listing")||l.includes("your own listing")?a("cart.error.listingChanged"):a("marketCheckout.error.generic")}const En=12e4;function qn(o){const l=[];return o.unavailable.length&&l.push(a("cart.drop.unavailable",{count:o.unavailable.length})),o.own.length&&l.push(a("cart.drop.own",{count:o.own.length})),a("cart.drop.removed",{items:l.join(` ${a("cart.drop.and")} `)})}const Qe=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 Yn(){ia({title:a("nav.cart"),noindex:!0});const o=N(t=>t.items),l=N(t=>t.remove),I=N(t=>t.increment),z=N(t=>t.decrement),W=N(t=>t.clear),D=N(t=>t.restore),Y=N(t=>t.setFittingOpen),A=dt(t=>t.items),ne=dt(t=>t.toggle),{session:n,signIn:L}=ra(),Rt=oa(),he=Cs().packs.slice(0,js);P.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const _t=o.some(t=>t.category!=="emote"),{data:Me}=ca({queryKey:["upsell-listings"],queryFn:()=>Ca({first:40}),staleTime:6e4}),{data:S}=da(n),b=la(),ee=ta(),{state:J}=aa(),[Wt,ie]=P.useState(null),[Ne,pe]=P.useState(null),[Ft,B]=P.useState(!1),[R,O]=P.useState(null),He=P.useRef(0),[p,j]=P.useState(null),{data:ge}=ua(n),{data:re}=ha(!0),[Te,Oe]=P.useState(""),oe=P.useRef(null),Ve=pa(o),Ge=t=>ut(Ve[t.id]),Ie=o.filter(Ge),Pe=o.length>0&&Ie.length===0,Lt=Ie.reduce((t,s)=>t+s.priceCredits*s.quantity,0),Kt=o.reduce((t,s)=>t+s.quantity,0),Qt=Ie.reduce((t,s)=>t+s.quantity,0),De=R?R.liveTotalCredits:Lt,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(R==null?void 0:R.buyable.map(t=>[t.item.id,t])),xe=(S==null?void 0:S.credits)??0,ze=De*10,Ht=re?lt(ze,re):0n,ce=Fe({priceCents:ze,priceManaWei:Ht,balanceCents:(S==null?void 0:S.balanceCents)??0,manaBalanceWei:ge??0n}),Ot=t=>t.some(s=>s.acquisition==="store"),Ae=t=>t.flatMap(s=>s.acquisition==="trade"?[s]:[]),Vt=fa,Gt=t=>ba(t.contractAddress,String(t.itemId));function me(t){t(),O(null),pe(null),ie(null)}function Dt(){j(null),B(!1)}function Je(t){const s=Qe(t),d=Math.max(0,s-xe),c=he.find(u=>u.credits>=d)??he[he.length-1];Oe(c.id),G("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:s,credits_balance:xe,shortfall:d}),j({phase:"nofunds",lines:t.map(u=>({item:u.item,priceCredits:u.priceCredits,quantity:u.quantity})),shortfall:d}),B(!1)}async function Ee(t){if(!n||t.length===0)return;const s=je(t),d=s.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,$=new Set,_=new Set,E=[];let q=!1;j({phase:"processing",stage:"reserving",step:1,total:s.length});try{const y=[];for(let m=0;m<s.length;m++){const x=s[m];j({phase:"processing",stage:"reserving",step:m+1,total:s.length});try{const M=x.acquisition==="trade"?x.trade.id:void 0,C=x.item.contractAddress&&x.item.itemId!=null?{contractAddress:x.item.contractAddress,itemId:String(x.item.itemId)}:void 0,{credit:U,maxCreditedValue:X}=await gt(n.identity,x.usdCents,M,C);u.push({salt:U.id,itemId:x.item.id}),y.push(x.acquisition==="store"?{kind:"store",item:{collection:x.item.contractAddress,itemId:String(x.item.itemId),priceWei:x.priceWei},credits:[U],maxCreditedValue:X,chainId:x.item.chainId}:{kind:"trade",trade:x.trade,credits:[U],maxCreditedValue:X})}catch(M){if(Ms(M)){if(u.length){try{await _e(n.identity,u.map(C=>C.salt))}catch(C){ae(C,{flow:"cart_checkout",step:"release"})}b.invalidateQueries({queryKey:["usd-balance"]})}Je(t);return}throw M}}h="submit";const g=ys(y).length,k=m=>g>1?{current:m,total:g}:void 0,F=(m,x)=>j({phase:"processing",stage:m,step:s.length,total:s.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"),Q=y.flatMap(m=>m.kind==="trade"?[m]:[]);if(hs()&&!v)try{const m=new Map;f=await bs({purchases:Q,buyer:n.address,signer:n.signer,onSigned:()=>K(g),onBroadcast:({txHash:C,salts:U})=>{m.set(C,U),U.forEach(X=>w.add(X))}});const x=await Promise.allSettled(f.map(C=>vs(C)));x.forEach((C,U)=>{const X=m.get(f[U])??[];C.status==="fulfilled"?(X.forEach(Re=>$.add(Re)),E.push(f[U])):C.reason instanceof wt||X.forEach(Re=>_.add(Re))});const M=x.flatMap(C=>C.status==="rejected"?[C.reason]:[]);if(M.length&&!M.some(C=>C instanceof wt))throw M[0];q=!0}catch(m){if(!(m instanceof ws))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=>$.add(C)),E.push(x)},onReverted:({salts:x})=>x.forEach(M=>_.add(M))})}else f=await Le({purchases:y,buyer:n.address,signer:n.signer,onSigned:K,onBroadcast:({salts:m})=>m.forEach(x=>w.add(x)),onSettled:({txHash:m,salts:x})=>{x.forEach(M=>$.add(M)),E.push(m)},onReverted:({salts:m})=>m.forEach(x=>_.add(x))});t.forEach(m=>l(m.item.id)),O(null),G("Shop Completed Purchase",{...ye(d),payment_type:"credits",no_crypto_step:q,transaction_hash:f[0]??null}),vt(b);const de=oe.current;oe.current=null,j(null),B(!1);const Be={items:c,txHash:f[0]??void 0,txHashes:f,settled:!0,...de?{creditsAdded:de}:{}};ee("/success",{state:Be,replace:!0})}catch(y){be(y)||ae(y,{flow:"cart_checkout",step:h,cart_size:t.length});const g=new Set([...w].filter(v=>!_.has(v))),{toRelease:k,boughtItemIds:F}=Ct({reservations:u,spent:g,settled:$}),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:xt(y),value_usd:ht(f.reduce((v,Q)=>v+Q.priceCredits,0)),cart_size:s.length,partial:K.length>0}),k.length)try{await _e(n.identity,k)}catch(v){ae(v,{flow:"cart_checkout",step:"release"})}if(b.invalidateQueries({queryKey:["usd-balance"]}),K.length>0){F.forEach(v=>l(v)),O(null),vt(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:a("cart.error.partiallyBought")}),B(!1);return}j({phase:"error",message:Ke(y)})}}function Xe(t,s){b.invalidateQueries({queryKey:["usd-balance"]}),b.invalidateQueries({queryKey:["detail-trade"]}),b.invalidateQueries({queryKey:["shop-item"]}),b.invalidateQueries({queryKey:["owned-token"]}),b.invalidateQueries({queryKey:["public-token"]}),b.invalidateQueries({queryKey:["item-resales"]}),b.invalidateQueries({queryKey:["shop-items"]}),b.invalidateQueries({queryKey:["catalog-items"]}),b.invalidateQueries({queryKey:["my-assets"]}),b.invalidateQueries({queryKey:["purchases"]}),b.invalidateQueries({queryKey:["owned-item-count"]}),b.invalidateQueries({queryKey:["overview-listings"]}),b.invalidateQueries({queryKey:["upsell-listings"]});const d=oe.current;oe.current=null,j(null),B(!1);const c={items:t,txHash:s[0]??void 0,txHashes:s,settled:!0,...d?{creditsAdded:d}:{}};ee("/success",{state:c,replace:!0})}function Ze(t,s){be(t)||ae(t,{flow:s,step:"submit"}),G(be(t)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:xt(t)}),j({phase:"error",message:Ke(t)}),B(!1)}async function Yt(t,s){const d=ve(We.MANAToken,s),c=ve(We.CreditsManager,s);await ms({auth:{kind:fs.Allowance,contractAddress:d.address,spenderAddress:c.address,chainId:s},signer:t})}async function et(){if(re)return re;try{return await b.fetchQuery({queryKey:["mana-rate",pt.chainId],queryFn:()=>ya(pt.chainId),staleTime:6e4})}catch{return}}async function Jt(t){const s=je(t).reduce((h,w)=>h+w.usdCents,0),c=(ge??0n)>0n?await et():re,u=c?lt(s,c):0n;return{totalCents:s,manaWei:u}}async function tt(t,s){const d=Qe(t),{totalCents:c,manaWei:u}=await Jt(t),h=Fe({priceCents:c,priceManaWei:u,balanceCents:(S==null?void 0:S.balanceCents)??0,manaBalanceWei:ge??0n}),w=Ot(t)?{...h,options:h.options.filter($=>$.method==="credits")}:h;if(s&&w.options.some($=>$.method===s)){if(s==="credits"){Ee(t);return}const{spender:$,chainId:_}=at(s,t);await st($,_,()=>s==="mana"?void nt(t):void it(t,c,u));return}if(w.options.some($=>$.method==="mana"||$.method==="combined")){j({phase:"choose",lines:t,totalCents:c,manaWei:u}),B(!1);return}if(S!=null&&S.credits<d){Je(t);return}Ee(t)}function Xt(t){return Fe({priceCents:t.totalCents,priceManaWei:t.manaWei,balanceCents:(S==null?void 0:S.balanceCents)??0,manaBalanceWei:ge??0n})}const[qe,fe]=P.useState(null);function at(t,s){const d=Ae(s)[0].trade;return{spender:t==="mana"?ve(wa(d.contract),d.chainId).address:ve(We.CreditsManager,d.chainId).address,chainId:d.chainId}}async function st(t,s,d){const c=ps(s,t),u=n?await gs(c,n.address).catch(()=>!0):!0;if(xs(n==null?void 0:n.providerType,u)){B(!1),fe({auth:c,run:d});return}d()}function Zt(t){if((p==null?void 0:p.phase)!=="choose")return;const{lines:s,totalCents:d,manaWei:c}=p;if(t==="credits"){Ee(s);return}const{spender:u,chainId:h}=at(t,s);st(u,h,()=>t==="mana"?void nt(s):void it(s,d,c))}async function nt(t){if(!n||t.length===0)return;const s=je(t),d=s.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:s.length,total:s.length});j({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});try{const h=await ds({trades:Ae(s).map(w=>w.trade),buyer:n.address,signer:n.signer,onSigned:u});t.forEach(w=>l(w.item.id)),O(null),G("Shop Completed Purchase",{...ye(d),payment_type:"mana",transaction_hash:h[0]??null}),b.invalidateQueries({queryKey:["mana-balance"]}),Xe(c,h)}catch(h){Ze(h,"buy_cart_mana")}}async function it(t,s,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=ls(c.map(g=>g.usdCents),(S==null?void 0:S.balanceCents)??0),$=w.reduce((g,k)=>g+k,0),_=us(Math.max(0,s-$),s,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 Q=g[f].item,{credit:de,maxCreditedValue:Be}=await gt(n.identity,v,g[f].trade.id,Q.contractAddress&&Q.itemId!=null?{contractAddress:Q.contractAddress,itemId:String(Q.itemId)}:void 0);E.push({salt:de.id,itemId:Q.id}),k.push({kind:"trade",trade:g[f].trade,credits:[de],maxCreditedValue:Be})}g.forEach((f,v)=>{w[v]<=0&&k.push({kind:"trade",trade:f.trade,credits:[],maxCreditedValue:"0"})}),k[0]={...k[0],maxCreditedValue:(BigInt(k[0].maxCreditedValue)+_).toString()},await 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)),O(null),G("Shop Completed Purchase",{...ye(u),payment_type:"credits_and_mana",transaction_hash:K[0]??null}),b.invalidateQueries({queryKey:["mana-balance"]}),Xe(h,K)}catch(g){const{toRelease:k}=Ct({reservations:E,spent:new Set([...q].filter(F=>!y.has(F))),settled:new Set});k.length&&_e(n.identity,k).catch(()=>{}),E.length&&b.invalidateQueries({queryKey:["usd-balance"]}),Ze(g,"buy_cart_combined")}}async function te(t){if(!n){bt({type:"cart-checkout"}),L();return}const s=N.getState().items.filter(Ge);if(s.length===0)return;ie(null),pe(null),B(!0);const d=s.reduce((c,u)=>c+u.priceCredits*u.quantity,0);G("Shop Started Checkout",{cart_size:s.length,cart_value_credits:d,cart_value_usd:ht(d),has_sufficient_credits:xe>=d});try{const c=await ks(s,n.address,Vt,await et(),Gt),u=[...c.unavailable,...c.own];if(u.length&&(u.forEach(h=>l(h.id)),pe(qn(c))),c.buyable.length===0){ie(a("cart.error.noneAvailable")),O(null);return}if(c.orderChanged){O(c),He.current=Date.now();return}await tt(c.buyable,t)}catch(c){ae(c,{flow:"cart_checkout",step:"review",cart_size:s.length}),ie(Ke(c))}finally{B(!1)}}async function rt(){if(R){if(!n){bt({type:"cart-checkout"}),L();return}if(Date.now()-He.current>En){O(null),pe(null),await te();return}ie(null),tt(R.buyable)}}async function ea(){if(Te){try{sessionStorage.setItem(we,JSON.stringify(N.getState().items))}catch{}B(!0);try{const t=await Ss(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:a("buyModal.error.creditsCheckout")})}finally{B(!1)}}}const ot=P.useRef(!1);P.useEffect(()=>{if(!n||ot.current||!is("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 s=sessionStorage.getItem(we);if(s){sessionStorage.removeItem(we);const d=JSON.parse(s);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=Ft||(p==null?void 0:p.phase)==="processing";return o.length===0&&!p?e.jsx(jt,{children:e.jsxs(St,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(H,{name:"arrow-left"}),a("nav.cart")]}),e.jsxs(Qs,{"data-testid":"cart-empty",children:[e.jsx(H,{name:"cart-plus",size:110}),e.jsxs(Us,{children:[e.jsx(Ns,{children:a("cart.empty.title")}),e.jsx(Hs,{children:a("cart.empty.body")})]}),e.jsx(Os,{to:"/items",children:a("cart.empty.cta")})]})]})}):e.jsxs(jt,{children:[e.jsxs(St,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(H,{name:"arrow-left"}),a("nav.cart")]}),e.jsxs(Fs,{children:[e.jsxs(Ls,{children:[e.jsxs(Ks,{children:[e.jsx(Vs,{onClick:()=>ee(-1),type:"button","aria-label":a("cart.goBack"),children:e.jsx(H,{name:"arrow-left"})}),e.jsx(Gs,{children:a("cart.panelTitle",{count:Kt})}),_t?e.jsxs(Ds,{onClick:()=>Y(!0),disabled:V,children:[e.jsx(H,{name:"fitting-room"}),a("cart.fittingRoom")]}):null]}),e.jsxs(At,{children:[e.jsx(Ys,{children:o.map(t=>{const s=Nt.get(t.id),d=s?s.priceCredits:t.priceCredits,c=!!s&&s.priceCredits!==t.priceCredits,u=!t.tokenId,h=t.quantity,w=typeof t.available=="number"&&h>=t.available,$=d*h,_=ga(t),E=!!_&&!!A[_],q=xa(t),y=Ve[t.id],g=!ut(y),k=y==="sold-out"?a("cart.availability.soldOut"):a("cart.availability.unavailable");return e.jsxs(Js,{"data-unavailable":g||void 0,children:[e.jsxs(Xs,{"data-thumb":!0,children:[q?e.jsx(Zs,{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(en,{"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(tn,{children:[e.jsxs(an,{"data-desc":!0,children:[q?e.jsx(nn,{to:q,state:{item:t,tradeId:t.tradeId},title:t.name,children:t.name}):e.jsx(sn,{title:t.name,children:t.name}),t.creator?e.jsx(rn,{address:t.creator,linkToProfile:!0}):null,Rt&&u?e.jsxs(fn,{"data-testid":"cart-creator-tag",children:[e.jsx(yn,{name:"buy-from-creator"}),a("cart.creatorTag")]}):null]}),e.jsx(on,{children:g?e.jsxs(e.Fragment,{children:[e.jsxs(gn,{children:[e.jsx(xn,{name:"warning-fill",size:24}),k]}),q?e.jsx(mn,{to:q,state:{item:t,tradeId:t.tradeId},children:a("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[u?e.jsxs(cn,{children:[e.jsx($t,{onClick:()=>me(()=>z(t.id)),disabled:V||h<=1,"aria-label":a("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(dn,{children:h}),e.jsx($t,{onClick:()=>me(()=>I(t.id)),disabled:V||w,"aria-label":a("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(ln,{children:[e.jsx(un,{})," ",$,c?e.jsx(hn,{children:t.priceCredits*h}):null]})]})})]}),e.jsxs(pn,{children:[_?e.jsx(bn,{"data-on":E||void 0,onClick:()=>ne(t),"aria-label":E?a("cart.removeFromFavorites",{name:t.name}):a("cart.addToFavorites",{name:t.name}),title:E?a("assetCard.removeFromFavorites"):a("assetCard.addToFavorites"),children:e.jsx(H,{name:E?"heart-solid":"heart"})}):null,e.jsx(vn,{onClick:()=>me(()=>l(t.id)),disabled:V,"aria-label":a("cart.remove",{name:t.name}),title:a("cart.removeTitle"),children:e.jsx(H,{name:"trash",size:24})})]})]},t.id)})}),e.jsx(wn,{children:e.jsx("button",{className:"link",onClick:()=>me(W),disabled:V,children:a("cart.clearCart")})})]})]}),e.jsxs(Cn,{children:[e.jsx(jn,{children:a("cart.purchaseSummary")}),e.jsxs(kn,{children:[e.jsxs(Sn,{children:[e.jsx($n,{children:a("cart.totalItems",{count:Qt})}),e.jsx(Tn,{children:e.jsxs(Mn,{children:[e.jsx(In,{})," ",De]})})]}),ce.options.length>0||ce.manaShortfall?e.jsx(Tt,{options:ce.options,totalCents:ze,shortfall:ce.manaShortfall,showCreditsAmount:!1,creditsLabel:R?a("marketCheckout.confirmPurchase"):ce.options.length>1?a("cart.buyWithCredits"):a("cart.checkout"),busy:V||Pe,onPay:t=>void(R?rt():te(t))}):e.jsx(Pn,{onClick:()=>void(R?rt():te()),disabled:V||Pe,children:V?a("cart.working"):R?a("marketCheckout.confirmPurchase"):a("cart.checkout")}),Pe?e.jsx(Ce,{className:"muted",children:a("cart.allUnavailable")}):null,n?null:e.jsx(Ce,{className:"muted",children:a("cart.signInHint")}),R?e.jsx(Ce,{className:"muted",children:a("cart.priceChanged")}):null,Ne?e.jsx(Ce,{className:"muted",children:Ne}):null,e.jsx(zn,{message:Wt})]})]})]})]}),Ye.length>0?e.jsx(An,{children:e.jsx(rs,{title:a("cart.youMightAlsoLike"),items:Ye})}):null,qe&&n?e.jsx(os,{auth:qe.auth,signer:n.signer,title:a("authorizeStep.manaTitle"),name:a("authorizeStep.manaName"),reason:a("authorizeStep.manaReason"),icon:e.jsx("img",{src:cs,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(Rs,{phase:p.phase,balanceCredits:xe,onClose:Dt,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:ma(n==null?void 0:n.providerType),signatures:p.phase==="processing"?p.signatures:void 0,options:p.phase==="choose"?Xt(p).options:void 0,onPay:Zt,totalCents:p.phase==="choose"?p.totalCents:void 0,totalManaWei:p.phase==="choose"?p.manaWei:void 0,totalCredits:p.phase==="choose"?Qe(p.lines):void 0,lines:p.phase==="nofunds"?p.lines:void 0,shortfallCredits:p.phase==="nofunds"?p.shortfall:void 0,packs:he,selectedPack:Te,onSelectPack:Oe,onBuyPacks:()=>void ea(),message:p.phase==="error"?p.message:void 0,onRetry:()=>void te()}):null]})}export{Yn as Cart};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ab as N,ac as U,ad as o,ae as n,af as D,o as M}from"./index-DfPAN1ow.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}from"./clsx-WwvpwSg0.js";import{s as v}from"./styled-Cwh1vUwH.js";function K(r){return z("MuiCircularProgress",r)}E("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const W=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,b,S,$;const t=44,B=M(P||(P=l`
|
|
2
2
|
0% {
|
|
3
3
|
transform: rotate(0deg);
|
|
4
4
|
}
|
|
@@ -21,8 +21,8 @@ import{a9 as N,aa as U,ab as o,ac as n,ad as D,o as M}from"./index-CpUnpBQ7.js";
|
|
|
21
21
|
stroke-dasharray: 100px, 200px;
|
|
22
22
|
stroke-dashoffset: -125px;
|
|
23
23
|
}
|
|
24
|
-
`)),L=r=>{const{classes:e,variant:s,color:
|
|
24
|
+
`)),L=r=>{const{classes:e,variant:s,color:a,disableShrink:d}=r,m={root:["root",s,`color${n(a)}`],svg:["svg"],circle:["circle",`circle${n(s)}`,d&&"circleDisableShrink"]};return F(m,K,e)},V=v("span",{name:"MuiCircularProgress",slot:"Root",overridesResolver:(r,e)=>{const{ownerState:s}=r;return[e.root,e[s.variant],e[`color${n(s.color)}`]]}})(({ownerState:r,theme:e})=>o({display:"inline-block"},r.variant==="determinate"&&{transition:e.transitions.create("transform")},r.color!=="inherit"&&{color:(e.vars||e).palette[r.color].main}),({ownerState:r})=>r.variant==="indeterminate"&&D(S||(S=l`
|
|
25
25
|
animation: ${0} 1.4s linear infinite;
|
|
26
26
|
`),B)),Z=v("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(r,e)=>e.svg})({display:"block"}),q=v("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(r,e)=>{const{ownerState:s}=r;return[e.circle,e[`circle${n(s.variant)}`],s.disableShrink&&e.circleDisableShrink]}})(({ownerState:r,theme:e})=>o({stroke:"currentColor"},r.variant==="determinate"&&{transition:e.transitions.create("stroke-dashoffset")},r.variant==="indeterminate"&&{strokeDasharray:"80px, 200px",strokeDashoffset:0}),({ownerState:r})=>r.variant==="indeterminate"&&!r.disableShrink&&D($||($=l`
|
|
27
27
|
animation: ${0} 1.4s ease-in-out infinite;
|
|
28
|
-
`),G)),Q=w.forwardRef(function(e,s){const
|
|
28
|
+
`),G)),Q=w.forwardRef(function(e,s){const a=N({props:e,name:"MuiCircularProgress"}),{className:d,color:m="primary",disableShrink:R=!1,size:u=40,style:_,thickness:i=3.6,value:f=0,variant:k="indeterminate"}=a,j=U(a,W),c=o({},a,{color:m,disableShrink:R,size:u,thickness:i,value:f,variant:k}),p=L(c),h={},x={},y={};if(k==="determinate"){const C=2*Math.PI*((t-i)/2);h.strokeDasharray=C.toFixed(3),y["aria-valuenow"]=Math.round(f),h.strokeDashoffset=`${((100-f)/100*C).toFixed(3)}px`,x.transform="rotate(-90deg)"}return g.jsx(V,o({className:I(p.root,d),style:o({width:u,height:u},x,_),ownerState:c,ref:s,role:"progressbar"},y,j,{children:g.jsx(Z,{className:p.svg,ownerState:c,viewBox:`${t/2} ${t/2} ${t} ${t}`,children:g.jsx(q,{className:p.circle,style:h,ownerState:c,cx:t,cy:t,r:(t-i)/2,fill:"none",strokeWidth:i})})}))});export{Q as C};
|