diff --git a/package-lock.json b/package-lock.json index fee76b6..79df32f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,8 +28,10 @@ "@types/react-dom": "^18.0.6", "dayjs": "^1.11.5", "moment": "^2.29.4", + "numeral": "^2.0.6", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-numeral": "^1.1.1", "react-router-dom": "^6.3.0", "react-scripts": "^5.0.1", "styled-components": "^5.3.5", @@ -6895,6 +6897,15 @@ "node": ">= 10" } }, + "node_modules/create-react-class": { + "version": "15.7.0", + "resolved": "https://registry.npmjs.org/create-react-class/-/create-react-class-15.7.0.tgz", + "integrity": "sha512-QZv4sFWG9S5RUvkTYWbflxeZX+JG7Cz0Tn33rQBJ+WFQTqTfUTjMjiv9tnfXazjsO5r0KhPs+AqCjyrQX6h2ng==", + "dependencies": { + "loose-envify": "^1.3.1", + "object-assign": "^4.1.1" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -7778,6 +7789,14 @@ "node": ">= 0.8" } }, + "node_modules/encoding": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", + "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", + "dependencies": { + "iconv-lite": "^0.6.2" + } + }, "node_modules/end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -8906,6 +8925,34 @@ "bser": "2.1.1" } }, + "node_modules/fbjs": { + "version": "0.8.18", + "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.18.tgz", + "integrity": "sha512-EQaWFK+fEPSoibjNy8IxUtaFOMXcWsY0JaVrQoZR9zC8N2Ygf9iDITPWjUTVIax95b6I742JFLqASHfsag/vKA==", + "dependencies": { + "core-js": "^1.0.0", + "isomorphic-fetch": "^2.1.1", + "loose-envify": "^1.0.0", + "object-assign": "^4.1.0", + "promise": "^7.1.1", + "setimmediate": "^1.0.5", + "ua-parser-js": "^0.7.30" + } + }, + "node_modules/fbjs/node_modules/core-js": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", + "integrity": "sha512-ZiPp9pZlgxpWRu0M+YWbm6+aQ84XEfH1JRXvfOc/fILWI0VKhLC2LX13X1NYq4fULzLMq7Hfh43CSo2/aIaUPA==", + "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js." + }, + "node_modules/fbjs/node_modules/promise": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", + "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", + "dependencies": { + "asap": "~2.0.3" + } + }, "node_modules/file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -10384,6 +10431,15 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, + "node_modules/isomorphic-fetch": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", + "integrity": "sha512-9c4TNAKYXM5PRyVcwUZrF3W09nQ+sO7+jydgs4ZGW9dhsLG2VOlISJABombdQqQRXCwuYG3sYV/puGf5rp0qmA==", + "dependencies": { + "node-fetch": "^1.0.1", + "whatwg-fetch": ">=0.10.0" + } + }, "node_modules/istanbul-lib-coverage": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", @@ -13283,6 +13339,23 @@ "tslib": "^2.0.3" } }, + "node_modules/node-fetch": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", + "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", + "dependencies": { + "encoding": "^0.1.11", + "is-stream": "^1.0.1" + } + }, + "node_modules/node-fetch/node_modules/is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/node-forge": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", @@ -13350,6 +13423,14 @@ "url": "https://github.com/fb55/nth-check?sponsor=1" } }, + "node_modules/numeral": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/numeral/-/numeral-2.0.6.tgz", + "integrity": "sha512-qaKRmtYPZ5qdw4jWJD6bxEf1FJEqllJrwxCLIm0sQU/A7v2/czigzOb+C2uSiFsa9lBUzeH7M1oK+Q+OLxL3kA==", + "engines": { + "node": "*" + } + }, "node_modules/nwsapi": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.1.tgz", @@ -13668,6 +13749,15 @@ "tslib": "^2.0.3" } }, + "node_modules/path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==", + "dependencies": { + "process": "^0.11.1", + "util": "^0.10.3" + } + }, "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -15095,6 +15185,14 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -15449,6 +15547,37 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" }, + "node_modules/react-numeral": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/react-numeral/-/react-numeral-1.1.1.tgz", + "integrity": "sha512-0s8F+kBaRiMOVgEtz45xvYgHtk2ff4FgJ4BNuXZUXRsfPGNNfrq+8zx/2NEc6jQHh2nXiz8ojng17/jNO3S38g==", + "dependencies": { + "@babel/core": "^7.14.3", + "@babel/preset-react": "^7.13.13", + "@rollup/plugin-babel": "^5.3.0", + "numeral": "^2.0.6", + "path": "^0.12.7", + "react": "^15.3.2", + "rimraf": "^3.0.2", + "rollup": "^2.50.5", + "rollup-plugin-babel": "^4.4.0" + } + }, + "node_modules/react-numeral/node_modules/react": { + "version": "15.7.0", + "resolved": "https://registry.npmjs.org/react/-/react-15.7.0.tgz", + "integrity": "sha512-5/MMRYmpmM0sMTHGLossnJCrmXQIiJilD6y3YN3TzAwGFj6zdnMtFv6xmi65PHKRV+pehIHpT7oy67Sr6s9AHA==", + "dependencies": { + "create-react-class": "^15.6.0", + "fbjs": "^0.8.9", + "loose-envify": "^1.1.0", + "object-assign": "^4.1.0", + "prop-types": "^15.5.10" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/react-refresh": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz", @@ -15963,6 +16092,20 @@ "fsevents": "~2.3.2" } }, + "node_modules/rollup-plugin-babel": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-babel/-/rollup-plugin-babel-4.4.0.tgz", + "integrity": "sha512-Lek/TYp1+7g7I+uMfJnnSJ7YWoD58ajo6Oarhlex7lvUce+RCKRuGRSgztDO3/MF/PuGKmUL5iTHKf208UNszw==", + "deprecated": "This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.", + "dependencies": { + "@babel/helper-module-imports": "^7.0.0", + "rollup-pluginutils": "^2.8.1" + }, + "peerDependencies": { + "@babel/core": "7 || ^7.0.0-rc.2", + "rollup": ">=0.60.0 <3" + } + }, "node_modules/rollup-plugin-terser": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz", @@ -16017,6 +16160,19 @@ "node": ">=8" } }, + "node_modules/rollup-pluginutils": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", + "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", + "dependencies": { + "estree-walker": "^0.6.1" + } + }, + "node_modules/rollup-pluginutils/node_modules/estree-walker": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", + "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==" + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -17310,6 +17466,24 @@ "node": ">=4.2.0" } }, + "node_modules/ua-parser-js": { + "version": "0.7.32", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.32.tgz", + "integrity": "sha512-f9BESNVhzlhEFf2CHMSj40NWOjYPl1YKYbrvIr/hFTDEmLq7SRbWvm7FcdcpCYT95zrOhC7gZSxjdnnTpBcwVw==", + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/ua-parser-js" + }, + { + "type": "paypal", + "url": "https://paypal.me/faisalman" + } + ], + "engines": { + "node": "*" + } + }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", @@ -17495,6 +17669,14 @@ "react": "^16.8.0 || ^17.0.0 || ^18.0.0" } }, + "node_modules/util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dependencies": { + "inherits": "2.0.3" + } + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -17514,6 +17696,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/util/node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==" + }, "node_modules/utila": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/utila/-/utila-0.4.0.tgz", @@ -23272,6 +23459,15 @@ "readable-stream": "^3.4.0" } }, + "create-react-class": { + "version": "15.7.0", + "resolved": "https://registry.npmjs.org/create-react-class/-/create-react-class-15.7.0.tgz", + "integrity": "sha512-QZv4sFWG9S5RUvkTYWbflxeZX+JG7Cz0Tn33rQBJ+WFQTqTfUTjMjiv9tnfXazjsO5r0KhPs+AqCjyrQX6h2ng==", + "requires": { + "loose-envify": "^1.3.1", + "object-assign": "^4.1.1" + } + }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -23911,6 +24107,14 @@ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==" }, + "encoding": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", + "integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==", + "requires": { + "iconv-lite": "^0.6.2" + } + }, "end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -24747,6 +24951,35 @@ "bser": "2.1.1" } }, + "fbjs": { + "version": "0.8.18", + "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.18.tgz", + "integrity": "sha512-EQaWFK+fEPSoibjNy8IxUtaFOMXcWsY0JaVrQoZR9zC8N2Ygf9iDITPWjUTVIax95b6I742JFLqASHfsag/vKA==", + "requires": { + "core-js": "^1.0.0", + "isomorphic-fetch": "^2.1.1", + "loose-envify": "^1.0.0", + "object-assign": "^4.1.0", + "promise": "^7.1.1", + "setimmediate": "^1.0.5", + "ua-parser-js": "^0.7.30" + }, + "dependencies": { + "core-js": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", + "integrity": "sha512-ZiPp9pZlgxpWRu0M+YWbm6+aQ84XEfH1JRXvfOc/fILWI0VKhLC2LX13X1NYq4fULzLMq7Hfh43CSo2/aIaUPA==" + }, + "promise": { + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", + "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", + "requires": { + "asap": "~2.0.3" + } + } + } + }, "file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -25779,6 +26012,15 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, + "isomorphic-fetch": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", + "integrity": "sha512-9c4TNAKYXM5PRyVcwUZrF3W09nQ+sO7+jydgs4ZGW9dhsLG2VOlISJABombdQqQRXCwuYG3sYV/puGf5rp0qmA==", + "requires": { + "node-fetch": "^1.0.1", + "whatwg-fetch": ">=0.10.0" + } + }, "istanbul-lib-coverage": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", @@ -27967,6 +28209,22 @@ "tslib": "^2.0.3" } }, + "node-fetch": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", + "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", + "requires": { + "encoding": "^0.1.11", + "is-stream": "^1.0.1" + }, + "dependencies": { + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha512-uQPm8kcs47jx38atAcWTVxyltQYoPT68y9aWYdV6yWXSyW8mzSat0TL6CiWdZeCdF3KrAvpVtnHbTv4RN+rqdQ==" + } + } + }, "node-forge": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.3.1.tgz", @@ -28013,6 +28271,11 @@ "boolbase": "^1.0.0" } }, + "numeral": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/numeral/-/numeral-2.0.6.tgz", + "integrity": "sha512-qaKRmtYPZ5qdw4jWJD6bxEf1FJEqllJrwxCLIm0sQU/A7v2/czigzOb+C2uSiFsa9lBUzeH7M1oK+Q+OLxL3kA==" + }, "nwsapi": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.1.tgz", @@ -28238,6 +28501,15 @@ "tslib": "^2.0.3" } }, + "path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==", + "requires": { + "process": "^0.11.1", + "util": "^0.10.3" + } + }, "path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", @@ -29079,6 +29351,11 @@ } } }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==" + }, "process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -29345,6 +29622,36 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" }, + "react-numeral": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/react-numeral/-/react-numeral-1.1.1.tgz", + "integrity": "sha512-0s8F+kBaRiMOVgEtz45xvYgHtk2ff4FgJ4BNuXZUXRsfPGNNfrq+8zx/2NEc6jQHh2nXiz8ojng17/jNO3S38g==", + "requires": { + "@babel/core": "^7.14.3", + "@babel/preset-react": "^7.13.13", + "@rollup/plugin-babel": "^5.3.0", + "numeral": "^2.0.6", + "path": "^0.12.7", + "react": "^15.3.2", + "rimraf": "^3.0.2", + "rollup": "^2.50.5", + "rollup-plugin-babel": "^4.4.0" + }, + "dependencies": { + "react": { + "version": "15.7.0", + "resolved": "https://registry.npmjs.org/react/-/react-15.7.0.tgz", + "integrity": "sha512-5/MMRYmpmM0sMTHGLossnJCrmXQIiJilD6y3YN3TzAwGFj6zdnMtFv6xmi65PHKRV+pehIHpT7oy67Sr6s9AHA==", + "requires": { + "create-react-class": "^15.6.0", + "fbjs": "^0.8.9", + "loose-envify": "^1.1.0", + "object-assign": "^4.1.0", + "prop-types": "^15.5.10" + } + } + } + }, "react-refresh": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.11.0.tgz", @@ -29723,6 +30030,15 @@ "fsevents": "~2.3.2" } }, + "rollup-plugin-babel": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-babel/-/rollup-plugin-babel-4.4.0.tgz", + "integrity": "sha512-Lek/TYp1+7g7I+uMfJnnSJ7YWoD58ajo6Oarhlex7lvUce+RCKRuGRSgztDO3/MF/PuGKmUL5iTHKf208UNszw==", + "requires": { + "@babel/helper-module-imports": "^7.0.0", + "rollup-pluginutils": "^2.8.1" + } + }, "rollup-plugin-terser": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz", @@ -29767,6 +30083,21 @@ } } }, + "rollup-pluginutils": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", + "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", + "requires": { + "estree-walker": "^0.6.1" + }, + "dependencies": { + "estree-walker": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", + "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==" + } + } + }, "run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -30734,6 +31065,11 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.2.tgz", "integrity": "sha512-C0I1UsrrDHo2fYI5oaCGbSejwX4ch+9Y5jTQELvovfmFkK3HHSZJB8MSJcWLmCUBzQBchCrZ9rMRV6GuNrvGtw==" }, + "ua-parser-js": { + "version": "0.7.32", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.32.tgz", + "integrity": "sha512-f9BESNVhzlhEFf2CHMSj40NWOjYPl1YKYbrvIr/hFTDEmLq7SRbWvm7FcdcpCYT95zrOhC7gZSxjdnnTpBcwVw==" + }, "unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", @@ -30875,6 +31211,21 @@ "integrity": "sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==", "requires": {} }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "requires": { + "inherits": "2.0.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==" + } + } + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index c1c3b25..814a70d 100644 --- a/package.json +++ b/package.json @@ -23,8 +23,10 @@ "@types/react-dom": "^18.0.6", "dayjs": "^1.11.5", "moment": "^2.29.4", + "numeral": "^2.0.6", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-numeral": "^1.1.1", "react-router-dom": "^6.3.0", "react-scripts": "^5.0.1", "styled-components": "^5.3.5", diff --git a/src/Components/LoggedIn/Content/Discounts/index.tsx b/src/Components/LoggedIn/Content/Discounts/index.tsx index 50b44ac..1f1553e 100644 --- a/src/Components/LoggedIn/Content/Discounts/index.tsx +++ b/src/Components/LoggedIn/Content/Discounts/index.tsx @@ -92,7 +92,7 @@ const rows:Array = [ good: "Товар 2", discount: 0.2 } - ], active: false, basketMore: 10, toTime: 20, toCapacity: 30 }, + ], active: false,incomeMore:1, basketMore: 10, toTime: 20, toCapacity: 30 }, { id: 2, name: "Скидка 2", endless: false, from: "", dueTo: "", privileges: [ { good: "Товар 3", @@ -102,7 +102,7 @@ const rows:Array = [ good: "Товар 4", discount: 0.2 } - ], active: true, basketMore: 10, toTime: 20, toCapacity: 30 }, + ], active: true,incomeMore:1, basketMore: 10, toTime: 20, toCapacity: 30 }, { id: 3, name: "Скидка 3", endless: false, from: "", dueTo: "", privileges: [ { good: "Товар 5", @@ -112,7 +112,7 @@ const rows:Array = [ good: "Товар 6", discount: 0.2 } - ], active: false, basketMore: 10, toTime: 20, toCapacity: 30 }, + ], active: false, incomeMore: 1, basketMore: 10, toTime: 20, toCapacity: 30 }, ]; const Discounts: React.FC = () => { @@ -193,6 +193,7 @@ const Discounts: React.FC = () => { id: new Date().getTime(), name, endless: checkboxState, + incomeMore: addedMore, from: checkboxState ? "" : new Date( value1 ).getTime() +"", dueTo: checkboxState ? "" : new Date( value2 ).getTime() +"", privileges: [{ @@ -690,4 +691,4 @@ const Discounts: React.FC = () => { } -export default Discounts; \ No newline at end of file +export default Discounts; diff --git a/src/Components/LoggedIn/Content/Discounts/types.ts b/src/Components/LoggedIn/Content/Discounts/types.ts index 2509b3a..124d07a 100644 --- a/src/Components/LoggedIn/Content/Discounts/types.ts +++ b/src/Components/LoggedIn/Content/Discounts/types.ts @@ -12,6 +12,7 @@ export interface DiscountProps { privileges: Array active: boolean basketMore: number + incomeMore: number toTime: number toCapacity: number -} \ No newline at end of file +} diff --git a/src/Components/LoggedIn/Content/Promocode/index.tsx b/src/Components/LoggedIn/Content/Promocode/index.tsx index af5a23b..e5fd4ba 100644 --- a/src/Components/LoggedIn/Content/Promocode/index.tsx +++ b/src/Components/LoggedIn/Content/Promocode/index.tsx @@ -243,7 +243,7 @@ const Promocode: React.FC = () => { } }} > - Шаблонизатор + Шаблонизатор Опросник Аналитика сокращателя АБ тесты @@ -448,4 +448,4 @@ const Promocode: React.FC = () => { } -export default Promocode; \ No newline at end of file +export default Promocode; diff --git a/src/Components/LoggedIn/Content/Tariffs/DataGridElement/index.tsx b/src/Components/LoggedIn/Content/Tariffs/DataGridElement/index.tsx index d0dd701..2949ea5 100644 --- a/src/Components/LoggedIn/Content/Tariffs/DataGridElement/index.tsx +++ b/src/Components/LoggedIn/Content/Tariffs/DataGridElement/index.tsx @@ -3,7 +3,7 @@ import { Box, Button, Typography, TextField } from "@mui/material"; import { DataGrid, GridColDef, GridSelectionModel, GridToolbar } from "@mui/x-data-grid"; import { useDemoData } from "@mui/x-data-grid-generator"; import useStore, { StoreState } from "../../../../../store"; -import { ArrayProps } from "../types"; +import { ArrayProps, CartSummary } from "../types"; import List from "@mui/material/List"; import ListItem from "@mui/material/ListItem"; import ListItemAvatar from "@mui/material/ListItemAvatar"; @@ -18,7 +18,6 @@ import { PrivilegesProps, PromocodeProps } from "../../Promocode/types"; import { DiscountProps } from "../../Discounts/types"; import theme from "../../../../../theme"; - export interface MWProps { openModal: () => void } @@ -119,13 +118,7 @@ const DataGridElement: React.FC = ({ openModal }) => { const { discountsArray, discountsArraySet } = useStore((state) => state); const { discountsActiveArray, discountsActiveArraySet } = useStore((state) => state); - const [checkboxStates, setCheckboxStates] = React.useState(1); - - const checkboxToggle = () => { - checkboxStates == 1 - ? setCheckboxStates( 0.2 ) - : setCheckboxStates( 1 ) - } + const [nonCommercial, setNonCommercial] = React.useState(false); const { data } = useDemoData({ dataSet: "Commodity", @@ -138,9 +131,9 @@ const DataGridElement: React.FC = ({ openModal }) => { if( item.type === "package" && item.tariffs ) { const result = item.tariffs.reduce( (acc, tariff) => { acc.service = acc.service? `${acc.service}, ${tariff.service}` : tariff.service; - acc.disk = acc.disk? `${acc.disk}, ${tariff.disk}` : tariff.disk; - acc.time = acc.time? `${acc.time}, ${tariff.time}` : tariff.time; - acc.points = acc.points? `${acc.points}, ${tariff.points}` : tariff.points; + acc.disk = acc.disk+ tariff.disk; + acc.time = acc.time+ tariff.time; + acc.points = acc.points + tariff.points; acc.price = acc.price + tariff.price; return acc; @@ -205,28 +198,9 @@ const DataGridElement: React.FC = ({ openModal }) => { } }; - const discountTime = ( days:string ) => { - if( parseInt(days) > 30 ) { return 0.01; } - if( parseInt(days) > 60 ) { return 0.03; } - if( parseInt(days) > 90 ) { return 0.05; } - return 0; - } - - const discountCapacity = ( generations:string ) => { - if( parseInt(generations) > 100 ) { return 0.01; } - if( parseInt(generations) > 300 ) { return 0.03; } - if( parseInt(generations) > 600 ) { return 0.06; } - return 0; - } - - const discountProduct = ( days:string, generations:string ) => { - if( parseInt(days) > 30 && parseInt(generations) > 100 ) { return 0.02; } - if( parseInt(days) > 60 && parseInt(generations) > 300 ) { return 0.03; } - if( parseInt(days) > 90 && parseInt(generations) > 600 ) { return 0.04; } - return 0; - } - const separator = (amount: number) => { +console.log(amount) + if( String(amount).length < 4 ) { return amount; } let result:Array = []; @@ -243,45 +217,85 @@ const DataGridElement: React.FC = ({ openModal }) => { } + + const cartSummary = new Map() + cartRowsData.forEach((row) => { + const svcName = row.service.split(" ")[0] + const prev = cartSummary.get(svcName) + console.log(row) + console.log(prev) + if (!prev) { + cartSummary.set(svcName, { + mbs: row.disk, + points: row.points, + days: row.time, + }) + } else { + cartSummary.set(svcName, { + mbs: row.disk+prev.mbs, + points: row.points+prev.points, + days: row.time+prev.days, + }) + } + }) + console.log(cartSummary) + + const fitDiscounts = discountsActiveArray.filter(e => { + const d = discountsArray[e] + const summary = cartSummary.get(d.privileges[0].good.split(' ')[0]) + return d.incomeMore*100 < parseInt(fieldAddedValue) && d.incomeMore > 0 || + d.toTime < (summary ? summary.days : 0) && d.toTime > 0 && d.toCapacity === 0 || + d.toCapacity > 0 && d.toCapacity < (summary ? summary.points : 0) && d.toTime === 0 || + d.toCapacity > 0 && d.toTime > 0 && d.toCapacity < (summary ? summary.points : 0) && d.toTime < (summary ? summary.days : 0) || + !d.toCapacity && !d.toTime && !d.incomeMore && !d.basketMore || + d.basketMore + }).filter((e,i,a)=>{ + const d = discountsArray[e] + if (d.incomeMore) { + return d.incomeMore === a.reduce((a, e) => Math.max(a, discountsArray[e].incomeMore || 0), 0 ) + } + if (d.toTime && d.toCapacity) { + return d.toTime === a.reduce((a, e) => Math.max(a, (discountsArray[e].toTime && discountsArray[e].toCapacity) ? discountsArray[e].toTime:0 ), 0 ) && d.toCapacity === a.reduce((a, e) => Math.max(a, (discountsArray[e].toCapacity && discountsArray[e].toTime) ? discountsArray[e].toCapacity : 0 ), 0 ) + } + if (d.toTime && !d.toCapacity) { + return d.toTime === a.reduce((a, e) => Math.max(a, discountsArray[e].toTime && !discountsArray[e].toCapacity ? discountsArray[e].toTime : 0), 0 ) + } + if (!d.toTime && d.toCapacity) { + return d.toCapacity === a.reduce((a, e) => Math.max(a, discountsArray[e].toCapacity && !discountsArray[e].toTime ? discountsArray[e].toCapacity : 0), 0 ) + } + return true + }) + console.log(fitDiscounts) + const discountsAfter = ( getPrice:number ) => { - discountsSum = ""; + const discounts:Array = []; priceBefore = getPrice; - // применяем активные скидки за объем корзины - let more = 0; - let moreI = -1; + prices = getPrice; + console.log(getPrice) - if( discountsActiveArray.length >= 0 && checkboxStates == 1 && selectedPromocode < 0 ) { - discountsActiveArray.forEach( (activeDiscount) => { - discountsArray.forEach( (discount, i) => { - if( i == activeDiscount && discount.basketMore ) { - if( more <= discount.basketMore ) { - more = discount.basketMore; - moreI = i; - } - } - }); + // применяем активные скидки за объем корзины + + if( fitDiscounts.length >= 0 && !nonCommercial && selectedPromocode < 0 ) { + fitDiscounts.forEach( (activeDiscount) => { + const d = discountsArray[activeDiscount] + console.log(d) + console.log(fieldAddedValue) + if (d.basketMore > 0 && getPrice > d.basketMore && d.basketMore === fitDiscounts.reduce((a,e) => Math.max(a, discountsArray[e].basketMore), 0) || + d.incomeMore > 0 && parseInt(fieldAddedValue) > d.incomeMore) { + prices *= (1-d.privileges[0].discount) + discounts.push(d.privileges[0].discount) + } }); } - if( moreI >= 0 ) { - getPrice = getPrice - getPrice * discountsArray[ moreI ].basketMore; - - if( discountsSum ) { discountsSum += " × "; } - discountsSum += `${ Math.round(discountsArray[ moreI ].basketMore * 100) }%`; + if( nonCommercial ) { + prices *= 0.2 + return `80%`; } - if( checkboxStates != 1 ) { - getPrice = getPrice - getPrice * checkboxStates; - discountsSum += `${ Math.round(checkboxStates * 100) }%`; - } - - prices = getPrice; - if(discountsSum) discountsSum += " = " + Math.round(prices / priceBefore * 100) +"%"; - - return discountsSum; + return discounts.map(e => `${(e*100).toFixed(2)}%`).join(' × ') + ` = ${(100 - discounts.reduce((a : number,cv : number) => a*(1-cv), 100)) .toFixed(2)}%`; } - return ( @@ -475,7 +489,7 @@ const DataGridElement: React.FC = ({ openModal }) => { "&.Mui-checked": { color: theme.palette.secondary.main, }, - }} onClick={ () => checkboxToggle() } /> + }} onClick={ () => setNonCommercial(!nonCommercial) } /> } label="НКО" /> = ({ openModal }) => { - { cartRowsData.map( (item) => { + { cartRowsData.map( (item) => { + price = item.price + const appliedDscnts: number[] = []; + if (!nonCommercial) { + if( item.type == "package" ) { // считаем цену в ПАКЕТАХ price = 0; @@ -548,7 +566,7 @@ const DataGridElement: React.FC = ({ openModal }) => { percents = 0; // применяем скидки по промокоду - if( selectedPromocode >= 0 && checkboxStates == 1 ) { + if( selectedPromocode >= 0 ) { promocodeArray[ selectedPromocode ].privileges.forEach( (privilege) => { if( tariff.service == privilege.good ) { percents = percents + privilege.discount; @@ -560,7 +578,7 @@ const DataGridElement: React.FC = ({ openModal }) => { } // применяем активные скидки - if( discountsActiveArray.length >= 0 && checkboxStates == 1 && selectedPromocode < 0 ) { + if( discountsActiveArray.length >= 0 && selectedPromocode < 0 ) { discountsActiveArray.forEach( (activeDiscount) => { discountsArray.forEach( (discount, i) => { if( i == activeDiscount ) { @@ -596,7 +614,7 @@ const DataGridElement: React.FC = ({ openModal }) => { percents = percents + privilege.discount; if( discounts ) { discounts += " × "; } - discounts += `${ Math.round(privilege.discount * 100) }%`; + discounts += `${ Math.round(privilege.discount * 100) }% `; } } @@ -607,25 +625,25 @@ const DataGridElement: React.FC = ({ openModal }) => { }); } - // применяем активные скидки по времени / объему - if( discountsActiveArray.length >= 0 && checkboxStates == 1 && selectedPromocode < 0 ) { + // применяем активные скидки по времени объему + if( discountsActiveArray.length >= 0 && selectedPromocode < 0 ) { discountsActiveArray.forEach( (activeDiscount) => { discountsArray.forEach( (discount, i) => { if( i == activeDiscount ) { if( tariff.time ) { - const dTime = discountTime( tariff.time ); + const dTime = 0.1; percents = percents + dTime; if( discounts ) discounts += " × "; - if( dTime != 0 ) discounts += `${ Math.round(dTime * 100) }%`; + //if( dTime != 0.0 ) discounts += `${ Math.round(dTime * 100) }%`; } if( tariff.points ) { - const cTime = discountCapacity( tariff.points ); - percents = percents + cTime; + //const cTime = discountCapacity( tariff.points ); + //percents = percents + cTime; - if( discounts ) discounts += " × "; - if( cTime != 0 ) discounts += `${ Math.round(cTime * 100) }%`; + //if( discounts ) discounts += " × "; + //if( cTime != 0 ) discounts += `${ Math.round(cTime * 100) }%`; } } }); @@ -633,16 +651,16 @@ const DataGridElement: React.FC = ({ openModal }) => { } // применяем активные скидки на продукт - if( discountsActiveArray.length >= 0 && checkboxStates == 1 && selectedPromocode < 0 ) { + if( discountsActiveArray.length >= 0 && selectedPromocode < 0 ) { discountsActiveArray.forEach( (activeDiscount) => { discountsArray.forEach( (discount, i) => { if( i == activeDiscount ) { if( tariff.time && tariff.points ) { - const dProduct = discountProduct( tariff.time, tariff.points ); - percents = percents + dProduct; + //const dProduct = discountProduct( tariff.time, tariff.points ); + //percents = percents + dProduct; - if( discounts ) discounts += " × "; - if( dProduct != 0 ) discounts += `${ Math.round(dProduct * 100) }%`; + //if( discounts ) discounts += " × "; + //if( dProduct != 0 ) discounts += `${ Math.round(dProduct * 100) }%`; } } }); @@ -664,118 +682,48 @@ const DataGridElement: React.FC = ({ openModal }) => { discounts = ""; // применяем скидки по промокоду - if( selectedPromocode >= 0 && checkboxStates == 1 ) { + if( selectedPromocode >= 0 ) { promocodeArray[ selectedPromocode ].privileges.forEach( (privilege) => { + console.log(item.service) + console.log(privilege.good) if( item.service == privilege.good ) { - percents = percents + privilege.discount - - if( discounts ) { discounts += " × "; } - discounts += `${ Math.round(privilege.discount * 100) }%`; - } + appliedDscnts.push(privilege.discount) + price *= (1 - privilege.discount) + } } ) - } + } else { + // применяем активные скидки + if( fitDiscounts.length >= 0 ) { + fitDiscounts.forEach( (activeDiscount) => { + const discount = discountsArray[activeDiscount] + discount.privileges.forEach((p) => { + const svcName = item.service.split(' ')[0] + if (p.good == svcName) { + const summary = cartSummary.get(svcName) || {mbs:0,points:0,days:0} + if (discount.toCapacity === 0 && discount.toTime === 0 && discount.basketMore === 0 && !(discount.incomeMore) || + discount.toCapacity > 0 && summary.points > discount.toCapacity && item.points > 0 && discount.toTime == 0 + || discount.toTime >0 && summary.days > discount.toTime*100 && item.time > 0 && discount.toCapacity == 0 || + discount.toTime > 0 && discount.toCapacity > 0 && summary.days > discount.toTime*100 && summary.points > discount.toCapacity ){ + + price *= (1-p.discount) + appliedDscnts.push(p.discount) + } - // применяем активные скидки - if( discountsActiveArray.length >= 0 && checkboxStates == 1 && selectedPromocode < 0 ) { - discountsActiveArray.forEach( (activeDiscount) => { - discountsArray.forEach( (discount, i) => { - if( i == activeDiscount ) { - discount.privileges.forEach( (privilege) => { - if( privilege.discount != 0 ) { - - if( fieldAddedValue ) { // внесено - const f = Number(fieldAddedValue); - let minDiscount = 100; - let minI = -1; - - discountsArray.forEach( (x, ii) => { - x.privileges.forEach( (y) => { - if( x.active && f - y.discount * 100 < minDiscount - && f - y.discount * 100 > 0 ) { - minDiscount = f - Math.round(y.discount * 100); - minI = ii; - } - }); - }); - - if( minI >= 0 ) { - discountsArray[ minI ].privileges.forEach( (y) => { - percents = percents + y.discount / discountsActiveArray.length; // костыль - - if( discounts ) { discounts += " × "; } - discounts += `${ Math.round(y.discount / discountsActiveArray.length * 100) }%`; - }); - } - - } else { // не внесено - if( item.service == privilege.good ) { - percents = percents + privilege.discount; - - if( discounts ) { discounts += " × "; } - discounts += `${ Math.round(privilege.discount * 100) }%`; - } - } - - } - }); - } - }); - }); - } - - // применяем активные скидки по времени / объему - if( discountsActiveArray.length >= 0 && checkboxStates == 1 && selectedPromocode < 0 ) { - discountsActiveArray.forEach( (activeDiscount) => { - discountsArray.forEach( (discount, i) => { - if( i == activeDiscount ) { - if( item.time ) { - const dTime = discountTime( item.time ); - percents = percents + dTime; - - if( discounts ) discounts += " × "; - if( dTime != 0 ) discounts += `${ Math.round(dTime * 100) }%`; } - - if( item.points ) { - const cTime = discountCapacity( item.points ); - percents = percents + cTime; - - if( discounts ) discounts += " × "; - if( cTime != 0 ) discounts += `${ Math.round(cTime * 100) }%`; - } - } + }) }); - }); - } + } - // применяем активные скидки на продукт - if( discountsActiveArray.length >= 0 && checkboxStates == 1 && selectedPromocode < 0 ) { - discountsActiveArray.forEach( (activeDiscount) => { - discountsArray.forEach( (discount, i) => { - if( i == activeDiscount ) { - if( item.time && item.points ) { - const dProduct = discountProduct( item.time, item.points ); - percents = percents + dProduct; - - if( discounts ) discounts += " × "; - if( dProduct != 0 ) discounts += `${ Math.round(dProduct * 100) }%`; - } - } - }); - }); } - percents = Number( percents.toFixed(2) ); priceBefore = price; price = price - (price * percents); } - +} prices += price; - if(discounts) discounts += " = " + Math.round(price / priceBefore * 100) +"%"; - return( @@ -794,7 +742,7 @@ const DataGridElement: React.FC = ({ openModal }) => { sx={{ textAlign: "center", minWidth: "200px", maxWidth: "200px" }} /> (e*100).toFixed(2)).join(' × '))} = ${(100 - appliedDscnts.reduce((a : number,cv : number) => a*(1-cv), 100)).toFixed(2)}%` } sx={{ textAlign: "center", minWidth: "400px", maxWidth: "400px" }} /> handleRemoveBasket( item.id ) }> @@ -831,4 +779,4 @@ const DataGridElement: React.FC = ({ openModal }) => { ); } -export default DataGridElement; \ No newline at end of file +export default DataGridElement; diff --git a/src/Components/LoggedIn/Content/Tariffs/ModalMini/index.tsx b/src/Components/LoggedIn/Content/Tariffs/ModalMini/index.tsx index 3e22227..2e74a13 100644 --- a/src/Components/LoggedIn/Content/Tariffs/ModalMini/index.tsx +++ b/src/Components/LoggedIn/Content/Tariffs/ModalMini/index.tsx @@ -30,11 +30,11 @@ const ModalMini = ({open, type, variant, close}: MWProps ) => { if( getData != null ) { tariffsArray = JSON.parse(getData); } - const data = [ "", "", "" ]; + const data = [ 0, 0, 0 ]; - if( variant == 0 ) { data[ 0 ] = fieldTime.current.value; } - if( variant == 1 ) { data[ 1 ] = fieldTime.current.value; } - if( variant == 2 ) { data[ 2 ] = fieldTime.current.value; } + if( variant == 0 ) { data[ 0 ] = parseInt(fieldTime.current.value); } + if( variant == 1 ) { data[ 1 ] = parseInt(fieldTime.current.value); } + if( variant == 2 ) { data[ 2 ] = parseInt(fieldTime.current.value); } const tariffsArrayNew = [...tariffsArray, { "id": new Date().getTime(), diff --git a/src/Components/LoggedIn/Content/Tariffs/index.tsx b/src/Components/LoggedIn/Content/Tariffs/index.tsx index a620339..00cdc5d 100644 --- a/src/Components/LoggedIn/Content/Tariffs/index.tsx +++ b/src/Components/LoggedIn/Content/Tariffs/index.tsx @@ -62,9 +62,9 @@ const Tariffs: React.FC = () => { type: "package", tariffs: uniqueArray, service: "", - disk: "", - time: "", - points: "", + disk: 0, + time: 0, + points: 0, price: 0 } @@ -94,4 +94,4 @@ const Tariffs: React.FC = () => { } -export default Tariffs; \ No newline at end of file +export default Tariffs; diff --git a/src/Components/LoggedIn/Content/Tariffs/types.ts b/src/Components/LoggedIn/Content/Tariffs/types.ts index ef29792..c842344 100644 --- a/src/Components/LoggedIn/Content/Tariffs/types.ts +++ b/src/Components/LoggedIn/Content/Tariffs/types.ts @@ -3,9 +3,9 @@ export interface Tariff { name: string type: string service: string - disk: string - time: string - points: string + disk: number + time: number + points: number price: number } @@ -14,9 +14,15 @@ export interface ArrayProps { name: string type: string service: string - disk: string - time: string - points: string + disk: number + time: number + points: number price: number tariffs?: Array -} \ No newline at end of file +} + +export interface CartSummary { + mbs: number + points: number + days: number +}