@dcl/shop 1.11.2 → 1.11.3-33155570552.commit-80e7685
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_assets/{Activity-BhrsqnTy.js → Activity-BQ4cNZJq.js} +8 -8
- package/_assets/{AnimatedBackground-DB2urHfN.js → AnimatedBackground-BlItZE4F.js} +2 -2
- package/_assets/{Assets-CEOKXfHN.js → Assets-D-AYQR5O.js} +61 -61
- package/_assets/{Authorizations-zY_jkrdd.js → Authorizations-D3TFOLc0.js} +2 -2
- package/_assets/{Cart-CD3QMZMU.js → Cart-6PT2o0XO.js} +2 -2
- package/_assets/{Collection-fLHFUGHo.js → Collection-DmKa8SBy.js} +2 -2
- package/_assets/{CollectionCarousel-Cs01J4sG.js → CollectionCarousel-xKmRjdjJ.js} +38 -21
- package/_assets/{Confetti-DI93CkCr.js → Confetti-Z8v6OTnK.js} +4 -4
- package/_assets/{ConstantsUtil-9orAwS_V.js → ConstantsUtil-BPwpv-BJ.js} +2 -2
- package/_assets/{ContentClient-Dr4IkAbb.js → ContentClient-CwaFAxk9.js} +2 -2
- package/_assets/{Creator-DGT3lqoW.js → Creator-CJ1EuxZi.js} +2 -2
- package/_assets/{DeploymentBuilder-BsQ4GIy9.js → DeploymentBuilder-Zh0Cr-vJ.js} +2 -2
- package/_assets/{EmotePlaybackBar-WqjOzm12.js → EmotePlaybackBar-Cfp2UVtr.js} +3 -3
- package/_assets/{ErrorNotice-BanVYx_o.js → ErrorNotice-4SblVCJ8.js} +2 -2
- package/_assets/{ExchangeController-BWLF9BXM.js → ExchangeController-FowBnqTh.js} +2 -2
- package/_assets/{Faq-Dt8RPaHZ.js → Faq-DWg1l4FJ.js} +2 -2
- package/_assets/{GetCredits-BtM_F2J_.js → GetCredits-Crj7O7kG.js} +2 -2
- package/_assets/{Grow-DqnkmJ7j.js → Grow-ClQLtYgl.js} +2 -2
- package/_assets/{HelpersUtil-BtPtcaFe.js → HelpersUtil-C9WqS0ra.js} +2 -2
- package/_assets/{ItemDetail-C28UgJKw.js → ItemDetail-DXkjmRlh.js} +319 -319
- package/_assets/{LoadMore-hoiSVN2H.js → LoadMore-BaRjyF39.js} +2 -2
- package/_assets/{ManaPricingBanner.styles-rIYX7xjf.js → ManaPricingBanner.styles-DJ7bjK0l.js} +2 -2
- package/_assets/{MyAssets-BtAcjcuT.js → MyAssets-DWg2lKw9.js} +2 -2
- package/_assets/{MyFavorites-C3BVkIkn.js → MyFavorites-B-2ArPlw.js} +2 -2
- package/_assets/{NetworkUtil-BIUbrPWa.js → NetworkUtil-aMprsRwC.js} +2 -2
- package/_assets/{NotFound-BgmQ5oFS.js → NotFound-BNX73CrT.js} +2 -2
- package/_assets/{NotificationsBell-Bjpu5hGT.js → NotificationsBell-B0enWd7a.js} +2 -2
- package/_assets/{OutfitDetail-CIeX74fk.js → OutfitDetail-BjKXVLQi.js} +2 -2
- package/_assets/{OutfitPreview-Clicok_x.js → OutfitPreview-Dwy7hPo7.js} +2 -2
- package/_assets/{OutfitStudio-DLStaax_.js → OutfitStudio-BPSa9mCN.js} +2 -2
- package/_assets/{StoreSettings-DwoVLG99.js → StoreSettings-CNfXo7Kp.js} +22 -22
- package/_assets/{Success-BKkeu6d7.js → Success-DRyL1YJL.js} +31 -31
- package/_assets/{SwapController-Cnrhnusk.js → SwapController-C6MSYEZI.js} +2 -2
- package/_assets/{TradeService-BgsoZh0O.js → TradeService-C-dm6LM0.js} +2 -2
- package/_assets/{W3MFrameProviderSingleton-DqaMm2mV.js → W3MFrameProviderSingleton-naTr0B5v.js} +4 -4
- package/_assets/{WebCryptoP256-R5qc29Sl.js → WebCryptoP256-BvKVlBTt.js} +2 -2
- package/_assets/{authorizations-DC168PVR.js → authorizations-DxGdOyfi.js} +2 -2
- package/_assets/{basic-CcMC-Noe.js → basic-BQfHF2z7.js} +2 -2
- package/_assets/{biconomy-MuBR1fCG.js → biconomy-CR1wJ3NW.js} +2 -2
- package/_assets/{browseLayout.styles-C_vn8XYJ.js → browseLayout.styles-CQilLRye.js} +2 -2
- package/_assets/{browser-CTTbQgwQ.js → browser-d5kVYj7V.js} +2 -2
- package/_assets/{browser-ponyfill-2MY_3eYQ.js → browser-ponyfill-DrgqR3Jn.js} +2 -2
- package/_assets/{builder-CpxipFmE.js → builder-BSxR3UB0.js} +2 -2
- package/_assets/{buy-gasless-Co1yjKqt.js → buy-gasless-IWvDnyE1.js} +2 -2
- package/_assets/{buy-C9vFcpIy.js → buy-wWHknAve.js} +2 -2
- package/_assets/{categories-DSulO5YB.js → categories-DeaLeWRX.js} +2 -2
- package/_assets/{ccip-BGKWaLZd.js → ccip-B90xCZHf.js} +2 -2
- package/_assets/{ccip-CIGFVe9f.js → ccip-Cz-KmXKk.js} +2 -2
- package/_assets/{chains-B_96BGTk.js → chains-oGtQSZCV.js} +2 -2
- package/_assets/collectionPage.styles-CghU1BDG.js +40 -0
- package/_assets/{common-nayH6Qb7.js → common-DC3tU0GR.js} +2 -2
- package/_assets/{controller-BoM50IGk.js → controller-BDXczEFY.js} +3 -3
- package/_assets/{core-C6U0AzoB.js → core-BFeA5TIQ.js} +5 -5
- package/_assets/{createSvgIcon-DLtjIgIX.js → createSvgIcon-aMKGf-Vs.js} +2 -2
- package/_assets/{custom-BDzyroM1.js → custom-CxtAUMyW.js} +2 -2
- package/_assets/{data-capture-Zb8-AfOh.js → data-capture-CJg0LXBB.js} +2 -2
- package/_assets/{dcl-schemas-OH8G4Ndl.js → dcl-schemas-DhyZEUTb.js} +2 -2
- package/_assets/{decimals-gxw11IoF.js → decimals-CyyfypTD.js} +2 -2
- package/_assets/{decimals-DwmaOPpT.js → decimals-Dp_m_LUh.js} +2 -2
- package/_assets/{detectExtension-GZk2y11b.js → detectExtension-BaIhULKE.js} +2 -2
- package/_assets/{disposePreview-CoU0o2LJ.js → disposePreview-BCeOgBsa.js} +2 -2
- package/_assets/{email-Bs2nQCjl.js → email-BXyiCzx4.js} +2 -2
- package/_assets/{embedded-wallet-DaMZY5wt.js → embedded-wallet-D_DeRhdX.js} +2 -2
- package/_assets/{emotion-styled.browser.esm-pl53fr_X.js → emotion-styled.browser.esm-CQmMziER.js} +2 -2
- package/_assets/{engine-_-Y9EygX.js → engine-Bv55PPW4.js} +2 -2
- package/_assets/{errors-ISVrHVty.js → errors-C7o97G4M.js} +2 -2
- package/_assets/{estimate-l1-fee-C2MojaUq.js → estimate-l1-fee-CDmNUoNh.js} +2 -2
- package/_assets/{eth_estimateGas-ByaJEeM-.js → eth_estimateGas-CWaRS4NL.js} +2 -2
- package/_assets/{eth_getStorageAt-CfRtAGD-.js → eth_getStorageAt-Dg9ISDGi.js} +2 -2
- package/_assets/{eth_getTransactionCount-DCx1pf2k.js → eth_getTransactionCount-LEq9UY5X.js} +2 -2
- package/_assets/{ethereum-BgVZC6F_.js → ethereum-Cmptxtln.js} +2 -2
- package/_assets/{ethers-DwK2TdL6.js → ethers-ByWI-eMv.js} +2 -2
- package/_assets/{events-CSIN-_05.js → events-D_1RveUS.js} +2 -2
- package/_assets/{execute-wmZZdldV.js → execute-DnJxddQK.js} +3 -3
- package/_assets/{extractIPFS-BS6I288E.js → extractIPFS-B1bRbvds.js} +2 -2
- package/_assets/{features-DimRp-1s.js → features-SrcqXGig.js} +2 -2
- package/_assets/{fetchTokenMetadata-DZy_tSZt.js → fetchTokenMetadata-VIsnBrpd.js} +3 -3
- package/_assets/{field.styles-6_NAJBdz.js → field.styles-D1op8emw.js} +2 -2
- package/_assets/{fortmatic-D-iEWKOV.js → fortmatic-DTk-9yYD.js} +2 -2
- package/_assets/{get-bytecode-We_Yud0L.js → get-bytecode-C8AHhRd1.js} +2 -2
- package/_assets/{get-ecosystem-wallet-info-CZ2Y-cLY.js → get-ecosystem-wallet-info-Be98mpat.js} +2 -2
- package/_assets/{getBalance-SeTBLCzL.js → getBalance-B-8cmr-h.js} +3 -3
- package/_assets/{getInstalledModules-Dj-K4xQC.js → getInstalledModules-DK4sLWwT.js} +2 -2
- package/_assets/{getNFT-BiPo4cEC.js → getNFT-Cx3ber2r.js} +2 -2
- package/_assets/{getNFT-BCYWBTK4.js → getNFT-kD4plCPE.js} +3 -3
- package/_assets/{grid.styles-DlGaOCzf.js → grid.styles-BIwLaIPU.js} +2 -2
- package/_assets/{hashTypedData-OCiZaYsv.js → hashTypedData-2dskM5dw.js} +2 -2
- package/_assets/{hashTypedData-Dr6t3Q-D.js → hashTypedData-XHY2qZ4b.js} +2 -2
- package/_assets/{in-app-CVvPAYT7.js → in-app-BWFH8lGO.js} +2 -2
- package/_assets/{in-app-wallet-calls-ChA73nJF.js → in-app-wallet-calls-A2e2hrZw.js} +2 -2
- package/_assets/{index-DZcNiUa1.js → index--zfsMLjb.js} +2 -2
- package/_assets/{index-Ct9dUkSX.js → index-10pmvfcK.js} +2 -2
- package/_assets/{index-DGwAzxg5.js → index-B119MHsD.js} +2 -2
- package/_assets/{index-BiAbz-7Q.js → index-B6mDQ71Q.js} +2 -2
- package/_assets/{index-gm_D0aNI.js → index-BCuiMQGB.js} +2 -2
- package/_assets/{index-BPQVwfa5.js → index-BF4nzAgt.js} +2 -2
- package/_assets/{index-B9Up_SK0.js → index-BOFayr-1.js} +2 -2
- package/_assets/{index-D1jUYM4a.js → index-BOp8R4FG.js} +2 -2
- package/_assets/{index-D0Wlf6gr.js → index-BSjqMBr9.js} +2 -2
- package/_assets/{index-D2CYJ9zD.js → index-BVX6XXgW.js} +2 -2
- package/_assets/{index-D7_zDlZP.js → index-BXB-Q7JK.js} +2 -2
- package/_assets/{index-ncctYqB-.js → index-BY17flxD.js} +2 -2
- package/_assets/{index-DAqd6v3r.js → index-BYq6qdHu.js} +2 -2
- package/_assets/{index-CO9qakt0.js → index-BZny5glp.js} +2 -2
- package/_assets/{index-Cj5zg5gT.js → index-Bbp7woDG.js} +2 -2
- package/_assets/{index-DKiFTtAe.js → index-BgR0fN2n.js} +3 -3
- package/_assets/{index-CQvLWK26.js → index-BivdeeqA.js} +2 -2
- package/_assets/{index-Dxe6AOQE.js → index-Bl3CX05h.js} +2 -2
- package/_assets/{index-_-VFmxzj.js → index-BuqzfES3.js} +2 -2
- package/_assets/{index-D0q045Px.js → index-Bv52y23u.js} +2 -2
- package/_assets/{index-Axq2dKdE.js → index-BzKWexAG.js} +2 -2
- package/_assets/{index-BjdjqJv4.js → index-C1LgB3lX.js} +4 -4
- package/_assets/{index-CK4WqWqO.js → index-C3A5Huo_.js} +2 -2
- package/_assets/{index-DRR34LYo.js → index-C3XWYmll.js} +2 -2
- package/_assets/{index-DibFNBla.js → index-CCo-gXU1.js} +2 -2
- package/_assets/{index-D8QWWYMI.js → index-CEWHjElK.js} +2 -2
- package/_assets/{index-BlorBoCd.js → index-CFjvSI9V.js} +2 -2
- package/_assets/{index-BPinodm9.js → index-CHOXNIZU.js} +2 -2
- package/_assets/{index-DJXUib_8.js → index-CKJbILwX.js} +2 -2
- package/_assets/{index-CWThS2BY.js → index-CQcYIbmA.js} +2 -2
- package/_assets/{index-C3LVhWuY.js → index-CWW8I3cM.js} +2 -2
- package/_assets/{index-CS1VnyR1.js → index-CYODi4De.js} +2 -2
- package/_assets/{index-B2uxq6bU.js → index-CayZJ1KW.js} +2 -2
- package/_assets/{index-CtayMM8a.js → index-ChSQKVK4.js} +4 -4
- package/_assets/{index-n4qOUE64.js → index-CsF6xXM_.js} +2 -2
- package/_assets/{index-ChNIU-k1.js → index-CsfKDkju.js} +2 -2
- package/_assets/{index-CY38y8q8.js → index-CtCVPVKq.js} +2 -2
- package/_assets/{index-DejzmYQv.js → index-Cy3Oonq3.js} +2 -2
- package/_assets/{index-CATjpM0W.js → index-D28ZG5tn.js} +2 -2
- package/_assets/{index-B0OkSRGZ.js → index-D3CuF5hF.js} +2 -2
- package/_assets/{index-DCE7JXu8.js → index-D4zFooZK.js} +2 -2
- package/_assets/{index-CmcvBNcU.js → index-D9RX6H64.js} +2 -2
- package/_assets/{index-Dn8vBHwo.js → index-DAjo0IeM.js} +2 -2
- package/_assets/{index-CFGlj3ri.js → index-DDcGOvgn.js} +2 -2
- package/_assets/{index-CGdQ1CYx.js → index-DIHPQBX2.js} +3 -3
- package/_assets/{index-B1wSCmue.js → index-DNyHNZwr.js} +2 -2
- package/_assets/{index-2aK4zhJE.js → index-DOAfbRmZ.js} +2 -2
- package/_assets/{index-DGUzkX-I.js → index-DQpwRCf7.js} +2 -2
- package/_assets/{index-CUa90VgH.js → index-DSycTKsm.js} +2 -2
- package/_assets/{index-Cst1nEOO.js → index-DbcMBgHZ.js} +2 -2
- package/_assets/{index-B3Ji4DRo.js → index-DcxgoxVS.js} +2 -2
- package/_assets/{index-zkaZwO7E.js → index-DfGK8WsI.js} +2 -2
- package/_assets/{index-MZXf7D1W.js → index-DjtZc-pt.js} +2 -2
- package/_assets/{index-nQ3hptXe.js → index-Dpn1ciOW.js} +2 -2
- package/_assets/{index-BDJuqgxU.js → index-Dqje5rD7.js} +2 -2
- package/_assets/{index-CmcTFc5W.js → index-Dzfu0CWL.js} +4 -4
- package/_assets/{index-BHbHN01N.js → index-FFpfUhvw.js} +2 -2
- package/_assets/{index-CbMw0H1W.js → index-I_d93jfN.js} +3 -3
- package/_assets/{index-ficvqfHi.js → index-KKcoIzB6.js} +2 -2
- package/_assets/{index-BJA_2Ynv.js → index-Kxc39maL.js} +2 -2
- package/_assets/{index-BACBbqlk.js → index-OnthK0Vi.js} +2 -2
- package/_assets/{index-DLKAGp7r.js → index-Y3Y-bbNA.js} +2 -2
- package/_assets/{index-bJXcZSYa.js → index-aVZCrQgK.js} +152 -123
- package/_assets/{index-gAex9EE8.js → index-pycwlDzM.js} +2 -2
- package/_assets/{index-G5AacsmF.js → index-qqle_e-t.js} +2 -2
- package/_assets/{index-ARGrbe3A.js → index-y36xxLzP.js} +3 -3
- package/_assets/{index-BWEvNyOP.js → index-z6_sFHO_.js} +2 -2
- package/_assets/{index.es-4xrWWZcO.js → index.es--QATjUsF.js} +2 -2
- package/_assets/{index.es-DYbPPtM5.js → index.es-ByQSPL6O.js} +2 -2
- package/_assets/{index.es-CstVHWlV.js → index.es-G4zCLjwI.js} +5 -5
- package/_assets/{index.es-DzLQ6Fnb.js → index.es-rjHK-XCJ.js} +2 -2
- package/_assets/items-empty-cgLqKc9S.js +2 -0
- package/_assets/{jump-CVtY0iTz.js → jump-5JL_cP03.js} +2 -2
- package/_assets/{linkAccount-6NTQv8aT.js → linkAccount-CETMoRWS.js} +2 -2
- package/_assets/{localBatchGatewayRequest-Dks7VfkN.js → localBatchGatewayRequest-CgHNgytM.js} +2 -2
- package/_assets/{native-CXAGKkI7.js → native-vpRrA4Cn.js} +2 -2
- package/_assets/{networks-DtT18tMT.js → networks-cWf4ZboA.js} +2 -2
- package/_assets/{onramp-CUVL5AKN.js → onramp-DgsjYxjT.js} +2 -2
- package/_assets/{openzeppelin-C6HmSX5F.js → openzeppelin-DNp3wLOb.js} +2 -2
- package/_assets/{ownerOf-iHeO-A0L.js → ownerOf-1LYSCOJn.js} +2 -2
- package/_assets/{parseNft-_qkiBgGY.js → parseNft-BcxHCtSx.js} +3 -3
- package/_assets/{parseSignature-DCX2Homx.js → parseSignature-D_DzESq3.js} +4 -4
- package/_assets/{parseSignature-DpYJxwtD.js → parseSignature-ePfokuCi.js} +2 -2
- package/_assets/{passkeys-CaDDwDfa.js → passkeys-DJo48zPj.js} +2 -2
- package/_assets/{pay-with-exchange-mjjMFDoB.js → pay-with-exchange-fixKZ9cy.js} +2 -2
- package/_assets/{prepare-contract-call-B3PEXjk8.js → prepare-contract-call-BdgAhwyh.js} +2 -2
- package/_assets/{qr-overlay-Dte-FwLF.js → qr-overlay-D-9ykAbc.js} +4 -4
- package/_assets/{react-Io5Wove7.js → react-BY3vVwvc.js} +2 -2
- package/_assets/{receive-BOylnCCD.js → receive-CfqOxXtt.js} +2 -2
- package/_assets/{resolveImplementation-eqKe_Jd_.js → resolveImplementation-CMOZuCS0.js} +2 -2
- package/_assets/{resume-buy-l-MsHDN-.js → resume-buy-C08YaHUW.js} +2 -2
- package/_assets/{rpc-Bd3ag8E4.js → rpc-VPqDooml.js} +2 -2
- package/_assets/{sales-empty-71lDTBeo.js → sales-empty-CiZXbQ-u.js} +2 -2
- package/_assets/{search-empty-C2pIWVz4.js → search-empty-CjwjsYp3.js} +2 -2
- package/_assets/{secp256k1-BCTY01q6.js → secp256k1-BjzlNiqc.js} +2 -2
- package/_assets/{secp256k1-D89skxyt.js → secp256k1-Bqz600sq.js} +2 -2
- package/_assets/{secp256k1-ChjjZr2n.js → secp256k1-DsYYocSz.js} +2 -2
- package/_assets/{send-BoRH3tdn.js → send-OqWYJzei.js} +2 -2
- package/_assets/{send-batch-transaction-qs3ijcbz.js → send-batch-transaction-DxplOsBV.js} +2 -2
- package/_assets/{send-eip712-transaction-BLU365vg.js → send-eip712-transaction-DLUlA6U2.js} +3 -3
- package/_assets/{send-gasless-transaction-COE6PePF.js → send-gasless-transaction-TcSr0Wcm.js} +3 -3
- package/_assets/{send-transaction-DWia223-.js → send-transaction-CCxtzvcs.js} +3 -3
- package/_assets/{sendMetaTransaction-Bnb1e1Oo.js → sendMetaTransaction-BojzaFVf.js} +2 -2
- package/_assets/{sendRawTransaction-QUpRtv1T.js → sendRawTransaction-Bb_nKhdW.js} +4 -4
- package/_assets/{sentry-faeuEJiQ.js → sentry-DTXXLFvs.js} +3 -3
- package/_assets/{serializeTransaction-Bzap5VIj.js → serializeTransaction-9MYeYe7S.js} +2 -2
- package/_assets/{session-proposal-BRPQA6_F.js → session-proposal-CPMewqWU.js} +2 -2
- package/_assets/{session-request-DE3BfIwL.js → session-request-qY4rCbGM.js} +3 -3
- package/_assets/{sha256-my9t8oLg.js → sha256-DiEOOsO8.js} +2 -2
- package/_assets/{signing-BKRnKKdl.js → signing-Be6vrTAY.js} +4 -4
- package/_assets/{skeleton.styles-Cjpy58bn.js → skeleton.styles-3JcIR00U.js} +2 -2
- package/_assets/{socials-CHs46oCs.js → socials-CG-rf6ye.js} +2 -2
- package/_assets/{styled-3e6FPpFM.js → styled-VFTp7jt7.js} +2 -2
- package/_assets/{swaps-BQAfj8hR.js → swaps-Cva-BDUb.js} +2 -2
- package/_assets/{thirdweb-I3ycy-sq.js → thirdweb-Zfbo-V64.js} +4 -4
- package/_assets/{to-serializable-transaction-D4JXNF6K.js → to-serializable-transaction-DNoF4797.js} +3 -3
- package/_assets/{totalSupply-RRjcgrsd.js → totalSupply-CQfJBYH9.js} +2 -2
- package/_assets/{transaction-CpNDZT6H.js → transaction-CX2qr19N.js} +2 -2
- package/_assets/{transactionReceipt-BsGymDgp.js → transactionReceipt-NOc_gzSn.js} +2 -2
- package/_assets/{transactions-ZyGjrTz1.js → transactions-ByOmVv0V.js} +2 -2
- package/_assets/{useCreditPacks-RKaHRtDl.js → useCreditPacks-6QkfHH0T.js} +2 -2
- package/_assets/{useInfiniteGrid-CKUOL3of.js → useInfiniteGrid-B1PlvGpx.js} +2 -2
- package/_assets/{useStore-zwLaMv5E.js → useStore-C8GZa7as.js} +3 -3
- package/_assets/{useTheme-6lXtg_We.js → useTheme-B9wRZIaP.js} +2 -2
- package/_assets/{utils-DmCacC3Z.js → utils-Bi-qMQUk.js} +2 -2
- package/_assets/{verifyHash-BnLy1LQ8.js → verifyHash-DDixZPU8.js} +2 -2
- package/_assets/{w3m-modal-CqeYEpsp.js → w3m-modal-B9dFmjTc.js} +2 -2
- package/_assets/{w3m-modal-igkHA2Yg.js → w3m-modal-DIyfW9yy.js} +2 -2
- package/_assets/{wait-for-tx-receipt-BBZ5JG62.js → wait-for-tx-receipt-D7fvkTOZ.js} +2 -2
- package/_assets/{wallets-BUa02PiV.js → wallets-CArhlSUA.js} +6 -6
- package/_assets/{web-connector-C7j-Aqf_.js → web-connector-BvNhhIkF.js} +4 -4
- package/_assets/{writeContract-DUS_4K4j.js → writeContract-y8T-A4Sn.js} +2 -2
- package/_assets/{zora-sepolia-CDPQd0aL.js → zora-sepolia-CTDvR1LG.js} +2 -2
- package/_assets/{zoraTestnet-DzzH_a_k.js → zoraTestnet-SPU8ZmJ1.js} +2 -2
- package/index.html +11 -11
- package/package.json +2 -2
- package/_assets/collectionPage.styles-DUDsxvQH.js +0 -40
- package/_assets/items-empty-CpzVwMne.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as u,L as W,d as re,j as e}from"./react-
|
|
1
|
+
import{r as u,L as W,d as re,j as e}from"./react-BY3vVwvc.js";import{Z as H,l as U,$ as le,a0 as de,a1 as ce,a2 as he,t as pe,s as i,I as L,a3 as ue,a4 as me,B as F,a5 as xe,o as V,a6 as ge,n as fe,b as n,a7 as G,a8 as N,a9 as be,aa as ye,ab as ve,ac as je,ad as we,ae as $e,af as ke,ag as Ie,ah as Ce,ai as Ee,aj as ze,ak as Le,al as Fe,am as We,an as Se,q as A,ao as O,ap as Ae,aq as Oe,ar as Te,as as Pe,at as Re,au as Ne}from"./index-aVZCrQgK.js";import{d as B}from"./dcl-schemas-DhyZEUTb.js";import{E as Q}from"./ErrorNotice-4SblVCJ8.js";import{E as Be}from"./EmotePlaybackBar-Cfp2UVtr.js";import{O as Me}from"./OutfitPreview-Dwy7hPo7.js";import"./sentry-DTXXLFvs.js";import"./ethers-ByWI-eMv.js";import"./intl-AKLEHPeO.js";import"./disposePreview-BCeOgBsa.js";(function(){try{var t=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},s=new t.Error().stack;s&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[s]="f06a8be4-4119-4a68-9e7f-b9ea8f87f9c7",t._sentryDebugIdIdentifier="sentry-dbid-f06a8be4-4119-4a68-9e7f-b9ea8f87f9c7")}catch{}})();function qe({address:t,outfitUrns:s,enabled:l=!0}){var b;const{data:r,isFetched:d}=H(t),m=((b=r==null?void 0:r.avatar)==null?void 0:b.wearables)??[],x=!!t&&!!r,p=m.join(","),c=l&&x&&m.length>0,{data:y,isLoading:v,isFetched:j}=U({queryKey:["wearable-rules",p],enabled:c,staleTime:30*6e4,retry:!1,queryFn:()=>he(m)}),k=s.join(",");return u.useMemo(()=>{const I=!!t&&!d||v||c&&!j;return x?{profile:"default",bodyShape:ce(r)??void 0,urns:[...de(y??[]),...s],...le(r),isLoading:I}:{profile:"default",urns:s,isLoading:I}},[t,x,r,d,y,v,j,c,k])}const{colors:o,radius:$,media:h,gradients:_e}=pe,Z=i.div`
|
|
2
2
|
max-width: 1721px;
|
|
3
3
|
margin: 0 auto;
|
|
4
4
|
/* The page's bottom padding is 56px, but the phone CTA bar is sticky and has its own bottom padding for the safe area.
|
|
@@ -365,4 +365,4 @@ import{r as u,L as W,d as re,j as e}from"./react-Io5Wove7.js";import{Z as H,l as
|
|
|
365
365
|
margin: 0;
|
|
366
366
|
color: ${o.gray4};
|
|
367
367
|
`,K="outfit-detail-preview";function Et(){const{id:t}=re(),s=V(c=>c.session),l=ge(),r=l==="creator",{data:d,isError:m,refetch:x}=U({queryKey:["outfit",t,r],enabled:N()&&!!t,staleTime:6e4,queryFn:()=>Ne(t,r&&s?s.identity:void 0)}),p=!N()||!t||d===null&&l!=="pending";return fe(p?{title:n("seo.outfit.notFoundTitle"),noindex:!0}:d?{title:d.name,image:G(d.thumbnailHash)??void 0}:{}),p?e.jsxs(D,{"data-testid":"outfit-notfound",children:[e.jsx(ht,{name:"cart",size:44}),e.jsx(pt,{children:n("outfits.detail.notFoundTitle")}),e.jsx(ut,{children:n("outfits.detail.notFoundBody")}),e.jsx(F,{as:W,to:"/items",variant:"purple",children:n("notFound.cta")})]}):m?e.jsxs(D,{"data-testid":"outfit-detail-error",children:[e.jsx(Q,{message:n("outfits.errors.generic")}),e.jsx(F,{variant:"purple",onClick:()=>void x(),children:n("outfits.detail.retry")})]}):d?e.jsx(xt,{outfit:d}):e.jsx(Z,{"aria-busy":"true","data-testid":"outfit-detail-loading",children:e.jsxs(J,{children:[e.jsx(X,{children:e.jsx("span",{className:"skeleton",style:{position:"absolute",inset:0},"aria-hidden":!0})}),e.jsxs(Y,{children:[e.jsx("span",{className:"skeleton",style:{width:"60%",height:32},"aria-hidden":!0}),e.jsx("span",{className:"skeleton",style:{width:"40%",height:16},"aria-hidden":!0}),e.jsx("span",{className:"skeleton",style:{width:"100%",height:48},"aria-hidden":!0})]})]})})}function mt({item:t}){const s=Ae(t),l=Oe(t.gender);return e.jsxs(it,{children:[t.rarity?e.jsx(z,{"data-variant":"rarity",style:{background:Re(t.rarity)},title:Pe(t.rarity),children:Te(t.rarity)}):null,t.isSmart?e.jsxs(z,{"data-variant":"smart",children:[e.jsx(L,{name:"smart",size:13}),n("assetCard.smart")]}):null,s?e.jsx(z,{"data-variant":"icon",children:e.jsx(L,{name:s})}):null,l?e.jsx(z,{"data-variant":"icon",children:e.jsx(L,{name:l})}):null]})}function xt({outfit:t}){const s=be(t),{split:l,availableCount:r,totalCredits:d,outfitCredits:m,addOutfit:x,isAdding:p}=ye(t,s),c=V(a=>{var w;return(w=a.session)==null?void 0:w.address}),y=ve(a=>a.items),v=u.useMemo(()=>new Set(y.map(je)),[y]),j=G(t.thumbnailHash),k=u.useRef(null);u.useEffect(()=>{k.current!==t.id&&(k.current=t.id,we("Shop Outfit Viewed",{outfit_id:t.id,item_count:t.items.length}))},[t.id,t.items.length]);const b=u.useMemo(()=>t.items.map(a=>{const w=$e(a),S=s.byKey.get(w)??null;return{key:w,item:S,state:S?ke(S,{address:c,cartKeys:v}):"missing"}}),[t,s.byKey,c,v]),{isFetched:I}=H(c),ee=!c||I,te=t.bodyShape==="female"?Ie:t.bodyShape==="male"?Ce:void 0,g=u.useMemo(()=>b.map(a=>a.item).filter(a=>!!a),[b]),P=u.useMemo(()=>Ee(g),[g]),ie=u.useMemo(()=>ze(g),[g]),R=u.useMemo(()=>{const a=Le(g);return a?Fe(a):null},[g]),ae=R??B.PreviewEmote.FASHION,se=!!R,f=qe({address:c,outfitUrns:P}),ne=t.items.length,oe=!s.isLoading&&!s.isError,C=l.purchasable.length;return e.jsxs(Z,{"data-testid":"outfit-detail",children:[e.jsxs(De,{"aria-label":n("outfits.detail.breadcrumbAria"),children:[e.jsx(M,{to:"/overview",children:n("nav.overview")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(M,{to:"/overview",children:n("outfits.detail.breadcrumbLooks")}),e.jsx("span",{"aria-hidden":!0,children:">"}),e.jsx(Ke,{children:t.name})]}),e.jsxs(J,{children:[e.jsx(X,{"data-testid":"outfit-detail-preview",style:{background:We(t)},children:j&&!s.isLoading&&P.length===0?e.jsx(He,{src:j,alt:t.name}):e.jsx(Me,{id:K,profile:f.profile,bodyShape:ie??f.bodyShape??te,urns:f.urns,emote:ae,unityMode:B.PreviewUnityMode.BUILDER,skin:f.skin,hair:f.hair,eyes:f.eyes,enabled:ee&&!f.isLoading&&!s.isLoading,controls:se?e.jsx(Be,{previewId:K,testId:"outfit-emote-controls"}):null})}),e.jsxs(Y,{children:[e.jsx(Ue,{children:t.name}),e.jsx(Ve,{"data-testid":"outfit-detail-meta",children:n("outfits.detail.itemsCount",{count:ne})}),s.isError?e.jsxs(st,{children:[e.jsx(Q,{message:n("outfits.detail.resolveError"),testId:"outfit-detail-resolve-error"}),e.jsx(F,{variant:"outline","data-testid":"outfit-detail-retry",onClick:s.retry,children:n("outfits.detail.retry")})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ge,{children:e.jsx(Qe,{children:b.map(a=>e.jsx(Ze,{"data-testid":"outfit-detail-item","data-state":a.state,children:a.item?e.jsxs(e.Fragment,{children:[e.jsx(Je,{to:`/item/${a.item.contractAddress}/${a.item.itemId}`,state:{item:a.item},"aria-label":a.item.name}),e.jsx(Xe,{src:a.item.thumbnail,alt:"",loading:"lazy"}),e.jsxs(q,{children:[e.jsx(T,{children:a.item.name}),a.item.creator?e.jsx(et,{to:`/items/creator/${a.item.creator}`,children:e.jsx(Se,{address:a.item.creator})}):null,e.jsxs(_,{children:[a.state!=="unavailable"?e.jsxs(tt,{children:[e.jsx(A,{size:15}),e.jsx(O,{credits:a.item.priceCredits})]}):null,a.state==="unavailable"?e.jsx(E,{children:n("outfits.card.unavailable")}):a.state==="own_listing"?e.jsx(E,{children:n("outfits.detail.yourListing")}):a.state==="in_cart"?e.jsx(E,{children:n("outfits.detail.inCart")}):null,e.jsx(mt,{item:a.item})]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ye,{className:s.isLoading?"skeleton":void 0,"aria-hidden":!0}),e.jsx(q,{children:s.isLoading?e.jsx(T,{children:e.jsx("span",{className:"skeleton",style:{display:"block",width:"70%",height:14}})}):e.jsxs(e.Fragment,{children:[e.jsx(T,{children:n("outfits.card.unavailable")}),e.jsx(_,{children:e.jsx(E,{children:n("outfits.card.unavailable")})})]})})]})},a.key))})}),e.jsxs(nt,{"data-testid":"outfit-detail-ctabar",children:[oe&&l.ownListing.length>0?e.jsx(at,{children:n("outfits.detail.yourListingHint")}):null,g.length>0&&e.jsxs(ot,{children:[e.jsx(rt,{children:n("outfits.detail.totalPrice")}),s.isLoading?e.jsx("span",{className:"skeleton",style:{width:64,height:26},"aria-hidden":!0}):e.jsxs(lt,{children:[e.jsx(A,{size:22}),e.jsx(O,{credits:m})]})]}),s.isLoading?e.jsx("span",{className:"skeleton",style:{width:"100%",height:52,borderRadius:26},"aria-hidden":!0}):e.jsxs(dt,{variant:"purple","data-testid":"outfit-detail-cta",onClick:x,disabled:p||C===0,"aria-busy":p||void 0,children:[p?n("outfits.card.adding"):C>0?n("outfits.detail.addCount",{count:C}):r>0?n("outfits.detail.nothingToAdd"):n("outfits.card.unavailable"),!p&&C>0?e.jsxs(ct,{children:[e.jsx(A,{size:16}),e.jsx(O,{credits:d})]}):null]})]})]})]})]})]})}export{Et as OutfitDetail,Et as default};
|
|
368
|
-
//# sourceMappingURL=OutfitDetail-
|
|
368
|
+
//# sourceMappingURL=OutfitDetail-BjKXVLQi.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{r as c,j as f}from"./react-
|
|
1
|
+
import{r as c,j as f}from"./react-BY3vVwvc.js";import{d as m}from"./dcl-schemas-DhyZEUTb.js";import{a_ as S,l as _,s as T,ab as q,a$ as M,b0 as U,b1 as W,b as $}from"./index-aVZCrQgK.js";import{d as k}from"./disposePreview-BCeOgBsa.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},n=new e.Error().stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="9b0fb41f-1605-4ee5-8583-0a2e945823c2",e._sentryDebugIdIdentifier="sentry-dbid-9b0fb41f-1605-4ee5-8583-0a2e945823c2")}catch{}})();function h(e){return e.startsWith("urn:")}function C(e,n){var o,d;const s=(o=e.metadata)==null?void 0:o.emoteDataADR74;if(!((d=s==null?void 0:s.representations)!=null&&d.length))return null;const a=new Map((e.content??[]).map(r=>[r.file,r.hash])),t=s.representations.map(r=>({...r,contents:(r.contents??[]).filter(l=>a.has(l)).map(l=>({key:l,url:`${n}/content/contents/${a.get(l)}`}))}));return t.every(r=>r.contents.length===0)?null:{base64:H({...e.metadata,emoteDataADR74:{...s,representations:t}}),loop:!!s.loop}}function H(e){return btoa(JSON.stringify(e).replace(/[^\x20-\x7f]/g,""))}async function J(e,n=S([e]),s){var a;try{const t=await fetch(`${n}/content/entities/active`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({pointers:[e]}),signal:s});if(!t.ok)return await((a=t.body)==null?void 0:a.cancel()),null;const[o]=await t.json();return o?C(o,n):null}catch{return null}}function K(e){var s,a;const n=_({queryKey:["emote-base64",e],enabled:!!e,staleTime:18e5,retry:!1,queryFn:({signal:t})=>J(e,void 0,t)});return{base64:((s=n.data)==null?void 0:s.base64)??null,loop:((a=n.data)==null?void 0:a.loop)??!1,isLoading:n.isLoading}}const Q=T.div`
|
|
2
2
|
position: absolute;
|
|
3
3
|
inset: 0;
|
|
4
4
|
display: grid;
|
|
5
5
|
place-items: center;
|
|
6
6
|
`;function X({id:e,profile:n,bodyShape:s,urns:a,emote:t=m.PreviewEmote.FASHION,enabled:o=!0,skin:d,hair:r,eyes:l,unityMode:E=m.PreviewUnityMode.BUILDER,controls:x,onRenderer:I}){const A=q(u=>u.fittingOpen),{ref:j,active:D}=M(),g=t&&h(t)?t:null,{base64:p,loop:O,isLoading:R}=K(g),i=o&&a.length>0&&D&&!A&&!R,B=U(a)===m.ChainName.MATIC_AMOY,[L,b]=c.useState(!1),P=a.join(",");c.useEffect(()=>{b(!1)},[P,n,s,t,d,r,l]),c.useEffect(()=>{i&&b(!1)},[i]);const[F,v]=c.useState(!1);c.useEffect(()=>{if(!i){v(!1);return}let u=0,N=0;const w=()=>{document.getElementById(e)?v(!0):N++<300&&(u=requestAnimationFrame(w))};return w(),()=>cancelAnimationFrame(u)},[i,e]);const y=c.useRef(null);return c.useEffect(()=>{if(i)return()=>{k(y.current),y.current=null}},[i]),f.jsxs(f.Fragment,{children:[f.jsx("div",{ref:j,"data-preview-viewport":!0,"aria-hidden":!0}),i?f.jsx(W,{id:e,profile:n,bodyShape:s,urns:a,skin:d,hair:r,eyes:l,type:m.PreviewType.AVATAR,emote:g?void 0:t&&!h(t)?t:void 0,base64s:p?[p]:void 0,disableDefaultEmotes:!!p&&!O,unityMode:E,disableBackground:!0,disableFadeEffect:!0,dev:B,onRenderer:I,onLoad:()=>{var u;b(!0),y.current=((u=document.getElementById(e))==null?void 0:u.contentWindow)??null}},n):null,F?x:null,o&&a.length===0?null:!i||!L?f.jsx(Q,{"aria-busy":"true","aria-label":$("spinner.loading"),children:f.jsx("span",{className:"spinner","aria-hidden":!0})}):null]})}export{X as O};
|
|
7
|
-
//# sourceMappingURL=OutfitPreview-
|
|
7
|
+
//# sourceMappingURL=OutfitPreview-Dwy7hPo7.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as d,j as t,L as F,d as Xt,a as Yt,b as Zt}from"./react-
|
|
1
|
+
import{r as d,j as t,L as F,d as Xt,a as Yt,b as Zt}from"./react-BY3vVwvc.js";import{s,t as ut,I as _,aI as te,b as e,q as ot,ao as at,B as x,A as Ct,o as X,a6 as ee,n as ie,r as Et,l as Lt,a9 as se,ae as z,aJ as V,aK as oe,aL as ae,aM as J,ai as re,ak as ne,ag as de,ah as le,a7 as Rt,am as ue,aN as rt,aO as ce,aP as pe,aQ as fe,w as N,aR as zt,aS as Pt,aT as A,h as nt,aU as dt,aV as he,aW as xe,aX as me,ad as ge,aY as be,aZ as ye,au as je}from"./index-aVZCrQgK.js";import{E as U}from"./ErrorNotice-4SblVCJ8.js";import{L as ve}from"./LoadMore-BaRjyF39.js";import{u as we}from"./useInfiniteGrid-B1PlvGpx.js";import{O as $e}from"./OutfitPreview-Dwy7hPo7.js";import{T as ke}from"./skeleton.styles-3JcIR00U.js";import"./dcl-schemas-DhyZEUTb.js";import"./sentry-DTXXLFvs.js";import"./ethers-ByWI-eMv.js";import"./intl-AKLEHPeO.js";import"./disposePreview-BCeOgBsa.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},f=new r.Error().stack;f&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[f]="6b13f580-a4f4-4796-826f-638e974a9c34",r._sentryDebugIdIdentifier="sentry-dbid-6b13f580-a4f4-4796-826f-638e974a9c34")}catch{}})();const{colors:m,radius:Y,media:Se}=ut,Ie=s.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 12px;
|
|
@@ -554,4 +554,4 @@ import{r as d,j as t,L as F,d as Xt,a as Yt,b as Zt}from"./react-Io5Wove7.js";im
|
|
|
554
554
|
flex-wrap: wrap;
|
|
555
555
|
gap: 10px;
|
|
556
556
|
`;function Ki(){const{id:r}=Xt(),{pathname:f}=Yt(),h=X(b=>b.session),c=X(b=>b.signIn),y=ee();ie({title:e("outfits.studio.title"),noindex:!0});const j=f.endsWith("/new")?"new":r?"edit":"list";return y==="pending"?t.jsx(O,{"aria-busy":"true","data-testid":"outfit-studio-loading",children:t.jsx("span",{className:"spinner","aria-hidden":!0})}):h?y!=="creator"?t.jsxs(O,{"data-testid":"outfit-studio-unavailable",children:[t.jsx(kt,{children:e("outfits.studio.title")}),t.jsx(w,{children:e("outfits.studio.notAvailable")}),t.jsx(x,{as:F,to:"/overview",variant:"white",children:e("outfits.studio.backToShop")})]}):j==="list"?t.jsx(Ei,{}):t.jsx(zi,{outfitId:j==="edit"?r:null},r??"new"):t.jsxs(O,{"data-testid":"outfit-studio-signin",children:[t.jsx(kt,{children:e("outfits.studio.title")}),t.jsx(w,{children:e("outfits.studio.signInPrompt")}),t.jsx(x,{variant:"white",onClick:()=>c(),children:e("outfits.studio.signIn")})]})}function Ci({outfit:r}){const f=Rt(r.thumbnailHash);return f?t.jsx(He,{style:{background:pe(r)},children:t.jsx("img",{src:f,alt:"",loading:"lazy"})}):t.jsx(Ue,{"aria-hidden":!0})}function Ei(){const r=X(u=>u.session),f=Et(),[h,c]=d.useState(null),[y,j]=d.useState(null),{data:b=[],isLoading:o,isError:R,refetch:T}=Lt({queryKey:["outfits-all"],enabled:!!r,staleTime:3e4,queryFn:()=>ye(r.identity)});async function C(u,S){if(r){j(u.id);try{S==="delete"?(await fe(u.id,r.identity),N.success(e("outfits.studio.deleted"))):(await zt({...lt(u),published:!1},r.identity,"update"),N.success(e("outfits.studio.unpublished"))),Pt(f)}catch(E){E instanceof A||nt(E,{flow:`outfit-${S}`}),N.error(e(E instanceof A?dt(E.code):"outfits.errors.generic"))}finally{j(null),c(null)}}}return t.jsxs(Wt,{"data-testid":"outfit-studio-list",children:[t.jsxs(Ot,{children:[t.jsx(At,{children:e("outfits.studio.myOutfits")}),t.jsx(x,{as:F,to:"/outfits/new",variant:"white","data-testid":"outfit-studio-new",children:e("outfits.studio.new")})]}),o?t.jsx(St,{"aria-busy":"true",children:Array.from({length:3},(u,S)=>t.jsx(Be,{className:"skeleton","aria-hidden":!0},S))}):R?t.jsxs(O,{children:[t.jsx(U,{message:e("outfits.errors.generic")}),t.jsx(x,{variant:"white",onClick:()=>void T(),children:e("outfits.detail.retry")})]}):b.length===0?t.jsx(w,{children:e("outfits.studio.empty")}):t.jsx(St,{children:b.map(u=>t.jsxs(Me,{"data-testid":"outfit-studio-row","data-published":u.published||void 0,children:[t.jsx(Ci,{outfit:u}),t.jsxs(_e,{children:[t.jsx(Ke,{children:u.name||e("outfits.studio.untitled")}),t.jsxs(Ge,{children:[t.jsx(Ft,{"data-state":u.published?"published":"draft",children:u.published?e("outfits.studio.publishedState"):e("outfits.studio.draft")}),e("outfits.card.items",{count:u.items.length})]})]}),t.jsxs(qe,{children:[u.published?t.jsx(x,{as:F,to:`/items/outfits/${u.id}`,variant:"ghost",size:"sm",children:e("outfits.studio.view")}):null,t.jsx(x,{as:F,to:`/outfits/${u.id}/edit`,variant:"outline",size:"sm","data-testid":"outfit-studio-edit",children:e("outfits.studio.edit")}),t.jsx(Qe,{type:"button","data-testid":"outfit-studio-delete","aria-label":e("outfits.studio.confirmDelete"),disabled:y===u.id,onClick:()=>c(u),children:t.jsx(_,{name:"trash",size:18})})]})]},u.id))}),h?t.jsxs(Ve,{role:"dialog","aria-modal":"true","aria-label":e("outfits.studio.deleteTitle"),"data-testid":"outfit-studio-confirm",children:[t.jsx(Je,{onClick:()=>c(null)}),t.jsxs(Xe,{children:[t.jsx(Ye,{children:e("outfits.studio.deleteTitle")}),t.jsx("p",{className:"muted",children:e("outfits.studio.deleteBody")}),t.jsxs(Ze,{children:[h.published?t.jsx(x,{variant:"purple","data-testid":"outfit-studio-confirm-unpublish",disabled:y===h.id,onClick:()=>void C(h,"unpublish"),children:e("outfits.studio.unpublish")}):null,t.jsx(x,{variant:h.published?"outline":"purple","data-testid":"outfit-studio-confirm-delete",disabled:y===h.id,onClick:()=>void C(h,"delete"),children:e("outfits.studio.confirmDelete")}),t.jsx(x,{variant:"ghost",onClick:()=>c(null),children:e("outfits.studio.cancel")})]})]})]}):null]})}const Tt=["image/png","image/jpeg","image/webp"];function Li(){return{id:crypto.randomUUID(),name:"",thumbnailHash:"",items:[],bodyShape:"unisex",gradientFrom:rt.from,gradientTo:rt.to,published:!1}}function lt(r){return{id:r.id,name:r.name,thumbnailHash:r.thumbnailHash,items:r.items,bodyShape:r.bodyShape,gradientFrom:r.gradientFrom,gradientTo:r.gradientTo,published:r.published}}function Ri(r){try{const f=sessionStorage.getItem(r);return f?JSON.parse(f):null}catch{return null}}function zi({outfitId:r}){const f=r===null,h=`outfit-draft:${r??"new"}`,c=X(i=>i.session),y=Et(),j=Zt(),[b]=d.useState(()=>Ri(h)),[o,R]=d.useState(()=>b??(f?Li():null)),[T,C]=d.useState(!!b),{data:u,isLoading:S,isError:E,refetch:Z}=Lt({queryKey:["outfit",r,!0],enabled:!f&&!!c,staleTime:0,queryFn:()=>je(r,c.identity)});d.useEffect(()=>{u&&R(i=>i??lt(u))},[u]);function k(i){R(a=>a&&{...a,...i}),C(!0)}d.useEffect(()=>{if(!(!o||!T))try{sessionStorage.setItem(h,JSON.stringify(o))}catch{}},[o,T,h]),d.useEffect(()=>{if(!T)return;const i=a=>a.preventDefault();return window.addEventListener("beforeunload",i),()=>window.removeEventListener("beforeunload",i)},[T]),d.useEffect(()=>()=>sessionStorage.removeItem(h),[h]);const g=se(o??void 0),K=d.useMemo(()=>new Set(((o==null?void 0:o.items)??[]).map(z)),[o]),B=i=>be((o==null?void 0:o.items)??[],i,g.byKey),l=i=>!!i.itemId&&B(i).length<=J;function v(i){!o||!l(i)||k({items:B(i)})}const[M,ct]=d.useState(null),L=d.useRef(null),tt=d.useRef(!0);d.useEffect(()=>(tt.current=!0,()=>{tt.current=!1}),[]);const[G,pt]=d.useState(!1),[Bt,q]=d.useState(null),[et,ft]=d.useState(""),[Mt,ht]=d.useState(null),[I,Ht]=d.useState();d.useEffect(()=>()=>{L.current&&URL.revokeObjectURL(L.current)},[]);function xt(){const i=me(et);if(!i){ht(e("outfits.studio.importError"));return}ht(null),ft(""),Ht(i.colors),k({items:i.items,...i.bodyShape?{bodyShape:i.bodyShape}:{}}),N.success(e("outfits.studio.importSuccess",{count:i.items.length}))}async function Ut(i){if(!i||!c)return;if(q(null),!Tt.includes(i.type)){q(e("outfits.errors.unsupportedType"));return}if(i.size>he){q(e("outfits.errors.tooLarge"));return}L.current&&URL.revokeObjectURL(L.current);const a=URL.createObjectURL(i);L.current=a,ct(a),pt(!0);try{const p=await xe(i,c.identity);k({thumbnailHash:p})}catch(p){p instanceof A||nt(p,{flow:"outfit-thumbnail"}),q(e(p instanceof A?dt(p.code):"outfits.errors.generic")),L.current&&(URL.revokeObjectURL(L.current),L.current=null),ct(null)}finally{pt(!1)}}const[H,mt]=d.useState(!1),[_t,gt]=d.useState(null),it=!!o&&o.name.trim().length>0&&o.name.length<=60,Kt=!!o&&V(o.gradientFrom)&&V(o.gradientTo),bt=!!o&&o.items.some(i=>{const a=g.byKey.get(z(i));return!a||oe(a)}),yt=!!o&&it&&!!o.thumbnailHash&&Kt&&bt&&o.items.length>=ae&&o.items.length<=J;async function st(i){if(!(!c||!o||H)){mt(!0),gt(null);try{const a=await zt({...o,published:i},c.identity,f?"create":"update");if(!tt.current)return;sessionStorage.removeItem(h),R(lt(a)),C(!1),Pt(y),i&&!o.published?(ge("Shop Outfit Published",{outfit_id:a.id,item_count:a.items.length}),N.success(e("outfits.studio.publishedToast"))):N.success(e("outfits.studio.saved")),f&&(y.setQueryData(["outfit",a.id,!0],a),j(`/outfits/${a.id}/edit`,{replace:!0}))}catch(a){a instanceof A||nt(a,{flow:"outfit-save"}),gt(e(a instanceof A?dt(a.code):"outfits.errors.generic"))}finally{mt(!1)}}}const Q=d.useMemo(()=>((o==null?void 0:o.items)??[]).map(i=>g.byKey.get(z(i))).filter(i=>!!i),[o,g.byKey]),jt=d.useMemo(()=>re(Q),[Q]),Gt=d.useMemo(()=>{const i=ne(Q);return i!=null&&i.itemId?z({contractAddress:i.contractAddress,itemId:i.itemId}):null},[Q]),qt=(o==null?void 0:o.bodyShape)==="female"?de:(o==null?void 0:o.bodyShape)==="male"?le:void 0;if(!c)return null;if(!o)return E?t.jsxs(O,{children:[t.jsx(U,{message:e("outfits.errors.generic")}),t.jsx(x,{variant:"white",onClick:()=>void Z(),children:e("outfits.detail.retry")})]}):!S&&u===null?t.jsxs(O,{"data-testid":"outfit-studio-missing",children:[t.jsx(w,{children:e("outfits.errors.notFound")}),t.jsx(x,{as:F,to:"/outfits/manage",variant:"white",children:e("outfits.studio.myOutfits")})]}):t.jsx(O,{"aria-busy":"true",children:t.jsx("span",{className:"spinner","aria-hidden":!0})});const vt=M??Rt(o.thumbnailHash),Qt={...o,authorAddress:(c==null?void 0:c.address)??"",createdAt:0,updatedAt:0},Vt=o.items.reduce((i,a)=>{var p;return i+(((p=g.byKey.get(z(a)))==null?void 0:p.priceCredits)??0)},0);return t.jsxs(Wt,{"data-testid":"outfit-studio-editor",children:[t.jsxs(Ot,{children:[t.jsx(De,{to:"/outfits/manage","aria-label":e("outfits.studio.myOutfits"),"data-testid":"outfit-studio-back",children:t.jsx(_,{name:"arrow-left",size:18})}),t.jsx(At,{children:f?e("outfits.studio.new"):e("outfits.studio.editTitle")}),t.jsx(Ft,{"data-state":o.published?"published":"draft",children:o.published?e("outfits.studio.publishedState"):e("outfits.studio.draft")})]}),t.jsxs(ti,{children:[t.jsxs(ei,{children:[t.jsxs(si,{"data-testid":"outfit-studio-preview",style:{background:ue(o)},children:[t.jsx($e,{id:"outfit-studio-preview-frame",profile:"default",bodyShape:qt,urns:jt,skin:I==null?void 0:I.skin,hair:I==null?void 0:I.hair,eyes:I==null?void 0:I.eyes,enabled:!g.isLoading}),jt.length===0&&!g.isLoading?t.jsx(oi,{children:e("outfits.studio.previewEmpty")}):null]}),t.jsxs(P,{children:[t.jsx(W,{as:"span",children:e("outfits.studio.bodyShape")}),t.jsx(ai,{role:"group","aria-label":e("outfits.studio.bodyShape"),children:["unisex","male","female"].map(i=>t.jsx(ri,{type:"button","data-selected":o.bodyShape===i||void 0,onClick:()=>k({bodyShape:i}),children:e(`outfits.studio.shape.${i}`)},i))})]}),t.jsxs(P,{children:[t.jsx(W,{as:"span",children:e("outfits.studio.gradient")}),t.jsx(di,{children:["gradientFrom","gradientTo"].map(i=>t.jsxs(li,{children:[t.jsx(ui,{type:"color",value:V(o[i])?o[i]:rt.from,"aria-label":e(i==="gradientFrom"?"outfits.studio.gradientTop":"outfits.studio.gradientBottom"),"data-testid":i==="gradientFrom"?"outfit-studio-gradient-from":"outfit-studio-gradient-to",onChange:a=>k({[i]:a.target.value.toLowerCase()})}),t.jsxs(ci,{children:[t.jsx("span",{children:e(i==="gradientFrom"?"outfits.studio.gradientTop":"outfits.studio.gradientBottom")}),t.jsx(pi,{value:o[i],maxLength:7,spellCheck:!1,placeholder:"#000000","aria-label":e(i==="gradientFrom"?"outfits.studio.gradientTopHex":"outfits.studio.gradientBottomHex"),"data-invalid":!V(o[i])||void 0,onChange:a=>{const p=a.target.value.trim().toLowerCase();k({[i]:p.startsWith("#")||p===""?p:`#${p}`})}})]})]},i))}),t.jsx(w,{children:e("outfits.studio.gradientHint")})]}),t.jsxs(P,{children:[t.jsx(W,{as:"span",children:e("outfits.studio.thumbnail")}),vt?t.jsx(ni,{"data-busy":G||void 0,children:t.jsx("img",{src:vt,alt:""})}):null,t.jsxs(hi,{as:"label",variant:"outline",size:"sm","data-busy":G||void 0,children:[G?e("outfits.studio.uploading"):e("outfits.studio.upload"),t.jsx("input",{type:"file",accept:Tt.join(","),hidden:!0,disabled:G,onChange:i=>{var a;return void Ut((a=i.target.files)==null?void 0:a[0])},"data-testid":"outfit-studio-thumb-input"})]}),t.jsx(w,{children:e("outfits.studio.thumbnailHint")}),t.jsx(U,{message:Bt,testId:"outfit-studio-thumb-error"})]}),t.jsxs(P,{children:[t.jsx(W,{as:"span",children:e("outfits.studio.cardPreview")}),t.jsx(fi,{"data-testid":"outfit-studio-card-preview",onClickCapture:i=>{i.preventDefault(),i.stopPropagation()},children:t.jsx(ce,{outfit:Qt,resolution:g})})]})]}),t.jsxs(ii,{children:[t.jsxs(P,{children:[t.jsx(W,{htmlFor:"outfit-import",children:e("outfits.studio.import")}),t.jsxs(xi,{children:[t.jsx(It,{id:"outfit-import",value:et,spellCheck:!1,placeholder:e("outfits.studio.importPlaceholder"),onChange:i=>ft(i.target.value),onKeyDown:i=>{i.key==="Enter"&&xt()},"data-testid":"outfit-studio-import"}),t.jsx(x,{variant:"outline",size:"sm",onClick:xt,disabled:et.trim()==="","data-testid":"outfit-studio-import-apply",children:e("outfits.studio.importApply")})]}),t.jsx(w,{children:e("outfits.studio.importHint")}),t.jsx(U,{message:Mt,testId:"outfit-studio-import-error"})]}),t.jsxs(P,{children:[t.jsx(W,{htmlFor:"outfit-name",children:e("outfits.studio.name")}),t.jsx(It,{id:"outfit-name",value:o.name,maxLength:60,placeholder:e("outfits.studio.namePlaceholder"),onChange:i=>k({name:i.target.value}),"data-testid":"outfit-studio-name"})]}),t.jsxs(P,{children:[t.jsxs(W,{as:"span",children:[e("outfits.studio.items")," (",o.items.length,"/",J,")"]}),o.items.length===0?t.jsx(w,{children:e("outfits.studio.noItems")}):t.jsx(mi,{children:o.items.map(i=>{const a=z(i),p=g.byKey.get(a);return t.jsxs(gi,{"data-testid":"outfit-studio-selected","data-missing":!p||void 0,children:[p?t.jsx(bi,{src:p.thumbnail,alt:""}):t.jsx(yi,{className:g.isLoading?"skeleton":void 0,"aria-hidden":!0}),t.jsx(ji,{className:p?void 0:"muted",children:p?p.name:g.isLoading?t.jsx(ke,{className:"skeleton",width:96,"aria-hidden":!0}):e("outfits.card.unavailable")}),a===Gt?t.jsx(vi,{"data-testid":"outfit-studio-plays-in-preview",children:e("outfits.studio.playsInPreview")}):null,p?t.jsxs(wi,{children:[t.jsx(ot,{size:12}),t.jsx(at,{credits:p.priceCredits})]}):null,t.jsx(Si,{type:"button","aria-label":e("outfits.studio.remove"),title:e("outfits.studio.remove"),onClick:()=>k({items:o.items.filter(Jt=>z(Jt)!==a)}),children:t.jsx(_,{name:"trash",size:16})})]},a)})}),o.items.length>0?t.jsxs($i,{"data-testid":"outfit-studio-total",children:[t.jsx("span",{children:e("outfits.detail.totalPrice")}),t.jsxs(ki,{children:[t.jsx(ot,{size:14}),t.jsx(at,{credits:Vt})]})]}):null,o.items.length>=J?t.jsx(w,{children:e("outfits.studio.maxItems")}):null]}),t.jsx(Fe,{selectedKeys:K,onPick:v,canPick:l})]})]}),t.jsxs(Ii,{"data-testid":"outfit-studio-savebar",children:[t.jsx(U,{message:_t,testId:"outfit-studio-save-error"}),it?!yt&&!o.published?t.jsx(w,{"data-testid":"outfit-studio-publish-hint",children:!bt&&o.items.length>0?e("outfits.studio.needsWearable"):e("outfits.errors.notPublishable")}):null:t.jsx(w,{children:e("outfits.studio.needName")}),t.jsxs(Ti,{children:[t.jsx(x,{variant:"outline","data-testid":"outfit-studio-save",disabled:H||!it,onClick:()=>void st(o.published),children:H?e("outfits.studio.saving"):e("outfits.studio.saveDraft")}),o.published?t.jsx(x,{variant:"white","data-testid":"outfit-studio-unpublish",disabled:H,onClick:()=>void st(!1),children:e("outfits.studio.unpublish")}):t.jsx(x,{variant:"white","data-testid":"outfit-studio-publish",disabled:H||!yt,onClick:()=>void st(!0),children:e("outfits.studio.publish")})]})]})]})}export{Ki as OutfitStudio,Ki as default};
|
|
557
|
-
//# sourceMappingURL=OutfitStudio-
|
|
557
|
+
//# sourceMappingURL=OutfitStudio-BPSa9mCN.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{j as t,L as oe,b as le,r as l}from"./react-
|
|
1
|
+
import{j as t,L as oe,b as le,r as l}from"./react-BY3vVwvc.js";import{b as n,t as S,s as r,m as ce,B as G,n as de,o as pe,r as ue,I,w as R}from"./index-aVZCrQgK.js";import{u as ge,d as me,t as he,L as xe,i as F,a as f,s as fe}from"./useStore-C8GZa7as.js";import{E as A}from"./ErrorNotice-4SblVCJ8.js";import{F as j}from"./field.styles-D1op8emw.js";import"./dcl-schemas-DhyZEUTb.js";import"./sentry-DTXXLFvs.js";import"./ethers-ByWI-eMv.js";import"./intl-AKLEHPeO.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},d=new a.Error().stack;d&&(a._sentryDebugIds=a._sentryDebugIds||{},a._sentryDebugIds[d]="1a058bad-84e5-4176-9ab2-4b81e319bab8",a._sentryDebugIdIdentifier="sentry-dbid-1a058bad-84e5-4176-9ab2-4b81e319bab8")}catch{}})();const be="https://cdn.decentraland.org/@dcl/shop/1.11.3-33155570552.commit-80e7685/_assets/template-cover-1-BETekfHg.jpeg",ve="https://cdn.decentraland.org/@dcl/shop/1.11.3-33155570552.commit-80e7685/_assets/template-cover-2-Dni9s0i_.jpeg",we=Object.assign({"../assets/creator-covers/template-cover-1.jpeg":be,"../assets/creator-covers/template-cover-2.jpeg":ve}),b=Object.entries(we).sort(([a],[d])=>a.localeCompare(d)).map(([a,d])=>({name:a.split("/").pop(),url:d})),je=ce`
|
|
2
2
|
to {
|
|
3
3
|
transform: rotate(360deg);
|
|
4
4
|
}
|
|
5
|
-
`,Se=
|
|
5
|
+
`,Se=r.div`
|
|
6
6
|
display: flex;
|
|
7
7
|
align-items: center;
|
|
8
8
|
justify-content: center;
|
|
@@ -16,7 +16,7 @@ import{j as t,L as oe,b as le,r as l}from"./react-Io5Wove7.js";import{b as n,t a
|
|
|
16
16
|
flex-direction: column;
|
|
17
17
|
text-align: center;
|
|
18
18
|
}
|
|
19
|
-
`,ke=
|
|
19
|
+
`,ke=r.span`
|
|
20
20
|
flex: none;
|
|
21
21
|
border-radius: 50%;
|
|
22
22
|
border-style: solid;
|
|
@@ -43,21 +43,21 @@ import{j as t,L as oe,b as le,r as l}from"./react-Io5Wove7.js";import{b as n,t a
|
|
|
43
43
|
@media (prefers-reduced-motion: reduce) {
|
|
44
44
|
animation-duration: 2s;
|
|
45
45
|
}
|
|
46
|
-
`,ye=
|
|
46
|
+
`,ye=r.span`
|
|
47
47
|
font-size: 14px;
|
|
48
48
|
font-weight: 600;
|
|
49
|
-
`;function $e({label:
|
|
49
|
+
`;function $e({label:a,size:d="medium",direction:v="column",className:k}){return t.jsxs(Se,{className:k,"data-testid":"spinner-box","data-direction":v,role:"status","aria-live":"polite","aria-label":a?void 0:n("spinner.loading"),children:[t.jsx(ke,{"data-testid":"spinner-box-ring","data-size":d,"aria-hidden":!0}),a?t.jsx(ye,{children:a}):null]})}const{colors:s,radius:_e,media:K}=S,Ee=r($e)`
|
|
50
50
|
display: grid;
|
|
51
51
|
place-items: center;
|
|
52
52
|
min-height: 60vh;
|
|
53
|
-
`,ze=
|
|
53
|
+
`,ze=r(G)`
|
|
54
54
|
align-self: center;
|
|
55
55
|
min-width: 200px;
|
|
56
56
|
margin-top: 8px;
|
|
57
|
-
`,Ie=
|
|
57
|
+
`,Ie=r.p`
|
|
58
58
|
margin: 0;
|
|
59
59
|
color: ${s.gray4};
|
|
60
|
-
`,M=
|
|
60
|
+
`,M=r.section`
|
|
61
61
|
max-width: 640px;
|
|
62
62
|
margin: 0 auto;
|
|
63
63
|
padding: 8px 0 48px;
|
|
@@ -88,17 +88,17 @@ import{j as t,L as oe,b as le,r as l}from"./react-Io5Wove7.js";import{b as n,t a
|
|
|
88
88
|
resize: vertical;
|
|
89
89
|
min-height: 88px;
|
|
90
90
|
}
|
|
91
|
-
`,Le=
|
|
91
|
+
`,Le=r.div`
|
|
92
92
|
display: flex;
|
|
93
93
|
align-items: baseline;
|
|
94
94
|
justify-content: space-between;
|
|
95
95
|
gap: 16px;
|
|
96
96
|
flex-wrap: wrap;
|
|
97
|
-
`,Ne=
|
|
97
|
+
`,Ne=r.div`
|
|
98
98
|
display: flex;
|
|
99
99
|
align-items: center;
|
|
100
100
|
gap: 10px;
|
|
101
|
-
`,Ce=
|
|
101
|
+
`,Ce=r(oe)`
|
|
102
102
|
display: flex;
|
|
103
103
|
align-items: center;
|
|
104
104
|
justify-content: center;
|
|
@@ -112,10 +112,10 @@ import{j as t,L as oe,b as le,r as l}from"./react-Io5Wove7.js";import{b as n,t a
|
|
|
112
112
|
width: 22px;
|
|
113
113
|
height: 22px;
|
|
114
114
|
}
|
|
115
|
-
`,O=
|
|
115
|
+
`,O=r.h1`
|
|
116
116
|
font-size: 24px;
|
|
117
117
|
font-weight: 800;
|
|
118
|
-
`,He=
|
|
118
|
+
`,He=r.a`
|
|
119
119
|
display: inline-flex;
|
|
120
120
|
align-items: center;
|
|
121
121
|
gap: 6px;
|
|
@@ -131,7 +131,7 @@ import{j as t,L as oe,b as le,r as l}from"./react-Io5Wove7.js";import{b as n,t a
|
|
|
131
131
|
width: 15px;
|
|
132
132
|
height: 15px;
|
|
133
133
|
}
|
|
134
|
-
`,Te=
|
|
134
|
+
`,Te=r.div`
|
|
135
135
|
display: flex;
|
|
136
136
|
align-items: stretch;
|
|
137
137
|
border: 1px solid ${s.lineStrong};
|
|
@@ -145,7 +145,7 @@ import{j as t,L as oe,b as le,r as l}from"./react-Io5Wove7.js";import{b as n,t a
|
|
|
145
145
|
flex: 1;
|
|
146
146
|
min-width: 0;
|
|
147
147
|
}
|
|
148
|
-
`,De=
|
|
148
|
+
`,De=r.span`
|
|
149
149
|
display: flex;
|
|
150
150
|
align-items: center;
|
|
151
151
|
padding: 0 10px;
|
|
@@ -154,7 +154,7 @@ import{j as t,L as oe,b as le,r as l}from"./react-Io5Wove7.js";import{b as n,t a
|
|
|
154
154
|
font-size: 13px;
|
|
155
155
|
white-space: nowrap;
|
|
156
156
|
border-right: 1px solid ${s.lineStrong};
|
|
157
|
-
`,Pe=
|
|
157
|
+
`,Pe=r.div`
|
|
158
158
|
display: grid;
|
|
159
159
|
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
|
|
160
160
|
gap: 12px;
|
|
@@ -162,7 +162,7 @@ import{j as t,L as oe,b as le,r as l}from"./react-Io5Wove7.js";import{b as n,t a
|
|
|
162
162
|
${K.maxWidth("mobile")} {
|
|
163
163
|
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
|
|
164
164
|
}
|
|
165
|
-
`,L=
|
|
165
|
+
`,L=r.button`
|
|
166
166
|
position: relative;
|
|
167
167
|
padding: 0;
|
|
168
168
|
border: 2px solid ${s.lineStrong};
|
|
@@ -223,22 +223,22 @@ import{j as t,L as oe,b as le,r as l}from"./react-Io5Wove7.js";import{b as n,t a
|
|
|
223
223
|
&[data-variant='upload']:hover .ico {
|
|
224
224
|
background: ${s.accent};
|
|
225
225
|
}
|
|
226
|
-
`,Be=
|
|
226
|
+
`,Be=r.input`
|
|
227
227
|
position: absolute;
|
|
228
228
|
width: 1px;
|
|
229
229
|
height: 1px;
|
|
230
230
|
opacity: 0;
|
|
231
231
|
pointer-events: none;
|
|
232
|
-
`,Re=
|
|
232
|
+
`,Re=r.div`
|
|
233
233
|
display: flex;
|
|
234
234
|
justify-content: flex-end;
|
|
235
235
|
gap: 12px;
|
|
236
236
|
margin-top: 8px;
|
|
237
|
-
`,Fe=
|
|
237
|
+
`,Fe=r(G)`
|
|
238
238
|
min-width: 180px;
|
|
239
239
|
|
|
240
240
|
${K.maxWidth("mobile")} {
|
|
241
241
|
width: 100%;
|
|
242
242
|
}
|
|
243
|
-
`,W=1e6,V={cover:"",coverName:"",coverHash:"",description:"",links:{website:"",twitter:"",discord:"",facebook:""}};function Y(
|
|
244
|
-
//# sourceMappingURL=StoreSettings-
|
|
243
|
+
`,W=1e6,V={cover:"",coverName:"",coverHash:"",description:"",links:{website:"",twitter:"",discord:"",facebook:""}};function Y(a){return`${(a/1e6).toLocaleString(void 0,{maximumFractionDigits:2})}MB`}function Je(){de({title:n("seo.storeSettings.title"),noindex:!0});const{session:a,signIn:d}=pe(),v=le(),k=ue(),u=a==null?void 0:a.address,{data:y,isLoading:q}=ge(u),[o,g]=l.useState(V),[N,C]=l.useState(V),[$,h]=l.useState(),[x,H]=l.useState(!1),[c,_]=l.useState(null),[w,J]=l.useState({}),T=l.useRef(null);l.useEffect(()=>{if(y){const e=me(y);g(e),C(e),h(void 0),_(e.cover?{url:e.cover,name:e.coverName,hash:e.coverHash}:null)}},[y]),l.useEffect(()=>{let e=!1;return Promise.all(b.map(async i=>[i.name,await he(i.url)])).then(i=>{e||J(Object.fromEntries(i))}).catch(()=>{}),()=>{e=!0}},[]);const E=l.useMemo(()=>{const e=b.find(p=>o.coverName===`cover/${p.name}`);if(e)return e.name;const i=o.coverHash?b.find(p=>w[p.name]===o.coverHash):void 0;return i==null?void 0:i.name},[o.coverName,o.coverHash,w]);l.useEffect(()=>{c!=null&&c.hash&&b.some(e=>w[e.name]===c.hash)&&_(null)},[w,c]);const D=$!==void 0&&$>W,Q=l.useMemo(()=>xe.filter(e=>!F(e,o.links[e])),[o.links]),U=D||Q.length>0,z=l.useMemo(()=>JSON.stringify(o)!==JSON.stringify(N),[o,N]),X=z&&!U&&!x;if(l.useEffect(()=>{if(!z)return;const e=i=>{i.preventDefault()};return window.addEventListener("beforeunload",e),()=>window.removeEventListener("beforeunload",e)},[z]),!a)return t.jsxs(M,{"data-signin":!0,"aria-label":n("storeSettings.title"),children:[t.jsx(O,{children:n("storeSettings.title")}),t.jsx(Ie,{children:n("storeSettings.signInPrompt")}),t.jsx(ze,{variant:"white",onClick:d,children:n("storeSettings.signIn")})]});function Z(e,i){h(void 0),g(p=>({...p,cover:i,coverName:`cover/${e}`,coverHash:""}))}const ee=["image/png","image/jpeg","image/webp"];function te(e){var P;const i=(P=e.target.files)==null?void 0:P[0];if(!i||!ee.includes(i.type))return;h(i.size);const p=`cover/${i.name}`,m=new FileReader;m.onload=()=>{const B=m.result;_({url:B,name:p,hash:""}),g(re=>({...re,cover:B,coverName:p,coverHash:""}))},m.readAsDataURL(i)}function ie(){c&&(h(void 0),g(e=>({...e,cover:c.url,coverName:c.name,coverHash:c.hash})))}function se(e,i){const p=i?(f[e]+i).replace(/\s/g,""):"";g(m=>({...m,links:{...m.links,[e]:p}}))}function ne(e){const i=o.links[e];return e==="website"?i:i.replace(f[e],"")}async function ae(){if(!(!u||!a)){H(!0);try{await fe(u,o,a.identity),C(o),h(void 0),await k.invalidateQueries({queryKey:["store",u.toLowerCase()]}),R.success(n("storeSettings.saved")),v(`/items/creator/${u}`)}catch{R.error(n("storeSettings.saveError"))}finally{H(!1)}}}return t.jsxs(M,{"aria-label":n("storeSettings.title"),children:[t.jsxs(Le,{children:[t.jsxs(Ne,{children:[u?t.jsx(Ce,{to:`/items/creator/${u}`,title:n("storeSettings.back"),"aria-label":n("storeSettings.back"),children:t.jsx(I,{name:"arrow-left"})}):null,t.jsx(O,{children:n("storeSettings.title")})]}),u?t.jsxs(He,{href:`/items/creator/${u}`,target:"_blank",rel:"noopener noreferrer",children:[n("storeSettings.seeAsGuest"),t.jsx(I,{name:"external-link"})]}):null]}),q?t.jsx(Ee,{size:"large",label:n("storeSettings.loading")}):t.jsxs(t.Fragment,{children:[t.jsxs(j,{children:[t.jsx("span",{className:"field__label",children:n("storeSettings.cover")}),t.jsxs(Pe,{role:"group","aria-label":n("storeSettings.cover"),children:[b.map(e=>{const i=E===e.name;return t.jsx(L,{type:"button","data-testid":"cover-picker-tile","data-selected":i,"aria-pressed":i,onClick:()=>Z(e.name,e.url),children:t.jsx("img",{src:e.url,alt:"",loading:"lazy"})},e.name)}),c?t.jsx(L,{type:"button","data-testid":"cover-picker-tile","data-variant":"custom","data-selected":!E,"aria-pressed":!E,onClick:ie,children:t.jsx("img",{src:c.url,alt:""})}):null,t.jsxs(L,{type:"button","data-testid":"cover-picker-tile","data-variant":"upload",onClick:()=>{var e;return(e=T.current)==null?void 0:e.click()},children:[t.jsx(I,{name:"upload"}),t.jsx("span",{children:n("storeSettings.upload")})]}),t.jsx(Be,{ref:T,type:"file",accept:"image/png, image/jpeg, image/webp","data-testid":"cover-picker-input",onChange:te})]}),D?t.jsx(A,{message:n("storeSettings.sizeError",{max:Y(W),current:Y($)})}):null]}),t.jsxs(j,{as:"label",children:[t.jsx("span",{className:"field__label",children:n("storeSettings.description")}),t.jsx("textarea",{value:o.description,rows:4,disabled:x,onChange:e=>g(i=>({...i,description:e.target.value}))})]}),t.jsxs(j,{as:"label",children:[t.jsx("span",{className:"field__label",children:n("storeSettings.website")}),t.jsx("input",{type:"url",value:o.links.website,placeholder:f.website,disabled:x,onChange:e=>g(i=>({...i,links:{...i.links,website:e.target.value.replace(/\s/g,"")}}))}),F("website",o.links.website)?null:t.jsx(A,{message:n("storeSettings.linkError",{value:f.website})})]}),["twitter","discord","facebook"].map(e=>t.jsxs(j,{as:"label",children:[t.jsx("span",{className:"field__label",children:n(`storeSettings.${e}`)}),t.jsxs(Te,{children:[t.jsx(De,{children:f[e]}),t.jsx("input",{type:"text",value:ne(e),disabled:x,onChange:i=>se(e,i.target.value)})]})]},e)),t.jsx(Re,{children:t.jsx(Fe,{variant:"white","data-testid":"store-settings-save",onClick:()=>void ae(),disabled:!X,children:x?n("storeSettings.saving"):n("storeSettings.save")})})]})]})}export{Je as StoreSettings,Je as default};
|
|
244
|
+
//# sourceMappingURL=StoreSettings-CNfXo7Kp.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as _,b as M,j as e,N as W,r as A}from"./react-BY3vVwvc.js";import{t as q,s as t,q as D,z as J,A as O,o as G,n as H,b as n,p as U,D as T,C as X,E as K,F as Q,c as Y,B as V,G as Z}from"./index-aVZCrQgK.js";import{C as ee}from"./Confetti-Z8v6OTnK.js";import{b as te,J as ne,a as ie}from"./jump-5JL_cP03.js";import{w as se,S as re}from"./buy-gasless-IWvDnyE1.js";import"./dcl-schemas-DhyZEUTb.js";import"./sentry-DTXXLFvs.js";import"./ethers-ByWI-eMv.js";import"./intl-AKLEHPeO.js";import"./authorizations-DxGdOyfi.js";import"./sendMetaTransaction-BojzaFVf.js";import"./buy-wWHknAve.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new r.Error().stack;o&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[o]="5fcec140-d6dc-4211-8834-ff084539b602",r._sentryDebugIdIdentifier="sentry-dbid-5fcec140-d6dc-4211-8834-ff084539b602")}catch{}})();const{colors:i,radius:j}=q,l="@media (max-width: 600px)",B=t.div`
|
|
2
2
|
/* Its own stacking context, above the confetti layer (z-index 0). Needed because z-index is inert without
|
|
3
3
|
a position, so the content would otherwise sit below the burst regardless of order. */
|
|
4
4
|
position: relative;
|
|
@@ -33,14 +33,14 @@ import{a as P,b as M,j as e,N as W,r as A}from"./react-Io5Wove7.js";import{t as
|
|
|
33
33
|
top: -16px;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
`,
|
|
36
|
+
`,oe=t.div`
|
|
37
37
|
display: flex;
|
|
38
38
|
flex-direction: column;
|
|
39
39
|
align-items: center;
|
|
40
40
|
text-align: center;
|
|
41
41
|
justify-content: center;
|
|
42
42
|
min-height: 60vh;
|
|
43
|
-
`,
|
|
43
|
+
`,ae=t.span`
|
|
44
44
|
margin: 4px auto 8px;
|
|
45
45
|
width: 40px;
|
|
46
46
|
height: 40px;
|
|
@@ -63,7 +63,7 @@ import{a as P,b as M,j as e,N as W,r as A}from"./react-Io5Wove7.js";import{t as
|
|
|
63
63
|
justify-content: flex-end;
|
|
64
64
|
margin: 0;
|
|
65
65
|
}
|
|
66
|
-
`,
|
|
66
|
+
`,ce=t.a`
|
|
67
67
|
display: inline-block;
|
|
68
68
|
margin: 0;
|
|
69
69
|
color: ${i.accent};
|
|
@@ -75,12 +75,12 @@ import{a as P,b as M,j as e,N as W,r as A}from"./react-Io5Wove7.js";import{t as
|
|
|
75
75
|
gap: 12px;
|
|
76
76
|
flex-wrap: wrap;
|
|
77
77
|
justify-content: center;
|
|
78
|
-
`,
|
|
78
|
+
`,de=t.div`
|
|
79
79
|
display: flex;
|
|
80
80
|
flex-direction: column;
|
|
81
81
|
gap: 12px;
|
|
82
82
|
width: 100%;
|
|
83
|
-
`,
|
|
83
|
+
`,le=t.div`
|
|
84
84
|
display: flex;
|
|
85
85
|
align-items: center;
|
|
86
86
|
justify-content: center;
|
|
@@ -94,12 +94,12 @@ import{a as P,b as M,j as e,N as W,r as A}from"./react-Io5Wove7.js";import{t as
|
|
|
94
94
|
flex-direction: column;
|
|
95
95
|
border: 0;
|
|
96
96
|
}
|
|
97
|
-
`,
|
|
97
|
+
`,pe=t.span`
|
|
98
98
|
flex-shrink: 0;
|
|
99
99
|
width: 60px;
|
|
100
100
|
height: 60px;
|
|
101
101
|
line-height: 0;
|
|
102
|
-
`,
|
|
102
|
+
`,xe=t.p`
|
|
103
103
|
margin: 0;
|
|
104
104
|
max-width: 640px;
|
|
105
105
|
text-align: center;
|
|
@@ -114,7 +114,7 @@ import{a as P,b as M,j as e,N as W,r as A}from"./react-Io5Wove7.js";import{t as
|
|
|
114
114
|
${l} {
|
|
115
115
|
font-size: 17px;
|
|
116
116
|
}
|
|
117
|
-
`,
|
|
117
|
+
`,he=t.div`
|
|
118
118
|
display: flex;
|
|
119
119
|
flex-direction: column;
|
|
120
120
|
padding: 24px;
|
|
@@ -128,7 +128,7 @@ import{a as P,b as M,j as e,N as W,r as A}from"./react-Io5Wove7.js";import{t as
|
|
|
128
128
|
background: none;
|
|
129
129
|
border: 0;
|
|
130
130
|
}
|
|
131
|
-
`,
|
|
131
|
+
`,ue=t.div`
|
|
132
132
|
display: flex;
|
|
133
133
|
flex-direction: column;
|
|
134
134
|
|
|
@@ -138,7 +138,7 @@ import{a as P,b as M,j as e,N as W,r as A}from"./react-Io5Wove7.js";import{t as
|
|
|
138
138
|
border: 1px solid ${i.gray4};
|
|
139
139
|
border-radius: 16px;
|
|
140
140
|
}
|
|
141
|
-
`,
|
|
141
|
+
`,ge=t.span`
|
|
142
142
|
display: block;
|
|
143
143
|
height: 1px;
|
|
144
144
|
margin: 12px 0;
|
|
@@ -147,7 +147,7 @@ import{a as P,b as M,j as e,N as W,r as A}from"./react-Io5Wove7.js";import{t as
|
|
|
147
147
|
${l} {
|
|
148
148
|
display: none;
|
|
149
149
|
}
|
|
150
|
-
`,
|
|
150
|
+
`,fe=t.div`
|
|
151
151
|
position: relative;
|
|
152
152
|
display: flex;
|
|
153
153
|
align-items: center;
|
|
@@ -163,23 +163,23 @@ import{a as P,b as M,j as e,N as W,r as A}from"./react-Io5Wove7.js";import{t as
|
|
|
163
163
|
${l} {
|
|
164
164
|
margin-bottom: 0;
|
|
165
165
|
}
|
|
166
|
-
`,
|
|
166
|
+
`,me=t(D)`
|
|
167
167
|
width: 30px;
|
|
168
168
|
height: 30px;
|
|
169
169
|
color: ${i.text};
|
|
170
|
-
`,
|
|
170
|
+
`,be=t.p`
|
|
171
171
|
display: inline-flex;
|
|
172
172
|
align-items: baseline;
|
|
173
173
|
gap: 6px;
|
|
174
174
|
margin: 0;
|
|
175
|
-
`,
|
|
175
|
+
`,je=t.span`
|
|
176
176
|
font-size: 24px;
|
|
177
177
|
font-weight: 700;
|
|
178
178
|
text-transform: capitalize;
|
|
179
|
-
`,
|
|
179
|
+
`,we=t.span`
|
|
180
180
|
font-size: 14px;
|
|
181
181
|
font-weight: 400;
|
|
182
|
-
`,
|
|
182
|
+
`,ye=t.div`
|
|
183
183
|
display: grid;
|
|
184
184
|
grid-template-columns: auto 1fr auto;
|
|
185
185
|
align-items: center;
|
|
@@ -204,7 +204,7 @@ import{a as P,b as M,j as e,N as W,r as A}from"./react-Io5Wove7.js";import{t as
|
|
|
204
204
|
margin-top: 4px;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
`,
|
|
207
|
+
`,ve=t.div`
|
|
208
208
|
position: relative;
|
|
209
209
|
flex-shrink: 0;
|
|
210
210
|
width: 137px;
|
|
@@ -240,14 +240,14 @@ import{a as P,b as M,j as e,N as W,r as A}from"./react-Io5Wove7.js";import{t as
|
|
|
240
240
|
background: ${i.dclRed};
|
|
241
241
|
border-radius: ${j.chip};
|
|
242
242
|
line-height: 0;
|
|
243
|
-
`,
|
|
243
|
+
`,ke=t.div`
|
|
244
244
|
flex: 1;
|
|
245
245
|
min-width: 0;
|
|
246
246
|
display: flex;
|
|
247
247
|
flex-direction: column;
|
|
248
248
|
justify-content: center;
|
|
249
249
|
gap: 4px;
|
|
250
|
-
|
|
250
|
+
`,$e=t.div`
|
|
251
251
|
font-weight: 700;
|
|
252
252
|
font-size: 20px;
|
|
253
253
|
line-height: 1.3;
|
|
@@ -259,12 +259,12 @@ import{a as P,b as M,j as e,N as W,r as A}from"./react-Io5Wove7.js";import{t as
|
|
|
259
259
|
${l} {
|
|
260
260
|
font-size: 16px;
|
|
261
261
|
}
|
|
262
|
-
|
|
262
|
+
`,Ce=t.span`
|
|
263
263
|
margin-left: 8px;
|
|
264
264
|
font-weight: 600;
|
|
265
265
|
font-size: 13px;
|
|
266
266
|
color: ${i.muted};
|
|
267
|
-
`,
|
|
267
|
+
`,Ie=t(J)`
|
|
268
268
|
position: relative;
|
|
269
269
|
z-index: 1;
|
|
270
270
|
color: ${i.muted};
|
|
@@ -273,7 +273,7 @@ import{a as P,b as M,j as e,N as W,r as A}from"./react-Io5Wove7.js";import{t as
|
|
|
273
273
|
& [data-avatar] {
|
|
274
274
|
display: none;
|
|
275
275
|
}
|
|
276
|
-
`,
|
|
276
|
+
`,ze=t.div`
|
|
277
277
|
display: flex;
|
|
278
278
|
align-items: center;
|
|
279
279
|
gap: 6px;
|
|
@@ -286,17 +286,17 @@ import{a as P,b as M,j as e,N as W,r as A}from"./react-Io5Wove7.js";import{t as
|
|
|
286
286
|
${l} {
|
|
287
287
|
font-size: 18px;
|
|
288
288
|
}
|
|
289
|
-
`,
|
|
289
|
+
`,Re=t(D)`
|
|
290
290
|
width: 22px;
|
|
291
291
|
height: 22px;
|
|
292
292
|
background: ${i.text2};
|
|
293
|
-
`,
|
|
293
|
+
`,Ae=t.div`
|
|
294
294
|
display: flex;
|
|
295
295
|
gap: 12px;
|
|
296
296
|
align-items: center;
|
|
297
297
|
justify-content: flex-end;
|
|
298
298
|
margin-top: 4px;
|
|
299
|
-
`,
|
|
299
|
+
`,P=O`
|
|
300
300
|
flex: 1;
|
|
301
301
|
min-width: 0;
|
|
302
302
|
height: 48px;
|
|
@@ -340,15 +340,15 @@ import{a as P,b as M,j as e,N as W,r as A}from"./react-Io5Wove7.js";import{t as
|
|
|
340
340
|
font-size: 13px;
|
|
341
341
|
}
|
|
342
342
|
`,E=t.button`
|
|
343
|
-
${
|
|
343
|
+
${P};
|
|
344
344
|
`,F=t.a`
|
|
345
|
-
${
|
|
346
|
-
`,
|
|
345
|
+
${P};
|
|
346
|
+
`,Te=t.span`
|
|
347
347
|
display: inline-flex;
|
|
348
348
|
flex-shrink: 0;
|
|
349
349
|
line-height: 0;
|
|
350
350
|
`,I=t(V)`
|
|
351
351
|
min-width: 160px;
|
|
352
352
|
text-align: center;
|
|
353
|
-
`;function
|
|
354
|
-
//# sourceMappingURL=Success-
|
|
353
|
+
`;function Be(r){return null}const Se=r=>new Promise(o=>setTimeout(o,r)),N=()=>e.jsx("svg",{viewBox:"0 0 18 18",width:"12",height:"12",children:e.jsx("path",{d:"M4 9l3.5 3.5L14 5",fill:"none",stroke:"#fff",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round"})});function Le(r,o){const[s,d]=A.useState(r?"pending":"confirmed"),x=o?`${o.owner}-${o.contractAddress}-${o.itemId}`:"";return A.useEffect(()=>{if(!r)return;let p=!1;return(async()=>{let f=!1;for(let a=0;a<20&&!p;a++)try{await se(r,{timeoutMs:15e3}),f=!0;break}catch(y){if(y instanceof re)continue;p||d("failed");return}if(!p){if(!f){d("timed-out");return}if(!o){d("confirmed");return}d("indexing");for(let a=0;a<40&&!p;a++){if(await Z(o.owner,o.contractAddress,o.itemId)){p||d("confirmed");return}await Se(3e3)}p||d("timed-out")}})(),()=>{p=!0}},[r,x]),s}const Ee=Y.chainId===80002?"https://amoy.polygonscan.com/tx/":"https://polygonscan.com/tx/";function Xe(){var R;const{state:r,search:o}=_(),s=r??Be(),d=M(),{session:x}=G(),p=s==null?void 0:s.txHash,w=(s==null?void 0:s.items)??[],f=s!=null&&s.creditsAdded&&s.creditsAdded>0?s.creditsAdded:null,a=w[0],y=x!=null&&x.address&&(a!=null&&a.contractAddress)&&(a!=null&&a.itemId)?{owner:x.address,contractAddress:a.contractAddress,itemId:a.itemId}:null,g=Le(s!=null&&s.settled?void 0:p,y);H({title:n("seo.success.title"),noindex:!0});const h=w;if(h.length===0)return e.jsx(W,{to:"/items",replace:!0});const z=h[0],m=(R=s==null?void 0:s.txHashes)!=null&&R.length?s.txHashes:p?[p]:[],u=m.length>0&&U(x==null?void 0:x.providerType)?m.map((c,v)=>e.jsx(ce,{href:`${Ee}${c}`,target:"_blank",rel:"noreferrer",children:m.length>1?n("success.viewTransactionNumbered",{n:v+1,total:m.length}):n("success.viewTransaction")},c)):null;return g!=="confirmed"?e.jsx(B,{children:e.jsx(oe,{children:g==="pending"||g==="indexing"?e.jsxs(e.Fragment,{children:[e.jsx(ae,{className:"spinner","aria-hidden":!0}),e.jsx($,{children:g==="indexing"?n("success.finalizing"):n("success.processing")}),e.jsx(C,{children:g==="indexing"?e.jsxs(e.Fragment,{children:[n("success.indexingBefore")," ",h.length===1?e.jsx("strong",{children:z.name}):n("success.itemCount",{count:h.length})," ",n("success.indexingAfter")]}):e.jsxs(e.Fragment,{children:[n("success.confirmingBefore")," ",h.length===1?e.jsx("strong",{children:z.name}):n("success.itemCount",{count:h.length})," ",n("success.confirmingAfter")]})}),u?e.jsx(b,{children:u}):null]}):g==="timed-out"?e.jsxs(e.Fragment,{children:[e.jsx($,{children:n("success.stillProcessingTitle")}),e.jsxs(C,{children:[n("success.timedOutBefore")," ",e.jsx("button",{className:"link",onClick:()=>d("/activity"),children:n("nav.activity")})," ",n("success.timedOutAfter")]}),u?e.jsx(b,{children:u}):null,e.jsxs(S,{children:[e.jsx(I,{variant:"purple",onClick:()=>d("/activity"),children:n("success.viewActivity")}),e.jsx(I,{variant:"ghost",onClick:()=>d("/items"),children:n("success.keepShopping")})]})]}):e.jsxs(e.Fragment,{children:[e.jsx($,{children:n("success.failedTitle")}),e.jsx(C,{children:n("success.failedBody")}),u?e.jsx(b,{children:u}):null,e.jsx(S,{children:e.jsx(I,{variant:"purple",onClick:()=>d("/items"),children:n("success.backToShop")})})]})})}):e.jsxs(B,{children:[e.jsx(ee,{}),e.jsxs(de,{children:[e.jsxs(le,{role:"status",children:[e.jsx(pe,{"aria-hidden":!0,children:e.jsxs("svg",{viewBox:"0 0 60 60",width:"60",height:"60",children:[e.jsx("circle",{cx:"30",cy:"30",r:"30",fill:"#34ce77"}),e.jsx("path",{d:"M18 31l8 8 16-18",fill:"none",stroke:"#fff",strokeWidth:"4.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}),e.jsxs(xe,{children:[e.jsx("b",{children:n("success.bannerTitle")})," ",T()?n("success.bannerBodyIap"):n("success.bannerBody")]})]}),e.jsxs(he,{children:[f?e.jsxs(fe,{"data-testid":"success-credits",children:[e.jsx(L,{"aria-hidden":!0,children:e.jsx(N,{})}),e.jsx(me,{}),e.jsxs(be,{children:[e.jsx(je,{children:n("getCredits.creditsAmount",{credits:f,currency:X.name})})," ",e.jsx(we,{children:n("getCredits.creditsAdded")})]})]}):null,h.map((c,v)=>{const k=c.quantity??1;return e.jsxs(ue,{children:[v>0?e.jsx(ge,{"aria-hidden":!0}):null,e.jsxs(ye,{children:[e.jsxs(ve,{"data-thumb":!0,children:[c.thumbnail?e.jsx("img",{src:c.thumbnail,alt:""}):null,e.jsx(L,{"aria-hidden":!0,children:e.jsx(N,{})})]}),e.jsxs(ke,{"data-info":!0,children:[e.jsxs($e,{title:c.name,children:[c.name||n("buyModal.itemFallback"),k>1?e.jsx(Ce,{children:n("cartCheckout.qty",{count:k})}):null]}),c.creator?e.jsx(Ie,{address:c.creator,linkToProfile:!0}):null]}),e.jsxs(ze,{"data-price":!0,children:[e.jsx(Re,{}),e.jsx("span",{children:K(c.priceCredits*k)})]})]})]},c.id)})]}),u?e.jsx(b,{"data-receipt":!0,children:u}):null,e.jsx(Ae,{children:T()?e.jsxs(e.Fragment,{children:[e.jsx(E,{"data-variant":"ghost",onClick:()=>d("/overview"),children:n("success.done")}),e.jsx(F,{"data-variant":"ruby",href:te(h),children:n("success.goToBackpack")})]}):e.jsxs(e.Fragment,{children:[e.jsx(E,{"data-variant":"ghost",onClick:()=>d(Q(h.map(c=>c.category))),children:n("success.myAssets")}),e.jsxs(F,{"data-variant":"ruby",href:ne,target:"_blank",rel:"noreferrer",children:[n("success.tryInWorld"),e.jsx(Te,{"aria-hidden":!0,children:e.jsx(ie,{})})]})]})})]})]})}export{Xe as Success,Xe as default};
|
|
354
|
+
//# sourceMappingURL=Success-DRyL1YJL.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{N as T,j as G,R as I,S as f,k as B,E as M,l as F,W as _,C as m,B as N,b as L,m as E,A as O,n as z,d as W,g as R,o as H,e as V,i as q,p as $}from"./W3MFrameProviderSingleton-DqaMm2mV.js";import{au as b}from"./NetworkUtil-BIUbrPWa.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new n.Error().stack;o&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[o]="d5bf39f8-0096-4633-a71d-e79393a73741",n._sentryDebugIdIdentifier="sentry-dbid-d5bf39f8-0096-4633-a71d-e79393a73741")}catch{}})();const C={getGasPriceInEther(n,o){const t=o*n;return Number(t)/1e18},getGasPriceInUSD(n,o,t){const s=C.getGasPriceInEther(o,t);return T.bigNumber(n).times(s).toNumber()},getPriceImpact({sourceTokenAmount:n,sourceTokenPriceInUSD:o,toTokenPriceInUSD:t,toTokenAmount:s}){const c=T.bigNumber(n).times(o),r=T.bigNumber(s).times(t);return c.minus(r).div(c).times(100).toNumber()},getMaxSlippage(n,o){const t=T.bigNumber(n).div(100);return T.multiply(o,t).toNumber()},getProviderFee(n,o=.0085){return T.bigNumber(n).times(o).toString()},isInsufficientNetworkTokenForGas(n,o){const t=o||"0";return T.bigNumber(n).eq(0)?!0:T.bigNumber(T.bigNumber(t)).gt(n)},isInsufficientSourceTokenForSwap(n,o,t){var r,d;const s=(d=(r=t==null?void 0:t.find(l=>l.address===o))==null?void 0:r.quantity)==null?void 0:d.numeric;return T.bigNumber(s||"0").lt(n)}},x=15e4,Q=6,g={initializing:!1,initialized:!1,loadingPrices:!1,loadingQuote:!1,loadingApprovalTransaction:!1,loadingBuildTransaction:!1,loadingTransaction:!1,switchingTokens:!1,fetchError:!1,approvalTransaction:void 0,swapTransaction:void 0,transactionError:void 0,sourceToken:void 0,sourceTokenAmount:"",sourceTokenPriceInUSD:0,toToken:void 0,toTokenAmount:"",toTokenPriceInUSD:0,networkPrice:"0",networkBalanceInUSD:"0",networkTokenSymbol:"",inputError:void 0,slippage:W.CONVERT_SLIPPAGE_TOLERANCE,tokens:void 0,popularTokens:void 0,suggestedTokens:void 0,foundTokens:void 0,myTokensWithBalance:void 0,tokensPriceMap:{},gasFee:"0",gasPriceInUSD:0,priceImpact:void 0,maxSlippage:void 0,providerFee:void 0},e=$({...g}),D={state:e,subscribe(n){return q(e,()=>n(e))},subscribeKey(n,o){return V(e,n,o)},getParams(){var i,u,p,w,y,h,A,S,P;const n=m.state.activeChain,o=((i=m.getAccountData(n))==null?void 0:i.caipAddress)??m.state.activeCaipAddress,t=L.getPlainAddress(o),s=R(),c=H.getConnectorId(m.state.activeChain);if(!t)throw new Error("No address found to swap the tokens from.");const r=!((u=e.toToken)!=null&&u.address)||!((p=e.toToken)!=null&&p.decimals),d=!((w=e.sourceToken)!=null&&w.address)||!((y=e.sourceToken)!=null&&y.decimals)||!T.bigNumber(e.sourceTokenAmount).gt(0),l=!e.sourceTokenAmount;return{networkAddress:s,fromAddress:t,fromCaipAddress:o,sourceTokenAddress:(h=e.sourceToken)==null?void 0:h.address,toTokenAddress:(A=e.toToken)==null?void 0:A.address,toTokenAmount:e.toTokenAmount,toTokenDecimals:(S=e.toToken)==null?void 0:S.decimals,sourceTokenAmount:e.sourceTokenAmount,sourceTokenDecimals:(P=e.sourceToken)==null?void 0:P.decimals,invalidToToken:r,invalidSourceToken:d,invalidSourceTokenAmount:l,availableToSwap:o&&!r&&!d&&!l,isAuthConnector:c===b.CONNECTOR_ID.AUTH}},async setSourceToken(n){if(!n){e.sourceToken=n,e.sourceTokenAmount="",e.sourceTokenPriceInUSD=0;return}e.sourceToken=n,await a.setTokenPrice(n.address,"sourceToken")},setSourceTokenAmount(n){e.sourceTokenAmount=n},async setToToken(n){if(!n){e.toToken=n,e.toTokenAmount="",e.toTokenPriceInUSD=0;return}e.toToken=n,await a.setTokenPrice(n.address,"toToken")},setToTokenAmount(n){e.toTokenAmount=n?T.toFixed(n,Q):""},async setTokenPrice(n,o){let t=e.tokensPriceMap[n]||0;t||(e.loadingPrices=!0,t=await a.getAddressPrice(n)),o==="sourceToken"?e.sourceTokenPriceInUSD=t:o==="toToken"&&(e.toTokenPriceInUSD=t),e.loadingPrices&&(e.loadingPrices=!1),a.getParams().availableToSwap&&!e.switchingTokens&&a.swapTokens()},async switchTokens(){if(!(e.initializing||!e.initialized||e.switchingTokens)){e.switchingTokens=!0;try{const n=e.toToken?{...e.toToken}:void 0,o=e.sourceToken?{...e.sourceToken}:void 0,t=n&&e.toTokenAmount===""?"1":e.toTokenAmount;a.setSourceTokenAmount(t),a.setToTokenAmount(""),await a.setSourceToken(n),await a.setToToken(o),e.switchingTokens=!1,a.swapTokens()}catch(n){throw e.switchingTokens=!1,n}}},resetState(){e.myTokensWithBalance=g.myTokensWithBalance,e.tokensPriceMap=g.tokensPriceMap,e.initialized=g.initialized,e.initializing=g.initializing,e.switchingTokens=g.switchingTokens,e.sourceToken=g.sourceToken,e.sourceTokenAmount=g.sourceTokenAmount,e.sourceTokenPriceInUSD=g.sourceTokenPriceInUSD,e.toToken=g.toToken,e.toTokenAmount=g.toTokenAmount,e.toTokenPriceInUSD=g.toTokenPriceInUSD,e.networkPrice=g.networkPrice,e.networkTokenSymbol=g.networkTokenSymbol,e.networkBalanceInUSD=g.networkBalanceInUSD,e.inputError=g.inputError},resetValues(){var t;const{networkAddress:n}=a.getParams(),o=(t=e.tokens)==null?void 0:t.find(s=>s.address===n);a.setSourceToken(o),a.setToToken(void 0)},getApprovalLoadingState(){return e.loadingApprovalTransaction},clearError(){e.transactionError=void 0},async initializeState(){if(!e.initializing){if(e.initializing=!0,!e.initialized)try{await a.fetchTokens(),e.initialized=!0}catch{e.initialized=!1,f.showError("Failed to initialize swap"),I.goBack()}e.initializing=!1}},async fetchTokens(){var t;const{networkAddress:n}=a.getParams();await a.getNetworkTokenPrice(),await a.getMyTokensWithBalance();const o=(t=e.myTokensWithBalance)==null?void 0:t.find(s=>s.address===n);o&&(e.networkTokenSymbol=o.symbol,a.setSourceToken(o),a.setSourceTokenAmount("0"))},async getTokenList(){var o,t;const n=(o=m.state.activeCaipNetwork)==null?void 0:o.caipNetworkId;if(!(e.caipNetworkId===n&&e.tokens))try{e.tokensLoading=!0;const s=await E.getTokenList(n);e.tokens=s,e.caipNetworkId=n,e.popularTokens=s.sort((i,u)=>i.symbol<u.symbol?-1:i.symbol>u.symbol?1:0);const r=(n&&((t=W.SUGGESTED_TOKENS_BY_CHAIN)==null?void 0:t[n])||[]).map(i=>s.find(u=>u.symbol===i)).filter(i=>!!i),l=(W.SWAP_SUGGESTED_TOKENS||[]).map(i=>s.find(u=>u.symbol===i)).filter(i=>!!i).filter(i=>!r.some(u=>u.address===i.address));e.suggestedTokens=[...r,...l]}catch{e.tokens=[],e.popularTokens=[],e.suggestedTokens=[]}finally{e.tokensLoading=!1}},async getAddressPrice(n){var i,u;const o=e.tokensPriceMap[n];if(o)return o;const t=await N.fetchTokenPrice({addresses:[n]}),s=(t==null?void 0:t.fungibles)||[],c=[...e.tokens||[],...e.myTokensWithBalance||[]],r=(i=c==null?void 0:c.find(p=>p.address===n))==null?void 0:i.symbol,d=((u=s.find(p=>p.symbol.toLowerCase()===(r==null?void 0:r.toLowerCase())))==null?void 0:u.price)||0,l=parseFloat(d.toString());return e.tokensPriceMap[n]=l,l},async getNetworkTokenPrice(){var c;const{networkAddress:n}=a.getParams(),t=(c=(await N.fetchTokenPrice({addresses:[n]}).catch(()=>(f.showError("Failed to fetch network token price"),{fungibles:[]}))).fungibles)==null?void 0:c[0],s=(t==null?void 0:t.price.toString())||"0";e.tokensPriceMap[n]=parseFloat(s),e.networkTokenSymbol=(t==null?void 0:t.symbol)||"",e.networkPrice=s},async getMyTokensWithBalance(n){var s;const o=await z.getMyTokensWithBalance({forceUpdate:n,caipNetwork:m.state.activeCaipNetwork,address:(s=m.getAccountData())==null?void 0:s.address}),t=E.mapBalancesToSwapTokens(o);t&&(await a.getInitialGasPrice(),a.setBalances(t))},setBalances(n){const{networkAddress:o}=a.getParams(),t=m.state.activeCaipNetwork;if(!t)return;const s=n.find(c=>c.address===o);n.forEach(c=>{e.tokensPriceMap[c.address]=c.price||0}),e.myTokensWithBalance=n.filter(c=>c.address.startsWith(t.caipNetworkId)),e.networkBalanceInUSD=s?T.multiply(s.quantity.numeric,s.price).toString():"0"},async getInitialGasPrice(){var o,t;const n=await E.fetchGasPrice();if(!n)return{gasPrice:null,gasPriceInUSD:null};switch((t=(o=m.state)==null?void 0:o.activeCaipNetwork)==null?void 0:t.chainNamespace){case b.CHAIN.SOLANA:return e.gasFee=n.standard??"0",e.gasPriceInUSD=T.multiply(n.standard,e.networkPrice).div(1e9).toNumber(),{gasPrice:BigInt(e.gasFee),gasPriceInUSD:Number(e.gasPriceInUSD)};case b.CHAIN.EVM:default:const s=n.standard??"0",c=BigInt(s),r=BigInt(x),d=C.getGasPriceInUSD(e.networkPrice,r,c);return e.gasFee=s,e.gasPriceInUSD=d,{gasPrice:c,gasPriceInUSD:d}}},async swapTokens(){var r,d,l;const n=(r=m.getAccountData())==null?void 0:r.address,o=e.sourceToken,t=e.toToken,s=T.bigNumber(e.sourceTokenAmount).gt(0);if(s||a.setToTokenAmount(""),!t||!o||e.loadingPrices||!s||!n)return;e.loadingQuote=!0;const c=T.bigNumber(e.sourceTokenAmount).times(10**o.decimals).round(0).toFixed(0);try{const i=await N.fetchSwapQuote({userAddress:n,from:o.address,to:t.address,gasPrice:e.gasFee,amount:c.toString()});e.loadingQuote=!1;const u=(l=(d=i==null?void 0:i.quotes)==null?void 0:d[0])==null?void 0:l.toAmount;if(!u){O.open({displayMessage:"Incorrect amount",debugMessage:"Please enter a valid amount"},"error");return}const p=T.bigNumber(u).div(10**t.decimals).toString();a.setToTokenAmount(p),a.hasInsufficientToken(e.sourceTokenAmount,o.address)?e.inputError="Insufficient balance":(e.inputError=void 0,a.setTransactionDetails())}catch(i){const u=await E.handleSwapError(i);e.loadingQuote=!1,e.inputError=u||"Insufficient balance"}},async getTransaction(){const{fromCaipAddress:n,availableToSwap:o}=a.getParams(),t=e.sourceToken,s=e.toToken;if(!(!n||!o||!t||!s||e.loadingQuote))try{e.loadingBuildTransaction=!0;const c=await E.fetchSwapAllowance({userAddress:n,tokenAddress:t.address,sourceTokenAmount:e.sourceTokenAmount,sourceTokenDecimals:t.decimals});let r;return c?r=await a.createSwapTransaction():r=await a.createAllowanceTransaction(),e.loadingBuildTransaction=!1,e.fetchError=!1,r}catch{I.goBack(),f.showError("Failed to check allowance"),e.loadingBuildTransaction=!1,e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}},async createAllowanceTransaction(){const{fromCaipAddress:n,sourceTokenAddress:o,toTokenAddress:t}=a.getParams();if(!(!n||!t)){if(!o)throw new Error("createAllowanceTransaction - No source token address found.");try{const s=await N.generateApproveCalldata({from:o,to:t,userAddress:n}),c=L.getPlainAddress(s.tx.from);if(!c)throw new Error("SwapController:createAllowanceTransaction - address is required");const r={data:s.tx.data,to:c,gasPrice:BigInt(s.tx.eip155.gasPrice),value:BigInt(s.tx.value),toAmount:e.toTokenAmount};return e.swapTransaction=void 0,e.approvalTransaction={data:r.data,to:r.to,gasPrice:r.gasPrice,value:r.value,toAmount:r.toAmount},{data:r.data,to:r.to,gasPrice:r.gasPrice,value:r.value,toAmount:r.toAmount}}catch{I.goBack(),f.showError("Failed to create approval transaction"),e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}}},async createSwapTransaction(){var d,l;const{networkAddress:n,fromCaipAddress:o,sourceTokenAmount:t}=a.getParams(),s=e.sourceToken,c=e.toToken;if(!o||!t||!s||!c)return;let r=(d=B.parseUnits(t,s.decimals))==null?void 0:d.toString();try{const i=s.address===n;let u=await N.generateSwapCalldata({userAddress:o,from:s.address,to:c.address,amount:r,disableEstimate:!0}),p=BigInt(u.tx.eip155.gas),w=BigInt(u.tx.eip155.gasPrice);if(i&&r){const A=(l=e.myTokensWithBalance)==null?void 0:l.find(S=>S.address===n);if(A){const S=parseInt(A.quantity.decimals,10),P=B.parseUnits(A.quantity.numeric,S)??0n,v=p*w;if(BigInt(r)+v>P){const k=P>v?P-v:0n;k>0n&&(u=await N.generateSwapCalldata({userAddress:o,from:s.address,to:c.address,amount:k.toString(),disableEstimate:!0}),r=k.toString(),p=BigInt(u.tx.eip155.gas),w=BigInt(u.tx.eip155.gasPrice))}}}const y=L.getPlainAddress(u.tx.to);if(!y)throw new Error("SwapController:createSwapTransaction - address is required");const h={data:u.tx.data,to:y,gas:p,gasPrice:w,value:BigInt(i?r??"0":"0"),toAmount:e.toTokenAmount};return e.gasPriceInUSD=C.getGasPriceInUSD(e.networkPrice,p,w),e.approvalTransaction=void 0,e.swapTransaction=h,h}catch{I.goBack(),f.showError("Failed to create transaction"),e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}},onEmbeddedWalletApprovalSuccess(){f.showLoading("Approve limit increase in your wallet"),I.replace("SwapPreview")},async sendTransactionForApproval(n){var c,r,d;const{fromAddress:o,isAuthConnector:t}=a.getParams();e.loadingApprovalTransaction=!0,t?I.pushTransactionStack({onSuccess:a.onEmbeddedWalletApprovalSuccess}):f.showLoading("Approve limit increase in your wallet");try{await B.sendTransaction({address:o,to:n.to,data:n.data,value:n.value,chainNamespace:b.CHAIN.EVM}),await a.swapTokens(),await a.getTransaction(),e.approvalTransaction=void 0,e.loadingApprovalTransaction=!1}catch(l){const i=l;e.transactionError=i==null?void 0:i.displayMessage,e.loadingApprovalTransaction=!1,f.showError((i==null?void 0:i.displayMessage)||"Transaction error"),M.sendEvent({type:"track",event:"SWAP_APPROVAL_ERROR",properties:{message:(i==null?void 0:i.displayMessage)||(i==null?void 0:i.message)||"Unknown",network:((c=m.state.activeCaipNetwork)==null?void 0:c.caipNetworkId)||"",swapFromToken:((r=a.state.sourceToken)==null?void 0:r.symbol)||"",swapToToken:((d=a.state.toToken)==null?void 0:d.symbol)||"",swapFromAmount:a.state.sourceTokenAmount||"",swapToAmount:a.state.toTokenAmount||"",isSmartAccount:F(b.CHAIN.EVM)===_.ACCOUNT_TYPES.SMART_ACCOUNT}})}},async sendTransactionForSwap(n){var d,l,i,u,p,w,y,h,A,S,P,v;if(!n)return;const{fromAddress:o,toTokenAmount:t,isAuthConnector:s}=a.getParams();e.loadingTransaction=!0;const c=`Swapping ${(d=e.sourceToken)==null?void 0:d.symbol} to ${T.formatNumberToLocalString(t,3)} ${(l=e.toToken)==null?void 0:l.symbol}`,r=`Swapped ${(i=e.sourceToken)==null?void 0:i.symbol} to ${T.formatNumberToLocalString(t,3)} ${(u=e.toToken)==null?void 0:u.symbol}`;s?I.pushTransactionStack({onSuccess(){I.replace("Account"),f.showLoading(c),D.resetState()}}):f.showLoading("Confirm transaction in your wallet");try{const U=[(p=e.sourceToken)==null?void 0:p.address,(w=e.toToken)==null?void 0:w.address].join(","),k=await B.sendTransaction({address:o,to:n.to,data:n.data,value:n.value,chainNamespace:b.CHAIN.EVM});return e.loadingTransaction=!1,f.showSuccess(r),M.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:((y=m.state.activeCaipNetwork)==null?void 0:y.caipNetworkId)||"",swapFromToken:((h=a.state.sourceToken)==null?void 0:h.symbol)||"",swapToToken:((A=a.state.toToken)==null?void 0:A.symbol)||"",swapFromAmount:a.state.sourceTokenAmount||"",swapToAmount:a.state.toTokenAmount||"",isSmartAccount:F(b.CHAIN.EVM)===_.ACCOUNT_TYPES.SMART_ACCOUNT}}),D.resetState(),s||I.replace("Account"),D.getMyTokensWithBalance(U),k}catch(U){const k=U;e.transactionError=k==null?void 0:k.displayMessage,e.loadingTransaction=!1,f.showError((k==null?void 0:k.displayMessage)||"Transaction error"),M.sendEvent({type:"track",event:"SWAP_ERROR",properties:{message:(k==null?void 0:k.displayMessage)||(k==null?void 0:k.message)||"Unknown",network:((S=m.state.activeCaipNetwork)==null?void 0:S.caipNetworkId)||"",swapFromToken:((P=a.state.sourceToken)==null?void 0:P.symbol)||"",swapToToken:((v=a.state.toToken)==null?void 0:v.symbol)||"",swapFromAmount:a.state.sourceTokenAmount||"",swapToAmount:a.state.toTokenAmount||"",isSmartAccount:F(b.CHAIN.EVM)===_.ACCOUNT_TYPES.SMART_ACCOUNT}});return}},hasInsufficientToken(n,o){return C.isInsufficientSourceTokenForSwap(n,o,e.myTokensWithBalance)},setTransactionDetails(){const{toTokenAddress:n,toTokenDecimals:o}=a.getParams();!n||!o||(e.gasPriceInUSD=C.getGasPriceInUSD(e.networkPrice,BigInt(e.gasFee),BigInt(x)),e.priceImpact=C.getPriceImpact({sourceTokenAmount:e.sourceTokenAmount,sourceTokenPriceInUSD:e.sourceTokenPriceInUSD,toTokenPriceInUSD:e.toTokenPriceInUSD,toTokenAmount:e.toTokenAmount}),e.maxSlippage=C.getMaxSlippage(e.slippage,e.toTokenAmount),e.providerFee=C.getProviderFee(e.sourceTokenAmount))}},a=G(D);export{a as S};
|
|
2
|
-
//# sourceMappingURL=SwapController-
|
|
1
|
+
import{N as T,j as G,R as I,S as f,k as B,E as M,l as F,W as _,C as m,B as N,b as L,m as E,A as O,n as z,d as W,g as R,o as H,e as V,i as q,p as $}from"./W3MFrameProviderSingleton-naTr0B5v.js";import{au as b}from"./NetworkUtil-aMprsRwC.js";(function(){try{var n=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},o=new n.Error().stack;o&&(n._sentryDebugIds=n._sentryDebugIds||{},n._sentryDebugIds[o]="d5bf39f8-0096-4633-a71d-e79393a73741",n._sentryDebugIdIdentifier="sentry-dbid-d5bf39f8-0096-4633-a71d-e79393a73741")}catch{}})();const C={getGasPriceInEther(n,o){const t=o*n;return Number(t)/1e18},getGasPriceInUSD(n,o,t){const s=C.getGasPriceInEther(o,t);return T.bigNumber(n).times(s).toNumber()},getPriceImpact({sourceTokenAmount:n,sourceTokenPriceInUSD:o,toTokenPriceInUSD:t,toTokenAmount:s}){const c=T.bigNumber(n).times(o),r=T.bigNumber(s).times(t);return c.minus(r).div(c).times(100).toNumber()},getMaxSlippage(n,o){const t=T.bigNumber(n).div(100);return T.multiply(o,t).toNumber()},getProviderFee(n,o=.0085){return T.bigNumber(n).times(o).toString()},isInsufficientNetworkTokenForGas(n,o){const t=o||"0";return T.bigNumber(n).eq(0)?!0:T.bigNumber(T.bigNumber(t)).gt(n)},isInsufficientSourceTokenForSwap(n,o,t){var r,d;const s=(d=(r=t==null?void 0:t.find(l=>l.address===o))==null?void 0:r.quantity)==null?void 0:d.numeric;return T.bigNumber(s||"0").lt(n)}},x=15e4,Q=6,g={initializing:!1,initialized:!1,loadingPrices:!1,loadingQuote:!1,loadingApprovalTransaction:!1,loadingBuildTransaction:!1,loadingTransaction:!1,switchingTokens:!1,fetchError:!1,approvalTransaction:void 0,swapTransaction:void 0,transactionError:void 0,sourceToken:void 0,sourceTokenAmount:"",sourceTokenPriceInUSD:0,toToken:void 0,toTokenAmount:"",toTokenPriceInUSD:0,networkPrice:"0",networkBalanceInUSD:"0",networkTokenSymbol:"",inputError:void 0,slippage:W.CONVERT_SLIPPAGE_TOLERANCE,tokens:void 0,popularTokens:void 0,suggestedTokens:void 0,foundTokens:void 0,myTokensWithBalance:void 0,tokensPriceMap:{},gasFee:"0",gasPriceInUSD:0,priceImpact:void 0,maxSlippage:void 0,providerFee:void 0},e=$({...g}),D={state:e,subscribe(n){return q(e,()=>n(e))},subscribeKey(n,o){return V(e,n,o)},getParams(){var i,u,p,w,y,h,A,S,P;const n=m.state.activeChain,o=((i=m.getAccountData(n))==null?void 0:i.caipAddress)??m.state.activeCaipAddress,t=L.getPlainAddress(o),s=R(),c=H.getConnectorId(m.state.activeChain);if(!t)throw new Error("No address found to swap the tokens from.");const r=!((u=e.toToken)!=null&&u.address)||!((p=e.toToken)!=null&&p.decimals),d=!((w=e.sourceToken)!=null&&w.address)||!((y=e.sourceToken)!=null&&y.decimals)||!T.bigNumber(e.sourceTokenAmount).gt(0),l=!e.sourceTokenAmount;return{networkAddress:s,fromAddress:t,fromCaipAddress:o,sourceTokenAddress:(h=e.sourceToken)==null?void 0:h.address,toTokenAddress:(A=e.toToken)==null?void 0:A.address,toTokenAmount:e.toTokenAmount,toTokenDecimals:(S=e.toToken)==null?void 0:S.decimals,sourceTokenAmount:e.sourceTokenAmount,sourceTokenDecimals:(P=e.sourceToken)==null?void 0:P.decimals,invalidToToken:r,invalidSourceToken:d,invalidSourceTokenAmount:l,availableToSwap:o&&!r&&!d&&!l,isAuthConnector:c===b.CONNECTOR_ID.AUTH}},async setSourceToken(n){if(!n){e.sourceToken=n,e.sourceTokenAmount="",e.sourceTokenPriceInUSD=0;return}e.sourceToken=n,await a.setTokenPrice(n.address,"sourceToken")},setSourceTokenAmount(n){e.sourceTokenAmount=n},async setToToken(n){if(!n){e.toToken=n,e.toTokenAmount="",e.toTokenPriceInUSD=0;return}e.toToken=n,await a.setTokenPrice(n.address,"toToken")},setToTokenAmount(n){e.toTokenAmount=n?T.toFixed(n,Q):""},async setTokenPrice(n,o){let t=e.tokensPriceMap[n]||0;t||(e.loadingPrices=!0,t=await a.getAddressPrice(n)),o==="sourceToken"?e.sourceTokenPriceInUSD=t:o==="toToken"&&(e.toTokenPriceInUSD=t),e.loadingPrices&&(e.loadingPrices=!1),a.getParams().availableToSwap&&!e.switchingTokens&&a.swapTokens()},async switchTokens(){if(!(e.initializing||!e.initialized||e.switchingTokens)){e.switchingTokens=!0;try{const n=e.toToken?{...e.toToken}:void 0,o=e.sourceToken?{...e.sourceToken}:void 0,t=n&&e.toTokenAmount===""?"1":e.toTokenAmount;a.setSourceTokenAmount(t),a.setToTokenAmount(""),await a.setSourceToken(n),await a.setToToken(o),e.switchingTokens=!1,a.swapTokens()}catch(n){throw e.switchingTokens=!1,n}}},resetState(){e.myTokensWithBalance=g.myTokensWithBalance,e.tokensPriceMap=g.tokensPriceMap,e.initialized=g.initialized,e.initializing=g.initializing,e.switchingTokens=g.switchingTokens,e.sourceToken=g.sourceToken,e.sourceTokenAmount=g.sourceTokenAmount,e.sourceTokenPriceInUSD=g.sourceTokenPriceInUSD,e.toToken=g.toToken,e.toTokenAmount=g.toTokenAmount,e.toTokenPriceInUSD=g.toTokenPriceInUSD,e.networkPrice=g.networkPrice,e.networkTokenSymbol=g.networkTokenSymbol,e.networkBalanceInUSD=g.networkBalanceInUSD,e.inputError=g.inputError},resetValues(){var t;const{networkAddress:n}=a.getParams(),o=(t=e.tokens)==null?void 0:t.find(s=>s.address===n);a.setSourceToken(o),a.setToToken(void 0)},getApprovalLoadingState(){return e.loadingApprovalTransaction},clearError(){e.transactionError=void 0},async initializeState(){if(!e.initializing){if(e.initializing=!0,!e.initialized)try{await a.fetchTokens(),e.initialized=!0}catch{e.initialized=!1,f.showError("Failed to initialize swap"),I.goBack()}e.initializing=!1}},async fetchTokens(){var t;const{networkAddress:n}=a.getParams();await a.getNetworkTokenPrice(),await a.getMyTokensWithBalance();const o=(t=e.myTokensWithBalance)==null?void 0:t.find(s=>s.address===n);o&&(e.networkTokenSymbol=o.symbol,a.setSourceToken(o),a.setSourceTokenAmount("0"))},async getTokenList(){var o,t;const n=(o=m.state.activeCaipNetwork)==null?void 0:o.caipNetworkId;if(!(e.caipNetworkId===n&&e.tokens))try{e.tokensLoading=!0;const s=await E.getTokenList(n);e.tokens=s,e.caipNetworkId=n,e.popularTokens=s.sort((i,u)=>i.symbol<u.symbol?-1:i.symbol>u.symbol?1:0);const r=(n&&((t=W.SUGGESTED_TOKENS_BY_CHAIN)==null?void 0:t[n])||[]).map(i=>s.find(u=>u.symbol===i)).filter(i=>!!i),l=(W.SWAP_SUGGESTED_TOKENS||[]).map(i=>s.find(u=>u.symbol===i)).filter(i=>!!i).filter(i=>!r.some(u=>u.address===i.address));e.suggestedTokens=[...r,...l]}catch{e.tokens=[],e.popularTokens=[],e.suggestedTokens=[]}finally{e.tokensLoading=!1}},async getAddressPrice(n){var i,u;const o=e.tokensPriceMap[n];if(o)return o;const t=await N.fetchTokenPrice({addresses:[n]}),s=(t==null?void 0:t.fungibles)||[],c=[...e.tokens||[],...e.myTokensWithBalance||[]],r=(i=c==null?void 0:c.find(p=>p.address===n))==null?void 0:i.symbol,d=((u=s.find(p=>p.symbol.toLowerCase()===(r==null?void 0:r.toLowerCase())))==null?void 0:u.price)||0,l=parseFloat(d.toString());return e.tokensPriceMap[n]=l,l},async getNetworkTokenPrice(){var c;const{networkAddress:n}=a.getParams(),t=(c=(await N.fetchTokenPrice({addresses:[n]}).catch(()=>(f.showError("Failed to fetch network token price"),{fungibles:[]}))).fungibles)==null?void 0:c[0],s=(t==null?void 0:t.price.toString())||"0";e.tokensPriceMap[n]=parseFloat(s),e.networkTokenSymbol=(t==null?void 0:t.symbol)||"",e.networkPrice=s},async getMyTokensWithBalance(n){var s;const o=await z.getMyTokensWithBalance({forceUpdate:n,caipNetwork:m.state.activeCaipNetwork,address:(s=m.getAccountData())==null?void 0:s.address}),t=E.mapBalancesToSwapTokens(o);t&&(await a.getInitialGasPrice(),a.setBalances(t))},setBalances(n){const{networkAddress:o}=a.getParams(),t=m.state.activeCaipNetwork;if(!t)return;const s=n.find(c=>c.address===o);n.forEach(c=>{e.tokensPriceMap[c.address]=c.price||0}),e.myTokensWithBalance=n.filter(c=>c.address.startsWith(t.caipNetworkId)),e.networkBalanceInUSD=s?T.multiply(s.quantity.numeric,s.price).toString():"0"},async getInitialGasPrice(){var o,t;const n=await E.fetchGasPrice();if(!n)return{gasPrice:null,gasPriceInUSD:null};switch((t=(o=m.state)==null?void 0:o.activeCaipNetwork)==null?void 0:t.chainNamespace){case b.CHAIN.SOLANA:return e.gasFee=n.standard??"0",e.gasPriceInUSD=T.multiply(n.standard,e.networkPrice).div(1e9).toNumber(),{gasPrice:BigInt(e.gasFee),gasPriceInUSD:Number(e.gasPriceInUSD)};case b.CHAIN.EVM:default:const s=n.standard??"0",c=BigInt(s),r=BigInt(x),d=C.getGasPriceInUSD(e.networkPrice,r,c);return e.gasFee=s,e.gasPriceInUSD=d,{gasPrice:c,gasPriceInUSD:d}}},async swapTokens(){var r,d,l;const n=(r=m.getAccountData())==null?void 0:r.address,o=e.sourceToken,t=e.toToken,s=T.bigNumber(e.sourceTokenAmount).gt(0);if(s||a.setToTokenAmount(""),!t||!o||e.loadingPrices||!s||!n)return;e.loadingQuote=!0;const c=T.bigNumber(e.sourceTokenAmount).times(10**o.decimals).round(0).toFixed(0);try{const i=await N.fetchSwapQuote({userAddress:n,from:o.address,to:t.address,gasPrice:e.gasFee,amount:c.toString()});e.loadingQuote=!1;const u=(l=(d=i==null?void 0:i.quotes)==null?void 0:d[0])==null?void 0:l.toAmount;if(!u){O.open({displayMessage:"Incorrect amount",debugMessage:"Please enter a valid amount"},"error");return}const p=T.bigNumber(u).div(10**t.decimals).toString();a.setToTokenAmount(p),a.hasInsufficientToken(e.sourceTokenAmount,o.address)?e.inputError="Insufficient balance":(e.inputError=void 0,a.setTransactionDetails())}catch(i){const u=await E.handleSwapError(i);e.loadingQuote=!1,e.inputError=u||"Insufficient balance"}},async getTransaction(){const{fromCaipAddress:n,availableToSwap:o}=a.getParams(),t=e.sourceToken,s=e.toToken;if(!(!n||!o||!t||!s||e.loadingQuote))try{e.loadingBuildTransaction=!0;const c=await E.fetchSwapAllowance({userAddress:n,tokenAddress:t.address,sourceTokenAmount:e.sourceTokenAmount,sourceTokenDecimals:t.decimals});let r;return c?r=await a.createSwapTransaction():r=await a.createAllowanceTransaction(),e.loadingBuildTransaction=!1,e.fetchError=!1,r}catch{I.goBack(),f.showError("Failed to check allowance"),e.loadingBuildTransaction=!1,e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}},async createAllowanceTransaction(){const{fromCaipAddress:n,sourceTokenAddress:o,toTokenAddress:t}=a.getParams();if(!(!n||!t)){if(!o)throw new Error("createAllowanceTransaction - No source token address found.");try{const s=await N.generateApproveCalldata({from:o,to:t,userAddress:n}),c=L.getPlainAddress(s.tx.from);if(!c)throw new Error("SwapController:createAllowanceTransaction - address is required");const r={data:s.tx.data,to:c,gasPrice:BigInt(s.tx.eip155.gasPrice),value:BigInt(s.tx.value),toAmount:e.toTokenAmount};return e.swapTransaction=void 0,e.approvalTransaction={data:r.data,to:r.to,gasPrice:r.gasPrice,value:r.value,toAmount:r.toAmount},{data:r.data,to:r.to,gasPrice:r.gasPrice,value:r.value,toAmount:r.toAmount}}catch{I.goBack(),f.showError("Failed to create approval transaction"),e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}}},async createSwapTransaction(){var d,l;const{networkAddress:n,fromCaipAddress:o,sourceTokenAmount:t}=a.getParams(),s=e.sourceToken,c=e.toToken;if(!o||!t||!s||!c)return;let r=(d=B.parseUnits(t,s.decimals))==null?void 0:d.toString();try{const i=s.address===n;let u=await N.generateSwapCalldata({userAddress:o,from:s.address,to:c.address,amount:r,disableEstimate:!0}),p=BigInt(u.tx.eip155.gas),w=BigInt(u.tx.eip155.gasPrice);if(i&&r){const A=(l=e.myTokensWithBalance)==null?void 0:l.find(S=>S.address===n);if(A){const S=parseInt(A.quantity.decimals,10),P=B.parseUnits(A.quantity.numeric,S)??0n,v=p*w;if(BigInt(r)+v>P){const k=P>v?P-v:0n;k>0n&&(u=await N.generateSwapCalldata({userAddress:o,from:s.address,to:c.address,amount:k.toString(),disableEstimate:!0}),r=k.toString(),p=BigInt(u.tx.eip155.gas),w=BigInt(u.tx.eip155.gasPrice))}}}const y=L.getPlainAddress(u.tx.to);if(!y)throw new Error("SwapController:createSwapTransaction - address is required");const h={data:u.tx.data,to:y,gas:p,gasPrice:w,value:BigInt(i?r??"0":"0"),toAmount:e.toTokenAmount};return e.gasPriceInUSD=C.getGasPriceInUSD(e.networkPrice,p,w),e.approvalTransaction=void 0,e.swapTransaction=h,h}catch{I.goBack(),f.showError("Failed to create transaction"),e.approvalTransaction=void 0,e.swapTransaction=void 0,e.fetchError=!0;return}},onEmbeddedWalletApprovalSuccess(){f.showLoading("Approve limit increase in your wallet"),I.replace("SwapPreview")},async sendTransactionForApproval(n){var c,r,d;const{fromAddress:o,isAuthConnector:t}=a.getParams();e.loadingApprovalTransaction=!0,t?I.pushTransactionStack({onSuccess:a.onEmbeddedWalletApprovalSuccess}):f.showLoading("Approve limit increase in your wallet");try{await B.sendTransaction({address:o,to:n.to,data:n.data,value:n.value,chainNamespace:b.CHAIN.EVM}),await a.swapTokens(),await a.getTransaction(),e.approvalTransaction=void 0,e.loadingApprovalTransaction=!1}catch(l){const i=l;e.transactionError=i==null?void 0:i.displayMessage,e.loadingApprovalTransaction=!1,f.showError((i==null?void 0:i.displayMessage)||"Transaction error"),M.sendEvent({type:"track",event:"SWAP_APPROVAL_ERROR",properties:{message:(i==null?void 0:i.displayMessage)||(i==null?void 0:i.message)||"Unknown",network:((c=m.state.activeCaipNetwork)==null?void 0:c.caipNetworkId)||"",swapFromToken:((r=a.state.sourceToken)==null?void 0:r.symbol)||"",swapToToken:((d=a.state.toToken)==null?void 0:d.symbol)||"",swapFromAmount:a.state.sourceTokenAmount||"",swapToAmount:a.state.toTokenAmount||"",isSmartAccount:F(b.CHAIN.EVM)===_.ACCOUNT_TYPES.SMART_ACCOUNT}})}},async sendTransactionForSwap(n){var d,l,i,u,p,w,y,h,A,S,P,v;if(!n)return;const{fromAddress:o,toTokenAmount:t,isAuthConnector:s}=a.getParams();e.loadingTransaction=!0;const c=`Swapping ${(d=e.sourceToken)==null?void 0:d.symbol} to ${T.formatNumberToLocalString(t,3)} ${(l=e.toToken)==null?void 0:l.symbol}`,r=`Swapped ${(i=e.sourceToken)==null?void 0:i.symbol} to ${T.formatNumberToLocalString(t,3)} ${(u=e.toToken)==null?void 0:u.symbol}`;s?I.pushTransactionStack({onSuccess(){I.replace("Account"),f.showLoading(c),D.resetState()}}):f.showLoading("Confirm transaction in your wallet");try{const U=[(p=e.sourceToken)==null?void 0:p.address,(w=e.toToken)==null?void 0:w.address].join(","),k=await B.sendTransaction({address:o,to:n.to,data:n.data,value:n.value,chainNamespace:b.CHAIN.EVM});return e.loadingTransaction=!1,f.showSuccess(r),M.sendEvent({type:"track",event:"SWAP_SUCCESS",properties:{network:((y=m.state.activeCaipNetwork)==null?void 0:y.caipNetworkId)||"",swapFromToken:((h=a.state.sourceToken)==null?void 0:h.symbol)||"",swapToToken:((A=a.state.toToken)==null?void 0:A.symbol)||"",swapFromAmount:a.state.sourceTokenAmount||"",swapToAmount:a.state.toTokenAmount||"",isSmartAccount:F(b.CHAIN.EVM)===_.ACCOUNT_TYPES.SMART_ACCOUNT}}),D.resetState(),s||I.replace("Account"),D.getMyTokensWithBalance(U),k}catch(U){const k=U;e.transactionError=k==null?void 0:k.displayMessage,e.loadingTransaction=!1,f.showError((k==null?void 0:k.displayMessage)||"Transaction error"),M.sendEvent({type:"track",event:"SWAP_ERROR",properties:{message:(k==null?void 0:k.displayMessage)||(k==null?void 0:k.message)||"Unknown",network:((S=m.state.activeCaipNetwork)==null?void 0:S.caipNetworkId)||"",swapFromToken:((P=a.state.sourceToken)==null?void 0:P.symbol)||"",swapToToken:((v=a.state.toToken)==null?void 0:v.symbol)||"",swapFromAmount:a.state.sourceTokenAmount||"",swapToAmount:a.state.toTokenAmount||"",isSmartAccount:F(b.CHAIN.EVM)===_.ACCOUNT_TYPES.SMART_ACCOUNT}});return}},hasInsufficientToken(n,o){return C.isInsufficientSourceTokenForSwap(n,o,e.myTokensWithBalance)},setTransactionDetails(){const{toTokenAddress:n,toTokenDecimals:o}=a.getParams();!n||!o||(e.gasPriceInUSD=C.getGasPriceInUSD(e.networkPrice,BigInt(e.gasFee),BigInt(x)),e.priceImpact=C.getPriceImpact({sourceTokenAmount:e.sourceTokenAmount,sourceTokenPriceInUSD:e.sourceTokenPriceInUSD,toTokenPriceInUSD:e.toTokenPriceInUSD,toTokenAmount:e.toTokenAmount}),e.maxSlippage=C.getMaxSlippage(e.slippage,e.toTokenAmount),e.providerFee=C.getProviderFee(e.sourceTokenAmount))}},a=G(D);export{a as S};
|
|
2
|
+
//# sourceMappingURL=SwapController-C6MSYEZI.js.map
|