@dcl/shop 0.1.0-29869835587.commit-e6e6578 → 0.1.0-29905759067.commit-1f1fc48
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/{AnimatedBackground-BvysF8a0.js → AnimatedBackground-iuUEWVvX.js} +1 -1
- package/assets/{Assets-DoUIRoSX.js → Assets-Boa_vcsA.js} +48 -48
- package/assets/{Cart-Cyj_u0xP.js → Cart-DmysAv-C.js} +2 -2
- package/assets/{CircularProgress-Bf7cTa84.js → CircularProgress-BbpUGXBC.js} +1 -1
- package/assets/{Collection-BFUSn0Z_.js → Collection-CaNHH8rp.js} +1 -1
- package/assets/{CollectionCarousel-BaK4BZqg.js → CollectionCarousel-DZRKlb8f.js} +1 -1
- package/assets/{Creator-CTfg9WAL.js → Creator-BB_N6Oar.js} +1 -1
- package/assets/{CssVarsProvider-DQXUaIP8.js → CssVarsProvider-CD9SUox4.js} +1 -1
- package/assets/{ExchangeController-H99cRhIr.js → ExchangeController-BWSsNG4e.js} +1 -1
- package/assets/{GetCredits-BqhYAHL0.js → GetCredits-Br21K9mc.js} +1 -1
- package/assets/{HelpersUtil-CN9OoRaT.js → HelpersUtil-Dn9aiv4g.js} +1 -1
- package/assets/{ImportListings-CCQDdZMF.js → ImportListings-BALL6CWe.js} +1 -1
- package/assets/{ItemDetail-C6EEFa3M.js → ItemDetail-B_zPbtC5.js} +2 -2
- package/assets/{LoadMore-QYabEF53.js → LoadMore-DUwOaKdq.js} +1 -1
- package/assets/{MarketCheckout-B1QbAQBC.js → MarketCheckout-DkLDRrfN.js} +3 -3
- package/assets/{MyAssets-gjvqMgx3.js → MyAssets-CTQx_QVe.js} +1 -1
- package/assets/{MyFavorites-CCbFgdqL.js → MyFavorites-DWHAFj8B.js} +1 -1
- package/assets/{MyPurchases-D04-_M8f.js → MyPurchases-BVQzJeQX.js} +1 -1
- package/assets/{NotFound-ViHzr3Nr.js → NotFound-CHQS62la.js} +1 -1
- package/assets/{PrimaryListModal-D6DU8-ZC.js → PrimaryListModal-gfgyzr3S.js} +1 -1
- package/assets/{StoreSettings-BnHjda9z.js → StoreSettings-CRxzmt3b.js} +5 -5
- package/assets/{Success-CbfD54bz.js → Success-cIWboc7p.js} +1 -1
- package/assets/{SwapController-Tfj7j5wZ.js → SwapController-DjGJvhyC.js} +1 -1
- package/assets/{TradeService-kxdTGO_i.js → TradeService-3mwR2v1C.js} +1 -1
- package/assets/{W3MFrameProviderSingleton-BWjqHbac.js → W3MFrameProviderSingleton-CH9k7C8I.js} +3 -3
- package/assets/{WebCryptoP256-8HU24K3x.js → WebCryptoP256-Lp5-qWkz.js} +1 -1
- package/assets/{basic-DX-B5_bS.js → basic-g_xHs-jl.js} +1 -1
- package/assets/{biconomy-DIiiyQwz.js → biconomy-wuZgdDji.js} +1 -1
- package/assets/{buy-C5_gzZWJ.js → buy-CgIgEqv9.js} +1 -1
- package/assets/{buy-gasless-Cxx1jwuH.js → buy-gasless-pwHqA_mF.js} +1 -1
- package/assets/{cart-checkout-C3WNM4cy.js → cart-checkout-vzYBjbSV.js} +1 -1
- package/assets/{categories-DQ55lr2p.js → categories-D5VGMfW4.js} +1 -1
- package/assets/{ccip-BafcYzQ9.js → ccip-B9Wl4rCZ.js} +1 -1
- package/assets/{ccip-CYEnvd4I.js → ccip-DugdnJIL.js} +1 -1
- package/assets/collection-7YyqOIsA.js +1 -0
- package/assets/{controller-B80HcZCL.js → controller-BIXF8m7m.js} +2 -2
- package/assets/{core-BtRDOtev.js → core-CPMlxlfe.js} +4 -4
- package/assets/{custom-DiiPEfeO.js → custom-C8eYncem.js} +1 -1
- package/assets/{data-capture-BFGedRFL.js → data-capture-BT3tUeZ2.js} +1 -1
- package/assets/{decimals-Cdn10TAV.js → decimals-2cHWSu_l.js} +1 -1
- package/assets/{decimals-DCazhsdS.js → decimals-C-EZF79s.js} +1 -1
- package/assets/{detectExtension-BSAkQ0I6.js → detectExtension-C-xKGK-n.js} +1 -1
- package/assets/{email-D8YhsjSC.js → email-DCkZGiuY.js} +1 -1
- package/assets/{embedded-wallet-CIVu6rdk.js → embedded-wallet-BwjbVQqZ.js} +1 -1
- package/assets/{emotion-styled.browser.esm-ClqtCiJQ.js → emotion-styled.browser.esm-CM5xiqPE.js} +1 -1
- package/assets/{engine-DsQHyohE.js → engine-BCIagDLK.js} +1 -1
- package/assets/{errors-BLIsDEoc.js → errors-BVwqXLe5.js} +1 -1
- package/assets/{estimate-l1-fee-Cna0j8C0.js → estimate-l1-fee-kxkgQ66r.js} +1 -1
- package/assets/{eth_estimateGas-A7dV8Dq8.js → eth_estimateGas-rl3D263K.js} +1 -1
- package/assets/{eth_getStorageAt-DVqXAuzZ.js → eth_getStorageAt-IB0eULMI.js} +1 -1
- package/assets/{eth_getTransactionCount-DLrwUt6V.js → eth_getTransactionCount-CtQzPcnF.js} +1 -1
- package/assets/{extractIPFS-Dq1wghef.js → extractIPFS-Cpl91fgz.js} +1 -1
- package/assets/{features-CFz8G3yF.js → features-BlHQSMzN.js} +1 -1
- package/assets/{fetchTokenMetadata-BTRazXId.js → fetchTokenMetadata-DJ4cCYA_.js} +2 -2
- package/assets/{get-ecosystem-wallet-info-B8H2bbhI.js → get-ecosystem-wallet-info-DwdeAhbV.js} +1 -1
- package/assets/{getBalance-BewKvJ6T.js → getBalance-DkBROkHj.js} +1 -1
- package/assets/{getInstalledModules-ByFUGStC.js → getInstalledModules-BfypScWD.js} +1 -1
- package/assets/{getNFT-BuDjU8-b.js → getNFT-Cv97lepQ.js} +2 -2
- package/assets/{getNFT-1nUsfQAJ.js → getNFT-DmshVHQV.js} +1 -1
- package/assets/{getOverlayAlpha-B_CoLTSj.js → getOverlayAlpha-mkhFONg0.js} +1 -1
- package/assets/{hashTypedData-BYNsvxyc.js → hashTypedData-6sx2OuME.js} +1 -1
- package/assets/{hashTypedData-DHR5yJit.js → hashTypedData-C9IqLTPk.js} +1 -1
- package/assets/{import-CWsWpkUA.js → import-Bsky-xMs.js} +1 -1
- package/assets/{in-app-wallet-calls-Fj_OJpWi.js → in-app-wallet-calls-s_cSY41h.js} +1 -1
- package/assets/{index-BCGZozX2.js → index-B0YrK5ZH.js} +1 -1
- package/assets/{index-C_jKIil3.js → index-BB1no6U7.js} +1 -1
- package/assets/{index-CN5ZLDnc.js → index-BDohxhb7.js} +1 -1
- package/assets/{index-Y6b_vUQr.js → index-BLPhH8eL.js} +1 -1
- package/assets/{index-DkfyzgR8.js → index-BU56N61z.js} +1 -1
- package/assets/{index-FUu8bz4c.js → index-BV1TWYA2.js} +1 -1
- package/assets/{index-Cuf2In7m.js → index-Bn_065d4.js} +1 -1
- package/assets/{index-B4p2eLga.js → index-BoxWf2CA.js} +1 -1
- package/assets/{index-DJsdR_Dh.js → index-BwU057Dz.js} +1 -1
- package/assets/{index-B04ndUbB.js → index-BwqmHtXi.js} +2 -2
- package/assets/{index-BSjx8-a9.js → index-BxhrtCIn.js} +1 -1
- package/assets/{index-DfnBxBKK.js → index-C-0iOuYu.js} +1 -1
- package/assets/{index-CzDOjIXr.js → index-C-sj52rG.js} +1 -1
- package/assets/{index-Da6whmyR.js → index-C1J9hW3D.js} +1 -1
- package/assets/{index-Cv6TsksD.js → index-CGUO0Y4Y.js} +1 -1
- package/assets/{index-CcJuo_B4.js → index-CG_iwpLC.js} +1 -1
- package/assets/{index-BufR0bxC.js → index-CHEQB_Cx.js} +1 -1
- package/assets/{index-B4OkjZ5Z.js → index-CPaULSDF.js} +3 -3
- package/assets/{index-C7VPGrdO.js → index-CTWPqZAC.js} +1 -1
- package/assets/{index-Do7lLz-O.js → index-CTwvZCoF.js} +1 -1
- package/assets/{index-mfpj9mGL.js → index-CYcVlGMR.js} +1 -1
- package/assets/{index-Cr7q_wI-.js → index-CjzqNOFR.js} +1 -1
- package/assets/{index-BQwZ_U1w.js → index-Co5hU_e6.js} +1 -1
- package/assets/{index-tKIgdudq.js → index-CrdpO7C8.js} +1 -1
- package/assets/{index-PGZV0u8x.js → index-CsD_onu6.js} +1 -1
- package/assets/{index-CtzfdSwK.js → index-CxFzTyPL.js} +1 -1
- package/assets/{index-BBuZMaWr.js → index-CxiM65Mp.js} +10 -10
- package/assets/{index-Cmi7sq59.js → index-DEyKdf7n.js} +1 -1
- package/assets/{index-BMFRmVon.js → index-DHmaSZRj.js} +1 -1
- package/assets/{index-CXYokVDz.js → index-DVePmEob.js} +1 -1
- package/assets/{index--JSSHFMQ.js → index-DaAuLTDJ.js} +1 -1
- package/assets/{index-BDfpUFpd.js → index-DcTQA0a2.js} +1 -1
- package/assets/{index-fOZ3JG1l.js → index-DcsTTH3Q.js} +1 -1
- package/assets/{index-gvpjFbR1.js → index-DdkbGf7r.js} +1 -1
- package/assets/{index-CaHcCfyv.js → index-DdxPPzlC.js} +1 -1
- package/assets/{index-CTwiT5J0.js → index-DgiZIEtb.js} +1 -1
- package/assets/{index-CWuMb79R.js → index-DiC-MoGd.js} +3 -3
- package/assets/{index-nRbKhfJe.js → index-DkJQfwjP.js} +2 -2
- package/assets/{index-CwWLPHI8.js → index-DmHTXw6k.js} +1 -1
- package/assets/{index-B3vzzuVP.js → index-DmTT-8Pb.js} +1 -1
- package/assets/{index-BtmcJRGy.js → index-Dv5PeJiX.js} +1 -1
- package/assets/{index-BDRB8FDm.js → index-I6QJl4JU.js} +1 -1
- package/assets/{index-goSkKmOv.js → index-LP7qradW.js} +1 -1
- package/assets/{index-Dhu9IXc1.js → index-S-phlU07.js} +1 -1
- package/assets/{index-BmxotHif.js → index-dYKVGrG9.js} +1 -1
- package/assets/{index-Cuq6iGY1.js → index-dysXdEH6.js} +1 -1
- package/assets/{index-g3sxw2b2.js → index-ntwLOBCc.js} +2 -2
- package/assets/{index-CdfmzGmf.js → index-pgEJuCvY.js} +1 -1
- package/assets/{index-BuMOiAUw.js → index-t2OgUZgI.js} +1 -1
- package/assets/{index-07n_zhYq.js → index-xIavEcfj.js} +1 -1
- package/assets/{index-2yTqM9xZ.js → index-yfYb8KLO.js} +1 -1
- package/assets/{index.es-Dvmu0NoU.js → index.es-DaC3JFFU.js} +4 -4
- package/assets/{index.es-CiHN99GO.js → index.es-KR7fFIjl.js} +1 -1
- package/assets/{index.es-BsTkmkjS.js → index.es-_UBQCq8d.js} +1 -1
- package/assets/{loader-logo-CK-TcJ-S.js → loader-logo-CmjwjqNs.js} +1 -1
- package/assets/{localBatchGatewayRequest-Cej95COc.js → localBatchGatewayRequest-p2Ks9d9x.js} +1 -1
- package/assets/{mana-rate-Disk-ReT.js → mana-rate-BSdhcAxH.js} +1 -1
- package/assets/{networks-Dapm2cWP.js → networks-DeWfvl_y.js} +1 -1
- package/assets/{onramp-DLQLHSLI.js → onramp-DRTE3n_-.js} +1 -1
- package/assets/{openzeppelin-B2ua0Itn.js → openzeppelin-CnjCMhne.js} +1 -1
- package/assets/{ownerOf-DOppg2jR.js → ownerOf-LGp4E5X6.js} +1 -1
- package/assets/{parseNft-D_8M9mfO.js → parseNft-ZibRZ1De.js} +2 -2
- package/assets/{parseSignature-O3FZfUUc.js → parseSignature-BVSxuf_G.js} +1 -1
- package/assets/{parseSignature-BUx9b-zW.js → parseSignature-qW8HDWC-.js} +3 -3
- package/assets/{pay-with-exchange-DaiVhZAg.js → pay-with-exchange-D01MHjgZ.js} +1 -1
- package/assets/{qr-overlay-CGmkZvV0.js → qr-overlay-BYvxaKdb.js} +1 -1
- package/assets/{receive-DVL3YCyE.js → receive-CqdylKzQ.js} +1 -1
- package/assets/{resolveImplementation-06H3horI.js → resolveImplementation-6K4nQmoD.js} +1 -1
- package/assets/{rpc-q1fg-PaK.js → rpc-CFw65GwW.js} +1 -1
- package/assets/{secp256k1-Dj-unqH_.js → secp256k1-Bn6bifwd.js} +1 -1
- package/assets/{secp256k1-DT5nTJQH.js → secp256k1-DHZdqghI.js} +1 -1
- package/assets/{secp256k1-D6rN1PGV.js → secp256k1-_DgqGs2V.js} +1 -1
- package/assets/{send-CjhoocaG.js → send-XfLoBs9R.js} +1 -1
- package/assets/{send-batch-transaction-Bbiva6rb.js → send-batch-transaction-BXPWrXSK.js} +1 -1
- package/assets/{send-eip712-transaction-NxK7USDp.js → send-eip712-transaction-4z6WNabr.js} +2 -2
- package/assets/{send-gasless-transaction-x5mofsoE.js → send-gasless-transaction-BcnQyjxj.js} +2 -2
- package/assets/{sendRawTransaction-CxX-WJOv.js → sendRawTransaction-GKBmcmEE.js} +3 -3
- package/assets/{serializeTransaction-KtBgxNjB.js → serializeTransaction-3d8pZ0Iy.js} +1 -1
- package/assets/{session-proposal-KoaDAo-a.js → session-proposal-B5ZHcD2T.js} +1 -1
- package/assets/{session-request-CSef7ndM.js → session-request-CAaoIKVS.js} +2 -2
- package/assets/{sha256-DkPvB4om.js → sha256-Dj7svQcS.js} +1 -1
- package/assets/{signing-B9F_g0GG.js → signing-CE_zI5_x.js} +4 -4
- package/assets/{socials-BqxUUXtR.js → socials-5v3xVdXT.js} +1 -1
- package/assets/{swaps-EDZta6zk.js → swaps-8AiJfIFs.js} +1 -1
- package/assets/{thirdweb-D99mQjH-.js → thirdweb-RN8sw7m_.js} +3 -3
- package/assets/{totalSupply-BhpAtMjH.js → totalSupply-CokjmPid.js} +1 -1
- package/assets/{trade-encoding-CWytSFjw.js → trade-encoding-D-nmkwVz.js} +1 -1
- package/assets/{transactionReceipt-OilL7-NS.js → transactionReceipt-CXYiDrev.js} +1 -1
- package/assets/{transactions-CGvL3Aj1.js → transactions-DtyT5OjZ.js} +1 -1
- package/assets/useInfiniteGrid-DMPijgdc.js +1 -0
- package/assets/{useStore-CQIJvFZA.js → useStore-B_g31vF6.js} +1 -1
- package/assets/{useTheme-6tr3eE7K.js → useTheme-BNMMOZXE.js} +1 -1
- package/assets/useTheme-Dym7bhKm.js +1 -0
- package/assets/{verifyHash-2hJaw2xF.js → verifyHash-Bm1x5_X2.js} +1 -1
- package/assets/{w3m-modal-DZpfNka8.js → w3m-modal-CvxdzPI1.js} +1 -1
- package/assets/{w3m-modal-CXTIrAhw.js → w3m-modal-DASeu1UW.js} +1 -1
- package/assets/{wait-for-tx-receipt-Dt-8wYDQ.js → wait-for-tx-receipt-B0NrXGCa.js} +1 -1
- package/assets/{wallets-v6YyPYY8.js → wallets-DOy020MN.js} +6 -6
- package/assets/{web-connector-DBKfHuJF.js → web-connector-BDLq1v7V.js} +3 -3
- package/assets/{writeContract-CJkUo9D7.js → writeContract-CvT6Z86X.js} +1 -1
- package/assets/{zoraTestnet-CRD_79WO.js → zoraTestnet-hCARxX58.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/assets/collection-DHOETntw.js +0 -1
- package/assets/useInfiniteGrid-CpiD11c4.js +0 -1
- package/assets/useTheme-Dpdkvivv.js +0 -1
|
@@ -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{ax as oe,ay as ce,
|
|
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{ax as oe,ay as ce,ak as le,t as a,az as E,B as ne,a3 as z,b as ie,I,g as de,u as me,A as ue,ao as he,aA as ge,h as xe}from"./index-CxiM65Mp.js";import{d as _e,g as pe,a as Ne,A as je}from"./collection-7YyqOIsA.js";import{u as be,L as fe}from"./useStore-B_g31vF6.js";import{s as D}from"./address-DrURAr9O.js";import{S as $,C as ve,c as w,F as Ce,e as we,d as ke}from"./categories-D5VGMfW4.js";import{L as B}from"./LoadMore-DUwOaKdq.js";import{u as R}from"./useInfiniteGrid-DMPijgdc.js";import{E as T}from"./ErrorNotice-C7soUjRV.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-BeFqf2KO.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 ye({address:t,className:r=""}){const o=E(m=>m.followed.includes(t.toLowerCase())),n=E(m=>m.toggle);return t?e.jsx(ne,{type:"button",size:"sm",variant:o?"ghost":"outline",className:r||void 0,"aria-pressed":o,title:o?a("creator.unfollowTitle"):a("creator.followTitle"),onClick:()=>n(t),children:o?a("creator.following"):a("creator.follow")}):null}const Se={website:"website",twitter:"twitter",discord:"discord",facebook:"facebook"};function Le({address:t}){var d,b;const{data:r}=z(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)||D(t),x=(b=(d=r==null?void 0:r.avatar)==null?void 0:d.snapshots)==null?void 0:b.face256,N=(o==null?void 0:o.cover)||_e,i=o==null?void 0:o.description,p=`${de.profileUrl}/${t}`,h=fe.filter(l=>o==null?void 0:o.links[l]),_=pe(Ne({name:r==null?void 0:r.name,hasClaimedName:r==null?void 0:r.hasClaimedName,ethAddress:(r==null?void 0:r.ethAddress)??t}));return e.jsxs("section",{className:"creator-hero","aria-label":`${g} storefront`,children:[e.jsxs("div",{className:"creator-hero__cover",children:[e.jsx("img",{className:"creator-hero__cover-img",src:N,alt:"",loading:"eager"}),e.jsx("div",{className:"creator-hero__scrim","aria-hidden":!0})]}),(h.length>0||m)&&e.jsxs("div",{className:"creator-hero__links",children:[h.map(l=>e.jsx("a",{className:"creator-hero__link","data-testid":"creator-hero-link",href:(o==null?void 0:o.links[l])??"",target:"_blank",rel:"noopener noreferrer",title:a(`creator.link.${l}`),"aria-label":a(`creator.link.${l}`),children:e.jsx(I,{name:Se[l]})},l)),m&&e.jsx(re,{className:"creator-hero__link creator-hero__edit",to:"/store-settings",title:a("creator.editStore"),"aria-label":a("creator.editStore"),children:e.jsx(I,{name:"pen"})})]}),e.jsxs("div",{className:"creator-hero__body",children:[x?e.jsx("img",{className:"creator-hero__ava",src:x,alt:"",loading:"eager",style:{backgroundColor:_}}):e.jsx("span",{className:"creator-hero__ava creator-hero__ava--ph","aria-hidden":!0,style:{backgroundColor:_}}),e.jsxs("div",{children:[e.jsx("h2",{className:"creator-hero__name",children:g}),i?e.jsx("p",{className:"creator-hero__desc",children:i}):null]}),e.jsxs("div",{className:"creator-hero__actions",children:[e.jsx("a",{className:"creator-hero__view","data-testid":"creator-hero-view",href:p,target:"_blank",rel:"noopener noreferrer",children:a("creator.viewProfile")}),e.jsx(ye,{address:t,className:"creator-hero__follow"})]})]})]})}const U=48;function Ge(){const{address:t}=se(),r=K(),[o]=te(),n=o.has("collections"),{data:m}=z(t),g=(m==null?void 0:m.name)||(t?D(t):a("creator.fallbackName"));me({title:g,description:a("seo.creator.description",{name:g})});const[x,N]=j.useState("wearable"),[i,p]=j.useState(null),[h,_]=j.useState([]),[d,b]=j.useState(""),[l,f]=j.useState(""),[P,O]=j.useState("newest"),y=d&&!Number.isNaN(Number(d))?Number(d):void 0,S=l&&!Number.isNaN(Number(l))?Number(l):void 0,G=i?ke[i]:void 0,H=($.find(s=>s.key===P)??$[0]).server,L={creator:t,category:x,rarities:h.length?h:void 0,wearableCategories:G,minPriceCredits:y,maxPriceCredits:S,sortBy:H},{items:v,total:Y,isLoading:C,error:A,hasNextPage:W,isFetchingNextPage:F,fetchNextPage:Z}=R(["creator-listings",L],s=>he({...L,first:U,skip:s}),{enabled:!!t&&!n}),u=R(["creator-collections",t],s=>ge(t,{first:U,skip:s}).then(c=>({items:c.collections,total:c.total})),{enabled:!!t&&n});function q(s){N(s),p(null),n&&M()}function M(){const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}`:""},{replace:!0})}function J(){if(n){M();return}const s=new URLSearchParams(o);s.delete("collections");const c=s.toString();r({search:c?`?${c}&collections`:"?collections"},{replace:!0})}function Q(s){_(c=>c.includes(s)?c.filter(ae=>ae!==s):[...c,s])}function V(){N("wearable"),p(null),_([]),b(""),f("")}const k=!!(y||S),X=k?`${d||"0"}–${l||"∞"}`:a("filter.price"),ee=x!=="wearable"||!!i||h.length>0||k;return e.jsxs("div",{className:"collection-page",children:[e.jsxs("nav",{className:"collection-page__crumbs","aria-label":a("creator.breadcrumbAria"),children:[e.jsx("button",{className:"collection-page__crumb-link",onClick:()=>r("/assets"),children:a("creator.breadcrumb")}),e.jsx("span",{className:"collection-page__crumb-sep",children:"/"}),e.jsx("span",{className:"collection-page__crumb-current",children:g})]}),t?e.jsx(Le,{address:t}):null,!n&&!C&&v.length>0?e.jsx(je,{items:v,source:"creator"}):null,e.jsxs("div",{className:"browse browse--sidebar",children:[e.jsx("aside",{className:"browse__sidebar",children:e.jsx(ve,{category:x,subCategory:i,onCategory:q,onSub:p,title:a("creator.category"),flat:!0,collections:n,onCollections:J})}),e.jsx("div",{className:"browse__main",children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"creator-collections__bar",children:e.jsx("span",{className:"assets__count",children:u.isLoading?"…":a("creator.collectionsCount",{count:u.total})})}),u.error?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid grid--collections",children:u.isLoading?e.jsx(w,{count:9}):e.jsxs(e.Fragment,{children:[u.items.map(s=>e.jsx(Pe,{collection:s,itemCount:s.itemCount},s.contractAddress)),u.isFetchingNextPage?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:u.hasNextPage,isFetching:u.isFetchingNextPage,onLoadMore:()=>void u.fetchNextPage()}),!u.isLoading&&!u.error&&u.items.length===0?e.jsx("p",{className:"muted",children:a("creator.collectionsEmpty")}):null]}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{rarities:h,onToggleRarity:Q,sort:P,onSort:O,total:Y,loading:C,anyActive:ee,onClear:V,renderTrailing:s=>e.jsx(we,{panelKey:"price",label:X,active:k,panel:s,children:e.jsxs("div",{className:"filter-pop filter-pop--price",children:[e.jsxs("div",{className:"filter-pop__price-row",children:[e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMin"),placeholder:a("creator.priceMinPlaceholder"),value:d,onChange:c=>b(c.target.value)}),e.jsx("span",{children:"–"}),e.jsx("input",{type:"number",min:"0","aria-label":a("creator.priceMax"),placeholder:a("creator.priceMaxPlaceholder"),value:l,onChange:c=>f(c.target.value)})]}),e.jsx("p",{className:"filter-pop__hint",children:a("creator.priceHint",{currency:xe.name})})]})})}),A?e.jsx(T,{message:a("creator.error")}):null,e.jsx("div",{className:"grid",children:C?e.jsx(w,{count:15}):e.jsxs(e.Fragment,{children:[v.map(s=>e.jsx(ue,{item:s},s.id)),F?e.jsx(w,{count:6}):null]})}),e.jsx(B,{hasNextPage:W,isFetching:F,onLoadMore:()=>void Z()}),!C&&!A&&v.length===0?e.jsx("p",{className:"muted",children:a("creator.empty")}):null]})})]})]})}export{Ge as Creator,Ge as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b9 as U,ba as Ue,E as C,bb as qe,bc as Ye,O as Qe,bd as Je,aY as Xe,D as R,b1 as K,b0 as Te,be as a,bf as Ze,bg as Le,T as et,b7 as tt}from"./index-
|
|
1
|
+
import{b9 as U,ba as Ue,E as C,bb as qe,bc as Ye,O as Qe,bd as Je,aY as Xe,D as R,b1 as K,b0 as Te,be as a,bf as Ze,bg as Le,T as et,b7 as tt}from"./index-CxiM65Mp.js";import{R as rt,g as ot}from"./getOverlayAlpha-mkhFONg0.js";import{j as T,r as y}from"./react-C51i12iP.js";import{u as nt,a as Be}from"./useTheme-BNMMOZXE.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-CH9k7C8I.js";import{g as T,a as W,f as b,b as _,c as v}from"./index-CPaULSDF.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{u as H,t as s,b as Q,n as V,o as g,h as d,m as P,X as I,C as W,
|
|
1
|
+
import{u as $,b as q,r as i,j as e}from"./react-C51i12iP.js";import{u as H,t as s,b as Q,n as V,o as g,h as d,m as P,X as I,C as W,ad as z}from"./index-CxiM65Mp.js";import{R as G}from"./resume-buy-Bf0zIH7y.js";import{R as D}from"./cart-checkout-vzYBjbSV.js";import{u as J,p as X,c as Z,l as ee,i as se}from"./loader-logo-CmjwjqNs.js";import{C as te}from"./CircularProgress-BbpUGXBC.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-BeFqf2KO.js";import"./intl-CBcMB1D2.js";const x="https://cdn.decentraland.org/@dcl/shop/0.1.0-29905759067.commit-1f1fc48/assets/pack-chips--HnOpf5U.webp",re="https://cdn.decentraland.org/@dcl/shop/0.1.0-29905759067.commit-1f1fc48/assets/credit-coin-CmcTCd5i.webp",ae="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",C=se()?"mock":"stripe",ce={pack_5:x,pack_10:x,pack_25:x,pack_50:x},ne="https://docs.decentraland.org";function M(o){const r=o;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 xe(){H({title:s("nav.getCredits",{currency:d.name}),noindex:!0});const o=$(),{session:r,signIn:m}=Q(),n=V(),[k,S]=q(),{packs:F,isLoading:T}=J(),[p,l]=i.useState("select"),[c,w]=i.useState(null),[E,R]=i.useState(null),[U,_]=i.useState(null),[K,N]=i.useState(!1),f=i.useRef(null);i.useEffect(()=>()=>{var t;return(t=f.current)==null?void 0:t.abort()},[]);const L=i.useCallback(()=>{S(t=>{const a=new URLSearchParams(t);return a.delete("order"),a.delete("canceled"),a},{replace:!0})},[S]),b=i.useCallback(async t=>{l("processing");const a=new AbortController;f.current=a;try{const u=await X(t,{signal:a.signal,address:r==null?void 0:r.address,identity:r==null?void 0:r.identity});if(u.status==="credited"){const j=u.creditsGranted??(c==null?void 0:c.credits)??0;R(j>0?j:null),l("success"),g("Shop Completed Buy Credits",{order_id:t,pack_usd:(c==null?void 0:c.usd)??null,credits:j>0?j:null,provider:C}),n.invalidateQueries({queryKey:["usd-balance"]});try{if(sessionStorage.getItem(D)){o("/cart",{state:{resumeCheckout:!0}});return}}catch{}try{const A=sessionStorage.getItem(G);if(A){sessionStorage.removeItem(G);const h=JSON.parse(A),B=h.tokenId??h.itemId;if(h.contractAddress&&B){o(`/item/${h.contractAddress}/${B}`,{state:{item:h,resumeBuy:!0}});return}}}catch{}}else u.status==="pending"?(g("Shop Buy Credits Pending",{step:"grant",pack_usd:(c==null?void 0:c.usd)??null}),n.invalidateQueries({queryKey:["usd-balance"]}),l("pending")):(g("Shop Buy Credits Failed",{step:"grant",error_code:"grant_failed",pack_usd:(c==null?void 0:c.usd)??null}),_(u.error??s("getCredits.errorGrant",{currency:d.name})),l("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:(c==null?void 0:c.usd)??null}),_(M(u)),l("error")}},[c,r,n,o]),O=i.useCallback(async t=>{if(!r){m();return}_(null),N(!1),w(t),l(C==="mock"?"processing":"redirecting"),g("Shop Started Buy Credits",{pack_usd:t.usd,credits:t.credits,provider:C});try{const a=await Z(t.id,{address:r.address,identity:r.identity});if(a.mock)b(a.orderId);else if(a.url)g("Shop Redirected To Stripe",{order_id:a.orderId,pack_usd:t.usd,credits:t.credits}),window.location.href=a.url;else throw new Error("Checkout did not return a redirect url")}catch(a){P(a,{flow:"get_credits",step:"checkout",provider:C}),g("Shop Buy Credits Failed",{step:"checkout",error_code:I(a),pack_usd:t.usd}),_(M(a)),l("error")}},[r,m,b]),y=i.useRef(!1);i.useEffect(()=>{if(y.current)return;const t=k.get("order");if(k.get("canceled")!=null){y.current=!0,g("Shop Buy Credits Cancelled",{order_id:t,provider:C}),L(),N(!0),l("select");return}t&&(l("processing"),r&&(y.current=!0,L(),b(t)))},[k,r]);function v(){var t;(t=f.current)==null||t.abort(),l("select"),w(null),R(null),_(null),N(!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:ee,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:ae,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})]})]}),E!=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:E,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:v,children:s("getCredits.buyMore",{currency:d.name})}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--solid",onClick:()=>o("/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:()=>o("/assets"),children:s("getCredits.startShopping")}),e.jsx("button",{className:"gc-actions__btn gc-actions__btn--outline",onClick:v,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:v,children:s("getCredits.tryAgain")})})]})]})}function ie({packs:o,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:o.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:ce[n.id]??x,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{xe as GetCredits,xe 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-Co5hU_e6.js";import{d as g,r as v}from"./index-CPaULSDF.js";import{C as c}from"./ConstantsUtil-CJUlyS7R.js";import{R as $,O as u}from"./W3MFrameProviderSingleton-CH9k7C8I.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{t as s,h as w,B as k,C as L,o as $,m as A,u as P,b as U,n as W,c as O,s as Q,r as z}from"./index-
|
|
1
|
+
import{u as K,r as u,j as e,L as B}from"./react-C51i12iP.js";import{t as s,h as w,B as k,C as L,o as $,m as A,u as P,b as U,n as W,c as O,s as Q,r as z}from"./index-CxiM65Mp.js";import{i as Y,R as D,f as G}from"./import-Bsky-xMs.js";import{s as H}from"./wallet-kind-B9P1TeIH.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-BeFqf2KO.js";import"./intl-CBcMB1D2.js";import"./buy-CgIgEqv9.js";import"./trade-encoding-D-nmkwVz.js";import"./index-HN6Rk25C.js";import"./mana-rate-BSdhcAxH.js";function J({queue:n,session:T,onClose:j,onDone:h}){const N=K(),d=H(T.providerType),[m,f]=u.useState(()=>n.map(()=>"pending")),[I,M]=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),$("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||M("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 pe,r as c,j as e,d as ua,a as ha,L as _a}from"./react-C51i12iP.js";import{b as Y,ae as ya,n as Ge,t,ap as pa,i as fa,j as ba,ai as xa,af as ie,o as V,X as Re,aj as _e,aq as ja,m as le,C as M,am as ne,_ as ye,a3 as va,a6 as ga,a5 as Na,aC as wa,a9 as ka,g as fe,aD as Ca,W as He,c as R,aE as Ia,I as F,a2 as O,s as z,aF as Aa,aG as Sa,aH as Ma,ab as Pa,ak as qe,a as $e,aI as Ea,aJ as Fa,aK as La,aL as Da,aM as Ta,al as Ba,u as Ra,aN as qa,aO as $a,aP as Oa,an as za,aQ as Oe,aR as Ka,B as be,e as Wa,r as Va,av as Qa,aS as Ua,aT as Ga,aw as Ha,aU as Ja,aV as Ya}from"./index-BBuZMaWr.js";import{d as Q}from"./dcl-schemas-BICTSpB5.js";import{b as ze,c as Xa}from"./buy-C5_gzZWJ.js";import{S as Za,P as et,f as at}from"./PrimaryListModal-D6DU8-ZC.js";import{g as tt,b as st,w as it,S as rt,G as nt}from"./buy-gasless-Cxx1jwuH.js";import{u as lt,l as dt,c as ot}from"./loader-logo-CK-TcJ-S.js";import{R as Ke}from"./resume-buy-Bf0zIH7y.js";import{a as ct,f as We,i as mt}from"./errors-BLIsDEoc.js";import{E as xe}from"./ErrorNotice-C7soUjRV.js";import{C as ut}from"./CircularProgress-Bf7cTa84.js";import{T as Je,u as ht,M as _t}from"./MarketCheckout-B1QbAQBC.js";import{s as yt}from"./address-DrURAr9O.js";import{C as pt}from"./CollectionCarousel-BaK4BZqg.js";import"./sentry-DKBoGDXH.js";import"./ethers-BeFqf2KO.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-CWytSFjw.js";import"./index-HN6Rk25C.js";import"./wallet-kind-B9P1TeIH.js";import"./mana-rate-Disk-ReT.js";import"./emotion-CSxEP8yM.js";function ft({item:s,onClose:n,resume:i=!1}){var Z,ee;const{session:d}=Y(),{data:o}=ya(d),h=Ge(),v=pe(),x=lt().packs.slice(0,3),[m,l]=c.useState("loading"),[a,k]=c.useState(null),[y,g]=c.useState(""),[L,f]=c.useState(s.priceCredits),[p,D]=c.useState(null),P=c.useRef(null),I=(p==null?void 0:p.credits)??L,X=(o==null?void 0:o.credits)??0;c.useEffect(()=>{let u=!1;if(!d){l("error"),k(t("buyModal.signInToCheckout"));return}const N=_=>{const w=_-((o==null?void 0:o.credits)??0),b=x.find(T=>T.credits>=w)??x[x.length-1];g(b.id),V("Shop Buy Credits Prompted",{from:"item_checkout",credits_needed:_,credits_balance:(o==null?void 0:o.credits)??0,shortfall:Math.max(0,w)}),l("nofunds")};return(async()=>{var _,w;try{const b=await pa(s);if(!b)throw new Error("not for sale");if(fa(b,d.address))throw new Error("You can't buy your own listing.");const T=ba((w=(_=b.received)==null?void 0:_[0])==null?void 0:w.amount);if(!Number.isFinite(T)||T<=0)throw new Error("price unavailable");const K=Math.ceil(T/10);if(u)return;if(f(K),o!=null&&o.credits<K){N(K);return}try{const{credit:C,maxCreditedValue:G,usdCents:$}=await xa(d.identity,T,b.id);if(u){ie(d.identity,[C.id]).catch(()=>{});return}P.current=C.id;const ae=Math.ceil($/10);f(ae);const W={trade:b,credit:C,maxCreditedValue:G,usdCents:$,credits:ae};D(W),i?U(W):l("ready")}catch(C){if(u)return;if(ct(C)){N(K);return}throw C}}catch(b){if(u)return;V(_e(b)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:Re(b)}),l("error"),k(We(b,t("buyModal.error.generic"),{sale:!0}))}})(),()=>{u=!0,P.current&&d&&(ie(d.identity,[P.current]).catch(()=>{}),P.current=null)}},[]);async function U(u=p){if(!d||!u)return;l("processing"),k(null);let N=!1;try{const _={trade:u.trade,buyer:d.address,signer:d.signer,credits:[u.credit],maxCreditedValue:u.maxCreditedValue};let w;if(tt())try{w=await st(_),await it(w),N=!0}catch(b){if(b instanceof rt)N=!0;else if(b instanceof nt)w=await ze(_);else throw b}else w=await ze(_);P.current=null,V("Shop Completed Purchase",{...ja([s]),payment_type:"credits",no_crypto_step:N,transaction_hash:w??null}),h.invalidateQueries({queryKey:["usd-balance"]}),l("complete")}catch(_){_e(_)||le(_,{flow:"buy",step:"submit",gasless:N}),ie(d.identity,[u.credit.id]).catch(()=>{}),P.current=null,V(_e(_)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:Re(_)}),h.invalidateQueries({queryKey:["usd-balance"]}),k(We(_,t("buyModal.error.generic"),{sale:!0})),l("error")}}async function de(){if(!(!y||!d)){try{sessionStorage.setItem(Ke,JSON.stringify(s))}catch{}p&&ie(d.identity,[p.credit.id]).catch(()=>{}),P.current=null,l("loading");try{const u=await ot(y,{address:d.address,identity:d.identity});if(u.url){window.location.href=u.url;return}v("/credits")}catch(u){le(u,{flow:"buy_credits_and_item"});try{sessionStorage.removeItem(Ke)}catch{}k(t("buyModal.error.creditsCheckout")),l("error")}}}const q=m==="processing",E=m==="complete"?t("buyModal.titleComplete"):m==="nofunds"?t("buyModal.titleNoFunds"):t("buyModal.titleBuy");return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":t("buyModal.dialogAria",{name:s.name}),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:q?void 0:n,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${m==="processing"||m==="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:E}),!q&&e.jsx("button",{className:"buy-modal__x",onClick:n,"aria-label":t("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:m==="nofunds"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(M,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:ne(X)})]})]}),m==="loading"&&e.jsx("div",{className:"buy-modal__body buy-modal__processing",children:e.jsx(ut,{size:44})}),m==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(xe,{message:a}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:n,children:t("buyModal.close")})})]}),m==="nofunds"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:"buy-modal__warning-ico",children:[e.jsx("path",{d:"M12 3L2 20h20L12 3z",fill:"none",stroke:"#691fa9",strokeWidth:"1.8",strokeLinejoin:"round"}),e.jsx("path",{d:"M12 9v5",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"17",r:"1.1",fill:"#691fa9"})]}),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,I-X)})})," ",t("buyModal.warningToPurchase",{count:1})]})]}),e.jsx(Ve,{item:s,priceCredits:I}),e.jsx("div",{className:"buy-modal__packs",children:x.map(u=>{const N=u.credits,_=u.id===y;return e.jsxs("button",{className:`buy-modal__pack${_?" buy-modal__pack--on":""}`,onClick:()=>g(u.id),children:[e.jsx(M,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:ne(N)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",u.usd.toFixed(2),")"]})]},u.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(M,{className:"buy-modal__total-ico"}),e.jsx("span",{children:ne(((Z=x.find(u=>u.id===y))==null?void 0:Z.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",(((ee=x.find(u=>u.id===y))==null?void 0:ee.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:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:()=>void de(),children:t("buyModal.buy")})]})]}),m==="ready"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(Ve,{item:s,priceCredits:I}),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:t("buyModal.buy")})})]}),m==="processing"&&e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:dt,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:i?t("buyModal.completingPurchase"):t("buyModal.completingTransaction")}),e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]}),m==="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:t("getCredits.successTitle")})," ",t("buyModal.successBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:()=>v("/assets?tab=mine"),children:t("buyModal.myAssets")}),e.jsxs("button",{className:"buy-modal__btn buy-modal__btn--ruby",onClick:n,children:[t("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 Ve({item:s,priceCredits:n}){return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:s.thumbnail?e.jsx("img",{src:s.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:s.name,children:s.name||t("buyModal.itemFallback")}),s.creator?e.jsx("div",{className:"buy-modal__asset-creator",children:t("search.byCreator",{name:s.creator})}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(M,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:ne(n)})]})]})]})}const bt=c.lazy(async()=>{const[{EmoteControls:s},{Experimental_CssVarsProvider:n},{light:i}]=await Promise.all([ye(()=>import("./index-CtzfdSwK.js").then(d=>d.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),ye(()=>import("./index-DfnBxBKK.js"),__vite__mapDeps([11,3,1,2,4,5,6,7,12,9,13,14])),ye(()=>import("./index-BDfpUFpd.js"),__vite__mapDeps([15,3,1,2,4,5,6,7,16,14,13,9]))]);return{default:d=>e.jsx(n,{theme:i,children:e.jsx(s,{...d})})}});function xt(s){return e.jsx(c.Suspense,{fallback:null,children:e.jsx(bt,{...s})})}function jt({item:s}){const n=Y(p=>{var D;return(D=p.session)==null?void 0:D.address}),{data:i,isLoading:d}=va(n),o=n&&i?n:"default",h=s.category==="emote",[v,x]=c.useState("item"),m=!h&&v==="item",l=m||!d,[a,k]=c.useState(!0);c.useEffect(()=>{k(!0)},[s.id,m]);const y=!!n&&!!i,g=y&&ga(s,Na(i)),L=wa(s)[0],f=y&&!g&&!h;return e.jsxs(e.Fragment,{children:[l?e.jsx(ka,{id:"shop-item-preview",contractAddress:s.contractAddress,tokenId:s.tokenId??void 0,itemId:s.tokenId?void 0:s.itemId??void 0,profile:m?void 0:g?o:"default",bodyShape:m||g?void 0:L,type:h?void 0:m?Q.PreviewType.WEARABLE:Q.PreviewType.AVATAR,emote:h||m?void 0:Q.PreviewEmote.FASHION,disableBackground:!0,wheelZoom:h?1.5:void 0,wheelStart:h?100:void 0,dev:fe.chainId===80002,onLoad:()=>k(!1)}):null,!l||a?e.jsx("div",{className:"item-preview__loading","aria-busy":"true","aria-label":t("itemPreview.loading"),children:e.jsx("span",{className:"item-preview__spinner","aria-hidden":!0})}):null,f&&!m?e.jsx("p",{className:"item-preview__note",children:t("itemPreview.shownOnBody",{shape:Ca(L)})}):null,h?e.jsx("div",{className:"item-preview__emote-controls","data-testid":"emote-controls",children:e.jsx(xt,{wearablePreviewId:"shop-item-preview",hideFrameInput:!0})}):e.jsxs("div",{className:"item-preview__toggle",role:"group","aria-label":t("itemPreview.previewMode"),children:[e.jsxs("button",{type:"button",className:v==="avatar"?"is-active":"","aria-pressed":v==="avatar","aria-label":t("itemPreview.onAvatar"),onClick:()=>x("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:t("itemPreview.onAvatar")})]}),e.jsxs("button",{type:"button",className:v==="item"?"is-active":"","aria-pressed":v==="item","aria-label":t("itemPreview.item"),onClick:()=>x("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:t("itemPreview.item")})]})]})]})}function Ye(){return fe.shopServerUrl||(typeof window<"u"?window.location.origin:"")}async function vt(s,n,i){const d=new URLSearchParams({contractAddress:s,itemId:n}),o=`${Ye()}/notify-requests?${d.toString()}`,h=await He(o,{method:"GET",identity:i,metadata:{}});if(!h.ok)throw new Error(`getNotifyRequest ${h.status}`);return h.json()}async function gt(s,n){const i=`${Ye()}/notify-requests`,d=await He(i,{method:"POST",identity:n,metadata:{},headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!d.ok)throw new Error(`createNotifyRequest ${d.status}: ${await d.text()}`);await d.json().catch(()=>{})}function Qe(s){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s.trim())}function Nt({item:s}){const n=Y(f=>f.session),i=Y(f=>f.signIn),[d,o]=c.useState(""),[h,v]=c.useState(!1),[x,m]=c.useState(!1),[l,a]=c.useState(null),k=!!n&&!!s.contractAddress&&!!s.itemId,{data:y}=R({queryKey:["notify-request",s.contractAddress,s.itemId,n==null?void 0:n.address],enabled:k,queryFn:()=>vt(s.contractAddress,s.itemId,n.identity)});c.useEffect(()=>{y!=null&&y.email&&o(f=>f||y.email)},[y==null?void 0:y.email]),c.useEffect(()=>{if(!n)return;let f=!1;return Ia().then(p=>{!f&&p&&o(D=>D||p)}),()=>{f=!0}},[n]);const g=x||!!(y!=null&&y.subscribed);async function L(f){if(f.preventDefault(),!(!n||!s.itemId||!Qe(d)||h)){v(!0),a(null);try{await gt({contractAddress:s.contractAddress,itemId:s.itemId,chainId:s.chainId,email:d.trim()},n.identity),m(!0)}catch(p){le(p,{flow:"notify-me",contractAddress:s.contractAddress,itemId:s.itemId}),a(t("notifyMe.error"))}finally{v(!1)}}}return n?g?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(F,{name:"check",size:12})}),e.jsx("span",{className:"notify__done-text",children:t("notifyMe.subscribedBody")})]}):e.jsxs("form",{className:"notify",onSubmit:L,"data-testid":"notify",children:[e.jsx("label",{className:"notify__label",htmlFor:"notify-email",children:t("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:t("notifyMe.placeholder"),value:d,onChange:f=>o(f.target.value),"data-testid":"notify-email"}),e.jsx("button",{type:"submit",className:"notify__btn",disabled:!Qe(d)||h,"data-testid":"notify-submit",children:h?t("notifyMe.working"):t("notifyMe.cta")})]}),e.jsx(xe,{message:l})]}):e.jsx("div",{className:"notify","data-testid":"notify",children:e.jsx("button",{type:"button",className:"notify__signin",onClick:i,"data-testid":"notify-signin",children:t("notifyMe.signInCta")})})}const wt=z.button`
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CxFzTyPL.js","assets/react-C51i12iP.js","assets/dcl-schemas-BICTSpB5.js","assets/index-CxiM65Mp.js","assets/sentry-DKBoGDXH.js","assets/ethers-BeFqf2KO.js","assets/intl-CBcMB1D2.js","assets/index-PISx9bvm.css","assets/emotion-styled.browser.esm-CM5xiqPE.js","assets/useTheme-BNMMOZXE.js","assets/CircularProgress-BbpUGXBC.js","assets/index-C-0iOuYu.js","assets/useTheme-Dym7bhKm.js","assets/CssVarsProvider-CD9SUox4.js","assets/getOverlayAlpha-mkhFONg0.js","assets/index-DcTQA0a2.js","assets/colors-LINLm1ux.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as pe,r as c,j as e,d as ua,a as ha,L as _a}from"./react-C51i12iP.js";import{b as Y,ab as ya,n as Ge,t,am as pa,i as fa,j as ba,af as xa,ac as ie,o as V,X as Re,ag as _e,an as ja,m as le,C as M,aj as ne,_ as ye,a3 as va,a6 as ga,a5 as Na,aC as wa,a9 as ka,g as fe,aD as Ca,W as He,c as R,aE as Ia,I as F,a2 as O,s as z,aF as Aa,aG as Sa,aH as Ma,as as Pa,ah as qe,a as $e,aI as Ea,aJ as Fa,aK as La,aL as Da,aM as Ta,ai as Ba,u as Ra,aN as qa,aO as $a,aP as Oa,ak as za,aQ as Oe,aR as Ka,B as be,e as Wa,r as Va,av as Qa,aS as Ua,aT as Ga,aw as Ha,aU as Ja,aV as Ya}from"./index-CxiM65Mp.js";import{d as Q}from"./dcl-schemas-BICTSpB5.js";import{b as ze,c as Xa}from"./buy-CgIgEqv9.js";import{S as Za,P as et,f as at}from"./PrimaryListModal-gfgyzr3S.js";import{g as tt,b as st,w as it,S as rt,G as nt}from"./buy-gasless-pwHqA_mF.js";import{u as lt,l as dt,c as ot}from"./loader-logo-CmjwjqNs.js";import{R as Ke}from"./resume-buy-Bf0zIH7y.js";import{a as ct,f as We,i as mt}from"./errors-BVwqXLe5.js";import{E as xe}from"./ErrorNotice-C7soUjRV.js";import{C as ut}from"./CircularProgress-BbpUGXBC.js";import{T as Je,u as ht,M as _t}from"./MarketCheckout-DkLDRrfN.js";import{s as yt}from"./address-DrURAr9O.js";import{C as pt}from"./CollectionCarousel-DZRKlb8f.js";import"./sentry-DKBoGDXH.js";import"./ethers-BeFqf2KO.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-D-nmkwVz.js";import"./index-HN6Rk25C.js";import"./wallet-kind-B9P1TeIH.js";import"./mana-rate-BSdhcAxH.js";import"./emotion-CSxEP8yM.js";function ft({item:s,onClose:n,resume:i=!1}){var Z,ee;const{session:d}=Y(),{data:o}=ya(d),h=Ge(),v=pe(),x=lt().packs.slice(0,3),[m,l]=c.useState("loading"),[a,k]=c.useState(null),[y,g]=c.useState(""),[L,f]=c.useState(s.priceCredits),[p,D]=c.useState(null),P=c.useRef(null),I=(p==null?void 0:p.credits)??L,X=(o==null?void 0:o.credits)??0;c.useEffect(()=>{let u=!1;if(!d){l("error"),k(t("buyModal.signInToCheckout"));return}const N=_=>{const w=_-((o==null?void 0:o.credits)??0),b=x.find(T=>T.credits>=w)??x[x.length-1];g(b.id),V("Shop Buy Credits Prompted",{from:"item_checkout",credits_needed:_,credits_balance:(o==null?void 0:o.credits)??0,shortfall:Math.max(0,w)}),l("nofunds")};return(async()=>{var _,w;try{const b=await pa(s);if(!b)throw new Error("not for sale");if(fa(b,d.address))throw new Error("You can't buy your own listing.");const T=ba((w=(_=b.received)==null?void 0:_[0])==null?void 0:w.amount);if(!Number.isFinite(T)||T<=0)throw new Error("price unavailable");const K=Math.ceil(T/10);if(u)return;if(f(K),o!=null&&o.credits<K){N(K);return}try{const{credit:C,maxCreditedValue:G,usdCents:$}=await xa(d.identity,T,b.id);if(u){ie(d.identity,[C.id]).catch(()=>{});return}P.current=C.id;const ae=Math.ceil($/10);f(ae);const W={trade:b,credit:C,maxCreditedValue:G,usdCents:$,credits:ae};D(W),i?U(W):l("ready")}catch(C){if(u)return;if(ct(C)){N(K);return}throw C}}catch(b){if(u)return;V(_e(b)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:Re(b)}),l("error"),k(We(b,t("buyModal.error.generic"),{sale:!0}))}})(),()=>{u=!0,P.current&&d&&(ie(d.identity,[P.current]).catch(()=>{}),P.current=null)}},[]);async function U(u=p){if(!d||!u)return;l("processing"),k(null);let N=!1;try{const _={trade:u.trade,buyer:d.address,signer:d.signer,credits:[u.credit],maxCreditedValue:u.maxCreditedValue};let w;if(tt())try{w=await st(_),await it(w),N=!0}catch(b){if(b instanceof rt)N=!0;else if(b instanceof nt)w=await ze(_);else throw b}else w=await ze(_);P.current=null,V("Shop Completed Purchase",{...ja([s]),payment_type:"credits",no_crypto_step:N,transaction_hash:w??null}),h.invalidateQueries({queryKey:["usd-balance"]}),l("complete")}catch(_){_e(_)||le(_,{flow:"buy",step:"submit",gasless:N}),ie(d.identity,[u.credit.id]).catch(()=>{}),P.current=null,V(_e(_)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:Re(_)}),h.invalidateQueries({queryKey:["usd-balance"]}),k(We(_,t("buyModal.error.generic"),{sale:!0})),l("error")}}async function de(){if(!(!y||!d)){try{sessionStorage.setItem(Ke,JSON.stringify(s))}catch{}p&&ie(d.identity,[p.credit.id]).catch(()=>{}),P.current=null,l("loading");try{const u=await ot(y,{address:d.address,identity:d.identity});if(u.url){window.location.href=u.url;return}v("/credits")}catch(u){le(u,{flow:"buy_credits_and_item"});try{sessionStorage.removeItem(Ke)}catch{}k(t("buyModal.error.creditsCheckout")),l("error")}}}const q=m==="processing",E=m==="complete"?t("buyModal.titleComplete"):m==="nofunds"?t("buyModal.titleNoFunds"):t("buyModal.titleBuy");return e.jsxs("div",{className:"buy-modal",role:"dialog","aria-modal":"true","aria-label":t("buyModal.dialogAria",{name:s.name}),children:[e.jsx("div",{className:"buy-modal__scrim",onClick:q?void 0:n,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${m==="processing"||m==="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:E}),!q&&e.jsx("button",{className:"buy-modal__x",onClick:n,"aria-label":t("buyModal.close"),children:e.jsx("svg",{viewBox:"0 0 18 18",width:"18",height:"18","aria-hidden":!0,children:e.jsx("path",{d:"M4 4l10 10M14 4L4 14",stroke:"#161518",strokeWidth:"1.8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"buy-modal__balance",children:[e.jsx("span",{className:"buy-modal__balance-label",children:m==="nofunds"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(M,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:ne(X)})]})]}),m==="loading"&&e.jsx("div",{className:"buy-modal__body buy-modal__processing",children:e.jsx(ut,{size:44})}),m==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(xe,{message:a}),e.jsx("div",{className:"buy-modal__ctas",children:e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:n,children:t("buyModal.close")})})]}),m==="nofunds"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24","aria-hidden":!0,className:"buy-modal__warning-ico",children:[e.jsx("path",{d:"M12 3L2 20h20L12 3z",fill:"none",stroke:"#691fa9",strokeWidth:"1.8",strokeLinejoin:"round"}),e.jsx("path",{d:"M12 9v5",stroke:"#691fa9",strokeWidth:"1.8",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"17",r:"1.1",fill:"#691fa9"})]}),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,I-X)})})," ",t("buyModal.warningToPurchase",{count:1})]})]}),e.jsx(Ve,{item:s,priceCredits:I}),e.jsx("div",{className:"buy-modal__packs",children:x.map(u=>{const N=u.credits,_=u.id===y;return e.jsxs("button",{className:`buy-modal__pack${_?" buy-modal__pack--on":""}`,onClick:()=>g(u.id),children:[e.jsx(M,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:ne(N)}),e.jsxs("span",{className:"buy-modal__pack-usd",children:["($",u.usd.toFixed(2),")"]})]},u.id)})}),e.jsxs("div",{className:"buy-modal__total",children:[e.jsxs("div",{className:"buy-modal__total-credits",children:[e.jsx(M,{className:"buy-modal__total-ico"}),e.jsx("span",{children:ne(((Z=x.find(u=>u.id===y))==null?void 0:Z.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",(((ee=x.find(u=>u.id===y))==null?void 0:ee.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:t("buyModal.cancel")}),e.jsx("button",{className:"buy-modal__btn buy-modal__btn--gradient",onClick:()=>void de(),children:t("buyModal.buy")})]})]}),m==="ready"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(Ve,{item:s,priceCredits:I}),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:t("buyModal.buy")})})]}),m==="processing"&&e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:dt,alt:"",width:61,height:61}),e.jsx("div",{className:"buy-modal__processing-text",children:i?t("buyModal.completingPurchase"):t("buyModal.completingTransaction")}),e.jsx("div",{className:"buy-modal__progress","aria-hidden":!0,children:e.jsx("span",{className:"buy-modal__progress-fill"})})]}),m==="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:t("getCredits.successTitle")})," ",t("buyModal.successBody")]})]}),e.jsxs("div",{className:"buy-modal__ctas",children:[e.jsx("button",{className:"buy-modal__btn buy-modal__btn--outline",onClick:()=>v("/assets?tab=mine"),children:t("buyModal.myAssets")}),e.jsxs("button",{className:"buy-modal__btn buy-modal__btn--ruby",onClick:n,children:[t("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 Ve({item:s,priceCredits:n}){return e.jsxs("div",{className:"buy-modal__asset",children:[e.jsx("div",{className:"buy-modal__asset-thumb",children:s.thumbnail?e.jsx("img",{src:s.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:s.name,children:s.name||t("buyModal.itemFallback")}),s.creator?e.jsx("div",{className:"buy-modal__asset-creator",children:t("search.byCreator",{name:s.creator})}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(M,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:ne(n)})]})]})]})}const bt=c.lazy(async()=>{const[{EmoteControls:s},{Experimental_CssVarsProvider:n},{light:i}]=await Promise.all([ye(()=>import("./index-CxFzTyPL.js").then(d=>d.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),ye(()=>import("./index-C-0iOuYu.js"),__vite__mapDeps([11,3,1,2,4,5,6,7,12,9,13,14])),ye(()=>import("./index-DcTQA0a2.js"),__vite__mapDeps([15,3,1,2,4,5,6,7,16,14,13,9]))]);return{default:d=>e.jsx(n,{theme:i,children:e.jsx(s,{...d})})}});function xt(s){return e.jsx(c.Suspense,{fallback:null,children:e.jsx(bt,{...s})})}function jt({item:s}){const n=Y(p=>{var D;return(D=p.session)==null?void 0:D.address}),{data:i,isLoading:d}=va(n),o=n&&i?n:"default",h=s.category==="emote",[v,x]=c.useState("item"),m=!h&&v==="item",l=m||!d,[a,k]=c.useState(!0);c.useEffect(()=>{k(!0)},[s.id,m]);const y=!!n&&!!i,g=y&&ga(s,Na(i)),L=wa(s)[0],f=y&&!g&&!h;return e.jsxs(e.Fragment,{children:[l?e.jsx(ka,{id:"shop-item-preview",contractAddress:s.contractAddress,tokenId:s.tokenId??void 0,itemId:s.tokenId?void 0:s.itemId??void 0,profile:m?void 0:g?o:"default",bodyShape:m||g?void 0:L,type:h?void 0:m?Q.PreviewType.WEARABLE:Q.PreviewType.AVATAR,emote:h||m?void 0:Q.PreviewEmote.FASHION,disableBackground:!0,wheelZoom:h?1.5:void 0,wheelStart:h?100:void 0,dev:fe.chainId===80002,onLoad:()=>k(!1)}):null,!l||a?e.jsx("div",{className:"item-preview__loading","aria-busy":"true","aria-label":t("itemPreview.loading"),children:e.jsx("span",{className:"item-preview__spinner","aria-hidden":!0})}):null,f&&!m?e.jsx("p",{className:"item-preview__note",children:t("itemPreview.shownOnBody",{shape:Ca(L)})}):null,h?e.jsx("div",{className:"item-preview__emote-controls","data-testid":"emote-controls",children:e.jsx(xt,{wearablePreviewId:"shop-item-preview",hideFrameInput:!0})}):e.jsxs("div",{className:"item-preview__toggle",role:"group","aria-label":t("itemPreview.previewMode"),children:[e.jsxs("button",{type:"button",className:v==="avatar"?"is-active":"","aria-pressed":v==="avatar","aria-label":t("itemPreview.onAvatar"),onClick:()=>x("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:t("itemPreview.onAvatar")})]}),e.jsxs("button",{type:"button",className:v==="item"?"is-active":"","aria-pressed":v==="item","aria-label":t("itemPreview.item"),onClick:()=>x("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:t("itemPreview.item")})]})]})]})}function Ye(){return fe.shopServerUrl||(typeof window<"u"?window.location.origin:"")}async function vt(s,n,i){const d=new URLSearchParams({contractAddress:s,itemId:n}),o=`${Ye()}/notify-requests?${d.toString()}`,h=await He(o,{method:"GET",identity:i,metadata:{}});if(!h.ok)throw new Error(`getNotifyRequest ${h.status}`);return h.json()}async function gt(s,n){const i=`${Ye()}/notify-requests`,d=await He(i,{method:"POST",identity:n,metadata:{},headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!d.ok)throw new Error(`createNotifyRequest ${d.status}: ${await d.text()}`);await d.json().catch(()=>{})}function Qe(s){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s.trim())}function Nt({item:s}){const n=Y(f=>f.session),i=Y(f=>f.signIn),[d,o]=c.useState(""),[h,v]=c.useState(!1),[x,m]=c.useState(!1),[l,a]=c.useState(null),k=!!n&&!!s.contractAddress&&!!s.itemId,{data:y}=R({queryKey:["notify-request",s.contractAddress,s.itemId,n==null?void 0:n.address],enabled:k,queryFn:()=>vt(s.contractAddress,s.itemId,n.identity)});c.useEffect(()=>{y!=null&&y.email&&o(f=>f||y.email)},[y==null?void 0:y.email]),c.useEffect(()=>{if(!n)return;let f=!1;return Ia().then(p=>{!f&&p&&o(D=>D||p)}),()=>{f=!0}},[n]);const g=x||!!(y!=null&&y.subscribed);async function L(f){if(f.preventDefault(),!(!n||!s.itemId||!Qe(d)||h)){v(!0),a(null);try{await gt({contractAddress:s.contractAddress,itemId:s.itemId,chainId:s.chainId,email:d.trim()},n.identity),m(!0)}catch(p){le(p,{flow:"notify-me",contractAddress:s.contractAddress,itemId:s.itemId}),a(t("notifyMe.error"))}finally{v(!1)}}}return n?g?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(F,{name:"check",size:12})}),e.jsx("span",{className:"notify__done-text",children:t("notifyMe.subscribedBody")})]}):e.jsxs("form",{className:"notify",onSubmit:L,"data-testid":"notify",children:[e.jsx("label",{className:"notify__label",htmlFor:"notify-email",children:t("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:t("notifyMe.placeholder"),value:d,onChange:f=>o(f.target.value),"data-testid":"notify-email"}),e.jsx("button",{type:"submit",className:"notify__btn",disabled:!Qe(d)||h,"data-testid":"notify-submit",children:h?t("notifyMe.working"):t("notifyMe.cta")})]}),e.jsx(xe,{message:l})]}):e.jsx("div",{className:"notify","data-testid":"notify",children:e.jsx("button",{type:"button",className:"notify__signin",onClick:i,"data-testid":"notify-signin",children:t("notifyMe.signInCta")})})}const wt=z.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-CxiM65Mp.js";const a=u.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: center;
|
|
4
4
|
padding: 28px 0 8px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as K,g as B,s as F,a2 as v,b as V,
|
|
1
|
+
import{c as K,g as B,s as F,a2 as v,b as V,ab as H,n as D,t as s,ac as _,C as I,ad as A,ae as J,h as P,e as Z,i as ee,af as te,o as g,X as T,ag as U,B as ae}from"./index-CxiM65Mp.js";import{r as re,a as M}from"./mana-rate-BSdhcAxH.js";import{r as o,j as t,u as se}from"./react-C51i12iP.js";import{n as L}from"./emotion-CSxEP8yM.js";import{b as W}from"./buy-CgIgEqv9.js";import{g as ne,b as oe,w as ie,S as ce,G as de}from"./buy-gasless-pwHqA_mF.js";import{i as le}from"./errors-BVwqXLe5.js";import{E as ue}from"./ErrorNotice-C7soUjRV.js";function ge(e=!0){return K({queryKey:["mana-rate",B.chainId],queryFn:()=>re(B.chainId),enabled:e,staleTime:6e4,refetchInterval:6e4,retry:1})}const me=F("span",L("block"))`
|
|
2
2
|
position: relative;
|
|
3
3
|
display: ${({block:e})=>e?"flex":"inline-flex"};
|
|
4
4
|
${({block:e})=>e?"width: 100%;":""}
|
|
@@ -45,6 +45,6 @@ import{c as K,g as B,s as F,a2 as v,b as V,ae as H,n as D,t as s,af as _,C as I,
|
|
|
45
45
|
@media (prefers-reduced-motion: reduce) {
|
|
46
46
|
transition: none;
|
|
47
47
|
}
|
|
48
|
-
`;function
|
|
48
|
+
`;function je({content:e,children:i,placement:j="top",block:w,onShow:a,className:c}){const[f,k]=o.useState(!1),x=o.useId(),y=o.useRef(!1),u=o.useCallback(()=>{k(!0),y.current||(y.current=!0,a==null||a())},[a]),p=o.useCallback(()=>k(!1),[]);return t.jsxs(me,{className:c,block:w,onMouseEnter:u,onMouseLeave:p,onFocus:u,onBlur:p,children:[o.cloneElement(i,{"aria-describedby":f?x:void 0}),t.jsx(he,{role:"tooltip",id:x,placement:j,"aria-hidden":!f,...f?{"data-open":""}:{},children:e})]})}const q=F(ae)`
|
|
49
49
|
flex: 1;
|
|
50
|
-
`;function z(e){if(le(e))return s("errors.rejected");const i=(e.message??"").toLowerCase();return i.includes("insufficient")?s("marketCheckout.error.insufficient",{currency:P.name}):i.includes("not found")||i.includes("no active listing")||i.includes("404")?s("marketCheckout.error.soldOrRemoved"):i.includes("your own listing")?s("errors.cantBuyOwn"):s("marketCheckout.error.generic")}function pe(e){return{id:e.tradeId,tradeId:e.tradeId,name:e.name,creator:e.creator,contractAddress:e.contractAddress,itemId:e.itemId,category:e.category,wearableCategory:e.wearableCategory??void 0,rarity:e.rarity,network:e.network,chainId:e.chainId,thumbnail:e.thumbnail,priceCredits:0,gender:null,isSmart:!1}}function we({listing:e,rate:i,onClose:
|
|
50
|
+
`;function z(e){if(le(e))return s("errors.rejected");const i=(e.message??"").toLowerCase();return i.includes("insufficient")?s("marketCheckout.error.insufficient",{currency:P.name}):i.includes("not found")||i.includes("no active listing")||i.includes("404")?s("marketCheckout.error.soldOrRemoved"):i.includes("your own listing")?s("errors.cantBuyOwn"):s("marketCheckout.error.generic")}function pe(e){return{id:e.tradeId,tradeId:e.tradeId,name:e.name,creator:e.creator,contractAddress:e.contractAddress,itemId:e.itemId,category:e.category,wearableCategory:e.wearableCategory??void 0,rarity:e.rarity,network:e.network,chainId:e.chainId,thumbnail:e.thumbnail,priceCredits:0,gender:null,isSmart:!1}}function we({listing:e,rate:i,onClose:j,onSold:w}){const{session:a}=V(),{data:c,isError:f}=H(a),k=D(),x=se(),[y,u]=o.useState("confirm"),[p,R]=o.useState(s("marketCheckout.lockingPrice")),[G,b]=o.useState(null),[r,O]=o.useState(null),l=o.useRef(null),Q=Math.ceil(M(e.manaWei,i)/10);o.useEffect(()=>{let m=!1;if(!a){u("error"),b(s("buyModal.signInToCheckout"));return}return(async()=>{try{const n=await Z(e.tradeId);if(!n)throw new Error("not found");if(ee(n,a.address))throw new Error("You can't buy your own listing.");const h=M(e.manaWei,i);if(!Number.isFinite(h)||h<=0)throw new Error("price unavailable");const{credit:E,maxCreditedValue:Y,usdCents:$}=await te(a.identity,h,e.tradeId);if(m){_(a.identity,[E.id]).catch(()=>{});return}l.current=E.id,O({trade:n,credit:E,maxCreditedValue:Y,usdCents:$,credits:Math.ceil($/10)}),R("")}catch(n){if(m)return;console.error("[market] authorize failed",n),g(U(n)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:T(n),value_usd:Math.round(M(e.manaWei,i))/100}),u("error"),b(z(n))}})(),()=>{m=!0,l.current&&a&&(_(a.identity,[l.current]).catch(()=>{}),l.current=null)}},[]);const N=!!r&&c!=null&&c.credits<r.credits;async function X(){if(!a||!r)return;if(N){g("Shop Buy Credits Prompted",{from:"item_checkout",credits_needed:r.credits,credits_balance:(c==null?void 0:c.credits)??0,shortfall:Math.max(0,r.credits-((c==null?void 0:c.credits)??0))}),_(a.identity,[r.credit.id]).catch(()=>{}),l.current=null,x("/credits");return}u("working"),b(null);let m=!1;try{R(s("marketCheckout.confirming"));const d={trade:r.trade,buyer:a.address,signer:a.signer,credits:[r.credit],maxCreditedValue:r.maxCreditedValue};let n;if(ne())try{n=await oe(d),await ie(n),m=!0}catch(h){if(h instanceof ce)m=!0;else if(h instanceof de)n=await W(d);else throw h}else n=await W(d);l.current=null,g("Shop Completed Purchase",{items:[{item_id:e.itemId??null,contract_address:e.contractAddress,token_id:null,price_usd:r.usdCents/100}],value_credits:r.credits,value_usd:r.usdCents/100,purchase_type:"item",is_primary:!0,payment_type:"credits",no_crypto_step:m,transaction_hash:n??null}),k.invalidateQueries({queryKey:["usd-balance"]}),x("/success",{state:{items:[pe(e)],txHash:n}})}catch(d){console.error("[market] buy now failed",d),_(a.identity,[r.credit.id]).catch(()=>{}),l.current=null,g(U(d)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:T(d),value_usd:r.usdCents/100}),k.invalidateQueries({queryKey:["usd-balance"]}),b(z(d)),u("error");const n=(d.message??"").toLowerCase();(n.includes("not found")||n.includes("no active listing")||n.includes("404"))&&w()}}function S(){a&&r&&_(a.identity,[r.credit.id]).catch(()=>{}),l.current=null,j()}const C=y==="working";return t.jsxs("div",{className:"mkt-modal",role:"dialog","aria-modal":"true","aria-label":s("buyModal.dialogAria",{name:e.name}),children:[t.jsx("div",{className:"mkt-modal__scrim",onClick:C?void 0:S,"aria-hidden":!0}),t.jsxs("div",{className:"mkt-modal__card",children:[t.jsxs("div",{className:"mkt-modal__head",children:[t.jsx("div",{className:"mkt-modal__thumb",children:e.thumbnail?t.jsx("img",{src:e.thumbnail,alt:""}):null}),t.jsxs("div",{children:[t.jsx("div",{className:"mkt-modal__name",title:e.name,children:e.name||s("buyModal.itemFallback")}),t.jsx("span",{className:"chip chip--rarity",children:e.rarity})]})]}),t.jsx("div",{className:"mkt-modal__price",children:r?t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"mkt-modal__price-label",children:s("marketCheckout.finalPrice")}),t.jsxs("div",{className:"mkt-modal__price-value",children:[t.jsx(I,{className:"mkt-modal__diamond"}),A(r.credits)]}),t.jsxs("div",{className:"mkt-modal__price-sub muted",children:[s("marketCheckout.lockedForPurchase")," · $",(r.usdCents/100).toFixed(2)]})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"mkt-modal__price-label",children:s("marketCheckout.todaysPrice")}),t.jsxs("div",{className:"mkt-modal__price-value mkt-modal__price-value--approx",children:[t.jsx("span",{className:"mkt-modal__approx","aria-hidden":!0,children:"≈"}),t.jsx(I,{className:"mkt-modal__diamond"}),A(Q)]}),t.jsx("div",{className:"mkt-modal__price-sub muted",children:p||s("marketCheckout.lockingPrice")})]})}),a?t.jsxs("div",{className:"mkt-modal__balance muted",children:[s("marketCheckout.yourBalance")," ",t.jsx(I,{className:"ccy-mark"})," ",J(c,f)]}):null,N?t.jsx("p",{className:"muted mkt-modal__note",children:s("marketCheckout.needMore",{currency:P.name})}):null,p&&y==="working"?t.jsx("p",{className:"muted mkt-modal__note",children:p}):null,t.jsx(ue,{message:G,className:"mkt-modal__note"}),t.jsxs("div",{className:"mkt-modal__actions",children:[t.jsx(q,{variant:"ghost",onClick:S,disabled:C,children:s("buyModal.cancel")}),t.jsx(q,{variant:"purple",onClick:()=>void X(),disabled:C||!r,children:C?s("marketCheckout.buying"):N?s("nav.getCredits",{currency:P.name}):s("marketCheckout.confirmPurchase")})]})]})]})}export{we as M,je as T,ge as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as J,r as o,j as s,L as V}from"./react-C51i12iP.js";import{u as X,t,b as ss,n as es,c as N,B as y,C as T,o as O,q as as,s as B,e as ns,r as ts,m as is,g as rs,h as cs,v as ls}from"./index-
|
|
1
|
+
import{u as J,r as o,j as s,L as V}from"./react-C51i12iP.js";import{u as X,t,b as ss,n as es,c as N,B as y,C as T,o as O,q as as,s as B,e as ns,r as ts,m as is,g as rs,h as cs,v as ls}from"./index-CxiM65Mp.js";import{f as os}from"./import-Bsky-xMs.js";import{S as ds,P as ms,f as hs}from"./PrimaryListModal-gfgyzr3S.js";import{c as us}from"./buy-CgIgEqv9.js";import{L as ps}from"./LoadMore-DUwOaKdq.js";import{u as ys}from"./useInfiniteGrid-DMPijgdc.js";import{E as _}from"./ErrorNotice-C7soUjRV.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-BeFqf2KO.js";import"./intl-CBcMB1D2.js";import"./mana-rate-BSdhcAxH.js";import"./index-HN6Rk25C.js";import"./trade-encoding-D-nmkwVz.js";import"./errors-BVwqXLe5.js";import"./wallet-kind-B9P1TeIH.js";const gs=B(y)`
|
|
2
2
|
margin-top: 8px;
|
|
3
3
|
width: 100%;
|
|
4
4
|
`,K=B(y)`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as n,j as s,L as m}from"./react-C51i12iP.js";import{u as c,t,a as l,I as d,A as p,s as v,B as x}from"./index-
|
|
1
|
+
import{r as n,j as s,L as m}from"./react-C51i12iP.js";import{u as c,t,a as l,I as d,A as p,s as v,B as x}from"./index-CxiM65Mp.js";import{L as u}from"./LoadMore-DUwOaKdq.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-BeFqf2KO.js";import"./intl-CBcMB1D2.js";const h=v(x)`
|
|
2
2
|
margin-top: 12px;
|
|
3
3
|
`,r=24;function E(){c({title:t("nav.myFavorites"),noindex:!0});const a=l(e=>Object.values(e.items)),[i,o]=n.useState(r);return a.length===0?s.jsxs("div",{className:"favorites-empty",children:[s.jsx(d,{name:"heart",size:40,color:"var(--muted-2)"}),s.jsx("p",{className:"favorites-empty__title",children:t("myFavorites.emptyTitle")}),s.jsx("p",{className:"muted",children:t("myFavorites.emptyBody")}),s.jsx(h,{as:m,to:"/assets",variant:"purple",children:t("notFound.cta")})]}):s.jsxs("section",{className:"favorites",children:[s.jsxs("div",{className:"favorites__head",children:[s.jsx("h1",{children:t("nav.myFavorites")}),s.jsx("span",{className:"favorites__count",children:t("myFavorites.itemCount",{count:a.length})})]}),s.jsx("div",{className:"grid",children:a.slice(0,i).map(e=>s.jsx(p,{item:e},e.id))}),s.jsx(u,{hasNextPage:i<a.length,isFetching:!1,onLoadMore:()=>o(e=>e+r)})]})}export{E as MyFavorites};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{j as s,L as h}from"./react-C51i12iP.js";import{u as l,t as r,b as p,I as o,f as x,s as j,B as _,c as y,C as N,d as g}from"./index-
|
|
1
|
+
import{j as s,L as h}from"./react-C51i12iP.js";import{u as l,t as r,b as p,I as o,f as x,s as j,B as _,c as y,C as N,d as g}from"./index-CxiM65Mp.js";import{L as f}from"./LoadMore-DUwOaKdq.js";import{u as v}from"./useInfiniteGrid-DMPijgdc.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-BeFqf2KO.js";import"./intl-CBcMB1D2.js";const P=j(_)`
|
|
2
2
|
margin-top: 12px;
|
|
3
3
|
`,I=24;function b(e){try{return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}catch{return""}}function E({status:e}){return e==="PENDING"?s.jsx("span",{className:"purchase__badge purchase__badge--pending",children:r("myPurchases.processing")}):s.jsx("span",{className:"purchase__badge purchase__badge--done",children:r("myPurchases.completed")})}function F({purchase:e}){const{data:a}=y({queryKey:["trade-display",e.tradeId],queryFn:()=>g(e.tradeId),enabled:!!e.tradeId,staleTime:3e5}),c=(a==null?void 0:a.name)??r("myPurchases.itemFallback"),m=(a==null?void 0:a.thumbnail)??"",i=(a==null?void 0:a.tokenId)??(a==null?void 0:a.itemId)??"",d=a!=null&&a.contractAddress&&i?`/item/${a.contractAddress}/${i}`:void 0,n=s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"purchase__thumb",children:m?s.jsx("img",{src:m,alt:c}):null}),s.jsxs("div",{className:"purchase__info",children:[s.jsx("div",{className:"purchase__name",title:c,children:c}),s.jsx("div",{className:"muted purchase__date",children:b(e.createdAt)})]}),s.jsx(E,{status:e.status}),s.jsxs("div",{className:"purchase__price",children:[s.jsx(N,{className:"ccy-mark"})," ",e.credits]})]});return d?s.jsx(h,{className:"purchase",to:d,children:n}):s.jsx("div",{className:"purchase",children:n})}function G(){l({title:r("nav.myPurchases"),noindex:!0});const{session:e}=p(),{items:a,isLoading:c,hasNextPage:m,isFetchingNextPage:i,fetchNextPage:d}=v(["purchases",e==null?void 0:e.address],t=>x(e.address,e.identity,{first:I,skip:t}),{enabled:!!e});if(!e)return s.jsxs("div",{className:"purchases-empty",children:[s.jsx(o,{name:"cart",size:40,color:"var(--muted-2)"}),s.jsx("p",{className:"purchases-empty__title",children:r("myPurchases.signInTitle")}),s.jsx("p",{className:"muted",children:r("myPurchases.signInBody")})]});const n=a.filter(t=>t.status!=="EXPIRED");return!c&&n.length===0?s.jsxs("div",{className:"purchases-empty",children:[s.jsx(o,{name:"cart",size:40,color:"var(--muted-2)"}),s.jsx("p",{className:"purchases-empty__title",children:r("myPurchases.emptyTitle")}),s.jsx("p",{className:"muted",children:r("myPurchases.emptyBody")}),s.jsx(P,{as:h,to:"/assets",variant:"purple",children:r("notFound.cta")})]}):s.jsxs("section",{className:"purchases",children:[s.jsxs("div",{className:"purchases__head",children:[s.jsx("h1",{children:r("nav.myPurchases")}),c?null:s.jsx("span",{className:"purchases__count",children:r("myPurchases.orderCount",{count:n.length})})]}),s.jsx("div",{className:"purchases__list",children:c?Array.from({length:4}).map((t,u)=>s.jsx("div",{className:"purchase purchase--skeleton"},u)):s.jsxs(s.Fragment,{children:[n.map(t=>s.jsx(F,{purchase:t},t.id)),i?Array.from({length:2}).map((t,u)=>s.jsx("div",{className:"purchase purchase--skeleton"},`m-${u}`)):null]})}),s.jsx(f,{hasNextPage:m,isFetching:i,onLoadMore:()=>void d()})]})}export{G as MyPurchases};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,L as n}from"./react-C51i12iP.js";import{u as s,t as o,I as e,B as a}from"./index-
|
|
1
|
+
import{j as t,L as n}from"./react-C51i12iP.js";import{u as s,t as o,I as e,B as a}from"./index-CxiM65Mp.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-BeFqf2KO.js";import"./intl-CBcMB1D2.js";function c(){return s({title:o("seo.notFound.title"),noindex:!0}),t.jsxs("div",{className:"notfound","data-testid":"notfound",children:[t.jsx(e,{name:"cart",className:"notfound__ico"}),t.jsx("h1",{className:"notfound__title",children:o("notFound.title")}),t.jsx("p",{className:"muted",children:o("notFound.body")}),t.jsx(a,{as:n,to:"/assets",variant:"purple",children:o("notFound.cta")})]})}export{c as NotFound,c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as w,W as K,n as M,t as a,C as P,B as f,h as j,p as $,o as C,r as E,m as T,X as O}from"./index-BBuZMaWr.js";import{d as F}from"./dcl-schemas-BICTSpB5.js";import{u as R,r as u,j as s}from"./react-C51i12iP.js";import{a as X,b as H,i as J,e as V,c as Y}from"./trade-encoding-CWytSFjw.js";import{f as U}from"./errors-BLIsDEoc.js";import{E as W}from"./ErrorNotice-C7soUjRV.js";import{s as z}from"./wallet-kind-B9P1TeIH.js";const I=()=>`${w.builderServerUrl}/v1`;function q(e){return Array.isArray(e)?e:"results"in e&&Array.isArray(e.results)?e.results:"data"in e&&Array.isArray(e.data)?e.data:[]}async function B(e,r){const t=await K(e,{method:"GET",identity:r,metadata:{}});if(!t.ok)throw new Error(`builder-server ${t.status}: ${await t.text()}`);const l=await t.json();return l.data??l}function Z(e,r){const t=r-e;return t>0?t:0}function ee(e){var r,t,l,i,n;return((t=(r=e.data)==null?void 0:r.wearable)==null?void 0:t.category)??((i=(l=e.data)==null?void 0:l.emote)==null?void 0:i.category)??((n=e.data)==null?void 0:n.category)??e.type??"wearable"}function A(e){return`${I()}/storage/contents/${e}`}function S(e,r){if(!e)return"";if(/^https?:\/\//.test(e))return e;const t=r==null?void 0:r[e];return t?A(t):/^(ba|Qm)/.test(e)?A(e):""}async function se(e,r){try{const t=await fetch(`${I()}/items/${e}/${r}/contents`);if(!t.ok)return{};const l=await t.json();return l.data??l}catch{return{}}}async function ae(e,r,t){const l=S(e.thumbnail,e.contents)||S("thumbnail.png",e.contents);if(l)return l;if(r&&t){const i=await se(r,t);return S(e.thumbnail,i)||S("thumbnail.png",i)||S("image.png",i)}return""}async function te(e,r){const t=`${I()}/${e.toLowerCase()}/collections?is_published=true`,l=await B(t,r);return q(l).filter(i=>i.is_published&&!!i.contract_address).map(i=>({id:i.id,name:i.name,contractAddress:i.contract_address.toLowerCase(),isPublished:i.is_published,isApproved:i.is_approved,minters:(i.minters??[]).map(n=>n.toLowerCase())}))}async function re(e,r){const t=`${I()}/collections/${e.id}/items`,l=await B(t,r);return(await Promise.all(q(l).map(async n=>{const _=n.rarity??"common",y=Number(n.total_supply??0)||0;let o;try{o=F.Rarity.getMaxSupply(_)}catch{o=0}const x=(n.contract_address??e.contractAddress).toLowerCase(),p=n.blockchain_item_id??"";return{id:n.id,collectionId:e.id,collectionName:e.name,contractAddress:x,blockchainItemId:p,name:n.name,category:ee(n),rarity:_,thumbnail:await ae(n,x,p),type:n.type??"wearable",isPublished:n.is_published??e.isPublished,isApproved:n.is_approved??e.isApproved,totalSupply:y,maxSupply:o,remainingSupply:Z(y,o),minters:e.minters}}))).filter(ie)}function ie(e){return e.isPublished&&e.isApproved&&e.blockchainItemId!==""&&e.blockchainItemId!=null&&e.remainingSupply>0}async function ye(e,r){const t=await te(e,r);return(await Promise.all(t.map(async i=>{try{return await re(i,r)}catch{return[]}}))).flat()}const ne=1e3*60*60*24*182;function ge({asset:e,session:r,onClose:t}){const l=M(),i=R(),[n,_]=u.useState("10"),[y,o]=u.useState(null),[x,p]=u.useState(null),[m,N]=u.useState(!1),[h,v]=u.useState(null);async function k(){p(null);const c=Number(n);if(!Number.isInteger(c)||c<=0){p(a("sellModal.errorWholeNumber"));return}N(!0);try{o(a("sellModal.statusPreparing")),await X({signer:r.signer,contractAddress:e.contractAddress,chainId:e.chainId}),o(a("sellModal.statusListing"));const g=await H({signer:r.signer,nft:{contractAddress:e.contractAddress,tokenId:e.tokenId,network:e.network,chainId:e.chainId},usdPrice:c/10,expiresAtMs:Date.now()+ne});o(a("sellModal.statusPublishing")),await $(g,r.identity),o(null),v(c),C("Shop Listed Item",{item_id:e.itemId??e.tokenId??null,contract_address:e.contractAddress,price_credits:c,price_usd:c/10,listing_type:"secondary",is_primary:!1}),E.success(a("sellModal.toastOnSale",{name:e.name})),l.invalidateQueries({queryKey:["my-assets",r.address]})}catch(g){T(g,{flow:"list_secondary"}),C("Shop Listing Failed",{listing_type:"secondary",error_code:O(g)}),p(U(g,a("sellModal.errorGeneric"))),o(null)}finally{N(!1)}}function L(){t(),i(`/item/${e.contractAddress}/${e.tokenId}`)}return h!==null?s.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:s.jsxs("div",{className:"modal modal--success",onClick:c=>c.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),s.jsx("h2",{className:"modal__title",children:a("sellModal.successTitle")}),e.image?s.jsx("img",{className:"modal__img",src:e.image,alt:e.name}):null,s.jsx("p",{className:"modal-success__name",children:e.name}),s.jsxs("p",{className:"muted small",children:[a("sellModal.listedFor")," ",s.jsxs("strong",{children:[s.jsx(P,{className:"ccy-mark"})," ",h]})]}),s.jsxs("div",{className:"modal__actions",children:[s.jsx(f,{variant:"ghost",onClick:t,children:a("getCredits.done")}),s.jsx(f,{variant:"purple",onClick:L,children:a("sellModal.viewInShop")})]})]})}):s.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:s.jsxs("div",{className:"modal","data-testid":"modal",onClick:c=>c.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsx("h2",{className:"modal__title",children:a("sellModal.listTitle",{name:e.name})}),e.image?s.jsx("img",{className:"modal__img",src:e.image,alt:e.name}):null,s.jsxs("label",{className:"field",children:[s.jsx("span",{children:a("sellModal.priceLabel",{currency:j.name})}),s.jsx("input",{type:"number",min:"1",step:"1",value:n,onChange:c=>_(c.target.value),disabled:m})]}),s.jsx("p",{className:"muted small",children:a("sellModal.pricedInWhole",{currency:j.name,currencySingular:j.nameSingular})}),y?s.jsx("p",{className:"muted",children:y}):null,s.jsx(W,{message:x}),s.jsxs("div",{className:"modal__actions",children:[s.jsx(f,{variant:"ghost",onClick:t,disabled:m,children:a("sellModal.cancel")}),s.jsx(f,{onClick:()=>void k(),disabled:m,children:m?a("sellModal.listing"):a("sellModal.putOnSale")})]})]})})}const le=1e3*60*60*24*182;function fe({item:e,session:r,onClose:t}){const l=M(),i=R(),[n,_]=u.useState("10"),[y,o]=u.useState(null),[x,p]=u.useState(null),[m,N]=u.useState(!1),[h,v]=u.useState(null),[k,L]=u.useState(null),c=w.chainId,g=z(r.providerType);u.useEffect(()=>{let d=!1;return(async()=>{try{const b=await J({contractAddress:e.contractAddress,chainId:c});d||v(b)}catch{d||v(!1)}})(),()=>{d=!0}},[e.contractAddress,c]);async function Q(){p(null);const d=Number(n);if(!Number.isInteger(d)||d<=0){p(a("primaryList.errorWholeNumber"));return}N(!0);try{h||(o(a("primaryList.statusEnabling")),await V({signer:r.signer,contractAddress:e.contractAddress,chainId:c}),v(!0)),o(a("primaryList.statusPublishing"));const b=await Y({signer:r.signer,item:{contractAddress:e.contractAddress,itemId:e.blockchainItemId,network:F.Network.MATIC,chainId:c},usdPrice:d/10,uses:e.remainingSupply,expiresAtMs:Date.now()+le});o(a("primaryList.statusFinishing")),await $(b,r.identity),o(null),L(d),C("Shop Listed Item",{item_id:e.blockchainItemId,contract_address:e.contractAddress,price_credits:d,price_usd:d/10,listing_type:"primary",is_primary:!0}),E.success(a("primaryList.toastOnSale",{name:e.name})),l.invalidateQueries({queryKey:["publishable-items"]}),l.invalidateQueries({queryKey:["collection-sale-state"]})}catch(b){T(b,{flow:"list_primary"}),C("Shop Listing Failed",{listing_type:"primary",error_code:O(b)}),p(U(b,a("primaryList.errorGeneric"))),o(null)}finally{N(!1)}}function D(){t(),i(`/item/${e.contractAddress}/${e.blockchainItemId}`)}const G=m?a("primaryList.listing"):h===!1?a("primaryList.enableAndPutOnSale"):a("primaryList.putOnSale");return k!==null?s.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:s.jsxs("div",{className:"modal modal--success",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),s.jsx("h2",{className:"modal__title",children:a("primaryList.successTitle")}),e.thumbnail?s.jsx("img",{className:"modal__img",src:e.thumbnail,alt:e.name}):null,s.jsx("p",{className:"modal-success__name",children:e.name}),s.jsxs("p",{className:"muted small",children:[a("primaryList.listedFor")," ",s.jsxs("strong",{children:[s.jsx(P,{className:"ccy-mark"})," ",k]})," ",a("primaryList.dotAvailable",{count:e.remainingSupply})]}),s.jsxs("div",{className:"modal__actions",children:[s.jsx(f,{variant:"ghost",onClick:t,children:a("getCredits.done")}),s.jsx(f,{variant:"purple",onClick:D,children:a("primaryList.viewInShop")})]})]})}):s.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:s.jsxs("div",{className:"modal","data-testid":"modal",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsx("h2",{className:"modal__title",children:a("primaryList.publishTitle",{name:e.name})}),e.thumbnail?s.jsx("img",{className:"modal__img",src:e.thumbnail,alt:e.name}):null,s.jsx("p",{className:"muted small",children:a("primaryList.fromCollection",{collectionName:e.collectionName,count:e.remainingSupply})}),s.jsxs("label",{className:"field",children:[s.jsx("span",{children:a("primaryList.priceLabel",{currency:j.name})}),s.jsx("input",{type:"number",min:"1",step:"1",value:n,onChange:d=>_(d.target.value),disabled:m})]}),s.jsx("p",{className:"muted small",children:a("primaryList.pricedInWhole",{currency:j.name,currencySingular:j.nameSingular})}),h===!1&&!m?g?s.jsx("p",{className:"muted small primary-note",children:a("primaryList.firstTimeConfirm",{collectionName:e.collectionName})}):s.jsx("p",{className:"muted small primary-note",children:a("primaryList.firstTimeManaged",{collectionName:e.collectionName})}):h===!0&&!m?g?s.jsx("p",{className:"muted small primary-note",children:a("primaryList.readyConfirm")}):s.jsx("p",{className:"muted small primary-note",children:a("primaryList.readyManaged")}):null,y?s.jsx("p",{className:"muted",children:y}):null,s.jsx(W,{message:x}),s.jsxs("div",{className:"modal__actions",children:[s.jsx(f,{variant:"ghost",onClick:t,disabled:m,children:a("primaryList.cancel")}),s.jsx(f,{onClick:()=>void Q(),disabled:m||h===null,children:h===null?a("primaryList.checking"):G})]})]})})}export{fe as P,ge as S,ye as f};
|
|
1
|
+
import{g as w,W as K,n as M,t as a,C as P,B as f,h as j,p as $,o as C,r as E,m as T,X as O}from"./index-CxiM65Mp.js";import{d as F}from"./dcl-schemas-BICTSpB5.js";import{u as R,r as u,j as s}from"./react-C51i12iP.js";import{a as X,b as H,i as J,e as V,c as Y}from"./trade-encoding-D-nmkwVz.js";import{f as U}from"./errors-BVwqXLe5.js";import{E as W}from"./ErrorNotice-C7soUjRV.js";import{s as z}from"./wallet-kind-B9P1TeIH.js";const I=()=>`${w.builderServerUrl}/v1`;function q(e){return Array.isArray(e)?e:"results"in e&&Array.isArray(e.results)?e.results:"data"in e&&Array.isArray(e.data)?e.data:[]}async function B(e,r){const t=await K(e,{method:"GET",identity:r,metadata:{}});if(!t.ok)throw new Error(`builder-server ${t.status}: ${await t.text()}`);const l=await t.json();return l.data??l}function Z(e,r){const t=r-e;return t>0?t:0}function ee(e){var r,t,l,i,n;return((t=(r=e.data)==null?void 0:r.wearable)==null?void 0:t.category)??((i=(l=e.data)==null?void 0:l.emote)==null?void 0:i.category)??((n=e.data)==null?void 0:n.category)??e.type??"wearable"}function A(e){return`${I()}/storage/contents/${e}`}function S(e,r){if(!e)return"";if(/^https?:\/\//.test(e))return e;const t=r==null?void 0:r[e];return t?A(t):/^(ba|Qm)/.test(e)?A(e):""}async function se(e,r){try{const t=await fetch(`${I()}/items/${e}/${r}/contents`);if(!t.ok)return{};const l=await t.json();return l.data??l}catch{return{}}}async function ae(e,r,t){const l=S(e.thumbnail,e.contents)||S("thumbnail.png",e.contents);if(l)return l;if(r&&t){const i=await se(r,t);return S(e.thumbnail,i)||S("thumbnail.png",i)||S("image.png",i)}return""}async function te(e,r){const t=`${I()}/${e.toLowerCase()}/collections?is_published=true`,l=await B(t,r);return q(l).filter(i=>i.is_published&&!!i.contract_address).map(i=>({id:i.id,name:i.name,contractAddress:i.contract_address.toLowerCase(),isPublished:i.is_published,isApproved:i.is_approved,minters:(i.minters??[]).map(n=>n.toLowerCase())}))}async function re(e,r){const t=`${I()}/collections/${e.id}/items`,l=await B(t,r);return(await Promise.all(q(l).map(async n=>{const _=n.rarity??"common",y=Number(n.total_supply??0)||0;let o;try{o=F.Rarity.getMaxSupply(_)}catch{o=0}const x=(n.contract_address??e.contractAddress).toLowerCase(),p=n.blockchain_item_id??"";return{id:n.id,collectionId:e.id,collectionName:e.name,contractAddress:x,blockchainItemId:p,name:n.name,category:ee(n),rarity:_,thumbnail:await ae(n,x,p),type:n.type??"wearable",isPublished:n.is_published??e.isPublished,isApproved:n.is_approved??e.isApproved,totalSupply:y,maxSupply:o,remainingSupply:Z(y,o),minters:e.minters}}))).filter(ie)}function ie(e){return e.isPublished&&e.isApproved&&e.blockchainItemId!==""&&e.blockchainItemId!=null&&e.remainingSupply>0}async function ye(e,r){const t=await te(e,r);return(await Promise.all(t.map(async i=>{try{return await re(i,r)}catch{return[]}}))).flat()}const ne=1e3*60*60*24*182;function ge({asset:e,session:r,onClose:t}){const l=M(),i=R(),[n,_]=u.useState("10"),[y,o]=u.useState(null),[x,p]=u.useState(null),[m,N]=u.useState(!1),[h,v]=u.useState(null);async function k(){p(null);const c=Number(n);if(!Number.isInteger(c)||c<=0){p(a("sellModal.errorWholeNumber"));return}N(!0);try{o(a("sellModal.statusPreparing")),await X({signer:r.signer,contractAddress:e.contractAddress,chainId:e.chainId}),o(a("sellModal.statusListing"));const g=await H({signer:r.signer,nft:{contractAddress:e.contractAddress,tokenId:e.tokenId,network:e.network,chainId:e.chainId},usdPrice:c/10,expiresAtMs:Date.now()+ne});o(a("sellModal.statusPublishing")),await $(g,r.identity),o(null),v(c),C("Shop Listed Item",{item_id:e.itemId??e.tokenId??null,contract_address:e.contractAddress,price_credits:c,price_usd:c/10,listing_type:"secondary",is_primary:!1}),E.success(a("sellModal.toastOnSale",{name:e.name})),l.invalidateQueries({queryKey:["my-assets",r.address]})}catch(g){T(g,{flow:"list_secondary"}),C("Shop Listing Failed",{listing_type:"secondary",error_code:O(g)}),p(U(g,a("sellModal.errorGeneric"))),o(null)}finally{N(!1)}}function L(){t(),i(`/item/${e.contractAddress}/${e.tokenId}`)}return h!==null?s.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:s.jsxs("div",{className:"modal modal--success",onClick:c=>c.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),s.jsx("h2",{className:"modal__title",children:a("sellModal.successTitle")}),e.image?s.jsx("img",{className:"modal__img",src:e.image,alt:e.name}):null,s.jsx("p",{className:"modal-success__name",children:e.name}),s.jsxs("p",{className:"muted small",children:[a("sellModal.listedFor")," ",s.jsxs("strong",{children:[s.jsx(P,{className:"ccy-mark"})," ",h]})]}),s.jsxs("div",{className:"modal__actions",children:[s.jsx(f,{variant:"ghost",onClick:t,children:a("getCredits.done")}),s.jsx(f,{variant:"purple",onClick:L,children:a("sellModal.viewInShop")})]})]})}):s.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:s.jsxs("div",{className:"modal","data-testid":"modal",onClick:c=>c.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsx("h2",{className:"modal__title",children:a("sellModal.listTitle",{name:e.name})}),e.image?s.jsx("img",{className:"modal__img",src:e.image,alt:e.name}):null,s.jsxs("label",{className:"field",children:[s.jsx("span",{children:a("sellModal.priceLabel",{currency:j.name})}),s.jsx("input",{type:"number",min:"1",step:"1",value:n,onChange:c=>_(c.target.value),disabled:m})]}),s.jsx("p",{className:"muted small",children:a("sellModal.pricedInWhole",{currency:j.name,currencySingular:j.nameSingular})}),y?s.jsx("p",{className:"muted",children:y}):null,s.jsx(W,{message:x}),s.jsxs("div",{className:"modal__actions",children:[s.jsx(f,{variant:"ghost",onClick:t,disabled:m,children:a("sellModal.cancel")}),s.jsx(f,{onClick:()=>void k(),disabled:m,children:m?a("sellModal.listing"):a("sellModal.putOnSale")})]})]})})}const le=1e3*60*60*24*182;function fe({item:e,session:r,onClose:t}){const l=M(),i=R(),[n,_]=u.useState("10"),[y,o]=u.useState(null),[x,p]=u.useState(null),[m,N]=u.useState(!1),[h,v]=u.useState(null),[k,L]=u.useState(null),c=w.chainId,g=z(r.providerType);u.useEffect(()=>{let d=!1;return(async()=>{try{const b=await J({contractAddress:e.contractAddress,chainId:c});d||v(b)}catch{d||v(!1)}})(),()=>{d=!0}},[e.contractAddress,c]);async function Q(){p(null);const d=Number(n);if(!Number.isInteger(d)||d<=0){p(a("primaryList.errorWholeNumber"));return}N(!0);try{h||(o(a("primaryList.statusEnabling")),await V({signer:r.signer,contractAddress:e.contractAddress,chainId:c}),v(!0)),o(a("primaryList.statusPublishing"));const b=await Y({signer:r.signer,item:{contractAddress:e.contractAddress,itemId:e.blockchainItemId,network:F.Network.MATIC,chainId:c},usdPrice:d/10,uses:e.remainingSupply,expiresAtMs:Date.now()+le});o(a("primaryList.statusFinishing")),await $(b,r.identity),o(null),L(d),C("Shop Listed Item",{item_id:e.blockchainItemId,contract_address:e.contractAddress,price_credits:d,price_usd:d/10,listing_type:"primary",is_primary:!0}),E.success(a("primaryList.toastOnSale",{name:e.name})),l.invalidateQueries({queryKey:["publishable-items"]}),l.invalidateQueries({queryKey:["collection-sale-state"]})}catch(b){T(b,{flow:"list_primary"}),C("Shop Listing Failed",{listing_type:"primary",error_code:O(b)}),p(U(b,a("primaryList.errorGeneric"))),o(null)}finally{N(!1)}}function D(){t(),i(`/item/${e.contractAddress}/${e.blockchainItemId}`)}const G=m?a("primaryList.listing"):h===!1?a("primaryList.enableAndPutOnSale"):a("primaryList.putOnSale");return k!==null?s.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:s.jsxs("div",{className:"modal modal--success",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),s.jsx("h2",{className:"modal__title",children:a("primaryList.successTitle")}),e.thumbnail?s.jsx("img",{className:"modal__img",src:e.thumbnail,alt:e.name}):null,s.jsx("p",{className:"modal-success__name",children:e.name}),s.jsxs("p",{className:"muted small",children:[a("primaryList.listedFor")," ",s.jsxs("strong",{children:[s.jsx(P,{className:"ccy-mark"})," ",k]})," ",a("primaryList.dotAvailable",{count:e.remainingSupply})]}),s.jsxs("div",{className:"modal__actions",children:[s.jsx(f,{variant:"ghost",onClick:t,children:a("getCredits.done")}),s.jsx(f,{variant:"purple",onClick:D,children:a("primaryList.viewInShop")})]})]})}):s.jsx("div",{className:"modal-backdrop",onClick:t,role:"presentation",children:s.jsxs("div",{className:"modal","data-testid":"modal",onClick:d=>d.stopPropagation(),role:"dialog","aria-modal":"true",children:[s.jsx("h2",{className:"modal__title",children:a("primaryList.publishTitle",{name:e.name})}),e.thumbnail?s.jsx("img",{className:"modal__img",src:e.thumbnail,alt:e.name}):null,s.jsx("p",{className:"muted small",children:a("primaryList.fromCollection",{collectionName:e.collectionName,count:e.remainingSupply})}),s.jsxs("label",{className:"field",children:[s.jsx("span",{children:a("primaryList.priceLabel",{currency:j.name})}),s.jsx("input",{type:"number",min:"1",step:"1",value:n,onChange:d=>_(d.target.value),disabled:m})]}),s.jsx("p",{className:"muted small",children:a("primaryList.pricedInWhole",{currency:j.name,currencySingular:j.nameSingular})}),h===!1&&!m?g?s.jsx("p",{className:"muted small primary-note",children:a("primaryList.firstTimeConfirm",{collectionName:e.collectionName})}):s.jsx("p",{className:"muted small primary-note",children:a("primaryList.firstTimeManaged",{collectionName:e.collectionName})}):h===!0&&!m?g?s.jsx("p",{className:"muted small primary-note",children:a("primaryList.readyConfirm")}):s.jsx("p",{className:"muted small primary-note",children:a("primaryList.readyManaged")}):null,y?s.jsx("p",{className:"muted",children:y}):null,s.jsx(W,{message:x}),s.jsxs("div",{className:"modal__actions",children:[s.jsx(f,{variant:"ghost",onClick:t,disabled:m,children:a("primaryList.cancel")}),s.jsx(f,{onClick:()=>void Q(),disabled:m||h===null,children:h===null?a("primaryList.checking"):G})]})]})})}export{fe as P,ge as S,ye as f};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{j as s,u as se,r as n,L as te}from"./react-C51i12iP.js";import{t as a,a2 as L,s as _,L as ae,u as ie,b as re,n as ne,I as E,B as P,r as R}from"./index-
|
|
1
|
+
import{j as s,u as se,r as n,L as te}from"./react-C51i12iP.js";import{t as a,a2 as L,s as _,L as ae,u as ie,b as re,n as ne,I as E,B as P,r as R}from"./index-CxiM65Mp.js";import{u as oe,d as le,t as ce,L as de,i as B,a as v,s as me}from"./useStore-B_g31vF6.js";import{E as M}from"./ErrorNotice-C7soUjRV.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DKBoGDXH.js";import"./ethers-BeFqf2KO.js";import"./intl-CBcMB1D2.js";const ue="https://cdn.decentraland.org/@dcl/shop/0.1.0-29905759067.commit-1f1fc48/assets/template-cover-1-BETekfHg.jpeg",pe="https://cdn.decentraland.org/@dcl/shop/0.1.0-29905759067.commit-1f1fc48/assets/template-cover-2-Dni9s0i_.jpeg",ge=Object.assign({"../assets/creator-covers/template-cover-1.jpeg":ue,"../assets/creator-covers/template-cover-2.jpeg":pe}),f=Object.entries(ge).sort(([i],[d])=>i.localeCompare(d)).map(([i,d])=>({name:i.split("/").pop(),url:d})),ve=ae`
|
|
2
2
|
to {
|
|
3
3
|
transform: rotate(360deg);
|
|
4
4
|
}
|
|
5
|
-
`,
|
|
5
|
+
`,fe=_.div`
|
|
6
6
|
display: flex;
|
|
7
7
|
align-items: center;
|
|
8
8
|
justify-content: center;
|
|
@@ -16,7 +16,7 @@ import{j as s,u as se,r as n,L as te}from"./react-C51i12iP.js";import{t as a,a2
|
|
|
16
16
|
flex-direction: column;
|
|
17
17
|
text-align: center;
|
|
18
18
|
}
|
|
19
|
-
`,
|
|
19
|
+
`,he=_.span`
|
|
20
20
|
flex: none;
|
|
21
21
|
border-radius: 50%;
|
|
22
22
|
border-style: solid;
|
|
@@ -46,8 +46,8 @@ import{j as s,u as se,r as n,L as te}from"./react-C51i12iP.js";import{t as a,a2
|
|
|
46
46
|
`,xe=_.span`
|
|
47
47
|
font-size: 14px;
|
|
48
48
|
font-weight: 600;
|
|
49
|
-
`;function _e({label:i,size:d="medium",direction:b="column",className:j}){return s.jsxs(
|
|
49
|
+
`;function _e({label:i,size:d="medium",direction:b="column",className:j}){return s.jsxs(fe,{className:j,"data-testid":"spinner-box","data-direction":b,role:"status","aria-live":"polite","aria-label":i?void 0:a("spinner.loading"),children:[s.jsx(he,{"data-testid":"spinner-box-ring","data-size":d,"aria-hidden":!0}),i?s.jsx(xe,{children:i}):null]})}const be=_(P)`
|
|
50
50
|
align-self: center;
|
|
51
51
|
min-width: 200px;
|
|
52
52
|
margin-top: 8px;
|
|
53
|
-
`,O=1e6,A={cover:"",coverName:"",coverHash:"",description:"",links:{website:"",twitter:"",discord:"",facebook:""}};function D(i){return`${(i/1e6).toLocaleString(void 0,{maximumFractionDigits:2})}MB`}function ye(){ie({title:a("seo.storeSettings.title"),noindex:!0});const{session:i,signIn:d}=re(),b=se(),j=ne(),c=i==null?void 0:i.address,{data:S,isLoading:F}=oe(c),[r,m]=n.useState(A),[C,y]=n.useState(A),[k,p]=n.useState(),[g,$]=n.useState(!1),[o,N]=n.useState(null),[
|
|
53
|
+
`,O=1e6,A={cover:"",coverName:"",coverHash:"",description:"",links:{website:"",twitter:"",discord:"",facebook:""}};function D(i){return`${(i/1e6).toLocaleString(void 0,{maximumFractionDigits:2})}MB`}function ye(){ie({title:a("seo.storeSettings.title"),noindex:!0});const{session:i,signIn:d}=re(),b=se(),j=ne(),c=i==null?void 0:i.address,{data:S,isLoading:F}=oe(c),[r,m]=n.useState(A),[C,y]=n.useState(A),[k,p]=n.useState(),[g,$]=n.useState(!1),[o,N]=n.useState(null),[h,V]=n.useState({}),z=n.useRef(null);n.useEffect(()=>{if(S){const e=le(S);m(e),y(e),p(void 0),N(e.cover?{url:e.cover,name:e.coverName,hash:e.coverHash}:null)}},[S]),n.useEffect(()=>{let e=!1;return Promise.all(f.map(async t=>[t.name,await ce(t.url)])).then(t=>{e||V(Object.fromEntries(t))}).catch(()=>{}),()=>{e=!0}},[]);const x=n.useMemo(()=>{const e=f.find(l=>r.coverName===`cover/${l.name}`);if(e)return e.name;const t=r.coverHash?f.find(l=>h[l.name]===r.coverHash):void 0;return t==null?void 0:t.name},[r.coverName,r.coverHash,h]);n.useEffect(()=>{o!=null&&o.hash&&f.some(e=>h[e.name]===o.hash)&&N(null)},[h,o]);const I=k!==void 0&&k>O,Y=n.useMemo(()=>de.filter(e=>!B(e,r.links[e])),[r.links]),K=I||Y.length>0,w=n.useMemo(()=>JSON.stringify(r)!==JSON.stringify(C),[r,C]),q=w&&!K&&!g;if(n.useEffect(()=>{if(!w)return;const e=t=>{t.preventDefault()};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[w]),!i)return s.jsxs("section",{className:"store-settings store-settings--signin","aria-label":a("storeSettings.title"),children:[s.jsx("h1",{className:"store-settings__title",children:a("storeSettings.title")}),s.jsx("p",{className:"muted",children:a("storeSettings.signInPrompt")}),s.jsx(be,{variant:"purple",onClick:d,children:a("storeSettings.signIn")})]});function G(e,t){p(void 0),m(l=>({...l,cover:t,coverName:`cover/${e}`,coverHash:""}))}const J=["image/png","image/jpeg","image/webp"];function Q(e){var H;const t=(H=e.target.files)==null?void 0:H[0];if(!t||!J.includes(t.type))return;p(t.size);const l=`cover/${t.name}`,u=new FileReader;u.onload=()=>{const T=u.result;N({url:T,name:l,hash:""}),m(ee=>({...ee,cover:T,coverName:l,coverHash:""}))},u.readAsDataURL(t)}function U(){o&&(p(void 0),m(e=>({...e,cover:o.url,coverName:o.name,coverHash:o.hash})))}function W(e,t){const l=t?(v[e]+t).replace(/\s/g,""):"";m(u=>({...u,links:{...u.links,[e]:l}}))}function X(e){const t=r.links[e];return e==="website"?t:t.replace(v[e],"")}async function Z(){if(!(!c||!i)){$(!0);try{await me(c,r,i.identity),y(r),p(void 0),await j.invalidateQueries({queryKey:["store",c.toLowerCase()]}),R.success(a("storeSettings.saved")),b(`/assets/creator/${c}`)}catch{R.error(a("storeSettings.saveError"))}finally{$(!1)}}}return s.jsxs("section",{className:"store-settings","aria-label":a("storeSettings.title"),children:[s.jsxs("div",{className:"store-settings__head",children:[s.jsxs("div",{className:"store-settings__heading",children:[c?s.jsx(te,{className:"store-settings__back",to:`/assets/creator/${c}`,title:a("storeSettings.back"),"aria-label":a("storeSettings.back"),children:s.jsx(E,{name:"arrow-left"})}):null,s.jsx("h1",{className:"store-settings__title",children:a("storeSettings.title")})]}),c?s.jsxs("a",{className:"store-settings__guest",href:`/assets/creator/${c}`,target:"_blank",rel:"noopener noreferrer",children:[a("storeSettings.seeAsGuest"),s.jsx(E,{name:"external-link"})]}):null]}),F?s.jsx(_e,{size:"large",label:a("storeSettings.loading"),className:"store-settings__loading"}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"field",children:[s.jsx("span",{className:"field__label",children:a("storeSettings.cover")}),s.jsxs("div",{className:"cover-picker",role:"group","aria-label":a("storeSettings.cover"),children:[f.map(e=>{const t=x===e.name;return s.jsx("button",{type:"button",className:`cover-picker__tile${t?" is-selected":""}`,"data-testid":"cover-picker-tile","data-selected":t,"aria-pressed":t,onClick:()=>G(e.name,e.url),children:s.jsx("img",{src:e.url,alt:"",loading:"lazy"})},e.name)}),o?s.jsx("button",{type:"button",className:`cover-picker__tile cover-picker__tile--custom${x?"":" is-selected"}`,"data-testid":"cover-picker-tile","data-variant":"custom","data-selected":!x,"aria-pressed":!x,onClick:U,children:s.jsx("img",{src:o.url,alt:""})}):null,s.jsxs("button",{type:"button",className:"cover-picker__tile cover-picker__upload","data-testid":"cover-picker-tile","data-variant":"upload",onClick:()=>{var e;return(e=z.current)==null?void 0:e.click()},children:[s.jsx(E,{name:"upload"}),s.jsx("span",{children:a("storeSettings.upload")})]}),s.jsx("input",{ref:z,type:"file",accept:"image/png, image/jpeg, image/webp",className:"cover-picker__input","data-testid":"cover-picker-input",onChange:Q})]}),I?s.jsx(M,{message:a("storeSettings.sizeError",{max:D(O),current:D(k)})}):null]}),s.jsxs("label",{className:"field",children:[s.jsx("span",{className:"field__label",children:a("storeSettings.description")}),s.jsx("textarea",{value:r.description,rows:4,disabled:g,onChange:e=>m(t=>({...t,description:e.target.value}))})]}),s.jsxs("label",{className:"field",children:[s.jsx("span",{className:"field__label",children:a("storeSettings.website")}),s.jsx("input",{type:"url",value:r.links.website,placeholder:v.website,disabled:g,onChange:e=>m(t=>({...t,links:{...t.links,website:e.target.value.replace(/\s/g,"")}}))}),B("website",r.links.website)?null:s.jsx(M,{message:a("storeSettings.linkError",{value:v.website})})]}),["twitter","discord","facebook"].map(e=>s.jsxs("label",{className:"field",children:[s.jsx("span",{className:"field__label",children:a(`storeSettings.${e}`)}),s.jsxs("div",{className:"field__prefixed",children:[s.jsx("span",{className:"field__prefix",children:v[e]}),s.jsx("input",{type:"text",value:X(e),disabled:g,onChange:t=>W(e,t.target.value)})]})]},e)),s.jsx("div",{className:"store-settings__actions",children:s.jsx(P,{variant:"purple",className:"store-settings__save","data-testid":"store-settings-save",onClick:()=>void Z(),disabled:!q,children:g?a("storeSettings.saving"):a("storeSettings.save")})})]})]})}export{ye as StoreSettings,ye as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,a as W,u as L,N as M,r as T}from"./react-C51i12iP.js";import{s as h,a2 as N,L as S,t as s,b as V,a3 as z,u as U,a4 as X,a5 as D,a6 as G,a7 as H,a8 as J,a9 as E,g as k,B as K,aa as Y}from"./index-
|
|
1
|
+
import{j as e,a as W,u as L,N as M,r as T}from"./react-C51i12iP.js";import{s as h,a2 as N,L as S,t as s,b as V,a3 as z,u as U,a4 as X,a5 as D,a6 as G,a7 as H,a8 as J,a9 as E,g as k,B as K,aa as Y}from"./index-CxiM65Mp.js";import{d as j}from"./dcl-schemas-BICTSpB5.js";import{s as q}from"./wallet-kind-B9P1TeIH.js";import{w as Q,S as Z}from"./buy-gasless-pwHqA_mF.js";import"./sentry-DKBoGDXH.js";import"./ethers-BeFqf2KO.js";import"./intl-CBcMB1D2.js";import"./trade-encoding-D-nmkwVz.js";import"./index-HN6Rk25C.js";const C="#2bb673",F=S`
|
|
2
2
|
to {
|
|
3
3
|
stroke-dashoffset: 0;
|
|
4
4
|
}
|