@dcl/shop 0.5.1-30942936446.commit-2065145 → 0.5.1-30944558724.commit-19fdddf
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-tm1GZBBE.js +357 -0
- package/_assets/{AnimatedBackground-D_NOZUsv.js → AnimatedBackground-PdNi-WfR.js} +2 -2
- package/_assets/Assets-DzU3XKtW.js +800 -0
- package/_assets/{Assets.styles-Dwkb-T-5.js → Assets.styles-ZM8Q2cFA.js} +1 -1
- package/_assets/{Authorizations-CwdWUCCN.js → Authorizations-BxBoJzQm.js} +7 -7
- package/_assets/{Cart-DJd7mRPw.js → Cart-CoA_J4Zn.js} +17 -17
- package/_assets/{CircularProgress-QCFQ5Q0T.js → CircularProgress-iDUU-7Dd.js} +5 -5
- package/_assets/{Collection-Du05-cah.js → Collection-DUnvQ9xs.js} +8 -8
- package/_assets/{CollectionCarousel-CzK6Sr6O.js → CollectionCarousel-nQamkKEm.js} +15 -15
- package/_assets/{Creator-9YR9zS8U.js → Creator-Dgszo59r.js} +11 -11
- package/_assets/{ErrorNotice-B-k-8lgH.js → ErrorNotice-CfA5EQ3B.js} +1 -1
- package/_assets/{ExchangeController-CgsMU6Of.js → ExchangeController-CdHvmoRP.js} +1 -1
- package/_assets/{GetCredits-BWKjSlQH.js → GetCredits-Dv4OnlPr.js} +16 -16
- package/_assets/{HelpersUtil-C9JEsHd1.js → HelpersUtil-DL3ySOBk.js} +1 -1
- package/_assets/{ItemDetail-ByJH66Dr.js → ItemDetail-B2_NA3qK.js} +15 -15
- package/_assets/{LoadMore-CDsECC_S.js → LoadMore-TnqPM5W_.js} +2 -2
- package/_assets/ManaPricingBanner.styles-C7faS-HZ.js +74 -0
- package/_assets/{MenuList-DniyjKZf.js → MenuList-DLBo9vKa.js} +1 -1
- package/_assets/{MyAssets-Cn5OcKcq.js → MyAssets-D-1HxNtf.js} +2 -2
- package/_assets/{MyFavorites-Dh3ERS1g.js → MyFavorites-27Kg0fu-.js} +1 -1
- package/_assets/NotFound-CF-eOmVc.js +13 -0
- package/_assets/{NotificationsBell-BWFTNvfH.js → NotificationsBell-BADWC1wN.js} +1 -1
- package/_assets/{OutfitDetail-C-O6ZG_T.js → OutfitDetail-CdadHpaC.js} +10 -10
- package/_assets/{OutfitPreview-3ZYOvLqd.js → OutfitPreview-JIaMYiWg.js} +2 -2
- package/_assets/{OutfitStudio-CdH7v1-f.js → OutfitStudio-D-Tn3MZ0.js} +17 -17
- package/_assets/{StoreSettings-ZBAETVqr.js → StoreSettings-5uZXoOvP.js} +7 -7
- package/_assets/{Success-Dcdg4j1H.js → Success-C4laQ6DO.js} +5 -5
- package/_assets/{SwapController-CJCQ0dFg.js → SwapController-h8IVGbcS.js} +1 -1
- package/_assets/{Tooltip-POp1BJ4y.js → Tooltip-ySlzdfvH.js} +1 -1
- package/_assets/{TradeService-CQMOkya7.js → TradeService-C_mQXbkZ.js} +1 -1
- package/_assets/{W3MFrameProviderSingleton-kdy7Kyep.js → W3MFrameProviderSingleton-Be2imJ8Z.js} +3 -3
- package/_assets/{WebCryptoP256-CmT290Aw.js → WebCryptoP256-I4V1QbUv.js} +1 -1
- package/_assets/{authorizations-CWm7pvjk.js → authorizations-D7XuRQgn.js} +1 -1
- package/_assets/{basic-2wXayEjj.js → basic-Cue7GVXe.js} +1 -1
- package/_assets/{biconomy-CrUwmLLN.js → biconomy-C-omatJP.js} +1 -1
- package/_assets/{builder-D3s6Xcg_.js → builder-MQPY8ChB.js} +1 -1
- package/_assets/buy-DGpUz8hz.js +1 -0
- package/_assets/{buy-gasless-D2u0Cuie.js → buy-gasless-Bl-OulBV.js} +1 -1
- package/_assets/{categories-CD0l2-IJ.js → categories-BQKh49D5.js} +1 -1
- package/_assets/{ccip-Bq7op_u4.js → ccip-BC-JPxWw.js} +1 -1
- package/_assets/{ccip-Dt-VmUCH.js → ccip-Yik4EQGY.js} +1 -1
- package/_assets/{clsx-BZmZfIZ7.js → clsx-Df3CFyaE.js} +2 -2
- package/_assets/{collectionPage.styles-DnFAUb4Q.js → collectionPage.styles-vmTcFGbQ.js} +8 -8
- package/_assets/{controller-DAvNn45R.js → controller-Bq2L0AX1.js} +2 -2
- package/_assets/{core-UWabPMJx.js → core-lz2OIs0H.js} +4 -4
- package/_assets/{createSvgIcon-B4LAM6aP.js → createSvgIcon-bfaHZSjd.js} +3 -3
- package/_assets/{custom-BjZ8TeJA.js → custom-DYDi3MJe.js} +1 -1
- package/_assets/{data-capture-CJaTah4x.js → data-capture-Y8xGExqA.js} +1 -1
- package/_assets/{email-nvRgEzbl.js → email-UTvBfzjL.js} +1 -1
- package/_assets/{embedded-wallet-m5nVefBN.js → embedded-wallet-hF59IEhH.js} +1 -1
- package/_assets/{emotion-styled.browser.esm-SPt1g8r5.js → emotion-styled.browser.esm-D23S089l.js} +1 -1
- package/_assets/{engine-BQ30rMc_.js → engine-CgRM_THA.js} +1 -1
- package/_assets/{errors-sEfj_aGG.js → errors-Wm6SH4-v.js} +1 -1
- package/_assets/{estimate-l1-fee-D55ttM53.js → estimate-l1-fee-DZHVdg7h.js} +1 -1
- package/_assets/{execute-20WfUFta.js → execute-BPgoblAE.js} +2 -2
- package/_assets/{features-B3g5o6I9.js → features-DYTS35jX.js} +1 -1
- package/_assets/{fetchTokenMetadata-C3taocSg.js → fetchTokenMetadata-BxGNbM_2.js} +2 -2
- package/_assets/{field.styles-Cv8EF1LN.js → field.styles-Bys6wE0V.js} +1 -1
- package/_assets/{get-ecosystem-wallet-info-C87cJBZ0.js → get-ecosystem-wallet-info-xvSXu74j.js} +1 -1
- package/_assets/{getBalance-DJFj4nll.js → getBalance-DLxh2RuD.js} +1 -1
- package/_assets/{getNFT-Db40YAe5.js → getNFT-BOSh5H84.js} +1 -1
- package/_assets/{getNFT-n1rLq0y8.js → getNFT-K4qjxWNY.js} +1 -1
- package/_assets/{getThemeProps-qixq943T.js → getThemeProps-mxNIag6l.js} +1 -1
- package/_assets/{grid.styles-V4B-yWuT.js → grid.styles-BaFKxOV8.js} +1 -1
- package/_assets/{hashTypedData-DmKA2WyG.js → hashTypedData-Bje_1GNe.js} +1 -1
- package/_assets/{hashTypedData-Cph7l-wN.js → hashTypedData-CCvvyerQ.js} +1 -1
- package/_assets/{in-app-BrwiASGV.js → in-app-DBzemWmV.js} +1 -1
- package/_assets/{in-app-wallet-calls-Cdw4VCOK.js → in-app-wallet-calls-CeM3dz7A.js} +1 -1
- package/_assets/{index-Bvu9JQbk.js → index--BUBq145.js} +1 -1
- package/_assets/{index-DmqmHJz0.js → index-9pYsulOA.js} +1 -1
- package/_assets/{index-BzlgQIWc.js → index-B-PyHfEF.js} +1 -1
- package/_assets/{index-Dfq9MSrW.js → index-B1WnOG_n.js} +3 -3
- package/_assets/{index-CpvNbkCX.js → index-B4iL_Vxm.js} +1 -1
- package/_assets/{index-BfbRuC2a.js → index-BCyVn8MQ.js} +1 -1
- package/_assets/{index-DSgPAG74.js → index-BIXkfL0f.js} +1 -1
- package/_assets/{index-B3dN6jXl.js → index-BKSx9kmy.js} +1 -1
- package/_assets/{index-fTx5OxT5.js → index-BNbfWSl_.js} +3 -3
- package/_assets/{index-jUw3qf0Z.js → index-BT9bqwmo.js} +1 -1
- package/_assets/{index-BqZsCXiJ.js → index-BW-7rl1w.js} +1 -1
- package/_assets/{index-BSYdl9Ph.js → index-BY-2ttcm.js} +1 -1
- package/_assets/{index-BvvXUkGO.js → index-BgL4tnd6.js} +1 -1
- package/_assets/{index-D8CMDKuk.js → index-BhRssk62.js} +1 -1
- package/_assets/{index-C_tTx02v.js → index-BwBZg-Cg.js} +1 -1
- package/_assets/{index-CMIeiz8J.js → index-C1hTWDfF.js} +1 -1
- package/_assets/{index-gMS2owiI.js → index-C6jx_7vf.js} +1 -1
- package/_assets/{index-CfQEZ4_J.js → index-C8VruoUX.js} +1 -1
- package/_assets/{index-Db25kjW1.js → index-CFUHl0Ma.js} +1 -1
- package/_assets/{index-CwkhI0tX.js → index-CJWQK5Lk.js} +1 -1
- package/_assets/{index-DxNuVfUW.js → index-CNwyt0TH.js} +1 -1
- package/_assets/{index-DfEcY6V7.js → index-COC826L7.js} +1 -1
- package/_assets/{index-BKV20Nhl.js → index-CTSAk3HZ.js} +1 -1
- package/_assets/{index-TLObYCeZ.js → index-CW0DN1u5.js} +1 -1
- package/_assets/{index-CuRsH7Jr.js → index-C_KycN_b.js} +1 -1
- package/_assets/{index-OIDpRQ7d.js → index-Cdnlri5M.js} +1 -1
- package/_assets/{index-qh5KEihJ.js → index-Cj0IFSYI.js} +1 -1
- package/_assets/{index-BZJRlKJd.js → index-Cx-FPP2C.js} +1 -1
- package/_assets/{index-BwJOXIY2.js → index-D1ncAmsg.js} +1 -1
- package/_assets/{index-B0GXKjok.js → index-D3a3O8EH.js} +1 -1
- package/_assets/{index-CoJ4w6mI.js → index-D5drugU6.js} +1 -1
- package/_assets/{index-DtXZOCTH.js → index-D7A-L9p9.js} +1 -1
- package/_assets/{index-DjwAceSs.js → index-DCdXL8QX.js} +2 -2
- package/_assets/{index-DtpiUbDD.js → index-DFaB3PXW.js} +1 -1
- package/_assets/{index-DI6lxGl3.js → index-DGDemPnB.js} +1 -1
- package/_assets/{index-tRBG96tO.js → index-DKr33OKQ.js} +1 -1
- package/_assets/{index-D90TiSbn.js → index-DMSY746R.js} +1 -1
- package/_assets/{index-BN6xB09s.js → index-DRJlDsJB.js} +1 -1
- package/_assets/{index-NZryii06.js → index-DZrXtOiH.js} +1 -1
- package/_assets/{index-B1ZZ9eYb.js → index-D_9mpAb0.js} +2 -2
- package/_assets/index-DaQaTpvn.js +3315 -0
- package/_assets/{index-Pc_h8OVk.js → index-DvkKq-3d.js} +1 -1
- package/_assets/{index-BEHNdwPO.js → index-Iqpx-phg.js} +13 -13
- package/_assets/{index-BG81Ew07.js → index-MZdslMn6.js} +1 -1
- package/_assets/{index-sBdhGti_.js → index-TvUj9AoT.js} +1 -1
- package/_assets/{index-aOM-5o2s.js → index-VpH-lUJq.js} +1 -1
- package/_assets/{index-fLV7Ojeb.js → index-WvEbTnHu.js} +1 -1
- package/_assets/{index-DQzoGDIO.js → index-Ypo9phAp.js} +2 -2
- package/_assets/{index-DHvFGs-V.js → index-cFnHRMx4.js} +2 -2
- package/_assets/{index-dV4DRjLe.js → index-fzBQEY_W.js} +1 -1
- package/_assets/{index-Dvh_4N8m.js → index-sofR0AzT.js} +1 -1
- package/_assets/{index-BuxC7_jg.js → index-vt25O9Am.js} +3 -3
- package/_assets/{index.es-Pw8SRe4y.js → index.es-B9ErMvUj.js} +4 -4
- package/_assets/{index.es-CX9AxHdS.js → index.es-DuthVFnh.js} +1 -1
- package/_assets/{index.es-J0I60DQn.js → index.es-rx-DH5wv.js} +1 -1
- package/_assets/{localBatchGatewayRequest-CprCDfDl.js → localBatchGatewayRequest-D_WhElUc.js} +1 -1
- package/_assets/{networks-BR41WM8b.js → networks-CjrnWm_p.js} +1 -1
- package/_assets/{onramp-BHoU1j8h.js → onramp-DTvBwKCe.js} +1 -1
- package/_assets/{openzeppelin-C3R3Ow9P.js → openzeppelin-C06zmVod.js} +1 -1
- package/_assets/{parseNft-HXsYyGMT.js → parseNft-CWL0AW1h.js} +2 -2
- package/_assets/{parseSignature-CfegJHxn.js → parseSignature-5VH_Alnl.js} +1 -1
- package/_assets/{parseSignature-B55K-BHw.js → parseSignature-C5YgXtpR.js} +3 -3
- package/_assets/{passkeys-BLEVv9is.js → passkeys-DiZlNP-q.js} +1 -1
- package/_assets/{pay-with-exchange-BDPb0fmB.js → pay-with-exchange-CNm1xvZ5.js} +1 -1
- package/_assets/{qr-overlay-Bn5u1TXh.js → qr-overlay-CpgjTugW.js} +1 -1
- package/_assets/{receive-DdEXjtdG.js → receive-CV4TgE-L.js} +1 -1
- package/_assets/{resolveImplementation-BTny85ZN.js → resolveImplementation-XYPJYD3T.js} +1 -1
- package/_assets/{rpc-C1vRekft.js → rpc-tLuHrGBn.js} +1 -1
- package/_assets/{secp256k1-BS_DtXn_.js → secp256k1-CDI-iBc2.js} +1 -1
- package/_assets/{secp256k1-DSewH7p4.js → secp256k1-CYEZP9R3.js} +1 -1
- package/_assets/{secp256k1-DjcGt-hf.js → secp256k1-CpiwnyMt.js} +1 -1
- package/_assets/{send-D36Kc8ar.js → send-D5VuBzPD.js} +1 -1
- package/_assets/{send-batch-transaction-9UPtmXhF.js → send-batch-transaction-BfHXn227.js} +1 -1
- package/_assets/{send-eip712-transaction-C-DlyYI4.js → send-eip712-transaction-t0wYgXj7.js} +2 -2
- package/_assets/{send-gasless-transaction-Clkbkp81.js → send-gasless-transaction-CgmsaSdY.js} +2 -2
- package/_assets/{send-transaction-ac0pElET.js → send-transaction-CrLGC-De.js} +2 -2
- package/_assets/{sendMetaTransaction-3Orn7mPE.js → sendMetaTransaction-ef-RXWfu.js} +1 -1
- package/_assets/{sendRawTransaction-Bd_d0DGd.js → sendRawTransaction-pS6CHcTu.js} +3 -3
- package/_assets/{serializeTransaction-tReIGWJj.js → serializeTransaction-KCGr6qFd.js} +1 -1
- package/_assets/{session-proposal-BGjlVk7r.js → session-proposal-sRmaUsXb.js} +1 -1
- package/_assets/{session-request-BAHn4jIb.js → session-request-CfwKiBxF.js} +2 -2
- package/_assets/{signing-BO2fbGm6.js → signing-DBbUwPle.js} +3 -3
- package/_assets/{socials-rfvGwJ98.js → socials-MOf37RiI.js} +1 -1
- package/_assets/{swaps-D7QVUfQw.js → swaps-bmMgRWV4.js} +1 -1
- package/_assets/{thirdweb-BdoDApEi.js → thirdweb--zGmSCRq.js} +3 -3
- package/_assets/{to-serializable-transaction-DJoSj0cy.js → to-serializable-transaction-DjbT77eY.js} +2 -2
- package/_assets/{trade-encoding-CitD9riU.js → trade-encoding-wpCgB2Av.js} +1 -1
- package/_assets/{transactionReceipt-CFvIhGab.js → transactionReceipt-CweRPSQa.js} +1 -1
- package/_assets/{transactions-BCaw00-L.js → transactions-dtEdgAGt.js} +1 -1
- package/_assets/useCreditPacks-CzOCruPU.js +1 -0
- package/_assets/useImportable-rrKOGrr4.js +1 -0
- package/_assets/{useInfiniteGrid-Crt1jGuz.js → useInfiniteGrid-XDOQyPRq.js} +1 -1
- package/_assets/useTheme-DGv_oEh8.js +1 -0
- package/_assets/{verifyHash-CONBvy81.js → verifyHash-CvfcirkG.js} +1 -1
- package/_assets/{w3m-modal-CmgRQ0lu.js → w3m-modal-BGA4lQKq.js} +1 -1
- package/_assets/{w3m-modal-DTboZx41.js → w3m-modal-PufzUctO.js} +1 -1
- package/_assets/{wait-for-tx-receipt-IG8mDnzG.js → wait-for-tx-receipt-0VbbjxzA.js} +1 -1
- package/_assets/{wallets-YFeaNJbJ.js → wallets-BopYfWq7.js} +5 -5
- package/_assets/{web-connector-CnAC5kme.js → web-connector-BSV6ourQ.js} +3 -3
- package/_assets/{writeContract-C-4vi3wG.js → writeContract-CCNcKbN2.js} +1 -1
- package/_assets/{zoraTestnet-BAdd9yw6.js → zoraTestnet-DJdUGbFi.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/_assets/Activity-DKyyVjF3.js +0 -357
- package/_assets/Assets-B-QxXzVp.js +0 -800
- package/_assets/ManaPricingBanner.styles-CBM3_pCR.js +0 -74
- package/_assets/NotFound-BLRVVTj-.js +0 -13
- package/_assets/buy-DH_c8xtw.js +0 -1
- package/_assets/index-BmdBaCyf.js +0 -3315
- package/_assets/mana-convert-DjCFeoQ3.js +0 -1
- package/_assets/useCreditPacks-DI0sJyEs.js +0 -1
- package/_assets/useImportable-B6LfqPpp.js +0 -1
- package/_assets/useManaRate-CVF6TzHy.js +0 -1
- package/_assets/useTheme-DDT9I-Gr.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as $,j as t}from"./react-DehiWSvs.js";import{R as T,C as se,a as ae,b as re}from"./categories-
|
|
1
|
+
import{r as $,j as t}from"./react-DehiWSvs.js";import{R as T,C as se,a as ae,b as re}from"./categories-BQKh49D5.js";import{n as c,T as le}from"./Tooltip-ySlzdfvH.js";import{t as e,s as o,I as g,d as s,ae as ce,e as v}from"./index-DaQaTpvn.js";const de=o.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 12px;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{j as i,L as _,r as
|
|
1
|
+
import{j as i,L as _,r as F}from"./react-DehiWSvs.js";import{s as n,B as P,t as a,q as D,v as W,d as e,l as G,w as O,I as b,x as B,o as w,y as K,c as Q,z as H,A,D as X,E as Z,F as E}from"./index-DaQaTpvn.js";import{d as J,f as U,b as V,h as Y,s as tt,a as it}from"./authorizations-D7XuRQgn.js";import{f as et}from"./builder-MQPY8ChB.js";import{m as ot}from"./mana-matic-C4e1sNO3.js";import{f as at}from"./errors-Wm6SH4-v.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-ef-RXWfu.js";const nt=D`
|
|
2
2
|
to { transform: rotate(360deg); }
|
|
3
|
-
`,st=
|
|
3
|
+
`,st=D`
|
|
4
4
|
to { background-position: -200% 0; }
|
|
5
5
|
`,rt=n.section`
|
|
6
6
|
width: 100%;
|
|
@@ -48,7 +48,7 @@ import{j as i,L as _,r as P}from"./react-DehiWSvs.js";import{s as n,B as W,t as
|
|
|
48
48
|
grid-template-columns: 44px 1fr;
|
|
49
49
|
grid-row-gap: 10px;
|
|
50
50
|
}
|
|
51
|
-
`,
|
|
51
|
+
`,T=n.div`
|
|
52
52
|
height: 74px;
|
|
53
53
|
border-radius: 16px;
|
|
54
54
|
background: linear-gradient(100deg, #efeef2 30%, #e2e0e7 50%, #efeef2 70%);
|
|
@@ -110,7 +110,7 @@ import{j as i,L as _,r as P}from"./react-DehiWSvs.js";import{s as n,B as W,t as
|
|
|
110
110
|
grid-column: 1 / -1;
|
|
111
111
|
justify-self: start;
|
|
112
112
|
}
|
|
113
|
-
`,
|
|
113
|
+
`,zt=n.button`
|
|
114
114
|
position: relative;
|
|
115
115
|
width: 46px;
|
|
116
116
|
height: 26px;
|
|
@@ -150,7 +150,7 @@ import{j as i,L as _,r as P}from"./react-DehiWSvs.js";import{s as n,B as W,t as
|
|
|
150
150
|
outline: 2px solid ${a.colors.accent};
|
|
151
151
|
outline-offset: 2px;
|
|
152
152
|
}
|
|
153
|
-
`,
|
|
153
|
+
`,bt=n.span`
|
|
154
154
|
width: 16px;
|
|
155
155
|
height: 16px;
|
|
156
156
|
border-radius: 50%;
|
|
@@ -181,6 +181,6 @@ import{j as i,L as _,r as P}from"./react-DehiWSvs.js";import{s as n,B as W,t as
|
|
|
181
181
|
font-size: 22px;
|
|
182
182
|
font-weight: 700;
|
|
183
183
|
margin: 6px 0 0;
|
|
184
|
-
`,M=n(
|
|
184
|
+
`,M=n(P)`
|
|
185
185
|
margin-top: 12px;
|
|
186
|
-
`;function j({descriptor:t,owner:s,signer:r,name:o,description:c,image:l,icon:p}){const v=K(),[h,y]=
|
|
186
|
+
`;function j({descriptor:t,owner:s,signer:r,name:o,description:c,image:l,icon:p}){const v=K(),[h,y]=F.useState(!1),{data:u,isLoading:m,refetch:d}=w({queryKey:["authorization",t.id,s],queryFn:()=>it(t,s),staleTime:3e4});async function g(){if(h||m)return;const z=!u;y(!0);try{await tt({auth:t,signer:r,active:z}),await d(),v.setQueryData(["authorization",t.id,s],z),A.success(z?e("authorizations.toastActivated",{name:o}):e("authorizations.toastDeactivated",{name:o}))}catch($){X($,{flow:"authorizations",step:z?"grant":"revoke"}),A.error(at($,e("authorizations.errorGeneric")))}finally{y(!1)}}const q=m?e("authorizations.checking"):u?e("authorizations.active"):e("authorizations.inactive");return i.jsxs(ut,{"data-testid":`authorization-${t.id}`,"data-active":!!u,children:[i.jsx(pt,{children:l?i.jsx("img",{src:l,alt:""}):p}),i.jsxs(mt,{children:[i.jsx(gt,{title:o,children:o}),i.jsx(xt,{children:c})]}),i.jsxs(yt,{children:[i.jsx(ft,{"data-active":!!u,children:q}),h?i.jsx(bt,{"aria-label":e("authorizations.working")}):i.jsx(zt,{type:"button","data-testid":`authorization-toggle-${t.id}`,"data-active":!!u,role:"switch","aria-checked":!!u,"aria-label":u?e("authorizations.deactivateAria",{name:o}):e("authorizations.activateAria",{name:o}),disabled:m,onClick:()=>void g()})]})]})}const f=500,R=10,wt=f*R;async function N(t,s){const r=await E(t,{category:s,first:f}),o=Math.min(Math.ceil(r.total/f),R),c=await Promise.all(Array.from({length:Math.max(0,o-1)},(l,p)=>E(t,{category:s,first:f,skip:(p+1)*f})));return{assets:[...r.assets,...c.flatMap(l=>l.assets)],truncated:r.total>wt}}function vt(t){return w({queryKey:["owned-collections",t],enabled:!!t,staleTime:6e4,queryFn:async()=>{const[s,r]=await Promise.all([N(t,"wearable"),N(t,"emote")]),o=new Map;for(const c of[...s.assets,...r.assets]){const l=c.contractAddress.toLowerCase();o.has(l)||o.set(l,c)}return{collections:[...o.values()],truncated:s.truncated||r.truncated,scanned:s.assets.length+r.assets.length}}})}function kt(t){return w({queryKey:["contract-registry"],enabled:t,staleTime:1/0,gcTime:1/0,queryFn:Z})}function Ct(t,s){const r=s==null?void 0:s.get(t.toLowerCase());if(r)return r;const o=H(t);return o===t?e("authorizations.collectionFallback"):o}function $t(t,s){return w({queryKey:["creator-collections",t],enabled:!!t&&!!s,staleTime:6e4,queryFn:async()=>{const r=await et(t,s),o=new Map;for(const c of r){const l=c.contractAddress.toLowerCase();o.has(l)||o.set(l,c)}return[...o.values()]}})}function _t(){W({title:e("authorizations.title"),noindex:!0});const{session:t,signIn:s}=G(),r=Q.chainId,o=O(t==null?void 0:t.providerType),{data:c,isLoading:l}=vt(o?t==null?void 0:t.address:void 0),{data:p,isLoading:v}=kt(!!o&&!!(t!=null&&t.address)),{data:h,isLoading:y}=$t(o?t==null?void 0:t.address:void 0,o?t==null?void 0:t.identity:void 0);if(!t)return i.jsxs(S,{children:[i.jsx(b,{name:"info",size:40,color:a.colors.muted2}),i.jsx(L,{children:e("authorizations.signInTitle")}),i.jsx("p",{className:"muted",children:e("authorizations.signInBody")}),i.jsx(M,{variant:"purple",onClick:()=>s(),children:e("storeSettings.signIn")})]});if(!o)return i.jsxs(S,{children:[i.jsx(b,{name:"check",size:40,color:a.colors.ok}),i.jsx(L,{children:e("authorizations.managedTitle")}),i.jsx("p",{className:"muted",children:e("authorizations.managedBody")}),i.jsx(M,{as:_,to:"/items",variant:"purple",children:e("authorizations.managedCta")})]});const u=J(r),m=U(r);return i.jsxs(rt,{children:[i.jsxs(ct,{children:[i.jsx(lt,{children:e("authorizations.title")}),i.jsx(dt,{children:e("authorizations.intro")})]}),i.jsxs(k,{children:[i.jsx(C,{children:e("authorizations.buyingTitle")}),i.jsxs(x,{children:[i.jsx(j,{descriptor:u,owner:t.address,signer:t.signer,name:e("authorizations.creditsName"),description:e("authorizations.creditsDesc"),icon:i.jsx(B,{className:"ccy-mark"})}),i.jsx(j,{descriptor:m,owner:t.address,signer:t.signer,name:e("authorizations.manaName"),description:e("authorizations.manaDesc"),icon:i.jsx(ht,{src:ot,alt:"","aria-hidden":!0})})]})]}),i.jsxs(k,{children:[i.jsx(C,{children:e("authorizations.sellingTitle")}),c!=null&&c.truncated?i.jsx(jt,{"data-testid":"authorizations-selling-truncated",children:e("authorizations.sellingTruncated",{count:c.scanned})}):null,l||v?i.jsx(x,{"aria-busy":"true","aria-label":e("authorizations.checking"),children:Array.from({length:3}).map((d,g)=>i.jsx(T,{"aria-hidden":!0},g))}):c&&c.collections.length>0?i.jsx(x,{children:c.collections.map(d=>i.jsx(j,{descriptor:V(d.contractAddress,r),owner:t.address,signer:t.signer,name:Ct(d.contractAddress,p),description:e("authorizations.sellingDesc"),image:d.image,icon:i.jsx(b,{name:"pen",size:18})},d.contractAddress))}):i.jsx(I,{children:e("authorizations.sellingEmpty")})]}),i.jsxs(k,{children:[i.jsx(C,{children:e("authorizations.mintingTitle")}),y?i.jsx(x,{"aria-busy":"true","aria-label":e("authorizations.checking"),children:Array.from({length:3}).map((d,g)=>i.jsx(T,{"aria-hidden":!0},g))}):h&&h.length>0?i.jsx(x,{children:h.map(d=>i.jsx(j,{descriptor:Y(d.contractAddress,r),owner:t.address,signer:t.signer,name:d.name||e("authorizations.collectionFallback"),description:e("authorizations.mintingDesc"),icon:i.jsx(b,{name:"pen",size:18})},d.contractAddress))}):i.jsx(I,{children:e("authorizations.mintingEmpty")})]})]})}export{_t as Authorizations};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,L as
|
|
1
|
+
import{j as e,L as $e,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t as le,s as i,d as s,av as de,b0 as sa,au as na,I as H,x as Mt,ad as Qe,v as ia,Q as N,af as dt,l as ra,n as oa,o as ca,b1 as da,y as la,b2 as ua,b3 as ha,b4 as pa,b5 as lt,b6 as ga,b7 as xa,w as ma,b8 as ut,U as G,b9 as ht,ba as fa,D as ae,k as ya,c as pt,bb as ba,e as va,bc as gt,bd as _e,be as ye,bf as be,bg as xt,g as ve,a as wa,C as We,bh as Ca}from"./index-DaQaTpvn.js";import{M as ja,S as ka,C as Sa,H as $a,a as Ma,T as Ta,X as Ia,b as Pa,B as za,c as Aa,d as mt,e as Ea,f as ke,P as Tt,m as qa,g as Ba,h as Ra,i as _a,j as It,k as Se,L as Wa,l as Fa,n as ft,o as yt,W as La,p as Ua,q as Ka,A as Qa,r as Na,s as Ha,t as Oa,u as Va,v as Ga,w as Da,x as Ya,y as Ja,z as Xa,D as Za,E as es,F as ts,G as as,I as ss,J as ns,K as Fe,N as is,O as rs,Q as os,R as cs,U as bt,V as vt,Y as ds,Z as ls,_ as us}from"./CollectionCarousel-nQamkKEm.js";import{j as hs,k as ps,a as gs,n as xs,i as ms,A as fs}from"./authorizations-D7XuRQgn.js";import{g as ys,b as Le}from"./buy-DGpUz8hz.js";import{b as bs,w as vs,S as wt,G as ws}from"./buy-gasless-Bl-OulBV.js";import{u as Cs,M as js,R as we,r as ks,c as Ss,p as Ct}from"./useCreditPacks-CzOCruPU.js";import{i as $s,a as Ms}from"./errors-Wm6SH4-v.js";import{E as Ts}from"./ErrorNotice-CfA5EQ3B.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-wpCgB2Av.js";import"./sendMetaTransaction-ef-RXWfu.js";const{colors:se,radius:Is}=le,Ps=i.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
@@ -58,7 +58,7 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
58
58
|
font-weight: 700;
|
|
59
59
|
color: ${se.text};
|
|
60
60
|
}
|
|
61
|
-
`,
|
|
61
|
+
`,Bs="https://cdn.decentraland.org/@dcl/shop/0.5.1-30944558724.commit-19fdddf/_assets/buy-error-22UunaPC.png";function Rs(o){const{phase:l,balanceCredits:I,onClose:z}=o,W=l==="processing",D=l==="error"?s("cartCheckout.errorTitle"):l==="nofunds"?s("cartCheckout.titleNoFunds"):l==="choose"?s("buyModal.choosePayment"):s("cartCheckout.titleBuy"),Y=l==="processing";return e.jsxs(ja,{role:"dialog","aria-modal":"true","aria-label":s("cartCheckout.dialogAria"),children:[e.jsx(ka,{onClick:W?void 0:z,"aria-hidden":!0}),e.jsxs(Sa,{"data-tall":Y||void 0,children:[e.jsxs($a,{children:[e.jsxs(Ma,{children:[e.jsx(Ta,{children:D}),!W&&e.jsx(Ia,{onClick:z,"aria-label":s("buyModal.close"),children:e.jsx(Pa,{})})]}),e.jsxs(za,{children:[e.jsx(Aa,{children:l==="nofunds"?s("buyModal.dclBalance"):s("buyModal.myCreditsBalance")}),e.jsx(mt,{}),e.jsx(Ea,{children:de(I)})]})]}),l==="choose"&&e.jsxs(ke,{children:[e.jsxs(qs,{children:[e.jsx("span",{children:s("cart.purchaseSummary")}),e.jsxs("strong",{children:[e.jsx(mt,{}),de(o.totalCredits??0)]})]}),e.jsx(Tt,{options:o.options??[],totalCents:o.totalCents??0,onPay:o.onPay??(()=>{}),rateNote:(()=>{const A=qa(o.totalCents??0,o.totalManaWei??0n);return A!=null?s("buyModal.manaRate",{mana:A.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),l==="processing"&&e.jsx(_s,{stage:o.stage??"reserving",step:o.step??1,total:o.total??1,isSelfCustody:!!o.isSelfCustody,signatures:o.signatures}),l==="nofunds"&&e.jsx(Ws,{lines:o.lines??[],shortfallCredits:o.shortfallCredits??0,packs:o.packs??[],selectedPack:o.selectedPack??"",onSelectPack:o.onSelectPack??(()=>{}),onBuyPacks:o.onBuyPacks??(()=>{}),onCancel:z}),l==="error"&&e.jsxs(ke,{children:[e.jsxs(Ba,{"data-testid":"buy-error",children:[e.jsx(Ra,{src:Bs,alt:"",width:64,height:80}),e.jsxs(_a,{children:[e.jsx("b",{children:s("cartCheckout.errorHeadline")})," ",o.message??s("cartCheckout.errorBody")]})]}),e.jsxs(It,{children:[e.jsx(Se,{"data-variant":"outline",onClick:z,children:s("buyModal.cancel")}),e.jsx(Se,{"data-variant":"purple",onClick:o.onRetry??z,children:s("cartCheckout.tryAgain")})]})]})]})]})}function _s({stage:o,step:l,total:I,isSelfCustody:z,signatures:W}){const D=o==="reserving",Y=I>0?Math.min(100,Math.round(l/I*100)):0,A=z&&W&&W.total>1,ne=o==="awaiting-signature"?z?A?s("cartCheckout.confirmMultiple",{current:W.current,total:W.total}):s("buyModal.confirmToContinue"):s("buyModal.completingTransaction"):o==="settling"?s("buyModal.completingTransaction"):s("cartCheckout.preparing");return e.jsxs(ke,{"data-processing":!0,children:[e.jsx(Wa,{src:sa,alt:"",width:61,height:61}),e.jsx(Fa,{children:ne}),D?e.jsxs(Ps,{children:[e.jsx(ft,{"aria-hidden":!0,children:e.jsx(yt,{"data-step":!0,style:{width:`${Y}%`}})}),I>1?e.jsxs(zs,{children:[l,"/",I]}):null]}):e.jsx(ft,{"aria-hidden":!0,children:e.jsx(yt,{})})]})}function Ws({lines:o,shortfallCredits:l,packs:I,selectedPack:z,onSelectPack:W,onBuyPacks:D,onCancel:Y}){const A=I.find(n=>n.id===z),ne=o.reduce((n,L)=>n+(L.quantity??1),0);return e.jsxs(ke,{children:[e.jsxs(La,{"data-testid":"nofunds-warning",children:[e.jsx(Ua,{}),e.jsxs(Ka,{children:[e.jsx("b",{children:s("buyModal.insufficientFunds")})," ",s("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:s("buyModal.warningCreditsAmount",{count:Math.max(0,l)})})," ",s("buyModal.warningToPurchase",{count:ne})]})]}),e.jsx(As,{children:o.map(n=>{const L=n.quantity??1;return e.jsxs(Qa,{children:[e.jsx(Na,{children:n.item.thumbnail?e.jsx("img",{src:n.item.thumbnail,alt:""}):null}),e.jsxs(Ha,{children:[e.jsxs("div",{children:[e.jsxs(Oa,{title:n.item.name,children:[n.item.name||s("buyModal.itemFallback"),L>1?e.jsx(Es,{children:s("cartCheckout.qty",{count:L})}):null]}),n.item.creator?e.jsx(Va,{address:n.item.creator}):null]}),e.jsxs(Ga,{children:[e.jsx(Da,{}),e.jsx("span",{children:de(n.priceCredits*L)})]})]})]},n.item.id)})}),e.jsx(Ya,{children:I.map(n=>{const L=n.id===z;return e.jsxs(Ja,{"data-testid":"credit-pack","data-on":L||void 0,onClick:()=>W(n.id),children:[e.jsx(Xa,{}),e.jsx(Za,{children:de(n.credits)}),e.jsxs(es,{children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs(ts,{children:[e.jsxs(as,{children:[e.jsx(ss,{}),e.jsx("span",{children:de((A==null?void 0:A.credits)??0)})]}),e.jsxs(ns,{children:["$",((A==null?void 0:A.usd)??0).toFixed(2)]})]}),e.jsxs(It,{children:[e.jsx(Se,{"data-variant":"outline",onClick:Y,children:s("buyModal.cancel")}),e.jsx(Se,{"data-variant":"gradient",onClick:D,children:s("buyModal.buy")})]})]})}const{colors:r,gradients:Pt,radius:Z}=le,zt="@media (max-width: 1080px)",T="@media (max-width: 880px)",jt=i.div`
|
|
62
62
|
max-width: 1510px;
|
|
63
63
|
margin: 0 auto;
|
|
64
64
|
/* Grows into the page's leftover height and passes it down to Upsell, so the white cross-sell band ends at
|
|
@@ -107,7 +107,7 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
107
107
|
${zt} {
|
|
108
108
|
grid-template-columns: 1fr;
|
|
109
109
|
}
|
|
110
|
-
|
|
110
|
+
`,St=i.div`
|
|
111
111
|
position: relative;
|
|
112
112
|
/* The gray band is 733px in Figma (1553-317103) — taller than the panels inside it, deliberately. Without
|
|
113
113
|
this it collapsed to the panels' height, and the page shell's own viewport-filling min-height then padded
|
|
@@ -125,7 +125,7 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
125
125
|
display: flex;
|
|
126
126
|
flex-direction: column;
|
|
127
127
|
gap: 12px;
|
|
128
|
-
`,
|
|
128
|
+
`,Us=i.div`
|
|
129
129
|
display: flex;
|
|
130
130
|
align-items: center;
|
|
131
131
|
justify-content: space-between;
|
|
@@ -147,7 +147,7 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
147
147
|
${T} {
|
|
148
148
|
padding: 16px;
|
|
149
149
|
}
|
|
150
|
-
`,
|
|
150
|
+
`,Ks=i(At)`
|
|
151
151
|
display: flex;
|
|
152
152
|
flex-direction: column;
|
|
153
153
|
align-items: center;
|
|
@@ -168,7 +168,7 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
168
168
|
align-items: center;
|
|
169
169
|
gap: 12px;
|
|
170
170
|
padding-bottom: 16px;
|
|
171
|
-
`,
|
|
171
|
+
`,Ns=i.p`
|
|
172
172
|
margin: 0;
|
|
173
173
|
font-size: 24px;
|
|
174
174
|
font-weight: 700;
|
|
@@ -186,7 +186,7 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
186
186
|
${le.media.maxWidth("mobile")} {
|
|
187
187
|
font-size: 16px;
|
|
188
188
|
}
|
|
189
|
-
`,Os=i(
|
|
189
|
+
`,Os=i($e)`
|
|
190
190
|
display: inline-flex;
|
|
191
191
|
align-items: center;
|
|
192
192
|
justify-content: center;
|
|
@@ -327,7 +327,7 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
327
327
|
width: 120px;
|
|
328
328
|
height: 120px;
|
|
329
329
|
}
|
|
330
|
-
`,Zs=i(
|
|
330
|
+
`,Zs=i($e)`
|
|
331
331
|
position: absolute;
|
|
332
332
|
inset: 0;
|
|
333
333
|
display: grid;
|
|
@@ -384,7 +384,7 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
384
384
|
}
|
|
385
385
|
`,sn=i.div`
|
|
386
386
|
${Et};
|
|
387
|
-
`,nn=i(
|
|
387
|
+
`,nn=i($e)`
|
|
388
388
|
${Et};
|
|
389
389
|
`,rn=i(na)`
|
|
390
390
|
font-size: 10px;
|
|
@@ -411,7 +411,7 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
411
411
|
padding: 6px;
|
|
412
412
|
border: 0.5px solid ${r.muted2};
|
|
413
413
|
border-radius: ${Z.pill};
|
|
414
|
-
|
|
414
|
+
`,$t=i.button`
|
|
415
415
|
display: grid;
|
|
416
416
|
place-items: center;
|
|
417
417
|
width: 16px;
|
|
@@ -480,7 +480,7 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
480
480
|
color: ${r.text2};
|
|
481
481
|
`,xn=i(H)`
|
|
482
482
|
color: #f48221;
|
|
483
|
-
`,mn=i(
|
|
483
|
+
`,mn=i($e)`
|
|
484
484
|
font-size: 12px;
|
|
485
485
|
font-weight: 600;
|
|
486
486
|
line-height: 24px;
|
|
@@ -596,12 +596,12 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
596
596
|
display: flex;
|
|
597
597
|
flex-direction: column;
|
|
598
598
|
gap: 12px;
|
|
599
|
-
|
|
599
|
+
`,Sn=i.div`
|
|
600
600
|
display: flex;
|
|
601
601
|
align-items: flex-start;
|
|
602
602
|
justify-content: space-between;
|
|
603
603
|
gap: 12px;
|
|
604
|
-
|
|
604
|
+
`,$n=i.span`
|
|
605
605
|
font-size: 14px;
|
|
606
606
|
font-weight: 600;
|
|
607
607
|
line-height: 1.57;
|
|
@@ -658,13 +658,13 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
658
658
|
opacity: 0.6;
|
|
659
659
|
cursor: default;
|
|
660
660
|
}
|
|
661
|
-
`,
|
|
661
|
+
`,Bt=Qe`
|
|
662
662
|
margin: 0;
|
|
663
663
|
font-size: 13px;
|
|
664
664
|
`,Ce=i.p`
|
|
665
|
-
${
|
|
665
|
+
${Bt};
|
|
666
666
|
`,zn=i(Ts)`
|
|
667
|
-
${
|
|
667
|
+
${Bt};
|
|
668
668
|
`,An=i.div`
|
|
669
669
|
position: relative;
|
|
670
670
|
/* Takes the leftover height so its white ::before covers it — see .page[data-route="/cart"]. */
|
|
@@ -692,4 +692,4 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
692
692
|
& section {
|
|
693
693
|
margin-top: 0;
|
|
694
694
|
}
|
|
695
|
-
`;function Ke(o){if(Ss(o))return s("errors.rejected");const l=(o.message??"").toLowerCase();return l.includes("insufficient")?s("cart.error.insufficient",{currency:fa.name}):l.includes("no active listing")||l.includes("your own listing")?s("cart.error.listingChanged"):s("marketCheckout.error.generic")}const En=12e4;function qn(o){const l=[];return o.unavailable.length&&l.push(s("cart.drop.unavailable",{count:o.unavailable.length})),o.own.length&&l.push(s("cart.drop.own",{count:o.own.length})),s("cart.drop.removed",{items:l.join(` ${s("cart.drop.and")} `)})}const Ne=o=>o.reduce((l,I)=>l+I.priceCredits*I.quantity,0),je=o=>o.flatMap(l=>Array.from({length:l.quantity},()=>({...l,quantity:1})));function Xn(){ia({title:s("nav.cart"),noindex:!0});const o=U(t=>t.items),l=U(t=>t.remove),I=U(t=>t.increment),z=U(t=>t.decrement),W=U(t=>t.clear),D=U(t=>t.restore),Y=U(t=>t.setFittingOpen),A=dt(t=>t.items),ne=dt(t=>t.toggle),{session:n,signIn:L}=ra(),Bt=ls(),ue=Cs().packs.slice(0,js);P.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const Rt=o.some(t=>t.category!=="emote"),{data:Me}=oa({queryKey:["upsell-listings"],queryFn:()=>ba({first:40}),staleTime:6e4}),{data:$}=ca(n),b=da(),ee=ta(),{state:J}=aa(),[Wt,ie]=P.useState(null),[Ue,he]=P.useState(null),[Ft,_]=P.useState(!1),[B,O]=P.useState(null),He=P.useRef(0),[p,j]=P.useState(null),{data:pe}=la(n),{data:re}=ds(!0),[Te,Oe]=P.useState(""),oe=P.useRef(null),Ve=ua(o),Ge=t=>lt(Ve[t.id]),Ie=o.filter(Ge),Pe=o.length>0&&Ie.length===0,Lt=Ie.reduce((t,a)=>t+a.priceCredits*a.quantity,0),Kt=o.reduce((t,a)=>t+a.quantity,0),Nt=Ie.reduce((t,a)=>t+a.quantity,0),De=B?B.liveTotalCredits:Lt,Qt=new Set(o.map(t=>t.id)),Ye=((Me==null?void 0:Me.items)??[]).filter(t=>!Qt.has(t.id)).slice(0,12),Ut=new Map(B==null?void 0:B.buyable.map(t=>[t.item.id,t])),ge=($==null?void 0:$.credits)??0,ze=De*10,Ht=re?Ct(ze,re):0n,xe=Fe({priceCents:ze,priceManaWei:Ht,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n}),Ot=t=>t.some(a=>a.acquisition==="store"),Ae=t=>t.flatMap(a=>a.acquisition==="trade"?[a]:[]),Vt=xa,Gt=t=>ma(t.contractAddress,String(t.itemId));function me(t){t(),O(null),he(null),ie(null)}function Dt(){j(null),_(!1)}function Je(t){const a=Ne(t),d=Math.max(0,a-ge),c=ue.find(u=>u.credits>=d)??ue[ue.length-1];Oe(c.id),G("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:a,credits_balance:ge,shortfall:d}),j({phase:"nofunds",lines:t.map(u=>({item:u.item,priceCredits:u.priceCredits,quantity:u.quantity})),shortfall:d}),_(!1)}async function Ee(t){if(!n||t.length===0)return;const a=je(t),d=a.map(y=>({...y.item,priceCredits:y.priceCredits})),c=t.map(y=>({...y.item,priceCredits:y.priceCredits,quantity:y.quantity})),u=[];let h="authorize";const w=new Set,S=new Set,R=new Set,E=[];let q=!1;j({phase:"processing",stage:"reserving",step:1,total:a.length});try{const y=[];for(let m=0;m<a.length;m++){const x=a[m];j({phase:"processing",stage:"reserving",step:m+1,total:a.length});try{const M=x.acquisition==="trade"?x.trade.id:void 0,C=x.item.contractAddress&&x.item.itemId!=null?{contractAddress:x.item.contractAddress,itemId:String(x.item.itemId)}:void 0,{credit:Q,maxCreditedValue:X}=await pt(n.identity,x.usdCents,M,C);u.push({salt:Q.id,itemId:x.item.id}),y.push(x.acquisition==="store"?{kind:"store",item:{collection:x.item.contractAddress,itemId:String(x.item.itemId),priceWei:x.priceWei},credits:[Q],maxCreditedValue:X,chainId:x.item.chainId}:{kind:"trade",trade:x.trade,credits:[Q],maxCreditedValue:X})}catch(M){if(Ms(M)){if(u.length){try{await Re(n.identity,u.map(C=>C.salt))}catch(C){ae(C,{flow:"cart_checkout",step:"release"})}b.invalidateQueries({queryKey:["usd-balance"]})}Je(t);return}throw M}}h="submit";const g=hs(y).length,k=m=>g>1?{current:m,total:g}:void 0,F=(m,x)=>j({phase:"processing",stage:m,step:a.length,total:a.length,signatures:k(x)}),K=m=>m<g?F("awaiting-signature",m+1):F("settling",g);F("awaiting-signature",1);let f=[];const v=y.some(m=>m.kind==="store"),N=y.flatMap(m=>m.kind==="trade"?[m]:[]);if(ps()&&!v)try{const m=new Map;f=await bs({purchases:N,buyer:n.address,signer:n.signer,onSigned:()=>K(g),onBroadcast:({txHash:C,salts:Q})=>{m.set(C,Q),Q.forEach(X=>w.add(X))}});const x=await Promise.allSettled(f.map(C=>vs(C)));x.forEach((C,Q)=>{const X=m.get(f[Q])??[];C.status==="fulfilled"?(X.forEach(Be=>S.add(Be)),E.push(f[Q])):C.reason instanceof vt||X.forEach(Be=>R.add(Be))});const M=x.flatMap(C=>C.status==="rejected"?[C.reason]:[]);if(M.length&&!M.some(C=>C instanceof vt))throw M[0];q=!0}catch(m){if(!(m instanceof ws))throw m;f=await Le({purchases:y,buyer:n.address,signer:n.signer,onSigned:K,onBroadcast:({salts:x})=>x.forEach(M=>w.add(M)),onSettled:({txHash:x,salts:M})=>{M.forEach(C=>S.add(C)),E.push(x)},onReverted:({salts:x})=>x.forEach(M=>R.add(M))})}else f=await Le({purchases:y,buyer:n.address,signer:n.signer,onSigned:K,onBroadcast:({salts:m})=>m.forEach(x=>w.add(x)),onSettled:({txHash:m,salts:x})=>{x.forEach(M=>S.add(M)),E.push(m)},onReverted:({salts:m})=>m.forEach(x=>R.add(x))});t.forEach(m=>l(m.item.id)),O(null),G("Shop Completed Purchase",{...ye(d),payment_type:"credits",no_crypto_step:q,transaction_hash:f[0]??null}),bt(b);const ce=oe.current;oe.current=null,j(null),_(!1);const _e={items:c,txHash:f[0]??void 0,txHashes:f,settled:!0,...ce?{creditsAdded:ce}:{}};ee("/success",{state:_e,replace:!0})}catch(y){be(y)||ae(y,{flow:"cart_checkout",step:h,cart_size:t.length});const g=new Set([...w].filter(v=>!R.has(v))),{toRelease:k,boughtItemIds:F}=wt({reservations:u,spent:g,settled:S}),K=d.filter(v=>F.includes(v.id)),f=d.filter(v=>!F.includes(v.id));if(G(be(y)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:h,error_code:gt(y),value_usd:ut(f.reduce((v,N)=>v+N.priceCredits,0)),cart_size:a.length,partial:K.length>0}),k.length)try{await Re(n.identity,k)}catch(v){ae(v,{flow:"cart_checkout",step:"release"})}if(b.invalidateQueries({queryKey:["usd-balance"]}),K.length>0){F.forEach(v=>l(v)),O(null),bt(b),G("Shop Completed Purchase",{...ye(K),payment_type:"credits",no_crypto_step:q,transaction_hash:E[0]??null,partial:!0}),j({phase:"error",message:s("cart.error.partiallyBought")}),_(!1);return}j({phase:"error",message:Ke(y)})}}function Xe(t,a){b.invalidateQueries({queryKey:["usd-balance"]}),b.invalidateQueries({queryKey:["detail-trade"]}),b.invalidateQueries({queryKey:["shop-item"]}),b.invalidateQueries({queryKey:["owned-token"]}),b.invalidateQueries({queryKey:["public-token"]}),b.invalidateQueries({queryKey:["item-resales"]}),b.invalidateQueries({queryKey:["shop-items"]}),b.invalidateQueries({queryKey:["catalog-items"]}),b.invalidateQueries({queryKey:["my-assets"]}),b.invalidateQueries({queryKey:["purchases"]}),b.invalidateQueries({queryKey:["owned-item-count"]}),b.invalidateQueries({queryKey:["overview-listings"]}),b.invalidateQueries({queryKey:["upsell-listings"]});const d=oe.current;oe.current=null,j(null),_(!1);const c={items:t,txHash:a[0]??void 0,txHashes:a,settled:!0,...d?{creditsAdded:d}:{}};ee("/success",{state:c,replace:!0})}function Ze(t,a){be(t)||ae(t,{flow:a,step:"submit"}),G(be(t)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:gt(t)}),j({phase:"error",message:Ke(t)}),_(!1)}async function Yt(t,a){const d=ve(We.MANAToken,a),c=ve(We.CreditsManager,a);await fs({auth:{kind:ys.Allowance,contractAddress:d.address,spenderAddress:c.address,chainId:a},signer:t})}async function et(){if(re)return re;try{return await b.fetchQuery({queryKey:["mana-rate",ht.chainId],queryFn:()=>us(ht.chainId),staleTime:6e4})}catch{return}}async function Jt(t){const a=je(t).reduce((h,w)=>h+w.usdCents,0),c=(pe??0n)>0n?await et():re,u=c?Ct(a,c):0n;return{totalCents:a,manaWei:u}}async function tt(t,a){const d=Ne(t),{totalCents:c,manaWei:u}=await Jt(t),h=Fe({priceCents:c,priceManaWei:u,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n}),w=Ot(t)?{...h,options:h.options.filter(S=>S.method==="credits")}:h;if(a&&w.options.some(S=>S.method===a)){if(a==="credits"){Ee(t);return}const{spender:S,chainId:R}=at(a,t);await st(S,R,()=>a==="mana"?void nt(t):void it(t,c,u));return}if(w.options.some(S=>S.method==="mana"||S.method==="combined")){j({phase:"choose",lines:t,totalCents:c,manaWei:u}),_(!1);return}if($!=null&&$.credits<d){Je(t);return}Ee(t)}function Xt(t){return Fe({priceCents:t.totalCents,priceManaWei:t.manaWei,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n})}const[qe,fe]=P.useState(null);function at(t,a){const d=Ae(a)[0].trade;return{spender:t==="mana"?ve(ya(d.contract),d.chainId).address:ve(We.CreditsManager,d.chainId).address,chainId:d.chainId}}async function st(t,a,d){const c=gs(a,t),u=n?await xs(c,n.address).catch(()=>!0):!0;if(ms(n==null?void 0:n.providerType,u)){_(!1),fe({auth:c,run:d});return}d()}function Zt(t){if((p==null?void 0:p.phase)!=="choose")return;const{lines:a,totalCents:d,manaWei:c}=p;if(t==="credits"){Ee(a);return}const{spender:u,chainId:h}=at(t,a);st(u,h,()=>t==="mana"?void nt(a):void it(a,d,c))}async function nt(t){if(!n||t.length===0)return;const a=je(t),d=a.map(h=>({...h.item,priceCredits:h.priceCredits})),c=t.map(h=>({...h.item,priceCredits:h.priceCredits,quantity:h.quantity})),u=()=>j({phase:"processing",stage:"settling",step:a.length,total:a.length});j({phase:"processing",stage:"awaiting-signature",step:a.length,total:a.length});try{const h=await rs({trades:Ae(a).map(w=>w.trade),buyer:n.address,signer:n.signer,onSigned:u});t.forEach(w=>l(w.item.id)),O(null),G("Shop Completed Purchase",{...ye(d),payment_type:"mana",transaction_hash:h[0]??null}),b.invalidateQueries({queryKey:["mana-balance"]}),Xe(c,h)}catch(h){Ze(h,"buy_cart_mana")}}async function it(t,a,d){if(!n||t.length===0)return;const c=je(t),u=c.map(g=>({...g.item,priceCredits:g.priceCredits})),h=t.map(g=>({...g.item,priceCredits:g.priceCredits,quantity:g.quantity})),w=os(c.map(g=>g.usdCents),($==null?void 0:$.balanceCents)??0),S=w.reduce((g,k)=>g+k,0),R=cs(Math.max(0,a-S),a,d),E=[],q=new Set,y=new Set;j({phase:"processing",stage:"reserving",step:1,total:c.length});try{const g=Ae(c),k=[];for(let f=0;f<g.length;f++){const v=w[f];if(v<=0)continue;j({phase:"processing",stage:"reserving",step:f+1,total:g.length});const N=g[f].item,{credit:ce,maxCreditedValue:_e}=await pt(n.identity,v,g[f].trade.id,N.contractAddress&&N.itemId!=null?{contractAddress:N.contractAddress,itemId:String(N.itemId)}:void 0);E.push({salt:ce.id,itemId:N.id}),k.push({kind:"trade",trade:g[f].trade,credits:[ce],maxCreditedValue:_e})}g.forEach((f,v)=>{w[v]<=0&&k.push({kind:"trade",trade:f.trade,credits:[],maxCreditedValue:"0"})}),k[0]={...k[0],maxCreditedValue:(BigInt(k[0].maxCreditedValue)+R).toString()},await Yt(n.signer,g[0].trade.chainId);const F=()=>j({phase:"processing",stage:"settling",step:c.length,total:c.length});j({phase:"processing",stage:"awaiting-signature",step:c.length,total:c.length});const K=await Le({purchases:k,buyer:n.address,signer:n.signer,onSigned:F,onBroadcast:({salts:f})=>f.forEach(v=>q.add(v)),onReverted:({salts:f})=>f.forEach(v=>y.add(v))});t.forEach(f=>l(f.item.id)),O(null),G("Shop Completed Purchase",{...ye(u),payment_type:"credits_and_mana",transaction_hash:K[0]??null}),b.invalidateQueries({queryKey:["mana-balance"]}),Xe(h,K)}catch(g){const{toRelease:k}=wt({reservations:E,spent:new Set([...q].filter(F=>!y.has(F))),settled:new Set});k.length&&Re(n.identity,k).catch(()=>{}),E.length&&b.invalidateQueries({queryKey:["usd-balance"]}),Ze(g,"buy_cart_combined")}}async function te(t){if(!n){yt({type:"cart-checkout"}),L();return}const a=U.getState().items.filter(Ge);if(a.length===0)return;ie(null),he(null),_(!0);const d=a.reduce((c,u)=>c+u.priceCredits*u.quantity,0);G("Shop Started Checkout",{cart_size:a.length,cart_value_credits:d,cart_value_usd:ut(d),has_sufficient_credits:ge>=d});try{const c=await ks(a,n.address,Vt,await et(),Gt),u=[...c.unavailable,...c.own];if(u.length&&(u.forEach(h=>l(h.id)),he(qn(c))),c.buyable.length===0){ie(s("cart.error.noneAvailable")),O(null);return}if(c.orderChanged){O(c),He.current=Date.now();return}await tt(c.buyable,t)}catch(c){ae(c,{flow:"cart_checkout",step:"review",cart_size:a.length}),ie(Ke(c))}finally{_(!1)}}async function rt(){if(B){if(!n){yt({type:"cart-checkout"}),L();return}if(Date.now()-He.current>En){O(null),he(null),await te();return}ie(null),tt(B.buyable)}}async function ea(){if(Te){try{sessionStorage.setItem(we,JSON.stringify(U.getState().items))}catch{}_(!0);try{const t=await $s(Te,n?{address:n.address,identity:n.identity}:void 0);if(t.url){window.location.href=t.url;return}ee("/credits")}catch(t){try{sessionStorage.removeItem(we)}catch{}ae(t,{flow:"cart_buy_credits"}),j({phase:"error",message:s("buyModal.error.creditsCheckout")})}finally{_(!1)}}}const ot=P.useRef(!1);P.useEffect(()=>{if(!n||ot.current||!as("cart-checkout"))return;ot.current=!0;const t=setTimeout(()=>void te(),0);return()=>clearTimeout(t)},[n]);const ct=P.useRef(!1);P.useEffect(()=>{if(!(J!=null&&J.resumeCheckout)||ct.current)return;ct.current=!0,oe.current=J.creditsAdded??null;try{const a=sessionStorage.getItem(we);if(a){sessionStorage.removeItem(we);const d=JSON.parse(a);Array.isArray(d)&&d.length&&D(d)}}catch{}b.invalidateQueries({queryKey:["usd-balance"]});const t=setTimeout(()=>void te(),0);return()=>clearTimeout(t)},[J==null?void 0:J.resumeCheckout]);const V=Ft||(p==null?void 0:p.phase)==="processing";return o.length===0&&!p?e.jsx(jt,{children:e.jsxs($t,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(H,{name:"arrow-left"}),s("nav.cart")]}),e.jsxs(Ns,{"data-testid":"cart-empty",children:[e.jsx(H,{name:"cart-plus",size:110}),e.jsxs(Qs,{children:[e.jsx(Us,{children:s("cart.empty.title")}),e.jsx(Hs,{children:s("cart.empty.body")})]}),e.jsx(Os,{to:"/items",children:s("cart.empty.cta")})]})]})}):e.jsxs(jt,{children:[e.jsxs($t,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(H,{name:"arrow-left"}),s("nav.cart")]}),e.jsxs(Fs,{children:[e.jsxs(Ls,{children:[e.jsxs(Ks,{children:[e.jsx(Vs,{onClick:()=>ee(-1),type:"button","aria-label":s("cart.goBack"),children:e.jsx(H,{name:"arrow-left"})}),e.jsx(Gs,{children:s("cart.panelTitle",{count:Kt})}),Rt?e.jsxs(Ds,{onClick:()=>Y(!0),disabled:V,children:[e.jsx(H,{name:"fitting-room"}),s("cart.fittingRoom")]}):null]}),e.jsxs(At,{children:[e.jsx(Ys,{children:o.map(t=>{const a=Ut.get(t.id),d=a?a.priceCredits:t.priceCredits,c=!!a&&a.priceCredits!==t.priceCredits,u=!t.tokenId,h=t.quantity,w=typeof t.available=="number"&&h>=t.available,S=d*h,R=ha(t),E=!!R&&!!A[R],q=pa(t),y=Ve[t.id],g=!lt(y),k=y==="sold-out"?s("cart.availability.soldOut"):s("cart.availability.unavailable");return e.jsxs(Js,{"data-unavailable":g||void 0,children:[e.jsxs(Xs,{"data-thumb":!0,children:[q?e.jsx(Zs,{to:q,state:{item:t,tradeId:t.tradeId},"aria-label":t.name,children:t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:t.name}):null}):t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:t.name}):null,e.jsx(en,{"data-check":!0,"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(tn,{children:[e.jsxs(an,{"data-desc":!0,children:[q?e.jsx(nn,{to:q,state:{item:t,tradeId:t.tradeId},title:t.name,children:t.name}):e.jsx(sn,{title:t.name,children:t.name}),t.creator?e.jsx(rn,{address:t.creator,linkToProfile:!0}):null,Bt&&u?e.jsxs(fn,{"data-testid":"cart-creator-tag",children:[e.jsx(yn,{name:"buy-from-creator"}),s("cart.creatorTag")]}):null]}),e.jsx(on,{children:g?e.jsxs(e.Fragment,{children:[e.jsxs(gn,{children:[e.jsx(xn,{name:"warning-fill",size:24}),k]}),q?e.jsx(mn,{to:q,state:{item:t,tradeId:t.tradeId},children:s("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[u?e.jsxs(cn,{children:[e.jsx(St,{onClick:()=>me(()=>z(t.id)),disabled:V||h<=1,"aria-label":s("cart.decreaseQuantity",{name:t.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(dn,{children:h}),e.jsx(St,{onClick:()=>me(()=>I(t.id)),disabled:V||w,"aria-label":s("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(ln,{children:[e.jsx(un,{})," ",S,c?e.jsx(hn,{children:t.priceCredits*h}):null]})]})})]}),e.jsxs(pn,{children:[R?e.jsx(bn,{"data-on":E||void 0,onClick:()=>ne(t),"aria-label":E?s("cart.removeFromFavorites",{name:t.name}):s("cart.addToFavorites",{name:t.name}),title:E?s("assetCard.removeFromFavorites"):s("assetCard.addToFavorites"),children:e.jsx(H,{name:E?"heart-solid":"heart"})}):null,e.jsx(vn,{onClick:()=>me(()=>l(t.id)),disabled:V,"aria-label":s("cart.remove",{name:t.name}),title:s("cart.removeTitle"),children:e.jsx(H,{name:"trash",size:24})})]})]},t.id)})}),e.jsx(wn,{children:e.jsx("button",{className:"link",onClick:()=>me(W),disabled:V,children:s("cart.clearCart")})})]})]}),e.jsxs(Cn,{children:[e.jsx(jn,{children:s("cart.purchaseSummary")}),e.jsxs(kn,{children:[e.jsxs($n,{children:[e.jsx(Sn,{children:s("cart.totalItems",{count:Nt})}),e.jsx(Tn,{children:e.jsxs(Mn,{children:[e.jsx(In,{})," ",De]})})]}),xe.options.length>0||xe.manaShortfall?e.jsx(Tt,{options:xe.options,totalCents:ze,shortfall:xe.manaShortfall,creditsLabel:B?s("marketCheckout.confirmPurchase"):s("cart.buyWithCredits"),busy:V||Pe,onPay:t=>void(B?rt():te(t))}):e.jsx(Pn,{onClick:()=>void(B?rt():te()),disabled:V||Pe,children:V?s("cart.working"):B?s("marketCheckout.confirmPurchase"):s("cart.checkout")}),Pe?e.jsx(Ce,{className:"muted",children:s("cart.allUnavailable")}):null,n?null:e.jsx(Ce,{className:"muted",children:s("cart.signInHint")}),B?e.jsx(Ce,{className:"muted",children:s("cart.priceChanged")}):null,Ue?e.jsx(Ce,{className:"muted",children:Ue}):null,e.jsx(zn,{message:Wt})]})]})]})]}),Ye.length>0?e.jsx(An,{children:e.jsx(ss,{title:s("cart.youMightAlsoLike"),items:Ye})}):null,qe&&n?e.jsx(ns,{auth:qe.auth,signer:n.signer,title:s("authorizeStep.manaTitle"),name:s("authorizeStep.manaName"),reason:s("authorizeStep.manaReason"),icon:e.jsx("img",{src:is,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:t}=qe;fe(null),t()},onCancel:()=>fe(null),onClose:()=>fe(null)}):null,p?e.jsx(Bs,{phase:p.phase,balanceCredits:ge,onClose:Dt,stage:p.phase==="processing"?p.stage:void 0,step:p.phase==="processing"?p.step:void 0,total:p.phase==="processing"?p.total:void 0,isSelfCustody:ga(n==null?void 0:n.providerType),signatures:p.phase==="processing"?p.signatures:void 0,options:p.phase==="choose"?Xt(p).options:void 0,onPay:Zt,totalCents:p.phase==="choose"?p.totalCents:void 0,totalManaWei:p.phase==="choose"?p.manaWei:void 0,totalCredits:p.phase==="choose"?Ne(p.lines):void 0,lines:p.phase==="nofunds"?p.lines:void 0,shortfallCredits:p.phase==="nofunds"?p.shortfall:void 0,packs:ue,selectedPack:Te,onSelectPack:Oe,onBuyPacks:()=>void ea(),message:p.phase==="error"?p.message:void 0,onRetry:()=>void te()}):null]})}export{Xn as Cart};
|
|
695
|
+
`;function Ue(o){if($s(o))return s("errors.rejected");const l=(o.message??"").toLowerCase();return l.includes("insufficient")?s("cart.error.insufficient",{currency:va.name}):l.includes("no active listing")||l.includes("your own listing")?s("cart.error.listingChanged"):s("marketCheckout.error.generic")}const En=12e4;function qn(o){const l=[];return o.unavailable.length&&l.push(s("cart.drop.unavailable",{count:o.unavailable.length})),o.own.length&&l.push(s("cart.drop.own",{count:o.own.length})),s("cart.drop.removed",{items:l.join(` ${s("cart.drop.and")} `)})}const Ke=o=>o.reduce((l,I)=>l+I.priceCredits*I.quantity,0),je=o=>o.flatMap(l=>Array.from({length:l.quantity},()=>({...l,quantity:1})));function Yn(){ia({title:s("nav.cart"),noindex:!0});const o=N(t=>t.items),l=N(t=>t.remove),I=N(t=>t.increment),z=N(t=>t.decrement),W=N(t=>t.clear),D=N(t=>t.restore),Y=N(t=>t.setFittingOpen),A=dt(t=>t.items),ne=dt(t=>t.toggle),{session:n,signIn:L}=ra(),Rt=oa(),ue=Cs().packs.slice(0,js);P.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const _t=o.some(t=>t.category!=="emote"),{data:Me}=ca({queryKey:["upsell-listings"],queryFn:()=>Ca({first:40}),staleTime:6e4}),{data:S}=da(n),b=la(),ee=ta(),{state:J}=aa(),[Wt,ie]=P.useState(null),[Ne,he]=P.useState(null),[Ft,B]=P.useState(!1),[R,O]=P.useState(null),He=P.useRef(0),[p,j]=P.useState(null),{data:pe}=ua(n),{data:re}=ha(!0),[Te,Oe]=P.useState(""),oe=P.useRef(null),Ve=pa(o),Ge=t=>ut(Ve[t.id]),Ie=o.filter(Ge),Pe=o.length>0&&Ie.length===0,Lt=Ie.reduce((t,a)=>t+a.priceCredits*a.quantity,0),Ut=o.reduce((t,a)=>t+a.quantity,0),Kt=Ie.reduce((t,a)=>t+a.quantity,0),De=R?R.liveTotalCredits:Lt,Qt=new Set(o.map(t=>t.id)),Ye=((Me==null?void 0:Me.items)??[]).filter(t=>!Qt.has(t.id)).slice(0,12),Nt=new Map(R==null?void 0:R.buyable.map(t=>[t.item.id,t])),ge=(S==null?void 0:S.credits)??0,ze=De*10,Ht=re?lt(ze,re):0n,xe=Fe({priceCents:ze,priceManaWei:Ht,balanceCents:(S==null?void 0:S.balanceCents)??0,manaBalanceWei:pe??0n}),Ot=t=>t.some(a=>a.acquisition==="store"),Ae=t=>t.flatMap(a=>a.acquisition==="trade"?[a]:[]),Vt=fa,Gt=t=>ba(t.contractAddress,String(t.itemId));function me(t){t(),O(null),he(null),ie(null)}function Dt(){j(null),B(!1)}function Je(t){const a=Ke(t),d=Math.max(0,a-ge),c=ue.find(u=>u.credits>=d)??ue[ue.length-1];Oe(c.id),G("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:a,credits_balance:ge,shortfall:d}),j({phase:"nofunds",lines:t.map(u=>({item:u.item,priceCredits:u.priceCredits,quantity:u.quantity})),shortfall:d}),B(!1)}async function Ee(t){if(!n||t.length===0)return;const a=je(t),d=a.map(y=>({...y.item,priceCredits:y.priceCredits})),c=t.map(y=>({...y.item,priceCredits:y.priceCredits,quantity:y.quantity})),u=[];let h="authorize";const w=new Set,$=new Set,_=new Set,E=[];let q=!1;j({phase:"processing",stage:"reserving",step:1,total:a.length});try{const y=[];for(let m=0;m<a.length;m++){const x=a[m];j({phase:"processing",stage:"reserving",step:m+1,total:a.length});try{const M=x.acquisition==="trade"?x.trade.id:void 0,C=x.item.contractAddress&&x.item.itemId!=null?{contractAddress:x.item.contractAddress,itemId:String(x.item.itemId)}:void 0,{credit:Q,maxCreditedValue:X}=await gt(n.identity,x.usdCents,M,C);u.push({salt:Q.id,itemId:x.item.id}),y.push(x.acquisition==="store"?{kind:"store",item:{collection:x.item.contractAddress,itemId:String(x.item.itemId),priceWei:x.priceWei},credits:[Q],maxCreditedValue:X,chainId:x.item.chainId}:{kind:"trade",trade:x.trade,credits:[Q],maxCreditedValue:X})}catch(M){if(Ms(M)){if(u.length){try{await _e(n.identity,u.map(C=>C.salt))}catch(C){ae(C,{flow:"cart_checkout",step:"release"})}b.invalidateQueries({queryKey:["usd-balance"]})}Je(t);return}throw M}}h="submit";const g=ys(y).length,k=m=>g>1?{current:m,total:g}:void 0,F=(m,x)=>j({phase:"processing",stage:m,step:a.length,total:a.length,signatures:k(x)}),U=m=>m<g?F("awaiting-signature",m+1):F("settling",g);F("awaiting-signature",1);let f=[];const v=y.some(m=>m.kind==="store"),K=y.flatMap(m=>m.kind==="trade"?[m]:[]);if(hs()&&!v)try{const m=new Map;f=await bs({purchases:K,buyer:n.address,signer:n.signer,onSigned:()=>U(g),onBroadcast:({txHash:C,salts:Q})=>{m.set(C,Q),Q.forEach(X=>w.add(X))}});const x=await Promise.allSettled(f.map(C=>vs(C)));x.forEach((C,Q)=>{const X=m.get(f[Q])??[];C.status==="fulfilled"?(X.forEach(Re=>$.add(Re)),E.push(f[Q])):C.reason instanceof wt||X.forEach(Re=>_.add(Re))});const M=x.flatMap(C=>C.status==="rejected"?[C.reason]:[]);if(M.length&&!M.some(C=>C instanceof wt))throw M[0];q=!0}catch(m){if(!(m instanceof ws))throw m;f=await Le({purchases:y,buyer:n.address,signer:n.signer,onSigned:U,onBroadcast:({salts:x})=>x.forEach(M=>w.add(M)),onSettled:({txHash:x,salts:M})=>{M.forEach(C=>$.add(C)),E.push(x)},onReverted:({salts:x})=>x.forEach(M=>_.add(M))})}else f=await Le({purchases:y,buyer:n.address,signer:n.signer,onSigned:U,onBroadcast:({salts:m})=>m.forEach(x=>w.add(x)),onSettled:({txHash:m,salts:x})=>{x.forEach(M=>$.add(M)),E.push(m)},onReverted:({salts:m})=>m.forEach(x=>_.add(x))});t.forEach(m=>l(m.item.id)),O(null),G("Shop Completed Purchase",{...ye(d),payment_type:"credits",no_crypto_step:q,transaction_hash:f[0]??null}),vt(b);const ce=oe.current;oe.current=null,j(null),B(!1);const Be={items:c,txHash:f[0]??void 0,txHashes:f,settled:!0,...ce?{creditsAdded:ce}:{}};ee("/success",{state:Be,replace:!0})}catch(y){be(y)||ae(y,{flow:"cart_checkout",step:h,cart_size:t.length});const g=new Set([...w].filter(v=>!_.has(v))),{toRelease:k,boughtItemIds:F}=Ct({reservations:u,spent:g,settled:$}),U=d.filter(v=>F.includes(v.id)),f=d.filter(v=>!F.includes(v.id));if(G(be(y)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:h,error_code:xt(y),value_usd:ht(f.reduce((v,K)=>v+K.priceCredits,0)),cart_size:a.length,partial:U.length>0}),k.length)try{await _e(n.identity,k)}catch(v){ae(v,{flow:"cart_checkout",step:"release"})}if(b.invalidateQueries({queryKey:["usd-balance"]}),U.length>0){F.forEach(v=>l(v)),O(null),vt(b),G("Shop Completed Purchase",{...ye(U),payment_type:"credits",no_crypto_step:q,transaction_hash:E[0]??null,partial:!0}),j({phase:"error",message:s("cart.error.partiallyBought")}),B(!1);return}j({phase:"error",message:Ue(y)})}}function Xe(t,a){b.invalidateQueries({queryKey:["usd-balance"]}),b.invalidateQueries({queryKey:["detail-trade"]}),b.invalidateQueries({queryKey:["shop-item"]}),b.invalidateQueries({queryKey:["owned-token"]}),b.invalidateQueries({queryKey:["public-token"]}),b.invalidateQueries({queryKey:["item-resales"]}),b.invalidateQueries({queryKey:["shop-items"]}),b.invalidateQueries({queryKey:["catalog-items"]}),b.invalidateQueries({queryKey:["my-assets"]}),b.invalidateQueries({queryKey:["purchases"]}),b.invalidateQueries({queryKey:["owned-item-count"]}),b.invalidateQueries({queryKey:["overview-listings"]}),b.invalidateQueries({queryKey:["upsell-listings"]});const d=oe.current;oe.current=null,j(null),B(!1);const c={items:t,txHash:a[0]??void 0,txHashes:a,settled:!0,...d?{creditsAdded:d}:{}};ee("/success",{state:c,replace:!0})}function Ze(t,a){be(t)||ae(t,{flow:a,step:"submit"}),G(be(t)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:xt(t)}),j({phase:"error",message:Ue(t)}),B(!1)}async function Yt(t,a){const d=ve(We.MANAToken,a),c=ve(We.CreditsManager,a);await ms({auth:{kind:fs.Allowance,contractAddress:d.address,spenderAddress:c.address,chainId:a},signer:t})}async function et(){if(re)return re;try{return await b.fetchQuery({queryKey:["mana-rate",pt.chainId],queryFn:()=>ya(pt.chainId),staleTime:6e4})}catch{return}}async function Jt(t){const a=je(t).reduce((h,w)=>h+w.usdCents,0),c=(pe??0n)>0n?await et():re,u=c?lt(a,c):0n;return{totalCents:a,manaWei:u}}async function tt(t,a){const d=Ke(t),{totalCents:c,manaWei:u}=await Jt(t),h=Fe({priceCents:c,priceManaWei:u,balanceCents:(S==null?void 0:S.balanceCents)??0,manaBalanceWei:pe??0n}),w=Ot(t)?{...h,options:h.options.filter($=>$.method==="credits")}:h;if(a&&w.options.some($=>$.method===a)){if(a==="credits"){Ee(t);return}const{spender:$,chainId:_}=at(a,t);await st($,_,()=>a==="mana"?void nt(t):void it(t,c,u));return}if(w.options.some($=>$.method==="mana"||$.method==="combined")){j({phase:"choose",lines:t,totalCents:c,manaWei:u}),B(!1);return}if(S!=null&&S.credits<d){Je(t);return}Ee(t)}function Xt(t){return Fe({priceCents:t.totalCents,priceManaWei:t.manaWei,balanceCents:(S==null?void 0:S.balanceCents)??0,manaBalanceWei:pe??0n})}const[qe,fe]=P.useState(null);function at(t,a){const d=Ae(a)[0].trade;return{spender:t==="mana"?ve(wa(d.contract),d.chainId).address:ve(We.CreditsManager,d.chainId).address,chainId:d.chainId}}async function st(t,a,d){const c=ps(a,t),u=n?await gs(c,n.address).catch(()=>!0):!0;if(xs(n==null?void 0:n.providerType,u)){B(!1),fe({auth:c,run:d});return}d()}function Zt(t){if((p==null?void 0:p.phase)!=="choose")return;const{lines:a,totalCents:d,manaWei:c}=p;if(t==="credits"){Ee(a);return}const{spender:u,chainId:h}=at(t,a);st(u,h,()=>t==="mana"?void nt(a):void it(a,d,c))}async function nt(t){if(!n||t.length===0)return;const a=je(t),d=a.map(h=>({...h.item,priceCredits:h.priceCredits})),c=t.map(h=>({...h.item,priceCredits:h.priceCredits,quantity:h.quantity})),u=()=>j({phase:"processing",stage:"settling",step:a.length,total:a.length});j({phase:"processing",stage:"awaiting-signature",step:a.length,total:a.length});try{const h=await ds({trades:Ae(a).map(w=>w.trade),buyer:n.address,signer:n.signer,onSigned:u});t.forEach(w=>l(w.item.id)),O(null),G("Shop Completed Purchase",{...ye(d),payment_type:"mana",transaction_hash:h[0]??null}),b.invalidateQueries({queryKey:["mana-balance"]}),Xe(c,h)}catch(h){Ze(h,"buy_cart_mana")}}async function it(t,a,d){if(!n||t.length===0)return;const c=je(t),u=c.map(g=>({...g.item,priceCredits:g.priceCredits})),h=t.map(g=>({...g.item,priceCredits:g.priceCredits,quantity:g.quantity})),w=ls(c.map(g=>g.usdCents),(S==null?void 0:S.balanceCents)??0),$=w.reduce((g,k)=>g+k,0),_=us(Math.max(0,a-$),a,d),E=[],q=new Set,y=new Set;j({phase:"processing",stage:"reserving",step:1,total:c.length});try{const g=Ae(c),k=[];for(let f=0;f<g.length;f++){const v=w[f];if(v<=0)continue;j({phase:"processing",stage:"reserving",step:f+1,total:g.length});const K=g[f].item,{credit:ce,maxCreditedValue:Be}=await gt(n.identity,v,g[f].trade.id,K.contractAddress&&K.itemId!=null?{contractAddress:K.contractAddress,itemId:String(K.itemId)}:void 0);E.push({salt:ce.id,itemId:K.id}),k.push({kind:"trade",trade:g[f].trade,credits:[ce],maxCreditedValue:Be})}g.forEach((f,v)=>{w[v]<=0&&k.push({kind:"trade",trade:f.trade,credits:[],maxCreditedValue:"0"})}),k[0]={...k[0],maxCreditedValue:(BigInt(k[0].maxCreditedValue)+_).toString()},await Yt(n.signer,g[0].trade.chainId);const F=()=>j({phase:"processing",stage:"settling",step:c.length,total:c.length});j({phase:"processing",stage:"awaiting-signature",step:c.length,total:c.length});const U=await Le({purchases:k,buyer:n.address,signer:n.signer,onSigned:F,onBroadcast:({salts:f})=>f.forEach(v=>q.add(v)),onReverted:({salts:f})=>f.forEach(v=>y.add(v))});t.forEach(f=>l(f.item.id)),O(null),G("Shop Completed Purchase",{...ye(u),payment_type:"credits_and_mana",transaction_hash:U[0]??null}),b.invalidateQueries({queryKey:["mana-balance"]}),Xe(h,U)}catch(g){const{toRelease:k}=Ct({reservations:E,spent:new Set([...q].filter(F=>!y.has(F))),settled:new Set});k.length&&_e(n.identity,k).catch(()=>{}),E.length&&b.invalidateQueries({queryKey:["usd-balance"]}),Ze(g,"buy_cart_combined")}}async function te(t){if(!n){bt({type:"cart-checkout"}),L();return}const a=N.getState().items.filter(Ge);if(a.length===0)return;ie(null),he(null),B(!0);const d=a.reduce((c,u)=>c+u.priceCredits*u.quantity,0);G("Shop Started Checkout",{cart_size:a.length,cart_value_credits:d,cart_value_usd:ht(d),has_sufficient_credits:ge>=d});try{const c=await ks(a,n.address,Vt,await et(),Gt),u=[...c.unavailable,...c.own];if(u.length&&(u.forEach(h=>l(h.id)),he(qn(c))),c.buyable.length===0){ie(s("cart.error.noneAvailable")),O(null);return}if(c.orderChanged){O(c),He.current=Date.now();return}await tt(c.buyable,t)}catch(c){ae(c,{flow:"cart_checkout",step:"review",cart_size:a.length}),ie(Ue(c))}finally{B(!1)}}async function rt(){if(R){if(!n){bt({type:"cart-checkout"}),L();return}if(Date.now()-He.current>En){O(null),he(null),await te();return}ie(null),tt(R.buyable)}}async function ea(){if(Te){try{sessionStorage.setItem(we,JSON.stringify(N.getState().items))}catch{}B(!0);try{const t=await Ss(Te,n?{address:n.address,identity:n.identity}:void 0);if(t.url){window.location.href=t.url;return}ee("/credits")}catch(t){try{sessionStorage.removeItem(we)}catch{}ae(t,{flow:"cart_buy_credits"}),j({phase:"error",message:s("buyModal.error.creditsCheckout")})}finally{B(!1)}}}const ot=P.useRef(!1);P.useEffect(()=>{if(!n||ot.current||!is("cart-checkout"))return;ot.current=!0;const t=setTimeout(()=>void te(),0);return()=>clearTimeout(t)},[n]);const ct=P.useRef(!1);P.useEffect(()=>{if(!(J!=null&&J.resumeCheckout)||ct.current)return;ct.current=!0,oe.current=J.creditsAdded??null;try{const a=sessionStorage.getItem(we);if(a){sessionStorage.removeItem(we);const d=JSON.parse(a);Array.isArray(d)&&d.length&&D(d)}}catch{}b.invalidateQueries({queryKey:["usd-balance"]});const t=setTimeout(()=>void te(),0);return()=>clearTimeout(t)},[J==null?void 0:J.resumeCheckout]);const V=Ft||(p==null?void 0:p.phase)==="processing";return o.length===0&&!p?e.jsx(jt,{children:e.jsxs(St,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(H,{name:"arrow-left"}),s("nav.cart")]}),e.jsxs(Ks,{"data-testid":"cart-empty",children:[e.jsx(H,{name:"cart-plus",size:110}),e.jsxs(Qs,{children:[e.jsx(Ns,{children:s("cart.empty.title")}),e.jsx(Hs,{children:s("cart.empty.body")})]}),e.jsx(Os,{to:"/items",children:s("cart.empty.cta")})]})]})}):e.jsxs(jt,{children:[e.jsxs(St,{children:[e.jsxs(kt,{onClick:()=>ee(-1),type:"button",children:[e.jsx(H,{name:"arrow-left"}),s("nav.cart")]}),e.jsxs(Fs,{children:[e.jsxs(Ls,{children:[e.jsxs(Us,{children:[e.jsx(Vs,{onClick:()=>ee(-1),type:"button","aria-label":s("cart.goBack"),children:e.jsx(H,{name:"arrow-left"})}),e.jsx(Gs,{children:s("cart.panelTitle",{count:Ut})}),_t?e.jsxs(Ds,{onClick:()=>Y(!0),disabled:V,children:[e.jsx(H,{name:"fitting-room"}),s("cart.fittingRoom")]}):null]}),e.jsxs(At,{children:[e.jsx(Ys,{children:o.map(t=>{const a=Nt.get(t.id),d=a?a.priceCredits:t.priceCredits,c=!!a&&a.priceCredits!==t.priceCredits,u=!t.tokenId,h=t.quantity,w=typeof t.available=="number"&&h>=t.available,$=d*h,_=ga(t),E=!!_&&!!A[_],q=xa(t),y=Ve[t.id],g=!ut(y),k=y==="sold-out"?s("cart.availability.soldOut"):s("cart.availability.unavailable");return e.jsxs(Js,{"data-unavailable":g||void 0,children:[e.jsxs(Xs,{"data-thumb":!0,children:[q?e.jsx(Zs,{to:q,state:{item:t,tradeId:t.tradeId},"aria-label":t.name,children:t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:t.name}):null}):t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:t.name}):null,e.jsx(en,{"data-check":!0,"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(tn,{children:[e.jsxs(an,{"data-desc":!0,children:[q?e.jsx(nn,{to:q,state:{item:t,tradeId:t.tradeId},title:t.name,children:t.name}):e.jsx(sn,{title:t.name,children:t.name}),t.creator?e.jsx(rn,{address:t.creator,linkToProfile:!0}):null,Rt&&u?e.jsxs(fn,{"data-testid":"cart-creator-tag",children:[e.jsx(yn,{name:"buy-from-creator"}),s("cart.creatorTag")]}):null]}),e.jsx(on,{children:g?e.jsxs(e.Fragment,{children:[e.jsxs(gn,{children:[e.jsx(xn,{name:"warning-fill",size:24}),k]}),q?e.jsx(mn,{to:q,state:{item:t,tradeId:t.tradeId},children:s("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[u?e.jsxs(cn,{children:[e.jsx($t,{onClick:()=>me(()=>z(t.id)),disabled:V||h<=1,"aria-label":s("cart.decreaseQuantity",{name:t.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(dn,{children:h}),e.jsx($t,{onClick:()=>me(()=>I(t.id)),disabled:V||w,"aria-label":s("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(ln,{children:[e.jsx(un,{})," ",$,c?e.jsx(hn,{children:t.priceCredits*h}):null]})]})})]}),e.jsxs(pn,{children:[_?e.jsx(bn,{"data-on":E||void 0,onClick:()=>ne(t),"aria-label":E?s("cart.removeFromFavorites",{name:t.name}):s("cart.addToFavorites",{name:t.name}),title:E?s("assetCard.removeFromFavorites"):s("assetCard.addToFavorites"),children:e.jsx(H,{name:E?"heart-solid":"heart"})}):null,e.jsx(vn,{onClick:()=>me(()=>l(t.id)),disabled:V,"aria-label":s("cart.remove",{name:t.name}),title:s("cart.removeTitle"),children:e.jsx(H,{name:"trash",size:24})})]})]},t.id)})}),e.jsx(wn,{children:e.jsx("button",{className:"link",onClick:()=>me(W),disabled:V,children:s("cart.clearCart")})})]})]}),e.jsxs(Cn,{children:[e.jsx(jn,{children:s("cart.purchaseSummary")}),e.jsxs(kn,{children:[e.jsxs(Sn,{children:[e.jsx($n,{children:s("cart.totalItems",{count:Kt})}),e.jsx(Tn,{children:e.jsxs(Mn,{children:[e.jsx(In,{})," ",De]})})]}),xe.options.length>0||xe.manaShortfall?e.jsx(Tt,{options:xe.options,totalCents:ze,shortfall:xe.manaShortfall,creditsLabel:R?s("marketCheckout.confirmPurchase"):s("cart.buyWithCredits"),busy:V||Pe,onPay:t=>void(R?rt():te(t))}):e.jsx(Pn,{onClick:()=>void(R?rt():te()),disabled:V||Pe,children:V?s("cart.working"):R?s("marketCheckout.confirmPurchase"):s("cart.checkout")}),Pe?e.jsx(Ce,{className:"muted",children:s("cart.allUnavailable")}):null,n?null:e.jsx(Ce,{className:"muted",children:s("cart.signInHint")}),R?e.jsx(Ce,{className:"muted",children:s("cart.priceChanged")}):null,Ne?e.jsx(Ce,{className:"muted",children:Ne}):null,e.jsx(zn,{message:Wt})]})]})]})]}),Ye.length>0?e.jsx(An,{children:e.jsx(rs,{title:s("cart.youMightAlsoLike"),items:Ye})}):null,qe&&n?e.jsx(os,{auth:qe.auth,signer:n.signer,title:s("authorizeStep.manaTitle"),name:s("authorizeStep.manaName"),reason:s("authorizeStep.manaReason"),icon:e.jsx("img",{src:cs,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:t}=qe;fe(null),t()},onCancel:()=>fe(null),onClose:()=>fe(null)}):null,p?e.jsx(Rs,{phase:p.phase,balanceCredits:ge,onClose:Dt,stage:p.phase==="processing"?p.stage:void 0,step:p.phase==="processing"?p.step:void 0,total:p.phase==="processing"?p.total:void 0,isSelfCustody:ma(n==null?void 0:n.providerType),signatures:p.phase==="processing"?p.signatures:void 0,options:p.phase==="choose"?Xt(p).options:void 0,onPay:Zt,totalCents:p.phase==="choose"?p.totalCents:void 0,totalManaWei:p.phase==="choose"?p.manaWei:void 0,totalCredits:p.phase==="choose"?Ke(p.lines):void 0,lines:p.phase==="nofunds"?p.lines:void 0,shortfallCredits:p.phase==="nofunds"?p.shortfall:void 0,packs:ue,selectedPack:Te,onSelectPack:Oe,onBuyPacks:()=>void ea(),message:p.phase==="error"?p.message:void 0,onRetry:()=>void te()}):null]})}export{Yn as Cart};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a9 as N,aa as U,ab as o,ac as n,ad as D,q as M}from"./index-DaQaTpvn.js";import{r as w,j as g}from"./react-DehiWSvs.js";import{g as z,a as E,c as I,b as F,s as v}from"./clsx-Df3CFyaE.js";function K(r){return z("MuiCircularProgress",r)}E("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const W=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,b,S,$;const a=44,q=M(P||(P=l`
|
|
2
2
|
0% {
|
|
3
3
|
transform: rotate(0deg);
|
|
4
4
|
}
|
|
@@ -6,7 +6,7 @@ import{a7 as N,a8 as U,a9 as o,aa as n,ab as D,m as M}from"./index-BmdBaCyf.js";
|
|
|
6
6
|
100% {
|
|
7
7
|
transform: rotate(360deg);
|
|
8
8
|
}
|
|
9
|
-
`)),
|
|
9
|
+
`)),B=M(b||(b=l`
|
|
10
10
|
0% {
|
|
11
11
|
stroke-dasharray: 1px, 200px;
|
|
12
12
|
stroke-dashoffset: 0;
|
|
@@ -21,8 +21,8 @@ import{a7 as N,a8 as U,a9 as o,aa as n,ab as D,m as M}from"./index-BmdBaCyf.js";
|
|
|
21
21
|
stroke-dasharray: 100px, 200px;
|
|
22
22
|
stroke-dashoffset: -125px;
|
|
23
23
|
}
|
|
24
|
-
`)),
|
|
24
|
+
`)),G=r=>{const{classes:e,variant:s,color:t,disableShrink:d}=r,u={root:["root",s,`color${n(t)}`],svg:["svg"],circle:["circle",`circle${n(s)}`,d&&"circleDisableShrink"]};return F(u,K,e)},L=v("span",{name:"MuiCircularProgress",slot:"Root",overridesResolver:(r,e)=>{const{ownerState:s}=r;return[e.root,e[s.variant],e[`color${n(s.color)}`]]}})(({ownerState:r,theme:e})=>o({display:"inline-block"},r.variant==="determinate"&&{transition:e.transitions.create("transform")},r.color!=="inherit"&&{color:(e.vars||e).palette[r.color].main}),({ownerState:r})=>r.variant==="indeterminate"&&D(S||(S=l`
|
|
25
25
|
animation: ${0} 1.4s linear infinite;
|
|
26
|
-
`),
|
|
26
|
+
`),q)),V=v("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(r,e)=>e.svg})({display:"block"}),Z=v("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(r,e)=>{const{ownerState:s}=r;return[e.circle,e[`circle${n(s.variant)}`],s.disableShrink&&e.circleDisableShrink]}})(({ownerState:r,theme:e})=>o({stroke:"currentColor"},r.variant==="determinate"&&{transition:e.transitions.create("stroke-dashoffset")},r.variant==="indeterminate"&&{strokeDasharray:"80px, 200px",strokeDashoffset:0}),({ownerState:r})=>r.variant==="indeterminate"&&!r.disableShrink&&D($||($=l`
|
|
27
27
|
animation: ${0} 1.4s ease-in-out infinite;
|
|
28
|
-
`),
|
|
28
|
+
`),B)),O=w.forwardRef(function(e,s){const t=N({props:e,name:"MuiCircularProgress"}),{className:d,color:u="primary",disableShrink:R=!1,size:m=40,style:_,thickness:i=3.6,value:p=0,variant:k="indeterminate"}=t,j=U(t,W),c=o({},t,{color:u,disableShrink:R,size:m,thickness:i,value:p,variant:k}),f=G(c),h={},x={},y={};if(k==="determinate"){const C=2*Math.PI*((a-i)/2);h.strokeDasharray=C.toFixed(3),y["aria-valuenow"]=Math.round(p),h.strokeDashoffset=`${((100-p)/100*C).toFixed(3)}px`,x.transform="rotate(-90deg)"}return g.jsx(L,o({className:I(f.root,d),style:o({width:m,height:m},x,_),ownerState:c,ref:s,role:"progressbar"},y,j,{children:g.jsx(V,{className:f.svg,ownerState:c,viewBox:`${a/2} ${a/2} ${a} ${a}`,children:g.jsx(Z,{className:f.circle,style:h,ownerState:c,cx:a,cy:a,r:(a-i)/2,fill:"none",strokeWidth:i})})}))});export{O as C};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,r as h,u as
|
|
1
|
+
import{j as e,r as h,u as Z,d as J}from"./react-DehiWSvs.js";import{t as b,s,bi as ee,X as te,z as T,bj as ae,bk as oe,I as ie,d as a,c as re,D as se,o as ne,v as ce,e as le,ag as F,ah as de,bl as pe,bm as xe}from"./index-DaQaTpvn.js";import{E as me}from"./ErrorNotice-CfA5EQ3B.js";import{d as he,P as ue,C as ge,a as be,b as fe,A as ve}from"./collectionPage.styles-vmTcFGbQ.js";import{S as L,C as je,F as ye,c as we,P as Ce,d as $e,H as ke,e as Ne}from"./categories-BQKh49D5.js";import{L as Pe}from"./LoadMore-TnqPM5W_.js";import{u as Se}from"./useInfiniteGrid-XDOQyPRq.js";import{G as Ae}from"./grid.styles-BaFKxOV8.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";const Me=s.section`
|
|
2
2
|
position: relative;
|
|
3
3
|
border-radius: ${b.radius.card};
|
|
4
4
|
overflow: hidden;
|
|
@@ -11,20 +11,20 @@ import{j as e,r as h,u as J,d as X}from"./react-DehiWSvs.js";import{t as b,s,bd
|
|
|
11
11
|
${b.media.maxWidth("mobile")} {
|
|
12
12
|
min-height: 140px;
|
|
13
13
|
}
|
|
14
|
-
`,
|
|
14
|
+
`,ze=s.div`
|
|
15
15
|
position: absolute;
|
|
16
16
|
inset: 0;
|
|
17
17
|
z-index: 0;
|
|
18
|
-
`,
|
|
18
|
+
`,Ee=s.img`
|
|
19
19
|
width: 100%;
|
|
20
20
|
height: 100%;
|
|
21
21
|
object-fit: cover;
|
|
22
22
|
display: block;
|
|
23
|
-
`,
|
|
23
|
+
`,Re=s.div`
|
|
24
24
|
position: absolute;
|
|
25
25
|
inset: 0;
|
|
26
26
|
background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.55) 100%);
|
|
27
|
-
`,
|
|
27
|
+
`,Te=s.h1`
|
|
28
28
|
position: relative;
|
|
29
29
|
z-index: 1;
|
|
30
30
|
margin: 0;
|
|
@@ -42,7 +42,7 @@ import{j as e,r as h,u as J,d as X}from"./react-DehiWSvs.js";import{t as b,s,bd
|
|
|
42
42
|
padding: 24px 16px;
|
|
43
43
|
font-size: 26px;
|
|
44
44
|
}
|
|
45
|
-
`;function Fe({name:o,creator:t}){const{data:n}=ee(t),d=(n==null?void 0:n.cover)||he;return e.jsxs(Me,{"data-testid":"collection-hero","aria-label":o,children:[e.jsxs(
|
|
45
|
+
`;function Fe({name:o,creator:t}){const{data:n}=ee(t),d=(n==null?void 0:n.cover)||he;return e.jsxs(Me,{"data-testid":"collection-hero","aria-label":o,children:[e.jsxs(ze,{children:[e.jsx(Ee,{src:d,alt:"",loading:"eager"}),e.jsx(Re,{"aria-hidden":!0})]}),e.jsx(Te,{"data-testid":"collection-hero-title",children:o})]})}const{colors:c,radius:I}=b,Le=s.div`
|
|
46
46
|
display: flex;
|
|
47
47
|
flex-direction: column;
|
|
48
48
|
align-items: center;
|
|
@@ -116,7 +116,7 @@ import{j as e,r as h,u as J,d as X}from"./react-DehiWSvs.js";import{t as b,s,bd
|
|
|
116
116
|
background: ${c.accent};
|
|
117
117
|
color: ${c.white};
|
|
118
118
|
}
|
|
119
|
-
`;function _e({address:o}){var v,l;const{data:t}=te(o),[n,d]=h.useState(!1);if(!o)return null;const p=(t==null?void 0:t.name)||
|
|
119
|
+
`;function _e({address:o}){var v,l;const{data:t}=te(o),[n,d]=h.useState(!1);if(!o)return null;const p=(t==null?void 0:t.name)||T(o),u=(l=(v=t==null?void 0:t.avatar)==null?void 0:v.snapshots)==null?void 0:l.face256,g=`${re.profileUrl}/${o}`,f=ae(oe({name:t==null?void 0:t.name,hasClaimedName:t==null?void 0:t.hasClaimedName,ethAddress:(t==null?void 0:t.ethAddress)??o}));async function x(){try{await navigator.clipboard.writeText(o),d(!0),window.setTimeout(()=>d(!1),1500)}catch(y){se(y,{flow:"copy_creator_address"})}}return e.jsxs(Le,{"data-testid":"creator-card",children:[u?e.jsx(B,{src:u,alt:"",loading:"eager",style:{backgroundColor:f}}):e.jsx(B,{as:"span","aria-hidden":!0,style:{backgroundColor:f}}),e.jsx(Be,{title:p,children:p}),e.jsxs(Ie,{type:"button",onClick:()=>void x(),title:n?a("collection.copied"):a("collection.copyAddress"),"aria-label":n?a("collection.copied"):a("collection.copyAddress"),children:[e.jsx("span",{children:T(o)}),e.jsx(ie,{name:"copy",size:16})]}),e.jsx(We,{"data-testid":"creator-card-view",href:g,target:"_blank",rel:"noopener noreferrer",children:a("collection.viewProfile")})]})}const{colors:Ge,media:$}=b,He=s.div`
|
|
120
120
|
position: relative;
|
|
121
121
|
display: flex;
|
|
122
122
|
gap: 32px;
|
|
@@ -159,4 +159,4 @@ import{j as e,r as h,u as J,d as X}from"./react-DehiWSvs.js";import{t as b,s,bd
|
|
|
159
159
|
visibility: visible;
|
|
160
160
|
}
|
|
161
161
|
}
|
|
162
|
-
`,qe=48;function it(){var
|
|
162
|
+
`,qe=48;function it(){var R;const{contractAddress:o}=Z(),t=J(),[n,d]=h.useState("wearable"),[p,u]=h.useState(null),[g,f]=h.useState([]),[x,v]=h.useState(""),[l,y]=h.useState(""),[k,W]=h.useState("newest"),N=x&&!Number.isNaN(Number(x))?Number(x):void 0,P=l&&!Number.isNaN(Number(l))?Number(l):void 0,_=p?Ne[p]:void 0,G=(L.find(i=>i.key===k)??L[0]).server,S={category:n,rarities:g.length?g:void 0,wearableCategories:_,minPriceCredits:N,maxPriceCredits:P,sortBy:G},{items:j,total:H,isLoading:w,error:A,hasNextPage:U,isFetchingNextPage:M,isFetchNextPageError:Y,fetchNextPage:q}=Se(["collection-page",o,S],i=>pe(o,{...S,first:qe,skip:i}),{enabled:!!o}),{data:r}=ne({queryKey:["collection-meta",o],queryFn:()=>xe(o),enabled:!!o,staleTime:5*6e4}),z=(r==null?void 0:r.name)||a("collection.fallbackTitle");ce({title:r==null?void 0:r.name,description:r!=null&&r.name?a("seo.collection.description",{name:r.name}):void 0});const E=(r==null?void 0:r.creator)||((R=j[0])==null?void 0:R.creator);function D(i){d(i),u(null)}function K(i){f(m=>m.includes(i)?m.filter(X=>X!==i):[...m,i])}function O(){d("wearable"),u(null),f([]),v(""),y("")}const C=!!(N||P),Q=C?`${x||"0"}–${l||"∞"}`:a("filter.price"),V=n!=="wearable"||!!p||g.length>0||C;return e.jsxs(ue,{"data-testid":"collection-page",children:[e.jsxs(ge,{"aria-label":a("collection.breadcrumbAria"),children:[e.jsx(be,{onClick:()=>t("/items"),children:a("collection.breadcrumb")}),e.jsx("span",{children:"/"}),e.jsx(fe,{children:z})]}),e.jsx(Fe,{name:z,creator:E}),e.jsxs(He,{"data-testid":"browse",children:[e.jsxs(Ye,{"data-testid":"browse-sidebar",children:[e.jsx(_e,{address:E}),e.jsx(je,{category:n,subCategory:p,onCategory:D,onSub:u,title:a("collection.category"),flat:!0})]}),e.jsxs(Ue,{children:[!w&&j.length>0?e.jsx(ve,{items:j,source:"collection"}):null,e.jsx(ye,{rarities:g,onToggleRarity:K,sort:k,onSort:W,total:H,loading:w,anyActive:V,onClear:O,renderTrailing:i=>e.jsx(we,{panelKey:"price",label:Q,active:C,panel:i,children:e.jsxs(Ce,{"data-variant":"price",children:[e.jsxs($e,{children:[e.jsx("input",{type:"number",min:"0","aria-label":a("collection.priceMin"),placeholder:a("collection.priceMinPlaceholder"),value:x,onChange:m=>v(m.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":a("collection.priceMax"),placeholder:a("collection.priceMaxPlaceholder"),value:l,onChange:m=>y(m.target.value)})]}),e.jsx(ke,{children:a("collection.priceHint",{currency:le.name})})]})})}),A?e.jsx(me,{message:a("collection.error")}):null,e.jsx(Ae,{"data-testid":"grid",children:w?e.jsx(F,{count:15}):e.jsxs(e.Fragment,{children:[j.map(i=>e.jsx(de,{item:i},i.id)),M?e.jsx(F,{count:6}):null]})}),e.jsx(Pe,{hasNextPage:U,isFetching:M,isError:Y,onLoadMore:()=>void q()}),!w&&!A&&j.length===0?e.jsx("p",{className:"muted",children:a("collection.empty")}):null]})]})]})}export{it as Collection,it as default};
|