@dcl/shop 0.1.0-28716682285.commit-81d5035 → 0.1.0-28716868442.commit-8bfb3b0
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-DZF_BGDq.js → Assets-nmQB2810.js} +1 -1
- package/assets/Cart-CVq8ErN4.js +1 -0
- package/assets/{Collection-C7QMeo-8.js → Collection-DrWaGsbD.js} +1 -1
- package/assets/{Creator-DalHYmPv.js → Creator-CODX4HY-.js} +1 -1
- package/assets/{ExchangeController-CR_0ng5W.js → ExchangeController-DGYlS1u1.js} +1 -1
- package/assets/GetCredits-BJ-vtPKx.js +2 -0
- package/assets/{HelpersUtil-CfV3xayn.js → HelpersUtil-Cs7A9lff.js} +1 -1
- package/assets/ImportListings-DWEJuGBQ.js +1 -0
- package/assets/ItemDetail-CLZiYPr_.js +1 -0
- package/assets/{Market-Cggj0BCU.js → Market-C5YZkU0k.js} +1 -1
- package/assets/MyAssets-DiQ1f-Nx.js +1 -0
- package/assets/{MyFavorites-DUAHlk2T.js → MyFavorites-D2neF-WT.js} +1 -1
- package/assets/{MyPurchases-DAwS8VjK.js → MyPurchases-CX-sT4T9.js} +1 -1
- package/assets/{RealCheckout-BtdQ4wYN.js → RealCheckout-DVYTPQMi.js} +1 -1
- package/assets/{Success-CXbDOKvL.js → Success-Dty0MEac.js} +1 -1
- package/assets/{SwapController-jQKmoGp2.js → SwapController-CTsLqo0R.js} +1 -1
- package/assets/{TradeService-qV7BPpRs.js → TradeService-Co6yXz1n.js} +1 -1
- package/assets/{W3MFrameProviderSingleton-DyH4u3WJ.js → W3MFrameProviderSingleton-DBf03HGk.js} +3 -3
- package/assets/{WebCryptoP256-DAh3RA9Y.js → WebCryptoP256-BMVi41Tf.js} +1 -1
- package/assets/{basic-Xr6dWq86.js → basic-BKlH1yZE.js} +1 -1
- package/assets/{biconomy-CkHCPJwz.js → biconomy-BuC8Y20q.js} +1 -1
- package/assets/{buy-gasless-CyxaR54s.js → buy-gasless-EwLKJESl.js} +1 -1
- package/assets/{buy-BDt3qh_Q.js → buy-qVYsiH8c.js} +1 -1
- package/assets/{ccip-xXRTc90o.js → ccip-BXAlyEXK.js} +1 -1
- package/assets/{ccip-BQIKnazd.js → ccip-BhXlCEl_.js} +1 -1
- package/assets/{collection-x0DaoqN4.js → collection-yK7CsBpq.js} +1 -1
- package/assets/{controller-xFYZ2tIS.js → controller-D31V5T7x.js} +2 -2
- package/assets/{core-BKZ4YKYj.js → core-HiY9JG8Q.js} +4 -4
- package/assets/{custom-DGEuqAtF.js → custom-CNeK1SBe.js} +1 -1
- package/assets/{data-capture-DpMm1B-r.js → data-capture-BGCV8f_8.js} +1 -1
- package/assets/decimals-690uYbRk.js +1 -0
- package/assets/{decimals-9X9HFAfo.js → decimals-eyiqtEAM.js} +1 -1
- package/assets/{detectExtension-D_FUQ2kn.js → detectExtension-HGgsLFYa.js} +1 -1
- package/assets/{email-8VZFOLCd.js → email-D3mSaTDc.js} +1 -1
- package/assets/{embedded-wallet-i0dfZ3jn.js → embedded-wallet-BIpOn63k.js} +1 -1
- package/assets/{engine-Cz8a0LUY.js → engine-Cp4bGvGY.js} +1 -1
- package/assets/{estimate-l1-fee-CeaPum-g.js → estimate-l1-fee-DqCr-VRj.js} +1 -1
- package/assets/{eth_estimateGas-Ch2Qo3Ym.js → eth_estimateGas-Btj3BdU3.js} +1 -1
- package/assets/{eth_getStorageAt-D6WJN9sx.js → eth_getStorageAt-cAsXEzwb.js} +1 -1
- package/assets/{eth_getTransactionCount-BRWa6Gde.js → eth_getTransactionCount-9mRngMvR.js} +1 -1
- package/assets/{extractIPFS-VtWbdMOz.js → extractIPFS-Cos3MMqA.js} +1 -1
- package/assets/{features-CkL7kILZ.js → features-CS9ITEyv.js} +1 -1
- package/assets/{fetchTokenMetadata-BXmwN0lx.js → fetchTokenMetadata--27nDLvT.js} +2 -2
- package/assets/{get-ecosystem-wallet-info-VhSMDJcW.js → get-ecosystem-wallet-info-DsGpr1v9.js} +1 -1
- package/assets/{getBalance-CMO7qPbW.js → getBalance-C1EIeWK3.js} +1 -1
- package/assets/{getInstalledModules-C8ciIxny.js → getInstalledModules-CSy_anIJ.js} +1 -1
- package/assets/{getNFT-BobGZ6K9.js → getNFT-Biv4Mkbw.js} +1 -1
- package/assets/{getNFT-CXOP2pMP.js → getNFT-C3k4-I_M.js} +2 -2
- package/assets/{hashTypedData-DvxOZf8f.js → hashTypedData-D-eX1daT.js} +1 -1
- package/assets/{hashTypedData-BYzWFHY1.js → hashTypedData-DCkFFbNQ.js} +1 -1
- package/assets/{import-MraNS_pv.js → import-DjExR-_c.js} +1 -1
- package/assets/{in-app-wallet-calls-CSBUm0WX.js → in-app-wallet-calls-BsZ7t_xW.js} +1 -1
- package/assets/{index-07l384vR.js → index-0QSHJ5kM.js} +1 -1
- package/assets/{index-R06QFYVY.js → index-B-iF1tO2.js} +1 -1
- package/assets/{index-PJXSqGcO.js → index-B91_eufC.js} +1 -1
- package/assets/{index-DPiqU2Qi.js → index-BBWsjtyi.js} +1 -1
- package/assets/{index-CnuiHcBF.js → index-BDnsSs1l.js} +1 -1
- package/assets/{index-BLDgd2FN.js → index-BEDCm9Wu.js} +1 -1
- package/assets/{index-CVqa84jW.js → index-BP1BUYI1.js} +1 -1
- package/assets/{index-Lqy4HRG5.js → index-BSTJA_7O.js} +2 -2
- package/assets/{index-BISQjaPy.js → index-BTkTkfcn.js} +1 -1
- package/assets/{index-CQjEYJsK.js → index-BbTcdIk0.js} +1 -1
- package/assets/{index-DXkd_D0R.js → index-BgPhxGKT.js} +1 -1
- package/assets/{index-CeOCXdzw.js → index-BkdaY7_G.js} +3 -3
- package/assets/{index-CZGhYHpa.js → index-BnFty3Li.js} +1 -1
- package/assets/{index-BVdflf99.js → index-BoJsJx--.js} +1 -1
- package/assets/{index-BvM6IpIn.js → index-Brg6cgDQ.js} +1 -1
- package/assets/{index-BEs7D61b.js → index-C0nXxFCO.js} +1 -1
- package/assets/{index-Bo1wSLQe.js → index-CJEb8Kzs.js} +1 -1
- package/assets/{index-C9CXoAJ2.js → index-CLE07-_x.js} +1 -1
- package/assets/{index-CsKQpaxl.js → index-CLXqEKlA.js} +1 -1
- package/assets/{index-B0b2BDzP.js → index-CLkVyB5o.js} +1 -1
- package/assets/{index-BfPP6XcF.js → index-CLy-wBAP.js} +2 -2
- package/assets/{index-Bi33Lec8.js → index-CQtzuPXx.js} +1 -1
- package/assets/{index-BfbFKF-_.js → index-CWRbefrn.js} +1 -1
- package/assets/{index-BOBTvczf.js → index-CWgv2cWv.js} +1 -1
- package/assets/{index-XN4xrhWa.js → index-CXiOQLIu.js} +1 -1
- package/assets/{index-CT8vHTeA.js → index-CdcrnJ5_.js} +1 -1
- package/assets/{index-DD9FbX3n.js → index-Cj7vACZe.js} +1 -1
- package/assets/{index-MrzRV9Q8.js → index-Cmk_xiBk.js} +1 -1
- package/assets/{index-C62Ww3lh.js → index-CqIROolS.js} +1 -1
- package/assets/{index-BTPsPO-G.js → index-CrBV_1yu.js} +1 -1
- package/assets/{index-Dxonssii.js → index-CyqLliR_.js} +3 -3
- package/assets/{index-C73nwsCH.js → index-D-S19rzI.js} +1 -1
- package/assets/{index-CbSQFzfb.js → index-D1cUVAY6.js} +1 -1
- package/assets/{index-C6XcSqXs.js → index-D5uLI4BM.js} +1 -1
- package/assets/{index-BmYqfzkI.js → index-DDLsPu5_.js} +12 -12
- package/assets/{index-CnG74PqV.js → index-DGoPqCsR.js} +1 -1
- package/assets/{index-DZoe-51F.js → index-DOExxORl.js} +1 -1
- package/assets/{index-Dgb5np7p.js → index-DUVY_38U.js} +1 -1
- package/assets/{index-BmNZbfHe.js → index-DccLoKMC.js} +2 -2
- package/assets/{index-FroDaHJR.js → index-DgAZv7hc.js} +1 -1
- package/assets/{index-B_00Os6M.js → index-DpcKgN-v.js} +1 -1
- package/assets/{index-A9JhdvF3.js → index-DquEMs4O.js} +1 -1
- package/assets/{index-BAagTwYN.js → index-KarPC4Z4.js} +1 -1
- package/assets/{index-Dhf1C0Kj.js → index-NdfBDpoO.js} +1 -1
- package/assets/{index-yUE19psb.js → index-Xk2toQGa.js} +1 -1
- package/assets/{index-ChQpTYWw.js → index-XzW65SVh.js} +1 -1
- package/assets/{index-D9se8tx4.js → index-cWedEEGZ.js} +1 -1
- package/assets/{index-CKmLGQME.js → index-kpX0X-RL.js} +1 -1
- package/assets/{index--3veqSx1.js → index-m9UlXIqW.js} +1 -1
- package/assets/{index-ChHoaBBu.js → index-xmSB5b1v.js} +1 -1
- package/assets/{index-CV6GodQX.js → index-zhHTnO6h.js} +1 -1
- package/assets/{index.es-Bzum_YS0.js → index.es-BtrYS_gk.js} +4 -4
- package/assets/{index.es-C0jq0YX8.js → index.es-CFwo152a.js} +1 -1
- package/assets/{index.es-CfPSe5Iz.js → index.es-Cw0Wg8zr.js} +1 -1
- package/assets/{localBatchGatewayRequest-BnMlZrXd.js → localBatchGatewayRequest-W5wM5RIw.js} +1 -1
- package/assets/{mana-rate-XfDebPT_.js → mana-rate-D91Nq-wO.js} +1 -1
- package/assets/network-ivZE_UMc.js +1 -0
- package/assets/{networks-DEhdIFNC.js → networks-DLxu9QYW.js} +1 -1
- package/assets/{onramp-C3j52sn0.js → onramp-DjMFTSAW.js} +1 -1
- package/assets/{openzeppelin-BTTAmnTW.js → openzeppelin-2ZkXoMQF.js} +1 -1
- package/assets/{ownerOf-RMAXTCdV.js → ownerOf-BAgrPslR.js} +1 -1
- package/assets/{parseNft-VKRkeiLD.js → parseNft-xmwbSwKx.js} +2 -2
- package/assets/{parseSignature-D30lji4A.js → parseSignature-DS_qYYXg.js} +3 -3
- package/assets/{parseSignature-CGlxNo0q.js → parseSignature-Dfqx4qdB.js} +1 -1
- package/assets/{pay-with-exchange-BvYYQIth.js → pay-with-exchange-BfqKWl-i.js} +1 -1
- package/assets/{qr-overlay-17TocZNH.js → qr-overlay-CuzJkOyH.js} +1 -1
- package/assets/{receive-C68u0-IH.js → receive-BXV5EvIe.js} +1 -1
- package/assets/{resolveImplementation-DfcgAZ7i.js → resolveImplementation-Cp1kSEV-.js} +1 -1
- package/assets/{rpc-BmefAEZX.js → rpc-Dtax0ZGB.js} +1 -1
- package/assets/{secp256k1-BJfT_BJS.js → secp256k1-C95i4S9L.js} +1 -1
- package/assets/{secp256k1-BO5hBgBV.js → secp256k1-D8wYY9C6.js} +1 -1
- package/assets/{secp256k1-DMHqss-g.js → secp256k1-yf38iHjx.js} +1 -1
- package/assets/{send-UIx8SeHj.js → send-bACcTxXh.js} +1 -1
- package/assets/{send-batch-transaction-CBhZSE7o.js → send-batch-transaction-vUlQ3f8W.js} +1 -1
- package/assets/{send-eip712-transaction-CYSTjMP2.js → send-eip712-transaction-BAhg0sSO.js} +2 -2
- package/assets/{send-gasless-transaction-DwC-e3jQ.js → send-gasless-transaction-Bbc--ckt.js} +2 -2
- package/assets/{sendRawTransaction-B_tunbjM.js → sendRawTransaction-Cn-exoEI.js} +3 -3
- package/assets/{serializeTransaction-DvYsEu0f.js → serializeTransaction-CI3T0WRP.js} +1 -1
- package/assets/{session-proposal-D-hIho9_.js → session-proposal-D0XHSqV_.js} +1 -1
- package/assets/{session-request-DD56Mdft.js → session-request-BsTTXWj7.js} +2 -2
- package/assets/{sha256-D-iwlmab.js → sha256-DMkvy9Cz.js} +1 -1
- package/assets/{signing-Cs3KRA5P.js → signing-DeH43Aaw.js} +4 -4
- package/assets/{socials-BNBBd15t.js → socials-D-IAo2yx.js} +1 -1
- package/assets/{swaps-Cm5YfdSu.js → swaps-BWMX0U3I.js} +1 -1
- package/assets/{thirdweb-C9J5fNOj.js → thirdweb-iPhsIfpR.js} +3 -3
- package/assets/{totalSupply-C8BmQbty.js → totalSupply-CSwsdpN_.js} +1 -1
- package/assets/{transactionReceipt-Bf7wcNWm.js → transactionReceipt-U1NdpKCV.js} +1 -1
- package/assets/{transactions-CuXfm9a0.js → transactions-BkfWn19q.js} +1 -1
- package/assets/{useInfiniteGrid-BM3TcyEh.js → useInfiniteGrid-6pBFQ8Kh.js} +1 -1
- package/assets/{verifyHash-1pRB3CwV.js → verifyHash-C7RY1nlI.js} +1 -1
- package/assets/{w3m-modal-Cml_eV0H.js → w3m-modal-1UZQLvps.js} +1 -1
- package/assets/{w3m-modal-B1-SYsNz.js → w3m-modal-DMTcXY8g.js} +1 -1
- package/assets/{wait-for-tx-receipt-Bd0-eoIT.js → wait-for-tx-receipt-Dy501zTV.js} +1 -1
- package/assets/{wallet-kind-Dt8fQXzn.js → wallet-kind-By432Wm8.js} +1 -1
- package/assets/{wallets-D8fixhFd.js → wallets-DpuodgNe.js} +6 -6
- package/assets/{web-connector-Cr9k7RR3.js → web-connector-C0IKOCFh.js} +3 -3
- package/assets/{writeContract-ZNyMwark.js → writeContract-B_fZae2g.js} +1 -1
- package/assets/{zoraTestnet-CzFN1G81.js → zoraTestnet-DBtbozoi.js} +1 -1
- package/index.html +8 -8
- package/package.json +2 -2
- package/assets/Cart-4PH7DZlC.js +0 -1
- package/assets/GetCredits-BY6Izy9M.js +0 -2
- package/assets/ImportListings-CHMxShJz.js +0 -1
- package/assets/ItemDetail-C6PGxnP4.js +0 -1
- package/assets/MyAssets-BlcOdmvf.js +0 -1
- package/assets/decimals-DpVCb2xf.js +0 -1
- package/assets/network-flD-kLcV.js +0 -1
package/index.html
CHANGED
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
<link rel="canonical" href="https://shop.decentraland.zone/" />
|
|
17
17
|
|
|
18
18
|
<!-- Favicon: the Decentraland mark (same as the marketplace). -->
|
|
19
|
-
<link rel="icon" type="image/x-icon" href="https://cdn.decentraland.org/@dcl/shop/0.1.0-
|
|
20
|
-
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.decentraland.org/@dcl/shop/0.1.0-
|
|
19
|
+
<link rel="icon" type="image/x-icon" href="https://cdn.decentraland.org/@dcl/shop/0.1.0-28716868442.commit-8bfb3b0/favicon.ico" sizes="16x16 32x32 48x48" />
|
|
20
|
+
<link rel="apple-touch-icon" sizes="180x180" href="https://cdn.decentraland.org/@dcl/shop/0.1.0-28716868442.commit-8bfb3b0/apple-touch-icon.png" />
|
|
21
21
|
<meta name="apple-mobile-web-app-title" content="DCL Shop" />
|
|
22
|
-
<link rel="manifest" href="https://cdn.decentraland.org/@dcl/shop/0.1.0-
|
|
22
|
+
<link rel="manifest" href="https://cdn.decentraland.org/@dcl/shop/0.1.0-28716868442.commit-8bfb3b0/site.webmanifest" />
|
|
23
23
|
|
|
24
24
|
<!-- Open Graph -->
|
|
25
25
|
<meta property="og:type" content="website" />
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
<meta name="twitter:image:alt" content="Decentraland Shop — wearables and emotes for your avatar" />
|
|
49
49
|
|
|
50
50
|
<!-- Sitemap -->
|
|
51
|
-
<link rel="sitemap" type="application/xml" title="Sitemap" href="https://cdn.decentraland.org/@dcl/shop/0.1.0-
|
|
51
|
+
<link rel="sitemap" type="application/xml" title="Sitemap" href="https://cdn.decentraland.org/@dcl/shop/0.1.0-28716868442.commit-8bfb3b0/sitemap.xml" />
|
|
52
52
|
|
|
53
53
|
<!-- Warm the 3D preview / fonts -->
|
|
54
54
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
@@ -60,10 +60,10 @@
|
|
|
60
60
|
<link rel="preconnect" href="https://wearable-preview.decentraland.org" />
|
|
61
61
|
<link rel="preconnect" href="https://peer.decentraland.zone" crossorigin />
|
|
62
62
|
<link rel="preconnect" href="https://peer.decentraland.org" crossorigin />
|
|
63
|
-
<script type="module" crossorigin src="https://cdn.decentraland.org/@dcl/shop/0.1.0-
|
|
64
|
-
<link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/shop/0.1.0-
|
|
65
|
-
<link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/shop/0.1.0-
|
|
66
|
-
<link rel="stylesheet" crossorigin href="https://cdn.decentraland.org/@dcl/shop/0.1.0-
|
|
63
|
+
<script type="module" crossorigin src="https://cdn.decentraland.org/@dcl/shop/0.1.0-28716868442.commit-8bfb3b0/assets/index-DDLsPu5_.js"></script>
|
|
64
|
+
<link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/shop/0.1.0-28716868442.commit-8bfb3b0/assets/react-E8ng6RF2.js">
|
|
65
|
+
<link rel="modulepreload" crossorigin href="https://cdn.decentraland.org/@dcl/shop/0.1.0-28716868442.commit-8bfb3b0/assets/ethers-BxoDGoYp.js">
|
|
66
|
+
<link rel="stylesheet" crossorigin href="https://cdn.decentraland.org/@dcl/shop/0.1.0-28716868442.commit-8bfb3b0/assets/index-xq0r0dow.css">
|
|
67
67
|
</head>
|
|
68
68
|
<body>
|
|
69
69
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/shop",
|
|
3
|
-
"version": "0.1.0-
|
|
3
|
+
"version": "0.1.0-28716868442.commit-8bfb3b0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"author": "Decentraland",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "git+https://github.com/decentraland/shop.git"
|
|
10
10
|
},
|
|
11
|
-
"commit": "
|
|
11
|
+
"commit": "8bfb3b031970bc699938feab7aed37b5738e8860"
|
|
12
12
|
}
|
package/assets/Cart-4PH7DZlC.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as z,r as j,j as e,L as T}from"./react-E8ng6RF2.js";import{j as _,c as B,e as L,k as Q,l as K,C as d,t as b,m as q,h as W,n as $,o as A,q as M,r as H,s as V,v as D,w as J,f as O}from"./index-BmYqfzkI.js";import{f as I}from"./buy-BDt3qh_Q.js";import{g as X,b as Z,w as ee,G as se}from"./buy-gasless-CyxaR54s.js";import"./ethers-BxoDGoYp.js";import"./index-07l384vR.js";function ae(a){const o=a,l=(o.message??"").toLowerCase();return o.code===4001||l.includes("reject")||l.includes("denied")||l.includes("cancel")?"You cancelled the request.":l.includes("insufficient")?`You don't have enough ${d.name} — get more first.`:l.includes("no active listing")?o.message:"Couldn't complete checkout — please try again."}function te(a){return J(a.received[0].amount)}function oe(){const a=_(s=>s.items),o=_(s=>s.remove),l=_(s=>s.clear),P=_(s=>s.add),{session:t}=B(),{data:y}=L({queryKey:["upsell-listings"],queryFn:()=>O({first:40}),staleTime:6e4}),{data:n}=Q(t),v=K(),F=z(),[g,h]=j.useState(null),[N,f]=j.useState(null),[p,C]=j.useState(!1),u=a.reduce((s,m)=>s+m.priceCredits,0),U=new Set(a.map(s=>s.id)),w=((y==null?void 0:y.items)??[]).filter(s=>!U.has(s.id)).slice(0,6);async function Y(){if(!t){f("Sign in to check out.");return}f(null),C(!0),b("Shop Started Checkout",{cart_size:a.length,cart_value_credits:u,cart_value_usd:q(u),has_sufficient_credits:((n==null?void 0:n.credits)??0)>=u});const s=a.slice(),m=[];let k="authorize",S=!1;try{h("Preparing your order…");const c=[];for(const r of a){const x=r.tradeId?await W(r.tradeId):await $(r.contractAddress,r.itemId??"");if(!x)throw new Error(`No active listing for ${r.name}.`);const G=te(x),{credit:E,maxCreditedValue:R}=await A(t.identity,G,r.tradeId);m.push(E.id),c.push({trade:x,credits:[E],maxCreditedValue:R})}h("Confirming your purchase…"),k="submit";let i=[];if(X())try{i=await Z({purchases:c,buyer:t.address,signer:t.signer}),await Promise.all(i.map(r=>ee(r))),S=!0}catch(r){if(!(r instanceof se))throw r;i=await I({purchases:c,buyer:t.address,signer:t.signer})}else i=await I({purchases:c,buyer:t.address,signer:t.signer});l(),h("Purchased! 🎉"),b("Shop Completed Purchase",{...M(s),payment_type:"credits",no_crypto_step:S,transaction_hash:i[0]??null}),v.invalidateQueries({queryKey:["usd-balance"]}),F("/success",{state:{items:s,txHash:i[0]}})}catch(c){if(console.error("[checkout] failed",c),b(V(c)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:k,error_code:H(c),value_usd:q(u),cart_size:a.length}),m.length){try{await D(t.identity,m)}catch(i){console.error("[checkout] release failed",i)}v.invalidateQueries({queryKey:["usd-balance"]})}f(ae(c)),h(null)}finally{C(!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 the shop"})]}):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}),e.jsx("div",{className:"muted",children:s.creator?`By ${s.creator}`:""})]}),e.jsxs("div",{className:"cart__price",children:[d.symbol," ",s.priceCredits]}),e.jsx("button",{className:"link",onClick:()=>o(s.id),disabled:p,children:"Remove"})]},s.id))}),e.jsxs("div",{className:"cart__foot",children:[e.jsxs("div",{className:"cart__total",children:[e.jsxs("div",{children:["Total ",e.jsxs("strong",{children:[d.symbol," ",u]})]}),t?e.jsxs("div",{className:"muted cart__balance",children:["Your balance: ",d.symbol," ",(n==null?void 0:n.credits)??0]}):null]}),e.jsxs("div",{className:"cart__actions",children:[e.jsxs(T,{className:"btn btn--ghost",to:"/credits",children:["Get ",d.name]}),null,e.jsx("button",{className:"btn btn--ghost",onClick:l,disabled:p,children:"Clear"}),e.jsx("button",{className:"btn btn--purple",onClick:Y,disabled:p,children:"Checkout"})]})]}),g?e.jsx("p",{className:"muted",style:{marginTop:12},children:g}):null,N?e.jsx("p",{className:"error",style:{marginTop:12},children:N}):null,w.length>0?e.jsxs("div",{className:"cart-upsell",children:[e.jsx("h2",{className:"cart-upsell__title",children:"You might also like"}),e.jsx("div",{className:"cart-upsell__row",children:w.map(s=>e.jsxs("div",{className:"cart-upsell__card",children:[e.jsx("div",{className:"cart-upsell__thumb",children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null}),e.jsx("div",{className:"cart-upsell__name",title:s.name,children:s.name}),e.jsxs("div",{className:"cart-upsell__price",children:[d.symbol," ",s.priceCredits]}),e.jsx("button",{className:"btn btn--sm cart-upsell__add",onClick:()=>P(s,"upsell"),disabled:p,children:"Add"})]},s.id))})]}):null]})}export{oe as Cart};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/RealCheckout-BtdQ4wYN.js","assets/react-E8ng6RF2.js","assets/index-BmYqfzkI.js","assets/ethers-BxoDGoYp.js","assets/index-xq0r0dow.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{G as M,c as B,l as T,t as p,r as b,C as u,E as D,H as S,_ as V}from"./index-BmYqfzkI.js";import{b as A,r as o,j as e}from"./react-E8ng6RF2.js";import{C as f}from"./CircularProgress-D-iaLmF3.js";import"./ethers-BxoDGoYp.js";import"./generateUtilityClasses-sji8XAMf.js";const F=.1,w=[{id:"pack_5",usd:5,credits:x(5)},{id:"pack_10",usd:10,credits:x(10)},{id:"pack_25",usd:25,credits:x(25),bestValue:!0},{id:"pack_50",usd:50,credits:x(50)}];function x(t){return Math.round(t/F)}function E(t){return w.find(s=>s.id===t)}const y="mock_cs_";function U(){return!0}async function Y(t,s){const a=E(t);if(!a)throw new Error("Unknown pack");return q(a)}async function z(t,s={}){const{intervalMs:a,timeoutMs:c,signal:n,identity:i}=s;if(t.startsWith(y)||U())return K(t,s)}function q(t){const s=`${y}${t.id}_${Date.now()}`;return P(400).then(()=>({orderId:s,clientSecret:`${y}${t.id}`,mock:!0}))}async function K(t,s={}){await P(s.intervalMs??900);const a=t.replace(y,"").replace(/_\d+$/,""),c=E(a),n=(c==null?void 0:c.credits)??0;if(s.address&&c)try{const i=await M(s.address,Math.round(c.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 P(t,s){return new Promise((a,c)=>{setTimeout(a,t)})}const k="mock",L=o.lazy(()=>V(()=>import("./RealCheckout-BtdQ4wYN.js"),__vite__mapDeps([0,1,2,3,4])));function v(t){const s=t;if((s==null?void 0:s.name)==="AbortError")return"You cancelled the request.";const a=((s==null?void 0:s.message)??"").toLowerCase();return a.includes("sign in")?`Sign in to get ${u.name}.`:a.includes("timed out")?`This is taking longer than usual — your ${u.name} will appear shortly.`:"Couldn't complete your purchase — please try again."}function se(){const t=A(),{session:s,signIn:a}=B(),c=T(),[n,i]=o.useState("select"),[r,_]=o.useState(null),[m,C]=o.useState(null),[$,N]=o.useState(null),[G,h]=o.useState(null),j=o.useRef(null);o.useEffect(()=>()=>{var d;return(d=j.current)==null?void 0:d.abort()},[]);const R=o.useCallback(async d=>{if(!s){a();return}h(null),_(d),i("paying"),p("Shop Started Buy Credits",{pack_usd:d.usd,credits:d.credits,provider:k});try{const l=await Y(d.id,{address:s.address,identity:s.identity});C(l)}catch(l){console.error(l),p("Shop Buy Credits Failed",{step:"checkout",error_code:b(l),pack_usd:d.usd}),h(v(l)),i("error")}},[s,a]),I=o.useCallback(async()=>{if(!m)return;i("processing");const d=new AbortController;j.current=d;try{const l=await z(m.orderId,{signal:d.signal,address:s==null?void 0:s.address,identity:s==null?void 0:s.identity});l.status==="credited"?(N(l.creditsGranted??(r==null?void 0:r.credits)??0),i("success"),p("Shop Completed Buy Credits",{order_id:m.orderId,pack_usd:(r==null?void 0:r.usd)??null,credits:l.creditsGranted??(r==null?void 0:r.credits)??0,provider:k}),c.invalidateQueries({queryKey:["usd-balance"]})):(p("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(r==null?void 0:r.usd)??null}),h(l.error??`Couldn't add your ${u.name} — please try again.`),i("error"))}catch(l){console.error(l),p("Shop Buy Credits Failed",{step:"grant",error_code:b(l),pack_usd:(r==null?void 0:r.usd)??null}),h(v(l)),i("error")}},[m,r,s,c]);function g(){var d;(d=j.current)==null||d.abort(),i("select"),_(null),C(null),N(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(O,{onSelect:R}),n==="paying"&&r&&e.jsx(Q,{pack:r,checkout:m,onPaid:I,onCancel:g}),n==="processing"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(f,{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:[u.symbol," ",$]})," ",u.name," added to your account."]}),e.jsxs("div",{className:"getcredits__status-actions",children:[e.jsx("button",{className:"btn",onClick:()=>t("/cart"),children:"Back to cart"}),e.jsxs("button",{className:"btn btn--ghost",onClick: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:G}),e.jsx("div",{className:"getcredits__status-actions",children:e.jsx("button",{className:"btn",onClick:g,children:"Try again"})})]})]})}function O({onSelect:t}){return e.jsx("div",{className:"packs",children:w.map(s=>e.jsxs("button",{type:"button",className:`pack${s.bestValue?" pack--best":""}`,onClick:()=>t(s),"aria-label":`Get ${S(s.credits)} for $${s.usd}`,children:[s.bestValue&&e.jsx("span",{className:"pack__ribbon",children:"Best value"}),e.jsxs("span",{className:"pack__credits",children:[e.jsx(D,{className:"pack__credits-ico"}),s.credits]}),e.jsx("span",{className:"pack__label",children:u.name}),e.jsxs("span",{className:"pack__price",children:["$",s.usd]}),e.jsxs("span",{className:"pack__cta",children:["Get ",u.name]})]},s.id))})}function Q({pack:t,checkout:s,onPaid:a,onCancel:c}){return e.jsxs("div",{className:"pay",children:[e.jsxs("div",{className:"pay__summary",children:[e.jsx("button",{className:"link",onClick:c,children:"← Choose a different pack"}),e.jsxs("div",{className:"pay__summary-row",children:[e.jsx("span",{children:"You’ll get"}),e.jsxs("strong",{children:[u.symbol," ",S(t.credits)]})]}),e.jsxs("div",{className:"pay__summary-row pay__summary-row--total",children:[e.jsx("span",{children:"You pay"}),e.jsxs("strong",{children:["$",t.usd]})]})]}),e.jsx("div",{className:"pay__form",children:s?s.mock?e.jsx(W,{onPaid:a,amountUsd:t.usd}):e.jsx(o.Suspense,{fallback:e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(f,{size:32}),e.jsx("p",{className:"muted",children:"Getting the payment form ready…"})]}),children:e.jsx(L,{clientSecret:s.clientSecret,onComplete:a})}):e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(f,{size:32}),e.jsx("p",{className:"muted",children:"Getting the payment form ready…"})]})})]})}function W({onPaid:t,amountUsd:s}){const[a,c]=o.useState("4242 4242 4242 4242"),[n,i]=o.useState(!1);function r(){i(!0),setTimeout(()=>t(),700)}return e.jsxs("div",{className:"card-form","aria-label":"Payment details",children:[e.jsx("p",{className:"muted small card-form__note",children:"Demo mode — no real charge is made."}),e.jsxs("label",{className:"field",children:[e.jsx("span",{children:"Card number"}),e.jsx("input",{value:a,onChange:_=>c(_.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:r,disabled:n,children:n?"Processing…":`Pay $${s}`})]})}export{se as GetCredits,se as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as L,r as d,j as e,L as E}from"./react-E8ng6RF2.js";import{t as M,C as o,c as Q,l as A,e as F,F as K}from"./index-BmYqfzkI.js";import{i as P,f as R}from"./import-MraNS_pv.js";import{s as Y}from"./wallet-kind-Dt8fQXzn.js";import"./ethers-BxoDGoYp.js";import"./buy-BDt3qh_Q.js";import"./index-07l384vR.js";import"./mana-rate-XfDebPT_.js";function W({queue:n,session:k,onClose:N,onDone:u}){const f=L(),r=Y(k.providerType),[c,y]=d.useState(()=>n.map(()=>"pending")),[b,C]=d.useState("running"),S=d.useRef(!1);d.useEffect(()=>{if(S.current)return;S.current=!0;let a=!1;return(async()=>{for(let i=0;i<n.length;i++){if(a)return;y(p=>p.map((h,g)=>g===i?"active":h));try{await P(n[i].item,n[i].priceCredits,k),M("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||y(p=>p.map((h,g)=>g===i?"done":h))}catch(p){const h=p,g=h.code===4001||/reject|denied|cancel/i.test(h.message??"");a||y(I=>I.map((w,t)=>t===i?g?"skipped":"failed":w))}}a||C("finished")})(),()=>{a=!0}},[]);const m=c.filter(a=>a==="done").length,x=c.findIndex(a=>a==="active"),_=Math.round(c.filter(a=>a!=="pending"&&a!=="active").length/n.length*100);function j(){u(),N()}if(b==="finished"){const a=c.filter(i=>i==="skipped"||i==="failed").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:m>0?"You're in the Shop! 🎉":"Nothing listed"}),e.jsxs("p",{className:"muted",style:{margin:0},children:[m>0?`${m} ${m===1?"item is":"items are"} now for sale with ${o.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:j,children:"Done"}),m>0?e.jsx("button",{className:"btn btn--purple",onClick:()=>{u(),N(),f("/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:[r?"Confirm each item to add it to the Shop.":"Adding your items to the Shop."," ",x>=0?`${x+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:[o.symbol," ",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})," ",r?"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:r?"A quick confirmation pops up for each item. Keep this open.":"This only takes a moment — keep this open."})]})})}const O=[{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 X(){const{session:n,signIn:k,restore:N}=Q(),u=A(),f=n==null?void 0:n.address;d.useEffect(()=>{N()},[N]);const{data:r,isLoading:c}=F({queryKey:["importable",f],queryFn:()=>R(f),enabled:!!f}),[y,b]=d.useState({}),[C,S]=d.useState(new Set),[m,x]=d.useState(null),_=d.useMemo(()=>[...(r==null?void 0:r.creations)??[],...(r==null?void 0:r.owned)??[]],[r]);d.useEffect(()=>{_.length&&b(t=>{const l={...t};for(const s of _)l[s.oldTradeId]==null&&(l[s.oldTradeId]=s.suggestedCredits);return l})},[_]);const j=t=>!C.has(t),a=t=>y[t.oldTradeId]??t.suggestedCredits,i=_.filter(t=>j(t.oldTradeId)),p=i.reduce((t,l)=>t+a(l),0);function h(t,l){const s=l.replace(/[^\d]/g,"");b(v=>({...v,[t]:s===""?0:parseInt(s,10)}))}function g(t){S(l=>{const s=new Set(l);return s.has(t)?s.delete(t):s.add(t),s})}function I(t){return t.map(l=>({item:l,priceCredits:Math.max(1,a(l))}))}function w(){u.invalidateQueries({queryKey:["importable"]}),u.invalidateQueries({queryKey:["listings"]}),u.invalidateQueries({queryKey:["my-assets"]}),u.invalidateQueries({queryKey:["collection-sale-state"]}),K.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(E,{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 ",o.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("span",{className:"imp__diamond",children:o.symbol})," 1 ",o.nameSingular," = $0.10 · prices rounded up"]}),c?e.jsx("div",{className:"imp__list",children:Array.from({length:4}).map((t,l)=>e.jsx("div",{className:"imp-row imp-row--skeleton"},l))}):O.map(t=>{const l=(r==null?void 0:r[t.key])??[];return l.length===0?null:e.jsxs("section",{className:"imp__section",children:[e.jsxs("div",{className:"imp__section-head",children:[e.jsx("h2",{className:"imp__section-title",children:t.title}),e.jsx("span",{className:"imp__section-sub",children:t.sub})]}),e.jsx("div",{className:"imp__list",children:l.map(s=>{const v=a(s),$=v!==s.suggestedCredits;return e.jsxs("article",{className:`imp-row${j(s.oldTradeId)?"":" is-off"}`,children:[e.jsx("input",{type:"checkbox",className:"imp-check",checked:j(s.oldTradeId),onChange:()=>g(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("span",{className:"imp-price__diamond","aria-hidden":!0,children:o.symbol}),e.jsx("input",{className:"imp-price__input",inputMode:"numeric",value:v.toLocaleString(),onChange:T=>h(s.oldTradeId,T.target.value),"aria-label":`Price in ${o.name} for ${s.name}`})]}),e.jsxs("div",{className:"imp-price__sub",children:[e.jsxs("span",{children:["$",(v*.1).toFixed(2)]}),$?e.jsxs("button",{className:"imp-price__reset",onClick:()=>b(T=>({...T,[s.oldTradeId]:s.suggestedCredits})),children:["Reset to ",o.symbol,s.suggestedCredits.toLocaleString()]}):null]})]}),e.jsx("div",{className:"imp-action",children:e.jsx("button",{className:"btn btn--sm imp-row__list",disabled:!j(s.oldTradeId),onClick:()=>x(I([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("span",{className:"imp__diamond",children:o.symbol})," ",p.toLocaleString()]}),e.jsxs("div",{className:"imp-dock__sub",children:[i.length," item",i.length===1?"":"s"," selected · $",(p*.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:()=>x(I(i)),children:["List all (",i.length,")"]})]})}),m&&n?e.jsx(W,{queue:m,session:n,onClose:()=>x(null),onDone:w}):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{X as ImportListings};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as e,r as d,a as ce,d as ne,b as le}from"./react-E8ng6RF2.js";import{c as G,N as de,W as oe,x as E,i as V,j as S,E as O,F as ue,k as me,e as F,t as L,O as he,P as fe,a as _e,C as K,h as pe,w as xe,o as ve,q as be,v as je,m as Ie,r as Ne,s as ye,b as ge,R as we,n as ke}from"./index-BmYqfzkI.js";import{h as U}from"./buy-BDt3qh_Q.js";import{g as Ce,a as Ae,w as Ee,G as Se}from"./buy-gasless-CyxaR54s.js";import"./ethers-BxoDGoYp.js";import"./index-07l384vR.js";function Te({item:i}){const c=G(b=>{var l;return(l=b.session)==null?void 0:l.address}),{data:r}=de(c),m=c&&r?c:"default",f=i.category==="emote";return e.jsx(oe,{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:E.PreviewType.AVATAR,emote:f?void 0:E.PreviewEmote.FASHION,disableBackground:!0,wheelZoom:f?1.5:void 0,wheelStart:f?100:void 0,dev:V.chainId===80002,disableFadeEffect:!0},i.id)}function Pe(i){return i==="male"?"♂":i==="female"?"♀":i==="unisex"?"⚥":""}function Re({title:i,items:c,activeId:r,onSelect:m,onViewAll:f}){const b=d.useRef(null),l=S(a=>a.add),g=S(a=>a.items.map(o=>o.id));if(c.length===0)return null;function s(a){l(a,"carousel"),ue.success(`“${a.name}” added to your cart.`)}function j(a){const o=b.current;o&&o.scrollBy({left:a*Math.round(o.clientWidth*.8),behavior:"smooth"})}return e.jsxs("section",{className:"collection-carousel",children:[e.jsxs("div",{className:"collection-carousel__head",children:[e.jsx("h2",{className:"collection-carousel__title",children: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:()=>j(-1),"aria-label":"Scroll left",children:"‹"}),e.jsx("button",{className:"collection-carousel__arrow",onClick:()=>j(1),"aria-label":"Scroll right",children:"›"})]})]})]}),e.jsx("div",{className:"collection-carousel__track",ref:b,children:c.map(a=>{const o=Pe(a.gender),w=a.id===r,I=a.priceCredits>0,_=g.includes(a.id);return e.jsxs("article",{className:`collection-carousel__card${w?" is-active":""}`,onClick:()=>m(a),role:"button",tabIndex:0,"aria-current":w||void 0,onKeyDown:h=>{(h.key==="Enter"||h.key===" ")&&(h.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,I?e.jsx("button",{className:"collection-carousel__add",disabled:_,"aria-label":_?"In cart":`Add ${a.name} to cart`,title:_?"In cart":"Add to cart",onClick:h=>{h.stopPropagation(),_||s(a)},children:e.jsx("span",{className:`ico ${_?"ico-cart-solid":"ico-cart"}`,"aria-hidden":!0})}):null]}),e.jsxs("div",{className:"collection-carousel__body",children:[e.jsx("div",{className:"collection-carousel__name",title:a.name,children:a.name}),e.jsxs("div",{className:"collection-carousel__meta",children:[I?e.jsxs("span",{className:"collection-carousel__price",children:[e.jsx(O,{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}),o?e.jsx("span",{className:"chip chip--icon",children:o}):null]})]})]})]},a.id)})})]})}function $e(i){return Object.values(E.Rarity).includes(i)}function Fe(i){return i==="male"?"Male":i==="female"?"Female":i==="unisex"?"Unisex":null}function Le(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 ${K.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 Ve(){const{contractAddress:i,tokenId:c}=ce(),{state:r}=ne(),m=le(),f=S(t=>t.add),b=S(t=>t.items),{session:l}=G(),{data:g}=me(l),[s,j]=d.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:V.chainId,thumbnail:"",priceCredits:0,gender:null,tokenId:c??void 0,tradeId:r==null?void 0:r.tradeId}),[a,o]=d.useState(!1),[w,I]=d.useState(null),[_,h]=d.useState(null),{data:N=[],isFetched:Y}=F({queryKey:["collection-items",s.contractAddress],enabled:!!s.contractAddress,queryFn:()=>ge(s.contractAddress,{first:20}).then(t=>t.items)}),{data:T,isLoading:z}=F({queryKey:["shop-item",s.contractAddress,c],enabled:!(r!=null&&r.item)&&!!s.contractAddress&&!!c,queryFn:()=>we(s.contractAddress,c)});d.useEffect(()=>{T&&j(t=>t.tradeId?t:{...T})},[T]),d.useEffect(()=>{if(s.name||N.length===0)return;const t=c&&N.find(n=>n.tokenId===c||n.itemId===c)||N.find(n=>n.contractAddress===s.contractAddress);t&&j(n=>({...t,tradeId:n.tradeId??t.tradeId}))},[N]);const D=d.useMemo(()=>{const t=new Set,n=[];for(const u of N){if(u.id===s.id||s.itemId&&u.itemId===s.itemId||s.tokenId&&u.tokenId===s.tokenId)continue;const A=`${u.contractAddress}-${u.itemId??u.tokenId??u.id}`;t.has(A)||(t.add(A),n.push(u))}return n},[N,s.id,s.itemId,s.tokenId]),{data:H,isLoading:k}=F({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 ke(s.contractAddress,s.itemId);return(t==null?void 0:t.id)??null}return null}}),v=s.tradeId??H??void 0,p=!!v,C=d.useMemo(()=>({...s,tradeId:v,id:v??s.id}),[s,v]),P=b.some(t=>t.id===C.id);d.useEffect(()=>{I(null),h(null)},[s.id]);const B=d.useRef(null);d.useEffect(()=>{!s.name||k||B.current===s.id||(B.current=s.id,L("Shop Viewed Item",{...he(s),for_sale:p}),fe(s))},[s.id,s.name,k,p]);function Q(t){j(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 Z(){!p||P||f(C,"item_detail")}async function J(){var A;if(!p||!v)return;if(!l){h("Log in to check out.");return}h(null),o(!0);let t,n="authorize",u=!1;try{I(`Buying ${s.name||"item"}…`);const x=await pe(v);if(!x)throw new Error("not for sale");const R=(A=x.received)==null?void 0:A[0],ie=xe(R==null?void 0:R.amount),{credit:M,maxCreditedValue:re}=await ve(l.identity,ie,v);t=M.id,n="submit";const $={trade:x,buyer:l.address,signer:l.signer,credits:[M],maxCreditedValue:re};let y;if(Ce())try{y=await Ae($),await Ee(y),u=!0}catch(W){if(!(W instanceof Se))throw W;y=await U($)}else y=await U($);t=void 0,L("Shop Completed Purchase",{...be([C]),payment_type:"credits",no_crypto_step:u,transaction_hash:y??null}),m("/success",{state:{items:[C],txHash:y}})}catch(x){console.error("[detail] buy now failed:",x),t&&je(l.identity,[t]).catch(()=>{}),L(ye(x)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:n,error_code:Ne(x),value_usd:Ie(C.priceCredits)}),h(Le(x)),I(null)}finally{o(!1)}}const X=$e(s.rarity)?s.rarity:E.Rarity.COMMON,[ee]=E.Rarity.getGradient(X),q=Fe(s.gender),se="More from this collection",te=p?P?"In cart":k?"Checking…":"Add to cart":"Not for sale",ae=z||!!s.contractAddress&&!Y;return!s.name&&!ae?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 the shop for something else."}),e.jsx("button",{className:"btn btn--purple",onClick:()=>m("/assets"),children:"Browse the shop"})]}):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%, ${ee}33 0%, var(--media) 68%)`},children:e.jsx(Te,{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","aria-label":"Add to favorites",children:e.jsx("span",{className:"ico ico-heart","aria-hidden":!0})})]}),s.creator?e.jsx(_e,{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"}),q?e.jsx("span",{className:"chip",children:q}):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?e.jsxs("div",{className:"item-detail__price",children:[e.jsx(O,{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: ",K.symbol," ",(g==null?void 0:g.credits)??0]}):null]}),e.jsxs("div",{className:"item-detail__ctas",children:[p?e.jsx("button",{className:"btn btn--purple item-detail__cta",onClick:J,disabled:a||k,children:a?"Working…":"Buy now"}):null,e.jsxs("button",{className:"item-detail__addcart",onClick:Z,disabled:!p||P||k||a,children:[e.jsx("span",{className:"ico ico-cart-solid item-detail__addcart-ico","aria-hidden":!0}),te]})]}),w?e.jsx("p",{className:"muted item-detail__status",children:w}):null,_?e.jsx("p",{className:"error item-detail__status",children:_}):null]})]})]}),e.jsx(Re,{title:se,items:D,activeId:s.id,onSelect:Q,onViewAll:s.contractAddress?()=>m(`/collection/${s.contractAddress}`):void 0})]})}export{Ve as ItemDetail,Ve as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as Y,r as m,j as s,L as ae}from"./react-E8ng6RF2.js";import{x as J,i as W,S as ie,l as B,C as _,p as Z,t as P,F as G,r as z,c as re,e as U,T as le,h as ce,U as oe}from"./index-BmYqfzkI.js";import{f as de}from"./import-MraNS_pv.js";import{a as me,b as ue,i as he,e as pe,c as be,d as ge}from"./buy-BDt3qh_Q.js";import{s as ye}from"./wallet-kind-Dt8fQXzn.js";import{L as xe}from"./LoadMore-DB6TwvRe.js";import{u as fe}from"./useInfiniteGrid-BM3TcyEh.js";import"./ethers-BxoDGoYp.js";import"./mana-rate-XfDebPT_.js";import"./index-07l384vR.js";const T=()=>`${W.builderServerUrl}/v1`;function ee(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 se(e,i){const t=await ie(e,{method:"GET",identity:i,metadata:{}});if(!t.ok)throw new Error(`builder-server ${t.status}: ${await t.text()}`);const o=await t.json();return o.data??o}function je(e,i){const t=i-e;return t>0?t:0}function _e(e){var i,t,o,l,c;return((t=(i=e.data)==null?void 0:i.wearable)==null?void 0:t.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 H(e){return`${T()}/storage/contents/${e}`}function $(e,i){if(!e)return"";if(/^https?:\/\//.test(e))return e;const t=i==null?void 0:i[e];return t?H(t):/^(ba|Qm)/.test(e)?H(e):""}async function Ne(e,i){try{const t=await fetch(`${T()}/items/${e}/${i}/contents`);if(!t.ok)return{};const o=await t.json();return o.data??o}catch{return{}}}async function Ie(e,i,t){const o=$(e.thumbnail,e.contents)||$("thumbnail.png",e.contents);if(o)return o;if(i&&t){const l=await Ne(i,t);return $(e.thumbnail,l)||$("thumbnail.png",l)||$("image.png",l)}return""}async function ve(e,i){const t=`${T()}/${e.toLowerCase()}/collections?is_published=true`,o=await se(t,i);return ee(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 ke(e,i){const t=`${T()}/collections/${e.id}/items`,o=await se(t,i);return(await Promise.all(ee(o).map(async c=>{const k=c.rarity??"common",N=Number(c.total_supply??0)||0;let u=0;try{u=J.Rarity.getMaxSupply(k)}catch{u=0}const I=(c.contract_address??e.contractAddress).toLowerCase(),p=c.blockchain_item_id??"";return{id:c.id,collectionId:e.id,collectionName:e.name,contractAddress:I,blockchainItemId:p,name:c.name,category:_e(c),rarity:k,thumbnail:await Ie(c,I,p),type:c.type??"wearable",isPublished:c.is_published??e.isPublished,isApproved:c.is_approved??e.isApproved,totalSupply:N,maxSupply:u,remainingSupply:je(N,u),minters:e.minters}}))).filter(Se)}function Se(e){return e.isPublished&&e.isApproved&&e.blockchainItemId!==""&&e.blockchainItemId!=null&&e.remainingSupply>0}async function Ce(e,i){const t=await ve(e,i);return(await Promise.all(t.map(async l=>{try{return await ke(l,i)}catch{return[]}}))).flat()}const we=1e3*60*60*24*182;function Ae(e){const i=e,t=(i.message??"").toLowerCase();return i.code===4001||t.includes("reject")||t.includes("denied")||t.includes("cancel")?"You cancelled the request.":"Couldn't list your item — please try again."}function Pe({asset:e,session:i,onClose:t}){const o=B(),l=Y(),[c,k]=m.useState("10"),[N,u]=m.useState(null),[I,p]=m.useState(null),[b,S]=m.useState(!1),[f,j]=m.useState(null);async function w(){p(null);const d=Number(c);if(!Number.isInteger(d)||d<=0){p("Enter a whole number of credits");return}S(!0);try{u("Getting your item ready…"),await me({signer:i.signer,contractAddress:e.contractAddress,chainId:e.chainId}),u("Listing your item…");const v=await ue({signer:i.signer,nft:{contractAddress:e.contractAddress,tokenId:e.tokenId,network:e.network,chainId:e.chainId},usdPrice:d/10,expiresAtMs:Date.now()+we});u("Publishing…"),await Z(v,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}),G.success(`“${e.name}” is now on sale!`),o.invalidateQueries({queryKey:["my-assets",i.address]})}catch(v){console.error(v),P("Shop Listing Failed",{listing_type:"secondary",error_code:z(v)}),p(Ae(v)),u(null)}finally{S(!1)}}function y(){t(),l(`/item/${e.contractAddress}/${e.tokenId}`)}return f!==null?s.jsx("div",{className:"modal-backdrop",onClick:t,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:[_.symbol," ",f]})]}),s.jsxs("div",{className:"modal__actions",children:[s.jsx("button",{className:"btn btn--ghost",onClick:t,children:"Done"}),s.jsx("button",{className:"btn btn--purple",onClick:y,children:"View in Shop"})]})]})}):s.jsx("div",{className:"modal-backdrop",onClick:t,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 (",_.name,")"]}),s.jsx("input",{type:"number",min:"1",step:"1",value:c,onChange:d=>k(d.target.value),disabled:b})]}),s.jsxs("p",{className:"muted small",children:["Priced in whole ",_.name," (1 ",_.nameSingular," = $0.10)."]}),N?s.jsx("p",{className:"muted",children:N}):null,I?s.jsx("p",{className:"error",children:I}):null,s.jsxs("div",{className:"modal__actions",children:[s.jsx("button",{className:"btn btn--ghost",onClick:t,disabled:b,children:"Cancel"}),s.jsx("button",{className:"btn",onClick:w,disabled:b,children:b?"Working…":"List for sale"})]})]})})}const $e=1e3*60*60*24*182;function Le(e){const i=e,t=(i.message??"").toLowerCase();return i.code===4001||t.includes("reject")||t.includes("denied")||t.includes("cancel")?"You cancelled the request.":"Couldn't publish your item — please try again."}function Ee({item:e,session:i,onClose:t}){const o=B(),l=Y(),[c,k]=m.useState("10"),[N,u]=m.useState(null),[I,p]=m.useState(null),[b,S]=m.useState(!1),[f,j]=m.useState(null),[w,y]=m.useState(null),d=W.chainId,v=ye(i.providerType);m.useEffect(()=>{let h=!1;return(async()=>{try{const g=await he({contractAddress:e.contractAddress,chainId:d});h||j(g)}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}S(!0);try{f||(u("Enabling sales for this collection…"),await pe({signer:i.signer,contractAddress:e.contractAddress,chainId:d}),j(!0)),u("Publishing your item…");const g=await be({signer:i.signer,item:{contractAddress:e.contractAddress,itemId:e.blockchainItemId,network:J.Network.MATIC,chainId:d},usdPrice:h/10,uses:e.remainingSupply,expiresAtMs:Date.now()+$e});u("Finishing up…"),await Z(g,i.identity),u(null),y(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}),G.success(`“${e.name}” is now on sale!`),o.invalidateQueries({queryKey:["publishable-items"]}),o.invalidateQueries({queryKey:["collection-sale-state"]})}catch(g){console.error(g),P("Shop Listing Failed",{listing_type:"primary",error_code:z(g)}),p(Le(g)),u(null)}finally{S(!1)}}function D(){t(),l(`/item/${e.contractAddress}/${e.blockchainItemId}`)}const E=b?"Working…":f===!1?"Enable & publish":"Publish for sale";return w!==null?s.jsx("div",{className:"modal-backdrop",onClick:t,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:[_.symbol," ",w]})," · ",e.remainingSupply.toLocaleString()," available"]}),s.jsxs("div",{className:"modal__actions",children:[s.jsx("button",{className:"btn btn--ghost",onClick:t,children:"Done"}),s.jsx("button",{className:"btn btn--purple",onClick:D,children:"View in Shop"})]})]})}):s.jsx("div",{className:"modal-backdrop",onClick:t,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 (",_.name,")"]}),s.jsx("input",{type:"number",min:"1",step:"1",value:c,onChange:h=>k(h.target.value),disabled:b})]}),s.jsxs("p",{className:"muted small",children:["Priced in whole ",_.name," (1 ",_.nameSingular," = $0.10)."]}),f===!1&&!b?v?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&&!b?v?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,N?s.jsx("p",{className:"muted",children:N}):null,I?s.jsx("p",{className:"error",children:I}):null,s.jsxs("div",{className:"modal__actions",children:[s.jsx("button",{className:"btn btn--ghost",onClick:t,disabled:b,children:"Cancel"}),s.jsx("button",{className:"btn",onClick:L,disabled:b||f===null,children:f===null?"Checking…":E})]})]})})}const Me=48;function X(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:W.chainId,thumbnail:e.thumbnail,priceCredits:0,gender:null}}function We(){const{session:e,error:i,signIn:t,restore:o}=re(),l=Y(),c=B(),[k,N]=m.useState(null),[u,I]=m.useState(null),[p,b]=m.useState(null),[S,f]=m.useState(null);function j(n){const a=n.tokenId??n.itemId??"";!n.contractAddress||!a||l(`/item/${n.contractAddress}/${a}`,{state:{item:n}})}async function w(n,a,r){if(e){f(null),b(r);try{const x=await ce(n);await ge({trade:x,signer:e.signer}),G.success(`“${a}” is no longer for sale.`),await c.invalidateQueries({queryKey:["my-assets",e.address]}),await c.invalidateQueries({queryKey:["collection-sale-state"]})}catch(x){const M=x,q=(M.message??"").toLowerCase();f(M.code===4001||q.includes("reject")||q.includes("denied")?"You cancelled the request.":"Couldn't remove the listing — please try again.")}finally{b(null)}}}m.useEffect(()=>{o()},[o]);const y=e==null?void 0:e.address,{items:d,isLoading:v,error:L,hasNextPage:D,isFetchingNextPage:E,fetchNextPage:h}=fe(["my-assets",y],n=>le(y,{first:Me,skip:n}).then(a=>({items:a.assets,total:a.total})),{enabled:!!y}),{data:g}=U({queryKey:["importable",y],queryFn:()=>de(y),enabled:!!y}),K=((g==null?void 0:g.creations.length)??0)+((g==null?void 0:g.owned.length)??0),{data:A,isLoading:ne,isError:te}=U({queryKey:["publishable-items",y],queryFn:()=>Ce(y,e.identity),enabled:!!e,retry:!1}),O=m.useMemo(()=>[...new Set((A??[]).map(n=>n.contractAddress))],[A]),{data:C}=U({queryKey:["collection-sale-state",y,O],enabled:O.length>0,queryFn:async()=>{const n=await Promise.all(O.map(async r=>[r,await oe(r)])),a={};for(const[r,x]of n)for(const[M,q]of Object.entries(x))a[`${r}-${M}`]=q;return a}}),R=n=>C==null?void 0:C[`${n.contractAddress}-${n.blockchainItemId}`],Q=m.useMemo(()=>(A??[]).filter(n=>{var a;return(a=R(n))==null?void 0:a.isOnSale}),[A,C]),V=m.useMemo(()=>{var a;const n=new Map;for(const r of A??[]){if((a=C==null?void 0:C[`${r.contractAddress}-${r.blockchainItemId}`])!=null&&a.isOnSale)continue;const x=n.get(r.collectionId)??{id:r.collectionId,name:r.collectionName,items:[]};x.items.push(r),n.set(r.collectionId,x)}return[...n.values()]},[A,C]);return e?s.jsxs("section",{className:"myassets",children:[s.jsx("h1",{children:"My Assets"}),K>0?s.jsxs(ae,{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 ",K," item",K===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,S?s.jsx("p",{className:"error",children:S}):null,s.jsxs("div",{className:"asset-grid",children:[v?Array.from({length:8}).map((n,a)=>s.jsx("div",{className:"asset-card asset-card--skeleton"},`sk-${a}`)):d.map(n=>s.jsxs("article",{className:"asset-card asset-card--link",onClick:()=>j(X(n)),role:"link",tabIndex:0,onKeyDown:a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),j(X(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:[_.symbol," ",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:a=>{a.stopPropagation(),n.tradeId&&w(n.tradeId,n.name,n.id)},children:p===n.id?"Removing…":"Remove listing"})]}):s.jsx("button",{className:"btn btn--sm",onClick:a=>{a.stopPropagation(),P("Shop Started Listing",{listing_type:"secondary",item_id:n.itemId??n.tokenId??null}),N(n)},children:"List for sale"})]},n.id)),E?Array.from({length:4}).map((n,a)=>s.jsx("div",{className:"asset-card asset-card--skeleton"},`msk-${a}`)):null]}),s.jsx(xe,{hasNextPage:D,isFetching:E,onLoadMore:()=>h()}),!v&&d.length===0?s.jsx("p",{className:"muted",children:"No items in your inventory 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 ",_.name," and buyers pay with ",_.name,"."]})]}),ne?s.jsx("div",{className:"publish-grid",children:Array.from({length:4}).map((n,a)=>s.jsx("div",{className:"asset-card asset-card--skeleton"},`pub-sk-${a}`))}):te?s.jsx("p",{className:"publish-empty",children:"We couldn’t load your collections right now. Please try again in a moment."}):Q.length===0&&V.length===0?s.jsx("p",{className:"publish-empty",children:"You don’t have any items to publish yet."}):s.jsxs(s.Fragment,{children:[Q.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:Q.map(n=>{var a;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:[_.symbol," ",((a=R(n))==null?void 0:a.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 x=R(n);x!=null&&x.tradeId&&w(x.tradeId,n.name,n.id)},children:p===n.id?"Removing…":"Remove listing"})]},`${n.contractAddress}-${n.blockchainItemId}`)})})]}):null,V.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(a=>s.jsxs("article",{className:"publish-card publish-card--link",onClick:()=>j(F(a)),role:"link",tabIndex:0,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),j(F(a)))},children:[s.jsx("div",{className:"publish-card__img",children:a.thumbnail?s.jsx("img",{src:a.thumbnail,alt:a.name}):null}),s.jsx("div",{className:"publish-card__name",title:a.name,children:a.name}),s.jsxs("div",{className:"publish-card__meta",children:[s.jsx("span",{className:"publish-chip publish-chip--rarity",children:a.rarity}),s.jsxs("span",{className:"publish-card__supply",children:[a.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:a.blockchainItemId}),I(a)},children:"Put on sale"})]},`${a.contractAddress}-${a.blockchainItemId}`))})]},n.id))]})]}),k?s.jsx(Pe,{asset:k,session:e,onClose:()=>N(null)}):null,u?s.jsx(Ee,{item:u,session:e,onClose:()=>I(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:()=>t(),children:"Sign in"})}),i?s.jsx("p",{className:"error",children:i}):null]})}export{We as MyAssets};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{w as r}from"./utils-CtSpY5KY.js";import{d as a}from"./decimals-9X9HFAfo.js";import"./ethers-BxoDGoYp.js";import"./react-E8ng6RF2.js";import"./signing-Cs3KRA5P.js";import"./index-BmYqfzkI.js";async function s(c){return r(()=>a(c),{cacheKey:`${c.contract.chain.id}:${c.contract.address}:decimals`,cacheTime:Number.POSITIVE_INFINITY})}export{s as decimals};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{y as r}from"./index-BmYqfzkI.js";var e=r();export{e as n};
|