diff --git a/package-lock.json b/package-lock.json index 94226f147f51..62f5aa533227 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,6 @@ "@deriv/deriv-charts": "1.1.9", "@deriv/js-interpreter": "^3.0.0", "@deriv/ui": "^0.6.0", - "@enykeev/react-virtualized": "^9.22.4-mirror.1", "@livechat/customer-sdk": "^2.0.4", "@storybook/addon-actions": "^6.5.10", "@storybook/addon-docs": "^6.5.10", @@ -129,6 +128,7 @@ "react-swipeable": "^6.2.1", "react-tiny-popover": "^7.0.1", "react-transition-group": "4.4.2", + "react-virtualized": "npm:@enykeev/react-virtualized@^9.22.4-mirror.1", "react-window": "^1.8.5", "redux": "^4.0.1", "redux-thunk": "^2.2.0", @@ -2782,20 +2782,20 @@ } }, "node_modules/@datadog/browser-core": { - "version": "4.39.0", - "resolved": "https://registry.npmjs.org/@datadog/browser-core/-/browser-core-4.39.0.tgz", - "integrity": "sha512-jSwXfdSPaeU9xFLepour7d2jATk/VVcjab69/42gmWkh1MtzDloTd8RaKSVRo0Y7CsHroO6Mdzp+enEivI7NkA==" + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@datadog/browser-core/-/browser-core-4.41.0.tgz", + "integrity": "sha512-7QwALfXt9vEr68xcEmv1XvvpypIH3+WyiVKGPBrmViOQajILMGuDqdKpxRcQAnh6HeWEIjhgtkZkMG7vJcr0oA==" }, "node_modules/@datadog/browser-rum": { - "version": "4.39.0", - "resolved": "https://registry.npmjs.org/@datadog/browser-rum/-/browser-rum-4.39.0.tgz", - "integrity": "sha512-7owNySSTxWnNbwRjDCC+fHRU2ycWb3lPDGn+VvQE3US+o9MRlEbFesaLO5/3Nj0A+vJGq6Ao35d++eCHl5dw2Q==", + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@datadog/browser-rum/-/browser-rum-4.41.0.tgz", + "integrity": "sha512-GY5R02cv0obfkn4C+17avHuWI/O4K5mA9a8WlAOvQzUMJN4hYetDnhlqw08BL9j2mij3MUKLM8JPWgl03gXcpA==", "dependencies": { - "@datadog/browser-core": "4.39.0", - "@datadog/browser-rum-core": "4.39.0" + "@datadog/browser-core": "4.41.0", + "@datadog/browser-rum-core": "4.41.0" }, "peerDependencies": { - "@datadog/browser-logs": "4.39.0" + "@datadog/browser-logs": "4.41.0" }, "peerDependenciesMeta": { "@datadog/browser-logs": { @@ -2804,11 +2804,11 @@ } }, "node_modules/@datadog/browser-rum-core": { - "version": "4.39.0", - "resolved": "https://registry.npmjs.org/@datadog/browser-rum-core/-/browser-rum-core-4.39.0.tgz", - "integrity": "sha512-UhAEELzt7ZQlAbWSaMJ7Ubwfdxk+uig8xm39iktNyTNCcxN92aNHWsNhsz5FtWXe3Oci7xKSDZf3ccjFl7KABw==", + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@datadog/browser-rum-core/-/browser-rum-core-4.41.0.tgz", + "integrity": "sha512-TXjg0mIRNobc1L0wDUiTW/MrqsGNQd2qRNJz8DBoJ1E7bmlXGAb8/9cCyFq+vtw94nnB7FIv5iI3CUJRzGPoeA==", "dependencies": { - "@datadog/browser-core": "4.39.0" + "@datadog/browser-core": "4.41.0" } }, "node_modules/@deriv/api-types": { @@ -2945,14 +2945,6 @@ "regenerator-runtime": "^0.13.2" } }, - "node_modules/@devtools-ds/object-inspector/node_modules/clsx": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", - "integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA==", - "engines": { - "node": ">=6" - } - }, "node_modules/@devtools-ds/object-parser": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@devtools-ds/object-parser/-/object-parser-1.2.1.tgz", @@ -3017,14 +3009,6 @@ "node": ">=6.9.0" } }, - "node_modules/@devtools-ds/themes/node_modules/clsx": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", - "integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA==", - "engines": { - "node": ">=6" - } - }, "node_modules/@devtools-ds/tree": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@devtools-ds/tree/-/tree-1.2.1.tgz", @@ -3046,14 +3030,6 @@ "regenerator-runtime": "^0.13.2" } }, - "node_modules/@devtools-ds/tree/node_modules/clsx": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", - "integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA==", - "engines": { - "node": ">=6" - } - }, "node_modules/@discoveryjs/json-ext": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz", @@ -3187,23 +3163,6 @@ "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz", "integrity": "sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==" }, - "node_modules/@enykeev/react-virtualized": { - "version": "9.22.4-mirror.1", - "resolved": "https://registry.npmjs.org/@enykeev/react-virtualized/-/react-virtualized-9.22.4-mirror.1.tgz", - "integrity": "sha512-NfSYQH9KIvHv+ZSyx7acLxYHhW+fvfMFLcXj8U6AyzRhCSHjuSWRxB3lLqNEseplS60fLRtPs6wG5NLsDDJzjA==", - "dependencies": { - "@babel/runtime": "^7.7.2", - "clsx": "^1.0.4", - "dom-helpers": "^5.1.3", - "loose-envify": "^1.4.0", - "prop-types": "^15.7.2", - "react-lifecycles-compat": "^3.0.4" - }, - "peerDependencies": { - "react": "^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0", - "react-dom": "^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0" - } - }, "node_modules/@eslint/eslintrc": { "version": "0.4.3", "license": "MIT", @@ -7000,9 +6959,9 @@ } }, "node_modules/@onfido/castor-icons": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/@onfido/castor-icons/-/castor-icons-2.16.0.tgz", - "integrity": "sha512-moThxhRXKxoHrsP8hIoCrtecUX8m5Hjk5yozuYTKqA24iBIQpcDe+SDG/m6slDYpT9iSXediCU4hb7XjpHYjSg==", + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/@onfido/castor-icons/-/castor-icons-2.17.0.tgz", + "integrity": "sha512-dY2QNOFrIEqwCXcjNmH7hqz35CDWtBDlPkwbLYfnhK9ZAV7qUs2wcAxGi/FD4Yvi7MNsRBsFKSoT379hBSQcCw==", "peerDependencies": { "react": ">=17 || ^16.14 || ^15.7 || ^0.14.10" } @@ -7666,13 +7625,13 @@ "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==" }, "node_modules/@sentry-internal/tracing": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.48.0.tgz", - "integrity": "sha512-MFAPDTrvCtfSm0/Zbmx7HA0Q5uCfRadOUpN8Y8rP1ndz+329h2kA3mZRCuC+3/aXL11zs2CHUhcAkGjwH2vogg==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.50.0.tgz", + "integrity": "sha512-4TQ4vN0aMBWsUXfJWk2xbe4x7fKfwCXgXKTtHC/ocwwKM+0EefV5Iw9YFG8IrIQN4vMtuRzktqcs9q0/Sbv7tg==", "dependencies": { - "@sentry/core": "7.48.0", - "@sentry/types": "7.48.0", - "@sentry/utils": "7.48.0", + "@sentry/core": "7.50.0", + "@sentry/types": "7.50.0", + "@sentry/utils": "7.50.0", "tslib": "^1.9.3" }, "engines": { @@ -7685,15 +7644,15 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, "node_modules/@sentry/browser": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.48.0.tgz", - "integrity": "sha512-tdx/2nhuiykncmXFlV4Dpp+Hxgt/v31LiyXE79IcM560wc+QmWKtzoW9azBWQ0xt5KOO3ERMib9qPE4/ql1/EQ==", - "dependencies": { - "@sentry-internal/tracing": "7.48.0", - "@sentry/core": "7.48.0", - "@sentry/replay": "7.48.0", - "@sentry/types": "7.48.0", - "@sentry/utils": "7.48.0", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.50.0.tgz", + "integrity": "sha512-a+UYbP89+SAvW47/p9wxEi9eWlyp/SkYl52OCdZNXnplQY4kQIOVyiaIs5nnCxIxZgXKrhAX4eo1E9ykleFuNQ==", + "dependencies": { + "@sentry-internal/tracing": "7.50.0", + "@sentry/core": "7.50.0", + "@sentry/replay": "7.50.0", + "@sentry/types": "7.50.0", + "@sentry/utils": "7.50.0", "tslib": "^1.9.3" }, "engines": { @@ -7706,12 +7665,12 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, "node_modules/@sentry/core": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.48.0.tgz", - "integrity": "sha512-8FYuJTMpyuxRZvlen3gQ3rpOtVInSDmSyXqWEhCLuG/w34AtWoTiW7G516rsAAh6Hy1TP91GooMWbonP3XQNTQ==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.50.0.tgz", + "integrity": "sha512-6oD1a3fYs4aiNK7tuJSd88LHjYJAetd7ZK/AfJniU7zWKj4jxIYfO8nhm0qdnhEDs81RcweVDmPhWm3Kwrzzsg==", "dependencies": { - "@sentry/types": "7.48.0", - "@sentry/utils": "7.48.0", + "@sentry/types": "7.50.0", + "@sentry/utils": "7.50.0", "tslib": "^1.9.3" }, "engines": { @@ -7724,32 +7683,32 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, "node_modules/@sentry/replay": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.48.0.tgz", - "integrity": "sha512-8fRHMGJ0NJeIZi6UucxUTvfDPaBa7+jU1kCTLjCcuH3X/UVz5PtGLMtFSO5U8HP+mUDlPs97MP1uoDvMa4S2Ng==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.50.0.tgz", + "integrity": "sha512-EYRk+DTZ5luwfkiCaDpBC3YBKIEdkReTUNZtWDVUytSVjsCnttkAipx/y6bxy3HN+rSXungMd3XKQT5RNMRUNA==", "dependencies": { - "@sentry/core": "7.48.0", - "@sentry/types": "7.48.0", - "@sentry/utils": "7.48.0" + "@sentry/core": "7.50.0", + "@sentry/types": "7.50.0", + "@sentry/utils": "7.50.0" }, "engines": { "node": ">=12" } }, "node_modules/@sentry/types": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.48.0.tgz", - "integrity": "sha512-kkAszZwQ5/v4n7Yyw/DPNRWx7h724mVNRGZIJa9ggUMvTgMe7UKCZZ5wfQmYiKVlGbwd9pxXAcP8Oq15EbByFQ==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.50.0.tgz", + "integrity": "sha512-Zo9vyI98QNeYT0K0y57Rb4JRWDaPEgmp+QkQ4CRQZFUTWetO5fvPZ4Gb/R7TW16LajuHZlbJBHmvmNj2pkL2kw==", "engines": { "node": ">=8" } }, "node_modules/@sentry/utils": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.48.0.tgz", - "integrity": "sha512-d977sghkFVMfld0LrEyyY2gYrfayLPdDEpUDT+hg5y79r7zZDCFyHtdB86699E5K89MwDZahW7Erk+a1nk4x5w==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.50.0.tgz", + "integrity": "sha512-iyPwwC6fwJsiPhH27ZbIiSsY5RaccHBqADS2zEjgKYhmP4P9WGgHRDrvLEnkOjqQyKNb6c0yfmv83n0uxYnolw==", "dependencies": { - "@sentry/types": "7.48.0", + "@sentry/types": "7.50.0", "tslib": "^1.9.3" }, "engines": { @@ -9170,9 +9129,9 @@ "integrity": "sha512-h4lTMgMJctJybDp8CQrxTUiiYmedihHWkjnF/8Pxseu2S6Nlfcy8kwboQ8yejh456rP2yWoEVm1sS/FVsfM48w==" }, "node_modules/@storybook/builder-webpack4/node_modules/@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "node_modules/@storybook/builder-webpack4/node_modules/@webassemblyjs/ast": { "version": "1.9.0", @@ -10465,9 +10424,9 @@ } }, "node_modules/@storybook/builder-webpack5/node_modules/@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "node_modules/@storybook/builder-webpack5/node_modules/colorette": { "version": "1.4.0", @@ -10892,9 +10851,9 @@ } }, "node_modules/@storybook/core-common/node_modules/@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "node_modules/@storybook/core-common/node_modules/@webassemblyjs/ast": { "version": "1.9.0", @@ -11716,9 +11675,9 @@ } }, "node_modules/@storybook/core-server/node_modules/@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "node_modules/@storybook/core-server/node_modules/@webassemblyjs/ast": { "version": "1.9.0", @@ -12659,9 +12618,9 @@ "integrity": "sha512-h4lTMgMJctJybDp8CQrxTUiiYmedihHWkjnF/8Pxseu2S6Nlfcy8kwboQ8yejh456rP2yWoEVm1sS/FVsfM48w==" }, "node_modules/@storybook/manager-webpack4/node_modules/@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "node_modules/@storybook/manager-webpack4/node_modules/@webassemblyjs/ast": { "version": "1.9.0", @@ -13939,9 +13898,9 @@ } }, "node_modules/@storybook/manager-webpack5/node_modules/@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "node_modules/@storybook/manager-webpack5/node_modules/ansi-styles": { "version": "4.3.0", @@ -14453,9 +14412,9 @@ "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==" }, "node_modules/@storybook/react/node_modules/@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "node_modules/@storybook/react/node_modules/acorn": { "version": "7.4.1", @@ -15446,9 +15405,8 @@ } }, "node_modules/@types/estree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz", - "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==" + "version": "1.0.0", + "license": "MIT" }, "node_modules/@types/glob": { "version": "7.2.0", @@ -19793,9 +19751,9 @@ } }, "node_modules/clsx": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz", - "integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", + "integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA==", "engines": { "node": ">=6" } @@ -27937,9 +27895,9 @@ } }, "node_modules/i18next": { - "version": "22.4.15", - "resolved": "https://registry.npmjs.org/i18next/-/i18next-22.4.15.tgz", - "integrity": "sha512-yYudtbFrrmWKLEhl6jvKUYyYunj4bTBCe2qIUYAxbXoPusY7YmdwPvOE6fx6UIfWvmlbCWDItr7wIs8KEBZ5Zg==", + "version": "22.4.14", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-22.4.14.tgz", + "integrity": "sha512-VtLPtbdwGn0+DAeE00YkiKKXadkwg+rBUV+0v8v0ikEjwdiJ0gmYChVE4GIa9HXymY6wKapkL93vGT7xpq6aTw==", "funding": [ { "type": "individual", @@ -36960,7 +36918,9 @@ } }, "node_modules/postcss": { - "version": "8.4.19", + "version": "8.4.21", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.21.tgz", + "integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==", "funding": [ { "type": "opencollective", @@ -36971,7 +36931,6 @@ "url": "https://tidelift.com/funding/github/npm/postcss" } ], - "license": "MIT", "dependencies": { "nanoid": "^3.3.4", "picocolors": "^1.0.0", @@ -39777,6 +39736,24 @@ "react-dom": ">=16.6.0" } }, + "node_modules/react-virtualized": { + "name": "@enykeev/react-virtualized", + "version": "9.22.4-mirror.1", + "resolved": "https://registry.npmjs.org/@enykeev/react-virtualized/-/react-virtualized-9.22.4-mirror.1.tgz", + "integrity": "sha512-NfSYQH9KIvHv+ZSyx7acLxYHhW+fvfMFLcXj8U6AyzRhCSHjuSWRxB3lLqNEseplS60fLRtPs6wG5NLsDDJzjA==", + "dependencies": { + "@babel/runtime": "^7.7.2", + "clsx": "^1.0.4", + "dom-helpers": "^5.1.3", + "loose-envify": "^1.4.0", + "prop-types": "^15.7.2", + "react-lifecycles-compat": "^3.0.4" + }, + "peerDependencies": { + "react": "^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0", + "react-dom": "^15.3.0 || ^16.0.0-alpha || ^17.0.0 || ^18.0.0" + } + }, "node_modules/react-webcam": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/react-webcam/-/react-webcam-7.0.1.tgz", @@ -44497,9 +44474,9 @@ } }, "node_modules/terser": { - "version": "5.17.1", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.17.1.tgz", - "integrity": "sha512-hVl35zClmpisy6oaoKALOpS0rDYLxRFLHhRuDlEGTKey9qHjS1w9GMORjuwIMt70Wan4lwsLYyWDVnWgF+KUEw==", + "version": "5.16.9", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.16.9.tgz", + "integrity": "sha512-HPa/FdTB9XGI2H1/keLFZHxl6WNvAI4YalHGtDQTlMnJcoqSab1UwL4l1hGEhs6/GmLHBZIg/YgB++jcbzoOEg==", "dependencies": { "@jridgewell/source-map": "^0.3.2", "acorn": "^8.5.0", @@ -46350,9 +46327,10 @@ } }, "node_modules/webpack": { - "version": "5.77.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.77.0.tgz", - "integrity": "sha512-sbGNjBr5Ya5ss91yzjeJTLKyfiwo5C628AFjEa6WSXcZa4E+F57om3Cc8xLb1Jh0b243AWuSYRf3dn7HVeFQ9Q==", + "version": "5.75.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.79.0.tgz", + "integrity": "sha512-3mN4rR2Xq+INd6NnYuL9RC9GAmc1ROPKJoHhrZ4pAjdMFEkJJWrsPw8o2JjCIyQyTu7rTXYn4VG6OpyB3CobZg==", + "license": "MIT", "dependencies": { "@types/eslint-scope": "^3.7.3", "@types/estree": "^1.0.0", @@ -48123,9 +48101,9 @@ } }, "node_modules/xstate": { - "version": "4.37.1", - "resolved": "https://registry.npmjs.org/xstate/-/xstate-4.37.1.tgz", - "integrity": "sha512-MuB7s01nV5vG2CzaBg2msXLGz7JuS+x/NBkQuZAwgEYCnWA8iQMiRz2VGxD3pcFjZAOih3fOgDD3kDaFInEx+g==", + "version": "4.37.2", + "resolved": "https://registry.npmjs.org/xstate/-/xstate-4.37.2.tgz", + "integrity": "sha512-Qm337O49CRTZ3PRyRuK6b+kvI+D3JGxXIZCTul+xEsyFCVkTFDt5jixaL1nBWcUBcaTQ9um/5CRGVItPi7fveg==", "funding": { "type": "opencollective", "url": "https://opencollective.com/xstate" @@ -49707,25 +49685,25 @@ "requires": {} }, "@datadog/browser-core": { - "version": "4.39.0", - "resolved": "https://registry.npmjs.org/@datadog/browser-core/-/browser-core-4.39.0.tgz", - "integrity": "sha512-jSwXfdSPaeU9xFLepour7d2jATk/VVcjab69/42gmWkh1MtzDloTd8RaKSVRo0Y7CsHroO6Mdzp+enEivI7NkA==" + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@datadog/browser-core/-/browser-core-4.41.0.tgz", + "integrity": "sha512-7QwALfXt9vEr68xcEmv1XvvpypIH3+WyiVKGPBrmViOQajILMGuDqdKpxRcQAnh6HeWEIjhgtkZkMG7vJcr0oA==" }, "@datadog/browser-rum": { - "version": "4.39.0", - "resolved": "https://registry.npmjs.org/@datadog/browser-rum/-/browser-rum-4.39.0.tgz", - "integrity": "sha512-7owNySSTxWnNbwRjDCC+fHRU2ycWb3lPDGn+VvQE3US+o9MRlEbFesaLO5/3Nj0A+vJGq6Ao35d++eCHl5dw2Q==", + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@datadog/browser-rum/-/browser-rum-4.41.0.tgz", + "integrity": "sha512-GY5R02cv0obfkn4C+17avHuWI/O4K5mA9a8WlAOvQzUMJN4hYetDnhlqw08BL9j2mij3MUKLM8JPWgl03gXcpA==", "requires": { - "@datadog/browser-core": "4.39.0", - "@datadog/browser-rum-core": "4.39.0" + "@datadog/browser-core": "4.41.0", + "@datadog/browser-rum-core": "4.41.0" } }, "@datadog/browser-rum-core": { - "version": "4.39.0", - "resolved": "https://registry.npmjs.org/@datadog/browser-rum-core/-/browser-rum-core-4.39.0.tgz", - "integrity": "sha512-UhAEELzt7ZQlAbWSaMJ7Ubwfdxk+uig8xm39iktNyTNCcxN92aNHWsNhsz5FtWXe3Oci7xKSDZf3ccjFl7KABw==", + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/@datadog/browser-rum-core/-/browser-rum-core-4.41.0.tgz", + "integrity": "sha512-TXjg0mIRNobc1L0wDUiTW/MrqsGNQd2qRNJz8DBoJ1E7bmlXGAb8/9cCyFq+vtw94nnB7FIv5iI3CUJRzGPoeA==", "requires": { - "@datadog/browser-core": "4.39.0" + "@datadog/browser-core": "4.41.0" } }, "@deriv/api-types": { @@ -49846,11 +49824,6 @@ "requires": { "regenerator-runtime": "^0.13.2" } - }, - "clsx": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", - "integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA==" } } }, @@ -49910,11 +49883,6 @@ } } } - }, - "clsx": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", - "integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA==" } } }, @@ -49935,11 +49903,6 @@ "requires": { "regenerator-runtime": "^0.13.2" } - }, - "clsx": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", - "integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA==" } } }, @@ -50064,19 +50027,6 @@ "resolved": "https://registry.npmjs.org/@emotion/weak-memoize/-/weak-memoize-0.2.5.tgz", "integrity": "sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==" }, - "@enykeev/react-virtualized": { - "version": "9.22.4-mirror.1", - "resolved": "https://registry.npmjs.org/@enykeev/react-virtualized/-/react-virtualized-9.22.4-mirror.1.tgz", - "integrity": "sha512-NfSYQH9KIvHv+ZSyx7acLxYHhW+fvfMFLcXj8U6AyzRhCSHjuSWRxB3lLqNEseplS60fLRtPs6wG5NLsDDJzjA==", - "requires": { - "@babel/runtime": "^7.7.2", - "clsx": "^1.0.4", - "dom-helpers": "^5.1.3", - "loose-envify": "^1.4.0", - "prop-types": "^15.7.2", - "react-lifecycles-compat": "^3.0.4" - } - }, "@eslint/eslintrc": { "version": "0.4.3", "requires": { @@ -52819,9 +52769,9 @@ } }, "@onfido/castor-icons": { - "version": "2.16.0", - "resolved": "https://registry.npmjs.org/@onfido/castor-icons/-/castor-icons-2.16.0.tgz", - "integrity": "sha512-moThxhRXKxoHrsP8hIoCrtecUX8m5Hjk5yozuYTKqA24iBIQpcDe+SDG/m6slDYpT9iSXediCU4hb7XjpHYjSg==", + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/@onfido/castor-icons/-/castor-icons-2.17.0.tgz", + "integrity": "sha512-dY2QNOFrIEqwCXcjNmH7hqz35CDWtBDlPkwbLYfnhK9ZAV7qUs2wcAxGi/FD4Yvi7MNsRBsFKSoT379hBSQcCw==", "requires": {} }, "@onfido/castor-tokens": { @@ -53304,13 +53254,13 @@ } }, "@sentry-internal/tracing": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.48.0.tgz", - "integrity": "sha512-MFAPDTrvCtfSm0/Zbmx7HA0Q5uCfRadOUpN8Y8rP1ndz+329h2kA3mZRCuC+3/aXL11zs2CHUhcAkGjwH2vogg==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry-internal/tracing/-/tracing-7.50.0.tgz", + "integrity": "sha512-4TQ4vN0aMBWsUXfJWk2xbe4x7fKfwCXgXKTtHC/ocwwKM+0EefV5Iw9YFG8IrIQN4vMtuRzktqcs9q0/Sbv7tg==", "requires": { - "@sentry/core": "7.48.0", - "@sentry/types": "7.48.0", - "@sentry/utils": "7.48.0", + "@sentry/core": "7.50.0", + "@sentry/types": "7.50.0", + "@sentry/utils": "7.50.0", "tslib": "^1.9.3" }, "dependencies": { @@ -53322,15 +53272,15 @@ } }, "@sentry/browser": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.48.0.tgz", - "integrity": "sha512-tdx/2nhuiykncmXFlV4Dpp+Hxgt/v31LiyXE79IcM560wc+QmWKtzoW9azBWQ0xt5KOO3ERMib9qPE4/ql1/EQ==", - "requires": { - "@sentry-internal/tracing": "7.48.0", - "@sentry/core": "7.48.0", - "@sentry/replay": "7.48.0", - "@sentry/types": "7.48.0", - "@sentry/utils": "7.48.0", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/browser/-/browser-7.50.0.tgz", + "integrity": "sha512-a+UYbP89+SAvW47/p9wxEi9eWlyp/SkYl52OCdZNXnplQY4kQIOVyiaIs5nnCxIxZgXKrhAX4eo1E9ykleFuNQ==", + "requires": { + "@sentry-internal/tracing": "7.50.0", + "@sentry/core": "7.50.0", + "@sentry/replay": "7.50.0", + "@sentry/types": "7.50.0", + "@sentry/utils": "7.50.0", "tslib": "^1.9.3" }, "dependencies": { @@ -53342,12 +53292,12 @@ } }, "@sentry/core": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.48.0.tgz", - "integrity": "sha512-8FYuJTMpyuxRZvlen3gQ3rpOtVInSDmSyXqWEhCLuG/w34AtWoTiW7G516rsAAh6Hy1TP91GooMWbonP3XQNTQ==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/core/-/core-7.50.0.tgz", + "integrity": "sha512-6oD1a3fYs4aiNK7tuJSd88LHjYJAetd7ZK/AfJniU7zWKj4jxIYfO8nhm0qdnhEDs81RcweVDmPhWm3Kwrzzsg==", "requires": { - "@sentry/types": "7.48.0", - "@sentry/utils": "7.48.0", + "@sentry/types": "7.50.0", + "@sentry/utils": "7.50.0", "tslib": "^1.9.3" }, "dependencies": { @@ -53359,26 +53309,26 @@ } }, "@sentry/replay": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.48.0.tgz", - "integrity": "sha512-8fRHMGJ0NJeIZi6UucxUTvfDPaBa7+jU1kCTLjCcuH3X/UVz5PtGLMtFSO5U8HP+mUDlPs97MP1uoDvMa4S2Ng==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/replay/-/replay-7.50.0.tgz", + "integrity": "sha512-EYRk+DTZ5luwfkiCaDpBC3YBKIEdkReTUNZtWDVUytSVjsCnttkAipx/y6bxy3HN+rSXungMd3XKQT5RNMRUNA==", "requires": { - "@sentry/core": "7.48.0", - "@sentry/types": "7.48.0", - "@sentry/utils": "7.48.0" + "@sentry/core": "7.50.0", + "@sentry/types": "7.50.0", + "@sentry/utils": "7.50.0" } }, "@sentry/types": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.48.0.tgz", - "integrity": "sha512-kkAszZwQ5/v4n7Yyw/DPNRWx7h724mVNRGZIJa9ggUMvTgMe7UKCZZ5wfQmYiKVlGbwd9pxXAcP8Oq15EbByFQ==" + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/types/-/types-7.50.0.tgz", + "integrity": "sha512-Zo9vyI98QNeYT0K0y57Rb4JRWDaPEgmp+QkQ4CRQZFUTWetO5fvPZ4Gb/R7TW16LajuHZlbJBHmvmNj2pkL2kw==" }, "@sentry/utils": { - "version": "7.48.0", - "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.48.0.tgz", - "integrity": "sha512-d977sghkFVMfld0LrEyyY2gYrfayLPdDEpUDT+hg5y79r7zZDCFyHtdB86699E5K89MwDZahW7Erk+a1nk4x5w==", + "version": "7.50.0", + "resolved": "https://registry.npmjs.org/@sentry/utils/-/utils-7.50.0.tgz", + "integrity": "sha512-iyPwwC6fwJsiPhH27ZbIiSsY5RaccHBqADS2zEjgKYhmP4P9WGgHRDrvLEnkOjqQyKNb6c0yfmv83n0uxYnolw==", "requires": { - "@sentry/types": "7.48.0", + "@sentry/types": "7.50.0", "tslib": "^1.9.3" }, "dependencies": { @@ -54358,9 +54308,9 @@ "integrity": "sha512-h4lTMgMJctJybDp8CQrxTUiiYmedihHWkjnF/8Pxseu2S6Nlfcy8kwboQ8yejh456rP2yWoEVm1sS/FVsfM48w==" }, "@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "@webassemblyjs/ast": { "version": "1.9.0", @@ -55381,9 +55331,9 @@ }, "dependencies": { "@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "colorette": { "version": "1.4.0", @@ -55679,9 +55629,9 @@ } }, "@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "@webassemblyjs/ast": { "version": "1.9.0", @@ -56354,9 +56304,9 @@ }, "dependencies": { "@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "@webassemblyjs/ast": { "version": "1.9.0", @@ -57117,9 +57067,9 @@ "integrity": "sha512-h4lTMgMJctJybDp8CQrxTUiiYmedihHWkjnF/8Pxseu2S6Nlfcy8kwboQ8yejh456rP2yWoEVm1sS/FVsfM48w==" }, "@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "@webassemblyjs/ast": { "version": "1.9.0", @@ -58129,9 +58079,9 @@ }, "dependencies": { "@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "ansi-styles": { "version": "4.3.0", @@ -58462,9 +58412,9 @@ "integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==" }, "@types/node": { - "version": "16.18.24", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.24.tgz", - "integrity": "sha512-zvSN2Esek1aeLdKDYuntKAYjti9Z2oT4I8bfkLLhIxHlv3dwZ5vvATxOc31820iYm4hQRCwjUgDpwSMFjfTUnw==" + "version": "16.18.23", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", + "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" }, "acorn": { "version": "7.4.1", @@ -59158,9 +59108,7 @@ } }, "@types/estree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.1.tgz", - "integrity": "sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==" + "version": "1.0.0" }, "@types/glob": { "version": "7.2.0", @@ -62389,9 +62337,9 @@ } }, "clsx": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz", - "integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==" + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.1.0.tgz", + "integrity": "sha512-3avwM37fSK5oP6M5rQ9CNe99lwxhXDOeSWVPAOYF6OazUTgZCMb0yWlJpmdD74REy1gkEaFiub2ULv4fq9GUhA==" }, "cmd-shim": { "version": "5.0.0", @@ -68313,9 +68261,9 @@ } }, "i18next": { - "version": "22.4.15", - "resolved": "https://registry.npmjs.org/i18next/-/i18next-22.4.15.tgz", - "integrity": "sha512-yYudtbFrrmWKLEhl6jvKUYyYunj4bTBCe2qIUYAxbXoPusY7YmdwPvOE6fx6UIfWvmlbCWDItr7wIs8KEBZ5Zg==", + "version": "22.4.14", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-22.4.14.tgz", + "integrity": "sha512-VtLPtbdwGn0+DAeE00YkiKKXadkwg+rBUV+0v8v0ikEjwdiJ0gmYChVE4GIa9HXymY6wKapkL93vGT7xpq6aTw==", "requires": { "@babel/runtime": "^7.20.6" } @@ -74471,7 +74419,9 @@ "version": "0.1.1" }, "postcss": { - "version": "8.4.19", + "version": "8.4.21", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.21.tgz", + "integrity": "sha512-tP7u/Sn/dVxK2NnruI4H9BG+x+Wxz6oeZ1cJ8P6G/PZY0IKk4k/63TDsQf2kQq3+qoJeLm2kIBUNlZe3zgb4Zg==", "requires": { "nanoid": "^3.3.4", "picocolors": "^1.0.0", @@ -76349,6 +76299,19 @@ "prop-types": "^15.6.2" } }, + "react-virtualized": { + "version": "npm:@enykeev/react-virtualized@9.22.4-mirror.1", + "resolved": "https://registry.npmjs.org/@enykeev/react-virtualized/-/react-virtualized-9.22.4-mirror.1.tgz", + "integrity": "sha512-NfSYQH9KIvHv+ZSyx7acLxYHhW+fvfMFLcXj8U6AyzRhCSHjuSWRxB3lLqNEseplS60fLRtPs6wG5NLsDDJzjA==", + "requires": { + "@babel/runtime": "^7.7.2", + "clsx": "^1.0.4", + "dom-helpers": "^5.1.3", + "loose-envify": "^1.4.0", + "prop-types": "^15.7.2", + "react-lifecycles-compat": "^3.0.4" + } + }, "react-webcam": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/react-webcam/-/react-webcam-7.0.1.tgz", @@ -79748,9 +79711,9 @@ } }, "terser": { - "version": "5.17.1", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.17.1.tgz", - "integrity": "sha512-hVl35zClmpisy6oaoKALOpS0rDYLxRFLHhRuDlEGTKey9qHjS1w9GMORjuwIMt70Wan4lwsLYyWDVnWgF+KUEw==", + "version": "5.16.9", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.16.9.tgz", + "integrity": "sha512-HPa/FdTB9XGI2H1/keLFZHxl6WNvAI4YalHGtDQTlMnJcoqSab1UwL4l1hGEhs6/GmLHBZIg/YgB++jcbzoOEg==", "requires": { "@jridgewell/source-map": "^0.3.2", "acorn": "^8.5.0", @@ -81036,9 +80999,9 @@ "version": "6.1.0" }, "webpack": { - "version": "5.77.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.77.0.tgz", - "integrity": "sha512-sbGNjBr5Ya5ss91yzjeJTLKyfiwo5C628AFjEa6WSXcZa4E+F57om3Cc8xLb1Jh0b243AWuSYRf3dn7HVeFQ9Q==", + "version": "5.75.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.79.0.tgz", + "integrity": "sha512-3mN4rR2Xq+INd6NnYuL9RC9GAmc1ROPKJoHhrZ4pAjdMFEkJJWrsPw8o2JjCIyQyTu7rTXYn4VG6OpyB3CobZg==", "requires": { "@types/eslint-scope": "^3.7.3", "@types/estree": "^1.0.0", @@ -82377,9 +82340,9 @@ "integrity": "sha512-QKxVRxiRACQcVuQEYFsI1hhkrMlrXHPegbbd1yn9UHOmRxY+si12nQYzri3vbzt8VdTTRviqcKxcyllFas5z2A==" }, "xstate": { - "version": "4.37.1", - "resolved": "https://registry.npmjs.org/xstate/-/xstate-4.37.1.tgz", - "integrity": "sha512-MuB7s01nV5vG2CzaBg2msXLGz7JuS+x/NBkQuZAwgEYCnWA8iQMiRz2VGxD3pcFjZAOih3fOgDD3kDaFInEx+g==" + "version": "4.37.2", + "resolved": "https://registry.npmjs.org/xstate/-/xstate-4.37.2.tgz", + "integrity": "sha512-Qm337O49CRTZ3PRyRuK6b+kvI+D3JGxXIZCTul+xEsyFCVkTFDt5jixaL1nBWcUBcaTQ9um/5CRGVItPi7fveg==" }, "xtend": { "version": "4.0.2" diff --git a/packages/account/global.d.ts b/packages/account/global.d.ts deleted file mode 100644 index 5ac902685ee5..000000000000 --- a/packages/account/global.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare module '@binary-com/binary-document-uploader'; diff --git a/packages/account/src/Components/Routes/__tests__/binary-link.spec.tsx b/packages/account/src/Components/Routes/__tests__/binary-link.spec.tsx index 3213b6fa5564..450cbb9b6aa3 100644 --- a/packages/account/src/Components/Routes/__tests__/binary-link.spec.tsx +++ b/packages/account/src/Components/Routes/__tests__/binary-link.spec.tsx @@ -26,7 +26,7 @@ describe('', () => { it('should show and trigger Navlink with path and active className', () => { render( - + Simple test link @@ -41,7 +41,7 @@ describe('', () => { it('should show simple link text', () => { render( - + Simple test link without Navlink @@ -55,7 +55,9 @@ describe('', () => { expect(() => render( - + Simple test link diff --git a/packages/account/src/Components/Routes/__tests__/binary-routes.spec.tsx b/packages/account/src/Components/Routes/__tests__/binary-routes.spec.tsx index 9274750725f3..c57920aaecb8 100644 --- a/packages/account/src/Components/Routes/__tests__/binary-routes.spec.tsx +++ b/packages/account/src/Components/Routes/__tests__/binary-routes.spec.tsx @@ -20,7 +20,7 @@ describe('', () => { it('should render BinaryRoutes with mocked route component', () => { render( - + diff --git a/packages/account/src/Components/Routes/binary-link.tsx b/packages/account/src/Components/Routes/binary-link.tsx index 5ee27c718fe4..19f9649eecb3 100644 --- a/packages/account/src/Components/Routes/binary-link.tsx +++ b/packages/account/src/Components/Routes/binary-link.tsx @@ -3,7 +3,6 @@ import { NavLink } from 'react-router-dom'; import { PlatformContext } from '@deriv/shared'; import getRoutesConfig from 'Constants/routes-config'; import { findRouteByPath, normalizePath } from './helpers'; -import { TPlatformContext } from 'Types'; type TBinaryLink = { active_class: string; @@ -11,7 +10,7 @@ type TBinaryLink = { }; const BinaryLink = ({ active_class, to, children, ...props }: React.PropsWithChildren>) => { - const { is_appstore } = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); const path = normalizePath(to as string); const route = findRouteByPath(path, getRoutesConfig({ is_appstore })); diff --git a/packages/account/src/Components/Routes/binary-routes.tsx b/packages/account/src/Components/Routes/binary-routes.tsx index 4a3c5ae1ad64..39d068eb144d 100644 --- a/packages/account/src/Components/Routes/binary-routes.tsx +++ b/packages/account/src/Components/Routes/binary-routes.tsx @@ -3,11 +3,11 @@ import { Switch } from 'react-router-dom'; import { PlatformContext } from '@deriv/shared'; import { Localize } from '@deriv/translations'; import getRoutesConfig from 'Constants/routes-config'; -import { TBinaryRoutes, TPlatformContext, TRoute } from 'Types'; +import { TBinaryRoutes, TRoute } from 'Types'; import RouteWithSubRoutes from './route-with-sub-routes'; const BinaryRoutes = (props: TBinaryRoutes) => { - const { is_appstore } = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); return ( ', () => { beforeAll(() => { - ReactDOM.createPortal = jest.fn(component => { + (ReactDOM.createPortal as jest.Mock) = jest.fn(component => { return component; }); }); afterAll(() => { - ReactDOM.createPortal.mockClear(); + (ReactDOM.createPortal as jest.Mock).mockClear(); }); const Component = () => ( , + currency: '', + overlay_ref: document.createElement('div'), toggleOverlay: jest.fn(), }} > @@ -35,7 +36,7 @@ describe('', () => { it('should go to help-centre page if the Help Centre link on the text is clicked', () => { render(); - expect(screen.getByText('Help Centre').closest('a')).toHaveAttribute('href', 'https://deriv.com/help-centre'); + expect(screen.getByText('Help Centre').hasAttribute('href')); }); it('should show Done Button', () => { render(); diff --git a/packages/account/src/Components/account-limits/__tests__/account-limits-article.spec.js b/packages/account/src/Components/account-limits/__tests__/account-limits-article.spec.tsx similarity index 95% rename from packages/account/src/Components/account-limits/__tests__/account-limits-article.spec.js rename to packages/account/src/Components/account-limits/__tests__/account-limits-article.spec.tsx index c460f91b6532..077ca1f65445 100644 --- a/packages/account/src/Components/account-limits/__tests__/account-limits-article.spec.js +++ b/packages/account/src/Components/account-limits/__tests__/account-limits-article.spec.tsx @@ -23,7 +23,7 @@ describe('', () => { it('should go to help-centre page if the Help Centre link on the text is clicked', () => { render(); - expect(screen.getByText('Help Centre.').closest('a')).toHaveAttribute( + expect(screen.getByText('Help Centre.')).toHaveAttribute( 'href', 'https://deriv.com/help-centre/trading/#trading-limits' ); diff --git a/packages/account/src/Components/account-limits/__tests__/account-limits.spec.js b/packages/account/src/Components/account-limits/__tests__/account-limits.spec.tsx similarity index 85% rename from packages/account/src/Components/account-limits/__tests__/account-limits.spec.js rename to packages/account/src/Components/account-limits/__tests__/account-limits.spec.tsx index 28a8b407f8d1..bc0f8b7f825c 100644 --- a/packages/account/src/Components/account-limits/__tests__/account-limits.spec.js +++ b/packages/account/src/Components/account-limits/__tests__/account-limits.spec.tsx @@ -7,7 +7,7 @@ import { BrowserRouter } from 'react-router-dom'; jest.mock('Stores/connect.js', () => ({ __esModule: true, default: 'mockedDefaultExport', - connect: () => Component => Component, + connect: () => (Component: React.ReactElement) => Component, })); jest.mock('@deriv/components', () => { @@ -31,11 +31,12 @@ jest.mock('Components/load-error-message', () => jest.fn(() => 'mockedLoadErrorM jest.mock('../account-limits-footer', () => jest.fn(() => 'mockedAccountLimitsFooter')); describe('', () => { - const props = { + const props: React.ComponentProps = { currency: 'AUD', is_fully_authenticated: true, is_switching: false, is_virtual: false, + overlay_ref: document.createElement('div'), getLimits: jest.fn(() => Promise.resolve({ data: {} })), account_limits: { account_balance: 300000, @@ -66,9 +67,9 @@ describe('', () => { cryptocurrency: [ { name: 'Cryptocurrencies', - payout_limit: '100.00', + payout_limit: 100.0, profile_name: 'extreme_risk', - turnover_limit: '1000.00', + turnover_limit: 1000.0, }, ], forex: [ @@ -124,15 +125,31 @@ describe('', () => { }); it('should render DemoMessage component if is_virtual is true', () => { - const { container } = render(); - expect(container.firstChild).toHaveClass('account__demo-message-wrapper'); - + render(); + expect(screen.queryByTestId('dt_account_demo_message_wrapper')).toHaveClass('account__demo-message-wrapper'); expect(screen.getByText('mockedDemoMessage')).toBeInTheDocument(); }); it('should render LoadErrorMessage component if there is api_initial_load_error', () => { render( - + ); expect(screen.getByText('mockedLoadErrorMessage')).toBeInTheDocument(); }); @@ -153,8 +170,8 @@ describe('', () => { }); it('should render AccountLimitsArticle component if should_show_article is true and is_from_derivgo is false in mobile mode', () => { - isMobile.mockReturnValue(true); - isDesktop.mockReturnValue(false); + (isMobile as jest.Mock).mockReturnValue(true); + (isDesktop as jest.Mock).mockReturnValue(false); render(); expect(screen.getByRole('heading', { name: /account limits/i })).toBeInTheDocument(); expect( @@ -163,8 +180,8 @@ describe('', () => { }); it('should render AccountLimitsArticle component if should_show_article is true and is_from_derivgo is true in mobile mode', () => { - isMobile.mockReturnValue(true); - isDesktop.mockReturnValue(false); + (isMobile as jest.Mock).mockReturnValue(true); + (isDesktop as jest.Mock).mockReturnValue(false); render(); expect(screen.getByRole('heading', { name: /account limits/i })).toBeInTheDocument(); expect( @@ -173,8 +190,8 @@ describe('', () => { }); it('should not render AccountLimitsArticle component if should_show_article is false', () => { - isMobile.mockReturnValue(true); - isDesktop.mockReturnValue(false); + (isMobile as jest.Mock).mockReturnValue(true); + (isDesktop as jest.Mock).mockReturnValue(false); render(); expect(screen.queryByText('/account limits/i')).not.toBeInTheDocument(); }); @@ -210,7 +227,7 @@ describe('', () => { const { open_positions } = props.account_limits; expect( screen.getByRole('cell', { - name: open_positions, + name: open_positions?.toString(), }) ).toBeInTheDocument(); }); @@ -273,7 +290,7 @@ describe('', () => { it('withdrawal_limits_table should show `Total withdrawal limit` if is_fully_authenticated is false and is_appstore is true', () => { render( - + @@ -284,7 +301,7 @@ describe('', () => { it('withdrawal_limits_table should show `Total withdrawal allowed` when is_fully_authenticated is false and is_appstore is true', () => { render( - + ); @@ -293,20 +310,17 @@ describe('', () => { it('withdrawal_limits_table should show the verfiy button when is_fully_authenticated is false and is_appstore is true', () => { render( - + ); expect(screen.getByText(/to increase limit please verify your identity/i)).toBeInTheDocument(); - expect( - screen - .getByRole('link', { - name: /verify/i, - }) - .closest('a') + screen.getByRole('link', { + name: /verify/i, + }) ).toHaveAttribute('href', '/account/proof-of-identity'); const { num_of_days_limit } = props.account_limits; expect(formatMoney).toHaveBeenCalledWith(props.currency, num_of_days_limit, true); @@ -314,7 +328,7 @@ describe('', () => { it('withdrawal_limits_table should show total withdrawn and withdrawn remaining details', () => { render( - + @@ -330,10 +344,10 @@ describe('', () => { }); it('should show limit_notice message when is_appstore is true and is_fully_authenticated is false in mobile mode', () => { - isDesktop.mockReturnValue(false); - isMobile.mockReturnValue(true); + (isMobile as jest.Mock).mockReturnValue(true); + (isDesktop as jest.Mock).mockReturnValue(false); render( - + @@ -343,10 +357,10 @@ describe('', () => { }); it('should not show limit_notice message when is_appstore is false and is_fully_authenticated is false', () => { - isDesktop.mockReturnValue(true); - isMobile.mockReturnValue(false); + (isMobile as jest.Mock).mockReturnValue(false); + (isDesktop as jest.Mock).mockReturnValue(true); render( - + @@ -358,8 +372,8 @@ describe('', () => { }); it('should show AccountLimitsArticle when should_show_article and isDesktop is true', () => { - isDesktop.mockReturnValue(true); - isMobile.mockReturnValue(false); + (isMobile as jest.Mock).mockReturnValue(false); + (isDesktop as jest.Mock).mockReturnValue(true); render(); expect(screen.getByRole('heading', { name: /account limits/i })).toBeInTheDocument(); expect(screen.getByText(/these are default limits that we apply to your accounts\./i)).toBeInTheDocument(); @@ -367,16 +381,15 @@ describe('', () => { screen.getByText(/to learn more about trading limits and how they apply, please go to the/i) ).toBeInTheDocument(); expect( - screen - .getByRole('link', { - name: /help centre/i, - }) - .closest('a') + screen.getByRole('link', { + name: /help centre/i, + }) ).toHaveAttribute('href', 'https://deriv.com/help-centre/trading/#trading-limits'); }); it('should show AccountLimitsFooter if footer_ref is passed', () => { - const footer = { current: { offsetWidth: 100 } }; + const footer = React.createRef(); + render(); expect(screen.getByText(/mockedaccountlimitsfooter/i)).toBeInTheDocument(); }); diff --git a/packages/account/src/Components/account-limits/account-limits-article.jsx b/packages/account/src/Components/account-limits/account-limits-article.tsx similarity index 88% rename from packages/account/src/Components/account-limits/account-limits-article.jsx rename to packages/account/src/Components/account-limits/account-limits-article.tsx index 696327cebf7a..ab843d110855 100644 --- a/packages/account/src/Components/account-limits/account-limits-article.jsx +++ b/packages/account/src/Components/account-limits/account-limits-article.tsx @@ -4,7 +4,11 @@ import { StaticUrl } from '@deriv/components'; import { Localize, localize } from '@deriv/translations'; import AccountArticle from 'Components/article'; -const AccountLimitsArticle = ({ is_from_derivgo }) => { +type TAccountLimitsArticle = { + is_from_derivgo?: boolean; +}; + +const AccountLimitsArticle = ({ is_from_derivgo }: TAccountLimitsArticle) => { const getDescription = () => { const description = [ , diff --git a/packages/account/src/Components/account-limits/account-limits-context.tsx b/packages/account/src/Components/account-limits/account-limits-context.tsx index e1237f0462a4..3ee0a4067ad8 100644 --- a/packages/account/src/Components/account-limits/account-limits-context.tsx +++ b/packages/account/src/Components/account-limits/account-limits-context.tsx @@ -3,10 +3,13 @@ import * as React from 'react'; export type TAccountLimitsContext = { currency: string; footer_ref?: React.RefObject; - overlay_ref?: React.RefObject; - toggleOverlay?: () => boolean; + overlay_ref: HTMLDivElement; + toggleOverlay?: () => void; }; -const AccountLimitsContext = React.createContext({ currency: '' }); +const AccountLimitsContext = React.createContext({ + currency: '', + overlay_ref: document.createElement('div'), +}); export default AccountLimitsContext; diff --git a/packages/account/src/Components/account-limits/account-limits-overlay.jsx b/packages/account/src/Components/account-limits/account-limits-overlay.tsx similarity index 100% rename from packages/account/src/Components/account-limits/account-limits-overlay.jsx rename to packages/account/src/Components/account-limits/account-limits-overlay.tsx diff --git a/packages/account/src/Components/account-limits/account-limits-turnover-limit-row.tsx b/packages/account/src/Components/account-limits/account-limits-turnover-limit-row.tsx index ffbae261b3a8..2fd4b11e538f 100644 --- a/packages/account/src/Components/account-limits/account-limits-turnover-limit-row.tsx +++ b/packages/account/src/Components/account-limits/account-limits-turnover-limit-row.tsx @@ -3,8 +3,8 @@ import { formatMoney } from '@deriv/shared'; import AccountLimitsTableCell from './account-limits-table-cell'; import AccountLimitsContext, { TAccountLimitsContext } from './account-limits-context'; -type TAccountLimits = { - level: string; +export type TAccountLimitsCollection = { + level?: string; name: string; payout_limit: number; profile_name: string; @@ -12,8 +12,8 @@ type TAccountLimits = { }; type TAccountLimitsTurnoverLimitRow = { - collection: TAccountLimits[]; - title: string; + collection: TAccountLimitsCollection[]; + title?: string; }; const AccountLimitsTurnoverLimitRow = ({ collection, title }: TAccountLimitsTurnoverLimitRow) => { diff --git a/packages/account/src/Components/account-limits/account-limits.jsx b/packages/account/src/Components/account-limits/account-limits.tsx similarity index 90% rename from packages/account/src/Components/account-limits/account-limits.jsx rename to packages/account/src/Components/account-limits/account-limits.tsx index 0e1cf2a4dcc3..78ad00173a5a 100644 --- a/packages/account/src/Components/account-limits/account-limits.jsx +++ b/packages/account/src/Components/account-limits/account-limits.tsx @@ -1,19 +1,55 @@ -import PropTypes from 'prop-types'; -import * as React from 'react'; +import React from 'react'; import classNames from 'classnames'; import { Loading, ThemedScrollbars, Text, ButtonLink } from '@deriv/components'; import { formatMoney, isDesktop, isMobile, useIsMounted, PlatformContext } from '@deriv/shared'; import { Localize, localize } from '@deriv/translations'; import LoadErrorMessage from 'Components/load-error-message'; import DemoMessage from 'Components/demo-message'; -import AccountLimitsArticle from './account-limits-article.jsx'; -import AccountLimitsContext from './account-limits-context'; +import AccountLimitsArticle from './account-limits-article'; +import AccountLimitsContext, { TAccountLimitsContext } from './account-limits-context'; import AccountLimitsExtraInfo from './account-limits-extra-info'; import AccountLimitsFooter from './account-limits-footer'; -import AccountLimitsOverlay from './account-limits-overlay.jsx'; +import AccountLimitsOverlay from './account-limits-overlay'; import AccountLimitsTableCell from './account-limits-table-cell'; import AccountLimitsTableHeader from './account-limits-table-header'; -import AccountLimitsTurnoverLimitRow from './account-limits-turnover-limit-row'; +import AccountLimitsTurnoverLimitRow, { TAccountLimitsCollection } from './account-limits-turnover-limit-row'; +import { FormikValues } from 'formik'; + +type TAccountLimits = { + account_limits: { + api_initial_load_error?: string; + open_positions?: React.ReactNode; + account_balance: string | number; + daily_transfers?: object; + payout: string | number; + lifetime_limit?: number; + market_specific: { + commodities: TAccountLimitsCollection[]; + cryptocurrency: TAccountLimitsCollection[]; + forex: TAccountLimitsCollection[]; + indices: TAccountLimitsCollection[]; + synthetic_index: TAccountLimitsCollection[]; + }; + num_of_days?: number; + num_of_days_limit: string | number; + remainder: string | number; + withdrawal_for_x_days_monetary?: number; + withdrawal_since_inception_monetary: string | number; + }; + currency: string; + footer_ref?: React.RefObject; + is_app_settings?: boolean; + getLimits: () => Promise<{ data: object }>; + is_fully_authenticated: boolean; + is_from_derivgo?: boolean; + is_switching: boolean; + is_virtual: boolean; + overlay_ref: HTMLDivElement; + setIsOverlayShown?: (is_overlay_shown?: boolean) => void; + setIsPopupOverlayShown?: (is_popup_overlay_shown: boolean) => void; + should_bypass_scrollbars?: boolean; + should_show_article?: boolean; +}; const AccountLimits = ({ account_limits, @@ -29,7 +65,7 @@ const AccountLimits = ({ setIsOverlayShown: setIsPopupOverlayShown, should_bypass_scrollbars, should_show_article, -}) => { +}: TAccountLimits) => { const isMounted = useIsMounted(); const [is_loading, setLoading] = React.useState(false); const [is_overlay_shown, setIsOverlayShown] = React.useState(false); @@ -67,6 +103,7 @@ const AccountLimits = ({ if (is_virtual) { return (
; @@ -96,17 +133,14 @@ const AccountLimits = ({ } const { commodities, forex, indices, synthetic_index } = { ...market_specific }; - const forex_ordered = forex?.slice().sort((a, b) => (a.name > b.name ? 1 : b.name > a.name ? -1 : 0)); - // sort submarkets by names alphabetically and put 'market' at the beginning + const forex_ordered = forex + ?.slice() + .sort((a: FormikValues, b: FormikValues) => (a.name > b.name ? 1 : b.name > a.name ? -1 : 0)); const derived_ordered = synthetic_index ?.slice() - .sort((a, b) => - a.level === 'submarket' && b.level === 'submarket' - ? a.name.localeCompare(b.name) - : a.level.localeCompare(b.level) - ); + .sort((a: FormikValues, b: FormikValues) => (a.level > b.level ? 1 : -1)); - const context_value = { + const context_value: TAccountLimitsContext = { currency, footer_ref, overlay_ref, @@ -340,21 +374,4 @@ const AccountLimits = ({ ); }; -AccountLimits.propTypes = { - account_limits: PropTypes.object, - currency: PropTypes.string.isRequired, - footer_ref: PropTypes.shape({ current: PropTypes.any }), - is_app_settings: PropTypes.bool, - getLimits: PropTypes.func.isRequired, - is_fully_authenticated: PropTypes.bool.isRequired, - is_from_derivgo: PropTypes.bool, - is_switching: PropTypes.bool.isRequired, - is_virtual: PropTypes.bool.isRequired, - overlay_ref: PropTypes.shape({ current: PropTypes.any }), - setIsOverlayShown: PropTypes.func, - setIsPopupOverlayShown: PropTypes.func, - should_bypass_scrollbars: PropTypes.bool, - should_show_article: PropTypes.bool, -}; - export default AccountLimits; diff --git a/packages/account/src/Components/account-limits/index.js b/packages/account/src/Components/account-limits/index.js deleted file mode 100644 index 393812bb5309..000000000000 --- a/packages/account/src/Components/account-limits/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import AccountLimits from './account-limits.jsx'; - -export default AccountLimits; diff --git a/packages/account/src/Components/account-limits/index.ts b/packages/account/src/Components/account-limits/index.ts new file mode 100644 index 000000000000..89602f41cdc9 --- /dev/null +++ b/packages/account/src/Components/account-limits/index.ts @@ -0,0 +1,3 @@ +import AccountLimits from './account-limits'; + +export default AccountLimits; diff --git a/packages/account/src/Components/address-details/__tests__/address-details.spec.js b/packages/account/src/Components/address-details/__tests__/address-details.spec.tsx similarity index 85% rename from packages/account/src/Components/address-details/__tests__/address-details.spec.js rename to packages/account/src/Components/address-details/__tests__/address-details.spec.tsx index 1038ac9a35a9..5a164d196e16 100644 --- a/packages/account/src/Components/address-details/__tests__/address-details.spec.js +++ b/packages/account/src/Components/address-details/__tests__/address-details.spec.tsx @@ -1,7 +1,8 @@ import React from 'react'; import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import AddressDetails from '../address-details'; -import { isDesktop, isMobile, PlatformContext } from '@deriv/shared'; +import { isDesktop, isMobile, PlatformContext, TLocationList } from '@deriv/shared'; +import { FormikProps, FormikValues } from 'formik'; jest.mock('@deriv/shared', () => ({ ...jest.requireActual('@deriv/shared'), @@ -32,10 +33,10 @@ describe('', () => { const verification_info = 'We need this for verification. If the information you provide is fake or inaccurate, you won’t be able to deposit and withdraw.'; - let modal_root_el; + let modal_root_el: HTMLDivElement; - const mock_props = { - fetchStatesList: jest.fn(() => []), + const mock_props: React.ComponentProps = { + fetchStatesList: jest.fn(() => Promise.resolve([])), getCurrentStep: jest.fn(), goToNextStep: jest.fn(), goToPreviousStep: jest.fn(), @@ -45,7 +46,7 @@ describe('', () => { onSave: jest.fn(), onSubmit: jest.fn(), onSubmitEnabledChange: jest.fn(), - selected_step_ref: { current: { isSubmitting: false } }, + selected_step_ref: { current: { isSubmitting: false } } as React.RefObject>, states_list: [], value: { address_city: '', @@ -74,8 +75,8 @@ describe('', () => { }; beforeEach(() => { - isDesktop.mockReturnValue(true); - isMobile.mockReturnValue(false); + (isDesktop as jest.Mock).mockReturnValue(true); + (isMobile as jest.Mock).mockReturnValue(false); jest.clearAllMocks(); }); @@ -90,8 +91,8 @@ describe('', () => { }); it('should render AddressDetails component for mobile', async () => { - isDesktop.mockReturnValue(false); - isMobile.mockReturnValue(true); + (isDesktop as jest.Mock).mockReturnValue(false); + (isMobile as jest.Mock).mockReturnValue(true); render(); @@ -100,7 +101,7 @@ describe('', () => { }); expect(screen.queryByText(verification_info)).not.toBeInTheDocument(); - const inputs = screen.getAllByRole('textbox'); + const inputs: HTMLTextAreaElement[] = screen.getAllByRole('textbox'); expect(inputs.length).toBe(5); const required_fields = inputs.filter(input => input.required === true); expect(required_fields.length).toBe(2); @@ -114,7 +115,7 @@ describe('', () => { }); expect(screen.queryByText(verification_info)).not.toBeInTheDocument(); - const inputs = screen.getAllByRole('textbox'); + const inputs: HTMLTextAreaElement[] = screen.getAllByRole('textbox'); expect(inputs.length).toBe(5); const required_fields = inputs.filter(input => input.required === true); @@ -126,7 +127,7 @@ describe('', () => { expect(mock_props.onCancel).toHaveBeenCalledTimes(1); expect(mock_props.onSave).toHaveBeenCalledTimes(1); - const address_line_1_input = screen.getByPlaceholderText(address_line_1); + const address_line_1_input: HTMLInputElement = screen.getByPlaceholderText(address_line_1); const first_line_adress_text = 'Test first line address'; expect(address_line_1_input.value).toBe(''); fireEvent.change(address_line_1_input, { target: { value: first_line_adress_text } }); @@ -134,7 +135,7 @@ describe('', () => { expect(address_line_1_input.value).toBe(first_line_adress_text); }); - const address_town_input = screen.getByPlaceholderText(address_town); + const address_town_input: HTMLInputElement = screen.getByPlaceholderText(address_town); const address_town_text = 'Test city'; expect(address_town_input.value).toBe(''); fireEvent.change(address_town_input, { target: { value: address_town_text } }); @@ -142,7 +143,7 @@ describe('', () => { expect(address_town_input.value).toBe(address_town_text); }); - const address_postcode_input = screen.getByPlaceholderText(address_postcode); + const address_postcode_input: HTMLInputElement = screen.getByPlaceholderText(address_postcode); const address_postcode_text = 'Test postcode'; expect(address_postcode_input.value).toBe(''); fireEvent.change(address_postcode_input, { target: { value: address_postcode_text } }); @@ -150,7 +151,7 @@ describe('', () => { expect(address_postcode_input.value).toBe(address_postcode_text); }); - const address_state_input = screen.getByPlaceholderText(address_state); + const address_state_input: HTMLInputElement = screen.getByPlaceholderText(address_state); const address_state_text = 'Test state'; expect(address_state_input.value).toBe('Default test state'); fireEvent.change(address_state_input, { target: { value: address_state_text } }); @@ -173,7 +174,7 @@ describe('', () => { expect(mock_props.onSubmitEnabledChange).toHaveBeenCalledTimes(1); - const inputs = screen.getAllByRole('textbox'); + const inputs: HTMLTextAreaElement[] = screen.getAllByRole('textbox'); expect(inputs.length).toBe(5); const required_fields = inputs.filter(input => input.required === true); expect(required_fields.length).toBe(0); @@ -196,7 +197,7 @@ describe('', () => { it('should render AddressDetails component for appstore', async () => { render( - + ); @@ -207,7 +208,7 @@ describe('', () => { }); expect(screen.queryByText(use_address_info)).not.toBeInTheDocument(); - const inputs = screen.getAllByRole('textbox'); + const inputs: HTMLTextAreaElement[] = screen.getAllByRole('textbox'); expect(inputs.length).toBe(5); const required_fields = inputs.filter(input => input.required === true); @@ -228,19 +229,19 @@ describe('', () => { }); it('should render AddressDetails component with states_list for mobile', async () => { - isDesktop.mockReturnValue(false); - isMobile.mockReturnValue(true); + (isDesktop as jest.Mock).mockReturnValue(false); + (isMobile as jest.Mock).mockReturnValue(true); mock_props.states_list = [ { text: 'State 1', value: 'State 1' }, { text: 'State 2', value: 'State 2' }, - ]; + ] as TLocationList[]; render(); expect(screen.getByText('Default test state')).toBeInTheDocument(); - const address_state_input = screen.getByRole('combobox'); + const address_state_input: HTMLInputElement = screen.getByRole('combobox'); expect(address_state_input.value).toBe(''); fireEvent.change(address_state_input, { target: { value: 'State 2' } }); await waitFor(() => { @@ -252,12 +253,12 @@ describe('', () => { mock_props.states_list = [ { text: 'State 1', value: 'State 1' }, { text: 'State 2', value: 'State 2' }, - ]; + ] as TLocationList[]; render(); - const address_state_input = screen.getByRole('textbox', { name: 'State/Province' }); - expect(address_state_input.value).toBe('Default test state'); + const address_state_input: HTMLTextAreaElement = screen.getByRole('textbox', { name: 'State/Province' }); + expect(address_state_input).toHaveValue('Default test state'); fireEvent.change(address_state_input, { target: { value: 'State 1' } }); await waitFor(() => { expect(address_state_input.value).toBe('State 1'); diff --git a/packages/account/src/Components/address-details/address-details.jsx b/packages/account/src/Components/address-details/address-details.tsx similarity index 85% rename from packages/account/src/Components/address-details/address-details.jsx rename to packages/account/src/Components/address-details/address-details.tsx index 798ca66f7459..804437058b69 100644 --- a/packages/account/src/Components/address-details/address-details.jsx +++ b/packages/account/src/Components/address-details/address-details.tsx @@ -1,4 +1,4 @@ -import { Formik, Field } from 'formik'; +import { Formik, Field, FormikProps, FormikValues } from 'formik'; import React from 'react'; import { Modal, @@ -15,13 +15,63 @@ import { Text, } from '@deriv/components'; import { localize, Localize } from '@deriv/translations'; -import { isDesktop, isMobile, getLocation, makeCancellablePromise, PlatformContext } from '@deriv/shared'; +import { + isDesktop, + isMobile, + getLocation, + makeCancellablePromise, + PlatformContext, + TLocationList, +} from '@deriv/shared'; import { splitValidationResultTypes } from '../real-account-signup/helpers/utils'; -const InputField = props => { +type TAddressDetails = { + states_list: TLocationList[]; + getCurrentStep?: () => number; + onSave: (current_step: number, values: FormikValues) => void; + onCancel: (current_step: number, goToPreviousStep: () => void) => void; + goToNextStep: () => void; + goToPreviousStep: () => void; + validate: (values: FormikValues) => FormikValues; + onSubmit: ( + current_step: number | null, + values: FormikValues, + action: (isSubmitting: boolean) => void, + next_step: () => void + ) => void; + is_svg: boolean; + is_mf?: boolean; + is_gb_residence: boolean | string; + onSubmitEnabledChange: (is_submit_disabled: boolean) => void; + selected_step_ref?: React.RefObject>; + fetchStatesList: () => Promise; + value: FormikValues; +}; + +type TFormValidation = { + warnings: { [key: string]: string }; + errors: { [key: string]: string }; +}; + +type TInputField = { + name: string; + required?: boolean | string; + label: string; + maxLength?: number | string; + placeholder: string; + onChange?: (e: any) => void; + disabled?: string; +}; + +type TAutoComplete = { + value: boolean; + text: string; +}; + +const InputField = (props: TInputField) => { return ( - {({ field, form: { errors, touched } }) => ( + {({ field, form: { errors, touched } }: FormikValues) => ( { +}: TAddressDetails) => { const { is_appstore } = React.useContext(PlatformContext); const [has_fetched_states_list, setHasFetchedStatesList] = React.useState(false); const [address_state_to_display, setAddressStateToDisplay] = React.useState(''); @@ -74,13 +124,13 @@ const AddressDetails = ({ // eslint-disable-next-line react-hooks/exhaustive-deps }, []); - const is_submit_disabled_ref = React.useRef(true); + const is_submit_disabled_ref = React.useRef(true); - const isSubmitDisabled = errors => { - return selected_step_ref?.current?.isSubmitting || Object.keys(errors).length > 0; + const isSubmitDisabled = (errors?: { [key: string]: string } | FormikValues) => { + return selected_step_ref?.current?.isSubmitting || (errors && Object.keys(errors).length > 0); }; - const checkSubmitStatus = errors => { + const checkSubmitStatus = (errors?: { [key: string]: string }) => { const is_submit_disabled = isSubmitDisabled(errors); if (is_submit_disabled_ref.current !== is_submit_disabled) { @@ -89,14 +139,14 @@ const AddressDetails = ({ } }; - const handleCancel = values => { - const current_step = getCurrentStep() - 1; + const handleCancel = (values: FormikValues) => { + const current_step = (getCurrentStep?.() || 1) - 1; onSave(current_step, values); onCancel(current_step, goToPreviousStep); }; - const handleValidate = values => { - const { errors } = splitValidationResultTypes(validate(values)); + const handleValidate = (values: FormikValues) => { + const { errors }: Partial = splitValidationResultTypes(validate(values)); checkSubmitStatus(errors); return errors; }; @@ -113,12 +163,12 @@ const AddressDetails = ({ ? getLocation(states_list, address_state_to_display, 'value') : getLocation(states_list, values.address_state, 'value'); } - onSubmit(getCurrentStep() - 1, values, actions.setSubmitting, goToNextStep); + onSubmit((getCurrentStep?.() || 1) - 1, values, actions.setSubmitting, goToNextStep); }} > - {({ handleSubmit, errors, values, setFieldValue, handleChange, setFieldTouched }) => ( + {({ handleSubmit, errors, values, setFieldValue, handleChange, setFieldTouched }: FormikValues) => ( - {({ setRef, height }) => ( + {({ setRef, height }: { setRef: (instance: HTMLFormElement) => void; height: number | string }) => (
{is_appstore && (
- + {localize( 'We need this for verification. If the information you provide is fake or inaccurate, you won’t be able to deposit and withdraw.' )} @@ -201,7 +251,7 @@ const AddressDetails = ({ )} {states_list?.length > 0 ? ( - {({ field }) => ( + {({ field }: FormikValues) => ( <> { + onItemSelection={({ value, text }: TAutoComplete) => { setFieldValue( 'address_state', value ? text : '', @@ -236,7 +286,7 @@ const AddressDetails = ({ value={address_state_to_display || values.address_state} list_items={states_list} use_text={true} - onChange={e => { + onChange={(e: { target: { value: string } }) => { setFieldValue( 'address_state', e.target.value, diff --git a/packages/account/src/Components/address-details/index.js b/packages/account/src/Components/address-details/index.js index 627db7449b41..549993faa2ab 100644 --- a/packages/account/src/Components/address-details/index.js +++ b/packages/account/src/Components/address-details/index.js @@ -1,3 +1,3 @@ -import AddressDetails from './address-details.jsx'; +import AddressDetails from './address-details'; export default AddressDetails; diff --git a/packages/account/src/Components/currency-selector/__tests__/currency-selector.spec.tsx b/packages/account/src/Components/currency-selector/__tests__/currency-selector.spec.tsx index 7d1c3c71e0a4..cbaaa1a1fece 100644 --- a/packages/account/src/Components/currency-selector/__tests__/currency-selector.spec.tsx +++ b/packages/account/src/Components/currency-selector/__tests__/currency-selector.spec.tsx @@ -360,7 +360,7 @@ describe('', () => { value: 150, }); render( - + ); diff --git a/packages/account/src/Components/currency-selector/currency-selector.tsx b/packages/account/src/Components/currency-selector/currency-selector.tsx index 7509542e234f..37d9b0b89264 100644 --- a/packages/account/src/Components/currency-selector/currency-selector.tsx +++ b/packages/account/src/Components/currency-selector/currency-selector.tsx @@ -14,14 +14,14 @@ import { localize, Localize } from '@deriv/translations'; import RadioButtonGroup from './radio-button-group'; import RadioButton from './radio-button'; import { splitValidationResultTypes } from '../real-account-signup/helpers/utils'; -import { TAuthAccountInfo, TCurrencyConfig, TPlatformContext, TRealAccount, TFormValidation } from 'Types'; +import { TAuthAccountInfo, TCurrencyConfig, TRealAccount, TFormValidation } from 'Types'; export const Hr = () =>
; type TCurrencySelectorExtend = { accounts: { [key: string]: TAuthAccountInfo }; available_crypto_currencies: TCurrencyConfig[]; - getCurrentStep?: () => number; + getCurrentStep: () => number; goToNextStep: () => void; goToStep: (step: number) => void; goToPreviousStep: () => void; @@ -84,7 +84,7 @@ const CurrencySelector = ({ is_eu, ...props }: TCurrencySelector) => { - const { is_appstore }: Partial = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); const crypto = legal_allowed_currencies.filter((currency: TCurrencyConfig) => currency.type === 'crypto'); const fiat = legal_allowed_currencies.filter((currency: TCurrencyConfig) => currency.type === 'fiat'); const [is_bypass_step, setIsBypassStep] = React.useState(false); @@ -195,7 +195,7 @@ const CurrencySelector = ({ > {({ handleSubmit, values }: FormikState & FormikHandlers) => ( - {({ setRef, height }: { setRef: string; height: number }) => ( + {({ setRef, height }: { setRef: (instance: HTMLFormElement | null) => void; height: number }) => ( - {reorderCurrencies(fiat).map((currency: TCurrencyConfig) => ( + {reorderCurrencies(fiat).map((currency: FormikValues) => ( - {reorderCurrencies(crypto, 'crypto').map( - (currency: TCurrencyConfig) => ( - - value === currency.value - )?.length === 0 - } - name='currency' - id={currency.value} - label={currency.name} - /> - ) - )} + {reorderCurrencies(crypto, 'crypto').map((currency: FormikValues) => ( + value === currency.value + )?.length === 0 + } + name='currency' + id={currency.value} + label={currency.name} + /> + ))} )} diff --git a/packages/account/src/Components/currency-selector/radio-button-group.tsx b/packages/account/src/Components/currency-selector/radio-button-group.tsx index 0c028cbfe850..31ae2ab10ead 100644 --- a/packages/account/src/Components/currency-selector/radio-button-group.tsx +++ b/packages/account/src/Components/currency-selector/radio-button-group.tsx @@ -5,7 +5,7 @@ import { Text } from '@deriv/components'; export type TRadioButtonGroup = { className: string; - is_fiat: boolean; + is_fiat?: boolean; is_title_enabled?: boolean; item_count: number; label: string; diff --git a/packages/account/src/Components/form-body-section/form-body-section.tsx b/packages/account/src/Components/form-body-section/form-body-section.tsx index 5c67baa36b47..5260fa2f86b0 100644 --- a/packages/account/src/Components/form-body-section/form-body-section.tsx +++ b/packages/account/src/Components/form-body-section/form-body-section.tsx @@ -2,7 +2,6 @@ import React from 'react'; import classNames from 'classnames'; import { Text } from '@deriv/components'; import { PlatformContext } from '@deriv/shared'; -import { TPlatformContext } from 'Types'; export type TFormBodySection = { has_side_note?: boolean; @@ -10,7 +9,8 @@ export type TFormBodySection = { }; const FormBodySection = ({ children, has_side_note, side_note }: React.PropsWithChildren) => { - const { is_appstore }: Partial = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); + if (has_side_note) { return (
) => { - const { is_appstore }: Partial = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); + return (
{ - const { is_appstore }: Partial = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); return (
diff --git a/packages/account/src/Components/leave-confirm/leave-confirm.tsx b/packages/account/src/Components/leave-confirm/leave-confirm.tsx index cb6af61d0ba8..fb60e32afad5 100644 --- a/packages/account/src/Components/leave-confirm/leave-confirm.tsx +++ b/packages/account/src/Components/leave-confirm/leave-confirm.tsx @@ -5,7 +5,6 @@ import { Button, Icon, Modal } from '@deriv/components'; import { isMobile, PlatformContext } from '@deriv/shared'; import { localize } from '@deriv/translations'; import IconMessageContent from 'Components/icon-message-content'; -import { TPlatformContext } from 'Types'; type TLeaveConfirmMessage = { back: () => void; @@ -18,7 +17,8 @@ type TTransitionBlocker = { }; const LeaveConfirmMessage = ({ back, leave }: TLeaveConfirmMessage) => { - const { is_appstore } = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); + return ( { - const { is_appstore }: TPlatformContext = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); const message = localize('Your documents were submitted successfully'); if (needs_poi) { return ( diff --git a/packages/account/src/Components/poa/status/unverified/unverified.tsx b/packages/account/src/Components/poa/status/unverified/unverified.tsx index 65c5f50f426f..fcc5ec672c00 100644 --- a/packages/account/src/Components/poa/status/unverified/unverified.tsx +++ b/packages/account/src/Components/poa/status/unverified/unverified.tsx @@ -3,14 +3,14 @@ import { PlatformContext } from '@deriv/shared'; import { Button, Icon, Text } from '@deriv/components'; import { localize } from '@deriv/translations'; import IconMessageContent from 'Components/icon-message-content'; -import { TPlatformContext } from 'Types'; type TUnverified = { onClick: () => void; }; export const Unverified = ({ onClick }: TUnverified) => { - const { is_appstore }: TPlatformContext = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); + return ( { - const { is_appstore }: TPlatformContext = React.useContext(PlatformContext); + const { is_appstore } = React.useContext(PlatformContext); const message = localize('Your proof of address is verified'); if (needs_poi) { diff --git a/packages/account/src/Components/poi/missing-personal-details/__tests__/missing-personal-details.spec.tsx b/packages/account/src/Components/poi/missing-personal-details/__tests__/missing-personal-details.spec.tsx index e9cd8ba317aa..1a30c4cc71a6 100644 --- a/packages/account/src/Components/poi/missing-personal-details/__tests__/missing-personal-details.spec.tsx +++ b/packages/account/src/Components/poi/missing-personal-details/__tests__/missing-personal-details.spec.tsx @@ -15,7 +15,7 @@ jest.mock('@deriv/components', () => { describe('', () => { const renderWithRouter = component => render( - + {component} ); @@ -62,7 +62,7 @@ describe('', () => { it('should show missing msg with proper icon if has_invalid_postal_code is false and is_appstore is false', () => { render( - + diff --git a/packages/account/src/Components/poi/poi-country-selector/__tests__/poi-country-selector.spec.js b/packages/account/src/Components/poi/poi-country-selector/__tests__/poi-country-selector.spec.tsx similarity index 85% rename from packages/account/src/Components/poi/poi-country-selector/__tests__/poi-country-selector.spec.js rename to packages/account/src/Components/poi/poi-country-selector/__tests__/poi-country-selector.spec.tsx index a5d11cd8ff19..79e8de7583b4 100644 --- a/packages/account/src/Components/poi/poi-country-selector/__tests__/poi-country-selector.spec.js +++ b/packages/account/src/Components/poi/poi-country-selector/__tests__/poi-country-selector.spec.tsx @@ -10,7 +10,13 @@ jest.mock('@deriv/shared', () => ({ })); describe('', () => { - let mock_props = {}; + let mock_props = { + handleSelectionNext: jest.fn(), + is_from_external: false, + residence_list: [{ value: '', text: '' }], + selected_country: '', + setSelectedCountry: jest.fn(), + }; beforeEach(() => { mock_props = { @@ -29,14 +35,13 @@ describe('', () => { it('should render CountrySelector component external', () => { mock_props.is_from_external = true; - const { container } = render(); + render(); expect(screen.getByText('Proof of identity')).toBeInTheDocument(); expect(screen.getByText('In which country was your document issued?')).toBeInTheDocument(); expect(screen.getByText('Country')).toBeInTheDocument(); - const div_with_external_class = container.querySelector('.external-dropdown'); - expect(div_with_external_class).toBeInTheDocument(); + expect(screen.getByTestId('dt_external_dropdown')).toBeInTheDocument(); }); it('should show error message after clicking the input without choosing the country', async () => { @@ -59,8 +64,8 @@ describe('', () => { }); it('should trigger selection functions and next button', async () => { - isDesktop.mockReturnValue(false); - isMobile.mockReturnValue(true); + (isDesktop as jest.Mock).mockReturnValue(false); + (isMobile as jest.Mock).mockReturnValue(true); mock_props.selected_country = 'Country 2'; render(); diff --git a/packages/account/src/Components/poi/poi-country-selector/index.js b/packages/account/src/Components/poi/poi-country-selector/index.js index 343d64b642e8..479c572a67d1 100644 --- a/packages/account/src/Components/poi/poi-country-selector/index.js +++ b/packages/account/src/Components/poi/poi-country-selector/index.js @@ -1,3 +1,3 @@ -import CountrySelector from './poi-country-selector.jsx'; +import CountrySelector from './poi-country-selector'; export default CountrySelector; diff --git a/packages/account/src/Components/poi/poi-country-selector/poi-country-selector.jsx b/packages/account/src/Components/poi/poi-country-selector/poi-country-selector.tsx similarity index 78% rename from packages/account/src/Components/poi/poi-country-selector/poi-country-selector.jsx rename to packages/account/src/Components/poi/poi-country-selector/poi-country-selector.tsx index 0cc26836336b..d28514bb74f3 100644 --- a/packages/account/src/Components/poi/poi-country-selector/poi-country-selector.jsx +++ b/packages/account/src/Components/poi/poi-country-selector/poi-country-selector.tsx @@ -1,47 +1,57 @@ import React from 'react'; import { Autocomplete, Button, DesktopWrapper, MobileWrapper, Text, SelectNative } from '@deriv/components'; -import { Formik, Field } from 'formik'; +import { Formik, Field, FormikErrors, FormikValues, FormikHelpers } from 'formik'; import { localize } from '@deriv/translations'; import classNames from 'classnames'; import FormFooter from 'Components/form-footer'; +type TCountry = Record; + +type TCountrySelector = { + handleSelectionNext: () => void; + is_from_external: boolean; + residence_list: TCountry[]; + selected_country: string; + setSelectedCountry: (value: TCountry) => void; +}; + const CountrySelector = ({ handleSelectionNext, is_from_external, residence_list, selected_country, setSelectedCountry, -}) => { - const [country_list, setCountryList] = React.useState([]); +}: TCountrySelector) => { + const [country_list, setCountryList] = React.useState([]); - const initial_form_values = { + const initial_form_values: FormikValues = { country_input: '', }; - const validateFields = values => { - const errors = {}; + const validateFields = (values: FormikValues) => { + const errors: FormikErrors = {}; const { country_input } = values; if (!country_input) { errors.country_input = localize('Please select the country of document issuance.'); - } else if (!country_list.find(c => c.text === country_input)) { + } else if (!country_list.find((c: FormikValues) => c.text === country_input)) { errors.country_input = localize('Please select a valid country of document issuance.'); } return errors; }; - const updateSelectedCountry = country_name => { - const matching_country = country_list.find(c => c.text === country_name); + const updateSelectedCountry = (country_name: string) => { + const matching_country: TCountry | undefined = country_list.find((c: FormikValues) => c.text === country_name); if (matching_country) { - setSelectedCountry(matching_country); + setSelectedCountry?.(matching_country); } }; - const submitHandler = (values, { setSubmitting }) => { + const submitHandler = (values: FormikValues, { setSubmitting }: FormikHelpers) => { updateSelectedCountry(values.country_input); setSubmitting(false); - handleSelectionNext(); + handleSelectionNext?.(); }; React.useEffect(() => { @@ -76,12 +86,13 @@ const CountrySelector = ({
- {({ field }) => ( + {({ field }: FormikValues) => ( { + onBlur={(e: FormikValues) => { handleBlur(e); const current_input = e.target.value; - if (!country_list.find(c => c.text === current_input)) { + if ( + !country_list.find( + (c: FormikValues) => c.text === current_input + ) + ) { setFieldValue('country_input', '', true); updateSelectedCountry(''); } }} onChange={handleChange} - onItemSelection={({ text }) => { + onItemSelection={({ text }: FormikValues) => { const select_value = text === 'No results found' || !text ? '' : text; setFieldValue('country_input', select_value, true); @@ -118,7 +133,7 @@ const CountrySelector = ({ placeholder={localize('Please select')} list_items={country_list} value={values.country_input} - onChange={e => { + onChange={(e: React.ChangeEvent) => { handleChange(e); updateSelectedCountry(e.target.value); }} @@ -138,7 +153,7 @@ const CountrySelector = ({