Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

chore(frontend): fixed all eslint errors

akhilmhdhcf7834bfc38d
diff --git a/frontend/.eslintrc b/frontend/.eslintrc
deleted file mode 100644
index d5f35096cf..0000000000
--- a/frontend/.eslintrc
+++ /dev/null
@@ -1,49 +0,0 @@
-{
- "extends": [
- "eslint:recommended",
- "plugin:@typescript-eslint/recommended",
- "next",
- "next/core-web-vitals"
- ],
- "parser": "@typescript-eslint/parser",
- "plugins": ["simple-import-sort", "@typescript-eslint"],
- "rules": {
- "react-hooks/exhaustive-deps": "off",
- "no-unused-vars": "warn",
- "@typescript-eslint/ban-ts-comment": "warn",
- "@typescript-eslint/no-unused-vars": "off",
- "@typescript-eslint/no-var-requires": "off",
- "@typescript-eslint/no-empty-function": "off",
- "@typescript-eslint/no-explicit-any": "off",
- "@typescript-eslint/no-non-null-assertion": "off",
- "simple-import-sort/exports": "warn",
- "simple-import-sort/imports": [
- "warn",
- {
- "groups": [
- // Node.js builtins. You could also generate this regex if you use a `.js` config.
- // For example: `^(${require("module").builtinModules.join("|")})(/|$)`
- // Note that if you use the `node:` prefix for Node.js builtins,
- // you can avoid this complexity: You can simply use "^node:".
- [
- "^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)"
- ],
- // Packages `react` related packages
- ["^react", "^next", "^@?\\w"],
- // Internal packages.
- ["^~(/.*|$)"],
- // Relative imports
- [
- "^\\.\\.(?!/?$)",
- "^\\.\\./?$",
- "^\\./(?=.*/)(?!/?$)",
- "^\\.(?!/?$)",
- "^\\./?$"
- ],
- // Style imports.
- ["^.+\\.?(css|scss)$"]
- ]
- }
- ]
- }
-}
diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js
new file mode 100644
index 0000000000..946575a66a
--- /dev/null
+++ b/frontend/.eslintrc.js
@@ -0,0 +1,72 @@
+module.exports = {
+ root: true,
+ env: {
+ browser: true,
+ es2021: true
+ },
+ extends: ['airbnb', 'airbnb-typescript', 'airbnb/hooks', 'plugin:react/recommended', 'prettier'],
+ parserOptions: {
+ ecmaVersion: 'latest',
+ sourceType: 'module',
+ project: './tsconfig.json',
+ ecmaFeatures: {
+ jsx: true
+ },
+ tsconfigRootDir: __dirname
+ },
+ plugins: ['react', 'prettier', 'simple-import-sort', 'import'],
+ rules: {
+ 'react/react-in-jsx-scope': 'off',
+ 'import/prefer-default-export': 'off',
+ 'react-hooks/exhaustive-deps': 'off',
+ '@typescript-eslint/ban-ts-comment': 'warn',
+ // TODO: This rule will be switched ON after complete revamp of frontend
+ '@typescript-eslint/no-explicit-any': 'off',
+ 'no-console': 'off',
+ 'arrow-body-style': 'off',
+ 'no-underscore-dangle': ['error', { allow: ['_id'] }],
+ 'jsx-a11y/anchor-is-valid': 'off', // all those <a> tags must be converted to label or a p component
+ //
+ 'react/require-default-props': 'off',
+ 'react/jsx-filename-extension': [1, { extensions: ['.tsx', '.ts'] }],
+ // TODO: turn this rule ON after migration. everything should use arrow functions
+ 'react/function-component-definition': [
+ 0,
+ {
+ namedComponents: 'arrow-function'
+ }
+ ],
+ 'react/no-unknown-property': ['error', { ignore: ['jsx'] }],
+ '@typescript-eslint/no-non-null-assertion': 'off',
+ 'simple-import-sort/exports': 'warn',
+ 'simple-import-sort/imports': [
+ 'warn',
+ {
+ groups: [
+ // Node.js builtins. You could also generate this regex if you use a `.js` config.
+ // For example: `^(${require("module").builtinModules.join("|")})(/|$)`
+ // Note that if you use the `node:` prefix for Node.js builtins,
+ // you can avoid this complexity: You can simply use "^node:".
+ [
+ '^(assert|buffer|child_process|cluster|console|constants|crypto|dgram|dns|domain|events|fs|http|https|module|net|os|path|punycode|querystring|readline|repl|stream|string_decoder|sys|timers|tls|tty|url|util|vm|zlib|freelist|v8|process|async_hooks|http2|perf_hooks)(/.*|$)'
+ ],
+ // Packages `react` related packages
+ ['^react', '^next', '^@?\\w'],
+ // Internal packages.
+ ['^~(/.*|$)'],
+ // Relative imports
+ ['^\\.\\.(?!/?$)', '^\\.\\./?$', '^\\./(?=.*/)(?!/?$)', '^\\.(?!/?$)', '^\\./?$'],
+ // Style imports.
+ ['^.+\\.?(css|scss)$']
+ ]
+ }
+ ]
+ },
+ settings: {
+ 'import/resolver': {
+ typescript: {
+ project: ['./tsconfig.json']
+ }
+ }
+ }
+};
diff --git a/frontend/.prettierrc b/frontend/.prettierrc
new file mode 100644
index 0000000000..da5d26a535
--- /dev/null
+++ b/frontend/.prettierrc
@@ -0,0 +1,7 @@
+{
+ "singleQuote": true,
+ "printWidth": 100,
+ "trailingComma": "none",
+ "tabWidth": 2,
+ "semi": true
+}
diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index ad16119732..d50b3bab2c 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -57,14 +57,23 @@
"@types/jsrp": "^0.2.4",
"@types/node": "18.11.9",
"@types/react": "^18.0.26",
- "@typescript-eslint/eslint-plugin": "^5.45.0",
+ "@typescript-eslint/eslint-plugin": "^5.48.1",
"@typescript-eslint/parser": "^5.45.0",
"autoprefixer": "^10.4.7",
- "eslint": "^8.29.0",
+ "eslint": "^8.32.0",
+ "eslint-config-airbnb": "^19.0.4",
+ "eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-next": "^13.0.5",
+ "eslint-config-prettier": "^8.6.0",
"eslint-import-resolver-typescript": "^3.5.2",
+ "eslint-plugin-import": "^2.27.4",
+ "eslint-plugin-jsx-a11y": "^6.7.1",
+ "eslint-plugin-prettier": "^4.2.1",
+ "eslint-plugin-react": "^7.32.0",
+ "eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^8.0.0",
"postcss": "^8.4.14",
+ "prettier": "^2.8.3",
"tailwindcss": "^3.1.4",
"typescript": "^4.9.3"
}
@@ -408,19 +417,6 @@
"node": ">=6.9.0"
}
},
- "node_modules/@babel/runtime-corejs3": {
- "version": "7.20.1",
- "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.20.1.tgz",
- "integrity": "sha512-CGulbEDcg/ND1Im7fUNRZdGXmX2MTWVVZacQi/6DiKE5HNwZ3aVTm5PV4lO8HHz0B2h8WQyvKKjbX5XgTtydsg==",
- "dev": true,
- "dependencies": {
- "core-js-pure": "^3.25.1",
- "regenerator-runtime": "^0.13.10"
- },
- "engines": {
- "node": ">=6.9.0"
- }
- },
"node_modules/@babel/template": {
"version": "7.18.10",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz",
@@ -648,15 +644,15 @@
"integrity": "sha512-AHPmaAx+RYfZz0eYu6Gviiagpmiyw98ySSlQvCUhVGDRtDFe4DBS0x1bSjdF3gqUDYOczB+yYvBTtEylYSdRhg=="
},
"node_modules/@eslint/eslintrc": {
- "version": "1.3.3",
- "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz",
- "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==",
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz",
+ "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==",
"dev": true,
"dependencies": {
"ajv": "^6.12.4",
"debug": "^4.3.2",
"espree": "^9.4.0",
- "globals": "^13.15.0",
+ "globals": "^13.19.0",
"ignore": "^5.2.0",
"import-fresh": "^3.2.1",
"js-yaml": "^4.1.0",
@@ -694,9 +690,9 @@
}
},
"node_modules/@eslint/eslintrc/node_modules/globals": {
- "version": "13.18.0",
- "resolved": "https://registry.npmjs.org/globals/-/globals-13.18.0.tgz",
- "integrity": "sha512-/mR4KI8Ps2spmoc0Ulu9L7agOF0du1CZNQ3dke8yItYlyKNmGrkONemBbd6V8UTc1Wgcqn21t3WYB7dbRmh6/A==",
+ "version": "13.19.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz",
+ "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==",
"dev": true,
"dependencies": {
"type-fest": "^0.20.2"
@@ -808,9 +804,9 @@
}
},
"node_modules/@humanwhocodes/config-array": {
- "version": "0.11.7",
- "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.7.tgz",
- "integrity": "sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==",
+ "version": "0.11.8",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
+ "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==",
"dev": true,
"dependencies": {
"@humanwhocodes/object-schema": "^1.2.1",
@@ -920,6 +916,51 @@
"glob": "7.1.7"
}
},
+ "node_modules/@next/swc-android-arm-eabi": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.3.4.tgz",
+ "integrity": "sha512-cM42Cw6V4Bz/2+j/xIzO8nK/Q3Ly+VSlZJTa1vHzsocJRYz8KT6MrreXaci2++SIZCF1rVRCDgAg5PpqRibdIA==",
+ "cpu": [
+ "arm"
+ ],
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-android-arm64": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.3.4.tgz",
+ "integrity": "sha512-5jf0dTBjL+rabWjGj3eghpLUxCukRhBcEJgwLedewEA/LJk2HyqCvGIwj5rH+iwmq1llCWbOky2dO3pVljrapg==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-darwin-arm64": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.3.4.tgz",
+ "integrity": "sha512-DqsSTd3FRjQUR6ao0E1e2OlOcrF5br+uegcEGPVonKYJpcr0MJrtYmPxd4v5T6UCJZ+XzydF7eQo5wdGvSZAyA==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
"node_modules/@next/swc-darwin-x64": {
"version": "12.3.4",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-12.3.4.tgz",
@@ -935,6 +976,141 @@
"node": ">= 10"
}
},
+ "node_modules/@next/swc-freebsd-x64": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.3.4.tgz",
+ "integrity": "sha512-KM9JXRXi/U2PUM928z7l4tnfQ9u8bTco/jb939pdFUHqc28V43Ohd31MmZD1QzEK4aFlMRaIBQOWQZh4D/E5lQ==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-arm-gnueabihf": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.3.4.tgz",
+ "integrity": "sha512-3zqD3pO+z5CZyxtKDTnOJ2XgFFRUBciOox6EWkoZvJfc9zcidNAQxuwonUeNts6Xbm8Wtm5YGIRC0x+12YH7kw==",
+ "cpu": [
+ "arm"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-arm64-gnu": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.3.4.tgz",
+ "integrity": "sha512-kiX0vgJGMZVv+oo1QuObaYulXNvdH/IINmvdZnVzMO/jic/B8EEIGlZ8Bgvw8LCjH3zNVPO3mGrdMvnEEPEhKA==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-arm64-musl": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.3.4.tgz",
+ "integrity": "sha512-EETZPa1juczrKLWk5okoW2hv7D7WvonU+Cf2CgsSoxgsYbUCZ1voOpL4JZTOb6IbKMDo6ja+SbY0vzXZBUMvkQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-x64-gnu": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.3.4.tgz",
+ "integrity": "sha512-4csPbRbfZbuWOk3ATyWcvVFdD9/Rsdq5YHKvRuEni68OCLkfy4f+4I9OBpyK1SKJ00Cih16NJbHE+k+ljPPpag==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-x64-musl": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.3.4.tgz",
+ "integrity": "sha512-YeBmI+63Ro75SUiL/QXEVXQ19T++58aI/IINOyhpsRL1LKdyfK/35iilraZEFz9bLQrwy1LYAR5lK200A9Gjbg==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-win32-arm64-msvc": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.3.4.tgz",
+ "integrity": "sha512-Sd0qFUJv8Tj0PukAYbCCDbmXcMkbIuhnTeHm9m4ZGjCf6kt7E/RMs55Pd3R5ePjOkN7dJEuxYBehawTR/aPDSQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-win32-ia32-msvc": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.3.4.tgz",
+ "integrity": "sha512-rt/vv/vg/ZGGkrkKcuJ0LyliRdbskQU+91bje+PgoYmxTZf/tYs6IfbmgudBJk6gH3QnjHWbkphDdRQrseRefQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-win32-x64-msvc": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.3.4.tgz",
+ "integrity": "sha512-DQ20JEfTBZAgF8QCjYfJhv2/279M6onxFjdG/+5B0Cyj00/EdBxiWb2eGGFgQhrBbNv/lsvzFbbi0Ptf8Vw/bg==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -1199,14 +1375,14 @@
"integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw=="
},
"node_modules/@typescript-eslint/eslint-plugin": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.47.1.tgz",
- "integrity": "sha512-r4RZ2Jl9kcQN7K/dcOT+J7NAimbiis4sSM9spvWimsBvDegMhKLA5vri2jG19PmIPbDjPeWzfUPQ2hjEzA4Nmg==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.48.1.tgz",
+ "integrity": "sha512-9nY5K1Rp2ppmpb9s9S2aBiF3xo5uExCehMDmYmmFqqyxgenbHJ3qbarcLt4ITgaD6r/2ypdlcFRdcuVPnks+fQ==",
"dev": true,
"dependencies": {
- "@typescript-eslint/scope-manager": "5.47.1",
- "@typescript-eslint/type-utils": "5.47.1",
- "@typescript-eslint/utils": "5.47.1",
+ "@typescript-eslint/scope-manager": "5.48.1",
+ "@typescript-eslint/type-utils": "5.48.1",
+ "@typescript-eslint/utils": "5.48.1",
"debug": "^4.3.4",
"ignore": "^5.2.0",
"natural-compare-lite": "^1.4.0",
@@ -1232,13 +1408,13 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.47.1.tgz",
- "integrity": "sha512-9hsFDsgUwrdOoW1D97Ewog7DYSHaq4WKuNs0LHF9RiCmqB0Z+XRR4Pf7u7u9z/8CciHuJ6yxNws1XznI3ddjEw==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.48.1.tgz",
+ "integrity": "sha512-S035ueRrbxRMKvSTv9vJKIWgr86BD8s3RqoRZmsSh/s8HhIs90g6UlK8ZabUSjUZQkhVxt7nmZ63VJ9dcZhtDQ==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "5.47.1",
- "@typescript-eslint/visitor-keys": "5.47.1"
+ "@typescript-eslint/types": "5.48.1",
+ "@typescript-eslint/visitor-keys": "5.48.1"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -1249,9 +1425,9 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz",
- "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.1.tgz",
+ "integrity": "sha512-xHyDLU6MSuEEdIlzrrAerCGS3T7AA/L8Hggd0RCYBi0w3JMvGYxlLlXHeg50JI9Tfg5MrtsfuNxbS/3zF1/ATg==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -1262,12 +1438,12 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz",
- "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.1.tgz",
+ "integrity": "sha512-Ns0XBwmfuX7ZknznfXozgnydyR8F6ev/KEGePP4i74uL3ArsKbEhJ7raeKr1JSa997DBDwol/4a0Y+At82c9dA==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "5.47.1",
+ "@typescript-eslint/types": "5.48.1",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
@@ -1369,13 +1545,13 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.47.1.tgz",
- "integrity": "sha512-/UKOeo8ee80A7/GJA427oIrBi/Gd4osk/3auBUg4Rn9EahFpevVV1mUK8hjyQD5lHPqX397x6CwOk5WGh1E/1w==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.48.1.tgz",
+ "integrity": "sha512-Hyr8HU8Alcuva1ppmqSYtM/Gp0q4JOp1F+/JH5D1IZm/bUBrV0edoewQZiEc1r6I8L4JL21broddxK8HAcZiqQ==",
"dev": true,
"dependencies": {
- "@typescript-eslint/typescript-estree": "5.47.1",
- "@typescript-eslint/utils": "5.47.1",
+ "@typescript-eslint/typescript-estree": "5.48.1",
+ "@typescript-eslint/utils": "5.48.1",
"debug": "^4.3.4",
"tsutils": "^3.21.0"
},
@@ -1396,9 +1572,9 @@
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz",
- "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.1.tgz",
+ "integrity": "sha512-xHyDLU6MSuEEdIlzrrAerCGS3T7AA/L8Hggd0RCYBi0w3JMvGYxlLlXHeg50JI9Tfg5MrtsfuNxbS/3zF1/ATg==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -1409,13 +1585,13 @@
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.47.1.tgz",
- "integrity": "sha512-4+ZhFSuISAvRi2xUszEj0xXbNTHceV9GbH9S8oAD2a/F9SW57aJNQVOCxG8GPfSWH/X4eOPdMEU2jYVuWKEpWA==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.48.1.tgz",
+ "integrity": "sha512-Hut+Osk5FYr+sgFh8J/FHjqX6HFcDzTlWLrFqGoK5kVUN3VBHF/QzZmAsIXCQ8T/W9nQNBTqalxi1P3LSqWnRA==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "5.47.1",
- "@typescript-eslint/visitor-keys": "5.47.1",
+ "@typescript-eslint/types": "5.48.1",
+ "@typescript-eslint/visitor-keys": "5.48.1",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -1436,12 +1612,12 @@
}
},
"node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz",
- "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.1.tgz",
+ "integrity": "sha512-Ns0XBwmfuX7ZknznfXozgnydyR8F6ev/KEGePP4i74uL3ArsKbEhJ7raeKr1JSa997DBDwol/4a0Y+At82c9dA==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "5.47.1",
+ "@typescript-eslint/types": "5.48.1",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
@@ -1539,16 +1715,16 @@
"dev": true
},
"node_modules/@typescript-eslint/utils": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.47.1.tgz",
- "integrity": "sha512-l90SdwqfmkuIVaREZ2ykEfCezepCLxzWMo5gVfcJsJCaT4jHT+QjgSkYhs5BMQmWqE9k3AtIfk4g211z/sTMVw==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.48.1.tgz",
+ "integrity": "sha512-SmQuSrCGUOdmGMwivW14Z0Lj8dxG1mOFZ7soeJ0TQZEJcs3n5Ndgkg0A4bcMFzBELqLJ6GTHnEU+iIoaD6hFGA==",
"dev": true,
"dependencies": {
"@types/json-schema": "^7.0.9",
"@types/semver": "^7.3.12",
- "@typescript-eslint/scope-manager": "5.47.1",
- "@typescript-eslint/types": "5.47.1",
- "@typescript-eslint/typescript-estree": "5.47.1",
+ "@typescript-eslint/scope-manager": "5.48.1",
+ "@typescript-eslint/types": "5.48.1",
+ "@typescript-eslint/typescript-estree": "5.48.1",
"eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0",
"semver": "^7.3.7"
@@ -1565,13 +1741,13 @@
}
},
"node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.47.1.tgz",
- "integrity": "sha512-9hsFDsgUwrdOoW1D97Ewog7DYSHaq4WKuNs0LHF9RiCmqB0Z+XRR4Pf7u7u9z/8CciHuJ6yxNws1XznI3ddjEw==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.48.1.tgz",
+ "integrity": "sha512-S035ueRrbxRMKvSTv9vJKIWgr86BD8s3RqoRZmsSh/s8HhIs90g6UlK8ZabUSjUZQkhVxt7nmZ63VJ9dcZhtDQ==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "5.47.1",
- "@typescript-eslint/visitor-keys": "5.47.1"
+ "@typescript-eslint/types": "5.48.1",
+ "@typescript-eslint/visitor-keys": "5.48.1"
},
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -1582,9 +1758,9 @@
}
},
"node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz",
- "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.1.tgz",
+ "integrity": "sha512-xHyDLU6MSuEEdIlzrrAerCGS3T7AA/L8Hggd0RCYBi0w3JMvGYxlLlXHeg50JI9Tfg5MrtsfuNxbS/3zF1/ATg==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -1595,13 +1771,13 @@
}
},
"node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.47.1.tgz",
- "integrity": "sha512-4+ZhFSuISAvRi2xUszEj0xXbNTHceV9GbH9S8oAD2a/F9SW57aJNQVOCxG8GPfSWH/X4eOPdMEU2jYVuWKEpWA==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.48.1.tgz",
+ "integrity": "sha512-Hut+Osk5FYr+sgFh8J/FHjqX6HFcDzTlWLrFqGoK5kVUN3VBHF/QzZmAsIXCQ8T/W9nQNBTqalxi1P3LSqWnRA==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "5.47.1",
- "@typescript-eslint/visitor-keys": "5.47.1",
+ "@typescript-eslint/types": "5.48.1",
+ "@typescript-eslint/visitor-keys": "5.48.1",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -1622,12 +1798,12 @@
}
},
"node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz",
- "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.1.tgz",
+ "integrity": "sha512-Ns0XBwmfuX7ZknznfXozgnydyR8F6ev/KEGePP4i74uL3ArsKbEhJ7raeKr1JSa997DBDwol/4a0Y+At82c9dA==",
"dev": true,
"dependencies": {
- "@typescript-eslint/types": "5.47.1",
+ "@typescript-eslint/types": "5.48.1",
"eslint-visitor-keys": "^3.3.0"
},
"engines": {
@@ -1823,16 +1999,12 @@
}
},
"node_modules/aria-query": {
- "version": "4.2.2",
- "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-4.2.2.tgz",
- "integrity": "sha512-o/HelwhuKpTj/frsOsbNLNgnNGVIFsVP/SW2BSF14gVl7kAfMOJ6/8wUAUvG1R1NHKrfG+2sHZTu0yauT1qBrA==",
+ "version": "5.1.3",
+ "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.1.3.tgz",
+ "integrity": "sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==",
"dev": true,
"dependencies": {
- "@babel/runtime": "^7.10.2",
- "@babel/runtime-corejs3": "^7.10.2"
- },
- "engines": {
- "node": ">=6.0"
+ "deep-equal": "^2.0.5"
}
},
"node_modules/array-includes": {
@@ -1967,10 +2139,22 @@
"postcss": "^8.1.0"
}
},
+ "node_modules/available-typed-arrays": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz",
+ "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/axe-core": {
- "version": "4.5.2",
- "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.5.2.tgz",
- "integrity": "sha512-u2MVsXfew5HBvjsczCv+xlwdNnB1oQR9HlAcsejZttNjKKSkeDNVwB1vMThIUIFI9GoT57Vtk8iQLwqOfAkboA==",
+ "version": "4.6.2",
+ "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.6.2.tgz",
+ "integrity": "sha512-b1WlTV8+XKLj9gZy2DZXgQiyDp9xkkoe2a6U6UbYccScq2wgH/YwCeI2/Jq2mgo0HzQxqJOjWZBLeA/mqsk5Mg==",
"dev": true,
"engines": {
"node": ">=4"
@@ -1994,10 +2178,13 @@
}
},
"node_modules/axobject-query": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz",
- "integrity": "sha512-Td525n+iPOOyUQIeBfcASuG6uJsDOITl7Mds5gFyerkWiX7qhUTdYUBlSgNMyVqtSJqwpt1kXGLdUt6SykLMRA==",
- "dev": true
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.1.1.tgz",
+ "integrity": "sha512-goKlv8DZrK9hUh975fnHzhNIO4jUnFCfv/dszV5VwUGDFjI6vQ2VwoyjYjYNEbBE8AH87TduWP5uyDR1D+Iteg==",
+ "dev": true,
+ "dependencies": {
+ "deep-equal": "^2.0.5"
+ }
},
"node_modules/babel-plugin-macros": {
"version": "3.1.0",
@@ -2403,6 +2590,12 @@
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true
},
+ "node_modules/confusing-browser-globals": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz",
+ "integrity": "sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==",
+ "dev": true
+ },
"node_modules/convert-source-map": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz",
@@ -2438,17 +2631,6 @@
"url": "https://opencollective.com/core-js"
}
},
- "node_modules/core-js-pure": {
- "version": "3.26.1",
- "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.26.1.tgz",
- "integrity": "sha512-VVXcDpp/xJ21KdULRq/lXdLzQAtX7+37LzpyfFM973il0tWSsDEoyzG38G14AjTpK9VTfiNM9jnFauq/CpaWGQ==",
- "dev": true,
- "hasInstallScript": true,
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/core-js"
- }
- },
"node_modules/core-util-is": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
@@ -2603,6 +2785,49 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/deep-equal": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.0.tgz",
+ "integrity": "sha512-RdpzE0Hv4lhowpIUKKMJfeH6C1pXdtT1/it80ubgWqwI3qpuxUBpC1S4hnHg+zjnuOoDkzUtUCEEkG+XG5l3Mw==",
+ "dev": true,
+ "dependencies": {
+ "call-bind": "^1.0.2",
+ "es-get-iterator": "^1.1.2",
+ "get-intrinsic": "^1.1.3",
+ "is-arguments": "^1.1.1",
+ "is-array-buffer": "^3.0.1",
+ "is-date-object": "^1.0.5",
+ "is-regex": "^1.1.4",
+ "is-shared-array-buffer": "^1.0.2",
+ "isarray": "^2.0.5",
+ "object-is": "^1.1.5",
+ "object-keys": "^1.1.1",
+ "object.assign": "^4.1.4",
+ "regexp.prototype.flags": "^1.4.3",
+ "side-channel": "^1.0.4",
+ "which-boxed-primitive": "^1.0.2",
+ "which-collection": "^1.0.1",
+ "which-typed-array": "^1.1.9"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/deep-equal/node_modules/isarray": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
+ "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==",
+ "dev": true
+ },
+ "node_modules/deep-equal/node_modules/object-keys": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
+ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/deep-extend": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
@@ -2894,16 +3119,42 @@
"node": ">= 0.4"
}
},
- "node_modules/es-shim-unscopables": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz",
- "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==",
+ "node_modules/es-get-iterator": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz",
+ "integrity": "sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==",
"dev": true,
"dependencies": {
- "has": "^1.0.3"
+ "call-bind": "^1.0.2",
+ "get-intrinsic": "^1.1.3",
+ "has-symbols": "^1.0.3",
+ "is-arguments": "^1.1.1",
+ "is-map": "^2.0.2",
+ "is-set": "^2.0.2",
+ "is-string": "^1.0.7",
+ "isarray": "^2.0.5",
+ "stop-iteration-iterator": "^1.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
}
},
- "node_modules/es-to-primitive": {
+ "node_modules/es-get-iterator/node_modules/isarray": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
+ "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==",
+ "dev": true
+ },
+ "node_modules/es-shim-unscopables": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz",
+ "integrity": "sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w==",
+ "dev": true,
+ "dependencies": {
+ "has": "^1.0.3"
+ }
+ },
+ "node_modules/es-to-primitive": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz",
"integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==",
@@ -2937,13 +3188,13 @@
}
},
"node_modules/eslint": {
- "version": "8.29.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.29.0.tgz",
- "integrity": "sha512-isQ4EEiyUjZFbEKvEGJKKGBwXtvXX+zJbkVKCgTuB9t/+jUBcy8avhkEwWJecI15BkRkOYmvIM5ynbhRjEkoeg==",
+ "version": "8.32.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.32.0.tgz",
+ "integrity": "sha512-nETVXpnthqKPFyuY2FNjz/bEd6nbosRgKbkgS/y1C7LJop96gYHWpiguLecMHQ2XCPxn77DS0P+68WzG6vkZSQ==",
"dev": true,
"dependencies": {
- "@eslint/eslintrc": "^1.3.3",
- "@humanwhocodes/config-array": "^0.11.6",
+ "@eslint/eslintrc": "^1.4.1",
+ "@humanwhocodes/config-array": "^0.11.8",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
"ajv": "^6.10.0",
@@ -2962,7 +3213,7 @@
"file-entry-cache": "^6.0.1",
"find-up": "^5.0.0",
"glob-parent": "^6.0.2",
- "globals": "^13.15.0",
+ "globals": "^13.19.0",
"grapheme-splitter": "^1.0.4",
"ignore": "^5.2.0",
"import-fresh": "^3.0.0",
@@ -2992,6 +3243,70 @@
"url": "https://opencollective.com/eslint"
}
},
+ "node_modules/eslint-config-airbnb": {
+ "version": "19.0.4",
+ "resolved": "https://registry.npmjs.org/eslint-config-airbnb/-/eslint-config-airbnb-19.0.4.tgz",
+ "integrity": "sha512-T75QYQVQX57jiNgpF9r1KegMICE94VYwoFQyMGhrvc+lB8YF2E/M/PYDaQe1AJcWaEgqLE+ErXV1Og/+6Vyzew==",
+ "dev": true,
+ "dependencies": {
+ "eslint-config-airbnb-base": "^15.0.0",
+ "object.assign": "^4.1.2",
+ "object.entries": "^1.1.5"
+ },
+ "engines": {
+ "node": "^10.12.0 || ^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "peerDependencies": {
+ "eslint": "^7.32.0 || ^8.2.0",
+ "eslint-plugin-import": "^2.25.3",
+ "eslint-plugin-jsx-a11y": "^6.5.1",
+ "eslint-plugin-react": "^7.28.0",
+ "eslint-plugin-react-hooks": "^4.3.0"
+ }
+ },
+ "node_modules/eslint-config-airbnb-base": {
+ "version": "15.0.0",
+ "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-15.0.0.tgz",
+ "integrity": "sha512-xaX3z4ZZIcFLvh2oUNvcX5oEofXda7giYmuplVxoOg5A7EXJMrUyqRgR+mhDhPK8LZ4PttFOBvCYDbX3sUoUig==",
+ "dev": true,
+ "dependencies": {
+ "confusing-browser-globals": "^1.0.10",
+ "object.assign": "^4.1.2",
+ "object.entries": "^1.1.5",
+ "semver": "^6.3.0"
+ },
+ "engines": {
+ "node": "^10.12.0 || >=12.0.0"
+ },
+ "peerDependencies": {
+ "eslint": "^7.32.0 || ^8.2.0",
+ "eslint-plugin-import": "^2.25.2"
+ }
+ },
+ "node_modules/eslint-config-airbnb-base/node_modules/semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true,
+ "bin": {
+ "semver": "bin/semver.js"
+ }
+ },
+ "node_modules/eslint-config-airbnb-typescript": {
+ "version": "17.0.0",
+ "resolved": "https://registry.npmjs.org/eslint-config-airbnb-typescript/-/eslint-config-airbnb-typescript-17.0.0.tgz",
+ "integrity": "sha512-elNiuzD0kPAPTXjFWg+lE24nMdHMtuxgYoD30OyMD6yrW1AhFZPAg27VX7d3tzOErw+dgJTNWfRSDqEcXb4V0g==",
+ "dev": true,
+ "dependencies": {
+ "eslint-config-airbnb-base": "^15.0.0"
+ },
+ "peerDependencies": {
+ "@typescript-eslint/eslint-plugin": "^5.13.0",
+ "@typescript-eslint/parser": "^5.0.0",
+ "eslint": "^7.32.0 || ^8.2.0",
+ "eslint-plugin-import": "^2.25.3"
+ }
+ },
"node_modules/eslint-config-next": {
"version": "13.0.5",
"resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-13.0.5.tgz",
@@ -3018,14 +3333,27 @@
}
}
},
+ "node_modules/eslint-config-prettier": {
+ "version": "8.6.0",
+ "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.6.0.tgz",
+ "integrity": "sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==",
+ "dev": true,
+ "bin": {
+ "eslint-config-prettier": "bin/cli.js"
+ },
+ "peerDependencies": {
+ "eslint": ">=7.0.0"
+ }
+ },
"node_modules/eslint-import-resolver-node": {
- "version": "0.3.6",
- "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz",
- "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==",
+ "version": "0.3.7",
+ "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz",
+ "integrity": "sha512-gozW2blMLJCeFpBwugLTGyvVjNoeo1knonXAcatC6bjPBZitotxdWf7Gimr25N4c0AAOo4eOUfaG82IJPDpqCA==",
"dev": true,
"dependencies": {
"debug": "^3.2.7",
- "resolve": "^1.20.0"
+ "is-core-module": "^2.11.0",
+ "resolve": "^1.22.1"
}
},
"node_modules/eslint-import-resolver-node/node_modules/debug": {
@@ -3155,23 +3483,25 @@
"dev": true
},
"node_modules/eslint-plugin-import": {
- "version": "2.26.0",
- "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz",
- "integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==",
+ "version": "2.27.4",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.27.4.tgz",
+ "integrity": "sha512-Z1jVt1EGKia1X9CnBCkpAOhWy8FgQ7OmJ/IblEkT82yrFU/xJaxwujaTzLWqigewwynRQ9mmHfX9MtAfhxm0sA==",
"dev": true,
"dependencies": {
- "array-includes": "^3.1.4",
- "array.prototype.flat": "^1.2.5",
- "debug": "^2.6.9",
+ "array-includes": "^3.1.6",
+ "array.prototype.flat": "^1.3.1",
+ "array.prototype.flatmap": "^1.3.0",
+ "debug": "^3.2.7",
"doctrine": "^2.1.0",
- "eslint-import-resolver-node": "^0.3.6",
- "eslint-module-utils": "^2.7.3",
+ "eslint-import-resolver-node": "^0.3.7",
+ "eslint-module-utils": "^2.7.4",
"has": "^1.0.3",
- "is-core-module": "^2.8.1",
+ "is-core-module": "^2.11.0",
"is-glob": "^4.0.3",
"minimatch": "^3.1.2",
- "object.values": "^1.1.5",
- "resolve": "^1.22.0",
+ "object.values": "^1.1.6",
+ "resolve": "^1.22.1",
+ "semver": "^6.3.0",
"tsconfig-paths": "^3.14.1"
},
"engines": {
@@ -3181,6 +3511,15 @@
"eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8"
}
},
+ "node_modules/eslint-plugin-import/node_modules/debug": {
+ "version": "3.2.7",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
+ "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
+ "dev": true,
+ "dependencies": {
+ "ms": "^2.1.1"
+ }
+ },
"node_modules/eslint-plugin-import/node_modules/doctrine": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
@@ -3193,24 +3532,42 @@
"node": ">=0.10.0"
}
},
+ "node_modules/eslint-plugin-import/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true
+ },
+ "node_modules/eslint-plugin-import/node_modules/semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true,
+ "bin": {
+ "semver": "bin/semver.js"
+ }
+ },
"node_modules/eslint-plugin-jsx-a11y": {
- "version": "6.6.1",
- "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.6.1.tgz",
- "integrity": "sha512-sXgFVNHiWffBq23uiS/JaP6eVR622DqwB4yTzKvGZGcPq6/yZ3WmOZfuBks/vHWo9GaFOqC2ZK4i6+C35knx7Q==",
+ "version": "6.7.1",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.7.1.tgz",
+ "integrity": "sha512-63Bog4iIethyo8smBklORknVjB0T2dwB8Mr/hIC+fBS0uyHdYYpzM/Ed+YC8VxTjlXHEWFOdmgwcDn1U2L9VCA==",
"dev": true,
"dependencies": {
- "@babel/runtime": "^7.18.9",
- "aria-query": "^4.2.2",
- "array-includes": "^3.1.5",
+ "@babel/runtime": "^7.20.7",
+ "aria-query": "^5.1.3",
+ "array-includes": "^3.1.6",
+ "array.prototype.flatmap": "^1.3.1",
"ast-types-flow": "^0.0.7",
- "axe-core": "^4.4.3",
- "axobject-query": "^2.2.0",
+ "axe-core": "^4.6.2",
+ "axobject-query": "^3.1.1",
"damerau-levenshtein": "^1.0.8",
"emoji-regex": "^9.2.2",
"has": "^1.0.3",
- "jsx-ast-utils": "^3.3.2",
- "language-tags": "^1.0.5",
+ "jsx-ast-utils": "^3.3.3",
+ "language-tags": "=1.0.5",
"minimatch": "^3.1.2",
+ "object.entries": "^1.1.6",
+ "object.fromentries": "^2.0.6",
"semver": "^6.3.0"
},
"engines": {
@@ -3229,10 +3586,31 @@
"semver": "bin/semver.js"
}
},
+ "node_modules/eslint-plugin-prettier": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz",
+ "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==",
+ "dev": true,
+ "dependencies": {
+ "prettier-linter-helpers": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "peerDependencies": {
+ "eslint": ">=7.28.0",
+ "prettier": ">=2.0.0"
+ },
+ "peerDependenciesMeta": {
+ "eslint-config-prettier": {
+ "optional": true
+ }
+ }
+ },
"node_modules/eslint-plugin-react": {
- "version": "7.31.11",
- "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.31.11.tgz",
- "integrity": "sha512-TTvq5JsT5v56wPa9OYHzsrOlHzKZKjV+aLgS+55NJP/cuzdiQPC7PfYoUjMoxlffKtvijpk7vA/jmuqRb9nohw==",
+ "version": "7.32.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.32.0.tgz",
+ "integrity": "sha512-vSBi1+SrPiLZCGvxpiZIa28fMEUaMjXtCplrvxcIxGzmFiYdsXQDwInEjuv5/i/2CTTxbkS87tE8lsQ0Qxinbw==",
"dev": true,
"dependencies": {
"array-includes": "^3.1.6",
@@ -3247,7 +3625,7 @@
"object.hasown": "^1.1.2",
"object.values": "^1.1.6",
"prop-types": "^15.8.1",
- "resolve": "^2.0.0-next.3",
+ "resolve": "^2.0.0-next.4",
"semver": "^6.3.0",
"string.prototype.matchall": "^4.0.8"
},
@@ -3433,9 +3811,9 @@
}
},
"node_modules/eslint/node_modules/globals": {
- "version": "13.18.0",
- "resolved": "https://registry.npmjs.org/globals/-/globals-13.18.0.tgz",
- "integrity": "sha512-/mR4KI8Ps2spmoc0Ulu9L7agOF0du1CZNQ3dke8yItYlyKNmGrkONemBbd6V8UTc1Wgcqn21t3WYB7dbRmh6/A==",
+ "version": "13.19.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz",
+ "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==",
"dev": true,
"dependencies": {
"type-fest": "^0.20.2"
@@ -3604,6 +3982,12 @@
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
"dev": true
},
+ "node_modules/fast-diff": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz",
+ "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==",
+ "dev": true
+ },
"node_modules/fast-glob": {
"version": "3.2.11",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz",
@@ -3749,6 +4133,15 @@
}
}
},
+ "node_modules/for-each": {
+ "version": "0.3.3",
+ "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
+ "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==",
+ "dev": true,
+ "dependencies": {
+ "is-callable": "^1.1.3"
+ }
+ },
"node_modules/form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
@@ -3967,6 +4360,18 @@
"integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==",
"dev": true
},
+ "node_modules/gopd": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
+ "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
+ "dev": true,
+ "dependencies": {
+ "get-intrinsic": "^1.1.3"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/graceful-fs": {
"version": "4.2.10",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
@@ -4274,12 +4679,12 @@
"integrity": "sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q=="
},
"node_modules/internal-slot": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz",
- "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==",
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.4.tgz",
+ "integrity": "sha512-tA8URYccNzMo94s5MQZgH8NB/XTa6HsOo0MLfXTKKEnHVVdegzaQoFZ7Jp44bdvLvY2waT5dc+j5ICEswhi7UQ==",
"dev": true,
"dependencies": {
- "get-intrinsic": "^1.1.0",
+ "get-intrinsic": "^1.1.3",
"has": "^1.0.3",
"side-channel": "^1.0.4"
},
@@ -4287,6 +4692,36 @@
"node": ">= 0.4"
}
},
+ "node_modules/is-arguments": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz",
+ "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==",
+ "dev": true,
+ "dependencies": {
+ "call-bind": "^1.0.2",
+ "has-tostringtag": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-array-buffer": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.1.tgz",
+ "integrity": "sha512-ASfLknmY8Xa2XtB4wmbz13Wu202baeA18cJBCeCy0wXUHZF0IPyVEXqKEcd+t2fNSLLL1vC6k7lxZEojNbISXQ==",
+ "dev": true,
+ "dependencies": {
+ "call-bind": "^1.0.2",
+ "get-intrinsic": "^1.1.3",
+ "is-typed-array": "^1.1.10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/is-arrayish": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
@@ -4436,6 +4871,15 @@
"node": ">=0.10.0"
}
},
+ "node_modules/is-map": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz",
+ "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==",
+ "dev": true,
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/is-negative-zero": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz",
@@ -4508,6 +4952,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/is-set": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz",
+ "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==",
+ "dev": true,
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/is-shared-array-buffer": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz",
@@ -4550,6 +5003,34 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/is-typed-array": {
+ "version": "1.1.10",
+ "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz",
+ "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==",
+ "dev": true,
+ "dependencies": {
+ "available-typed-arrays": "^1.0.5",
+ "call-bind": "^1.0.2",
+ "for-each": "^0.3.3",
+ "gopd": "^1.0.1",
+ "has-tostringtag": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-weakmap": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz",
+ "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==",
+ "dev": true,
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/is-weakref": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz",
@@ -4562,6 +5043,19 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/is-weakset": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz",
+ "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==",
+ "dev": true,
+ "dependencies": {
+ "call-bind": "^1.0.2",
+ "get-intrinsic": "^1.1.1"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/is-wsl": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
@@ -5678,6 +6172,22 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/object-is": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz",
+ "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==",
+ "dev": true,
+ "dependencies": {
+ "call-bind": "^1.0.2",
+ "define-properties": "^1.1.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/object-keys": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz",
@@ -6120,6 +6630,33 @@
"node": ">= 0.8.0"
}
},
+ "node_modules/prettier": {
+ "version": "2.8.3",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.3.tgz",
+ "integrity": "sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw==",
+ "dev": true,
+ "bin": {
+ "prettier": "bin-prettier.js"
+ },
+ "engines": {
+ "node": ">=10.13.0"
+ },
+ "funding": {
+ "url": "https://github.com/prettier/prettier?sponsor=1"
+ }
+ },
+ "node_modules/prettier-linter-helpers": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz",
+ "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==",
+ "dev": true,
+ "dependencies": {
+ "fast-diff": "^1.1.2"
+ },
+ "engines": {
+ "node": ">=6.0.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",
@@ -6154,9 +6691,9 @@
}
},
"node_modules/punycode": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
- "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.2.0.tgz",
+ "integrity": "sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw==",
"dev": true,
"engines": {
"node": ">=6"
@@ -7041,6 +7578,18 @@
"node": ">=0.1.14"
}
},
+ "node_modules/stop-iteration-iterator": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.0.0.tgz",
+ "integrity": "sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==",
+ "dev": true,
+ "dependencies": {
+ "internal-slot": "^1.0.4"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/strict-uri-encode": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz",
@@ -7848,6 +8397,41 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/which-collection": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz",
+ "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==",
+ "dev": true,
+ "dependencies": {
+ "is-map": "^2.0.1",
+ "is-set": "^2.0.1",
+ "is-weakmap": "^2.0.1",
+ "is-weakset": "^2.0.1"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/which-typed-array": {
+ "version": "1.1.9",
+ "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz",
+ "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==",
+ "dev": true,
+ "dependencies": {
+ "available-typed-arrays": "^1.0.5",
+ "call-bind": "^1.0.2",
+ "for-each": "^0.3.3",
+ "gopd": "^1.0.1",
+ "has-tostringtag": "^1.0.0",
+ "is-typed-array": "^1.1.10"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/word-wrap": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
@@ -7895,186 +8479,6 @@
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
- },
- "node_modules/@next/swc-android-arm-eabi": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.3.4.tgz",
- "integrity": "sha512-cM42Cw6V4Bz/2+j/xIzO8nK/Q3Ly+VSlZJTa1vHzsocJRYz8KT6MrreXaci2++SIZCF1rVRCDgAg5PpqRibdIA==",
- "cpu": [
- "arm"
- ],
- "optional": true,
- "os": [
- "android"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-android-arm64": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.3.4.tgz",
- "integrity": "sha512-5jf0dTBjL+rabWjGj3eghpLUxCukRhBcEJgwLedewEA/LJk2HyqCvGIwj5rH+iwmq1llCWbOky2dO3pVljrapg==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "android"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-darwin-arm64": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.3.4.tgz",
- "integrity": "sha512-DqsSTd3FRjQUR6ao0E1e2OlOcrF5br+uegcEGPVonKYJpcr0MJrtYmPxd4v5T6UCJZ+XzydF7eQo5wdGvSZAyA==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-freebsd-x64": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.3.4.tgz",
- "integrity": "sha512-KM9JXRXi/U2PUM928z7l4tnfQ9u8bTco/jb939pdFUHqc28V43Ohd31MmZD1QzEK4aFlMRaIBQOWQZh4D/E5lQ==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "freebsd"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-linux-arm-gnueabihf": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.3.4.tgz",
- "integrity": "sha512-3zqD3pO+z5CZyxtKDTnOJ2XgFFRUBciOox6EWkoZvJfc9zcidNAQxuwonUeNts6Xbm8Wtm5YGIRC0x+12YH7kw==",
- "cpu": [
- "arm"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-linux-arm64-gnu": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.3.4.tgz",
- "integrity": "sha512-kiX0vgJGMZVv+oo1QuObaYulXNvdH/IINmvdZnVzMO/jic/B8EEIGlZ8Bgvw8LCjH3zNVPO3mGrdMvnEEPEhKA==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-linux-arm64-musl": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.3.4.tgz",
- "integrity": "sha512-EETZPa1juczrKLWk5okoW2hv7D7WvonU+Cf2CgsSoxgsYbUCZ1voOpL4JZTOb6IbKMDo6ja+SbY0vzXZBUMvkQ==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-linux-x64-gnu": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.3.4.tgz",
- "integrity": "sha512-4csPbRbfZbuWOk3ATyWcvVFdD9/Rsdq5YHKvRuEni68OCLkfy4f+4I9OBpyK1SKJ00Cih16NJbHE+k+ljPPpag==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-linux-x64-musl": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.3.4.tgz",
- "integrity": "sha512-YeBmI+63Ro75SUiL/QXEVXQ19T++58aI/IINOyhpsRL1LKdyfK/35iilraZEFz9bLQrwy1LYAR5lK200A9Gjbg==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-win32-arm64-msvc": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.3.4.tgz",
- "integrity": "sha512-Sd0qFUJv8Tj0PukAYbCCDbmXcMkbIuhnTeHm9m4ZGjCf6kt7E/RMs55Pd3R5ePjOkN7dJEuxYBehawTR/aPDSQ==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-win32-ia32-msvc": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.3.4.tgz",
- "integrity": "sha512-rt/vv/vg/ZGGkrkKcuJ0LyliRdbskQU+91bje+PgoYmxTZf/tYs6IfbmgudBJk6gH3QnjHWbkphDdRQrseRefQ==",
- "cpu": [
- "ia32"
- ],
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-win32-x64-msvc": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.3.4.tgz",
- "integrity": "sha512-DQ20JEfTBZAgF8QCjYfJhv2/279M6onxFjdG/+5B0Cyj00/EdBxiWb2eGGFgQhrBbNv/lsvzFbbi0Ptf8Vw/bg==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
}
},
"dependencies": {
@@ -8324,16 +8728,6 @@
"regenerator-runtime": "^0.13.11"
}
},
- "@babel/runtime-corejs3": {
- "version": "7.20.1",
- "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.20.1.tgz",
- "integrity": "sha512-CGulbEDcg/ND1Im7fUNRZdGXmX2MTWVVZacQi/6DiKE5HNwZ3aVTm5PV4lO8HHz0B2h8WQyvKKjbX5XgTtydsg==",
- "dev": true,
- "requires": {
- "core-js-pure": "^3.25.1",
- "regenerator-runtime": "^0.13.10"
- }
- },
"@babel/template": {
"version": "7.18.10",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz",
@@ -8527,15 +8921,15 @@
"integrity": "sha512-AHPmaAx+RYfZz0eYu6Gviiagpmiyw98ySSlQvCUhVGDRtDFe4DBS0x1bSjdF3gqUDYOczB+yYvBTtEylYSdRhg=="
},
"@eslint/eslintrc": {
- "version": "1.3.3",
- "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz",
- "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==",
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz",
+ "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==",
"dev": true,
"requires": {
"ajv": "^6.12.4",
"debug": "^4.3.2",
"espree": "^9.4.0",
- "globals": "^13.15.0",
+ "globals": "^13.19.0",
"ignore": "^5.2.0",
"import-fresh": "^3.2.1",
"js-yaml": "^4.1.0",
@@ -8559,9 +8953,9 @@
}
},
"globals": {
- "version": "13.18.0",
- "resolved": "https://registry.npmjs.org/globals/-/globals-13.18.0.tgz",
- "integrity": "sha512-/mR4KI8Ps2spmoc0Ulu9L7agOF0du1CZNQ3dke8yItYlyKNmGrkONemBbd6V8UTc1Wgcqn21t3WYB7dbRmh6/A==",
+ "version": "13.19.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz",
+ "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==",
"dev": true,
"requires": {
"type-fest": "^0.20.2"
@@ -8636,9 +9030,9 @@
"requires": {}
},
"@humanwhocodes/config-array": {
- "version": "0.11.7",
- "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.7.tgz",
- "integrity": "sha512-kBbPWzN8oVMLb0hOUYXhmxggL/1cJE6ydvjDIGi9EnAGUyA7cLVKQg+d/Dsm+KZwx2czGHrCmMVLiyg8s5JPKw==",
+ "version": "0.11.8",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.8.tgz",
+ "integrity": "sha512-UybHIJzJnR5Qc/MsD9Kr+RpO2h+/P1GhOwdiLPXK5TWk5sgTdu88bTD9UP+CKbPPh5Rni1u0GjAdYQLemG8g+g==",
"dev": true,
"requires": {
"@humanwhocodes/object-schema": "^1.2.1",
@@ -8723,12 +9117,84 @@
"glob": "7.1.7"
}
},
+ "@next/swc-android-arm-eabi": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.3.4.tgz",
+ "integrity": "sha512-cM42Cw6V4Bz/2+j/xIzO8nK/Q3Ly+VSlZJTa1vHzsocJRYz8KT6MrreXaci2++SIZCF1rVRCDgAg5PpqRibdIA==",
+ "optional": true
+ },
+ "@next/swc-android-arm64": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.3.4.tgz",
+ "integrity": "sha512-5jf0dTBjL+rabWjGj3eghpLUxCukRhBcEJgwLedewEA/LJk2HyqCvGIwj5rH+iwmq1llCWbOky2dO3pVljrapg==",
+ "optional": true
+ },
+ "@next/swc-darwin-arm64": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.3.4.tgz",
+ "integrity": "sha512-DqsSTd3FRjQUR6ao0E1e2OlOcrF5br+uegcEGPVonKYJpcr0MJrtYmPxd4v5T6UCJZ+XzydF7eQo5wdGvSZAyA==",
+ "optional": true
+ },
"@next/swc-darwin-x64": {
"version": "12.3.4",
"resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-12.3.4.tgz",
"integrity": "sha512-PPF7tbWD4k0dJ2EcUSnOsaOJ5rhT3rlEt/3LhZUGiYNL8KvoqczFrETlUx0cUYaXe11dRA3F80Hpt727QIwByQ==",
"optional": true
},
+ "@next/swc-freebsd-x64": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.3.4.tgz",
+ "integrity": "sha512-KM9JXRXi/U2PUM928z7l4tnfQ9u8bTco/jb939pdFUHqc28V43Ohd31MmZD1QzEK4aFlMRaIBQOWQZh4D/E5lQ==",
+ "optional": true
+ },
+ "@next/swc-linux-arm-gnueabihf": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.3.4.tgz",
+ "integrity": "sha512-3zqD3pO+z5CZyxtKDTnOJ2XgFFRUBciOox6EWkoZvJfc9zcidNAQxuwonUeNts6Xbm8Wtm5YGIRC0x+12YH7kw==",
+ "optional": true
+ },
+ "@next/swc-linux-arm64-gnu": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.3.4.tgz",
+ "integrity": "sha512-kiX0vgJGMZVv+oo1QuObaYulXNvdH/IINmvdZnVzMO/jic/B8EEIGlZ8Bgvw8LCjH3zNVPO3mGrdMvnEEPEhKA==",
+ "optional": true
+ },
+ "@next/swc-linux-arm64-musl": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.3.4.tgz",
+ "integrity": "sha512-EETZPa1juczrKLWk5okoW2hv7D7WvonU+Cf2CgsSoxgsYbUCZ1voOpL4JZTOb6IbKMDo6ja+SbY0vzXZBUMvkQ==",
+ "optional": true
+ },
+ "@next/swc-linux-x64-gnu": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.3.4.tgz",
+ "integrity": "sha512-4csPbRbfZbuWOk3ATyWcvVFdD9/Rsdq5YHKvRuEni68OCLkfy4f+4I9OBpyK1SKJ00Cih16NJbHE+k+ljPPpag==",
+ "optional": true
+ },
+ "@next/swc-linux-x64-musl": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.3.4.tgz",
+ "integrity": "sha512-YeBmI+63Ro75SUiL/QXEVXQ19T++58aI/IINOyhpsRL1LKdyfK/35iilraZEFz9bLQrwy1LYAR5lK200A9Gjbg==",
+ "optional": true
+ },
+ "@next/swc-win32-arm64-msvc": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.3.4.tgz",
+ "integrity": "sha512-Sd0qFUJv8Tj0PukAYbCCDbmXcMkbIuhnTeHm9m4ZGjCf6kt7E/RMs55Pd3R5ePjOkN7dJEuxYBehawTR/aPDSQ==",
+ "optional": true
+ },
+ "@next/swc-win32-ia32-msvc": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.3.4.tgz",
+ "integrity": "sha512-rt/vv/vg/ZGGkrkKcuJ0LyliRdbskQU+91bje+PgoYmxTZf/tYs6IfbmgudBJk6gH3QnjHWbkphDdRQrseRefQ==",
+ "optional": true
+ },
+ "@next/swc-win32-x64-msvc": {
+ "version": "12.3.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.3.4.tgz",
+ "integrity": "sha512-DQ20JEfTBZAgF8QCjYfJhv2/279M6onxFjdG/+5B0Cyj00/EdBxiWb2eGGFgQhrBbNv/lsvzFbbi0Ptf8Vw/bg==",
+ "optional": true
+ },
"@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -8955,14 +9421,14 @@
"integrity": "sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw=="
},
"@typescript-eslint/eslint-plugin": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.47.1.tgz",
- "integrity": "sha512-r4RZ2Jl9kcQN7K/dcOT+J7NAimbiis4sSM9spvWimsBvDegMhKLA5vri2jG19PmIPbDjPeWzfUPQ2hjEzA4Nmg==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.48.1.tgz",
+ "integrity": "sha512-9nY5K1Rp2ppmpb9s9S2aBiF3xo5uExCehMDmYmmFqqyxgenbHJ3qbarcLt4ITgaD6r/2ypdlcFRdcuVPnks+fQ==",
"dev": true,
"requires": {
- "@typescript-eslint/scope-manager": "5.47.1",
- "@typescript-eslint/type-utils": "5.47.1",
- "@typescript-eslint/utils": "5.47.1",
+ "@typescript-eslint/scope-manager": "5.48.1",
+ "@typescript-eslint/type-utils": "5.48.1",
+ "@typescript-eslint/utils": "5.48.1",
"debug": "^4.3.4",
"ignore": "^5.2.0",
"natural-compare-lite": "^1.4.0",
@@ -8972,28 +9438,28 @@
},
"dependencies": {
"@typescript-eslint/scope-manager": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.47.1.tgz",
- "integrity": "sha512-9hsFDsgUwrdOoW1D97Ewog7DYSHaq4WKuNs0LHF9RiCmqB0Z+XRR4Pf7u7u9z/8CciHuJ6yxNws1XznI3ddjEw==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.48.1.tgz",
+ "integrity": "sha512-S035ueRrbxRMKvSTv9vJKIWgr86BD8s3RqoRZmsSh/s8HhIs90g6UlK8ZabUSjUZQkhVxt7nmZ63VJ9dcZhtDQ==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "5.47.1",
- "@typescript-eslint/visitor-keys": "5.47.1"
+ "@typescript-eslint/types": "5.48.1",
+ "@typescript-eslint/visitor-keys": "5.48.1"
}
},
"@typescript-eslint/types": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz",
- "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.1.tgz",
+ "integrity": "sha512-xHyDLU6MSuEEdIlzrrAerCGS3T7AA/L8Hggd0RCYBi0w3JMvGYxlLlXHeg50JI9Tfg5MrtsfuNxbS/3zF1/ATg==",
"dev": true
},
"@typescript-eslint/visitor-keys": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz",
- "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.1.tgz",
+ "integrity": "sha512-Ns0XBwmfuX7ZknznfXozgnydyR8F6ev/KEGePP4i74uL3ArsKbEhJ7raeKr1JSa997DBDwol/4a0Y+At82c9dA==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "5.47.1",
+ "@typescript-eslint/types": "5.48.1",
"eslint-visitor-keys": "^3.3.0"
}
},
@@ -9054,31 +9520,31 @@
}
},
"@typescript-eslint/type-utils": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.47.1.tgz",
- "integrity": "sha512-/UKOeo8ee80A7/GJA427oIrBi/Gd4osk/3auBUg4Rn9EahFpevVV1mUK8hjyQD5lHPqX397x6CwOk5WGh1E/1w==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.48.1.tgz",
+ "integrity": "sha512-Hyr8HU8Alcuva1ppmqSYtM/Gp0q4JOp1F+/JH5D1IZm/bUBrV0edoewQZiEc1r6I8L4JL21broddxK8HAcZiqQ==",
"dev": true,
"requires": {
- "@typescript-eslint/typescript-estree": "5.47.1",
- "@typescript-eslint/utils": "5.47.1",
+ "@typescript-eslint/typescript-estree": "5.48.1",
+ "@typescript-eslint/utils": "5.48.1",
"debug": "^4.3.4",
"tsutils": "^3.21.0"
},
"dependencies": {
"@typescript-eslint/types": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz",
- "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.1.tgz",
+ "integrity": "sha512-xHyDLU6MSuEEdIlzrrAerCGS3T7AA/L8Hggd0RCYBi0w3JMvGYxlLlXHeg50JI9Tfg5MrtsfuNxbS/3zF1/ATg==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.47.1.tgz",
- "integrity": "sha512-4+ZhFSuISAvRi2xUszEj0xXbNTHceV9GbH9S8oAD2a/F9SW57aJNQVOCxG8GPfSWH/X4eOPdMEU2jYVuWKEpWA==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.48.1.tgz",
+ "integrity": "sha512-Hut+Osk5FYr+sgFh8J/FHjqX6HFcDzTlWLrFqGoK5kVUN3VBHF/QzZmAsIXCQ8T/W9nQNBTqalxi1P3LSqWnRA==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "5.47.1",
- "@typescript-eslint/visitor-keys": "5.47.1",
+ "@typescript-eslint/types": "5.48.1",
+ "@typescript-eslint/visitor-keys": "5.48.1",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -9087,12 +9553,12 @@
}
},
"@typescript-eslint/visitor-keys": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz",
- "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.1.tgz",
+ "integrity": "sha512-Ns0XBwmfuX7ZknznfXozgnydyR8F6ev/KEGePP4i74uL3ArsKbEhJ7raeKr1JSa997DBDwol/4a0Y+At82c9dA==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "5.47.1",
+ "@typescript-eslint/types": "5.48.1",
"eslint-visitor-keys": "^3.3.0"
}
},
@@ -9152,45 +9618,45 @@
}
},
"@typescript-eslint/utils": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.47.1.tgz",
- "integrity": "sha512-l90SdwqfmkuIVaREZ2ykEfCezepCLxzWMo5gVfcJsJCaT4jHT+QjgSkYhs5BMQmWqE9k3AtIfk4g211z/sTMVw==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.48.1.tgz",
+ "integrity": "sha512-SmQuSrCGUOdmGMwivW14Z0Lj8dxG1mOFZ7soeJ0TQZEJcs3n5Ndgkg0A4bcMFzBELqLJ6GTHnEU+iIoaD6hFGA==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.9",
"@types/semver": "^7.3.12",
- "@typescript-eslint/scope-manager": "5.47.1",
- "@typescript-eslint/types": "5.47.1",
- "@typescript-eslint/typescript-estree": "5.47.1",
+ "@typescript-eslint/scope-manager": "5.48.1",
+ "@typescript-eslint/types": "5.48.1",
+ "@typescript-eslint/typescript-estree": "5.48.1",
"eslint-scope": "^5.1.1",
"eslint-utils": "^3.0.0",
"semver": "^7.3.7"
},
"dependencies": {
"@typescript-eslint/scope-manager": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.47.1.tgz",
- "integrity": "sha512-9hsFDsgUwrdOoW1D97Ewog7DYSHaq4WKuNs0LHF9RiCmqB0Z+XRR4Pf7u7u9z/8CciHuJ6yxNws1XznI3ddjEw==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.48.1.tgz",
+ "integrity": "sha512-S035ueRrbxRMKvSTv9vJKIWgr86BD8s3RqoRZmsSh/s8HhIs90g6UlK8ZabUSjUZQkhVxt7nmZ63VJ9dcZhtDQ==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "5.47.1",
- "@typescript-eslint/visitor-keys": "5.47.1"
+ "@typescript-eslint/types": "5.48.1",
+ "@typescript-eslint/visitor-keys": "5.48.1"
}
},
"@typescript-eslint/types": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.47.1.tgz",
- "integrity": "sha512-CmALY9YWXEpwuu6377ybJBZdtSAnzXLSQcxLSqSQSbC7VfpMu/HLVdrnVJj7ycI138EHqocW02LPJErE35cE9A==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.48.1.tgz",
+ "integrity": "sha512-xHyDLU6MSuEEdIlzrrAerCGS3T7AA/L8Hggd0RCYBi0w3JMvGYxlLlXHeg50JI9Tfg5MrtsfuNxbS/3zF1/ATg==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.47.1.tgz",
- "integrity": "sha512-4+ZhFSuISAvRi2xUszEj0xXbNTHceV9GbH9S8oAD2a/F9SW57aJNQVOCxG8GPfSWH/X4eOPdMEU2jYVuWKEpWA==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.48.1.tgz",
+ "integrity": "sha512-Hut+Osk5FYr+sgFh8J/FHjqX6HFcDzTlWLrFqGoK5kVUN3VBHF/QzZmAsIXCQ8T/W9nQNBTqalxi1P3LSqWnRA==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "5.47.1",
- "@typescript-eslint/visitor-keys": "5.47.1",
+ "@typescript-eslint/types": "5.48.1",
+ "@typescript-eslint/visitor-keys": "5.48.1",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@@ -9199,12 +9665,12 @@
}
},
"@typescript-eslint/visitor-keys": {
- "version": "5.47.1",
- "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.47.1.tgz",
- "integrity": "sha512-rF3pmut2JCCjh6BLRhNKdYjULMb1brvoaiWDlHfLNVgmnZ0sBVJrs3SyaKE1XoDDnJuAx/hDQryHYmPUuNq0ig==",
+ "version": "5.48.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.48.1.tgz",
+ "integrity": "sha512-Ns0XBwmfuX7ZknznfXozgnydyR8F6ev/KEGePP4i74uL3ArsKbEhJ7raeKr1JSa997DBDwol/4a0Y+At82c9dA==",
"dev": true,
"requires": {
- "@typescript-eslint/types": "5.47.1",
+ "@typescript-eslint/types": "5.48.1",
"eslint-visitor-keys": "^3.3.0"
}
},
@@ -9352,13 +9818,12 @@
}
},
"aria-query": {
- "version": "4.2.2",
- "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-4.2.2.tgz",
- "integrity": "sha512-o/HelwhuKpTj/frsOsbNLNgnNGVIFsVP/SW2BSF14gVl7kAfMOJ6/8wUAUvG1R1NHKrfG+2sHZTu0yauT1qBrA==",
+ "version": "5.1.3",
+ "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.1.3.tgz",
+ "integrity": "sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==",
"dev": true,
"requires": {
- "@babel/runtime": "^7.10.2",
- "@babel/runtime-corejs3": "^7.10.2"
+ "deep-equal": "^2.0.5"
}
},
"array-includes": {
@@ -9447,10 +9912,16 @@
"postcss-value-parser": "^4.2.0"
}
},
+ "available-typed-arrays": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz",
+ "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==",
+ "dev": true
+ },
"axe-core": {
- "version": "4.5.2",
- "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.5.2.tgz",
- "integrity": "sha512-u2MVsXfew5HBvjsczCv+xlwdNnB1oQR9HlAcsejZttNjKKSkeDNVwB1vMThIUIFI9GoT57Vtk8iQLwqOfAkboA==",
+ "version": "4.6.2",
+ "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.6.2.tgz",
+ "integrity": "sha512-b1WlTV8+XKLj9gZy2DZXgQiyDp9xkkoe2a6U6UbYccScq2wgH/YwCeI2/Jq2mgo0HzQxqJOjWZBLeA/mqsk5Mg==",
"dev": true
},
"axios": {
@@ -9469,10 +9940,13 @@
"requires": {}
},
"axobject-query": {
- "version": "2.2.0",
- "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-2.2.0.tgz",
- "integrity": "sha512-Td525n+iPOOyUQIeBfcASuG6uJsDOITl7Mds5gFyerkWiX7qhUTdYUBlSgNMyVqtSJqwpt1kXGLdUt6SykLMRA==",
- "dev": true
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.1.1.tgz",
+ "integrity": "sha512-goKlv8DZrK9hUh975fnHzhNIO4jUnFCfv/dszV5VwUGDFjI6vQ2VwoyjYjYNEbBE8AH87TduWP5uyDR1D+Iteg==",
+ "dev": true,
+ "requires": {
+ "deep-equal": "^2.0.5"
+ }
},
"babel-plugin-macros": {
"version": "3.1.0",
@@ -9751,6 +10225,12 @@
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
"dev": true
},
+ "confusing-browser-globals": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz",
+ "integrity": "sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==",
+ "dev": true
+ },
"convert-source-map": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz",
@@ -9780,12 +10260,6 @@
"resolved": "https://registry.npmjs.org/core-js/-/core-js-3.26.0.tgz",
"integrity": "sha512-+DkDrhoR4Y0PxDz6rurahuB+I45OsEUv8E1maPTB6OuHRohMMcznBq9TMpdpDMm/hUPob/mJJS3PqgbHpMTQgw=="
},
- "core-js-pure": {
- "version": "3.26.1",
- "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.26.1.tgz",
- "integrity": "sha512-VVXcDpp/xJ21KdULRq/lXdLzQAtX7+37LzpyfFM973il0tWSsDEoyzG38G14AjTpK9VTfiNM9jnFauq/CpaWGQ==",
- "dev": true
- },
"core-util-is": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
@@ -9911,6 +10385,45 @@
"mimic-response": "^3.1.0"
}
},
+ "deep-equal": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.0.tgz",
+ "integrity": "sha512-RdpzE0Hv4lhowpIUKKMJfeH6C1pXdtT1/it80ubgWqwI3qpuxUBpC1S4hnHg+zjnuOoDkzUtUCEEkG+XG5l3Mw==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.2",
+ "es-get-iterator": "^1.1.2",
+ "get-intrinsic": "^1.1.3",
+ "is-arguments": "^1.1.1",
+ "is-array-buffer": "^3.0.1",
+ "is-date-object": "^1.0.5",
+ "is-regex": "^1.1.4",
+ "is-shared-array-buffer": "^1.0.2",
+ "isarray": "^2.0.5",
+ "object-is": "^1.1.5",
+ "object-keys": "^1.1.1",
+ "object.assign": "^4.1.4",
+ "regexp.prototype.flags": "^1.4.3",
+ "side-channel": "^1.0.4",
+ "which-boxed-primitive": "^1.0.2",
+ "which-collection": "^1.0.1",
+ "which-typed-array": "^1.1.9"
+ },
+ "dependencies": {
+ "isarray": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
+ "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==",
+ "dev": true
+ },
+ "object-keys": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz",
+ "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==",
+ "dev": true
+ }
+ }
+ },
"deep-extend": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
@@ -10150,6 +10663,31 @@
}
}
},
+ "es-get-iterator": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz",
+ "integrity": "sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.2",
+ "get-intrinsic": "^1.1.3",
+ "has-symbols": "^1.0.3",
+ "is-arguments": "^1.1.1",
+ "is-map": "^2.0.2",
+ "is-set": "^2.0.2",
+ "is-string": "^1.0.7",
+ "isarray": "^2.0.5",
+ "stop-iteration-iterator": "^1.0.0"
+ },
+ "dependencies": {
+ "isarray": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz",
+ "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==",
+ "dev": true
+ }
+ }
+ },
"es-shim-unscopables": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz",
@@ -10181,13 +10719,13 @@
"integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg=="
},
"eslint": {
- "version": "8.29.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.29.0.tgz",
- "integrity": "sha512-isQ4EEiyUjZFbEKvEGJKKGBwXtvXX+zJbkVKCgTuB9t/+jUBcy8avhkEwWJecI15BkRkOYmvIM5ynbhRjEkoeg==",
+ "version": "8.32.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.32.0.tgz",
+ "integrity": "sha512-nETVXpnthqKPFyuY2FNjz/bEd6nbosRgKbkgS/y1C7LJop96gYHWpiguLecMHQ2XCPxn77DS0P+68WzG6vkZSQ==",
"dev": true,
"requires": {
- "@eslint/eslintrc": "^1.3.3",
- "@humanwhocodes/config-array": "^0.11.6",
+ "@eslint/eslintrc": "^1.4.1",
+ "@humanwhocodes/config-array": "^0.11.8",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
"ajv": "^6.10.0",
@@ -10206,7 +10744,7 @@
"file-entry-cache": "^6.0.1",
"find-up": "^5.0.0",
"glob-parent": "^6.0.2",
- "globals": "^13.15.0",
+ "globals": "^13.19.0",
"grapheme-splitter": "^1.0.4",
"ignore": "^5.2.0",
"import-fresh": "^3.0.0",
@@ -10268,9 +10806,9 @@
"dev": true
},
"globals": {
- "version": "13.18.0",
- "resolved": "https://registry.npmjs.org/globals/-/globals-13.18.0.tgz",
- "integrity": "sha512-/mR4KI8Ps2spmoc0Ulu9L7agOF0du1CZNQ3dke8yItYlyKNmGrkONemBbd6V8UTc1Wgcqn21t3WYB7dbRmh6/A==",
+ "version": "13.19.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-13.19.0.tgz",
+ "integrity": "sha512-dkQ957uSRWHw7CFXLUtUHQI3g3aWApYhfNR2O6jn/907riyTYKVBmxYVROkBcY614FSSeSJh7Xm7SrUWCxvJMQ==",
"dev": true,
"requires": {
"type-fest": "^0.20.2"
@@ -10308,6 +10846,46 @@
}
}
},
+ "eslint-config-airbnb": {
+ "version": "19.0.4",
+ "resolved": "https://registry.npmjs.org/eslint-config-airbnb/-/eslint-config-airbnb-19.0.4.tgz",
+ "integrity": "sha512-T75QYQVQX57jiNgpF9r1KegMICE94VYwoFQyMGhrvc+lB8YF2E/M/PYDaQe1AJcWaEgqLE+ErXV1Og/+6Vyzew==",
+ "dev": true,
+ "requires": {
+ "eslint-config-airbnb-base": "^15.0.0",
+ "object.assign": "^4.1.2",
+ "object.entries": "^1.1.5"
+ }
+ },
+ "eslint-config-airbnb-base": {
+ "version": "15.0.0",
+ "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-15.0.0.tgz",
+ "integrity": "sha512-xaX3z4ZZIcFLvh2oUNvcX5oEofXda7giYmuplVxoOg5A7EXJMrUyqRgR+mhDhPK8LZ4PttFOBvCYDbX3sUoUig==",
+ "dev": true,
+ "requires": {
+ "confusing-browser-globals": "^1.0.10",
+ "object.assign": "^4.1.2",
+ "object.entries": "^1.1.5",
+ "semver": "^6.3.0"
+ },
+ "dependencies": {
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
+ }
+ }
+ },
+ "eslint-config-airbnb-typescript": {
+ "version": "17.0.0",
+ "resolved": "https://registry.npmjs.org/eslint-config-airbnb-typescript/-/eslint-config-airbnb-typescript-17.0.0.tgz",
+ "integrity": "sha512-elNiuzD0kPAPTXjFWg+lE24nMdHMtuxgYoD30OyMD6yrW1AhFZPAg27VX7d3tzOErw+dgJTNWfRSDqEcXb4V0g==",
+ "dev": true,
+ "requires": {
+ "eslint-config-airbnb-base": "^15.0.0"
+ }
+ },
"eslint-config-next": {
"version": "13.0.5",
"resolved": "https://registry.npmjs.org/eslint-config-next/-/eslint-config-next-13.0.5.tgz",
@@ -10325,14 +10903,22 @@
"eslint-plugin-react-hooks": "^4.5.0"
}
},
+ "eslint-config-prettier": {
+ "version": "8.6.0",
+ "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.6.0.tgz",
+ "integrity": "sha512-bAF0eLpLVqP5oEVUFKpMA+NnRFICwn9X8B5jrR9FcqnYBuPbqWEjTEspPWMj5ye6czoSLDweCzSo3Ko7gGrZaA==",
+ "dev": true,
+ "requires": {}
+ },
"eslint-import-resolver-node": {
- "version": "0.3.6",
- "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz",
- "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==",
+ "version": "0.3.7",
+ "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.7.tgz",
+ "integrity": "sha512-gozW2blMLJCeFpBwugLTGyvVjNoeo1knonXAcatC6bjPBZitotxdWf7Gimr25N4c0AAOo4eOUfaG82IJPDpqCA==",
"dev": true,
"requires": {
"debug": "^3.2.7",
- "resolve": "^1.20.0"
+ "is-core-module": "^2.11.0",
+ "resolve": "^1.22.1"
},
"dependencies": {
"debug": {
@@ -10430,26 +11016,37 @@
}
},
"eslint-plugin-import": {
- "version": "2.26.0",
- "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz",
- "integrity": "sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==",
+ "version": "2.27.4",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.27.4.tgz",
+ "integrity": "sha512-Z1jVt1EGKia1X9CnBCkpAOhWy8FgQ7OmJ/IblEkT82yrFU/xJaxwujaTzLWqigewwynRQ9mmHfX9MtAfhxm0sA==",
"dev": true,
"requires": {
- "array-includes": "^3.1.4",
- "array.prototype.flat": "^1.2.5",
- "debug": "^2.6.9",
+ "array-includes": "^3.1.6",
+ "array.prototype.flat": "^1.3.1",
+ "array.prototype.flatmap": "^1.3.0",
+ "debug": "^3.2.7",
"doctrine": "^2.1.0",
- "eslint-import-resolver-node": "^0.3.6",
- "eslint-module-utils": "^2.7.3",
+ "eslint-import-resolver-node": "^0.3.7",
+ "eslint-module-utils": "^2.7.4",
"has": "^1.0.3",
- "is-core-module": "^2.8.1",
+ "is-core-module": "^2.11.0",
"is-glob": "^4.0.3",
"minimatch": "^3.1.2",
- "object.values": "^1.1.5",
- "resolve": "^1.22.0",
+ "object.values": "^1.1.6",
+ "resolve": "^1.22.1",
+ "semver": "^6.3.0",
"tsconfig-paths": "^3.14.1"
},
"dependencies": {
+ "debug": {
+ "version": "3.2.7",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
+ "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
+ "dev": true,
+ "requires": {
+ "ms": "^2.1.1"
+ }
+ },
"doctrine": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
@@ -10458,27 +11055,42 @@
"requires": {
"esutils": "^2.0.2"
}
+ },
+ "ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true
+ },
+ "semver": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
+ "dev": true
}
}
},
"eslint-plugin-jsx-a11y": {
- "version": "6.6.1",
- "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.6.1.tgz",
- "integrity": "sha512-sXgFVNHiWffBq23uiS/JaP6eVR622DqwB4yTzKvGZGcPq6/yZ3WmOZfuBks/vHWo9GaFOqC2ZK4i6+C35knx7Q==",
+ "version": "6.7.1",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.7.1.tgz",
+ "integrity": "sha512-63Bog4iIethyo8smBklORknVjB0T2dwB8Mr/hIC+fBS0uyHdYYpzM/Ed+YC8VxTjlXHEWFOdmgwcDn1U2L9VCA==",
"dev": true,
"requires": {
- "@babel/runtime": "^7.18.9",
- "aria-query": "^4.2.2",
- "array-includes": "^3.1.5",
+ "@babel/runtime": "^7.20.7",
+ "aria-query": "^5.1.3",
+ "array-includes": "^3.1.6",
+ "array.prototype.flatmap": "^1.3.1",
"ast-types-flow": "^0.0.7",
- "axe-core": "^4.4.3",
- "axobject-query": "^2.2.0",
+ "axe-core": "^4.6.2",
+ "axobject-query": "^3.1.1",
"damerau-levenshtein": "^1.0.8",
"emoji-regex": "^9.2.2",
"has": "^1.0.3",
- "jsx-ast-utils": "^3.3.2",
- "language-tags": "^1.0.5",
+ "jsx-ast-utils": "^3.3.3",
+ "language-tags": "=1.0.5",
"minimatch": "^3.1.2",
+ "object.entries": "^1.1.6",
+ "object.fromentries": "^2.0.6",
"semver": "^6.3.0"
},
"dependencies": {
@@ -10490,10 +11102,19 @@
}
}
},
+ "eslint-plugin-prettier": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz",
+ "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==",
+ "dev": true,
+ "requires": {
+ "prettier-linter-helpers": "^1.0.0"
+ }
+ },
"eslint-plugin-react": {
- "version": "7.31.11",
- "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.31.11.tgz",
- "integrity": "sha512-TTvq5JsT5v56wPa9OYHzsrOlHzKZKjV+aLgS+55NJP/cuzdiQPC7PfYoUjMoxlffKtvijpk7vA/jmuqRb9nohw==",
+ "version": "7.32.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.32.0.tgz",
+ "integrity": "sha512-vSBi1+SrPiLZCGvxpiZIa28fMEUaMjXtCplrvxcIxGzmFiYdsXQDwInEjuv5/i/2CTTxbkS87tE8lsQ0Qxinbw==",
"dev": true,
"requires": {
"array-includes": "^3.1.6",
@@ -10508,7 +11129,7 @@
"object.hasown": "^1.1.2",
"object.values": "^1.1.6",
"prop-types": "^15.8.1",
- "resolve": "^2.0.0-next.3",
+ "resolve": "^2.0.0-next.4",
"semver": "^6.3.0",
"string.prototype.matchall": "^4.0.8"
},
@@ -10671,6 +11292,12 @@
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
"dev": true
},
+ "fast-diff": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz",
+ "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==",
+ "dev": true
+ },
"fast-glob": {
"version": "3.2.11",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz",
@@ -10780,6 +11407,15 @@
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.1.tgz",
"integrity": "sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA=="
},
+ "for-each": {
+ "version": "0.3.3",
+ "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz",
+ "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==",
+ "dev": true,
+ "requires": {
+ "is-callable": "^1.1.3"
+ }
+ },
"form-data": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
@@ -10939,6 +11575,15 @@
"integrity": "sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==",
"dev": true
},
+ "gopd": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
+ "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
+ "dev": true,
+ "requires": {
+ "get-intrinsic": "^1.1.3"
+ }
+ },
"graceful-fs": {
"version": "4.2.10",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
@@ -11161,16 +11806,37 @@
"integrity": "sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q=="
},
"internal-slot": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz",
- "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==",
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.4.tgz",
+ "integrity": "sha512-tA8URYccNzMo94s5MQZgH8NB/XTa6HsOo0MLfXTKKEnHVVdegzaQoFZ7Jp44bdvLvY2waT5dc+j5ICEswhi7UQ==",
"dev": true,
"requires": {
- "get-intrinsic": "^1.1.0",
+ "get-intrinsic": "^1.1.3",
"has": "^1.0.3",
"side-channel": "^1.0.4"
}
},
+ "is-arguments": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz",
+ "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.2",
+ "has-tostringtag": "^1.0.0"
+ }
+ },
+ "is-array-buffer": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.1.tgz",
+ "integrity": "sha512-ASfLknmY8Xa2XtB4wmbz13Wu202baeA18cJBCeCy0wXUHZF0IPyVEXqKEcd+t2fNSLLL1vC6k7lxZEojNbISXQ==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.2",
+ "get-intrinsic": "^1.1.3",
+ "is-typed-array": "^1.1.10"
+ }
+ },
"is-arrayish": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz",
@@ -11258,6 +11924,12 @@
"is-extglob": "^2.1.1"
}
},
+ "is-map": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz",
+ "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==",
+ "dev": true
+ },
"is-negative-zero": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz",
@@ -11300,6 +11972,12 @@
"has-tostringtag": "^1.0.0"
}
},
+ "is-set": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz",
+ "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==",
+ "dev": true
+ },
"is-shared-array-buffer": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz",
@@ -11327,6 +12005,25 @@
"has-symbols": "^1.0.2"
}
},
+ "is-typed-array": {
+ "version": "1.1.10",
+ "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz",
+ "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==",
+ "dev": true,
+ "requires": {
+ "available-typed-arrays": "^1.0.5",
+ "call-bind": "^1.0.2",
+ "for-each": "^0.3.3",
+ "gopd": "^1.0.1",
+ "has-tostringtag": "^1.0.0"
+ }
+ },
+ "is-weakmap": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz",
+ "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==",
+ "dev": true
+ },
"is-weakref": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz",
@@ -11336,6 +12033,16 @@
"call-bind": "^1.0.2"
}
},
+ "is-weakset": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz",
+ "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.2",
+ "get-intrinsic": "^1.1.1"
+ }
+ },
"is-wsl": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
@@ -12064,6 +12771,16 @@
"integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==",
"dev": true
},
+ "object-is": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz",
+ "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==",
+ "dev": true,
+ "requires": {
+ "call-bind": "^1.0.2",
+ "define-properties": "^1.1.3"
+ }
+ },
"object-keys": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/object-keys/-/object-keys-0.4.0.tgz",
@@ -12359,6 +13076,21 @@
"integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
"dev": true
},
+ "prettier": {
+ "version": "2.8.3",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.3.tgz",
+ "integrity": "sha512-tJ/oJ4amDihPoufT5sM0Z1SKEuKay8LfVAMlbbhnnkvt6BUserZylqo2PN+p9KeljLr0OHa2rXHU1T8reeoTrw==",
+ "dev": true
+ },
+ "prettier-linter-helpers": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz",
+ "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==",
+ "dev": true,
+ "requires": {
+ "fast-diff": "^1.1.2"
+ }
+ },
"process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
@@ -12389,9 +13121,9 @@
}
},
"punycode": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
- "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.2.0.tgz",
+ "integrity": "sha512-LN6QV1IJ9ZhxWTNdktaPClrNfp8xdSAYS0Zk2ddX7XsXZAxckMHPCBcHRo0cTcEIgYPRiGEkmji3Idkh2yFtYw==",
"dev": true
},
"query-string": {
@@ -12993,6 +13725,15 @@
"integrity": "sha512-EeNzTVfj+1In7aSLPKDD03F/ly4RxEuF/EX0YcOG0cKoPXs+SLZxDawQbexQDBzwROs4VKLWTOaZQlZkGBFEIQ==",
"optional": true
},
+ "stop-iteration-iterator": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.0.0.tgz",
+ "integrity": "sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==",
+ "dev": true,
+ "requires": {
+ "internal-slot": "^1.0.4"
+ }
+ },
"strict-uri-encode": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz",
@@ -13587,6 +14328,32 @@
"is-symbol": "^1.0.3"
}
},
+ "which-collection": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz",
+ "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==",
+ "dev": true,
+ "requires": {
+ "is-map": "^2.0.1",
+ "is-set": "^2.0.1",
+ "is-weakmap": "^2.0.1",
+ "is-weakset": "^2.0.1"
+ }
+ },
+ "which-typed-array": {
+ "version": "1.1.9",
+ "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.9.tgz",
+ "integrity": "sha512-w9c4xkx6mPidwp7180ckYWfMmvxpjlZuIudNtDf4N/tTAUB8VJbX25qZoAsrtGuYNnGw3pa0AXgbGKRB8/EceA==",
+ "dev": true,
+ "requires": {
+ "available-typed-arrays": "^1.0.5",
+ "call-bind": "^1.0.2",
+ "for-each": "^0.3.3",
+ "gopd": "^1.0.1",
+ "has-tostringtag": "^1.0.0",
+ "is-typed-array": "^1.1.10"
+ }
+ },
"word-wrap": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
@@ -13619,78 +14386,6 @@
"resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
"integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
"dev": true
- },
- "@next/swc-android-arm-eabi": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-android-arm-eabi/-/swc-android-arm-eabi-12.3.4.tgz",
- "integrity": "sha512-cM42Cw6V4Bz/2+j/xIzO8nK/Q3Ly+VSlZJTa1vHzsocJRYz8KT6MrreXaci2++SIZCF1rVRCDgAg5PpqRibdIA==",
- "optional": true
- },
- "@next/swc-android-arm64": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-android-arm64/-/swc-android-arm64-12.3.4.tgz",
- "integrity": "sha512-5jf0dTBjL+rabWjGj3eghpLUxCukRhBcEJgwLedewEA/LJk2HyqCvGIwj5rH+iwmq1llCWbOky2dO3pVljrapg==",
- "optional": true
- },
- "@next/swc-darwin-arm64": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-12.3.4.tgz",
- "integrity": "sha512-DqsSTd3FRjQUR6ao0E1e2OlOcrF5br+uegcEGPVonKYJpcr0MJrtYmPxd4v5T6UCJZ+XzydF7eQo5wdGvSZAyA==",
- "optional": true
- },
- "@next/swc-freebsd-x64": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-12.3.4.tgz",
- "integrity": "sha512-KM9JXRXi/U2PUM928z7l4tnfQ9u8bTco/jb939pdFUHqc28V43Ohd31MmZD1QzEK4aFlMRaIBQOWQZh4D/E5lQ==",
- "optional": true
- },
- "@next/swc-linux-arm-gnueabihf": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-arm-gnueabihf/-/swc-linux-arm-gnueabihf-12.3.4.tgz",
- "integrity": "sha512-3zqD3pO+z5CZyxtKDTnOJ2XgFFRUBciOox6EWkoZvJfc9zcidNAQxuwonUeNts6Xbm8Wtm5YGIRC0x+12YH7kw==",
- "optional": true
- },
- "@next/swc-linux-arm64-gnu": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-12.3.4.tgz",
- "integrity": "sha512-kiX0vgJGMZVv+oo1QuObaYulXNvdH/IINmvdZnVzMO/jic/B8EEIGlZ8Bgvw8LCjH3zNVPO3mGrdMvnEEPEhKA==",
- "optional": true
- },
- "@next/swc-linux-arm64-musl": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-12.3.4.tgz",
- "integrity": "sha512-EETZPa1juczrKLWk5okoW2hv7D7WvonU+Cf2CgsSoxgsYbUCZ1voOpL4JZTOb6IbKMDo6ja+SbY0vzXZBUMvkQ==",
- "optional": true
- },
- "@next/swc-linux-x64-gnu": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-12.3.4.tgz",
- "integrity": "sha512-4csPbRbfZbuWOk3ATyWcvVFdD9/Rsdq5YHKvRuEni68OCLkfy4f+4I9OBpyK1SKJ00Cih16NJbHE+k+ljPPpag==",
- "optional": true
- },
- "@next/swc-linux-x64-musl": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-12.3.4.tgz",
- "integrity": "sha512-YeBmI+63Ro75SUiL/QXEVXQ19T++58aI/IINOyhpsRL1LKdyfK/35iilraZEFz9bLQrwy1LYAR5lK200A9Gjbg==",
- "optional": true
- },
- "@next/swc-win32-arm64-msvc": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-12.3.4.tgz",
- "integrity": "sha512-Sd0qFUJv8Tj0PukAYbCCDbmXcMkbIuhnTeHm9m4ZGjCf6kt7E/RMs55Pd3R5ePjOkN7dJEuxYBehawTR/aPDSQ==",
- "optional": true
- },
- "@next/swc-win32-ia32-msvc": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-12.3.4.tgz",
- "integrity": "sha512-rt/vv/vg/ZGGkrkKcuJ0LyliRdbskQU+91bje+PgoYmxTZf/tYs6IfbmgudBJk6gH3QnjHWbkphDdRQrseRefQ==",
- "optional": true
- },
- "@next/swc-win32-x64-msvc": {
- "version": "12.3.4",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-12.3.4.tgz",
- "integrity": "sha512-DQ20JEfTBZAgF8QCjYfJhv2/279M6onxFjdG/+5B0Cyj00/EdBxiWb2eGGFgQhrBbNv/lsvzFbbi0Ptf8Vw/bg==",
- "optional": true
}
}
}
diff --git a/frontend/package.json b/frontend/package.json
index 579aaa0963..98c10a84c3 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -6,7 +6,7 @@
"build": "next build",
"start": "next start",
"start:docker": "next build && next start",
- "lint": "next lint",
+ "lint": "eslint --fix --ext js,ts,tsx ./src",
"type-check": "tsc --project tsconfig.json"
},
"dependencies": {
@@ -62,14 +62,23 @@
"@types/jsrp": "^0.2.4",
"@types/node": "18.11.9",
"@types/react": "^18.0.26",
- "@typescript-eslint/eslint-plugin": "^5.45.0",
+ "@typescript-eslint/eslint-plugin": "^5.48.1",
"@typescript-eslint/parser": "^5.45.0",
"autoprefixer": "^10.4.7",
- "eslint": "^8.29.0",
+ "eslint": "^8.32.0",
+ "eslint-config-airbnb": "^19.0.4",
+ "eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-next": "^13.0.5",
+ "eslint-config-prettier": "^8.6.0",
"eslint-import-resolver-typescript": "^3.5.2",
+ "eslint-plugin-import": "^2.27.4",
+ "eslint-plugin-jsx-a11y": "^6.7.1",
+ "eslint-plugin-prettier": "^4.2.1",
+ "eslint-plugin-react": "^7.32.0",
+ "eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^8.0.0",
"postcss": "^8.4.14",
+ "prettier": "^2.8.3",
"tailwindcss": "^3.1.4",
"typescript": "^4.9.3"
}
diff --git a/frontend/src/components/RouteGuard.tsx b/frontend/src/components/RouteGuard.tsx
index 9b87411463..a1154ee5c1 100644
--- a/frontend/src/components/RouteGuard.tsx
+++ b/frontend/src/components/RouteGuard.tsx
@@ -1,8 +1,7 @@
import { ReactNode, useEffect, useState } from 'react';
import { useRouter } from 'next/router';
-
-import { publicPaths } from '~/const';
-import checkAuth from '~/pages/api/auth/CheckAuth';
+import { publicPaths } from '@app/const';
+import checkAuth from '@app/pages/api/auth/CheckAuth';
// #TODO: finish spinner only when the data loads fully
// #TODO: Redirect somewhere if the page does not exist
@@ -13,39 +12,15 @@ type Prop = {
export default function RouteGuard({ children }: Prop): JSX.Element {
const router = useRouter();
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
const [authorized, setAuthorized] = useState(false);
- useEffect(() => {
- // on initial load - run auth check
- (async () => {
- await authCheck(router.asPath);
- })();
-
- // on route change start - hide page content by setting authorized to false
- // #TODO: add the loading page when not yet authorized.
- const hideContent = () => setAuthorized(false);
- // const onError = () => setAuthorized(true)
- router.events.on('routeChangeStart', hideContent);
- // router.events.on("routeChangeError", onError);
-
- // on route change complete - run auth check
- router.events.on('routeChangeComplete', authCheck);
-
- // unsubscribe from events in useEffect return function
- return () => {
- router.events.off('routeChangeStart', hideContent);
- router.events.off('routeChangeComplete', authCheck);
- // router.events.off("routeChangeError", onError);
- };
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, []);
-
/**
* redirect to login page if accessing a private page and not logged in
*/
async function authCheck(url: string) {
// Make sure that we don't redirect when the user is on the following pages.
- const path = '/' + url.split('?')[0].split('/')[1];
+ const path = `/${url.split('?')[0].split('/')[1]}`;
// Check if the user is authenticated
const response = await checkAuth();
@@ -62,13 +37,35 @@ export default function RouteGuard({ children }: Prop): JSX.Element {
console.log('Authorized to access.');
}
} catch (error) {
- console.log(
- 'Error (probably the authCheck route is stuck again...):',
- error
- );
+ console.log('Error (probably the authCheck route is stuck again...):', error);
}
}
}
+ useEffect(() => {
+ // on initial load - run auth check
+ (async () => {
+ await authCheck(router.asPath);
+ })();
+
+ // on route change start - hide page content by setting authorized to false
+ // #TODO: add the loading page when not yet authorized.
+ const hideContent = () => setAuthorized(false);
+ // const onError = () => setAuthorized(true)
+ router.events.on('routeChangeStart', hideContent);
+ // router.events.on("routeChangeError", onError);
+
+ // on route change complete - run auth check
+ router.events.on('routeChangeComplete', authCheck);
+
+ // unsubscribe from events in useEffect return function
+ return () => {
+ router.events.off('routeChangeStart', hideContent);
+ router.events.off('routeChangeComplete', authCheck);
+ // router.events.off("routeChangeError", onError);
+ };
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
return children as JSX.Element;
}
diff --git a/frontend/src/components/analytics/posthog.ts b/frontend/src/components/analytics/posthog.ts
index 8482eeb06e..aa6abf4636 100644
--- a/frontend/src/components/analytics/posthog.ts
+++ b/frontend/src/components/analytics/posthog.ts
@@ -8,7 +8,7 @@ export const initPostHog = () => {
try {
if (typeof window !== 'undefined') {
// @ts-ignore
- if (ENV == 'production' && TELEMETRY_CAPTURING_ENABLED) {
+ if (ENV === 'production' && TELEMETRY_CAPTURING_ENABLED) {
posthog.init(POSTHOG_API_KEY, {
api_host: POSTHOG_HOST
});
@@ -19,4 +19,6 @@ export const initPostHog = () => {
} catch (e) {
console.log("posthog err", e)
}
+
+ return undefined;
};
diff --git a/frontend/src/components/basic/Error.tsx b/frontend/src/components/basic/Error.tsx
index e4a3de366c..ab79fb24d2 100644
--- a/frontend/src/components/basic/Error.tsx
+++ b/frontend/src/components/basic/Error.tsx
@@ -1,16 +1,13 @@
import { faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-export default function Error({ text }: { text: string }): JSX.Element {
+const Error = ({ text }: { text: string }): JSX.Element => {
return (
- <div className='relative flex flex-row justify-center m-auto items-center w-fit rounded-full'>
- <FontAwesomeIcon
- icon={faExclamationTriangle}
- className='text-red mt-1.5 mb-2 mx-2'
- />
- {text && (
- <p className='relative top-0 text-red mr-2 text-sm py-1'>{text}</p>
- )}
+ <div className="relative flex flex-row justify-center m-auto items-center w-fit rounded-full">
+ <FontAwesomeIcon icon={faExclamationTriangle} className="text-red mt-1.5 mb-2 mx-2" />
+ {text && <p className="relative top-0 text-red mr-2 text-sm py-1">{text}</p>}
</div>
);
-}
+};
+
+export default Error;
diff --git a/frontend/src/components/basic/EventFilter.tsx b/frontend/src/components/basic/EventFilter.tsx
index dc5ffe109b..02a6705c61 100644
--- a/frontend/src/components/basic/EventFilter.tsx
+++ b/frontend/src/components/basic/EventFilter.tsx
@@ -1,6 +1,5 @@
-import React from 'react';
-import { Fragment } from 'react';
-import { useTranslation } from "next-i18next";
+import React, { Fragment } from 'react';
+import { useTranslation } from 'next-i18next';
import {
faAngleDown,
faEye,
@@ -42,27 +41,20 @@ const eventOptions = [
* @param {string} obj.selected - the event that is currently selected
* @param {function} obj.select - an action that happens when an item is selected
*/
-export default function EventFilter({
- selected,
- select
-}: ListBoxProps): JSX.Element {
+const EventFilter = ({ selected, select }: ListBoxProps): JSX.Element => {
const { t } = useTranslation();
return (
- <Listbox value={t("activity:event." + selected)} onChange={select}>
+ <Listbox value={t(`activity:event.${selected}`)} onChange={select}>
<div className="relative">
<Listbox.Button className="bg-mineshaft-800 hover:bg-mineshaft-700 duration-200 cursor-pointer rounded-md h-10 flex items-center justify-between pl-4 pr-2 w-52 text-bunker-200 text-sm">
- {selected != '' ? (
- <p className="select-none text-bunker-100">{t("activity:event." + selected)}</p>
+ {selected !== '' ? (
+ <p className="select-none text-bunker-100">{t(`activity:event.${selected}`)}</p>
) : (
- <p className="select-none">{String(t("common:select-event"))}</p>
+ <p className="select-none">{String(t('common:select-event'))}</p>
)}
- {selected != '' ? (
- <FontAwesomeIcon
- icon={faX}
- className="pl-2 w-2 p-2"
- onClick={() => select('')}
- />
+ {selected !== '' ? (
+ <FontAwesomeIcon icon={faX} className="pl-2 w-2 p-2" onClick={() => select('')} />
) : (
<FontAwesomeIcon icon={faAngleDown} className="pl-4 pr-2" />
)}
@@ -74,33 +66,29 @@ export default function EventFilter({
leaveTo="opacity-0"
>
<Listbox.Options className="border border-mineshaft-700 z-50 w-52 p-1 absolute mt-1 max-h-60 overflow-auto rounded-md bg-bunker text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm">
- {eventOptions.map((event, id) => {
- return (
- <Listbox.Option
- key={id}
- className={`px-4 h-10 flex items-center text-sm cursor-pointer hover:bg-mineshaft-700 text-bunker-200 rounded-md ${
- selected == t("activity:event." + event.name) && 'bg-mineshaft-700'
- }`}
- value={event.name}
- >
- {({ selected }) => (
- <>
- <span
- className={`block truncate ${
- selected ? 'font-semibold' : 'font-normal'
- }`}
- >
- <FontAwesomeIcon icon={event.icon} className="pr-4" />{' '}
- {t("activity:event." + event.name)}
- </span>
- </>
- )}
- </Listbox.Option>
- );
- })}
+ {eventOptions.map((event, id) => (
+ <Listbox.Option
+ key={`${event.name}.${id + 1}`}
+ className={`px-4 h-10 flex items-center text-sm cursor-pointer hover:bg-mineshaft-700 text-bunker-200 rounded-md ${
+ selected === t(`activity:event.${event.name}`) && 'bg-mineshaft-700'
+ }`}
+ value={event.name}
+ >
+ {({ selected: isSelected }) => (
+ <span
+ className={`block truncate ${isSelected ? 'font-semibold' : 'font-normal'}`}
+ >
+ <FontAwesomeIcon icon={event.icon} className="pr-4" />{' '}
+ {t(`activity:event.${event.name}`)}
+ </span>
+ )}
+ </Listbox.Option>
+ ))}
</Listbox.Options>
</Transition>
</div>
</Listbox>
);
-}
+};
+
+export default EventFilter;
diff --git a/frontend/src/components/basic/InputField.tsx b/frontend/src/components/basic/InputField.tsx
index 9d4a245ffc..a8ad953a44 100644
--- a/frontend/src/components/basic/InputField.tsx
+++ b/frontend/src/components/basic/InputField.tsx
@@ -5,13 +5,12 @@ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import guidGenerator from '../utilities/randomId';
interface InputFieldProps {
- static?: boolean;
+ isStatic?: boolean;
label: string;
type: string;
value: string;
placeholder?: string;
isRequired: boolean;
- disabled?: boolean;
error?: boolean;
text?: string;
name?: string;
@@ -20,46 +19,54 @@ interface InputFieldProps {
onChangeHandler: (value: string) => void;
}
-const InputField = (
- props: InputFieldProps &
- Pick<JSX.IntrinsicElements['input'], 'autoComplete' | 'id'>
-) => {
+const InputField = ({
+ isRequired,
+ label,
+ onChangeHandler,
+ type,
+ value,
+ autoComplete,
+ blurred,
+ error,
+ errorText,
+ id,
+ name,
+ placeholder,
+ isStatic,
+ text
+}: InputFieldProps & Pick<JSX.IntrinsicElements['input'], 'autoComplete' | 'id'>) => {
const [passwordVisible, setPasswordVisible] = useState(false);
- if (props.static === true) {
+ if (isStatic === true) {
return (
- <div className='flex flex-col my-2 md:my-4 justify-center w-full max-w-md'>
- <p className='text-sm font-semibold text-gray-400 mb-0.5'>
- {props.label}
- </p>
- {props.text && (
- <p className='text-xs text-gray-400 mb-2'>{props.text}</p>
- )}
+ <div className="flex flex-col my-2 md:my-4 justify-center w-full max-w-md">
+ <p className="text-sm font-semibold text-gray-400 mb-0.5">{label}</p>
+ {text && <p className="text-xs text-gray-400 mb-2">{text}</p>}
<input
- onChange={(e) => props.onChangeHandler(e.target.value)}
- type={props.type}
- placeholder={props.placeholder}
- value={props.value}
- required={props.isRequired}
- className='bg-bunker-800 text-gray-400 border border-gray-600 rounded-md text-md p-2 w-full min-w-16 outline-none'
- name={props.name}
+ onChange={(e) => onChangeHandler(e.target.value)}
+ type={type}
+ placeholder={placeholder}
+ value={value}
+ required={isRequired}
+ className="bg-bunker-800 text-gray-400 border border-gray-600 rounded-md text-md p-2 w-full min-w-16 outline-none"
+ name={name}
readOnly
- autoComplete={props.autoComplete}
- id={props.id}
+ autoComplete={autoComplete}
+ id={id}
/>
</div>
);
- } else {
- return (
- <div className='flex-col w-full'>
- <div className='flex flex-row text-mineshaft-300 items-center mb-0.5'>
- <p className='text-sm font-semibold mr-1'>{props.label}</p>
- {/* {props.label == "Password" && router.asPath != "/login" && (
+ }
+ return (
+ <div className="flex-col w-full">
+ <div className="flex flex-row text-mineshaft-300 items-center mb-0.5">
+ <p className="text-sm font-semibold mr-1">{label}</p>
+ {/* {label === "Password" && router.asPath !== "/login" && (
<div className="mb-0.5 relative inline-block text-gray-400 underline hover:text-primary duration-200">
<FontAwesomeIcon
icon={faCircleExclamation}
className={`text-sm peer ${
- props.error && "text-red"
+ error && "text-red"
}`}
/>
<span className="absolute hidden peer-hover:block duration-200 w-60 -left-28 -top-2 -translate-y-full px-2 py-2 bg-gray-700 rounded-md text-center text-gray-200 text-sm after:content-[''] after:absolute after:left-1/2 after:top-[100%] after:-translate-x-1/2 after:border-8 after:border-x-transparent after:border-b-transparent after:border-t-gray-700">
@@ -70,74 +77,69 @@ const InputField = (
</span>
</div>
)} */}
- </div>
- <div
- className={`group relative flex flex-col justify-center w-full max-w-2xl border ${
- props.error ? 'border-red' : 'border-mineshaft-500'
- } rounded-md`}
- >
- <input
- onChange={(e) => props.onChangeHandler(e.target.value)}
- type={passwordVisible === false ? props.type : 'text'}
- placeholder={props.placeholder}
- value={props.value}
- required={props.isRequired}
- className={`${
- props.blurred
- ? 'text-bunker-800 group-hover:text-gray-400 focus:text-gray-400 active:text-gray-400'
- : ''
- } ${
- props.error ? 'focus:ring-red/50' : 'focus:ring-primary/50'
- } relative peer bg-bunker-800 rounded-md text-gray-400 text-md p-2 w-full min-w-16 outline-none focus:ring-4 duration-200`}
- name={props.name}
- spellCheck='false'
- autoComplete={props.autoComplete}
- id={props.id}
- />
- {props.label?.includes('Password') && (
- <button
- type='button'
- onClick={() => {
- setPasswordVisible(!passwordVisible);
- }}
- className='absolute self-end mr-3 text-gray-400 cursor-pointer'
- >
- {passwordVisible ? (
- <FontAwesomeIcon icon={faEyeSlash} />
- ) : (
- <FontAwesomeIcon icon={faEye} />
- )}
- </button>
- )}
- {props.blurred && (
- <div className='peer group-hover:hidden peer-hover:hidden peer-focus:hidden peer-active:invisible absolute h-10 w-fit max-w-xl rounded-md flex items-center text-gray-400/50 text-clip overflow-hidden'>
- <p className='ml-2'></p>
- {props.value
- .split('')
- .slice(0, 54)
- .map(() => (
- <FontAwesomeIcon
- key={guidGenerator()}
- className='text-xxs mx-0.5'
- icon={faCircle}
- />
- ))}
- </div>
- )}
- {/* {props.error && (
+ </div>
+ <div
+ className={`group relative flex flex-col justify-center w-full max-w-2xl border ${
+ error ? 'border-red' : 'border-mineshaft-500'
+ } rounded-md`}
+ >
+ <input
+ onChange={(e) => onChangeHandler(e.target.value)}
+ type={passwordVisible === false ? type : 'text'}
+ placeholder={placeholder}
+ value={value}
+ required={isRequired}
+ className={`${
+ blurred
+ ? 'text-bunker-800 group-hover:text-gray-400 focus:text-gray-400 active:text-gray-400'
+ : ''
+ } ${
+ error ? 'focus:ring-red/50' : 'focus:ring-primary/50'
+ } relative peer bg-bunker-800 rounded-md text-gray-400 text-md p-2 w-full min-w-16 outline-none focus:ring-4 duration-200`}
+ name={name}
+ spellCheck="false"
+ autoComplete={autoComplete}
+ id={id}
+ />
+ {label?.includes('Password') && (
+ <button
+ type="button"
+ onClick={() => {
+ setPasswordVisible(!passwordVisible);
+ }}
+ className="absolute self-end mr-3 text-gray-400 cursor-pointer"
+ >
+ {passwordVisible ? (
+ <FontAwesomeIcon icon={faEyeSlash} />
+ ) : (
+ <FontAwesomeIcon icon={faEye} />
+ )}
+ </button>
+ )}
+ {blurred && (
+ <div className="peer group-hover:hidden peer-hover:hidden peer-focus:hidden peer-active:invisible absolute h-10 w-fit max-w-xl rounded-md flex items-center text-gray-400/50 text-clip overflow-hidden">
+ <p className="ml-2" />
+ {value
+ .split('')
+ .slice(0, 54)
+ .map(() => (
+ <FontAwesomeIcon
+ key={guidGenerator()}
+ className="text-xxs mx-0.5"
+ icon={faCircle}
+ />
+ ))}
+ </div>
+ )}
+ {/* {error && (
<div className="absolute z-20 flex items-end justify-end mt-4 mr-1.5 self-end">
<Error />
</div>
)} */}
- </div>
- {props.error && (
- <p className='text-red text-xs mt-0.5 mx-0 mb-2 max-w-xs'>
- {props.errorText}
- </p>
- )}
</div>
- );
- }
+ {error && <p className="text-red text-xs mt-0.5 mx-0 mb-2 max-w-xs">{errorText}</p>}
+ </div>
+ );
};
export default memo(InputField);
diff --git a/frontend/src/components/basic/Layout.tsx b/frontend/src/components/basic/Layout.tsx
index 216b3ecc34..3ccd80afe7 100644
--- a/frontend/src/components/basic/Layout.tsx
+++ b/frontend/src/components/basic/Layout.tsx
@@ -1,9 +1,20 @@
+/* eslint-disable no-nested-ternary */
/* eslint-disable no-unexpected-multiline */
/* eslint-disable react-hooks/exhaustive-deps */
-import { useEffect, useMemo, useState } from "react";
-import Link from "next/link";
-import { useRouter } from "next/router";
-import { useTranslation } from "next-i18next";
+import crypto from 'crypto';
+
+import { useEffect, useMemo, useState } from 'react';
+import Link from 'next/link';
+import { useRouter } from 'next/router';
+import { useTranslation } from 'next-i18next';
+import getOrganizations from '@app/pages/api/organization/getOrgs';
+import getOrganizationUserProjects from '@app/pages/api/organization/GetOrgUserProjects';
+import getOrganizationUsers from '@app/pages/api/organization/GetOrgUsers';
+import getUser from '@app/pages/api/user/getUser';
+import addUserToWorkspace from '@app/pages/api/workspace/addUserToWorkspace';
+import createWorkspace from '@app/pages/api/workspace/createWorkspace';
+import getWorkspaces from '@app/pages/api/workspace/getWorkspaces';
+import uploadKeys from '@app/pages/api/workspace/uploadKeys';
import {
faBookOpen,
faFileLines,
@@ -11,56 +22,42 @@ import {
faKey,
faMobile,
faPlug,
- faUser,
-} from "@fortawesome/free-solid-svg-icons";
-import { faPlus } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-
-import getOrganizations from "~/pages/api/organization/getOrgs";
-import getOrganizationUserProjects from "~/pages/api/organization/GetOrgUserProjects";
-import getOrganizationUsers from "~/pages/api/organization/GetOrgUsers";
-import getUser from "~/pages/api/user/getUser";
-import addUserToWorkspace from "~/pages/api/workspace/addUserToWorkspace";
-import createWorkspace from "~/pages/api/workspace/createWorkspace";
-import getWorkspaces from "~/pages/api/workspace/getWorkspaces";
-import uploadKeys from "~/pages/api/workspace/uploadKeys";
+ faPlus,
+ faUser
+} from '@fortawesome/free-solid-svg-icons';
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import NavBarDashboard from "../navigation/NavBarDashboard";
-import onboardingCheck from "../utilities/checks/OnboardingCheck";
-import { tempLocalStorage } from "../utilities/checks/tempLocalStorage";
-import {
- decryptAssymmetric,
- encryptAssymmetric,
-} from "../utilities/cryptography/crypto";
-import Button from "./buttons/Button";
-import AddWorkspaceDialog from "./dialog/AddWorkspaceDialog";
-import Listbox from "./Listbox";
+import NavBarDashboard from '../navigation/NavBarDashboard';
+import onboardingCheck from '../utilities/checks/OnboardingCheck';
+import { tempLocalStorage } from '../utilities/checks/tempLocalStorage';
+import { decryptAssymmetric, encryptAssymmetric } from '../utilities/cryptography/crypto';
+import Button from './buttons/Button';
+import AddWorkspaceDialog from './dialog/AddWorkspaceDialog';
+import Listbox from './Listbox';
interface LayoutProps {
children: React.ReactNode;
}
-const crypto = require("crypto");
-export default function Layout({ children }: LayoutProps) {
+const Layout = ({ children }: LayoutProps) => {
const router = useRouter();
const [workspaceMapping, setWorkspaceMapping] = useState<Map<string, string>[]>([]);
- const [workspaceSelected, setWorkspaceSelected] = useState("∞");
- const [newWorkspaceName, setNewWorkspaceName] = useState("");
+ const [workspaceSelected, setWorkspaceSelected] = useState('∞');
+ const [newWorkspaceName, setNewWorkspaceName] = useState('');
const [isOpen, setIsOpen] = useState(false);
const [loading, setLoading] = useState(false);
const [error, setError] = useState(false);
- const [totalOnboardingActionsDone, setTotalOnboardingActionsDone] =
- useState(0);
+ const [totalOnboardingActionsDone, setTotalOnboardingActionsDone] = useState(0);
const { t } = useTranslation();
- function closeModal() {
+ const closeModal = () => {
setIsOpen(false);
- }
+ };
- function openModal() {
+ const openModal = () => {
setIsOpen(true);
- }
+ };
// TODO: what to do about the fact that 2ids can have the same name
@@ -68,7 +65,7 @@ export default function Layout({ children }: LayoutProps) {
* When a user creates a new workspace, redirect them to the page of the new workspace.
* @param {*} workspaceName
*/
- async function submitModal(workspaceName: string, addAllUsers: boolean) {
+ const submitModal = async (workspaceName: string, addAllUsers: boolean) => {
setLoading(true);
// timeout code.
setTimeout(() => setLoading(false), 1500);
@@ -79,62 +76,49 @@ export default function Layout({ children }: LayoutProps) {
if (!currentWorkspaces.includes(workspaceName)) {
const newWorkspace = await createWorkspace({
workspaceName,
- organizationId: tempLocalStorage("orgData.id"),
+ organizationId: tempLocalStorage('orgData.id')
});
const newWorkspaceId = newWorkspace._id;
- const randomBytes = crypto.randomBytes(16).toString("hex");
- const PRIVATE_KEY = String(localStorage.getItem("PRIVATE_KEY"));
+ const randomBytes = crypto.randomBytes(16).toString('hex');
+ const PRIVATE_KEY = String(localStorage.getItem('PRIVATE_KEY'));
const myUser = await getUser();
const { ciphertext, nonce } = encryptAssymmetric({
plaintext: randomBytes,
publicKey: myUser.publicKey,
- privateKey: PRIVATE_KEY,
- }) as { ciphertext: string; nonce: string };
+ privateKey: PRIVATE_KEY
+ });
- await uploadKeys(
- newWorkspaceId,
- myUser._id,
- ciphertext,
- nonce
- );
+ await uploadKeys(newWorkspaceId, myUser._id, ciphertext, nonce);
if (addAllUsers) {
- console.log('adding other users')
+ console.log('adding other users');
const orgUsers = await getOrganizationUsers({
- orgId: tempLocalStorage("orgData.id"),
+ orgId: tempLocalStorage('orgData.id')
});
orgUsers.map(async (user: any) => {
- if (user.status == "accepted" && user.email != myUser.email) {
- const result = await addUserToWorkspace(
- user.user.email,
- newWorkspaceId
- );
+ if (user.status === 'accepted' && user.email !== myUser.email) {
+ const result = await addUserToWorkspace(user.user.email, newWorkspaceId);
if (result?.invitee && result?.latestKey) {
- const PRIVATE_KEY = tempLocalStorage("PRIVATE_KEY");
+ const TEMP_PRIVATE_KEY = tempLocalStorage('PRIVATE_KEY');
// assymmetrically decrypt symmetric key with local private key
const key = decryptAssymmetric({
ciphertext: result.latestKey.encryptedKey,
nonce: result.latestKey.nonce,
publicKey: result.latestKey.sender.publicKey,
- privateKey: PRIVATE_KEY,
+ privateKey: TEMP_PRIVATE_KEY
});
- const { ciphertext, nonce } = encryptAssymmetric({
+ const { ciphertext: inviteeCipherText, nonce: inviteeNonce } = encryptAssymmetric({
plaintext: key,
publicKey: result.invitee.publicKey,
- privateKey: PRIVATE_KEY,
- }) as { ciphertext: string; nonce: string };
+ privateKey: PRIVATE_KEY
+ });
- uploadKeys(
- newWorkspaceId,
- result.invitee._id,
- ciphertext,
- nonce
- );
+ uploadKeys(newWorkspaceId, result.invitee._id, inviteeCipherText, inviteeNonce);
}
}
});
@@ -142,12 +126,12 @@ export default function Layout({ children }: LayoutProps) {
setWorkspaceMapping((prevState) => ({
...prevState,
[workspaceName]: newWorkspaceId
- }))
+ }));
setWorkspaceSelected(workspaceName);
setIsOpen(false);
- setNewWorkspaceName("");
+ setNewWorkspaceName('');
} else {
- console.error("A project with this name already exists.");
+ console.error('A project with this name already exists.');
setError(true);
setLoading(false);
}
@@ -156,37 +140,35 @@ export default function Layout({ children }: LayoutProps) {
setError(true);
setLoading(false);
}
- }
+ };
const menuItems = useMemo(
() => [
{
- href:
- "/dashboard/" +
- workspaceMapping[workspaceSelected as any],
- title: t("nav:menu.secrets"),
- emoji: <FontAwesomeIcon icon={faKey} />,
+ href: `/dashboard/${workspaceMapping[workspaceSelected as any]}`,
+ title: t('nav:menu.secrets'),
+ emoji: <FontAwesomeIcon icon={faKey} />
},
{
- href: "/users/" + workspaceMapping[workspaceSelected as any],
- title: t("nav:menu.members"),
- emoji: <FontAwesomeIcon icon={faUser} />,
+ href: `/users/${workspaceMapping[workspaceSelected as any]}`,
+ title: t('nav:menu.members'),
+ emoji: <FontAwesomeIcon icon={faUser} />
},
{
- href: "/integrations/" + workspaceMapping[workspaceSelected as any],
- title: t("nav:menu.integrations"),
- emoji: <FontAwesomeIcon icon={faPlug} />,
+ href: `/integrations/${workspaceMapping[workspaceSelected as any]}`,
+ title: t('nav:menu.integrations'),
+ emoji: <FontAwesomeIcon icon={faPlug} />
},
{
- href: '/activity/' + workspaceMapping[workspaceSelected as any],
+ href: `/activity/${workspaceMapping[workspaceSelected as any]}`,
title: 'Activity Logs',
emoji: <FontAwesomeIcon icon={faFileLines} />
},
{
- href: "/settings/project/" + workspaceMapping[workspaceSelected as any],
- title: t("nav:menu.project-settings"),
- emoji: <FontAwesomeIcon icon={faGear} />,
- },
+ href: `/settings/project/${workspaceMapping[workspaceSelected as any]}`,
+ title: t('nav:menu.project-settings'),
+ emoji: <FontAwesomeIcon icon={faGear} />
+ }
],
[t, workspaceMapping, workspaceSelected]
);
@@ -194,61 +176,49 @@ export default function Layout({ children }: LayoutProps) {
useEffect(() => {
// Put a user in a workspace if they're not in one yet
const putUserInWorkSpace = async () => {
- if (tempLocalStorage("orgData.id") === "") {
+ if (tempLocalStorage('orgData.id') === '') {
const userOrgs = await getOrganizations();
- localStorage.setItem("orgData.id", userOrgs[0]._id);
+ localStorage.setItem('orgData.id', userOrgs[0]._id);
}
const orgUserProjects = await getOrganizationUserProjects({
- orgId: tempLocalStorage("orgData.id"),
+ orgId: tempLocalStorage('orgData.id')
});
const userWorkspaces = orgUserProjects;
if (
- userWorkspaces.length == 0 &&
- router.asPath != "/noprojects" &&
- !router.asPath.includes("home")&&
- !router.asPath.includes("settings")
+ userWorkspaces.length === 0 &&
+ router.asPath !== '/noprojects' &&
+ !router.asPath.includes('home') &&
+ !router.asPath.includes('settings')
) {
- router.push("/noprojects");
- } else if (router.asPath != "/noprojects") {
+ router.push('/noprojects');
+ } else if (router.asPath !== '/noprojects') {
const intendedWorkspaceId = router.asPath
- .split("/")
- [router.asPath.split("/").length - 1].split("?")[0];
-
- if (
- !["heroku", "vercel", "github", "netlify"].includes(intendedWorkspaceId)
- ) {
- localStorage.setItem("projectData.id", intendedWorkspaceId);
+ .split('/')
+ [router.asPath.split('/').length - 1].split('?')[0];
+
+ if (!['heroku', 'vercel', 'github', 'netlify'].includes(intendedWorkspaceId)) {
+ localStorage.setItem('projectData.id', intendedWorkspaceId);
}
-
+
// If a user is not a member of a workspace they are trying to access, just push them to one of theirs
if (
- !["heroku", "vercel", "github", "netlify"].includes(intendedWorkspaceId) &&
+ !['heroku', 'vercel', 'github', 'netlify'].includes(intendedWorkspaceId) &&
!userWorkspaces
.map((workspace: { _id: string }) => workspace._id)
.includes(intendedWorkspaceId)
) {
- router.push("/dashboard/" + userWorkspaces[0]._id);
+ router.push(`/dashboard/${userWorkspaces[0]._id}`);
} else {
setWorkspaceMapping(
Object.fromEntries(
- userWorkspaces.map((workspace: any) => [
- workspace.name,
- workspace._id,
- ])
+ userWorkspaces.map((workspace: any) => [workspace.name, workspace._id])
) as any
);
setWorkspaceSelected(
Object.fromEntries(
- userWorkspaces.map((workspace: any) => [
- workspace._id,
- workspace.name,
- ])
- )[
- router.asPath
- .split("/")
- [router.asPath.split("/").length - 1].split("?")[0]
- ]
+ userWorkspaces.map((workspace: any) => [workspace._id, workspace.name])
+ )[router.asPath.split('/')[router.asPath.split('/').length - 1].split('?')[0]]
);
}
}
@@ -262,31 +232,20 @@ export default function Layout({ children }: LayoutProps) {
if (
workspaceMapping[workspaceSelected as any] &&
`${workspaceMapping[workspaceSelected as any]}` !==
- router.asPath
- .split("/")
- [router.asPath.split("/").length - 1].split("?")[0]
+ router.asPath.split('/')[router.asPath.split('/').length - 1].split('?')[0]
) {
- localStorage.setItem(
- "projectData.id",
- `${workspaceMapping[workspaceSelected as any]}`
- );
- router.push(
- "/dashboard/" +
- workspaceMapping[workspaceSelected as any]
- );
+ localStorage.setItem('projectData.id', `${workspaceMapping[workspaceSelected as any]}`);
+ router.push(`/dashboard/${workspaceMapping[workspaceSelected as any]}`);
}
- } catch (error) {
- console.log(error);
+ } catch (err) {
+ console.log(err);
}
}, [workspaceSelected]);
return (
<>
- <div className="fixed w-full hidden md:block flex flex-col h-screen">
- <script
- src="https://cdnjs.cloudflare.com/ajax/libs/alpinejs/3.2.2/cdn.js"
- defer
- ></script>
+ <div className="fixed w-full md:block flex flex-col h-screen">
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/alpinejs/3.2.2/cdn.js" defer />
<NavBarDashboard />
<div className="flex flex-col md:flex-row flex-1">
<aside className="bg-bunker-600 border-r border-mineshaft-500 w-full md:w-60 h-screen">
@@ -295,7 +254,7 @@ export default function Layout({ children }: LayoutProps) {
<div>
<div className="flex justify-center w-full mt-[4.5rem] mb-6 bg-bunker-600 h-20 flex-col items-center px-4">
<div className="text-gray-400 self-start ml-1 mb-1 text-xs font-semibold tracking-wide">
- {t("nav:menu.project")}
+ {t('nav:menu.project')}
</div>
{Object.keys(workspaceMapping).length > 0 ? (
<Listbox
@@ -319,35 +278,27 @@ export default function Layout({ children }: LayoutProps) {
{Object.keys(workspaceMapping).length > 0 &&
menuItems.map(({ href, title, emoji }) => (
<li className="mt-0.5 mx-2" key={title}>
- {router.asPath.split("/")[1] === href.split("/")[1] &&
- (["project", "billing", "org", "personal"].includes(
- router.asPath.split("/")[2]
+ {router.asPath.split('/')[1] === href.split('/')[1] &&
+ (['project', 'billing', 'org', 'personal'].includes(
+ router.asPath.split('/')[2]
)
- ? router.asPath.split("/")[2] === href.split("/")[2]
+ ? router.asPath.split('/')[2] === href.split('/')[2]
: true) ? (
- <div
- className={`flex relative px-0.5 py-2.5 text-white text-sm rounded cursor-pointer bg-primary-50/10`}
- >
- <div className="absolute top-0 my-1 ml-1 inset-0 bg-primary w-1 rounded-xl mr-1"></div>
+ <div className="flex relative px-0.5 py-2.5 text-white text-sm rounded cursor-pointer bg-primary-50/10">
+ <div className="absolute top-0 my-1 ml-1 inset-0 bg-primary w-1 rounded-xl mr-1" />
<p className="w-6 ml-4 mr-2 flex items-center justify-center text-lg">
{emoji}
</p>
{title}
</div>
- ) : router.asPath == "/noprojects" ? (
- <div
- className={`flex p-2.5 text-white text-sm rounded`}
- >
- <p className="w-10 flex items-center justify-center text-lg">
- {emoji}
- </p>
+ ) : router.asPath === '/noprojects' ? (
+ <div className="flex p-2.5 text-white text-sm rounded">
+ <p className="w-10 flex items-center justify-center text-lg">{emoji}</p>
{title}
</div>
) : (
<Link href={href}>
- <div
- className={`flex p-2.5 text-white text-sm rounded cursor-pointer hover:bg-primary-50/5`}
- >
+ <div className="flex p-2.5 text-white text-sm rounded cursor-pointer hover:bg-primary-50/5">
<p className="w-10 flex items-center justify-center text-lg">
{emoji}
</p>
@@ -360,53 +311,47 @@ export default function Layout({ children }: LayoutProps) {
</ul>
</div>
<div className="w-full mt-40 mb-4 px-2">
- {router.asPath.split("/")[1] === "home" ? (
- <div
- className={`flex relative px-0.5 py-2.5 text-white text-sm rounded cursor-pointer bg-primary-50/10`}
- >
- <div className="absolute top-0 my-1 ml-1 inset-0 bg-primary w-1 rounded-xl mr-1"></div>
+ {router.asPath.split('/')[1] === 'home' ? (
+ <div className="flex relative px-0.5 py-2.5 text-white text-sm rounded cursor-pointer bg-primary-50/10">
+ <div className="absolute top-0 my-1 ml-1 inset-0 bg-primary w-1 rounded-xl mr-1" />
<p className="w-6 ml-4 mr-2 flex items-center justify-center text-lg">
<FontAwesomeIcon icon={faBookOpen} />
</p>
Infisical Guide
<img
- src={`/images/progress-${
- totalOnboardingActionsDone == 0 ? "0" : ""
- }${totalOnboardingActionsDone == 1 ? "14" : ""}${
- totalOnboardingActionsDone == 2 ? "28" : ""
- }${totalOnboardingActionsDone == 3 ? "43" : ""}${
- totalOnboardingActionsDone == 4 ? "57" : ""
- }${totalOnboardingActionsDone == 5 ? "71" : ""}.svg`}
+ src={`/images/progress-${totalOnboardingActionsDone === 0 ? '0' : ''}${
+ totalOnboardingActionsDone === 1 ? '14' : ''
+ }${totalOnboardingActionsDone === 2 ? '28' : ''}${
+ totalOnboardingActionsDone === 3 ? '43' : ''
+ }${totalOnboardingActionsDone === 4 ? '57' : ''}${
+ totalOnboardingActionsDone === 5 ? '71' : ''
+ }.svg`}
height={58}
width={58}
alt="progress bar"
className="absolute right-2 -top-2"
- ></img>
+ />
</div>
) : (
- <Link
- href={`/home/` + workspaceMapping[workspaceSelected as any]}
- >
- <div
- className={`relative flex p-2.5 overflow-visible text-white h-10 text-sm rounded cursor-pointer bg-white/10 hover:bg-primary-50/[0.15] mt-max`}
- >
+ <Link href={`/home/${workspaceMapping[workspaceSelected as any]}`}>
+ <div className="relative flex p-2.5 overflow-visible text-white h-10 text-sm rounded cursor-pointer bg-white/10 hover:bg-primary-50/[0.15] mt-max">
<p className="w-10 flex items-center justify-center text-lg">
<FontAwesomeIcon icon={faBookOpen} />
</p>
Infisical Guide
<img
- src={`/images/progress-${
- totalOnboardingActionsDone == 0 ? "0" : ""
- }${totalOnboardingActionsDone == 1 ? "14" : ""}${
- totalOnboardingActionsDone == 2 ? "28" : ""
- }${totalOnboardingActionsDone == 3 ? "43" : ""}${
- totalOnboardingActionsDone == 4 ? "57" : ""
- }${totalOnboardingActionsDone == 5 ? "71" : ""}.svg`}
+ src={`/images/progress-${totalOnboardingActionsDone === 0 ? '0' : ''}${
+ totalOnboardingActionsDone === 1 ? '14' : ''
+ }${totalOnboardingActionsDone === 2 ? '28' : ''}${
+ totalOnboardingActionsDone === 3 ? '43' : ''
+ }${totalOnboardingActionsDone === 4 ? '57' : ''}${
+ totalOnboardingActionsDone === 5 ? '71' : ''
+ }.svg`}
height={58}
width={58}
alt="progress bar"
className="absolute right-2 -top-2"
- ></img>
+ />
</div>
</Link>
)}
@@ -426,14 +371,13 @@ export default function Layout({ children }: LayoutProps) {
</div>
</div>
<div className="md:hidden bg-bunker-800 w-screen h-screen flex flex-col justify-center items-center">
- <FontAwesomeIcon
- icon={faMobile}
- className="text-gray-300 text-7xl mb-8"
- />
+ <FontAwesomeIcon icon={faMobile} className="text-gray-300 text-7xl mb-8" />
<p className="text-gray-200 px-6 text-center text-lg max-w-sm">
- {` ${t("common:no-mobile")} `}
+ {` ${t('common:no-mobile')} `}
</p>
</div>
</>
);
-}
+};
+
+export default Layout;
diff --git a/frontend/src/components/basic/Listbox.tsx b/frontend/src/components/basic/Listbox.tsx
index 8ce747376c..b966e9f393 100644
--- a/frontend/src/components/basic/Listbox.tsx
+++ b/frontend/src/components/basic/Listbox.tsx
@@ -1,10 +1,5 @@
-import React from 'react';
-import { Fragment } from 'react';
-import {
- faAngleDown,
- faCheck,
- faPlus,
-} from '@fortawesome/free-solid-svg-icons';
+import React, { Fragment } from 'react';
+import { faAngleDown, faCheck, faPlus } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Listbox, Transition } from '@headlessui/react';
@@ -27,72 +22,69 @@ interface ListBoxProps {
* @param {function} obj.buttonAction - if there is a button at the bottom of the list, this is the action that happens when you click the button
* @returns
*/
-export default function ListBox({
+const ListBox = ({
selected,
onChange,
data,
text,
buttonAction,
- isFull,
-}: ListBoxProps): JSX.Element {
+ isFull
+}: ListBoxProps): JSX.Element => {
return (
<Listbox value={selected} onChange={onChange}>
- <div className='relative'>
+ <div className="relative">
<Listbox.Button
className={`text-gray-400 relative ${
isFull ? 'w-full' : 'w-52'
} cursor-default rounded-md bg-white/[0.07] hover:bg-white/[0.11] duration-200 py-2.5 pl-3 pr-10 text-left shadow-md focus:outline-none focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75 focus-visible:ring-offset-2 focus-visible:ring-offset-orange-300 sm:text-sm`}
>
- <div className='flex flex-row'>
+ <div className="flex flex-row">
{text}
- <span className='ml-1 cursor-pointer block truncate font-semibold text-gray-300 capitalize'>
+ <span className="ml-1 cursor-pointer block truncate font-semibold text-gray-300 capitalize">
{' '}
{selected}
</span>
</div>
{data && (
- <div className='cursor-pointer pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2'>
- <FontAwesomeIcon icon={faAngleDown} className='text-md mr-1.5' />
+ <div className="cursor-pointer pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2">
+ <FontAwesomeIcon icon={faAngleDown} className="text-md mr-1.5" />
</div>
)}
</Listbox.Button>
{data && (
<Transition
as={Fragment}
- leave='transition ease-in duration-100'
- leaveFrom='opacity-100'
- leaveTo='opacity-0'
+ leave="transition ease-in duration-100"
+ leaveFrom="opacity-100"
+ leaveTo="opacity-0"
>
- <Listbox.Options className='border border-mineshaft-700 z-50 p-2 absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-bunker text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm'>
+ <Listbox.Options className="border border-mineshaft-700 z-50 p-2 absolute mt-1 max-h-60 w-full overflow-auto rounded-md bg-bunker text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm">
{data.map((person, personIdx) => (
<Listbox.Option
- key={personIdx}
- className={({ active, selected }) =>
+ key={`${person}.${personIdx + 1}`}
+ className={({ active, selected: isSelected }) =>
`my-0.5 relative cursor-default select-none py-2 pl-10 pr-4 rounded-md capitalize ${
- selected ? 'bg-white/10 text-gray-400 font-bold' : ''
+ isSelected ? 'bg-white/10 text-gray-400 font-bold' : ''
} ${
- active && !selected
+ active && !isSelected
? 'bg-white/5 text-mineshaft-200 cursor-pointer'
: 'text-gray-400'
} `
}
value={person}
>
- {({ selected }) => (
+ {({ selected: isSelected }) => (
<>
<span
className={`block truncate text-primary${
- selected ? 'font-medium' : 'font-normal'
+ isSelected ? 'font-medium' : 'font-normal'
}`}
>
{person}
</span>
{selected ? (
- <span className='text-primary rounded-lg absolute inset-y-0 left-0 flex items-center pl-3'>
- <FontAwesomeIcon
- icon={faCheck}
- className='text-md ml-1'
- />
+ <span className="text-primary rounded-lg absolute inset-y-0 left-0 flex items-center pl-3">
+ <FontAwesomeIcon icon={faCheck} className="text-md ml-1" />
</span>
) : null}
</>
@@ -100,13 +92,10 @@ export default function ListBox({
</Listbox.Option>
))}
{buttonAction && (
- <button
- onClick={buttonAction}
- className='cursor-pointer w-full'
- >
- <div className='my-0.5 relative flex justify-start cursor-pointer select-none py-2 pl-10 pr-4 rounded-md text-gray-400 hover:bg-lime-300 duration-200 hover:text-black hover:font-semibold mt-2'>
- <span className='rounded-lg absolute inset-y-0 left-0 flex items-center pl-3 pr-4'>
- <FontAwesomeIcon icon={faPlus} className='text-lg' />
+ <button type="button" onClick={buttonAction} className="cursor-pointer w-full">
+ <div className="my-0.5 relative flex justify-start cursor-pointer select-none py-2 pl-10 pr-4 rounded-md text-gray-400 hover:bg-lime-300 duration-200 hover:text-black hover:font-semibold mt-2">
+ <span className="rounded-lg absolute inset-y-0 left-0 flex items-center pl-3 pr-4">
+ <FontAwesomeIcon icon={faPlus} className="text-lg" />
</span>
Add Project
</div>
@@ -118,4 +107,6 @@ export default function ListBox({
</div>
</Listbox>
);
-}
+};
+
+export default ListBox;
diff --git a/frontend/src/components/basic/Toggle.tsx b/frontend/src/components/basic/Toggle.tsx
index 6d465d786d..9c6dcf1553 100644
--- a/frontend/src/components/basic/Toggle.tsx
+++ b/frontend/src/components/basic/Toggle.tsx
@@ -16,17 +16,12 @@ interface ToggleProps {
* @param {number} obj.pos - position of a certain secret
* @returns
*/
-export default function Toggle({
- enabled,
- setEnabled,
- addOverride,
- pos,
-}: ToggleProps): JSX.Element {
+const Toggle = ({ enabled, setEnabled, addOverride, pos }: ToggleProps): JSX.Element => {
return (
<Switch
checked={enabled}
onChange={() => {
- if (enabled == false) {
+ if (enabled === false) {
addOverride('', pos);
} else {
addOverride(undefined, pos);
@@ -37,7 +32,7 @@ export default function Toggle({
enabled ? 'bg-primary' : 'bg-bunker-400'
} relative inline-flex h-5 w-9 items-center rounded-full`}
>
- <span className='sr-only'>Enable notifications</span>
+ <span className="sr-only">Enable notifications</span>
<span
className={`${
enabled ? 'translate-x-[1.26rem]' : 'translate-x-0.5'
@@ -45,4 +40,6 @@ export default function Toggle({
/>
</Switch>
);
-}
+};
+
+export default Toggle;
diff --git a/frontend/src/components/basic/buttons/Button.tsx b/frontend/src/components/basic/buttons/Button.tsx
index 2405abce77..5941b54376 100644
--- a/frontend/src/components/basic/buttons/Button.tsx
+++ b/frontend/src/components/basic/buttons/Button.tsx
@@ -1,11 +1,10 @@
-import React, { ButtonHTMLAttributes } from "react";
-import Image from "next/image";
-import { IconProp } from "@fortawesome/fontawesome-svg-core";
-import {
- FontAwesomeIcon,
-} from "@fortawesome/react-fontawesome";
+/* eslint-disable react/button-has-type */
+import React, { ButtonHTMLAttributes } from 'react';
+import Image from 'next/image';
+import { IconProp } from '@fortawesome/fontawesome-svg-core';
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-const classNames = require("classnames");
+const classNames = require('classnames');
type ButtonProps = {
text?: string;
@@ -17,7 +16,7 @@ type ButtonProps = {
active?: boolean;
iconDisabled?: IconProp;
textDisabled?: string;
- type?: ButtonHTMLAttributes<any>['type'];
+ type?: ButtonHTMLAttributes<any>["type"];
};
/**
@@ -34,72 +33,76 @@ type ButtonProps = {
* @param {string} props.textDisable - text inside the button when it is disabled
* @returns
*/
-export default function Button(props: ButtonProps): JSX.Element {
+const Button = ({
+ active,
+ text,
+ textDisabled,
+ color,
+ size,
+ onButtonPressed,
+ loading,
+ icon,
+ iconDisabled,
+ type = "button",
+}: ButtonProps): JSX.Element => {
// Check if the button show always be 'active' - then true;
// or if it should switch between 'active' and 'disabled' - then give the status
- const activityStatus =
- props.active || (props.text != "" && props.textDisabled == undefined);
+ const activityStatus = active || (text !== '' && textDisabled === undefined);
const styleButton = classNames(
- "group m-auto md:m-0 inline-block rounded-md duration-200",
+ 'group m-auto md:m-0 inline-block rounded-md duration-200',
// Setting background colors and hover modes
- props.color == "mineshaft" &&
- activityStatus &&
- "bg-mineshaft-700 hover:bg-primary",
- props.color == "mineshaft" && !activityStatus && "bg-mineshaft",
- (props.color == "primary" || !props.color) &&
- activityStatus &&
- "bg-primary hover:opacity-80",
- (props.color == "primary" || !props.color) &&
- !activityStatus &&
- "bg-primary",
- props.color == "red" && "bg-red",
+ color === 'mineshaft' && activityStatus && 'bg-mineshaft-700 hover:bg-primary',
+ color === 'mineshaft' && !activityStatus && 'bg-mineshaft',
+ (color === 'primary' || !color) && activityStatus && 'bg-primary hover:opacity-80',
+ (color === 'primary' || !color) && !activityStatus && 'bg-primary',
+ color === 'red' && 'bg-red',
// Changing the opacity when active vs when not
- activityStatus ? "opacity-100 cursor-pointer" : "opacity-40",
+ activityStatus ? 'opacity-100 cursor-pointer' : 'opacity-40',
// Setting the button sizes
- props.size == "md" && "h-10 w-full px-2 md:px-4",
- props.size == "lg" && "h-12 w-full px-2 md:px-8",
- !props.size && "md:py-1 px-3 md:px-8",
- props.size == "icon-md" && "h-10 w-10 flex items-center justify-center",
- props.size == "icon-sm" && "h-9 w-9 flex items-center justify-center"
+ size === 'md' && 'h-10 w-full px-2 md:px-4',
+ size === 'lg' && 'h-12 w-full px-2 md:px-8',
+ !size && 'md:py-1 px-3 md:px-8',
+ size === 'icon-md' && 'h-10 w-10 flex items-center justify-center',
+ size === 'icon-sm' && 'h-9 w-9 flex items-center justify-center'
);
const styleMainDiv = classNames(
- "relative font-medium flex items-center",
+ 'relative font-medium flex items-center',
// Setting the text color for the text and icon
- props.color == "mineshaft" && "text-gray-400",
- props.color != "mineshaft" && props.color != "red" && props.color != "none" && "text-black",
- props.color == "red" && "text-gray-200",
- props.color == "none" && "text-gray-200 text-xl",
- activityStatus && props.color != "red" && props.color != "none" ? "group-hover:text-black" : "",
+ color === 'mineshaft' && 'text-gray-400',
+ color !== 'mineshaft' && color !== 'red' && color !== 'none' && 'text-black',
+ color === 'red' && 'text-gray-200',
+ color === 'none' && 'text-gray-200 text-xl',
+ activityStatus && color !== 'red' && color !== 'none' ? 'group-hover:text-black' : '',
- props.size == "icon" && "flex items-center justify-center"
+ size === 'icon' && 'flex items-center justify-center'
);
const textStyle = classNames(
- "relative duration-200 text-center w-full",
+ 'relative duration-200 text-center w-full',
// Show the loading sign if the loading indicator is on
- props.loading ? "opacity-0" : "opacity-100",
- props.size == "md" && "text-sm",
- props.size == "lg" && "text-lg"
+ loading ? 'opacity-0' : 'opacity-100',
+ size === 'md' && 'text-sm',
+ size === 'lg' && 'text-lg'
);
const button = (
<button
disabled={!activityStatus}
- type={props.type}
- onClick={props.onButtonPressed}
+ type={type}
+ onClick={onButtonPressed}
className={styleButton}
>
<div className={styleMainDiv}>
<div
className={`${
- props.loading == true ? "opacity-100" : "opacity-0"
+ loading === true ? 'opacity-100' : 'opacity-0'
} absolute flex items-center px-3 bg-primary duration-200 w-full`}
>
<Image
@@ -107,33 +110,33 @@ export default function Button(props: ButtonProps): JSX.Element {
height={25}
width={42}
alt="loading animation"
- className={`rounded-xl`}
- ></Image>
+ className="rounded-xl"
+ />
</div>
- {props.icon && (
+ {icon && (
<FontAwesomeIcon
- icon={props.icon}
- className={`flex my-auto font-extrabold ${
- props.size == "icon-sm" ? "text-sm" : "text-sm"
- } ${(props.text || props.textDisabled) && "mr-2"}`}
+ icon={icon}
+ className={`flex my-auto font-extrabold ${size === 'icon-sm' ? 'text-sm' : 'text-sm'} ${
+ (text || textDisabled) && 'mr-2'
+ }`}
/>
)}
- {props.iconDisabled && (
+ {iconDisabled && (
<FontAwesomeIcon
- icon={props.iconDisabled as IconProp}
- className={`flex my-auto font-extrabold ${
- props.size == "icon-sm" ? "text-sm" : "text-md"
- } ${(props.text || props.textDisabled) && "mr-2"}`}
+ icon={iconDisabled as IconProp}
+ className={`flex my-auto font-extrabold ${size === 'icon-sm' ? 'text-sm' : 'text-md'} ${
+ (text || textDisabled) && 'mr-2'
+ }`}
/>
)}
- {(props.text || props.textDisabled) && (
- <p className={textStyle}>
- {activityStatus ? props.text : props.textDisabled}
- </p>
+ {(text || textDisabled) && (
+ <p className={textStyle}>{activityStatus ? text : textDisabled}</p>
)}
</div>
</button>
);
return button;
-}
+};
+
+export default Button;
diff --git a/frontend/src/components/basic/dialog/ActivateBotDialog.tsx b/frontend/src/components/basic/dialog/ActivateBotDialog.tsx
index ab4f478c66..6a5596b8c9 100644
--- a/frontend/src/components/basic/dialog/ActivateBotDialog.tsx
+++ b/frontend/src/components/basic/dialog/ActivateBotDialog.tsx
@@ -17,7 +17,7 @@ const ActivateBotDialog = ({
closeModal,
selectedIntegrationOption,
handleBotActivate,
- handleIntegrationOption,
+ handleIntegrationOption
}: Props) => {
const { t } = useTranslation();
@@ -30,7 +30,7 @@ const ActivateBotDialog = ({
if (!selectedIntegrationOption) return;
// 2. start integration
await handleIntegrationOption({
- integrationOption: selectedIntegrationOption,
+ integrationOption: selectedIntegrationOption
});
} catch (err) {
console.log(err);
@@ -42,47 +42,44 @@ const ActivateBotDialog = ({
return (
<div>
<Transition appear show={isOpen} as={Fragment}>
- <Dialog as='div' className='relative z-10' onClose={closeModal}>
+ <Dialog as="div" className="relative z-10" onClose={closeModal}>
<Transition.Child
as={Fragment}
- enter='ease-out duration-300'
- enterFrom='opacity-0'
- enterTo='opacity-100'
- leave='ease-in duration-200'
- leaveFrom='opacity-100'
- leaveTo='opacity-0'
+ enter="ease-out duration-300"
+ enterFrom="opacity-0"
+ enterTo="opacity-100"
+ leave="ease-in duration-200"
+ leaveFrom="opacity-100"
+ leaveTo="opacity-0"
>
- <div className='fixed inset-0 bg-black bg-opacity-70' />
+ <div className="fixed inset-0 bg-black bg-opacity-70" />
</Transition.Child>
- <div className='fixed inset-0 overflow-y-auto'>
- <div className='flex min-h-full items-center justify-center p-4 text-center'>
+ <div className="fixed inset-0 overflow-y-auto">
+ <div className="flex min-h-full items-center justify-center p-4 text-center">
<Transition.Child
as={Fragment}
- enter='ease-out duration-300'
- enterFrom='opacity-0 scale-95'
- enterTo='opacity-100 scale-100'
- leave='ease-in duration-200'
- leaveFrom='opacity-100 scale-100'
- leaveTo='opacity-0 scale-95'
+ enter="ease-out duration-300"
+ enterFrom="opacity-0 scale-95"
+ enterTo="opacity-100 scale-100"
+ leave="ease-in duration-200"
+ leaveFrom="opacity-100 scale-100"
+ leaveTo="opacity-0 scale-95"
>
- <Dialog.Panel className='w-full max-w-md transform overflow-hidden rounded-md bg-bunker-800 border border-gray-700 p-6 text-left align-middle shadow-xl transition-all'>
- <Dialog.Title
- as='h3'
- className='text-lg font-medium leading-6 text-gray-400'
- >
+ <Dialog.Panel className="w-full max-w-md transform overflow-hidden rounded-md bg-bunker-800 border border-gray-700 p-6 text-left align-middle shadow-xl transition-all">
+ <Dialog.Title as="h3" className="text-lg font-medium leading-6 text-gray-400">
{t('integrations:grant-access-to-secrets')}
</Dialog.Title>
- <div className='mt-2 mb-2'>
- <p className='text-sm text-gray-500'>
+ <div className="mt-2 mb-2">
+ <p className="text-sm text-gray-500">
{t('integrations:why-infisical-needs-access')}
</p>
</div>
- <div className='mt-6 max-w-max'>
+ <div className="mt-6 max-w-max">
<Button
onButtonPressed={submit}
- color='mineshaft'
+ color="mineshaft"
text={t('integrations:grant-access-button') as string}
- size='md'
+ size="md"
/>
</div>
</Dialog.Panel>
diff --git a/frontend/src/components/basic/dialog/AddApiKeyDialog.tsx b/frontend/src/components/basic/dialog/AddApiKeyDialog.tsx
index a46c8fd591..911cb35e35 100644
--- a/frontend/src/components/basic/dialog/AddApiKeyDialog.tsx
+++ b/frontend/src/components/basic/dialog/AddApiKeyDialog.tsx
@@ -1,11 +1,10 @@
import { Fragment, useState } from 'react';
import { useTranslation } from 'next-i18next';
+import addAPIKey from '@app/pages/api/apiKey/addAPIKey';
import { faCheck, faCopy } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Dialog, Transition } from '@headlessui/react';
-import addAPIKey from '~/pages/api/apiKey/addAPIKey';
-
import Button from '../buttons/Button';
import InputField from '../InputField';
import ListBox from '../Listbox';
@@ -99,7 +98,7 @@ const AddApiKeyDialog = ({
leaveFrom='opacity-100 scale-100'
leaveTo='opacity-0 scale-95'
>
- {apiKey == '' ? (
+ {apiKey === '' ? (
<Dialog.Panel className='w-full max-w-md transform rounded-md bg-bunker-800 border border-gray-700 p-6 text-left align-middle shadow-xl transition-all'>
<Dialog.Title
as='h3'
@@ -135,7 +134,7 @@ const AddApiKeyDialog = ({
'6 months',
'12 months',
]}
- isFull={true}
+ isFull
text={`${t('common:expired-in')}: `}
/>
</div>
@@ -149,7 +148,7 @@ const AddApiKeyDialog = ({
t('section-api-key:add-dialog.add') as string
}
size='md'
- active={apiKeyName == '' ? false : true}
+ active={apiKeyName !== ''}
/>
</div>
</div>
@@ -176,15 +175,16 @@ const AddApiKeyDialog = ({
<input
type='text'
value={apiKey}
- disabled={true}
+ disabled
id='apiKey'
className='invisible bg-white/0 text-gray-400 py-2 w-full px-2 min-w-full outline-none'
- ></input>
+ />
<div className='bg-white/0 max-w-md text-sm text-gray-400 py-2 w-full pl-14 pr-2 break-words outline-none'>
{apiKey}
</div>
<div className='group font-normal h-full relative inline-block text-gray-400 underline hover:text-primary duration-200'>
<button
+ type="button"
onClick={copyToClipboard}
className='h-full pl-3.5 pr-4 border-l border-white/20 py-2 hover:bg-white/[0.12] duration-200'
>
diff --git a/frontend/src/components/basic/dialog/AddIncidentContactDialog.tsx b/frontend/src/components/basic/dialog/AddIncidentContactDialog.tsx
index 524e98906a..4d84165018 100644
--- a/frontend/src/components/basic/dialog/AddIncidentContactDialog.tsx
+++ b/frontend/src/components/basic/dialog/AddIncidentContactDialog.tsx
@@ -1,16 +1,14 @@
import { Fragment, useState } from 'react';
import { useTranslation } from 'next-i18next';
+import addIncidentContact from '@app/pages/api/organization/addIncidentContact';
import { Dialog, Transition } from '@headlessui/react';
-import addIncidentContact from '~/pages/api/organization/addIncidentContact';
-
import Button from '../buttons/Button';
import InputField from '../InputField';
type Props = {
isOpen: boolean;
closeModal: () => void;
- workspaceId: string;
incidentContacts: string[];
setIncidentContacts: (arg: string[]) => void;
};
diff --git a/frontend/src/components/basic/dialog/AddProjectMemberDialog.tsx b/frontend/src/components/basic/dialog/AddProjectMemberDialog.tsx
index 47994c81cd..0cf76be9fb 100644
--- a/frontend/src/components/basic/dialog/AddProjectMemberDialog.tsx
+++ b/frontend/src/components/basic/dialog/AddProjectMemberDialog.tsx
@@ -27,122 +27,105 @@ const AddProjectMemberDialog = ({
const { t } = useTranslation();
return (
- <div className='z-50'>
+ <div className="z-50">
<Transition appear show={isOpen} as={Fragment}>
- <Dialog as='div' className='relative' onClose={closeModal}>
+ <Dialog as="div" className="relative" onClose={closeModal}>
<Transition.Child
as={Fragment}
- enter='ease-out duration-300'
- enterFrom='opacity-0'
- enterTo='opacity-100'
- leave='ease-in duration-200'
- leaveFrom='opacity-100'
- leaveTo='opacity-0'
+ enter="ease-out duration-300"
+ enterFrom="opacity-0"
+ enterTo="opacity-100"
+ leave="ease-in duration-200"
+ leaveFrom="opacity-100"
+ leaveTo="opacity-0"
>
- <div className='fixed inset-0 bg-black bg-opacity-70' />
+ <div className="fixed inset-0 bg-black bg-opacity-70" />
</Transition.Child>
- <div className='fixed inset-0 overflow-y-auto'>
- <div className='flex min-h-full items-center justify-center p-4 text-center'>
+ <div className="fixed inset-0 overflow-y-auto">
+ <div className="flex min-h-full items-center justify-center p-4 text-center">
<Transition.Child
as={Fragment}
- enter='ease-out duration-300'
- enterFrom='opacity-0 scale-95'
- enterTo='opacity-100 scale-100'
- leave='ease-in duration-200'
- leaveFrom='opacity-100 scale-100'
- leaveTo='opacity-0 scale-95'
+ enter="ease-out duration-300"
+ enterFrom="opacity-0 scale-95"
+ enterTo="opacity-100 scale-100"
+ leave="ease-in duration-200"
+ leaveFrom="opacity-100 scale-100"
+ leaveTo="opacity-0 scale-95"
>
- <Dialog.Panel className='w-full max-w-md transform rounded-md bg-bunker-800 border border-gray-700 p-6 text-left align-middle shadow-xl transition-all'>
+ <Dialog.Panel className="w-full max-w-md transform rounded-md bg-bunker-800 border border-gray-700 p-6 text-left align-middle shadow-xl transition-all">
{data?.length > 0 ? (
<Dialog.Title
- as='h3'
- className='text-lg font-medium leading-6 text-gray-400 z-50'
+ as="h3"
+ className="text-lg font-medium leading-6 text-gray-400 z-50"
>
{t('section-members:add-dialog.add-member-to-project')}
</Dialog.Title>
) : (
<Dialog.Title
- as='h3'
- className='text-lg font-medium leading-6 text-gray-400 z-50'
+ as="h3"
+ className="text-lg font-medium leading-6 text-gray-400 z-50"
>
{t('section-members:add-dialog.already-all-invited')}
</Dialog.Title>
)}
- <div className='mt-2 mb-4'>
+ <div className="mt-2 mb-4">
{data?.length > 0 ? (
- <div className='flex flex-col'>
- <p className='text-sm text-gray-500'>
+ <div className="flex flex-col">
+ <p className="text-sm text-gray-500">
{t('section-members:add-dialog.user-will-email')}
</p>
- <div className=''>
+ <div className="">
<Trans
- i18nKey='section-members:add-dialog.looking-add'
+ i18nKey="section-members:add-dialog.looking-add"
components={[
// eslint-disable-next-line react/jsx-key
<button
- type='button'
- className='inline-flex justify-center rounded-md py-1 text-sm text-gray-500 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2'
- onClick={() =>
- router.push(
- '/settings/org/' + router.query.id
- )
- }
+ type="button"
+ className="inline-flex justify-center rounded-md py-1 text-sm text-gray-500 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"
+ onClick={() => router.push(`/settings/org/${router.query.id}`)}
+ aria-label="add member"
/>,
// eslint-disable-next-line react/jsx-key
<button
- type='button'
- className='ml-1 inline-flex justify-center rounded-md py-1 text-sm text-gray-500 hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2'
+ type="button"
+ className="ml-1 inline-flex justify-center rounded-md py-1 text-sm text-gray-500 hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"
onClick={() =>
- router.push(
- '/settings/org/' +
- router.query.id +
- '?invite'
- )
+ router.push(`/settings/org/${router.query.id}?invite`)
}
- />,
+ aria-label="add member"
+ />
]}
/>
</div>
</div>
) : (
- <p className='text-sm text-gray-500'>
+ <p className="text-sm text-gray-500">
{t('section-members:add-dialog.add-user-org-first')}
</p>
)}
</div>
- <div className='max-h-28'>
+ <div className="max-h-28">
{data?.length > 0 && (
- <ListBox
- selected={email ? email : data[0]}
- onChange={setEmail}
- data={data}
- isFull={true}
- />
+ <ListBox selected={email || data[0]} onChange={setEmail} data={data} isFull />
)}
</div>
- <div className='max-w-max'>
+ <div className="max-w-max">
{data?.length > 0 ? (
- <div className='mt-6 flex flex-col justify-start w-max'>
+ <div className="mt-6 flex flex-col justify-start w-max">
<Button
onButtonPressed={submitModal}
- color='mineshaft'
+ color="mineshaft"
text={t('section-members:add-member') as string}
- size='md'
+ size="md"
/>
</div>
) : (
<Button
- onButtonPressed={() =>
- router.push('/settings/org/' + router.query.id)
- }
- color='mineshaft'
- text={
- t(
- 'section-members:add-dialog.add-user-to-org'
- ) as string
- }
- size='md'
+ onButtonPressed={() => router.push(`/settings/org/${router.query.id}`)}
+ color="mineshaft"
+ text={t('section-members:add-dialog.add-user-to-org') as string}
+ size="md"
/>
)}
</div>
diff --git a/frontend/src/components/basic/dialog/AddServiceTokenDialog.tsx b/frontend/src/components/basic/dialog/AddServiceTokenDialog.tsx
index 0bb50fe0af..b0322e49a6 100644
--- a/frontend/src/components/basic/dialog/AddServiceTokenDialog.tsx
+++ b/frontend/src/components/basic/dialog/AddServiceTokenDialog.tsx
@@ -2,13 +2,12 @@ import crypto from 'crypto';
import { Fragment, useState } from 'react';
import { useTranslation } from 'next-i18next';
+import addServiceToken from '@app/pages/api/serviceToken/addServiceToken';
+import getLatestFileKey from '@app/pages/api/workspace/getLatestFileKey';
import { faCheck, faCopy } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Dialog, Transition } from '@headlessui/react';
-import addServiceToken from '~/pages/api/serviceToken/addServiceToken';
-import getLatestFileKey from '~/pages/api/workspace/getLatestFileKey';
-
import {
decryptAssymmetric,
encryptSymmetric,
@@ -86,7 +85,7 @@ const AddServiceTokenDialog = ({
});
setServiceTokens(serviceTokens.concat([newServiceToken.serviceTokenData]));
- setServiceToken(newServiceToken.serviceToken + '.' + randomBytes);
+ setServiceToken(`${newServiceToken.serviceToken }.${ randomBytes}`);
};
function copyToClipboard() {
@@ -141,7 +140,7 @@ const AddServiceTokenDialog = ({
leaveFrom='opacity-100 scale-100'
leaveTo='opacity-0 scale-95'
>
- {serviceToken == '' ? (
+ {serviceToken === '' ? (
<Dialog.Panel className='w-full max-w-md transform rounded-md bg-bunker-800 border border-gray-700 p-6 text-left align-middle shadow-xl transition-all'>
<Dialog.Title
as='h3'
@@ -186,7 +185,7 @@ const AddServiceTokenDialog = ({
}
)
}
- isFull={true}
+ isFull
text={`${t('common:environment')}: `}
/>
</div>
@@ -201,7 +200,7 @@ const AddServiceTokenDialog = ({
'6 months',
'12 months',
]}
- isFull={true}
+ isFull
text={`${t('common:expired-in')}: `}
/>
</div>
@@ -215,7 +214,7 @@ const AddServiceTokenDialog = ({
t('section-token:add-dialog.add') as string
}
size='md'
- active={serviceTokenName == '' ? false : true}
+ active={serviceTokenName !== ''}
/>
</div>
</div>
@@ -244,13 +243,14 @@ const AddServiceTokenDialog = ({
value={serviceToken}
id='serviceToken'
className='invisible bg-white/0 text-gray-400 py-2 w-full px-2 min-w-full outline-none'
- ></input>
+ />
<div className='bg-white/0 max-w-md text-sm text-gray-400 py-2 w-full pl-14 pr-2 break-words outline-none'>
{serviceToken}
</div>
<div className='group font-normal h-full relative inline-block text-gray-400 underline hover:text-primary duration-200'>
<button
onClick={copyToClipboard}
+ type="button"
className='h-full pl-3.5 pr-4 border-l border-white/20 py-2 hover:bg-white/[0.12] duration-200'
>
{serviceTokenCopied ? (
diff --git a/frontend/src/components/basic/dialog/AddUserDialog.tsx b/frontend/src/components/basic/dialog/AddUserDialog.tsx
index 08d9c68036..c450a1f904 100644
--- a/frontend/src/components/basic/dialog/AddUserDialog.tsx
+++ b/frontend/src/components/basic/dialog/AddUserDialog.tsx
@@ -10,7 +10,6 @@ type Props = {
isOpen: boolean;
closeModal: () => void;
submitModal: (email: string) => void;
- workspaceId: string;
email: string;
setEmail: (email: string) => void;
currentPlan: string;
@@ -82,13 +81,13 @@ const AddUserDialog = ({
isRequired
/>
</div>
- {currentPlan == STRIPE_PRODUCT_STARTER && (
+ {currentPlan === STRIPE_PRODUCT_STARTER && (
<div className='flex flex-row'>
<button
type='button'
className='inline-flex justify-center rounded-md py-1 text-sm text-gray-500 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2'
onClick={() =>
- router.push('/settings/billing/' + router.query.id)
+ router.push(`/settings/billing/${ router.query.id}`)
}
>
You can add up to 5 members on a Free tier.
@@ -97,7 +96,7 @@ const AddUserDialog = ({
type='button'
className='ml-1 inline-flex justify-center rounded-md py-1 text-sm text-gray-500 hover:text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2'
onClick={() =>
- router.push('/settings/billing/' + router.query.id)
+ router.push(`/settings/billing/${ router.query.id}`)
}
>
Upgrade now.
diff --git a/frontend/src/components/basic/dialog/DeleteEnvVar.tsx b/frontend/src/components/basic/dialog/DeleteEnvVar.tsx
index 4bb5840397..d455a792c0 100644
--- a/frontend/src/components/basic/dialog/DeleteEnvVar.tsx
+++ b/frontend/src/components/basic/dialog/DeleteEnvVar.tsx
@@ -26,7 +26,14 @@ export const DeleteEnvVar = ({ isOpen, onClose, onSubmit }: Props) => {
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
- <div className="fixed inset-0 bg-black bg-opacity-70" onClick={onClose} />
+ <div
+ className="fixed inset-0 bg-black bg-opacity-70"
+ onClick={onClose}
+ onKeyDown={onClose}
+ role="button"
+ tabIndex={0}
+ aria-label="Close"
+ />
</Transition.Child>
<div className="flex min-h-full items-center justify-center p-4 text-center">
<Transition.Child
@@ -39,10 +46,7 @@ export const DeleteEnvVar = ({ isOpen, onClose, onSubmit }: Props) => {
leaveTo="opacity-0 scale-95"
>
<Dialog.Panel className="w-full max-w-md transform overflow-hidden rounded-md bg-grey border border-gray-700 p-6 text-left align-middle shadow-xl transition-all">
- <Dialog.Title
- as="h3"
- className="text-lg font-medium leading-6 text-gray-400"
- >
+ <Dialog.Title as="h3" className="text-lg font-medium leading-6 text-gray-400">
{t('dashboard:sidebar.delete-key-dialog.title')}
</Dialog.Title>
<div className="mt-2">
diff --git a/frontend/src/components/basic/dialog/IntegrationAccessTokenDialog.tsx b/frontend/src/components/basic/dialog/IntegrationAccessTokenDialog.tsx
index 1efb22329f..7c1fd3e94c 100644
--- a/frontend/src/components/basic/dialog/IntegrationAccessTokenDialog.tsx
+++ b/frontend/src/components/basic/dialog/IntegrationAccessTokenDialog.tsx
@@ -6,7 +6,6 @@ import InputField from "../InputField";
type Props = {
isOpen: boolean;
closeModal: () => void;
- submitModal: (userIdToBeDeleted: string) => void;
selectedIntegrationOption: string;
handleBotActivate: () => void;
handleIntegrationOption: (arg:{integrationOption:string})=>void;
@@ -20,6 +19,7 @@ const IntegrationAccessTokenDialog = ({
handleIntegrationOption
}:Props) => {
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
const submit = async () => {
try {
// 1. activate bot
@@ -85,7 +85,7 @@ const IntegrationAccessTokenDialog = ({
label="Access token"
onChangeHandler={() => {}}
type="varName"
- value={"Hello"}
+ value="Hello"
placeholder=""
isRequired
/>
diff --git a/frontend/src/components/basic/popups/BottomRightPopup.tsx b/frontend/src/components/basic/popups/BottomRightPopup.tsx
index a0031d09c9..91427a3a8d 100644
--- a/frontend/src/components/basic/popups/BottomRightPopup.tsx
+++ b/frontend/src/components/basic/popups/BottomRightPopup.tsx
@@ -23,50 +23,47 @@ interface PopupProps {
* @param {string} org.setCheckDocsPopUpVisible - the functions that closes the popup
* @returns
*/
-export default function BottonRightPopup({
+const BottonRightPopup = ({
buttonText,
buttonLink,
titleText,
emoji,
textLine1,
textLine2,
- setCheckDocsPopUpVisible,
-}: PopupProps): JSX.Element {
+ setCheckDocsPopUpVisible
+}: PopupProps): JSX.Element => {
return (
<div
- className='z-50 drop-shadow-xl border-gray-600/50 border flex flex-col items-start bg-bunker max-w-xl text-gray-200 pt-3 pb-4 rounded-md absolute bottom-0 right-0 mr-6 mb-6'
- role='alert'
+ className="z-50 drop-shadow-xl border-gray-600/50 border flex flex-col items-start bg-bunker max-w-xl text-gray-200 pt-3 pb-4 rounded-md absolute bottom-0 right-0 mr-6 mb-6"
+ role="alert"
>
- <div className='flex flex-row items-center justify-between w-full border-b border-gray-600/70 pb-3 px-6'>
- <div className='font-bold text-xl mr-2 mt-0.5 flex flex-row'>
+ <div className="flex flex-row items-center justify-between w-full border-b border-gray-600/70 pb-3 px-6">
+ <div className="font-bold text-xl mr-2 mt-0.5 flex flex-row">
<div>{titleText}</div>
- <div className='ml-2.5'>{emoji}</div>
+ <div className="ml-2.5">{emoji}</div>
</div>
- <button
- className='mt-1'
- onClick={() => setCheckDocsPopUpVisible(false)}
- >
+ <button className="mt-1" onClick={() => setCheckDocsPopUpVisible(false)} type="button">
<FontAwesomeIcon
icon={faXmark}
- className='text-gray-400 text-2xl hover:text-red duration-200 cursor-pointer'
+ className="text-gray-400 text-2xl hover:text-red duration-200 cursor-pointer"
/>
</button>
</div>
- <div className='block sm:inline px-6 mt-4 mb-0.5 text-gray-300'>
- {textLine1}
- </div>
- <div className='block sm:inline mb-4 px-6'>{textLine2}</div>
- <div className='flex flex-row px-6 w-full'>
- {/*eslint-disable-next-line react/jsx-no-target-blank */}
+ <div className="block sm:inline px-6 mt-4 mb-0.5 text-gray-300">{textLine1}</div>
+ <div className="block sm:inline mb-4 px-6">{textLine2}</div>
+ <div className="flex flex-row px-6 w-full">
+ {/* eslint-disable-next-line react/jsx-no-target-blank */}
<a
- className='font-bold p-2 bg-white/10 rounded-md w-full hover:bg-primary duration-200 hover:text-black flex justify-center'
+ className="font-bold p-2 bg-white/10 rounded-md w-full hover:bg-primary duration-200 hover:text-black flex justify-center"
href={buttonLink}
- target='_blank'
- rel='noopener'
+ target="_blank"
+ rel="noopener"
>
{buttonText}
</a>
</div>
</div>
);
-}
+};
+
+export default BottonRightPopup;
diff --git a/frontend/src/components/basic/table/ApiKeyTable.tsx b/frontend/src/components/basic/table/ApiKeyTable.tsx
index dd71b1b3f6..19327088d9 100644
--- a/frontend/src/components/basic/table/ApiKeyTable.tsx
+++ b/frontend/src/components/basic/table/ApiKeyTable.tsx
@@ -1,8 +1,7 @@
+import { useNotificationContext } from '@app/components/context/Notifications/NotificationProvider';
import { faX } from '@fortawesome/free-solid-svg-icons';
-import { useNotificationContext } from '~/components/context/Notifications/NotificationProvider';
-
-import deleteAPIKey from "../../../pages/api/apiKey/deleteAPIKey";
+import deleteAPIKey from '../../../pages/api/apiKey/deleteAPIKey';
import guidGenerator from '../../utilities/randomId';
import Button from '../buttons/Button';
@@ -28,49 +27,47 @@ const ApiKeyTable = ({ data, setApiKeys }: ServiceTokensProps) => {
const { createNotification } = useNotificationContext();
return (
<div className="table-container w-full bg-bunker rounded-md mb-6 border border-mineshaft-700 relative mt-1">
- <div className="absolute rounded-t-md w-full h-12 bg-white/5"></div>
+ <div className="absolute rounded-t-md w-full h-12 bg-white/5" />
<table className="w-full my-1">
<thead className="text-bunker-300 text-sm font-light">
<tr>
<th className="text-left pl-6 pt-2.5 pb-2">API KEY NAME</th>
<th className="text-left pl-6 pt-2.5 pb-2">VALID UNTIL</th>
- <th></th>
+ <th aria-label="button" />
</tr>
</thead>
<tbody>
{data?.length > 0 ? (
- data?.map((row) => {
- return (
- <tr
- key={guidGenerator()}
- className="bg-bunker-800 hover:bg-bunker-800/5 duration-100"
- >
- <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
- {row.name}
- </td>
- <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
- {new Date(row.expiresAt).toUTCString()}
- </td>
- <td className="py-2 border-mineshaft-700 border-t">
- <div className="opacity-50 hover:opacity-100 duration-200 flex items-center">
- <Button
- onButtonPressed={() => {
- deleteAPIKey({ apiKeyId: row._id} );
- setApiKeys(data.filter(token => token._id != row._id));
- createNotification({
- text: `'${row.name}' API key has been revoked.`,
- type: 'error'
- });
- }}
- color="red"
- size="icon-sm"
- icon={faX}
- />
- </div>
- </td>
- </tr>
- );
- })
+ data?.map((row) => (
+ <tr
+ key={guidGenerator()}
+ className="bg-bunker-800 hover:bg-bunker-800/5 duration-100"
+ >
+ <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
+ {row.name}
+ </td>
+ <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
+ {new Date(row.expiresAt).toUTCString()}
+ </td>
+ <td className="py-2 border-mineshaft-700 border-t">
+ <div className="opacity-50 hover:opacity-100 duration-200 flex items-center">
+ <Button
+ onButtonPressed={() => {
+ deleteAPIKey({ apiKeyId: row._id });
+ setApiKeys(data.filter((token) => token._id !== row._id));
+ createNotification({
+ text: `'${row.name}' API key has been revoked.`,
+ type: 'error'
+ });
+ }}
+ color="red"
+ size="icon-sm"
+ icon={faX}
+ />
+ </div>
+ </td>
+ </tr>
+ ))
) : (
<tr>
<td colSpan={4} className="text-center pt-7 pb-5 text-bunker-300 text-sm">
diff --git a/frontend/src/components/basic/table/Checkbox.tsx b/frontend/src/components/basic/table/Checkbox.tsx
index 56e0158c16..24f6a26737 100644
--- a/frontend/src/components/basic/table/Checkbox.tsx
+++ b/frontend/src/components/basic/table/Checkbox.tsx
@@ -1,31 +1,32 @@
+/* eslint-disable jsx-a11y/label-has-associated-control */
type Props = {
addAllUsers: boolean;
setAddAllUsers: (arg: boolean) => void;
};
-export const Checkbox = ({ addAllUsers, setAddAllUsers }: Props) => {
- return (
- <>
- <div className='flex flex-row items-center'>
- {addAllUsers == true ? (
- <input
- type='checkbox'
- className='accent-primary h-4 w-4'
- checked
- readOnly
- onClick={() => setAddAllUsers(!addAllUsers)}
- />
- ) : (
- <div
- className='h-4 w-4 bg-bunker border border-gray-600 rounded-sm'
- onClick={() => setAddAllUsers(!addAllUsers)}
- ></div>
- )}
+export const Checkbox = ({ addAllUsers, setAddAllUsers }: Props) => (
+ <div className="flex flex-row items-center">
+ {addAllUsers === true ? (
+ <input
+ type="checkbox"
+ className="accent-primary h-4 w-4"
+ checked
+ readOnly
+ onClick={() => setAddAllUsers(!addAllUsers)}
+ />
+ ) : (
+ <div
+ onKeyDown={() => setAddAllUsers(!addAllUsers)}
+ role="button"
+ tabIndex={0}
+ aria-label="add all users"
+ className="h-4 w-4 bg-bunker border border-gray-600 rounded-sm"
+ onClick={() => setAddAllUsers(!addAllUsers)}
+ />
+ )}
- <label className='ml-2 text-gray-500 text-sm'>
- Add all members of my organization to this project.
- </label>
- </div>
- </>
- );
-};
+ <label className="ml-2 text-gray-500 text-sm">
+ Add all members of my organization to this project.
+ </label>
+ </div>
+);
diff --git a/frontend/src/components/basic/table/EnvironmentsTable.tsx b/frontend/src/components/basic/table/EnvironmentsTable.tsx
index 56536b679e..886bb1761b 100644
--- a/frontend/src/components/basic/table/EnvironmentsTable.tsx
+++ b/frontend/src/components/basic/table/EnvironmentsTable.tsx
@@ -14,15 +14,10 @@ type Props = {
onDeleteEnv: (slug: string) => Promise<void>;
};
-const EnvironmentTable = ({
- data = [],
- onCreateEnv,
- onDeleteEnv,
- onUpdateEnv,
-}: Props) => {
+const EnvironmentTable = ({ data = [], onCreateEnv, onDeleteEnv, onUpdateEnv }: Props) => {
const { popUp, handlePopUpOpen, handlePopUpClose } = usePopUp([
'createUpdateEnv',
- 'deleteEnv',
+ 'deleteEnv'
] as const);
const onEnvCreateCB = async (env: Env) => {
@@ -36,10 +31,7 @@ const EnvironmentTable = ({
const onEnvUpdateCB = async (env: Env) => {
try {
- await onUpdateEnv(
- (popUp.createUpdateEnv?.data as Pick<Env, 'slug'>)?.slug,
- env
- );
+ await onUpdateEnv((popUp.createUpdateEnv?.data as Pick<Env, 'slug'>)?.slug, env);
handlePopUpClose('createUpdateEnv');
} catch (error) {
console.error(error);
@@ -48,9 +40,7 @@ const EnvironmentTable = ({
const onEnvDeleteCB = async () => {
try {
- await onDeleteEnv(
- (popUp.deleteEnv?.data as Pick<Env, 'slug'>)?.slug
- );
+ await onDeleteEnv((popUp.deleteEnv?.data as Pick<Env, 'slug'>)?.slug);
handlePopUpClose('deleteEnv');
} catch (error) {
console.error(error);
@@ -59,83 +49,68 @@ const EnvironmentTable = ({
return (
<>
- <div className='flex flex-row justify-between w-full'>
- <div className='flex flex-col w-full'>
- <p className='text-xl font-semibold mb-3'>Project Environments</p>
- <p className='text-base text-gray-400 mb-4'>
- Choose which environments will show up in your dashboard like
- development, staging, production
+ <div className="flex flex-row justify-between w-full">
+ <div className="flex flex-col w-full">
+ <p className="text-xl font-semibold mb-3">Project Environments</p>
+ <p className="text-base text-gray-400 mb-4">
+ Choose which environments will show up in your dashboard like development, staging,
+ production
</p>
- <p className='text-sm mr-1 text-gray-500 self-start'>
- Note: the text in slugs shows how these environmant should be
- accessed in CLI.
+ <p className="text-sm mr-1 text-gray-500 self-start">
+ Note: the text in slugs shows how these environmant should be accessed in CLI.
</p>
</div>
- <div className='w-48'>
+ <div className="w-48">
<Button
- text='Add New Env'
+ text="Add New Env"
onButtonPressed={() => handlePopUpOpen('createUpdateEnv')}
- color='mineshaft'
+ color="mineshaft"
icon={faPlus}
- size='md'
+ size="md"
/>
</div>
</div>
- <div className='table-container w-full bg-bunker rounded-md mb-6 border border-mineshaft-700 relative mt-1'>
- <div className='absolute rounded-t-md w-full h-12 bg-white/5'></div>
- <table className='w-full my-1'>
- <thead className='text-bunker-300'>
+ <div className="table-container w-full bg-bunker rounded-md mb-6 border border-mineshaft-700 relative mt-1">
+ <div className="absolute rounded-t-md w-full h-12 bg-white/5" />
+ <table className="w-full my-1">
+ <thead className="text-bunker-300">
<tr>
- <th className='text-left pl-6 pt-2.5 pb-2'>Name</th>
- <th className='text-left pl-6 pt-2.5 pb-2'>Slug</th>
- <th></th>
+ <th className="text-left pl-6 pt-2.5 pb-2">Name</th>
+ <th className="text-left pl-6 pt-2.5 pb-2">Slug</th>
+ <th aria-label="buttons" />
</tr>
</thead>
<tbody>
{data?.length > 0 ? (
- data.map(({ name, slug }) => {
- return (
- <tr
- key={name}
- className='bg-bunker-800 hover:bg-bunker-800/5 duration-100'
- >
- <td className='pl-6 py-2 border-mineshaft-700 border-t text-gray-300 capitalize'>
- {name}
- </td>
- <td className='pl-6 py-2 border-mineshaft-700 border-t text-gray-300'>
- {slug}
- </td>
- <td className='py-2 border-mineshaft-700 border-t flex'>
- <div className='opacity-50 hover:opacity-100 duration-200 flex items-center mr-8'>
- <Button
- onButtonPressed={() =>
- handlePopUpOpen('createUpdateEnv', { name, slug })
- }
- color='red'
- size='icon-sm'
- icon={faPencil}
- />
- </div>
- <div className='opacity-50 hover:opacity-100 duration-200 flex items-center'>
- <Button
- onButtonPressed={() =>
- handlePopUpOpen('deleteEnv', { name, slug })
- }
- color='red'
- size='icon-sm'
- icon={faX}
- />
- </div>
- </td>
- </tr>
- );
- })
+ data.map(({ name, slug }) => (
+ <tr key={name} className="bg-bunker-800 hover:bg-bunker-800/5 duration-100">
+ <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300 capitalize">
+ {name}
+ </td>
+ <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">{slug}</td>
+ <td className="py-2 border-mineshaft-700 border-t flex">
+ <div className="opacity-50 hover:opacity-100 duration-200 flex items-center mr-8">
+ <Button
+ onButtonPressed={() => handlePopUpOpen('createUpdateEnv', { name, slug })}
+ color="red"
+ size="icon-sm"
+ icon={faPencil}
+ />
+ </div>
+ <div className="opacity-50 hover:opacity-100 duration-200 flex items-center">
+ <Button
+ onButtonPressed={() => handlePopUpOpen('deleteEnv', { name, slug })}
+ color="red"
+ size="icon-sm"
+ icon={faX}
+ />
+ </div>
+ </td>
+ </tr>
+ ))
) : (
<tr>
- <td
- colSpan={4}
- className='text-center pt-7 pb-4 text-bunker-400'
- >
+ <td colSpan={4} className="text-center pt-7 pb-4 text-bunker-400">
No environmants found
</td>
</tr>
@@ -143,7 +118,7 @@ const EnvironmentTable = ({
</tbody>
</table>
<DeleteActionModal
- isOpen={popUp['deleteEnv'].isOpen}
+ isOpen={popUp.deleteEnv.isOpen}
title={`Are you sure want to delete ${
(popUp?.deleteEnv?.data as { name: string })?.name || ' '
}?`}
diff --git a/frontend/src/components/basic/table/ServiceTokenTable.tsx b/frontend/src/components/basic/table/ServiceTokenTable.tsx
index 4d30b30139..73dd2a4ee5 100644
--- a/frontend/src/components/basic/table/ServiceTokenTable.tsx
+++ b/frontend/src/components/basic/table/ServiceTokenTable.tsx
@@ -1,8 +1,7 @@
+import { useNotificationContext } from '@app/components/context/Notifications/NotificationProvider';
import { faX } from '@fortawesome/free-solid-svg-icons';
-import { useNotificationContext } from '~/components/context/Notifications/NotificationProvider';
-
-import deleteServiceToken from "../../../pages/api/serviceToken/deleteServiceToken";
+import deleteServiceToken from '../../../pages/api/serviceToken/deleteServiceToken';
import guidGenerator from '../../utilities/randomId';
import Button from '../buttons/Button';
@@ -33,7 +32,7 @@ const ServiceTokenTable = ({ data, workspaceName, setServiceTokens }: ServiceTok
return (
<div className="table-container w-full bg-bunker rounded-md mb-6 border border-mineshaft-700 relative mt-1">
- <div className="absolute rounded-t-md w-full h-12 bg-white/5"></div>
+ <div className="absolute rounded-t-md w-full h-12 bg-white/5" />
<table className="w-full my-1">
<thead className="text-bunker-300 text-sm font-light">
<tr>
@@ -41,49 +40,47 @@ const ServiceTokenTable = ({ data, workspaceName, setServiceTokens }: ServiceTok
<th className="text-left pl-6 pt-2.5 pb-2">PROJECT</th>
<th className="text-left pl-6 pt-2.5 pb-2">ENVIRONMENT</th>
<th className="text-left pl-6 pt-2.5 pb-2">VAILD UNTIL</th>
- <th></th>
+ <th aria-label="button" />
</tr>
</thead>
<tbody>
{data?.length > 0 ? (
- data?.map((row) => {
- return (
- <tr
- key={guidGenerator()}
- className="bg-bunker-800 hover:bg-bunker-800/5 duration-100"
- >
- <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
- {row.name}
- </td>
- <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
- {workspaceName}
- </td>
- <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
- {row.environment}
- </td>
- <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
- {new Date(row.expiresAt).toUTCString()}
- </td>
- <td className="py-2 border-mineshaft-700 border-t">
- <div className="opacity-50 hover:opacity-100 duration-200 flex items-center">
- <Button
- onButtonPressed={() => {
- deleteServiceToken({ serviceTokenId: row._id} );
- setServiceTokens(data.filter(token => token._id != row._id));
- createNotification({
- text: `'${row.name}' token has been revoked.`,
- type: 'error'
- });
- }}
- color="red"
- size="icon-sm"
- icon={faX}
- />
- </div>
- </td>
- </tr>
- );
- })
+ data?.map((row) => (
+ <tr
+ key={guidGenerator()}
+ className="bg-bunker-800 hover:bg-bunker-800/5 duration-100"
+ >
+ <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
+ {row.name}
+ </td>
+ <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
+ {workspaceName}
+ </td>
+ <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
+ {row.environment}
+ </td>
+ <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
+ {new Date(row.expiresAt).toUTCString()}
+ </td>
+ <td className="py-2 border-mineshaft-700 border-t">
+ <div className="opacity-50 hover:opacity-100 duration-200 flex items-center">
+ <Button
+ onButtonPressed={() => {
+ deleteServiceToken({ serviceTokenId: row._id });
+ setServiceTokens(data.filter((token) => token._id !== row._id));
+ createNotification({
+ text: `'${row.name}' token has been revoked.`,
+ type: 'error'
+ });
+ }}
+ color="red"
+ size="icon-sm"
+ icon={faX}
+ />
+ </div>
+ </td>
+ </tr>
+ ))
) : (
<tr>
<td colSpan={4} className="text-center pt-7 pb-5 text-bunker-300 text-sm">
diff --git a/frontend/src/components/basic/table/UserTable.js b/frontend/src/components/basic/table/UserTable.js
deleted file mode 100644
index 677b0d978d..0000000000
--- a/frontend/src/components/basic/table/UserTable.js
+++ /dev/null
@@ -1,241 +0,0 @@
-import { useEffect, useMemo, useState } from 'react';
-import { useRouter } from 'next/router';
-import { faX } from '@fortawesome/free-solid-svg-icons';
-
-import deleteUserFromOrganization from '~/pages/api/organization/deleteUserFromOrganization';
-import changeUserRoleInWorkspace from '~/pages/api/workspace/changeUserRoleInWorkspace';
-import deleteUserFromWorkspace from '~/pages/api/workspace/deleteUserFromWorkspace';
-import getLatestFileKey from '~/pages/api/workspace/getLatestFileKey';
-import uploadKeys from '~/pages/api/workspace/uploadKeys';
-
-import guidGenerator from '../../utilities/randomId';
-import Button from '../buttons/Button';
-import Listbox from '../Listbox';
-
-const {
- decryptAssymmetric,
- encryptAssymmetric
-} = require('../../utilities/cryptography/crypto');
-const nacl = require('tweetnacl');
-nacl.util = require('tweetnacl-util');
-
-const roles = ['admin', 'user'];
-
-/**
- * This is the component that we utilize for the user table - in future, can reuse it for some other purposes too.
- * #TODO: add the possibility of choosing and doing operations on multiple users.
- * @param {*} props
- * @returns
- */
-const UserTable = ({
- userData,
- changeData,
- myUser,
- filter,
- resendInvite,
- isOrg,
- onClick,
- deleteUser,
- setUserIdToBeDeleted
-}) => {
- const [roleSelected, setRoleSelected] = useState(
- Array(userData?.length).fill(userData.map((user) => user.role))
- );
- const router = useRouter();
- const [myRole, setMyRole] = useState('member');
-
- // Delete the row in the table (e.g. a user)
- // #TODO: Add a pop-up that warns you that the user is going to be deleted.
- const handleDelete = (membershipId, index, e) => {
- // setUserIdToBeDeleted(userId);
- // onClick();
- if (isOrg) {
- deleteUserFromOrganization(membershipId);
- } else {
- deleteUserFromWorkspace(membershipId);
- }
- changeData(userData.filter((v, i) => i !== index));
- setRoleSelected([
- ...roleSelected.slice(0, index),
- ...roleSelected.slice(index + 1, userData?.length)
- ]);
- };
-
- // Update the rold of a certain user
- const handleRoleUpdate = (index, e) => {
- changeUserRoleInWorkspace(userData[index].membershipId, e);
- changeData([
- ...userData.slice(0, index),
- ...[
- {
- key: userData[index].key,
- firstName: userData[index].firstName,
- lastName: userData[index].lastName,
- email: userData[index].email,
- role: e,
- status: userData[index].status,
- userId: userData[index].userId,
- membershipId: userData[index].membershipId,
- publicKey: userData[index].publicKey
- }
- ],
- ...userData.slice(index + 1, userData?.length)
- ]);
- };
-
- useEffect(() => {
- setMyRole(userData.filter((user) => user.email == myUser)[0]?.role);
- }, [userData, myUser]);
-
- const grantAccess = async (id, publicKey) => {
- let result = await getLatestFileKey({ workspaceId: router.query.id });
-
- const PRIVATE_KEY = localStorage.getItem('PRIVATE_KEY');
-
- // assymmetrically decrypt symmetric key with local private key
- const key = decryptAssymmetric({
- ciphertext: result.latestKey.encryptedKey,
- nonce: result.latestKey.nonce,
- publicKey: result.latestKey.sender.publicKey,
- privateKey: PRIVATE_KEY
- });
-
- const { ciphertext, nonce } = encryptAssymmetric({
- plaintext: key,
- publicKey: publicKey,
- privateKey: PRIVATE_KEY
- });
-
- uploadKeys(router.query.id, id, ciphertext, nonce);
- router.reload();
- };
-
- const deleteMembershipAndResendInvite = (email, membershipId) => {
- // deleteUserFromWorkspace(membershipId);
- resendInvite(email);
- };
-
- return (
- <div className="table-container bg-bunker rounded-md mb-6 border border-mineshaft-700 relative mt-1">
- <div className="absolute rounded-t-md w-full h-[3.25rem] bg-white/5"></div>
- <table className="w-full my-0.5">
- <thead className="text-gray-400 text-sm font-light">
- <tr>
- <th className="text-left pl-6 py-3.5">FIRST NAME</th>
- <th className="text-left pl-6 py-3.5">LAST NAME</th>
- <th className="text-left pl-6 py-3.5">EMAIL</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- {userData?.filter(
- (user) =>
- user.firstName?.toLowerCase().includes(filter) ||
- user.lastName?.toLowerCase().includes(filter) ||
- user.email?.toLowerCase().includes(filter)
- ).length > 0 &&
- userData
- ?.filter(
- (user) =>
- user.firstName?.toLowerCase().includes(filter) ||
- user.lastName?.toLowerCase().includes(filter) ||
- user.email?.toLowerCase().includes(filter)
- )
- .map((row, index) => {
- return (
- <tr
- key={guidGenerator()}
- className="bg-bunker-800 hover:bg-bunker-800/5"
- >
- <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
- {row.firstName}
- </td>
- <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
- {row.lastName}
- </td>
- <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
- {row.email}
- </td>
- <td className="flex flex-row justify-end pr-8 py-2 border-t border-0.5 border-mineshaft-700">
- <div className="flex justify-end mr-6 w-3/4 mx-2 w-full h-full flex flex-row items-center">
- {row.status == 'granted' &&
- ((myRole == 'admin' && row.role != 'owner') ||
- myRole == 'owner') &&
- myUser !== row.email ? (
- <Listbox
- selected={row.role}
- onChange={(e) => handleRoleUpdate(index, e)}
- data={
- myRole == 'owner'
- ? ['owner', 'admin', 'member']
- : ['admin', 'member']
- }
- text="Role: "
- membershipId={row.membershipId}
- />
- ) : (
- row.status != 'invited' &&
- row.status != 'verified' && (
- <Listbox
- selected={row.role}
- text="Role: "
- membershipId={row.membershipId}
- />
- )
- )}
- {(row.status == 'invited' ||
- row.status == 'verified') && (
- <div className="w-full pl-9">
- <Button
- onButtonPressed={() =>
- deleteMembershipAndResendInvite(
- row.email,
- row.membershipId
- )
- }
- color="mineshaft"
- text="Resend Invite"
- size="md"
- />
- </div>
- )}
- {row.status == 'completed' && myUser !== row.email && (
- <div className="border border-mineshaft-700 rounded-md bg-white/5 hover:bg-primary text-white hover:text-black duration-200">
- <Button
- onButtonPressed={() =>
- grantAccess(row.userId, row.publicKey)
- }
- color="mineshaft"
- text="Grant Access"
- size="md"
- />
- </div>
- )}
- </div>
- {myUser !== row.email &&
- // row.role != "admin" &&
- myRole != 'member' ? (
- <div className="opacity-50 hover:opacity-100 flex items-center">
- <Button
- onButtonPressed={(e) =>
- handleDelete(row.membershipId, index, e)
- }
- color="red"
- size="icon-sm"
- icon={faX}
- />
- </div>
- ) : (
- <div className="w-9 h-9"></div>
- )}
- </td>
- </tr>
- );
- })}
- </tbody>
- </table>
- </div>
- );
-};
-
-export default UserTable;
diff --git a/frontend/src/components/basic/table/UserTable.tsx b/frontend/src/components/basic/table/UserTable.tsx
new file mode 100644
index 0000000000..ad997ca1a3
--- /dev/null
+++ b/frontend/src/components/basic/table/UserTable.tsx
@@ -0,0 +1,218 @@
+import { useEffect, useState } from 'react';
+import { useRouter } from 'next/router';
+import deleteUserFromOrganization from '@app/pages/api/organization/deleteUserFromOrganization';
+import changeUserRoleInWorkspace from '@app/pages/api/workspace/changeUserRoleInWorkspace';
+import deleteUserFromWorkspace from '@app/pages/api/workspace/deleteUserFromWorkspace';
+import getLatestFileKey from '@app/pages/api/workspace/getLatestFileKey';
+import uploadKeys from '@app/pages/api/workspace/uploadKeys';
+import { faX } from '@fortawesome/free-solid-svg-icons';
+
+import { decryptAssymmetric, encryptAssymmetric } from '../../utilities/cryptography/crypto';
+import guidGenerator from '../../utilities/randomId';
+import Button from '../buttons/Button';
+import Listbox from '../Listbox';
+
+// const roles = ['admin', 'user'];
+// TODO: Set type for this
+type Props = {
+ userData: any[];
+ changeData: (users: any[]) => void;
+ myUser: string;
+ filter: string;
+ resendInvite: (email: string) => void;
+ isOrg: boolean;
+};
+
+/**
+ * This is the component that we utilize for the user table - in future, can reuse it for some other purposes too.
+ * #TODO: add the possibility of choosing and doing operations on multiple users.
+ * @param {*} props
+ * @returns
+ */
+const UserTable = ({ userData, changeData, myUser, filter, resendInvite, isOrg }: Props) => {
+ const [roleSelected, setRoleSelected] = useState(
+ Array(userData?.length).fill(userData.map((user) => user.role))
+ );
+ const router = useRouter();
+ const [myRole, setMyRole] = useState('member');
+
+ const workspaceId = router.query.id as string;
+ // Delete the row in the table (e.g. a user)
+ // #TODO: Add a pop-up that warns you that the user is going to be deleted.
+ const handleDelete = (membershipId: string, index: number) => {
+ // setUserIdToBeDeleted(userId);
+ // onClick();
+ if (isOrg) {
+ deleteUserFromOrganization(membershipId);
+ } else {
+ deleteUserFromWorkspace(membershipId);
+ }
+ changeData(userData.filter((v, i) => i !== index));
+ setRoleSelected([
+ ...roleSelected.slice(0, index),
+ ...roleSelected.slice(index + 1, userData?.length)
+ ]);
+ };
+
+ // Update the rold of a certain user
+ const handleRoleUpdate = (index: number, e: string) => {
+ changeUserRoleInWorkspace(userData[index].membershipId, e);
+ changeData([
+ ...userData.slice(0, index),
+ ...[
+ {
+ key: userData[index].key,
+ firstName: userData[index].firstName,
+ lastName: userData[index].lastName,
+ email: userData[index].email,
+ role: e,
+ status: userData[index].status,
+ userId: userData[index].userId,
+ membershipId: userData[index].membershipId,
+ publicKey: userData[index].publicKey
+ }
+ ],
+ ...userData.slice(index + 1, userData?.length)
+ ]);
+ };
+
+ useEffect(() => {
+ setMyRole(userData.filter((user) => user.email === myUser)[0]?.role);
+ }, [userData, myUser]);
+
+ const grantAccess = async (id: string, publicKey: string) => {
+ const result = await getLatestFileKey({ workspaceId });
+
+ const PRIVATE_KEY = localStorage.getItem('PRIVATE_KEY') as string;
+
+ // assymmetrically decrypt symmetric key with local private key
+ const key = decryptAssymmetric({
+ ciphertext: result.latestKey.encryptedKey,
+ nonce: result.latestKey.nonce,
+ publicKey: result.latestKey.sender.publicKey,
+ privateKey: PRIVATE_KEY
+ });
+
+ const { ciphertext, nonce } = encryptAssymmetric({
+ plaintext: key,
+ publicKey,
+ privateKey: PRIVATE_KEY
+ });
+
+ uploadKeys(workspaceId, id, ciphertext, nonce);
+ router.reload();
+ };
+
+ const deleteMembershipAndResendInvite = (email: string) => {
+ // deleteUserFromWorkspace(membershipId);
+ resendInvite(email);
+ };
+
+ return (
+ <div className="table-container bg-bunker rounded-md mb-6 border border-mineshaft-700 relative mt-1">
+ <div className="absolute rounded-t-md w-full h-[3.25rem] bg-white/5" />
+ <table className="w-full my-0.5">
+ <thead className="text-gray-400 text-sm font-light">
+ <tr>
+ <th className="text-left pl-6 py-3.5">FIRST NAME</th>
+ <th className="text-left pl-6 py-3.5">LAST NAME</th>
+ <th className="text-left pl-6 py-3.5">EMAIL</th>
+ <th aria-label="buttons" />
+ </tr>
+ </thead>
+ <tbody>
+ {userData?.filter(
+ (user) =>
+ user.firstName?.toLowerCase().includes(filter) ||
+ user.lastName?.toLowerCase().includes(filter) ||
+ user.email?.toLowerCase().includes(filter)
+ ).length > 0 &&
+ userData
+ ?.filter(
+ (user) =>
+ user.firstName?.toLowerCase().includes(filter) ||
+ user.lastName?.toLowerCase().includes(filter) ||
+ user.email?.toLowerCase().includes(filter)
+ )
+ .map((row, index) => (
+ <tr key={guidGenerator()} className="bg-bunker-800 hover:bg-bunker-800/5">
+ <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
+ {row.firstName}
+ </td>
+ <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
+ {row.lastName}
+ </td>
+ <td className="pl-6 py-2 border-mineshaft-700 border-t text-gray-300">
+ {row.email}
+ </td>
+ <td className="flex flex-row justify-end pr-8 py-2 border-t border-0.5 border-mineshaft-700">
+ <div className="justify-end mr-6 mx-2 w-full h-full flex flex-row items-center">
+ {row.status === 'granted' &&
+ ((myRole === 'admin' && row.role !== 'owner') || myRole === 'owner') &&
+ myUser !== row.email ? (
+ <Listbox
+ selected={row.role}
+ onChange={(e) => handleRoleUpdate(index, e)}
+ data={
+ myRole === 'owner' ? ['owner', 'admin', 'member'] : ['admin', 'member']
+ }
+ text="Role: "
+ />
+ ) : (
+ row.status !== 'invited' &&
+ row.status !== 'verified' && (
+ <Listbox
+ selected={row.role}
+ text="Role: "
+ onChange={() => {
+ throw new Error('Function not implemented.');
+ }}
+ data={null}
+ />
+ )
+ )}
+ {(row.status === 'invited' || row.status === 'verified') && (
+ <div className="w-full pl-9">
+ <Button
+ onButtonPressed={() => deleteMembershipAndResendInvite(row.email)}
+ color="mineshaft"
+ text="Resend Invite"
+ size="md"
+ />
+ </div>
+ )}
+ {row.status === 'completed' && myUser !== row.email && (
+ <div className="border border-mineshaft-700 rounded-md bg-white/5 hover:bg-primary text-white hover:text-black duration-200">
+ <Button
+ onButtonPressed={() => grantAccess(row.userId, row.publicKey)}
+ color="mineshaft"
+ text="Grant Access"
+ size="md"
+ />
+ </div>
+ )}
+ </div>
+ {myUser !== row.email &&
+ // row.role !== "admin" &&
+ myRole !== 'member' ? (
+ <div className="opacity-50 hover:opacity-100 flex items-center">
+ <Button
+ onButtonPressed={() => handleDelete(row.membershipId, index)}
+ color="red"
+ size="icon-sm"
+ icon={faX}
+ />
+ </div>
+ ) : (
+ <div className="w-9 h-9" />
+ )}
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
+ </div>
+ );
+};
+
+export default UserTable;
diff --git a/frontend/src/components/billing/Plan.tsx b/frontend/src/components/billing/Plan.tsx
index 54d8515006..ea3d590062 100644
--- a/frontend/src/components/billing/Plan.tsx
+++ b/frontend/src/components/billing/Plan.tsx
@@ -1,6 +1,5 @@
import React from 'react';
-
-import StripeRedirect from '~/pages/api/organization/StripeRedirect';
+import StripeRedirect from '@app/pages/api/organization/StripeRedirect';
import { tempLocalStorage } from '../utilities/checks/tempLocalStorage';
@@ -21,54 +20,43 @@ export default function Plan({ plan }: Props) {
return (
<div
className={`relative flex flex-col justify-between border-2 min-w-fit w-96 rounded-lg h-68 mr-4 bg-mineshaft-800 ${
- plan.name != 'Starter' && plan.current == true
- ? 'border-primary'
- : 'border-chicago-700'
+ plan.name !== 'Starter' && plan.current === true ? 'border-primary' : 'border-chicago-700'
}
`}
>
- <div className='flex flex-col'>
- <div className='flex flex-row justify-between items-center relative z-10'>
- <p className={`px-6 py-4 text-3xl font-semibold text-gray-400`}>
- {plan.name}
- </p>
+ <div className="flex flex-col">
+ <div className="flex flex-row justify-between items-center relative z-10">
+ <p className="px-6 py-4 text-3xl font-semibold text-gray-400">{plan.name}</p>
</div>
- <div className='flex flwx-row items-end justify-start mb-4'>
- <p className='pl-6 text-3xl font-semibold text-primary'>
- {plan.price}
- </p>
- <p className='pl-3 mb-1 text-lg text-gray-400'>
- {plan.priceExplanation}
- </p>
+ <div className="flex flwx-row items-end justify-start mb-4">
+ <p className="pl-6 text-3xl font-semibold text-primary">{plan.price}</p>
+ <p className="pl-3 mb-1 text-lg text-gray-400">{plan.priceExplanation}</p>
</div>
- <p className='relative z-10 max-w-fit px-6 text-base text-gray-400'>
- {plan.text}
- </p>
- <p className='relative z-10 max-w-fit px-6 text-base text-gray-400'>
- {plan.subtext}
- </p>
+ <p className="relative z-10 max-w-fit px-6 text-base text-gray-400">{plan.text}</p>
+ <p className="relative z-10 max-w-fit px-6 text-base text-gray-400">{plan.subtext}</p>
</div>
- <div className='flex flex-row items-center'>
- {plan.current == false ? (
+ <div className="flex flex-row items-center">
+ {plan.current === false ? (
<>
- {plan.buttonTextMain == 'Schedule a Demo' ? (
- <a href='/scheduledemo' target='_blank rel="noopener"'>
- <div className='relative z-10 mx-5 mt-3 mb-4 py-2 px-4 border border-1 border-gray-600 hover:text-black hover:border-primary text-gray-400 font-semibold hover:bg-primary bg-bunker duration-200 cursor-pointer rounded-md flex w-max'>
+ {plan.buttonTextMain === 'Schedule a Demo' ? (
+ <a href="/scheduledemo" target='_blank rel="noopener"'>
+ <div className="relative z-10 mx-5 mt-3 mb-4 py-2 px-4 border border-1 border-gray-600 hover:text-black hover:border-primary text-gray-400 font-semibold hover:bg-primary bg-bunker duration-200 cursor-pointer rounded-md flex w-max">
{plan.buttonTextMain}
</div>
</a>
) : (
<div
className={`relative z-10 mx-5 mt-3 mb-4 py-2 px-4 border border-1 border-gray-600 text-gray-400 font-semibold ${
- plan.buttonTextMain == 'Downgrade'
+ plan.buttonTextMain === 'Downgrade'
? 'hover:bg-red hover:text-white hover:border-red'
: 'hover:bg-primary hover:text-black hover:border-primary'
} bg-bunker duration-200 cursor-pointer rounded-md flex w-max`}
>
<button
+ type="button"
onClick={() =>
StripeRedirect({
- orgId: tempLocalStorage('orgData.id'),
+ orgId: tempLocalStorage('orgData.id')
})
}
>
@@ -76,11 +64,8 @@ export default function Plan({ plan }: Props) {
</button>
</div>
)}
- <a
- href='https://infisical.com/pricing'
- target='_blank rel="noopener"'
- >
- <div className='relative z-10 text-gray-400 font-semibold hover:text-primary duration-200 cursor-pointer mb-0.5'>
+ <a href="https://infisical.com/pricing" target='_blank rel="noopener"'>
+ <div className="relative z-10 text-gray-400 font-semibold hover:text-primary duration-200 cursor-pointer mb-0.5">
{plan.buttonTextSecondary}
</div>
</a>
@@ -88,12 +73,10 @@ export default function Plan({ plan }: Props) {
) : (
<div
className={`h-8 w-full rounded-b-md flex justify-center items-center z-10 ${
- plan.name != 'Starter' && plan.current == true
- ? 'bg-primary'
- : 'bg-chicago-700'
+ plan.name !== 'Starter' && plan.current === true ? 'bg-primary' : 'bg-chicago-700'
}`}
>
- <p className='text-xs text-black font-semibold'>CURRENT PLAN</p>
+ <p className="text-xs text-black font-semibold">CURRENT PLAN</p>
</div>
)}
</div>
diff --git a/frontend/src/components/context/Notifications/Notification.tsx b/frontend/src/components/context/Notifications/Notification.tsx
index 6635c795e1..ca1b155bd0 100644
--- a/frontend/src/components/context/Notifications/Notification.tsx
+++ b/frontend/src/components/context/Notifications/Notification.tsx
@@ -2,26 +2,26 @@ import { useEffect, useRef } from 'react';
import { faX } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import { Notification as NotificationType } from './NotificationProvider';
+type NotificationType = 'success' | 'error' | 'info';
+
+export type TNotification = {
+ text: string;
+ type?: NotificationType;
+ timeoutMs?: number;
+};
interface NotificationProps {
- notification: Required<NotificationType>;
+ notification: Required<TNotification>;
clearNotification: (text: string) => void;
}
-const Notification = ({
- notification,
- clearNotification
-}: NotificationProps) => {
+const Notification = ({ notification, clearNotification }: NotificationProps) => {
const timeout = useRef<number>();
const handleClearNotification = () => clearNotification(notification.text);
const setNotifTimeout = () => {
- timeout.current = window.setTimeout(
- handleClearNotification,
- notification.timeoutMs
- );
+ timeout.current = window.setTimeout(handleClearNotification, notification.timeoutMs);
};
const cancelNotifTimeout = () => {
@@ -40,25 +40,21 @@ const Notification = ({
role="alert"
>
{notification.type === 'error' && (
- <div className="absolute w-full h-1 bg-red top-0 left-0 rounded-t-md"></div>
+ <div className="absolute w-full h-1 bg-red top-0 left-0 rounded-t-md" />
)}
{notification.type === 'success' && (
- <div className="absolute w-full h-1 bg-green top-0 left-0 rounded-t-md"></div>
+ <div className="absolute w-full h-1 bg-green top-0 left-0 rounded-t-md" />
)}
{notification.type === 'info' && (
- <div className="absolute w-full h-1 bg-yellow top-0 left-0 rounded-t-md"></div>
+ <div className="absolute w-full h-1 bg-yellow top-0 left-0 rounded-t-md" />
)}
- <p className="text-bunker-200 text-sm font-semibold mt-0.5">
- {notification.text}
- </p>
+ <p className="text-bunker-200 text-sm font-semibold mt-0.5">{notification.text}</p>
<button
+ type="button"
className="rounded-lg"
onClick={() => clearNotification(notification.text)}
>
- <FontAwesomeIcon
- className="text-white pl-2 w-4 h-3 hover:text-red"
- icon={faX}
- />
+ <FontAwesomeIcon className="text-white pl-2 w-4 h-3 hover:text-red" icon={faX} />
</button>
</div>
);
diff --git a/frontend/src/components/context/Notifications/NotificationProvider.tsx b/frontend/src/components/context/Notifications/NotificationProvider.tsx
index aa694a1d00..eda35a439d 100644
--- a/frontend/src/components/context/Notifications/NotificationProvider.tsx
+++ b/frontend/src/components/context/Notifications/NotificationProvider.tsx
@@ -1,17 +1,10 @@
-import { createContext, ReactNode, useContext, useState } from 'react';
+import { createContext, ReactNode, useCallback, useContext, useMemo, useState } from 'react';
+import { TNotification } from './Notification';
import Notifications from './Notifications';
-type NotificationType = 'success' | 'error' | 'info';
-
-export type Notification = {
- text: string;
- type?: NotificationType;
- timeoutMs?: number;
-};
-
type NotificationContextState = {
- createNotification: (newNotification: Notification) => void;
+ createNotification: (newNotification: TNotification) => void;
};
const NotificationContext = createContext<NotificationContextState>({
@@ -24,43 +17,33 @@ interface NotificationProviderProps {
children: ReactNode;
}
+// TODO: Migration to radix toast
const NotificationProvider = ({ children }: NotificationProviderProps) => {
- const [notifications, setNotifications] = useState<Required<Notification>[]>(
- []
- );
+ const [notifications, setNotifications] = useState<Required<TNotification>[]>([]);
+
+ const clearNotification = (text: string) =>
+ setNotifications((state) => state.filter((notif) => notif.text !== text));
- const clearNotification = (text: string) => {
- return setNotifications((state) =>
- state.filter((notif) => notif.text !== text)
- );
- };
+ const createNotification = useCallback(
+ ({ text, type = 'success', timeoutMs = 4000 }: TNotification) => {
+ const doesNotifExist = notifications.some((notif) => notif.text === text);
- const createNotification = ({
- text,
- type = 'success',
- timeoutMs = 4000
- }: Notification) => {
- const doesNotifExist = notifications.some((notif) => notif.text === text);
+ if (doesNotifExist) {
+ return;
+ }
- if (doesNotifExist) {
- return;
- }
+ const newNotification: Required<TNotification> = { text, type, timeoutMs };
- const newNotification: Required<Notification> = { text, type, timeoutMs };
+ setNotifications((state) => [...state, newNotification]);
+ },
+ [notifications]
+ );
- return setNotifications((state) => [...state, newNotification]);
- };
+ const value = useMemo(() => ({ createNotification }), [createNotification]);
return (
- <NotificationContext.Provider
- value={{
- createNotification
- }}
- >
- <Notifications
- notifications={notifications}
- clearNotification={clearNotification}
- />
+ <NotificationContext.Provider value={value}>
+ <Notifications notifications={notifications} clearNotification={clearNotification} />
{children}
</NotificationContext.Provider>
);
diff --git a/frontend/src/components/context/Notifications/Notifications.tsx b/frontend/src/components/context/Notifications/Notifications.tsx
index 2baba521b5..e49b9775ad 100644
--- a/frontend/src/components/context/Notifications/Notifications.tsx
+++ b/frontend/src/components/context/Notifications/Notifications.tsx
@@ -1,27 +1,19 @@
-import Notification from './Notification';
-import { Notification as NotificationType } from './NotificationProvider';
+import Notification, { TNotification } from './Notification';
interface NoticationsProps {
- notifications: Required<NotificationType>[];
+ notifications: Required<TNotification>[];
clearNotification: (text: string) => void;
}
-const Notifications = ({
- notifications,
- clearNotification
-}: NoticationsProps) => {
+const Notifications = ({ notifications, clearNotification }: NoticationsProps) => {
if (!notifications.length) {
return null;
}
return (
- <div className="hidden fixed z-50 md:flex md:flex-col-reverse bottom-1 gap-y-2 w-96 h-full right-2 bottom-2 pointer-events-none">
+ <div className="hidden fixed z-50 md:flex md:flex-col-reverse gap-y-2 w-96 h-full right-2 bottom-2 pointer-events-none">
{notifications.map((notif) => (
- <Notification
- key={notif.text}
- notification={notif}
- clearNotification={clearNotification}
- />
+ <Notification key={notif.text} notification={notif} clearNotification={clearNotification} />
))}
</div>
);
diff --git a/frontend/src/components/dashboard/CommentField.tsx b/frontend/src/components/dashboard/CommentField.tsx
index 62ff0c2f12..bbd77cea05 100644
--- a/frontend/src/components/dashboard/CommentField.tsx
+++ b/frontend/src/components/dashboard/CommentField.tsx
@@ -1,20 +1,30 @@
-import { useTranslation } from "next-i18next";
+import { useTranslation } from 'next-i18next';
/**
* This is the text field where people can add comments to particular secrets.
*/
-const CommentField = ({ comment, modifyComment, position }: { comment: string; modifyComment: (value: string, posistion: number) => void; position: number;}) => {
+const CommentField = ({
+ comment,
+ modifyComment,
+ position
+}: {
+ comment: string;
+ modifyComment: (value: string, posistion: number) => void;
+ position: number;
+}) => {
const { t } = useTranslation();
- return <div className={`relative mt-4 px-4 pt-6`}>
- <p className='text-sm text-bunker-300 pl-0.5'>{t("dashboard:sidebar.comments")}</p>
- <textarea
- className="bg-bunker-800 placeholder:text-bunker-400 h-32 w-full bg-bunker-800 px-2 py-1.5 rounded-md border border-mineshaft-500 text-sm text-bunker-300 outline-none focus:ring-2 ring-primary-800 ring-opacity-70"
- value={comment}
- onChange={(e) => modifyComment(e.target.value, position)}
- placeholder="Leave any comments here..."
- />
- </div>
-}
+ return (
+ <div className="relative mt-4 px-4 pt-6">
+ <p className="text-sm text-bunker-300 pl-0.5">{t('dashboard:sidebar.comments')}</p>
+ <textarea
+ className="placeholder:text-bunker-400 h-32 w-full bg-bunker-800 px-2 py-1.5 rounded-md border border-mineshaft-500 text-sm text-bunker-300 outline-none focus:ring-2 ring-primary-800 ring-opacity-70"
+ value={comment}
+ onChange={(e) => modifyComment(e.target.value, position)}
+ placeholder="Leave any comments here..."
+ />
+ </div>
+ );
+};
export default CommentField;
diff --git a/frontend/src/components/dashboard/DashboardInputField.tsx b/frontend/src/components/dashboard/DashboardInputField.tsx
index c19f6f4f95..0e292d65db 100644
--- a/frontend/src/components/dashboard/DashboardInputField.tsx
+++ b/frontend/src/components/dashboard/DashboardInputField.tsx
@@ -40,14 +40,14 @@ const DashboardInputField = ({
}: DashboardInputFieldProps) => {
const ref = useRef<HTMLDivElement | null>(null);
const syncScroll = (e: SyntheticEvent<HTMLDivElement>) => {
- if (ref.current == null) return;
+ if (ref.current === null) return;
ref.current.scrollTop = e.currentTarget.scrollTop;
ref.current.scrollLeft = e.currentTarget.scrollLeft;
};
if (type === 'varName') {
- const startsWithNumber = !isNaN(Number(value?.charAt(0))) && value != '';
+ const startsWithNumber = !Number.isNaN(Number(value?.charAt(0))) && value !== '';
const error = startsWithNumber || isDuplicate;
return (
@@ -58,9 +58,7 @@ const DashboardInputField = ({
} rounded-md`}
>
<input
- onChange={(e) =>
- onChangeHandler(e.target.value.toUpperCase(), position)
- }
+ onChange={(e) => onChangeHandler(e.target.value.toUpperCase(), position)}
type={type}
value={value}
className={`z-10 peer font-mono ph-no-capture bg-bunker-800 rounded-md caret-white text-gray-400 text-md px-2 py-1.5 w-full min-w-16 outline-none focus:ring-2 ${
@@ -81,13 +79,16 @@ const DashboardInputField = ({
)}
</div>
);
- } else if (type === 'value') {
+ }
+ if (type === 'value') {
return (
<div className="flex-col w-full">
- <div
- className={`group relative whitespace-pre flex flex-col justify-center w-full border border-mineshaft-500 rounded-md`}
- >
- {override == true && <div className='bg-primary-300 absolute top-[0.1rem] right-[0.1rem] z-10 w-min text-xxs px-1 text-black opacity-80 rounded-md'>Override enabled</div>}
+ <div className="group relative whitespace-pre flex flex-col justify-center w-full border border-mineshaft-500 rounded-md">
+ {override === true && (
+ <div className="bg-primary-300 absolute top-[0.1rem] right-[0.1rem] z-10 w-min text-xxs px-1 text-black opacity-80 rounded-md">
+ Override enabled
+ </div>
+ )}
<input
value={value}
onChange={(e) => onChangeHandler(e.target.value, position)}
@@ -105,20 +106,18 @@ const DashboardInputField = ({
blurred && !override
? 'text-bunker-800 group-hover:text-gray-400 peer-focus:text-gray-400 peer-active:text-gray-400'
: ''
- } ${
- override ? 'text-primary-300' : 'text-gray-400'
- }
+ } ${override ? 'text-primary-300' : 'text-gray-400'}
absolute flex flex-row whitespace-pre font-mono z-0 ph-no-capture overflow-x-scroll bg-bunker-800 h-9 rounded-md text-md px-2 py-1.5 w-full min-w-16 outline-none focus:ring-2 focus:ring-primary/50 duration-100 no-scrollbar no-scrollbar::-webkit-scrollbar`}
>
{value?.split(REGEX).map((word, id) => {
if (word.match(REGEX) !== null) {
return (
- <span className="ph-no-capture text-yellow" key={id}>
+ <span className="ph-no-capture text-yellow" key={`${word}.${id + 1}`}>
{word.slice(0, 2)}
<span className="ph-no-capture text-yellow-200/80">
{word.slice(2, word.length - 1)}
</span>
- {word.slice(word.length - 1, word.length) == '}' ? (
+ {word.slice(word.length - 1, word.length) === '}' ? (
<span className="ph-no-capture text-yellow">
{word.slice(word.length - 1, word.length)}
</span>
@@ -129,13 +128,12 @@ const DashboardInputField = ({
)}
</span>
);
- } else {
- return (
- <span key={id} className="ph-no-capture">
- {word}
- </span>
- );
}
+ return (
+ <span key={`${word}_${id + 1}`} className="ph-no-capture">
+ {word}
+ </span>
+ );
})}
</div>
{blurred && (
@@ -160,7 +158,14 @@ const DashboardInputField = ({
};
function inputPropsAreEqual(prev: DashboardInputFieldProps, next: DashboardInputFieldProps) {
- return prev.value === next.value && prev.type === next.type && prev.position === next.position && prev.blurred === next.blurred && prev.override === next.override && prev.isDuplicate === next.isDuplicate;
+ return (
+ prev.value === next.value &&
+ prev.type === next.type &&
+ prev.position === next.position &&
+ prev.blurred === next.blurred &&
+ prev.override === next.override &&
+ prev.isDuplicate === next.isDuplicate
+ );
}
export default memo(DashboardInputField, inputPropsAreEqual);
diff --git a/frontend/src/components/dashboard/DeleteActionButton.tsx b/frontend/src/components/dashboard/DeleteActionButton.tsx
index db595ff031..e4d56dd950 100644
--- a/frontend/src/components/dashboard/DeleteActionButton.tsx
+++ b/frontend/src/components/dashboard/DeleteActionButton.tsx
@@ -8,7 +8,7 @@ type Props = {
onSubmit: () => void
}
-export function DeleteActionButton({ onSubmit }: Props) {
+export const DeleteActionButton = ({ onSubmit }: Props) => {
const { t } = useTranslation();
const [open, setOpen] = useState(false)
diff --git a/frontend/src/components/dashboard/DownloadSecretsMenu.tsx b/frontend/src/components/dashboard/DownloadSecretsMenu.tsx
index dc11570e21..19b3003658 100644
--- a/frontend/src/components/dashboard/DownloadSecretsMenu.tsx
+++ b/frontend/src/components/dashboard/DownloadSecretsMenu.tsx
@@ -1,5 +1,4 @@
import { Fragment } from 'react';
-import { useTranslation } from "next-i18next";
import { faDownload } from '@fortawesome/free-solid-svg-icons';
import { Menu, Transition } from '@headlessui/react';
import { SecretDataProps } from 'public/data/frequentInterfaces';
@@ -10,57 +9,49 @@ import downloadYaml from '../utilities/secrets/downloadYaml';
/**
* This is the menu that is used to download secrets as .env ad .yml files (in future we may have more options)
- * @param {object} obj
+ * @param {object} obj
* @param {SecretDataProps[]} obj.data - secrets that we want to downlaod
* @param {string} obj.env - the environment which we're downloading (used for naming the file)
*/
-const DownloadSecretMenu = ({ data, env }: { data: SecretDataProps[]; env: string; }) => {
- const { t } = useTranslation();
-
- return <Menu
- as="div"
- className="relative inline-block text-left"
- >
- <Menu.Button
- as="div"
- className="inline-flex w-full justify-center text-sm font-medium text-gray-200 rounded-md hover:bg-white/10 duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75"
- >
- <Button
- color="mineshaft"
- size="icon-md"
- icon={faDownload}
- onButtonPressed={() => {}}
- />
- </Menu.Button>
- <Transition
- as={Fragment}
- enter="transition ease-out duration-100"
- enterFrom="transform opacity-0 scale-95"
- enterTo="transform opacity-100 scale-100"
- leave="transition ease-in duration-75"
- leaveFrom="transform opacity-100 scale-100"
- leaveTo="transform opacity-0 scale-95"
- >
- <Menu.Items className="absolute z-50 drop-shadow-xl right-0 mt-0.5 w-[12rem] origin-top-right rounded-md bg-bunker border border-mineshaft-500 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none p-2 space-y-2">
- <Menu.Item>
- <Button
- color="mineshaft"
- onButtonPressed={() => downloadDotEnv({ data, env })}
- size="md"
- text="Download as .env"
- />
- </Menu.Item>
- <Menu.Item>
- <Button
- color="mineshaft"
- onButtonPressed={() => downloadYaml({ data, env })}
- size="md"
- text="Download as .yml"
- />
- </Menu.Item>
- </Menu.Items>
- </Transition>
- </Menu>
-}
+const DownloadSecretMenu = ({ data, env }: { data: SecretDataProps[]; env: string }) => {
+ return (
+ <Menu as="div" className="relative inline-block text-left">
+ <Menu.Button
+ as="div"
+ className="inline-flex w-full justify-center text-sm font-medium text-gray-200 rounded-md hover:bg-white/10 duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75"
+ >
+ <Button color="mineshaft" size="icon-md" icon={faDownload} onButtonPressed={() => {}} />
+ </Menu.Button>
+ <Transition
+ as={Fragment}
+ enter="transition ease-out duration-100"
+ enterFrom="transform opacity-0 scale-95"
+ enterTo="transform opacity-100 scale-100"
+ leave="transition ease-in duration-75"
+ leaveFrom="transform opacity-100 scale-100"
+ leaveTo="transform opacity-0 scale-95"
+ >
+ <Menu.Items className="absolute z-50 drop-shadow-xl right-0 mt-0.5 w-[12rem] origin-top-right rounded-md bg-bunker border border-mineshaft-500 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none p-2 space-y-2">
+ <Menu.Item>
+ <Button
+ color="mineshaft"
+ onButtonPressed={() => downloadDotEnv({ data, env })}
+ size="md"
+ text="Download as .env"
+ />
+ </Menu.Item>
+ <Menu.Item>
+ <Button
+ color="mineshaft"
+ onButtonPressed={() => downloadYaml({ data, env })}
+ size="md"
+ text="Download as .yml"
+ />
+ </Menu.Item>
+ </Menu.Items>
+ </Transition>
+ </Menu>
+ );
+};
export default DownloadSecretMenu;
diff --git a/frontend/src/components/dashboard/DropZone.tsx b/frontend/src/components/dashboard/DropZone.tsx
index ffde34566a..bb11332b8f 100644
--- a/frontend/src/components/dashboard/DropZone.tsx
+++ b/frontend/src/components/dashboard/DropZone.tsx
@@ -1,14 +1,15 @@
-import { type ChangeEvent, type DragEvent, useState } from "react";
-import Image from "next/image";
-import { useTranslation } from "next-i18next";
-import { faUpload } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+/* eslint-disable no-nested-ternary */
+import { type ChangeEvent, type DragEvent, useState } from 'react';
+import Image from 'next/image';
+import { useTranslation } from 'next-i18next';
+import { faUpload } from '@fortawesome/free-solid-svg-icons';
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { parseDocument, Scalar, YAMLMap } from 'yaml';
-import Button from "../basic/buttons/Button";
-import Error from "../basic/Error";
+import Button from '../basic/buttons/Button';
+import Error from '../basic/Error';
import { parseDotEnv } from '../utilities/parseDotEnv';
-import guidGenerator from "../utilities/randomId";
+import guidGenerator from '../utilities/randomId';
interface DropZoneProps {
// TODO: change Data type from any
@@ -28,7 +29,7 @@ const DropZone = ({
errorDragAndDrop,
setButtonReady,
keysExist,
- numCurrentRows,
+ numCurrentRows
}: DropZoneProps) => {
const { t } = useTranslation();
@@ -47,7 +48,7 @@ const DropZone = ({
e.stopPropagation();
// set dropEffect to copy i.e copy of the source item
- e.dataTransfer.dropEffect = "copy";
+ e.dataTransfer.dropEffect = 'copy';
};
const [loading, setLoading] = useState(false);
@@ -57,16 +58,14 @@ const DropZone = ({
switch (fileType) {
case 'env': {
const keyPairs = parseDotEnv(file);
- secrets = Object.keys(keyPairs).map((key, index) => {
- return {
- id: guidGenerator(),
- pos: numCurrentRows + index,
- key: key,
- value: keyPairs[key as keyof typeof keyPairs].value,
- comment: keyPairs[key as keyof typeof keyPairs].comments.join('\n'),
- type: 'shared',
- };
- });
+ secrets = Object.keys(keyPairs).map((key, index) => ({
+ id: guidGenerator(),
+ pos: numCurrentRows + index,
+ key,
+ value: keyPairs[key as keyof typeof keyPairs].value,
+ comment: keyPairs[key as keyof typeof keyPairs].comments.join('\n'),
+ type: 'shared'
+ }));
break;
}
case 'yml': {
@@ -79,15 +78,15 @@ const DropZone = ({
fileContent!.items
.find((item) => item.key.value === key)
?.key?.commentBefore?.split('\n')
- .map((comment) => comment.trim())
+ .map((cmnt) => cmnt.trim())
.join('\n') ?? '';
return {
id: guidGenerator(),
pos: numCurrentRows + index,
- key: key,
+ key,
value: keyPairs[key as keyof typeof keyPairs]?.toString() ?? '',
comment,
- type: 'shared',
+ type: 'shared'
};
});
break;
@@ -105,7 +104,7 @@ const DropZone = ({
setTimeout(() => setLoading(false), 5000);
e.preventDefault();
e.stopPropagation();
- e.dataTransfer.dropEffect = "copy";
+ e.dataTransfer.dropEffect = 'copy';
const file = e.dataTransfer.files[0];
const reader = new FileReader();
@@ -149,16 +148,11 @@ const DropZone = ({
return loading ? (
<div className="flex items-center justify-center pt-16 mb-16">
- <Image
- src="/images/loading/loading.gif"
- height={70}
- width={120}
- alt="google logo"
- ></Image>
+ <Image src="/images/loading/loading.gif" height={70} width={120} alt="google logo" />
</div>
) : keysExist ? (
<div
- className="opacity-60 hover:opacity-100 duration-200 relative bg-mineshaft-900 outline max-w-[calc(100%-1rem)] w-full outline-dashed outline-chicago-600 rounded-md outline-2 flex flex-col items-center justify-center mb-16 mx-auto mt-1 py-8 px-2"
+ className="opacity-60 hover:opacity-100 duration-200 relative bg-mineshaft-900 max-w-[calc(100%-1rem)] w-full outline-dashed outline-chicago-600 rounded-md outline-2 flex flex-col items-center justify-center mb-16 mx-auto mt-1 py-8 px-2"
onDragEnter={handleDragEnter}
onDragOver={handleDragOver}
onDragLeave={handleDragLeave}
@@ -171,36 +165,27 @@ const DropZone = ({
accept=".txt,.env,.yml"
onChange={handleFileSelect}
/>
- {errorDragAndDrop ? (
- <div className="my-3 max-w-xl opacity-80"></div>
- ) : (
- <div className=""></div>
- )}
+ {errorDragAndDrop ? <div className="my-3 max-w-xl opacity-80" /> : <div className="" />}
<div className="flex flex-row">
- <FontAwesomeIcon
- icon={faUpload}
- className="text-bunker-300 text-3xl mr-6"
- />
- <p className="text-bunker-300 mt-1">{t("common:drop-zone-keys")}</p>
+ <FontAwesomeIcon icon={faUpload} className="text-bunker-300 text-3xl mr-6" />
+ <p className="text-bunker-300 mt-1">{t('common:drop-zone-keys')}</p>
</div>
- {errorDragAndDrop ? (
+ {errorDragAndDrop && (
<div className="mt-8 max-w-xl opacity-80">
<Error text="Something went wrong! Make sure you drag the file directly from the folder in which it is located (e.g., not VS code). Tip: click 'Reveal in Finder/Explorer'" />
</div>
- ) : (
- <></>
)}
</div>
) : (
<div
- className="opacity-80 hover:opacity-100 duration-200 relative bg-bunker outline max-w-2xl w-full outline-dashed outline-gray-700 rounded-md outline-2 flex flex-col items-center justify-center pt-16 mb-16 px-4"
+ className="opacity-80 hover:opacity-100 duration-200 relative bg-bunker max-w-2xl w-full outline-dashed outline-gray-700 rounded-md outline-2 flex flex-col items-center justify-center pt-16 mb-16 px-4"
onDragEnter={handleDragEnter}
onDragOver={handleDragOver}
onDragLeave={handleDragLeave}
onDrop={handleDrop}
>
<FontAwesomeIcon icon={faUpload} className="text-7xl mb-8" />
- <p className="">{t("common:drop-zone")}</p>
+ <p className="">{t('common:drop-zone')}</p>
<input
id="fileSelect"
type="file"
@@ -209,14 +194,14 @@ const DropZone = ({
onChange={handleFileSelect}
/>
<div className="flex flex-row w-full items-center justify-center mb-6 mt-5">
- <div className="border-t border-gray-700 w-1/5"></div>
+ <div className="border-t border-gray-700 w-1/5" />
<p className="text-gray-400 text-xs mx-4">OR</p>
- <div className="border-t border-gray-700 w-1/5"></div>
+ <div className="border-t border-gray-700 w-1/5" />
</div>
<div className="z-10 mb-6">
<Button
color="mineshaft"
- text={String(t("dashboard:add-secret"))}
+ text={String(t('dashboard:add-secret'))}
onButtonPressed={createNewFile}
size="md"
/>
diff --git a/frontend/src/components/dashboard/GenerateSecretMenu.tsx b/frontend/src/components/dashboard/GenerateSecretMenu.tsx
index 20a1de01c3..f87b12beca 100644
--- a/frontend/src/components/dashboard/GenerateSecretMenu.tsx
+++ b/frontend/src/components/dashboard/GenerateSecretMenu.tsx
@@ -1,95 +1,106 @@
-import { Fragment,useState } from 'react';
-import { useTranslation } from "next-i18next";
+import { Fragment, useState } from 'react';
+import { useTranslation } from 'next-i18next';
import { faShuffle } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Menu, Transition } from '@headlessui/react';
-
/**
* This is the menu that is used to (re)generate secrets (currently we only have ranom hex, in future we will have more options)
* @returns the popup-menu for randomly generating secrets
*/
-const GenerateSecretMenu = ({ modifyValue, position }: { modifyValue: (value: string, position: number) => void; position: number; }) => {
+const GenerateSecretMenu = ({
+ modifyValue,
+ position
+}: {
+ modifyValue: (value: string, position: number) => void;
+ position: number;
+}) => {
const [randomStringLength, setRandomStringLength] = useState(32);
const { t } = useTranslation();
- return <Menu as="div" className="relative inline-block text-left">
- <div>
- <Menu.Button className="inline-flex w-full justify-center rounded-md text-sm font-medium text-gray-200 rounded-md hover:bg-white/10 duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75">
- <div className='py-1 px-2 rounded-md bg-bunker-800 hover:bg-bunker-500'>
- <FontAwesomeIcon icon={faShuffle} className='text-bunker-300'/>
- </div>
- </Menu.Button>
- </div>
- <Transition
- as={Fragment}
- enter="transition ease-out duration-100"
- enterFrom="transform opacity-0 scale-95"
- enterTo="transform opacity-100 scale-100"
- leave="transition ease-in duration-75"
- leaveFrom="transform opacity-100 scale-100"
- leaveTo="transform opacity-0 scale-95"
- >
- <Menu.Items className="absolute z-50 drop-shadow-xl right-0 mt-0.5 w-[20rem] origin-top-right rounded-md bg-bunker border border-mineshaft-500 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none px-1 py-1">
- <div
- onClick={() => {
- if (randomStringLength > 32) {
- setRandomStringLength(32);
- } else if (randomStringLength < 2) {
- setRandomStringLength(2);
- } else {
- modifyValue(
- [...Array(randomStringLength)]
- .map(() => Math.floor(Math.random() * 16).toString(16))
- .join(''),
- position
- );
- }
- }}
- className="relative flex flex-row justify-start items-center cursor-pointer select-none py-2 px-2 rounded-md text-gray-400 hover:bg-white/10 duration-200 hover:text-gray-200 w-full"
- >
- <FontAwesomeIcon
- className="text-lg pl-1.5 pr-3"
- icon={faShuffle}
- />
- <div className="text-sm justify-between flex flex-row w-full">
- <p>{t("dashboard:sidebar.generate-random-hex")}</p>
- <p>{t("dashboard:sidebar.digits")}</p>
+ return (
+ <Menu as="div" className="relative inline-block text-left">
+ <div>
+ <Menu.Button className="inline-flex w-full justify-center text-sm font-medium text-gray-200 rounded-md hover:bg-white/10 duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75">
+ <div className="py-1 px-2 rounded-md bg-bunker-800 hover:bg-bunker-500">
+ <FontAwesomeIcon icon={faShuffle} className="text-bunker-300" />
</div>
- </div>
- <div className="flex flex-row absolute bottom-[0.4rem] right-[3.3rem] w-16 bg-bunker-800 border border-chicago-700 rounded-md text-bunker-200 ">
+ </Menu.Button>
+ </div>
+ <Transition
+ as={Fragment}
+ enter="transition ease-out duration-100"
+ enterFrom="transform opacity-0 scale-95"
+ enterTo="transform opacity-100 scale-100"
+ leave="transition ease-in duration-75"
+ leaveFrom="transform opacity-100 scale-100"
+ leaveTo="transform opacity-0 scale-95"
+ >
+ <Menu.Items className="absolute z-50 drop-shadow-xl right-0 mt-0.5 w-[20rem] origin-top-right rounded-md bg-bunker border border-mineshaft-500 shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none px-1 py-1">
<div
- className="m-0.5 px-1 cursor-pointer rounded-md hover:bg-chicago-700"
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
onClick={() => {
- if (randomStringLength > 1) {
- setRandomStringLength(randomStringLength - 1);
+ if (randomStringLength > 32) {
+ setRandomStringLength(32);
+ } else if (randomStringLength < 2) {
+ setRandomStringLength(2);
+ } else {
+ modifyValue(
+ [...Array(randomStringLength)]
+ .map(() => Math.floor(Math.random() * 16).toString(16))
+ .join(''),
+ position
+ );
}
}}
+ className="relative flex flex-row justify-start items-center cursor-pointer select-none py-2 px-2 rounded-md text-gray-400 hover:bg-white/10 duration-200 hover:text-gray-200 w-full"
>
- -
+ <FontAwesomeIcon className="text-lg pl-1.5 pr-3" icon={faShuffle} />
+ <div className="text-sm justify-between flex flex-row w-full">
+ <p>{t('dashboard:sidebar.generate-random-hex')}</p>
+ <p>{t('dashboard:sidebar.digits')}</p>
+ </div>
</div>
- <input
- onChange={(e) =>
- setRandomStringLength(parseInt(e.target.value))
- }
- value={randomStringLength}
- className="text-center z-20 peer text-sm bg-transparent w-full outline-none"
- spellCheck="false"
- />
- <div
- className="m-0.5 px-1 pb-0.5 cursor-pointer rounded-md hover:bg-chicago-700"
- onClick={() => {
- if (randomStringLength < 32) {
- setRandomStringLength(randomStringLength + 1);
- }
- }}
- >
- +
+ <div className="flex flex-row absolute bottom-[0.4rem] right-[3.3rem] w-16 bg-bunker-800 border border-chicago-700 rounded-md text-bunker-200 ">
+ <div
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
+ className="m-0.5 px-1 cursor-pointer rounded-md hover:bg-chicago-700"
+ onClick={() => {
+ if (randomStringLength > 1) {
+ setRandomStringLength(randomStringLength - 1);
+ }
+ }}
+ >
+ -
+ </div>
+ <input
+ onChange={(e) => setRandomStringLength(parseInt(e.target.value, 10))}
+ value={randomStringLength}
+ className="text-center z-20 peer text-sm bg-transparent w-full outline-none"
+ spellCheck="false"
+ />
+ <div
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
+ className="m-0.5 px-1 pb-0.5 cursor-pointer rounded-md hover:bg-chicago-700"
+ onClick={() => {
+ if (randomStringLength < 32) {
+ setRandomStringLength(randomStringLength + 1);
+ }
+ }}
+ >
+ +
+ </div>
</div>
- </div>
- </Menu.Items>
- </Transition>
- </Menu>
-}
+ </Menu.Items>
+ </Transition>
+ </Menu>
+ );
+};
export default GenerateSecretMenu;
diff --git a/frontend/src/components/dashboard/KeyPair.tsx b/frontend/src/components/dashboard/KeyPair.tsx
index c1adb22803..7de4edf82e 100644
--- a/frontend/src/components/dashboard/KeyPair.tsx
+++ b/frontend/src/components/dashboard/KeyPair.tsx
@@ -1,4 +1,3 @@
-import React from 'react';
import { faEllipsis } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { SecretDataProps } from 'public/data/frequentInterfaces';
@@ -7,9 +6,9 @@ import DashboardInputField from './DashboardInputField';
interface KeyPairProps {
keyPair: SecretDataProps;
- modifyKey: (value: string, position: number) => void;
- modifyValue: (value: string, position: number) => void;
- modifyValueOverride: (value: string, position: number) => void;
+ modifyKey: (value: string, position: number) => void;
+ modifyValue: (value: string, position: number) => void;
+ modifyValueOverride: (value: string, position: number) => void;
isBlurred: boolean;
isDuplicate: boolean;
toggleSidebar: (id: string) => void;
@@ -28,7 +27,7 @@ interface KeyPairProps {
* @param {boolean} obj.isDuplicate - list of all the duplicates secret names on the dashboard
* @param {function} obj.toggleSidebar - open/close/switch sidebar
* @param {string} obj.sidebarSecretId - the id of a secret for the side bar is displayed
- * @param {boolean} obj.isSnapshot - whether this keyPair is in a snapshot. If so, it won't have some features like sidebar
+ * @param {boolean} obj.isSnapshot - whether this keyPair is in a snapshot. If so, it won't have some features like sidebar
* @returns
*/
const KeyPair = ({
@@ -41,48 +40,61 @@ const KeyPair = ({
toggleSidebar,
sidebarSecretId,
isSnapshot
-}: KeyPairProps) => {
- return (
- <div className={`mx-1 flex flex-col items-center ml-1 ${isSnapshot && "pointer-events-none"} ${keyPair.id == sidebarSecretId && "bg-mineshaft-500 duration-200"} rounded-md`}>
- <div className="relative flex flex-row justify-between w-full max-w-5xl mr-auto max-h-14 my-1 items-start px-1">
- {keyPair.valueOverride && <div className="group font-normal group absolute top-[1rem] left-[0.2rem] z-40 inline-block text-gray-300 underline hover:text-primary duration-200">
- <div className='w-1 h-1 rounded-full bg-primary z-40'></div>
- <span className="absolute z-50 hidden group-hover:flex group-hover:animate-popdown duration-200 w-[10.5rem] -left-[0.4rem] -top-[1.7rem] translate-y-full px-2 py-2 bg-mineshaft-500 rounded-b-md rounded-r-md text-center text-gray-100 text-sm after:content-[''] after:absolute after:left-0 after:bottom-[100%] after:-translate-x-0 after:border-8 after:border-x-transparent after:border-t-transparent after:border-b-mineshaft-500">
- This secret is overriden
- </span>
- </div>}
- <div className="min-w-xl w-96">
- <div className="flex pr-1.5 items-center rounded-lg mt-4 md:mt-0 max-h-16">
- <DashboardInputField
- onChangeHandler={modifyKey}
- type="varName"
- position={keyPair.pos}
- value={keyPair.key}
- isDuplicate={isDuplicate}
- />
- </div>
+}: KeyPairProps) => (
+ <div
+ className={`mx-1 flex flex-col items-center ml-1 ${isSnapshot && 'pointer-events-none'} ${
+ keyPair.id === sidebarSecretId && 'bg-mineshaft-500 duration-200'
+ } rounded-md`}
+ >
+ <div className="relative flex flex-row justify-between w-full max-w-5xl mr-auto max-h-14 my-1 items-start px-1">
+ {keyPair.valueOverride && (
+ <div className="group font-normal group absolute top-[1rem] left-[0.2rem] z-40 inline-block text-gray-300 underline hover:text-primary duration-200">
+ <div className="w-1 h-1 rounded-full bg-primary z-40" />
+ <span className="absolute z-50 hidden group-hover:flex group-hover:animate-popdown duration-200 w-[10.5rem] -left-[0.4rem] -top-[1.7rem] translate-y-full px-2 py-2 bg-mineshaft-500 rounded-b-md rounded-r-md text-center text-gray-100 text-sm after:content-[''] after:absolute after:left-0 after:bottom-[100%] after:-translate-x-0 after:border-8 after:border-x-transparent after:border-t-transparent after:border-b-mineshaft-500">
+ This secret is overriden
+ </span>
</div>
- <div className="w-full min-w-xl">
- <div className={`flex min-w-xl items-center ${!isSnapshot && "pr-1.5"} rounded-lg mt-4 md:mt-0 max-h-10`}>
- <DashboardInputField
- onChangeHandler={keyPair.valueOverride ? modifyValueOverride : modifyValue}
- type="value"
- position={keyPair.pos}
- value={keyPair.valueOverride ? keyPair.valueOverride : keyPair.value}
- blurred={isBlurred}
- override={Boolean(keyPair.valueOverride)}
- />
- </div>
+ )}
+ <div className="min-w-xl w-96">
+ <div className="flex pr-1.5 items-center rounded-lg mt-4 md:mt-0 max-h-16">
+ <DashboardInputField
+ onChangeHandler={modifyKey}
+ type="varName"
+ position={keyPair.pos}
+ value={keyPair.key}
+ isDuplicate={isDuplicate}
+ />
</div>
- {!isSnapshot && <div onClick={() => toggleSidebar(keyPair.id)} className="cursor-pointer w-[2.35rem] h-[2.35rem] bg-mineshaft-700 hover:bg-chicago-700 rounded-md flex flex-row justify-center items-center duration-200">
- <FontAwesomeIcon
- className="text-gray-300 px-2.5 text-lg mt-0.5"
- icon={faEllipsis}
+ </div>
+ <div className="w-full min-w-xl">
+ <div
+ className={`flex min-w-xl items-center ${
+ !isSnapshot && 'pr-1.5'
+ } rounded-lg mt-4 md:mt-0 max-h-10`}
+ >
+ <DashboardInputField
+ onChangeHandler={keyPair.valueOverride ? modifyValueOverride : modifyValue}
+ type="value"
+ position={keyPair.pos}
+ value={keyPair.valueOverride ? keyPair.valueOverride : keyPair.value}
+ blurred={isBlurred}
+ override={Boolean(keyPair.valueOverride)}
/>
- </div>}
+ </div>
</div>
+ {!isSnapshot && (
+ <div
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
+ onClick={() => toggleSidebar(keyPair.id)}
+ className="cursor-pointer w-[2.35rem] h-[2.35rem] bg-mineshaft-700 hover:bg-chicago-700 rounded-md flex flex-row justify-center items-center duration-200"
+ >
+ <FontAwesomeIcon className="text-gray-300 px-2.5 text-lg mt-0.5" icon={faEllipsis} />
+ </div>
+ )}
</div>
- );
-};
+ </div>
+);
-export default KeyPair;
\ No newline at end of file
+export default KeyPair;
diff --git a/frontend/src/components/dashboard/SideBar.tsx b/frontend/src/components/dashboard/SideBar.tsx
index 4237c9c570..7ccbb6e40e 100644
--- a/frontend/src/components/dashboard/SideBar.tsx
+++ b/frontend/src/components/dashboard/SideBar.tsx
@@ -1,6 +1,7 @@
+/* eslint-disable react/no-unused-prop-types */
import { useState } from 'react';
import Image from 'next/image';
-import { useTranslation } from "next-i18next";
+import { useTranslation } from 'next-i18next';
import SecretVersionList from '@app/ee/components/SecretVersionList';
import { faX } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
@@ -12,7 +13,6 @@ import DashboardInputField from './DashboardInputField';
import { DeleteActionButton } from './DeleteActionButton';
import GenerateSecretMenu from './GenerateSecretMenu';
-
interface SecretProps {
key: string;
value: string;
@@ -22,22 +22,18 @@ interface SecretProps {
comment: string;
}
-interface OverrideProps {
- id: string;
- valueOverride: string;
-}
-export interface DeleteRowFunctionProps {
- ids: string[];
- secretName: string;
+export interface DeleteRowFunctionProps {
+ ids: string[];
+ secretName: string;
}
interface SideBarProps {
- toggleSidebar: (value: string) => void;
+ toggleSidebar: (value: string) => void;
data: SecretProps[];
- modifyKey: (value: string, position: number) => void;
- modifyValue: (value: string, position: number) => void;
- modifyValueOverride: (value: string | undefined, position: number) => void;
- modifyComment: (value: string, position: number) => void;
+ modifyKey: (value: string, position: number) => void;
+ modifyValue: (value: string, position: number) => void;
+ modifyValueOverride: (value: string | undefined, position: number) => void;
+ modifyComment: (value: string, position: number) => void;
buttonReady: boolean;
savePush: () => void;
sharedToHide: string[];
@@ -57,112 +53,140 @@ interface SideBarProps {
* @param {function} obj.deleteRow - a function to delete a certain keyPair
* @returns the sidebar with 'secret's settings'
*/
-const SideBar = ({
- toggleSidebar,
- data,
- modifyKey,
- modifyValue,
- modifyValueOverride,
+const SideBar = ({
+ toggleSidebar,
+ data,
+ modifyKey,
+ modifyValue,
+ modifyValueOverride,
modifyComment,
- buttonReady,
+ buttonReady,
savePush,
deleteRow
}: SideBarProps) => {
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
const [isLoading, setIsLoading] = useState(false);
- const [overrideEnabled, setOverrideEnabled] = useState(data[0].valueOverride != undefined);
+ const [overrideEnabled, setOverrideEnabled] = useState(data[0].valueOverride !== undefined);
const { t } = useTranslation();
- return <div className='absolute border-l border-mineshaft-500 bg-bunker fixed h-full w-96 top-14 right-0 z-40 shadow-xl flex flex-col justify-between'>
- {isLoading ? (
- <div className="flex items-center justify-center h-full">
- <Image
- src="/images/loading/loading.gif"
- height={60}
- width={100}
- alt="infisical loading indicator"
- ></Image>
- </div>
- ) : (
- <div className='h-min overflow-y-auto'>
- <div className="flex flex-row px-4 py-3 border-b border-mineshaft-500 justify-between items-center">
- <p className="font-semibold text-lg text-bunker-200">{t("dashboard:sidebar.secret")}</p>
- <div className='p-1' onClick={() => toggleSidebar("None")}>
- <FontAwesomeIcon icon={faX} className='w-4 h-4 text-bunker-300 cursor-pointer'/>
- </div>
- </div>
- <div className='mt-4 px-4 pointer-events-none'>
- <p className='text-sm text-bunker-300'>{t("dashboard:sidebar.key")}</p>
- <DashboardInputField
- onChangeHandler={modifyKey}
- type="varName"
- position={data[0]?.pos}
- value={data[0]?.key}
- isDuplicate={false}
- blurred={false}
+ return (
+ <div className="absolute border-l border-mineshaft-500 bg-bunker h-full w-96 top-14 right-0 z-40 shadow-xl flex flex-col justify-between">
+ {isLoading ? (
+ <div className="flex items-center justify-center h-full">
+ <Image
+ src="/images/loading/loading.gif"
+ height={60}
+ width={100}
+ alt="infisical loading indicator"
/>
</div>
- {data[0]?.value
- ? <div className={`relative mt-2 px-4 ${overrideEnabled && "opacity-40 pointer-events-none"} duration-200`}>
- <p className='text-sm text-bunker-300'>{t("dashboard:sidebar.value")}</p>
- <DashboardInputField
- onChangeHandler={modifyValue}
- type="value"
- position={data[0].pos}
- value={data[0]?.value}
- isDuplicate={false}
- blurred={true}
- />
- <div className='absolute bg-bunker-800 right-[1.07rem] top-[1.6rem] z-50'>
- <GenerateSecretMenu modifyValue={modifyValue} position={data[0]?.pos} />
+ ) : (
+ <div className="h-min overflow-y-auto">
+ <div className="flex flex-row px-4 py-3 border-b border-mineshaft-500 justify-between items-center">
+ <p className="font-semibold text-lg text-bunker-200">{t('dashboard:sidebar.secret')}</p>
+ <div
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
+ className="p-1"
+ onClick={() => toggleSidebar('None')}
+ >
+ <FontAwesomeIcon icon={faX} className="w-4 h-4 text-bunker-300 cursor-pointer" />
+ </div>
</div>
- </div>
- : <div className='px-4 text-sm text-bunker-300 pt-4'>
- <span className='py-0.5 px-1 rounded-md bg-primary-200/10 mr-1'>{t("common:note")}:</span>
- {t("dashboard:sidebar.personal-explanation")}
- </div>}
- <div className='mt-4 px-4'>
- {data[0]?.value &&
- <div className='flex flex-row items-center justify-between my-2 pl-1 pr-2'>
- <p className='text-sm text-bunker-300'>{t("dashboard:sidebar.override")}</p>
- <Toggle
- enabled={overrideEnabled}
- setEnabled={setOverrideEnabled}
- addOverride={modifyValueOverride}
- pos={data[0]?.pos}
- />
- </div>}
- <div className={`relative ${!overrideEnabled && "opacity-40 pointer-events-none"} duration-200`}>
+ <div className="mt-4 px-4 pointer-events-none">
+ <p className="text-sm text-bunker-300">{t('dashboard:sidebar.key')}</p>
<DashboardInputField
- onChangeHandler={modifyValueOverride}
- type="value"
+ onChangeHandler={modifyKey}
+ type="varName"
position={data[0]?.pos}
- value={overrideEnabled ? data[0]?.valueOverride : data[0]?.value}
+ value={data[0]?.key}
isDuplicate={false}
- blurred={true}
+ blurred={false}
/>
- <div className='absolute right-[0.57rem] top-[0.3rem] z-50'>
- <GenerateSecretMenu modifyValue={modifyValueOverride} position={data[0]?.pos} />
+ </div>
+ {data[0]?.value ? (
+ <div
+ className={`relative mt-2 px-4 ${
+ overrideEnabled && 'opacity-40 pointer-events-none'
+ } duration-200`}
+ >
+ <p className="text-sm text-bunker-300">{t('dashboard:sidebar.value')}</p>
+ <DashboardInputField
+ onChangeHandler={modifyValue}
+ type="value"
+ position={data[0].pos}
+ value={data[0]?.value}
+ isDuplicate={false}
+ blurred
+ />
+ <div className="absolute bg-bunker-800 right-[1.07rem] top-[1.6rem] z-50">
+ <GenerateSecretMenu modifyValue={modifyValue} position={data[0]?.pos} />
+ </div>
+ </div>
+ ) : (
+ <div className="px-4 text-sm text-bunker-300 pt-4">
+ <span className="py-0.5 px-1 rounded-md bg-primary-200/10 mr-1">
+ {t('common:note')}:
+ </span>
+ {t('dashboard:sidebar.personal-explanation')}
+ </div>
+ )}
+ <div className="mt-4 px-4">
+ {data[0]?.value && (
+ <div className="flex flex-row items-center justify-between my-2 pl-1 pr-2">
+ <p className="text-sm text-bunker-300">{t('dashboard:sidebar.override')}</p>
+ <Toggle
+ enabled={overrideEnabled}
+ setEnabled={setOverrideEnabled}
+ addOverride={modifyValueOverride}
+ pos={data[0]?.pos}
+ />
+ </div>
+ )}
+ <div
+ className={`relative ${
+ !overrideEnabled && 'opacity-40 pointer-events-none'
+ } duration-200`}
+ >
+ <DashboardInputField
+ onChangeHandler={modifyValueOverride}
+ type="value"
+ position={data[0]?.pos}
+ value={overrideEnabled ? data[0]?.valueOverride : data[0]?.value}
+ isDuplicate={false}
+ blurred
+ />
+ <div className="absolute right-[0.57rem] top-[0.3rem] z-50">
+ <GenerateSecretMenu modifyValue={modifyValueOverride} position={data[0]?.pos} />
+ </div>
</div>
</div>
+ <SecretVersionList secretId={data[0]?.id} />
+ <CommentField
+ comment={data[0]?.comment}
+ modifyComment={modifyComment}
+ position={data[0]?.pos}
+ />
</div>
- <SecretVersionList secretId={data[0]?.id} />
- <CommentField comment={data[0]?.comment} modifyComment={modifyComment} position={data[0]?.pos} />
+ )}
+ <div className="flex justify-start max-w-sm mt-4 px-4 mt-full mb-[4.7rem]">
+ <Button
+ text={String(t('common:save-changes'))}
+ onButtonPressed={savePush}
+ color="primary"
+ size="md"
+ active={buttonReady}
+ textDisabled="Saved"
+ />
+ <DeleteActionButton
+ onSubmit={() =>
+ deleteRow({ ids: data.map((secret) => secret.id), secretName: data[0]?.key })
+ }
+ />
</div>
- )}
- <div className={`flex justify-start max-w-sm mt-4 px-4 mt-full mb-[4.7rem]`}>
- <Button
- text={String(t("common:save-changes"))}
- onButtonPressed={savePush}
- color="primary"
- size="md"
- active={buttonReady}
- textDisabled="Saved"
- />
- <DeleteActionButton
- onSubmit={() => deleteRow({ ids: data.map(secret => secret.id), secretName: data[0]?.key })}
- />
</div>
- </div>
+ );
};
export default SideBar;
diff --git a/frontend/src/components/integrations/CloudIntegration.tsx b/frontend/src/components/integrations/CloudIntegration.tsx
index d63081d5a1..4828ed52ba 100644
--- a/frontend/src/components/integrations/CloudIntegration.tsx
+++ b/frontend/src/components/integrations/CloudIntegration.tsx
@@ -21,12 +21,8 @@ interface IntegrationAuth {
interface Props {
cloudIntegrationOption: CloudIntegrationOption;
- setSelectedIntegrationOption: (
- cloudIntegration: CloudIntegrationOption
- ) => void;
- integrationOptionPress: (
- cloudIntegrationOption: CloudIntegrationOption
- ) => void;
+ setSelectedIntegrationOption: (cloudIntegration: CloudIntegrationOption) => void;
+ integrationOptionPress: (cloudIntegrationOption: CloudIntegrationOption) => void;
integrationAuths: IntegrationAuth[];
}
@@ -34,11 +30,14 @@ const CloudIntegration = ({
cloudIntegrationOption,
setSelectedIntegrationOption,
integrationOptionPress,
- integrationAuths,
+ integrationAuths
}: Props) => {
const router = useRouter();
return integrationAuths ? (
<div
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
className={`relative ${
cloudIntegrationOption.isAvailable
? 'hover:bg-white/10 duration-200 cursor-pointer'
@@ -55,18 +54,17 @@ const CloudIntegration = ({
src={`/images/integrations/${cloudIntegrationOption.name}.png`}
height={70}
width={70}
- alt='integration logo'
+ alt="integration logo"
/>
{cloudIntegrationOption.name.split(' ').length > 2 ? (
- <div className='font-semibold text-gray-300 group-hover:text-gray-200 duration-200 text-3xl ml-4 max-w-xs'>
+ <div className="font-semibold text-gray-300 group-hover:text-gray-200 duration-200 text-3xl ml-4 max-w-xs">
<div>{cloudIntegrationOption.name.split(' ')[0]}</div>
- <div className='text-base'>
- {cloudIntegrationOption.name.split(' ')[1]}{' '}
- {cloudIntegrationOption.name.split(' ')[2]}
+ <div className="text-base">
+ {cloudIntegrationOption.name.split(' ')[1]} {cloudIntegrationOption.name.split(' ')[2]}
</div>
</div>
) : (
- <div className='font-semibold text-gray-300 group-hover:text-gray-200 duration-200 text-xl ml-4 max-w-xs'>
+ <div className="font-semibold text-gray-300 group-hover:text-gray-200 duration-200 text-xl ml-4 max-w-xs">
{cloudIntegrationOption.name}
</div>
)}
@@ -74,43 +72,45 @@ const CloudIntegration = ({
integrationAuths
.map((authorization) => authorization.integration)
.includes(cloudIntegrationOption.name.toLowerCase()) && (
- <div className='absolute group z-40 top-0 right-0 flex flex-row'>
+ <div className="absolute group z-40 top-0 right-0 flex flex-row">
<div
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
onClick={(event) => {
event.stopPropagation();
deleteIntegrationAuth({
integrationAuthId: integrationAuths
.filter(
(authorization) =>
- authorization.integration ==
- cloudIntegrationOption.name.toLowerCase()
+ authorization.integration === cloudIntegrationOption.name.toLowerCase()
)
- .map((authorization) => authorization._id)[0],
+ .map((authorization) => authorization._id)[0]
});
router.reload();
}}
- className='cursor-pointer w-max bg-red py-0.5 px-2 rounded-b-md text-xs flex flex-row items-center opacity-0 group-hover:opacity-100 duration-200'
+ className="cursor-pointer w-max bg-red py-0.5 px-2 rounded-b-md text-xs flex flex-row items-center opacity-0 group-hover:opacity-100 duration-200"
>
- <FontAwesomeIcon icon={faX} className='text-xs mr-2 py-px' />
+ <FontAwesomeIcon icon={faX} className="text-xs mr-2 py-px" />
Revoke
</div>
- <div className='w-max bg-primary py-0.5 px-2 rounded-bl-md rounded-tr-md text-xs flex flex-row items-center text-black opacity-90 group-hover:opacity-100 duration-200'>
- <FontAwesomeIcon icon={faCheck} className='text-xs mr-2' />
+ <div className="w-max bg-primary py-0.5 px-2 rounded-bl-md rounded-tr-md text-xs flex flex-row items-center text-black opacity-90 group-hover:opacity-100 duration-200">
+ <FontAwesomeIcon icon={faCheck} className="text-xs mr-2" />
Authorized
</div>
</div>
)}
{!cloudIntegrationOption.isAvailable && (
- <div className='absolute group z-50 top-0 right-0 flex flex-row'>
- <div className='w-max bg-yellow py-0.5 px-2 rounded-bl-md rounded-tr-md text-xs flex flex-row items-center text-black opacity-90'>
+ <div className="absolute group z-50 top-0 right-0 flex flex-row">
+ <div className="w-max bg-yellow py-0.5 px-2 rounded-bl-md rounded-tr-md text-xs flex flex-row items-center text-black opacity-90">
Coming Soon
</div>
</div>
)}
</div>
) : (
- <div></div>
+ <div />
);
};
diff --git a/frontend/src/components/integrations/CloudIntegrationSection.tsx b/frontend/src/components/integrations/CloudIntegrationSection.tsx
index 4bc48cf1a8..832f5e87da 100644
--- a/frontend/src/components/integrations/CloudIntegrationSection.tsx
+++ b/frontend/src/components/integrations/CloudIntegrationSection.tsx
@@ -29,7 +29,7 @@ const CloudIntegrationSection = ({
return (
<>
<div
- className={`flex flex-col justify-between items-start m-4 mt-7 text-xl max-w-5xl px-2`}
+ className="flex flex-col justify-between items-start m-4 mt-7 text-xl max-w-5xl px-2"
>
<h1 className='font-semibold text-3xl'>
{t('integrations:cloud-integrations')}
diff --git a/frontend/src/components/integrations/FrameworkIntegration.tsx b/frontend/src/components/integrations/FrameworkIntegration.tsx
index c5d922c496..cf85038274 100644
--- a/frontend/src/components/integrations/FrameworkIntegration.tsx
+++ b/frontend/src/components/integrations/FrameworkIntegration.tsx
@@ -7,33 +7,29 @@ interface Framework {
docsLink: string;
}
-const FrameworkIntegration = ({ framework }: { framework: Framework }) => {
- return (
- <a
- href={framework.docsLink}
- rel='noopener'
- className={`relative flex flex-row items-center justify-center bg-bunker-500 hover:bg-gradient-to-tr duration-200 h-32 rounded-md p-0.5 items-center cursor-pointer`}
+const FrameworkIntegration = ({ framework }: { framework: Framework }) => (
+ <a
+ href={framework.docsLink}
+ rel="noopener"
+ className="relative flex flex-row justify-center bg-bunker-500 hover:bg-gradient-to-tr duration-200 h-32 rounded-md p-0.5 items-center cursor-pointer"
+ >
+ <div
+ className={`hover:bg-white/10 cursor-pointer font-semibold bg-bunker-500 flex flex-col items-center justify-center h-full w-full rounded-md text-gray-300 group-hover:text-gray-200 duration-200 ${
+ framework?.name?.split(' ').length > 1 ? 'text-sm px-1' : 'text-xl px-2'
+ } text-center w-full max-w-xs`}
>
- <div
- className={`hover:bg-white/10 duration-200 cursor-pointer font-semibold bg-bunker-500 flex flex-col items-center justify-center h-full w-full rounded-md text-gray-300 group-hover:text-gray-200 duration-200 ${
- framework?.name?.split(' ').length > 1
- ? 'text-sm px-1'
- : 'text-xl px-2'
- } text-center w-full max-w-xs`}
- >
- {framework?.image && (
- <Image
- src={`/images/integrations/${framework.image}.png`}
- height={framework?.name ? 60 : 90}
- width={framework?.name ? 60 : 90}
- alt='integration logo'
- ></Image>
- )}
- {framework?.name && framework?.image && <div className='h-2'></div>}
- {framework?.name && framework.name}
- </div>
- </a>
- );
-};
+ {framework?.image && (
+ <Image
+ src={`/images/integrations/${framework.image}.png`}
+ height={framework?.name ? 60 : 90}
+ width={framework?.name ? 60 : 90}
+ alt="integration logo"
+ />
+ )}
+ {framework?.name && framework?.image && <div className="h-2" />}
+ {framework?.name && framework.name}
+ </div>
+ </a>
+);
export default FrameworkIntegration;
diff --git a/frontend/src/components/integrations/Integration.tsx b/frontend/src/components/integrations/Integration.tsx
index fe2e3ea219..dc7344cad8 100644
--- a/frontend/src/components/integrations/Integration.tsx
+++ b/frontend/src/components/integrations/Integration.tsx
@@ -1,33 +1,26 @@
-import { useEffect, useState } from "react";
-import { useRouter } from "next/router";
-import {
- faArrowRight,
- faRotate,
- faX,
-} from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-// TODO: This needs to be moved from public folder
-import {
- contextNetlifyMapping,
- reverseContextNetlifyMapping,
-} from "public/data/frequentConstants";
-
-import Button from "~/components/basic/buttons/Button";
-import ListBox from "~/components/basic/Listbox";
-
-import deleteIntegration from "../../pages/api/integrations/DeleteIntegration"
-import getIntegrationApps from "../../pages/api/integrations/GetIntegrationApps";
-import updateIntegration from "../../pages/api/integrations/updateIntegration"
-
-interface Integration {
- _id: string;
- app?: string;
- target?: string;
- environment: string;
- integration: string;
- integrationAuth: string;
- isActive: boolean;
- context: string;
+/* eslint-disable @typescript-eslint/no-unused-vars */
+import { useEffect, useState } from 'react';
+import { useRouter } from 'next/router';
+import Button from '@app/components/basic/buttons/Button';
+import ListBox from '@app/components/basic/Listbox';
+import { faArrowRight, faRotate, faX } from '@fortawesome/free-solid-svg-icons';
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+// TODO: This needs to be moved from public folder
+import { contextNetlifyMapping, reverseContextNetlifyMapping } from 'public/data/frequentConstants';
+
+import deleteIntegration from '../../pages/api/integrations/DeleteIntegration';
+import getIntegrationApps from '../../pages/api/integrations/GetIntegrationApps';
+import updateIntegration from '../../pages/api/integrations/updateIntegration';
+
+interface TIntegration {
+ _id: string;
+ app?: string;
+ target?: string;
+ environment: string;
+ integration: string;
+ integrationAuth: string;
+ isActive: boolean;
+ context: string;
}
interface IntegrationApp {
@@ -36,219 +29,190 @@ interface IntegrationApp {
}
type Props = {
- integration: Integration;
+ integration: TIntegration;
environments: Array<{ name: string; slug: string }>;
};
-const Integration = ({
- integration,
- environments = []
-}:Props ) => {
- // set initial environment. This find will only execute when component is mounting
- const [integrationEnvironment, setIntegrationEnvironment] = useState<
- Props['environments'][0]
- >(
- environments.find(({ slug }) => slug === integration.environment) || {
- name: '',
- slug: '',
+const Integration = ({ integration, environments = [] }: Props) => {
+ // set initial environment. This find will only execute when component is mounting
+ const [integrationEnvironment, setIntegrationEnvironment] = useState<Props['environments'][0]>(
+ environments.find(({ slug }) => slug === integration.environment) || {
+ name: '',
+ slug: ''
+ }
+ );
+ const [fileState, setFileState] = useState([]);
+ const router = useRouter();
+ const [apps, setApps] = useState<IntegrationApp[]>([]); // integration app objects
+ const [integrationApp, setIntegrationApp] = useState(''); // integration app name
+ const [integrationTarget, setIntegrationTarget] = useState(''); // vercel-specific integration param
+ const [integrationContext, setIntegrationContext] = useState(''); // netlify-specific integration param
+
+ useEffect(() => {
+ const loadIntegration = async () => {
+ interface App {
+ name: string;
+ siteId?: string;
}
- );
- const [fileState, setFileState] = useState([]);
- const router = useRouter();
- const [apps, setApps] = useState<IntegrationApp[]>([]); // integration app objects
- const [integrationApp, setIntegrationApp] = useState(""); // integration app name
- const [integrationTarget, setIntegrationTarget] = useState(""); // vercel-specific integration param
- const [integrationContext, setIntegrationContext] = useState(""); // netlify-specific integration param
-
- useEffect(() => {
-
- const loadIntegration = async () => {
- interface App {
- name: string;
- siteId?: string;
- }
-
- const tempApps: [IntegrationApp] = await getIntegrationApps({
- integrationAuthId: integration.integrationAuth,
- });
-
- setApps(tempApps);
- setIntegrationApp(
- integration.app ? integration.app : tempApps[0].name
- );
-
- switch (integration.integration) {
- case "vercel":
- setIntegrationTarget(
- integration?.target
- ? integration.target.charAt(0).toUpperCase() + integration.target.substring(1)
- : "Development"
- );
- break;
- case "netlify":
- setIntegrationContext(integration?.context ? contextNetlifyMapping[integration.context] : "Local development");
- break;
- default:
- break;
- }
+
+ const tempApps: [IntegrationApp] = await getIntegrationApps({
+ integrationAuthId: integration.integrationAuth
+ });
+
+ setApps(tempApps);
+ setIntegrationApp(integration.app ? integration.app : tempApps[0].name);
+
+ switch (integration.integration) {
+ case 'vercel':
+ setIntegrationTarget(
+ integration?.target
+ ? integration.target.charAt(0).toUpperCase() + integration.target.substring(1)
+ : 'Development'
+ );
+ break;
+ case 'netlify':
+ setIntegrationContext(
+ integration?.context ? contextNetlifyMapping[integration.context] : 'Local development'
+ );
+ break;
+ default:
+ break;
}
+ };
+
+ loadIntegration();
+ }, []);
- loadIntegration();
- }, []);
-
- const renderIntegrationSpecificParams = (integration: Integration) => {
- try {
- switch (integration.integration) {
- case "vercel":
- return (
- <div>
- <div className="text-gray-400 text-xs font-semibold mb-2 w-60">
- ENVIRONMENT
- </div>
- <ListBox
- data={!integration.isActive ? [
- "Development",
- "Preview",
- "Production"
- ] : null}
- selected={integrationTarget}
- onChange={setIntegrationTarget}
- isFull={true}
- />
+ // eslint-disable-next-line @typescript-eslint/no-shadow
+ const renderIntegrationSpecificParams = (integration: TIntegration) => {
+ try {
+ switch (integration.integration) {
+ case 'vercel':
+ return (
+ <div>
+ <div className="text-gray-400 text-xs font-semibold mb-2 w-60">ENVIRONMENT</div>
+ <ListBox
+ data={!integration.isActive ? ['Development', 'Preview', 'Production'] : null}
+ selected={integrationTarget}
+ onChange={setIntegrationTarget}
+ isFull
+ />
+ </div>
+ );
+ case 'netlify':
+ return (
+ <div>
+ <div className="text-gray-400 text-xs font-semibold mb-2">CONTEXT</div>
+ <ListBox
+ data={
+ !integration.isActive
+ ? ['Production', 'Deploy previews', 'Branch deploys', 'Local development']
+ : null
+ }
+ selected={integrationContext}
+ onChange={setIntegrationContext}
+ />
</div>
- );
- case "netlify":
- return (
- <div>
- <div className="text-gray-400 text-xs font-semibold mb-2">
- CONTEXT
- </div>
- <ListBox
- data={!integration.isActive ? [
- "Production",
- "Deploy previews",
- "Branch deploys",
- "Local development"
- ] : null}
- selected={integrationContext}
- onChange={setIntegrationContext}
- />
- </div>
- );
- default:
- return <div></div>;
- }
- } catch (err) {
- console.error(err);
+ );
+ default:
+ return <div />;
}
+ } catch (err) {
+ console.error(err);
}
-
- if (!integrationApp || apps.length === 0) return <div></div>
-
- return (
- <div className='max-w-5xl p-6 mx-6 mb-8 rounded-md bg-white/5 flex justify-between'>
- <div className='flex'>
- <div>
- <p className='text-gray-400 text-xs font-semibold mb-2'>
- ENVIRONMENT
- </p>
- <ListBox
- data={
- !integration.isActive
- ? environments.map(({ name }) => name)
- : null
- }
- selected={integrationEnvironment.name}
- onChange={(envName) =>
- setIntegrationEnvironment(
- environments.find(({ name }) => envName === name) || {
- name: 'unknown',
- slug: 'unknown',
- }
- )
- }
- isFull={true}
- />
- </div>
- <div className='pt-2'>
- <FontAwesomeIcon
- icon={faArrowRight}
- className='mx-4 text-gray-400 mt-8'
- />
- </div>
- <div className='mr-2'>
- <p className='text-gray-400 text-xs font-semibold mb-2'>
- INTEGRATION
- </p>
- <div className='py-2.5 bg-white/[.07] rounded-md pl-4 pr-10 text-sm font-semibold text-gray-300'>
- {integration.integration.charAt(0).toUpperCase() +
- integration.integration.slice(1)}
- </div>
- </div>
- <div className='mr-2'>
- <div className='text-gray-400 text-xs font-semibold mb-2'>APP</div>
- <ListBox
- data={!integration.isActive ? apps.map((app) => app.name) : null}
- selected={integrationApp}
- onChange={(app) => {
- setIntegrationApp(app);
- }}
- />
+
+ return <div />;
+ };
+
+ if (!integrationApp || apps.length === 0) return <div />;
+
+ return (
+ <div className="max-w-5xl p-6 mx-6 mb-8 rounded-md bg-white/5 flex justify-between">
+ <div className="flex">
+ <div>
+ <p className="text-gray-400 text-xs font-semibold mb-2">ENVIRONMENT</p>
+ <ListBox
+ data={!integration.isActive ? environments.map(({ name }) => name) : null}
+ selected={integrationEnvironment.name}
+ onChange={(envName) =>
+ setIntegrationEnvironment(
+ environments.find(({ name }) => envName === name) || {
+ name: 'unknown',
+ slug: 'unknown'
+ }
+ )
+ }
+ isFull
+ />
+ </div>
+ <div className="pt-2">
+ <FontAwesomeIcon icon={faArrowRight} className="mx-4 text-gray-400 mt-8" />
+ </div>
+ <div className="mr-2">
+ <p className="text-gray-400 text-xs font-semibold mb-2">INTEGRATION</p>
+ <div className="py-2.5 bg-white/[.07] rounded-md pl-4 pr-10 text-sm font-semibold text-gray-300">
+ {integration.integration.charAt(0).toUpperCase() + integration.integration.slice(1)}
</div>
- {renderIntegrationSpecificParams(integration)}
</div>
- <div className='flex items-end'>
- {integration.isActive ? (
- <div className='max-w-5xl flex flex-row items-center bg-white/5 p-2 rounded-md px-4'>
- <FontAwesomeIcon
- icon={faRotate}
- className='text-lg mr-2.5 text-primary animate-spin'
- />
- <div className='text-gray-300 font-semibold'>In Sync</div>
- </div>
- ) : (
- <Button
- text='Start Integration'
- onButtonPressed={async () => {
- const siteApp = apps.find((app) => app.name === integrationApp); // obj or undefined
- const siteId = siteApp?.siteId ? siteApp.siteId : null;
-
- await updateIntegration({
- integrationId: integration._id,
- environment: integrationEnvironment.slug,
- app: integrationApp,
- isActive: true,
- target: integrationTarget
- ? integrationTarget.toLowerCase()
- : null,
- context: integrationContext
- ? reverseContextNetlifyMapping[integrationContext]
- : null,
- siteId,
- });
-
- router.reload();
- }}
- color='mineshaft'
- size='md'
- />
- )}
- <div className='opacity-50 hover:opacity-100 duration-200 ml-2'>
- <Button
- onButtonPressed={async () => {
- await deleteIntegration({
- integrationId: integration._id,
- });
- router.reload();
- }}
- color='red'
- size='icon-md'
- icon={faX}
- />
+ <div className="mr-2">
+ <div className="text-gray-400 text-xs font-semibold mb-2">APP</div>
+ <ListBox
+ data={!integration.isActive ? apps.map((app) => app.name) : null}
+ selected={integrationApp}
+ onChange={(app) => {
+ setIntegrationApp(app);
+ }}
+ />
+ </div>
+ {renderIntegrationSpecificParams(integration)}
+ </div>
+ <div className="flex items-end">
+ {integration.isActive ? (
+ <div className="max-w-5xl flex flex-row items-center bg-white/5 p-2 rounded-md px-4">
+ <FontAwesomeIcon icon={faRotate} className="text-lg mr-2.5 text-primary animate-spin" />
+ <div className="text-gray-300 font-semibold">In Sync</div>
</div>
+ ) : (
+ <Button
+ text="Start Integration"
+ onButtonPressed={async () => {
+ const siteApp = apps.find((app) => app.name === integrationApp); // obj or undefined
+ const siteId = siteApp?.siteId ? siteApp.siteId : null;
+
+ await updateIntegration({
+ integrationId: integration._id,
+ environment: integrationEnvironment.slug,
+ app: integrationApp,
+ isActive: true,
+ target: integrationTarget ? integrationTarget.toLowerCase() : null,
+ context: integrationContext
+ ? reverseContextNetlifyMapping[integrationContext]
+ : null,
+ siteId
+ });
+
+ router.reload();
+ }}
+ color="mineshaft"
+ size="md"
+ />
+ )}
+ <div className="opacity-50 hover:opacity-100 duration-200 ml-2">
+ <Button
+ onButtonPressed={async () => {
+ await deleteIntegration({
+ integrationId: integration._id
+ });
+ router.reload();
+ }}
+ color="red"
+ size="icon-md"
+ icon={faX}
+ />
</div>
</div>
- );
- };
+ </div>
+ );
+};
-export default Integration;
\ No newline at end of file
+export default Integration;
diff --git a/frontend/src/components/integrations/IntegrationSection.tsx b/frontend/src/components/integrations/IntegrationSection.tsx
index 026b543ce7..1862bd8062 100644
--- a/frontend/src/components/integrations/IntegrationSection.tsx
+++ b/frontend/src/components/integrations/IntegrationSection.tsx
@@ -1,4 +1,4 @@
-import guidGenerator from '~/utilities/randomId';
+import guidGenerator from '@app/components/utilities/randomId';
import Integration from './Integration';
@@ -17,29 +17,21 @@ interface IntegrationType {
context: string;
}
-const ProjectIntegrationSection = ({
- integrations,
- environments = [],
-}: Props) => {
- return integrations.length > 0 ? (
- <div className='mb-12'>
- <div className='flex flex-col justify-between items-start mx-4 mb-4 mt-6 text-xl max-w-5xl px-2'>
- <h1 className='font-semibold text-3xl'>Current Integrations</h1>
- <p className='text-base text-gray-400'>
+const ProjectIntegrationSection = ({ integrations, environments = [] }: Props) =>
+ integrations.length > 0 ? (
+ <div className="mb-12">
+ <div className="flex flex-col justify-between items-start mx-4 mb-4 mt-6 text-xl max-w-5xl px-2">
+ <h1 className="font-semibold text-3xl">Current Integrations</h1>
+ <p className="text-base text-gray-400">
Manage your integrations of Infisical with third-party services.
</p>
</div>
{integrations.map((integration: IntegrationType) => (
- <Integration
- key={guidGenerator()}
- integration={integration}
- environments={environments}
- />
+ <Integration key={guidGenerator()} integration={integration} environments={environments} />
))}
</div>
) : (
- <div></div>
+ <div />
);
-};
export default ProjectIntegrationSection;
diff --git a/frontend/src/components/navigation/NavBarDashboard.tsx b/frontend/src/components/navigation/NavBarDashboard.tsx
index c4e66a5c04..4f67f89cc7 100644
--- a/frontend/src/components/navigation/NavBarDashboard.tsx
+++ b/frontend/src/components/navigation/NavBarDashboard.tsx
@@ -1,10 +1,12 @@
+/* eslint-disable jsx-a11y/anchor-is-valid */
/* eslint-disable react/jsx-key */
-import { Fragment, useEffect, useMemo, useState } from "react";
-import Image from "next/image";
-import { useRouter } from "next/router";
-import { TFunction, useTranslation } from "next-i18next";
-import { faGithub, faSlack } from "@fortawesome/free-brands-svg-icons";
-import { faCircleQuestion } from "@fortawesome/free-regular-svg-icons";
+import { Fragment, useEffect, useMemo, useState } from 'react';
+import Image from 'next/image';
+import { useRouter } from 'next/router';
+import { TFunction, useTranslation } from 'next-i18next';
+import logout from '@app/pages/api/auth/Logout';
+import { faGithub, faSlack } from '@fortawesome/free-brands-svg-icons';
+import { faCircleQuestion } from '@fortawesome/free-regular-svg-icons';
import {
faAngleDown,
faBook,
@@ -12,40 +14,37 @@ import {
faEnvelope,
faGear,
faPlus,
- faRightFromBracket,
- faUpRightFromSquare,
-} from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
-import { Menu, Transition } from "@headlessui/react";
+ faRightFromBracket
+} from '@fortawesome/free-solid-svg-icons';
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
+import { Menu, Transition } from '@headlessui/react';
-import logout from "~/pages/api/auth/Logout";
-
-import getOrganization from "../../pages/api/organization/GetOrg";
-import getOrganizations from "../../pages/api/organization/getOrgs";
-import getUser from "../../pages/api/user/getUser";
-import guidGenerator from "../utilities/randomId";
+import getOrganization from '../../pages/api/organization/GetOrg';
+import getOrganizations from '../../pages/api/organization/getOrgs';
+import getUser from '../../pages/api/user/getUser';
+import guidGenerator from '../utilities/randomId';
const supportOptions = (t: TFunction) => [
[
<FontAwesomeIcon className="text-lg pl-1.5 pr-3" icon={faSlack} />,
- t("nav:support.slack"),
- "https://join.slack.com/t/infisical/shared_invite/zt-1dgg63ln8-G7PCNJdCymAT9YF3j1ewVA",
+ t('nav:support.slack'),
+ 'https://join.slack.com/t/infisical/shared_invite/zt-1dgg63ln8-G7PCNJdCymAT9YF3j1ewVA'
],
[
<FontAwesomeIcon className="text-lg pl-1.5 pr-3" icon={faBook} />,
- t("nav:support.docs"),
- "https://infisical.com/docs/getting-started/introduction",
+ t('nav:support.docs'),
+ 'https://infisical.com/docs/getting-started/introduction'
],
[
<FontAwesomeIcon className="text-lg pl-1.5 pr-3" icon={faGithub} />,
- t("nav:support.issue"),
- "https://github.com/Infisical/infisical-cli/issues",
+ t('nav:support.issue'),
+ 'https://github.com/Infisical/infisical-cli/issues'
],
[
<FontAwesomeIcon className="text-lg pl-1.5 pr-3" icon={faEnvelope} />,
- t("nav:support.email"),
- "mailto:[email protected]",
- ],
+ t('nav:support.email'),
+ ]
];
export interface ICurrentOrg {
@@ -79,17 +78,17 @@ export default function Navbar() {
setUser(userData);
const orgsData = await getOrganizations();
setOrgs(orgsData);
- const currentOrg = await getOrganization({
- orgId: String(localStorage.getItem("orgData.id")),
+ const currentUserOrg = await getOrganization({
+ orgId: String(localStorage.getItem('orgData.id'))
});
- setCurrentOrg(currentOrg);
+ setCurrentOrg(currentUserOrg);
})();
}, []);
const closeApp = async () => {
- console.log("Logging out...");
+ console.log('Logging out...');
await logout();
- router.push("/login");
+ router.push('/login');
};
return (
@@ -97,28 +96,26 @@ export default function Navbar() {
<div className="m-auto flex justify-start items-center mx-4">
<div className="flex flex-row items-center">
<div className="flex justify-center py-4">
- <Image
- src="/images/logotransparent.png"
- height={23}
- width={57}
- alt="logo"
- />
+ <Image src="/images/logotransparent.png" height={23} width={57} alt="logo" />
</div>
- <a className="text-2xl text-white font-semibold mx-2">Infisical</a>
+ <a href="#" className="text-2xl text-white font-semibold mx-2">
+ Infisical
+ </a>
</div>
</div>
<div className="relative flex justify-start items-center mx-2 z-40">
- <a
+ <a
href="https://infisical.com/docs/getting-started/introduction"
target="_blank"
rel="noopener noreferrer"
- className="text-gray-200 hover:bg-white/10 px-3 rounded-md duration-200 text-sm mr-4 py-2 flex items-center">
+ className="text-gray-200 hover:bg-white/10 px-3 rounded-md duration-200 text-sm mr-4 py-2 flex items-center"
+ >
<FontAwesomeIcon icon={faBook} className="text-xl mr-2" />
- Docs
+ Docs
</a>
<Menu as="div" className="relative inline-block text-left">
<div className="mr-4">
- <Menu.Button className="inline-flex w-full justify-center rounded-md px-2 py-2 text-sm font-medium text-gray-200 rounded-md hover:bg-white/10 duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75">
+ <Menu.Button className="inline-flex w-full justify-center px-2 py-2 text-sm font-medium text-gray-200 rounded-md hover:bg-white/10 duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75">
<FontAwesomeIcon className="text-xl" icon={faCircleQuestion} />
</Menu.Button>
</div>
@@ -151,7 +148,7 @@ export default function Navbar() {
</Menu>
<Menu as="div" className="relative inline-block text-left mr-4">
<div>
- <Menu.Button className="inline-flex w-full justify-center rounded-md pr-2 pl-2 py-2 text-sm font-medium text-gray-200 rounded-md hover:bg-white/10 duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75">
+ <Menu.Button className="inline-flex w-full justify-center pr-2 pl-2 py-2 text-sm font-medium text-gray-200 rounded-md hover:bg-white/10 duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75">
{user?.firstName} {user?.lastName}
<FontAwesomeIcon
icon={faAngleDown}
@@ -171,12 +168,13 @@ export default function Navbar() {
<Menu.Items className="absolute right-0 mt-0.5 w-64 origin-top-right divide-y divide-gray-700 rounded-md bg-bunker border border-mineshaft-700 shadow-lg ring-1 ring-black z-20 ring-opacity-5 focus:outline-none">
<div className="px-1 py-1 ">
<div className="text-gray-400 self-start ml-2 mt-2 text-xs font-semibold tracking-wide">
- {t("nav:user.signed-in-as")}
+ {t('nav:user.signed-in-as')}
</div>
<div
- onClick={() =>
- router.push("/settings/personal/" + router.query.id)
- }
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
+ onClick={() => router.push(`/settings/personal/${router.query.id}`)}
className="flex flex-row items-center px-1 mx-1 my-1 hover:bg-white/5 cursor-pointer rounded-md"
>
<div className="bg-white/10 h-8 w-9 rounded-full flex items-center justify-center text-gray-300">
@@ -185,13 +183,10 @@ export default function Navbar() {
<div className="flex items-center justify-between w-full">
<div>
<p className="text-gray-300 px-2 pt-1 text-sm">
- {" "}
+ {' '}
{user?.firstName} {user?.lastName}
</p>
- <p className="text-gray-400 px-2 pb-1 text-xs">
- {" "}
- {user?.email}
- </p>
+ <p className="text-gray-400 px-2 pb-1 text-xs"> {user?.email}</p>
</div>
<FontAwesomeIcon
icon={faGear}
@@ -202,21 +197,20 @@ export default function Navbar() {
</div>
<div className="px-2 pt-2">
<div className="text-gray-400 self-start ml-2 mt-2 text-xs font-semibold tracking-wide">
- {t("nav:user.current-organization")}
+ {t('nav:user.current-organization')}
</div>
<div
- onClick={() =>
- router.push("/settings/org/" + router.query.id)
- }
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
+ onClick={() => router.push(`/settings/org/${router.query.id}`)}
className="flex flex-row items-center px-2 mt-2 py-1 hover:bg-white/5 cursor-pointer rounded-md"
>
<div className="bg-white/10 h-7 w-8 rounded-md flex items-center justify-center text-gray-300">
{currentOrg?.name?.charAt(0)}
</div>
<div className="flex items-center justify-between w-full">
- <p className="text-gray-300 px-2 text-sm">
- {currentOrg?.name}
- </p>
+ <p className="text-gray-300 px-2 text-sm">{currentOrg?.name}</p>
<FontAwesomeIcon
icon={faGear}
className="text-lg text-gray-400 p-2 rounded-md cursor-pointer hover:bg-white/10"
@@ -225,56 +219,57 @@ export default function Navbar() {
</div>
<button
// onClick={buttonAction}
+ type="button"
className="cursor-pointer w-full"
>
<div
- onClick={() =>
- router.push("/settings/billing/" + router.query.id)
- }
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
+ onClick={() => router.push(`/settings/billing/${router.query.id}`)}
className="mt-1 relative flex justify-start cursor-pointer select-none py-2 px-2 rounded-md text-gray-400 hover:bg-white/5 duration-200 hover:text-gray-200"
>
- <FontAwesomeIcon
- className="text-lg pl-1.5 pr-3"
- icon={faCoins}
- />
- <div className="text-sm">{t("nav:user.usage-billing")}</div>
+ <FontAwesomeIcon className="text-lg pl-1.5 pr-3" icon={faCoins} />
+ <div className="text-sm">{t('nav:user.usage-billing')}</div>
</div>
</button>
<button
+ type="button"
// onClick={buttonAction}
className="cursor-pointer w-full mb-2"
>
<div
- onClick={() =>
- router.push(
- "/settings/org/" + router.query.id + "?invite"
- )
- }
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
+ onClick={() => router.push(`/settings/org/${router.query.id}?invite`)}
className="relative flex justify-start cursor-pointer select-none py-2 pl-10 pr-4 rounded-md text-gray-400 hover:bg-primary/100 duration-200 hover:text-black hover:font-semibold mt-1"
>
<span className="rounded-lg absolute inset-y-0 left-0 flex items-center pl-3 pr-4">
<FontAwesomeIcon icon={faPlus} className="ml-1" />
</span>
- <div className="text-sm ml-1">{t("nav:user.invite")}</div>
+ <div className="text-sm ml-1">{t('nav:user.invite')}</div>
</div>
</button>
</div>
{orgs?.length > 1 && (
<div className="px-1 pt-1">
<div className="text-gray-400 self-start ml-2 mt-2 text-xs font-semibold tracking-wide">
- {t("nav:user.other-organizations")}
+ {t('nav:user.other-organizations')}
</div>
<div className="flex flex-col items-start px-1 mt-3 mb-2">
{orgs
.filter(
- (org: { _id: string }) =>
- org._id != localStorage.getItem("orgData.id")
+ (org: { _id: string }) => org._id !== localStorage.getItem('orgData.id')
)
.map((org: { _id: string; name: string }) => (
<div
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
key={guidGenerator()}
onClick={() => {
- localStorage.setItem("orgData.id", org._id);
+ localStorage.setItem('orgData.id', org._id);
router.reload();
}}
className="flex flex-row justify-start items-center hover:bg-white/5 w-full p-1.5 cursor-pointer rounded-md"
@@ -283,9 +278,7 @@ export default function Navbar() {
{org.name.charAt(0)}
</div>
<div className="flex items-center justify-between w-full">
- <p className="text-gray-300 px-2 text-sm">
- {org.name}
- </p>
+ <p className="text-gray-300 px-2 text-sm">{org.name}</p>
</div>
</div>
))}
@@ -296,11 +289,10 @@ export default function Navbar() {
<Menu.Item>
{({ active }) => (
<button
+ type="button"
onClick={closeApp}
className={`${
- active
- ? "bg-red font-semibold text-white"
- : "text-gray-400"
+ active ? 'bg-red font-semibold text-white' : 'text-gray-400'
} group flex w-full items-center rounded-md px-2 py-2 text-sm`}
>
<div className="relative flex justify-start items-center cursor-pointer select-none">
@@ -308,7 +300,7 @@ export default function Navbar() {
className="text-lg ml-1.5 mr-3"
icon={faRightFromBracket}
/>
- {t("common:logout")}
+ {t('common:logout')}
</div>
</button>
)}
diff --git a/frontend/src/components/navigation/NavHeader.tsx b/frontend/src/components/navigation/NavHeader.tsx
index 8c1721be34..115bba26be 100644
--- a/frontend/src/components/navigation/NavHeader.tsx
+++ b/frontend/src/components/navigation/NavHeader.tsx
@@ -1,11 +1,10 @@
import { useEffect, useState } from 'react';
import { useRouter } from 'next/router';
+import getOrganization from '@app/pages/api/organization/GetOrg';
+import getProjectInfo from '@app/pages/api/workspace/getProjectInfo';
import { faAngleRight } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import getOrganization from '~/pages/api/organization/GetOrg';
-import getProjectInfo from '~/pages/api/workspace/getProjectInfo';
-
/**
* This is the component at the top of almost every page.
* It shows how to navigate to a certain page.
@@ -17,7 +16,7 @@ import getProjectInfo from '~/pages/api/workspace/getProjectInfo';
*/
export default function NavHeader({
pageName,
- isProjectRelated,
+ isProjectRelated
}: {
pageName: string;
isProjectRelated?: boolean;
@@ -30,12 +29,12 @@ export default function NavHeader({
(async () => {
const orgId = localStorage.getItem('orgData.id');
const org = await getOrganization({
- orgId: orgId ? orgId : '',
+ orgId: orgId || ''
});
setOrgName(org.name);
const workspace = await getProjectInfo({
- projectId: String(router.query.id),
+ projectId: String(router.query.id)
});
setWorkspaceName(workspace.name);
})();
@@ -43,27 +42,19 @@ export default function NavHeader({
}, []);
return (
- <div className='pt-20 ml-6 flex flex-row items-center'>
- <div className='bg-primary-900 h-6 w-6 rounded-md flex items-center justify-center text-mineshaft-100 mr-2'>
+ <div className="pt-20 ml-6 flex flex-row items-center">
+ <div className="bg-primary-900 h-6 w-6 rounded-md flex items-center justify-center text-mineshaft-100 mr-2">
{orgName?.charAt(0)}
</div>
- <div className='text-primary text-sm font-semibold'>{orgName}</div>
+ <div className="text-primary text-sm font-semibold">{orgName}</div>
{isProjectRelated && (
<>
- <FontAwesomeIcon
- icon={faAngleRight}
- className='ml-3 text-sm text-gray-400 mr-3'
- />
- <div className='font-semibold text-primary text-sm'>
- {workspaceName}
- </div>
+ <FontAwesomeIcon icon={faAngleRight} className="ml-3 text-sm text-gray-400 mr-3" />
+ <div className="font-semibold text-primary text-sm">{workspaceName}</div>
</>
)}
- <FontAwesomeIcon
- icon={faAngleRight}
- className='ml-3 text-sm text-gray-400 mr-3'
- />
- <div className='text-gray-400 text-sm'>{pageName}</div>
+ <FontAwesomeIcon icon={faAngleRight} className="ml-3 text-sm text-gray-400 mr-3" />
+ <div className="text-gray-400 text-sm">{pageName}</div>
</div>
);
}
diff --git a/frontend/src/components/signup/CodeInputStep.tsx b/frontend/src/components/signup/CodeInputStep.tsx
index 9cb1aa5502..6a93010838 100644
--- a/frontend/src/components/signup/CodeInputStep.tsx
+++ b/frontend/src/components/signup/CodeInputStep.tsx
@@ -1,49 +1,48 @@
-import React, { useState } from "react";
-import ReactCodeInput from "react-code-input";
-import { useTranslation } from "next-i18next";
-
-import sendVerificationEmail from "~/pages/api/auth/SendVerificationEmail";
-
-import Button from "../basic/buttons/Button";
-import Error from "../basic/Error";
+/* eslint-disable react/jsx-props-no-spreading */
+import React, { useState } from 'react';
+import ReactCodeInput from 'react-code-input';
+import { useTranslation } from 'next-i18next';
+import sendVerificationEmail from '@app/pages/api/auth/SendVerificationEmail';
+import Button from '../basic/buttons/Button';
+import Error from '../basic/Error';
// The style for the verification code input
const props = {
inputStyle: {
- fontFamily: "monospace",
- margin: "4px",
- MozAppearance: "textfield",
- width: "55px",
- borderRadius: "5px",
- fontSize: "24px",
- height: "55px",
- paddingLeft: "7",
- backgroundColor: "#0d1117",
- color: "white",
- border: "1px solid #2d2f33",
- textAlign: "center",
- outlineColor: "#8ca542",
- borderColor: "#2d2f33"
- },
+ fontFamily: 'monospace',
+ margin: '4px',
+ MozAppearance: 'textfield',
+ width: '55px',
+ borderRadius: '5px',
+ fontSize: '24px',
+ height: '55px',
+ paddingLeft: '7',
+ backgroundColor: '#0d1117',
+ color: 'white',
+ border: '1px solid #2d2f33',
+ textAlign: 'center',
+ outlineColor: '#8ca542',
+ borderColor: '#2d2f33'
+ }
} as const;
const propsPhone = {
inputStyle: {
- fontFamily: "monospace",
- margin: "4px",
- MozAppearance: "textfield",
- width: "40px",
- borderRadius: "5px",
- fontSize: "24px",
- height: "40px",
- paddingLeft: "7",
- backgroundColor: "#0d1117",
- color: "white",
- border: "1px solid #2d2f33",
- textAlign: "center",
- outlineColor: "#8ca542",
- borderColor: "#2d2f33"
- },
+ fontFamily: 'monospace',
+ margin: '4px',
+ MozAppearance: 'textfield',
+ width: '40px',
+ borderRadius: '5px',
+ fontSize: '24px',
+ height: '40px',
+ paddingLeft: '7',
+ backgroundColor: '#0d1117',
+ color: 'white',
+ border: '1px solid #2d2f33',
+ textAlign: 'center',
+ outlineColor: '#8ca542',
+ borderColor: '#2d2f33'
+ }
} as const;
interface CodeInputStepProps {
@@ -55,17 +54,21 @@ interface CodeInputStepProps {
/**
* This is the second step of sign up where users need to verify their email
- * @param {object} obj
+ * @param {object} obj
* @param {string} obj.email - user's email to which we just sent a verification email
* @param {function} obj.incrementStep - goes to the next step of signup
* @param {function} obj.setCode - state updating function that set the current value of the emai verification code
* @param {boolean} obj.codeError - whether the code was inputted wrong or now
- * @returns
+ * @returns
*/
-export default function CodeInputStep({ email, incrementStep, setCode, codeError }: CodeInputStepProps): JSX.Element {
+export default function CodeInputStep({
+ email,
+ incrementStep,
+ setCode,
+ codeError
+}: CodeInputStepProps): JSX.Element {
const [isLoading, setIsLoading] = useState(false);
- const [isResendingVerificationEmail, setIsResendingVerificationEmail] =
- useState(false);
+ const [isResendingVerificationEmail, setIsResendingVerificationEmail] = useState(false);
const { t } = useTranslation();
const resendVerificationEmail = async () => {
@@ -80,12 +83,8 @@ export default function CodeInputStep({ email, incrementStep, setCode, codeError
return (
<div className="bg-bunker w-max mx-auto h-7/12 pt-10 pb-4 px-8 rounded-xl drop-shadow-xl mb-64 md:mb-16">
- <p className="text-l flex justify-center text-bunker-300">
- {t("signup:step2-message")}
- </p>
- <p className="text-l flex justify-center font-semibold my-2 text-bunker-300">
- {email}{" "}
- </p>
+ <p className="text-l flex justify-center text-bunker-300">{t('signup:step2-message')}</p>
+ <p className="text-l flex justify-center font-semibold my-2 text-bunker-300">{email} </p>
<div className="hidden md:block">
<ReactCodeInput
name=""
@@ -108,28 +107,28 @@ export default function CodeInputStep({ email, incrementStep, setCode, codeError
className="mt-2 mb-6"
/>
</div>
- {codeError && <Error text={t("signup:step2-code-error")} />}
+ {codeError && <Error text={t('signup:step2-code-error')} />}
<div className="flex max-w-max min-w-28 flex-col items-center justify-center md:p-2 max-h-24 mx-auto text-lg px-4 mt-4 mb-2">
- <Button
- text={t("signup:verify") ?? ""}
- onButtonPressed={incrementStep}
- size="lg"
- />
+ <Button text={t('signup:verify') ?? ''} onButtonPressed={incrementStep} size="lg" />
</div>
<div className="flex flex-col items-center justify-center w-full max-h-24 max-w-md mx-auto pt-2">
<div className="flex flex-row items-baseline gap-1 text-sm">
- <span className="text-bunker-400">
- {t("signup:step2-resend-alert")}
- </span>
- <u className={`font-normal ${isResendingVerificationEmail ? 'text-bunker-400' : 'text-primary-700 hover:text-primary duration-200'}`}>
- <button disabled={isLoading} onClick={resendVerificationEmail}>
- {isResendingVerificationEmail ? t("signup:step2-resend-progress") : t("signup:step2-resend-submit")}
+ <span className="text-bunker-400">{t('signup:step2-resend-alert')}</span>
+ <u
+ className={`font-normal ${
+ isResendingVerificationEmail
+ ? 'text-bunker-400'
+ : 'text-primary-700 hover:text-primary duration-200'
+ }`}
+ >
+ <button disabled={isLoading} onClick={resendVerificationEmail} type="button">
+ {isResendingVerificationEmail
+ ? t('signup:step2-resend-progress')
+ : t('signup:step2-resend-submit')}
</button>
</u>
</div>
- <p className="text-sm text-bunker-400 pb-2">
- {t("signup:step2-spam-alert")}
- </p>
+ <p className="text-sm text-bunker-400 pb-2">{t('signup:step2-spam-alert')}</p>
</div>
</div>
);
diff --git a/frontend/src/components/signup/DonwloadBackupPDFStep.tsx b/frontend/src/components/signup/DonwloadBackupPDFStep.tsx
index 97905e450f..664420c3bd 100644
--- a/frontend/src/components/signup/DonwloadBackupPDFStep.tsx
+++ b/frontend/src/components/signup/DonwloadBackupPDFStep.tsx
@@ -25,37 +25,37 @@ export default function DonwloadBackupPDFStep({
incrementStep,
email,
password,
- name,
+ name
}: DownloadBackupPDFStepProps): JSX.Element {
const { t } = useTranslation();
return (
- <div className='bg-bunker flex flex-col items-center w-full max-w-xs md:max-w-lg mx-auto h-7/12 py-8 px-4 md:px-6 mx-1 mb-36 md:mb-16 rounded-xl drop-shadow-xl'>
- <p className='text-4xl text-center font-semibold flex justify-center text-transparent bg-clip-text bg-gradient-to-br from-sky-400 to-primary'>
+ <div className="bg-bunker flex flex-col items-center w-full max-w-xs md:max-w-lg h-7/12 py-8 px-4 md:px-6 mx-1 mb-36 md:mb-16 rounded-xl drop-shadow-xl">
+ <p className="text-4xl text-center font-semibold flex justify-center text-transparent bg-clip-text bg-gradient-to-br from-sky-400 to-primary">
{t('signup:step4-message')}
</p>
- <div className='flex flex-col items-center justify-center w-full mt-4 md:mt-8 max-w-md text-gray-400 text-md rounded-md px-2'>
+ <div className="flex flex-col items-center justify-center w-full mt-4 md:mt-8 max-w-md text-gray-400 text-md rounded-md px-2">
<div>{t('signup:step4-description1')}</div>
- <div className='mt-3'>{t('signup:step4-description2')}</div>
+ <div className="mt-3">{t('signup:step4-description2')}</div>
</div>
- <div className='w-full p-2 flex flex-row items-center bg-white/10 text-gray-400 rounded-md max-w-xs md:max-w-md mx-auto mt-4'>
- <FontAwesomeIcon icon={faWarning} className='ml-2 mr-4 text-4xl' />
+ <div className="w-full p-2 flex flex-row items-center bg-white/10 text-gray-400 rounded-md max-w-xs md:max-w-md mx-auto mt-4">
+ <FontAwesomeIcon icon={faWarning} className="ml-2 mr-4 text-4xl" />
{t('signup:step4-description3')}
</div>
- <div className='flex flex-col items-center justify-center md:px-4 md:py-5 mt-2 px-2 py-3 max-h-24 max-w-max mx-auto text-lg'>
+ <div className="flex flex-col items-center justify-center md:px-4 md:py-5 mt-2 px-2 py-3 max-h-24 max-w-max mx-auto text-lg">
<Button
- text='Download PDF'
+ text="Download PDF"
onButtonPressed={async () => {
await issueBackupKey({
email,
password,
personalName: name,
- setBackupKeyError: (value: boolean) => {},
- setBackupKeyIssued: (value: boolean) => {},
+ setBackupKeyError: () => {},
+ setBackupKeyIssued: () => {}
});
incrementStep();
}}
- size='lg'
+ size="lg"
/>
</div>
</div>
diff --git a/frontend/src/components/signup/EnterEmailStep.tsx b/frontend/src/components/signup/EnterEmailStep.tsx
index 1b9177580f..3b6a4c62cc 100644
--- a/frontend/src/components/signup/EnterEmailStep.tsx
+++ b/frontend/src/components/signup/EnterEmailStep.tsx
@@ -1,30 +1,32 @@
-import React, { useState } from "react";
-import Link from "next/link";
-import { useTranslation } from "next-i18next";
-
-import sendVerificationEmail from "~/pages/api/auth/SendVerificationEmail";
-
-import Button from "../basic/buttons/Button";
-import InputField from "../basic/InputField";
+import React, { useState } from 'react';
+import Link from 'next/link';
+import { useTranslation } from 'next-i18next';
+import sendVerificationEmail from '@app/pages/api/auth/SendVerificationEmail';
+import Button from '../basic/buttons/Button';
+import InputField from '../basic/InputField';
interface DownloadBackupPDFStepProps {
incrementStep: () => void;
- email: string;
+ email: string;
setEmail: (value: string) => void;
}
/**
* This is the first step of the sign up process - users need to enter their email
- * @param {object} obj
+ * @param {object} obj
* @param {string} obj.email - email of a user signing up
* @param {function} obj.setEmail - funciton that manages the state of the email variable
* @param {function} obj.incrementStep - function to go to the next step of the signup flow
- * @returns
+ * @returns
*/
-export default function EnterEmailStep({ email, setEmail, incrementStep }: DownloadBackupPDFStepProps): JSX.Element {
+export default function EnterEmailStep({
+ email,
+ setEmail,
+ incrementStep
+}: DownloadBackupPDFStepProps): JSX.Element {
const [emailError, setEmailError] = useState(false);
- const [emailErrorMessage, setEmailErrorMessage] = useState("");
+ const [emailErrorMessage, setEmailErrorMessage] = useState('');
const { t } = useTranslation();
/**
@@ -34,15 +36,11 @@ export default function EnterEmailStep({ email, setEmail, incrementStep }: Downl
let emailCheckBool = false;
if (!email) {
setEmailError(true);
- setEmailErrorMessage("Please enter your email.");
+ setEmailErrorMessage('Please enter your email.');
emailCheckBool = true;
- } else if (
- !email.includes("@") ||
- !email.includes(".") ||
- !/[a-z]/.test(email)
- ) {
+ } else if (!email.includes('@') || !email.includes('.') || !/[a-z]/.test(email)) {
setEmailError(true);
- setEmailErrorMessage("Please enter a valid email.");
+ setEmailErrorMessage('Please enter a valid email.');
emailCheckBool = true;
} else {
setEmailError(false);
@@ -57,13 +55,13 @@ export default function EnterEmailStep({ email, setEmail, incrementStep }: Downl
return (
<div>
- <div className="bg-bunker w-full max-w-md mx-auto h-7/12 py-8 md:px-6 mx-1 rounded-xl drop-shadow-xl">
+ <div className="bg-bunker w-full max-w-md h-7/12 py-8 md:px-6 mx-1 rounded-xl drop-shadow-xl">
<p className="text-4xl font-semibold flex justify-center text-primary">
- {t("signup:step1-start")}
+ {t('signup:step1-start')}
</p>
<div className="flex items-center justify-center w-5/6 md:w-full m-auto md:p-2 rounded-lg max-h-24 mt-4">
<InputField
- label={t("common:email") ?? ""}
+ label={t('common:email') ?? ''}
onChangeHandler={setEmail}
type="email"
value={email}
@@ -75,11 +73,14 @@ export default function EnterEmailStep({ email, setEmail, incrementStep }: Downl
/>
</div>
<div className="flex flex-col items-center justify-center w-5/6 md:w-full md:p-2 max-h-28 max-w-xs md:max-w-md mx-auto mt-4 md:mt-4 text-sm text-center md:text-left">
- <p className="text-gray-400 mt-2 md:mx-0.5">
- {t("signup:step1-privacy")}
- </p>
+ <p className="text-gray-400 mt-2 md:mx-0.5">{t('signup:step1-privacy')}</p>
<div className="text-l mt-6 m-2 md:m-8 px-8 py-1 text-lg">
- <Button text={t("signup:step1-submit") ?? ""} type="submit" onButtonPressed={emailCheck} size="lg" />
+ <Button
+ text={t('signup:step1-submit') ?? ''}
+ type="submit"
+ onButtonPressed={emailCheck}
+ size="lg"
+ />
</div>
</div>
</div>
@@ -87,7 +88,7 @@ export default function EnterEmailStep({ email, setEmail, incrementStep }: Downl
<Link href="/login">
<button type="button" className="w-max pb-3 hover:opacity-90 duration-200">
<u className="font-normal text-sm text-primary-500">
- {t("signup:already-have-account")}
+ {t('signup:already-have-account')}
</u>
</button>
</Link>
diff --git a/frontend/src/components/signup/TeamInviteStep.tsx b/frontend/src/components/signup/TeamInviteStep.tsx
index e2639b88fd..879925e2a5 100644
--- a/frontend/src/components/signup/TeamInviteStep.tsx
+++ b/frontend/src/components/signup/TeamInviteStep.tsx
@@ -1,18 +1,16 @@
-import React, { useState } from "react";
-import { useRouter } from "next/router";
-import { useTranslation } from "next-i18next";
-
-import addUserToOrg from "~/pages/api/organization/addUserToOrg";
-import getWorkspaces from "~/pages/api/workspace/getWorkspaces";
-
-import Button from "../basic/buttons/Button";
+import React, { useState } from 'react';
+import { useRouter } from 'next/router';
+import { useTranslation } from 'next-i18next';
+import addUserToOrg from '@app/pages/api/organization/addUserToOrg';
+import getWorkspaces from '@app/pages/api/workspace/getWorkspaces';
+import Button from '../basic/buttons/Button';
/**
* This is the last step of the signup flow. People can optionally invite their teammates here.
*/
export default function TeamInviteStep(): JSX.Element {
- const [emails, setEmails] = useState("");
+ const [emails, setEmails] = useState('');
const { t } = useTranslation();
const router = useRouter();
@@ -20,34 +18,31 @@ export default function TeamInviteStep(): JSX.Element {
const redirectToHome = async () => {
const userWorkspaces = await getWorkspaces();
const userWorkspace = userWorkspaces[0]._id;
- router.push("/home/" + userWorkspace);
+ router.push(`/home/${userWorkspace}`);
+ };
- }
-
- const inviteUsers = async ({ emails }: { emails: string; }) => {
- emails
+ const inviteUsers = async ({ emails: inviteEmails }: { emails: string }) => {
+ inviteEmails
.split(',')
- .map(email => email.trim())
- .map(async (email) => await addUserToOrg(email, String(localStorage.getItem('orgData.id'))));
+ .map((email) => email.trim())
+ .map(async (email) => addUserToOrg(email, String(localStorage.getItem('orgData.id'))));
await redirectToHome();
- }
+ };
return (
<div className="bg-bunker w-max mx-auto h-7/12 pt-6 pb-4 px-8 rounded-xl drop-shadow-xl mb-64 md:mb-32">
<p className="text-4xl font-semibold flex justify-center text-primary">
- {t("signup:step5-invite-team")}
+ {t('signup:step5-invite-team')}
</p>
<p className="text-center flex justify-center text-bunker-300 max-w-xs md:max-w-sm md:mx-8 mb-6 mt-4">
- {t("signup:step5-subtitle")}
+ {t('signup:step5-subtitle')}
</p>
<div>
<div className="overflow-auto bg-bunker-800">
- <div className="whitespace-pre-wrap break-words bg-transparent">
-
- </div>
+ <div className="whitespace-pre-wrap break-words bg-transparent" />
</div>
- <textarea
+ <textarea
className="bg-bunker-800 h-20 w-full placeholder:text-bunker-400 py-1 px-2 rounded-md border border-mineshaft-500 text-sm text-bunker-300 outline-none focus:ring-2 ring-primary-800 ring-opacity-70"
value={emails}
onChange={(e) => setEmails(e.target.value)}
@@ -55,15 +50,18 @@ export default function TeamInviteStep(): JSX.Element {
/>
</div>
<div className="flex flex-row max-w-max min-w-28 items-center justify-center md:p-2 max-h-24 mx-auto text-lg px-4 mt-4 mb-2">
- <div
+ <div
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
className="text-md md:text-sm mx-3 text-bunker-300 bg-mineshaft-700 py-3 md:py-3.5 px-5 rounded-md cursor-pointer hover:bg-mineshaft-500 duration-200"
onClick={redirectToHome}
>
- {t("signup:step5-skip")}
+ {t('signup:step5-skip')}
</div>
<Button
- text={t("signup:step5-send-invites") ?? ""}
- onButtonPressed={() => inviteUsers({ emails})}
+ text={t('signup:step5-send-invites') ?? ''}
+ onButtonPressed={() => inviteUsers({ emails })}
size="lg"
/>
</div>
diff --git a/frontend/src/components/signup/UserInfoStep.tsx b/frontend/src/components/signup/UserInfoStep.tsx
index d1f4524878..abb7a41621 100644
--- a/frontend/src/components/signup/UserInfoStep.tsx
+++ b/frontend/src/components/signup/UserInfoStep.tsx
@@ -1,10 +1,12 @@
import React, { useState } from 'react';
import { useRouter } from 'next/router';
import { useTranslation } from 'next-i18next';
+import completeAccountInformationSignup from '@app/pages/api/auth/CompleteAccountInformationSignup';
import { faCheck, faX } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-
-import completeAccountInformationSignup from '~/pages/api/auth/CompleteAccountInformationSignup';
+import jsrp from 'jsrp';
+import nacl from 'tweetnacl';
+import { encodeBase64 } from 'tweetnacl-util';
import Button from '../basic/buttons/Button';
import InputField from '../basic/InputField';
@@ -12,9 +14,7 @@ import attemptLogin from '../utilities/attemptLogin';
import passwordCheck from '../utilities/checks/PasswordCheck';
import Aes256Gcm from '../utilities/cryptography/aes-256-gcm';
-const nacl = require('tweetnacl');
-const jsrp = require('jsrp');
-nacl.util = require('tweetnacl-util');
+// eslint-disable-next-line new-cap
const client = new jsrp.client();
interface UserInfoStepProps {
@@ -51,7 +51,7 @@ export default function UserInfoStep({
firstName,
setFirstName,
lastName,
- setLastName,
+ setLastName
}: UserInfoStepProps): JSX.Element {
const [firstNameError, setFirstNameError] = useState(false);
const [lastNameError, setLastNameError] = useState(false);
@@ -85,7 +85,7 @@ export default function UserInfoStep({
setPasswordErrorLength,
setPasswordErrorNumber,
setPasswordErrorLowerCase,
- errorCheck,
+ errorCheck
});
if (!errorCheck) {
@@ -93,17 +93,14 @@ export default function UserInfoStep({
const pair = nacl.box.keyPair();
const secretKeyUint8Array = pair.secretKey;
const publicKeyUint8Array = pair.publicKey;
- const PRIVATE_KEY = nacl.util.encodeBase64(secretKeyUint8Array);
- const PUBLIC_KEY = nacl.util.encodeBase64(publicKeyUint8Array);
+ const PRIVATE_KEY = encodeBase64(secretKeyUint8Array);
+ const PUBLIC_KEY = encodeBase64(publicKeyUint8Array);
const { ciphertext, iv, tag } = Aes256Gcm.encrypt({
text: PRIVATE_KEY,
secret: password
.slice(0, 32)
- .padStart(
- 32 + (password.slice(0, 32).length - new Blob([password]).size),
- '0'
- ),
+ .padStart(32 + (password.slice(0, 32).length - new Blob([password]).size), '0')
}) as { ciphertext: string; iv: string; tag: string };
localStorage.setItem('PRIVATE_KEY', PRIVATE_KEY);
@@ -111,50 +108,41 @@ export default function UserInfoStep({
client.init(
{
username: email,
- password: password,
+ password
},
async () => {
- client.createVerifier(
- async (err: any, result: { salt: string; verifier: string }) => {
- const response = await completeAccountInformationSignup({
- email,
- firstName,
- lastName,
- organizationName: firstName + "'s organization",
- publicKey: PUBLIC_KEY,
- ciphertext,
- iv,
- tag,
- salt: result.salt,
- verifier: result.verifier,
- token: verificationToken,
- });
+ client.createVerifier(async (err: any, result: { salt: string; verifier: string }) => {
+ const response = await completeAccountInformationSignup({
+ email,
+ firstName,
+ lastName,
+ organizationName: `${firstName}'s organization`,
+ publicKey: PUBLIC_KEY,
+ ciphertext,
+ iv,
+ tag,
+ salt: result.salt,
+ verifier: result.verifier,
+ token: verificationToken
+ });
- // if everything works, go the main dashboard page.
- if (response.status === 200) {
- // response = await response.json();
+ // if everything works, go the main dashboard page.
+ if (response.status === 200) {
+ // response = await response.json();
- localStorage.setItem('publicKey', PUBLIC_KEY);
- localStorage.setItem('encryptedPrivateKey', ciphertext);
- localStorage.setItem('iv', iv);
- localStorage.setItem('tag', tag);
+ localStorage.setItem('publicKey', PUBLIC_KEY);
+ localStorage.setItem('encryptedPrivateKey', ciphertext);
+ localStorage.setItem('iv', iv);
+ localStorage.setItem('tag', tag);
- try {
- await attemptLogin(
- email,
- password,
- (value: boolean) => {},
- router,
- true,
- false
- );
- incrementStep();
- } catch (error) {
- setIsLoading(false);
- }
+ try {
+ await attemptLogin(email, password, () => {}, router, true, false);
+ incrementStep();
+ } catch (error) {
+ setIsLoading(false);
}
}
- );
+ });
}
);
} else {
@@ -163,142 +151,108 @@ export default function UserInfoStep({
};
return (
- <div className='bg-bunker w-max mx-auto h-7/12 py-10 px-8 rounded-xl drop-shadow-xl mb-36 md:mb-16'>
- <p className='text-4xl font-bold flex justify-center mb-6 text-gray-400 mx-8 md:mx-16 text-transparent bg-clip-text bg-gradient-to-br from-sky-400 to-primary'>
+ <div className="bg-bunker w-max mx-auto h-7/12 py-10 px-8 rounded-xl drop-shadow-xl mb-36 md:mb-16">
+ <p className="text-4xl font-bold flex justify-center mb-6 text-gray-400 mx-8 md:mx-16 text-transparent bg-clip-text bg-gradient-to-br from-sky-400 to-primary">
{t('signup:step3-message')}
</p>
- <div className='relative z-0 flex items-center justify-end w-full md:p-2 rounded-lg max-h-24'>
+ <div className="relative z-0 flex items-center justify-end w-full md:p-2 rounded-lg max-h-24">
<InputField
label={t('common:first-name')}
onChangeHandler={setFirstName}
- type='name'
+ type="name"
value={firstName}
isRequired
errorText={
t('common:validate-required', {
- name: t('common:first-name'),
+ name: t('common:first-name')
}) as string
}
error={firstNameError}
- autoComplete='given-name'
+ autoComplete="given-name"
/>
</div>
- <div className='mt-2 flex items-center justify-center w-full md:p-2 rounded-lg max-h-24'>
+ <div className="mt-2 flex items-center justify-center w-full md:p-2 rounded-lg max-h-24">
<InputField
label={t('common:last-name')}
onChangeHandler={setLastName}
- type='name'
+ type="name"
value={lastName}
isRequired
errorText={
t('common:validate-required', {
- name: t('common:last-name'),
+ name: t('common:last-name')
}) as string
}
error={lastNameError}
- autoComplete='family-name'
+ autoComplete="family-name"
/>
</div>
- <div className='mt-2 flex flex-col items-center justify-center w-full md:p-2 rounded-lg max-h-60'>
+ <div className="mt-2 flex flex-col items-center justify-center w-full md:p-2 rounded-lg max-h-60">
<InputField
label={t('section-password:password')}
- onChangeHandler={(password: string) => {
- setPassword(password);
+ onChangeHandler={(pass: string) => {
+ setPassword(pass);
passwordCheck({
- password,
+ password: pass,
setPasswordErrorLength,
setPasswordErrorNumber,
setPasswordErrorLowerCase,
- errorCheck: false,
+ errorCheck: false
});
}}
- type='password'
+ type="password"
value={password}
isRequired
- error={
- passwordErrorLength && passwordErrorNumber && passwordErrorLowerCase
- }
- autoComplete='new-password'
- id='new-password'
+ error={passwordErrorLength && passwordErrorNumber && passwordErrorLowerCase}
+ autoComplete="new-password"
+ id="new-password"
/>
- {passwordErrorLength ||
- passwordErrorLowerCase ||
- passwordErrorNumber ? (
- <div className='w-full mt-4 bg-white/5 px-2 flex flex-col items-start py-2 rounded-md'>
- <div className={`text-gray-400 text-sm mb-1`}>
- {t('section-password:validate-base')}
- </div>
- <div className='flex flex-row justify-start items-center ml-1'>
+ {passwordErrorLength || passwordErrorLowerCase || passwordErrorNumber ? (
+ <div className="w-full mt-4 bg-white/5 px-2 flex flex-col items-start py-2 rounded-md">
+ <div className="text-gray-400 text-sm mb-1">{t('section-password:validate-base')}</div>
+ <div className="flex flex-row justify-start items-center ml-1">
{passwordErrorLength ? (
- <FontAwesomeIcon
- icon={faX}
- className='text-md text-red mr-2.5'
- />
+ <FontAwesomeIcon icon={faX} className="text-md text-red mr-2.5" />
) : (
- <FontAwesomeIcon
- icon={faCheck}
- className='text-md text-primary mr-2'
- />
+ <FontAwesomeIcon icon={faCheck} className="text-md text-primary mr-2" />
)}
- <div
- className={`${
- passwordErrorLength ? 'text-gray-400' : 'text-gray-600'
- } text-sm`}
- >
+ <div className={`${passwordErrorLength ? 'text-gray-400' : 'text-gray-600'} text-sm`}>
{t('section-password:validate-length')}
</div>
</div>
- <div className='flex flex-row justify-start items-center ml-1'>
+ <div className="flex flex-row justify-start items-center ml-1">
{passwordErrorLowerCase ? (
- <FontAwesomeIcon
- icon={faX}
- className='text-md text-red mr-2.5'
- />
+ <FontAwesomeIcon icon={faX} className="text-md text-red mr-2.5" />
) : (
- <FontAwesomeIcon
- icon={faCheck}
- className='text-md text-primary mr-2'
- />
+ <FontAwesomeIcon icon={faCheck} className="text-md text-primary mr-2" />
)}
<div
- className={`${
- passwordErrorLowerCase ? 'text-gray-400' : 'text-gray-600'
- } text-sm`}
+ className={`${passwordErrorLowerCase ? 'text-gray-400' : 'text-gray-600'} text-sm`}
>
{t('section-password:validate-case')}
</div>
</div>
- <div className='flex flex-row justify-start items-center ml-1'>
+ <div className="flex flex-row justify-start items-center ml-1">
{passwordErrorNumber ? (
- <FontAwesomeIcon
- icon={faX}
- className='text-md text-red mr-2.5'
- />
+ <FontAwesomeIcon icon={faX} className="text-md text-red mr-2.5" />
) : (
- <FontAwesomeIcon
- icon={faCheck}
- className='text-md text-primary mr-2'
- />
+ <FontAwesomeIcon icon={faCheck} className="text-md text-primary mr-2" />
)}
- <div
- className={`${
- passwordErrorNumber ? 'text-gray-400' : 'text-gray-600'
- } text-sm`}
- >
+ <div className={`${passwordErrorNumber ? 'text-gray-400' : 'text-gray-600'} text-sm`}>
{t('section-password:validate-number')}
</div>
</div>
</div>
) : (
- <div className='py-2'></div>
+ <div className="py-2" />
)}
</div>
- <div className='flex flex-col items-center justify-center md:p-2 max-h-48 max-w-max mx-auto text-lg px-2 py-3'>
+ <div className="flex flex-col items-center justify-center md:p-2 max-h-48 max-w-max mx-auto text-lg px-2 py-3">
<Button
text={t('signup:signup') ?? ''}
loading={isLoading}
onButtonPressed={signupErrorCheck}
- size='lg'
+ size="lg"
/>
</div>
</div>
diff --git a/frontend/src/components/utilities/SecurityClient.ts b/frontend/src/components/utilities/SecurityClient.ts
index 3adfa1dc15..57e35d6b24 100644
--- a/frontend/src/components/utilities/SecurityClient.ts
+++ b/frontend/src/components/utilities/SecurityClient.ts
@@ -1,32 +1,27 @@
-import token from '~/pages/api/auth/Token';
+import token from '@app/pages/api/auth/Token';
export default class SecurityClient {
static #token = '';
- constructor() {}
-
- static setToken(token: string) {
- this.#token = token;
+ static setToken(tokenStr: string) {
+ this.#token = tokenStr;
}
- static async fetchCall(
- resource: RequestInfo,
- options?: RequestInit | undefined
- ) {
+ static async fetchCall(resource: RequestInfo, options?: RequestInit | undefined) {
const req = new Request(resource, options);
- if (this.#token == '') {
+ if (this.#token === '') {
try {
// TODO: This should be moved to a context to do it only once when app loads
// this try catch saves route guard from a stuck state
this.setToken(await token());
} catch (error) {
- console.error("Unauthorized access");
+ console.error('Unauthorized access');
}
}
if (this.#token) {
- req.headers.set('Authorization', 'Bearer ' + this.#token);
+ req.headers.set('Authorization', `Bearer ${this.#token}`);
}
return fetch(req);
diff --git a/frontend/src/components/utilities/attemptLogin.ts b/frontend/src/components/utilities/attemptLogin.ts
index 1a960af10e..e167a8e1b2 100644
--- a/frontend/src/components/utilities/attemptLogin.ts
+++ b/frontend/src/components/utilities/attemptLogin.ts
@@ -1,25 +1,24 @@
+/* eslint-disable prefer-destructuring */
+import crypto from 'crypto';
+
+import Aes256Gcm from '@app/components/utilities/cryptography/aes-256-gcm';
+import login1 from '@app/pages/api/auth/Login1';
+import login2 from '@app/pages/api/auth/Login2';
+import addSecrets from '@app/pages/api/files/AddSecrets';
+import getOrganizations from '@app/pages/api/organization/getOrgs';
+import getOrganizationUserProjects from '@app/pages/api/organization/GetOrgUserProjects';
+import getUser from '@app/pages/api/user/getUser';
+import uploadKeys from '@app/pages/api/workspace/uploadKeys';
+import jsrp from 'jsrp';
import { SecretDataProps } from 'public/data/frequentInterfaces';
-import Aes256Gcm from '~/components/utilities/cryptography/aes-256-gcm';
-import login1 from '~/pages/api/auth/Login1';
-import login2 from '~/pages/api/auth/Login2';
-import addSecrets from '~/pages/api/files/AddSecrets';
-import getOrganizations from '~/pages/api/organization/getOrgs';
-import getOrganizationUserProjects from '~/pages/api/organization/GetOrgUserProjects';
-import getUser from '~/pages/api/user/getUser';
-import uploadKeys from '~/pages/api/workspace/uploadKeys';
-
import { encryptAssymmetric } from './cryptography/crypto';
import encryptSecrets from './secrets/encryptSecrets';
import Telemetry from './telemetry/Telemetry';
import { saveTokenToLocalStorage } from './saveTokenToLocalStorage';
import SecurityClient from './SecurityClient';
-
-const crypto = require("crypto");
-const nacl = require('tweetnacl');
-nacl.util = require('tweetnacl-util');
-const jsrp = require('jsrp');
+// eslint-disable-next-line new-cap
const client = new jsrp.client();
/**
@@ -46,7 +45,7 @@ const attemptLogin = async (
client.init(
{
username: email,
- password: password
+ password
},
async () => {
const clientPublicKey = client.getPublicKey();
@@ -59,8 +58,10 @@ const attemptLogin = async (
const clientProof = client.getProof(); // called M1
// if everything works, go the main dashboard page.
- const { token, publicKey, encryptedPrivateKey, iv, tag } =
- await login2(email, clientProof);
+ const { token, publicKey, encryptedPrivateKey, iv, tag } = await login2(
+ email,
+ clientProof
+ );
SecurityClient.setToken(token);
@@ -70,10 +71,7 @@ const attemptLogin = async (
tag,
secret: password
.slice(0, 32)
- .padStart(
- 32 + (password.slice(0, 32).length - new Blob([password]).size),
- '0'
- )
+ .padStart(32 + (password.slice(0, 32).length - new Blob([password]).size), '0')
});
saveTokenToLocalStorage({
@@ -83,9 +81,9 @@ const attemptLogin = async (
tag,
privateKey
});
-
+
const userOrgs = await getOrganizations();
- const userOrgsData = userOrgs.map((org: { _id: string; }) => org._id);
+ const userOrgsData = userOrgs.map((org: { _id: string }) => org._id);
let orgToLogin;
if (userOrgsData.includes(localStorage.getItem('orgData.id'))) {
@@ -99,11 +97,9 @@ const attemptLogin = async (
orgId: orgToLogin
});
- orgUserProjects = orgUserProjects?.map((project: { _id: string; }) => project._id);
+ orgUserProjects = orgUserProjects?.map((project: { _id: string }) => project._id);
let projectToLogin;
- if (
- orgUserProjects.includes(localStorage.getItem('projectData.id'))
- ) {
+ if (orgUserProjects.includes(localStorage.getItem('projectData.id'))) {
projectToLogin = localStorage.getItem('projectData.id');
} else {
try {
@@ -113,90 +109,104 @@ const attemptLogin = async (
console.log('ERROR: User likely has no projects. ', error);
}
}
-
+
if (email) {
telemetry.identify(email);
telemetry.capture('User Logged In');
}
if (isSignUp) {
- const randomBytes = crypto.randomBytes(16).toString("hex");
- const PRIVATE_KEY = String(localStorage.getItem("PRIVATE_KEY"));
+ const randomBytes = crypto.randomBytes(16).toString('hex');
+ const PRIVATE_KEY = String(localStorage.getItem('PRIVATE_KEY'));
const myUser = await getUser();
const { ciphertext, nonce } = encryptAssymmetric({
plaintext: randomBytes,
publicKey: myUser.publicKey,
- privateKey: PRIVATE_KEY,
+ privateKey: PRIVATE_KEY
}) as { ciphertext: string; nonce: string };
- await uploadKeys(
- projectToLogin,
- myUser._id,
- ciphertext,
- nonce
- );
-
- const secretsToBeAdded: SecretDataProps[] = [{
- pos: 0,
- key: "DATABASE_URL",
- value: "mongodb+srv://${DB_USERNAME}:${DB_PASSWORD}@mongodb.net",
- valueOverride: undefined,
- comment: "This is an example of secret referencing.",
- id: ''
- }, {
- pos: 1,
- key: "DB_USERNAME",
- value: "OVERRIDE_THIS",
- valueOverride: undefined,
- comment: "This is an example of secret overriding. Your team can have a shared value of a secret, while you can override it to whatever value you need",
- id: ''
- }, {
- pos: 2,
- key: "DB_PASSWORD",
- value: "OVERRIDE_THIS",
- valueOverride: undefined,
- comment: "This is an example of secret overriding. Your team can have a shared value of a secret, while you can override it to whatever value you need",
- id: ''
- }, {
- pos: 3,
- key: "DB_USERNAME",
- value: "user1234",
- valueOverride: "user1234",
- comment: "",
- id: ''
- }, {
- pos: 4,
- key: "DB_PASSWORD",
- value: "example_password",
- valueOverride: "example_password",
- comment: "",
- id: ''
- }, {
- pos: 5,
- key: "TWILIO_AUTH_TOKEN",
- value: "example_twillio_token",
- valueOverride: undefined,
- comment: "",
- id: ''
- }, {
- pos: 6,
- key: "WEBSITE_URL",
- value: "http://localhost:3000",
- valueOverride: undefined,
- comment: "",
- id: ''
- }]
- const secrets = await encryptSecrets({ secretsToEncrypt: secretsToBeAdded, workspaceId: String(localStorage.getItem('projectData.id')), env: 'dev' })
- await addSecrets({ secrets: secrets ?? [], env: "dev", workspaceId: String(localStorage.getItem('projectData.id')) });
+ await uploadKeys(projectToLogin, myUser._id, ciphertext, nonce);
+
+ const secretsToBeAdded: SecretDataProps[] = [
+ {
+ pos: 0,
+ key: 'DATABASE_URL',
+ // eslint-disable-next-line no-template-curly-in-string
+ value: 'mongodb+srv://${DB_USERNAME}:${DB_PASSWORD}@mongodb.net',
+ valueOverride: undefined,
+ comment: 'This is an example of secret referencing.',
+ id: ''
+ },
+ {
+ pos: 1,
+ key: 'DB_USERNAME',
+ value: 'OVERRIDE_THIS',
+ valueOverride: undefined,
+ comment:
+ 'This is an example of secret overriding. Your team can have a shared value of a secret, while you can override it to whatever value you need',
+ id: ''
+ },
+ {
+ pos: 2,
+ key: 'DB_PASSWORD',
+ value: 'OVERRIDE_THIS',
+ valueOverride: undefined,
+ comment:
+ 'This is an example of secret overriding. Your team can have a shared value of a secret, while you can override it to whatever value you need',
+ id: ''
+ },
+ {
+ pos: 3,
+ key: 'DB_USERNAME',
+ value: 'user1234',
+ valueOverride: 'user1234',
+ comment: '',
+ id: ''
+ },
+ {
+ pos: 4,
+ key: 'DB_PASSWORD',
+ value: 'example_password',
+ valueOverride: 'example_password',
+ comment: '',
+ id: ''
+ },
+ {
+ pos: 5,
+ key: 'TWILIO_AUTH_TOKEN',
+ value: 'example_twillio_token',
+ valueOverride: undefined,
+ comment: '',
+ id: ''
+ },
+ {
+ pos: 6,
+ key: 'WEBSITE_URL',
+ value: 'http://localhost:3000',
+ valueOverride: undefined,
+ comment: '',
+ id: ''
+ }
+ ];
+ const secrets = await encryptSecrets({
+ secretsToEncrypt: secretsToBeAdded,
+ workspaceId: String(localStorage.getItem('projectData.id')),
+ env: 'dev'
+ });
+ await addSecrets({
+ secrets: secrets ?? [],
+ env: 'dev',
+ workspaceId: String(localStorage.getItem('projectData.id'))
+ });
}
if (isLogin) {
- router.push('/dashboard/' + localStorage.getItem('projectData.id'));
+ router.push(`/dashboard/${localStorage.getItem('projectData.id')}`);
}
} catch (error) {
- console.log(error)
+ console.log(error);
setErrorLogin(true);
console.log('Login response not available');
}
diff --git a/frontend/src/components/utilities/checks/OnboardingCheck.ts b/frontend/src/components/utilities/checks/OnboardingCheck.ts
index 343efadb52..ccdf03dff3 100644
--- a/frontend/src/components/utilities/checks/OnboardingCheck.ts
+++ b/frontend/src/components/utilities/checks/OnboardingCheck.ts
@@ -1,5 +1,5 @@
-import getOrganizationUsers from '~/pages/api/organization/GetOrgUsers';
-import checkUserAction from '~/pages/api/userActions/checkUserAction';
+import getOrganizationUsers from '@app/pages/api/organization/GetOrgUsers';
+import checkUserAction from '@app/pages/api/userActions/checkUserAction';
interface OnboardingCheckProps {
setTotalOnboardingActionsDone?: (value: number) => void;
@@ -26,46 +26,43 @@ const onboardingCheck = async ({
action: 'slack_cta_clicked'
});
if (userActionSlack) {
- countActions = countActions + 1;
+ countActions += 1;
}
- setHasUserClickedSlack &&
- setHasUserClickedSlack(userActionSlack ? true : false);
+ if (setHasUserClickedSlack) setHasUserClickedSlack(!!userActionSlack);
const userActionSecrets = await checkUserAction({
action: 'first_time_secrets_pushed'
});
if (userActionSecrets) {
- countActions = countActions + 1;
+ countActions += 1;
}
- setHasUserPushedSecrets &&
- setHasUserPushedSecrets(userActionSecrets ? true : false);
+ if (setHasUserPushedSecrets) setHasUserPushedSecrets(!!userActionSecrets);
const userActionIntro = await checkUserAction({
action: 'intro_cta_clicked'
});
if (userActionIntro) {
- countActions = countActions + 1;
+ countActions += 1;
}
- setHasUserClickedIntro &&
- setHasUserClickedIntro(userActionIntro ? true : false);
+ if (setHasUserClickedIntro) setHasUserClickedIntro(!!userActionIntro);
const userActionStar = await checkUserAction({
action: 'star_cta_clicked'
});
if (userActionStar) {
- countActions = countActions + 1;
+ countActions += 1;
}
- setHasUserStarred && setHasUserStarred(userActionStar ? true : false);
+ if (setHasUserStarred) setHasUserStarred(!!userActionStar);
const orgId = localStorage.getItem('orgData.id');
const orgUsers = await getOrganizationUsers({
- orgId: orgId ? orgId : ''
+ orgId: orgId || ''
});
if (orgUsers.length > 1) {
- countActions = countActions + 1;
+ countActions += 1;
}
- setUsersInOrg && setUsersInOrg(orgUsers.length > 1);
- setTotalOnboardingActionsDone && setTotalOnboardingActionsDone(countActions);
+ if (setUsersInOrg) setUsersInOrg(orgUsers.length > 1);
+ if (setTotalOnboardingActionsDone) setTotalOnboardingActionsDone(countActions);
};
export default onboardingCheck;
diff --git a/frontend/src/components/utilities/checks/PasswordCheck.ts b/frontend/src/components/utilities/checks/PasswordCheck.ts
index b511304fbc..e84cba761b 100644
--- a/frontend/src/components/utilities/checks/PasswordCheck.ts
+++ b/frontend/src/components/utilities/checks/PasswordCheck.ts
@@ -1,3 +1,4 @@
+/* eslint-disable no-param-reassign */
interface PasswordCheckProps {
password: string;
errorCheck: boolean;
@@ -14,7 +15,7 @@ const passwordCheck = ({
setPasswordErrorLength,
setPasswordErrorNumber,
setPasswordErrorLowerCase,
- errorCheck,
+ errorCheck
}: PasswordCheckProps) => {
if (!password || password.length < 14) {
setPasswordErrorLength(true);
diff --git a/frontend/src/components/utilities/cryptography/aes-256-gcm.ts b/frontend/src/components/utilities/cryptography/aes-256-gcm.ts
index aa4986dc42..5a2301c257 100644
--- a/frontend/src/components/utilities/cryptography/aes-256-gcm.ts
+++ b/frontend/src/components/utilities/cryptography/aes-256-gcm.ts
@@ -32,7 +32,6 @@ class Aes256Gcm {
/**
* No need to run the constructor. The class only has static methods.
*/
- constructor() {}
/**
* Encrypts text with AES 256 GCM.
@@ -65,11 +64,7 @@ class Aes256Gcm {
* @returns {string}
*/
static decrypt({ ciphertext, iv, tag, secret }: DecryptProps): string {
- const decipher = crypto.createDecipheriv(
- ALGORITHM,
- secret,
- Buffer.from(iv, 'base64')
- );
+ const decipher = crypto.createDecipheriv(ALGORITHM, secret, Buffer.from(iv, 'base64'));
decipher.setAuthTag(Buffer.from(tag, 'base64'));
let cleartext = decipher.update(ciphertext, 'base64', 'utf8');
diff --git a/frontend/src/components/utilities/cryptography/changePassword.ts b/frontend/src/components/utilities/cryptography/changePassword.ts
index 0a8f6a35de..744f45969e 100644
--- a/frontend/src/components/utilities/cryptography/changePassword.ts
+++ b/frontend/src/components/utilities/cryptography/changePassword.ts
@@ -1,8 +1,8 @@
+/* eslint-disable new-cap */
+import changePassword2 from '@app/pages/api/auth/ChangePassword2';
+import SRP1 from '@app/pages/api/auth/SRP1';
import jsrp from 'jsrp';
-import changePassword2 from '~/pages/api/auth/ChangePassword2';
-import SRP1 from '~/pages/api/auth/SRP1';
-
import Aes256Gcm from './aes-256-gcm';
const clientOldPassword = new jsrp.client();
@@ -33,15 +33,16 @@ const changePassword = async (
clientOldPassword.init(
{
username: email,
- password: currentPassword,
+ password: currentPassword
},
async () => {
const clientPublicKey = clientOldPassword.getPublicKey();
- let serverPublicKey, salt;
+ let serverPublicKey;
+ let salt;
try {
const res = await SRP1({
- clientPublicKey: clientPublicKey,
+ clientPublicKey
});
serverPublicKey = res.serverPublicKey;
salt = res.salt;
@@ -57,7 +58,7 @@ const changePassword = async (
clientNewPassword.init(
{
username: email,
- password: newPassword,
+ password: newPassword
},
async () => {
clientNewPassword.createVerifier(async (err, result) => {
@@ -67,11 +68,9 @@ const changePassword = async (
secret: newPassword
.slice(0, 32)
.padStart(
- 32 +
- (newPassword.slice(0, 32).length -
- new Blob([newPassword]).size),
+ 32 + (newPassword.slice(0, 32).length - new Blob([newPassword]).size),
'0'
- ),
+ )
});
if (ciphertext) {
@@ -87,18 +86,18 @@ const changePassword = async (
tag,
salt: result.salt,
verifier: result.verifier,
- clientProof,
+ clientProof
});
- if (res && res.status == 400) {
+ if (res && res.status === 400) {
setCurrentPasswordError(true);
- } else if (res && res.status == 200) {
+ } else if (res && res.status === 200) {
setPasswordChanged(true);
setCurrentPassword('');
setNewPassword('');
}
- } catch (err) {
+ } catch (error) {
setCurrentPasswordError(true);
- console.log(err);
+ console.log(error);
}
}
});
diff --git a/frontend/src/components/utilities/cryptography/crypto.ts b/frontend/src/components/utilities/cryptography/crypto.ts
index 010c4d65d0..d1db995ee8 100644
--- a/frontend/src/components/utilities/cryptography/crypto.ts
+++ b/frontend/src/components/utilities/cryptography/crypto.ts
@@ -1,8 +1,9 @@
+import aes from './aes-256-gcm';
+
const nacl = require('tweetnacl');
nacl.util = require('tweetnacl-util');
-import aes from './aes-256-gcm';
-type encryptAsymmetricProps = {
+type EncryptAsymmetricProps = {
plaintext: string;
publicKey: string;
privateKey: string;
@@ -22,8 +23,8 @@ type encryptAsymmetricProps = {
const encryptAssymmetric = ({
plaintext,
publicKey,
- privateKey,
-}: encryptAsymmetricProps): {
+ privateKey
+}: EncryptAsymmetricProps): {
ciphertext: string;
nonce: string;
} => {
@@ -37,11 +38,11 @@ const encryptAssymmetric = ({
return {
ciphertext: nacl.util.encodeBase64(ciphertext),
- nonce: nacl.util.encodeBase64(nonce),
+ nonce: nacl.util.encodeBase64(nonce)
};
};
-type decryptAsymmetricProps = {
+type DecryptAsymmetricProps = {
ciphertext: string;
nonce: string;
publicKey: string;
@@ -61,8 +62,8 @@ const decryptAssymmetric = ({
ciphertext,
nonce,
publicKey,
- privateKey,
-}: decryptAsymmetricProps): string => {
+ privateKey
+}: DecryptAsymmetricProps): string => {
const plaintext = nacl.box.open(
nacl.util.decodeBase64(ciphertext),
nacl.util.decodeBase64(nonce),
@@ -73,24 +74,23 @@ const decryptAssymmetric = ({
return nacl.util.encodeUTF8(plaintext);
};
-type encryptSymmetricProps = {
+type EncryptSymmetricProps = {
plaintext: string;
key: string;
};
-type encryptSymmetricReturn = {
- ciphertext:string;
- iv:string;
- tag:string;
+type EncryptSymmetricReturn = {
+ ciphertext: string;
+ iv: string;
+ tag: string;
};
/**
* Return symmetrically encrypted [plaintext] using [key].
*/
-const encryptSymmetric = ({
- plaintext,
- key,
-}: encryptSymmetricProps): encryptSymmetricReturn => {
- let ciphertext, iv, tag;
+const encryptSymmetric = ({ plaintext, key }: EncryptSymmetricProps): EncryptSymmetricReturn => {
+ let ciphertext;
+ let iv;
+ let tag;
try {
const obj = aes.encrypt({ text: plaintext, secret: key });
ciphertext = obj.ciphertext;
@@ -105,11 +105,11 @@ const encryptSymmetric = ({
return {
ciphertext,
iv,
- tag,
+ tag
};
};
-type decryptSymmetricProps = {
+type DecryptSymmetricProps = {
ciphertext: string;
iv: string;
tag: string;
@@ -126,12 +126,7 @@ type decryptSymmetricProps = {
* @param {String} obj.key - 32-byte hex key
*
*/
-const decryptSymmetric = ({
- ciphertext,
- iv,
- tag,
- key,
-}: decryptSymmetricProps): string => {
+const decryptSymmetric = ({ ciphertext, iv, tag, key }: DecryptSymmetricProps): string => {
let plaintext;
try {
plaintext = aes.decrypt({ ciphertext, iv, tag, secret: key });
@@ -143,9 +138,4 @@ const decryptSymmetric = ({
return plaintext;
};
-export {
- decryptAssymmetric,
- decryptSymmetric,
- encryptAssymmetric,
- encryptSymmetric,
-};
+export { decryptAssymmetric, decryptSymmetric, encryptAssymmetric, encryptSymmetric };
diff --git a/frontend/src/components/utilities/cryptography/issueBackupKey.ts b/frontend/src/components/utilities/cryptography/issueBackupKey.ts
index 147377b77f..5f048d97a1 100644
--- a/frontend/src/components/utilities/cryptography/issueBackupKey.ts
+++ b/frontend/src/components/utilities/cryptography/issueBackupKey.ts
@@ -1,15 +1,15 @@
-import issueBackupPrivateKey from '~/pages/api/auth/IssueBackupPrivateKey';
-import SRP1 from '~/pages/api/auth/SRP1';
+/* eslint-disable new-cap */
+import crypto from 'crypto';
+
+import issueBackupPrivateKey from '@app/pages/api/auth/IssueBackupPrivateKey';
+import SRP1 from '@app/pages/api/auth/SRP1';
+import jsrp from 'jsrp';
import generateBackupPDF from '../generateBackupPDF';
import Aes256Gcm from './aes-256-gcm';
-const nacl = require('tweetnacl');
-nacl.util = require('tweetnacl-util');
-const jsrp = require('jsrp');
const clientPassword = new jsrp.client();
const clientKey = new jsrp.client();
-const crypto = require('crypto');
interface BackupKeyProps {
email: string;
@@ -42,15 +42,16 @@ const issueBackupKey = async ({
clientPassword.init(
{
username: email,
- password: password
+ password
},
async () => {
const clientPublicKey = clientPassword.getPublicKey();
- let serverPublicKey, salt;
+ let serverPublicKey;
+ let salt;
try {
const res = await SRP1({
- clientPublicKey: clientPublicKey
+ clientPublicKey
});
serverPublicKey = res.serverPublicKey;
salt = res.salt;
@@ -87,9 +88,9 @@ const issueBackupKey = async ({
clientProof
});
- if (res?.status == 400) {
+ if (res?.status === 400) {
setBackupKeyError(true);
- } else if (res?.status == 200) {
+ } else if (res?.status === 200) {
generateBackupPDF({
personalName,
personalEmail: email,
diff --git a/frontend/src/components/utilities/generateBackupPDF.ts b/frontend/src/components/utilities/generateBackupPDF.ts
index d47bdfe732..a4ee0035e2 100644
--- a/frontend/src/components/utilities/generateBackupPDF.ts
+++ b/frontend/src/components/utilities/generateBackupPDF.ts
@@ -9,22 +9,19 @@ interface PDFProps {
/**
* This function generate a pdf with a secret key for a user.
*/
-function generateBackupPDF({
- personalName,
- personalEmail,
- generatedKey
-}: PDFProps) {
+function generateBackupPDF({ personalName, personalEmail, generatedKey }: PDFProps) {
const imgData =
'data:image/png;base64,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';
// new jsPDF('p', 'mm', [297, 210]);
const today = new Date();
const dd = String(today.getDate()).padStart(2, '0');
- const mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
+ const mm = String(today.getMonth() + 1).padStart(2, '0'); // January is 0!
const yyyy = today.getFullYear();
- const todayFormatted = mm + '/' + dd + '/' + yyyy;
+ const todayFormatted = `${mm}/${dd}/${yyyy}`;
+ // eslint-disable-next-line new-cap
const doc = new jsPDF('p', 'pt');
doc.setFillColor(255, 255, 255);
doc.rect(0, 0, 600, 900, 'F');
@@ -32,12 +29,7 @@ function generateBackupPDF({
doc.addImage(imgData, 'png', 30, 35, 535, 72);
doc.addFont('helvetica', 'normal', '');
doc.setFontSize(12);
- doc.text(
- 'Created for ' + personalName + ' on ' + todayFormatted + '.',
- 290,
- 130,
- { align: 'center' }
- );
+ doc.text(`Created for ${personalName} on ${todayFormatted}.`, 290, 130, { align: 'center' });
doc.setFontSize(14);
doc.text(
'In case you get locked out of you Infisical account, you`ll need these account details',
@@ -46,11 +38,7 @@ function generateBackupPDF({
);
doc.text('to sign in —', 32, 200);
doc.setFont('helvetica', 'bold');
- doc.text(
- 'including your Secret Key, which we absolutely cannot access or',
- 110,
- 200
- );
+ doc.text('including your Secret Key, which we absolutely cannot access or', 110, 200);
doc.text('recover for you. ', 32, 220);
doc.setFont('helvetica', 'normal');
doc.text('Recommendations:', 32, 250);
diff --git a/frontend/src/components/utilities/parseDotEnv.ts b/frontend/src/components/utilities/parseDotEnv.ts
index 56fe3e349f..5d8869b606 100644
--- a/frontend/src/components/utilities/parseDotEnv.ts
+++ b/frontend/src/components/utilities/parseDotEnv.ts
@@ -29,6 +29,7 @@ export function parseDotEnv(src: ArrayBuffer) {
let match;
let item: [string, string, string[]] | [] = [];
+ // eslint-disable-next-line no-cond-assign
while ((match = LINE.exec(line)) !== null) {
const key = match[1];
@@ -58,8 +59,8 @@ export function parseDotEnv(src: ArrayBuffer) {
})
.filter((line) => line.length > 1)
.forEach((line) => {
- const [key, value, comments] = line;
- object[key as string] = { value, comments };
+ const [key, value, cmnts] = line;
+ object[key as string] = { value, comments: cmnts };
});
return object;
diff --git a/frontend/src/components/utilities/randomId.ts b/frontend/src/components/utilities/randomId.ts
index 8e1c7f9723..9c9382c14d 100644
--- a/frontend/src/components/utilities/randomId.ts
+++ b/frontend/src/components/utilities/randomId.ts
@@ -3,23 +3,11 @@
* @returns
*/
const guidGenerator = () => {
- const S4 = function () {
+ const S4 = () => {
+ // eslint-disable-next-line no-bitwise
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
};
- return (
- S4() +
- S4() +
- '-' +
- S4() +
- '-' +
- S4() +
- '-' +
- S4() +
- '-' +
- S4() +
- S4() +
- S4()
- );
+ return `${S4() + S4()}-${S4()}-${S4()}-${S4()}-${S4()}${S4()}${S4()}`;
};
export default guidGenerator;
diff --git a/frontend/src/components/utilities/saveTokenToLocalStorage.ts b/frontend/src/components/utilities/saveTokenToLocalStorage.ts
index 35b3361814..b624babd6c 100644
--- a/frontend/src/components/utilities/saveTokenToLocalStorage.ts
+++ b/frontend/src/components/utilities/saveTokenToLocalStorage.ts
@@ -22,7 +22,7 @@ export const saveTokenToLocalStorage = ({
} catch (err) {
if (err instanceof Error) {
throw new Error(
- "Unable to send the tokens in local storage:" + err.message
+ `Unable to send the tokens in local storage:${ err.message}`
);
}
}
diff --git a/frontend/src/components/utilities/secrets/checkOverrides.ts b/frontend/src/components/utilities/secrets/checkOverrides.ts
index 83a779a85b..356f0025e3 100644
--- a/frontend/src/components/utilities/secrets/checkOverrides.ts
+++ b/frontend/src/components/utilities/secrets/checkOverrides.ts
@@ -1,26 +1,32 @@
-import { SecretDataProps } from "public/data/frequentInterfaces";
+import { SecretDataProps } from 'public/data/frequentInterfaces';
/**
* This function downloads the secrets as a .env file
- * @param {object} obj
+ * @param {object} obj
* @param {SecretDataProps[]} obj.data - secrets that we want to check for overrides
- * @returns
+ * @returns
*/
-const checkOverrides = async ({ data }: { data: SecretDataProps[]; }) => {
- let secrets : SecretDataProps[] = data!.map((secret) => Object.create(secret));
- const overridenSecrets = data!.filter(
- (secret) => (secret.valueOverride == undefined || secret?.value != secret?.valueOverride) ? 'shared' : 'personal'
+const checkOverrides = async ({ data }: { data: SecretDataProps[] }) => {
+ let secrets: SecretDataProps[] = data!.map((secret) => Object.create(secret));
+ const overridenSecrets = data!.filter((secret) =>
+ secret.valueOverride === undefined || secret?.value !== secret?.valueOverride
+ ? 'shared'
+ : 'personal'
);
if (overridenSecrets.length) {
overridenSecrets.forEach((secret) => {
const index = secrets!.findIndex(
- (_secret) => _secret.key === secret.key && (secret.valueOverride == undefined || secret?.value != secret?.valueOverride)
+ (_secret) =>
+ _secret.key === secret.key &&
+ (secret.valueOverride === undefined || secret?.value !== secret?.valueOverride)
);
secrets![index].value = secret.value;
});
- secrets = secrets!.filter((secret) => (secret.valueOverride == undefined || secret?.value != secret?.valueOverride));
+ secrets = secrets!.filter(
+ (secret) => secret.valueOverride === undefined || secret?.value !== secret?.valueOverride
+ );
}
return secrets;
-}
+};
export default checkOverrides;
diff --git a/frontend/src/components/utilities/secrets/downloadDotEnv.ts b/frontend/src/components/utilities/secrets/downloadDotEnv.ts
index 983796981b..49702fb70a 100644
--- a/frontend/src/components/utilities/secrets/downloadDotEnv.ts
+++ b/frontend/src/components/utilities/secrets/downloadDotEnv.ts
@@ -1,16 +1,14 @@
-import { envMapping } from "public/data/frequentConstants";
-import { SecretDataProps } from "public/data/frequentInterfaces";
+import { SecretDataProps } from 'public/data/frequentInterfaces';
import checkOverrides from './checkOverrides';
-
/**
* This function downloads the secrets as a .env file
- * @param {object} obj
+ * @param {object} obj
* @param {SecretDataProps[]} obj.data - secrets that we want to download
* @param {string} obj.env - the environment which we're downloading (used for naming the file)
*/
-const downloadDotEnv = async ({ data, env }: { data: SecretDataProps[]; env: string; }) => {
+const downloadDotEnv = async ({ data, env }: { data: SecretDataProps[]; env: string }) => {
if (!data) return;
const secrets = await checkOverrides({ data });
@@ -19,21 +17,21 @@ const downloadDotEnv = async ({ data, env }: { data: SecretDataProps[]; env: str
(item: SecretDataProps) =>
`${
item.comment
- ? item.comment
+ ? `${item.comment
.split('\n')
.map((comment) => '# '.concat(comment))
- .join('\n') + '\n'
+ .join('\n')}\n`
: ''
- }` + [item.key, item.value].join('=')
+ }${[item.key, item.value].join('=')}`
)
.join('\n');
- const blob = new Blob([file]);
- const fileDownloadUrl = URL.createObjectURL(blob);
- const alink = document.createElement('a');
- alink.href = fileDownloadUrl;
- alink.download = env + '.env';
- alink.click();
-}
+ const blob = new Blob([file]);
+ const fileDownloadUrl = URL.createObjectURL(blob);
+ const alink = document.createElement('a');
+ alink.href = fileDownloadUrl;
+ alink.download = `${env}.env`;
+ alink.click();
+};
export default downloadDotEnv;
diff --git a/frontend/src/components/utilities/secrets/downloadYaml.ts b/frontend/src/components/utilities/secrets/downloadYaml.ts
index 26fca5f006..5af38f9b16 100644
--- a/frontend/src/components/utilities/secrets/downloadYaml.ts
+++ b/frontend/src/components/utilities/secrets/downloadYaml.ts
@@ -1,20 +1,20 @@
// import YAML from 'yaml';
// import { YAMLSeq } from 'yaml/types';
-import { SecretDataProps } from "public/data/frequentInterfaces";
+import { SecretDataProps } from 'public/data/frequentInterfaces';
// import { envMapping } from "../../../public/data/frequentConstants";
// import checkOverrides from './checkOverrides';
-
/**
* This function downloads the secrets as a .yml file
- * @param {object} obj
+ * @param {object} obj
* @param {SecretDataProps[]} obj.data - secrets that we want to download
* @param {string} obj.env - used for naming the file
- * @returns
+ * @returns
*/
-const downloadYaml = async ({ data, env }: { data: SecretDataProps[]; env: string; }) => {
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
+const downloadYaml = async ({ data, env }: { data: SecretDataProps[]; env: string }) => {
// if (!data) return;
// const doc = new YAML.Document();
// doc.contents = new YAMLSeq();
@@ -27,20 +27,17 @@ const downloadYaml = async ({ data, env }: { data: SecretDataProps[]; env: strin
// .join('\n');
// doc.add(pair);
// });
-
// const file = doc
// .toString()
// .split('\n')
// .map((line) => (line.startsWith('-') ? line.replace('- ', '') : line))
// .join('\n');
-
// const blob = new Blob([file]);
// const fileDownloadUrl = URL.createObjectURL(blob);
// const alink = document.createElement('a');
// alink.href = fileDownloadUrl;
// alink.download = envMapping[env] + '.yml';
// alink.click();
- return;
-}
+};
export default downloadYaml;
diff --git a/frontend/src/components/utilities/secrets/encryptSecrets.ts b/frontend/src/components/utilities/secrets/encryptSecrets.ts
index a0f56990a2..0b60d555e2 100644
--- a/frontend/src/components/utilities/secrets/encryptSecrets.ts
+++ b/frontend/src/components/utilities/secrets/encryptSecrets.ts
@@ -1,15 +1,9 @@
-import { SecretDataProps } from "public/data/frequentInterfaces";
+import crypto from 'crypto';
-import getLatestFileKey from "~/pages/api/workspace/getLatestFileKey";
-
-const crypto = require("crypto");
-const {
- decryptAssymmetric,
- encryptSymmetric,
-} = require("../cryptography/crypto");
-const nacl = require("tweetnacl");
-nacl.util = require("tweetnacl-util");
+import getLatestFileKey from '@app/pages/api/workspace/getLatestFileKey';
+import { SecretDataProps } from 'public/data/frequentInterfaces';
+import { decryptAssymmetric, encryptSymmetric } from '../cryptography/crypto';
interface EncryptedSecretProps {
id: string;
@@ -24,22 +18,30 @@ interface EncryptedSecretProps {
secretValueCiphertext: string;
secretValueIV: string;
secretValueTag: string;
- type: "personal" | "shared";
+ type: 'personal' | 'shared';
}
/**
* Encypt secrets before pushing the to the DB
- * @param {object} obj
+ * @param {object} obj
* @param {object} obj.secretsToEncrypt - secrets that we want to encrypt
* @param {object} obj.workspaceId - the id of a project in which we are encrypting secrets
- * @returns
+ * @returns
*/
-const encryptSecrets = async ({ secretsToEncrypt, workspaceId, env }: { secretsToEncrypt: SecretDataProps[]; workspaceId: string; env: string; }) => {
+const encryptSecrets = async ({
+ secretsToEncrypt,
+ workspaceId,
+ env
+}: {
+ secretsToEncrypt: SecretDataProps[];
+ workspaceId: string;
+ env: string;
+}) => {
let secrets;
try {
const sharedKey = await getLatestFileKey({ workspaceId });
- const PRIVATE_KEY = localStorage.getItem("PRIVATE_KEY");
+ const PRIVATE_KEY = localStorage.getItem('PRIVATE_KEY') as string;
let randomBytes: string;
if (Object.keys(sharedKey).length > 0) {
@@ -48,42 +50,42 @@ const encryptSecrets = async ({ secretsToEncrypt, workspaceId, env }: { secretsT
ciphertext: sharedKey.latestKey.encryptedKey,
nonce: sharedKey.latestKey.nonce,
publicKey: sharedKey.latestKey.sender.publicKey,
- privateKey: PRIVATE_KEY,
+ privateKey: PRIVATE_KEY
});
} else {
// case: a (shared) key does not exist for the workspace
- randomBytes = crypto.randomBytes(16).toString("hex");
+ randomBytes = crypto.randomBytes(16).toString('hex');
}
-
+
secrets = secretsToEncrypt.map((secret) => {
// encrypt key
const {
ciphertext: secretKeyCiphertext,
iv: secretKeyIV,
- tag: secretKeyTag,
+ tag: secretKeyTag
} = encryptSymmetric({
plaintext: secret.key,
- key: randomBytes,
+ key: randomBytes
});
// encrypt value
const {
ciphertext: secretValueCiphertext,
iv: secretValueIV,
- tag: secretValueTag,
+ tag: secretValueTag
} = encryptSymmetric({
plaintext: secret.value,
- key: randomBytes,
+ key: randomBytes
});
// encrypt comment
const {
ciphertext: secretCommentCiphertext,
iv: secretCommentIV,
- tag: secretCommentTag,
+ tag: secretCommentTag
} = encryptSymmetric({
plaintext: secret.comment ?? '',
- key: randomBytes,
+ key: randomBytes
});
const result: EncryptedSecretProps = {
@@ -99,17 +101,19 @@ const encryptSecrets = async ({ secretsToEncrypt, workspaceId, env }: { secretsT
secretCommentCiphertext,
secretCommentIV,
secretCommentTag,
- type: (secret.valueOverride == undefined || secret?.value != secret?.valueOverride) ? 'shared' : 'personal',
+ type:
+ secret.valueOverride === undefined || secret?.value !== secret?.valueOverride
+ ? 'shared'
+ : 'personal'
};
return result;
});
} catch (error) {
- console.log("Error while encrypting secrets");
+ console.log('Error while encrypting secrets');
}
return secrets;
-
-}
+};
export default encryptSecrets;
diff --git a/frontend/src/components/utilities/secrets/getSecretsForProject.ts b/frontend/src/components/utilities/secrets/getSecretsForProject.ts
index 86f6db0e01..c00f13d04a 100644
--- a/frontend/src/components/utilities/secrets/getSecretsForProject.ts
+++ b/frontend/src/components/utilities/secrets/getSecretsForProject.ts
@@ -1,12 +1,7 @@
-import getSecrets from '~/pages/api/files/GetSecrets';
-import getLatestFileKey from '~/pages/api/workspace/getLatestFileKey';
+import getSecrets from '@app/pages/api/files/GetSecrets';
+import getLatestFileKey from '@app/pages/api/workspace/getLatestFileKey';
-const {
- decryptAssymmetric,
- decryptSymmetric
-} = require('../cryptography/crypto');
-const nacl = require('tweetnacl');
-nacl.util = require('tweetnacl-util');
+import { decryptAssymmetric, decryptSymmetric } from '../cryptography/crypto';
interface EncryptedSecretProps {
_id: string;
@@ -21,14 +16,14 @@ interface EncryptedSecretProps {
secretValueCiphertext: string;
secretValueIV: string;
secretValueTag: string;
- type: "personal" | "shared";
+ type: 'personal' | 'shared';
}
-interface SecretProps {
- key: string;
- value: string;
- type: 'personal' | 'shared';
- comment: string;
+interface SecretProps {
+ key: string;
+ value: string;
+ type: 'personal' | 'shared';
+ comment: string;
id: string;
}
@@ -61,11 +56,11 @@ const getSecretsForProject = async ({
console.log('ERROR: Not able to access the latest version of secrets');
}
- const latestKey = await getLatestFileKey({ workspaceId })
+ const latestKey = await getLatestFileKey({ workspaceId });
// This is called isKeyAvailable but what it really means is if a person is able to create new key pairs
- setIsKeyAvailable(!latestKey ? encryptedSecrets.length == 0 : true);
+ setIsKeyAvailable(!latestKey ? encryptedSecrets.length === 0 : true);
- const PRIVATE_KEY = localStorage.getItem('PRIVATE_KEY');
+ const PRIVATE_KEY = localStorage.getItem('PRIVATE_KEY') as string;
const tempDecryptedSecrets: SecretProps[] = [];
if (latestKey) {
@@ -78,7 +73,7 @@ const getSecretsForProject = async ({
});
// decrypt secret keys, values, and comments
- encryptedSecrets.map((secret: EncryptedSecretProps) => {
+ encryptedSecrets.forEach((secret: EncryptedSecretProps) => {
const plainTextKey = decryptSymmetric({
ciphertext: secret.secretKeyCiphertext,
iv: secret.secretKeyIV,
@@ -102,7 +97,7 @@ const getSecretsForProject = async ({
key
});
} else {
- plainTextComment = "";
+ plainTextComment = '';
}
tempDecryptedSecrets.push({
@@ -115,20 +110,26 @@ const getSecretsForProject = async ({
});
}
- const secretKeys = [...new Set(tempDecryptedSecrets.map(secret => secret.key))];
-
-
- const result = secretKeys.map((key, index) => {
- return {
- id: tempDecryptedSecrets.filter(secret => secret.key == key && secret.type == 'shared')[0]?.id,
- idOverride: tempDecryptedSecrets.filter(secret => secret.key == key && secret.type == 'personal')[0]?.id,
- pos: index,
- key: key,
- value: tempDecryptedSecrets.filter(secret => secret.key == key && secret.type == 'shared')[0]?.value,
- valueOverride: tempDecryptedSecrets.filter(secret => secret.key == key && secret.type == 'personal')[0]?.value,
- comment: tempDecryptedSecrets.filter(secret => secret.key == key && secret.type == 'shared')[0]?.comment,
- }
- });
+ const secretKeys = [...new Set(tempDecryptedSecrets.map((secret) => secret.key))];
+
+ const result = secretKeys.map((key, index) => ({
+ id: tempDecryptedSecrets.filter((secret) => secret.key === key && secret.type === 'shared')[0]
+ ?.id,
+ idOverride: tempDecryptedSecrets.filter(
+ (secret) => secret.key === key && secret.type === 'personal'
+ )[0]?.id,
+ pos: index,
+ key,
+ value: tempDecryptedSecrets.filter(
+ (secret) => secret.key === key && secret.type === 'shared'
+ )[0]?.value,
+ valueOverride: tempDecryptedSecrets.filter(
+ (secret) => secret.key === key && secret.type === 'personal'
+ )[0]?.value,
+ comment: tempDecryptedSecrets.filter(
+ (secret) => secret.key === key && secret.type === 'shared'
+ )[0]?.comment
+ }));
setData(result);
return result;
diff --git a/frontend/src/components/utilities/telemetry/Telemetry.ts b/frontend/src/components/utilities/telemetry/Telemetry.ts
index e7e367fbd7..b31007f1c4 100644
--- a/frontend/src/components/utilities/telemetry/Telemetry.ts
+++ b/frontend/src/components/utilities/telemetry/Telemetry.ts
@@ -1,7 +1,7 @@
/* eslint-disable */
import { PostHog } from 'posthog-js';
-import { initPostHog } from '~/components/analytics/posthog';
-import { ENV } from '~/components/utilities/config';
+import { initPostHog } from '@app/components/analytics/posthog';
+import { ENV } from '@app/components/utilities/config';
declare let TELEMETRY_CAPTURING_ENABLED: any;
@@ -13,7 +13,7 @@ class Capturer {
}
capture(item: string) {
- if (ENV == 'production' && TELEMETRY_CAPTURING_ENABLED) {
+ if (ENV === 'production' && TELEMETRY_CAPTURING_ENABLED) {
try {
this.api.capture(item);
} catch (error) {
@@ -23,7 +23,7 @@ class Capturer {
}
identify(id: string) {
- if (ENV == 'production' && TELEMETRY_CAPTURING_ENABLED) {
+ if (ENV === 'production' && TELEMETRY_CAPTURING_ENABLED) {
try {
this.api.identify(id);
} catch (error) {
diff --git a/frontend/src/ee/api/secrets/GetActionData.ts b/frontend/src/ee/api/secrets/GetActionData.ts
index 4fdf184364..85b6c320b9 100644
--- a/frontend/src/ee/api/secrets/GetActionData.ts
+++ b/frontend/src/ee/api/secrets/GetActionData.ts
@@ -1,8 +1,7 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
-
-interface workspaceProps {
- actionId: string;
+interface WorkspaceProps {
+ actionId: string;
}
/**
@@ -11,21 +10,18 @@ interface workspaceProps {
* @param {string} obj.actionId - id of an action for which we are trying to get data
* @returns
*/
-const getActionData = async ({ actionId }: workspaceProps) => {
- return SecurityClient.fetchCall(
- '/api/v1/action/' + actionId, {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json'
- }
+const getActionData = async ({ actionId }: WorkspaceProps) =>
+ SecurityClient.fetchCall(`/api/v1/action/${actionId}`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res && res.status == 200) {
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return (await res.json()).action;
- } else {
- console.log('Failed to get the info about an action');
}
+ console.log('Failed to get the info about an action');
+ return undefined;
});
-};
export default getActionData;
diff --git a/frontend/src/ee/api/secrets/GetProjectLogs.ts b/frontend/src/ee/api/secrets/GetProjectLogs.ts
index e127be8155..a87973bca0 100644
--- a/frontend/src/ee/api/secrets/GetProjectLogs.ts
+++ b/frontend/src/ee/api/secrets/GetProjectLogs.ts
@@ -1,8 +1,7 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
-
-interface workspaceProps {
- workspaceId: string;
+interface WorkspaceProps {
+ workspaceId: string;
offset: number;
limit: number;
userId: string;
@@ -12,48 +11,53 @@ interface workspaceProps {
/**
* This function fetches the activity logs for a certain project
* @param {object} obj
- * @param {string} obj.workspaceId - workspace id for which we are trying to get project log
+ * @param {string} obj.workspaceId - workspace id for which we are trying to get project log
* @param {object} obj.offset - teh starting point of logs that we want to pull
* @param {object} obj.limit - how many logs will we output
* @param {object} obj.userId - optional userId filter - will only query logs for that user
* @param {string} obj.actionNames - optional actionNames filter - will only query logs for those actions
* @returns
*/
-const getProjectLogs = async ({ workspaceId, offset, limit, userId, actionNames }: workspaceProps) => {
+const getProjectLogs = async ({
+ workspaceId,
+ offset,
+ limit,
+ userId,
+ actionNames
+}: WorkspaceProps) => {
let payload;
- if (userId != "" && actionNames != '') {
+ if (userId !== '' && actionNames !== '') {
payload = {
offset: String(offset),
limit: String(limit),
sortBy: 'recent',
userId: JSON.stringify(userId),
- actionNames: actionNames
- }
- } else if (userId != "") {
+ actionNames
+ };
+ } else if (userId !== '') {
payload = {
offset: String(offset),
limit: String(limit),
sortBy: 'recent',
userId: JSON.stringify(userId)
- }
- } else if (actionNames != "") {
+ };
+ } else if (actionNames !== '') {
payload = {
offset: String(offset),
limit: String(limit),
sortBy: 'recent',
- actionNames: actionNames
- }
+ actionNames
+ };
} else {
payload = {
offset: String(offset),
limit: String(limit),
- sortBy: 'recent'
- }
+ sortBy: 'recent'
+ };
}
-
+
return SecurityClient.fetchCall(
- '/api/v1/workspace/' + workspaceId + '/logs?' +
- new URLSearchParams(payload),
+ `/api/v1/workspace/${workspaceId}/logs?${new URLSearchParams(payload)}`,
{
method: 'GET',
headers: {
@@ -61,11 +65,11 @@ const getProjectLogs = async ({ workspaceId, offset, limit, userId, actionNames
}
}
).then(async (res) => {
- if (res && res.status == 200) {
+ if (res && res.status === 200) {
return (await res.json()).logs;
- } else {
- console.log('Failed to get project logs');
}
+ console.log('Failed to get project logs');
+ return undefined;
});
};
diff --git a/frontend/src/ee/api/secrets/GetProjectSercetShanpshots.ts b/frontend/src/ee/api/secrets/GetProjectSercetShanpshots.ts
index 21c2ac8010..649082fa71 100644
--- a/frontend/src/ee/api/secrets/GetProjectSercetShanpshots.ts
+++ b/frontend/src/ee/api/secrets/GetProjectSercetShanpshots.ts
@@ -1,8 +1,7 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
-
-interface workspaceProps {
- workspaceId: string;
+interface WorkspaceProps {
+ workspaceId: string;
offset: number;
limit: number;
}
@@ -10,30 +9,29 @@ interface workspaceProps {
/**
* This function fetches the secret snapshots for a certain project
* @param {object} obj
- * @param {string} obj.workspaceId - project id for which we are trying to get project secret snapshots
+ * @param {string} obj.workspaceId - project id for which we are trying to get project secret snapshots
* @param {object} obj.offset - teh starting point of snapshots that we want to pull
* @param {object} obj.limit - how many snapshots will we output
* @returns
*/
-const getProjectSecretShanpshots = async ({ workspaceId, offset, limit }: workspaceProps) => {
- return SecurityClient.fetchCall(
- '/api/v1/workspace/' + workspaceId + '/secret-snapshots?' +
- new URLSearchParams({
+const getProjectSecretShanpshots = async ({ workspaceId, offset, limit }: WorkspaceProps) =>
+ SecurityClient.fetchCall(
+ `/api/v1/workspace/${workspaceId}/secret-snapshots?${new URLSearchParams({
offset: String(offset),
limit: String(limit)
- }), {
+ })}`,
+ {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
}
).then(async (res) => {
- if (res && res.status == 200) {
+ if (res && res.status === 200) {
return (await res.json()).secretSnapshots;
- } else {
- console.log('Failed to get project secret snapshots');
}
+ console.log('Failed to get project secret snapshots');
+ return undefined;
});
-};
export default getProjectSecretShanpshots;
diff --git a/frontend/src/ee/api/secrets/GetProjectSercetSnapshotsCount.ts b/frontend/src/ee/api/secrets/GetProjectSercetSnapshotsCount.ts
index 19389026b6..a8f72b0295 100644
--- a/frontend/src/ee/api/secrets/GetProjectSercetSnapshotsCount.ts
+++ b/frontend/src/ee/api/secrets/GetProjectSercetSnapshotsCount.ts
@@ -1,31 +1,27 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
-
-interface workspaceProps {
- workspaceId: string;
+interface WorkspaceProps {
+ workspaceId: string;
}
/**
* This function fetches the count of secret snapshots for a certain project
* @param {object} obj
- * @param {string} obj.workspaceId - project id for which we are trying to get project secret snapshots
+ * @param {string} obj.workspaceId - project id for which we are trying to get project secret snapshots
* @returns
*/
-const getProjectSercetSnapshotsCount = async ({ workspaceId }: workspaceProps) => {
- return SecurityClient.fetchCall(
- '/api/v1/workspace/' + workspaceId + '/secret-snapshots/count', {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json'
- }
+const getProjectSercetSnapshotsCount = async ({ workspaceId }: WorkspaceProps) =>
+ SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/secret-snapshots/count`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res && res.status == 200) {
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return (await res.json()).count;
- } else {
- console.log('Failed to get the count of project secret snapshots');
}
+ console.log('Failed to get the count of project secret snapshots');
+ return undefined;
});
-};
export default getProjectSercetSnapshotsCount;
diff --git a/frontend/src/ee/api/secrets/GetSecretSnapshotData.ts b/frontend/src/ee/api/secrets/GetSecretSnapshotData.ts
index 181fa85ce7..7d118ef0b4 100644
--- a/frontend/src/ee/api/secrets/GetSecretSnapshotData.ts
+++ b/frontend/src/ee/api/secrets/GetSecretSnapshotData.ts
@@ -1,8 +1,7 @@
-import SecurityClient from '~/utilities/SecurityClient';
-
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface SnapshotProps {
- secretSnapshotId: string;
+ secretSnapshotId: string;
}
/**
@@ -11,21 +10,18 @@ interface SnapshotProps {
* @param {string} obj.secretSnapshotId - snapshot id for which we are trying to get secrets
* @returns
*/
-const getSecretSnapshotData = async ({ secretSnapshotId }: SnapshotProps) => {
- return SecurityClient.fetchCall(
- '/api/v1/secret-snapshot/' + secretSnapshotId, {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json'
- }
+const getSecretSnapshotData = async ({ secretSnapshotId }: SnapshotProps) =>
+ SecurityClient.fetchCall(`/api/v1/secret-snapshot/${secretSnapshotId}`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res && res.status == 200) {
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return (await res.json()).secretSnapshot;
- } else {
- console.log('Failed to get the secrets of a certain snapshot');
}
+ console.log('Failed to get the secrets of a certain snapshot');
+ return undefined;
});
-};
export default getSecretSnapshotData;
diff --git a/frontend/src/ee/api/secrets/GetSecretVersions.ts b/frontend/src/ee/api/secrets/GetSecretVersions.ts
index 7b38403991..a1ec95dc3c 100644
--- a/frontend/src/ee/api/secrets/GetSecretVersions.ts
+++ b/frontend/src/ee/api/secrets/GetSecretVersions.ts
@@ -1,9 +1,8 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
-
-interface secretVersionProps {
- secretId: string;
- offset: number;
+interface SecretVersionProps {
+ secretId: string;
+ offset: number;
limit: number;
}
@@ -15,13 +14,12 @@ interface secretVersionProps {
* @param {number} obj.limit - how far our query goes
* @returns
*/
-const getSecretVersions = async ({ secretId, offset, limit }: secretVersionProps) => {
- return SecurityClient.fetchCall(
- '/api/v1/secret/' + secretId + '/secret-versions?' +
- new URLSearchParams({
- offset: String(offset),
- limit: String(limit)
- }),
+const getSecretVersions = async ({ secretId, offset, limit }: SecretVersionProps) =>
+ SecurityClient.fetchCall(
+ `/api/v1/secret/${secretId}/secret-versions?${new URLSearchParams({
+ offset: String(offset),
+ limit: String(limit)
+ })}`,
{
method: 'GET',
headers: {
@@ -29,12 +27,11 @@ const getSecretVersions = async ({ secretId, offset, limit }: secretVersionProps
}
}
).then(async (res) => {
- if (res && res.status == 200) {
- return await res.json();
- } else {
- console.log('Failed to get secret version history');
+ if (res && res.status === 200) {
+ return res.json();
}
+ console.log('Failed to get secret version history');
+ return undefined;
});
-};
export default getSecretVersions;
diff --git a/frontend/src/ee/api/secrets/PerformSecretRollback.ts b/frontend/src/ee/api/secrets/PerformSecretRollback.ts
index 6b51410a23..ccdd2e00fd 100644
--- a/frontend/src/ee/api/secrets/PerformSecretRollback.ts
+++ b/frontend/src/ee/api/secrets/PerformSecretRollback.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This function performs a rollback of secrets in a certain project
@@ -7,24 +7,27 @@ import SecurityClient from '~/utilities/SecurityClient';
* @param {number} obj.version - version to which we are rolling back
* @returns
*/
-const performSecretRollback = async ({ workspaceId, version }: { workspaceId: string; version: number; }) => {
- return SecurityClient.fetchCall(
- '/api/v1/workspace/' + workspaceId + "/secret-snapshots/rollback", {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({
- version
- })
- }
- ).then(async (res) => {
- if (res && res.status == 200) {
- return (await res.json());
- } else {
- console.log('Failed to perform the secret rollback');
+const performSecretRollback = async ({
+ workspaceId,
+ version
+}: {
+ workspaceId: string;
+ version: number;
+}) =>
+ SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/secret-snapshots/rollback`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ version
+ })
+ }).then(async (res) => {
+ if (res && res.status === 200) {
+ return res.json();
}
+ console.log('Failed to perform the secret rollback');
+ return undefined;
});
-};
export default performSecretRollback;
diff --git a/frontend/src/ee/components/ActivitySideBar.tsx b/frontend/src/ee/components/ActivitySideBar.tsx
index f8ecf15099..c45c8beca1 100644
--- a/frontend/src/ee/components/ActivitySideBar.tsx
+++ b/frontend/src/ee/components/ActivitySideBar.tsx
@@ -1,27 +1,21 @@
-import { useEffect, useState } from "react";
-import Image from "next/image";
-import { useRouter } from "next/router";
-import { useTranslation } from "next-i18next";
-import getActionData from "@app/ee/api/secrets/GetActionData";
+import { useEffect, useState } from 'react';
+import Image from 'next/image';
+import { useRouter } from 'next/router';
+import { useTranslation } from 'next-i18next';
+import getActionData from '@app/ee/api/secrets/GetActionData';
import patienceDiff from '@app/ee/utilities/findTextDifferences';
+import getLatestFileKey from '@app/pages/api/workspace/getLatestFileKey';
import { faX } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import getLatestFileKey from "~/pages/api/workspace/getLatestFileKey";
-
import DashboardInputField from '../../components/dashboard/DashboardInputField';
-
-
-const {
+import {
decryptAssymmetric,
decryptSymmetric
-} = require('../../components/utilities/cryptography/crypto');
-const nacl = require('tweetnacl');
-nacl.util = require('tweetnacl-util');
-
+} from '../../components/utilities/cryptography/crypto';
interface SideBarProps {
- toggleSidebar: (value: string) => void;
+ toggleSidebar: (value: string) => void;
currentAction: string;
}
@@ -41,11 +35,11 @@ interface DecryptedSecretProps {
newSecretVersion: {
key: string;
value: string;
- }
+ };
oldSecretVersion: {
key: string;
value: string;
- }
+ };
}
interface ActionProps {
@@ -58,10 +52,7 @@ interface ActionProps {
* @param {string} obj.currentAction - the action id for which a sidebar is being displayed
* @returns the sidebar with the payload of user activity logs
*/
-const ActivitySideBar = ({
- toggleSidebar,
- currentAction
-}: SideBarProps) => {
+const ActivitySideBar = ({ toggleSidebar, currentAction }: SideBarProps) => {
const { t } = useTranslation();
const router = useRouter();
const [actionData, setActionData] = useState<DecryptedSecretProps[]>();
@@ -72,7 +63,7 @@ const ActivitySideBar = ({
const getLogData = async () => {
setIsLoading(true);
const tempActionData = await getActionData({ actionId: currentAction });
- const latestKey = await getLatestFileKey({ workspaceId: String(router.query.id) })
+ const latestKey = await getLatestFileKey({ workspaceId: String(router.query.id) });
const PRIVATE_KEY = localStorage.getItem('PRIVATE_KEY');
// #TODO: make this a separate function and reuse across the app
@@ -86,12 +77,12 @@ const ActivitySideBar = ({
privateKey: String(PRIVATE_KEY)
});
}
-
- const decryptedSecretVersions = tempActionData.payload.secretVersions.map((encryptedSecretVersion: {
- newSecretVersion?: SecretProps;
- oldSecretVersion?: SecretProps;
- }) => {
- return {
+
+ const decryptedSecretVersions = tempActionData.payload.secretVersions.map(
+ (encryptedSecretVersion: {
+ newSecretVersion?: SecretProps;
+ oldSecretVersion?: SecretProps;
+ }) => ({
newSecretVersion: {
key: decryptSymmetric({
ciphertext: encryptedSecretVersion.newSecretVersion!.secretKeyCiphertext,
@@ -107,79 +98,134 @@ const ActivitySideBar = ({
})
},
oldSecretVersion: {
- key: encryptedSecretVersion.oldSecretVersion?.secretKeyCiphertext
- ? decryptSymmetric({
- ciphertext: encryptedSecretVersion.oldSecretVersion?.secretKeyCiphertext,
- iv: encryptedSecretVersion.oldSecretVersion?.secretKeyIV,
- tag: encryptedSecretVersion.oldSecretVersion?.secretKeyTag,
- key: decryptedLatestKey
- }): undefined,
+ key: encryptedSecretVersion.oldSecretVersion?.secretKeyCiphertext
+ ? decryptSymmetric({
+ ciphertext: encryptedSecretVersion.oldSecretVersion?.secretKeyCiphertext,
+ iv: encryptedSecretVersion.oldSecretVersion?.secretKeyIV,
+ tag: encryptedSecretVersion.oldSecretVersion?.secretKeyTag,
+ key: decryptedLatestKey
+ })
+ : undefined,
value: encryptedSecretVersion.oldSecretVersion?.secretValueCiphertext
- ? decryptSymmetric({
- ciphertext: encryptedSecretVersion.oldSecretVersion?.secretValueCiphertext,
- iv: encryptedSecretVersion.oldSecretVersion?.secretValueIV,
- tag: encryptedSecretVersion.oldSecretVersion?.secretValueTag,
- key: decryptedLatestKey
- }): undefined
+ ? decryptSymmetric({
+ ciphertext: encryptedSecretVersion.oldSecretVersion?.secretValueCiphertext,
+ iv: encryptedSecretVersion.oldSecretVersion?.secretValueIV,
+ tag: encryptedSecretVersion.oldSecretVersion?.secretValueTag,
+ key: decryptedLatestKey
+ })
+ : undefined
}
- }
- })
+ })
+ );
setActionData(decryptedSecretVersions);
- setActionMetaData({name: tempActionData.name});
+ setActionMetaData({ name: tempActionData.name });
setIsLoading(false);
- }
+ };
getLogData();
}, [currentAction]);
- return <div className={`absolute border-l border-mineshaft-500 ${isLoading ? "bg-bunker-800" : "bg-bunker"} fixed h-full w-96 top-14 right-0 z-40 shadow-xl flex flex-col justify-between`}>
- {isLoading ? (
- <div className="flex items-center justify-center h-full mb-8">
- <Image
- src="/images/loading/loading.gif"
- height={60}
- width={100}
- alt="infisical loading indicator"
- ></Image>
- </div>
- ) : (
- <div className='h-min overflow-y-auto'>
- <div className="flex flex-row px-4 py-3 border-b border-mineshaft-500 justify-between items-center">
- <p className="font-semibold text-lg text-bunker-200">{t("activity:event." + actionMetaData?.name)}</p>
- <div className='p-1' onClick={() => toggleSidebar("")}>
- <FontAwesomeIcon icon={faX} className='w-4 h-4 text-bunker-300 cursor-pointer'/>
- </div>
+ return (
+ <div
+ className={`absolute border-l border-mineshaft-500 ${
+ isLoading ? 'bg-bunker-800' : 'bg-bunker'
+ } fixed h-full w-96 top-14 right-0 z-40 shadow-xl flex flex-col justify-between`}
+ >
+ {isLoading ? (
+ <div className="flex items-center justify-center h-full mb-8">
+ <Image
+ src="/images/loading/loading.gif"
+ height={60}
+ width={100}
+ alt="infisical loading indicator"
+ />
</div>
- <div className='flex flex-col px-4'>
- {(actionMetaData?.name == 'readSecrets'
- || actionMetaData?.name == 'addSecrets'
- || actionMetaData?.name == 'deleteSecrets') && actionData?.map((item, id) =>
- <div key={id}>
- <div className='text-xs text-bunker-200 mt-4 pl-1'>{item.newSecretVersion.key}</div>
- <DashboardInputField
- key={id}
- onChangeHandler={() => {}}
- type="value"
- position={1}
- value={item.newSecretVersion.value}
- isDuplicate={false}
- blurred={false}
- />
+ ) : (
+ <div className="h-min overflow-y-auto">
+ <div className="flex flex-row px-4 py-3 border-b border-mineshaft-500 justify-between items-center">
+ <p className="font-semibold text-lg text-bunker-200">
+ {t(`activity:event.${actionMetaData?.name}`)}
+ </p>
+ <div
+ className="p-1"
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
+ onClick={() => toggleSidebar('')}
+ >
+ <FontAwesomeIcon icon={faX} className="w-4 h-4 text-bunker-300 cursor-pointer" />
</div>
- )}
- {actionMetaData?.name == 'updateSecrets' && actionData?.map((item, id) =>
- <>
- <div className='text-xs text-bunker-200 mt-4 pl-1'>{item.newSecretVersion.key}</div>
- <div className='text-bunker-100 font-mono rounded-md overflow-hidden'>
- <div className='bg-red/30 px-2'>- {patienceDiff(item.oldSecretVersion.value.split(''), item.newSecretVersion.value.split(''), false).lines.map((character, id) => character.bIndex != -1 && <span key={id} className={`${character.aIndex == -1 && "bg-red-700/80"}`}>{character.line}</span>)}</div>
- <div className='bg-green-500/30 px-2'>+ {patienceDiff(item.oldSecretVersion.value.split(''), item.newSecretVersion.value.split(''), false).lines.map((character, id) => character.aIndex != -1 && <span key={id} className={`${character.bIndex == -1 && "bg-green-700/80"}`}>{character.line}</span>)}</div>
- </div>
- </>
- )}
+ </div>
+ <div className="flex flex-col px-4">
+ {(actionMetaData?.name === 'readSecrets' ||
+ actionMetaData?.name === 'addSecrets' ||
+ actionMetaData?.name === 'deleteSecrets') &&
+ actionData?.map((item, id) => (
+ <div key={`secret.${id + 1}`}>
+ <div className="text-xs text-bunker-200 mt-4 pl-1">
+ {item.newSecretVersion.key}
+ </div>
+ <DashboardInputField
+ onChangeHandler={() => {}}
+ type="value"
+ position={1}
+ value={item.newSecretVersion.value}
+ isDuplicate={false}
+ blurred={false}
+ />
+ </div>
+ ))}
+ {actionMetaData?.name === 'updateSecrets' &&
+ actionData?.map((item, id) => (
+ <>
+ <div className="text-xs text-bunker-200 mt-4 pl-1">
+ {item.newSecretVersion.key}
+ </div>
+ <div className="text-bunker-100 font-mono rounded-md overflow-hidden">
+ <div className="bg-red/30 px-2">
+ -{' '}
+ {patienceDiff(
+ item.oldSecretVersion.value.split(''),
+ item.newSecretVersion.value.split(''),
+ false
+ ).lines.map(
+ (character, lineId) =>
+ character.bIndex !== -1 && (
+ <span
+ key={`actionData.${id + 1}.line.${lineId + 1}`}
+ className={`${character.aIndex === -1 && 'bg-red-700/80'}`}
+ >
+ {character.line}
+ </span>
+ )
+ )}
+ </div>
+ <div className="bg-green-500/30 px-2">
+ +{' '}
+ {patienceDiff(
+ item.oldSecretVersion.value.split(''),
+ item.newSecretVersion.value.split(''),
+ false
+ ).lines.map(
+ (character, lineId) =>
+ character.aIndex !== -1 && (
+ <span
+ key={`actionData.${id + 1}.linev2.${lineId + 1}`}
+ className={`${character.bIndex === -1 && 'bg-green-700/80'}`}
+ >
+ {character.line}
+ </span>
+ )
+ )}
+ </div>
+ </div>
+ </>
+ ))}
+ </div>
</div>
- </div>
- )}
- </div>
+ )}
+ </div>
+ );
};
export default ActivitySideBar;
diff --git a/frontend/src/ee/components/ActivityTable.tsx b/frontend/src/ee/components/ActivityTable.tsx
index 1777181d2f..28977f473b 100644
--- a/frontend/src/ee/components/ActivityTable.tsx
+++ b/frontend/src/ee/components/ActivityTable.tsx
@@ -1,24 +1,20 @@
+/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
import React, { useState } from 'react';
import Image from 'next/image';
-import { useTranslation } from "next-i18next";
+import { useTranslation } from 'next-i18next';
import timeSince from '@app/ee/utilities/timeSince';
-import {
- faAngleDown,
- faAngleRight,
- faUpRightFromSquare
-} from '@fortawesome/free-solid-svg-icons';
+import { faAngleDown, faAngleRight, faUpRightFromSquare } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import guidGenerator from '../../components/utilities/randomId';
-
interface PayloadProps {
_id: string;
- name: string;
+ name: string;
secretVersions: string[];
}
-interface logData {
+interface LogData {
_id: string;
channel: string;
createdAt: string;
@@ -27,15 +23,20 @@ interface logData {
payload: PayloadProps[];
}
-
/**
* This is a single row of the activity table
- * @param obj
- * @param {logData} obj.row - data for a certain event
+ * @param obj
+ * @param {LogData} obj.row - data for a certain event
* @param {function} obj.toggleSidebar - open and close sidebar that displays data for a specific event
- * @returns
+ * @returns
*/
-const ActivityLogsRow = ({ row, toggleSidebar }: { row: logData, toggleSidebar: (value: string) => void; }) => {
+const ActivityLogsRow = ({
+ row,
+ toggleSidebar
+}: {
+ row: LogData;
+ toggleSidebar: (value: string) => void;
+}) => {
const [payloadOpened, setPayloadOpened] = useState(false);
const { t } = useTranslation();
@@ -43,6 +44,7 @@ const ActivityLogsRow = ({ row, toggleSidebar }: { row: logData, toggleSidebar:
<>
<tr key={guidGenerator()} className="bg-bunker-800 duration-100 w-full text-sm">
<td
+ onKeyDown={() => null}
onClick={() => setPayloadOpened(!payloadOpened)}
className="border-mineshaft-700 border-t text-gray-300 flex items-center cursor-pointer"
>
@@ -54,40 +56,58 @@ const ActivityLogsRow = ({ row, toggleSidebar }: { row: logData, toggleSidebar:
/>
</td>
<td className="py-3 border-mineshaft-700 border-t text-gray-300">
- {row.payload?.map(action => String(action.secretVersions.length) + " " + t("activity:event." + action.name)).join(" and ")}
- </td>
- <td className="pl-6 py-3 border-mineshaft-700 border-t text-gray-300">
- {row.user}
- </td>
- <td className="pl-6 py-3 border-mineshaft-700 border-t text-gray-300">
- {row.channel}
+ {row.payload
+ ?.map(
+ (action) =>
+ `${String(action.secretVersions.length)} ${t(`activity:event.${action.name}`)}`
+ )
+ .join(' and ')}
</td>
+ <td className="pl-6 py-3 border-mineshaft-700 border-t text-gray-300">{row.user}</td>
+ <td className="pl-6 py-3 border-mineshaft-700 border-t text-gray-300">{row.channel}</td>
<td className="pl-6 py-3 border-mineshaft-700 border-t text-gray-300">
{timeSince(new Date(row.createdAt))}
</td>
</tr>
- {payloadOpened &&
- <tr className='h-9 text-bunker-200 border-mineshaft-700 border-t text-sm'>
- <td></td>
- <td>{String(t("common:timestamp"))}</td>
- <td>{row.createdAt}</td>
- </tr>}
- {payloadOpened && row.payload?.map((action, index) => {
- return action.secretVersions.length > 0 && <tr key={index} className="h-9 text-bunker-200 border-mineshaft-700 border-t text-sm">
- <td></td>
- <td className="">{t("activity:event." + action.name)}</td>
- <td className="text-primary-300 cursor-pointer hover:text-primary duration-200" onClick={() => toggleSidebar(action._id)}>
- {action.secretVersions.length + (action.secretVersions.length != 1 ? " secrets" : " secret")}
- <FontAwesomeIcon icon={faUpRightFromSquare} className="ml-2 mb-0.5 font-light w-3 h-3"/>
- </td>
+ {payloadOpened && (
+ <tr className="h-9 text-bunker-200 border-mineshaft-700 border-t text-sm">
+ <td />
+ <td>{String(t('common:timestamp'))}</td>
+ <td>{row.createdAt}</td>
</tr>
- })}
+ )}
{payloadOpened &&
- <tr className='h-9 text-bunker-200 border-mineshaft-700 border-t text-sm'>
- <td></td>
- <td>{String(t("activity:ip-address"))}</td>
- <td>{row.ipAddress}</td>
- </tr>}
+ row.payload?.map(
+ (action) =>
+ action.secretVersions.length > 0 && (
+ <tr
+ key={action._id}
+ className="h-9 text-bunker-200 border-mineshaft-700 border-t text-sm"
+ >
+ <td />
+ <td className="">{t(`activity:event.${action.name}`)}</td>
+ <td
+ onKeyDown={() => null}
+ className="text-primary-300 cursor-pointer hover:text-primary duration-200"
+ onClick={() => toggleSidebar(action._id)}
+ >
+ {action.secretVersions.length +
+ (action.secretVersions.length !== 1 ? ' secrets' : ' secret')}
+ <FontAwesomeIcon
+ icon={faUpRightFromSquare}
+ className="ml-2 mb-0.5 font-light w-3 h-3"
+ />
+ </td>
+ </tr>
+ )
+ )}
+ {payloadOpened && (
+ <tr className="h-9 text-bunker-200 border-mineshaft-700 border-t text-sm">
+ <td />
+ <td>{String(t('activity:ip-address'))}</td>
+ <td>{row.ipAddress}</td>
+ </tr>
+ )}
</>
);
};
@@ -100,37 +120,61 @@ const ActivityLogsRow = ({ row, toggleSidebar }: { row: logData, toggleSidebar:
* @param {boolean} obj.isLoading - whether the log data has been loaded yet or not
* @returns
*/
-const ActivityTable = ({ data, toggleSidebar, isLoading }: { data: logData[], toggleSidebar: (value: string) => void; isLoading: boolean; }) => {
+const ActivityTable = ({
+ data,
+ toggleSidebar,
+ isLoading
+}: {
+ data: LogData[];
+ toggleSidebar: (value: string) => void;
+ isLoading: boolean;
+}) => {
const { t } = useTranslation();
return (
<div className="w-full px-6 mt-8">
<div className="table-container w-full bg-bunker rounded-md mb-6 border border-mineshaft-700 relative">
- <div className="absolute rounded-t-md w-full h-[3rem] bg-white/5"></div>
+ <div className="absolute rounded-t-md w-full h-[3rem] bg-white/5" />
<table className="w-full my-1">
<thead className="text-bunker-300">
- <tr className='text-sm'>
- <th className="text-left pl-6 pt-2.5 pb-3"></th>
- <th className="text-left font-semibold pt-2.5 pb-3">{String(t("common:event")).toUpperCase()}</th>
- <th className="text-left font-semibold pl-6 pt-2.5 pb-3">{String(t("common:user")).toUpperCase()}</th>
- <th className="text-left font-semibold pl-6 pt-2.5 pb-3">{String(t("common:source")).toUpperCase()}</th>
- <th className="text-left font-semibold pl-6 pt-2.5 pb-3">{String(t("common:time")).toUpperCase()}</th>
- <th></th>
+ <tr className="text-sm">
+ <th aria-label="actions" className="text-left pl-6 pt-2.5 pb-3" />
+ <th className="text-left font-semibold pt-2.5 pb-3">
+ {String(t('common:event')).toUpperCase()}
+ </th>
+ <th className="text-left font-semibold pl-6 pt-2.5 pb-3">
+ {String(t('common:user')).toUpperCase()}
+ </th>
+ <th className="text-left font-semibold pl-6 pt-2.5 pb-3">
+ {String(t('common:source')).toUpperCase()}
+ </th>
+ <th className="text-left font-semibold pl-6 pt-2.5 pb-3">
+ {String(t('common:time')).toUpperCase()}
+ </th>
+ <th aria-label="action" />
</tr>
</thead>
<tbody>
- {data?.map((row, index) => {
- return <ActivityLogsRow key={index} row={row} toggleSidebar={toggleSidebar} />;
- })}
+ {data?.map((row, index) => (
+ <ActivityLogsRow
+ key={`activity.${index + 1}.${row._id}`}
+ row={row}
+ toggleSidebar={toggleSidebar}
+ />
+ ))}
</tbody>
</table>
</div>
- {isLoading && <div className='w-full flex justify-center mb-8 mt-4'><Image
- src="/images/loading/loading.gif"
- height={60}
- width={100}
- alt="loading animation"
- ></Image></div>}
+ {isLoading && (
+ <div className="w-full flex justify-center mb-8 mt-4">
+ <Image
+ src="/images/loading/loading.gif"
+ height={60}
+ width={100}
+ alt="loading animation"
+ />
+ </div>
+ )}
</div>
);
};
diff --git a/frontend/src/ee/components/PITRecoverySidebar.tsx b/frontend/src/ee/components/PITRecoverySidebar.tsx
index 0a9eea130b..334444fb93 100644
--- a/frontend/src/ee/components/PITRecoverySidebar.tsx
+++ b/frontend/src/ee/components/PITRecoverySidebar.tsx
@@ -1,18 +1,20 @@
-import { useEffect, useState } from "react";
-import Image from "next/image";
-import { useRouter } from "next/router";
-import { useTranslation } from "next-i18next";
-import getProjectSecretShanpshots from "@app/ee/api/secrets/GetProjectSercetShanpshots";
-import getSecretSnapshotData from "@app/ee/api/secrets/GetSecretSnapshotData";
-import timeSince from "@app/ee/utilities/timeSince";
+/* eslint-disable no-nested-ternary */
+import { useEffect, useState } from 'react';
+import Image from 'next/image';
+import { useRouter } from 'next/router';
+import { useTranslation } from 'next-i18next';
+import Button from '@app/components/basic/buttons/Button';
+import {
+ decryptAssymmetric,
+ decryptSymmetric
+} from '@app/components/utilities/cryptography/crypto';
+import getProjectSecretShanpshots from '@app/ee/api/secrets/GetProjectSercetShanpshots';
+import getSecretSnapshotData from '@app/ee/api/secrets/GetSecretSnapshotData';
+import timeSince from '@app/ee/utilities/timeSince';
+import getLatestFileKey from '@app/pages/api/workspace/getLatestFileKey';
import { faX } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import Button from "~/components/basic/buttons/Button";
-import { decryptAssymmetric, decryptSymmetric } from "~/components/utilities/cryptography/crypto";
-import getLatestFileKey from "~/pages/api/workspace/getLatestFileKey";
-
-
export interface SecretDataProps {
pos: number;
key: string;
@@ -23,7 +25,7 @@ export interface SecretDataProps {
}
interface SideBarProps {
- toggleSidebar: (value: boolean) => void;
+ toggleSidebar: (value: boolean) => void;
setSnapshotData: (value: any) => void;
chosenSnapshot: string;
}
@@ -44,7 +46,7 @@ interface EncrypetedSecretVersionListProps {
secretKeyIV: string;
secretKeyTag: string;
environment: string;
- type: "personal" | "shared";
+ type: 'personal' | 'shared';
}
/**
@@ -54,11 +56,7 @@ interface EncrypetedSecretVersionListProps {
* @param {string} obj.chosenSnaphshot - the snapshot id which is currently selected
* @returns the sidebar with the options for point-in-time recovery (commits)
*/
-const PITRecoverySidebar = ({
- toggleSidebar,
- setSnapshotData,
- chosenSnapshot
-}: SideBarProps) => {
+const PITRecoverySidebar = ({ toggleSidebar, setSnapshotData, chosenSnapshot }: SideBarProps) => {
const { t } = useTranslation();
const router = useRouter();
const [isLoading, setIsLoading] = useState(false);
@@ -68,22 +66,26 @@ const PITRecoverySidebar = ({
const loadMoreSnapshots = () => {
setCurrentOffset(currentOffset + currentLimit);
- }
+ };
useEffect(() => {
const getLogData = async () => {
setIsLoading(true);
- const results = await getProjectSecretShanpshots({ workspaceId: String(router.query.id), limit: currentLimit, offset: currentOffset })
+ const results = await getProjectSecretShanpshots({
+ workspaceId: String(router.query.id),
+ limit: currentLimit,
+ offset: currentOffset
+ });
setSecretSnapshotsMetadata(secretSnapshotsMetadata.concat(results));
setIsLoading(false);
- }
+ };
getLogData();
}, [currentOffset]);
- const exploreSnapshot = async ({ snapshotId }: { snapshotId: string; }) => {
+ const exploreSnapshot = async ({ snapshotId }: { snapshotId: string }) => {
const secretSnapshotData = await getSecretSnapshotData({ secretSnapshotId: snapshotId });
- const latestKey = await getLatestFileKey({ workspaceId: String(router.query.id) })
+ const latestKey = await getLatestFileKey({ workspaceId: String(router.query.id) });
const PRIVATE_KEY = localStorage.getItem('PRIVATE_KEY');
let decryptedLatestKey: string;
@@ -97,10 +99,10 @@ const PITRecoverySidebar = ({
});
}
- const decryptedSecretVersions = secretSnapshotData.secretVersions.map((encryptedSecretVersion: EncrypetedSecretVersionListProps, pos: number) => {
- return {
+ const decryptedSecretVersions = secretSnapshotData.secretVersions.map(
+ (encryptedSecretVersion: EncrypetedSecretVersionListProps, pos: number) => ({
id: encryptedSecretVersion._id,
- pos: pos,
+ pos,
type: encryptedSecretVersion.type,
environment: encryptedSecretVersion.environment,
key: decryptSymmetric({
@@ -115,69 +117,132 @@ const PITRecoverySidebar = ({
tag: encryptedSecretVersion.secretValueTag,
key: decryptedLatestKey
})
- }
- })
-
-
- const secretKeys = [...new Set(decryptedSecretVersions.map((secret: SecretDataProps) => secret.key))];
-
- const result = secretKeys.map((key, index) => {
- return {
- id: decryptedSecretVersions.filter((secret: SecretDataProps) => secret.key == key && secret.type == 'shared')[0].id,
- pos: index,
- key: key,
- environment: decryptedSecretVersions.filter((secret: SecretDataProps) => secret.key == key && secret.type == 'shared')[0].environment,
- value: decryptedSecretVersions.filter((secret: SecretDataProps) => secret.key == key && secret.type == 'shared')[0]?.value,
- valueOverride: decryptedSecretVersions.filter((secret: SecretDataProps) => secret.key == key && secret.type == 'personal')[0]?.value,
- }
+ })
+ );
+
+ const secretKeys = [
+ ...new Set(decryptedSecretVersions.map((secret: SecretDataProps) => secret.key))
+ ];
+
+ const result = secretKeys.map((key, index) => ({
+ id: decryptedSecretVersions.filter(
+ (secret: SecretDataProps) => secret.key === key && secret.type === 'shared'
+ )[0].id,
+ pos: index,
+ key,
+ environment: decryptedSecretVersions.filter(
+ (secret: SecretDataProps) => secret.key === key && secret.type === 'shared'
+ )[0].environment,
+ value: decryptedSecretVersions.filter(
+ (secret: SecretDataProps) => secret.key === key && secret.type === 'shared'
+ )[0]?.value,
+ valueOverride: decryptedSecretVersions.filter(
+ (secret: SecretDataProps) => secret.key === key && secret.type === 'personal'
+ )[0]?.value
+ }));
+
+ setSnapshotData({
+ id: secretSnapshotData._id,
+ version: secretSnapshotData.version,
+ createdAt: secretSnapshotData.createdAt,
+ secretVersions: result,
+ comment: ''
});
-
- setSnapshotData({ id: secretSnapshotData._id, version: secretSnapshotData.version, createdAt: secretSnapshotData.createdAt, secretVersions: result, comment: '' })
- }
-
- return <div className={`absolute border-l border-mineshaft-500 ${isLoading ? "bg-bunker-800" : "bg-bunker"} fixed h-full w-96 top-14 right-0 z-40 shadow-xl flex flex-col justify-between`}>
- {isLoading ? (
- <div className="flex items-center justify-center h-full mb-8">
- <Image
- src="/images/loading/loading.gif"
- height={60}
- width={100}
- alt="infisical loading indicator"
- ></Image>
- </div>
- ) : (
- <div className='h-min'>
- <div className="flex flex-row px-4 py-3 border-b border-mineshaft-500 justify-between items-center">
- <p className="font-semibold text-lg text-bunker-200">{t("Point-in-time Recovery")}</p>
- <div className='p-1' onClick={() => toggleSidebar(false)}>
- <FontAwesomeIcon icon={faX} className='w-4 h-4 text-bunker-300 cursor-pointer'/>
- </div>
+ };
+
+ return (
+ <div
+ className={`absolute border-l border-mineshaft-500 ${
+ isLoading ? 'bg-bunker-800' : 'bg-bunker'
+ } fixed h-full w-96 top-14 right-0 z-40 shadow-xl flex flex-col justify-between`}
+ >
+ {isLoading ? (
+ <div className="flex items-center justify-center h-full mb-8">
+ <Image
+ src="/images/loading/loading.gif"
+ height={60}
+ width={100}
+ alt="infisical loading indicator"
+ />
</div>
- <div className='flex flex-col px-2 py-2 overflow-y-auto h-[92vh]'>
- {secretSnapshotsMetadata?.map((snapshot: SnaphotProps, id: number) =>
- <div
- key={snapshot._id}
- onClick={() => exploreSnapshot({ snapshotId: snapshot._id })}
- className={`${chosenSnapshot == snapshot._id || (id == 0 && chosenSnapshot === "") ? "bg-primary text-black pointer-events-none" : "bg-mineshaft-700 hover:bg-mineshaft-500 duration-200 cursor-pointer"} py-3 px-4 mb-2 rounded-md flex flex-row justify-between items-center`}
+ ) : (
+ <div className="h-min">
+ <div className="flex flex-row px-4 py-3 border-b border-mineshaft-500 justify-between items-center">
+ <p className="font-semibold text-lg text-bunker-200">{t('Point-in-time Recovery')}</p>
+ <div
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
+ className="p-1"
+ onClick={() => toggleSidebar(false)}
>
- <div className="flex flex-row items-start">
- <div className={`${chosenSnapshot == snapshot._id || (id == 0 && chosenSnapshot === "") ? "text-bunker-800" : "text-bunker-200"} text-sm mr-1.5`}>{timeSince(new Date(snapshot.createdAt))}</div>
- <div className={`${chosenSnapshot == snapshot._id || (id == 0 && chosenSnapshot === "") ? "text-bunker-900" : "text-bunker-300"} text-sm `}>{" - " + snapshot.secretVersions.length + " Secrets"}</div>
+ <FontAwesomeIcon icon={faX} className="w-4 h-4 text-bunker-300 cursor-pointer" />
+ </div>
+ </div>
+ <div className="flex flex-col px-2 py-2 overflow-y-auto h-[92vh]">
+ {secretSnapshotsMetadata?.map((snapshot: SnaphotProps, id: number) => (
+ <div
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
+ key={snapshot._id}
+ onClick={() => exploreSnapshot({ snapshotId: snapshot._id })}
+ className={`${
+ chosenSnapshot === snapshot._id || (id === 0 && chosenSnapshot === '')
+ ? 'bg-primary text-black pointer-events-none'
+ : 'bg-mineshaft-700 hover:bg-mineshaft-500 duration-200 cursor-pointer'
+ } py-3 px-4 mb-2 rounded-md flex flex-row justify-between items-center`}
+ >
+ <div className="flex flex-row items-start">
+ <div
+ className={`${
+ chosenSnapshot === snapshot._id || (id === 0 && chosenSnapshot === '')
+ ? 'text-bunker-800'
+ : 'text-bunker-200'
+ } text-sm mr-1.5`}
+ >
+ {timeSince(new Date(snapshot.createdAt))}
+ </div>
+ <div
+ className={`${
+ chosenSnapshot === snapshot._id || (id === 0 && chosenSnapshot === '')
+ ? 'text-bunker-900'
+ : 'text-bunker-300'
+ } text-sm `}
+ >{` - ${snapshot.secretVersions.length} Secrets`}</div>
+ </div>
+ <div
+ className={`${
+ chosenSnapshot === snapshot._id || (id === 0 && chosenSnapshot === '')
+ ? 'text-bunker-800 pointer-events-none'
+ : 'text-bunker-200 hover:text-primary duration-200 cursor-pointer'
+ } text-sm`}
+ >
+ {id === 0
+ ? 'Current Version'
+ : chosenSnapshot === snapshot._id
+ ? 'Currently Viewing'
+ : 'Explore'}
+ </div>
</div>
- <div
- className={`${chosenSnapshot == snapshot._id || (id == 0 && chosenSnapshot === "") ? "text-bunker-800 pointer-events-none" : "text-bunker-200 hover:text-primary duration-200 cursor-pointer"} text-sm`}>
- {id == 0 ? "Current Version" : chosenSnapshot == snapshot._id ? "Currently Viewing" : "Explore"}
+ ))}
+ <div className="flex justify-center w-full mb-14">
+ <div className="items-center w-40">
+ <Button
+ text="View More"
+ textDisabled="End of History"
+ active={secretSnapshotsMetadata.length % 15 === 0}
+ onButtonPressed={loadMoreSnapshots}
+ size="md"
+ color="mineshaft"
+ />
</div>
- </div>)}
- <div className='flex justify-center w-full mb-14'>
- <div className='items-center w-40'>
- <Button text="View More" textDisabled="End of History" active={secretSnapshotsMetadata.length % 15 == 0 ? true : false} onButtonPressed={loadMoreSnapshots} size="md" color="mineshaft"/>
</div>
</div>
</div>
- </div>
- )}
- </div>
+ )}
+ </div>
+ );
};
export default PITRecoverySidebar;
diff --git a/frontend/src/ee/components/SecretVersionList.tsx b/frontend/src/ee/components/SecretVersionList.tsx
index 8a97383920..b7fbdaa79a 100644
--- a/frontend/src/ee/components/SecretVersionList.tsx
+++ b/frontend/src/ee/components/SecretVersionList.tsx
@@ -1,14 +1,16 @@
import { useEffect, useState } from 'react';
import Image from 'next/image';
import { useRouter } from 'next/router';
-import { useTranslation } from "next-i18next";
+import { useTranslation } from 'next-i18next';
+import {
+ decryptAssymmetric,
+ decryptSymmetric
+} from '@app/components/utilities/cryptography/crypto';
import getSecretVersions from '@app/ee/api/secrets/GetSecretVersions';
+import getLatestFileKey from '@app/pages/api/workspace/getLatestFileKey';
import { faCircle, faDotCircle } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import { decryptAssymmetric, decryptSymmetric } from '~/components/utilities/cryptography/crypto';
-import getLatestFileKey from '~/pages/api/workspace/getLatestFileKey';
-
interface DecryptedSecretVersionListProps {
createdAt: string;
value: string;
@@ -21,24 +23,23 @@ interface EncrypetedSecretVersionListProps {
secretValueTag: string;
}
-
/**
* @param {string} secretId - the id of a secret for which are querying version history
* @returns a list of versions for a specific secret
*/
-const SecretVersionList = ({ secretId }: { secretId: string; }) => {
+const SecretVersionList = ({ secretId }: { secretId: string }) => {
const router = useRouter();
const [isLoading, setIsLoading] = useState(false);
const { t } = useTranslation();
const [secretVersions, setSecretVersions] = useState<DecryptedSecretVersionListProps[]>([]);
-
+
useEffect(() => {
const getSecretVersionHistory = async () => {
setIsLoading(true);
try {
- const encryptedSecretVersions = await getSecretVersions({ secretId, offset: 0, limit: 10});
- const latestKey = await getLatestFileKey({ workspaceId: String(router.query.id) })
-
+ const encryptedSecretVersions = await getSecretVersions({ secretId, offset: 0, limit: 10 });
+ const latestKey = await getLatestFileKey({ workspaceId: String(router.query.id) });
+
const PRIVATE_KEY = localStorage.getItem('PRIVATE_KEY');
let decryptedLatestKey: string;
@@ -52,8 +53,8 @@ const SecretVersionList = ({ secretId }: { secretId: string; }) => {
});
}
- const decryptedSecretVersions = encryptedSecretVersions?.secretVersions.map((encryptedSecretVersion: EncrypetedSecretVersionListProps) => {
- return {
+ const decryptedSecretVersions = encryptedSecretVersions?.secretVersions.map(
+ (encryptedSecretVersion: EncrypetedSecretVersionListProps) => ({
createdAt: encryptedSecretVersion.createdAt,
value: decryptSymmetric({
ciphertext: encryptedSecretVersion.secretValueCiphertext,
@@ -61,63 +62,76 @@ const SecretVersionList = ({ secretId }: { secretId: string; }) => {
tag: encryptedSecretVersion.secretValueTag,
key: decryptedLatestKey
})
- }
- })
+ })
+ );
setSecretVersions(decryptedSecretVersions);
setIsLoading(false);
} catch (error) {
- console.log(error)
+ console.log(error);
}
};
getSecretVersionHistory();
}, [secretId]);
- return <div className='w-full h-52 px-4 mt-4 text-sm text-bunker-300 overflow-x-none'>
- <p className=''>{t("dashboard:sidebar.version-history")}</p>
- <div className='p-1 rounded-md bg-bunker-800 border border-mineshaft-500 overflow-x-none h-full'>
- {isLoading ? (
- <div className="flex items-center justify-center h-full">
- <Image
- src="/images/loading/loading.gif"
- height={60}
- width={100}
- alt="infisical loading indicator"
- ></Image>
- </div>
- ) : (
- <div className='h-48 overflow-y-auto overflow-x-none'>
- {secretVersions
- ? secretVersions?.sort((a, b) => b.createdAt.localeCompare(a.createdAt))
- .map((version: DecryptedSecretVersionListProps, index: number) =>
- <div key={index} className='flex flex-row'>
- <div className='pr-1 flex flex-col items-center'>
- <div className='p-1'><FontAwesomeIcon icon={index == 0 ? faDotCircle : faCircle} /></div>
- <div className='w-0 h-full border-l mt-1'></div>
- </div>
- <div className='flex flex-col w-full max-w-[calc(100%-2.3rem)]'>
- <div className='pr-2 pt-1'>
- {(new Date(version.createdAt)).toLocaleDateString('en-US', {
- year: 'numeric',
- month: '2-digit',
- day: '2-digit',
- hour: '2-digit',
- minute: '2-digit',
- second: '2-digit'
- })}
+ return (
+ <div className="w-full h-52 px-4 mt-4 text-sm text-bunker-300 overflow-x-none">
+ <p className="">{t('dashboard:sidebar.version-history')}</p>
+ <div className="p-1 rounded-md bg-bunker-800 border border-mineshaft-500 overflow-x-none h-full">
+ {isLoading ? (
+ <div className="flex items-center justify-center h-full">
+ <Image
+ src="/images/loading/loading.gif"
+ height={60}
+ width={100}
+ alt="infisical loading indicator"
+ />
+ </div>
+ ) : (
+ <div className="h-48 overflow-y-auto overflow-x-none">
+ {secretVersions ? (
+ secretVersions
+ ?.sort((a, b) => b.createdAt.localeCompare(a.createdAt))
+ .map((version: DecryptedSecretVersionListProps, index: number) => (
+ <div key={`${version.createdAt}.${index + 1}`} className="flex flex-row">
+ <div className="pr-1 flex flex-col items-center">
+ <div className="p-1">
+ <FontAwesomeIcon icon={index === 0 ? faDotCircle : faCircle} />
+ </div>
+ <div className="w-0 h-full border-l mt-1" />
+ </div>
+ <div className="flex flex-col w-full max-w-[calc(100%-2.3rem)]">
+ <div className="pr-2 pt-1">
+ {new Date(version.createdAt).toLocaleDateString('en-US', {
+ year: 'numeric',
+ month: '2-digit',
+ day: '2-digit',
+ hour: '2-digit',
+ minute: '2-digit',
+ second: '2-digit'
+ })}
+ </div>
+ <div className="">
+ <p className="break-words">
+ <span className="py-0.5 px-1 rounded-md bg-primary-200/10 mr-1.5">
+ Value:
+ </span>
+ {version.value}
+ </p>
+ </div>
+ </div>
</div>
- <div className=''><p className='break-words'><span className='py-0.5 px-1 rounded-md bg-primary-200/10 mr-1.5'>Value:</span>{version.value}</p></div>
- </div>
+ ))
+ ) : (
+ <div className="w-full h-full flex items-center justify-center text-bunker-400">
+ No version history yet.
</div>
- )
- : (
- <div className='w-full h-full flex items-center justify-center text-bunker-400'>No version history yet.</div>
- )
- }
- </div>
- )}
+ )}
+ </div>
+ )}
+ </div>
</div>
- </div>
+ );
};
export default SecretVersionList;
diff --git a/frontend/src/ee/utilities/findTextDifferences.ts b/frontend/src/ee/utilities/findTextDifferences.ts
index ffd847a778..c15bb4b058 100644
--- a/frontend/src/ee/utilities/findTextDifferences.ts
+++ b/frontend/src/ee/utilities/findTextDifferences.ts
@@ -1,270 +1,284 @@
+/* eslint-disable */
+// TODO(akhilmhdh): Danger. This file functions needs to simplified.
+// Disabled eslinting as below algos uses unnary operator and need to be careful on handling it
+// Will revisit this and change to simplier non-recursive to dynamic programming with space allocation strategy
/**
- *
+ *
* @param textOld - old secret
* @param textNew - new (updated) secret
- * @param diffPlusFlag - a flag for whether we want to detect moving segments
+ * @param diffPlusFlag - a flag for whether we want to detect moving segments
* - doesn't work in some examples (e.g., when we have a full reverse ordering of the text)
- * @returns
+ * @returns
*/
function patienceDiff(textOld: string[], textNew: string[], diffPlusFlag?: boolean) {
-
/**
* findUnique finds all unique values in arr[lo..hi], inclusive. This
* function is used in preparation for determining the longest common
* subsequence. Specifically, it first reduces the array range in question
* to unique values.
* @param chars - an array of characters
- * @param lo
- * @param hi
+ * @param lo
+ * @param hi
* @returns - an ordered Map, with the arr[i] value as the Map key and the
- * array index i as the Map value.
+ * array index i as the Map value.
*/
- function findUnique(chars: string[], lo: number, hi: number) {
- const characterMap = new Map();
-
- for (let i=lo; i<=hi; i++) {
- const character = chars[i];
-
- if (characterMap.has(character)) {
- characterMap.get(character).count++;
- characterMap.get(character).index = i;
- } else {
- characterMap.set(character, { count: 1, index: i });
- }
- }
-
- characterMap.forEach((val, key, map) => {
- if (val.count !== 1) {
- map.delete(key);
- } else {
- map.set(key, val.index);
- }
- });
-
- return characterMap;
- }
+ function findUnique(chars: string[], lo: number, hi: number) {
+ const characterMap = new Map();
+
+ for (let i = lo; i <= hi; i += 1) {
+ const character = chars[i];
+
+ if (characterMap.has(character)) {
+ characterMap.get(character).count += 1;
+ characterMap.get(character).index = i;
+ } else {
+ characterMap.set(character, { count: 1, index: i });
+ }
+ }
+
+ characterMap.forEach((val, key, map) => {
+ if (val.count !== 1) {
+ map.delete(key);
+ } else {
+ map.set(key, val.index);
+ }
+ });
+
+ return characterMap;
+ }
/**
- * @param aArray
- * @param aLo
- * @param aHi
- * @param bArray
- * @param bLo
- * @param bHi
+ * @param aArray
+ * @param aLo
+ * @param aHi
+ * @param bArray
+ * @param bLo
+ * @param bHi
* @returns an ordered Map, with the Map key as the common line between aArray
* and bArray, with the Map value as an object containing the array indexes of
* the matching unique lines.
- *
+ *
*/
- function uniqueCommon(aArray: string[], aLo: number, aHi: number, bArray: string[], bLo: number, bHi: number) {
- const ma = findUnique(aArray, aLo, aHi);
- const mb = findUnique(bArray, bLo, bHi);
-
- ma.forEach((val, key, map) => {
- if (mb.has(key)) {
- map.set(key, {
- indexA: val,
- indexB: mb.get(key)
- });
- } else {
- map.delete(key);
- }
- });
-
- return ma;
- }
+ function uniqueCommon(
+ aArray: string[],
+ aLo: number,
+ aHi: number,
+ bArray: string[],
+ bLo: number,
+ bHi: number
+ ) {
+ const ma = findUnique(aArray, aLo, aHi);
+ const mb = findUnique(bArray, bLo, bHi);
+
+ ma.forEach((val, key, map) => {
+ if (mb.has(key)) {
+ map.set(key, {
+ indexA: val,
+ indexB: mb.get(key)
+ });
+ } else {
+ map.delete(key);
+ }
+ });
+
+ return ma;
+ }
/**
* longestCommonSubsequence takes an ordered Map from the function uniqueCommon
* and determines the Longest Common Subsequence (LCS).
- * @param abMap
+ * @param abMap
* @returns an ordered array of objects containing the array indexes of the
* matching lines for a LCS.
*/
- function longestCommonSubsequence(abMap: Map<number, { indexA: number, indexB: number, prev?: number }>) {
- const ja: any = [];
-
- // First, walk the list creating the jagged array.
- abMap.forEach((val, key, map) => {
- let i = 0;
-
- while (ja[i] && ja[i][ja[i].length - 1].indexB < val.indexB) {
- i++;
- }
-
- if (!ja[i]) {
- ja[i] = [];
- }
-
- if (0 < i) {
- val.prev = ja[i-1][ja[i - 1].length - 1];
- }
- ja[i].push(val);
- });
-
- // Now, pull out the longest common subsequence.
- let lcs: any[] = [];
-
- if (0 < ja.length) {
- const n = ja.length - 1;
- lcs = [ja[n][ja[n].length - 1]];
-
- while (lcs[lcs.length - 1].prev) {
- lcs.push(lcs[lcs.length - 1].prev);
- }
- }
-
- return lcs.reverse();
- }
-
- // "result" is the array used to accumulate the textOld that are deleted, the
- // lines that are shared between textOld and textNew, and the textNew that were
- // inserted.
-
- const result: any[] = [];
- let deleted = 0;
- let inserted = 0;
-
- // aMove and bMove will contain the lines that don't match, and will be returned
- // for possible searching of lines that moved.
-
- const aMove: any[] = [];
- const aMoveIndex: any[] = [];
- const bMove: any[] = [];
- const bMoveIndex: any[] = [];
+ function longestCommonSubsequence(
+ abMap: Map<number, { indexA: number; indexB: number; prev?: number }>
+ ) {
+ const ja: any = [];
+
+ // First, walk the list creating the jagged array.
+ abMap.forEach((val, key, map) => {
+ let i = 0;
+
+ while (ja[i] && ja[i][ja[i].length - 1].indexB < val.indexB) {
+ i += 1;
+ }
+
+ if (!ja[i]) {
+ ja[i] = [];
+ }
+
+ if (i > 0) {
+ val.prev = ja[i - 1][ja[i - 1].length - 1];
+ }
+ ja[i].push(val);
+ });
+
+ // Now, pull out the longest common subsequence.
+ let lcs: any[] = [];
+
+ if (ja.length > 0) {
+ const n = ja.length - 1;
+ lcs = [ja[n][ja[n].length - 1]];
+
+ while (lcs[lcs.length - 1].prev) {
+ lcs.push(lcs[lcs.length - 1].prev);
+ }
+ }
+
+ return lcs.reverse();
+ }
+
+ // "result" is the array used to accumulate the textOld that are deleted, the
+ // lines that are shared between textOld and textNew, and the textNew that were
+ // inserted.
+
+ const result: any[] = [];
+ let deleted = 0;
+ let inserted = 0;
+
+ // aMove and bMove will contain the lines that don't match, and will be returned
+ // for possible searching of lines that moved.
+
+ const aMove: any[] = [];
+ const aMoveIndex: any[] = [];
+ const bMove: any[] = [];
+ const bMoveIndex: any[] = [];
/**
* addToResult simply pushes the latest value onto the "result" array. This
* array captures the diff of the line, aIndex, and bIndex from the textOld
* and textNew array.
- * @param aIndex
- * @param bIndex
+ * @param aIndex
+ * @param bIndex
*/
- function addToResult(aIndex: number, bIndex: number) {
- if (bIndex < 0) {
- aMove.push(textOld[aIndex]);
- aMoveIndex.push(result.length);
- deleted++;
- } else if (aIndex < 0) {
- bMove.push(textNew[bIndex]);
- bMoveIndex.push(result.length);
- inserted++;
- }
-
- result.push({
- line: 0 <= aIndex ? textOld[aIndex] : textNew[bIndex],
- aIndex: aIndex,
- bIndex: bIndex,
- });
- }
-
+ function addToResult(aIndex: number, bIndex: number) {
+ if (bIndex < 0) {
+ aMove.push(textOld[aIndex]);
+ aMoveIndex.push(result.length);
+ deleted += 1;
+ } else if (aIndex < 0) {
+ bMove.push(textNew[bIndex]);
+ bMoveIndex.push(result.length);
+ inserted += 1;
+ }
+
+ result.push({
+ line: aIndex >= 0 ? textOld[aIndex] : textNew[bIndex],
+ aIndex,
+ bIndex
+ });
+ }
+
/**
* addSubMatch handles the lines between a pair of entries in the LCS. Thus,
* this function might recursively call recurseLCS to further match the lines
* between textOld and textNew.
- * @param aLo
- * @param aHi
- * @param bLo
- * @param bHi
+ * @param aLo
+ * @param aHi
+ * @param bLo
+ * @param bHi
*/
- function addSubMatch(aLo: number, aHi: number, bLo: number, bHi: number) {
- // Match any lines at the beginning of textOld and textNew.
- while (aLo <= aHi && bLo <= bHi && textOld[aLo] === textNew[bLo]) {
- addToResult(aLo++, bLo++);
- }
-
- // Match any lines at the end of textOld and textNew, but don't place them
- // in the "result" array just yet, as the lines between these matches at
- // the beginning and the end need to be analyzed first.
-
- const aHiTemp = aHi;
- while (aLo <= aHi && bLo <= bHi && textOld[aHi] === textNew[bHi]) {
- aHi--;
- bHi--;
- }
-
- // Now, check to determine with the remaining lines in the subsequence
- // whether there are any unique common lines between textOld and textNew.
- //
- // If not, add the subsequence to the result (all textOld having been
- // deleted, and all textNew having been inserted).
- //
- // If there are unique common lines between textOld and textNew, then let's
- // recursively perform the patience diff on the subsequence.
-
- const uniqueCommonMap = uniqueCommon(textOld, aLo, aHi, textNew, bLo, bHi);
-
- if (uniqueCommonMap.size === 0) {
- while (aLo <= aHi) {
- addToResult(aLo++, -1);
- }
-
- while (bLo <= bHi) {
- addToResult(-1, bLo++);
- }
- } else {
- recurseLCS(aLo, aHi, bLo, bHi, uniqueCommonMap);
- }
-
- // Finally, let's add the matches at the end to the result.
- while (aHi < aHiTemp) {
- addToResult(++aHi, ++bHi);
- }
- }
-
+ function addSubMatch(aLo: number, aHi: number, bLo: number, bHi: number) {
+ // Match any lines at the beginning of textOld and textNew.
+ while (aLo <= aHi && bLo <= bHi && textOld[aLo] === textNew[bLo]) {
+ addToResult(aLo++, bLo++);
+ }
+
+ // Match any lines at the end of textOld and textNew, but don't place them
+ // in the "result" array just yet, as the lines between these matches at
+ // the beginning and the end need to be analyzed first.
+
+ const aHiTemp = aHi;
+ while (aLo <= aHi && bLo <= bHi && textOld[aHi] === textNew[bHi]) {
+ aHi -= 1;
+ bHi -= 1;
+ }
+
+ // Now, check to determine with the remaining lines in the subsequence
+ // whether there are any unique common lines between textOld and textNew.
+ //
+ // If not, add the subsequence to the result (all textOld having been
+ // deleted, and all textNew having been inserted).
+ //
+ // If there are unique common lines between textOld and textNew, then let's
+ // recursively perform the patience diff on the subsequence.
+
+ const uniqueCommonMap = uniqueCommon(textOld, aLo, aHi, textNew, bLo, bHi);
+
+ if (uniqueCommonMap.size === 0) {
+ while (aLo <= aHi) {
+ addToResult(aLo++, -1);
+ }
+
+ while (bLo <= bHi) {
+ addToResult(-1, bLo++);
+ }
+ } else {
+ recurseLCS(aLo, aHi, bLo, bHi, uniqueCommonMap);
+ }
+
+ // Finally, let's add the matches at the end to the result.
+ while (aHi < aHiTemp) {
+ addToResult(++aHi, ++bHi);
+ }
+ }
+
/**
* recurseLCS finds the longest common subsequence (LCS) between the arrays
* textOld[aLo..aHi] and textNew[bLo..bHi] inclusive. Then for each subsequence
* recursively performs another LCS search (via addSubMatch), until there are
* none found, at which point the subsequence is dumped to the result.
- * @param aLo
- * @param aHi
- * @param bLo
- * @param bHi
- * @param uniqueCommonMap
+ * @param aLo
+ * @param aHi
+ * @param bLo
+ * @param bHi
+ * @param uniqueCommonMap
*/
- function recurseLCS(aLo: number, aHi: number, bLo: number, bHi: number, uniqueCommonMap?: any) {
- const x = longestCommonSubsequence(uniqueCommonMap || uniqueCommon(textOld, aLo, aHi, textNew, bLo, bHi));
-
- if (x.length === 0) {
- addSubMatch(aLo, aHi, bLo, bHi);
- } else {
- if (aLo < x[0].indexA || bLo < x[0].indexB) {
- addSubMatch(aLo, x[0].indexA - 1, bLo, x[0].indexB - 1);
- }
-
- let i;
- for (i = 0; i < x.length - 1; i++) {
- addSubMatch(x[i].indexA, x[i+1].indexA - 1, x[i].indexB, x[i+1].indexB - 1);
- }
-
- if (x[i].indexA <= aHi || x[i].indexB <= bHi) {
- addSubMatch(x[i].indexA, aHi, x[i].indexB, bHi);
- }
- }
- }
-
- recurseLCS(0, textOld.length - 1, 0, textNew.length - 1);
-
- if (diffPlusFlag) {
- return {
- lines: result,
- lineCountDeleted: deleted,
- lineCountInserted: inserted,
- lineCountMoved: 0,
- aMove: aMove,
- aMoveIndex: aMoveIndex,
- bMove: bMove,
- bMoveIndex: bMoveIndex,
- };
- }
-
- return {
- lines: result,
- lineCountDeleted: deleted,
- lineCountInserted: inserted,
- lineCountMoved: 0,
- };
+ function recurseLCS(aLo: number, aHi: number, bLo: number, bHi: number, uniqueCommonMap?: any) {
+ const x = longestCommonSubsequence(
+ uniqueCommonMap || uniqueCommon(textOld, aLo, aHi, textNew, bLo, bHi)
+ );
+
+ if (x.length === 0) {
+ addSubMatch(aLo, aHi, bLo, bHi);
+ } else {
+ if (aLo < x[0].indexA || bLo < x[0].indexB) {
+ addSubMatch(aLo, x[0].indexA - 1, bLo, x[0].indexB - 1);
+ }
+
+ let i;
+ for (i = 0; i < x.length - 1; i += 1) {
+ addSubMatch(x[i].indexA, x[i + 1].indexA - 1, x[i].indexB, x[i + 1].indexB - 1);
+ }
+
+ if (x[i].indexA <= aHi || x[i].indexB <= bHi) {
+ addSubMatch(x[i].indexA, aHi, x[i].indexB, bHi);
+ }
+ }
+ }
+
+ recurseLCS(0, textOld.length - 1, 0, textNew.length - 1);
+
+ if (diffPlusFlag) {
+ return {
+ lines: result,
+ lineCountDeleted: deleted,
+ lineCountInserted: inserted,
+ lineCountMoved: 0,
+ aMove,
+ aMoveIndex,
+ bMove,
+ bMoveIndex
+ };
+ }
+
+ return {
+ lines: result,
+ lineCountDeleted: deleted,
+ lineCountInserted: inserted,
+ lineCountMoved: 0
+ };
}
/**
@@ -289,58 +303,54 @@ function patienceDiff(textOld: string[], textNew: string[], diffPlusFlag?: boole
*/
function patienceDiffPlus(textOld: string[], textNew: string[]) {
-
- const difference = patienceDiff(textOld, textNew, true);
-
- let aMoveNext = difference.aMove;
- let aMoveIndexNext = difference.aMoveIndex;
- let bMoveNext = difference.bMove;
- let bMoveIndexNext = difference.bMoveIndex;
-
- delete difference.aMove;
- delete difference.aMoveIndex;
- delete difference.bMove;
- delete difference.bMoveIndex;
-
- let lastLineCountMoved;
-
- do {
- const aMove = aMoveNext;
- const aMoveIndex = aMoveIndexNext;
- const bMove = bMoveNext;
- const bMoveIndex = bMoveIndexNext;
-
- aMoveNext = [];
- aMoveIndexNext = [];
- bMoveNext = [];
- bMoveIndexNext = [];
-
- const subDiff = patienceDiff(aMove!, bMove!);
-
- lastLineCountMoved = difference.lineCountMoved;
-
- subDiff.lines.forEach((v, i) => {
-
- if (0 <= v.aIndex && 0 <= v.bIndex) {
-
- difference.lines[aMoveIndex![v.aIndex]].moved = true;
- difference.lines[bMoveIndex![v.bIndex]].aIndex = aMoveIndex![v.aIndex];
- difference.lines[bMoveIndex![v.bIndex]].moved = true;
- difference.lineCountInserted--;
- difference.lineCountDeleted--;
- difference.lineCountMoved++;
- } else if (v.bIndex < 0) {
- aMoveNext!.push(aMove![v.aIndex]);
- aMoveIndexNext!.push(aMoveIndex![v.aIndex]);
- } else {
- bMoveNext!.push(bMove![v.bIndex]);
- bMoveIndexNext!.push(bMoveIndex![v.bIndex]);
- }
- });
- } while (0 < difference.lineCountMoved - lastLineCountMoved);
-
- return difference;
-
+ const difference = patienceDiff(textOld, textNew, true);
+
+ let aMoveNext = difference.aMove;
+ let aMoveIndexNext = difference.aMoveIndex;
+ let bMoveNext = difference.bMove;
+ let bMoveIndexNext = difference.bMoveIndex;
+
+ delete difference.aMove;
+ delete difference.aMoveIndex;
+ delete difference.bMove;
+ delete difference.bMoveIndex;
+
+ let lastLineCountMoved;
+
+ do {
+ const aMove = aMoveNext;
+ const aMoveIndex = aMoveIndexNext;
+ const bMove = bMoveNext;
+ const bMoveIndex = bMoveIndexNext;
+
+ aMoveNext = [];
+ aMoveIndexNext = [];
+ bMoveNext = [];
+ bMoveIndexNext = [];
+
+ const subDiff = patienceDiff(aMove!, bMove!);
+
+ lastLineCountMoved = difference.lineCountMoved;
+
+ subDiff.lines.forEach((v, i) => {
+ if (v.aIndex >= 0 && v.bIndex >= 0) {
+ difference.lines[aMoveIndex![v.aIndex]].moved = true;
+ difference.lines[bMoveIndex![v.bIndex]].aIndex = aMoveIndex![v.aIndex];
+ difference.lines[bMoveIndex![v.bIndex]].moved = true;
+ difference.lineCountInserted -= 1;
+ difference.lineCountDeleted -= 1;
+ difference.lineCountMoved += 1;
+ } else if (v.bIndex < 0) {
+ aMoveNext!.push(aMove![v.aIndex]);
+ aMoveIndexNext!.push(aMoveIndex![v.aIndex]);
+ } else {
+ bMoveNext!.push(bMove![v.bIndex]);
+ bMoveIndexNext!.push(bMoveIndex![v.bIndex]);
+ }
+ });
+ } while (difference.lineCountMoved - lastLineCountMoved > 0);
+
+ return difference;
}
export default patienceDiff;
diff --git a/frontend/src/ee/utilities/timeSince.ts b/frontend/src/ee/utilities/timeSince.ts
index b792499670..3c80cb78b3 100644
--- a/frontend/src/ee/utilities/timeSince.ts
+++ b/frontend/src/ee/utilities/timeSince.ts
@@ -11,25 +11,25 @@ function timeSince(date: Date) {
let interval = seconds / 31536000;
if (interval > 1) {
- return Math.floor(interval) + ' years ago';
+ return `${Math.floor(interval) } years ago`;
}
interval = seconds / 2592000;
if (interval > 1) {
- return Math.floor(interval) + ' months ago';
+ return `${Math.floor(interval) } months ago`;
}
interval = seconds / 86400;
if (interval > 1) {
- return Math.floor(interval) + ' days ago';
+ return `${Math.floor(interval) } days ago`;
}
interval = seconds / 3600;
if (interval > 1) {
- return Math.floor(interval) + ' hours ago';
+ return `${Math.floor(interval) } hours ago`;
}
interval = seconds / 60;
if (interval > 1) {
- return Math.floor(interval) + ' minutes ago';
+ return `${Math.floor(interval) } minutes ago`;
}
- return Math.floor(seconds) + ' seconds ago';
+ return `${Math.floor(seconds) } seconds ago`;
}
export default timeSince;
diff --git a/frontend/src/hooks/usePopUp.tsx b/frontend/src/hooks/usePopUp.tsx
index eb0835b495..b0c4163beb 100644
--- a/frontend/src/hooks/usePopUp.tsx
+++ b/frontend/src/hooks/usePopUp.tsx
@@ -1,6 +1,6 @@
import { useCallback, useState } from 'react';
-interface usePopUpProps {
+interface UsePopUpProps {
name: Readonly<string>;
isOpen: boolean;
}
@@ -10,18 +10,18 @@ interface usePopUpProps {
* checks which type of inputProps were given and converts them into key-names
* SIDENOTE: On inputting give it as const and not string with (as const)
*/
-type usePopUpState<T extends Readonly<string[]> | usePopUpProps[]> = {
- [P in T extends usePopUpProps[] ? T[number]['name'] : T[number]]: {
+type UsePopUpState<T extends Readonly<string[]> | UsePopUpProps[]> = {
+ [P in T extends UsePopUpProps[] ? T[number]['name'] : T[number]]: {
isOpen: boolean;
data?: unknown;
};
};
-interface usePopUpReturn<T extends Readonly<string[]> | usePopUpProps[]> {
- popUp: usePopUpState<T>;
- handlePopUpOpen: (popUpName: keyof usePopUpState<T>, data?: unknown) => void;
- handlePopUpClose: (popUpName: keyof usePopUpState<T>) => void;
- handlePopUpToggle: (popUpName: keyof usePopUpState<T>) => void;
+interface UsePopUpReturn<T extends Readonly<string[]> | UsePopUpProps[]> {
+ popUp: UsePopUpState<T>;
+ handlePopUpOpen: (popUpName: keyof UsePopUpState<T>, data?: unknown) => void;
+ handlePopUpClose: (popUpName: keyof UsePopUpState<T>) => void;
+ handlePopUpToggle: (popUpName: keyof UsePopUpState<T>) => void;
}
/**
@@ -29,34 +29,31 @@ interface usePopUpReturn<T extends Readonly<string[]> | usePopUpProps[]> {
* Provides api to open,close,toggle and also store temporary data for the popUp
* @param popUpNames: the names of popUp containers eg: ["popUp1","second"] or [{name:"popUp2",isOpen:bool}]
*/
-export const usePopUp = <T extends Readonly<string[]> | usePopUpProps[]>(
+export const usePopUp = <T extends Readonly<string[]> | UsePopUpProps[]>(
popUpNames: T
-): usePopUpReturn<T> => {
- const [popUp, setPopUp] = useState<usePopUpState<T>>(
+): UsePopUpReturn<T> => {
+ const [popUp, setPopUp] = useState<UsePopUpState<T>>(
Object.fromEntries(
popUpNames.map((popUpName) =>
typeof popUpName === 'string'
? [popUpName, { isOpen: false }]
: [popUpName.name, { isOpen: popUpName.isOpen }]
) // convert into an array of [[popUpName,state]] then into Object
- ) as usePopUpState<T> // to override generic string return type of the function
+ ) as UsePopUpState<T> // to override generic string return type of the function
);
- const handlePopUpOpen = useCallback(
- (popUpName: keyof usePopUpState<T>, data?: unknown) => {
- setPopUp((popUp) => ({ ...popUp, [popUpName]: { isOpen: true, data } }));
- },
- []
- );
+ const handlePopUpOpen = useCallback((popUpName: keyof UsePopUpState<T>, data?: unknown) => {
+ setPopUp((oldState) => ({ ...oldState, [popUpName]: { isOpen: true, data } }));
+ }, []);
- const handlePopUpClose = useCallback((popUpName: keyof usePopUpState<T>) => {
- setPopUp((popUp) => ({ ...popUp, [popUpName]: { isOpen: false } }));
+ const handlePopUpClose = useCallback((popUpName: keyof UsePopUpState<T>) => {
+ setPopUp((oldState) => ({ ...oldState, [popUpName]: { isOpen: false } }));
}, []);
- const handlePopUpToggle = useCallback((popUpName: keyof usePopUpState<T>) => {
- setPopUp((popUp) => ({
- ...popUp,
- [popUpName]: { isOpen: !popUp[popUpName].isOpen },
+ const handlePopUpToggle = useCallback((popUpName: keyof UsePopUpState<T>) => {
+ setPopUp((oldState) => ({
+ ...oldState,
+ [popUpName]: { isOpen: !oldState[popUpName].isOpen }
}));
}, []);
@@ -64,6 +61,6 @@ export const usePopUp = <T extends Readonly<string[]> | usePopUpProps[]>(
popUp,
handlePopUpOpen,
handlePopUpClose,
- handlePopUpToggle,
+ handlePopUpToggle
};
};
diff --git a/frontend/src/pages/404.tsx b/frontend/src/pages/404.tsx
index ac96cd68be..9c51f2faef 100644
--- a/frontend/src/pages/404.tsx
+++ b/frontend/src/pages/404.tsx
@@ -32,7 +32,7 @@ export default function Custom404() {
height={554}
width={942}
alt='infisical dragon - page not found'
- ></Image>
+ />
</div>
</div>
);
diff --git a/frontend/src/pages/_app.tsx b/frontend/src/pages/_app.tsx
index ce905b2e52..73766169de 100644
--- a/frontend/src/pages/_app.tsx
+++ b/frontend/src/pages/_app.tsx
@@ -1,15 +1,15 @@
+/* eslint-disable react/jsx-props-no-spreading */
import { useEffect } from 'react';
import { AppProps } from 'next/app';
import { useRouter } from 'next/router';
import { appWithTranslation } from 'next-i18next';
+import Layout from '@app/components/basic/Layout';
+import NotificationProvider from '@app/components/context/Notifications/NotificationProvider';
+import RouteGuard from '@app/components/RouteGuard';
+import Telemetry from '@app/components/utilities/telemetry/Telemetry';
+import { publicPaths } from '@app/const';
import { config } from '@fortawesome/fontawesome-svg-core';
-import Layout from '~/components/basic/Layout';
-import NotificationProvider from '~/components/context/Notifications/NotificationProvider';
-import RouteGuard from '~/components/RouteGuard';
-import { publicPaths } from '~/const';
-import Telemetry from '~/utilities/telemetry/Telemetry';
-
import '@fortawesome/fontawesome-svg-core/styles.css';
import '../styles/globals.css';
@@ -19,18 +19,14 @@ type NextAppProp = AppProps & {
Component: AppProps['Component'] & { requireAuth: boolean };
};
-const App = ({
- Component,
- pageProps,
- ...appProps
-}: NextAppProp): JSX.Element => {
+const App = ({ Component, pageProps, ...appProps }: NextAppProp): JSX.Element => {
const router = useRouter();
useEffect(() => {
const storedLang = localStorage.getItem('lang');
- if (router.locale ?? 'en' !== storedLang ?? 'en') {
+ if (router.locale ?? storedLang !== 'en' ?? 'en') {
router.push(router.asPath, router.asPath, {
- locale: storedLang ?? 'en',
+ locale: storedLang ?? 'en'
});
}
}, [router.locale, router.pathname]);
@@ -54,7 +50,7 @@ const App = ({
// If it's one of these routes, don't add the layout (e.g., these routes are external)
if (
- publicPaths.includes('/' + appProps.router.pathname.split('/')[1]) ||
+ publicPaths.includes(`/${appProps.router.pathname.split('/')[1]}`) ||
!Component.requireAuth
) {
return <Component {...pageProps} />;
@@ -73,8 +69,7 @@ const App = ({
export default appWithTranslation(App);
-{
- /* <Script
+/* <Script
src="https://www.googletagmanager.com/gtag/js?id=G-DQ1XLJJGG1"
strategy="afterInteractive"
/>
@@ -87,4 +82,3 @@ strategy="afterInteractive"
gtag('config', 'G-DQ1XLJJGG1');
`}
</Script> */
-}
diff --git a/frontend/src/pages/activity/[id].tsx b/frontend/src/pages/activity/[id].tsx
index fb5285fb3f..981ebc4bbe 100644
--- a/frontend/src/pages/activity/[id].tsx
+++ b/frontend/src/pages/activity/[id].tsx
@@ -1,18 +1,16 @@
import React, { useEffect, useState } from 'react';
import { useRouter } from 'next/router';
-import { useTranslation } from "next-i18next";
+import { useTranslation } from 'next-i18next';
+import Button from '@app/components/basic/buttons/Button';
+import EventFilter from '@app/components/basic/EventFilter';
+import NavHeader from '@app/components/navigation/NavHeader';
+import { getTranslatedServerSideProps } from '@app/components/utilities/withTranslateProps';
import ActivitySideBar from '@app/ee/components/ActivitySideBar';
-import Button from '~/components/basic/buttons/Button';
-import EventFilter from '~/components/basic/EventFilter';
-import NavHeader from '~/components/navigation/NavHeader';
-import { getTranslatedServerSideProps } from '~/components/utilities/withTranslateProps';
-
import getProjectLogs from '../../ee/api/secrets/GetProjectLogs';
import ActivityTable from '../../ee/components/ActivityTable';
-
-interface logData {
+interface LogData {
_id: string;
channel: string;
createdAt: string;
@@ -25,17 +23,17 @@ interface logData {
name: string;
payload: {
secretVersions: string[];
- }
- }[]
+ };
+ }[];
}
interface PayloadProps {
_id: string;
- name: string;
+ name: string;
secretVersions: string[];
}
-interface logDataPoint {
+interface LogDataPoint {
_id: string;
channel: string;
createdAt: string;
@@ -50,11 +48,11 @@ interface logDataPoint {
export default function Activity() {
const router = useRouter();
const [eventChosen, setEventChosen] = useState('');
- const [logsData, setLogsData] = useState<logDataPoint[]>([]);
+ const [logsData, setLogsData] = useState<LogDataPoint[]>([]);
const [isLoading, setIsLoading] = useState(false);
const [currentOffset, setCurrentOffset] = useState(0);
const currentLimit = 10;
- const [currentSidebarAction, toggleSidebar] = useState<string>()
+ const [currentSidebarAction, toggleSidebar] = useState<string>();
const { t } = useTranslation();
// this use effect updates the data in case of a new filter being added
@@ -62,25 +60,29 @@ export default function Activity() {
setCurrentOffset(0);
const getLogData = async () => {
setIsLoading(true);
- const tempLogsData = await getProjectLogs({ workspaceId: String(router.query.id), offset: 0, limit: currentLimit, userId: "", actionNames: eventChosen })
- setLogsData(tempLogsData.map((log: logData) => {
- return {
- _id: log._id,
- channel: log.channel,
- createdAt: log.createdAt,
- ipAddress: log.ipAddress,
- user: log.user.email,
- payload: log.actions.map(action => {
- return {
- _id: action._id,
- name: action.name,
- secretVersions: action.payload.secretVersions
- }
- })
- }
- }))
+ const tempLogsData = await getProjectLogs({
+ workspaceId: String(router.query.id),
+ offset: 0,
+ limit: currentLimit,
+ userId: '',
+ actionNames: eventChosen
+ });
+ setLogsData(
+ tempLogsData.map((log: LogData) => ({
+ _id: log._id,
+ channel: log.channel,
+ createdAt: log.createdAt,
+ ipAddress: log.ipAddress,
+ user: log.user.email,
+ payload: log.actions.map((action) => ({
+ _id: action._id,
+ name: action.name,
+ secretVersions: action.payload.secretVersions
+ }))
+ }))
+ );
setIsLoading(false);
- }
+ };
getLogData();
}, [eventChosen]);
@@ -88,58 +90,64 @@ export default function Activity() {
useEffect(() => {
const getLogData = async () => {
setIsLoading(true);
- const tempLogsData = await getProjectLogs({ workspaceId: String(router.query.id), offset: currentOffset, limit: currentLimit, userId: "", actionNames: eventChosen })
- setLogsData(logsData.concat(tempLogsData.map((log: logData) => {
- return {
- _id: log._id,
- channel: log.channel,
- createdAt: log.createdAt,
- ipAddress: log.ipAddress,
- user: log.user.email,
- payload: log.actions.map(action => {
- return {
+ const tempLogsData = await getProjectLogs({
+ workspaceId: String(router.query.id),
+ offset: currentOffset,
+ limit: currentLimit,
+ userId: '',
+ actionNames: eventChosen
+ });
+ setLogsData(
+ logsData.concat(
+ tempLogsData.map((log: LogData) => ({
+ _id: log._id,
+ channel: log.channel,
+ createdAt: log.createdAt,
+ ipAddress: log.ipAddress,
+ user: log.user.email,
+ payload: log.actions.map((action) => ({
_id: action._id,
name: action.name,
secretVersions: action.payload.secretVersions
- }
- })
- }
- })))
+ }))
+ }))
+ )
+ );
setIsLoading(false);
- }
+ };
getLogData();
}, [currentLimit, currentOffset]);
const loadMoreLogs = () => {
setCurrentOffset(currentOffset + currentLimit);
- }
+ };
return (
<div className="mx-6 lg:mx-0 w-full overflow-y-scroll h-screen">
- <NavHeader pageName="Project Activity" isProjectRelated={true} />
- {currentSidebarAction && <ActivitySideBar toggleSidebar={toggleSidebar} currentAction={currentSidebarAction} />}
+ <NavHeader pageName="Project Activity" isProjectRelated />
+ {currentSidebarAction && (
+ <ActivitySideBar toggleSidebar={toggleSidebar} currentAction={currentSidebarAction} />
+ )}
<div className="flex flex-col justify-between items-start mx-4 mt-6 mb-4 text-xl max-w-5xl px-2">
<div className="flex flex-row justify-start items-center text-3xl">
- <p className="font-semibold mr-4 text-bunker-100">{t("activity:title")}</p>
+ <p className="font-semibold mr-4 text-bunker-100">{t('activity:title')}</p>
</div>
- <p className="mr-4 text-base text-gray-400">
- {t("activity:subtitle")}
- </p>
+ <p className="mr-4 text-base text-gray-400">{t('activity:subtitle')}</p>
</div>
<div className="px-6 h-8 mt-2">
- <EventFilter
- selected={eventChosen}
- select={setEventChosen}
- />
+ <EventFilter selected={eventChosen} select={setEventChosen} />
</div>
- <ActivityTable
- data={logsData}
- toggleSidebar={toggleSidebar}
- isLoading={isLoading}
- />
- <div className='flex justify-center w-full mb-6'>
- <div className='items-center w-60'>
- <Button text={String(t("common:view-more"))} textDisabled={String(t("common:end-of-history"))} active={logsData.length % 10 == 0 ? true : false} onButtonPressed={loadMoreLogs} size="md" color="mineshaft"/>
+ <ActivityTable data={logsData} toggleSidebar={toggleSidebar} isLoading={isLoading} />
+ <div className="flex justify-center w-full mb-6">
+ <div className="items-center w-60">
+ <Button
+ text={String(t('common:view-more'))}
+ textDisabled={String(t('common:end-of-history'))}
+ active={logsData.length % 10 === 0}
+ onButtonPressed={loadMoreLogs}
+ size="md"
+ color="mineshaft"
+ />
</div>
</div>
</div>
@@ -148,4 +156,4 @@ export default function Activity() {
Activity.requireAuth = true;
-export const getServerSideProps = getTranslatedServerSideProps(["activity", "common"]);
\ No newline at end of file
+export const getServerSideProps = getTranslatedServerSideProps(['activity', 'common']);
diff --git a/frontend/src/pages/api/apiKey/addAPIKey.ts b/frontend/src/pages/api/apiKey/addAPIKey.ts
index 4707af9be6..2b88b380cf 100644
--- a/frontend/src/pages/api/apiKey/addAPIKey.ts
+++ b/frontend/src/pages/api/apiKey/addAPIKey.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
name: string;
@@ -12,11 +12,8 @@ interface Props {
* @param {string} obj.expiresIn - how soon the API key expires in ms
* @returns
*/
-const addAPIKey = ({
- name,
- expiresIn,
-}: Props) => {
- return SecurityClient.fetchCall('/api/v2/api-key/', {
+const addAPIKey = ({ name, expiresIn }: Props) =>
+ SecurityClient.fetchCall('/api/v2/api-key/', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@@ -26,12 +23,11 @@ const addAPIKey = ({
expiresIn
})
}).then(async (res) => {
- if (res && res.status == 200) {
- return (await res.json());
- } else {
- console.log('Failed to add API key');
+ if (res && res.status === 200) {
+ return res.json();
}
+ console.log('Failed to add API key');
+ return undefined;
});
-};
export default addAPIKey;
diff --git a/frontend/src/pages/api/apiKey/deleteAPIKey.ts b/frontend/src/pages/api/apiKey/deleteAPIKey.ts
index cea53444de..1e242887f2 100644
--- a/frontend/src/pages/api/apiKey/deleteAPIKey.ts
+++ b/frontend/src/pages/api/apiKey/deleteAPIKey.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
apiKeyId: string;
@@ -10,21 +10,18 @@ interface Props {
* @param {string} obj.apiKeyId - id of the API key to delete
* @returns
*/
-const deleteAPIKey = ({
- apiKeyId
-}: Props) => {
- return SecurityClient.fetchCall('/api/v2/api-key/' + apiKeyId, {
+const deleteAPIKey = ({ apiKeyId }: Props) =>
+ SecurityClient.fetchCall(`/api/v2/api-key/${apiKeyId}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
- },
+ }
}).then(async (res) => {
- if (res && res.status == 200) {
- return (await res.json());
- } else {
- console.log('Failed to delete API key');
+ if (res && res.status === 200) {
+ return res.json();
}
+ console.log('Failed to delete API key');
+ return undefined;
});
-};
export default deleteAPIKey;
diff --git a/frontend/src/pages/api/apiKey/getAPIKeys.ts b/frontend/src/pages/api/apiKey/getAPIKeys.ts
index 0168a87c66..66f233d572 100644
--- a/frontend/src/pages/api/apiKey/getAPIKeys.ts
+++ b/frontend/src/pages/api/apiKey/getAPIKeys.ts
@@ -1,26 +1,22 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route gets API keys for the user
* @param {*} param0
* @returns
*/
-const getAPIKeys = () => {
- return SecurityClient.fetchCall(
- '/api/v2/api-key',
- {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json'
- }
+const getAPIKeys = () =>
+ SecurityClient.fetchCall('/api/v2/api-key', {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res && res.status == 200) {
- return (await res.json()).apiKeyData;
- } else {
- console.log('Failed to get API keys');
+ }).then(async (res) => {
+ if (res && res.status === 200) {
+ return (await res.json()).apiKeyData;
}
+ console.log('Failed to get API keys');
+ return undefined;
});
-};
export default getAPIKeys;
diff --git a/frontend/src/pages/api/auth/ChangePassword2.ts b/frontend/src/pages/api/auth/ChangePassword2.ts
index 132eeddf43..71857f8b7f 100644
--- a/frontend/src/pages/api/auth/ChangePassword2.ts
+++ b/frontend/src/pages/api/auth/ChangePassword2.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
encryptedPrivateKey: string;
@@ -14,34 +14,26 @@ interface Props {
* @param {*} clientPublicKey
* @returns
*/
-const changePassword2 = ({
- encryptedPrivateKey,
- iv,
- tag,
- salt,
- verifier,
- clientProof
-}: Props) => {
- return SecurityClient.fetchCall('/api/v1/password/change-password', {
+const changePassword2 = ({ encryptedPrivateKey, iv, tag, salt, verifier, clientProof }: Props) =>
+ SecurityClient.fetchCall('/api/v1/password/change-password', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
- clientProof: clientProof,
- encryptedPrivateKey: encryptedPrivateKey,
- iv: iv,
- tag: tag,
- salt: salt,
- verifier: verifier
+ clientProof,
+ encryptedPrivateKey,
+ iv,
+ tag,
+ salt,
+ verifier
})
}).then(async (res) => {
- if (res && res.status == 200) {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to change the password');
}
+ console.log('Failed to change the password');
+ return undefined;
});
-};
export default changePassword2;
diff --git a/frontend/src/pages/api/auth/CheckAuth.ts b/frontend/src/pages/api/auth/CheckAuth.ts
index 1decb5bf35..6b569cfae0 100644
--- a/frontend/src/pages/api/auth/CheckAuth.ts
+++ b/frontend/src/pages/api/auth/CheckAuth.ts
@@ -1,16 +1,15 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This function is used to check if the user is authenticated.
* To do that, we get their tokens from cookies, and verify if they are good.
*/
-const checkAuth = async () => {
- return SecurityClient.fetchCall('/api/v1/auth/checkAuth', {
+const checkAuth = async () =>
+ SecurityClient.fetchCall('/api/v1/auth/checkAuth', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
}
}).then((res) => res);
-};
export default checkAuth;
diff --git a/frontend/src/pages/api/auth/CheckEmailVerificationCode.ts b/frontend/src/pages/api/auth/CheckEmailVerificationCode.ts
index 0709592a32..6fab91d22b 100644
--- a/frontend/src/pages/api/auth/CheckEmailVerificationCode.ts
+++ b/frontend/src/pages/api/auth/CheckEmailVerificationCode.ts
@@ -10,17 +10,15 @@ interface Props {
* @param {string} obj.code
* @returns
*/
-const checkEmailVerificationCode = ({ email, code }: Props) => {
- return fetch('/api/v1/signup/email/verify', {
+const checkEmailVerificationCode = ({ email, code }: Props) => fetch('/api/v1/signup/email/verify', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
- email: email,
- code: code
+ email,
+ code
})
});
-};
export default checkEmailVerificationCode;
diff --git a/frontend/src/pages/api/auth/CompleteAccountInformationSignup.ts b/frontend/src/pages/api/auth/CompleteAccountInformationSignup.ts
index 8057e776a4..3fe985cab0 100644
--- a/frontend/src/pages/api/auth/CompleteAccountInformationSignup.ts
+++ b/frontend/src/pages/api/auth/CompleteAccountInformationSignup.ts
@@ -41,12 +41,11 @@ const completeAccountInformationSignup = ({
salt,
verifier,
token
-}: Props) => {
- return fetch('/api/v1/signup/complete-account/signup', {
+}: Props) => fetch('/api/v1/signup/complete-account/signup', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
- Authorization: 'Bearer ' + token
+ Authorization: `Bearer ${ token}`
},
body: JSON.stringify({
email,
@@ -61,6 +60,5 @@ const completeAccountInformationSignup = ({
verifier
})
});
-};
export default completeAccountInformationSignup;
diff --git a/frontend/src/pages/api/auth/CompleteAccountInformationSignupInvite.ts b/frontend/src/pages/api/auth/CompleteAccountInformationSignupInvite.ts
index 03c11cb67e..6fada48bac 100644
--- a/frontend/src/pages/api/auth/CompleteAccountInformationSignupInvite.ts
+++ b/frontend/src/pages/api/auth/CompleteAccountInformationSignupInvite.ts
@@ -38,25 +38,23 @@ const completeAccountInformationSignupInvite = ({
salt,
verifier,
token
-}: Props) => {
- return fetch('/api/v1/signup/complete-account/invite', {
+}: Props) => fetch('/api/v1/signup/complete-account/invite', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
- Authorization: 'Bearer ' + token
+ Authorization: `Bearer ${ token}`
},
body: JSON.stringify({
- email: email,
- firstName: firstName,
- lastName: lastName,
- publicKey: publicKey,
+ email,
+ firstName,
+ lastName,
+ publicKey,
encryptedPrivateKey: ciphertext,
- iv: iv,
- tag: tag,
- salt: salt,
- verifier: verifier
+ iv,
+ tag,
+ salt,
+ verifier
})
});
-};
export default completeAccountInformationSignupInvite;
diff --git a/frontend/src/pages/api/auth/EmailVerifyOnPasswordReset.ts b/frontend/src/pages/api/auth/EmailVerifyOnPasswordReset.ts
index b3d5e3d558..0ef20ca064 100644
--- a/frontend/src/pages/api/auth/EmailVerifyOnPasswordReset.ts
+++ b/frontend/src/pages/api/auth/EmailVerifyOnPasswordReset.ts
@@ -18,8 +18,8 @@ const EmailVerifyOnPasswordReset = async ({ email, code }: Props) => {
'Content-Type': 'application/json'
},
body: JSON.stringify({
- email: email,
- code: code
+ email,
+ code
})
});
if (response?.status === 200) {
diff --git a/frontend/src/pages/api/auth/IssueBackupPrivateKey.ts b/frontend/src/pages/api/auth/IssueBackupPrivateKey.ts
index e24ac510e3..90db8d8dd7 100644
--- a/frontend/src/pages/api/auth/IssueBackupPrivateKey.ts
+++ b/frontend/src/pages/api/auth/IssueBackupPrivateKey.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
encryptedPrivateKey: string;
@@ -27,19 +27,19 @@ const issueBackupPrivateKey = ({
salt,
verifier,
clientProof
-}: Props) => {
- return SecurityClient.fetchCall('/api/v1/password/backup-private-key', {
+}: Props) =>
+ SecurityClient.fetchCall('/api/v1/password/backup-private-key', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
- clientProof: clientProof,
- encryptedPrivateKey: encryptedPrivateKey,
- iv: iv,
- tag: tag,
- salt: salt,
- verifier: verifier
+ clientProof,
+ encryptedPrivateKey,
+ iv,
+ tag,
+ salt,
+ verifier
})
}).then((res) => {
if (res?.status !== 200) {
@@ -47,6 +47,5 @@ const issueBackupPrivateKey = ({
}
return res;
});
-};
export default issueBackupPrivateKey;
diff --git a/frontend/src/pages/api/auth/Login1.ts b/frontend/src/pages/api/auth/Login1.ts
index 818a2d1572..94a56866da 100644
--- a/frontend/src/pages/api/auth/Login1.ts
+++ b/frontend/src/pages/api/auth/Login1.ts
@@ -16,7 +16,7 @@ const login1 = async (email: string, clientPublicKey: string) => {
"Content-Type": "application/json",
},
body: JSON.stringify({
- email: email,
+ email,
clientPublicKey,
}),
});
diff --git a/frontend/src/pages/api/auth/Login2.ts b/frontend/src/pages/api/auth/Login2.ts
index 3adcb695f8..6c431cbb85 100644
--- a/frontend/src/pages/api/auth/Login2.ts
+++ b/frontend/src/pages/api/auth/Login2.ts
@@ -13,24 +13,24 @@ interface Login2Response {
* @returns
*/
const login2 = async (email: string, clientProof: string) => {
- const response = await fetch("/api/v1/auth/login2", {
- method: "POST",
+ const response = await fetch('/api/v1/auth/login2', {
+ method: 'POST',
headers: {
- "Content-Type": "application/json",
+ 'Content-Type': 'application/json'
},
body: JSON.stringify({
- email: email,
- clientProof,
+ email,
+ clientProof
}),
- credentials: "include",
+ credentials: 'include'
});
// need precise error handling about the status code
- if (response.status == 200) {
+ if (response.status === 200) {
const data = (await response.json()) as unknown as Login2Response;
return data;
}
- throw new Error("Password verification failed");
+ throw new Error('Password verification failed');
};
export default login2;
diff --git a/frontend/src/pages/api/auth/Logout.ts b/frontend/src/pages/api/auth/Logout.ts
index cd4ff9a61e..acf04bc1a7 100644
--- a/frontend/src/pages/api/auth/Logout.ts
+++ b/frontend/src/pages/api/auth/Logout.ts
@@ -1,18 +1,18 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route logs the user out. Note: the user should authorized to do this.
* We first try to log out - if the authorization fails (response.status = 401), we refetch the new token, and then retry
*/
-const logout = async () => {
- return SecurityClient.fetchCall('/api/v1/auth/logout', {
+const logout = async () =>
+ SecurityClient.fetchCall('/api/v1/auth/logout', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
credentials: 'include'
}).then((res) => {
- if (res?.status == 200) {
+ if (res?.status === 200) {
SecurityClient.setToken('');
// Delete the cookie by not setting a value; Alternatively clear the local storage
localStorage.setItem('publicKey', '');
@@ -22,10 +22,9 @@ const logout = async () => {
localStorage.setItem('PRIVATE_KEY', '');
console.log('User logged out', res);
return res;
- } else {
- console.log('Failed to log out');
}
+ console.log('Failed to log out');
+ return undefined;
});
-};
export default logout;
diff --git a/frontend/src/pages/api/auth/SRP1.ts b/frontend/src/pages/api/auth/SRP1.ts
index cb6386ff20..2316a605c2 100644
--- a/frontend/src/pages/api/auth/SRP1.ts
+++ b/frontend/src/pages/api/auth/SRP1.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
clientPublicKey: string;
@@ -9,8 +9,8 @@ interface Props {
* @param {string} clientPublicKey
* @returns
*/
-const SRP1 = ({ clientPublicKey }: Props) => {
- return SecurityClient.fetchCall('/api/v1/password/srp1', {
+const SRP1 = ({ clientPublicKey }: Props) =>
+ SecurityClient.fetchCall('/api/v1/password/srp1', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@@ -19,12 +19,11 @@ const SRP1 = ({ clientPublicKey }: Props) => {
clientPublicKey
})
}).then(async (res) => {
- if (res && res.status == 200) {
- return await res.json();
- } else {
- console.log('Failed to do the first step of SRP');
+ if (res && res.status === 200) {
+ return res.json();
}
+ console.log('Failed to do the first step of SRP');
+ return undefined;
});
-};
export default SRP1;
diff --git a/frontend/src/pages/api/auth/SendEmailOnPasswordReset.ts b/frontend/src/pages/api/auth/SendEmailOnPasswordReset.ts
index abe610f07d..e0f2f0ae3d 100644
--- a/frontend/src/pages/api/auth/SendEmailOnPasswordReset.ts
+++ b/frontend/src/pages/api/auth/SendEmailOnPasswordReset.ts
@@ -16,7 +16,7 @@ const SendEmailOnPasswordReset = async ({ email }: Props) => {
'Content-Type': 'application/json'
},
body: JSON.stringify({
- email: email
+ email
})
});
// need precise error handling about the status code
diff --git a/frontend/src/pages/api/auth/SendVerificationEmail.ts b/frontend/src/pages/api/auth/SendVerificationEmail.ts
index 4f3b063c6a..dcf7d3db7b 100644
--- a/frontend/src/pages/api/auth/SendVerificationEmail.ts
+++ b/frontend/src/pages/api/auth/SendVerificationEmail.ts
@@ -9,7 +9,7 @@ const sendVerificationEmail = (email: string) => {
'Content-Type': 'application/json'
},
body: JSON.stringify({
- email: email
+ email
})
});
};
diff --git a/frontend/src/pages/api/auth/Token.ts b/frontend/src/pages/api/auth/Token.ts
index ed347ba4b8..75ac906f60 100644
--- a/frontend/src/pages/api/auth/Token.ts
+++ b/frontend/src/pages/api/auth/Token.ts
@@ -1,17 +1,16 @@
-const token = async () => {
- return fetch('/api/v1/auth/token', {
+const token = async () =>
+ fetch('/api/v1/auth/token', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
credentials: 'include'
}).then(async (res) => {
- if (res.status == 200) {
+ if (res.status === 200) {
return (await res.json()).token;
- } else {
- console.log('Getting a new token failed');
}
+ console.log('Getting a new token failed');
+ return undefined;
});
-};
export default token;
diff --git a/frontend/src/pages/api/auth/VerifySignupInvite.ts b/frontend/src/pages/api/auth/VerifySignupInvite.ts
index 0b6cc7577f..71f7246542 100644
--- a/frontend/src/pages/api/auth/VerifySignupInvite.ts
+++ b/frontend/src/pages/api/auth/VerifySignupInvite.ts
@@ -10,8 +10,7 @@ interface Props {
* @param {string} obj.code - code that a user received to the abovementioned email
* @returns
*/
-const verifySignupInvite = ({ email, code }: Props) => {
- return fetch('/api/v1/invite-org/verify', {
+const verifySignupInvite = ({ email, code }: Props) => fetch('/api/v1/invite-org/verify', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@@ -21,6 +20,5 @@ const verifySignupInvite = ({ email, code }: Props) => {
code
})
});
-};
export default verifySignupInvite;
diff --git a/frontend/src/pages/api/auth/getBackupEncryptedPrivateKey.ts b/frontend/src/pages/api/auth/getBackupEncryptedPrivateKey.ts
index 826085263e..7eca82018e 100644
--- a/frontend/src/pages/api/auth/getBackupEncryptedPrivateKey.ts
+++ b/frontend/src/pages/api/auth/getBackupEncryptedPrivateKey.ts
@@ -8,12 +8,11 @@ const getBackupEncryptedPrivateKey = ({
verificationToken
}: {
verificationToken: string;
-}) => {
- return fetch('/api/v1/password/backup-private-key', {
+}) => fetch('/api/v1/password/backup-private-key', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
- Authorization: 'Bearer ' + verificationToken
+ Authorization: `Bearer ${ verificationToken}`
}
}).then(async (res) => {
if (res?.status !== 200) {
@@ -21,6 +20,5 @@ const getBackupEncryptedPrivateKey = ({
}
return (await res?.json())?.backupPrivateKey;
});
-};
export default getBackupEncryptedPrivateKey;
diff --git a/frontend/src/pages/api/auth/publicKeyInfisical.ts b/frontend/src/pages/api/auth/publicKeyInfisical.ts
index d3e0f646c8..af8269ee37 100644
--- a/frontend/src/pages/api/auth/publicKeyInfisical.ts
+++ b/frontend/src/pages/api/auth/publicKeyInfisical.ts
@@ -1,10 +1,8 @@
-const publicKeyInfisical = () => {
- return fetch('/api/v1/key/publicKey/infisical', {
+const publicKeyInfisical = () => fetch('/api/v1/key/publicKey/infisical', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
});
-};
export default publicKeyInfisical;
diff --git a/frontend/src/pages/api/auth/resetPasswordOnAccountRecovery.ts b/frontend/src/pages/api/auth/resetPasswordOnAccountRecovery.ts
index f2b5ad98ea..77c1a2aa03 100644
--- a/frontend/src/pages/api/auth/resetPasswordOnAccountRecovery.ts
+++ b/frontend/src/pages/api/auth/resetPasswordOnAccountRecovery.ts
@@ -25,19 +25,18 @@ const resetPasswordOnAccountRecovery = ({
tag,
salt,
verifier
-}: Props) => {
- return fetch('/api/v1/password/password-reset', {
+}: Props) => fetch('/api/v1/password/password-reset', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
- Authorization: 'Bearer ' + verificationToken
+ Authorization: `Bearer ${ verificationToken}`
},
body: JSON.stringify({
- encryptedPrivateKey: encryptedPrivateKey,
- iv: iv,
- tag: tag,
- salt: salt,
- verifier: verifier
+ encryptedPrivateKey,
+ iv,
+ tag,
+ salt,
+ verifier
})
}).then(async (res) => {
if (res?.status !== 200) {
@@ -45,6 +44,5 @@ const resetPasswordOnAccountRecovery = ({
}
return res;
});
-};
export default resetPasswordOnAccountRecovery;
diff --git a/frontend/src/pages/api/bot/getBot.ts b/frontend/src/pages/api/bot/getBot.ts
index 145b50891d..5c1d111737 100644
--- a/frontend/src/pages/api/bot/getBot.ts
+++ b/frontend/src/pages/api/bot/getBot.ts
@@ -1,4 +1,4 @@
-import SecurityClient from "~/utilities/SecurityClient";
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
workspaceId: string;
@@ -10,22 +10,18 @@ interface Props {
* @param {String} obj.workspaceId
* @returns
*/
-const getBot = async ({ workspaceId }: Props) => {
- return SecurityClient.fetchCall(
- "/api/v1/bot/" + workspaceId,
- {
- method: "GET",
- headers: {
- "Content-Type": "application/json",
- }
+const getBot = async ({ workspaceId }: Props) =>
+ SecurityClient.fetchCall(`/api/v1/bot/${workspaceId}`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res && res.status == 200) {
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return (await res.json()).bot;
- } else {
- console.log("Failed to get bot for project");
}
+ console.log('Failed to get bot for project');
+ return undefined;
});
-};
-export default getBot;
\ No newline at end of file
+export default getBot;
diff --git a/frontend/src/pages/api/bot/setBotActiveStatus.ts b/frontend/src/pages/api/bot/setBotActiveStatus.ts
index 0a974a5883..857de01c73 100644
--- a/frontend/src/pages/api/bot/setBotActiveStatus.ts
+++ b/frontend/src/pages/api/bot/setBotActiveStatus.ts
@@ -1,4 +1,4 @@
-import SecurityClient from "~/utilities/SecurityClient";
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface BotKey {
encryptedKey: string;
@@ -10,10 +10,10 @@ interface Props {
isActive: boolean;
botKey: BotKey;
}
-
+
/**
* This function sets the active status of a bot and shares a copy of
- * the project key (encrypted under the bot's public key) with the
+ * the project key (encrypted under the bot's public key) with the
* project's bot
* @param {Object} obj
* @param {String} obj.botId
@@ -21,26 +21,22 @@ interface Props {
* @param {Object} obj.botKey
* @returns
*/
-const setBotActiveStatus = async ({ botId, isActive, botKey }: Props) => {
- return SecurityClient.fetchCall(
- "/api/v1/bot/" + botId + "/active",
- {
- method: "PATCH",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({
- isActive,
- botKey
- })
- }
- ).then(async (res) => {
- if (res && res.status == 200) {
- return await res.json();
- } else {
- console.log("Failed to get bot for project");
+const setBotActiveStatus = async ({ botId, isActive, botKey }: Props) =>
+ SecurityClient.fetchCall(`/api/v1/bot/${botId}/active`, {
+ method: 'PATCH',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ isActive,
+ botKey
+ })
+ }).then(async (res) => {
+ if (res && res.status === 200) {
+ return res.json();
}
+ console.log('Failed to get bot for project');
+ return undefined;
});
-};
-export default setBotActiveStatus;
\ No newline at end of file
+export default setBotActiveStatus;
diff --git a/frontend/src/pages/api/environments/createEnvironment.ts b/frontend/src/pages/api/environments/createEnvironment.ts
index 2d0ecfa379..ddeb8effd2 100644
--- a/frontend/src/pages/api/environments/createEnvironment.ts
+++ b/frontend/src/pages/api/environments/createEnvironment.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
type NewEnvironmentInfo = {
environmentSlug: string;
@@ -10,20 +10,19 @@ type NewEnvironmentInfo = {
* @param {*} workspaceId
* @returns
*/
-const createEnvironment = (workspaceId:string, newEnv: NewEnvironmentInfo) => {
- return SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/environments`, {
+const createEnvironment = (workspaceId: string, newEnv: NewEnvironmentInfo) =>
+ SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/environments`, {
method: 'POST',
headers: {
- 'Content-Type': 'application/json',
+ 'Content-Type': 'application/json'
},
body: JSON.stringify(newEnv)
}).then(async (res) => {
- if (res && res.status == 200) {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to create environment');
}
+ console.log('Failed to create environment');
+ return undefined;
});
-};
export default createEnvironment;
diff --git a/frontend/src/pages/api/environments/deleteEnvironment.ts b/frontend/src/pages/api/environments/deleteEnvironment.ts
index de86115321..4463ef4a38 100644
--- a/frontend/src/pages/api/environments/deleteEnvironment.ts
+++ b/frontend/src/pages/api/environments/deleteEnvironment.ts
@@ -1,26 +1,22 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route deletes a specified env.
* @param {*} workspaceId
* @returns
*/
-const deleteEnvironment = (workspaceId: string, environmentSlug: string) => {
- return SecurityClient.fetchCall(
- `/api/v2/workspace/${workspaceId}/environments`,
- {
- method: 'DELETE',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify({ environmentSlug }),
- }
- ).then(async (res) => {
- if (res && res.status == 200) {
+const deleteEnvironment = (workspaceId: string, environmentSlug: string) =>
+ SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/environments`, {
+ method: 'DELETE',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({ environmentSlug })
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to delete environment');
}
+ console.log('Failed to delete environment');
+ return undefined;
});
-};
export default deleteEnvironment;
diff --git a/frontend/src/pages/api/environments/updateEnvironment.ts b/frontend/src/pages/api/environments/updateEnvironment.ts
index 65fb449a8b..d285179980 100644
--- a/frontend/src/pages/api/environments/updateEnvironment.ts
+++ b/frontend/src/pages/api/environments/updateEnvironment.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
type EnvironmentInfo = {
oldEnvironmentSlug: string;
@@ -11,23 +11,19 @@ type EnvironmentInfo = {
* @param {*} workspaceId
* @returns
*/
-const updateEnvironment = (workspaceId: string, env: EnvironmentInfo) => {
- return SecurityClient.fetchCall(
- `/api/v2/workspace/${workspaceId}/environments`,
- {
- method: 'PUT',
- headers: {
- 'Content-Type': 'application/json',
- },
- body: JSON.stringify(env),
- }
- ).then(async (res) => {
- if (res && res.status == 200) {
+const updateEnvironment = (workspaceId: string, env: EnvironmentInfo) =>
+ SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/environments`, {
+ method: 'PUT',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify(env)
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to update environment');
}
+ console.log('Failed to update environment');
+ return undefined;
});
-};
export default updateEnvironment;
diff --git a/frontend/src/pages/api/files/AddSecrets.ts b/frontend/src/pages/api/files/AddSecrets.ts
index cdee8e7ba4..46d454a04b 100644
--- a/frontend/src/pages/api/files/AddSecrets.ts
+++ b/frontend/src/pages/api/files/AddSecrets.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface EncryptedSecretProps {
id: string;
@@ -13,7 +13,7 @@ interface EncryptedSecretProps {
secretValueCiphertext: string;
secretValueIV: string;
secretValueTag: string;
- type: "personal" | "shared";
+ type: 'personal' | 'shared';
}
/**
@@ -24,25 +24,31 @@ interface EncryptedSecretProps {
* @param {string} obj.workspaceId - the project to which we are adding secrets
* @returns
*/
-const addSecrets = async ({ secrets, env, workspaceId }: { secrets: EncryptedSecretProps[]; env: string; workspaceId: string; }) => {
- return SecurityClient.fetchCall('/api/v2/secrets', {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({
- environment: env,
- workspaceId,
- secrets
- })
- }
- ).then(async (res) => {
- if (res && res.status == 200) {
- return await res.json();
- } else {
- console.log('Failed to add certain project secrets');
+const addSecrets = async ({
+ secrets,
+ env,
+ workspaceId
+}: {
+ secrets: EncryptedSecretProps[];
+ env: string;
+ workspaceId: string;
+}) =>
+ SecurityClient.fetchCall('/api/v2/secrets', {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ environment: env,
+ workspaceId,
+ secrets
+ })
+ }).then(async (res) => {
+ if (res && res.status === 200) {
+ return res.json();
}
+ console.log('Failed to add certain project secrets');
+ return undefined;
});
-};
export default addSecrets;
diff --git a/frontend/src/pages/api/files/DeleteSecrets.ts b/frontend/src/pages/api/files/DeleteSecrets.ts
index cc178b7bbd..76dd19da32 100644
--- a/frontend/src/pages/api/files/DeleteSecrets.ts
+++ b/frontend/src/pages/api/files/DeleteSecrets.ts
@@ -1,27 +1,25 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This function deletes certain secrets from a certain project
* @param {string[]} secretIds - the ids of secrets that we want to be deleted
* @returns
*/
-const deleteSecrets = async ({ secretIds }: { secretIds: string[] }) => {
- return SecurityClient.fetchCall('/api/v2/secrets', {
- method: 'DELETE',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({
- secretIds
- })
- }
- ).then(async (res) => {
- if (res && res.status == 200) {
- return await res.json();
- } else {
- console.log('Failed to delete certain project secrets');
+const deleteSecrets = async ({ secretIds }: { secretIds: string[] }) =>
+ SecurityClient.fetchCall('/api/v2/secrets', {
+ method: 'DELETE',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ secretIds
+ })
+ }).then(async (res) => {
+ if (res && res.status === 200) {
+ return res.json();
}
+ console.log('Failed to delete certain project secrets');
+ return undefined;
});
-};
export default deleteSecrets;
diff --git a/frontend/src/pages/api/files/GetSecrets.ts b/frontend/src/pages/api/files/GetSecrets.ts
index 2fed6a4003..fb980a4335 100644
--- a/frontend/src/pages/api/files/GetSecrets.ts
+++ b/frontend/src/pages/api/files/GetSecrets.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This function fetches the encrypted secrets for a certain project
@@ -6,13 +6,12 @@ import SecurityClient from '~/utilities/SecurityClient';
* @param {string} env - environment of a project for which a user is trying ot get secrets
* @returns
*/
-const getSecrets = async (workspaceId: string, env: string) => {
- return SecurityClient.fetchCall(
- '/api/v2/secrets?' +
- new URLSearchParams({
- environment: env,
- workspaceId
- }),
+const getSecrets = async (workspaceId: string, env: string) =>
+ SecurityClient.fetchCall(
+ `/api/v2/secrets?${new URLSearchParams({
+ environment: env,
+ workspaceId
+ })}`,
{
method: 'GET',
headers: {
@@ -20,12 +19,11 @@ const getSecrets = async (workspaceId: string, env: string) => {
}
}
).then(async (res) => {
- if (res && res.status == 200) {
+ if (res && res.status === 200) {
return (await res.json()).secrets;
- } else {
- console.log('Failed to get project secrets');
}
+ console.log('Failed to get project secrets');
+ return undefined;
});
-};
export default getSecrets;
diff --git a/frontend/src/pages/api/files/UpdateSecrets.ts b/frontend/src/pages/api/files/UpdateSecrets.ts
index 2ec67fc2e5..b42d653c99 100644
--- a/frontend/src/pages/api/files/UpdateSecrets.ts
+++ b/frontend/src/pages/api/files/UpdateSecrets.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface EncryptedSecretProps {
id: string;
@@ -13,7 +13,7 @@ interface EncryptedSecretProps {
secretValueCiphertext: string;
secretValueIV: string;
secretValueTag: string;
- type: "personal" | "shared";
+ type: 'personal' | 'shared';
}
/**
@@ -22,23 +22,21 @@ interface EncryptedSecretProps {
* @param {EncryptedSecretProps[]} obj.secrets - the ids of secrets that we want to update
* @returns
*/
-const updateSecrets = async ({ secrets }: { secrets: EncryptedSecretProps[] }) => {
- return SecurityClient.fetchCall('/api/v2/secrets', {
- method: 'PATCH',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({
- secrets
- })
- }
- ).then(async (res) => {
- if (res && res.status == 200) {
- return await res.json();
- } else {
- console.log('Failed to update certain project secrets');
+const updateSecrets = async ({ secrets }: { secrets: EncryptedSecretProps[] }) =>
+ SecurityClient.fetchCall('/api/v2/secrets', {
+ method: 'PATCH',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ secrets
+ })
+ }).then(async (res) => {
+ if (res && res.status === 200) {
+ return res.json();
}
+ console.log('Failed to update certain project secrets');
+ return undefined;
});
-};
export default updateSecrets;
diff --git a/frontend/src/pages/api/files/UploadSecrets.ts b/frontend/src/pages/api/files/UploadSecrets.ts
index 03a98d4837..4fc0ff0e8f 100644
--- a/frontend/src/pages/api/files/UploadSecrets.ts
+++ b/frontend/src/pages/api/files/UploadSecrets.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
workspaceId: string;
@@ -16,13 +16,8 @@ interface Props {
* @param {string} obj.environment
* @returns
*/
-const uploadSecrets = async ({
- workspaceId,
- secrets,
- keys,
- environment
-}: Props) => {
- return SecurityClient.fetchCall('/api/v2/workspace/' + workspaceId + '/secrets', {
+const uploadSecrets = async ({ workspaceId, secrets, keys, environment }: Props) =>
+ SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/secrets`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@@ -34,12 +29,11 @@ const uploadSecrets = async ({
channel: 'web'
})
}).then(async (res) => {
- if (res && res.status == 200) {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to push secrets');
}
+ console.log('Failed to push secrets');
+ return undefined;
});
-};
export default uploadSecrets;
diff --git a/frontend/src/pages/api/integrations/ChangeHerokuConfigVars.ts b/frontend/src/pages/api/integrations/ChangeHerokuConfigVars.ts
index e011bda7bd..27e36a33d5 100644
--- a/frontend/src/pages/api/integrations/ChangeHerokuConfigVars.ts
+++ b/frontend/src/pages/api/integrations/ChangeHerokuConfigVars.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
integrationId: string;
@@ -16,26 +16,22 @@ interface Props {
}[];
}
-const changeHerokuConfigVars = ({ integrationId, key, secrets }: Props) => {
- return SecurityClient.fetchCall(
- '/api/v1/integration/' + integrationId + '/sync',
- {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({
- key,
- secrets
- })
- }
- ).then(async (res) => {
- if (res && res.status == 200) {
+const changeHerokuConfigVars = ({ integrationId, key, secrets }: Props) =>
+ SecurityClient.fetchCall(`/api/v1/integration/${integrationId}/sync`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ key,
+ secrets
+ })
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to sync secrets to Heroku');
}
+ console.log('Failed to sync secrets to Heroku');
+ return undefined;
});
-};
export default changeHerokuConfigVars;
diff --git a/frontend/src/pages/api/integrations/DeleteIntegration.ts b/frontend/src/pages/api/integrations/DeleteIntegration.ts
index 89aa0ab0c5..a15afcf344 100644
--- a/frontend/src/pages/api/integrations/DeleteIntegration.ts
+++ b/frontend/src/pages/api/integrations/DeleteIntegration.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
integrationId: string;
@@ -9,19 +9,18 @@ interface Props {
* @param {*} integrationId
* @returns
*/
-const deleteIntegration = ({ integrationId }: Props) => {
- return SecurityClient.fetchCall('/api/v1/integration/' + integrationId, {
+const deleteIntegration = ({ integrationId }: Props) =>
+ SecurityClient.fetchCall(`/api/v1/integration/${integrationId}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
}
}).then(async (res) => {
- if (res && res.status == 200) {
+ if (res && res.status === 200) {
return (await res.json()).workspace;
- } else {
- console.log('Failed to delete an integration');
}
+ console.log('Failed to delete an integration');
+ return undefined;
});
-};
export default deleteIntegration;
diff --git a/frontend/src/pages/api/integrations/DeleteIntegrationAuth.ts b/frontend/src/pages/api/integrations/DeleteIntegrationAuth.ts
index 3a2da2cbf3..ee4b75c0d6 100644
--- a/frontend/src/pages/api/integrations/DeleteIntegrationAuth.ts
+++ b/frontend/src/pages/api/integrations/DeleteIntegrationAuth.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
integrationAuthId: string;
@@ -9,22 +9,18 @@ interface Props {
* @param {*} integrationAuthId
* @returns
*/
-const deleteIntegrationAuth = ({ integrationAuthId }: Props) => {
- return SecurityClient.fetchCall(
- '/api/v1/integration-auth/' + integrationAuthId,
- {
- method: 'DELETE',
- headers: {
- 'Content-Type': 'application/json'
- }
+const deleteIntegrationAuth = ({ integrationAuthId }: Props) =>
+ SecurityClient.fetchCall(`/api/v1/integration-auth/${integrationAuthId}`, {
+ method: 'DELETE',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res && res.status == 200) {
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to delete an integration authorization');
}
+ console.log('Failed to delete an integration authorization');
+ return undefined;
});
-};
export default deleteIntegrationAuth;
diff --git a/frontend/src/pages/api/integrations/GetIntegrationApps.ts b/frontend/src/pages/api/integrations/GetIntegrationApps.ts
index 5597c24b15..cf49882b42 100644
--- a/frontend/src/pages/api/integrations/GetIntegrationApps.ts
+++ b/frontend/src/pages/api/integrations/GetIntegrationApps.ts
@@ -1,25 +1,21 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
integrationAuthId: string;
}
-const getIntegrationApps = ({ integrationAuthId }: Props) => {
- return SecurityClient.fetchCall(
- '/api/v1/integration-auth/' + integrationAuthId + '/apps',
- {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json'
- }
+const getIntegrationApps = ({ integrationAuthId }: Props) =>
+ SecurityClient.fetchCall(`/api/v1/integration-auth/${integrationAuthId}/apps`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res && res.status == 200) {
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return (await res.json()).apps;
- } else {
- console.log('Failed to get available apps for an integration');
}
+ console.log('Failed to get available apps for an integration');
+ return undefined;
});
-};
export default getIntegrationApps;
diff --git a/frontend/src/pages/api/integrations/GetIntegrationOptions.ts b/frontend/src/pages/api/integrations/GetIntegrationOptions.ts
index caf0c8626c..b00ff3fd5d 100644
--- a/frontend/src/pages/api/integrations/GetIntegrationOptions.ts
+++ b/frontend/src/pages/api/integrations/GetIntegrationOptions.ts
@@ -1,21 +1,17 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
-const getIntegrationOptions = () => {
- return SecurityClient.fetchCall(
- '/api/v1/integration-auth/integration-options',
- {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json'
- }
+const getIntegrationOptions = () =>
+ SecurityClient.fetchCall('/api/v1/integration-auth/integration-options', {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res && res.status == 200) {
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return (await res.json()).integrationOptions;
- } else {
- console.log('Failed to get (cloud) integration options');
}
+ console.log('Failed to get (cloud) integration options');
+ return undefined;
});
-};
export default getIntegrationOptions;
diff --git a/frontend/src/pages/api/integrations/StartIntegration.ts b/frontend/src/pages/api/integrations/StartIntegration.ts
index bef82e7e17..199462206c 100644
--- a/frontend/src/pages/api/integrations/StartIntegration.ts
+++ b/frontend/src/pages/api/integrations/StartIntegration.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
integrationId: string;
@@ -11,8 +11,8 @@ interface Props {
* @param {*} integrationId
* @returns
*/
-const startIntegration = ({ integrationId, appName, environment }: Props) => {
- return SecurityClient.fetchCall('/api/v1/integration/' + integrationId, {
+const startIntegration = ({ integrationId, appName, environment }: Props) =>
+ SecurityClient.fetchCall(`/api/v1/integration/${integrationId}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
@@ -25,12 +25,11 @@ const startIntegration = ({ integrationId, appName, environment }: Props) => {
}
})
}).then(async (res) => {
- if (res && res.status == 200) {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to start an integration');
}
+ console.log('Failed to start an integration');
+ return undefined;
});
-};
export default startIntegration;
diff --git a/frontend/src/pages/api/integrations/authorizeIntegration.ts b/frontend/src/pages/api/integrations/authorizeIntegration.ts
index 1454bde4d2..94f1d54f5c 100644
--- a/frontend/src/pages/api/integrations/authorizeIntegration.ts
+++ b/frontend/src/pages/api/integrations/authorizeIntegration.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
workspaceId: string;
@@ -13,8 +13,8 @@ interface Props {
* @param {object} obj.integration - integration which a user is trying to turn on
* @returns
*/
-const AuthorizeIntegration = ({ workspaceId, code, integration }: Props) => {
- return SecurityClient.fetchCall('/api/v1/integration-auth/oauth-token', {
+const AuthorizeIntegration = ({ workspaceId, code, integration }: Props) =>
+ SecurityClient.fetchCall('/api/v1/integration-auth/oauth-token', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@@ -25,12 +25,11 @@ const AuthorizeIntegration = ({ workspaceId, code, integration }: Props) => {
integration
})
}).then(async (res) => {
- if (res && res.status == 200) {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to authorize the integration');
}
+ console.log('Failed to authorize the integration');
+ return undefined;
});
-};
export default AuthorizeIntegration;
diff --git a/frontend/src/pages/api/integrations/getWorkspaceAuthorizations.ts b/frontend/src/pages/api/integrations/getWorkspaceAuthorizations.ts
index f1b4065550..e6b2875542 100644
--- a/frontend/src/pages/api/integrations/getWorkspaceAuthorizations.ts
+++ b/frontend/src/pages/api/integrations/getWorkspaceAuthorizations.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
workspaceId: string;
@@ -9,22 +9,18 @@ interface Props {
* @param {*} workspaceId
* @returns
*/
-const getWorkspaceAuthorizations = ({ workspaceId }: Props) => {
- return SecurityClient.fetchCall(
- '/api/v1/workspace/' + workspaceId + '/authorizations',
- {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json'
- }
+const getWorkspaceAuthorizations = ({ workspaceId }: Props) =>
+ SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/authorizations`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res && res.status == 200) {
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return (await res.json()).authorizations;
- } else {
- console.log('Failed to get project authorizations');
}
+ console.log('Failed to get project authorizations');
+ return undefined;
});
-};
export default getWorkspaceAuthorizations;
diff --git a/frontend/src/pages/api/integrations/getWorkspaceIntegrations.ts b/frontend/src/pages/api/integrations/getWorkspaceIntegrations.ts
index a33256749d..1a518f0eb0 100644
--- a/frontend/src/pages/api/integrations/getWorkspaceIntegrations.ts
+++ b/frontend/src/pages/api/integrations/getWorkspaceIntegrations.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
workspaceId: string;
@@ -9,22 +9,18 @@ interface Props {
* @param {*} workspaceId
* @returns
*/
-const getWorkspaceIntegrations = ({ workspaceId }: Props) => {
- return SecurityClient.fetchCall(
- '/api/v1/workspace/' + workspaceId + '/integrations',
- {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json'
- }
+const getWorkspaceIntegrations = ({ workspaceId }: Props) =>
+ SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/integrations`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res && res.status == 200) {
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return (await res.json()).integrations;
- } else {
- console.log('Failed to get the project integrations');
}
+ console.log('Failed to get the project integrations');
+ return undefined;
});
-};
export default getWorkspaceIntegrations;
diff --git a/frontend/src/pages/api/integrations/updateIntegration.ts b/frontend/src/pages/api/integrations/updateIntegration.ts
index 8afcfc0a95..27047aa7cc 100644
--- a/frontend/src/pages/api/integrations/updateIntegration.ts
+++ b/frontend/src/pages/api/integrations/updateIntegration.ts
@@ -1,4 +1,4 @@
-import SecurityClient from "~/utilities/SecurityClient";
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route starts the integration after teh default one if gonna set up.
@@ -6,7 +6,7 @@ import SecurityClient from "~/utilities/SecurityClient";
* [environment] to the integration [app] with active state [isActive]
* @param {Object} obj
* @param {String} obj.integrationId - id of integration
- * @param {String} obj.app - name of app
+ * @param {String} obj.app - name of app
* @param {String} obj.environment - project environment to push secrets from
* @param {Boolean} obj.isActive - active state
* @param {String} obj.target - (optional) target (environment) for Vercel integration
@@ -14,47 +14,42 @@ import SecurityClient from "~/utilities/SecurityClient";
* @param {String} obj.siteId - (optional) app (site_id) for Netlify integration
* @returns
*/
-const updateIntegration = ({
- integrationId,
- app,
+const updateIntegration = ({
+ integrationId,
+ app,
environment,
isActive,
target,
context,
siteId
}: {
- integrationId: string,
- app: string,
- environment: string,
- isActive: boolean,
- target: string | null,
- context: string | null,
- siteId: string | null
-
-}) => {
- return SecurityClient.fetchCall(
- "/api/v1/integration/" + integrationId,
- {
- method: "PATCH",
- headers: {
- "Content-Type": "application/json",
- },
- body: JSON.stringify({
- app,
- environment,
- isActive,
- target,
- context,
- siteId
- }),
- }
- ).then(async (res) => {
- if (res && res.status == 200) {
+ integrationId: string;
+ app: string;
+ environment: string;
+ isActive: boolean;
+ target: string | null;
+ context: string | null;
+ siteId: string | null;
+}) =>
+ SecurityClient.fetchCall(`/api/v1/integration/${integrationId}`, {
+ method: 'PATCH',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ app,
+ environment,
+ isActive,
+ target,
+ context,
+ siteId
+ })
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log("Failed to start an integration");
}
+ console.log('Failed to start an integration');
+ return undefined;
});
-};
export default updateIntegration;
diff --git a/frontend/src/pages/api/organization/GetOrg.ts b/frontend/src/pages/api/organization/GetOrg.ts
index 5e56e5c727..64af7a4c9e 100644
--- a/frontend/src/pages/api/organization/GetOrg.ts
+++ b/frontend/src/pages/api/organization/GetOrg.ts
@@ -1,23 +1,22 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route lets us get info about a certain org
* @param {string} orgId - the organization ID
* @returns
*/
-const getOrganization = ({ orgId }: { orgId: string }) => {
- return SecurityClient.fetchCall('/api/v1/organization/' + orgId, {
+const getOrganization = ({ orgId }: { orgId: string }) =>
+ SecurityClient.fetchCall(`/api/v1/organization/${orgId}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
}).then(async (res) => {
- if (res?.status == 200) {
+ if (res?.status === 200) {
return (await res.json()).organization;
- } else {
- console.log('Failed to get org info');
}
+ console.log('Failed to get org info');
+ return undefined;
});
-};
export default getOrganization;
diff --git a/frontend/src/pages/api/organization/GetOrgProjects.ts b/frontend/src/pages/api/organization/GetOrgProjects.ts
index 9546944863..7066772ebc 100644
--- a/frontend/src/pages/api/organization/GetOrgProjects.ts
+++ b/frontend/src/pages/api/organization/GetOrgProjects.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route lets us get all the users in an org.
@@ -8,22 +8,18 @@ import SecurityClient from '~/utilities/SecurityClient';
*/
// TODO: this file is not used anywhere
-const getOrganizationProjects = (req: { orgId: string }) => {
- return SecurityClient.fetchCall(
- '/api/organization/' + req.orgId + '/workspaces',
- {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json'
- }
+const getOrganizationProjects = (req: { orgId: string }) =>
+ SecurityClient.fetchCall(`/api/organization/${req.orgId}/workspaces`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res && res.status == 200) {
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return (await res.json()).workspaces;
- } else {
- console.log('Failed to get projects for an org');
}
+ console.log('Failed to get projects for an org');
+ return undefined;
});
-};
export default getOrganizationProjects;
diff --git a/frontend/src/pages/api/organization/GetOrgSubscription.ts b/frontend/src/pages/api/organization/GetOrgSubscription.ts
index c93679cdc8..5004ef078f 100644
--- a/frontend/src/pages/api/organization/GetOrgSubscription.ts
+++ b/frontend/src/pages/api/organization/GetOrgSubscription.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route lets us get the current subscription of an org.
@@ -6,22 +6,18 @@ import SecurityClient from '~/utilities/SecurityClient';
* @param {*} res
* @returns
*/
-const getOrganizationSubscriptions = (req: { orgId: string }) => {
- return SecurityClient.fetchCall(
- '/api/v1/organization/' + req.orgId + '/subscriptions',
- {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json'
- }
+const getOrganizationSubscriptions = (req: { orgId: string }) =>
+ SecurityClient.fetchCall(`/api/v1/organization/${req.orgId}/subscriptions`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res && res.status == 200) {
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return (await res.json()).subscriptions;
- } else {
- console.log('Failed to get org subscriptions');
}
+ console.log('Failed to get org subscriptions');
+ return undefined;
});
-};
export default getOrganizationSubscriptions;
diff --git a/frontend/src/pages/api/organization/GetOrgUserProjects.ts b/frontend/src/pages/api/organization/GetOrgUserProjects.ts
index 872b8d7818..9e0634f87a 100644
--- a/frontend/src/pages/api/organization/GetOrgUserProjects.ts
+++ b/frontend/src/pages/api/organization/GetOrgUserProjects.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route lets us get all the projects of a certain user in an org.
@@ -6,22 +6,18 @@ import SecurityClient from '~/utilities/SecurityClient';
* @param {*} res
* @returns
*/
-const getOrganizationUserProjects = (req: { orgId: string }) => {
- return SecurityClient.fetchCall(
- '/api/v1/organization/' + req.orgId + '/my-workspaces',
- {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json'
- }
+const getOrganizationUserProjects = (req: { orgId: string }) =>
+ SecurityClient.fetchCall(`/api/v1/organization/${req.orgId}/my-workspaces`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res && res.status == 200) {
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return (await res.json()).workspaces;
- } else {
- console.log('Failed to get projects of a user in an org');
}
+ console.log('Failed to get projects of a user in an org');
+ return undefined;
});
-};
export default getOrganizationUserProjects;
diff --git a/frontend/src/pages/api/organization/GetOrgUsers.ts b/frontend/src/pages/api/organization/GetOrgUsers.ts
index e5c5ba7622..a617e26f43 100644
--- a/frontend/src/pages/api/organization/GetOrgUsers.ts
+++ b/frontend/src/pages/api/organization/GetOrgUsers.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
export interface IMembershipOrg {
_id: string;
@@ -20,23 +20,18 @@ export interface IMembershipOrg {
* @param {string} obj.orgId - organization Id
* @returns
*/
-const getOrganizationUsers = ({
- orgId,
-}: {
- orgId: string;
-}): Promise<IMembershipOrg[]> => {
- return SecurityClient.fetchCall('/api/v1/organization/' + orgId + '/users', {
+const getOrganizationUsers = ({ orgId }: { orgId: string }): Promise<IMembershipOrg[]> =>
+ SecurityClient.fetchCall(`/api/v1/organization/${orgId}/users`, {
method: 'GET',
headers: {
- 'Content-Type': 'application/json',
- },
+ 'Content-Type': 'application/json'
+ }
}).then(async (res) => {
- if (res?.status == 200) {
+ if (res?.status === 200) {
return (await res.json()).users;
- } else {
- console.log('Failed to get org users');
}
+ console.log('Failed to get org users');
+ return undefined;
});
-};
export default getOrganizationUsers;
diff --git a/frontend/src/pages/api/organization/StripeRedirect.ts b/frontend/src/pages/api/organization/StripeRedirect.ts
index a9fe1f066d..7a7e935221 100644
--- a/frontend/src/pages/api/organization/StripeRedirect.ts
+++ b/frontend/src/pages/api/organization/StripeRedirect.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route redirects the user to the right stripe billing page.
@@ -6,22 +6,18 @@ import SecurityClient from '~/utilities/SecurityClient';
* @param {*} res
* @returns
*/
-const StripeRedirect = ({ orgId }: { orgId: string }) => {
- return SecurityClient.fetchCall(
- '/api/v1/organization/' + orgId + '/customer-portal-session',
- {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json'
- }
+const StripeRedirect = ({ orgId }: { orgId: string }) =>
+ SecurityClient.fetchCall(`/api/v1/organization/${orgId}/customer-portal-session`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res && res.status == 200) {
- return (window.location.href = (await res.json()).url);
- } else {
- console.log('Failed to redirect to Stripe');
+ }).then(async (res) => {
+ if (res && res.status === 200) {
+ window.location.href = (await res.json()).url;
+ return;
}
+ console.log('Failed to redirect to Stripe');
});
-};
export default StripeRedirect;
diff --git a/frontend/src/pages/api/organization/addIncidentContact.ts b/frontend/src/pages/api/organization/addIncidentContact.ts
index d3676e6419..d3cd93fe1f 100644
--- a/frontend/src/pages/api/organization/addIncidentContact.ts
+++ b/frontend/src/pages/api/organization/addIncidentContact.ts
@@ -1,29 +1,25 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route add an incident contact email to a certain organization
* @param {*} param0
* @returns
*/
-const addIncidentContact = (organizationId: string, email: string) => {
- return SecurityClient.fetchCall(
- '/api/v1/organization/' + organizationId + '/incidentContactOrg',
- {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({
- email: email
- })
- }
- ).then(async (res) => {
- if (res && res.status == 200) {
+const addIncidentContact = (organizationId: string, email: string) =>
+ SecurityClient.fetchCall(`/api/v1/organization/${organizationId}/incidentContactOrg`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ email
+ })
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to add an incident contact');
}
+ console.log('Failed to add an incident contact');
+ return undefined;
});
-};
export default addIncidentContact;
diff --git a/frontend/src/pages/api/organization/addUserToOrg.ts b/frontend/src/pages/api/organization/addUserToOrg.ts
index 70dbad56cc..8736e6f603 100644
--- a/frontend/src/pages/api/organization/addUserToOrg.ts
+++ b/frontend/src/pages/api/organization/addUserToOrg.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This function sends an email invite to a user to join an org
@@ -6,8 +6,8 @@ import SecurityClient from '~/utilities/SecurityClient';
* @param {*} orgId
* @returns
*/
-const addUserToOrg = (email: string, orgId: string) => {
- return SecurityClient.fetchCall('/api/v1/invite-org/signup', {
+const addUserToOrg = (email: string, orgId: string) =>
+ SecurityClient.fetchCall('/api/v1/invite-org/signup', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@@ -17,12 +17,11 @@ const addUserToOrg = (email: string, orgId: string) => {
organizationId: orgId
})
}).then(async (res) => {
- if (res && res.status == 200) {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to add a user to an org');
}
+ console.log('Failed to add a user to an org');
+ return undefined;
});
-};
export default addUserToOrg;
diff --git a/frontend/src/pages/api/organization/deleteIncidentContact.ts b/frontend/src/pages/api/organization/deleteIncidentContact.ts
index fd6374e9b6..be418f5302 100644
--- a/frontend/src/pages/api/organization/deleteIncidentContact.ts
+++ b/frontend/src/pages/api/organization/deleteIncidentContact.ts
@@ -1,29 +1,25 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route deletes an incident Contact from a certain organization
* @param {*} param0
* @returns
*/
-const deleteIncidentContact = (organizationId: string, email: string) => {
- return SecurityClient.fetchCall(
- '/api/v1/organization/' + organizationId + '/incidentContactOrg',
- {
- method: 'DELETE',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({
- email: email
- })
- }
- ).then(async (res) => {
- if (res && res.status == 200) {
+const deleteIncidentContact = (organizationId: string, email: string) =>
+ SecurityClient.fetchCall(`/api/v1/organization/${organizationId}/incidentContactOrg`, {
+ method: 'DELETE',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ email
+ })
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to delete an incident contact');
}
+ console.log('Failed to delete an incident contact');
+ return undefined;
});
-};
export default deleteIncidentContact;
diff --git a/frontend/src/pages/api/organization/deleteUserFromOrganization.ts b/frontend/src/pages/api/organization/deleteUserFromOrganization.ts
index 988a09485a..594c5cbdd4 100644
--- a/frontend/src/pages/api/organization/deleteUserFromOrganization.ts
+++ b/frontend/src/pages/api/organization/deleteUserFromOrganization.ts
@@ -1,23 +1,22 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This function removes a certain member from a certain organization
* @param {*} membershipId
* @returns
*/
-const deleteUserFromOrganization = (membershipId: string) => {
- return SecurityClient.fetchCall('/api/v1/membership-org/' + membershipId, {
+const deleteUserFromOrganization = (membershipId: string) =>
+ SecurityClient.fetchCall(`/api/v1/membership-org/${membershipId}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
}
}).then(async (res) => {
- if (res && res.status == 200) {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to delete a user from an org');
}
+ console.log('Failed to delete a user from an org');
+ return undefined;
});
-};
export default deleteUserFromOrganization;
diff --git a/frontend/src/pages/api/organization/getIncidentContacts.ts b/frontend/src/pages/api/organization/getIncidentContacts.ts
index 01ea81350b..df5ab083ed 100644
--- a/frontend/src/pages/api/organization/getIncidentContacts.ts
+++ b/frontend/src/pages/api/organization/getIncidentContacts.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
export interface IIncidentContactOrg {
_id: string;
@@ -10,24 +10,18 @@ export interface IIncidentContactOrg {
* @param {*} workspaceId
* @returns
*/
-const getIncidentContacts = (
- organizationId: string
-): Promise<IIncidentContactOrg[]> => {
- return SecurityClient.fetchCall(
- '/api/v1/organization/' + organizationId + '/incidentContactOrg',
- {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json',
- },
+const getIncidentContacts = (organizationId: string): Promise<IIncidentContactOrg[]> =>
+ SecurityClient.fetchCall(`/api/v1/organization/${organizationId}/incidentContactOrg`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res && res.status == 200) {
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return (await res.json()).incidentContactsOrg;
- } else {
- console.log('Failed to get incident contacts');
}
+ console.log('Failed to get incident contacts');
+ return undefined;
});
-};
export default getIncidentContacts;
diff --git a/frontend/src/pages/api/organization/getOrgs.ts b/frontend/src/pages/api/organization/getOrgs.ts
index 5f01bc4d16..84d43187a2 100644
--- a/frontend/src/pages/api/organization/getOrgs.ts
+++ b/frontend/src/pages/api/organization/getOrgs.ts
@@ -1,22 +1,21 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route lets us get the all the orgs of a certain user.
* @returns
*/
-const getOrganizations = () => {
- return SecurityClient.fetchCall('/api/v1/organization', {
+const getOrganizations = () =>
+ SecurityClient.fetchCall('/api/v1/organization', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
}).then(async (res) => {
- if (res?.status == 200) {
+ if (res?.status === 200) {
return (await res.json()).organizations;
- } else {
- console.log('Failed to get orgs of a user');
}
+ console.log('Failed to get orgs of a user');
+ return undefined;
});
-};
export default getOrganizations;
diff --git a/frontend/src/pages/api/organization/renameOrg.ts b/frontend/src/pages/api/organization/renameOrg.ts
index c5c0b4d65b..c97255d267 100644
--- a/frontend/src/pages/api/organization/renameOrg.ts
+++ b/frontend/src/pages/api/organization/renameOrg.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route lets us rename a certain org.
@@ -6,8 +6,8 @@ import SecurityClient from '~/utilities/SecurityClient';
* @param {*} res
* @returns
*/
-const renameOrg = (orgId: string, newOrgName: string) => {
- return SecurityClient.fetchCall('/api/v1/organization/' + orgId + '/name', {
+const renameOrg = (orgId: string, newOrgName: string) =>
+ SecurityClient.fetchCall(`/api/v1/organization/${orgId}/name`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json'
@@ -16,12 +16,11 @@ const renameOrg = (orgId: string, newOrgName: string) => {
name: newOrgName
})
}).then(async (res) => {
- if (res && res.status == 200) {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to rename an organization');
}
+ console.log('Failed to rename an organization');
+ return undefined;
});
-};
export default renameOrg;
diff --git a/frontend/src/pages/api/serviceToken/addServiceToken.ts b/frontend/src/pages/api/serviceToken/addServiceToken.ts
index c9cc7a2398..8dc0cca5d6 100644
--- a/frontend/src/pages/api/serviceToken/addServiceToken.ts
+++ b/frontend/src/pages/api/serviceToken/addServiceToken.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
name: string;
@@ -28,10 +28,10 @@ const addServiceToken = ({
environment,
expiresIn,
encryptedKey,
- iv,
+ iv,
tag
-}: Props) => {
- return SecurityClient.fetchCall('/api/v2/service-token/', {
+}: Props) =>
+ SecurityClient.fetchCall('/api/v2/service-token/', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@@ -42,16 +42,15 @@ const addServiceToken = ({
environment,
expiresIn,
encryptedKey,
- iv,
+ iv,
tag
})
}).then(async (res) => {
- if (res && res.status == 200) {
- return (await res.json());
- } else {
- console.log('Failed to add service tokens');
+ if (res && res.status === 200) {
+ return res.json();
}
+ console.log('Failed to add service tokens');
+ return undefined;
});
-};
export default addServiceToken;
diff --git a/frontend/src/pages/api/serviceToken/deleteServiceToken.ts b/frontend/src/pages/api/serviceToken/deleteServiceToken.ts
index 94f2f1602d..077f7a4bc3 100644
--- a/frontend/src/pages/api/serviceToken/deleteServiceToken.ts
+++ b/frontend/src/pages/api/serviceToken/deleteServiceToken.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Props {
serviceTokenId: string;
@@ -10,21 +10,18 @@ interface Props {
* @param {string} obj.serviceTokenId - id of a cervice token that we want to delete
* @returns
*/
-const deleteServiceToken = ({
- serviceTokenId,
-}: Props) => {
- return SecurityClient.fetchCall('/api/v2/service-token/' + serviceTokenId, {
+const deleteServiceToken = ({ serviceTokenId }: Props) =>
+ SecurityClient.fetchCall(`/api/v2/service-token/${serviceTokenId}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
- },
+ }
}).then(async (res) => {
- if (res && res.status == 200) {
- return (await res.json());
- } else {
- console.log('Failed to delete a service token');
+ if (res && res.status === 200) {
+ return res.json();
}
+ console.log('Failed to delete a service token');
+ return undefined;
});
-};
export default deleteServiceToken;
diff --git a/frontend/src/pages/api/serviceToken/getServiceTokens.ts b/frontend/src/pages/api/serviceToken/getServiceTokens.ts
index db6b035dd6..3d4d322743 100644
--- a/frontend/src/pages/api/serviceToken/getServiceTokens.ts
+++ b/frontend/src/pages/api/serviceToken/getServiceTokens.ts
@@ -1,26 +1,22 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route gets service tokens for a specific user in a project
* @param {*} param0
* @returns
*/
-const getServiceTokens = ({ workspaceId }: { workspaceId: string }) => {
- return SecurityClient.fetchCall(
- '/api/v2/workspace/' + workspaceId + '/service-token-data',
- {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json'
- }
+const getServiceTokens = ({ workspaceId }: { workspaceId: string }) =>
+ SecurityClient.fetchCall(`/api/v2/workspace/${workspaceId}/service-token-data`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res && res.status == 200) {
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return (await res.json()).serviceTokenData;
- } else {
- console.log('Failed to get service tokens');
}
+ console.log('Failed to get service tokens');
+ return undefined;
});
-};
export default getServiceTokens;
diff --git a/frontend/src/pages/api/user/getUser.ts b/frontend/src/pages/api/user/getUser.ts
index 7562b0f3be..50f9fc5d33 100644
--- a/frontend/src/pages/api/user/getUser.ts
+++ b/frontend/src/pages/api/user/getUser.ts
@@ -1,21 +1,20 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route gets the information about a specific user.
*/
-const getUser = () => {
- return SecurityClient.fetchCall('/api/v1/user', {
+const getUser = () =>
+ SecurityClient.fetchCall('/api/v1/user', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
}).then(async (res) => {
- if (res?.status == 200) {
+ if (res?.status === 200) {
return (await res.json()).user;
- } else {
- console.log('Failed to get user info');
}
+ console.log('Failed to get user info');
+ return undefined;
});
-};
export default getUser;
diff --git a/frontend/src/pages/api/userActions/checkUserAction.ts b/frontend/src/pages/api/userActions/checkUserAction.ts
index 9941ae85a9..80f2918866 100644
--- a/frontend/src/pages/api/userActions/checkUserAction.ts
+++ b/frontend/src/pages/api/userActions/checkUserAction.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route registers a certain action for a user
@@ -6,13 +6,12 @@ import SecurityClient from '~/utilities/SecurityClient';
* @param {*} workspaceId
* @returns
*/
-const checkUserAction = ({ action }: { action: string }) => {
- return SecurityClient.fetchCall(
- '/api/v1/user-action' +
- '?' +
- new URLSearchParams({
+const checkUserAction = ({ action }: { action: string }) =>
+ SecurityClient.fetchCall(
+ `/api/v1/user-action` +
+ `?${new URLSearchParams({
action
- }),
+ })}`,
{
method: 'GET',
headers: {
@@ -20,12 +19,11 @@ const checkUserAction = ({ action }: { action: string }) => {
}
}
).then(async (res) => {
- if (res && res.status == 200) {
+ if (res && res.status === 200) {
return (await res.json()).userAction;
- } else {
- console.log('Failed to check a user action');
}
+ console.log('Failed to check a user action');
+ return undefined;
});
-};
export default checkUserAction;
diff --git a/frontend/src/pages/api/userActions/registerUserAction.ts b/frontend/src/pages/api/userActions/registerUserAction.ts
index d8f4d41e6e..669ccc8876 100644
--- a/frontend/src/pages/api/userActions/registerUserAction.ts
+++ b/frontend/src/pages/api/userActions/registerUserAction.ts
@@ -1,12 +1,12 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route registers a certain action for a user
* @param {*} action
* @returns
*/
-const registerUserAction = ({ action }: { action: string }) => {
- return SecurityClient.fetchCall('/api/v1/user-action', {
+const registerUserAction = ({ action }: { action: string }) =>
+ SecurityClient.fetchCall('/api/v1/user-action', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
@@ -15,12 +15,11 @@ const registerUserAction = ({ action }: { action: string }) => {
action
})
}).then(async (res) => {
- if (res && res.status == 200) {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to register a user action');
}
+ console.log('Failed to register a user action');
+ return undefined;
});
-};
export default registerUserAction;
diff --git a/frontend/src/pages/api/workspace/addUserToWorkspace.ts b/frontend/src/pages/api/workspace/addUserToWorkspace.ts
index e1efa51a1a..20a5fa0299 100644
--- a/frontend/src/pages/api/workspace/addUserToWorkspace.ts
+++ b/frontend/src/pages/api/workspace/addUserToWorkspace.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This function adds a user to a project
@@ -6,25 +6,21 @@ import SecurityClient from '~/utilities/SecurityClient';
* @param {*} workspaceId
* @returns
*/
-const addUserToWorkspace = (email: string, workspaceId: string) => {
- return SecurityClient.fetchCall(
- '/api/v1/workspace/' + workspaceId + '/invite-signup',
- {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({
- email: email
- })
- }
- ).then(async (res) => {
- if (res && res.status == 200) {
- return await res.json();
- } else {
- console.log('Failed to add a user to project');
+const addUserToWorkspace = (email: string, workspaceId: string) =>
+ SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/invite-signup`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ email
+ })
+ }).then(async (res) => {
+ if (res && res.status === 200) {
+ return res.json();
}
+ console.log('Failed to add a user to project');
+ return undefined;
});
-};
export default addUserToWorkspace;
diff --git a/frontend/src/pages/api/workspace/changeUserRoleInWorkspace.ts b/frontend/src/pages/api/workspace/changeUserRoleInWorkspace.ts
index 9ac49440a7..6436b2bb41 100644
--- a/frontend/src/pages/api/workspace/changeUserRoleInWorkspace.ts
+++ b/frontend/src/pages/api/workspace/changeUserRoleInWorkspace.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This function change the access of a user in a certain workspace
@@ -6,25 +6,21 @@ import SecurityClient from '~/utilities/SecurityClient';
* @param {*} role
* @returns
*/
-const changeUserRoleInWorkspace = (membershipId: string, role: string) => {
- return SecurityClient.fetchCall(
- '/api/v1/membership/' + membershipId + '/change-role',
- {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({
- role: role
- })
- }
- ).then(async (res) => {
- if (res && res.status == 200) {
+const changeUserRoleInWorkspace = (membershipId: string, role: string) =>
+ SecurityClient.fetchCall(`/api/v1/membership/${membershipId}/change-role`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ role
+ })
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to change the user role in a project');
}
+ console.log('Failed to change the user role in a project');
+ return undefined;
});
-};
export default changeUserRoleInWorkspace;
diff --git a/frontend/src/pages/api/workspace/createWorkspace.ts b/frontend/src/pages/api/workspace/createWorkspace.ts
index 877ef7567f..0aee4643b3 100644
--- a/frontend/src/pages/api/workspace/createWorkspace.ts
+++ b/frontend/src/pages/api/workspace/createWorkspace.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route creates a new workspace for a user within a certain organization.
@@ -12,23 +12,22 @@ const createWorkspace = ({
}: {
workspaceName: string;
organizationId: string;
-}) => {
- return SecurityClient.fetchCall('/api/v1/workspace', {
+}) =>
+ SecurityClient.fetchCall('/api/v1/workspace', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
- workspaceName: workspaceName,
- organizationId: organizationId
+ workspaceName,
+ organizationId
})
}).then(async (res) => {
- if (res?.status == 200) {
+ if (res?.status === 200) {
return (await res.json()).workspace;
- } else {
- console.log('Failed to create a project');
}
+ console.log('Failed to create a project');
+ return undefined;
});
-};
export default createWorkspace;
diff --git a/frontend/src/pages/api/workspace/deleteUserFromWorkspace.ts b/frontend/src/pages/api/workspace/deleteUserFromWorkspace.ts
index ea02f96d44..10cbeb2c6b 100644
--- a/frontend/src/pages/api/workspace/deleteUserFromWorkspace.ts
+++ b/frontend/src/pages/api/workspace/deleteUserFromWorkspace.ts
@@ -1,23 +1,22 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This function removes a certain member from a certain workspace
* @param {*} membershipId
* @returns
*/
-const deleteUserFromWorkspace = (membershipId: string) => {
- return SecurityClient.fetchCall('/api/v1/membership/' + membershipId, {
+const deleteUserFromWorkspace = (membershipId: string) =>
+ SecurityClient.fetchCall(`/api/v1/membership/${membershipId}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
}
}).then(async (res) => {
- if (res && res.status == 200) {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to delete a user from a project');
}
+ console.log('Failed to delete a user from a project');
+ return undefined;
});
-};
export default deleteUserFromWorkspace;
diff --git a/frontend/src/pages/api/workspace/deleteWorkspace.ts b/frontend/src/pages/api/workspace/deleteWorkspace.ts
index 2bdb64cd31..0961bdf26d 100644
--- a/frontend/src/pages/api/workspace/deleteWorkspace.ts
+++ b/frontend/src/pages/api/workspace/deleteWorkspace.ts
@@ -1,23 +1,22 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route deletes a specified workspace.
* @param {*} workspaceId
* @returns
*/
-const deleteWorkspace = (workspaceId: string) => {
- return SecurityClient.fetchCall('/api/v1/workspace/' + workspaceId, {
+const deleteWorkspace = (workspaceId: string) =>
+ SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
}
}).then(async (res) => {
- if (res && res.status == 200) {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to delete a project');
}
+ console.log('Failed to delete a project');
+ return undefined;
});
-};
export default deleteWorkspace;
diff --git a/frontend/src/pages/api/workspace/getAWorkspace.ts b/frontend/src/pages/api/workspace/getAWorkspace.ts
index 71c5036eb4..69c178ae91 100644
--- a/frontend/src/pages/api/workspace/getAWorkspace.ts
+++ b/frontend/src/pages/api/workspace/getAWorkspace.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Workspace {
__v: number;
@@ -12,20 +12,19 @@ interface Workspace {
* This route lets us get the workspaces of a certain user
* @returns
*/
-const getAWorkspace = (workspaceID:string) => {
- return SecurityClient.fetchCall(`/api/v1/workspace/${workspaceID}`, {
+const getAWorkspace = (workspaceID: string) =>
+ SecurityClient.fetchCall(`/api/v1/workspace/${workspaceID}`, {
method: 'GET',
headers: {
- 'Content-Type': 'application/json',
- },
+ 'Content-Type': 'application/json'
+ }
}).then(async (res) => {
- if (res?.status == 200) {
+ if (res?.status === 200) {
const data = (await res.json()) as unknown as { workspace: Workspace };
return data.workspace;
}
throw new Error('Failed to get workspace');
});
-};
export default getAWorkspace;
diff --git a/frontend/src/pages/api/workspace/getLatestFileKey.ts b/frontend/src/pages/api/workspace/getLatestFileKey.ts
index 1ecd2035dc..576fcf9437 100644
--- a/frontend/src/pages/api/workspace/getLatestFileKey.ts
+++ b/frontend/src/pages/api/workspace/getLatestFileKey.ts
@@ -1,23 +1,22 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* Get the latest key pairs from a certain workspace
* @param {string} workspaceId
* @returns
*/
-const getLatestFileKey = ({ workspaceId }: { workspaceId: string }) => {
- return SecurityClient.fetchCall('/api/v1/key/' + workspaceId + '/latest', {
+const getLatestFileKey = ({ workspaceId }: { workspaceId: string }) =>
+ SecurityClient.fetchCall(`/api/v1/key/${workspaceId}/latest`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
}).then(async (res) => {
- if (res?.status == 200) {
- return await res.json();
- } else {
- console.log('Failed to get the latest key pairs for a certain project');
+ if (res?.status === 200) {
+ return res.json();
}
+ console.log('Failed to get the latest key pairs for a certain project');
+ return undefined;
});
-};
export default getLatestFileKey;
diff --git a/frontend/src/pages/api/workspace/getProjectInfo.ts b/frontend/src/pages/api/workspace/getProjectInfo.ts
index a1ab0438c5..f6d364c189 100644
--- a/frontend/src/pages/api/workspace/getProjectInfo.ts
+++ b/frontend/src/pages/api/workspace/getProjectInfo.ts
@@ -1,23 +1,22 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route lets us get the information of a certain project.
* @param {*} projectId - project ID (we renamed workspaces to projects in the app)
* @returns
*/
-const getProjectInfo = ({ projectId }: { projectId: string }) => {
- return SecurityClient.fetchCall('/api/v1/workspace/' + projectId, {
+const getProjectInfo = ({ projectId }: { projectId: string }) =>
+ SecurityClient.fetchCall(`/api/v1/workspace/${projectId}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
}).then(async (res) => {
- if (res?.status == 200) {
+ if (res?.status === 200) {
return (await res.json()).workspace;
- } else {
- console.log('Failed to get project info');
}
+ console.log('Failed to get project info');
+ return undefined;
});
-};
export default getProjectInfo;
diff --git a/frontend/src/pages/api/workspace/getWorkspaceKeys.ts b/frontend/src/pages/api/workspace/getWorkspaceKeys.ts
index 09b4686622..636b2fc422 100644
--- a/frontend/src/pages/api/workspace/getWorkspaceKeys.ts
+++ b/frontend/src/pages/api/workspace/getWorkspaceKeys.ts
@@ -1,26 +1,22 @@
-import SecurityClient from "~/utilities/SecurityClient";
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route lets us get the public keys of everyone in your workspace.
* @param {string} workspaceId
* @returns
*/
-const getWorkspaceKeys = ({ workspaceId }: { workspaceId: string; }) => {
- return SecurityClient.fetchCall(
- "/api/v1/workspace/" + workspaceId + "/keys",
- {
- method: "GET",
- headers: {
- "Content-Type": "application/json",
- },
+const getWorkspaceKeys = ({ workspaceId }: { workspaceId: string }) =>
+ SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/keys`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res?.status == 200) {
+ }).then(async (res) => {
+ if (res?.status === 200) {
return (await res.json()).publicKeys;
- } else {
- console.log("Failed to get the public keys of everyone in the workspace");
}
+ console.log('Failed to get the public keys of everyone in the workspace');
+ return undefined;
});
-};
export default getWorkspaceKeys;
diff --git a/frontend/src/pages/api/workspace/getWorkspaceUsers.ts b/frontend/src/pages/api/workspace/getWorkspaceUsers.ts
index c4f00eb0da..d498685819 100644
--- a/frontend/src/pages/api/workspace/getWorkspaceUsers.ts
+++ b/frontend/src/pages/api/workspace/getWorkspaceUsers.ts
@@ -1,26 +1,22 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route lets us get all the users in the workspace.
* @param {string} workspaceId - workspace ID
* @returns
*/
-const getWorkspaceUsers = ({ workspaceId }: { workspaceId: string }) => {
- return SecurityClient.fetchCall(
- '/api/v1/workspace/' + workspaceId + '/users',
- {
- method: 'GET',
- headers: {
- 'Content-Type': 'application/json'
- }
+const getWorkspaceUsers = ({ workspaceId }: { workspaceId: string }) =>
+ SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/users`, {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json'
}
- ).then(async (res) => {
- if (res?.status == 200) {
+ }).then(async (res) => {
+ if (res?.status === 200) {
return (await res.json()).users;
- } else {
- console.log('Failed to get Project Users');
}
+ console.log('Failed to get Project Users');
+ return undefined;
});
-};
export default getWorkspaceUsers;
diff --git a/frontend/src/pages/api/workspace/getWorkspaces.ts b/frontend/src/pages/api/workspace/getWorkspaces.ts
index d77c4c431b..95c9770088 100644
--- a/frontend/src/pages/api/workspace/getWorkspaces.ts
+++ b/frontend/src/pages/api/workspace/getWorkspaces.ts
@@ -1,31 +1,30 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
interface Workspace {
__v: number;
_id: string;
name: string;
organization: string;
- environments: Array<{name:string, slug:string}>
+ environments: Array<{ name: string; slug: string }>;
}
/**
* This route lets us get the workspaces of a certain user
* @returns
*/
-const getWorkspaces = () => {
- return SecurityClient.fetchCall('/api/v1/workspace', {
+const getWorkspaces = () =>
+ SecurityClient.fetchCall('/api/v1/workspace', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
}).then(async (res) => {
- if (res?.status == 200) {
+ if (res?.status === 200) {
const data = (await res.json()) as unknown as { workspaces: Workspace[] };
return data.workspaces;
}
throw new Error('Failed to get projects');
});
-};
export default getWorkspaces;
diff --git a/frontend/src/pages/api/workspace/renameWorkspace.ts b/frontend/src/pages/api/workspace/renameWorkspace.ts
index a25d2068c1..5c7238b40e 100644
--- a/frontend/src/pages/api/workspace/renameWorkspace.ts
+++ b/frontend/src/pages/api/workspace/renameWorkspace.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route lets us rename a certain workspace.
@@ -6,25 +6,21 @@ import SecurityClient from '~/utilities/SecurityClient';
* @param {*} res
* @returns
*/
-const renameWorkspace = (workspaceId: string, newWorkspaceName: string) => {
- return SecurityClient.fetchCall(
- '/api/v1/workspace/' + workspaceId + '/name',
- {
- method: 'POST',
- headers: {
- 'Content-Type': 'application/json'
- },
- body: JSON.stringify({
- name: newWorkspaceName
- })
- }
- ).then(async (res) => {
- if (res && res.status == 200) {
+const renameWorkspace = (workspaceId: string, newWorkspaceName: string) =>
+ SecurityClient.fetchCall(`/api/v1/workspace/${workspaceId}/name`, {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ name: newWorkspaceName
+ })
+ }).then(async (res) => {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to rename a project');
}
+ console.log('Failed to rename a project');
+ return undefined;
});
-};
export default renameWorkspace;
diff --git a/frontend/src/pages/api/workspace/uploadKeys.ts b/frontend/src/pages/api/workspace/uploadKeys.ts
index 2f791735d9..7d05fa9ed6 100644
--- a/frontend/src/pages/api/workspace/uploadKeys.ts
+++ b/frontend/src/pages/api/workspace/uploadKeys.ts
@@ -1,4 +1,4 @@
-import SecurityClient from '~/utilities/SecurityClient';
+import SecurityClient from '@app/components/utilities/SecurityClient';
/**
* This route uplods the keys in an encrypted format.
@@ -8,31 +8,25 @@ import SecurityClient from '~/utilities/SecurityClient';
* @param {*} nonce
* @returns
*/
-const uploadKeys = (
- workspaceId: string,
- userId: string,
- encryptedKey: string,
- nonce: string
-) => {
- return SecurityClient.fetchCall('/api/v1/key/' + workspaceId, {
+const uploadKeys = (workspaceId: string, userId: string, encryptedKey: string, nonce: string) =>
+ SecurityClient.fetchCall(`/api/v1/key/${workspaceId}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
key: {
- userId: userId,
- encryptedKey: encryptedKey,
- nonce: nonce
+ userId,
+ encryptedKey,
+ nonce
}
})
}).then(async (res) => {
- if (res && res.status == 200) {
+ if (res && res.status === 200) {
return res;
- } else {
- console.log('Failed to upload keys for a new user');
}
+ console.log('Failed to upload keys for a new user');
+ return undefined;
});
-};
export default uploadKeys;
diff --git a/frontend/src/pages/dashboard.tsx b/frontend/src/pages/dashboard.tsx
index 8b3ba26945..60fda6cf28 100644
--- a/frontend/src/pages/dashboard.tsx
+++ b/frontend/src/pages/dashboard.tsx
@@ -15,11 +15,11 @@ export default function DashboardRedirect() {
let userWorkspace;
try {
if (localStorage.getItem('projectData.id')) {
- router.push('/dashboard/' + localStorage.getItem('projectData.id'));
+ router.push(`/dashboard/${ localStorage.getItem('projectData.id')}`);
} else {
const userWorkspaces = await getWorkspaces();
userWorkspace = userWorkspaces[0]._id;
- router.push('/dashboard/' + userWorkspace);
+ router.push(`/dashboard/${ userWorkspace}`);
}
} catch (error) {
console.log('Error - Not logged in yet');
@@ -28,7 +28,7 @@ export default function DashboardRedirect() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
- return <div></div>;
+ return <div />;
}
DashboardRedirect.requireAuth = true;
diff --git a/frontend/src/pages/dashboard/[id].tsx b/frontend/src/pages/dashboard/[id].tsx
index 8d463c47b5..8499faf9ce 100644
--- a/frontend/src/pages/dashboard/[id].tsx
+++ b/frontend/src/pages/dashboard/[id].tsx
@@ -1,8 +1,22 @@
+/* eslint-disable no-nested-ternary */
import { Fragment, useCallback, useEffect, useState } from 'react';
import Head from 'next/head';
import Image from 'next/image';
import { useRouter } from 'next/router';
import { useTranslation } from 'next-i18next';
+import Button from '@app/components/basic/buttons/Button';
+import ListBox from '@app/components/basic/Listbox';
+import BottonRightPopup from '@app/components/basic/popups/BottomRightPopup';
+import { useNotificationContext } from '@app/components/context/Notifications/NotificationProvider';
+import DownloadSecretMenu from '@app/components/dashboard/DownloadSecretsMenu';
+import DropZone from '@app/components/dashboard/DropZone';
+import KeyPair from '@app/components/dashboard/KeyPair';
+import SideBar from '@app/components/dashboard/SideBar';
+import NavHeader from '@app/components/navigation/NavHeader';
+import guidGenerator from '@app/components/utilities/randomId';
+import encryptSecrets from '@app/components/utilities/secrets/encryptSecrets';
+import getSecretsForProject from '@app/components/utilities/secrets/getSecretsForProject';
+import { getTranslatedServerSideProps } from '@app/components/utilities/withTranslateProps';
import getProjectSercetSnapshotsCount from '@app/ee/api/secrets/GetProjectSercetSnapshotsCount';
import performSecretRollback from '@app/ee/api/secrets/PerformSecretRollback';
import PITRecoverySidebar from '@app/ee/components/PITRecoverySidebar';
@@ -16,24 +30,10 @@ import {
faEyeSlash,
faFolderOpen,
faMagnifyingGlass,
- faPlus,
+ faPlus
} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import Button from '~/components/basic/buttons/Button';
-import ListBox from '~/components/basic/Listbox';
-import BottonRightPopup from '~/components/basic/popups/BottomRightPopup';
-import { useNotificationContext } from '~/components/context/Notifications/NotificationProvider';
-import DownloadSecretMenu from '~/components/dashboard/DownloadSecretsMenu';
-import DropZone from '~/components/dashboard/DropZone';
-import KeyPair from '~/components/dashboard/KeyPair';
-import SideBar from '~/components/dashboard/SideBar';
-import NavHeader from '~/components/navigation/NavHeader';
-import encryptSecrets from '~/components/utilities/secrets/encryptSecrets';
-import getSecretsForProject from '~/components/utilities/secrets/getSecretsForProject';
-import { getTranslatedServerSideProps } from '~/components/utilities/withTranslateProps';
-import guidGenerator from '~/utilities/randomId';
-
import addSecrets from '../api/files/AddSecrets';
import deleteSecrets from '../api/files/DeleteSecrets';
import updateSecrets from '../api/files/UpdateSecrets';
@@ -57,7 +57,8 @@ interface SecretDataProps {
comment: string;
}
-interface overrideProps {
+// eslint-disable-next-line @typescript-eslint/no-unused-vars
+interface OverrideProps {
id: string;
keyName: string;
value: string;
@@ -91,10 +92,9 @@ function findDuplicates(arr: any[]) {
if (map.has(item)) {
map.set(item, false);
return true;
- } else {
- map.set(item, true);
- return false;
}
+ map.set(item, true);
+ return false;
});
}
@@ -104,7 +104,7 @@ function findDuplicates(arr: any[]) {
*/
export default function Dashboard() {
const [data, setData] = useState<SecretDataProps[] | null>();
- const [initialData, setInitialData] = useState<SecretDataProps[] | null | undefined>([]);
+ const [initialData, setInitialData] = useState<SecretDataProps[] | null | undefined>([]);
const [buttonReady, setButtonReady] = useState(false);
const router = useRouter();
const [blurred, setBlurred] = useState(true);
@@ -129,11 +129,10 @@ export default function Dashboard() {
const workspaceId = router.query.id as string;
const [workspaceEnvs, setWorkspaceEnvs] = useState<WorkspaceEnv[]>([]);
- const [selectedSnapshotEnv, setSelectedSnapshotEnv] =
- useState<WorkspaceEnv>();
+ const [selectedSnapshotEnv, setSelectedSnapshotEnv] = useState<WorkspaceEnv>();
const [selectedEnv, setSelectedEnv] = useState<WorkspaceEnv>({
name: '',
- slug: '',
+ slug: ''
});
// #TODO: fix save message for changing reroutes
@@ -153,12 +152,11 @@ export default function Dashboard() {
// prompt the user if they try and leave with unsaved changes
useEffect(() => {
- const warningText =
- 'Do you want to save your results before leaving this page?';
+ const warningText = 'Do you want to save your results before leaving this page?';
const handleWindowClose = (e: any) => {
if (!buttonReady) return;
e.preventDefault();
- return (e.returnValue = warningText);
+ e.returnValue = warningText;
};
window.addEventListener('beforeunload', handleWindowClose);
// router.events.on('routeChangeStart', beforeRouteHandler);
@@ -168,13 +166,29 @@ export default function Dashboard() {
};
}, [buttonReady]);
+ // TODO(akhilmhdh): change to FP
+ const sortValuesHandler = (
+ dataToSort: SecretDataProps[] | 1,
+ specificSortMethod?: 'alphabetical' | '-alphabetical'
+ ) => {
+ const howToSort = specificSortMethod === undefined ? sortMethod : specificSortMethod;
+ const sortedData = (dataToSort !== 1 ? dataToSort : data)!
+ .sort((a, b) =>
+ howToSort === 'alphabetical' ? a.key.localeCompare(b.key) : b.key.localeCompare(a.key)
+ )
+ .map((item: SecretDataProps, index: number) => ({
+ ...item,
+ pos: index
+ }));
+
+ setData(sortedData);
+ };
+
/**
* Reorder rows alphabetically or in the opprosite order
*/
const reorderRows = (dataToReorder: SecretDataProps[] | 1) => {
- setSortMethod((prevSort) =>
- prevSort == 'alphabetical' ? '-alphabetical' : 'alphabetical'
- );
+ setSortMethod((prevSort) => (prevSort === 'alphabetical' ? '-alphabetical' : 'alphabetical'));
sortValuesHandler(dataToReorder, undefined);
};
@@ -183,38 +197,30 @@ export default function Dashboard() {
(async () => {
try {
const tempNumSnapshots = await getProjectSercetSnapshotsCount({
- workspaceId,
+ workspaceId
});
setNumSnapshots(tempNumSnapshots);
const userWorkspaces = await getWorkspaces();
- const workspace = userWorkspaces.find(
- (workspace) => workspace._id === workspaceId
- );
+ const workspace = userWorkspaces.find((wp) => wp._id === workspaceId);
if (!workspace) {
- router.push('/dashboard/' + userWorkspaces?.[0]?._id);
+ router.push(`/dashboard/${userWorkspaces?.[0]?._id}`);
}
setWorkspaceEnvs(workspace?.environments || []);
// set env
const env = workspace?.environments?.[0] || {
name: 'unknown',
- slug: 'unkown',
+ slug: 'unkown'
};
setSelectedEnv(env);
setSelectedSnapshotEnv(env);
const user = await getUser();
- setIsNew(
- (Date.parse(String(new Date())) - Date.parse(user.createdAt)) /
- 60000 <
- 3
- ? true
- : false
- );
+ setIsNew((Date.parse(String(new Date())) - Date.parse(user.createdAt)) / 60000 < 3);
const userAction = await checkUserAction({
- action: 'first_time_secrets_pushed',
+ action: 'first_time_secrets_pushed'
});
- setHasUserEverPushed(userAction ? true : false);
+ setHasUserEverPushed(!!userAction);
} catch (error) {
console.log('Error', error);
setData(undefined);
@@ -232,14 +238,12 @@ export default function Dashboard() {
env: selectedEnv.slug,
setIsKeyAvailable,
setData,
- workspaceId,
+ workspaceId
});
setInitialData(dataToSort);
reorderRows(dataToSort);
- setTimeout(
- () => setIsLoading(false)
- , 700);
+ setTimeout(() => setIsLoading(false), 700);
} catch (error) {
console.log('Error', error);
setData(undefined);
@@ -259,54 +263,41 @@ export default function Dashboard() {
key: '',
value: '',
valueOverride: undefined,
- comment: '',
- },
+ comment: ''
+ }
]);
};
-
- const deleteRow = ({ ids, secretName }: { ids: string[]; secretName: string; }) => {
+ const deleteRow = ({ ids, secretName }: { ids: string[]; secretName: string }) => {
setButtonReady(true);
toggleSidebar('None');
createNotification({
text: `${secretName} has been deleted. Remember to save changes.`,
- type: 'error',
+ type: 'error'
});
sortValuesHandler(
data!.filter((row: SecretDataProps) => !ids.includes(row.id)),
- sortMethod == 'alhpabetical' ? '-alphabetical' : 'alphabetical'
+ sortMethod === 'alhpabetical' ? '-alphabetical' : 'alphabetical'
);
};
const modifyValue = (value: string, pos: number) => {
- setData((oldData) => {
- oldData![pos].value = value;
- return [...oldData!];
- });
+ setData((oldData) => oldData?.map((e, index) => (index === pos ? { ...e, value } : e)));
setButtonReady(true);
};
- const modifyValueOverride = (value: string | undefined, pos: number) => {
- setData((oldData) => {
- oldData![pos].valueOverride = value;
- return [...oldData!];
- });
+ const modifyValueOverride = (valueOverride: string | undefined, pos: number) => {
+ setData((oldData) => oldData?.map((e, index) => (index === pos ? { ...e, valueOverride } : e)));
setButtonReady(true);
};
- const modifyKey = (value: string, pos: number) => {
- setData((oldData) => {
- oldData![pos].key = value;
- return [...oldData!];
- });
+ const modifyKey = (key: string, pos: number) => {
+ setData((oldData) => oldData?.map((e, index) => (index === pos ? { ...e, key } : e)));
setButtonReady(true);
};
- const modifyComment = (value: string, pos: number) => {
- setData((oldData) => {
- oldData![pos].comment = value;
- return [...oldData!];
- });
+ const modifyComment = (comment: string, pos: number) => {
+ setData((oldData) => oldData?.map((e, index) => (index === pos ? { ...e, comment } : e)));
setButtonReady(true);
};
@@ -330,6 +321,7 @@ export default function Dashboard() {
/**
* Save the changes of environment variables and push them to the database
*/
+ // TODO(akhilmhdh): split and make it small
const savePush = async (dataToPush?: SecretDataProps[]) => {
setSaveLoading(true);
let newData: SecretDataProps[] | null | undefined;
@@ -342,82 +334,135 @@ export default function Dashboard() {
// Checking if any of the secret keys start with a number - if so, don't do anything
const nameErrors = !newData!
- .map((secret) => !isNaN(Number(secret.key.charAt(0))))
+ .map((secret) => !Number.isNaN(Number(secret.key.charAt(0))))
.every((v) => v === false);
- const duplicatesExist = findDuplicates(data!.map((item: SecretDataProps) => item.key)).length > 0;
+ const duplicatesExist =
+ findDuplicates(data!.map((item: SecretDataProps) => item.key)).length > 0;
if (nameErrors) {
return createNotification({
text: 'Solve all name errors before saving secrets.',
- type: 'error',
+ type: 'error'
});
}
if (duplicatesExist) {
return createNotification({
text: 'Remove duplicated secret names before saving.',
- type: 'error',
+ type: 'error'
});
}
// Once "Save changes" is clicked, disable that button
setButtonReady(false);
- const secretsToBeDeleted
- = initialData!
- .filter(initDataPoint => !newData!.map(newDataPoint => newDataPoint.id).includes(initDataPoint.id))
- .map(secret => secret.id);
- console.log('delete', secretsToBeDeleted.length)
-
- const secretsToBeAdded
- = newData!
- .filter(newDataPoint => !initialData!.map(initDataPoint => initDataPoint.id).includes(newDataPoint.id));
- console.log('add', secretsToBeAdded.length)
-
- const secretsToBeUpdated
- = newData!.filter(newDataPoint => initialData!
- .filter(initDataPoint => newData!.map(newDataPoint => newDataPoint.id).includes(initDataPoint.id)
- && (newData!.filter(newDataPoint => newDataPoint.id == initDataPoint.id)[0].value != initDataPoint.value
- || newData!.filter(newDataPoint => newDataPoint.id == initDataPoint.id)[0].key != initDataPoint.key
- || newData!.filter(newDataPoint => newDataPoint.id == initDataPoint.id)[0].comment != initDataPoint.comment))
- .map(secret => secret.id).includes(newDataPoint.id));
- console.log('update', secretsToBeUpdated.length)
-
- const newOverrides = newData!.filter(newDataPoint => newDataPoint.valueOverride != undefined)
- const initOverrides = initialData!.filter(initDataPoint => initDataPoint.valueOverride != undefined)
-
- const overridesToBeDeleted
- = initOverrides
- .filter(initDataPoint => !newOverrides!.map(newDataPoint => newDataPoint.id).includes(initDataPoint.id))
- .map(secret => String(secret.idOverride));
- console.log('override delete', overridesToBeDeleted.length)
-
- const overridesToBeAdded
- = newOverrides!
- .filter(newDataPoint => !initOverrides.map(initDataPoint => initDataPoint.id).includes(newDataPoint.id))
- .map(override => ({pos: override.pos, key: override.key, value: String(override.valueOverride), valueOverride: override.valueOverride, comment: '', id: String(override.idOverride), idOverride: String(override.idOverride)}));
- console.log('override add', overridesToBeAdded.length)
-
- const overridesToBeUpdated
- = newOverrides!.filter(newDataPoint => initOverrides
- .filter(initDataPoint => newOverrides!.map(newDataPoint => newDataPoint.id).includes(initDataPoint.id)
- && (newOverrides!.filter(newDataPoint => newDataPoint.id == initDataPoint.id)[0].valueOverride != initDataPoint.valueOverride
- || newOverrides!.filter(newDataPoint => newDataPoint.id == initDataPoint.id)[0].key != initDataPoint.key
- || newOverrides!.filter(newDataPoint => newDataPoint.id == initDataPoint.id)[0].comment != initDataPoint.comment))
- .map(secret => secret.id).includes(newDataPoint.id))
- .map(override => ({pos: override.pos, key: override.key, value: String(override.valueOverride), valueOverride: override.valueOverride, comment: '', id: String(override.idOverride), idOverride: String(override.idOverride)}));
- console.log('override update', overridesToBeUpdated.length)
-
+ const secretsToBeDeleted = initialData!
+ .filter(
+ (initDataPoint) =>
+ !newData!.map((newDataPoint) => newDataPoint.id).includes(initDataPoint.id)
+ )
+ .map((secret) => secret.id);
+ console.log('delete', secretsToBeDeleted.length);
+
+ const secretsToBeAdded = newData!.filter(
+ (newDataPoint) =>
+ !initialData!.map((initDataPoint) => initDataPoint.id).includes(newDataPoint.id)
+ );
+ console.log('add', secretsToBeAdded.length);
+
+ const secretsToBeUpdated = newData!.filter((newDataPoint) =>
+ initialData!
+ .filter(
+ (initDataPoint) =>
+ newData!.map((dataPoint) => dataPoint.id).includes(initDataPoint.id) &&
+ (newData!.filter((dataPoint) => dataPoint.id === initDataPoint.id)[0].value !==
+ initDataPoint.value ||
+ newData!.filter((dataPoint) => dataPoint.id === initDataPoint.id)[0].key !==
+ initDataPoint.key ||
+ newData!.filter((dataPoint) => dataPoint.id === initDataPoint.id)[0].comment !==
+ initDataPoint.comment)
+ )
+ .map((secret) => secret.id)
+ .includes(newDataPoint.id)
+ );
+ console.log('update', secretsToBeUpdated.length);
+
+ const newOverrides = newData!.filter(
+ (newDataPoint) => newDataPoint.valueOverride !== undefined
+ );
+ const initOverrides = initialData!.filter(
+ (initDataPoint) => initDataPoint.valueOverride !== undefined
+ );
+
+ const overridesToBeDeleted = initOverrides
+ .filter(
+ (initDataPoint) =>
+ !newOverrides!.map((newDataPoint) => newDataPoint.id).includes(initDataPoint.id)
+ )
+ .map((secret) => String(secret.idOverride));
+ console.log('override delete', overridesToBeDeleted.length);
+
+ const overridesToBeAdded = newOverrides!
+ .filter(
+ (newDataPoint) =>
+ !initOverrides.map((initDataPoint) => initDataPoint.id).includes(newDataPoint.id)
+ )
+ .map((override) => ({
+ pos: override.pos,
+ key: override.key,
+ value: String(override.valueOverride),
+ valueOverride: override.valueOverride,
+ comment: '',
+ id: String(override.idOverride),
+ idOverride: String(override.idOverride)
+ }));
+ console.log('override add', overridesToBeAdded.length);
+
+ const overridesToBeUpdated = newOverrides!
+ .filter((newDataPoint) =>
+ initOverrides
+ .filter(
+ (initDataPoint) =>
+ newOverrides!.map((dataPoint) => dataPoint.id).includes(initDataPoint.id) &&
+ (newOverrides!.filter((dataPoint) => dataPoint.id === initDataPoint.id)[0]
+ .valueOverride !== initDataPoint.valueOverride ||
+ newOverrides!.filter((dataPoint) => dataPoint.id === initDataPoint.id)[0].key !==
+ initDataPoint.key ||
+ newOverrides!.filter((dataPoint) => dataPoint.id === initDataPoint.id)[0]
+ .comment !== initDataPoint.comment)
+ )
+ .map((secret) => secret.id)
+ .includes(newDataPoint.id)
+ )
+ .map((override) => ({
+ pos: override.pos,
+ key: override.key,
+ value: String(override.valueOverride),
+ valueOverride: override.valueOverride,
+ comment: '',
+ id: String(override.idOverride),
+ idOverride: String(override.idOverride)
+ }));
+ console.log('override update', overridesToBeUpdated.length);
+
if (secretsToBeDeleted.concat(overridesToBeDeleted).length > 0) {
await deleteSecrets({ secretIds: secretsToBeDeleted.concat(overridesToBeDeleted) });
}
if (secretsToBeAdded.concat(overridesToBeAdded).length > 0) {
- const secrets = await encryptSecrets({ secretsToEncrypt: secretsToBeAdded.concat(overridesToBeAdded), workspaceId, env: selectedEnv.slug });
- secrets && await addSecrets({ secrets, env: selectedEnv.slug, workspaceId });
+ const secrets = await encryptSecrets({
+ secretsToEncrypt: secretsToBeAdded.concat(overridesToBeAdded),
+ workspaceId,
+ env: selectedEnv.slug
+ });
+ if (secrets) await addSecrets({ secrets, env: selectedEnv.slug, workspaceId });
}
if (secretsToBeUpdated.concat(overridesToBeUpdated).length > 0) {
- const secrets = await encryptSecrets({ secretsToEncrypt: secretsToBeUpdated.concat(overridesToBeUpdated), workspaceId, env: selectedEnv.slug });
- secrets && await updateSecrets({ secrets });
+ const secrets = await encryptSecrets({
+ secretsToEncrypt: secretsToBeUpdated.concat(overridesToBeUpdated),
+ workspaceId,
+ env: selectedEnv.slug
+ });
+ if (secrets) await updateSecrets({ secrets });
}
setInitialData(structuredClone(newData));
@@ -431,6 +476,7 @@ export default function Dashboard() {
// increasing the number of project commits
setNumSnapshots((numSnapshots ?? 0) + 1);
setSaveLoading(false);
+ return undefined;
};
const addData = (newData: SecretDataProps[]) => {
@@ -442,104 +488,80 @@ export default function Dashboard() {
setBlurred(!blurred);
};
- const sortValuesHandler = (
- dataToSort: SecretDataProps[] | 1,
- specificSortMethod?: 'alphabetical' | '-alphabetical'
- ) => {
- const howToSort =
- specificSortMethod == undefined ? sortMethod : specificSortMethod;
- const sortedData = (dataToSort != 1 ? dataToSort : data)!
- .sort((a, b) =>
- howToSort == 'alphabetical'
- ? a.key.localeCompare(b.key)
- : b.key.localeCompare(a.key)
- )
- .map((item: SecretDataProps, index: number) => {
- return {
- ...item,
- pos: index,
- };
- });
-
- setData(sortedData);
- };
-
- const deleteCertainRow = ({
- ids,
- secretName,
- }: {
- ids: string[];
- secretName: string;
- }) => {
+ const deleteCertainRow = ({ ids, secretName }: { ids: string[]; secretName: string }) => {
deleteRow({ ids, secretName });
};
return data ? (
- <div className='bg-bunker-800 max-h-screen flex flex-col justify-between text-white'>
+ <div className="bg-bunker-800 max-h-screen flex flex-col justify-between text-white">
<Head>
<title>{t('common:head-title', { title: t('dashboard:title') })}</title>
- <link rel='icon' href='/infisical.ico' />
- <meta property='og:image' content='/images/message.png' />
- <meta property='og:title' content={String(t('dashboard:og-title'))} />
- <meta
- name='og:description'
- content={String(t('dashboard:og-description'))}
- />
+ <link rel="icon" href="/infisical.ico" />
+ <meta property="og:image" content="/images/message.png" />
+ <meta property="og:title" content={String(t('dashboard:og-title'))} />
+ <meta name="og:description" content={String(t('dashboard:og-description'))} />
</Head>
<div className="flex flex-row">
- {sidebarSecretId != "None" && <SideBar
- toggleSidebar={toggleSidebar}
- data={data.filter((row: SecretDataProps) => row.key == data.filter(row => row.id == sidebarSecretId)[0]?.key)}
- modifyKey={listenChangeKey}
- modifyValue={listenChangeValue}
- modifyValueOverride={listenChangeValueOverride}
- modifyComment={listenChangeComment}
- buttonReady={buttonReady}
- savePush={savePush}
- sharedToHide={sharedToHide}
- setSharedToHide={setSharedToHide}
- deleteRow={deleteCertainRow}
- />}
- {PITSidebarOpen && <PITRecoverySidebar
- toggleSidebar={togglePITSidebar}
- chosenSnapshot={String(snapshotData?.id ? snapshotData.id : "")}
- setSnapshotData={setSnapshotData}
- />}
+ {sidebarSecretId !== 'None' && (
+ <SideBar
+ toggleSidebar={toggleSidebar}
+ data={data.filter(
+ (row: SecretDataProps) =>
+ row.key === data.filter((r) => r.id === sidebarSecretId)[0]?.key
+ )}
+ modifyKey={listenChangeKey}
+ modifyValue={listenChangeValue}
+ modifyValueOverride={listenChangeValueOverride}
+ modifyComment={listenChangeComment}
+ buttonReady={buttonReady}
+ savePush={savePush}
+ sharedToHide={sharedToHide}
+ setSharedToHide={setSharedToHide}
+ deleteRow={deleteCertainRow}
+ />
+ )}
+ {PITSidebarOpen && (
+ <PITRecoverySidebar
+ toggleSidebar={togglePITSidebar}
+ chosenSnapshot={String(snapshotData?.id ? snapshotData.id : '')}
+ setSnapshotData={setSnapshotData}
+ />
+ )}
<div className="w-full max-h-96 pb-2">
- <NavHeader pageName={t("dashboard:title")} isProjectRelated={true} />
+ <NavHeader pageName={t('dashboard:title')} isProjectRelated />
{checkDocsPopUpVisible && (
<BottonRightPopup
buttonText={t('dashboard:check-docs.button')}
- buttonLink='https://infisical.com/docs/getting-started/introduction'
+ buttonLink="https://infisical.com/docs/getting-started/introduction"
titleText={t('dashboard:check-docs.title')}
- emoji='🎉'
+ emoji="🎉"
textLine1={t('dashboard:check-docs.line1')}
textLine2={t('dashboard:check-docs.line2')}
setCheckDocsPopUpVisible={setCheckDocsPopUpVisible}
/>
)}
- <div className='flex flex-row justify-between items-center mx-6 mt-6 mb-3 text-xl max-w-5xl'>
+ <div className="flex flex-row justify-between items-center mx-6 mt-6 mb-3 text-xl max-w-5xl">
{snapshotData && (
- <div className={`flex justify-start max-w-sm mt-1 mr-2`}>
+ <div className="flex justify-start max-w-sm mt-1 mr-2">
<Button
text={String(t('Go back to current'))}
onButtonPressed={() => setSnapshotData(undefined)}
- color='mineshaft'
- size='md'
+ color="mineshaft"
+ size="md"
icon={faArrowLeft}
/>
</div>
)}
- <div className='flex flex-row justify-start items-center text-3xl'>
- <div className='font-semibold mr-4 mt-1 flex flex-row items-center'>
+ <div className="flex flex-row justify-start items-center text-3xl">
+ <div className="font-semibold mr-4 mt-1 flex flex-row items-center">
<p>{snapshotData ? 'Secret Snapshot' : t('dashboard:title')}</p>
{snapshotData && (
- <span className='bg-primary-800 text-sm ml-4 mt-1 px-1.5 rounded-md'>
+ <span className="bg-primary-800 text-sm ml-4 mt-1 px-1.5 rounded-md">
{new Date(snapshotData.createdAt).toLocaleString()}
</span>
)}
</div>
- {!snapshotData && data?.length == 0 && (
+ {!snapshotData && data?.length === 0 && (
<ListBox
selected={selectedEnv.name}
data={workspaceEnvs.map(({ name }) => name)}
@@ -547,70 +569,76 @@ export default function Dashboard() {
setSelectedEnv(
workspaceEnvs.find(({ name }) => envName === name) || {
name: 'unknown',
- slug: 'unknown',
+ slug: 'unknown'
}
)
}
/>
)}
</div>
- <div className='flex flex-row'>
- <div className={`flex justify-start max-w-sm mt-1 mr-2`}>
+ <div className="flex flex-row">
+ <div className="flex justify-start max-w-sm mt-1 mr-2">
<Button
- text={String(numSnapshots + ' ' + t('Commits'))}
+ text={String(`${numSnapshots} ${t('Commits')}`)}
onButtonPressed={() => togglePITSidebar(true)}
- color='mineshaft'
- size='md'
+ color="mineshaft"
+ size="md"
icon={faClockRotateLeft}
/>
</div>
{(data?.length !== 0 || buttonReady) && !snapshotData && (
- <div className={`flex justify-start max-w-sm mt-1`}>
+ <div className="flex justify-start max-w-sm mt-1">
<Button
text={String(t('common:save-changes'))}
onButtonPressed={savePush}
- color='primary'
- size='md'
+ color="primary"
+ size="md"
active={buttonReady}
iconDisabled={faCheck}
- textDisabled={String(t("common:saved"))}
+ textDisabled={String(t('common:saved'))}
loading={saveLoading}
/>
</div>
)}
- {snapshotData && <div className={`flex justify-start max-w-sm mt-1`}>
- <Button
- text={String(t("Rollback to this snapshot"))}
- onButtonPressed={async () => {
- // Update secrets in the state only for the current environment
- const rolledBackSecrets = snapshotData.secretVersions
- .filter(row => row.environment == selectedEnv.slug)
- .map((sv, position) => {
- return {
- id: sv.id, idOverride: sv.id, pos: position, valueOverride: sv.valueOverride, key: sv.key, value: sv.value, comment: ''
- }
- });
- setData(rolledBackSecrets);
-
- // Perform the rollback globally
- performSecretRollback({ workspaceId, version: snapshotData.version })
-
- setSnapshotData(undefined);
- createNotification({
- text: `Rollback has been performed successfully.`,
- type: 'success'
- });
- }}
- color="primary"
- size="md"
- active={buttonReady}
- />
- </div>}
+ {snapshotData && (
+ <div className="flex justify-start max-w-sm mt-1">
+ <Button
+ text={String(t('Rollback to this snapshot'))}
+ onButtonPressed={async () => {
+ // Update secrets in the state only for the current environment
+ const rolledBackSecrets = snapshotData.secretVersions
+ .filter((row) => row.environment === selectedEnv.slug)
+ .map((sv, position) => ({
+ id: sv.id,
+ idOverride: sv.id,
+ pos: position,
+ valueOverride: sv.valueOverride,
+ key: sv.key,
+ value: sv.value,
+ comment: ''
+ }));
+ setData(rolledBackSecrets);
+
+ // Perform the rollback globally
+ performSecretRollback({ workspaceId, version: snapshotData.version });
+
+ setSnapshotData(undefined);
+ createNotification({
+ text: `Rollback has been performed successfully.`,
+ type: 'success'
+ });
+ }}
+ color="primary"
+ size="md"
+ active={buttonReady}
+ />
+ </div>
+ )}
</div>
</div>
- <div className='mx-6 w-full pr-12'>
- <div className='flex flex-col max-w-5xl pb-1'>
- <div className='w-full flex flex-row items-start'>
+ <div className="mx-6 w-full pr-12">
+ <div className="flex flex-col max-w-5xl pb-1">
+ <div className="w-full flex flex-row items-start">
{(snapshotData || data?.length !== 0) && (
<>
{!snapshotData ? (
@@ -619,11 +647,9 @@ export default function Dashboard() {
data={workspaceEnvs.map(({ name }) => name)}
onChange={(envName) =>
setSelectedEnv(
- workspaceEnvs.find(
- ({ name }) => envName === name
- ) || {
+ workspaceEnvs.find(({ name }) => envName === name) || {
name: 'unknown',
- slug: 'unknown',
+ slug: 'unknown'
}
)
}
@@ -634,71 +660,62 @@ export default function Dashboard() {
data={workspaceEnvs.map(({ name }) => name)}
onChange={(envName) =>
setSelectedSnapshotEnv(
- workspaceEnvs.find(
- ({ name }) => envName === name
- ) || {
+ workspaceEnvs.find(({ name }) => envName === name) || {
name: 'unknown',
- slug: 'unknown',
+ slug: 'unknown'
}
)
}
/>
)}
- <div className='h-10 w-full bg-white/5 hover:bg-white/10 ml-2 flex items-center rounded-md flex flex-row items-center'>
+ <div className="h-10 w-full bg-white/5 hover:bg-white/10 ml-2 rounded-md flex flex-row items-center">
<FontAwesomeIcon
- className='bg-white/5 rounded-l-md py-3 pl-4 pr-2 text-gray-400'
+ className="bg-white/5 rounded-l-md py-3 pl-4 pr-2 text-gray-400"
icon={faMagnifyingGlass}
/>
<input
- className='pl-2 text-gray-400 rounded-r-md bg-white/5 w-full h-full outline-none'
+ className="pl-2 text-gray-400 rounded-r-md bg-white/5 w-full h-full outline-none"
value={searchKeys}
onChange={(e) => setSearchKeys(e.target.value)}
placeholder={String(t('dashboard:search-keys'))}
/>
</div>
{!snapshotData && (
- <div className='ml-2 min-w-max flex flex-row items-start justify-start'>
+ <div className="ml-2 min-w-max flex flex-row items-start justify-start">
<Button
onButtonPressed={() => reorderRows(1)}
- color='mineshaft'
- size='icon-md'
- icon={
- sortMethod == 'alphabetical'
- ? faArrowDownAZ
- : faArrowDownZA
- }
+ color="mineshaft"
+ size="icon-md"
+ icon={sortMethod === 'alphabetical' ? faArrowDownAZ : faArrowDownZA}
/>
</div>
)}
{!snapshotData && (
- <div className='ml-2 min-w-max flex flex-row items-start justify-start'>
- <DownloadSecretMenu
- data={data}
- env={selectedEnv.slug}
- />
+ <div className="ml-2 min-w-max flex flex-row items-start justify-start">
+ <DownloadSecretMenu data={data} env={selectedEnv.slug} />
</div>
)}
- <div className='ml-2 min-w-max flex flex-row items-start justify-start'>
+ <div className="ml-2 min-w-max flex flex-row items-start justify-start">
<Button
onButtonPressed={changeBlurred}
- color='mineshaft'
- size='icon-md'
+ color="mineshaft"
+ size="icon-md"
icon={blurred ? faEye : faEyeSlash}
/>
</div>
{!snapshotData && (
- <div className='relative ml-2 min-w-max flex flex-row items-start justify-end'>
+ <div className="relative ml-2 min-w-max flex flex-row items-start justify-end">
<Button
text={String(t('dashboard:add-key'))}
onButtonPressed={addRow}
- color='mineshaft'
+ color="mineshaft"
icon={faPlus}
- size='md'
+ size="md"
/>
{isNew && (
- <span className='absolute right-0 flex h-3 w-3 items-center justify-center ml-4 mb-4'>
- <span className='animate-ping absolute inline-flex h-full w-full rounded-full bg-primary/50 opacity-75 h-4 w-4'></span>
- <span className='relative inline-flex rounded-full h-3 w-3 bg-primary'></span>
+ <span className="absolute right-0 flex h-3 w-3 items-center justify-center ml-4 mb-4">
+ <span className="animate-ping absolute inline-flex rounded-full bg-primary/50 opacity-75 h-4 w-4" />
+ <span className="relative inline-flex rounded-full h-3 w-3 bg-primary" />
</span>
)}
</div>
@@ -708,75 +725,85 @@ export default function Dashboard() {
</div>
</div>
{isLoading ? (
- <div className='flex items-center justify-center h-full my-48'>
+ <div className="flex items-center justify-center h-full my-48">
<Image
- src='/images/loading/loading.gif'
+ src="/images/loading/loading.gif"
height={60}
width={100}
- alt='infisical loading indicator'
- ></Image>
+ alt="infisical loading indicator"
+ />
</div>
) : data?.length !== 0 ? (
- <div className='flex flex-col w-full mt-1 mb-2'>
- <div
- className={`max-w-5xl mt-1 max-h-[calc(100vh-280px)] overflow-hidden overflow-y-scroll no-scrollbar no-scrollbar::-webkit-scrollbar`}
- >
+ <div className="flex flex-col w-full mt-1 mb-2">
+ <div className="max-w-5xl mt-1 max-h-[calc(100vh-280px)] overflow-hidden overflow-y-scroll no-scrollbar no-scrollbar::-webkit-scrollbar">
<div className="px-1 pt-2 bg-mineshaft-800 rounded-md p-2">
- {!snapshotData && data?.filter(row => row.key?.toUpperCase().includes(searchKeys.toUpperCase()))
- .filter(row => !sharedToHide.includes(row.id)).map((keyPair) => (
- <KeyPair
- key={keyPair.id}
- keyPair={keyPair}
- modifyValue={listenChangeValue}
- modifyValueOverride={listenChangeValueOverride}
- modifyKey={listenChangeKey}
- isBlurred={blurred}
- isDuplicate={findDuplicates(
- data?.map((item) => item.key)
- )?.includes(keyPair.key)}
- toggleSidebar={toggleSidebar}
- sidebarSecretId={sidebarSecretId}
- isSnapshot={false}
- />
- ))}
- {snapshotData && snapshotData.secretVersions?.sort((a, b) => a.key.localeCompare(b.key))
- .filter(row => row.environment == selectedSnapshotEnv?.slug)
- .filter(row => row.key.toUpperCase().includes(searchKeys.toUpperCase()))
- .filter(
- row => !(snapshotData.secretVersions?.filter(row => (snapshotData.secretVersions
- ?.map((item) => item.key)
- .filter(
- (item, index) =>
- index !==
- snapshotData.secretVersions?.map((item) => item.key).indexOf(item)
- ).includes(row.key)))?.map((item) => item.id).includes(row.id))
- )
- .map((keyPair) => (
- <KeyPair
- key={keyPair.id}
- keyPair={keyPair}
- modifyValue={listenChangeValue}
- modifyValueOverride={listenChangeValueOverride}
- modifyKey={listenChangeKey}
- isBlurred={blurred}
- isDuplicate={findDuplicates(
- data?.map((item) => item.key)
- )?.includes(keyPair.key)}
- toggleSidebar={toggleSidebar}
- sidebarSecretId={sidebarSecretId}
- isSnapshot={true}
- />
- ))}
+ {!snapshotData &&
+ data
+ ?.filter((row) => row.key?.toUpperCase().includes(searchKeys.toUpperCase()))
+ .filter((row) => !sharedToHide.includes(row.id))
+ .map((keyPair) => (
+ <KeyPair
+ key={keyPair.id}
+ keyPair={keyPair}
+ modifyValue={listenChangeValue}
+ modifyValueOverride={listenChangeValueOverride}
+ modifyKey={listenChangeKey}
+ isBlurred={blurred}
+ isDuplicate={findDuplicates(data?.map((item) => item.key))?.includes(
+ keyPair.key
+ )}
+ toggleSidebar={toggleSidebar}
+ sidebarSecretId={sidebarSecretId}
+ isSnapshot={false}
+ />
+ ))}
+ {snapshotData &&
+ snapshotData.secretVersions
+ ?.sort((a, b) => a.key.localeCompare(b.key))
+ .filter((row) => row.environment === selectedSnapshotEnv?.slug)
+ .filter((row) => row.key.toUpperCase().includes(searchKeys.toUpperCase()))
+ .filter(
+ (row) =>
+ !snapshotData.secretVersions
+ ?.filter((secretVersion) =>
+ snapshotData.secretVersions
+ ?.map((item) => item.key)
+ .filter(
+ (item, index) =>
+ index !==
+ snapshotData.secretVersions?.map((i) => i.key).indexOf(item)
+ )
+ .includes(secretVersion.key)
+ )
+ ?.map((item) => item.id)
+ .includes(row.id)
+ )
+ .map((keyPair) => (
+ <KeyPair
+ key={keyPair.id}
+ keyPair={keyPair}
+ modifyValue={listenChangeValue}
+ modifyValueOverride={listenChangeValueOverride}
+ modifyKey={listenChangeKey}
+ isBlurred={blurred}
+ isDuplicate={findDuplicates(data?.map((item) => item.key))?.includes(
+ keyPair.key
+ )}
+ toggleSidebar={toggleSidebar}
+ sidebarSecretId={sidebarSecretId}
+ isSnapshot
+ />
+ ))}
</div>
{!snapshotData && (
- <div className='w-full max-w-5xl px-2 pt-3'>
+ <div className="w-full max-w-5xl px-2 pt-3">
<DropZone
setData={addData}
setErrorDragAndDrop={setErrorDragAndDrop}
createNewFile={addRow}
errorDragAndDrop={errorDragAndDrop}
setButtonReady={setButtonReady}
- keysExist={true}
+ keysExist
numCurrentRows={data.length}
/>
</div>
@@ -784,7 +811,7 @@ export default function Dashboard() {
</div>
</div>
) : (
- <div className='flex flex-col items-center justify-center h-full text-xl text-gray-400 max-w-5xl mt-28'>
+ <div className="flex flex-col items-center justify-center h-full text-xl text-gray-400 max-w-5xl mt-28">
{isKeyAvailable && !snapshotData && (
<DropZone
setData={setData}
@@ -798,17 +825,9 @@ export default function Dashboard() {
)}
{!isKeyAvailable && (
<>
- <FontAwesomeIcon
- className='text-7xl mt-20 mb-8'
- icon={faFolderOpen}
- />
- <p>
- To view this file, contact your administrator for
- permission.
- </p>
- <p className='mt-1'>
- They need to grant you access in the team tab.
- </p>
+ <FontAwesomeIcon className="text-7xl mt-20 mb-8" icon={faFolderOpen} />
+ <p>To view this file, contact your administrator for permission.</p>
+ <p className="mt-1">They need to grant you access in the team tab.</p>
</>
)}
</div>
@@ -818,14 +837,9 @@ export default function Dashboard() {
</div>
</div>
) : (
- <div className='relative z-10 w-10/12 mr-auto h-full ml-2 bg-bunker-800 flex flex-col items-center justify-center'>
- <div className='absolute top-0 bg-bunker h-14 border-b border-mineshaft-700 w-full'></div>
- <Image
- src='/images/loading/loading.gif'
- height={70}
- width={120}
- alt='loading animation'
- ></Image>
+ <div className="relative z-10 w-10/12 mr-auto h-full ml-2 bg-bunker-800 flex flex-col items-center justify-center">
+ <div className="absolute top-0 bg-bunker h-14 border-b border-mineshaft-700 w-full" />
+ <Image src="/images/loading/loading.gif" height={70} width={120} alt="loading animation" />
</div>
);
}
diff --git a/frontend/src/pages/email-not-verified.tsx b/frontend/src/pages/email-not-verified.tsx
index 3c634874af..cac631e30f 100644
--- a/frontend/src/pages/email-not-verified.tsx
+++ b/frontend/src/pages/email-not-verified.tsx
@@ -13,8 +13,7 @@ export default function EmailNotFeriviedPage() {
<p className="mt-2 mb-1 text-xl">Your email was not verified. </p>
<p className="text-xl">Please try again.</p>
<p className="text-md mt-8 text-gray-600 max-w-sm text-center">
- Note: If it still {"doesn't work"}, please reach out to us at
+ Note: If it still doesn&apos;t work, please reach out to us at [email protected]
</p>
</div>
</div>
diff --git a/frontend/src/pages/github.tsx b/frontend/src/pages/github.tsx
index 03173b7658..8970272463 100644
--- a/frontend/src/pages/github.tsx
+++ b/frontend/src/pages/github.tsx
@@ -7,8 +7,8 @@ import AuthorizeIntegration from './api/integrations/authorizeIntegration';
export default function Github() {
const router = useRouter();
const parsedUrl = queryString.parse(router.asPath.split('?')[1]);
- const code = parsedUrl.code;
- const state = parsedUrl.state;
+ const {code} = parsedUrl;
+ const {state} = parsedUrl;
/**
* Here we forward to the default workspace if a user opens this url
@@ -25,7 +25,7 @@ export default function Github() {
integration: 'github',
});
router.push(
- '/integrations/' + localStorage.getItem('projectData.id')
+ `/integrations/${ localStorage.getItem('projectData.id')}`
);
}
} catch (error) {
@@ -35,7 +35,7 @@ export default function Github() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
- return <div></div>;
+ return <div />;
}
Github.requireAuth = true;
diff --git a/frontend/src/pages/heroku.tsx b/frontend/src/pages/heroku.tsx
index 0f64bd81b8..ff4f2263e0 100644
--- a/frontend/src/pages/heroku.tsx
+++ b/frontend/src/pages/heroku.tsx
@@ -7,8 +7,8 @@ import AuthorizeIntegration from './api/integrations/authorizeIntegration';
export default function Heroku() {
const router = useRouter();
const parsedUrl = queryString.parse(router.asPath.split('?')[1]);
- const code = parsedUrl.code;
- const state = parsedUrl.state;
+ const {code} = parsedUrl;
+ const {state} = parsedUrl;
/**
* Here we forward to the default workspace if a user opens this url
@@ -25,7 +25,7 @@ export default function Heroku() {
integration: 'heroku',
});
router.push(
- '/integrations/' + localStorage.getItem('projectData.id')
+ `/integrations/${ localStorage.getItem('projectData.id')}`
);
}
} catch (error) {
@@ -35,7 +35,7 @@ export default function Heroku() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
- return <div></div>;
+ return <div />;
}
Heroku.requireAuth = true;
diff --git a/frontend/src/pages/home/[id].tsx b/frontend/src/pages/home/[id].tsx
index 6d3acd3638..0fe52c7ffe 100644
--- a/frontend/src/pages/home/[id].tsx
+++ b/frontend/src/pages/home/[id].tsx
@@ -1,7 +1,8 @@
import { useEffect, useState } from 'react';
import Link from 'next/link';
import { useRouter } from 'next/router';
-import { useTranslation } from "next-i18next";
+import onboardingCheck from '@app/components/utilities/checks/OnboardingCheck';
+import { getTranslatedServerSideProps } from '@app/components/utilities/withTranslateProps';
import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { faSlack } from '@fortawesome/free-brands-svg-icons';
import {
@@ -15,9 +16,6 @@ import {
} from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import onboardingCheck from '~/components/utilities/checks/OnboardingCheck';
-import { getTranslatedServerSideProps } from '~/components/utilities/withTranslateProps';
-
import registerUserAction from '../api/userActions/registerUserAction';
type ItemProps = {
@@ -46,10 +44,14 @@ const learningItem = ({
target={`${link.includes('https') ? '_blank' : '_self'}`}
rel="noopener noreferrer"
className="w-full"
+ href="#"
>
<div
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
onClick={async () => {
- if (userAction && userAction != 'first_time_secrets_pushed') {
+ if (userAction && userAction !== 'first_time_secrets_pushed') {
await registerUserAction({
action: userAction
});
@@ -61,10 +63,7 @@ const learningItem = ({
<FontAwesomeIcon icon={icon} className="text-4xl mx-2 w-16" />
{complete && (
<div className="bg-bunker-700 w-7 h-7 rounded-full absolute left-12 top-10 p-2 flex items-center justify-center">
- <FontAwesomeIcon
- icon={faCheckCircle}
- className="text-4xl w-5 h-5 text-green"
- />
+ <FontAwesomeIcon icon={faCheckCircle} className="text-4xl w-5 h-5 text-green" />
</div>
)}
<div className="flex flex-col items-start">
@@ -73,59 +72,51 @@ const learningItem = ({
</div>
</div>
<div
- className={`pr-4 font-semibold text-sm w-28 text-right ${
- complete && 'text-green'
- }`}
+ className={`pr-4 font-semibold text-sm w-28 text-right ${complete && 'text-green'}`}
>
- {complete ? 'Complete!' : 'About ' + time}
+ {complete ? 'Complete!' : `About ${time}`}
</div>
- {complete && (
- <div className="absolute bottom-0 left-0 h-1 w-full bg-green"></div>
- )}
+ {complete && <div className="absolute bottom-0 left-0 h-1 w-full bg-green" />}
</div>
</a>
</Link>
);
- } else {
- return (
- <div
- onClick={async () => {
- if (userAction) {
- await registerUserAction({
- action: userAction
- });
- }
- }}
- className="relative bg-bunker-700 hover:bg-bunker-500 shadow-xl duration-200 rounded-md border border-dashed border-bunker-400 pl-2 pr-6 py-2 h-[5.5rem] w-full flex items-center justify-between overflow-hidden my-1.5 cursor-pointer"
- >
- <div className="flex flex-row items-center mr-4">
- <FontAwesomeIcon icon={icon} className="text-4xl mx-2 w-16" />
- {complete && (
- <div className="bg-bunker-700 w-7 h-7 rounded-full absolute left-11 top-10">
- <FontAwesomeIcon
- icon={faCheckCircle}
- className="absolute text-4xl left-12 top-16 w-5 h-5 text-green"
- />
- </div>
- )}
- <div className="flex flex-col items-start">
- <div className="text-xl font-semibold mt-0.5">{text}</div>
- <div className="text-sm font-normal mt-0.5">{subText}</div>
- </div>
- </div>
- <div
- className={`pr-4 font-semibold text-sm w-28 text-right ${
- complete && 'text-green'
- }`}
- >
- {complete ? 'Complete!' : 'About ' + time}
- </div>
+ }
+ return (
+ <div
+ onKeyDown={() => null}
+ role="button"
+ tabIndex={0}
+ onClick={async () => {
+ if (userAction) {
+ await registerUserAction({
+ action: userAction
+ });
+ }
+ }}
+ className="relative bg-bunker-700 hover:bg-bunker-500 shadow-xl duration-200 rounded-md border border-dashed border-bunker-400 pl-2 pr-6 py-2 h-[5.5rem] w-full flex items-center justify-between overflow-hidden my-1.5 cursor-pointer"
+ >
+ <div className="flex flex-row items-center mr-4">
+ <FontAwesomeIcon icon={icon} className="text-4xl mx-2 w-16" />
{complete && (
- <div className="absolute bottom-0 left-0 h-1 w-full bg-green"></div>
+ <div className="bg-bunker-700 w-7 h-7 rounded-full absolute left-11 top-10">
+ <FontAwesomeIcon
+ icon={faCheckCircle}
+ className="absolute text-4xl left-12 top-16 w-5 h-5 text-green"
+ />
+ </div>
)}
+ <div className="flex flex-col items-start">
+ <div className="text-xl font-semibold mt-0.5">{text}</div>
+ <div className="text-sm font-normal mt-0.5">{subText}</div>
+ </div>
</div>
- );
- }
+ <div className={`pr-4 font-semibold text-sm w-28 text-right ${complete && 'text-green'}`}>
+ {complete ? 'Complete!' : `About ${time}`}
+ </div>
+ {complete && <div className="absolute bottom-0 left-0 h-1 w-full bg-green" />}
+ </div>
+ );
};
/**
@@ -141,8 +132,6 @@ export default function Home() {
const [hasUserPushedSecrets, setHasUserPushedSecrets] = useState(false);
const [usersInOrg, setUsersInOrg] = useState(false);
- const { t } = useTranslation();
-
useEffect(() => {
onboardingCheck({
setHasUserClickedIntro,
@@ -156,9 +145,7 @@ export default function Home() {
return (
<div className="mx-6 lg:mx-0 w-full overflow-y-scroll pt-20 h-screen">
<div className="flex flex-col items-center text-gray-300 text-lg mx-auto max-w-2xl lg:max-w-3xl xl:max-w-4xl py-6">
- <div className="text-3xl font-bold text-left w-full">
- Your quick start guide
- </div>
+ <div className="text-3xl font-bold text-left w-full">Your quick start guide</div>
<div className="text-md text-left w-full pt-2 pb-4 text-bunker-300">
Click on the items below and follow the instructions.
</div>
@@ -178,12 +165,11 @@ export default function Home() {
icon: faPlus,
time: '2 min',
userAction: 'first_time_secrets_pushed',
- link: '/dashboard/' + router.query.id
+ link: `/dashboard/${router.query.id}`
})}
{learningItem({
text: 'Inject secrets locally',
- subText:
- 'Replace .env files with a more secure an efficient alternative.',
+ subText: 'Replace .env files with a more secure an efficient alternative.',
complete: false,
icon: faNetworkWired,
time: '8 min',
@@ -191,8 +177,7 @@ export default function Home() {
})}
{learningItem({
text: 'Integrate Infisical with your infrastructure',
- subText:
- 'Only a few integrations are currently available. Many more coming soon!',
+ subText: 'Only a few integrations are currently available. Many more coming soon!',
complete: false,
icon: faPlug,
time: '15 min',
@@ -204,7 +189,7 @@ export default function Home() {
complete: usersInOrg,
icon: faUserPlus,
time: '2 min',
- link: '/settings/org/' + router.query.id + '?invite'
+ link: `/settings/org/${router.query.id}?invite`
})}
{learningItem({
text: 'Join Infisical Slack',
@@ -231,4 +216,4 @@ export default function Home() {
Home.requireAuth = true;
-export const getServerSideProps = getTranslatedServerSideProps(["home"]);
+export const getServerSideProps = getTranslatedServerSideProps(['home']);
diff --git a/frontend/src/pages/index.tsx b/frontend/src/pages/index.tsx
index f1412e16c6..615393cbd4 100644
--- a/frontend/src/pages/index.tsx
+++ b/frontend/src/pages/index.tsx
@@ -9,5 +9,5 @@ export default function Home() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
- return <div className="bg-bunker-800 w-screen"></div>;
+ return <div className="bg-bunker-800 w-screen" />;
}
diff --git a/frontend/src/pages/integrations/[id].tsx b/frontend/src/pages/integrations/[id].tsx
index 697597ede8..c9ede39e39 100644
--- a/frontend/src/pages/integrations/[id].tsx
+++ b/frontend/src/pages/integrations/[id].tsx
@@ -4,18 +4,17 @@ import { useEffect, useState } from 'react';
import Head from 'next/head';
import { useRouter } from 'next/router';
import { useTranslation } from 'next-i18next';
+import ActivateBotDialog from '@app/components/basic/dialog/ActivateBotDialog';
+import CloudIntegrationSection from '@app/components/integrations/CloudIntegrationSection';
+import FrameworkIntegrationSection from '@app/components/integrations/FrameworkIntegrationSection';
+import IntegrationSection from '@app/components/integrations/IntegrationSection';
+import NavHeader from '@app/components/navigation/NavHeader';
+import { getTranslatedServerSideProps } from '@app/components/utilities/withTranslateProps';
import frameworkIntegrationOptions from 'public/json/frameworkIntegrations.json';
-import ActivateBotDialog from '~/components/basic/dialog/ActivateBotDialog';
-import CloudIntegrationSection from '~/components/integrations/CloudIntegrationSection';
-import FrameworkIntegrationSection from '~/components/integrations/FrameworkIntegrationSection';
-import IntegrationSection from '~/components/integrations/IntegrationSection';
-import NavHeader from '~/components/navigation/NavHeader';
-import { getTranslatedServerSideProps } from '~/utilities/withTranslateProps';
-
import {
decryptAssymmetric,
- encryptAssymmetric,
+ encryptAssymmetric
} from '../../components/utilities/cryptography/crypto';
import getBot from '../api/bot/getBot';
import setBotActiveStatus from '../api/bot/setBotActiveStatus';
@@ -39,8 +38,7 @@ export default function Integrations() {
const [bot, setBot] = useState<any>(null);
const [isActivateBotDialogOpen, setIsActivateBotDialogOpen] = useState(false);
// const [isIntegrationAccessTokenDialogOpen, setIntegrationAccessTokenDialogOpen] = useState(true);
- const [selectedIntegrationOption, setSelectedIntegrationOption] =
- useState(null);
+ const [selectedIntegrationOption, setSelectedIntegrationOption] = useState(null);
const router = useRouter();
const workspaceId = router.query.id as string;
@@ -59,14 +57,14 @@ export default function Integrations() {
// get project integration authorizations
setIntegrationAuths(
await getWorkspaceAuthorizations({
- workspaceId,
+ workspaceId
})
);
// get project integrations
setIntegrations(
await getWorkspaceIntegrations({
- workspaceId,
+ workspaceId
})
);
@@ -101,26 +99,26 @@ export default function Integrations() {
ciphertext: key.latestKey.encryptedKey,
nonce: key.latestKey.nonce,
publicKey: key.latestKey.sender.publicKey,
- privateKey: PRIVATE_KEY,
+ privateKey: PRIVATE_KEY
});
const { ciphertext, nonce } = encryptAssymmetric({
plaintext: WORKSPACE_KEY,
publicKey: bot.publicKey,
- privateKey: PRIVATE_KEY,
+ privateKey: PRIVATE_KEY
});
botKey = {
encryptedKey: ciphertext,
- nonce,
+ nonce
};
setBot(
(
await setBotActiveStatus({
botId: bot._id,
- isActive: bot.isActive ? false : true,
- botKey,
+ isActive: !bot.isActive,
+ botKey
})
).bot
);
@@ -139,11 +137,7 @@ export default function Integrations() {
* @param {String} obj.docsLink
* @returns
*/
- const handleIntegrationOption = async ({
- integrationOption,
- }: {
- integrationOption: any;
- }) => {
+ const handleIntegrationOption = async ({ integrationOption }: { integrationOption: any }) => {
try {
// generate CSRF token for OAuth2 code-token exchange integrations
const state = crypto.randomBytes(16).toString('hex');
@@ -170,6 +164,8 @@ export default function Integrations() {
`https://github.com/login/oauth/authorize?client_id=${integrationOption.clientId}&response_type=code&scope=repo&redirect_uri=${window.location.origin}/github&state=${state}`
);
break;
+ default:
+ break;
// case 'Fly.io':
// console.log('fly.io');
// setIntegrationAccessTokenDialogOpen(true);
@@ -205,21 +201,16 @@ export default function Integrations() {
};
return (
- <div className='bg-bunker-800 max-h-screen flex flex-col justify-between text-white'>
+ <div className="bg-bunker-800 max-h-screen flex flex-col justify-between text-white">
<Head>
- <title>
- {t('common:head-title', { title: t('integrations:title') })}
- </title>
- <link rel='icon' href='/infisical.ico' />
- <meta property='og:image' content='/images/message.png' />
- <meta property='og:title' content='Manage your .env files in seconds' />
- <meta
- name='og:description'
- content={t('integrations:description') as string}
- />
+ <title>{t('common:head-title', { title: t('integrations:title') })}</title>
+ <link rel="icon" href="/infisical.ico" />
+ <meta property="og:image" content="/images/message.png" />
+ <meta property="og:title" content="Manage your .env files in seconds" />
+ <meta name="og:description" content={t('integrations:description') as string} />
</Head>
- <div className='w-full pb-2 h-screen max-h-[calc(100vh-10px)] overflow-y-scroll no-scrollbar no-scrollbar::-webkit-scrollbar'>
- <NavHeader pageName={t('integrations:title')} isProjectRelated={true} />
+ <div className="w-full pb-2 h-screen max-h-[calc(100vh-10px)] overflow-y-scroll no-scrollbar no-scrollbar::-webkit-scrollbar">
+ <NavHeader pageName={t('integrations:title')} isProjectRelated />
<ActivateBotDialog
isOpen={isActivateBotDialogOpen}
closeModal={() => setIsActivateBotDialogOpen(false)}
@@ -234,10 +225,7 @@ export default function Integrations() {
handleBotActivate={handleBotActivate}
handleIntegrationOption={handleIntegrationOption}
/> */}
- <IntegrationSection
- integrations={integrations}
- environments={environments}
- />
+ <IntegrationSection integrations={integrations} environments={environments} />
{cloudIntegrationOptions.length > 0 && bot ? (
<CloudIntegrationSection
cloudIntegrationOptions={cloudIntegrationOptions}
@@ -246,11 +234,9 @@ export default function Integrations() {
integrationAuths={integrationAuths}
/>
) : (
- <div></div>
+ <div />
)}
- <FrameworkIntegrationSection
- frameworks={frameworkIntegrationOptions as any}
- />
+ <FrameworkIntegrationSection frameworks={frameworkIntegrationOptions as any} />
</div>
</div>
);
@@ -258,6 +244,4 @@ export default function Integrations() {
Integrations.requireAuth = true;
-export const getServerSideProps = getTranslatedServerSideProps([
- 'integrations',
-]);
+export const getServerSideProps = getTranslatedServerSideProps(['integrations']);
diff --git a/frontend/src/pages/login.tsx b/frontend/src/pages/login.tsx
index 929c1fdb09..114d379e83 100644
--- a/frontend/src/pages/login.tsx
+++ b/frontend/src/pages/login.tsx
@@ -1,33 +1,32 @@
-import { useEffect, useState } from "react";
-import Head from "next/head";
-import Image from "next/image";
-import Link from "next/link";
-import { useRouter } from "next/router";
-import { useTranslation } from "next-i18next";
-import { faWarning } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { useEffect, useState } from 'react';
+import Head from 'next/head';
+import Image from 'next/image';
+import Link from 'next/link';
+import { useRouter } from 'next/router';
+import { useTranslation } from 'next-i18next';
+import Button from '@app/components/basic/buttons/Button';
+import Error from '@app/components/basic/Error';
+import InputField from '@app/components/basic/InputField';
+import ListBox from '@app/components/basic/Listbox';
+import attemptLogin from '@app/components/utilities/attemptLogin';
+import { getTranslatedStaticProps } from '@app/components/utilities/withTranslateProps';
+import { faWarning } from '@fortawesome/free-solid-svg-icons';
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import Button from "~/components/basic/buttons/Button";
-import Error from "~/components/basic/Error";
-import InputField from "~/components/basic/InputField";
-import ListBox from "~/components/basic/Listbox";
-import { getTranslatedStaticProps } from "~/components/utilities/withTranslateProps";
-import attemptLogin from "~/utilities/attemptLogin";
-
-import getWorkspaces from "./api/workspace/getWorkspaces";
+import getWorkspaces from './api/workspace/getWorkspaces';
export default function Login() {
- const [email, setEmail] = useState("");
- const [password, setPassword] = useState("");
+ const [email, setEmail] = useState('');
+ const [password, setPassword] = useState('');
const [errorLogin, setErrorLogin] = useState(false);
const [isLoading, setIsLoading] = useState(false);
const router = useRouter();
const { t } = useTranslation();
- const lang = router.locale ?? "en";
+ const lang = router.locale ?? 'en';
const setLanguage = async (to: string) => {
- router.push("/login", "/login", { locale: to });
- localStorage.setItem("lang", to);
+ router.push('/login', '/login', { locale: to });
+ localStorage.setItem('lang', to);
};
useEffect(() => {
@@ -36,9 +35,9 @@ export default function Login() {
try {
const userWorkspaces = await getWorkspaces();
userWorkspace = userWorkspaces[0]._id;
- router.push("/dashboard/" + userWorkspace);
+ router.push(`/dashboard/${userWorkspace}`);
} catch (error) {
- console.log("Error - Not logged in yet");
+ console.log('Error - Not logged in yet');
}
};
redirectToDashboard();
@@ -53,15 +52,8 @@ export default function Login() {
}
setIsLoading(true);
- await attemptLogin(
- email,
- password,
- setErrorLogin,
- router,
- false,
- true
- ).then(() => {
- setTimeout(function () {
+ await attemptLogin(email, password, setErrorLogin, router, false, true).then(() => {
+ setTimeout(() => {
setIsLoading(false);
}, 2000);
});
@@ -70,33 +62,25 @@ export default function Login() {
return (
<div className="bg-bunker-800 h-screen flex flex-col justify-start px-6">
<Head>
- <title>{t("common:head-title", { title: t("login:title") })}</title>
+ <title>{t('common:head-title', { title: t('login:title') })}</title>
<link rel="icon" href="/infisical.ico" />
<meta property="og:image" content="/images/message.png" />
- <meta property="og:title" content={t("login:og-title") ?? ""} />
- <meta name="og:description" content={t("login:og-description") ?? ""} />
+ <meta property="og:title" content={t('login:og-title') ?? ''} />
+ <meta name="og:description" content={t('login:og-description') ?? ''} />
</Head>
<Link href="/">
<div className="flex justify-center mb-8 mt-20 cursor-pointer">
- <Image
- src="/images/biglogo.png"
- height={90}
- width={120}
- alt="long logo"
- />
+ <Image src="/images/biglogo.png" height={90} width={120} alt="long logo" />
</div>
</Link>
- <form
- onChange={() => setErrorLogin(false)}
- onSubmit={(e) => e.preventDefault()}
- >
+ <form onChange={() => setErrorLogin(false)} onSubmit={(e) => e.preventDefault()}>
<div className="bg-bunker w-full max-w-md mx-auto h-7/12 py-4 pt-8 px-6 rounded-xl drop-shadow-xl">
<p className="text-3xl w-max mx-auto flex justify-center font-semibold text-bunker-100 mb-6">
- {t("login:login")}
+ {t('login:login')}
</p>
<div className="flex items-center justify-center w-full md:p-2 rounded-lg mt-4 md:mt-0 max-h-24 md:max-h-28">
<InputField
- label={t("common:email")}
+ label={t('common:email')}
onChangeHandler={setEmail}
type="email"
value={email}
@@ -107,7 +91,7 @@ export default function Login() {
</div>
<div className="relative flex items-center justify-center w-full md:p-2 rounded-lg md:mt-2 mt-6 max-h-24 md:max-h-28">
<InputField
- label={t("common:password")}
+ label={t('common:password')}
onChangeHandler={setPassword}
type="password"
value={password}
@@ -118,20 +102,21 @@ export default function Login() {
/>
<div className="absolute top-2 right-3 text-primary-700 hover:text-primary duration-200 cursor-pointer text-sm">
<Link href="/verify-email">
- <button className="text-primary-700 hover:text-primary duration-200 font-normal text-sm underline-offset-4 ml-1.5">
- {t("login:forgot-password")}
+ <button
+ type="button"
+ className="text-primary-700 hover:text-primary duration-200 font-normal text-sm underline-offset-4 ml-1.5"
+ >
+ {t('login:forgot-password')}
</button>
</Link>
</div>
</div>
- {!isLoading && errorLogin && (
- <Error text={t("login:error-login") ?? ""} />
- )}
+ {!isLoading && errorLogin && <Error text={t('login:error-login') ?? ''} />}
<div className="flex flex-col items-center justify-center w-full md:p-2 max-h-20 max-w-md mt-4 mx-auto text-sm">
<div className="text-l mt-6 m-8 px-8 py-3 text-lg">
<Button
type="submit"
- text={t("login:login") ?? ""}
+ text={t('login:login') ?? ''}
onButtonPressed={loginCheck}
loading={isLoading}
size="lg"
@@ -145,16 +130,19 @@ export default function Login() {
{false && (
<div className="w-full p-2 flex flex-row items-center bg-white/10 text-gray-300 rounded-md max-w-md mx-auto mt-4">
<FontAwesomeIcon icon={faWarning} className="ml-2 mr-6 text-6xl" />
- {t("common:maintenance-alert")}
+ {t('common:maintenance-alert')}
</div>
)}
<div className="flex flex-row items-center justify-center md:pb-4 mt-4">
<p className="text-sm flex justify-center text-gray-400 w-max">
- {t("login:need-account")}
+ {t('login:need-account')}
</p>
<Link href="/signup">
- <button className="text-primary-700 hover:text-primary duration-200 font-normal text-sm underline-offset-4 ml-1.5">
- {t("login:create-account")}
+ <button
+ type="button"
+ className="text-primary-700 hover:text-primary duration-200 font-normal text-sm underline-offset-4 ml-1.5"
+ >
+ {t('login:create-account')}
</button>
</Link>
</div>
@@ -164,9 +152,9 @@ export default function Login() {
<ListBox
selected={lang}
onChange={setLanguage}
- data={["en", "ko", "fr", "pt-BR"]}
+ data={['en', 'ko', 'fr', 'pt-BR']}
isFull
- text={`${t("common:language")}: `}
+ text={`${t('common:language')}: `}
/>
</div>
</div>
@@ -174,4 +162,4 @@ export default function Login() {
);
}
-export const getStaticProps = getTranslatedStaticProps(["auth", "login"]);
+export const getStaticProps = getTranslatedStaticProps(['auth', 'login']);
diff --git a/frontend/src/pages/netlify.tsx b/frontend/src/pages/netlify.tsx
index ef92c19b6e..532d6044ac 100644
--- a/frontend/src/pages/netlify.tsx
+++ b/frontend/src/pages/netlify.tsx
@@ -7,8 +7,8 @@ import AuthorizeIntegration from './api/integrations/authorizeIntegration';
export default function Netlify() {
const router = useRouter();
const parsedUrl = queryString.parse(router.asPath.split('?')[1]);
- const code = parsedUrl.code;
- const state = parsedUrl.state;
+ const {code} = parsedUrl;
+ const {state} = parsedUrl;
// modify comment here
/**
@@ -30,7 +30,7 @@ export default function Netlify() {
});
router.push(
- '/integrations/' + localStorage.getItem('projectData.id')
+ `/integrations/${ localStorage.getItem('projectData.id')}`
);
}
} catch (err) {
@@ -40,7 +40,7 @@ export default function Netlify() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
- return <div></div>;
+ return <div />;
}
Netlify.requireAuth = true;
diff --git a/frontend/src/pages/noprojects.tsx b/frontend/src/pages/noprojects.tsx
index 5d3073f974..1e2f1737e3 100644
--- a/frontend/src/pages/noprojects.tsx
+++ b/frontend/src/pages/noprojects.tsx
@@ -1,9 +1,8 @@
import { useEffect } from 'react';
import Image from 'next/image';
import { useRouter } from 'next/router';
-
-import Button from '~/components/basic/buttons/Button';
-import { getTranslatedServerSideProps } from '~/utilities/withTranslateProps';
+import Button from '@app/components/basic/buttons/Button';
+import { getTranslatedServerSideProps } from '@app/components/utilities/withTranslateProps';
import getWorkspaces from './api/workspace/getWorkspaces';
@@ -13,38 +12,33 @@ export default function NoProjects() {
const redirectUser = async () => {
const workspaces = await getWorkspaces();
if (workspaces.length > 0) {
- router.push('/dashboard/' + workspaces[0]._id);
+ router.push(`/dashboard/${workspaces[0]._id}`);
}
- }
+ };
useEffect(() => {
// on initial load - run auth check
(async () => {
- await redirectUser()
+ await redirectUser();
})();
}, []);
return (
- <div className='h-full flex flex-col items-center justify-center text-gray-300 text-lg text-center w-11/12 mr-auto'>
- <div className='mb-6 mt-16 mr-16'>
- <Image
- src='/images/dragon-cant-find.svg'
- height={270}
- width={436}
- alt='google logo'
- ></Image>
+ <div className="h-full flex flex-col items-center justify-center text-gray-300 text-lg text-center w-11/12 mr-auto">
+ <div className="mb-6 mt-16 mr-16">
+ <Image src="/images/dragon-cant-find.svg" height={270} width={436} alt="google logo" />
</div>
- <div className='px-4 rounded-md bg-bunker-500 mb-8 text-bunker-300 shadow-xl py-6'>
- <div className='max-w-md'>
- You are not part of any projects in this organization yet. When you
- do, they will appear here.
+ <div className="px-4 rounded-md bg-bunker-500 mb-8 text-bunker-300 shadow-xl py-6">
+ <div className="max-w-md">
+ You are not part of any projects in this organization yet. When you do, they will appear
+ here.
</div>
- <div className='max-w-md mt-4'>
- Create a new project, or ask other organization members to give you
- neccessary permissions.
+ <div className="max-w-md mt-4">
+ Create a new project, or ask other organization members to give you neccessary
+ permissions.
</div>
- <div className='mt-6 mx-2'>
- <Button text="Check again" onButtonPressed={redirectUser} size="md" color="mineshaft"/>
+ <div className="mt-6 mx-2">
+ <Button text="Check again" onButtonPressed={redirectUser} size="md" color="mineshaft" />
</div>
</div>
</div>
diff --git a/frontend/src/pages/password-reset.tsx b/frontend/src/pages/password-reset.tsx
index dfb5e01abd..beb2b7816a 100644
--- a/frontend/src/pages/password-reset.tsx
+++ b/frontend/src/pages/password-reset.tsx
@@ -1,21 +1,21 @@
import { useState } from 'react';
import Image from 'next/image';
import { useRouter } from 'next/router';
+import Button from '@app/components/basic/buttons/Button';
+import InputField from '@app/components/basic/InputField';
+import passwordCheck from '@app/components/utilities/checks/PasswordCheck';
+import Aes256Gcm from '@app/components/utilities/cryptography/aes-256-gcm';
+import { getTranslatedStaticProps } from '@app/components/utilities/withTranslateProps';
import { faCheck, faX } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import jsrp from 'jsrp';
import queryString from 'query-string';
-import Button from '~/components/basic/buttons/Button';
-import InputField from '~/components/basic/InputField';
-import passwordCheck from '~/components/utilities/checks/PasswordCheck';
-import Aes256Gcm from '~/components/utilities/cryptography/aes-256-gcm';
-import { getTranslatedStaticProps } from '~/components/utilities/withTranslateProps';
-
import EmailVerifyOnPasswordReset from './api/auth/EmailVerifyOnPasswordReset';
import getBackupEncryptedPrivateKey from './api/auth/getBackupEncryptedPrivateKey';
import resetPasswordOnAccountRecovery from './api/auth/resetPasswordOnAccountRecovery';
+// eslint-disable-next-line new-cap
const client = new jsrp.client();
export default function PasswordReset() {
@@ -43,7 +43,7 @@ export default function PasswordReset() {
ciphertext: result.encryptedPrivateKey,
iv: result.iv,
tag: result.tag,
- secret: backupKey,
+ secret: backupKey
})
);
setStep(3);
@@ -59,7 +59,7 @@ export default function PasswordReset() {
setPasswordErrorLength,
setPasswordErrorNumber,
setPasswordErrorLowerCase,
- errorCheck: false,
+ errorCheck: false
});
if (!errorCheck) {
@@ -68,36 +68,30 @@ export default function PasswordReset() {
text: privateKey,
secret: newPassword
.slice(0, 32)
- .padStart(
- 32 +
- (newPassword.slice(0, 32).length - new Blob([newPassword]).size),
- '0'
- ),
+ .padStart(32 + (newPassword.slice(0, 32).length - new Blob([newPassword]).size), '0')
}) as { ciphertext: string; iv: string; tag: string };
client.init(
{
username: email,
- password: newPassword,
+ password: newPassword
},
async () => {
- client.createVerifier(
- async (err: any, result: { salt: string; verifier: string }) => {
- const response = await resetPasswordOnAccountRecovery({
- verificationToken,
- encryptedPrivateKey: ciphertext,
- iv,
- tag,
- salt: result.salt,
- verifier: result.verifier,
- });
+ client.createVerifier(async (err: any, result: { salt: string; verifier: string }) => {
+ const response = await resetPasswordOnAccountRecovery({
+ verificationToken,
+ encryptedPrivateKey: ciphertext,
+ iv,
+ tag,
+ salt: result.salt,
+ verifier: result.verifier
+ });
- // if everything works, go the main dashboard page.
- if (response?.status === 200) {
- router.push('/login');
- }
+ // if everything works, go the main dashboard page.
+ if (response?.status === 200) {
+ router.push('/login');
}
- );
+ });
}
);
}
@@ -105,25 +99,20 @@ export default function PasswordReset() {
// Click a button to confirm email
const stepConfirmEmail = (
- <div className='bg-bunker flex flex-col items-center w-full py-6 max-w-xs md:max-w-lg mx-auto my-32 px-4 md:px-6 mx-1 rounded-xl drop-shadow-xl'>
- <p className='text-4xl text-center font-semibold mb-8 flex justify-center text-transparent bg-clip-text bg-gradient-to-br from-sky-400 to-primary'>
+ <div className="bg-bunker flex flex-col items-center w-full py-6 max-w-xs md:max-w-lg my-32 px-4 md:px-6 mx-1 rounded-xl drop-shadow-xl">
+ <p className="text-4xl text-center font-semibold mb-8 flex justify-center text-transparent bg-clip-text bg-gradient-to-br from-sky-400 to-primary">
Confirm your email
</p>
- <Image
- src='/images/envelope.svg'
- height={262}
- width={410}
- alt='verify email'
- ></Image>
- <div className='flex flex-col items-center justify-center md:p-2 max-h-24 max-w-md mx-auto text-lg px-4 mt-4 mb-2'>
+ <Image src="/images/envelope.svg" height={262} width={410} alt="verify email" />
+ <div className="flex flex-col items-center justify-center md:p-2 max-h-24 max-w-md mx-auto text-lg px-4 mt-4 mb-2">
<Button
- text='Confirm Email'
+ text="Confirm Email"
onButtonPressed={async () => {
const response = await EmailVerifyOnPasswordReset({
email,
- code: token,
+ code: token
});
- if (response.status == 200) {
+ if (response.status === 200) {
setVerificationToken((await response.json()).token);
setStep(2);
} else {
@@ -131,7 +120,7 @@ export default function PasswordReset() {
router.push('/email-not-verified');
}
}}
- size='lg'
+ size="lg"
/>
</div>
</div>
@@ -139,34 +128,33 @@ export default function PasswordReset() {
// Input backup key
const stepInputBackupKey = (
- <div className='bg-bunker flex flex-col items-center w-full pt-6 pb-3 max-w-xs md:max-w-lg mx-auto my-32 px-4 md:px-6 mx-1 rounded-xl drop-shadow-xl'>
- <p className='text-2xl md:text-3xl w-max mx-auto flex justify-center font-semibold text-bunker-100 mb-4'>
+ <div className="bg-bunker flex flex-col items-center w-full pt-6 pb-3 max-w-xs md:max-w-lg my-32 px-4 md:px-6 mx-1 rounded-xl drop-shadow-xl">
+ <p className="text-2xl md:text-3xl w-max mx-auto flex justify-center font-semibold text-bunker-100 mb-4">
Enter your backup key
</p>
- <div className='flex flex-row items-center justify-center md:pb-4 mt-4 md:mx-2'>
- <p className='text-sm flex justify-center text-gray-400 w-max max-w-md'>
- You can find it in your emrgency kit. You had to download the enrgency
- kit during signup.
+ <div className="flex flex-row items-center justify-center md:pb-4 mt-4 md:mx-2">
+ <p className="text-sm flex justify-center text-gray-400 w-max max-w-md">
+ You can find it in your emrgency kit. You had to download the enrgency kit during signup.
</p>
</div>
- <div className='flex items-center justify-center w-full md:p-2 rounded-lg mt-4 md:mt-0 max-h-24 md:max-h-28'>
+ <div className="flex items-center justify-center w-full md:p-2 rounded-lg mt-4 md:mt-0 max-h-24 md:max-h-28">
<InputField
- label='Backup Key'
+ label="Backup Key"
onChangeHandler={setBackupKey}
- type='password'
+ type="password"
value={backupKey}
- placeholder=''
+ placeholder=""
isRequired
error={backupKeyError}
- errorText='Something is wrong with the backup key'
+ errorText="Something is wrong with the backup key"
/>
</div>
- <div className='flex flex-col items-center justify-center w-full md:p-2 max-h-20 max-w-md mt-4 mx-auto text-sm'>
- <div className='text-l mt-6 m-8 px-8 py-3 text-lg'>
+ <div className="flex flex-col items-center justify-center w-full md:p-2 max-h-20 max-w-md mt-4 mx-auto text-sm">
+ <div className="text-l mt-6 m-8 px-8 py-3 text-lg">
<Button
- text='Submit Backup Key'
+ text="Submit Backup Key"
onButtonPressed={() => getEncryptedKeyHandler()}
- size='lg'
+ size="lg"
/>
</div>
</div>
@@ -175,18 +163,18 @@ export default function PasswordReset() {
// Enter new password
const stepEnterNewPassword = (
- <div className='bg-bunker flex flex-col items-center w-full pt-6 pb-3 max-w-xs md:max-w-lg mx-auto my-32 px-4 md:px-6 mx-1 rounded-xl drop-shadow-xl'>
- <p className='text-2xl md:text-3xl w-max mx-auto flex justify-center font-semibold text-bunker-100'>
+ <div className="bg-bunker flex flex-col items-center w-full pt-6 pb-3 max-w-xs md:max-w-lg my-32 px-4 md:px-6 mx-1 rounded-xl drop-shadow-xl">
+ <p className="text-2xl md:text-3xl w-max mx-auto flex justify-center font-semibold text-bunker-100">
Enter new password
</p>
- <div className='flex flex-row items-center justify-center md:pb-4 mt-1 md:mx-2'>
- <p className='text-sm flex justify-center text-gray-400 w-max max-w-md'>
+ <div className="flex flex-row items-center justify-center md:pb-4 mt-1 md:mx-2">
+ <p className="text-sm flex justify-center text-gray-400 w-max max-w-md">
Make sure you save it somewhere save.
</p>
</div>
- <div className='flex items-center justify-center w-full md:p-2 rounded-lg mt-4 md:mt-0 max-h-24 md:max-h-28'>
+ <div className="flex items-center justify-center w-full md:p-2 rounded-lg mt-4 md:mt-0 max-h-24 md:max-h-28">
<InputField
- label='New Password'
+ label="New Password"
onChangeHandler={(password) => {
setNewPassword(password);
passwordCheck({
@@ -194,85 +182,62 @@ export default function PasswordReset() {
setPasswordErrorLength,
setPasswordErrorNumber,
setPasswordErrorLowerCase,
- errorCheck: false,
+ errorCheck: false
});
}}
- type='password'
+ type="password"
value={newPassword}
isRequired
- error={
- passwordErrorLength && passwordErrorLowerCase && passwordErrorNumber
- }
- autoComplete='new-password'
- id='new-password'
+ error={passwordErrorLength && passwordErrorLowerCase && passwordErrorNumber}
+ autoComplete="new-password"
+ id="new-password"
/>
</div>
{passwordErrorLength || passwordErrorLowerCase || passwordErrorNumber ? (
- <div className='w-full mt-3 bg-white/5 px-2 mx-2 flex flex-col items-start py-2 rounded-md max-w-md mb-2'>
- <div className={`text-gray-400 text-sm mb-1`}>
- Password should contain at least:
- </div>
- <div className='flex flex-row justify-start items-center ml-1'>
+ <div className="w-full mt-3 bg-white/5 px-2 mx-2 flex flex-col items-start py-2 rounded-md max-w-md mb-2">
+ <div className="text-gray-400 text-sm mb-1">Password should contain at least:</div>
+ <div className="flex flex-row justify-start items-center ml-1">
{passwordErrorLength ? (
- <FontAwesomeIcon icon={faX} className='text-md text-red mr-2.5' />
+ <FontAwesomeIcon icon={faX} className="text-md text-red mr-2.5" />
) : (
- <FontAwesomeIcon
- icon={faCheck}
- className='text-md text-primary mr-2'
- />
+ <FontAwesomeIcon icon={faCheck} className="text-md text-primary mr-2" />
)}
- <div
- className={`${
- passwordErrorLength ? 'text-gray-400' : 'text-gray-600'
- } text-sm`}
- >
+ <div className={`${passwordErrorLength ? 'text-gray-400' : 'text-gray-600'} text-sm`}>
14 characters
</div>
</div>
- <div className='flex flex-row justify-start items-center ml-1'>
+ <div className="flex flex-row justify-start items-center ml-1">
{passwordErrorLowerCase ? (
- <FontAwesomeIcon icon={faX} className='text-md text-red mr-2.5' />
+ <FontAwesomeIcon icon={faX} className="text-md text-red mr-2.5" />
) : (
- <FontAwesomeIcon
- icon={faCheck}
- className='text-md text-primary mr-2'
- />
+ <FontAwesomeIcon icon={faCheck} className="text-md text-primary mr-2" />
)}
<div
- className={`${
- passwordErrorLowerCase ? 'text-gray-400' : 'text-gray-600'
- } text-sm`}
+ className={`${passwordErrorLowerCase ? 'text-gray-400' : 'text-gray-600'} text-sm`}
>
1 lowercase character
</div>
</div>
- <div className='flex flex-row justify-start items-center ml-1'>
+ <div className="flex flex-row justify-start items-center ml-1">
{passwordErrorNumber ? (
- <FontAwesomeIcon icon={faX} className='text-md text-red mr-2.5' />
+ <FontAwesomeIcon icon={faX} className="text-md text-red mr-2.5" />
) : (
- <FontAwesomeIcon
- icon={faCheck}
- className='text-md text-primary mr-2'
- />
+ <FontAwesomeIcon icon={faCheck} className="text-md text-primary mr-2" />
)}
- <div
- className={`${
- passwordErrorNumber ? 'text-gray-400' : 'text-gray-600'
- } text-sm`}
- >
+ <div className={`${passwordErrorNumber ? 'text-gray-400' : 'text-gray-600'} text-sm`}>
1 number
</div>
</div>
</div>
) : (
- <div className='py-2'></div>
+ <div className="py-2" />
)}
- <div className='flex flex-col items-center justify-center w-full md:p-2 max-h-20 max-w-md mt-4 mx-auto text-sm'>
- <div className='text-l mt-6 m-8 px-8 py-3 text-lg'>
+ <div className="flex flex-col items-center justify-center w-full md:p-2 max-h-20 max-w-md mt-4 mx-auto text-sm">
+ <div className="text-l mt-6 m-8 px-8 py-3 text-lg">
<Button
- text='Submit New Password'
+ text="Submit New Password"
onButtonPressed={() => resetPasswordHandler()}
- size='lg'
+ size="lg"
/>
</div>
</div>
@@ -280,7 +245,7 @@ export default function PasswordReset() {
);
return (
- <div className='bg-bunker-800 h-screen w-full flex flex-col items-center justify-center'>
+ <div className="bg-bunker-800 h-screen w-full flex flex-col items-center justify-center">
{step === 1 && stepConfirmEmail}
{step === 2 && stepInputBackupKey}
{step === 3 && stepEnterNewPassword}
diff --git a/frontend/src/pages/requestnewinvite.tsx b/frontend/src/pages/requestnewinvite.tsx
index c8a5118803..be345d7e70 100644
--- a/frontend/src/pages/requestnewinvite.tsx
+++ b/frontend/src/pages/requestnewinvite.tsx
@@ -7,30 +7,20 @@ import Image from 'next/image';
*/
export default function RequestNewInvite() {
return (
- <div className='bg-bunker-700 md:h-screen flex flex-col justify-between'>
+ <div className="bg-bunker-700 md:h-screen flex flex-col justify-between">
<Head>
<title>Request a New Invite</title>
- <link rel='icon' href='/infisical.ico' />
+ <link rel="icon" href="/infisical.ico" />
</Head>
- <div className='flex flex-col items-center justify-center text-bunker-200 h-screen w-screen mt-8'>
- <p className='text-4xl text-primary-100'>
- Oops, your invite has expired.
+ <div className="flex flex-col items-center justify-center text-bunker-200 h-screen w-screen mt-8">
+ <p className="text-4xl text-primary-100">Oops, your invite has expired.</p>
+ <p className="text-lg my-4">Ask your admin for a new one.</p>
+ <p className="text-sm text-bunker-400 max-w-xs px-7 text-center leading-tight">
+ <span className="bg-primary-500/40 text-black px-1 rounded-md">Note:</span> If it still
+ doesn&apos;t work, please reach out to us at [email protected]
</p>
- <p className='text-lg my-4'>Ask your admin for a new one.</p>
- <p className='text-sm text-bunker-400 max-w-xs px-7 text-center leading-tight'>
- <span className='bg-primary-500/40 text-black px-1 rounded-md'>
- Note:
- </span>{' '}
- If it still {"doesn't work"}, please reach out to us at
- </p>
- <div className=''>
- <Image
- src='/images/invitation-expired.svg'
- height={500}
- width={800}
- alt='google logo'
- ></Image>
+ <div className="">
+ <Image src="/images/invitation-expired.svg" height={500} width={800} alt="google logo" />
</div>
</div>
</div>
diff --git a/frontend/src/pages/settings/billing/[id].tsx b/frontend/src/pages/settings/billing/[id].tsx
index 9837b8d761..3ee52db473 100644
--- a/frontend/src/pages/settings/billing/[id].tsx
+++ b/frontend/src/pages/settings/billing/[id].tsx
@@ -1,11 +1,10 @@
import { useEffect, useState } from 'react';
import Head from 'next/head';
import { useTranslation } from 'next-i18next';
-
-import Plan from '~/components/billing/Plan';
-import NavHeader from '~/components/navigation/NavHeader';
-import { STRIPE_PRODUCT_PRO, STRIPE_PRODUCT_STARTER } from '~/utilities/config';
-import { getTranslatedServerSideProps } from '~/utilities/withTranslateProps';
+import Plan from '@app/components/billing/Plan';
+import NavHeader from '@app/components/navigation/NavHeader';
+import { STRIPE_PRODUCT_PRO, STRIPE_PRODUCT_STARTER } from '@app/components/utilities/config';
+import { getTranslatedServerSideProps } from '@app/components/utilities/withTranslateProps';
import getOrganizationSubscriptions from '../../api/organization/GetOrgSubscription';
import getOrganizationUsers from '../../api/organization/GetOrgUsers';
@@ -26,7 +25,7 @@ export default function SettingsBilling() {
subtext: t('billing:starter.subtext')!,
buttonTextMain: t('billing:downgrade')!,
buttonTextSecondary: t('billing:learn-more')!,
- current: currentPlan == STRIPE_PRODUCT_STARTER,
+ current: currentPlan === STRIPE_PRODUCT_STARTER
},
{
key: 2,
@@ -37,7 +36,7 @@ export default function SettingsBilling() {
text: t('billing:professional.text')!,
buttonTextMain: t('billing:upgrade')!,
buttonTextSecondary: t('billing:learn-more')!,
- current: currentPlan == STRIPE_PRODUCT_PRO,
+ current: currentPlan === STRIPE_PRODUCT_PRO
},
{
key: 3,
@@ -46,61 +45,53 @@ export default function SettingsBilling() {
text: t('billing:enterprise.text')!,
buttonTextMain: t('billing:schedule-demo')!,
buttonTextSecondary: t('billing:learn-more')!,
- current: false,
- },
+ current: false
+ }
];
useEffect(() => {
(async () => {
const orgId = localStorage.getItem('orgData.id') as string;
const subscriptions = await getOrganizationSubscriptions({
- orgId,
+ orgId
});
setCurrentPlan(subscriptions.data[0].plan.id);
const orgUsers = await getOrganizationUsers({
- orgId,
+ orgId
});
setNumUsers(orgUsers.length);
})();
}, []);
return (
- <div className='bg-bunker-800 max-h-screen flex flex-col justify-between text-white'>
+ <div className="bg-bunker-800 max-h-screen flex flex-col justify-between text-white">
<Head>
<title>{t('common:head-title', { title: t('billing:title') })}</title>
- <link rel='icon' href='/infisical.ico' />
+ <link rel="icon" href="/infisical.ico" />
</Head>
- <div className='flex flex-row'>
- <div className='w-full max-h-screen pb-2 overflow-y-auto'>
+ <div className="flex flex-row">
+ <div className="w-full max-h-screen pb-2 overflow-y-auto">
<NavHeader pageName={t('billing:title')} />
- <div className='flex flex-row justify-between items-center ml-6 my-8 text-xl max-w-5xl'>
- <div className='flex flex-col justify-start items-start text-3xl'>
- <p className='font-semibold mr-4 text-gray-200'>
- {t('billing:title')}
- </p>
- <p className='font-normal mr-4 text-gray-400 text-base'>
- {t('billing:description')}
- </p>
+ <div className="flex flex-row justify-between items-center ml-6 my-8 text-xl max-w-5xl">
+ <div className="flex flex-col justify-start items-start text-3xl">
+ <p className="font-semibold mr-4 text-gray-200">{t('billing:title')}</p>
+ <p className="font-normal mr-4 text-gray-400 text-base">{t('billing:description')}</p>
</div>
</div>
- <div className='flex flex-col ml-6 text-mineshaft-50'>
- <p className='text-xl font-semibold'>{t('billing:subscription')}</p>
- <div className='flex flex-row mt-4 overflow-x-auto'>
+ <div className="flex flex-col ml-6 text-mineshaft-50">
+ <p className="text-xl font-semibold">{t('billing:subscription')}</p>
+ <div className="flex flex-row mt-4 overflow-x-auto">
{plans.map((plan) => (
<Plan key={plan.name} plan={plan} />
))}
</div>
- <p className='text-xl font-bold mt-12'>
- {t('billing:current-usage')}
- </p>
- <div className='flex flex-row'>
- <div className='mr-4 mt-8 text-gray-300 w-60 pt-6 pb-10 rounded-md bg-white/5 flex justify-center items-center flex flex-col'>
- <p className='text-6xl font-bold'>{numUsers}</p>
- <p className='text-gray-300'>
- {numUsers > 1
- ? 'Organization members'
- : 'Organization member'}
+ <p className="text-xl font-bold mt-12">{t('billing:current-usage')}</p>
+ <div className="flex flex-row">
+ <div className="mr-4 mt-8 text-gray-300 w-60 pt-6 pb-10 rounded-md bg-white/5 justify-center items-center flex flex-col">
+ <p className="text-6xl font-bold">{numUsers}</p>
+ <p className="text-gray-300">
+ {numUsers > 1 ? 'Organization members' : 'Organization member'}
</p>
</div>
{/* <div className="mr-4 mt-8 text-gray-300 w-60 pt-6 pb-10 rounded-md bg-white/5 flex justify-center items-center flex flex-col">
@@ -117,7 +108,4 @@ export default function SettingsBilling() {
SettingsBilling.requireAuth = true;
-export const getServerSideProps = getTranslatedServerSideProps([
- 'settings',
- 'billing',
-]);
+export const getServerSideProps = getTranslatedServerSideProps(['settings', 'billing']);
diff --git a/frontend/src/pages/settings/org/[id].tsx b/frontend/src/pages/settings/org/[id].tsx
index 1370afa69e..d82613a2d4 100644
--- a/frontend/src/pages/settings/org/[id].tsx
+++ b/frontend/src/pages/settings/org/[id].tsx
@@ -1,24 +1,19 @@
+/* eslint-disable @typescript-eslint/no-unused-vars */
import { useEffect, useState } from 'react';
import Head from 'next/head';
import { useRouter } from 'next/router';
import { useTranslation } from 'next-i18next';
-import {
- faMagnifyingGlass,
- faPlus,
- faX,
-} from '@fortawesome/free-solid-svg-icons';
-import { faCheck } from '@fortawesome/free-solid-svg-icons';
+import Button from '@app/components/basic/buttons/Button';
+import AddIncidentContactDialog from '@app/components/basic/dialog/AddIncidentContactDialog';
+import AddUserDialog from '@app/components/basic/dialog/AddUserDialog';
+import InputField from '@app/components/basic/InputField';
+import UserTable from '@app/components/basic/table/UserTable';
+import NavHeader from '@app/components/navigation/NavHeader';
+import guidGenerator from '@app/components/utilities/randomId';
+import { getTranslatedServerSideProps } from '@app/components/utilities/withTranslateProps';
+import { faCheck, faMagnifyingGlass, faPlus, faX } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import Button from '~/components/basic/buttons/Button';
-import AddIncidentContactDialog from '~/components/basic/dialog/AddIncidentContactDialog';
-import AddUserDialog from '~/components/basic/dialog/AddUserDialog';
-import InputField from '~/components/basic/InputField';
-import UserTable from '~/components/basic/table/UserTable';
-import NavHeader from '~/components/navigation/NavHeader';
-import guidGenerator from '~/utilities/randomId';
-import { getTranslatedServerSideProps } from '~/utilities/withTranslateProps';
-
import addUserToOrg from '../../api/organization/addUserToOrg';
import deleteIncidentContact from '../../api/organization/deleteIncidentContact';
import getIncidentContacts from '../../api/organization/getIncidentContacts';
@@ -37,11 +32,8 @@ export default function SettingsOrg() {
const [emailUser, setEmailUser] = useState('');
const [workspaceToBeDeletedName, setWorkspaceToBeDeletedName] = useState('');
const [searchUsers, setSearchUsers] = useState('');
- const [isAddIncidentContactOpen, setIsAddIncidentContactOpen] =
- useState(false);
- const [isAddUserOpen, setIsAddUserOpen] = useState(
- router.asPath.split('?')[1] == 'invite'
- );
+ const [isAddIncidentContactOpen, setIsAddIncidentContactOpen] = useState(false);
+ const [isAddUserOpen, setIsAddUserOpen] = useState(router.asPath.split('?')[1] === 'invite');
const [incidentContacts, setIncidentContacts] = useState<string[]>([]);
const [searchIncidentContact, setSearchIncidentContact] = useState('');
const [userList, setUserList] = useState<any[]>([]);
@@ -57,7 +49,7 @@ export default function SettingsOrg() {
(async () => {
const orgId = localStorage.getItem('orgData.id') as string;
const org = await getOrganization({
- orgId,
+ orgId
});
setOrgName(org.name);
@@ -65,33 +57,31 @@ export default function SettingsOrg() {
localStorage.getItem('orgData.id') as string
);
- setIncidentContacts(
- incidentContactsData?.map((contact) => contact.email)
- );
+ setIncidentContacts(incidentContactsData?.map((contact) => contact.email));
const user = await getUser();
setPersonalEmail(user.email);
const orgUsers = await getOrganizationUsers({
- orgId,
+ orgId
});
setUserList(
- orgUsers.map((user) => ({
+ orgUsers.map((orgUser) => ({
key: guidGenerator(),
- firstName: user.user?.firstName,
- lastName: user.user?.lastName,
- email: user.user?.email == null ? user.inviteEmail : user.user?.email,
- role: user?.role,
- status: user?.status,
- userId: user.user?._id,
- membershipId: user._id,
- publicKey: user.user?.publicKey,
+ firstName: orgUser.user?.firstName,
+ lastName: orgUser.user?.lastName,
+ email: orgUser.user?.email === null ? orgUser.inviteEmail : orgUser.user?.email,
+ role: orgUser?.role,
+ status: orgUser?.status,
+ userId: orgUser.user?._id,
+ membershipId: orgUser._id,
+ publicKey: orgUser.user?.publicKey
}))
);
const subscriptions = await getOrganizationSubscriptions({
- orgId,
+ orgId
});
setCurrentPlan(subscriptions.data[0].plan.product);
})();
@@ -107,37 +97,32 @@ export default function SettingsOrg() {
setButtonReady(false);
};
- function closeAddUserModal() {
+ const closeAddUserModal = () => {
setIsAddUserOpen(false);
- }
+ };
- function closeAddIncidentContactModal() {
+ const closeAddIncidentContactModal = () => {
setIsAddIncidentContactOpen(false);
- }
+ };
- function openAddUserModal() {
+ const openAddUserModal = () => {
setIsAddUserOpen(true);
- }
+ };
- function openAddIncidentContactModal() {
+ const openAddIncidentContactModal = () => {
setIsAddIncidentContactOpen(true);
- }
+ };
- async function submitAddUserModal(email: string) {
+ const submitAddUserModal = async (newUserEmail: string) => {
await addUserToOrg(email, localStorage.getItem('orgData.id') as string);
setEmail('');
setIsAddUserOpen(false);
router.reload();
- }
+ };
const deleteIncidentContactFully = (incidentContact: string) => {
- setIncidentContacts(
- incidentContacts.filter((contact) => contact != incidentContact)
- );
- deleteIncidentContact(
- localStorage.getItem('orgData.id') as string,
- incidentContact
- );
+ setIncidentContacts(incidentContacts.filter((contact) => contact !== incidentContact));
+ deleteIncidentContact(localStorage.getItem('orgData.id') as string, incidentContact);
};
/**
@@ -151,69 +136,64 @@ export default function SettingsOrg() {
if (userWorkspaces.length > 1) {
if (
- userWorkspaces.filter((workspace) => workspace._id == workspaceId)[0]
- .name == workspaceToBeDeletedName
+ userWorkspaces.filter((workspace) => workspace._id === workspaceId)[0].name ===
+ workspaceToBeDeletedName
) {
await deleteWorkspace(workspaceId);
- const userWorkspaces = await getWorkspaces();
- router.push('/dashboard/' + userWorkspaces[0]._id);
+ const ws = await getWorkspaces();
+ router.push(`/dashboard/${ws[0]._id}`);
}
}
};
return (
- <div className='bg-bunker-800 max-h-screen flex flex-col justify-between text-white'>
+ <div className="bg-bunker-800 max-h-screen flex flex-col justify-between text-white">
<Head>
- <title>
- {t('common:head-title', { title: t('settings-org:title') })}
- </title>
- <link rel='icon' href='/infisical.ico' />
+ <title>{t('common:head-title', { title: t('settings-org:title') })}</title>
+ <link rel="icon" href="/infisical.ico" />
</Head>
- <div className='flex flex-row'>
- <div className='w-full max-h-screen pb-2 overflow-y-auto'>
+ <div className="flex flex-row">
+ <div className="w-full max-h-screen pb-2 overflow-y-auto">
<NavHeader pageName={t('settings-org:title')} />
<AddIncidentContactDialog
isOpen={isAddIncidentContactOpen}
closeModal={closeAddIncidentContactModal}
- workspaceId={workspaceId}
incidentContacts={incidentContacts}
setIncidentContacts={setIncidentContacts}
/>
- <div className='flex flex-row justify-between items-center ml-6 my-8 text-xl max-w-5xl'>
- <div className='flex flex-col justify-start items-start text-3xl'>
- <p className='font-semibold mr-4 text-gray-200'>
- {t('settings-org:title')}
- </p>
- <p className='font-normal mr-4 text-gray-400 text-base'>
+ <div className="flex flex-row justify-between items-center ml-6 my-8 text-xl max-w-5xl">
+ <div className="flex flex-col justify-start items-start text-3xl">
+ <p className="font-semibold mr-4 text-gray-200">{t('settings-org:title')}</p>
+ <p className="font-normal mr-4 text-gray-400 text-base">
{t('settings-org:description')}
</p>
</div>
</div>
- <div className='flex flex-col ml-6 text-mineshaft-50 mr-6 max-w-5xl'>
- <div className='flex flex-col'>
- <div className='min-w-md mt-2 flex flex-col items-end pb-4'>
- <div className='bg-white/5 rounded-md px-6 py-4 flex flex-col items-start w-full mb-6'>
- <div className='max-h-28 w-full max-w-md mr-auto'>
- <p className='font-semibold mr-4 text-gray-200 text-xl mb-2'>
+ <div className="flex flex-col ml-6 text-mineshaft-50 mr-6 max-w-5xl">
+ <div className="flex flex-col">
+ <div className="min-w-md mt-2 flex flex-col items-end pb-4">
+ <div className="bg-white/5 rounded-md px-6 py-4 flex flex-col items-start w-full mb-6">
+ <div className="max-h-28 w-full max-w-md mr-auto">
+ <p className="font-semibold mr-4 text-gray-200 text-xl mb-2">
{t('common:display-name')}
</p>
<InputField
- label=''
+ label=""
// label="Organization Name"
onChangeHandler={modifyOrgName}
- type='varName'
+ type="varName"
value={orgName}
- placeholder=''
+ placeholder=""
isRequired
/>
</div>
- <div className='flex justify-start w-full'>
- <div className={`flex justify-start max-w-sm mt-4 mb-2`}>
+ <div className="flex justify-start w-full">
+ <div className="flex justify-start max-w-sm mt-4 mb-2">
<Button
text={t('common:save-changes') as string}
onButtonPressed={() => submitChanges(orgName)}
- color='mineshaft'
- size='md'
+ color="mineshaft"
+ size="md"
active={buttonReady}
iconDisabled={faCheck}
textDisabled={t('common:saved') as string}
@@ -223,11 +203,11 @@ export default function SettingsOrg() {
</div>
</div>
</div>
- <div className='bg-white/5 rounded-md px-6 pt-6 pb-2 flex flex-col items-start w-full mb-6'>
- <p className='font-semibold mr-4 text-white text-xl'>
+ <div className="bg-white/5 rounded-md px-6 pt-6 pb-2 flex flex-col items-start w-full mb-6">
+ <p className="font-semibold mr-4 text-white text-xl">
{t('section-members:org-members')}
</p>
- <p className='mr-4 text-gray-400 mt-2 mb-2'>
+ <p className="mr-4 text-gray-400 mt-2 mb-2">
{t('section-members:org-members-description')}
</p>
<AddUserDialog
@@ -235,113 +215,107 @@ export default function SettingsOrg() {
closeModal={closeAddUserModal}
submitModal={submitAddUserModal}
email={emailUser}
- workspaceId={workspaceId}
setEmail={setEmailUser}
currentPlan={currentPlan}
orgName={orgName}
/>
{/* <DeleteUserDialog isOpen={isDeleteOpen} closeModal={closeDeleteModal} submitModal={deleteMembership} userIdToBeDeleted={userIdToBeDeleted}/> */}
- <div className='pb-1 w-full flex flex-row items-start max-w-6xl'>
- <div className='h-10 w-full bg-white/5 mt-2 flex items-center rounded-md flex-row '>
+ <div className="pb-1 w-full flex flex-row items-start max-w-6xl">
+ <div className="h-10 w-full bg-white/5 mt-2 flex items-center rounded-md flex-row ">
<FontAwesomeIcon
- className='bg-white/5 rounded-l-md py-3 pl-4 pr-2 text-gray-400'
+ className="bg-white/5 rounded-l-md py-3 pl-4 pr-2 text-gray-400"
icon={faMagnifyingGlass}
/>
<input
- className='pl-2 text-gray-400 rounded-r-md bg-white/5 w-full h-full outline-none'
+ className="pl-2 text-gray-400 rounded-r-md bg-white/5 w-full h-full outline-none"
value={searchUsers}
onChange={(e) => setSearchUsers(e.target.value)}
placeholder={t('section-members:search-members') as string}
/>
</div>
- <div className='mt-2 ml-2 min-w-max flex flex-row items-start justify-start'>
+ <div className="mt-2 ml-2 min-w-max flex flex-row items-start justify-start">
<Button
text={t('section-members:add-member') as string}
onButtonPressed={openAddUserModal}
- color='mineshaft'
- size='md'
+ color="mineshaft"
+ size="md"
icon={faPlus}
/>
</div>
</div>
{userList && (
- <div className='overflow-y-auto max-w-6xl w-full'>
+ <div className="overflow-y-auto max-w-6xl w-full">
<UserTable
userData={userList}
changeData={setUserList}
myUser={personalEmail}
filter={searchUsers.toLowerCase()}
resendInvite={submitAddUserModal}
- isOrg={true}
+ isOrg
// onClick={openDeleteModal}
// deleteUser={deleteMembership}
// setUserIdToBeDeleted={setUserIdToBeDeleted}
- className='w-full'
/>
</div>
)}
</div>
- <div className='bg-white/5 rounded-md px-6 pt-6 pb-6 flex flex-col items-start w-full mb-6 mt-4'>
- <div className='flex flex-row max-w-5xl justify-between items-center w-full'>
- <div className='flex flex-col justify-between w-full max-w-3xl'>
- <p className='text-xl font-semibold mb-3 min-w-max'>
+ <div className="bg-white/5 rounded-md px-6 pt-6 pb-6 flex flex-col items-start w-full mb-6 mt-4">
+ <div className="flex flex-row max-w-5xl justify-between items-center w-full">
+ <div className="flex flex-col justify-between w-full max-w-3xl">
+ <p className="text-xl font-semibold mb-3 min-w-max">
{t('section-incident:incident-contacts')}
</p>
- <p className='text-xs text-gray-500 mb-2 min-w-max'>
+ <p className="text-xs text-gray-500 mb-2 min-w-max">
{t('section-incident:incident-contacts-description')}
</p>
</div>
- <div className='mt-4 mb-2 min-w-max flex flex-row items-end justify-center'>
+ <div className="mt-4 mb-2 min-w-max flex flex-row items-end justify-center">
<Button
text={t('section-incident:add-contact') as string}
onButtonPressed={openAddIncidentContactModal}
- color='mineshaft'
- size='md'
+ color="mineshaft"
+ size="md"
icon={faPlus}
/>
</div>
</div>
- <div className='h-12 w-full max-w-5xl bg-white/5 mt-2 flex items-center rounded-t-md flwex-row'>
+ <div className="h-12 w-full max-w-5xl bg-white/5 mt-2 flex items-center rounded-t-md flwex-row">
<FontAwesomeIcon
- className='bg-white/5 rounded-tl-md py-4 pl-4 pr-2 text-gray-400'
+ className="bg-white/5 rounded-tl-md py-4 pl-4 pr-2 text-gray-400"
icon={faMagnifyingGlass}
/>
<input
- className='pl-2 text-gray-400 rounded-tr-md bg-white/5 w-full h-full outline-none'
+ className="pl-2 text-gray-400 rounded-tr-md bg-white/5 w-full h-full outline-none"
value={searchIncidentContact}
onChange={(e) => setSearchIncidentContact(e.target.value)}
placeholder={t('common:search') as string}
/>
</div>
- {incidentContacts?.filter((email) =>
- email.includes(searchIncidentContact)
+ {incidentContacts?.filter((incidentEmail) =>
+ incidentEmail.includes(searchIncidentContact)
).length > 0 ? (
incidentContacts
- .filter((email) => email.includes(searchIncidentContact))
+ .filter((incidentEmail) => incidentEmail.includes(searchIncidentContact))
.map((contact) => (
<div
key={guidGenerator()}
- className='flex flex-row items-center justify-between max-w-5xl px-4 py-3 hover:bg-white/5 border-t border-gray-600 w-full'
+ className="flex flex-row items-center justify-between max-w-5xl px-4 py-3 hover:bg-white/5 border-t border-gray-600 w-full"
>
- <p className='text-gray-300'>{contact}</p>
- <div className='opacity-50 hover:opacity-100 duration-200'>
+ <p className="text-gray-300">{contact}</p>
+ <div className="opacity-50 hover:opacity-100 duration-200">
<Button
- onButtonPressed={() =>
- deleteIncidentContactFully(contact)
- }
- color='red'
- size='icon-sm'
+ onButtonPressed={() => deleteIncidentContactFully(contact)}
+ color="red"
+ size="icon-sm"
icon={faX}
/>
</div>
</div>
))
) : (
- <div className='w-full flex flex-row justify-center mt-6 max-w-4xl ml-6'>
- <p className='text-gray-400'>
- {t('section-incident:no-incident-contacts')}
- </p>
+ <div className="w-full flex flex-row justify-center mt-6 max-w-4xl ml-6">
+ <p className="text-gray-400">{t('section-incident:no-incident-contacts')}</p>
</div>
)}
</div>
@@ -394,5 +368,5 @@ export const getServerSideProps = getTranslatedServerSideProps([
'settings',
'settings-org',
'section-incident',
- 'section-members',
+ 'section-members'
]);
diff --git a/frontend/src/pages/settings/personal/[id].tsx b/frontend/src/pages/settings/personal/[id].tsx
index 59b19ab655..11fab79961 100644
--- a/frontend/src/pages/settings/personal/[id].tsx
+++ b/frontend/src/pages/settings/personal/[id].tsx
@@ -1,23 +1,22 @@
-import { useEffect, useState } from "react";
-import Head from "next/head";
-import { useRouter } from "next/router";
-import { useTranslation } from "next-i18next";
-import { faCheck, faPlus, faX } from "@fortawesome/free-solid-svg-icons";
-import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
+import { useEffect, useState } from 'react';
+import Head from 'next/head';
+import { useRouter } from 'next/router';
+import { useTranslation } from 'next-i18next';
+import Button from '@app/components/basic/buttons/Button';
+import InputField from '@app/components/basic/InputField';
+import ListBox from '@app/components/basic/Listbox';
+import ApiKeyTable from '@app/components/basic/table/ApiKeyTable';
+import NavHeader from '@app/components/navigation/NavHeader';
+import passwordCheck from '@app/components/utilities/checks/PasswordCheck';
+import changePassword from '@app/components/utilities/cryptography/changePassword';
+import issueBackupKey from '@app/components/utilities/cryptography/issueBackupKey';
+import { getTranslatedServerSideProps } from '@app/components/utilities/withTranslateProps';
+import { faCheck, faPlus, faX } from '@fortawesome/free-solid-svg-icons';
+import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import Button from "~/components/basic/buttons/Button";
-import InputField from "~/components/basic/InputField";
-import ListBox from "~/components/basic/Listbox";
-import ApiKeyTable from "~/components/basic/table/ApiKeyTable";
-import NavHeader from "~/components/navigation/NavHeader";
-import changePassword from "~/components/utilities/cryptography/changePassword";
-import issueBackupKey from "~/components/utilities/cryptography/issueBackupKey";
-import passwordCheck from "~/utilities/checks/PasswordCheck";
-import { getTranslatedServerSideProps } from "~/utilities/withTranslateProps";
-
-import AddApiKeyDialog from "../../../components/basic/dialog/AddApiKeyDialog";
-import getAPIKeys from "../../api/apiKey/getAPIKeys";
-import getUser from "../../api/user/getUser";
+import AddApiKeyDialog from '../../../components/basic/dialog/AddApiKeyDialog';
+import getAPIKeys from '../../api/apiKey/getAPIKeys';
+import getUser from '../../api/user/getUser';
export default function PersonalSettings() {
const [personalEmail, setPersonalEmail] = useState('');
@@ -32,7 +31,7 @@ export default function PersonalSettings() {
const [passwordChanged, setPasswordChanged] = useState(false);
const [backupKeyIssued, setBackupKeyIssued] = useState(false);
const [backupKeyError, setBackupKeyError] = useState(false);
- const [isAddApiKeyDialogOpen, setIsAddApiKeyDialogOpen] = useState(false)
+ const [isAddApiKeyDialogOpen, setIsAddApiKeyDialogOpen] = useState(false);
const [apiKeys, setApiKeys] = useState<any[]>([]);
const { t } = useTranslation();
@@ -48,16 +47,14 @@ export default function PersonalSettings() {
const load = async () => {
try {
const user = await getUser();
- setApiKeys(
- await getAPIKeys()
- );
+ setApiKeys(await getAPIKeys());
setPersonalEmail(user.email);
- setPersonalName(user.firstName + " " + user.lastName);
+ setPersonalName(`${user.firstName} ${user.lastName}`);
} catch (err) {
console.error(err);
}
- }
-
+ };
+
load();
}, []);
@@ -66,12 +63,10 @@ export default function PersonalSettings() {
};
return (
- <div className='bg-bunker-800 max-h-screen flex flex-col justify-between text-white'>
+ <div className="bg-bunker-800 max-h-screen flex flex-col justify-between text-white">
<Head>
- <title>
- {t('common:head-title', { title: t('settings-personal:title') })}
- </title>
- <link rel='icon' href='/infisical.ico' />
+ <title>{t('common:head-title', { title: t('settings-personal:title') })}</title>
+ <link rel="icon" href="/infisical.ico" />
</Head>
<AddApiKeyDialog
isOpen={isAddApiKeyDialogOpen}
@@ -81,16 +76,11 @@ export default function PersonalSettings() {
/>
<div className="flex flex-row">
<div className="w-full max-h-screen pb-2 overflow-y-auto">
- <NavHeader
- pageName={t('settings-personal:title')}
- isProjectRelated={false}
- />
- <div className='flex flex-row justify-between items-center ml-6 mt-8 mb-6 text-xl max-w-5xl'>
- <div className='flex flex-col justify-start items-start text-3xl'>
- <p className='font-semibold mr-4 text-gray-200'>
- {t('settings-personal:title')}
- </p>
- <p className='font-normal mr-4 text-gray-400 text-base'>
+ <NavHeader pageName={t('settings-personal:title')} isProjectRelated={false} />
+ <div className="flex flex-row justify-between items-center ml-6 mt-8 mb-6 text-xl max-w-5xl">
+ <div className="flex flex-col justify-start items-start text-3xl">
+ <p className="font-semibold mr-4 text-gray-200">{t('settings-personal:title')}</p>
+ <p className="font-normal mr-4 text-gray-400 text-base">
{t('settings-personal:description')}
</p>
</div>
@@ -98,9 +88,9 @@ export default function PersonalSettings() {
<div className="flex flex-col ml-6 text-mineshaft-50 mr-6 max-w-5xl">
<div className="bg-white/5 rounded-md px-6 pt-6 pb-6 flex flex-col items-start w-full mb-6 mt-4">
<p className="text-xl font-semibold self-start">
- {t("settings-personal:change-language")}
+ {t('settings-personal:change-language')}
</p>
- <div className='max-h-28 w-ful mt-4'>
+ <div className="max-h-28 w-ful mt-4">
<ListBox
selected={lang}
onChange={setLanguage}
@@ -113,15 +103,15 @@ export default function PersonalSettings() {
<div className="flex flex-row justify-between w-full">
<div className="flex flex-col w-full">
<p className="text-xl font-semibold mb-3">
- {t("settings-personal:api-keys.title")}
+ {t('settings-personal:api-keys.title')}
</p>
<p className="text-sm text-gray-400">
- {t("settings-personal:api-keys.description")}
+ {t('settings-personal:api-keys.description')}
</p>
</div>
<div className="w-48 mt-2">
<Button
- text={String(t("settings-personal:api-keys.add-new"))}
+ text={String(t('settings-personal:api-keys.add-new'))}
onButtonPressed={() => {
setIsAddApiKeyDialogOpen(true);
}}
@@ -131,35 +121,32 @@ export default function PersonalSettings() {
/>
</div>
</div>
- <ApiKeyTable
- data={apiKeys}
- setApiKeys={setApiKeys as any}
- />
+ <ApiKeyTable data={apiKeys} setApiKeys={setApiKeys as any} />
</div>
- <div className='bg-white/5 rounded-md px-6 pt-5 pb-6 flex flex-col items-start w-full mb-6'>
- <div className='flex flex-row max-w-5xl justify-between items-center w-full'>
- <div className='flex flex-col justify-between w-full max-w-3xl'>
- <p className='text-xl font-semibold mb-3 min-w-max'>
+ <div className="bg-white/5 rounded-md px-6 pt-5 pb-6 flex flex-col items-start w-full mb-6">
+ <div className="flex flex-row max-w-5xl justify-between items-center w-full">
+ <div className="flex flex-col justify-between w-full max-w-3xl">
+ <p className="text-xl font-semibold mb-3 min-w-max">
{t('section-password:change')}
</p>
</div>
</div>
- <div className='max-w-xl w-full'>
+ <div className="max-w-xl w-full">
<InputField
label={t('section-password:current') as string}
onChangeHandler={(password) => {
setCurrentPassword(password);
}}
- type='password'
+ type="password"
value={currentPassword}
isRequired
error={currentPasswordError}
errorText={t('section-password:current-wrong') as string}
- autoComplete='current-password'
- id='current-password'
+ autoComplete="current-password"
+ id="current-password"
/>
- <div className='py-2'></div>
+ <div className="py-2" />
<InputField
label={t('section-password:new') as string}
onChangeHandler={(password) => {
@@ -169,39 +156,27 @@ export default function PersonalSettings() {
setPasswordErrorLength,
setPasswordErrorNumber,
setPasswordErrorLowerCase,
- errorCheck: false,
+ errorCheck: false
});
}}
- type='password'
+ type="password"
value={newPassword}
isRequired
- error={
- passwordErrorLength &&
- passwordErrorLowerCase &&
- passwordErrorNumber
- }
- autoComplete='new-password'
- id='new-password'
+ error={passwordErrorLength && passwordErrorLowerCase && passwordErrorNumber}
+ autoComplete="new-password"
+ id="new-password"
/>
</div>
- {passwordErrorLength ||
- passwordErrorLowerCase ||
- passwordErrorNumber ? (
- <div className='w-full mt-3 bg-white/5 px-2 flex flex-col items-start py-2 rounded-md max-w-xl mb-2'>
- <div className={`text-gray-400 text-sm mb-1`}>
+ {passwordErrorLength || passwordErrorLowerCase || passwordErrorNumber ? (
+ <div className="w-full mt-3 bg-white/5 px-2 flex flex-col items-start py-2 rounded-md max-w-xl mb-2">
+ <div className="text-gray-400 text-sm mb-1">
{t('section-password:validate-base')}
</div>
- <div className='flex flex-row justify-start items-center ml-1'>
+ <div className="flex flex-row justify-start items-center ml-1">
{passwordErrorLength ? (
- <FontAwesomeIcon
- icon={faX}
- className='text-md text-red mr-2.5'
- />
+ <FontAwesomeIcon icon={faX} className="text-md text-red mr-2.5" />
) : (
- <FontAwesomeIcon
- icon={faCheck}
- className='text-md text-primary mr-2'
- />
+ <FontAwesomeIcon icon={faCheck} className="text-md text-primary mr-2" />
)}
<div
className={`${
@@ -211,39 +186,25 @@ export default function PersonalSettings() {
{t('section-password:validate-length')}
</div>
</div>
- <div className='flex flex-row justify-start items-center ml-1'>
+ <div className="flex flex-row justify-start items-center ml-1">
{passwordErrorLowerCase ? (
- <FontAwesomeIcon
- icon={faX}
- className='text-md text-red mr-2.5'
- />
+ <FontAwesomeIcon icon={faX} className="text-md text-red mr-2.5" />
) : (
- <FontAwesomeIcon
- icon={faCheck}
- className='text-md text-primary mr-2'
- />
+ <FontAwesomeIcon icon={faCheck} className="text-md text-primary mr-2" />
)}
<div
className={`${
- passwordErrorLowerCase
- ? 'text-gray-400'
- : 'text-gray-600'
+ passwordErrorLowerCase ? 'text-gray-400' : 'text-gray-600'
} text-sm`}
>
{t('section-password:validate-case')}
</div>
</div>
- <div className='flex flex-row justify-start items-center ml-1'>
+ <div className="flex flex-row justify-start items-center ml-1">
{passwordErrorNumber ? (
- <FontAwesomeIcon
- icon={faX}
- className='text-md text-red mr-2.5'
- />
+ <FontAwesomeIcon icon={faX} className="text-md text-red mr-2.5" />
) : (
- <FontAwesomeIcon
- icon={faCheck}
- className='text-md text-primary mr-2'
- />
+ <FontAwesomeIcon icon={faCheck} className="text-md text-primary mr-2" />
)}
<div
className={`${
@@ -255,17 +216,13 @@ export default function PersonalSettings() {
</div>
</div>
) : (
- <div className='py-2'></div>
+ <div className="py-2" />
)}
- <div className='flex flex-row items-center mt-3 w-52 pr-3'>
+ <div className="flex flex-row items-center mt-3 w-52 pr-3">
<Button
text={t('section-password:change') as string}
onButtonPressed={() => {
- if (
- !passwordErrorLength &&
- !passwordErrorLowerCase &&
- !passwordErrorNumber
- ) {
+ if (!passwordErrorLength && !passwordErrorLowerCase && !passwordErrorNumber) {
changePassword(
personalEmail,
currentPassword,
@@ -277,16 +234,12 @@ export default function PersonalSettings() {
);
}
}}
- color='mineshaft'
- size='md'
+ color="mineshaft"
+ size="md"
active={
- newPassword != '' &&
- currentPassword != '' &&
- !(
- passwordErrorLength ||
- passwordErrorLowerCase ||
- passwordErrorNumber
- )
+ newPassword !== '' &&
+ currentPassword !== '' &&
+ !(passwordErrorLength || passwordErrorLowerCase || passwordErrorNumber)
}
textDisabled={t('section-password:change') as string}
/>
@@ -299,34 +252,34 @@ export default function PersonalSettings() {
</div>
</div>
- <div className="bg-white/5 rounded-md px-6 pt-5 pb-6 mt-2 flex flex-col items-start flex flex-col items-start w-full mb-6">
+ <div className="bg-white/5 rounded-md px-6 pt-5 pb-6 mt-2 flex flex-col items-start w-full mb-6">
<div className="flex flex-row max-w-5xl justify-between items-center w-full">
<div className="flex flex-col justify-between w-full max-w-3xl">
<p className="text-xl font-semibold mb-3 min-w-max">
- {t("settings-personal:emergency.name")}
+ {t('settings-personal:emergency.name')}
</p>
- <p className='text-sm text-mineshaft-300 min-w-max'>
+ <p className="text-sm text-mineshaft-300 min-w-max">
{t('settings-personal:emergency.text1')}
</p>
- <p className='text-sm text-mineshaft-300 mb-5 min-w-max'>
+ <p className="text-sm text-mineshaft-300 mb-5 min-w-max">
{t('settings-personal:emergency.text2')}
</p>
</div>
</div>
- <div className='w-full max-w-xl mb-4'>
+ <div className="w-full max-w-xl mb-4">
<InputField
label={t('section-password:current') as string}
onChangeHandler={setBackupPassword}
- type='password'
+ type="password"
value={backupPassword}
isRequired
error={backupKeyError}
errorText={t('section-password:current-wrong') as string}
- autoComplete='current-password'
- id='current-password'
+ autoComplete="current-password"
+ id="current-password"
/>
</div>
- <div className='flex flex-row items-center mt-3 w-60'>
+ <div className="flex flex-row items-center mt-3 w-60">
<Button
text={t('settings-personal:emergency.download') as string}
onButtonPressed={() => {
@@ -335,15 +288,13 @@ export default function PersonalSettings() {
password: backupPassword,
personalName,
setBackupKeyError,
- setBackupKeyIssued,
+ setBackupKeyIssued
});
}}
- color='mineshaft'
- size='md'
- active={backupPassword != ''}
- textDisabled={
- t('settings-personal:emergency.download') as string
- }
+ color="mineshaft"
+ size="md"
+ active={backupPassword !== ''}
+ textDisabled={t('settings-personal:emergency.download') as string}
/>
<FontAwesomeIcon
icon={faCheck}
@@ -363,8 +314,8 @@ export default function PersonalSettings() {
PersonalSettings.requireAuth = true;
export const getServerSideProps = getTranslatedServerSideProps([
- "settings",
- "settings-personal",
- "section-password",
- "section-api-key"
+ 'settings',
+ 'settings-personal',
+ 'section-password',
+ 'section-api-key'
]);
diff --git a/frontend/src/pages/settings/project/[id].tsx b/frontend/src/pages/settings/project/[id].tsx
index ef33fce73c..737b6ac2ab 100644
--- a/frontend/src/pages/settings/project/[id].tsx
+++ b/frontend/src/pages/settings/project/[id].tsx
@@ -2,19 +2,18 @@ import { useEffect, useState } from 'react';
import Head from 'next/head';
import { useRouter } from 'next/router';
import { useTranslation } from 'next-i18next';
+import Button from '@app/components/basic/buttons/Button';
+import AddServiceTokenDialog from '@app/components/basic/dialog/AddServiceTokenDialog';
+import InputField from '@app/components/basic/InputField';
+import EnvironmentTable from '@app/components/basic/table/EnvironmentsTable';
+import ServiceTokenTable from '@app/components/basic/table/ServiceTokenTable';
+import NavHeader from '@app/components/navigation/NavHeader';
+import { getTranslatedServerSideProps } from '@app/components/utilities/withTranslateProps';
+import deleteEnvironment from '@app/pages/api/environments/deleteEnvironment';
+import updateEnvironment from '@app/pages/api/environments/updateEnvironment';
import { faCheck, faCopy, faPlus } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import Button from '~/components/basic/buttons/Button';
-import AddServiceTokenDialog from '~/components/basic/dialog/AddServiceTokenDialog';
-import InputField from '~/components/basic/InputField';
-import EnvironmentTable from '~/components/basic/table/EnvironmentsTable';
-import ServiceTokenTable from '~/components/basic/table/ServiceTokenTable';
-import NavHeader from '~/components/navigation/NavHeader';
-import deleteEnvironment from '~/pages/api/environments/deleteEnvironment';
-import updateEnvironment from '~/pages/api/environments/updateEnvironment';
-import { getTranslatedServerSideProps } from '~/utilities/withTranslateProps';
-
import createEnvironment from '../../api/environments/createEnvironment';
import getServiceTokens from '../../api/serviceToken/getServiceTokens';
import deleteWorkspace from '../../api/workspace/deleteWorkspace';
@@ -33,9 +32,8 @@ export default function SettingsBasic() {
const [serviceTokens, setServiceTokens] = useState<any[]>([]);
const [environments, setEnvironments] = useState<Array<EnvData>>([]);
const [workspaceToBeDeletedName, setWorkspaceToBeDeletedName] = useState('');
- const [isAddOpen, setIsAddOpen] = useState(false);
- const [isAddServiceTokenDialogOpen, setIsAddServiceTokenDialogOpen] =
- useState(false);
+ // const [isAddOpen, setIsAddOpen] = useState(false);
+ const [isAddServiceTokenDialogOpen, setIsAddServiceTokenDialogOpen] = useState(false);
const [projectIdCopied, setProjectIdCopied] = useState(false);
const workspaceId = router.query.id as string;
@@ -62,13 +60,13 @@ export default function SettingsBasic() {
const load = async () => {
const userWorkspaces = await getWorkspaces();
userWorkspaces.forEach((userWorkspace) => {
- if (userWorkspace._id == workspaceId) {
+ if (userWorkspace._id === workspaceId) {
setWorkspaceName(userWorkspace.name);
setEnvironments(userWorkspace.environments);
}
});
const tempServiceTokens = await getServiceTokens({
- workspaceId,
+ workspaceId
});
setServiceTokens(tempServiceTokens);
};
@@ -101,12 +99,12 @@ export default function SettingsBasic() {
if (userWorkspaces.length > 1) {
if (
- userWorkspaces.filter((workspace) => workspace._id === workspaceId)[0]
- .name == workspaceToBeDeletedName
+ userWorkspaces.filter((workspace) => workspace._id === workspaceId)[0].name ===
+ workspaceToBeDeletedName
) {
await deleteWorkspace(workspaceId);
- const userWorkspaces = await getWorkspaces();
- router.push('/dashboard/' + userWorkspaces[0]._id);
+ const ws = await getWorkspaces();
+ router.push(`/dashboard/${ws[0]._id}`);
}
}
};
@@ -114,7 +112,7 @@ export default function SettingsBasic() {
const onCreateEnvironment = async ({ name, slug }: EnvData) => {
const res = await createEnvironment(workspaceId, {
environmentName: name,
- environmentSlug: slug,
+ environmentSlug: slug
});
if (res) {
// TODO: on react-query migration do an api call to resync
@@ -122,20 +120,15 @@ export default function SettingsBasic() {
}
};
- const onUpdateEnvironment = async (
- oldSlug: string,
- { name, slug }: EnvData
- ) => {
+ const onUpdateEnvironment = async (oldSlug: string, { name, slug }: EnvData) => {
const res = await updateEnvironment(workspaceId, {
oldEnvironmentSlug: oldSlug,
environmentName: name,
- environmentSlug: slug,
+ environmentSlug: slug
});
// TODO: on react-query migration do an api call to resync
if (res) {
- setEnvironments((env) =>
- env.map((el) => (el.slug === oldSlug ? { name, slug } : el))
- );
+ setEnvironments((env) => env.map((el) => (el.slug === oldSlug ? { name, slug } : el)));
}
};
@@ -143,19 +136,15 @@ export default function SettingsBasic() {
const res = await deleteEnvironment(workspaceId, slugToBeDelete);
// TODO: on react-query migration do an api call to resync
if (res) {
- setEnvironments((env) =>
- env.filter(({ slug }) => slug !== slugToBeDelete)
- );
+ setEnvironments((env) => env.filter(({ slug }) => slug !== slugToBeDelete));
}
};
return (
- <div className='bg-bunker-800 max-h-screen flex flex-col justify-between text-white'>
+ <div className="bg-bunker-800 max-h-screen flex flex-col justify-between text-white">
<Head>
- <title>
- {t('common:head-title', { title: t('settings-project:title') })}
- </title>
- <link rel='icon' href='/infisical.ico' />
+ <title>{t('common:head-title', { title: t('settings-project:title') })}</title>
+ <link rel="icon" href="/infisical.ico" />
</Head>
<AddServiceTokenDialog
isOpen={isAddServiceTokenDialogOpen}
@@ -166,104 +155,94 @@ export default function SettingsBasic() {
serviceTokens={serviceTokens}
setServiceTokens={setServiceTokens}
/>
- <div className='flex flex-row mr-6 max-w-5xl'>
- <div className='w-full max-h-screen pb-2 overflow-y-auto'>
- <NavHeader
- pageName={t('settings-project:title')}
- isProjectRelated={true}
- />
- <div className='flex flex-row justify-between items-center ml-6 my-8 text-xl max-w-5xl'>
- <div className='flex flex-col justify-start items-start text-3xl'>
- <p className='font-semibold mr-4 text-gray-200'>
- {t('settings-project:title')}
- </p>
- <p className='font-normal mr-4 text-gray-400 text-base'>
+ <div className="flex flex-row mr-6 max-w-5xl">
+ <div className="w-full max-h-screen pb-2 overflow-y-auto">
+ <NavHeader pageName={t('settings-project:title')} isProjectRelated />
+ <div className="flex flex-row justify-between items-center ml-6 my-8 text-xl max-w-5xl">
+ <div className="flex flex-col justify-start items-start text-3xl">
+ <p className="font-semibold mr-4 text-gray-200">{t('settings-project:title')}</p>
+ <p className="font-normal mr-4 text-gray-400 text-base">
{t('settings-project:description')}
</p>
</div>
</div>
- <div className='flex flex-col ml-6 text-mineshaft-50'>
- <div className='flex flex-col'>
- <div className='min-w-md mt-2 flex flex-col items-start'>
- <div className='bg-white/5 rounded-md px-6 pt-6 pb-4 flex flex-col items-start flex flex-col items-start w-full mb-6 pt-2'>
- <p className='text-xl font-semibold mb-4 mt-2'>
- {t('common:display-name')}
- </p>
- <div className='max-h-28 w-full max-w-md mr-auto'>
+ <div className="flex flex-col ml-6 text-mineshaft-50">
+ <div className="flex flex-col">
+ <div className="min-w-md mt-2 flex flex-col items-start">
+ <div className="bg-white/5 rounded-md px-6 pb-4 flex flex-col items-start w-full mb-6 pt-2">
+ <p className="text-xl font-semibold mb-4 mt-2">{t('common:display-name')}</p>
+ <div className="max-h-28 w-full max-w-md mr-auto">
<InputField
- label=''
+ label=""
onChangeHandler={modifyWorkspaceName}
- type='varName'
+ type="varName"
value={workspaceName}
- placeholder=''
+ placeholder=""
isRequired
/>
</div>
- <div className='flex justify-start w-full'>
- <div className={`flex justify-start max-w-sm mt-4 mb-2`}>
+ <div className="flex justify-start w-full">
+ <div className="flex justify-start max-w-sm mt-4 mb-2">
<Button
text={t('common:save-changes') as string}
onButtonPressed={() => submitChanges(workspaceName)}
- color='mineshaft'
- size='md'
+ color="mineshaft"
+ size="md"
active={buttonReady}
iconDisabled={faCheck}
- textDisabled='Saved'
+ textDisabled="Saved"
/>
</div>
</div>
</div>
- <div className='bg-white/5 rounded-md px-6 pt-4 pb-2 flex flex-col items-start w-full mb-6 mt-4'>
- <p className='text-xl font-semibold self-start'>
- {t('common:project-id')}
- </p>
- <p className='text-base text-gray-400 font-normal self-start mt-4'>
+ <div className="bg-white/5 rounded-md px-6 pt-4 pb-2 flex flex-col items-start w-full mb-6 mt-4">
+ <p className="text-xl font-semibold self-start">{t('common:project-id')}</p>
+ <p className="text-base text-gray-400 font-normal self-start mt-4">
{t('settings-project:project-id-description')}
</p>
- <p className='text-base text-gray-400 font-normal self-start'>
+ <p className="text-base text-gray-400 font-normal self-start">
{t('settings-project:project-id-description2')}
{/* eslint-disable-next-line react/jsx-no-target-blank */}
<a
- href='https://infisical.com/docs/getting-started/introduction'
- target='_blank'
- rel='noopener'
- className='text-primary hover:opacity-80 duration-200'
+ href="https://infisical.com/docs/getting-started/introduction"
+ target="_blank"
+ rel="noopener"
+ className="text-primary hover:opacity-80 duration-200"
>
{t('settings-project:docs')}
</a>
</p>
- <p className='mt-4 text-xs text-bunker-300'>
+ <p className="mt-4 text-xs text-bunker-300">
{t('settings-project:auto-generated')}
</p>
- <div className='flex justify-end items-center bg-white/[0.07] text-base mt-2 mb-3 mr-2 rounded-md text-gray-400'>
- <p className='mr-2 font-bold pl-4'>{`${t(
- 'common:project-id'
- )}:`}</p>
+ <div className="flex justify-end items-center bg-white/[0.07] text-base mt-2 mb-3 mr-2 rounded-md text-gray-400">
+ <p className="mr-2 font-bold pl-4">{`${t('common:project-id')}:`}</p>
<input
- type='text'
+ type="text"
value={workspaceId}
- id='myInput'
- className='bg-white/0 text-gray-400 py-2 w-60 px-2 min-w-md outline-none'
+ id="myInput"
+ className="bg-white/0 text-gray-400 py-2 w-60 px-2 min-w-md outline-none"
disabled
- ></input>
- <div className='group font-normal group relative inline-block text-gray-400 underline hover:text-primary duration-200'>
+ />
+ <div className="group font-normal group relative inline-block text-gray-400 underline hover:text-primary duration-200">
<button
+ type="button"
onClick={copyToClipboard}
- className='pl-4 pr-4 border-l border-white/20 py-2 hover:bg-white/[0.12] duration-200'
+ className="pl-4 pr-4 border-l border-white/20 py-2 hover:bg-white/[0.12] duration-200"
>
{projectIdCopied ? (
- <FontAwesomeIcon icon={faCheck} className='pr-0.5' />
+ <FontAwesomeIcon icon={faCheck} className="pr-0.5" />
) : (
<FontAwesomeIcon icon={faCopy} />
)}
</button>
- <span className='absolute hidden group-hover:flex group-hover:animate-popup duration-300 w-28 -left-8 -top-20 translate-y-full pl-3 py-2 bg-bunker-800 rounded-md text-center text-gray-400 text-sm'>
+ <span className="absolute hidden group-hover:flex group-hover:animate-popup duration-300 w-28 -left-8 -top-20 translate-y-full pl-3 py-2 bg-bunker-800 rounded-md text-center text-gray-400 text-sm">
{t('common:click-to-copy')}
</span>
</div>
</div>
</div>
- <div className='bg-white/5 rounded-md px-6 pt-6 flex flex-col items-start w-full mt-4 mb-4'>
+ <div className="bg-white/5 rounded-md px-6 pt-6 flex flex-col items-start w-full mt-4 mb-4">
<EnvironmentTable
data={environments}
onCreateEnv={onCreateEnvironment}
@@ -271,37 +250,37 @@ export default function SettingsBasic() {
onDeleteEnv={onDeleteEnvironment}
/>
</div>
- <div className='bg-white/5 rounded-md px-6 flex flex-col items-start w-full mt-4 mb-4 pt-2'>
- <div className='flex flex-row justify-between w-full'>
- <div className='flex flex-col w-full'>
- <p className='text-xl font-semibold mb-3'>
+ <div className="bg-white/5 rounded-md px-6 flex flex-col items-start w-full mt-4 mb-4 pt-2">
+ <div className="flex flex-row justify-between w-full">
+ <div className="flex flex-col w-full">
+ <p className="text-xl font-semibold mb-3">
{t('section-token:service-tokens')}
</p>
- <p className='text-sm text-gray-400'>
+ <p className="text-sm text-gray-400">
{t('section-token:service-tokens-description')}
</p>
- <p className='text-sm text-gray-400 mb-4'>
+ <p className="text-sm text-gray-400 mb-4">
Please, make sure you are on the
<a
- className='text-primary underline underline-offset-2 ml-1'
- href='https://infisical.com/docs/cli/overview'
- target='_blank'
- rel='noreferrer'
+ className="text-primary underline underline-offset-2 ml-1"
+ href="https://infisical.com/docs/cli/overview"
+ target="_blank"
+ rel="noreferrer"
>
latest version of CLI
</a>
.
</p>
</div>
- <div className='w-48 mt-2'>
+ <div className="w-48 mt-2">
<Button
text={t('section-token:add-new') as string}
onButtonPressed={() => {
setIsAddServiceTokenDialogOpen(true);
}}
- color='mineshaft'
+ color="mineshaft"
icon={faPlus}
- size='md'
+ size="md"
/>
</div>
</div>
@@ -313,31 +292,27 @@ export default function SettingsBasic() {
</div>
</div>
</div>
- <div className='bg-white/5 rounded-md px-6 border-l border-red pl-6 flex flex-col items-start w-full mb-6 mt-4 pb-4 pt-2'>
- <p className='text-xl font-bold text-red'>
- {t('settings-project:danger-zone')}
- </p>
- <p className='mt-2 text-md text-gray-400'>
- {t('settings-project:danger-zone-note')}
- </p>
- <div className='max-h-28 w-full max-w-md mr-auto mt-4'>
+ <div className="bg-white/5 rounded-md px-6 border-l border-red pl-6 flex flex-col items-start w-full mb-6 mt-4 pb-4 pt-2">
+ <p className="text-xl font-bold text-red">{t('settings-project:danger-zone')}</p>
+ <p className="mt-2 text-md text-gray-400">{t('settings-project:danger-zone-note')}</p>
+ <div className="max-h-28 w-full max-w-md mr-auto mt-4">
<InputField
label={t('settings-project:project-to-delete') as string}
onChangeHandler={setWorkspaceToBeDeletedName}
- type='varName'
+ type="varName"
value={workspaceToBeDeletedName}
- placeholder=''
+ placeholder=""
isRequired
/>
</div>
<button
- type='button'
- className='max-w-md mt-6 w-full inline-flex justify-center rounded-md border border-transparent bg-gray-800 px-4 py-2.5 text-sm font-medium text-gray-400 hover:bg-red hover:text-white hover:font-semibold hover:text-semibold duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2'
+ type="button"
+ className="max-w-md mt-6 w-full inline-flex justify-center rounded-md border border-transparent bg-gray-800 px-4 py-2.5 text-sm font-medium text-gray-400 hover:bg-red hover:text-white hover:font-semibold hover:text-semibold duration-200 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2"
onClick={executeDeletingWorkspace}
>
{t('settings-project:delete-project')}
</button>
- <p className='mt-0.5 ml-1 text-xs text-gray-500'>
+ <p className="mt-0.5 ml-1 text-xs text-gray-500">
{t('settings-project:delete-project-note')}
</p>
</div>
@@ -353,5 +328,5 @@ SettingsBasic.requireAuth = true;
export const getServerSideProps = getTranslatedServerSideProps([
'settings',
'settings-project',
- 'section-token',
+ 'section-token'
]);
diff --git a/frontend/src/pages/signup.tsx b/frontend/src/pages/signup.tsx
index d7a3960bf1..71feec8c21 100644
--- a/frontend/src/pages/signup.tsx
+++ b/frontend/src/pages/signup.tsx
@@ -1,34 +1,33 @@
-import { useEffect, useState } from "react";
-import Head from "next/head";
-import Image from "next/image";
-import Link from "next/link";
-import { useRouter } from "next/router";
-import { useTranslation } from "next-i18next";
-
-import CodeInputStep from "~/components/signup/CodeInputStep";
-import DownloadBackupPDF from "~/components/signup/DonwloadBackupPDFStep";
-import EnterEmailStep from "~/components/signup/EnterEmailStep";
-import TeamInviteStep from "~/components/signup/TeamInviteStep";
-import UserInfoStep from "~/components/signup/UserInfoStep";
-import { getTranslatedStaticProps } from "~/components/utilities/withTranslateProps";
-
-import checkEmailVerificationCode from "./api/auth/CheckEmailVerificationCode";
-import getWorkspaces from "./api/workspace/getWorkspaces";
+/* eslint-disable no-nested-ternary */
+import { useEffect, useState } from 'react';
+import Head from 'next/head';
+import Image from 'next/image';
+import Link from 'next/link';
+import { useRouter } from 'next/router';
+import { useTranslation } from 'next-i18next';
+import CodeInputStep from '@app/components/signup/CodeInputStep';
+import DownloadBackupPDF from '@app/components/signup/DonwloadBackupPDFStep';
+import EnterEmailStep from '@app/components/signup/EnterEmailStep';
+import TeamInviteStep from '@app/components/signup/TeamInviteStep';
+import UserInfoStep from '@app/components/signup/UserInfoStep';
+import { getTranslatedStaticProps } from '@app/components/utilities/withTranslateProps';
+import checkEmailVerificationCode from './api/auth/CheckEmailVerificationCode';
+import getWorkspaces from './api/workspace/getWorkspaces';
/**
* @returns the signup page
*/
export default function SignUp() {
- const [email, setEmail] = useState("");
- const [password, setPassword] = useState("");
- const [firstName, setFirstName] = useState("");
- const [lastName, setLastName] = useState("");
- const [code, setCode] = useState("");
+ const [email, setEmail] = useState('');
+ const [password, setPassword] = useState('');
+ const [firstName, setFirstName] = useState('');
+ const [lastName, setLastName] = useState('');
+ const [code, setCode] = useState('');
const [codeError, setCodeError] = useState(false);
const [step, setStep] = useState(1);
const router = useRouter();
- const [verificationToken, setVerificationToken] = useState("");
+ const [verificationToken, setVerificationToken] = useState('');
const { t } = useTranslation();
@@ -36,9 +35,9 @@ export default function SignUp() {
const tryAuth = async () => {
try {
const userWorkspaces = await getWorkspaces();
- router.push("/dashboard/" + userWorkspaces[0]._id);
+ router.push(`/dashboard/${userWorkspaces[0]._id}`);
} catch (error) {
- console.log("Error - Not logged in yet");
+ console.log('Error - Not logged in yet');
}
};
tryAuth();
@@ -53,9 +52,9 @@ export default function SignUp() {
* Step 5 is inviting users
*/
const incrementStep = async () => {
- if (step == 1 || step == 3 || step == 4) {
+ if (step === 1 || step === 3 || step === 4) {
setStep(step + 1);
- } else if (step == 2) {
+ } else if (step === 2) {
// Checking if the code matches the email.
const response = await checkEmailVerificationCode({ email, code });
if (response.status === 200) {
@@ -70,40 +69,54 @@ export default function SignUp() {
return (
<div className="bg-bunker-800 h-screen flex flex-col items-center justify-center">
<Head>
- <title>{t("common:head-title", { title: t("signup:title") })}</title>
+ <title>{t('common:head-title', { title: t('signup:title') })}</title>
<link rel="icon" href="/infisical.ico" />
<meta property="og:image" content="/images/message.png" />
- <meta property="og:title" content={t("signup:og-title") as string} />
- <meta
- name="og:description"
- content={t("signup:og-description") as string}
- />
+ <meta property="og:title" content={t('signup:og-title') as string} />
+ <meta name="og:description" content={t('signup:og-description') as string} />
</Head>
<div className="flex flex-col justify-center items-center">
<Link href="/">
<div className="flex justify-center mb-2 md:mb-8 cursor-pointer">
- <Image
- src="/images/biglogo.png"
- height={90}
- width={120}
- alt="Infisical Wide Logo"
- />
+ <Image src="/images/biglogo.png" height={90} width={120} alt="Infisical Wide Logo" />
</div>
</Link>
<form onSubmit={(e) => e.preventDefault()}>
- {step == 1 ? <EnterEmailStep email={email} setEmail={setEmail} incrementStep={incrementStep} />
- : step == 2 ? <CodeInputStep email={email} incrementStep={incrementStep} setCode={setCode} codeError={codeError}/>
- : step == 3 ? <UserInfoStep verificationToken={verificationToken} incrementStep={incrementStep} email={email} password={password} setPassword={setPassword} firstName={firstName} setFirstName={setFirstName} lastName={lastName} setLastName={setLastName}/>
- : step == 4 ? <DownloadBackupPDF incrementStep={incrementStep} email={email} password={password} name={firstName + " " + lastName} />
- : <TeamInviteStep/>}
+ {step === 1 ? (
+ <EnterEmailStep email={email} setEmail={setEmail} incrementStep={incrementStep} />
+ ) : step === 2 ? (
+ <CodeInputStep
+ email={email}
+ incrementStep={incrementStep}
+ setCode={setCode}
+ codeError={codeError}
+ />
+ ) : step === 3 ? (
+ <UserInfoStep
+ verificationToken={verificationToken}
+ incrementStep={incrementStep}
+ email={email}
+ password={password}
+ setPassword={setPassword}
+ firstName={firstName}
+ setFirstName={setFirstName}
+ lastName={lastName}
+ setLastName={setLastName}
+ />
+ ) : step === 4 ? (
+ <DownloadBackupPDF
+ incrementStep={incrementStep}
+ email={email}
+ password={password}
+ name={`${firstName} ${lastName}`}
+ />
+ ) : (
+ <TeamInviteStep />
+ )}
</form>
</div>
</div>
);
}
-export const getStaticProps = getTranslatedStaticProps([
- "auth",
- "signup",
- "section-password",
-]);
+export const getStaticProps = getTranslatedStaticProps(['auth', 'signup', 'section-password']);
diff --git a/frontend/src/pages/signupinvite.tsx b/frontend/src/pages/signupinvite.tsx
index 3975d762c9..4c1c60733a 100644
--- a/frontend/src/pages/signupinvite.tsx
+++ b/frontend/src/pages/signupinvite.tsx
@@ -1,8 +1,16 @@
+/* eslint-disable no-nested-ternary */
+/* eslint-disable @typescript-eslint/no-unused-vars */
import { useState } from 'react';
import Head from 'next/head';
import Image from 'next/image';
import Link from 'next/link';
import { useRouter } from 'next/router';
+import Button from '@app/components/basic/buttons/Button';
+import InputField from '@app/components/basic/InputField';
+import attemptLogin from '@app/components/utilities/attemptLogin';
+import passwordCheck from '@app/components/utilities/checks/PasswordCheck';
+import Aes256Gcm from '@app/components/utilities/cryptography/aes-256-gcm';
+import issueBackupKey from '@app/components/utilities/cryptography/issueBackupKey';
import { faCheck, faWarning, faX } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import jsrp from 'jsrp';
@@ -10,16 +18,10 @@ import queryString from 'query-string';
import nacl from 'tweetnacl';
import { encodeBase64 } from 'tweetnacl-util';
-import Button from '~/components/basic/buttons/Button';
-import InputField from '~/components/basic/InputField';
-import Aes256Gcm from '~/components/utilities/cryptography/aes-256-gcm';
-import issueBackupKey from '~/components/utilities/cryptography/issueBackupKey';
-import attemptLogin from '~/utilities/attemptLogin';
-import passwordCheck from '~/utilities/checks/PasswordCheck';
-
import completeAccountInformationSignupInvite from './api/auth/CompleteAccountInformationSignupInvite';
import verifySignupInvite from './api/auth/VerifySignupInvite';
+// eslint-disable-next-line new-cap
const client = new jsrp.client();
export default function SignupInvite() {
@@ -64,7 +66,7 @@ export default function SignupInvite() {
setPasswordErrorLength,
setPasswordErrorNumber,
setPasswordErrorLowerCase,
- errorCheck,
+ errorCheck
});
if (!errorCheck) {
@@ -79,10 +81,7 @@ export default function SignupInvite() {
text: PRIVATE_KEY,
secret: password
.slice(0, 32)
- .padStart(
- 32 + (password.slice(0, 32).length - new Blob([password]).size),
- '0'
- ),
+ .padStart(32 + (password.slice(0, 32).length - new Blob([password]).size), '0')
});
localStorage.setItem('PRIVATE_KEY', PRIVATE_KEY);
@@ -90,7 +89,7 @@ export default function SignupInvite() {
client.init(
{
username: email,
- password: password,
+ password
},
async () => {
client.createVerifier(async (err, result) => {
@@ -104,11 +103,11 @@ export default function SignupInvite() {
tag,
salt: result.salt,
verifier: result.verifier,
- token: verificationToken,
+ token: verificationToken
});
// if everything works, go the main dashboard page.
- if (!errorCheck && response.status == 200) {
+ if (!errorCheck && response.status === 200) {
response = await response.json();
localStorage.setItem('publicKey', PUBLIC_KEY);
@@ -117,14 +116,7 @@ export default function SignupInvite() {
localStorage.setItem('tag', tag);
try {
- await attemptLogin(
- email,
- password,
- setErrorLogin,
- router,
- false,
- false
- );
+ await attemptLogin(email, password, setErrorLogin, router, false, false);
setStep(3);
} catch (error) {
setIsLoading(false);
@@ -141,25 +133,20 @@ export default function SignupInvite() {
// Step 4 of the sign up process (download the emergency kit pdf)
const stepConfirmEmail = (
- <div className='bg-bunker flex flex-col items-center w-full max-w-xs md:max-w-lg mx-auto h-7/12 py-8 px-4 md:px-6 mx-1 mb-36 md:mb-16 rounded-xl drop-shadow-xl'>
- <p className='text-4xl text-center font-semibold mb-6 flex justify-center text-primary-100'>
+ <div className="bg-bunker flex flex-col items-center w-full max-w-xs md:max-w-lg h-7/12 py-8 px-4 md:px-6 mx-1 mb-36 md:mb-16 rounded-xl drop-shadow-xl">
+ <p className="text-4xl text-center font-semibold mb-6 flex justify-center text-primary-100">
Confirm your email
</p>
- <Image
- src='/images/dragon-signupinvite.svg'
- height={262}
- width={410}
- alt='verify email'
- ></Image>
- <div className='flex flex-col items-center justify-center md:p-2 max-h-24 max-w-md mx-auto text-lg px-4 mt-10 mb-2'>
+ <Image src="/images/dragon-signupinvite.svg" height={262} width={410} alt="verify email" />
+ <div className="flex flex-col items-center justify-center md:p-2 max-h-24 max-w-md mx-auto text-lg px-4 mt-10 mb-2">
<Button
- text='Confirm Email'
+ text="Confirm Email"
onButtonPressed={async () => {
const response = await verifySignupInvite({
email,
- code: token,
+ code: token
});
- if (response.status == 200) {
+ if (response.status === 200) {
const res = await response.json();
// user will have temp token if doesn't have an account
// then continue with account setup workflow
@@ -176,7 +163,7 @@ export default function SignupInvite() {
router.push('/requestnewinvite');
}
}}
- size='lg'
+ size="lg"
/>
</div>
</div>
@@ -184,136 +171,102 @@ export default function SignupInvite() {
// Because this is the invite signup - we directly go to the last step of signup (email is already verified)
const main = (
- <div className='bg-bunker w-max mx-auto h-7/12 py-10 px-8 rounded-xl drop-shadow-xl mb-32 md:mb-16'>
- <p className='text-4xl font-bold flex justify-center mb-6 text-gray-400 mx-8 md:mx-16 text-transparent bg-clip-text bg-gradient-to-br from-sky-400 to-primary'>
+ <div className="bg-bunker w-max mx-auto h-7/12 py-10 px-8 rounded-xl drop-shadow-xl mb-32 md:mb-16">
+ <p className="text-4xl font-bold flex justify-center mb-6 text-gray-400 mx-8 md:mx-16 text-transparent bg-clip-text bg-gradient-to-br from-sky-400 to-primary">
Almost there!
</p>
- <div className='relative z-0 flex items-center justify-end w-full md:p-2 rounded-lg max-h-24'>
+ <div className="relative z-0 flex items-center justify-end w-full md:p-2 rounded-lg max-h-24">
<InputField
- label='First Name'
+ label="First Name"
onChangeHandler={setFirstName}
- type='name'
+ type="name"
value={firstName}
isRequired
- errorText='Please input your first name.'
+ errorText="Please input your first name."
error={firstNameError}
- autoComplete='given-name'
+ autoComplete="given-name"
/>
</div>
- <div className='flex items-center justify-center w-full md:p-2 rounded-lg max-h-24'>
+ <div className="flex items-center justify-center w-full md:p-2 rounded-lg max-h-24">
<InputField
- label='Last Name'
+ label="Last Name"
onChangeHandler={setLastName}
- type='name'
+ type="name"
value={lastName}
isRequired
- errorText='Please input your last name.'
+ errorText="Please input your last name."
error={lastNameError}
- autoComplete='family-name'
+ autoComplete="family-name"
/>
</div>
- <div className='mt-2 flex flex-col items-center justify-center w-full md:p-2 rounded-lg max-h-60'>
+ <div className="mt-2 flex flex-col items-center justify-center w-full md:p-2 rounded-lg max-h-60">
<InputField
- label='Password'
- onChangeHandler={(password) => {
- setPassword(password);
+ label="Password"
+ onChangeHandler={(pass) => {
+ setPassword(pass);
passwordCheck({
- password,
+ password: pass,
setPasswordErrorLength,
setPasswordErrorNumber,
setPasswordErrorLowerCase,
- errorCheck: false,
+ errorCheck: false
});
}}
- type='password'
+ type="password"
value={password}
isRequired
- error={
- passwordErrorLength && passwordErrorNumber && passwordErrorLowerCase
- }
- autoComplete='new-password'
- id='new-password'
+ error={passwordErrorLength && passwordErrorNumber && passwordErrorLowerCase}
+ autoComplete="new-password"
+ id="new-password"
/>
- {passwordErrorLength ||
- passwordErrorLowerCase ||
- passwordErrorNumber ? (
- <div className='w-full mt-4 bg-white/5 px-2 flex flex-col items-start py-2 rounded-md'>
- <div className={`text-gray-400 text-sm mb-1`}>
- Password should contain at least:
- </div>
- <div className='flex flex-row justify-start items-center ml-1'>
+ {passwordErrorLength || passwordErrorLowerCase || passwordErrorNumber ? (
+ <div className="w-full mt-4 bg-white/5 px-2 flex flex-col items-start py-2 rounded-md">
+ <div className="text-gray-400 text-sm mb-1">Password should contain at least:</div>
+ <div className="flex flex-row justify-start items-center ml-1">
{passwordErrorLength ? (
- <FontAwesomeIcon
- icon={faX}
- className='text-md text-red mr-2.5'
- />
+ <FontAwesomeIcon icon={faX} className="text-md text-red mr-2.5" />
) : (
- <FontAwesomeIcon
- icon={faCheck}
- className='text-md text-primary mr-2'
- />
+ <FontAwesomeIcon icon={faCheck} className="text-md text-primary mr-2" />
)}
- <div
- className={`${
- passwordErrorLength ? 'text-gray-400' : 'text-gray-600'
- } text-sm`}
- >
+ <div className={`${passwordErrorLength ? 'text-gray-400' : 'text-gray-600'} text-sm`}>
14 characters
</div>
</div>
- <div className='flex flex-row justify-start items-center ml-1'>
+ <div className="flex flex-row justify-start items-center ml-1">
{passwordErrorLowerCase ? (
- <FontAwesomeIcon
- icon={faX}
- className='text-md text-red mr-2.5'
- />
+ <FontAwesomeIcon icon={faX} className="text-md text-red mr-2.5" />
) : (
- <FontAwesomeIcon
- icon={faCheck}
- className='text-md text-primary mr-2'
- />
+ <FontAwesomeIcon icon={faCheck} className="text-md text-primary mr-2" />
)}
<div
- className={`${
- passwordErrorLowerCase ? 'text-gray-400' : 'text-gray-600'
- } text-sm`}
+ className={`${passwordErrorLowerCase ? 'text-gray-400' : 'text-gray-600'} text-sm`}
>
1 lowercase character
</div>
</div>
- <div className='flex flex-row justify-start items-center ml-1'>
+ <div className="flex flex-row justify-start items-center ml-1">
{passwordErrorNumber ? (
- <FontAwesomeIcon
- icon={faX}
- className='text-md text-red mr-2.5'
- />
+ <FontAwesomeIcon icon={faX} className="text-md text-red mr-2.5" />
) : (
- <FontAwesomeIcon
- icon={faCheck}
- className='text-md text-primary mr-2'
- />
+ <FontAwesomeIcon icon={faCheck} className="text-md text-primary mr-2" />
)}
- <div
- className={`${
- passwordErrorNumber ? 'text-gray-400' : 'text-gray-600'
- } text-sm`}
- >
+ <div className={`${passwordErrorNumber ? 'text-gray-400' : 'text-gray-600'} text-sm`}>
1 number
</div>
</div>
</div>
) : (
- <div className='py-2'></div>
+ <div className="py-2" />
)}
</div>
- <div className='flex flex-col items-center justify-center md:px-4 md:py-5 mt-2 px-2 py-3 max-h-24 max-w-max mx-auto text-lg'>
+ <div className="flex flex-col items-center justify-center md:px-4 md:py-5 mt-2 px-2 py-3 max-h-24 max-w-max mx-auto text-lg">
<Button
- text='Sign Up'
+ text="Sign Up"
onButtonPressed={() => {
signupErrorCheck();
}}
loading={isLoading}
- size='lg'
+ size="lg"
/>
</div>
</div>
@@ -321,38 +274,34 @@ export default function SignupInvite() {
// Step 4 of the sign up process (download the emergency kit pdf)
const step4 = (
- <div className='bg-bunker flex flex-col items-center w-full max-w-xs md:max-w-lg mx-auto h-7/12 py-8 px-4 md:px-6 mx-1 mb-36 md:mb-16 rounded-xl drop-shadow-xl'>
- <p className='text-4xl text-center font-semibold flex justify-center text-transparent bg-clip-text bg-gradient-to-br from-sky-400 to-primary'>
+ <div className="bg-bunker flex flex-col items-center w-full max-w-xs md:max-w-lg h-7/12 py-8 px-4 md:px-6 mx-1 mb-36 md:mb-16 rounded-xl drop-shadow-xl">
+ <p className="text-4xl text-center font-semibold flex justify-center text-transparent bg-clip-text bg-gradient-to-br from-sky-400 to-primary">
Save your Emergency Kit
</p>
- <div className='flex flex-col items-center justify-center w-full mt-4 md:mt-8 max-w-md text-gray-400 text-md rounded-md px-2'>
+ <div className="flex flex-col items-center justify-center w-full mt-4 md:mt-8 max-w-md text-gray-400 text-md rounded-md px-2">
<div>
- If you get locked out of your account, your Emergency Kit is the only
- way to sign in.
- </div>
- <div className='mt-3'>
- We recommend you download it and keep it somewhere safe.
+ If you get locked out of your account, your Emergency Kit is the only way to sign in.
</div>
+ <div className="mt-3">We recommend you download it and keep it somewhere safe.</div>
</div>
- <div className='w-full p-2 flex flex-row items-center bg-white/10 text-gray-400 rounded-md max-w-xs md:max-w-md mx-auto mt-4'>
- <FontAwesomeIcon icon={faWarning} className='ml-2 mr-4 text-4xl' />
- It contains your Secret Key which we cannot access or recover for you if
- you lose it.
+ <div className="w-full p-2 flex flex-row items-center bg-white/10 text-gray-400 rounded-md max-w-xs md:max-w-md mx-auto mt-4">
+ <FontAwesomeIcon icon={faWarning} className="ml-2 mr-4 text-4xl" />
+ It contains your Secret Key which we cannot access or recover for you if you lose it.
</div>
- <div className='flex flex-col items-center justify-center md:px-4 md:py-5 mt-2 px-2 py-3 max-h-24 max-w-max mx-auto text-lg'>
+ <div className="flex flex-col items-center justify-center md:px-4 md:py-5 mt-2 px-2 py-3 max-h-24 max-w-max mx-auto text-lg">
<Button
- text='Download PDF'
+ text="Download PDF"
onButtonPressed={async () => {
await issueBackupKey({
email,
password,
- personalName: firstName + ' ' + lastName,
+ personalName: `${firstName} ${lastName}`,
setBackupKeyError,
- setBackupKeyIssued,
+ setBackupKeyIssued
});
router.push('/noprojects/');
}}
- size='lg'
+ size="lg"
/>
{/* <div
className="text-l mt-4 text-lg text-gray-400 hover:text-gray-300 duration-200 bg-white/5 px-8 hover:bg-white/10 py-3 rounded-md cursor-pointer"
@@ -371,22 +320,17 @@ export default function SignupInvite() {
);
return (
- <div className='bg-bunker-800 h-screen flex flex-col items-center justify-center'>
+ <div className="bg-bunker-800 h-screen flex flex-col items-center justify-center">
<Head>
<title>Sign Up</title>
- <link rel='icon' href='/infisical.ico' />
+ <link rel="icon" href="/infisical.ico" />
</Head>
- <Link href='/'>
- <div className='flex justify-center mb-2 md:mb-4 opacity-80 cursor-pointer'>
- <Image
- src='/images/biglogo.png'
- height={90}
- width={120}
- alt='Infisical Wide Logo'
- />
+ <Link href="/">
+ <div className="flex justify-center mb-2 md:mb-4 opacity-80 cursor-pointer">
+ <Image src="/images/biglogo.png" height={90} width={120} alt="Infisical Wide Logo" />
</div>
</Link>
- {step == 1 ? stepConfirmEmail : step == 2 ? main : step4}
+ {step === 1 ? stepConfirmEmail : step === 2 ? main : step4}
</div>
);
}
diff --git a/frontend/src/pages/users/[id].tsx b/frontend/src/pages/users/[id].tsx
index 46ddc6657e..22dafaa2cc 100644
--- a/frontend/src/pages/users/[id].tsx
+++ b/frontend/src/pages/users/[id].tsx
@@ -3,19 +3,22 @@ import Head from 'next/head';
import Image from 'next/image';
import { useRouter } from 'next/router';
import { useTranslation } from 'next-i18next';
+import Button from '@app/components/basic/buttons/Button';
+import AddProjectMemberDialog from '@app/components/basic/dialog/AddProjectMemberDialog';
+import UserTable from '@app/components/basic/table/UserTable';
+import NavHeader from '@app/components/navigation/NavHeader';
+import guidGenerator from '@app/components/utilities/randomId';
+import { getTranslatedServerSideProps } from '@app/components/utilities/withTranslateProps';
import { faMagnifyingGlass, faPlus } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import Button from '~/components/basic/buttons/Button';
-import AddProjectMemberDialog from '~/components/basic/dialog/AddProjectMemberDialog';
-import UserTable from '~/components/basic/table/UserTable';
-import NavHeader from '~/components/navigation/NavHeader';
-import guidGenerator from '~/utilities/randomId';
-import { getTranslatedServerSideProps } from '~/utilities/withTranslateProps';
-
+import {
+ decryptAssymmetric,
+ encryptAssymmetric
+} from '../../components/utilities/cryptography/crypto';
import getOrganizationUsers from '../api/organization/GetOrgUsers';
import getUser from '../api/user/getUser';
-// import DeleteUserDialog from '~/components/basic/dialog/DeleteUserDialog';
+// import DeleteUserDialog from '@app/components/basic/dialog/DeleteUserDialog';
import addUserToWorkspace from '../api/workspace/addUserToWorkspace';
import getWorkspaceUsers from '../api/workspace/getWorkspaceUsers';
import uploadKeys from '../api/workspace/uploadKeys';
@@ -37,13 +40,6 @@ interface MembershipProps {
}
// #TODO: Update all the workspaceIds
-const crypto = require('crypto');
-const {
- decryptAssymmetric,
- encryptAssymmetric,
-} = require('../../components/utilities/cryptography/crypto');
-const nacl = require('tweetnacl');
-nacl.util = require('tweetnacl-util');
export default function Users() {
const [isAddOpen, setIsAddOpen] = useState(false);
@@ -56,11 +52,57 @@ export default function Users() {
const { t } = useTranslation();
const router = useRouter();
- let workspaceId;
+ const workspaceId = router.query.id as string;
+
+ const [userList, setUserList] = useState<any[]>([]);
+ const [orgUserList, setOrgUserList] = useState<any[]>([]);
+
+ useEffect(() => {
+ (async () => {
+ const user = await getUser();
+ setPersonalEmail(user.email);
+
+ // This part quiries the current users of a project
+ const workspaceUsers = await getWorkspaceUsers({
+ workspaceId
+ });
+ const tempUserList = workspaceUsers.map((membership: MembershipProps) => ({
+ key: guidGenerator(),
+ firstName: membership.user?.firstName,
+ lastName: membership.user?.lastName,
+ email: membership.user?.email === null ? membership.inviteEmail : membership.user?.email,
+ role: membership?.role,
+ status: membership?.status,
+ userId: membership.user?._id,
+ membershipId: membership._id,
+ publicKey: membership.user?.publicKey
+ }));
+ setUserList(tempUserList);
- function closeAddModal() {
+ // This is needed to know wha users from an org (if any), we are able to add to a certain project
+ const orgUsers = await getOrganizationUsers({
+ orgId: String(localStorage.getItem('orgData.id'))
+ });
+ setOrgUserList(orgUsers);
+ setEmail(
+ orgUsers
+ ?.filter((membership: MembershipProps) => membership.status === 'accepted')
+ .map((membership: MembershipProps) => membership.user.email)
+ .filter(
+ (usEmail: string) =>
+ !tempUserList?.map((user1: UserProps) => user1.email).includes(usEmail)
+ )[0]
+ );
+ })();
+ }, []);
+
+ const closeAddModal = () => {
setIsAddOpen(false);
- }
+ };
+
+ const openAddModal = () => {
+ setIsAddOpen(true);
+ };
// function closeDeleteModal() {
// setIsDeleteOpen(false);
@@ -74,111 +116,42 @@ export default function Users() {
// setIsDeleteOpen(true);
// }
- async function submitAddModal() {
- const result = await addUserToWorkspace(email, String(router.query.id));
+ const submitAddModal = async () => {
+ const result = await addUserToWorkspace(email, workspaceId);
if (result?.invitee && result?.latestKey) {
- const PRIVATE_KEY = localStorage.getItem('PRIVATE_KEY');
+ const PRIVATE_KEY = localStorage.getItem('PRIVATE_KEY') as string;
// assymmetrically decrypt symmetric key with local private key
const key = decryptAssymmetric({
ciphertext: result.latestKey.encryptedKey,
nonce: result.latestKey.nonce,
publicKey: result.latestKey.sender.publicKey,
- privateKey: PRIVATE_KEY,
+ privateKey: PRIVATE_KEY
});
const { ciphertext, nonce } = encryptAssymmetric({
plaintext: key,
publicKey: result.invitee.publicKey,
- privateKey: PRIVATE_KEY,
+ privateKey: PRIVATE_KEY
});
- uploadKeys(
- String(router.query.id),
- result.invitee._id,
- ciphertext,
- nonce
- );
+ uploadKeys(workspaceId, result.invitee._id, ciphertext, nonce);
}
setEmail('');
setIsAddOpen(false);
router.reload();
- }
-
- function openAddModal() {
- setIsAddOpen(true);
- }
-
- const [userList, setUserList] = useState([]);
- const [orgUserList, setOrgUserList] = useState<any[]>([]);
-
- useEffect(() => {
- (async () => {
- const user = await getUser();
- setPersonalEmail(user.email);
-
- // This part quiries the current users of a project
- const workspaceUsers = await getWorkspaceUsers({
- workspaceId: String(router.query.id),
- });
- const tempUserList = workspaceUsers.map(
- (membership: MembershipProps) => ({
- key: guidGenerator(),
- firstName: membership.user?.firstName,
- lastName: membership.user?.lastName,
- email:
- membership.user?.email == null
- ? membership.inviteEmail
- : membership.user?.email,
- role: membership?.role,
- status: membership?.status,
- userId: membership.user?._id,
- membershipId: membership._id,
- publicKey: membership.user?.publicKey,
- })
- );
- setUserList(tempUserList);
-
- // This is needed to know wha users from an org (if any), we are able to add to a certain project
- const orgUsers = await getOrganizationUsers({
- orgId: String(localStorage.getItem('orgData.id')),
- });
- setOrgUserList(orgUsers);
- setEmail(
- orgUsers
- ?.filter(
- (membership: MembershipProps) => membership.status == 'accepted'
- )
- .map((membership: MembershipProps) => membership.user.email)
- .filter(
- (email: string) =>
- !tempUserList
- ?.map((user1: UserProps) => user1.email)
- .includes(email)
- )[0]
- );
- })();
- }, []);
+ };
return userList ? (
- <div className='bg-bunker-800 md:h-screen flex flex-col justify-start'>
+ <div className="bg-bunker-800 md:h-screen flex flex-col justify-start">
<Head>
- <title>
- {t('common:head-title', { title: t('settings-members:title') })}
- </title>
- <link rel='icon' href='/infisical.ico' />
+ <title>{t('common:head-title', { title: t('settings-members:title') })}</title>
+ <link rel="icon" href="/infisical.ico" />
</Head>
- <NavHeader
- pageName={t('settings-members:title')}
- isProjectRelated={true}
- />
- <div className='flex flex-col justify-start items-start px-6 py-6 pb-4 text-3xl'>
- <p className='font-semibold mr-4 text-white'>
- {t('settings-members:title')}
- </p>
- <p className='mr-4 text-base text-gray-400'>
- {t('settings-members:description')}
- </p>
+ <NavHeader pageName={t('settings-members:title')} isProjectRelated />
+ <div className="flex flex-col justify-start items-start px-6 py-6 pb-4 text-3xl">
+ <p className="font-semibold mr-4 text-white">{t('settings-members:title')}</p>
+ <p className="mr-4 text-base text-gray-400">{t('settings-members:description')}</p>
</div>
<AddProjectMemberDialog
isOpen={isAddOpen}
@@ -186,41 +159,38 @@ export default function Users() {
submitModal={submitAddModal}
email={email}
data={orgUserList
- ?.filter(
- (membership: MembershipProps) => membership.status == 'accepted'
- )
+ ?.filter((membership: MembershipProps) => membership.status === 'accepted')
.map((membership: MembershipProps) => membership.user.email)
.filter(
- (email) =>
- !userList?.map((user1: UserProps) => user1.email).includes(email)
+ (orgEmail) => !userList?.map((user1: UserProps) => user1.email).includes(orgEmail)
)}
setEmail={setEmail}
/>
{/* <DeleteUserDialog isOpen={isDeleteOpen} closeModal={closeDeleteModal} submitModal={deleteMembership} userIdToBeDeleted={userIdToBeDeleted}/> */}
- <div className='px-6 pb-1 w-full flex flex-row items-start min-w-6xl max-w-6xl'>
- <div className='h-10 w-full bg-white/5 mt-2 flex items-center rounded-md flex flex-row items-center'>
+ <div className="px-6 pb-1 w-full flex flex-row items-start min-w-6xl max-w-6xl">
+ <div className="h-10 w-full bg-white/5 mt-2 rounded-md flex flex-row items-center">
<FontAwesomeIcon
- className='bg-white/5 rounded-l-md py-3 pl-4 pr-2 text-gray-400'
+ className="bg-white/5 rounded-l-md py-3 pl-4 pr-2 text-gray-400"
icon={faMagnifyingGlass}
/>
<input
- className='pl-2 text-gray-400 rounded-r-md bg-white/5 w-full h-full outline-none'
+ className="pl-2 text-gray-400 rounded-r-md bg-white/5 w-full h-full outline-none"
value={searchUsers}
onChange={(e) => setSearchUsers(e.target.value)}
placeholder={String(t('section-members:search-members'))}
/>
</div>
- <div className='mt-2 ml-2 min-w-max flex flex-row items-start justify-start'>
+ <div className="mt-2 ml-2 min-w-max flex flex-row items-start justify-start">
<Button
text={String(t('section-members:add-member'))}
onButtonPressed={openAddModal}
- color='mineshaft'
- size='md'
+ color="mineshaft"
+ size="md"
icon={faPlus}
/>
</div>
</div>
- <div className='block overflow-y-auto min-w-6xl max-w-6xl px-6'>
+ <div className="block overflow-y-auto min-w-6xl max-w-6xl px-6">
<UserTable
userData={userList}
changeData={setUserList}
@@ -235,14 +205,9 @@ export default function Users() {
</div>
</div>
) : (
- <div className='relative z-10 w-10/12 mr-auto h-full ml-2 bg-bunker-800 flex flex-col items-center justify-center'>
- <div className='absolute top-0 bg-bunker h-14 border-b border-mineshaft-700 w-full'></div>
- <Image
- src='/images/loading/loading.gif'
- height={70}
- width={120}
- alt='loading animation'
- ></Image>
+ <div className="relative z-10 w-10/12 mr-auto h-full ml-2 bg-bunker-800 flex flex-col items-center justify-center">
+ <div className="absolute top-0 bg-bunker h-14 border-b border-mineshaft-700 w-full" />
+ <Image src="/images/loading/loading.gif" height={70} width={120} alt="loading animation" />
</div>
);
}
@@ -252,5 +217,5 @@ Users.requireAuth = true;
export const getServerSideProps = getTranslatedServerSideProps([
'settings',
'settings-members',
- 'section-members',
+ 'section-members'
]);
diff --git a/frontend/src/pages/vercel.tsx b/frontend/src/pages/vercel.tsx
index a6fa3c80d5..8e82457367 100644
--- a/frontend/src/pages/vercel.tsx
+++ b/frontend/src/pages/vercel.tsx
@@ -7,8 +7,8 @@ import AuthorizeIntegration from './api/integrations/authorizeIntegration';
export default function Vercel() {
const router = useRouter();
const parsedUrl = queryString.parse(router.asPath.split('?')[1]);
- const code = parsedUrl.code;
- const state = parsedUrl.state;
+ const {code} = parsedUrl;
+ const {state} = parsedUrl;
/**
* Here we forward to the default workspace if a user opens this url
@@ -30,7 +30,7 @@ export default function Vercel() {
});
router.push(
- '/integrations/' + localStorage.getItem('projectData.id')
+ `/integrations/${ localStorage.getItem('projectData.id')}`
);
}
} catch (err) {
@@ -40,7 +40,7 @@ export default function Vercel() {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
- return <div></div>;
+ return <div />;
}
Vercel.requireAuth = true;
diff --git a/frontend/src/pages/verify-email.tsx b/frontend/src/pages/verify-email.tsx
index 0831a3a2e2..6263572805 100644
--- a/frontend/src/pages/verify-email.tsx
+++ b/frontend/src/pages/verify-email.tsx
@@ -1,16 +1,15 @@
-import { useState } from "react";
-import Head from "next/head";
-import Image from "next/image";
-import Link from "next/link";
+import { useState } from 'react';
+import Head from 'next/head';
+import Image from 'next/image';
+import Link from 'next/link';
+import Button from '@app/components/basic/buttons/Button';
+import InputField from '@app/components/basic/InputField';
+import { getTranslatedStaticProps } from '@app/components/utilities/withTranslateProps';
-import Button from "~/components/basic/buttons/Button";
-import InputField from "~/components/basic/InputField";
-import { getTranslatedStaticProps } from "~/components/utilities/withTranslateProps";
-
-import SendEmailOnPasswordReset from "./api/auth/SendEmailOnPasswordReset";
+import SendEmailOnPasswordReset from './api/auth/SendEmailOnPasswordReset';
export default function VerifyEmail() {
- const [email, setEmail] = useState("");
+ const [email, setEmail] = useState('');
const [step, setStep] = useState(1);
/**
@@ -37,23 +36,17 @@ export default function VerifyEmail() {
</Head>
<Link href="/">
<div className="flex justify-center mb-8 mt-20 cursor-pointer">
- <Image
- src="/images/biglogo.png"
- height={90}
- width={120}
- alt="long logo"
- />
+ <Image src="/images/biglogo.png" height={90} width={120} alt="long logo" />
</div>
</Link>
- {step == 1 && (
+ {step === 1 && (
<div className="bg-bunker w-full max-w-md mx-auto h-7/12 py-4 pt-8 px-6 rounded-xl drop-shadow-xl">
<p className="text-2xl md:text-3xl w-max mx-auto flex justify-center font-semibold text-bunker-100 mb-6">
Forgot your password?
</p>
<div className="flex flex-row items-center justify-center md:pb-4 mt-4 md:mx-2">
<p className="text-sm flex justify-center text-gray-400 w-max">
- You will need your emergency kit. Enter your email to start
- account recovery.
+ You will need your emergency kit. Enter your email to start account recovery.
</p>
</div>
<div className="flex items-center justify-center w-full md:p-2 rounded-lg mt-4 md:mt-0 max-h-24 md:max-h-28">
@@ -69,16 +62,12 @@ export default function VerifyEmail() {
</div>
<div className="flex flex-col items-center justify-center w-full md:p-2 max-h-20 max-w-md mt-4 mx-auto text-sm">
<div className="text-l mt-6 m-8 px-8 py-3 text-lg">
- <Button
- text="Continue"
- onButtonPressed={sendVerificationEmail}
- size="lg"
- />
+ <Button text="Continue" onButtonPressed={sendVerificationEmail} size="lg" />
</div>
</div>
</div>
)}
- {step == 2 && (
+ {step === 2 && (
<div className="bg-bunker w-full max-w-md mx-auto h-7/12 py-4 pt-8 px-6 rounded-xl drop-shadow-xl">
<p className="text-xl md:text-2xl w-max mx-auto flex justify-center font-semibold text-bunker-100 mb-6">
Look for an email in your inbox.
diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json
index c554a0683c..70fc385b9a 100644
--- a/frontend/tsconfig.json
+++ b/frontend/tsconfig.json
@@ -25,6 +25,6 @@
"jsx": "preserve",
"incremental": true
},
- "include": ["next-env.d.ts", "./src/**/*.ts", "./src/**/*.tsx"],
+ "include": ["next-env.d.ts", "./src/**/*.ts", "./src/**/*.tsx", "./.eslintrc.js"],
"exclude": ["node_modules"]
}