@dcl/shop 0.1.0-29996672089.commit-ce4d282 → 0.1.0-29998165954.commit-94f27c7
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-ji9z26-b.js → Activity-CQ1S7RP2.js} +1 -1
- package/assets/{AnimatedBackground-dlJZeXOs.js → AnimatedBackground-B60_y-iB.js} +1 -1
- package/assets/{Assets-DHtvK9gi.js → Assets-DM226wfM.js} +1 -1
- package/assets/{Assets.styles-DBA9HXW7.js → Assets.styles-Btwb1rti.js} +1 -1
- package/assets/{Authorizations-BNMCiOdB.js → Authorizations-xmfXuMqn.js} +1 -1
- package/assets/{Cart-BlShrWP_.js → Cart-dxu8TEgG.js} +1 -1
- package/assets/{CircularProgress-DvTkhDvC.js → CircularProgress-D3dl01wX.js} +1 -1
- package/assets/{Collection-DFIFsgYQ.js → Collection-DDSbHeKd.js} +1 -1
- package/assets/{CollectionCarousel-DMwkzkYf.js → CollectionCarousel-qqanrG2T.js} +1 -1
- package/assets/{Creator-BzYX40qE.js → Creator-BnbES5jB.js} +1 -1
- package/assets/{CssVarsProvider-D82yS8Ds.js → CssVarsProvider-Bt7Uqfjv.js} +1 -1
- package/assets/{ExchangeController-CiGVwKQf.js → ExchangeController-DylfpE-b.js} +1 -1
- package/assets/{GetCredits-eVhxGnMo.js → GetCredits-eyGBD1At.js} +1 -1
- package/assets/{HelpersUtil-C32FavmO.js → HelpersUtil-ONsX5AUS.js} +1 -1
- package/assets/{ImportListings-BiGwtdUn.js → ImportListings-BgmJrYYl.js} +1 -1
- package/assets/{ItemDetail-DQOBDAhC.js → ItemDetail-Bd8WksQa.js} +2 -2
- package/assets/{LoadMore-BjvEi3Wj.js → LoadMore-DAqU2FKL.js} +1 -1
- package/assets/{MarketCheckout-BB0_ss_n.js → MarketCheckout-DuLpUtl6.js} +1 -1
- package/assets/{MyAssets-cbSiEx2B.js → MyAssets-CCrB2a8a.js} +1 -1
- package/assets/{MyFavorites-DxWrJSpf.js → MyFavorites-Ceugbkn9.js} +1 -1
- package/assets/{NotFound-Cj4SIl5T.js → NotFound-PAfvcQvY.js} +1 -1
- package/assets/{PrimaryListModal-CdZJXblc.js → PrimaryListModal-5XAxSkjg.js} +1 -1
- package/assets/{StoreSettings-LdrMcuVr.js → StoreSettings-BczIRbgU.js} +5 -5
- package/assets/{Success-BRT1MWds.js → Success-Bp66M0uy.js} +1 -1
- package/assets/{SwapController-CXQ00xts.js → SwapController-DufZMq9T.js} +1 -1
- package/assets/{Tooltip-BZ57TVaP.js → Tooltip-DMu4FyD0.js} +1 -1
- package/assets/{TradeService-SfkC7zHZ.js → TradeService-B1_Alpk3.js} +1 -1
- package/assets/{W3MFrameProviderSingleton-B8RM0-JJ.js → W3MFrameProviderSingleton-CwlhUGa4.js} +3 -3
- package/assets/{WebCryptoP256-D_33Dvnx.js → WebCryptoP256-uRjtMnR-.js} +1 -1
- package/assets/{authorizations-D44lw00X.js → authorizations-HxyvVTVD.js} +1 -1
- package/assets/{basic-CtFzqtOx.js → basic-CBBntIne.js} +1 -1
- package/assets/{biconomy-BaeM1SCU.js → biconomy-Gl4G3kZ2.js} +1 -1
- package/assets/{buy-Dszi8UeF.js → buy-Cf4D1sNV.js} +1 -1
- package/assets/{buy-gasless-Nfp6cMbQ.js → buy-gasless-DN1sOd1A.js} +1 -1
- package/assets/{cart-checkout-Ba3nMBI0.js → cart-checkout-r4Liry5X.js} +1 -1
- package/assets/{categories-D0iwhqs_.js → categories-C9Gq6j7d.js} +1 -1
- package/assets/{ccip-CaKFUjmD.js → ccip-Ch1A53wO.js} +1 -1
- package/assets/{ccip-DGnj8pvI.js → ccip-D-RstLJp.js} +1 -1
- package/assets/{collection-DSysxaCY.js → collection-BSoK3y5r.js} +1 -1
- package/assets/{controller-DqW_a2vQ.js → controller-B7IHgPyr.js} +2 -2
- package/assets/{core-BfFj7IDN.js → core-B3kyxDkb.js} +4 -4
- package/assets/{custom-CyKMgWLF.js → custom-Ct3JEEDg.js} +1 -1
- package/assets/{data-capture-DyJzM655.js → data-capture-DFw7mxvh.js} +1 -1
- package/assets/{email-B1LVTurO.js → email-D6vja-Xi.js} +1 -1
- package/assets/{embedded-wallet-DbH1O4GQ.js → embedded-wallet-CkmpdmJ3.js} +1 -1
- package/assets/{emotion-styled.browser.esm-CMXzhKww.js → emotion-styled.browser.esm-DEfIzFSa.js} +1 -1
- package/assets/{engine-BNiIRF8k.js → engine-CiP5MdSc.js} +1 -1
- package/assets/{errors-DUo56sGG.js → errors-B_GO1NZB.js} +1 -1
- package/assets/{estimate-l1-fee-DbEUBk2I.js → estimate-l1-fee-DiRSrRcV.js} +1 -1
- package/assets/{execute-CzNqLgfO.js → execute-CwnICnat.js} +2 -2
- package/assets/{features-D_R5E38-.js → features-CAnqu3Sc.js} +1 -1
- package/assets/{fetchTokenMetadata-BZsN957Y.js → fetchTokenMetadata-Cc9rSYF1.js} +2 -2
- package/assets/{get-ecosystem-wallet-info-BIlu2xkX.js → get-ecosystem-wallet-info-CoLOiw65.js} +1 -1
- package/assets/{getBalance-BD5xADMR.js → getBalance-BNKtRXZ7.js} +1 -1
- package/assets/{getNFT-DjEJIHB0.js → getNFT-BI_-d9KG.js} +1 -1
- package/assets/{getNFT-B7e2uNF-.js → getNFT-BIcTMezx.js} +1 -1
- package/assets/{getOverlayAlpha-Ho14PJoT.js → getOverlayAlpha-D966K3RG.js} +1 -1
- package/assets/{hashTypedData-CC4Umz6j.js → hashTypedData-B5uEMQfs.js} +1 -1
- package/assets/{hashTypedData-DE2iuKMA.js → hashTypedData-DO7aTzMo.js} +1 -1
- package/assets/{import-BPLVQmln.js → import-Cnh7LTQ6.js} +1 -1
- package/assets/{in-app-qD4m50Nn.js → in-app-CK4zclFV.js} +1 -1
- package/assets/{in-app-wallet-calls-BcFExuty.js → in-app-wallet-calls-Dpg7CvYB.js} +1 -1
- package/assets/{index-B_AeYsKa.js → index--DA7r4x_.js} +1 -1
- package/assets/{index-BGbFLGJH.js → index-5ST535e6.js} +1 -1
- package/assets/{index-D_xn82-1.js → index-9R05sahO.js} +1 -1
- package/assets/{index-CDkTFenk.js → index-B1He8BC8.js} +2 -2
- package/assets/{index-VUv3xRHQ.js → index-BDraLmvG.js} +1 -1
- package/assets/{index-Dg2IevmK.js → index-BLr_pqsz.js} +2 -2
- package/assets/{index-CrhtLjWe.js → index-BPX_5p4E.js} +1 -1
- package/assets/{index-BAKqn_lj.js → index-BYhpAHD_.js} +2 -2
- package/assets/{index-hDcHuSsT.js → index-BZXMBsoP.js} +1 -1
- package/assets/{index-Cx9QgWtN.js → index-BbrSULPV.js} +1 -1
- package/assets/{index-CA73t5p4.js → index-Bn1mHQve.js} +1 -1
- package/assets/{index-DD8leihn.js → index-BpeuyNx2.js} +1 -1
- package/assets/{index-C4111GJ-.js → index-Bu7iRw_n.js} +1 -1
- package/assets/{index-CGNquv7o.js → index-BuIf8bJO.js} +21 -21
- package/assets/{index-BNa7Mf2M.js → index-BxN6B0Kw.js} +1 -1
- package/assets/{index-DUx_udvr.js → index-C2tE9vuy.js} +1 -1
- package/assets/{index-BnrQ0KXT.js → index-C4tiEYzB.js} +1 -1
- package/assets/{index-yRQsdAyS.js → index-C5SWIbX1.js} +3 -3
- package/assets/{index-CwFsoF5e.js → index-CAPlUTsQ.js} +1 -1
- package/assets/{index-Dv2SQ_eL.js → index-CJoN849e.js} +1 -1
- package/assets/{index-BBLW_jFO.js → index-CKREiUBo.js} +1 -1
- package/assets/{index-Dzj-nA_x.js → index-CMI54Xz_.js} +1 -1
- package/assets/{index-z9bgkHOn.js → index-CMWxvoeR.js} +1 -1
- package/assets/{index-C8P6BHpY.js → index-CN7LSdt9.js} +3 -3
- package/assets/{index-hmML8Yn6.js → index-CPDwm9i3.js} +1 -1
- package/assets/{index-0syK5-Ww.js → index-CSZ92vM6.js} +1 -1
- package/assets/{index-B9U21JU-.js → index-Cc0i-akL.js} +1 -1
- package/assets/{index--PWwvcNI.js → index-Cm3FUlKl.js} +1 -1
- package/assets/{index-DcVvVcVQ.js → index-CmKYvq1f.js} +1 -1
- package/assets/{index-BuXSM1De.js → index-CmejkGIl.js} +1 -1
- package/assets/{index-BFydxC8W.js → index-CwqoZ_h0.js} +1 -1
- package/assets/{index-5RDpMwKv.js → index-CysYUHJL.js} +1 -1
- package/assets/{index-ByOIX4VW.js → index-D-1HL6xt.js} +1 -1
- package/assets/{index-B9n-6xCt.js → index-D7hxCZ_0.js} +1 -1
- package/assets/{index-grzzP9n9.js → index-DCmUtroF.js} +1 -1
- package/assets/{index-Bt55wXtx.js → index-DEHYfBo2.js} +1 -1
- package/assets/{index-BW1vsFdc.js → index-DKBbIWQ-.js} +1 -1
- package/assets/{index-CuA9C-j1.js → index-DMGHbuSV.js} +1 -1
- package/assets/{index-CPvKfkxC.js → index-DUJ1xtTH.js} +1 -1
- package/assets/{index-w4_5Aj8T.js → index-D_9ktFnA.js} +1 -1
- package/assets/{index-2Q-POj3l.js → index-Da5RB1ao.js} +3 -3
- package/assets/{index-I5rJvbQ1.js → index-JoEf73cu.js} +1 -1
- package/assets/{index-CXMHgbT-.js → index-OMuKDQLq.js} +1 -1
- package/assets/{index-DWj03ICg.js → index-QEVhfcrR.js} +1 -1
- package/assets/{index-OGdy2qbx.js → index-TX_SI4bj.js} +1 -1
- package/assets/{index-D2bdndwX.js → index-d5AxX01m.js} +1 -1
- package/assets/{index-DxFC7t5T.js → index-dYb3OXf6.js} +1 -1
- package/assets/{index-CwKIaxXt.js → index-j0SSsmJG.js} +1 -1
- package/assets/{index-Cl3G53Lb.js → index-la20cX_M.js} +1 -1
- package/assets/{index-DVl2fB76.js → index-mBFQiSSk.js} +1 -1
- package/assets/{index-D_jFC223.js → index-pMEYaZGt.js} +1 -1
- package/assets/{index-Aw0QE_Br.js → index-yXPrcU-1.js} +1 -1
- package/assets/{index.es-CMyspuf3.js → index.es-Bd7Dghdz.js} +4 -4
- package/assets/{index.es-CMAy1XDw.js → index.es-DrPv5UJQ.js} +1 -1
- package/assets/{index.es-DLt1eklQ.js → index.es-DzsFv3y6.js} +1 -1
- package/assets/{localBatchGatewayRequest-Da4arsJr.js → localBatchGatewayRequest-Bj_BmGnI.js} +1 -1
- package/assets/{mana-rate-BM11zYcS.js → mana-rate-Bk6GbQZ7.js} +1 -1
- package/assets/{networks-CP5ZxOS7.js → networks-BxLJhcz4.js} +1 -1
- package/assets/{onramp-DEaPwD93.js → onramp-AWbTXIV9.js} +1 -1
- package/assets/{openzeppelin-ubglQWTS.js → openzeppelin-DsZVJrq1.js} +1 -1
- package/assets/{parseNft-nhS1PzrY.js → parseNft-BJUzSvMQ.js} +2 -2
- package/assets/{parseSignature-DIaDPyGA.js → parseSignature-D2ko2_ob.js} +1 -1
- package/assets/{parseSignature-DtIw2rXo.js → parseSignature-DjUwOCUG.js} +3 -3
- package/assets/{passkeys-l4VrwtfF.js → passkeys-BzW5Rz11.js} +1 -1
- package/assets/{pay-with-exchange-yIOka8rX.js → pay-with-exchange-BqT2KU0O.js} +1 -1
- package/assets/{qr-overlay-BC6wsExf.js → qr-overlay-CGD8oCpG.js} +1 -1
- package/assets/{receive-DGr9WBJt.js → receive-ToeMRUUv.js} +1 -1
- package/assets/{resolveImplementation-CgWwbjqg.js → resolveImplementation-DRiYQ6Wf.js} +1 -1
- package/assets/{rpc-2WnfD84R.js → rpc-6bAZTgVk.js} +1 -1
- package/assets/{secp256k1-C3Ly2cZR.js → secp256k1-BGdSqHGh.js} +1 -1
- package/assets/{secp256k1-BzEjkNEy.js → secp256k1-UwopyXuA.js} +1 -1
- package/assets/{secp256k1-C2nawWfp.js → secp256k1-hyS3kDMb.js} +1 -1
- package/assets/{send-DaMmaBKd.js → send-CCDIsx5r.js} +1 -1
- package/assets/{send-batch-transaction-BJnHeeX4.js → send-batch-transaction-CQdBo1Am.js} +1 -1
- package/assets/{send-eip712-transaction-lGbfEAzA.js → send-eip712-transaction-CXwUHDAE.js} +2 -2
- package/assets/{send-gasless-transaction-GytT3EN0.js → send-gasless-transaction-iaB4_nx6.js} +2 -2
- package/assets/{send-transaction-wju-H3Cn.js → send-transaction-rT_eyDT5.js} +2 -2
- package/assets/{sendRawTransaction-B7gRnaFv.js → sendRawTransaction-HfEYbTdt.js} +3 -3
- package/assets/{serializeTransaction-K8-WLWnl.js → serializeTransaction-D22ScvKD.js} +1 -1
- package/assets/{session-proposal-eLNEKDfD.js → session-proposal-BT6RMaiZ.js} +1 -1
- package/assets/{session-request-D0qpm2ew.js → session-request-DaQtElCn.js} +2 -2
- package/assets/{signing-gBX9gJ32.js → signing-Co2eYofC.js} +3 -3
- package/assets/{socials-CD_j_07F.js → socials-caELEqC_.js} +1 -1
- package/assets/{swaps-Bzm1G8N4.js → swaps-BZn0-RZm.js} +1 -1
- package/assets/{thirdweb-DCMx7j1D.js → thirdweb-FfEzrcIo.js} +3 -3
- package/assets/{to-serializable-transaction-BZAI7BsG.js → to-serializable-transaction-BwcNTEo7.js} +2 -2
- package/assets/{trade-encoding-2LKm-Goy.js → trade-encoding-BozR-TuN.js} +1 -1
- package/assets/{transactionReceipt-CRyPQK5a.js → transactionReceipt-C2mDr5G0.js} +1 -1
- package/assets/{transactions-I7lCf2CM.js → transactions-CixHndKe.js} +1 -1
- package/assets/{useCreditPacks-DYrmYjK5.js → useCreditPacks-DAQD0des.js} +1 -1
- package/assets/{useInfiniteGrid-CDzsfZBu.js → useInfiniteGrid-Bwx1Qc9o.js} +1 -1
- package/assets/useManaRate-Dte3sZ4h.js +1 -0
- package/assets/{useStore-D1gCXOP_.js → useStore-CFq-Fftn.js} +1 -1
- package/assets/useTheme-5pltrVRq.js +1 -0
- package/assets/{useTheme-CUwz5NUH.js → useTheme-CppNw7QX.js} +1 -1
- package/assets/{verifyHash-DGsbtWAk.js → verifyHash-Ba0SXO6H.js} +1 -1
- package/assets/{w3m-modal-DJ_LdfUD.js → w3m-modal-DmRzgs0L.js} +1 -1
- package/assets/{w3m-modal-C4axQEqk.js → w3m-modal-DpI9W7-o.js} +1 -1
- package/assets/{wait-for-tx-receipt-JPXzoKCu.js → wait-for-tx-receipt-Cx54WhPM.js} +1 -1
- package/assets/{wallets-CkR7yrP_.js → wallets-Da_nPQ9j.js} +5 -5
- package/assets/{web-connector-HjRYE3VT.js → web-connector-CFmx1R_l.js} +3 -3
- package/assets/{writeContract-DSPOgOMV.js → writeContract-DoNvXgqB.js} +1 -1
- package/assets/{zoraTestnet-2TguyOvD.js → zoraTestnet-CAbW3YGF.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/assets/useManaRate-BEdT5IGm.js +0 -1
- package/assets/useTheme-hvTZJoGa.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as Q,j as e,L as $}from"./react-C51i12iP.js";import{s as o,F as a,N as V,B as X,m as Z,t as c,u as J,I as h,af as Y,ag as tt,C as m,o as w,ah as et,ai as it}from"./index-
|
|
1
|
+
import{r as Q,j as e,L as $}from"./react-C51i12iP.js";import{s as o,F as a,N as V,B as X,m as Z,t as c,u as J,I as h,af as Y,ag as tt,C as m,o as w,ah as et,ai as it}from"./index-BuIf8bJO.js";import{a as st}from"./mana-rate-Bk6GbQZ7.js";import{u as nt}from"./useManaRate-Dte3sZ4h.js";import{L as at}from"./LoadMore-DAqU2FKL.js";import{u as b}from"./useInfiniteGrid-Bwx1Qc9o.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";const rt=15e3;function ot(t,i){return t.txHash&&i.txHash?t.txHash===i.txHash:t.txHash||i.txHash?!1:t.status===i.status&&Math.abs(t.createdAt-i.createdAt)<=rt}function ct(t){const i=[...t].sort((s,n)=>n.createdAt-s.createdAt),d=[];for(const s of i){const n=d[d.length-1];n&&ot(n[n.length-1],s)?n.push(s):d.push([s])}return d.map(s=>{var n;return{id:((n=s.find(r=>r.txHash))==null?void 0:n.txHash)??s[s.length-1].id,createdAt:Math.max(...s.map(r=>r.createdAt)),status:s.some(r=>r.status==="PENDING")?"PENDING":"SETTLED",totalCredits:s.reduce((r,u)=>r+u.credits,0),lines:s}})}function dt(t){const i=[],d=new Map;for(const s of t)if(s.tradeId){const n=d.get(s.tradeId);if(n){n.quantity+=1,n.credits+=s.credits;continue}const r={key:s.tradeId,tradeId:s.tradeId,quantity:1,credits:s.credits};d.set(s.tradeId,r),i.push(r)}else i.push({key:s.id,tradeId:null,quantity:1,credits:s.credits});return i}function lt(t,i){return{id:t.id,contractAddress:t.contractAddress,tokenId:t.tokenId,itemId:t.itemId,counterparty:t.buyer,credits:i?st(t.manaWei,i):null,createdAt:t.createdAt}}function ut(t){const d=ct(t.purchases.filter(n=>n.status!=="EXPIRED")).map(n=>({kind:"purchase",id:`purchase:${n.id}`,createdAt:n.createdAt,order:n})),s=t.sales.map(n=>{const r=lt(n,t.rate);return{kind:"sale",id:`sale:${r.id}`,createdAt:r.createdAt,sale:r}});return[...d,...s].sort((n,r)=>r.createdAt-n.createdAt||(n.id<r.id?-1:1))}function pt(t,i){if(i==="all")return t;const d=i==="purchases"?"purchase":"sale";return t.filter(s=>s.kind===d)}const g=V`
|
|
2
2
|
0% { background-position: 200% 0; }
|
|
3
3
|
100% { background-position: -200% 0; }
|
|
4
4
|
`,xt=o.section`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,j as v}from"./react-C51i12iP.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-
|
|
1
|
+
import{r as l,j as v}from"./react-C51i12iP.js";const w="https://cdn.decentraland.org/@dcl/shop/0.1.0-29998165954.commit-94f27c7/assets/custom-welcome-background-BxlFQma9.webp",S="https://cdn.decentraland.org/@dcl/shop/0.1.0-29998165954.commit-94f27c7/assets/DCL_LogoPattern-BryBPc3d.png",U=`
|
|
2
2
|
attribute vec2 a_position;
|
|
3
3
|
varying vec2 v_uv;
|
|
4
4
|
void main() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as Ze,r as p,j as e,b as Je}from"./react-C51i12iP.js";import{p as W,h as Xe,c as Ye,M as et,s,F as t,u as oe,a as tt,b as Ne,x as _e,v as nt,t as o,I as N,C as F,d as he,j as D,k as st,l as ot,m as Ae,G as rt,A as Q,ax as it,ay as at}from"./index-
|
|
1
|
+
import{u as Ze,r as p,j as e,b as Je}from"./react-C51i12iP.js";import{p as W,h as Xe,c as Ye,M as et,s,F as t,u as oe,a as tt,b as Ne,x as _e,v as nt,t as o,I as N,C as F,d as he,j as D,k as st,l as ot,m as Ae,G as rt,A as Q,ax as it,ay as at}from"./index-BuIf8bJO.js";import{r as lt,m as ct,a as Pe}from"./mana-rate-Bk6GbQZ7.js";import{u as Me}from"./useManaRate-Dte3sZ4h.js";import{g as dt,h as ft,i as pt,j as ut,k as xt,C as ht,l as mt,o as gt,m as bt,n as yt,M as wt}from"./Assets.styles-Btwb1rti.js";import{d as me,R as jt,F as vt,S as ge,b as $t}from"./categories-C9Gq6j7d.js";import{L as Ct}from"./LoadMore-DAqU2FKL.js";import{M as kt}from"./MarketCheckout-DuLpUtl6.js";import{u as St}from"./useInfiniteGrid-Bwx1Qc9o.js";import{E as Rt}from"./ErrorNotice-C7soUjRV.js";import{d as It}from"./dcl-schemas-BICTSpB5.js";import{u as Et,G as Tt,w as zt,S as Nt}from"./buy-gasless-DN1sOd1A.js";import{s as _t}from"./buy-Cf4D1sNV.js";import{h as At}from"./trade-encoding-BozR-TuN.js";import{f as Pt}from"./errors-B_GO1NZB.js";import{J as Mt,C as Lt,B as se}from"./ethers-w5dOkonM.js";import{l as Bt}from"./loader-logo-BzY9EKdC.js";import{n as Ft}from"./emotion-CSxEP8yM.js";import"./sentry-DKBoGDXH.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./Tooltip-DMu4FyD0.js";import"./authorizations-HxyvVTVD.js";import"./sendMetaTransaction-CiO3jI6F.js";function Z(n){const r=n.source??"item",f=n.tradeId||`${n.contractAddress}-${n.tokenId??n.itemId??""}`;return`${r}:${f}`}const H="100000000000000000000",Le=2,V=15,Wt=/^[a-zA-Z0-9]+$/;function be(n){const r=n.trim();return r.length===0?{ok:!1,reason:"empty"}:Wt.test(r)?r.length<Le?{ok:!1,reason:"too-short"}:r.length>V?{ok:!1,reason:"too-long"}:{ok:!0}:{ok:!1,reason:"invalid-chars"}}function Ht(n){return n.replace(/[^a-zA-Z0-9]/g,"").slice(0,V)}const Ot=["function available(string _subdomain) view returns (bool)"],ye={mainnet:{rpc:"https://rpc.decentraland.org/mainnet",address:"0x2a187453064356c898cae034eaed119e1663acb8"},sepolia:{rpc:"https://rpc.decentraland.org/sepolia",address:"0x7518456ae93eb98f3e64571b689c626616bb7f30"}};function Ut(){return W.chainId===It.ChainId.MATIC_MAINNET?ye.mainnet:ye.sepolia}async function Gt(n,r={}){var d;const{rpc:f,address:u}=Ut(),h=new Mt(f),l=new Lt(u,Ot,h);console.info(`[names] availability check → DCLRegistrar(${u}).available("${n}") on ${f}`);const c=await l.available(n);if((d=r.signal)!=null&&d.aborted)throw new DOMException("Aborted","AbortError");return console.info(`[names] "${n}" available=${c}`),c?"available":"taken"}const qt="https://app.across.to/api";class Be extends Error{constructor(){super("Name registration is temporarily unavailable due to high network costs"),this.name="NameRouteCostTooHighError"}}function Dt(n){return ct(H,n)}async function Vt(n,r,f={}){var d;const u=f.chainId??W.chainId,h=f.provider??"across",l=`${W.creditsServerUrl}/credits-name-route?name=${encodeURIComponent(r)}&chainId=${u}&provider=${h}`,c=await et(l,{method:"GET",identity:n,metadata:{}});if(!c.ok){let a;try{a=(d=await c.json())==null?void 0:d.code}catch{}throw a==="ROUTE_COST_TOO_HIGH"?new Be:new Error(`fetchNameCreditRoute ${c.status}`)}return c.json()}function Kt(n,r){const f=se.from(n.availableAmount),h=se.from(H).sub(f);return{credits:[{value:n.amount,expiresAt:Number(n.expiresAt),salt:At(n.id)}],creditsSignatures:[n.signature],externalCall:{target:r.externalCall.target,selector:r.externalCall.selector,data:r.externalCall.data,expiresAt:r.externalCall.expiresAt,salt:r.externalCall.salt},customExternalCallSignature:r.customExternalCallSignature,maxUncreditedValue:h.isNegative()?"0":h.toString(),maxCreditedValue:H}}async function Qt(n,r={}){const f=qt,u=r.intervalMs??1e4,h=r.maxAttempts??60;let l={status:"pending",destinationTxHash:null,actionsSucceeded:!1};for(let c=0;c<h;c++){try{const d=await fetch(`${f}/deposit/status?originChainId=137&depositTxHash=${n}`);if(d.ok){const a=await d.json(),x=(a.status??"pending").toLowerCase(),m=a.fillTx??a.fillTxnRef??null,w=a.actionsSucceeded!==!1;if(x==="filled")return{status:"filled",destinationTxHash:m,actionsSucceeded:w};if(x==="refunded"||x==="expired")return{status:x,destinationTxHash:null,actionsSucceeded:!1};l={status:"pending",destinationTxHash:m,actionsSucceeded:w}}}catch{}c<h-1&&await new Promise(d=>setTimeout(d,u))}return l}async function Zt(n){const{name:r,identity:f,signer:u}=n,h=n.chainId??W.chainId,l=n.provider??"across",c=(n.beneficiary??await u.getAddress()).toLowerCase();let d=null,a=!1;console.info("[names] register start",{name:r,buyer:c,chainId:h,provider:l});try{const x=await lt(h),m=Dt(x);console.info("[names] step 1/6 sized reservation",{usdCents:m,manaRate:x});const w=await Vt(f,r,{chainId:h,provider:l});console.info("[names] step 2/6 route fetched",{target:w.externalCall.target,selector:w.externalCall.selector,provider:w.provider,quoteId:w.quoteId});const v=await Xe(f,m);if(d=v.credit.id,console.info("[names] step 3/6 credit authorized",{creditId:v.credit.id,maxCreditedValue:v.maxCreditedValue}),se.from(v.maxCreditedValue).lt(H))throw new Error("Credit under-sized for the name price");const k=Kt(v.credit,w);let g;try{g=await Et({chainId:h,buyer:c,signer:u,args:k})}catch(y){if(!(y instanceof Tt))throw y;g=await _t(h,k,u)}if(console.info("[names] step 4/6 useCredits submitted (Polygon origin tx)",{originTxHash:g}),await zt(g),a=!0,console.info("[names] step 5/6 origin tx confirmed",{originTxHash:g}),l==="across"){const y=await Qt(g,n.acrossPoll);if(console.info("[names] step 6/6 across status",y),y.status==="pending")return{status:"pending",originTxHash:g};if(y.status!=="filled"||!y.actionsSucceeded)throw new Error("The name could not be registered on Ethereum; your funds were recovered.");return{status:"registered",originTxHash:g,destinationTxHash:y.destinationTxHash}}return{status:"pending",originTxHash:g}}catch(x){if(console.error("[names] register failed — raw error:",x,{name:r,buyer:c,originConfirmed:a}),x instanceof Nt)return{status:"pending",originTxHash:x.txHash};throw d&&!a&&await Ye(f,[d]).catch(()=>{}),x instanceof Be?x:new Error(Pt(x,"Couldn't register the name. Please try again.",{sale:!0}))}}const Jt=s.div`
|
|
2
2
|
position: fixed;
|
|
3
3
|
inset: 0;
|
|
4
4
|
z-index: 10000;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as y,j as t}from"./react-C51i12iP.js";import{R as z,a as oe,C as ie,c as ne}from"./categories-
|
|
1
|
+
import{r as y,j as t}from"./react-C51i12iP.js";import{R as z,a as oe,C as ie,c as ne}from"./categories-C9Gq6j7d.js";import{T as se}from"./Tooltip-DMu4FyD0.js";import{F as e,s as o,I as m,t as s,G as re,e as v}from"./index-BuIf8bJO.js";import{n as c}from"./emotion-CSxEP8yM.js";const ae=o.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 12px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t,L,r as N}from"./react-C51i12iP.js";import{s,B as q,F as e,N as B,m as D,t as i,u as F,v as G,I as m,C as H,o as I,b as Q,p as K,J as z,E as M,H as j}from"./index-
|
|
1
|
+
import{j as t,L,r as N}from"./react-C51i12iP.js";import{s,B as q,F as e,N as B,m as D,t as i,u as F,v as G,I as m,C as H,o as I,b as Q,p as K,J as z,E as M,H as j}from"./index-BuIf8bJO.js";import{b as W,c as J,s as O,d as P}from"./authorizations-HxyvVTVD.js";import{f as X}from"./errors-B_GO1NZB.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";const U=B`
|
|
2
2
|
to { transform: rotate(360deg); }
|
|
3
3
|
`,V=s.section`
|
|
4
4
|
width: 100%;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as e,r as h,u as qe,a as Fe,L as te}from"./react-C51i12iP.js";import{t,C as q,x as V,m as Ae,ad as v,n as me,u as Be,o as Le,a as Ue,b as We,I as T,w as $e,v as ze,j as D,aj as _e,ak as Ke,E as W,s as Qe,B as Oe,e as Ge,h as He,c as ye,al as De,l as pe,k as Je,am as Ve}from"./index-
|
|
1
|
+
import{j as e,r as h,u as qe,a as Fe,L as te}from"./react-C51i12iP.js";import{t,C as q,x as V,m as Ae,ad as v,n as me,u as Be,o as Le,a as Ue,b as We,I as T,w as $e,v as ze,j as D,aj as _e,ak as Ke,E as W,s as Qe,B as Oe,e as Ge,h as He,c as ye,al as De,l as pe,k as Je,am as Ve}from"./index-BuIf8bJO.js";import{W as Ye,C as Xe,t as Ze,a as es,s as be}from"./CollectionCarousel-qqanrG2T.js";import{a as ge}from"./buy-Cf4D1sNV.js";import{a as ss,w as ts,S as as,G as cs}from"./buy-gasless-DN1sOd1A.js";import{R as J,r as rs}from"./cart-checkout-r4Liry5X.js";import{g as ns}from"./authorizations-HxyvVTVD.js";import{u as is,M as ls,c as os}from"./useCreditPacks-DAQD0des.js";import{l as ds}from"./loader-logo-BzY9EKdC.js";import{i as us,a as hs}from"./errors-B_GO1NZB.js";import{E as ms}from"./ErrorNotice-C7soUjRV.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./address-DrURAr9O.js";import"./trade-encoding-BozR-TuN.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";const _s="https://cdn.decentraland.org/@dcl/shop/0.1.0-29998165954.commit-94f27c7/assets/buy-error-22UunaPC.png";function ys(c){const{phase:n,balanceCredits:u,onClose:m}=c,N=n==="processing",w=n==="error"?t("cartCheckout.errorTitle"):n==="nofunds"?t("cartCheckout.titleNoFunds"):t("cartCheckout.titleBuy"),S=n==="processing";return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":t("cartCheckout.dialogAria"),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:N?void 0:m,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${S?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:w}),!N&&e.jsx("button",{className:"buy-modal__x",onClick:m,"aria-label":t("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:n==="nofunds"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(q,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:V(u)})]})]}),n==="processing"&&e.jsx(ps,{stage:c.stage??"reserving",step:c.step??1,total:c.total??1,isSelfCustody:!!c.isSelfCustody}),n==="nofunds"&&e.jsx(bs,{lines:c.lines??[],shortfallCredits:c.shortfallCredits??0,packs:c.packs??[],selectedPack:c.selectedPack??"",onSelectPack:c.onSelectPack??(()=>{}),onBuyPacks:c.onBuyPacks??(()=>{}),onCancel:m}),n==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-error",children:[e.jsx("img",{className:"buy-error__art",src:_s,alt:"",width:64,height:80}),e.jsxs("p",{className:"buy-error__text",children:[e.jsx("b",{children:t("cartCheckout.errorHeadline")})," ",t("cartCheckout.errorBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:m,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--purple",onClick:c.onRetry??m,children:t("cartCheckout.tryAgain")})]})]})]})]})}function ps({stage:c,step:n,total:u,isSelfCustody:m}){const N=c==="reserving",w=u>0?Math.min(100,Math.round(n/u*100)):0,S=c==="awaiting-signature"?m?t("buyModal.confirmToContinue"):t("buyModal.completingTransaction"):c==="settling"?t("buyModal.completingTransaction"):t("cartCheckout.preparing");return e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:ds,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:S}),N?e.jsxs("div",{className:"cart-checkout__progress-row",children:[e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill buy-modal__progress-fill--step",style:{width:`${w}%`}})}),u>1?e.jsxs("span",{className:"cart-checkout__step",children:[n,"/",u]}):null]}):e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]})}function bs({lines:c,shortfallCredits:n,packs:u,selectedPack:m,onSelectPack:N,onBuyPacks:w,onCancel:S}){const C=u.find(a=>a.id===m),Y=c.reduce((a,g)=>a+(g.quantity??1),0);return e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(Ye,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:t("buyModal.insufficientFunds")})," ",t("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:t("buyModal.warningCreditsAmount",{count:Math.max(0,n)})})," ",t("buyModal.warningToPurchase",{count:Y})]})]}),e.jsx("div",{className:"cart-checkout__scroll",children:c.map(a=>{const g=a.quantity??1;return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:a.item.thumbnail?e.jsx("img",{src:a.item.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsxs("div",{className:"buy-modal__asset-name",title:a.item.name,children:[a.item.name||t("buyModal.itemFallback"),g>1?e.jsx("span",{className:"cart-checkout__qty-tag",children:t("cartCheckout.qty",{count:g})}):null]}),a.item.creator?e.jsx(Xe,{address:a.item.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(q,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:V(a.priceCredits*g)})]})]})]},a.item.id)})}),e.jsx("div",{className:"buy-modal__packs",children:u.map(a=>{const g=a.id===m;return e.jsxs("button",{className:`buy-modal__pack${g?" buy-modal__pack--on":""}`,onClick:()=>N(a.id),children:[e.jsx(q,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:V(a.credits)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",a.usd.toFixed(2),")"]})]},a.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(q,{className:"buy-modal__total-ico"}),e.jsx("span",{children:V((C==null?void 0:C.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",((C==null?void 0:C.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:S,children:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:w,children:t("buyModal.buy")})]})]})}const gs=Qe(Oe)`
|
|
2
2
|
margin-top: 12px;
|
|
3
3
|
`;function fe(c){if(us(c))return t("errors.rejected");const n=(c.message??"").toLowerCase();return n.includes("insufficient")?t("cart.error.insufficient",{currency:Ge.name}):n.includes("no active listing")||n.includes("your own listing")?t("cart.error.listingChanged"):t("marketCheckout.error.generic")}const fs=12e4;function xs(c){const n=[];return c.unavailable.length&&n.push(t("cart.drop.unavailable",{count:c.unavailable.length})),c.own.length&&n.push(t("cart.drop.own",{count:c.own.length})),t("cart.drop.removed",{items:n.join(` ${t("cart.drop.and")} `)})}const xe=c=>c.reduce((n,u)=>n+u.priceCredits*u.quantity,0),ks=c=>c.flatMap(n=>Array.from({length:n.quantity},()=>({...n,quantity:1})));function $s(){Ae({title:t("nav.cart"),noindex:!0});const c=v(s=>s.items),n=v(s=>s.remove),u=v(s=>s.increment),m=v(s=>s.decrement),N=v(s=>s.clear),w=v(s=>s.restore),S=v(s=>s.setFittingOpen),C=me(s=>s.items),Y=me(s=>s.toggle),{session:a,signIn:g}=Be(),$=is().packs.slice(0,ls);h.useEffect(()=>(document.body.classList.add("shop-cart-bg"),()=>document.body.classList.remove("shop-cart-bg")),[]);const ke=c.some(s=>s.category!=="emote"),{data:X}=Le({queryKey:["upsell-listings"],queryFn:()=>Ve({first:40}),staleTime:6e4}),{data:F}=Ue(a),z=We(),K=qe(),{state:M}=Fe(),[ae,A]=h.useState(null),[je,B]=h.useState(null),[ce,Q]=h.useState(null),[ve,E]=h.useState(!1),[f,L]=h.useState(null),re=h.useRef(0),[o,k]=h.useState(null),[Z,ne]=h.useState(""),ee=h.useRef(null),Ne=c.reduce((s,r)=>s+r.priceCredits*r.quantity,0),ie=c.reduce((s,r)=>s+r.quantity,0),Ce=f?f.liveTotalCredits:Ne,we=new Set(c.map(s=>s.id)),le=((X==null?void 0:X.items)??[]).filter(s=>!we.has(s.id)).slice(0,12),Se=new Map(f==null?void 0:f.buyable.map(s=>[s.item.id,s])),O=(F==null?void 0:F.credits)??0,Me=Ke;function G(s){s(),L(null),Q(null),B(null)}function Ee(){k(null),E(!1)}function oe(s){const r=xe(s),i=Math.max(0,r-O),y=$.find(d=>d.credits>=i)??$[$.length-1];ne(y.id),D("Shop Buy Credits Prompted",{from:"cart_checkout",credits_needed:r,credits_balance:O,shortfall:i}),k({phase:"nofunds",lines:s.map(d=>({item:d.item,priceCredits:d.priceCredits,quantity:d.quantity})),shortfall:i}),E(!1)}async function Ie(s){if(!a||s.length===0)return;const r=ks(s),i=r.map(l=>({...l.item,priceCredits:l.priceCredits})),y=s.map(l=>({...l.item,priceCredits:l.priceCredits,quantity:l.quantity})),d=[];let j="authorize",H=!1;k({phase:"processing",stage:"reserving",step:1,total:r.length});try{const l=[];for(let x=0;x<r.length;x++){const R=r[x];k({phase:"processing",stage:"reserving",step:x+1,total:r.length});try{const{credit:_,maxCreditedValue:se}=await He(a.identity,R.usdCents,R.trade.id);d.push(_.id),l.push({trade:R.trade,credits:[_],maxCreditedValue:se})}catch(_){if(hs(_)){if(d.length){try{await ye(a.identity,d)}catch(se){W(se,{flow:"cart_checkout",step:"release"})}z.invalidateQueries({queryKey:["usd-balance"]})}oe(s);return}throw _}}j="submit";const p=()=>k({phase:"processing",stage:"settling",step:r.length,total:r.length});k({phase:"processing",stage:"awaiting-signature",step:r.length,total:r.length});let b=[];if(ns())try{b=await ss({purchases:l,buyer:a.address,signer:a.signer,onSigned:p});const R=(await Promise.allSettled(b.map(_=>ts(_)))).flatMap(_=>_.status==="rejected"?[_.reason]:[]);if(R.length&&!R.some(_=>_ instanceof as))throw R[0];H=!0}catch(x){if(!(x instanceof cs))throw x;b=await ge({purchases:l,buyer:a.address,signer:a.signer,onSigned:p})}else b=await ge({purchases:l,buyer:a.address,signer:a.signer});s.forEach(x=>n(x.item.id)),L(null),D("Shop Completed Purchase",{...De(i),payment_type:"credits",no_crypto_step:H,transaction_hash:b[0]??null}),z.invalidateQueries({queryKey:["usd-balance"]});const P=ee.current;ee.current=null,k(null),E(!1);const Te={items:y,txHash:b[0]??void 0,settled:!0,...P?{creditsAdded:P}:{}};K("/success",{state:Te,replace:!0})}catch(l){if(pe(l)||W(l,{flow:"cart_checkout",step:j,cart_size:s.length}),D(pe(l)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:j,error_code:Je(l),value_usd:_e(i.reduce((p,b)=>p+b.priceCredits,0)),cart_size:r.length}),d.length){try{await ye(a.identity,d)}catch(p){W(p,{flow:"cart_checkout",step:"release"})}z.invalidateQueries({queryKey:["usd-balance"]})}k({phase:"error",message:fe(l)})}}function de(s){const r=xe(s);if(F!=null&&F.credits<r){oe(s);return}Ie(s)}async function U(){if(!a){be({type:"cart-checkout"}),g();return}const s=v.getState().items;if(s.length===0)return;B(null),Q(null),E(!0);const r=s.reduce((i,y)=>i+y.priceCredits*y.quantity,0);D("Shop Started Checkout",{cart_size:s.length,cart_value_credits:r,cart_value_usd:_e(r),has_sufficient_credits:O>=r});try{A(t("cart.status.reviewing"));const i=await rs(s,a.address,Me),y=[...i.unavailable,...i.own];if(y.length&&(y.forEach(d=>n(d.id)),Q(xs(i))),i.buyable.length===0){B(t("cart.error.noneAvailable")),L(null),A(null);return}if(i.orderChanged){L(i),re.current=Date.now(),A(null);return}A(null),de(i.buyable)}catch(i){W(i,{flow:"cart_checkout",step:"review",cart_size:s.length}),B(fe(i)),A(null)}finally{E(!1)}}async function Pe(){if(f){if(!a){be({type:"cart-checkout"}),g();return}if(Date.now()-re.current>fs){L(null),Q(null),await U();return}B(null),de(f.buyable)}}async function Re(){if(Z){try{sessionStorage.setItem(J,JSON.stringify(v.getState().items))}catch{}E(!0);try{const s=await os(Z,a?{address:a.address,identity:a.identity}:void 0);if(s.url){window.location.href=s.url;return}K("/credits")}catch(s){try{sessionStorage.removeItem(J)}catch{}W(s,{flow:"cart_buy_credits"}),k({phase:"error",message:t("buyModal.error.creditsCheckout")})}finally{E(!1)}}}const ue=h.useRef(!1);h.useEffect(()=>{if(!a||ue.current||!Ze("cart-checkout"))return;ue.current=!0;const s=setTimeout(()=>void U(),0);return()=>clearTimeout(s)},[a]);const he=h.useRef(!1);h.useEffect(()=>{if(!(M!=null&&M.resumeCheckout)||he.current)return;he.current=!0,ee.current=M.creditsAdded??null;try{const r=sessionStorage.getItem(J);if(r){sessionStorage.removeItem(J);const i=JSON.parse(r);Array.isArray(i)&&i.length&&w(i)}}catch{}z.invalidateQueries({queryKey:["usd-balance"]});const s=setTimeout(()=>void U(),0);return()=>clearTimeout(s)},[M==null?void 0:M.resumeCheckout]);const I=ve||(o==null?void 0:o.phase)==="processing";return c.length===0&&!o?e.jsxs("div",{className:"cart cart--empty",children:[e.jsx(T,{name:"cart",size:44,color:"var(--muted-2)"}),e.jsx("p",{className:"cart-empty__title",children:t("cart.empty.title")}),e.jsx("p",{className:"muted",children:t("cart.empty.body")}),e.jsx(gs,{as:te,to:"/assets",variant:"purple",children:t("cart.empty.cta")})]}):e.jsxs("div",{className:"checkout",children:[e.jsxs("div",{className:"checkout__top",children:[e.jsxs("button",{className:"checkout__back",onClick:()=>K(-1),type:"button",children:[e.jsx(T,{name:"arrow-left"}),t("nav.cart")]}),e.jsxs("div",{className:"checkout__body",children:[e.jsxs("div",{className:"checkout__left",children:[e.jsxs("div",{className:"checkout__head-card",children:[e.jsx("button",{className:"checkout__panel-back",onClick:()=>K(-1),type:"button","aria-label":t("cart.goBack"),children:e.jsx(T,{name:"arrow-left"})}),e.jsx("h1",{className:"checkout__panel-title",children:t("cart.panelTitle",{count:ie})}),ke?e.jsxs("button",{className:"checkout__fitting",onClick:()=>S(!0),disabled:I,children:[e.jsx(T,{name:"fitting-room"}),t("cart.fittingRoom")]}):null]}),e.jsxs("section",{className:"checkout__panel",children:[e.jsx("div",{className:"checkout__list",children:c.map(s=>{const r=Se.get(s.id),i=r?r.priceCredits:s.priceCredits,y=!!r&&r.priceCredits!==s.priceCredits,d=!s.tokenId,j=s.quantity,H=typeof s.available=="number"&&j>=s.available,l=i*j,p=!!C[s.id],b=s.tokenId??s.itemId,P=s.contractAddress&&b?`/item/${s.contractAddress}/${b}`:null;return e.jsxs("div",{className:"checkout__card",children:[e.jsxs("div",{className:"checkout__thumb",children:[P?e.jsx(te,{className:"checkout__thumb-link",to:P,state:{item:s,tradeId:s.tradeId},"aria-label":s.name,children:s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null}):s.thumbnail?e.jsx("img",{src:s.thumbnail,alt:s.name}):null,e.jsx("span",{className:"checkout__thumb-check","aria-hidden":!0,children:e.jsx("svg",{viewBox:"0 0 20 20",width:"12",height:"12",children:e.jsx("path",{d:"M5 10.5l3 3 7-7.5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})})})]}),e.jsxs("div",{className:"checkout__info",children:[e.jsxs("div",{className:"checkout__desc",children:[P?e.jsx(te,{className:"checkout__name",to:P,state:{item:s,tradeId:s.tradeId},title:s.name,children:s.name}):e.jsx("div",{className:"checkout__name",title:s.name,children:s.name}),s.creator?e.jsx($e,{address:s.creator,className:"checkout__creator",linkToProfile:!0}):null]}),e.jsxs("div",{className:"checkout__foot",children:[d?e.jsxs("div",{className:"checkout__stepper",children:[e.jsx("button",{className:"checkout__step",onClick:()=>G(()=>m(s.id)),disabled:I||j<=1,"aria-label":t("cart.decreaseQuantity",{name:s.name}),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}),e.jsx("span",{className:"checkout__qty",children:j}),e.jsx("button",{className:"checkout__step",onClick:()=>G(()=>u(s.id)),disabled:I||H,"aria-label":t("cart.increaseQuantity"),children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,focusable:"false",children:e.jsx("path",{d:"M8 3.5v9M3.5 8h9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null,e.jsxs("div",{className:"checkout__price",children:[e.jsx(q,{className:"checkout__price-ico"})," ",l,y?e.jsx("span",{className:"checkout__price-was",children:s.priceCredits*j}):null]})]})]}),e.jsxs("div",{className:"checkout__actions",children:[e.jsx("button",{className:`checkout__fav${p?" is-on":""}`,onClick:()=>Y(s),"aria-label":p?t("cart.removeFromFavorites",{name:s.name}):t("cart.addToFavorites",{name:s.name}),title:p?t("assetCard.removeFromFavorites"):t("assetCard.addToFavorites"),children:e.jsx(T,{name:p?"heart-solid":"heart"})}),e.jsx("button",{className:"checkout__remove",onClick:()=>G(()=>n(s.id)),disabled:I,"aria-label":t("cart.remove",{name:s.name}),title:t("cart.removeTitle"),children:e.jsx(T,{name:"trash",size:24})})]})]},s.id)})}),e.jsx("div",{className:"checkout__utils",children:e.jsx("button",{className:"link",onClick:()=>G(N),disabled:I,children:t("cart.clearCart")})})]})]}),e.jsxs("aside",{className:"checkout__summary",children:[e.jsx("h2",{className:"checkout__summary-title",children:t("cart.purchaseSummary")}),e.jsxs("div",{className:"checkout__summary-body",children:[e.jsxs("div",{className:"checkout__total-line",children:[e.jsx("span",{className:"checkout__total-label",children:t("cart.totalItems",{count:ie})}),e.jsxs("span",{className:"checkout__total-value",children:[e.jsx(q,{className:"checkout__total-ico"})," ",Ce]})]}),e.jsx("button",{className:"checkout__cta",onClick:()=>void(f?Pe():U()),disabled:I,children:I?t("cart.working"):f?t("marketCheckout.confirmPurchase"):t("assetCard.buyNow")}),a?null:e.jsx("p",{className:"muted checkout__msg",children:t("cart.signInHint")}),f?e.jsx("p",{className:"muted checkout__msg",children:t("cart.priceChanged")}):null,ce?e.jsx("p",{className:"muted checkout__msg",children:ce}):null,ae?e.jsx("p",{className:"muted checkout__msg",children:ae}):null,e.jsx(ms,{message:je,className:"checkout__msg"})]})]})]})]}),le.length>0?e.jsx("div",{className:"cart-upsell",children:e.jsx(es,{title:t("cart.youMightAlsoLike"),items:le})}):null,o?e.jsx(ys,{phase:o.phase,balanceCredits:O,onClose:Ee,stage:o.phase==="processing"?o.stage:void 0,step:o.phase==="processing"?o.step:void 0,total:o.phase==="processing"?o.total:void 0,isSelfCustody:ze(a==null?void 0:a.providerType),lines:o.phase==="nofunds"?o.lines:void 0,shortfallCredits:o.phase==="nofunds"?o.shortfall:void 0,packs:$,selectedPack:Z,onSelectPack:ne,onBuyPacks:()=>void Re(),message:o.phase==="error"?o.message:void 0,onRetry:()=>void U()}):null]})}export{$s as Cart};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{O as N,P as U,Q as w,R as z,S as o,U as E,V as c,W as I,X as g,Y as D,N as R}from"./index-
|
|
1
|
+
import{O as N,P as U,Q as w,R as z,S as o,U as E,V as c,W as I,X as g,Y as D,N as R}from"./index-BuIf8bJO.js";import{r as W,j as v}from"./react-C51i12iP.js";function F(r){return N("MuiCircularProgress",r)}U("MuiCircularProgress",["root","determinate","indeterminate","colorPrimary","colorSecondary","svg","circle","circleDeterminate","circleIndeterminate","circleDisableShrink"]);const K=["className","color","disableShrink","size","style","thickness","value","variant"];let l=r=>r,P,S,b,$;const t=44,V=R(P||(P=l`
|
|
2
2
|
0% {
|
|
3
3
|
transform: rotate(0deg);
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,r as p,d as Q,u as Y}from"./react-C51i12iP.js";import{F as N,s as v,ap as Z,I as J,t,p as V,E as W,o as X,m as ee,A as ae,aq as te,e as re,ar as se}from"./index-
|
|
1
|
+
import{j as e,r as p,d as Q,u as Y}from"./react-C51i12iP.js";import{F as N,s as v,ap as Z,I as J,t,p as V,E as W,o as X,m as ee,A as ae,aq as te,e as re,ar as se}from"./index-BuIf8bJO.js";import{E as oe}from"./ErrorNotice-C7soUjRV.js";import{d as ie,g as ce,a as ne,A as le}from"./collection-BSoK3y5r.js";import{u as de}from"./useStore-CFq-Fftn.js";import{s as E}from"./address-DrURAr9O.js";import{d as F,a as me,F as pe,e as ue,S as R,b as ge}from"./categories-C9Gq6j7d.js";import{L as xe}from"./LoadMore-DAqU2FKL.js";import{u as he}from"./useInfiniteGrid-Bwx1Qc9o.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";const be=v.section`
|
|
2
2
|
position: relative;
|
|
3
3
|
border-radius: ${N.radius.card};
|
|
4
4
|
overflow: hidden;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,r as l}from"./react-C51i12iP.js";import{ap as C,G as N,t as i,I as E,as as x,A as S}from"./index-
|
|
1
|
+
import{j as e,r as l}from"./react-C51i12iP.js";import{ap as C,G as N,t as i,I as E,as as x,A as S}from"./index-BuIf8bJO.js";import{s as A}from"./address-DrURAr9O.js";const h="shop:resume_after_signin",I=900*1e3;function R(a){try{sessionStorage.setItem(h,JSON.stringify({...a,at:Date.now()}))}catch{}}function P(a){let o;try{o=sessionStorage.getItem(h)}catch{return null}if(!o)return null;try{sessionStorage.removeItem(h)}catch{}let r;try{r=JSON.parse(o)}catch{return null}return!r||r.type!==a||typeof r.at!="number"||Date.now()-r.at>I?null:r.type==="cart-checkout"?{type:"cart-checkout"}:{type:"item-buy",path:r.path}}function z({address:a,className:o}){const{data:r}=C(a),c=r!=null&&r.name?N(r.name):A(a);return e.jsx("div",{className:o,children:i("search.byCreator",{name:c})})}function B({className:a}){return e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:a,children:[e.jsx("circle",{cx:"12",cy:"12",r:"9",fill:"none",stroke:"#691fa9",strokeWidth:"1.8"}),e.jsx("path",{d:"M12 7v6",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"16.5",r:"1.1",fill:"#691fa9"})]})}function D({title:a,items:o,onViewAll:r}){const c=l.useRef(null),[d,g]=l.useState(1),[m,v]=l.useState(0),[j,k]=l.useState(!0),[w,y]=l.useState(!1),n=l.useCallback(()=>{const s=c.current;if(!s)return;const{scrollLeft:t,scrollWidth:_,clientWidth:u}=s,p=Math.max(1,Math.ceil(_/u));g(p),v(Math.min(p-1,Math.round(t/u))),k(t<=1),y(t+u>=_-1)},[]);if(l.useEffect(()=>{n();const s=c.current;if(s)return s.addEventListener("scroll",n,{passive:!0}),window.addEventListener("resize",n),()=>{s.removeEventListener("scroll",n),window.removeEventListener("resize",n)}},[n,o.length]),o.length===0)return null;function f(s){const t=c.current;t&&t.scrollBy({left:s*t.clientWidth,behavior:"smooth"})}function b(s){const t=c.current;t&&t.scrollTo({left:s*t.clientWidth,behavior:"smooth"})}return e.jsxs("section",{className:"collection-carousel",children:[e.jsxs("div",{className:"collection-carousel__head",children:[e.jsx("h2",{className:"collection-carousel__title",children:a}),r?e.jsxs("button",{className:"collection-carousel__viewall",onClick:r,children:[i("collectionCarousel.viewAll"),e.jsx(E,{name:"chevron-down",size:16,className:"collection-carousel__viewall-ico"})]}):null]}),e.jsxs("div",{className:"collection-carousel__viewport",children:[e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--left",onClick:()=>f(-1),"aria-label":i("collectionCarousel.scrollLeft"),disabled:j,children:e.jsx("img",{src:x,alt:"","aria-hidden":!0})}),e.jsx("div",{className:"collection-carousel__track",ref:c,children:o.map(s=>e.jsx(S,{item:s},s.id))}),e.jsx("button",{className:"collection-carousel__arrow collection-carousel__arrow--right",onClick:()=>f(1),"aria-label":i("collectionCarousel.scrollRight"),disabled:w,children:e.jsx("img",{src:x,alt:"","aria-hidden":!0})})]}),d>1?e.jsx("div",{className:"collection-carousel__dots","aria-label":i("collectionCarousel.pages"),children:Array.from({length:d}).map((s,t)=>e.jsx("button",{className:`collection-carousel__dot${t===m?" is-active":""}`,"aria-label":i("collectionCarousel.goToPage",{page:t+1}),"aria-current":t===m?"true":void 0,onClick:()=>b(t)},t))}):null]})}export{z as C,B as W,D as a,R as s,P as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as K,j as e,L as re,d as se,b as te,r as j}from"./react-C51i12iP.js";import{at as oe,au as ce,w as le,t as a,av as E,B as ne,ap as D,u as ie,I,p as de,m as me,A as ue,am as he,aw as ge,e as xe}from"./index-
|
|
1
|
+
import{u as K,j as e,L as re,d as se,b as te,r as j}from"./react-C51i12iP.js";import{at as oe,au as ce,w as le,t as a,av as E,B as ne,ap as D,u as ie,I,p as de,m as me,A as ue,am as he,aw as ge,e as xe}from"./index-BuIf8bJO.js";import{d as _e,g as pe,a as Ne,A as je}from"./collection-BSoK3y5r.js";import{u as be,L as fe}from"./useStore-CFq-Fftn.js";import{s as O}from"./address-DrURAr9O.js";import{d as $,a as ve,S as w,F as Ce,e as we,b as ke}from"./categories-C9Gq6j7d.js";import{L as B}from"./LoadMore-DAqU2FKL.js";import{u as R}from"./useInfiniteGrid-Bwx1Qc9o.js";import{E as T}from"./ErrorNotice-C7soUjRV.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./emotion-CSxEP8yM.js";function Pe({collection:t,cover:r,itemCount:o}){const n=K(),{contractAddress:m,name:g,creator:x}=t,N=r==null||o==null,{data:i}=oe(m,N),p=r==null?(i==null?void 0:i.items)??[]:[],h=o??(i==null?void 0:i.total);function _(){n(`/collection/${m}`)}return e.jsxs("article",{className:"coll-card",role:"link",tabIndex:0,onClick:_,onKeyDown:d=>{(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),_())},children:[e.jsx("div",{className:"coll-card__media",children:r?e.jsx("img",{className:"coll-card__img","data-testid":"coll-card-img",src:r,alt:"",loading:"lazy"}):p.length>0?e.jsx(ce,{items:p,className:"coll-card__cover"}):null}),e.jsxs("div",{className:"coll-card__body",children:[e.jsx("h3",{className:"coll-card__name",title:g,children:g}),e.jsxs("div",{className:"coll-card__meta",children:[x?e.jsx(le,{address:x,className:"coll-card__creator",linkToProfile:!0}):e.jsx("span",{className:"coll-card__creator",children:" "}),e.jsx("span",{className:"coll-card__count",children:h==null?"…":a("collectionCard.itemCount",{count:h})})]}),e.jsx("button",{className:"coll-card__view",onClick:d=>{d.stopPropagation(),_()},tabIndex:-1,children:a("collectionCard.viewCollection")})]})]})}function Se({address:t,className:r=""}){const o=E(m=>m.followed.includes(t.toLowerCase())),n=E(m=>m.toggle);return t?e.jsx(ne,{type:"button",size:"sm",variant:o?"ghost":"outline",className:r||void 0,"aria-pressed":o,title:o?a("creator.unfollowTitle"):a("creator.followTitle"),onClick:()=>n(t),children:o?a("creator.following"):a("creator.follow")}):null}const ye={website:"website",twitter:"twitter",discord:"discord",facebook:"facebook"};function Le({address:t}){var d,b;const{data:r}=D(t),{data:o}=be(t),n=ie(l=>{var f;return(f=l.session)==null?void 0:f.address}),m=!!n&&n.toLowerCase()===t.toLowerCase(),g=(r==null?void 0:r.name)||O(t),x=(b=(d=r==null?void 0:r.avatar)==null?void 0:d.snapshots)==null?void 0:b.face256,N=(o==null?void 0:o.cover)||_e,i=o==null?void 0:o.description,p=`${de.profileUrl}/${t}`,h=fe.filter(l=>o==null?void 0:o.links[l]),_=pe(Ne({name:r==null?void 0:r.name,hasClaimedName:r==null?void 0:r.hasClaimedName,ethAddress:(r==null?void 0:r.ethAddress)??t}));return e.jsxs("section",{className:"creator-hero","aria-label":`${g} storefront`,children:[e.jsxs("div",{className:"creator-hero__cover",children:[e.jsx("img",{className:"creator-hero__cover-img",src:N,alt:"",loading:"eager"}),e.jsx("div",{className:"creator-hero__scrim","aria-hidden":!0})]}),(h.length>0||m)&&e.jsxs("div",{className:"creator-hero__links",children:[h.map(l=>e.jsx("a",{className:"creator-hero__link","data-testid":"creator-hero-link",href:(o==null?void 0:o.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:a(`creator.link.${l}`),"aria-label":a(`creator.link.${l}`),children:e.jsx(I,{name:ye[l]})},l)),m&&e.jsx(re,{className:"creator-hero__link creator-hero__edit",to:"/store-settings",title:a("creator.editStore"),"aria-label":a("creator.editStore"),children:e.jsx(I,{name:"pen"})})]}),e.jsxs("div",{className:"creator-hero__body",children:[x?e.jsx("img",{className:"creator-hero__ava",src:x,alt:"",loading:"eager",style:{backgroundColor:_}}):e.jsx("span",{className:"creator-hero__ava creator-hero__ava--ph","aria-hidden":!0,style:{backgroundColor:_}}),e.jsxs("div",{children:[e.jsx("h2",{className:"creator-hero__name",children:g}),i?e.jsx("p",{className:"creator-hero__desc",children:i}):null]}),e.jsxs("div",{className:"creator-hero__actions",children:[e.jsx("a",{className:"creator-hero__view","data-testid":"creator-hero-view",href:p,target:"_blank",rel:"noopener noreferrer",children:a("creator.viewProfile")}),e.jsx(Se,{address:t,className:"creator-hero__follow"})]})]})]})}const U=48;function Ge(){const{address:t}=se(),r=K(),[o]=te(),n=o.has("collections"),{data:m}=D(t),g=(m==null?void 0:m.name)||(t?O(t):a("creator.fallbackName"));me({title:g,description:a("seo.creator.description",{name:g})});const[x,N]=j.useState("wearable"),[i,p]=j.useState(null),[h,_]=j.useState([]),[d,b]=j.useState(""),[l,f]=j.useState(""),[P,z]=j.useState("newest"),S=d&&!Number.isNaN(Number(d))?Number(d):void 0,y=l&&!Number.isNaN(Number(l))?Number(l):void 0,G=i?ke[i]:void 0,H=($.find(s=>s.key===P)??$[0]).server,L={creator:t,category:x,rarities:h.length?h:void 0,wearableCategories:G,minPriceCredits:S,maxPriceCredits:y,sortBy:H},{items:v,total:Y,isLoading:C,error:A,hasNextPage:W,isFetchingNextPage:F,fetchNextPage:Z}=R(["creator-listings",L],s=>he({...L,first:U,skip:s}),{enabled:!!t&&!n}),u=R(["creator-collections",t],s=>ge(t,{first:U,skip:s}).then(c=>({items:c.collections,total:c.total})),{enabled:!!t&&n});function q(s){N(s),p(null),n&&M()}function M(){const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}`:""},{replace:!0})}function J(){if(n){M();return}const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function Q(s){_(c=>c.includes(s)?c.filter(ae=>ae!==s):[...c,s])}function V(){N("wearable"),p(null),_([]),b(""),f("")}const k=!!(S||y),X=k?`${d||"0"}–${l||"∞"}`:a("filter.price"),ee=x!=="wearable"||!!i||h.length>0||k;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":a("creator.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>r("/assets"),children:a("creator.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:g})]}),t?e.jsx(Le,{address:t}):null,!n&&!C&&v.length>0?e.jsx(je,{items:v,source:"creator"}):null,e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(ve,{category:x,subCategory:i,onCategory:q,onSub:p,title:a("creator.category"),flat:!0,collections:n,onCollections:J})}),e.jsx("div",{className:"browse__main",children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"creator-collections__bar",children:e.jsx("span",{className:"assets__count",children:u.isLoading?"…":a("creator.collectionsCount",{count:u.total})})}),u.error?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid grid--collections",children:u.isLoading?e.jsx(w,{count:9}):e.jsxs(e.Fragment,{children:[u.items.map(s=>e.jsx(Pe,{collection:s,itemCount:s.itemCount},s.contractAddress)),u.isFetchingNextPage?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:u.hasNextPage,isFetching:u.isFetchingNextPage,onLoadMore:()=>void u.fetchNextPage()}),!u.isLoading&&!u.error&&u.items.length===0?e.jsx("p",{className:"muted",children:a("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{rarities:h,onToggleRarity:Q,sort:P,onSort:z,total:Y,loading:C,anyActive:ee,onClear:V,renderTrailing:s=>e.jsx(we,{panelKey:"price",label:X,active:k,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMin"),placeholder:a("creator.priceMinPlaceholder"),value:d,onChange:c=>b(c.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMax"),placeholder:a("creator.priceMaxPlaceholder"),value:l,onChange:c=>f(c.target.value)})]}),e.jsx("p",{className:"filter-pop__hint",children:a("creator.priceHint",{currency:xe.name})})]})})}),A?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid",children:C?e.jsx(w,{count:15}):e.jsxs(e.Fragment,{children:[v.map(s=>e.jsx(ue,{item:s},s.id)),F?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:W,isFetching:F,onLoadMore:()=>void Z()}),!C&&!A&&v.length===0?e.jsx("p",{className:"muted",children:a("creator.empty")}):null]})})]})]})}export{Ge as Creator,Ge as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{be as U,bf as Ue,S as C,bg as qe,bh as Ye,a0 as Qe,bi as Je,aC as Xe,R as W,aH as K,aG as Te,bj as a,bk as Ze,bl as Le,T as et,aN as tt}from"./index-
|
|
1
|
+
import{be as U,bf as Ue,S as C,bg as qe,bh as Ye,a0 as Qe,bi as Je,aC as Xe,R as W,aH as K,aG as Te,bj as a,bk as Ze,bl as Le,T as et,aN as tt}from"./index-BuIf8bJO.js";import{R as rt,g as ot}from"./getOverlayAlpha-D966K3RG.js";import{j as T,r as y}from"./react-C51i12iP.js";import{u as nt,a as Be}from"./useTheme-CppNw7QX.js";function ne(r){const o=Ue(r);return r!==o&&o.styles?(o.styles.match(/^@layer\s+[^{]*$/)||(o.styles=`@layer global{${o.styles}}`),o):r}function at({styles:r,themeId:o,defaultTheme:n={}}){const i=nt(n),s=o&&i[o]||i;let l=typeof r=="function"?r(s):r;return s.modularCssLayers&&(Array.isArray(l)?l=l.map(d=>ne(typeof d=="function"?d(s):d)):l=ne(l)),T.jsx(U,{styles:l})}const Ee=y.createContext(null);function se(){return y.useContext(Ee)}const it=typeof Symbol=="function"&&Symbol.for,st=it?Symbol.for("mui.nested"):"__THEME_NESTED__";function lt(r,o){return typeof o=="function"?o(r):C({},r,o)}function ct(r){const{children:o,theme:n}=r,i=se(),s=y.useMemo(()=>{const l=i===null?n:lt(i,n);return l!=null&&(l[st]=i!==null),l},[n,i]);return T.jsx(Ee.Provider,{value:s,children:o})}function dt(r){const o=Be(),n=qe()||"",{modularCssLayers:i}=r;let s="mui.global, mui.components, mui.theme, mui.custom, mui.sx";return!i||o!==null?s="":typeof i=="string"?s=i.replace(/mui(?!\.)/g,s):s=`@layer ${s};`,Ye(()=>{const l=document.querySelector("head");if(!l)return;const d=l.firstChild;if(s){var m;if(d&&(m=d.hasAttribute)!=null&&m.call(d,"data-mui-layer-order")&&d.getAttribute("data-mui-layer-order")===n)return;const S=document.createElement("style");S.setAttribute("data-mui-layer-order",n),S.textContent=s,l.prepend(S)}else{var f;(f=l.querySelector(`style[data-mui-layer-order="${n}"]`))==null||f.remove()}},[s,n]),s?T.jsx(at,{styles:s}):null}const $e={};function xe(r,o,n,i=!1){return y.useMemo(()=>{const s=r&&o[r]||o;if(typeof n=="function"){const l=n(s),d=r?C({},o,{[r]:l}):l;return i?()=>d:d}return r?C({},o,{[r]:n}):C({},o,n)},[r,o,n,i])}function ut(r){const{children:o,theme:n,themeId:i}=r,s=Be($e),l=se()||$e,d=xe(i,s,n),m=xe(i,l,n,!0),f=d.direction==="rtl",S=dt(d);return T.jsx(ct,{theme:m,children:T.jsx(Qe.Provider,{value:d,children:T.jsx(rt,{value:f,children:T.jsxs(Je,{value:d==null?void 0:d.components,children:[S,o]})})})})}const le="mode",ce="color-scheme",Ie="data-color-scheme";function mt(r){const{defaultMode:o="light",defaultLightColorScheme:n="light",defaultDarkColorScheme:i="dark",modeStorageKey:s=le,colorSchemeStorageKey:l=ce,attribute:d=Ie,colorSchemeNode:m="document.documentElement",nonce:f}=r||{};return T.jsx("script",{suppressHydrationWarning:!0,nonce:typeof window>"u"?f:"",dangerouslySetInnerHTML:{__html:`(function() {
|
|
2
2
|
try {
|
|
3
3
|
var mode = localStorage.getItem('${s}') || '${o}';
|
|
4
4
|
var colorScheme = '';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-
|
|
1
|
+
import{C as l,E as w,b as E,S as A,d as k,O as U,N as P,g as f,B as x,e as N,i as I,p as L}from"./W3MFrameProviderSingleton-CwlhUGa4.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-Da5RB1ao.js";const D=0,C={paymentAsset:null,amount:null,tokenAmount:0,priceLoading:!1,error:null,exchanges:[],isLoading:!1,currentPayment:void 0,isPaymentInProgress:!1,paymentId:"",assets:[]},e=L(C),m={state:e,subscribe(t){return I(e,()=>t(e))},subscribeKey(t,n){return N(e,t,n)},resetState(){Object.assign(e,{...C})},async getAssetsForNetwork(t){const n=v(t),s=await m.getAssetsImageAndPrice(n),r=n.map(a=>{var c,o,p,y;const u=a.asset==="native"?f():`${a.network}:${a.asset}`,i=s.find(S=>{var g,d,h;return((h=(d=(g=S.fungibles)==null?void 0:g[0])==null?void 0:d.address)==null?void 0:h.toLowerCase())===u.toLowerCase()});return{...a,price:((o=(c=i==null?void 0:i.fungibles)==null?void 0:c[0])==null?void 0:o.price)||1,metadata:{...a.metadata,iconUrl:(y=(p=i==null?void 0:i.fungibles)==null?void 0:p[0])==null?void 0:y.iconUrl}}});return e.assets=r,r},async getAssetsImageAndPrice(t){const n=t.map(r=>r.asset==="native"?f():`${r.network}:${r.asset}`);return await Promise.all(n.map(r=>x.fetchTokenPrice({addresses:[r]})))},getTokenAmount(){var s;if(!((s=e==null?void 0:e.paymentAsset)!=null&&s.price))throw new Error("Cannot get token price");const t=P.bigNumber(e.amount??0).round(8),n=P.bigNumber(e.paymentAsset.price).round(8);return t.div(n).round(8).toNumber()},setAmount(t){var n;e.amount=t,(n=e.paymentAsset)!=null&&n.price&&(e.tokenAmount=m.getTokenAmount())},setPaymentAsset(t){e.paymentAsset=t},isPayWithExchangeEnabled(){var t;return(t=U.state.remoteFeatures)==null?void 0:t.payWithExchange},isPayWithExchangeSupported(){return m.isPayWithExchangeEnabled()&&l.state.activeCaipNetwork&&k.PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES.includes(l.state.activeCaipNetwork.chainNamespace)},async fetchExchanges(){var t;try{const n=m.isPayWithExchangeSupported();if(!e.paymentAsset||!n){e.exchanges=[],e.isLoading=!1;return}e.isLoading=!0;const s=await _({page:D,asset:b(e.paymentAsset.network,e.paymentAsset.asset),amount:((t=e.amount)==null?void 0:t.toString())??"0"});e.exchanges=s.exchanges.slice(0,2)}catch{throw A.showError("Unable to get exchanges"),new Error("Unable to get exchanges")}finally{e.isLoading=!1}},async getPayUrl(t,n){try{const s=Number(n.amount),r=await W({exchangeId:t,asset:b(n.network,n.asset),amount:s.toString(),recipient:`${n.network}:${n.recipient}`});return w.sendEvent({type:"track",event:"PAY_EXCHANGE_SELECTED",properties:{exchange:{id:t},configuration:{network:n.network,asset:n.asset,recipient:n.recipient,amount:s},currentPayment:{type:"exchange",exchangeId:t},source:"fund-from-exchange",headless:!1}}),r}catch(s){throw s instanceof Error&&s.message.includes("is not supported")?new Error("Asset not supported"):new Error(s.message)}},async handlePayWithExchange(t){var n;try{const s=(n=l.getAccountData())==null?void 0:n.address;if(!s)throw new Error("No account connected");if(!e.paymentAsset)throw new Error("No payment asset selected");const r=E.returnOpenHref("","popupWindow","scrollbar=yes,width=480,height=720");if(!r)throw new Error("Could not create popup window");e.isPaymentInProgress=!0,e.paymentId=crypto.randomUUID(),e.currentPayment={type:"exchange",exchangeId:t};const{network:a,asset:u}=e.paymentAsset,i={network:a,asset:u,amount:e.tokenAmount,recipient:s},c=await m.getPayUrl(t,i);if(!c){try{r.close()}catch(o){console.error("Unable to close popup window",o)}throw new Error("Unable to initiate payment")}e.currentPayment.sessionId=c.sessionId,e.currentPayment.status="IN_PROGRESS",e.currentPayment.exchangeId=t,r.location.href=c.url}catch{e.error="Unable to initiate payment",A.showError(e.error)}},async waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r=20}){const a=await m.getBuyStatus(t,n,s);if(a.status==="SUCCESS"||a.status==="FAILED")return a;if(r===0)throw new Error("Unable to get deposit status");return await new Promise(u=>{setTimeout(u,5e3)}),m.waitUntilComplete({exchangeId:t,sessionId:n,paymentId:s,retries:r-1})},async getBuyStatus(t,n,s){var r,a,u,i,c;try{if(!e.currentPayment)throw new Error("No current payment");const o=await T({sessionId:n,exchangeId:t});if(e.currentPayment.status=o.status,o.status==="SUCCESS"||o.status==="FAILED"){const p=(r=l.getAccountData())==null?void 0:r.address;e.currentPayment.result=o.txHash,e.isPaymentInProgress=!1,w.sendEvent({type:"track",event:o.status==="SUCCESS"?"PAY_SUCCESS":"PAY_ERROR",properties:{message:o.status==="FAILED"?E.parseError(e.error):void 0,source:"fund-from-exchange",paymentId:s,configuration:{network:((a=e.paymentAsset)==null?void 0:a.network)||"",asset:((u=e.paymentAsset)==null?void 0:u.asset)||"",recipient:p||"",amount:e.amount??0},currentPayment:{type:"exchange",exchangeId:(i=e.currentPayment)==null?void 0:i.exchangeId,sessionId:(c=e.currentPayment)==null?void 0:c.sessionId,result:o.txHash}}})}return o}catch{return{status:"UNKNOWN",txHash:""}}},reset(){e.currentPayment=void 0,e.isPaymentInProgress=!1,e.paymentId="",e.paymentAsset=null,e.amount=0,e.tokenAmount=0,e.priceLoading=!1,e.error=null,e.exchanges=[],e.isLoading=!1}};export{m as E};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as $,b as q,r as i,j as e}from"./react-C51i12iP.js";import{m as H,t as s,u as Q,b as V,j as g,e as d,E as P,k as I,C as W,f as z}from"./index-
|
|
1
|
+
import{u as $,b as q,r as i,j as e}from"./react-C51i12iP.js";import{m as H,t as s,u as Q,b as V,j as g,e as d,E as P,k as I,C as W,f as z}from"./index-BuIf8bJO.js";import{R as G}from"./resume-buy-Bf0zIH7y.js";import{R as D}from"./cart-checkout-r4Liry5X.js";import{l as J}from"./loader-logo-BzY9EKdC.js";import{u as Z,p as X,c as ee,i as se}from"./useCreditPacks-DAQD0des.js";import{C as te}from"./CircularProgress-D3dl01wX.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";const j="https://cdn.decentraland.org/@dcl/shop/0.1.0-29998165954.commit-94f27c7/assets/pack-chips--HnOpf5U.webp",re="https://cdn.decentraland.org/@dcl/shop/0.1.0-29998165954.commit-94f27c7/assets/credit-coin-CmcTCd5i.webp",ce="data:image/svg+xml,%3csvg%20width='60'%20height='60'%20viewBox='0%200%2060%2060'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3crect%20width='60'%20height='60'%20rx='30'%20fill='%2334CE77'/%3e%3cpath%20d='M21.6583%2046.1067L11.4656%2036.0591C10.1688%2034.829%2010.1905%2032.7207%2011.4769%2031.4622L13.6868%2029.3591C14.9732%2028.1006%2017.1615%2028.1058%2018.4582%2029.3359L23.8747%2034.6197L41.9704%2015.6527C43.2568%2014.3942%2045.4291%2014.2093%2046.7258%2015.4394L48.8765%2017.3628C50.1732%2018.5929%2050.3491%2020.6844%2049.0626%2021.9429L26.6112%2045.8766C25.1433%2047.342%2022.955%2047.3368%2021.6583%2046.1067Z'%20fill='%23FCFCFC'/%3e%3c/svg%3e",x=se()?"mock":"stripe",ae={pack_5:j,pack_10:j,pack_25:j,pack_50:j},ne="https://docs.decentraland.org";function M(l){const r=l;if((r==null?void 0:r.name)==="AbortError")return s("getCredits.errorCanceled");const m=((r==null?void 0:r.message)??"").toLowerCase();return m.includes("sign in")?s("getCredits.errorSignIn",{currency:d.name}):m.includes("timed out")?s("getCredits.errorTimeout",{currency:d.name}):s("getCredits.errorGeneric")}function je(){H({title:s("nav.getCredits",{currency:d.name}),noindex:!0});const l=$(),{session:r,signIn:m}=Q(),n=V(),[N,w]=q(),{packs:F,isLoading:T}=Z(),[p,o]=i.useState("select"),[a,E]=i.useState(null),[R,L]=i.useState(null),[U,h]=i.useState(null),[K,f]=i.useState(!1),b=i.useRef(null);i.useEffect(()=>()=>{var t;return(t=b.current)==null?void 0:t.abort()},[]);const A=i.useCallback(()=>{w(t=>{const c=new URLSearchParams(t);return c.delete("order"),c.delete("canceled"),c},{replace:!0})},[w]),y=i.useCallback(async t=>{o("processing");const c=new AbortController;b.current=c;try{const u=await X(t,{signal:c.signal,address:r==null?void 0:r.address,identity:r==null?void 0:r.identity});if(u.status==="credited"){const _=u.creditsGranted??(a==null?void 0:a.credits)??0;L(_>0?_:null),o("success"),g("Shop Completed Buy Credits",{order_id:t,pack_usd:(a==null?void 0:a.usd)??null,credits:_>0?_:null,provider:x}),n.invalidateQueries({queryKey:["usd-balance"]});try{if(sessionStorage.getItem(D)){const k={resumeCheckout:!0,..._>0?{creditsAdded:_}:{}};l("/cart",{state:k});return}}catch{}try{const k=sessionStorage.getItem(G);if(k){sessionStorage.removeItem(G);const C=JSON.parse(k),B=C.tokenId??C.itemId;if(C.contractAddress&&B){l(`/item/${C.contractAddress}/${B}`,{state:{item:C,resumeBuy:!0}});return}}}catch{}}else u.status==="pending"?(g("Shop Buy Credits Pending",{step:"grant",pack_usd:(a==null?void 0:a.usd)??null}),n.invalidateQueries({queryKey:["usd-balance"]}),o("pending")):(g("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(a==null?void 0:a.usd)??null}),h(u.error??s("getCredits.errorGrant",{currency:d.name})),o("error"))}catch(u){P(u,{flow:"get_credits",step:"grant",order_id:t}),g("Shop Buy Credits Failed",{step:"grant",error_code:I(u),pack_usd:(a==null?void 0:a.usd)??null}),h(M(u)),o("error")}},[a,r,n,l]),O=i.useCallback(async t=>{if(!r){m();return}h(null),f(!1),E(t),o(x==="mock"?"processing":"redirecting"),g("Shop Started Buy Credits",{pack_usd:t.usd,credits:t.credits,provider:x});try{const c=await ee(t.id,{address:r.address,identity:r.identity});if(c.mock)y(c.orderId);else if(c.url)g("Shop Redirected To Stripe",{order_id:c.orderId,pack_usd:t.usd,credits:t.credits}),window.location.href=c.url;else throw new Error("Checkout did not return a redirect url")}catch(c){P(c,{flow:"get_credits",step:"checkout",provider:x}),g("Shop Buy Credits Failed",{step:"checkout",error_code:I(c),pack_usd:t.usd}),h(M(c)),o("error")}},[r,m,y]),v=i.useRef(!1);i.useEffect(()=>{if(v.current)return;const t=N.get("order");if(N.get("canceled")!=null){v.current=!0,g("Shop Buy Credits Cancelled",{order_id:t,provider:x}),A(),f(!0),o("select");return}t&&(o("processing"),r&&(v.current=!0,A(),y(t)))},[N,r]);function S(){var t;(t=b.current)==null||t.abort(),o("select"),E(null),L(null),h(null),f(!1)}const Y=p==="select";return e.jsxs("div",{className:"getcredits",children:[Y&&e.jsxs("header",{className:"getcredits__head",children:[e.jsx("h1",{className:"getcredits__title",children:s("getCredits.title",{currency:d.name})}),e.jsxs("p",{className:"getcredits__sub",children:[s("getCredits.subtitle",{currency:d.name})," ",e.jsxs("a",{className:"getcredits__learn",href:ne,target:"_blank",rel:"noreferrer",children:[s("getCredits.learnMore"),e.jsxs("svg",{className:"getcredits__learn-ico",viewBox:"0 0 13 13","aria-hidden":!0,fill:"none",children:[e.jsx("path",{d:"M4 2h7v7",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M11 2 2 11",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]})]})]})]}),p==="select"&&e.jsxs(e.Fragment,{children:[K&&e.jsx("p",{className:"getcredits__note muted",role:"status",children:s("getCredits.canceledNote")}),e.jsx(ie,{packs:F,loading:T,onSelect:t=>void O(t)})]}),p==="redirecting"&&e.jsxs("div",{className:"getcredits__status",role:"status","aria-live":"polite",children:[e.jsx(te,{size:32}),e.jsx("p",{className:"muted",children:s("getCredits.redirecting")})]}),p==="processing"&&e.jsxs("div",{className:"gc-processing",role:"status","aria-live":"polite",children:[e.jsx("img",{className:"gc-processing__logo",src:J,alt:"",width:61,height:61}),e.jsxs("div",{className:"gc-processing__body",children:[e.jsxs("p",{className:"gc-processing__title",children:[e.jsx("strong",{children:s("getCredits.processing")}),"…"]}),e.jsxs("div",{className:"gc-progress","aria-hidden":!0,children:[e.jsx("span",{className:"gc-progress__track",children:e.jsx("span",{className:"gc-progress__fill"})}),e.jsx("span",{className:"gc-progress__count",children:"1/1"})]})]})]}),p==="success"&&e.jsxs("div",{className:"gc-success",role:"status","aria-live":"polite",children:[e.jsxs("div",{className:"gc-banner",children:[e.jsx("img",{className:"gc-banner__icon",src:ce,alt:"",width:60,height:60}),e.jsxs("p",{className:"gc-banner__text",children:[e.jsx("strong",{children:s("getCredits.successTitle")})," ",s("getCredits.successBody",{currency:d.name})]})]}),R!=null&&e.jsx("div",{className:"gc-credits",children:e.jsxs("div",{className:"gc-credits__row",children:[e.jsx("img",{className:"gc-credits__coin",src:re,alt:"",width:93,height:93}),e.jsxs("p",{className:"gc-credits__text",children:[e.jsx(W,{className:"gc-credits__diamond"}),e.jsxs("span",{children:[e.jsx("strong",{className:"gc-credits__amount",children:s("getCredits.creditsAmount",{credits:R,currency:d.name})})," ",e.jsx("span",{className:"gc-credits__added",children:s("getCredits.creditsAdded")})]})]})]})}),e.jsxs("div",{className:"gc-actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:S,children:s("getCredits.buyMore",{currency:d.name})}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/assets"),children:s("getCredits.startShopping")})]})]}),p==="pending"&&e.jsxs("div",{className:"gc-status",role:"status","aria-live":"polite",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.pendingTitle",{currency:d.name})}),e.jsx("p",{className:"muted",children:s("getCredits.pendingBody")}),e.jsxs("div",{className:"gc-status__actions",children:[e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>l("/assets"),children:s("getCredits.startShopping")}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:S,children:s("getCredits.done")})]})]}),p==="error"&&e.jsxs("div",{className:"gc-status gc-status--err",role:"alert",children:[e.jsx("p",{className:"gc-status__title",children:s("getCredits.errorTitle")}),e.jsx("p",{className:"error",children:U}),e.jsx("div",{className:"gc-status__actions",children:e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:S,children:s("getCredits.tryAgain")})})]})]})}function ie({packs:l,loading:r,onSelect:m}){return r?e.jsx("div",{className:"packs","aria-busy":"true","aria-label":s("getCredits.packsLoading",{currency:d.name}),children:[0,1,2,3].map(n=>e.jsx("div",{className:"pack pack--skeleton","aria-hidden":!0,children:e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"skeleton pack__label-sk"}),e.jsx("span",{className:"skeleton pack__art-sk"}),e.jsx("span",{className:"skeleton pack__cta-sk"})]})},n))}):e.jsx("div",{className:"packs",children:l.map(n=>e.jsxs("button",{type:"button",className:`pack${n.bestValue?" pack--best":""}`,"data-testid":"pack",onClick:()=>m(n),"aria-label":s("getCredits.packAria",{amount:z(n.credits),usd:n.usd}),children:[n.bestValue&&e.jsx("span",{className:"pack__badge",children:s("getCredits.packBadge")}),e.jsxs("span",{className:"pack__inner",children:[e.jsx("span",{className:"pack__label",children:s("getCredits.creditsAmount",{credits:n.credits,currency:d.name})}),e.jsx("span",{className:"pack__art",children:e.jsx("img",{src:ae[n.id]??j,alt:"",loading:"lazy"})}),e.jsx("span",{className:"pack__cta-wrap",children:e.jsxs("span",{className:"pack__cta",children:["$",n.usd.toFixed(2)]})})]})]},n.id))})}export{je as GetCredits,je as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-
|
|
1
|
+
import{i as f,b as h}from"./lit-element-B3y9oplH.js";import{n as m}from"./class-map-CxwNmq0D.js";import{c as p}from"./index-CmKYvq1f.js";import{d as g,r as v}from"./index-Da5RB1ao.js";import{C as c}from"./ConstantsUtil-CJUlyS7R.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-CwlhUGa4.js";import{au as y}from"./NetworkUtil-Xp0fNa8X.js";const b=g`
|
|
2
2
|
:host {
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: center;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as K,r as u,j as e,L as B}from"./react-C51i12iP.js";import{v as $,t as s,e as w,B as k,C as L,j as P,E as A,m as U,u as W,b as O,o as z,s as Q,J}from"./index-
|
|
1
|
+
import{u as K,r as u,j as e,L as B}from"./react-C51i12iP.js";import{v as $,t as s,e as w,B as k,C as L,j as P,E as A,m as U,u as W,b as O,o as z,s as Q,J}from"./index-BuIf8bJO.js";import{i as Y,R as D,f as G}from"./import-Cnh7LTQ6.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./buy-Cf4D1sNV.js";import"./authorizations-HxyvVTVD.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";import"./trade-encoding-BozR-TuN.js";import"./mana-rate-Bk6GbQZ7.js";function H({queue:n,session:T,onClose:j,onDone:h}){const N=K(),d=$(T.providerType),[m,f]=u.useState(()=>n.map(()=>"pending")),[I,E]=u.useState("running"),S=u.useRef(!1);u.useEffect(()=>{if(S.current)return;S.current=!0;let t=!1;return(async()=>{for(let r=0;r<n.length;r++){if(t)return;f(p=>p.map((g,o)=>o===r?"active":g));try{await Y(n[r].item,n[r].priceCredits,T),P("Shop Migrated Listing",{item_id:n[r].item.itemId??n[r].item.oldTradeId??null,contract_address:n[r].item.contractAddress,new_price_credits:n[r].priceCredits,new_price_usd:n[r].priceCredits/10}),t||f(p=>p.map((g,o)=>o===r?"done":g))}catch(p){if(p instanceof D)A(p,{flow:"import_listing",step:"relist",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(g=>g.map((o,b)=>b===r?"unlisted":o));else{const g=p,o=g.code===4001||/reject|denied|cancel/i.test(g.message??"");o||A(p,{flow:"import_listing",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(b=>b.map((a,l)=>l===r?o?"skipped":"failed":a))}}}t||E("finished")})(),()=>{t=!0}},[]);const _=m.filter(t=>t==="done").length,v=m.findIndex(t=>t==="active"),x=Math.round(m.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function y(){h(),j()}if(I==="finished"){const t=m.filter(r=>r==="skipped"||r==="failed").length,c=m.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:_>0?s("migrate.successTitle"):s("migrate.nothingTitle")}),e.jsxs("p",{className:"muted",style:{margin:0},children:[_>0?s("migrate.listedSummary",{count:_,currency:w.name}):s("migrate.noneListed"),t>0?" "+s("migrate.skippedSummary",{count:t}):"",c>0?" "+s("migrate.unlistedSummary",{count:c}):""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(k,{variant:"ghost",onClick:y,children:s("getCredits.done")}),c>0?e.jsx(k,{variant:"purple",onClick:()=>{h(),j(),N("/my-assets")},children:s("migrate.goToMyAssets")}):_>0?e.jsx(k,{variant:"purple",onClick:()=>{h(),j(),N("/assets")},children:s("migrate.viewInShop")}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate","data-testid":"modal",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:s("migrate.listingTitle")}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[d?s("migrate.subConfirm"):s("migrate.subManaged")," ",v>=0?s("migrate.progressCount",{current:v+1,total:n.length}):""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${x}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,c)=>e.jsxs("li",{className:`migrate__row migrate__row--${m[c]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||s("migrate.itemFallback")}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(L,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:m[c]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",d?s("migrate.statusConfirm"):s("migrate.statusAdding")]}):m[c]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):m[c]==="skipped"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusSkipped")}):m[c]==="failed"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusFailed")}):m[c]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:s("migrate.unlistedTooltip"),children:s("migrate.statusUnlisted")}):e.jsx("span",{className:"migrate__wait",children:s("migrate.statusWaiting")})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:d?s("migrate.hintConfirm"):s("migrate.hintManaged")})]})})}const F=Q(k)`
|
|
2
2
|
margin-top: 10px;
|
|
3
3
|
`,V=Q(k)`
|
|
4
4
|
padding: 13px 24px;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{u as he,r as l,j as e,d as ka,a as wa,L as Ca}from"./react-C51i12iP.js";import{u as ee,a as Aa,b as _e,t as s,ak as Sa,i as Ma,r as Pa,h as Ea,c as ce,j as K,k as we,l as Ne,al as La,E as ie,C as q,x as te,B as G,e as Ie,q as Fa,J as sa,_ as ke,ap as Ta,aO as Ra,aP as qa,aQ as Da,aR as Ba,p as Ae,aS as $a,ad as ue,o as R,w as ta,I as O,aT as Oa,aU as Ka,aV as Wa,M as ia,aW as za,F as H,s as Y,aX as Va,aY as Qa,aZ as Ua,G as Ga,n as Ge,a_ as Ha,a$ as Ya,b0 as Ja,b1 as Xa,b2 as Za,ae as es,m as as,b3 as ss,b4 as ts,b5 as is,b6 as He,b7 as rs,g as ns,aq as ls,b8 as ds,b9 as os,ar as cs,ba as ms,bb as us,bc as hs}from"./index-CGNquv7o.js";import{d as Z}from"./dcl-schemas-BICTSpB5.js";import{W as _s,C as ys,t as ps,a as bs,s as fs}from"./CollectionCarousel-DMwkzkYf.js";import{b as Ye,c as xs}from"./buy-Dszi8UeF.js";import{P as gs,f as js}from"./PrimaryListModal-CdZJXblc.js";import{b as vs,w as Ns,S as Is,G as ks}from"./buy-gasless-Nfp6cMbQ.js";import{g as ws}from"./authorizations-D44lw00X.js";import{u as Cs,M as As,c as Ss}from"./useCreditPacks-DYrmYjK5.js";import{R as Je}from"./resume-buy-Bf0zIH7y.js";import{a as Ms,f as Ce,i as Ps}from"./errors-DUo56sGG.js";import{E as ye}from"./ErrorNotice-C7soUjRV.js";import{l as Es}from"./loader-logo-BzY9EKdC.js";import{C as Ls}from"./CircularProgress-DvTkhDvC.js";import{a as Fs,b as Ts}from"./trade-encoding-2LKm-Goy.js";import{M as ra}from"./MarketCheckout-BB0_ss_n.js";import{u as na}from"./useManaRate-BEdT5IGm.js";import{s as Rs}from"./address-DrURAr9O.js";import{T as la}from"./Tooltip-BZ57TVaP.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";import"./mana-rate-BM11zYcS.js";import"./emotion-CSxEP8yM.js";function da({item:t,onClose:n,resume:u=!1}){var B,W;const{session:i}=ee(),{data:_}=Aa(i),d=_e(),x=he(),v=Cs().packs.slice(0,As),[o,b]=l.useState("loading"),[c,N]=l.useState(null),[a,w]=l.useState(""),[A,y]=l.useState(t.priceCredits),[I,f]=l.useState(null),C=l.useRef(null),Q=(I==null?void 0:I.credits)??A,F=(_==null?void 0:_.credits)??0;l.useEffect(()=>{let m=!1;if(!i){b("error"),N(s("buyModal.signInToCheckout"));return}const k=g=>{const M=g-((_==null?void 0:_.credits)??0),j=v.find(T=>T.credits>=M)??v[v.length-1];w(j.id),K("Shop Buy Credits Prompted",{from:"item_checkout",credits_needed:g,credits_balance:(_==null?void 0:_.credits)??0,shortfall:Math.max(0,M)}),b("nofunds")};return(async()=>{var g,M;try{const j=await Sa(t);if(!j)throw new Error("not for sale");if(Ma(j,i.address))throw new Error("You can't buy your own listing.");const T=Pa((M=(g=j.received)==null?void 0:g[0])==null?void 0:M.amount);if(!Number.isFinite(T)||T<=0)throw new Error("price unavailable");const E=Math.ceil(T/10);if(m)return;if(y(E),_!=null&&_.credits<E){k(E);return}try{const{credit:$,maxCreditedValue:ae,usdCents:re}=await Ea(i.identity,T,j.id);if(m){ce(i.identity,[$.id]).catch(()=>{});return}C.current=$.id;const ne=Math.ceil(re/10);y(ne);const z={trade:j,credit:$,maxCreditedValue:ae,usdCents:re,credits:ne};f(z),u?U(z):b("ready")}catch($){if(m)return;if(Ms($)){k(E);return}throw $}}catch(j){if(m)return;K(Ne(j)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:we(j)}),b("error"),N(Ce(j,s("buyModal.error.generic"),{sale:!0}))}})(),()=>{m=!0,C.current&&i&&(ce(i.identity,[C.current]).catch(()=>{}),C.current=null)}},[]);async function U(m=I){if(!i||!m)return;b("processing"),N(null);let k=!1;try{const g={trade:m.trade,buyer:i.address,signer:i.signer,credits:[m.credit],maxCreditedValue:m.maxCreditedValue};let M;if(ws())try{M=await vs(g),await Ns(M),k=!0}catch(j){if(j instanceof Is)k=!0;else if(j instanceof ks)M=await Ye(g);else throw j}else M=await Ye(g);C.current=null,K("Shop Completed Purchase",{...La([t]),payment_type:"credits",no_crypto_step:k,transaction_hash:M??null}),d.invalidateQueries({queryKey:["usd-balance"]}),b("complete")}catch(g){Ne(g)||ie(g,{flow:"buy",step:"submit",gasless:k}),ce(i.identity,[m.credit.id]).catch(()=>{}),C.current=null,K(Ne(g)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:we(g)}),d.invalidateQueries({queryKey:["usd-balance"]}),N(Ce(g,s("buyModal.error.generic"),{sale:!0})),b("error")}}async function J(){if(!(!a||!i)){try{sessionStorage.setItem(Je,JSON.stringify(t))}catch{}I&&ce(i.identity,[I.credit.id]).catch(()=>{}),C.current=null,b("loading");try{const m=await Ss(a,{address:i.address,identity:i.identity});if(m.url){window.location.href=m.url;return}x("/credits")}catch(m){ie(m,{flow:"buy_credits_and_item"});try{sessionStorage.removeItem(Je)}catch{}N(s("buyModal.error.creditsCheckout")),b("error")}}}const L=o==="processing",h=o==="complete"?s("buyModal.titleComplete"):o==="nofunds"?s("buyModal.titleNoFunds"):s("buyModal.titleBuy");return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":s("buyModal.dialogAria",{name:t.name}),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:L?void 0:n,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${o==="processing"||o==="loading"?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:h}),!L&&e.jsx("button",{className:"buy-modal__x",onClick:n,"aria-label":s("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:o==="nofunds"?s("buyModal.dclBalance"):s("buyModal.myCreditsBalance")}),e.jsx(q,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:te(F)})]})]}),o==="loading"&&e.jsx("div",{className:"buy-modal__body buy-modal__processing",children:e.jsx(Ls,{size:44})}),o==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(ye,{message:c}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:n,children:s("buyModal.close")})})]}),o==="nofunds"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(_s,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:s("buyModal.insufficientFunds")})," ",s("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:s("buyModal.warningCreditsAmount",{count:Math.max(0,Q-F)})})," ",s("buyModal.warningToPurchase",{count:1})]})]}),e.jsx(Xe,{item:t,priceCredits:Q}),e.jsx("div",{className:"buy-modal__packs",children:v.map(m=>{const k=m.credits,g=m.id===a;return e.jsxs("button",{className:`buy-modal__pack${g?" buy-modal__pack--on":""}`,onClick:()=>w(m.id),children:[e.jsx(q,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:te(k)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",m.usd.toFixed(2),")"]})]},m.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(q,{className:"buy-modal__total-ico"}),e.jsx("span",{children:te(((B=v.find(m=>m.id===a))==null?void 0:B.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",(((W=v.find(m=>m.id===a))==null?void 0:W.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:n,children:s("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:()=>void J(),children:s("buyModal.buy")})]})]}),o==="ready"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(Xe,{item:t,priceCredits:Q}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient buy-modal__btn--full",onClick:()=>void U(),children:s("buyModal.buy")})})]}),o==="processing"&&e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:Es,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:u?s("buyModal.completingPurchase"):s("buyModal.completingTransaction")}),e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]}),o==="complete"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__success",children:[e.jsxs("svg",{viewBox:"0 0 64 64",width:"64",height:"64","aria-hidden":!0,children:[e.jsx("circle",{cx:"32",cy:"32",r:"32",fill:"#34ce74"}),e.jsx("path",{d:"M20 33l8 8 16-18",fill:"none",stroke:"#fff",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsxs("p",{className:"buy-modal__success-text",children:[e.jsx("b",{children:s("getCredits.successTitle")})," ",s("buyModal.successBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:()=>x("/assets?tab=mine"),children:s("buyModal.myAssets")}),e.jsxs("button",{className:"buy-modal__btn buy-modal__btn--ruby",onClick:n,children:[s("buyModal.tryInWorld"),e.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20","aria-hidden":!0,children:e.jsx("path",{d:"M5 12h12M13 7l5 5-5 5",fill:"none",stroke:"#fcfcfc",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})]})]})]})}function Xe({item:t,priceCredits:n}){return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsx("div",{className:"buy-modal__asset-name",title:t.name,children:t.name||s("buyModal.itemFallback")}),t.creator?e.jsx(ys,{address:t.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(q,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:te(n)})]})]})]})}const qs=1e3*60*60*24*182;function Ds({asset:t,session:n,onClose:u}){const i=_e(),_=he(),[d,x]=l.useState("10"),[v,o]=l.useState(null),[b,c]=l.useState(null),[N,a]=l.useState(!1),[w,A]=l.useState(null);async function y(){c(null);const f=Number(d);if(!Number.isInteger(f)||f<=0){c(s("sellModal.errorWholeNumber"));return}a(!0);try{o(s("sellModal.statusPreparing")),await Fs({signer:n.signer,contractAddress:t.contractAddress,chainId:t.chainId}),o(s("sellModal.statusListing"));const C=await Ts({signer:n.signer,nft:{contractAddress:t.contractAddress,tokenId:t.tokenId,network:t.network,chainId:t.chainId},usdPrice:f/10,expiresAtMs:Date.now()+qs});o(s("sellModal.statusPublishing")),await Fa(C,n.identity),o(null),A(f),K("Shop Listed Item",{item_id:t.itemId??t.tokenId??null,contract_address:t.contractAddress,price_credits:f,price_usd:f/10,listing_type:"secondary",is_primary:!1}),sa.success(s("sellModal.toastOnSale",{name:t.name})),i.invalidateQueries({queryKey:["my-assets",n.address]})}catch(C){ie(C,{flow:"list_secondary"}),K("Shop Listing Failed",{listing_type:"secondary",error_code:we(C)}),c(Ce(C,s("sellModal.errorGeneric"))),o(null)}finally{a(!1)}}function I(){u(),_(`/item/${t.contractAddress}/${t.tokenId}`)}return w!==null?e.jsx("div",{className:"modal-backdrop",onClick:u,role:"presentation",children:e.jsxs("div",{className:"modal modal--success",onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:s("sellModal.successTitle")}),t.image?e.jsx("img",{className:"modal__img",src:t.image,alt:t.name}):null,e.jsx("p",{className:"modal-success__name",children:t.name}),e.jsxs("p",{className:"muted small",children:[s("sellModal.listedFor")," ",e.jsxs("strong",{children:[e.jsx(q,{className:"ccy-mark"})," ",w]})]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(G,{variant:"ghost",onClick:u,children:s("getCredits.done")}),e.jsx(G,{variant:"purple",onClick:I,children:s("sellModal.viewInShop")})]})]})}):e.jsx("div",{className:"modal-backdrop",onClick:u,role:"presentation",children:e.jsxs("div",{className:"modal","data-testid":"modal",onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("h2",{className:"modal__title",children:s("sellModal.listTitle",{name:t.name})}),t.image?e.jsx("img",{className:"modal__img",src:t.image,alt:t.name}):null,e.jsxs("label",{className:"field",children:[e.jsx("span",{children:s("sellModal.priceLabel",{currency:Ie.name})}),e.jsx("input",{type:"number",min:"1",step:"1",value:d,onChange:f=>x(f.target.value),disabled:N})]}),e.jsx("p",{className:"muted small",children:s("sellModal.pricedInWhole",{currency:Ie.name,currencySingular:Ie.nameSingular})}),v?e.jsx("p",{className:"muted",children:v}):null,e.jsx(ye,{message:b}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(G,{variant:"ghost",onClick:u,disabled:N,children:s("sellModal.cancel")}),e.jsx(G,{onClick:()=>void y(),disabled:N,children:N?s("sellModal.listing"):s("sellModal.putOnSale")})]})]})})}const Bs=l.lazy(async()=>{const[{EmoteControls:t},{Experimental_CssVarsProvider:n},{light:u}]=await Promise.all([ke(()=>import("./index-Dzj-nA_x.js").then(i=>i.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),ke(()=>import("./index-hmML8Yn6.js"),__vite__mapDeps([11,3,1,2,4,5,6,7,12,9,13,14])),ke(()=>import("./index-I5rJvbQ1.js"),__vite__mapDeps([15,3,1,2,4,5,6,7,16,14,13,9]))]);return{default:i=>e.jsx(n,{theme:u,children:e.jsx(t,{...i})})}});function $s(t){return e.jsx(l.Suspense,{fallback:null,children:e.jsx(Bs,{...t})})}function Os({item:t}){const n=ee(I=>{var f;return(f=I.session)==null?void 0:f.address}),{data:u,isLoading:i}=Ta(n),_=n&&u?n:"default",d=t.category==="emote",[x,v]=l.useState("item"),o=!d&&x==="item",b=o||!i,[c,N]=l.useState(!0);l.useEffect(()=>{N(!0)},[t.id,o]);const a=!!n&&!!u,w=a&&Ra(t,qa(u)),A=Da(t)[0],y=a&&!w&&!d;return e.jsxs(e.Fragment,{children:[b?e.jsx(Ba,{id:"shop-item-preview",contractAddress:t.contractAddress,tokenId:t.tokenId??void 0,itemId:t.tokenId?void 0:t.itemId??void 0,profile:o?void 0:w?_:"default",bodyShape:o||w?void 0:A,type:d?void 0:o?Z.PreviewType.WEARABLE:Z.PreviewType.AVATAR,emote:d||o?void 0:Z.PreviewEmote.FASHION,disableBackground:!0,wheelZoom:d?1.5:void 0,wheelStart:d?100:void 0,dev:Ae.chainId===80002,onLoad:()=>N(!1)}):null,!b||c?e.jsx("div",{className:"item-preview__loading","aria-busy":"true","aria-label":s("itemPreview.loading"),children:e.jsx("span",{className:"item-preview__spinner","aria-hidden":!0})}):null,y&&!o?e.jsx("p",{className:"item-preview__note",children:s("itemPreview.shownOnBody",{shape:$a(A)})}):null,d?e.jsx("div",{className:"item-preview__emote-controls","data-testid":"emote-controls",children:e.jsx($s,{wearablePreviewId:"shop-item-preview",hideFrameInput:!0})}):e.jsxs("div",{className:"item-preview__toggle",role:"group","aria-label":s("itemPreview.previewMode"),children:[e.jsxs("button",{type:"button",className:x==="avatar"?"is-active":"","aria-pressed":x==="avatar","aria-label":s("itemPreview.onAvatar"),onClick:()=>v("avatar"),children:[e.jsxs("svg",{className:"item-preview__toggle-ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:[e.jsx("circle",{cx:"12",cy:"7.5",r:"4"}),e.jsx("path",{d:"M4 20c0-4.2 3.6-6.5 8-6.5s8 2.3 8 6.5v.5H4z"})]}),e.jsx("span",{className:"item-preview__toggle-label",children:s("itemPreview.onAvatar")})]}),e.jsxs("button",{type:"button",className:x==="item"?"is-active":"","aria-pressed":x==="item","aria-label":s("itemPreview.item"),onClick:()=>v("item"),children:[e.jsx("svg",{className:"item-preview__toggle-ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:e.jsx("path",{d:"M8.5 3 3 6l1.8 3.8 2.2-1V21h10V8.8l2.2 1L22 6l-5.5-3a2.6 2.6 0 0 1-4.5 1.4A2.6 2.6 0 0 1 8.5 3z"})}),e.jsx("span",{className:"item-preview__toggle-label",children:s("itemPreview.item")})]})]})]})}const Ze=8,Ks=!1;function Ws(t){return{tradeId:t.tradeId??t.id,listingType:"primary",contractAddress:t.contractAddress,itemId:t.itemId??"",name:t.name,thumbnail:t.thumbnail,rarity:t.rarity,category:t.category,wearableCategory:t.wearableCategory??null,creator:t.creator,manaWei:t.manaWei??"0",available:1,network:t.network,chainId:t.chainId,createdAt:0}}function zs({item:t}){var L;const n=t.contractAddress,u=t.itemId,i=_e(),_=ue(h=>h.add),d=ue(h=>h.items),{session:x}=ee(),v=(L=x==null?void 0:x.address)==null?void 0:L.toLowerCase(),[o,b]=l.useState(null),[c,N]=l.useState(null),[a,w]=l.useState(Ze),{data:A=[],isLoading:y}=R({queryKey:["item-resales",n,u],enabled:!!n&&!!u,queryFn:()=>Oa(n,u)}),I=A.slice(0,a),f=I.map(h=>h.tokenId).filter(h=>!!h),{data:C={}}=R({queryKey:["resale-token-info",n,f.join(",")],enabled:!!n&&f.length>0,staleTime:6e4,queryFn:()=>Ka(n,f)}),{data:Q=[]}=R({queryKey:["item-classic-orders",n,u],enabled:Ks,queryFn:()=>Wa(n,u)}),F=A.some(h=>h.source==="legacy"),{data:U}=na(F);function J(){i.invalidateQueries({queryKey:["item-resales",n,u]})}return y||A.length===0?null:e.jsxs("section",{className:"resales","data-testid":"resales-section",children:[e.jsxs("div",{className:"resales__head",children:[e.jsx("h2",{className:"resales__title",children:s("resales.title")}),e.jsx("p",{className:"resales__subtitle",children:s("resales.subtitle")})]}),A.length>0?e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"resales__list",children:I.map(h=>{const B=h.source==="legacy",W=d.some(j=>j.id===h.id),m=h.tokenId&&C[h.tokenId]||{},k=m.issuedId??h.issuedId,g=m.seller,M=!!g&&!!v&&g.toLowerCase()===v;return e.jsxs("li",{className:`resales__row${B?" resales__row--legacy":""}`,"data-testid":"resale-row","data-source":h.source,"data-own":M?"true":void 0,children:[h.thumbnail?e.jsx("img",{className:"resales__thumb",src:h.thumbnail,alt:"","aria-hidden":!0}):null,e.jsxs("div",{className:"resales__meta",children:[k?e.jsxs("span",{className:"resales__issued","data-testid":"resale-issued",children:["#",k]}):e.jsx("span",{className:"resales__issued resales__issued--muted",children:s("resales.copy")}),g?e.jsxs("div",{className:"resales__seller","data-testid":"resale-seller",children:[e.jsx("span",{className:"resales__seller-label",children:s("resales.seller")}),e.jsx(ta,{address:g,className:"resales__seller-badge",linkToProfile:!0,hidePrefix:!0})]}):null]}),e.jsxs("div",{className:`resales__price${B?" resales__price--approx":""}`,children:[B?e.jsx("span",{className:"resales__approx","aria-hidden":!0,children:"≈"}):null,e.jsx(q,{className:"resales__diamond"}),e.jsx("span",{className:"resales__price-value",children:te(h.priceCredits)})]}),e.jsx("div",{className:"resales__actions",children:M?e.jsx("span",{className:"chip resales__own-chip","data-testid":"resale-own",children:s("resales.yourListing")}):B?e.jsx("button",{className:"resales__buy",onClick:()=>N(Ws(h)),"aria-label":s("assetCard.buyNow"),"data-testid":"resale-buy",children:s("assetCard.buyNow")}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"resales__add",onClick:()=>_(h,"item_detail"),disabled:W,"aria-label":W?s("assetCard.inCart"):s("assetCard.addToCart"),"data-testid":"resale-add",children:[e.jsx(O,{name:"cart-solid",size:16}),e.jsx("span",{children:W?s("assetCard.inCart"):s("assetCard.addToCart")})]}),e.jsx("button",{className:"resales__buy",onClick:()=>b(h),"aria-label":s("assetCard.buyNow"),"data-testid":"resale-buy",children:s("assetCard.buyNow")})]})})]},h.tradeId??h.id)})}),A.length>a?e.jsx("button",{className:"resales__more",onClick:()=>w(h=>h+Ze),"data-testid":"resale-show-more",children:s("resales.showMore")}):null]}):null,null,o?e.jsx(da,{item:o,onClose:()=>{b(null),J()}}):null,c&&U?e.jsx(ra,{listing:c,rate:U,onClose:()=>N(null),onSold:()=>{N(null),J()}}):null]})}function oa(){return Ae.shopServerUrl||(typeof window<"u"?window.location.origin:"")}async function Vs(t,n,u){const i=new URLSearchParams({contractAddress:t,itemId:n}),_=`${oa()}/notify-requests?${i.toString()}`,d=await ia(_,{method:"GET",identity:u,metadata:{}});if(!d.ok)throw new Error(`getNotifyRequest ${d.status}`);return d.json()}async function Qs(t,n){const u=`${oa()}/notify-requests`,i=await ia(u,{method:"POST",identity:n,metadata:{},headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!i.ok)throw new Error(`createNotifyRequest ${i.status}: ${await i.text()}`);await i.json().catch(()=>{})}function ea(t){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t.trim())}function Us({item:t}){const n=ee(y=>y.session),u=ee(y=>y.signIn),[i,_]=l.useState(""),[d,x]=l.useState(!1),[v,o]=l.useState(!1),[b,c]=l.useState(null),N=!!n&&!!t.contractAddress&&!!t.itemId,{data:a}=R({queryKey:["notify-request",t.contractAddress,t.itemId,n==null?void 0:n.address],enabled:N,queryFn:()=>Vs(t.contractAddress,t.itemId,n.identity)});l.useEffect(()=>{a!=null&&a.email&&_(y=>y||a.email)},[a==null?void 0:a.email]),l.useEffect(()=>{if(!n)return;let y=!1;return za().then(I=>{!y&&I&&_(f=>f||I)}),()=>{y=!0}},[n]);const w=v||!!(a!=null&&a.subscribed);async function A(y){if(y.preventDefault(),!(!n||!t.itemId||!ea(i)||d)){x(!0),c(null);try{await Qs({contractAddress:t.contractAddress,itemId:t.itemId,chainId:t.chainId,email:i.trim()},n.identity),o(!0)}catch(I){ie(I,{flow:"notify-me",contractAddress:t.contractAddress,itemId:t.itemId}),c(s("notifyMe.error"))}finally{x(!1)}}}return n?w?e.jsxs("div",{className:"notify notify__done","data-testid":"notify-subscribed",children:[e.jsx("span",{className:"notify__done-check","aria-hidden":!0,children:e.jsx(O,{name:"check",size:12})}),e.jsx("span",{className:"notify__done-text",children:s("notifyMe.subscribedBody")})]}):e.jsxs("form",{className:"notify",onSubmit:A,"data-testid":"notify",children:[e.jsx("label",{className:"notify__label",htmlFor:"notify-email",children:s("notifyMe.label")}),e.jsxs("div",{className:"notify__row",children:[e.jsx("input",{id:"notify-email",className:"notify__input",type:"email",inputMode:"email",autoComplete:"email",placeholder:s("notifyMe.placeholder"),value:i,onChange:y=>_(y.target.value),"data-testid":"notify-email"}),e.jsx("button",{type:"submit",className:"notify__btn",disabled:!ea(i)||d,"data-testid":"notify-submit",children:d?s("notifyMe.working"):s("notifyMe.cta")})]}),e.jsx(ye,{message:b})]}):e.jsx("div",{className:"notify","data-testid":"notify",children:e.jsx("button",{type:"button",className:"notify__signin",onClick:u,"data-testid":"notify-signin",children:s("notifyMe.signInCta")})})}const Gs=Y.button`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CMI54Xz_.js","assets/react-C51i12iP.js","assets/dcl-schemas-BICTSpB5.js","assets/index-BuIf8bJO.js","assets/sentry-DKBoGDXH.js","assets/ethers-w5dOkonM.js","assets/intl-CBcMB1D2.js","assets/index-CrKaGnrK.css","assets/emotion-styled.browser.esm-DEfIzFSa.js","assets/useTheme-CppNw7QX.js","assets/CircularProgress-D3dl01wX.js","assets/index-CPDwm9i3.js","assets/useTheme-5pltrVRq.js","assets/CssVarsProvider-Bt7Uqfjv.js","assets/getOverlayAlpha-D966K3RG.js","assets/index-JoEf73cu.js","assets/colors-LINLm1ux.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as he,r as l,j as e,d as ka,a as wa,L as Ca}from"./react-C51i12iP.js";import{u as ee,a as Aa,b as _e,t as s,ak as Sa,i as Ma,r as Pa,h as Ea,c as ce,j as K,k as we,l as Ne,al as La,E as ie,C as q,x as te,B as G,e as Ie,q as Fa,J as sa,_ as ke,ap as Ta,aO as Ra,aP as qa,aQ as Da,aR as Ba,p as Ae,aS as $a,ad as ue,o as R,w as ta,I as O,aT as Oa,aU as Ka,aV as Wa,M as ia,aW as za,F as H,s as Y,aX as Va,aY as Qa,aZ as Ua,G as Ga,n as Ge,a_ as Ha,a$ as Ya,b0 as Ja,b1 as Xa,b2 as Za,ae as es,m as as,b3 as ss,b4 as ts,b5 as is,b6 as He,b7 as rs,g as ns,aq as ls,b8 as ds,b9 as os,ar as cs,ba as ms,bb as us,bc as hs}from"./index-BuIf8bJO.js";import{d as Z}from"./dcl-schemas-BICTSpB5.js";import{W as _s,C as ys,t as ps,a as bs,s as fs}from"./CollectionCarousel-qqanrG2T.js";import{b as Ye,c as xs}from"./buy-Cf4D1sNV.js";import{P as gs,f as js}from"./PrimaryListModal-5XAxSkjg.js";import{b as vs,w as Ns,S as Is,G as ks}from"./buy-gasless-DN1sOd1A.js";import{g as ws}from"./authorizations-HxyvVTVD.js";import{u as Cs,M as As,c as Ss}from"./useCreditPacks-DAQD0des.js";import{R as Je}from"./resume-buy-Bf0zIH7y.js";import{a as Ms,f as Ce,i as Ps}from"./errors-B_GO1NZB.js";import{E as ye}from"./ErrorNotice-C7soUjRV.js";import{l as Es}from"./loader-logo-BzY9EKdC.js";import{C as Ls}from"./CircularProgress-D3dl01wX.js";import{a as Fs,b as Ts}from"./trade-encoding-BozR-TuN.js";import{M as ra}from"./MarketCheckout-DuLpUtl6.js";import{u as na}from"./useManaRate-Dte3sZ4h.js";import{s as Rs}from"./address-DrURAr9O.js";import{T as la}from"./Tooltip-DMu4FyD0.js";import"./sentry-DKBoGDXH.js";import"./ethers-w5dOkonM.js";import"./intl-CBcMB1D2.js";import"./index-HN6Rk25C.js";import"./sendMetaTransaction-CiO3jI6F.js";import"./mana-rate-Bk6GbQZ7.js";import"./emotion-CSxEP8yM.js";function da({item:t,onClose:n,resume:u=!1}){var B,W;const{session:i}=ee(),{data:_}=Aa(i),d=_e(),x=he(),v=Cs().packs.slice(0,As),[o,b]=l.useState("loading"),[c,N]=l.useState(null),[a,w]=l.useState(""),[A,y]=l.useState(t.priceCredits),[I,f]=l.useState(null),C=l.useRef(null),Q=(I==null?void 0:I.credits)??A,F=(_==null?void 0:_.credits)??0;l.useEffect(()=>{let m=!1;if(!i){b("error"),N(s("buyModal.signInToCheckout"));return}const k=g=>{const M=g-((_==null?void 0:_.credits)??0),j=v.find(T=>T.credits>=M)??v[v.length-1];w(j.id),K("Shop Buy Credits Prompted",{from:"item_checkout",credits_needed:g,credits_balance:(_==null?void 0:_.credits)??0,shortfall:Math.max(0,M)}),b("nofunds")};return(async()=>{var g,M;try{const j=await Sa(t);if(!j)throw new Error("not for sale");if(Ma(j,i.address))throw new Error("You can't buy your own listing.");const T=Pa((M=(g=j.received)==null?void 0:g[0])==null?void 0:M.amount);if(!Number.isFinite(T)||T<=0)throw new Error("price unavailable");const E=Math.ceil(T/10);if(m)return;if(y(E),_!=null&&_.credits<E){k(E);return}try{const{credit:$,maxCreditedValue:ae,usdCents:re}=await Ea(i.identity,T,j.id);if(m){ce(i.identity,[$.id]).catch(()=>{});return}C.current=$.id;const ne=Math.ceil(re/10);y(ne);const z={trade:j,credit:$,maxCreditedValue:ae,usdCents:re,credits:ne};f(z),u?U(z):b("ready")}catch($){if(m)return;if(Ms($)){k(E);return}throw $}}catch(j){if(m)return;K(Ne(j)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:we(j)}),b("error"),N(Ce(j,s("buyModal.error.generic"),{sale:!0}))}})(),()=>{m=!0,C.current&&i&&(ce(i.identity,[C.current]).catch(()=>{}),C.current=null)}},[]);async function U(m=I){if(!i||!m)return;b("processing"),N(null);let k=!1;try{const g={trade:m.trade,buyer:i.address,signer:i.signer,credits:[m.credit],maxCreditedValue:m.maxCreditedValue};let M;if(ws())try{M=await vs(g),await Ns(M),k=!0}catch(j){if(j instanceof Is)k=!0;else if(j instanceof ks)M=await Ye(g);else throw j}else M=await Ye(g);C.current=null,K("Shop Completed Purchase",{...La([t]),payment_type:"credits",no_crypto_step:k,transaction_hash:M??null}),d.invalidateQueries({queryKey:["usd-balance"]}),b("complete")}catch(g){Ne(g)||ie(g,{flow:"buy",step:"submit",gasless:k}),ce(i.identity,[m.credit.id]).catch(()=>{}),C.current=null,K(Ne(g)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:we(g)}),d.invalidateQueries({queryKey:["usd-balance"]}),N(Ce(g,s("buyModal.error.generic"),{sale:!0})),b("error")}}async function J(){if(!(!a||!i)){try{sessionStorage.setItem(Je,JSON.stringify(t))}catch{}I&&ce(i.identity,[I.credit.id]).catch(()=>{}),C.current=null,b("loading");try{const m=await Ss(a,{address:i.address,identity:i.identity});if(m.url){window.location.href=m.url;return}x("/credits")}catch(m){ie(m,{flow:"buy_credits_and_item"});try{sessionStorage.removeItem(Je)}catch{}N(s("buyModal.error.creditsCheckout")),b("error")}}}const L=o==="processing",h=o==="complete"?s("buyModal.titleComplete"):o==="nofunds"?s("buyModal.titleNoFunds"):s("buyModal.titleBuy");return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":s("buyModal.dialogAria",{name:t.name}),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:L?void 0:n,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${o==="processing"||o==="loading"?" buy-modal__card--tall":""}`,children:[e.jsxs("div",{className:"buy-modal__head",children:[e.jsxs("div",{className:"buy-modal__head-row",children:[e.jsx("h2",{className:"buy-modal__title",children:h}),!L&&e.jsx("button",{className:"buy-modal__x",onClick:n,"aria-label":s("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:o==="nofunds"?s("buyModal.dclBalance"):s("buyModal.myCreditsBalance")}),e.jsx(q,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:te(F)})]})]}),o==="loading"&&e.jsx("div",{className:"buy-modal__body buy-modal__processing",children:e.jsx(Ls,{size:44})}),o==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(ye,{message:c}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:n,children:s("buyModal.close")})})]}),o==="nofunds"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(_s,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:s("buyModal.insufficientFunds")})," ",s("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:s("buyModal.warningCreditsAmount",{count:Math.max(0,Q-F)})})," ",s("buyModal.warningToPurchase",{count:1})]})]}),e.jsx(Xe,{item:t,priceCredits:Q}),e.jsx("div",{className:"buy-modal__packs",children:v.map(m=>{const k=m.credits,g=m.id===a;return e.jsxs("button",{className:`buy-modal__pack${g?" buy-modal__pack--on":""}`,onClick:()=>w(m.id),children:[e.jsx(q,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:te(k)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",m.usd.toFixed(2),")"]})]},m.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(q,{className:"buy-modal__total-ico"}),e.jsx("span",{children:te(((B=v.find(m=>m.id===a))==null?void 0:B.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",(((W=v.find(m=>m.id===a))==null?void 0:W.usd)??0).toFixed(2)]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:n,children:s("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:()=>void J(),children:s("buyModal.buy")})]})]}),o==="ready"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(Xe,{item:t,priceCredits:Q}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient buy-modal__btn--full",onClick:()=>void U(),children:s("buyModal.buy")})})]}),o==="processing"&&e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:Es,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:u?s("buyModal.completingPurchase"):s("buyModal.completingTransaction")}),e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]}),o==="complete"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__success",children:[e.jsxs("svg",{viewBox:"0 0 64 64",width:"64",height:"64","aria-hidden":!0,children:[e.jsx("circle",{cx:"32",cy:"32",r:"32",fill:"#34ce74"}),e.jsx("path",{d:"M20 33l8 8 16-18",fill:"none",stroke:"#fff",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round"})]}),e.jsxs("p",{className:"buy-modal__success-text",children:[e.jsx("b",{children:s("getCredits.successTitle")})," ",s("buyModal.successBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:()=>x("/assets?tab=mine"),children:s("buyModal.myAssets")}),e.jsxs("button",{className:"buy-modal__btn buy-modal__btn--ruby",onClick:n,children:[s("buyModal.tryInWorld"),e.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20","aria-hidden":!0,children:e.jsx("path",{d:"M5 12h12M13 7l5 5-5 5",fill:"none",stroke:"#fcfcfc",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})]})]})]})}function Xe({item:t,priceCredits:n}){return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:t.thumbnail?e.jsx("img",{src:t.thumbnail,alt:""}):null}),e.jsxs("div",{className:"buy-modal__asset-info",children:[e.jsxs("div",{children:[e.jsx("div",{className:"buy-modal__asset-name",title:t.name,children:t.name||s("buyModal.itemFallback")}),t.creator?e.jsx(ys,{address:t.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(q,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:te(n)})]})]})]})}const qs=1e3*60*60*24*182;function Ds({asset:t,session:n,onClose:u}){const i=_e(),_=he(),[d,x]=l.useState("10"),[v,o]=l.useState(null),[b,c]=l.useState(null),[N,a]=l.useState(!1),[w,A]=l.useState(null);async function y(){c(null);const f=Number(d);if(!Number.isInteger(f)||f<=0){c(s("sellModal.errorWholeNumber"));return}a(!0);try{o(s("sellModal.statusPreparing")),await Fs({signer:n.signer,contractAddress:t.contractAddress,chainId:t.chainId}),o(s("sellModal.statusListing"));const C=await Ts({signer:n.signer,nft:{contractAddress:t.contractAddress,tokenId:t.tokenId,network:t.network,chainId:t.chainId},usdPrice:f/10,expiresAtMs:Date.now()+qs});o(s("sellModal.statusPublishing")),await Fa(C,n.identity),o(null),A(f),K("Shop Listed Item",{item_id:t.itemId??t.tokenId??null,contract_address:t.contractAddress,price_credits:f,price_usd:f/10,listing_type:"secondary",is_primary:!1}),sa.success(s("sellModal.toastOnSale",{name:t.name})),i.invalidateQueries({queryKey:["my-assets",n.address]})}catch(C){ie(C,{flow:"list_secondary"}),K("Shop Listing Failed",{listing_type:"secondary",error_code:we(C)}),c(Ce(C,s("sellModal.errorGeneric"))),o(null)}finally{a(!1)}}function I(){u(),_(`/item/${t.contractAddress}/${t.tokenId}`)}return w!==null?e.jsx("div",{className:"modal-backdrop",onClick:u,role:"presentation",children:e.jsxs("div",{className:"modal modal--success",onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:s("sellModal.successTitle")}),t.image?e.jsx("img",{className:"modal__img",src:t.image,alt:t.name}):null,e.jsx("p",{className:"modal-success__name",children:t.name}),e.jsxs("p",{className:"muted small",children:[s("sellModal.listedFor")," ",e.jsxs("strong",{children:[e.jsx(q,{className:"ccy-mark"})," ",w]})]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(G,{variant:"ghost",onClick:u,children:s("getCredits.done")}),e.jsx(G,{variant:"purple",onClick:I,children:s("sellModal.viewInShop")})]})]})}):e.jsx("div",{className:"modal-backdrop",onClick:u,role:"presentation",children:e.jsxs("div",{className:"modal","data-testid":"modal",onClick:f=>f.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("h2",{className:"modal__title",children:s("sellModal.listTitle",{name:t.name})}),t.image?e.jsx("img",{className:"modal__img",src:t.image,alt:t.name}):null,e.jsxs("label",{className:"field",children:[e.jsx("span",{children:s("sellModal.priceLabel",{currency:Ie.name})}),e.jsx("input",{type:"number",min:"1",step:"1",value:d,onChange:f=>x(f.target.value),disabled:N})]}),e.jsx("p",{className:"muted small",children:s("sellModal.pricedInWhole",{currency:Ie.name,currencySingular:Ie.nameSingular})}),v?e.jsx("p",{className:"muted",children:v}):null,e.jsx(ye,{message:b}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(G,{variant:"ghost",onClick:u,disabled:N,children:s("sellModal.cancel")}),e.jsx(G,{onClick:()=>void y(),disabled:N,children:N?s("sellModal.listing"):s("sellModal.putOnSale")})]})]})})}const Bs=l.lazy(async()=>{const[{EmoteControls:t},{Experimental_CssVarsProvider:n},{light:u}]=await Promise.all([ke(()=>import("./index-CMI54Xz_.js").then(i=>i.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),ke(()=>import("./index-CPDwm9i3.js"),__vite__mapDeps([11,3,1,2,4,5,6,7,12,9,13,14])),ke(()=>import("./index-JoEf73cu.js"),__vite__mapDeps([15,3,1,2,4,5,6,7,16,14,13,9]))]);return{default:i=>e.jsx(n,{theme:u,children:e.jsx(t,{...i})})}});function $s(t){return e.jsx(l.Suspense,{fallback:null,children:e.jsx(Bs,{...t})})}function Os({item:t}){const n=ee(I=>{var f;return(f=I.session)==null?void 0:f.address}),{data:u,isLoading:i}=Ta(n),_=n&&u?n:"default",d=t.category==="emote",[x,v]=l.useState("item"),o=!d&&x==="item",b=o||!i,[c,N]=l.useState(!0);l.useEffect(()=>{N(!0)},[t.id,o]);const a=!!n&&!!u,w=a&&Ra(t,qa(u)),A=Da(t)[0],y=a&&!w&&!d;return e.jsxs(e.Fragment,{children:[b?e.jsx(Ba,{id:"shop-item-preview",contractAddress:t.contractAddress,tokenId:t.tokenId??void 0,itemId:t.tokenId?void 0:t.itemId??void 0,profile:o?void 0:w?_:"default",bodyShape:o||w?void 0:A,type:d?void 0:o?Z.PreviewType.WEARABLE:Z.PreviewType.AVATAR,emote:d||o?void 0:Z.PreviewEmote.FASHION,disableBackground:!0,wheelZoom:d?1.5:void 0,wheelStart:d?100:void 0,dev:Ae.chainId===80002,onLoad:()=>N(!1)}):null,!b||c?e.jsx("div",{className:"item-preview__loading","aria-busy":"true","aria-label":s("itemPreview.loading"),children:e.jsx("span",{className:"item-preview__spinner","aria-hidden":!0})}):null,y&&!o?e.jsx("p",{className:"item-preview__note",children:s("itemPreview.shownOnBody",{shape:$a(A)})}):null,d?e.jsx("div",{className:"item-preview__emote-controls","data-testid":"emote-controls",children:e.jsx($s,{wearablePreviewId:"shop-item-preview",hideFrameInput:!0})}):e.jsxs("div",{className:"item-preview__toggle",role:"group","aria-label":s("itemPreview.previewMode"),children:[e.jsxs("button",{type:"button",className:x==="avatar"?"is-active":"","aria-pressed":x==="avatar","aria-label":s("itemPreview.onAvatar"),onClick:()=>v("avatar"),children:[e.jsxs("svg",{className:"item-preview__toggle-ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:[e.jsx("circle",{cx:"12",cy:"7.5",r:"4"}),e.jsx("path",{d:"M4 20c0-4.2 3.6-6.5 8-6.5s8 2.3 8 6.5v.5H4z"})]}),e.jsx("span",{className:"item-preview__toggle-label",children:s("itemPreview.onAvatar")})]}),e.jsxs("button",{type:"button",className:x==="item"?"is-active":"","aria-pressed":x==="item","aria-label":s("itemPreview.item"),onClick:()=>v("item"),children:[e.jsx("svg",{className:"item-preview__toggle-ico",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:e.jsx("path",{d:"M8.5 3 3 6l1.8 3.8 2.2-1V21h10V8.8l2.2 1L22 6l-5.5-3a2.6 2.6 0 0 1-4.5 1.4A2.6 2.6 0 0 1 8.5 3z"})}),e.jsx("span",{className:"item-preview__toggle-label",children:s("itemPreview.item")})]})]})]})}const Ze=8,Ks=!1;function Ws(t){return{tradeId:t.tradeId??t.id,listingType:"primary",contractAddress:t.contractAddress,itemId:t.itemId??"",name:t.name,thumbnail:t.thumbnail,rarity:t.rarity,category:t.category,wearableCategory:t.wearableCategory??null,creator:t.creator,manaWei:t.manaWei??"0",available:1,network:t.network,chainId:t.chainId,createdAt:0}}function zs({item:t}){var L;const n=t.contractAddress,u=t.itemId,i=_e(),_=ue(h=>h.add),d=ue(h=>h.items),{session:x}=ee(),v=(L=x==null?void 0:x.address)==null?void 0:L.toLowerCase(),[o,b]=l.useState(null),[c,N]=l.useState(null),[a,w]=l.useState(Ze),{data:A=[],isLoading:y}=R({queryKey:["item-resales",n,u],enabled:!!n&&!!u,queryFn:()=>Oa(n,u)}),I=A.slice(0,a),f=I.map(h=>h.tokenId).filter(h=>!!h),{data:C={}}=R({queryKey:["resale-token-info",n,f.join(",")],enabled:!!n&&f.length>0,staleTime:6e4,queryFn:()=>Ka(n,f)}),{data:Q=[]}=R({queryKey:["item-classic-orders",n,u],enabled:Ks,queryFn:()=>Wa(n,u)}),F=A.some(h=>h.source==="legacy"),{data:U}=na(F);function J(){i.invalidateQueries({queryKey:["item-resales",n,u]})}return y||A.length===0?null:e.jsxs("section",{className:"resales","data-testid":"resales-section",children:[e.jsxs("div",{className:"resales__head",children:[e.jsx("h2",{className:"resales__title",children:s("resales.title")}),e.jsx("p",{className:"resales__subtitle",children:s("resales.subtitle")})]}),A.length>0?e.jsxs(e.Fragment,{children:[e.jsx("ul",{className:"resales__list",children:I.map(h=>{const B=h.source==="legacy",W=d.some(j=>j.id===h.id),m=h.tokenId&&C[h.tokenId]||{},k=m.issuedId??h.issuedId,g=m.seller,M=!!g&&!!v&&g.toLowerCase()===v;return e.jsxs("li",{className:`resales__row${B?" resales__row--legacy":""}`,"data-testid":"resale-row","data-source":h.source,"data-own":M?"true":void 0,children:[h.thumbnail?e.jsx("img",{className:"resales__thumb",src:h.thumbnail,alt:"","aria-hidden":!0}):null,e.jsxs("div",{className:"resales__meta",children:[k?e.jsxs("span",{className:"resales__issued","data-testid":"resale-issued",children:["#",k]}):e.jsx("span",{className:"resales__issued resales__issued--muted",children:s("resales.copy")}),g?e.jsxs("div",{className:"resales__seller","data-testid":"resale-seller",children:[e.jsx("span",{className:"resales__seller-label",children:s("resales.seller")}),e.jsx(ta,{address:g,className:"resales__seller-badge",linkToProfile:!0,hidePrefix:!0})]}):null]}),e.jsxs("div",{className:`resales__price${B?" resales__price--approx":""}`,children:[B?e.jsx("span",{className:"resales__approx","aria-hidden":!0,children:"≈"}):null,e.jsx(q,{className:"resales__diamond"}),e.jsx("span",{className:"resales__price-value",children:te(h.priceCredits)})]}),e.jsx("div",{className:"resales__actions",children:M?e.jsx("span",{className:"chip resales__own-chip","data-testid":"resale-own",children:s("resales.yourListing")}):B?e.jsx("button",{className:"resales__buy",onClick:()=>N(Ws(h)),"aria-label":s("assetCard.buyNow"),"data-testid":"resale-buy",children:s("assetCard.buyNow")}):e.jsxs(e.Fragment,{children:[e.jsxs("button",{className:"resales__add",onClick:()=>_(h,"item_detail"),disabled:W,"aria-label":W?s("assetCard.inCart"):s("assetCard.addToCart"),"data-testid":"resale-add",children:[e.jsx(O,{name:"cart-solid",size:16}),e.jsx("span",{children:W?s("assetCard.inCart"):s("assetCard.addToCart")})]}),e.jsx("button",{className:"resales__buy",onClick:()=>b(h),"aria-label":s("assetCard.buyNow"),"data-testid":"resale-buy",children:s("assetCard.buyNow")})]})})]},h.tradeId??h.id)})}),A.length>a?e.jsx("button",{className:"resales__more",onClick:()=>w(h=>h+Ze),"data-testid":"resale-show-more",children:s("resales.showMore")}):null]}):null,null,o?e.jsx(da,{item:o,onClose:()=>{b(null),J()}}):null,c&&U?e.jsx(ra,{listing:c,rate:U,onClose:()=>N(null),onSold:()=>{N(null),J()}}):null]})}function oa(){return Ae.shopServerUrl||(typeof window<"u"?window.location.origin:"")}async function Vs(t,n,u){const i=new URLSearchParams({contractAddress:t,itemId:n}),_=`${oa()}/notify-requests?${i.toString()}`,d=await ia(_,{method:"GET",identity:u,metadata:{}});if(!d.ok)throw new Error(`getNotifyRequest ${d.status}`);return d.json()}async function Qs(t,n){const u=`${oa()}/notify-requests`,i=await ia(u,{method:"POST",identity:n,metadata:{},headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!i.ok)throw new Error(`createNotifyRequest ${i.status}: ${await i.text()}`);await i.json().catch(()=>{})}function ea(t){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t.trim())}function Us({item:t}){const n=ee(y=>y.session),u=ee(y=>y.signIn),[i,_]=l.useState(""),[d,x]=l.useState(!1),[v,o]=l.useState(!1),[b,c]=l.useState(null),N=!!n&&!!t.contractAddress&&!!t.itemId,{data:a}=R({queryKey:["notify-request",t.contractAddress,t.itemId,n==null?void 0:n.address],enabled:N,queryFn:()=>Vs(t.contractAddress,t.itemId,n.identity)});l.useEffect(()=>{a!=null&&a.email&&_(y=>y||a.email)},[a==null?void 0:a.email]),l.useEffect(()=>{if(!n)return;let y=!1;return za().then(I=>{!y&&I&&_(f=>f||I)}),()=>{y=!0}},[n]);const w=v||!!(a!=null&&a.subscribed);async function A(y){if(y.preventDefault(),!(!n||!t.itemId||!ea(i)||d)){x(!0),c(null);try{await Qs({contractAddress:t.contractAddress,itemId:t.itemId,chainId:t.chainId,email:i.trim()},n.identity),o(!0)}catch(I){ie(I,{flow:"notify-me",contractAddress:t.contractAddress,itemId:t.itemId}),c(s("notifyMe.error"))}finally{x(!1)}}}return n?w?e.jsxs("div",{className:"notify notify__done","data-testid":"notify-subscribed",children:[e.jsx("span",{className:"notify__done-check","aria-hidden":!0,children:e.jsx(O,{name:"check",size:12})}),e.jsx("span",{className:"notify__done-text",children:s("notifyMe.subscribedBody")})]}):e.jsxs("form",{className:"notify",onSubmit:A,"data-testid":"notify",children:[e.jsx("label",{className:"notify__label",htmlFor:"notify-email",children:s("notifyMe.label")}),e.jsxs("div",{className:"notify__row",children:[e.jsx("input",{id:"notify-email",className:"notify__input",type:"email",inputMode:"email",autoComplete:"email",placeholder:s("notifyMe.placeholder"),value:i,onChange:y=>_(y.target.value),"data-testid":"notify-email"}),e.jsx("button",{type:"submit",className:"notify__btn",disabled:!ea(i)||d,"data-testid":"notify-submit",children:d?s("notifyMe.working"):s("notifyMe.cta")})]}),e.jsx(ye,{message:b})]}):e.jsx("div",{className:"notify","data-testid":"notify",children:e.jsx("button",{type:"button",className:"notify__signin",onClick:u,"data-testid":"notify-signin",children:s("notifyMe.signInCta")})})}const Gs=Y.button`
|
|
3
3
|
display: flex;
|
|
4
4
|
align-items: center;
|
|
5
5
|
justify-content: center;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,j as c}from"./react-C51i12iP.js";import{s as u,B as p,t as d}from"./index-
|
|
1
|
+
import{r as l,j as c}from"./react-C51i12iP.js";import{s as u,B as p,t as d}from"./index-BuIf8bJO.js";const a=u.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: center;
|
|
4
4
|
padding: 28px 0 8px;
|