@dcl/shop 0.1.0-28784739881.commit-43c3ed7 → 0.1.0-28788415697.commit-92a0131
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/{Assets-gIjjpRy5.js → Assets-C0yakYaS.js} +1 -1
- package/assets/Cart-CcietwVV.js +1 -0
- package/assets/{CircularProgress-lGz3QJzY.js → CircularProgress-B0lRHBCP.js} +1 -1
- package/assets/{Collection-cVl5pkqL.js → Collection-DpUFjy6q.js} +1 -1
- package/assets/{Creator-CtFPTv2r.js → Creator-BIgvo89M.js} +1 -1
- package/assets/{ExchangeController-D_k2b6bN.js → ExchangeController-BxGELXaJ.js} +1 -1
- package/assets/{GetCredits-C5tUkBfq.js → GetCredits-BkyWsDk5.js} +2 -2
- package/assets/{HelpersUtil-Bx9DcGje.js → HelpersUtil-JEAWoPWy.js} +1 -1
- package/assets/{ImportListings-Cp9c43PW.js → ImportListings-_ZmYZr75.js} +1 -1
- package/assets/ItemDetail-5H1R8AEJ.js +1 -0
- package/assets/{ItemDetail-ClAyj4b-.css → ItemDetail-BLC5ggDg.css} +1 -1
- package/assets/Market-DjypWFj5.js +1 -0
- package/assets/MyAssets-CrobB3dP.js +1 -0
- package/assets/{MyFavorites-la-Ipzze.js → MyFavorites-LznRvK5N.js} +1 -1
- package/assets/{MyPurchases-uj97bMKy.js → MyPurchases-BM1Uxpk1.js} +1 -1
- package/assets/{RealCheckout-WGIqivb-.js → RealCheckout-DbSQfCUZ.js} +1 -1
- package/assets/{Success-9nbA6ARC.js → Success-CkhrWNlU.js} +1 -1
- package/assets/{SvgIcon-B-RYlk9D.js → SvgIcon-o9nhGFxM.js} +1 -1
- package/assets/{SwapController-DvqrkWqb.js → SwapController-C1nqmWnS.js} +1 -1
- package/assets/{TradeService-bh07C9CQ.js → TradeService-BOr6_BxE.js} +1 -1
- package/assets/{W3MFrameProviderSingleton-BcBo86qj.js → W3MFrameProviderSingleton-Drovl6ew.js} +3 -3
- package/assets/{WebCryptoP256-C22djMF_.js → WebCryptoP256-C468KsvN.js} +1 -1
- package/assets/{basic-CvkQ4eMW.js → basic-CfT3tKSs.js} +1 -1
- package/assets/{biconomy-BYF4CuCg.js → biconomy-BRQR4sBp.js} +1 -1
- package/assets/{buy-BhUIEcOv.js → buy-C-Rj-xp5.js} +1 -1
- package/assets/{buy-gasless-Sp2nbDeH.js → buy-gasless-BmoACMRr.js} +1 -1
- package/assets/{ccip-CIC3drWp.js → ccip-0BllB1E2.js} +1 -1
- package/assets/{ccip-DQo0NqSR.js → ccip-c6S7TqyR.js} +1 -1
- package/assets/{collection-CYeLN-mn.js → collection-WeXeyjAn.js} +1 -1
- package/assets/{controller-DTGxZ8xF.js → controller-dlBlTbYB.js} +2 -2
- package/assets/{core-ByXkyoai.js → core-Bl_sLfyx.js} +4 -4
- package/assets/{custom-uyVA1bVr.js → custom-CNFVifWV.js} +1 -1
- package/assets/{data-capture-C7YYyGFW.js → data-capture-SDMekFnt.js} +1 -1
- package/assets/{decimals-CoCCzTJB.js → decimals-CSVlCZb3.js} +1 -1
- package/assets/decimals-DoXdKj3t.js +1 -0
- package/assets/{detectExtension-CX-wCFtq.js → detectExtension-CGFTREd-.js} +1 -1
- package/assets/{email-D0SaZ2E-.js → email-CYnr2jcE.js} +1 -1
- package/assets/{embedded-wallet-BwoVxbVF.js → embedded-wallet-W7SWJ6st.js} +1 -1
- package/assets/{engine-CA8Qop3l.js → engine-UOkAfyVN.js} +1 -1
- package/assets/{estimate-l1-fee-DZkH0sUH.js → estimate-l1-fee-D_bpSDla.js} +1 -1
- package/assets/{eth_estimateGas-pj61ZTal.js → eth_estimateGas-CtUEH79c.js} +1 -1
- package/assets/{eth_getStorageAt-hW8hecJw.js → eth_getStorageAt-D3dzlnBk.js} +1 -1
- package/assets/{eth_getTransactionCount-CgTYkq09.js → eth_getTransactionCount-n2pPwlEw.js} +1 -1
- package/assets/{extractIPFS-BAo6dLmM.js → extractIPFS-DGHj61b1.js} +1 -1
- package/assets/{features-DRtFoDzt.js → features-DENKVFit.js} +1 -1
- package/assets/{fetchTokenMetadata-DvUQSd7A.js → fetchTokenMetadata-D85asFLD.js} +2 -2
- package/assets/{generateUtilityClasses-BZqFSfTv.js → generateUtilityClasses-DXz6v4wN.js} +1 -1
- package/assets/{get-ecosystem-wallet-info-DSu1SiXe.js → get-ecosystem-wallet-info-D5g78AMe.js} +1 -1
- package/assets/{getBalance-CadpLxBV.js → getBalance-D2EO4aBF.js} +1 -1
- package/assets/{getInstalledModules-W1h7kV7_.js → getInstalledModules-D4PNkmVO.js} +1 -1
- package/assets/{getNFT-BVVLfQbq.js → getNFT-BESsQ4oH.js} +1 -1
- package/assets/{getNFT-Dz57g64e.js → getNFT-Ddh7bEJQ.js} +2 -2
- package/assets/{hashTypedData-nw2pcANT.js → hashTypedData-Bx3nzvk8.js} +1 -1
- package/assets/{hashTypedData-QpseW5gc.js → hashTypedData-C9QOz9pr.js} +1 -1
- package/assets/{import-Dkeo-TN0.js → import-CDNhzcDz.js} +1 -1
- package/assets/{in-app-wallet-calls-4eFCdDZh.js → in-app-wallet-calls-Df158hbr.js} +1 -1
- package/assets/{index-DgmIAh0P.js → index-3SuxDGIz.js} +1 -1
- package/assets/{index-Dfkt19BE.js → index-63GX_n07.js} +2 -2
- package/assets/{index-y7nKWZtu.js → index-75Ps2rGt.js} +3 -3
- package/assets/{index-yGcwaBGX.js → index-B3m29cNt.js} +1 -1
- package/assets/{index-B1S_9aHy.js → index-B4VK7VPX.js} +1 -1
- package/assets/{index-BLLxusx7.js → index-BC7-fNQN.js} +1 -1
- package/assets/{index-BxjGkOuB.js → index-BEqhzSDF.js} +1 -1
- package/assets/{index-CK9n2Soe.js → index-BGGbU05t.js} +1 -1
- package/assets/{index-DzF5BR5O.js → index-BQWuxKdW.js} +1 -1
- package/assets/{index-B2XvcdGV.js → index-BUE1aXpM.js} +1 -1
- package/assets/{index-9Psy23oc.js → index-BkFksbUM.js} +1 -1
- package/assets/{index-DUnR57bW.js → index-BpRV6pU7.js} +1 -1
- package/assets/{index-D8aVYz6b.js → index-BqV4-5lu.js} +2 -2
- package/assets/{index-DEHAgwh3.js → index-BwMgLDly.js} +1 -1
- package/assets/{index-DDfYFIH_.js → index-C13awi5n.js} +30 -30
- package/assets/{index-CL4WxYGH.js → index-C631qzTG.js} +1 -1
- package/assets/{index-obSnm-Ia.js → index-C6ImpJyG.js} +1 -1
- package/assets/{index-6cNDeqeF.js → index-CBLO6USL.js} +1 -1
- package/assets/{index-YkoyBH8H.js → index-CIxFIqFU.js} +1 -1
- package/assets/index-CVEOS5BF.css +1 -0
- package/assets/{index-ZfDbe-6V.js → index-CfLoF7Qe.js} +1 -1
- package/assets/{index-eC1YpRrY.js → index-Cre0gJrZ.js} +1 -1
- package/assets/{index-CAj_rMw8.js → index-CvVHPcFb.js} +1 -1
- package/assets/{index-D3AFvgbm.js → index-D6h-NdP-.js} +1 -1
- package/assets/{index-DK8o_-MU.js → index-D7_2_7YY.js} +1 -1
- package/assets/{index-HFnpFwSe.js → index-DBg2eXPN.js} +1 -1
- package/assets/{index-Cw-pbvCZ.js → index-DFJRGUDh.js} +1 -1
- package/assets/{index-DXtGvB98.js → index-DFrHyvod.js} +1 -1
- package/assets/{index-CCdZbTTX.js → index-DSxKsQSh.js} +1 -1
- package/assets/{index-CxoVorCo.js → index-DUOCGq8U.js} +1 -1
- package/assets/{index-BJ1ioTkZ.js → index-DYf2mXDi.js} +1 -1
- package/assets/{index-CvsStUct.js → index-DaBA0yRd.js} +1 -1
- package/assets/{index-BtHC7Fa4.js → index-DdlK5WYO.js} +1 -1
- package/assets/{index-YieljOW_.js → index-Dk9zDQwk.js} +1 -1
- package/assets/{index-UoCQV6ME.js → index-DoTsdAEj.js} +1 -1
- package/assets/{index-gKTQuTml.js → index-K4m_AYVk.js} +3 -3
- package/assets/{index-CW4-nT2C.js → index-LSdKGFoq.js} +1 -1
- package/assets/{index-qITppT9o.js → index-TLgW5WZT.js} +1 -1
- package/assets/{index-DsTotSHt.js → index-VSv5weX8.js} +1 -1
- package/assets/{index-KYw0-IT6.js → index-WQHztqda.js} +1 -1
- package/assets/{index-CfFVh2eL.js → index-boWBUFDv.js} +1 -1
- package/assets/{index-W0uLoFxp.js → index-bwiQJCJg.js} +1 -1
- package/assets/{index-Bpsad0fL.js → index-kSZb6Dua.js} +1 -1
- package/assets/{index-B7BzjWLu.js → index-kV1vUp3Z.js} +1 -1
- package/assets/{index-BktYjWX5.js → index-m4zZXBld.js} +1 -1
- package/assets/{index-B79ABZ__.js → index-p2GbBPES.js} +1 -1
- package/assets/{index-DQQ8vcKb.js → index-soJZoLvF.js} +1 -1
- package/assets/{index-lxqXQ6kn.js → index-u6DTe7Nz.js} +1 -1
- package/assets/{index-Cg0zF20H.js → index-wj8CVNfJ.js} +1 -1
- package/assets/{index-CdP0lCdS.js → index-yPxvUW6S.js} +1 -1
- package/assets/{index-CbjBeTe9.js → index-ykRzQjuZ.js} +2 -2
- package/assets/{index-D4sCSl3v.js → index-z01aMwFk.js} +1 -1
- package/assets/{index.es-m3ocg06j.js → index.es-BRKHDF5O.js} +1 -1
- package/assets/{index.es-BafpZUkY.js → index.es-C0c_PfHy.js} +1 -1
- package/assets/{index.es-fIa_oqRK.js → index.es-CO_XF63k.js} +4 -4
- package/assets/{localBatchGatewayRequest-CtkYeZDu.js → localBatchGatewayRequest-Coptu8fQ.js} +1 -1
- package/assets/{mana-rate-BmNr7NQv.js → mana-rate-RN1C71HA.js} +1 -1
- package/assets/network-DRh88abw.js +1 -0
- package/assets/{networks-_eWeMDsj.js → networks-Dk1wsaJ8.js} +1 -1
- package/assets/{onramp-CGWmiF1J.js → onramp-8Ursi6WH.js} +1 -1
- package/assets/{openzeppelin--5btda16.js → openzeppelin-DoezFh1a.js} +1 -1
- package/assets/{ownerOf-DWiVCMYI.js → ownerOf-Be35NH6y.js} +1 -1
- package/assets/{parseNft-DXOsgcMp.js → parseNft-B8RddWyu.js} +2 -2
- package/assets/{parseSignature-Ycmpy2nX.js → parseSignature-B9N92FV1.js} +3 -3
- package/assets/{parseSignature-Y0VTeji3.js → parseSignature-BCXOdvDq.js} +1 -1
- package/assets/{pay-with-exchange-DmX53QwM.js → pay-with-exchange-CLsRdRnD.js} +1 -1
- package/assets/{qr-overlay-CQHeB4ei.js → qr-overlay-CfKat5Nj.js} +1 -1
- package/assets/{receive-B6FzlvkF.js → receive-Bpba7exF.js} +1 -1
- package/assets/{resolveImplementation-D5Mrnxoa.js → resolveImplementation-COEuR_c6.js} +1 -1
- package/assets/{rpc-DSGD_uZq.js → rpc-CA14ywXy.js} +1 -1
- package/assets/{secp256k1-B2i0Wftc.js → secp256k1-BYTveHSI.js} +1 -1
- package/assets/{secp256k1-6tsRQRAJ.js → secp256k1-BxNXIPx_.js} +1 -1
- package/assets/{secp256k1-eid5ygXp.js → secp256k1-VCKU6ZbV.js} +1 -1
- package/assets/{send-D9ZyDxbV.js → send-CKEWBVZR.js} +1 -1
- package/assets/{send-batch-transaction-Dz6a059B.js → send-batch-transaction-kRaDbHFW.js} +1 -1
- package/assets/{send-eip712-transaction-Bhe_ladj.js → send-eip712-transaction-BdAsbdUC.js} +2 -2
- package/assets/{send-gasless-transaction-_2XH2Eaa.js → send-gasless-transaction-umbide8L.js} +2 -2
- package/assets/{sendRawTransaction-DYmEcH56.js → sendRawTransaction-9yflHgsx.js} +3 -3
- package/assets/{serializeTransaction-Do4PXTSN.js → serializeTransaction-Cl_9QLOo.js} +1 -1
- package/assets/{session-proposal-DWcvrF7V.js → session-proposal-CAuTXnKi.js} +1 -1
- package/assets/{session-request-C6sAlwA7.js → session-request-CuMQl9E8.js} +2 -2
- package/assets/{sha256-Dd8TUFpB.js → sha256-4KqSLEWF.js} +1 -1
- package/assets/{signing-D1s1fFYk.js → signing-CHdT_Ot8.js} +4 -4
- package/assets/{socials-Crmkp42G.js → socials-9xnPXlWI.js} +1 -1
- package/assets/{swaps-B4Zg1wD0.js → swaps-DJp-RCo5.js} +1 -1
- package/assets/{thirdweb-BYOg3U-4.js → thirdweb-T9OwwIQ6.js} +3 -3
- package/assets/{totalSupply-DYQLqcrO.js → totalSupply-D_X-_ZDw.js} +1 -1
- package/assets/{transactionReceipt-BMFv-CWc.js → transactionReceipt-BTJ1sQrj.js} +1 -1
- package/assets/{transactions-Bue4De3k.js → transactions-C6sC5BaM.js} +1 -1
- package/assets/{useInfiniteGrid-BljM6dNq.js → useInfiniteGrid-et3T-1IY.js} +1 -1
- package/assets/{verifyHash-CgPvy4KQ.js → verifyHash-CudNiAgH.js} +1 -1
- package/assets/{w3m-modal-jHCkWizs.js → w3m-modal-BxYBckMB.js} +1 -1
- package/assets/{w3m-modal-mwXP0RL3.js → w3m-modal-DIuoUtJk.js} +1 -1
- package/assets/{wait-for-tx-receipt-Cn4cARlz.js → wait-for-tx-receipt-CygP4VsC.js} +1 -1
- package/assets/{wallet-kind-DWVcMRCP.js → wallet-kind-BTWNHcc9.js} +1 -1
- package/assets/{wallets-jS_FUEQm.js → wallets-CsiIl2HG.js} +6 -6
- package/assets/{web-connector-CAH6CXlP.js → web-connector-BkMDTCh_.js} +3 -3
- package/assets/{writeContract-CSKFgtPF.js → writeContract-C8FPneHs.js} +1 -1
- package/assets/{zoraTestnet-CrygtBAa.js → zoraTestnet-CQZ9NUll.js} +1 -1
- package/index.html +8 -8
- package/package.json +2 -2
- package/assets/Cart-C52mFfKE.js +0 -1
- package/assets/ItemDetail-QsZRIBMD.js +0 -1
- package/assets/Market-DjUM6Tjh.js +0 -1
- package/assets/MyAssets--T3O0ufz.js +0 -1
- package/assets/decimals-DLIjm7Tv.js +0 -1
- package/assets/index-pYCoYNtI.css +0 -1
- package/assets/network-QMhAzF3Y.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as K,r as i,j as e}from"./react-E8ng6RF2.js";import{t as M,C as Q,A as V,f as X}from"./index-
|
|
1
|
+
import{u as K,r as i,j as e}from"./react-E8ng6RF2.js";import{t as M,C as Q,A as V,f as X}from"./index-C13awi5n.js";import{S as F}from"./SkeletonCards-yV2mi4oc.js";import{L as ee}from"./LoadMore-DB6TwvRe.js";import{u as se}from"./useInfiniteGrid-et3T-1IY.js";import"./ethers-DbXGgxrh.js";const re=48,k=[{key:"wearable",label:"Wearables",sub:["Head","Upper Body","Handwear","Lower Body","Feet","Accessories","Skins"]},{key:"emote",label:"Emotes",sub:[]},{key:"ens",label:"Names",sub:[]},{key:"parcel",label:"Lands",sub:[]}],ie={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"]},te=["common","uncommon","rare","epic","legendary","mythic","unique","exotic"],f=[{key:"newest",label:"Newest",server:"newest"},{key:"price-asc",label:"Price: Low to High",server:"cheapest"},{key:"price-desc",label:"Price: High to Low",server:"most_expensive"},{key:"name",label:"Name (A–Z)",server:"name"}];function de(){const[B]=K(),l=(B.get("q")??"").trim().toLowerCase(),[n,C]=i.useState("wearable"),[r,x]=i.useState(null),[t,S]=i.useState([]),[m,w]=i.useState(""),[p,$]=i.useState(""),[u,H]=i.useState("newest"),[a,d]=i.useState(null),h=m&&!Number.isNaN(Number(m))?Number(m):void 0,b=p&&!Number.isNaN(Number(p))?Number(p):void 0,I=r?ie[r]:void 0,q=(f.find(s=>s.key===u)??f[0]).server,A={category:n,rarities:t.length?t:void 0,wearableCategories:I,minPriceCredits:h,maxPriceCredits:b,search:l||void 0,sortBy:q},{items:P,total:y,isLoading:c,error:L,hasNextPage:O,isFetchingNextPage:R,fetchNextPage:T}=se(["listings",A],s=>X({...A,first:re,skip:s})),N=y,E=i.useRef(null);i.useEffect(()=>{c||!l||E.current===l||(E.current=l,M("Shop Searched",{query:l,result_count:N}))},[l,c,N]);const g=i.useRef("__init__");i.useEffect(()=>{if(c)return;const s=JSON.stringify({category:n,subCategory:r,rarities:t,min:h,max:b,sort:u});if(g.current==="__init__"||g.current===s){g.current=s;return}g.current=s,M("Shop Applied Filter",{filters:{category:n,sub_category:r,rarities:t,min_price_credits:h??null,max_price_credits:b??null,sort:u},result_count:N})},[n,r,t,h,b,u,c,N]);function U(s){C(s),x(null)}function G(s){S(o=>o.includes(s)?o.filter(D=>D!==s):[...o,s])}function Z(){C("wearable"),x(null),S([]),w(""),$(""),d(null)}function j(s){d(o=>o===s?null:s)}const J=f.find(s=>s.key===u)??f[0],_=k.find(s=>s.key===n)??k[0],W=r?`${_.label} · ${r}`:_.label,v=!!(h||b),Y=v?`${m||"0"}–${p||"∞"}`:"Price",z=n!=="wearable"||!!r||t.length>0||v;return e.jsxs("div",{className:"browse",children:[a?e.jsx("div",{className:"filterbar__scrim",onClick:()=>d(null),"aria-hidden":!0}):null,e.jsxs("div",{className:"filterbar",children:[e.jsxs("div",{className:"filterbar__filters",children:[e.jsxs("div",{className:"filterbar__item",children:[e.jsxs("button",{className:`filterbar__trigger${a==="section"?" is-open":""}${r||n!=="wearable"?" is-active":""}`,onClick:()=>j("section"),children:[W," ",e.jsx("span",{className:"filterbar__chev","aria-hidden":!0,children:"▾"})]}),a==="section"?e.jsxs("div",{className:"filter-pop filter-pop--section",children:[e.jsx("ul",{className:"filter-pop__cats",children:k.map(s=>e.jsx("li",{children:e.jsx("button",{className:`filter-pop__cat${n===s.key?" is-active":""}`,onClick:()=>U(s.key),children:s.label})},s.key))}),_.sub.length?e.jsxs("ul",{className:"filter-pop__subs",children:[e.jsx("li",{children:e.jsxs("button",{className:`filter-pop__sub${r?"":" is-active"}`,onClick:()=>{x(null),d(null)},children:["All ",_.label]})}),_.sub.map(s=>e.jsx("li",{children:e.jsx("button",{className:`filter-pop__sub${r===s?" is-active":""}`,onClick:()=>{x(o=>o===s?null:s),d(null)},children:s})},s))]}):null]}):null]}),e.jsxs("div",{className:"filterbar__item",children:[e.jsxs("button",{className:`filterbar__trigger${a==="rarity"?" is-open":""}${t.length?" is-active":""}`,onClick:()=>j("rarity"),children:["Rarity ",t.length?e.jsx("span",{className:"filterbar__badge",children:t.length}):null," ",e.jsx("span",{className:"filterbar__chev","aria-hidden":!0,children:"▾"})]}),a==="rarity"?e.jsx("div",{className:"filter-pop filter-pop--rarity",children:te.map(s=>e.jsxs("label",{className:"filter-pop__check",children:[e.jsx("input",{type:"checkbox",checked:t.includes(s),onChange:()=>G(s)}),e.jsx("span",{children:s})]},s))}):null]}),e.jsxs("div",{className:"filterbar__item",children:[e.jsxs("button",{className:`filterbar__trigger${a==="price"?" is-open":""}${v?" is-active":""}`,onClick:()=>j("price"),children:[Y," ",e.jsx("span",{className:"filterbar__chev","aria-hidden":!0,children:"▾"})]}),a==="price"?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:m,onChange:s=>w(s.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":"Maximum price",placeholder:"Max",value:p,onChange:s=>$(s.target.value)})]}),e.jsxs("p",{className:"filter-pop__hint",children:["Price in ",Q.name]})]}):null]}),z?e.jsx("button",{className:"filterbar__clear",onClick:Z,children:"Clear all"}):null]}),e.jsxs("div",{className:"filterbar__right",children:[e.jsxs("span",{className:"filterbar__count",children:[c?"…":`${y.toLocaleString()} item${y===1?"":"s"}`,l?` for “${l}”`:""]}),e.jsxs("div",{className:"filterbar__item",children:[e.jsxs("button",{className:`filterbar__sort${a==="sort"?" is-open":""}`,onClick:()=>j("sort"),children:["Sort by: ",J.label," ",e.jsx("span",{className:"filterbar__chev","aria-hidden":!0,children:"▾"})]}),a==="sort"?e.jsx("div",{className:"filter-pop filter-pop--sort",children:f.map(s=>e.jsx("button",{className:`filter-pop__sort${s.key===u?" is-active":""}`,onClick:()=>{H(s.key),d(null)},children:s.label},s.key))}):null]})]})]}),L?e.jsx("p",{className:"error",children:L.message}):null,e.jsx("div",{className:"grid",children:c?e.jsx(F,{count:15}):e.jsxs(e.Fragment,{children:[P.map(s=>e.jsx(V,{item:s},s.id)),R?e.jsx(F,{count:6}):null]})}),e.jsx(ee,{hasNextPage:O,isFetching:R,onLoadMore:()=>T()}),!c&&P.length===0?e.jsx("p",{className:"muted",children:"No items match your filters."}):null]})}export{de as Assets};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as W,r as g,j as e,L as T}from"./react-E8ng6RF2.js";import{k as _,c as $,e as A,l as K,m as O,a as M,g as j,C as Y,A as H,t as v,n as F,i as V,o as D,q as J,r as X,s as Z,v as I,w as P,x as ee,y as se,z as ae,f as te}from"./index-C13awi5n.js";import{f as q}from"./buy-C-Rj-xp5.js";import{g as re,b as ce,w as ie,G as ne}from"./buy-gasless-BmoACMRr.js";import"./ethers-DbXGgxrh.js";import"./index-kV1vUp3Z.js";function le(a){const o=a,i=(o.message??"").toLowerCase();return o.code===4001||i.includes("reject")||i.includes("denied")||i.includes("cancel")?"You cancelled the request.":i.includes("insufficient")?`You don't have enough ${Y.name} — get more first.`:i.includes("no active listing")||i.includes("your own listing")?o.message:"Couldn't complete checkout — please try again."}function oe(a){return ae(a.received[0].amount)}function ye(){const a=_(s=>s.items),o=_(s=>s.remove),i=_(s=>s.clear),z=_(s=>s.setFittingOpen),{session:t}=$(),R=a.some(s=>s.category!=="emote"),{data:y}=A({queryKey:["upsell-listings"],queryFn:()=>te({first:40}),staleTime:6e4}),{data:l}=K(t),N=O(),U=W(),[b,m]=g.useState(null),[C,f]=g.useState(null),[h,w]=g.useState(!1),d=a.reduce((s,u)=>s+u.priceCredits,0),G=new Set(a.map(s=>s.id)),k=((y==null?void 0:y.items)??[]).filter(s=>!G.has(s.id)).slice(0,6);async function B(){if(!t){f("Sign in to check out.");return}f(null),w(!0),v("Shop Started Checkout",{cart_size:a.length,cart_value_credits:d,cart_value_usd:F(d),has_sufficient_credits:((l==null?void 0:l.credits)??0)>=d});const s=a.slice(),u=[];let x="authorize",S=!1;try{m("Preparing your order…");const c=[];for(const r of a){const p=r.tradeId?await V(r.tradeId):await D(r.contractAddress,r.itemId??"");if(!p)throw new Error(`No active listing for ${r.name}.`);if(J(p,t.address))throw new Error(`You can't buy your own listing: ${r.name}.`);const L=oe(p),{credit:E,maxCreditedValue:Q}=await X(t.identity,L,r.tradeId);u.push(E.id),c.push({trade:p,credits:[E],maxCreditedValue:Q})}m("Confirming your purchase…"),x="submit";let n=[];if(re())try{n=await ce({purchases:c,buyer:t.address,signer:t.signer}),await Promise.all(n.map(r=>ie(r))),S=!0}catch(r){if(!(r instanceof ne))throw r;n=await q({purchases:c,buyer:t.address,signer:t.signer})}else n=await q({purchases:c,buyer:t.address,signer:t.signer});i(),m("Purchased! 🎉"),v("Shop Completed Purchase",{...Z(s),payment_type:"credits",no_crypto_step:S,transaction_hash:n[0]??null}),N.invalidateQueries({queryKey:["usd-balance"]}),U("/success",{state:{items:s,txHash:n[0]}})}catch(c){if(I(c)||P(c,{flow:"cart_checkout",step:x,cart_size:a.length}),v(I(c)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:x,error_code:ee(c),value_usd:F(d),cart_size:a.length}),u.length){try{await se(t.identity,u)}catch(n){P(n,{flow:"cart_checkout",step:"release"})}N.invalidateQueries({queryKey:["usd-balance"]})}f(le(c)),m(null)}finally{w(!1)}}return a.length===0?e.jsxs("div",{className:"cart cart--empty",children:[e.jsx("span",{className:"ico ico-cart cart-empty__ico","aria-hidden":!0}),e.jsx("p",{className:"cart-empty__title",children:"Your cart is empty"}),e.jsx("p",{className:"muted",children:"Find something you love and it’ll show up here."}),e.jsx(T,{className:"btn btn--purple",to:"/assets",children:"Browse Collectibles"})]}):e.jsxs("div",{className:"cart",children:[e.jsxs("h1",{children:["Cart (",a.length,")"]}),e.jsx("div",{className:"cart__list",children:a.map(s=>e.jsxs("div",{className:"cart__row",children:[e.jsx("div",{className:"cart__thumb",children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null}),e.jsxs("div",{className:"cart__info",children:[e.jsx("div",{className:"cart__name",children:s.name}),s.creator?e.jsx(M,{address:s.creator,className:"cart__creator",linkToProfile:!0}):null]}),e.jsxs("div",{className:"cart__price",children:[e.jsx(j,{className:"ccy-mark"})," ",s.priceCredits]}),e.jsx("button",{className:"cart__remove",onClick:()=>o(s.id),disabled:h,"aria-label":`Remove ${s.name}`,title:"Remove",children:e.jsx("span",{className:"ico ico-trash","aria-hidden":!0})})]},s.id))}),e.jsxs("div",{className:"cart__foot",children:[e.jsxs("div",{className:"cart__total",children:[e.jsxs("div",{className:"cart__total-line",children:["Total ",e.jsxs("strong",{children:[e.jsx(j,{className:"ccy-mark"})," ",d]})]}),t?e.jsxs("div",{className:"muted cart__balance",children:["Your balance: ",e.jsx(j,{className:"ccy-mark"})," ",(l==null?void 0:l.credits)??0]}):null]}),e.jsxs("div",{className:"cart__actions",children:[R?e.jsx("button",{className:"btn btn--ghost",onClick:()=>z(!0),disabled:h,children:"Try on outfit"}):null,e.jsxs(T,{className:"btn btn--ghost",to:"/credits",children:["Get ",Y.name]}),e.jsx("button",{className:"btn btn--purple cart__checkout",onClick:B,disabled:h,children:"Checkout"})]})]}),e.jsxs("div",{className:"cart__utils",children:[e.jsx("button",{className:"link",onClick:i,disabled:h,children:"Clear cart"}),null]}),b?e.jsx("p",{className:"muted",style:{marginTop:12},children:b}):null,C?e.jsx("p",{className:"error",style:{marginTop:12},children:C}):null,k.length>0?e.jsxs("section",{className:"row cart-upsell",children:[e.jsx("div",{className:"row__head",children:e.jsx("h2",{className:"row__title",children:"You might also like"})}),e.jsx("div",{className:"row__track",children:k.map(s=>e.jsx(H,{item:s},s.id))})]}):null]})}export{ye 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-DXz6v4wN.js";import{r as F,j as g}from"./react-E8ng6RF2.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
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as g,b as h,j as e}from"./react-E8ng6RF2.js";import{a as x,A as j,b as _}from"./index-
|
|
1
|
+
import{a as g,b as h,j as e}from"./react-E8ng6RF2.js";import{a as x,A as j,b as _}from"./index-C13awi5n.js";import{A as N}from"./collection-WeXeyjAn.js";import{S as m}from"./SkeletonCards-yV2mi4oc.js";import{L as f}from"./LoadMore-DB6TwvRe.js";import{u as b}from"./useInfiniteGrid-et3T-1IY.js";import"./ethers-DbXGgxrh.js";const C=48;function F(){var i;const{contractAddress:o}=g(),d=h(),{items:s,total:t,isLoading:a,error:c,hasNextPage:p,isFetchingNextPage:n,fetchNextPage:u}=b(["collection-page",o],l=>_(o,{first:C,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?"…":`${t.toLocaleString()} item${t===1?"":"s"}`})]}),!a&&s.length>0?e.jsx(N,{items:s,source:"collection"}):null,c?e.jsx("p",{className:"error",children:c.message}):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:p,isFetching:n,onLoadMore:()=>u()}),!a&&!c&&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,a as g,b as p}from"./react-E8ng6RF2.js";import{
|
|
1
|
+
import{j as e,a as g,b as p}from"./react-E8ng6RF2.js";import{F as i,a as h,A as x,G as j}from"./index-C13awi5n.js";import{A as f}from"./collection-WeXeyjAn.js";import{S as m}from"./SkeletonCards-yV2mi4oc.js";import{L as b}from"./LoadMore-DB6TwvRe.js";import{u as N}from"./useInfiniteGrid-et3T-1IY.js";import"./ethers-DbXGgxrh.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}=N(["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:n.message}):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(b,{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-Drovl6ew.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-K4m_AYVk.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RealCheckout-
|
|
2
|
-
import{
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RealCheckout-DbSQfCUZ.js","assets/react-E8ng6RF2.js","assets/index-C13awi5n.js","assets/ethers-DbXGgxrh.js","assets/index-CVEOS5BF.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{P,j as y,R as O,c as V,m as F,t as _,w as v,x as S,C as u,g as N,J as $,_ as Y}from"./index-C13awi5n.js";import{b as z,r as l,j as e}from"./react-E8ng6RF2.js";import{C}from"./CircularProgress-B0lRHBCP.js";import"./ethers-DbXGgxrh.js";import"./generateUtilityClasses-DXz6v4wN.js";function R(){return y.shopServerUrl||y.creditsServerUrl}async function K(s,t){const r=await P(`${R()}/credits/checkout`,{method:"POST",identity:t,metadata:{},headers:{"Content-Type":"application/json"},body:JSON.stringify({packId:s})});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(s,t,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(s,t,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(s,t,r){const a=await P(`${R()}/credits/orders/${s}`,{method:"GET",identity:t,metadata:{},signal:r});if(!a.ok)throw new Error(`order status ${a.status}`);return a.json()}function J(s,t){return new Promise((r,a)=>{const n=setTimeout(r,s);t==null||t.addEventListener("abort",()=>{clearTimeout(n),a(new DOMException("Aborted","AbortError"))})})}const Q=.1,G=[{id:"pack_5",usd:5,credits:f(5)},{id:"pack_10",usd:10,credits:f(10)},{id:"pack_25",usd:25,credits:f(25),bestValue:!0},{id:"pack_50",usd:50,credits:f(50)}];function f(s){return Math.round(s/Q)}function T(s){return G.find(t=>t.id===s)}const x="mock_cs_";function M(){return!y.stripePublishableKey||!y.shopServerUrl}async function W(s,t){const r=T(s);if(!r)throw new Error("Unknown pack");if(M())return H(r);if(!(t!=null&&t.identity))throw new Error("Sign in to get credits.");return K(s,t.identity)}async function X(s,t={}){const{intervalMs:r,timeoutMs:a,signal:n,identity:i}=t;if(s.startsWith(x)||M())return Z(s,t);if(!i)throw new Error("Sign in to get credits.");return L(s,i,{intervalMs:r,timeoutMs:a,signal:n})}function H(s){const t=`${x}${s.id}_${Date.now()}`;return D(400).then(()=>({orderId:t,clientSecret:`${x}${s.id}`,mock:!0}))}async function Z(s,t={}){await D(t.intervalMs??900);const r=s.replace(x,"").replace(/_\d+$/,""),a=T(r),n=(a==null?void 0:a.credits)??0;if(t.address&&a)try{const i=await O(t.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(s,t){return new Promise((r,a)=>{setTimeout(r,s)})}const b=y.shopServerUrl?"stripe":"mock",ee=l.lazy(()=>Y(()=>import("./RealCheckout-DbSQfCUZ.js"),__vite__mapDeps([0,1,2,3,4])));function E(s){const t=s;if((t==null?void 0:t.name)==="AbortError")return"You cancelled the request.";const r=((t==null?void 0:t.message)??"").toLowerCase();return r.includes("sign in")?`Sign in to get ${u.name}.`:r.includes("timed out")?`This is taking longer than usual — your ${u.name} will appear shortly.`:"Couldn't complete your purchase — please try again."}function de(){const s=z(),{session:t,signIn:r}=V(),a=F(),[n,i]=l.useState("select"),[c,m]=l.useState(null),[p,k]=l.useState(null),[I,w]=l.useState(null),[A,h]=l.useState(null),j=l.useRef(null);l.useEffect(()=>()=>{var o;return(o=j.current)==null?void 0:o.abort()},[]);const B=l.useCallback(async o=>{if(!t){r();return}h(null),m(o),i("paying"),_("Shop Started Buy Credits",{pack_usd:o.usd,credits:o.credits,provider:b});try{const d=await W(o.id,{address:t.address,identity:t.identity});k(d)}catch(d){v(d,{flow:"get_credits",step:"checkout",provider:b}),_("Shop Buy Credits Failed",{step:"checkout",error_code:S(d),pack_usd:o.usd}),h(E(d)),i("error")}},[t,r]),U=l.useCallback(async()=>{if(!p)return;i("processing");const o=new AbortController;j.current=o;try{const d=await X(p.orderId,{signal:o.signal,address:t==null?void 0:t.address,identity:t==null?void 0:t.identity});d.status==="credited"?(w(d.creditsGranted??(c==null?void 0:c.credits)??0),i("success"),_("Shop Completed Buy Credits",{order_id:p.orderId,pack_usd:(c==null?void 0:c.usd)??null,credits:d.creditsGranted??(c==null?void 0:c.credits)??0,provider:b}),a.invalidateQueries({queryKey:["usd-balance"]})):(_("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(c==null?void 0:c.usd)??null}),h(d.error??`Couldn't add your ${u.name} — please try again.`),i("error"))}catch(d){v(d,{flow:"get_credits",step:"grant",order_id:p.orderId}),_("Shop Buy Credits Failed",{step:"grant",error_code:S(d),pack_usd:(c==null?void 0:c.usd)??null}),h(E(d)),i("error")}},[p,c,t,a]);function g(){var o;(o=j.current)==null||o.abort(),i("select"),m(null),k(null),w(null),h(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."]})]}),n==="select"&&e.jsx(te,{onSelect:B}),n==="paying"&&c&&e.jsx(se,{pack:c,checkout:p,onPaid:U,onCancel:g}),n==="processing"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(C,{size:40}),e.jsxs("p",{className:"getcredits__status-title",children:["Adding your ",u.name,"…"]}),e.jsx("p",{className:"muted",children:"Payment received. Just a moment while we top up your balance."})]}),n==="success"&&e.jsxs("div",{className:"getcredits__status getcredits__status--ok",role:"status","aria-live":"polite",children:[e.jsx("div",{className:"getcredits__confetti","aria-hidden":!0,children:"🎉"}),e.jsx("p",{className:"getcredits__status-title",children:"You’re all set!"}),e.jsxs("p",{className:"muted",children:[e.jsxs("strong",{children:[e.jsx(N,{className:"ccy-mark"})," ",I]})," ",u.name," added to your account."]}),e.jsxs("div",{className:"getcredits__status-actions",children:[e.jsx("button",{className:"btn",onClick:()=>s("/cart"),children:"Back to cart"}),e.jsxs("button",{className:"btn btn--ghost",onClick:g,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:g,children:"Try again"})})]})]})}function te({onSelect:s}){return e.jsx("div",{className:"packs",children:G.map(t=>e.jsxs("button",{type:"button",className:`pack${t.bestValue?" pack--best":""}`,onClick:()=>s(t),"aria-label":`Get ${$(t.credits)} for $${t.usd}`,children:[t.bestValue&&e.jsx("span",{className:"pack__ribbon",children:"Best value"}),e.jsxs("span",{className:"pack__credits",children:[e.jsx(N,{className:"pack__credits-ico"}),t.credits]}),e.jsx("span",{className:"pack__label",children:u.name}),e.jsxs("span",{className:"pack__price",children:["$",t.usd]}),e.jsxs("span",{className:"pack__cta",children:["Get ",u.name]})]},t.id))})}function se({pack:s,checkout:t,onPaid:r,onCancel:a}){return e.jsxs("div",{className:"pay",children:[e.jsxs("div",{className:"pay__summary",children:[e.jsx("button",{className:"link",onClick:a,children:"← Choose a different pack"}),e.jsxs("div",{className:"pay__summary-row",children:[e.jsx("span",{children:"You’ll get"}),e.jsxs("strong",{children:[e.jsx(N,{className:"ccy-mark"})," ",$(s.credits)]})]}),e.jsxs("div",{className:"pay__summary-row pay__summary-row--total",children:[e.jsx("span",{children:"You pay"}),e.jsxs("strong",{children:["$",s.usd]})]})]}),e.jsx("div",{className:"pay__form",children:t?t.mock?e.jsx(re,{onPaid:r,amountUsd:s.usd}):e.jsx(l.Suspense,{fallback:e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(C,{size:32}),e.jsx("p",{className:"muted",children:"Getting the payment form ready…"})]}),children:e.jsx(ee,{clientSecret:t.clientSecret,onComplete:r})}):e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(C,{size:32}),e.jsx("p",{className:"muted",children:"Getting the payment form ready…"})]})})]})}function re({onPaid:s,amountUsd:t}){const[r,a]=l.useState("4242 4242 4242 4242"),[n,i]=l.useState(!1);function c(){i(!0),setTimeout(()=>s(),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 $${t}`})]})}export{de as GetCredits,de as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-
|
|
1
|
+
import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-u6DTe7Nz.js";import{d as g,r as v}from"./index-K4m_AYVk.js";import{C as c}from"./ConstantsUtil-D9t4gp4-.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-Drovl6ew.js";import{au as y}from"./NetworkUtil-CSluj-ND.js";const b=g`
|
|
2
2
|
:host {
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as E,r as d,j as e,L as M}from"./react-E8ng6RF2.js";import{t as Q,
|
|
1
|
+
import{b as E,r as d,j as e,L as M}from"./react-E8ng6RF2.js";import{t as Q,w as A,C,g as v,c as K,m as F,e as P,H as R}from"./index-C13awi5n.js";import{i as Y,f as W}from"./import-CDNhzcDz.js";import{s as O}from"./wallet-kind-BTWNHcc9.js";import"./ethers-DbXGgxrh.js";import"./buy-C-Rj-xp5.js";import"./index-kV1vUp3Z.js";import"./mana-rate-RN1C71HA.js";function B({queue:n,session:k,onClose:j,onDone:u}){const N=E(),l=O(k.providerType),[c,f]=d.useState(()=>n.map(()=>"pending")),[y,w]=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(m=>m.map((p,h)=>h===i?"active":p));try{await Y(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(m=>m.map((p,h)=>h===i?"done":p))}catch(m){const p=m,h=p.code===4001||/reject|denied|cancel/i.test(p.message??"");h||A(m,{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||w("finished")})(),()=>{a=!0}},[]);const o=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:o>0?"You're in the Shop! 🎉":"Nothing listed"}),e.jsxs("p",{className:"muted",style:{margin:0},children:[o>0?`${o} ${o===1?"item is":"items are"} now for sale with ${C.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"}),o>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?"Confirm each item to add it to the Shop.":"Adding 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 quick confirmation pops up for each item. Keep this open.":"This only takes a moment — keep this open."})]})})}const D=[{key:"creations",title:"Your creations",sub:"Items you made. Put them on sale in the Shop."},{key:"owned",title:"Items you own",sub:"Things you've bought elsewhere — resell them in the Shop."}];function 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:()=>W(N),enabled:!!N}),[f,y]=d.useState({}),[w,I]=d.useState(new Set),[o,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=>!w.has(t),a=t=>f[t.oldTradeId]??t.suggestedCredits,i=_.filter(t=>x(t.oldTradeId)),m=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 ",C.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 ",C.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))}):D.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 ${C.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"})," ",m.toLocaleString()]}),e.jsxs("div",{className:"imp-dock__sub",children:[i.length," item",i.length===1?"":"s"," selected · $",(m*.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,")"]})]})}),o&&n?e.jsx(B,{queue:o,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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as e,r as u,a as me,d as he,b as _e,L as fe}from"./react-E8ng6RF2.js";import{c as H,S as pe,W as xe,B as T,j as Z,k as L,g as S,H as je,u as Y,l as ve,e as q,t as M,T as Ne,U as be,V as ye,X as Ie,a as ge,Y as z,Z as Ce,i as we,q as Ae,z as ke,r as Ee,s as Se,v as D,w as Te,y as Le,n as $e,x as Fe,C as Pe,b as Re,$ as Be,o as qe}from"./index-C13awi5n.js";import{h as K}from"./buy-C-Rj-xp5.js";import{g as Me,a as Ue,w as Ve,G as We}from"./buy-gasless-BmoACMRr.js";import"./ethers-DbXGgxrh.js";import"./index-kV1vUp3Z.js";function Ge({item:i}){const c=H(v=>{var N;return(N=v.session)==null?void 0:N.address}),{data:r}=pe(c),m=c&&r?c:"default",f=i.category==="emote";return e.jsx(xe,{id:"shop-item-preview",contractAddress:i.contractAddress,tokenId:i.tokenId??void 0,itemId:i.tokenId?void 0:i.itemId??void 0,profile:m,type:f?void 0:T.PreviewType.AVATAR,emote:f?void 0:T.PreviewEmote.FASHION,disableBackground:!0,wheelZoom:f?1.5:void 0,wheelStart:f?100:void 0,dev:Z.chainId===80002,disableFadeEffect:!0},i.id)}function Oe(i){return i==="male"?"♂":i==="female"?"♀":i==="unisex"?"⚥":""}function Ye({title:i,items:c,activeId:r,onSelect:m,onViewAll:f}){const v=u.useRef(null),N=L(a=>a.add),l=L(a=>a.items.map(d=>d.id));if(c.length===0)return null;function g(a){N(a,"carousel"),je.success(`“${a.name}” added to your cart.`)}function s(a){const d=v.current;d&&d.scrollBy({left:a*Math.round(d.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:i}),e.jsxs("div",{className:"collection-carousel__head-right",children:[f?e.jsx("button",{className:"collection-carousel__viewall",onClick:f,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:v,children:c.map(a=>{const d=Oe(a.gender),b=a.id===r,C=a.priceCredits>0,h=l.includes(a.id);return e.jsxs("article",{className:`collection-carousel__card${b?" is-active":""}`,onClick:()=>m(a),role:"button",tabIndex:0,"aria-current":b||void 0,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),m(a))},children:[e.jsxs("div",{className:"collection-carousel__media",children:[a.thumbnail?e.jsx("img",{className:"collection-carousel__img",src:a.thumbnail,alt:a.name,loading:"lazy"}):null,C?e.jsx("button",{className:"collection-carousel__add",disabled:h,"aria-label":h?"In cart":`Add ${a.name} to cart`,title:h?"In cart":"Add to cart",onClick:x=>{x.stopPropagation(),h||g(a)},children:e.jsx("span",{className:`ico ${h?"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:a.name,children:a.name}),e.jsxs("div",{className:"collection-carousel__meta",children:[C?e.jsxs("span",{className:"collection-carousel__price",children:[e.jsx(S,{className:"collection-carousel__diamond"}),a.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:a.rarity}),d?e.jsx("span",{className:"chip chip--icon",children:d}):null]})]})]})]},a.id)})})]})}function ze(i){return Object.values(T.Rarity).includes(i)}function De(i){return i==="male"?"Male":i==="female"?"Female":i==="unisex"?"Unisex":null}function Ke(i){const c=i,r=(c.message??"").toLowerCase();return c.code===4001||r.includes("reject")||r.includes("denied")||r.includes("cancel")?"You cancelled the request.":r.includes("insufficient")?`You don't have enough ${Pe.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 ss(){const{contractAddress:i,tokenId:c}=me(),{state:r}=he(),m=_e(),f=L(t=>t.add),v=L(t=>t.items),N=Y(t=>t.toggle),{session:l}=H(),{data:g}=ve(l),[s,a]=u.useState(()=>r!=null&&r.item?{...r.item,tradeId:r.tradeId??r.item.tradeId}:{id:`${i}-${c}`,name:"",creator:"",contractAddress:i??"",itemId:null,category:"wearable",rarity:"common",network:"MATIC",chainId:Z.chainId,thumbnail:"",priceCredits:0,gender:null,tokenId:c??void 0,tradeId:r==null?void 0:r.tradeId}),[d,b]=u.useState(!1),[C,h]=u.useState(null),[x,w]=u.useState(null),{data:y=[],isFetched:Q}=q({queryKey:["collection-items",s.contractAddress],enabled:!!s.contractAddress,queryFn:()=>Re(s.contractAddress,{first:20}).then(t=>t.items)}),{data:$,isLoading:X}=q({queryKey:["shop-item",s.contractAddress,c],enabled:!(r!=null&&r.item)&&!!s.contractAddress&&!!c,queryFn:()=>Be(s.contractAddress,c)});u.useEffect(()=>{$&&a(t=>t.tradeId?t:{...$})},[$]),u.useEffect(()=>{if(s.name||y.length===0)return;const t=c&&y.find(n=>n.tokenId===c||n.itemId===c)||y.find(n=>n.contractAddress===s.contractAddress);t&&a(n=>({...t,tradeId:n.tradeId??t.tradeId}))},[y]);const J=u.useMemo(()=>{const t=new Set,n=[];for(const o of y){if(o.id===s.id||s.itemId&&o.itemId===s.itemId||s.tokenId&&o.tokenId===s.tokenId)continue;const E=`${o.contractAddress}-${o.itemId??o.tokenId??o.id}`;t.has(E)||(t.add(E),n.push(o))}return n},[y,s.id,s.itemId,s.tokenId]),{data:ee,isLoading:A}=q({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 t=await qe(s.contractAddress,s.itemId);return(t==null?void 0:t.id)??null}return null}}),j=s.tradeId??ee??void 0,p=!!j,k=u.useMemo(()=>({...s,tradeId:j,id:j??s.id}),[s,j]),F=v.some(t=>t.id===k.id),P=Y(t=>!!t.items[s.id]);u.useEffect(()=>{h(null),w(null)},[s.id]);const U=u.useRef(null);u.useEffect(()=>{!s.name||A||U.current===s.id||(U.current=s.id,M("Shop Viewed Item",{...Ne(s),for_sale:p}),be(s))},[s.id,s.name,A,p]);function se(t){a(t);const n=t.tokenId??t.itemId;t.contractAddress&&n&&m(`/item/${t.contractAddress}/${n}`,{replace:!0,state:{item:t}}),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"})}function te(){!p||F||W||f(k,"item_detail")}async function ae(){var E;if(!p||!j)return;if(!l){w("Sign in to check out.");return}w(null),b(!0);let t,n="authorize",o=!1;try{h(`Buying ${s.name||"item"}…`);const _=await we(j);if(!_)throw new Error("not for sale");if(Ae(_,l.address)){w("You can't buy your own listing."),h(null),b(!1);return}const R=(E=_.received)==null?void 0:E[0],oe=ke(R==null?void 0:R.amount),{credit:G,maxCreditedValue:ue}=await Ee(l.identity,oe,j);t=G.id,n="submit";const B={trade:_,buyer:l.address,signer:l.signer,credits:[G],maxCreditedValue:ue};let I;if(Me())try{I=await Ue(B),await Ve(I),o=!0}catch(O){if(!(O instanceof We))throw O;I=await K(B)}else I=await K(B);t=void 0,M("Shop Completed Purchase",{...Se([k]),payment_type:"credits",no_crypto_step:o,transaction_hash:I??null}),m("/success",{state:{items:[k],txHash:I}})}catch(_){D(_)||Te(_,{flow:"buy",step:n,gasless:o}),t&&Le(l.identity,[t]).catch(()=>{}),M(D(_)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:n,error_code:Fe(_),value_usd:$e(k.priceCredits)}),w(Ke(_)),h(null)}finally{b(!1)}}const ie=ze(s.rarity)?s.rarity:T.Rarity.COMMON,[re]=T.Rarity.getGradient(ie),V=De(s.gender),ce=p&&ye({priceCredits:s.priceCredits,compareAtCredits:s.compareAtCredits,saleEndsAt:s.saleEndsAt}),ne="More from this collection",W=Ie(s,l==null?void 0:l.address),le=p?F?"In cart":A?"Checking…":"Add to cart":"Not for sale",de=X||!!s.contractAddress&&!Q;return!s.name&&!de?e.jsxs("div",{className:"item-detail item-detail--notfound",children:[e.jsx("span",{className:"ico ico-cart item-detail__notfound-ico","aria-hidden":!0}),e.jsx("h1",{className:"item-detail__notfound-title",children:"This item isn’t available"}),e.jsx("p",{className:"muted",children:"It may have been delisted or moved. Browse Collectibles for something else."}),e.jsx("button",{className:"btn btn--purple",onClick:()=>m("/assets"),children:"Browse Collectibles"})]}):e.jsxs("div",{className:"item-detail",children:[e.jsxs("nav",{className:"item-detail__crumbs","aria-label":"Breadcrumb",children:[e.jsx("button",{className:"item-detail__crumb-link",onClick:()=>m("/assets"),children:"Collectibles"}),e.jsx("span",{className:"item-detail__crumb-sep",children:"/"}),e.jsx("span",{className:"item-detail__crumb-current",children: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%, ${re}33 0%, var(--media) 68%)`},children:e.jsx(Ge,{item:s})}),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${P?" is-on":""}`,onClick:()=>N(s),"aria-pressed":P,"aria-label":P?"Remove from favorites":"Add to favorites",children:e.jsx("span",{className:"ico ico-heart","aria-hidden":!0})})]}),s.creator?e.jsx(ge,{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"}),V?e.jsx("span",{className:"chip",children:V}):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"}),p?ce?e.jsxs("div",{className:"item-detail__price item-detail__price--sale",children:[e.jsxs("span",{className:"item-detail__price",children:[e.jsx(S,{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(S,{className:"item-detail__diamond item-detail__diamond--was"}),s.compareAtCredits]}),z(s.compareAtCredits,s.priceCredits)>0?e.jsxs("span",{className:"item-detail__sale-badge",children:["SALE -",z(s.compareAtCredits,s.priceCredits),"%"]}):null,e.jsx(Ce,{endsAt:s.saleEndsAt,className:"item-detail__countdown"})]}):e.jsxs("div",{className:"item-detail__price",children:[e.jsx(S,{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(S,{className:"ccy-mark"})," ",(g==null?void 0:g.credits)??0]}):null]}),e.jsx("div",{className:"item-detail__ctas",children:W?e.jsxs("p",{className:"item-detail__own-note muted",children:["This is your item — manage it in ",e.jsx(fe,{to:"/my-assets",children:"My Assets"}),"."]}):e.jsxs(e.Fragment,{children:[p?e.jsx("button",{className:"btn btn--purple item-detail__cta",onClick:ae,disabled:d||A,children:d?"Buying…":"Buy now"}):null,e.jsxs("button",{className:"item-detail__addcart",onClick:te,disabled:!p||F||A||d,children:[e.jsx("span",{className:"ico ico-cart-solid item-detail__addcart-ico","aria-hidden":!0}),le]})]})}),C?e.jsx("p",{className:"muted item-detail__status",children:C}):null,x?e.jsx("p",{className:"error item-detail__status",children:x}):null]})]})]}),e.jsx(Ye,{title:ne,items:J,activeId:s.id,onSelect:se,onViewAll:s.contractAddress?()=>m(`/collection/${s.contractAddress}`):void 0})]})}export{ss as ItemDetail,ss as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.item-detail{max-width:1721px;margin:0 auto}.item-detail__crumbs{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--muted);margin-bottom:22px}.item-detail__crumb-link{background:none;border:0;padding:0;font:inherit;color:var(--muted)}.item-detail__crumb-link:hover{color:var(--text)}.item-detail__crumb-sep{color:var(--muted-2)}.item-detail__crumb-current{color:var(--text);font-weight:600}.item-detail__main{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(320px,522px);gap:40px;align-items:start}@media(max-width:900px){.item-detail__main{grid-template-columns:1fr}}.item-detail__preview{position:relative;height:min(752px,70vh);border-radius:var(--radius-card);overflow:hidden;background:var(--media)}.item-detail__preview iframe,.item-detail__preview>*{width:100%;height:100%;border:0;display:block}.item-detail__info{display:flex;flex-direction:column;gap:14px}.item-detail__info-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.item-detail__title{font-size:clamp(24px,2.4vw,34px);font-weight:700;line-height:1.15;color:var(--text)}.item-detail__fav{flex:none;width:38px;height:38px;border-radius:50%;border:1px solid var(--line);background:#fff;display:grid;place-items:center;color:var(--text)}.item-detail__fav{cursor:pointer;transition:color .12s ease,border-color .12s ease}.item-detail__fav.is-on{color:var(--dcl-red);border-color:var(--dcl-red)}.item-detail__fav .ico-heart{width:18px;height:18px}.item-detail__creator{color:var(--muted);font-size:14px;margin-top:-6px}.item-detail__chips{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.item-detail__card{margin-top:8px;border:1px solid var(--line);border-radius:var(--radius-card);padding:20px;display:flex;flex-direction:column;gap:16px;background:#fff}.item-detail__price-block{display:flex;flex-direction:column;gap:6px}.item-detail__price-label{font-size:13px;font-weight:600;text-transform:uppercase;letter-spacing:.03em;color:var(--muted)}.item-detail__price{display:flex;align-items:center;gap:10px;font-weight:700;color:var(--text-2)}.item-detail__diamond{width:28px;height:28px;color:var(--text-2)}.item-detail__price-value{font-size:34px;line-height:1}.item-detail__price--none{font-size:18px;color:var(--muted)}.item-detail__price--sale{flex-wrap:wrap;gap:10px 14px}.item-detail__price--sale .item-detail__price,.item-detail__price--sale .item-detail__price-value,.item-detail__price--sale .item-detail__diamond{color:var(--dcl-red)}.item-detail__price-was{display:inline-flex;align-items:center;gap:6px;color:var(--muted);text-decoration:line-through;font-weight:600;font-size:20px}.item-detail__diamond--was{width:18px;height:18px;color:var(--muted)}.item-detail__sale-badge{display:inline-flex;align-items:center;background:var(--dcl-red);color:#fff;font-weight:800;font-size:13px;letter-spacing:.03em;text-transform:uppercase;border-radius:6px;padding:4px 10px}.item-detail__countdown{display:inline-flex;align-items:center;gap:5px;background:var(--rarity-bg);color:var(--accent);font-size:13px;font-weight:700;border-radius:6px;padding:4px 10px;white-space:nowrap}.item-detail__countdown .sale-countdown__ico{width:14px;height:14px}.item-detail__balance{font-size:13px}.item-detail__ctas{display:flex;flex-direction:column;gap:12px}.item-detail__cta{width:100%;height:44px;text-align:center}.item-detail__addcart{width:100%;height:44px;display:flex;align-items:center;justify-content:center;gap:8px;background:var(--black-btn);color:var(--soft-white);border:0;border-radius:var(--radius-btn);font-weight:600;font-size:13px;text-transform:uppercase;letter-spacing:.046em}.item-detail__addcart:disabled{opacity:.55;cursor:default}.item-detail__addcart-ico{width:20px;height:20px}.item-detail__status{margin:0;font-size:13px}.collection-carousel{margin-top:56px}.collection-carousel__head{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.collection-carousel__title{font-size:20px;font-weight:600;color:var(--text)}.collection-carousel__head-right{display:flex;align-items:center;gap:16px}.collection-carousel__viewall{background:none;border:0;padding:0;color:var(--accent);font-weight:600;font-size:13px;cursor:pointer;white-space:nowrap}.collection-carousel__viewall:hover{text-decoration:underline}.collection-carousel__arrows{display:flex;gap:10px}.collection-carousel__arrow{width:44px;height:44px;border-radius:50%;border:0;background:#fff;color:var(--text);font-size:22px;line-height:1;display:grid;place-items:center;box-shadow:0 6px 16px #16151829;transition:transform .12s ease,box-shadow .12s ease}.collection-carousel__arrow:hover{transform:scale(1.06);box-shadow:0 8px 20px #16151833}@media(prefers-reduced-motion:reduce){.collection-carousel__arrow{transition:none}}.collection-carousel__track{display:flex;gap:16px;overflow-x:auto;padding-bottom:8px;scroll-snap-type:x proximity}.collection-carousel__card{flex:0 0 220px;scroll-snap-align:start;text-align:left;background:#fff;border:1px solid var(--line);border-radius:var(--radius-card);overflow:hidden;padding:0;display:flex;flex-direction:column;transition:box-shadow .15s ease,transform .15s ease}.collection-carousel__card:hover{transform:translateY(-2px);box-shadow:0 0 0 2px var(--brand-violet),0 10px 30px #a524b347}.collection-carousel__card.is-active{box-shadow:0 0 0 2px var(--accent)}.collection-carousel__media{position:relative;aspect-ratio:1 / 1;background:var(--media)}.collection-carousel__img{width:100%;height:100%;object-fit:contain;display:block}.collection-carousel__body{padding:10px 12px 12px;display:flex;flex-direction:column;gap:8px}.collection-carousel__name{font-weight:600;font-size:14px;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.collection-carousel__meta{display:flex;align-items:center;justify-content:space-between;gap:8px}.collection-carousel__price{display:flex;align-items:center;gap:5px;font-weight:600;font-size:15px;color:var(--text-2)}.collection-carousel__diamond{width:14px;height:14px;color:var(--text-2)}.collection-carousel__chips{display:flex;align-items:center;gap:6px}.collection-carousel__na{color:var(--muted);font-weight:600;font-size:13px}.collection-carousel__card{cursor:pointer}.collection-carousel__card:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.collection-carousel__add{position:absolute;bottom:10px;right:10px;z-index:2;width:34px;height:34px;border-radius:50%;border:0;background:var(--accent);color:#fff;display:grid;place-items:center;box-shadow:0 4px 12px #691fa959;transition:transform .12s ease,background .15s ease}.collection-carousel__add:hover{transform:scale(1.08)}.collection-carousel__add:disabled{background:var(--muted-2);cursor:default;box-shadow:none}.collection-carousel__add .ico{width:18px;height:18px}.item-detail--notfound{min-height:46vh;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:14px}.item-detail__notfound-ico{width:44px;height:44px;opacity:.4}.item-detail__notfound-title{font-size:22px}.item-detail--notfound .btn{margin-top:6px}
|
|
1
|
+
.item-detail{max-width:1721px;margin:0 auto}.item-detail__crumbs{display:flex;align-items:center;gap:8px;font-size:13px;color:var(--muted);margin-bottom:22px}.item-detail__crumb-link{background:none;border:0;padding:0;font:inherit;color:var(--muted)}.item-detail__crumb-link:hover{color:var(--text)}.item-detail__crumb-sep{color:var(--muted-2)}.item-detail__crumb-current{color:var(--text);font-weight:600}.item-detail__main{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(320px,522px);gap:40px;align-items:start}@media(max-width:900px){.item-detail__main{grid-template-columns:1fr}}.item-detail__preview{position:relative;height:min(752px,70vh);border-radius:var(--radius-card);overflow:hidden;background:var(--media)}.item-detail__preview iframe,.item-detail__preview>*{width:100%;height:100%;border:0;display:block}.item-detail__info{display:flex;flex-direction:column;gap:14px}.item-detail__info-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.item-detail__title{font-size:clamp(24px,2.4vw,34px);font-weight:700;line-height:1.15;color:var(--text)}.item-detail__fav{flex:none;width:38px;height:38px;border-radius:50%;border:1px solid var(--line);background:#fff;display:grid;place-items:center;color:var(--text)}.item-detail__fav{cursor:pointer;transition:color .12s ease,border-color .12s ease}.item-detail__fav.is-on{color:var(--dcl-red);border-color:var(--dcl-red)}.item-detail__fav .ico-heart{width:18px;height:18px}.item-detail__creator{color:var(--muted);font-size:14px;margin-top:-6px}.item-detail__chips{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.item-detail__card{margin-top:8px;border:1px solid var(--line);border-radius:var(--radius-card);padding:20px;display:flex;flex-direction:column;gap:16px;background:#fff}.item-detail__price-block{display:flex;flex-direction:column;gap:6px}.item-detail__price-label{font-size:13px;font-weight:600;text-transform:uppercase;letter-spacing:.03em;color:var(--muted)}.item-detail__price{display:flex;align-items:center;gap:10px;font-weight:700;color:var(--text-2)}.item-detail__diamond{width:28px;height:28px;color:var(--text-2)}.item-detail__price-value{font-size:34px;line-height:1}.item-detail__price--none{font-size:18px;color:var(--muted)}.item-detail__price--sale{flex-wrap:wrap;gap:10px 14px}.item-detail__price--sale .item-detail__price,.item-detail__price--sale .item-detail__price-value,.item-detail__price--sale .item-detail__diamond{color:var(--dcl-red)}.item-detail__price-was{display:inline-flex;align-items:center;gap:6px;color:var(--muted);text-decoration:line-through;font-weight:600;font-size:20px}.item-detail__diamond--was{width:18px;height:18px;color:var(--muted)}.item-detail__sale-badge{display:inline-flex;align-items:center;background:var(--dcl-red);color:#fff;font-weight:800;font-size:13px;letter-spacing:.03em;text-transform:uppercase;border-radius:6px;padding:4px 10px}.item-detail__countdown{display:inline-flex;align-items:center;gap:5px;background:var(--rarity-bg);color:var(--accent);font-size:13px;font-weight:700;border-radius:6px;padding:4px 10px;white-space:nowrap}.item-detail__countdown .sale-countdown__ico{width:14px;height:14px}.item-detail__balance{font-size:13px}.item-detail__ctas{display:flex;flex-direction:column;gap:12px}.item-detail__cta{width:100%;height:44px;text-align:center}.item-detail__addcart{width:100%;height:44px;display:flex;align-items:center;justify-content:center;gap:8px;background:var(--black-btn);color:var(--soft-white);border:0;border-radius:var(--radius-btn);font-weight:600;font-size:13px;text-transform:uppercase;letter-spacing:.046em}.item-detail__addcart:disabled{opacity:.55;cursor:default}.item-detail__addcart-ico{width:20px;height:20px}.item-detail__status{margin:0;font-size:13px}.item-detail__own-note{margin:0;font-size:14px}.item-detail__own-note a{color:var(--accent);font-weight:600}.collection-carousel{margin-top:56px}.collection-carousel__head{display:flex;align-items:center;justify-content:space-between;margin-bottom:20px}.collection-carousel__title{font-size:20px;font-weight:600;color:var(--text)}.collection-carousel__head-right{display:flex;align-items:center;gap:16px}.collection-carousel__viewall{background:none;border:0;padding:0;color:var(--accent);font-weight:600;font-size:13px;cursor:pointer;white-space:nowrap}.collection-carousel__viewall:hover{text-decoration:underline}.collection-carousel__arrows{display:flex;gap:10px}.collection-carousel__arrow{width:44px;height:44px;border-radius:50%;border:0;background:#fff;color:var(--text);font-size:22px;line-height:1;display:grid;place-items:center;box-shadow:0 6px 16px #16151829;transition:transform .12s ease,box-shadow .12s ease}.collection-carousel__arrow:hover{transform:scale(1.06);box-shadow:0 8px 20px #16151833}@media(prefers-reduced-motion:reduce){.collection-carousel__arrow{transition:none}}.collection-carousel__track{display:flex;gap:16px;overflow-x:auto;padding-bottom:8px;scroll-snap-type:x proximity}.collection-carousel__card{flex:0 0 220px;scroll-snap-align:start;text-align:left;background:#fff;border:1px solid var(--line);border-radius:var(--radius-card);overflow:hidden;padding:0;display:flex;flex-direction:column;transition:box-shadow .15s ease,transform .15s ease}.collection-carousel__card:hover{transform:translateY(-2px);box-shadow:0 0 0 2px var(--brand-violet),0 10px 30px #a524b347}.collection-carousel__card.is-active{box-shadow:0 0 0 2px var(--accent)}.collection-carousel__media{position:relative;aspect-ratio:1 / 1;background:var(--media)}.collection-carousel__img{width:100%;height:100%;object-fit:contain;display:block}.collection-carousel__body{padding:10px 12px 12px;display:flex;flex-direction:column;gap:8px}.collection-carousel__name{font-weight:600;font-size:14px;color:var(--text);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.collection-carousel__meta{display:flex;align-items:center;justify-content:space-between;gap:8px}.collection-carousel__price{display:flex;align-items:center;gap:5px;font-weight:600;font-size:15px;color:var(--text-2)}.collection-carousel__diamond{width:14px;height:14px;color:var(--text-2)}.collection-carousel__chips{display:flex;align-items:center;gap:6px}.collection-carousel__na{color:var(--muted);font-weight:600;font-size:13px}.collection-carousel__card{cursor:pointer}.collection-carousel__card:focus-visible{outline:2px solid var(--accent);outline-offset:2px}.collection-carousel__add{position:absolute;bottom:10px;right:10px;z-index:2;width:34px;height:34px;border-radius:50%;border:0;background:var(--accent);color:#fff;display:grid;place-items:center;box-shadow:0 4px 12px #691fa959;transition:transform .12s ease,background .15s ease}.collection-carousel__add:hover{transform:scale(1.08)}.collection-carousel__add:disabled{background:var(--muted-2);cursor:default;box-shadow:none}.collection-carousel__add .ico{width:18px;height:18px}.item-detail--notfound{min-height:46vh;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:14px}.item-detail__notfound-ico{width:44px;height:44px;opacity:.4}.item-detail__notfound-title{font-size:22px}.item-detail--notfound .btn{margin-top:6px}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as te,r as o,j as e,u as ie}from"./react-E8ng6RF2.js";import{e as ne,j as G,c as le,l as ce,m as V,i as oe,q as de,r as ue,y as I,t as M,x as H,v as Y,g as T,J as K,C as W,A as me,K as he}from"./index-C13awi5n.js";import{r as pe,a as B,m as ye}from"./mana-rate-RN1C71HA.js";import{S as O}from"./SkeletonCards-yV2mi4oc.js";import{L as fe}from"./LoadMore-DB6TwvRe.js";import{h as Q}from"./buy-C-Rj-xp5.js";import{g as _e,a as be,w as ke,G as xe}from"./buy-gasless-BmoACMRr.js";import{u as ge}from"./useInfiniteGrid-et3T-1IY.js";import"./ethers-DbXGgxrh.js";import"./index-kV1vUp3Z.js";function ve(){return ne({queryKey:["mana-rate",G.chainId],queryFn:()=>pe(G.chainId),staleTime:6e4,refetchInterval:6e4,retry:1})}function z(r){const u=r,c=(u.message??"").toLowerCase();return u.code===4001||c.includes("reject")||c.includes("denied")||c.includes("cancel")?"You cancelled the request.":c.includes("insufficient")?`Not enough ${W.name} — get more first.`:c.includes("not found")||c.includes("no active listing")||c.includes("404")?"This item was just sold or removed. Refreshing the market…":c.includes("your own listing")?"You can't buy your own listing.":"Couldn't complete checkout — please try again."}function je(r){return{id:r.tradeId,tradeId:r.tradeId,name:r.name,creator:r.creator,contractAddress:r.contractAddress,itemId:r.itemId,category:r.category,wearableCategory:r.wearableCategory??void 0,rarity:r.rarity,network:r.network,chainId:r.chainId,thumbnail:r.thumbnail,priceCredits:0,gender:null}}function Ce({listing:r,rate:u,onClose:c,onSold:k}){const{session:i}=le(),{data:n}=ce(i),x=V(),m=te(),[N,_]=o.useState("confirm"),[w,h]=o.useState("Locking today’s price…"),[f,g]=o.useState(null),[s,$]=o.useState(null),p=o.useRef(null),A=Math.ceil(B(r.manaWei,u)/10);o.useEffect(()=>{let b=!1;if(!i){_("error"),g("Sign in to check out.");return}return(async()=>{try{const t=await oe(r.tradeId);if(!t)throw new Error("not found");if(de(t,i.address))throw new Error("You can't buy your own listing.");const l=B(r.manaWei,u);if(!Number.isFinite(l)||l<=0)throw new Error("price unavailable");const{credit:d,maxCreditedValue:R,usdCents:P}=await ue(i.identity,l,r.tradeId);if(b){I(i.identity,[d.id]).catch(()=>{});return}p.current=d.id,$({trade:t,credit:d,maxCreditedValue:R,usdCents:P,credits:Math.ceil(P/10)}),h("")}catch(t){if(b)return;console.error("[market] authorize failed",t),M(Y(t)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:H(t),value_usd:Math.round(B(r.manaWei,u))/100}),_("error"),g(z(t))}})(),()=>{b=!0,p.current&&i&&(I(i.identity,[p.current]).catch(()=>{}),p.current=null)}},[]);const v=!!s&&((n==null?void 0:n.credits)??0)<s.credits;async function L(){if(!i||!s)return;if(v){I(i.identity,[s.credit.id]).catch(()=>{}),p.current=null,m("/credits");return}_("working"),g(null);let b=!1;try{h("Confirming your purchase…");const t={trade:s.trade,buyer:i.address,signer:i.signer,credits:[s.credit],maxCreditedValue:s.maxCreditedValue};let l;if(_e())try{l=await be(t),await ke(l),b=!0}catch(d){if(!(d instanceof xe))throw d;l=await Q(t)}else l=await Q(t);p.current=null,M("Shop Completed Purchase",{items:[{item_id:r.itemId??null,contract_address:r.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:b,transaction_hash:l??null}),x.invalidateQueries({queryKey:["usd-balance"]}),m("/success",{state:{items:[je(r)],txHash:l}})}catch(t){console.error("[market] buy now failed",t),I(i.identity,[s.credit.id]).catch(()=>{}),p.current=null,M(Y(t)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:H(t),value_usd:s.usdCents/100}),x.invalidateQueries({queryKey:["usd-balance"]});const l=z(t);g(l),_("error"),/sold or removed/i.test(l)&&k()}}function C(){i&&s&&I(i.identity,[s.credit.id]).catch(()=>{}),p.current=null,c()}const j=N==="working";return e.jsxs("div",{className:"mkt-modal",role:"dialog","aria-modal":"true","aria-label":`Buy ${r.name}`,children:[e.jsx("div",{className:"mkt-modal__scrim",onClick:j?void 0:C,"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:r.thumbnail?e.jsx("img",{src:r.thumbnail,alt:""}):null}),e.jsxs("div",{children:[e.jsx("div",{className:"mkt-modal__name",title:r.name,children:r.name||"Item"}),e.jsx("span",{className:"chip chip--rarity",children:r.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"}),K(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"}),K(A)]}),e.jsx("div",{className:"mkt-modal__price-sub muted",children:w||"Locking today’s price…"})]})}),i?e.jsxs("div",{className:"mkt-modal__balance muted",children:["Your balance: ",e.jsx(T,{className:"ccy-mark"})," ",(n==null?void 0:n.credits)??0]}):null,v?e.jsxs("p",{className:"muted mkt-modal__note",children:["You’ll need a few more ",W.name," to buy this."]}):null,w&&N==="working"?e.jsx("p",{className:"muted mkt-modal__note",children:w}):null,f?e.jsx("p",{className:"error mkt-modal__note",children:f}):null,e.jsxs("div",{className:"mkt-modal__actions",children:[e.jsx("button",{className:"btn btn--ghost",onClick:C,disabled:j,children:"Cancel"}),e.jsx("button",{className:"btn btn--purple",onClick:L,disabled:j||!s,children:j?"Buying…":v?`Get ${W.name}`:"Confirm purchase"})]})]})]})}const Ne=48,U=[{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"]},Se=["common","uncommon","rare","epic","legendary","mythic","unique","exotic"],E=[{key:"newest",label:"Newest",server:"newest"},{key:"price-asc",label:"Price: Low to High",server:"cheapest"},{key:"price-desc",label:"Price: High to Low",server:"most_expensive"},{key:"name",label:"Name (A–Z)",server:"name"}];function Ie(r){return{id:r.tradeId,tradeId:r.tradeId,name:r.name,creator:r.creator,contractAddress:r.contractAddress,itemId:r.itemId,category:r.category,wearableCategory:r.wearableCategory??void 0,rarity:r.rarity,network:r.network,chainId:r.chainId,thumbnail:r.thumbnail,priceCredits:0,gender:null}}function Be(){const[r]=ie(),u=(r.get("q")??"").trim().toLowerCase(),c=V(),[k,i]=o.useState("wearable"),[n,x]=o.useState(null),[m,N]=o.useState([]),[_,w]=o.useState("newest"),[h,f]=o.useState(null),[g,s]=o.useState(null),$=n?we[n]:void 0,p=(E.find(a=>a.key===_)??E[0]).server,A={category:k,rarities:m.length?m:void 0,wearableCategories:$,search:u||void 0,sortBy:p},{items:v,total:L,isLoading:C,error:j,hasNextPage:b,isFetchingNextPage:t,fetchNextPage:l}=ge(["legacy-listings",A],a=>he({...A,first:Ne,skip:a})),{data:d,isError:R}=ve(),P=a=>d?ye(a.manaWei,d):null;function Z(a){i(a),x(null)}function J(a){N(y=>y.includes(a)?y.filter(q=>q!==a):[...y,a])}function D(){i("wearable"),x(null),N([]),f(null)}function F(a){f(y=>y===a?null:a)}function X(a){const y=v.find(q=>q.tradeId===a.tradeId);y&&s(y)}function ee(){c.invalidateQueries({queryKey:["legacy-listings"]})}const ae=E.find(a=>a.key===_)??E[0],S=U.find(a=>a.key===k)??U[0],re=n?`${S.label} · ${n}`:S.label,se=k!=="wearable"||!!n||m.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."})]}),R?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,h?e.jsx("div",{className:"filterbar__scrim",onClick:()=>f(null),"aria-hidden":!0}):null,e.jsxs("div",{className:"filterbar",children:[e.jsxs("div",{className:"filterbar__filters",children:[e.jsxs("div",{className:"filterbar__item",children:[e.jsxs("button",{className:`filterbar__trigger${h==="section"?" is-open":""}${n||k!=="wearable"?" is-active":""}`,onClick:()=>F("section"),children:[re," ",e.jsx("span",{className:"filterbar__chev","aria-hidden":!0,children:"▾"})]}),h==="section"?e.jsxs("div",{className:"filter-pop filter-pop--section",children:[e.jsx("ul",{className:"filter-pop__cats",children:U.map(a=>e.jsx("li",{children:e.jsx("button",{className:`filter-pop__cat${k===a.key?" is-active":""}`,onClick:()=>Z(a.key),children:a.label})},a.key))}),S.sub.length?e.jsxs("ul",{className:"filter-pop__subs",children:[e.jsx("li",{children:e.jsxs("button",{className:`filter-pop__sub${n?"":" is-active"}`,onClick:()=>{x(null),f(null)},children:["All ",S.label]})}),S.sub.map(a=>e.jsx("li",{children:e.jsx("button",{className:`filter-pop__sub${n===a?" is-active":""}`,onClick:()=>{x(y=>y===a?null:a),f(null)},children:a})},a))]}):null]}):null]}),e.jsxs("div",{className:"filterbar__item",children:[e.jsxs("button",{className:`filterbar__trigger${h==="rarity"?" is-open":""}${m.length?" is-active":""}`,onClick:()=>F("rarity"),children:["Rarity ",m.length?e.jsx("span",{className:"filterbar__badge",children:m.length}):null," ",e.jsx("span",{className:"filterbar__chev","aria-hidden":!0,children:"▾"})]}),h==="rarity"?e.jsx("div",{className:"filter-pop filter-pop--rarity",children:Se.map(a=>e.jsxs("label",{className:"filter-pop__check",children:[e.jsx("input",{type:"checkbox",checked:m.includes(a),onChange:()=>J(a)}),e.jsx("span",{children:a})]},a))}):null]}),se?e.jsx("button",{className:"filterbar__clear",onClick:D,children:"Clear all"}):null]}),e.jsxs("div",{className:"filterbar__right",children:[e.jsxs("span",{className:"filterbar__count",children:[C?"…":`${L.toLocaleString()} item${L===1?"":"s"}`,u?` for “${u}”`:""]}),e.jsxs("div",{className:"filterbar__item",children:[e.jsxs("button",{className:`filterbar__sort${h==="sort"?" is-open":""}`,onClick:()=>F("sort"),children:["Sort by: ",ae.label," ",e.jsx("span",{className:"filterbar__chev","aria-hidden":!0,children:"▾"})]}),h==="sort"?e.jsx("div",{className:"filter-pop filter-pop--sort",children:E.map(a=>e.jsx("button",{className:`filter-pop__sort${a.key===_?" is-active":""}`,onClick:()=>{w(a.key),f(null)},children:a.label},a.key))}):null]})]})]}),j?e.jsx("p",{className:"error",children:j.message}):null,e.jsx("div",{className:"grid",children:C?e.jsx(O,{count:15}):e.jsxs(e.Fragment,{children:[v.map(a=>e.jsx(me,{item:Ie(a),mode:"market",marketPriceCredits:P(a),onBuyNow:X},a.tradeId)),t?e.jsx(O,{count:6}):null]})}),e.jsx(fe,{hasNextPage:b,isFetching:t,onLoadMore:()=>l()}),!C&&v.length===0?e.jsx("p",{className:"muted",children:"No items match your filters."}):null,g&&d?e.jsx(Ce,{listing:g,rate:d,onClose:()=>s(null),onSold:()=>{s(null),ee()}}):null]})}export{Be as Market,Be as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as B,r as m,j as s,L as le}from"./react-E8ng6RF2.js";import{B as ee,j as G,P as ce,m as W,g as T,C,p as se,t as P,H,w as V,x as ne,c as oe,e as U,a0 as de,i as me,a1 as ue}from"./index-C13awi5n.js";import{f as he}from"./import-CDNhzcDz.js";import{a as pe,b as ge,i as be,e as ye,c as xe,d as fe}from"./buy-C-Rj-xp5.js";import{s as je}from"./wallet-kind-BTWNHcc9.js";import{L as _e}from"./LoadMore-DB6TwvRe.js";import{u as Ne}from"./useInfiniteGrid-et3T-1IY.js";import"./ethers-DbXGgxrh.js";import"./mana-rate-RN1C71HA.js";import"./index-kV1vUp3Z.js";const D=()=>`${G.builderServerUrl}/v1`;function ae(e){return Array.isArray(e)?e:"results"in e&&Array.isArray(e.results)?e.results:"data"in e&&Array.isArray(e.data)?e.data:[]}async function te(e,i){const a=await ce(e,{method:"GET",identity:i,metadata:{}});if(!a.ok)throw new Error(`builder-server ${a.status}: ${await a.text()}`);const o=await a.json();return o.data??o}function Ie(e,i){const a=i-e;return a>0?a:0}function ke(e){var i,a,o,l,c;return((a=(i=e.data)==null?void 0:i.wearable)==null?void 0:a.category)??((l=(o=e.data)==null?void 0:o.emote)==null?void 0:l.category)??((c=e.data)==null?void 0:c.category)??e.type??"wearable"}function Z(e){return`${D()}/storage/contents/${e}`}function $(e,i){if(!e)return"";if(/^https?:\/\//.test(e))return e;const a=i==null?void 0:i[e];return a?Z(a):/^(ba|Qm)/.test(e)?Z(e):""}async function ve(e,i){try{const a=await fetch(`${D()}/items/${e}/${i}/contents`);if(!a.ok)return{};const o=await a.json();return o.data??o}catch{return{}}}async function we(e,i,a){const o=$(e.thumbnail,e.contents)||$("thumbnail.png",e.contents);if(o)return o;if(i&&a){const l=await ve(i,a);return $(e.thumbnail,l)||$("thumbnail.png",l)||$("image.png",l)}return""}async function Ce(e,i){const a=`${D()}/${e.toLowerCase()}/collections?is_published=true`,o=await te(a,i);return ae(o).filter(l=>l.is_published&&!!l.contract_address).map(l=>({id:l.id,name:l.name,contractAddress:l.contract_address.toLowerCase(),isPublished:l.is_published,isApproved:l.is_approved,minters:(l.minters??[]).map(c=>c.toLowerCase())}))}async function Se(e,i){const a=`${D()}/collections/${e.id}/items`,o=await te(a,i);return(await Promise.all(ae(o).map(async c=>{const k=c.rarity??"common",_=Number(c.total_supply??0)||0;let u=0;try{u=ee.Rarity.getMaxSupply(k)}catch{u=0}const N=(c.contract_address??e.contractAddress).toLowerCase(),p=c.blockchain_item_id??"";return{id:c.id,collectionId:e.id,collectionName:e.name,contractAddress:N,blockchainItemId:p,name:c.name,category:ke(c),rarity:k,thumbnail:await we(c,N,p),type:c.type??"wearable",isPublished:c.is_published??e.isPublished,isApproved:c.is_approved??e.isApproved,totalSupply:_,maxSupply:u,remainingSupply:Ie(_,u),minters:e.minters}}))).filter(Ae)}function Ae(e){return e.isPublished&&e.isApproved&&e.blockchainItemId!==""&&e.blockchainItemId!=null&&e.remainingSupply>0}async function Pe(e,i){const a=await Ce(e,i);return(await Promise.all(a.map(async l=>{try{return await Se(l,i)}catch{return[]}}))).flat()}const $e=1e3*60*60*24*182;function Le(e){const i=e,a=(i.message??"").toLowerCase();return i.code===4001||a.includes("reject")||a.includes("denied")||a.includes("cancel")?"You cancelled the request.":"Couldn't list your item — please try again."}function Ee({asset:e,session:i,onClose:a}){const o=W(),l=B(),[c,k]=m.useState("10"),[_,u]=m.useState(null),[N,p]=m.useState(null),[g,v]=m.useState(!1),[f,j]=m.useState(null);async function S(){p(null);const d=Number(c);if(!Number.isInteger(d)||d<=0){p("Enter a whole number of credits");return}v(!0);try{u("Getting your item ready…"),await pe({signer:i.signer,contractAddress:e.contractAddress,chainId:e.chainId}),u("Listing your item…");const I=await ge({signer:i.signer,nft:{contractAddress:e.contractAddress,tokenId:e.tokenId,network:e.network,chainId:e.chainId},usdPrice:d/10,expiresAtMs:Date.now()+$e});u("Publishing…"),await se(I,i.identity),u(null),j(d),P("Shop Listed Item",{item_id:e.itemId??e.tokenId??null,contract_address:e.contractAddress,price_credits:d,price_usd:d/10,listing_type:"secondary",is_primary:!1}),H.success(`“${e.name}” is now on sale!`),o.invalidateQueries({queryKey:["my-assets",i.address]})}catch(I){V(I,{flow:"list_secondary"}),P("Shop Listing Failed",{listing_type:"secondary",error_code:ne(I)}),p(Le(I)),u(null)}finally{v(!1)}}function x(){a(),l(`/item/${e.contractAddress}/${e.tokenId}`)}return f!==null?s.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:s.jsxs("div",{className:"modal modal--success",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),s.jsx("h2",{className:"modal__title",children:"It’s on sale! 🎉"}),e.image?s.jsx("img",{className:"modal__img",src:e.image,alt:e.name}):null,s.jsx("p",{className:"modal-success__name",children:e.name}),s.jsxs("p",{className:"muted small",children:["Listed for ",s.jsxs("strong",{children:[s.jsx(T,{className:"ccy-mark"})," ",f]})]}),s.jsxs("div",{className:"modal__actions",children:[s.jsx("button",{className:"btn btn--ghost",onClick:a,children:"Done"}),s.jsx("button",{className:"btn btn--purple",onClick:x,children:"View in Shop"})]})]})}):s.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:s.jsxs("div",{className:"modal",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsxs("h2",{className:"modal__title",children:["List “",e.name,"”"]}),e.image?s.jsx("img",{className:"modal__img",src:e.image,alt:e.name}):null,s.jsxs("label",{className:"field",children:[s.jsxs("span",{children:["Price (",C.name,")"]}),s.jsx("input",{type:"number",min:"1",step:"1",value:c,onChange:d=>k(d.target.value),disabled:g})]}),s.jsxs("p",{className:"muted small",children:["Priced in whole ",C.name," (1 ",C.nameSingular," = $0.10)."]}),_?s.jsx("p",{className:"muted",children:_}):null,N?s.jsx("p",{className:"error",children:N}):null,s.jsxs("div",{className:"modal__actions",children:[s.jsx("button",{className:"btn btn--ghost",onClick:a,disabled:g,children:"Cancel"}),s.jsx("button",{className:"btn",onClick:S,disabled:g,children:g?"Listing…":"Put on sale"})]})]})})}const Me=1e3*60*60*24*182;function qe(e){const i=e,a=(i.message??"").toLowerCase();return i.code===4001||a.includes("reject")||a.includes("denied")||a.includes("cancel")?"You cancelled the request.":"Couldn't publish your item — please try again."}function Fe({item:e,session:i,onClose:a}){const o=W(),l=B(),[c,k]=m.useState("10"),[_,u]=m.useState(null),[N,p]=m.useState(null),[g,v]=m.useState(!1),[f,j]=m.useState(null),[S,x]=m.useState(null),d=G.chainId,I=je(i.providerType);m.useEffect(()=>{let h=!1;return(async()=>{try{const b=await be({contractAddress:e.contractAddress,chainId:d});h||j(b)}catch{h||j(!1)}})(),()=>{h=!0}},[e.contractAddress,d]);async function L(){p(null);const h=Number(c);if(!Number.isInteger(h)||h<=0){p("Enter a whole number of credits");return}v(!0);try{f||(u("Enabling sales for this collection…"),await ye({signer:i.signer,contractAddress:e.contractAddress,chainId:d}),j(!0)),u("Publishing your item…");const b=await xe({signer:i.signer,item:{contractAddress:e.contractAddress,itemId:e.blockchainItemId,network:ee.Network.MATIC,chainId:d},usdPrice:h/10,uses:e.remainingSupply,expiresAtMs:Date.now()+Me});u("Finishing up…"),await se(b,i.identity),u(null),x(h),P("Shop Listed Item",{item_id:e.blockchainItemId,contract_address:e.contractAddress,price_credits:h,price_usd:h/10,listing_type:"primary",is_primary:!0}),H.success(`“${e.name}” is now on sale!`),o.invalidateQueries({queryKey:["publishable-items"]}),o.invalidateQueries({queryKey:["collection-sale-state"]})}catch(b){V(b,{flow:"list_primary"}),P("Shop Listing Failed",{listing_type:"primary",error_code:ne(b)}),p(qe(b)),u(null)}finally{v(!1)}}function K(){a(),l(`/item/${e.contractAddress}/${e.blockchainItemId}`)}const E=g?"Listing…":f===!1?"Enable & put on sale":"Put on sale";return S!==null?s.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:s.jsxs("div",{className:"modal modal--success",onClick:h=>h.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),s.jsx("h2",{className:"modal__title",children:"It’s on sale! 🎉"}),e.thumbnail?s.jsx("img",{className:"modal__img",src:e.thumbnail,alt:e.name}):null,s.jsx("p",{className:"modal-success__name",children:e.name}),s.jsxs("p",{className:"muted small",children:["Listed for ",s.jsxs("strong",{children:[s.jsx(T,{className:"ccy-mark"})," ",S]})," · ",e.remainingSupply.toLocaleString()," available"]}),s.jsxs("div",{className:"modal__actions",children:[s.jsx("button",{className:"btn btn--ghost",onClick:a,children:"Done"}),s.jsx("button",{className:"btn btn--purple",onClick:K,children:"View in Shop"})]})]})}):s.jsx("div",{className:"modal-backdrop",onClick:a,role:"presentation",children:s.jsxs("div",{className:"modal",onClick:h=>h.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsxs("h2",{className:"modal__title",children:["Publish “",e.name,"”"]}),e.thumbnail?s.jsx("img",{className:"modal__img",src:e.thumbnail,alt:e.name}):null,s.jsxs("p",{className:"muted small",children:["From your collection “",e.collectionName,"” · ",e.remainingSupply.toLocaleString()," available"]}),s.jsxs("label",{className:"field",children:[s.jsxs("span",{children:["Price (",C.name,")"]}),s.jsx("input",{type:"number",min:"1",step:"1",value:c,onChange:h=>k(h.target.value),disabled:g})]}),s.jsxs("p",{className:"muted small",children:["Priced in whole ",C.name," (1 ",C.nameSingular," = $0.10)."]}),f===!1&&!g?I?s.jsxs("p",{className:"muted small primary-note",children:["First time selling from “",e.collectionName,"”? It needs a one-time approval, then you’ll confirm the listing — two quick confirmations. After this, listing more items from this collection is a single step."]}):s.jsxs("p",{className:"muted small primary-note",children:["First time selling from “",e.collectionName,"”? Setting it up takes a moment — after that, listing more items from this collection is instant."]}):f===!0&&!g?I?s.jsx("p",{className:"muted small primary-note",children:"This collection is ready — publishing is a single confirmation."}):s.jsx("p",{className:"muted small primary-note",children:"This collection is ready — publishing is instant."}):null,_?s.jsx("p",{className:"muted",children:_}):null,N?s.jsx("p",{className:"error",children:N}):null,s.jsxs("div",{className:"modal__actions",children:[s.jsx("button",{className:"btn btn--ghost",onClick:a,disabled:g,children:"Cancel"}),s.jsx("button",{className:"btn",onClick:L,disabled:g||f===null,children:f===null?"Checking…":E})]})]})})}const Te=48;function z(e){return{id:e.id,name:e.name,creator:"",contractAddress:e.contractAddress,itemId:e.itemId,category:e.category,rarity:e.rarity??"common",network:e.network,chainId:e.chainId,thumbnail:e.image,priceCredits:e.listingPrice??0,gender:null,tokenId:e.tokenId}}function F(e){return{id:`${e.contractAddress}-${e.blockchainItemId}`,name:e.name,creator:"",contractAddress:e.contractAddress,itemId:e.blockchainItemId,category:e.category,rarity:e.rarity,network:"MATIC",chainId:G.chainId,thumbnail:e.thumbnail,priceCredits:0,gender:null}}function He(){const{session:e,error:i,signIn:a,restore:o}=oe(),l=B(),c=W(),[k,_]=m.useState(null),[u,N]=m.useState(null),[p,g]=m.useState(null),[v,f]=m.useState(null);function j(n){const t=n.tokenId??n.itemId??"";!n.contractAddress||!t||l(`/item/${n.contractAddress}/${t}`,{state:{item:n}})}async function S(n,t,r){if(e){f(null),g(r);try{const y=await me(n);await fe({trade:y,signer:e.signer}),H.success(`“${t}” is no longer for sale.`),await c.invalidateQueries({queryKey:["my-assets",e.address]}),await c.invalidateQueries({queryKey:["collection-sale-state"]})}catch(y){const M=y,q=(M.message??"").toLowerCase(),J=M.code===4001||q.includes("reject")||q.includes("denied");J||V(y,{flow:"remove-listing",tradeId:n}),f(J?"You cancelled the request.":"Couldn't remove the listing — please try again.")}finally{g(null)}}}m.useEffect(()=>{o()},[o]);const x=e==null?void 0:e.address,{items:d,isLoading:I,error:L,hasNextPage:K,isFetchingNextPage:E,fetchNextPage:h}=Ne(["my-assets",x],n=>de(x,{first:Te,skip:n}).then(t=>({items:t.assets,total:t.total})),{enabled:!!x}),{data:b}=U({queryKey:["importable",x],queryFn:()=>he(x),enabled:!!x}),O=((b==null?void 0:b.creations.length)??0)+((b==null?void 0:b.owned.length)??0),{data:A,isLoading:ie,isError:re}=U({queryKey:["publishable-items",x],queryFn:()=>Pe(x,e.identity),enabled:!!e,retry:!1}),R=m.useMemo(()=>[...new Set((A??[]).map(n=>n.contractAddress))],[A]),{data:w}=U({queryKey:["collection-sale-state",x,R],enabled:R.length>0,queryFn:async()=>{const n=await Promise.all(R.map(async r=>[r,await ue(r)])),t={};for(const[r,y]of n)for(const[M,q]of Object.entries(y))t[`${r}-${M}`]=q;return t}}),Q=n=>w==null?void 0:w[`${n.contractAddress}-${n.blockchainItemId}`],Y=m.useMemo(()=>(A??[]).filter(n=>{var t;return(t=Q(n))==null?void 0:t.isOnSale}),[A,w]),X=m.useMemo(()=>{var t;const n=new Map;for(const r of A??[]){if((t=w==null?void 0:w[`${r.contractAddress}-${r.blockchainItemId}`])!=null&&t.isOnSale)continue;const y=n.get(r.collectionId)??{id:r.collectionId,name:r.collectionName,items:[]};y.items.push(r),n.set(r.collectionId,y)}return[...n.values()]},[A,w]);return e?s.jsxs("section",{className:"myassets",children:[s.jsx("h1",{children:"My Assets"}),O>0?s.jsxs(le,{className:"import-banner",to:"/import",children:[s.jsx("span",{className:"import-banner__ico","aria-hidden":!0,children:"📦"}),s.jsxs("span",{className:"import-banner__text",children:[s.jsx("strong",{children:"Import your listings"}),s.jsxs("span",{className:"import-banner__sub",children:["You have ",O," item",O===1?"":"s"," for sale elsewhere — bring them into the Shop."]})]}),s.jsx("span",{className:"import-banner__cta",children:"Import"})]}):null,s.jsxs("div",{className:"myassets__section",children:[s.jsxs("div",{className:"myassets__section-head",children:[s.jsx("h2",{className:"myassets__section-title",children:"Items you own"}),s.jsx("p",{className:"myassets__section-sub",children:"Wearables & emotes you’ve bought — resell them in the Shop."})]}),L?s.jsx("p",{className:"error",children:L.message}):null,v?s.jsx("p",{className:"error",children:v}):null,s.jsxs("div",{className:"asset-grid",children:[I?Array.from({length:8}).map((n,t)=>s.jsx("div",{className:"asset-card asset-card--skeleton"},`sk-${t}`)):d.map(n=>s.jsxs("article",{className:"asset-card asset-card--link",onClick:()=>j(z(n)),role:"link",tabIndex:0,onKeyDown:t=>{(t.key==="Enter"||t.key===" ")&&(t.preventDefault(),j(z(n)))},children:[s.jsx("div",{className:"asset-card__img",children:n.image?s.jsx("img",{src:n.image,alt:n.name}):null}),s.jsx("div",{className:"asset-card__name",title:n.name,children:n.name}),n.isOnSale?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"asset-card__listed",children:[s.jsxs("span",{className:"asset-card__price",children:[s.jsx(T,{className:"ccy-mark"})," ",n.listingPrice]}),s.jsx("span",{className:"badge",children:"On sale"})]}),s.jsx("button",{className:"btn btn--sm btn--ghost asset-card__remove",disabled:p===n.id||!n.tradeId,onClick:t=>{t.stopPropagation(),n.tradeId&&S(n.tradeId,n.name,n.id)},children:p===n.id?"Removing…":"Remove listing"})]}):s.jsx("button",{className:"btn btn--sm",onClick:t=>{t.stopPropagation(),P("Shop Started Listing",{listing_type:"secondary",item_id:n.itemId??n.tokenId??null}),_(n)},children:"Put on sale"})]},n.id)),E?Array.from({length:4}).map((n,t)=>s.jsx("div",{className:"asset-card asset-card--skeleton"},`msk-${t}`)):null]}),s.jsx(_e,{hasNextPage:K,isFetching:E,onLoadMore:()=>h()}),!I&&d.length===0?s.jsx("p",{className:"muted",children:"No items in your wardrobe yet."}):null]}),s.jsxs("div",{className:"myassets__section",children:[s.jsxs("div",{className:"myassets__section-head",children:[s.jsx("h2",{className:"myassets__section-title",children:"Your creations"}),s.jsxs("p",{className:"myassets__section-sub",children:["Items you made. Put them on sale in the Shop — set a price in ",C.name," and buyers pay with ",C.name,"."]})]}),ie?s.jsx("div",{className:"publish-grid",children:Array.from({length:4}).map((n,t)=>s.jsx("div",{className:"asset-card asset-card--skeleton"},`pub-sk-${t}`))}):re?s.jsx("p",{className:"publish-empty",children:"We couldn’t load your collections right now. Please try again in a moment."}):Y.length===0&&X.length===0?s.jsx("p",{className:"publish-empty",children:"You don’t have any items to publish yet."}):s.jsxs(s.Fragment,{children:[Y.length>0?s.jsxs("div",{className:"creations-collection",children:[s.jsx("h3",{className:"creations-collection__name",children:"On sale"}),s.jsx("div",{className:"publish-grid",children:Y.map(n=>{var t;return s.jsxs("article",{className:"publish-card publish-card--link",onClick:()=>j(F(n)),role:"link",tabIndex:0,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),j(F(n)))},children:[s.jsx("div",{className:"publish-card__img",children:n.thumbnail?s.jsx("img",{src:n.thumbnail,alt:n.name}):null}),s.jsx("div",{className:"publish-card__name",title:n.name,children:n.name}),s.jsxs("div",{className:"publish-card__listed",children:[s.jsxs("span",{className:"publish-card__price",children:[s.jsx(T,{className:"ccy-mark"})," ",((t=Q(n))==null?void 0:t.priceCredits)??0]}),s.jsx("span",{className:"badge",children:"On sale"})]}),s.jsx("button",{className:"btn btn--sm btn--ghost publish-card__cta",disabled:p===n.id,onClick:r=>{r.stopPropagation();const y=Q(n);y!=null&&y.tradeId&&S(y.tradeId,n.name,n.id)},children:p===n.id?"Removing…":"Remove listing"})]},`${n.contractAddress}-${n.blockchainItemId}`)})})]}):null,X.map(n=>s.jsxs("div",{className:"creations-collection",children:[s.jsx("h3",{className:"creations-collection__name",children:n.name}),s.jsx("div",{className:"publish-grid",children:n.items.map(t=>s.jsxs("article",{className:"publish-card publish-card--link",onClick:()=>j(F(t)),role:"link",tabIndex:0,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),j(F(t)))},children:[s.jsx("div",{className:"publish-card__img",children:t.thumbnail?s.jsx("img",{src:t.thumbnail,alt:t.name}):null}),s.jsx("div",{className:"publish-card__name",title:t.name,children:t.name}),s.jsxs("div",{className:"publish-card__meta",children:[s.jsx("span",{className:"publish-chip publish-chip--rarity",children:t.rarity}),s.jsxs("span",{className:"publish-card__supply",children:[t.remainingSupply.toLocaleString()," available"]})]}),s.jsx("button",{className:"btn btn--sm btn--purple publish-card__cta",onClick:r=>{r.stopPropagation(),P("Shop Started Listing",{listing_type:"primary",item_id:t.blockchainItemId}),N(t)},children:"Put on sale"})]},`${t.contractAddress}-${t.blockchainItemId}`))})]},n.id))]})]}),k?s.jsx(Ee,{asset:k,session:e,onClose:()=>_(null)}):null,u?s.jsx(Fe,{item:u,session:e,onClose:()=>N(null)}):null]}):s.jsxs("section",{className:"myassets",children:[s.jsx("h1",{children:"My Assets"}),s.jsx("p",{className:"muted",children:"Sign in to sell your items."}),s.jsx("div",{className:"connect-row",children:s.jsx("button",{className:"btn btn--purple",onClick:()=>a(),children:"Sign in"})}),i?s.jsx("p",{className:"error",children:i}):null]})}export{He as MyAssets};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,j as s,L as n}from"./react-E8ng6RF2.js";import{u as c,A as l}from"./index-
|
|
1
|
+
import{r as o,j as s,L as n}from"./react-E8ng6RF2.js";import{u as c,A as l}from"./index-C13awi5n.js";import{L as m}from"./LoadMore-DB6TwvRe.js";import"./ethers-DbXGgxrh.js";const i=24;function v(){const t=c(e=>Object.values(e.items)),[a,r]=o.useState(i);return t.length===0?s.jsxs("div",{className:"favorites-empty",children:[s.jsx("span",{className:"ico ico-heart favorites-empty__ico","aria-hidden":!0}),s.jsx("p",{className:"favorites-empty__title",children:"No favorites yet"}),s.jsx("p",{className:"muted",children:"Tap the heart on any item to save it here."}),s.jsx(n,{className:"btn btn--purple",to:"/assets",children:"Browse Collectibles"})]}):s.jsxs("section",{className:"favorites",children:[s.jsxs("div",{className:"favorites__head",children:[s.jsx("h1",{children:"My Favorites"}),s.jsxs("span",{className:"favorites__count",children:[t.length," item",t.length>1?"s":""]})]}),s.jsx("div",{className:"grid",children:t.slice(0,a).map(e=>s.jsx(l,{item:e},e.id))}),s.jsx(m,{hasNextPage:a<t.length,isFetching:!1,onLoadMore:()=>r(e=>e+i)})]})}export{v as MyFavorites};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,L as l}from"./react-E8ng6RF2.js";import{c as o,d as u,e as m,g as p,h as x}from"./index-
|
|
1
|
+
import{j as e,L as l}from"./react-E8ng6RF2.js";import{c as o,d as u,e as m,g as p,h as x}from"./index-C13awi5n.js";import{L as _}from"./LoadMore-DB6TwvRe.js";import{u as j}from"./useInfiniteGrid-et3T-1IY.js";import"./ethers-DbXGgxrh.js";const N=24;function g(s){try{return new Date(s).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function f({status:s}){return s==="PENDING"?e.jsx("span",{className:"purchase__badge purchase__badge--pending",children:"Processing"}):e.jsx("span",{className:"purchase__badge purchase__badge--done",children:"Completed"})}function y({purchase:s}){const{data:a}=m({queryKey:["trade-display",s.tradeId],queryFn:()=>x(s.tradeId),enabled:!!s.tradeId,staleTime:3e5}),t=(a==null?void 0:a.name)??"Item",i=(a==null?void 0:a.thumbnail)??"",n=(a==null?void 0:a.tokenId)??(a==null?void 0:a.itemId)??"",d=a!=null&&a.contractAddress&&n?`/item/${a.contractAddress}/${n}`:void 0,c=e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"purchase__thumb",children:i?e.jsx("img",{src:i,alt:t}):null}),e.jsxs("div",{className:"purchase__info",children:[e.jsx("div",{className:"purchase__name",title:t,children:t}),e.jsx("div",{className:"muted purchase__date",children:g(s.createdAt)})]}),e.jsx(f,{status:s.status}),e.jsxs("div",{className:"purchase__price",children:[e.jsx(p,{className:"ccy-mark"})," ",s.credits]})]});return d?e.jsx(l,{className:"purchase",to:d,children:c}):e.jsx("div",{className:"purchase",children:c})}function A(){const{session:s}=o(),{items:a,isLoading:t,hasNextPage:i,isFetchingNextPage:n,fetchNextPage:d}=j(["purchases",s==null?void 0:s.address],r=>u(s.address,s.identity,{first:N,skip:r}),{enabled:!!s});if(!s)return e.jsxs("div",{className:"purchases-empty",children:[e.jsx("span",{className:"ico ico-cart purchases-empty__ico","aria-hidden":!0}),e.jsx("p",{className:"purchases-empty__title",children:"Sign in to see your purchases"}),e.jsx("p",{className:"muted",children:"Your order history shows up here once you sign in."})]});const c=a.filter(r=>r.status!=="EXPIRED");return!t&&c.length===0?e.jsxs("div",{className:"purchases-empty",children:[e.jsx("span",{className:"ico ico-cart purchases-empty__ico","aria-hidden":!0}),e.jsx("p",{className:"purchases-empty__title",children:"No purchases yet"}),e.jsx("p",{className:"muted",children:"When you buy something it’ll appear here."}),e.jsx(l,{className:"btn btn--purple",to:"/assets",children:"Browse Collectibles"})]}):e.jsxs("section",{className:"purchases",children:[e.jsxs("div",{className:"purchases__head",children:[e.jsx("h1",{children:"My Purchases"}),t?null:e.jsxs("span",{className:"purchases__count",children:[c.length," order",c.length>1?"s":""]})]}),e.jsx("div",{className:"purchases__list",children:t?Array.from({length:4}).map((r,h)=>e.jsx("div",{className:"purchase purchase--skeleton"},h)):e.jsxs(e.Fragment,{children:[c.map(r=>e.jsx(y,{purchase:r},r.id)),n?Array.from({length:2}).map((r,h)=>e.jsx("div",{className:"purchase purchase--skeleton"},`m-${h}`)):null]})}),e.jsx(_,{hasNextPage:i,isFetching:n,onLoadMore:()=>d()})]})}export{A as MyPurchases};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{g as Ee,R as a,r as be,j as W}from"./react-E8ng6RF2.js";import{j as ke}from"./index-
|
|
1
|
+
import{g as Ee,R as a,r as be,j as W}from"./react-E8ng6RF2.js";import{j as ke}from"./index-C13awi5n.js";import"./ethers-DbXGgxrh.js";var q={exports:{}},D,V;function Pe(){if(V)return D;V=1;var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return D=n,D}var B,G;function we(){if(G)return B;G=1;var n=Pe();function e(){}function t(){}return t.resetWarningCache=e,B=function(){function r(u,s,c,y,f,S){if(S!==n){var m=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw m.name="Invariant Violation",m}}r.isRequired=r;function o(){return r}var i={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:t,resetWarningCache:e};return i.PropTypes=i,i},B}var J;function Re(){return J||(J=1,q.exports=we()()),q.exports}var xe=Re();const d=Ee(xe);var re="https://js.stripe.com/v3",je=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/;var Oe=function(){for(var e=document.querySelectorAll('script[src^="'.concat(re,'"]')),t=0;t<e.length;t++){var r=e[t];if(je.test(r.src))return r}return null},z=function(e){var t="",r=document.createElement("script");r.src="".concat(re).concat(t);var o=document.head||document.body;if(!o)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return o.appendChild(r),r},Te=function(e,t){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"4.6.0",startTime:t})},R=null,N=null,L=null,Ae=function(e){return function(){e(new Error("Failed to load Stripe.js"))}},Ne=function(e,t){return function(){window.Stripe?e(window.Stripe):t(new Error("Stripe.js not available"))}},Le=function(e){return R!==null?R:(R=new Promise(function(t,r){if(typeof window>"u"||typeof document>"u"){t(null);return}if(window.Stripe){t(window.Stripe);return}try{var o=Oe();if(!(o&&e)){if(!o)o=z(e);else if(o&&L!==null&&N!==null){var i;o.removeEventListener("load",L),o.removeEventListener("error",N),(i=o.parentNode)===null||i===void 0||i.removeChild(o),o=z(e)}}L=Ne(t,r),N=Ae(r),o.addEventListener("load",L),o.addEventListener("error",N)}catch(u){r(u);return}}),R.catch(function(t){return R=null,Promise.reject(t)}))},Ie=function(e,t,r){if(e===null)return null;var o=e.apply(void 0,t);return Te(o,r),o},x,ne=!1,oe=function(){return x||(x=Le(null).catch(function(e){return x=null,Promise.reject(e)}),x)};Promise.resolve().then(function(){return oe()}).catch(function(n){ne||console.warn(n)});var Ue=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];ne=!0;var o=Date.now();return oe().then(function(i){return Ie(i,t,o)})};function H(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(n);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(n,o).enumerable})),t.push.apply(t,r)}return t}function X(n){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?H(Object(t),!0).forEach(function(r){ie(n,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):H(Object(t)).forEach(function(r){Object.defineProperty(n,r,Object.getOwnPropertyDescriptor(t,r))})}return n}function I(n){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?I=function(e){return typeof e}:I=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I(n)}function ie(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function ae(n,e){return _e(n)||We(n,e)||qe(n,e)||De()}function _e(n){if(Array.isArray(n))return n}function We(n,e){var t=n&&(typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"]);if(t!=null){var r=[],o=!0,i=!1,u,s;try{for(t=t.call(n);!(o=(u=t.next()).done)&&(r.push(u.value),!(e&&r.length===e));o=!0);}catch(c){i=!0,s=c}finally{try{!o&&t.return!=null&&t.return()}finally{if(i)throw s}}return r}}function qe(n,e){if(n){if(typeof n=="string")return Q(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);if(t==="Object"&&n.constructor&&(t=n.constructor.name),t==="Map"||t==="Set")return Array.from(n);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Q(n,e)}}function Q(n,e){(e==null||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function De(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var C=function(e,t,r){var o=!!r,i=a.useRef(r);a.useEffect(function(){i.current=r},[r]),a.useEffect(function(){if(!o||!e)return function(){};var u=function(){i.current&&i.current.apply(i,arguments)};return e.on(t,u),function(){e.off(t,u)}},[o,t,e,i])},Y=function(e){var t=a.useRef(e);return a.useEffect(function(){t.current=e},[e]),t.current},w=function(e){return e!==null&&I(e)==="object"},Be=function(e){return w(e)&&typeof e.then=="function"},Me=function(e){return w(e)&&typeof e.elements=="function"&&typeof e.createToken=="function"&&typeof e.createPaymentMethod=="function"&&typeof e.confirmCardPayment=="function"},Z="[object Object]",Ye=function n(e,t){if(!w(e)||!w(t))return e===t;var r=Array.isArray(e),o=Array.isArray(t);if(r!==o)return!1;var i=Object.prototype.toString.call(e)===Z,u=Object.prototype.toString.call(t)===Z;if(i!==u)return!1;if(!i&&!r)return e===t;var s=Object.keys(e),c=Object.keys(t);if(s.length!==c.length)return!1;for(var y={},f=0;f<s.length;f+=1)y[s[f]]=!0;for(var S=0;S<c.length;S+=1)y[c[S]]=!0;var m=Object.keys(y);if(m.length!==s.length)return!1;var h=e,k=t,E=function(P){return n(h[P],k[P])};return m.every(E)},Fe=function(e,t,r){return w(e)?Object.keys(e).reduce(function(o,i){var u=!w(t)||!Ye(e[i],t[i]);return r.includes(i)?(u&&console.warn("Unsupported prop change: options.".concat(i," is not a mutable property.")),o):u?X(X({},o||{}),{},ie({},i,e[i])):o},null):null},ue="Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",ee=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ue;if(e===null||Me(e))return e;throw new Error(t)},$e=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ue;if(Be(e))return{tag:"async",stripePromise:Promise.resolve(e).then(function(o){return ee(o,t)})};var r=ee(e,t);return r===null?{tag:"empty"}:{tag:"sync",stripe:r}},Ke=function(e){!e||!e._registerWrapper||!e.registerAppInfo||(e._registerWrapper({name:"react-stripe-js",version:"2.8.1"}),e.registerAppInfo({name:"react-stripe-js",version:"2.8.1",url:"https://stripe.com/docs/stripe-js/react"}))},ce=a.createContext(null);ce.displayName="ElementsContext";var Ve=function(e,t){if(!e)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(t," in an <Elements> provider."));return e};d.any,d.object;d.func.isRequired;var se=a.createContext(null);se.displayName="CustomCheckoutSdkContext";var Ge=function(e,t){if(!e)throw new Error("Could not find CustomCheckoutProvider context; You need to wrap the part of your app that ".concat(t," in an <CustomCheckoutProvider> provider."));return e},Je=a.createContext(null);Je.displayName="CustomCheckoutContext";d.any,d.shape({clientSecret:d.string.isRequired,elementsOptions:d.object}).isRequired;var te=function(e){var t=a.useContext(se),r=a.useContext(ce);if(t&&r)throw new Error("You cannot wrap the part of your app that ".concat(e," in both <CustomCheckoutProvider> and <Elements> providers."));return t?Ge(t,e):Ve(r,e)},ze=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},p=function(e,t){var r="".concat(ze(e),"Element"),o=function(c){var y=c.id,f=c.className,S=c.options,m=S===void 0?{}:S,h=c.onBlur,k=c.onFocus,E=c.onReady,j=c.onChange,P=c.onEscape,le=c.onClick,pe=c.onLoadError,fe=c.onLoaderStart,me=c.onNetworksChange,he=c.onConfirm,ve=c.onCancel,Ce=c.onShippingAddressChange,ye=c.onShippingRateChange,O=te("mounts <".concat(r,">")),T="elements"in O?O.elements:null,A="customCheckoutSdk"in O?O.customCheckoutSdk:null,ge=a.useState(null),$=ae(ge,2),v=$[0],Se=$[1],b=a.useRef(null),U=a.useRef(null);C(v,"blur",h),C(v,"focus",k),C(v,"escape",P),C(v,"click",le),C(v,"loaderror",pe),C(v,"loaderstart",fe),C(v,"networkschange",me),C(v,"confirm",he),C(v,"cancel",ve),C(v,"shippingaddresschange",Ce),C(v,"shippingratechange",ye),C(v,"change",j);var _;E&&(e==="expressCheckout"?_=E:_=function(){E(v)}),C(v,"ready",_),a.useLayoutEffect(function(){if(b.current===null&&U.current!==null&&(T||A)){var g=null;A?g=A.createElement(e,m):T&&(g=T.create(e,m)),b.current=g,Se(g),g&&g.mount(U.current)}},[T,A,m]);var K=Y(m);return a.useEffect(function(){if(b.current){var g=Fe(m,K,["paymentRequest"]);g&&"update"in b.current&&b.current.update(g)}},[m,K]),a.useLayoutEffect(function(){return function(){if(b.current&&typeof b.current.destroy=="function")try{b.current.destroy(),b.current=null}catch{}}},[]),a.createElement("div",{id:y,className:f,ref:U})},i=function(c){te("mounts <".concat(r,">"));var y=c.id,f=c.className;return a.createElement("div",{id:y,className:f})},u=t?i:o;return u.propTypes={id:d.string,className:d.string,onChange:d.func,onBlur:d.func,onFocus:d.func,onReady:d.func,onEscape:d.func,onClick:d.func,onLoadError:d.func,onLoaderStart:d.func,onNetworksChange:d.func,onConfirm:d.func,onCancel:d.func,onShippingAddressChange:d.func,onShippingRateChange:d.func,options:d.object},u.displayName=r,u.__elementType=e,u},l=typeof window>"u",F=a.createContext(null);F.displayName="EmbeddedCheckoutProviderContext";var de=function(){var e=a.useContext(F);if(!e)throw new Error("<EmbeddedCheckout> must be used within <EmbeddedCheckoutProvider>");return e},He="Invalid prop `stripe` supplied to `EmbeddedCheckoutProvider`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.",Xe=function(e){var t=e.stripe,r=e.options,o=e.children,i=a.useMemo(function(){return $e(t,He)},[t]),u=a.useRef(null),s=a.useRef(null),c=a.useState({embeddedCheckout:null}),y=ae(c,2),f=y[0],S=y[1];a.useEffect(function(){if(!(s.current||u.current)){var k=function(j){s.current||u.current||(s.current=j,u.current=s.current.initEmbeddedCheckout(r).then(function(P){S({embeddedCheckout:P})}))};i.tag==="async"&&!s.current&&(r.clientSecret||r.fetchClientSecret)?i.stripePromise.then(function(E){E&&k(E)}):i.tag==="sync"&&!s.current&&(r.clientSecret||r.fetchClientSecret)&&k(i.stripe)}},[i,r,f,s]),a.useEffect(function(){return function(){f.embeddedCheckout?(u.current=null,f.embeddedCheckout.destroy()):u.current&&u.current.then(function(){u.current=null,f.embeddedCheckout&&f.embeddedCheckout.destroy()})}},[f.embeddedCheckout]),a.useEffect(function(){Ke(s)},[s]);var m=Y(t);a.useEffect(function(){m!==null&&m!==t&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the `stripe` prop after setting it.")},[m,t]);var h=Y(r);return a.useEffect(function(){if(h!=null){if(r==null){console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot unset options after setting them.");return}r.clientSecret===void 0&&r.fetchClientSecret===void 0&&console.warn("Invalid props passed to EmbeddedCheckoutProvider: You must provide one of either `options.fetchClientSecret` or `options.clientSecret`."),h.clientSecret!=null&&r.clientSecret!==h.clientSecret&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the client secret after setting it. Unmount and create a new instance of EmbeddedCheckoutProvider instead."),h.fetchClientSecret!=null&&r.fetchClientSecret!==h.fetchClientSecret&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change fetchClientSecret after setting it. Unmount and create a new instance of EmbeddedCheckoutProvider instead."),h.onComplete!=null&&r.onComplete!==h.onComplete&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onComplete option after setting it."),h.onShippingDetailsChange!=null&&r.onShippingDetailsChange!==h.onShippingDetailsChange&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onShippingDetailsChange option after setting it."),h.onLineItemsChange!=null&&r.onLineItemsChange!==h.onLineItemsChange&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onLineItemsChange option after setting it.")}},[h,r]),a.createElement(F.Provider,{value:f},o)},Qe=function(e){var t=e.id,r=e.className,o=de(),i=o.embeddedCheckout,u=a.useRef(!1),s=a.useRef(null);return a.useLayoutEffect(function(){return!u.current&&i&&s.current!==null&&(i.mount(s.current),u.current=!0),function(){if(u.current&&i)try{i.unmount(),u.current=!1}catch{}}},[i]),a.createElement("div",{ref:s,id:t,className:r})},Ze=function(e){var t=e.id,r=e.className;return de(),a.createElement("div",{id:t,className:r})},et=l?Ze:Qe;p("auBankAccount",l);p("card",l);p("cardNumber",l);p("cardExpiry",l);p("cardCvc",l);p("fpxBank",l);p("iban",l);p("idealBank",l);p("p24Bank",l);p("epsBank",l);p("payment",l);p("expressCheckout",l);p("currencySelector",l);p("paymentRequestButton",l);p("linkAuthentication",l);p("address",l);p("shippingAddress",l);p("paymentMethodMessaging",l);p("affirmMessage",l);p("afterpayClearpayMessage",l);let M=null;function tt(){return M||(M=Ue(ke.stripePublishableKey)),M}function it({clientSecret:n,onComplete:e}){const t=be.useMemo(()=>({clientSecret:n,onComplete:e}),[n,e]);return W.jsx("div",{className:"stripe-embed",children:W.jsx(Xe,{stripe:tt(),options:t,children:W.jsx(et,{})})})}export{it as RealCheckout,it as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as s,d as _,b as x,N as j}from"./react-E8ng6RF2.js";import{c as v,
|
|
1
|
+
import{j as s,d as _,b as x,N as j}from"./react-E8ng6RF2.js";import{c as v,I as N,W as h,B as i,j as t}from"./index-C13awi5n.js";import{s as g}from"./wallet-kind-BTWNHcc9.js";import"./ethers-DbXGgxrh.js";function b(){return s.jsxs("div",{className:"success-anim",role:"img","aria-label":"Purchase successful",children:[s.jsxs("svg",{className:"success-anim__svg",viewBox:"0 0 120 120",children:[s.jsx("circle",{className:"success-anim__ring",cx:"60",cy:"60",r:"54"}),s.jsx("path",{className:"success-anim__check",d:"M37 61 l16 16 l30 -34"})]}),s.jsx("span",{className:"success-anim__spark success-anim__spark--1","aria-hidden":!0,children:"✦"}),s.jsx("span",{className:"success-anim__spark success-anim__spark--2","aria-hidden":!0,children:"✦"}),s.jsx("span",{className:"success-anim__spark success-anim__spark--3","aria-hidden":!0,children:"◈"}),s.jsx("span",{className:"success-anim__spark success-anim__spark--4","aria-hidden":!0,children:"✦"})]})}const k=t.chainId===80002?"https://decentraland.zone/jump":"https://decentraland.org/jump",f=t.chainId===80002?"https://amoy.polygonscan.com/tx/":"https://polygonscan.com/tx/";function E(){const{state:c}=_(),o=x(),{session:a}=v(),r=(c==null?void 0:c.items)??[];if(r.length===0)return s.jsx(j,{to:"/assets",replace:!0});const e=r[0],d=(a==null?void 0:a.address)??"default",l=e.category==="emote",m=l?[]:r.map(N).filter(n=>!!n),u=c==null?void 0:c.txHash,p=!!u&&g(a==null?void 0:a.providerType);return s.jsxs("div",{className:"success",children:[s.jsx("div",{className:"success__preview",children:m.length>0?s.jsx(h,{profile:d,urns:m,type:i.PreviewType.AVATAR,emote:i.PreviewEmote.FASHION,background:"ecebed",dev:t.chainId===80002},e.id):s.jsx(h,{contractAddress:e.contractAddress,tokenId:e.tokenId??void 0,itemId:e.tokenId?void 0:e.itemId??void 0,profile:d,type:l?void 0:i.PreviewType.AVATAR,emote:l?void 0:i.PreviewEmote.FASHION,background:"ecebed",dev:t.chainId===80002},e.id)}),s.jsxs("div",{className:"success__panel",children:[s.jsx(b,{}),s.jsx("h1",{className:"success__title",children:"It’s yours!"}),r.length===1?s.jsxs("p",{className:"success__sub",children:[s.jsx("strong",{children:e.name})," is now in your wardrobe."]}):s.jsxs(s.Fragment,{children:[s.jsxs("p",{className:"success__sub",children:[r.length," items are now in your wardrobe."]}),s.jsx("ul",{className:"success__list",children:r.map(n=>s.jsx("li",{children:n.name},n.id))})]}),s.jsxs("div",{className:"success__links",children:[s.jsx("button",{className:"success__receipt",onClick:()=>o("/my-purchases"),children:"View order"}),p?s.jsx("a",{className:"success__receipt",href:`${f}${u}`,target:"_blank",rel:"noreferrer",children:"View transaction ↗"}):null]}),s.jsxs("div",{className:"success__actions",children:[s.jsx("a",{className:"btn btn--purple",href:k,target:"_blank",rel:"noreferrer",children:"Use it in-world"}),s.jsx("button",{className:"btn btn--ghost",onClick:()=>o("/assets"),children:"Keep shopping"})]})]})]})}export{E as Success,E as default};
|