@dcl/shop 0.5.1-30941423866.commit-16bb43e → 0.5.1-30942936446.commit-2065145
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-D6HGEkBY.js → Activity-DKyyVjF3.js} +3 -3
- package/_assets/{AnimatedBackground-Bz6-eXM-.js → AnimatedBackground-D_NOZUsv.js} +2 -2
- package/_assets/{Assets-91-VU1Yf.js → Assets-B-QxXzVp.js} +7 -7
- package/_assets/{Assets.styles-nkCcUHhi.js → Assets.styles-Dwkb-T-5.js} +56 -56
- package/_assets/{Authorizations-CEIgVod3.js → Authorizations-CwdWUCCN.js} +3 -3
- package/_assets/{Cart-bL5VUwar.js → Cart-DJd7mRPw.js} +15 -15
- package/_assets/{CircularProgress-t5C2xMSa.js → CircularProgress-QCFQ5Q0T.js} +3 -3
- package/_assets/Collection-Du05-cah.js +162 -0
- package/_assets/{CollectionCarousel-BofN3PUd.js → CollectionCarousel-CzK6Sr6O.js} +15 -15
- package/_assets/Creator-9YR9zS8U.js +306 -0
- package/_assets/{ErrorNotice-SoCdrSmZ.js → ErrorNotice-B-k-8lgH.js} +1 -1
- package/_assets/{ExchangeController-CfUvjqK_.js → ExchangeController-CgsMU6Of.js} +1 -1
- package/_assets/{GetCredits-DoaG2_0N.js → GetCredits-BWKjSlQH.js} +7 -7
- package/_assets/{HelpersUtil-BMGSbn7T.js → HelpersUtil-C9JEsHd1.js} +1 -1
- package/_assets/{ItemDetail-DgqMo17C.js → ItemDetail-ByJH66Dr.js} +3 -3
- package/_assets/{LoadMore-QZxbtyl3.js → LoadMore-CDsECC_S.js} +1 -1
- package/_assets/{ManaPricingBanner.styles-CfeNfvcw.js → ManaPricingBanner.styles-CBM3_pCR.js} +3 -3
- package/_assets/{MenuList-3Ove0Kax.js → MenuList-DniyjKZf.js} +1 -1
- package/_assets/{MyAssets-Dfi9GJY7.js → MyAssets-Cn5OcKcq.js} +1 -1
- package/_assets/{MyFavorites-4NZPS72p.js → MyFavorites-Dh3ERS1g.js} +1 -1
- package/_assets/NotFound-BLRVVTj-.js +13 -0
- package/_assets/{NotificationsBell-C3ZVZms3.js → NotificationsBell-BWFTNvfH.js} +1 -1
- package/_assets/{OutfitDetail-BnpYR8Sn.js → OutfitDetail-C-O6ZG_T.js} +4 -4
- package/_assets/{OutfitPreview-Ds73Fyio.js → OutfitPreview-3ZYOvLqd.js} +2 -2
- package/_assets/{OutfitStudio-BcZDs5Sw.js → OutfitStudio-CdH7v1-f.js} +13 -13
- package/_assets/{StoreSettings-DgkB-s8z.js → StoreSettings-ZBAETVqr.js} +11 -11
- package/_assets/{Success-CFrayKii.js → Success-Dcdg4j1H.js} +4 -4
- package/_assets/{SwapController-B0I2SBMi.js → SwapController-CJCQ0dFg.js} +1 -1
- package/_assets/{Tooltip-DrwaXxlg.js → Tooltip-POp1BJ4y.js} +1 -1
- package/_assets/{TradeService-wTgWWF_f.js → TradeService-CQMOkya7.js} +1 -1
- package/_assets/{W3MFrameProviderSingleton-DmUcIZ1-.js → W3MFrameProviderSingleton-kdy7Kyep.js} +3 -3
- package/_assets/{WebCryptoP256-Bh90kMb3.js → WebCryptoP256-CmT290Aw.js} +1 -1
- package/_assets/{authorizations-LULzuipv.js → authorizations-CWm7pvjk.js} +1 -1
- package/_assets/{basic-BJTMzaq4.js → basic-2wXayEjj.js} +1 -1
- package/_assets/{biconomy-DwCfSXz5.js → biconomy-CrUwmLLN.js} +1 -1
- package/_assets/{builder-CsWf7X7a.js → builder-D3s6Xcg_.js} +1 -1
- package/_assets/{buy-Cs1e8dwt.js → buy-DH_c8xtw.js} +1 -1
- package/_assets/{buy-gasless-nMph8utE.js → buy-gasless-D2u0Cuie.js} +1 -1
- package/_assets/{categories-Al7TFiZ3.js → categories-CD0l2-IJ.js} +32 -32
- package/_assets/{ccip-D1z2vDZ1.js → ccip-Bq7op_u4.js} +1 -1
- package/_assets/{ccip-BwXOtHnt.js → ccip-Dt-VmUCH.js} +1 -1
- package/_assets/{clsx-CF2rJgou.js → clsx-BZmZfIZ7.js} +2 -2
- package/_assets/collectionPage.styles-DnFAUb4Q.js +48 -0
- package/_assets/{controller-Dd98YdMj.js → controller-DAvNn45R.js} +2 -2
- package/_assets/{core-D1SojbPa.js → core-UWabPMJx.js} +4 -4
- package/_assets/{createSvgIcon-BD9EM61r.js → createSvgIcon-B4LAM6aP.js} +3 -3
- package/_assets/{custom-COzYkjQL.js → custom-BjZ8TeJA.js} +1 -1
- package/_assets/{data-capture-BjEF_GLG.js → data-capture-CJaTah4x.js} +1 -1
- package/_assets/{email-ps4Ivz5i.js → email-nvRgEzbl.js} +1 -1
- package/_assets/{embedded-wallet-CVLG0kXZ.js → embedded-wallet-m5nVefBN.js} +1 -1
- package/_assets/{emotion-styled.browser.esm-CDuZD50Q.js → emotion-styled.browser.esm-SPt1g8r5.js} +1 -1
- package/_assets/{engine-pr6_tb_z.js → engine-BQ30rMc_.js} +1 -1
- package/_assets/{errors-5vlAB2Zg.js → errors-sEfj_aGG.js} +1 -1
- package/_assets/{estimate-l1-fee-B3g-FnFs.js → estimate-l1-fee-D55ttM53.js} +1 -1
- package/_assets/{execute-Cel7d92K.js → execute-20WfUFta.js} +2 -2
- package/_assets/{features-D5rLpDoE.js → features-B3g5o6I9.js} +1 -1
- package/_assets/{fetchTokenMetadata-DryrCOLG.js → fetchTokenMetadata-C3taocSg.js} +2 -2
- package/_assets/{field.styles-C90By0S4.js → field.styles-Cv8EF1LN.js} +1 -1
- package/_assets/{get-ecosystem-wallet-info-DS2uBDFK.js → get-ecosystem-wallet-info-C87cJBZ0.js} +1 -1
- package/_assets/{getBalance-DzSIaYv8.js → getBalance-DJFj4nll.js} +1 -1
- package/_assets/{getNFT-B_38vu3d.js → getNFT-Db40YAe5.js} +1 -1
- package/_assets/{getNFT-BYs-Lc0M.js → getNFT-n1rLq0y8.js} +1 -1
- package/_assets/{getThemeProps-CMN_iN9O.js → getThemeProps-qixq943T.js} +1 -1
- package/_assets/{grid.styles-_dq0Z7zy.js → grid.styles-V4B-yWuT.js} +1 -1
- package/_assets/{hashTypedData-U2WpRL9J.js → hashTypedData-Cph7l-wN.js} +1 -1
- package/_assets/{hashTypedData-nZ5SahOR.js → hashTypedData-DmKA2WyG.js} +1 -1
- package/_assets/{in-app-CrkxD8Cc.js → in-app-BrwiASGV.js} +1 -1
- package/_assets/{in-app-wallet-calls-Li6zp_GH.js → in-app-wallet-calls-Cdw4VCOK.js} +1 -1
- package/_assets/{index-BZWjyqNw.js → index-B0GXKjok.js} +1 -1
- package/_assets/{index-Bie49yv7.js → index-B1ZZ9eYb.js} +2 -2
- package/_assets/{index-ChlDHmTZ.js → index-B3dN6jXl.js} +1 -1
- package/_assets/{index-Z5BMZOu5.js → index-BEHNdwPO.js} +11 -11
- package/_assets/{index-BXLMe2R7.js → index-BG81Ew07.js} +1 -1
- package/_assets/{index-DptqVcuN.js → index-BKV20Nhl.js} +2 -2
- package/_assets/{index-BfJ9y_zu.js → index-BN6xB09s.js} +1 -1
- package/_assets/{index-3swvxeAv.js → index-BSYdl9Ph.js} +1 -1
- package/_assets/{index-T4DelPen.js → index-BZJRlKJd.js} +1 -1
- package/_assets/{index-C9YePsjK.js → index-BfbRuC2a.js} +1 -1
- package/_assets/index-BmdBaCyf.js +3315 -0
- package/_assets/{index-BpktVBiY.js → index-BqZsCXiJ.js} +1 -1
- package/_assets/{index-DNQcT8i8.js → index-BuxC7_jg.js} +3 -3
- package/_assets/{index-DI5MJwtI.js → index-Bvu9JQbk.js} +1 -1
- package/_assets/{index-DfH6m-Ar.js → index-BvvXUkGO.js} +1 -1
- package/_assets/{index-CycLf6t0.js → index-BwJOXIY2.js} +1 -1
- package/_assets/{index-YQoU1Oij.js → index-BzlgQIWc.js} +1 -1
- package/_assets/{index-CPEW56oC.js → index-CMIeiz8J.js} +1 -1
- package/_assets/{index-B-cFSgSm.js → index-C_tTx02v.js} +1 -1
- package/_assets/{index-BRUTO6r3.js → index-CfQEZ4_J.js} +1 -1
- package/_assets/{index-CIJrlsx5.js → index-CoJ4w6mI.js} +1 -1
- package/_assets/{index-uA72jFdu.js → index-CpvNbkCX.js} +1 -1
- package/_assets/{index-DhVlJ1ll.js → index-CuRsH7Jr.js} +1 -1
- package/_assets/{index-BB2cIvLa.js → index-CwkhI0tX.js} +1 -1
- package/_assets/{index-CkDVG_a0.js → index-D8CMDKuk.js} +1 -1
- package/_assets/{index-DqDSn6aV.js → index-D90TiSbn.js} +1 -1
- package/_assets/{index-CtSdDkYg.js → index-DHvFGs-V.js} +2 -2
- package/_assets/{index-CroRq_48.js → index-DI6lxGl3.js} +1 -1
- package/_assets/{index-Crfc7kEB.js → index-DQzoGDIO.js} +2 -2
- package/_assets/{index-3p-1HM0o.js → index-DSgPAG74.js} +1 -1
- package/_assets/{index-BzJy8rqx.js → index-Db25kjW1.js} +1 -1
- package/_assets/{index-Cl61ltQF.js → index-DfEcY6V7.js} +1 -1
- package/_assets/{index-onFl5MgF.js → index-Dfq9MSrW.js} +3 -3
- package/_assets/{index-C6vWyFJn.js → index-DjwAceSs.js} +2 -2
- package/_assets/{index-Ccc-pGrt.js → index-DmqmHJz0.js} +1 -1
- package/_assets/{index-Dy8SH7iw.js → index-DtXZOCTH.js} +1 -1
- package/_assets/{index-CZ-oyr8d.js → index-DtpiUbDD.js} +1 -1
- package/_assets/{index-voVSpMmf.js → index-Dvh_4N8m.js} +1 -1
- package/_assets/{index-CVaetlkF.js → index-DxNuVfUW.js} +1 -1
- package/_assets/{index-BjGq2FUA.js → index-NZryii06.js} +1 -1
- package/_assets/{index-B7jpRyRq.js → index-OIDpRQ7d.js} +1 -1
- package/_assets/{index-EbRcCO2e.js → index-Pc_h8OVk.js} +1 -1
- package/_assets/{index-18uEK4oZ.js → index-TLObYCeZ.js} +1 -1
- package/_assets/{index-Dl3xGhv0.js → index-aOM-5o2s.js} +1 -1
- package/_assets/{index-BzjKhN7Z.js → index-dV4DRjLe.js} +1 -1
- package/_assets/{index-1geQS8z5.js → index-fLV7Ojeb.js} +1 -1
- package/_assets/{index-B5d3bUu8.js → index-fTx5OxT5.js} +3 -3
- package/_assets/{index-AnVlYA8W.js → index-gMS2owiI.js} +1 -1
- package/_assets/{index-DxPgc0KP.js → index-jUw3qf0Z.js} +1 -1
- package/_assets/{index-C23YPWAe.js → index-qh5KEihJ.js} +1 -1
- package/_assets/{index-CbbOEMBd.js → index-sBdhGti_.js} +1 -1
- package/_assets/{index-Cnjifnkg.js → index-tRBG96tO.js} +1 -1
- package/_assets/{index.es-CvbAgxyC.js → index.es-CX9AxHdS.js} +1 -1
- package/_assets/{index.es-CToxxyBw.js → index.es-J0I60DQn.js} +1 -1
- package/_assets/{index.es-DRByKX1-.js → index.es-Pw8SRe4y.js} +4 -4
- package/_assets/{localBatchGatewayRequest-DTJgI3xj.js → localBatchGatewayRequest-CprCDfDl.js} +1 -1
- package/_assets/{mana-convert-BvzeO7sG.js → mana-convert-DjCFeoQ3.js} +1 -1
- package/_assets/{networks-CFK3bJYy.js → networks-BR41WM8b.js} +1 -1
- package/_assets/{onramp-okVUuWV0.js → onramp-BHoU1j8h.js} +1 -1
- package/_assets/{openzeppelin-De_HqqIc.js → openzeppelin-C3R3Ow9P.js} +1 -1
- package/_assets/{parseNft-q8FmdH8G.js → parseNft-HXsYyGMT.js} +2 -2
- package/_assets/{parseSignature-CqPrGTDR.js → parseSignature-B55K-BHw.js} +3 -3
- package/_assets/{parseSignature-B5R6ASNp.js → parseSignature-CfegJHxn.js} +1 -1
- package/_assets/{passkeys-DSnfSnMU.js → passkeys-BLEVv9is.js} +1 -1
- package/_assets/{pay-with-exchange-W6o_xhiT.js → pay-with-exchange-BDPb0fmB.js} +1 -1
- package/_assets/{qr-overlay-yLQ0IoEW.js → qr-overlay-Bn5u1TXh.js} +1 -1
- package/_assets/{receive-B1if_96A.js → receive-DdEXjtdG.js} +1 -1
- package/_assets/{resolveImplementation-DO2_Regw.js → resolveImplementation-BTny85ZN.js} +1 -1
- package/_assets/{rpc-Byx0dACz.js → rpc-C1vRekft.js} +1 -1
- package/_assets/{secp256k1-DZugY34I.js → secp256k1-BS_DtXn_.js} +1 -1
- package/_assets/{secp256k1-qgQXh0MJ.js → secp256k1-DSewH7p4.js} +1 -1
- package/_assets/{secp256k1-DdXA0G93.js → secp256k1-DjcGt-hf.js} +1 -1
- package/_assets/{send-DtosPy0k.js → send-D36Kc8ar.js} +1 -1
- package/_assets/{send-batch-transaction-_L7mjvMY.js → send-batch-transaction-9UPtmXhF.js} +1 -1
- package/_assets/{send-eip712-transaction-DurwgWTK.js → send-eip712-transaction-C-DlyYI4.js} +2 -2
- package/_assets/{send-gasless-transaction-B3bmXUxJ.js → send-gasless-transaction-Clkbkp81.js} +2 -2
- package/_assets/{send-transaction-CZKkuF5l.js → send-transaction-ac0pElET.js} +2 -2
- package/_assets/{sendMetaTransaction-4my7kZiF.js → sendMetaTransaction-3Orn7mPE.js} +1 -1
- package/_assets/{sendRawTransaction-BwVANbYg.js → sendRawTransaction-Bd_d0DGd.js} +3 -3
- package/_assets/{serializeTransaction-cVp_FJox.js → serializeTransaction-tReIGWJj.js} +1 -1
- package/_assets/{session-proposal-CYvptxU7.js → session-proposal-BGjlVk7r.js} +1 -1
- package/_assets/{session-request-Bn37Dem4.js → session-request-BAHn4jIb.js} +2 -2
- package/_assets/{signing-DEItZ-F3.js → signing-BO2fbGm6.js} +3 -3
- package/_assets/{socials-CdpDKKrQ.js → socials-rfvGwJ98.js} +1 -1
- package/_assets/{swaps-DnenFD5w.js → swaps-D7QVUfQw.js} +1 -1
- package/_assets/{thirdweb-Bp130Dcj.js → thirdweb-BdoDApEi.js} +3 -3
- package/_assets/{to-serializable-transaction-CcF0iJ96.js → to-serializable-transaction-DJoSj0cy.js} +2 -2
- package/_assets/{trade-encoding-BRe43PSw.js → trade-encoding-CitD9riU.js} +1 -1
- package/_assets/{transactionReceipt-lMu7BRwr.js → transactionReceipt-CFvIhGab.js} +1 -1
- package/_assets/{transactions-B14lINkM.js → transactions-BCaw00-L.js} +1 -1
- package/_assets/{useCreditPacks-C5VR3CBS.js → useCreditPacks-DI0sJyEs.js} +1 -1
- package/_assets/{useImportable-B5bQ22LQ.js → useImportable-B6LfqPpp.js} +1 -1
- package/_assets/{useInfiniteGrid-eJ_aRWUt.js → useInfiniteGrid-Crt1jGuz.js} +1 -1
- package/_assets/useManaRate-CVF6TzHy.js +1 -0
- package/_assets/{useTheme--KekSHIk.js → useTheme-DDT9I-Gr.js} +1 -1
- package/_assets/{verifyHash-Bt7jFOSN.js → verifyHash-CONBvy81.js} +1 -1
- package/_assets/{w3m-modal-Dn7of9MZ.js → w3m-modal-CmgRQ0lu.js} +1 -1
- package/_assets/{w3m-modal-CDIk6daa.js → w3m-modal-DTboZx41.js} +1 -1
- package/_assets/{wait-for-tx-receipt-BUw9UtP4.js → wait-for-tx-receipt-IG8mDnzG.js} +1 -1
- package/_assets/{wallets-A7pRwPiu.js → wallets-YFeaNJbJ.js} +5 -5
- package/_assets/{web-connector-P4z47D9H.js → web-connector-CnAC5kme.js} +3 -3
- package/_assets/{writeContract-Bx4xVEvO.js → writeContract-C-4vi3wG.js} +1 -1
- package/_assets/{zoraTestnet-CuzBONzv.js → zoraTestnet-BAdd9yw6.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/_assets/Collection-B3QlNwPP.js +0 -119
- package/_assets/Creator-BvEpySRn.js +0 -306
- package/_assets/NotFound-BJON5Kwq.js +0 -13
- package/_assets/browseLayout.styles-Cb1bSjYL.js +0 -91
- package/_assets/index-CqLzAYYu.js +0 -3482
- package/_assets/useManaRate-CEsFS4D7.js +0 -1
- package/_assets/useStore-BZhz06Vz.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t as le,s as i,b as s,
|
|
1
|
+
import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t as le,s as i,b as s,as as de,aZ as sa,ar as na,I as H,q as Mt,ab as Qe,n as ia,N as U,ad as dt,l as ra,u as oa,a_ as ca,v as da,a$ as la,b0 as ua,b1 as ha,b2 as pa,o as ga,b3 as lt,Q as G,b4 as ut,b5 as xa,y as ae,c as ht,b6 as ma,C as fa,b7 as pt,b8 as Re,b9 as ye,ba as be,bb as gt,g as ve,d as ya,e as We,bc as ba}from"./index-BmdBaCyf.js";import{M as va,S as wa,C as Ca,H as ja,a as ka,T as $a,X as Sa,b as Ma,B as Ta,c as Ia,d as xt,e as Pa,f as ke,P as Tt,m as za,g as Aa,h as Ea,i as qa,j as It,k as $e,L as _a,l as Ba,n as mt,o as ft,W as Ra,p as Wa,q as Fa,A as La,r as Ka,s as Na,t as Qa,u as Ua,v as Ha,w as Oa,x as Va,y as Ga,z as Da,D as Ya,E as Ja,F as Xa,G as Za,I as es,J as ts,K as Fe,N as as,O as ss,Q as ns,R as is,U as yt,V as bt,Y as rs,Z as os,_ as cs}from"./CollectionCarousel-CzK6Sr6O.js";import{u as ds}from"./useManaRate-CVF6TzHy.js";import{u as ls,r as us,g as hs,b as Le}from"./buy-DH_c8xtw.js";import{j as ps,k as gs,a as xs,n as ms,f as fs,A as ys}from"./authorizations-CWm7pvjk.js";import{b as bs,w as vs,S as vt,G as ws}from"./buy-gasless-D2u0Cuie.js";import{u as Cs,M as js,R as we,r as ks,c as $s,p as wt}from"./useCreditPacks-DI0sJyEs.js";import{i as Ss,a as Ms}from"./errors-sEfj_aGG.js";import{E as Ts}from"./ErrorNotice-B-k-8lgH.js";import{u as Ct}from"./mana-convert-DjCFeoQ3.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-CitD9riU.js";import"./sendMetaTransaction-3Orn7mPE.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
|
+
`,_s="https://cdn.decentraland.org/@dcl/shop/0.5.1-30942936446.commit-2065145/_assets/buy-error-22UunaPC.png";function Bs(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(va,{role:"dialog","aria-modal":"true","aria-label":s("cartCheckout.dialogAria"),children:[e.jsx(wa,{onClick:W?void 0:z,"aria-hidden":!0}),e.jsxs(Ca,{"data-tall":Y||void 0,children:[e.jsxs(ja,{children:[e.jsxs(ka,{children:[e.jsx($a,{children:D}),!W&&e.jsx(Sa,{onClick:z,"aria-label":s("buyModal.close"),children:e.jsx(Ma,{})})]}),e.jsxs(Ta,{children:[e.jsx(Ia,{children:l==="nofunds"?s("buyModal.dclBalance"):s("buyModal.myCreditsBalance")}),e.jsx(xt,{}),e.jsx(Pa,{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(xt,{}),de(o.totalCredits??0)]})]}),e.jsx(Tt,{options:o.options??[],totalCents:o.totalCents??0,onPay:o.onPay??(()=>{}),rateNote:(()=>{const A=za(o.totalCents??0,o.totalManaWei??0n);return A!=null?s("buyModal.manaRate",{mana:A.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),l==="processing"&&e.jsx(Rs,{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(Aa,{"data-testid":"buy-error",children:[e.jsx(Ea,{src:_s,alt:"",width:64,height:80}),e.jsxs(qa,{children:[e.jsx("b",{children:s("cartCheckout.errorHeadline")})," ",o.message??s("cartCheckout.errorBody")]})]}),e.jsxs(It,{children:[e.jsx($e,{"data-variant":"outline",onClick:z,children:s("buyModal.cancel")}),e.jsx($e,{"data-variant":"purple",onClick:o.onRetry??z,children:s("cartCheckout.tryAgain")})]})]})]})]})}function Rs({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(_a,{src:sa,alt:"",width:61,height:61}),e.jsx(Ba,{children:ne}),D?e.jsxs(Ps,{children:[e.jsx(mt,{"aria-hidden":!0,children:e.jsx(ft,{"data-step":!0,style:{width:`${Y}%`}})}),I>1?e.jsxs(zs,{children:[l,"/",I]}):null]}):e.jsx(mt,{"aria-hidden":!0,children:e.jsx(ft,{})})]})}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(Ra,{"data-testid":"nofunds-warning",children:[e.jsx(Wa,{}),e.jsxs(Fa,{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(La,{children:[e.jsx(Ka,{children:n.item.thumbnail?e.jsx("img",{src:n.item.thumbnail,alt:""}):null}),e.jsxs(Na,{children:[e.jsxs("div",{children:[e.jsxs(Qa,{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(Ua,{address:n.item.creator}):null]}),e.jsxs(Ha,{children:[e.jsx(Oa,{}),e.jsx("span",{children:de(n.priceCredits*L)})]})]})]},n.item.id)})}),e.jsx(Va,{children:I.map(n=>{const L=n.id===z;return e.jsxs(Ga,{"data-testid":"credit-pack","data-on":L||void 0,onClick:()=>W(n.id),children:[e.jsx(Da,{}),e.jsx(Ya,{children:de(n.credits)}),e.jsxs(Ja,{children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs(Xa,{children:[e.jsxs(Za,{children:[e.jsx(es,{}),e.jsx("span",{children:de((A==null?void 0:A.credits)??0)})]}),e.jsxs(ts,{children:["$",((A==null?void 0:A.usd)??0).toFixed(2)]})]}),e.jsxs(It,{children:[e.jsx($e,{"data-variant":"outline",onClick:Y,children:s("buyModal.cancel")}),e.jsx($e,{"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
|
|
@@ -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
|
+
`,Ns=i(At)`
|
|
151
151
|
display: flex;
|
|
152
152
|
flex-direction: column;
|
|
153
153
|
align-items: center;
|
|
@@ -162,13 +162,13 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
162
162
|
min-height: 320px;
|
|
163
163
|
padding: 32px 16px;
|
|
164
164
|
}
|
|
165
|
-
`,
|
|
165
|
+
`,Qs=i.div`
|
|
166
166
|
display: flex;
|
|
167
167
|
flex-direction: column;
|
|
168
168
|
align-items: center;
|
|
169
169
|
gap: 12px;
|
|
170
170
|
padding-bottom: 16px;
|
|
171
|
-
`,
|
|
171
|
+
`,Us=i.p`
|
|
172
172
|
margin: 0;
|
|
173
173
|
font-size: 24px;
|
|
174
174
|
font-weight: 700;
|
|
@@ -177,7 +177,7 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
177
177
|
${le.media.maxWidth("mobile")} {
|
|
178
178
|
font-size: 20px;
|
|
179
179
|
}
|
|
180
|
-
`,
|
|
180
|
+
`,Hs=i.p`
|
|
181
181
|
margin: 0;
|
|
182
182
|
font-size: 20px;
|
|
183
183
|
font-weight: 400;
|
|
@@ -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
|
-
`,
|
|
189
|
+
`,Os=i(Se)`
|
|
190
190
|
display: inline-flex;
|
|
191
191
|
align-items: center;
|
|
192
192
|
justify-content: center;
|
|
@@ -360,7 +360,7 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
360
360
|
gap: 4px;
|
|
361
361
|
min-width: 0;
|
|
362
362
|
padding-right: 64px; /* clear the top-right favourite + remove group */
|
|
363
|
-
`,Et=
|
|
363
|
+
`,Et=Qe`
|
|
364
364
|
display: block;
|
|
365
365
|
font-size: 16px;
|
|
366
366
|
font-weight: 600;
|
|
@@ -478,7 +478,7 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
478
478
|
line-height: 1;
|
|
479
479
|
text-transform: uppercase;
|
|
480
480
|
color: ${r.text2};
|
|
481
|
-
`,xn=i(
|
|
481
|
+
`,xn=i(H)`
|
|
482
482
|
color: #f48221;
|
|
483
483
|
`,mn=i(Se)`
|
|
484
484
|
font-size: 12px;
|
|
@@ -508,11 +508,11 @@ import{j as e,L as Se,r as P,d as ta,b as aa}from"./react-DehiWSvs.js";import{t
|
|
|
508
508
|
font-weight: 400;
|
|
509
509
|
line-height: 14px;
|
|
510
510
|
color: ${r.text};
|
|
511
|
-
`,yn=i(
|
|
511
|
+
`,yn=i(H)`
|
|
512
512
|
width: 11.31px;
|
|
513
513
|
height: 10.94px;
|
|
514
514
|
background: ${r.text};
|
|
515
|
-
`,qt=
|
|
515
|
+
`,qt=Qe`
|
|
516
516
|
display: grid;
|
|
517
517
|
place-items: center;
|
|
518
518
|
width: 24px;
|
|
@@ -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
|
+
`,_t=Qe`
|
|
662
662
|
margin: 0;
|
|
663
663
|
font-size: 13px;
|
|
664
664
|
`,Ce=i.p`
|
|
665
|
-
${
|
|
665
|
+
${_t};
|
|
666
666
|
`,zn=i(Ts)`
|
|
667
|
-
${
|
|
667
|
+
${_t};
|
|
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 Ue=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=Q(t=>t.items),l=Q(t=>t.remove),I=Q(t=>t.increment),z=Q(t=>t.decrement),W=Q(t=>t.clear),D=Q(t=>t.restore),Y=Q(t=>t.setFittingOpen),A=dt(t=>t.items),ne=dt(t=>t.toggle),{session:n,signIn:L}=ra(),_t=ls(),ue=Cs().packs.slice(0,js);P.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const Bt=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),[Qe,he]=P.useState(null),[Ft,R]=P.useState(!1),[_,H]=P.useState(null),Oe=P.useRef(0),[p,j]=P.useState(null),{data:pe}=la(n),{data:re}=ds(!0),[Te,He]=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),Ut=Ie.reduce((t,a)=>t+a.quantity,0),De=_?_.liveTotalCredits:Lt,Nt=new Set(o.map(t=>t.id)),Ye=((Me==null?void 0:Me.items)??[]).filter(t=>!Nt.has(t.id)).slice(0,12),Qt=new Map(_==null?void 0:_.buyable.map(t=>[t.item.id,t])),ge=($==null?void 0:$.credits)??0,ze=De*10,Ot=re?Ct(ze,re):0n,xe=Fe({priceCents:ze,priceManaWei:Ot,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n}),Ht=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(),H(null),he(null),ie(null)}function Dt(){j(null),R(!1)}function Je(t){const a=Ue(t),d=Math.max(0,a-ge),c=ue.find(u=>u.credits>=d)??ue[ue.length-1];He(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}),R(!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,B=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:N,maxCreditedValue:X}=await pt(n.identity,x.usdCents,M,C);u.push({salt:N.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:[N],maxCreditedValue:X,chainId:x.item.chainId}:{kind:"trade",trade:x.trade,credits:[N],maxCreditedValue:X})}catch(M){if(Ms(M)){if(u.length){try{await Be(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"),U=y.flatMap(m=>m.kind==="trade"?[m]:[]);if(ps()&&!v)try{const m=new Map;f=await bs({purchases:U,buyer:n.address,signer:n.signer,onSigned:()=>K(g),onBroadcast:({txHash:C,salts:N})=>{m.set(C,N),N.forEach(X=>w.add(X))}});const x=await Promise.allSettled(f.map(C=>vs(C)));x.forEach((C,N)=>{const X=m.get(f[N])??[];C.status==="fulfilled"?(X.forEach(_e=>S.add(_e)),E.push(f[N])):C.reason instanceof vt||X.forEach(_e=>B.add(_e))});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=>B.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=>B.add(x))});t.forEach(m=>l(m.item.id)),H(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),R(!1);const Re={items:c,txHash:f[0]??void 0,txHashes:f,settled:!0,...ce?{creditsAdded:ce}:{}};ee("/success",{state:Re,replace:!0})}catch(y){be(y)||ae(y,{flow:"cart_checkout",step:h,cart_size:t.length});const g=new Set([...w].filter(v=>!B.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,U)=>v+U.priceCredits,0)),cart_size:a.length,partial:K.length>0}),k.length)try{await Be(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)),H(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")}),R(!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),R(!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)}),R(!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=Ue(t),{totalCents:c,manaWei:u}=await Jt(t),h=Fe({priceCents:c,priceManaWei:u,balanceCents:($==null?void 0:$.balanceCents)??0,manaBalanceWei:pe??0n}),w=Ht(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:B}=at(a,t);await st(S,B,()=>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}),R(!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)){R(!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)),H(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),B=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 U=g[f].item,{credit:ce,maxCreditedValue:Re}=await pt(n.identity,v,g[f].trade.id,U.contractAddress&&U.itemId!=null?{contractAddress:U.contractAddress,itemId:String(U.itemId)}:void 0);E.push({salt:ce.id,itemId:U.id}),k.push({kind:"trade",trade:g[f].trade,credits:[ce],maxCreditedValue:Re})}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)+B).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)),H(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&&Be(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=Q.getState().items.filter(Ge);if(a.length===0)return;ie(null),he(null),R(!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")),H(null);return}if(c.orderChanged){H(c),Oe.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{R(!1)}}async function rt(){if(_){if(!n){yt({type:"cart-checkout"}),L();return}if(Date.now()-Oe.current>En){H(null),he(null),await te();return}ie(null),tt(_.buyable)}}async function ea(){if(Te){try{sessionStorage.setItem(we,JSON.stringify(Q.getState().items))}catch{}R(!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{R(!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(O,{name:"arrow-left"}),s("nav.cart")]}),e.jsxs(Us,{"data-testid":"cart-empty",children:[e.jsx(O,{name:"cart-plus",size:110}),e.jsxs(Ns,{children:[e.jsx(Qs,{children:s("cart.empty.title")}),e.jsx(Os,{children:s("cart.empty.body")})]}),e.jsx(Hs,{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(O,{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(O,{name:"arrow-left"})}),e.jsx(Gs,{children:s("cart.panelTitle",{count:Kt})}),Bt?e.jsxs(Ds,{onClick:()=>Y(!0),disabled:V,children:[e.jsx(O,{name:"fitting-room"}),s("cart.fittingRoom")]}):null]}),e.jsxs(At,{children:[e.jsx(Ys,{children:o.map(t=>{const a=Qt.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,B=ha(t),E=!!B&&!!A[B],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,_t&&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:[B?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(O,{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(O,{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:Ut})}),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:_?s("marketCheckout.confirmPurchase"):s("cart.buyWithCredits"),busy:V||Pe,onPay:t=>void(_?rt():te(t))}):e.jsx(Pn,{onClick:()=>void(_?rt():te()),disabled:V||Pe,children:V?s("cart.working"):_?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")}),_?e.jsx(Ce,{className:"muted",children:s("cart.priceChanged")}):null,Qe?e.jsx(Ce,{className:"muted",children:Qe}):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(_s,{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"?Ue(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:He,onBuyPacks:()=>void ea(),message:p.phase==="error"?p.message:void 0,onRetry:()=>void te()}):null]})}export{Xn as Cart};
|
|
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};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a7 as N,a8 as U,a9 as o,aa as n,ab as D,m as M}from"./index-BmdBaCyf.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-BZmZfIZ7.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,B=M(P||(P=l`
|
|
2
2
|
0% {
|
|
3
3
|
transform: rotate(0deg);
|
|
4
4
|
}
|
|
@@ -21,8 +21,8 @@ import{a8 as N,a9 as U,aa as o,ab as n,ac as D,o as M}from"./index-CqLzAYYu.js";
|
|
|
21
21
|
stroke-dasharray: 100px, 200px;
|
|
22
22
|
stroke-dashoffset: -125px;
|
|
23
23
|
}
|
|
24
|
-
`)),L=r=>{const{classes:e,variant:s,color:t,disableShrink:d}=r,
|
|
24
|
+
`)),L=r=>{const{classes:e,variant:s,color:t,disableShrink:d}=r,m={root:["root",s,`color${n(t)}`],svg:["svg"],circle:["circle",`circle${n(s)}`,d&&"circleDisableShrink"]};return F(m,K,e)},V=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
|
`),B)),Z=v("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(r,e)=>e.svg})({display:"block"}),q=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
|
-
`),G)),O=w.forwardRef(function(e,s){const t=N({props:e,name:"MuiCircularProgress"}),{className:d,color:
|
|
28
|
+
`),G)),O=w.forwardRef(function(e,s){const t=N({props:e,name:"MuiCircularProgress"}),{className:d,color:m="primary",disableShrink:R=!1,size:u=40,style:_,thickness:i=3.6,value:p=0,variant:k="indeterminate"}=t,j=U(t,W),c=o({},t,{color:m,disableShrink:R,size:u,thickness:i,value:p,variant:k}),f=L(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(V,o({className:I(f.root,d),style:o({width:u,height:u},x,_),ownerState:c,ref:s,role:"progressbar"},y,j,{children:g.jsx(Z,{className:f.svg,ownerState:c,viewBox:`${a/2} ${a/2} ${a} ${a}`,children:g.jsx(q,{className:f.circle,style:h,ownerState:c,cx:a,cy:a,r:(a-i)/2,fill:"none",strokeWidth:i})})}))});export{O as C};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import{j as e,r as h,u as J,d as X}from"./react-DehiWSvs.js";import{t as b,s,bd as ee,V as te,w as z,be as ae,bf as oe,I as ie,b as a,c as re,y as se,u as ne,n as ce,C as le,ae as F,af as de,bg as pe,bh as xe}from"./index-BmdBaCyf.js";import{E as me}from"./ErrorNotice-B-k-8lgH.js";import{d as he,P as ue,C as ge,a as be,b as fe,A as ve}from"./collectionPage.styles-DnFAUb4Q.js";import{S as L,C as ye,F as je,c as we,P as Ce,d as $e,H as ke,e as Ne}from"./categories-CD0l2-IJ.js";import{L as Pe}from"./LoadMore-CDsECC_S.js";import{u as Se}from"./useInfiniteGrid-Crt1jGuz.js";import{G as Ae}from"./grid.styles-V4B-yWuT.js";import"./sentry-973sfbO9.js";import"./dcl-schemas-Dr9BTjb7.js";import"./ethers-CtNGBird.js";import"./intl-CBcMB1D2.js";const Me=s.section`
|
|
2
|
+
position: relative;
|
|
3
|
+
border-radius: ${b.radius.card};
|
|
4
|
+
overflow: hidden;
|
|
5
|
+
margin-bottom: 24px;
|
|
6
|
+
min-height: 200px;
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
justify-content: center;
|
|
10
|
+
|
|
11
|
+
${b.media.maxWidth("mobile")} {
|
|
12
|
+
min-height: 140px;
|
|
13
|
+
}
|
|
14
|
+
`,Ee=s.div`
|
|
15
|
+
position: absolute;
|
|
16
|
+
inset: 0;
|
|
17
|
+
z-index: 0;
|
|
18
|
+
`,Re=s.img`
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
object-fit: cover;
|
|
22
|
+
display: block;
|
|
23
|
+
`,Te=s.div`
|
|
24
|
+
position: absolute;
|
|
25
|
+
inset: 0;
|
|
26
|
+
background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0.55) 100%);
|
|
27
|
+
`,ze=s.h1`
|
|
28
|
+
position: relative;
|
|
29
|
+
z-index: 1;
|
|
30
|
+
margin: 0;
|
|
31
|
+
padding: 32px 24px;
|
|
32
|
+
text-align: center;
|
|
33
|
+
color: ${b.colors.white};
|
|
34
|
+
font-size: 40px;
|
|
35
|
+
font-weight: 800;
|
|
36
|
+
line-height: 1.2;
|
|
37
|
+
letter-spacing: 0.02em;
|
|
38
|
+
text-transform: uppercase;
|
|
39
|
+
text-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
|
|
40
|
+
|
|
41
|
+
${b.media.maxWidth("mobile")} {
|
|
42
|
+
padding: 24px 16px;
|
|
43
|
+
font-size: 26px;
|
|
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(Ee,{children:[e.jsx(Re,{src:d,alt:"",loading:"eager"}),e.jsx(Te,{"aria-hidden":!0})]}),e.jsx(ze,{"data-testid":"collection-hero-title",children:o})]})}const{colors:c,radius:I}=b,Le=s.div`
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
align-items: center;
|
|
49
|
+
text-align: center;
|
|
50
|
+
gap: 12px;
|
|
51
|
+
padding-bottom: 24px;
|
|
52
|
+
/* Lift so the avatar half-overlaps the 24px-below cover hero (24px + half the 110px avatar). */
|
|
53
|
+
margin-top: -79px;
|
|
54
|
+
margin-bottom: 8px;
|
|
55
|
+
border-bottom: 1px solid ${c.line};
|
|
56
|
+
`,B=s.img`
|
|
57
|
+
display: block;
|
|
58
|
+
width: 110px;
|
|
59
|
+
height: 110px;
|
|
60
|
+
border-radius: 50%;
|
|
61
|
+
object-fit: cover;
|
|
62
|
+
border: 5px solid ${c.white};
|
|
63
|
+
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
|
|
64
|
+
background: #ff4bed;
|
|
65
|
+
`,Be=s.h2`
|
|
66
|
+
margin: 0;
|
|
67
|
+
font-size: 20px;
|
|
68
|
+
font-weight: 700;
|
|
69
|
+
line-height: 1.3;
|
|
70
|
+
color: ${c.text};
|
|
71
|
+
max-width: 100%;
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
text-overflow: ellipsis;
|
|
74
|
+
white-space: nowrap;
|
|
75
|
+
`,Ie=s.button`
|
|
76
|
+
display: inline-flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
gap: 8px;
|
|
79
|
+
padding: 4px 8px;
|
|
80
|
+
border: 0;
|
|
81
|
+
border-radius: ${I.btn};
|
|
82
|
+
background: none;
|
|
83
|
+
color: ${c.muted};
|
|
84
|
+
font: inherit;
|
|
85
|
+
font-size: 14px;
|
|
86
|
+
cursor: pointer;
|
|
87
|
+
transition:
|
|
88
|
+
color 0.15s ease,
|
|
89
|
+
background 0.15s ease;
|
|
90
|
+
|
|
91
|
+
&:hover {
|
|
92
|
+
color: ${c.text};
|
|
93
|
+
background: ${c.media};
|
|
94
|
+
}
|
|
95
|
+
`,We=s.a`
|
|
96
|
+
display: inline-flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
justify-content: center;
|
|
99
|
+
width: 100%;
|
|
100
|
+
height: 44px;
|
|
101
|
+
padding: 0 20px;
|
|
102
|
+
border: 2px solid ${c.accent};
|
|
103
|
+
border-radius: ${I.btn};
|
|
104
|
+
background: transparent;
|
|
105
|
+
color: ${c.accent};
|
|
106
|
+
font-weight: 600;
|
|
107
|
+
font-size: 13px;
|
|
108
|
+
text-transform: uppercase;
|
|
109
|
+
letter-spacing: 0.046em;
|
|
110
|
+
text-decoration: none;
|
|
111
|
+
transition:
|
|
112
|
+
background 0.15s ease,
|
|
113
|
+
color 0.15s ease;
|
|
114
|
+
|
|
115
|
+
&:hover {
|
|
116
|
+
background: ${c.accent};
|
|
117
|
+
color: ${c.white};
|
|
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)||z(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(j){se(j,{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:z(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
|
+
position: relative;
|
|
121
|
+
display: flex;
|
|
122
|
+
gap: 32px;
|
|
123
|
+
align-items: flex-start;
|
|
124
|
+
|
|
125
|
+
${$.maxWidth("lg")} {
|
|
126
|
+
display: block;
|
|
127
|
+
}
|
|
128
|
+
`,Ue=s.div`
|
|
129
|
+
flex: 1;
|
|
130
|
+
min-width: 0;
|
|
131
|
+
|
|
132
|
+
${$.maxWidth("lg")} {
|
|
133
|
+
width: 100%;
|
|
134
|
+
}
|
|
135
|
+
`,Ye=s.aside`
|
|
136
|
+
flex: none;
|
|
137
|
+
width: 265px;
|
|
138
|
+
|
|
139
|
+
${$.maxWidth("lg")} {
|
|
140
|
+
position: fixed;
|
|
141
|
+
left: 0;
|
|
142
|
+
right: 0;
|
|
143
|
+
bottom: 0;
|
|
144
|
+
top: auto;
|
|
145
|
+
z-index: 9999;
|
|
146
|
+
width: 100%;
|
|
147
|
+
max-height: 88vh;
|
|
148
|
+
border-radius: 16px 16px 0 0;
|
|
149
|
+
background: ${Ge.white};
|
|
150
|
+
padding: 0 16px;
|
|
151
|
+
overflow-y: auto;
|
|
152
|
+
box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18);
|
|
153
|
+
transform: translateY(100%);
|
|
154
|
+
transition: transform 0.26s ease;
|
|
155
|
+
visibility: hidden;
|
|
156
|
+
|
|
157
|
+
&[data-open] {
|
|
158
|
+
transform: translateY(0);
|
|
159
|
+
visibility: visible;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
`,qe=48;function it(){var T;const{contractAddress:o}=J(),t=X(),[n,d]=h.useState("wearable"),[p,u]=h.useState(null),[g,f]=h.useState([]),[x,v]=h.useState(""),[l,j]=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:y,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}),E=(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 R=(r==null?void 0:r.creator)||((T=y[0])==null?void 0:T.creator);function K(i){d(i),u(null)}function V(i){f(m=>m.includes(i)?m.filter(Z=>Z!==i):[...m,i])}function D(){d("wearable"),u(null),f([]),v(""),j("")}const C=!!(N||P),O=C?`${x||"0"}–${l||"∞"}`:a("filter.price"),Q=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:E})]}),e.jsx(Fe,{name:E,creator:R}),e.jsxs(He,{"data-testid":"browse",children:[e.jsxs(Ye,{"data-testid":"browse-sidebar",children:[e.jsx(_e,{address:R}),e.jsx(ye,{category:n,subCategory:p,onCategory:K,onSub:u,title:a("collection.category"),flat:!0})]}),e.jsxs(Ue,{children:[!w&&y.length>0?e.jsx(ve,{items:y,source:"collection"}):null,e.jsx(je,{rarities:g,onToggleRarity:V,sort:k,onSort:W,total:H,loading:w,anyActive:Q,onClear:D,renderTrailing:i=>e.jsx(we,{panelKey:"price",label:O,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=>j(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:[y.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&&y.length===0?e.jsx("p",{className:"muted",children:a("collection.empty")}):null]})]})]})}export{it as Collection,it as default};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,
|
|
1
|
+
import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,q as k,as as j,bx as C,C as G,m as Y,I as Q,y as X,g as W,e as B,d as Z,$ as q,b_ as F,af as J}from"./index-BmdBaCyf.js";import{s as ee,f as U,A as _,g as K,r as te,m as ne,i as ae,M as ie,h as oe}from"./authorizations-CWm7pvjk.js";import{i as se}from"./errors-sEfj_aGG.js";import{E as re}from"./ErrorNotice-B-k-8lgH.js";import{a as ce}from"./buy-DH_c8xtw.js";import{g as de,f as le}from"./trade-encoding-CitD9riU.js";import{s as pe,M as he,E as ue}from"./sendMetaTransaction-3Orn7mPE.js";import{I as xe,C as ge}from"./ethers-CtNGBird.js";const R="shop:resume_after_signin",fe=900*1e3;function dt(a){try{sessionStorage.setItem(R,JSON.stringify({...a,at:Date.now()}))}catch{}}function lt(a){let n;try{n=sessionStorage.getItem(R)}catch{return null}if(!n)return null;try{sessionStorage.removeItem(R)}catch{}let i;try{i=JSON.parse(n)}catch{return null}return!i||i.type!==a||typeof i.at!="number"||Date.now()-i.at>fe?null:i.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:i.path}}function me(a,n){return(a+n-1n)/n}function be(a,n,i){return a<=0||n<=0?0n:a>=n?i:me(i*BigInt(a),BigInt(n))}function pt(a){var b,y,w;const n=Number.isFinite(a.priceCents)?Math.max(0,Math.trunc(a.priceCents)):0,i=Number.isFinite(a.balanceCents)?Math.max(0,Math.trunc(a.balanceCents)):0,s=a.priceManaWei>0n?a.priceManaWei:0n,l=a.manaBalanceWei>0n?a.manaBalanceWei:0n;if(n<=0)return{options:[],preferred:null,manaShortfall:null};const c=[];if(i>=n&&c.push({method:"credits",creditsCents:n,manaWei:0n}),s>0n&&i>0&&i<n){const d=n-i,f=be(d,n,s);l>=f&&c.push({method:"combined",creditsCents:i,manaWei:f})}s>0n&&l>=s&&c.push({method:"mana",creditsCents:0,manaWei:s});const p=((b=c.find(d=>d.method==="credits"))==null?void 0:b.method)??((y=c.find(d=>d.method==="combined"))==null?void 0:y.method)??((w=c.find(d=>d.method==="mana"))==null?void 0:w.method)??null,m=!c.some(d=>d.method==="mana"||d.method==="combined")&&s>0n&&l>0n?{manaWei:l,manaCents:ye(l,n,s),priceCents:n}:null;return{options:c,preferred:p,manaShortfall:m}}function ye(a,n,i){return Number(a*BigInt(n)/i)}function ht(a,n){let i=Number.isFinite(n)?Math.max(0,Math.trunc(n)):0;return a.map(s=>{const l=Number.isFinite(s)?Math.max(0,Math.trunc(s)):0,c=Math.min(l,i);return i-=c,c})}function M(a){return Number.isFinite(a)?Math.max(0,a)/10:0}function ut(a,n){return a.options.find(i=>i.method===n)??null}function xt(a,n){if(!Number.isFinite(a)||a<=0||n<=0n)return null;const i=a/10;return Number(n)/1e18/i}const T="data:image/svg+xml,%3csvg%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Group%201'%3e%3cpath%20id='Vector'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M12%202L22%2012L12%2022L2%2012L12%202ZM12%204.8L19.2%2012L12%2019.2L4.8%2012L12%204.8ZM12%2015.6C12.9548%2015.6001%2013.8705%2015.2209%2014.5457%2014.5459C15.2209%2013.8708%2015.6003%2012.9552%2015.6004%2012.0004C15.6005%2011.0456%2015.2213%2010.1299%2014.5463%209.45471C13.8712%208.7795%2012.9556%208.40011%2012.0008%208.4C11.0461%208.4%2010.1304%208.77928%209.45525%209.45442C8.78012%2010.1295%208.40083%2011.0452%208.40083%2012C8.40083%2012.9548%208.78012%2013.8705%209.45525%2014.5456C10.1304%2015.2207%2011.0461%2015.6%2012.0008%2015.6H12Z'%20fill='white'/%3e%3cg%20id='Rectangle%201'%3e%3c/g%3e%3c/g%3e%3c/svg%3e",we=e.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 12px;
|
|
5
5
|
align-items: stretch;
|
|
6
6
|
width: 100%;
|
|
7
|
-
`,
|
|
7
|
+
`,H=`
|
|
8
8
|
width: 100%;
|
|
9
9
|
min-height: 56px;
|
|
10
10
|
display: flex;
|
|
@@ -36,14 +36,14 @@ import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,w as
|
|
|
36
36
|
cursor: default;
|
|
37
37
|
}
|
|
38
38
|
`,ve=e.button`
|
|
39
|
-
${
|
|
39
|
+
${H}
|
|
40
40
|
background: ${o.gradients.amethyst};
|
|
41
41
|
|
|
42
42
|
&:hover:not(:disabled) {
|
|
43
43
|
filter: brightness(1.08);
|
|
44
44
|
}
|
|
45
45
|
`,N=e.button`
|
|
46
|
-
${
|
|
46
|
+
${H}
|
|
47
47
|
background: ${o.colors.text2};
|
|
48
48
|
|
|
49
49
|
&:hover:not(:disabled) {
|
|
@@ -289,10 +289,10 @@ import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,w as
|
|
|
289
289
|
@media (prefers-reduced-motion: reduce) {
|
|
290
290
|
animation: none;
|
|
291
291
|
}
|
|
292
|
-
`;function mt({auth:a,signer:n,title:i,reason:s,name:l,image:c,icon:p,onAuthorized:h,onCancel:m,onClose:b}){const[y,w]=v.useState(!1),[d,f]=v.useState(null);async function $(){w(!0),f(null);try{await ee({auth:a,signer:n,active:!0}),h()}catch(u){se(u)?f(g("authorizeStep.errorRejected")):(X(u,{flow:"authorize_step",kind:a.kind}),f(g("authorizeStep.errorGeneric"))),w(!1)}}return t.jsx(ze,{onClick:y?void 0:b,role:"presentation",children:t.jsxs(Ae,{onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":i,children:[t.jsxs(We,{children:[t.jsx(Ie,{children:i}),t.jsx(Se,{onClick:b,disabled:y,"aria-label":g("authorizeStep.close"),children:t.jsx(Q,{name:"close",className:"ico"})})]}),t.jsxs(Te,{"data-testid":"authorize-step-row",children:[t.jsx(Ne,{children:c?t.jsx("img",{src:c,alt:""}):p}),t.jsxs(Ee,{children:[t.jsx(Be,{title:l,children:l}),t.jsx(Re,{children:s})]})]}),t.jsx(Le,{children:g("authorizeStep.note")}),t.jsx(re,{message:d}),t.jsxs(Pe,{children:[t.jsx(Fe,{type:"button",onClick:m,disabled:y,children:g("authorizeStep.cancel")}),t.jsx(Ke,{type:"button","data-testid":"authorize-step-action",onClick:()=>void $(),disabled:y,children:y?t.jsxs(t.Fragment,{children:[t.jsx(De,{"aria-hidden":!0}),g("authorizeStep.authorizing")]}):g("authorizeStep.authorize")})]})]})})}async function bt(a){const[n]=await Qe({...a,trades:[a.trade]});return n}async function Qe(a){const{trades:n,buyer:i,signer:s,onSigned:l}=a;if(n.length===0)throw new Error("No items to buy");const c=new Map;for(const h of n){const m=`${h.chainId}:${h.contract.toLowerCase()}`,b=c.get(m);b?b.push(h):c.set(m,[h])}const p=[];for(const h of c.values())p.push(await Ue({trades:h,buyer:i,signer:s,onSigned:l}));return p}async function Ue(a){const{trades:n,buyer:i,signer:s,onSigned:l}=a,c=n[0],p=W(Z(c.contract),c.chainId),h=W(B.MANAToken,c.chainId);await U({auth:{kind:
|
|
292
|
+
`;function mt({auth:a,signer:n,title:i,reason:s,name:l,image:c,icon:p,onAuthorized:h,onCancel:m,onClose:b}){const[y,w]=v.useState(!1),[d,f]=v.useState(null);async function $(){w(!0),f(null);try{await ee({auth:a,signer:n,active:!0}),h()}catch(u){se(u)?f(g("authorizeStep.errorRejected")):(X(u,{flow:"authorize_step",kind:a.kind}),f(g("authorizeStep.errorGeneric"))),w(!1)}}return t.jsx(ze,{onClick:y?void 0:b,role:"presentation",children:t.jsxs(Ae,{onClick:u=>u.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":i,children:[t.jsxs(We,{children:[t.jsx(Ie,{children:i}),t.jsx(Se,{onClick:b,disabled:y,"aria-label":g("authorizeStep.close"),children:t.jsx(Q,{name:"close",className:"ico"})})]}),t.jsxs(Te,{"data-testid":"authorize-step-row",children:[t.jsx(Ne,{children:c?t.jsx("img",{src:c,alt:""}):p}),t.jsxs(Ee,{children:[t.jsx(Be,{title:l,children:l}),t.jsx(Re,{children:s})]})]}),t.jsx(Le,{children:g("authorizeStep.note")}),t.jsx(re,{message:d}),t.jsxs(Pe,{children:[t.jsx(Fe,{type:"button",onClick:m,disabled:y,children:g("authorizeStep.cancel")}),t.jsx(Ke,{type:"button","data-testid":"authorize-step-action",onClick:()=>void $(),disabled:y,children:y?t.jsxs(t.Fragment,{children:[t.jsx(De,{"aria-hidden":!0}),g("authorizeStep.authorizing")]}):g("authorizeStep.authorize")})]})]})})}async function bt(a){const[n]=await Qe({...a,trades:[a.trade]});return n}async function Qe(a){const{trades:n,buyer:i,signer:s,onSigned:l}=a;if(n.length===0)throw new Error("No items to buy");const c=new Map;for(const h of n){const m=`${h.chainId}:${h.contract.toLowerCase()}`,b=c.get(m);b?b.push(h):c.set(m,[h])}const p=[];for(const h of c.values())p.push(await Ue({trades:h,buyer:i,signer:s,onSigned:l}));return p}async function Ue(a){const{trades:n,buyer:i,signer:s,onSigned:l}=a,c=n[0],p=W(Z(c.contract),c.chainId),h=W(B.MANAToken,c.chainId);await U({auth:{kind:_.Allowance,contractAddress:h.address,spenderAddress:p.address,chainId:c.chainId},signer:s});const m=n.map(d=>de(d,i));if(K.enabled)try{const d=new xe(p.abi).encodeFunctionData("accept",[m]),f=te(),$=ne(s.provider,f),u=await pe($,f,d,p,{serverURL:K.relayerUrl});return l==null||l(),await ae(u,"the MANA purchase"),u}catch(d){if(d instanceof he&&d.code===ue.USER_DENIED||d instanceof ie)throw d;console.warn("[buyWithMana] gasless meta-tx failed, falling back to a direct tx:",d)}await oe(s.provider,c.chainId);const y=await new ge(p.address,p.abi,s).accept(m,le(c.chainId));return l==null||l(),(await y.wait()).transactionHash}async function yt(a){const{trade:n,buyer:i,signer:s,credits:l,manaGapWei:c,onBroadcast:p,onReverted:h}=a;if(l.length===0)throw new Error("No credits to spend — use buyWithMana for a MANA-only purchase");if(c<=0n)throw new Error("No MANA gap to cover — use buyWithCredits for a credits-only purchase");const m=W(B.MANAToken,n.chainId),b=W(B.CreditsManager,n.chainId);await U({auth:{kind:_.Allowance,contractAddress:m.address,spenderAddress:b.address,chainId:n.chainId},signer:s});const w=(l.reduce((d,f)=>d+BigInt(f.availableAmount),0n)+c).toString();return ce({trade:n,buyer:i,signer:s,credits:l,maxCreditedValue:w,onBroadcast:p,onReverted:h})}function wt(a){return t.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,...a,children:t.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})}function vt(a){return t.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,...a,children:[t.jsx("path",{d:"M12 3L2 20h20L12 3z",fill:"none",stroke:"#691fa9",strokeWidth:"1.8",strokeLinejoin:"round"}),t.jsx("path",{d:"M12 9v5",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),t.jsx("circle",{cx:"12",cy:"17",r:"1.1",fill:"#691fa9"})]})}const{colors:r,gradients:O,radius:V,z:_e}=o,kt=e.div`
|
|
293
293
|
position: fixed;
|
|
294
294
|
inset: 0;
|
|
295
|
-
z-index: ${
|
|
295
|
+
z-index: ${_e.overlay};
|
|
296
296
|
display: flex;
|
|
297
297
|
overflow-y: auto;
|
|
298
298
|
padding: 20px;
|
|
@@ -422,7 +422,7 @@ import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,w as
|
|
|
422
422
|
color: ${r.text};
|
|
423
423
|
overflow: hidden;
|
|
424
424
|
text-overflow: ellipsis;
|
|
425
|
-
`,Pt=e(
|
|
425
|
+
`,Pt=e(q)`
|
|
426
426
|
font-size: 10px;
|
|
427
427
|
line-height: 1.43;
|
|
428
428
|
color: ${r.muted};
|
|
@@ -461,7 +461,7 @@ import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,w as
|
|
|
461
461
|
`,Ut=e.div`
|
|
462
462
|
display: flex;
|
|
463
463
|
gap: 12px;
|
|
464
|
-
`,
|
|
464
|
+
`,_t=e.button`
|
|
465
465
|
flex: 1;
|
|
466
466
|
height: 109px;
|
|
467
467
|
border: 1px solid ${r.muted2};
|
|
@@ -477,7 +477,7 @@ import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,w as
|
|
|
477
477
|
&[data-on] {
|
|
478
478
|
border: 4px solid ${r.magenta};
|
|
479
479
|
}
|
|
480
|
-
`,
|
|
480
|
+
`,Ht=e(k)`
|
|
481
481
|
width: 24px;
|
|
482
482
|
height: 24px;
|
|
483
483
|
background: ${r.text};
|
|
@@ -509,7 +509,7 @@ import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,w as
|
|
|
509
509
|
font-size: 14px;
|
|
510
510
|
font-weight: 600;
|
|
511
511
|
color: ${r.muted1};
|
|
512
|
-
`,
|
|
512
|
+
`,qt=e.div`
|
|
513
513
|
position: sticky;
|
|
514
514
|
bottom: 0;
|
|
515
515
|
display: flex;
|
|
@@ -517,7 +517,7 @@ import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,w as
|
|
|
517
517
|
margin-top: -8px;
|
|
518
518
|
padding-top: 8px;
|
|
519
519
|
background: ${r.white};
|
|
520
|
-
`,
|
|
520
|
+
`,Jt=e.button`
|
|
521
521
|
flex: 1;
|
|
522
522
|
/* Let the CTAs shrink so their min-content can't widen the modal past the viewport on mobile. */
|
|
523
523
|
min-width: 0;
|
|
@@ -665,7 +665,7 @@ import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,w as
|
|
|
665
665
|
text-align: center;
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
|
-
`,{colors:I,media:A}=o,
|
|
668
|
+
`,{colors:I,media:A}=o,He=e.section`
|
|
669
669
|
margin-top: 40px;
|
|
670
670
|
`,Oe=e.div`
|
|
671
671
|
display: flex;
|
|
@@ -773,13 +773,13 @@ import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,w as
|
|
|
773
773
|
${A.maxWidth("sm")} {
|
|
774
774
|
grid-auto-columns: calc((100% - 16px) / 2);
|
|
775
775
|
}
|
|
776
|
-
`,
|
|
776
|
+
`,qe=e.div`
|
|
777
777
|
display: flex;
|
|
778
778
|
align-items: center;
|
|
779
779
|
justify-content: center;
|
|
780
780
|
gap: 8px;
|
|
781
781
|
margin-top: 18px;
|
|
782
|
-
`,
|
|
782
|
+
`,Je=e.button`
|
|
783
783
|
width: 10px;
|
|
784
784
|
height: 10px;
|
|
785
785
|
border-radius: 50%;
|
|
@@ -801,4 +801,4 @@ import{j as t,r as v}from"./react-DehiWSvs.js";import{s as e,t as o,b as g,w as
|
|
|
801
801
|
opacity: 1;
|
|
802
802
|
transform: scale(1.1);
|
|
803
803
|
}
|
|
804
|
-
`;function ln({title:a,items:n,onViewAll:i}){const s=v.useRef(null),[l,c]=v.useState(1),[p,h]=v.useState(0),[m,b]=v.useState(!0),[y,w]=v.useState(!1),d=v.useCallback(()=>{const u=s.current;if(!u)return;const{scrollLeft:x,scrollWidth:L,clientWidth:S}=u,P=Math.max(1,Math.ceil(L/S));c(P),h(Math.min(P-1,Math.round(x/S))),b(x<=1),w(x+S>=L-1)},[]);if(v.useEffect(()=>{d();const u=s.current;if(u)return u.addEventListener("scroll",d,{passive:!0}),window.addEventListener("resize",d),()=>{u.removeEventListener("scroll",d),window.removeEventListener("resize",d)}},[d,n.length]),n.length===0)return null;function f(u){const x=s.current;x&&x.scrollBy({left:u*x.clientWidth,behavior:"smooth"})}function $(u){const x=s.current;x&&x.scrollTo({left:u*x.clientWidth,behavior:"smooth"})}return t.jsxs(
|
|
804
|
+
`;function ln({title:a,items:n,onViewAll:i}){const s=v.useRef(null),[l,c]=v.useState(1),[p,h]=v.useState(0),[m,b]=v.useState(!0),[y,w]=v.useState(!1),d=v.useCallback(()=>{const u=s.current;if(!u)return;const{scrollLeft:x,scrollWidth:L,clientWidth:S}=u,P=Math.max(1,Math.ceil(L/S));c(P),h(Math.min(P-1,Math.round(x/S))),b(x<=1),w(x+S>=L-1)},[]);if(v.useEffect(()=>{d();const u=s.current;if(u)return u.addEventListener("scroll",d,{passive:!0}),window.addEventListener("resize",d),()=>{u.removeEventListener("scroll",d),window.removeEventListener("resize",d)}},[d,n.length]),n.length===0)return null;function f(u){const x=s.current;x&&x.scrollBy({left:u*x.clientWidth,behavior:"smooth"})}function $(u){const x=s.current;x&&x.scrollTo({left:u*x.clientWidth,behavior:"smooth"})}return t.jsxs(He,{children:[t.jsxs(Oe,{children:[t.jsx(Ve,{children:a}),i?t.jsxs(Ge,{onClick:i,children:[g("collectionCarousel.viewAll"),t.jsx(Ye,{name:"chevron-down",size:16})]}):null]}),t.jsxs(Xe,{children:[t.jsx(D,{"data-side":"left",onClick:()=>f(-1),"aria-label":g("collectionCarousel.scrollLeft"),disabled:m,children:t.jsx("img",{src:F,alt:"","aria-hidden":!0})}),t.jsx(Ze,{ref:s,children:n.map(u=>t.jsx(J,{item:u},u.id))}),t.jsx(D,{"data-side":"right",onClick:()=>f(1),"aria-label":g("collectionCarousel.scrollRight"),disabled:y,children:t.jsx("img",{src:F,alt:"","aria-hidden":!0})})]}),l>1?t.jsx(qe,{"aria-label":g("collectionCarousel.pages"),children:Array.from({length:l}).map((u,x)=>t.jsx(Je,{"data-active":x===p||void 0,"aria-label":g("collectionCarousel.goToPage",{page:x+1}),"aria-current":x===p?"true":void 0,onClick:()=>$(x)},x))}):null]})}export{M as $,Et as A,Wt as B,jt as C,Ot as D,Vt as E,Gt as F,Yt as G,Ct as H,Xt as I,Zt as J,pt as K,en as L,kt as M,lt as N,ln as O,gt as P,mt as Q,T as R,$t as S,zt as T,dt as U,ft as V,Dt as W,At as X,Qe as Y,ht as Z,be as _,Mt as a,cn as a0,dn as a1,bt as a2,ut as a3,yt as a4,wt as b,It as c,St as d,Tt as e,Nt as f,tn as g,nn as h,an as i,qt as j,Jt as k,on as l,xt as m,sn as n,rn as o,vt as p,Qt as q,Bt as r,Rt as s,Lt as t,Pt as u,Ft as v,Kt as w,Ut as x,_t as y,Ht as z};
|