@dcl/shop 0.1.0-30043940031.commit-1a0b88f → 0.1.0-30084313421.commit-41b3e0b
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/{Activity-CnoF6F3Z.js → Activity-Bb-OLVcI.js} +1 -1
- package/assets/{AnimatedBackground-DKAviRVb.js → AnimatedBackground-DjPfAvry.js} +1 -1
- package/assets/{Assets-CbIX010b.js → Assets-6XPKeddO.js} +1 -1
- package/assets/{Assets.styles-C5zpZCUK.js → Assets.styles-BDoRqZww.js} +1 -1
- package/assets/{Authorizations-4u2_v7qf.js → Authorizations-BM-OFJCX.js} +1 -1
- package/assets/{Cart-C1woE131.js → Cart-CO4_yVvN.js} +1 -1
- package/assets/{CircularProgress-CeVjKviE.js → CircularProgress-CQ5EJ-uq.js} +1 -1
- package/assets/{Collection-CdFvuhxV.js → Collection-CHzevcx8.js} +1 -1
- package/assets/{CollectionCarousel-BC4r8J9j.js → CollectionCarousel-BWYkR7q0.js} +1 -1
- package/assets/{Creator-Cpw9Qy_r.js → Creator-sctmPqy6.js} +1 -1
- package/assets/{CssVarsProvider-B0QPJ9UY.js → CssVarsProvider-BzgltKCN.js} +1 -1
- package/assets/{ExchangeController-aeqEXROB.js → ExchangeController-Dsrf1L46.js} +1 -1
- package/assets/{GetCredits-BfCzeAeD.js → GetCredits-D8qINCF8.js} +1 -1
- package/assets/{HelpersUtil-fELrO7Xi.js → HelpersUtil-CpsiKONs.js} +1 -1
- package/assets/{ImportListings-CxJDA8Su.js → ImportListings-DybRiRBL.js} +1 -1
- package/assets/{ItemDetail-D1Xe6t7i.js → ItemDetail-BJ2dLPG6.js} +2 -2
- package/assets/{LoadMore-CHlPzPXC.js → LoadMore-DypsCZRq.js} +1 -1
- package/assets/{MarketCheckout-dyTQT0v3.js → MarketCheckout-rU7x7bhY.js} +1 -1
- package/assets/{MyAssets-C_wlVXNb.js → MyAssets-BmcwS5MF.js} +1 -1
- package/assets/{MyFavorites-B7HUqvEe.js → MyFavorites-DiAgFtAG.js} +1 -1
- package/assets/{NotFound-DgN5Ojh9.js → NotFound-Tg4avYxP.js} +1 -1
- package/assets/{PrimaryListModal-vBauRE_Q.js → PrimaryListModal-CjIspJsb.js} +1 -1
- package/assets/{StoreSettings-Bx7T9d4h.js → StoreSettings-CgpJ1KIi.js} +6 -6
- package/assets/{Success-B45Qtg3D.js → Success-CtTmYej8.js} +1 -1
- package/assets/{SwapController-qtGuRSFp.js → SwapController-D0htXek5.js} +1 -1
- package/assets/{Tooltip-BjVKL7Fw.js → Tooltip-BTVaKPyS.js} +1 -1
- package/assets/{TradeService-DWfELVYz.js → TradeService-ComBMl40.js} +1 -1
- package/assets/{W3MFrameProviderSingleton-BYvOktGz.js → W3MFrameProviderSingleton-CbjIJy-0.js} +3 -3
- package/assets/{WebCryptoP256-BaA8puph.js → WebCryptoP256-Dl6_JG2r.js} +1 -1
- package/assets/{authorizations-BdVBiEr7.js → authorizations-Bgadyzys.js} +1 -1
- package/assets/{basic-Ceg7-rw5.js → basic-C8b990aB.js} +1 -1
- package/assets/{biconomy-dWuJAVG6.js → biconomy-DeYIA1c5.js} +1 -1
- package/assets/{buy-B_TXfJF4.js → buy-8zXIWr42.js} +1 -1
- package/assets/{buy-gasless-C7VsNrLp.js → buy-gasless-CGYytySC.js} +1 -1
- package/assets/{cart-checkout-QeMYLp4l.js → cart-checkout-CBAloPLv.js} +1 -1
- package/assets/{categories-DDZgtl6y.js → categories-CV9q9c1e.js} +1 -1
- package/assets/{ccip-O9QIlP6E.js → ccip-BD21-sze.js} +1 -1
- package/assets/{ccip-D1vE27l0.js → ccip-NyeeMPNI.js} +1 -1
- package/assets/collection-RngIGkUk.js +1 -0
- package/assets/{controller-BDtPSPmx.js → controller-CIp4T1M6.js} +2 -2
- package/assets/{core-LjTvFg1D.js → core-D3ZBtmG9.js} +4 -4
- package/assets/{custom-COtXL8aP.js → custom-DoCHnHlx.js} +1 -1
- package/assets/{data-capture-CXZOXZ6B.js → data-capture-Bt97LC30.js} +1 -1
- package/assets/{email-BS7ZREiA.js → email-C4WfX6BK.js} +1 -1
- package/assets/{embedded-wallet-CWaQUjgL.js → embedded-wallet-DTgxcP09.js} +1 -1
- package/assets/{emotion-styled.browser.esm-c2FFx3DR.js → emotion-styled.browser.esm-DMJh0f0o.js} +1 -1
- package/assets/{engine-bGCn900B.js → engine-1qktmoqt.js} +1 -1
- package/assets/{errors-D2EYBG38.js → errors-BPMx500B.js} +1 -1
- package/assets/{estimate-l1-fee-CEy_ASr7.js → estimate-l1-fee-Bp5BtcNG.js} +1 -1
- package/assets/{execute-DySDEvjB.js → execute-BnReK8lm.js} +2 -2
- package/assets/{features-DLc5WZYN.js → features-Df6olFjN.js} +1 -1
- package/assets/{fetchTokenMetadata-C9wYmfXl.js → fetchTokenMetadata-B8s7yFfZ.js} +2 -2
- package/assets/{get-ecosystem-wallet-info-B4KRbr6l.js → get-ecosystem-wallet-info-CyiX8NHL.js} +1 -1
- package/assets/{getBalance-j6TTPwxJ.js → getBalance-DSWEI8pi.js} +1 -1
- package/assets/{getNFT-B7SHBqxZ.js → getNFT-BDsH7laZ.js} +1 -1
- package/assets/{getNFT-BJKaB30S.js → getNFT-D1D9PPym.js} +1 -1
- package/assets/{getOverlayAlpha-Dgr3elr3.js → getOverlayAlpha-DPVIWFtM.js} +1 -1
- package/assets/{hashTypedData-B3ueg2tO.js → hashTypedData-BLxWGL2s.js} +1 -1
- package/assets/{hashTypedData-C3LWcJNr.js → hashTypedData-BS4ZfyTV.js} +1 -1
- package/assets/{import-CT__rglP.js → import-CyTlWuc0.js} +1 -1
- package/assets/{in-app-eO_XP67Y.js → in-app-BrQfXIMQ.js} +1 -1
- package/assets/{in-app-wallet-calls-CaxSZMND.js → in-app-wallet-calls-DiHdNRS1.js} +1 -1
- package/assets/{index-BzQBX2p-.js → index-B-HIPRSI.js} +1 -1
- package/assets/{index-BcatoSfw.js → index-B0RtEUzx.js} +1 -1
- package/assets/{index-UvWrbkyR.js → index-B176-toy.js} +1 -1
- package/assets/{index-dVV4LZRn.js → index-B3vP5DbK.js} +1 -1
- package/assets/{index-DFwKLiGe.js → index-BA9v7_k2.js} +1 -1
- package/assets/{index-D4SQVwZS.js → index-BBGfTC_W.js} +1 -1
- package/assets/{index-RYFuERlG.js → index-Bb6ilOog.js} +1 -1
- package/assets/{index-BLif3fcT.js → index-Bgn9500L.js} +1 -1
- package/assets/{index-Chf28tkX.js → index-BheJY9I_.js} +1 -1
- package/assets/{index-F4KCRFXO.js → index-BmCkBWJA.js} +1 -1
- package/assets/{index-BgKrxOfP.js → index-BqF61I35.js} +1 -1
- package/assets/{index-CoBli9XK.js → index-BxzC0BU0.js} +1 -1
- package/assets/{index-Bt4sSx0j.js → index-ByY1hur1.js} +1 -1
- package/assets/{index-DSY1kJ-n.js → index-C-TzM1dq.js} +1 -1
- package/assets/{index-D84f1SZS.js → index-CIy5Ix3H.js} +1 -1
- package/assets/{index-DPeNzqnx.js → index-CKfSwJkZ.js} +1 -1
- package/assets/{index-DnjriEQ8.js → index-CQ1YB7hb.js} +1 -1
- package/assets/{index-BbfDA6Q2.js → index-CRCmj1Gz.js} +1 -1
- package/assets/{index-LLNcsqnt.js → index-CRd-7JoJ.js} +1 -1
- package/assets/{index-CoY6w5ve.js → index-CeMMnddd.js} +1 -1
- package/assets/{index-BNz2c_gH.js → index-CgePjjT-.js} +1 -1
- package/assets/{index-BLHU8DgF.js → index-Cl27wvu-.js} +1 -1
- package/assets/{index-CPhNis9E.js → index-CmWFbx7x.js} +1 -1
- package/assets/{index-ahfZZDfz.js → index-Cr7OVX_h.js} +1 -1
- package/assets/{index-DhuOONXr.js → index-Ct0QDYSg.js} +1 -1
- package/assets/{index-DQ1f3JN6.js → index-CxrSMW3t.js} +1 -1
- package/assets/{index-BTO-tMff.js → index-D8iyBi4K.js} +1 -1
- package/assets/{index-DtCbj4Bu.js → index-DD7A6YNB.js} +1 -1
- package/assets/{index-k1Bog_tr.js → index-DJzwNEuW.js} +27 -27
- package/assets/{index-CI_Eucnr.js → index-DLljbm1v.js} +3 -3
- package/assets/{index-FmAwtPUy.js → index-DO3Y1E93.js} +1 -1
- package/assets/{index-DTEyrFW2.js → index-DRm2Jw63.js} +1 -1
- package/assets/{index-yeRgwVVL.js → index-DWGpYysm.js} +2 -2
- package/assets/{index-QTjwITlm.js → index-DYY73RtD.js} +1 -1
- package/assets/{index-BgEzTrtV.js → index-DZ1jCc1j.js} +1 -1
- package/assets/{index-BLLuYu72.js → index-DbtiJztg.js} +1 -1
- package/assets/{index-BCdiIcLt.js → index-DeDo7lcb.js} +1 -1
- package/assets/{index-6eUPFQAl.js → index-DhMFUIC8.js} +1 -1
- package/assets/{index-D-DOtIYj.js → index-Dm6T5atW.js} +1 -1
- package/assets/{index-DTVGIjcC.js → index-DvGLPHzj.js} +1 -1
- package/assets/{index-B6KO-WXc.js → index-DxyocxxR.js} +1 -1
- package/assets/{index-CLZOJwm_.js → index-ENmogT7M.js} +3 -3
- package/assets/{index-C6h_WU9m.js → index-IHkIXroQ.js} +1 -1
- package/assets/{index-I60bR1z0.js → index-RemR4b9r.js} +1 -1
- package/assets/{index-BAbZ1oMa.js → index-UnwMi8Ij.js} +1 -1
- package/assets/{index-Cfbe2Qvo.js → index-VPymOKcY.js} +2 -2
- package/assets/{index-B7P0UO1e.js → index-YGTcGdG0.js} +1 -1
- package/assets/{index-BR4zrdA9.js → index-Zx6iKfwQ.js} +2 -2
- package/assets/{index-DDk8aurE.js → index-_JECnUXv.js} +1 -1
- package/assets/{index-D2Lec10t.js → index-eCI6DTVT.js} +1 -1
- package/assets/{index-CSlkMlP4.js → index-j7uoTH7P.js} +1 -1
- package/assets/{index-B7mff2o2.js → index-nTALreMf.js} +3 -3
- package/assets/{index.es-DcggvVah.js → index.es-CzcyYTsy.js} +1 -1
- package/assets/{index.es-BxDkRG0j.js → index.es-rPugFlNV.js} +1 -1
- package/assets/{index.es-pkeG3qQo.js → index.es-uLrjiFt8.js} +4 -4
- package/assets/{localBatchGatewayRequest-B7VW_3F8.js → localBatchGatewayRequest-st64C34I.js} +1 -1
- package/assets/{mana-rate-Ez6IlT0x.js → mana-rate-D0Q2dITA.js} +1 -1
- package/assets/{networks-CuAkQzro.js → networks-aJPeF2SG.js} +1 -1
- package/assets/{onramp-C5uxESKn.js → onramp-DssQ6hUS.js} +1 -1
- package/assets/{openzeppelin-CEEpXs6H.js → openzeppelin-JTgKhCRH.js} +1 -1
- package/assets/{parseNft-CjnCetmp.js → parseNft-Cw9BKziD.js} +2 -2
- package/assets/{parseSignature-CjHHoeVW.js → parseSignature-CGuYiLrP.js} +1 -1
- package/assets/{parseSignature-Ba1mhqh5.js → parseSignature-kkOm4INP.js} +3 -3
- package/assets/{passkeys-DKJW-FEa.js → passkeys-D7M1_Jqt.js} +1 -1
- package/assets/{pay-with-exchange-yOexVTa_.js → pay-with-exchange-BbWWTFoZ.js} +1 -1
- package/assets/{qr-overlay-CurN-_cO.js → qr-overlay-HamzVk19.js} +1 -1
- package/assets/{receive-Bvf5SspN.js → receive-BEDwM8Fr.js} +1 -1
- package/assets/{resolveImplementation-BMaNFS8w.js → resolveImplementation-DPONOgzF.js} +1 -1
- package/assets/{rpc-Bclh4OVX.js → rpc-CWbAKSXO.js} +1 -1
- package/assets/{secp256k1-B7PtKdKr.js → secp256k1-B5Z9AfKG.js} +1 -1
- package/assets/{secp256k1---Cfb5Gr.js → secp256k1-BF-XCAf9.js} +1 -1
- package/assets/{secp256k1-BznDUTmG.js → secp256k1-Dybxu4DO.js} +1 -1
- package/assets/{send-BxN6VGCE.js → send-BwY7Rwfq.js} +1 -1
- package/assets/{send-batch-transaction-BY7yHkGa.js → send-batch-transaction-Cx-jETrV.js} +1 -1
- package/assets/{send-eip712-transaction-RXT3aSSm.js → send-eip712-transaction-Dpk3acDm.js} +2 -2
- package/assets/{send-gasless-transaction-DDPuuxQ-.js → send-gasless-transaction-Cub2VyVN.js} +2 -2
- package/assets/{send-transaction-BvCcEvFd.js → send-transaction-BPZZcM9D.js} +2 -2
- package/assets/{sendRawTransaction-BJZ0BEjt.js → sendRawTransaction-BuKuvToI.js} +3 -3
- package/assets/{serializeTransaction-CRJP65Ad.js → serializeTransaction-224hq0Gk.js} +1 -1
- package/assets/{session-proposal-Dvj-F2wQ.js → session-proposal-C2qfuTaQ.js} +1 -1
- package/assets/{session-request-Ce-DwiYu.js → session-request-DPBw3JPk.js} +2 -2
- package/assets/{signing-BCzW8Yh4.js → signing-MX0iS77w.js} +3 -3
- package/assets/{socials-2qO6GWvx.js → socials-CNzyfjxh.js} +1 -1
- package/assets/{swaps-Byx37cWK.js → swaps-BwGWGNw5.js} +1 -1
- package/assets/{thirdweb-Bzinkygh.js → thirdweb-DZiMNspq.js} +3 -3
- package/assets/{to-serializable-transaction-BPYyQKxa.js → to-serializable-transaction-td0zDiR1.js} +2 -2
- package/assets/{trade-encoding-Bq9nPTSy.js → trade-encoding-DuF5Et_P.js} +1 -1
- package/assets/{transactionReceipt-7aTE2Yz3.js → transactionReceipt-D3KLB67c.js} +1 -1
- package/assets/{transactions-Y7mX5hPf.js → transactions-Bx1pg-ZE.js} +1 -1
- package/assets/{useCreditPacks-CG7L_UQ4.js → useCreditPacks-Cnffyb1f.js} +1 -1
- package/assets/{useInfiniteGrid-H1sfBdhy.js → useInfiniteGrid-DyZgZbO4.js} +1 -1
- package/assets/useManaRate-DBsG9LRw.js +1 -0
- package/assets/{useStore-Cbt7cLyp.js → useStore-DW_s4ry_.js} +1 -1
- package/assets/useTheme-CK32hdxC.js +1 -0
- package/assets/{useTheme-CauhIIJq.js → useTheme-niAOV5zA.js} +1 -1
- package/assets/{verifyHash-BzzdH-JT.js → verifyHash-COHX4PVC.js} +1 -1
- package/assets/{w3m-modal-Uf8zuJST.js → w3m-modal-2W0XLNLb.js} +1 -1
- package/assets/{w3m-modal-R9G6tUSA.js → w3m-modal-Ch1kgpOz.js} +1 -1
- package/assets/{wait-for-tx-receipt-UIT99Yyq.js → wait-for-tx-receipt-DsdkfqEB.js} +1 -1
- package/assets/{wallets-CgBIBei6.js → wallets-EFcAGNXF.js} +5 -5
- package/assets/{web-connector-B1ptdbTS.js → web-connector-C8bjZk8B.js} +3 -3
- package/assets/{writeContract-aQQPNQN6.js → writeContract-BCOaU6gC.js} +1 -1
- package/assets/{zoraTestnet-BxMHEDAV.js → zoraTestnet-BsjW-laY.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/assets/collection-d97cPr3w.js +0 -1
- package/assets/useManaRate-BO1b19Qr.js +0 -1
- package/assets/useTheme-TzAV5P1-.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as Q,j as e,L as $}from"./react-C51i12iP.js";import{s as o,F as a,N as V,B as X,m as Z,t as c,u as J,I as h,af as Y,ag as tt,C as m,o as w,ah as et,ai as it}from"./index-
|
|
1
|
+
import{r as Q,j as e,L as $}from"./react-C51i12iP.js";import{s as o,F as a,N as V,B as X,m as Z,t as c,u as J,I as h,af as Y,ag as tt,C as m,o as w,ah as et,ai as it}from"./index-DJzwNEuW.js";import{a as st}from"./mana-rate-D0Q2dITA.js";import{u as nt}from"./useManaRate-DBsG9LRw.js";import{L as at}from"./LoadMore-DypsCZRq.js";import{u as b}from"./useInfiniteGrid-DyZgZbO4.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";const rt=15e3;function ot(t,i){return t.txHash&&i.txHash?t.txHash===i.txHash:t.txHash||i.txHash?!1:t.status===i.status&&Math.abs(t.createdAt-i.createdAt)<=rt}function ct(t){const i=[...t].sort((s,n)=>n.createdAt-s.createdAt),d=[];for(const s of i){const n=d[d.length-1];n&&ot(n[n.length-1],s)?n.push(s):d.push([s])}return d.map(s=>{var n;return{id:((n=s.find(r=>r.txHash))==null?void 0:n.txHash)??s[s.length-1].id,createdAt:Math.max(...s.map(r=>r.createdAt)),status:s.some(r=>r.status==="PENDING")?"PENDING":"SETTLED",totalCredits:s.reduce((r,u)=>r+u.credits,0),lines:s}})}function dt(t){const i=[],d=new Map;for(const s of t)if(s.tradeId){const n=d.get(s.tradeId);if(n){n.quantity+=1,n.credits+=s.credits;continue}const r={key:s.tradeId,tradeId:s.tradeId,quantity:1,credits:s.credits};d.set(s.tradeId,r),i.push(r)}else i.push({key:s.id,tradeId:null,quantity:1,credits:s.credits});return i}function lt(t,i){return{id:t.id,contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId,counterparty:t.buyer,credits:i?st(t.manaWei,i):null,createdAt:t.createdAt}}function ut(t){const d=ct(t.purchases.filter(n=>n.status!=="EXPIRED")).map(n=>({kind:"purchase",id:`purchase:${n.id}`,createdAt:n.createdAt,order:n})),s=t.sales.map(n=>{const r=lt(n,t.rate);return{kind:"sale",id:`sale:${r.id}`,createdAt:r.createdAt,sale:r}});return[...d,...s].sort((n,r)=>r.createdAt-n.createdAt||(n.id<r.id?-1:1))}function pt(t,i){if(i==="all")return t;const d=i==="purchases"?"purchase":"sale";return t.filter(s=>s.kind===d)}const g=V`
|
|
2
2
|
0% { background-position: 200% 0; }
|
|
3
3
|
100% { background-position: -200% 0; }
|
|
4
4
|
`,xt=o.section`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,j as v}from"./react-C51i12iP.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-
|
|
1
|
+
import{r as l,j as v}from"./react-C51i12iP.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-30084313421.commit-41b3e0b/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-30084313421.commit-41b3e0b/assets/DCL_LogoPattern-BryBPc3d.png",b=`
|
|
2
2
|
attribute vec2 a_position;
|
|
3
3
|
varying vec2 v_uv;
|
|
4
4
|
void main() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as Ze,r as p,j as e,b as Je}from"./react-C51i12iP.js";import{p as W,h as Xe,c as Ye,M as et,s,F as t,u as oe,a as tt,b as Ne,x as Ae,v as nt,t as o,I as N,C as F,d as he,j as D,k as st,l as ot,m as _e,G as rt,A as Q,az as it,aA as at}from"./index-
|
|
1
|
+
import{u as Ze,r as p,j as e,b as Je}from"./react-C51i12iP.js";import{p as W,h as Xe,c as Ye,M as et,s,F as t,u as oe,a as tt,b as Ne,x as Ae,v as nt,t as o,I as N,C as F,d as he,j as D,k as st,l as ot,m as _e,G as rt,A as Q,az as it,aA as at}from"./index-DJzwNEuW.js";import{r as lt,m as ct,a as Pe}from"./mana-rate-D0Q2dITA.js";import{u as Me}from"./useManaRate-DBsG9LRw.js";import{g as dt,h as ft,i as pt,j as ut,k as xt,C as ht,l as mt,o as gt,m as bt,n as yt,M as wt}from"./Assets.styles-BDoRqZww.js";import{d as me,R as vt,F as jt,S as ge,b as $t}from"./categories-CV9q9c1e.js";import{L as Ct}from"./LoadMore-DypsCZRq.js";import{M as kt}from"./MarketCheckout-rU7x7bhY.js";import{u as St}from"./useInfiniteGrid-DyZgZbO4.js";import{E as Rt}from"./ErrorNotice-C7soUjRV.js";import{d as It}from"./dcl-schemas-BICTSpB5.js";import{u as Et,G as Tt,w as zt,S as Nt}from"./buy-gasless-CGYytySC.js";import{s as At}from"./buy-8zXIWr42.js";import{h as _t}from"./trade-encoding-DuF5Et_P.js";import{f as Pt}from"./errors-BPMx500B.js";import{J as Mt,C as Lt,B as se}from"./ethers-w5dOkonM.js";import{l as Bt}from"./loader-logo-BzY9EKdC.js";import{n as Ft}from"./emotion-CSxEP8yM.js";import"./sentry-DKBoGDXH.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./Tooltip-BTVaKPyS.js";import"./authorizations-Bgadyzys.js";import"./sendMetaTransaction-CiO3jI6F.js";function Z(n){const r=n.source??"item",f=n.tradeId||`${n.contractAddress}-${n.tokenId??n.itemId??""}`;return`${r}:${f}`}const H="100000000000000000000",Le=2,V=15,Wt=/^[a-zA-Z0-9]+$/;function be(n){const r=n.trim();return r.length===0?{ok:!1,reason:"empty"}:Wt.test(r)?r.length<Le?{ok:!1,reason:"too-short"}:r.length>V?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Ht(n){return n.replace(/[^a-zA-Z0-9]/g,"").slice(0,V)}const Ot=["function available(string _subdomain) view returns (bool)"],ye={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Ut(){return W.chainId===It.ChainId.MATIC_MAINNET?ye.mainnet:ye.sepolia}async function Gt(n,r={}){var d;const{rpc:f,address:u}=Ut(),h=new Mt(f),l=new Lt(u,Ot,h);console.info(`[names] availability check → DCLRegistrar(${u}).available("${n}") on ${f}`);const c=await l.available(n);if((d=r.signal)!=null&&d.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${n}" available=${c}`),c?"available":"taken"}const qt="https://app.across.to/api";class Be extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function Dt(n){return ct(H,n)}async function Vt(n,r,f={}){var d;const u=f.chainId??W.chainId,h=f.provider??"across",l=`${W.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(r)}&chainId=${u}&provider=${h}`,c=await et(l,{method:"GET",identity:n,metadata:{}});if(!c.ok){let a;try{a=(d=await c.json())==null?void 0:d.code}catch{}throw a==="ROUTE_COST_TOO_HIGH"?new Be:new Error(`fetchNameCreditRoute ${c.status}`)}return c.json()}function Kt(n,r){const f=se.from(n.availableAmount),h=se.from(H).sub(f);return{credits:[{value:n.amount,expiresAt:Number(n.expiresAt),salt:_t(n.id)}],creditsSignatures:[n.signature],externalCall:{target:r.externalCall.target,selector:r.externalCall.selector,data:r.externalCall.data,expiresAt:r.externalCall.expiresAt,salt:r.externalCall.salt},customExternalCallSignature:r.customExternalCallSignature,maxUncreditedValue:h.isNegative()?"0":h.toString(),maxCreditedValue:H}}async function Qt(n,r={}){const f=qt,u=r.intervalMs??1e4,h=r.maxAttempts??60;let l={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let c=0;c<h;c++){try{const d=await fetch(`${f}/deposit/status?originChainId=137&depositTxHash=${n}`);if(d.ok){const a=await d.json(),x=(a.status??"pending").toLowerCase(),m=a.fillTx??a.fillTxnRef??null,w=a.actionsSucceeded!==!1;if(x==="filled")return{status:"filled",destinationTxHash:m,actionsSucceeded:w};if(x==="refunded"||x==="expired")return{status:x,destinationTxHash:null,actionsSucceeded:!1};l={status:"pending",destinationTxHash:m,actionsSucceeded:w}}}catch{}c<h-1&&await new Promise(d=>setTimeout(d,u))}return l}async function Zt(n){const{name:r,identity:f,signer:u}=n,h=n.chainId??W.chainId,l=n.provider??"across",c=(n.beneficiary??await u.getAddress()).toLowerCase();let d=null,a=!1;console.info("[names] register start",{name:r,buyer:c,chainId:h,provider:l});try{const x=await lt(h),m=Dt(x);console.info("[names] step 1/6 sized reservation",{usdCents:m,manaRate:x});const w=await Vt(f,r,{chainId:h,provider:l});console.info("[names] step 2/6 route fetched",{target:w.externalCall.target,selector:w.externalCall.selector,provider:w.provider,quoteId:w.quoteId});const j=await Xe(f,m);if(d=j.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:j.credit.id,maxCreditedValue:j.maxCreditedValue}),se.from(j.maxCreditedValue).lt(H))throw new Error("Credit under-sized for the name price");const k=Kt(j.credit,w);let g;try{g=await Et({chainId:h,buyer:c,signer:u,args:k})}catch(y){if(!(y instanceof Tt))throw y;g=await At(h,k,u)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:g}),await zt(g),a=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:g}),l==="across"){const y=await Qt(g,n.acrossPoll);if(console.info("[names] step 6/6 across status",y),y.status==="pending")return{status:"pending",originTxHash:g};if(y.status!=="filled"||!y.actionsSucceeded)throw new Error("The name could not be registered on Ethereum; your funds were recovered.");return{status:"registered",originTxHash:g,destinationTxHash:y.destinationTxHash}}return{status:"pending",originTxHash:g}}catch(x){if(console.error("[names] register failed — raw error:",x,{name:r,buyer:c,originConfirmed:a}),x instanceof Nt)return{status:"pending",originTxHash:x.txHash};throw d&&!a&&await Ye(f,[d]).catch(()=>{}),x instanceof Be?x:new Error(Pt(x,"Couldn't register the name. Please try again.",{sale:!0}))}}const Jt=s.div`
|
|
2
2
|
position: fixed;
|
|
3
3
|
inset: 0;
|
|
4
4
|
z-index: 10000;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as y,j as t}from"./react-C51i12iP.js";import{R as z,a as oe,C as ie,c as ne}from"./categories-
|
|
1
|
+
import{r as y,j as t}from"./react-C51i12iP.js";import{R as z,a as oe,C as ie,c as ne}from"./categories-CV9q9c1e.js";import{T as se}from"./Tooltip-BTVaKPyS.js";import{F as e,s as o,I as m,t as s,G as re,e as v}from"./index-DJzwNEuW.js";import{n as c}from"./emotion-CSxEP8yM.js";const ae=o.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 12px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t,L,r as N}from"./react-C51i12iP.js";import{s,B as q,F as e,N as B,m as D,t as i,u as F,v as G,I as m,C as H,o as I,b as Q,p as K,J as z,E as M,H as j}from"./index-
|
|
1
|
+
import{j as t,L,r as N}from"./react-C51i12iP.js";import{s,B as q,F as e,N as B,m as D,t as i,u as F,v as G,I as m,C as H,o as I,b as Q,p as K,J as z,E as M,H as j}from"./index-DJzwNEuW.js";import{b as W,c as J,s as O,d as P}from"./authorizations-Bgadyzys.js";import{f as X}from"./errors-BPMx500B.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";const U=B`
|
|
2
2
|
to { transform: rotate(360deg); }
|
|
3
3
|
`,V=s.section`
|
|
4
4
|
width: 100%;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as e,r as h,u as Qe,a as Ue,L as re}from"./react-C51i12iP.js";import{t as a,C as F,x as Y,m as We,ad as C,n as pe,u as $e,o as ze,a as Oe,b as Ge,aj as He,I as T,w as De,v as Je,ak as ge,j as J,al as ve,am as Ve,E as U,s as Ye,B as Xe,e as Ze,h as es,c as fe,an as ss,l as xe,k as as,ao as ts}from"./index-
|
|
1
|
+
import{j as e,r as h,u as Qe,a as Ue,L as re}from"./react-C51i12iP.js";import{t as a,C as F,x as Y,m as We,ad as C,n as pe,u as $e,o as ze,a as Oe,b as Ge,aj as He,I as T,w as De,v as Je,ak as ge,j as J,al as ve,am as Ve,E as U,s as Ye,B as Xe,e as Ze,h as es,c as fe,an as ss,l as xe,k as as,ao as ts}from"./index-DJzwNEuW.js";import{W as rs,C as cs,t as ns,a as is,s as ke}from"./CollectionCarousel-BWYkR7q0.js";import{a as je}from"./buy-8zXIWr42.js";import{a as ls,w as os,S as ds,G as us}from"./buy-gasless-CGYytySC.js";import{R as V,r as hs}from"./cart-checkout-CBAloPLv.js";import{g as ms}from"./authorizations-Bgadyzys.js";import{u as _s,M as ys,c as bs}from"./useCreditPacks-Cnffyb1f.js";import{l as ps}from"./loader-logo-BzY9EKdC.js";import{i as gs,a as vs}from"./errors-BPMx500B.js";import{E as fs}from"./ErrorNotice-C7soUjRV.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./address-DrURAr9O.js";import"./trade-encoding-DuF5Et_P.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";const xs="https://cdn.decentraland.org/@dcl/shop/0.1.0-30084313421.commit-41b3e0b/assets/buy-error-22UunaPC.png";function ks(r){const{phase:n,balanceCredits:u,onClose:y}=r,w=n==="processing",M=n==="error"?a("cartCheckout.errorTitle"):n==="nofunds"?a("cartCheckout.titleNoFunds"):a("cartCheckout.titleBuy"),q=n==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":a("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:w?void 0:y,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${q?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:M}),!w&&e.jsx("button",{className:"buy-modal__x",onClick:y,"aria-label":a("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:n==="nofunds"?a("buyModal.dclBalance"):a("buyModal.myCreditsBalance")}),e.jsx(F,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:Y(u)})]})]}),n==="processing"&&e.jsx(js,{stage:r.stage??"reserving",step:r.step??1,total:r.total??1,isSelfCustody:!!r.isSelfCustody}),n==="nofunds"&&e.jsx(Ns,{lines:r.lines??[],shortfallCredits:r.shortfallCredits??0,packs:r.packs??[],selectedPack:r.selectedPack??"",onSelectPack:r.onSelectPack??(()=>{}),onBuyPacks:r.onBuyPacks??(()=>{}),onCancel:y}),n==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-error",children:[e.jsx("img",{className:"buy-error__art",src:xs,alt:"",width:64,height:80}),e.jsxs("p",{className:"buy-error__text",children:[e.jsx("b",{children:a("cartCheckout.errorHeadline")})," ",a("cartCheckout.errorBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:y,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:r.onRetry??y,children:a("cartCheckout.tryAgain")})]})]})]})]})}function js({stage:r,step:n,total:u,isSelfCustody:y}){const w=r==="reserving",M=u>0?Math.min(100,Math.round(n/u*100)):0,q=r==="awaiting-signature"?y?a("buyModal.confirmToContinue"):a("buyModal.completingTransaction"):r==="settling"?a("buyModal.completingTransaction"):a("cartCheckout.preparing");return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:ps,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:q}),w?e.jsxs("div",{className:"cart-checkout__progress-row",children:[e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill buy-modal__progress-fill--step",style:{width:`${M}%`}})}),u>1?e.jsxs("span",{className:"cart-checkout__step",children:[n,"/",u]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function Ns({lines:r,shortfallCredits:n,packs:u,selectedPack:y,onSelectPack:w,onBuyPacks:M,onCancel:q}){const S=u.find(t=>t.id===y),X=r.reduce((t,f)=>t+(f.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(rs,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:a("buyModal.insufficientFunds")})," ",a("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:a("buyModal.warningCreditsAmount",{count:Math.max(0,n)})})," ",a("buyModal.warningToPurchase",{count:X})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:r.map(t=>{const f=t.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"buy-modal__asset-name",title:t.item.name,children:[t.item.name||a("buyModal.itemFallback"),f>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:a("cartCheckout.qty",{count:f})}):null]}),t.item.creator?e.jsx(cs,{address:t.item.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(F,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:Y(t.priceCredits*f)})]})]})]},t.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:u.map(t=>{const f=t.id===y;return e.jsxs("button",{className:`buy-modal__pack${f?" buy-modal__pack--on":""}`,onClick:()=>w(t.id),children:[e.jsx(F,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:Y(t.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",t.usd.toFixed(2),")"]})]},t.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(F,{className:"buy-modal__total-ico"}),e.jsx("span",{children:Y((S==null?void 0:S.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((S==null?void 0:S.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:q,children:a("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:M,children:a("buyModal.buy")})]})]})}const Cs=Ye(Xe)`
|
|
2
2
|
margin-top: 12px;
|
|
3
3
|
`;function Ne(r){if(gs(r))return a("errors.rejected");const n=(r.message??"").toLowerCase();return n.includes("insufficient")?a("cart.error.insufficient",{currency:Ze.name}):n.includes("no active listing")||n.includes("your own listing")?a("cart.error.listingChanged"):a("marketCheckout.error.generic")}const ws=12e4;function Ss(r){const n=[];return r.unavailable.length&&n.push(a("cart.drop.unavailable",{count:r.unavailable.length})),r.own.length&&n.push(a("cart.drop.own",{count:r.own.length})),a("cart.drop.removed",{items:n.join(` ${a("cart.drop.and")} `)})}const Ce=r=>r.reduce((n,u)=>n+u.priceCredits*u.quantity,0),Ms=r=>r.flatMap(n=>Array.from({length:n.quantity},()=>({...n,quantity:1})));function Ds(){We({title:a("nav.cart"),noindex:!0});const r=C(s=>s.items),n=C(s=>s.remove),u=C(s=>s.increment),y=C(s=>s.decrement),w=C(s=>s.clear),M=C(s=>s.restore),q=C(s=>s.setFittingOpen),S=pe(s=>s.items),X=pe(s=>s.toggle),{session:t,signIn:f}=$e(),W=_s().packs.slice(0,ys);h.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const we=r.some(s=>s.category!=="emote"),{data:Z}=ze({queryKey:["upsell-listings"],queryFn:()=>ts({first:40}),staleTime:6e4}),{data:B}=Oe(t),m=Ge(),$=Qe(),{state:E}=Ue(),[ce,A]=h.useState(null),[Se,L]=h.useState(null),[ne,z]=h.useState(null),[Me,I]=h.useState(!1),[x,K]=h.useState(null),ie=h.useRef(0),[o,k]=h.useState(null),[ee,le]=h.useState(""),se=h.useRef(null),oe=He(r),de=s=>ge(oe[s.id]),ae=r.filter(de),ue=r.length>0&&ae.length===0,qe=ae.reduce((s,c)=>s+c.priceCredits*c.quantity,0),Ee=r.reduce((s,c)=>s+c.quantity,0),Ie=ae.reduce((s,c)=>s+c.quantity,0),Pe=x?x.liveTotalCredits:qe,Re=new Set(r.map(s=>s.id)),he=((Z==null?void 0:Z.items)??[]).filter(s=>!Re.has(s.id)).slice(0,12),Te=new Map(x==null?void 0:x.buyable.map(s=>[s.item.id,s])),O=(B==null?void 0:B.credits)??0,Fe=Ve;function G(s){s(),K(null),z(null),L(null)}function Be(){k(null),I(!1)}function me(s){const c=Ce(s),i=Math.max(0,c-O),p=W.find(d=>d.credits>=i)??W[W.length-1];le(p.id),J("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:c,credits_balance:O,shortfall:i}),k({phase:"nofunds",lines:s.map(d=>({item:d.item,priceCredits:d.priceCredits,quantity:d.quantity})),shortfall:i}),I(!1)}async function Ae(s){if(!t||s.length===0)return;const c=Ms(s),i=c.map(l=>({...l.item,priceCredits:l.priceCredits})),p=s.map(l=>({...l.item,priceCredits:l.priceCredits,quantity:l.quantity})),d=[];let j="authorize",H=!1;k({phase:"processing",stage:"reserving",step:1,total:c.length});try{const l=[];for(let _=0;_<c.length;_++){const N=c[_];k({phase:"processing",stage:"reserving",step:_+1,total:c.length});try{const{credit:b,maxCreditedValue:te}=await es(t.identity,N.usdCents,N.trade.id);d.push(b.id),l.push({trade:N.trade,credits:[b],maxCreditedValue:te})}catch(b){if(vs(b)){if(d.length){try{await fe(t.identity,d)}catch(te){U(te,{flow:"cart_checkout",step:"release"})}m.invalidateQueries({queryKey:["usd-balance"]})}me(s);return}throw b}}j="submit";const g=()=>k({phase:"processing",stage:"settling",step:c.length,total:c.length});k({phase:"processing",stage:"awaiting-signature",step:c.length,total:c.length});let v=[];if(ms())try{v=await ls({purchases:l,buyer:t.address,signer:t.signer,onSigned:g});const N=(await Promise.allSettled(v.map(b=>os(b)))).flatMap(b=>b.status==="rejected"?[b.reason]:[]);if(N.length&&!N.some(b=>b instanceof ds))throw N[0];H=!0}catch(_){if(!(_ instanceof us))throw _;v=await je({purchases:l,buyer:t.address,signer:t.signer,onSigned:g})}else v=await je({purchases:l,buyer:t.address,signer:t.signer});s.forEach(_=>n(_.item.id)),K(null),J("Shop Completed Purchase",{...ss(i),payment_type:"credits",no_crypto_step:H,transaction_hash:v[0]??null}),m.invalidateQueries({queryKey:["usd-balance"]}),m.invalidateQueries({queryKey:["detail-trade"]}),m.invalidateQueries({queryKey:["shop-item"]}),m.invalidateQueries({queryKey:["owned-token"]}),m.invalidateQueries({queryKey:["public-token"]}),m.invalidateQueries({queryKey:["item-resales"]}),m.invalidateQueries({queryKey:["shop-items"]}),m.invalidateQueries({queryKey:["catalog-items"]}),m.invalidateQueries({queryKey:["my-assets"]}),m.invalidateQueries({queryKey:["purchases"]});const R=se.current;se.current=null,k(null),I(!1);const D={items:p,txHash:v[0]??void 0,settled:!0,...R?{creditsAdded:R}:{}};$("/success",{state:D,replace:!0})}catch(l){if(xe(l)||U(l,{flow:"cart_checkout",step:j,cart_size:s.length}),J(xe(l)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:j,error_code:as(l),value_usd:ve(i.reduce((g,v)=>g+v.priceCredits,0)),cart_size:c.length}),d.length){try{await fe(t.identity,d)}catch(g){U(g,{flow:"cart_checkout",step:"release"})}m.invalidateQueries({queryKey:["usd-balance"]})}k({phase:"error",message:Ne(l)})}}function _e(s){const c=Ce(s);if(B!=null&&B.credits<c){me(s);return}Ae(s)}async function Q(){if(!t){ke({type:"cart-checkout"}),f();return}const s=C.getState().items.filter(de);if(s.length===0)return;L(null),z(null),I(!0);const c=s.reduce((i,p)=>i+p.priceCredits*p.quantity,0);J("Shop Started Checkout",{cart_size:s.length,cart_value_credits:c,cart_value_usd:ve(c),has_sufficient_credits:O>=c});try{A(a("cart.status.reviewing"));const i=await hs(s,t.address,Fe),p=[...i.unavailable,...i.own];if(p.length&&(p.forEach(d=>n(d.id)),z(Ss(i))),i.buyable.length===0){L(a("cart.error.noneAvailable")),K(null),A(null);return}if(i.orderChanged){K(i),ie.current=Date.now(),A(null);return}A(null),_e(i.buyable)}catch(i){U(i,{flow:"cart_checkout",step:"review",cart_size:s.length}),L(Ne(i)),A(null)}finally{I(!1)}}async function Le(){if(x){if(!t){ke({type:"cart-checkout"}),f();return}if(Date.now()-ie.current>ws){K(null),z(null),await Q();return}L(null),_e(x.buyable)}}async function Ke(){if(ee){try{sessionStorage.setItem(V,JSON.stringify(C.getState().items))}catch{}I(!0);try{const s=await bs(ee,t?{address:t.address,identity:t.identity}:void 0);if(s.url){window.location.href=s.url;return}$("/credits")}catch(s){try{sessionStorage.removeItem(V)}catch{}U(s,{flow:"cart_buy_credits"}),k({phase:"error",message:a("buyModal.error.creditsCheckout")})}finally{I(!1)}}}const ye=h.useRef(!1);h.useEffect(()=>{if(!t||ye.current||!ns("cart-checkout"))return;ye.current=!0;const s=setTimeout(()=>void Q(),0);return()=>clearTimeout(s)},[t]);const be=h.useRef(!1);h.useEffect(()=>{if(!(E!=null&&E.resumeCheckout)||be.current)return;be.current=!0,se.current=E.creditsAdded??null;try{const c=sessionStorage.getItem(V);if(c){sessionStorage.removeItem(V);const i=JSON.parse(c);Array.isArray(i)&&i.length&&M(i)}}catch{}m.invalidateQueries({queryKey:["usd-balance"]});const s=setTimeout(()=>void Q(),0);return()=>clearTimeout(s)},[E==null?void 0:E.resumeCheckout]);const P=Me||(o==null?void 0:o.phase)==="processing";return r.length===0&&!o?e.jsxs("div",{className:"cart cart--empty",children:[e.jsx(T,{name:"cart",size:44,color:"var(--muted-2)"}),e.jsx("p",{className:"cart-empty__title",children:a("cart.empty.title")}),e.jsx("p",{className:"muted",children:a("cart.empty.body")}),e.jsx(Cs,{as:re,to:"/assets",variant:"purple",children:a("cart.empty.cta")})]}):e.jsxs("div",{className:"checkout",children:[e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>$(-1),type:"button",children:[e.jsx(T,{name:"arrow-left"}),a("nav.cart")]}),e.jsxs("div",{className:"checkout__body",children:[e.jsxs("div",{className:"checkout__left",children:[e.jsxs("div",{className:"checkout__head-card",children:[e.jsx("button",{className:"checkout__panel-back",onClick:()=>$(-1),type:"button","aria-label":a("cart.goBack"),children:e.jsx(T,{name:"arrow-left"})}),e.jsx("h1",{className:"checkout__panel-title",children:a("cart.panelTitle",{count:Ee})}),we?e.jsxs("button",{className:"checkout__fitting",onClick:()=>q(!0),disabled:P,children:[e.jsx(T,{name:"fitting-room"}),a("cart.fittingRoom")]}):null]}),e.jsxs("section",{className:"checkout__panel",children:[e.jsx("div",{className:"checkout__list",children:r.map(s=>{const c=Te.get(s.id),i=c?c.priceCredits:s.priceCredits,p=!!c&&c.priceCredits!==s.priceCredits,d=!s.tokenId,j=s.quantity,H=typeof s.available=="number"&&j>=s.available,l=i*j,g=!!S[s.id],v=s.tokenId??s.itemId,R=s.contractAddress&&v?`/item/${s.contractAddress}/${v}`:null,D=oe[s.id],_=!ge(D),N=D==="sold-out"?a("cart.availability.soldOut"):a("cart.availability.unavailable");return e.jsxs("div",{className:`checkout__card${_?" is-unavailable":""}`,children:[e.jsxs("div",{className:"checkout__thumb",children:[R?e.jsx(re,{className:"checkout__thumb-link",to:R,state:{item:s,tradeId:s.tradeId},"aria-label":s.name,children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null}):s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null,e.jsx("span",{className:"checkout__thumb-check","aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"checkout__info",children:[e.jsxs("div",{className:"checkout__desc",children:[R?e.jsx(re,{className:"checkout__name",to:R,state:{item:s,tradeId:s.tradeId},title:s.name,children:s.name}):e.jsx("div",{className:"checkout__name",title:s.name,children:s.name}),s.creator?e.jsx(De,{address:s.creator,className:"checkout__creator",linkToProfile:!0}):null]}),e.jsx("div",{className:"checkout__foot",children:_?e.jsx("span",{className:"checkout__unavailable",children:N}):e.jsxs(e.Fragment,{children:[d?e.jsxs("div",{className:"checkout__stepper",children:[e.jsx("button",{className:"checkout__step",onClick:()=>G(()=>y(s.id)),disabled:P||j<=1,"aria-label":a("cart.decreaseQuantity",{name:s.name}),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsx("span",{className:"checkout__qty",children:j}),e.jsx("button",{className:"checkout__step",onClick:()=>G(()=>u(s.id)),disabled:P||H,"aria-label":a("cart.increaseQuantity"),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null,e.jsxs("div",{className:"checkout__price",children:[e.jsx(F,{className:"checkout__price-ico"})," ",l,p?e.jsx("span",{className:"checkout__price-was",children:s.priceCredits*j}):null]})]})})]}),e.jsxs("div",{className:"checkout__actions",children:[e.jsx("button",{className:`checkout__fav${g?" is-on":""}`,onClick:()=>X(s),"aria-label":g?a("cart.removeFromFavorites",{name:s.name}):a("cart.addToFavorites",{name:s.name}),title:g?a("assetCard.removeFromFavorites"):a("assetCard.addToFavorites"),children:e.jsx(T,{name:g?"heart-solid":"heart"})}),e.jsx("button",{className:"checkout__remove",onClick:()=>G(()=>n(s.id)),disabled:P,"aria-label":a("cart.remove",{name:s.name}),title:a("cart.removeTitle"),children:e.jsx(T,{name:"trash",size:24})})]})]},s.id)})}),e.jsx("div",{className:"checkout__utils",children:e.jsx("button",{className:"link",onClick:()=>G(w),disabled:P,children:a("cart.clearCart")})})]})]}),e.jsxs("aside",{className:"checkout__summary",children:[e.jsx("h2",{className:"checkout__summary-title",children:a("cart.purchaseSummary")}),e.jsxs("div",{className:"checkout__summary-body",children:[e.jsxs("div",{className:"checkout__total-line",children:[e.jsx("span",{className:"checkout__total-label",children:a("cart.totalItems",{count:Ie})}),e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(F,{className:"checkout__total-ico"})," ",Pe]})]}),e.jsx("button",{className:"checkout__cta",onClick:()=>void(x?Le():Q()),disabled:P||ue,children:P?a("cart.working"):x?a("marketCheckout.confirmPurchase"):a("assetCard.buyNow")}),ue?e.jsx("p",{className:"muted checkout__msg",children:a("cart.allUnavailable")}):null,t?null:e.jsx("p",{className:"muted checkout__msg",children:a("cart.signInHint")}),x?e.jsx("p",{className:"muted checkout__msg",children:a("cart.priceChanged")}):null,ne?e.jsx("p",{className:"muted checkout__msg",children:ne}):null,ce?e.jsx("p",{className:"muted checkout__msg",children:ce}):null,e.jsx(fs,{message:Se,className:"checkout__msg"})]})]})]})]}),he.length>0?e.jsx("div",{className:"cart-upsell",children:e.jsx(is,{title:a("cart.youMightAlsoLike"),items:he})}):null,o?e.jsx(ks,{phase:o.phase,balanceCredits:O,onClose:Be,stage:o.phase==="processing"?o.stage:void 0,step:o.phase==="processing"?o.step:void 0,total:o.phase==="processing"?o.total:void 0,isSelfCustody:Je(t==null?void 0:t.providerType),lines:o.phase==="nofunds"?o.lines:void 0,shortfallCredits:o.phase==="nofunds"?o.shortfall:void 0,packs:W,selectedPack:ee,onSelectPack:le,onBuyPacks:()=>void Ke(),message:o.phase==="error"?o.message:void 0,onRetry:()=>void Q()}):null]})}export{Ds as Cart};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{O as N,P as U,Q as w,R as z,S as o,U as E,V as c,W as I,X as g,Y as D,N as R}from"./index-
|
|
1
|
+
import{O as N,P as U,Q as w,R as z,S as o,U as E,V as c,W as I,X as g,Y as D,N as R}from"./index-DJzwNEuW.js";import{r as W,j as v}from"./react-C51i12iP.js";function F(r){return N("MuiCircularProgress",r)}U("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const K=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,S,b,$;const t=44,V=R(P||(P=l`
|
|
2
2
|
0% {
|
|
3
3
|
transform: rotate(0deg);
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,r as p,d as Q,u as Y}from"./react-C51i12iP.js";import{F as N,s as v,ar as Z,I as J,t,p as V,E as W,o as X,m as ee,A as ae,as as te,e as re,at as se}from"./index-
|
|
1
|
+
import{j as e,r as p,d as Q,u as Y}from"./react-C51i12iP.js";import{F as N,s as v,ar as Z,I as J,t,p as V,E as W,o as X,m as ee,A as ae,as as te,e as re,at as se}from"./index-DJzwNEuW.js";import{E as oe}from"./ErrorNotice-C7soUjRV.js";import{d as ie,g as ce,a as ne,A as le}from"./collection-RngIGkUk.js";import{u as de}from"./useStore-DW_s4ry_.js";import{s as E}from"./address-DrURAr9O.js";import{d as F,a as me,F as pe,e as ue,S as R,b as ge}from"./categories-CV9q9c1e.js";import{L as xe}from"./LoadMore-DypsCZRq.js";import{u as he}from"./useInfiniteGrid-DyZgZbO4.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";const be=v.section`
|
|
2
2
|
position: relative;
|
|
3
3
|
border-radius: ${N.radius.card};
|
|
4
4
|
overflow: hidden;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,r as l}from"./react-C51i12iP.js";import{ar as C,G as N,t as i,I as E,au as x,A as S}from"./index-
|
|
1
|
+
import{j as e,r as l}from"./react-C51i12iP.js";import{ar as C,G as N,t as i,I as E,au as x,A as S}from"./index-DJzwNEuW.js";import{s as A}from"./address-DrURAr9O.js";const h="shop:resume_after_signin",I=900*1e3;function R(a){try{sessionStorage.setItem(h,JSON.stringify({...a,at:Date.now()}))}catch{}}function P(a){let o;try{o=sessionStorage.getItem(h)}catch{return null}if(!o)return null;try{sessionStorage.removeItem(h)}catch{}let r;try{r=JSON.parse(o)}catch{return null}return!r||r.type!==a||typeof r.at!="number"||Date.now()-r.at>I?null:r.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:r.path}}function z({address:a,className:o}){const{data:r}=C(a),c=r!=null&&r.name?N(r.name):A(a);return e.jsx("div",{className:o,children:i("search.byCreator",{name:c})})}function B({className:a}){return e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:a,children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"#691fa9",strokeWidth:"1.8"}),e.jsx("path",{d:"M12 7v6",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"16.5",r:"1.1",fill:"#691fa9"})]})}function D({title:a,items:o,onViewAll:r}){const c=l.useRef(null),[d,g]=l.useState(1),[m,v]=l.useState(0),[j,k]=l.useState(!0),[w,y]=l.useState(!1),n=l.useCallback(()=>{const s=c.current;if(!s)return;const{scrollLeft:t,scrollWidth:_,clientWidth:u}=s,p=Math.max(1,Math.ceil(_/u));g(p),v(Math.min(p-1,Math.round(t/u))),k(t<=1),y(t+u>=_-1)},[]);if(l.useEffect(()=>{n();const s=c.current;if(s)return s.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n),()=>{s.removeEventListener("scroll",n),window.removeEventListener("resize",n)}},[n,o.length]),o.length===0)return null;function f(s){const t=c.current;t&&t.scrollBy({left:s*t.clientWidth,behavior:"smooth"})}function b(s){const t=c.current;t&&t.scrollTo({left:s*t.clientWidth,behavior:"smooth"})}return e.jsxs("section",{className:"collection-carousel",children:[e.jsxs("div",{className:"collection-carousel__head",children:[e.jsx("h2",{className:"collection-carousel__title",children:a}),r?e.jsxs("button",{className:"collection-carousel__viewall",onClick:r,children:[i("collectionCarousel.viewAll"),e.jsx(E,{name:"chevron-down",size:16,className:"collection-carousel__viewall-ico"})]}):null]}),e.jsxs("div",{className:"collection-carousel__viewport",children:[e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--left",onClick:()=>f(-1),"aria-label":i("collectionCarousel.scrollLeft"),disabled:j,children:e.jsx("img",{src:x,alt:"","aria-hidden":!0})}),e.jsx("div",{className:"collection-carousel__track",ref:c,children:o.map(s=>e.jsx(S,{item:s},s.id))}),e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--right",onClick:()=>f(1),"aria-label":i("collectionCarousel.scrollRight"),disabled:w,children:e.jsx("img",{src:x,alt:"","aria-hidden":!0})})]}),d>1?e.jsx("div",{className:"collection-carousel__dots","aria-label":i("collectionCarousel.pages"),children:Array.from({length:d}).map((s,t)=>e.jsx("button",{className:`collection-carousel__dot${t===m?" is-active":""}`,"aria-label":i("collectionCarousel.goToPage",{page:t+1}),"aria-current":t===m?"true":void 0,onClick:()=>b(t)},t))}):null]})}export{z as C,B as W,D as a,R as s,P as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as K,j as e,L as re,d as se,b as te,r as j}from"./react-C51i12iP.js";import{av as oe,aw as ce,w as le,t as a,ax as E,B as ne,ar as D,u as ie,I,p as de,m as me,A as ue,ao as he,ay as ge,e as xe}from"./index-
|
|
1
|
+
import{u as K,j as e,L as re,d as se,b as te,r as j}from"./react-C51i12iP.js";import{av as oe,aw as ce,w as le,t as a,ax as E,B as ne,ar as D,u as ie,I,p as de,m as me,A as ue,ao as he,ay as ge,e as xe}from"./index-DJzwNEuW.js";import{d as _e,g as pe,a as Ne,A as je}from"./collection-RngIGkUk.js";import{u as be,L as fe}from"./useStore-DW_s4ry_.js";import{s as O}from"./address-DrURAr9O.js";import{d as $,a as ve,S as w,F as Ce,e as we,b as ke}from"./categories-CV9q9c1e.js";import{L as B}from"./LoadMore-DypsCZRq.js";import{u as R}from"./useInfiniteGrid-DyZgZbO4.js";import{E as T}from"./ErrorNotice-C7soUjRV.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";function Pe({collection:t,cover:r,itemCount:o}){const n=K(),{contractAddress:m,name:g,creator:x}=t,N=r==null||o==null,{data:i}=oe(m,N),p=r==null?(i==null?void 0:i.items)??[]:[],h=o??(i==null?void 0:i.total);function _(){n(`/collection/${m}`)}return e.jsxs("article",{className:"coll-card",role:"link",tabIndex:0,onClick:_,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),_())},children:[e.jsx("div",{className:"coll-card__media",children:r?e.jsx("img",{className:"coll-card__img","data-testid":"coll-card-img",src:r,alt:"",loading:"lazy"}):p.length>0?e.jsx(ce,{items:p,className:"coll-card__cover"}):null}),e.jsxs("div",{className:"coll-card__body",children:[e.jsx("h3",{className:"coll-card__name",title:g,children:g}),e.jsxs("div",{className:"coll-card__meta",children:[x?e.jsx(le,{address:x,className:"coll-card__creator",linkToProfile:!0}):e.jsx("span",{className:"coll-card__creator",children:" "}),e.jsx("span",{className:"coll-card__count",children:h==null?"…":a("collectionCard.itemCount",{count:h})})]}),e.jsx("button",{className:"coll-card__view",onClick:d=>{d.stopPropagation(),_()},tabIndex:-1,children:a("collectionCard.viewCollection")})]})]})}function ye({address:t,className:r=""}){const o=E(m=>m.followed.includes(t.toLowerCase())),n=E(m=>m.toggle);return t?e.jsx(ne,{type:"button",size:"sm",variant:o?"ghost":"outline",className:r||void 0,"aria-pressed":o,title:o?a("creator.unfollowTitle"):a("creator.followTitle"),onClick:()=>n(t),children:o?a("creator.following"):a("creator.follow")}):null}const Se={website:"website",twitter:"twitter",discord:"discord",facebook:"facebook"};function Le({address:t}){var d,b;const{data:r}=D(t),{data:o}=be(t),n=ie(l=>{var f;return(f=l.session)==null?void 0:f.address}),m=!!n&&n.toLowerCase()===t.toLowerCase(),g=(r==null?void 0:r.name)||O(t),x=(b=(d=r==null?void 0:r.avatar)==null?void 0:d.snapshots)==null?void 0:b.face256,N=(o==null?void 0:o.cover)||_e,i=o==null?void 0:o.description,p=`${de.profileUrl}/${t}`,h=fe.filter(l=>o==null?void 0:o.links[l]),_=pe(Ne({name:r==null?void 0:r.name,hasClaimedName:r==null?void 0:r.hasClaimedName,ethAddress:(r==null?void 0:r.ethAddress)??t}));return e.jsxs("section",{className:"creator-hero","aria-label":`${g} storefront`,children:[e.jsxs("div",{className:"creator-hero__cover",children:[e.jsx("img",{className:"creator-hero__cover-img",src:N,alt:"",loading:"eager"}),e.jsx("div",{className:"creator-hero__scrim","aria-hidden":!0})]}),(h.length>0||m)&&e.jsxs("div",{className:"creator-hero__links",children:[h.map(l=>e.jsx("a",{className:"creator-hero__link","data-testid":"creator-hero-link",href:(o==null?void 0:o.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:a(`creator.link.${l}`),"aria-label":a(`creator.link.${l}`),children:e.jsx(I,{name:Se[l]})},l)),m&&e.jsx(re,{className:"creator-hero__link creator-hero__edit",to:"/store-settings",title:a("creator.editStore"),"aria-label":a("creator.editStore"),children:e.jsx(I,{name:"pen"})})]}),e.jsxs("div",{className:"creator-hero__body",children:[x?e.jsx("img",{className:"creator-hero__ava",src:x,alt:"",loading:"eager",style:{backgroundColor:_}}):e.jsx("span",{className:"creator-hero__ava creator-hero__ava--ph","aria-hidden":!0,style:{backgroundColor:_}}),e.jsxs("div",{children:[e.jsx("h2",{className:"creator-hero__name",children:g}),i?e.jsx("p",{className:"creator-hero__desc",children:i}):null]}),e.jsxs("div",{className:"creator-hero__actions",children:[e.jsx("a",{className:"creator-hero__view","data-testid":"creator-hero-view",href:p,target:"_blank",rel:"noopener noreferrer",children:a("creator.viewProfile")}),e.jsx(ye,{address:t,className:"creator-hero__follow"})]})]})]})}const U=48;function Ge(){const{address:t}=se(),r=K(),[o]=te(),n=o.has("collections"),{data:m}=D(t),g=(m==null?void 0:m.name)||(t?O(t):a("creator.fallbackName"));me({title:g,description:a("seo.creator.description",{name:g})});const[x,N]=j.useState("wearable"),[i,p]=j.useState(null),[h,_]=j.useState([]),[d,b]=j.useState(""),[l,f]=j.useState(""),[P,z]=j.useState("newest"),y=d&&!Number.isNaN(Number(d))?Number(d):void 0,S=l&&!Number.isNaN(Number(l))?Number(l):void 0,G=i?ke[i]:void 0,H=($.find(s=>s.key===P)??$[0]).server,L={creator:t,category:x,rarities:h.length?h:void 0,wearableCategories:G,minPriceCredits:y,maxPriceCredits:S,sortBy:H},{items:v,total:Y,isLoading:C,error:A,hasNextPage:W,isFetchingNextPage:F,fetchNextPage:Z}=R(["creator-listings",L],s=>he({...L,first:U,skip:s}),{enabled:!!t&&!n}),u=R(["creator-collections",t],s=>ge(t,{first:U,skip:s}).then(c=>({items:c.collections,total:c.total})),{enabled:!!t&&n});function q(s){N(s),p(null),n&&M()}function M(){const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}`:""},{replace:!0})}function J(){if(n){M();return}const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function Q(s){_(c=>c.includes(s)?c.filter(ae=>ae!==s):[...c,s])}function V(){N("wearable"),p(null),_([]),b(""),f("")}const k=!!(y||S),X=k?`${d||"0"}–${l||"∞"}`:a("filter.price"),ee=x!=="wearable"||!!i||h.length>0||k;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":a("creator.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>r("/assets"),children:a("creator.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:g})]}),t?e.jsx(Le,{address:t}):null,!n&&!C&&v.length>0?e.jsx(je,{items:v,source:"creator"}):null,e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(ve,{category:x,subCategory:i,onCategory:q,onSub:p,title:a("creator.category"),flat:!0,collections:n,onCollections:J})}),e.jsx("div",{className:"browse__main",children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"creator-collections__bar",children:e.jsx("span",{className:"assets__count",children:u.isLoading?"…":a("creator.collectionsCount",{count:u.total})})}),u.error?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid grid--collections",children:u.isLoading?e.jsx(w,{count:9}):e.jsxs(e.Fragment,{children:[u.items.map(s=>e.jsx(Pe,{collection:s,itemCount:s.itemCount},s.contractAddress)),u.isFetchingNextPage?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:u.hasNextPage,isFetching:u.isFetchingNextPage,onLoadMore:()=>void u.fetchNextPage()}),!u.isLoading&&!u.error&&u.items.length===0?e.jsx("p",{className:"muted",children:a("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{rarities:h,onToggleRarity:Q,sort:P,onSort:z,total:Y,loading:C,anyActive:ee,onClear:V,renderTrailing:s=>e.jsx(we,{panelKey:"price",label:X,active:k,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMin"),placeholder:a("creator.priceMinPlaceholder"),value:d,onChange:c=>b(c.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMax"),placeholder:a("creator.priceMaxPlaceholder"),value:l,onChange:c=>f(c.target.value)})]}),e.jsx("p",{className:"filter-pop__hint",children:a("creator.priceHint",{currency:xe.name})})]})})}),A?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid",children:C?e.jsx(w,{count:15}):e.jsxs(e.Fragment,{children:[v.map(s=>e.jsx(ue,{item:s},s.id)),F?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:W,isFetching:F,onLoadMore:()=>void Z()}),!C&&!A&&v.length===0?e.jsx("p",{className:"muted",children:a("creator.empty")}):null]})})]})]})}export{Ge as Creator,Ge as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{bg as U,bh as Ue,S as C,bi as qe,bj as Ye,a0 as Je,bk as Qe,aE as Xe,R as W,aJ as K,aI as Te,bl as a,bm as Ze,bn as Le,T as et,aP as tt}from"./index-
|
|
1
|
+
import{bg as U,bh as Ue,S as C,bi as qe,bj as Ye,a0 as Je,bk as Qe,aE as Xe,R as W,aJ as K,aI as Te,bl as a,bm as Ze,bn as Le,T as et,aP as tt}from"./index-DJzwNEuW.js";import{R as rt,g as ot}from"./getOverlayAlpha-DPVIWFtM.js";import{j as T,r as y}from"./react-C51i12iP.js";import{u as nt,a as Be}from"./useTheme-niAOV5zA.js";function ne(r){const o=Ue(r);return r!==o&&o.styles?(o.styles.match(/^@layer\s+[^{]*$/)||(o.styles=`@layer global{${o.styles}}`),o):r}function at({styles:r,themeId:o,defaultTheme:n={}}){const i=nt(n),s=o&&i[o]||i;let l=typeof r=="function"?r(s):r;return s.modularCssLayers&&(Array.isArray(l)?l=l.map(d=>ne(typeof d=="function"?d(s):d)):l=ne(l)),T.jsx(U,{styles:l})}const Ee=y.createContext(null);function se(){return y.useContext(Ee)}const it=typeof Symbol=="function"&&Symbol.for,st=it?Symbol.for("mui.nested"):"__THEME_NESTED__";function lt(r,o){return typeof o=="function"?o(r):C({},r,o)}function ct(r){const{children:o,theme:n}=r,i=se(),s=y.useMemo(()=>{const l=i===null?n:lt(i,n);return l!=null&&(l[st]=i!==null),l},[n,i]);return T.jsx(Ee.Provider,{value:s,children:o})}function dt(r){const o=Be(),n=qe()||"",{modularCssLayers:i}=r;let s="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!i||o!==null?s="":typeof i=="string"?s=i.replace(/mui(?!\.)/g,s):s=`@layer ${s};`,Ye(()=>{const l=document.querySelector("head");if(!l)return;const d=l.firstChild;if(s){var m;if(d&&(m=d.hasAttribute)!=null&&m.call(d,"data-mui-layer-order")&&d.getAttribute("data-mui-layer-order")===n)return;const S=document.createElement("style");S.setAttribute("data-mui-layer-order",n),S.textContent=s,l.prepend(S)}else{var f;(f=l.querySelector(`style[data-mui-layer-order="${n}"]`))==null||f.remove()}},[s,n]),s?T.jsx(at,{styles:s}):null}const $e={};function xe(r,o,n,i=!1){return y.useMemo(()=>{const s=r&&o[r]||o;if(typeof n=="function"){const l=n(s),d=r?C({},o,{[r]:l}):l;return i?()=>d:d}return r?C({},o,{[r]:n}):C({},o,n)},[r,o,n,i])}function ut(r){const{children:o,theme:n,themeId:i}=r,s=Be($e),l=se()||$e,d=xe(i,s,n),m=xe(i,l,n,!0),f=d.direction==="rtl",S=dt(d);return T.jsx(ct,{theme:m,children:T.jsx(Je.Provider,{value:d,children:T.jsx(rt,{value:f,children:T.jsxs(Qe,{value:d==null?void 0:d.components,children:[S,o]})})})})}const le="mode",ce="color-scheme",Ie="data-color-scheme";function mt(r){const{defaultMode:o="light",defaultLightColorScheme:n="light",defaultDarkColorScheme:i="dark",modeStorageKey:s=le,colorSchemeStorageKey:l=ce,attribute:d=Ie,colorSchemeNode:m="document.documentElement",nonce:f}=r||{};return T.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?f:"",dangerouslySetInnerHTML:{__html:`(function() {
|
|
2
2
|
try {
|
|
3
3
|
var mode = localStorage.getItem('${s}') || '${o}';
|
|
4
4
|
var colorScheme = '';
|
|
@@ -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-CbjIJy-0.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-nTALreMf.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 +1 @@
|
|
|
1
|
-
import{u as $,b as q,r as i,j as e}from"./react-C51i12iP.js";import{m as H,t as s,u as Q,b as V,j as g,e as d,E as P,k as I,C as W,f as z}from"./index-
|
|
1
|
+
import{u as $,b as q,r as i,j as e}from"./react-C51i12iP.js";import{m as H,t as s,u as Q,b as V,j as g,e as d,E as P,k as I,C as W,f as z}from"./index-DJzwNEuW.js";import{R as G}from"./resume-buy-Bf0zIH7y.js";import{R as D}from"./cart-checkout-CBAloPLv.js";import{l as J}from"./loader-logo-BzY9EKdC.js";import{u as Z,p as X,c as ee,i as se}from"./useCreditPacks-Cnffyb1f.js";import{C as te}from"./CircularProgress-CQ5EJ-uq.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";const j="https://cdn.decentraland.org/@dcl/shop/0.1.0-30084313421.commit-41b3e0b/assets/pack-chips--HnOpf5U.webp",re="https://cdn.decentraland.org/@dcl/shop/0.1.0-30084313421.commit-41b3e0b/assets/credit-coin-CmcTCd5i.webp",ae="data:image/svg+xml,%3csvg%20width='60'%20height='60'%20viewBox='0%200%2060%2060'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='60'%20height='60'%20rx='30'%20fill='%2334CE77'/%3e%3cpath%20d='M21.6583%2046.1067L11.4656%2036.0591C10.1688%2034.829%2010.1905%2032.7207%2011.4769%2031.4622L13.6868%2029.3591C14.9732%2028.1006%2017.1615%2028.1058%2018.4582%2029.3359L23.8747%2034.6197L41.9704%2015.6527C43.2568%2014.3942%2045.4291%2014.2093%2046.7258%2015.4394L48.8765%2017.3628C50.1732%2018.5929%2050.3491%2020.6844%2049.0626%2021.9429L26.6112%2045.8766C25.1433%2047.342%2022.955%2047.3368%2021.6583%2046.1067Z'%20fill='%23FCFCFC'/%3e%3c/svg%3e",x=se()?"mock":"stripe",ce={pack_5:j,pack_10:j,pack_25:j,pack_50:j},ne="https://docs.decentraland.org";function M(l){const r=l;if((r==null?void 0:r.name)==="AbortError")return s("getCredits.errorCanceled");const m=((r==null?void 0:r.message)??"").toLowerCase();return m.includes("sign in")?s("getCredits.errorSignIn",{currency:d.name}):m.includes("timed out")?s("getCredits.errorTimeout",{currency:d.name}):s("getCredits.errorGeneric")}function je(){H({title:s("nav.getCredits",{currency:d.name}),noindex:!0});const l=$(),{session:r,signIn:m}=Q(),n=V(),[N,w]=q(),{packs:F,isLoading:T}=Z(),[p,o]=i.useState("select"),[c,E]=i.useState(null),[R,L]=i.useState(null),[U,h]=i.useState(null),[K,f]=i.useState(!1),b=i.useRef(null);i.useEffect(()=>()=>{var t;return(t=b.current)==null?void 0:t.abort()},[]);const A=i.useCallback(()=>{w(t=>{const a=new URLSearchParams(t);return a.delete("order"),a.delete("canceled"),a},{replace:!0})},[w]),y=i.useCallback(async t=>{o("processing");const a=new AbortController;b.current=a;try{const u=await X(t,{signal:a.signal,address:r==null?void 0:r.address,identity:r==null?void 0:r.identity});if(u.status==="credited"){const _=u.creditsGranted??(c==null?void 0:c.credits)??0;L(_>0?_:null),o("success"),g("Shop Completed Buy Credits",{order_id:t,pack_usd:(c==null?void 0:c.usd)??null,credits:_>0?_:null,provider:x}),n.invalidateQueries({queryKey:["usd-balance"]});try{if(sessionStorage.getItem(D)){const k={resumeCheckout:!0,..._>0?{creditsAdded:_}:{}};l("/cart",{state:k});return}}catch{}try{const k=sessionStorage.getItem(G);if(k){sessionStorage.removeItem(G);const C=JSON.parse(k),B=C.tokenId??C.itemId;if(C.contractAddress&&B){l(`/item/${C.contractAddress}/${B}`,{state:{item:C,resumeBuy:!0}});return}}}catch{}}else u.status==="pending"?(g("Shop Buy Credits Pending",{step:"grant",pack_usd:(c==null?void 0:c.usd)??null}),n.invalidateQueries({queryKey:["usd-balance"]}),o("pending")):(g("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(c==null?void 0:c.usd)??null}),h(u.error??s("getCredits.errorGrant",{currency:d.name})),o("error"))}catch(u){P(u,{flow:"get_credits",step:"grant",order_id:t}),g("Shop Buy Credits Failed",{step:"grant",error_code:I(u),pack_usd:(c==null?void 0:c.usd)??null}),h(M(u)),o("error")}},[c,r,n,l]),O=i.useCallback(async t=>{if(!r){m();return}h(null),f(!1),E(t),o(x==="mock"?"processing":"redirecting"),g("Shop Started Buy Credits",{pack_usd:t.usd,credits:t.credits,provider:x});try{const a=await ee(t.id,{address:r.address,identity:r.identity});if(a.mock)y(a.orderId);else if(a.url)g("Shop Redirected To Stripe",{order_id:a.orderId,pack_usd:t.usd,credits:t.credits}),window.location.href=a.url;else throw new Error("Checkout did not return a redirect url")}catch(a){P(a,{flow:"get_credits",step:"checkout",provider:x}),g("Shop Buy Credits Failed",{step:"checkout",error_code:I(a),pack_usd:t.usd}),h(M(a)),o("error")}},[r,m,y]),v=i.useRef(!1);i.useEffect(()=>{if(v.current)return;const t=N.get("order");if(N.get("canceled")!=null){v.current=!0,g("Shop Buy Credits Cancelled",{order_id:t,provider:x}),A(),f(!0),o("select");return}t&&(o("processing"),r&&(v.current=!0,A(),y(t)))},[N,r]);function S(){var t;(t=b.current)==null||t.abort(),o("select"),E(null),L(null),h(null),f(!1)}const Y=p==="select";return e.jsxs("div",{className:"getcredits",children:[Y&&e.jsxs("header",{className:"getcredits__head",children:[e.jsx("h1",{className:"getcredits__title",children:s("getCredits.title",{currency:d.name})}),e.jsxs("p",{className:"getcredits__sub",children:[s("getCredits.subtitle",{currency:d.name})," ",e.jsxs("a",{className:"getcredits__learn",href:ne,target:"_blank",rel:"noreferrer",children:[s("getCredits.learnMore"),e.jsxs("svg",{className:"getcredits__learn-ico",viewBox:"0 0 13 13","aria-hidden":!0,fill:"none",children:[e.jsx("path",{d:"M4 2h7v7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M11 2 2 11",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]})]})]})]}),p==="select"&&e.jsxs(e.Fragment,{children:[K&&e.jsx("p",{className:"getcredits__note muted",role:"status",children:s("getCredits.canceledNote")}),e.jsx(ie,{packs:F,loading:T,onSelect:t=>void O(t)})]}),p==="redirecting"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(te,{size:32}),e.jsx("p",{className:"muted",children:s("getCredits.redirecting")})]}),p==="processing"&&e.jsxs("div",{className:"gc-processing",role:"status","aria-live":"polite",children:[e.jsx("img",{className:"gc-processing__logo",src:J,alt:"",width:61,height:61}),e.jsxs("div",{className:"gc-processing__body",children:[e.jsxs("p",{className:"gc-processing__title",children:[e.jsx("strong",{children:s("getCredits.processing")}),"…"]}),e.jsxs("div",{className:"gc-progress","aria-hidden":!0,children:[e.jsx("span",{className:"gc-progress__track",children:e.jsx("span",{className:"gc-progress__fill"})}),e.jsx("span",{className:"gc-progress__count",children:"1/1"})]})]})]}),p==="success"&&e.jsxs("div",{className:"gc-success",role:"status","aria-live":"polite",children:[e.jsxs("div",{className:"gc-banner",children:[e.jsx("img",{className:"gc-banner__icon",src:ae,alt:"",width:60,height:60}),e.jsxs("p",{className:"gc-banner__text",children:[e.jsx("strong",{children:s("getCredits.successTitle")})," ",s("getCredits.successBody",{currency:d.name})]})]}),R!=null&&e.jsx("div",{className:"gc-credits",children:e.jsxs("div",{className:"gc-credits__row",children:[e.jsx("img",{className:"gc-credits__coin",src:re,alt:"",width:93,height:93}),e.jsxs("p",{className:"gc-credits__text",children:[e.jsx(W,{className:"gc-credits__diamond"}),e.jsxs("span",{children:[e.jsx("strong",{className:"gc-credits__amount",children:s("getCredits.creditsAmount",{credits:R,currency:d.name})})," ",e.jsx("span",{className:"gc-credits__added",children:s("getCredits.creditsAdded")})]})]})]})}),e.jsxs("div",{className:"gc-actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:S,children:s("getCredits.buyMore",{currency:d.name})}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/assets"),children:s("getCredits.startShopping")})]})]}),p==="pending"&&e.jsxs("div",{className:"gc-status",role:"status","aria-live":"polite",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.pendingTitle",{currency:d.name})}),e.jsx("p",{className:"muted",children:s("getCredits.pendingBody")}),e.jsxs("div",{className:"gc-status__actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/assets"),children:s("getCredits.startShopping")}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:S,children:s("getCredits.done")})]})]}),p==="error"&&e.jsxs("div",{className:"gc-status gc-status--err",role:"alert",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.errorTitle")}),e.jsx("p",{className:"error",children:U}),e.jsx("div",{className:"gc-status__actions",children:e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:S,children:s("getCredits.tryAgain")})})]})]})}function ie({packs:l,loading:r,onSelect:m}){return r?e.jsx("div",{className:"packs","aria-busy":"true","aria-label":s("getCredits.packsLoading",{currency:d.name}),children:[0,1,2,3].map(n=>e.jsx("div",{className:"pack pack--skeleton","aria-hidden":!0,children:e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"skeleton pack__label-sk"}),e.jsx("span",{className:"skeleton pack__art-sk"}),e.jsx("span",{className:"skeleton pack__cta-sk"})]})},n))}):e.jsx("div",{className:"packs",children:l.map(n=>e.jsxs("button",{type:"button",className:`pack${n.bestValue?" pack--best":""}`,"data-testid":"pack",onClick:()=>m(n),"aria-label":s("getCredits.packAria",{amount:z(n.credits),usd:n.usd}),children:[n.bestValue&&e.jsx("span",{className:"pack__badge",children:s("getCredits.packBadge")}),e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"pack__label",children:s("getCredits.creditsAmount",{credits:n.credits,currency:d.name})}),e.jsx("span",{className:"pack__art",children:e.jsx("img",{src:ce[n.id]??j,alt:"",loading:"lazy"})}),e.jsx("span",{className:"pack__cta-wrap",children:e.jsxs("span",{className:"pack__cta",children:["$",n.usd.toFixed(2)]})})]})]},n.id))})}export{je as GetCredits,je 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-DhMFUIC8.js";import{d as g,r as v}from"./index-nTALreMf.js";import{C as c}from"./ConstantsUtil-CJUlyS7R.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-CbjIJy-0.js";import{au as y}from"./NetworkUtil-Xp0fNa8X.js";const b=g`
|
|
2
2
|
:host {
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as R,r as h,j as e,L as B}from"./react-C51i12iP.js";import{v as $,t as s,e as S,B as k,C as L,j as P,E as Q,m as U,u as W,b as O,o as z,s as F,J}from"./index-
|
|
1
|
+
import{u as R,r as h,j as e,L as B}from"./react-C51i12iP.js";import{v as $,t as s,e as S,B as k,C as L,j as P,E as Q,m as U,u as W,b as O,o as z,s as F,J}from"./index-DJzwNEuW.js";import{i as Y,R as D,f as G}from"./import-CyTlWuc0.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./buy-8zXIWr42.js";import"./authorizations-Bgadyzys.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";import"./trade-encoding-DuF5Et_P.js";import"./mana-rate-D0Q2dITA.js";function H({queue:n,session:T,onClose:j,onDone:o}){const N=R(),d=$(T.providerType),[m,f]=h.useState(()=>n.map(()=>"pending")),[I,E]=h.useState("running"),w=h.useRef(!1);h.useEffect(()=>{if(w.current)return;w.current=!0;let t=!1;return(async()=>{for(let r=0;r<n.length;r++){if(t)return;f(u=>u.map((g,p)=>p===r?"active":g));try{await Y(n[r].item,n[r].priceCredits,T),P("Shop Migrated Listing",{item_id:n[r].item.itemId??n[r].item.oldTradeId??null,contract_address:n[r].item.contractAddress,new_price_credits:n[r].priceCredits,new_price_usd:n[r].priceCredits/10}),t||f(u=>u.map((g,p)=>p===r?"done":g))}catch(u){if(u instanceof D)Q(u,{flow:"import_listing",step:"relist",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(g=>g.map((p,b)=>b===r?"unlisted":p));else{const g=u,p=g.code===4001||/reject|denied|cancel/i.test(g.message??"");p||Q(u,{flow:"import_listing",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(b=>b.map((a,l)=>l===r?p?"skipped":"failed":a))}}}t||E("finished")})(),()=>{t=!0}},[]);const _=m.filter(t=>t==="done").length,v=m.findIndex(t=>t==="active"),x=Math.round(m.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function y(){o(),j()}if(I==="finished"){const t=m.filter(r=>r==="skipped"||r==="failed").length,c=m.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:_>0?s("migrate.successTitle"):s("migrate.nothingTitle")}),e.jsxs("p",{className:"muted",style:{margin:0},children:[_>0?s("migrate.listedSummary",{count:_,currency:S.name}):s("migrate.noneListed"),t>0?" "+s("migrate.skippedSummary",{count:t}):"",c>0?" "+s("migrate.unlistedSummary",{count:c}):""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(k,{variant:"ghost",onClick:y,children:s("getCredits.done")}),c>0?e.jsx(k,{variant:"purple",onClick:()=>{o(),j(),N("/my-assets")},children:s("migrate.goToMyAssets")}):_>0?e.jsx(k,{variant:"purple",onClick:()=>{o(),j(),N("/assets")},children:s("migrate.viewInShop")}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate","data-testid":"modal",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:s("migrate.listingTitle")}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[d?s("migrate.subConfirm"):s("migrate.subManaged")," ",v>=0?s("migrate.progressCount",{current:v+1,total:n.length}):""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${x}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,c)=>e.jsxs("li",{className:`migrate__row migrate__row--${m[c]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||s("migrate.itemFallback")}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(L,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:m[c]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",d?s("migrate.statusConfirm"):s("migrate.statusAdding")]}):m[c]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):m[c]==="skipped"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusSkipped")}):m[c]==="failed"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusFailed")}):m[c]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:s("migrate.unlistedTooltip"),children:s("migrate.statusUnlisted")}):e.jsx("span",{className:"migrate__wait",children:s("migrate.statusWaiting")})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:d?s("migrate.hintConfirm"):s("migrate.hintManaged")})]})})}const A=F(k)`
|
|
2
2
|
margin-top: 10px;
|
|
3
3
|
`,V=F(k)`
|
|
4
4
|
padding: 13px 24px;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{u as le,r as d,j as e,d as Ca,a as Aa,L as Sa}from"./react-C51i12iP.js";import{u as ae,a as Ma,b as pe,t,am as Pa,i as Fa,r as Ea,h as La,c as he,j as V,k as Ae,l as ke,an as Ta,E as ne,C as D,x as re,B as H,e as Ie,q as qa,J as ia,_ as Ce,ar as ra,aQ as Ra,aR as Da,aS as $a,aT as Ba,p as Me,aU as Oa,ad as ye,o as $,G as na,I as O,aV as Ka,aW as Wa,aX as Qa,M as la,aY as za,F as J,s as X,aZ as Va,a_ as Ua,a$ as Ga,n as He,b0 as Ya,b1 as Ha,b2 as Ja,b3 as Xa,b4 as Za,ae as es,m as as,b5 as ss,b6 as ts,b7 as is,w as rs,b8 as Je,b9 as ns,g as ls,as as ds,ba as os,bb as cs,at as ms,bc as us,bd as hs,be as _s}from"./index-k1Bog_tr.js";import{d as K}from"./dcl-schemas-BICTSpB5.js";import{W as ys,C as ps,t as fs,a as bs,s as xs}from"./CollectionCarousel-BC4r8J9j.js";import{b as Xe,c as gs}from"./buy-B_TXfJF4.js";import{P as vs,f as js}from"./PrimaryListModal-vBauRE_Q.js";import{b as Ns,w as ws,S as ks,G as Is}from"./buy-gasless-C7VsNrLp.js";import{g as Cs}from"./authorizations-BdVBiEr7.js";import{u as As,M as Ss,c as Ms}from"./useCreditPacks-CG7L_UQ4.js";import{R as Ze}from"./resume-buy-Bf0zIH7y.js";import{a as Ps,f as Se,i as Fs}from"./errors-D2EYBG38.js";import{E as fe}from"./ErrorNotice-C7soUjRV.js";import{l as Es}from"./loader-logo-BzY9EKdC.js";import{C as Ls}from"./CircularProgress-CeVjKviE.js";import{a as Ts,b as qs}from"./trade-encoding-Bq9nPTSy.js";import{M as da}from"./MarketCheckout-dyTQT0v3.js";import{u as oa}from"./useManaRate-BO1b19Qr.js";import{s as Rs}from"./address-DrURAr9O.js";import{T as ca}from"./Tooltip-BjVKL7Fw.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-CiO3jI6F.js";import"./index-HN6Rk25C.js";import"./mana-rate-Ez6IlT0x.js";import"./emotion-CSxEP8yM.js";function ma({item:s,onClose:r,resume:c=!1}){var h,ee;const{session:i}=ae(),{data:y}=Ma(i),l=pe(),f=le(),v=As().packs.slice(0,Ss),[o,b]=d.useState("loading"),[m,N]=d.useState(null),[a,k]=d.useState(""),[E,u]=d.useState(s.priceCredits),[w,x]=d.useState(null),j=d.useRef(null),q=(w==null?void 0:w.credits)??E,M=(y==null?void 0:y.credits)??0;d.useEffect(()=>{let _=!1;if(!i){b("error"),N(t("buyModal.signInToCheckout"));return}const C=I=>{const A=I-((y==null?void 0:y.credits)??0),g=v.find(T=>T.credits>=A)??v[v.length-1];k(g.id),V("Shop Buy Credits Prompted",{from:"item_checkout",credits_needed:I,credits_balance:(y==null?void 0:y.credits)??0,shortfall:Math.max(0,A)}),b("nofunds")};return(async()=>{var I,A;try{const g=await Pa(s);if(!g)throw new Error("not for sale");if(Fa(g,i.address))throw new Error("You can't buy your own listing.");const T=Ea((A=(I=g.received)==null?void 0:I[0])==null?void 0:A.amount);if(!Number.isFinite(T)||T<=0)throw new Error("price unavailable");const S=Math.ceil(T/10);if(_)return;if(u(S),y!=null&&y.credits<S){C(S);return}try{const{credit:B,maxCreditedValue:se,usdCents:de}=await La(i.identity,T,g.id);if(_){he(i.identity,[B.id]).catch(()=>{});return}j.current=B.id;const oe=Math.ceil(de/10);u(oe);const U={trade:g,credit:B,maxCreditedValue:se,usdCents:de,credits:oe};x(U),c?W(U):b("ready")}catch(B){if(_)return;if(Ps(B)){C(S);return}throw B}}catch(g){if(_)return;V(ke(g)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:Ae(g)}),b("error"),N(Se(g,t("buyModal.error.generic"),{sale:!0}))}})(),()=>{_=!0,j.current&&i&&(he(i.identity,[j.current]).catch(()=>{}),j.current=null)}},[]);async function W(_=w){if(!i||!_)return;b("processing"),N(null);let C=!1;try{const I={trade:_.trade,buyer:i.address,signer:i.signer,credits:[_.credit],maxCreditedValue:_.maxCreditedValue};let A;if(Cs())try{A=await Ns(I),await ws(A),C=!0}catch(g){if(g instanceof ks)C=!0;else if(g instanceof Is)A=await Xe(I);else throw g}else A=await Xe(I);j.current=null,V("Shop Completed Purchase",{...Ta([s]),payment_type:"credits",no_crypto_step:C,transaction_hash:A??null}),l.invalidateQueries({queryKey:["usd-balance"]}),l.invalidateQueries({queryKey:["detail-trade"]}),l.invalidateQueries({queryKey:["shop-item"]}),l.invalidateQueries({queryKey:["owned-token",s.contractAddress,s.tokenId]}),l.invalidateQueries({queryKey:["public-token",s.contractAddress,s.tokenId]}),l.invalidateQueries({queryKey:["item-resales",s.contractAddress,s.itemId]}),l.invalidateQueries({queryKey:["shop-items"]}),l.invalidateQueries({queryKey:["catalog-items"]}),l.invalidateQueries({queryKey:["my-assets"]}),l.invalidateQueries({queryKey:["purchases"]}),b("complete")}catch(I){ke(I)||ne(I,{flow:"buy",step:"submit",gasless:C}),he(i.identity,[_.credit.id]).catch(()=>{}),j.current=null,V(ke(I)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:Ae(I)}),l.invalidateQueries({queryKey:["usd-balance"]}),N(Se(I,t("buyModal.error.generic"),{sale:!0})),b("error")}}async function Q(){if(!(!a||!i)){try{sessionStorage.setItem(Ze,JSON.stringify(s))}catch{}w&&he(i.identity,[w.credit.id]).catch(()=>{}),j.current=null,b("loading");try{const _=await Ms(a,{address:i.address,identity:i.identity});if(_.url){window.location.href=_.url;return}f("/credits")}catch(_){ne(_,{flow:"buy_credits_and_item"});try{sessionStorage.removeItem(Ze)}catch{}N(t("buyModal.error.creditsCheckout")),b("error")}}}const L=o==="processing",Z=o==="complete"?t("buyModal.titleComplete"):o==="nofunds"?t("buyModal.titleNoFunds"):t("buyModal.titleBuy");return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":t("buyModal.dialogAria",{name:s.name}),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:L?void 0:r,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${o==="processing"||o==="loading"?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:Z}),!L&&e.jsx("button",{className:"buy-modal__x",onClick:r,"aria-label":t("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:o==="nofunds"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(D,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:re(M)})]})]}),o==="loading"&&e.jsx("div",{className:"buy-modal__body buy-modal__processing",children:e.jsx(Ls,{size:44})}),o==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(fe,{message:m}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:r,children:t("buyModal.close")})})]}),o==="nofunds"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(ys,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:t("buyModal.insufficientFunds")})," ",t("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:t("buyModal.warningCreditsAmount",{count:Math.max(0,q-M)})})," ",t("buyModal.warningToPurchase",{count:1})]})]}),e.jsx(ea,{item:s,priceCredits:q}),e.jsx("div",{className:"buy-modal__packs",children:v.map(_=>{const C=_.credits,I=_.id===a;return e.jsxs("button",{className:`buy-modal__pack${I?" buy-modal__pack--on":""}`,onClick:()=>k(_.id),children:[e.jsx(D,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:re(C)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",_.usd.toFixed(2),")"]})]},_.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(D,{className:"buy-modal__total-ico"}),e.jsx("span",{children:re(((h=v.find(_=>_.id===a))==null?void 0:h.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",(((ee=v.find(_=>_.id===a))==null?void 0:ee.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:r,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:()=>void Q(),children:t("buyModal.buy")})]})]}),o==="ready"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(ea,{item:s,priceCredits:q}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient buy-modal__btn--full",onClick:()=>void W(),children:t("buyModal.buy")})})]}),o==="processing"&&e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:Es,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:c?t("buyModal.completingPurchase"):t("buyModal.completingTransaction")}),e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]}),o==="complete"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__success",children:[e.jsxs("svg",{viewBox:"0 0 64 64",width:"64",height:"64","aria-hidden":!0,children:[e.jsx("circle",{cx:"32",cy:"32",r:"32",fill:"#34ce74"}),e.jsx("path",{d:"M20 33l8 8 16-18",fill:"none",stroke:"#fff",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsxs("p",{className:"buy-modal__success-text",children:[e.jsx("b",{children:t("getCredits.successTitle")})," ",t("buyModal.successBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:()=>f("/assets?tab=mine"),children:t("buyModal.myAssets")}),e.jsxs("button",{className:"buy-modal__btn buy-modal__btn--ruby",onClick:r,children:[t("buyModal.tryInWorld"),e.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20","aria-hidden":!0,children:e.jsx("path",{d:"M5 12h12M13 7l5 5-5 5",fill:"none",stroke:"#fcfcfc",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})]})]})]})}function ea({item:s,priceCredits:r}){return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsx("div",{className:"buy-modal__asset-name",title:s.name,children:s.name||t("buyModal.itemFallback")}),s.creator?e.jsx(ps,{address:s.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(D,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:re(r)})]})]})]})}const Ds=1e3*60*60*24*182;function $s({asset:s,session:r,onClose:c}){const i=pe(),y=le(),[l,f]=d.useState("10"),[v,o]=d.useState(null),[b,m]=d.useState(null),[N,a]=d.useState(!1),[k,E]=d.useState(null);async function u(){m(null);const x=Number(l);if(!Number.isInteger(x)||x<=0){m(t("sellModal.errorWholeNumber"));return}a(!0);try{o(t("sellModal.statusPreparing")),await Ts({signer:r.signer,contractAddress:s.contractAddress,chainId:s.chainId}),o(t("sellModal.statusListing"));const j=await qs({signer:r.signer,nft:{contractAddress:s.contractAddress,tokenId:s.tokenId,network:s.network,chainId:s.chainId},usdPrice:x/10,expiresAtMs:Date.now()+Ds});o(t("sellModal.statusPublishing")),await qa(j,r.identity),o(null),E(x),V("Shop Listed Item",{item_id:s.itemId??s.tokenId??null,contract_address:s.contractAddress,price_credits:x,price_usd:x/10,listing_type:"secondary",is_primary:!1}),ia.success(t("sellModal.toastOnSale",{name:s.name})),i.invalidateQueries({queryKey:["my-assets",r.address]})}catch(j){ne(j,{flow:"list_secondary"}),V("Shop Listing Failed",{listing_type:"secondary",error_code:Ae(j)}),m(Se(j,t("sellModal.errorGeneric"))),o(null)}finally{a(!1)}}function w(){c(),y(`/item/${s.contractAddress}/${s.tokenId}`)}return k!==null?e.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:e.jsxs("div",{className:"modal modal--success",onClick:x=>x.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:t("sellModal.successTitle")}),s.image?e.jsx("img",{className:"modal__img",src:s.image,alt:s.name}):null,e.jsx("p",{className:"modal-success__name",children:s.name}),e.jsxs("p",{className:"muted small",children:[t("sellModal.listedFor")," ",e.jsxs("strong",{children:[e.jsx(D,{className:"ccy-mark"})," ",k]})]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(H,{variant:"ghost",onClick:c,children:t("getCredits.done")}),e.jsx(H,{variant:"purple",onClick:w,children:t("sellModal.viewInShop")})]})]})}):e.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:e.jsxs("div",{className:"modal","data-testid":"modal",onClick:x=>x.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("h2",{className:"modal__title",children:t("sellModal.listTitle",{name:s.name})}),s.image?e.jsx("img",{className:"modal__img",src:s.image,alt:s.name}):null,e.jsxs("label",{className:"field",children:[e.jsx("span",{children:t("sellModal.priceLabel",{currency:Ie.name})}),e.jsx("input",{type:"number",min:"1",step:"1",value:l,onChange:x=>f(x.target.value),disabled:N})]}),e.jsx("p",{className:"muted small",children:t("sellModal.pricedInWhole",{currency:Ie.name,currencySingular:Ie.nameSingular})}),v?e.jsx("p",{className:"muted",children:v}):null,e.jsx(fe,{message:b}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(H,{variant:"ghost",onClick:c,disabled:N,children:t("sellModal.cancel")}),e.jsx(H,{onClick:()=>void u(),disabled:N,children:N?t("sellModal.listing"):t("sellModal.putOnSale")})]})]})})}const Bs=d.lazy(async()=>{const[{EmoteControls:s},{Experimental_CssVarsProvider:r},{light:c}]=await Promise.all([Ce(()=>import("./index-D4SQVwZS.js").then(i=>i.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),Ce(()=>import("./index-DTEyrFW2.js"),__vite__mapDeps([11,3,1,2,4,5,6,7,12,9,13,14])),Ce(()=>import("./index-UvWrbkyR.js"),__vite__mapDeps([15,3,1,2,4,5,6,7,16,14,13,9]))]);return{default:i=>e.jsx(r,{theme:c,children:e.jsx(s,{...i})})}});function Os(s){return e.jsx(d.Suspense,{fallback:null,children:e.jsx(Bs,{...s})})}function Ks({item:s}){const r=ae(q=>{var M;return(M=q.session)==null?void 0:M.address}),{data:c,isLoading:i}=ra(r),y=r&&c?r:"default",l=s.category==="emote",[f,v]=d.useState("item"),o=!l&&f==="item",b=o||!i,[m,N]=d.useState(!0);d.useEffect(()=>{N(!0)},[s.id,o]);const[a,k]=d.useState(K.PreviewRenderer.UNITY),E=a===K.PreviewRenderer.BABYLON,u=!!r&&!!c,w=u&&Ra(s,Da(c)),x=$a(s)[0],j=u&&!w&&!l;return e.jsxs(e.Fragment,{children:[b?e.jsx(Ba,{id:"shop-item-preview",contractAddress:s.contractAddress,tokenId:s.tokenId??void 0,itemId:s.tokenId?void 0:s.itemId??void 0,profile:o?void 0:w?y:"default",bodyShape:o||w?void 0:x,type:l?void 0:o?K.PreviewType.WEARABLE:K.PreviewType.AVATAR,emote:l||o?void 0:K.PreviewEmote.FASHION,disableBackground:!0,wheelZoom:l?1.5:void 0,wheelStart:l?100:void 0,dev:Me.chainId===80002,unity:!0,onRenderer:k,onLoad:()=>N(!1)}):null,!b||m?e.jsx("div",{className:"item-preview__loading","aria-busy":"true","aria-label":t("itemPreview.loading"),children:e.jsx("span",{className:"item-preview__spinner","aria-hidden":!0})}):null,j&&!o?e.jsx("p",{className:"item-preview__note",children:t("itemPreview.shownOnBody",{shape:Oa(x)})}):null,E?l?e.jsx("div",{className:"item-preview__emote-controls","data-testid":"emote-controls",children:e.jsx(Os,{wearablePreviewId:"shop-item-preview",hideFrameInput:!0})}):e.jsxs("div",{className:"item-preview__toggle",role:"group","aria-label":t("itemPreview.previewMode"),children:[e.jsxs("button",{type:"button",className:f==="avatar"?"is-active":"","aria-pressed":f==="avatar","aria-label":t("itemPreview.onAvatar"),onClick:()=>v("avatar"),children:[e.jsxs("svg",{className:"item-preview__toggle-ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:[e.jsx("circle",{cx:"12",cy:"7.5",r:"4"}),e.jsx("path",{d:"M4 20c0-4.2 3.6-6.5 8-6.5s8 2.3 8 6.5v.5H4z"})]}),e.jsx("span",{className:"item-preview__toggle-label",children:t("itemPreview.onAvatar")})]}),e.jsxs("button",{type:"button",className:f==="item"?"is-active":"","aria-pressed":f==="item","aria-label":t("itemPreview.item"),onClick:()=>v("item"),children:[e.jsx("svg",{className:"item-preview__toggle-ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:e.jsx("path",{d:"M8.5 3 3 6l1.8 3.8 2.2-1V21h10V8.8l2.2 1L22 6l-5.5-3a2.6 2.6 0 0 1-4.5 1.4A2.6 2.6 0 0 1 8.5 3z"})}),e.jsx("span",{className:"item-preview__toggle-label",children:t("itemPreview.item")})]})]}):null]})}const aa=8,Ws=!1;function Qs(s){if(!s)return;const r=s.toLowerCase();return Object.values(K.Rarity).includes(r)?K.Rarity.getMaxSupply(r):void 0}function zs(s){return/^0x[a-fA-F0-9]{40}$/.test(s)?`${s.slice(0,6)}…${s.slice(-4)}`:s}function Vs(s){let r=0;for(let c=0;c<s.length;c++)r=r*31+s.charCodeAt(c)>>>0;return`hsl(${r%360}, 52%, 45%)`}function Us(s,r){var c;return(((c=s==null?void 0:s.trim())==null?void 0:c[0])||r.replace(/^0x/i,"")[0]||"?").toUpperCase()}function Gs(s){return{tradeId:s.tradeId??s.id,listingType:"primary",contractAddress:s.contractAddress,itemId:s.itemId??"",name:s.name,thumbnail:s.thumbnail,rarity:s.rarity,category:s.category,wearableCategory:s.wearableCategory??null,creator:s.creator,manaWei:s.manaWei??"0",available:1,network:s.network,chainId:s.chainId,createdAt:0}}function Ys({r:s,seller:r,issuedId:c,total:i,isOwn:y,isLegacy:l,inCart:f,fallbackImage:v,onAdd:o,onBuyNative:b,onBuyLegacy:m}){var W,Q;const N=le(),{data:a}=ra(r),k=(Q=(W=a==null?void 0:a.avatar)==null?void 0:W.snapshots)==null?void 0:Q.face256,[E,u]=d.useState(!1);d.useEffect(()=>u(!1),[k]);const w=!!k&&!E,x=r?a!=null&&a.name?na(a.name):zs(r):void 0,j=w?e.jsx("img",{className:"resales__ava",src:k,alt:"",loading:"lazy",onError:()=>u(!0)}):r?e.jsx("span",{className:"resales__ava resales__ava--letter",style:{backgroundColor:Vs(r)},"aria-hidden":!0,children:Us(a==null?void 0:a.name,r)}):v?e.jsx("img",{className:"resales__ava",src:v,alt:"","aria-hidden":!0}):e.jsx("span",{className:"resales__ava resales__ava--empty","aria-hidden":!0}),q=e.jsxs("span",{className:"resales__ident",children:[x?e.jsx("span",{className:"resales__name","data-testid":"resale-seller",children:x}):null,c?e.jsxs("span",{className:"resales__serial",children:[t("resales.serialLabel")," ",e.jsxs("span",{className:"resales__issued","data-testid":"resale-issued",children:["#",c]}),i?` ${t("resales.serialOf")} ${i.toLocaleString("en-US")}`:""]}):e.jsx("span",{className:"resales__serial resales__serial--muted",children:t("resales.copy")})]}),M=r?e.jsxs("button",{type:"button",className:"resales__who resales__who--link",onClick:()=>N(`/assets/creator/${r}`),children:[j,q]}):e.jsxs("div",{className:"resales__who",children:[j,q]});return e.jsxs("li",{className:`resales__row${l?" resales__row--legacy":""}`,"data-testid":"resale-row","data-source":s.source,"data-own":y?"true":void 0,children:[M,e.jsxs("div",{className:`resales__price${l?" resales__price--approx":""}`,children:[l?e.jsx("span",{className:"resales__approx","aria-hidden":!0,children:"≈"}):null,e.jsx(D,{className:"resales__diamond"}),e.jsx("span",{className:"resales__price-value",children:re(s.priceCredits)})]}),e.jsx("div",{className:"resales__actions",children:y?e.jsx("span",{className:"chip resales__own-chip","data-testid":"resale-own",children:t("resales.yourListing")}):l?e.jsx("button",{className:"resales__buy",onClick:m,"aria-label":t("assetCard.buyNow"),"data-testid":"resale-buy",children:t("assetCard.buyNow")}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"resales__add",onClick:o,disabled:f,"aria-label":f?t("assetCard.inCart"):t("assetCard.addToCart"),"data-testid":"resale-add",children:[e.jsx(O,{name:"cart-solid",size:16}),e.jsx("span",{children:f?t("assetCard.inCart"):t("assetCard.addToCart")})]}),e.jsx("button",{className:"resales__buy",onClick:b,"aria-label":t("assetCard.buyNow"),"data-testid":"resale-buy",children:t("assetCard.buyNow")})]})})]})}function Hs({item:s}){var Z;const r=s.contractAddress,c=s.itemId,i=pe(),y=ye(h=>h.add),l=ye(h=>h.items),{session:f}=ae(),v=(Z=f==null?void 0:f.address)==null?void 0:Z.toLowerCase(),[o,b]=d.useState(null),[m,N]=d.useState(null),[a,k]=d.useState(aa),E=Qs(s.rarity),{data:u=[],isLoading:w}=$({queryKey:["item-resales",r,c],enabled:!!r&&!!c,staleTime:0,refetchOnMount:"always",refetchOnWindowFocus:!0,queryFn:()=>Ka(r,c)}),x=u.slice(0,a),j=x.filter(h=>!h.seller||!h.issuedId).map(h=>h.tokenId).filter(h=>!!h),{data:q={}}=$({queryKey:["resale-token-info",r,j.join(",")],enabled:!!r&&j.length>0,staleTime:6e4,queryFn:()=>Wa(r,j)}),{data:M=[]}=$({queryKey:["item-classic-orders",r,c],enabled:Ws,queryFn:()=>Qa(r,c)}),W=u.some(h=>h.source==="legacy"),{data:Q}=oa(W);function L(){i.invalidateQueries({queryKey:["item-resales",r,c]})}return w||u.length===0?null:e.jsxs("section",{className:"resales","data-testid":"resales-section",children:[e.jsxs("div",{className:"resales__head",children:[e.jsx("h2",{className:"resales__title",children:t("resales.title")}),e.jsx("p",{className:"resales__subtitle",children:t("resales.subtitle")})]}),u.length>0?e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"resales__list",children:x.map(h=>{const ee=h.source==="legacy",_=l.some(S=>S.id===h.id),C=h.tokenId&&q[h.tokenId]||{},I=h.issuedId??C.issuedId,A=h.seller??C.seller,g={...h,name:h.name||s.name,thumbnail:h.thumbnail||s.thumbnail,rarity:h.rarity||s.rarity,category:h.category||s.category,wearableCategory:h.wearableCategory??s.wearableCategory,gender:h.gender??s.gender},T=!!A&&!!v&&A.toLowerCase()===v;return e.jsx(Ys,{r:g,seller:A,issuedId:I,total:E,isOwn:T,isLegacy:ee,inCart:_,fallbackImage:g.thumbnail,onAdd:()=>y(g,"item_detail"),onBuyNative:()=>b(g),onBuyLegacy:()=>N(Gs(g))},h.tradeId??h.id)})}),u.length>a?e.jsx("button",{className:"resales__more",onClick:()=>k(h=>h+aa),"data-testid":"resale-show-more",children:t("resales.showMore")}):null]}):null,null,o?e.jsx(ma,{item:o,onClose:()=>{b(null),L()}}):null,m&&Q?e.jsx(da,{listing:m,rate:Q,onClose:()=>N(null),onSold:()=>{N(null),L()}}):null]})}function ua(){return Me.shopServerUrl||(typeof window<"u"?window.location.origin:"")}async function Js(s,r,c){const i=new URLSearchParams({contractAddress:s,itemId:r}),y=`${ua()}/notify-requests?${i.toString()}`,l=await la(y,{method:"GET",identity:c,metadata:{}});if(!l.ok)throw new Error(`getNotifyRequest ${l.status}`);return l.json()}async function Xs(s,r){const c=`${ua()}/notify-requests`,i=await la(c,{method:"POST",identity:r,metadata:{},headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!i.ok)throw new Error(`createNotifyRequest ${i.status}: ${await i.text()}`);await i.json().catch(()=>{})}function sa(s){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s.trim())}function Zs({item:s}){const r=ae(u=>u.session),c=ae(u=>u.signIn),[i,y]=d.useState(""),[l,f]=d.useState(!1),[v,o]=d.useState(!1),[b,m]=d.useState(null),N=!!r&&!!s.contractAddress&&!!s.itemId,{data:a}=$({queryKey:["notify-request",s.contractAddress,s.itemId,r==null?void 0:r.address],enabled:N,queryFn:()=>Js(s.contractAddress,s.itemId,r.identity)});d.useEffect(()=>{a!=null&&a.email&&y(u=>u||a.email)},[a==null?void 0:a.email]),d.useEffect(()=>{if(!r)return;let u=!1;return za().then(w=>{!u&&w&&y(x=>x||w)}),()=>{u=!0}},[r]);const k=v||!!(a!=null&&a.subscribed);async function E(u){if(u.preventDefault(),!(!r||!s.itemId||!sa(i)||l)){f(!0),m(null);try{await Xs({contractAddress:s.contractAddress,itemId:s.itemId,chainId:s.chainId,email:i.trim()},r.identity),o(!0)}catch(w){ne(w,{flow:"notify-me",contractAddress:s.contractAddress,itemId:s.itemId}),m(t("notifyMe.error"))}finally{f(!1)}}}return r?k?e.jsxs("div",{className:"notify notify__done","data-testid":"notify-subscribed",children:[e.jsx("span",{className:"notify__done-check","aria-hidden":!0,children:e.jsx(O,{name:"check",size:12})}),e.jsx("span",{className:"notify__done-text",children:t("notifyMe.subscribedBody")})]}):e.jsxs("form",{className:"notify",onSubmit:E,"data-testid":"notify",children:[e.jsx("label",{className:"notify__label",htmlFor:"notify-email",children:t("notifyMe.label")}),e.jsxs("div",{className:"notify__row",children:[e.jsx("input",{id:"notify-email",className:"notify__input",type:"email",inputMode:"email",autoComplete:"email",placeholder:t("notifyMe.placeholder"),value:i,onChange:u=>y(u.target.value),"data-testid":"notify-email"}),e.jsx("button",{type:"submit",className:"notify__btn",disabled:!sa(i)||l,"data-testid":"notify-submit",children:l?t("notifyMe.working"):t("notifyMe.cta")})]}),e.jsx(fe,{message:b})]}):e.jsx("div",{className:"notify","data-testid":"notify",children:e.jsx("button",{type:"button",className:"notify__signin",onClick:c,"data-testid":"notify-signin",children:t("notifyMe.signInCta")})})}const et=X.button`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BBGfTC_W.js","assets/react-C51i12iP.js","assets/dcl-schemas-BICTSpB5.js","assets/index-DJzwNEuW.js","assets/sentry-DKBoGDXH.js","assets/ethers-w5dOkonM.js","assets/intl-CBcMB1D2.js","assets/index-CkvNUeW9.css","assets/emotion-styled.browser.esm-DMJh0f0o.js","assets/useTheme-niAOV5zA.js","assets/CircularProgress-CQ5EJ-uq.js","assets/index-DRm2Jw63.js","assets/useTheme-CK32hdxC.js","assets/CssVarsProvider-BzgltKCN.js","assets/getOverlayAlpha-DPVIWFtM.js","assets/index-B176-toy.js","assets/colors-LINLm1ux.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as le,r as d,j as e,d as Ca,a as Aa,L as Sa}from"./react-C51i12iP.js";import{u as ae,a as Ma,b as pe,t,am as Pa,i as Fa,r as Ea,h as La,c as he,j as V,k as Ae,l as ke,an as Ta,E as ne,C as D,x as re,B as H,e as Ie,q as qa,J as ia,_ as Ce,ar as ra,aQ as Ra,aR as Da,aS as $a,aT as Ba,p as Me,aU as Oa,ad as ye,o as $,G as na,I as O,aV as Ka,aW as Wa,aX as Qa,M as la,aY as za,F as J,s as X,aZ as Va,a_ as Ua,a$ as Ga,n as He,b0 as Ya,b1 as Ha,b2 as Ja,b3 as Xa,b4 as Za,ae as es,m as as,b5 as ss,b6 as ts,b7 as is,w as rs,b8 as Je,b9 as ns,g as ls,as as ds,ba as os,bb as cs,at as ms,bc as us,bd as hs,be as _s}from"./index-DJzwNEuW.js";import{d as K}from"./dcl-schemas-BICTSpB5.js";import{W as ys,C as ps,t as fs,a as bs,s as xs}from"./CollectionCarousel-BWYkR7q0.js";import{b as Xe,c as gs}from"./buy-8zXIWr42.js";import{P as vs,f as js}from"./PrimaryListModal-CjIspJsb.js";import{b as Ns,w as ws,S as ks,G as Is}from"./buy-gasless-CGYytySC.js";import{g as Cs}from"./authorizations-Bgadyzys.js";import{u as As,M as Ss,c as Ms}from"./useCreditPacks-Cnffyb1f.js";import{R as Ze}from"./resume-buy-Bf0zIH7y.js";import{a as Ps,f as Se,i as Fs}from"./errors-BPMx500B.js";import{E as fe}from"./ErrorNotice-C7soUjRV.js";import{l as Es}from"./loader-logo-BzY9EKdC.js";import{C as Ls}from"./CircularProgress-CQ5EJ-uq.js";import{a as Ts,b as qs}from"./trade-encoding-DuF5Et_P.js";import{M as da}from"./MarketCheckout-rU7x7bhY.js";import{u as oa}from"./useManaRate-DBsG9LRw.js";import{s as Rs}from"./address-DrURAr9O.js";import{T as ca}from"./Tooltip-BTVaKPyS.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-CiO3jI6F.js";import"./index-HN6Rk25C.js";import"./mana-rate-D0Q2dITA.js";import"./emotion-CSxEP8yM.js";function ma({item:s,onClose:r,resume:c=!1}){var h,ee;const{session:i}=ae(),{data:y}=Ma(i),l=pe(),f=le(),v=As().packs.slice(0,Ss),[o,b]=d.useState("loading"),[m,N]=d.useState(null),[a,k]=d.useState(""),[E,u]=d.useState(s.priceCredits),[w,x]=d.useState(null),j=d.useRef(null),q=(w==null?void 0:w.credits)??E,M=(y==null?void 0:y.credits)??0;d.useEffect(()=>{let _=!1;if(!i){b("error"),N(t("buyModal.signInToCheckout"));return}const C=I=>{const A=I-((y==null?void 0:y.credits)??0),g=v.find(T=>T.credits>=A)??v[v.length-1];k(g.id),V("Shop Buy Credits Prompted",{from:"item_checkout",credits_needed:I,credits_balance:(y==null?void 0:y.credits)??0,shortfall:Math.max(0,A)}),b("nofunds")};return(async()=>{var I,A;try{const g=await Pa(s);if(!g)throw new Error("not for sale");if(Fa(g,i.address))throw new Error("You can't buy your own listing.");const T=Ea((A=(I=g.received)==null?void 0:I[0])==null?void 0:A.amount);if(!Number.isFinite(T)||T<=0)throw new Error("price unavailable");const S=Math.ceil(T/10);if(_)return;if(u(S),y!=null&&y.credits<S){C(S);return}try{const{credit:B,maxCreditedValue:se,usdCents:de}=await La(i.identity,T,g.id);if(_){he(i.identity,[B.id]).catch(()=>{});return}j.current=B.id;const oe=Math.ceil(de/10);u(oe);const U={trade:g,credit:B,maxCreditedValue:se,usdCents:de,credits:oe};x(U),c?W(U):b("ready")}catch(B){if(_)return;if(Ps(B)){C(S);return}throw B}}catch(g){if(_)return;V(ke(g)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:Ae(g)}),b("error"),N(Se(g,t("buyModal.error.generic"),{sale:!0}))}})(),()=>{_=!0,j.current&&i&&(he(i.identity,[j.current]).catch(()=>{}),j.current=null)}},[]);async function W(_=w){if(!i||!_)return;b("processing"),N(null);let C=!1;try{const I={trade:_.trade,buyer:i.address,signer:i.signer,credits:[_.credit],maxCreditedValue:_.maxCreditedValue};let A;if(Cs())try{A=await Ns(I),await ws(A),C=!0}catch(g){if(g instanceof ks)C=!0;else if(g instanceof Is)A=await Xe(I);else throw g}else A=await Xe(I);j.current=null,V("Shop Completed Purchase",{...Ta([s]),payment_type:"credits",no_crypto_step:C,transaction_hash:A??null}),l.invalidateQueries({queryKey:["usd-balance"]}),l.invalidateQueries({queryKey:["detail-trade"]}),l.invalidateQueries({queryKey:["shop-item"]}),l.invalidateQueries({queryKey:["owned-token",s.contractAddress,s.tokenId]}),l.invalidateQueries({queryKey:["public-token",s.contractAddress,s.tokenId]}),l.invalidateQueries({queryKey:["item-resales",s.contractAddress,s.itemId]}),l.invalidateQueries({queryKey:["shop-items"]}),l.invalidateQueries({queryKey:["catalog-items"]}),l.invalidateQueries({queryKey:["my-assets"]}),l.invalidateQueries({queryKey:["purchases"]}),b("complete")}catch(I){ke(I)||ne(I,{flow:"buy",step:"submit",gasless:C}),he(i.identity,[_.credit.id]).catch(()=>{}),j.current=null,V(ke(I)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:Ae(I)}),l.invalidateQueries({queryKey:["usd-balance"]}),N(Se(I,t("buyModal.error.generic"),{sale:!0})),b("error")}}async function Q(){if(!(!a||!i)){try{sessionStorage.setItem(Ze,JSON.stringify(s))}catch{}w&&he(i.identity,[w.credit.id]).catch(()=>{}),j.current=null,b("loading");try{const _=await Ms(a,{address:i.address,identity:i.identity});if(_.url){window.location.href=_.url;return}f("/credits")}catch(_){ne(_,{flow:"buy_credits_and_item"});try{sessionStorage.removeItem(Ze)}catch{}N(t("buyModal.error.creditsCheckout")),b("error")}}}const L=o==="processing",Z=o==="complete"?t("buyModal.titleComplete"):o==="nofunds"?t("buyModal.titleNoFunds"):t("buyModal.titleBuy");return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":t("buyModal.dialogAria",{name:s.name}),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:L?void 0:r,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${o==="processing"||o==="loading"?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:Z}),!L&&e.jsx("button",{className:"buy-modal__x",onClick:r,"aria-label":t("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:o==="nofunds"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(D,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:re(M)})]})]}),o==="loading"&&e.jsx("div",{className:"buy-modal__body buy-modal__processing",children:e.jsx(Ls,{size:44})}),o==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(fe,{message:m}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:r,children:t("buyModal.close")})})]}),o==="nofunds"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(ys,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:t("buyModal.insufficientFunds")})," ",t("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:t("buyModal.warningCreditsAmount",{count:Math.max(0,q-M)})})," ",t("buyModal.warningToPurchase",{count:1})]})]}),e.jsx(ea,{item:s,priceCredits:q}),e.jsx("div",{className:"buy-modal__packs",children:v.map(_=>{const C=_.credits,I=_.id===a;return e.jsxs("button",{className:`buy-modal__pack${I?" buy-modal__pack--on":""}`,onClick:()=>k(_.id),children:[e.jsx(D,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:re(C)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",_.usd.toFixed(2),")"]})]},_.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(D,{className:"buy-modal__total-ico"}),e.jsx("span",{children:re(((h=v.find(_=>_.id===a))==null?void 0:h.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",(((ee=v.find(_=>_.id===a))==null?void 0:ee.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:r,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:()=>void Q(),children:t("buyModal.buy")})]})]}),o==="ready"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(ea,{item:s,priceCredits:q}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient buy-modal__btn--full",onClick:()=>void W(),children:t("buyModal.buy")})})]}),o==="processing"&&e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:Es,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:c?t("buyModal.completingPurchase"):t("buyModal.completingTransaction")}),e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]}),o==="complete"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__success",children:[e.jsxs("svg",{viewBox:"0 0 64 64",width:"64",height:"64","aria-hidden":!0,children:[e.jsx("circle",{cx:"32",cy:"32",r:"32",fill:"#34ce74"}),e.jsx("path",{d:"M20 33l8 8 16-18",fill:"none",stroke:"#fff",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsxs("p",{className:"buy-modal__success-text",children:[e.jsx("b",{children:t("getCredits.successTitle")})," ",t("buyModal.successBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:()=>f("/assets?tab=mine"),children:t("buyModal.myAssets")}),e.jsxs("button",{className:"buy-modal__btn buy-modal__btn--ruby",onClick:r,children:[t("buyModal.tryInWorld"),e.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20","aria-hidden":!0,children:e.jsx("path",{d:"M5 12h12M13 7l5 5-5 5",fill:"none",stroke:"#fcfcfc",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})]})]})]})}function ea({item:s,priceCredits:r}){return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsx("div",{className:"buy-modal__asset-name",title:s.name,children:s.name||t("buyModal.itemFallback")}),s.creator?e.jsx(ps,{address:s.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(D,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:re(r)})]})]})]})}const Ds=1e3*60*60*24*182;function $s({asset:s,session:r,onClose:c}){const i=pe(),y=le(),[l,f]=d.useState("10"),[v,o]=d.useState(null),[b,m]=d.useState(null),[N,a]=d.useState(!1),[k,E]=d.useState(null);async function u(){m(null);const x=Number(l);if(!Number.isInteger(x)||x<=0){m(t("sellModal.errorWholeNumber"));return}a(!0);try{o(t("sellModal.statusPreparing")),await Ts({signer:r.signer,contractAddress:s.contractAddress,chainId:s.chainId}),o(t("sellModal.statusListing"));const j=await qs({signer:r.signer,nft:{contractAddress:s.contractAddress,tokenId:s.tokenId,network:s.network,chainId:s.chainId},usdPrice:x/10,expiresAtMs:Date.now()+Ds});o(t("sellModal.statusPublishing")),await qa(j,r.identity),o(null),E(x),V("Shop Listed Item",{item_id:s.itemId??s.tokenId??null,contract_address:s.contractAddress,price_credits:x,price_usd:x/10,listing_type:"secondary",is_primary:!1}),ia.success(t("sellModal.toastOnSale",{name:s.name})),i.invalidateQueries({queryKey:["my-assets",r.address]})}catch(j){ne(j,{flow:"list_secondary"}),V("Shop Listing Failed",{listing_type:"secondary",error_code:Ae(j)}),m(Se(j,t("sellModal.errorGeneric"))),o(null)}finally{a(!1)}}function w(){c(),y(`/item/${s.contractAddress}/${s.tokenId}`)}return k!==null?e.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:e.jsxs("div",{className:"modal modal--success",onClick:x=>x.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:t("sellModal.successTitle")}),s.image?e.jsx("img",{className:"modal__img",src:s.image,alt:s.name}):null,e.jsx("p",{className:"modal-success__name",children:s.name}),e.jsxs("p",{className:"muted small",children:[t("sellModal.listedFor")," ",e.jsxs("strong",{children:[e.jsx(D,{className:"ccy-mark"})," ",k]})]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(H,{variant:"ghost",onClick:c,children:t("getCredits.done")}),e.jsx(H,{variant:"purple",onClick:w,children:t("sellModal.viewInShop")})]})]})}):e.jsx("div",{className:"modal-backdrop",onClick:c,role:"presentation",children:e.jsxs("div",{className:"modal","data-testid":"modal",onClick:x=>x.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("h2",{className:"modal__title",children:t("sellModal.listTitle",{name:s.name})}),s.image?e.jsx("img",{className:"modal__img",src:s.image,alt:s.name}):null,e.jsxs("label",{className:"field",children:[e.jsx("span",{children:t("sellModal.priceLabel",{currency:Ie.name})}),e.jsx("input",{type:"number",min:"1",step:"1",value:l,onChange:x=>f(x.target.value),disabled:N})]}),e.jsx("p",{className:"muted small",children:t("sellModal.pricedInWhole",{currency:Ie.name,currencySingular:Ie.nameSingular})}),v?e.jsx("p",{className:"muted",children:v}):null,e.jsx(fe,{message:b}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(H,{variant:"ghost",onClick:c,disabled:N,children:t("sellModal.cancel")}),e.jsx(H,{onClick:()=>void u(),disabled:N,children:N?t("sellModal.listing"):t("sellModal.putOnSale")})]})]})})}const Bs=d.lazy(async()=>{const[{EmoteControls:s},{Experimental_CssVarsProvider:r},{light:c}]=await Promise.all([Ce(()=>import("./index-BBGfTC_W.js").then(i=>i.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),Ce(()=>import("./index-DRm2Jw63.js"),__vite__mapDeps([11,3,1,2,4,5,6,7,12,9,13,14])),Ce(()=>import("./index-B176-toy.js"),__vite__mapDeps([15,3,1,2,4,5,6,7,16,14,13,9]))]);return{default:i=>e.jsx(r,{theme:c,children:e.jsx(s,{...i})})}});function Os(s){return e.jsx(d.Suspense,{fallback:null,children:e.jsx(Bs,{...s})})}function Ks({item:s}){const r=ae(q=>{var M;return(M=q.session)==null?void 0:M.address}),{data:c,isLoading:i}=ra(r),y=r&&c?r:"default",l=s.category==="emote",[f,v]=d.useState("item"),o=!l&&f==="item",b=o||!i,[m,N]=d.useState(!0);d.useEffect(()=>{N(!0)},[s.id,o]);const[a,k]=d.useState(K.PreviewRenderer.UNITY),E=a===K.PreviewRenderer.BABYLON,u=!!r&&!!c,w=u&&Ra(s,Da(c)),x=$a(s)[0],j=u&&!w&&!l;return e.jsxs(e.Fragment,{children:[b?e.jsx(Ba,{id:"shop-item-preview",contractAddress:s.contractAddress,tokenId:s.tokenId??void 0,itemId:s.tokenId?void 0:s.itemId??void 0,profile:o?void 0:w?y:"default",bodyShape:o||w?void 0:x,type:l?void 0:o?K.PreviewType.WEARABLE:K.PreviewType.AVATAR,emote:l||o?void 0:K.PreviewEmote.FASHION,disableBackground:!0,wheelZoom:l?1.5:void 0,wheelStart:l?100:void 0,dev:Me.chainId===80002,unity:!0,onRenderer:k,onLoad:()=>N(!1)}):null,!b||m?e.jsx("div",{className:"item-preview__loading","aria-busy":"true","aria-label":t("itemPreview.loading"),children:e.jsx("span",{className:"item-preview__spinner","aria-hidden":!0})}):null,j&&!o?e.jsx("p",{className:"item-preview__note",children:t("itemPreview.shownOnBody",{shape:Oa(x)})}):null,E?l?e.jsx("div",{className:"item-preview__emote-controls","data-testid":"emote-controls",children:e.jsx(Os,{wearablePreviewId:"shop-item-preview",hideFrameInput:!0})}):e.jsxs("div",{className:"item-preview__toggle",role:"group","aria-label":t("itemPreview.previewMode"),children:[e.jsxs("button",{type:"button",className:f==="avatar"?"is-active":"","aria-pressed":f==="avatar","aria-label":t("itemPreview.onAvatar"),onClick:()=>v("avatar"),children:[e.jsxs("svg",{className:"item-preview__toggle-ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:[e.jsx("circle",{cx:"12",cy:"7.5",r:"4"}),e.jsx("path",{d:"M4 20c0-4.2 3.6-6.5 8-6.5s8 2.3 8 6.5v.5H4z"})]}),e.jsx("span",{className:"item-preview__toggle-label",children:t("itemPreview.onAvatar")})]}),e.jsxs("button",{type:"button",className:f==="item"?"is-active":"","aria-pressed":f==="item","aria-label":t("itemPreview.item"),onClick:()=>v("item"),children:[e.jsx("svg",{className:"item-preview__toggle-ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:e.jsx("path",{d:"M8.5 3 3 6l1.8 3.8 2.2-1V21h10V8.8l2.2 1L22 6l-5.5-3a2.6 2.6 0 0 1-4.5 1.4A2.6 2.6 0 0 1 8.5 3z"})}),e.jsx("span",{className:"item-preview__toggle-label",children:t("itemPreview.item")})]})]}):null]})}const aa=8,Ws=!1;function Qs(s){if(!s)return;const r=s.toLowerCase();return Object.values(K.Rarity).includes(r)?K.Rarity.getMaxSupply(r):void 0}function zs(s){return/^0x[a-fA-F0-9]{40}$/.test(s)?`${s.slice(0,6)}…${s.slice(-4)}`:s}function Vs(s){let r=0;for(let c=0;c<s.length;c++)r=r*31+s.charCodeAt(c)>>>0;return`hsl(${r%360}, 52%, 45%)`}function Us(s,r){var c;return(((c=s==null?void 0:s.trim())==null?void 0:c[0])||r.replace(/^0x/i,"")[0]||"?").toUpperCase()}function Gs(s){return{tradeId:s.tradeId??s.id,listingType:"primary",contractAddress:s.contractAddress,itemId:s.itemId??"",name:s.name,thumbnail:s.thumbnail,rarity:s.rarity,category:s.category,wearableCategory:s.wearableCategory??null,creator:s.creator,manaWei:s.manaWei??"0",available:1,network:s.network,chainId:s.chainId,createdAt:0}}function Ys({r:s,seller:r,issuedId:c,total:i,isOwn:y,isLegacy:l,inCart:f,fallbackImage:v,onAdd:o,onBuyNative:b,onBuyLegacy:m}){var W,Q;const N=le(),{data:a}=ra(r),k=(Q=(W=a==null?void 0:a.avatar)==null?void 0:W.snapshots)==null?void 0:Q.face256,[E,u]=d.useState(!1);d.useEffect(()=>u(!1),[k]);const w=!!k&&!E,x=r?a!=null&&a.name?na(a.name):zs(r):void 0,j=w?e.jsx("img",{className:"resales__ava",src:k,alt:"",loading:"lazy",onError:()=>u(!0)}):r?e.jsx("span",{className:"resales__ava resales__ava--letter",style:{backgroundColor:Vs(r)},"aria-hidden":!0,children:Us(a==null?void 0:a.name,r)}):v?e.jsx("img",{className:"resales__ava",src:v,alt:"","aria-hidden":!0}):e.jsx("span",{className:"resales__ava resales__ava--empty","aria-hidden":!0}),q=e.jsxs("span",{className:"resales__ident",children:[x?e.jsx("span",{className:"resales__name","data-testid":"resale-seller",children:x}):null,c?e.jsxs("span",{className:"resales__serial",children:[t("resales.serialLabel")," ",e.jsxs("span",{className:"resales__issued","data-testid":"resale-issued",children:["#",c]}),i?` ${t("resales.serialOf")} ${i.toLocaleString("en-US")}`:""]}):e.jsx("span",{className:"resales__serial resales__serial--muted",children:t("resales.copy")})]}),M=r?e.jsxs("button",{type:"button",className:"resales__who resales__who--link",onClick:()=>N(`/assets/creator/${r}`),children:[j,q]}):e.jsxs("div",{className:"resales__who",children:[j,q]});return e.jsxs("li",{className:`resales__row${l?" resales__row--legacy":""}`,"data-testid":"resale-row","data-source":s.source,"data-own":y?"true":void 0,children:[M,e.jsxs("div",{className:`resales__price${l?" resales__price--approx":""}`,children:[l?e.jsx("span",{className:"resales__approx","aria-hidden":!0,children:"≈"}):null,e.jsx(D,{className:"resales__diamond"}),e.jsx("span",{className:"resales__price-value",children:re(s.priceCredits)})]}),e.jsx("div",{className:"resales__actions",children:y?e.jsx("span",{className:"chip resales__own-chip","data-testid":"resale-own",children:t("resales.yourListing")}):l?e.jsx("button",{className:"resales__buy",onClick:m,"aria-label":t("assetCard.buyNow"),"data-testid":"resale-buy",children:t("assetCard.buyNow")}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"resales__add",onClick:o,disabled:f,"aria-label":f?t("assetCard.inCart"):t("assetCard.addToCart"),"data-testid":"resale-add",children:[e.jsx(O,{name:"cart-solid",size:16}),e.jsx("span",{children:f?t("assetCard.inCart"):t("assetCard.addToCart")})]}),e.jsx("button",{className:"resales__buy",onClick:b,"aria-label":t("assetCard.buyNow"),"data-testid":"resale-buy",children:t("assetCard.buyNow")})]})})]})}function Hs({item:s}){var Z;const r=s.contractAddress,c=s.itemId,i=pe(),y=ye(h=>h.add),l=ye(h=>h.items),{session:f}=ae(),v=(Z=f==null?void 0:f.address)==null?void 0:Z.toLowerCase(),[o,b]=d.useState(null),[m,N]=d.useState(null),[a,k]=d.useState(aa),E=Qs(s.rarity),{data:u=[],isLoading:w}=$({queryKey:["item-resales",r,c],enabled:!!r&&!!c,staleTime:0,refetchOnMount:"always",refetchOnWindowFocus:!0,queryFn:()=>Ka(r,c)}),x=u.slice(0,a),j=x.filter(h=>!h.seller||!h.issuedId).map(h=>h.tokenId).filter(h=>!!h),{data:q={}}=$({queryKey:["resale-token-info",r,j.join(",")],enabled:!!r&&j.length>0,staleTime:6e4,queryFn:()=>Wa(r,j)}),{data:M=[]}=$({queryKey:["item-classic-orders",r,c],enabled:Ws,queryFn:()=>Qa(r,c)}),W=u.some(h=>h.source==="legacy"),{data:Q}=oa(W);function L(){i.invalidateQueries({queryKey:["item-resales",r,c]})}return w||u.length===0?null:e.jsxs("section",{className:"resales","data-testid":"resales-section",children:[e.jsxs("div",{className:"resales__head",children:[e.jsx("h2",{className:"resales__title",children:t("resales.title")}),e.jsx("p",{className:"resales__subtitle",children:t("resales.subtitle")})]}),u.length>0?e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"resales__list",children:x.map(h=>{const ee=h.source==="legacy",_=l.some(S=>S.id===h.id),C=h.tokenId&&q[h.tokenId]||{},I=h.issuedId??C.issuedId,A=h.seller??C.seller,g={...h,name:h.name||s.name,thumbnail:h.thumbnail||s.thumbnail,rarity:h.rarity||s.rarity,category:h.category||s.category,wearableCategory:h.wearableCategory??s.wearableCategory,gender:h.gender??s.gender},T=!!A&&!!v&&A.toLowerCase()===v;return e.jsx(Ys,{r:g,seller:A,issuedId:I,total:E,isOwn:T,isLegacy:ee,inCart:_,fallbackImage:g.thumbnail,onAdd:()=>y(g,"item_detail"),onBuyNative:()=>b(g),onBuyLegacy:()=>N(Gs(g))},h.tradeId??h.id)})}),u.length>a?e.jsx("button",{className:"resales__more",onClick:()=>k(h=>h+aa),"data-testid":"resale-show-more",children:t("resales.showMore")}):null]}):null,null,o?e.jsx(ma,{item:o,onClose:()=>{b(null),L()}}):null,m&&Q?e.jsx(da,{listing:m,rate:Q,onClose:()=>N(null),onSold:()=>{N(null),L()}}):null]})}function ua(){return Me.shopServerUrl||(typeof window<"u"?window.location.origin:"")}async function Js(s,r,c){const i=new URLSearchParams({contractAddress:s,itemId:r}),y=`${ua()}/notify-requests?${i.toString()}`,l=await la(y,{method:"GET",identity:c,metadata:{}});if(!l.ok)throw new Error(`getNotifyRequest ${l.status}`);return l.json()}async function Xs(s,r){const c=`${ua()}/notify-requests`,i=await la(c,{method:"POST",identity:r,metadata:{},headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!i.ok)throw new Error(`createNotifyRequest ${i.status}: ${await i.text()}`);await i.json().catch(()=>{})}function sa(s){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s.trim())}function Zs({item:s}){const r=ae(u=>u.session),c=ae(u=>u.signIn),[i,y]=d.useState(""),[l,f]=d.useState(!1),[v,o]=d.useState(!1),[b,m]=d.useState(null),N=!!r&&!!s.contractAddress&&!!s.itemId,{data:a}=$({queryKey:["notify-request",s.contractAddress,s.itemId,r==null?void 0:r.address],enabled:N,queryFn:()=>Js(s.contractAddress,s.itemId,r.identity)});d.useEffect(()=>{a!=null&&a.email&&y(u=>u||a.email)},[a==null?void 0:a.email]),d.useEffect(()=>{if(!r)return;let u=!1;return za().then(w=>{!u&&w&&y(x=>x||w)}),()=>{u=!0}},[r]);const k=v||!!(a!=null&&a.subscribed);async function E(u){if(u.preventDefault(),!(!r||!s.itemId||!sa(i)||l)){f(!0),m(null);try{await Xs({contractAddress:s.contractAddress,itemId:s.itemId,chainId:s.chainId,email:i.trim()},r.identity),o(!0)}catch(w){ne(w,{flow:"notify-me",contractAddress:s.contractAddress,itemId:s.itemId}),m(t("notifyMe.error"))}finally{f(!1)}}}return r?k?e.jsxs("div",{className:"notify notify__done","data-testid":"notify-subscribed",children:[e.jsx("span",{className:"notify__done-check","aria-hidden":!0,children:e.jsx(O,{name:"check",size:12})}),e.jsx("span",{className:"notify__done-text",children:t("notifyMe.subscribedBody")})]}):e.jsxs("form",{className:"notify",onSubmit:E,"data-testid":"notify",children:[e.jsx("label",{className:"notify__label",htmlFor:"notify-email",children:t("notifyMe.label")}),e.jsxs("div",{className:"notify__row",children:[e.jsx("input",{id:"notify-email",className:"notify__input",type:"email",inputMode:"email",autoComplete:"email",placeholder:t("notifyMe.placeholder"),value:i,onChange:u=>y(u.target.value),"data-testid":"notify-email"}),e.jsx("button",{type:"submit",className:"notify__btn",disabled:!sa(i)||l,"data-testid":"notify-submit",children:l?t("notifyMe.working"):t("notifyMe.cta")})]}),e.jsx(fe,{message:b})]}):e.jsx("div",{className:"notify","data-testid":"notify",children:e.jsx("button",{type:"button",className:"notify__signin",onClick:c,"data-testid":"notify-signin",children:t("notifyMe.signInCta")})})}const et=X.button`
|
|
3
3
|
display: flex;
|
|
4
4
|
align-items: center;
|
|
5
5
|
justify-content: center;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,j as c}from"./react-C51i12iP.js";import{s as u,B as p,t as d}from"./index-
|
|
1
|
+
import{r as l,j as c}from"./react-C51i12iP.js";import{s as u,B as p,t as d}from"./index-DJzwNEuW.js";const a=u.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: center;
|
|
4
4
|
padding: 28px 0 8px;
|