diff --git a/client/package.json b/client/package.json index fde65223..b5c386f2 100644 --- a/client/package.json +++ b/client/package.json @@ -17,7 +17,8 @@ "preview": "vite preview", "codegen": "graphql-codegen", "gen:models": "npx create-models ../contracts/manifests/dev/manifest.json ./src/dojo/generated/contractModels.ts", - "test": "jest" + "test": "vitest", + "test:watch": "vitest watch" }, "bin": { "create-models": "./bin/models.cjs" @@ -97,7 +98,8 @@ "@graphql-codegen/typescript": "^4.0.7", "@graphql-codegen/typescript-graphql-request": "^5.0.0", "@graphql-codegen/typescript-operations": "^4.2.1", - "@types/jest": "^29.5.12", + "@testing-library/jest-dom": "^6.6.3", + "@testing-library/react": "^16.0.1", "@types/node": "^20.16.6", "@types/react": "^18.3.9", "@types/react-dom": "^18.3.0", @@ -108,12 +110,13 @@ "eslint": "^8.57.0", "eslint-plugin-react-hooks": "^4.6.2", "eslint-plugin-react-refresh": "^0.3.5", - "jest": "^29.7.0", + "jsdom": "^25.0.1", "postcss": "^8.4.38", "tailwindcss": "^3.4.4", "ts-jest": "^29.2.5", "typescript": "^5.6.2", "vite": "^4.5.5", - "vite-plugin-mkcert": "^1.17.5" + "vite-plugin-mkcert": "^1.17.5", + "vitest": "^2.1.4" } } diff --git a/client/pnpm-lock.yaml b/client/pnpm-lock.yaml index f7a65157..9855770d 100644 --- a/client/pnpm-lock.yaml +++ b/client/pnpm-lock.yaml @@ -22,13 +22,13 @@ importers: version: 1.0.0-alpha.24(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(starknet@6.11.0(encoding@0.1.13))(typescript@5.6.2) '@dojoengine/react': specifier: 1.0.0-alpha.24 - version: 1.0.0-alpha.24(@types/node@20.17.6)(@types/react@18.3.12)(react@18.3.1)(starknet@6.11.0(encoding@0.1.13))(terser@5.31.1)(type-fest@2.19.0)(typescript@5.6.2)(zod@3.23.8) + version: 1.0.0-alpha.24(@types/node@20.17.6)(@types/react@18.3.12)(jsdom@25.0.1)(react@18.3.1)(starknet@6.11.0(encoding@0.1.13))(terser@5.31.1)(type-fest@2.19.0)(typescript@5.6.2)(zod@3.23.8) '@dojoengine/recs': specifier: 2.0.13 version: 2.0.13(typescript@5.6.2)(zod@3.23.8) '@dojoengine/state': specifier: 1.0.0-alpha.24 - version: 1.0.0-alpha.24(@types/node@20.17.6)(starknet@6.11.0(encoding@0.1.13))(terser@5.31.1)(typescript@5.6.2)(zod@3.23.8) + version: 1.0.0-alpha.24(@types/node@20.17.6)(jsdom@25.0.1)(starknet@6.11.0(encoding@0.1.13))(terser@5.31.1)(typescript@5.6.2)(zod@3.23.8) '@dojoengine/torii-client': specifier: 1.0.0-alpha.24 version: 1.0.0-alpha.24 @@ -225,9 +225,12 @@ importers: '@graphql-codegen/typescript-operations': specifier: ^4.2.1 version: 4.2.1(encoding@0.1.13)(graphql@16.8.2) - '@types/jest': - specifier: ^29.5.12 - version: 29.5.12 + '@testing-library/jest-dom': + specifier: ^6.6.3 + version: 6.6.3 + '@testing-library/react': + specifier: ^16.0.1 + version: 16.0.1(@testing-library/dom@10.4.0)(@types/react-dom@18.3.0)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@types/node': specifier: ^20.16.6 version: 20.17.6 @@ -258,9 +261,9 @@ importers: eslint-plugin-react-refresh: specifier: ^0.3.5 version: 0.3.5(eslint@8.57.0) - jest: - specifier: ^29.7.0 - version: 29.7.0(@types/node@20.17.6)(babel-plugin-macros@3.1.0) + jsdom: + specifier: ^25.0.1 + version: 25.0.1 postcss: specifier: ^8.4.38 version: 8.4.38 @@ -279,9 +282,15 @@ importers: vite-plugin-mkcert: specifier: ^1.17.5 version: 1.17.5(vite@4.5.5(@types/node@20.17.6)(terser@5.31.1)) + vitest: + specifier: ^2.1.4 + version: 2.1.4(@types/node@20.17.6)(jsdom@25.0.1)(terser@5.31.1) packages: + '@adobe/css-tools@4.4.0': + resolution: {integrity: sha512-Ff9+ksdQQB3rMncgqDK78uLznstjyfIf2Arnh22pW8kBpLs6rpKDwgnZT46hin5Hl1WzazzK64DOrhSwYpS7bQ==} + '@adraffy/ens-normalize@1.10.0': resolution: {integrity: sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==} @@ -3224,6 +3233,29 @@ packages: '@telegram-apps/types@1.0.1': resolution: {integrity: sha512-8tGy1zG/1MEt0KF8nR0ffZ93whKveEJIkBI+qxHCRgatKwKVJV2dVSXrrBspFKn7FIIo1/CvmB8zP4vKPzglbg==} + '@testing-library/dom@10.4.0': + resolution: {integrity: sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==} + engines: {node: '>=18'} + + '@testing-library/jest-dom@6.6.3': + resolution: {integrity: sha512-IteBhl4XqYNkM54f4ejhLRJiZNqcSCoXUOG2CPK7qbD322KjQozM4kHQOfkG2oln9b9HTYqs+Sae8vBATubxxA==} + engines: {node: '>=14', npm: '>=6', yarn: '>=1'} + + '@testing-library/react@16.0.1': + resolution: {integrity: sha512-dSmwJVtJXmku+iocRhWOUFbrERC76TX2Mnf0ATODz8brzAZrMBbzLwQixlBSanZxR6LddK3eiwpSFZgDET1URg==} + engines: {node: '>=18'} + peerDependencies: + '@testing-library/dom': ^10.0.0 + '@types/react': ^18.0.0 + '@types/react-dom': ^18.0.0 + react: ^18.0.0 + react-dom: ^18.0.0 + peerDependenciesMeta: + '@types/react': + optional: true + '@types/react-dom': + optional: true + '@tsparticles/basic@3.5.0': resolution: {integrity: sha512-oty33TxM2aHWrzcwWRic1bQ04KBCdpnvzv8JXEkx5Uyp70vgVegUbtKmwGki3shqKZIt3v2qE4I8NsK6onhLrA==} @@ -3363,6 +3395,9 @@ packages: '@tsparticles/updater-wobble@3.5.0': resolution: {integrity: sha512-fpN0XPvAf3dJ5UU++C+ETVDLurpnkzje02w865Ar4ubPBgGpMhowr6AbtFUe37Zl8rFUTYntBOSEoxqNYJAUgQ==} + '@types/aria-query@5.0.4': + resolution: {integrity: sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==} + '@types/babel__core@7.20.5': resolution: {integrity: sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==} @@ -3420,9 +3455,6 @@ packages: '@types/istanbul-reports@3.0.4': resolution: {integrity: sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==} - '@types/jest@29.5.12': - resolution: {integrity: sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw==} - '@types/js-yaml@4.0.9': resolution: {integrity: sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg==} @@ -3541,18 +3573,47 @@ packages: '@vitest/expect@1.6.0': resolution: {integrity: sha512-ixEvFVQjycy/oNgHjqsL6AZCDduC+tflRluaHIzKIsdbzkLn2U/iBnVeJwB6HsIjQBdfMR8Z0tRxKUsvFJEeWQ==} + '@vitest/expect@2.1.4': + resolution: {integrity: sha512-DOETT0Oh1avie/D/o2sgMHGrzYUFFo3zqESB2Hn70z6QB1HrS2IQ9z5DfyTqU8sg4Bpu13zZe9V4+UTNQlUeQA==} + + '@vitest/mocker@2.1.4': + resolution: {integrity: sha512-Ky/O1Lc0QBbutJdW0rqLeFNbuLEyS+mIPiNdlVlp2/yhJ0SbyYqObS5IHdhferJud8MbbwMnexg4jordE5cCoQ==} + peerDependencies: + msw: ^2.4.9 + vite: ^5.0.0 + peerDependenciesMeta: + msw: + optional: true + vite: + optional: true + + '@vitest/pretty-format@2.1.4': + resolution: {integrity: sha512-L95zIAkEuTDbUX1IsjRl+vyBSLh3PwLLgKpghl37aCK9Jvw0iP+wKwIFhfjdUtA2myLgjrG6VU6JCFLv8q/3Ww==} + '@vitest/runner@1.6.0': resolution: {integrity: sha512-P4xgwPjwesuBiHisAVz/LSSZtDjOTPYZVmNAnpHHSR6ONrf8eCJOFRvUwdHn30F5M1fxhqtl7QZQUk2dprIXAg==} + '@vitest/runner@2.1.4': + resolution: {integrity: sha512-sKRautINI9XICAMl2bjxQM8VfCMTB0EbsBc/EDFA57V6UQevEKY/TOPOF5nzcvCALltiLfXWbq4MaAwWx/YxIA==} + '@vitest/snapshot@1.6.0': resolution: {integrity: sha512-+Hx43f8Chus+DCmygqqfetcAZrDJwvTj0ymqjQq4CvmpKFSTVteEOBzCusu1x2tt4OJcvBflyHUE0DZSLgEMtQ==} + '@vitest/snapshot@2.1.4': + resolution: {integrity: sha512-3Kab14fn/5QZRog5BPj6Rs8dc4B+mim27XaKWFWHWA87R56AKjHTGcBFKpvZKDzC4u5Wd0w/qKsUIio3KzWW4Q==} + '@vitest/spy@1.6.0': resolution: {integrity: sha512-leUTap6B/cqi/bQkXUu6bQV5TZPx7pmMBKBQiI0rJA8c3pB56ZsaTbREnF7CJfmvAS4V2cXIBAh/3rVwrrCYgw==} + '@vitest/spy@2.1.4': + resolution: {integrity: sha512-4JOxa+UAizJgpZfaCPKK2smq9d8mmjZVPMt2kOsg/R8QkoRzydHH1qHxIYNvr1zlEaFj4SXiaaJWxq/LPLKaLg==} + '@vitest/utils@1.6.0': resolution: {integrity: sha512-21cPiuGMoMZwiOHa2i4LXkMkMkCGzA+MVFV70jRwHo95dL4x/ts5GZhML1QWuy7yfp3WzK3lRvZi3JnXTYqrBw==} + '@vitest/utils@2.1.4': + resolution: {integrity: sha512-MXDnZn0Awl2S86PSNIim5PWXgIAx8CIkzu35mBdSApUip6RFOGXBCf3YFyeEu8n1IHk4bWD46DeYFu9mQlFIRg==} + '@whatwg-node/events@0.0.3': resolution: {integrity: sha512-IqnKIDWfXBJkvy/k6tzskWTc2NK3LcqHlb+KHGCrjOCH4jfQckRX0NAiIcC/vIqQkzLYw2r2CTSwAxcrtcD6lA==} @@ -3685,6 +3746,13 @@ packages: resolution: {integrity: sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A==} engines: {node: '>=10'} + aria-query@5.3.0: + resolution: {integrity: sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==} + + aria-query@5.3.2: + resolution: {integrity: sha512-COROpnaoap1E2F000S62r6A60uHZnmlvomhfyT2DlTcrY1OrBKn2UhH7qn5wTC9zMvD0AY7csdPSNwKP+7WiQw==} + engines: {node: '>= 0.4'} + arktype@2.0.0-beta.6: resolution: {integrity: sha512-tbH5/h0z371sgrJIAhZhH2BcrErWv8uQIPVcLmknJ8ffov5/ZbMNufrQ3hG9avGKTcVnVmdQoPhl1WuKuagqXA==} @@ -3710,6 +3778,10 @@ packages: assertion-error@1.1.0: resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + astral-regex@2.0.0: resolution: {integrity: sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==} engines: {node: '>=8'} @@ -3918,10 +3990,18 @@ packages: resolution: {integrity: sha512-RITGBfijLkBddZvnn8jdqoTypxvqbOLYQkGGxXzeFjVHvudaPw0HNFD9x928/eUwYWd2dPCugVqspGALTZZQKw==} engines: {node: '>=4'} + chai@5.1.2: + resolution: {integrity: sha512-aGtmf24DW6MLHHG5gCx4zaI3uBq3KRtxeVs0DjFH6Z0rDNbsvTxFASFvdj79pxjxZ8/5u3PIiN3IwEIQkiiuPw==} + engines: {node: '>=12'} + chalk@2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} engines: {node: '>=4'} + chalk@3.0.0: + resolution: {integrity: sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==} + engines: {node: '>=8'} + chalk@4.1.2: resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==} engines: {node: '>=10'} @@ -3945,6 +4025,10 @@ packages: check-error@1.0.3: resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} + check-error@2.1.1: + resolution: {integrity: sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==} + engines: {node: '>= 16'} + chokidar@3.6.0: resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} engines: {node: '>= 8.10.0'} @@ -4096,11 +4180,18 @@ packages: css-mediaquery@0.1.2: resolution: {integrity: sha512-COtn4EROW5dBGlE/4PiKnh6rZpAPxDeFLaEEwt4i10jpDMFt2EhQGS79QmmrO+iKCHv0PU/HrOWEhijFd1x99Q==} + css.escape@1.5.1: + resolution: {integrity: sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==} + cssesc@3.0.0: resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==} engines: {node: '>=4'} hasBin: true + cssstyle@4.1.0: + resolution: {integrity: sha512-h66W1URKpBS5YMI/V8PyXvTMFT8SupJ1IzoIV8IeBC/ji8WVmrO8dGlTi+2dh6whmdk6BiKJLD/ZBkhWbcg6nA==} + engines: {node: '>=18'} + csstype@3.1.3: resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} @@ -4148,6 +4239,10 @@ packages: resolution: {integrity: sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==} engines: {node: '>=12'} + data-urls@5.0.0: + resolution: {integrity: sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==} + engines: {node: '>=18'} + data-view-buffer@1.0.1: resolution: {integrity: sha512-0lht7OugA5x3iJLOWFhWK/5ehONdprk0ISXqVFn/NFrDu+cuc8iADFrGQz5BnRK7LLU3JmkbXSxaqX+/mXYtUA==} engines: {node: '>= 0.4'} @@ -4178,6 +4273,15 @@ packages: supports-color: optional: true + debug@4.3.7: + resolution: {integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + decamelize@1.2.0: resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==} engines: {node: '>=0.10.0'} @@ -4204,6 +4308,10 @@ packages: resolution: {integrity: sha512-SUwdGfqdKOwxCPeVYjwSyRpJ7Z+fhpwIAtmCUdZIWZ/YP5R9WAsyuSgpLVDi9bjWoN2LXHNss/dk3urXtdQxGg==} engines: {node: '>=6'} + deep-eql@5.0.2: + resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} + engines: {node: '>=6'} + deep-is@0.1.4: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} @@ -4233,6 +4341,10 @@ packages: deprecation@2.3.1: resolution: {integrity: sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==} + dequal@2.0.3: + resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} + engines: {node: '>=6'} + detect-indent@6.1.0: resolution: {integrity: sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==} engines: {node: '>=8'} @@ -4266,6 +4378,12 @@ packages: resolution: {integrity: sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==} engines: {node: '>=6.0.0'} + dom-accessibility-api@0.5.16: + resolution: {integrity: sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==} + + dom-accessibility-api@0.6.3: + resolution: {integrity: sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==} + dom-helpers@5.2.1: resolution: {integrity: sha512-nRCa7CK3VTrM2NmGkIy4cbK7IZlgBE/PYMn55rrXefr5xXDP0LdtfPnblFDoVdcAfslJ7or6iqAUnx0CCGIWQA==} @@ -4323,6 +4441,10 @@ packages: encoding@0.1.13: resolution: {integrity: sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==} + entities@4.5.0: + resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} + engines: {node: '>=0.12'} + error-ex@1.3.2: resolution: {integrity: sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==} @@ -4479,6 +4601,10 @@ packages: resolution: {integrity: sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==} engines: {node: '>= 0.8.0'} + expect-type@1.1.0: + resolution: {integrity: sha512-bFi65yM+xZgk+u/KRIpekdSYkTB5W1pEf0Lt8Q8Msh7b+eQ7LXVtIB1Bkm4fvclDEL1b2CZkMhv2mOeF8tMdkA==} + engines: {node: '>=12.0.0'} + expect@29.7.0: resolution: {integrity: sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -4803,6 +4929,10 @@ packages: howler@2.2.4: resolution: {integrity: sha512-iARIBPgcQrwtEr+tALF+rapJ8qSc+Set2GJQl7xT1MQzWaVkFebdJhR3alVlSiUf5U7nAANKuj3aWpwerocD5w==} + html-encoding-sniffer@4.0.0: + resolution: {integrity: sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==} + engines: {node: '>=18'} + html-escaper@2.0.2: resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} @@ -4988,6 +5118,9 @@ packages: resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} engines: {node: '>=8'} + is-potential-custom-element-name@1.0.1: + resolution: {integrity: sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==} + is-regex@1.1.4: resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} engines: {node: '>= 0.4'} @@ -5259,6 +5392,15 @@ packages: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true + jsdom@25.0.1: + resolution: {integrity: sha512-8i7LzZj7BF8uplX+ZyOlIz86V6TAsSs+np6m1kpW9u0JWi4z/1t+FzcK1aek+ybTnAC4KhBL4uXCNT0wcUIeCw==} + engines: {node: '>=18'} + peerDependencies: + canvas: ^2.11.2 + peerDependenciesMeta: + canvas: + optional: true + jsesc@0.5.0: resolution: {integrity: sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==} hasBin: true @@ -5386,6 +5528,9 @@ packages: loupe@2.3.7: resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} + loupe@3.1.2: + resolution: {integrity: sha512-23I4pFZHmAemUnz8WZXbYRSKYj801VDaNv9ETuMh7IrMc7VuVVSo+Z9iLE3ni30+U48iDWfi30d3twAXBYmnCg==} + lower-case-first@2.0.2: resolution: {integrity: sha512-EVm/rR94FJTZi3zefZ82fLWab+GX14LJN4HrWBcuo6Evmsl9hEfnqxgcHCKb9q+mNf6EVdsjx/qucYFIIB84pg==} @@ -5404,12 +5549,19 @@ packages: peerDependencies: react: ^16.5.1 || ^17.0.0 || ^18.0.0 + lz-string@1.5.0: + resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} + hasBin: true + magic-string@0.25.9: resolution: {integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==} magic-string@0.30.11: resolution: {integrity: sha512-+Wri9p0QHMy+545hKww7YAu5NyzF8iomPL/RQazugQ9+Ez4Ic3mERMd8ZTX5rfK944j+560ZJi8iAwgak1Ac7A==} + magic-string@0.30.12: + resolution: {integrity: sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==} + make-dir@4.0.0: resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} engines: {node: '>=10'} @@ -5471,6 +5623,10 @@ packages: resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} engines: {node: '>=12'} + min-indent@1.0.1: + resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==} + engines: {node: '>=4'} + minimalistic-assert@1.0.1: resolution: {integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==} @@ -5505,6 +5661,9 @@ packages: ms@2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + mute-stream@0.0.8: resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==} @@ -5576,6 +5735,9 @@ packages: nullthrows@1.1.1: resolution: {integrity: sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw==} + nwsapi@2.2.13: + resolution: {integrity: sha512-cTGB9ptp9dY9A5VbMSe7fQBcl/tt22Vcqdq8+eN93rblOuE0aCFu4aZ2vMwct/2t+lFnosm8RkQW1I0Omb1UtQ==} + object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} @@ -5688,6 +5850,9 @@ packages: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} + parse5@7.2.1: + resolution: {integrity: sha512-BuBYQYlv1ckiPdQi/ohiivi9Sagc9JG+Ozs0r7b/0iK3sKmrb0b9FdWdBbOdx6hBCM/F9Ir82ofnBhtZOjCRPQ==} + pascal-case@3.1.2: resolution: {integrity: sha512-uWlGT3YSnK9x3BQJaOdcZwrnV6hPpd8jFH1/ucpiLRPh/2zCVJKS19E4GvYHvaCcACn3foXZ0cLB9Wrx1KGe5g==} @@ -5739,6 +5904,10 @@ packages: pathval@1.1.1: resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} + pathval@2.0.0: + resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} + engines: {node: '>= 14.16'} + picocolors@1.0.1: resolution: {integrity: sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==} @@ -5836,6 +6005,10 @@ packages: resolution: {integrity: sha512-mQUvGU6aUFQ+rNvTIAcZuWGRT9a6f6Yrg9bHs4ImKF+HZCEK+plBvnAZYSIQztknZF2qnzNtr6F8s0+IuptdlQ==} engines: {node: ^14.13.1 || >=16.0.0} + pretty-format@27.5.1: + resolution: {integrity: sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==} + engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} + pretty-format@29.7.0: resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -5897,6 +6070,9 @@ packages: react-is@16.13.1: resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} + react-is@17.0.2: + resolution: {integrity: sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==} + react-is@18.3.1: resolution: {integrity: sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==} @@ -5996,6 +6172,10 @@ packages: react: ^16.0.0 || ^17.0.0 || ^18.0.0 react-dom: ^16.0.0 || ^17.0.0 || ^18.0.0 + redent@3.0.0: + resolution: {integrity: sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==} + engines: {node: '>=8'} + redeyed@2.1.1: resolution: {integrity: sha512-FNpGGo1DycYAdnrKFxCMmKYgo/mILAqtRYbkdQD8Ep/Hk2PQ5+aEAEx+IU713RTDmuBaH0c8P5ZozurNu5ObRQ==} @@ -6105,6 +6285,9 @@ packages: engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true + rrweb-cssom@0.7.1: + resolution: {integrity: sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg==} + run-async@2.4.1: resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==} engines: {node: '>=0.12.0'} @@ -6132,6 +6315,10 @@ packages: safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} + saxes@6.0.0: + resolution: {integrity: sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==} + engines: {node: '>=v12.22.7'} + scheduler@0.23.2: resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==} @@ -6360,6 +6547,10 @@ packages: resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==} engines: {node: '>=12'} + strip-indent@3.0.0: + resolution: {integrity: sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==} + engines: {node: '>=8'} + strip-json-comments@3.1.1: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} @@ -6394,6 +6585,9 @@ packages: swap-case@2.0.2: resolution: {integrity: sha512-kc6S2YS/2yXbtkSMunBtKdah4VFETZ8Oh6ONSmSd9bRxhqTrtARUCBUiWXH3xVPpvR7tz2CSnkuXVE42EcGnMw==} + symbol-tree@3.2.4: + resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==} + tabbable@6.2.0: resolution: {integrity: sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==} @@ -6449,17 +6643,39 @@ packages: tinybench@2.9.0: resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + tinyexec@0.3.1: + resolution: {integrity: sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ==} + tinypool@0.8.4: resolution: {integrity: sha512-i11VH5gS6IFeLY3gMBQ00/MmLncVP7JLXOw1vlgkytLmJK7QnEr7NXf0LBdxfmNPAeyetukOk0bOYrJrFGjYJQ==} engines: {node: '>=14.0.0'} + tinypool@1.0.1: + resolution: {integrity: sha512-URZYihUbRPcGv95En+sz6MfghfIc2OJ1sv/RmhWZLouPY0/8Vo80viwPvg3dlaS9fuq7fQMEfgRRK7BBZThBEA==} + engines: {node: ^18.0.0 || >=20.0.0} + + tinyrainbow@1.2.0: + resolution: {integrity: sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==} + engines: {node: '>=14.0.0'} + tinyspy@2.2.1: resolution: {integrity: sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==} engines: {node: '>=14.0.0'} + tinyspy@3.0.2: + resolution: {integrity: sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==} + engines: {node: '>=14.0.0'} + title-case@3.0.3: resolution: {integrity: sha512-e1zGYRvbffpcHIrnuqT0Dh+gEJtDaxDSoG4JAIpq4oDFyooziLBIiYQv0GBT4FUAnUop5uZ1hiIAj7oAF6sOCA==} + tldts-core@6.1.60: + resolution: {integrity: sha512-XHjoxak8SFQnHnmYHb3PcnW5TZ+9ErLZemZei3azuIRhQLw4IExsVbL3VZJdHcLeNaXq6NqawgpDPpjBOg4B5g==} + + tldts@6.1.60: + resolution: {integrity: sha512-TYVHm7G9NCnhgqOsFalbX6MG1Po5F4efF+tLfoeiOGQq48Oqgwcgz8upY2R1BHWa4aDrj28RYx0dkYJ63qCFMg==} + hasBin: true + tmp@0.0.33: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} engines: {node: '>=0.6.0'} @@ -6479,12 +6695,20 @@ packages: resolution: {integrity: sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==} engines: {node: '>=6'} + tough-cookie@5.0.0: + resolution: {integrity: sha512-FRKsF7cz96xIIeMZ82ehjC3xW2E+O2+v11udrDYewUbszngYhsGa8z6YUMMzO9QJZzzyd0nGGXnML/TReX6W8Q==} + engines: {node: '>=16'} + tr46@0.0.3: resolution: {integrity: sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==} tr46@1.0.1: resolution: {integrity: sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==} + tr46@5.0.0: + resolution: {integrity: sha512-tk2G5R2KRwBd+ZN0zaEXpmzdKyOYksXwywulIX95MBODjSzMIuQnQ3m8JxgbhnL1LeVo7lqQKsYa1O3Htl7K5g==} + engines: {node: '>=18'} + ts-interface-checker@0.1.13: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} @@ -6752,6 +6976,11 @@ packages: engines: {node: ^18.0.0 || >=20.0.0} hasBin: true + vite-node@2.1.4: + resolution: {integrity: sha512-kqa9v+oi4HwkG6g8ufRnb5AeplcRw8jUF6/7/Qz1qRQOXHImG8YnLbB+LLszENwFnoBl9xIf9nVdCFzNd7GQEg==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + vite-plugin-mkcert@1.17.5: resolution: {integrity: sha512-KKGY3iHx/9zb7ow8JJ+nLN2HiNIBuPBwj34fJ+jAJT89/8qfk7msO7G7qipR8VDEm9xMCys0xT11QOJbZcg3/Q==} engines: {node: '>=v16.7.0'} @@ -6864,6 +7093,35 @@ packages: jsdom: optional: true + vitest@2.1.4: + resolution: {integrity: sha512-eDjxbVAJw1UJJCHr5xr/xM86Zx+YxIEXGAR+bmnEID7z9qWfoxpHw0zdobz+TQAFOLT+nEXz3+gx6nUJ7RgmlQ==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@types/node': ^18.0.0 || >=20.0.0 + '@vitest/browser': 2.1.4 + '@vitest/ui': 2.1.4 + happy-dom: '*' + jsdom: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@types/node': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + + w3c-xmlserializer@5.0.0: + resolution: {integrity: sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==} + engines: {node: '>=18'} + walker@1.0.8: resolution: {integrity: sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==} @@ -6886,9 +7144,25 @@ packages: webidl-conversions@4.0.2: resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==} + webidl-conversions@7.0.0: + resolution: {integrity: sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==} + engines: {node: '>=12'} + + whatwg-encoding@3.1.1: + resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==} + engines: {node: '>=18'} + whatwg-fetch@3.6.20: resolution: {integrity: sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==} + whatwg-mimetype@4.0.0: + resolution: {integrity: sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==} + engines: {node: '>=18'} + + whatwg-url@14.0.0: + resolution: {integrity: sha512-1lfMEm2IEr7RIV+f4lUNPOqfFL+pO+Xw3fJSqmjX9AbXcXcYOkCe1P6+9VBZB6n94af16NfZf+sSk0JCBZC9aw==} + engines: {node: '>=18'} + whatwg-url@5.0.0: resolution: {integrity: sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==} @@ -7035,6 +7309,13 @@ packages: utf-8-validate: optional: true + xml-name-validator@5.0.0: + resolution: {integrity: sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==} + engines: {node: '>=18'} + + xmlchars@2.2.0: + resolution: {integrity: sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==} + y18n@4.0.3: resolution: {integrity: sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==} @@ -7101,6 +7382,8 @@ packages: snapshots: + '@adobe/css-tools@4.4.0': {} + '@adraffy/ens-normalize@1.10.0': {} '@adraffy/ens-normalize@1.11.0': {} @@ -7235,7 +7518,7 @@ snapshots: '@babel/core': 7.24.7 '@babel/helper-compilation-targets': 7.24.7 '@babel/helper-plugin-utils': 7.24.8 - debug: 4.3.5 + debug: 4.3.7 lodash.debounce: 4.0.8 resolve: 1.22.8 transitivePeerDependencies: @@ -8071,10 +8354,10 @@ snapshots: - typescript - utf-8-validate - '@dojoengine/react@1.0.0-alpha.24(@types/node@20.17.6)(@types/react@18.3.12)(react@18.3.1)(starknet@6.11.0(encoding@0.1.13))(terser@5.31.1)(type-fest@2.19.0)(typescript@5.6.2)(zod@3.23.8)': + '@dojoengine/react@1.0.0-alpha.24(@types/node@20.17.6)(@types/react@18.3.12)(jsdom@25.0.1)(react@18.3.1)(starknet@6.11.0(encoding@0.1.13))(terser@5.31.1)(type-fest@2.19.0)(typescript@5.6.2)(zod@3.23.8)': dependencies: '@dojoengine/recs': 2.0.13(typescript@5.6.2)(zod@3.23.8) - '@dojoengine/state': 1.0.0-alpha.24(@types/node@20.17.6)(starknet@6.11.0(encoding@0.1.13))(terser@5.31.1)(typescript@5.6.2)(zod@3.23.8) + '@dojoengine/state': 1.0.0-alpha.24(@types/node@20.17.6)(jsdom@25.0.1)(starknet@6.11.0(encoding@0.1.13))(terser@5.31.1)(typescript@5.6.2)(zod@3.23.8) '@dojoengine/torii-client': 1.0.0-alpha.24 '@dojoengine/utils': 1.0.0-alpha.24(starknet@6.11.0(encoding@0.1.13))(typescript@5.6.2)(zod@3.23.8) '@latticexyz/utils': 2.2.14 @@ -8121,12 +8404,12 @@ snapshots: - utf-8-validate - zod - '@dojoengine/state@1.0.0-alpha.24(@types/node@20.17.6)(starknet@6.11.0(encoding@0.1.13))(terser@5.31.1)(typescript@5.6.2)(zod@3.23.8)': + '@dojoengine/state@1.0.0-alpha.24(@types/node@20.17.6)(jsdom@25.0.1)(starknet@6.11.0(encoding@0.1.13))(terser@5.31.1)(typescript@5.6.2)(zod@3.23.8)': dependencies: '@dojoengine/recs': 2.0.13(typescript@5.6.2)(zod@3.23.8) '@dojoengine/torii-client': 1.0.0-alpha.24 starknet: 6.11.0(encoding@0.1.13) - vitest: 1.6.0(@types/node@20.17.6)(terser@5.31.1) + vitest: 1.6.0(@types/node@20.17.6)(jsdom@25.0.1)(terser@5.31.1) transitivePeerDependencies: - '@edge-runtime/vm' - '@types/node' @@ -9079,9 +9362,9 @@ snapshots: '@types/ws': 8.5.10 graphql: 16.8.2 graphql-ws: 5.16.0(graphql@16.8.2) - isomorphic-ws: 5.0.0(ws@8.17.1) + isomorphic-ws: 5.0.0(ws@8.18.0) tslib: 2.6.3 - ws: 8.17.1 + ws: 8.18.0 transitivePeerDependencies: - bufferutil - utf-8-validate @@ -9104,9 +9387,9 @@ snapshots: '@graphql-tools/utils': 10.2.3(graphql@16.8.2) '@types/ws': 8.5.10 graphql: 16.8.2 - isomorphic-ws: 5.0.0(ws@8.17.1) + isomorphic-ws: 5.0.0(ws@8.18.0) tslib: 2.6.3 - ws: 8.17.1 + ws: 8.18.0 transitivePeerDependencies: - bufferutil - utf-8-validate @@ -10809,6 +11092,37 @@ snapshots: '@telegram-apps/types@1.0.1': {} + '@testing-library/dom@10.4.0': + dependencies: + '@babel/code-frame': 7.24.7 + '@babel/runtime': 7.24.7 + '@types/aria-query': 5.0.4 + aria-query: 5.3.0 + chalk: 4.1.2 + dom-accessibility-api: 0.5.16 + lz-string: 1.5.0 + pretty-format: 27.5.1 + + '@testing-library/jest-dom@6.6.3': + dependencies: + '@adobe/css-tools': 4.4.0 + aria-query: 5.3.2 + chalk: 3.0.0 + css.escape: 1.5.1 + dom-accessibility-api: 0.6.3 + lodash: 4.17.21 + redent: 3.0.0 + + '@testing-library/react@16.0.1(@testing-library/dom@10.4.0)(@types/react-dom@18.3.0)(@types/react@18.3.12)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + dependencies: + '@babel/runtime': 7.24.7 + '@testing-library/dom': 10.4.0 + react: 18.3.1 + react-dom: 18.3.1(react@18.3.1) + optionalDependencies: + '@types/react': 18.3.12 + '@types/react-dom': 18.3.0 + '@tsparticles/basic@3.5.0': dependencies: '@tsparticles/engine': 3.5.0 @@ -11022,6 +11336,8 @@ snapshots: dependencies: '@tsparticles/engine': 3.5.0 + '@types/aria-query@5.0.4': {} + '@types/babel__core@7.20.5': dependencies: '@babel/parser': 7.24.7 @@ -11085,11 +11401,6 @@ snapshots: dependencies: '@types/istanbul-lib-report': 3.0.3 - '@types/jest@29.5.12': - dependencies: - expect: 29.7.0 - pretty-format: 29.7.0 - '@types/js-yaml@4.0.9': {} '@types/json-schema@7.0.15': {} @@ -11238,22 +11549,56 @@ snapshots: '@vitest/utils': 1.6.0 chai: 4.5.0 + '@vitest/expect@2.1.4': + dependencies: + '@vitest/spy': 2.1.4 + '@vitest/utils': 2.1.4 + chai: 5.1.2 + tinyrainbow: 1.2.0 + + '@vitest/mocker@2.1.4(vite@5.4.2(@types/node@20.17.6)(terser@5.31.1))': + dependencies: + '@vitest/spy': 2.1.4 + estree-walker: 3.0.3 + magic-string: 0.30.12 + optionalDependencies: + vite: 5.4.2(@types/node@20.17.6)(terser@5.31.1) + + '@vitest/pretty-format@2.1.4': + dependencies: + tinyrainbow: 1.2.0 + '@vitest/runner@1.6.0': dependencies: '@vitest/utils': 1.6.0 p-limit: 5.0.0 pathe: 1.1.2 + '@vitest/runner@2.1.4': + dependencies: + '@vitest/utils': 2.1.4 + pathe: 1.1.2 + '@vitest/snapshot@1.6.0': dependencies: magic-string: 0.30.11 pathe: 1.1.2 pretty-format: 29.7.0 + '@vitest/snapshot@2.1.4': + dependencies: + '@vitest/pretty-format': 2.1.4 + magic-string: 0.30.12 + pathe: 1.1.2 + '@vitest/spy@1.6.0': dependencies: tinyspy: 2.2.1 + '@vitest/spy@2.1.4': + dependencies: + tinyspy: 3.0.2 + '@vitest/utils@1.6.0': dependencies: diff-sequences: 29.6.3 @@ -11261,6 +11606,12 @@ snapshots: loupe: 2.3.7 pretty-format: 29.7.0 + '@vitest/utils@2.1.4': + dependencies: + '@vitest/pretty-format': 2.1.4 + loupe: 3.1.2 + tinyrainbow: 1.2.0 + '@whatwg-node/events@0.0.3': {} '@whatwg-node/events@0.1.1': {} @@ -11391,6 +11742,12 @@ snapshots: dependencies: tslib: 2.6.3 + aria-query@5.3.0: + dependencies: + dequal: 2.0.3 + + aria-query@5.3.2: {} + arktype@2.0.0-beta.6: dependencies: '@ark/schema': 0.3.3 @@ -11424,6 +11781,8 @@ snapshots: assertion-error@1.1.0: {} + assertion-error@2.0.1: {} + astral-regex@2.0.0: {} async@3.2.5: {} @@ -11712,12 +12071,25 @@ snapshots: pathval: 1.1.1 type-detect: 4.1.0 + chai@5.1.2: + dependencies: + assertion-error: 2.0.1 + check-error: 2.1.1 + deep-eql: 5.0.2 + loupe: 3.1.2 + pathval: 2.0.0 + chalk@2.4.2: dependencies: ansi-styles: 3.2.1 escape-string-regexp: 1.0.5 supports-color: 5.5.0 + chalk@3.0.0: + dependencies: + ansi-styles: 4.3.0 + supports-color: 7.2.0 + chalk@4.1.2: dependencies: ansi-styles: 4.3.0 @@ -11772,6 +12144,8 @@ snapshots: dependencies: get-func-name: 2.0.2 + check-error@2.1.1: {} + chokidar@3.6.0: dependencies: anymatch: 3.1.3 @@ -11927,8 +12301,14 @@ snapshots: css-mediaquery@0.1.2: {} + css.escape@1.5.1: {} + cssesc@3.0.0: {} + cssstyle@4.1.0: + dependencies: + rrweb-cssom: 0.7.1 + csstype@3.1.3: {} d3-array@3.2.4: @@ -11969,6 +12349,11 @@ snapshots: d3-timer@3.0.1: {} + data-urls@5.0.0: + dependencies: + whatwg-mimetype: 4.0.0 + whatwg-url: 14.0.0 + data-view-buffer@1.0.1: dependencies: call-bind: 1.0.7 @@ -11997,6 +12382,10 @@ snapshots: dependencies: ms: 2.1.2 + debug@4.3.7: + dependencies: + ms: 2.1.3 + decamelize@1.2.0: {} decimal.js-light@2.5.1: {} @@ -12013,6 +12402,8 @@ snapshots: dependencies: type-detect: 4.1.0 + deep-eql@5.0.2: {} + deep-is@0.1.4: {} deepmerge@4.3.1: {} @@ -12039,6 +12430,8 @@ snapshots: deprecation@2.3.1: {} + dequal@2.0.3: {} + detect-indent@6.1.0: {} detect-libc@2.0.3: @@ -12062,6 +12455,10 @@ snapshots: dependencies: esutils: 2.0.3 + dom-accessibility-api@0.5.16: {} + + dom-accessibility-api@0.6.3: {} + dom-helpers@5.2.1: dependencies: '@babel/runtime': 7.24.7 @@ -12118,6 +12515,8 @@ snapshots: dependencies: iconv-lite: 0.6.3 + entities@4.5.0: {} + error-ex@1.3.2: dependencies: is-arrayish: 0.2.1 @@ -12452,6 +12851,8 @@ snapshots: exit@0.1.2: {} + expect-type@1.1.0: {} + expect@29.7.0: dependencies: '@jest/expect-utils': 29.7.0 @@ -12801,6 +13202,10 @@ snapshots: howler@2.2.4: {} + html-encoding-sniffer@4.0.0: + dependencies: + whatwg-encoding: 3.1.1 + html-escaper@2.0.2: {} html-to-image@1.11.11: {} @@ -12971,6 +13376,8 @@ snapshots: is-path-inside@3.0.3: {} + is-potential-custom-element-name@1.0.1: {} + is-regex@1.1.4: dependencies: call-bind: 1.0.7 @@ -13033,6 +13440,10 @@ snapshots: dependencies: ws: 8.17.1 + isomorphic-ws@5.0.0(ws@8.18.0): + dependencies: + ws: 8.18.0 + isows@1.0.3(ws@8.13.0): dependencies: ws: 8.13.0 @@ -13426,6 +13837,34 @@ snapshots: dependencies: argparse: 2.0.1 + jsdom@25.0.1: + dependencies: + cssstyle: 4.1.0 + data-urls: 5.0.0 + decimal.js: 10.4.3 + form-data: 4.0.0 + html-encoding-sniffer: 4.0.0 + http-proxy-agent: 7.0.2 + https-proxy-agent: 7.0.5 + is-potential-custom-element-name: 1.0.1 + nwsapi: 2.2.13 + parse5: 7.2.1 + rrweb-cssom: 0.7.1 + saxes: 6.0.0 + symbol-tree: 3.2.4 + tough-cookie: 5.0.0 + w3c-xmlserializer: 5.0.0 + webidl-conversions: 7.0.0 + whatwg-encoding: 3.1.1 + whatwg-mimetype: 4.0.0 + whatwg-url: 14.0.0 + ws: 8.18.0 + xml-name-validator: 5.0.0 + transitivePeerDependencies: + - bufferutil + - supports-color + - utf-8-validate + jsesc@0.5.0: {} jsesc@2.5.2: {} @@ -13536,6 +13975,8 @@ snapshots: dependencies: get-func-name: 2.0.2 + loupe@3.1.2: {} + lower-case-first@2.0.2: dependencies: tslib: 2.6.3 @@ -13554,6 +13995,8 @@ snapshots: dependencies: react: 18.3.1 + lz-string@1.5.0: {} + magic-string@0.25.9: dependencies: sourcemap-codec: 1.4.8 @@ -13562,6 +14005,10 @@ snapshots: dependencies: '@jridgewell/sourcemap-codec': 1.5.0 + magic-string@0.30.12: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.0 + make-dir@4.0.0: dependencies: semver: 7.6.2 @@ -13618,6 +14065,8 @@ snapshots: mimic-fn@4.0.0: {} + min-indent@1.0.1: {} + minimalistic-assert@1.0.1: {} minimalistic-crypto-utils@1.0.1: {} @@ -13651,6 +14100,8 @@ snapshots: ms@2.1.2: {} + ms@2.1.3: {} + mute-stream@0.0.8: {} mz@2.7.0: @@ -13710,6 +14161,8 @@ snapshots: nullthrows@1.1.1: {} + nwsapi@2.2.13: {} + object-assign@4.1.1: {} object-hash@3.0.0: {} @@ -13832,6 +14285,10 @@ snapshots: json-parse-even-better-errors: 2.3.1 lines-and-columns: 1.2.4 + parse5@7.2.1: + dependencies: + entities: 4.5.0 + pascal-case@3.1.2: dependencies: no-case: 3.0.4 @@ -13871,6 +14328,8 @@ snapshots: pathval@1.1.1: {} + pathval@2.0.0: {} + picocolors@1.0.1: {} picocolors@1.1.1: {} @@ -13951,6 +14410,12 @@ snapshots: pretty-bytes@6.1.1: {} + pretty-format@27.5.1: + dependencies: + ansi-regex: 5.0.1 + ansi-styles: 5.2.0 + react-is: 17.0.2 + pretty-format@29.7.0: dependencies: '@jest/schemas': 29.6.3 @@ -14013,6 +14478,8 @@ snapshots: react-is@16.13.1: {} + react-is@17.0.2: {} + react-is@18.3.1: {} react-refresh@0.14.2: {} @@ -14124,6 +14591,11 @@ snapshots: tiny-invariant: 1.3.3 victory-vendor: 36.9.2 + redent@3.0.0: + dependencies: + indent-string: 4.0.0 + strip-indent: 3.0.0 + redeyed@2.1.1: dependencies: esprima: 4.0.1 @@ -14243,6 +14715,8 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.21.0 fsevents: 2.3.3 + rrweb-cssom@0.7.1: {} + run-async@2.4.1: {} run-parallel@1.2.0: @@ -14274,6 +14748,10 @@ snapshots: safer-buffer@2.1.2: {} + saxes@6.0.0: + dependencies: + xmlchars: 2.2.0 + scheduler@0.23.2: dependencies: loose-envify: 1.4.0 @@ -14516,6 +14994,10 @@ snapshots: strip-final-newline@3.0.0: {} + strip-indent@3.0.0: + dependencies: + min-indent: 1.0.1 + strip-json-comments@3.1.1: {} strip-literal@2.1.0: @@ -14552,6 +15034,8 @@ snapshots: dependencies: tslib: 2.6.3 + symbol-tree@3.2.4: {} + tabbable@6.2.0: {} tailwind-merge@2.3.0: @@ -14629,14 +15113,28 @@ snapshots: tinybench@2.9.0: {} + tinyexec@0.3.1: {} + tinypool@0.8.4: {} + tinypool@1.0.1: {} + + tinyrainbow@1.2.0: {} + tinyspy@2.2.1: {} + tinyspy@3.0.2: {} + title-case@3.0.3: dependencies: tslib: 2.6.3 + tldts-core@6.1.60: {} + + tldts@6.1.60: + dependencies: + tldts-core: 6.1.60 + tmp@0.0.33: dependencies: os-tmpdir: 1.0.2 @@ -14656,12 +15154,20 @@ snapshots: universalify: 0.2.0 url-parse: 1.5.10 + tough-cookie@5.0.0: + dependencies: + tldts: 6.1.60 + tr46@0.0.3: {} tr46@1.0.1: dependencies: punycode: 2.3.1 + tr46@5.0.0: + dependencies: + punycode: 2.3.1 + ts-interface-checker@0.1.13: {} ts-jest@29.2.5(@babel/core@7.24.7)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.24.7))(jest@29.7.0(@types/node@20.17.6)(babel-plugin-macros@3.1.0))(typescript@5.6.2): @@ -14958,6 +15464,23 @@ snapshots: - supports-color - terser + vite-node@2.1.4(@types/node@20.17.6)(terser@5.31.1): + dependencies: + cac: 6.7.14 + debug: 4.3.7 + pathe: 1.1.2 + vite: 5.4.2(@types/node@20.17.6)(terser@5.31.1) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + vite-plugin-mkcert@1.17.5(vite@4.5.5(@types/node@20.17.6)(terser@5.31.1)): dependencies: '@octokit/rest': 20.1.1 @@ -15013,7 +15536,7 @@ snapshots: fsevents: 2.3.3 terser: 5.31.1 - vitest@1.6.0(@types/node@20.17.6)(terser@5.31.1): + vitest@1.6.0(@types/node@20.17.6)(jsdom@25.0.1)(terser@5.31.1): dependencies: '@vitest/expect': 1.6.0 '@vitest/runner': 1.6.0 @@ -15037,9 +15560,46 @@ snapshots: why-is-node-running: 2.3.0 optionalDependencies: '@types/node': 20.17.6 + jsdom: 25.0.1 + transitivePeerDependencies: + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + + vitest@2.1.4(@types/node@20.17.6)(jsdom@25.0.1)(terser@5.31.1): + dependencies: + '@vitest/expect': 2.1.4 + '@vitest/mocker': 2.1.4(vite@5.4.2(@types/node@20.17.6)(terser@5.31.1)) + '@vitest/pretty-format': 2.1.4 + '@vitest/runner': 2.1.4 + '@vitest/snapshot': 2.1.4 + '@vitest/spy': 2.1.4 + '@vitest/utils': 2.1.4 + chai: 5.1.2 + debug: 4.3.7 + expect-type: 1.1.0 + magic-string: 0.30.12 + pathe: 1.1.2 + std-env: 3.7.0 + tinybench: 2.9.0 + tinyexec: 0.3.1 + tinypool: 1.0.1 + tinyrainbow: 1.2.0 + vite: 5.4.2(@types/node@20.17.6)(terser@5.31.1) + vite-node: 2.1.4(@types/node@20.17.6)(terser@5.31.1) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 20.17.6 + jsdom: 25.0.1 transitivePeerDependencies: - less - lightningcss + - msw - sass - sass-embedded - stylus @@ -15047,6 +15607,10 @@ snapshots: - supports-color - terser + w3c-xmlserializer@5.0.0: + dependencies: + xml-name-validator: 5.0.0 + walker@1.0.8: dependencies: makeerror: 1.0.12 @@ -15074,8 +15638,21 @@ snapshots: webidl-conversions@4.0.2: {} + webidl-conversions@7.0.0: {} + + whatwg-encoding@3.1.1: + dependencies: + iconv-lite: 0.6.3 + whatwg-fetch@3.6.20: {} + whatwg-mimetype@4.0.0: {} + + whatwg-url@14.0.0: + dependencies: + tr46: 5.0.0 + webidl-conversions: 7.0.0 + whatwg-url@5.0.0: dependencies: tr46: 0.0.3 @@ -15262,6 +15839,10 @@ snapshots: ws@8.18.0: {} + xml-name-validator@5.0.0: {} + + xmlchars@2.2.0: {} + y18n@4.0.3: {} y18n@5.0.8: {} diff --git a/client/src/dojo/systems.ts b/client/src/dojo/systems.ts index ceedb282..cf8657ee 100644 --- a/client/src/dojo/systems.ts +++ b/client/src/dojo/systems.ts @@ -3,100 +3,20 @@ import { toast } from "sonner"; import * as SystemTypes from "./contractSystems"; import { shortenHex } from "@dojoengine/utils"; import { Account } from "starknet"; +import { + getToastPlacement, + getUrl, + getWalnutUrl, + shouldShowToast, + getToastAction, + notify, +} from "@/utils/toast"; export type SystemCalls = ReturnType; -const { VITE_PUBLIC_DEPLOY_TYPE } = import.meta.env; - export function systems({ client }: { client: IWorld }) { - // Function to extract error messages from a given string - function extractErrorMessages(errorString: string) { - const regex = /Error message:(.*?)(?=\n|$)/gs; - const matches = errorString.match(regex); - - if (matches) { - return matches.map((match) => match.replace("Error message:", "").trim()); - } else { - return [errorString.trim()]; // Return the entire message if no specific pattern found - } - } - - const extractedMessage = (message: string) => { - const errorMessages = extractErrorMessages(message); - - return errorMessages.length > 0 ? errorMessages[0] : message; - }; - - const isMdOrLarger = (): boolean => { - return window.matchMedia("(min-width: 768px)").matches; - }; - - const shouldShowToast = (): boolean => { - return isMdOrLarger(); - }; - - const isSmallHeight = (): boolean => { - return window.matchMedia("(max-height: 768px)").matches; - }; - - const getUrl = (transaction_hash: string) => { - if ( - VITE_PUBLIC_DEPLOY_TYPE === "sepolia" || - VITE_PUBLIC_DEPLOY_TYPE === "sepoliadev1" || - VITE_PUBLIC_DEPLOY_TYPE === "sepoliadev2" - ) { - //return `https://sepolia.starkscan.co/tx/${transaction_hash}`; - return `https://sepolia.voyager.online/tx/${transaction_hash}`; - } else if (VITE_PUBLIC_DEPLOY_TYPE === "mainnet") { - return `https://starkscan.co/tx/${transaction_hash}`; - } else { - return `https://worlds.dev/networks/slot/worlds/zkube-${VITE_PUBLIC_DEPLOY_TYPE}/txs/${transaction_hash}`; - } - }; - - const getWalnutUrl = (transaction_hash: string) => { - return `https://app.walnut.dev/transactions?rpcUrl=https%3A%2F%2Fapi.cartridge.gg%2Fx%2Fstarknet%2Fsepolia&txHash=${transaction_hash}`; - }; - - const getToastAction = (transaction_hash: string) => { - return { - label: "View", - onClick: () => window.open(getUrl(transaction_hash), "_blank"), - }; - }; - - const getToastPlacement = (): - | "top-center" - | "bottom-center" - | "bottom-right" => { - if (!isMdOrLarger()) { - // if mobile - return isSmallHeight() ? "top-center" : "bottom-right"; - } - return "bottom-right"; - }; - const toastPlacement = getToastPlacement(); - const notify = (message: string, transaction: any) => { - const toastId = transaction.transaction_hash; - - if (transaction.execution_status !== "REVERTED") { - if (!shouldShowToast()) return; // Exit if screen is smaller than medium - toast.success(message, { - id: toastId, // Use the transaction_hash as the unique toast ID - description: shortenHex(transaction.transaction_hash), - action: getToastAction(transaction.transaction_hash), - position: toastPlacement, - }); - } else { - toast.error(extractedMessage(transaction.revert_reason), { - id: toastId, // Use the same transaction_hash ID for error - position: toastPlacement, - }); - } - }; - const handleTransaction = async ( account: Account, action: () => Promise<{ transaction_hash: string }>, diff --git a/client/src/hooks/useGrid.tsx b/client/src/hooks/useGrid.tsx index 04e60fec..d0987519 100644 --- a/client/src/hooks/useGrid.tsx +++ b/client/src/hooks/useGrid.tsx @@ -1,8 +1,7 @@ -import { useEffect, useState, useMemo, useRef } from "react"; +import { useEffect, useState, useRef } from "react"; import { useGame } from "@/hooks/useGame"; import { formatBigIntToBinaryArrayCustom } from "@/utils/gridUtils"; import useDeepMemo from "./useDeepMemo"; -import { set } from "date-fns"; interface DebugData { blocksRaw: bigint; diff --git a/client/src/hooks/useSettings.tsx b/client/src/hooks/useSettings.tsx index 3873838b..41ed7305 100644 --- a/client/src/hooks/useSettings.tsx +++ b/client/src/hooks/useSettings.tsx @@ -25,7 +25,5 @@ export const useSettings = () => { return component ? new SettingsClass(component) : null; }, [component]); - //console.log("settings", settings); - return { settings, settingsKey }; }; diff --git a/client/src/stores/rewardsStore.ts b/client/src/stores/rewardsStore.ts index c48f2619..933df7e0 100644 --- a/client/src/stores/rewardsStore.ts +++ b/client/src/stores/rewardsStore.ts @@ -3,24 +3,24 @@ import { useEffect } from "react"; import { Participation } from "@/dojo/game/models/participation"; import { Tournament } from "@/dojo/game/models/tournament"; import { Mode } from "@/dojo/game/types/mode"; -import { formatPrize } from "@/utils/wei"; import { useAllChests } from "@/hooks/useAllChests"; import { useParticipations } from "@/hooks/useParticipations"; import { useWonTournaments } from "@/hooks/useWonTournaments"; import useAccountCustom from "@/hooks/useAccountCustom"; +import { formatPrize, Prize } from "@/utils/price"; const { VITE_PUBLIC_GAME_TOKEN_SYMBOL } = import.meta.env; interface ParticipationWithPrize extends Participation { raw_prize: bigint; - formatted_prize: string; - formatted_user_prize: string; + formatted_prize: Prize; + formatted_user_prize: Prize; } export type TournamentReward = { player_id: string; rank: 1 | 2 | 3; - prize: string; + prize: Prize; tournament_id: number; mode: Mode; tournament: Tournament; @@ -75,8 +75,18 @@ export const useRewardsCalculator = () => { return { ...participation, raw_prize: 0n, - formatted_prize: "", - formatted_user_prize: "", + formatted_prize: { + full: "", + formatted_prize: "", + display: null, + withImage: null, + }, + formatted_user_prize: { + full: "", + formatted_prize: "", + display: null, + withImage: null, + }, }; const rawPrize = BigInt(chest.prize); diff --git a/client/src/test/setup.ts b/client/src/test/setup.ts new file mode 100644 index 00000000..c56efc56 --- /dev/null +++ b/client/src/test/setup.ts @@ -0,0 +1,13 @@ +import { beforeEach, afterEach } from "node:test"; + +import "@testing-library/jest-dom"; +import { vi } from "vitest"; + +beforeEach(() => { + vi.spyOn(Math, "random").mockImplementation(() => 0.5); + vi.spyOn(Date, "now").mockImplementation(() => 1234567890); +}); + +afterEach(() => { + vi.restoreAllMocks(); +}); diff --git a/client/src/ui/actions/Start.tsx b/client/src/ui/actions/Start.tsx index 9256801d..537b11ad 100644 --- a/client/src/ui/actions/Start.tsx +++ b/client/src/ui/actions/Start.tsx @@ -14,6 +14,7 @@ import { erc20ABI } from "@/utils/erc20"; import { useMediaQuery } from "react-responsive"; import { erc721ABI } from "@/utils/erc721"; import { useNftMint } from "@/hooks/useNftMint"; +import { showToast } from "@/utils/toast"; const { VITE_PUBLIC_GAME_CREDITS_TOKEN_ADDRESS, @@ -55,19 +56,39 @@ export const Start: React.FC = ({ mode, handleGameMode }) => { const { mint } = useNftMint(); const [isWaitingTx, setIsWaitingTx] = useState(false); - //useFirstNft(address); - const handleMint = useCallback(async () => { if (account) { try { setIsWaitingTx(true); + showToast({ + message: "Minting your first game credit NFT...", + toastId: "game-start-process", + }); + const tx = await mint(); + showToast({ + message: "Minting your first game credit NFT...", + txHash: tx.transaction_hash, + toastId: "game-start-process", + }); await account.waitForTransaction(tx.transaction_hash, { - retryInterval: 1000, + retryInterval: 200, + }); + + showToast({ + message: "Transaction validated", + txHash: tx.transaction_hash, + type: "success", + toastId: "game-start-process", }); } catch (err) { console.error("Mint error:", err); + showToast({ + message: "Failed to mint NFT", + type: "error", + toastId: "game-start-process", + }); } finally { setIsWaitingTx(false); } @@ -79,62 +100,78 @@ export const Start: React.FC = ({ mode, handleGameMode }) => { }, [account, player, game]); const handleClick = useCallback(async () => { - if (settings === null) return; - if (erc20Contract === undefined) return; - if (erc721Contract === undefined) return; - if (!account?.address) return; + if (settings === null) { + console.error("Settings not loaded"); + return; + } + if (erc20Contract === undefined) { + console.error("ERC20 contract not loaded"); + return; + } + if (erc721Contract === undefined) { + console.error("ERC721 contract not loaded"); + return; + } + if (!account?.address) { + console.error("Account not loaded"); + return; + } setIsLoading(true); + showToast({ + message: "Checking your game credits...", + toastId: "game-start-process", + }); - let token_id = 0n; - if (mode !== ModeType.Free) { - // Check if the player has an NFT - const ret_erc721_balance = await erc721Contract.call("balance_of", [ - account?.address, - ]); - const number_of_nft = Number(ret_erc721_balance.toString()); - console.log("number_of_nft", number_of_nft); + try { + let token_id = 0n; + if (mode !== ModeType.Free) { + // Check if the player has an NFT + const ret_erc721_balance = await erc721Contract.call("balance_of", [ + account?.address, + ]); + const number_of_nft = Number(ret_erc721_balance.toString()); + console.log("number_of_nft", number_of_nft); - try { if (number_of_nft === 0) { - // Mint one - // First check if the player has enough balance + // Check balance and claim from faucet if needed const ret_erc20 = await erc20Contract.call("balanceOf", [ account?.address, ]); const balance = BigInt(ret_erc20.toString()); if (balance < settings.game_price && erc20Contract) { if (import.meta.env.VITE_PUBLIC_DEPLOY_TYPE === "mainnet") { - console.log("No funds to sign tx"); + console.log("No LORDs to pay for game"); return; } - console.log("Not enough balance, trying to claim faucet"); - + showToast({ + message: "Claiming tokens from faucet...", + toastId: "game-start-process", + }); await createFaucetClaimHandler(account as Account, () => { return; })(); } - // Second mint the NFT + // Mint NFT await handleMint(); } - } catch (error) { - console.error("Error minting NFT:", error); - } - try { const ret_erc721 = await erc721Contract.call( "token_of_owner_by_index", [account?.address, 0], ); token_id = BigInt(ret_erc721.toString()); console.log("token_id", token_id); - } catch (error) { - console.error("Error getting NFT:", error); } - } - try { + showToast({ + message: "Preparing game data...", + txHash: "", + toastId: "game-start-process", + type: "success", + }); + const { seed, proof_gamma_x, @@ -145,6 +182,7 @@ export const Start: React.FC = ({ mode, handleGameMode }) => { beta, } = await fetchVrfData(); + // Start game await start({ account: account as Account, token_id, @@ -158,9 +196,15 @@ export const Start: React.FC = ({ mode, handleGameMode }) => { sqrt_ratio_hint: proof_verify_hint, beta: beta, }); + handleGameMode(); } catch (error) { console.error("Error during game start:", error); + showToast({ + message: "Failed to start game", + type: "error", + toastId: "game-start-process", + }); } finally { setIsLoading(false); } diff --git a/client/src/ui/components/AccountDetails.tsx b/client/src/ui/components/AccountDetails.tsx index 71c8a891..5aaa5b30 100644 --- a/client/src/ui/components/AccountDetails.tsx +++ b/client/src/ui/components/AccountDetails.tsx @@ -41,7 +41,7 @@ const AccountDetails = () => {
{username}

- {shortAddress(account.address, isMdOrLarger ? 5 : 6)} + {shortAddress(account.address, isMdOrLarger ? 5 : 4)}