From cf7834bfc38dfbeea3d27c2f71ef7c83805fd767 Mon Sep 17 00:00:00 2001 From: akhilmhdh Date: Tue, 17 Jan 2023 20:53:35 +0530 Subject: [PATCH 1/3] chore(frontend): fixed all eslint errors --- frontend/.eslintrc | 49 - frontend/.eslintrc.js | 72 + frontend/.prettierrc | 7 + frontend/package-lock.json | 1789 ++++++++++++----- frontend/package.json | 15 +- frontend/src/components/RouteGuard.tsx | 63 +- frontend/src/components/analytics/posthog.ts | 4 +- frontend/src/components/basic/Error.tsx | 17 +- frontend/src/components/basic/EventFilter.tsx | 72 +- frontend/src/components/basic/InputField.tsx | 188 +- frontend/src/components/basic/Layout.tsx | 322 ++- frontend/src/components/basic/Listbox.tsx | 67 +- frontend/src/components/basic/Toggle.tsx | 15 +- .../src/components/basic/buttons/Button.tsx | 123 +- .../basic/dialog/ActivateBotDialog.tsx | 53 +- .../basic/dialog/AddApiKeyDialog.tsx | 14 +- .../basic/dialog/AddIncidentContactDialog.tsx | 4 +- .../basic/dialog/AddProjectMemberDialog.tsx | 111 +- .../basic/dialog/AddServiceTokenDialog.tsx | 18 +- .../components/basic/dialog/AddUserDialog.tsx | 7 +- .../components/basic/dialog/DeleteEnvVar.tsx | 14 +- .../dialog/IntegrationAccessTokenDialog.tsx | 4 +- .../basic/popups/BottomRightPopup.tsx | 43 +- .../components/basic/table/ApiKeyTable.tsx | 71 +- .../src/components/basic/table/Checkbox.tsx | 51 +- .../basic/table/EnvironmentsTable.tsx | 127 +- .../basic/table/ServiceTokenTable.tsx | 83 +- .../src/components/basic/table/UserTable.js | 241 --- .../src/components/basic/table/UserTable.tsx | 218 ++ frontend/src/components/billing/Plan.tsx | 61 +- .../context/Notifications/Notification.tsx | 36 +- .../Notifications/NotificationProvider.tsx | 67 +- .../context/Notifications/Notifications.tsx | 18 +- .../src/components/dashboard/CommentField.tsx | 34 +- .../dashboard/DashboardInputField.tsx | 49 +- .../dashboard/DeleteActionButton.tsx | 2 +- .../dashboard/DownloadSecretsMenu.tsx | 91 +- .../src/components/dashboard/DropZone.tsx | 83 +- .../dashboard/GenerateSecretMenu.tsx | 159 +- frontend/src/components/dashboard/KeyPair.tsx | 102 +- frontend/src/components/dashboard/SideBar.tsx | 238 ++- .../integrations/CloudIntegration.tsx | 48 +- .../integrations/CloudIntegrationSection.tsx | 2 +- .../integrations/FrameworkIntegration.tsx | 50 +- .../components/integrations/Integration.tsx | 434 ++-- .../integrations/IntegrationSection.tsx | 26 +- .../components/navigation/NavBarDashboard.tsx | 160 +- .../src/components/navigation/NavHeader.tsx | 33 +- .../src/components/signup/CodeInputStep.tsx | 127 +- .../signup/DonwloadBackupPDFStep.tsx | 24 +- .../src/components/signup/EnterEmailStep.tsx | 57 +- .../src/components/signup/TeamInviteStep.tsx | 52 +- .../src/components/signup/UserInfoStep.tsx | 196 +- .../components/utilities/SecurityClient.ts | 19 +- .../src/components/utilities/attemptLogin.ts | 192 +- .../utilities/checks/OnboardingCheck.ts | 31 +- .../utilities/checks/PasswordCheck.ts | 3 +- .../utilities/cryptography/aes-256-gcm.ts | 7 +- .../utilities/cryptography/changePassword.ts | 31 +- .../utilities/cryptography/crypto.ts | 56 +- .../utilities/cryptography/issueBackupKey.ts | 23 +- .../components/utilities/generateBackupPDF.ts | 24 +- .../src/components/utilities/parseDotEnv.ts | 5 +- frontend/src/components/utilities/randomId.ts | 18 +- .../utilities/saveTokenToLocalStorage.ts | 2 +- .../utilities/secrets/checkOverrides.ts | 26 +- .../utilities/secrets/downloadDotEnv.ts | 28 +- .../utilities/secrets/downloadYaml.ts | 15 +- .../utilities/secrets/encryptSecrets.ts | 60 +- .../utilities/secrets/getSecretsForProject.ts | 65 +- .../utilities/telemetry/Telemetry.ts | 8 +- frontend/src/ee/api/secrets/GetActionData.ts | 28 +- frontend/src/ee/api/secrets/GetProjectLogs.ts | 48 +- .../api/secrets/GetProjectSercetShanpshots.ts | 26 +- .../secrets/GetProjectSercetSnapshotsCount.ts | 30 +- .../ee/api/secrets/GetSecretSnapshotData.ts | 26 +- .../src/ee/api/secrets/GetSecretVersions.ts | 31 +- .../ee/api/secrets/PerformSecretRollback.ts | 39 +- .../src/ee/components/ActivitySideBar.tsx | 228 ++- frontend/src/ee/components/ActivityTable.tsx | 162 +- .../src/ee/components/PITRecoverySidebar.tsx | 223 +- .../src/ee/components/SecretVersionList.tsx | 128 +- .../src/ee/utilities/findTextDifferences.ts | 498 ++--- frontend/src/ee/utilities/timeSince.ts | 12 +- frontend/src/hooks/usePopUp.tsx | 49 +- frontend/src/pages/404.tsx | 2 +- frontend/src/pages/_app.tsx | 28 +- frontend/src/pages/activity/[id].tsx | 142 +- frontend/src/pages/api/apiKey/addAPIKey.ts | 18 +- frontend/src/pages/api/apiKey/deleteAPIKey.ts | 21 +- frontend/src/pages/api/apiKey/getAPIKeys.ts | 26 +- .../src/pages/api/auth/ChangePassword2.ts | 32 +- frontend/src/pages/api/auth/CheckAuth.ts | 7 +- .../api/auth/CheckEmailVerificationCode.ts | 8 +- .../auth/CompleteAccountInformationSignup.ts | 6 +- .../CompleteAccountInformationSignupInvite.ts | 22 +- .../api/auth/EmailVerifyOnPasswordReset.ts | 4 +- .../pages/api/auth/IssueBackupPrivateKey.ts | 19 +- frontend/src/pages/api/auth/Login1.ts | 2 +- frontend/src/pages/api/auth/Login2.ts | 16 +- frontend/src/pages/api/auth/Logout.ts | 13 +- frontend/src/pages/api/auth/SRP1.ts | 15 +- .../api/auth/SendEmailOnPasswordReset.ts | 2 +- .../pages/api/auth/SendVerificationEmail.ts | 2 +- frontend/src/pages/api/auth/Token.ts | 11 +- .../src/pages/api/auth/VerifySignupInvite.ts | 4 +- .../api/auth/getBackupEncryptedPrivateKey.ts | 6 +- .../src/pages/api/auth/publicKeyInfisical.ts | 4 +- .../auth/resetPasswordOnAccountRecovery.ts | 16 +- frontend/src/pages/api/bot/getBot.ts | 26 +- .../src/pages/api/bot/setBotActiveStatus.ts | 42 +- .../api/environments/createEnvironment.ts | 15 +- .../api/environments/deleteEnvironment.ts | 28 +- .../api/environments/updateEnvironment.ts | 28 +- frontend/src/pages/api/files/AddSecrets.ts | 46 +- frontend/src/pages/api/files/DeleteSecrets.ts | 32 +- frontend/src/pages/api/files/GetSecrets.ts | 22 +- frontend/src/pages/api/files/UpdateSecrets.ts | 34 +- frontend/src/pages/api/files/UploadSecrets.ts | 18 +- .../integrations/ChangeHerokuConfigVars.ts | 34 +- .../api/integrations/DeleteIntegration.ts | 13 +- .../api/integrations/DeleteIntegrationAuth.ts | 24 +- .../api/integrations/GetIntegrationApps.ts | 24 +- .../api/integrations/GetIntegrationOptions.ts | 24 +- .../api/integrations/StartIntegration.ts | 13 +- .../api/integrations/authorizeIntegration.ts | 13 +- .../getWorkspaceAuthorizations.ts | 24 +- .../integrations/getWorkspaceIntegrations.ts | 24 +- .../api/integrations/updateIntegration.ts | 65 +- frontend/src/pages/api/organization/GetOrg.ts | 13 +- .../pages/api/organization/GetOrgProjects.ts | 24 +- .../api/organization/GetOrgSubscription.ts | 24 +- .../api/organization/GetOrgUserProjects.ts | 24 +- .../src/pages/api/organization/GetOrgUsers.ts | 25 +- .../pages/api/organization/StripeRedirect.ts | 26 +- .../api/organization/addIncidentContact.ts | 32 +- .../pages/api/organization/addUserToOrg.ts | 13 +- .../api/organization/deleteIncidentContact.ts | 32 +- .../deleteUserFromOrganization.ts | 13 +- .../api/organization/getIncidentContacts.ts | 26 +- .../src/pages/api/organization/getOrgs.ts | 13 +- .../src/pages/api/organization/renameOrg.ts | 13 +- .../pages/api/serviceToken/addServiceToken.ts | 19 +- .../api/serviceToken/deleteServiceToken.ts | 21 +- .../api/serviceToken/getServiceTokens.ts | 24 +- frontend/src/pages/api/user/getUser.ts | 13 +- .../pages/api/userActions/checkUserAction.ts | 20 +- .../api/userActions/registerUserAction.ts | 13 +- .../pages/api/workspace/addUserToWorkspace.ts | 34 +- .../workspace/changeUserRoleInWorkspace.ts | 32 +- .../pages/api/workspace/createWorkspace.ts | 17 +- .../api/workspace/deleteUserFromWorkspace.ts | 13 +- .../pages/api/workspace/deleteWorkspace.ts | 13 +- .../src/pages/api/workspace/getAWorkspace.ts | 13 +- .../pages/api/workspace/getLatestFileKey.ts | 15 +- .../src/pages/api/workspace/getProjectInfo.ts | 13 +- .../pages/api/workspace/getWorkspaceKeys.ts | 24 +- .../pages/api/workspace/getWorkspaceUsers.ts | 24 +- .../src/pages/api/workspace/getWorkspaces.ts | 11 +- .../pages/api/workspace/renameWorkspace.ts | 32 +- .../src/pages/api/workspace/uploadKeys.ts | 24 +- frontend/src/pages/dashboard.tsx | 6 +- frontend/src/pages/dashboard/[id].tsx | 680 ++++--- frontend/src/pages/email-not-verified.tsx | 3 +- frontend/src/pages/github.tsx | 8 +- frontend/src/pages/heroku.tsx | 8 +- frontend/src/pages/home/[id].tsx | 119 +- frontend/src/pages/index.tsx | 2 +- frontend/src/pages/integrations/[id].tsx | 76 +- frontend/src/pages/login.tsx | 110 +- frontend/src/pages/netlify.tsx | 8 +- frontend/src/pages/noprojects.tsx | 40 +- frontend/src/pages/password-reset.tsx | 187 +- frontend/src/pages/requestnewinvite.tsx | 30 +- frontend/src/pages/settings/billing/[id].tsx | 68 +- frontend/src/pages/settings/org/[id].tsx | 222 +- frontend/src/pages/settings/personal/[id].tsx | 229 +-- frontend/src/pages/settings/project/[id].tsx | 205 +- frontend/src/pages/signup.tsx | 109 +- frontend/src/pages/signupinvite.tsx | 222 +- frontend/src/pages/users/[id].tsx | 211 +- frontend/src/pages/vercel.tsx | 8 +- frontend/src/pages/verify-email.tsx | 39 +- frontend/tsconfig.json | 2 +- 184 files changed, 6255 insertions(+), 6117 deletions(-) delete mode 100644 frontend/.eslintrc create mode 100644 frontend/.eslintrc.js create mode 100644 frontend/.prettierrc delete mode 100644 frontend/src/components/basic/table/UserTable.js create mode 100644 frontend/src/components/basic/table/UserTable.tsx 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 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,6 +3119,32 @@ "node": ">= 0.4" } }, + "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": { + "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-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", @@ -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,8 +12,36 @@ 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); + /** + * 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]}`; + + // Check if the user is authenticated + const response = await checkAuth(); + // #TODO: figure our why sometimes it doesn't output a response + // ANS(akhilmhdh): Because inside the security client the await token() doesn't have try/catch + if (!publicPaths.includes(path)) { + try { + if (response.status !== 200) { + router.push('/login'); + console.log('Unauthorized to access.'); + setAuthorized(false); + } else { + setAuthorized(true); + console.log('Authorized to access.'); + } + } catch (error) { + console.log('Error (probably the authCheck route is stuck again...):', error); + } + } + } + useEffect(() => { // on initial load - run auth check (async () => { @@ -40,35 +67,5 @@ export default function RouteGuard({ children }: Prop): JSX.Element { // 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]; - - // Check if the user is authenticated - const response = await checkAuth(); - // #TODO: figure our why sometimes it doesn't output a response - // ANS(akhilmhdh): Because inside the security client the await token() doesn't have try/catch - if (!publicPaths.includes(path)) { - try { - if (response.status !== 200) { - router.push('/login'); - console.log('Unauthorized to access.'); - setAuthorized(false); - } else { - setAuthorized(true); - console.log('Authorized to access.'); - } - } catch (error) { - console.log( - 'Error (probably the authCheck route is stuck again...):', - error - ); - } - } - } - 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 ( -
- - {text && ( -

{text}

- )} +
+ + {text &&

{text}

}
); -} +}; + +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 ( - +
- {selected != '' ? ( -

{t("activity:event." + selected)}

+ {selected !== '' ? ( +

{t(`activity:event.${selected}`)}

) : ( -

{String(t("common:select-event"))}

+

{String(t('common:select-event'))}

)} - {selected != '' ? ( - select('')} - /> + {selected !== '' ? ( + select('')} /> ) : ( )} @@ -74,33 +66,29 @@ export default function EventFilter({ leaveTo="opacity-0" > - {eventOptions.map((event, id) => { - return ( - - {({ selected }) => ( - <> - - {' '} - {t("activity:event." + event.name)} - - - )} - - ); - })} + {eventOptions.map((event, id) => ( + + {({ selected: isSelected }) => ( + + {' '} + {t(`activity:event.${event.name}`)} + + )} + + ))}
); -} +}; + +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 -) => { +const InputField = ({ + isRequired, + label, + onChangeHandler, + type, + value, + autoComplete, + blurred, + error, + errorText, + id, + name, + placeholder, + isStatic, + text +}: InputFieldProps & Pick) => { const [passwordVisible, setPasswordVisible] = useState(false); - if (props.static === true) { + if (isStatic === true) { return ( -
-

- {props.label} -

- {props.text && ( -

{props.text}

- )} +
+

{label}

+ {text &&

{text}

} 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} />
); - } else { - return ( -
-
-

{props.label}

- {/* {props.label == "Password" && router.asPath != "/login" && ( + } + return ( +
+
+

{label}

+ {/* {label === "Password" && router.asPath !== "/login" && (
@@ -70,74 +77,69 @@ const InputField = (
)} */} -
-
- 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') && ( - - )} - {props.blurred && ( -
-

- {props.value - .split('') - .slice(0, 54) - .map(() => ( - - ))} -
- )} - {/* {props.error && ( +
+
+ 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') && ( + + )} + {blurred && ( +
+

+ {value + .split('') + .slice(0, 54) + .map(() => ( + + ))} +

+ )} + {/* {error && (
)} */} -
- {props.error && ( -

- {props.errorText} -

- )}
- ); - } + {error &&

{errorText}

} +
+ ); }; 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"; + faPlus, + faUser +} 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"; - -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[]>([]); - 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: , + href: `/dashboard/${workspaceMapping[workspaceSelected as any]}`, + title: t('nav:menu.secrets'), + emoji: }, { - href: "/users/" + workspaceMapping[workspaceSelected as any], - title: t("nav:menu.members"), - emoji: , + href: `/users/${workspaceMapping[workspaceSelected as any]}`, + title: t('nav:menu.members'), + emoji: }, { - href: "/integrations/" + workspaceMapping[workspaceSelected as any], - title: t("nav:menu.integrations"), - emoji: , + href: `/integrations/${workspaceMapping[workspaceSelected as any]}`, + title: t('nav:menu.integrations'), + emoji: }, { - href: '/activity/' + workspaceMapping[workspaceSelected as any], + href: `/activity/${workspaceMapping[workspaceSelected as any]}`, title: 'Activity Logs', emoji: }, { - href: "/settings/project/" + workspaceMapping[workspaceSelected as any], - title: t("nav:menu.project-settings"), - emoji: , - }, + href: `/settings/project/${workspaceMapping[workspaceSelected as any]}`, + title: t('nav:menu.project-settings'), + emoji: + } ], [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 ( <> -
- +
+ */ -} 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([]); + const [logsData, setLogsData] = useState([]); const [isLoading, setIsLoading] = useState(false); const [currentOffset, setCurrentOffset] = useState(0); const currentLimit = 10; - const [currentSidebarAction, toggleSidebar] = useState() + const [currentSidebarAction, toggleSidebar] = useState(); 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 (
- - {currentSidebarAction && } + + {currentSidebarAction && ( + + )}
-

{t("activity:title")}

+

{t('activity:title')}

-

- {t("activity:subtitle")} -

+

{t('activity:subtitle')}

- +
- -
-
-
@@ -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'); } + }).then(async (res) => { + 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 => { - return SecurityClient.fetchCall('/api/v1/organization/' + orgId + '/users', { +const getOrganizationUsers = ({ orgId }: { orgId: string }): Promise => + SecurityClient.fetchCall(`/api/v1/organization/${orgId}/users`, { method: 'GET', headers: { - 'Content-Type': 'application/json', - }, - }).then(async (res) => { - if (res?.status == 200) { - return (await res.json()).users; - } else { - console.log('Failed to get org users'); + 'Content-Type': 'application/json' } + }).then(async (res) => { + if (res?.status === 200) { + return (await res.json()).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 => { - return SecurityClient.fetchCall( - '/api/v1/organization/' + organizationId + '/incidentContactOrg', - { - method: 'GET', - headers: { - 'Content-Type': 'application/json', - }, +const getIncidentContacts = (organizationId: string): Promise => + 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'); } + }).then(async (res) => { + 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
; + return
; } 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(); - const [initialData, setInitialData] = useState([]); + const [initialData, setInitialData] = useState([]); 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([]); - const [selectedSnapshotEnv, setSelectedSnapshotEnv] = - useState(); + const [selectedSnapshotEnv, setSelectedSnapshotEnv] = useState(); const [selectedEnv, setSelectedEnv] = useState({ 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 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 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 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 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 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 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); - 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) - 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 ? ( -
+
{t('common:head-title', { title: t('dashboard:title') })} - - - - + + + +
- {sidebarSecretId != "None" && 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 && } + {sidebarSecretId !== 'None' && ( + + 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 && ( + + )}
- + {checkDocsPopUpVisible && ( )} -
+
{snapshotData && ( -
+
)} -
-
+
+

{snapshotData ? 'Secret Snapshot' : t('dashboard:title')}

{snapshotData && ( - + {new Date(snapshotData.createdAt).toLocaleString()} )}
- {!snapshotData && data?.length == 0 && ( + {!snapshotData && data?.length === 0 && ( name)} @@ -547,70 +569,76 @@ export default function Dashboard() { setSelectedEnv( workspaceEnvs.find(({ name }) => envName === name) || { name: 'unknown', - slug: 'unknown', + slug: 'unknown' } ) } /> )}
-
-
+
+
{(data?.length !== 0 || buttonReady) && !snapshotData && ( -
+
)} - {snapshotData &&
-
} + setSnapshotData(undefined); + createNotification({ + text: `Rollback has been performed successfully.`, + type: 'success' + }); + }} + color="primary" + size="md" + active={buttonReady} + /> +
+ )}
-
-
-
+
+
+
{(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' } ) } /> )} -
+
setSearchKeys(e.target.value)} placeholder={String(t('dashboard:search-keys'))} />
{!snapshotData && ( -
+
)} {!snapshotData && ( -
- +
+
)} -
+
{!snapshotData && ( -
+
@@ -708,75 +725,85 @@ export default function Dashboard() {
{isLoading ? ( -
+
infisical loading indicator + alt="infisical loading indicator" + />
) : data?.length !== 0 ? ( -
-
+
+
- {!snapshotData && data?.filter(row => row.key?.toUpperCase().includes(searchKeys.toUpperCase())) - .filter(row => !sharedToHide.includes(row.id)).map((keyPair) => ( - 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) => ( - 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) => ( + 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) => ( + item.key))?.includes( + keyPair.key + )} + toggleSidebar={toggleSidebar} + sidebarSecretId={sidebarSecretId} + isSnapshot + /> + ))}
{!snapshotData && ( -
+
@@ -784,7 +811,7 @@ export default function Dashboard() {
) : ( -
+
{isKeyAvailable && !snapshotData && ( - -

- To view this file, contact your administrator for - permission. -

-

- They need to grant you access in the team tab. -

+ +

To view this file, contact your administrator for permission.

+

They need to grant you access in the team tab.

)}
@@ -818,14 +837,9 @@ export default function Dashboard() {
) : ( -
-
- loading animation +
+
+ loading animation
); } 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() {

Your email was not verified.

Please try again.

- Note: If it still {"doesn't work"}, please reach out to us at - support@infisical.com + Note: If it still doesn't work, please reach out to us at support@infisical.com

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
; + return
; } 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
; + return
; } 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="#" >
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 = ({ {complete && (
- +
)}
@@ -73,59 +72,51 @@ const learningItem = ({
- {complete ? 'Complete!' : 'About ' + time} + {complete ? 'Complete!' : `About ${time}`}
- {complete && ( -
- )} + {complete &&
}
); - } else { - return ( -
{ - 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" - > -
- - {complete && ( -
- -
- )} -
-
{text}
-
{subText}
-
-
-
- {complete ? 'Complete!' : 'About ' + time} -
- {complete && ( -
- )} -
- ); } + return ( +
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" + > +
+ + {complete && ( +
+ +
+ )} +
+
{text}
+
{subText}
+
+
+
+ {complete ? 'Complete!' : `About ${time}`} +
+ {complete &&
} +
+ ); }; /** @@ -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 (
-
- Your quick start guide -
+
Your quick start guide
Click on the items below and follow the instructions.
@@ -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
; + return
; } 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(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 ( -
+
- - {t('common:head-title', { title: t('integrations:title') })} - - - - - + {t('common:head-title', { title: t('integrations:title') })} + + + + -
- +
+ setIsActivateBotDialogOpen(false)} @@ -234,10 +225,7 @@ export default function Integrations() { handleBotActivate={handleBotActivate} handleIntegrationOption={handleIntegrationOption} /> */} - + {cloudIntegrationOptions.length > 0 && bot ? ( ) : ( -
+
)} - +
); @@ -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 (
- {t("common:head-title", { title: t("login:title") })} + {t('common:head-title', { title: t('login:title') })} - - + +
- long logo + long logo
-
setErrorLogin(false)} - onSubmit={(e) => e.preventDefault()} - > + setErrorLogin(false)} onSubmit={(e) => e.preventDefault()}>

- {t("login:login")} + {t('login:login')}

-
- {!isLoading && errorLogin && ( - - )} + {!isLoading && errorLogin && }
)}

- {t("login:need-account")} + {t('login:need-account')}

-
@@ -164,9 +152,9 @@ export default function Login() {
@@ -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
; + return
; } 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 ( -
-
- google logo +
+
+ google logo
-
-
- You are not part of any projects in this organization yet. When you - do, they will appear here. +
+
+ You are not part of any projects in this organization yet. When you do, they will appear + here.
-
- Create a new project, or ask other organization members to give you - neccessary permissions. +
+ Create a new project, or ask other organization members to give you neccessary + permissions.
-
-
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 = ( -
-

+

+

Confirm your email

- verify email -
+ verify email +
@@ -139,34 +128,33 @@ export default function PasswordReset() { // Input backup key const stepInputBackupKey = ( -
-

+

+

Enter your backup key

-
-

- You can find it in your emrgency kit. You had to download the enrgency - kit during signup. +

+

+ You can find it in your emrgency kit. You had to download the enrgency kit during signup.

-
+
-
-
+
+
@@ -175,18 +163,18 @@ export default function PasswordReset() { // Enter new password const stepEnterNewPassword = ( -
-

+

+

Enter new password

-
-

+

+

Make sure you save it somewhere save.

-
+
{ 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" />
{passwordErrorLength || passwordErrorLowerCase || passwordErrorNumber ? ( -
-
- Password should contain at least: -
-
+
+
Password should contain at least:
+
{passwordErrorLength ? ( - + ) : ( - + )} -
+
14 characters
-
+
{passwordErrorLowerCase ? ( - + ) : ( - + )}
1 lowercase character
-
+
{passwordErrorNumber ? ( - + ) : ( - + )} -
+
1 number
) : ( -
+
)} -
-
+
+
@@ -280,7 +245,7 @@ export default function PasswordReset() { ); return ( -
+
{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 ( -
+
Request a New Invite - + -
-

- Oops, your invite has expired. +

+

Oops, your invite has expired.

+

Ask your admin for a new one.

+

+ Note: If it still + doesn't work, please reach out to us at support@infisical.com

-

Ask your admin for a new one.

-

- - Note: - {' '} - If it still {"doesn't work"}, please reach out to us at - support@infisical.com -

-
- google logo +
+ google logo
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 ( -
+
{t('common:head-title', { title: t('billing:title') })} - + -
-
+
+
-
-
-

- {t('billing:title')} -

-

- {t('billing:description')} -

+
+
+

{t('billing:title')}

+

{t('billing:description')}

-
-

{t('billing:subscription')}

-
+
+

{t('billing:subscription')}

+
{plans.map((plan) => ( ))}
-

- {t('billing:current-usage')} -

-
-
-

{numUsers}

-

- {numUsers > 1 - ? 'Organization members' - : 'Organization member'} +

{t('billing:current-usage')}

+
+
+

{numUsers}

+

+ {numUsers > 1 ? 'Organization members' : 'Organization member'}

{/*
@@ -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([]); const [searchIncidentContact, setSearchIncidentContact] = useState(''); const [userList, setUserList] = useState([]); @@ -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 ( -
+
- - {t('common:head-title', { title: t('settings-org:title') })} - - + {t('common:head-title', { title: t('settings-org:title') })} + -
-
+
+
-
-
-

- {t('settings-org:title')} -

-

+

+
+

{t('settings-org:title')}

+

{t('settings-org:description')}

-
-
-
-
-
-

+

+
+
+
+
+

{t('common:display-name')}

-
-
+
+
-
-

+

+

{t('section-members:org-members')}

-

+

{t('section-members:org-members-description')}

{/* */} -
-
+
+
setSearchUsers(e.target.value)} placeholder={t('section-members:search-members') as string} />
-
+
{userList && ( -
+
)}
-
-
-
-

+

+
+
+

{t('section-incident:incident-contacts')}

-

+

{t('section-incident:incident-contacts-description')}

-
+
-
+
setSearchIncidentContact(e.target.value)} placeholder={t('common:search') as string} />
- {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) => (
-

{contact}

-
+

{contact}

+
)) ) : ( -
-

- {t('section-incident:no-incident-contacts')} -

+
+

{t('section-incident:no-incident-contacts')}

)}
@@ -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([]); 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 ( -
+
- - {t('common:head-title', { title: t('settings-personal:title') })} - - + {t('common:head-title', { title: t('settings-personal:title') })} +
- -
-
-

- {t('settings-personal:title')} -

-

+ +

+
+

{t('settings-personal:title')}

+

{t('settings-personal:description')}

@@ -98,9 +88,9 @@ export default function PersonalSettings() {

- {t("settings-personal:change-language")} + {t('settings-personal:change-language')}

-
+

- {t("settings-personal:api-keys.title")} + {t('settings-personal:api-keys.title')}

- {t("settings-personal:api-keys.description")} + {t('settings-personal:api-keys.description')}

- +
-
-
-
-

+

+
+
+

{t('section-password:change')}

-
+
{ 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" /> -
+
{ @@ -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" />
- {passwordErrorLength || - passwordErrorLowerCase || - passwordErrorNumber ? ( -
-
+ {passwordErrorLength || passwordErrorLowerCase || passwordErrorNumber ? ( +
+
{t('section-password:validate-base')}
-
+
{passwordErrorLength ? ( - + ) : ( - + )}
-
+
{passwordErrorLowerCase ? ( - + ) : ( - + )}
{t('section-password:validate-case')}
-
+
{passwordErrorNumber ? ( - + ) : ( - + )}
) : ( -
+
)} -
+
-
+

- {t("settings-personal:emergency.name")} + {t('settings-personal:emergency.name')}

-

+

{t('settings-personal:emergency.text1')}

-

+

{t('settings-personal:emergency.text2')}

-
+
-
+
-
-

- {t('common:project-id')} -

-

+

+

{t('common:project-id')}

+

{t('settings-project:project-id-description')}

-

+

{t('settings-project:project-id-description2')} {/* eslint-disable-next-line react/jsx-no-target-blank */} {t('settings-project:docs')}

-

+

{t('settings-project:auto-generated')}

-
-

{`${t( - 'common:project-id' - )}:`}

+
+

{`${t('common:project-id')}:`}

-
+ /> +
- + {t('common:click-to-copy')}
-
+
-
-
-
-

+

+
+
+

{t('section-token:service-tokens')}

-

+

{t('section-token:service-tokens-description')}

-

+

Please, make sure you are on the latest version of CLI .

-
+
@@ -313,31 +292,27 @@ export default function SettingsBasic() {
-
-

- {t('settings-project:danger-zone')} -

-

- {t('settings-project:danger-zone-note')} -

-
+
+

{t('settings-project:danger-zone')}

+

{t('settings-project:danger-zone-note')}

+
-

+

{t('settings-project:delete-project-note')}

@@ -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 (
- {t("common:head-title", { title: t("signup:title") })} + {t('common:head-title', { title: t('signup:title') })} - - + +
- Infisical Wide Logo + Infisical Wide Logo
e.preventDefault()}> - {step == 1 ? - : step == 2 ? - : step == 3 ? - : step == 4 ? - : } + {step === 1 ? ( + + ) : step === 2 ? ( + + ) : step === 3 ? ( + + ) : step === 4 ? ( + + ) : ( + + )}
); } -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 = ( -
-

+

+

Confirm your email

- verify email -
+ verify email +
@@ -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 = ( -
-

+

+

Almost there!

-
+
-
+
-
+
{ - 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 ? ( -
-
- Password should contain at least: -
-
+ {passwordErrorLength || passwordErrorLowerCase || passwordErrorNumber ? ( +
+
Password should contain at least:
+
{passwordErrorLength ? ( - + ) : ( - + )} -
+
14 characters
-
+
{passwordErrorLowerCase ? ( - + ) : ( - + )}
1 lowercase character
-
+
{passwordErrorNumber ? ( - + ) : ( - + )} -
+
1 number
) : ( -
+
)}
-
+
@@ -321,38 +274,34 @@ export default function SignupInvite() { // Step 4 of the sign up process (download the emergency kit pdf) const step4 = ( -
-

+

+

Save your Emergency Kit

-
+
- If you get locked out of your account, your Emergency Kit is the only - way to sign in. -
-
- 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.
+
We recommend you download it and keep it somewhere safe.
-
- - It contains your Secret Key which we cannot access or recover for you if - you lose it. +
+ + It contains your Secret Key which we cannot access or recover for you if you lose it.
-
+
-
+
) : ( -
-
- loading animation +
+
+ loading animation
); } @@ -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
; + return
; } 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() {
- long logo + long logo
- {step == 1 && ( + {step === 1 && (

Forgot your password?

- 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.

@@ -69,16 +62,12 @@ export default function VerifyEmail() {
-
)} - {step == 2 && ( + {step === 2 && (

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"] } From 7ae73d1b6286689120bc606bd63ceba191e5eb3e Mon Sep 17 00:00:00 2001 From: akhilmhdh Date: Tue, 17 Jan 2023 21:05:21 +0530 Subject: [PATCH 2/3] chore(frontend): added rule to seperate out @app imports and linted --- frontend/.eslintrc.js | 1 + frontend/src/components/RouteGuard.tsx | 1 + frontend/src/components/basic/Layout.tsx | 17 ++++++------ .../basic/dialog/AddApiKeyDialog.tsx | 3 ++- .../basic/dialog/AddIncidentContactDialog.tsx | 3 ++- .../basic/dialog/AddServiceTokenDialog.tsx | 5 ++-- .../components/basic/table/ApiKeyTable.tsx | 3 ++- .../basic/table/ServiceTokenTable.tsx | 3 ++- .../src/components/basic/table/UserTable.tsx | 3 ++- frontend/src/components/billing/Plan.tsx | 1 + frontend/src/components/dashboard/SideBar.tsx | 3 ++- .../components/integrations/Integration.tsx | 5 ++-- .../components/navigation/NavBarDashboard.tsx | 3 ++- .../src/components/navigation/NavHeader.tsx | 5 ++-- .../src/components/signup/CodeInputStep.tsx | 1 + .../src/components/signup/EnterEmailStep.tsx | 1 + .../src/components/signup/TeamInviteStep.tsx | 1 + .../src/components/signup/UserInfoStep.tsx | 3 ++- .../src/components/utilities/attemptLogin.ts | 5 ++-- .../utilities/cryptography/changePassword.ts | 3 ++- .../utilities/cryptography/issueBackupKey.ts | 3 ++- .../utilities/secrets/encryptSecrets.ts | 3 ++- .../src/ee/components/ActivitySideBar.tsx | 5 ++-- frontend/src/ee/components/ActivityTable.tsx | 3 ++- .../src/ee/components/PITRecoverySidebar.tsx | 5 ++-- .../src/ee/components/SecretVersionList.tsx | 5 ++-- frontend/src/pages/_app.tsx | 3 ++- frontend/src/pages/activity/[id].tsx | 1 + frontend/src/pages/dashboard/[id].tsx | 27 ++++++++++--------- frontend/src/pages/home/[id].tsx | 5 ++-- frontend/src/pages/integrations/[id].tsx | 3 ++- frontend/src/pages/login.tsx | 5 ++-- frontend/src/pages/noprojects.tsx | 1 + frontend/src/pages/password-reset.tsx | 9 ++++--- frontend/src/pages/settings/billing/[id].tsx | 1 + frontend/src/pages/settings/org/[id].tsx | 5 ++-- frontend/src/pages/settings/personal/[id].tsx | 5 ++-- frontend/src/pages/settings/project/[id].tsx | 5 ++-- frontend/src/pages/signup.tsx | 1 + frontend/src/pages/signupinvite.tsx | 13 ++++----- frontend/src/pages/users/[id].tsx | 5 ++-- frontend/src/pages/verify-email.tsx | 1 + 42 files changed, 113 insertions(+), 71 deletions(-) diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js index 946575a66a..dfaed6f6d2 100644 --- a/frontend/.eslintrc.js +++ b/frontend/.eslintrc.js @@ -52,6 +52,7 @@ module.exports = { ], // Packages `react` related packages ['^react', '^next', '^@?\\w'], + ['^@app'], // Internal packages. ['^~(/.*|$)'], // Relative imports diff --git a/frontend/src/components/RouteGuard.tsx b/frontend/src/components/RouteGuard.tsx index a1154ee5c1..3b755341e8 100644 --- a/frontend/src/components/RouteGuard.tsx +++ b/frontend/src/components/RouteGuard.tsx @@ -1,5 +1,6 @@ import { ReactNode, useEffect, useState } from 'react'; import { useRouter } from 'next/router'; + import { publicPaths } from '@app/const'; import checkAuth from '@app/pages/api/auth/CheckAuth'; diff --git a/frontend/src/components/basic/Layout.tsx b/frontend/src/components/basic/Layout.tsx index 3ccd80afe7..19a7fbc936 100644 --- a/frontend/src/components/basic/Layout.tsx +++ b/frontend/src/components/basic/Layout.tsx @@ -7,14 +7,6 @@ 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, @@ -27,6 +19,15 @@ import { } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +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 NavBarDashboard from '../navigation/NavBarDashboard'; import onboardingCheck from '../utilities/checks/OnboardingCheck'; import { tempLocalStorage } from '../utilities/checks/tempLocalStorage'; diff --git a/frontend/src/components/basic/dialog/AddApiKeyDialog.tsx b/frontend/src/components/basic/dialog/AddApiKeyDialog.tsx index 911cb35e35..6956b9a7c0 100644 --- a/frontend/src/components/basic/dialog/AddApiKeyDialog.tsx +++ b/frontend/src/components/basic/dialog/AddApiKeyDialog.tsx @@ -1,10 +1,11 @@ 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 '@app/pages/api/apiKey/addAPIKey'; + import Button from '../buttons/Button'; import InputField from '../InputField'; import ListBox from '../Listbox'; diff --git a/frontend/src/components/basic/dialog/AddIncidentContactDialog.tsx b/frontend/src/components/basic/dialog/AddIncidentContactDialog.tsx index 4d84165018..dddcfa30f8 100644 --- a/frontend/src/components/basic/dialog/AddIncidentContactDialog.tsx +++ b/frontend/src/components/basic/dialog/AddIncidentContactDialog.tsx @@ -1,8 +1,9 @@ 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 '@app/pages/api/organization/addIncidentContact'; + import Button from '../buttons/Button'; import InputField from '../InputField'; diff --git a/frontend/src/components/basic/dialog/AddServiceTokenDialog.tsx b/frontend/src/components/basic/dialog/AddServiceTokenDialog.tsx index b0322e49a6..646b5bf4e1 100644 --- a/frontend/src/components/basic/dialog/AddServiceTokenDialog.tsx +++ b/frontend/src/components/basic/dialog/AddServiceTokenDialog.tsx @@ -2,12 +2,13 @@ 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 '@app/pages/api/serviceToken/addServiceToken'; +import getLatestFileKey from '@app/pages/api/workspace/getLatestFileKey'; + import { decryptAssymmetric, encryptSymmetric, diff --git a/frontend/src/components/basic/table/ApiKeyTable.tsx b/frontend/src/components/basic/table/ApiKeyTable.tsx index 19327088d9..800ea7356c 100644 --- a/frontend/src/components/basic/table/ApiKeyTable.tsx +++ b/frontend/src/components/basic/table/ApiKeyTable.tsx @@ -1,6 +1,7 @@ -import { useNotificationContext } from '@app/components/context/Notifications/NotificationProvider'; import { faX } from '@fortawesome/free-solid-svg-icons'; +import { useNotificationContext } from '@app/components/context/Notifications/NotificationProvider'; + import deleteAPIKey from '../../../pages/api/apiKey/deleteAPIKey'; import guidGenerator from '../../utilities/randomId'; import Button from '../buttons/Button'; diff --git a/frontend/src/components/basic/table/ServiceTokenTable.tsx b/frontend/src/components/basic/table/ServiceTokenTable.tsx index 73dd2a4ee5..2fa7bb4398 100644 --- a/frontend/src/components/basic/table/ServiceTokenTable.tsx +++ b/frontend/src/components/basic/table/ServiceTokenTable.tsx @@ -1,6 +1,7 @@ -import { useNotificationContext } from '@app/components/context/Notifications/NotificationProvider'; import { faX } from '@fortawesome/free-solid-svg-icons'; +import { useNotificationContext } from '@app/components/context/Notifications/NotificationProvider'; + import deleteServiceToken from '../../../pages/api/serviceToken/deleteServiceToken'; import guidGenerator from '../../utilities/randomId'; import Button from '../buttons/Button'; diff --git a/frontend/src/components/basic/table/UserTable.tsx b/frontend/src/components/basic/table/UserTable.tsx index ad997ca1a3..a9700832b4 100644 --- a/frontend/src/components/basic/table/UserTable.tsx +++ b/frontend/src/components/basic/table/UserTable.tsx @@ -1,11 +1,12 @@ import { useEffect, useState } from 'react'; import { useRouter } from 'next/router'; +import { faX } from '@fortawesome/free-solid-svg-icons'; + 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'; diff --git a/frontend/src/components/billing/Plan.tsx b/frontend/src/components/billing/Plan.tsx index ea3d590062..692157923b 100644 --- a/frontend/src/components/billing/Plan.tsx +++ b/frontend/src/components/billing/Plan.tsx @@ -1,4 +1,5 @@ import React from 'react'; + import StripeRedirect from '@app/pages/api/organization/StripeRedirect'; import { tempLocalStorage } from '../utilities/checks/tempLocalStorage'; diff --git a/frontend/src/components/dashboard/SideBar.tsx b/frontend/src/components/dashboard/SideBar.tsx index 7ccbb6e40e..5f67808f1d 100644 --- a/frontend/src/components/dashboard/SideBar.tsx +++ b/frontend/src/components/dashboard/SideBar.tsx @@ -2,10 +2,11 @@ import { useState } from 'react'; import Image from 'next/image'; 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'; +import SecretVersionList from '@app/ee/components/SecretVersionList'; + import Button from '../basic/buttons/Button'; import Toggle from '../basic/Toggle'; import CommentField from './CommentField'; diff --git a/frontend/src/components/integrations/Integration.tsx b/frontend/src/components/integrations/Integration.tsx index dc7344cad8..62b44d420b 100644 --- a/frontend/src/components/integrations/Integration.tsx +++ b/frontend/src/components/integrations/Integration.tsx @@ -1,13 +1,14 @@ /* 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 Button from '@app/components/basic/buttons/Button'; +import ListBox from '@app/components/basic/Listbox'; + import deleteIntegration from '../../pages/api/integrations/DeleteIntegration'; import getIntegrationApps from '../../pages/api/integrations/GetIntegrationApps'; import updateIntegration from '../../pages/api/integrations/updateIntegration'; diff --git a/frontend/src/components/navigation/NavBarDashboard.tsx b/frontend/src/components/navigation/NavBarDashboard.tsx index 4f67f89cc7..d681930ac5 100644 --- a/frontend/src/components/navigation/NavBarDashboard.tsx +++ b/frontend/src/components/navigation/NavBarDashboard.tsx @@ -4,7 +4,6 @@ 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 { @@ -19,6 +18,8 @@ import { import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { Menu, Transition } from '@headlessui/react'; +import logout from '@app/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'; diff --git a/frontend/src/components/navigation/NavHeader.tsx b/frontend/src/components/navigation/NavHeader.tsx index 115bba26be..c550d46e99 100644 --- a/frontend/src/components/navigation/NavHeader.tsx +++ b/frontend/src/components/navigation/NavHeader.tsx @@ -1,10 +1,11 @@ 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 '@app/pages/api/organization/GetOrg'; +import getProjectInfo from '@app/pages/api/workspace/getProjectInfo'; + /** * This is the component at the top of almost every page. * It shows how to navigate to a certain page. diff --git a/frontend/src/components/signup/CodeInputStep.tsx b/frontend/src/components/signup/CodeInputStep.tsx index 6a93010838..67b4e530c7 100644 --- a/frontend/src/components/signup/CodeInputStep.tsx +++ b/frontend/src/components/signup/CodeInputStep.tsx @@ -2,6 +2,7 @@ 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'; diff --git a/frontend/src/components/signup/EnterEmailStep.tsx b/frontend/src/components/signup/EnterEmailStep.tsx index 3b6a4c62cc..d7114946ec 100644 --- a/frontend/src/components/signup/EnterEmailStep.tsx +++ b/frontend/src/components/signup/EnterEmailStep.tsx @@ -1,6 +1,7 @@ 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'; diff --git a/frontend/src/components/signup/TeamInviteStep.tsx b/frontend/src/components/signup/TeamInviteStep.tsx index 879925e2a5..29cb95076c 100644 --- a/frontend/src/components/signup/TeamInviteStep.tsx +++ b/frontend/src/components/signup/TeamInviteStep.tsx @@ -1,6 +1,7 @@ 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'; diff --git a/frontend/src/components/signup/UserInfoStep.tsx b/frontend/src/components/signup/UserInfoStep.tsx index abb7a41621..bf9fa1edbd 100644 --- a/frontend/src/components/signup/UserInfoStep.tsx +++ b/frontend/src/components/signup/UserInfoStep.tsx @@ -1,13 +1,14 @@ 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 jsrp from 'jsrp'; import nacl from 'tweetnacl'; import { encodeBase64 } from 'tweetnacl-util'; +import completeAccountInformationSignup from '@app/pages/api/auth/CompleteAccountInformationSignup'; + import Button from '../basic/buttons/Button'; import InputField from '../basic/InputField'; import attemptLogin from '../utilities/attemptLogin'; diff --git a/frontend/src/components/utilities/attemptLogin.ts b/frontend/src/components/utilities/attemptLogin.ts index e167a8e1b2..05c3fbb904 100644 --- a/frontend/src/components/utilities/attemptLogin.ts +++ b/frontend/src/components/utilities/attemptLogin.ts @@ -1,6 +1,9 @@ /* eslint-disable prefer-destructuring */ import crypto from 'crypto'; +import jsrp from 'jsrp'; +import { SecretDataProps } from 'public/data/frequentInterfaces'; + 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'; @@ -9,8 +12,6 @@ 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 { encryptAssymmetric } from './cryptography/crypto'; import encryptSecrets from './secrets/encryptSecrets'; diff --git a/frontend/src/components/utilities/cryptography/changePassword.ts b/frontend/src/components/utilities/cryptography/changePassword.ts index 744f45969e..db72856ed8 100644 --- a/frontend/src/components/utilities/cryptography/changePassword.ts +++ b/frontend/src/components/utilities/cryptography/changePassword.ts @@ -1,7 +1,8 @@ /* eslint-disable new-cap */ +import jsrp from 'jsrp'; + import changePassword2 from '@app/pages/api/auth/ChangePassword2'; import SRP1 from '@app/pages/api/auth/SRP1'; -import jsrp from 'jsrp'; import Aes256Gcm from './aes-256-gcm'; diff --git a/frontend/src/components/utilities/cryptography/issueBackupKey.ts b/frontend/src/components/utilities/cryptography/issueBackupKey.ts index 5f048d97a1..49ea5400c0 100644 --- a/frontend/src/components/utilities/cryptography/issueBackupKey.ts +++ b/frontend/src/components/utilities/cryptography/issueBackupKey.ts @@ -1,9 +1,10 @@ /* eslint-disable new-cap */ import crypto from 'crypto'; +import jsrp from 'jsrp'; + 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'; diff --git a/frontend/src/components/utilities/secrets/encryptSecrets.ts b/frontend/src/components/utilities/secrets/encryptSecrets.ts index 0b60d555e2..53ce0066de 100644 --- a/frontend/src/components/utilities/secrets/encryptSecrets.ts +++ b/frontend/src/components/utilities/secrets/encryptSecrets.ts @@ -1,8 +1,9 @@ import crypto from 'crypto'; -import getLatestFileKey from '@app/pages/api/workspace/getLatestFileKey'; import { SecretDataProps } from 'public/data/frequentInterfaces'; +import getLatestFileKey from '@app/pages/api/workspace/getLatestFileKey'; + import { decryptAssymmetric, encryptSymmetric } from '../cryptography/crypto'; interface EncryptedSecretProps { diff --git a/frontend/src/ee/components/ActivitySideBar.tsx b/frontend/src/ee/components/ActivitySideBar.tsx index c45c8beca1..69a6701afe 100644 --- a/frontend/src/ee/components/ActivitySideBar.tsx +++ b/frontend/src/ee/components/ActivitySideBar.tsx @@ -2,11 +2,12 @@ import { useEffect, useState } from 'react'; import Image from 'next/image'; import { useRouter } from 'next/router'; import { useTranslation } from 'next-i18next'; +import { faX } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; + 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 DashboardInputField from '../../components/dashboard/DashboardInputField'; import { diff --git a/frontend/src/ee/components/ActivityTable.tsx b/frontend/src/ee/components/ActivityTable.tsx index 28977f473b..1867128d46 100644 --- a/frontend/src/ee/components/ActivityTable.tsx +++ b/frontend/src/ee/components/ActivityTable.tsx @@ -2,10 +2,11 @@ import React, { useState } from 'react'; import Image from 'next/image'; import { useTranslation } from 'next-i18next'; -import timeSince from '@app/ee/utilities/timeSince'; import { faAngleDown, faAngleRight, faUpRightFromSquare } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import timeSince from '@app/ee/utilities/timeSince'; + import guidGenerator from '../../components/utilities/randomId'; interface PayloadProps { diff --git a/frontend/src/ee/components/PITRecoverySidebar.tsx b/frontend/src/ee/components/PITRecoverySidebar.tsx index 334444fb93..d9cc47a7e8 100644 --- a/frontend/src/ee/components/PITRecoverySidebar.tsx +++ b/frontend/src/ee/components/PITRecoverySidebar.tsx @@ -3,6 +3,9 @@ import { useEffect, useState } from 'react'; import Image from 'next/image'; import { useRouter } from 'next/router'; import { useTranslation } from 'next-i18next'; +import { faX } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; + import Button from '@app/components/basic/buttons/Button'; import { decryptAssymmetric, @@ -12,8 +15,6 @@ import getProjectSecretShanpshots from '@app/ee/api/secrets/GetProjectSercetShan 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'; export interface SecretDataProps { pos: number; diff --git a/frontend/src/ee/components/SecretVersionList.tsx b/frontend/src/ee/components/SecretVersionList.tsx index b7fbdaa79a..4df9c38a75 100644 --- a/frontend/src/ee/components/SecretVersionList.tsx +++ b/frontend/src/ee/components/SecretVersionList.tsx @@ -2,14 +2,15 @@ import { useEffect, useState } from 'react'; import Image from 'next/image'; import { useRouter } from 'next/router'; import { useTranslation } from 'next-i18next'; +import { faCircle, faDotCircle } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; + 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'; interface DecryptedSecretVersionListProps { createdAt: string; diff --git a/frontend/src/pages/_app.tsx b/frontend/src/pages/_app.tsx index 73766169de..4e22c943fb 100644 --- a/frontend/src/pages/_app.tsx +++ b/frontend/src/pages/_app.tsx @@ -3,12 +3,13 @@ import { useEffect } from 'react'; import { AppProps } from 'next/app'; import { useRouter } from 'next/router'; import { appWithTranslation } from 'next-i18next'; +import { config } from '@fortawesome/fontawesome-svg-core'; + 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 '@fortawesome/fontawesome-svg-core/styles.css'; import '../styles/globals.css'; diff --git a/frontend/src/pages/activity/[id].tsx b/frontend/src/pages/activity/[id].tsx index 981ebc4bbe..55e5b1924e 100644 --- a/frontend/src/pages/activity/[id].tsx +++ b/frontend/src/pages/activity/[id].tsx @@ -1,6 +1,7 @@ import React, { useEffect, useState } from 'react'; import { useRouter } from 'next/router'; 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'; diff --git a/frontend/src/pages/dashboard/[id].tsx b/frontend/src/pages/dashboard/[id].tsx index 8499faf9ce..1052a14f54 100644 --- a/frontend/src/pages/dashboard/[id].tsx +++ b/frontend/src/pages/dashboard/[id].tsx @@ -4,6 +4,20 @@ import Head from 'next/head'; import Image from 'next/image'; import { useRouter } from 'next/router'; import { useTranslation } from 'next-i18next'; +import { + faArrowDownAZ, + faArrowDownZA, + faArrowLeft, + faCheck, + faClockRotateLeft, + faEye, + faEyeSlash, + faFolderOpen, + faMagnifyingGlass, + faPlus +} from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; + import Button from '@app/components/basic/buttons/Button'; import ListBox from '@app/components/basic/Listbox'; import BottonRightPopup from '@app/components/basic/popups/BottomRightPopup'; @@ -20,19 +34,6 @@ import { getTranslatedServerSideProps } from '@app/components/utilities/withTran import getProjectSercetSnapshotsCount from '@app/ee/api/secrets/GetProjectSercetSnapshotsCount'; import performSecretRollback from '@app/ee/api/secrets/PerformSecretRollback'; import PITRecoverySidebar from '@app/ee/components/PITRecoverySidebar'; -import { - faArrowDownAZ, - faArrowDownZA, - faArrowLeft, - faCheck, - faClockRotateLeft, - faEye, - faEyeSlash, - faFolderOpen, - faMagnifyingGlass, - faPlus -} from '@fortawesome/free-solid-svg-icons'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import addSecrets from '../api/files/AddSecrets'; import deleteSecrets from '../api/files/DeleteSecrets'; diff --git a/frontend/src/pages/home/[id].tsx b/frontend/src/pages/home/[id].tsx index 0fe52c7ffe..72ed8bb4d3 100644 --- a/frontend/src/pages/home/[id].tsx +++ b/frontend/src/pages/home/[id].tsx @@ -1,8 +1,6 @@ import { useEffect, useState } from 'react'; import Link from 'next/link'; import { useRouter } from 'next/router'; -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 { @@ -16,6 +14,9 @@ import { } from '@fortawesome/free-solid-svg-icons'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import onboardingCheck from '@app/components/utilities/checks/OnboardingCheck'; +import { getTranslatedServerSideProps } from '@app/components/utilities/withTranslateProps'; + import registerUserAction from '../api/userActions/registerUserAction'; type ItemProps = { diff --git a/frontend/src/pages/integrations/[id].tsx b/frontend/src/pages/integrations/[id].tsx index c9ede39e39..ff90e43df2 100644 --- a/frontend/src/pages/integrations/[id].tsx +++ b/frontend/src/pages/integrations/[id].tsx @@ -4,13 +4,14 @@ import { useEffect, useState } from 'react'; import Head from 'next/head'; import { useRouter } from 'next/router'; import { useTranslation } from 'next-i18next'; +import frameworkIntegrationOptions from 'public/json/frameworkIntegrations.json'; + 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 { decryptAssymmetric, diff --git a/frontend/src/pages/login.tsx b/frontend/src/pages/login.tsx index 114d379e83..0589870395 100644 --- a/frontend/src/pages/login.tsx +++ b/frontend/src/pages/login.tsx @@ -4,14 +4,15 @@ 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 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 getWorkspaces from './api/workspace/getWorkspaces'; diff --git a/frontend/src/pages/noprojects.tsx b/frontend/src/pages/noprojects.tsx index 1e2f1737e3..06ed600bb3 100644 --- a/frontend/src/pages/noprojects.tsx +++ b/frontend/src/pages/noprojects.tsx @@ -1,6 +1,7 @@ import { useEffect } from 'react'; import Image from 'next/image'; import { useRouter } from 'next/router'; + import Button from '@app/components/basic/buttons/Button'; import { getTranslatedServerSideProps } from '@app/components/utilities/withTranslateProps'; diff --git a/frontend/src/pages/password-reset.tsx b/frontend/src/pages/password-reset.tsx index beb2b7816a..7da1778ead 100644 --- a/frontend/src/pages/password-reset.tsx +++ b/frontend/src/pages/password-reset.tsx @@ -1,15 +1,16 @@ import { useState } from 'react'; import Image from 'next/image'; import { useRouter } from 'next/router'; +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 '@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 EmailVerifyOnPasswordReset from './api/auth/EmailVerifyOnPasswordReset'; import getBackupEncryptedPrivateKey from './api/auth/getBackupEncryptedPrivateKey'; diff --git a/frontend/src/pages/settings/billing/[id].tsx b/frontend/src/pages/settings/billing/[id].tsx index 3ee52db473..e3cd22191b 100644 --- a/frontend/src/pages/settings/billing/[id].tsx +++ b/frontend/src/pages/settings/billing/[id].tsx @@ -1,6 +1,7 @@ import { useEffect, useState } from 'react'; import Head from 'next/head'; import { useTranslation } from 'next-i18next'; + 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'; diff --git a/frontend/src/pages/settings/org/[id].tsx b/frontend/src/pages/settings/org/[id].tsx index d82613a2d4..ff2657e6dd 100644 --- a/frontend/src/pages/settings/org/[id].tsx +++ b/frontend/src/pages/settings/org/[id].tsx @@ -3,6 +3,9 @@ import { useEffect, useState } from 'react'; import Head from 'next/head'; import { useRouter } from 'next/router'; import { useTranslation } from 'next-i18next'; +import { faCheck, faMagnifyingGlass, faPlus, faX } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; + import Button from '@app/components/basic/buttons/Button'; import AddIncidentContactDialog from '@app/components/basic/dialog/AddIncidentContactDialog'; import AddUserDialog from '@app/components/basic/dialog/AddUserDialog'; @@ -11,8 +14,6 @@ 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 addUserToOrg from '../../api/organization/addUserToOrg'; import deleteIncidentContact from '../../api/organization/deleteIncidentContact'; diff --git a/frontend/src/pages/settings/personal/[id].tsx b/frontend/src/pages/settings/personal/[id].tsx index 11fab79961..72f57f1550 100644 --- a/frontend/src/pages/settings/personal/[id].tsx +++ b/frontend/src/pages/settings/personal/[id].tsx @@ -2,6 +2,9 @@ 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 Button from '@app/components/basic/buttons/Button'; import InputField from '@app/components/basic/InputField'; import ListBox from '@app/components/basic/Listbox'; @@ -11,8 +14,6 @@ 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 AddApiKeyDialog from '../../../components/basic/dialog/AddApiKeyDialog'; import getAPIKeys from '../../api/apiKey/getAPIKeys'; diff --git a/frontend/src/pages/settings/project/[id].tsx b/frontend/src/pages/settings/project/[id].tsx index 737b6ac2ab..14b2a37852 100644 --- a/frontend/src/pages/settings/project/[id].tsx +++ b/frontend/src/pages/settings/project/[id].tsx @@ -2,6 +2,9 @@ import { useEffect, useState } from 'react'; import Head from 'next/head'; import { useRouter } from 'next/router'; import { useTranslation } from 'next-i18next'; +import { faCheck, faCopy, faPlus } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; + import Button from '@app/components/basic/buttons/Button'; import AddServiceTokenDialog from '@app/components/basic/dialog/AddServiceTokenDialog'; import InputField from '@app/components/basic/InputField'; @@ -11,8 +14,6 @@ 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 createEnvironment from '../../api/environments/createEnvironment'; import getServiceTokens from '../../api/serviceToken/getServiceTokens'; diff --git a/frontend/src/pages/signup.tsx b/frontend/src/pages/signup.tsx index 71feec8c21..ae93d97d0d 100644 --- a/frontend/src/pages/signup.tsx +++ b/frontend/src/pages/signup.tsx @@ -5,6 +5,7 @@ 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'; diff --git a/frontend/src/pages/signupinvite.tsx b/frontend/src/pages/signupinvite.tsx index 4c1c60733a..ce8db9afe3 100644 --- a/frontend/src/pages/signupinvite.tsx +++ b/frontend/src/pages/signupinvite.tsx @@ -5,12 +5,6 @@ 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'; @@ -18,6 +12,13 @@ import queryString from 'query-string'; import nacl from 'tweetnacl'; import { encodeBase64 } from 'tweetnacl-util'; +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 completeAccountInformationSignupInvite from './api/auth/CompleteAccountInformationSignupInvite'; import verifySignupInvite from './api/auth/VerifySignupInvite'; diff --git a/frontend/src/pages/users/[id].tsx b/frontend/src/pages/users/[id].tsx index 22dafaa2cc..db71e34fcf 100644 --- a/frontend/src/pages/users/[id].tsx +++ b/frontend/src/pages/users/[id].tsx @@ -3,14 +3,15 @@ import Head from 'next/head'; import Image from 'next/image'; import { useRouter } from 'next/router'; import { useTranslation } from 'next-i18next'; +import { faMagnifyingGlass, faPlus } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; + 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 { decryptAssymmetric, diff --git a/frontend/src/pages/verify-email.tsx b/frontend/src/pages/verify-email.tsx index 6263572805..d134a07afa 100644 --- a/frontend/src/pages/verify-email.tsx +++ b/frontend/src/pages/verify-email.tsx @@ -2,6 +2,7 @@ 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'; From 18fbe82535e599e11b236c94325aa540684b84a9 Mon Sep 17 00:00:00 2001 From: Vladyslav Matsiiako Date: Tue, 17 Jan 2023 19:03:43 -0800 Subject: [PATCH 3/3] Fixed minor bugs during code cleaning --- frontend/src/components/basic/Layout.tsx | 5 ++-- frontend/src/components/basic/Listbox.tsx | 24 +++++++++---------- .../basic/dialog/AddApiKeyDialog.tsx | 2 +- .../basic/dialog/AddProjectMemberDialog.tsx | 2 +- .../basic/dialog/AddServiceTokenDialog.tsx | 4 ++-- .../src/components/basic/table/UserTable.tsx | 4 ++-- .../components/integrations/Integration.tsx | 8 +++---- .../src/components/utilities/attemptLogin.ts | 6 ++++- frontend/src/pages/dashboard/[id].tsx | 6 ++--- frontend/src/pages/login.tsx | 2 +- frontend/src/pages/noprojects.tsx | 2 +- frontend/src/pages/settings/org/[id].tsx | 4 ++-- frontend/src/pages/settings/personal/[id].tsx | 2 +- 13 files changed, 38 insertions(+), 33 deletions(-) diff --git a/frontend/src/components/basic/Layout.tsx b/frontend/src/components/basic/Layout.tsx index 19a7fbc936..a3d6092a1a 100644 --- a/frontend/src/components/basic/Layout.tsx +++ b/frontend/src/components/basic/Layout.tsx @@ -190,7 +190,8 @@ const Layout = ({ children }: LayoutProps) => { userWorkspaces.length === 0 && router.asPath !== '/noprojects' && !router.asPath.includes('home') && - !router.asPath.includes('settings') + !router.asPath.includes('settings') || + router.asPath === '/dashboard/undefined' ) { router.push('/noprojects'); } else if (router.asPath !== '/noprojects') { @@ -259,7 +260,7 @@ const Layout = ({ children }: LayoutProps) => {

{Object.keys(workspaceMapping).length > 0 ? ( void; data: string[] | null; text?: string; @@ -15,7 +15,7 @@ interface ListBoxProps { /** * This is the component that we use for drop down lists. * @param {object} obj - * @param {string} obj.selected - the item that is currently selected + * @param {string} obj.isSelected - the item that is currently selected * @param {function} obj.onChange - what happends if you select the item inside a list * @param {string[]} obj.data - all the options available * @param {string} obj.text - the text that shows us in front of the select option @@ -23,7 +23,7 @@ interface ListBoxProps { * @returns */ const ListBox = ({ - selected, + isSelected, onChange, data, text, @@ -31,7 +31,7 @@ const ListBox = ({ isFull }: ListBoxProps): JSX.Element => { return ( - +
{text} - + {' '} - {selected} + {isSelected}
{data && ( @@ -62,22 +62,22 @@ const ListBox = ({ {data.map((person, personIdx) => ( - `my-0.5 relative cursor-default select-none py-2 pl-10 pr-4 rounded-md capitalize ${ - isSelected ? 'bg-white/10 text-gray-400 font-bold' : '' + className={({ active, selected }) => + `my-0.5 relative cursor-default select-none py-2 pl-10 pr-4 rounded-md ${ + selected ? 'bg-white/10 text-gray-400 font-bold' : '' } ${ - active && !isSelected + active && !selected ? 'bg-white/5 text-mineshaft-200 cursor-pointer' : 'text-gray-400' } ` } value={person} > - {({ selected: isSelected }) => ( + {({ selected }) => ( <> {person} diff --git a/frontend/src/components/basic/dialog/AddApiKeyDialog.tsx b/frontend/src/components/basic/dialog/AddApiKeyDialog.tsx index 6956b9a7c0..67f0c1f1fa 100644 --- a/frontend/src/components/basic/dialog/AddApiKeyDialog.tsx +++ b/frontend/src/components/basic/dialog/AddApiKeyDialog.tsx @@ -126,7 +126,7 @@ const AddApiKeyDialog = ({
{data?.length > 0 && ( - + )}
diff --git a/frontend/src/components/basic/dialog/AddServiceTokenDialog.tsx b/frontend/src/components/basic/dialog/AddServiceTokenDialog.tsx index 646b5bf4e1..d2126b3e74 100644 --- a/frontend/src/components/basic/dialog/AddServiceTokenDialog.tsx +++ b/frontend/src/components/basic/dialog/AddServiceTokenDialog.tsx @@ -170,7 +170,7 @@ const AddServiceTokenDialog = ({
handleRoleUpdate(index, e)} data={ myRole === 'owner' ? ['owner', 'admin', 'member'] : ['admin', 'member'] @@ -163,7 +163,7 @@ const UserTable = ({ userData, changeData, myUser, filter, resendInvite, isOrg } row.status !== 'invited' && row.status !== 'verified' && ( { throw new Error('Function not implemented.'); diff --git a/frontend/src/components/integrations/Integration.tsx b/frontend/src/components/integrations/Integration.tsx index 62b44d420b..38b005844a 100644 --- a/frontend/src/components/integrations/Integration.tsx +++ b/frontend/src/components/integrations/Integration.tsx @@ -94,7 +94,7 @@ const Integration = ({ integration, environments = [] }: Props) => {
ENVIRONMENT
@@ -110,7 +110,7 @@ const Integration = ({ integration, environments = [] }: Props) => { ? ['Production', 'Deploy previews', 'Branch deploys', 'Local development'] : null } - selected={integrationContext} + isSelected={integrationContext} onChange={setIntegrationContext} />
@@ -134,7 +134,7 @@ const Integration = ({ integration, environments = [] }: Props) => {

ENVIRONMENT

name) : null} - selected={integrationEnvironment.name} + isSelected={integrationEnvironment.name} onChange={(envName) => setIntegrationEnvironment( environments.find(({ name }) => envName === name) || { @@ -159,7 +159,7 @@ const Integration = ({ integration, environments = [] }: Props) => {
APP
app.name) : null} - selected={integrationApp} + isSelected={integrationApp} onChange={(app) => { setIntegrationApp(app); }} diff --git a/frontend/src/components/utilities/attemptLogin.ts b/frontend/src/components/utilities/attemptLogin.ts index 05c3fbb904..acc2b67fea 100644 --- a/frontend/src/components/utilities/attemptLogin.ts +++ b/frontend/src/components/utilities/attemptLogin.ts @@ -204,7 +204,11 @@ const attemptLogin = async ( } if (isLogin) { - router.push(`/dashboard/${localStorage.getItem('projectData.id')}`); + if (localStorage.getItem('projectData.id') !== "undefined") { + router.push(`/dashboard/${localStorage.getItem('projectData.id')}`); + } else { + router.push("/noprojects"); + } } } catch (error) { console.log(error); diff --git a/frontend/src/pages/dashboard/[id].tsx b/frontend/src/pages/dashboard/[id].tsx index 1052a14f54..6b0ce53ae2 100644 --- a/frontend/src/pages/dashboard/[id].tsx +++ b/frontend/src/pages/dashboard/[id].tsx @@ -564,7 +564,7 @@ export default function Dashboard() {
{!snapshotData && data?.length === 0 && ( name)} onChange={(envName) => setSelectedEnv( @@ -644,7 +644,7 @@ export default function Dashboard() { <> {!snapshotData ? ( name)} onChange={(envName) => setSelectedEnv( @@ -657,7 +657,7 @@ export default function Dashboard() { /> ) : ( name)} onChange={(envName) => setSelectedSnapshotEnv( diff --git a/frontend/src/pages/login.tsx b/frontend/src/pages/login.tsx index 0589870395..571a636f77 100644 --- a/frontend/src/pages/login.tsx +++ b/frontend/src/pages/login.tsx @@ -151,7 +151,7 @@ export default function Login() {
- You are not part of any projects in this organization yet. When you do, they will appear + You are not part of any projects in this organization yet. When you are, they will appear here.
diff --git a/frontend/src/pages/settings/org/[id].tsx b/frontend/src/pages/settings/org/[id].tsx index ff2657e6dd..15fcf07cf5 100644 --- a/frontend/src/pages/settings/org/[id].tsx +++ b/frontend/src/pages/settings/org/[id].tsx @@ -72,7 +72,7 @@ export default function SettingsOrg() { key: guidGenerator(), firstName: orgUser.user?.firstName, lastName: orgUser.user?.lastName, - email: orgUser.user?.email === null ? orgUser.inviteEmail : orgUser.user?.email, + email: orgUser.user?.email == null ? orgUser.inviteEmail : orgUser.user?.email, role: orgUser?.role, status: orgUser?.status, userId: orgUser.user?._id, @@ -115,7 +115,7 @@ export default function SettingsOrg() { }; const submitAddUserModal = async (newUserEmail: string) => { - await addUserToOrg(email, localStorage.getItem('orgData.id') as string); + await addUserToOrg(newUserEmail, localStorage.getItem('orgData.id') as string); setEmail(''); setIsAddUserOpen(false); router.reload(); diff --git a/frontend/src/pages/settings/personal/[id].tsx b/frontend/src/pages/settings/personal/[id].tsx index 72f57f1550..7d015ca407 100644 --- a/frontend/src/pages/settings/personal/[id].tsx +++ b/frontend/src/pages/settings/personal/[id].tsx @@ -93,7 +93,7 @@ export default function PersonalSettings() {