@dcl/shop 0.1.0-29736515487.commit-b64bf82 → 0.1.0-29783861565.commit-b83d609
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/{AnimatedBackground-BJBUqhHZ.js → AnimatedBackground-CnXByL2p.js} +1 -1
- package/assets/Assets-DwgI8MEu.js +1 -0
- package/assets/{Cart-CNsRhX_R.js → Cart-BX9aQ6G0.js} +1 -1
- package/assets/{CircularProgress-C9g4a9bc.js → CircularProgress-DYIOpTqD.js} +1 -1
- package/assets/Collection-LcILXLBn.js +1 -0
- package/assets/{CollectionCarousel-CiKValmX.js → CollectionCarousel-CoUEKAXy.js} +1 -1
- package/assets/Creator-UHpdXwMr.js +1 -0
- package/assets/{CssVarsProvider-Bc8wQjEb.js → CssVarsProvider-DfFti9_A.js} +1 -1
- package/assets/ErrorNotice-CKeOu_Oi.js +1 -0
- package/assets/{ExchangeController-B6lNqmFK.js → ExchangeController-C6sXEiq1.js} +1 -1
- package/assets/GetCredits-DtfEKpG3.js +1 -0
- package/assets/{HelpersUtil-zS6eOrPz.js → HelpersUtil-VuaewgD3.js} +1 -1
- package/assets/ImportListings-BpZvc0Qy.js +1 -0
- package/assets/ItemDetail-BVVMGMLA.js +2 -0
- package/assets/{LoadMore-BIjeTH4T.js → LoadMore-6Uy0vHhH.js} +1 -1
- package/assets/{MarketCheckout-DoRZsMk0.js → MarketCheckout-Kp8KKjmU.js} +1 -1
- package/assets/MyAssets-jAtm2rkC.js +1 -0
- package/assets/{MyFavorites-CRqCDkA2.js → MyFavorites-CGr22n0E.js} +1 -1
- package/assets/{MyPurchases-BsTMOXYC.js → MyPurchases-jF5HW7GK.js} +1 -1
- package/assets/NotFound-bMjp4Hut.js +1 -0
- package/assets/StoreSettings-CkUUTNHp.js +1 -0
- package/assets/{Success-3OL55SvR.js → Success-DYjGuuuE.js} +1 -1
- package/assets/{SwapController-BHBv5Fp0.js → SwapController-DBJm_MiD.js} +1 -1
- package/assets/{TradeService-CNoDt48E.js → TradeService-BFaS1SX9.js} +1 -1
- package/assets/{W3MFrameProviderSingleton-Bndo_4Rg.js → W3MFrameProviderSingleton-DCqZCe_f.js} +3 -3
- package/assets/{WebCryptoP256-Bt50-H1K.js → WebCryptoP256-Cz-rTluH.js} +1 -1
- package/assets/{basic-Bub5O4ZI.js → basic-BcwNyjio.js} +1 -1
- package/assets/{biconomy-DuIIEXUB.js → biconomy-DR6YsiDl.js} +1 -1
- package/assets/{buy--wjHgZbY.js → buy-BlHiSc1W.js} +1 -1
- package/assets/{buy-gasless-DaSij0O9.js → buy-gasless-aP_Keozx.js} +1 -1
- package/assets/{cart-checkout-RV2JhHc0.js → cart-checkout-ClRVRUn2.js} +1 -1
- package/assets/{categories-BwgdoXaT.js → categories-BTWuBkUd.js} +1 -1
- package/assets/{ccip-C1ke5tRS.js → ccip-ChPEdTqV.js} +1 -1
- package/assets/{ccip-Cbub1KDX.js → ccip-DMrR031x.js} +1 -1
- package/assets/{collection-CtZ-NDco.js → collection-CRx0Du-v.js} +1 -1
- package/assets/{controller-Cn9mR-pN.js → controller-421tDirA.js} +2 -2
- package/assets/{core-Z6gT3FaJ.js → core-CsX6p7T6.js} +4 -4
- package/assets/{custom-Djk6BRDC.js → custom-CILu-JPM.js} +1 -1
- package/assets/{data-capture-CaF6YYAr.js → data-capture-DRuJL5zb.js} +1 -1
- package/assets/{decimals-_kiKzbOr.js → decimals-BKVZKqKN.js} +1 -1
- package/assets/{decimals-BW2hoshz.js → decimals-DrtQQlU9.js} +1 -1
- package/assets/{detectExtension-BkZ-FjJy.js → detectExtension-D-LvJWm4.js} +1 -1
- package/assets/{email-1Van4lx1.js → email-Cb1GxsJf.js} +1 -1
- package/assets/{embedded-wallet-_TVgs7Qd.js → embedded-wallet-BwhNJ4Q2.js} +1 -1
- package/assets/{emotion-styled.browser.esm-B2VU5Fdx.js → emotion-styled.browser.esm-Ca1eN6j6.js} +1 -1
- package/assets/{engine-D9uS1iWH.js → engine-B6D8ee3-.js} +1 -1
- package/assets/{errors-BFbUxXdM.js → errors-uwUVgVvx.js} +1 -1
- package/assets/{estimate-l1-fee-DFpjQWvm.js → estimate-l1-fee-G7zM8IOX.js} +1 -1
- package/assets/{eth_estimateGas-XGJ1z-TU.js → eth_estimateGas-CJsm4rG5.js} +1 -1
- package/assets/{eth_getStorageAt-4_YV1iAo.js → eth_getStorageAt-qmfvyP-u.js} +1 -1
- package/assets/{eth_getTransactionCount-DO_4-OAP.js → eth_getTransactionCount-BGQQ5Vv9.js} +1 -1
- package/assets/{extractIPFS-CMkI68ZH.js → extractIPFS-DakUEmlc.js} +1 -1
- package/assets/{features-Dzd7PGBD.js → features-bW08HJnZ.js} +1 -1
- package/assets/{fetchTokenMetadata-BJILnwgp.js → fetchTokenMetadata-CXT0jjgl.js} +2 -2
- package/assets/{get-ecosystem-wallet-info-BD5YDDMh.js → get-ecosystem-wallet-info-Dn1LefmJ.js} +1 -1
- package/assets/{getBalance-SRetmB3S.js → getBalance-B_aNPKoy.js} +1 -1
- package/assets/{getInstalledModules-DFh2dv3C.js → getInstalledModules-CympWNqL.js} +1 -1
- package/assets/{getNFT-CtODGGom.js → getNFT-B8Q1zkC4.js} +2 -2
- package/assets/{getNFT-CJ8nxXzA.js → getNFT-eM-T6tRF.js} +1 -1
- package/assets/{getOverlayAlpha-DqVbiGQa.js → getOverlayAlpha-Ttcml9GY.js} +1 -1
- package/assets/{hashTypedData-B9EX4kQr.js → hashTypedData--AK2ZmGf.js} +1 -1
- package/assets/{hashTypedData-DF-5orkI.js → hashTypedData-DzD4jekn.js} +1 -1
- package/assets/{import-DjSObRBl.js → import-sr6kRaqB.js} +1 -1
- package/assets/{in-app-wallet-calls-BIFm_f4e.js → in-app-wallet-calls-C_SOVV0l.js} +1 -1
- package/assets/{index-BDpvYYDT.js → index-9gD2DfUK.js} +2 -2
- package/assets/{index-DZXCznoC.js → index-B-3CTsQP.js} +1 -1
- package/assets/{index-Baz_xGcG.js → index-B2OrjlTl.js} +1 -1
- package/assets/{index-D6gXM0CC.js → index-B4-G1rCo.js} +1 -1
- package/assets/{index-icCmSJB-.js → index-B6W_ISMa.js} +1 -1
- package/assets/{index-Cq05ek6k.js → index-B81tYS6F.js} +1 -1
- package/assets/{index-BMvjtMcC.js → index-BIv8GADN.js} +1 -1
- package/assets/{index-BJhyH2t3.js → index-BJZdI022.js} +1 -1
- package/assets/{index-C2Nkwj4Q.js → index-BV33ef1J.js} +1 -1
- package/assets/{index-wua-qNwF.js → index-Bgbtqpi_.js} +1 -1
- package/assets/{index-C7FmrxuL.js → index-BvrURYoS.js} +2 -2
- package/assets/{index-4FVRm8A1.js → index-BxbTiINv.js} +1 -1
- package/assets/{index-DxHhM-lc.js → index-C2m0blJe.js} +1 -1
- package/assets/{index-CXx3fqSb.js → index-C6G40j4u.js} +1 -1
- package/assets/{index-BIm4mg7q.js → index-C84kXK1X.js} +1 -1
- package/assets/{index-D-OL6_Yb.js → index-CWbmWEtn.js} +1 -1
- package/assets/{index-CPEmMCeJ.js → index-CaDGH4a6.js} +1 -1
- package/assets/{index-C4u9N2Kl.js → index-CjOGY-Pr.js} +1 -1
- package/assets/{index-ChsZA2LJ.js → index-CnCph4mF.js} +1 -1
- package/assets/{index-CnO86Xf-.js → index-CovWGvEr.js} +2 -2
- package/assets/{index-B8oIDYaY.js → index-Cr7wLvnz.js} +1 -1
- package/assets/{index-B-R-UWD3.js → index-CtLPwG2t.js} +1 -1
- package/assets/{index-CDzDnyJW.js → index-CzmwWbz1.js} +4 -4
- package/assets/{index-mj00iiOs.js → index-D-gvLUqs.js} +1 -1
- package/assets/{index-D-g3I2lj.js → index-D226txBm.js} +1 -1
- package/assets/{index-Ca1AwnnV.js → index-DGQOzxeF.js} +1 -1
- package/assets/{index-_PfBd9GI.js → index-DOoENNk5.js} +1 -1
- package/assets/{index-D4I9bYC2.js → index-DPKHQYT5.js} +1 -1
- package/assets/{index-B84aCWu7.js → index-DSEv1Ue8.js} +1 -1
- package/assets/{index-COxhR5RZ.js → index-DTg93qgJ.js} +1 -1
- package/assets/{index-C6_L5Mw_.js → index-DToUml_I.js} +1 -1
- package/assets/{index-B0vpo1ZT.js → index-DUF4UmqA.js} +1 -1
- package/assets/{index-RUxrTr_p.js → index-DXDNRhxq.js} +1 -1
- package/assets/{index-BuMqkfRn.js → index-D_W5oEuA.js} +1 -1
- package/assets/{index-BTBCIBCb.js → index-DkhsBldP.js} +1 -1
- package/assets/{index-CI-M1Arz.js → index-DmEz5tjU.js} +1 -1
- package/assets/{index-CB1b6TrQ.js → index-DmJlIq9f.js} +1 -1
- package/assets/{index-C1ZfYzAF.js → index-DoFyhOro.js} +1 -1
- package/assets/{index-z0NRAVC7.js → index-DokyT4P9.js} +1 -1
- package/assets/{index-Cxc0o5xP.js → index-DptThZec.js} +3 -3
- package/assets/{index-C7dwOEd4.js → index-DvTTdt4H.js} +1 -1
- package/assets/{index-435lMBSs.js → index-DzHyxhs5.js} +1 -1
- package/assets/{index-CuuFwMsN.js → index-NeuZ4y_J.js} +1 -1
- package/assets/{index-lt9H89-j.js → index-XK7XP931.js} +1 -1
- package/assets/{index-Dp3LaHz2.js → index-iYHUkCYV.js} +1 -1
- package/assets/{index-rjGwBRLW.js → index-jywqB30S.js} +1 -1
- package/assets/{index-BP93EahD.js → index-mBDGvwIW.js} +1 -1
- package/assets/{index-D1WSRIS2.js → index-nj2GyU5U.js} +1 -1
- package/assets/{index-D9ieJGKB.js → index-s1UJ3WrX.js} +3 -3
- package/assets/{index-kwYOhJAZ.js → index-sYlKY5cB.js} +1 -1
- package/assets/{index-5DUAhgPD.js → index-xPWOdr4_.js} +1 -1
- package/assets/{index.es-BzNqI7gq.js → index.es-7B3Apj6r.js} +1 -1
- package/assets/{index.es-CwZSb0ol.js → index.es-BHyvc-N-.js} +1 -1
- package/assets/{index.es-1OmAzkct.js → index.es-BxwrCOID.js} +4 -4
- package/assets/{localBatchGatewayRequest-yoTBhn0Z.js → localBatchGatewayRequest-H6cBwZqz.js} +1 -1
- package/assets/{mana-rate-Db4BQ-_Q.js → mana-rate-D42fK9sf.js} +1 -1
- package/assets/{networks-DK4RaMPB.js → networks-0pOpKJQi.js} +1 -1
- package/assets/{onramp-D9q0W6xC.js → onramp-CCXo5M0Y.js} +1 -1
- package/assets/{openzeppelin-BquKm-KX.js → openzeppelin-BYJ2tC9d.js} +1 -1
- package/assets/{ownerOf-DuMQ2Sl6.js → ownerOf-Q7VDagMC.js} +1 -1
- package/assets/{parseNft-ufNn3-SE.js → parseNft-5mZpwsx1.js} +2 -2
- package/assets/{parseSignature-DMb3jl_X.js → parseSignature-CWegNxH8.js} +1 -1
- package/assets/{parseSignature-BwqWTE77.js → parseSignature-EO4YSoUl.js} +3 -3
- package/assets/{pay-with-exchange-CTQ9umub.js → pay-with-exchange-DNZN1-oM.js} +1 -1
- package/assets/{payments-tEVDRx3d.js → payments-DOnM9_yY.js} +1 -1
- package/assets/{qr-overlay-dEspWwjk.js → qr-overlay-BffOPDZr.js} +1 -1
- package/assets/{receive-D0GHoQxU.js → receive-CH8H0XRZ.js} +1 -1
- package/assets/{resolveImplementation-C8pfiiFc.js → resolveImplementation-BK16Utmf.js} +1 -1
- package/assets/{rpc-DmLUQYS0.js → rpc-BuwiLkbO.js} +1 -1
- package/assets/{secp256k1-Dfs57S6d.js → secp256k1-2SXpP68_.js} +1 -1
- package/assets/{secp256k1-Dr9eLw2v.js → secp256k1-BFHcnR-p.js} +1 -1
- package/assets/{secp256k1-Nx-YHmXH.js → secp256k1-Br1Y5NMo.js} +1 -1
- package/assets/{send-BwQAcpw3.js → send-an0evxKn.js} +1 -1
- package/assets/{send-batch-transaction-DzTkK7I2.js → send-batch-transaction-JFUz9Aa9.js} +1 -1
- package/assets/{send-eip712-transaction-Cwec8TpW.js → send-eip712-transaction-DdF3ZvBS.js} +2 -2
- package/assets/{send-gasless-transaction-CM25TtQp.js → send-gasless-transaction-CxNH64lc.js} +2 -2
- package/assets/{sendRawTransaction-D4a6ft8m.js → sendRawTransaction-iwgyq4DD.js} +3 -3
- package/assets/{serializeTransaction-2sq4x0kU.js → serializeTransaction-b9KVJNpn.js} +1 -1
- package/assets/{session-proposal-BdXqD0a8.js → session-proposal-SlVAZSFJ.js} +1 -1
- package/assets/{session-request-DK4XwmDL.js → session-request-BLbnbkSH.js} +2 -2
- package/assets/{sha256-D-WKRl2Q.js → sha256-DynB7XkZ.js} +1 -1
- package/assets/{signing-BT7JgIF_.js → signing-BbFSmiZg.js} +4 -4
- package/assets/{socials-BOqU6AoU.js → socials-CS5qY0g8.js} +1 -1
- package/assets/{swaps-CG6VNxsT.js → swaps-DxVYaURr.js} +1 -1
- package/assets/{thirdweb-CAdiquMi.js → thirdweb-DN9IYPLv.js} +3 -3
- package/assets/{totalSupply-DjhdgKBK.js → totalSupply-CYz_14oP.js} +1 -1
- package/assets/{trade-encoding-6ejU5fQD.js → trade-encoding-8RrYE6hq.js} +1 -1
- package/assets/{transactionReceipt-DWMHa3N1.js → transactionReceipt-BwIePvtD.js} +1 -1
- package/assets/{transactions-BgR8COf-.js → transactions-CHQdZqE3.js} +1 -1
- package/assets/{useInfiniteGrid-gL0KJ-yb.js → useInfiniteGrid-Dg-jgtmN.js} +1 -1
- package/assets/{useStore-BXbR3Zt_.js → useStore-BYewymaj.js} +1 -1
- package/assets/{useTheme-CmaVa_eU.js → useTheme-Ckn40RaY.js} +1 -1
- package/assets/useTheme-DLZ3E7iB.js +1 -0
- package/assets/{verifyHash-0bNfbKAs.js → verifyHash-DZ_VWsuB.js} +1 -1
- package/assets/{w3m-modal-L-SoXhRP.js → w3m-modal-BTdIt9gK.js} +1 -1
- package/assets/{w3m-modal-Cb8f-N8c.js → w3m-modal-DWDDyMHz.js} +1 -1
- package/assets/{wait-for-tx-receipt-DHi00k13.js → wait-for-tx-receipt-BFayfepQ.js} +1 -1
- package/assets/{wallets-DQmx7SO4.js → wallets-5iCkp8_7.js} +6 -6
- package/assets/{web-connector-DZjwkeRe.js → web-connector-CC3nGcrB.js} +3 -3
- package/assets/{writeContract-DzbrR3T0.js → writeContract-CdvSowPF.js} +1 -1
- package/assets/{zoraTestnet-CiD1Xv8j.js → zoraTestnet-BZKi9YAz.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/assets/Assets-BLEE2McM.js +0 -1
- package/assets/Collection-CEmVbx8y.js +0 -1
- package/assets/Creator-CSW1SPi9.js +0 -1
- package/assets/ErrorNotice-Rze9rgc9.js +0 -1
- package/assets/GetCredits-CovHo4LD.js +0 -1
- package/assets/ImportListings-B_GYydG3.js +0 -1
- package/assets/ItemDetail-DmBWsg8l.js +0 -2
- package/assets/MyAssets-7sMdrGBa.js +0 -1
- package/assets/NotFound-COraILzW.js +0 -1
- package/assets/StoreSettings-C_SlMQ79.js +0 -1
- package/assets/useTheme-bLwsL2uj.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,j as v}from"./react-yytiy0wi.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-
|
|
1
|
+
import{r as l,j as v}from"./react-yytiy0wi.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-29783861565.commit-b83d609/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-29783861565.commit-b83d609/assets/DCL_LogoPattern-BryBPc3d.png",b=`
|
|
2
2
|
attribute vec2 a_position;
|
|
3
3
|
varying vec2 v_uv;
|
|
4
4
|
void main() {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as oe,r as i,j as e}from"./react-yytiy0wi.js";import{u as de,a as ue,t as a,b as $,C,A as B,f as me}from"./index-CzmwWbz1.js";import{m as pe}from"./mana-rate-D42fK9sf.js";import{u as _e,M as fe}from"./MarketCheckout-Kp8KKjmU.js";import{S as G,C as xe,R as be,F as he,a as Q,b as ge}from"./categories-BTWuBkUd.js";import{L as je}from"./LoadMore-6Uy0vHhH.js";import{u as Ne}from"./useInfiniteGrid-Dg-jgtmN.js";import{E as ye}from"./ErrorNotice-CKeOu_Oi.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-BPJvc5GU.js";import"./ethers-w2AslR0v.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./buy-BlHiSc1W.js";import"./trade-encoding-8RrYE6hq.js";import"./buy-gasless-aP_Keozx.js";import"./errors-uwUVgVvx.js";const ve=48,n=1e5;function Se(r){return{tradeId:r.tradeId??r.id,listingType:"primary",contractAddress:r.contractAddress,itemId:r.itemId??"",name:r.name,thumbnail:r.thumbnail,rarity:r.rarity,category:r.category,wearableCategory:r.wearableCategory??null,creator:r.creator,manaWei:r.manaWei??"0",available:1,network:r.network,chainId:r.chainId,createdAt:0}}function Ge(){const[r]=oe(),l=(r.get("q")??"").trim().toLowerCase(),U=de(),I=(r.get("q")??"").trim();ue({title:I?a("seo.collectibles.searchTitle",{query:I}):a("seo.collectibles.title"),description:a("seo.collectibles.description")});const[p,F]=i.useState("wearable"),[d,k]=i.useState(null),[c,R]=i.useState([]),[x,w]=i.useState(""),[b,M]=i.useState(""),[_,K]=i.useState("newest"),[P,D]=i.useState(!1),[h,f]=i.useState(!1),[L,E]=i.useState(null);i.useEffect(()=>{if(!h)return;const s=t=>{t.key==="Escape"&&f(!1)};return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[h]);const u=x&&!Number.isNaN(Number(x))?Number(x):void 0,m=b&&!Number.isNaN(Number(b))?Number(b):void 0,J=d?ge[d]:void 0,X=(G.find(s=>s.key===_)??G[0]).server,q={category:p,rarities:c.length?c:void 0,wearableCategories:J,minPriceCredits:u,maxPriceCredits:m,search:l||void 0,sortBy:X},{items:g,total:O,isLoading:o,error:Z,hasNextPage:z,isFetchingNextPage:T,fetchNextPage:H}=Ne(["unified-listings",q],s=>me({...q,first:ve,skip:s})),j=O,{data:N,isError:V}=_e(),Y=s=>N&&s.manaWei?pe(s.manaWei,N):null,W=i.useRef(null);i.useEffect(()=>{o||!l||W.current===l||(W.current=l,$("Shop Searched",{query:l,result_count:j}))},[l,o,j]);const y=i.useRef("__init__");i.useEffect(()=>{if(o)return;const s=JSON.stringify({category:p,subCategory:d,rarities:c,min:u,max:m,sort:_});if(y.current==="__init__"||y.current===s){y.current=s;return}y.current=s,$("Shop Applied Filter",{filters:{category:p,sub_category:d,rarities:c,min_price_credits:u??null,max_price_credits:m??null,sort:_},result_count:j})},[p,d,c,u,m,_,o,j]);function ee(s){F(s),k(null)}function se(s){R(t=>t.includes(s)?t.filter(A=>A!==s):[...t,s])}function ae(){F("wearable"),k(null),R([]),w(""),M("")}function re(s){const t=g.find(A=>A.id===s.id);t&&t.source==="legacy"&&t.manaWei&&E(Se(t))}function te(){U.invalidateQueries({queryKey:["unified-listings"]})}const v=u!=null?Math.min(u,n):0,S=m!=null?Math.min(m,n):n,ie=v/n*100,ne=S/n*100;function le(s){const t=Math.min(s,S);w(t<=0?"":String(t))}function ce(s){const t=Math.max(s,v);M(t>=n?"":String(t))}return e.jsxs("div",{className:"browse browse--sidebar","data-testid":"browse",children:[h?e.jsx("div",{className:"browse__scrim",onClick:()=>f(!1),"aria-hidden":!0}):null,e.jsxs("aside",{className:`browse__sidebar${h?" is-open":""}`,"data-testid":"browse-sidebar",children:[e.jsxs("div",{className:"browse__sidebar-head",children:[e.jsx("span",{className:"browse__sidebar-title",children:a("assets.filters")}),e.jsx("button",{className:"browse__sidebar-close",onClick:()=>f(!1),"aria-label":a("assets.closeFilters"),children:"✕"})]}),e.jsx("div",{className:"sidebar__section-label",children:a("assets.category")}),e.jsx(xe,{category:p,subCategory:d,onCategory:ee,onSub:k}),e.jsx("div",{className:"sidebar__divider"}),e.jsx("div",{className:"sidebar__section-label",children:a("filter.price")}),e.jsxs("div",{className:"price-filter",children:[e.jsxs("div",{className:"price-filter__inputs",children:[e.jsxs("label",{className:"price-filter__field",children:[e.jsx("span",{className:"price-filter__field-label",children:a("assets.min")}),e.jsxs("span",{className:"price-filter__box",children:[e.jsx(C,{className:"price-filter__coin"}),e.jsx("input",{type:"number",min:"0","aria-label":a("assets.minPriceAria"),placeholder:"0",value:x,onChange:s=>w(s.target.value)})]})]}),e.jsx("span",{className:"price-filter__to",children:a("assets.priceTo")}),e.jsxs("label",{className:"price-filter__field",children:[e.jsx("span",{className:"price-filter__field-label",children:a("assets.max")}),e.jsxs("span",{className:"price-filter__box",children:[e.jsx(C,{className:"price-filter__coin"}),e.jsx("input",{type:"number",min:"0","aria-label":a("assets.maxPriceAria"),placeholder:"0",value:b,onChange:s=>M(s.target.value)})]})]})]}),e.jsxs("div",{className:"price-filter__slider",style:{"--min-pct":`${ie}%`,"--max-pct":`${ne}%`},children:[e.jsx("div",{className:"price-filter__track","aria-hidden":!0}),e.jsx("div",{className:"price-filter__fill","aria-hidden":!0}),e.jsx("input",{type:"range",min:0,max:n,value:v,"aria-label":a("assets.minPriceSliderAria"),onChange:s=>le(Number(s.target.value))}),e.jsx("input",{type:"range",min:0,max:n,value:S,"aria-label":a("assets.maxPriceSliderAria"),onChange:s=>ce(Number(s.target.value))})]}),e.jsxs("div",{className:"price-filter__range",children:[e.jsxs("span",{className:"price-filter__range-val",children:[e.jsx(C,{className:"price-filter__coin"}),v.toLocaleString()]}),e.jsxs("span",{className:"price-filter__range-val",children:[e.jsx(C,{className:"price-filter__coin"}),S.toLocaleString()]})]})]}),e.jsx("div",{className:"sidebar__divider"}),e.jsxs("button",{type:"button",className:"sidebar__section-toggle","data-testid":"sidebar-section-toggle","aria-expanded":P,onClick:()=>D(s=>!s),children:[e.jsx("span",{className:"sidebar__section-label",children:a("assets.rarity")}),e.jsx("span",{className:`ico ico-chevron sidebar__section-chev${P?" is-up":""}`,"aria-hidden":!0})]}),P?e.jsx("div",{className:"rarity-filter","data-testid":"rarity-filter",children:be.map(s=>e.jsxs("label",{className:`rarity-filter__check${c.includes(s)?" is-on":""}`,"data-testid":"rarity-filter-check",children:[e.jsx("input",{type:"checkbox",checked:c.includes(s),onChange:()=>se(s)}),e.jsx("span",{children:s})]},s))}):null,e.jsxs("div",{className:"browse__sidebar-foot",children:[e.jsx("button",{type:"button",className:"browse__clear",onClick:ae,children:a("assets.clearFilters")}),e.jsx("button",{type:"button",className:"browse__apply",onClick:()=>f(!1),children:a("assets.apply")})]})]}),e.jsxs("div",{className:"browse__main",children:[e.jsx(he,{sort:_,onSort:K,total:O,loading:o,query:l,onOpenFilters:()=>f(!0)}),V&&g.some(s=>s.source==="legacy")?e.jsx("p",{className:"market-banner market-banner--warn",children:a("assets.marketUnavailable")}):null,Z?e.jsx(ye,{message:a("assets.loadError"),testId:"browse-error"}):null,e.jsx("div",{className:"grid","data-testid":"grid",children:o?e.jsx(Q,{count:15}):e.jsxs(e.Fragment,{children:[g.map(s=>s.source==="legacy"?e.jsx(B,{item:s,mode:"market",marketPriceCredits:Y(s),onBuyNow:re},s.id):e.jsx(B,{item:s},s.id)),T?e.jsx(Q,{count:6}):null]})}),e.jsx(je,{hasNextPage:z,isFetching:T,onLoadMore:()=>void H()}),!o&&g.length===0?e.jsx("p",{className:"muted",children:a("assets.noItems")}):null]}),L&&N?e.jsx(fe,{listing:L,rate:N,onClose:()=>E(null),onSold:()=>{E(null),te()}}):null]})}export{Ge as Assets};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,a as fe,b as ge,r as x,L as J}from"./react-yytiy0wi.js";import{t as a,C as N,ad as R,a as ve,ae as v,c as te,d as Ne,g as Ce,o as we,u as Me,af as Se,b as z,ag as ce,ah as Ie,z as B,j as Pe,k as Te,v as Le,q as re,ai as Ee,x as ne,w as Fe,aj as Be}from"./index-CDzDnyJW.js";import{a as le}from"./buy--wjHgZbY.js";import{g as Re,a as Ae,w as We,S as Ue,G as qe}from"./buy-gasless-DaSij0O9.js";import{R as $,r as ze}from"./cart-checkout-RV2JhHc0.js";import{c as $e,C as Ke}from"./payments-tEVDRx3d.js";import{E as oe}from"./ErrorNotice-Rze9rgc9.js";import{i as Qe,a as Oe}from"./errors-BFbUxXdM.js";import{C as Ge}from"./CollectionCarousel-CiKValmX.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-BPJvc5GU.js";import"./ethers-w2AslR0v.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-6ejU5fQD.js";import"./index-HN6Rk25C.js";function De(t){const{phase:r,balanceCredits:j,onClose:i}=t,C=r==="processing",I=r!=="complete",P=r==="nofunds"?a("cartCheckout.titleNoFunds"):a("cartCheckout.titleBuy"),n=r==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":a("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:C?void 0:i,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${n?" buy-modal__card--tall":""}`,children:[I&&e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:P}),!C&&e.jsx("button",{className:"buy-modal__x",onClick:i,"aria-label":a("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:r==="nofunds"?a("buyModal.dclBalance"):a("buyModal.myCreditsBalance")}),e.jsx(N,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:R(j)})]})]}),r==="processing"&&e.jsx(Je,{step:t.step??1,total:t.total??1}),r==="nofunds"&&e.jsx(Ve,{lines:t.lines??[],shortfallCredits:t.shortfallCredits??0,packs:t.packs??[],selectedPack:t.selectedPack??"",onSelectPack:t.onSelectPack??(()=>{}),onBuyPacks:t.onBuyPacks??(()=>{}),onCancel:i}),r==="complete"&&e.jsx(Ye,{purchased:t.purchased??[],onMyAssets:t.onMyAssets??i,onTryInWorld:t.onTryInWorld??i}),r==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(oe,{message:t.message}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:i,children:a("buyModal.close")})})]})]})]})}function Je({step:t,total:r}){return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:"/icon-192.png",alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:a("buyModal.completingTransaction")}),e.jsxs("div",{className:"cart-checkout__progress-row",children:[e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})}),e.jsxs("span",{className:"cart-checkout__step",children:[t,"/",r]})]})]})}function Ve({lines:t,shortfallCredits:r,packs:j,selectedPack:i,onSelectPack:C,onBuyPacks:I,onCancel:P}){const n=j.find(o=>o.id===i);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:"buy-modal__warning-ico",children:[e.jsx("path",{d:"M12 3L2 20h20L12 3z",fill:"none",stroke:"#691fa9",strokeWidth:"1.8",strokeLinejoin:"round"}),e.jsx("path",{d:"M12 9v5",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"17",r:"1.1",fill:"#691fa9"})]}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:a("buyModal.insufficientFunds")})," ",a("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:a("buyModal.warningCreditsAmount",{count:Math.max(0,r)})})," ",a("buyModal.warningToPurchase",{count:t.length})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:t.map(o=>e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:o.item.thumbnail?e.jsx("img",{src:o.item.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsx("div",{className:"buy-modal__asset-name",title:o.item.name,children:o.item.name||a("buyModal.itemFallback")}),o.item.creator?e.jsx("div",{className:"buy-modal__asset-creator",children:a("search.byCreator",{name:o.item.creator})}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(N,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:R(o.priceCredits)})]})]})]},o.item.id))}),e.jsx("div",{className:"buy-modal__packs",children:j.map(o=>{const T=o.id===i;return e.jsxs("button",{className:`buy-modal__pack${T?" buy-modal__pack--on":""}`,onClick:()=>C(o.id),children:[e.jsx(N,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:R(o.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",o.usd.toFixed(2),")"]})]},o.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(N,{className:"buy-modal__total-ico"}),e.jsx("span",{children:R((n==null?void 0:n.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((n==null?void 0:n.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:P,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:I,children:a("buyModal.buy")})]})]})}function Ye({purchased:t,onMyAssets:r,onTryInWorld:j}){return e.jsxs("div",{className:"buy-modal__body cart-checkout__done-body",children:[e.jsxs("div",{className:"buy-modal__success",children:[e.jsxs("svg",{viewBox:"0 0 64 64",width:"60",height:"60","aria-hidden":!0,children:[e.jsx("circle",{cx:"32",cy:"32",r:"32",fill:"#34ce77"}),e.jsx("path",{d:"M20 33l8 8 16-18",fill:"none",stroke:"#fff",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsxs("p",{className:"buy-modal__success-text",children:[e.jsx("b",{children:a("getCredits.successTitle")})," ",a("buyModal.successBody")]})]}),e.jsx("div",{className:"cart-checkout__done",children:e.jsx("div",{className:"cart-checkout__done-scroll",children:t.map(i=>e.jsxs("div",{className:"cart-checkout__done-row",children:[e.jsxs("div",{className:"cart-checkout__done-thumb",children:[i.thumbnail?e.jsx("img",{src:i.thumbnail,alt:""}):null,e.jsx("span",{className:"cart-checkout__done-check","aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 18 18",width:"12",height:"12",children:e.jsx("path",{d:"M4 9l3.5 3.5L14 5",fill:"none",stroke:"#fff",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"cart-checkout__done-info",children:[e.jsx("div",{className:"cart-checkout__done-name",title:i.name,children:i.name||a("buyModal.itemFallback")}),i.creator?e.jsx("div",{className:"cart-checkout__done-creator",children:a("search.byCreator",{name:i.creator})}):null]}),e.jsxs("div",{className:"cart-checkout__done-price",children:[e.jsx(N,{className:"cart-checkout__done-price-ico"}),e.jsx("span",{children:R(i.priceCredits)})]})]},i.id))})}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:r,children:a("buyModal.myAssets")}),e.jsxs("button",{className:"buy-modal__btn buy-modal__btn--ruby",onClick:j,children:[a("buyModal.tryInWorld"),e.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20","aria-hidden":!0,children:e.jsx("path",{d:"M5 12h12M13 7l5 5-5 5",fill:"none",stroke:"#fcfcfc",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})]})}function ie(t){if(Qe(t))return a("errors.rejected");const r=(t.message??"").toLowerCase();return r.includes("insufficient")?a("cart.error.insufficient",{currency:Te.name}):r.includes("no active listing")||r.includes("your own listing")?a("cart.error.listingChanged"):a("marketCheckout.error.generic")}const He=12e4,K=Ke.slice(0,3),Xe=Pe.chainId===80002?"https://decentraland.zone/jump":"https://decentraland.org/jump";function Ze(t){const r=[];return t.unavailable.length&&r.push(a("cart.drop.unavailable",{count:t.unavailable.length})),t.own.length&&r.push(a("cart.drop.own",{count:t.own.length})),a("cart.drop.removed",{items:r.join(` ${a("cart.drop.and")} `)})}function bs(){ve({title:a("nav.cart"),noindex:!0});const t=v(s=>s.items),r=v(s=>s.remove),j=v(s=>s.clear),i=v(s=>s.restore),C=v(s=>s.setFittingOpen),I=te(s=>s.items),P=te(s=>s.toggle),{session:n}=Ne(),o=t.some(s=>s.category!=="emote"),{data:T}=Ce({queryKey:["upsell-listings"],queryFn:()=>Be({first:40}),staleTime:6e4}),{data:L}=we(n),A=Me(),W=fe(),{state:w}=ge(),[V,E]=x.useState(null),[de,k]=x.useState(null),[Y,U]=x.useState(null),[ue,M]=x.useState(!1),[y,F]=x.useState(null),H=x.useRef(0),[d,f]=x.useState(null),[Q,X]=x.useState(""),he=t.reduce((s,c)=>s+c.priceCredits,0),me=y?y.liveTotalCredits:he,_e=new Set(t.map(s=>s.id)),Z=((T==null?void 0:T.items)??[]).filter(s=>!_e.has(s.id)).slice(0,12),be=new Map(y==null?void 0:y.buyable.map(s=>[s.item.id,s])),q=(L==null?void 0:L.credits)??0,pe=Ie;function O(s){s(),F(null),U(null),k(null)}function ye(){f(null),M(!1)}function ee(s){const c=s.reduce((h,u)=>h+u.priceCredits,0),l=Math.max(0,c-q),p=K.find(h=>h.credits>=l)??K[K.length-1];X(p.id),z("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:c,credits_balance:q,shortfall:l}),f({phase:"nofunds",lines:s.map(h=>({item:h.item,priceCredits:h.priceCredits})),shortfall:l}),M(!1)}async function xe(s){if(!n||s.length===0)return;const c=s.map(u=>({...u.item,priceCredits:u.priceCredits})),l=[];let p="authorize",h=!1;f({phase:"processing",step:1,total:s.length});try{const u=[];for(let _=0;_<s.length;_++){const g=s[_];f({phase:"processing",step:_+1,total:s.length});try{const{credit:b,maxCreditedValue:D}=await Le(n.identity,g.usdCents,g.trade.id);l.push(b.id),u.push({trade:g.trade,credits:[b],maxCreditedValue:D})}catch(b){if(Oe(b)){if(l.length){try{await re(n.identity,l)}catch(D){B(D,{flow:"cart_checkout",step:"release"})}A.invalidateQueries({queryKey:["usd-balance"]})}ee(s);return}throw b}}p="submit";let m=[];if(Re())try{m=await Ae({purchases:u,buyer:n.address,signer:n.signer});const g=(await Promise.allSettled(m.map(b=>We(b)))).flatMap(b=>b.status==="rejected"?[b.reason]:[]);if(g.length&&!g.some(b=>b instanceof Ue))throw g[0];h=!0}catch(_){if(!(_ instanceof qe))throw _;m=await le({purchases:u,buyer:n.address,signer:n.signer})}else m=await le({purchases:u,buyer:n.address,signer:n.signer});s.forEach(_=>r(_.item.id)),F(null),z("Shop Completed Purchase",{...Ee(c),payment_type:"credits",no_crypto_step:h,transaction_hash:m[0]??null}),A.invalidateQueries({queryKey:["usd-balance"]}),f({phase:"complete",purchased:c})}catch(u){if(ne(u)||B(u,{flow:"cart_checkout",step:p,cart_size:s.length}),z(ne(u)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:p,error_code:Fe(u),value_usd:ce(c.reduce((m,_)=>m+_.priceCredits,0)),cart_size:s.length}),l.length){try{await re(n.identity,l)}catch(m){B(m,{flow:"cart_checkout",step:"release"})}A.invalidateQueries({queryKey:["usd-balance"]})}f({phase:"error",message:ie(u)})}}function se(s){const c=s.reduce((l,p)=>l+p.priceCredits,0);if(L!=null&&L.credits<c){ee(s);return}xe(s)}async function G(){if(!n){k(a("buyModal.signInToCheckout"));return}const s=v.getState().items;if(s.length!==0){k(null),U(null),M(!0),z("Shop Started Checkout",{cart_size:s.length,cart_value_credits:s.reduce((c,l)=>c+l.priceCredits,0),cart_value_usd:ce(s.reduce((c,l)=>c+l.priceCredits,0)),has_sufficient_credits:q>=s.reduce((c,l)=>c+l.priceCredits,0)});try{E(a("cart.status.reviewing"));const c=await ze(s,n.address,pe),l=[...c.unavailable,...c.own];if(l.length&&(l.forEach(p=>r(p.id)),U(Ze(c))),c.buyable.length===0){k(a("cart.error.noneAvailable")),F(null),E(null);return}if(c.orderChanged){F(c),H.current=Date.now(),E(null);return}E(null),se(c.buyable)}catch(c){B(c,{flow:"cart_checkout",step:"review",cart_size:s.length}),k(ie(c)),E(null)}finally{M(!1)}}}async function je(){if(y){if(!n){k(a("buyModal.signInToCheckout"));return}if(Date.now()-H.current>He){F(null),U(null),await G();return}k(null),se(y.buyable)}}async function ke(){if(Q){try{sessionStorage.setItem($,JSON.stringify(v.getState().items))}catch{}M(!0);try{const s=await $e(Q,n?{address:n.address,identity:n.identity}:void 0);if(s.url){window.location.href=s.url;return}W("/credits")}catch(s){try{sessionStorage.removeItem($)}catch{}B(s,{flow:"cart_buy_credits"}),f({phase:"error",message:a("buyModal.error.creditsCheckout")})}finally{M(!1)}}}const ae=x.useRef(!1);x.useEffect(()=>{if(!(w!=null&&w.resumeCheckout)||ae.current)return;ae.current=!0;try{const c=sessionStorage.getItem($);if(c){sessionStorage.removeItem($);const l=JSON.parse(c);Array.isArray(l)&&l.length&&i(l)}}catch{}A.invalidateQueries({queryKey:["usd-balance"]});const s=setTimeout(()=>void G(),0);return()=>clearTimeout(s)},[w==null?void 0:w.resumeCheckout]);const S=ue||(d==null?void 0:d.phase)==="processing";return t.length===0&&!d?e.jsxs("div",{className:"cart cart--empty",children:[e.jsx("span",{className:"ico ico-cart cart-empty__ico","aria-hidden":!0}),e.jsx("p",{className:"cart-empty__title",children:a("cart.empty.title")}),e.jsx("p",{className:"muted",children:a("cart.empty.body")}),e.jsx(J,{className:"btn btn--purple",to:"/assets",children:a("cart.empty.cta")})]}):e.jsxs("div",{className:"checkout",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>W(-1),type:"button",children:[e.jsx("span",{className:"ico ico-arrow-left","aria-hidden":!0}),a("nav.cart")]}),e.jsxs("div",{className:"checkout__body",children:[e.jsxs("section",{className:"checkout__panel",children:[e.jsxs("div",{className:"checkout__panel-head",children:[e.jsx("button",{className:"checkout__panel-back",onClick:()=>W(-1),type:"button","aria-label":a("cart.goBack"),children:e.jsx("span",{className:"ico ico-arrow-left","aria-hidden":!0})}),e.jsx("h1",{className:"checkout__panel-title",children:a("cart.panelTitle",{count:t.length})}),o?e.jsxs("button",{className:"checkout__fitting",onClick:()=>C(!0),disabled:S,children:[e.jsx("span",{className:"ico ico-fitting-room checkout__fitting-ico","aria-hidden":!0}),a("cart.fittingRoom")]}):null]}),e.jsx("div",{className:"checkout__list",children:t.map(s=>{const c=be.get(s.id),l=c?c.priceCredits:s.priceCredits,p=!!c&&c.priceCredits!==s.priceCredits,h=!!I[s.id],u=s.tokenId??s.itemId,m=s.contractAddress&&u?`/item/${s.contractAddress}/${u}`:null;return e.jsxs("div",{className:"checkout__card",children:[e.jsxs("div",{className:"checkout__thumb",children:[m?e.jsx(J,{className:"checkout__thumb-link",to:m,state:{item:s,tradeId:s.tradeId},"aria-label":s.name,children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null}):s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null,e.jsx("span",{className:"checkout__thumb-check","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("div",{className:"checkout__info",children:[e.jsxs("div",{className:"checkout__desc",children:[m?e.jsx(J,{className:"checkout__name",to:m,state:{item:s,tradeId:s.tradeId},title:s.name,children:s.name}):e.jsx("div",{className:"checkout__name",title:s.name,children:s.name}),s.creator?e.jsx(Se,{address:s.creator,className:"checkout__creator",linkToProfile:!0}):null]}),e.jsxs("div",{className:"checkout__foot",children:[e.jsxs("div",{className:"checkout__stepper",children:[e.jsx("button",{className:"checkout__step",onClick:()=>O(()=>r(s.id)),disabled:S,"aria-label":a("cart.removeFromCart",{name:s.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("span",{className:"checkout__qty",children:"1"}),e.jsx("button",{className:"checkout__step",disabled:!0,"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"})})})]}),e.jsxs("div",{className:"checkout__price",children:[e.jsx(N,{className:"checkout__price-ico"})," ",l,p?e.jsx("span",{className:"checkout__price-was",children:s.priceCredits}):null]})]})]}),e.jsxs("div",{className:"checkout__actions",children:[e.jsx("button",{className:`checkout__fav${h?" is-on":""}`,onClick:()=>P(s),"aria-label":h?a("cart.removeFromFavorites",{name:s.name}):a("cart.addToFavorites",{name:s.name}),title:h?a("assetCard.removeFromFavorites"):a("assetCard.addToFavorites"),children:e.jsx("span",{className:`ico ${h?"ico-heart-solid":"ico-heart"}`,"aria-hidden":!0})}),e.jsx("button",{className:"checkout__remove",onClick:()=>O(()=>r(s.id)),disabled:S,"aria-label":a("cart.remove",{name:s.name}),title:a("cart.removeTitle"),children:e.jsx("span",{className:"ico ico-trash","aria-hidden":!0})})]})]},s.id)})}),e.jsxs("div",{className:"checkout__utils",children:[e.jsx("button",{className:"link",onClick:()=>O(j),disabled:S,children:a("cart.clearCart")}),null]})]}),e.jsxs("aside",{className:"checkout__summary",children:[e.jsx("h2",{className:"checkout__summary-title",children:a("cart.purchaseSummary")}),e.jsxs("div",{className:"checkout__summary-body",children:[e.jsxs("div",{className:"checkout__total-line",children:[e.jsx("span",{className:"checkout__total-label",children:a("cart.totalItems",{count:t.length})}),e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(N,{className:"checkout__total-ico"})," ",me]})]}),e.jsx("button",{className:"checkout__cta",onClick:y?je:G,disabled:S,children:S?a("cart.working"):y?a("marketCheckout.confirmPurchase"):a("assetCard.buyNow")}),y?e.jsx("p",{className:"muted checkout__msg",children:a("cart.priceChanged")}):null,Y?e.jsx("p",{className:"muted checkout__msg",children:Y}):null,V?e.jsx("p",{className:"muted checkout__msg",children:V}):null,e.jsx(oe,{message:de,className:"checkout__msg"})]})]})]}),Z.length>0?e.jsx("div",{className:"cart-upsell",children:e.jsx(Ge,{title:a("cart.youMightAlsoLike"),items:Z})}):null,d?e.jsx(De,{phase:d.phase,balanceCredits:q,onClose:ye,step:d.phase==="processing"?d.step:void 0,total:d.phase==="processing"?d.total:void 0,lines:d.phase==="nofunds"?d.lines:void 0,shortfallCredits:d.phase==="nofunds"?d.shortfall:void 0,packs:K,selectedPack:Q,onSelectPack:X,onBuyPacks:ke,purchased:d.phase==="complete"?d.purchased:void 0,onMyAssets:()=>W("/assets?tab=mine"),onTryInWorld:()=>window.open(Xe,"_blank","noopener"),message:d.phase==="error"?d.message:void 0}):null]})}export{bs as Cart};
|
|
1
|
+
import{j as e,a as fe,b as ge,r as x,L as J}from"./react-yytiy0wi.js";import{t as a,C as N,ad as R,a as ve,ae as v,c as te,d as Ne,g as Ce,o as we,u as Me,af as Se,b as z,ag as ce,ah as Ie,z as B,j as Pe,k as Te,v as Le,q as re,ai as Ee,x as ne,w as Fe,aj as Be}from"./index-CzmwWbz1.js";import{a as le}from"./buy-BlHiSc1W.js";import{g as Re,a as Ae,w as We,S as Ue,G as qe}from"./buy-gasless-aP_Keozx.js";import{R as $,r as ze}from"./cart-checkout-ClRVRUn2.js";import{C as $e,c as Ke}from"./payments-DOnM9_yY.js";import{E as oe}from"./ErrorNotice-CKeOu_Oi.js";import{i as Qe,a as Oe}from"./errors-uwUVgVvx.js";import{C as Ge}from"./CollectionCarousel-CoUEKAXy.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-BPJvc5GU.js";import"./ethers-w2AslR0v.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-8RrYE6hq.js";import"./index-HN6Rk25C.js";function De(t){const{phase:r,balanceCredits:j,onClose:i}=t,C=r==="processing",I=r!=="complete",P=r==="nofunds"?a("cartCheckout.titleNoFunds"):a("cartCheckout.titleBuy"),n=r==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":a("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:C?void 0:i,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${n?" buy-modal__card--tall":""}`,children:[I&&e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:P}),!C&&e.jsx("button",{className:"buy-modal__x",onClick:i,"aria-label":a("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:r==="nofunds"?a("buyModal.dclBalance"):a("buyModal.myCreditsBalance")}),e.jsx(N,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:R(j)})]})]}),r==="processing"&&e.jsx(Je,{step:t.step??1,total:t.total??1}),r==="nofunds"&&e.jsx(Ve,{lines:t.lines??[],shortfallCredits:t.shortfallCredits??0,packs:t.packs??[],selectedPack:t.selectedPack??"",onSelectPack:t.onSelectPack??(()=>{}),onBuyPacks:t.onBuyPacks??(()=>{}),onCancel:i}),r==="complete"&&e.jsx(Ye,{purchased:t.purchased??[],onMyAssets:t.onMyAssets??i,onTryInWorld:t.onTryInWorld??i}),r==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(oe,{message:t.message}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:i,children:a("buyModal.close")})})]})]})]})}function Je({step:t,total:r}){return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:"/icon-192.png",alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:a("buyModal.completingTransaction")}),e.jsxs("div",{className:"cart-checkout__progress-row",children:[e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})}),e.jsxs("span",{className:"cart-checkout__step",children:[t,"/",r]})]})]})}function Ve({lines:t,shortfallCredits:r,packs:j,selectedPack:i,onSelectPack:C,onBuyPacks:I,onCancel:P}){const n=j.find(o=>o.id===i);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:"buy-modal__warning-ico",children:[e.jsx("path",{d:"M12 3L2 20h20L12 3z",fill:"none",stroke:"#691fa9",strokeWidth:"1.8",strokeLinejoin:"round"}),e.jsx("path",{d:"M12 9v5",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"17",r:"1.1",fill:"#691fa9"})]}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:a("buyModal.insufficientFunds")})," ",a("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:a("buyModal.warningCreditsAmount",{count:Math.max(0,r)})})," ",a("buyModal.warningToPurchase",{count:t.length})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:t.map(o=>e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:o.item.thumbnail?e.jsx("img",{src:o.item.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsx("div",{className:"buy-modal__asset-name",title:o.item.name,children:o.item.name||a("buyModal.itemFallback")}),o.item.creator?e.jsx("div",{className:"buy-modal__asset-creator",children:a("search.byCreator",{name:o.item.creator})}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(N,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:R(o.priceCredits)})]})]})]},o.item.id))}),e.jsx("div",{className:"buy-modal__packs",children:j.map(o=>{const T=o.id===i;return e.jsxs("button",{className:`buy-modal__pack${T?" buy-modal__pack--on":""}`,onClick:()=>C(o.id),children:[e.jsx(N,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:R(o.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",o.usd.toFixed(2),")"]})]},o.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(N,{className:"buy-modal__total-ico"}),e.jsx("span",{children:R((n==null?void 0:n.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((n==null?void 0:n.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:P,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:I,children:a("buyModal.buy")})]})]})}function Ye({purchased:t,onMyAssets:r,onTryInWorld:j}){return e.jsxs("div",{className:"buy-modal__body cart-checkout__done-body",children:[e.jsxs("div",{className:"buy-modal__success",children:[e.jsxs("svg",{viewBox:"0 0 64 64",width:"60",height:"60","aria-hidden":!0,children:[e.jsx("circle",{cx:"32",cy:"32",r:"32",fill:"#34ce77"}),e.jsx("path",{d:"M20 33l8 8 16-18",fill:"none",stroke:"#fff",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsxs("p",{className:"buy-modal__success-text",children:[e.jsx("b",{children:a("getCredits.successTitle")})," ",a("buyModal.successBody")]})]}),e.jsx("div",{className:"cart-checkout__done",children:e.jsx("div",{className:"cart-checkout__done-scroll",children:t.map(i=>e.jsxs("div",{className:"cart-checkout__done-row",children:[e.jsxs("div",{className:"cart-checkout__done-thumb",children:[i.thumbnail?e.jsx("img",{src:i.thumbnail,alt:""}):null,e.jsx("span",{className:"cart-checkout__done-check","aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 18 18",width:"12",height:"12",children:e.jsx("path",{d:"M4 9l3.5 3.5L14 5",fill:"none",stroke:"#fff",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"cart-checkout__done-info",children:[e.jsx("div",{className:"cart-checkout__done-name",title:i.name,children:i.name||a("buyModal.itemFallback")}),i.creator?e.jsx("div",{className:"cart-checkout__done-creator",children:a("search.byCreator",{name:i.creator})}):null]}),e.jsxs("div",{className:"cart-checkout__done-price",children:[e.jsx(N,{className:"cart-checkout__done-price-ico"}),e.jsx("span",{children:R(i.priceCredits)})]})]},i.id))})}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:r,children:a("buyModal.myAssets")}),e.jsxs("button",{className:"buy-modal__btn buy-modal__btn--ruby",onClick:j,children:[a("buyModal.tryInWorld"),e.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20","aria-hidden":!0,children:e.jsx("path",{d:"M5 12h12M13 7l5 5-5 5",fill:"none",stroke:"#fcfcfc",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})]})}function ie(t){if(Qe(t))return a("errors.rejected");const r=(t.message??"").toLowerCase();return r.includes("insufficient")?a("cart.error.insufficient",{currency:Te.name}):r.includes("no active listing")||r.includes("your own listing")?a("cart.error.listingChanged"):a("marketCheckout.error.generic")}const He=12e4,K=$e.slice(0,3),Xe=Pe.chainId===80002?"https://decentraland.zone/jump":"https://decentraland.org/jump";function Ze(t){const r=[];return t.unavailable.length&&r.push(a("cart.drop.unavailable",{count:t.unavailable.length})),t.own.length&&r.push(a("cart.drop.own",{count:t.own.length})),a("cart.drop.removed",{items:r.join(` ${a("cart.drop.and")} `)})}function bs(){ve({title:a("nav.cart"),noindex:!0});const t=v(s=>s.items),r=v(s=>s.remove),j=v(s=>s.clear),i=v(s=>s.restore),C=v(s=>s.setFittingOpen),I=te(s=>s.items),P=te(s=>s.toggle),{session:n}=Ne(),o=t.some(s=>s.category!=="emote"),{data:T}=Ce({queryKey:["upsell-listings"],queryFn:()=>Be({first:40}),staleTime:6e4}),{data:L}=we(n),A=Me(),W=fe(),{state:w}=ge(),[V,E]=x.useState(null),[de,k]=x.useState(null),[Y,U]=x.useState(null),[ue,M]=x.useState(!1),[y,F]=x.useState(null),H=x.useRef(0),[d,f]=x.useState(null),[Q,X]=x.useState(""),he=t.reduce((s,c)=>s+c.priceCredits,0),me=y?y.liveTotalCredits:he,_e=new Set(t.map(s=>s.id)),Z=((T==null?void 0:T.items)??[]).filter(s=>!_e.has(s.id)).slice(0,12),be=new Map(y==null?void 0:y.buyable.map(s=>[s.item.id,s])),q=(L==null?void 0:L.credits)??0,pe=Ie;function O(s){s(),F(null),U(null),k(null)}function ye(){f(null),M(!1)}function ee(s){const c=s.reduce((h,u)=>h+u.priceCredits,0),l=Math.max(0,c-q),p=K.find(h=>h.credits>=l)??K[K.length-1];X(p.id),z("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:c,credits_balance:q,shortfall:l}),f({phase:"nofunds",lines:s.map(h=>({item:h.item,priceCredits:h.priceCredits})),shortfall:l}),M(!1)}async function xe(s){if(!n||s.length===0)return;const c=s.map(u=>({...u.item,priceCredits:u.priceCredits})),l=[];let p="authorize",h=!1;f({phase:"processing",step:1,total:s.length});try{const u=[];for(let _=0;_<s.length;_++){const g=s[_];f({phase:"processing",step:_+1,total:s.length});try{const{credit:b,maxCreditedValue:D}=await Le(n.identity,g.usdCents,g.trade.id);l.push(b.id),u.push({trade:g.trade,credits:[b],maxCreditedValue:D})}catch(b){if(Oe(b)){if(l.length){try{await re(n.identity,l)}catch(D){B(D,{flow:"cart_checkout",step:"release"})}A.invalidateQueries({queryKey:["usd-balance"]})}ee(s);return}throw b}}p="submit";let m=[];if(Re())try{m=await Ae({purchases:u,buyer:n.address,signer:n.signer});const g=(await Promise.allSettled(m.map(b=>We(b)))).flatMap(b=>b.status==="rejected"?[b.reason]:[]);if(g.length&&!g.some(b=>b instanceof Ue))throw g[0];h=!0}catch(_){if(!(_ instanceof qe))throw _;m=await le({purchases:u,buyer:n.address,signer:n.signer})}else m=await le({purchases:u,buyer:n.address,signer:n.signer});s.forEach(_=>r(_.item.id)),F(null),z("Shop Completed Purchase",{...Ee(c),payment_type:"credits",no_crypto_step:h,transaction_hash:m[0]??null}),A.invalidateQueries({queryKey:["usd-balance"]}),f({phase:"complete",purchased:c})}catch(u){if(ne(u)||B(u,{flow:"cart_checkout",step:p,cart_size:s.length}),z(ne(u)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:p,error_code:Fe(u),value_usd:ce(c.reduce((m,_)=>m+_.priceCredits,0)),cart_size:s.length}),l.length){try{await re(n.identity,l)}catch(m){B(m,{flow:"cart_checkout",step:"release"})}A.invalidateQueries({queryKey:["usd-balance"]})}f({phase:"error",message:ie(u)})}}function se(s){const c=s.reduce((l,p)=>l+p.priceCredits,0);if(L!=null&&L.credits<c){ee(s);return}xe(s)}async function G(){if(!n){k(a("buyModal.signInToCheckout"));return}const s=v.getState().items;if(s.length!==0){k(null),U(null),M(!0),z("Shop Started Checkout",{cart_size:s.length,cart_value_credits:s.reduce((c,l)=>c+l.priceCredits,0),cart_value_usd:ce(s.reduce((c,l)=>c+l.priceCredits,0)),has_sufficient_credits:q>=s.reduce((c,l)=>c+l.priceCredits,0)});try{E(a("cart.status.reviewing"));const c=await ze(s,n.address,pe),l=[...c.unavailable,...c.own];if(l.length&&(l.forEach(p=>r(p.id)),U(Ze(c))),c.buyable.length===0){k(a("cart.error.noneAvailable")),F(null),E(null);return}if(c.orderChanged){F(c),H.current=Date.now(),E(null);return}E(null),se(c.buyable)}catch(c){B(c,{flow:"cart_checkout",step:"review",cart_size:s.length}),k(ie(c)),E(null)}finally{M(!1)}}}async function je(){if(y){if(!n){k(a("buyModal.signInToCheckout"));return}if(Date.now()-H.current>He){F(null),U(null),await G();return}k(null),se(y.buyable)}}async function ke(){if(Q){try{sessionStorage.setItem($,JSON.stringify(v.getState().items))}catch{}M(!0);try{const s=await Ke(Q,n?{address:n.address,identity:n.identity}:void 0);if(s.url){window.location.href=s.url;return}W("/credits")}catch(s){try{sessionStorage.removeItem($)}catch{}B(s,{flow:"cart_buy_credits"}),f({phase:"error",message:a("buyModal.error.creditsCheckout")})}finally{M(!1)}}}const ae=x.useRef(!1);x.useEffect(()=>{if(!(w!=null&&w.resumeCheckout)||ae.current)return;ae.current=!0;try{const c=sessionStorage.getItem($);if(c){sessionStorage.removeItem($);const l=JSON.parse(c);Array.isArray(l)&&l.length&&i(l)}}catch{}A.invalidateQueries({queryKey:["usd-balance"]});const s=setTimeout(()=>void G(),0);return()=>clearTimeout(s)},[w==null?void 0:w.resumeCheckout]);const S=ue||(d==null?void 0:d.phase)==="processing";return t.length===0&&!d?e.jsxs("div",{className:"cart cart--empty",children:[e.jsx("span",{className:"ico ico-cart cart-empty__ico","aria-hidden":!0}),e.jsx("p",{className:"cart-empty__title",children:a("cart.empty.title")}),e.jsx("p",{className:"muted",children:a("cart.empty.body")}),e.jsx(J,{className:"btn btn--purple",to:"/assets",children:a("cart.empty.cta")})]}):e.jsxs("div",{className:"checkout",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>W(-1),type:"button",children:[e.jsx("span",{className:"ico ico-arrow-left","aria-hidden":!0}),a("nav.cart")]}),e.jsxs("div",{className:"checkout__body",children:[e.jsxs("section",{className:"checkout__panel",children:[e.jsxs("div",{className:"checkout__panel-head",children:[e.jsx("button",{className:"checkout__panel-back",onClick:()=>W(-1),type:"button","aria-label":a("cart.goBack"),children:e.jsx("span",{className:"ico ico-arrow-left","aria-hidden":!0})}),e.jsx("h1",{className:"checkout__panel-title",children:a("cart.panelTitle",{count:t.length})}),o?e.jsxs("button",{className:"checkout__fitting",onClick:()=>C(!0),disabled:S,children:[e.jsx("span",{className:"ico ico-fitting-room checkout__fitting-ico","aria-hidden":!0}),a("cart.fittingRoom")]}):null]}),e.jsx("div",{className:"checkout__list",children:t.map(s=>{const c=be.get(s.id),l=c?c.priceCredits:s.priceCredits,p=!!c&&c.priceCredits!==s.priceCredits,h=!!I[s.id],u=s.tokenId??s.itemId,m=s.contractAddress&&u?`/item/${s.contractAddress}/${u}`:null;return e.jsxs("div",{className:"checkout__card",children:[e.jsxs("div",{className:"checkout__thumb",children:[m?e.jsx(J,{className:"checkout__thumb-link",to:m,state:{item:s,tradeId:s.tradeId},"aria-label":s.name,children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null}):s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null,e.jsx("span",{className:"checkout__thumb-check","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("div",{className:"checkout__info",children:[e.jsxs("div",{className:"checkout__desc",children:[m?e.jsx(J,{className:"checkout__name",to:m,state:{item:s,tradeId:s.tradeId},title:s.name,children:s.name}):e.jsx("div",{className:"checkout__name",title:s.name,children:s.name}),s.creator?e.jsx(Se,{address:s.creator,className:"checkout__creator",linkToProfile:!0}):null]}),e.jsxs("div",{className:"checkout__foot",children:[e.jsxs("div",{className:"checkout__stepper",children:[e.jsx("button",{className:"checkout__step",onClick:()=>O(()=>r(s.id)),disabled:S,"aria-label":a("cart.removeFromCart",{name:s.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("span",{className:"checkout__qty",children:"1"}),e.jsx("button",{className:"checkout__step",disabled:!0,"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"})})})]}),e.jsxs("div",{className:"checkout__price",children:[e.jsx(N,{className:"checkout__price-ico"})," ",l,p?e.jsx("span",{className:"checkout__price-was",children:s.priceCredits}):null]})]})]}),e.jsxs("div",{className:"checkout__actions",children:[e.jsx("button",{className:`checkout__fav${h?" is-on":""}`,onClick:()=>P(s),"aria-label":h?a("cart.removeFromFavorites",{name:s.name}):a("cart.addToFavorites",{name:s.name}),title:h?a("assetCard.removeFromFavorites"):a("assetCard.addToFavorites"),children:e.jsx("span",{className:`ico ${h?"ico-heart-solid":"ico-heart"}`,"aria-hidden":!0})}),e.jsx("button",{className:"checkout__remove",onClick:()=>O(()=>r(s.id)),disabled:S,"aria-label":a("cart.remove",{name:s.name}),title:a("cart.removeTitle"),children:e.jsx("span",{className:"ico ico-trash","aria-hidden":!0})})]})]},s.id)})}),e.jsxs("div",{className:"checkout__utils",children:[e.jsx("button",{className:"link",onClick:()=>O(j),disabled:S,children:a("cart.clearCart")}),null]})]}),e.jsxs("aside",{className:"checkout__summary",children:[e.jsx("h2",{className:"checkout__summary-title",children:a("cart.purchaseSummary")}),e.jsxs("div",{className:"checkout__summary-body",children:[e.jsxs("div",{className:"checkout__total-line",children:[e.jsx("span",{className:"checkout__total-label",children:a("cart.totalItems",{count:t.length})}),e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(N,{className:"checkout__total-ico"})," ",me]})]}),e.jsx("button",{className:"checkout__cta",onClick:()=>void(y?je():G()),disabled:S,children:S?a("cart.working"):y?a("marketCheckout.confirmPurchase"):a("assetCard.buyNow")}),y?e.jsx("p",{className:"muted checkout__msg",children:a("cart.priceChanged")}):null,Y?e.jsx("p",{className:"muted checkout__msg",children:Y}):null,V?e.jsx("p",{className:"muted checkout__msg",children:V}):null,e.jsx(oe,{message:de,className:"checkout__msg"})]})]})]}),Z.length>0?e.jsx("div",{className:"cart-upsell",children:e.jsx(Ge,{title:a("cart.youMightAlsoLike"),items:Z})}):null,d?e.jsx(De,{phase:d.phase,balanceCredits:q,onClose:ye,step:d.phase==="processing"?d.step:void 0,total:d.phase==="processing"?d.total:void 0,lines:d.phase==="nofunds"?d.lines:void 0,shortfallCredits:d.phase==="nofunds"?d.shortfall:void 0,packs:K,selectedPack:Q,onSelectPack:X,onBuyPacks:()=>void ke(),purchased:d.phase==="complete"?d.purchased:void 0,onMyAssets:()=>W("/assets?tab=mine"),onTryInWorld:()=>window.open(Xe,"_blank","noopener"),message:d.phase==="error"?d.message:void 0}):null]})}export{bs as Cart};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{M as N,N as U,O as w,P as z,Q as o,R as E,S as c,U as I,V as g,X as D,Y as M}from"./index-
|
|
1
|
+
import{M as N,N as U,O as w,P as z,Q as o,R as E,S as c,U as I,V as g,X as D,Y as M}from"./index-CzmwWbz1.js";import{r as F,j as v}from"./react-yytiy0wi.js";function K(r){return N("MuiCircularProgress",r)}U("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const V=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,S,b,$;const t=44,W=M(P||(P=l`
|
|
2
2
|
0% {
|
|
3
3
|
transform: rotate(0deg);
|
|
4
4
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,r as u,d as D,a as O}from"./react-yytiy0wi.js";import{F as Q,t,j as Y,z as Z,g as J,a as V,A as W,an as X,k as ee,ao as ae}from"./index-CzmwWbz1.js";import{E as te}from"./ErrorNotice-CKeOu_Oi.js";import{d as re,g as se,a as ce,A as oe}from"./collection-CRx0Du-v.js";import{u as ie}from"./useStore-BYewymaj.js";import{s as M}from"./address-DrURAr9O.js";import{S as F,C as le,F as ne,c as de,a as T,b as me}from"./categories-BTWuBkUd.js";import{L as ue}from"./LoadMore-6Uy0vHhH.js";import{u as pe}from"./useInfiniteGrid-Dg-jgtmN.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-BPJvc5GU.js";import"./ethers-w2AslR0v.js";import"./intl-CBcMB1D2.js";function he({name:r,creator:a}){const{data:o}=ie(a),l=(o==null?void 0:o.cover)||re;return e.jsxs("section",{className:"collection-hero","data-testid":"collection-hero","aria-label":r,children:[e.jsxs("div",{className:"collection-hero__cover",children:[e.jsx("img",{className:"collection-hero__cover-img",src:l,alt:"",loading:"eager"}),e.jsx("div",{className:"collection-hero__scrim","aria-hidden":!0})]}),e.jsx("h1",{className:"collection-hero__title","data-testid":"collection-hero-title",children:r})]})}function ge({address:r}){var x,i;const{data:a}=Q(r),[o,l]=u.useState(!1);if(!r)return null;const n=(a==null?void 0:a.name)||M(r),p=(i=(x=a==null?void 0:a.avatar)==null?void 0:x.snapshots)==null?void 0:i.face256,h=`${Y.profileUrl}/${r}`,g=se(ce({name:a==null?void 0:a.name,hasClaimedName:a==null?void 0:a.hasClaimedName,ethAddress:(a==null?void 0:a.ethAddress)??r}));async function d(){try{await navigator.clipboard.writeText(r),l(!0),window.setTimeout(()=>l(!1),1500)}catch(_){Z(_,{flow:"copy_creator_address"})}}return e.jsxs("div",{className:"creator-card","data-testid":"creator-card",children:[p?e.jsx("img",{className:"creator-card__ava",src:p,alt:"",loading:"eager",style:{backgroundColor:g}}):e.jsx("span",{className:"creator-card__ava creator-card__ava--ph","aria-hidden":!0,style:{backgroundColor:g}}),e.jsx("h2",{className:"creator-card__name",title:n,children:n}),e.jsxs("button",{type:"button",className:"creator-card__account",onClick:()=>void d(),title:o?t("collection.copied"):t("collection.copyAddress"),"aria-label":o?t("collection.copied"):t("collection.copyAddress"),children:[e.jsx("span",{className:"creator-card__account-text",children:M(r)}),e.jsx("span",{className:"ico ico-copy creator-card__copy","aria-hidden":!0})]}),e.jsx("a",{className:"creator-card__view","data-testid":"creator-card-view",href:h,target:"_blank",rel:"noopener noreferrer",children:t("collection.viewProfile")})]})}const xe=48;function Me(){var k;const{contractAddress:r}=D(),a=O(),[o,l]=u.useState("wearable"),[n,p]=u.useState(null),[h,g]=u.useState([]),[d,x]=u.useState(""),[i,_]=u.useState(""),[v,E]=u.useState("newest"),f=d&&!Number.isNaN(Number(d))?Number(d):void 0,C=i&&!Number.isNaN(Number(i))?Number(i):void 0,R=n?me[n]:void 0,B=(F.find(s=>s.key===v)??F[0]).server,y={category:o,rarities:h.length?h:void 0,wearableCategories:R,minPriceCredits:f,maxPriceCredits:C,sortBy:B},{items:b,total:L,isLoading:N,error:w,hasNextPage:U,isFetchingNextPage:A,fetchNextPage:$}=pe(["collection-page",r,y],s=>X(r,{...y,first:xe,skip:s}),{enabled:!!r}),{data:c}=J({queryKey:["collection-meta",r],queryFn:()=>ae(r),enabled:!!r,staleTime:5*6e4}),S=(c==null?void 0:c.name)||t("collection.fallbackTitle");V({title:c==null?void 0:c.name,description:c!=null&&c.name?t("seo.collection.description",{name:c.name}):void 0});const P=(c==null?void 0:c.creator)||((k=b[0])==null?void 0:k.creator);function I(s){l(s),p(null)}function q(s){g(m=>m.includes(s)?m.filter(z=>z!==s):[...m,s])}function G(){l("wearable"),p(null),g([]),x(""),_("")}const j=!!(f||C),H=j?`${d||"0"}–${i||"∞"}`:t("filter.price"),K=o!=="wearable"||!!n||h.length>0||j;return e.jsxs("div",{className:"collection-page","data-testid":"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":t("collection.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>a("/assets"),children:t("collection.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:S})]}),e.jsx(he,{name:S,creator:P}),e.jsxs("div",{className:"browse browse--sidebar collection-page__browse","data-testid":"browse",children:[e.jsxs("aside",{className:"browse__sidebar","data-testid":"browse-sidebar",children:[e.jsx(ge,{address:P}),e.jsx(le,{category:o,subCategory:n,onCategory:I,onSub:p,title:t("collection.category"),flat:!0})]}),e.jsxs("div",{className:"browse__main",children:[!N&&b.length>0?e.jsx(oe,{items:b,source:"collection"}):null,e.jsx(ne,{rarities:h,onToggleRarity:q,sort:v,onSort:E,total:L,loading:N,anyActive:K,onClear:G,renderTrailing:s=>e.jsx(de,{panelKey:"price",label:H,active:j,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":t("collection.priceMin"),placeholder:t("collection.priceMinPlaceholder"),value:d,onChange:m=>x(m.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":t("collection.priceMax"),placeholder:t("collection.priceMaxPlaceholder"),value:i,onChange:m=>_(m.target.value)})]}),e.jsx("p",{className:"filter-pop__hint",children:t("collection.priceHint",{currency:ee.name})})]})})}),w?e.jsx(te,{message:t("collection.error")}):null,e.jsx("div",{className:"grid","data-testid":"grid",children:N?e.jsx(T,{count:15}):e.jsxs(e.Fragment,{children:[b.map(s=>e.jsx(W,{item:s},s.id)),A?e.jsx(T,{count:6}):null]})}),e.jsx(ue,{hasNextPage:U,isFetching:A,onLoadMore:()=>void $()}),!N&&!w&&b.length===0?e.jsx("p",{className:"muted",children:t("collection.empty")}):null]})]})]})}export{Me as Collection,Me as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as t}from"./react-yytiy0wi.js";import{t as s,B as f,A as k}from"./index-
|
|
1
|
+
import{r as o,j as t}from"./react-yytiy0wi.js";import{t as s,B as f,A as k}from"./index-CzmwWbz1.js";function A({title:v,items:a,onViewAll:i}){const r=o.useRef(null),[u,x]=o.useState(1),[d,g]=o.useState(0),[j,p]=o.useState(!0),[C,b]=o.useState(!1),c=o.useCallback(()=>{const l=r.current;if(!l)return;const{scrollLeft:e,scrollWidth:m,clientWidth:n}=l,_=Math.max(1,Math.ceil(m/n));x(_),g(Math.min(_-1,Math.round(e/n))),p(e<=1),b(e+n>=m-1)},[]);if(o.useEffect(()=>{c();const l=r.current;if(l)return l.addEventListener("scroll",c,{passive:!0}),window.addEventListener("resize",c),()=>{l.removeEventListener("scroll",c),window.removeEventListener("resize",c)}},[c,a.length]),a.length===0)return null;function h(l){const e=r.current;e&&e.scrollBy({left:l*e.clientWidth,behavior:"smooth"})}function w(l){const e=r.current;e&&e.scrollTo({left:l*e.clientWidth,behavior:"smooth"})}return t.jsxs("section",{className:"collection-carousel",children:[t.jsxs("div",{className:"collection-carousel__head",children:[t.jsx("h2",{className:"collection-carousel__title",children:v}),i?t.jsxs("button",{className:"collection-carousel__viewall",onClick:i,children:[s("collectionCarousel.viewAll"),t.jsx("span",{className:"ico ico-chevron collection-carousel__viewall-ico","aria-hidden":!0})]}):null]}),t.jsxs("div",{className:"collection-carousel__viewport",children:[t.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--left",onClick:()=>h(-1),"aria-label":s("collectionCarousel.scrollLeft"),disabled:j,children:t.jsx("img",{src:f,alt:"","aria-hidden":!0})}),t.jsx("div",{className:"collection-carousel__track",ref:r,children:a.map(l=>t.jsx(k,{item:l},l.id))}),t.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--right",onClick:()=>h(1),"aria-label":s("collectionCarousel.scrollRight"),disabled:C,children:t.jsx("img",{src:f,alt:"","aria-hidden":!0})})]}),u>1?t.jsx("div",{className:"collection-carousel__dots","aria-label":s("collectionCarousel.pages"),children:Array.from({length:u}).map((l,e)=>t.jsx("button",{className:`collection-carousel__dot${e===d?" is-active":""}`,"aria-label":s("collectionCarousel.goToPage",{page:e+1}),"aria-current":e===d?"true":void 0,onClick:()=>w(e)},e))}):null]})}export{A as C};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as U,j as e,L as ae,d as re,u as se,r as j}from"./react-yytiy0wi.js";import{aH as te,aI as oe,af as ce,t as a,aJ as $,F as K,d as le,j as ne,a as ie,A as de,aj as me,aK as ue,k as he}from"./index-CzmwWbz1.js";import{d as ge,g as xe,a as _e,A as pe}from"./collection-CRx0Du-v.js";import{u as Ne,L as je}from"./useStore-BYewymaj.js";import{s as D}from"./address-DrURAr9O.js";import{S as E,C as be,a as w,F as fe,c as ve,b as Ce}from"./categories-BTWuBkUd.js";import{L as I}from"./LoadMore-6Uy0vHhH.js";import{u as R}from"./useInfiniteGrid-Dg-jgtmN.js";import{E as T}from"./ErrorNotice-CKeOu_Oi.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-BPJvc5GU.js";import"./ethers-w2AslR0v.js";import"./intl-CBcMB1D2.js";function we({collection:t,cover:r,itemCount:o}){const n=U(),{contractAddress:m,name:g,creator:x}=t,N=r==null||o==null,{data:i}=te(m,N),p=r==null?(i==null?void 0:i.items)??[]:[],h=o??(i==null?void 0:i.total);function _(){n(`/collection/${m}`)}return e.jsxs("article",{className:"coll-card",role:"link",tabIndex:0,onClick:_,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),_())},children:[e.jsx("div",{className:"coll-card__media",children:r?e.jsx("img",{className:"coll-card__img","data-testid":"coll-card-img",src:r,alt:"",loading:"lazy"}):p.length>0?e.jsx(oe,{items:p,className:"coll-card__cover"}):null}),e.jsxs("div",{className:"coll-card__body",children:[e.jsx("h3",{className:"coll-card__name",title:g,children:g}),e.jsxs("div",{className:"coll-card__meta",children:[x?e.jsx(ce,{address:x,className:"coll-card__creator",linkToProfile:!0}):e.jsx("span",{className:"coll-card__creator",children:" "}),e.jsx("span",{className:"coll-card__count",children:h==null?"…":a("collectionCard.itemCount",{count:h})})]}),e.jsx("button",{className:"coll-card__view",onClick:d=>{d.stopPropagation(),_()},tabIndex:-1,children:a("collectionCard.viewCollection")})]})]})}function ke({address:t,className:r=""}){const o=$(m=>m.followed.includes(t.toLowerCase())),n=$(m=>m.toggle);return t?e.jsx("button",{type:"button",className:`btn btn--sm ${o?"btn--ghost":"btn--outline"} ${r}`.trim(),"aria-pressed":o,title:o?a("creator.unfollowTitle"):a("creator.followTitle"),onClick:()=>n(t),children:o?a("creator.following"):a("creator.follow")}):null}const Pe={website:"ico-website",twitter:"ico-twitter",discord:"ico-discord",facebook:"ico-facebook"};function Se({address:t}){var d,b;const{data:r}=K(t),{data:o}=Ne(t),n=le(l=>{var f;return(f=l.session)==null?void 0:f.address}),m=!!n&&n.toLowerCase()===t.toLowerCase(),g=(r==null?void 0:r.name)||D(t),x=(b=(d=r==null?void 0:r.avatar)==null?void 0:d.snapshots)==null?void 0:b.face256,N=(o==null?void 0:o.cover)||ge,i=o==null?void 0:o.description,p=`${ne.profileUrl}/${t}`,h=je.filter(l=>o==null?void 0:o.links[l]),_=xe(_e({name:r==null?void 0:r.name,hasClaimedName:r==null?void 0:r.hasClaimedName,ethAddress:(r==null?void 0:r.ethAddress)??t}));return e.jsxs("section",{className:"creator-hero","aria-label":`${g} storefront`,children:[e.jsxs("div",{className:"creator-hero__cover",children:[e.jsx("img",{className:"creator-hero__cover-img",src:N,alt:"",loading:"eager"}),e.jsx("div",{className:"creator-hero__scrim","aria-hidden":!0})]}),(h.length>0||m)&&e.jsxs("div",{className:"creator-hero__links",children:[h.map(l=>e.jsx("a",{className:"creator-hero__link","data-testid":"creator-hero-link",href:(o==null?void 0:o.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:a(`creator.link.${l}`),"aria-label":a(`creator.link.${l}`),children:e.jsx("span",{className:`ico ${Pe[l]}`,"aria-hidden":!0})},l)),m&&e.jsx(ae,{className:"creator-hero__link creator-hero__edit",to:"/store-settings",title:a("creator.editStore"),"aria-label":a("creator.editStore"),children:e.jsx("span",{className:"ico ico-pen","aria-hidden":!0})})]}),e.jsxs("div",{className:"creator-hero__body",children:[x?e.jsx("img",{className:"creator-hero__ava",src:x,alt:"",loading:"eager",style:{backgroundColor:_}}):e.jsx("span",{className:"creator-hero__ava creator-hero__ava--ph","aria-hidden":!0,style:{backgroundColor:_}}),e.jsxs("div",{children:[e.jsx("h2",{className:"creator-hero__name",children:g}),i?e.jsx("p",{className:"creator-hero__desc",children:i}):null]}),e.jsxs("div",{className:"creator-hero__actions",children:[e.jsx("a",{className:"creator-hero__view","data-testid":"creator-hero-view",href:p,target:"_blank",rel:"noopener noreferrer",children:a("creator.viewProfile")}),e.jsx(ke,{address:t,className:"creator-hero__follow"})]})]})]})}const B=48;function De(){const{address:t}=re(),r=U(),[o]=se(),n=o.has("collections"),{data:m}=K(t),g=(m==null?void 0:m.name)||(t?D(t):a("creator.fallbackName"));ie({title:g,description:a("seo.creator.description",{name:g})});const[x,N]=j.useState("wearable"),[i,p]=j.useState(null),[h,_]=j.useState([]),[d,b]=j.useState(""),[l,f]=j.useState(""),[P,H]=j.useState("newest"),S=d&&!Number.isNaN(Number(d))?Number(d):void 0,y=l&&!Number.isNaN(Number(l))?Number(l):void 0,O=i?Ce[i]:void 0,G=(E.find(s=>s.key===P)??E[0]).server,L={creator:t,category:x,rarities:h.length?h:void 0,wearableCategories:O,minPriceCredits:S,maxPriceCredits:y,sortBy:G},{items:v,total:Y,isLoading:C,error:A,hasNextPage:z,isFetchingNextPage:F,fetchNextPage:J}=R(["creator-listings",L],s=>me({...L,first:B,skip:s}),{enabled:!!t&&!n}),u=R(["creator-collections",t],s=>ue(t,{first:B,skip:s}).then(c=>({items:c.collections,total:c.total})),{enabled:!!t&&n});function W(s){N(s),p(null),n&&M()}function M(){const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}`:""},{replace:!0})}function Z(){if(n){M();return}const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function q(s){_(c=>c.includes(s)?c.filter(ee=>ee!==s):[...c,s])}function Q(){N("wearable"),p(null),_([]),b(""),f("")}const k=!!(S||y),V=k?`${d||"0"}–${l||"∞"}`:a("filter.price"),X=x!=="wearable"||!!i||h.length>0||k;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":a("creator.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>r("/assets"),children:a("creator.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:g})]}),t?e.jsx(Se,{address:t}):null,!n&&!C&&v.length>0?e.jsx(pe,{items:v,source:"creator"}):null,e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(be,{category:x,subCategory:i,onCategory:W,onSub:p,title:a("creator.category"),flat:!0,collections:n,onCollections:Z})}),e.jsx("div",{className:"browse__main",children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"creator-collections__bar",children:e.jsx("span",{className:"assets__count",children:u.isLoading?"…":a("creator.collectionsCount",{count:u.total})})}),u.error?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid grid--collections",children:u.isLoading?e.jsx(w,{count:9}):e.jsxs(e.Fragment,{children:[u.items.map(s=>e.jsx(we,{collection:s,itemCount:s.itemCount},s.contractAddress)),u.isFetchingNextPage?e.jsx(w,{count:6}):null]})}),e.jsx(I,{hasNextPage:u.hasNextPage,isFetching:u.isFetchingNextPage,onLoadMore:()=>void u.fetchNextPage()}),!u.isLoading&&!u.error&&u.items.length===0?e.jsx("p",{className:"muted",children:a("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(fe,{rarities:h,onToggleRarity:q,sort:P,onSort:H,total:Y,loading:C,anyActive:X,onClear:Q,renderTrailing:s=>e.jsx(ve,{panelKey:"price",label:V,active:k,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMin"),placeholder:a("creator.priceMinPlaceholder"),value:d,onChange:c=>b(c.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMax"),placeholder:a("creator.priceMaxPlaceholder"),value:l,onChange:c=>f(c.target.value)})]}),e.jsx("p",{className:"filter-pop__hint",children:a("creator.priceHint",{currency:he.name})})]})})}),A?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid",children:C?e.jsx(w,{count:15}):e.jsxs(e.Fragment,{children:[v.map(s=>e.jsx(de,{item:s},s.id)),F?e.jsx(w,{count:6}):null]})}),e.jsx(I,{hasNextPage:z,isFetching:F,onLoadMore:()=>void J()}),!C&&!A&&v.length===0?e.jsx("p",{className:"muted",children:a("creator.empty")}):null]})})]})]})}export{De as Creator,De as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a$ as U,b0 as Ue,Q as C,b1 as qe,b2 as Ye,a0 as Qe,b3 as Ze,aO as Je,P as R,aT as K,aS as Te,b4 as a,b5 as Xe,b6 as Le,T as et,aZ as tt}from"./index-
|
|
1
|
+
import{a$ as U,b0 as Ue,Q as C,b1 as qe,b2 as Ye,a0 as Qe,b3 as Ze,aO as Je,P as R,aT as K,aS as Te,b4 as a,b5 as Xe,b6 as Le,T as et,aZ as tt}from"./index-CzmwWbz1.js";import{R as rt,g as ot}from"./getOverlayAlpha-Ttcml9GY.js";import{j as T,r as y}from"./react-yytiy0wi.js";import{u as nt,a as Be}from"./useTheme-Ckn40RaY.js";function ne(r){const o=Ue(r);return r!==o&&o.styles?(o.styles.match(/^@layer\s+[^{]*$/)||(o.styles=`@layer global{${o.styles}}`),o):r}function at({styles:r,themeId:o,defaultTheme:n={}}){const i=nt(n),s=o&&i[o]||i;let l=typeof r=="function"?r(s):r;return s.modularCssLayers&&(Array.isArray(l)?l=l.map(d=>ne(typeof d=="function"?d(s):d)):l=ne(l)),T.jsx(U,{styles:l})}const Ee=y.createContext(null);function se(){return y.useContext(Ee)}const it=typeof Symbol=="function"&&Symbol.for,st=it?Symbol.for("mui.nested"):"__THEME_NESTED__";function lt(r,o){return typeof o=="function"?o(r):C({},r,o)}function ct(r){const{children:o,theme:n}=r,i=se(),s=y.useMemo(()=>{const l=i===null?n:lt(i,n);return l!=null&&(l[st]=i!==null),l},[n,i]);return T.jsx(Ee.Provider,{value:s,children:o})}function dt(r){const o=Be(),n=qe()||"",{modularCssLayers:i}=r;let s="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!i||o!==null?s="":typeof i=="string"?s=i.replace(/mui(?!\.)/g,s):s=`@layer ${s};`,Ye(()=>{const l=document.querySelector("head");if(!l)return;const d=l.firstChild;if(s){var m;if(d&&(m=d.hasAttribute)!=null&&m.call(d,"data-mui-layer-order")&&d.getAttribute("data-mui-layer-order")===n)return;const S=document.createElement("style");S.setAttribute("data-mui-layer-order",n),S.textContent=s,l.prepend(S)}else{var f;(f=l.querySelector(`style[data-mui-layer-order="${n}"]`))==null||f.remove()}},[s,n]),s?T.jsx(at,{styles:s}):null}const $e={};function xe(r,o,n,i=!1){return y.useMemo(()=>{const s=r&&o[r]||o;if(typeof n=="function"){const l=n(s),d=r?C({},o,{[r]:l}):l;return i?()=>d:d}return r?C({},o,{[r]:n}):C({},o,n)},[r,o,n,i])}function ut(r){const{children:o,theme:n,themeId:i}=r,s=Be($e),l=se()||$e,d=xe(i,s,n),m=xe(i,l,n,!0),f=d.direction==="rtl",S=dt(d);return T.jsx(ct,{theme:m,children:T.jsx(Qe.Provider,{value:d,children:T.jsx(rt,{value:f,children:T.jsxs(Ze,{value:d==null?void 0:d.components,children:[S,o]})})})})}const le="mode",ce="color-scheme",Ie="data-color-scheme";function mt(r){const{defaultMode:o="light",defaultLightColorScheme:n="light",defaultDarkColorScheme:i="dark",modeStorageKey:s=le,colorSchemeStorageKey:l=ce,attribute:d=Ie,colorSchemeNode:m="document.documentElement",nonce:f}=r||{};return T.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?f:"",dangerouslySetInnerHTML:{__html:`(function() {
|
|
2
2
|
try {
|
|
3
3
|
var mode = localStorage.getItem('${s}') || '${o}';
|
|
4
4
|
var colorScheme = '';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r}from"./react-yytiy0wi.js";function a({message:e,className:o,testId:t}){return e?r.jsxs("p",{className:o?`error-notice ${o}`:"error-notice","data-testid":t,role:"alert",children:[r.jsx("svg",{className:"error-notice__ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:r.jsx("path",{d:"M12 2 1 21h22L12 2zm0 6a1 1 0 0 1 1 1v5a1 1 0 1 1-2 0V9a1 1 0 0 1 1-1zm0 8.25a1.25 1.25 0 1 1 0 2.5 1.25 1.25 0 0 1 0-2.5z"})}),r.jsx("span",{className:"error-notice__msg",children:e})]}):null}export{a as E};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-
|
|
1
|
+
import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-DCqZCe_f.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-s1UJ3WrX.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as T,u as V,r as a,j as e}from"./react-yytiy0wi.js";import{a as D,t,d as O,u as K,b as u,k as n,z as A,w as L,C as Y,r as $}from"./index-CzmwWbz1.js";import{R as G}from"./resume-buy-Bf0zIH7y.js";import{R as q}from"./cart-checkout-ClRVRUn2.js";import{p as z,c as Q,i as W,C as J}from"./payments-DOnM9_yY.js";import{C as X}from"./CircularProgress-DYIOpTqD.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-BPJvc5GU.js";import"./ethers-w2AslR0v.js";import"./intl-CBcMB1D2.js";const C="https://cdn.decentraland.org/@dcl/shop/0.1.0-29783861565.commit-b83d609/assets/pack-chips--HnOpf5U.webp",ee="https://cdn.decentraland.org/@dcl/shop/0.1.0-29783861565.commit-b83d609/assets/credit-coin-CmcTCd5i.webp",se="data:image/svg+xml,%3csvg%20width='60'%20height='60'%20viewBox='0%200%2060%2060'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='60'%20height='60'%20rx='30'%20fill='%2334CE77'/%3e%3cpath%20d='M21.6583%2046.1067L11.4656%2036.0591C10.1688%2034.829%2010.1905%2032.7207%2011.4769%2031.4622L13.6868%2029.3591C14.9732%2028.1006%2017.1615%2028.1058%2018.4582%2029.3359L23.8747%2034.6197L41.9704%2015.6527C43.2568%2014.3942%2045.4291%2014.2093%2046.7258%2015.4394L48.8765%2017.3628C50.1732%2018.5929%2050.3491%2020.6844%2049.0626%2021.9429L26.6112%2045.8766C25.1433%2047.342%2022.955%2047.3368%2021.6583%2046.1067Z'%20fill='%23FCFCFC'/%3e%3c/svg%3e",te="data:image/svg+xml,%3csvg%20width='61'%20height='61'%20viewBox='0%200%2061%2061'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M30.5%2061C47.3447%2061%2061%2047.3447%2061%2030.5C61%2013.6553%2047.3447%200%2030.5%200C13.6553%200%200%2013.6553%200%2030.5C0%2047.3447%2013.6553%2061%2030.5%2061Z'%20fill='url(%23gc_paint0)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12.2001%2054.8997C17.2935%2058.7274%2023.6375%2060.9997%2030.5%2060.9997C37.3625%2060.9997%2043.7065%2058.7274%2048.8%2054.8997H12.2001Z'%20fill='%23FF2D55'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M6.10013%2048.7997C7.83863%2051.1024%209.89738%2053.1612%2012.2001%2054.8997H48.8001C51.1029%2053.1612%2053.1616%2051.1024%2054.9001%2048.7997H6.10013Z'%20fill='%23FFA25A'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M40.9158%2042.6998H2.5468C3.4923%2044.8805%204.69705%2046.924%206.10005%2048.7997H40.9311V42.6998H40.9158Z'%20fill='%23FFC95B'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M21.6094%2019.8247V42.6997H40.6719L21.6094%2019.8247Z'%20fill='url(%23gc_paint1)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M2.5468%2042.6997H21.6093V19.8248L2.5468%2042.6997Z'%20fill='%23FCFCFC'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M40.9158%2032.025V48.8H54.9L40.9158%2032.025Z'%20fill='url(%23gc_paint2)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M26.9467%2048.8H40.9157V32.025L26.9467%2048.8Z'%20fill='%23FCFCFC'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M40.9158%2027.4497C45.127%2027.4497%2048.5408%2024.0359%2048.5408%2019.8247C48.5408%2015.6136%2045.127%2012.1998%2040.9158%2012.1998C36.7046%2012.1998%2033.2908%2015.6136%2033.2908%2019.8247C33.2908%2024.0359%2036.7046%2027.4497%2040.9158%2027.4497Z'%20fill='%23FFC95B'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M21.6092%2015.2497C23.7148%2015.2497%2025.4217%2013.5428%2025.4217%2011.4372C25.4217%209.33166%2023.7148%207.62475%2021.6092%207.62475C19.5036%207.62475%2017.7967%209.33166%2017.7967%2011.4372C17.7967%2013.5428%2019.5036%2015.2497%2021.6092%2015.2497Z'%20fill='%23FFC95B'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='gc_paint0'%20x1='30.5'%20y1='-12.6335'%20x2='-12.6335'%20y2='30.5'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FF2D55'/%3e%3cstop%20offset='1'%20stop-color='%23FFBC5B'/%3e%3c/linearGradient%3e%3clinearGradient%20id='gc_paint1'%20x1='21.6029'%20y1='19.8247'%20x2='21.6029'%20y2='42.6997'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23A524B3'/%3e%3cstop%20offset='1'%20stop-color='%23FF2D55'/%3e%3c/linearGradient%3e%3clinearGradient%20id='gc_paint2'%20x1='40.9111'%20y1='32.025'%20x2='40.9111'%20y2='48.8'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23A524B3'/%3e%3cstop%20offset='1'%20stop-color='%23FF2D55'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",_=W()?"mock":"stripe",re={pack_5:C,pack_10:C,pack_25:C,pack_50:C},ce="https://docs.decentraland.org";function I(l){const s=l;if((s==null?void 0:s.name)==="AbortError")return t("getCredits.errorCanceled");const p=((s==null?void 0:s.message)??"").toLowerCase();return p.includes("sign in")?t("getCredits.errorSignIn",{currency:n.name}):p.includes("timed out")?t("getCredits.errorTimeout",{currency:n.name}):t("getCredits.errorGeneric")}function _e(){D({title:t("nav.getCredits",{currency:n.name}),noindex:!0});const l=T(),{session:s,signIn:p}=O(),f=K(),[v,w]=V(),[g,d]=a.useState("select"),[i,S]=a.useState(null),[F,E]=a.useState(null),[P,m]=a.useState(null),[H,j]=a.useState(!1),N=a.useRef(null);a.useEffect(()=>()=>{var r;return(r=N.current)==null?void 0:r.abort()},[]);const B=a.useCallback(()=>{w(r=>{const c=new URLSearchParams(r);return c.delete("order"),c.delete("canceled"),c},{replace:!0})},[w]),y=a.useCallback(async r=>{d("processing");const c=new AbortController;N.current=c;try{const o=await z(r,{signal:c.signal,address:s==null?void 0:s.address,identity:s==null?void 0:s.identity});if(o.status==="credited"){const x=o.creditsGranted??(i==null?void 0:i.credits)??0;E(x>0?x:null),d("success"),u("Shop Completed Buy Credits",{order_id:r,pack_usd:(i==null?void 0:i.usd)??null,credits:x>0?x:null,provider:_}),f.invalidateQueries({queryKey:["usd-balance"]});try{if(sessionStorage.getItem(q)){l("/cart",{state:{resumeCheckout:!0}});return}}catch{}try{const R=sessionStorage.getItem(G);if(R){sessionStorage.removeItem(G);const h=JSON.parse(R),M=h.tokenId??h.itemId;if(h.contractAddress&&M){l(`/item/${h.contractAddress}/${M}`,{state:{item:h,resumeBuy:!0}});return}}}catch{}}else o.status==="pending"?(u("Shop Buy Credits Pending",{step:"grant",pack_usd:(i==null?void 0:i.usd)??null}),f.invalidateQueries({queryKey:["usd-balance"]}),d("pending")):(u("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(i==null?void 0:i.usd)??null}),m(o.error??t("getCredits.errorGrant",{currency:n.name})),d("error"))}catch(o){A(o,{flow:"get_credits",step:"grant",order_id:r}),u("Shop Buy Credits Failed",{step:"grant",error_code:L(o),pack_usd:(i==null?void 0:i.usd)??null}),m(I(o)),d("error")}},[i,s,f,l]),U=a.useCallback(async r=>{if(!s){p();return}m(null),j(!1),S(r),d(_==="mock"?"processing":"redirecting"),u("Shop Started Buy Credits",{pack_usd:r.usd,credits:r.credits,provider:_});try{const c=await Q(r.id,{address:s.address,identity:s.identity});if(c.mock)y(c.orderId);else if(c.url)u("Shop Redirected To Stripe",{order_id:c.orderId,pack_usd:r.usd,credits:r.credits}),window.location.href=c.url;else throw new Error("Checkout did not return a redirect url")}catch(c){A(c,{flow:"get_credits",step:"checkout",provider:_}),u("Shop Buy Credits Failed",{step:"checkout",error_code:L(c),pack_usd:r.usd}),m(I(c)),d("error")}},[s,p,y]),b=a.useRef(!1);a.useEffect(()=>{if(b.current)return;const r=v.get("order");if(v.get("canceled")!=null){b.current=!0,u("Shop Buy Credits Cancelled",{order_id:r,provider:_}),B(),j(!0),d("select");return}r&&(d("processing"),s&&(b.current=!0,B(),y(r)))},[v,s]);function k(){var r;(r=N.current)==null||r.abort(),d("select"),S(null),E(null),m(null),j(!1)}const Z=g==="select";return e.jsxs("div",{className:"getcredits",children:[Z&&e.jsxs("header",{className:"getcredits__head",children:[e.jsx("h1",{className:"getcredits__title",children:t("getCredits.title",{currency:n.name})}),e.jsxs("p",{className:"getcredits__sub",children:[t("getCredits.subtitle",{currency:n.name})," ",e.jsxs("a",{className:"getcredits__learn",href:ce,target:"_blank",rel:"noreferrer",children:[t("getCredits.learnMore"),e.jsxs("svg",{className:"getcredits__learn-ico",viewBox:"0 0 13 13","aria-hidden":!0,fill:"none",children:[e.jsx("path",{d:"M4 2h7v7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M11 2 2 11",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]})]})]})]}),g==="select"&&e.jsxs(e.Fragment,{children:[H&&e.jsx("p",{className:"getcredits__note muted",role:"status",children:t("getCredits.canceledNote")}),e.jsx(ie,{onSelect:r=>void U(r)})]}),g==="redirecting"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(X,{size:32}),e.jsx("p",{className:"muted",children:t("getCredits.redirecting")})]}),g==="processing"&&e.jsxs("div",{className:"gc-processing",role:"status","aria-live":"polite",children:[e.jsx("img",{className:"gc-processing__logo",src:te,alt:"",width:61,height:61}),e.jsxs("div",{className:"gc-processing__body",children:[e.jsxs("p",{className:"gc-processing__title",children:[e.jsx("strong",{children:t("getCredits.processing")}),"…"]}),e.jsxs("div",{className:"gc-progress","aria-hidden":!0,children:[e.jsx("span",{className:"gc-progress__track",children:e.jsx("span",{className:"gc-progress__fill"})}),e.jsx("span",{className:"gc-progress__count",children:"1/1"})]})]})]}),g==="success"&&e.jsxs("div",{className:"gc-success",role:"status","aria-live":"polite",children:[e.jsxs("div",{className:"gc-banner",children:[e.jsx("img",{className:"gc-banner__icon",src:se,alt:"",width:60,height:60}),e.jsxs("p",{className:"gc-banner__text",children:[e.jsx("strong",{children:t("getCredits.successTitle")})," ",t("getCredits.successBody",{currency:n.name})]})]}),F!=null&&e.jsx("div",{className:"gc-credits",children:e.jsxs("div",{className:"gc-credits__row",children:[e.jsx("img",{className:"gc-credits__coin",src:ee,alt:"",width:93,height:93}),e.jsxs("p",{className:"gc-credits__text",children:[e.jsx(Y,{className:"gc-credits__diamond"}),e.jsxs("span",{children:[e.jsx("strong",{className:"gc-credits__amount",children:t("getCredits.creditsAmount",{credits:F,currency:n.name})})," ",e.jsx("span",{className:"gc-credits__added",children:t("getCredits.creditsAdded")})]})]})]})}),e.jsxs("div",{className:"gc-actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:k,children:t("getCredits.buyMore",{currency:n.name})}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/assets"),children:t("getCredits.startShopping")})]})]}),g==="pending"&&e.jsxs("div",{className:"gc-status",role:"status","aria-live":"polite",children:[e.jsx("p",{className:"gc-status__title",children:t("getCredits.pendingTitle",{currency:n.name})}),e.jsx("p",{className:"muted",children:t("getCredits.pendingBody")}),e.jsxs("div",{className:"gc-status__actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/assets"),children:t("getCredits.startShopping")}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:k,children:t("getCredits.done")})]})]}),g==="error"&&e.jsxs("div",{className:"gc-status gc-status--err",role:"alert",children:[e.jsx("p",{className:"gc-status__title",children:t("getCredits.errorTitle")}),e.jsx("p",{className:"error",children:P}),e.jsx("div",{className:"gc-status__actions",children:e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:k,children:t("getCredits.tryAgain")})})]})]})}function ie({onSelect:l}){return e.jsx("div",{className:"packs",children:J.map(s=>e.jsxs("button",{type:"button",className:`pack${s.bestValue?" pack--best":""}`,"data-testid":"pack",onClick:()=>l(s),"aria-label":t("getCredits.packAria",{amount:$(s.credits),usd:s.usd}),children:[s.bestValue&&e.jsx("span",{className:"pack__badge",children:t("getCredits.packBadge")}),e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"pack__label",children:t("getCredits.creditsAmount",{credits:s.credits,currency:n.name})}),e.jsx("span",{className:"pack__art",children:e.jsx("img",{src:re[s.id]??C,alt:"",loading:"lazy"})}),e.jsx("span",{className:"pack__cta-wrap",children:e.jsxs("span",{className:"pack__cta",children:["$",s.usd.toFixed(2)]})})]})]},s.id))})}export{_e as GetCredits,_e as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-
|
|
1
|
+
import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-DToUml_I.js";import{d as g,r as v}from"./index-s1UJ3WrX.js";import{C as c}from"./ConstantsUtil-BbIzv5xN.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-DCqZCe_f.js";import{au as y}from"./NetworkUtil-CLSFaUe_.js";const b=g`
|
|
2
2
|
:host {
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as F,r as g,j as e,L as Q}from"./react-yytiy0wi.js";import{t as s,k as S,C as L,b as R,z as E,a as K,d as $,u as P,g as U,ac as W}from"./index-CzmwWbz1.js";import{i as B,R as O,f as z}from"./import-sr6kRaqB.js";import{s as Y}from"./wallet-kind-B9P1TeIH.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-BPJvc5GU.js";import"./ethers-w2AslR0v.js";import"./intl-CBcMB1D2.js";import"./buy-BlHiSc1W.js";import"./trade-encoding-8RrYE6hq.js";import"./index-HN6Rk25C.js";import"./mana-rate-D42fK9sf.js";function G({queue:n,session:C,onClose:j,onDone:h}){const N=F(),d=Y(C.providerType),[m,f]=g.useState(()=>n.map(()=>"pending")),[v,w]=g.useState("running"),T=g.useRef(!1);g.useEffect(()=>{if(T.current)return;T.current=!0;let t=!1;return(async()=>{for(let r=0;r<n.length;r++){if(t)return;f(p=>p.map((u,o)=>o===r?"active":u));try{await B(n[r].item,n[r].priceCredits,C),R("Shop Migrated Listing",{item_id:n[r].item.itemId??n[r].item.oldTradeId??null,contract_address:n[r].item.contractAddress,new_price_credits:n[r].priceCredits,new_price_usd:n[r].priceCredits/10}),t||f(p=>p.map((u,o)=>o===r?"done":u))}catch(p){if(p instanceof O)E(p,{flow:"import_listing",step:"relist",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(u=>u.map((o,k)=>k===r?"unlisted":o));else{const u=p,o=u.code===4001||/reject|denied|cancel/i.test(u.message??"");o||E(p,{flow:"import_listing",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(k=>k.map((a,l)=>l===r?o?"skipped":"failed":a))}}}t||w("finished")})(),()=>{t=!0}},[]);const _=m.filter(t=>t==="done").length,b=m.findIndex(t=>t==="active"),x=Math.round(m.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function y(){h(),j()}if(v==="finished"){const t=m.filter(r=>r==="skipped"||r==="failed").length,c=m.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:_>0?s("migrate.successTitle"):s("migrate.nothingTitle")}),e.jsxs("p",{className:"muted",style:{margin:0},children:[_>0?s("migrate.listedSummary",{count:_,currency:S.name}):s("migrate.noneListed"),t>0?" "+s("migrate.skippedSummary",{count:t}):"",c>0?" "+s("migrate.unlistedSummary",{count:c}):""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:y,children:s("getCredits.done")}),c>0?e.jsx("button",{className:"btn btn--purple",onClick:()=>{h(),j(),N("/my-assets")},children:s("migrate.goToMyAssets")}):_>0?e.jsx("button",{className:"btn btn--purple",onClick:()=>{h(),j(),N("/assets")},children:s("migrate.viewInShop")}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate","data-testid":"modal",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:s("migrate.listingTitle")}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[d?s("migrate.subConfirm"):s("migrate.subManaged")," ",b>=0?s("migrate.progressCount",{current:b+1,total:n.length}):""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${x}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,c)=>e.jsxs("li",{className:`migrate__row migrate__row--${m[c]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||s("migrate.itemFallback")}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(L,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:m[c]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",d?s("migrate.statusConfirm"):s("migrate.statusAdding")]}):m[c]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):m[c]==="skipped"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusSkipped")}):m[c]==="failed"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusFailed")}):m[c]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:s("migrate.unlistedTooltip"),children:s("migrate.statusUnlisted")}):e.jsx("span",{className:"migrate__wait",children:s("migrate.statusWaiting")})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:d?s("migrate.hintConfirm"):s("migrate.hintManaged")})]})})}const H=[{key:"creations",title:"importListings.creations.title",sub:"importListings.creations.sub"},{key:"owned",title:"importListings.owned.title",sub:"importListings.owned.sub"}];function ne(){K({title:s("seo.import.title"),noindex:!0});const{session:n,signIn:C,restore:j}=$(),h=P(),N=n==null?void 0:n.address;g.useEffect(()=>{j()},[j]);const{data:d,isLoading:m}=U({queryKey:["importable",N],queryFn:()=>z(N),enabled:!!N}),[f,v]=g.useState({}),[w,T]=g.useState(new Set),[_,b]=g.useState(null),x=g.useMemo(()=>[...(d==null?void 0:d.creations)??[],...(d==null?void 0:d.owned)??[]],[d]);g.useEffect(()=>{x.length&&v(a=>{const l={...a};for(const i of x)l[i.oldTradeId]==null&&(l[i.oldTradeId]=i.suggestedCredits);return l})},[x]);const y=a=>!w.has(a),t=a=>f[a.oldTradeId]??a.suggestedCredits,c=x.filter(a=>y(a.oldTradeId)),r=c.reduce((a,l)=>a+t(l),0);function p(a,l){const i=l.replace(/[^\d]/g,"");v(I=>({...I,[a]:i===""?0:parseInt(i,10)}))}function u(a){T(l=>{const i=new Set(l);return i.has(a)?i.delete(a):i.add(a),i})}function o(a){return a.map(l=>({item:l,priceCredits:Math.max(1,t(l))}))}function k(){h.invalidateQueries({queryKey:["importable"]}),h.invalidateQueries({queryKey:["unified-listings"]}),h.invalidateQueries({queryKey:["my-assets"]}),h.invalidateQueries({queryKey:["collection-sale-state"]}),W.success(s("importListings.toastUpdated"))}return n?!m&&x.length===0?e.jsxs("div",{className:"imp-empty",children:[e.jsx("span",{className:"imp-empty__ico","aria-hidden":!0,children:"✨"}),e.jsx("h1",{className:"imp-empty__title",children:s("importListings.emptyTitle")}),e.jsx("p",{className:"muted",children:s("importListings.emptyBody")}),e.jsx(Q,{className:"btn btn--purple",to:"/my-assets",children:s("importListings.goToMyAssets")})]}):e.jsxs("div",{className:"imp",children:[e.jsxs("header",{className:"imp__head",children:[e.jsx("span",{className:"imp__eyebrow",children:s("importListings.eyebrow")}),e.jsxs("h1",{className:"imp__title",children:[s("importListings.titleLead")," ",e.jsx("span",{className:"imp__grad",children:s("importListings.titleAccent")})]}),e.jsx("p",{className:"imp__lede",children:s("importListings.lede",{currency:S.name})})]}),e.jsxs("div",{className:"imp__ratebar",children:[e.jsx(L,{className:"ccy-mark imp__diamond"})," ",s("importListings.rate",{currency:S.nameSingular})]}),m?e.jsx("div",{className:"imp__list",children:Array.from({length:4}).map((a,l)=>e.jsx("div",{className:"imp-row imp-row--skeleton"},l))}):H.map(a=>{const l=(d==null?void 0:d[a.key])??[];return l.length===0?null:e.jsxs("section",{className:"imp__section",children:[e.jsxs("div",{className:"imp__section-head",children:[e.jsx("h2",{className:"imp__section-title",children:s(a.title)}),e.jsx("span",{className:"imp__section-sub",children:s(a.sub)})]}),e.jsx("div",{className:"imp__list",children:l.map(i=>{const I=t(i),A=I!==i.suggestedCredits;return e.jsxs("article",{className:`imp-row${y(i.oldTradeId)?"":" is-off"}`,children:[e.jsx("input",{type:"checkbox",className:"imp-check",checked:y(i.oldTradeId),onChange:()=>u(i.oldTradeId),"aria-label":s("importListings.includeItem",{name:i.name})}),e.jsx("div",{className:"imp-thumb",children:i.thumbnail?e.jsx("img",{src:i.thumbnail,alt:""}):null}),e.jsxs("div",{className:"imp-meta",children:[e.jsx("div",{className:"imp-name",title:i.name,children:i.name||s("importListings.itemFallback")}),e.jsx("span",{className:"imp-chip",children:i.rarity})]}),e.jsxs("div",{className:"imp-price",children:[e.jsxs("div",{className:"imp-price__field",children:[e.jsx(L,{className:"ccy-mark imp-price__diamond"}),e.jsx("input",{className:"imp-price__input","data-testid":"imp-price-input",inputMode:"numeric",value:I.toLocaleString(),onChange:M=>p(i.oldTradeId,M.target.value),"aria-label":s("importListings.priceAria",{currency:S.name,name:i.name})})]}),e.jsxs("div",{className:"imp-price__sub",children:[e.jsxs("span",{children:["$",(I*.1).toFixed(2)]}),A?e.jsxs("button",{className:"imp-price__reset",onClick:()=>v(M=>({...M,[i.oldTradeId]:i.suggestedCredits})),children:[s("importListings.resetTo")," ",e.jsx(L,{className:"ccy-mark"}),i.suggestedCredits.toLocaleString()]}):null]})]}),e.jsx("div",{className:"imp-action",children:e.jsx("button",{className:"btn btn--sm imp-row__list",disabled:!y(i.oldTradeId),onClick:()=>b(o([i])),children:s("importListings.list")})})]},i.oldTradeId)})})]},a.key)}),e.jsx("div",{className:"imp-dock",children:e.jsxs("div",{className:"imp-dock__inner",children:[e.jsxs("div",{className:"imp-dock__summary",children:[e.jsxs("div",{className:"imp-dock__total",children:[e.jsx(L,{className:"ccy-mark imp__diamond"})," ",r.toLocaleString()]}),e.jsx("div",{className:"imp-dock__sub",children:s("importListings.selectedSummary",{count:c.length,usd:(r*.1).toFixed(2)})})]}),e.jsx("span",{className:"imp-dock__spacer"}),e.jsx("button",{className:"btn btn--purple imp-dock__cta",disabled:c.length===0,onClick:()=>b(o(c)),children:s("importListings.listAll",{count:c.length})})]})}),_&&n?e.jsx(G,{queue:_,session:n,onClose:()=>b(null),onDone:k}):null]}):e.jsxs("div",{className:"imp-empty",children:[e.jsx("span",{className:"imp-empty__ico","aria-hidden":!0,children:"📦"}),e.jsx("h1",{className:"imp-empty__title",children:s("importListings.signInTitle")}),e.jsx("p",{className:"muted",children:s("importListings.signInBody")}),e.jsx("button",{className:"btn btn--purple",onClick:()=>C(),children:s("storeSettings.signIn")})]})}export{ne as ImportListings};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-nj2GyU5U.js","assets/react-yytiy0wi.js","assets/dcl-schemas-BICTSpB5.js","assets/index-CzmwWbz1.js","assets/sentry-BPJvc5GU.js","assets/ethers-w2AslR0v.js","assets/intl-CBcMB1D2.js","assets/index-DvbMYtAp.css","assets/emotion-styled.browser.esm-Ca1eN6j6.js","assets/useTheme-Ckn40RaY.js","assets/CircularProgress-DYIOpTqD.js","assets/index-DOoENNk5.js","assets/useTheme-DLZ3E7iB.js","assets/CssVarsProvider-DfFti9_A.js","assets/getOverlayAlpha-Ttcml9GY.js","assets/index-B6W_ISMa.js","assets/colors-LINLm1ux.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as se,r as m,j as e,d as Se,b as Pe,L as Ee}from"./react-yytiy0wi.js";import{d as te,o as Fe,u as Le,t as s,ah as De,l as Te,m as Be,v as Re,q as J,b as z,w as me,x as ee,ai as $e,z as ue,C as M,ad as Z,_ as ae,F as We,I as Ve,H as qe,ar as Oe,W as ze,j as fe,as as Ke,at as Ue,ae as _e,c as he,g as O,au as Ge,av as He,aw as Qe,ax as Ye,ay as Je,ak as Ze,a as Xe,az as ea,aA as aa,aB as sa,af as ta,aC as be,aD as ia,an as ra,aE as la,aF as da,ao as na,aG as ca}from"./index-CzmwWbz1.js";import{d as $}from"./dcl-schemas-BICTSpB5.js";import{b as pe}from"./buy-BlHiSc1W.js";import{g as oa,b as ma,w as ua,S as _a,G as ha}from"./buy-gasless-aP_Keozx.js";import{C as ba,c as pa}from"./payments-DOnM9_yY.js";import{R as ye}from"./resume-buy-Bf0zIH7y.js";import{a as ya,f as xe}from"./errors-uwUVgVvx.js";import{E as xa}from"./ErrorNotice-CKeOu_Oi.js";import{C as ja}from"./CircularProgress-DYIOpTqD.js";import{u as va,M as fa}from"./MarketCheckout-Kp8KKjmU.js";import{s as Na}from"./address-DrURAr9O.js";import{C as ga}from"./CollectionCarousel-CoUEKAXy.js";import"./sentry-BPJvc5GU.js";import"./ethers-w2AslR0v.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-8RrYE6hq.js";import"./index-HN6Rk25C.js";import"./mana-rate-D42fK9sf.js";const R=ba.slice(0,3);function wa({item:r,onClose:o,resume:t=!1}){var I,H;const{session:d}=te(),{data:n}=Fe(d),b=Le(),x=se(),[_,l]=m.useState("loading"),[j,a]=m.useState(null),[v,P]=m.useState(""),[f,L]=m.useState(r.priceCredits),[C,g]=m.useState(null),N=m.useRef(null),W=(C==null?void 0:C.credits)??f,k=(n==null?void 0:n.credits)??0;m.useEffect(()=>{let c=!1;if(!d){l("error"),a(s("buyModal.signInToCheckout"));return}const y=u=>{const h=u-((n==null?void 0:n.credits)??0),p=R.find(A=>A.credits>=h)??R[R.length-1];P(p.id),z("Shop Buy Credits Prompted",{from:"item_checkout",credits_needed:u,credits_balance:(n==null?void 0:n.credits)??0,shortfall:Math.max(0,h)}),l("nofunds")};return(async()=>{var u,h;try{const p=await De(r);if(!p)throw new Error("not for sale");if(Te(p,d.address))throw new Error("You can't buy your own listing.");const A=Be((h=(u=p.received)==null?void 0:u[0])==null?void 0:h.amount);if(!Number.isFinite(A)||A<=0)throw new Error("price unavailable");const T=Math.ceil(A/10);if(c)return;if(L(T),n!=null&&n.credits<T){y(T);return}try{const{credit:E,maxCreditedValue:V,usdCents:B}=await Re(d.identity,A,p.id);if(c){J(d.identity,[E.id]).catch(()=>{});return}N.current=E.id;const w=Math.ceil(B/10);L(w);const q={trade:p,credit:E,maxCreditedValue:V,usdCents:B,credits:w};g(q),t?K(q):l("ready")}catch(E){if(c)return;if(ya(E)){y(T);return}throw E}}catch(p){if(c)return;z(ee(p)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:me(p)}),l("error"),a(xe(p,s("buyModal.error.generic"),{sale:!0}))}})(),()=>{c=!0,N.current&&d&&(J(d.identity,[N.current]).catch(()=>{}),N.current=null)}},[]);async function K(c=C){if(!d||!c)return;l("processing"),a(null);let y=!1;try{const u={trade:c.trade,buyer:d.address,signer:d.signer,credits:[c.credit],maxCreditedValue:c.maxCreditedValue};let h;if(oa())try{h=await ma(u),await ua(h),y=!0}catch(p){if(p instanceof _a)y=!0;else if(p instanceof ha)h=await pe(u);else throw p}else h=await pe(u);N.current=null,z("Shop Completed Purchase",{...$e([r]),payment_type:"credits",no_crypto_step:y,transaction_hash:h??null}),b.invalidateQueries({queryKey:["usd-balance"]}),l("complete")}catch(u){ee(u)||ue(u,{flow:"buy",step:"submit",gasless:y}),J(d.identity,[c.credit.id]).catch(()=>{}),N.current=null,z(ee(u)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:me(u)}),b.invalidateQueries({queryKey:["usd-balance"]}),a(xe(u,s("buyModal.error.generic"),{sale:!0})),l("error")}}async function U(){if(!(!v||!d)){try{sessionStorage.setItem(ye,JSON.stringify(r))}catch{}C&&J(d.identity,[C.credit.id]).catch(()=>{}),N.current=null,l("loading");try{const c=await pa(v,{address:d.address,identity:d.identity});if(c.url){window.location.href=c.url;return}x("/credits")}catch(c){ue(c,{flow:"buy_credits_and_item"});try{sessionStorage.removeItem(ye)}catch{}a(s("buyModal.error.creditsCheckout")),l("error")}}}const G=_==="processing",D=_==="complete"?s("buyModal.titleComplete"):_==="nofunds"?s("buyModal.titleNoFunds"):s("buyModal.titleBuy");return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":s("buyModal.dialogAria",{name:r.name}),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:G?void 0:o,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${_==="processing"||_==="loading"?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:D}),!G&&e.jsx("button",{className:"buy-modal__x",onClick:o,"aria-label":s("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:_==="nofunds"?s("buyModal.dclBalance"):s("buyModal.myCreditsBalance")}),e.jsx(M,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:Z(k)})]})]}),_==="loading"&&e.jsx("div",{className:"buy-modal__body buy-modal__processing",children:e.jsx(ja,{size:44})}),_==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(xa,{message:j}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:o,children:s("buyModal.close")})})]}),_==="nofunds"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:"buy-modal__warning-ico",children:[e.jsx("path",{d:"M12 3L2 20h20L12 3z",fill:"none",stroke:"#691fa9",strokeWidth:"1.8",strokeLinejoin:"round"}),e.jsx("path",{d:"M12 9v5",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"17",r:"1.1",fill:"#691fa9"})]}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:s("buyModal.insufficientFunds")})," ",s("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:s("buyModal.warningCreditsAmount",{count:Math.max(0,W-k)})})," ",s("buyModal.warningToPurchase",{count:1})]})]}),e.jsx(je,{item:r,priceCredits:W}),e.jsx("div",{className:"buy-modal__packs",children:R.map(c=>{const y=c.credits,u=c.id===v;return e.jsxs("button",{className:`buy-modal__pack${u?" buy-modal__pack--on":""}`,onClick:()=>P(c.id),children:[e.jsx(M,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:Z(y)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",c.usd.toFixed(2),")"]})]},c.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(M,{className:"buy-modal__total-ico"}),e.jsx("span",{children:Z(((I=R.find(c=>c.id===v))==null?void 0:I.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",(((H=R.find(c=>c.id===v))==null?void 0:H.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:o,children:s("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:()=>void U(),children:s("buyModal.buy")})]})]}),_==="ready"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(je,{item:r,priceCredits:W}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient buy-modal__btn--full",onClick:()=>void K(),children:s("buyModal.buy")})})]}),_==="processing"&&e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:"/icon-192.png",alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:t?s("buyModal.completingPurchase"):s("buyModal.completingTransaction")}),e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]}),_==="complete"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__success",children:[e.jsxs("svg",{viewBox:"0 0 64 64",width:"64",height:"64","aria-hidden":!0,children:[e.jsx("circle",{cx:"32",cy:"32",r:"32",fill:"#34ce74"}),e.jsx("path",{d:"M20 33l8 8 16-18",fill:"none",stroke:"#fff",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsxs("p",{className:"buy-modal__success-text",children:[e.jsx("b",{children:s("getCredits.successTitle")})," ",s("buyModal.successBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:()=>x("/assets?tab=mine"),children:s("buyModal.myAssets")}),e.jsxs("button",{className:"buy-modal__btn buy-modal__btn--ruby",onClick:o,children:[s("buyModal.tryInWorld"),e.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20","aria-hidden":!0,children:e.jsx("path",{d:"M5 12h12M13 7l5 5-5 5",fill:"none",stroke:"#fcfcfc",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})]})]})]})}function je({item:r,priceCredits:o}){return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:r.thumbnail?e.jsx("img",{src:r.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsx("div",{className:"buy-modal__asset-name",title:r.name,children:r.name||s("buyModal.itemFallback")}),r.creator?e.jsx("div",{className:"buy-modal__asset-creator",children:s("search.byCreator",{name:r.creator})}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(M,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:Z(o)})]})]})]})}const Ca=m.lazy(async()=>{const[{EmoteControls:r},{Experimental_CssVarsProvider:o},{light:t}]=await Promise.all([ae(()=>import("./index-nj2GyU5U.js").then(d=>d.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),ae(()=>import("./index-DOoENNk5.js"),__vite__mapDeps([11,3,1,2,4,5,6,7,12,9,13,14])),ae(()=>import("./index-B6W_ISMa.js"),__vite__mapDeps([15,3,1,2,4,5,6,7,16,14,13,9]))]);return{default:d=>e.jsx(o,{theme:t,children:e.jsx(r,{...d})})}});function ka(r){return e.jsx(m.Suspense,{fallback:null,children:e.jsx(Ca,{...r})})}function Ia({item:r}){const o=te(g=>{var N;return(N=g.session)==null?void 0:N.address}),{data:t,isLoading:d}=We(o),n=o&&t?o:"default",b=r.category==="emote",[x,_]=m.useState("item"),l=!b&&x==="item",j=l||!d,[a,v]=m.useState(!0);m.useEffect(()=>{v(!0)},[r.id,l]);const P=!!o&&!!t,f=P&&Ve(r,qe(t)),L=Oe(r)[0],C=P&&!f&&!b;return e.jsxs(e.Fragment,{children:[j?e.jsx(ze,{id:"shop-item-preview",contractAddress:r.contractAddress,tokenId:r.tokenId??void 0,itemId:r.tokenId?void 0:r.itemId??void 0,profile:l?void 0:f?n:"default",bodyShape:l||f?void 0:L,type:b?void 0:l?$.PreviewType.WEARABLE:$.PreviewType.AVATAR,emote:b||l?void 0:$.PreviewEmote.FASHION,disableBackground:!0,wheelZoom:b?1.5:void 0,wheelStart:b?100:void 0,dev:fe.chainId===80002,onLoad:()=>v(!1)}):null,!j||a?e.jsx("div",{className:"item-preview__loading","aria-busy":"true","aria-label":s("itemPreview.loading"),children:e.jsx("span",{className:"item-preview__spinner","aria-hidden":!0})}):null,C&&!l?e.jsx("p",{className:"item-preview__note",children:s("itemPreview.shownOnBody",{shape:Ke(L)})}):null,b?e.jsx("div",{className:"item-preview__emote-controls","data-testid":"emote-controls",children:e.jsx(ka,{wearablePreviewId:"shop-item-preview",hideFrameInput:!0})}):e.jsxs("div",{className:"item-preview__toggle",role:"group","aria-label":s("itemPreview.previewMode"),children:[e.jsxs("button",{type:"button",className:x==="avatar"?"is-active":"","aria-pressed":x==="avatar","aria-label":s("itemPreview.onAvatar"),onClick:()=>_("avatar"),children:[e.jsxs("svg",{className:"item-preview__toggle-ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:[e.jsx("circle",{cx:"12",cy:"7.5",r:"4"}),e.jsx("path",{d:"M4 20c0-4.2 3.6-6.5 8-6.5s8 2.3 8 6.5v.5H4z"})]}),e.jsx("span",{className:"item-preview__toggle-label",children:s("itemPreview.onAvatar")})]}),e.jsxs("button",{type:"button",className:x==="item"?"is-active":"","aria-pressed":x==="item","aria-label":s("itemPreview.item"),onClick:()=>_("item"),children:[e.jsx("svg",{className:"item-preview__toggle-ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:e.jsx("path",{d:"M8.5 3 3 6l1.8 3.8 2.2-1V21h10V8.8l2.2 1L22 6l-5.5-3a2.6 2.6 0 0 1-4.5 1.4A2.6 2.6 0 0 1 8.5 3z"})}),e.jsx("span",{className:"item-preview__toggle-label",children:s("itemPreview.item")})]})]})]})}function Aa({contractAddress:r,name:o,items:t,className:d}){const n=se();if(!r||!o)return null;const b=(t??[]).map(l=>l.thumbnail).filter(l=>!!l).slice(0,4),x=b.slice(0,2),_=b.slice(2,4);return e.jsxs("button",{className:`creator creator--link${d?` ${d}`:""}`,onClick:l=>{l.stopPropagation(),n(`/collection/${r}`)},children:[b.length>0?e.jsxs("span",{className:"creator__ava collection-collage","aria-hidden":!0,children:[e.jsx("span",{className:`collection-collage__row${_.length===0?" collection-collage__row--full":""}`,children:x.map((l,j)=>e.jsx("img",{src:l,alt:""},j))}),_.length>0?e.jsx("span",{className:"collection-collage__row",children:_.map((l,j)=>e.jsx("img",{src:l,alt:""},j))}):null]}):null,e.jsx("span",{className:"creator__name",children:Ue(o)})]})}function Ma(r){return Object.values($.Rarity).includes(r)}function Sa(r){return r==="male"?s("itemDetail.genderMale"):r==="female"?s("itemDetail.genderFemale"):r==="unisex"?s("itemDetail.genderUnisex"):null}function ve(r){return r.wearableCategory?r.wearableCategory.replace(/_/g," "):r.category==="emote"?s("itemDetail.categoryEmote"):s("itemDetail.categoryWearable")}function Ja(){const{contractAddress:r,tokenId:o}=Se(),{state:t}=Pe(),d=se(),n=!!(t!=null&&t.market),b=(t==null?void 0:t.marketPriceCredits)??null,x=_e(i=>i.add),_=_e(i=>i.items),l=he(i=>i.toggle),{session:j}=te(),[a,v]=m.useState(()=>t!=null&&t.item?{...t.item,tradeId:t.tradeId??t.item.tradeId}:{id:`${r}-${o}`,name:"",creator:"",contractAddress:r??"",itemId:null,category:"wearable",rarity:"common",network:"MATIC",chainId:fe.chainId,thumbnail:"",priceCredits:0,gender:null,isSmart:!1,tokenId:o??void 0,tradeId:t==null?void 0:t.tradeId}),[P,f]=m.useState(!1),[L,C]=m.useState(!!(t!=null&&t.resumeBuy));m.useEffect(()=>{t!=null&&t.resumeBuy&&f(!0)},[t==null?void 0:t.resumeBuy]);const{data:g=[],isFetched:N}=O({queryKey:["collection-items",a.contractAddress],enabled:!!a.contractAddress,queryFn:()=>ra(a.contractAddress,{first:20}).then(i=>i.items)}),W=a.available==null&&!a.tokenId,{data:k,isLoading:K}=O({queryKey:["shop-item",a.contractAddress,o],enabled:!n&&!!a.contractAddress&&!!o&&(!(t!=null&&t.item)||W),queryFn:()=>la(a.contractAddress,o)});m.useEffect(()=>{k&&v(i=>i.tradeId?i.available!=null&&i.wearableCategory?i:{...i,available:i.available??k.available,wearableCategory:i.wearableCategory??k.wearableCategory}:{...k})},[k]);const[U,G]=m.useState(!1),{data:D=""}=O({queryKey:["item-desc",a.contractAddress,a.itemId],enabled:!!a.contractAddress&&!!a.itemId,staleTime:5*6e4,queryFn:()=>da(a.contractAddress,a.itemId)}),{data:I}=O({queryKey:["collection-meta",a.contractAddress],enabled:!!a.contractAddress,staleTime:5*6e4,queryFn:()=>na(a.contractAddress)});m.useEffect(()=>{if(a.name||k||g.length===0)return;const i=o&&g.find(S=>S.tokenId===o||S.itemId===o)||g.find(S=>S.contractAddress===a.contractAddress);i&&v(S=>({...i,tradeId:S.tradeId??i.tradeId}))},[g,k]);const H=m.useMemo(()=>{const i=new Set,S=[];for(const F of g){if(F.id===a.id||a.itemId&&F.itemId===a.itemId||a.tokenId&&F.tokenId===a.tokenId)continue;const oe=`${F.contractAddress}-${F.itemId??F.tokenId??F.id}`;i.has(oe)||(i.add(oe),S.push(F))}return S},[g,a.id,a.itemId,a.tokenId]),{data:c,isLoading:y}=O({queryKey:["detail-trade",a.id,a.tradeId,a.contractAddress,a.itemId],enabled:!!a.contractAddress,queryFn:async()=>{if(a.tradeId)return a.tradeId;if(a.itemId){const i=await ca(a.contractAddress,a.itemId);return(i==null?void 0:i.id)??null}return null}}),u=a.tradeId??c??void 0,h=!!u,{data:p}=va(n),A=m.useMemo(()=>{if(!n||!(t!=null&&t.item))return null;const i=t.item;return i.manaWei?{tradeId:i.tradeId??i.id,listingType:"primary",contractAddress:i.contractAddress,itemId:i.itemId??"",name:i.name,thumbnail:i.thumbnail,rarity:i.rarity,category:i.category,wearableCategory:i.wearableCategory??null,creator:i.creator,manaWei:i.manaWei,available:1,network:i.network,chainId:i.chainId,createdAt:0}:null},[n,t==null?void 0:t.item]),T=n&&b!=null&&!!p&&!!A,E=Ge({priceCredits:a.priceCredits,compareAtCredits:a.compareAtCredits,saleEndsAt:a.saleEndsAt}),V=m.useMemo(()=>({...a,tradeId:u,id:u??a.id}),[a,u]),B=_.some(i=>i.id===V.id),w=he(i=>!!i.items[a.id]),q=m.useRef(null);m.useEffect(()=>{!a.name||y||q.current===a.id||(q.current=a.id,z("Shop Viewed Item",{...He(a),for_sale:h}),Qe(a))},[a.id,a.name,y,h]);const Q=`${r}/${o}`,ie=m.useRef(Q);m.useEffect(()=>{ie.current!==Q&&(ie.current=Q,t!=null&&t.item&&v({...t.item,tradeId:t.tradeId??t.item.tradeId}),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"}))},[Q]);function Ne(){!h||B||Y||x(V,"item_detail")}const X=Ma(a.rarity)?a.rarity:$.Rarity.COMMON,re=Sa(a.gender),le=Ye(a),de=Je(a.gender),ge=h&&E,we=s("itemDetail.moreFromCollection"),Y=Ze(a,j==null?void 0:j.address),ne=h?B?s("assetCard.inCart"):y?s("itemDetail.checking"):s("assetCard.addToCart"):s("itemDetail.notForSale"),Ce=typeof a.available=="number"&&a.available>0&&!a.tokenId&&!n,ke=!Y&&h&&!n,Ie=n||!Y,Ae=K||!!a.contractAddress&&!N,ce=!a.name&&!Ae,Me=/^https?:\/\//i.test(a.thumbnail);return Xe(ce?{title:s("seo.item.notFoundTitle"),noindex:!0}:a.name?{title:a.name,description:D||s("seo.item.fallbackDescription",{name:a.name,rarity:a.rarity,category:ve(a),creator:Na(a.creator)}),image:Me?a.thumbnail:void 0,type:"product"}:{}),ce?e.jsxs("div",{className:"item-detail item-detail--notfound",children:[e.jsx("span",{className:"ico ico-cart item-detail__notfound-ico","aria-hidden":!0}),e.jsx("h1",{className:"item-detail__notfound-title",children:s("itemDetail.notAvailableTitle")}),e.jsx("p",{className:"muted",children:s("itemDetail.notAvailableBody")}),e.jsx("button",{className:"btn btn--purple",onClick:()=>d("/assets"),children:s("notFound.cta")})]}):e.jsxs("div",{className:"item-detail",children:[e.jsxs("nav",{className:"item-detail__crumbs","aria-label":s("itemDetail.breadcrumbAria"),children:[e.jsx("button",{className:"item-detail__crumb-link",onClick:()=>d("/assets"),children:s("nav.collectibles")}),e.jsx("span",{className:"item-detail__crumb-sep",children:"/"}),e.jsx("span",{className:"item-detail__crumb-current",children:a.name||s("itemDetail.itemFallback")})]}),e.jsxs("div",{className:"item-detail__main",children:[e.jsxs("div",{className:"item-detail__preview","data-testid":"item-preview",children:[a.name?e.jsx(Ia,{item:a}):e.jsx("div",{className:"item-preview__loading","aria-busy":"true","aria-label":s("itemPreview.loading"),children:e.jsx("span",{className:"skeleton item-preview__skeleton","aria-hidden":!0})}),e.jsx("button",{className:`item-detail__fav item-detail__fav--preview${w?" is-on":""}`,onClick:()=>l(a),"aria-pressed":w,"aria-label":w?s("assetCard.removeFromFavorites"):s("assetCard.addToFavorites"),children:e.jsx("span",{className:`ico ${w?"ico-heart-solid":"ico-heart"}`,"aria-hidden":!0})})]}),e.jsx("div",{className:"item-detail__info",children:a.name?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"item-detail__info-head",children:[e.jsx("h1",{className:"item-detail__title",children:a.name}),e.jsx("button",{className:`item-detail__fav${w?" is-on":""}`,onClick:()=>l(a),"aria-pressed":w,"aria-label":w?s("assetCard.removeFromFavorites"):s("assetCard.addToFavorites"),children:e.jsx("span",{className:`ico ${w?"ico-heart-solid":"ico-heart"}`,"aria-hidden":!0})})]}),e.jsxs("div",{className:"item-detail__chips",children:[e.jsx("span",{className:"chip chip--rarity",style:{background:sa(X),color:aa(X)},title:ea(a.rarity),children:a.rarity}),e.jsxs("span",{className:"chip item-detail__chip",children:[le?e.jsx("span",{className:`ico ico-${le} item-detail__chip-ico`,"aria-hidden":!0}):null,ve(a)]}),re?e.jsxs("span",{className:"chip item-detail__chip",children:[de?e.jsx("span",{className:`ico ico-${de} item-detail__chip-ico`,"aria-hidden":!0}):null,re]}):null]}),D?e.jsxs("div",{className:"item-detail__section item-detail__description",children:[e.jsx("div",{className:"item-detail__label",children:s("itemDetail.description")}),e.jsx("p",{className:`item-detail__desc-text${U?" is-expanded":""}`,children:D}),D.length>140?e.jsx("button",{className:"link item-detail__desc-toggle",onClick:()=>G(i=>!i),children:U?s("itemDetail.showLess"):s("itemDetail.readMore")}):null]}):null,a.creator||I!=null&&I.name?e.jsxs("div",{className:"item-detail__meta",children:[a.creator?e.jsxs("div",{className:"item-detail__meta-col",children:[e.jsx("div",{className:"item-detail__label",children:s("itemDetail.creator")}),e.jsx(ta,{address:a.creator,className:"item-detail__creator",linkToProfile:!0,hidePrefix:!0})]}):null,I!=null&&I.name?e.jsxs("div",{className:"item-detail__meta-col item-detail__meta-col--collection",children:[e.jsx("div",{className:"item-detail__label",children:s("itemDetail.collection")}),e.jsx(Aa,{contractAddress:a.contractAddress,name:I.name,items:g,className:"item-detail__creator"})]}):null]}):null,e.jsx("hr",{className:"item-detail__divider"}),e.jsx("div",{className:"item-detail__price-block",children:e.jsxs("div",{className:"item-detail__price-row",children:[e.jsxs("div",{className:"item-detail__price-col",children:[e.jsx("div",{className:"item-detail__price-label",children:s("itemDetail.price")}),n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"item-detail__price item-detail__price--market",children:b==null?e.jsx("span",{className:"item-detail__price-value",children:"—"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"item-detail__approx","aria-hidden":!0,children:"≈"}),e.jsx(M,{className:"item-detail__diamond"}),e.jsx("span",{className:"item-detail__price-value",children:b})]})}),e.jsx("div",{className:"item-detail__market-note muted",children:s("assetCard.marketPrice")})]}):h?ge?e.jsxs("div",{className:"item-detail__price item-detail__price--sale",children:[e.jsxs("span",{className:"item-detail__price",children:[e.jsx(M,{className:"item-detail__diamond"}),e.jsx("span",{className:"item-detail__price-value",children:a.priceCredits})]}),e.jsxs("span",{className:"item-detail__price-was",children:[e.jsx(M,{className:"item-detail__diamond item-detail__diamond--was"}),a.compareAtCredits]}),be(a.compareAtCredits,a.priceCredits)>0?e.jsx("span",{className:"item-detail__sale-badge",children:s("assetCard.saleWithDiscount",{pct:be(a.compareAtCredits,a.priceCredits)})}):null,e.jsx(ia,{endsAt:a.saleEndsAt,className:"item-detail__countdown"})]}):e.jsxs("div",{className:"item-detail__price",children:[e.jsx(M,{className:"item-detail__diamond"}),e.jsx("span",{className:"item-detail__price-value",children:a.priceCredits})]}):e.jsx("div",{className:"item-detail__price item-detail__price--none",children:s("itemDetail.notForSale")})]}),Ce?e.jsxs("div",{className:"item-detail__stock-col",children:[e.jsx("div",{className:"item-detail__price-label",children:s("itemDetail.stock")}),e.jsxs("div",{className:"item-detail__stock-value",children:[(a.available??0).toLocaleString(),"/",$.Rarity.getMaxSupply(X).toLocaleString()]})]}):null]})}),e.jsx("div",{className:`item-detail__ctas${Ie?" item-detail__ctas--buttons":""}${ke?" item-detail__ctas--dual":""}`,children:n?e.jsxs("button",{className:"btn btn--purple item-detail__cta",onClick:()=>f(!0),disabled:!T,children:[e.jsx("span",{className:"item-detail__cta-label",children:s("assetCard.buyNow")}),b!=null?e.jsxs("span",{className:"item-detail__cta-price","aria-hidden":!0,children:[e.jsx(M,{className:"item-detail__cta-diamond"}),b]}):null]}):Y?e.jsxs("p",{className:"item-detail__own-note muted",children:[s("itemDetail.ownItemPrefix")," ",e.jsx(Ee,{to:"/my-assets",children:s("nav.myAssets")}),s("itemDetail.ownItemSuffix")]}):e.jsxs(e.Fragment,{children:[h?e.jsxs("button",{className:"btn btn--purple item-detail__cta",onClick:()=>f(!0),disabled:y,children:[e.jsx("span",{className:"item-detail__cta-label",children:s("assetCard.buyNow")}),e.jsxs("span",{className:"item-detail__cta-price","aria-hidden":!0,children:[e.jsx(M,{className:"item-detail__cta-diamond"}),a.priceCredits]})]}):null,e.jsxs("button",{className:"item-detail__addcart",onClick:Ne,disabled:!h||B||y,"aria-label":ne,children:[e.jsx("span",{className:"ico ico-cart-solid item-detail__addcart-ico","aria-hidden":!0}),e.jsx("span",{className:"item-detail__addcart-label",children:ne})]})]})})]}):e.jsx(Pa,{})})]}),e.jsx(ga,{title:we,items:H,onViewAll:a.contractAddress?()=>d(`/collection/${a.contractAddress}`):void 0}),P&&n&&A&&p?e.jsx(fa,{listing:A,rate:p,onClose:()=>f(!1),onSold:()=>f(!1)}):P&&!n?e.jsx(wa,{item:V,resume:L,onClose:()=>{f(!1),C(!1)}}):null]})}function Pa(){return e.jsxs("div",{className:"item-detail__info-skel","aria-hidden":!0,children:[e.jsx("span",{className:"skeleton id-skel__title"}),e.jsxs("div",{className:"id-skel__chips",children:[e.jsx("span",{className:"skeleton id-skel__chip"}),e.jsx("span",{className:"skeleton id-skel__chip"})]}),e.jsx("span",{className:"skeleton id-skel__line"}),e.jsx("span",{className:"skeleton id-skel__line id-skel__line--short"}),e.jsx("hr",{className:"item-detail__divider"}),e.jsx("span",{className:"skeleton id-skel__price"}),e.jsx("span",{className:"skeleton id-skel__btn"})]})}export{Ja as ItemDetail,Ja as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,j as i}from"./react-yytiy0wi.js";import{t as u}from"./index-
|
|
1
|
+
import{r as c,j as i}from"./react-yytiy0wi.js";import{t as u}from"./index-CzmwWbz1.js";function m({hasNextPage:e,isFetching:r,onLoadMore:o}){const t=c.useRef(null);return c.useEffect(()=>{const n=t.current;if(!n||!e)return;const s=new IntersectionObserver(a=>{var l;(l=a[0])!=null&&l.isIntersecting&&!r&&o()},{rootMargin:"600px 0px"});return s.observe(n),()=>s.disconnect()},[e,r,o]),e?i.jsx("div",{className:"load-more",ref:t,children:i.jsx("button",{className:"btn btn--ghost",onClick:o,disabled:r,children:r?u("loadMore.loading"):u("loadMore.loadMore")})}):null}export{m as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as K,j as S,d as O,o as V,u as Y,t,q as h,C as b,r as M,s as H,k as j,i as $,l as D,v as J,b as y,w as F,x as R}from"./index-
|
|
1
|
+
import{g as K,j as S,d as O,o as V,u as Y,t,q as h,C as b,r as M,s as H,k as j,i as $,l as D,v as J,b as y,w as F,x as R}from"./index-CzmwWbz1.js";import{r as X,a as x}from"./mana-rate-D42fK9sf.js";import{a as Z,r as m,j as r}from"./react-yytiy0wi.js";import{b as U}from"./buy-BlHiSc1W.js";import{g as ee,b as re,w as ae,S as te,G as se}from"./buy-gasless-aP_Keozx.js";import{i as ie}from"./errors-uwUVgVvx.js";import{E as ce}from"./ErrorNotice-CKeOu_Oi.js";function fe(e=!0){return K({queryKey:["mana-rate",S.chainId],queryFn:()=>X(S.chainId),enabled:e,staleTime:6e4,refetchInterval:6e4,retry:1})}function q(e){if(ie(e))return t("errors.rejected");const n=(e.message??"").toLowerCase();return n.includes("insufficient")?t("marketCheckout.error.insufficient",{currency:j.name}):n.includes("not found")||n.includes("no active listing")||n.includes("404")?t("marketCheckout.error.soldOrRemoved"):n.includes("your own listing")?t("errors.cantBuyOwn"):t("marketCheckout.error.generic")}function ne(e){return{id:e.tradeId,tradeId:e.tradeId,name:e.name,creator:e.creator,contractAddress:e.contractAddress,itemId:e.itemId,category:e.category,wearableCategory:e.wearableCategory??void 0,rarity:e.rarity,network:e.network,chainId:e.chainId,thumbnail:e.thumbnail,priceCredits:0,gender:null,isSmart:!1}}function _e({listing:e,rate:n,onClose:A,onSold:W}){const{session:i}=O(),{data:d,isError:T}=V(i),w=Y(),N=Z(),[g,k]=m.useState("confirm"),[p,I]=m.useState(t("marketCheckout.lockingPrice")),[B,f]=m.useState(null),[a,G]=m.useState(null),o=m.useRef(null),L=Math.ceil(x(e.manaWei,n)/10);m.useEffect(()=>{let l=!1;if(!i){k("error"),f(t("buyModal.signInToCheckout"));return}return(async()=>{try{const s=await $(e.tradeId);if(!s)throw new Error("not found");if(D(s,i.address))throw new Error("You can't buy your own listing.");const u=x(e.manaWei,n);if(!Number.isFinite(u)||u<=0)throw new Error("price unavailable");const{credit:v,maxCreditedValue:z,usdCents:P}=await J(i.identity,u,e.tradeId);if(l){h(i.identity,[v.id]).catch(()=>{});return}o.current=v.id,G({trade:s,credit:v,maxCreditedValue:z,usdCents:P,credits:Math.ceil(P/10)}),I("")}catch(s){if(l)return;console.error("[market] authorize failed",s),y(R(s)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:F(s),value_usd:Math.round(x(e.manaWei,n))/100}),k("error"),f(q(s))}})(),()=>{l=!0,o.current&&i&&(h(i.identity,[o.current]).catch(()=>{}),o.current=null)}},[]);const C=!!a&&d!=null&&d.credits<a.credits;async function Q(){if(!i||!a)return;if(C){y("Shop Buy Credits Prompted",{from:"item_checkout",credits_needed:a.credits,credits_balance:(d==null?void 0:d.credits)??0,shortfall:Math.max(0,a.credits-((d==null?void 0:d.credits)??0))}),h(i.identity,[a.credit.id]).catch(()=>{}),o.current=null,N("/credits");return}k("working"),f(null);let l=!1;try{I(t("marketCheckout.confirming"));const c={trade:a.trade,buyer:i.address,signer:i.signer,credits:[a.credit],maxCreditedValue:a.maxCreditedValue};let s;if(ee())try{s=await re(c),await ae(s),l=!0}catch(u){if(u instanceof te)l=!0;else if(u instanceof se)s=await U(c);else throw u}else s=await U(c);o.current=null,y("Shop Completed Purchase",{items:[{item_id:e.itemId??null,contract_address:e.contractAddress,token_id:null,price_usd:a.usdCents/100}],value_credits:a.credits,value_usd:a.usdCents/100,purchase_type:"item",is_primary:!0,payment_type:"credits",no_crypto_step:l,transaction_hash:s??null}),w.invalidateQueries({queryKey:["usd-balance"]}),N("/success",{state:{items:[ne(e)],txHash:s}})}catch(c){console.error("[market] buy now failed",c),h(i.identity,[a.credit.id]).catch(()=>{}),o.current=null,y(R(c)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:F(c),value_usd:a.usdCents/100}),w.invalidateQueries({queryKey:["usd-balance"]}),f(q(c)),k("error");const s=(c.message??"").toLowerCase();(s.includes("not found")||s.includes("no active listing")||s.includes("404"))&&W()}}function E(){i&&a&&h(i.identity,[a.credit.id]).catch(()=>{}),o.current=null,A()}const _=g==="working";return r.jsxs("div",{className:"mkt-modal",role:"dialog","aria-modal":"true","aria-label":t("buyModal.dialogAria",{name:e.name}),children:[r.jsx("div",{className:"mkt-modal__scrim",onClick:_?void 0:E,"aria-hidden":!0}),r.jsxs("div",{className:"mkt-modal__card",children:[r.jsxs("div",{className:"mkt-modal__head",children:[r.jsx("div",{className:"mkt-modal__thumb",children:e.thumbnail?r.jsx("img",{src:e.thumbnail,alt:""}):null}),r.jsxs("div",{children:[r.jsx("div",{className:"mkt-modal__name",title:e.name,children:e.name||t("buyModal.itemFallback")}),r.jsx("span",{className:"chip chip--rarity",children:e.rarity})]})]}),r.jsx("div",{className:"mkt-modal__price",children:a?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mkt-modal__price-label",children:t("marketCheckout.finalPrice")}),r.jsxs("div",{className:"mkt-modal__price-value",children:[r.jsx(b,{className:"mkt-modal__diamond"}),M(a.credits)]}),r.jsxs("div",{className:"mkt-modal__price-sub muted",children:[t("marketCheckout.lockedForPurchase")," · $",(a.usdCents/100).toFixed(2)]})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mkt-modal__price-label",children:t("marketCheckout.todaysPrice")}),r.jsxs("div",{className:"mkt-modal__price-value mkt-modal__price-value--approx",children:[r.jsx("span",{className:"mkt-modal__approx","aria-hidden":!0,children:"≈"}),r.jsx(b,{className:"mkt-modal__diamond"}),M(L)]}),r.jsx("div",{className:"mkt-modal__price-sub muted",children:p||t("marketCheckout.lockingPrice")})]})}),i?r.jsxs("div",{className:"mkt-modal__balance muted",children:[t("marketCheckout.yourBalance")," ",r.jsx(b,{className:"ccy-mark"})," ",H(d,T)]}):null,C?r.jsx("p",{className:"muted mkt-modal__note",children:t("marketCheckout.needMore",{currency:j.name})}):null,p&&g==="working"?r.jsx("p",{className:"muted mkt-modal__note",children:p}):null,r.jsx(ce,{message:B,className:"mkt-modal__note"}),r.jsxs("div",{className:"mkt-modal__actions",children:[r.jsx("button",{className:"btn btn--ghost",onClick:E,disabled:_,children:t("buyModal.cancel")}),r.jsx("button",{className:"btn btn--purple",onClick:()=>void Q(),disabled:_||!a,children:_?t("marketCheckout.buying"):C?t("nav.getCredits",{currency:j.name}):t("marketCheckout.confirmPurchase")})]})]})]})}export{_e as M,fe as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as G,r as m,j as e,L as os}from"./react-yytiy0wi.js";import{j as B,D as ds,u as H,t as a,C as F,k as w,p as es,b as M,ac as X,z,w as as,a as ms,d as us,g as D,ap as hs,i as ps,aq as ys}from"./index-CzmwWbz1.js";import{f as bs}from"./import-sr6kRaqB.js";import{d as ts}from"./dcl-schemas-BICTSpB5.js";import{c as gs}from"./buy-BlHiSc1W.js";import{a as xs,b as js,i as _s,e as Ns,c as fs}from"./trade-encoding-8RrYE6hq.js";import{f as ns}from"./errors-uwUVgVvx.js";import{E as $}from"./ErrorNotice-CKeOu_Oi.js";import{s as vs}from"./wallet-kind-B9P1TeIH.js";import{L as Is}from"./LoadMore-6Uy0vHhH.js";import{u as As}from"./useInfiniteGrid-Dg-jgtmN.js";import"./sentry-BPJvc5GU.js";import"./ethers-w2AslR0v.js";import"./intl-CBcMB1D2.js";import"./mana-rate-D42fK9sf.js";import"./index-HN6Rk25C.js";const O=()=>`${B.builderServerUrl}/v1`;function rs(s){return Array.isArray(s)?s:"results"in s&&Array.isArray(s.results)?s.results:"data"in s&&Array.isArray(s.data)?s.data:[]}async function is(s,i){const r=await ds(s,{method:"GET",identity:i,metadata:{}});if(!r.ok)throw new Error(`builder-server ${r.status}: ${await r.text()}`);const o=await r.json();return o.data??o}function ks(s,i){const r=i-s;return r>0?r:0}function Ss(s){var i,r,o,l,c;return((r=(i=s.data)==null?void 0:i.wearable)==null?void 0:r.category)??((l=(o=s.data)==null?void 0:o.emote)==null?void 0:l.category)??((c=s.data)==null?void 0:c.category)??s.type??"wearable"}function Z(s){return`${O()}/storage/contents/${s}`}function P(s,i){if(!s)return"";if(/^https?:\/\//.test(s))return s;const r=i==null?void 0:i[s];return r?Z(r):/^(ba|Qm)/.test(s)?Z(s):""}async function Cs(s,i){try{const r=await fetch(`${O()}/items/${s}/${i}/contents`);if(!r.ok)return{};const o=await r.json();return o.data??o}catch{return{}}}async function ws(s,i,r){const o=P(s.thumbnail,s.contents)||P("thumbnail.png",s.contents);if(o)return o;if(i&&r){const l=await Cs(i,r);return P(s.thumbnail,l)||P("thumbnail.png",l)||P("image.png",l)}return""}async function Ls(s,i){const r=`${O()}/${s.toLowerCase()}/collections?is_published=true`,o=await is(r,i);return rs(o).filter(l=>l.is_published&&!!l.contract_address).map(l=>({id:l.id,name:l.name,contractAddress:l.contract_address.toLowerCase(),isPublished:l.is_published,isApproved:l.is_approved,minters:(l.minters??[]).map(c=>c.toLowerCase())}))}async function Ms(s,i){const r=`${O()}/collections/${s.id}/items`,o=await is(r,i);return(await Promise.all(rs(o).map(async c=>{const v=c.rarity??"common",N=Number(c.total_supply??0)||0;let u;try{u=ts.Rarity.getMaxSupply(v)}catch{u=0}const I=(c.contract_address??s.contractAddress).toLowerCase(),y=c.blockchain_item_id??"";return{id:c.id,collectionId:s.id,collectionName:s.name,contractAddress:I,blockchainItemId:y,name:c.name,category:Ss(c),rarity:v,thumbnail:await ws(c,I,y),type:c.type??"wearable",isPublished:c.is_published??s.isPublished,isApproved:c.is_approved??s.isApproved,totalSupply:N,maxSupply:u,remainingSupply:ks(N,u),minters:s.minters}}))).filter(Ps)}function Ps(s){return s.isPublished&&s.isApproved&&s.blockchainItemId!==""&&s.blockchainItemId!=null&&s.remainingSupply>0}async function $s(s,i){const r=await Ls(s,i);return(await Promise.all(r.map(async l=>{try{return await Ms(l,i)}catch{return[]}}))).flat()}const Es=1e3*60*60*24*182;function Ts({asset:s,session:i,onClose:r}){const o=H(),l=G(),[c,v]=m.useState("10"),[N,u]=m.useState(null),[I,y]=m.useState(null),[b,S]=m.useState(!1),[_,A]=m.useState(null);async function C(){y(null);const d=Number(c);if(!Number.isInteger(d)||d<=0){y(a("sellModal.errorWholeNumber"));return}S(!0);try{u(a("sellModal.statusPreparing")),await xs({signer:i.signer,contractAddress:s.contractAddress,chainId:s.chainId}),u(a("sellModal.statusListing"));const f=await js({signer:i.signer,nft:{contractAddress:s.contractAddress,tokenId:s.tokenId,network:s.network,chainId:s.chainId},usdPrice:d/10,expiresAtMs:Date.now()+Es});u(a("sellModal.statusPublishing")),await es(f,i.identity),u(null),A(d),M("Shop Listed Item",{item_id:s.itemId??s.tokenId??null,contract_address:s.contractAddress,price_credits:d,price_usd:d/10,listing_type:"secondary",is_primary:!1}),X.success(a("sellModal.toastOnSale",{name:s.name})),o.invalidateQueries({queryKey:["my-assets",i.address]})}catch(f){z(f,{flow:"list_secondary"}),M("Shop Listing Failed",{listing_type:"secondary",error_code:as(f)}),y(ns(f,a("sellModal.errorGeneric"))),u(null)}finally{S(!1)}}function j(){r(),l(`/item/${s.contractAddress}/${s.tokenId}`)}return _!==null?e.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:e.jsxs("div",{className:"modal modal--success",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:a("sellModal.successTitle")}),s.image?e.jsx("img",{className:"modal__img",src:s.image,alt:s.name}):null,e.jsx("p",{className:"modal-success__name",children:s.name}),e.jsxs("p",{className:"muted small",children:[a("sellModal.listedFor")," ",e.jsxs("strong",{children:[e.jsx(F,{className:"ccy-mark"})," ",_]})]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:r,children:a("getCredits.done")}),e.jsx("button",{className:"btn btn--purple",onClick:j,children:a("sellModal.viewInShop")})]})]})}):e.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:e.jsxs("div",{className:"modal","data-testid":"modal",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("h2",{className:"modal__title",children:a("sellModal.listTitle",{name:s.name})}),s.image?e.jsx("img",{className:"modal__img",src:s.image,alt:s.name}):null,e.jsxs("label",{className:"field",children:[e.jsx("span",{children:a("sellModal.priceLabel",{currency:w.name})}),e.jsx("input",{type:"number",min:"1",step:"1",value:c,onChange:d=>v(d.target.value),disabled:b})]}),e.jsx("p",{className:"muted small",children:a("sellModal.pricedInWhole",{currency:w.name,currencySingular:w.nameSingular})}),N?e.jsx("p",{className:"muted",children:N}):null,e.jsx($,{message:I}),e.jsxs("div",{className:"modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:r,disabled:b,children:a("sellModal.cancel")}),e.jsx("button",{className:"btn",onClick:()=>void C(),disabled:b,children:b?a("sellModal.listing"):a("sellModal.putOnSale")})]})]})})}const qs=1e3*60*60*24*182;function Fs({item:s,session:i,onClose:r}){const o=H(),l=G(),[c,v]=m.useState("10"),[N,u]=m.useState(null),[I,y]=m.useState(null),[b,S]=m.useState(!1),[_,A]=m.useState(null),[C,j]=m.useState(null),d=B.chainId,f=vs(i.providerType);m.useEffect(()=>{let h=!1;return(async()=>{try{const g=await _s({contractAddress:s.contractAddress,chainId:d});h||A(g)}catch{h||A(!1)}})(),()=>{h=!0}},[s.contractAddress,d]);async function K(){y(null);const h=Number(c);if(!Number.isInteger(h)||h<=0){y(a("primaryList.errorWholeNumber"));return}S(!0);try{_||(u(a("primaryList.statusEnabling")),await Ns({signer:i.signer,contractAddress:s.contractAddress,chainId:d}),A(!0)),u(a("primaryList.statusPublishing"));const g=await fs({signer:i.signer,item:{contractAddress:s.contractAddress,itemId:s.blockchainItemId,network:ts.Network.MATIC,chainId:d},usdPrice:h/10,uses:s.remainingSupply,expiresAtMs:Date.now()+qs});u(a("primaryList.statusFinishing")),await es(g,i.identity),u(null),j(h),M("Shop Listed Item",{item_id:s.blockchainItemId,contract_address:s.contractAddress,price_credits:h,price_usd:h/10,listing_type:"primary",is_primary:!0}),X.success(a("primaryList.toastOnSale",{name:s.name})),o.invalidateQueries({queryKey:["publishable-items"]}),o.invalidateQueries({queryKey:["collection-sale-state"]})}catch(g){z(g,{flow:"list_primary"}),M("Shop Listing Failed",{listing_type:"primary",error_code:as(g)}),y(ns(g,a("primaryList.errorGeneric"))),u(null)}finally{S(!1)}}function Q(){r(),l(`/item/${s.contractAddress}/${s.blockchainItemId}`)}const E=b?a("primaryList.listing"):_===!1?a("primaryList.enableAndPutOnSale"):a("primaryList.putOnSale");return C!==null?e.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:e.jsxs("div",{className:"modal modal--success",onClick:h=>h.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:a("primaryList.successTitle")}),s.thumbnail?e.jsx("img",{className:"modal__img",src:s.thumbnail,alt:s.name}):null,e.jsx("p",{className:"modal-success__name",children:s.name}),e.jsxs("p",{className:"muted small",children:[a("primaryList.listedFor")," ",e.jsxs("strong",{children:[e.jsx(F,{className:"ccy-mark"})," ",C]})," ",a("primaryList.dotAvailable",{count:s.remainingSupply})]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:r,children:a("getCredits.done")}),e.jsx("button",{className:"btn btn--purple",onClick:Q,children:a("primaryList.viewInShop")})]})]})}):e.jsx("div",{className:"modal-backdrop",onClick:r,role:"presentation",children:e.jsxs("div",{className:"modal","data-testid":"modal",onClick:h=>h.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("h2",{className:"modal__title",children:a("primaryList.publishTitle",{name:s.name})}),s.thumbnail?e.jsx("img",{className:"modal__img",src:s.thumbnail,alt:s.name}):null,e.jsx("p",{className:"muted small",children:a("primaryList.fromCollection",{collectionName:s.collectionName,count:s.remainingSupply})}),e.jsxs("label",{className:"field",children:[e.jsx("span",{children:a("primaryList.priceLabel",{currency:w.name})}),e.jsx("input",{type:"number",min:"1",step:"1",value:c,onChange:h=>v(h.target.value),disabled:b})]}),e.jsx("p",{className:"muted small",children:a("primaryList.pricedInWhole",{currency:w.name,currencySingular:w.nameSingular})}),_===!1&&!b?f?e.jsx("p",{className:"muted small primary-note",children:a("primaryList.firstTimeConfirm",{collectionName:s.collectionName})}):e.jsx("p",{className:"muted small primary-note",children:a("primaryList.firstTimeManaged",{collectionName:s.collectionName})}):_===!0&&!b?f?e.jsx("p",{className:"muted small primary-note",children:a("primaryList.readyConfirm")}):e.jsx("p",{className:"muted small primary-note",children:a("primaryList.readyManaged")}):null,N?e.jsx("p",{className:"muted",children:N}):null,e.jsx($,{message:I}),e.jsxs("div",{className:"modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:r,disabled:b,children:a("primaryList.cancel")}),e.jsx("button",{className:"btn",onClick:()=>void K(),disabled:b||_===null,children:_===null?a("primaryList.checking"):E})]})]})})}const Os=48;function Ks(s){return{id:s.id,name:s.name,creator:"",contractAddress:s.contractAddress,itemId:s.itemId,category:s.category,rarity:s.rarity??"common",network:s.network,chainId:s.chainId,thumbnail:s.image,priceCredits:s.listingPrice??0,gender:null,isSmart:!1,tokenId:s.tokenId}}function ss(s){return{id:`${s.contractAddress}-${s.blockchainItemId}`,name:s.name,creator:"",contractAddress:s.contractAddress,itemId:s.blockchainItemId,category:s.category,rarity:s.rarity,network:"MATIC",chainId:B.chainId,thumbnail:s.thumbnail,priceCredits:0,gender:null,isSmart:!1}}function ae(){ms({title:a("nav.myAssets"),noindex:!0});const{session:s,error:i,signIn:r,restore:o}=us(),l=G(),c=H(),[v,N]=m.useState(null),[u,I]=m.useState(null),[y,b]=m.useState(null),[S,_]=m.useState(null);function A(t){const n=t.tokenId??t.itemId??"";!t.contractAddress||!n||l(`/item/${t.contractAddress}/${n}`,{state:{item:t}})}async function C(t,n,p){if(s){_(null),b(p);try{const x=await ps(t);await gs({trade:x,signer:s.signer}),X.success(a("myAssets.removedFromSale",{name:n})),await c.invalidateQueries({queryKey:["my-assets",s.address]}),await c.invalidateQueries({queryKey:["collection-sale-state"]})}catch(x){const T=x,q=(T.message??"").toLowerCase(),Y=T.code===4001||q.includes("reject")||q.includes("denied");Y||z(x,{flow:"remove-listing",tradeId:t}),_(Y?a("getCredits.errorCanceled"):a("myAssets.removeListingError"))}finally{b(null)}}}m.useEffect(()=>{o()},[o]);const j=s==null?void 0:s.address,{items:d,isLoading:f,error:K,hasNextPage:Q,isFetchingNextPage:E,fetchNextPage:h}=As(["my-assets",j],t=>hs(j,{first:Os,skip:t}).then(n=>({items:n.assets,total:n.total})),{enabled:!!j}),{data:g}=D({queryKey:["importable",j],queryFn:()=>bs(j),enabled:!!j}),J=((g==null?void 0:g.creations.length)??0)+((g==null?void 0:g.owned.length)??0),{data:L,isLoading:ls,isError:cs}=D({queryKey:["publishable-items",j],queryFn:()=>$s(j,s.identity),enabled:!!s,retry:!1}),R=m.useMemo(()=>[...new Set((L??[]).map(t=>t.contractAddress))],[L]),{data:k}=D({queryKey:["collection-sale-state",j,R],enabled:R.length>0,queryFn:async()=>{const t=await Promise.all(R.map(async p=>[p,await ys(p)])),n={};for(const[p,x]of t)for(const[T,q]of Object.entries(x))n[`${p}-${T}`]=q;return n}}),U=t=>k==null?void 0:k[`${t.contractAddress}-${t.blockchainItemId}`],W=m.useMemo(()=>(L??[]).filter(t=>{var n;return(n=U(t))==null?void 0:n.isOnSale}),[L,k]),V=m.useMemo(()=>{var n;const t=new Map;for(const p of L??[]){if((n=k==null?void 0:k[`${p.contractAddress}-${p.blockchainItemId}`])!=null&&n.isOnSale)continue;const x=t.get(p.collectionId)??{id:p.collectionId,name:p.collectionName,items:[]};x.items.push(p),t.set(p.collectionId,x)}return[...t.values()]},[L,k]);return s?e.jsxs("section",{className:"myassets",children:[e.jsx("h1",{children:a("nav.myAssets")}),J>0?e.jsxs(os,{className:"import-banner",to:"/import",children:[e.jsx("span",{className:"import-banner__ico","aria-hidden":!0,children:"📦"}),e.jsxs("span",{className:"import-banner__text",children:[e.jsx("strong",{children:a("myAssets.importTitle")}),e.jsx("span",{className:"import-banner__sub",children:a("myAssets.importSub",{count:J})})]}),e.jsx("span",{className:"import-banner__cta",children:a("myAssets.import")})]}):null,e.jsxs("div",{className:"myassets__section",children:[e.jsxs("div",{className:"myassets__section-head",children:[e.jsx("h2",{className:"myassets__section-title",children:a("myAssets.ownedTitle")}),e.jsx("p",{className:"myassets__section-sub",children:a("myAssets.ownedSub")})]}),K?e.jsx($,{message:a("myAssets.ownedError")}):null,e.jsx($,{message:S}),e.jsxs("div",{className:"asset-grid",children:[f?Array.from({length:8}).map((t,n)=>e.jsx("div",{className:"asset-card asset-card--skeleton"},`sk-${n}`)):d.map(t=>e.jsxs("article",{className:"asset-card asset-card--link",children:[e.jsx("button",{className:"card-link-overlay","aria-label":a("myAssets.viewItem",{name:t.name}),onClick:()=>A(Ks(t))}),e.jsx("div",{className:"asset-card__img",children:t.image?e.jsx("img",{src:t.image,alt:t.name}):null}),e.jsx("div",{className:"asset-card__name",title:t.name,children:t.name}),t.isOnSale?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"asset-card__listed",children:[e.jsxs("span",{className:"asset-card__price",children:[e.jsx(F,{className:"ccy-mark"})," ",t.listingPrice]}),e.jsx("span",{className:"badge",children:a("myAssets.onSale")})]}),e.jsx("button",{className:"btn btn--sm btn--ghost asset-card__remove",disabled:y===t.id||!t.tradeId,onClick:n=>{n.stopPropagation(),t.tradeId&&C(t.tradeId,t.name,t.id)},children:y===t.id?a("myAssets.removing"):a("myAssets.removeListing")})]}):e.jsx("button",{className:"btn btn--sm",onClick:n=>{n.stopPropagation(),M("Shop Started Listing",{listing_type:"secondary",item_id:t.itemId??t.tokenId??null}),N(t)},children:a("myAssets.putOnSale")})]},t.id)),E?Array.from({length:4}).map((t,n)=>e.jsx("div",{className:"asset-card asset-card--skeleton"},`msk-${n}`)):null]}),e.jsx(Is,{hasNextPage:Q,isFetching:E,onLoadMore:()=>void h()}),!f&&d.length===0?e.jsx("p",{className:"muted",children:a("myAssets.ownedEmpty")}):null]}),e.jsxs("div",{className:"myassets__section",children:[e.jsxs("div",{className:"myassets__section-head",children:[e.jsx("h2",{className:"myassets__section-title",children:a("myAssets.creationsTitle")}),e.jsx("p",{className:"myassets__section-sub",children:a("myAssets.creationsSub",{currency:w.name})})]}),ls?e.jsx("div",{className:"publish-grid",children:Array.from({length:4}).map((t,n)=>e.jsx("div",{className:"asset-card asset-card--skeleton"},`pub-sk-${n}`))}):cs?e.jsx("p",{className:"publish-empty",children:a("myAssets.collectionsError")}):W.length===0&&V.length===0?e.jsx("p",{className:"publish-empty",children:a("myAssets.nothingToPublish")}):e.jsxs(e.Fragment,{children:[W.length>0?e.jsxs("div",{className:"creations-collection",children:[e.jsx("h3",{className:"creations-collection__name",children:a("myAssets.onSale")}),e.jsx("div",{className:"publish-grid",children:W.map(t=>{var n;return e.jsxs("article",{className:"publish-card publish-card--link",children:[e.jsx("button",{className:"card-link-overlay","aria-label":a("myAssets.viewItem",{name:t.name}),onClick:()=>A(ss(t))}),e.jsx("div",{className:"publish-card__img",children:t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:t.name}):null}),e.jsx("div",{className:"publish-card__name",title:t.name,children:t.name}),e.jsxs("div",{className:"publish-card__listed",children:[e.jsxs("span",{className:"publish-card__price",children:[e.jsx(F,{className:"ccy-mark"})," ",((n=U(t))==null?void 0:n.priceCredits)??0]}),e.jsx("span",{className:"badge",children:a("myAssets.onSale")})]}),e.jsx("button",{className:"btn btn--sm btn--ghost publish-card__cta",disabled:y===t.id,onClick:p=>{p.stopPropagation();const x=U(t);x!=null&&x.tradeId&&C(x.tradeId,t.name,t.id)},children:y===t.id?a("myAssets.removing"):a("myAssets.removeListing")})]},`${t.contractAddress}-${t.blockchainItemId}`)})})]}):null,V.map(t=>e.jsxs("div",{className:"creations-collection",children:[e.jsx("h3",{className:"creations-collection__name",children:t.name}),e.jsx("div",{className:"publish-grid",children:t.items.map(n=>e.jsxs("article",{className:"publish-card publish-card--link",children:[e.jsx("button",{className:"card-link-overlay","aria-label":a("myAssets.viewItem",{name:n.name}),onClick:()=>A(ss(n))}),e.jsx("div",{className:"publish-card__img",children:n.thumbnail?e.jsx("img",{src:n.thumbnail,alt:n.name}):null}),e.jsx("div",{className:"publish-card__name",title:n.name,children:n.name}),e.jsxs("div",{className:"publish-card__meta",children:[e.jsx("span",{className:"publish-chip publish-chip--rarity",children:n.rarity}),e.jsx("span",{className:"publish-card__supply",children:a("myAssets.available",{count:n.remainingSupply})})]}),e.jsx("button",{className:"btn btn--sm btn--purple publish-card__cta",onClick:p=>{p.stopPropagation(),M("Shop Started Listing",{listing_type:"primary",item_id:n.blockchainItemId}),I(n)},children:a("myAssets.putOnSale")})]},`${n.contractAddress}-${n.blockchainItemId}`))})]},t.id))]})]}),v?e.jsx(Ts,{asset:v,session:s,onClose:()=>N(null)}):null,u?e.jsx(Fs,{item:u,session:s,onClose:()=>I(null)}):null]}):e.jsxs("section",{className:"myassets",children:[e.jsx("h1",{children:a("nav.myAssets")}),e.jsx("p",{className:"muted",children:a("myAssets.signInPrompt")}),e.jsx("div",{className:"connect-row",children:e.jsx("button",{className:"btn btn--purple",onClick:()=>r(),children:a("storeSettings.signIn")})}),e.jsx($,{message:i})]})}export{ae as MyAssets};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as n,j as s,L as c}from"./react-yytiy0wi.js";import{a as m,t,c as l,A as d}from"./index-
|
|
1
|
+
import{r as n,j as s,L as c}from"./react-yytiy0wi.js";import{a as m,t,c as l,A as d}from"./index-CzmwWbz1.js";import{L as p}from"./LoadMore-6Uy0vHhH.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-BPJvc5GU.js";import"./ethers-w2AslR0v.js";import"./intl-CBcMB1D2.js";const r=24;function N(){m({title:t("nav.myFavorites"),noindex:!0});const a=l(e=>Object.values(e.items)),[i,o]=n.useState(r);return a.length===0?s.jsxs("div",{className:"favorites-empty",children:[s.jsx("span",{className:"ico ico-heart favorites-empty__ico","aria-hidden":!0}),s.jsx("p",{className:"favorites-empty__title",children:t("myFavorites.emptyTitle")}),s.jsx("p",{className:"muted",children:t("myFavorites.emptyBody")}),s.jsx(c,{className:"btn btn--purple",to:"/assets",children:t("notFound.cta")})]}):s.jsxs("section",{className:"favorites",children:[s.jsxs("div",{className:"favorites__head",children:[s.jsx("h1",{children:t("nav.myFavorites")}),s.jsx("span",{className:"favorites__count",children:t("myFavorites.itemCount",{count:a.length})})]}),s.jsx("div",{className:"grid",children:a.slice(0,i).map(e=>s.jsx(d,{item:e},e.id))}),s.jsx(p,{hasNextPage:i<a.length,isFetching:!1,onLoadMore:()=>o(e=>e+r)})]})}export{N as MyFavorites};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s,L as h}from"./react-yytiy0wi.js";import{a as l,t as r,d as o,e as p,g as x,C as _,h as j}from"./index-
|
|
1
|
+
import{j as s,L as h}from"./react-yytiy0wi.js";import{a as l,t as r,d as o,e as p,g as x,C as _,h as j}from"./index-CzmwWbz1.js";import{L as N}from"./LoadMore-6Uy0vHhH.js";import{u as y}from"./useInfiniteGrid-Dg-jgtmN.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-BPJvc5GU.js";import"./ethers-w2AslR0v.js";import"./intl-CBcMB1D2.js";const g=24;function f(e){try{return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function P({status:e}){return e==="PENDING"?s.jsx("span",{className:"purchase__badge purchase__badge--pending",children:r("myPurchases.processing")}):s.jsx("span",{className:"purchase__badge purchase__badge--done",children:r("myPurchases.completed")})}function v({purchase:e}){const{data:a}=x({queryKey:["trade-display",e.tradeId],queryFn:()=>j(e.tradeId),enabled:!!e.tradeId,staleTime:3e5}),c=(a==null?void 0:a.name)??r("myPurchases.itemFallback"),m=(a==null?void 0:a.thumbnail)??"",i=(a==null?void 0:a.tokenId)??(a==null?void 0:a.itemId)??"",d=a!=null&&a.contractAddress&&i?`/item/${a.contractAddress}/${i}`:void 0,n=s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"purchase__thumb",children:m?s.jsx("img",{src:m,alt:c}):null}),s.jsxs("div",{className:"purchase__info",children:[s.jsx("div",{className:"purchase__name",title:c,children:c}),s.jsx("div",{className:"muted purchase__date",children:f(e.createdAt)})]}),s.jsx(P,{status:e.status}),s.jsxs("div",{className:"purchase__price",children:[s.jsx(_,{className:"ccy-mark"})," ",e.credits]})]});return d?s.jsx(h,{className:"purchase",to:d,children:n}):s.jsx("div",{className:"purchase",children:n})}function S(){l({title:r("nav.myPurchases"),noindex:!0});const{session:e}=o(),{items:a,isLoading:c,hasNextPage:m,isFetchingNextPage:i,fetchNextPage:d}=y(["purchases",e==null?void 0:e.address],t=>p(e.address,e.identity,{first:g,skip:t}),{enabled:!!e});if(!e)return s.jsxs("div",{className:"purchases-empty",children:[s.jsx("span",{className:"ico ico-cart purchases-empty__ico","aria-hidden":!0}),s.jsx("p",{className:"purchases-empty__title",children:r("myPurchases.signInTitle")}),s.jsx("p",{className:"muted",children:r("myPurchases.signInBody")})]});const n=a.filter(t=>t.status!=="EXPIRED");return!c&&n.length===0?s.jsxs("div",{className:"purchases-empty",children:[s.jsx("span",{className:"ico ico-cart purchases-empty__ico","aria-hidden":!0}),s.jsx("p",{className:"purchases-empty__title",children:r("myPurchases.emptyTitle")}),s.jsx("p",{className:"muted",children:r("myPurchases.emptyBody")}),s.jsx(h,{className:"btn btn--purple",to:"/assets",children:r("notFound.cta")})]}):s.jsxs("section",{className:"purchases",children:[s.jsxs("div",{className:"purchases__head",children:[s.jsx("h1",{children:r("nav.myPurchases")}),c?null:s.jsx("span",{className:"purchases__count",children:r("myPurchases.orderCount",{count:n.length})})]}),s.jsx("div",{className:"purchases__list",children:c?Array.from({length:4}).map((t,u)=>s.jsx("div",{className:"purchase purchase--skeleton"},u)):s.jsxs(s.Fragment,{children:[n.map(t=>s.jsx(v,{purchase:t},t.id)),i?Array.from({length:2}).map((t,u)=>s.jsx("div",{className:"purchase purchase--skeleton"},`m-${u}`)):null]})}),s.jsx(N,{hasNextPage:m,isFetching:i,onLoadMore:()=>void d()})]})}export{S as MyPurchases};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as t,L as n}from"./react-yytiy0wi.js";import{a as s,t as o}from"./index-CzmwWbz1.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-BPJvc5GU.js";import"./ethers-w2AslR0v.js";import"./intl-CBcMB1D2.js";function c(){return s({title:o("seo.notFound.title"),noindex:!0}),t.jsxs("div",{className:"notfound","data-testid":"notfound",children:[t.jsx("span",{className:"ico ico-cart notfound__ico","aria-hidden":!0}),t.jsx("h1",{className:"notfound__title",children:o("notFound.title")}),t.jsx("p",{className:"muted",children:o("notFound.body")}),t.jsx(n,{className:"btn btn--purple",to:"/assets",children:o("notFound.cta")})]})}export{c as NotFound,c as default};
|