@dcl/shop 0.1.0-29233106796.commit-1837efd → 0.1.0-29233112588.commit-3471a57
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-C0rqDJfb.js → AnimatedBackground-CHkBmxUh.js} +1 -1
- package/assets/{Assets-DFF19cjO.js → Assets-4BU9Crmz.js} +1 -1
- package/assets/{Button-uGoMyMeg.js → Button-BX2vF44i.js} +1 -1
- package/assets/{Cart-bVoFfuT2.js → Cart-Dt1wJOE3.js} +1 -1
- package/assets/{CircularProgress-Ca679YX-.js → CircularProgress-CDHgSKkY.js} +1 -1
- package/assets/Collection-DIn7EG6I.js +1 -0
- package/assets/{Creator-CEshnkfr.js → Creator-St94H6BT.js} +1 -1
- package/assets/{ExchangeController-CFvT4C3L.js → ExchangeController-CFIPrnwO.js} +1 -1
- package/assets/{GetCredits-D48kUeN-.js → GetCredits-DdaqNRBc.js} +2 -2
- package/assets/{HelpersUtil-DSOtZH4j.js → HelpersUtil-B5jzyW6x.js} +1 -1
- package/assets/{ImportListings-DN6Tu-bh.js → ImportListings-uI1Q9Cni.js} +1 -1
- package/assets/{ItemDetail-B1lNS7Di.js → ItemDetail-Q5BXaKCZ.js} +2 -2
- package/assets/{Market-KfYPcfQF.js → Market-DQAo1ZUc.js} +1 -1
- package/assets/{MenuItem-6nwFKjkW.js → MenuItem-BadlrOSJ.js} +1 -1
- package/assets/{MyAssets-BXYso89u.js → MyAssets-D-1zLGLa.js} +1 -1
- package/assets/{MyFavorites-6TD3GhQr.js → MyFavorites-DOkuuWff.js} +1 -1
- package/assets/{MyPurchases-DPAy76Q8.js → MyPurchases-CmUWGyAk.js} +1 -1
- package/assets/{NotFound-CXoM3h2z.js → NotFound-DtdtCA8G.js} +1 -1
- package/assets/{RealCheckout-75GM0cgX.js → RealCheckout-Ct5C78JH.js} +1 -1
- package/assets/{ShopFooterInner-C274TFSL.js → ShopFooterInner-qgccN1H6.js} +2 -2
- package/assets/{Success-FCI3WLUn.js → Success-ClzM1ItH.js} +1 -1
- package/assets/{SvgIcon-DuD4CLX1.js → SvgIcon-ZHB11KC9.js} +1 -1
- package/assets/{SwapController-Bt0cz6Wd.js → SwapController-Clus5sIm.js} +1 -1
- package/assets/{TradeService-DYLc9PvE.js → TradeService-05ryi2Hm.js} +1 -1
- package/assets/{W3MFrameProviderSingleton-BvhNgFgm.js → W3MFrameProviderSingleton-CNJGu1s_.js} +3 -3
- package/assets/{WebCryptoP256-CmPjTQJj.js → WebCryptoP256-Ba2CR4Xp.js} +1 -1
- package/assets/{basic-B0YfIqrx.js → basic-Bv9yTnhd.js} +1 -1
- package/assets/{biconomy-ge27Lvzm.js → biconomy-chS0NxIt.js} +1 -1
- package/assets/{buy-CtGOLfNq.js → buy-DSDTz9Ug.js} +1 -1
- package/assets/{buy-gasless-RvPPxhUM.js → buy-gasless-VKTXyC9T.js} +1 -1
- package/assets/{ccip-Dj85jtj6.js → ccip-9Gv2Pf4C.js} +1 -1
- package/assets/{ccip-I5jvI7YU.js → ccip-Bbl_0s1O.js} +1 -1
- package/assets/{collection-DttFUtCF.js → collection-CJBo0QKZ.js} +1 -1
- package/assets/{controller-KIszeBL2.js → controller-CmXQtg8P.js} +2 -2
- package/assets/{core-ov94tG9b.js → core-nWNc93zq.js} +4 -4
- package/assets/{custom-5PrshmtG.js → custom-BPvT6WKj.js} +1 -1
- package/assets/{data-capture-lUD162xM.js → data-capture-OsDnZUv7.js} +1 -1
- package/assets/decimals-CY4MKUZO.js +1 -0
- package/assets/{decimals-DpraMyBi.js → decimals-DrVIWQab.js} +1 -1
- package/assets/{detectExtension-aE5lnWvs.js → detectExtension-CiOOHgJ5.js} +1 -1
- package/assets/{email-CthjyMNP.js → email-BL_6Rwog.js} +1 -1
- package/assets/{embedded-wallet-BJY3GXC2.js → embedded-wallet-BEqYuuLS.js} +1 -1
- package/assets/{engine-j-oLBjOz.js → engine-BSw4yNxP.js} +1 -1
- package/assets/{estimate-l1-fee-DjWZekSm.js → estimate-l1-fee-CRG_ZYOH.js} +1 -1
- package/assets/{eth_estimateGas-DN3qr8TB.js → eth_estimateGas-BFj64_s-.js} +1 -1
- package/assets/{eth_getStorageAt-DQzkgcMe.js → eth_getStorageAt-CrCM1uRk.js} +1 -1
- package/assets/{eth_getTransactionCount-DM4ijSWf.js → eth_getTransactionCount-BukD81TA.js} +1 -1
- package/assets/{extractIPFS-iOFrfwzj.js → extractIPFS-Dm1i6XJu.js} +1 -1
- package/assets/{features-B2Sp0NPq.js → features-I4--UPMy.js} +1 -1
- package/assets/{fetchTokenMetadata-BuZDzhII.js → fetchTokenMetadata-DOoK744L.js} +2 -2
- package/assets/{generateUtilityClasses-EHQxwZec.js → generateUtilityClasses-CVd9wG9P.js} +1 -1
- package/assets/{get-ecosystem-wallet-info-f_luxiNk.js → get-ecosystem-wallet-info-DTNpaty2.js} +1 -1
- package/assets/{getBalance-DR8safQ4.js → getBalance-BHZ3IFEu.js} +1 -1
- package/assets/{getInstalledModules-DYdUHIJC.js → getInstalledModules-De7CDRYo.js} +1 -1
- package/assets/{getNFT-DRWdoeee.js → getNFT-CHg09T74.js} +1 -1
- package/assets/{getNFT-BRjpGSIo.js → getNFT-DoL2HIvx.js} +2 -2
- package/assets/{hashTypedData-DLv4vmSt.js → hashTypedData-CL274mk_.js} +1 -1
- package/assets/{hashTypedData-CfSRA3ti.js → hashTypedData-DTKiEvBJ.js} +1 -1
- package/assets/{import-B7IrqJHM.js → import-B6HLomRq.js} +1 -1
- package/assets/{in-app-wallet-calls-DArzhQxl.js → in-app-wallet-calls-qDphU_6F.js} +1 -1
- package/assets/{index-DjLIZOTh.js → index--LoqTj-4.js} +1 -1
- package/assets/{index-Dl-2j4dO.js → index-7QxFZeGQ.js} +1 -1
- package/assets/{index-DrNzHQM5.js → index-B2hwSpcv.js} +1 -1
- package/assets/{index-D9E3HDnS.js → index-BBXAY787.js} +1 -1
- package/assets/{index-7RiTEasz.js → index-BFflN0t4.js} +1 -1
- package/assets/{index-BILR6PXd.js → index-BLqeW9QA.js} +1 -1
- package/assets/{index-D8yull60.js → index-BQTrO182.js} +5 -5
- package/assets/{index-mQkXd2DT.js → index-BWC26FPE.js} +1 -1
- package/assets/{index-Catw56Zo.js → index-Bchsu7Gy.js} +1 -1
- package/assets/{index-FgCfQjOt.js → index-Bf90wxgH.js} +1 -1
- package/assets/{index-DlKR3Fym.js → index-Bg45xunH.js} +1 -1
- package/assets/{index-Bn5lQZ1w.js → index-Bij4-TSD.js} +1 -1
- package/assets/{index-CRCB75oU.js → index-BjWZj4AD.js} +1 -1
- package/assets/{index-CXqoUgKu.js → index-BjxI-vsX.js} +1 -1
- package/assets/{index-Dr-5ALhc.js → index-C---HSEJ.js} +1 -1
- package/assets/{index-hm6YyqJl.js → index-C0NXl_ZK.js} +2 -2
- package/assets/{index-Br04ERn8.js → index-C5PABxhi.js} +1 -1
- package/assets/{index-BsihGVe1.js → index-CGW_QnLp.js} +1 -1
- package/assets/{index-COxGjPhG.js → index-CH8sNaIF.js} +1 -1
- package/assets/{index-CEMLnpSr.js → index-CHKlpOE4.js} +1 -1
- package/assets/{index-BVKDtuC0.js → index-CPOS-ZX8.js} +1 -1
- package/assets/{index-CrfX_nUp.js → index-CSWQsOGj.js} +1 -1
- package/assets/{index-DbCLSKdx.js → index-CTAdPvyN.js} +1 -1
- package/assets/{index-CD_ojwcp.js → index-CW-8lHlO.js} +1 -1
- package/assets/{index-C6V3kfM1.js → index-C_ObzGNF.js} +1 -1
- package/assets/{index-D9dKa_F_.js → index-CfVmURma.js} +1 -1
- package/assets/{index-DtCgIhCZ.js → index-ChIJGn_8.js} +1 -1
- package/assets/{index-BJpc1lfK.js → index-Cj7Pp_YX.js} +1 -1
- package/assets/{index-Bq01IzMZ.js → index-Cn7q_Auu.js} +1 -1
- package/assets/{index-D-dOTleV.js → index-CrD2cxhw.js} +1 -1
- package/assets/{index-CN5d5qP-.js → index-Cu7Lu9bv.js} +3 -3
- package/assets/{index-Co5EcXpK.js → index-D4o1kYfZ.js} +1 -1
- package/assets/{index-QP8xnR1y.js → index-DB4TJQHV.js} +1 -1
- package/assets/{index-B-B0JHcE.js → index-DD484ptW.js} +1 -1
- package/assets/{index-B3X7tTfx.js → index-DKCzuFlD.js} +1 -1
- package/assets/{index-bhBCwNAI.js → index-DM517EYv.js} +1 -1
- package/assets/{index-BJWi_Mde.js → index-DPo1Jc-3.js} +1 -1
- package/assets/{index-Cg6lHlPj.js → index-DVG2tLnZ.js} +1 -1
- package/assets/{index-D2X-VE01.js → index-DXBQ7p7A.js} +1 -1
- package/assets/{index-BrTElmXN.js → index-DZ7OqNDh.js} +1 -1
- package/assets/{index-D5dW41Yp.js → index-DeK2gk15.js} +2 -2
- package/assets/{index-DxiDSDBc.js → index-DkS85S-U.js} +1 -1
- package/assets/{index-Cb2_Tzeq.js → index-DqP4ubUd.js} +1 -1
- package/assets/{index-C3Is1Apr.js → index-DslCyXew.js} +1 -1
- package/assets/{index-DRIZge00.js → index-EEHmZhmi.js} +1 -1
- package/assets/{index-KO5jocfW.js → index-LkTNNJf8.js} +1 -1
- package/assets/{index-BuTY5O7i.js → index-WG-2bU2R.js} +1 -1
- package/assets/{index-C0naoCgt.js → index-X8WyejKw.js} +1 -1
- package/assets/{index-D4hUhx_k.js → index-ZXE3Jzhw.js} +2 -2
- package/assets/{index-CyLTth0X.js → index-kdRTF64R.js} +3 -3
- package/assets/{index-DMKKgcdZ.js → index-nNjDHMMe.js} +1 -1
- package/assets/{index-BP-fVzDu.js → index-or9-gmVP.js} +1 -1
- package/assets/{index-BN--SoPG.js → index-ttsk6pAT.js} +1 -1
- package/assets/{index.es-BiEhEc8p.js → index.es-Dwau1Unb.js} +1 -1
- package/assets/{index.es-DyfpWv1f.js → index.es-LD6l3yAP.js} +1 -1
- package/assets/{index.es-CQ6rFGBE.js → index.es-i4tm8RED.js} +4 -4
- package/assets/{localBatchGatewayRequest-BDrEFVai.js → localBatchGatewayRequest-CO3ZuHSj.js} +1 -1
- package/assets/{mana-rate-DrmNLaz-.js → mana-rate-C-rCn1C4.js} +1 -1
- package/assets/network-CSs93eko.js +1 -0
- package/assets/{networks-bRyDO1Qp.js → networks-BFEXyN7L.js} +1 -1
- package/assets/{onramp-BEQTNzss.js → onramp-CzcBij_c.js} +1 -1
- package/assets/{openzeppelin-D_XQzmtX.js → openzeppelin-CGHqJu29.js} +1 -1
- package/assets/{ownerOf-OA2RTQQO.js → ownerOf-qN-FBNCP.js} +1 -1
- package/assets/{parseNft-CXoj0hvM.js → parseNft-h7dpSl-B.js} +2 -2
- package/assets/{parseSignature-BxaAhKeg.js → parseSignature-ClgBcz_E.js} +1 -1
- package/assets/{parseSignature-CKZOR4TK.js → parseSignature-gJmLCKAP.js} +3 -3
- package/assets/{pay-with-exchange-aKfCF8UA.js → pay-with-exchange-DCBEgJ2h.js} +1 -1
- package/assets/{qr-overlay-D2uIJnFP.js → qr-overlay-DbAEP7oV.js} +1 -1
- package/assets/{receive-DA3o78qy.js → receive-CTwQVNv_.js} +1 -1
- package/assets/{resolveImplementation-fVGP_Xas.js → resolveImplementation-CGH4osIy.js} +1 -1
- package/assets/{rpc-DBEEzhj8.js → rpc-BngWyGfZ.js} +1 -1
- package/assets/{secp256k1-hn5_kA6G.js → secp256k1-9xB5BW84.js} +1 -1
- package/assets/{secp256k1-B8n8HBER.js → secp256k1-DOofANAG.js} +1 -1
- package/assets/{secp256k1-BbaO7vsd.js → secp256k1-DgN2B_kR.js} +1 -1
- package/assets/{send-DU8MQ1y8.js → send-BDlN2sgB.js} +1 -1
- package/assets/{send-batch-transaction-DY_pgHDI.js → send-batch-transaction-wZHP58R7.js} +1 -1
- package/assets/{send-eip712-transaction-BkgoythS.js → send-eip712-transaction-Bi1a8eyR.js} +2 -2
- package/assets/{send-gasless-transaction-BVYH1gYX.js → send-gasless-transaction-Bw_gGkTl.js} +2 -2
- package/assets/{sendRawTransaction-DbhgEUz6.js → sendRawTransaction-5EC8yzHr.js} +3 -3
- package/assets/{serializeTransaction-DZrTl33k.js → serializeTransaction-BlqVFvkg.js} +1 -1
- package/assets/{session-proposal-Cl2sjjeM.js → session-proposal-ctnDmZur.js} +1 -1
- package/assets/{session-request-dut4_Z-r.js → session-request-CUsXTmQ3.js} +2 -2
- package/assets/{sha256-BCXR6ojR.js → sha256-RE6wmqKj.js} +1 -1
- package/assets/{signing-DstZY6Ke.js → signing-D7DnlITB.js} +4 -4
- package/assets/{socials-DFT4pr6K.js → socials-C4i949oG.js} +1 -1
- package/assets/{swaps-B6e9-nOS.js → swaps-qHGa0ddB.js} +1 -1
- package/assets/{thirdweb-13r7kkOp.js → thirdweb-CR0hbJDH.js} +3 -3
- package/assets/{totalSupply-CEHgHE1R.js → totalSupply-C-TxVq4_.js} +1 -1
- package/assets/{transactionReceipt-CJqXaM7n.js → transactionReceipt-BaHYZskc.js} +1 -1
- package/assets/{transactions-Dg8-HdPI.js → transactions-CZHtKEkE.js} +1 -1
- package/assets/{useInfiniteGrid-_j3sTNFy.js → useInfiniteGrid-BddL8SSO.js} +1 -1
- package/assets/{verifyHash-DDifZCfe.js → verifyHash-Bi4U7qrf.js} +1 -1
- package/assets/{w3m-modal-Bz6lLxMo.js → w3m-modal-BNkfhTR4.js} +1 -1
- package/assets/{w3m-modal-wr6gqHHl.js → w3m-modal-D7g91RDF.js} +1 -1
- package/assets/{wait-for-tx-receipt-TO5nTGOg.js → wait-for-tx-receipt-MuErdbkx.js} +1 -1
- package/assets/{wallet-kind-BSzJpUob.js → wallet-kind-CIBO15i5.js} +1 -1
- package/assets/{wallets-CrZ_KakB.js → wallets-CsMQQSxs.js} +6 -6
- package/assets/{web-connector-C-PKMENi.js → web-connector-Cil3jKzV.js} +3 -3
- package/assets/{writeContract-dUugnk5I.js → writeContract-BXtYV0Oi.js} +1 -1
- package/assets/{zoraTestnet-z7D1VXMG.js → zoraTestnet-UyN43x8_.js} +1 -1
- package/index.html +8 -8
- package/package.json +2 -2
- package/assets/Collection-Cbyv2bH1.js +0 -1
- package/assets/decimals-CF3AbQzO.js +0 -1
- package/assets/network-CpS8nVMF.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,j as v}from"./react-Vu6nbGi5.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-
|
|
1
|
+
import{r as l,j as v}from"./react-Vu6nbGi5.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-29233112588.commit-3471a57/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-29233112588.commit-3471a57/assets/DCL_LogoPattern-BryBPc3d.png",U=`
|
|
2
2
|
attribute vec2 a_position;
|
|
3
3
|
varying vec2 v_uv;
|
|
4
4
|
void main() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,j as e,b as D}from"./react-Vu6nbGi5.js";import{j as
|
|
1
|
+
import{r as i,j as e,b as D}from"./react-Vu6nbGi5.js";import{j as P,k as I,A as K,l as J}from"./index-BQTrO182.js";import{S as F,F as W,a as Y}from"./FilterBar-CdU8B66A.js";import{S as A}from"./SkeletonCards-BysJEVmg.js";import{L as Z}from"./LoadMore-BOCtgPLI.js";import{u as z}from"./useInfiniteGrid-BddL8SSO.js";import"./ethers-JeCAM1sd.js";const Q=[{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 V({category:f,subCategory:n,onCategory:l,onSub:x}){const[c,p]=i.useState(()=>f==="wearable"?"wearable":null);function o(s){s.subs?p(t=>{const u=t!==s.key;return u&&l(s.key),u?s.key:null}):(l(s.key),p(null))}return e.jsx("div",{className:"catfilter",children:Q.map(s=>{const t=c===s.key&&!!s.subs,u=s.key===f;return e.jsxs("div",{className:"catfilter__group",children:[e.jsxs("button",{type:"button",className:`catfilter__cat${t?" is-expanded":""}${u?" is-selected":""}`,onClick:()=>o(s),children:[e.jsx("span",{className:"catfilter__cat-label",children:s.label}),s.expandable?e.jsx("span",{className:`ico ico-chevron catfilter__chev${t?" is-up":""}`,"aria-hidden":!0}):null]}),s.subs?e.jsx("div",{className:`catfilter__subs${t?" is-open":""}`,children:e.jsx("div",{className:"catfilter__subs-inner",children:s.subs.map(r=>e.jsx("button",{type:"button",className:`catfilter__sub${n===r.key?" is-active":""}`,onClick:()=>x(n===r.key?null:r.key),children:e.jsxs("span",{className:"catfilter__sub-left",children:[e.jsx("span",{className:`ico ico-${r.icon} catfilter__sub-ico`,"aria-hidden":!0}),e.jsx("span",{className:"catfilter__sub-label",children:r.label})]})},r.key))})}):null]},s.key)})})}const X=48,ee={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 ce(){const[f]=D(),n=(f.get("q")??"").trim().toLowerCase(),[l,x]=i.useState("wearable"),[c,p]=i.useState(null),[o,s]=i.useState([]),[t,u]=i.useState(""),[r,N]=i.useState(""),[b,M]=i.useState("newest"),y=t&&!Number.isNaN(Number(t))?Number(t):void 0,h=r&&!Number.isNaN(Number(r))?Number(r):void 0,R=c?ee[c]:void 0,E=(F.find(a=>a.key===b)??F[0]).server,j={category:l,rarities:o.length?o:void 0,wearableCategories:R,minPriceCredits:y,maxPriceCredits:h,search:n||void 0,sortBy:E},{items:S,total:w,isLoading:d,error:L,hasNextPage:B,isFetchingNextPage:v,fetchNextPage:H}=z(["listings",j],a=>J({...j,first:X,skip:a})),_=w,C=i.useRef(null);i.useEffect(()=>{d||!n||C.current===n||(C.current=n,P("Shop Searched",{query:n,result_count:_}))},[n,d,_]);const g=i.useRef("__init__");i.useEffect(()=>{if(d)return;const a=JSON.stringify({category:l,subCategory:c,rarities:o,min:y,max:h,sort:b});if(g.current==="__init__"||g.current===a){g.current=a;return}g.current=a,P("Shop Applied Filter",{filters:{category:l,sub_category:c,rarities:o,min_price_credits:y??null,max_price_credits:h??null,sort:b},result_count:_})},[l,c,o,y,h,b,d,_]);function $(a){x(a),p(null)}function G(a){s(m=>m.includes(a)?m.filter(O=>O!==a):[...m,a])}function T(){x("wearable"),p(null),s([]),u(""),N("")}const k=!!(y||h),U=k?`${t||"0"}–${r||"∞"}`:"Price",q=l!=="wearable"||!!c||o.length>0||k;return e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(V,{category:l,subCategory:c,onCategory:$,onSub:p})}),e.jsxs("div",{className:"browse__main",children:[e.jsx(W,{rarities:o,onToggleRarity:G,sort:b,onSort:M,total:w,loading:d,query:n,anyActive:q,onClear:T,renderTrailing:a=>e.jsx(Y,{panelKey:"price",label:U,active:k,panel:a,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":"Minimum price",placeholder:"Min",value:t,onChange:m=>u(m.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":"Maximum price",placeholder:"Max",value:r,onChange:m=>N(m.target.value)})]}),e.jsxs("p",{className:"filter-pop__hint",children:["Price in ",I.name]})]})})}),L?e.jsx("p",{className:"error",children:"Couldn’t load items — please try again."}):null,e.jsx("div",{className:"grid",children:d?e.jsx(A,{count:15}):e.jsxs(e.Fragment,{children:[S.map(a=>e.jsx(K,{item:a},a.id)),v?e.jsx(A,{count:6}):null]})}),e.jsx(Z,{hasNextPage:B,isFetching:v,onLoadMore:()=>H()}),!d&&S.length===0?e.jsx("p",{className:"muted",children:"No items match your filters."}):null]})]})}export{ce as Assets};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as a,i as st,j as z,e as lt,R as H}from"./react-Vu6nbGi5.js";import{b as m,C as Ne,d as M,T as ut,t as ct,v as dt,x as pt,y as ft,_ as Y,c as I,a as ee,u as fe,s as A,k as he,g as Se,e as Ve,n as ht,z as mt,A as bt,q as gt,p as J}from"./generateUtilityClasses-
|
|
1
|
+
import{r as a,i as st,j as z,e as lt,R as H}from"./react-Vu6nbGi5.js";import{b as m,C as Ne,d as M,T as ut,t as ct,v as dt,x as pt,y as ft,_ as Y,c as I,a as ee,u as fe,s as A,k as he,g as Se,e as Ve,n as ht,z as mt,A as bt,q as gt,p as J}from"./generateUtilityClasses-CVd9wG9P.js";import{S as Ce}from"./SvgIcon-ZHB11KC9.js";var se={};function vt(...e){return e.reduce((t,n)=>n==null?t:function(...r){t.apply(this,r),n.apply(this,r)},()=>{})}function xt(e,t=166){let n;function o(...r){const i=()=>{e.apply(this,r)};clearTimeout(n),n=setTimeout(i,t)}return o.clear=()=>{clearTimeout(n)},o}function yt(e,t){return()=>null}function Ct(e,t){var n,o;return a.isValidElement(e)&&t.indexOf((n=e.type.muiName)!=null?n:(o=e.type)==null||(o=o._payload)==null||(o=o.value)==null?void 0:o.muiName)!==-1}function ke(e){return e&&e.ownerDocument||document}function Rt(e){return ke(e).defaultView||window}function Et(e,t){return()=>null}function Le(e,t){typeof e=="function"?e(t):e&&(e.current=t)}const _e=typeof window<"u"?a.useLayoutEffect:a.useEffect;let Re=0;function It(e){const[t,n]=a.useState(e),o=e||t;return a.useEffect(()=>{t==null&&(Re+=1,n(`mui-${Re}`))},[t]),o}const Ee=st.useId;function Tt(e){if(Ee!==void 0){const t=Ee();return e??t}return It(e)}function Mt(e,t,n,o,r){return null}function zt({controlled:e,default:t,name:n,state:o="value"}){const{current:r}=a.useRef(e!==void 0),[i,s]=a.useState(t),c=r?e:i,u=a.useCallback(d=>{r||s(d)},[]);return[c,u]}function X(e){const t=a.useRef(e);return _e(()=>{t.current=e}),a.useRef((...n)=>(0,t.current)(...n)).current}function ue(...e){return a.useMemo(()=>e.every(t=>t==null)?null:t=>{e.forEach(n=>{Le(n,t)})},e)}const Ie={};function $t(e,t){const n=a.useRef(Ie);return n.current===Ie&&(n.current=e(t)),n}const Bt=[];function Pt(e){a.useEffect(e,Bt)}class te{constructor(){this.currentId=null,this.clear=()=>{this.currentId!==null&&(clearTimeout(this.currentId),this.currentId=null)},this.disposeEffect=()=>this.clear}static create(){return new te}start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=null,n()},t)}}function Nt(){const e=$t(te.create).current;return Pt(e.disposeEffect),e}let ne=!0,ce=!1;const St=new te,Vt={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function kt(e){const{type:t,tagName:n}=e;return!!(n==="INPUT"&&Vt[t]&&!e.readOnly||n==="TEXTAREA"&&!e.readOnly||e.isContentEditable)}function Lt(e){e.metaKey||e.altKey||e.ctrlKey||(ne=!0)}function le(){ne=!1}function _t(){this.visibilityState==="hidden"&&ce&&(ne=!0)}function Ft(e){e.addEventListener("keydown",Lt,!0),e.addEventListener("mousedown",le,!0),e.addEventListener("pointerdown",le,!0),e.addEventListener("touchstart",le,!0),e.addEventListener("visibilitychange",_t,!0)}function Dt(e){const{target:t}=e;try{return t.matches(":focus-visible")}catch{}return ne||kt(t)}function Fe(){const e=a.useCallback(r=>{r!=null&&Ft(r.ownerDocument)},[]),t=a.useRef(!1);function n(){return t.current?(ce=!0,St.start(100,()=>{ce=!1}),t.current=!1,!0):!1}function o(r){return Dt(r)?(t.current=!0,!0):!1}return{isFocusVisibleRef:t,onFocus:o,onBlur:n,ref:e}}function jt(e,t){function n(o,r){return z.jsx(Ce,m({"data-testid":`${t}Icon`,ref:r},o,{children:e}))}return n.muiName=Ce.muiName,a.memo(a.forwardRef(n))}const Ot={configure:e=>{Ne.configure(e)}},Ut=Object.freeze(Object.defineProperty({__proto__:null,capitalize:M,createChainedFunction:vt,createSvgIcon:jt,debounce:xt,deprecatedPropType:yt,isMuiElement:Ct,ownerDocument:ke,ownerWindow:Rt,requirePropFactory:Et,setRef:Le,unstable_ClassNameGenerator:Ot,unstable_useEnhancedEffect:_e,unstable_useId:Tt,unsupportedProp:Mt,useControlled:zt,useEventCallback:X,useForkRef:ue,useIsFocusVisible:Fe},Symbol.toStringTag,{value:"Module"})),Wt=lt(Ut);var Te;function Vn(){return Te||(Te=1,(function(e){"use client";Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"default",{enumerable:!0,get:function(){return t.createSvgIcon}});var t=Wt})(se)),se}function wt(e){return Object.keys(e).length===0}function At(e=null){const t=a.useContext(ut);return!t||wt(t)?e:t}const Kt=ct();function Gt(e=Kt){return At(e)}function De(e){var t,n,o="";if(typeof e=="string"||typeof e=="number")o+=e;else if(typeof e=="object")if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(n=De(e[t]))&&(o&&(o+=" "),o+=n)}else for(n in e)e[n]&&(o&&(o+=" "),o+=n);return o}function Ht(){for(var e,t,n=0,o="",r=arguments.length;n<r;n++)(e=arguments[n])&&(t=De(e))&&(o&&(o+=" "),o+=t);return o}const Xt=["className","component"];function Yt(e={}){const{themeId:t,defaultTheme:n,defaultClassName:o="MuiBox-root",generateClassName:r}=e,i=dt("div",{shouldForwardProp:c=>c!=="theme"&&c!=="sx"&&c!=="as"})(pt);return a.forwardRef(function(u,d){const f=Gt(n),b=ft(u),{className:g,component:x="div"}=b,h=Y(b,Xt);return z.jsx(i,m({as:x,ref:d,className:Ht(g,r?r(o):o),theme:t&&f[t]||f},h))})}function de(e,t){return de=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,o){return n.__proto__=o,n},de(e,t)}function qt(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,de(e,t)}const Me=H.createContext(null);function Zt(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function me(e,t){var n=function(i){return t&&a.isValidElement(i)?t(i):i},o=Object.create(null);return e&&a.Children.map(e,function(r){return r}).forEach(function(r){o[r.key]=n(r)}),o}function Jt(e,t){e=e||{},t=t||{};function n(f){return f in t?t[f]:e[f]}var o=Object.create(null),r=[];for(var i in e)i in t?r.length&&(o[i]=r,r=[]):r.push(i);var s,c={};for(var u in t){if(o[u])for(s=0;s<o[u].length;s++){var d=o[u][s];c[o[u][s]]=n(d)}c[u]=n(u)}for(s=0;s<r.length;s++)c[r[s]]=n(r[s]);return c}function w(e,t,n){return n[t]!=null?n[t]:e.props[t]}function Qt(e,t){return me(e.children,function(n){return a.cloneElement(n,{onExited:t.bind(null,n),in:!0,appear:w(n,"appear",e),enter:w(n,"enter",e),exit:w(n,"exit",e)})})}function en(e,t,n){var o=me(e.children),r=Jt(t,o);return Object.keys(r).forEach(function(i){var s=r[i];if(a.isValidElement(s)){var c=i in t,u=i in o,d=t[i],f=a.isValidElement(d)&&!d.props.in;u&&(!c||f)?r[i]=a.cloneElement(s,{onExited:n.bind(null,s),in:!0,exit:w(s,"exit",e),enter:w(s,"enter",e)}):!u&&c&&!f?r[i]=a.cloneElement(s,{in:!1}):u&&c&&a.isValidElement(d)&&(r[i]=a.cloneElement(s,{onExited:n.bind(null,s),in:d.props.in,exit:w(s,"exit",e),enter:w(s,"enter",e)}))}}),r}var tn=Object.values||function(e){return Object.keys(e).map(function(t){return e[t]})},nn={component:"div",childFactory:function(t){return t}},be=(function(e){qt(t,e);function t(o,r){var i;i=e.call(this,o,r)||this;var s=i.handleExited.bind(Zt(i));return i.state={contextValue:{isMounting:!0},handleExited:s,firstRender:!0},i}var n=t.prototype;return n.componentDidMount=function(){this.mounted=!0,this.setState({contextValue:{isMounting:!1}})},n.componentWillUnmount=function(){this.mounted=!1},t.getDerivedStateFromProps=function(r,i){var s=i.children,c=i.handleExited,u=i.firstRender;return{children:u?Qt(r,c):en(r,s,c),firstRender:!1}},n.handleExited=function(r,i){var s=me(this.props.children);r.key in s||(r.props.onExited&&r.props.onExited(i),this.mounted&&this.setState(function(c){var u=m({},c.children);return delete u[r.key],{children:u}}))},n.render=function(){var r=this.props,i=r.component,s=r.childFactory,c=Y(r,["component","childFactory"]),u=this.state.contextValue,d=tn(this.state.children).map(s);return delete c.appear,delete c.enter,delete c.exit,i===null?H.createElement(Me.Provider,{value:u},d):H.createElement(Me.Provider,{value:u},H.createElement(i,c,d))},t})(H.Component);be.propTypes={};be.defaultProps=nn;function on(e){const{className:t,classes:n,pulsate:o=!1,rippleX:r,rippleY:i,rippleSize:s,in:c,onExited:u,timeout:d}=e,[f,b]=a.useState(!1),g=I(t,n.ripple,n.rippleVisible,o&&n.ripplePulsate),x={width:s,height:s,top:-(s/2)+i,left:-(s/2)+r},h=I(n.child,f&&n.childLeaving,o&&n.childPulsate);return!c&&!f&&b(!0),a.useEffect(()=>{if(!c&&u!=null){const C=setTimeout(u,d);return()=>{clearTimeout(C)}}},[u,c,d]),z.jsx("span",{className:g,style:x,children:z.jsx("span",{className:h})})}const T=ee("MuiTouchRipple",["root","ripple","rippleVisible","ripplePulsate","child","childLeaving","childPulsate"]),rn=["center","classes","className"];let oe=e=>e,ze,$e,Be,Pe;const pe=550,an=80,sn=he(ze||(ze=oe`
|
|
2
2
|
0% {
|
|
3
3
|
transform: scale(0);
|
|
4
4
|
opacity: 0.1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ee,r as v,j as t,L as A}from"./react-Vu6nbGi5.js";import{s as te,v as se,o as P,a as ae,c as re,w as ne,x as ce,t as R,C as ie,d as I,k as O,A as le,j as F,y as B,z,D as oe,E as de,F as D,G as ue,H as he,g as me,I as pe,l as fe}from"./index-
|
|
1
|
+
import{a as ee,r as v,j as t,L as A}from"./react-Vu6nbGi5.js";import{s as te,v as se,o as P,a as ae,c as re,w as ne,x as ce,t as R,C as ie,d as I,k as O,A as le,j as F,y as B,z,D as oe,E as de,F as D,G as ue,H as he,g as me,I as pe,l as fe}from"./index-BQTrO182.js";import{f as Q}from"./buy-DSDTz9Ug.js";import{g as ye,b as ge,w as _e,S as be,G as ve}from"./buy-gasless-VKTXyC9T.js";import"./ethers-JeCAM1sd.js";import"./index-DZ7OqNDh.js";function Ce(s){return Math.ceil(s/10)}async function xe(s,r,d){var j;const _=[],a=[],C=[];for(const n of s)try{const m=await d(n);if(!m){a.push(n);continue}if(te(m,r)){C.push(n);continue}const c=se((j=m.received[0])==null?void 0:j.amount);if(!Number.isFinite(c)||c<=0){a.push(n);continue}_.push({item:n,trade:m,usdCents:c,priceCredits:Ce(c)})}catch{a.push(n)}const x=_.reduce((n,m)=>n+m.priceCredits,0),p=a.length>0||C.length>0||_.some(n=>n.priceCredits!==n.item.priceCredits);return{buyable:_,unavailable:a,own:C,liveTotalCredits:x,orderChanged:p}}function K(s){const r=s,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 ${O.name} — get more first.`:d.includes("no active listing")||d.includes("your own listing")?r.message:"Couldn't complete checkout — please try again."}const je=12e4;function Ne(s){const r=[];return s.unavailable.length&&r.push(`${s.unavailable.length} no longer available`),s.own.length&&r.push(`${s.own.length} you can't buy (your own listing)`),`Removed ${r.join(" and ")} from your cart.`}function Re(){const s=P(e=>e.items),r=P(e=>e.remove),d=P(e=>e.clear),_=P(e=>e.setFittingOpen),{session:a}=ae(),C=s.some(e=>e.category!=="emote"),{data:x}=re({queryKey:["upsell-listings"],queryFn:()=>fe({first:40}),staleTime:6e4}),{data:p}=ne(a),j=ce(),n=ee(),[m,c]=v.useState(null),[q,f]=v.useState(null),[G,S]=v.useState(null),[N,T]=v.useState(!1),[u,w]=v.useState(null),L=v.useRef(0),E=s.reduce((e,i)=>e+i.priceCredits,0),H=u?u.liveTotalCredits:E,V=new Set(s.map(e=>e.id)),M=((x==null?void 0:x.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})),g=[];let k="authorize",$=!1;try{c("Preparing your order…");const l=[];for(const o of e){const{credit:b,maxCreditedValue:y}=await oe(a.identity,o.usdCents,o.item.tradeId);g.push(b.id),l.push({trade:o.trade,credits:[b],maxCreditedValue:y})}c("Confirming your purchase…"),k="submit";let h=[];if(ye())try{h=await ge({purchases:l,buyer:a.address,signer:a.signer});const b=(await Promise.allSettled(h.map(y=>_e(y)))).flatMap(y=>y.status==="rejected"?[y.reason]:[]);if(b.length&&!b.some(y=>y instanceof be))throw b[0];$=!0}catch(o){if(!(o instanceof ve))throw o;h=await Q({purchases:l,buyer:a.address,signer:a.signer})}else h=await Q({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}),j.invalidateQueries({queryKey:["usd-balance"]}),n("/success",{state:{items:i,txHash:h[0]}})}catch(l){if(D(l)||z(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}),g.length){try{await he(a.identity,g)}catch(h){z(h,{flow:"cart_checkout",step:"release"})}j.invalidateQueries({queryKey:["usd-balance"]})}f(K(l)),c(null)}}async function Y(){if(!a){f("Sign in to check out.");return}f(null),S(null),T(!0),F("Shop Started Checkout",{cart_size:s.length,cart_value_credits:E,cart_value_usd:B(E),has_sufficient_credits:((p==null?void 0:p.credits)??0)>=E});try{c("Reviewing your cart…");const e=await xe(s,a.address,X),i=[...e.unavailable,...e.own];if(i.length&&(i.forEach(g=>r(g.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){z(e,{flow:"cart_checkout",step:"review",cart_size:s.length}),f(K(e)),c(null)}finally{T(!1)}}async function Z(){if(u){if(!a){f("Sign in to check out.");return}if(Date.now()-L.current>je){w(null),S(null),await Y();return}f(null),T(!0);try{await W(u.buyable)}finally{T(!1)}}}return s.length===0?t.jsxs("div",{className:"cart cart--empty",children:[t.jsx("span",{className:"ico ico-cart cart-empty__ico","aria-hidden":!0}),t.jsx("p",{className:"cart-empty__title",children:R("cart.empty.title")}),t.jsx("p",{className:"muted",children:R("cart.empty.body")}),t.jsx(A,{className:"btn btn--purple",to:"/assets",children:R("cart.empty.cta")})]}):t.jsxs("div",{className:"cart",children:[t.jsxs("h1",{children:["Cart (",s.length,")"]}),t.jsx("div",{className:"cart__list",children:s.map(e=>{const i=J.get(e.id),g=i?i.priceCredits:e.priceCredits,k=!!i&&i.priceCredits!==e.priceCredits;return t.jsxs("div",{className:"cart__row",children:[t.jsx("div",{className:"cart__thumb",children:e.thumbnail?t.jsx("img",{src:e.thumbnail,alt:e.name}):null}),t.jsxs("div",{className:"cart__info",children:[t.jsx("div",{className:"cart__name",children:e.name}),e.creator?t.jsx(ie,{address:e.creator,className:"cart__creator",linkToProfile:!0}):null]}),t.jsxs("div",{className:"cart__price",children:[t.jsx(I,{className:"ccy-mark"})," ",g,k?t.jsx("span",{className:"muted",style:{marginLeft:6,textDecoration:"line-through"},children:e.priceCredits}):null]}),t.jsx("button",{className:"cart__remove",onClick:()=>U(()=>r(e.id)),disabled:N,"aria-label":`Remove ${e.name}`,title:"Remove",children:t.jsx("span",{className:"ico ico-trash","aria-hidden":!0})})]},e.id)})}),t.jsxs("div",{className:"cart__foot",children:[t.jsxs("div",{className:"cart__total",children:[t.jsxs("div",{className:"cart__total-line",children:["Total ",t.jsxs("strong",{children:[t.jsx(I,{className:"ccy-mark"})," ",H]})]}),a?t.jsxs("div",{className:"muted cart__balance",children:["Your balance: ",t.jsx(I,{className:"ccy-mark"})," ",(p==null?void 0:p.credits)??0]}):null]}),t.jsxs("div",{className:"cart__actions",children:[C?t.jsx("button",{className:"btn btn--ghost",onClick:()=>_(!0),disabled:N,children:"Try on outfit"}):null,t.jsxs(A,{className:"btn btn--ghost",to:"/credits",children:["Get ",O.name]}),t.jsx("button",{className:"btn btn--purple cart__checkout",onClick:u?Z:Y,disabled:N,children:N?"Working…":u?"Confirm purchase":"Checkout"})]})]}),t.jsxs("div",{className:"cart__utils",children:[t.jsx("button",{className:"link",onClick:()=>U(d),disabled:N,children:"Clear cart"}),null]}),u?t.jsx("p",{className:"muted",style:{marginTop:12},children:"Prices or availability changed since you added these — review the updated total and confirm to buy."}):null,G?t.jsx("p",{className:"muted",style:{marginTop:12},children:G}):null,m?t.jsx("p",{className:"muted",style:{marginTop:12},children:m}):null,q?t.jsx("p",{className:"error",style:{marginTop:12},children:q}):null,M.length>0?t.jsxs("section",{className:"row cart-upsell",children:[t.jsx("div",{className:"row__head",children:t.jsx("h2",{className:"row__title",children:"You might also like"})}),t.jsx("div",{className:"row__track",children:M.map(e=>t.jsx(le,{item:e},e.id))})]}):null]})}export{Re as Cart};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as N,a as U,u as w,_ as z,b as o,c as E,d as n,e as I,s as v,f as D,k as _}from"./generateUtilityClasses-
|
|
1
|
+
import{g as N,a as U,u as w,_ as z,b as o,c as E,d as n,e as I,s as v,f as D,k as _}from"./generateUtilityClasses-CVd9wG9P.js";import{r as F,j as g}from"./react-Vu6nbGi5.js";function K(r){return N("MuiCircularProgress",r)}U("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const W=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,b,S,$;const t=44,B=_(P||(P=l`
|
|
2
2
|
0% {
|
|
3
3
|
transform: rotate(0deg);
|
|
4
4
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as h,a as g,j as e}from"./react-Vu6nbGi5.js";import{C as x,A as j,f as _}from"./index-BQTrO182.js";import{A as N}from"./collection-CJBo0QKZ.js";import{S as m}from"./SkeletonCards-BysJEVmg.js";import{L as f}from"./LoadMore-BOCtgPLI.js";import{u as C}from"./useInfiniteGrid-BddL8SSO.js";import"./ethers-JeCAM1sd.js";const b=48;function F(){var i;const{contractAddress:o}=h(),d=g(),{items:s,total:c,isLoading:a,error:t,hasNextPage:u,isFetchingNextPage:n,fetchNextPage:p}=C(["collection-page",o],l=>_(o,{first:b,skip:l}),{enabled:!!o}),r=(i=s[0])==null?void 0:i.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:()=>d("/assets"),children:"Collectibles"}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:"Collection"})]}),e.jsxs("header",{className:"collection-page__head",children:[e.jsx("h1",{className:"collection-page__title",children:"Collection"}),r?e.jsx(x,{address:r,className:"collection-page__creator"}):null,e.jsx("span",{className:"muted collection-page__count",children:a?"…":`${c.toLocaleString()} item${c===1?"":"s"}`})]}),!a&&s.length>0?e.jsx(N,{items:s,source:"collection"}):null,t?e.jsx("p",{className:"error",children:"Couldn’t load this collection — please try again."}):null,e.jsx("div",{className:"grid",children:a?e.jsx(m,{count:12}):e.jsxs(e.Fragment,{children:[s.map(l=>e.jsx(j,{item:l},l.id)),n?e.jsx(m,{count:6}):null]})}),e.jsx(f,{hasNextPage:u,isFetching:n,onLoadMore:()=>p()}),!a&&!t&&s.length===0?e.jsx("p",{className:"muted",children:"This collection has no items to show."}):null]})}export{F as Collection,F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,u as g,a as p}from"./react-Vu6nbGi5.js";import{m as i,C as h,A as x,n as j}from"./index-
|
|
1
|
+
import{j as e,u as g,a as p}from"./react-Vu6nbGi5.js";import{m as i,C as h,A as x,n as j}from"./index-BQTrO182.js";import{A as f}from"./collection-CJBo0QKZ.js";import{S as m}from"./SkeletonCards-BysJEVmg.js";import{L as N}from"./LoadMore-BOCtgPLI.js";import{u as b}from"./useInfiniteGrid-BddL8SSO.js";import"./ethers-JeCAM1sd.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-CNJGu1s_.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-kdRTF64R.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{R as $,h as b,S as F,a as O,x as V,j as _,z as S,G as E,k as u,d as C,K as R,_ as z}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RealCheckout-Ct5C78JH.js","assets/react-Vu6nbGi5.js","assets/index-BQTrO182.js","assets/ethers-JeCAM1sd.js","assets/index-DliU9pat.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{R as $,h as b,S as F,a as O,x as V,j as _,z as S,G as E,k as u,d as C,K as R,_ as z}from"./index-BQTrO182.js";import{a as K,r as l,j as e}from"./react-Vu6nbGi5.js";import{C as N}from"./CircularProgress-CDHgSKkY.js";import"./ethers-JeCAM1sd.js";import"./generateUtilityClasses-CVd9wG9P.js";function G(){return b.shopServerUrl||b.creditsServerUrl}async function Y(t,s){const r=await $(`${G()}/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 L(t,s,r={}){const{intervalMs:a=1500,timeoutMs:n=6e4,signal:i}=r,c=Date.now()+n;for(;;){if(i!=null&&i.aborted)throw new DOMException("Aborted","AbortError");const m=await q(t,s,i);if(m.status!=="processing")return m;if(Date.now()>c)return{status:"failed",error:"Timed out waiting for your credits."};await J(a,i)}}async function q(t,s,r){const a=await $(`${G()}/credits/orders/${t}`,{method:"GET",identity:s,metadata:{},signal:r});if(!a.ok)throw new Error(`order status ${a.status}`);return a.json()}function J(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 Q=.1,T=[{id:"pack_5",usd:5,credits:y(5)},{id:"pack_10",usd:10,credits:y(10)},{id:"pack_25",usd:25,credits:y(25),bestValue:!0},{id:"pack_50",usd:50,credits:y(50)}];function y(t){return Math.round(t/Q)}function M(t){return T.find(s=>s.id===t)}const x="mock_cs_";function k(){return!b.stripePublishableKey}async function W(t,s){const r=M(t);if(!r)throw new Error("Unknown pack");if(k())return H(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:i}=s;if(t.startsWith(x)||k())return Z(t,s);if(!i)throw new Error("Sign in to get credits.");return L(t,i,{intervalMs:r,timeoutMs:a,signal:n})}function H(t){const s=`${x}${t.id}_${Date.now()}`;return D(400).then(()=>({orderId:s,clientSecret:`${x}${t.id}`,mock:!0}))}async function Z(t,s={}){await D(s.intervalMs??900);const r=t.replace(x,"").replace(/_\d+$/,""),a=M(r),n=(a==null?void 0:a.credits)??0;if(s.address&&a)try{const i=await F(s.address,Math.round(a.usd*100));return{status:"credited",creditsGranted:n,newBalance:i.credits}}catch(i){return{status:"failed",error:i.message}}return{status:"credited",creditsGranted:n,newBalance:n}}function D(t,s){return new Promise((r,a)=>{setTimeout(r,t)})}const g=k()?"mock":"stripe",ee=l.lazy(()=>z(()=>import("./RealCheckout-Ct5C78JH.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 oe(){const t=K(),{session:s,signIn:r}=O(),a=V(),[n,i]=l.useState("select"),[c,m]=l.useState(null),[h,w]=l.useState(null),[I,v]=l.useState(null),[A,p]=l.useState(null),j=l.useRef(null);l.useEffect(()=>()=>{var d;return(d=j.current)==null?void 0:d.abort()},[]);const B=l.useCallback(async d=>{if(!s){r();return}p(null),m(d),i("paying"),_("Shop Started Buy Credits",{pack_usd:d.usd,credits:d.credits,provider:g});try{const o=await W(d.id,{address:s.address,identity:s.identity});w(o)}catch(o){S(o,{flow:"get_credits",step:"checkout",provider:g}),_("Shop Buy Credits Failed",{step:"checkout",error_code:E(o),pack_usd:d.usd}),p(P(o)),i("error")}},[s,r]),U=l.useCallback(async()=>{if(!h)return;i("processing");const d=new AbortController;j.current=d;try{const o=await X(h.orderId,{signal:d.signal,address:s==null?void 0:s.address,identity:s==null?void 0:s.identity});o.status==="credited"?(v(o.creditsGranted??(c==null?void 0:c.credits)??0),i("success"),_("Shop Completed Buy Credits",{order_id:h.orderId,pack_usd:(c==null?void 0:c.usd)??null,credits:o.creditsGranted??(c==null?void 0:c.credits)??0,provider:g}),a.invalidateQueries({queryKey:["usd-balance"]})):(_("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(c==null?void 0:c.usd)??null}),p(o.error??`Couldn't add your ${u.name} — please try again.`),i("error"))}catch(o){S(o,{flow:"get_credits",step:"grant",order_id:h.orderId}),_("Shop Buy Credits Failed",{step:"grant",error_code:E(o),pack_usd:(c==null?void 0:c.usd)??null}),p(P(o)),i("error")}},[h,c,s,a]);function f(){var d;(d=j.current)==null||d.abort(),i("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(se,{onSelect:B}),n==="paying"&&c&&e.jsx(te,{pack:c,checkout:h,onPaid:U,onCancel:f}),n==="processing"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(N,{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(C,{className:"ccy-mark"})," ",I]})," ",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:f,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:f,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 se({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(C,{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 te({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(C,{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(re,{onPaid:r,amountUsd:t.usd}):e.jsx(l.Suspense,{fallback:e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(N,{size:32}),e.jsx("p",{className:"muted",children:"Getting the payment form ready…"})]}),children:e.jsx(ee,{clientSecret:s.clientSecret,onComplete:r})}):e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(N,{size:32}),e.jsx("p",{className:"muted",children:"Getting the payment form ready…"})]})})]})}function re({onPaid:t,amountUsd:s}){const[r,a]=l.useState("4242 4242 4242 4242"),[n,i]=l.useState(!1);function c(){i(!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:c,disabled:n,children:n?"Processing…":`Pay $${s}`})]})}export{oe as GetCredits,oe 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-DslCyXew.js";import{d as g,r as v}from"./index-kdRTF64R.js";import{C as c}from"./ConstantsUtil-CiDezLbv.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-CNJGu1s_.js";import{au as y}from"./NetworkUtil-DDES604E.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 d,j as e,L as M}from"./react-Vu6nbGi5.js";import{j as Q,z as A,k as w,d as v,a as K,x as F,c as P,q as R}from"./index-
|
|
1
|
+
import{a as E,r as d,j as e,L as M}from"./react-Vu6nbGi5.js";import{j as Q,z as A,k as w,d as v,a as K,x as F,c as P,q as R}from"./index-BQTrO182.js";import{i as W,f as Y}from"./import-B6HLomRq.js";import{s as O}from"./wallet-kind-CIBO15i5.js";import"./ethers-JeCAM1sd.js";import"./buy-DSDTz9Ug.js";import"./index-DZ7OqNDh.js";import"./mana-rate-C-rCn1C4.js";function z({queue:n,session:k,onClose:j,onDone:u}){const N=E(),l=O(k.providerType),[c,f]=d.useState(()=>n.map(()=>"pending")),[y,C]=d.useState("running"),I=d.useRef(!1);d.useEffect(()=>{if(I.current)return;I.current=!0;let a=!1;return(async()=>{for(let i=0;i<n.length;i++){if(a)return;f(o=>o.map((p,h)=>h===i?"active":p));try{await W(n[i].item,n[i].priceCredits,k),Q("Shop Migrated Listing",{item_id:n[i].item.itemId??n[i].item.oldTradeId??null,contract_address:n[i].item.contractAddress,new_price_credits:n[i].priceCredits,new_price_usd:n[i].priceCredits/10}),a||f(o=>o.map((p,h)=>h===i?"done":p))}catch(o){const p=o,h=p.code===4001||/reject|denied|cancel/i.test(p.message??"");h||A(o,{flow:"import_listing",itemId:n[i].item.itemId??n[i].item.oldTradeId}),a||f(S=>S.map((T,t)=>t===i?h?"skipped":"failed":T))}}a||C("finished")})(),()=>{a=!0}},[]);const m=c.filter(a=>a==="done").length,g=c.findIndex(a=>a==="active"),_=Math.round(c.filter(a=>a!=="pending"&&a!=="active").length/n.length*100);function x(){u(),j()}if(y==="finished"){const a=c.filter(i=>i==="skipped"||i==="failed").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:m>0?"You're in the Shop! 🎉":"Nothing listed"}),e.jsxs("p",{className:"muted",style:{margin:0},children:[m>0?`${m} ${m===1?"item is":"items are"} now for sale with ${w.name}.`:"No items were listed.",a>0?` ${a} skipped — you can try those again anytime.`:""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:x,children:"Done"}),m>0?e.jsx("button",{className:"btn btn--purple",onClick:()=>{u(),j(),N("/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:[l?"We take down each old listing and re-list it for credits — confirm each step.":"Moving your items to the Shop."," ",g>=0?`${g+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((a,i)=>e.jsxs("li",{className:`migrate__row migrate__row--${c[i]}`,children:[e.jsx("span",{className:"migrate__thumb",children:a.item.thumbnail?e.jsx("img",{src:a.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:a.item.name,children:a.item.name||"Item"}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(v,{className:"ccy-mark"})," ",a.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:c[i]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",l?"Confirm…":"Adding…"]}):c[i]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):c[i]==="skipped"?e.jsx("span",{className:"migrate__skip",children:"Skipped"}):c[i]==="failed"?e.jsx("span",{className:"migrate__skip",children:"Failed"}):e.jsx("span",{className:"migrate__wait",children:"Waiting"})})]},a.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:l?"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 B=[{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 q(){const{session:n,signIn:k,restore:j}=K(),u=F(),N=n==null?void 0:n.address;d.useEffect(()=>{j()},[j]);const{data:l,isLoading:c}=P({queryKey:["importable",N],queryFn:()=>Y(N),enabled:!!N}),[f,y]=d.useState({}),[C,I]=d.useState(new Set),[m,g]=d.useState(null),_=d.useMemo(()=>[...(l==null?void 0:l.creations)??[],...(l==null?void 0:l.owned)??[]],[l]);d.useEffect(()=>{_.length&&y(t=>{const r={...t};for(const s of _)r[s.oldTradeId]==null&&(r[s.oldTradeId]=s.suggestedCredits);return r})},[_]);const x=t=>!C.has(t),a=t=>f[t.oldTradeId]??t.suggestedCredits,i=_.filter(t=>x(t.oldTradeId)),o=i.reduce((t,r)=>t+a(r),0);function p(t,r){const s=r.replace(/[^\d]/g,"");y(b=>({...b,[t]:s===""?0:parseInt(s,10)}))}function h(t){I(r=>{const s=new Set(r);return s.has(t)?s.delete(t):s.add(t),s})}function S(t){return t.map(r=>({item:r,priceCredits:Math.max(1,a(r))}))}function T(){u.invalidateQueries({queryKey:["importable"]}),u.invalidateQueries({queryKey:["listings"]}),u.invalidateQueries({queryKey:["my-assets"]}),u.invalidateQueries({queryKey:["collection-sale-state"]}),R.success("Your Shop is updated.")}return n?!c&&_.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(M,{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 ",w.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 ",w.nameSingular," = $0.10 · prices rounded up"]}),c?e.jsx("div",{className:"imp__list",children:Array.from({length:4}).map((t,r)=>e.jsx("div",{className:"imp-row imp-row--skeleton"},r))}):B.map(t=>{const r=(l==null?void 0:l[t.key])??[];return r.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:t.title}),e.jsx("span",{className:"imp__section-sub",children:t.sub})]}),e.jsx("div",{className:"imp__list",children:r.map(s=>{const b=a(s),L=b!==s.suggestedCredits;return e.jsxs("article",{className:`imp-row${x(s.oldTradeId)?"":" is-off"}`,children:[e.jsx("input",{type:"checkbox",className:"imp-check",checked:x(s.oldTradeId),onChange:()=>h(s.oldTradeId),"aria-label":`Include ${s.name}`}),e.jsx("div",{className:"imp-thumb",children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:""}):null}),e.jsxs("div",{className:"imp-meta",children:[e.jsx("div",{className:"imp-name",title:s.name,children:s.name||"Item"}),e.jsx("span",{className:"imp-chip",children:s.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:b.toLocaleString(),onChange:$=>p(s.oldTradeId,$.target.value),"aria-label":`Price in ${w.name} for ${s.name}`})]}),e.jsxs("div",{className:"imp-price__sub",children:[e.jsxs("span",{children:["$",(b*.1).toFixed(2)]}),L?e.jsxs("button",{className:"imp-price__reset",onClick:()=>y($=>({...$,[s.oldTradeId]:s.suggestedCredits})),children:["Reset to ",e.jsx(v,{className:"ccy-mark"}),s.suggestedCredits.toLocaleString()]}):null]})]}),e.jsx("div",{className:"imp-action",children:e.jsx("button",{className:"btn btn--sm imp-row__list",disabled:!x(s.oldTradeId),onClick:()=>g(S([s])),children:"List"})})]},s.oldTradeId)})})]},t.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"})," ",o.toLocaleString()]}),e.jsxs("div",{className:"imp-dock__sub",children:[i.length," item",i.length===1?"":"s"," selected · $",(o*.1).toFixed(2)]})]}),e.jsx("span",{className:"imp-dock__spacer"}),e.jsxs("button",{className:"btn btn--purple imp-dock__cta",disabled:i.length===0,onClick:()=>g(S(i)),children:["List all (",i.length,")"]})]})}),m&&n?e.jsx(z,{queue:m,session:n,onClose:()=>g(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:()=>k(),children:"Sign in"})]})}export{q as ImportListings};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{j as e,r as c,u as fe,d as ve,a as xe,L as je}from"./react-Vu6nbGi5.js";import{_ as Ne,a as Q,V as be,X as ye,Y as ge,Z as Ie,W as we,i as A,h as X,$ as Ce,o as T,d as L,q as Ae,u as Y,w as ke,c as P,a0 as Ee,j as D,a1 as Se,a2 as Le,a3 as Pe,C as Te,a4 as K,a5 as Fe,g as Re,s as $e,v as Be,D as qe,E as Me,F as H,z as Ve,H as De,y as Oe,G as We,k as Ge,f as Ue,a6 as ze,a7 as Ye,I as Ke}from"./index-D8yull60.js";import{h as Z}from"./buy-CtGOLfNq.js";import{g as He,a as Ze,w as Qe,S as Xe,G as Je}from"./buy-gasless-RvPPxhUM.js";import"./ethers-JeCAM1sd.js";import"./index-BrTElmXN.js";const es=c.lazy(()=>Ne(()=>import("./index-7RiTEasz.js").then(t=>t.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(t=>({default:t.EmoteControls})));function ss(t){return e.jsx(c.Suspense,{fallback:null,children:e.jsx(es,{...t})})}function as({item:t}){const n=Q(v=>{var y;return(y=v.session)==null?void 0:y.address}),{data:r,isLoading:p}=be(n),I=n&&r?n:"default",m=t.category==="emote",[j,l]=c.useState("avatar"),h=!m&&j==="item",[s,i]=c.useState(!0);c.useEffect(()=>{i(!0)},[t.id,h]);const o=!!n&&!!r,f=o&&ye(t,ge(r)),b=Ie(t)[0],_=o&&!f&&!m;return e.jsxs(e.Fragment,{children:[p?null:e.jsx(we,{id:"shop-item-preview",contractAddress:t.contractAddress,tokenId:t.tokenId??void 0,itemId:t.tokenId?void 0:t.itemId??void 0,profile:h?void 0:f?I:"default",bodyShape:h||f?void 0:b,type:m?void 0:h?A.PreviewType.WEARABLE:A.PreviewType.AVATAR,emote:m||h?void 0:A.PreviewEmote.FASHION,disableBackground:!0,wheelZoom:m?1.5:void 0,wheelStart:m?100:void 0,dev:X.chainId===80002,onLoad:()=>i(!1)},t.id),p||s?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,_&&!h?e.jsxs("p",{className:"item-preview__note",children:["Shown on a ",Ce(b)," body — this item isn’t made for your avatar’s shape."]}):null,m?e.jsx("div",{className:"item-preview__emote-controls",children:e.jsx(ss,{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:j==="avatar"?"is-active":"","aria-pressed":j==="avatar",onClick:()=>l("avatar"),children:"On avatar"}),e.jsx("button",{type:"button",className:j==="item"?"is-active":"","aria-pressed":j==="item",onClick:()=>l("item"),children:"Item"})]})]})}function ts(t){return t==="male"?"♂":t==="female"?"♀":t==="unisex"?"⚥":""}function is({title:t,items:n,activeId:r,onSelect:p,onViewAll:I}){const m=c.useRef(null),j=T(i=>i.add),l=T(i=>i.items.map(o=>o.id));if(n.length===0)return null;function h(i){j(i,"carousel"),Ae.success(`“${i.name}” added to your cart.`)}function s(i){const o=m.current;o&&o.scrollBy({left:i*Math.round(o.clientWidth*.8),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:t}),e.jsxs("div",{className:"collection-carousel__head-right",children:[I?e.jsx("button",{className:"collection-carousel__viewall",onClick:I,children:"View all"}):null,e.jsxs("div",{className:"collection-carousel__arrows",children:[e.jsx("button",{className:"collection-carousel__arrow",onClick:()=>s(-1),"aria-label":"Scroll left",children:"‹"}),e.jsx("button",{className:"collection-carousel__arrow",onClick:()=>s(1),"aria-label":"Scroll right",children:"›"})]})]})]}),e.jsx("div",{className:"collection-carousel__track",ref:m,children:n.map(i=>{const o=ts(i.gender),f=i.id===r,b=i.priceCredits>0,_=l.includes(i.id);return e.jsxs("article",{className:`collection-carousel__card${f?" is-active":""}`,onClick:()=>p(i),role:"button",tabIndex:0,"aria-current":f||void 0,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),p(i))},children:[e.jsxs("div",{className:"collection-carousel__media",children:[i.thumbnail?e.jsx("img",{className:"collection-carousel__img",src:i.thumbnail,alt:i.name,loading:"lazy"}):null,b?e.jsx("button",{className:"collection-carousel__add",disabled:_,"aria-label":_?"In cart":`Add ${i.name} to cart`,title:_?"In cart":"Add to cart",onClick:v=>{v.stopPropagation(),_||h(i)},children:e.jsx("span",{className:`ico ${_?"ico-cart-solid":"ico-cart"}`,"aria-hidden":!0})}):null]}),e.jsxs("div",{className:"collection-carousel__body",children:[e.jsx("div",{className:"collection-carousel__name",title:i.name,children:i.name}),e.jsxs("div",{className:"collection-carousel__meta",children:[b?e.jsxs("span",{className:"collection-carousel__price",children:[e.jsx(L,{className:"collection-carousel__diamond"}),i.priceCredits]}):e.jsx("span",{className:"collection-carousel__price collection-carousel__na",children:"Not listed"}),e.jsxs("span",{className:"collection-carousel__chips",children:[e.jsx("span",{className:"chip chip--rarity",children:i.rarity}),o?e.jsx("span",{className:"chip chip--icon",children:o}):null]})]})]})]},i.id)})})]})}function rs(t){return Object.values(A.Rarity).includes(t)}function ns(t){return t==="male"?"Male":t==="female"?"Female":t==="unisex"?"Unisex":null}function cs(t){const n=t,r=(n.message??"").toLowerCase();return n.code===4001||r.includes("reject")||r.includes("denied")||r.includes("cancel")?"You cancelled the request.":r.includes("insufficient")?`You don't have enough ${Ge.name} — get more first.`:r.includes("no active listing")||r.includes("not for sale")?"This item is not for sale right now.":"Couldn't complete checkout — please try again."}function _s(){const{contractAddress:t,tokenId:n}=fe(),{state:r}=ve(),p=xe(),I=T(a=>a.add),m=T(a=>a.items),j=Y(a=>a.toggle),{session:l}=Q(),{data:h}=ke(l),[s,i]=c.useState(()=>r!=null&&r.item?{...r.item,tradeId:r.tradeId??r.item.tradeId}:{id:`${t}-${n}`,name:"",creator:"",contractAddress:t??"",itemId:null,category:"wearable",rarity:"common",network:"MATIC",chainId:X.chainId,thumbnail:"",priceCredits:0,gender:null,tokenId:n??void 0,tradeId:r==null?void 0:r.tradeId}),[o,f]=c.useState(!1),[b,_]=c.useState(null),[v,y]=c.useState(null),{data:w=[],isFetched:J}=P({queryKey:["collection-items",s.contractAddress],enabled:!!s.contractAddress,queryFn:()=>Ue(s.contractAddress,{first:20}).then(a=>a.items)}),{data:F,isLoading:ee}=P({queryKey:["shop-item",s.contractAddress,n],enabled:!(r!=null&&r.item)&&!!s.contractAddress&&!!n,queryFn:()=>ze(s.contractAddress,n)});c.useEffect(()=>{F&&i(a=>a.tradeId?a:{...F})},[F]);const[O,se]=c.useState(!1),{data:R=""}=P({queryKey:["item-desc",s.contractAddress,s.itemId],enabled:!!s.contractAddress&&!!s.itemId,staleTime:5*6e4,queryFn:()=>Ye(s.contractAddress,s.itemId)});c.useEffect(()=>{if(s.name||w.length===0)return;const a=n&&w.find(d=>d.tokenId===n||d.itemId===n)||w.find(d=>d.contractAddress===s.contractAddress);a&&i(d=>({...a,tradeId:d.tradeId??a.tradeId}))},[w]);const ae=c.useMemo(()=>{const a=new Set,d=[];for(const u of w){if(u.id===s.id||s.itemId&&u.itemId===s.itemId||s.tokenId&&u.tokenId===s.tokenId)continue;const S=`${u.contractAddress}-${u.itemId??u.tokenId??u.id}`;a.has(S)||(a.add(S),d.push(u))}return d},[w,s.id,s.itemId,s.tokenId]),{data:te,isLoading:k}=P({queryKey:["detail-trade",s.id,s.tradeId,s.contractAddress,s.itemId],enabled:!!s.contractAddress,queryFn:async()=>{if(s.tradeId)return s.tradeId;if(s.itemId){const a=await Ke(s.contractAddress,s.itemId);return(a==null?void 0:a.id)??null}return null}}),g=s.tradeId??te??void 0,N=!!g,ie=Ee({priceCredits:s.priceCredits,compareAtCredits:s.compareAtCredits,saleEndsAt:s.saleEndsAt}),E=c.useMemo(()=>({...s,tradeId:g,id:g??s.id}),[s,g]),$=m.some(a=>a.id===E.id),B=Y(a=>!!a.items[s.id]);c.useEffect(()=>{_(null),y(null)},[s.id]);const W=c.useRef(null);c.useEffect(()=>{!s.name||k||W.current===s.id||(W.current=s.id,D("Shop Viewed Item",{...Se(s),for_sale:N}),Le(s))},[s.id,s.name,k,N]);function re(a){i(a);const d=a.tokenId??a.itemId;a.contractAddress&&d&&p(`/item/${a.contractAddress}/${d}`,{replace:!0,state:{item:a}}),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}function ne(){!N||$||U||I(E,"item_detail")}async function ce(){var S;if(!N||!g)return;if(!l){y("Sign in to check out.");return}y(null),f(!0);let a,d="authorize",u=!1;try{_(`Buying ${s.name||"item"}…`);const x=await Re(g);if(!x)throw new Error("not for sale");if($e(x,l.address)){y("You can't buy your own listing."),_(null),f(!1);return}const q=(S=x.received)==null?void 0:S[0],_e=Be(q==null?void 0:q.amount),{credit:z,maxCreditedValue:pe}=await qe(l.identity,_e,g);a=z.id,d="submit";const M={trade:x,buyer:l.address,signer:l.signer,credits:[z],maxCreditedValue:pe};let C;if(He())try{C=await Ze(M),await Qe(C),u=!0}catch(V){if(V instanceof Xe)u=!0;else if(V instanceof Je)C=await Z(M);else throw V}else C=await Z(M);a=void 0,D("Shop Completed Purchase",{...Me([E]),payment_type:"credits",no_crypto_step:u,transaction_hash:C??null}),p("/success",{state:{items:[E],txHash:C}})}catch(x){H(x)||Ve(x,{flow:"buy",step:d,gasless:u}),a&&De(l.identity,[a]).catch(()=>{}),D(H(x)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:d,error_code:We(x),value_usd:Oe(E.priceCredits)}),y(cs(x)),_(null)}finally{f(!1)}}const le=rs(s.rarity)?s.rarity:A.Rarity.COMMON,[de]=A.Rarity.getGradient(le),G=ns(s.gender),oe=N&&ie,ue="More from this collection",U=Pe(s,l==null?void 0:l.address),me=N?$?"In cart":k?"Checking…":"Add to cart":"Not for sale",he=ee||!!s.contractAddress&&!J;return!s.name&&!he?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:()=>p("/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:()=>p("/assets"),children:"Collectibles"}),e.jsx("span",{className:"item-detail__crumb-sep",children:"/"}),e.jsx("span",{className:"item-detail__crumb-current",children:s.name||"Item"})]}),e.jsxs("div",{className:"item-detail__main",children:[e.jsx("div",{className:"item-detail__preview",style:{background:`radial-gradient(circle at 50% 38%, ${de}33 0%, var(--media) 68%)`},children:s.name?e.jsx(as,{item:s}):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:s.name||"Loading…"}),e.jsx("button",{className:`item-detail__fav${B?" is-on":""}`,onClick:()=>j(s),"aria-pressed":B,"aria-label":B?"Remove from favorites":"Add to favorites",children:e.jsx("span",{className:"ico ico-heart","aria-hidden":!0})})]}),s.creator?e.jsx(Te,{address:s.creator,className:"item-detail__creator",linkToProfile:!0}):null,e.jsxs("div",{className:"item-detail__chips",children:[e.jsx("span",{className:"chip chip--rarity",children:s.rarity}),e.jsx("span",{className:"chip",children:s.category==="emote"?"Emote":"Wearable"}),G?e.jsx("span",{className:"chip",children:G}):null]}),R?e.jsxs("div",{className:"item-detail__description",children:[e.jsx("p",{className:`item-detail__desc-text${O?" is-expanded":""}`,children:R}),R.length>140?e.jsx("button",{className:"link item-detail__desc-toggle",onClick:()=>se(a=>!a),children:O?"Show less":"Read more"}):null]}):null,e.jsxs("div",{className:"item-detail__card",children:[e.jsxs("div",{className:"item-detail__price-block",children:[e.jsx("div",{className:"item-detail__price-label",children:"Price"}),N?oe?e.jsxs("div",{className:"item-detail__price item-detail__price--sale",children:[e.jsxs("span",{className:"item-detail__price",children:[e.jsx(L,{className:"item-detail__diamond"}),e.jsx("span",{className:"item-detail__price-value",children:s.priceCredits})]}),e.jsxs("span",{className:"item-detail__price-was",children:[e.jsx(L,{className:"item-detail__diamond item-detail__diamond--was"}),s.compareAtCredits]}),K(s.compareAtCredits,s.priceCredits)>0?e.jsxs("span",{className:"item-detail__sale-badge",children:["SALE -",K(s.compareAtCredits,s.priceCredits),"%"]}):null,e.jsx(Fe,{endsAt:s.saleEndsAt,className:"item-detail__countdown"})]}):e.jsxs("div",{className:"item-detail__price",children:[e.jsx(L,{className:"item-detail__diamond"}),e.jsx("span",{className:"item-detail__price-value",children:s.priceCredits})]}):e.jsx("div",{className:"item-detail__price item-detail__price--none",children:"Not for sale"}),l?e.jsxs("div",{className:"item-detail__balance muted",children:["Your balance: ",e.jsx(L,{className:"ccy-mark"})," ",(h==null?void 0:h.credits)??0]}):null]}),e.jsx("div",{className:"item-detail__ctas",children:U?e.jsxs("p",{className:"item-detail__own-note muted",children:["This is your item — manage it in ",e.jsx(je,{to:"/my-assets",children:"My Assets"}),"."]}):e.jsxs(e.Fragment,{children:[N?e.jsx("button",{className:"btn btn--purple item-detail__cta",onClick:ce,disabled:o||k,children:o?"Buying…":"Buy now"}):null,e.jsxs("button",{className:"item-detail__addcart",onClick:ne,disabled:!N||$||k||o,children:[e.jsx("span",{className:"ico ico-cart-solid item-detail__addcart-ico","aria-hidden":!0}),me]})]})}),b?e.jsx("p",{className:"muted item-detail__status",children:b}):null,v?e.jsx("p",{className:"error item-detail__status",children:v}):null]})]})]}),e.jsx(is,{title:ue,items:ae,activeId:s.id,onSelect:re,onViewAll:s.contractAddress?()=>p(`/collection/${s.contractAddress}`):void 0})]})}export{_s as ItemDetail,_s as default};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BFflN0t4.js","assets/react-Vu6nbGi5.js","assets/index-BQTrO182.js","assets/ethers-JeCAM1sd.js","assets/index-DliU9pat.css","assets/generateUtilityClasses-CVd9wG9P.js","assets/Button-BX2vF44i.js","assets/SvgIcon-ZHB11KC9.js","assets/CircularProgress-CDHgSKkY.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{j as e,r as c,u as fe,d as ve,a as xe,L as je}from"./react-Vu6nbGi5.js";import{_ as Ne,a as Q,V as be,X as ye,Y as ge,Z as Ie,W as we,i as A,h as X,$ as Ce,o as T,d as L,q as Ae,u as Y,w as ke,c as P,a0 as Ee,j as D,a1 as Se,a2 as Le,a3 as Pe,C as Te,a4 as K,a5 as Fe,g as Re,s as $e,v as Be,D as qe,E as Me,F as H,z as Ve,H as De,y as Oe,G as We,k as Ge,f as Ue,a6 as ze,a7 as Ye,I as Ke}from"./index-BQTrO182.js";import{h as Z}from"./buy-DSDTz9Ug.js";import{g as He,a as Ze,w as Qe,S as Xe,G as Je}from"./buy-gasless-VKTXyC9T.js";import"./ethers-JeCAM1sd.js";import"./index-DZ7OqNDh.js";const es=c.lazy(()=>Ne(()=>import("./index-BFflN0t4.js").then(t=>t.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8])).then(t=>({default:t.EmoteControls})));function ss(t){return e.jsx(c.Suspense,{fallback:null,children:e.jsx(es,{...t})})}function as({item:t}){const n=Q(v=>{var y;return(y=v.session)==null?void 0:y.address}),{data:r,isLoading:p}=be(n),I=n&&r?n:"default",m=t.category==="emote",[j,l]=c.useState("avatar"),h=!m&&j==="item",[s,i]=c.useState(!0);c.useEffect(()=>{i(!0)},[t.id,h]);const o=!!n&&!!r,f=o&&ye(t,ge(r)),b=Ie(t)[0],_=o&&!f&&!m;return e.jsxs(e.Fragment,{children:[p?null:e.jsx(we,{id:"shop-item-preview",contractAddress:t.contractAddress,tokenId:t.tokenId??void 0,itemId:t.tokenId?void 0:t.itemId??void 0,profile:h?void 0:f?I:"default",bodyShape:h||f?void 0:b,type:m?void 0:h?A.PreviewType.WEARABLE:A.PreviewType.AVATAR,emote:m||h?void 0:A.PreviewEmote.FASHION,disableBackground:!0,wheelZoom:m?1.5:void 0,wheelStart:m?100:void 0,dev:X.chainId===80002,onLoad:()=>i(!1)},t.id),p||s?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,_&&!h?e.jsxs("p",{className:"item-preview__note",children:["Shown on a ",Ce(b)," body — this item isn’t made for your avatar’s shape."]}):null,m?e.jsx("div",{className:"item-preview__emote-controls",children:e.jsx(ss,{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:j==="avatar"?"is-active":"","aria-pressed":j==="avatar",onClick:()=>l("avatar"),children:"On avatar"}),e.jsx("button",{type:"button",className:j==="item"?"is-active":"","aria-pressed":j==="item",onClick:()=>l("item"),children:"Item"})]})]})}function ts(t){return t==="male"?"♂":t==="female"?"♀":t==="unisex"?"⚥":""}function is({title:t,items:n,activeId:r,onSelect:p,onViewAll:I}){const m=c.useRef(null),j=T(i=>i.add),l=T(i=>i.items.map(o=>o.id));if(n.length===0)return null;function h(i){j(i,"carousel"),Ae.success(`“${i.name}” added to your cart.`)}function s(i){const o=m.current;o&&o.scrollBy({left:i*Math.round(o.clientWidth*.8),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:t}),e.jsxs("div",{className:"collection-carousel__head-right",children:[I?e.jsx("button",{className:"collection-carousel__viewall",onClick:I,children:"View all"}):null,e.jsxs("div",{className:"collection-carousel__arrows",children:[e.jsx("button",{className:"collection-carousel__arrow",onClick:()=>s(-1),"aria-label":"Scroll left",children:"‹"}),e.jsx("button",{className:"collection-carousel__arrow",onClick:()=>s(1),"aria-label":"Scroll right",children:"›"})]})]})]}),e.jsx("div",{className:"collection-carousel__track",ref:m,children:n.map(i=>{const o=ts(i.gender),f=i.id===r,b=i.priceCredits>0,_=l.includes(i.id);return e.jsxs("article",{className:`collection-carousel__card${f?" is-active":""}`,onClick:()=>p(i),role:"button",tabIndex:0,"aria-current":f||void 0,onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),p(i))},children:[e.jsxs("div",{className:"collection-carousel__media",children:[i.thumbnail?e.jsx("img",{className:"collection-carousel__img",src:i.thumbnail,alt:i.name,loading:"lazy"}):null,b?e.jsx("button",{className:"collection-carousel__add",disabled:_,"aria-label":_?"In cart":`Add ${i.name} to cart`,title:_?"In cart":"Add to cart",onClick:v=>{v.stopPropagation(),_||h(i)},children:e.jsx("span",{className:`ico ${_?"ico-cart-solid":"ico-cart"}`,"aria-hidden":!0})}):null]}),e.jsxs("div",{className:"collection-carousel__body",children:[e.jsx("div",{className:"collection-carousel__name",title:i.name,children:i.name}),e.jsxs("div",{className:"collection-carousel__meta",children:[b?e.jsxs("span",{className:"collection-carousel__price",children:[e.jsx(L,{className:"collection-carousel__diamond"}),i.priceCredits]}):e.jsx("span",{className:"collection-carousel__price collection-carousel__na",children:"Not listed"}),e.jsxs("span",{className:"collection-carousel__chips",children:[e.jsx("span",{className:"chip chip--rarity",children:i.rarity}),o?e.jsx("span",{className:"chip chip--icon",children:o}):null]})]})]})]},i.id)})})]})}function rs(t){return Object.values(A.Rarity).includes(t)}function ns(t){return t==="male"?"Male":t==="female"?"Female":t==="unisex"?"Unisex":null}function cs(t){const n=t,r=(n.message??"").toLowerCase();return n.code===4001||r.includes("reject")||r.includes("denied")||r.includes("cancel")?"You cancelled the request.":r.includes("insufficient")?`You don't have enough ${Ge.name} — get more first.`:r.includes("no active listing")||r.includes("not for sale")?"This item is not for sale right now.":"Couldn't complete checkout — please try again."}function _s(){const{contractAddress:t,tokenId:n}=fe(),{state:r}=ve(),p=xe(),I=T(a=>a.add),m=T(a=>a.items),j=Y(a=>a.toggle),{session:l}=Q(),{data:h}=ke(l),[s,i]=c.useState(()=>r!=null&&r.item?{...r.item,tradeId:r.tradeId??r.item.tradeId}:{id:`${t}-${n}`,name:"",creator:"",contractAddress:t??"",itemId:null,category:"wearable",rarity:"common",network:"MATIC",chainId:X.chainId,thumbnail:"",priceCredits:0,gender:null,tokenId:n??void 0,tradeId:r==null?void 0:r.tradeId}),[o,f]=c.useState(!1),[b,_]=c.useState(null),[v,y]=c.useState(null),{data:w=[],isFetched:J}=P({queryKey:["collection-items",s.contractAddress],enabled:!!s.contractAddress,queryFn:()=>Ue(s.contractAddress,{first:20}).then(a=>a.items)}),{data:F,isLoading:ee}=P({queryKey:["shop-item",s.contractAddress,n],enabled:!(r!=null&&r.item)&&!!s.contractAddress&&!!n,queryFn:()=>ze(s.contractAddress,n)});c.useEffect(()=>{F&&i(a=>a.tradeId?a:{...F})},[F]);const[O,se]=c.useState(!1),{data:R=""}=P({queryKey:["item-desc",s.contractAddress,s.itemId],enabled:!!s.contractAddress&&!!s.itemId,staleTime:5*6e4,queryFn:()=>Ye(s.contractAddress,s.itemId)});c.useEffect(()=>{if(s.name||w.length===0)return;const a=n&&w.find(d=>d.tokenId===n||d.itemId===n)||w.find(d=>d.contractAddress===s.contractAddress);a&&i(d=>({...a,tradeId:d.tradeId??a.tradeId}))},[w]);const ae=c.useMemo(()=>{const a=new Set,d=[];for(const u of w){if(u.id===s.id||s.itemId&&u.itemId===s.itemId||s.tokenId&&u.tokenId===s.tokenId)continue;const S=`${u.contractAddress}-${u.itemId??u.tokenId??u.id}`;a.has(S)||(a.add(S),d.push(u))}return d},[w,s.id,s.itemId,s.tokenId]),{data:te,isLoading:k}=P({queryKey:["detail-trade",s.id,s.tradeId,s.contractAddress,s.itemId],enabled:!!s.contractAddress,queryFn:async()=>{if(s.tradeId)return s.tradeId;if(s.itemId){const a=await Ke(s.contractAddress,s.itemId);return(a==null?void 0:a.id)??null}return null}}),g=s.tradeId??te??void 0,N=!!g,ie=Ee({priceCredits:s.priceCredits,compareAtCredits:s.compareAtCredits,saleEndsAt:s.saleEndsAt}),E=c.useMemo(()=>({...s,tradeId:g,id:g??s.id}),[s,g]),$=m.some(a=>a.id===E.id),B=Y(a=>!!a.items[s.id]);c.useEffect(()=>{_(null),y(null)},[s.id]);const W=c.useRef(null);c.useEffect(()=>{!s.name||k||W.current===s.id||(W.current=s.id,D("Shop Viewed Item",{...Se(s),for_sale:N}),Le(s))},[s.id,s.name,k,N]);function re(a){i(a);const d=a.tokenId??a.itemId;a.contractAddress&&d&&p(`/item/${a.contractAddress}/${d}`,{replace:!0,state:{item:a}}),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}function ne(){!N||$||U||I(E,"item_detail")}async function ce(){var S;if(!N||!g)return;if(!l){y("Sign in to check out.");return}y(null),f(!0);let a,d="authorize",u=!1;try{_(`Buying ${s.name||"item"}…`);const x=await Re(g);if(!x)throw new Error("not for sale");if($e(x,l.address)){y("You can't buy your own listing."),_(null),f(!1);return}const q=(S=x.received)==null?void 0:S[0],_e=Be(q==null?void 0:q.amount),{credit:z,maxCreditedValue:pe}=await qe(l.identity,_e,g);a=z.id,d="submit";const M={trade:x,buyer:l.address,signer:l.signer,credits:[z],maxCreditedValue:pe};let C;if(He())try{C=await Ze(M),await Qe(C),u=!0}catch(V){if(V instanceof Xe)u=!0;else if(V instanceof Je)C=await Z(M);else throw V}else C=await Z(M);a=void 0,D("Shop Completed Purchase",{...Me([E]),payment_type:"credits",no_crypto_step:u,transaction_hash:C??null}),p("/success",{state:{items:[E],txHash:C}})}catch(x){H(x)||Ve(x,{flow:"buy",step:d,gasless:u}),a&&De(l.identity,[a]).catch(()=>{}),D(H(x)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:d,error_code:We(x),value_usd:Oe(E.priceCredits)}),y(cs(x)),_(null)}finally{f(!1)}}const le=rs(s.rarity)?s.rarity:A.Rarity.COMMON,[de]=A.Rarity.getGradient(le),G=ns(s.gender),oe=N&&ie,ue="More from this collection",U=Pe(s,l==null?void 0:l.address),me=N?$?"In cart":k?"Checking…":"Add to cart":"Not for sale",he=ee||!!s.contractAddress&&!J;return!s.name&&!he?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:()=>p("/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:()=>p("/assets"),children:"Collectibles"}),e.jsx("span",{className:"item-detail__crumb-sep",children:"/"}),e.jsx("span",{className:"item-detail__crumb-current",children:s.name||"Item"})]}),e.jsxs("div",{className:"item-detail__main",children:[e.jsx("div",{className:"item-detail__preview",style:{background:`radial-gradient(circle at 50% 38%, ${de}33 0%, var(--media) 68%)`},children:s.name?e.jsx(as,{item:s}):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:s.name||"Loading…"}),e.jsx("button",{className:`item-detail__fav${B?" is-on":""}`,onClick:()=>j(s),"aria-pressed":B,"aria-label":B?"Remove from favorites":"Add to favorites",children:e.jsx("span",{className:"ico ico-heart","aria-hidden":!0})})]}),s.creator?e.jsx(Te,{address:s.creator,className:"item-detail__creator",linkToProfile:!0}):null,e.jsxs("div",{className:"item-detail__chips",children:[e.jsx("span",{className:"chip chip--rarity",children:s.rarity}),e.jsx("span",{className:"chip",children:s.category==="emote"?"Emote":"Wearable"}),G?e.jsx("span",{className:"chip",children:G}):null]}),R?e.jsxs("div",{className:"item-detail__description",children:[e.jsx("p",{className:`item-detail__desc-text${O?" is-expanded":""}`,children:R}),R.length>140?e.jsx("button",{className:"link item-detail__desc-toggle",onClick:()=>se(a=>!a),children:O?"Show less":"Read more"}):null]}):null,e.jsxs("div",{className:"item-detail__card",children:[e.jsxs("div",{className:"item-detail__price-block",children:[e.jsx("div",{className:"item-detail__price-label",children:"Price"}),N?oe?e.jsxs("div",{className:"item-detail__price item-detail__price--sale",children:[e.jsxs("span",{className:"item-detail__price",children:[e.jsx(L,{className:"item-detail__diamond"}),e.jsx("span",{className:"item-detail__price-value",children:s.priceCredits})]}),e.jsxs("span",{className:"item-detail__price-was",children:[e.jsx(L,{className:"item-detail__diamond item-detail__diamond--was"}),s.compareAtCredits]}),K(s.compareAtCredits,s.priceCredits)>0?e.jsxs("span",{className:"item-detail__sale-badge",children:["SALE -",K(s.compareAtCredits,s.priceCredits),"%"]}):null,e.jsx(Fe,{endsAt:s.saleEndsAt,className:"item-detail__countdown"})]}):e.jsxs("div",{className:"item-detail__price",children:[e.jsx(L,{className:"item-detail__diamond"}),e.jsx("span",{className:"item-detail__price-value",children:s.priceCredits})]}):e.jsx("div",{className:"item-detail__price item-detail__price--none",children:"Not for sale"}),l?e.jsxs("div",{className:"item-detail__balance muted",children:["Your balance: ",e.jsx(L,{className:"ccy-mark"})," ",(h==null?void 0:h.credits)??0]}):null]}),e.jsx("div",{className:"item-detail__ctas",children:U?e.jsxs("p",{className:"item-detail__own-note muted",children:["This is your item — manage it in ",e.jsx(je,{to:"/my-assets",children:"My Assets"}),"."]}):e.jsxs(e.Fragment,{children:[N?e.jsx("button",{className:"btn btn--purple item-detail__cta",onClick:ce,disabled:o||k,children:o?"Buying…":"Buy now"}):null,e.jsxs("button",{className:"item-detail__addcart",onClick:ne,disabled:!N||$||k||o,children:[e.jsx("span",{className:"ico ico-cart-solid item-detail__addcart-ico","aria-hidden":!0}),me]})]})}),b?e.jsx("p",{className:"muted item-detail__status",children:b}):null,v?e.jsx("p",{className:"error item-detail__status",children:v}):null]})]})]}),e.jsx(is,{title:ue,items:ae,activeId:s.id,onSelect:re,onViewAll:s.contractAddress?()=>p(`/collection/${s.contractAddress}`):void 0})]})}export{_s as ItemDetail,_s as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as ee,r as u,j as e,b as ae}from"./react-Vu6nbGi5.js";import{c as te,h as G,a as re,w as se,x as z,g as
|
|
1
|
+
import{a as ee,r as u,j as e,b as ae}from"./react-Vu6nbGi5.js";import{c as te,h as G,a as re,w as se,x as z,g as ne,s as ie,D as oe,H as I,j as M,G as W,F as $,d as T,K as H,k as U,A as ce,L as de}from"./index-BQTrO182.js";import{r as le,a as q,m as ue}from"./mana-rate-C-rCn1C4.js";import{S as K,F as me,a as he}from"./FilterBar-CdU8B66A.js";import{S as Y}from"./SkeletonCards-BysJEVmg.js";import{L as ye}from"./LoadMore-BOCtgPLI.js";import{h as Q}from"./buy-DSDTz9Ug.js";import{g as pe,a as fe,w as ke,S as be,G as _e}from"./buy-gasless-VKTXyC9T.js";import{u as ge}from"./useInfiniteGrid-BddL8SSO.js";import"./ethers-JeCAM1sd.js";import"./index-DZ7OqNDh.js";function xe(){return te({queryKey:["mana-rate",G.chainId],queryFn:()=>le(G.chainId),staleTime:6e4,refetchInterval:6e4,retry:1})}function O(a){const m=a,d=(m.message??"").toLowerCase();return m.code===4001||d.includes("reject")||d.includes("denied")||d.includes("cancel")?"You cancelled the request.":d.includes("insufficient")?`Not enough ${U.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 Ce(a){return{id:a.tradeId,tradeId:a.tradeId,name:a.name,creator:a.creator,contractAddress:a.contractAddress,itemId:a.itemId,category:a.category,wearableCategory:a.wearableCategory??void 0,rarity:a.rarity,network:a.network,chainId:a.chainId,thumbnail:a.thumbnail,priceCredits:0,gender:null}}function ve({listing:a,rate:m,onClose:d,onSold:p}){const{session:n}=re(),{data:o}=se(n),f=z(),k=ee(),[v,b]=u.useState("confirm"),[j,w]=u.useState("Locking today’s price…"),[x,C]=u.useState(null),[s,E]=u.useState(null),l=u.useRef(null),A=Math.ceil(q(a.manaWei,m)/10);u.useEffect(()=>{let h=!1;if(!n){b("error"),C("Sign in to check out.");return}return(async()=>{try{const r=await ne(a.tradeId);if(!r)throw new Error("not found");if(ie(r,n.address))throw new Error("You can't buy your own listing.");const c=q(a.manaWei,m);if(!Number.isFinite(c)||c<=0)throw new Error("price unavailable");const{credit:y,maxCreditedValue:R,usdCents:P}=await oe(n.identity,c,a.tradeId);if(h){I(n.identity,[y.id]).catch(()=>{});return}l.current=y.id,E({trade:r,credit:y,maxCreditedValue:R,usdCents:P,credits:Math.ceil(P/10)}),w("")}catch(r){if(h)return;console.error("[market] authorize failed",r),M($(r)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:W(r),value_usd:Math.round(q(a.manaWei,m))/100}),b("error"),C(O(r))}})(),()=>{h=!0,l.current&&n&&(I(n.identity,[l.current]).catch(()=>{}),l.current=null)}},[]);const _=!!s&&((o==null?void 0:o.credits)??0)<s.credits;async function L(){if(!n||!s)return;if(_){I(n.identity,[s.credit.id]).catch(()=>{}),l.current=null,k("/credits");return}b("working"),C(null);let h=!1;try{w("Confirming your purchase…");const r={trade:s.trade,buyer:n.address,signer:n.signer,credits:[s.credit],maxCreditedValue:s.maxCreditedValue};let c;if(pe())try{c=await fe(r),await ke(c),h=!0}catch(y){if(y instanceof be)h=!0;else if(y instanceof _e)c=await Q(r);else throw y}else c=await Q(r);l.current=null,M("Shop Completed Purchase",{items:[{item_id:a.itemId??null,contract_address:a.contractAddress,token_id:null,price_usd:s.usdCents/100}],value_credits:s.credits,value_usd:s.usdCents/100,purchase_type:"item",is_primary:!0,payment_type:"credits",no_crypto_step:h,transaction_hash:c??null}),f.invalidateQueries({queryKey:["usd-balance"]}),k("/success",{state:{items:[Ce(a)],txHash:c}})}catch(r){console.error("[market] buy now failed",r),I(n.identity,[s.credit.id]).catch(()=>{}),l.current=null,M($(r)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:W(r),value_usd:s.usdCents/100}),f.invalidateQueries({queryKey:["usd-balance"]});const c=O(r);C(c),b("error"),/sold or removed/i.test(c)&&p()}}function F(){n&&s&&I(n.identity,[s.credit.id]).catch(()=>{}),l.current=null,d()}const g=v==="working";return e.jsxs("div",{className:"mkt-modal",role:"dialog","aria-modal":"true","aria-label":`Buy ${a.name}`,children:[e.jsx("div",{className:"mkt-modal__scrim",onClick:g?void 0:F,"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:a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:""}):null}),e.jsxs("div",{children:[e.jsx("div",{className:"mkt-modal__name",title:a.name,children:a.name||"Item"}),e.jsx("span",{className:"chip chip--rarity",children:a.rarity})]})]}),e.jsx("div",{className:"mkt-modal__price",children:s?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(T,{className:"mkt-modal__diamond"}),H(s.credits)]}),e.jsxs("div",{className:"mkt-modal__price-sub muted",children:["Locked for this purchase · $",(s.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(T,{className:"mkt-modal__diamond"}),H(A)]}),e.jsx("div",{className:"mkt-modal__price-sub muted",children:j||"Locking today’s price…"})]})}),n?e.jsxs("div",{className:"mkt-modal__balance muted",children:["Your balance: ",e.jsx(T,{className:"ccy-mark"})," ",(o==null?void 0:o.credits)??0]}):null,_?e.jsxs("p",{className:"muted mkt-modal__note",children:["You’ll need a few more ",U.name," to buy this."]}):null,j&&v==="working"?e.jsx("p",{className:"muted mkt-modal__note",children:j}):null,x?e.jsx("p",{className:"error mkt-modal__note",children:x}):null,e.jsxs("div",{className:"mkt-modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:F,disabled:g,children:"Cancel"}),e.jsx("button",{className:"btn btn--purple",onClick:L,disabled:g||!s,children:g?"Buying…":_?`Get ${U.name}`:"Confirm purchase"})]})]})]})}const je=48,B=[{key:"wearable",label:"Wearables",sub:["Head","Upper Body","Handwear","Lower Body","Feet","Accessories","Skins"]},{key:"emote",label:"Emotes",sub:[]}],we={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"]};function Ne(a){return{id:a.tradeId,tradeId:a.tradeId,name:a.name,creator:a.creator,contractAddress:a.contractAddress,itemId:a.itemId,category:a.category,wearableCategory:a.wearableCategory??void 0,rarity:a.rarity,network:a.network,chainId:a.chainId,thumbnail:a.thumbnail,priceCredits:0,gender:null}}function Be(){const[a]=ae(),m=(a.get("q")??"").trim().toLowerCase(),d=z(),[p,n]=u.useState("wearable"),[o,f]=u.useState(null),[k,v]=u.useState([]),[b,j]=u.useState("newest"),[w,x]=u.useState(null),C=o?we[o]:void 0,s=(K.find(t=>t.key===b)??K[0]).server,E={category:p,rarities:k.length?k:void 0,wearableCategories:C,search:m||void 0,sortBy:s},{items:l,total:A,isLoading:_,error:L,hasNextPage:F,isFetchingNextPage:g,fetchNextPage:h}=ge(["legacy-listings",E],t=>de({...E,first:je,skip:t})),{data:r,isError:c}=xe(),y=t=>r?ue(t.manaWei,r):null;function R(t){n(t),f(null)}function P(t){v(i=>i.includes(t)?i.filter(S=>S!==t):[...i,t])}function V(){n("wearable"),f(null),v([])}function D(t){const i=l.find(S=>S.tradeId===t.tradeId);i&&x(i)}function Z(){d.invalidateQueries({queryKey:["legacy-listings"]})}const N=B.find(t=>t.key===p)??B[0],J=o?`${N.label} · ${o}`:N.label,X=p!=="wearable"||!!o||k.length>0;return e.jsxs("div",{className:"browse",children:[e.jsxs("div",{className:"market-banner",children:[e.jsx("span",{className:"market-banner__ico","aria-hidden":!0,children:"✨"}),e.jsx("span",{children:"Prices here follow the live market and may shift slightly at checkout."})]}),c?e.jsx("p",{className:"market-banner market-banner--warn",children:"The market price is temporarily unavailable — buying is paused for a moment. Please try again shortly."}):null,e.jsx(me,{rarities:k,onToggleRarity:P,sort:b,onSort:j,total:A,loading:_,query:m,anyActive:X,onClear:V,renderLeading:t=>e.jsx(he,{panelKey:"section",label:J,active:!!o||p!=="wearable",panel:t,children:e.jsxs("div",{className:"filter-pop filter-pop--section",children:[e.jsx("ul",{className:"filter-pop__cats",children:B.map(i=>e.jsx("li",{children:e.jsx("button",{className:`filter-pop__cat${p===i.key?" is-active":""}`,onClick:()=>R(i.key),children:i.label})},i.key))}),N.sub.length?e.jsxs("ul",{className:"filter-pop__subs",children:[e.jsx("li",{children:e.jsxs("button",{className:`filter-pop__sub${o?"":" is-active"}`,onClick:()=>{f(null),t.close()},children:["All ",N.label]})}),N.sub.map(i=>e.jsx("li",{children:e.jsx("button",{className:`filter-pop__sub${o===i?" is-active":""}`,onClick:()=>{f(S=>S===i?null:i),t.close()},children:i})},i))]}):null]})})}),L?e.jsx("p",{className:"error",children:"Couldn’t load the market — please try again."}):null,e.jsx("div",{className:"grid",children:_?e.jsx(Y,{count:15}):e.jsxs(e.Fragment,{children:[l.map(t=>e.jsx(ce,{item:Ne(t),mode:"market",marketPriceCredits:y(t),onBuyNow:D},t.tradeId)),g?e.jsx(Y,{count:6}):null]})}),e.jsx(ye,{hasNextPage:F,isFetching:g,onLoadMore:()=>h()}),!_&&l.length===0?e.jsx("p",{className:"muted",children:"No items match your filters."}):null,w&&r?e.jsx(ve,{listing:w,rate:r,onClose:()=>x(null),onSold:()=>{x(null),Z()}}):null]})}export{Be as Market,Be as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{_ as w,b as g,n as Ne,o as ke,g as Q,a as A,u as ie,c as Z,e as ae,s as le,p as H,q as we}from"./generateUtilityClasses-
|
|
1
|
+
import{_ as w,b as g,n as Ne,o as ke,g as Q,a as A,u as ie,c as Z,e as ae,s as le,p as H,q as we}from"./generateUtilityClasses-CVd9wG9P.js";import{r as p,j as T,f as z,R as X,h as De}from"./react-Vu6nbGi5.js";import{u as Oe,_ as Le,T as Ce,a as W,b as J,s as ue,c as _e,o as ce,B as Fe}from"./Button-BX2vF44i.js";function je(e){const t=e.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}const He=["value"],Se=p.createContext();function xt(e){let{value:t}=e,n=w(e,He);return T.jsx(Se.Provider,g({value:t??!0},n))}const bt=()=>{const e=p.useContext(Se);return e??!1};function Ae(){const e=Oe(ke);return e[Ne]||e}const de=e=>{let t;return e<1?t=5.11916*e**2:t=4.5*Math.log(e+1)+2,(t/100).toFixed(2)};var ee={exports:{}},d={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-is.production.min.js
|
|
4
4
|
*
|