@dcl/shop 0.1.0-30362033606.commit-6679fb7 → 0.1.0-30362815497.commit-35ecdbf
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-DYOikZol.js +291 -0
- package/assets/{AnimatedBackground-iEufGyJM.js → AnimatedBackground-HX4woz1t.js} +1 -1
- package/assets/{Assets-D_qxhH0_.js → Assets-trIla3fm.js} +3 -3
- package/assets/{Assets.styles-CLuTJVZD.js → Assets.styles-BN81sFiL.js} +1 -1
- package/assets/{Authorizations-GHs_v1B1.js → Authorizations-9b3idzYV.js} +1 -1
- package/assets/{Button-BhJV9mDs.js → Button-BeodHck0.js} +1 -1
- package/assets/{Cart-CruglxJv.js → Cart-DgJ2dSls.js} +1 -1
- package/assets/{CircularProgress-epyn6nc6.js → CircularProgress-DBX8-bxs.js} +1 -1
- package/assets/{Collection-Djuc0POi.js → Collection-BoptXS-5.js} +1 -1
- package/assets/{CollectionCarousel-DKG8cPgV.js → CollectionCarousel-Dsbypx_Q.js} +5 -5
- package/assets/{Creator-eSug8_TQ.js → Creator-Bt88BMiE.js} +1 -1
- package/assets/{ExchangeController-Ct4Ki5nB.js → ExchangeController-Bh5MbgEF.js} +1 -1
- package/assets/{GetCredits-XtvdCK97.js → GetCredits-CbPLtnWt.js} +1 -1
- package/assets/{HelpersUtil-CYSRpIiK.js → HelpersUtil-Bj2jMRhF.js} +1 -1
- package/assets/{ImportListings-BqR-zEJR.js → ImportListings-Dza88Ul5.js} +1 -1
- package/assets/{ItemDetail-AWy_u3GL.js → ItemDetail-BrPctSLd.js} +138 -138
- package/assets/{LoadMore-BTQZzU_a.js → LoadMore-Cp-E67xI.js} +1 -1
- package/assets/{MarketCheckout-rGu14iiZ.js → MarketCheckout-ClTJqeTN.js} +1 -1
- package/assets/{MenuList-BF1nXMBL.js → MenuList-CGv6Hx3E.js} +1 -1
- package/assets/{MyAssets-crgNspr4.js → MyAssets-CCRHQYFa.js} +1 -1
- package/assets/{MyFavorites-DSuisiq3.js → MyFavorites-CdD42WhZ.js} +1 -1
- package/assets/{NotFound-B8sPg1gR.js → NotFound-C-faFC1M.js} +1 -1
- package/assets/{NotificationsBell-c4MiNFUe.js → NotificationsBell-BoZQHliJ.js} +1 -1
- package/assets/{StoreSettings-HSUnq4XZ.js → StoreSettings-LxpZbXrk.js} +1 -1
- package/assets/{Success-rVm2tk33.js → Success-DuDT9YWk.js} +1 -1
- package/assets/{SwapController-FYPbMPBT.js → SwapController-DCarrY7n.js} +1 -1
- package/assets/{Tooltip-CRNJUi7h.js → Tooltip-QUx-0PAd.js} +1 -1
- package/assets/{TradeService-BMX7g6F3.js → TradeService-WOpUOCj5.js} +1 -1
- package/assets/{W3MFrameProviderSingleton-Bo3pJwFX.js → W3MFrameProviderSingleton-DvD-aezH.js} +3 -3
- package/assets/{WebCryptoP256-YM8V8hE_.js → WebCryptoP256-KHg0PT8E.js} +1 -1
- package/assets/{authorizations-B3unAuyK.js → authorizations-CUAi4uqJ.js} +1 -1
- package/assets/{basic-CqYT-xKy.js → basic-Bf_YtlYZ.js} +1 -1
- package/assets/{biconomy-DdUJ1TI6.js → biconomy-ClJBQv0E.js} +1 -1
- package/assets/{builder-0ySmkHq4.js → builder-BFcfggvn.js} +1 -1
- package/assets/{buy-G_ozgV7F.js → buy-Tme1UHVf.js} +1 -1
- package/assets/{buy-gasless-Mzedr7ex.js → buy-gasless-BdW9VEKq.js} +1 -1
- package/assets/{cart-checkout-BWnjrd9o.js → cart-checkout-D8_UxnB9.js} +1 -1
- package/assets/{categories-Es6QIUbi.js → categories-CV5P_HZd.js} +1 -1
- package/assets/{ccip-CbLx66OQ.js → ccip-BQ1iXCKX.js} +1 -1
- package/assets/{ccip-CQ3kYqry.js → ccip-Dt6AwyXx.js} +1 -1
- package/assets/{collection-CUUdfXnW.js → collection-CHWj8iQW.js} +1 -1
- package/assets/{controller-BBOeHMtg.js → controller-DINKBWbu.js} +2 -2
- package/assets/{core-DuCtOV4j.js → core-BAP8R3XC.js} +4 -4
- package/assets/{custom-Dux_cR5y.js → custom--eKw29PB.js} +1 -1
- package/assets/{data-capture-BtkbB29s.js → data-capture-B1VKtAVM.js} +1 -1
- package/assets/{email-CQ3uWiN7.js → email-BLadXpqP.js} +1 -1
- package/assets/{embedded-wallet-D6ThwibN.js → embedded-wallet-BcP4ehoH.js} +1 -1
- package/assets/{emotion-styled.browser.esm-rdVqxNso.js → emotion-styled.browser.esm-CWNG-OnU.js} +1 -1
- package/assets/{engine-BbDeZ4M-.js → engine-DNXrnXBq.js} +1 -1
- package/assets/{errors-B3QlpNKh.js → errors-DCLH44Ym.js} +1 -1
- package/assets/{estimate-l1-fee-DnuQRU3q.js → estimate-l1-fee-qYVfWmvo.js} +1 -1
- package/assets/{execute-CuvSUGCv.js → execute-DZFWrHQq.js} +2 -2
- package/assets/{features-C5pmu6GA.js → features-CU8DRP_5.js} +1 -1
- package/assets/{fetchTokenMetadata-Vkw7Qayd.js → fetchTokenMetadata-qukyHCda.js} +2 -2
- package/assets/{get-ecosystem-wallet-info-y1X5AZ_K.js → get-ecosystem-wallet-info-CE-anDO0.js} +1 -1
- package/assets/{getBalance-BBhNKCqJ.js → getBalance-BYFNEbEM.js} +1 -1
- package/assets/{getNFT-CqpZBPAh.js → getNFT-2J_9TTUS.js} +1 -1
- package/assets/{getNFT-Bs83vt27.js → getNFT-CozT-FPO.js} +1 -1
- package/assets/{getThemeProps-C13FKFea.js → getThemeProps-G_RkUSWj.js} +1 -1
- package/assets/{hashTypedData-DdM26gim.js → hashTypedData-COw4MIw7.js} +1 -1
- package/assets/{hashTypedData-CRyVzapS.js → hashTypedData-Shyia_b5.js} +1 -1
- package/assets/{import-DRcmHaW1.js → import-BgvjaGsU.js} +1 -1
- package/assets/{in-app-BvBGB6Fh.js → in-app-h5Z8xJLI.js} +1 -1
- package/assets/{in-app-wallet-calls-B-BvRXhc.js → in-app-wallet-calls-DndrTTgL.js} +1 -1
- package/assets/{index-DV0XdLTX.js → index-0df2_JuN.js} +1 -1
- package/assets/{index-D1MCC2DS.js → index-5TQ09pWW.js} +1 -1
- package/assets/{index-D2Zsvd3f.js → index-8yB_Vwf0.js} +1 -1
- package/assets/{index-wC0QnbPi.js → index-B-7JnJnf.js} +1 -1
- package/assets/{index-CZsWD06k.js → index-B-IGbYzs.js} +1 -1
- package/assets/{index-YP58zh-H.js → index-B20SJjGI.js} +1 -1
- package/assets/{index-Dai5XPjM.js → index-BSeusSHl.js} +31 -31
- package/assets/{index-Bthwkhf8.js → index-BkDBPQKr.js} +1 -1
- package/assets/{index-CpCOc_0i.js → index-BrDLym1R.js} +2 -2
- package/assets/{index-CH_NAbJs.js → index-C4-ffFyv.js} +1 -1
- package/assets/{index-BURKzVS1.js → index-C97Z675S.js} +1 -1
- package/assets/{index-BtE-jNvg.js → index-CF84ORMp.js} +1 -1
- package/assets/{index-BYonXszl.js → index-CFFpa2x2.js} +1 -1
- package/assets/{index-D-WoE9lZ.js → index-CFuHjg6U.js} +1 -1
- package/assets/{index-ClCqW_rO.js → index-CNI9E71C.js} +1 -1
- package/assets/{index-BJ86ZwVJ.js → index-CPpRxy1r.js} +1 -1
- package/assets/{index-Bn4g5O31.js → index-CQzsOUTd.js} +1 -1
- package/assets/{index-CBZo3NZq.js → index-CkyS_Z8N.js} +1 -1
- package/assets/{index-BX_i57O_.js → index-ClGkpWPa.js} +2 -2
- package/assets/{index-BgyvxrzE.js → index-CnqcuprG.js} +3 -3
- package/assets/{index-B5I913jj.js → index-CpnWgZnn.js} +3 -3
- package/assets/{index-CsB5T8lQ.js → index-Cr75_Qxi.js} +1 -1
- package/assets/{index-a5aMOiol.js → index-Cs14qqbg.js} +1 -1
- package/assets/{index-2MAAQV09.js → index-CuziAoAD.js} +1 -1
- package/assets/{index-H3CdymL9.js → index-CxnwYMKU.js} +1 -1
- package/assets/{index-B4z3h9SS.js → index-D-DRci2G.js} +1 -1
- package/assets/{index-BkuRUv0H.js → index-D-sEcKqr.js} +1 -1
- package/assets/{index-4i696-lE.js → index-D2m2DNID.js} +1 -1
- package/assets/{index-DlO08MsL.js → index-D6_4iqAn.js} +2 -2
- package/assets/{index-DA2_HcoB.js → index-DIlrszNn.js} +1 -1
- package/assets/{index-BUjNpZOK.js → index-DLY0JksW.js} +1 -1
- package/assets/{index-ByGwjpMp.js → index-DLsq0JOY.js} +1 -1
- package/assets/{index-BMVr9JEp.js → index-DQWUa_ga.js} +1 -1
- package/assets/{index-CzQl6pS8.js → index-DSv4T_PT.js} +1 -1
- package/assets/{index-DNjpXMun.js → index-DZwpOX3I.js} +1 -1
- package/assets/{index-DhSu6yft.js → index-Dj-l-ING.js} +1 -1
- package/assets/{index-NezN4_GC.js → index-Dj9Oj7O6.js} +1 -1
- package/assets/{index-D1vVk8OZ.js → index-DonfdwAp.js} +1 -1
- package/assets/{index-DfCBTENl.js → index-DySNHqeZ.js} +1 -1
- package/assets/{index-Dlx6rt2u.js → index-FJnVr04j.js} +1 -1
- package/assets/{index-dg4grBtF.js → index-PrsXxs3B.js} +2 -2
- package/assets/{index-p57r9lnj.js → index-RTTHiCT2.js} +1 -1
- package/assets/{index-zv5mxAYx.js → index-TRWztzJI.js} +1 -1
- package/assets/{index-C_brH2k2.js → index-_DXp_lqm.js} +1 -1
- package/assets/{index-B7JI7ldm.js → index-a0GqAWet.js} +1 -1
- package/assets/{index-CL6c3iVg.js → index-iGJTuv1I.js} +3 -3
- package/assets/{index-BAGLKm-V.js → index-isk6Q4SE.js} +1 -1
- package/assets/{index-DFnEt9BN.js → index-m8asLu1c.js} +1 -1
- package/assets/{index-BHxCSgWX.js → index-rsuER-il.js} +1 -1
- package/assets/{index-CAs9TZEG.js → index-vYDwCibh.js} +1 -1
- package/assets/{index-DZr0hKxc.js → index-zSTykcGn.js} +1 -1
- package/assets/{index.es-B9qRsTw5.js → index.es-CsQSB3db.js} +4 -4
- package/assets/{index.es-d7QjqFps.js → index.es-CsZiAUYy.js} +1 -1
- package/assets/{index.es-CC0hx--A.js → index.es-Do3Y7r2K.js} +1 -1
- package/assets/{localBatchGatewayRequest-BGKFudjd.js → localBatchGatewayRequest-CbxoLL2f.js} +1 -1
- package/assets/{mana-rate-Dh0XRmbf.js → mana-rate-BJbe6lgb.js} +1 -1
- package/assets/{networks-CJHR4Hzo.js → networks-Dpsd0s9-.js} +1 -1
- package/assets/{onramp-DCythIMd.js → onramp-DaQ4owbO.js} +1 -1
- package/assets/{openzeppelin-CvXZ_iOn.js → openzeppelin-6LOIfZsS.js} +1 -1
- package/assets/{parseNft-CFMan3R8.js → parseNft-DM4WbrF2.js} +2 -2
- package/assets/{parseSignature-BFD_ILq0.js → parseSignature-CJECbqyJ.js} +1 -1
- package/assets/{parseSignature-B2ae5H_l.js → parseSignature-DJ5B7dkH.js} +3 -3
- package/assets/{passkeys-CTuv_5P6.js → passkeys-D0bGzkR-.js} +1 -1
- package/assets/{pay-with-exchange-CWNTkcKw.js → pay-with-exchange-DGD6NZUT.js} +1 -1
- package/assets/{qr-overlay-iuHA89Qf.js → qr-overlay-C57bRh8h.js} +1 -1
- package/assets/{receive-DjFemyyC.js → receive-Dig0fUc0.js} +1 -1
- package/assets/{resolveImplementation-DYl32KDg.js → resolveImplementation-D_fazAjd.js} +1 -1
- package/assets/{rpc-Cx_JL8Xb.js → rpc-ChD_4MbV.js} +1 -1
- package/assets/{secp256k1-CltAnO7K.js → secp256k1-BClwNS_R.js} +1 -1
- package/assets/{secp256k1-CPWzTneR.js → secp256k1-CJyNFsNt.js} +1 -1
- package/assets/{secp256k1-B7JhrCDg.js → secp256k1-N6PNU3bA.js} +1 -1
- package/assets/{send-BrpjMOTP.js → send-DAWm3Jv2.js} +1 -1
- package/assets/{send-batch-transaction-CbDS0Qog.js → send-batch-transaction-Dg_fuCoW.js} +1 -1
- package/assets/{send-eip712-transaction-CTcgkhR6.js → send-eip712-transaction-BfQDidJ0.js} +2 -2
- package/assets/{send-gasless-transaction-DbFAFDf9.js → send-gasless-transaction-ZUIH6xn8.js} +2 -2
- package/assets/{send-transaction-B7OJlw7I.js → send-transaction-CfoJI6V6.js} +2 -2
- package/assets/{sendMetaTransaction-r8fzkVlB.js → sendMetaTransaction-DEU_Xtzf.js} +1 -1
- package/assets/{sendRawTransaction-DsHI9qgM.js → sendRawTransaction-ZYIm5xd5.js} +3 -3
- package/assets/{serializeTransaction-xwHKCWao.js → serializeTransaction-CzSGVGz4.js} +1 -1
- package/assets/{session-proposal-IxK8YbH3.js → session-proposal-B0DQCL8Q.js} +1 -1
- package/assets/{session-request-DVsQQiDu.js → session-request-D7PK8aVZ.js} +2 -2
- package/assets/{signing-DG3xJRlW.js → signing-B8VyPC00.js} +3 -3
- package/assets/{socials-BwXT1X55.js → socials-KoDapNpC.js} +1 -1
- package/assets/{swaps-BH6mkFik.js → swaps-BlxZRFZr.js} +1 -1
- package/assets/{thirdweb-BVpV6K-m.js → thirdweb-DJf-EEOv.js} +3 -3
- package/assets/{to-serializable-transaction-CjhXjs-A.js → to-serializable-transaction-B1lQjM9d.js} +2 -2
- package/assets/{trade-encoding-DyS_yWBn.js → trade-encoding-DXoI04Mc.js} +1 -1
- package/assets/{transactionReceipt-rNz8j7SE.js → transactionReceipt-kDTd5JL7.js} +1 -1
- package/assets/{transactions-Bmo025ie.js → transactions-CehNE2A8.js} +1 -1
- package/assets/{useCreditPacks-lMN2Cy0g.js → useCreditPacks-Dg3_30xn.js} +1 -1
- package/assets/{useInfiniteGrid-rJdstFin.js → useInfiniteGrid-dBP53DpO.js} +1 -1
- package/assets/useManaRate-CY5PbqWB.js +1 -0
- package/assets/{useStore-DkvGYgqc.js → useStore-Duh496VH.js} +1 -1
- package/assets/{useTheme-BWX-jis-.js → useTheme-BRdkaoFm.js} +1 -1
- package/assets/{verifyHash-CwPWQPwT.js → verifyHash-PdDaV25N.js} +1 -1
- package/assets/{w3m-modal-C1Ym3Jda.js → w3m-modal-Bt6VN9EP.js} +1 -1
- package/assets/{w3m-modal-D2-gzhTC.js → w3m-modal-CywSQTgA.js} +1 -1
- package/assets/{wait-for-tx-receipt-CDninVEz.js → wait-for-tx-receipt-Cw3p4OOt.js} +1 -1
- package/assets/{wallets-CrqEt-GS.js → wallets-BqGvfAVQ.js} +5 -5
- package/assets/{web-connector-DQoPqph2.js → web-connector-CwUgIh1D.js} +3 -3
- package/assets/{writeContract-eGc70oTI.js → writeContract-BCO99ptR.js} +1 -1
- package/assets/{zoraTestnet-DYX03m-Z.js → zoraTestnet-81flFamw.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/assets/Activity-BLNPi_3I.js +0 -287
- package/assets/useManaRate-DLQBcAci.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,r as j,a as pa,u as _a,L as te}from"./react-B36MyIP_.js";import{t,k as K,m as G,ak as ga,h as ba,ai as P,Q as Ue,e as fa,u as va,w as xa,x as Ca,al as ja,am as ka,I as A,an as Na,l as wa,j as Ma,ao as Oe,E as B,ap as $e,aq as Sa,J as O,b as qa,D as Ve,y as pe,ar as _e,G as se,F as De,g as ne,a as Pa,C as ge,c as Ge,as as Aa}from"./index-Dai5XPjM.js";import{P as Ye,m as Xe,W as Ia,c as be,t as Ra,C as Fa,A as Ta,a as Ea,s as He,i as Wa,b as La,d as Ba,e as Ka}from"./CollectionCarousel-DKG8cPgV.js";import{u as Qa}from"./useManaRate-DLQBcAci.js";import{u as Je,r as za}from"./mana-rate-Dh0XRmbf.js";import{a as Ua,j as Oa,h as $a,n as Va,i as Da,A as Ga}from"./authorizations-B3unAuyK.js";import{a as fe}from"./buy-G_ozgV7F.js";import{a as Ha,w as Ja,S as Ya,G as Xa}from"./buy-gasless-Mzedr7ex.js";import{R as re,r as Za}from"./cart-checkout-BWnjrd9o.js";import{u as et,M as at,c as tt}from"./useCreditPacks-lMN2Cy0g.js";import{l as st}from"./loader-logo-BzY9EKdC.js";import{i as nt,a as rt}from"./errors-B3QlpNKh.js";import{E as ct}from"./ErrorNotice-D_Z5OVFI.js";import"./sentry-gZJVwIqQ.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BteKixT0.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-DyS_yWBn.js";import"./sendMetaTransaction-r8fzkVlB.js";const it="https://cdn.decentraland.org/@dcl/shop/0.1.0-30362033606.commit-6679fb7/assets/buy-error-22UunaPC.png";function ot(c){const{phase:o,balanceCredits:C,onClose:N}=c,I=o==="processing",T=o==="error"?t("cartCheckout.errorTitle"):o==="nofunds"?t("cartCheckout.titleNoFunds"):o==="choose"?t("buyModal.choosePayment"):t("cartCheckout.titleBuy"),E=o==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":t("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:I?void 0:N,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${E?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:T}),!I&&e.jsx("button",{className:"buy-modal__x",onClick:N,"aria-label":t("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:o==="nofunds"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(K,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:G(C)})]})]}),o==="choose"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"cart-checkout__choose-total",children:[e.jsx("span",{children:t("cart.purchaseSummary")}),e.jsxs("strong",{children:[e.jsx(K,{className:"buy-modal__balance-ico"}),G(c.totalCredits??0)]})]}),e.jsx(Ye,{options:c.options??[],totalCents:c.totalCents??0,onPay:c.onPay??(()=>{}),rateNote:(()=>{const M=Xe(c.totalCents??0,c.totalManaWei??0n);return M!=null?t("buyModal.manaRate",{mana:M.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),o==="processing"&&e.jsx(lt,{stage:c.stage??"reserving",step:c.step??1,total:c.total??1,isSelfCustody:!!c.isSelfCustody}),o==="nofunds"&&e.jsx(dt,{lines:c.lines??[],shortfallCredits:c.shortfallCredits??0,packs:c.packs??[],selectedPack:c.selectedPack??"",onSelectPack:c.onSelectPack??(()=>{}),onBuyPacks:c.onBuyPacks??(()=>{}),onCancel:N}),o==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-error",children:[e.jsx("img",{className:"buy-error__art",src:it,alt:"",width:64,height:80}),e.jsxs("p",{className:"buy-error__text",children:[e.jsx("b",{children:t("cartCheckout.errorHeadline")})," ",t("cartCheckout.errorBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:N,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:c.onRetry??N,children:t("cartCheckout.tryAgain")})]})]})]})]})}function lt({stage:c,step:o,total:C,isSelfCustody:N}){const I=c==="reserving",T=C>0?Math.min(100,Math.round(o/C*100)):0,E=c==="awaiting-signature"?N?t("buyModal.confirmToContinue"):t("buyModal.completingTransaction"):c==="settling"?t("buyModal.completingTransaction"):t("cartCheckout.preparing");return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:st,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:E}),I?e.jsxs("div",{className:"cart-checkout__progress-row",children:[e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill buy-modal__progress-fill--step",style:{width:`${T}%`}})}),C>1?e.jsxs("span",{className:"cart-checkout__step",children:[o,"/",C]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function dt({lines:c,shortfallCredits:o,packs:C,selectedPack:N,onSelectPack:I,onBuyPacks:T,onCancel:E}){const M=C.find(n=>n.id===N),ie=c.reduce((n,q)=>n+(q.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(Ia,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:t("buyModal.insufficientFunds")})," ",t("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:t("buyModal.warningCreditsAmount",{count:Math.max(0,o)})})," ",t("buyModal.warningToPurchase",{count:ie})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:c.map(n=>{const q=n.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:n.item.thumbnail?e.jsx("img",{src:n.item.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"buy-modal__asset-name",title:n.item.name,children:[n.item.name||t("buyModal.itemFallback"),q>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:t("cartCheckout.qty",{count:q})}):null]}),n.item.creator?e.jsx(ga,{address:n.item.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(K,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:G(n.priceCredits*q)})]})]})]},n.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:C.map(n=>{const q=n.id===N;return e.jsxs("button",{className:`buy-modal__pack${q?" buy-modal__pack--on":""}`,onClick:()=>I(n.id),children:[e.jsx(K,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:G(n.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(K,{className:"buy-modal__total-ico"}),e.jsx("span",{children:G((M==null?void 0:M.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((M==null?void 0:M.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:E,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:T,children:t("buyModal.buy")})]})]})}function ve(c){if(nt(c))return t("errors.rejected");const o=(c.message??"").toLowerCase();return o.includes("insufficient")?t("cart.error.insufficient",{currency:qa.name}):o.includes("no active listing")||o.includes("your own listing")?t("cart.error.listingChanged"):t("marketCheckout.error.generic")}const ut=12e4;function ht(c){const o=[];return c.unavailable.length&&o.push(t("cart.drop.unavailable",{count:c.unavailable.length})),c.own.length&&o.push(t("cart.drop.own",{count:c.own.length})),t("cart.drop.removed",{items:o.join(` ${t("cart.drop.and")} `)})}const xe=c=>c.reduce((o,C)=>o+C.priceCredits*C.quantity,0),ce=c=>c.flatMap(o=>Array.from({length:o.quantity},()=>({...o,quantity:1})));function It(){ba({title:t("nav.cart"),noindex:!0});const c=P(a=>a.items),o=P(a=>a.remove),C=P(a=>a.increment),N=P(a=>a.decrement),I=P(a=>a.clear),T=P(a=>a.restore),E=P(a=>a.setFittingOpen),M=Ue(a=>a.items),ie=Ue(a=>a.toggle),{session:n,signIn:q}=fa(),H=et().packs.slice(0,at);j.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const Ze=c.some(a=>a.category!=="emote"),{data:oe}=va({queryKey:["upsell-listings"],queryFn:()=>Aa({first:40}),staleTime:6e4}),{data:f}=xa(n),y=Ca(),Q=pa(),{state:W}=_a(),[ea,$]=j.useState(null),[Ce,J]=j.useState(null),[aa,S]=j.useState(!1),[w,L]=j.useState(null),je=j.useRef(0),[u,g]=j.useState(null),{data:V}=ja(n),{data:le}=Qa(!0),[de,ke]=j.useState(""),D=j.useRef(null),Ne=ka(c),we=a=>Oe(Ne[a.id]),ue=c.filter(we),he=c.length>0&&ue.length===0,ta=ue.reduce((a,s)=>a+s.priceCredits*s.quantity,0),sa=c.reduce((a,s)=>a+s.quantity,0),na=ue.reduce((a,s)=>a+s.quantity,0),Me=w?w.liveTotalCredits:ta,ra=new Set(c.map(a=>a.id)),Se=((oe==null?void 0:oe.items)??[]).filter(a=>!ra.has(a.id)).slice(0,12),ca=new Map(w==null?void 0:w.buyable.map(a=>[a.item.id,a])),Y=(f==null?void 0:f.credits)??0,X=Me*10,qe=le?Je(X,le):0n,Z=be({priceCents:X,priceManaWei:qe,balanceCents:(f==null?void 0:f.balanceCents)??0,manaBalanceWei:V??0n}),Pe=Xe(X,qe),Ae=Pe!=null?t("buyModal.manaRate",{mana:Pe.toLocaleString("en",{maximumFractionDigits:2})}):null,ia=Sa;function ee(a){a(),L(null),J(null),$(null)}function oa(){g(null),S(!1)}function Ie(a){const s=xe(a),i=Math.max(0,s-Y),r=H.find(l=>l.credits>=i)??H[H.length-1];ke(r.id),B("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:s,credits_balance:Y,shortfall:i}),g({phase:"nofunds",lines:a.map(l=>({item:l.item,priceCredits:l.priceCredits,quantity:l.quantity})),shortfall:i}),S(!1)}async function me(a){if(!n||a.length===0)return;const s=ce(a),i=s.map(m=>({...m.item,priceCredits:m.priceCredits})),r=a.map(m=>({...m.item,priceCredits:m.priceCredits,quantity:m.quantity})),l=[];let d="authorize",p=!1;g({phase:"processing",stage:"reserving",step:1,total:s.length});try{const m=[];for(let x=0;x<s.length;x++){const b=s[x];g({phase:"processing",stage:"reserving",step:x+1,total:s.length});try{const{credit:v,maxCreditedValue:U}=await Ve(n.identity,b.usdCents,b.trade.id);l.push(v.id),m.push({trade:b.trade,credits:[v],maxCreditedValue:U})}catch(v){if(rt(v)){if(l.length){try{await pe(n.identity,l)}catch(U){O(U,{flow:"cart_checkout",step:"release"})}y.invalidateQueries({queryKey:["usd-balance"]})}Ie(a);return}throw v}}d="submit";const k=()=>g({phase:"processing",stage:"settling",step:s.length,total:s.length});g({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});let _=[];if(Ua())try{_=await Ha({purchases:m,buyer:n.address,signer:n.signer,onSigned:k});const b=(await Promise.allSettled(_.map(v=>Ja(v)))).flatMap(v=>v.status==="rejected"?[v.reason]:[]);if(b.length&&!b.some(v=>v instanceof Ya))throw b[0];p=!0}catch(x){if(!(x instanceof Xa))throw x;_=await fe({purchases:m,buyer:n.address,signer:n.signer,onSigned:k})}else _=await fe({purchases:m,buyer:n.address,signer:n.signer});a.forEach(x=>o(x.item.id)),L(null),B("Shop Completed Purchase",{..._e(i),payment_type:"credits",no_crypto_step:p,transaction_hash:_[0]??null}),Wa(y);const h=D.current;D.current=null,g(null),S(!1);const F={items:r,txHash:_[0]??void 0,settled:!0,...h?{creditsAdded:h}:{}};Q("/success",{state:F,replace:!0})}catch(m){if(se(m)||O(m,{flow:"cart_checkout",step:d,cart_size:a.length}),B(se(m)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:d,error_code:De(m),value_usd:$e(i.reduce((k,_)=>k+_.priceCredits,0)),cart_size:s.length}),l.length){try{await pe(n.identity,l)}catch(k){O(k,{flow:"cart_checkout",step:"release"})}y.invalidateQueries({queryKey:["usd-balance"]})}g({phase:"error",message:ve(m)})}}function Re(a,s){y.invalidateQueries({queryKey:["usd-balance"]}),y.invalidateQueries({queryKey:["detail-trade"]}),y.invalidateQueries({queryKey:["shop-item"]}),y.invalidateQueries({queryKey:["owned-token"]}),y.invalidateQueries({queryKey:["public-token"]}),y.invalidateQueries({queryKey:["item-resales"]}),y.invalidateQueries({queryKey:["shop-items"]}),y.invalidateQueries({queryKey:["catalog-items"]}),y.invalidateQueries({queryKey:["my-assets"]}),y.invalidateQueries({queryKey:["purchases"]}),y.invalidateQueries({queryKey:["owned-item-count"]}),y.invalidateQueries({queryKey:["overview-listings"]}),y.invalidateQueries({queryKey:["upsell-listings"]});const i=D.current;D.current=null,g(null),S(!1);const r={items:a,txHash:s[0]??void 0,settled:!0,...i?{creditsAdded:i}:{}};Q("/success",{state:r,replace:!0})}function Fe(a,s){se(a)||O(a,{flow:s,step:"submit"}),B(se(a)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:De(a)}),g({phase:"error",message:ve(a)}),S(!1)}async function la(a,s){const i=ne(ge.MANAToken,s),r=ne(ge.CreditsManager,s);await Da({auth:{kind:Ga.Allowance,contractAddress:i.address,spenderAddress:r.address,chainId:s},signer:a})}async function da(a){const s=ce(a).reduce((d,p)=>d+p.usdCents,0),i=(V??0n)>0n;let r=le;if(!r&&i)try{r=await y.fetchQuery({queryKey:["mana-rate",Ge.chainId],queryFn:()=>za(Ge.chainId),staleTime:6e4})}catch{r=void 0}const l=r?Je(s,r):0n;return{totalCents:s,manaWei:l}}async function Te(a,s){const i=xe(a),{totalCents:r,manaWei:l}=await da(a),d=be({priceCents:r,priceManaWei:l,balanceCents:(f==null?void 0:f.balanceCents)??0,manaBalanceWei:V??0n});if(s&&d.options.some(p=>p.method===s)){if(s==="credits"){me(a);return}const{spender:p,chainId:m}=Ee(s,a);await We(p,m,()=>s==="mana"?void Le(a):void Be(a,r,l));return}if(d.options.some(p=>p.method==="mana"||p.method==="combined")){g({phase:"choose",lines:a,totalCents:r,manaWei:l}),S(!1);return}if(f!=null&&f.credits<i){Ie(a);return}me(a)}function ua(a){return be({priceCents:a.totalCents,priceManaWei:a.manaWei,balanceCents:(f==null?void 0:f.balanceCents)??0,manaBalanceWei:V??0n})}const[ye,ae]=j.useState(null);function Ee(a,s){const i=s[0].trade;return{spender:a==="mana"?ne(Pa(i.contract),i.chainId).address:ne(ge.CreditsManager,i.chainId).address,chainId:i.chainId}}async function We(a,s,i){const r=Oa(s,a),l=n?await $a(r,n.address).catch(()=>!0):!0;if(Va(n==null?void 0:n.providerType,l)){S(!1),ae({auth:r,run:i});return}i()}function ha(a){if((u==null?void 0:u.phase)!=="choose")return;const{lines:s,totalCents:i,manaWei:r}=u;if(a==="credits"){me(s);return}const{spender:l,chainId:d}=Ee(a,s);We(l,d,()=>a==="mana"?void Le(s):void Be(s,i,r))}async function Le(a){if(!n||a.length===0)return;const s=ce(a),i=s.map(d=>({...d.item,priceCredits:d.priceCredits})),r=a.map(d=>({...d.item,priceCredits:d.priceCredits,quantity:d.quantity})),l=()=>g({phase:"processing",stage:"settling",step:s.length,total:s.length});g({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});try{const d=await La({trades:s.map(p=>p.trade),buyer:n.address,signer:n.signer,onSigned:l});a.forEach(p=>o(p.item.id)),L(null),B("Shop Completed Purchase",{..._e(i),payment_type:"mana",transaction_hash:d[0]??null}),y.invalidateQueries({queryKey:["mana-balance"]}),Re(r,d)}catch(d){Fe(d,"buy_cart_mana")}}async function Be(a,s,i){if(!n||a.length===0)return;const r=ce(a),l=r.map(h=>({...h.item,priceCredits:h.priceCredits})),d=a.map(h=>({...h.item,priceCredits:h.priceCredits,quantity:h.quantity})),p=Ba(r.map(h=>h.usdCents),(f==null?void 0:f.balanceCents)??0),m=p.reduce((h,F)=>h+F,0),k=Ka(Math.max(0,s-m),s,i),_=[];g({phase:"processing",stage:"reserving",step:1,total:r.length});try{const h=[];for(let b=0;b<r.length;b++){const v=p[b];if(v<=0)continue;g({phase:"processing",stage:"reserving",step:b+1,total:r.length});const{credit:U,maxCreditedValue:ya}=await Ve(n.identity,v,r[b].trade.id);_.push(U.id),h.push({trade:r[b].trade,credits:[U],maxCreditedValue:ya})}r.forEach((b,v)=>{p[v]<=0&&h.push({trade:b.trade,credits:[],maxCreditedValue:"0"})}),h[0]={...h[0],maxCreditedValue:(BigInt(h[0].maxCreditedValue)+k).toString()},await la(n.signer,r[0].trade.chainId);const F=()=>g({phase:"processing",stage:"settling",step:r.length,total:r.length});g({phase:"processing",stage:"awaiting-signature",step:r.length,total:r.length});const x=await fe({purchases:h,buyer:n.address,signer:n.signer,onSigned:F});a.forEach(b=>o(b.item.id)),L(null),B("Shop Completed Purchase",{..._e(l),payment_type:"credits_and_mana",transaction_hash:x[0]??null}),y.invalidateQueries({queryKey:["mana-balance"]}),Re(d,x)}catch(h){_.length&&(pe(n.identity,_).catch(()=>{}),y.invalidateQueries({queryKey:["usd-balance"]})),Fe(h,"buy_cart_combined")}}async function z(a){if(!n){He({type:"cart-checkout"}),q();return}const s=P.getState().items.filter(we);if(s.length===0)return;$(null),J(null),S(!0);const i=s.reduce((r,l)=>r+l.priceCredits*l.quantity,0);B("Shop Started Checkout",{cart_size:s.length,cart_value_credits:i,cart_value_usd:$e(i),has_sufficient_credits:Y>=i});try{const r=await Za(s,n.address,ia),l=[...r.unavailable,...r.own];if(l.length&&(l.forEach(d=>o(d.id)),J(ht(r))),r.buyable.length===0){$(t("cart.error.noneAvailable")),L(null);return}if(r.orderChanged){L(r),je.current=Date.now();return}await Te(r.buyable,a)}catch(r){O(r,{flow:"cart_checkout",step:"review",cart_size:s.length}),$(ve(r))}finally{S(!1)}}async function Ke(){if(w){if(!n){He({type:"cart-checkout"}),q();return}if(Date.now()-je.current>ut){L(null),J(null),await z();return}$(null),Te(w.buyable)}}async function ma(){if(de){try{sessionStorage.setItem(re,JSON.stringify(P.getState().items))}catch{}S(!0);try{const a=await tt(de,n?{address:n.address,identity:n.identity}:void 0);if(a.url){window.location.href=a.url;return}Q("/credits")}catch(a){try{sessionStorage.removeItem(re)}catch{}O(a,{flow:"cart_buy_credits"}),g({phase:"error",message:t("buyModal.error.creditsCheckout")})}finally{S(!1)}}}const Qe=j.useRef(!1);j.useEffect(()=>{if(!n||Qe.current||!Ra("cart-checkout"))return;Qe.current=!0;const a=setTimeout(()=>void z(),0);return()=>clearTimeout(a)},[n]);const ze=j.useRef(!1);j.useEffect(()=>{if(!(W!=null&&W.resumeCheckout)||ze.current)return;ze.current=!0,D.current=W.creditsAdded??null;try{const s=sessionStorage.getItem(re);if(s){sessionStorage.removeItem(re);const i=JSON.parse(s);Array.isArray(i)&&i.length&&T(i)}}catch{}y.invalidateQueries({queryKey:["usd-balance"]});const a=setTimeout(()=>void z(),0);return()=>clearTimeout(a)},[W==null?void 0:W.resumeCheckout]);const R=aa||(u==null?void 0:u.phase)==="processing";return c.length===0&&!u?e.jsx("div",{className:"checkout checkout--empty",children:e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>Q(-1),type:"button",children:[e.jsx(A,{name:"arrow-left"}),t("nav.cart")]}),e.jsxs("section",{className:"checkout__panel cart-empty","data-testid":"cart-empty",children:[e.jsx(A,{name:"cart-plus",size:110,className:"cart-empty__icon"}),e.jsxs("div",{className:"cart-empty__text",children:[e.jsx("p",{className:"cart-empty__title",children:t("cart.empty.title")}),e.jsx("p",{className:"cart-empty__body",children:t("cart.empty.body")})]}),e.jsx(te,{className:"cart-empty__cta",to:"/assets",children:t("cart.empty.cta")})]})]})}):e.jsxs("div",{className:"checkout",children:[e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>Q(-1),type:"button",children:[e.jsx(A,{name:"arrow-left"}),t("nav.cart")]}),e.jsxs("div",{className:"checkout__body",children:[e.jsxs("div",{className:"checkout__left",children:[e.jsxs("div",{className:"checkout__head-card",children:[e.jsx("button",{className:"checkout__panel-back",onClick:()=>Q(-1),type:"button","aria-label":t("cart.goBack"),children:e.jsx(A,{name:"arrow-left"})}),e.jsx("h1",{className:"checkout__panel-title",children:t("cart.panelTitle",{count:sa})}),Ze?e.jsxs("button",{className:"checkout__fitting",onClick:()=>E(!0),disabled:R,children:[e.jsx(A,{name:"fitting-room"}),t("cart.fittingRoom")]}):null]}),e.jsxs("section",{className:"checkout__panel",children:[e.jsx("div",{className:"checkout__list",children:c.map(a=>{const s=ca.get(a.id),i=s?s.priceCredits:a.priceCredits,r=!!s&&s.priceCredits!==a.priceCredits,l=!a.tokenId,d=a.quantity,p=typeof a.available=="number"&&d>=a.available,m=i*d,k=!!M[a.id],_=Na(a),h=Ne[a.id],F=!Oe(h),x=h==="sold-out"?t("cart.availability.soldOut"):t("cart.availability.unavailable");return e.jsxs("div",{className:`checkout__card${F?" is-unavailable":""}`,children:[e.jsxs("div",{className:"checkout__thumb",children:[_?e.jsx(te,{className:"checkout__thumb-link",to:_,state:{item:a,tradeId:a.tradeId},"aria-label":a.name,children:a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:a.name}):null}):a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:a.name}):null,e.jsx("span",{className:"checkout__thumb-check","aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"checkout__info",children:[e.jsxs("div",{className:"checkout__desc",children:[_?e.jsx(te,{className:"checkout__name",to:_,state:{item:a,tradeId:a.tradeId},title:a.name,children:a.name}):e.jsx("div",{className:"checkout__name",title:a.name,children:a.name}),a.creator?e.jsx(wa,{address:a.creator,className:"checkout__creator",linkToProfile:!0}):null,l?e.jsxs("span",{className:"checkout__creator-tag","data-testid":"cart-creator-tag",children:[e.jsx(A,{name:"buy-from-creator",className:"checkout__creator-tag-ico","aria-hidden":!0}),t("cart.creatorTag")]}):null]}),e.jsx("div",{className:"checkout__foot",children:F?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"checkout__unavailable",children:[e.jsx(A,{name:"warning-fill",size:24,className:"checkout__warn","aria-hidden":!0}),x]}),_?e.jsx(te,{className:"checkout__resales",to:_,state:{item:a,tradeId:a.tradeId},children:t("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[l?e.jsxs("div",{className:"checkout__stepper",children:[e.jsx("button",{className:"checkout__step",onClick:()=>ee(()=>N(a.id)),disabled:R||d<=1,"aria-label":t("cart.decreaseQuantity",{name:a.name}),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsx("span",{className:"checkout__qty",children:d}),e.jsx("button",{className:"checkout__step",onClick:()=>ee(()=>C(a.id)),disabled:R||p,"aria-label":t("cart.increaseQuantity"),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null,e.jsxs("div",{className:"checkout__price",children:[e.jsx(K,{className:"checkout__price-ico"})," ",m,r?e.jsx("span",{className:"checkout__price-was",children:a.priceCredits*d}):null]})]})})]}),e.jsxs("div",{className:"checkout__actions",children:[e.jsx("button",{className:`checkout__fav${k?" is-on":""}`,onClick:()=>ie(a),"aria-label":k?t("cart.removeFromFavorites",{name:a.name}):t("cart.addToFavorites",{name:a.name}),title:k?t("assetCard.removeFromFavorites"):t("assetCard.addToFavorites"),children:e.jsx(A,{name:k?"heart-solid":"heart"})}),e.jsx("button",{className:"checkout__remove",onClick:()=>ee(()=>o(a.id)),disabled:R,"aria-label":t("cart.remove",{name:a.name}),title:t("cart.removeTitle"),children:e.jsx(A,{name:"trash",size:24})})]})]},a.id)})}),e.jsx("div",{className:"checkout__utils",children:e.jsx("button",{className:"link",onClick:()=>ee(I),disabled:R,children:t("cart.clearCart")})})]})]}),e.jsxs("aside",{className:"checkout__summary",children:[e.jsx("h2",{className:"checkout__summary-title",children:t("cart.purchaseSummary")}),e.jsxs("div",{className:"checkout__summary-body",children:[e.jsxs("div",{className:"checkout__total-line",children:[e.jsx("span",{className:"checkout__total-label",children:t("cart.totalItems",{count:na})}),e.jsxs("span",{className:"checkout__total-side",children:[e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(K,{className:"checkout__total-ico"})," ",Me]}),Ae&&(V??0n)>0n?e.jsx("span",{className:"checkout__total-rate","data-testid":"cart-mana-rate",children:Ae}):null]})]}),Z.options.length>0||Z.manaShortfall?e.jsx(Ye,{options:Z.options,totalCents:X,shortfall:Z.manaShortfall,creditsLabel:w?t("marketCheckout.confirmPurchase"):t("cart.buyWithCredits"),busy:R||he,onPay:a=>void(w?Ke():z(a))}):e.jsx("button",{className:"checkout__cta",onClick:()=>void(w?Ke():z()),disabled:R||he,children:R?t("cart.working"):w?t("marketCheckout.confirmPurchase"):t("assetCard.buyNow")}),he?e.jsx("p",{className:"muted checkout__msg",children:t("cart.allUnavailable")}):null,n?null:e.jsx("p",{className:"muted checkout__msg",children:t("cart.signInHint")}),w?e.jsx("p",{className:"muted checkout__msg",children:t("cart.priceChanged")}):null,Ce?e.jsx("p",{className:"muted checkout__msg",children:Ce}):null,e.jsx(ct,{message:ea,className:"checkout__msg"})]})]})]})]}),Se.length>0?e.jsx("div",{className:"cart-upsell",children:e.jsx(Fa,{title:t("cart.youMightAlsoLike"),items:Se})}):null,ye&&n?e.jsx(Ta,{auth:ye.auth,signer:n.signer,title:t("authorizeStep.manaTitle"),name:t("authorizeStep.manaName"),reason:t("authorizeStep.manaReason"),icon:e.jsx("img",{src:Ea,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:a}=ye;ae(null),a()},onCancel:()=>ae(null),onClose:()=>ae(null)}):null,u?e.jsx(ot,{phase:u.phase,balanceCredits:Y,onClose:oa,stage:u.phase==="processing"?u.stage:void 0,step:u.phase==="processing"?u.step:void 0,total:u.phase==="processing"?u.total:void 0,isSelfCustody:Ma(n==null?void 0:n.providerType),options:u.phase==="choose"?ua(u).options:void 0,onPay:ha,totalCents:u.phase==="choose"?u.totalCents:void 0,totalManaWei:u.phase==="choose"?u.manaWei:void 0,totalCredits:u.phase==="choose"?xe(u.lines):void 0,lines:u.phase==="nofunds"?u.lines:void 0,shortfallCredits:u.phase==="nofunds"?u.shortfall:void 0,packs:H,selectedPack:de,onSelectPack:ke,onBuyPacks:()=>void ma(),message:u.phase==="error"?u.message:void 0,onRetry:()=>void z()}):null]})}export{It as Cart};
|
|
1
|
+
import{j as e,r as j,a as pa,u as _a,L as te}from"./react-B36MyIP_.js";import{t,k as K,m as G,ak as ga,h as ba,ai as P,Q as Ue,e as fa,u as va,w as xa,x as Ca,al as ja,am as ka,I as A,an as Na,l as wa,j as Ma,ao as Oe,E as B,ap as $e,aq as Sa,J as O,b as qa,D as Ve,y as pe,ar as _e,G as se,F as De,g as ne,a as Pa,C as ge,c as Ge,as as Aa}from"./index-BSeusSHl.js";import{P as Ye,m as Xe,W as Ia,c as be,t as Ra,C as Fa,A as Ta,a as Ea,s as He,i as Wa,b as La,d as Ba,e as Ka}from"./CollectionCarousel-Dsbypx_Q.js";import{u as Qa}from"./useManaRate-CY5PbqWB.js";import{u as Je,r as za}from"./mana-rate-BJbe6lgb.js";import{a as Ua,j as Oa,h as $a,n as Va,i as Da,A as Ga}from"./authorizations-CUAi4uqJ.js";import{a as fe}from"./buy-Tme1UHVf.js";import{a as Ha,w as Ja,S as Ya,G as Xa}from"./buy-gasless-BdW9VEKq.js";import{R as re,r as Za}from"./cart-checkout-D8_UxnB9.js";import{u as et,M as at,c as tt}from"./useCreditPacks-Dg3_30xn.js";import{l as st}from"./loader-logo-BzY9EKdC.js";import{i as nt,a as rt}from"./errors-DCLH44Ym.js";import{E as ct}from"./ErrorNotice-D_Z5OVFI.js";import"./sentry-gZJVwIqQ.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BteKixT0.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-DXoI04Mc.js";import"./sendMetaTransaction-DEU_Xtzf.js";const it="https://cdn.decentraland.org/@dcl/shop/0.1.0-30362815497.commit-35ecdbf/assets/buy-error-22UunaPC.png";function ot(c){const{phase:o,balanceCredits:C,onClose:N}=c,I=o==="processing",T=o==="error"?t("cartCheckout.errorTitle"):o==="nofunds"?t("cartCheckout.titleNoFunds"):o==="choose"?t("buyModal.choosePayment"):t("cartCheckout.titleBuy"),E=o==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":t("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:I?void 0:N,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${E?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:T}),!I&&e.jsx("button",{className:"buy-modal__x",onClick:N,"aria-label":t("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:o==="nofunds"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(K,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:G(C)})]})]}),o==="choose"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"cart-checkout__choose-total",children:[e.jsx("span",{children:t("cart.purchaseSummary")}),e.jsxs("strong",{children:[e.jsx(K,{className:"buy-modal__balance-ico"}),G(c.totalCredits??0)]})]}),e.jsx(Ye,{options:c.options??[],totalCents:c.totalCents??0,onPay:c.onPay??(()=>{}),rateNote:(()=>{const M=Xe(c.totalCents??0,c.totalManaWei??0n);return M!=null?t("buyModal.manaRate",{mana:M.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),o==="processing"&&e.jsx(lt,{stage:c.stage??"reserving",step:c.step??1,total:c.total??1,isSelfCustody:!!c.isSelfCustody}),o==="nofunds"&&e.jsx(dt,{lines:c.lines??[],shortfallCredits:c.shortfallCredits??0,packs:c.packs??[],selectedPack:c.selectedPack??"",onSelectPack:c.onSelectPack??(()=>{}),onBuyPacks:c.onBuyPacks??(()=>{}),onCancel:N}),o==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-error",children:[e.jsx("img",{className:"buy-error__art",src:it,alt:"",width:64,height:80}),e.jsxs("p",{className:"buy-error__text",children:[e.jsx("b",{children:t("cartCheckout.errorHeadline")})," ",t("cartCheckout.errorBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:N,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:c.onRetry??N,children:t("cartCheckout.tryAgain")})]})]})]})]})}function lt({stage:c,step:o,total:C,isSelfCustody:N}){const I=c==="reserving",T=C>0?Math.min(100,Math.round(o/C*100)):0,E=c==="awaiting-signature"?N?t("buyModal.confirmToContinue"):t("buyModal.completingTransaction"):c==="settling"?t("buyModal.completingTransaction"):t("cartCheckout.preparing");return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:st,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:E}),I?e.jsxs("div",{className:"cart-checkout__progress-row",children:[e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill buy-modal__progress-fill--step",style:{width:`${T}%`}})}),C>1?e.jsxs("span",{className:"cart-checkout__step",children:[o,"/",C]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function dt({lines:c,shortfallCredits:o,packs:C,selectedPack:N,onSelectPack:I,onBuyPacks:T,onCancel:E}){const M=C.find(n=>n.id===N),ie=c.reduce((n,q)=>n+(q.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(Ia,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:t("buyModal.insufficientFunds")})," ",t("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:t("buyModal.warningCreditsAmount",{count:Math.max(0,o)})})," ",t("buyModal.warningToPurchase",{count:ie})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:c.map(n=>{const q=n.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:n.item.thumbnail?e.jsx("img",{src:n.item.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"buy-modal__asset-name",title:n.item.name,children:[n.item.name||t("buyModal.itemFallback"),q>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:t("cartCheckout.qty",{count:q})}):null]}),n.item.creator?e.jsx(ga,{address:n.item.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(K,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:G(n.priceCredits*q)})]})]})]},n.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:C.map(n=>{const q=n.id===N;return e.jsxs("button",{className:`buy-modal__pack${q?" buy-modal__pack--on":""}`,onClick:()=>I(n.id),children:[e.jsx(K,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:G(n.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(K,{className:"buy-modal__total-ico"}),e.jsx("span",{children:G((M==null?void 0:M.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((M==null?void 0:M.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:E,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:T,children:t("buyModal.buy")})]})]})}function ve(c){if(nt(c))return t("errors.rejected");const o=(c.message??"").toLowerCase();return o.includes("insufficient")?t("cart.error.insufficient",{currency:qa.name}):o.includes("no active listing")||o.includes("your own listing")?t("cart.error.listingChanged"):t("marketCheckout.error.generic")}const ut=12e4;function ht(c){const o=[];return c.unavailable.length&&o.push(t("cart.drop.unavailable",{count:c.unavailable.length})),c.own.length&&o.push(t("cart.drop.own",{count:c.own.length})),t("cart.drop.removed",{items:o.join(` ${t("cart.drop.and")} `)})}const xe=c=>c.reduce((o,C)=>o+C.priceCredits*C.quantity,0),ce=c=>c.flatMap(o=>Array.from({length:o.quantity},()=>({...o,quantity:1})));function It(){ba({title:t("nav.cart"),noindex:!0});const c=P(a=>a.items),o=P(a=>a.remove),C=P(a=>a.increment),N=P(a=>a.decrement),I=P(a=>a.clear),T=P(a=>a.restore),E=P(a=>a.setFittingOpen),M=Ue(a=>a.items),ie=Ue(a=>a.toggle),{session:n,signIn:q}=fa(),H=et().packs.slice(0,at);j.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const Ze=c.some(a=>a.category!=="emote"),{data:oe}=va({queryKey:["upsell-listings"],queryFn:()=>Aa({first:40}),staleTime:6e4}),{data:f}=xa(n),y=Ca(),Q=pa(),{state:W}=_a(),[ea,$]=j.useState(null),[Ce,J]=j.useState(null),[aa,S]=j.useState(!1),[w,L]=j.useState(null),je=j.useRef(0),[u,g]=j.useState(null),{data:V}=ja(n),{data:le}=Qa(!0),[de,ke]=j.useState(""),D=j.useRef(null),Ne=ka(c),we=a=>Oe(Ne[a.id]),ue=c.filter(we),he=c.length>0&&ue.length===0,ta=ue.reduce((a,s)=>a+s.priceCredits*s.quantity,0),sa=c.reduce((a,s)=>a+s.quantity,0),na=ue.reduce((a,s)=>a+s.quantity,0),Me=w?w.liveTotalCredits:ta,ra=new Set(c.map(a=>a.id)),Se=((oe==null?void 0:oe.items)??[]).filter(a=>!ra.has(a.id)).slice(0,12),ca=new Map(w==null?void 0:w.buyable.map(a=>[a.item.id,a])),Y=(f==null?void 0:f.credits)??0,X=Me*10,qe=le?Je(X,le):0n,Z=be({priceCents:X,priceManaWei:qe,balanceCents:(f==null?void 0:f.balanceCents)??0,manaBalanceWei:V??0n}),Pe=Xe(X,qe),Ae=Pe!=null?t("buyModal.manaRate",{mana:Pe.toLocaleString("en",{maximumFractionDigits:2})}):null,ia=Sa;function ee(a){a(),L(null),J(null),$(null)}function oa(){g(null),S(!1)}function Ie(a){const s=xe(a),i=Math.max(0,s-Y),r=H.find(l=>l.credits>=i)??H[H.length-1];ke(r.id),B("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:s,credits_balance:Y,shortfall:i}),g({phase:"nofunds",lines:a.map(l=>({item:l.item,priceCredits:l.priceCredits,quantity:l.quantity})),shortfall:i}),S(!1)}async function me(a){if(!n||a.length===0)return;const s=ce(a),i=s.map(m=>({...m.item,priceCredits:m.priceCredits})),r=a.map(m=>({...m.item,priceCredits:m.priceCredits,quantity:m.quantity})),l=[];let d="authorize",p=!1;g({phase:"processing",stage:"reserving",step:1,total:s.length});try{const m=[];for(let x=0;x<s.length;x++){const b=s[x];g({phase:"processing",stage:"reserving",step:x+1,total:s.length});try{const{credit:v,maxCreditedValue:U}=await Ve(n.identity,b.usdCents,b.trade.id);l.push(v.id),m.push({trade:b.trade,credits:[v],maxCreditedValue:U})}catch(v){if(rt(v)){if(l.length){try{await pe(n.identity,l)}catch(U){O(U,{flow:"cart_checkout",step:"release"})}y.invalidateQueries({queryKey:["usd-balance"]})}Ie(a);return}throw v}}d="submit";const k=()=>g({phase:"processing",stage:"settling",step:s.length,total:s.length});g({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});let _=[];if(Ua())try{_=await Ha({purchases:m,buyer:n.address,signer:n.signer,onSigned:k});const b=(await Promise.allSettled(_.map(v=>Ja(v)))).flatMap(v=>v.status==="rejected"?[v.reason]:[]);if(b.length&&!b.some(v=>v instanceof Ya))throw b[0];p=!0}catch(x){if(!(x instanceof Xa))throw x;_=await fe({purchases:m,buyer:n.address,signer:n.signer,onSigned:k})}else _=await fe({purchases:m,buyer:n.address,signer:n.signer});a.forEach(x=>o(x.item.id)),L(null),B("Shop Completed Purchase",{..._e(i),payment_type:"credits",no_crypto_step:p,transaction_hash:_[0]??null}),Wa(y);const h=D.current;D.current=null,g(null),S(!1);const F={items:r,txHash:_[0]??void 0,settled:!0,...h?{creditsAdded:h}:{}};Q("/success",{state:F,replace:!0})}catch(m){if(se(m)||O(m,{flow:"cart_checkout",step:d,cart_size:a.length}),B(se(m)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:d,error_code:De(m),value_usd:$e(i.reduce((k,_)=>k+_.priceCredits,0)),cart_size:s.length}),l.length){try{await pe(n.identity,l)}catch(k){O(k,{flow:"cart_checkout",step:"release"})}y.invalidateQueries({queryKey:["usd-balance"]})}g({phase:"error",message:ve(m)})}}function Re(a,s){y.invalidateQueries({queryKey:["usd-balance"]}),y.invalidateQueries({queryKey:["detail-trade"]}),y.invalidateQueries({queryKey:["shop-item"]}),y.invalidateQueries({queryKey:["owned-token"]}),y.invalidateQueries({queryKey:["public-token"]}),y.invalidateQueries({queryKey:["item-resales"]}),y.invalidateQueries({queryKey:["shop-items"]}),y.invalidateQueries({queryKey:["catalog-items"]}),y.invalidateQueries({queryKey:["my-assets"]}),y.invalidateQueries({queryKey:["purchases"]}),y.invalidateQueries({queryKey:["owned-item-count"]}),y.invalidateQueries({queryKey:["overview-listings"]}),y.invalidateQueries({queryKey:["upsell-listings"]});const i=D.current;D.current=null,g(null),S(!1);const r={items:a,txHash:s[0]??void 0,settled:!0,...i?{creditsAdded:i}:{}};Q("/success",{state:r,replace:!0})}function Fe(a,s){se(a)||O(a,{flow:s,step:"submit"}),B(se(a)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:De(a)}),g({phase:"error",message:ve(a)}),S(!1)}async function la(a,s){const i=ne(ge.MANAToken,s),r=ne(ge.CreditsManager,s);await Da({auth:{kind:Ga.Allowance,contractAddress:i.address,spenderAddress:r.address,chainId:s},signer:a})}async function da(a){const s=ce(a).reduce((d,p)=>d+p.usdCents,0),i=(V??0n)>0n;let r=le;if(!r&&i)try{r=await y.fetchQuery({queryKey:["mana-rate",Ge.chainId],queryFn:()=>za(Ge.chainId),staleTime:6e4})}catch{r=void 0}const l=r?Je(s,r):0n;return{totalCents:s,manaWei:l}}async function Te(a,s){const i=xe(a),{totalCents:r,manaWei:l}=await da(a),d=be({priceCents:r,priceManaWei:l,balanceCents:(f==null?void 0:f.balanceCents)??0,manaBalanceWei:V??0n});if(s&&d.options.some(p=>p.method===s)){if(s==="credits"){me(a);return}const{spender:p,chainId:m}=Ee(s,a);await We(p,m,()=>s==="mana"?void Le(a):void Be(a,r,l));return}if(d.options.some(p=>p.method==="mana"||p.method==="combined")){g({phase:"choose",lines:a,totalCents:r,manaWei:l}),S(!1);return}if(f!=null&&f.credits<i){Ie(a);return}me(a)}function ua(a){return be({priceCents:a.totalCents,priceManaWei:a.manaWei,balanceCents:(f==null?void 0:f.balanceCents)??0,manaBalanceWei:V??0n})}const[ye,ae]=j.useState(null);function Ee(a,s){const i=s[0].trade;return{spender:a==="mana"?ne(Pa(i.contract),i.chainId).address:ne(ge.CreditsManager,i.chainId).address,chainId:i.chainId}}async function We(a,s,i){const r=Oa(s,a),l=n?await $a(r,n.address).catch(()=>!0):!0;if(Va(n==null?void 0:n.providerType,l)){S(!1),ae({auth:r,run:i});return}i()}function ha(a){if((u==null?void 0:u.phase)!=="choose")return;const{lines:s,totalCents:i,manaWei:r}=u;if(a==="credits"){me(s);return}const{spender:l,chainId:d}=Ee(a,s);We(l,d,()=>a==="mana"?void Le(s):void Be(s,i,r))}async function Le(a){if(!n||a.length===0)return;const s=ce(a),i=s.map(d=>({...d.item,priceCredits:d.priceCredits})),r=a.map(d=>({...d.item,priceCredits:d.priceCredits,quantity:d.quantity})),l=()=>g({phase:"processing",stage:"settling",step:s.length,total:s.length});g({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});try{const d=await La({trades:s.map(p=>p.trade),buyer:n.address,signer:n.signer,onSigned:l});a.forEach(p=>o(p.item.id)),L(null),B("Shop Completed Purchase",{..._e(i),payment_type:"mana",transaction_hash:d[0]??null}),y.invalidateQueries({queryKey:["mana-balance"]}),Re(r,d)}catch(d){Fe(d,"buy_cart_mana")}}async function Be(a,s,i){if(!n||a.length===0)return;const r=ce(a),l=r.map(h=>({...h.item,priceCredits:h.priceCredits})),d=a.map(h=>({...h.item,priceCredits:h.priceCredits,quantity:h.quantity})),p=Ba(r.map(h=>h.usdCents),(f==null?void 0:f.balanceCents)??0),m=p.reduce((h,F)=>h+F,0),k=Ka(Math.max(0,s-m),s,i),_=[];g({phase:"processing",stage:"reserving",step:1,total:r.length});try{const h=[];for(let b=0;b<r.length;b++){const v=p[b];if(v<=0)continue;g({phase:"processing",stage:"reserving",step:b+1,total:r.length});const{credit:U,maxCreditedValue:ya}=await Ve(n.identity,v,r[b].trade.id);_.push(U.id),h.push({trade:r[b].trade,credits:[U],maxCreditedValue:ya})}r.forEach((b,v)=>{p[v]<=0&&h.push({trade:b.trade,credits:[],maxCreditedValue:"0"})}),h[0]={...h[0],maxCreditedValue:(BigInt(h[0].maxCreditedValue)+k).toString()},await la(n.signer,r[0].trade.chainId);const F=()=>g({phase:"processing",stage:"settling",step:r.length,total:r.length});g({phase:"processing",stage:"awaiting-signature",step:r.length,total:r.length});const x=await fe({purchases:h,buyer:n.address,signer:n.signer,onSigned:F});a.forEach(b=>o(b.item.id)),L(null),B("Shop Completed Purchase",{..._e(l),payment_type:"credits_and_mana",transaction_hash:x[0]??null}),y.invalidateQueries({queryKey:["mana-balance"]}),Re(d,x)}catch(h){_.length&&(pe(n.identity,_).catch(()=>{}),y.invalidateQueries({queryKey:["usd-balance"]})),Fe(h,"buy_cart_combined")}}async function z(a){if(!n){He({type:"cart-checkout"}),q();return}const s=P.getState().items.filter(we);if(s.length===0)return;$(null),J(null),S(!0);const i=s.reduce((r,l)=>r+l.priceCredits*l.quantity,0);B("Shop Started Checkout",{cart_size:s.length,cart_value_credits:i,cart_value_usd:$e(i),has_sufficient_credits:Y>=i});try{const r=await Za(s,n.address,ia),l=[...r.unavailable,...r.own];if(l.length&&(l.forEach(d=>o(d.id)),J(ht(r))),r.buyable.length===0){$(t("cart.error.noneAvailable")),L(null);return}if(r.orderChanged){L(r),je.current=Date.now();return}await Te(r.buyable,a)}catch(r){O(r,{flow:"cart_checkout",step:"review",cart_size:s.length}),$(ve(r))}finally{S(!1)}}async function Ke(){if(w){if(!n){He({type:"cart-checkout"}),q();return}if(Date.now()-je.current>ut){L(null),J(null),await z();return}$(null),Te(w.buyable)}}async function ma(){if(de){try{sessionStorage.setItem(re,JSON.stringify(P.getState().items))}catch{}S(!0);try{const a=await tt(de,n?{address:n.address,identity:n.identity}:void 0);if(a.url){window.location.href=a.url;return}Q("/credits")}catch(a){try{sessionStorage.removeItem(re)}catch{}O(a,{flow:"cart_buy_credits"}),g({phase:"error",message:t("buyModal.error.creditsCheckout")})}finally{S(!1)}}}const Qe=j.useRef(!1);j.useEffect(()=>{if(!n||Qe.current||!Ra("cart-checkout"))return;Qe.current=!0;const a=setTimeout(()=>void z(),0);return()=>clearTimeout(a)},[n]);const ze=j.useRef(!1);j.useEffect(()=>{if(!(W!=null&&W.resumeCheckout)||ze.current)return;ze.current=!0,D.current=W.creditsAdded??null;try{const s=sessionStorage.getItem(re);if(s){sessionStorage.removeItem(re);const i=JSON.parse(s);Array.isArray(i)&&i.length&&T(i)}}catch{}y.invalidateQueries({queryKey:["usd-balance"]});const a=setTimeout(()=>void z(),0);return()=>clearTimeout(a)},[W==null?void 0:W.resumeCheckout]);const R=aa||(u==null?void 0:u.phase)==="processing";return c.length===0&&!u?e.jsx("div",{className:"checkout checkout--empty",children:e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>Q(-1),type:"button",children:[e.jsx(A,{name:"arrow-left"}),t("nav.cart")]}),e.jsxs("section",{className:"checkout__panel cart-empty","data-testid":"cart-empty",children:[e.jsx(A,{name:"cart-plus",size:110,className:"cart-empty__icon"}),e.jsxs("div",{className:"cart-empty__text",children:[e.jsx("p",{className:"cart-empty__title",children:t("cart.empty.title")}),e.jsx("p",{className:"cart-empty__body",children:t("cart.empty.body")})]}),e.jsx(te,{className:"cart-empty__cta",to:"/assets",children:t("cart.empty.cta")})]})]})}):e.jsxs("div",{className:"checkout",children:[e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>Q(-1),type:"button",children:[e.jsx(A,{name:"arrow-left"}),t("nav.cart")]}),e.jsxs("div",{className:"checkout__body",children:[e.jsxs("div",{className:"checkout__left",children:[e.jsxs("div",{className:"checkout__head-card",children:[e.jsx("button",{className:"checkout__panel-back",onClick:()=>Q(-1),type:"button","aria-label":t("cart.goBack"),children:e.jsx(A,{name:"arrow-left"})}),e.jsx("h1",{className:"checkout__panel-title",children:t("cart.panelTitle",{count:sa})}),Ze?e.jsxs("button",{className:"checkout__fitting",onClick:()=>E(!0),disabled:R,children:[e.jsx(A,{name:"fitting-room"}),t("cart.fittingRoom")]}):null]}),e.jsxs("section",{className:"checkout__panel",children:[e.jsx("div",{className:"checkout__list",children:c.map(a=>{const s=ca.get(a.id),i=s?s.priceCredits:a.priceCredits,r=!!s&&s.priceCredits!==a.priceCredits,l=!a.tokenId,d=a.quantity,p=typeof a.available=="number"&&d>=a.available,m=i*d,k=!!M[a.id],_=Na(a),h=Ne[a.id],F=!Oe(h),x=h==="sold-out"?t("cart.availability.soldOut"):t("cart.availability.unavailable");return e.jsxs("div",{className:`checkout__card${F?" is-unavailable":""}`,children:[e.jsxs("div",{className:"checkout__thumb",children:[_?e.jsx(te,{className:"checkout__thumb-link",to:_,state:{item:a,tradeId:a.tradeId},"aria-label":a.name,children:a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:a.name}):null}):a.thumbnail?e.jsx("img",{src:a.thumbnail,alt:a.name}):null,e.jsx("span",{className:"checkout__thumb-check","aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"checkout__info",children:[e.jsxs("div",{className:"checkout__desc",children:[_?e.jsx(te,{className:"checkout__name",to:_,state:{item:a,tradeId:a.tradeId},title:a.name,children:a.name}):e.jsx("div",{className:"checkout__name",title:a.name,children:a.name}),a.creator?e.jsx(wa,{address:a.creator,className:"checkout__creator",linkToProfile:!0}):null,l?e.jsxs("span",{className:"checkout__creator-tag","data-testid":"cart-creator-tag",children:[e.jsx(A,{name:"buy-from-creator",className:"checkout__creator-tag-ico","aria-hidden":!0}),t("cart.creatorTag")]}):null]}),e.jsx("div",{className:"checkout__foot",children:F?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"checkout__unavailable",children:[e.jsx(A,{name:"warning-fill",size:24,className:"checkout__warn","aria-hidden":!0}),x]}),_?e.jsx(te,{className:"checkout__resales",to:_,state:{item:a,tradeId:a.tradeId},children:t("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[l?e.jsxs("div",{className:"checkout__stepper",children:[e.jsx("button",{className:"checkout__step",onClick:()=>ee(()=>N(a.id)),disabled:R||d<=1,"aria-label":t("cart.decreaseQuantity",{name:a.name}),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsx("span",{className:"checkout__qty",children:d}),e.jsx("button",{className:"checkout__step",onClick:()=>ee(()=>C(a.id)),disabled:R||p,"aria-label":t("cart.increaseQuantity"),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null,e.jsxs("div",{className:"checkout__price",children:[e.jsx(K,{className:"checkout__price-ico"})," ",m,r?e.jsx("span",{className:"checkout__price-was",children:a.priceCredits*d}):null]})]})})]}),e.jsxs("div",{className:"checkout__actions",children:[e.jsx("button",{className:`checkout__fav${k?" is-on":""}`,onClick:()=>ie(a),"aria-label":k?t("cart.removeFromFavorites",{name:a.name}):t("cart.addToFavorites",{name:a.name}),title:k?t("assetCard.removeFromFavorites"):t("assetCard.addToFavorites"),children:e.jsx(A,{name:k?"heart-solid":"heart"})}),e.jsx("button",{className:"checkout__remove",onClick:()=>ee(()=>o(a.id)),disabled:R,"aria-label":t("cart.remove",{name:a.name}),title:t("cart.removeTitle"),children:e.jsx(A,{name:"trash",size:24})})]})]},a.id)})}),e.jsx("div",{className:"checkout__utils",children:e.jsx("button",{className:"link",onClick:()=>ee(I),disabled:R,children:t("cart.clearCart")})})]})]}),e.jsxs("aside",{className:"checkout__summary",children:[e.jsx("h2",{className:"checkout__summary-title",children:t("cart.purchaseSummary")}),e.jsxs("div",{className:"checkout__summary-body",children:[e.jsxs("div",{className:"checkout__total-line",children:[e.jsx("span",{className:"checkout__total-label",children:t("cart.totalItems",{count:na})}),e.jsxs("span",{className:"checkout__total-side",children:[e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(K,{className:"checkout__total-ico"})," ",Me]}),Ae&&(V??0n)>0n?e.jsx("span",{className:"checkout__total-rate","data-testid":"cart-mana-rate",children:Ae}):null]})]}),Z.options.length>0||Z.manaShortfall?e.jsx(Ye,{options:Z.options,totalCents:X,shortfall:Z.manaShortfall,creditsLabel:w?t("marketCheckout.confirmPurchase"):t("cart.buyWithCredits"),busy:R||he,onPay:a=>void(w?Ke():z(a))}):e.jsx("button",{className:"checkout__cta",onClick:()=>void(w?Ke():z()),disabled:R||he,children:R?t("cart.working"):w?t("marketCheckout.confirmPurchase"):t("assetCard.buyNow")}),he?e.jsx("p",{className:"muted checkout__msg",children:t("cart.allUnavailable")}):null,n?null:e.jsx("p",{className:"muted checkout__msg",children:t("cart.signInHint")}),w?e.jsx("p",{className:"muted checkout__msg",children:t("cart.priceChanged")}):null,Ce?e.jsx("p",{className:"muted checkout__msg",children:Ce}):null,e.jsx(ct,{message:ea,className:"checkout__msg"})]})]})]})]}),Se.length>0?e.jsx("div",{className:"cart-upsell",children:e.jsx(Fa,{title:t("cart.youMightAlsoLike"),items:Se})}):null,ye&&n?e.jsx(Ta,{auth:ye.auth,signer:n.signer,title:t("authorizeStep.manaTitle"),name:t("authorizeStep.manaName"),reason:t("authorizeStep.manaReason"),icon:e.jsx("img",{src:Ea,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:a}=ye;ae(null),a()},onCancel:()=>ae(null),onClose:()=>ae(null)}):null,u?e.jsx(ot,{phase:u.phase,balanceCredits:Y,onClose:oa,stage:u.phase==="processing"?u.stage:void 0,step:u.phase==="processing"?u.step:void 0,total:u.phase==="processing"?u.total:void 0,isSelfCustody:Ma(n==null?void 0:n.providerType),options:u.phase==="choose"?ua(u).options:void 0,onPay:ha,totalCents:u.phase==="choose"?u.totalCents:void 0,totalManaWei:u.phase==="choose"?u.manaWei:void 0,totalCredits:u.phase==="choose"?xe(u.lines):void 0,lines:u.phase==="nofunds"?u.lines:void 0,shortfallCredits:u.phase==="nofunds"?u.shortfall:void 0,packs:H,selectedPack:de,onSelectPack:ke,onBuyPacks:()=>void ma(),message:u.phase==="error"?u.message:void 0,onRetry:()=>void z()}):null]})}export{It as Cart};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{V as N,W as U,X as w,Y as z,Z as o,$ as E,a0 as c,a1 as I,a2 as g,a3 as D,R}from"./index-
|
|
1
|
+
import{V as N,W as U,X as w,Y as z,Z as o,$ as E,a0 as c,a1 as I,a2 as g,a3 as D,R}from"./index-BSeusSHl.js";import{r as W,j as v}from"./react-B36MyIP_.js";function F(r){return N("MuiCircularProgress",r)}U("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const K=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,S,b,$;const t=44,V=R(P||(P=l`
|
|
2
2
|
0% {
|
|
3
3
|
transform: rotate(0deg);
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,r as p,d as O,a as Q}from"./react-B36MyIP_.js";import{K as N,n as v,ay as Y,az as E,I as Z,t,c as V,J as W,u as X,h as ee,M as ae,aA as te,b as re,aB as se}from"./index-
|
|
1
|
+
import{j as e,r as p,d as O,a as Q}from"./react-B36MyIP_.js";import{K as N,n as v,ay as Y,az as E,I as Z,t,c as V,J as W,u as X,h as ee,M as ae,aA as te,b as re,aB as se}from"./index-BSeusSHl.js";import{E as oe}from"./ErrorNotice-D_Z5OVFI.js";import{d as ie,g as ce,a as ne,A as le}from"./collection-CHWj8iQW.js";import{u as de}from"./useStore-Duh496VH.js";import{d as F,a as me,F as pe,e as ue,S as R,b as ge}from"./categories-CV5P_HZd.js";import{L as xe}from"./LoadMore-Cp-E67xI.js";import{u as he}from"./useInfiniteGrid-dBP53DpO.js";import"./sentry-gZJVwIqQ.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BteKixT0.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";const be=v.section`
|
|
2
2
|
position: relative;
|
|
3
3
|
border-radius: ${N.radius.card};
|
|
4
4
|
overflow: hidden;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,r as w}from"./react-B36MyIP_.js";import{n as l,K as s,t as f,k as R,m as j,
|
|
1
|
+
import{j as e,r as w}from"./react-B36MyIP_.js";import{n as l,K as s,t as f,k as R,m as j,aO as C,b as Q,R as D,I as K,J as O,g as $,C as _,a as U,aP as B,M as G}from"./index-BSeusSHl.js";import{s as H,i as P,A as T,g as L,r as J,m as V,e as Y}from"./authorizations-CUAi4uqJ.js";import{i as Z}from"./errors-DCLH44Ym.js";import{E as q}from"./ErrorNotice-D_Z5OVFI.js";import{b as X}from"./buy-Tme1UHVf.js";import{g as ee,d as te}from"./trade-encoding-DXoI04Mc.js";import{s as ne,M as ae,E as re}from"./sendMetaTransaction-DEU_Xtzf.js";import{I as se,C as ie}from"./ethers-BteKixT0.js";const I="shop:resume_after_signin",oe=900*1e3;function Oe(n){try{sessionStorage.setItem(I,JSON.stringify({...n,at:Date.now()}))}catch{}}function Ue(n){let t;try{t=sessionStorage.getItem(I)}catch{return null}if(!t)return null;try{sessionStorage.removeItem(I)}catch{}let a;try{a=JSON.parse(t)}catch{return null}return!a||a.type!==n||typeof a.at!="number"||Date.now()-a.at>oe?null:a.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:a.path}}function ce(n,t){return(n+t-1n)/t}function le(n,t,a){return n<=0||t<=0?0n:n>=t?a:ce(a*BigInt(n),BigInt(t))}function Ge(n){var m,x,y;const t=Number.isFinite(n.priceCents)?Math.max(0,Math.trunc(n.priceCents)):0,a=Number.isFinite(n.balanceCents)?Math.max(0,Math.trunc(n.balanceCents)):0,r=n.priceManaWei>0n?n.priceManaWei:0n,o=n.manaBalanceWei>0n?n.manaBalanceWei:0n;if(t<=0)return{options:[],preferred:null,manaShortfall:null};const i=[];if(a>=t&&i.push({method:"credits",creditsCents:t,manaWei:0n}),r>0n&&a>0&&a<t){const c=t-a,g=le(c,t,r);o>=g&&i.push({method:"combined",creditsCents:a,manaWei:g})}r>0n&&o>=r&&i.push({method:"mana",creditsCents:0,manaWei:r});const d=((m=i.find(c=>c.method==="credits"))==null?void 0:m.method)??((x=i.find(c=>c.method==="combined"))==null?void 0:x.method)??((y=i.find(c=>c.method==="mana"))==null?void 0:y.method)??null,b=!i.some(c=>c.method==="mana"||c.method==="combined")&&r>0n&&o>0n?{manaWei:o,manaCents:de(o,t,r),priceCents:t}:null;return{options:i,preferred:d,manaShortfall:b}}function de(n,t,a){return Number(n*BigInt(t)/a)}function He(n,t){let a=Number.isFinite(t)?Math.max(0,Math.trunc(t)):0;return n.map(r=>{const o=Number.isFinite(r)?Math.max(0,Math.trunc(r)):0,i=Math.min(o,a);return a-=i,i})}function k(n){return Number.isFinite(n)?Math.max(0,n)/10:0}function Je(n,t){return n.options.find(a=>a.method===t)??null}function Ve(n,t){if(!Number.isFinite(n)||n<=0||t<=0n)return null;const a=n/10;return Number(t)/1e18/a}const N="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",ue=l.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 12px;
|
|
@@ -109,7 +109,7 @@ import{j as e,r as w}from"./react-B36MyIP_.js";import{n as l,K as s,t as f,k as
|
|
|
109
109
|
line-height: 1.4;
|
|
110
110
|
color: ${s.colors.muted};
|
|
111
111
|
text-align: center;
|
|
112
|
-
`;function Ye({options:n,totalCents:t,onPay:a,busy:r=!1,rateNote:o,creditsLabel:i,shortfall:d}){return e.jsxs(ue,{children:[n.map(u=>u.method==="credits"?e.jsxs(he,{type:"button","data-testid":"pay-with-credits",onClick:()=>a("credits"),disabled:r,children:[e.jsx("span",{children:i??f("buyModal.buy")}),e.jsxs(M,{children:[e.jsx(R,{}),e.jsx("span",{children:j(k(u.creditsCents))})]})]},"credits"):u.method==="mana"?e.jsxs(W,{type:"button","data-testid":"pay-with-mana",onClick:()=>a("mana"),disabled:r,children:[e.jsx("span",{children:f("buyModal.buyWithMana")}),e.jsxs(M,{children:[e.jsx(z,{children:e.jsx("img",{src:
|
|
112
|
+
`;function Ye({options:n,totalCents:t,onPay:a,busy:r=!1,rateNote:o,creditsLabel:i,shortfall:d}){return e.jsxs(ue,{children:[n.map(u=>u.method==="credits"?e.jsxs(he,{type:"button","data-testid":"pay-with-credits",onClick:()=>a("credits"),disabled:r,children:[e.jsx("span",{children:i??f("buyModal.buy")}),e.jsxs(M,{children:[e.jsx(R,{}),e.jsx("span",{children:j(k(u.creditsCents))})]})]},"credits"):u.method==="mana"?e.jsxs(W,{type:"button","data-testid":"pay-with-mana",onClick:()=>a("mana"),disabled:r,children:[e.jsx("span",{children:f("buyModal.buyWithMana")}),e.jsxs(M,{children:[e.jsx(z,{children:e.jsx("img",{src:N,alt:"","aria-hidden":!0})}),e.jsx("span",{children:C(u.manaWei)})]})]},"mana"):e.jsxs(W,{type:"button","data-testid":"pay-with-combined",onClick:()=>a("combined"),disabled:r,children:[e.jsx("span",{children:f("buyModal.buyWith")}),e.jsxs(M,{children:[e.jsx(R,{}),e.jsx("span",{children:j(k(u.creditsCents))}),e.jsx(fe,{children:"+"}),e.jsx(z,{children:e.jsx("img",{src:N,alt:"","aria-hidden":!0})}),e.jsx("span",{children:C(u.manaWei)}),e.jsx(pe,{children:"MANA"})]})]},"combined")),d?e.jsxs(e.Fragment,{children:[e.jsxs(W,{type:"button","data-testid":"pay-with-mana-disabled",disabled:!0,children:[e.jsx("span",{children:f("buyModal.buyWithMana")}),e.jsxs(M,{children:[e.jsx(z,{children:e.jsx("img",{src:N,alt:"","aria-hidden":!0})}),e.jsx("span",{children:C(d.manaWei)})]})]},"mana-short"),e.jsx(me,{"data-testid":"mana-shortfall-note",children:f("buyModal.manaWorth",{mana:C(d.manaWei),credits:j(k(d.manaCents)),price:j(k(d.priceCents)),currency:Q.name})})]}):null,o?e.jsx(xe,{"data-testid":"mana-rate-note",children:o}):null,e.jsx("span",{hidden:!0,"data-testid":"pay-total-cents",children:t})]})}function Ze(n,t){const a=(r,...o)=>void n.invalidateQueries({queryKey:t?[r,...o]:[r]});n.invalidateQueries({queryKey:["usd-balance"]}),n.invalidateQueries({queryKey:["detail-trade"]}),n.invalidateQueries({queryKey:["shop-item"]}),a("owned-token",t==null?void 0:t.contractAddress,t==null?void 0:t.tokenId),a("public-token",t==null?void 0:t.contractAddress,t==null?void 0:t.tokenId),a("item-resales",t==null?void 0:t.contractAddress,t==null?void 0:t.itemId),n.invalidateQueries({queryKey:["shop-items"]}),n.invalidateQueries({queryKey:["catalog-items"]}),n.invalidateQueries({queryKey:["overview-listings"]}),n.invalidateQueries({queryKey:["upsell-listings"]}),n.invalidateQueries({queryKey:["my-assets"]}),n.invalidateQueries({queryKey:["purchases"]}),n.invalidateQueries({queryKey:["owned-item-count"]})}const ge=D`
|
|
113
113
|
to { transform: rotate(360deg); }
|
|
114
114
|
`,be=l.div`
|
|
115
115
|
position: fixed;
|
|
@@ -206,11 +206,11 @@ import{j as e,r as w}from"./react-B36MyIP_.js";import{n as l,K as s,t as f,k as
|
|
|
206
206
|
`,$e=l.span`
|
|
207
207
|
font-weight: 700;
|
|
208
208
|
color: ${s.colors.text};
|
|
209
|
-
`,
|
|
209
|
+
`,Ae=l.span`
|
|
210
210
|
font-size: 13px;
|
|
211
211
|
line-height: 1.45;
|
|
212
212
|
color: ${s.colors.muted};
|
|
213
|
-
`,
|
|
213
|
+
`,Ne=l.p`
|
|
214
214
|
margin: 0;
|
|
215
215
|
font-size: 12px;
|
|
216
216
|
line-height: 1.5;
|
|
@@ -289,4 +289,4 @@ import{j as e,r as w}from"./react-B36MyIP_.js";import{n as l,K as s,t as f,k as
|
|
|
289
289
|
@media (prefers-reduced-motion: reduce) {
|
|
290
290
|
animation: none;
|
|
291
291
|
}
|
|
292
|
-
`;function qe({auth:n,signer:t,title:a,reason:r,name:o,image:i,icon:d,onAuthorized:u,onCancel:b,onClose:m}){const[x,y]=w.useState(!1),[c,g]=w.useState(null);async function v(){y(!0),g(null);try{await H({auth:n,signer:t,active:!0}),u()}catch(h){Z(h)?g(f("authorizeStep.errorRejected")):(O(h,{flow:"authorize_step",kind:n.kind}),g(f("authorizeStep.errorGeneric"))),y(!1)}}return e.jsx(be,{onClick:x?void 0:m,role:"presentation",children:e.jsxs(ye,{onClick:h=>h.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":a,children:[e.jsxs(we,{children:[e.jsx(ve,{children:a}),e.jsx(je,{onClick:m,disabled:x,"aria-label":f("authorizeStep.close"),children:e.jsx(K,{name:"close",className:"ico"})})]}),e.jsxs(Ce,{"data-testid":"authorize-step-row",children:[e.jsx(ke,{children:i?e.jsx("img",{src:i,alt:""}):d}),e.jsxs(Me,{children:[e.jsx($e,{title:o,children:o}),e.jsx(
|
|
292
|
+
`;function qe({auth:n,signer:t,title:a,reason:r,name:o,image:i,icon:d,onAuthorized:u,onCancel:b,onClose:m}){const[x,y]=w.useState(!1),[c,g]=w.useState(null);async function v(){y(!0),g(null);try{await H({auth:n,signer:t,active:!0}),u()}catch(h){Z(h)?g(f("authorizeStep.errorRejected")):(O(h,{flow:"authorize_step",kind:n.kind}),g(f("authorizeStep.errorGeneric"))),y(!1)}}return e.jsx(be,{onClick:x?void 0:m,role:"presentation",children:e.jsxs(ye,{onClick:h=>h.stopPropagation(),role:"dialog","aria-modal":"true","aria-label":a,children:[e.jsxs(we,{children:[e.jsx(ve,{children:a}),e.jsx(je,{onClick:m,disabled:x,"aria-label":f("authorizeStep.close"),children:e.jsx(K,{name:"close",className:"ico"})})]}),e.jsxs(Ce,{"data-testid":"authorize-step-row",children:[e.jsx(ke,{children:i?e.jsx("img",{src:i,alt:""}):d}),e.jsxs(Me,{children:[e.jsx($e,{title:o,children:o}),e.jsx(Ae,{children:r})]})]}),e.jsx(Ne,{children:f("authorizeStep.note")}),e.jsx(q,{message:c}),e.jsxs(We,{children:[e.jsx(ze,{type:"button",onClick:b,disabled:x,children:f("authorizeStep.cancel")}),e.jsx(_e,{type:"button","data-testid":"authorize-step-action",onClick:()=>void v(),disabled:x,children:x?e.jsxs(e.Fragment,{children:[e.jsx(Ie,{"aria-hidden":!0}),f("authorizeStep.authorizing")]}):f("authorizeStep.authorize")})]})]})})}async function Xe(n){const[t]=await Se({...n,trades:[n.trade]});return t}async function Se(n){const{trades:t,buyer:a,signer:r,onSigned:o}=n;if(t.length===0)throw new Error("No items to buy");const i=new Map;for(const u of t){const b=`${u.chainId}:${u.contract.toLowerCase()}`,m=i.get(b);m?m.push(u):i.set(b,[u])}const d=[];for(const u of i.values())d.push(await Ee({trades:u,buyer:a,signer:r,onSigned:o}));return d}async function Ee(n){const{trades:t,buyer:a,signer:r,onSigned:o}=n,i=t[0],d=$(U(i.contract),i.chainId),u=$(_.MANAToken,i.chainId);await P({auth:{kind:T.Allowance,contractAddress:u.address,spenderAddress:d.address,chainId:i.chainId},signer:r});const b=t.map(c=>ee(c,a));if(L.enabled)try{const c=new se(d.abi).encodeFunctionData("accept",[b]),g=J(),v=V(r.provider,g),h=await ne(v,g,c,d,{serverURL:L.relayerUrl});return o==null||o(),await g.waitForTransaction(h,1,12e4),h}catch(c){if(c instanceof ae&&c.code===re.USER_DENIED)throw c;console.warn("[buyWithMana] gasless meta-tx failed, falling back to a direct tx:",c)}await Y(r.provider,i.chainId);const x=await new ie(d.address,d.abi,r).accept(b,te(i.chainId));return o==null||o(),(await x.wait()).transactionHash}async function et(n){const{trade:t,buyer:a,signer:r,credits:o,manaGapWei:i}=n;if(o.length===0)throw new Error("No credits to spend — use buyWithMana for a MANA-only purchase");if(i<=0n)throw new Error("No MANA gap to cover — use buyWithCredits for a credits-only purchase");const d=$(_.MANAToken,t.chainId),u=$(_.CreditsManager,t.chainId);await P({auth:{kind:T.Allowance,contractAddress:d.address,spenderAddress:u.address,chainId:t.chainId},signer:r});const m=(o.reduce((x,y)=>x+BigInt(y.availableAmount),0n)+i).toString();return X({trade:t,buyer:a,signer:r,credits:o,maxCreditedValue:m})}function tt({className:n}){return e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:n,children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"#691fa9",strokeWidth:"1.8"}),e.jsx("path",{d:"M12 7v6",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"16.5",r:"1.1",fill:"#691fa9"})]})}function nt({title:n,items:t,onViewAll:a}){const r=w.useRef(null),[o,i]=w.useState(1),[d,u]=w.useState(0),[b,m]=w.useState(!0),[x,y]=w.useState(!1),c=w.useCallback(()=>{const h=r.current;if(!h)return;const{scrollLeft:p,scrollWidth:S,clientWidth:A}=h,E=Math.max(1,Math.ceil(S/A));i(E),u(Math.min(E-1,Math.round(p/A))),m(p<=1),y(p+A>=S-1)},[]);if(w.useEffect(()=>{c();const h=r.current;if(h)return h.addEventListener("scroll",c,{passive:!0}),window.addEventListener("resize",c),()=>{h.removeEventListener("scroll",c),window.removeEventListener("resize",c)}},[c,t.length]),t.length===0)return null;function g(h){const p=r.current;p&&p.scrollBy({left:h*p.clientWidth,behavior:"smooth"})}function v(h){const p=r.current;p&&p.scrollTo({left:h*p.clientWidth,behavior:"smooth"})}return e.jsxs("section",{className:"collection-carousel",children:[e.jsxs("div",{className:"collection-carousel__head",children:[e.jsx("h2",{className:"collection-carousel__title",children:n}),a?e.jsxs("button",{className:"collection-carousel__viewall",onClick:a,children:[f("collectionCarousel.viewAll"),e.jsx(K,{name:"chevron-down",size:16,className:"collection-carousel__viewall-ico"})]}):null]}),e.jsxs("div",{className:"collection-carousel__viewport",children:[e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--left",onClick:()=>g(-1),"aria-label":f("collectionCarousel.scrollLeft"),disabled:b,children:e.jsx("img",{src:B,alt:"","aria-hidden":!0})}),e.jsx("div",{className:"collection-carousel__track",ref:r,children:t.map(h=>e.jsx(G,{item:h},h.id))}),e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--right",onClick:()=>g(1),"aria-label":f("collectionCarousel.scrollRight"),disabled:x,children:e.jsx("img",{src:B,alt:"","aria-hidden":!0})})]}),o>1?e.jsx("div",{className:"collection-carousel__dots","aria-label":f("collectionCarousel.pages"),children:Array.from({length:o}).map((h,p)=>e.jsx("button",{className:`collection-carousel__dot${p===d?" is-active":""}`,"aria-label":f("collectionCarousel.goToPage",{page:p+1}),"aria-current":p===d?"true":void 0,onClick:()=>v(p)},p))}):null]})}export{qe as A,nt as C,Ye as P,tt as W,N as a,Se as b,Ge as c,He as d,le as e,k as f,Xe as g,Je as h,Ze as i,et as j,Ve as m,Oe as s,Ue as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as D,j as e,L as re,d as se,b as te,r as j}from"./react-B36MyIP_.js";import{aC as oe,aD as ce,l as le,t as a,aE as E,B as ne,ay as K,e as ie,az as z,I,c as de,h as me,M as ue,as as he,aF as ge,b as xe}from"./index-
|
|
1
|
+
import{a as D,j as e,L as re,d as se,b as te,r as j}from"./react-B36MyIP_.js";import{aC as oe,aD as ce,l as le,t as a,aE as E,B as ne,ay as K,e as ie,az as z,I,c as de,h as me,M as ue,as as he,aF as ge,b as xe}from"./index-BSeusSHl.js";import{d as _e,g as pe,a as Ne,A as je}from"./collection-CHWj8iQW.js";import{u as be,L as fe}from"./useStore-Duh496VH.js";import{d as $,a as ve,S as w,F as Ce,e as we,b as ke}from"./categories-CV5P_HZd.js";import{L as B}from"./LoadMore-Cp-E67xI.js";import{u as R}from"./useInfiniteGrid-dBP53DpO.js";import{E as T}from"./ErrorNotice-D_Z5OVFI.js";import"./sentry-gZJVwIqQ.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BteKixT0.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";function Pe({collection:t,cover:r,itemCount:o}){const n=D(),{contractAddress:m,name:g,creator:x}=t,N=r==null||o==null,{data:i}=oe(m,N),p=r==null?(i==null?void 0:i.items)??[]:[],h=o??(i==null?void 0:i.total);function _(){n(`/collection/${m}`)}return e.jsxs("article",{className:"coll-card",role:"link",tabIndex:0,onClick:_,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),_())},children:[e.jsx("div",{className:"coll-card__media",children:r?e.jsx("img",{className:"coll-card__img","data-testid":"coll-card-img",src:r,alt:"",loading:"lazy"}):p.length>0?e.jsx(ce,{items:p,className:"coll-card__cover"}):null}),e.jsxs("div",{className:"coll-card__body",children:[e.jsx("h3",{className:"coll-card__name",title:g,children:g}),e.jsxs("div",{className:"coll-card__meta",children:[x?e.jsx(le,{address:x,className:"coll-card__creator",linkToProfile:!0}):e.jsx("span",{className:"coll-card__creator",children:" "}),e.jsx("span",{className:"coll-card__count",children:h==null?"…":a("collectionCard.itemCount",{count:h})})]}),e.jsx("button",{className:"coll-card__view",onClick:d=>{d.stopPropagation(),_()},tabIndex:-1,children:a("collectionCard.viewCollection")})]})]})}function ye({address:t,className:r=""}){const o=E(m=>m.followed.includes(t.toLowerCase())),n=E(m=>m.toggle);return t?e.jsx(ne,{type:"button",size:"sm",variant:o?"ghost":"outline",className:r||void 0,"aria-pressed":o,title:o?a("creator.unfollowTitle"):a("creator.followTitle"),onClick:()=>n(t),children:o?a("creator.following"):a("creator.follow")}):null}const Se={website:"website",twitter:"twitter",discord:"discord",facebook:"facebook"};function Le({address:t}){var d,b;const{data:r}=K(t),{data:o}=be(t),n=ie(l=>{var f;return(f=l.session)==null?void 0:f.address}),m=!!n&&n.toLowerCase()===t.toLowerCase(),g=(r==null?void 0:r.name)||z(t),x=(b=(d=r==null?void 0:r.avatar)==null?void 0:d.snapshots)==null?void 0:b.face256,N=(o==null?void 0:o.cover)||_e,i=o==null?void 0:o.description,p=`${de.profileUrl}/${t}`,h=fe.filter(l=>o==null?void 0:o.links[l]),_=pe(Ne({name:r==null?void 0:r.name,hasClaimedName:r==null?void 0:r.hasClaimedName,ethAddress:(r==null?void 0:r.ethAddress)??t}));return e.jsxs("section",{className:"creator-hero","aria-label":`${g} storefront`,children:[e.jsxs("div",{className:"creator-hero__cover",children:[e.jsx("img",{className:"creator-hero__cover-img",src:N,alt:"",loading:"eager"}),e.jsx("div",{className:"creator-hero__scrim","aria-hidden":!0})]}),(h.length>0||m)&&e.jsxs("div",{className:"creator-hero__links",children:[h.map(l=>e.jsx("a",{className:"creator-hero__link","data-testid":"creator-hero-link",href:(o==null?void 0:o.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:a(`creator.link.${l}`),"aria-label":a(`creator.link.${l}`),children:e.jsx(I,{name:Se[l]})},l)),m&&e.jsx(re,{className:"creator-hero__link creator-hero__edit",to:"/store-settings",title:a("creator.editStore"),"aria-label":a("creator.editStore"),children:e.jsx(I,{name:"pen"})})]}),e.jsxs("div",{className:"creator-hero__body",children:[x?e.jsx("img",{className:"creator-hero__ava",src:x,alt:"",loading:"eager",style:{backgroundColor:_}}):e.jsx("span",{className:"creator-hero__ava creator-hero__ava--ph","aria-hidden":!0,style:{backgroundColor:_}}),e.jsxs("div",{children:[e.jsx("h2",{className:"creator-hero__name",children:g}),i?e.jsx("p",{className:"creator-hero__desc",children:i}):null]}),e.jsxs("div",{className:"creator-hero__actions",children:[e.jsx("a",{className:"creator-hero__view","data-testid":"creator-hero-view",href:p,target:"_blank",rel:"noopener noreferrer",children:a("creator.viewProfile")}),e.jsx(ye,{address:t,className:"creator-hero__follow"})]})]})]})}const U=48;function Oe(){const{address:t}=se(),r=D(),[o]=te(),n=o.has("collections"),{data:m}=K(t),g=(m==null?void 0:m.name)||(t?z(t):a("creator.fallbackName"));me({title:g,description:a("seo.creator.description",{name:g})});const[x,N]=j.useState("wearable"),[i,p]=j.useState(null),[h,_]=j.useState([]),[d,b]=j.useState(""),[l,f]=j.useState(""),[P,O]=j.useState("newest"),y=d&&!Number.isNaN(Number(d))?Number(d):void 0,S=l&&!Number.isNaN(Number(l))?Number(l):void 0,G=i?ke[i]:void 0,H=($.find(s=>s.key===P)??$[0]).server,L={creator:t,category:x,rarities:h.length?h:void 0,wearableCategories:G,minPriceCredits:y,maxPriceCredits:S,sortBy:H},{items:v,total:Y,isLoading:C,error:A,hasNextPage:W,isFetchingNextPage:F,fetchNextPage:Z}=R(["creator-listings",L],s=>he({...L,first:U,skip:s}),{enabled:!!t&&!n}),u=R(["creator-collections",t],s=>ge(t,{first:U,skip:s}).then(c=>({items:c.collections,total:c.total})),{enabled:!!t&&n});function q(s){N(s),p(null),n&&M()}function M(){const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}`:""},{replace:!0})}function J(){if(n){M();return}const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function Q(s){_(c=>c.includes(s)?c.filter(ae=>ae!==s):[...c,s])}function V(){N("wearable"),p(null),_([]),b(""),f("")}const k=!!(y||S),X=k?`${d||"0"}–${l||"∞"}`:a("filter.price"),ee=x!=="wearable"||!!i||h.length>0||k;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":a("creator.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>r("/assets"),children:a("creator.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:g})]}),t?e.jsx(Le,{address:t}):null,!n&&!C&&v.length>0?e.jsx(je,{items:v,source:"creator"}):null,e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(ve,{category:x,subCategory:i,onCategory:q,onSub:p,title:a("creator.category"),flat:!0,collections:n,onCollections:J})}),e.jsx("div",{className:"browse__main",children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"creator-collections__bar",children:e.jsx("span",{className:"assets__count",children:u.isLoading?"…":a("creator.collectionsCount",{count:u.total})})}),u.error?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid grid--collections",children:u.isLoading?e.jsx(w,{count:9}):e.jsxs(e.Fragment,{children:[u.items.map(s=>e.jsx(Pe,{collection:s,itemCount:s.itemCount},s.contractAddress)),u.isFetchingNextPage?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:u.hasNextPage,isFetching:u.isFetchingNextPage,onLoadMore:()=>void u.fetchNextPage()}),!u.isLoading&&!u.error&&u.items.length===0?e.jsx("p",{className:"muted",children:a("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{rarities:h,onToggleRarity:Q,sort:P,onSort:O,total:Y,loading:C,anyActive:ee,onClear:V,renderTrailing:s=>e.jsx(we,{panelKey:"price",label:X,active:k,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMin"),placeholder:a("creator.priceMinPlaceholder"),value:d,onChange:c=>b(c.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMax"),placeholder:a("creator.priceMaxPlaceholder"),value:l,onChange:c=>f(c.target.value)})]}),e.jsx("p",{className:"filter-pop__hint",children:a("creator.priceHint",{currency:xe.name})})]})})}),A?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid",children:C?e.jsx(w,{count:15}):e.jsxs(e.Fragment,{children:[v.map(s=>e.jsx(ue,{item:s},s.id)),F?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:W,isFetching:F,onLoadMore:()=>void Z()}),!C&&!A&&v.length===0?e.jsx("p",{className:"muted",children:a("creator.empty")}):null]})})]})]})}export{Oe as Creator,Oe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-
|
|
1
|
+
import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-DvD-aezH.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-iGJTuv1I.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as pe,b as xe,r as l,j as t}from"./react-B36MyIP_.js";import{n as i,K as e,R as E,h as ue,t as r,e as ge,x as he,E as h,an as fe,b as p,J as U,F as N,I as ee,k as te,z as me}from"./index-
|
|
1
|
+
import{a as pe,b as xe,r as l,j as t}from"./react-B36MyIP_.js";import{n as i,K as e,R as E,h as ue,t as r,e as ge,x as he,E as h,an as fe,b as p,J as U,F as N,I as ee,k as te,z as me}from"./index-BSeusSHl.js";import{R as H}from"./resume-buy-Bf0zIH7y.js";import{R as be}from"./cart-checkout-D8_UxnB9.js";import{l as K}from"./loader-logo-BzY9EKdC.js";import{u as we,p as ye,c as ke,i as Ce}from"./useCreditPacks-Dg3_30xn.js";import"./sentry-gZJVwIqQ.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BteKixT0.js";import"./intl-CBcMB1D2.js";const S="https://cdn.decentraland.org/@dcl/shop/0.1.0-30362815497.commit-35ecdbf/assets/pack-coins-BDh1ZDbh.webp",ie="https://cdn.decentraland.org/@dcl/shop/0.1.0-30362815497.commit-35ecdbf/assets/pack-stacks-D-V2jSHW.webp",re="https://cdn.decentraland.org/@dcl/shop/0.1.0-30362815497.commit-35ecdbf/assets/pack-chest-BX_j84xW.webp",je="https://cdn.decentraland.org/@dcl/shop/0.1.0-30362815497.commit-35ecdbf/assets/credit-coin-CmcTCd5i.webp",$e="data:image/svg+xml,%3csvg%20width='60'%20height='60'%20viewBox='0%200%2060%2060'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='60'%20height='60'%20rx='30'%20fill='%2334CE77'/%3e%3cpath%20d='M21.6583%2046.1067L11.4656%2036.0591C10.1688%2034.829%2010.1905%2032.7207%2011.4769%2031.4622L13.6868%2029.3591C14.9732%2028.1006%2017.1615%2028.1058%2018.4582%2029.3359L23.8747%2034.6197L41.9704%2015.6527C43.2568%2014.3942%2045.4291%2014.2093%2046.7258%2015.4394L48.8765%2017.3628C50.1732%2018.5929%2050.3491%2020.6844%2049.0626%2021.9429L26.6112%2045.8766C25.1433%2047.342%2022.955%2047.3368%2021.6583%2046.1067Z'%20fill='%23FCFCFC'/%3e%3c/svg%3e",ve="https://cdn.decentraland.org/@dcl/shop/0.1.0-30362815497.commit-35ecdbf/assets/packs-backdrop-BcXiUPeP.webp",D="linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0)",Se=i.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 24px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-
|
|
1
|
+
import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-CFFpa2x2.js";import{d as g,r as v}from"./index-iGJTuv1I.js";import{C as c}from"./ConstantsUtil-CqaPdSAF.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-DvD-aezH.js";import{au as y}from"./NetworkUtil-DQZGJzap.js";const b=g`
|
|
2
2
|
:host {
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as R,r as h,j as e,L as B}from"./react-B36MyIP_.js";import{j as U,t as s,b as S,B as k,k as C,E as $,J as Q,h as P,e as W,x as O,u as z,n as F,U as J}from"./index-
|
|
1
|
+
import{a as R,r as h,j as e,L as B}from"./react-B36MyIP_.js";import{j as U,t as s,b as S,B as k,k as C,E as $,J as Q,h as P,e as W,x as O,u as z,n as F,U as J}from"./index-BSeusSHl.js";import{i as Y,R as D,f as G}from"./import-BgvjaGsU.js";import"./sentry-gZJVwIqQ.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-BteKixT0.js";import"./intl-CBcMB1D2.js";import"./buy-Tme1UHVf.js";import"./authorizations-CUAi4uqJ.js";import"./sendMetaTransaction-DEU_Xtzf.js";import"./trade-encoding-DXoI04Mc.js";import"./mana-rate-BJbe6lgb.js";function H({queue:n,session:T,onClose:j,onDone:o}){const N=R(),d=U(T.providerType),[m,f]=h.useState(()=>n.map(()=>"pending")),[I,E]=h.useState("running"),w=h.useRef(!1);h.useEffect(()=>{if(w.current)return;w.current=!0;let t=!1;return(async()=>{for(let r=0;r<n.length;r++){if(t)return;f(u=>u.map((g,p)=>p===r?"active":g));try{await Y(n[r].item,n[r].priceCredits,T),$("Shop Migrated Listing",{item_id:n[r].item.itemId??n[r].item.oldTradeId??null,contract_address:n[r].item.contractAddress,new_price_credits:n[r].priceCredits,new_price_usd:n[r].priceCredits/10}),t||f(u=>u.map((g,p)=>p===r?"done":g))}catch(u){if(u instanceof D)Q(u,{flow:"import_listing",step:"relist",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(g=>g.map((p,b)=>b===r?"unlisted":p));else{const g=u,p=g.code===4001||/reject|denied|cancel/i.test(g.message??"");p||Q(u,{flow:"import_listing",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(b=>b.map((a,l)=>l===r?p?"skipped":"failed":a))}}}t||E("finished")})(),()=>{t=!0}},[]);const _=m.filter(t=>t==="done").length,v=m.findIndex(t=>t==="active"),x=Math.round(m.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function y(){o(),j()}if(I==="finished"){const t=m.filter(r=>r==="skipped"||r==="failed").length,c=m.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:_>0?s("migrate.successTitle"):s("migrate.nothingTitle")}),e.jsxs("p",{className:"muted",style:{margin:0},children:[_>0?s("migrate.listedSummary",{count:_,currency:S.name}):s("migrate.noneListed"),t>0?" "+s("migrate.skippedSummary",{count:t}):"",c>0?" "+s("migrate.unlistedSummary",{count:c}):""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(k,{variant:"ghost",onClick:y,children:s("getCredits.done")}),c>0?e.jsx(k,{variant:"purple",onClick:()=>{o(),j(),N("/my-assets")},children:s("migrate.goToMyAssets")}):_>0?e.jsx(k,{variant:"purple",onClick:()=>{o(),j(),N("/assets")},children:s("migrate.viewInShop")}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate","data-testid":"modal",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:s("migrate.listingTitle")}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[d?s("migrate.subConfirm"):s("migrate.subManaged")," ",v>=0?s("migrate.progressCount",{current:v+1,total:n.length}):""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${x}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,c)=>e.jsxs("li",{className:`migrate__row migrate__row--${m[c]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||s("migrate.itemFallback")}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(C,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:m[c]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",d?s("migrate.statusConfirm"):s("migrate.statusAdding")]}):m[c]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):m[c]==="skipped"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusSkipped")}):m[c]==="failed"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusFailed")}):m[c]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:s("migrate.unlistedTooltip"),children:s("migrate.statusUnlisted")}):e.jsx("span",{className:"migrate__wait",children:s("migrate.statusWaiting")})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:d?s("migrate.hintConfirm"):s("migrate.hintManaged")})]})})}const A=F(k)`
|
|
2
2
|
margin-top: 10px;
|
|
3
3
|
`,V=F(k)`
|
|
4
4
|
padding: 13px 24px;
|