@dcl/shop 0.1.0-30532275270.commit-a2f045a → 0.1.0-30533220789.commit-7bdc9fc
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-CbMqQzHZ.js → Activity-DHcT0NJQ.js} +5 -5
- package/assets/{AnimatedBackground-BMoGVnu-.js → AnimatedBackground-DAYiO97V.js} +2 -2
- package/assets/{Assets-DcH8v049.js → Assets-CgAVCNln.js} +10 -10
- package/assets/{Assets.styles-C2A8CUAi.js → Assets.styles-99ENlFTF.js} +1 -1
- package/assets/{Authorizations-CoJ3Ra_P.js → Authorizations-mUxFKG6u.js} +2 -2
- package/assets/{Cart-CKkA6F0l.js → Cart-DU6OZ2TR.js} +10 -10
- package/assets/{CircularProgress-BBvMw0HD.js → CircularProgress-MdA4nK0M.js} +5 -5
- package/assets/{Collection-CT7H6Iat.js → Collection-DEbf6Pik.js} +1 -1
- package/assets/{CollectionCarousel-AI_GtvP3.js → CollectionCarousel-GA0qG2qL.js} +11 -11
- package/assets/{ContentClient-gZyDAKO3.js → ContentClient-CHs-qED4.js} +1 -1
- package/assets/{Creator-M4B8I_Qa.js → Creator-Lgx8CCs2.js} +5 -5
- package/assets/{DeploymentBuilder-DufsvYDr.js → DeploymentBuilder-ku3det23.js} +1 -1
- package/assets/{ErrorNotice-7lrQ5fyU.js → ErrorNotice-CK4lBVOL.js} +1 -1
- package/assets/{ExchangeController-CrTq22ta.js → ExchangeController-qK879qyE.js} +1 -1
- package/assets/{GetCredits-D4-Nd3Rr.js → GetCredits-Ci0y1ioU.js} +12 -12
- package/assets/{HelpersUtil-C97X2mL1.js → HelpersUtil-dZeTnpvn.js} +1 -1
- package/assets/{ImportListings-Dr89QkkM.js → ImportListings-DWvRK7Iw.js} +10 -10
- package/assets/{ItemDetail-VbfIuH1Q.js → ItemDetail-hA7QMWxr.js} +24 -24
- package/assets/LoadMore-BPUX0H_4.js +7 -0
- package/assets/{MenuList-Qx-qACQt.js → MenuList-Cww1tjVv.js} +1 -1
- package/assets/{MyAssets-Bg7seD5E.js → MyAssets-CbRnqEUT.js} +1 -1
- package/assets/{MyFavorites-DZAOw6sU.js → MyFavorites-DMexPVyD.js} +1 -1
- package/assets/{NotFound-Ca5MLBnt.js → NotFound-BS0Tbunn.js} +4 -4
- package/assets/{NotificationsBell-CPq4ywSS.js → NotificationsBell-DDbo4iZn.js} +1 -1
- package/assets/{StoreSettings-BUVzCOC4.js → StoreSettings-BsANXVe6.js} +5 -5
- package/assets/{Success-D8cw654x.js → Success-BhoyFUvj.js} +7 -7
- package/assets/{SwapController-TQEZkP3S.js → SwapController-BhSWjg_q.js} +1 -1
- package/assets/{Tooltip-6L66h5-B.js → Tooltip-ByBgftfn.js} +1 -1
- package/assets/{TradeService-CmEo9qNj.js → TradeService-BTErm28m.js} +1 -1
- package/assets/{W3MFrameProviderSingleton-wlaGUzlC.js → W3MFrameProviderSingleton-BsbvrUws.js} +3 -3
- package/assets/{WebCryptoP256-D4jtQCS_.js → WebCryptoP256-B9kdEJYr.js} +1 -1
- package/assets/{authorizations-CuAc2XNm.js → authorizations-DFNq9Tgp.js} +1 -1
- package/assets/{basic-BtRQIBSr.js → basic-C_iELqsA.js} +1 -1
- package/assets/{biconomy-ByzzTnNJ.js → biconomy-f6KI6CNd.js} +1 -1
- package/assets/browseLayout.styles-Cmr9wUVU.js +91 -0
- package/assets/{builder-DHb3XLhA.js → builder-DCiuBzde.js} +1 -1
- package/assets/{buy-CqH6bZKJ.js → buy-DM-cSEnp.js} +1 -1
- package/assets/{buy-gasless-BppY_ycq.js → buy-gasless-4_XeVMNy.js} +1 -1
- package/assets/{categories-Ii_8mB-U.js → categories-DpOXLpA1.js} +3 -3
- package/assets/{ccip-BiUOzWPo.js → ccip-wPDIiKjj.js} +1 -1
- package/assets/{ccip-BVsU6ewa.js → ccip-ylse5_Kd.js} +1 -1
- package/assets/{clsx-gjbd6Og2.js → clsx-B-q2CjUj.js} +2 -2
- package/assets/{controller-Co1-cKSv.js → controller-y5wQtcRI.js} +2 -2
- package/assets/{core-mul2yOPE.js → core-9ETwjyyw.js} +4 -4
- package/assets/{createSvgIcon-bdXjSxn7.js → createSvgIcon-Cg_YayG4.js} +3 -3
- package/assets/{custom-D7xF5lj-.js → custom-quw6VfoY.js} +1 -1
- package/assets/{data-capture-yH3jYwyM.js → data-capture-CcbMvFTV.js} +1 -1
- package/assets/{email-Cp2tYkC5.js → email-DHZihEAj.js} +1 -1
- package/assets/{embedded-wallet-BCQNiaOl.js → embedded-wallet-DyU_HywD.js} +1 -1
- package/assets/{emotion-styled.browser.esm-FOCyt_32.js → emotion-styled.browser.esm-UYGVcgjh.js} +1 -1
- package/assets/{engine-ChEnHgTC.js → engine-yDAKevG_.js} +1 -1
- package/assets/{errors-DO4BAL3a.js → errors-ChVGWplO.js} +1 -1
- package/assets/{estimate-l1-fee-DSqjPH6d.js → estimate-l1-fee-KZr1MEvO.js} +1 -1
- package/assets/{ethers-CpLYx0ea.js → ethers-CXBJm_wN.js} +1 -1
- package/assets/{execute-pLWBON1m.js → execute-Bd9BxvT3.js} +2 -2
- package/assets/{features-dN_Tmzyb.js → features-A-VDHJUY.js} +1 -1
- package/assets/{fetchTokenMetadata-DQHY0RzR.js → fetchTokenMetadata-DtVJcSJp.js} +2 -2
- package/assets/{get-ecosystem-wallet-info-Bq5fCSPW.js → get-ecosystem-wallet-info-zgqdQXds.js} +1 -1
- package/assets/{getBalance-BzjMPt51.js → getBalance-CaDvSg8z.js} +1 -1
- package/assets/{getNFT-BKee0rFf.js → getNFT-hEiojfwE.js} +1 -1
- package/assets/{getNFT-clj6qr0h.js → getNFT-llCzlOpx.js} +1 -1
- package/assets/{getThemeProps-DpSrsNzC.js → getThemeProps-CyTO66m-.js} +1 -1
- package/assets/{grid.styles-CBL5-QgD.js → grid.styles-BKcqv8ku.js} +1 -1
- package/assets/{hashTypedData-Umk2D-Fv.js → hashTypedData-BwAGg-bM.js} +1 -1
- package/assets/{hashTypedData-CEkTyB4O.js → hashTypedData-ClRj-Vq3.js} +1 -1
- package/assets/{import-DmtyCc6m.js → import-DZDyJpzb.js} +1 -1
- package/assets/{in-app-De4GslKA.js → in-app-DvVGn-Tr.js} +1 -1
- package/assets/{in-app-wallet-calls-bdyVm0s9.js → in-app-wallet-calls-BFOriSM3.js} +1 -1
- package/assets/{index-CHtagFNQ.js → index-7p9A6Y0a.js} +1 -1
- package/assets/{index-yPSwFHJl.js → index-B-PC7kzk.js} +1 -1
- package/assets/{index-DM_2rgLV.js → index-BJyrx34m.js} +1 -1
- package/assets/{index-BdoU8P0k.js → index-BM5QAu0f.js} +1 -1
- package/assets/{index-awpxTEfa.js → index-BOqjnYX-.js} +1 -1
- package/assets/{index-CErFnDxO.js → index-BT3SHHd5.js} +1 -1
- package/assets/{index--LSY5-1n.js → index-BWrvjmvA.js} +1 -1
- package/assets/{index-BfZyGlMC.js → index-BXU-nLAg.js} +1 -1
- package/assets/{index-B4FgMNzP.js → index-BXwiCVbv.js} +1 -1
- package/assets/{index-uAE5YYu_.js → index-BZ0ivrP7.js} +1 -1
- package/assets/{index-BvX1QIzX.js → index-Bbuk9Khc.js} +1 -1
- package/assets/{index-NlFL3d2s.js → index-BdttBNrs.js} +1 -1
- package/assets/{index-Bvk6vM0C.js → index-BgMBv9dR.js} +1 -1
- package/assets/{index-BNfX7QrP.js → index-BimrH13W.js} +2 -2
- package/assets/{index-Fb0K-mXa.js → index-Bjg7TODu.js} +1 -1
- package/assets/{index-DSWXAUVm.js → index-BkypgqOV.js} +1 -1
- package/assets/{index-BiKZ964V.js → index-BllcClN6.js} +1 -1
- package/assets/{index-DS96DfqT.js → index-Bvg39vl-.js} +1 -1
- package/assets/{index-B7ResnK5.js → index-BzC7P3rh.js} +1 -1
- package/assets/{index-BONtSxa0.js → index-C2bGw1aV.js} +1 -1
- package/assets/{index-Jl8k4zvP.js → index-C3kietSY.js} +1 -1
- package/assets/{index-CK7WvZif.js → index-CEP90DOS.js} +1 -1
- package/assets/{index-Cver6pep.js → index-CKm5jjNA.js} +1 -1
- package/assets/{index-G_dn-tvL.js → index-C_8fFdiQ.js} +1 -1
- package/assets/{index-BgaV9USa.js → index-CcILR5tk.js} +3 -3
- package/assets/{index-C8hIMbtK.js → index-CewFuSMJ.js} +1 -1
- package/assets/{index-DknMEmk3.js → index-CgqZXKRV.js} +1 -1
- package/assets/{index-D-IAkb5J.js → index-Cra6AwSQ.js} +1 -1
- package/assets/{index-B-Kqr2Lr.js → index-Cw22meEP.js} +1 -1
- package/assets/{index-DZT3e3OX.js → index-CxfxQdzz.js} +1 -1
- package/assets/{index-CjyETdIk.js → index-D-EI3P40.js} +3 -3
- package/assets/{index-BWdFjMnd.js → index-D0Y8g2RK.js} +1 -1
- package/assets/{index-CMt5tDkm.js → index-D0YGh1qc.js} +1 -1
- package/assets/{index-C9-FY-Ky.js → index-D2tIIB80.js} +1 -1
- package/assets/index-D5DVXUwH.js +2815 -0
- package/assets/{index-CFMaudzh.js → index-DA9dNuFx.js} +1 -1
- package/assets/{index-BpuTOU0Y.js → index-DDLYKD1A.js} +1 -1
- package/assets/{index-BJQJ6qaf.js → index-DFzHpbP5.js} +1 -1
- package/assets/{index-DlkFYSp0.js → index-DQ2tXB-9.js} +1 -1
- package/assets/{index-B54fv8BV.js → index-DV71UlyX.js} +2 -2
- package/assets/{index-CB_CYh2b.js → index-De4CFGxV.js} +1 -1
- package/assets/{index-DutOGRmD.js → index-DgKHc2Pp.js} +1 -1
- package/assets/{index-CV_6t64M.js → index-DhLo2n6f.js} +3 -3
- package/assets/{index-Be0ZRjCF.js → index-Di6u8k7B.js} +1 -1
- package/assets/{index-QvFmNklc.js → index-DpBcQE_6.js} +2 -2
- package/assets/{index-Cpb2GsOL.js → index-DtDHbRaI.js} +1 -1
- package/assets/{index-DUoFIKBs.js → index-DtJyQ9bI.js} +1 -1
- package/assets/{index-CBNY7GXM.js → index-Gh8Wo_nP.js} +1 -1
- package/assets/{index-DrQdISEN.js → index-LJgz7Vh0.js} +1 -1
- package/assets/{index-CYxLeUYk.js → index-QqnCK59E.js} +1 -1
- package/assets/{index-CeUaTQBa.js → index-T6QVaQCG.js} +1 -1
- package/assets/{index-CFVWvFqS.js → index-Vn0Ag5lj.js} +2 -2
- package/assets/{index-TbYX4rLT.js → index-aqbngM36.js} +1 -1
- package/assets/{index-DAbgom1O.js → index-ic-9gGyQ.js} +1 -1
- package/assets/{index-CRH1JYli.js → index-mUhc64Y7.js} +2 -2
- package/assets/{index-cFddn33m.js → index-n6Y6VcrN.js} +1 -1
- package/assets/{index-gtWzDPti.js → index-qV7AbQfd.js} +1 -1
- package/assets/{index.es-DzMzdwPi.js → index.es-CztAAmPP.js} +4 -4
- package/assets/{index.es-BFcZPPhE.js → index.es-DVrmRSwM.js} +1 -1
- package/assets/{index.es-DHdAVxZp.js → index.es-bWvk478d.js} +1 -1
- package/assets/{localBatchGatewayRequest-CmlDXZ5z.js → localBatchGatewayRequest-DuBJGihv.js} +1 -1
- package/assets/{mana-convert-KYZPeT3f.js → mana-convert-DlwVmR8Z.js} +1 -1
- package/assets/{mana-rate-BPbJ056a.js → mana-rate-BfcKcY1g.js} +1 -1
- package/assets/{networks-yZyw6wIL.js → networks-1Ibttcj1.js} +1 -1
- package/assets/{onramp-DOIKmPiV.js → onramp-aAvMQcmO.js} +1 -1
- package/assets/{openzeppelin-D2LH4Ydk.js → openzeppelin-C38CqrRA.js} +1 -1
- package/assets/{parseNft-T_nq-FRz.js → parseNft-6oJxXfwc.js} +2 -2
- package/assets/{parseSignature-CvqOiuxh.js → parseSignature-CNg3sYg3.js} +1 -1
- package/assets/{parseSignature-DcnU6VsD.js → parseSignature-CoR3bR9Z.js} +3 -3
- package/assets/{passkeys-DRffD36u.js → passkeys-DA1I0YCi.js} +1 -1
- package/assets/{pay-with-exchange-Ds1MFPWI.js → pay-with-exchange-ClJmaJuN.js} +1 -1
- package/assets/{qr-overlay-B_n8DdYE.js → qr-overlay-DluNEOGD.js} +1 -1
- package/assets/{receive-YaMGhsu8.js → receive-BcyE8h_z.js} +1 -1
- package/assets/{resolveImplementation-CP8ReK0t.js → resolveImplementation-yzbJCbQl.js} +1 -1
- package/assets/{rpc-Lt48x6y2.js → rpc-CtvmLvX8.js} +1 -1
- package/assets/{secp256k1-lg2mkCel.js → secp256k1-BxtxQFCf.js} +1 -1
- package/assets/{secp256k1-DLLGRjo2.js → secp256k1-CErv03Bc.js} +1 -1
- package/assets/{secp256k1-BDvY1_CS.js → secp256k1-CbUZMnZP.js} +1 -1
- package/assets/{send-C0DGzWDF.js → send--RiC0a6k.js} +1 -1
- package/assets/{send-batch-transaction-zJ_VDicb.js → send-batch-transaction-DOj0V2-L.js} +1 -1
- package/assets/{send-eip712-transaction-Dq_x23F7.js → send-eip712-transaction-CIzKCZyA.js} +2 -2
- package/assets/{send-gasless-transaction-B-ZOssZP.js → send-gasless-transaction-BWlKSPeq.js} +2 -2
- package/assets/{send-transaction-vZeDg_HE.js → send-transaction-BPaN8n6Z.js} +2 -2
- package/assets/{sendMetaTransaction-DenOLxoI.js → sendMetaTransaction-BKizuZFV.js} +1 -1
- package/assets/{sendRawTransaction-CMejmfE_.js → sendRawTransaction-CxB_4oN4.js} +3 -3
- package/assets/{serializeTransaction-fkTrXDU0.js → serializeTransaction-C3q3weD9.js} +1 -1
- package/assets/{session-proposal-NFuTkmi6.js → session-proposal-vDKIjX3g.js} +1 -1
- package/assets/{session-request-xNEp01mS.js → session-request-CHfNc9vC.js} +2 -2
- package/assets/{signing-D5SsZYxi.js → signing-B7_GRHUe.js} +3 -3
- package/assets/{socials-M6SDfPLz.js → socials-DK5o9fyb.js} +1 -1
- package/assets/{swaps-as4l882g.js → swaps-DfDMa1aq.js} +1 -1
- package/assets/{thirdweb-B0ediOQG.js → thirdweb-CIO7xwSs.js} +3 -3
- package/assets/{to-serializable-transaction-B1HReYXC.js → to-serializable-transaction-Bdgoy0Wm.js} +2 -2
- package/assets/trade-encoding-B0FxJexO.js +1 -0
- package/assets/{transactionReceipt-DWQKELDB.js → transactionReceipt-CWj8puIV.js} +1 -1
- package/assets/{transactions-1NqtgaFK.js → transactions-D-SPS7uV.js} +1 -1
- package/assets/useCreditPacks-Cpp2jALc.js +1 -0
- package/assets/{useInfiniteGrid-lzr54mZj.js → useInfiniteGrid-C475cv9A.js} +1 -1
- package/assets/useManaRate-D_UeFv99.js +1 -0
- package/assets/useSecondarySales-kULWuUVg.js +1 -0
- package/assets/{useStore-D-wvS_np.js → useStore-Cl1MYHtr.js} +2 -2
- package/assets/useTheme-CxKwPhP1.js +1 -0
- package/assets/{verifyHash-DOqrIW3W.js → verifyHash-Bt32rWW9.js} +1 -1
- package/assets/{w3m-modal-GWJUaUWr.js → w3m-modal-2-4Pq3p_.js} +1 -1
- package/assets/{w3m-modal-D3KNKX82.js → w3m-modal-CsLwVxzq.js} +1 -1
- package/assets/{wait-for-tx-receipt-DrhWpj7T.js → wait-for-tx-receipt-B_tiZ6k5.js} +1 -1
- package/assets/{wallets-CG89q62s.js → wallets-xc4Kph_C.js} +5 -5
- package/assets/{web-connector-BoJZiGWp.js → web-connector-CAYL-Why.js} +3 -3
- package/assets/{writeContract-y1Yqqq2A.js → writeContract-DalyEIEs.js} +1 -1
- package/assets/{zoraTestnet-BsKNbyY5.js → zoraTestnet-05BYQqBP.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/assets/LoadMore-Ph3D3bIG.js +0 -7
- package/assets/browseLayout.styles-CQaQRgwg.js +0 -91
- package/assets/index-YNVuXck0.js +0 -2759
- package/assets/loader-logo-BzY9EKdC.js +0 -1
- package/assets/trade-encoding-BtHgpsoS.js +0 -1
- package/assets/useCreditPacks-KAopaQFi.js +0 -1
- package/assets/useManaRate-D40Girrk.js +0 -1
- package/assets/useSecondarySales-VfEySv0L.js +0 -1
- package/assets/useTheme-BfFEOOz_.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as b,j as e,L as _,d as dt}from"./react-vyZjIDcS.js";import{
|
|
1
|
+
import{r as b,j as e,L as _,d as dt}from"./react-vyZjIDcS.js";import{aH as lt,s as l,t as o,x as ut,B as ht,m as xt,e as d,n as pt,u as j,I as g,aI as R,aJ as G,aK as mt,z as v,aL as gt,ao as T,D as J,J as ft,aM as yt,aN as Q}from"./index-D5DVXUwH.js";import{m as bt}from"./mana-convert-DlwVmR8Z.js";import{u as jt}from"./useManaRate-D_UeFv99.js";import{L as vt}from"./LoadMore-BPUX0H_4.js";import{u as f}from"./useInfiniteGrid-C475cv9A.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./mana-rate-BfcKcY1g.js";const kt=15e3;function wt(t,i){return t.txHash&&i.txHash?t.txHash===i.txHash:t.txHash||i.txHash?!1:t.status===i.status&&Math.abs(t.createdAt-i.createdAt)<=kt}function It(t){const i=[...t].sort((a,n)=>n.createdAt-a.createdAt),s=[];for(const a of i){const n=s[s.length-1];n&&wt(n[n.length-1],a)?n.push(a):s.push([a])}return s.map(a=>{var n;return{id:((n=a.find(c=>c.txHash))==null?void 0:n.txHash)??a[a.length-1].id,createdAt:Math.max(...a.map(c=>c.createdAt)),status:a.some(c=>c.status==="PENDING")?"PENDING":"SETTLED",totalCredits:a.reduce((c,h)=>c+h.credits,0),lines:a}})}function At(t){const i=[],s=new Map;for(const a of t)if(a.tradeId){const n=s.get(a.tradeId);if(n){n.quantity+=1,n.credits+=a.credits;continue}const c={key:a.tradeId,tradeId:a.tradeId,quantity:1,credits:a.credits};s.set(a.tradeId,c),i.push(c)}else i.push({key:a.id,tradeId:null,quantity:1,credits:a.credits});return i}function $t(t,i){return{id:t.id,contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId,counterparty:t.buyer,credits:i?bt(t.manaWei,i):null,manaWei:t.manaWei,createdAt:t.createdAt,txHash:t.txHash}}function Pt(t){const s=It(t.purchases.filter(r=>r.status!=="EXPIRED")).map(r=>({kind:"purchase",id:`purchase:${r.id}`,createdAt:r.createdAt,order:r})),a=t.sales.map(r=>{const x=$t(r,t.rate);return{kind:"sale",id:`sale:${x.id}`,createdAt:x.createdAt,sale:x}}),n=(t.creditOrders??[]).filter(r=>r.status!=="failed"&&r.status!=="abandoned").map(r=>({kind:"credit",id:`credit:${r.id}`,createdAt:r.createdAt,order:r})),c=new Set(t.purchases.filter(r=>r.txHash).map(r=>r.txHash.toLowerCase())),h=(t.manaPurchases??[]).filter(r=>!c.has(r.txHash.toLowerCase())).map(r=>({kind:"mana-purchase",id:`mana-purchase:${r.id}`,createdAt:r.createdAt,sale:r}));return[...s,...a,...n,...h].sort((r,x)=>x.createdAt-r.createdAt||(r.id<x.id?-1:1))}function Lt(t,i){return i==="all"?t:i==="sales"?t.filter(s=>s.kind==="sale"):t.filter(s=>s.kind==="purchase"||s.kind==="credit"||s.kind==="mana-purchase")}const X=t=>t.trim().toLowerCase();function Nt(t){const i=new Map;for(const s of t??[]){const a=X(s.txHash??"");if(!a)continue;const n=i.get(a);n?n.push(s):i.set(a,[s])}return i}function Tt(t,i,s=Date.now()){const a=i.txHash?t.get(X(i.txHash)):void 0;if(!a||a.length===0)return{kind:"direct"};const n=a.length===1?Et(a[0].netCents):null,c=a.filter(r=>!r.available&&r.availableAt>s);if(c.length===0)return{kind:"credited",credits:n};const h=c.reduce((r,x)=>Math.max(r,x.availableAt),0);return{kind:"pending",credits:n,availableAt:h}}function Et(t){return lt(t)}const Ct="https://cdn.decentraland.org/@dcl/shop/0.1.0-30533220789.commit-7bdc9fc/assets/credits-product-vs4Q6u6l.svg",E=ut`
|
|
2
2
|
0% { background-position: 200% 0; }
|
|
3
3
|
100% { background-position: -200% 0; }
|
|
4
4
|
`,Ft=l.section`
|
|
@@ -220,7 +220,7 @@ import{r as b,j as e,L as _,d as dt}from"./react-vyZjIDcS.js";import{aE as lt,s
|
|
|
220
220
|
border-radius: 10px;
|
|
221
221
|
background: linear-gradient(100deg, ${o.colors.media} 30%, ${o.colors.panel} 50%, ${o.colors.media} 70%);
|
|
222
222
|
background-size: 200% 100%;
|
|
223
|
-
animation: ${
|
|
223
|
+
animation: ${E} 1.3s infinite linear;
|
|
224
224
|
|
|
225
225
|
@media (prefers-reduced-motion: reduce) {
|
|
226
226
|
animation: none;
|
|
@@ -243,7 +243,7 @@ import{r as b,j as e,L as _,d as dt}from"./react-vyZjIDcS.js";import{aE as lt,s
|
|
|
243
243
|
border-radius: 6px;
|
|
244
244
|
background: linear-gradient(100deg, ${o.colors.media} 30%, ${o.colors.panel} 50%, ${o.colors.media} 70%);
|
|
245
245
|
background-size: 200% 100%;
|
|
246
|
-
animation: ${
|
|
246
|
+
animation: ${E} 1.3s infinite linear;
|
|
247
247
|
|
|
248
248
|
@media (prefers-reduced-motion: reduce) {
|
|
249
249
|
animation: none;
|
|
@@ -269,7 +269,7 @@ import{r as b,j as e,L as _,d as dt}from"./react-vyZjIDcS.js";import{aE as lt,s
|
|
|
269
269
|
border: 1px solid transparent;
|
|
270
270
|
background: linear-gradient(100deg, ${o.colors.media} 30%, ${o.colors.panel} 50%, ${o.colors.media} 70%);
|
|
271
271
|
background-size: 200% 100%;
|
|
272
|
-
animation: ${
|
|
272
|
+
animation: ${E} 1.3s infinite linear;
|
|
273
273
|
|
|
274
274
|
@media (prefers-reduced-motion: reduce) {
|
|
275
275
|
animation: none;
|
|
@@ -288,4 +288,4 @@ import{r as b,j as e,L as _,d as dt}from"./react-vyZjIDcS.js";import{aE as lt,s
|
|
|
288
288
|
margin: 6px 0 0;
|
|
289
289
|
`,Bt=l(ht)`
|
|
290
290
|
margin-top: 12px;
|
|
291
|
-
`,q=N.withComponent(_),y=24,
|
|
291
|
+
`,q=N.withComponent(_),y=24,Rt=["all","purchases","sales"];function m(t){try{return new Date(t).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function tt(t){return t.length>10?`${t.slice(0,6)}…${t.slice(-4)}`:t}function et(t){const i=Number(t)/1e18;return Number.isFinite(i)?i.toLocaleString("en",{maximumFractionDigits:2}):"0"}function it({children:t}){const i=b.useRef(null),[s,a]=b.useState(null),n=()=>{var h;const c=(h=i.current)==null?void 0:h.getBoundingClientRect();c&&a({top:c.bottom+8,left:c.left+c.width/2})};return e.jsxs(qt,{ref:i,tabIndex:0,onMouseEnter:n,onMouseLeave:()=>a(null),onFocus:n,onBlur:()=>a(null),children:[t,s?dt.createPortal(e.jsx(Ot,{style:{top:s.top,left:s.left},role:"tooltip",children:d("activity.polygonMana")}),document.body):null]})}function Gt({item:t}){const{data:i,isLoading:s}=j({queryKey:["trade-display",t.tradeId],queryFn:()=>yt(t.tradeId),enabled:!!t.tradeId,staleTime:3e5}),a=!!t.tradeId&&s,n=(i==null?void 0:i.name)??d("activity.itemFallback"),c=(i==null?void 0:i.thumbnail)??"",h=T({contractAddress:i==null?void 0:i.contractAddress,tokenId:i==null?void 0:i.tokenId,itemId:i==null?void 0:i.itemId})??void 0,r=e.jsxs(e.Fragment,{children:[a?e.jsx(S,{}):e.jsx(F,{children:c?e.jsx("img",{src:c,alt:n}):e.jsx(g,{name:"cart",size:20})}),e.jsxs(M,{children:[a?e.jsx(H,{}):e.jsx(D,{title:n,children:n}),t.quantity>1?e.jsx(z,{children:d("activity.quantity",{count:t.quantity})}):null]}),e.jsxs(Wt,{children:[e.jsx(v,{className:"ccy-mark"})," ",t.credits]})]});return h?e.jsx(q,{to:h,"data-link":"true",children:r}):e.jsx(N,{children:r})}function Kt({order:t}){const i=At(t.lines),s=i.reduce((a,n)=>a+n.quantity,0);return e.jsxs(k,{"data-testid":"purchase-order",children:[e.jsxs(w,{children:[e.jsxs(I,{children:[e.jsx(A,{children:m(t.createdAt)}),e.jsxs($,{children:[d("activity.purchaseLabel")," · ",d("activity.itemCount",{count:s})]})]}),e.jsxs(P,{children:[e.jsx(L,{"data-status":t.status,children:t.status==="PENDING"?d("activity.processing"):d("activity.completed")}),e.jsxs(p,{children:[e.jsx(v,{className:"ccy-mark"})," ",t.totalCredits]})]})]}),e.jsx(C,{children:i.map(a=>e.jsx(Gt,{item:a},a.key))})]})}function Ut({sale:t}){const{data:i,isLoading:s}=j({queryKey:["asset-display",t.contractAddress,t.tokenId,t.itemId],queryFn:()=>Q(t.contractAddress,{tokenId:t.tokenId,itemId:t.itemId}),enabled:!!t.contractAddress,staleTime:3e5}),a=(i==null?void 0:i.name)??d("activity.itemFallback"),n=(i==null?void 0:i.thumbnail)??"",c=T({contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId})??void 0,h=e.jsxs(e.Fragment,{children:[s?e.jsx(S,{}):e.jsx(F,{children:n?e.jsx("img",{src:n,alt:a}):e.jsx(g,{name:"offer",size:20})}),e.jsxs(M,{children:[s?e.jsx(H,{}):e.jsx(D,{title:a,children:a}),e.jsx(z,{children:d("activity.boughtFrom",{account:tt(t.seller)})})]})]});return e.jsxs(k,{"data-testid":"activity-mana-purchase",children:[e.jsxs(w,{children:[e.jsxs(I,{children:[e.jsx(A,{children:m(t.createdAt)}),e.jsx($,{children:d("activity.paidWithMana")})]}),e.jsxs(P,{children:[e.jsx(L,{"data-status":"SETTLED",children:d("activity.completed")}),e.jsxs(p,{children:[et(t.manaWei)," ",e.jsx(it,{children:e.jsx(Z,{src:J,alt:"MANA"})})]})]})]}),e.jsx(C,{children:c?e.jsx(q,{to:c,"data-link":"true",children:h}):e.jsx(N,{children:h})})]})}function _t({sale:t,payout:i}){const{data:s,isLoading:a}=j({queryKey:["asset-display",t.contractAddress,t.tokenId,t.itemId],queryFn:()=>Q(t.contractAddress,{tokenId:t.tokenId,itemId:t.itemId}),enabled:!!t.contractAddress,staleTime:3e5}),n=(s==null?void 0:s.name)??d("activity.itemFallback"),c=(s==null?void 0:s.thumbnail)??"",h=T({contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId})??void 0,r=e.jsxs(e.Fragment,{children:[a?e.jsx(S,{}):e.jsx(F,{children:c?e.jsx("img",{src:c,alt:n}):e.jsx(g,{name:"offer",size:20})}),e.jsxs(M,{children:[a?e.jsx(H,{}):e.jsx(D,{title:n,children:n}),e.jsxs(z,{children:[d("activity.soldTo",{account:tt(t.counterparty)}),i.kind==="pending"?` · ${d("activity.payoutPendingOn",{date:m(i.availableAt)})}`:""]})]})]});return e.jsxs(k,{"data-testid":"activity-sale",children:[e.jsxs(w,{children:[e.jsxs(I,{children:[e.jsx(A,{children:m(t.createdAt)}),e.jsx($,{children:d("activity.saleLabel")})]}),e.jsxs(P,{children:[e.jsx(L,{"data-status":i.kind==="pending"?"PENDING":"SOLD",children:i.kind==="pending"?d("activity.payoutPending"):d("activity.sold")}),i.kind==="direct"?e.jsxs(p,{"data-kind":"income",children:["+",et(t.manaWei)," ",e.jsx(it,{children:e.jsx(Z,{src:J,alt:"MANA"})})]}):i.credits!==null?e.jsxs(p,{"data-kind":"income",children:[e.jsx(v,{className:"ccy-mark"})," +",ft(i.credits)]}):e.jsx(p,{"data-kind":"income",children:d("activity.payoutCredited")})]})]}),e.jsx(C,{children:h?e.jsx(q,{to:h,"data-link":"true",children:r}):e.jsx(N,{children:r})})]})}function Jt({order:t}){const i=`$${(t.usdCents/100).toFixed(2)}`,s=gt(t.status),a=s==="SETTLED"?d("activity.completed"):s==="FAILED"?d("activity.failed"):d("activity.processing");return e.jsx(k,{"data-testid":"credit-order",children:e.jsxs(w,{children:[e.jsx(zt,{children:e.jsx("img",{src:Ct,alt:"","aria-hidden":!0})}),e.jsxs(I,{children:[e.jsx(A,{children:m(t.createdAt)}),e.jsxs($,{children:[d("activity.creditPurchaseLabel")," · ",d("activity.creditPaid",{usd:i})]})]}),e.jsxs(P,{children:[e.jsx(L,{"data-status":s,children:a}),e.jsxs(p,{"data-kind":"income",children:["+",e.jsx(v,{className:"ccy-mark"})," ",t.credits]})]})]})})}function Qt({filter:t}){const i={all:{icon:"clock",title:d("activity.emptyAllTitle"),body:d("activity.emptyAllBody")},purchases:{icon:"cart",title:d("activity.emptyPurchasesTitle"),body:d("activity.emptyPurchasesBody")},sales:{icon:"offer",title:d("activity.emptySalesTitle"),body:d("activity.emptySalesBody")}}[t];return e.jsxs(V,{children:[e.jsx(g,{name:i.icon,size:40,color:o.colors.muted2}),e.jsx(Y,{children:i.title}),e.jsx("p",{className:"muted",children:i.body}),t!=="sales"?e.jsx(Bt,{as:_,to:"/assets",variant:"purple",children:d("notFound.cta")}):null]})}function oe(){xt({title:d("nav.activity"),noindex:!0});const{session:t}=pt(),[i,s]=b.useState("all"),a=!!t&&i!=="sales",n=!!t&&i!=="purchases",c=f(["purchases",t==null?void 0:t.address],u=>mt(t.address,t.identity,{first:y,skip:u}),{enabled:a}),h=f(["sales",t==null?void 0:t.address],u=>R(t.address,{role:"seller",first:y,skip:u}),{enabled:n}),r=f(["credit-orders",t==null?void 0:t.address],u=>G(t.address,t.identity,{first:y,skip:u}),{enabled:a}),x=f(["mana-purchases",t==null?void 0:t.address],u=>R(t.address,{role:"buyer",first:y,skip:u}),{enabled:a}),{data:O}=j({queryKey:["sale-payouts",t==null?void 0:t.address],queryFn:()=>G(t.address,t.identity,{first:200}).then(u=>u.payouts),enabled:n,staleTime:6e4}),at=b.useMemo(()=>Nt(O),[O]),{data:nt}=jt(n);if(!t)return e.jsxs(V,{children:[e.jsx(g,{name:"clock",size:40,color:o.colors.muted2}),e.jsx(Y,{children:d("activity.signInTitle")}),e.jsx("p",{className:"muted",children:d("activity.signInBody")})]});const W=Lt(Pt({purchases:a?c.items:[],sales:n?h.items:[],creditOrders:a?r.items:[],manaPurchases:a?x.items:[],rate:nt}),i),st=a&&(c.isLoading||r.isLoading||x.isLoading)||n&&h.isLoading,B=a&&(c.isFetchingNextPage||r.isFetchingNextPage||x.isFetchingNextPage)||n&&h.isFetchingNextPage,rt=a&&(c.hasNextPage||r.hasNextPage||x.hasNextPage)||n&&h.hasNextPage;function ot(){a&&c.hasNextPage&&c.fetchNextPage(),a&&r.hasNextPage&&r.fetchNextPage(),a&&x.hasNextPage&&x.fetchNextPage(),n&&h.hasNextPage&&h.fetchNextPage()}return e.jsxs(Ft,{children:[e.jsx(St,{children:e.jsx(Mt,{children:d("nav.activity")})}),e.jsx(Dt,{role:"tablist","aria-label":d("nav.activity"),children:Rt.map(u=>e.jsx(Ht,{type:"button",role:"tab","aria-selected":i===u,"data-active":i===u,"data-testid":`activity-filter-${u}`,onClick:()=>s(u),children:d(`activity.filter.${u}`)},u))}),st?e.jsx(K,{children:Array.from({length:5}).map((u,ct)=>e.jsx(U,{},ct))}):W.length===0?e.jsx(Qt,{filter:i}):e.jsxs(e.Fragment,{children:[e.jsxs(K,{children:[W.map(u=>u.kind==="purchase"?e.jsx(Kt,{order:u.order},u.id):u.kind==="credit"?e.jsx(Jt,{order:u.order},u.id):u.kind==="mana-purchase"?e.jsx(Ut,{sale:u.sale},u.id):e.jsx(_t,{sale:u.sale,payout:Tt(at,u.sale)},u.id)),B?e.jsx(U,{}):null]}),e.jsx(vt,{hasNextPage:rt,isFetching:B,onLoadMore:ot})]})]})}export{oe as Activity};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,j as v}from"./react-vyZjIDcS.js";import{s as u}from"./index-
|
|
1
|
+
import{r as l,j as v}from"./react-vyZjIDcS.js";import{s as u}from"./index-D5DVXUwH.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";const S="https://cdn.decentraland.org/@dcl/shop/0.1.0-30533220789.commit-7bdc9fc/assets/custom-welcome-background-BxlFQma9.webp",b="https://cdn.decentraland.org/@dcl/shop/0.1.0-30533220789.commit-7bdc9fc/assets/DCL_LogoPattern-BryBPc3d.png",U=`
|
|
2
2
|
attribute vec2 a_position;
|
|
3
3
|
varying vec2 v_uv;
|
|
4
4
|
void main() {
|
|
@@ -94,4 +94,4 @@ void main() {
|
|
|
94
94
|
inset: 0;
|
|
95
95
|
width: 100%;
|
|
96
96
|
height: 100%;
|
|
97
|
-
`;function G(){const t=l.useRef(null),n=l.useRef(0);return l.useEffect(()=>{var x;const r=t.current;if(!r||(x=window.matchMedia)!=null&&x.call(window,"(prefers-reduced-motion: reduce)").matches)return;const e=r.getContext("webgl",{alpha:!1,antialias:!1});if(!e)return;const o=p(e,e.VERTEX_SHADER,U),
|
|
97
|
+
`;function G(){const t=l.useRef(null),n=l.useRef(0);return l.useEffect(()=>{var x;const r=t.current;if(!r||(x=window.matchMedia)!=null&&x.call(window,"(prefers-reduced-motion: reduce)").matches)return;const e=r.getContext("webgl",{alpha:!1,antialias:!1});if(!e)return;const o=p(e,e.VERTEX_SHADER,U),c=p(e,e.FRAGMENT_SHADER,P);if(!o||!c){o&&e.deleteShader(o),c&&e.deleteShader(c);return}const a=D(e,o,c);if(!a){e.deleteShader(o),e.deleteShader(c);return}const m=e.getAttribLocation(a,"a_position"),R=e.getUniformLocation(a,"u_time"),y=e.getUniformLocation(a,"u_resolution"),_=e.getUniformLocation(a,"u_overlayTex"),s=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,new Float32Array([-1,-1,1,-1,-1,1,-1,1,1,-1,1,1]),e.STATIC_DRAW);let d=!1;const f=L(e,b,()=>d),w=()=>{const i=window.devicePixelRatio||1,E=r.clientWidth*i,g=r.clientHeight*i;(r.width!==E||r.height!==g)&&(r.width=E,r.height=g)},A=performance.now()/1e3,h=()=>{w(),e.viewport(0,0,r.width,r.height),e.useProgram(a),e.uniform1f(R,performance.now()/1e3-A),e.uniform2f(y,r.width,r.height),e.activeTexture(e.TEXTURE0),e.bindTexture(e.TEXTURE_2D,f),e.uniform1i(_,0),e.enableVertexAttribArray(m),e.bindBuffer(e.ARRAY_BUFFER,s),e.vertexAttribPointer(m,2,e.FLOAT,!1,0,0),e.drawArrays(e.TRIANGLES,0,6),n.current=requestAnimationFrame(h)},T=i=>{i.preventDefault(),cancelAnimationFrame(n.current),r.style.opacity="0"};return r.addEventListener("webglcontextlost",T,!1),n.current=requestAnimationFrame(h),()=>{d=!0,cancelAnimationFrame(n.current),r.removeEventListener("webglcontextlost",T),e.deleteProgram(a),e.deleteShader(o),e.deleteShader(c),e.deleteBuffer(s),e.deleteTexture(f)}},[]),v.jsxs(B,{"aria-hidden":!0,children:[v.jsx(F,{style:{backgroundImage:`url(${S})`}}),v.jsx(I,{ref:t})]})}export{G as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,
|
|
1
|
+
import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,at as Ze,au as Je,d as Ke,s as n,t,n as Ie,al as Qe,E as Xe,J as Ae,y as Ye,e as s,I as R,z as W,aQ as he,aj as et,aq as K,ax as tt,aw as nt,m as Ne,o as st,S as fe,A as O,aR as ot,aS as it}from"./index-D5DVXUwH.js";import{u as rt}from"./useSecondarySales-kULWuUVg.js";import{a as at,m as Me}from"./mana-convert-DlwVmR8Z.js";import{u as Pe}from"./useManaRate-D_UeFv99.js";import{g as lt,h as ct,i as dt,j as pt,k as xt,C as ht,l as ft,o as mt,m as ut,n as gt,M as bt,p as yt,E as wt,q as jt,r as vt,s as $t,t as Ct,u as kt,v as St}from"./Assets.styles-99ENlFTF.js";import{c as me,R as Et,F as Rt,S as Tt}from"./categories-DpOXLpA1.js";import{L as _t}from"./LoadMore-BPUX0H_4.js";import{u as zt}from"./useInfiniteGrid-C475cv9A.js";import{E as It}from"./ErrorNotice-CK4lBVOL.js";import{d as At}from"./dcl-schemas-BICTSpB5.js";import{s as Nt,G as Mt,w as Pt,S as Wt}from"./buy-gasless-4_XeVMNy.js";import{s as Bt}from"./buy-DM-cSEnp.js";import{i as Ft}from"./trade-encoding-B0FxJexO.js";import{r as Lt}from"./mana-rate-BfcKcY1g.js";import{f as Ht}from"./errors-ChVGWplO.js";import{J as Ut,C as Ot,B as ee}from"./ethers-CXBJm_wN.js";import{n as Gt}from"./Tooltip-ByBgftfn.js";import{G as Dt}from"./grid.styles-BKcqv8ku.js";import"./sentry-B35L1FdR.js";import"./intl-CBcMB1D2.js";import"./authorizations-DFNq9Tgp.js";import"./sendMetaTransaction-BKizuZFV.js";function G(o){const i=o.source??"item",l=o.tradeId||`${o.contractAddress}-${o.tokenId??o.itemId??""}`;return`${i}:${l}`}const F="100000000000000000000",We=2,Q=15,qt=/^[a-zA-Z0-9]+$/;function ue(o){const i=o.trim();return i.length===0?{ok:!1,reason:"empty"}:qt.test(i)?i.length<We?{ok:!1,reason:"too-short"}:i.length>Q?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Vt(o){return o.replace(/[^a-zA-Z0-9]/g,"").slice(0,Q)}const Zt=["function available(string _subdomain) view returns (bool)"],ge={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Jt(){return B.chainId===Number(At.ChainId.MATIC_MAINNET)?ge.mainnet:ge.sepolia}async function Kt(o,i={}){var p;const{rpc:l,address:x}=Jt(),c=new Ut(l),d=new Ot(x,Zt,c);console.info(`[names] availability check → DCLRegistrar(${x}).available("${o}") on ${l}`);const h=await d.available(o);if((p=i.signal)!=null&&p.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${o}" available=${h}`),h?"available":"taken"}const Qt="https://app.across.to/api";class Be extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function Xt(o){return at(F,o)}async function Yt(o,i,l={}){var p;const x=l.chainId??B.chainId,c=l.provider??"across",d=`${B.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(i)}&chainId=${x}&provider=${c}`,h=await Ke(d,{method:"GET",identity:o,metadata:{}});if(!h.ok){let a;try{a=(p=await h.json())==null?void 0:p.code}catch{}throw a==="ROUTE_COST_TOO_HIGH"?new Be:new Error(`fetchNameCreditRoute ${h.status}`)}return h.json()}function en(o,i){const l=ee.from(o.availableAmount),c=ee.from(F).sub(l);return{credits:[{value:o.amount,expiresAt:Number(o.expiresAt),salt:Ft(o.id)}],creditsSignatures:[o.signature],externalCall:{target:i.externalCall.target,selector:i.externalCall.selector,data:i.externalCall.data,expiresAt:i.externalCall.expiresAt,salt:i.externalCall.salt},customExternalCallSignature:i.customExternalCallSignature,maxUncreditedValue:c.isNegative()?"0":c.toString(),maxCreditedValue:F}}async function tn(o,i={}){const l=Qt,x=i.intervalMs??1e4,c=i.maxAttempts??60;let d={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let h=0;h<c;h++){try{const p=await fetch(`${l}/deposit/status?originChainId=137&depositTxHash=${o}`);if(p.ok){const a=await p.json(),u=(a.status??"pending").toLowerCase(),b=a.fillTx??a.fillTxnRef??null,w=a.actionsSucceeded!==!1;if(u==="filled")return{status:"filled",destinationTxHash:b,actionsSucceeded:w};if(u==="refunded"||u==="expired")return{status:u,destinationTxHash:null,actionsSucceeded:!1};d={status:"pending",destinationTxHash:b,actionsSucceeded:w}}}catch{}h<c-1&&await new Promise(p=>setTimeout(p,x))}return d}async function nn(o){const{name:i,identity:l,signer:x}=o,c=o.chainId??B.chainId,d=o.provider??"across",h=(o.beneficiary??await x.getAddress()).toLowerCase();let p=null,a=!1;console.info("[names] register start",{name:i,buyer:h,chainId:c,provider:d});try{const u=await Lt(c),b=Xt(u);console.info("[names] step 1/6 sized reservation",{usdCents:b,manaRate:u});const w=await Yt(l,i,{chainId:c,provider:d});console.info("[names] step 2/6 route fetched",{target:w.externalCall.target,selector:w.externalCall.selector,provider:w.provider,quoteId:w.quoteId});const j=await Ze(l,b);if(p=j.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:j.credit.id,maxCreditedValue:j.maxCreditedValue}),ee.from(j.maxCreditedValue).lt(F))throw new Error("Credit under-sized for the name price");const $=en(j.credit,w);let f;try{f=await Nt({chainId:c,buyer:h,signer:x,args:$})}catch(y){if(!(y instanceof Mt))throw y;f=await Bt(c,$,x)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:f}),await Pt(f),a=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:f}),d==="across"){const y=await tn(f,o.acrossPoll);if(console.info("[names] step 6/6 across status",y),y.status==="pending")return{status:"pending",originTxHash:f};if(y.status!=="filled"||!y.actionsSucceeded)throw new Error("The name could not be registered on Ethereum; your funds were recovered.");return{status:"registered",originTxHash:f,destinationTxHash:y.destinationTxHash}}return{status:"pending",originTxHash:f}}catch(u){if(console.error("[names] register failed — raw error:",u,{name:i,buyer:h,originConfirmed:a}),u instanceof Wt)return{status:"pending",originTxHash:u.txHash};if(p&&!a&&await Je(l,[p]).catch(()=>{}),u instanceof Be)throw u;const b=new Error(Ht(u,"Couldn't register the name. Please try again.",{sale:!0}));throw b.cause=u,b}}const sn=n.div`
|
|
2
2
|
position: fixed;
|
|
3
3
|
inset: 0;
|
|
4
4
|
z-index: 10000;
|
|
@@ -366,7 +366,7 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,aq
|
|
|
366
366
|
flex: none;
|
|
367
367
|
color: ${t.colors.dclRed};
|
|
368
368
|
}
|
|
369
|
-
`;function Sn({name:o,priceCredits:i,onClose:l}){const{session:x}=Ie(),{data:c,isError:d}=Qe(x),h=Xe(),p=ze(),[a,u]=m.useState("confirm"),[b,w]=m.useState(""),[j,$]=m.useState(null),f=m.useRef(!1),y=b.trim().toLowerCase()===o.toLowerCase(),v=a==="completing",k=i!=null?Ae(i):"—";m.useEffect(()=>{const g=T=>{T.key==="Escape"&&!v&&l()};document.addEventListener("keydown",g);const I=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",g),document.body.style.overflow=I}},[v,l]);async function C(){if(!(!x||!y||f.current)){f.current=!0,u("completing"),$(null);try{await nn({name:o,identity:x.identity,signer:x.signer}),
|
|
369
|
+
`;function Sn({name:o,priceCredits:i,onClose:l}){const{session:x}=Ie(),{data:c,isError:d}=Qe(x),h=Xe(),p=ze(),[a,u]=m.useState("confirm"),[b,w]=m.useState(""),[j,$]=m.useState(null),f=m.useRef(!1),y=b.trim().toLowerCase()===o.toLowerCase(),v=a==="completing",k=i!=null?Ae(i):"—";m.useEffect(()=>{const g=T=>{T.key==="Escape"&&!v&&l()};document.addEventListener("keydown",g);const I=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",g),document.body.style.overflow=I}},[v,l]);async function C(){if(!(!x||!y||f.current)){f.current=!0,u("completing"),$(null);try{await nn({name:o,identity:x.identity,signer:x.signer}),K("Shop Completed Purchase",{purchase_type:"name",is_primary:!0,payment_type:"credits",value_credits:i??null}),h.invalidateQueries({queryKey:["usd-balance"]}),h.invalidateQueries({queryKey:["my-assets"]}),u("success")}catch(g){K(nt(g)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:tt(g),purchase_type:"name"}),$((g==null?void 0:g.message)||s("names.errorGeneric")),u("error")}finally{f.current=!1}}}const z=a!=="success",E=Ye(x==null?void 0:x.providerType);return e.jsx(sn,{onClick:v?void 0:l,role:"presentation",children:e.jsxs(on,{role:"dialog","aria-modal":"true","aria-label":s("names.buyTitle"),onClick:g=>g.stopPropagation(),children:[z&&e.jsxs(e.Fragment,{children:[e.jsxs(be,{children:[e.jsx(ye,{children:a==="error"?s("names.errorTitle"):s("names.buyTitle")}),e.jsx(we,{onClick:l,disabled:v,"aria-label":s("buyModal.close"),children:e.jsx(R,{name:"close"})})]}),e.jsxs(je,{children:[s("names.myCreditsBalance")," ",e.jsx(W,{})," ",he(c,d)]}),e.jsx(ve,{})]}),(a==="confirm"||a==="error")&&e.jsxs(e.Fragment,{children:[e.jsxs($e,{children:[e.jsx(Ce,{"aria-hidden":!0,children:"@"}),e.jsxs(ke,{children:[e.jsxs(Se,{children:[o,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ee,{children:s("names.subtitle")})]}),e.jsxs(Re,{children:[e.jsx(W,{}),k]})]}),a==="error"?e.jsxs(e.Fragment,{children:[e.jsxs(kn,{children:[e.jsx(R,{name:"info","aria-hidden":!0}),e.jsx("span",{children:j})]}),e.jsx(Te,{onClick:()=>u("confirm"),children:s("names.tryAgain")})]}):e.jsxs(e.Fragment,{children:[e.jsxs(rn,{children:[e.jsx(an,{children:s("names.confirmTitle")}),e.jsx(ln,{dangerouslySetInnerHTML:{__html:s("names.confirmBody",{name:`<b>@${En(o)}</b>`})}}),e.jsxs(cn,{children:[e.jsx(dn,{"aria-hidden":!0,children:"@"}),e.jsx(pn,{value:b,onChange:g=>w(g.target.value.replace(/[^a-zA-Z0-9]/g,"")),placeholder:"yourname","aria-label":s("names.reenterAria"),autoComplete:"off",spellCheck:!1,style:{width:`${Math.max(b.length,8)}ch`}}),e.jsx(xn,{children:".dcl.eth"})]})]}),e.jsx(Te,{onClick:()=>void C(),disabled:!y||!x,children:s("names.buyCta")})]})]}),a==="completing"&&e.jsxs(hn,{children:[e.jsx(fn,{src:et,alt:"",width:56,height:56}),e.jsx(mn,{children:E?s("names.confirming"):s("names.completing")}),e.jsxs(un,{children:[e.jsx(gn,{"aria-hidden":!0,children:e.jsx("span",{})}),e.jsx(bn,{children:"1/1"})]})]}),a==="success"&&e.jsxs(e.Fragment,{children:[e.jsxs(be,{children:[e.jsx(ye,{children:s("names.successHeaderTitle")}),e.jsx(we,{onClick:l,"aria-label":s("buyModal.close"),children:e.jsx(R,{name:"close"})})]}),e.jsxs(je,{children:[s("names.myCreditsBalance")," ",e.jsx(W,{})," ",he(c,d)]}),e.jsx(ve,{}),e.jsxs(yn,{children:[e.jsx(wn,{"aria-hidden":!0,children:e.jsx(R,{name:"check"})}),e.jsxs(jn,{children:[e.jsx("b",{children:s("names.successBannerBold")})," ",s("names.successBannerRest")]})]}),e.jsxs($e,{style:{marginTop:20},children:[e.jsx(Ce,{"aria-hidden":!0,children:"@"}),e.jsxs(ke,{children:[e.jsxs(Se,{children:[o,e.jsx("span",{children:".dcl.eth"})]}),e.jsx(Ee,{children:s("names.subtitle")})]}),e.jsxs(Re,{children:[e.jsx(W,{}),k]})]}),e.jsxs(vn,{children:[e.jsx($n,{onClick:()=>{l(),p("/my-assets")},children:s("names.myItems")}),e.jsx(Cn,{href:B.profileUrl,target:"_blank",rel:"noopener noreferrer",children:s("names.assignToAvatar")})]})]})]})})}function En(o){return o.replace(/[&<>"']/g,i=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[i])}const Rn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30533220789.commit-7bdc9fc/assets/identity-B4DXDuJP.webp",Tn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30533220789.commit-7bdc9fc/assets/world-B-9aPlxu.webp",_n="https://cdn.decentraland.org/@dcl/shop/0.1.0-30533220789.commit-7bdc9fc/assets/invite-BfwIhP2C.webp",zn="https://cdn.decentraland.org/@dcl/shop/0.1.0-30533220789.commit-7bdc9fc/assets/governance-DnazlIjy.webp",In=n.div`
|
|
370
370
|
width: 100%;
|
|
371
371
|
min-width: 0;
|
|
372
372
|
`,An=n.nav`
|
|
@@ -460,7 +460,7 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,aq
|
|
|
460
460
|
gap: 12px;
|
|
461
461
|
`,Un=n.div`
|
|
462
462
|
position: relative;
|
|
463
|
-
`,On=n("div",
|
|
463
|
+
`,On=n("div",Gt("invalid"))`
|
|
464
464
|
display: flex;
|
|
465
465
|
align-items: center;
|
|
466
466
|
gap: 8px;
|
|
@@ -476,7 +476,7 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,aq
|
|
|
476
476
|
${t.media.maxWidth("mobile")} {
|
|
477
477
|
border-radius: 16px;
|
|
478
478
|
}
|
|
479
|
-
`,
|
|
479
|
+
`,Gn=n.span`
|
|
480
480
|
position: absolute;
|
|
481
481
|
left: -9999px;
|
|
482
482
|
top: 0;
|
|
@@ -491,7 +491,7 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,aq
|
|
|
491
491
|
${t.media.maxWidth("mobile")} {
|
|
492
492
|
font-size: 16px;
|
|
493
493
|
}
|
|
494
|
-
`,
|
|
494
|
+
`,Dn=n.div`
|
|
495
495
|
position: absolute;
|
|
496
496
|
top: calc(100% + 8px);
|
|
497
497
|
left: 0;
|
|
@@ -550,7 +550,7 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,aq
|
|
|
550
550
|
${t.media.maxWidth("mobile")} {
|
|
551
551
|
font-size: 20px;
|
|
552
552
|
}
|
|
553
|
-
`,
|
|
553
|
+
`,Jn=n.input`
|
|
554
554
|
flex: 0 1 auto;
|
|
555
555
|
min-width: 0;
|
|
556
556
|
max-width: 100%;
|
|
@@ -572,7 +572,7 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,aq
|
|
|
572
572
|
${t.media.maxWidth("mobile")} {
|
|
573
573
|
font-size: 16px;
|
|
574
574
|
}
|
|
575
|
-
`,
|
|
575
|
+
`,Kn=n.span`
|
|
576
576
|
flex: none;
|
|
577
577
|
margin-left: 2px;
|
|
578
578
|
font-family: ${t.font.sans};
|
|
@@ -716,7 +716,7 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,aq
|
|
|
716
716
|
${t.media.maxWidth("mobile")} {
|
|
717
717
|
grid-template-columns: 1fr;
|
|
718
718
|
}
|
|
719
|
-
`,
|
|
719
|
+
`,D=n.article`
|
|
720
720
|
min-width: 0;
|
|
721
721
|
display: flex;
|
|
722
722
|
flex-direction: column;
|
|
@@ -743,7 +743,7 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,aq
|
|
|
743
743
|
line-height: 1.57;
|
|
744
744
|
text-transform: uppercase;
|
|
745
745
|
color: ${t.colors.text};
|
|
746
|
-
`,
|
|
746
|
+
`,J=n.p`
|
|
747
747
|
margin: 0;
|
|
748
748
|
font-family: ${t.font.sans};
|
|
749
749
|
font-weight: 400;
|
|
@@ -784,4 +784,4 @@ import{b as ze,r as m,j as e,u as Ve}from"./react-vyZjIDcS.js";import{c as B,aq
|
|
|
784
784
|
clip: rect(0, 0, 0, 0);
|
|
785
785
|
white-space: nowrap;
|
|
786
786
|
border: 0;
|
|
787
|
-
`,as="https://docs.decentraland.org/creator/worlds/about/",ls="https://governance.decentraland.org";function cs(o){const i=typeof window<"u"?window.location.hostname:"";return`${i.endsWith("decentraland.org")?"https://decentraland.org":i.endsWith("decentraland.today")?"https://decentraland.today":"https://decentraland.zone"}/marketplace/names/browse?search=${encodeURIComponent(o)}`}function ds({onBack:o}){Ne({title:s("seo.names.title"),description:s("seo.names.description")});const{session:i,signIn:l}=Ie(),{data:x}=Pe(),c=x?Me(F,x):null,[d,h]=m.useState(""),[p,a]=m.useState("idle"),[u,b]=m.useState(!1),w=m.useRef(null),[j,$]=m.useState(void 0);m.useLayoutEffect(()=>{w.current&&$(w.current.offsetWidth)},[d]),m.useEffect(()=>{if(!ue(d).ok){a(d.length===0?"idle":"invalid");return}a("checking");const z=new AbortController,E=setTimeout(()=>{(async()=>{try{const g=await Jt(d,{signal:z.signal});a(g)}catch(g){if((g==null?void 0:g.name)==="AbortError")return;a("error")}})()},400);return()=>{clearTimeout(E),z.abort()}},[d]);const f=ue(d),y=f.ok&&(p==="available"||p==="error");function v(){if(y){if(!i){l();return}b(!0)}}const k=e.jsxs(e.Fragment,{children:[s("names.claim"),c!=null?e.jsxs(Yn,{children:[e.jsx(W,{}),Ae(c)]}):null]});return e.jsxs(In,{"data-testid":"names-page",children:[e.jsxs(An,{"aria-label":s("names.breadcrumbAria"),children:[e.jsx(Nn,{onClick:o,children:s("names.breadcrumbCollectibles")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(Mn,{children:s("names.breadcrumbCurrent")})]}),e.jsxs(Pn,{children:[e.jsxs(Wn,{children:[e.jsxs(Bn,{children:[e.jsx(Fn,{children:s("names.heroTitle")}),e.jsx(Ln,{children:s("names.heroSubtitle")})]}),e.jsxs(Hn,{children:[e.jsxs(Un,{children:[e.jsxs(On,{invalid:p==="taken",children:[e.jsxs(Vn,{children:[e.jsx(Zn,{"aria-hidden":!0,children:"@"}),e.jsx(Kn,{value:d,onChange:C=>h(Vt(C.target.value)),placeholder:s("names.inputPlaceholder"),"aria-label":s("names.inputAria"),autoComplete:"off",spellCheck:!1,maxLength:Q,style:{width:j!=null?`${j}px`:void 0}}),e.jsx(Dn,{ref:w,"aria-hidden":!0,children:d||s("names.inputPlaceholder")}),e.jsx(Jn,{children:s("names.suffix")})]}),d.length>0?e.jsxs(Qn,{"aria-hidden":!0,children:[d.length,"/",Q]}):null,e.jsx(Fe,{onClick:v,disabled:!y,"data-testid":"names-claim",children:k})]}),p==="taken"?e.jsxs(Gn,{role:"status","data-testid":"names-taken",children:[e.jsx(R,{name:"info",size:16,"aria-hidden":!0}),e.jsx("span",{children:s("names.taken")}),e.jsxs(qn,{href:cs(d),target:"_blank",rel:"noopener noreferrer",children:[s("names.takenMakeOffer"),e.jsx(R,{name:"external-link",size:13,"aria-hidden":!0})]})]}):null]}),e.jsx(Xn,{onClick:v,disabled:!y,children:k}),p==="checking"?e.jsx(X,{tone:"muted",role:"status","data-testid":"names-checking",children:s("names.checking")}):p==="error"?e.jsx(X,{tone:"muted",role:"status",children:s("names.checkError")}):p==="invalid"&&!f.ok&&f.reason==="too-short"?e.jsx(X,{tone:"muted",role:"status",children:s("names.tooShort",{min:We})}):null,e.jsx(rs,{role:"status","aria-live":"polite",children:p==="available"?s("names.available",{name:d}):""})]})]}),e.jsxs(es,{children:[e.jsxs(ts,{children:[e.jsx(ns,{children:s("names.whyTitle")}),e.jsx(ss,{children:s("names.whyIntro")})]}),e.jsxs(os,{children:[e.jsxs(G,{children:[e.jsx(q,{src:Rn,alt:""}),e.jsxs(V,{children:[e.jsx(Z,{children:s("names.why1Title")}),e.jsx(K,{children:s("names.why1")})]})]}),e.jsxs(G,{children:[e.jsx(q,{src:Tn,alt:""}),e.jsxs(V,{children:[e.jsx(Z,{children:s("names.why2Title")}),e.jsxs(K,{children:[s("names.why2")," ",e.jsx(is,{children:s("names.why2Address")})]}),e.jsxs(_e,{href:as,target:"_blank",rel:"noopener noreferrer",children:[s("names.learnMore"),e.jsx(R,{name:"external-link","aria-hidden":!0})]})]})]}),e.jsxs(G,{children:[e.jsx(q,{src:_n,alt:""}),e.jsxs(V,{children:[e.jsx(Z,{children:s("names.why3Title")}),e.jsx(K,{children:s("names.why3")})]})]}),e.jsxs(G,{children:[e.jsx(q,{src:zn,alt:""}),e.jsxs(V,{children:[e.jsx(Z,{children:s("names.why4Title")}),e.jsx(K,{children:s("names.why4")}),e.jsxs(_e,{href:ls,target:"_blank",rel:"noopener noreferrer",children:[s("names.learnMore"),e.jsx(R,{name:"external-link","aria-hidden":!0})]})]})]})]})]})]}),u?e.jsx(Sn,{name:d,priceCredits:c,onClose:()=>b(!1)}):null]})}const ps="data:image/svg+xml,%3csvg%20width='101'%20height='101'%20viewBox='0%200%20101%20101'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M42.4493%2040.9855L30.7394%2052.6954'%20stroke='%23FF5A57'%20stroke-width='3.15625'%20stroke-linecap='round'/%3e%3cpath%20d='M30.7391%2040.9855L42.449%2052.6954'%20stroke='%23FF5A57'%20stroke-width='3.15625'%20stroke-linecap='round'/%3e%3cpath%20d='M36.2621%2071.0604C29.6047%2071.0604%2023.9709%2068.7542%2019.3608%2064.1416C14.7507%2059.5291%2012.4445%2053.8953%2012.442%2047.2404C12.4396%2040.5854%2014.7459%2034.9516%2019.3608%2030.3391C23.9758%2025.7266%2029.6096%2023.4203%2036.2621%2023.4203C42.9146%2023.4203%2048.5496%2025.7266%2053.167%2030.3391C57.7844%2034.9516%2060.0895%2040.5854%2060.0822%2047.2404C60.0822%2049.9277%2059.6546%2052.4624%2058.7995%2054.8445C57.9445%2057.2265%2056.784%2059.3336%2055.3181%2061.1659L75.84%2081.6878C76.5119%2082.3597%2076.8478%2083.2148%2076.8478%2084.2531C76.8478%2085.2914%2076.5119%2086.1465%2075.84%2086.8183C75.1682%2087.4902%2074.3131%2087.8261%2073.2748%2087.8261C72.2365%2087.8261%2071.3814%2087.4902%2070.7096%2086.8183L50.1877%2066.2964C48.3554%2067.7623%2046.2482%2068.9227%2043.8662%2069.7778C41.4842%2070.6329%2038.9495%2071.0604%2036.2621%2071.0604ZM36.2621%2063.7312C40.8429%2063.7312%2044.7372%2062.1285%2047.9449%2058.9232C51.1527%2055.7179%2052.7554%2051.8236%2052.7529%2047.2404C52.7505%2042.6571%2051.1478%2038.7641%2047.9449%2035.5612C44.742%2032.3583%2040.8478%2030.7544%2036.2621%2030.7495C31.6764%2030.7447%2027.7834%2032.3485%2024.5829%2035.5612C21.3825%2038.7739%2019.7786%2042.6669%2019.7713%2047.2404C19.764%2051.8138%2021.3678%2055.7081%2024.5829%2058.9232C27.798%2062.1383%2031.6911%2063.7409%2036.2621%2063.7312Z'%20fill='url(%23paint0_linear_search_empty)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_search_empty'%20x1='10.4127'%20y1='55.6273'%20x2='124.009'%20y2='44.925'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FF2D55'/%3e%3cstop%20offset='1'%20stop-color='%23FFBC5B'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",Y=48;function Ps(){const[o]=Ve(),i=ze(),l=(o.get("q")??"").trim().toLowerCase(),x=(o.get("q")??"").trim();Ne({title:x?s("seo.collectibles.searchTitle",{query:x}):s("seo.collectibles.title"),description:s("seo.collectibles.description")});const[c,d]=m.useState("wearable"),[h,p]=m.useState(null),[a,u]=m.useState([]),[b,w]=m.useState(""),[j,$]=m.useState(""),[f,y]=m.useState("on_sale"),[v,k]=m.useState(!1),[C,z]=m.useState("newest"),[E,g]=m.useState(!1);m.useEffect(()=>{if(!E)return;const r=N=>{N.key==="Escape"&&g(!1)};document.addEventListener("keydown",r);const S=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",r),document.body.style.overflow=S}},[E]);const I=f==="on_sale",T=b&&!Number.isNaN(Number(b))?Number(b):void 0,M=j&&!Number.isNaN(Number(j))?Number(j):void 0,Le=it(),te=h?Rt[h]:void 0,ne=(me.find(r=>r.key===C)??me[0]).server,se={category:c,rarities:a.length?a:void 0,wearableCategories:te,minPriceCredits:T,maxPriceCredits:M,search:l||void 0,sortBy:ne,isSmart:v||void 0,onSale:!0,listingType:Le?void 0:"primary"},oe={category:c,rarities:a.length?a:void 0,wearableCategories:te,search:l||void 0,sortBy:ne,isWearableSmart:v||void 0,isOnSale:f==="not_for_sale"?!1:void 0},{items:L,total:ie,isLoading:_,isPlaceholderData:A,error:re,hasNextPage:He,isFetchingNextPage:ae,fetchNextPage:Ue}=_t(I?["shop-items",se]:["catalog-items",oe],r=>I?st({...se,first:Y,skip:r}):ot({...oe,first:Y,skip:r}),{enabled:c!=="names"}),H=ie,le=_||A,Oe=_?15:Math.min(Math.max(L.length,1),Y),{data:ce,isError:De}=Pe(),Ge=r=>ce&&r.manaWei?Me(r.manaWei,ce):null,de=m.useRef(null);m.useEffect(()=>{_||A||!l||de.current===l||(de.current=l,J("Shop Searched",{query:l,result_count:H}))},[l,_,A,H]);const U=m.useRef("__init__");m.useEffect(()=>{if(_||A)return;const r=JSON.stringify({category:c,subCategory:h,rarities:a,min:T,max:M,sort:C,status:f,smart:v});if(U.current==="__init__"||U.current===r){U.current=r;return}U.current=r,J("Shop Applied Filter",{filters:{category:c,sub_category:h,rarities:a,min_price_credits:T??null,max_price_credits:M??null,status:f,smart:v,sort:C},result_count:H})},[c,h,a,T,M,C,f,v,_,A,H]);function pe(r){d(r),p(null)}function xe(r){u(S=>S.includes(r)?S.filter(N=>N!==r):[...S,r])}function qe(){d("wearable"),p(null),u([]),w(""),$(""),y("on_sale"),k(!1)}const P=[];(T!=null||M!=null)&&P.push({key:"price",label:s("filter.price"),onRemove:()=>{w(""),$("")}});for(const r of St)a.includes(r)&&P.push({key:`rarity-${r}`,label:nt(r),onRemove:()=>xe(r)});return v&&P.push({key:"smart",label:s("filter.smart"),onRemove:()=>k(!1)}),f!=="on_sale"&&P.push({key:"status",label:f==="all"?s("filter.statusAll"):s("filter.notForSale"),onRemove:()=>y("on_sale")}),e.jsxs(at,{"data-testid":"browse",children:[c!=="names"&&e.jsxs(e.Fragment,{children:[E?e.jsx(lt,{onClick:()=>g(!1),"aria-hidden":!0}):null,e.jsxs(ct,{"data-open":E||void 0,"data-testid":"browse-sidebar",children:[e.jsxs(dt,{children:[e.jsx(pt,{children:s("assets.filters")}),e.jsx(xt,{onClick:()=>g(!1),"aria-label":s("assets.closeFilters"),children:"✕"})]}),e.jsx(ht,{children:e.jsx(ft,{category:c,subCategory:h,onCategory:pe,onSub:p,priceMin:b,priceMax:j,onPriceMin:w,onPriceMax:$,rarities:a,onToggleRarity:xe,status:f,onStatus:y,smart:v,onSmart:k})}),e.jsx(mt,{children:e.jsx(ut,{type:"button",onClick:()=>g(!1),children:s("assets.showItems")})})]})]}),e.jsx(gt,{children:c==="names"?e.jsx(ds,{onBack:()=>pe("wearable")}):e.jsxs(e.Fragment,{children:[e.jsx(Et,{sort:C,onSort:z,total:ie,loading:_||A,query:l,onOpenFilters:()=>g(!0),chips:P,onClearChips:qe}),De&&I&&L.some(r=>r.source==="legacy")?e.jsx(bt,{"data-variant":"warn",children:s("assets.marketUnavailable")}):null,re?e.jsx(zt,{message:s("assets.loadError"),testId:"browse-error"}):null,!le&&L.length===0&&!re?e.jsxs(yt,{"data-testid":"browse-empty",children:[e.jsx(wt,{src:ps,alt:""}),e.jsxs(jt,{children:[e.jsx(vt,{children:s("assets.empty.title")}),e.jsx($t,{children:x?e.jsxs(e.Fragment,{children:[s("assets.empty.searchBefore"),e.jsx("b",{children:x}),s("assets.empty.searchAfter")]}):s("assets.empty.filters")})]}),e.jsx(Ct,{children:e.jsx(kt,{type:"button",onClick:()=>i("/overview"),children:s("assets.empty.cta")})})]}):e.jsxs(e.Fragment,{children:[e.jsx(Gt,{"data-testid":"grid",children:le?e.jsx(fe,{count:Oe}):e.jsxs(e.Fragment,{children:[L.map(r=>{if(!I)return e.jsx(O,{item:r,mode:"view"},D(r));const S=r;if(S.source!=="legacy")return e.jsx(O,{item:r},D(r));const N=Ge(S);return N==null?e.jsx(O,{item:r,mode:"view"},D(r)):e.jsx(O,{item:{...S,priceCredits:N}},D(r))}),ae?e.jsx(fe,{count:6}):null]})}),e.jsx(Tt,{hasNextPage:He,isFetching:ae,onLoadMore:()=>void Ue()})]})]})})]})}export{Ps as Assets};
|
|
787
|
+
`,as="https://docs.decentraland.org/creator/worlds/about/",ls="https://governance.decentraland.org";function cs(o){const i=typeof window<"u"?window.location.hostname:"";return`${i.endsWith("decentraland.org")?"https://decentraland.org":i.endsWith("decentraland.today")?"https://decentraland.today":"https://decentraland.zone"}/marketplace/names/browse?search=${encodeURIComponent(o)}`}function ds({onBack:o}){Ne({title:s("seo.names.title"),description:s("seo.names.description")});const{session:i,signIn:l}=Ie(),{data:x}=Pe(),c=x?Me(F,x):null,[d,h]=m.useState(""),[p,a]=m.useState("idle"),[u,b]=m.useState(!1),w=m.useRef(null),[j,$]=m.useState(void 0);m.useLayoutEffect(()=>{w.current&&$(w.current.offsetWidth)},[d]),m.useEffect(()=>{if(!ue(d).ok){a(d.length===0?"idle":"invalid");return}a("checking");const z=new AbortController,E=setTimeout(()=>{(async()=>{try{const g=await Kt(d,{signal:z.signal});a(g)}catch(g){if((g==null?void 0:g.name)==="AbortError")return;a("error")}})()},400);return()=>{clearTimeout(E),z.abort()}},[d]);const f=ue(d),y=f.ok&&(p==="available"||p==="error");function v(){if(y){if(!i){l();return}b(!0)}}const k=e.jsxs(e.Fragment,{children:[s("names.claim"),c!=null?e.jsxs(Yn,{children:[e.jsx(W,{}),Ae(c)]}):null]});return e.jsxs(In,{"data-testid":"names-page",children:[e.jsxs(An,{"aria-label":s("names.breadcrumbAria"),children:[e.jsx(Nn,{onClick:o,children:s("names.breadcrumbCollectibles")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(Mn,{children:s("names.breadcrumbCurrent")})]}),e.jsxs(Pn,{children:[e.jsxs(Wn,{children:[e.jsxs(Bn,{children:[e.jsx(Fn,{children:s("names.heroTitle")}),e.jsx(Ln,{children:s("names.heroSubtitle")})]}),e.jsxs(Hn,{children:[e.jsxs(Un,{children:[e.jsxs(On,{invalid:p==="taken",children:[e.jsxs(Vn,{children:[e.jsx(Zn,{"aria-hidden":!0,children:"@"}),e.jsx(Jn,{value:d,onChange:C=>h(Vt(C.target.value)),placeholder:s("names.inputPlaceholder"),"aria-label":s("names.inputAria"),autoComplete:"off",spellCheck:!1,maxLength:Q,style:{width:j!=null?`${j}px`:void 0}}),e.jsx(Gn,{ref:w,"aria-hidden":!0,children:d||s("names.inputPlaceholder")}),e.jsx(Kn,{children:s("names.suffix")})]}),d.length>0?e.jsxs(Qn,{"aria-hidden":!0,children:[d.length,"/",Q]}):null,e.jsx(Fe,{onClick:v,disabled:!y,"data-testid":"names-claim",children:k})]}),p==="taken"?e.jsxs(Dn,{role:"status","data-testid":"names-taken",children:[e.jsx(R,{name:"info",size:16,"aria-hidden":!0}),e.jsx("span",{children:s("names.taken")}),e.jsxs(qn,{href:cs(d),target:"_blank",rel:"noopener noreferrer",children:[s("names.takenMakeOffer"),e.jsx(R,{name:"external-link",size:13,"aria-hidden":!0})]})]}):null]}),e.jsx(Xn,{onClick:v,disabled:!y,children:k}),p==="checking"?e.jsx(X,{tone:"muted",role:"status","data-testid":"names-checking",children:s("names.checking")}):p==="error"?e.jsx(X,{tone:"muted",role:"status",children:s("names.checkError")}):p==="invalid"&&!f.ok&&f.reason==="too-short"?e.jsx(X,{tone:"muted",role:"status",children:s("names.tooShort",{min:We})}):null,e.jsx(rs,{role:"status","aria-live":"polite",children:p==="available"?s("names.available",{name:d}):""})]})]}),e.jsxs(es,{children:[e.jsxs(ts,{children:[e.jsx(ns,{children:s("names.whyTitle")}),e.jsx(ss,{children:s("names.whyIntro")})]}),e.jsxs(os,{children:[e.jsxs(D,{children:[e.jsx(q,{src:Rn,alt:""}),e.jsxs(V,{children:[e.jsx(Z,{children:s("names.why1Title")}),e.jsx(J,{children:s("names.why1")})]})]}),e.jsxs(D,{children:[e.jsx(q,{src:Tn,alt:""}),e.jsxs(V,{children:[e.jsx(Z,{children:s("names.why2Title")}),e.jsxs(J,{children:[s("names.why2")," ",e.jsx(is,{children:s("names.why2Address")})]}),e.jsxs(_e,{href:as,target:"_blank",rel:"noopener noreferrer",children:[s("names.learnMore"),e.jsx(R,{name:"external-link","aria-hidden":!0})]})]})]}),e.jsxs(D,{children:[e.jsx(q,{src:_n,alt:""}),e.jsxs(V,{children:[e.jsx(Z,{children:s("names.why3Title")}),e.jsx(J,{children:s("names.why3")})]})]}),e.jsxs(D,{children:[e.jsx(q,{src:zn,alt:""}),e.jsxs(V,{children:[e.jsx(Z,{children:s("names.why4Title")}),e.jsx(J,{children:s("names.why4")}),e.jsxs(_e,{href:ls,target:"_blank",rel:"noopener noreferrer",children:[s("names.learnMore"),e.jsx(R,{name:"external-link","aria-hidden":!0})]})]})]})]})]})]}),u?e.jsx(Sn,{name:d,priceCredits:c,onClose:()=>b(!1)}):null]})}const ps="data:image/svg+xml,%3csvg%20width='101'%20height='101'%20viewBox='0%200%20101%20101'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M42.4493%2040.9855L30.7394%2052.6954'%20stroke='%23FF5A57'%20stroke-width='3.15625'%20stroke-linecap='round'/%3e%3cpath%20d='M30.7391%2040.9855L42.449%2052.6954'%20stroke='%23FF5A57'%20stroke-width='3.15625'%20stroke-linecap='round'/%3e%3cpath%20d='M36.2621%2071.0604C29.6047%2071.0604%2023.9709%2068.7542%2019.3608%2064.1416C14.7507%2059.5291%2012.4445%2053.8953%2012.442%2047.2404C12.4396%2040.5854%2014.7459%2034.9516%2019.3608%2030.3391C23.9758%2025.7266%2029.6096%2023.4203%2036.2621%2023.4203C42.9146%2023.4203%2048.5496%2025.7266%2053.167%2030.3391C57.7844%2034.9516%2060.0895%2040.5854%2060.0822%2047.2404C60.0822%2049.9277%2059.6546%2052.4624%2058.7995%2054.8445C57.9445%2057.2265%2056.784%2059.3336%2055.3181%2061.1659L75.84%2081.6878C76.5119%2082.3597%2076.8478%2083.2148%2076.8478%2084.2531C76.8478%2085.2914%2076.5119%2086.1465%2075.84%2086.8183C75.1682%2087.4902%2074.3131%2087.8261%2073.2748%2087.8261C72.2365%2087.8261%2071.3814%2087.4902%2070.7096%2086.8183L50.1877%2066.2964C48.3554%2067.7623%2046.2482%2068.9227%2043.8662%2069.7778C41.4842%2070.6329%2038.9495%2071.0604%2036.2621%2071.0604ZM36.2621%2063.7312C40.8429%2063.7312%2044.7372%2062.1285%2047.9449%2058.9232C51.1527%2055.7179%2052.7554%2051.8236%2052.7529%2047.2404C52.7505%2042.6571%2051.1478%2038.7641%2047.9449%2035.5612C44.742%2032.3583%2040.8478%2030.7544%2036.2621%2030.7495C31.6764%2030.7447%2027.7834%2032.3485%2024.5829%2035.5612C21.3825%2038.7739%2019.7786%2042.6669%2019.7713%2047.2404C19.764%2051.8138%2021.3678%2055.7081%2024.5829%2058.9232C27.798%2062.1383%2031.6911%2063.7409%2036.2621%2063.7312Z'%20fill='url(%23paint0_linear_search_empty)'/%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_search_empty'%20x1='10.4127'%20y1='55.6273'%20x2='124.009'%20y2='44.925'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%23FF2D55'/%3e%3cstop%20offset='1'%20stop-color='%23FFBC5B'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",Y=48;function Ms(){const[o]=Ve(),i=ze(),l=(o.get("q")??"").trim().toLowerCase(),x=(o.get("q")??"").trim();Ne({title:x?s("seo.collectibles.searchTitle",{query:x}):s("seo.collectibles.title"),description:s("seo.collectibles.description")});const[c,d]=m.useState("wearable"),[h,p]=m.useState(null),[a,u]=m.useState([]),[b,w]=m.useState(""),[j,$]=m.useState(""),[f,y]=m.useState("on_sale"),[v,k]=m.useState(!1),[C,z]=m.useState("newest"),[E,g]=m.useState(!1);m.useEffect(()=>{if(!E)return;const r=N=>{N.key==="Escape"&&g(!1)};document.addEventListener("keydown",r);const S=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",r),document.body.style.overflow=S}},[E]);const I=f==="on_sale",T=b&&!Number.isNaN(Number(b))?Number(b):void 0,M=j&&!Number.isNaN(Number(j))?Number(j):void 0,Le=rt(),te=h?Tt[h]:void 0,ne=(me.find(r=>r.key===C)??me[0]).server,se={category:c,rarities:a.length?a:void 0,wearableCategories:te,minPriceCredits:T,maxPriceCredits:M,search:l||void 0,sortBy:ne,isSmart:v||void 0,onSale:!0,listingType:Le?void 0:"primary"},oe={category:c,rarities:a.length?a:void 0,wearableCategories:te,search:l||void 0,sortBy:ne,isWearableSmart:v||void 0,isOnSale:f==="not_for_sale"?!1:void 0},{items:L,total:ie,isLoading:_,isPlaceholderData:A,error:re,hasNextPage:He,isFetchingNextPage:ae,fetchNextPage:Ue}=zt(I?["shop-items",se]:["catalog-items",oe],r=>I?ot({...se,first:Y,skip:r}):it({...oe,first:Y,skip:r}),{enabled:c!=="names"}),H=ie,le=_||A,Oe=_?15:Math.min(Math.max(L.length,1),Y),{data:ce,isError:Ge}=Pe(),De=r=>ce&&r.manaWei?Me(r.manaWei,ce):null,de=m.useRef(null);m.useEffect(()=>{_||A||!l||de.current===l||(de.current=l,K("Shop Searched",{query:l,result_count:H}))},[l,_,A,H]);const U=m.useRef("__init__");m.useEffect(()=>{if(_||A)return;const r=JSON.stringify({category:c,subCategory:h,rarities:a,min:T,max:M,sort:C,status:f,smart:v});if(U.current==="__init__"||U.current===r){U.current=r;return}U.current=r,K("Shop Applied Filter",{filters:{category:c,sub_category:h,rarities:a,min_price_credits:T??null,max_price_credits:M??null,status:f,smart:v,sort:C},result_count:H})},[c,h,a,T,M,C,f,v,_,A,H]);function pe(r){d(r),p(null)}function xe(r){u(S=>S.includes(r)?S.filter(N=>N!==r):[...S,r])}function qe(){d("wearable"),p(null),u([]),w(""),$(""),y("on_sale"),k(!1)}const P=[];(T!=null||M!=null)&&P.push({key:"price",label:s("filter.price"),onRemove:()=>{w(""),$("")}});for(const r of Et)a.includes(r)&&P.push({key:`rarity-${r}`,label:st(r),onRemove:()=>xe(r)});return v&&P.push({key:"smart",label:s("filter.smart"),onRemove:()=>k(!1)}),f!=="on_sale"&&P.push({key:"status",label:f==="all"?s("filter.statusAll"):s("filter.notForSale"),onRemove:()=>y("on_sale")}),e.jsxs(lt,{"data-testid":"browse",children:[c!=="names"&&e.jsxs(e.Fragment,{children:[E?e.jsx(ct,{onClick:()=>g(!1),"aria-hidden":!0}):null,e.jsxs(dt,{"data-open":E||void 0,"data-testid":"browse-sidebar",children:[e.jsxs(pt,{children:[e.jsx(xt,{children:s("assets.filters")}),e.jsx(ht,{onClick:()=>g(!1),"aria-label":s("assets.closeFilters"),children:"✕"})]}),e.jsx(ft,{children:e.jsx(mt,{category:c,subCategory:h,onCategory:pe,onSub:p,priceMin:b,priceMax:j,onPriceMin:w,onPriceMax:$,rarities:a,onToggleRarity:xe,status:f,onStatus:y,smart:v,onSmart:k})}),e.jsx(ut,{children:e.jsx(gt,{type:"button",onClick:()=>g(!1),children:s("assets.showItems")})})]})]}),e.jsx(bt,{children:c==="names"?e.jsx(ds,{onBack:()=>pe("wearable")}):e.jsxs(e.Fragment,{children:[e.jsx(Rt,{sort:C,onSort:z,total:ie,loading:_||A,query:l,onOpenFilters:()=>g(!0),chips:P,onClearChips:qe}),Ge&&I&&L.some(r=>r.source==="legacy")?e.jsx(yt,{"data-variant":"warn",children:s("assets.marketUnavailable")}):null,re?e.jsx(It,{message:s("assets.loadError"),testId:"browse-error"}):null,!le&&L.length===0&&!re?e.jsxs(wt,{"data-testid":"browse-empty",children:[e.jsx(jt,{src:ps,alt:""}),e.jsxs(vt,{children:[e.jsx($t,{children:s("assets.empty.title")}),e.jsx(Ct,{children:x?e.jsxs(e.Fragment,{children:[s("assets.empty.searchBefore"),e.jsx("b",{children:x}),s("assets.empty.searchAfter")]}):s("assets.empty.filters")})]}),e.jsx(kt,{children:e.jsx(St,{type:"button",onClick:()=>i("/overview"),children:s("assets.empty.cta")})})]}):e.jsxs(e.Fragment,{children:[e.jsx(Dt,{"data-testid":"grid",children:le?e.jsx(fe,{count:Oe}):e.jsxs(e.Fragment,{children:[L.map(r=>{if(!I)return e.jsx(O,{item:r,mode:"view"},G(r));const S=r;if(S.source!=="legacy")return e.jsx(O,{item:r},G(r));const N=De(S);return N==null?e.jsx(O,{item:r,mode:"view"},G(r)):e.jsx(O,{item:{...S,priceCredits:N}},G(r))}),ae?e.jsx(fe,{count:6}):null]})}),e.jsx(_t,{hasNextPage:He,isFetching:ae,onLoadMore:()=>void Ue()})]})]})})]})}export{Ms as Assets};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as $,j as t}from"./react-vyZjIDcS.js";import{R as C,a as oe,C as ie,b as ne}from"./categories-
|
|
1
|
+
import{r as $,j as t}from"./react-vyZjIDcS.js";import{R as C,a as oe,C as ie,b as ne}from"./categories-DpOXLpA1.js";import{n as c,T as se}from"./Tooltip-ByBgftfn.js";import{t as e,s as o,I as g,e as s,o as ae,h as v}from"./index-D5DVXUwH.js";const re=o.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 12px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t,L as
|
|
1
|
+
import{j as t,L as R,r as M}from"./react-vyZjIDcS.js";import{s as a,B as N,t as o,x as I,m as F,e,n as B,y as W,I as f,z as G,D as K,u as w,E as P,c as Q,F as k,l as H,q as $}from"./index-D5DVXUwH.js";import{a as O,b as _,c as X,d as J,s as U,f as V}from"./authorizations-DFNq9Tgp.js";import{a as Y}from"./builder-DCiuBzde.js";import{f as Z}from"./errors-ChVGWplO.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./sendMetaTransaction-BKizuZFV.js";const tt=I`
|
|
2
2
|
to { transform: rotate(360deg); }
|
|
3
3
|
`,it=I`
|
|
4
4
|
to { background-position: -200% 0; }
|
|
@@ -179,4 +179,4 @@ import{j as t,L as q,r as M}from"./react-vyZjIDcS.js";import{s as a,B as N,t as
|
|
|
179
179
|
margin: 6px 0 0;
|
|
180
180
|
`,S=a(N)`
|
|
181
181
|
margin-top: 12px;
|
|
182
|
-
`;function y({descriptor:i,owner:c,signer:l,name:n,description:r,image:d,icon:h}){const b=P(),[m,x]=M.useState(!1),{data:s,isLoading:u,refetch:
|
|
182
|
+
`;function y({descriptor:i,owner:c,signer:l,name:n,description:r,image:d,icon:h}){const b=P(),[m,x]=M.useState(!1),{data:s,isLoading:u,refetch:q}=w({queryKey:["authorization",i.id,c],queryFn:()=>V(i,c),staleTime:3e4});async function D(){if(m||u)return;const g=!s;x(!0);try{await U({auth:i,signer:l,active:g}),await q(),b.setQueryData(["authorization",i.id,c],g),k.success(g?e("authorizations.toastActivated",{name:n}):e("authorizations.toastDeactivated",{name:n}))}catch(v){H(v,{flow:"authorizations",step:g?"grant":"revoke"}),k.error(Z(v,e("authorizations.errorGeneric")))}finally{x(!1)}}const L=u?e("authorizations.checking"):s?e("authorizations.active"):e("authorizations.inactive");return t.jsxs(st,{"data-testid":`authorization-${i.id}`,"data-active":!!s,children:[t.jsx(ct,{children:d?t.jsx("img",{src:d,alt:""}):h}),t.jsxs(lt,{children:[t.jsx(dt,{title:n,children:n}),t.jsx(ut,{children:r})]}),t.jsxs(pt,{children:[t.jsx(ht,{"data-active":!!s,children:L}),m?t.jsx(xt,{"aria-label":e("authorizations.working")}):t.jsx(mt,{type:"button","data-testid":`authorization-toggle-${i.id}`,"data-active":!!s,role:"switch","aria-checked":!!s,"aria-label":s?e("authorizations.deactivateAria",{name:n}):e("authorizations.activateAria",{name:n}),disabled:u,onClick:()=>void D()})]})]})}function gt(i){return w({queryKey:["owned-collections",i],enabled:!!i,staleTime:6e4,queryFn:async()=>{const[c,l]=await Promise.all([$(i,{category:"wearable",first:96}),$(i,{category:"emote",first:96})]),n=new Map;for(const r of[...c.assets,...l.assets]){const d=r.contractAddress.toLowerCase();n.has(d)||n.set(d,r)}return[...n.values()]}})}function ft(i,c){return w({queryKey:["creator-collections",i],enabled:!!i&&!!c,staleTime:6e4,queryFn:async()=>{const l=await Y(i,c),n=new Map;for(const r of l){const d=r.contractAddress.toLowerCase();n.has(d)||n.set(d,r)}return[...n.values()]}})}function Tt(){F({title:e("authorizations.title"),noindex:!0});const{session:i,signIn:c}=B(),l=Q.chainId,n=W(i==null?void 0:i.providerType),{data:r,isLoading:d}=gt(n?i==null?void 0:i.address:void 0),{data:h,isLoading:b}=ft(n?i==null?void 0:i.address:void 0,n?i==null?void 0:i.identity:void 0);if(!i)return t.jsxs(T,{children:[t.jsx(f,{name:"info",size:40,color:o.colors.muted2}),t.jsx(E,{children:e("authorizations.signInTitle")}),t.jsx("p",{className:"muted",children:e("authorizations.signInBody")}),t.jsx(S,{variant:"purple",onClick:()=>c(),children:e("storeSettings.signIn")})]});if(!n)return t.jsxs(T,{children:[t.jsx(f,{name:"check",size:40,color:o.colors.ok}),t.jsx(E,{children:e("authorizations.managedTitle")}),t.jsx("p",{className:"muted",children:e("authorizations.managedBody")}),t.jsx(S,{as:R,to:"/assets",variant:"purple",children:e("authorizations.managedCta")})]});const m=O(l),x=_(l);return t.jsxs(et,{children:[t.jsxs(ot,{children:[t.jsx(at,{children:e("authorizations.title")}),t.jsx(nt,{children:e("authorizations.intro")})]}),t.jsxs(z,{children:[t.jsx(j,{children:e("authorizations.buyingTitle")}),t.jsxs(p,{children:[t.jsx(y,{descriptor:m,owner:i.address,signer:i.signer,name:e("authorizations.creditsName"),description:e("authorizations.creditsDesc"),icon:t.jsx(G,{className:"ccy-mark"})}),t.jsx(y,{descriptor:x,owner:i.address,signer:i.signer,name:e("authorizations.manaName"),description:e("authorizations.manaDesc"),icon:t.jsx(rt,{src:K,alt:"","aria-hidden":!0})})]})]}),t.jsxs(z,{children:[t.jsx(j,{children:e("authorizations.sellingTitle")}),d?t.jsx(p,{"aria-busy":"true","aria-label":e("authorizations.checking"),children:Array.from({length:3}).map((s,u)=>t.jsx(C,{"aria-hidden":!0},u))}):r&&r.length>0?t.jsx(p,{children:r.map(s=>t.jsx(y,{descriptor:X(s.contractAddress,l),owner:i.address,signer:i.signer,name:s.name||e("authorizations.collectionFallback"),description:e("authorizations.sellingDesc"),image:s.image,icon:t.jsx(f,{name:"pen",size:18})},s.contractAddress))}):t.jsx(A,{children:e("authorizations.sellingEmpty")})]}),t.jsxs(z,{children:[t.jsx(j,{children:e("authorizations.mintingTitle")}),b?t.jsx(p,{"aria-busy":"true","aria-label":e("authorizations.checking"),children:Array.from({length:3}).map((s,u)=>t.jsx(C,{"aria-hidden":!0},u))}):h&&h.length>0?t.jsx(p,{children:h.map(s=>t.jsx(y,{descriptor:J(s.contractAddress,l),owner:i.address,signer:i.signer,name:s.name||e("authorizations.collectionFallback"),description:e("authorizations.mintingDesc"),icon:t.jsx(f,{name:"pen",size:18})},s.contractAddress))}):t.jsx(A,{children:e("authorizations.mintingEmpty")})]})]})}export{Tt as Authorizations};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,L as ge,r as $,b as Lt,a as Nt}from"./react-vyZjIDcS.js";import{t as ee,s as i,
|
|
1
|
+
import{j as e,L as ge,r as $,b as Lt,a as Nt}from"./react-vyZjIDcS.js";import{t as ee,s as i,e as a,J as Z,aj as Qt,G as Kt,I as R,z as xt,H as ze,m as Ut,ak as q,Q as Ze,n as Ht,u as Ot,al as Vt,E as Dt,am as Gt,an as Jt,ao as Yt,y as Xt,ap as et,aq as Q,ar as tt,as as Zt,l as V,c as at,h as ea,at as st,au as je,av as ke,aw as ce,ax as nt,a as le,b as ta,C as $e,ay as aa}from"./index-D5DVXUwH.js";import{M as sa,S as na,C as ia,H as ra,a as oa,T as ca,X as la,b as da,B as ua,c as ha,d as it,e as pa,f as pe,P as gt,m as mt,g as xa,h as ga,i as ma,j as ft,k as xe,L as fa,l as ya,n as rt,o as ot,W as ba,p as va,q as Ca,A as wa,r as ja,s as ka,t as $a,u as Sa,v as Ma,w as Ta,x as Pa,y as za,z as Aa,D as Ia,E as qa,F as Ra,G as _a,I as Ba,J as Ea,K as Se,N as Wa,O as Fa,Q as La,R as Na,U as ct,V as Qa,Y as Ka,Z as Ua,_ as Ha}from"./CollectionCarousel-GA0qG2qL.js";import{u as Oa}from"./useManaRate-D_UeFv99.js";import{r as Va}from"./mana-rate-BfcKcY1g.js";import{i as Da,j as Ga,f as Ja,n as Ya,h as Xa,A as Za}from"./authorizations-DFNq9Tgp.js";import{b as Me}from"./buy-DM-cSEnp.js";import{b as es,w as ts,S as as,G as ss}from"./buy-gasless-4_XeVMNy.js";import{u as ns,M as is,R as de,r as rs,c as os}from"./useCreditPacks-Cpp2jALc.js";import{i as cs,a as ls}from"./errors-ChVGWplO.js";import{E as ds}from"./ErrorNotice-CK4lBVOL.js";import{u as lt}from"./mana-convert-DlwVmR8Z.js";import"./sentry-B35L1FdR.js";import"./dcl-schemas-BICTSpB5.js";import"./ethers-CXBJm_wN.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-B0FxJexO.js";import"./sendMetaTransaction-BKizuZFV.js";const{colors:D,radius:us}=ee,hs=i.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
@@ -58,7 +58,7 @@ import{j as e,L as ge,r as $,b as Lt,a as Nt}from"./react-vyZjIDcS.js";import{t
|
|
|
58
58
|
font-weight: 700;
|
|
59
59
|
color: ${D.text};
|
|
60
60
|
}
|
|
61
|
-
`,fs="https://cdn.decentraland.org/@dcl/shop/0.1.0-
|
|
61
|
+
`,fs="https://cdn.decentraland.org/@dcl/shop/0.1.0-30533220789.commit-7bdc9fc/assets/buy-error-22UunaPC.png";function ys(c){const{phase:d,balanceCredits:k,onClose:T}=c,_=d==="processing",W=d==="error"?a("cartCheckout.errorTitle"):d==="nofunds"?a("cartCheckout.titleNoFunds"):d==="choose"?a("buyModal.choosePayment"):a("cartCheckout.titleBuy"),F=d==="processing";return e.jsxs(sa,{role:"dialog","aria-modal":"true","aria-label":a("cartCheckout.dialogAria"),children:[e.jsx(na,{onClick:_?void 0:T,"aria-hidden":!0}),e.jsxs(ia,{"data-tall":F||void 0,children:[e.jsxs(ra,{children:[e.jsxs(oa,{children:[e.jsx(ca,{children:W}),!_&&e.jsx(la,{onClick:T,"aria-label":a("buyModal.close"),children:e.jsx(da,{})})]}),e.jsxs(ua,{children:[e.jsx(ha,{children:d==="nofunds"?a("buyModal.dclBalance"):a("buyModal.myCreditsBalance")}),e.jsx(it,{}),e.jsx(pa,{children:Z(k)})]})]}),d==="choose"&&e.jsxs(pe,{children:[e.jsxs(ms,{children:[e.jsx("span",{children:a("cart.purchaseSummary")}),e.jsxs("strong",{children:[e.jsx(it,{}),Z(c.totalCredits??0)]})]}),e.jsx(gt,{options:c.options??[],totalCents:c.totalCents??0,onPay:c.onPay??(()=>{}),rateNote:(()=>{const z=mt(c.totalCents??0,c.totalManaWei??0n);return z!=null?a("buyModal.manaRate",{mana:z.toLocaleString("en",{maximumFractionDigits:2})}):null})()})]}),d==="processing"&&e.jsx(bs,{stage:c.stage??"reserving",step:c.step??1,total:c.total??1,isSelfCustody:!!c.isSelfCustody}),d==="nofunds"&&e.jsx(vs,{lines:c.lines??[],shortfallCredits:c.shortfallCredits??0,packs:c.packs??[],selectedPack:c.selectedPack??"",onSelectPack:c.onSelectPack??(()=>{}),onBuyPacks:c.onBuyPacks??(()=>{}),onCancel:T}),d==="error"&&e.jsxs(pe,{children:[e.jsxs(xa,{"data-testid":"buy-error",children:[e.jsx(ga,{src:fs,alt:"",width:64,height:80}),e.jsxs(ma,{children:[e.jsx("b",{children:a("cartCheckout.errorHeadline")})," ",a("cartCheckout.errorBody")]})]}),e.jsxs(ft,{children:[e.jsx(xe,{"data-variant":"outline",onClick:T,children:a("buyModal.cancel")}),e.jsx(xe,{"data-variant":"purple",onClick:c.onRetry??T,children:a("cartCheckout.tryAgain")})]})]})]})]})}function bs({stage:c,step:d,total:k,isSelfCustody:T}){const _=c==="reserving",W=k>0?Math.min(100,Math.round(d/k*100)):0,F=c==="awaiting-signature"?T?a("buyModal.confirmToContinue"):a("buyModal.completingTransaction"):c==="settling"?a("buyModal.completingTransaction"):a("cartCheckout.preparing");return e.jsxs(pe,{"data-processing":!0,children:[e.jsx(fa,{src:Qt,alt:"",width:61,height:61}),e.jsx(ya,{children:F}),_?e.jsxs(hs,{children:[e.jsx(rt,{"aria-hidden":!0,children:e.jsx(ot,{"data-step":!0,style:{width:`${W}%`}})}),k>1?e.jsxs(ps,{children:[d,"/",k]}):null]}):e.jsx(rt,{"aria-hidden":!0,children:e.jsx(ot,{})})]})}function vs({lines:c,shortfallCredits:d,packs:k,selectedPack:T,onSelectPack:_,onBuyPacks:W,onCancel:F}){const z=k.find(n=>n.id===T),me=c.reduce((n,I)=>n+(I.quantity??1),0);return e.jsxs(pe,{children:[e.jsxs(ba,{"data-testid":"nofunds-warning",children:[e.jsx(va,{}),e.jsxs(Ca,{children:[e.jsx("b",{children:a("buyModal.insufficientFunds")})," ",a("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:a("buyModal.warningCreditsAmount",{count:Math.max(0,d)})})," ",a("buyModal.warningToPurchase",{count:me})]})]}),e.jsx(xs,{children:c.map(n=>{const I=n.quantity??1;return e.jsxs(wa,{children:[e.jsx(ja,{children:n.item.thumbnail?e.jsx("img",{src:n.item.thumbnail,alt:""}):null}),e.jsxs(ka,{children:[e.jsxs("div",{children:[e.jsxs($a,{title:n.item.name,children:[n.item.name||a("buyModal.itemFallback"),I>1?e.jsx(gs,{children:a("cartCheckout.qty",{count:I})}):null]}),n.item.creator?e.jsx(Sa,{address:n.item.creator}):null]}),e.jsxs(Ma,{children:[e.jsx(Ta,{}),e.jsx("span",{children:Z(n.priceCredits*I)})]})]})]},n.item.id)})}),e.jsx(Pa,{children:k.map(n=>{const I=n.id===T;return e.jsxs(za,{"data-testid":"credit-pack","data-on":I||void 0,onClick:()=>_(n.id),children:[e.jsx(Aa,{}),e.jsx(Ia,{children:Z(n.credits)}),e.jsxs(qa,{children:["($",n.usd.toFixed(2),")"]})]},n.id)})}),e.jsxs(Ra,{children:[e.jsxs(_a,{children:[e.jsx(Ba,{}),e.jsx("span",{children:Z((z==null?void 0:z.credits)??0)})]}),e.jsxs(Ea,{children:["$",((z==null?void 0:z.usd)??0).toFixed(2)]})]}),e.jsxs(ft,{children:[e.jsx(xe,{"data-variant":"outline",onClick:F,children:a("buyModal.cancel")}),e.jsx(xe,{"data-variant":"gradient",onClick:W,children:a("buyModal.buy")})]})]})}const{colors:o,gradients:yt,radius:K}=ee,bt="@media (max-width: 1080px)",S="@media (max-width: 880px)",dt=i.div`
|
|
62
62
|
max-width: 1510px;
|
|
63
63
|
margin: 0 auto;
|
|
64
64
|
|
|
@@ -337,7 +337,7 @@ import{j as e,L as ge,r as $,b as Lt,a as Nt}from"./react-vyZjIDcS.js";import{t
|
|
|
337
337
|
${S} {
|
|
338
338
|
padding: 12px 4px 12px 0;
|
|
339
339
|
}
|
|
340
|
-
`,
|
|
340
|
+
`,Ws=i.div`
|
|
341
341
|
display: flex;
|
|
342
342
|
flex-direction: column;
|
|
343
343
|
gap: 4px;
|
|
@@ -365,11 +365,11 @@ import{j as e,L as ge,r as $,b as Lt,a as Nt}from"./react-vyZjIDcS.js";import{t
|
|
|
365
365
|
line-clamp: 2;
|
|
366
366
|
-webkit-box-orient: vertical;
|
|
367
367
|
}
|
|
368
|
-
`,
|
|
368
|
+
`,Fs=i.div`
|
|
369
369
|
${Ct};
|
|
370
370
|
`,Ls=i(ge)`
|
|
371
371
|
${Ct};
|
|
372
|
-
`,Ns=i(
|
|
372
|
+
`,Ns=i(Kt)`
|
|
373
373
|
font-size: 10px;
|
|
374
374
|
line-height: 1.43;
|
|
375
375
|
color: ${o.muted};
|
|
@@ -416,7 +416,7 @@ import{j as e,L as ge,r as $,b as Lt,a as Nt}from"./react-vyZjIDcS.js";import{t
|
|
|
416
416
|
line-height: 1.2;
|
|
417
417
|
color: ${o.text};
|
|
418
418
|
text-align: center;
|
|
419
|
-
`,
|
|
419
|
+
`,Hs=i.div`
|
|
420
420
|
display: inline-flex;
|
|
421
421
|
align-items: center;
|
|
422
422
|
gap: 4px;
|
|
@@ -430,7 +430,7 @@ import{j as e,L as ge,r as $,b as Lt,a as Nt}from"./react-vyZjIDcS.js";import{t
|
|
|
430
430
|
${S} {
|
|
431
431
|
font-size: 20px;
|
|
432
432
|
}
|
|
433
|
-
`,
|
|
433
|
+
`,Os=i(xt)`
|
|
434
434
|
width: 24px;
|
|
435
435
|
height: 24px;
|
|
436
436
|
background: ${o.text};
|
|
@@ -461,9 +461,9 @@ import{j as e,L as ge,r as $,b as Lt,a as Nt}from"./react-vyZjIDcS.js";import{t
|
|
|
461
461
|
line-height: 1;
|
|
462
462
|
text-transform: uppercase;
|
|
463
463
|
color: ${o.text2};
|
|
464
|
-
`,
|
|
464
|
+
`,Js=i(R)`
|
|
465
465
|
color: #f48221;
|
|
466
|
-
`,
|
|
466
|
+
`,Ys=i(ge)`
|
|
467
467
|
font-size: 12px;
|
|
468
468
|
font-weight: 600;
|
|
469
469
|
line-height: 24px;
|
|
@@ -673,4 +673,4 @@ import{j as e,L as ge,r as $,b as Lt,a as Nt}from"./react-vyZjIDcS.js";import{t
|
|
|
673
673
|
& section {
|
|
674
674
|
margin-top: 0;
|
|
675
675
|
}
|
|
676
|
-
`;function Te(c){if(cs(c))return a("errors.rejected");const d=(c.message??"").toLowerCase();return d.includes("insufficient")?a("cart.error.insufficient",{currency:Zt.name}):d.includes("no active listing")||d.includes("your own listing")?a("cart.error.listingChanged"):a("marketCheckout.error.generic")}const mn=12e4;function fn(c){const d=[];return c.unavailable.length&&d.push(a("cart.drop.unavailable",{count:c.unavailable.length})),c.own.length&&d.push(a("cart.drop.own",{count:c.own.length})),a("cart.drop.removed",{items:d.join(` ${a("cart.drop.and")} `)})}const Pe=c=>c.reduce((d,k)=>d+k.priceCredits*k.quantity,0),he=c=>c.flatMap(d=>Array.from({length:d.quantity},()=>({...d,quantity:1})));function En(){Kt({title:a("nav.cart"),noindex:!0});const c=q(t=>t.items),d=q(t=>t.remove),k=q(t=>t.increment),T=q(t=>t.decrement),_=q(t=>t.clear),F=q(t=>t.restore),W=q(t=>t.setFittingOpen),z=Ze(t=>t.items),me=Ze(t=>t.toggle),{session:n,signIn:I}=Ut(),te=ss().packs.slice(0,ns);$.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const kt=c.some(t=>t.category!=="emote"),{data:fe}=Ot({queryKey:["upsell-listings"],queryFn:()=>ta({first:40}),staleTime:6e4}),{data:C}=Ht(n),m=Vt(),U=Lt(),{state:L}=Nt(),[$t,G]=$.useState(null),[Ae,ae]=$.useState(null),[St,A]=$.useState(!1),[P,N]=$.useState(null),Ie=$.useRef(0),[p,b]=$.useState(null),{data:Y}=Dt(n),{data:J}=Oa(!0),[ye,qe]=$.useState(""),X=$.useRef(null),Re=Gt(c),_e=t=>et(Re[t.id]),be=c.filter(_e),ve=c.length>0&&be.length===0,Mt=be.reduce((t,s)=>t+s.priceCredits*s.quantity,0),Tt=c.reduce((t,s)=>t+s.quantity,0),Pt=be.reduce((t,s)=>t+s.quantity,0),Be=P?P.liveTotalCredits:Mt,zt=new Set(c.map(t=>t.id)),Ee=((fe==null?void 0:fe.items)??[]).filter(t=>!zt.has(t.id)).slice(0,12),At=new Map(P==null?void 0:P.buyable.map(t=>[t.item.id,t])),se=(C==null?void 0:C.credits)??0,ne=Be*10,Fe=J?lt(ne,J):0n,ie=Se({priceCents:ne,priceManaWei:Fe,balanceCents:(C==null?void 0:C.balanceCents)??0,manaBalanceWei:Y??0n}),We=mt(ne,Fe),Le=We!=null?a("buyModal.manaRate",{mana:We.toLocaleString("en",{maximumFractionDigits:2})}):null,It=Xt;function re(t){t(),N(null),ae(null),G(null)}function qt(){b(null),A(!1)}function Ne(t){const s=Pe(t),l=Math.max(0,s-se),r=te.find(u=>u.credits>=l)??te[te.length-1];qe(r.id),Q("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:s,credits_balance:se,shortfall:l}),b({phase:"nofunds",lines:t.map(u=>({item:u.item,priceCredits:u.priceCredits,quantity:u.quantity})),shortfall:l}),A(!1)}async function Ce(t){if(!n||t.length===0)return;const s=he(t),l=s.map(g=>({...g.item,priceCredits:g.priceCredits})),r=t.map(g=>({...g.item,priceCredits:g.priceCredits,quantity:g.quantity})),u=[];let h="authorize",f=!1;b({phase:"processing",stage:"reserving",step:1,total:s.length});try{const g=[];for(let j=0;j<s.length;j++){const v=s[j];b({phase:"processing",stage:"reserving",step:j+1,total:s.length});try{const{credit:w,maxCreditedValue:H}=await st(n.identity,v.usdCents,v.trade.id);u.push(w.id),g.push({trade:v.trade,credits:[w],maxCreditedValue:H})}catch(w){if(ls(w)){if(u.length){try{await je(n.identity,u)}catch(H){V(H,{flow:"cart_checkout",step:"release"})}m.invalidateQueries({queryKey:["usd-balance"]})}Ne(t);return}throw w}}h="submit";const M=()=>b({phase:"processing",stage:"settling",step:s.length,total:s.length});b({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});let y=[];if(Va())try{y=await Za({purchases:g,buyer:n.address,signer:n.signer,onSigned:M});const v=(await Promise.allSettled(y.map(w=>es(w)))).flatMap(w=>w.status==="rejected"?[w.reason]:[]);if(v.length&&!v.some(w=>w instanceof ts))throw v[0];f=!0}catch(j){if(!(j instanceof as))throw j;y=await Me({purchases:g,buyer:n.address,signer:n.signer,onSigned:M})}else y=await Me({purchases:g,buyer:n.address,signer:n.signer});t.forEach(j=>d(j.item.id)),N(null),Q("Shop Completed Purchase",{...ke(l),payment_type:"credits",no_crypto_step:f,transaction_hash:y[0]??null}),Na(m);const x=X.current;X.current=null,b(null),A(!1);const E={items:r,txHash:y[0]??void 0,settled:!0,...x?{creditsAdded:x}:{}};U("/success",{state:E,replace:!0})}catch(g){if(ce(g)||V(g,{flow:"cart_checkout",step:h,cart_size:t.length}),Q(ce(g)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:h,error_code:nt(g),value_usd:tt(l.reduce((M,y)=>M+y.priceCredits,0)),cart_size:s.length}),u.length){try{await je(n.identity,u)}catch(M){V(M,{flow:"cart_checkout",step:"release"})}m.invalidateQueries({queryKey:["usd-balance"]})}b({phase:"error",message:Te(g)})}}function Qe(t,s){m.invalidateQueries({queryKey:["usd-balance"]}),m.invalidateQueries({queryKey:["detail-trade"]}),m.invalidateQueries({queryKey:["shop-item"]}),m.invalidateQueries({queryKey:["owned-token"]}),m.invalidateQueries({queryKey:["public-token"]}),m.invalidateQueries({queryKey:["item-resales"]}),m.invalidateQueries({queryKey:["shop-items"]}),m.invalidateQueries({queryKey:["catalog-items"]}),m.invalidateQueries({queryKey:["my-assets"]}),m.invalidateQueries({queryKey:["purchases"]}),m.invalidateQueries({queryKey:["owned-item-count"]}),m.invalidateQueries({queryKey:["overview-listings"]}),m.invalidateQueries({queryKey:["upsell-listings"]});const l=X.current;X.current=null,b(null),A(!1);const r={items:t,txHash:s[0]??void 0,settled:!0,...l?{creditsAdded:l}:{}};U("/success",{state:r,replace:!0})}function Ke(t,s){ce(t)||V(t,{flow:s,step:"submit"}),Q(ce(t)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:nt(t)}),b({phase:"error",message:Te(t)}),A(!1)}async function Rt(t,s){const l=le($e.MANAToken,s),r=le($e.CreditsManager,s);await Ja({auth:{kind:Xa.Allowance,contractAddress:l.address,spenderAddress:r.address,chainId:s},signer:t})}async function Ue(){if(J)return J;try{return await m.fetchQuery({queryKey:["mana-rate",at.chainId],queryFn:()=>Ha(at.chainId),staleTime:6e4})}catch{return}}async function _t(t){const s=he(t).reduce((h,f)=>h+f.usdCents,0),r=(Y??0n)>0n?await Ue():J,u=r?lt(s,r):0n;return{totalCents:s,manaWei:u}}async function Oe(t,s){const l=Pe(t),{totalCents:r,manaWei:u}=await _t(t),h=Se({priceCents:r,priceManaWei:u,balanceCents:(C==null?void 0:C.balanceCents)??0,manaBalanceWei:Y??0n});if(s&&h.options.some(f=>f.method===s)){if(s==="credits"){Ce(t);return}const{spender:f,chainId:g}=He(s,t);await Ve(f,g,()=>s==="mana"?void De(t):void Ge(t,r,u));return}if(h.options.some(f=>f.method==="mana"||f.method==="combined")){b({phase:"choose",lines:t,totalCents:r,manaWei:u}),A(!1);return}if(C!=null&&C.credits<l){Ne(t);return}Ce(t)}function Bt(t){return Se({priceCents:t.totalCents,priceManaWei:t.manaWei,balanceCents:(C==null?void 0:C.balanceCents)??0,manaBalanceWei:Y??0n})}const[we,oe]=$.useState(null);function He(t,s){const l=s[0].trade;return{spender:t==="mana"?le(ea(l.contract),l.chainId).address:le($e.CreditsManager,l.chainId).address,chainId:l.chainId}}async function Ve(t,s,l){const r=Da(s,t),u=n?await Ga(r,n.address).catch(()=>!0):!0;if(Ya(n==null?void 0:n.providerType,u)){A(!1),oe({auth:r,run:l});return}l()}function Et(t){if((p==null?void 0:p.phase)!=="choose")return;const{lines:s,totalCents:l,manaWei:r}=p;if(t==="credits"){Ce(s);return}const{spender:u,chainId:h}=He(t,s);Ve(u,h,()=>t==="mana"?void De(s):void Ge(s,l,r))}async function De(t){if(!n||t.length===0)return;const s=he(t),l=s.map(h=>({...h.item,priceCredits:h.priceCredits})),r=t.map(h=>({...h.item,priceCredits:h.priceCredits,quantity:h.quantity})),u=()=>b({phase:"processing",stage:"settling",step:s.length,total:s.length});b({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});try{const h=await Qa({trades:s.map(f=>f.trade),buyer:n.address,signer:n.signer,onSigned:u});t.forEach(f=>d(f.item.id)),N(null),Q("Shop Completed Purchase",{...ke(l),payment_type:"mana",transaction_hash:h[0]??null}),m.invalidateQueries({queryKey:["mana-balance"]}),Qe(r,h)}catch(h){Ke(h,"buy_cart_mana")}}async function Ge(t,s,l){if(!n||t.length===0)return;const r=he(t),u=r.map(x=>({...x.item,priceCredits:x.priceCredits})),h=t.map(x=>({...x.item,priceCredits:x.priceCredits,quantity:x.quantity})),f=Ka(r.map(x=>x.usdCents),(C==null?void 0:C.balanceCents)??0),g=f.reduce((x,E)=>x+E,0),M=Ua(Math.max(0,s-g),s,l),y=[];b({phase:"processing",stage:"reserving",step:1,total:r.length});try{const x=[];for(let v=0;v<r.length;v++){const w=f[v];if(w<=0)continue;b({phase:"processing",stage:"reserving",step:v+1,total:r.length});const{credit:H,maxCreditedValue:Wt}=await st(n.identity,w,r[v].trade.id);y.push(H.id),x.push({trade:r[v].trade,credits:[H],maxCreditedValue:Wt})}r.forEach((v,w)=>{f[w]<=0&&x.push({trade:v.trade,credits:[],maxCreditedValue:"0"})}),x[0]={...x[0],maxCreditedValue:(BigInt(x[0].maxCreditedValue)+M).toString()},await Rt(n.signer,r[0].trade.chainId);const E=()=>b({phase:"processing",stage:"settling",step:r.length,total:r.length});b({phase:"processing",stage:"awaiting-signature",step:r.length,total:r.length});const j=await Me({purchases:x,buyer:n.address,signer:n.signer,onSigned:E});t.forEach(v=>d(v.item.id)),N(null),Q("Shop Completed Purchase",{...ke(u),payment_type:"credits_and_mana",transaction_hash:j[0]??null}),m.invalidateQueries({queryKey:["mana-balance"]}),Qe(h,j)}catch(x){y.length&&(je(n.identity,y).catch(()=>{}),m.invalidateQueries({queryKey:["usd-balance"]})),Ke(x,"buy_cart_combined")}}async function O(t){if(!n){ct({type:"cart-checkout"}),I();return}const s=q.getState().items.filter(_e);if(s.length===0)return;G(null),ae(null),A(!0);const l=s.reduce((r,u)=>r+u.priceCredits*u.quantity,0);Q("Shop Started Checkout",{cart_size:s.length,cart_value_credits:l,cart_value_usd:tt(l),has_sufficient_credits:se>=l});try{const r=await is(s,n.address,It,await Ue()),u=[...r.unavailable,...r.own];if(u.length&&(u.forEach(h=>d(h.id)),ae(fn(r))),r.buyable.length===0){G(a("cart.error.noneAvailable")),N(null);return}if(r.orderChanged){N(r),Ie.current=Date.now();return}await Oe(r.buyable,t)}catch(r){V(r,{flow:"cart_checkout",step:"review",cart_size:s.length}),G(Te(r))}finally{A(!1)}}async function Ye(){if(P){if(!n){ct({type:"cart-checkout"}),I();return}if(Date.now()-Ie.current>mn){N(null),ae(null),await O();return}G(null),Oe(P.buyable)}}async function Ft(){if(ye){try{sessionStorage.setItem(de,JSON.stringify(q.getState().items))}catch{}A(!0);try{const t=await rs(ye,n?{address:n.address,identity:n.identity}:void 0);if(t.url){window.location.href=t.url;return}U("/credits")}catch(t){try{sessionStorage.removeItem(de)}catch{}V(t,{flow:"cart_buy_credits"}),b({phase:"error",message:a("buyModal.error.creditsCheckout")})}finally{A(!1)}}}const Je=$.useRef(!1);$.useEffect(()=>{if(!n||Je.current||!Ea("cart-checkout"))return;Je.current=!0;const t=setTimeout(()=>void O(),0);return()=>clearTimeout(t)},[n]);const Xe=$.useRef(!1);$.useEffect(()=>{if(!(L!=null&&L.resumeCheckout)||Xe.current)return;Xe.current=!0,X.current=L.creditsAdded??null;try{const s=sessionStorage.getItem(de);if(s){sessionStorage.removeItem(de);const l=JSON.parse(s);Array.isArray(l)&&l.length&&F(l)}}catch{}m.invalidateQueries({queryKey:["usd-balance"]});const t=setTimeout(()=>void O(),0);return()=>clearTimeout(t)},[L==null?void 0:L.resumeCheckout]);const B=St||(p==null?void 0:p.phase)==="processing";return c.length===0&&!p?e.jsx(dt,{children:e.jsxs(ht,{children:[e.jsxs(ut,{onClick:()=>U(-1),type:"button",children:[e.jsx(R,{name:"arrow-left"}),a("nav.cart")]}),e.jsxs(ks,{"data-testid":"cart-empty",children:[e.jsx(R,{name:"cart-plus",size:110}),e.jsxs($s,{children:[e.jsx(Ss,{children:a("cart.empty.title")}),e.jsx(Ms,{children:a("cart.empty.body")})]}),e.jsx(Ts,{to:"/assets",children:a("cart.empty.cta")})]})]})}):e.jsxs(dt,{children:[e.jsxs(ht,{children:[e.jsxs(ut,{onClick:()=>U(-1),type:"button",children:[e.jsx(R,{name:"arrow-left"}),a("nav.cart")]}),e.jsxs(Cs,{children:[e.jsxs(ws,{children:[e.jsxs(js,{children:[e.jsx(Ps,{onClick:()=>U(-1),type:"button","aria-label":a("cart.goBack"),children:e.jsx(R,{name:"arrow-left"})}),e.jsx(zs,{children:a("cart.panelTitle",{count:Tt})}),kt?e.jsxs(As,{onClick:()=>W(!0),disabled:B,children:[e.jsx(R,{name:"fitting-room"}),a("cart.fittingRoom")]}):null]}),e.jsxs(vt,{children:[e.jsx(Is,{children:c.map(t=>{const s=At.get(t.id),l=s?s.priceCredits:t.priceCredits,r=!!s&&s.priceCredits!==t.priceCredits,u=!t.tokenId,h=t.quantity,f=typeof t.available=="number"&&h>=t.available,g=l*h,M=!!z[t.id],y=Yt(t),x=Re[t.id],E=!et(x),j=x==="sold-out"?a("cart.availability.soldOut"):a("cart.availability.unavailable");return e.jsxs(qs,{"data-unavailable":E||void 0,children:[e.jsxs(Rs,{"data-thumb":!0,children:[y?e.jsx(_s,{to:y,state:{item:t,tradeId:t.tradeId},"aria-label":t.name,children:t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:t.name}):null}):t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:t.name}):null,e.jsx(Bs,{"data-check":!0,"aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs(Es,{children:[e.jsxs(Fs,{"data-desc":!0,children:[y?e.jsx(Ls,{to:y,state:{item:t,tradeId:t.tradeId},title:t.name,children:t.name}):e.jsx(Ws,{title:t.name,children:t.name}),t.creator?e.jsx(Ns,{address:t.creator,linkToProfile:!0}):null,u?e.jsxs(Xs,{"data-testid":"cart-creator-tag",children:[e.jsx(Zs,{name:"buy-from-creator"}),a("cart.creatorTag")]}):null]}),e.jsx(Qs,{children:E?e.jsxs(e.Fragment,{children:[e.jsxs(Gs,{children:[e.jsx(Ys,{name:"warning-fill",size:24}),j]}),y?e.jsx(Js,{to:y,state:{item:t,tradeId:t.tradeId},children:a("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[u?e.jsxs(Ks,{children:[e.jsx(pt,{onClick:()=>re(()=>T(t.id)),disabled:B||h<=1,"aria-label":a("cart.decreaseQuantity",{name:t.name}),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsx(Us,{children:h}),e.jsx(pt,{onClick:()=>re(()=>k(t.id)),disabled:B||f,"aria-label":a("cart.increaseQuantity"),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null,e.jsxs(Os,{children:[e.jsx(Hs,{})," ",g,r?e.jsx(Vs,{children:t.priceCredits*h}):null]})]})})]}),e.jsxs(Ds,{children:[e.jsx(en,{"data-on":M||void 0,onClick:()=>me(t),"aria-label":M?a("cart.removeFromFavorites",{name:t.name}):a("cart.addToFavorites",{name:t.name}),title:M?a("assetCard.removeFromFavorites"):a("assetCard.addToFavorites"),children:e.jsx(R,{name:M?"heart-solid":"heart"})}),e.jsx(tn,{onClick:()=>re(()=>d(t.id)),disabled:B,"aria-label":a("cart.remove",{name:t.name}),title:a("cart.removeTitle"),children:e.jsx(R,{name:"trash",size:24})})]})]},t.id)})}),e.jsx(an,{children:e.jsx("button",{className:"link",onClick:()=>re(_),disabled:B,children:a("cart.clearCart")})})]})]}),e.jsxs(sn,{children:[e.jsx(nn,{children:a("cart.purchaseSummary")}),e.jsxs(rn,{children:[e.jsxs(on,{children:[e.jsx(cn,{children:a("cart.totalItems",{count:Pt})}),e.jsxs(dn,{children:[e.jsxs(ln,{children:[e.jsx(hn,{})," ",Be]}),Le&&(Y??0n)>0n?e.jsx(un,{"data-testid":"cart-mana-rate",children:Le}):null]})]}),ie.options.length>0||ie.manaShortfall?e.jsx(gt,{options:ie.options,totalCents:ne,shortfall:ie.manaShortfall,creditsLabel:P?a("marketCheckout.confirmPurchase"):a("cart.buyWithCredits"),busy:B||ve,onPay:t=>void(P?Ye():O(t))}):e.jsx(pn,{onClick:()=>void(P?Ye():O()),disabled:B||ve,children:B?a("cart.working"):P?a("marketCheckout.confirmPurchase"):a("assetCard.buyNow")}),ve?e.jsx(ue,{className:"muted",children:a("cart.allUnavailable")}):null,n?null:e.jsx(ue,{className:"muted",children:a("cart.signInHint")}),P?e.jsx(ue,{className:"muted",children:a("cart.priceChanged")}):null,Ae?e.jsx(ue,{className:"muted",children:Ae}):null,e.jsx(xn,{message:$t})]})]})]})]}),Ee.length>0?e.jsx(gn,{children:e.jsx(Fa,{title:a("cart.youMightAlsoLike"),items:Ee})}):null,we&&n?e.jsx(Wa,{auth:we.auth,signer:n.signer,title:a("authorizeStep.manaTitle"),name:a("authorizeStep.manaName"),reason:a("authorizeStep.manaReason"),icon:e.jsx("img",{src:La,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:t}=we;oe(null),t()},onCancel:()=>oe(null),onClose:()=>oe(null)}):null,p?e.jsx(ys,{phase:p.phase,balanceCredits:se,onClose:qt,stage:p.phase==="processing"?p.stage:void 0,step:p.phase==="processing"?p.step:void 0,total:p.phase==="processing"?p.total:void 0,isSelfCustody:Jt(n==null?void 0:n.providerType),options:p.phase==="choose"?Bt(p).options:void 0,onPay:Et,totalCents:p.phase==="choose"?p.totalCents:void 0,totalManaWei:p.phase==="choose"?p.manaWei:void 0,totalCredits:p.phase==="choose"?Pe(p.lines):void 0,lines:p.phase==="nofunds"?p.lines:void 0,shortfallCredits:p.phase==="nofunds"?p.shortfall:void 0,packs:te,selectedPack:ye,onSelectPack:qe,onBuyPacks:()=>void Ft(),message:p.phase==="error"?p.message:void 0,onRetry:()=>void O()}):null]})}export{En as Cart};
|
|
676
|
+
`;function Te(c){if(cs(c))return a("errors.rejected");const d=(c.message??"").toLowerCase();return d.includes("insufficient")?a("cart.error.insufficient",{currency:ea.name}):d.includes("no active listing")||d.includes("your own listing")?a("cart.error.listingChanged"):a("marketCheckout.error.generic")}const mn=12e4;function fn(c){const d=[];return c.unavailable.length&&d.push(a("cart.drop.unavailable",{count:c.unavailable.length})),c.own.length&&d.push(a("cart.drop.own",{count:c.own.length})),a("cart.drop.removed",{items:d.join(` ${a("cart.drop.and")} `)})}const Pe=c=>c.reduce((d,k)=>d+k.priceCredits*k.quantity,0),he=c=>c.flatMap(d=>Array.from({length:d.quantity},()=>({...d,quantity:1})));function Bn(){Ut({title:a("nav.cart"),noindex:!0});const c=q(t=>t.items),d=q(t=>t.remove),k=q(t=>t.increment),T=q(t=>t.decrement),_=q(t=>t.clear),W=q(t=>t.restore),F=q(t=>t.setFittingOpen),z=Ze(t=>t.items),me=Ze(t=>t.toggle),{session:n,signIn:I}=Ht(),te=ns().packs.slice(0,is);$.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const kt=c.some(t=>t.category!=="emote"),{data:fe}=Ot({queryKey:["upsell-listings"],queryFn:()=>aa({first:40}),staleTime:6e4}),{data:C}=Vt(n),m=Dt(),U=Lt(),{state:L}=Nt(),[$t,G]=$.useState(null),[Ae,ae]=$.useState(null),[St,A]=$.useState(!1),[P,N]=$.useState(null),Ie=$.useRef(0),[p,b]=$.useState(null),{data:J}=Gt(n),{data:Y}=Oa(!0),[ye,qe]=$.useState(""),X=$.useRef(null),Re=Jt(c),_e=t=>et(Re[t.id]),be=c.filter(_e),ve=c.length>0&&be.length===0,Mt=be.reduce((t,s)=>t+s.priceCredits*s.quantity,0),Tt=c.reduce((t,s)=>t+s.quantity,0),Pt=be.reduce((t,s)=>t+s.quantity,0),Be=P?P.liveTotalCredits:Mt,zt=new Set(c.map(t=>t.id)),Ee=((fe==null?void 0:fe.items)??[]).filter(t=>!zt.has(t.id)).slice(0,12),At=new Map(P==null?void 0:P.buyable.map(t=>[t.item.id,t])),se=(C==null?void 0:C.credits)??0,ne=Be*10,We=Y?lt(ne,Y):0n,ie=Se({priceCents:ne,priceManaWei:We,balanceCents:(C==null?void 0:C.balanceCents)??0,manaBalanceWei:J??0n}),Fe=mt(ne,We),Le=Fe!=null?a("buyModal.manaRate",{mana:Fe.toLocaleString("en",{maximumFractionDigits:2})}):null,It=Zt;function re(t){t(),N(null),ae(null),G(null)}function qt(){b(null),A(!1)}function Ne(t){const s=Pe(t),l=Math.max(0,s-se),r=te.find(u=>u.credits>=l)??te[te.length-1];qe(r.id),Q("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:s,credits_balance:se,shortfall:l}),b({phase:"nofunds",lines:t.map(u=>({item:u.item,priceCredits:u.priceCredits,quantity:u.quantity})),shortfall:l}),A(!1)}async function Ce(t){if(!n||t.length===0)return;const s=he(t),l=s.map(g=>({...g.item,priceCredits:g.priceCredits})),r=t.map(g=>({...g.item,priceCredits:g.priceCredits,quantity:g.quantity})),u=[];let h="authorize",f=!1;b({phase:"processing",stage:"reserving",step:1,total:s.length});try{const g=[];for(let j=0;j<s.length;j++){const v=s[j];b({phase:"processing",stage:"reserving",step:j+1,total:s.length});try{const{credit:w,maxCreditedValue:O}=await st(n.identity,v.usdCents,v.trade.id);u.push(w.id),g.push({trade:v.trade,credits:[w],maxCreditedValue:O})}catch(w){if(ls(w)){if(u.length){try{await je(n.identity,u)}catch(O){V(O,{flow:"cart_checkout",step:"release"})}m.invalidateQueries({queryKey:["usd-balance"]})}Ne(t);return}throw w}}h="submit";const M=()=>b({phase:"processing",stage:"settling",step:s.length,total:s.length});b({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});let y=[];if(Da())try{y=await es({purchases:g,buyer:n.address,signer:n.signer,onSigned:M});const v=(await Promise.allSettled(y.map(w=>ts(w)))).flatMap(w=>w.status==="rejected"?[w.reason]:[]);if(v.length&&!v.some(w=>w instanceof as))throw v[0];f=!0}catch(j){if(!(j instanceof ss))throw j;y=await Me({purchases:g,buyer:n.address,signer:n.signer,onSigned:M})}else y=await Me({purchases:g,buyer:n.address,signer:n.signer});t.forEach(j=>d(j.item.id)),N(null),Q("Shop Completed Purchase",{...ke(l),payment_type:"credits",no_crypto_step:f,transaction_hash:y[0]??null}),Qa(m);const x=X.current;X.current=null,b(null),A(!1);const E={items:r,txHash:y[0]??void 0,settled:!0,...x?{creditsAdded:x}:{}};U("/success",{state:E,replace:!0})}catch(g){if(ce(g)||V(g,{flow:"cart_checkout",step:h,cart_size:t.length}),Q(ce(g)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:h,error_code:nt(g),value_usd:tt(l.reduce((M,y)=>M+y.priceCredits,0)),cart_size:s.length}),u.length){try{await je(n.identity,u)}catch(M){V(M,{flow:"cart_checkout",step:"release"})}m.invalidateQueries({queryKey:["usd-balance"]})}b({phase:"error",message:Te(g)})}}function Qe(t,s){m.invalidateQueries({queryKey:["usd-balance"]}),m.invalidateQueries({queryKey:["detail-trade"]}),m.invalidateQueries({queryKey:["shop-item"]}),m.invalidateQueries({queryKey:["owned-token"]}),m.invalidateQueries({queryKey:["public-token"]}),m.invalidateQueries({queryKey:["item-resales"]}),m.invalidateQueries({queryKey:["shop-items"]}),m.invalidateQueries({queryKey:["catalog-items"]}),m.invalidateQueries({queryKey:["my-assets"]}),m.invalidateQueries({queryKey:["purchases"]}),m.invalidateQueries({queryKey:["owned-item-count"]}),m.invalidateQueries({queryKey:["overview-listings"]}),m.invalidateQueries({queryKey:["upsell-listings"]});const l=X.current;X.current=null,b(null),A(!1);const r={items:t,txHash:s[0]??void 0,settled:!0,...l?{creditsAdded:l}:{}};U("/success",{state:r,replace:!0})}function Ke(t,s){ce(t)||V(t,{flow:s,step:"submit"}),Q(ce(t)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:nt(t)}),b({phase:"error",message:Te(t)}),A(!1)}async function Rt(t,s){const l=le($e.MANAToken,s),r=le($e.CreditsManager,s);await Xa({auth:{kind:Za.Allowance,contractAddress:l.address,spenderAddress:r.address,chainId:s},signer:t})}async function Ue(){if(Y)return Y;try{return await m.fetchQuery({queryKey:["mana-rate",at.chainId],queryFn:()=>Va(at.chainId),staleTime:6e4})}catch{return}}async function _t(t){const s=he(t).reduce((h,f)=>h+f.usdCents,0),r=(J??0n)>0n?await Ue():Y,u=r?lt(s,r):0n;return{totalCents:s,manaWei:u}}async function He(t,s){const l=Pe(t),{totalCents:r,manaWei:u}=await _t(t),h=Se({priceCents:r,priceManaWei:u,balanceCents:(C==null?void 0:C.balanceCents)??0,manaBalanceWei:J??0n});if(s&&h.options.some(f=>f.method===s)){if(s==="credits"){Ce(t);return}const{spender:f,chainId:g}=Oe(s,t);await Ve(f,g,()=>s==="mana"?void De(t):void Ge(t,r,u));return}if(h.options.some(f=>f.method==="mana"||f.method==="combined")){b({phase:"choose",lines:t,totalCents:r,manaWei:u}),A(!1);return}if(C!=null&&C.credits<l){Ne(t);return}Ce(t)}function Bt(t){return Se({priceCents:t.totalCents,priceManaWei:t.manaWei,balanceCents:(C==null?void 0:C.balanceCents)??0,manaBalanceWei:J??0n})}const[we,oe]=$.useState(null);function Oe(t,s){const l=s[0].trade;return{spender:t==="mana"?le(ta(l.contract),l.chainId).address:le($e.CreditsManager,l.chainId).address,chainId:l.chainId}}async function Ve(t,s,l){const r=Ga(s,t),u=n?await Ja(r,n.address).catch(()=>!0):!0;if(Ya(n==null?void 0:n.providerType,u)){A(!1),oe({auth:r,run:l});return}l()}function Et(t){if((p==null?void 0:p.phase)!=="choose")return;const{lines:s,totalCents:l,manaWei:r}=p;if(t==="credits"){Ce(s);return}const{spender:u,chainId:h}=Oe(t,s);Ve(u,h,()=>t==="mana"?void De(s):void Ge(s,l,r))}async function De(t){if(!n||t.length===0)return;const s=he(t),l=s.map(h=>({...h.item,priceCredits:h.priceCredits})),r=t.map(h=>({...h.item,priceCredits:h.priceCredits,quantity:h.quantity})),u=()=>b({phase:"processing",stage:"settling",step:s.length,total:s.length});b({phase:"processing",stage:"awaiting-signature",step:s.length,total:s.length});try{const h=await Ka({trades:s.map(f=>f.trade),buyer:n.address,signer:n.signer,onSigned:u});t.forEach(f=>d(f.item.id)),N(null),Q("Shop Completed Purchase",{...ke(l),payment_type:"mana",transaction_hash:h[0]??null}),m.invalidateQueries({queryKey:["mana-balance"]}),Qe(r,h)}catch(h){Ke(h,"buy_cart_mana")}}async function Ge(t,s,l){if(!n||t.length===0)return;const r=he(t),u=r.map(x=>({...x.item,priceCredits:x.priceCredits})),h=t.map(x=>({...x.item,priceCredits:x.priceCredits,quantity:x.quantity})),f=Ua(r.map(x=>x.usdCents),(C==null?void 0:C.balanceCents)??0),g=f.reduce((x,E)=>x+E,0),M=Ha(Math.max(0,s-g),s,l),y=[];b({phase:"processing",stage:"reserving",step:1,total:r.length});try{const x=[];for(let v=0;v<r.length;v++){const w=f[v];if(w<=0)continue;b({phase:"processing",stage:"reserving",step:v+1,total:r.length});const{credit:O,maxCreditedValue:Ft}=await st(n.identity,w,r[v].trade.id);y.push(O.id),x.push({trade:r[v].trade,credits:[O],maxCreditedValue:Ft})}r.forEach((v,w)=>{f[w]<=0&&x.push({trade:v.trade,credits:[],maxCreditedValue:"0"})}),x[0]={...x[0],maxCreditedValue:(BigInt(x[0].maxCreditedValue)+M).toString()},await Rt(n.signer,r[0].trade.chainId);const E=()=>b({phase:"processing",stage:"settling",step:r.length,total:r.length});b({phase:"processing",stage:"awaiting-signature",step:r.length,total:r.length});const j=await Me({purchases:x,buyer:n.address,signer:n.signer,onSigned:E});t.forEach(v=>d(v.item.id)),N(null),Q("Shop Completed Purchase",{...ke(u),payment_type:"credits_and_mana",transaction_hash:j[0]??null}),m.invalidateQueries({queryKey:["mana-balance"]}),Qe(h,j)}catch(x){y.length&&(je(n.identity,y).catch(()=>{}),m.invalidateQueries({queryKey:["usd-balance"]})),Ke(x,"buy_cart_combined")}}async function H(t){if(!n){ct({type:"cart-checkout"}),I();return}const s=q.getState().items.filter(_e);if(s.length===0)return;G(null),ae(null),A(!0);const l=s.reduce((r,u)=>r+u.priceCredits*u.quantity,0);Q("Shop Started Checkout",{cart_size:s.length,cart_value_credits:l,cart_value_usd:tt(l),has_sufficient_credits:se>=l});try{const r=await rs(s,n.address,It,await Ue()),u=[...r.unavailable,...r.own];if(u.length&&(u.forEach(h=>d(h.id)),ae(fn(r))),r.buyable.length===0){G(a("cart.error.noneAvailable")),N(null);return}if(r.orderChanged){N(r),Ie.current=Date.now();return}await He(r.buyable,t)}catch(r){V(r,{flow:"cart_checkout",step:"review",cart_size:s.length}),G(Te(r))}finally{A(!1)}}async function Je(){if(P){if(!n){ct({type:"cart-checkout"}),I();return}if(Date.now()-Ie.current>mn){N(null),ae(null),await H();return}G(null),He(P.buyable)}}async function Wt(){if(ye){try{sessionStorage.setItem(de,JSON.stringify(q.getState().items))}catch{}A(!0);try{const t=await os(ye,n?{address:n.address,identity:n.identity}:void 0);if(t.url){window.location.href=t.url;return}U("/credits")}catch(t){try{sessionStorage.removeItem(de)}catch{}V(t,{flow:"cart_buy_credits"}),b({phase:"error",message:a("buyModal.error.creditsCheckout")})}finally{A(!1)}}}const Ye=$.useRef(!1);$.useEffect(()=>{if(!n||Ye.current||!Wa("cart-checkout"))return;Ye.current=!0;const t=setTimeout(()=>void H(),0);return()=>clearTimeout(t)},[n]);const Xe=$.useRef(!1);$.useEffect(()=>{if(!(L!=null&&L.resumeCheckout)||Xe.current)return;Xe.current=!0,X.current=L.creditsAdded??null;try{const s=sessionStorage.getItem(de);if(s){sessionStorage.removeItem(de);const l=JSON.parse(s);Array.isArray(l)&&l.length&&W(l)}}catch{}m.invalidateQueries({queryKey:["usd-balance"]});const t=setTimeout(()=>void H(),0);return()=>clearTimeout(t)},[L==null?void 0:L.resumeCheckout]);const B=St||(p==null?void 0:p.phase)==="processing";return c.length===0&&!p?e.jsx(dt,{children:e.jsxs(ht,{children:[e.jsxs(ut,{onClick:()=>U(-1),type:"button",children:[e.jsx(R,{name:"arrow-left"}),a("nav.cart")]}),e.jsxs(ks,{"data-testid":"cart-empty",children:[e.jsx(R,{name:"cart-plus",size:110}),e.jsxs($s,{children:[e.jsx(Ss,{children:a("cart.empty.title")}),e.jsx(Ms,{children:a("cart.empty.body")})]}),e.jsx(Ts,{to:"/assets",children:a("cart.empty.cta")})]})]})}):e.jsxs(dt,{children:[e.jsxs(ht,{children:[e.jsxs(ut,{onClick:()=>U(-1),type:"button",children:[e.jsx(R,{name:"arrow-left"}),a("nav.cart")]}),e.jsxs(Cs,{children:[e.jsxs(ws,{children:[e.jsxs(js,{children:[e.jsx(Ps,{onClick:()=>U(-1),type:"button","aria-label":a("cart.goBack"),children:e.jsx(R,{name:"arrow-left"})}),e.jsx(zs,{children:a("cart.panelTitle",{count:Tt})}),kt?e.jsxs(As,{onClick:()=>F(!0),disabled:B,children:[e.jsx(R,{name:"fitting-room"}),a("cart.fittingRoom")]}):null]}),e.jsxs(vt,{children:[e.jsx(Is,{children:c.map(t=>{const s=At.get(t.id),l=s?s.priceCredits:t.priceCredits,r=!!s&&s.priceCredits!==t.priceCredits,u=!t.tokenId,h=t.quantity,f=typeof t.available=="number"&&h>=t.available,g=l*h,M=!!z[t.id],y=Yt(t),x=Re[t.id],E=!et(x),j=x==="sold-out"?a("cart.availability.soldOut"):a("cart.availability.unavailable");return e.jsxs(qs,{"data-unavailable":E||void 0,children:[e.jsxs(Rs,{"data-thumb":!0,children:[y?e.jsx(_s,{to:y,state:{item:t,tradeId:t.tradeId},"aria-label":t.name,children:t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:t.name}):null}):t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:t.name}):null,e.jsx(Bs,{"data-check":!0,"aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs(Es,{children:[e.jsxs(Ws,{"data-desc":!0,children:[y?e.jsx(Ls,{to:y,state:{item:t,tradeId:t.tradeId},title:t.name,children:t.name}):e.jsx(Fs,{title:t.name,children:t.name}),t.creator?e.jsx(Ns,{address:t.creator,linkToProfile:!0}):null,u?e.jsxs(Xs,{"data-testid":"cart-creator-tag",children:[e.jsx(Zs,{name:"buy-from-creator"}),a("cart.creatorTag")]}):null]}),e.jsx(Qs,{children:E?e.jsxs(e.Fragment,{children:[e.jsxs(Gs,{children:[e.jsx(Js,{name:"warning-fill",size:24}),j]}),y?e.jsx(Ys,{to:y,state:{item:t,tradeId:t.tradeId},children:a("cart.availability.viewResales")}):null]}):e.jsxs(e.Fragment,{children:[u?e.jsxs(Ks,{children:[e.jsx(pt,{onClick:()=>re(()=>T(t.id)),disabled:B||h<=1,"aria-label":a("cart.decreaseQuantity",{name:t.name}),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsx(Us,{children:h}),e.jsx(pt,{onClick:()=>re(()=>k(t.id)),disabled:B||f,"aria-label":a("cart.increaseQuantity"),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null,e.jsxs(Hs,{children:[e.jsx(Os,{})," ",g,r?e.jsx(Vs,{children:t.priceCredits*h}):null]})]})})]}),e.jsxs(Ds,{children:[e.jsx(en,{"data-on":M||void 0,onClick:()=>me(t),"aria-label":M?a("cart.removeFromFavorites",{name:t.name}):a("cart.addToFavorites",{name:t.name}),title:M?a("assetCard.removeFromFavorites"):a("assetCard.addToFavorites"),children:e.jsx(R,{name:M?"heart-solid":"heart"})}),e.jsx(tn,{onClick:()=>re(()=>d(t.id)),disabled:B,"aria-label":a("cart.remove",{name:t.name}),title:a("cart.removeTitle"),children:e.jsx(R,{name:"trash",size:24})})]})]},t.id)})}),e.jsx(an,{children:e.jsx("button",{className:"link",onClick:()=>re(_),disabled:B,children:a("cart.clearCart")})})]})]}),e.jsxs(sn,{children:[e.jsx(nn,{children:a("cart.purchaseSummary")}),e.jsxs(rn,{children:[e.jsxs(on,{children:[e.jsx(cn,{children:a("cart.totalItems",{count:Pt})}),e.jsxs(dn,{children:[e.jsxs(ln,{children:[e.jsx(hn,{})," ",Be]}),Le&&(J??0n)>0n?e.jsx(un,{"data-testid":"cart-mana-rate",children:Le}):null]})]}),ie.options.length>0||ie.manaShortfall?e.jsx(gt,{options:ie.options,totalCents:ne,shortfall:ie.manaShortfall,creditsLabel:P?a("marketCheckout.confirmPurchase"):a("cart.buyWithCredits"),busy:B||ve,onPay:t=>void(P?Je():H(t))}):e.jsx(pn,{onClick:()=>void(P?Je():H()),disabled:B||ve,children:B?a("cart.working"):P?a("marketCheckout.confirmPurchase"):a("assetCard.buyNow")}),ve?e.jsx(ue,{className:"muted",children:a("cart.allUnavailable")}):null,n?null:e.jsx(ue,{className:"muted",children:a("cart.signInHint")}),P?e.jsx(ue,{className:"muted",children:a("cart.priceChanged")}):null,Ae?e.jsx(ue,{className:"muted",children:Ae}):null,e.jsx(xn,{message:$t})]})]})]})]}),Ee.length>0?e.jsx(gn,{children:e.jsx(Fa,{title:a("cart.youMightAlsoLike"),items:Ee})}):null,we&&n?e.jsx(La,{auth:we.auth,signer:n.signer,title:a("authorizeStep.manaTitle"),name:a("authorizeStep.manaName"),reason:a("authorizeStep.manaReason"),icon:e.jsx("img",{src:Na,width:24,height:24,alt:"","aria-hidden":!0}),onAuthorized:()=>{const{run:t}=we;oe(null),t()},onCancel:()=>oe(null),onClose:()=>oe(null)}):null,p?e.jsx(ys,{phase:p.phase,balanceCredits:se,onClose:qt,stage:p.phase==="processing"?p.stage:void 0,step:p.phase==="processing"?p.step:void 0,total:p.phase==="processing"?p.total:void 0,isSelfCustody:Xt(n==null?void 0:n.providerType),options:p.phase==="choose"?Bt(p).options:void 0,onPay:Et,totalCents:p.phase==="choose"?p.totalCents:void 0,totalManaWei:p.phase==="choose"?p.manaWei:void 0,totalCredits:p.phase==="choose"?Pe(p.lines):void 0,lines:p.phase==="nofunds"?p.lines:void 0,shortfallCredits:p.phase==="nofunds"?p.shortfall:void 0,packs:te,selectedPack:ye,onSelectPack:qe,onBuyPacks:()=>void Wt(),message:p.phase==="error"?p.message:void 0,onRetry:()=>void H()}):null]})}export{Bn as Cart};
|