@dcl/shop 0.1.0-29342337543.commit-e62debf → 0.1.0-29425895395.commit-da7542b
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-De9Qp4KR.js → AnimatedBackground-ByeV6imX.js} +1 -1
- package/assets/Assets-DTeAGuPJ.js +1 -0
- package/assets/{Cart-gIn2SSad.js → Cart-DsKgmI--.js} +1 -1
- package/assets/{CircularProgress-j19iz-El.js → CircularProgress-BrhtD36_.js} +3 -3
- package/assets/{Collection-BZksCNg9.js → Collection-BAOaVoBY.js} +1 -1
- package/assets/{ConstantsUtil-DrbbN8Db.js → ConstantsUtil-rB_9qX5U.js} +1 -1
- package/assets/{Creator-pYPGRDX3.js → Creator-BdIms9yP.js} +1 -1
- package/assets/{ExchangeController-C6LdMnhd.js → ExchangeController-D-XC-Q7k.js} +1 -1
- package/assets/{GetCredits-BFYRErFS.js → GetCredits-DcoRpqyl.js} +2 -2
- package/assets/{HelpersUtil-BMey9OQC.js → HelpersUtil-B2llAX1s.js} +1 -1
- package/assets/{ImportListings-BJS8ANY1.js → ImportListings-DV3t1ZKa.js} +1 -1
- package/assets/ItemDetail--AzXh8S2.css +1 -0
- package/assets/ItemDetail-CW5a5Nwi.js +2 -0
- package/assets/{LoadMore-7qZApSeo.js → LoadMore-8Dx5lULo.js} +1 -1
- package/assets/{MyAssets-n058kEFs.js → MyAssets-CVbI6KU1.js} +1 -1
- package/assets/{MyFavorites-D2YHdh9H.js → MyFavorites-B5MPsVmN.js} +1 -1
- package/assets/{MyPurchases-Cj9XFiMA.js → MyPurchases-Doo71tKL.js} +1 -1
- package/assets/{NetworkUtil-BI8jZwmc.js → NetworkUtil-Cm_KFCNa.js} +1 -1
- package/assets/{NotFound-30ZleK4O.js → NotFound-Hs3P0mMU.js} +1 -1
- package/assets/{RealCheckout-DdB_2aXB.js → RealCheckout-LHxmnnay.js} +1 -1
- package/assets/{SkeletonCards-DSpqiDzZ.js → SkeletonCards-BhzQlTiQ.js} +1 -1
- package/assets/Success-QN2PsOV1.js +1 -0
- package/assets/{SwapController-2gLg4R4h.js → SwapController-BjWS11Jx.js} +1 -1
- package/assets/{TradeService-CxOFjzRK.js → TradeService-B93W8k7Z.js} +1 -1
- package/assets/{W3MFrameProviderSingleton-BwXooI70.js → W3MFrameProviderSingleton-DhBR5OWI.js} +3 -3
- package/assets/{WebCryptoP256-Dtj06UwI.js → WebCryptoP256-CmR7-QI6.js} +1 -1
- package/assets/{basic-Dq2uHR0o.js → basic-DL7JfRe9.js} +1 -1
- package/assets/{biconomy-h_5HWh_l.js → biconomy-BlzKK-1D.js} +1 -1
- package/assets/{browser-D_5JuNNR.js → browser-BMhVVB-A.js} +1 -1
- package/assets/{browser-ponyfill-ClcxEFdz.js → browser-ponyfill-B39o65AB.js} +1 -1
- package/assets/{buy-KvjWmHql.js → buy-CXa71Woo.js} +1 -1
- package/assets/{buy-gasless-DuWzXmm_.js → buy-gasless-D9RsxE8-.js} +1 -1
- package/assets/{ccip-nHQJrzNM.js → ccip-589-7EDe.js} +1 -1
- package/assets/{ccip-9mCO1EZs.js → ccip-CtRmn4Ga.js} +1 -1
- package/assets/{chains-BsN0T6nV.js → chains-ahXbxt0q.js} +1 -1
- package/assets/{collection-ae9B_wBl.js → collection-DYVwsnxc.js} +1 -1
- package/assets/{common-TfzpxC2l.js → common-B5mo5Owz.js} +1 -1
- package/assets/{controller-Bm814olt.js → controller-BLDrOI5f.js} +2 -2
- package/assets/{core-2GzKX_V0.js → core-y8rtgpqz.js} +4 -4
- package/assets/{custom-Dg9059mJ.js → custom-wxLCw85s.js} +1 -1
- package/assets/{data-capture-Cs7uNAyj.js → data-capture-BbWPyRJo.js} +1 -1
- package/assets/{decimals-BozxDRnr.js → decimals-CAZvzZR5.js} +1 -1
- package/assets/decimals-Cv0av6ul.js +1 -0
- package/assets/{detectExtension-BcudqjHr.js → detectExtension-ZdWveqLA.js} +1 -1
- package/assets/{email-CkxGvJ7n.js → email-BQRuUht-.js} +1 -1
- package/assets/{embedded-wallet-DCvtWtAo.js → embedded-wallet-BLW2xyPF.js} +1 -1
- package/assets/{emotion-styled.browser.esm-aJQM59uX.js → emotion-styled.browser.esm-B_soaN1s.js} +1 -1
- package/assets/{engine-DJykDFYI.js → engine-Cw-CqKlR.js} +1 -1
- package/assets/{estimate-l1-fee-BHy3gQeo.js → estimate-l1-fee-B0hGt0xv.js} +1 -1
- package/assets/eth_estimateGas-_wfJOTXO.js +1 -0
- package/assets/{eth_getStorageAt-gLuffVw8.js → eth_getStorageAt-D0GpAnGI.js} +1 -1
- package/assets/eth_getTransactionCount-CluIgStf.js +1 -0
- package/assets/{ethereum-A1QWZFDW.js → ethereum-CfGZ1o2B.js} +1 -1
- package/assets/{ethers-DXxh-eEm.js → ethers-D-4WUfRB.js} +1 -1
- package/assets/{extractIPFS-BuYfN-sn.js → extractIPFS-W8e4LNFu.js} +1 -1
- package/assets/{features-C0YNwzWv.js → features-BksEhTgv.js} +1 -1
- package/assets/{fetchTokenMetadata-DPimZ4m_.js → fetchTokenMetadata-Qg7lxQa0.js} +2 -2
- package/assets/{fortmatic-Beo5lxXY.js → fortmatic-Be6frCcv.js} +1 -1
- package/assets/get-ecosystem-wallet-info-CgXB5b_A.js +1 -0
- package/assets/{getBalance-CRqNHI0S.js → getBalance-jh2K6LR7.js} +2 -2
- package/assets/{getInstalledModules-QJB7fy_4.js → getInstalledModules-Ctee4w-2.js} +1 -1
- package/assets/{getNFT-D0APw_WL.js → getNFT-7fsQ51YF.js} +1 -1
- package/assets/{getNFT-D8bkf2cV.js → getNFT-Cv-zkATn.js} +2 -2
- package/assets/{hashTypedData-BaiVsItZ.js → hashTypedData-DAia9_2x.js} +1 -1
- package/assets/{hashTypedData-C3gUj3RL.js → hashTypedData-DsQdM93d.js} +1 -1
- package/assets/hero-fashion-week-B9LOzkde.png +0 -0
- package/assets/{import-DI2r0vcY.js → import-DRq28X4S.js} +1 -1
- package/assets/{in-app-wallet-calls-Bb3GeV4R.js → in-app-wallet-calls-B8wOMlaR.js} +1 -1
- package/assets/{index-CZE9iM0w.js → index-1B6078wn.js} +1 -1
- package/assets/{index-DYbx7tio.js → index-2hhaqprB.js} +1 -1
- package/assets/{index-Cedadicw.js → index-8GTqRsL8.js} +1 -1
- package/assets/{index-BObGhUwb.js → index-99ltjmK1.js} +1 -1
- package/assets/{index-BGmSS9--.js → index-9L-l30jB.js} +1 -1
- package/assets/{index-CWRdMktG.js → index-B-6KsJls.js} +1 -1
- package/assets/{index-8qREWc4C.js → index-B01xZd7P.js} +1 -1
- package/assets/{index-BJI9-eQ3.js → index-B06bjdNu.js} +1 -1
- package/assets/{index-DgnsXd1K.js → index-B5l_hTjM.js} +1 -1
- package/assets/{index-BFep7uQJ.js → index-B8Qvjapu.js} +1 -1
- package/assets/{index-DXpWAbYJ.js → index-BAdTwWkv.js} +2 -2
- package/assets/{index-BJcsuoFJ.js → index-BJ5f7uEf.js} +2 -2
- package/assets/{index-UUD5CaBO.js → index-BNH4x7b8.js} +1 -1
- package/assets/{index-BOJUx2yW.js → index-BQkCy5n9.js} +1 -1
- package/assets/{index-KbyFXy1r.js → index-BTYYymng.js} +1 -1
- package/assets/{index-DIkXA0Hv.js → index-BYMSEXnr.js} +1 -1
- package/assets/{index-Cpng5QLO.js → index-BZtHn4dc.js} +1 -1
- package/assets/{index-BclUryz1.js → index-Ba1nPvJW.js} +1 -1
- package/assets/{index-Cc4Zz6Zy.js → index-BaSxcMLe.js} +1 -1
- package/assets/{index-CxNuM1Pe.js → index-Bafqag_e.js} +1 -1
- package/assets/{index-DvAy35iS.js → index-Bct-eJWT.js} +44 -44
- package/assets/{index-DoxdT7ta.js → index-Bg3eptuh.js} +1 -1
- package/assets/{index-CS6NyySB.js → index-Bl9wwBWc.js} +1 -1
- package/assets/{index-DxTXRx_1.js → index-BlyErarI.js} +1 -1
- package/assets/index-Bv7abT8U.js +1 -0
- package/assets/{index-B33BKn4f.js → index-By-3NeeE.js} +2 -2
- package/assets/{index-BeV9LW2a.js → index-By4ywqV-.js} +1 -1
- package/assets/{index-B_Ooxv1v.js → index-CB4GdY7Y.js} +1 -1
- package/assets/{index-BYJZLO0l.js → index-CLKnyAON.js} +1 -1
- package/assets/{index-2ABFVZj7.js → index-CPwsN2sj.js} +1 -1
- package/assets/{index-CUDTJiCv.js → index-CQ6rdhhJ.js} +1 -1
- package/assets/{index-CEEwIfoI.js → index-CQsTxitN.js} +1 -1
- package/assets/{index-B_vGP-LB.js → index-CRhMAYc2.js} +1 -1
- package/assets/{index-CTrKkOgC.js → index-CRlcAmHX.js} +1 -1
- package/assets/{index-zdwEHMJV.js → index-C_5ju-So.js} +1 -1
- package/assets/{index-BVmP09nN.js → index-Can6dD45.js} +2 -2
- package/assets/{index-D03fBLru.js → index-CkgQaWIb.js} +1 -1
- package/assets/index-CoFY6_dr.js +12 -0
- package/assets/{index-CGu_c1E3.js → index-CpXIW7YJ.js} +1 -1
- package/assets/{index-V84TKWVc.js → index-CpaPvB9F.js} +1 -1
- package/assets/{index-DQ-JVIh_.js → index-CrmU5-DB.js} +1 -1
- package/assets/index-Ctf6wteV.css +1 -0
- package/assets/{index-CdYVhV-8.js → index-CzzDZduN.js} +1 -1
- package/assets/index-D99Qzmcw.js +74 -0
- package/assets/{index-sdenODYs.js → index-DQwZSjK7.js} +1 -1
- package/assets/{index-CZx6HzWG.js → index-DWEaiDXG.js} +1 -1
- package/assets/{index-DL8xJTzj.js → index-Dxo2QxO8.js} +1 -1
- package/assets/{index-D6jFYOn4.js → index-Fy50YzQ3.js} +1 -1
- package/assets/{index-Cm0Bd7M5.js → index-MNIzeHLm.js} +1 -1
- package/assets/{index-kJ2Om4DY.js → index-MpzRiIaf.js} +1 -1
- package/assets/{index-B9VcNONK.js → index-T55ZcmEP.js} +1 -1
- package/assets/{index-BXZNWPQo.js → index-TZAp1x_0.js} +1 -1
- package/assets/{index-CmnC7TX_.js → index-YExU_uJE.js} +3 -3
- package/assets/{index-1EmEZY58.js → index-_qvHCYVE.js} +1 -1
- package/assets/index-dX-ld8DY.js +1 -0
- package/assets/{index-4fviM57_.js → index-griTOqQM.js} +1 -1
- package/assets/{index-dh70gAb1.js → index-jhNKjUOM.js} +1 -1
- package/assets/{index-B96emzZW.js → index-u1X7CHwF.js} +1 -1
- package/assets/{index-7vBeJ6h0.js → index-v-Gh8W6O.js} +1 -1
- package/assets/{index-BplwFt6_.js → index-xfN1xxGv.js} +3 -3
- package/assets/{index.es-DkJWnksP.js → index.es-BOifPE7F.js} +1 -1
- package/assets/{index.es-COvtwZfe.js → index.es-BpqG8ysp.js} +1 -1
- package/assets/{index.es-BM0IDFYO.js → index.es-CgGnmWs_.js} +4 -4
- package/assets/{localBatchGatewayRequest-BX9seGap.js → localBatchGatewayRequest-C-WCQMC1.js} +1 -1
- package/assets/{mana-rate-BmhpEynZ.js → mana-rate-CN4rx5dQ.js} +1 -1
- package/assets/{native-B9_hMdpy.js → native-8V193B3S.js} +1 -1
- package/assets/network-DGd9L_bm.js +1 -0
- package/assets/{networks-D5uQp84i.js → networks-BeubhJNj.js} +1 -1
- package/assets/{onramp-BcSAlX0-.js → onramp-D0p_Qo-G.js} +1 -1
- package/assets/{openzeppelin-BNaf3Kr3.js → openzeppelin-7g5bSckb.js} +1 -1
- package/assets/{ownerOf-3r-8WATC.js → ownerOf-GjuCbuU_.js} +1 -1
- package/assets/{parseNft-Bc_K1PCu.js → parseNft-BotdSCo9.js} +2 -2
- package/assets/{parseSignature-fjZSf4e-.js → parseSignature-BWX0SlIz.js} +3 -3
- package/assets/{parseSignature-C6RtDqHk.js → parseSignature-DXFRCzS_.js} +1 -1
- package/assets/{pay-with-exchange-DWMiqDBV.js → pay-with-exchange-gAN7UrjF.js} +1 -1
- package/assets/promo-best-rated-emotes-C6kNvB-a.png +0 -0
- package/assets/promo-week-selected-outfits-BBmkZYZx.png +0 -0
- package/assets/{qr-overlay-BevbfqIg.js → qr-overlay-ppf-VMAe.js} +3 -3
- package/assets/{react-CQ5qhqs6.js → react-iAgwec9M.js} +1 -1
- package/assets/{receive-C3dfyqOo.js → receive-DJ4fr4O5.js} +1 -1
- package/assets/{resolveImplementation-DXxkRbEQ.js → resolveImplementation-CS6w70ZZ.js} +1 -1
- package/assets/{rpc-CUZ4dR7x.js → rpc-Dz2VrPFN.js} +1 -1
- package/assets/{secp256k1-D3J1vgG3.js → secp256k1-Blju95DS.js} +1 -1
- package/assets/{secp256k1-Cf36qiOc.js → secp256k1-ChAgiqXn.js} +1 -1
- package/assets/{secp256k1-Bd5EX38Z.js → secp256k1-CmlW72oq.js} +1 -1
- package/assets/{send-C-bE7JsL.js → send-BuW_oiRa.js} +1 -1
- package/assets/{send-batch-transaction-x2iJTEAe.js → send-batch-transaction-BZcfm_Ue.js} +1 -1
- package/assets/{send-eip712-transaction-s2GicVHp.js → send-eip712-transaction-DyA2q1yI.js} +2 -2
- package/assets/{send-gasless-transaction-CZ-7RvQf.js → send-gasless-transaction-B-lY1Xcj.js} +2 -2
- package/assets/{sendRawTransaction-DDaLAHUQ.js → sendRawTransaction-BpRKX6TE.js} +3 -3
- package/assets/{serializeTransaction-9vMytB_d.js → serializeTransaction-BFHyld5T.js} +1 -1
- package/assets/{session-proposal-RKf_pb2T.js → session-proposal-nVsr4NC2.js} +1 -1
- package/assets/{session-request-D7IOp8Re.js → session-request-BIwztPi_.js} +2 -2
- package/assets/{sha256-B7mufoJi.js → sha256-BgQ7bBix.js} +1 -1
- package/assets/{signing-2DKT9LNu.js → signing-0UenPreP.js} +5 -5
- package/assets/{socials-L3VYxM6J.js → socials-D4U3EGzM.js} +1 -1
- package/assets/{swaps-CRa3_MsX.js → swaps-C_TQEj-E.js} +1 -1
- package/assets/{thirdweb-CG-tYItw.js → thirdweb-CTb3Zzwl.js} +3 -3
- package/assets/{totalSupply-ppOlQsps.js → totalSupply-Bs9Yl2ex.js} +1 -1
- package/assets/{trade-encoding-CmkOOQWS.js → trade-encoding-B73Nbkim.js} +1 -1
- package/assets/{transactionReceipt-CGXAX_4G.js → transactionReceipt-CN2DPy3H.js} +1 -1
- package/assets/{transactions-DqEiSEGD.js → transactions-DXFzQImA.js} +1 -1
- package/assets/{useInfiniteGrid-DBBDC6CU.js → useInfiniteGrid-DGtN78WM.js} +1 -1
- package/assets/{utils-CebgHLxz.js → utils-DmMVfaK5.js} +1 -1
- package/assets/{verifyHash-CJuroX1V.js → verifyHash-Yn98Sfxz.js} +1 -1
- package/assets/{w3m-modal-BGeUUrbk.js → w3m-modal-CSom2QAa.js} +1 -1
- package/assets/{w3m-modal-SC-8Yppy.js → w3m-modal-D1P6Fv9L.js} +1 -1
- package/assets/{wait-for-tx-receipt-BNoaz4x5.js → wait-for-tx-receipt-DL9crYq3.js} +1 -1
- package/assets/{wallet-kind-D56TeB0g.js → wallet-kind-C1BAMMs6.js} +1 -1
- package/assets/{wallets-C3sYPWeN.js → wallets-CAmvPFJg.js} +6 -6
- package/assets/{web-connector-Ci6UxTsz.js → web-connector-C5b5Xx9t.js} +3 -3
- package/assets/{writeContract-DjDZhUiF.js → writeContract-CQcKlKF1.js} +1 -1
- package/assets/{zora-sepolia-BXcKZl5q.js → zora-sepolia-6WiqQMBk.js} +1 -1
- package/assets/{zoraTestnet-DecFal9Q.js → zoraTestnet-CUAicz5k.js} +1 -1
- package/index.html +8 -8
- package/package.json +2 -2
- package/assets/Assets-1bNeklxr.js +0 -1
- package/assets/Button-u4Y_U_Lz.js +0 -74
- package/assets/ItemDetail-BfnmM6Wd.js +0 -2
- package/assets/ItemDetail-Casltmsg.css +0 -1
- package/assets/MenuItem-ynqlyh9y.js +0 -9
- package/assets/ShopFooterInner-C2m2Dyez.js +0 -24
- package/assets/Success-DKBdybry.js +0 -1
- package/assets/colors-LINLm1ux.js +0 -1
- package/assets/decimals-CmjPenXw.js +0 -1
- package/assets/eth_estimateGas-4echzN6X.js +0 -1
- package/assets/eth_getTransactionCount-CPFlNa2B.js +0 -1
- package/assets/get-ecosystem-wallet-info-CgRHuJjM.js +0 -1
- package/assets/index-C18kHZS6.js +0 -1
- package/assets/index-C2KSBy5B.js +0 -4
- package/assets/index-D5NMP22o.css +0 -1
- package/assets/index-D_4bro34.js +0 -1
- package/assets/index-r9qogMtw.js +0 -1
- package/assets/network-CirTws7i.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,j as v}from"./react-
|
|
1
|
+
import{r as l,j as v}from"./react-iAgwec9M.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-29425895395.commit-da7542b/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-29425895395.commit-da7542b/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{r as l,j as e,a as fe,d as ye}from"./react-iAgwec9M.js";import{u as xe,i as D,c as ke,v as je,w as ae,h as Ne,q as ge,E as ve,I as R,y as $,H as z,G as V,e as S,ai as Z,x as H,A as J,al as Ce}from"./index-Bct-eJWT.js";import{r as we,a as U,m as Se}from"./mana-rate-CN4rx5dQ.js";import{S as X}from"./SkeletonCards-BhzQlTiQ.js";import{L as Ie}from"./LoadMore-8Dx5lULo.js";import{a as ee}from"./buy-CXa71Woo.js";import{g as Me,a as Ee,w as Fe,S as Pe,G as Ae}from"./buy-gasless-D9RsxE8-.js";import{u as Re}from"./useInfiniteGrid-DGtN78WM.js";import"./ethers-D-4WUfRB.js";import"./index-CQ6rdhhJ.js";import"./trade-encoding-B73Nbkim.js";function $e(){return xe({queryKey:["mana-rate",D.chainId],queryFn:()=>we(D.chainId),staleTime:6e4,refetchInterval:6e4,retry:1})}const Le=[{key:"all",label:"Shop All"},{key:"wearable",label:"Wearables",expandable:!0,subs:[{key:"Head",label:"Head",icon:"cat-head"},{key:"Upper Body",label:"Upper Body",icon:"cat-upper"},{key:"Handwear",label:"Handwear",icon:"cat-handwear"},{key:"Lower Body",label:"Lower Body",icon:"cat-lower"},{key:"Feet",label:"Feet",icon:"cat-feet"},{key:"Accessories",label:"Accessories",icon:"cat-accessories"},{key:"Skins",label:"Skins",icon:"cat-skins"}]},{key:"emote",label:"Emotes",expandable:!0,subs:[{key:"Dance",label:"Dance",icon:"emote-dance"},{key:"Stunt",label:"Stunt",icon:"emote-stunt"},{key:"Greetings",label:"Greetings",icon:"emote-greetings"},{key:"Fun",label:"Fun",icon:"emote-fun"},{key:"Poses",label:"Poses",icon:"emote-poses"},{key:"Reactions",label:"Reactions",icon:"emote-reactions"},{key:"Horror",label:"Horror",icon:"emote-horror"},{key:"Miscellaneous",label:"Miscellaneous",icon:"emote-misc"}]}];function Be({category:s,subCategory:c,onCategory:d,onSub:_}){const[t,i]=l.useState(()=>s==="wearable"?"wearable":null);function y(r){r.subs?i(h=>{const m=h!==r.key;return m&&d(r.key),m?r.key:null}):(d(r.key),i(null))}return e.jsx("div",{className:"catfilter",children:Le.map(r=>{const h=t===r.key&&!!r.subs,m=r.key===s;return e.jsxs("div",{className:"catfilter__group",children:[e.jsxs("button",{type:"button",className:`catfilter__cat${h?" is-expanded":""}${m?" is-selected":""}`,onClick:()=>y(r),children:[e.jsx("span",{className:"catfilter__cat-label",children:r.label}),r.expandable?e.jsx("span",{className:`ico ico-chevron catfilter__chev${h?" is-up":""}`,"aria-hidden":!0}):null]}),r.subs?e.jsx("div",{className:`catfilter__subs${h?" is-open":""}`,children:e.jsx("div",{className:"catfilter__subs-inner",children:r.subs.map(n=>e.jsx("button",{type:"button",className:`catfilter__sub${c===n.key?" is-active":""}`,onClick:()=>_(c===n.key?null:n.key),children:e.jsxs("span",{className:"catfilter__sub-left",children:[e.jsx("span",{className:`ico ico-${n.icon} catfilter__sub-ico`,"aria-hidden":!0}),e.jsx("span",{className:"catfilter__sub-label",children:n.label})]})},n.key))})}):null]},r.key)})})}const qe=["common","uncommon","rare","epic","legendary","mythic","unique","exotic"],K=[{key:"newest",label:"Newest",server:"newest"},{key:"price-asc",label:"Cheapest",server:"cheapest"},{key:"price-desc",label:"Most Expensive",server:"most_expensive"},{key:"name",label:"Name (A–Z)",server:"name"}];function Ge({panelKey:s,label:c,active:d,badge:_,align:t="left",panel:i,children:y}){const r=i.open===s,h=t==="right"?"filterbar__sort":"filterbar__trigger";return e.jsxs("div",{className:"filterbar__item",children:[e.jsxs("button",{className:`${h}${r?" is-open":""}${d?" is-active":""}`,onClick:()=>i.toggle(s),children:[c," ",_?e.jsx("span",{className:"filterbar__badge",children:_}):null," ",e.jsx("span",{className:`ico ico-chevron filterbar__chev${r?" is-up":""}`,"aria-hidden":!0})]}),r?y:null]})}function Te({sort:s,onSort:c,sortOptions:d=K,total:_,loading:t,query:i,onOpenFilters:y}){const[r,h]=l.useState(null),m={open:r,toggle:n=>h(g=>g===n?null:n),close:()=>h(null)};return e.jsxs(e.Fragment,{children:[r?e.jsx("div",{className:"filterbar__scrim",onClick:m.close,"aria-hidden":!0}):null,e.jsxs("div",{className:"browse__toolbar",children:[e.jsxs("span",{className:"browse__count",children:[t?"…":`${_.toLocaleString()} Item${_===1?"":"s"}`,i?` for “${i}”`:""]}),e.jsxs("div",{className:"browse__dropdowns",children:[y?e.jsxs("button",{type:"button",className:"browse__filters-btn",onClick:y,children:[e.jsx("span",{className:"ico ico-filter","aria-hidden":!0}),"Filters"]}):null,e.jsx(Ge,{panelKey:"sort",label:"Sort By",align:"right",panel:m,children:e.jsx("div",{className:"filter-pop filter-pop--sort",children:d.map(n=>e.jsx("button",{className:`filter-pop__sort${n.key===s?" is-active":""}`,onClick:()=>{c(n.key),m.close()},children:n.label},n.key))})})]})]})]})}function se(s){const c=s,d=(c.message??"").toLowerCase();return c.code===4001||d.includes("reject")||d.includes("denied")||d.includes("cancel")?"You cancelled the request.":d.includes("insufficient")?`Not enough ${H.name} — get more first.`:d.includes("not found")||d.includes("no active listing")||d.includes("404")?"This item was just sold or removed. Refreshing the market…":d.includes("your own listing")?"You can't buy your own listing.":"Couldn't complete checkout — please try again."}function We(s){return{id:s.tradeId,tradeId:s.tradeId,name:s.name,creator:s.creator,contractAddress:s.contractAddress,itemId:s.itemId,category:s.category,wearableCategory:s.wearableCategory??void 0,rarity:s.rarity,network:s.network,chainId:s.chainId,thumbnail:s.thumbnail,priceCredits:0,gender:null}}function Oe({listing:s,rate:c,onClose:d,onSold:_}){const{session:t}=ke(),{data:i}=je(t),y=ae(),r=fe(),[h,m]=l.useState("confirm"),[n,g]=l.useState("Locking today’s price…"),[I,k]=l.useState(null),[o,P]=l.useState(null),j=l.useRef(null),M=Math.ceil(U(s.manaWei,c)/10);l.useEffect(()=>{let f=!1;if(!t){m("error"),k("Sign in to check out.");return}return(async()=>{try{const u=await Ne(s.tradeId);if(!u)throw new Error("not found");if(ge(u,t.address))throw new Error("You can't buy your own listing.");const b=U(s.manaWei,c);if(!Number.isFinite(b)||b<=0)throw new Error("price unavailable");const{credit:N,maxCreditedValue:F,usdCents:A}=await ve(t.identity,b,s.tradeId);if(f){R(t.identity,[N.id]).catch(()=>{});return}j.current=N.id,P({trade:u,credit:N,maxCreditedValue:F,usdCents:A,credits:Math.ceil(A/10)}),g("")}catch(u){if(f)return;console.error("[market] authorize failed",u),$(V(u)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:z(u),value_usd:Math.round(U(s.manaWei,c))/100}),m("error"),k(se(u))}})(),()=>{f=!0,j.current&&t&&(R(t.identity,[j.current]).catch(()=>{}),j.current=null)}},[]);const v=!!o&&((i==null?void 0:i.credits)??0)<o.credits;async function L(){if(!t||!o)return;if(v){R(t.identity,[o.credit.id]).catch(()=>{}),j.current=null,r("/credits");return}m("working"),k(null);let f=!1;try{g("Confirming your purchase…");const u={trade:o.trade,buyer:t.address,signer:t.signer,credits:[o.credit],maxCreditedValue:o.maxCreditedValue};let b;if(Me())try{b=await Ee(u),await Fe(b),f=!0}catch(N){if(N instanceof Pe)f=!0;else if(N instanceof Ae)b=await ee(u);else throw N}else b=await ee(u);j.current=null,$("Shop Completed Purchase",{items:[{item_id:s.itemId??null,contract_address:s.contractAddress,token_id:null,price_usd:o.usdCents/100}],value_credits:o.credits,value_usd:o.usdCents/100,purchase_type:"item",is_primary:!0,payment_type:"credits",no_crypto_step:f,transaction_hash:b??null}),y.invalidateQueries({queryKey:["usd-balance"]}),r("/success",{state:{items:[We(s)],txHash:b}})}catch(u){console.error("[market] buy now failed",u),R(t.identity,[o.credit.id]).catch(()=>{}),j.current=null,$(V(u)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:z(u),value_usd:o.usdCents/100}),y.invalidateQueries({queryKey:["usd-balance"]});const b=se(u);k(b),m("error"),/sold or removed/i.test(b)&&_()}}function E(){t&&o&&R(t.identity,[o.credit.id]).catch(()=>{}),j.current=null,d()}const x=h==="working";return e.jsxs("div",{className:"mkt-modal",role:"dialog","aria-modal":"true","aria-label":`Buy ${s.name}`,children:[e.jsx("div",{className:"mkt-modal__scrim",onClick:x?void 0:E,"aria-hidden":!0}),e.jsxs("div",{className:"mkt-modal__card",children:[e.jsxs("div",{className:"mkt-modal__head",children:[e.jsx("div",{className:"mkt-modal__thumb",children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:""}):null}),e.jsxs("div",{children:[e.jsx("div",{className:"mkt-modal__name",title:s.name,children:s.name||"Item"}),e.jsx("span",{className:"chip chip--rarity",children:s.rarity})]})]}),e.jsx("div",{className:"mkt-modal__price",children:o?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mkt-modal__price-label",children:"Final price"}),e.jsxs("div",{className:"mkt-modal__price-value",children:[e.jsx(S,{className:"mkt-modal__diamond"}),Z(o.credits)]}),e.jsxs("div",{className:"mkt-modal__price-sub muted",children:["Locked for this purchase · $",(o.usdCents/100).toFixed(2)]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mkt-modal__price-label",children:"Today’s price"}),e.jsxs("div",{className:"mkt-modal__price-value mkt-modal__price-value--approx",children:[e.jsx("span",{className:"mkt-modal__approx","aria-hidden":!0,children:"≈"}),e.jsx(S,{className:"mkt-modal__diamond"}),Z(M)]}),e.jsx("div",{className:"mkt-modal__price-sub muted",children:n||"Locking today’s price…"})]})}),t?e.jsxs("div",{className:"mkt-modal__balance muted",children:["Your balance: ",e.jsx(S,{className:"ccy-mark"})," ",(i==null?void 0:i.credits)??0]}):null,v?e.jsxs("p",{className:"muted mkt-modal__note",children:["You’ll need a few more ",H.name," to buy this."]}):null,n&&h==="working"?e.jsx("p",{className:"muted mkt-modal__note",children:n}):null,I?e.jsx("p",{className:"error mkt-modal__note",children:I}):null,e.jsxs("div",{className:"mkt-modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:E,disabled:x,children:"Cancel"}),e.jsx("button",{className:"btn btn--purple",onClick:L,disabled:x||!o,children:x?"Buying…":v?`Get ${H.name}`:"Confirm purchase"})]})]})]})}const Ue=48,C=1e5,He={Head:["head","hat","hair","facial_hair","eyes","eyebrows","mouth","mask","helmet","tiara","top_head"],"Upper Body":["upper_body"],Handwear:["hands_wear"],"Lower Body":["lower_body"],Feet:["feet"],Accessories:["earring","eyewear"],Skins:["skin"],Dance:["dance"],Stunt:["stunt"],Greetings:["greetings"],Fun:["fun"],Poses:["poses"],Reactions:["reactions"],Horror:["horror"],Miscellaneous:["miscellaneous"]};function Ke(s){return{tradeId:s.tradeId??s.id,listingType:"primary",contractAddress:s.contractAddress,itemId:s.itemId??"",name:s.name,thumbnail:s.thumbnail,rarity:s.rarity,category:s.category,wearableCategory:s.wearableCategory??null,creator:s.creator,manaWei:s.manaWei??"0",available:1,network:s.network,chainId:s.chainId,createdAt:0}}function rs(){const[s]=ye(),c=(s.get("q")??"").trim().toLowerCase(),d=ae(),[_,t]=l.useState("wearable"),[i,y]=l.useState(null),[r,h]=l.useState([]),[m,n]=l.useState(""),[g,I]=l.useState(""),[k,o]=l.useState("newest"),[P,j]=l.useState(!1),[M,v]=l.useState(!1),[L,E]=l.useState(null);l.useEffect(()=>{if(!M)return;const a=p=>{p.key==="Escape"&&v(!1)};return document.addEventListener("keydown",a),()=>document.removeEventListener("keydown",a)},[M]);const x=m&&!Number.isNaN(Number(m))?Number(m):void 0,f=g&&!Number.isNaN(Number(g))?Number(g):void 0,u=i?He[i]:void 0,b=(K.find(a=>a.key===k)??K[0]).server,N={category:_,rarities:r.length?r:void 0,wearableCategories:u,minPriceCredits:x,maxPriceCredits:f,search:c||void 0,sortBy:b},{items:F,total:A,isLoading:w,error:re,hasNextPage:te,isFetchingNextPage:Y,fetchNextPage:ie}=Re(["unified-listings",N],a=>Ce({...N,first:Ue,skip:a})),B=A,{data:q,isError:ne}=$e(),le=a=>q&&a.manaWei?Se(a.manaWei,q):null,Q=l.useRef(null);l.useEffect(()=>{w||!c||Q.current===c||(Q.current=c,$("Shop Searched",{query:c,result_count:B}))},[c,w,B]);const G=l.useRef("__init__");l.useEffect(()=>{if(w)return;const a=JSON.stringify({category:_,subCategory:i,rarities:r,min:x,max:f,sort:k});if(G.current==="__init__"||G.current===a){G.current=a;return}G.current=a,$("Shop Applied Filter",{filters:{category:_,sub_category:i,rarities:r,min_price_credits:x??null,max_price_credits:f??null,sort:k},result_count:B})},[_,i,r,x,f,k,w,B]);function ce(a){t(a),y(null)}function oe(a){h(p=>p.includes(a)?p.filter(O=>O!==a):[...p,a])}function de(){t("wearable"),y(null),h([]),n(""),I("")}function ue(a){const p=F.find(O=>O.id===a.id);p&&p.source==="legacy"&&p.manaWei&&E(Ke(p))}function me(){d.invalidateQueries({queryKey:["unified-listings"]})}const T=x!=null?Math.min(x,C):0,W=f!=null?Math.min(f,C):C,he=T/C*100,pe=W/C*100;function _e(a){const p=Math.min(a,W);n(p<=0?"":String(p))}function be(a){const p=Math.max(a,T);I(p>=C?"":String(p))}return e.jsxs("div",{className:"browse browse--sidebar",children:[M?e.jsx("div",{className:"browse__scrim",onClick:()=>v(!1),"aria-hidden":!0}):null,e.jsxs("aside",{className:`browse__sidebar${M?" is-open":""}`,children:[e.jsxs("div",{className:"browse__sidebar-head",children:[e.jsx("span",{className:"browse__sidebar-title",children:"Filters"}),e.jsx("button",{className:"browse__sidebar-close",onClick:()=>v(!1),"aria-label":"Close filters",children:"✕"})]}),e.jsx("div",{className:"sidebar__section-label",children:"Category"}),e.jsx(Be,{category:_,subCategory:i,onCategory:ce,onSub:y}),e.jsx("div",{className:"sidebar__divider"}),e.jsx("div",{className:"sidebar__section-label",children:"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:"Min"}),e.jsxs("span",{className:"price-filter__box",children:[e.jsx(S,{className:"price-filter__coin"}),e.jsx("input",{type:"number",min:"0","aria-label":"Minimum price",placeholder:"0",value:m,onChange:a=>n(a.target.value)})]})]}),e.jsx("span",{className:"price-filter__to",children:"to"}),e.jsxs("label",{className:"price-filter__field",children:[e.jsx("span",{className:"price-filter__field-label",children:"Max"}),e.jsxs("span",{className:"price-filter__box",children:[e.jsx(S,{className:"price-filter__coin"}),e.jsx("input",{type:"number",min:"0","aria-label":"Maximum price",placeholder:"0",value:g,onChange:a=>I(a.target.value)})]})]})]}),e.jsxs("div",{className:"price-filter__slider",style:{"--min-pct":`${he}%`,"--max-pct":`${pe}%`},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:C,value:T,"aria-label":"Minimum price slider",onChange:a=>_e(Number(a.target.value))}),e.jsx("input",{type:"range",min:0,max:C,value:W,"aria-label":"Maximum price slider",onChange:a=>be(Number(a.target.value))})]}),e.jsxs("div",{className:"price-filter__range",children:[e.jsxs("span",{className:"price-filter__range-val",children:[e.jsx(S,{className:"price-filter__coin"}),T.toLocaleString()]}),e.jsxs("span",{className:"price-filter__range-val",children:[e.jsx(S,{className:"price-filter__coin"}),W.toLocaleString()]})]})]}),e.jsx("div",{className:"sidebar__divider"}),e.jsxs("button",{type:"button",className:"sidebar__section-toggle","aria-expanded":P,onClick:()=>j(a=>!a),children:[e.jsx("span",{className:"sidebar__section-label",children:"Rarity"}),e.jsx("span",{className:`ico ico-chevron sidebar__section-chev${P?" is-up":""}`,"aria-hidden":!0})]}),P?e.jsx("div",{className:"rarity-filter",children:qe.map(a=>e.jsxs("label",{className:`rarity-filter__check${r.includes(a)?" is-on":""}`,children:[e.jsx("input",{type:"checkbox",checked:r.includes(a),onChange:()=>oe(a)}),e.jsx("span",{children:a})]},a))}):null,e.jsxs("div",{className:"browse__sidebar-foot",children:[e.jsx("button",{type:"button",className:"browse__clear",onClick:de,children:"Clear Filters"}),e.jsx("button",{type:"button",className:"browse__apply",onClick:()=>v(!1),children:"Apply"})]})]}),e.jsxs("div",{className:"browse__main",children:[e.jsx(Te,{sort:k,onSort:o,total:A,loading:w,query:c,onOpenFilters:()=>v(!0)}),ne&&F.some(a=>a.source==="legacy")?e.jsx("p",{className:"market-banner market-banner--warn",children:"Some market prices are temporarily unavailable — buying those items is paused for a moment. Please try again shortly."}):null,re?e.jsx("p",{className:"error",children:"Couldn’t load items — please try again."}):null,e.jsx("div",{className:"grid",children:w?e.jsx(X,{count:15}):e.jsxs(e.Fragment,{children:[F.map(a=>a.source==="legacy"?e.jsx(J,{item:a,mode:"market",marketPriceCredits:le(a),onBuyNow:ue},a.id):e.jsx(J,{item:a},a.id)),Y?e.jsx(X,{count:6}):null]})}),e.jsx(Ie,{hasNextPage:te,isFetching:Y,onLoadMore:()=>ie()}),!w&&F.length===0?e.jsx("p",{className:"muted",children:"No items match your filters."}):null]}),L&&q?e.jsx(Oe,{listing:L,rate:q,onClose:()=>E(null),onSold:()=>{E(null),me()}}):null]})}export{rs as Assets};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ee,r as x,j as s,L as A}from"./react-
|
|
1
|
+
import{a as ee,r as x,j as s,L as A}from"./react-iAgwec9M.js";import{q as se,s as te,m as P,c as ae,u as re,v as ne,w as ce,t as R,C as ie,e as I,x as Q,A as le,y as F,z as B,D as q,E as oe,F as de,G as D,H as ue,I as he,h as me,J as pe,K as fe}from"./index-Bct-eJWT.js";import{b as K}from"./buy-CXa71Woo.js";import{g as _e,b as ye,w as ge,S as be,G as xe}from"./buy-gasless-D9RsxE8-.js";import"./ethers-D-4WUfRB.js";import"./trade-encoding-B73Nbkim.js";import"./index-CQ6rdhhJ.js";function ve(t){return Math.ceil(t/10)}async function je(t,r,d){var C;const g=[],a=[],v=[];for(const n of t)try{const m=await d(n);if(!m){a.push(n);continue}if(se(m,r)){v.push(n);continue}const c=te((C=m.received[0])==null?void 0:C.amount);if(!Number.isFinite(c)||c<=0){a.push(n);continue}g.push({item:n,trade:m,usdCents:c,priceCredits:ve(c)})}catch{a.push(n)}const j=g.reduce((n,m)=>n+m.priceCredits,0),p=a.length>0||v.length>0||g.some(n=>n.priceCredits!==n.item.priceCredits);return{buyable:g,unavailable:a,own:v,liveTotalCredits:j,orderChanged:p}}function O(t){const r=t,d=(r.message??"").toLowerCase();return r.code===4001||d.includes("reject")||d.includes("denied")||d.includes("cancel")?"You cancelled the request.":d.includes("insufficient")?`You don't have enough ${Q.name} — get more first.`:d.includes("no active listing")||d.includes("your own listing")?r.message:"Couldn't complete checkout — please try again."}const Ce=12e4;function Ne(t){const r=[];return t.unavailable.length&&r.push(`${t.unavailable.length} no longer available`),t.own.length&&r.push(`${t.own.length} you can't buy (your own listing)`),`Removed ${r.join(" and ")} from your cart.`}function Ie(){const t=P(e=>e.items),r=P(e=>e.remove),d=P(e=>e.clear),g=P(e=>e.setFittingOpen),{session:a}=ae(),v=t.some(e=>e.category!=="emote"),{data:j}=re({queryKey:["upsell-listings"],queryFn:()=>fe({first:40}),staleTime:6e4}),{data:p}=ne(a),C=ce(),n=ee(),[m,c]=x.useState(null),[z,f]=x.useState(null),[G,S]=x.useState(null),[N,E]=x.useState(!1),[u,w]=x.useState(null),L=x.useRef(0),T=t.reduce((e,i)=>e+i.priceCredits,0),H=u?u.liveTotalCredits:T,V=new Set(t.map(e=>e.id)),M=((j==null?void 0:j.items)??[]).filter(e=>!V.has(e.id)).slice(0,6),J=new Map(u==null?void 0:u.buyable.map(e=>[e.item.id,e])),X=e=>e.tradeId?me(e.tradeId):pe(e.contractAddress,e.itemId??"");function U(e){e(),w(null),S(null),f(null)}async function W(e){if(!a||e.length===0)return;const i=e.map(l=>({...l.item,priceCredits:l.priceCredits})),y=[];let k="authorize",$=!1;try{c("Preparing your order…");const l=[];for(const o of e){const{credit:b,maxCreditedValue:_}=await oe(a.identity,o.usdCents,o.item.tradeId);y.push(b.id),l.push({trade:o.trade,credits:[b],maxCreditedValue:_})}c("Confirming your purchase…"),k="submit";let h=[];if(_e())try{h=await ye({purchases:l,buyer:a.address,signer:a.signer});const b=(await Promise.allSettled(h.map(_=>ge(_)))).flatMap(_=>_.status==="rejected"?[_.reason]:[]);if(b.length&&!b.some(_=>_ instanceof be))throw b[0];$=!0}catch(o){if(!(o instanceof xe))throw o;h=await K({purchases:l,buyer:a.address,signer:a.signer})}else h=await K({purchases:l,buyer:a.address,signer:a.signer});e.forEach(o=>r(o.item.id)),w(null),c("Purchased! 🎉"),F("Shop Completed Purchase",{...de(i),payment_type:"credits",no_crypto_step:$,transaction_hash:h[0]??null}),C.invalidateQueries({queryKey:["usd-balance"]}),n("/success",{state:{items:i,txHash:h[0]}})}catch(l){if(D(l)||q(l,{flow:"cart_checkout",step:k,cart_size:e.length}),F(D(l)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:k,error_code:ue(l),value_usd:B(i.reduce((h,o)=>h+o.priceCredits,0)),cart_size:e.length}),y.length){try{await he(a.identity,y)}catch(h){q(h,{flow:"cart_checkout",step:"release"})}C.invalidateQueries({queryKey:["usd-balance"]})}f(O(l)),c(null)}}async function Y(){if(!a){f("Sign in to check out.");return}f(null),S(null),E(!0),F("Shop Started Checkout",{cart_size:t.length,cart_value_credits:T,cart_value_usd:B(T),has_sufficient_credits:((p==null?void 0:p.credits)??0)>=T});try{c("Reviewing your cart…");const e=await je(t,a.address,X),i=[...e.unavailable,...e.own];if(i.length&&(i.forEach(y=>r(y.id)),S(Ne(e))),e.buyable.length===0){f("None of these items are available to buy right now."),w(null),c(null);return}if(e.orderChanged){w(e),L.current=Date.now(),c(null);return}await W(e.buyable)}catch(e){q(e,{flow:"cart_checkout",step:"review",cart_size:t.length}),f(O(e)),c(null)}finally{E(!1)}}async function Z(){if(u){if(!a){f("Sign in to check out.");return}if(Date.now()-L.current>Ce){w(null),S(null),await Y();return}f(null),E(!0);try{await W(u.buyable)}finally{E(!1)}}}return t.length===0?s.jsxs("div",{className:"cart cart--empty",children:[s.jsx("span",{className:"ico ico-cart cart-empty__ico","aria-hidden":!0}),s.jsx("p",{className:"cart-empty__title",children:R("cart.empty.title")}),s.jsx("p",{className:"muted",children:R("cart.empty.body")}),s.jsx(A,{className:"btn btn--purple",to:"/assets",children:R("cart.empty.cta")})]}):s.jsxs("div",{className:"cart",children:[s.jsxs("h1",{children:["Cart (",t.length,")"]}),s.jsxs("div",{className:"cart__body",children:[s.jsxs("div",{className:"cart__main",children:[s.jsx("div",{className:"cart__list",children:t.map(e=>{const i=J.get(e.id),y=i?i.priceCredits:e.priceCredits,k=!!i&&i.priceCredits!==e.priceCredits;return s.jsxs("div",{className:"cart__row",children:[s.jsx("div",{className:"cart__thumb",children:e.thumbnail?s.jsx("img",{src:e.thumbnail,alt:e.name}):null}),s.jsxs("div",{className:"cart__info",children:[s.jsx("div",{className:"cart__name",children:e.name}),e.creator?s.jsx(ie,{address:e.creator,className:"cart__creator",linkToProfile:!0}):null]}),s.jsxs("div",{className:"cart__price",children:[s.jsx(I,{className:"ccy-mark"})," ",y,k?s.jsx("span",{className:"muted",style:{marginLeft:6,textDecoration:"line-through"},children:e.priceCredits}):null]}),s.jsx("button",{className:"cart__remove",onClick:()=>U(()=>r(e.id)),disabled:N,"aria-label":`Remove ${e.name}`,title:"Remove",children:s.jsx("span",{className:"ico ico-trash","aria-hidden":!0})})]},e.id)})}),s.jsxs("div",{className:"cart__utils",children:[s.jsx("button",{className:"link",onClick:()=>U(d),disabled:N,children:"Clear cart"}),null]})]}),s.jsxs("aside",{className:"cart__summary",children:[s.jsx("h2",{className:"cart__summary-title",children:"Order summary"}),s.jsxs("div",{className:"cart__total",children:[s.jsxs("div",{className:"cart__total-line",children:[s.jsx("span",{children:"Total"}),s.jsxs("strong",{children:[s.jsx(I,{className:"ccy-mark"})," ",H]})]}),a?s.jsxs("div",{className:"muted cart__balance",children:["Your balance: ",s.jsx(I,{className:"ccy-mark"})," ",(p==null?void 0:p.credits)??0]}):null]}),s.jsxs("div",{className:"cart__actions",children:[s.jsx("button",{className:"btn btn--purple cart__checkout",onClick:u?Z:Y,disabled:N,children:N?"Working…":u?"Confirm purchase":"Checkout"}),s.jsxs(A,{className:"btn btn--ghost",to:"/credits",children:["Get ",Q.name]}),v?s.jsx("button",{className:"btn btn--ghost",onClick:()=>g(!0),disabled:N,children:"Try on outfit"}):null]}),u?s.jsx("p",{className:"muted cart__msg",children:"Prices or availability changed since you added these — review the updated total and confirm to buy."}):null,G?s.jsx("p",{className:"muted cart__msg",children:G}):null,m?s.jsx("p",{className:"muted cart__msg",children:m}):null,z?s.jsx("p",{className:"error cart__msg",children:z}):null]})]}),M.length>0?s.jsxs("section",{className:"row cart-upsell",children:[s.jsx("div",{className:"row__head",children:s.jsx("h2",{className:"row__title",children:"You might also like"})}),s.jsx("div",{className:"row__track",children:M.map(e=>s.jsx(le,{item:e},e.id))})]}):null]})}export{Ie as Cart};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{S as N,T as U,U as w,V as z,X as o,Y as E,Z as c,$ as I,a0 as g,a1 as D,a2 as M}from"./index-Bct-eJWT.js";import{r as F,j as v}from"./react-iAgwec9M.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
|
}
|
|
@@ -6,7 +6,7 @@ import{R as N,S as U,T as w,U as z,V as o,X as E,Y as c,Z as I,$ as g,a0 as D,a1
|
|
|
6
6
|
100% {
|
|
7
7
|
transform: rotate(360deg);
|
|
8
8
|
}
|
|
9
|
-
`)),Z=
|
|
9
|
+
`)),Z=M(S||(S=l`
|
|
10
10
|
0% {
|
|
11
11
|
stroke-dasharray: 1px, 200px;
|
|
12
12
|
stroke-dashoffset: 0;
|
|
@@ -25,4 +25,4 @@ import{R as N,S as U,T as w,U as z,V as o,X as E,Y as c,Z as I,$ as g,a0 as D,a1
|
|
|
25
25
|
animation: ${0} 1.4s linear infinite;
|
|
26
26
|
`),W)),L=g("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(r,e)=>e.svg})({display:"block"}),T=g("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(r,e)=>{const{ownerState:s}=r;return[e.circle,e[`circle${c(s.variant)}`],s.disableShrink&&e.circleDisableShrink]}})(({ownerState:r,theme:e})=>o({stroke:"currentColor"},r.variant==="determinate"&&{transition:e.transitions.create("stroke-dashoffset")},r.variant==="indeterminate"&&{strokeDasharray:"80px, 200px",strokeDashoffset:0}),({ownerState:r})=>r.variant==="indeterminate"&&!r.disableShrink&&D($||($=l`
|
|
27
27
|
animation: ${0} 1.4s ease-in-out infinite;
|
|
28
|
-
`),Z)),q=F.forwardRef(function(e,s){const a=w({props:e,name:"MuiCircularProgress"}),{className:d,color:u="primary",disableShrink:
|
|
28
|
+
`),Z)),q=F.forwardRef(function(e,s){const a=w({props:e,name:"MuiCircularProgress"}),{className:d,color:u="primary",disableShrink:R=!1,size:m=40,style:_,thickness:i=3.6,value:p=0,variant:k="indeterminate"}=a,j=z(a,V),n=o({},a,{color:u,disableShrink:R,size:m,thickness:i,value:p,variant:k}),f=B(n),h={},x={},y={};if(k==="determinate"){const C=2*Math.PI*((t-i)/2);h.strokeDasharray=C.toFixed(3),y["aria-valuenow"]=Math.round(p),h.strokeDashoffset=`${((100-p)/100*C).toFixed(3)}px`,x.transform="rotate(-90deg)"}return v.jsx(G,o({className:E(f.root,d),style:o({width:m,height:m},x,_),ownerState:n,ref:s,role:"progressbar"},y,j,{children:v.jsx(L,{className:f.svg,ownerState:n,viewBox:`${t/2} ${t/2} ${t} ${t}`,children:v.jsx(T,{className:f.circle,style:h,ownerState:n,cx:t,cy:t,r:(t-i)/2,fill:"none",strokeWidth:i})})}))});export{q as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as j,a as _,j as e}from"./react-
|
|
1
|
+
import{u as j,a as _,j as e}from"./react-iAgwec9M.js";import{u as N,t as u,C as f,A as b,f as C,a as A}from"./index-Bct-eJWT.js";import{A as v}from"./collection-DYVwsnxc.js";import{S as h}from"./SkeletonCards-BhzQlTiQ.js";import{L as y}from"./LoadMore-8Dx5lULo.js";import{u as L}from"./useInfiniteGrid-DGtN78WM.js";import"./ethers-D-4WUfRB.js";const P=48;function B(){var d;const{contractAddress:a}=j(),p=_(),{items:t,total:o,isLoading:l,error:r,hasNextPage:g,isFetchingNextPage:n,fetchNextPage:x}=L(["collection-page",a],c=>C(a,{first:P,skip:c}),{enabled:!!a}),{data:s}=N({queryKey:["collection-meta",a],queryFn:()=>A(a),enabled:!!a,staleTime:5*6e4}),i=(s==null?void 0:s.name)||u("collection.fallbackTitle"),m=(s==null?void 0:s.creator)||((d=t[0])==null?void 0:d.creator);return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":"Breadcrumb",children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>p("/assets"),children:u("collection.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:i})]}),e.jsxs("header",{className:"collection-page__head",children:[e.jsx("h1",{className:"collection-page__title",children:i}),m?e.jsx(f,{address:m,className:"collection-page__creator"}):null,e.jsx("span",{className:"muted collection-page__count",children:l?"…":`${o.toLocaleString()} item${o===1?"":"s"}`})]}),!l&&t.length>0?e.jsx(v,{items:t,source:"collection"}):null,r?e.jsx("p",{className:"error",children:"Couldn’t load this collection — please try again."}):null,e.jsx("div",{className:"grid",children:l?e.jsx(h,{count:12}):e.jsxs(e.Fragment,{children:[t.map(c=>e.jsx(b,{item:c},c.id)),n?e.jsx(h,{count:6}):null]})}),e.jsx(y,{hasNextPage:g,isFetching:n,onLoadMore:()=>x()}),!l&&!r&&t.length===0?e.jsx("p",{className:"muted",children:"This collection has no items to show."}):null]})}export{B as Collection,B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t}from"./ethers-
|
|
1
|
+
import{p as t}from"./ethers-D-4WUfRB.js";var e={};const o={ACCOUNT_TABS:[{label:"Tokens"},{label:"Activity"}],SECURE_SITE_ORIGIN:(typeof t<"u"&&typeof e<"u"?e.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",VIEW_DIRECTION:{Next:"next",Prev:"prev"},ANIMATION_DURATIONS:{HeaderText:120},VIEWS_WITH_LEGAL_FOOTER:["Connect","ConnectWallets","OnRampTokenSelect","OnRampFiatSelect","OnRampProviders"],VIEWS_WITH_DEFAULT_FOOTER:["Networks"]};export{o as C};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,u as g,a as p}from"./react-
|
|
1
|
+
import{j as e,u as g,a as p}from"./react-iAgwec9M.js";import{k as i,C as h,A as x,l as j}from"./index-Bct-eJWT.js";import{A as f}from"./collection-DYVwsnxc.js";import{S as m}from"./SkeletonCards-BhzQlTiQ.js";import{L as N}from"./LoadMore-8Dx5lULo.js";import{u as b}from"./useInfiniteGrid-DGtN78WM.js";import"./ethers-D-4WUfRB.js";function _({address:s,className:r=""}){const o=i(t=>t.followed.includes(s.toLowerCase())),a=i(t=>t.toggle);return s?e.jsx("button",{type:"button",className:`btn btn--sm ${o?"btn--ghost":"btn--outline"} ${r}`.trim(),"aria-pressed":o,title:o?"Unfollow creator":"Follow creator",onClick:()=>a(s),children:o?"Following":"Follow"}):null}const C=48;function S(){const{address:s}=g(),r=p(),{items:o,total:a,isLoading:t,error:n,hasNextPage:u,isFetchingNextPage:c,fetchNextPage:d}=b(["creator-page",s],l=>j(s,{first:C,skip:l}),{enabled:!!s});return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":"Breadcrumb",children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>r("/assets"),children:"Collectibles"}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:"Creator"})]}),e.jsxs("header",{className:"collection-page__head",children:[s?e.jsx(h,{address:s,className:"collection-page__title-creator"}):null,s?e.jsx(_,{address:s}):null,e.jsx("span",{className:"muted collection-page__count",children:t?"…":`${a.toLocaleString()} item${a===1?"":"s"}`})]}),!t&&o.length>0?e.jsx(f,{items:o,source:"creator"}):null,n?e.jsx("p",{className:"error",children:"Couldn’t load this creator — please try again."}):null,e.jsx("div",{className:"grid",children:t?e.jsx(m,{count:12}):e.jsxs(e.Fragment,{children:[o.map(l=>e.jsx(x,{item:l},l.id)),c?e.jsx(m,{count:6}):null]})}),e.jsx(N,{hasNextPage:u,isFetching:c,onLoadMore:()=>d()}),!t&&!n&&o.length===0?e.jsx("p",{className:"muted",children:"This creator has no items to show yet."}):null]})}export{S as Creator,S as default};
|
|
@@ -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-DhBR5OWI.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-xfN1xxGv.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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RealCheckout-
|
|
2
|
-
import{
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RealCheckout-LHxmnnay.js","assets/react-iAgwec9M.js","assets/index-Bct-eJWT.js","assets/ethers-D-4WUfRB.js","assets/index-Ctf6wteV.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{ag as $,i as y,ah as U,c as F,w as L,y as _,D as S,H as E,x as u,e as N,ai as R,_ as V}from"./index-Bct-eJWT.js";import{a as K,r as l,j as e}from"./react-iAgwec9M.js";import{C as k}from"./CircularProgress-BrhtD36_.js";import"./ethers-D-4WUfRB.js";function I(){return y.shopServerUrl||y.creditsServerUrl}async function Y(t,s){const r=await $(`${I()}/credits/checkout`,{method:"POST",identity:s,metadata:{},headers:{"Content-Type":"application/json"},body:JSON.stringify({packId:t})});if(!r.ok)throw new Error(`checkout ${r.status}: ${await r.text()}`);const{orderId:a,clientSecret:n}=await r.json();return{orderId:a,clientSecret:n,mock:!1}}async function z(t,s,r={}){const{intervalMs:a=1500,timeoutMs:n=6e4,signal:c}=r,i=Date.now()+n;for(;;){if(c!=null&&c.aborted)throw new DOMException("Aborted","AbortError");const m=await q(t,s,c);if(m.status!=="processing")return m;if(Date.now()>i)return{status:"failed",error:"Timed out waiting for your credits."};await H(a,c)}}async function q(t,s,r){const a=await $(`${I()}/credits/orders/${t}`,{method:"GET",identity:s,metadata:{},signal:r});if(!a.ok)throw new Error(`order status ${a.status}`);return a.json()}function H(t,s){return new Promise((r,a)=>{const n=setTimeout(r,t);s==null||s.addEventListener("abort",()=>{clearTimeout(n),a(new DOMException("Aborted","AbortError"))})})}const W=.1,T=[{id:"pack_5",usd:5,credits:f(5)},{id:"pack_10",usd:10,credits:f(10)},{id:"pack_25",usd:25,credits:f(25),bestValue:!0},{id:"pack_50",usd:50,credits:f(50)}];function f(t){return Math.round(t/W)}function G(t){return T.find(s=>s.id===t)}const x="mock_cs_",J=new Set([80002,11155111,1337,31337]);function C(){const t=!y.stripePublishableKey;if(t&&!J.has(y.chainId))throw new Error(`Stripe publishable key is missing on chainId=${y.chainId}, which is not a recognized test network. Refusing to fall back to mock payments in a real-money environment — configure STRIPE_PUBLISHABLE_KEY.`);return t}async function Q(t,s){const r=G(t);if(!r)throw new Error("Unknown pack");if(C())return Z(r);if(!(s!=null&&s.identity))throw new Error("Sign in to get credits.");return Y(t,s.identity)}async function X(t,s={}){const{intervalMs:r,timeoutMs:a,signal:n,identity:c}=s;if(C()||t.startsWith(x))return ee(t,s);if(!c)throw new Error("Sign in to get credits.");return z(t,c,{intervalMs:r,timeoutMs:a,signal:n})}function Z(t){const s=`${x}${t.id}_${Date.now()}`;return M(400).then(()=>({orderId:s,clientSecret:`${x}${t.id}`,mock:!0}))}async function ee(t,s={}){await M(s.intervalMs??900);const r=t.replace(x,"").replace(/_\d+$/,""),a=G(r),n=(a==null?void 0:a.credits)??0;if(s.address&&a)try{const c=await U(s.address,Math.round(a.usd*100));return{status:"credited",creditsGranted:n,newBalance:c.credits}}catch(c){return{status:"failed",error:c.message}}return{status:"credited",creditsGranted:n,newBalance:n}}function M(t,s){return new Promise((r,a)=>{setTimeout(r,t)})}const b=C()?"mock":"stripe",se=l.lazy(()=>V(()=>import("./RealCheckout-LHxmnnay.js"),__vite__mapDeps([0,1,2,3,4])));function P(t){const s=t;if((s==null?void 0:s.name)==="AbortError")return"You cancelled the request.";const r=((s==null?void 0:s.message)??"").toLowerCase();return r.includes("sign in")?`Sign in to get ${u.name}.`:r.includes("timed out")?`This is taking longer than usual — your ${u.name} will appear shortly.`:"Couldn't complete your purchase — please try again."}function de(){const t=K(),{session:s,signIn:r}=F(),a=L(),[n,c]=l.useState("select"),[i,m]=l.useState(null),[h,w]=l.useState(null),[D,v]=l.useState(null),[A,p]=l.useState(null),g=l.useRef(null);l.useEffect(()=>()=>{var o;return(o=g.current)==null?void 0:o.abort()},[]);const B=l.useCallback(async o=>{if(!s){r();return}p(null),m(o),c("paying"),_("Shop Started Buy Credits",{pack_usd:o.usd,credits:o.credits,provider:b});try{const d=await Q(o.id,{address:s.address,identity:s.identity});w(d)}catch(d){S(d,{flow:"get_credits",step:"checkout",provider:b}),_("Shop Buy Credits Failed",{step:"checkout",error_code:E(d),pack_usd:o.usd}),p(P(d)),c("error")}},[s,r]),O=l.useCallback(async()=>{if(!h)return;c("processing");const o=new AbortController;g.current=o;try{const d=await X(h.orderId,{signal:o.signal,address:s==null?void 0:s.address,identity:s==null?void 0:s.identity});d.status==="credited"?(v(d.creditsGranted??(i==null?void 0:i.credits)??0),c("success"),_("Shop Completed Buy Credits",{order_id:h.orderId,pack_usd:(i==null?void 0:i.usd)??null,credits:d.creditsGranted??(i==null?void 0:i.credits)??0,provider:b}),a.invalidateQueries({queryKey:["usd-balance"]})):(_("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(i==null?void 0:i.usd)??null}),p(d.error??`Couldn't add your ${u.name} — please try again.`),c("error"))}catch(d){S(d,{flow:"get_credits",step:"grant",order_id:h.orderId}),_("Shop Buy Credits Failed",{step:"grant",error_code:E(d),pack_usd:(i==null?void 0:i.usd)??null}),p(P(d)),c("error")}},[h,i,s,a]);function j(){var o;(o=g.current)==null||o.abort(),c("select"),m(null),w(null),v(null),p(null)}return e.jsxs("div",{className:"getcredits",children:[e.jsxs("header",{className:"getcredits__head",children:[e.jsxs("h1",{className:"getcredits__title",children:["Get ",u.name]}),e.jsxs("p",{className:"muted",children:["Add ",u.name," to your account to shop. Pay with any card."]})]}),s?e.jsxs(e.Fragment,{children:[n==="select"&&e.jsx(te,{onSelect:B}),n==="paying"&&i&&e.jsx(re,{pack:i,checkout:h,onPaid:O,onCancel:j}),n==="processing"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(k,{size:40}),e.jsxs("p",{className:"getcredits__status-title",children:["Adding your ",u.name,"…"]}),e.jsx("p",{className:"muted",children:"Payment received. Just a moment while we top up your balance."})]}),n==="success"&&e.jsxs("div",{className:"getcredits__status getcredits__status--ok",role:"status","aria-live":"polite",children:[e.jsx("div",{className:"getcredits__confetti","aria-hidden":!0,children:"🎉"}),e.jsx("p",{className:"getcredits__status-title",children:"You’re all set!"}),e.jsxs("p",{className:"muted",children:[e.jsxs("strong",{children:[e.jsx(N,{className:"ccy-mark"})," ",D]})," ",u.name," added to your account."]}),e.jsxs("div",{className:"getcredits__status-actions",children:[e.jsx("button",{className:"btn",onClick:()=>t("/cart"),children:"Back to cart"}),e.jsxs("button",{className:"btn btn--ghost",onClick:j,children:["Get more ",u.name]})]})]}),n==="error"&&e.jsxs("div",{className:"getcredits__status getcredits__status--err",role:"alert",children:[e.jsx("p",{className:"getcredits__status-title",children:"Something went wrong"}),e.jsx("p",{className:"error",children:A}),e.jsx("div",{className:"getcredits__status-actions",children:e.jsx("button",{className:"btn",onClick:j,children:"Try again"})})]})]}):e.jsxs("div",{className:"getcredits__status",role:"status",children:[e.jsxs("p",{className:"getcredits__status-title",children:["Sign in to get ",u.name]}),e.jsxs("p",{className:"muted",children:["Connect your account to buy ",u.name," and start shopping."]}),e.jsx("div",{className:"getcredits__status-actions",children:e.jsx("button",{className:"btn btn--purple",onClick:r,children:"Sign in"})})]})]})}function te({onSelect:t}){return e.jsx("div",{className:"packs",children:T.map(s=>e.jsxs("button",{type:"button",className:`pack${s.bestValue?" pack--best":""}`,onClick:()=>t(s),"aria-label":`Get ${R(s.credits)} for $${s.usd}`,children:[s.bestValue&&e.jsx("span",{className:"pack__ribbon",children:"Best value"}),e.jsxs("span",{className:"pack__credits",children:[e.jsx(N,{className:"pack__credits-ico"}),s.credits]}),e.jsx("span",{className:"pack__label",children:u.name}),e.jsxs("span",{className:"pack__price",children:["$",s.usd]}),e.jsxs("span",{className:"pack__cta",children:["Get ",u.name]})]},s.id))})}function re({pack:t,checkout:s,onPaid:r,onCancel:a}){return e.jsxs("div",{className:"pay",children:[e.jsxs("div",{className:"pay__summary",children:[e.jsx("button",{className:"link",onClick:a,children:"← Choose a different pack"}),e.jsxs("div",{className:"pay__summary-row",children:[e.jsx("span",{children:"You’ll get"}),e.jsxs("strong",{children:[e.jsx(N,{className:"ccy-mark"})," ",R(t.credits)]})]}),e.jsxs("div",{className:"pay__summary-row pay__summary-row--total",children:[e.jsx("span",{children:"You pay"}),e.jsxs("strong",{children:["$",t.usd]})]})]}),e.jsx("div",{className:"pay__form",children:s?s.mock?e.jsx(ae,{onPaid:r,amountUsd:t.usd}):e.jsx(l.Suspense,{fallback:e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(k,{size:32}),e.jsx("p",{className:"muted",children:"Getting the payment form ready…"})]}),children:e.jsx(se,{clientSecret:s.clientSecret,onComplete:r})}):e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(k,{size:32}),e.jsx("p",{className:"muted",children:"Getting the payment form ready…"})]})})]})}function ae({onPaid:t,amountUsd:s}){const[r,a]=l.useState("4242 4242 4242 4242"),[n,c]=l.useState(!1);function i(){c(!0),setTimeout(()=>t(),700)}return e.jsxs("div",{className:"card-form","aria-label":"Payment details",children:[e.jsx("p",{className:"muted small card-form__note",children:"Demo mode — no real charge is made."}),e.jsxs("label",{className:"field",children:[e.jsx("span",{children:"Card number"}),e.jsx("input",{value:r,onChange:m=>a(m.target.value),disabled:n,inputMode:"numeric"})]}),e.jsxs("div",{className:"card-form__row",children:[e.jsxs("label",{className:"field",children:[e.jsx("span",{children:"Expiry"}),e.jsx("input",{defaultValue:"12 / 34",disabled:n})]}),e.jsxs("label",{className:"field",children:[e.jsx("span",{children:"CVC"}),e.jsx("input",{defaultValue:"123",disabled:n,inputMode:"numeric"})]})]}),e.jsx("button",{className:"btn btn--purple card-form__pay",onClick:i,disabled:n,children:n?"Processing…":`Pay $${s}`})]})}export{de as GetCredits,de 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-BZtHn4dc.js";import{d as g,r as v}from"./index-xfN1xxGv.js";import{C as c}from"./ConstantsUtil-rB_9qX5U.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-DhBR5OWI.js";import{au as y}from"./NetworkUtil-Cm_KFCNa.js";const b=g`
|
|
2
2
|
:host {
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as E,r as p,j as e,L as A}from"./react-CQ5qhqs6.js";import{y as Q,D as L,x as S,e as v,c as R,w as F,u as K,o as P}from"./index-DvAy35iS.js";import{i as W,R as Y,f as G}from"./import-DI2r0vcY.js";import{s as O}from"./wallet-kind-D56TeB0g.js";import"./ethers-DXxh-eEm.js";import"./buy-KvjWmHql.js";import"./trade-encoding-CmkOOQWS.js";import"./index-CUDTJiCv.js";import"./mana-rate-BmhpEynZ.js";function B({queue:n,session:I,onClose:g,onDone:h}){const x=E(),c=O(I.providerType),[d,j]=p.useState(()=>n.map(()=>"pending")),[b,C]=p.useState("running"),w=p.useRef(!1);p.useEffect(()=>{if(w.current)return;w.current=!0;let t=!1;return(async()=>{for(let s=0;s<n.length;s++){if(t)return;j(r=>r.map((m,o)=>o===s?"active":m));try{await W(n[s].item,n[s].priceCredits,I),Q("Shop Migrated Listing",{item_id:n[s].item.itemId??n[s].item.oldTradeId??null,contract_address:n[s].item.contractAddress,new_price_credits:n[s].priceCredits,new_price_usd:n[s].priceCredits/10}),t||j(r=>r.map((m,o)=>o===s?"done":m))}catch(r){if(r instanceof Y)L(r,{flow:"import_listing",step:"relist",itemId:n[s].item.itemId??n[s].item.oldTradeId}),t||j(m=>m.map((o,y)=>y===s?"unlisted":o));else{const m=r,o=m.code===4001||/reject|denied|cancel/i.test(m.message??"");o||L(r,{flow:"import_listing",itemId:n[s].item.itemId??n[s].item.oldTradeId}),t||j(y=>y.map((T,a)=>a===s?o?"skipped":"failed":T))}}}t||C("finished")})(),()=>{t=!0}},[]);const u=d.filter(t=>t==="done").length,N=d.findIndex(t=>t==="active"),_=Math.round(d.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function f(){h(),g()}if(b==="finished"){const t=d.filter(r=>r==="skipped"||r==="failed").length,s=d.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:u>0?"You're in the Shop! 🎉":"Nothing listed"}),e.jsxs("p",{className:"muted",style:{margin:0},children:[u>0?`${u} ${u===1?"item is":"items are"} now for sale with ${S.name}.`:"No items were listed.",t>0?` ${t} skipped — you can try those again anytime.`:"",s>0?` ${s} ${s===1?"item was":"items were"} taken off the old marketplace but couldn't be re-listed — re-list ${s===1?"it":"them"} from My Assets.`:""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:f,children:"Done"}),s>0?e.jsx("button",{className:"btn btn--purple",onClick:()=>{h(),g(),x("/my-assets")},children:"Go to My Assets"}):u>0?e.jsx("button",{className:"btn btn--purple",onClick:()=>{h(),g(),x("/assets")},children:"View in Shop"}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:"Listing your items"}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[c?"We take down each old listing and re-list it for credits — confirm each step.":"Moving your items to the Shop."," ",N>=0?`${N+1} of ${n.length}`:""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${_}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,s)=>e.jsxs("li",{className:`migrate__row migrate__row--${d[s]}`,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||"Item"}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(v,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:d[s]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",c?"Confirm…":"Adding…"]}):d[s]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):d[s]==="skipped"?e.jsx("span",{className:"migrate__skip",children:"Skipped"}):d[s]==="failed"?e.jsx("span",{className:"migrate__skip",children:"Failed"}):d[s]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:"Removed from the old marketplace but not re-listed — re-list it from My Assets.",children:"Not listed"}):e.jsx("span",{className:"migrate__wait",children:"Waiting"})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:c?"A couple of quick confirmations pop up per item (take down + re-list). Keep this open.":"This only takes a moment — keep this open."})]})})}const D=[{key:"creations",title:"Your creations",sub:"Items you made. Put them on sale in the Shop."},{key:"owned",title:"Items you own",sub:"Things you've bought elsewhere — resell them in the Shop."}];function se(){const{session:n,signIn:I,restore:g}=R(),h=F(),x=n==null?void 0:n.address;p.useEffect(()=>{g()},[g]);const{data:c,isLoading:d}=K({queryKey:["importable",x],queryFn:()=>G(x),enabled:!!x}),[j,b]=p.useState({}),[C,w]=p.useState(new Set),[u,N]=p.useState(null),_=p.useMemo(()=>[...(c==null?void 0:c.creations)??[],...(c==null?void 0:c.owned)??[]],[c]);p.useEffect(()=>{_.length&&b(a=>{const l={...a};for(const i of _)l[i.oldTradeId]==null&&(l[i.oldTradeId]=i.suggestedCredits);return l})},[_]);const f=a=>!C.has(a),t=a=>j[a.oldTradeId]??a.suggestedCredits,s=_.filter(a=>f(a.oldTradeId)),r=s.reduce((a,l)=>a+t(l),0);function m(a,l){const i=l.replace(/[^\d]/g,"");b(k=>({...k,[a]:i===""?0:parseInt(i,10)}))}function o(a){w(l=>{const i=new Set(l);return i.has(a)?i.delete(a):i.add(a),i})}function y(a){return a.map(l=>({item:l,priceCredits:Math.max(1,t(l))}))}function T(){h.invalidateQueries({queryKey:["importable"]}),h.invalidateQueries({queryKey:["unified-listings"]}),h.invalidateQueries({queryKey:["my-assets"]}),h.invalidateQueries({queryKey:["collection-sale-state"]}),P.success("Your Shop is updated.")}return n?!d&&_.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:"You're all caught up"}),e.jsx("p",{className:"muted",children:"Everything you sell is already in the Shop — nothing to import."}),e.jsx(A,{className:"btn btn--purple",to:"/my-assets",children:"Go to My Assets"})]}):e.jsxs("div",{className:"imp",children:[e.jsxs("header",{className:"imp__head",children:[e.jsx("span",{className:"imp__eyebrow",children:"Import to the Shop"}),e.jsxs("h1",{className:"imp__title",children:["Bring your listings ",e.jsx("span",{className:"imp__grad",children:"into the Shop"})]}),e.jsxs("p",{className:"imp__lede",children:["These items are already for sale elsewhere. We suggested a price in ",S.name," for each — matched to today's rate and rounded up. Adjust anything, then list them."]})]}),e.jsxs("div",{className:"imp__ratebar",children:[e.jsx(v,{className:"ccy-mark imp__diamond"})," 1 ",S.nameSingular," = $0.10 · prices rounded up"]}),d?e.jsx("div",{className:"imp__list",children:Array.from({length:4}).map((a,l)=>e.jsx("div",{className:"imp-row imp-row--skeleton"},l))}):D.map(a=>{const l=(c==null?void 0:c[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:a.title}),e.jsx("span",{className:"imp__section-sub",children:a.sub})]}),e.jsx("div",{className:"imp__list",children:l.map(i=>{const k=t(i),M=k!==i.suggestedCredits;return e.jsxs("article",{className:`imp-row${f(i.oldTradeId)?"":" is-off"}`,children:[e.jsx("input",{type:"checkbox",className:"imp-check",checked:f(i.oldTradeId),onChange:()=>o(i.oldTradeId),"aria-label":`Include ${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||"Item"}),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(v,{className:"ccy-mark imp-price__diamond"}),e.jsx("input",{className:"imp-price__input",inputMode:"numeric",value:k.toLocaleString(),onChange:$=>m(i.oldTradeId,$.target.value),"aria-label":`Price in ${S.name} for ${i.name}`})]}),e.jsxs("div",{className:"imp-price__sub",children:[e.jsxs("span",{children:["$",(k*.1).toFixed(2)]}),M?e.jsxs("button",{className:"imp-price__reset",onClick:()=>b($=>({...$,[i.oldTradeId]:i.suggestedCredits})),children:["Reset to ",e.jsx(v,{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:!f(i.oldTradeId),onClick:()=>N(y([i])),children:"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(v,{className:"ccy-mark imp__diamond"})," ",r.toLocaleString()]}),e.jsxs("div",{className:"imp-dock__sub",children:[s.length," item",s.length===1?"":"s"," selected · $",(r*.1).toFixed(2)]})]}),e.jsx("span",{className:"imp-dock__spacer"}),e.jsxs("button",{className:"btn btn--purple imp-dock__cta",disabled:s.length===0,onClick:()=>N(y(s)),children:["List all (",s.length,")"]})]})}),u&&n?e.jsx(B,{queue:u,session:n,onClose:()=>N(null),onDone:T}):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:"Import your listings"}),e.jsx("p",{className:"muted",children:"Sign in to bring the items you already sell into the Shop."}),e.jsx("button",{className:"btn btn--purple",onClick:()=>I(),children:"Sign in"})]})}export{se as ImportListings};
|
|
1
|
+
import{a as E,r as p,j as e,L as A}from"./react-iAgwec9M.js";import{y as Q,D as L,x as S,e as v,c as R,w as F,u as K,o as P}from"./index-Bct-eJWT.js";import{i as W,R as Y,f as G}from"./import-DRq28X4S.js";import{s as O}from"./wallet-kind-C1BAMMs6.js";import"./ethers-D-4WUfRB.js";import"./buy-CXa71Woo.js";import"./trade-encoding-B73Nbkim.js";import"./index-CQ6rdhhJ.js";import"./mana-rate-CN4rx5dQ.js";function B({queue:n,session:I,onClose:g,onDone:h}){const x=E(),c=O(I.providerType),[d,j]=p.useState(()=>n.map(()=>"pending")),[b,C]=p.useState("running"),w=p.useRef(!1);p.useEffect(()=>{if(w.current)return;w.current=!0;let t=!1;return(async()=>{for(let s=0;s<n.length;s++){if(t)return;j(r=>r.map((m,o)=>o===s?"active":m));try{await W(n[s].item,n[s].priceCredits,I),Q("Shop Migrated Listing",{item_id:n[s].item.itemId??n[s].item.oldTradeId??null,contract_address:n[s].item.contractAddress,new_price_credits:n[s].priceCredits,new_price_usd:n[s].priceCredits/10}),t||j(r=>r.map((m,o)=>o===s?"done":m))}catch(r){if(r instanceof Y)L(r,{flow:"import_listing",step:"relist",itemId:n[s].item.itemId??n[s].item.oldTradeId}),t||j(m=>m.map((o,y)=>y===s?"unlisted":o));else{const m=r,o=m.code===4001||/reject|denied|cancel/i.test(m.message??"");o||L(r,{flow:"import_listing",itemId:n[s].item.itemId??n[s].item.oldTradeId}),t||j(y=>y.map((T,a)=>a===s?o?"skipped":"failed":T))}}}t||C("finished")})(),()=>{t=!0}},[]);const u=d.filter(t=>t==="done").length,N=d.findIndex(t=>t==="active"),_=Math.round(d.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function f(){h(),g()}if(b==="finished"){const t=d.filter(r=>r==="skipped"||r==="failed").length,s=d.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:u>0?"You're in the Shop! 🎉":"Nothing listed"}),e.jsxs("p",{className:"muted",style:{margin:0},children:[u>0?`${u} ${u===1?"item is":"items are"} now for sale with ${S.name}.`:"No items were listed.",t>0?` ${t} skipped — you can try those again anytime.`:"",s>0?` ${s} ${s===1?"item was":"items were"} taken off the old marketplace but couldn't be re-listed — re-list ${s===1?"it":"them"} from My Assets.`:""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:f,children:"Done"}),s>0?e.jsx("button",{className:"btn btn--purple",onClick:()=>{h(),g(),x("/my-assets")},children:"Go to My Assets"}):u>0?e.jsx("button",{className:"btn btn--purple",onClick:()=>{h(),g(),x("/assets")},children:"View in Shop"}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:"Listing your items"}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[c?"We take down each old listing and re-list it for credits — confirm each step.":"Moving your items to the Shop."," ",N>=0?`${N+1} of ${n.length}`:""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${_}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,s)=>e.jsxs("li",{className:`migrate__row migrate__row--${d[s]}`,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||"Item"}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(v,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:d[s]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",c?"Confirm…":"Adding…"]}):d[s]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):d[s]==="skipped"?e.jsx("span",{className:"migrate__skip",children:"Skipped"}):d[s]==="failed"?e.jsx("span",{className:"migrate__skip",children:"Failed"}):d[s]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:"Removed from the old marketplace but not re-listed — re-list it from My Assets.",children:"Not listed"}):e.jsx("span",{className:"migrate__wait",children:"Waiting"})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:c?"A couple of quick confirmations pop up per item (take down + re-list). Keep this open.":"This only takes a moment — keep this open."})]})})}const D=[{key:"creations",title:"Your creations",sub:"Items you made. Put them on sale in the Shop."},{key:"owned",title:"Items you own",sub:"Things you've bought elsewhere — resell them in the Shop."}];function se(){const{session:n,signIn:I,restore:g}=R(),h=F(),x=n==null?void 0:n.address;p.useEffect(()=>{g()},[g]);const{data:c,isLoading:d}=K({queryKey:["importable",x],queryFn:()=>G(x),enabled:!!x}),[j,b]=p.useState({}),[C,w]=p.useState(new Set),[u,N]=p.useState(null),_=p.useMemo(()=>[...(c==null?void 0:c.creations)??[],...(c==null?void 0:c.owned)??[]],[c]);p.useEffect(()=>{_.length&&b(a=>{const l={...a};for(const i of _)l[i.oldTradeId]==null&&(l[i.oldTradeId]=i.suggestedCredits);return l})},[_]);const f=a=>!C.has(a),t=a=>j[a.oldTradeId]??a.suggestedCredits,s=_.filter(a=>f(a.oldTradeId)),r=s.reduce((a,l)=>a+t(l),0);function m(a,l){const i=l.replace(/[^\d]/g,"");b(k=>({...k,[a]:i===""?0:parseInt(i,10)}))}function o(a){w(l=>{const i=new Set(l);return i.has(a)?i.delete(a):i.add(a),i})}function y(a){return a.map(l=>({item:l,priceCredits:Math.max(1,t(l))}))}function T(){h.invalidateQueries({queryKey:["importable"]}),h.invalidateQueries({queryKey:["unified-listings"]}),h.invalidateQueries({queryKey:["my-assets"]}),h.invalidateQueries({queryKey:["collection-sale-state"]}),P.success("Your Shop is updated.")}return n?!d&&_.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:"You're all caught up"}),e.jsx("p",{className:"muted",children:"Everything you sell is already in the Shop — nothing to import."}),e.jsx(A,{className:"btn btn--purple",to:"/my-assets",children:"Go to My Assets"})]}):e.jsxs("div",{className:"imp",children:[e.jsxs("header",{className:"imp__head",children:[e.jsx("span",{className:"imp__eyebrow",children:"Import to the Shop"}),e.jsxs("h1",{className:"imp__title",children:["Bring your listings ",e.jsx("span",{className:"imp__grad",children:"into the Shop"})]}),e.jsxs("p",{className:"imp__lede",children:["These items are already for sale elsewhere. We suggested a price in ",S.name," for each — matched to today's rate and rounded up. Adjust anything, then list them."]})]}),e.jsxs("div",{className:"imp__ratebar",children:[e.jsx(v,{className:"ccy-mark imp__diamond"})," 1 ",S.nameSingular," = $0.10 · prices rounded up"]}),d?e.jsx("div",{className:"imp__list",children:Array.from({length:4}).map((a,l)=>e.jsx("div",{className:"imp-row imp-row--skeleton"},l))}):D.map(a=>{const l=(c==null?void 0:c[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:a.title}),e.jsx("span",{className:"imp__section-sub",children:a.sub})]}),e.jsx("div",{className:"imp__list",children:l.map(i=>{const k=t(i),M=k!==i.suggestedCredits;return e.jsxs("article",{className:`imp-row${f(i.oldTradeId)?"":" is-off"}`,children:[e.jsx("input",{type:"checkbox",className:"imp-check",checked:f(i.oldTradeId),onChange:()=>o(i.oldTradeId),"aria-label":`Include ${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||"Item"}),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(v,{className:"ccy-mark imp-price__diamond"}),e.jsx("input",{className:"imp-price__input",inputMode:"numeric",value:k.toLocaleString(),onChange:$=>m(i.oldTradeId,$.target.value),"aria-label":`Price in ${S.name} for ${i.name}`})]}),e.jsxs("div",{className:"imp-price__sub",children:[e.jsxs("span",{children:["$",(k*.1).toFixed(2)]}),M?e.jsxs("button",{className:"imp-price__reset",onClick:()=>b($=>({...$,[i.oldTradeId]:i.suggestedCredits})),children:["Reset to ",e.jsx(v,{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:!f(i.oldTradeId),onClick:()=>N(y([i])),children:"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(v,{className:"ccy-mark imp__diamond"})," ",r.toLocaleString()]}),e.jsxs("div",{className:"imp-dock__sub",children:[s.length," item",s.length===1?"":"s"," selected · $",(r*.1).toFixed(2)]})]}),e.jsx("span",{className:"imp-dock__spacer"}),e.jsxs("button",{className:"btn btn--purple imp-dock__cta",disabled:s.length===0,onClick:()=>N(y(s)),children:["List all (",s.length,")"]})]})}),u&&n?e.jsx(B,{queue:u,session:n,onClose:()=>N(null),onDone:T}):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:"Import your listings"}),e.jsx("p",{className:"muted",children:"Sign in to bring the items you already sell into the Shop."}),e.jsx("button",{className:"btn btn--purple",onClick:()=>I(),children:"Sign in"})]})}export{se as ImportListings};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.item-detail{max-width:1721px;margin:0 auto}.item-detail__crumbs{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--muted);margin-bottom:24px}.item-detail__crumb-link{background:none;border:0;padding:0;font:inherit;color:var(--muted)}.item-detail__crumb-link:hover{color:var(--text)}.item-detail__crumb-sep{color:var(--muted-2)}.item-detail__crumb-current{color:var(--text);font-weight:600}.item-detail__main{display:grid;grid-template-columns:minmax(0,1045fr) minmax(0,514fr);gap:48px;align-items:start;max-width:1607px;margin:0 auto}@media(max-width:900px){.item-detail__main{grid-template-columns:1fr;gap:24px;max-width:none}}.item-detail__preview{position:relative;aspect-ratio:1045 / 752;border-radius:16px;overflow:hidden;background:var(--media)}@media(max-width:900px){.item-detail__preview{aspect-ratio:1 / 1}}.item-detail__preview iframe,.item-detail__preview>*{width:100%;height:100%;border:0;display:block}.item-detail__preview>.item-preview__toggle{position:absolute;top:16px;left:16px;z-index:2;width:auto;height:auto;display:inline-flex;gap:2px;padding:3px;background:#ffffffeb;border:1px solid var(--line);border-radius:999px;box-shadow:0 1px 4px #0000001f}.item-preview__toggle button{border:0;background:none;cursor:pointer;padding:6px 16px;border-radius:999px;font-weight:600;font-size:12px;text-transform:uppercase;letter-spacing:.04em;color:var(--muted);transition:background .12s ease,color .12s ease}.item-preview__toggle button.is-active{background:var(--text);color:#fff}.item-preview__toggle button:not(.is-active):hover{color:var(--text)}.item-detail__preview>.item-preview__emote-controls{position:absolute;bottom:14px;left:50%;transform:translate(-50%);z-index:2;width:auto;height:auto;max-width:92%;display:flex;align-items:center;background:#ffffffeb;border:1px solid var(--line);border-radius:12px;padding:6px 10px;box-shadow:0 1px 4px #0000001f}.item-detail__preview>.item-preview__note{position:absolute;bottom:14px;left:50%;transform:translate(-50%);z-index:2;width:auto;height:auto;max-width:88%;margin:0;text-align:center;background:#161518c7;color:#fff;font-size:12px;font-weight:500;padding:6px 12px;border-radius:999px}.item-detail__preview>.item-preview__loading{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;display:flex;align-items:center;justify-content:center;width:100%;height:100%;background:transparent}.item-preview__spinner{width:34px;height:34px;border-radius:50%;border:3px solid var(--line);border-top-color:var(--accent);animation:item-preview-spin .8s linear infinite}@keyframes item-preview-spin{to{transform:rotate(360deg)}}@media(prefers-reduced-motion:reduce){.item-preview__spinner{animation-duration:2.4s}}.item-detail__info{display:flex;flex-direction:column;gap:20px}.item-detail__info-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.item-detail__title{font-size:28px;font-weight:600;line-height:34px;color:var(--text-2)}.item-detail__fav{flex:none;width:40px;height:40px;border-radius:50%;border:0;background:var(--media);display:grid;place-items:center;color:var(--text-2);cursor:pointer;transition:color .12s ease,background .12s ease}.item-detail__fav:hover{background:var(--line)}.item-detail__fav.is-on{color:var(--dcl-red)}.item-detail__fav .ico-heart{width:18px;height:18px}.item-detail__label{display:inline-flex;align-items:center;gap:5px;font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--muted)}.item-detail__chips{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:-6px}.item-detail__chips .chip{height:24px;padding:0 8px;gap:3px;font-size:12px;border-radius:4px;letter-spacing:.02em;text-transform:uppercase}.item-detail__chip{background:var(--chip);color:var(--text-2)}.item-detail__chip-ico{width:16px;height:16px;color:var(--text-2)}.item-detail__section{display:flex;flex-direction:column;align-items:flex-start;gap:8px}.item-detail__desc-text{margin:0;color:var(--text-2);font-size:14px;line-height:30px;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:4;overflow:hidden}.item-detail__desc-text.is-expanded{-webkit-line-clamp:unset;overflow:visible}.item-detail__desc-toggle{font-size:13px;align-self:flex-start}.item-detail__meta{display:grid;grid-template-columns:1fr 1fr;gap:16px}.item-detail__meta-col{display:flex;flex-direction:column;gap:10px;min-width:0}.item-detail__creator.creator{color:var(--accent);font-size:14px;gap:12px}.item-detail__creator .creator__ava{width:48px;height:48px}.item-detail__creator .creator__ava--letter{font-size:18px}.item-detail__creator .creator__name{color:var(--accent);font-weight:500;text-decoration:underline}.item-detail__creator.creator--link:hover .creator__name{color:var(--brand-violet)}.item-detail__divider{border:0;border-top:1px solid var(--line);margin:4px 0;width:100%}.item-detail__price-block{display:flex;flex-direction:column;gap:8px}.item-detail__price-label{font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--muted)}.item-detail__price{display:flex;align-items:center;gap:10px;font-weight:700;color:var(--text)}.item-detail__diamond{width:30px;height:30px;color:var(--brand-violet)}.item-detail__price-value{font-size:30px;line-height:1}.item-detail__price--none{font-size:18px;color:var(--muted)}.item-detail__price--sale{flex-wrap:wrap;gap:10px 14px}.item-detail__price--sale .item-detail__price,.item-detail__price--sale .item-detail__price-value,.item-detail__price--sale .item-detail__diamond{color:var(--dcl-red)}.item-detail__price-was{display:inline-flex;align-items:center;gap:6px;color:var(--muted);text-decoration:line-through;font-weight:600;font-size:20px}.item-detail__diamond--was{width:18px;height:18px;color:var(--muted)}.item-detail__sale-badge{display:inline-flex;align-items:center;background:var(--dcl-red);color:#fff;font-weight:800;font-size:13px;letter-spacing:.03em;text-transform:uppercase;border-radius:6px;padding:4px 10px}.item-detail__countdown{display:inline-flex;align-items:center;gap:5px;background:var(--rarity-bg);color:var(--accent);font-size:13px;font-weight:700;border-radius:6px;padding:4px 10px;white-space:nowrap}.item-detail__countdown .sale-countdown__ico{width:14px;height:14px}.item-detail__balance{font-size:13px}.item-detail__ctas{display:flex;flex-direction:column;gap:12px;margin-top:4px}.item-detail__cta{width:100%;height:48px;border-radius:8px;font-size:15px;text-align:center}.item-detail__addcart{width:100%;height:48px;display:flex;align-items:center;justify-content:center;gap:8px;background:var(--black-btn);color:var(--soft-white);border:0;border-radius:8px;font-weight:600;font-size:15px;text-transform:uppercase;letter-spacing:.046em;cursor:pointer;transition:filter .15s ease}.item-detail__addcart:hover:not(:disabled){filter:brightness(1.35)}.item-detail__addcart:disabled{opacity:.55;cursor:default}.item-detail__addcart-ico{width:20px;height:20px}.item-detail__status{margin:0;font-size:13px}.item-detail__own-note{margin:0;font-size:14px}.item-detail__own-note a{color:var(--accent);font-weight:600}@media(max-width:900px){.item-detail__title{font-size:20px;line-height:24px}.item-detail__info-head{order:0}.item-detail__chips{order:1}.item-detail__meta{order:2;grid-template-columns:1fr}.item-detail__description{order:3}.item-detail__divider{order:4}.item-detail__price-block{order:5}.item-detail__ctas{order:6}.item-detail__status{order:7}}.collection-carousel{margin-top:64px}.collection-carousel__head{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.collection-carousel__title{font-size:22px;font-weight:700;color:var(--text)}.collection-carousel__viewall{display:inline-flex;align-items:center;gap:4px;background:none;border:0;padding:0;color:var(--accent);font-weight:700;font-size:13px;letter-spacing:.046em;text-transform:uppercase;cursor:pointer;white-space:nowrap}.collection-carousel__viewall:hover{text-decoration:underline}.collection-carousel__viewall-ico{width:16px;height:16px;transform:rotate(-90deg)}.collection-carousel__viewport{position:relative}.collection-carousel__arrow{position:absolute;top:calc(50% - 22px);transform:translateY(-50%);z-index:3;width:52px;height:52px;border-radius:50%;border:0;background:#fff;color:var(--text);font-size:24px;line-height:1;display:grid;place-items:center;cursor:pointer;box-shadow:0 6px 16px #16151829;transition:transform .12s ease,box-shadow .12s ease,opacity .12s ease}.collection-carousel__arrow--left{left:-10px}.collection-carousel__arrow--right{right:-10px}.collection-carousel__arrow:hover:not(:disabled){transform:translateY(-50%) scale(1.06);box-shadow:0 8px 20px #16151833}.collection-carousel__arrow:disabled{opacity:0;pointer-events:none}@media(prefers-reduced-motion:reduce){.collection-carousel__arrow{transition:none}}@media(max-width:900px){.collection-carousel__arrow{display:none}}.collection-carousel__track{display:flex;gap:16px;overflow-x:auto;padding:12px 10px;margin:0 -10px;scroll-snap-type:x proximity;scrollbar-width:none}.collection-carousel__track::-webkit-scrollbar{display:none}.collection-carousel__track>.card{flex:0 0 281px;scroll-snap-align:start}@media(max-width:720px){.collection-carousel__track>.card{flex:0 0 44vw}}.collection-carousel__dots{display:flex;align-items:center;justify-content:center;gap:8px;margin-top:18px}.collection-carousel__dot{width:10px;height:10px;border-radius:50%;border:0;padding:0;background:var(--line-strong);opacity:.5;cursor:pointer;transition:opacity .12s ease,background .12s ease,transform .12s ease}.collection-carousel__dot:hover{opacity:.8}.collection-carousel__dot.is-active{background:var(--accent);opacity:1;transform:scale(1.1)}.item-detail--notfound{min-height:46vh;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:14px}.item-detail__notfound-ico{width:44px;height:44px;opacity:.4}.item-detail__notfound-title{font-size:22px}.item-detail--notfound .btn{margin-top:6px}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D99Qzmcw.js","assets/react-iAgwec9M.js","assets/index-Bct-eJWT.js","assets/ethers-D-4WUfRB.js","assets/index-Ctf6wteV.css","assets/emotion-styled.browser.esm-B_soaN1s.js","assets/CircularProgress-BrhtD36_.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as e,r as n,u as xe,b as be,a as je,L as ge}from"./react-iAgwec9M.js";import{_ as ye,c as ae,L as Ne,O as we,N as Ie,am as Ce,W as Ae,j as P,i as ie,an as ke,A as Ee,m as Z,b as X,v as Se,u as R,ao as Le,y as D,ap as Pe,aq as Te,ar as Re,as as Fe,n as $e,at as Be,au as qe,C as Me,e as F,av as ee,aw as We,h as Oe,q as De,s as Ve,E as ze,F as Ue,G as te,D as Ge,I as Ke,z as Ye,H as He,x as Je,f as Qe,ax as Ze,ay as Xe,J as et}from"./index-Bct-eJWT.js";import{a as se}from"./buy-CXa71Woo.js";import{g as tt,a as st,w as at,S as it,G as rt}from"./buy-gasless-D9RsxE8-.js";import"./ethers-D-4WUfRB.js";import"./trade-encoding-B73Nbkim.js";import"./index-CQ6rdhhJ.js";const nt=n.lazy(()=>ye(()=>import("./index-D99Qzmcw.js").then(s=>s.i),__vite__mapDeps([0,1,2,3,4,5,6])).then(s=>({default:s.EmoteControls})));function lt(s){return e.jsx(n.Suspense,{fallback:null,children:e.jsx(nt,{...s})})}function ct({item:s}){const l=ae(c=>{var r;return(r=c.session)==null?void 0:r.address}),{data:a,isLoading:m}=Ne(l),I=l&&a?l:"default",p=s.category==="emote",[f,d]=n.useState("avatar"),_=!p&&f==="item",[t,j]=n.useState(!0);n.useEffect(()=>{j(!0)},[s.id,_]);const g=!!l&&!!a,o=g&&we(s,Ie(a)),y=Ce(s)[0],N=g&&!o&&!p;return e.jsxs(e.Fragment,{children:[m?null:e.jsx(Ae,{id:"shop-item-preview",contractAddress:s.contractAddress,tokenId:s.tokenId??void 0,itemId:s.tokenId?void 0:s.itemId??void 0,profile:_?void 0:o?I:"default",bodyShape:_||o?void 0:y,type:p?void 0:_?P.PreviewType.WEARABLE:P.PreviewType.AVATAR,emote:p||_?void 0:P.PreviewEmote.FASHION,disableBackground:!0,wheelZoom:p?1.5:void 0,wheelStart:p?100:void 0,dev:ie.chainId===80002,onLoad:()=>j(!1)},s.id),m||t?e.jsx("div",{className:"item-preview__loading","aria-busy":"true","aria-label":"Loading preview",children:e.jsx("span",{className:"item-preview__spinner","aria-hidden":!0})}):null,N&&!_?e.jsxs("p",{className:"item-preview__note",children:["Shown on a ",ke(y)," body — this item isn’t made for your avatar’s shape."]}):null,p?e.jsx("div",{className:"item-preview__emote-controls",children:e.jsx(lt,{wearablePreviewId:"shop-item-preview",hideFrameInput:!0})}):e.jsxs("div",{className:"item-preview__toggle",role:"group","aria-label":"Preview mode",children:[e.jsx("button",{type:"button",className:f==="avatar"?"is-active":"","aria-pressed":f==="avatar",onClick:()=>d("avatar"),children:"On avatar"}),e.jsx("button",{type:"button",className:f==="item"?"is-active":"","aria-pressed":f==="item",onClick:()=>d("item"),children:"Item"})]})]})}function dt({title:s,items:l,onViewAll:a}){const m=n.useRef(null),[I,p]=n.useState(1),[f,d]=n.useState(0),[_,t]=n.useState(!0),[j,g]=n.useState(!1),o=n.useCallback(()=>{const c=m.current;if(!c)return;const{scrollLeft:r,scrollWidth:x,clientWidth:k}=c,C=Math.max(1,Math.ceil(x/k));p(C),d(Math.min(C-1,Math.round(r/k))),t(r<=1),g(r+k>=x-1)},[]);if(n.useEffect(()=>{o();const c=m.current;if(c)return c.addEventListener("scroll",o,{passive:!0}),window.addEventListener("resize",o),()=>{c.removeEventListener("scroll",o),window.removeEventListener("resize",o)}},[o,l.length]),l.length===0)return null;function y(c){const r=m.current;r&&r.scrollBy({left:c*r.clientWidth,behavior:"smooth"})}function N(c){const r=m.current;r&&r.scrollTo({left:c*r.clientWidth,behavior:"smooth"})}return e.jsxs("section",{className:"collection-carousel",children:[e.jsxs("div",{className:"collection-carousel__head",children:[e.jsx("h2",{className:"collection-carousel__title",children:s}),a?e.jsxs("button",{className:"collection-carousel__viewall",onClick:a,children:["View all",e.jsx("span",{className:"ico ico-chevron collection-carousel__viewall-ico","aria-hidden":!0})]}):null]}),e.jsxs("div",{className:"collection-carousel__viewport",children:[e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--left",onClick:()=>y(-1),"aria-label":"Scroll left",disabled:_,children:"‹"}),e.jsx("div",{className:"collection-carousel__track",ref:m,children:l.map(c=>e.jsx(Ee,{item:c},c.id))}),e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--right",onClick:()=>y(1),"aria-label":"Scroll right",disabled:j,children:"›"})]}),I>1?e.jsx("div",{className:"collection-carousel__dots","aria-label":"Carousel pages",children:Array.from({length:I}).map((c,r)=>e.jsx("button",{className:`collection-carousel__dot${r===f?" is-active":""}`,"aria-label":`Go to page ${r+1}`,"aria-current":r===f?"true":void 0,onClick:()=>N(r)},r))}):null]})}function ot(s){return Object.values(P.Rarity).includes(s)}function mt(s){return s==="male"?"Male":s==="female"?"Female":s==="unisex"?"Unisex":null}function ut(s){return s.wearableCategory?s.wearableCategory.replace(/_/g," "):s.category==="emote"?"Emote":"Wearable"}function ht(s){const l=s,a=(l.message??"").toLowerCase();return l.code===4001||a.includes("reject")||a.includes("denied")||a.includes("cancel")?"You cancelled the request.":a.includes("insufficient")?`You don't have enough ${Je.name} — get more first.`:a.includes("no active listing")||a.includes("not for sale")?"This item is not for sale right now.":"Couldn't complete checkout — please try again."}function gt(){const{contractAddress:s,tokenId:l}=xe(),{state:a}=be(),m=je(),I=Z(i=>i.add),p=Z(i=>i.items),f=X(i=>i.toggle),{session:d}=ae(),{data:_}=Se(d),[t,j]=n.useState(()=>a!=null&&a.item?{...a.item,tradeId:a.tradeId??a.item.tradeId}:{id:`${s}-${l}`,name:"",creator:"",contractAddress:s??"",itemId:null,category:"wearable",rarity:"common",network:"MATIC",chainId:ie.chainId,thumbnail:"",priceCredits:0,gender:null,tokenId:l??void 0,tradeId:a==null?void 0:a.tradeId}),[g,o]=n.useState(!1),[y,N]=n.useState(null),[c,r]=n.useState(null),{data:x=[],isFetched:k}=R({queryKey:["collection-items",t.contractAddress],enabled:!!t.contractAddress,queryFn:()=>Qe(t.contractAddress,{first:20}).then(i=>i.items)}),{data:C,isLoading:re}=R({queryKey:["shop-item",t.contractAddress,l],enabled:!(a!=null&&a.item)&&!!t.contractAddress&&!!l,queryFn:()=>Ze(t.contractAddress,l)});n.useEffect(()=>{C&&j(i=>i.tradeId?i:{...C})},[C]);const[V,ne]=n.useState(!1),{data:$=""}=R({queryKey:["item-desc",t.contractAddress,t.itemId],enabled:!!t.contractAddress&&!!t.itemId,staleTime:5*6e4,queryFn:()=>Xe(t.contractAddress,t.itemId)});n.useEffect(()=>{if(t.name||x.length===0)return;const i=l&&x.find(u=>u.tokenId===l||u.itemId===l)||x.find(u=>u.contractAddress===t.contractAddress);i&&j(u=>({...i,tradeId:u.tradeId??i.tradeId}))},[x]);const le=n.useMemo(()=>{const i=new Set,u=[];for(const h of x){if(h.id===t.id||t.itemId&&h.itemId===t.itemId||t.tokenId&&h.tokenId===t.tokenId)continue;const L=`${h.contractAddress}-${h.itemId??h.tokenId??h.id}`;i.has(L)||(i.add(L),u.push(h))}return u},[x,t.id,t.itemId,t.tokenId]),{data:ce,isLoading:E}=R({queryKey:["detail-trade",t.id,t.tradeId,t.contractAddress,t.itemId],enabled:!!t.contractAddress,queryFn:async()=>{if(t.tradeId)return t.tradeId;if(t.itemId){const i=await et(t.contractAddress,t.itemId);return(i==null?void 0:i.id)??null}return null}}),w=t.tradeId??ce??void 0,b=!!w,de=Le({priceCredits:t.priceCredits,compareAtCredits:t.compareAtCredits,saleEndsAt:t.saleEndsAt}),S=n.useMemo(()=>({...t,tradeId:w,id:w??t.id}),[t,w]),B=p.some(i=>i.id===S.id),q=X(i=>!!i.items[t.id]);n.useEffect(()=>{N(null),r(null)},[t.id]);const z=n.useRef(null);n.useEffect(()=>{!t.name||E||z.current===t.id||(z.current=t.id,D("Shop Viewed Item",{...Pe(t),for_sale:b}),Te(t))},[t.id,t.name,E,b]);const T=`${s}/${l}`,U=n.useRef(T);n.useEffect(()=>{U.current!==T&&(U.current=T,a!=null&&a.item&&j({...a.item,tradeId:a.tradeId??a.item.tradeId}),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"}))},[T]);function oe(){!b||B||J||I(S,"item_detail")}async function me(){var L;if(!b||!w)return;if(!d){r("Sign in to check out.");return}r(null),o(!0);let i,u="authorize",h=!1;try{N(`Buying ${t.name||"item"}…`);const v=await Oe(w);if(!v)throw new Error("not for sale");if(De(v,d.address)){r("You can't buy your own listing."),N(null),o(!1);return}const M=(L=v.received)==null?void 0:L[0],fe=Ve(M==null?void 0:M.amount),{credit:Q,maxCreditedValue:ve}=await ze(d.identity,fe,w);i=Q.id,u="submit";const W={trade:v,buyer:d.address,signer:d.signer,credits:[Q],maxCreditedValue:ve};let A;if(tt())try{A=await st(W),await at(A),h=!0}catch(O){if(O instanceof it)h=!0;else if(O instanceof rt)A=await se(W);else throw O}else A=await se(W);i=void 0,D("Shop Completed Purchase",{...Ue([S]),payment_type:"credits",no_crypto_step:h,transaction_hash:A??null}),m("/success",{state:{items:[S],txHash:A}})}catch(v){te(v)||Ge(v,{flow:"buy",step:u,gasless:h}),i&&Ke(d.identity,[i]).catch(()=>{}),D(te(v)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:u,error_code:He(v),value_usd:Ye(S.priceCredits)}),r(ht(v)),N(null)}finally{o(!1)}}const G=ot(t.rarity)?t.rarity:P.Rarity.COMMON,K=mt(t.gender),Y=Re(t),H=Fe(t.gender),ue=b&&de,he="More from this collection",J=$e(t,d==null?void 0:d.address),_e=b?B?"In cart":E?"Checking…":"Add to cart":"Not for sale",pe=re||!!t.contractAddress&&!k;return!t.name&&!pe?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:"This item isn’t available"}),e.jsx("p",{className:"muted",children:"It may have been delisted or moved. Browse Collectibles for something else."}),e.jsx("button",{className:"btn btn--purple",onClick:()=>m("/assets"),children:"Browse Collectibles"})]}):e.jsxs("div",{className:"item-detail",children:[e.jsxs("nav",{className:"item-detail__crumbs","aria-label":"Breadcrumb",children:[e.jsx("button",{className:"item-detail__crumb-link",onClick:()=>m("/assets"),children:"Collectibles"}),e.jsx("span",{className:"item-detail__crumb-sep",children:"/"}),e.jsx("span",{className:"item-detail__crumb-current",children:t.name||"Item"})]}),e.jsxs("div",{className:"item-detail__main",children:[e.jsx("div",{className:"item-detail__preview",children:t.name?e.jsx(ct,{item:t}):e.jsx("div",{className:"item-preview__loading","aria-busy":"true","aria-label":"Loading preview",children:e.jsx("span",{className:"item-preview__spinner","aria-hidden":!0})})}),e.jsxs("div",{className:"item-detail__info",children:[e.jsxs("div",{className:"item-detail__info-head",children:[e.jsx("h1",{className:"item-detail__title",children:t.name||"Loading…"}),e.jsx("button",{className:`item-detail__fav${q?" is-on":""}`,onClick:()=>f(t),"aria-pressed":q,"aria-label":q?"Remove from favorites":"Add to favorites",children:e.jsx("span",{className:"ico ico-heart","aria-hidden":!0})})]}),e.jsxs("div",{className:"item-detail__chips",children:[e.jsx("span",{className:"chip chip--rarity",style:{background:qe(G),color:Be(G)},children:t.rarity}),e.jsxs("span",{className:"chip item-detail__chip",children:[Y?e.jsx("span",{className:`ico ico-${Y} item-detail__chip-ico`,"aria-hidden":!0}):null,ut(t)]}),K?e.jsxs("span",{className:"chip item-detail__chip",children:[H?e.jsx("span",{className:`ico ico-${H} item-detail__chip-ico`,"aria-hidden":!0}):null,K]}):null]}),$?e.jsxs("div",{className:"item-detail__section item-detail__description",children:[e.jsx("div",{className:"item-detail__label",children:"Description"}),e.jsx("p",{className:`item-detail__desc-text${V?" is-expanded":""}`,children:$}),$.length>140?e.jsx("button",{className:"link item-detail__desc-toggle",onClick:()=>ne(i=>!i),children:V?"Show less":"Read more"}):null]}):null,t.creator?e.jsx("div",{className:"item-detail__meta",children:e.jsxs("div",{className:"item-detail__meta-col",children:[e.jsx("div",{className:"item-detail__label",children:"Creator"}),e.jsx(Me,{address:t.creator,className:"item-detail__creator",linkToProfile:!0})]})}):null,e.jsx("hr",{className:"item-detail__divider"}),e.jsxs("div",{className:"item-detail__price-block",children:[e.jsx("div",{className:"item-detail__price-label",children:"Price"}),b?ue?e.jsxs("div",{className:"item-detail__price item-detail__price--sale",children:[e.jsxs("span",{className:"item-detail__price",children:[e.jsx(F,{className:"item-detail__diamond"}),e.jsx("span",{className:"item-detail__price-value",children:t.priceCredits})]}),e.jsxs("span",{className:"item-detail__price-was",children:[e.jsx(F,{className:"item-detail__diamond item-detail__diamond--was"}),t.compareAtCredits]}),ee(t.compareAtCredits,t.priceCredits)>0?e.jsxs("span",{className:"item-detail__sale-badge",children:["SALE -",ee(t.compareAtCredits,t.priceCredits),"%"]}):null,e.jsx(We,{endsAt:t.saleEndsAt,className:"item-detail__countdown"})]}):e.jsxs("div",{className:"item-detail__price",children:[e.jsx(F,{className:"item-detail__diamond"}),e.jsx("span",{className:"item-detail__price-value",children:t.priceCredits})]}):e.jsx("div",{className:"item-detail__price item-detail__price--none",children:"Not for sale"}),d?e.jsxs("div",{className:"item-detail__balance muted",children:["Your balance: ",e.jsx(F,{className:"ccy-mark"})," ",(_==null?void 0:_.credits)??0]}):null]}),e.jsx("div",{className:"item-detail__ctas",children:J?e.jsxs("p",{className:"item-detail__own-note muted",children:["This is your item — manage it in ",e.jsx(ge,{to:"/my-assets",children:"My Assets"}),"."]}):e.jsxs(e.Fragment,{children:[b?e.jsx("button",{className:"btn btn--purple item-detail__cta",onClick:me,disabled:g||E,children:g?"Buying…":"Buy now"}):null,e.jsxs("button",{className:"item-detail__addcart",onClick:oe,disabled:!b||B||E||g,children:[e.jsx("span",{className:"ico ico-cart-solid item-detail__addcart-ico","aria-hidden":!0}),_e]})]})}),y?e.jsx("p",{className:"muted item-detail__status",children:y}):null,c?e.jsx("p",{className:"error item-detail__status",children:c}):null]})]}),e.jsx(dt,{title:he,items:le,onViewAll:t.contractAddress?()=>m(`/collection/${t.contractAddress}`):void 0})]})}export{gt as ItemDetail,gt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as l}from"./react-
|
|
1
|
+
import{r as i,j as l}from"./react-iAgwec9M.js";function a({hasNextPage:e,isFetching:r,onLoadMore:n}){const t=i.useRef(null);return i.useEffect(()=>{const s=t.current;if(!s||!e)return;const o=new IntersectionObserver(u=>{var c;(c=u[0])!=null&&c.isIntersecting&&!r&&n()},{rootMargin:"600px 0px"});return o.observe(s),()=>o.disconnect()},[e,r,n]),e?l.jsx("div",{className:"load-more",ref:t,children:l.jsx("button",{className:"btn btn--ghost",onClick:n,disabled:r,children:r?"Loading…":"Load more"})}):null}export{a as L};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as U,r as d,j as s,L as re}from"./react-CQ5qhqs6.js";import{j as z,i as V,af as le,w as B,e as q,x as C,p as ee,y as P,o as G,D as W,H as se,c as ce,u as Y,au as oe,h as de,av as me}from"./index-DvAy35iS.js";import{f as ue}from"./import-DI2r0vcY.js";import{c as he}from"./buy-KvjWmHql.js";import{a as pe,b as ge,i as be,e as ye,c as xe}from"./trade-encoding-CmkOOQWS.js";import{s as je}from"./wallet-kind-D56TeB0g.js";import{L as fe}from"./LoadMore-7qZApSeo.js";import{u as _e}from"./useInfiniteGrid-DBBDC6CU.js";import"./ethers-DXxh-eEm.js";import"./mana-rate-BmhpEynZ.js";import"./index-CUDTJiCv.js";const F=()=>`${V.builderServerUrl}/v1`;function ae(e){return Array.isArray(e)?e:"results"in e&&Array.isArray(e.results)?e.results:"data"in e&&Array.isArray(e.data)?e.data:[]}async function ne(e,i){const n=await le(e,{method:"GET",identity:i,metadata:{}});if(!n.ok)throw new Error(`builder-server ${n.status}: ${await n.text()}`);const c=await n.json();return c.data??c}function Ne(e,i){const n=i-e;return n>0?n:0}function ve(e){var i,n,c,r,l;return((n=(i=e.data)==null?void 0:i.wearable)==null?void 0:n.category)??((r=(c=e.data)==null?void 0:c.emote)==null?void 0:r.category)??((l=e.data)==null?void 0:l.category)??e.type??"wearable"}function J(e){return`${F()}/storage/contents/${e}`}function $(e,i){if(!e)return"";if(/^https?:\/\//.test(e))return e;const n=i==null?void 0:i[e];return n?J(n):/^(ba|Qm)/.test(e)?J(e):""}async function Ie(e,i){try{const n=await fetch(`${F()}/items/${e}/${i}/contents`);if(!n.ok)return{};const c=await n.json();return c.data??c}catch{return{}}}async function ke(e,i,n){const c=$(e.thumbnail,e.contents)||$("thumbnail.png",e.contents);if(c)return c;if(i&&n){const r=await Ie(i,n);return $(e.thumbnail,r)||$("thumbnail.png",r)||$("image.png",r)}return""}async function we(e,i){const n=`${F()}/${e.toLowerCase()}/collections?is_published=true`,c=await ne(n,i);return ae(c).filter(r=>r.is_published&&!!r.contract_address).map(r=>({id:r.id,name:r.name,contractAddress:r.contract_address.toLowerCase(),isPublished:r.is_published,isApproved:r.is_approved,minters:(r.minters??[]).map(l=>l.toLowerCase())}))}async function Ce(e,i){const n=`${F()}/collections/${e.id}/items`,c=await ne(n,i);return(await Promise.all(ae(c).map(async l=>{const v=l.rarity??"common",f=Number(l.total_supply??0)||0;let m=0;try{m=z.Rarity.getMaxSupply(v)}catch{m=0}const _=(l.contract_address??e.contractAddress).toLowerCase(),p=l.blockchain_item_id??"";return{id:l.id,collectionId:e.id,collectionName:e.name,contractAddress:_,blockchainItemId:p,name:l.name,category:ve(l),rarity:v,thumbnail:await ke(l,_,p),type:l.type??"wearable",isPublished:l.is_published??e.isPublished,isApproved:l.is_approved??e.isApproved,totalSupply:f,maxSupply:m,remainingSupply:Ne(f,m),minters:e.minters}}))).filter(Se)}function Se(e){return e.isPublished&&e.isApproved&&e.blockchainItemId!==""&&e.blockchainItemId!=null&&e.remainingSupply>0}async function Ae(e,i){const n=await we(e,i);return(await Promise.all(n.map(async r=>{try{return await Ce(r,i)}catch{return[]}}))).flat()}const Pe=1e3*60*60*24*182;function $e(e){const i=e,n=(i.message??"").toLowerCase();return i.code===4001||n.includes("reject")||n.includes("denied")||n.includes("cancel")?"You cancelled the request.":"Couldn't list your item — please try again."}function Le({asset:e,session:i,onClose:n}){const c=B(),r=U(),[l,v]=d.useState("10"),[f,m]=d.useState(null),[_,p]=d.useState(null),[g,k]=d.useState(!1),[j,I]=d.useState(null);async function S(){p(null);const o=Number(l);if(!Number.isInteger(o)||o<=0){p("Enter a whole number of credits");return}k(!0);try{m("Getting your item ready…"),await pe({signer:i.signer,contractAddress:e.contractAddress,chainId:e.chainId}),m("Listing your item…");const N=await ge({signer:i.signer,nft:{contractAddress:e.contractAddress,tokenId:e.tokenId,network:e.network,chainId:e.chainId},usdPrice:o/10,expiresAtMs:Date.now()+Pe});m("Publishing…"),await ee(N,i.identity),m(null),I(o),P("Shop Listed Item",{item_id:e.itemId??e.tokenId??null,contract_address:e.contractAddress,price_credits:o,price_usd:o/10,listing_type:"secondary",is_primary:!1}),G.success(`“${e.name}” is now on sale!`),c.invalidateQueries({queryKey:["my-assets",i.address]})}catch(N){W(N,{flow:"list_secondary"}),P("Shop Listing Failed",{listing_type:"secondary",error_code:se(N)}),p($e(N)),m(null)}finally{k(!1)}}function x(){n(),r(`/item/${e.contractAddress}/${e.tokenId}`)}return j!==null?s.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:s.jsxs("div",{className:"modal modal--success",onClick:o=>o.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),s.jsx("h2",{className:"modal__title",children:"It’s on sale! 🎉"}),e.image?s.jsx("img",{className:"modal__img",src:e.image,alt:e.name}):null,s.jsx("p",{className:"modal-success__name",children:e.name}),s.jsxs("p",{className:"muted small",children:["Listed for ",s.jsxs("strong",{children:[s.jsx(q,{className:"ccy-mark"})," ",j]})]}),s.jsxs("div",{className:"modal__actions",children:[s.jsx("button",{className:"btn btn--ghost",onClick:n,children:"Done"}),s.jsx("button",{className:"btn btn--purple",onClick:x,children:"View in Shop"})]})]})}):s.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:s.jsxs("div",{className:"modal",onClick:o=>o.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsxs("h2",{className:"modal__title",children:["List “",e.name,"”"]}),e.image?s.jsx("img",{className:"modal__img",src:e.image,alt:e.name}):null,s.jsxs("label",{className:"field",children:[s.jsxs("span",{children:["Price (",C.name,")"]}),s.jsx("input",{type:"number",min:"1",step:"1",value:l,onChange:o=>v(o.target.value),disabled:g})]}),s.jsxs("p",{className:"muted small",children:["Priced in whole ",C.name," (1 ",C.nameSingular," = $0.10)."]}),f?s.jsx("p",{className:"muted",children:f}):null,_?s.jsx("p",{className:"error",children:_}):null,s.jsxs("div",{className:"modal__actions",children:[s.jsx("button",{className:"btn btn--ghost",onClick:n,disabled:g,children:"Cancel"}),s.jsx("button",{className:"btn",onClick:S,disabled:g,children:g?"Listing…":"Put on sale"})]})]})})}const Ee=1e3*60*60*24*182;function Me(e){const i=e,n=(i.message??"").toLowerCase();return i.code===4001||n.includes("reject")||n.includes("denied")||n.includes("cancel")?"You cancelled the request.":"Couldn't publish your item — please try again."}function qe({item:e,session:i,onClose:n}){const c=B(),r=U(),[l,v]=d.useState("10"),[f,m]=d.useState(null),[_,p]=d.useState(null),[g,k]=d.useState(!1),[j,I]=d.useState(null),[S,x]=d.useState(null),o=V.chainId,N=je(i.providerType);d.useEffect(()=>{let u=!1;return(async()=>{try{const b=await be({contractAddress:e.contractAddress,chainId:o});u||I(b)}catch{u||I(!1)}})(),()=>{u=!0}},[e.contractAddress,o]);async function T(){p(null);const u=Number(l);if(!Number.isInteger(u)||u<=0){p("Enter a whole number of credits");return}k(!0);try{j||(m("Enabling sales for this collection…"),await ye({signer:i.signer,contractAddress:e.contractAddress,chainId:o}),I(!0)),m("Publishing your item…");const b=await xe({signer:i.signer,item:{contractAddress:e.contractAddress,itemId:e.blockchainItemId,network:z.Network.MATIC,chainId:o},usdPrice:u/10,uses:e.remainingSupply,expiresAtMs:Date.now()+Ee});m("Finishing up…"),await ee(b,i.identity),m(null),x(u),P("Shop Listed Item",{item_id:e.blockchainItemId,contract_address:e.contractAddress,price_credits:u,price_usd:u/10,listing_type:"primary",is_primary:!0}),G.success(`“${e.name}” is now on sale!`),c.invalidateQueries({queryKey:["publishable-items"]}),c.invalidateQueries({queryKey:["collection-sale-state"]})}catch(b){W(b,{flow:"list_primary"}),P("Shop Listing Failed",{listing_type:"primary",error_code:se(b)}),p(Me(b)),m(null)}finally{k(!1)}}function O(){n(),r(`/item/${e.contractAddress}/${e.blockchainItemId}`)}const L=g?"Listing…":j===!1?"Enable & put on sale":"Put on sale";return S!==null?s.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:s.jsxs("div",{className:"modal modal--success",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),s.jsx("h2",{className:"modal__title",children:"It’s on sale! 🎉"}),e.thumbnail?s.jsx("img",{className:"modal__img",src:e.thumbnail,alt:e.name}):null,s.jsx("p",{className:"modal-success__name",children:e.name}),s.jsxs("p",{className:"muted small",children:["Listed for ",s.jsxs("strong",{children:[s.jsx(q,{className:"ccy-mark"})," ",S]})," · ",e.remainingSupply.toLocaleString()," available"]}),s.jsxs("div",{className:"modal__actions",children:[s.jsx("button",{className:"btn btn--ghost",onClick:n,children:"Done"}),s.jsx("button",{className:"btn btn--purple",onClick:O,children:"View in Shop"})]})]})}):s.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:s.jsxs("div",{className:"modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsxs("h2",{className:"modal__title",children:["Publish “",e.name,"”"]}),e.thumbnail?s.jsx("img",{className:"modal__img",src:e.thumbnail,alt:e.name}):null,s.jsxs("p",{className:"muted small",children:["From your collection “",e.collectionName,"” · ",e.remainingSupply.toLocaleString()," available"]}),s.jsxs("label",{className:"field",children:[s.jsxs("span",{children:["Price (",C.name,")"]}),s.jsx("input",{type:"number",min:"1",step:"1",value:l,onChange:u=>v(u.target.value),disabled:g})]}),s.jsxs("p",{className:"muted small",children:["Priced in whole ",C.name," (1 ",C.nameSingular," = $0.10)."]}),j===!1&&!g?N?s.jsxs("p",{className:"muted small primary-note",children:["First time selling from “",e.collectionName,"”? It needs a one-time approval, then you’ll confirm the listing — two quick confirmations. After this, listing more items from this collection is a single step."]}):s.jsxs("p",{className:"muted small primary-note",children:["First time selling from “",e.collectionName,"”? Setting it up takes a moment — after that, listing more items from this collection is instant."]}):j===!0&&!g?N?s.jsx("p",{className:"muted small primary-note",children:"This collection is ready — publishing is a single confirmation."}):s.jsx("p",{className:"muted small primary-note",children:"This collection is ready — publishing is instant."}):null,f?s.jsx("p",{className:"muted",children:f}):null,_?s.jsx("p",{className:"error",children:_}):null,s.jsxs("div",{className:"modal__actions",children:[s.jsx("button",{className:"btn btn--ghost",onClick:n,disabled:g,children:"Cancel"}),s.jsx("button",{className:"btn",onClick:T,disabled:g||j===null,children:j===null?"Checking…":L})]})]})})}const Fe=48;function Te(e){return{id:e.id,name:e.name,creator:"",contractAddress:e.contractAddress,itemId:e.itemId,category:e.category,rarity:e.rarity??"common",network:e.network,chainId:e.chainId,thumbnail:e.image,priceCredits:e.listingPrice??0,gender:null,tokenId:e.tokenId}}function Z(e){return{id:`${e.contractAddress}-${e.blockchainItemId}`,name:e.name,creator:"",contractAddress:e.contractAddress,itemId:e.blockchainItemId,category:e.category,rarity:e.rarity,network:"MATIC",chainId:V.chainId,thumbnail:e.thumbnail,priceCredits:0,gender:null}}function He(){const{session:e,error:i,signIn:n,restore:c}=ce(),r=U(),l=B(),[v,f]=d.useState(null),[m,_]=d.useState(null),[p,g]=d.useState(null),[k,j]=d.useState(null);function I(a){const t=a.tokenId??a.itemId??"";!a.contractAddress||!t||r(`/item/${a.contractAddress}/${t}`,{state:{item:a}})}async function S(a,t,h){if(e){j(null),g(h);try{const y=await de(a);await he({trade:y,signer:e.signer}),G.success(`“${t}” is no longer for sale.`),await l.invalidateQueries({queryKey:["my-assets",e.address]}),await l.invalidateQueries({queryKey:["collection-sale-state"]})}catch(y){const E=y,M=(E.message??"").toLowerCase(),X=E.code===4001||M.includes("reject")||M.includes("denied");X||W(y,{flow:"remove-listing",tradeId:a}),j(X?"You cancelled the request.":"Couldn't remove the listing — please try again.")}finally{g(null)}}}d.useEffect(()=>{c()},[c]);const x=e==null?void 0:e.address,{items:o,isLoading:N,error:T,hasNextPage:O,isFetchingNextPage:L,fetchNextPage:u}=_e(["my-assets",x],a=>oe(x,{first:Fe,skip:a}).then(t=>({items:t.assets,total:t.total})),{enabled:!!x}),{data:b}=Y({queryKey:["importable",x],queryFn:()=>ue(x),enabled:!!x}),R=((b==null?void 0:b.creations.length)??0)+((b==null?void 0:b.owned.length)??0),{data:A,isLoading:te,isError:ie}=Y({queryKey:["publishable-items",x],queryFn:()=>Ae(x,e.identity),enabled:!!e,retry:!1}),K=d.useMemo(()=>[...new Set((A??[]).map(a=>a.contractAddress))],[A]),{data:w}=Y({queryKey:["collection-sale-state",x,K],enabled:K.length>0,queryFn:async()=>{const a=await Promise.all(K.map(async h=>[h,await me(h)])),t={};for(const[h,y]of a)for(const[E,M]of Object.entries(y))t[`${h}-${E}`]=M;return t}}),Q=a=>w==null?void 0:w[`${a.contractAddress}-${a.blockchainItemId}`],D=d.useMemo(()=>(A??[]).filter(a=>{var t;return(t=Q(a))==null?void 0:t.isOnSale}),[A,w]),H=d.useMemo(()=>{var t;const a=new Map;for(const h of A??[]){if((t=w==null?void 0:w[`${h.contractAddress}-${h.blockchainItemId}`])!=null&&t.isOnSale)continue;const y=a.get(h.collectionId)??{id:h.collectionId,name:h.collectionName,items:[]};y.items.push(h),a.set(h.collectionId,y)}return[...a.values()]},[A,w]);return e?s.jsxs("section",{className:"myassets",children:[s.jsx("h1",{children:"My Assets"}),R>0?s.jsxs(re,{className:"import-banner",to:"/import",children:[s.jsx("span",{className:"import-banner__ico","aria-hidden":!0,children:"📦"}),s.jsxs("span",{className:"import-banner__text",children:[s.jsx("strong",{children:"Import your listings"}),s.jsxs("span",{className:"import-banner__sub",children:["You have ",R," item",R===1?"":"s"," for sale elsewhere — bring them into the Shop."]})]}),s.jsx("span",{className:"import-banner__cta",children:"Import"})]}):null,s.jsxs("div",{className:"myassets__section",children:[s.jsxs("div",{className:"myassets__section-head",children:[s.jsx("h2",{className:"myassets__section-title",children:"Items you own"}),s.jsx("p",{className:"myassets__section-sub",children:"Wearables & emotes you’ve bought — resell them in the Shop."})]}),T?s.jsx("p",{className:"error",children:"Couldn’t load your items — please try again."}):null,k?s.jsx("p",{className:"error",children:k}):null,s.jsxs("div",{className:"asset-grid",children:[N?Array.from({length:8}).map((a,t)=>s.jsx("div",{className:"asset-card asset-card--skeleton"},`sk-${t}`)):o.map(a=>s.jsxs("article",{className:"asset-card asset-card--link",children:[s.jsx("button",{className:"card-link-overlay","aria-label":`View ${a.name}`,onClick:()=>I(Te(a))}),s.jsx("div",{className:"asset-card__img",children:a.image?s.jsx("img",{src:a.image,alt:a.name}):null}),s.jsx("div",{className:"asset-card__name",title:a.name,children:a.name}),a.isOnSale?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"asset-card__listed",children:[s.jsxs("span",{className:"asset-card__price",children:[s.jsx(q,{className:"ccy-mark"})," ",a.listingPrice]}),s.jsx("span",{className:"badge",children:"On sale"})]}),s.jsx("button",{className:"btn btn--sm btn--ghost asset-card__remove",disabled:p===a.id||!a.tradeId,onClick:t=>{t.stopPropagation(),a.tradeId&&S(a.tradeId,a.name,a.id)},children:p===a.id?"Removing…":"Remove listing"})]}):s.jsx("button",{className:"btn btn--sm",onClick:t=>{t.stopPropagation(),P("Shop Started Listing",{listing_type:"secondary",item_id:a.itemId??a.tokenId??null}),f(a)},children:"Put on sale"})]},a.id)),L?Array.from({length:4}).map((a,t)=>s.jsx("div",{className:"asset-card asset-card--skeleton"},`msk-${t}`)):null]}),s.jsx(fe,{hasNextPage:O,isFetching:L,onLoadMore:()=>u()}),!N&&o.length===0?s.jsx("p",{className:"muted",children:"No items in your wardrobe yet."}):null]}),s.jsxs("div",{className:"myassets__section",children:[s.jsxs("div",{className:"myassets__section-head",children:[s.jsx("h2",{className:"myassets__section-title",children:"Your creations"}),s.jsxs("p",{className:"myassets__section-sub",children:["Items you made. Put them on sale in the Shop — set a price in ",C.name," and buyers pay with ",C.name,"."]})]}),te?s.jsx("div",{className:"publish-grid",children:Array.from({length:4}).map((a,t)=>s.jsx("div",{className:"asset-card asset-card--skeleton"},`pub-sk-${t}`))}):ie?s.jsx("p",{className:"publish-empty",children:"We couldn’t load your collections right now. Please try again in a moment."}):D.length===0&&H.length===0?s.jsx("p",{className:"publish-empty",children:"You don’t have any items to publish yet."}):s.jsxs(s.Fragment,{children:[D.length>0?s.jsxs("div",{className:"creations-collection",children:[s.jsx("h3",{className:"creations-collection__name",children:"On sale"}),s.jsx("div",{className:"publish-grid",children:D.map(a=>{var t;return s.jsxs("article",{className:"publish-card publish-card--link",children:[s.jsx("button",{className:"card-link-overlay","aria-label":`View ${a.name}`,onClick:()=>I(Z(a))}),s.jsx("div",{className:"publish-card__img",children:a.thumbnail?s.jsx("img",{src:a.thumbnail,alt:a.name}):null}),s.jsx("div",{className:"publish-card__name",title:a.name,children:a.name}),s.jsxs("div",{className:"publish-card__listed",children:[s.jsxs("span",{className:"publish-card__price",children:[s.jsx(q,{className:"ccy-mark"})," ",((t=Q(a))==null?void 0:t.priceCredits)??0]}),s.jsx("span",{className:"badge",children:"On sale"})]}),s.jsx("button",{className:"btn btn--sm btn--ghost publish-card__cta",disabled:p===a.id,onClick:h=>{h.stopPropagation();const y=Q(a);y!=null&&y.tradeId&&S(y.tradeId,a.name,a.id)},children:p===a.id?"Removing…":"Remove listing"})]},`${a.contractAddress}-${a.blockchainItemId}`)})})]}):null,H.map(a=>s.jsxs("div",{className:"creations-collection",children:[s.jsx("h3",{className:"creations-collection__name",children:a.name}),s.jsx("div",{className:"publish-grid",children:a.items.map(t=>s.jsxs("article",{className:"publish-card publish-card--link",children:[s.jsx("button",{className:"card-link-overlay","aria-label":`View ${t.name}`,onClick:()=>I(Z(t))}),s.jsx("div",{className:"publish-card__img",children:t.thumbnail?s.jsx("img",{src:t.thumbnail,alt:t.name}):null}),s.jsx("div",{className:"publish-card__name",title:t.name,children:t.name}),s.jsxs("div",{className:"publish-card__meta",children:[s.jsx("span",{className:"publish-chip publish-chip--rarity",children:t.rarity}),s.jsxs("span",{className:"publish-card__supply",children:[t.remainingSupply.toLocaleString()," available"]})]}),s.jsx("button",{className:"btn btn--sm btn--purple publish-card__cta",onClick:h=>{h.stopPropagation(),P("Shop Started Listing",{listing_type:"primary",item_id:t.blockchainItemId}),_(t)},children:"Put on sale"})]},`${t.contractAddress}-${t.blockchainItemId}`))})]},a.id))]})]}),v?s.jsx(Le,{asset:v,session:e,onClose:()=>f(null)}):null,m?s.jsx(qe,{item:m,session:e,onClose:()=>_(null)}):null]}):s.jsxs("section",{className:"myassets",children:[s.jsx("h1",{children:"My Assets"}),s.jsx("p",{className:"muted",children:"Sign in to sell your items."}),s.jsx("div",{className:"connect-row",children:s.jsx("button",{className:"btn btn--purple",onClick:()=>n(),children:"Sign in"})}),i?s.jsx("p",{className:"error",children:i}):null]})}export{He as MyAssets};
|
|
1
|
+
import{a as U,r as d,j as s,L as re}from"./react-iAgwec9M.js";import{j as Z,i as V,ag as le,w as B,e as q,x as C,p as ee,y as P,o as G,D as W,H as se,c as ce,u as Y,az as oe,h as de,aA as me}from"./index-Bct-eJWT.js";import{f as ue}from"./import-DRq28X4S.js";import{c as he}from"./buy-CXa71Woo.js";import{a as pe,b as ge,i as be,e as ye,c as xe}from"./trade-encoding-B73Nbkim.js";import{s as je}from"./wallet-kind-C1BAMMs6.js";import{L as _e}from"./LoadMore-8Dx5lULo.js";import{u as fe}from"./useInfiniteGrid-DGtN78WM.js";import"./ethers-D-4WUfRB.js";import"./mana-rate-CN4rx5dQ.js";import"./index-CQ6rdhhJ.js";const F=()=>`${V.builderServerUrl}/v1`;function ae(e){return Array.isArray(e)?e:"results"in e&&Array.isArray(e.results)?e.results:"data"in e&&Array.isArray(e.data)?e.data:[]}async function ne(e,i){const n=await le(e,{method:"GET",identity:i,metadata:{}});if(!n.ok)throw new Error(`builder-server ${n.status}: ${await n.text()}`);const c=await n.json();return c.data??c}function Ne(e,i){const n=i-e;return n>0?n:0}function ve(e){var i,n,c,r,l;return((n=(i=e.data)==null?void 0:i.wearable)==null?void 0:n.category)??((r=(c=e.data)==null?void 0:c.emote)==null?void 0:r.category)??((l=e.data)==null?void 0:l.category)??e.type??"wearable"}function z(e){return`${F()}/storage/contents/${e}`}function $(e,i){if(!e)return"";if(/^https?:\/\//.test(e))return e;const n=i==null?void 0:i[e];return n?z(n):/^(ba|Qm)/.test(e)?z(e):""}async function Ie(e,i){try{const n=await fetch(`${F()}/items/${e}/${i}/contents`);if(!n.ok)return{};const c=await n.json();return c.data??c}catch{return{}}}async function ke(e,i,n){const c=$(e.thumbnail,e.contents)||$("thumbnail.png",e.contents);if(c)return c;if(i&&n){const r=await Ie(i,n);return $(e.thumbnail,r)||$("thumbnail.png",r)||$("image.png",r)}return""}async function we(e,i){const n=`${F()}/${e.toLowerCase()}/collections?is_published=true`,c=await ne(n,i);return ae(c).filter(r=>r.is_published&&!!r.contract_address).map(r=>({id:r.id,name:r.name,contractAddress:r.contract_address.toLowerCase(),isPublished:r.is_published,isApproved:r.is_approved,minters:(r.minters??[]).map(l=>l.toLowerCase())}))}async function Ce(e,i){const n=`${F()}/collections/${e.id}/items`,c=await ne(n,i);return(await Promise.all(ae(c).map(async l=>{const v=l.rarity??"common",_=Number(l.total_supply??0)||0;let m=0;try{m=Z.Rarity.getMaxSupply(v)}catch{m=0}const f=(l.contract_address??e.contractAddress).toLowerCase(),p=l.blockchain_item_id??"";return{id:l.id,collectionId:e.id,collectionName:e.name,contractAddress:f,blockchainItemId:p,name:l.name,category:ve(l),rarity:v,thumbnail:await ke(l,f,p),type:l.type??"wearable",isPublished:l.is_published??e.isPublished,isApproved:l.is_approved??e.isApproved,totalSupply:_,maxSupply:m,remainingSupply:Ne(_,m),minters:e.minters}}))).filter(Se)}function Se(e){return e.isPublished&&e.isApproved&&e.blockchainItemId!==""&&e.blockchainItemId!=null&&e.remainingSupply>0}async function Ae(e,i){const n=await we(e,i);return(await Promise.all(n.map(async r=>{try{return await Ce(r,i)}catch{return[]}}))).flat()}const Pe=1e3*60*60*24*182;function $e(e){const i=e,n=(i.message??"").toLowerCase();return i.code===4001||n.includes("reject")||n.includes("denied")||n.includes("cancel")?"You cancelled the request.":"Couldn't list your item — please try again."}function Le({asset:e,session:i,onClose:n}){const c=B(),r=U(),[l,v]=d.useState("10"),[_,m]=d.useState(null),[f,p]=d.useState(null),[g,k]=d.useState(!1),[j,I]=d.useState(null);async function S(){p(null);const o=Number(l);if(!Number.isInteger(o)||o<=0){p("Enter a whole number of credits");return}k(!0);try{m("Getting your item ready…"),await pe({signer:i.signer,contractAddress:e.contractAddress,chainId:e.chainId}),m("Listing your item…");const N=await ge({signer:i.signer,nft:{contractAddress:e.contractAddress,tokenId:e.tokenId,network:e.network,chainId:e.chainId},usdPrice:o/10,expiresAtMs:Date.now()+Pe});m("Publishing…"),await ee(N,i.identity),m(null),I(o),P("Shop Listed Item",{item_id:e.itemId??e.tokenId??null,contract_address:e.contractAddress,price_credits:o,price_usd:o/10,listing_type:"secondary",is_primary:!1}),G.success(`“${e.name}” is now on sale!`),c.invalidateQueries({queryKey:["my-assets",i.address]})}catch(N){W(N,{flow:"list_secondary"}),P("Shop Listing Failed",{listing_type:"secondary",error_code:se(N)}),p($e(N)),m(null)}finally{k(!1)}}function x(){n(),r(`/item/${e.contractAddress}/${e.tokenId}`)}return j!==null?s.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:s.jsxs("div",{className:"modal modal--success",onClick:o=>o.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),s.jsx("h2",{className:"modal__title",children:"It’s on sale! 🎉"}),e.image?s.jsx("img",{className:"modal__img",src:e.image,alt:e.name}):null,s.jsx("p",{className:"modal-success__name",children:e.name}),s.jsxs("p",{className:"muted small",children:["Listed for ",s.jsxs("strong",{children:[s.jsx(q,{className:"ccy-mark"})," ",j]})]}),s.jsxs("div",{className:"modal__actions",children:[s.jsx("button",{className:"btn btn--ghost",onClick:n,children:"Done"}),s.jsx("button",{className:"btn btn--purple",onClick:x,children:"View in Shop"})]})]})}):s.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:s.jsxs("div",{className:"modal",onClick:o=>o.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsxs("h2",{className:"modal__title",children:["List “",e.name,"”"]}),e.image?s.jsx("img",{className:"modal__img",src:e.image,alt:e.name}):null,s.jsxs("label",{className:"field",children:[s.jsxs("span",{children:["Price (",C.name,")"]}),s.jsx("input",{type:"number",min:"1",step:"1",value:l,onChange:o=>v(o.target.value),disabled:g})]}),s.jsxs("p",{className:"muted small",children:["Priced in whole ",C.name," (1 ",C.nameSingular," = $0.10)."]}),_?s.jsx("p",{className:"muted",children:_}):null,f?s.jsx("p",{className:"error",children:f}):null,s.jsxs("div",{className:"modal__actions",children:[s.jsx("button",{className:"btn btn--ghost",onClick:n,disabled:g,children:"Cancel"}),s.jsx("button",{className:"btn",onClick:S,disabled:g,children:g?"Listing…":"Put on sale"})]})]})})}const Ee=1e3*60*60*24*182;function Me(e){const i=e,n=(i.message??"").toLowerCase();return i.code===4001||n.includes("reject")||n.includes("denied")||n.includes("cancel")?"You cancelled the request.":"Couldn't publish your item — please try again."}function qe({item:e,session:i,onClose:n}){const c=B(),r=U(),[l,v]=d.useState("10"),[_,m]=d.useState(null),[f,p]=d.useState(null),[g,k]=d.useState(!1),[j,I]=d.useState(null),[S,x]=d.useState(null),o=V.chainId,N=je(i.providerType);d.useEffect(()=>{let u=!1;return(async()=>{try{const b=await be({contractAddress:e.contractAddress,chainId:o});u||I(b)}catch{u||I(!1)}})(),()=>{u=!0}},[e.contractAddress,o]);async function T(){p(null);const u=Number(l);if(!Number.isInteger(u)||u<=0){p("Enter a whole number of credits");return}k(!0);try{j||(m("Enabling sales for this collection…"),await ye({signer:i.signer,contractAddress:e.contractAddress,chainId:o}),I(!0)),m("Publishing your item…");const b=await xe({signer:i.signer,item:{contractAddress:e.contractAddress,itemId:e.blockchainItemId,network:Z.Network.MATIC,chainId:o},usdPrice:u/10,uses:e.remainingSupply,expiresAtMs:Date.now()+Ee});m("Finishing up…"),await ee(b,i.identity),m(null),x(u),P("Shop Listed Item",{item_id:e.blockchainItemId,contract_address:e.contractAddress,price_credits:u,price_usd:u/10,listing_type:"primary",is_primary:!0}),G.success(`“${e.name}” is now on sale!`),c.invalidateQueries({queryKey:["publishable-items"]}),c.invalidateQueries({queryKey:["collection-sale-state"]})}catch(b){W(b,{flow:"list_primary"}),P("Shop Listing Failed",{listing_type:"primary",error_code:se(b)}),p(Me(b)),m(null)}finally{k(!1)}}function O(){n(),r(`/item/${e.contractAddress}/${e.blockchainItemId}`)}const L=g?"Listing…":j===!1?"Enable & put on sale":"Put on sale";return S!==null?s.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:s.jsxs("div",{className:"modal modal--success",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),s.jsx("h2",{className:"modal__title",children:"It’s on sale! 🎉"}),e.thumbnail?s.jsx("img",{className:"modal__img",src:e.thumbnail,alt:e.name}):null,s.jsx("p",{className:"modal-success__name",children:e.name}),s.jsxs("p",{className:"muted small",children:["Listed for ",s.jsxs("strong",{children:[s.jsx(q,{className:"ccy-mark"})," ",S]})," · ",e.remainingSupply.toLocaleString()," available"]}),s.jsxs("div",{className:"modal__actions",children:[s.jsx("button",{className:"btn btn--ghost",onClick:n,children:"Done"}),s.jsx("button",{className:"btn btn--purple",onClick:O,children:"View in Shop"})]})]})}):s.jsx("div",{className:"modal-backdrop",onClick:n,role:"presentation",children:s.jsxs("div",{className:"modal",onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsxs("h2",{className:"modal__title",children:["Publish “",e.name,"”"]}),e.thumbnail?s.jsx("img",{className:"modal__img",src:e.thumbnail,alt:e.name}):null,s.jsxs("p",{className:"muted small",children:["From your collection “",e.collectionName,"” · ",e.remainingSupply.toLocaleString()," available"]}),s.jsxs("label",{className:"field",children:[s.jsxs("span",{children:["Price (",C.name,")"]}),s.jsx("input",{type:"number",min:"1",step:"1",value:l,onChange:u=>v(u.target.value),disabled:g})]}),s.jsxs("p",{className:"muted small",children:["Priced in whole ",C.name," (1 ",C.nameSingular," = $0.10)."]}),j===!1&&!g?N?s.jsxs("p",{className:"muted small primary-note",children:["First time selling from “",e.collectionName,"”? It needs a one-time approval, then you’ll confirm the listing — two quick confirmations. After this, listing more items from this collection is a single step."]}):s.jsxs("p",{className:"muted small primary-note",children:["First time selling from “",e.collectionName,"”? Setting it up takes a moment — after that, listing more items from this collection is instant."]}):j===!0&&!g?N?s.jsx("p",{className:"muted small primary-note",children:"This collection is ready — publishing is a single confirmation."}):s.jsx("p",{className:"muted small primary-note",children:"This collection is ready — publishing is instant."}):null,_?s.jsx("p",{className:"muted",children:_}):null,f?s.jsx("p",{className:"error",children:f}):null,s.jsxs("div",{className:"modal__actions",children:[s.jsx("button",{className:"btn btn--ghost",onClick:n,disabled:g,children:"Cancel"}),s.jsx("button",{className:"btn",onClick:T,disabled:g||j===null,children:j===null?"Checking…":L})]})]})})}const Fe=48;function Te(e){return{id:e.id,name:e.name,creator:"",contractAddress:e.contractAddress,itemId:e.itemId,category:e.category,rarity:e.rarity??"common",network:e.network,chainId:e.chainId,thumbnail:e.image,priceCredits:e.listingPrice??0,gender:null,tokenId:e.tokenId}}function J(e){return{id:`${e.contractAddress}-${e.blockchainItemId}`,name:e.name,creator:"",contractAddress:e.contractAddress,itemId:e.blockchainItemId,category:e.category,rarity:e.rarity,network:"MATIC",chainId:V.chainId,thumbnail:e.thumbnail,priceCredits:0,gender:null}}function He(){const{session:e,error:i,signIn:n,restore:c}=ce(),r=U(),l=B(),[v,_]=d.useState(null),[m,f]=d.useState(null),[p,g]=d.useState(null),[k,j]=d.useState(null);function I(a){const t=a.tokenId??a.itemId??"";!a.contractAddress||!t||r(`/item/${a.contractAddress}/${t}`,{state:{item:a}})}async function S(a,t,h){if(e){j(null),g(h);try{const y=await de(a);await he({trade:y,signer:e.signer}),G.success(`“${t}” is no longer for sale.`),await l.invalidateQueries({queryKey:["my-assets",e.address]}),await l.invalidateQueries({queryKey:["collection-sale-state"]})}catch(y){const E=y,M=(E.message??"").toLowerCase(),X=E.code===4001||M.includes("reject")||M.includes("denied");X||W(y,{flow:"remove-listing",tradeId:a}),j(X?"You cancelled the request.":"Couldn't remove the listing — please try again.")}finally{g(null)}}}d.useEffect(()=>{c()},[c]);const x=e==null?void 0:e.address,{items:o,isLoading:N,error:T,hasNextPage:O,isFetchingNextPage:L,fetchNextPage:u}=fe(["my-assets",x],a=>oe(x,{first:Fe,skip:a}).then(t=>({items:t.assets,total:t.total})),{enabled:!!x}),{data:b}=Y({queryKey:["importable",x],queryFn:()=>ue(x),enabled:!!x}),R=((b==null?void 0:b.creations.length)??0)+((b==null?void 0:b.owned.length)??0),{data:A,isLoading:te,isError:ie}=Y({queryKey:["publishable-items",x],queryFn:()=>Ae(x,e.identity),enabled:!!e,retry:!1}),K=d.useMemo(()=>[...new Set((A??[]).map(a=>a.contractAddress))],[A]),{data:w}=Y({queryKey:["collection-sale-state",x,K],enabled:K.length>0,queryFn:async()=>{const a=await Promise.all(K.map(async h=>[h,await me(h)])),t={};for(const[h,y]of a)for(const[E,M]of Object.entries(y))t[`${h}-${E}`]=M;return t}}),Q=a=>w==null?void 0:w[`${a.contractAddress}-${a.blockchainItemId}`],D=d.useMemo(()=>(A??[]).filter(a=>{var t;return(t=Q(a))==null?void 0:t.isOnSale}),[A,w]),H=d.useMemo(()=>{var t;const a=new Map;for(const h of A??[]){if((t=w==null?void 0:w[`${h.contractAddress}-${h.blockchainItemId}`])!=null&&t.isOnSale)continue;const y=a.get(h.collectionId)??{id:h.collectionId,name:h.collectionName,items:[]};y.items.push(h),a.set(h.collectionId,y)}return[...a.values()]},[A,w]);return e?s.jsxs("section",{className:"myassets",children:[s.jsx("h1",{children:"My Assets"}),R>0?s.jsxs(re,{className:"import-banner",to:"/import",children:[s.jsx("span",{className:"import-banner__ico","aria-hidden":!0,children:"📦"}),s.jsxs("span",{className:"import-banner__text",children:[s.jsx("strong",{children:"Import your listings"}),s.jsxs("span",{className:"import-banner__sub",children:["You have ",R," item",R===1?"":"s"," for sale elsewhere — bring them into the Shop."]})]}),s.jsx("span",{className:"import-banner__cta",children:"Import"})]}):null,s.jsxs("div",{className:"myassets__section",children:[s.jsxs("div",{className:"myassets__section-head",children:[s.jsx("h2",{className:"myassets__section-title",children:"Items you own"}),s.jsx("p",{className:"myassets__section-sub",children:"Wearables & emotes you’ve bought — resell them in the Shop."})]}),T?s.jsx("p",{className:"error",children:"Couldn’t load your items — please try again."}):null,k?s.jsx("p",{className:"error",children:k}):null,s.jsxs("div",{className:"asset-grid",children:[N?Array.from({length:8}).map((a,t)=>s.jsx("div",{className:"asset-card asset-card--skeleton"},`sk-${t}`)):o.map(a=>s.jsxs("article",{className:"asset-card asset-card--link",children:[s.jsx("button",{className:"card-link-overlay","aria-label":`View ${a.name}`,onClick:()=>I(Te(a))}),s.jsx("div",{className:"asset-card__img",children:a.image?s.jsx("img",{src:a.image,alt:a.name}):null}),s.jsx("div",{className:"asset-card__name",title:a.name,children:a.name}),a.isOnSale?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"asset-card__listed",children:[s.jsxs("span",{className:"asset-card__price",children:[s.jsx(q,{className:"ccy-mark"})," ",a.listingPrice]}),s.jsx("span",{className:"badge",children:"On sale"})]}),s.jsx("button",{className:"btn btn--sm btn--ghost asset-card__remove",disabled:p===a.id||!a.tradeId,onClick:t=>{t.stopPropagation(),a.tradeId&&S(a.tradeId,a.name,a.id)},children:p===a.id?"Removing…":"Remove listing"})]}):s.jsx("button",{className:"btn btn--sm",onClick:t=>{t.stopPropagation(),P("Shop Started Listing",{listing_type:"secondary",item_id:a.itemId??a.tokenId??null}),_(a)},children:"Put on sale"})]},a.id)),L?Array.from({length:4}).map((a,t)=>s.jsx("div",{className:"asset-card asset-card--skeleton"},`msk-${t}`)):null]}),s.jsx(_e,{hasNextPage:O,isFetching:L,onLoadMore:()=>u()}),!N&&o.length===0?s.jsx("p",{className:"muted",children:"No items in your wardrobe yet."}):null]}),s.jsxs("div",{className:"myassets__section",children:[s.jsxs("div",{className:"myassets__section-head",children:[s.jsx("h2",{className:"myassets__section-title",children:"Your creations"}),s.jsxs("p",{className:"myassets__section-sub",children:["Items you made. Put them on sale in the Shop — set a price in ",C.name," and buyers pay with ",C.name,"."]})]}),te?s.jsx("div",{className:"publish-grid",children:Array.from({length:4}).map((a,t)=>s.jsx("div",{className:"asset-card asset-card--skeleton"},`pub-sk-${t}`))}):ie?s.jsx("p",{className:"publish-empty",children:"We couldn’t load your collections right now. Please try again in a moment."}):D.length===0&&H.length===0?s.jsx("p",{className:"publish-empty",children:"You don’t have any items to publish yet."}):s.jsxs(s.Fragment,{children:[D.length>0?s.jsxs("div",{className:"creations-collection",children:[s.jsx("h3",{className:"creations-collection__name",children:"On sale"}),s.jsx("div",{className:"publish-grid",children:D.map(a=>{var t;return s.jsxs("article",{className:"publish-card publish-card--link",children:[s.jsx("button",{className:"card-link-overlay","aria-label":`View ${a.name}`,onClick:()=>I(J(a))}),s.jsx("div",{className:"publish-card__img",children:a.thumbnail?s.jsx("img",{src:a.thumbnail,alt:a.name}):null}),s.jsx("div",{className:"publish-card__name",title:a.name,children:a.name}),s.jsxs("div",{className:"publish-card__listed",children:[s.jsxs("span",{className:"publish-card__price",children:[s.jsx(q,{className:"ccy-mark"})," ",((t=Q(a))==null?void 0:t.priceCredits)??0]}),s.jsx("span",{className:"badge",children:"On sale"})]}),s.jsx("button",{className:"btn btn--sm btn--ghost publish-card__cta",disabled:p===a.id,onClick:h=>{h.stopPropagation();const y=Q(a);y!=null&&y.tradeId&&S(y.tradeId,a.name,a.id)},children:p===a.id?"Removing…":"Remove listing"})]},`${a.contractAddress}-${a.blockchainItemId}`)})})]}):null,H.map(a=>s.jsxs("div",{className:"creations-collection",children:[s.jsx("h3",{className:"creations-collection__name",children:a.name}),s.jsx("div",{className:"publish-grid",children:a.items.map(t=>s.jsxs("article",{className:"publish-card publish-card--link",children:[s.jsx("button",{className:"card-link-overlay","aria-label":`View ${t.name}`,onClick:()=>I(J(t))}),s.jsx("div",{className:"publish-card__img",children:t.thumbnail?s.jsx("img",{src:t.thumbnail,alt:t.name}):null}),s.jsx("div",{className:"publish-card__name",title:t.name,children:t.name}),s.jsxs("div",{className:"publish-card__meta",children:[s.jsx("span",{className:"publish-chip publish-chip--rarity",children:t.rarity}),s.jsxs("span",{className:"publish-card__supply",children:[t.remainingSupply.toLocaleString()," available"]})]}),s.jsx("button",{className:"btn btn--sm btn--purple publish-card__cta",onClick:h=>{h.stopPropagation(),P("Shop Started Listing",{listing_type:"primary",item_id:t.blockchainItemId}),f(t)},children:"Put on sale"})]},`${t.contractAddress}-${t.blockchainItemId}`))})]},a.id))]})]}),v?s.jsx(Le,{asset:v,session:e,onClose:()=>_(null)}):null,m?s.jsx(qe,{item:m,session:e,onClose:()=>f(null)}):null]}):s.jsxs("section",{className:"myassets",children:[s.jsx("h1",{children:"My Assets"}),s.jsx("p",{className:"muted",children:"Sign in to sell your items."}),s.jsx("div",{className:"connect-row",children:s.jsx("button",{className:"btn btn--purple",onClick:()=>n(),children:"Sign in"})}),i?s.jsx("p",{className:"error",children:i}):null]})}export{He as MyAssets};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as s,L as n}from"./react-
|
|
1
|
+
import{r as o,j as s,L as n}from"./react-iAgwec9M.js";import{b as c,A as l}from"./index-Bct-eJWT.js";import{L as m}from"./LoadMore-8Dx5lULo.js";import"./ethers-D-4WUfRB.js";const i=24;function v(){const t=c(e=>Object.values(e.items)),[a,r]=o.useState(i);return t.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:"No favorites yet"}),s.jsx("p",{className:"muted",children:"Tap the heart on any item to save it here."}),s.jsx(n,{className:"btn btn--purple",to:"/assets",children:"Browse Collectibles"})]}):s.jsxs("section",{className:"favorites",children:[s.jsxs("div",{className:"favorites__head",children:[s.jsx("h1",{children:"My Favorites"}),s.jsxs("span",{className:"favorites__count",children:[t.length," item",t.length>1?"s":""]})]}),s.jsx("div",{className:"grid",children:t.slice(0,a).map(e=>s.jsx(l,{item:e},e.id))}),s.jsx(m,{hasNextPage:a<t.length,isFetching:!1,onLoadMore:()=>r(e=>e+i)})]})}export{v as MyFavorites};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,L as u}from"./react-
|
|
1
|
+
import{j as e,L as u}from"./react-iAgwec9M.js";import{c as l,d as o,u as m,e as p,g as x}from"./index-Bct-eJWT.js";import{L as _}from"./LoadMore-8Dx5lULo.js";import{u as j}from"./useInfiniteGrid-DGtN78WM.js";import"./ethers-D-4WUfRB.js";const N=24;function g(s){try{return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function f({status:s}){return s==="PENDING"?e.jsx("span",{className:"purchase__badge purchase__badge--pending",children:"Processing"}):e.jsx("span",{className:"purchase__badge purchase__badge--done",children:"Completed"})}function y({purchase:s}){const{data:a}=m({queryKey:["trade-display",s.tradeId],queryFn:()=>x(s.tradeId),enabled:!!s.tradeId,staleTime:3e5}),t=(a==null?void 0:a.name)??"Item",i=(a==null?void 0:a.thumbnail)??"",n=(a==null?void 0:a.tokenId)??(a==null?void 0:a.itemId)??"",d=a!=null&&a.contractAddress&&n?`/item/${a.contractAddress}/${n}`:void 0,c=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"purchase__thumb",children:i?e.jsx("img",{src:i,alt:t}):null}),e.jsxs("div",{className:"purchase__info",children:[e.jsx("div",{className:"purchase__name",title:t,children:t}),e.jsx("div",{className:"muted purchase__date",children:g(s.createdAt)})]}),e.jsx(f,{status:s.status}),e.jsxs("div",{className:"purchase__price",children:[e.jsx(p,{className:"ccy-mark"})," ",s.credits]})]});return d?e.jsx(u,{className:"purchase",to:d,children:c}):e.jsx("div",{className:"purchase",children:c})}function A(){const{session:s}=l(),{items:a,isLoading:t,hasNextPage:i,isFetchingNextPage:n,fetchNextPage:d}=j(["purchases",s==null?void 0:s.address],r=>o(s.address,s.identity,{first:N,skip:r}),{enabled:!!s});if(!s)return e.jsxs("div",{className:"purchases-empty",children:[e.jsx("span",{className:"ico ico-cart purchases-empty__ico","aria-hidden":!0}),e.jsx("p",{className:"purchases-empty__title",children:"Sign in to see your purchases"}),e.jsx("p",{className:"muted",children:"Your order history shows up here once you sign in."})]});const c=a.filter(r=>r.status!=="EXPIRED");return!t&&c.length===0?e.jsxs("div",{className:"purchases-empty",children:[e.jsx("span",{className:"ico ico-cart purchases-empty__ico","aria-hidden":!0}),e.jsx("p",{className:"purchases-empty__title",children:"No purchases yet"}),e.jsx("p",{className:"muted",children:"When you buy something it’ll appear here."}),e.jsx(u,{className:"btn btn--purple",to:"/assets",children:"Browse Collectibles"})]}):e.jsxs("section",{className:"purchases",children:[e.jsxs("div",{className:"purchases__head",children:[e.jsx("h1",{children:"My Purchases"}),t?null:e.jsxs("span",{className:"purchases__count",children:[c.length," order",c.length>1?"s":""]})]}),e.jsx("div",{className:"purchases__list",children:t?Array.from({length:4}).map((r,h)=>e.jsx("div",{className:"purchase purchase--skeleton"},h)):e.jsxs(e.Fragment,{children:[c.map(r=>e.jsx(y,{purchase:r},r.id)),n?Array.from({length:2}).map((r,h)=>e.jsx("div",{className:"purchase purchase--skeleton"},`m-${h}`)):null]})}),e.jsx(_,{hasNextPage:i,isFetching:n,onLoadMore:()=>d()})]})}export{A as MyPurchases};
|