@dcl/shop 0.1.0-29942574523.commit-573f25e → 0.1.0-29944279663.commit-001b5a7
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-CzCwcFdY.js → AnimatedBackground-CPcXx1BG.js} +3 -3
- package/assets/{Assets-BTdyC00C.js → Assets-AjWSopj2.js} +1 -1
- package/assets/{Assets.styles-eeqx94WS.js → Assets.styles-BldKbSnl.js} +26 -27
- package/assets/{Authorizations-BZhmfDD4.js → Authorizations-DN5rReSr.js} +1 -1
- package/assets/Cart-BOomZzFA.js +3 -0
- package/assets/{Cart-Ep_4Wxpy.css → Cart-BqMUti_3.css} +1 -1
- package/assets/{CircularProgress-BivMeg1W.js → CircularProgress-B7vK7bWC.js} +1 -1
- package/assets/{Collection-DQAOAaC9.js → Collection-Op3SrGcQ.js} +1 -1
- package/assets/CollectionCarousel-C2R0_DIx.js +1 -0
- package/assets/{Creator-X75Qvpr4.js → Creator-BXkmnq6l.js} +1 -1
- package/assets/{CssVarsProvider-C0ny30E-.js → CssVarsProvider-CbqPuVyv.js} +1 -1
- package/assets/{ExchangeController-D0l6M3tj.js → ExchangeController-CkwXcZrE.js} +1 -1
- package/assets/GetCredits-DyYrVUsB.js +1 -0
- package/assets/{HelpersUtil-hamZLlhX.js → HelpersUtil-Cd6Cz7k6.js} +1 -1
- package/assets/{ImportListings-BFIpuuBM.js → ImportListings-BqaE2RRj.js} +1 -1
- package/assets/ItemDetail-CXntx0dm.js +78 -0
- package/assets/{LoadMore-BLy9p9ul.js → LoadMore-wolzH5ER.js} +1 -1
- package/assets/MarketCheckout-D_f5rC4e.js +3 -0
- package/assets/MyAssets-CBQJfW0w.js +258 -0
- package/assets/{MyFavorites-Dul-WC6l.js → MyFavorites-DtHDd-wr.js} +1 -1
- package/assets/{MyPurchases-DI0zzNTZ.js → MyPurchases-BBRP2pOD.js} +1 -1
- package/assets/{NotFound-Bdg_iIpB.js → NotFound-CJzX5KFi.js} +1 -1
- package/assets/PrimaryListModal-Bfe2jEqA.js +1 -0
- package/assets/{StoreSettings-2cViRT0c.js → StoreSettings-CCjyP-1z.js} +5 -5
- package/assets/Success-DgDiikPg.js +4 -0
- package/assets/{SwapController-DKBIcDPA.js → SwapController-CtlOMvk3.js} +1 -1
- package/assets/{Tooltip-DJ7HtAmB.js → Tooltip-BtGlCRjR.js} +1 -1
- package/assets/{TradeService-BpWgN8zg.js → TradeService-OKrfHBNk.js} +1 -1
- package/assets/{W3MFrameProviderSingleton-B40OWK0h.js → W3MFrameProviderSingleton-BFTt2bWv.js} +3 -3
- package/assets/{WebCryptoP256-Ccr1DsYO.js → WebCryptoP256-CNNq2h94.js} +1 -1
- package/assets/{authorizations-sU14ILrd.js → authorizations-ChRb35xG.js} +1 -1
- package/assets/{basic-DaSuNoEa.js → basic-O1kzoE_h.js} +1 -1
- package/assets/{biconomy-DmmBzkXG.js → biconomy-NJyzVP4P.js} +1 -1
- package/assets/{buy-BRLq1STf.js → buy-CNc4Y8CN.js} +1 -1
- package/assets/{buy-gasless-hR2bH0iR.js → buy-gasless-wrR0AjfW.js} +1 -1
- package/assets/{cart-checkout-CifIjL1z.js → cart-checkout-BAUaf92R.js} +1 -1
- package/assets/{categories-BPU8ySTe.js → categories-BKqMpg3a.js} +1 -1
- package/assets/{ccip-C1DhAmlP.js → ccip-DzP3mwwB.js} +1 -1
- package/assets/{ccip-pv6qu637.js → ccip-S_59ofbi.js} +1 -1
- package/assets/collection-4y6zy3OY.js +1 -0
- package/assets/{controller-DBPpBNi9.js → controller-CyymDuZ1.js} +2 -2
- package/assets/{core-CftjJZSY.js → core-DpgBxh1f.js} +4 -4
- package/assets/{custom-CLjHEVcz.js → custom-CUYXqRFz.js} +1 -1
- package/assets/{data-capture-ClKTWWBL.js → data-capture-DEtSxXU7.js} +1 -1
- package/assets/{email-Dx9BSTtw.js → email-CZBKdtTz.js} +1 -1
- package/assets/{embedded-wallet-CCKNmFwm.js → embedded-wallet-DI5q9f92.js} +1 -1
- package/assets/{emotion-styled.browser.esm-B6FBNgF3.js → emotion-styled.browser.esm-DSDqSITi.js} +1 -1
- package/assets/{engine-1UaDNb6s.js → engine-H6XTP7Hg.js} +1 -1
- package/assets/{errors-DKFg2ql0.js → errors-gKUnErEU.js} +1 -1
- package/assets/{estimate-l1-fee-cQM6_GVS.js → estimate-l1-fee-CRLseeHD.js} +1 -1
- package/assets/{execute-BuVfiwvM.js → execute-DnoTKwUA.js} +2 -2
- package/assets/{features-ieqkL6m1.js → features-DsCWYm7t.js} +1 -1
- package/assets/{fetchTokenMetadata-D8OWz4cP.js → fetchTokenMetadata-D8xF6Tp2.js} +2 -2
- package/assets/{get-ecosystem-wallet-info-LZLHBFVZ.js → get-ecosystem-wallet-info-eeuY73_c.js} +1 -1
- package/assets/{getBalance-Ck1YHbUL.js → getBalance-D4FtfBuc.js} +1 -1
- package/assets/{getNFT-DYxVn0Et.js → getNFT-CCUV8jjB.js} +1 -1
- package/assets/{getNFT-DnYNAiji.js → getNFT-DsBG7sol.js} +1 -1
- package/assets/{getOverlayAlpha-Jb_9sPPd.js → getOverlayAlpha-DD0MBenH.js} +1 -1
- package/assets/{hashTypedData-BHOeb4kN.js → hashTypedData-D4XcfX8m.js} +1 -1
- package/assets/{hashTypedData-Bqz6FRnB.js → hashTypedData-DY9RW77q.js} +1 -1
- package/assets/{import-CyzZeEcP.js → import-C4A0dOmT.js} +1 -1
- package/assets/{in-app-yMA-tvKO.js → in-app-miryaTIx.js} +1 -1
- package/assets/{in-app-wallet-calls-BJRqCE4k.js → in-app-wallet-calls-BNAeRkM1.js} +1 -1
- package/assets/{index-Dx4oKUoK.js → index-5BCUAQ7G.js} +1 -1
- package/assets/{index-B7YJ2-NC.js → index-B-lOuLL_.js} +1 -1
- package/assets/{index-YX1mo09T.js → index-B0f3YMv0.js} +1 -1
- package/assets/{index-3c-o1deN.js → index-B2KZdX5l.js} +1 -1
- package/assets/{index-LMkzNUyd.js → index-B7Aw3qxP.js} +1 -1
- package/assets/{index-Dil5ESgb.js → index-BHgNE80I.js} +1 -1
- package/assets/{index-Df4qngsG.js → index-BMxVktKR.js} +1 -1
- package/assets/{index-BLpc0PAw.js → index-BPTCeB75.js} +1 -1
- package/assets/{index-LQPmlKJw.js → index-BR9EQbWB.js} +1 -1
- package/assets/{index-BgMPhDEY.js → index-BVDwZ7ux.js} +1 -1
- package/assets/{index-B6Hb0r15.js → index-BaEQqKh7.js} +1 -1
- package/assets/{index-Chx72aoA.js → index-Bd6HRkkM.js} +1 -1
- package/assets/{index-D0tMQ_oG.js → index-BeDPwdIU.js} +1 -1
- package/assets/{index-C0MEN305.js → index-BeF4PcAs.js} +1 -1
- package/assets/{index-DHzasbYL.js → index-Bnxb7s2U.js} +1 -1
- package/assets/index-Bw9Y53F1.css +1 -0
- package/assets/index-C1yBaAe9.js +289 -0
- package/assets/{index-uESxdvPf.js → index-CAtCo41a.js} +1 -1
- package/assets/{index-B55KertC.js → index-CJ72HArz.js} +1 -1
- package/assets/{index-zfsFyt-v.js → index-CKain9CR.js} +1 -1
- package/assets/{index-CO9CUrPm.js → index-CNUSWwhT.js} +2 -2
- package/assets/{index-mc7xea6T.js → index-CS_YGkJS.js} +1 -1
- package/assets/{index-Cenx9VIL.js → index-CUapata6.js} +1 -1
- package/assets/{index-DM6cwvvh.js → index-CW4WLUXF.js} +1 -1
- package/assets/{index-BVjayAtf.js → index-CaKtCSoO.js} +1 -1
- package/assets/{index-0C8jHF02.js → index-CchI9mHk.js} +1 -1
- package/assets/{index-B8PSEU0f.js → index-Cd8SstNC.js} +1 -1
- package/assets/{index-Bxu_HZv7.js → index-Cglxr6xq.js} +1 -1
- package/assets/{index-0Z5nkscP.js → index-CitxiVaF.js} +1 -1
- package/assets/{index-fvb_2ePt.js → index-CpUzfl0K.js} +1 -1
- package/assets/{index-CqYieDft.js → index-CryDMiQl.js} +1 -1
- package/assets/{index-nmCuLAGG.js → index-CvSuJFRB.js} +1 -1
- package/assets/{index-DwFc8v1Z.js → index-D-u-hSI3.js} +1 -1
- package/assets/{index-Dszgr0BR.js → index-D15jEYwr.js} +1 -1
- package/assets/{index-B_fPkyQt.js → index-D4MR9O_F.js} +1 -1
- package/assets/{index-CWcMLN9O.js → index-DBt6hDgv.js} +1 -1
- package/assets/{index-Dc1nvyn9.js → index-DNxKrdux.js} +1 -1
- package/assets/{index-a_8ZLAR0.js → index-DSw2AqET.js} +1 -1
- package/assets/{index-D18uHh6f.js → index-DWxI9Hlb.js} +1 -1
- package/assets/{index-Bc63dzBj.js → index-DXtL9zpK.js} +3 -3
- package/assets/{index-CCr2J09y.js → index-DbySRbMy.js} +2 -2
- package/assets/{index-DSbcS8Gm.js → index-DpDqOxel.js} +1 -1
- package/assets/{index-DPjEYQhJ.js → index-DsrJfyy3.js} +1 -1
- package/assets/{index-BEOJi3Jo.js → index-G8bd0RHd.js} +1 -1
- package/assets/{index-xFOezD9a.js → index-KOeN6JEM.js} +1 -1
- package/assets/{index-CstoEHiD.js → index-U4GunfhO.js} +1 -1
- package/assets/{index-WrHr3vKs.js → index-ZiBxg6FP.js} +2 -2
- package/assets/{index-BlKccc7B.js → index-dBhDm5QH.js} +1 -1
- package/assets/{index-KyO7a8ne.js → index-iruECcYS.js} +3 -3
- package/assets/{index-O1MAeCt1.js → index-k4CkTGxw.js} +1 -1
- package/assets/{index-DJEb_i4T.js → index-rbNc96Al.js} +1 -1
- package/assets/{index-DPm2T7me.js → index-sXacIDUz.js} +3 -3
- package/assets/{index-CVG4mg1H.js → index-wJEgDopC.js} +1 -1
- package/assets/{index.es-CP2cNM9F.js → index.es-BxcQA2dU.js} +1 -1
- package/assets/{index.es-Dy8PEmK4.js → index.es-Cl_XwBUi.js} +4 -4
- package/assets/{index.es-B-uJmNhd.js → index.es-DIuzDiOd.js} +1 -1
- package/assets/{localBatchGatewayRequest-Dg8trW1f.js → localBatchGatewayRequest-DInd0cLm.js} +1 -1
- package/assets/{mana-rate-DtQ8WpoI.js → mana-rate-CQNKlfL0.js} +1 -1
- package/assets/{networks-BaSDToU0.js → networks-Cov5QiMG.js} +1 -1
- package/assets/{onramp-D6REu-OE.js → onramp-hb5ff0As.js} +1 -1
- package/assets/{openzeppelin-DsZ0ZpWh.js → openzeppelin-Bjn2nu6_.js} +1 -1
- package/assets/{parseNft-BrwItloF.js → parseNft-D9LBoQtO.js} +2 -2
- package/assets/{parseSignature-C67g8Ikn.js → parseSignature-L1A1P3GM.js} +1 -1
- package/assets/{parseSignature-CtBPNsAi.js → parseSignature-ePtMgMiu.js} +3 -3
- package/assets/{passkeys-CkVvpC6F.js → passkeys-DmsGOzkI.js} +1 -1
- package/assets/{pay-with-exchange-DDftQXGa.js → pay-with-exchange-AEyKwlqz.js} +1 -1
- package/assets/{qr-overlay-CHyDfEfF.js → qr-overlay-DyUlpaIC.js} +1 -1
- package/assets/{receive-BqeMp3_k.js → receive-DXQR7h-2.js} +1 -1
- package/assets/{resolveImplementation-D6GNwvZn.js → resolveImplementation-BXX46XHe.js} +1 -1
- package/assets/{rpc-D1wZc4pd.js → rpc-DpwEotT8.js} +1 -1
- package/assets/{secp256k1-Cu8gqKOi.js → secp256k1-CAtCZ-Xr.js} +1 -1
- package/assets/{secp256k1-DKdkwurr.js → secp256k1-DXm6hl-z.js} +1 -1
- package/assets/{secp256k1-tM-HU4Wb.js → secp256k1-IsXW7STM.js} +1 -1
- package/assets/{send-C5LlTSZw.js → send-CbWz9hcp.js} +1 -1
- package/assets/{send-batch-transaction-2M20mpyd.js → send-batch-transaction-9mR-y7h4.js} +1 -1
- package/assets/{send-eip712-transaction-DxCA-Uwd.js → send-eip712-transaction-CM2oNuUv.js} +2 -2
- package/assets/{send-gasless-transaction-VjwN2uQK.js → send-gasless-transaction-Dt3TrVjF.js} +2 -2
- package/assets/{send-transaction-Bb0Q9hmN.js → send-transaction-BZ4LJjTi.js} +2 -2
- package/assets/{sendRawTransaction-CED77ONZ.js → sendRawTransaction--x3C4a4M.js} +3 -3
- package/assets/{serializeTransaction-7yAEy3FU.js → serializeTransaction-DkNQBPpa.js} +1 -1
- package/assets/{session-proposal-DGrkZ9Ix.js → session-proposal-C_7oJg4v.js} +1 -1
- package/assets/{session-request-Dg8cFRll.js → session-request-BswrUDyz.js} +2 -2
- package/assets/{signing-DuUwyfpZ.js → signing-Ci_N7XnZ.js} +3 -3
- package/assets/{socials-cbGvEEpM.js → socials-Cy0uuEjD.js} +1 -1
- package/assets/{swaps-EURvYFti.js → swaps-CJefGDGP.js} +1 -1
- package/assets/{thirdweb-D4Tt3SPK.js → thirdweb-_jeY-8oo.js} +3 -3
- package/assets/{to-serializable-transaction-Dh5bAtyQ.js → to-serializable-transaction-z3rODop-.js} +2 -2
- package/assets/{trade-encoding-0IFZ39Tk.js → trade-encoding-DQ3zNCj8.js} +1 -1
- package/assets/{transactionReceipt-DIw9ApVw.js → transactionReceipt-CmnDZJIN.js} +1 -1
- package/assets/{transactions-xAqHSp91.js → transactions-C19bGnmB.js} +1 -1
- package/assets/useCreditPacks-Caur-2iX.js +1 -0
- package/assets/{useInfiniteGrid-BbeLTVdN.js → useInfiniteGrid-CRDFn4if.js} +1 -1
- package/assets/{useStore-PWA7dbNJ.js → useStore-DjC0Mzyl.js} +1 -1
- package/assets/useTheme-4G-3zKnL.js +1 -0
- package/assets/{useTheme-BHtz4hyG.js → useTheme-YjNnj0AZ.js} +1 -1
- package/assets/{verifyHash-sv4aRvH_.js → verifyHash-C_4O6fWL.js} +1 -1
- package/assets/{w3m-modal-D1RMqW5z.js → w3m-modal-C8bpYQNG.js} +1 -1
- package/assets/{w3m-modal-BoTSPCYe.js → w3m-modal-Ckpscz46.js} +1 -1
- package/assets/{wait-for-tx-receipt-CnoUxMtV.js → wait-for-tx-receipt-FMU2_8T4.js} +1 -1
- package/assets/{wallets-Cuqbvnoy.js → wallets-DdObuep1.js} +5 -5
- package/assets/{web-connector-0FomZsHS.js → web-connector-CnDHaN6b.js} +3 -3
- package/assets/{writeContract-Bicvfabo.js → writeContract-C9X9RN9V.js} +1 -1
- package/assets/{zoraTestnet-4QPNkDlh.js → zoraTestnet-d3v06Qdp.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/assets/Cart-BicSZMzV.js +0 -3
- package/assets/CollectionCarousel-D_udpdxX.js +0 -1
- package/assets/GetCredits-CMdoboQp.js +0 -1
- package/assets/ItemDetail-C0Sm18Me.js +0 -78
- package/assets/MarketCheckout-DSl7Bl-M.js +0 -3
- package/assets/MyAssets-UFPrjPwu.js +0 -258
- package/assets/PrimaryListModal-CnlMOkG5.js +0 -1
- package/assets/Success-D9l7pr2K.js +0 -4
- package/assets/collection-DhudRI2A.js +0 -1
- package/assets/index-CJ4mXolB.js +0 -289
- package/assets/index-CqYr0ABc.css +0 -1
- package/assets/useCreditPacks-DO-uyk4N.js +0 -1
- package/assets/useTheme-Ciqd957r.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as K,r as u,j as e,L as B}from"./react-BrLDncxD.js";import{e as $,t as s,C as w,B as k,
|
|
1
|
+
import{a as K,r as u,j as e,L as B}from"./react-BrLDncxD.js";import{e as $,t as s,C as w,B as k,g as L,x as P,E as A,u as U,d as W,o as O,m as z,s as Q,J}from"./index-C1yBaAe9.js";import{i as Y,R as D,f as G}from"./import-C4A0dOmT.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-CLB2z3On.js";import"./intl-CBcMB1D2.js";import"./buy-CNc4Y8CN.js";import"./authorizations-ChRb35xG.js";import"./index-HN6Rk25C.js";import"./trade-encoding-DQ3zNCj8.js";import"./mana-rate-CQNKlfL0.js";function H({queue:n,session:T,onClose:j,onDone:h}){const N=K(),d=$(T.providerType),[m,f]=u.useState(()=>n.map(()=>"pending")),[I,E]=u.useState("running"),S=u.useRef(!1);u.useEffect(()=>{if(S.current)return;S.current=!0;let t=!1;return(async()=>{for(let r=0;r<n.length;r++){if(t)return;f(p=>p.map((g,o)=>o===r?"active":g));try{await Y(n[r].item,n[r].priceCredits,T),P("Shop Migrated Listing",{item_id:n[r].item.itemId??n[r].item.oldTradeId??null,contract_address:n[r].item.contractAddress,new_price_credits:n[r].priceCredits,new_price_usd:n[r].priceCredits/10}),t||f(p=>p.map((g,o)=>o===r?"done":g))}catch(p){if(p instanceof D)A(p,{flow:"import_listing",step:"relist",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(g=>g.map((o,b)=>b===r?"unlisted":o));else{const g=p,o=g.code===4001||/reject|denied|cancel/i.test(g.message??"");o||A(p,{flow:"import_listing",itemId:n[r].item.itemId??n[r].item.oldTradeId}),t||f(b=>b.map((a,l)=>l===r?o?"skipped":"failed":a))}}}t||E("finished")})(),()=>{t=!0}},[]);const _=m.filter(t=>t==="done").length,v=m.findIndex(t=>t==="active"),x=Math.round(m.filter(t=>t!=="pending"&&t!=="active").length/n.length*100);function y(){h(),j()}if(I==="finished"){const t=m.filter(r=>r==="skipped"||r==="failed").length,c=m.filter(r=>r==="unlisted").length;return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal modal--success",role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:_>0?s("migrate.successTitle"):s("migrate.nothingTitle")}),e.jsxs("p",{className:"muted",style:{margin:0},children:[_>0?s("migrate.listedSummary",{count:_,currency:w.name}):s("migrate.noneListed"),t>0?" "+s("migrate.skippedSummary",{count:t}):"",c>0?" "+s("migrate.unlistedSummary",{count:c}):""]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(k,{variant:"ghost",onClick:y,children:s("getCredits.done")}),c>0?e.jsx(k,{variant:"purple",onClick:()=>{h(),j(),N("/my-assets")},children:s("migrate.goToMyAssets")}):_>0?e.jsx(k,{variant:"purple",onClick:()=>{h(),j(),N("/assets")},children:s("migrate.viewInShop")}):null]})]})})}return e.jsx("div",{className:"modal-backdrop",role:"presentation",children:e.jsxs("div",{className:"modal migrate","data-testid":"modal",role:"dialog","aria-modal":"true","aria-live":"polite",children:[e.jsx("h2",{className:"modal__title",children:s("migrate.listingTitle")}),e.jsxs("p",{className:"muted small",style:{margin:"0 0 4px"},children:[d?s("migrate.subConfirm"):s("migrate.subManaged")," ",v>=0?s("migrate.progressCount",{current:v+1,total:n.length}):""]}),e.jsx("div",{className:"migrate__progress",children:e.jsx("div",{className:"migrate__bar",style:{width:`${x}%`}})}),e.jsx("ul",{className:"migrate__list",children:n.map((t,c)=>e.jsxs("li",{className:`migrate__row migrate__row--${m[c]}`,children:[e.jsx("span",{className:"migrate__thumb",children:t.item.thumbnail?e.jsx("img",{src:t.item.thumbnail,alt:""}):null}),e.jsx("span",{className:"migrate__name",title:t.item.name,children:t.item.name||s("migrate.itemFallback")}),e.jsxs("span",{className:"migrate__price",children:[e.jsx(L,{className:"ccy-mark"})," ",t.priceCredits.toLocaleString()]}),e.jsx("span",{className:"migrate__status",children:m[c]==="active"?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"spinner migrate__spin","aria-hidden":!0})," ",d?s("migrate.statusConfirm"):s("migrate.statusAdding")]}):m[c]==="done"?e.jsx("span",{className:"migrate__tick",children:"✓"}):m[c]==="skipped"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusSkipped")}):m[c]==="failed"?e.jsx("span",{className:"migrate__skip",children:s("migrate.statusFailed")}):m[c]==="unlisted"?e.jsx("span",{className:"migrate__skip",title:s("migrate.unlistedTooltip"),children:s("migrate.statusUnlisted")}):e.jsx("span",{className:"migrate__wait",children:s("migrate.statusWaiting")})})]},t.item.oldTradeId))}),e.jsx("p",{className:"muted small migrate__hint",children:d?s("migrate.hintConfirm"):s("migrate.hintManaged")})]})})}const F=Q(k)`
|
|
2
2
|
margin-top: 10px;
|
|
3
3
|
`,V=Q(k)`
|
|
4
4
|
padding: 13px 24px;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CpUzfl0K.js","assets/react-BrLDncxD.js","assets/dcl-schemas-BICTSpB5.js","assets/index-C1yBaAe9.js","assets/sentry-DYZXk5O5.js","assets/ethers-CLB2z3On.js","assets/intl-CBcMB1D2.js","assets/index-Bw9Y53F1.css","assets/emotion-styled.browser.esm-DSDqSITi.js","assets/useTheme-YjNnj0AZ.js","assets/CircularProgress-B7vK7bWC.js","assets/index-dBhDm5QH.js","assets/useTheme-4G-3zKnL.js","assets/CssVarsProvider-CbqPuVyv.js","assets/getOverlayAlpha-DD0MBenH.js","assets/index-BVDwZ7ux.js","assets/colors-LINLm1ux.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as oe,r as d,j as e,d as pa,u as ya,L as fa}from"./react-BrLDncxD.js";import{d as X,n as xa,o as ve,t,ah as ba,i as ga,b as ja,w as va,q as ne,x as D,y as ge,z as fe,ai as Na,E as Z,g as E,j as de,B as z,C as xe,p as wa,J as Je,_ as be,ak as ka,ax as Ia,ay as Ca,az as Sa,aA as Aa,c as Ne,aB as Ma,L as Ye,m as B,aC as Pa,I as T,F as K,s as W,aD as Ea,aE as Fa,aF as La,G as Ta,ae as ze,a as Ke,aG as Da,aH as Ra,aI as qa,aJ as Ba,aK as $a,af as Oa,u as za,aL as Ka,aM as Wa,aN as Va,h as Qa,aO as We,aP as Ua,f as Ga,ao as Ha,aQ as Ja,aR as Ya,ap as Xa,aS as Za,aT as et}from"./index-C1yBaAe9.js";import{d as G}from"./dcl-schemas-BICTSpB5.js";import{b as Ve,c as at}from"./buy-CNc4Y8CN.js";import{P as tt,f as st}from"./PrimaryListModal-Bfe2jEqA.js";import{g as it,b as rt,w as nt,S as lt,G as dt}from"./buy-gasless-wrR0AjfW.js";import{u as ot,M as ct,c as mt}from"./useCreditPacks-Caur-2iX.js";import{W as ut,C as ht,a as _t}from"./CollectionCarousel-C2R0_DIx.js";import{R as Qe}from"./resume-buy-Bf0zIH7y.js";import{a as pt,f as je,i as yt}from"./errors-gKUnErEU.js";import{E as ce}from"./ErrorNotice-BDH9xoG4.js";import{l as ft}from"./loader-logo-BzY9EKdC.js";import{C as xt}from"./CircularProgress-B7vK7bWC.js";import{a as bt,b as gt}from"./trade-encoding-DQ3zNCj8.js";import{u as jt,M as vt}from"./MarketCheckout-D_f5rC4e.js";import{s as Nt}from"./address-DrURAr9O.js";import{T as Xe}from"./Tooltip-BtGlCRjR.js";import"./sentry-DYZXk5O5.js";import"./ethers-CLB2z3On.js";import"./intl-CBcMB1D2.js";import"./authorizations-ChRb35xG.js";import"./index-HN6Rk25C.js";import"./mana-rate-CQNKlfL0.js";import"./emotion-CSxEP8yM.js";function wt({item:s,onClose:n,resume:i=!1}){var ae,te;const{session:o}=X(),{data:m}=xa(o),h=ve(),w=oe(),x=ot().packs.slice(0,ct),[c,l]=d.useState("loading"),[a,j]=d.useState(null),[y,N]=d.useState(""),[F,b]=d.useState(s.priceCredits),[f,g]=d.useState(null),I=d.useRef(null),M=(f==null?void 0:f.credits)??F,ee=(m==null?void 0:m.credits)??0;d.useEffect(()=>{let u=!1;if(!o){l("error"),j(t("buyModal.signInToCheckout"));return}const C=_=>{const S=_-((m==null?void 0:m.credits)??0),v=x.find(R=>R.credits>=S)??x[x.length-1];N(v.id),D("Shop Buy Credits Prompted",{from:"item_checkout",credits_needed:_,credits_balance:(m==null?void 0:m.credits)??0,shortfall:Math.max(0,S)}),l("nofunds")};return(async()=>{var _,S;try{const v=await ba(s);if(!v)throw new Error("not for sale");if(ga(v,o.address))throw new Error("You can't buy your own listing.");const R=ja((S=(_=v.received)==null?void 0:_[0])==null?void 0:S.amount);if(!Number.isFinite(R)||R<=0)throw new Error("price unavailable");const V=Math.ceil(R/10);if(u)return;if(b(V),m!=null&&m.credits<V){C(V);return}try{const{credit:A,maxCreditedValue:J,usdCents:O}=await va(o.identity,R,v.id);if(u){ne(o.identity,[A.id]).catch(()=>{});return}I.current=A.id;const se=Math.ceil(O/10);b(se);const Q={trade:v,credit:A,maxCreditedValue:J,usdCents:O,credits:se};g(Q),i?H(Q):l("ready")}catch(A){if(u)return;if(pt(A)){C(V);return}throw A}}catch(v){if(u)return;D(fe(v)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:ge(v)}),l("error"),j(je(v,t("buyModal.error.generic"),{sale:!0}))}})(),()=>{u=!0,I.current&&o&&(ne(o.identity,[I.current]).catch(()=>{}),I.current=null)}},[]);async function H(u=f){if(!o||!u)return;l("processing"),j(null);let C=!1;try{const _={trade:u.trade,buyer:o.address,signer:o.signer,credits:[u.credit],maxCreditedValue:u.maxCreditedValue};let S;if(it())try{S=await rt(_),await nt(S),C=!0}catch(v){if(v instanceof lt)C=!0;else if(v instanceof dt)S=await Ve(_);else throw v}else S=await Ve(_);I.current=null,D("Shop Completed Purchase",{...Na([s]),payment_type:"credits",no_crypto_step:C,transaction_hash:S??null}),h.invalidateQueries({queryKey:["usd-balance"]}),l("complete")}catch(_){fe(_)||Z(_,{flow:"buy",step:"submit",gasless:C}),ne(o.identity,[u.credit.id]).catch(()=>{}),I.current=null,D(fe(_)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:ge(_)}),h.invalidateQueries({queryKey:["usd-balance"]}),j(je(_,t("buyModal.error.generic"),{sale:!0})),l("error")}}async function me(){if(!(!y||!o)){try{sessionStorage.setItem(Qe,JSON.stringify(s))}catch{}f&&ne(o.identity,[f.credit.id]).catch(()=>{}),I.current=null,l("loading");try{const u=await mt(y,{address:o.address,identity:o.identity});if(u.url){window.location.href=u.url;return}w("/credits")}catch(u){Z(u,{flow:"buy_credits_and_item"});try{sessionStorage.removeItem(Qe)}catch{}j(t("buyModal.error.creditsCheckout")),l("error")}}}const $=c==="processing",L=c==="complete"?t("buyModal.titleComplete"):c==="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:$?void 0:n,"aria-hidden":!0}),e.jsxs("div",{className:`buy-modal__card${c==="processing"||c==="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:L}),!$&&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:c==="nofunds"?t("buyModal.dclBalance"):t("buyModal.myCreditsBalance")}),e.jsx(E,{className:"buy-modal__balance-ico"}),e.jsx("span",{className:"buy-modal__balance-value",children:de(ee)})]})]}),c==="loading"&&e.jsx("div",{className:"buy-modal__body buy-modal__processing",children:e.jsx(xt,{size:44})}),c==="error"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(ce,{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")})})]}),c==="nofunds"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsxs("div",{className:"buy-modal__warning",children:[e.jsx(ut,{className:"buy-modal__warning-ico"}),e.jsxs("p",{className:"buy-modal__warning-text",children:[e.jsx("b",{children:t("buyModal.insufficientFunds")})," ",t("buyModal.warningNeedToBuy")," ",e.jsx("b",{children:t("buyModal.warningCreditsAmount",{count:Math.max(0,M-ee)})})," ",t("buyModal.warningToPurchase",{count:1})]})]}),e.jsx(Ue,{item:s,priceCredits:M}),e.jsx("div",{className:"buy-modal__packs",children:x.map(u=>{const C=u.credits,_=u.id===y;return e.jsxs("button",{className:`buy-modal__pack${_?" buy-modal__pack--on":""}`,onClick:()=>N(u.id),children:[e.jsx(E,{className:"buy-modal__pack-ico"}),e.jsx("span",{className:"buy-modal__pack-amount",children:de(C)}),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(E,{className:"buy-modal__total-ico"}),e.jsx("span",{children:de(((ae=x.find(u=>u.id===y))==null?void 0:ae.credits)??0)})]}),e.jsxs("span",{className:"buy-modal__total-usd",children:["$",(((te=x.find(u=>u.id===y))==null?void 0:te.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 me(),children:t("buyModal.buy")})]})]}),c==="ready"&&e.jsxs("div",{className:"buy-modal__body",children:[e.jsx(Ue,{item:s,priceCredits:M}),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 H(),children:t("buyModal.buy")})})]}),c==="processing"&&e.jsxs("div",{className:"buy-modal__body buy-modal__processing",children:[e.jsx("img",{className:"buy-modal__logo",src:ft,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"})})]}),c==="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:()=>w("/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 Ue({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(ht,{address:s.creator,className:"buy-modal__asset-creator"}):null]}),e.jsxs("div",{className:"buy-modal__asset-price",children:[e.jsx(E,{className:"buy-modal__asset-price-ico"}),e.jsx("span",{children:de(n)})]})]})]})}const kt=1e3*60*60*24*182;function It({asset:s,session:n,onClose:i}){const o=ve(),m=oe(),[h,w]=d.useState("10"),[x,c]=d.useState(null),[l,a]=d.useState(null),[j,y]=d.useState(!1),[N,F]=d.useState(null);async function b(){a(null);const g=Number(h);if(!Number.isInteger(g)||g<=0){a(t("sellModal.errorWholeNumber"));return}y(!0);try{c(t("sellModal.statusPreparing")),await bt({signer:n.signer,contractAddress:s.contractAddress,chainId:s.chainId}),c(t("sellModal.statusListing"));const I=await gt({signer:n.signer,nft:{contractAddress:s.contractAddress,tokenId:s.tokenId,network:s.network,chainId:s.chainId},usdPrice:g/10,expiresAtMs:Date.now()+kt});c(t("sellModal.statusPublishing")),await wa(I,n.identity),c(null),F(g),D("Shop Listed Item",{item_id:s.itemId??s.tokenId??null,contract_address:s.contractAddress,price_credits:g,price_usd:g/10,listing_type:"secondary",is_primary:!1}),Je.success(t("sellModal.toastOnSale",{name:s.name})),o.invalidateQueries({queryKey:["my-assets",n.address]})}catch(I){Z(I,{flow:"list_secondary"}),D("Shop Listing Failed",{listing_type:"secondary",error_code:ge(I)}),a(je(I,t("sellModal.errorGeneric"))),c(null)}finally{y(!1)}}function f(){i(),m(`/item/${s.contractAddress}/${s.tokenId}`)}return N!==null?e.jsx("div",{className:"modal-backdrop",onClick:i,role:"presentation",children:e.jsxs("div",{className:"modal modal--success",onClick:g=>g.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("div",{className:"modal-success__check","aria-hidden":!0,children:"✓"}),e.jsx("h2",{className:"modal__title",children:t("sellModal.successTitle")}),s.image?e.jsx("img",{className:"modal__img",src:s.image,alt:s.name}):null,e.jsx("p",{className:"modal-success__name",children:s.name}),e.jsxs("p",{className:"muted small",children:[t("sellModal.listedFor")," ",e.jsxs("strong",{children:[e.jsx(E,{className:"ccy-mark"})," ",N]})]}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(z,{variant:"ghost",onClick:i,children:t("getCredits.done")}),e.jsx(z,{variant:"purple",onClick:f,children:t("sellModal.viewInShop")})]})]})}):e.jsx("div",{className:"modal-backdrop",onClick:i,role:"presentation",children:e.jsxs("div",{className:"modal","data-testid":"modal",onClick:g=>g.stopPropagation(),role:"dialog","aria-modal":"true",children:[e.jsx("h2",{className:"modal__title",children:t("sellModal.listTitle",{name:s.name})}),s.image?e.jsx("img",{className:"modal__img",src:s.image,alt:s.name}):null,e.jsxs("label",{className:"field",children:[e.jsx("span",{children:t("sellModal.priceLabel",{currency:xe.name})}),e.jsx("input",{type:"number",min:"1",step:"1",value:h,onChange:g=>w(g.target.value),disabled:j})]}),e.jsx("p",{className:"muted small",children:t("sellModal.pricedInWhole",{currency:xe.name,currencySingular:xe.nameSingular})}),x?e.jsx("p",{className:"muted",children:x}):null,e.jsx(ce,{message:l}),e.jsxs("div",{className:"modal__actions",children:[e.jsx(z,{variant:"ghost",onClick:i,disabled:j,children:t("sellModal.cancel")}),e.jsx(z,{onClick:()=>void b(),disabled:j,children:j?t("sellModal.listing"):t("sellModal.putOnSale")})]})]})})}const Ct=d.lazy(async()=>{const[{EmoteControls:s},{Experimental_CssVarsProvider:n},{light:i}]=await Promise.all([be(()=>import("./index-CpUzfl0K.js").then(o=>o.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),be(()=>import("./index-dBhDm5QH.js"),__vite__mapDeps([11,3,1,2,4,5,6,7,12,9,13,14])),be(()=>import("./index-BVDwZ7ux.js"),__vite__mapDeps([15,3,1,2,4,5,6,7,16,14,13,9]))]);return{default:o=>e.jsx(n,{theme:i,children:e.jsx(s,{...o})})}});function St(s){return e.jsx(d.Suspense,{fallback:null,children:e.jsx(Ct,{...s})})}function At({item:s}){const n=X(f=>{var g;return(g=f.session)==null?void 0:g.address}),{data:i,isLoading:o}=ka(n),m=n&&i?n:"default",h=s.category==="emote",[w,x]=d.useState("item"),c=!h&&w==="item",l=c||!o,[a,j]=d.useState(!0);d.useEffect(()=>{j(!0)},[s.id,c]);const y=!!n&&!!i,N=y&&Ia(s,Ca(i)),F=Sa(s)[0],b=y&&!N&&!h;return e.jsxs(e.Fragment,{children:[l?e.jsx(Aa,{id:"shop-item-preview",contractAddress:s.contractAddress,tokenId:s.tokenId??void 0,itemId:s.tokenId?void 0:s.itemId??void 0,profile:c?void 0:N?m:"default",bodyShape:c||N?void 0:F,type:h?void 0:c?G.PreviewType.WEARABLE:G.PreviewType.AVATAR,emote:h||c?void 0:G.PreviewEmote.FASHION,disableBackground:!0,wheelZoom:h?1.5:void 0,wheelStart:h?100:void 0,dev:Ne.chainId===80002,onLoad:()=>j(!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,b&&!c?e.jsx("p",{className:"item-preview__note",children:t("itemPreview.shownOnBody",{shape:Ma(F)})}):null,h?e.jsx("div",{className:"item-preview__emote-controls","data-testid":"emote-controls",children:e.jsx(St,{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:w==="avatar"?"is-active":"","aria-pressed":w==="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:w==="item"?"is-active":"","aria-pressed":w==="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 Ze(){return Ne.shopServerUrl||(typeof window<"u"?window.location.origin:"")}async function Mt(s,n,i){const o=new URLSearchParams({contractAddress:s,itemId:n}),m=`${Ze()}/notify-requests?${o.toString()}`,h=await Ye(m,{method:"GET",identity:i,metadata:{}});if(!h.ok)throw new Error(`getNotifyRequest ${h.status}`);return h.json()}async function Pt(s,n){const i=`${Ze()}/notify-requests`,o=await Ye(i,{method:"POST",identity:n,metadata:{},headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});if(!o.ok)throw new Error(`createNotifyRequest ${o.status}: ${await o.text()}`);await o.json().catch(()=>{})}function Ge(s){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s.trim())}function Et({item:s}){const n=X(b=>b.session),i=X(b=>b.signIn),[o,m]=d.useState(""),[h,w]=d.useState(!1),[x,c]=d.useState(!1),[l,a]=d.useState(null),j=!!n&&!!s.contractAddress&&!!s.itemId,{data:y}=B({queryKey:["notify-request",s.contractAddress,s.itemId,n==null?void 0:n.address],enabled:j,queryFn:()=>Mt(s.contractAddress,s.itemId,n.identity)});d.useEffect(()=>{y!=null&&y.email&&m(b=>b||y.email)},[y==null?void 0:y.email]),d.useEffect(()=>{if(!n)return;let b=!1;return Pa().then(f=>{!b&&f&&m(g=>g||f)}),()=>{b=!0}},[n]);const N=x||!!(y!=null&&y.subscribed);async function F(b){if(b.preventDefault(),!(!n||!s.itemId||!Ge(o)||h)){w(!0),a(null);try{await Pt({contractAddress:s.contractAddress,itemId:s.itemId,chainId:s.chainId,email:o.trim()},n.identity),c(!0)}catch(f){Z(f,{flow:"notify-me",contractAddress:s.contractAddress,itemId:s.itemId}),a(t("notifyMe.error"))}finally{w(!1)}}}return n?N?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(T,{name:"check",size:12})}),e.jsx("span",{className:"notify__done-text",children:t("notifyMe.subscribedBody")})]}):e.jsxs("form",{className:"notify",onSubmit:F,"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:o,onChange:b=>m(b.target.value),"data-testid":"notify-email"}),e.jsx("button",{type:"submit",className:"notify__btn",disabled:!Ge(o)||h,"data-testid":"notify-submit",children:h?t("notifyMe.working"):t("notifyMe.cta")})]}),e.jsx(ce,{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 Ft=W.button`
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
gap: 8px;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 40px;
|
|
9
|
+
padding: 0 12px;
|
|
10
|
+
border: 2px solid #c640cd;
|
|
11
|
+
border-radius: 8px;
|
|
12
|
+
background: transparent;
|
|
13
|
+
color: ${K.colors.accent};
|
|
14
|
+
font-family: ${K.font.sans};
|
|
15
|
+
font-weight: 600;
|
|
16
|
+
font-size: 15px;
|
|
17
|
+
line-height: 24px;
|
|
18
|
+
letter-spacing: 0.46px;
|
|
19
|
+
text-transform: uppercase;
|
|
20
|
+
cursor: not-allowed;
|
|
21
|
+
opacity: 0.55;
|
|
22
|
+
transition: opacity 0.15s ease;
|
|
23
|
+
|
|
24
|
+
&:hover,
|
|
25
|
+
&:focus-visible {
|
|
26
|
+
opacity: 0.75;
|
|
27
|
+
}
|
|
28
|
+
&:focus-visible {
|
|
29
|
+
outline: 2px solid ${K.colors.accent};
|
|
30
|
+
outline-offset: 2px;
|
|
31
|
+
}
|
|
32
|
+
`;function Lt({item:s}){return e.jsx(Xe,{block:!0,content:t("makeOffer.comingSoon"),onShow:()=>D("Shop Make Offer Tooltip Shown",{contractAddress:s.contractAddress,itemId:s.itemId}),children:e.jsxs(Ft,{type:"button","aria-disabled":!0,onClick:n=>n.preventDefault(),"data-testid":"make-offer",children:[e.jsx(T,{name:"offer",size:20,"aria-hidden":!0}),e.jsx("span",{children:t("makeOffer.cta")})]})})}const Tt=W(Ea)`
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
gap: 1px;
|
|
37
|
+
background: ${K.colors.lineStrong};
|
|
38
|
+
`;function Dt({contractAddress:s,name:n,items:i,className:o}){const m=oe();if(!s||!n)return null;const h=(i??[]).map(c=>c.thumbnail).filter(c=>!!c).slice(0,4),w=h.slice(0,2),x=h.slice(2,4);return e.jsxs(Fa,{as:"button","data-link":!0,className:o,"data-testid":"creator",onClick:c=>{c.stopPropagation(),m(`/collection/${s}`)},children:[h.length>0?e.jsxs(Tt,{as:"span","data-avatar":!0,"data-testid":"creator-ava","aria-hidden":!0,children:[e.jsx("span",{className:`collection-collage__row${x.length===0?" collection-collage__row--full":""}`,children:w.map((c,l)=>e.jsx("img",{src:c,alt:""},l))}),x.length>0?e.jsx("span",{className:"collection-collage__row",children:x.map((c,l)=>e.jsx("img",{src:c,alt:""},l))}):null]}):null,e.jsx(La,{"data-testid":"creator-name",children:Ta(n)})]})}const Rt=W(z)`
|
|
39
|
+
margin-top: 6px;
|
|
40
|
+
`,le=W(z)`
|
|
41
|
+
&& {
|
|
42
|
+
width: 100%;
|
|
43
|
+
height: 48px;
|
|
44
|
+
font-size: 15px;
|
|
45
|
+
font-weight: 600;
|
|
46
|
+
letter-spacing: 0.46px;
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
gap: 8px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
${K.media.down("lg")} {
|
|
54
|
+
.item-detail__ctas--dual && {
|
|
55
|
+
flex: 1 1 auto;
|
|
56
|
+
width: auto;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
`,qt=W("div")`
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
gap: 10px;
|
|
63
|
+
width: 100%;
|
|
64
|
+
`,Bt=W(z)`
|
|
65
|
+
&& {
|
|
66
|
+
width: 100%;
|
|
67
|
+
height: 44px;
|
|
68
|
+
}
|
|
69
|
+
`,$t=W("p")`
|
|
70
|
+
margin: 4px 0 0;
|
|
71
|
+
font-size: 13px;
|
|
72
|
+
color: ${K.colors.muted};
|
|
73
|
+
|
|
74
|
+
a {
|
|
75
|
+
color: ${K.colors.accent};
|
|
76
|
+
font-weight: 600;
|
|
77
|
+
}
|
|
78
|
+
`;function Ot(s){return Object.values(G.Rarity).includes(s)}function zt(s){return s==="male"?t("itemDetail.genderMale"):s==="female"?t("itemDetail.genderFemale"):s==="unisex"?t("itemDetail.genderUnisex"):null}function He(s){return s.wearableCategory?s.wearableCategory.replace(/_/g," "):s.category==="emote"?t("itemDetail.categoryEmote"):t("itemDetail.categoryWearable")}function ps(){var $e;const{contractAddress:s,tokenId:n}=pa(),{state:i}=ya(),o=oe(),m=!!(i!=null&&i.market),h=(i==null?void 0:i.marketPriceCredits)??null,w=ze(r=>r.add),x=ze(r=>r.items),c=Ke(r=>r.toggle),{session:l}=X(),[a,j]=d.useState(()=>i!=null&&i.item?{...i.item,tradeId:i.tradeId??i.item.tradeId}:{id:`${s}-${n}`,name:"",creator:"",contractAddress:s??"",itemId:null,category:"wearable",rarity:"common",network:"MATIC",chainId:Ne.chainId,thumbnail:"",priceCredits:0,gender:null,isSmart:!1,tokenId:n??void 0,tradeId:i==null?void 0:i.tradeId}),[y,N]=d.useState(!1),[F,b]=d.useState(!!(i!=null&&i.resumeBuy));d.useEffect(()=>{i!=null&&i.resumeBuy&&N(!0)},[i==null?void 0:i.resumeBuy]);const{data:f=[],isFetched:g}=B({queryKey:["collection-items",a.contractAddress],enabled:!!a.contractAddress,queryFn:()=>Ha(a.contractAddress,{first:20}).then(r=>r.items)}),I=a.available==null&&!a.tokenId,{data:M,isLoading:ee}=B({queryKey:["shop-item",a.contractAddress,n],enabled:!m&&!!a.contractAddress&&!!n&&(!(i!=null&&i.item)||I),queryFn:()=>Ja(a.contractAddress,n)});d.useEffect(()=>{M&&j(r=>r.tradeId?r.available!=null&&r.wearableCategory?r:{...r,available:r.available??M.available,wearableCategory:r.wearableCategory??M.wearableCategory}:{...M})},[M]);const[H,me]=d.useState(!1),{data:$=""}=B({queryKey:["item-desc",a.contractAddress,a.itemId],enabled:!!a.contractAddress&&!!a.itemId,staleTime:5*6e4,queryFn:()=>Ya(a.contractAddress,a.itemId)}),{data:L}=B({queryKey:["collection-meta",a.contractAddress],enabled:!!a.contractAddress,staleTime:5*6e4,queryFn:()=>Xa(a.contractAddress)});d.useEffect(()=>{if(a.name||M||f.length===0)return;const r=n&&f.find(k=>k.tokenId===n||k.itemId===n)||f.find(k=>k.contractAddress===a.contractAddress);r&&j(k=>({...r,tradeId:k.tradeId??r.tradeId}))},[f,M]);const ae=d.useMemo(()=>{const r=new Set,k=[];for(const P of f){if(P.id===a.id||a.itemId&&P.itemId===a.itemId||a.tokenId&&P.tokenId===a.tokenId)continue;const Oe=`${P.contractAddress}-${P.itemId??P.tokenId??P.id}`;r.has(Oe)||(r.add(Oe),k.push(P))}return k},[f,a.id,a.itemId,a.tokenId]),{data:te,isLoading:u}=B({queryKey:["detail-trade",a.id,a.tradeId,a.contractAddress,a.itemId],enabled:!!a.contractAddress,queryFn:async()=>{if(a.tradeId)return a.tradeId;if(a.itemId){const r=await Za(a.contractAddress,a.itemId);return(r==null?void 0:r.id)??null}return null}}),C=a.tradeId??te??void 0,_=!!C,{data:S}=jt(m),v=d.useMemo(()=>{if(!m||!(i!=null&&i.item))return null;const r=i.item;return r.manaWei?{tradeId:r.tradeId??r.id,listingType:"primary",contractAddress:r.contractAddress,itemId:r.itemId??"",name:r.name,thumbnail:r.thumbnail,rarity:r.rarity,category:r.category,wearableCategory:r.wearableCategory??null,creator:r.creator,manaWei:r.manaWei,available:1,network:r.network,chainId:r.chainId,createdAt:0}:null},[m,i==null?void 0:i.item]),R=m&&h!=null&&!!S&&!!v,V=Da({priceCredits:a.priceCredits,compareAtCredits:a.compareAtCredits,saleEndsAt:a.saleEndsAt}),A=d.useMemo(()=>({...a,tradeId:C,id:C??a.id}),[a,C]),J=x.some(r=>r.id===A.id),O=!A.tokenId,se=(($e=x.find(r=>r.id===A.id))==null?void 0:$e.quantity)??0,Q=O&&typeof a.available=="number"&&se>=a.available,q=Ke(r=>!!r.items[a.id]),we=d.useRef(null);d.useEffect(()=>{!a.name||u||we.current===a.id||(we.current=a.id,D("Shop Viewed Item",{...Ra(a),for_sale:_}),qa(a))},[a.id,a.name,u,_]);const ie=`${s}/${n}`,ke=d.useRef(ie);d.useEffect(()=>{ke.current!==ie&&(ke.current=ie,i!=null&&i.item&&j({...i.item,tradeId:i.tradeId??i.item.tradeId}),typeof window<"u"&&window.scrollTo({top:0,behavior:"smooth"}))},[ie]);function ea(){!_||he||u||!O&&J||Q||w(A,"item_detail")}const ue=Ot(a.rarity)?a.rarity:G.Rarity.COMMON,Ie=zt(a.gender),Ce=Ba(a),Se=$a(a.gender),aa=_&&V,ta=t("itemDetail.moreFromCollection"),he=Oa(a,l==null?void 0:l.address),re=ve(),[sa,Ae]=d.useState(!1),[ia,Me]=d.useState(!1),[Y,Pe]=d.useState(!1),[ra,Ee]=d.useState(null),{data:p,isLoading:na}=B({queryKey:["owned-token",a.contractAddress,a.tokenId,l==null?void 0:l.address],enabled:!m&&!!(l!=null&&l.address)&&!!a.contractAddress&&!!a.tokenId,queryFn:()=>l?et(l.address,a.contractAddress,a.tokenId):null});d.useEffect(()=>{p&&j(r=>r.name?r.issuedId?r:{...r,issuedId:p.issuedId}:{id:p.id,name:p.name,creator:"",contractAddress:p.contractAddress,itemId:p.itemId,category:p.category,rarity:p.rarity??"common",network:p.network,chainId:p.chainId,thumbnail:p.image,priceCredits:p.listingPrice??0,gender:null,isSmart:!1,tokenId:p.tokenId,issuedId:p.issuedId,tradeId:p.tradeId})},[p]);const{data:_e}=B({queryKey:["publishable-item",a.contractAddress,a.itemId,l==null?void 0:l.address],enabled:he&&!!l&&!!a.itemId,queryFn:async()=>l?(await st(l.address,l.identity)).find(k=>k.contractAddress.toLowerCase()===a.contractAddress.toLowerCase()&&k.blockchainItemId===a.itemId)??null:null}),U=!!p,pe=!m&&(he||U),la=U?!!(p!=null&&p.isOnSale):_,ye=U?p==null?void 0:p.tradeId:C,Fe=U?!!p:!!_e;async function Le(){await Promise.all([re.invalidateQueries({queryKey:["owned-token",a.contractAddress,a.tokenId]}),re.invalidateQueries({queryKey:["detail-trade"]}),re.invalidateQueries({queryKey:["shop-item"]}),re.invalidateQueries({queryKey:["collection-sale-state"]})])}async function Te(r={}){if(!l||!ye)return!1;Ee(null),Pe(!0);try{const k=await Ga(ye);return await at({trade:k,signer:l.signer}),r.silent||Je.success(t("myAssets.removedFromSale",{name:a.name})),await Le(),!0}catch(k){const P=yt(k);return P||Z(k,{flow:"remove-listing",tradeId:ye}),Ee(P?t("getCredits.errorCanceled"):t("myAssets.removeListingError")),!1}finally{Pe(!1)}}function De(){U?Ae(!0):Me(!0)}async function da(){await Te({silent:!0})&&De()}function Re(){Ae(!1),Me(!1),Le()}const qe=_?u?t("itemDetail.checking"):Q?t("itemDetail.maxInCart"):!O&&J?t("assetCard.inCart"):t("assetCard.addToCart"):t("itemDetail.notForSale"),oa=typeof a.available=="number"&&a.available>0&&!a.tokenId&&!m,ca=!m&&!a.tokenId&&a.available===0,ma=!pe&&_&&!m,ua=m||!pe,ha=ee||!!a.contractAddress&&!g||!a.name&&na,Be=!a.name&&!ha,_a=/^https?:\/\//i.test(a.thumbnail);return za(Be?{title:t("seo.item.notFoundTitle"),noindex:!0}:a.name?{title:a.name,description:$||t("seo.item.fallbackDescription",{name:a.name,rarity:a.rarity,category:He(a),creator:Nt(a.creator)}),image:_a?a.thumbnail:void 0,type:"product"}:{}),Be?e.jsxs("div",{className:"item-detail item-detail--notfound",children:[e.jsx(T,{name:"cart",className:"item-detail__notfound-ico"}),e.jsx("h1",{className:"item-detail__notfound-title",children:t("itemDetail.notAvailableTitle")}),e.jsx("p",{className:"muted",children:t("itemDetail.notAvailableBody")}),e.jsx(Rt,{variant:"purple",onClick:()=>o("/assets"),children:t("notFound.cta")})]}):e.jsxs("div",{className:"item-detail",children:[e.jsxs("nav",{className:"item-detail__crumbs","aria-label":t("itemDetail.breadcrumbAria"),children:[e.jsx("button",{className:"item-detail__crumb-link",onClick:()=>o("/assets"),children:t("nav.collectibles")}),e.jsx("span",{className:"item-detail__crumb-sep",children:"/"}),e.jsx("span",{className:"item-detail__crumb-current",children:a.name||t("itemDetail.itemFallback")})]}),e.jsxs("div",{className:"item-detail__main",children:[e.jsxs("div",{className:"item-detail__preview","data-testid":"item-preview",children:[a.name?e.jsx(At,{item:a}):e.jsx("div",{className:"item-preview__loading","aria-busy":"true","aria-label":t("itemPreview.loading"),children:e.jsx("span",{className:"skeleton item-preview__skeleton","aria-hidden":!0})}),e.jsx("button",{className:`item-detail__fav item-detail__fav--preview${q?" is-on":""}`,onClick:()=>c(a),"aria-pressed":q,"aria-label":q?t("assetCard.removeFromFavorites"):t("assetCard.addToFavorites"),children:e.jsx(T,{name:q?"heart-solid":"heart",size:18})})]}),e.jsx("div",{className:"item-detail__info",children:a.name?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"item-detail__info-head",children:[e.jsx("h1",{className:"item-detail__title",children:a.name}),e.jsx("button",{className:`item-detail__fav${q?" is-on":""}`,onClick:()=>c(a),"aria-pressed":q,"aria-label":q?t("assetCard.removeFromFavorites"):t("assetCard.addToFavorites"),children:e.jsx(T,{name:q?"heart-solid":"heart",size:18})})]}),e.jsxs("div",{className:"item-detail__chips",children:[e.jsx("span",{className:"chip chip--rarity",style:{background:Va(ue),color:Wa(ue)},title:Ka(a.rarity),children:a.rarity}),e.jsxs("span",{className:"chip item-detail__chip",children:[Ce?e.jsx(T,{name:Ce,size:18,color:"var(--text-2)"}):null,He(a)]}),Ie?e.jsxs("span",{className:"chip item-detail__chip",children:[Se?e.jsx(T,{name:Se,size:18,color:"var(--text-2)"}):null,Ie]}):null,a.issuedId?e.jsxs("span",{className:"chip item-detail__chip","data-testid":"detail-issued",children:["#",a.issuedId]}):null]}),$?e.jsxs("div",{className:"item-detail__section item-detail__description",children:[e.jsx("div",{className:"item-detail__label",children:t("itemDetail.description")}),e.jsx("p",{className:`item-detail__desc-text${H?" is-expanded":""}`,children:$}),$.length>140?e.jsx("button",{className:"link item-detail__desc-toggle",onClick:()=>me(r=>!r),children:H?t("itemDetail.showLess"):t("itemDetail.readMore")}):null]}):null,a.creator||L!=null&&L.name?e.jsxs("div",{className:"item-detail__meta",children:[a.creator?e.jsxs("div",{className:"item-detail__meta-col",children:[e.jsx("div",{className:"item-detail__label",children:t("itemDetail.creator")}),e.jsx(Qa,{address:a.creator,className:"item-detail__creator",linkToProfile:!0,hidePrefix:!0})]}):null,L!=null&&L.name?e.jsxs("div",{className:"item-detail__meta-col item-detail__meta-col--collection",children:[e.jsx("div",{className:"item-detail__label",children:t("itemDetail.collection")}),e.jsx(Dt,{contractAddress:a.contractAddress,name:L.name,items:f,className:"item-detail__creator"})]}):null]}):null,e.jsx("hr",{className:"item-detail__divider"}),e.jsx("div",{className:"item-detail__price-block",children:e.jsxs("div",{className:"item-detail__price-row",children:[e.jsxs("div",{className:"item-detail__price-col",children:[m||_?e.jsx("div",{className:"item-detail__price-label",children:t("itemDetail.price")}):null,m?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"item-detail__price item-detail__price--market",children:h==null?e.jsx("span",{className:"item-detail__price-value",children:"—"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"item-detail__approx","aria-hidden":!0,children:"≈"}),e.jsx(E,{className:"item-detail__diamond"}),e.jsx("span",{className:"item-detail__price-value",children:h})]})}),e.jsx("div",{className:"item-detail__market-note muted",children:t("assetCard.marketPrice")})]}):_?aa?e.jsxs("div",{className:"item-detail__price item-detail__price--sale",children:[e.jsxs("span",{className:"item-detail__price",children:[e.jsx(E,{className:"item-detail__diamond"}),e.jsx("span",{className:"item-detail__price-value",children:a.priceCredits})]}),e.jsxs("span",{className:"item-detail__price-was",children:[e.jsx(E,{className:"item-detail__diamond item-detail__diamond--was"}),a.compareAtCredits]}),We(a.compareAtCredits,a.priceCredits)>0?e.jsx("span",{className:"item-detail__sale-badge",children:t("assetCard.saleWithDiscount",{pct:We(a.compareAtCredits,a.priceCredits)})}):null,e.jsx(Ua,{endsAt:a.saleEndsAt,className:"item-detail__countdown"})]}):e.jsxs("div",{className:"item-detail__price",children:[e.jsx(E,{className:"item-detail__diamond"}),e.jsx("span",{className:"item-detail__price-value",children:a.priceCredits})]}):e.jsxs("div",{className:"item-detail__price item-detail__price--none",children:[e.jsx("span",{children:t("itemDetail.notForSale")}),e.jsx(Xe,{content:t("itemDetail.notForSaleHint"),children:e.jsx("span",{className:"item-detail__price-info",tabIndex:0,role:"img","aria-label":t("itemDetail.notForSaleHint"),children:e.jsx(T,{name:"info",size:14})})})]})]}),oa?e.jsxs("div",{className:"item-detail__stock-col",children:[e.jsx("div",{className:"item-detail__price-label",children:t("itemDetail.stock")}),e.jsxs("div",{className:"item-detail__stock-value",children:[(a.available??0).toLocaleString(),"/",G.Rarity.getMaxSupply(ue).toLocaleString()]})]}):ca?e.jsx("div",{className:"item-detail__stock-col",children:e.jsx("div",{className:"item-detail__stock-value item-detail__stock-value--out","data-testid":"out-of-stock",children:t("itemDetail.outOfStock")})}):null]})}),e.jsx("div",{className:`item-detail__ctas${ua?" item-detail__ctas--buttons":""}${ma?" item-detail__ctas--dual":""}`,children:m?e.jsxs(le,{variant:"purple",onClick:()=>N(!0),disabled:!R,children:[e.jsx("span",{className:"item-detail__cta-label",children:t("assetCard.buyNow")}),h!=null?e.jsxs("span",{className:"item-detail__cta-price","aria-hidden":!0,children:[e.jsx(E,{className:"item-detail__cta-diamond"}),h]}):null]}):pe?e.jsxs(qt,{"data-testid":"manage-actions",children:[e.jsx(ce,{message:ra}),la?e.jsxs(e.Fragment,{children:[e.jsx(le,{variant:"purple",onClick:()=>void da(),disabled:Y||!Fe,children:e.jsx("span",{className:"item-detail__cta-label",children:Y?t("itemDetail.manageWorking"):t("itemDetail.manageUpdatePrice")})}),e.jsx(Bt,{variant:"ghost",onClick:()=>void Te(),disabled:Y,children:Y?t("myAssets.removing"):t("itemDetail.manageRemove")})]}):e.jsx(le,{variant:"purple",onClick:()=>{U&&D("Shop Started Listing",{listing_type:"secondary",item_id:a.itemId??a.tokenId??null}),De()},disabled:Y||!Fe,children:e.jsx("span",{className:"item-detail__cta-label",children:t("itemDetail.manageList")})}),e.jsxs($t,{children:[t("itemDetail.ownItemPrefix")," ",e.jsx(fa,{to:"/my-assets",children:t("nav.myAssets")}),t("itemDetail.ownItemSuffix")]})]}):_?e.jsxs(e.Fragment,{children:[e.jsxs(le,{variant:"purple",onClick:()=>N(!0),disabled:u,children:[e.jsx("span",{className:"item-detail__cta-label",children:t("assetCard.buyNow")}),e.jsxs("span",{className:"item-detail__cta-price","aria-hidden":!0,children:[e.jsx(E,{className:"item-detail__cta-diamond"}),a.priceCredits]})]}),e.jsxs("button",{className:"item-detail__addcart",onClick:ea,disabled:u||(O?Q:J),"aria-label":qe,children:[e.jsx(T,{name:"cart-solid"}),e.jsx("span",{className:"item-detail__addcart-label",children:qe})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Et,{item:a}),e.jsx(Lt,{item:a})]})})]}):e.jsx(Kt,{})})]}),e.jsx(_t,{title:ta,items:ae,onViewAll:a.contractAddress?()=>o(`/collection/${a.contractAddress}`):void 0}),y&&m&&v&&S?e.jsx(vt,{listing:v,rate:S,onClose:()=>N(!1),onSold:()=>N(!1)}):y&&!m?e.jsx(wt,{item:A,resume:F,onClose:()=>{N(!1),b(!1)}}):null,sa&&p&&l?e.jsx(It,{asset:p,session:l,onClose:Re}):null,ia&&_e&&l?e.jsx(tt,{item:_e,session:l,onClose:Re}):null]})}function Kt(){return e.jsxs("div",{className:"item-detail__info-skel","aria-hidden":!0,children:[e.jsx("span",{className:"skeleton id-skel__title"}),e.jsxs("div",{className:"id-skel__chips",children:[e.jsx("span",{className:"skeleton id-skel__chip"}),e.jsx("span",{className:"skeleton id-skel__chip"})]}),e.jsx("span",{className:"skeleton id-skel__line"}),e.jsx("span",{className:"skeleton id-skel__line id-skel__line--short"}),e.jsx("hr",{className:"item-detail__divider"}),e.jsx("span",{className:"skeleton id-skel__price"}),e.jsx("span",{className:"skeleton id-skel__btn"})]})}export{ps as ItemDetail,ps as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as l,j as c}from"./react-BrLDncxD.js";import{s as u,B as p,t as d}from"./index-
|
|
1
|
+
import{r as l,j as c}from"./react-BrLDncxD.js";import{s as u,B as p,t as d}from"./index-C1yBaAe9.js";const a=u.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: center;
|
|
4
4
|
padding: 28px 0 8px;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{m as O,c as S,d as V,n as Y,o as H,t,q as k,g as x,r as M,v as $,C as j,f as D,i as J,w as X,x as p,y as F,z as R,s as Z,B as ee}from"./index-C1yBaAe9.js";import{r as re,a as b}from"./mana-rate-CQNKlfL0.js";import{a as ae,r as m,j as r}from"./react-BrLDncxD.js";import{b as A}from"./buy-CNc4Y8CN.js";import{g as te,b as se,w as ie,S as ce,G as ne}from"./buy-gasless-wrR0AjfW.js";import{i as de}from"./errors-gKUnErEU.js";import{E as oe}from"./ErrorNotice-BDH9xoG4.js";function pe(e=!0){return O({queryKey:["mana-rate",S.chainId],queryFn:()=>re(S.chainId),enabled:e,staleTime:6e4,refetchInterval:6e4,retry:1})}const B=Z(ee)`
|
|
2
|
+
flex: 1;
|
|
3
|
+
`;function U(e){if(de(e))return t("errors.rejected");const n=(e.message??"").toLowerCase();return n.includes("insufficient")?t("marketCheckout.error.insufficient",{currency:j.name}):n.includes("not found")||n.includes("no active listing")||n.includes("404")?t("marketCheckout.error.soldOrRemoved"):n.includes("your own listing")?t("errors.cantBuyOwn"):t("marketCheckout.error.generic")}function le(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 Ce({listing:e,rate:n,onClose:q,onSold:W}){const{session:i}=V(),{data:d,isError:T}=Y(i),w=H(),g=ae(),[N,f]=m.useState("confirm"),[C,I]=m.useState(t("marketCheckout.lockingPrice")),[z,_]=m.useState(null),[a,G]=m.useState(null),o=m.useRef(null),L=Math.ceil(b(e.manaWei,n)/10);m.useEffect(()=>{let l=!1;if(!i){f("error"),_(t("buyModal.signInToCheckout"));return}return(async()=>{try{const s=await D(e.tradeId);if(!s)throw new Error("not found");if(J(s,i.address))throw new Error("You can't buy your own listing.");const h=b(e.manaWei,n);if(!Number.isFinite(h)||h<=0)throw new Error("price unavailable");const{credit:u,maxCreditedValue:K,usdCents:P}=await X(i.identity,h,e.tradeId);if(l){k(i.identity,[u.id]).catch(()=>{});return}o.current=u.id,G({trade:s,credit:u,maxCreditedValue:K,usdCents:P,credits:Math.ceil(P/10)}),I("")}catch(s){if(l)return;console.error("[market] authorize failed",s),p(R(s)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"authorize",error_code:F(s),value_usd:Math.round(b(e.manaWei,n))/100}),f("error"),_(U(s))}})(),()=>{l=!0,o.current&&i&&(k(i.identity,[o.current]).catch(()=>{}),o.current=null)}},[]);const v=!!a&&d!=null&&d.credits<a.credits;async function Q(){if(!i||!a)return;if(v){p("Shop Buy Credits Prompted",{from:"item_checkout",credits_needed:a.credits,credits_balance:(d==null?void 0:d.credits)??0,shortfall:Math.max(0,a.credits-((d==null?void 0:d.credits)??0))}),k(i.identity,[a.credit.id]).catch(()=>{}),o.current=null,g("/credits");return}f("working"),_(null);let l=!1;try{I(t("marketCheckout.confirming"));const c={trade:a.trade,buyer:i.address,signer:i.signer,credits:[a.credit],maxCreditedValue:a.maxCreditedValue};let s;if(te())try{s=await se(c),await ie(s),l=!0}catch(u){if(u instanceof ce)l=!0;else if(u instanceof ne)s=await A(c);else throw u}else s=await A(c);o.current=null,p("Shop Completed Purchase",{items:[{item_id:e.itemId??null,contract_address:e.contractAddress,token_id:null,price_usd:a.usdCents/100}],value_credits:a.credits,value_usd:a.usdCents/100,purchase_type:"item",is_primary:!0,payment_type:"credits",no_crypto_step:l,transaction_hash:s??null}),w.invalidateQueries({queryKey:["usd-balance"]});const h={items:[le(e)],txHash:s};g("/success",{state:h})}catch(c){console.error("[market] buy now failed",c),k(i.identity,[a.credit.id]).catch(()=>{}),o.current=null,p(R(c)?"Shop Purchase Cancelled":"Shop Purchase Failed",{step:"submit",error_code:F(c),value_usd:a.usdCents/100}),w.invalidateQueries({queryKey:["usd-balance"]}),_(U(c)),f("error");const s=(c.message??"").toLowerCase();(s.includes("not found")||s.includes("no active listing")||s.includes("404"))&&W()}}function E(){i&&a&&k(i.identity,[a.credit.id]).catch(()=>{}),o.current=null,q()}const y=N==="working";return r.jsxs("div",{className:"mkt-modal",role:"dialog","aria-modal":"true","aria-label":t("buyModal.dialogAria",{name:e.name}),children:[r.jsx("div",{className:"mkt-modal__scrim",onClick:y?void 0:E,"aria-hidden":!0}),r.jsxs("div",{className:"mkt-modal__card",children:[r.jsxs("div",{className:"mkt-modal__head",children:[r.jsx("div",{className:"mkt-modal__thumb",children:e.thumbnail?r.jsx("img",{src:e.thumbnail,alt:""}):null}),r.jsxs("div",{children:[r.jsx("div",{className:"mkt-modal__name",title:e.name,children:e.name||t("buyModal.itemFallback")}),r.jsx("span",{className:"chip chip--rarity",children:e.rarity})]})]}),r.jsx("div",{className:"mkt-modal__price",children:a?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mkt-modal__price-label",children:t("marketCheckout.finalPrice")}),r.jsxs("div",{className:"mkt-modal__price-value",children:[r.jsx(x,{className:"mkt-modal__diamond"}),M(a.credits)]}),r.jsxs("div",{className:"mkt-modal__price-sub muted",children:[t("marketCheckout.lockedForPurchase")," · $",(a.usdCents/100).toFixed(2)]})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"mkt-modal__price-label",children:t("marketCheckout.todaysPrice")}),r.jsxs("div",{className:"mkt-modal__price-value mkt-modal__price-value--approx",children:[r.jsx("span",{className:"mkt-modal__approx","aria-hidden":!0,children:"≈"}),r.jsx(x,{className:"mkt-modal__diamond"}),M(L)]}),r.jsx("div",{className:"mkt-modal__price-sub muted",children:C||t("marketCheckout.lockingPrice")})]})}),i?r.jsxs("div",{className:"mkt-modal__balance muted",children:[t("marketCheckout.yourBalance")," ",r.jsx(x,{className:"ccy-mark"})," ",$(d,T)]}):null,v?r.jsx("p",{className:"muted mkt-modal__note",children:t("marketCheckout.needMore",{currency:j.name})}):null,C&&N==="working"?r.jsx("p",{className:"muted mkt-modal__note",children:C}):null,r.jsx(oe,{message:z,className:"mkt-modal__note"}),r.jsxs("div",{className:"mkt-modal__actions",children:[r.jsx(B,{variant:"ghost",onClick:E,disabled:y,children:t("buyModal.cancel")}),r.jsx(B,{variant:"purple",onClick:()=>void Q(),disabled:y||!a,children:y?t("marketCheckout.buying"):v?t("nav.getCredits",{currency:j.name}):t("marketCheckout.confirmPurchase")})]})]})]})}export{Ce as M,pe as u};
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import{L as Se,b as Ye,r as d,j as t}from"./react-BrLDncxD.js";import{s as a,F as s,I as j,u as Je,t as r,d as Ve,o as Ze,G as le,m as M,B as Xe,A as q,x as et,H as tt,f as st,J as ot,E as nt,c as je,K as rt}from"./index-C1yBaAe9.js";import{f as at}from"./import-C4A0dOmT.js";import{P as it,f as lt}from"./PrimaryListModal-Bfe2jEqA.js";import{c as ct}from"./buy-CNc4Y8CN.js";import{R as G,C as dt,a as mt,F as pt,S as D,b as ce}from"./categories-BKqMpg3a.js";import{L as ut}from"./LoadMore-wolzH5ER.js";import{D as de,F as me,R as ft,a as xt,b as ht,c as yt,d as gt,S as bt,e as wt,f as St,g as jt,h as $t,i as Ct,j as It,k as kt,C as vt,l as At,m as Et,n as Tt,M as Ft}from"./Assets.styles-BldKbSnl.js";import{u as Rt}from"./useInfiniteGrid-CRDFn4if.js";import{E as U}from"./ErrorNotice-BDH9xoG4.js";import{n as $e}from"./emotion-CSxEP8yM.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-CLB2z3On.js";import"./intl-CBcMB1D2.js";import"./mana-rate-CQNKlfL0.js";import"./index-HN6Rk25C.js";import"./trade-encoding-DQ3zNCj8.js";import"./authorizations-ChRb35xG.js";import"./errors-gKUnErEU.js";import"./Tooltip-BtGlCRjR.js";a.div`
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: 4px;
|
|
5
|
+
width: 100%;
|
|
6
|
+
`;a.h2`
|
|
7
|
+
margin: 0;
|
|
8
|
+
padding: 4px 4px 2px;
|
|
9
|
+
font-family: ${s.font.sans};
|
|
10
|
+
font-weight: 700;
|
|
11
|
+
font-size: 12px;
|
|
12
|
+
letter-spacing: 0.46px;
|
|
13
|
+
text-transform: uppercase;
|
|
14
|
+
color: ${s.colors.muted};
|
|
15
|
+
`;a("button",$e("selected"))`
|
|
16
|
+
display: flex;
|
|
17
|
+
align-items: center;
|
|
18
|
+
gap: 10px;
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 40px;
|
|
21
|
+
padding: 4px 12px;
|
|
22
|
+
border: 0;
|
|
23
|
+
border-radius: 8px;
|
|
24
|
+
background: ${({selected:o})=>o?s.colors.media:"transparent"};
|
|
25
|
+
color: ${s.colors.text};
|
|
26
|
+
font-family: ${s.font.sans};
|
|
27
|
+
font-weight: ${({selected:o})=>o?600:400};
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
text-align: left;
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
|
|
32
|
+
@media (hover: hover) {
|
|
33
|
+
&:hover {
|
|
34
|
+
background: ${s.colors.media};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
&:focus-visible {
|
|
38
|
+
outline: 2px solid ${s.colors.accent};
|
|
39
|
+
outline-offset: 2px;
|
|
40
|
+
}
|
|
41
|
+
`;a(j)`
|
|
42
|
+
width: 18px;
|
|
43
|
+
height: 18px;
|
|
44
|
+
flex: none;
|
|
45
|
+
color: ${s.colors.muted};
|
|
46
|
+
`;a.div`
|
|
47
|
+
display: flex;
|
|
48
|
+
flex-direction: column;
|
|
49
|
+
gap: 8px;
|
|
50
|
+
width: 100%;
|
|
51
|
+
`;a.span`
|
|
52
|
+
font-family: ${s.font.sans};
|
|
53
|
+
font-weight: 600;
|
|
54
|
+
font-size: 14px;
|
|
55
|
+
line-height: 1.43;
|
|
56
|
+
color: ${s.colors.text};
|
|
57
|
+
padding: 0 4px;
|
|
58
|
+
`;a.div`
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-wrap: wrap;
|
|
61
|
+
gap: 8px;
|
|
62
|
+
padding: 4px;
|
|
63
|
+
`;a("button",$e("selected"))`
|
|
64
|
+
display: inline-flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
gap: 4px;
|
|
67
|
+
padding: 4px 10px;
|
|
68
|
+
border-radius: 6px;
|
|
69
|
+
background: ${({selected:o})=>o?s.colors.text:s.colors.softWhite};
|
|
70
|
+
border: ${({selected:o})=>o?`1px solid ${s.colors.text}`:`0.5px solid ${s.colors.gray4}`};
|
|
71
|
+
color: ${({selected:o})=>o?s.colors.white:s.colors.gray0};
|
|
72
|
+
font-family: ${s.font.sans};
|
|
73
|
+
font-weight: ${({selected:o})=>o?600:400};
|
|
74
|
+
font-size: 12px;
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
|
|
77
|
+
&:hover {
|
|
78
|
+
border-color: ${s.colors.text};
|
|
79
|
+
}
|
|
80
|
+
&:focus-visible {
|
|
81
|
+
outline: 2px solid ${s.colors.accent};
|
|
82
|
+
outline-offset: 2px;
|
|
83
|
+
}
|
|
84
|
+
`;const _t=a.div`
|
|
85
|
+
display: flex;
|
|
86
|
+
align-items: center;
|
|
87
|
+
gap: 8px;
|
|
88
|
+
height: 44px;
|
|
89
|
+
padding: 0 12px;
|
|
90
|
+
margin-bottom: 16px;
|
|
91
|
+
border: 1px solid ${s.colors.lineStrong};
|
|
92
|
+
border-radius: ${s.radius.btn};
|
|
93
|
+
background: ${s.colors.white};
|
|
94
|
+
|
|
95
|
+
&:focus-within {
|
|
96
|
+
border-color: ${s.colors.accent};
|
|
97
|
+
}
|
|
98
|
+
`,Lt=a(j)`
|
|
99
|
+
width: 18px;
|
|
100
|
+
height: 18px;
|
|
101
|
+
flex: none;
|
|
102
|
+
color: ${s.colors.muted};
|
|
103
|
+
`,Ot=a.input`
|
|
104
|
+
flex: 1;
|
|
105
|
+
min-width: 0;
|
|
106
|
+
border: 0;
|
|
107
|
+
background: none;
|
|
108
|
+
padding: 0;
|
|
109
|
+
font-family: ${s.font.sans};
|
|
110
|
+
font-size: 14px;
|
|
111
|
+
color: ${s.colors.text};
|
|
112
|
+
|
|
113
|
+
&::placeholder {
|
|
114
|
+
color: ${s.colors.muted2};
|
|
115
|
+
}
|
|
116
|
+
&:focus {
|
|
117
|
+
outline: 0;
|
|
118
|
+
}
|
|
119
|
+
`,Pt=a.button`
|
|
120
|
+
display: grid;
|
|
121
|
+
place-items: center;
|
|
122
|
+
width: 24px;
|
|
123
|
+
height: 24px;
|
|
124
|
+
border: 0;
|
|
125
|
+
border-radius: 50%;
|
|
126
|
+
background: ${s.colors.chip};
|
|
127
|
+
color: ${s.colors.text};
|
|
128
|
+
cursor: pointer;
|
|
129
|
+
flex: none;
|
|
130
|
+
|
|
131
|
+
&:focus-visible {
|
|
132
|
+
outline: 2px solid ${s.colors.accent};
|
|
133
|
+
outline-offset: 2px;
|
|
134
|
+
}
|
|
135
|
+
`,zt=a(j)`
|
|
136
|
+
width: 12px;
|
|
137
|
+
height: 12px;
|
|
138
|
+
`,pe=a.div`
|
|
139
|
+
display: grid;
|
|
140
|
+
grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
|
|
141
|
+
gap: 20px;
|
|
142
|
+
|
|
143
|
+
${s.media.down("sm")} {
|
|
144
|
+
grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
|
|
145
|
+
gap: 12px;
|
|
146
|
+
}
|
|
147
|
+
`;a.p`
|
|
148
|
+
margin: 24px 0;
|
|
149
|
+
font-family: ${s.font.sans};
|
|
150
|
+
font-size: 14px;
|
|
151
|
+
color: ${s.colors.muted};
|
|
152
|
+
`;const ue=a.div`
|
|
153
|
+
display: flex;
|
|
154
|
+
flex-direction: column;
|
|
155
|
+
align-items: center;
|
|
156
|
+
justify-content: center;
|
|
157
|
+
gap: 6px;
|
|
158
|
+
padding: 72px 24px;
|
|
159
|
+
text-align: center;
|
|
160
|
+
`,fe=a.div`
|
|
161
|
+
display: flex;
|
|
162
|
+
align-items: center;
|
|
163
|
+
justify-content: center;
|
|
164
|
+
width: 72px;
|
|
165
|
+
height: 72px;
|
|
166
|
+
margin-bottom: 10px;
|
|
167
|
+
border-radius: 50%;
|
|
168
|
+
background: ${s.colors.navViolet};
|
|
169
|
+
color: ${s.colors.accent};
|
|
170
|
+
`,xe=a.p`
|
|
171
|
+
margin: 0;
|
|
172
|
+
font-family: ${s.font.sans};
|
|
173
|
+
font-size: 18px;
|
|
174
|
+
font-weight: 600;
|
|
175
|
+
color: ${s.colors.text};
|
|
176
|
+
`,he=a.p`
|
|
177
|
+
margin: 0;
|
|
178
|
+
max-width: 360px;
|
|
179
|
+
font-family: ${s.font.sans};
|
|
180
|
+
font-size: 14px;
|
|
181
|
+
line-height: 1.5;
|
|
182
|
+
color: ${s.colors.muted};
|
|
183
|
+
`,Bt=a(Se)`
|
|
184
|
+
margin-top: 12px;
|
|
185
|
+
display: inline-flex;
|
|
186
|
+
align-items: center;
|
|
187
|
+
height: 40px;
|
|
188
|
+
padding: 0 20px;
|
|
189
|
+
border-radius: 8px;
|
|
190
|
+
background: ${s.colors.accent};
|
|
191
|
+
color: #fff;
|
|
192
|
+
font-family: ${s.font.sans};
|
|
193
|
+
font-size: 14px;
|
|
194
|
+
font-weight: 600;
|
|
195
|
+
text-decoration: none;
|
|
196
|
+
cursor: pointer;
|
|
197
|
+
|
|
198
|
+
&:hover {
|
|
199
|
+
background: ${s.colors.accentHover};
|
|
200
|
+
}
|
|
201
|
+
`,Kt=a.section`
|
|
202
|
+
max-width: 520px;
|
|
203
|
+
margin: 48px auto;
|
|
204
|
+
text-align: center;
|
|
205
|
+
display: flex;
|
|
206
|
+
flex-direction: column;
|
|
207
|
+
gap: 16px;
|
|
208
|
+
align-items: center;
|
|
209
|
+
`,Nt=a.h1`
|
|
210
|
+
margin: 0;
|
|
211
|
+
font-family: ${s.font.sans};
|
|
212
|
+
font-weight: 700;
|
|
213
|
+
font-size: 24px;
|
|
214
|
+
color: ${s.colors.text};
|
|
215
|
+
`,Mt=a.p`
|
|
216
|
+
margin: 0;
|
|
217
|
+
font-family: ${s.font.sans};
|
|
218
|
+
font-size: 15px;
|
|
219
|
+
color: ${s.colors.muted};
|
|
220
|
+
`,qt=a(Se)`
|
|
221
|
+
display: flex;
|
|
222
|
+
align-items: center;
|
|
223
|
+
gap: 12px;
|
|
224
|
+
margin-bottom: 16px;
|
|
225
|
+
padding: 12px 16px;
|
|
226
|
+
border-radius: ${s.radius.btn};
|
|
227
|
+
background: ${s.colors.rarityBg};
|
|
228
|
+
color: ${s.colors.text};
|
|
229
|
+
text-decoration: none;
|
|
230
|
+
|
|
231
|
+
&:hover {
|
|
232
|
+
filter: brightness(0.98);
|
|
233
|
+
}
|
|
234
|
+
&:focus-visible {
|
|
235
|
+
outline: 2px solid ${s.colors.accent};
|
|
236
|
+
outline-offset: 2px;
|
|
237
|
+
}
|
|
238
|
+
`,Gt=a.span`
|
|
239
|
+
display: flex;
|
|
240
|
+
flex-direction: column;
|
|
241
|
+
flex: 1;
|
|
242
|
+
min-width: 0;
|
|
243
|
+
font-family: ${s.font.sans};
|
|
244
|
+
`,Dt=a.strong`
|
|
245
|
+
font-weight: 600;
|
|
246
|
+
font-size: 14px;
|
|
247
|
+
color: ${s.colors.text};
|
|
248
|
+
`,Ut=a.span`
|
|
249
|
+
font-size: 12px;
|
|
250
|
+
color: ${s.colors.muted};
|
|
251
|
+
`,Ht=a.span`
|
|
252
|
+
flex: none;
|
|
253
|
+
font-weight: 600;
|
|
254
|
+
font-size: 13px;
|
|
255
|
+
color: ${s.colors.accent};
|
|
256
|
+
text-transform: uppercase;
|
|
257
|
+
letter-spacing: 0.046em;
|
|
258
|
+
`,Qt=48,ye=[{key:"wearables",labelKey:"myAssets.sectionWearables",category:"wearable"},{key:"emotes",labelKey:"myAssets.sectionEmotes",category:"emote"},{key:"names",labelKey:"myAssets.sectionNames",category:"ens"},{key:"creations",labelKey:"myAssets.sectionCreations"}],H=[{key:"newest",label:"filterBar.sortNewest",server:"newest"},{key:"name",label:"filterBar.sortName",server:"name"},{key:"cheapest",label:"filterBar.sortCheapest",server:"cheapest"}];function ge(o){return o==="wearables"||o==="emotes"}const be={wearables:"wearable",emotes:"emote",names:"names",creations:""},Wt={wearable:"wearables",emote:"emotes",names:"names"};function Yt(o){return`${je.builderUrl}/names/${encodeURIComponent(o)}`}function we(o){return{id:o.id,name:o.name,creator:"",contractAddress:o.contractAddress,itemId:o.itemId,category:o.category,rarity:o.rarity??"common",network:o.network,chainId:o.chainId,thumbnail:o.image,priceCredits:o.listingPrice??0,gender:null,isSmart:!1,tokenId:o.tokenId,issuedId:o.issuedId}}function Jt(o,T=0){return{id:`${o.contractAddress}-${o.blockchainItemId}`,name:o.name,creator:"",contractAddress:o.contractAddress,itemId:o.blockchainItemId,category:o.category,rarity:o.rarity,network:"MATIC",chainId:je.chainId,thumbnail:o.thumbnail,priceCredits:T,gender:null,isSmart:!1}}function gs(){var re,ae;Je({title:r("nav.myAssets"),noindex:!0});const{session:o,error:T,signIn:Ce,restore:Q}=Ve(),F=Ze(),[Ie,ke]=Ye(),W=Ie.get("section"),l=ye.some(e=>e.key===W)?W:"wearables",[m,R]=d.useState("all"),[h,_]=d.useState([]),[p,$]=d.useState(null),[w,ve]=d.useState("newest"),[C,Y]=d.useState(""),[y,Ae]=d.useState(""),[I,g]=d.useState(!1),[Ee,Te]=d.useState(!0),[Fe,Re]=d.useState(!1),[J,V]=d.useState(null),[_e,Z]=d.useState(null),[Le,X]=d.useState(null);d.useEffect(()=>{Q()},[Q]),d.useEffect(()=>{const e=setTimeout(()=>Ae(C.trim()),300);return()=>clearTimeout(e)},[C]),d.useEffect(()=>{if(!I)return;const e=i=>{i.key==="Escape"&&g(!1)};document.addEventListener("keydown",e);const n=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.removeEventListener("keydown",e),document.body.style.overflow=n}},[I]);const u=o==null?void 0:o.address,Oe=ye.find(e=>e.key===l),k=ge(l),ee=(H.find(e=>e.key===w)??H[0]).server,Pe=m==="on_sale"?r("filter.onSale"):m==="not_for_sale"?r("filter.notForSale"):"",ze=G.filter(e=>h.includes(e)).map(le).join(", ");function te(e){ke(n=>{const i=new URLSearchParams(n);return i.set("section",e),i},{replace:!0}),$(null),ge(e)||_([]),g(!1)}function se(e){_(n=>n.includes(e)?n.filter(i=>i!==e):[...n,e])}function Be(e){const n=Wt[e];n&&te(n)}const{items:L,total:Ke,isLoading:O,isPlaceholderData:P,error:Ne,hasNextPage:Me,isFetchingNextPage:oe,fetchNextPage:qe}=Rt(["my-assets",u,l,m,h,p,y,ee],e=>tt(u,{category:Oe.category,first:Qt,skip:e,search:y||void 0,rarities:k&&h.length?h:void 0,wearableCategories:l==="wearables"&&p?ce[p]:void 0,emoteCategories:l==="emotes"&&p?ce[p]:void 0,onlyOnSale:m==="on_sale"||void 0,sortBy:ee}).then(n=>({items:n.assets,total:n.total})),{enabled:!!u&&l!=="creations"}),z=d.useMemo(()=>m==="not_for_sale"?L.filter(e=>!e.isOnSale):L,[L,m]),{data:v,isLoading:B,isError:Ge}=M({queryKey:["publishable-items",u],queryFn:()=>lt(u,o.identity),enabled:!!o&&l==="creations",retry:!1}),K=d.useMemo(()=>[...new Set((v??[]).map(e=>e.contractAddress))],[v]),{data:A}=M({queryKey:["collection-sale-state",u,K],enabled:K.length>0,queryFn:async()=>{const e=await Promise.all(K.map(async i=>[i,await rt(i)])),n={};for(const[i,c]of e)for(const[f,x]of Object.entries(c))n[`${i}-${f}`]=x;return n}}),S=e=>A==null?void 0:A[`${e.contractAddress}-${e.blockchainItemId}`],N=d.useMemo(()=>{let e=v??[];if(m==="on_sale"?e=e.filter(i=>{var c;return(c=S(i))==null?void 0:c.isOnSale}):m==="not_for_sale"&&(e=e.filter(i=>{var c;return!((c=S(i))!=null&&c.isOnSale)})),y){const i=y.toLowerCase();e=e.filter(c=>c.name.toLowerCase().includes(i))}const n=[...e];return w==="name"?n.sort((i,c)=>i.name.localeCompare(c.name)):w==="cheapest"&&n.sort((i,c)=>{var f,x;return(((f=S(i))==null?void 0:f.priceCredits)??0)-(((x=S(c))==null?void 0:x.priceCredits)??0)}),n},[v,A,m,y,w]),{data:b}=M({queryKey:["importable",u],queryFn:()=>at(u),enabled:!!u}),ne=((b==null?void 0:b.creations.length)??0)+((b==null?void 0:b.owned.length)??0);async function De(e,n,i){if(o){X(null),Z(i);try{const c=await st(e);await ct({trade:c,signer:o.signer}),ot.success(r("myAssets.removedFromSale",{name:n})),await F.invalidateQueries({queryKey:["my-assets",o.address]}),await F.invalidateQueries({queryKey:["collection-sale-state"]}),await F.invalidateQueries({queryKey:["publishable-items"]})}catch(c){const f=c,x=(f.message??"").toLowerCase(),ie=f.code===4001||x.includes("reject")||x.includes("denied");ie||nt(c,{flow:"remove-listing",tradeId:e}),X(ie?r("getCredits.errorCanceled"):r("myAssets.removeListingError"))}finally{Z(null)}}}if(!o)return t.jsxs(Kt,{children:[t.jsx(Nt,{children:r("nav.myAssets")}),t.jsx(Mt,{children:r("myAssets.signInPrompt")}),t.jsx(Xe,{variant:"purple",onClick:()=>Ce(),children:r("storeSettings.signIn")}),t.jsx(U,{message:T})]});const Ue=l==="creations"?B:O||P,He=l==="creations"?N.length:m==="not_for_sale"?z.length:Ke,E=[];if(m!=="all"&&E.push({key:"status",label:m==="on_sale"?r("filter.onSale"):r("filter.notForSale"),onRemove:()=>R("all")}),k)for(const e of G)h.includes(e)&&E.push({key:`rarity-${e}`,label:le(e),onRemove:()=>se(e)});if(k&&p){const e=(ae=(re=dt.find(n=>n.key===be[l]))==null?void 0:re.subs)==null?void 0:ae.find(n=>n.key===p);E.push({key:"sub",label:e?r(e.labelKey):p,onRemove:()=>$(null)})}function Qe(){R("all"),_([]),$(null)}const We=t.jsxs(t.Fragment,{children:[t.jsx(mt,{title:r("myAssets.assetsHeading"),category:be[l],subCategory:p,onCategory:Be,onSub:$,onCollections:()=>te("creations"),collections:l==="creations",extraLabelKey:"myAssets.sectionCreations",hideAll:!0}),k?t.jsxs(t.Fragment,{children:[t.jsx(de,{}),t.jsx(me,{title:r("assets.rarity"),open:Fe,onToggle:()=>Re(e=>!e),summary:ze,headerTestId:"sidebar-section-toggle",children:t.jsx(ft,{"data-testid":"rarity-filter",children:G.map(e=>{const n=h.includes(e);return t.jsxs(xt,{type:"button",selected:n,"aria-pressed":n,onClick:()=>se(e),"data-testid":"rarity-filter-check",children:[t.jsx(ht,{color:s.rarities[e],children:n?t.jsx(yt,{name:"check","aria-hidden":!0}):null}),t.jsx(gt,{selected:n,children:e})]},e)})})})]}):null,t.jsx(de,{}),t.jsx(me,{title:r("filter.status"),open:Ee,onToggle:()=>Te(e=>!e),summary:Pe,children:[["all",r("filter.statusAll")],["on_sale",r("filter.onSale")],["not_for_sale",r("filter.notForSale")]].map(([e,n])=>t.jsxs(bt,{children:[t.jsx(wt,{type:"radio",name:"myassets-status",checked:m===e,onChange:()=>R(e)}),t.jsx(St,{children:n})]},e))})]});return t.jsxs(jt,{"data-testid":"my-assets",children:[I?t.jsx($t,{onClick:()=>g(!1),"aria-hidden":!0}):null,t.jsxs(Ct,{className:I?"is-open":"","data-testid":"my-assets-sidebar",children:[t.jsxs(It,{children:[t.jsx(kt,{children:r("assets.filters")}),t.jsx(vt,{onClick:()=>g(!1),"aria-label":r("assets.closeFilters"),children:"✕"})]}),t.jsx(At,{children:We}),t.jsx(Et,{children:t.jsx(Tt,{type:"button",onClick:()=>g(!1),children:r("assets.showItems")})})]}),t.jsxs(Ft,{children:[t.jsxs(_t,{children:[t.jsx(Lt,{name:"search","aria-hidden":!0}),t.jsx(Ot,{type:"search",value:C,placeholder:r("myAssets.searchPlaceholder"),"aria-label":r("myAssets.searchPlaceholder"),onChange:e=>Y(e.target.value)}),C?t.jsx(Pt,{type:"button","aria-label":r("myAssets.clearSearch"),onClick:()=>Y(""),children:t.jsx(zt,{name:"close","aria-hidden":!0})}):null]}),ne>0?t.jsxs(qt,{to:"/import",children:[t.jsx("span",{"aria-hidden":!0,children:"📦"}),t.jsxs(Gt,{children:[t.jsx(Dt,{children:r("myAssets.importTitle")}),t.jsx(Ut,{children:r("myAssets.importSub",{count:ne})})]}),t.jsx(Ht,{children:r("myAssets.import")})]}):null,t.jsx(pt,{sort:w,onSort:ve,sortOptions:H,total:He,loading:Ue,query:y,onOpenFilters:()=>g(!0),chips:E,onClearChips:Qe}),(l==="creations"?Ge:Ne)?t.jsx(U,{message:r("myAssets.ownedError"),testId:"my-assets-error"}):null,t.jsx(U,{message:Le}),l==="creations"?t.jsxs(t.Fragment,{children:[t.jsx(pe,{"data-testid":"grid",children:B?t.jsx(D,{count:12}):N.map(e=>{const n=S(e),i=!!(n!=null&&n.isOnSale);return t.jsx(q,{item:Jt(e,(n==null?void 0:n.priceCredits)??0),mode:"manage",listed:i,busy:_e===e.id,onList:()=>{et("Shop Started Listing",{listing_type:"primary",item_id:e.blockchainItemId}),V(e)},onUnlist:()=>{n!=null&&n.tradeId&&De(n.tradeId,e.name,e.id)}},`${e.contractAddress}-${e.blockchainItemId}`)})}),!B&&N.length===0?t.jsxs(ue,{children:[t.jsx(fe,{children:t.jsx(j,{name:"pen",size:30,"aria-hidden":!0})}),t.jsx(xe,{children:r("myAssets.emptyCreationsTitle")}),t.jsx(he,{children:r("myAssets.nothingToPublish")})]}):null]}):t.jsxs(t.Fragment,{children:[t.jsxs(pe,{"data-testid":"grid",children:[O||P?t.jsx(D,{count:12}):z.map(e=>l==="names"?t.jsx(q,{item:{...we(e),category:"ens"},mode:"manage-link",manageHref:Yt(e.name)},e.id):t.jsx(q,{item:we(e),mode:"manage-link"},e.id)),oe?t.jsx(D,{count:6}):null]}),m!=="not_for_sale"?t.jsx(ut,{hasNextPage:Me,isFetching:oe,onLoadMore:()=>void qe()}):null,!O&&!P&&z.length===0?t.jsxs(ue,{children:[t.jsx(fe,{children:t.jsx(j,{name:l==="names"?"website":l==="emotes"?"emote-dance":"cat-upper",size:30,"aria-hidden":!0})}),t.jsx(xe,{children:l==="names"?r("myAssets.emptyNamesTitle"):r("myAssets.emptyOwnedTitle")}),t.jsx(he,{children:l==="names"?r("myAssets.namesEmpty"):r("myAssets.ownedEmpty")}),l!=="names"?t.jsx(Bt,{to:"/assets",children:r("myAssets.emptyBrowse")}):null]}):null]})]}),J?t.jsx(it,{item:J,session:o,onClose:()=>V(null)}):null]})}export{gs as MyAssets};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{r as n,j as s,L as m}from"./react-BrLDncxD.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-BrLDncxD.js";import{u as c,t,a as l,I as d,A as p,s as v,B as x}from"./index-C1yBaAe9.js";import{L as u}from"./LoadMore-wolzH5ER.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-CLB2z3On.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,4 +1,4 @@
|
|
|
1
|
-
import{j as e,L as y}from"./react-BrLDncxD.js";import{s as i,B as w,F as r,M as k,u as $,t as d,d as v,I as x,
|
|
1
|
+
import{j as e,L as y}from"./react-BrLDncxD.js";import{s as i,B as w,F as r,M as k,u as $,t as d,d as v,I as x,a6 as I,g as j,m as P,a7 as L}from"./index-C1yBaAe9.js";import{L as N}from"./LoadMore-wolzH5ER.js";import{u as E}from"./useInfiniteGrid-CRDFn4if.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-CLB2z3On.js";import"./intl-CBcMB1D2.js";const T=15e3;function C(t,n){return t.txHash&&n.txHash?t.txHash===n.txHash:t.txHash||n.txHash?!1:t.status===n.status&&Math.abs(t.createdAt-n.createdAt)<=T}function D(t){const n=[...t].sort((s,o)=>o.createdAt-s.createdAt),a=[];for(const s of n){const o=a[a.length-1];o&&C(o[o.length-1],s)?o.push(s):a.push([s])}return a.map(s=>{var o;return{id:((o=s.find(c=>c.txHash))==null?void 0:o.txHash)??s[s.length-1].id,createdAt:Math.max(...s.map(c=>c.createdAt)),status:s.some(c=>c.status==="PENDING")?"PENDING":"SETTLED",totalCredits:s.reduce((c,u)=>c+u.credits,0),lines:s}})}function H(t){const n=[],a=new Map;for(const s of t)if(s.tradeId){const o=a.get(s.tradeId);if(o){o.quantity+=1,o.credits+=s.credits;continue}const c={key:s.tradeId,tradeId:s.tradeId,quantity:1,credits:s.credits};a.set(s.tradeId,c),n.push(c)}else n.push({key:s.id,tradeId:null,quantity:1,credits:s.credits});return n}const m=k`
|
|
2
2
|
0% { background-position: 200% 0; }
|
|
3
3
|
100% { background-position: -200% 0; }
|
|
4
4
|
`,z=i.section`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,L as n}from"./react-BrLDncxD.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-BrLDncxD.js";import{u as s,t as o,I as e,B as a}from"./index-C1yBaAe9.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-CLB2z3On.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as A,L as O,o as U,e as B,t as a,g as F,B as _,C as v,p as Q,x as k,J as q,E as W,y as D}from"./index-C1yBaAe9.js";import{d as w}from"./dcl-schemas-BICTSpB5.js";import{a as G,r as m,j as s}from"./react-BrLDncxD.js";import{i as J,e as K,c as H}from"./trade-encoding-DQ3zNCj8.js";import{f as V}from"./errors-gKUnErEU.js";import{E as X}from"./ErrorNotice-BDH9xoG4.js";const N=()=>`${A.builderServerUrl}/v1`;function P(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 E(e,r){const t=await O(e,{method:"GET",identity:r,metadata:{}});if(!t.ok)throw new Error(`builder-server ${t.status}: ${await t.text()}`);const n=await t.json();return n.data??n}function Y(e,r){const t=r-e;return t>0?t:0}function z(e){var r,t,n,i,l;return((t=(r=e.data)==null?void 0:r.wearable)==null?void 0:t.category)??((i=(n=e.data)==null?void 0:n.emote)==null?void 0:i.category)??((l=e.data)==null?void 0:l.category)??e.type??"wearable"}function I(e){return`${N()}/storage/contents/${e}`}function f(e,r){if(!e)return"";if(/^https?:\/\//.test(e))return e;const t=r==null?void 0:r[e];return t?I(t):/^(ba|Qm)/.test(e)?I(e):""}async function Z(e,r){try{const t=await fetch(`${N()}/items/${e}/${r}/contents`);if(!t.ok)return{};const n=await t.json();return n.data??n}catch{return{}}}async function ee(e,r,t){const n=f(e.thumbnail,e.contents)||f("thumbnail.png",e.contents);if(n)return n;if(r&&t){const i=await Z(r,t);return f(e.thumbnail,i)||f("thumbnail.png",i)||f("image.png",i)}return""}async function te(e,r){const t=`${N()}/${e.toLowerCase()}/collections?is_published=true`,n=await E(t,r);return P(n).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(l=>l.toLowerCase())}))}async function se(e,r){const t=`${N()}/collections/${e.id}/items`,n=await E(t,r);return(await Promise.all(P(n).map(async l=>{const g=l.rarity??"common",h=Number(l.total_supply??0)||0;let o;try{o=w.Rarity.getMaxSupply(g)}catch{o=0}const b=(l.contract_address??e.contractAddress).toLowerCase(),p=l.blockchain_item_id??"";return{id:l.id,collectionId:e.id,collectionName:e.name,contractAddress:b,blockchainItemId:p,name:l.name,category:z(l),rarity:g,thumbnail:await ee(l,b,p),type:l.type??"wearable",isPublished:l.is_published??e.isPublished,isApproved:l.is_approved??e.isApproved,totalSupply:h,maxSupply:o,remainingSupply:Y(h,o),minters:e.minters}}))).filter(re)}function re(e){return e.isPublished&&e.isApproved&&e.blockchainItemId!==""&&e.blockchainItemId!=null&&e.remainingSupply>0}async function ue(e,r){const t=await te(e,r);return(await Promise.all(t.map(async i=>{try{return await se(i,r)}catch{return[]}}))).flat()}const ae=1e3*60*60*24*182;function me({item:e,session:r,onClose:t}){const n=U(),i=G(),[l,g]=m.useState("10"),[h,o]=m.useState(null),[b,p]=m.useState(null),[d,L]=m.useState(!1),[y,j]=m.useState(null),[C,$]=m.useState(null),x=A.chainId,S=B(r.providerType);m.useEffect(()=>{let c=!1;return(async()=>{try{const u=await J({contractAddress:e.contractAddress,chainId:x});c||j(u)}catch{c||j(!1)}})(),()=>{c=!0}},[e.contractAddress,x]);async function M(){p(null);const c=Number(l);if(!Number.isInteger(c)||c<=0){p(a("primaryList.errorWholeNumber"));return}L(!0);try{y||(o(a("primaryList.statusEnabling")),await K({signer:r.signer,contractAddress:e.contractAddress,chainId:x}),j(!0)),o(a("primaryList.statusPublishing"));const u=await H({signer:r.signer,item:{contractAddress:e.contractAddress,itemId:e.blockchainItemId,network:w.Network.MATIC,chainId:x},usdPrice:c/10,uses:e.remainingSupply,expiresAtMs:Date.now()+ae});o(a("primaryList.statusFinishing")),await Q(u,r.identity),o(null),$(c),k("Shop Listed Item",{item_id:e.blockchainItemId,contract_address:e.contractAddress,price_credits:c,price_usd:c/10,listing_type:"primary",is_primary:!0}),q.success(a("primaryList.toastOnSale",{name:e.name})),n.invalidateQueries({queryKey:["publishable-items"]}),n.invalidateQueries({queryKey:["collection-sale-state"]})}catch(u){W(u,{flow:"list_primary"}),k("Shop Listing Failed",{listing_type:"primary",error_code:D(u)}),p(V(u,a("primaryList.errorGeneric"))),o(null)}finally{L(!1)}}function T(){t(),i(`/item/${e.contractAddress}/${e.blockchainItemId}`)}const R=d?a("primaryList.listing"):y===!1?a("primaryList.enableAndPutOnSale"):a("primaryList.putOnSale");return C!==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("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(F,{className:"ccy-mark"})," ",C]})," ",a("primaryList.dotAvailable",{count:e.remainingSupply})]}),s.jsxs("div",{className:"modal__actions",children:[s.jsx(_,{variant:"ghost",onClick:t,children:a("getCredits.done")}),s.jsx(_,{variant:"purple",onClick:T,children:a("primaryList.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("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:v.name})}),s.jsx("input",{type:"number",min:"1",step:"1",value:l,onChange:c=>g(c.target.value),disabled:d})]}),s.jsx("p",{className:"muted small",children:a("primaryList.pricedInWhole",{currency:v.name,currencySingular:v.nameSingular})}),y===!1&&!d?S?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})}):y===!0&&!d?S?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,h?s.jsx("p",{className:"muted",children:h}):null,s.jsx(X,{message:b}),s.jsxs("div",{className:"modal__actions",children:[s.jsx(_,{variant:"ghost",onClick:t,disabled:d,children:a("primaryList.cancel")}),s.jsx(_,{onClick:()=>void M(),disabled:d||y===null,children:y===null?a("primaryList.checking"):R})]})]})})}export{me as P,ue as f};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{j as s,a as se,r as n,L as te}from"./react-BrLDncxD.js";import{t as a,F as C,s as _,M as ae,u as ie,d as re,o as ne,I as E,B as F,J as M}from"./index-
|
|
1
|
+
import{j as s,a as se,r as n,L as te}from"./react-BrLDncxD.js";import{t as a,F as C,s as _,M as ae,u as ie,d as re,o as ne,I as E,B as F,J as M}from"./index-C1yBaAe9.js";import{u as oe,d as le,t as ce,L as de,i as R,a as v,s as me}from"./useStore-DjC0Mzyl.js";import{E as B}from"./ErrorNotice-BDH9xoG4.js";import"./dcl-schemas-BICTSpB5.js";import"./sentry-DYZXk5O5.js";import"./ethers-CLB2z3On.js";import"./intl-CBcMB1D2.js";const ue="https://cdn.decentraland.org/@dcl/shop/0.1.0-29944279663.commit-001b5a7/assets/template-cover-1-BETekfHg.jpeg",pe="https://cdn.decentraland.org/@dcl/shop/0.1.0-29944279663.commit-001b5a7/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}),h=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
|
+
`,he=_.div`
|
|
6
6
|
display: flex;
|
|
7
7
|
align-items: center;
|
|
8
8
|
justify-content: center;
|
|
@@ -16,7 +16,7 @@ import{j as s,a as se,r as n,L as te}from"./react-BrLDncxD.js";import{t as a,F a
|
|
|
16
16
|
flex-direction: column;
|
|
17
17
|
text-align: center;
|
|
18
18
|
}
|
|
19
|
-
`,
|
|
19
|
+
`,fe=_.span`
|
|
20
20
|
flex: none;
|
|
21
21
|
border-radius: 50%;
|
|
22
22
|
border-style: solid;
|
|
@@ -46,8 +46,8 @@ import{j as s,a as se,r as n,L as te}from"./react-BrLDncxD.js";import{t as a,F a
|
|
|
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(he,{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(fe,{"data-testid":"spinner-box-ring","data-size":d,"aria-hidden":!0}),i?s.jsx(xe,{children:i}):null]})}const be=_(F)`
|
|
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:P}=oe(c),[r,m]=n.useState(A),[L,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:P}=oe(c),[r,m]=n.useState(A),[L,y]=n.useState(A),[k,p]=n.useState(),[g,$]=n.useState(!1),[o,N]=n.useState(null),[f,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(h.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=h.find(l=>r.coverName===`cover/${l.name}`);if(e)return e.name;const t=r.coverHash?h.find(l=>f[l.name]===r.coverHash):void 0;return t==null?void 0:t.name},[r.coverName,r.coverHash,f]);n.useEffect(()=>{o!=null&&o.hash&&h.some(e=>f[e.name]===o.hash)&&N(null)},[f,o]);const I=k!==void 0&&k>O,Y=n.useMemo(()=>de.filter(e=>!R(e,r.links[e])),[r.links]),J=I||Y.length>0,w=n.useMemo(()=>JSON.stringify(r)!==JSON.stringify(L),[r,L]),K=w&&!J&&!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 q(e,t){p(void 0),m(l=>({...l,cover:t,coverName:`cover/${e}`,coverHash:""}))}const G=["image/png","image/jpeg","image/webp"];function Q(e){var H;const t=(H=e.target.files)==null?void 0:H[0];if(!t||!G.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()]}),M.success(a("storeSettings.saved")),b(`/assets/creator/${c}`)}catch{M.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]}),P?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:[h.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:()=>q(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(B,{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,"")}}))}),R("website",r.links.website)?null:s.jsx(B,{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(F,{variant:"purple",className:"store-settings__save","data-testid":"store-settings-save",onClick:()=>void Z(),disabled:!K,children:g?a("storeSettings.saving"):a("storeSettings.save")})})]})]})}export{ye as StoreSettings,ye as default};
|