From b3ae2d27488c0aac7af7e24d1dc9f866f5fbd29b Mon Sep 17 00:00:00 2001 From: Ali BARIN Date: Tue, 27 Feb 2024 15:23:23 +0000 Subject: [PATCH] refactor(web): remove typescript --- .eslintrc.js | 18 - .github/workflows/ci.yml | 2 +- package.json | 3 - .../backend/.eslintignore | 0 packages/backend/package.json | 3 +- packages/e2e-tests/package.json | 2 - packages/web/.eslintignore | 3 + packages/web/.eslintrc.js | 3 + packages/web/jsconfig.json | 6 + packages/web/package.json | 22 +- ...ingsRoutes.tsx => adminSettingsRoutes.jsx} | 2 - .../{index.tsx => index.jsx} | 26 +- .../AddAppConnection/{index.tsx => index.jsx} | 47 +- .../AddAppConnection/{style.ts => style.js} | 1 - .../{index.tsx => index.jsx} | 31 +- .../{index.tsx => index.jsx} | 26 +- .../{style.ts => style.js} | 1 - .../{index.tsx => index.jsx} | 18 +- .../{index.tsx => index.jsx} | 31 +- .../{index.tsx => index.jsx} | 28 +- .../{style.ts => style.js} | 1 - .../{index.tsx => index.jsx} | 27 +- .../{index.tsx => index.jsx} | 32 +- .../ApolloProvider/{index.tsx => index.jsx} | 18 +- .../{index.ee.tsx => index.ee.jsx} | 15 +- .../AppBar/{index.tsx => index.jsx} | 24 +- .../{Logo/style.ts => AppBar/style.js} | 1 - .../{index.tsx => index.jsx} | 32 +- .../AppConnectionRow/{index.tsx => index.jsx} | 50 +- .../AppConnectionRow/{style.ts => style.js} | 2 - .../AppConnections/{index.tsx => index.jsx} | 18 +- .../AppFlows/{index.tsx => index.jsx} | 20 +- .../AppIcon/{index.tsx => index.jsx} | 18 +- .../AppRow/{index.tsx => index.jsx} | 16 +- .../components/AppRow/{style.ts => style.js} | 3 - packages/web/src/components/Can/index.jsx | 7 + packages/web/src/components/Can/index.tsx | 22 - .../{index.ee.tsx => index.ee.jsx} | 7 +- .../{index.tsx => index.jsx} | 103 +- .../{index.tsx => index.jsx} | 73 +- .../ColorButton/{index.tsx => index.jsx} | 15 +- .../ColorButton/{style.tsx => style.jsx} | 3 +- .../ColorInput/{index.tsx => index.jsx} | 12 +- .../{index.tsx => index.jsx} | 10 +- .../{style.ts => style.js} | 3 +- .../{index.tsx => index.jsx} | 37 +- .../web/src/components/Container/index.jsx | 8 + .../web/src/components/Container/index.tsx | 10 - .../{index.tsx => index.jsx} | 41 +- .../{index.tsx => index.jsx} | 14 +- .../{Controller.tsx => Controller.jsx} | 19 +- .../{CustomOptions.tsx => CustomOptions.jsx} | 29 +- .../{Options.tsx => Options.jsx} | 47 +- .../{index.tsx => index.jsx} | 87 +- .../{style.ts => style.js} | 3 - .../CustomLogo/{index.ee.tsx => index.ee.jsx} | 7 +- .../CustomLogo/{style.ee.ts => style.ee.js} | 1 - .../DefaultLogo/{index.tsx => index.jsx} | 6 - .../{index.ee.tsx => index.ee.jsx} | 12 +- .../{index.ee.tsx => index.ee.jsx} | 16 +- .../{index.ee.tsx => index.ee.jsx} | 21 +- .../Drawer/{index.tsx => index.jsx} | 26 +- .../components/Drawer/{style.ts => style.js} | 10 +- .../DynamicField/{index.tsx => index.jsx} | 41 +- .../{index.tsx => index.jsx} | 41 +- .../EditableTypography/{style.ts => style.js} | 12 +- .../Editor/{index.tsx => index.jsx} | 44 +- .../EditorLayout/{index.tsx => index.jsx} | 18 +- .../ExecutionHeader/{index.tsx => index.jsx} | 29 +- .../ExecutionRow/{index.tsx => index.jsx} | 19 +- .../ExecutionRow/{style.ts => style.js} | 4 - .../ExecutionStep/{index.tsx => index.jsx} | 32 +- .../ExecutionStep/{style.ts => style.js} | 25 +- .../FlowAppIcons/{index.tsx => index.jsx} | 10 +- .../FlowContextMenu/{index.tsx => index.jsx} | 25 +- .../FlowRow/{index.tsx => index.jsx} | 41 +- .../components/FlowRow/{style.ts => style.js} | 4 - .../FlowStep/{index.tsx => index.jsx} | 93 +- .../FlowStep/{style.ts => style.js} | 11 +- .../{index.tsx => index.jsx} | 21 +- .../FilterConditions/{index.tsx => index.jsx} | 195 ++-- .../FlowSubstep/{index.tsx => index.jsx} | 20 +- .../FlowSubstepTitle/{index.tsx => index.jsx} | 15 +- .../FlowSubstepTitle/{style.tsx => style.jsx} | 2 - .../{index.ee.tsx => index.ee.jsx} | 17 +- .../components/Form/{index.tsx => index.jsx} | 30 +- .../HideOnScroll/{index.tsx => index.jsx} | 6 +- .../InputCreator/{index.tsx => index.jsx} | 41 +- .../{index.tsx => index.jsx} | 11 +- .../{style.ts => style.js} | 1 - .../IntlProvider/{index.tsx => index.jsx} | 8 +- .../Invoices/{index.ee.tsx => index.ee.jsx} | 8 +- .../JSONViewer/{index.tsx => index.jsx} | 13 +- .../JSONViewer/{style.tsx => style.jsx} | 4 - .../Layout/{index.tsx => index.jsx} | 53 +- .../web/src/components/ListItemLink/index.jsx | 49 + .../web/src/components/ListItemLink/index.tsx | 66 -- .../ListLoader/{index.tsx => index.jsx} | 14 +- .../src/components/LiveChat/Chatwoot.ee.jsx | 45 + .../src/components/LiveChat/Chatwoot.ee.tsx | 55 -- .../web/src/components/LiveChat/index.ee.jsx | 47 + .../web/src/components/LiveChat/index.ee.tsx | 62 -- .../LoginForm/{index.tsx => index.jsx} | 10 +- .../components/Logo/{index.tsx => index.jsx} | 8 +- .../{AppBar/style.ts => Logo/style.js} | 1 - .../MationLogo/{index.tsx => index.jsx} | 2 - .../MetadataProvider/{index.tsx => index.jsx} | 22 +- .../NoResultFound/{index.tsx => index.jsx} | 26 +- .../NoResultFound/{style.ts => style.js} | 1 - .../NotFound/{index.tsx => index.jsx} | 6 +- .../NotificationCard/{index.tsx => index.jsx} | 16 +- .../web/src/components/PageTitle/index.jsx | 5 + .../web/src/components/PageTitle/index.tsx | 8 - .../{index.tsx => index.jsx} | 2 - ...tings.ee.tsx => PermissionSettings.ee.jsx} | 23 +- .../{index.ee.tsx => index.ee.jsx} | 15 +- .../Portal/{index.tsx => index.jsx} | 9 +- .../PowerInput/{Popper.tsx => Popper.jsx} | 32 +- .../{Suggestions.tsx => Suggestions.jsx} | 75 +- .../PowerInput/{data.ts => data.js} | 38 +- .../PowerInput/{index.tsx => index.jsx} | 43 +- .../PowerInput/{style.ts => style.js} | 12 +- .../PublicLayout/{index.tsx => index.jsx} | 9 +- .../{index.ee.tsx => index.ee.jsx} | 24 +- .../RoleList/{index.ee.tsx => index.ee.jsx} | 30 +- .../Router/{index.tsx => index.jsx} | 1 - .../SearchInput/{index.tsx => index.jsx} | 11 +- .../{index.tsx => index.jsx} | 25 +- .../SettingsLayout/{index.tsx => index.jsx} | 18 +- .../SignUpForm/{index.ee.tsx => index.ee.jsx} | 26 +- .../Slate/{Element.tsx => Element.jsx} | 4 +- .../Slate/{Variable.tsx => Variable.jsx} | 10 +- .../components/Slate/{index.tsx => index.jsx} | 1 - packages/web/src/components/Slate/types.js | 1 + packages/web/src/components/Slate/types.ts | 32 - .../components/Slate/{utils.ts => utils.js} | 149 +-- .../SnackbarProvider/{index.tsx => index.jsx} | 9 +- .../SplitButton/{index.tsx => index.jsx} | 28 +- .../{index.ee.tsx => index.ee.jsx} | 5 - .../{index.ee.tsx => index.ee.jsx} | 4 - .../Switch/{index.tsx => index.jsx} | 19 +- .../TabPanel/{index.tsx => index.jsx} | 10 +- .../TestSubstep/{index.tsx => index.jsx} | 39 +- .../TextField/{index.tsx => index.jsx} | 29 +- .../ThemeProvider/{index.tsx => index.jsx} | 25 +- .../{index.ee.tsx => index.ee.jsx} | 7 +- .../{index.ee.tsx => index.ee.jsx} | 7 +- .../{style.ee.tsx => style.ee.jsx} | 3 +- .../{index.ee.tsx => index.ee.jsx} | 29 +- .../{index.ee.tsx => index.ee.jsx} | 25 +- .../{index.tsx => index.jsx} | 36 +- .../UserList/{index.tsx => index.jsx} | 54 +- .../UserList/{style.ts => style.js} | 1 - .../WebhookUrlInfo/{index.tsx => index.jsx} | 11 +- .../WebhookUrlInfo/{style.ts => style.js} | 7 +- packages/web/src/config/app.js | 7 + packages/web/src/config/app.ts | 16 - packages/web/src/config/{urls.ts => urls.js} | 69 +- packages/web/src/contexts/Authentication.jsx | 24 + packages/web/src/contexts/Authentication.tsx | 40 - ...utomatischInfo.tsx => AutomatischInfo.jsx} | 31 +- packages/web/src/contexts/Editor.jsx | 10 + packages/web/src/contexts/Editor.tsx | 23 - packages/web/src/contexts/Paddle.ee.jsx | 79 ++ packages/web/src/contexts/Paddle.ee.tsx | 109 --- packages/web/src/contexts/StepExecutions.jsx | 10 + packages/web/src/contexts/StepExecutions.tsx | 20 - .../web/src/graphql/{cache.ts => cache.js} | 12 +- .../web/src/graphql/{client.ts => client.js} | 14 +- packages/web/src/graphql/{link.ts => link.js} | 33 +- ...th-client.ts => create-app-auth-client.js} | 1 - ...ate-app-config.ts => create-app-config.js} | 1 - ...ate-connection.ts => create-connection.js} | 1 - .../{create-flow.ts => create-flow.js} | 1 - .../{create-role.ee.ts => create-role.ee.js} | 1 - .../{create-step.ts => create-step.js} | 1 - .../{create-user.ee.ts => create-user.ee.js} | 1 - ...ete-connection.ts => delete-connection.js} | 1 - ...t-user.ee.ts => delete-current-user.ee.js} | 1 - .../{delete-flow.ts => delete-flow.js} | 1 - .../{delete-role.ee.ts => delete-role.ee.js} | 1 - .../{delete-step.ts => delete-step.js} | 1 - .../{delete-user.ee.ts => delete-user.ee.js} | 1 - .../{duplicate-flow.ts => duplicate-flow.js} | 1 - .../{execute-flow.ts => execute-flow.js} | 1 - ...t-password.ee.ts => forgot-password.ee.js} | 1 - ...erate-auth-url.ts => generate-auth-url.js} | 1 - .../graphql/mutations/{index.ts => index.js} | 8 +- .../graphql/mutations/{login.ts => login.js} | 1 - ...egister-user.ee.ts => register-user.ee.js} | 1 - ...eset-connection.ts => reset-connection.js} | 1 - ...et-password.ee.ts => reset-password.ee.js} | 1 - ...th-client.ts => update-app-auth-client.js} | 1 - ...ate-app-config.ts => update-app-config.js} | 1 - ...pdate-config.ee.ts => update-config.ee.js} | 1 - ...ate-connection.ts => update-connection.js} | 1 - ...current-user.ts => update-current-user.js} | 1 - ...e-flow-status.ts => update-flow-status.js} | 1 - .../{update-flow.ts => update-flow.js} | 1 - .../{update-role.ee.ts => update-role.ee.js} | 1 - .../{update-step.ts => update-step.js} | 1 - .../{update-user.ee.ts => update-user.ee.js} | 1 - ...ovider.ts => upsert-saml-auth-provider.js} | 1 - ...sert-saml-auth-providers-role-mappings.js} | 1 - ...ify-connection.ts => verify-connection.js} | 1 - packages/web/src/graphql/pagination.js | 32 + packages/web/src/graphql/pagination.ts | 70 -- ...client.ee.ts => get-app-auth-client.ee.js} | 2 - ...ients.ee.ts => get-app-auth-clients.ee.js} | 2 - ...-app-config.ee.ts => get-app-config.ee.js} | 2 - ...-connections.ts => get-app-connections.js} | 1 - .../queries/{get-app.ts => get-app.js} | 1 - .../queries/{get-apps.ts => get-apps.js} | 1 - ...atisch-info.ts => get-automatisch-info.js} | 2 - ...sage.ee.ts => get-billing-and-usage.ee.js} | 2 - .../{get-config.ee.ts => get-config.ee.js} | 2 - ...onnected-apps.ts => get-connected-apps.js} | 1 - ...et-current-user.ts => get-current-user.js} | 1 - ...et-dynamic-data.ts => get-dynamic-data.js} | 1 - ...ynamic-fields.ts => get-dynamic-fields.js} | 1 - ...cution-steps.ts => get-execution-steps.js} | 1 - .../{get-execution.ts => get-execution.js} | 1 - .../{get-executions.ts => get-executions.js} | 1 - .../queries/{get-flow.ts => get-flow.js} | 1 - .../queries/{get-flows.ts => get-flows.js} | 1 - ...{get-invoices.ee.ts => get-invoices.ee.js} | 2 - ...-notifications.ts => get-notifications.js} | 1 - ...addle-info.ee.ts => get-paddle-info.ee.js} | 1 - ...nt-plans.ee.ts => get-payment-plans.ee.js} | 1 - ...log.ee.ts => get-permission-catalog.ee.js} | 1 - .../{get-role.ee.ts => get-role.ee.js} | 1 - .../{get-roles.ee.ts => get-roles.ee.js} | 1 - ...> get-saml-auth-provider-role-mappings.js} | 1 - ...-provider.ts => get-saml-auth-provider.js} | 1 - ...ns.ts => get-step-with-test-executions.js} | 1 - ...us.ee.ts => get-subscription-status.ee.js} | 1 - ...al-status.ee.ts => get-trial-status.ee.js} | 1 - .../queries/{get-user.ts => get-user.js} | 1 - .../queries/{get-users.ts => get-users.js} | 11 +- .../{healthcheck.ts => healthcheck.js} | 1 - ...s.ee.ts => list-saml-auth-providers.ee.js} | 1 - ...{test-connection.ts => test-connection.js} | 1 - ...icationSteps.ts => authenticationSteps.js} | 56 +- ...riables.ts => computeAuthStepVariables.js} | 25 +- ...issions.ee.ts => computePermissions.ee.js} | 29 +- ...omputeVariables.ts => computeVariables.js} | 23 +- packages/web/src/helpers/copyInputValue.js | 4 + packages/web/src/helpers/copyInputValue.ts | 5 - .../{filterObject.ts => filterObject.js} | 17 +- .../src/helpers/{isEmpty.ts => isEmpty.js} | 8 +- .../helpers/{nestObject.ts => nestObject.js} | 8 +- packages/web/src/helpers/storage.js | 8 + packages/web/src/helpers/storage.ts | 10 - .../web/src/helpers/translationValues.jsx | 12 + .../web/src/helpers/translationValues.tsx | 16 - .../{userAbility.ts => userAbility.js} | 9 +- .../web/src/hooks/{useApp.ts => useApp.js} | 12 +- ...uthClient.ee.ts => useAppAuthClient.ee.js} | 16 +- ...hClients.ee.ts => useAppAuthClients.ee.js} | 24 +- ...{useAppConfig.ee.ts => useAppConfig.ee.js} | 12 +- packages/web/src/hooks/useApps.js | 12 + packages/web/src/hooks/useApps.ts | 26 - ...cateApp.ee.ts => useAuthenticateApp.ee.js} | 45 +- ...Authentication.ts => useAuthentication.js} | 11 +- ...tomatischInfo.ts => useAutomatischInfo.js} | 10 +- ...ata.ee.ts => useBillingAndUsageData.ee.js} | 32 +- .../src/hooks/{useCloud.ts => useCloud.js} | 11 +- packages/web/src/hooks/useConfig.js | 11 + packages/web/src/hooks/useConfig.ts | 19 - .../{useCurrentUser.ts => useCurrentUser.js} | 6 +- ...serAbility.ts => useCurrentUserAbility.js} | 2 - .../{useDynamicData.ts => useDynamicData.js} | 27 +- ...seDynamicFields.ts => useDynamicFields.js} | 35 +- packages/web/src/hooks/useEnqueueSnackbar.js | 18 + packages/web/src/hooks/useEnqueueSnackbar.ts | 34 - packages/web/src/hooks/useFormatMessage.js | 5 + packages/web/src/hooks/useFormatMessage.ts | 14 - .../{useInvoices.ee.ts => useInvoices.ee.js} | 11 +- ...seNotifications.ts => useNotifications.js} | 12 +- .../{usePaddle.ee.ts => usePaddle.ee.js} | 8 +- ...sePaddleInfo.ee.ts => usePaddleInfo.ee.js} | 13 +- ...ymentPlans.ee.ts => usePaymentPlans.ee.js} | 11 +- ...talog.ee.ts => usePermissionCatalog.ee.js} | 11 +- .../hooks/{useRole.ee.ts => useRole.ee.js} | 13 +- .../hooks/{useRoles.ee.ts => useRoles.ee.js} | 10 +- packages/web/src/hooks/useSamlAuthProvider.js | 12 + packages/web/src/hooks/useSamlAuthProvider.ts | 22 - ....ts => useSamlAuthProviderRoleMappings.js} | 16 +- ...iders.ee.ts => useSamlAuthProviders.ee.js} | 11 +- .../web/src/hooks/useSubscriptionStatus.ee.js | 21 + .../web/src/hooks/useSubscriptionStatus.ee.ts | 31 - ...TrialStatus.ee.ts => useTrialStatus.ee.js} | 82 +- .../web/src/hooks/{useUser.ts => useUser.js} | 13 +- .../src/hooks/{useUsers.ts => useUsers.js} | 26 +- .../hooks/{useVersion.ts => useVersion.js} | 13 +- packages/web/src/{index.tsx => index.jsx} | 5 +- .../AdminApplication/{index.tsx => index.jsx} | 17 +- .../{index.tsx => index.jsx} | 9 +- .../Application/{index.tsx => index.jsx} | 35 +- .../Applications/{index.tsx => index.jsx} | 13 +- .../{RoleMappings.tsx => RoleMappings.jsx} | 34 +- ...sArray.tsx => RoleMappingsFieldsArray.jsx} | 11 +- ...onfiguration.tsx => SamlConfiguration.jsx} | 35 +- .../Authentication/{index.tsx => index.jsx} | 6 - .../{index.ee.tsx => index.ee.jsx} | 6 - .../CreateRole/{index.ee.tsx => index.ee.jsx} | 18 +- .../pages/CreateUser/{index.tsx => index.jsx} | 14 +- .../pages/Dashboard/{index.tsx => index.jsx} | 0 .../EditRole/{index.ee.tsx => index.ee.jsx} | 21 +- .../pages/EditUser/{index.tsx => index.jsx} | 20 +- .../pages/Editor/{create.tsx => create.jsx} | 15 +- .../src/pages/Editor/{index.tsx => index.jsx} | 3 +- .../pages/Editor/{routes.tsx => routes.jsx} | 3 +- .../pages/Execution/{index.tsx => index.jsx} | 21 +- .../pages/Executions/{index.tsx => index.jsx} | 17 +- .../src/pages/Flow/{index.tsx => index.jsx} | 11 +- .../src/pages/Flows/{index.tsx => index.jsx} | 32 +- .../{index.ee.tsx => index.ee.jsx} | 5 +- .../src/pages/Login/{index.tsx => index.jsx} | 4 +- .../LoginCallback/{index.tsx => index.jsx} | 11 +- .../Notifications/{index.tsx => index.jsx} | 17 +- .../{index.ee.tsx => index.ee.jsx} | 10 +- .../ProfileSettings/{index.tsx => index.jsx} | 25 +- .../{index.ee.tsx => index.ee.jsx} | 5 +- .../Roles/{index.ee.tsx => index.ee.jsx} | 4 - .../SignUp/{index.ee.tsx => index.ee.jsx} | 5 +- .../UserInterface/{index.tsx => index.jsx} | 57 +- .../src/pages/Users/{index.tsx => index.jsx} | 4 - packages/web/src/react-app-env.d.ts | 8 - ...{reportWebVitals.ts => reportWebVitals.js} | 5 +- packages/web/src/{routes.tsx => routes.jsx} | 3 - ...{settingsRoutes.tsx => settingsRoutes.jsx} | 2 - .../web/src/{setupTests.ts => setupTests.js} | 0 .../web/src/styles/{theme.ts => theme.js} | 41 +- packages/web/src/types/index.d.ts | 493 ---------- packages/web/tsconfig.json | 21 - yarn.lock | 883 ++++++++++++++---- 337 files changed, 2067 insertions(+), 4997 deletions(-) delete mode 100644 .eslintrc.js rename .eslintignore => packages/backend/.eslintignore (100%) create mode 100644 packages/web/.eslintignore create mode 100644 packages/web/.eslintrc.js create mode 100644 packages/web/jsconfig.json rename packages/web/src/{adminSettingsRoutes.tsx => adminSettingsRoutes.jsx} (99%) rename packages/web/src/components/AccountDropdownMenu/{index.tsx => index.jsx} (79%) rename packages/web/src/components/AddAppConnection/{index.tsx => index.jsx} (82%) rename packages/web/src/components/AddAppConnection/{style.ts => style.js} (99%) rename packages/web/src/components/AddNewAppConnection/{index.tsx => index.jsx} (89%) rename packages/web/src/components/AdminApplicationAuthClientDialog/{index.tsx => index.jsx} (78%) rename packages/web/src/components/AdminApplicationAuthClientDialog/{style.ts => style.js} (99%) rename packages/web/src/components/AdminApplicationAuthClients/{index.tsx => index.jsx} (91%) rename packages/web/src/components/AdminApplicationCreateAuthClient/{index.tsx => index.jsx} (83%) rename packages/web/src/components/AdminApplicationSettings/{index.tsx => index.jsx} (93%) rename packages/web/src/components/AdminApplicationSettings/{style.ts => style.js} (99%) rename packages/web/src/components/AdminApplicationUpdateAuthClient/{index.tsx => index.jsx} (81%) rename packages/web/src/components/AdminSettingsLayout/{index.tsx => index.jsx} (87%) rename packages/web/src/components/ApolloProvider/{index.tsx => index.jsx} (78%) rename packages/web/src/components/AppAuthClientsDialog/{index.ee.tsx => index.ee.jsx} (85%) rename packages/web/src/components/AppBar/{index.tsx => index.jsx} (85%) rename packages/web/src/components/{Logo/style.ts => AppBar/style.js} (99%) rename packages/web/src/components/AppConnectionContextMenu/{index.tsx => index.jsx} (69%) rename packages/web/src/components/AppConnectionRow/{index.tsx => index.jsx} (85%) rename packages/web/src/components/AppConnectionRow/{style.ts => style.js} (99%) rename packages/web/src/components/AppConnections/{index.tsx => index.jsx} (73%) rename packages/web/src/components/AppFlows/{index.tsx => index.jsx} (85%) rename packages/web/src/components/AppIcon/{index.tsx => index.jsx} (61%) rename packages/web/src/components/AppRow/{index.tsx => index.jsx} (90%) rename packages/web/src/components/AppRow/{style.ts => style.js} (99%) create mode 100644 packages/web/src/components/Can/index.jsx delete mode 100644 packages/web/src/components/Can/index.tsx rename packages/web/src/components/CheckoutCompletedAlert/{index.ee.tsx => index.ee.jsx} (91%) rename packages/web/src/components/ChooseAppAndEventSubstep/{index.tsx => index.jsx} (73%) rename packages/web/src/components/ChooseConnectionSubstep/{index.tsx => index.jsx} (84%) rename packages/web/src/components/ColorInput/ColorButton/{index.tsx => index.jsx} (72%) rename packages/web/src/components/ColorInput/ColorButton/{style.tsx => style.jsx} (94%) rename packages/web/src/components/ColorInput/{index.tsx => index.jsx} (72%) rename packages/web/src/components/ConditionalIconButton/{index.tsx => index.jsx} (72%) rename packages/web/src/components/ConditionalIconButton/{style.ts => style.js} (94%) rename packages/web/src/components/ConfirmationDialog/{index.tsx => index.jsx} (53%) create mode 100644 packages/web/src/components/Container/index.jsx delete mode 100644 packages/web/src/components/Container/index.tsx rename packages/web/src/components/ControlledAutocomplete/{index.tsx => index.jsx} (80%) rename packages/web/src/components/ControlledCheckbox/{index.tsx => index.jsx} (78%) rename packages/web/src/components/ControlledCustomAutocomplete/{Controller.tsx => Controller.jsx} (60%) rename packages/web/src/components/ControlledCustomAutocomplete/{CustomOptions.tsx => CustomOptions.jsx} (76%) rename packages/web/src/components/ControlledCustomAutocomplete/{Options.tsx => Options.jsx} (77%) rename packages/web/src/components/ControlledCustomAutocomplete/{index.tsx => index.jsx} (82%) rename packages/web/src/components/ControlledCustomAutocomplete/{style.ts => style.js} (99%) rename packages/web/src/components/CustomLogo/{index.ee.tsx => index.ee.jsx} (86%) rename packages/web/src/components/CustomLogo/{style.ee.ts => style.ee.js} (99%) rename packages/web/src/components/DefaultLogo/{index.tsx => index.jsx} (98%) rename packages/web/src/components/DeleteAccountDialog/{index.ee.tsx => index.ee.jsx} (90%) rename packages/web/src/components/DeleteRoleButton/{index.ee.tsx => index.ee.jsx} (90%) rename packages/web/src/components/DeleteUserButton/{index.ee.tsx => index.ee.jsx} (84%) rename packages/web/src/components/Drawer/{index.tsx => index.jsx} (82%) rename packages/web/src/components/Drawer/{style.ts => style.js} (87%) rename packages/web/src/components/DynamicField/{index.tsx => index.jsx} (81%) rename packages/web/src/components/EditableTypography/{index.tsx => index.jsx} (69%) rename packages/web/src/components/EditableTypography/{style.ts => style.js} (73%) rename packages/web/src/components/Editor/{index.tsx => index.jsx} (81%) rename packages/web/src/components/EditorLayout/{index.tsx => index.jsx} (95%) rename packages/web/src/components/ExecutionHeader/{index.tsx => index.jsx} (75%) rename packages/web/src/components/ExecutionRow/{index.tsx => index.jsx} (87%) rename packages/web/src/components/ExecutionRow/{style.ts => style.js} (99%) rename packages/web/src/components/ExecutionStep/{index.tsx => index.jsx} (88%) rename packages/web/src/components/ExecutionStep/{style.ts => style.js} (89%) rename packages/web/src/components/FlowAppIcons/{index.tsx => index.jsx} (83%) rename packages/web/src/components/FlowContextMenu/{index.tsx => index.jsx} (88%) rename packages/web/src/components/FlowRow/{index.tsx => index.jsx} (80%) rename packages/web/src/components/FlowRow/{style.ts => style.js} (99%) rename packages/web/src/components/FlowStep/{index.tsx => index.jsx} (85%) rename packages/web/src/components/FlowStep/{style.ts => style.js} (93%) rename packages/web/src/components/FlowStepContextMenu/{index.tsx => index.jsx} (73%) rename packages/web/src/components/FlowSubstep/FilterConditions/{index.tsx => index.jsx} (50%) rename packages/web/src/components/FlowSubstep/{index.tsx => index.jsx} (87%) rename packages/web/src/components/FlowSubstepTitle/{index.tsx => index.jsx} (81%) rename packages/web/src/components/FlowSubstepTitle/{style.tsx => style.jsx} (99%) rename packages/web/src/components/ForgotPasswordForm/{index.ee.tsx => index.ee.jsx} (85%) rename packages/web/src/components/Form/{index.tsx => index.jsx} (58%) rename packages/web/src/components/HideOnScroll/{index.tsx => index.jsx} (60%) rename packages/web/src/components/InputCreator/{index.tsx => index.jsx} (88%) rename packages/web/src/components/IntermediateStepCount/{index.tsx => index.jsx} (65%) rename packages/web/src/components/IntermediateStepCount/{style.ts => style.js} (99%) rename packages/web/src/components/IntlProvider/{index.tsx => index.jsx} (69%) rename packages/web/src/components/Invoices/{index.ee.tsx => index.ee.jsx} (97%) rename packages/web/src/components/JSONViewer/{index.tsx => index.jsx} (90%) rename packages/web/src/components/JSONViewer/{style.tsx => style.jsx} (99%) rename packages/web/src/components/Layout/{index.tsx => index.jsx} (80%) create mode 100644 packages/web/src/components/ListItemLink/index.jsx delete mode 100644 packages/web/src/components/ListItemLink/index.tsx rename packages/web/src/components/ListLoader/{index.tsx => index.jsx} (83%) create mode 100644 packages/web/src/components/LiveChat/Chatwoot.ee.jsx delete mode 100644 packages/web/src/components/LiveChat/Chatwoot.ee.tsx create mode 100644 packages/web/src/components/LiveChat/index.ee.jsx delete mode 100644 packages/web/src/components/LiveChat/index.ee.tsx rename packages/web/src/components/LoginForm/{index.tsx => index.jsx} (98%) rename packages/web/src/components/Logo/{index.tsx => index.jsx} (86%) rename packages/web/src/components/{AppBar/style.ts => Logo/style.js} (99%) rename packages/web/src/components/MationLogo/{index.tsx => index.jsx} (98%) rename packages/web/src/components/MetadataProvider/{index.tsx => index.jsx} (68%) rename packages/web/src/components/NoResultFound/{index.tsx => index.jsx} (59%) rename packages/web/src/components/NoResultFound/{style.ts => style.js} (99%) rename packages/web/src/components/NotFound/{index.tsx => index.jsx} (94%) rename packages/web/src/components/NotificationCard/{index.tsx => index.jsx} (83%) create mode 100644 packages/web/src/components/PageTitle/index.jsx delete mode 100644 packages/web/src/components/PageTitle/index.tsx rename packages/web/src/components/PermissionCatalogField/PermissionCatalogFieldLoader/{index.tsx => index.jsx} (99%) rename packages/web/src/components/PermissionCatalogField/{PermissionSettings.ee.tsx => PermissionSettings.ee.jsx} (92%) rename packages/web/src/components/PermissionCatalogField/{index.ee.tsx => index.ee.jsx} (94%) rename packages/web/src/components/Portal/{index.tsx => index.jsx} (53%) rename packages/web/src/components/PowerInput/{Popper.tsx => Popper.jsx} (66%) rename packages/web/src/components/PowerInput/{Suggestions.tsx => Suggestions.jsx} (76%) rename packages/web/src/components/PowerInput/{data.ts => data.js} (67%) rename packages/web/src/components/PowerInput/{index.tsx => index.jsx} (85%) rename packages/web/src/components/PowerInput/{style.ts => style.js} (94%) rename packages/web/src/components/PublicLayout/{index.tsx => index.jsx} (80%) rename packages/web/src/components/ResetPasswordForm/{index.ee.tsx => index.ee.jsx} (91%) rename packages/web/src/components/RoleList/{index.ee.tsx => index.ee.jsx} (84%) rename packages/web/src/components/Router/{index.tsx => index.jsx} (98%) rename packages/web/src/components/SearchInput/{index.tsx => index.jsx} (84%) rename packages/web/src/components/SearchableJSONViewer/{index.tsx => index.jsx} (73%) rename packages/web/src/components/SettingsLayout/{index.tsx => index.jsx} (89%) rename packages/web/src/components/SignUpForm/{index.ee.tsx => index.ee.jsx} (92%) rename packages/web/src/components/Slate/{Element.tsx => Element.jsx} (84%) rename packages/web/src/components/Slate/{Variable.tsx => Variable.jsx} (77%) rename packages/web/src/components/Slate/{index.tsx => index.jsx} (98%) create mode 100644 packages/web/src/components/Slate/types.js delete mode 100644 packages/web/src/components/Slate/types.ts rename packages/web/src/components/Slate/{utils.ts => utils.js} (68%) rename packages/web/src/components/SnackbarProvider/{index.tsx => index.jsx} (56%) rename packages/web/src/components/SplitButton/{index.tsx => index.jsx} (85%) rename packages/web/src/components/SsoProviders/{index.ee.tsx => index.ee.jsx} (99%) rename packages/web/src/components/SubscriptionCancelledAlert/{index.ee.tsx => index.ee.jsx} (99%) rename packages/web/src/components/Switch/{index.tsx => index.jsx} (75%) rename packages/web/src/components/TabPanel/{index.tsx => index.jsx} (55%) rename packages/web/src/components/TestSubstep/{index.tsx => index.jsx} (85%) rename packages/web/src/components/TextField/{index.tsx => index.jsx} (74%) rename packages/web/src/components/ThemeProvider/{index.tsx => index.jsx} (84%) rename packages/web/src/components/TrialOverAlert/{index.ee.tsx => index.ee.jsx} (99%) rename packages/web/src/components/TrialStatusBadge/{index.ee.tsx => index.ee.jsx} (86%) rename packages/web/src/components/TrialStatusBadge/{style.ee.tsx => style.ee.jsx} (92%) rename packages/web/src/components/UpgradeFreeTrial/{index.ee.tsx => index.ee.jsx} (88%) rename packages/web/src/components/UsageDataInformation/{index.ee.tsx => index.ee.jsx} (94%) rename packages/web/src/components/UserList/TablePaginationActions/{index.tsx => index.jsx} (74%) rename packages/web/src/components/UserList/{index.tsx => index.jsx} (81%) rename packages/web/src/components/UserList/{style.ts => style.js} (99%) rename packages/web/src/components/WebhookUrlInfo/{index.tsx => index.jsx} (84%) rename packages/web/src/components/WebhookUrlInfo/{style.ts => style.js} (84%) create mode 100644 packages/web/src/config/app.js delete mode 100644 packages/web/src/config/app.ts rename packages/web/src/config/{urls.ts => urls.js} (69%) create mode 100644 packages/web/src/contexts/Authentication.jsx delete mode 100644 packages/web/src/contexts/Authentication.tsx rename packages/web/src/contexts/{AutomatischInfo.tsx => AutomatischInfo.jsx} (57%) create mode 100644 packages/web/src/contexts/Editor.jsx delete mode 100644 packages/web/src/contexts/Editor.tsx create mode 100644 packages/web/src/contexts/Paddle.ee.jsx delete mode 100644 packages/web/src/contexts/Paddle.ee.tsx create mode 100644 packages/web/src/contexts/StepExecutions.jsx delete mode 100644 packages/web/src/contexts/StepExecutions.tsx rename packages/web/src/graphql/{cache.ts => cache.js} (93%) rename packages/web/src/graphql/{client.ts => client.js} (73%) rename packages/web/src/graphql/{link.ts => link.js} (71%) rename packages/web/src/graphql/mutations/{create-app-auth-client.ts => create-app-auth-client.js} (99%) rename packages/web/src/graphql/mutations/{create-app-config.ts => create-app-config.js} (99%) rename packages/web/src/graphql/mutations/{create-connection.ts => create-connection.js} (99%) rename packages/web/src/graphql/mutations/{create-flow.ts => create-flow.js} (99%) rename packages/web/src/graphql/mutations/{create-role.ee.ts => create-role.ee.js} (99%) rename packages/web/src/graphql/mutations/{create-step.ts => create-step.js} (99%) rename packages/web/src/graphql/mutations/{create-user.ee.ts => create-user.ee.js} (99%) rename packages/web/src/graphql/mutations/{delete-connection.ts => delete-connection.js} (99%) rename packages/web/src/graphql/mutations/{delete-current-user.ee.ts => delete-current-user.ee.js} (99%) rename packages/web/src/graphql/mutations/{delete-flow.ts => delete-flow.js} (99%) rename packages/web/src/graphql/mutations/{delete-role.ee.ts => delete-role.ee.js} (99%) rename packages/web/src/graphql/mutations/{delete-step.ts => delete-step.js} (99%) rename packages/web/src/graphql/mutations/{delete-user.ee.ts => delete-user.ee.js} (99%) rename packages/web/src/graphql/mutations/{duplicate-flow.ts => duplicate-flow.js} (99%) rename packages/web/src/graphql/mutations/{execute-flow.ts => execute-flow.js} (99%) rename packages/web/src/graphql/mutations/{forgot-password.ee.ts => forgot-password.ee.js} (99%) rename packages/web/src/graphql/mutations/{generate-auth-url.ts => generate-auth-url.js} (99%) rename packages/web/src/graphql/mutations/{index.ts => index.js} (88%) rename packages/web/src/graphql/mutations/{login.ts => login.js} (99%) rename packages/web/src/graphql/mutations/{register-user.ee.ts => register-user.ee.js} (99%) rename packages/web/src/graphql/mutations/{reset-connection.ts => reset-connection.js} (99%) rename packages/web/src/graphql/mutations/{reset-password.ee.ts => reset-password.ee.js} (99%) rename packages/web/src/graphql/mutations/{update-app-auth-client.ts => update-app-auth-client.js} (99%) rename packages/web/src/graphql/mutations/{update-app-config.ts => update-app-config.js} (99%) rename packages/web/src/graphql/mutations/{update-config.ee.ts => update-config.ee.js} (99%) rename packages/web/src/graphql/mutations/{update-connection.ts => update-connection.js} (99%) rename packages/web/src/graphql/mutations/{update-current-user.ts => update-current-user.js} (99%) rename packages/web/src/graphql/mutations/{update-flow-status.ts => update-flow-status.js} (99%) rename packages/web/src/graphql/mutations/{update-flow.ts => update-flow.js} (99%) rename packages/web/src/graphql/mutations/{update-role.ee.ts => update-role.ee.js} (99%) rename packages/web/src/graphql/mutations/{update-step.ts => update-step.js} (99%) rename packages/web/src/graphql/mutations/{update-user.ee.ts => update-user.ee.js} (99%) rename packages/web/src/graphql/mutations/{upsert-saml-auth-provider.ts => upsert-saml-auth-provider.js} (99%) rename packages/web/src/graphql/mutations/{upsert-saml-auth-providers-role-mappings.ts => upsert-saml-auth-providers-role-mappings.js} (99%) rename packages/web/src/graphql/mutations/{verify-connection.ts => verify-connection.js} (99%) create mode 100644 packages/web/src/graphql/pagination.js delete mode 100644 packages/web/src/graphql/pagination.ts rename packages/web/src/graphql/queries/{get-app-auth-client.ee.ts => get-app-auth-client.ee.js} (99%) rename packages/web/src/graphql/queries/{get-app-auth-clients.ee.ts => get-app-auth-clients.ee.js} (99%) rename packages/web/src/graphql/queries/{get-app-config.ee.ts => get-app-config.ee.js} (99%) rename packages/web/src/graphql/queries/{get-app-connections.ts => get-app-connections.js} (99%) rename packages/web/src/graphql/queries/{get-app.ts => get-app.js} (99%) rename packages/web/src/graphql/queries/{get-apps.ts => get-apps.js} (99%) rename packages/web/src/graphql/queries/{get-automatisch-info.ts => get-automatisch-info.js} (98%) rename packages/web/src/graphql/queries/{get-billing-and-usage.ee.ts => get-billing-and-usage.ee.js} (99%) rename packages/web/src/graphql/queries/{get-config.ee.ts => get-config.ee.js} (98%) rename packages/web/src/graphql/queries/{get-connected-apps.ts => get-connected-apps.js} (99%) rename packages/web/src/graphql/queries/{get-current-user.ts => get-current-user.js} (99%) rename packages/web/src/graphql/queries/{get-dynamic-data.ts => get-dynamic-data.js} (99%) rename packages/web/src/graphql/queries/{get-dynamic-fields.ts => get-dynamic-fields.js} (99%) rename packages/web/src/graphql/queries/{get-execution-steps.ts => get-execution-steps.js} (99%) rename packages/web/src/graphql/queries/{get-execution.ts => get-execution.js} (99%) rename packages/web/src/graphql/queries/{get-executions.ts => get-executions.js} (99%) rename packages/web/src/graphql/queries/{get-flow.ts => get-flow.js} (99%) rename packages/web/src/graphql/queries/{get-flows.ts => get-flows.js} (99%) rename packages/web/src/graphql/queries/{get-invoices.ee.ts => get-invoices.ee.js} (98%) rename packages/web/src/graphql/queries/{get-notifications.ts => get-notifications.js} (99%) rename packages/web/src/graphql/queries/{get-paddle-info.ee.ts => get-paddle-info.ee.js} (99%) rename packages/web/src/graphql/queries/{get-payment-plans.ee.ts => get-payment-plans.ee.js} (99%) rename packages/web/src/graphql/queries/{get-permission-catalog.ee.ts => get-permission-catalog.ee.js} (99%) rename packages/web/src/graphql/queries/{get-role.ee.ts => get-role.ee.js} (99%) rename packages/web/src/graphql/queries/{get-roles.ee.ts => get-roles.ee.js} (99%) rename packages/web/src/graphql/queries/{get-saml-auth-provider-role-mappings.ts => get-saml-auth-provider-role-mappings.js} (99%) rename packages/web/src/graphql/queries/{get-saml-auth-provider.ts => get-saml-auth-provider.js} (99%) rename packages/web/src/graphql/queries/{get-step-with-test-executions.ts => get-step-with-test-executions.js} (99%) rename packages/web/src/graphql/queries/{get-subscription-status.ee.ts => get-subscription-status.ee.js} (99%) rename packages/web/src/graphql/queries/{get-trial-status.ee.ts => get-trial-status.ee.js} (99%) rename packages/web/src/graphql/queries/{get-user.ts => get-user.js} (99%) rename packages/web/src/graphql/queries/{get-users.ts => get-users.js} (71%) rename packages/web/src/graphql/queries/{healthcheck.ts => healthcheck.js} (99%) rename packages/web/src/graphql/queries/{list-saml-auth-providers.ee.ts => list-saml-auth-providers.ee.js} (99%) rename packages/web/src/graphql/queries/{test-connection.ts => test-connection.js} (99%) rename packages/web/src/helpers/{authenticationSteps.ts => authenticationSteps.js} (70%) rename packages/web/src/helpers/{computeAuthStepVariables.ts => computeAuthStepVariables.js} (65%) rename packages/web/src/helpers/{computePermissions.ee.ts => computePermissions.ee.js} (66%) rename packages/web/src/helpers/{computeVariables.ts => computeVariables.js} (58%) create mode 100644 packages/web/src/helpers/copyInputValue.js delete mode 100644 packages/web/src/helpers/copyInputValue.ts rename packages/web/src/helpers/{filterObject.ts => filterObject.js} (93%) rename packages/web/src/helpers/{isEmpty.ts => isEmpty.js} (86%) rename packages/web/src/helpers/{nestObject.ts => nestObject.js} (64%) create mode 100644 packages/web/src/helpers/storage.js delete mode 100644 packages/web/src/helpers/storage.ts create mode 100644 packages/web/src/helpers/translationValues.jsx delete mode 100644 packages/web/src/helpers/translationValues.tsx rename packages/web/src/helpers/{userAbility.ts => userAbility.js} (74%) rename packages/web/src/hooks/{useApp.ts => useApp.js} (50%) rename packages/web/src/hooks/{useAppAuthClient.ee.ts => useAppAuthClient.ee.js} (65%) rename packages/web/src/hooks/{useAppAuthClients.ee.ts => useAppAuthClients.ee.js} (63%) rename packages/web/src/hooks/{useAppConfig.ee.ts => useAppConfig.ee.js} (55%) create mode 100644 packages/web/src/hooks/useApps.js delete mode 100644 packages/web/src/hooks/useApps.ts rename packages/web/src/hooks/{useAuthenticateApp.ee.ts => useAuthenticateApp.ee.js} (75%) rename packages/web/src/hooks/{useAuthentication.ts => useAuthentication.js} (51%) rename packages/web/src/hooks/{useAutomatischInfo.ts => useAutomatischInfo.js} (65%) rename packages/web/src/hooks/{useBillingAndUsageData.ee.ts => useBillingAndUsageData.ee.js} (72%) rename packages/web/src/hooks/{useCloud.ts => useCloud.js} (71%) create mode 100644 packages/web/src/hooks/useConfig.js delete mode 100644 packages/web/src/hooks/useConfig.ts rename packages/web/src/hooks/{useCurrentUser.ts => useCurrentUser.js} (69%) rename packages/web/src/hooks/{useCurrentUserAbility.ts => useCurrentUserAbility.js} (99%) rename packages/web/src/hooks/{useDynamicData.ts => useDynamicData.js} (88%) rename packages/web/src/hooks/{useDynamicFields.ts => useDynamicFields.js} (86%) create mode 100644 packages/web/src/hooks/useEnqueueSnackbar.js delete mode 100644 packages/web/src/hooks/useEnqueueSnackbar.ts create mode 100644 packages/web/src/hooks/useFormatMessage.js delete mode 100644 packages/web/src/hooks/useFormatMessage.ts rename packages/web/src/hooks/{useInvoices.ee.ts => useInvoices.ee.js} (58%) rename packages/web/src/hooks/{useNotifications.ts => useNotifications.js} (57%) rename packages/web/src/hooks/{usePaddle.ee.ts => usePaddle.ee.js} (64%) rename packages/web/src/hooks/{usePaddleInfo.ee.ts => usePaddleInfo.ee.js} (61%) rename packages/web/src/hooks/{usePaymentPlans.ee.ts => usePaymentPlans.ee.js} (56%) rename packages/web/src/hooks/{usePermissionCatalog.ee.ts => usePermissionCatalog.ee.js} (53%) rename packages/web/src/hooks/{useRole.ee.ts => useRole.ee.js} (61%) rename packages/web/src/hooks/{useRoles.ee.ts => useRoles.ee.js} (62%) create mode 100644 packages/web/src/hooks/useSamlAuthProvider.js delete mode 100644 packages/web/src/hooks/useSamlAuthProvider.ts rename packages/web/src/hooks/{useSamlAuthProviderRoleMappings.ts => useSamlAuthProviderRoleMappings.js} (64%) rename packages/web/src/hooks/{useSamlAuthProviders.ee.ts => useSamlAuthProviders.ee.js} (55%) create mode 100644 packages/web/src/hooks/useSubscriptionStatus.ee.js delete mode 100644 packages/web/src/hooks/useSubscriptionStatus.ee.ts rename packages/web/src/hooks/{useTrialStatus.ee.ts => useTrialStatus.ee.js} (51%) rename packages/web/src/hooks/{useUser.ts => useUser.js} (61%) rename packages/web/src/hooks/{useUsers.ts => useUsers.js} (50%) rename packages/web/src/hooks/{useVersion.ts => useVersion.js} (85%) rename packages/web/src/{index.tsx => index.jsx} (95%) rename packages/web/src/pages/AdminApplication/{index.tsx => index.jsx} (96%) rename packages/web/src/pages/AdminApplications/{index.tsx => index.jsx} (96%) rename packages/web/src/pages/Application/{index.tsx => index.jsx} (92%) rename packages/web/src/pages/Applications/{index.tsx => index.jsx} (94%) rename packages/web/src/pages/Authentication/{RoleMappings.tsx => RoleMappings.jsx} (81%) rename packages/web/src/pages/Authentication/{RoleMappingsFieldsArray.tsx => RoleMappingsFieldsArray.jsx} (94%) rename packages/web/src/pages/Authentication/{SamlConfiguration.tsx => SamlConfiguration.jsx} (90%) rename packages/web/src/pages/Authentication/{index.tsx => index.jsx} (99%) rename packages/web/src/pages/BillingAndUsageSettings/{index.ee.tsx => index.ee.jsx} (99%) rename packages/web/src/pages/CreateRole/{index.ee.tsx => index.ee.jsx} (92%) rename packages/web/src/pages/CreateUser/{index.tsx => index.jsx} (94%) rename packages/web/src/pages/Dashboard/{index.tsx => index.jsx} (100%) rename packages/web/src/pages/EditRole/{index.ee.tsx => index.ee.jsx} (93%) rename packages/web/src/pages/EditUser/{index.tsx => index.jsx} (93%) rename packages/web/src/pages/Editor/{create.tsx => create.jsx} (92%) rename packages/web/src/pages/Editor/{index.tsx => index.jsx} (65%) rename packages/web/src/pages/Editor/{routes.tsx => routes.jsx} (83%) rename packages/web/src/pages/Execution/{index.tsx => index.jsx} (83%) rename packages/web/src/pages/Executions/{index.tsx => index.jsx} (92%) rename packages/web/src/pages/Flow/{index.tsx => index.jsx} (73%) rename packages/web/src/pages/Flows/{index.tsx => index.jsx} (93%) rename packages/web/src/pages/ForgotPassword/{index.ee.tsx => index.ee.jsx} (86%) rename packages/web/src/pages/Login/{index.tsx => index.jsx} (90%) rename packages/web/src/pages/LoginCallback/{index.tsx => index.jsx} (88%) rename packages/web/src/pages/Notifications/{index.tsx => index.jsx} (84%) rename packages/web/src/pages/PlanUpgrade/{index.ee.tsx => index.ee.jsx} (91%) rename packages/web/src/pages/ProfileSettings/{index.tsx => index.jsx} (95%) rename packages/web/src/pages/ResetPassword/{index.ee.tsx => index.ee.jsx} (86%) rename packages/web/src/pages/Roles/{index.ee.tsx => index.ee.jsx} (99%) rename packages/web/src/pages/SignUp/{index.ee.tsx => index.ee.jsx} (87%) rename packages/web/src/pages/UserInterface/{index.tsx => index.jsx} (87%) rename packages/web/src/pages/Users/{index.tsx => index.jsx} (99%) delete mode 100644 packages/web/src/react-app-env.d.ts rename packages/web/src/{reportWebVitals.ts => reportWebVitals.js} (74%) rename packages/web/src/{routes.tsx => routes.jsx} (99%) rename packages/web/src/{settingsRoutes.tsx => settingsRoutes.jsx} (99%) rename packages/web/src/{setupTests.ts => setupTests.js} (100%) rename packages/web/src/styles/{theme.ts => theme.js} (94%) delete mode 100644 packages/web/src/types/index.d.ts delete mode 100644 packages/web/tsconfig.json diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 8d788f7e..00000000 --- a/.eslintrc.js +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = { - root: true, - parser: '@typescript-eslint/parser', - plugins: ['@typescript-eslint'], - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'prettier', - ], - overrides: [ - { - files: ['**/*.test.ts', '**/test/**/*.ts'], - rules: { - '@typescript-eslint/ban-ts-comment': ['off'], - }, - }, - ], -}; diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c537c94..f200e74e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - run: echo "🖥️ The workflow is now ready to test your code on the runner." - run: yarn --frozen-lockfile - - run: yarn lint + - run: cd packages/backend && yarn lint - run: echo "🍏 This job's status is ${{ job.status }}." start-backend-server: runs-on: ubuntu-latest diff --git a/package.json b/package.json index 83e33ab6..e8a5eb9f 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ "start": "lerna run --stream --parallel --scope=@*/{web,backend} dev", "start:web": "lerna run --stream --scope=@*/web dev", "start:backend": "lerna run --stream --scope=@*/backend dev", - "lint": "lerna run --no-bail --stream --parallel --scope=@*/{web,backend} lint", "build:docs": "cd ./packages/docs && yarn install && yarn build" }, "workspaces": { @@ -21,8 +20,6 @@ ] }, "devDependencies": { - "@typescript-eslint/eslint-plugin": "^5.9.1", - "@typescript-eslint/parser": "^5.9.1", "eslint": "^8.13.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-prettier": "^4.0.0", diff --git a/.eslintignore b/packages/backend/.eslintignore similarity index 100% rename from .eslintignore rename to packages/backend/.eslintignore diff --git a/packages/backend/package.json b/packages/backend/package.json index 027525ff..b59b7e0f 100644 --- a/packages/backend/package.json +++ b/packages/backend/package.json @@ -11,7 +11,7 @@ "start:worker": "node src/worker.js", "pretest": "APP_ENV=test node ./test/setup/prepare-test-env.js", "test": "APP_ENV=test vitest run", - "lint": "eslint . --ignore-path ../../.eslintignore", + "lint": "eslint .", "db:create": "node ./bin/database/create.js", "db:seed:user": "node ./bin/database/seed-user.js", "db:drop": "node ./bin/database/drop.js", @@ -95,7 +95,6 @@ "url": "https://github.com/automatisch/automatisch/issues" }, "devDependencies": { - "@typescript-eslint/utils": "^7.0.2", "nodemon": "^2.0.13", "supertest": "^6.3.3", "vitest": "^1.1.3" diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index c1b716ff..48d395e0 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -28,8 +28,6 @@ "@playwright/test": "^1.36.2" }, "dependencies": { - "@typescript-eslint/eslint-plugin": "^5.9.1", - "@typescript-eslint/parser": "^5.9.1", "dotenv": "^16.3.1", "eslint": "^8.13.0", "eslint-config-prettier": "^8.3.0", diff --git a/packages/web/.eslintignore b/packages/web/.eslintignore new file mode 100644 index 00000000..14672a63 --- /dev/null +++ b/packages/web/.eslintignore @@ -0,0 +1,3 @@ +node_modules +build +source \ No newline at end of file diff --git a/packages/web/.eslintrc.js b/packages/web/.eslintrc.js new file mode 100644 index 00000000..1b79b16f --- /dev/null +++ b/packages/web/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: ['react-app', 'prettier'], +}; diff --git a/packages/web/jsconfig.json b/packages/web/jsconfig.json new file mode 100644 index 00000000..5875dc5b --- /dev/null +++ b/packages/web/jsconfig.json @@ -0,0 +1,6 @@ +{ + "compilerOptions": { + "baseUrl": "src" + }, + "include": ["src"] +} diff --git a/packages/web/package.json b/packages/web/package.json index 3f9a476c..201890a3 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -16,16 +16,9 @@ "@testing-library/jest-dom": "^5.11.4", "@testing-library/react": "^11.1.0", "@testing-library/user-event": "^12.1.10", - "@types/jest": "^26.0.15", - "@types/lodash": "^4.14.182", - "@types/luxon": "^2.0.8", - "@types/node": "^12.0.0", - "@types/react": "^17.0.0", - "@types/react-dom": "^17.0.0", - "@types/react-window": "^1.8.5", - "@types/uuid": "^9.0.0", "clipboard-copy": "^4.0.1", "compare-versions": "^4.1.3", + "eslint-plugin-react": "^7.33.2", "graphql": "^15.6.0", "lodash": "^4.17.21", "luxon": "^2.3.1", @@ -42,7 +35,6 @@ "slate": "^0.94.1", "slate-history": "^0.93.0", "slate-react": "^0.94.2", - "typescript": "^4.6.3", "uuid": "^9.0.0", "web-vitals": "^1.0.1", "yup": "^0.32.11" @@ -54,7 +46,7 @@ "build:watch": "yarn nodemon --exec react-scripts build --watch 'src/**/*.ts' --watch 'public/**/*' --ext ts,html", "test": "react-scripts test", "eject": "react-scripts eject", - "lint": "eslint . --ignore-path ../../.eslintignore", + "lint": "eslint .", "prepack": "REACT_APP_GRAPHQL_URL=/graphql yarn build" }, "files": [ @@ -87,5 +79,15 @@ }, "publishConfig": { "access": "public" + }, + "devDependencies": { + "eslint-config-prettier": "^9.1.0", + "eslint-config-react-app": "^7.0.1", + "prettier": "^3.2.5" + }, + "eslintConfig": { + "extends": [ + "./.eslintrc.js" + ] } } diff --git a/packages/web/src/adminSettingsRoutes.tsx b/packages/web/src/adminSettingsRoutes.jsx similarity index 99% rename from packages/web/src/adminSettingsRoutes.tsx rename to packages/web/src/adminSettingsRoutes.jsx index ae59a296..340a92ed 100644 --- a/packages/web/src/adminSettingsRoutes.tsx +++ b/packages/web/src/adminSettingsRoutes.jsx @@ -8,12 +8,10 @@ import CreateRole from 'pages/CreateRole/index.ee'; import EditRole from 'pages/EditRole/index.ee'; import Authentication from 'pages/Authentication'; import UserInterface from 'pages/UserInterface'; - import * as URLS from 'config/urls'; import Can from 'components/Can'; import AdminApplications from 'pages/AdminApplications'; import AdminApplication from 'pages/AdminApplication'; - // TODO: consider introducing redirections to `/` as fallback export default ( <> diff --git a/packages/web/src/components/AccountDropdownMenu/index.tsx b/packages/web/src/components/AccountDropdownMenu/index.jsx similarity index 79% rename from packages/web/src/components/AccountDropdownMenu/index.tsx rename to packages/web/src/components/AccountDropdownMenu/index.jsx index 849b93c0..17c31d8c 100644 --- a/packages/web/src/components/AccountDropdownMenu/index.tsx +++ b/packages/web/src/components/AccountDropdownMenu/index.jsx @@ -1,40 +1,24 @@ import * as React from 'react'; import { useNavigate } from 'react-router-dom'; import MenuItem from '@mui/material/MenuItem'; -import Menu, { MenuProps } from '@mui/material/Menu'; +import Menu from '@mui/material/Menu'; import { Link } from 'react-router-dom'; - import Can from 'components/Can'; import apolloClient from 'graphql/client'; import * as URLS from 'config/urls'; import useAuthentication from 'hooks/useAuthentication'; import useFormatMessage from 'hooks/useFormatMessage'; - -type AccountDropdownMenuProps = { - open: boolean; - onClose: () => void; - anchorEl: MenuProps['anchorEl']; - id: string; -}; - -function AccountDropdownMenu( - props: AccountDropdownMenuProps -): React.ReactElement { +function AccountDropdownMenu(props) { const formatMessage = useFormatMessage(); const authentication = useAuthentication(); const navigate = useNavigate(); - const { open, onClose, anchorEl, id } = props; - const logout = async () => { authentication.updateToken(''); await apolloClient.clearStore(); - onClose(); - navigate(URLS.LOGIN); }; - return ( - + {formatMessage('accountDropdownMenu.adminSettings')} @@ -70,5 +51,4 @@ function AccountDropdownMenu( ); } - export default AccountDropdownMenu; diff --git a/packages/web/src/components/AddAppConnection/index.tsx b/packages/web/src/components/AddAppConnection/index.jsx similarity index 82% rename from packages/web/src/components/AddAppConnection/index.tsx rename to packages/web/src/components/AddAppConnection/index.jsx index 3a7febd3..87db10bf 100644 --- a/packages/web/src/components/AddAppConnection/index.tsx +++ b/packages/web/src/components/AddAppConnection/index.jsx @@ -1,4 +1,3 @@ -import type { IApp, IField, IJSONObject } from 'types'; import LoadingButton from '@mui/lab/LoadingButton'; import Alert from '@mui/material/Alert'; import Dialog from '@mui/material/Dialog'; @@ -6,32 +5,21 @@ import DialogContent from '@mui/material/DialogContent'; import DialogContentText from '@mui/material/DialogContentText'; import DialogTitle from '@mui/material/DialogTitle'; import * as React from 'react'; -import { FieldValues, SubmitHandler } from 'react-hook-form'; import { useNavigate, useSearchParams } from 'react-router-dom'; - import AppAuthClientsDialog from 'components/AppAuthClientsDialog/index.ee'; import InputCreator from 'components/InputCreator'; import * as URLS from 'config/urls'; import useAuthenticateApp from 'hooks/useAuthenticateApp.ee'; import useFormatMessage from 'hooks/useFormatMessage'; -import { generateExternalLink } from '../../helpers/translationValues'; +import { generateExternalLink } from 'helpers/translationValues'; import { Form } from './style'; - -type AddAppConnectionProps = { - onClose: (response: Record) => void; - application: IApp; - connectionId?: string; -}; - -export default function AddAppConnection( - props: AddAppConnectionProps -): React.ReactElement { +export default function AddAppConnection(props) { const { application, connectionId, onClose } = props; const { name, authDocUrl, key, auth } = application; const navigate = useNavigate(); const [searchParams] = useSearchParams(); const formatMessage = useFormatMessage(); - const [error, setError] = React.useState(null); + const [error, setError] = React.useState(null); const [inProgress, setInProgress] = React.useState(false); const hasConnection = Boolean(connectionId); const useShared = searchParams.get('shared') === 'true'; @@ -42,7 +30,6 @@ export default function AddAppConnection( appAuthClientId, useShared: !!appAuthClientId, }); - React.useEffect(function relayProviderData() { if (window.opener) { window.opener.postMessage({ @@ -52,51 +39,41 @@ export default function AddAppConnection( window.close(); } }, []); - React.useEffect( function initiateSharedAuthenticationForGivenAuthClient() { if (!appAuthClientId) return; if (!authenticate) return; - const asyncAuthenticate = async () => { await authenticate(); - navigate(URLS.APP_CONNECTIONS(key)); }; - asyncAuthenticate(); }, - [appAuthClientId, authenticate] + [appAuthClientId, authenticate], ); - - const handleClientClick = (appAuthClientId: string) => + const handleClientClick = (appAuthClientId) => navigate(URLS.APP_ADD_CONNECTION_WITH_AUTH_CLIENT_ID(key, appAuthClientId)); - const handleAuthClientsDialogClose = () => navigate(URLS.APP_CONNECTIONS(key)); - - const submitHandler: SubmitHandler = React.useCallback( + const submitHandler = React.useCallback( async (data) => { if (!authenticate) return; - setInProgress(true); - try { const response = await authenticate({ fields: data, }); - onClose(response as Record); + onClose(response); } catch (err) { - const error = err as IJSONObject; + const error = err; console.log(error); - setError((error.graphQLErrors as IJSONObject[])?.[0]); + setError(error.graphQLErrors?.[0]); } finally { setInProgress(false); } }, - [authenticate] + [authenticate], ); - if (useShared) return ( ); - if (appAuthClientId) return ; - return ( @@ -142,7 +117,7 @@ export default function AddAppConnection(
- {auth?.fields?.map((field: IField) => ( + {auth?.fields?.map((field) => ( ))} diff --git a/packages/web/src/components/AddAppConnection/style.ts b/packages/web/src/components/AddAppConnection/style.js similarity index 99% rename from packages/web/src/components/AddAppConnection/style.ts rename to packages/web/src/components/AddAppConnection/style.js index 411c8683..2d2c4347 100644 --- a/packages/web/src/components/AddAppConnection/style.ts +++ b/packages/web/src/components/AddAppConnection/style.js @@ -1,6 +1,5 @@ import { styled } from '@mui/material/styles'; import BaseForm from 'components/Form'; - export const Form = styled(BaseForm)(({ theme }) => ({ display: 'flex', flexDirection: 'column', diff --git a/packages/web/src/components/AddNewAppConnection/index.tsx b/packages/web/src/components/AddNewAppConnection/index.jsx similarity index 89% rename from packages/web/src/components/AddNewAppConnection/index.tsx rename to packages/web/src/components/AddNewAppConnection/index.jsx index c0985b67..4180f84d 100644 --- a/packages/web/src/components/AddNewAppConnection/index.tsx +++ b/packages/web/src/components/AddNewAppConnection/index.jsx @@ -19,67 +19,52 @@ import InputLabel from '@mui/material/InputLabel'; import OutlinedInput from '@mui/material/OutlinedInput'; import FormControl from '@mui/material/FormControl'; import Box from '@mui/material/Box'; -import type { IApp } from 'types'; - import * as URLS from 'config/urls'; import AppIcon from 'components/AppIcon'; import { GET_APPS } from 'graphql/queries/get-apps'; import useFormatMessage from 'hooks/useFormatMessage'; - -function createConnectionOrFlow(appKey: string, supportsConnections = false) { +function createConnectionOrFlow(appKey, supportsConnections = false) { if (!supportsConnections) { return URLS.CREATE_FLOW_WITH_APP(appKey); } - return URLS.APP_ADD_CONNECTION(appKey); } - -type AddNewAppConnectionProps = { - onClose: () => void; -}; - -export default function AddNewAppConnection( - props: AddNewAppConnectionProps -): React.ReactElement { +export default function AddNewAppConnection(props) { const { onClose } = props; const theme = useTheme(); const matchSmallScreens = useMediaQuery(theme.breakpoints.down('sm')); const formatMessage = useFormatMessage(); - const [appName, setAppName] = React.useState(null); + const [appName, setAppName] = React.useState(null); const [loading, setLoading] = React.useState(false); const [getApps, { data }] = useLazyQuery(GET_APPS, { onCompleted: () => { setLoading(false); }, }); - const fetchData = React.useMemo( () => debounce((name) => getApps({ variables: { name } }), 300), - [getApps] + [getApps], ); - React.useEffect( function fetchAppsOnAppNameChange() { setLoading(true); - fetchData(appName); }, - [fetchData, appName] + [fetchData, appName], ); - React.useEffect(function cancelDebounceOnUnmount() { return () => { fetchData.cancel(); }; }, []); - return ( + data-test="add-app-connection-dialog" + > {formatMessage('apps.addNewAppConnection')} @@ -123,7 +108,7 @@ export default function AddNewAppConnection( )} {!loading && - data?.getApps?.map((app: IApp) => ( + data?.getApps?.map((app) => ( ; - onClose: () => void; -}; - -export default function AdminApplicationAuthClientDialog( - props: AdminApplicationAuthClientDialogProps -): React.ReactElement { +export default function AdminApplicationAuthClientDialog(props) { const { error, onClose, @@ -45,7 +24,6 @@ export default function AdminApplicationAuthClientDialog( disabled = false, } = props; const formatMessage = useFormatMessage(); - return ( {title} @@ -80,7 +58,7 @@ export default function AdminApplicationAuthClientDialog( label={formatMessage('authClient.inputName')} fullWidth /> - {authFields?.map((field: IField) => ( + {authFields?.map((field) => ( ))} ({ display: 'flex', flexDirection: 'column', diff --git a/packages/web/src/components/AdminApplicationAuthClients/index.tsx b/packages/web/src/components/AdminApplicationAuthClients/index.jsx similarity index 91% rename from packages/web/src/components/AdminApplicationAuthClients/index.tsx rename to packages/web/src/components/AdminApplicationAuthClients/index.jsx index cfa5eadb..f311a548 100644 --- a/packages/web/src/components/AdminApplicationAuthClients/index.tsx +++ b/packages/web/src/components/AdminApplicationAuthClients/index.jsx @@ -7,27 +7,16 @@ import CardContent from '@mui/material/CardContent'; import Typography from '@mui/material/Typography'; import Chip from '@mui/material/Chip'; import Button from '@mui/material/Button'; - import * as URLS from 'config/urls'; import useFormatMessage from 'hooks/useFormatMessage'; import useAppAuthClients from 'hooks/useAppAuthClients.ee'; - import NoResultFound from 'components/NoResultFound'; - -type AdminApplicationAuthClientsProps = { - appKey: string; -}; - -function AdminApplicationAuthClients( - props: AdminApplicationAuthClientsProps -): React.ReactElement { +function AdminApplicationAuthClients(props) { const { appKey } = props; const formatMessage = useFormatMessage(); const { appAuthClients, loading } = useAppAuthClients({ appKey }); - if (loading) return ; - if (!appAuthClients?.length) { return ( ); } - const sortedAuthClients = appAuthClients.slice().sort((a, b) => { if (a.id < b.id) { return -1; @@ -46,7 +34,6 @@ function AdminApplicationAuthClients( } return 0; }); - return (
{sortedAuthClients.map((client) => ( @@ -67,7 +54,7 @@ function AdminApplicationAuthClients( label={formatMessage( client?.active ? 'adminAppsAuthClients.statusActive' - : 'adminAppsAuthClients.statusInactive' + : 'adminAppsAuthClients.statusInactive', )} /> @@ -85,5 +72,4 @@ function AdminApplicationAuthClients(
); } - export default AdminApplicationAuthClients; diff --git a/packages/web/src/components/AdminApplicationCreateAuthClient/index.tsx b/packages/web/src/components/AdminApplicationCreateAuthClient/index.jsx similarity index 83% rename from packages/web/src/components/AdminApplicationCreateAuthClient/index.tsx rename to packages/web/src/components/AdminApplicationCreateAuthClient/index.jsx index 4c297423..c253382e 100644 --- a/packages/web/src/components/AdminApplicationCreateAuthClient/index.tsx +++ b/packages/web/src/components/AdminApplicationCreateAuthClient/index.jsx @@ -1,24 +1,11 @@ import React, { useCallback, useMemo } from 'react'; -import type { IApp } from 'types'; -import { FieldValues, SubmitHandler } from 'react-hook-form'; import { useMutation } from '@apollo/client'; import { CREATE_APP_CONFIG } from 'graphql/mutations/create-app-config'; import { CREATE_APP_AUTH_CLIENT } from 'graphql/mutations/create-app-auth-client'; - import useAppConfig from 'hooks/useAppConfig.ee'; import useFormatMessage from 'hooks/useFormatMessage'; - import AdminApplicationAuthClientDialog from 'components/AdminApplicationAuthClientDialog'; - -type AdminApplicationCreateAuthClientProps = { - appKey: string; - application: IApp; - onClose: () => void; -}; - -export default function AdminApplicationCreateAuthClient( - props: AdminApplicationCreateAuthClientProps -): React.ReactElement { +export default function AdminApplicationCreateAuthClient(props) { const { appKey, application, onClose } = props; const { auth } = application; const formatMessage = useFormatMessage(); @@ -37,10 +24,8 @@ export default function AdminApplicationCreateAuthClient( refetchQueries: ['GetAppAuthClients'], context: { autoSnackbar: false }, }); - - const submitHandler: SubmitHandler = async (values) => { + const submitHandler = async (values) => { let appConfigId = appConfig?.id; - if (!appConfigId) { const { data: appConfigData } = await createAppConfig({ variables: { @@ -54,9 +39,7 @@ export default function AdminApplicationCreateAuthClient( }); appConfigId = appConfigData.createAppConfig.id; } - const { name, active, ...formattedAuthDefaults } = values; - await createAppAuthClient({ variables: { input: { @@ -67,17 +50,13 @@ export default function AdminApplicationCreateAuthClient( }, }, }); - onClose(); }; - const getAuthFieldsDefaultValues = useCallback(() => { if (!auth?.fields) { return {}; } - const defaultValues: { - [key: string]: any; - } = {}; + const defaultValues = {}; auth.fields.forEach((field) => { if (field.value || field.type !== 'string') { defaultValues[field.key] = field.value; @@ -87,16 +66,14 @@ export default function AdminApplicationCreateAuthClient( }); return defaultValues; }, [auth?.fields]); - const defaultValues = useMemo( () => ({ name: '', active: false, ...getAuthFieldsDefaultValues(), }), - [getAuthFieldsDefaultValues] + [getAuthFieldsDefaultValues], ); - return ( { + const handleSubmit = async (values) => { try { if (!appConfig) { await createAppConfig({ @@ -56,23 +45,21 @@ function AdminApplicationSettings( enqueueSnackbar(formatMessage('adminAppsSettings.successfullySaved'), { variant: 'success', SnackbarProps: { - 'data-test': 'snackbar-save-admin-apps-settings-success' - } + 'data-test': 'snackbar-save-admin-apps-settings-success', + }, }); } catch (error) { throw new Error('Failed while saving!'); } }; - const defaultValues = useMemo( () => ({ allowCustomConnection: appConfig?.allowCustomConnection || false, shared: appConfig?.shared || false, disabled: appConfig?.disabled || false, }), - [appConfig] + [appConfig], ); - return ( ); } - export default AdminApplicationSettings; diff --git a/packages/web/src/components/AdminApplicationSettings/style.ts b/packages/web/src/components/AdminApplicationSettings/style.js similarity index 99% rename from packages/web/src/components/AdminApplicationSettings/style.ts rename to packages/web/src/components/AdminApplicationSettings/style.js index a32940c1..7f42ed86 100644 --- a/packages/web/src/components/AdminApplicationSettings/style.ts +++ b/packages/web/src/components/AdminApplicationSettings/style.js @@ -1,6 +1,5 @@ import { styled } from '@mui/material/styles'; import SwitchBase from 'components/Switch'; - export const Switch = styled(SwitchBase)` justify-content: space-between; margin: 0; diff --git a/packages/web/src/components/AdminApplicationUpdateAuthClient/index.tsx b/packages/web/src/components/AdminApplicationUpdateAuthClient/index.jsx similarity index 81% rename from packages/web/src/components/AdminApplicationUpdateAuthClient/index.tsx rename to packages/web/src/components/AdminApplicationUpdateAuthClient/index.jsx index 8182f8de..f35f52c5 100644 --- a/packages/web/src/components/AdminApplicationUpdateAuthClient/index.tsx +++ b/packages/web/src/components/AdminApplicationUpdateAuthClient/index.jsx @@ -1,31 +1,18 @@ import React, { useCallback, useMemo } from 'react'; import { useParams } from 'react-router-dom'; -import type { IApp } from 'types'; -import { FieldValues, SubmitHandler } from 'react-hook-form'; import { useMutation } from '@apollo/client'; import { UPDATE_APP_AUTH_CLIENT } from 'graphql/mutations/update-app-auth-client'; - import useAppAuthClient from 'hooks/useAppAuthClient.ee'; import useFormatMessage from 'hooks/useFormatMessage'; import AdminApplicationAuthClientDialog from 'components/AdminApplicationAuthClientDialog'; - -type AdminApplicationUpdateAuthClientProps = { - application: IApp; - onClose: () => void; -}; - -export default function AdminApplicationUpdateAuthClient( - props: AdminApplicationUpdateAuthClientProps -): React.ReactElement { +export default function AdminApplicationUpdateAuthClient(props) { const { application, onClose } = props; const { auth } = application; const authFields = auth?.fields?.map((field) => ({ ...field, required: false, })); - const formatMessage = useFormatMessage(); - const { clientId } = useParams(); const { appAuthClient, loading: loadingAuthClient } = useAppAuthClient(clientId); @@ -34,8 +21,7 @@ export default function AdminApplicationUpdateAuthClient( refetchQueries: ['GetAppAuthClients'], context: { autoSnackbar: false }, }); - - const submitHandler: SubmitHandler = async (values) => { + const submitHandler = async (values) => { if (!appAuthClient) { return; } @@ -52,14 +38,11 @@ export default function AdminApplicationUpdateAuthClient( }); onClose(); }; - const getAuthFieldsDefaultValues = useCallback(() => { if (!authFields) { return {}; } - const defaultValues: { - [key: string]: any; - } = {}; + const defaultValues = {}; authFields.forEach((field) => { if (field.value || field.type !== 'string') { defaultValues[field.key] = field.value; @@ -69,16 +52,14 @@ export default function AdminApplicationUpdateAuthClient( }); return defaultValues; }, [auth?.fields]); - const defaultValues = useMemo( () => ({ name: appAuthClient?.name || '', active: appAuthClient?.active || false, ...getAuthFieldsDefaultValues(), }), - [appAuthClient, getAuthFieldsDefaultValues] + [appAuthClient, getAuthFieldsDefaultValues], ); - return ( setDrawerOpen(true); const closeDrawer = () => setDrawerOpen(false); const drawerLinks = createDrawerLinks({ @@ -108,7 +83,7 @@ export default function SettingsLayout({ currentUserAbility.can('create', 'SamlAuthProvider'), canUpdateApp: currentUserAbility.can('update', 'App'), }); - + const a = 123; const drawerBottomLinks = [ { Icon: ArrowBackIosNewIcon, @@ -117,7 +92,6 @@ export default function SettingsLayout({ dataTest: 'go-back-drawer-link', }, ]; - return ( <> { +const ApolloProvider = (props) => { const enqueueSnackbar = useEnqueueSnackbar(); const authentication = useAuthentication(); - const onError = React.useCallback( (message) => { enqueueSnackbar(message, { variant: 'error', SnackbarProps: { - 'data-test': 'snackbar-error' - } + 'data-test': 'snackbar-error', + }, }); }, - [enqueueSnackbar] + [enqueueSnackbar], ); - const client = React.useMemo(() => { return mutateAndGetClient({ onError, token: authentication.token, }); }, [onError, authentication]); - return ; }; - export default ApolloProvider; diff --git a/packages/web/src/components/AppAuthClientsDialog/index.ee.tsx b/packages/web/src/components/AppAuthClientsDialog/index.ee.jsx similarity index 85% rename from packages/web/src/components/AppAuthClientsDialog/index.ee.tsx rename to packages/web/src/components/AppAuthClientsDialog/index.ee.jsx index ff044f79..395bdc24 100644 --- a/packages/web/src/components/AppAuthClientsDialog/index.ee.tsx +++ b/packages/web/src/components/AppAuthClientsDialog/index.ee.jsx @@ -5,33 +5,22 @@ import ListItem from '@mui/material/ListItem'; import ListItemButton from '@mui/material/ListItemButton'; import ListItemText from '@mui/material/ListItemText'; import * as React from 'react'; - import useAppAuthClients from 'hooks/useAppAuthClients.ee'; import useFormatMessage from 'hooks/useFormatMessage'; - -type AppAuthClientsDialogProps = { - appKey: string; - onClientClick: (appAuthClientId: string) => void; - onClose: () => void; -}; - -export default function AppAuthClientsDialog(props: AppAuthClientsDialogProps) { +export default function AppAuthClientsDialog(props) { const { appKey, onClientClick, onClose } = props; const { appAuthClients } = useAppAuthClients({ appKey, active: true }); const formatMessage = useFormatMessage(); - React.useEffect( function autoAuthenticateSingleClient() { if (appAuthClients?.length === 1) { onClientClick(appAuthClients[0].id); } }, - [appAuthClients] + [appAuthClients], ); - if (!appAuthClients?.length || appAuthClients?.length === 1) return ; - return ( {formatMessage('appAuthClientsDialog.title')} diff --git a/packages/web/src/components/AppBar/index.tsx b/packages/web/src/components/AppBar/index.jsx similarity index 85% rename from packages/web/src/components/AppBar/index.tsx rename to packages/web/src/components/AppBar/index.jsx index 60bea460..1a0b9d8d 100644 --- a/packages/web/src/components/AppBar/index.tsx +++ b/packages/web/src/components/AppBar/index.jsx @@ -2,49 +2,31 @@ import AccountCircleIcon from '@mui/icons-material/AccountCircle'; import MenuIcon from '@mui/icons-material/Menu'; import MenuOpenIcon from '@mui/icons-material/MenuOpen'; import MuiAppBar from '@mui/material/AppBar'; -import type { ContainerProps } from '@mui/material/Container'; import IconButton from '@mui/material/IconButton'; import Toolbar from '@mui/material/Toolbar'; import { useTheme } from '@mui/material/styles'; import useMediaQuery from '@mui/material/useMediaQuery'; import * as React from 'react'; - import AccountDropdownMenu from 'components/AccountDropdownMenu'; import Container from 'components/Container'; import Logo from 'components/Logo/index'; import TrialStatusBadge from 'components/TrialStatusBadge/index.ee'; import * as URLS from 'config/urls'; - import { Link } from './style'; - -type AppBarProps = { - drawerOpen: boolean; - onDrawerOpen: () => void; - onDrawerClose: () => void; - maxWidth?: ContainerProps['maxWidth']; -}; - const accountMenuId = 'account-menu'; - -export default function AppBar(props: AppBarProps): React.ReactElement { +export default function AppBar(props) { const { drawerOpen, onDrawerOpen, onDrawerClose, maxWidth = false } = props; - const theme = useTheme(); const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md')); - const [accountMenuAnchorElement, setAccountMenuAnchorElement] = - React.useState(null); - + React.useState(null); const isMenuOpen = Boolean(accountMenuAnchorElement); - - const handleAccountMenuOpen = (event: React.MouseEvent) => { + const handleAccountMenuOpen = (event) => { setAccountMenuAnchorElement(event.currentTarget); }; - const handleAccountMenuClose = () => { setAccountMenuAnchorElement(null); }; - return ( diff --git a/packages/web/src/components/Logo/style.ts b/packages/web/src/components/AppBar/style.js similarity index 99% rename from packages/web/src/components/Logo/style.ts rename to packages/web/src/components/AppBar/style.js index 5c446842..2d26af6e 100644 --- a/packages/web/src/components/Logo/style.ts +++ b/packages/web/src/components/AppBar/style.js @@ -1,6 +1,5 @@ import { styled } from '@mui/material/styles'; import { Link as RouterLink } from 'react-router-dom'; - export const Link = styled(RouterLink)(() => ({ textDecoration: 'none', color: 'inherit', diff --git a/packages/web/src/components/AppConnectionContextMenu/index.tsx b/packages/web/src/components/AppConnectionContextMenu/index.jsx similarity index 69% rename from packages/web/src/components/AppConnectionContextMenu/index.tsx rename to packages/web/src/components/AppConnectionContextMenu/index.jsx index 0e83ea37..e2f277df 100644 --- a/packages/web/src/components/AppConnectionContextMenu/index.tsx +++ b/packages/web/src/components/AppConnectionContextMenu/index.jsx @@ -1,29 +1,10 @@ import * as React from 'react'; import { Link } from 'react-router-dom'; import Menu from '@mui/material/Menu'; -import type { PopoverProps } from '@mui/material/Popover'; import MenuItem from '@mui/material/MenuItem'; -import type { IConnection } from 'types'; - import * as URLS from 'config/urls'; import useFormatMessage from 'hooks/useFormatMessage'; - -type Action = { - type: 'test' | 'reconnect' | 'delete' | 'viewFlows'; -}; - -type ContextMenuProps = { - appKey: string; - connection: IConnection; - onClose: () => void; - onMenuItemClick: (event: React.MouseEvent, action: Action) => void; - anchorEl: PopoverProps['anchorEl']; - disableReconnection: boolean; -}; - -export default function ContextMenu( - props: ContextMenuProps -): React.ReactElement { +export default function ContextMenu(props) { const { appKey, connection, @@ -33,18 +14,15 @@ export default function ContextMenu( disableReconnection, } = props; const formatMessage = useFormatMessage(); - const createActionHandler = React.useCallback( - (action: Action) => { - return function clickHandler(event: React.MouseEvent) { + (action) => { + return function clickHandler(event) { onMenuItemClick(event, action); - onClose(); }; }, - [onMenuItemClick, onClose] + [onMenuItemClick, onClose], ); - return ( diff --git a/packages/web/src/components/AppConnectionRow/index.tsx b/packages/web/src/components/AppConnectionRow/index.jsx similarity index 85% rename from packages/web/src/components/AppConnectionRow/index.tsx rename to packages/web/src/components/AppConnectionRow/index.jsx index b0a70e22..6a139098 100644 --- a/packages/web/src/components/AppConnectionRow/index.tsx +++ b/packages/web/src/components/AppConnectionRow/index.jsx @@ -10,26 +10,18 @@ import Stack from '@mui/material/Stack'; import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar'; import { DateTime } from 'luxon'; import * as React from 'react'; - -import type { IConnection } from 'types'; import ConnectionContextMenu from 'components/AppConnectionContextMenu'; import { DELETE_CONNECTION } from 'graphql/mutations/delete-connection'; import { TEST_CONNECTION } from 'graphql/queries/test-connection'; import useFormatMessage from 'hooks/useFormatMessage'; import { CardContent, Typography } from './style'; - -type AppConnectionRowProps = { - connection: IConnection; -}; - -const countTranslation = (value: React.ReactNode) => ( +const countTranslation = (value) => ( <> {value}
); - -function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement { +function AppConnectionRow(props) { const enqueueSnackbar = useEnqueueSnackbar(); const [verificationVisible, setVerificationVisible] = React.useState(false); const [testConnection, { called: testCalled, loading: testLoading }] = @@ -43,7 +35,6 @@ function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement { }, }); const [deleteConnection] = useMutation(DELETE_CONNECTION); - const formatMessage = useFormatMessage(); const { id, @@ -54,17 +45,14 @@ function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement { flowCount, reconnectable, } = props.connection; - - const contextButtonRef = React.useRef(null); - const [anchorEl, setAnchorEl] = React.useState(null); - + const contextButtonRef = React.useRef(null); + const [anchorEl, setAnchorEl] = React.useState(null); const handleClose = () => { setAnchorEl(null); }; - const onContextMenuClick = () => setAnchorEl(contextButtonRef.current); const onContextMenuAction = React.useCallback( - async (event, action: { [key: string]: string }) => { + async (event, action) => { if (action.type === 'delete') { await deleteConnection({ variables: { input: { id } }, @@ -73,13 +61,11 @@ function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement { __typename: 'Connection', id, }); - cache.evict({ id: connectionCacheId, }); }, }); - enqueueSnackbar(formatMessage('connection.deletedMessage'), { variant: 'success', SnackbarProps: { @@ -91,13 +77,11 @@ function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement { testConnection({ variables: { id } }); } }, - [deleteConnection, id, testConnection, formatMessage, enqueueSnackbar] + [deleteConnection, id, testConnection, formatMessage, enqueueSnackbar], ); - const relativeCreatedAt = DateTime.fromMillis( - parseInt(createdAt, 10) + parseInt(createdAt, 10), ).toRelative(); - return ( <> @@ -125,14 +109,17 @@ function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement { )} - {verificationVisible && testCalled && !testLoading && verified && ( - <> - - - {formatMessage('connection.testSuccessful')} - - - )} + {verificationVisible && + testCalled && + !testLoading && + verified && ( + <> + + + {formatMessage('connection.testSuccessful')} + + + )} {verificationVisible && testCalled && !testLoading && @@ -179,5 +166,4 @@ function AppConnectionRow(props: AppConnectionRowProps): React.ReactElement { ); } - export default AppConnectionRow; diff --git a/packages/web/src/components/AppConnectionRow/style.ts b/packages/web/src/components/AppConnectionRow/style.js similarity index 99% rename from packages/web/src/components/AppConnectionRow/style.ts rename to packages/web/src/components/AppConnectionRow/style.js index 9bbc429b..2bc8d163 100644 --- a/packages/web/src/components/AppConnectionRow/style.ts +++ b/packages/web/src/components/AppConnectionRow/style.js @@ -1,7 +1,6 @@ import { styled } from '@mui/material/styles'; import MuiCardContent from '@mui/material/CardContent'; import MuiTypography from '@mui/material/Typography'; - export const CardContent = styled(MuiCardContent)(({ theme }) => ({ display: 'grid', gridTemplateRows: 'auto', @@ -9,7 +8,6 @@ export const CardContent = styled(MuiCardContent)(({ theme }) => ({ gridColumnGap: theme.spacing(2), alignItems: 'center', })); - export const Typography = styled(MuiTypography)(() => ({ textAlign: 'center', display: 'inline-block', diff --git a/packages/web/src/components/AppConnections/index.tsx b/packages/web/src/components/AppConnections/index.jsx similarity index 73% rename from packages/web/src/components/AppConnections/index.tsx rename to packages/web/src/components/AppConnections/index.jsx index 3150cc05..74061258 100644 --- a/packages/web/src/components/AppConnections/index.tsx +++ b/packages/web/src/components/AppConnections/index.jsx @@ -1,29 +1,18 @@ import * as React from 'react'; import { useQuery } from '@apollo/client'; - -import type { IConnection } from 'types'; import { GET_APP_CONNECTIONS } from 'graphql/queries/get-app-connections'; import AppConnectionRow from 'components/AppConnectionRow'; import NoResultFound from 'components/NoResultFound'; import useFormatMessage from 'hooks/useFormatMessage'; import * as URLS from 'config/urls'; - -type AppConnectionsProps = { - appKey: string; -}; - -export default function AppConnections( - props: AppConnectionsProps -): React.ReactElement { +export default function AppConnections(props) { const { appKey } = props; const formatMessage = useFormatMessage(); const { data } = useQuery(GET_APP_CONNECTIONS, { variables: { key: appKey }, }); - const appConnections: IConnection[] = data?.getApp?.connections || []; - + const appConnections = data?.getApp?.connections || []; const hasConnections = appConnections?.length; - if (!hasConnections) { return ( ); } - return ( <> - {appConnections.map((appConnection: IConnection) => ( + {appConnections.map((appConnection) => ( ))} diff --git a/packages/web/src/components/AppFlows/index.tsx b/packages/web/src/components/AppFlows/index.jsx similarity index 85% rename from packages/web/src/components/AppFlows/index.tsx rename to packages/web/src/components/AppFlows/index.jsx index dba06bec..eede48f5 100644 --- a/packages/web/src/components/AppFlows/index.tsx +++ b/packages/web/src/components/AppFlows/index.jsx @@ -3,25 +3,16 @@ import { Link, useSearchParams } from 'react-router-dom'; import { GET_FLOWS } from 'graphql/queries/get-flows'; import Pagination from '@mui/material/Pagination'; import PaginationItem from '@mui/material/PaginationItem'; - import * as URLS from 'config/urls'; import AppFlowRow from 'components/FlowRow'; import NoResultFound from 'components/NoResultFound'; import useFormatMessage from 'hooks/useFormatMessage'; -import type { IFlow } from 'types'; - -type AppFlowsProps = { - appKey: string; -}; - const FLOW_PER_PAGE = 10; - -const getLimitAndOffset = (page: number) => ({ +const getLimitAndOffset = (page) => ({ limit: FLOW_PER_PAGE, offset: (page - 1) * FLOW_PER_PAGE, }); - -export default function AppFlows(props: AppFlowsProps): React.ReactElement { +export default function AppFlows(props) { const { appKey } = props; const formatMessage = useFormatMessage(); const [searchParams, setSearchParams] = useSearchParams(); @@ -36,10 +27,8 @@ export default function AppFlows(props: AppFlowsProps): React.ReactElement { }); const getFlows = data?.getFlows || {}; const { pageInfo, edges } = getFlows; - - const flows: IFlow[] = edges?.map(({ node }: { node: IFlow }) => node); + const flows = edges?.map(({ node }) => node); const hasFlows = flows?.length; - if (!hasFlows) { return ( ); } - return ( <> - {flows?.map((appFlow: IFlow) => ( + {flows?.map((appFlow) => ( ))} diff --git a/packages/web/src/components/AppIcon/index.tsx b/packages/web/src/components/AppIcon/index.jsx similarity index 61% rename from packages/web/src/components/AppIcon/index.tsx rename to packages/web/src/components/AppIcon/index.jsx index 4e87ab5c..1357bd2d 100644 --- a/packages/web/src/components/AppIcon/index.tsx +++ b/packages/web/src/components/AppIcon/index.jsx @@ -1,25 +1,11 @@ import * as React from 'react'; import Avatar from '@mui/material/Avatar'; -import type { AvatarProps } from '@mui/material/Avatar'; - -type AppIconProps = { - name?: string; - url?: string; - color?: string; - variant?: AvatarProps['variant']; -}; - -const inlineImgStyle: React.CSSProperties = { +const inlineImgStyle = { objectFit: 'contain', }; - -export default function AppIcon( - props: AppIconProps & AvatarProps -): React.ReactElement { +export default function AppIcon(props) { const { name, url, color, sx = {}, variant = 'square', ...restProps } = props; - const initialLetter = name?.[0]; - return ( ( +const countTranslation = (value) => ( <> {value}
); - -function AppRow(props: AppRowProps): React.ReactElement { +function AppRow(props) { const formatMessage = useFormatMessage(); const { name, primaryColor, iconUrl, connectionCount, flowCount } = props.application; - return ( @@ -76,5 +65,4 @@ function AppRow(props: AppRowProps): React.ReactElement { ); } - export default AppRow; diff --git a/packages/web/src/components/AppRow/style.ts b/packages/web/src/components/AppRow/style.js similarity index 99% rename from packages/web/src/components/AppRow/style.ts rename to packages/web/src/components/AppRow/style.js index 3c00d785..05709cd9 100644 --- a/packages/web/src/components/AppRow/style.ts +++ b/packages/web/src/components/AppRow/style.js @@ -1,7 +1,6 @@ import { styled } from '@mui/material/styles'; import MuiCardContent from '@mui/material/CardContent'; import MuiTypography from '@mui/material/Typography'; - export const CardContent = styled(MuiCardContent)(({ theme }) => ({ display: 'grid', gridTemplateRows: 'auto', @@ -9,7 +8,6 @@ export const CardContent = styled(MuiCardContent)(({ theme }) => ({ gridColumnGap: theme.spacing(2), alignItems: 'center', })); - export const Typography = styled(MuiTypography)(() => ({ '&.MuiTypography-h6': { textTransform: 'capitalize', @@ -17,7 +15,6 @@ export const Typography = styled(MuiTypography)(() => ({ textAlign: 'center', display: 'inline-block', })); - export const DesktopOnlyBreakline = styled('br')(({ theme }) => ({ [theme.breakpoints.down('sm')]: { display: 'none', diff --git a/packages/web/src/components/Can/index.jsx b/packages/web/src/components/Can/index.jsx new file mode 100644 index 00000000..b98893ce --- /dev/null +++ b/packages/web/src/components/Can/index.jsx @@ -0,0 +1,7 @@ +import { Can as OriginalCan } from '@casl/react'; +import * as React from 'react'; +import useCurrentUserAbility from 'hooks/useCurrentUserAbility'; +export default function Can(props) { + const currentUserAbility = useCurrentUserAbility(); + return ; +} diff --git a/packages/web/src/components/Can/index.tsx b/packages/web/src/components/Can/index.tsx deleted file mode 100644 index 08957059..00000000 --- a/packages/web/src/components/Can/index.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { Can as OriginalCan } from '@casl/react'; -import * as React from 'react'; - -import useCurrentUserAbility from 'hooks/useCurrentUserAbility'; - -type CanProps = { - I: string; - a: string; - passThrough?: boolean; - children: React.ReactNode | ((isAllowed: boolean) => React.ReactNode); -} | { - I: string; - an: string; - passThrough?: boolean; - children: React.ReactNode | ((isAllowed: boolean) => React.ReactNode); -}; - -export default function Can(props: CanProps) { - const currentUserAbility = useCurrentUserAbility(); - - return (); -}; diff --git a/packages/web/src/components/CheckoutCompletedAlert/index.ee.tsx b/packages/web/src/components/CheckoutCompletedAlert/index.ee.jsx similarity index 91% rename from packages/web/src/components/CheckoutCompletedAlert/index.ee.tsx rename to packages/web/src/components/CheckoutCompletedAlert/index.ee.jsx index c2f41f64..f1ff8e91 100644 --- a/packages/web/src/components/CheckoutCompletedAlert/index.ee.tsx +++ b/packages/web/src/components/CheckoutCompletedAlert/index.ee.jsx @@ -2,18 +2,13 @@ import * as React from 'react'; import { useLocation } from 'react-router-dom'; import Alert from '@mui/material/Alert'; import Typography from '@mui/material/Typography'; - import useFormatMessage from 'hooks/useFormatMessage'; - export default function CheckoutCompletedAlert() { const formatMessage = useFormatMessage(); const location = useLocation(); - const state = location.state as { checkoutCompleted: boolean }; - + const state = location.state; const checkoutCompleted = state?.checkoutCompleted; - if (!checkoutCompleted) return ; - return ( void; - onCollapse: () => void; - onChange: ({ step }: { step: IStep }) => void; - onSubmit: () => void; - step: IStep; -}; - -const optionGenerator = (app: { - name: string; - key: string; -}): { label: string; value: string } => ({ - label: app.name as string, - value: app.key as string, +const optionGenerator = (app) => ({ + label: app.name, + value: app.key, }); - -const eventOptionGenerator = (app: { - name: string; - key: string; - type?: string; -}): { label: string; value: string; type: string } => ({ - label: app.name as string, - value: app.key as string, - type: app?.type as string, +const eventOptionGenerator = (app) => ({ + label: app.name, + value: app.key, + type: app?.type, }); - -const getOption = ( - options: T[], - selectedOptionValue?: string -) => options.find((option) => option.value === selectedOptionValue); - -function ChooseAppAndEventSubstep( - props: ChooseAppAndEventSubstepProps -): React.ReactElement { +const getOption = (options, selectedOptionValue) => + options.find((option) => option.value === selectedOptionValue); +function ChooseAppAndEventSubstep(props) { const { substep, expanded = false, @@ -59,49 +32,38 @@ function ChooseAppAndEventSubstep( onSubmit, onChange, } = props; - const formatMessage = useFormatMessage(); const editorContext = React.useContext(EditorContext); - const isTrigger = step.type === 'trigger'; const isAction = step.type === 'action'; - const { apps } = useApps({ onlyWithTriggers: isTrigger, onlyWithActions: isAction, }); - const app = apps?.find((currentApp: IApp) => currentApp.key === step.appKey); - + const app = apps?.find((currentApp) => currentApp.key === step.appKey); const appOptions = React.useMemo( () => apps?.map((app) => optionGenerator(app)) || [], - [apps] + [apps], ); - const actionsOrTriggers: Array = - (isTrigger ? app?.triggers : app?.actions) || []; + const actionsOrTriggers = (isTrigger ? app?.triggers : app?.actions) || []; const actionOrTriggerOptions = React.useMemo( () => actionsOrTriggers.map((trigger) => eventOptionGenerator(trigger)), - [app?.key] + [app?.key], ); const selectedActionOrTrigger = actionsOrTriggers.find( - (actionOrTrigger: IAction | ITrigger) => actionOrTrigger.key === step?.key + (actionOrTrigger) => actionOrTrigger.key === step?.key, ); - - const isWebhook = - isTrigger && (selectedActionOrTrigger as ITrigger)?.type === 'webhook'; - + const isWebhook = isTrigger && selectedActionOrTrigger?.type === 'webhook'; const { name } = substep; - - const valid: boolean = !!step.key && !!step.appKey; - + const valid = !!step.key && !!step.appKey; // placeholders const onEventChange = React.useCallback( - (event: React.SyntheticEvent, selectedOption: unknown) => { + (event, selectedOption) => { if (typeof selectedOption === 'object') { // TODO: try to simplify type casting below. - const typedSelectedOption = selectedOption as { value: string }; - const option: { value: string } = typedSelectedOption; - const eventKey = option?.value as string; - + const typedSelectedOption = selectedOption; + const option = typedSelectedOption; + const eventKey = option?.value; if (step.key !== eventKey) { onChange({ step: { @@ -112,17 +74,15 @@ function ChooseAppAndEventSubstep( } } }, - [step, onChange] + [step, onChange], ); - const onAppChange = React.useCallback( - (event: React.SyntheticEvent, selectedOption: unknown) => { + (event, selectedOption) => { if (typeof selectedOption === 'object') { // TODO: try to simplify type casting below. - const typedSelectedOption = selectedOption as { value: string }; - const option: { value: string } = typedSelectedOption; - const appKey = option?.value as string; - + const typedSelectedOption = selectedOption; + const option = typedSelectedOption; + const appKey = option?.value; if (step.appKey !== appKey) { onChange({ step: { @@ -135,11 +95,9 @@ function ChooseAppAndEventSubstep( } } }, - [step, onChange] + [step, onChange], ); - const onToggle = expanded ? onCollapse : onExpand; - return ( )} @@ -237,11 +195,11 @@ function ChooseAppAndEventSubstep( )} - {isTrigger && (selectedActionOrTrigger as ITrigger)?.pollInterval && ( + {isTrigger && selectedActionOrTrigger?.pollInterval && ( ); } - export default ChooseAppAndEventSubstep; diff --git a/packages/web/src/components/ChooseConnectionSubstep/index.tsx b/packages/web/src/components/ChooseConnectionSubstep/index.jsx similarity index 84% rename from packages/web/src/components/ChooseConnectionSubstep/index.tsx rename to packages/web/src/components/ChooseConnectionSubstep/index.jsx index cef67d58..38e4367c 100644 --- a/packages/web/src/components/ChooseConnectionSubstep/index.tsx +++ b/packages/web/src/components/ChooseConnectionSubstep/index.jsx @@ -5,8 +5,6 @@ import Collapse from '@mui/material/Collapse'; import ListItem from '@mui/material/ListItem'; import TextField from '@mui/material/TextField'; import * as React from 'react'; - -import type { IApp, IConnection, IStep, ISubstep } from 'types'; import AddAppConnection from 'components/AddAppConnection'; import AppAuthClientsDialog from 'components/AppAuthClientsDialog/index.ee'; import FlowSubstepTitle from 'components/FlowSubstepTitle'; @@ -16,34 +14,15 @@ import { GET_APP_CONNECTIONS } from 'graphql/queries/get-app-connections'; import { TEST_CONNECTION } from 'graphql/queries/test-connection'; import useAuthenticateApp from 'hooks/useAuthenticateApp.ee'; import useFormatMessage from 'hooks/useFormatMessage'; - -type ChooseConnectionSubstepProps = { - application: IApp; - substep: ISubstep; - expanded?: boolean; - onExpand: () => void; - onCollapse: () => void; - onChange: ({ step }: { step: IStep }) => void; - onSubmit: () => void; - step: IStep; -}; - const ADD_CONNECTION_VALUE = 'ADD_CONNECTION'; const ADD_SHARED_CONNECTION_VALUE = 'ADD_SHARED_CONNECTION'; - -const optionGenerator = ( - connection: IConnection -): { label: string; value: string } => ({ - label: (connection?.formattedData?.screenName as string) ?? 'Unnamed', - value: connection?.id as string, +const optionGenerator = (connection) => ({ + label: connection?.formattedData?.screenName ?? 'Unnamed', + value: connection?.id, }); - -const getOption = (options: Record[], connectionId?: string) => +const getOption = (options, connectionId) => options.find((connection) => connection.value === connectionId) || null; - -function ChooseConnectionSubstep( - props: ChooseConnectionSubstepProps -): React.ReactElement { +function ChooseConnectionSubstep(props) { const { substep, expanded = false, @@ -78,7 +57,6 @@ function ChooseConnectionSubstep( id: connection?.id, }, }); - React.useEffect(() => { if (connection?.id) { testConnection({ @@ -89,42 +67,34 @@ function ChooseConnectionSubstep( } // intentionally no dependencies for initial test }, []); - const connectionOptions = React.useMemo(() => { - const appWithConnections = data?.getApp as IApp; + const appWithConnections = data?.getApp; const options = appWithConnections?.connections?.map((connection) => - optionGenerator(connection) + optionGenerator(connection), ) || []; - if (!appConfig || appConfig.canCustomConnect) { options.push({ label: formatMessage('chooseConnectionSubstep.addNewConnection'), value: ADD_CONNECTION_VALUE, }); } - if (appConfig?.canConnect) { options.push({ label: formatMessage('chooseConnectionSubstep.addNewSharedConnection'), value: ADD_SHARED_CONNECTION_VALUE, }); } - return options; }, [data, formatMessage, appConfig]); - - const handleClientClick = async (appAuthClientId: string) => { + const handleClientClick = async (appAuthClientId) => { try { const response = await authenticate?.({ appAuthClientId, }); - const connectionId = response?.createConnection.id; - if (connectionId) { await refetch(); - onChange({ step: { ...step, @@ -140,18 +110,13 @@ function ChooseConnectionSubstep( setShowAddSharedConnectionDialog(false); } }; - const { name } = substep; - const handleAddConnectionClose = React.useCallback( async (response) => { setShowAddConnectionDialog(false); - const connectionId = response?.createConnection.id; - if (connectionId) { await refetch(); - onChange({ step: { ...step, @@ -162,27 +127,23 @@ function ChooseConnectionSubstep( }); } }, - [onChange, refetch, step] + [onChange, refetch, step], ); - const handleChange = React.useCallback( - (event: React.SyntheticEvent, selectedOption: unknown) => { + (event, selectedOption) => { if (typeof selectedOption === 'object') { // TODO: try to simplify type casting below. - const typedSelectedOption = selectedOption as { value: string }; - const option: { value: string } = typedSelectedOption; - const connectionId = option?.value as string; - + const typedSelectedOption = selectedOption; + const option = typedSelectedOption; + const connectionId = option?.value; if (connectionId === ADD_CONNECTION_VALUE) { setShowAddConnectionDialog(true); return; } - if (connectionId === ADD_SHARED_CONNECTION_VALUE) { setShowAddSharedConnectionDialog(true); return; } - if (connectionId !== step.connection?.id) { onChange({ step: { @@ -195,9 +156,8 @@ function ChooseConnectionSubstep( } } }, - [step, onChange] + [step, onChange], ); - React.useEffect(() => { if (step.connection?.id) { retestConnection({ @@ -205,9 +165,7 @@ function ChooseConnectionSubstep( }); } }, [step.connection?.id, retestConnection]); - const onToggle = expanded ? onCollapse : onExpand; - return ( )} @@ -279,5 +237,4 @@ function ChooseConnectionSubstep( ); } - export default ChooseConnectionSubstep; diff --git a/packages/web/src/components/ColorInput/ColorButton/index.tsx b/packages/web/src/components/ColorInput/ColorButton/index.jsx similarity index 72% rename from packages/web/src/components/ColorInput/ColorButton/index.tsx rename to packages/web/src/components/ColorInput/ColorButton/index.jsx index 2eac7f19..76caa0a0 100644 --- a/packages/web/src/components/ColorInput/ColorButton/index.tsx +++ b/packages/web/src/components/ColorInput/ColorButton/index.jsx @@ -1,19 +1,8 @@ import React from 'react'; -import { ButtonProps } from '@mui/material/Button'; import { Button } from './style'; - const BG_IMAGE_FALLBACK = 'linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(135deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(135deg, transparent 75%, #ccc 75%) /*! @noflip */'; - -export type ColorButtonProps = Omit & { - bgColor: string; - isBgColorValid: boolean; - disablePopover: boolean; -}; - -export type ColorButtonElement = (props: ColorButtonProps) => JSX.Element; - -const ColorButton = (props: ColorButtonProps) => { +const ColorButton = (props) => { const { bgColor, className, @@ -21,7 +10,6 @@ const ColorButton = (props: ColorButtonProps) => { isBgColorValid, ...restButtonProps } = props; - return ( + {cancelButtonChildren && onClose && ( + )} - {(confirmButtionChildren && onConfirm) && ( + {confirmButtionChildren && onConfirm && ( )} diff --git a/packages/web/src/components/Container/index.jsx b/packages/web/src/components/Container/index.jsx new file mode 100644 index 00000000..07228073 --- /dev/null +++ b/packages/web/src/components/Container/index.jsx @@ -0,0 +1,8 @@ +import * as React from 'react'; +import MuiContainer from '@mui/material/Container'; +export default function Container(props) { + return ; +} +Container.defaultProps = { + maxWidth: 'lg', +}; diff --git a/packages/web/src/components/Container/index.tsx b/packages/web/src/components/Container/index.tsx deleted file mode 100644 index 26d28db8..00000000 --- a/packages/web/src/components/Container/index.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import * as React from 'react'; -import MuiContainer, { ContainerProps } from '@mui/material/Container'; - -export default function Container(props: ContainerProps): React.ReactElement { - return ; -} - -Container.defaultProps = { - maxWidth: 'lg', -}; diff --git a/packages/web/src/components/ControlledAutocomplete/index.tsx b/packages/web/src/components/ControlledAutocomplete/index.jsx similarity index 80% rename from packages/web/src/components/ControlledAutocomplete/index.tsx rename to packages/web/src/components/ControlledAutocomplete/index.jsx index 6e9cde23..cd5ae7b9 100644 --- a/packages/web/src/components/ControlledAutocomplete/index.tsx +++ b/packages/web/src/components/ControlledAutocomplete/index.jsx @@ -1,39 +1,19 @@ import * as React from 'react'; import { Controller, useFormContext } from 'react-hook-form'; import FormHelperText from '@mui/material/FormHelperText'; -import Autocomplete, { - AutocompleteProps, - createFilterOptions, -} from '@mui/material/Autocomplete'; +import Autocomplete, { createFilterOptions } from '@mui/material/Autocomplete'; import Typography from '@mui/material/Typography'; -import type { IFieldDropdownOption } from 'types'; - -interface ControlledAutocompleteProps - extends AutocompleteProps { - shouldUnregister?: boolean; - name: string; - required?: boolean; - showOptionValue?: boolean; - description?: string; - dependsOn?: string[]; -} - -const getOption = (options: readonly IFieldDropdownOption[], value: string) => +const getOption = (options, value) => options.find((option) => option.value === value) || null; - // Enables filtering by value in autocomplete dropdown -const filterOptions = createFilterOptions({ +const filterOptions = createFilterOptions({ stringify: ({ label, value }) => ` ${label} ${value} `, }); - -function ControlledAutocomplete( - props: ControlledAutocompleteProps -): React.ReactElement { +function ControlledAutocomplete(props) { const { control, watch, setValue, resetField } = useFormContext(); - const { required = false, name, @@ -47,23 +27,19 @@ function ControlledAutocomplete( showOptionValue, ...autocompleteProps } = props; - - let dependsOnValues: unknown[] = []; + let dependsOnValues = []; if (dependsOn?.length) { dependsOnValues = watch(dependsOn); } - React.useEffect(() => { const hasDependencies = dependsOnValues.length; const allDepsSatisfied = dependsOnValues.every(Boolean); - if (hasDependencies && !allDepsSatisfied) { // Reset the field if any dependency is not satisfied setValue(name, null); resetField(name); } }, dependsOnValues); - return ( { - const typedSelectedOption = - selectedOption as IFieldDropdownOption; + const typedSelectedOption = selectedOption; if ( typedSelectedOption !== null && Object.prototype.hasOwnProperty.call( typedSelectedOption, - 'value' + 'value', ) ) { controllerOnChange(typedSelectedOption.value); } else { controllerOnChange(typedSelectedOption); } - onChange?.(event, selectedOption, reason, details); }} onBlur={(...args) => { @@ -139,5 +113,4 @@ function ControlledAutocomplete( /> ); } - export default ControlledAutocomplete; diff --git a/packages/web/src/components/ControlledCheckbox/index.tsx b/packages/web/src/components/ControlledCheckbox/index.jsx similarity index 78% rename from packages/web/src/components/ControlledCheckbox/index.tsx rename to packages/web/src/components/ControlledCheckbox/index.jsx index 1b8b269c..27c9aaf3 100644 --- a/packages/web/src/components/ControlledCheckbox/index.tsx +++ b/packages/web/src/components/ControlledCheckbox/index.jsx @@ -1,16 +1,7 @@ import * as React from 'react'; import { Controller, useFormContext } from 'react-hook-form'; -import Checkbox, { CheckboxProps } from '@mui/material/Checkbox'; - -type ControlledCheckboxProps = { - name: string; - defaultValue?: boolean; - dataTest?: string; -} & Omit; - -export default function ControlledCheckbox( - props: ControlledCheckboxProps -): React.ReactElement { +import Checkbox from '@mui/material/Checkbox'; +export default function ControlledCheckbox(props) { const { control } = useFormContext(); const { required, @@ -22,7 +13,6 @@ export default function ControlledCheckbox( dataTest, ...checkboxProps } = props; - return ( React.cloneElement(children, { field })} + render={({ field }) => React.cloneElement(children, { field })} /> ); } - export default Controller; diff --git a/packages/web/src/components/ControlledCustomAutocomplete/CustomOptions.tsx b/packages/web/src/components/ControlledCustomAutocomplete/CustomOptions.jsx similarity index 76% rename from packages/web/src/components/ControlledCustomAutocomplete/CustomOptions.tsx rename to packages/web/src/components/ControlledCustomAutocomplete/CustomOptions.jsx index 6e79853d..a0516f41 100644 --- a/packages/web/src/components/ControlledCustomAutocomplete/CustomOptions.tsx +++ b/packages/web/src/components/ControlledCustomAutocomplete/CustomOptions.jsx @@ -2,27 +2,11 @@ import Paper from '@mui/material/Paper'; import Popper from '@mui/material/Popper'; import Tab from '@mui/material/Tab'; import * as React from 'react'; - -import type { IFieldDropdownOption } from 'types'; import Suggestions from 'components/PowerInput/Suggestions'; import TabPanel from 'components/TabPanel'; - import Options from './Options'; import { Tabs } from './style'; - -interface CustomOptionsProps { - open: boolean; - anchorEl: any; - data: any; - options: readonly IFieldDropdownOption[]; - onSuggestionClick: any; - onOptionClick: (event: React.MouseEvent, option: any) => void; - onTabChange: (tabIndex: 0 | 1) => void; - label?: string; - initialTabIndex?: 0 | 1; -} - -const CustomOptions = (props: CustomOptionsProps) => { +const CustomOptions = (props) => { const { open, anchorEl, @@ -34,24 +18,18 @@ const CustomOptions = (props: CustomOptionsProps) => { label, initialTabIndex, } = props; - - const [activeTabIndex, setActiveTabIndex] = React.useState< - number | undefined - >(undefined); - + const [activeTabIndex, setActiveTabIndex] = React.useState(undefined); React.useEffect( function applyInitialActiveTabIndex() { setActiveTabIndex((currentActiveTabIndex) => { if (currentActiveTabIndex === undefined) { return initialTabIndex; } - return currentActiveTabIndex; }); }, - [initialTabIndex] + [initialTabIndex], ); - return ( { ); }; - export default CustomOptions; diff --git a/packages/web/src/components/ControlledCustomAutocomplete/Options.tsx b/packages/web/src/components/ControlledCustomAutocomplete/Options.jsx similarity index 77% rename from packages/web/src/components/ControlledCustomAutocomplete/Options.tsx rename to packages/web/src/components/ControlledCustomAutocomplete/Options.jsx index 5e8b2448..9560b2a7 100644 --- a/packages/web/src/components/ControlledCustomAutocomplete/Options.tsx +++ b/packages/web/src/components/ControlledCustomAutocomplete/Options.jsx @@ -1,35 +1,23 @@ -import type { IFieldDropdownOption } from 'types'; import ListItemButton from '@mui/material/ListItemButton'; import ListItemText from '@mui/material/ListItemText'; import throttle from 'lodash/throttle'; import * as React from 'react'; -import { FixedSizeList, ListChildComponentProps } from 'react-window'; - +import { FixedSizeList } from 'react-window'; import { Typography } from '@mui/material'; import SearchInput from 'components/SearchInput'; import useFormatMessage from 'hooks/useFormatMessage'; import { SearchInputWrapper } from './style'; - -interface OptionsProps { - data: readonly IFieldDropdownOption[]; - onOptionClick: (event: React.MouseEvent, option: any) => void; -} - const SHORT_LIST_LENGTH = 4; const LIST_ITEM_HEIGHT = 64; - -const computeListHeight = (currentLength: number) => { +const computeListHeight = (currentLength) => { const numberOfRenderedItems = Math.min(SHORT_LIST_LENGTH, currentLength); return LIST_ITEM_HEIGHT * numberOfRenderedItems; }; - const renderItemFactory = - ({ onOptionClick }: Pick) => - (props: ListChildComponentProps) => { + ({ onOptionClick }) => + (props) => { const { index, style, data } = props; - const suboption = data[index]; - return ( ); }; - -const Options = (props: OptionsProps) => { +const Options = (props) => { const formatMessage = useFormatMessage(); const { data, onOptionClick } = props; - const [filteredData, setFilteredData] = - React.useState(data); - + const [filteredData, setFilteredData] = React.useState(data); React.useEffect( function syncOptions() { setFilteredData((filteredData) => { if (filteredData.length === 0 && filteredData.length !== data.length) { return data; } - return filteredData; }); }, - [data] + [data], ); - const renderItem = React.useMemo( () => renderItemFactory({ onOptionClick, }), - [onOptionClick] + [onOptionClick], ); - const onSearchChange = React.useMemo( () => - throttle((event: React.ChangeEvent) => { - const search = (event.target as HTMLInputElement).value.toLowerCase(); - + throttle((event) => { + const search = event.target.value.toLowerCase(); if (!search) { setFilteredData(data); return; } - const newFilteredData = data.filter((option) => `${option.label}\n${option.value}` .toLowerCase() - .includes(search.toLowerCase()) + .includes(search.toLowerCase()), ); - setFilteredData(newFilteredData); }, 400), - [data] + [data], ); - return ( <> @@ -130,5 +108,4 @@ const Options = (props: OptionsProps) => { ); }; - export default Options; diff --git a/packages/web/src/components/ControlledCustomAutocomplete/index.tsx b/packages/web/src/components/ControlledCustomAutocomplete/index.jsx similarity index 82% rename from packages/web/src/components/ControlledCustomAutocomplete/index.tsx rename to packages/web/src/components/ControlledCustomAutocomplete/index.jsx index f3a131cd..e18f452d 100644 --- a/packages/web/src/components/ControlledCustomAutocomplete/index.tsx +++ b/packages/web/src/components/ControlledCustomAutocomplete/index.jsx @@ -2,20 +2,15 @@ import * as React from 'react'; import { useController, useFormContext } from 'react-hook-form'; import { IconButton } from '@mui/material'; import FormHelperText from '@mui/material/FormHelperText'; -import { AutocompleteProps } from '@mui/material/Autocomplete'; import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown'; import ClearIcon from '@mui/icons-material/Clear'; -import type { IFieldDropdownOption } from 'types'; import { ActionButtonsWrapper } from './style'; - import ClickAwayListener from '@mui/base/ClickAwayListener'; import InputLabel from '@mui/material/InputLabel'; import { createEditor } from 'slate'; import { Editable, ReactEditor } from 'slate-react'; - import Slate from 'components/Slate'; import Element from 'components/Slate/Element'; - import { serialize, deserialize, @@ -30,32 +25,10 @@ import { InputLabelWrapper, ChildrenWrapper, } from 'components/PowerInput/style'; -import { VariableElement } from 'components/Slate/types'; import CustomOptions from './CustomOptions'; import { processStepWithExecutions } from 'components/PowerInput/data'; import { StepExecutionsContext } from 'contexts/StepExecutions'; - -interface ControlledCustomAutocompleteProps - extends AutocompleteProps { - showOptionValue?: boolean; - dependsOn?: string[]; - - defaultValue?: string; - name: string; - label?: string; - type?: string; - required?: boolean; - readOnly?: boolean; - description?: string; - docUrl?: string; - clickToCopy?: boolean; - disabled?: boolean; - shouldUnregister?: boolean; -} - -function ControlledCustomAutocomplete( - props: ControlledCustomAutocompleteProps -): React.ReactElement { +function ControlledCustomAutocomplete(props) { const { defaultValue = '', name, @@ -83,63 +56,48 @@ function ControlledCustomAutocomplete( } = field; const [, forceUpdate] = React.useReducer((x) => x + 1, 0); const [isInitialValueSet, setInitialValue] = React.useState(false); - const [isSingleChoice, setSingleChoice] = React.useState( - undefined - ); + const [isSingleChoice, setSingleChoice] = React.useState(undefined); const priorStepsWithExecutions = React.useContext(StepExecutionsContext); - const editorRef = React.useRef(null); + const editorRef = React.useRef(null); const renderElement = React.useCallback( (props) => , - [disabled] + [disabled], ); const [editor] = React.useState(() => customizeEditor(createEditor())); const [showVariableSuggestions, setShowVariableSuggestions] = React.useState(false); - - let dependsOnValues: unknown[] = []; + let dependsOnValues = []; if (dependsOn?.length) { dependsOnValues = watch(dependsOn); } - React.useEffect(() => { const ref = ReactEditor.toDOMNode(editor, editor); - resizeObserver.observe(ref); - return () => resizeObserver.unobserve(ref); }, []); - const promoteValue = () => { const serializedValue = serialize(editor.children); controllerOnChange(serializedValue); }; - const resizeObserver = React.useMemo(function syncCustomOptionsPosition() { return new ResizeObserver(() => { forceUpdate(); }); }, []); - React.useEffect(() => { const hasDependencies = dependsOnValues.length; - if (hasDependencies) { // Reset the field when a dependent has been updated resetEditor(editor); } }, dependsOnValues); - React.useEffect( function updateInitialValue() { const hasOptions = options.length; const isOptionsLoaded = loading === false; if (!isInitialValueSet && hasOptions && isOptionsLoaded) { setInitialValue(true); - - const option: IFieldDropdownOption | undefined = options.find( - (option) => option.value === value - ); - + const option = options.find((option) => option.value === value); if (option) { overrideEditorValue(editor, { option, focus: false }); setSingleChoice(true); @@ -148,70 +106,56 @@ function ControlledCustomAutocomplete( } } }, - [isInitialValueSet, options, loading] + [isInitialValueSet, options, loading], ); - React.useEffect(() => { if (!showVariableSuggestions && value !== serialize(editor.children)) { promoteValue(); } }, [showVariableSuggestions]); - - const hideSuggestionsOnShift = ( - event: React.KeyboardEvent - ) => { + const hideSuggestionsOnShift = (event) => { if (event.code === 'Tab') { setShowVariableSuggestions(false); } }; - - const handleKeyDown = (event: React.KeyboardEvent) => { + const handleKeyDown = (event) => { hideSuggestionsOnShift(event); if (event.code === 'Tab') { promoteValue(); } - if (isSingleChoice && event.code !== 'Tab') { event.preventDefault(); } }; - const stepsWithVariables = React.useMemo(() => { return processStepWithExecutions(priorStepsWithExecutions); }, [priorStepsWithExecutions]); - const handleVariableSuggestionClick = React.useCallback( - (variable: Pick) => { + (variable) => { insertVariable(editor, variable, stepsWithVariables); }, - [stepsWithVariables] + [stepsWithVariables], ); - const handleOptionClick = React.useCallback( - (event: React.MouseEvent, option: IFieldDropdownOption) => { + (event, option) => { event.stopPropagation(); overrideEditorValue(editor, { option, focus: false }); setShowVariableSuggestions(false); setSingleChoice(true); }, - [stepsWithVariables] + [stepsWithVariables], ); - - const handleClearButtonClick = (event: React.MouseEvent) => { + const handleClearButtonClick = (event) => { event.stopPropagation(); resetEditor(editor); promoteValue(); setSingleChoice(undefined); }; - - const reset = (tabIndex: 0 | 1) => { + const reset = (tabIndex) => { const isOptions = tabIndex === 0; - setSingleChoice(isOptions); - resetEditor(editor, { focus: true }); }; - return ( ); } - export default ControlledCustomAutocomplete; diff --git a/packages/web/src/components/ControlledCustomAutocomplete/style.ts b/packages/web/src/components/ControlledCustomAutocomplete/style.js similarity index 99% rename from packages/web/src/components/ControlledCustomAutocomplete/style.ts rename to packages/web/src/components/ControlledCustomAutocomplete/style.js index 83e6960e..42a1e007 100644 --- a/packages/web/src/components/ControlledCustomAutocomplete/style.ts +++ b/packages/web/src/components/ControlledCustomAutocomplete/style.js @@ -1,18 +1,15 @@ import { styled } from '@mui/material/styles'; import Stack from '@mui/material/Stack'; import MuiTabs from '@mui/material/Tabs'; - export const ActionButtonsWrapper = styled(Stack)` position: absolute; right: 0; top: 50%; transform: translateY(-50%); `; - export const Tabs = styled(MuiTabs)` border-bottom: 1px solid ${({ theme }) => theme.palette.divider}; `; - export const SearchInputWrapper = styled('div')` padding: ${({ theme }) => theme.spacing(0, 2, 2, 2)}; `; diff --git a/packages/web/src/components/CustomLogo/index.ee.tsx b/packages/web/src/components/CustomLogo/index.ee.jsx similarity index 86% rename from packages/web/src/components/CustomLogo/index.ee.tsx rename to packages/web/src/components/CustomLogo/index.ee.jsx index 877124b4..ccea8c55 100644 --- a/packages/web/src/components/CustomLogo/index.ee.tsx +++ b/packages/web/src/components/CustomLogo/index.ee.jsx @@ -1,13 +1,9 @@ import useConfig from 'hooks/useConfig'; import { LogoImage } from './style.ee'; - const CustomLogo = () => { const { config, loading } = useConfig(['logo.svgData']); - if (loading || !config?.['logo.svgData']) return null; - - const logoSvgData = config['logo.svgData'] as string; - + const logoSvgData = config['logo.svgData']; return ( { /> ); }; - export default CustomLogo; diff --git a/packages/web/src/components/CustomLogo/style.ee.ts b/packages/web/src/components/CustomLogo/style.ee.js similarity index 99% rename from packages/web/src/components/CustomLogo/style.ee.ts rename to packages/web/src/components/CustomLogo/style.ee.js index 51f6e131..1e156e6e 100644 --- a/packages/web/src/components/CustomLogo/style.ee.ts +++ b/packages/web/src/components/CustomLogo/style.ee.js @@ -1,5 +1,4 @@ import styled from '@emotion/styled'; - export const LogoImage = styled('img')(() => ({ maxWidth: 200, maxHeight: 22, diff --git a/packages/web/src/components/DefaultLogo/index.tsx b/packages/web/src/components/DefaultLogo/index.jsx similarity index 98% rename from packages/web/src/components/DefaultLogo/index.tsx rename to packages/web/src/components/DefaultLogo/index.jsx index 8c989fc3..0ced62ba 100644 --- a/packages/web/src/components/DefaultLogo/index.tsx +++ b/packages/web/src/components/DefaultLogo/index.jsx @@ -1,22 +1,16 @@ import Typography from '@mui/material/Typography'; import * as React from 'react'; import { FormattedMessage } from 'react-intl'; - import MationLogo from 'components/MationLogo'; import useAutomatischInfo from 'hooks/useAutomatischInfo'; - const DefaultLogo = () => { const { isMation, loading } = useAutomatischInfo(); - if (loading) return ; - if (isMation) return ; - return ( ); }; - export default DefaultLogo; diff --git a/packages/web/src/components/DeleteAccountDialog/index.ee.tsx b/packages/web/src/components/DeleteAccountDialog/index.ee.jsx similarity index 90% rename from packages/web/src/components/DeleteAccountDialog/index.ee.tsx rename to packages/web/src/components/DeleteAccountDialog/index.ee.jsx index 74b823fc..e21c3219 100644 --- a/packages/web/src/components/DeleteAccountDialog/index.ee.tsx +++ b/packages/web/src/components/DeleteAccountDialog/index.ee.jsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { useNavigate } from 'react-router-dom'; import { useMutation } from '@apollo/client'; - import * as URLS from 'config/urls'; import ConfirmationDialog from 'components/ConfirmationDialog'; import apolloClient from 'graphql/client'; @@ -9,27 +8,18 @@ import { DELETE_CURRENT_USER } from 'graphql/mutations/delete-current-user.ee'; import useAuthentication from 'hooks/useAuthentication'; import useFormatMessage from 'hooks/useFormatMessage'; import useCurrentUser from 'hooks/useCurrentUser'; - -type DeleteAccountDialogProps = { - onClose: () => void; -} - -export default function DeleteAccountDialog(props: DeleteAccountDialogProps) { +export default function DeleteAccountDialog(props) { const [deleteCurrentUser] = useMutation(DELETE_CURRENT_USER); const formatMessage = useFormatMessage(); const currentUser = useCurrentUser(); const authentication = useAuthentication(); const navigate = useNavigate(); - const handleConfirm = React.useCallback(async () => { await deleteCurrentUser(); - authentication.updateToken(''); await apolloClient.clearStore(); - navigate(URLS.LOGIN); }, [deleteCurrentUser, currentUser]); - return ( { try { await deleteRole(); - setShowConfirmation(false); enqueueSnackbar(formatMessage('deleteRoleButton.successfullyDeleted'), { variant: 'success', SnackbarProps: { - 'data-test': 'snackbar-delete-role-success' - } + 'data-test': 'snackbar-delete-role-success', + }, }); } catch (error) { throw new Error('Failed while deleting!'); } }, [deleteRole]); - return ( <> diff --git a/packages/web/src/components/DeleteUserButton/index.ee.tsx b/packages/web/src/components/DeleteUserButton/index.ee.jsx similarity index 84% rename from packages/web/src/components/DeleteUserButton/index.ee.tsx rename to packages/web/src/components/DeleteUserButton/index.ee.jsx index 353af591..099b4f44 100644 --- a/packages/web/src/components/DeleteUserButton/index.ee.tsx +++ b/packages/web/src/components/DeleteUserButton/index.ee.jsx @@ -3,16 +3,10 @@ import DeleteIcon from '@mui/icons-material/Delete'; import IconButton from '@mui/material/IconButton'; import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar'; import * as React from 'react'; - import ConfirmationDialog from 'components/ConfirmationDialog'; import { DELETE_USER } from 'graphql/mutations/delete-user.ee'; import useFormatMessage from 'hooks/useFormatMessage'; - -type DeleteUserButtonProps = { - userId: string; -}; - -export default function DeleteUserButton(props: DeleteUserButtonProps) { +export default function DeleteUserButton(props) { const { userId } = props; const [showConfirmation, setShowConfirmation] = React.useState(false); const [deleteUser] = useMutation(DELETE_USER, { @@ -21,26 +15,27 @@ export default function DeleteUserButton(props: DeleteUserButtonProps) { }); const formatMessage = useFormatMessage(); const enqueueSnackbar = useEnqueueSnackbar(); - const handleConfirm = React.useCallback(async () => { try { await deleteUser(); - setShowConfirmation(false); enqueueSnackbar(formatMessage('deleteUserButton.successfullyDeleted'), { variant: 'success', SnackbarProps: { - 'data-test': 'snackbar-delete-user-success' - } + 'data-test': 'snackbar-delete-user-success', + }, }); } catch (error) { throw new Error('Failed while deleting!'); } }, [deleteUser]); - return ( <> - setShowConfirmation(true)} size="small"> + setShowConfirmation(true)} + size="small" + > diff --git a/packages/web/src/components/Drawer/index.tsx b/packages/web/src/components/Drawer/index.jsx similarity index 82% rename from packages/web/src/components/Drawer/index.tsx rename to packages/web/src/components/Drawer/index.jsx index 1de8ec86..8cf9234a 100644 --- a/packages/web/src/components/Drawer/index.tsx +++ b/packages/web/src/components/Drawer/index.jsx @@ -1,46 +1,26 @@ import * as React from 'react'; import { useTheme } from '@mui/material/styles'; -import { SwipeableDrawerProps } from '@mui/material/SwipeableDrawer'; import Toolbar from '@mui/material/Toolbar'; import List from '@mui/material/List'; import Divider from '@mui/material/Divider'; import useMediaQuery from '@mui/material/useMediaQuery'; import Badge from '@mui/material/Badge'; - import ListItemLink from 'components/ListItemLink'; import useFormatMessage from 'hooks/useFormatMessage'; import { Drawer as BaseDrawer } from './style'; - const iOS = typeof navigator !== 'undefined' && /iPad|iPhone|iPod/.test(navigator.userAgent); - -type DrawerLink = { - Icon: React.ElementType; - primary: string; - to: string; - target?: '_blank'; - badgeContent?: React.ReactNode; - dataTest?: string; -}; - -type DrawerProps = { - links: DrawerLink[]; - bottomLinks?: DrawerLink[]; -} & SwipeableDrawerProps; - -export default function Drawer(props: DrawerProps): React.ReactElement { +export default function Drawer(props) { const { links = [], bottomLinks = [], ...drawerProps } = props; const theme = useTheme(); const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md')); const formatMessage = useFormatMessage(); - - const closeOnClick = (event: React.SyntheticEvent) => { + const closeOnClick = (event) => { if (matchSmallScreens) { props.onClose(event); } }; - return ( - ) + ), )} diff --git a/packages/web/src/components/Drawer/style.ts b/packages/web/src/components/Drawer/style.js similarity index 87% rename from packages/web/src/components/Drawer/style.ts rename to packages/web/src/components/Drawer/style.js index 76559701..c64a5ddc 100644 --- a/packages/web/src/components/Drawer/style.ts +++ b/packages/web/src/components/Drawer/style.js @@ -1,10 +1,8 @@ -import { styled, Theme, CSSObject } from '@mui/material/styles'; +import { styled } from '@mui/material/styles'; import { drawerClasses } from '@mui/material/Drawer'; import MuiSwipeableDrawer from '@mui/material/SwipeableDrawer'; - const drawerWidth = 300; - -const openedMixin = (theme: Theme): CSSObject => ({ +const openedMixin = (theme) => ({ transition: theme.transitions.create('width', { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.enteringScreen, @@ -15,8 +13,7 @@ const openedMixin = (theme: Theme): CSSObject => ({ width: drawerWidth, }, }); - -const closedMixin = (theme: Theme): CSSObject => ({ +const closedMixin = (theme) => ({ transition: theme.transitions.create('width', { easing: theme.transitions.easing.sharp, duration: theme.transitions.duration.leavingScreen, @@ -27,7 +24,6 @@ const closedMixin = (theme: Theme): CSSObject => ({ width: `calc(${theme.spacing(9)} + 1px)`, }, }); - export const Drawer = styled(MuiSwipeableDrawer)(({ theme, open }) => ({ width: drawerWidth, flexShrink: 0, diff --git a/packages/web/src/components/DynamicField/index.tsx b/packages/web/src/components/DynamicField/index.jsx similarity index 81% rename from packages/web/src/components/DynamicField/index.tsx rename to packages/web/src/components/DynamicField/index.jsx index cff470d0..b22fce2a 100644 --- a/packages/web/src/components/DynamicField/index.tsx +++ b/packages/web/src/components/DynamicField/index.jsx @@ -7,35 +7,13 @@ import Box from '@mui/material/Box'; import IconButton from '@mui/material/IconButton'; import RemoveIcon from '@mui/icons-material/Remove'; import AddIcon from '@mui/icons-material/Add'; - -import { IFieldDynamic } from 'types'; import InputCreator from 'components/InputCreator'; import { EditorContext } from 'contexts/Editor'; - -interface DynamicFieldProps { - onChange?: (value: string) => void; - onBlur?: (value: string) => void; - defaultValue?: Record[]; - name: string; - label: string; - type?: string; - required?: boolean; - readOnly?: boolean; - description?: string; - docUrl?: string; - clickToCopy?: boolean; - disabled?: boolean; - fields: IFieldDynamic['fields']; - shouldUnregister?: boolean; - stepId?: string; -} - -function DynamicField(props: DynamicFieldProps): React.ReactElement { +function DynamicField(props) { const { label, description, fields, name, defaultValue, stepId } = props; const { control, setValue, getValues } = useFormContext(); - const fieldsValue = useWatch({ control, name }) as Record[]; + const fieldsValue = useWatch({ control, name }); const editorContext = React.useContext(EditorContext); - const createEmptyItem = React.useCallback(() => { return fields.reduce((previousValue, field) => { return { @@ -45,43 +23,35 @@ function DynamicField(props: DynamicFieldProps): React.ReactElement { }; }, {}); }, [fields]); - const addItem = React.useCallback(() => { const values = getValues(name); - if (!values) { setValue(name, [createEmptyItem()]); } else { setValue(name, values.concat(createEmptyItem())); } }, [getValues, createEmptyItem]); - const removeItem = React.useCallback( (index) => { if (fieldsValue.length === 1) return; - const newFieldsValue = fieldsValue.filter( - (fieldValue, fieldIndex) => fieldIndex !== index + (fieldValue, fieldIndex) => fieldIndex !== index, ); - setValue(name, newFieldsValue); }, - [fieldsValue] + [fieldsValue], ); - React.useEffect( function addInitialGroupWhenEmpty() { const fieldValues = getValues(name); - if (!fieldValues && defaultValue) { setValue(name, defaultValue); } else if (!fieldValues) { setValue(name, [createEmptyItem()]); } }, - [createEmptyItem, defaultValue] + [createEmptyItem, defaultValue], ); - return ( {label} @@ -137,5 +107,4 @@ function DynamicField(props: DynamicFieldProps): React.ReactElement { ); } - export default DynamicField; diff --git a/packages/web/src/components/EditableTypography/index.tsx b/packages/web/src/components/EditableTypography/index.jsx similarity index 69% rename from packages/web/src/components/EditableTypography/index.tsx rename to packages/web/src/components/EditableTypography/index.jsx index 6f81e6b8..52a7016e 100644 --- a/packages/web/src/components/EditableTypography/index.tsx +++ b/packages/web/src/components/EditableTypography/index.jsx @@ -1,61 +1,40 @@ import * as React from 'react'; import Typography from '@mui/material/Typography'; -import type { TypographyProps } from '@mui/material/Typography'; import EditIcon from '@mui/icons-material/Edit'; - import { Box, TextField } from './style'; - -type EditableTypographyProps = TypographyProps & { - children: string; - onConfirm?: (value: string) => void; -}; - const noop = () => null; - -function EditableTypography(props: EditableTypographyProps) { +function EditableTypography(props) { const { children, onConfirm = noop, sx, ...typographyProps } = props; const [editing, setEditing] = React.useState(false); - const handleClick = React.useCallback(() => { setEditing((editing) => !editing); }, []); - - const handleTextFieldClick = React.useCallback( - (event: React.SyntheticEvent) => { - event.stopPropagation(); - }, - [] - ); - + const handleTextFieldClick = React.useCallback((event) => { + event.stopPropagation(); + }, []); const handleTextFieldKeyDown = React.useCallback( - async (event: React.KeyboardEvent) => { - const target = event.target as HTMLInputElement; + async (event) => { + const target = event.target; if (event.key === 'Enter') { if (target.value !== children) { await onConfirm(target.value); } - setEditing(false); } }, - [children] + [children], ); - const handleTextFieldBlur = React.useCallback( - async (event: React.FocusEvent) => { + async (event) => { const value = event.target.value; - if (value !== children) { await onConfirm(value); } - setEditing(false); }, - [onConfirm, children] + [onConfirm, children], ); - let component = {children}; - if (editing) { component = ( ); } - return ( @@ -77,5 +55,4 @@ function EditableTypography(props: EditableTypographyProps) { ); } - export default EditableTypography; diff --git a/packages/web/src/components/EditableTypography/style.ts b/packages/web/src/components/EditableTypography/style.js similarity index 73% rename from packages/web/src/components/EditableTypography/style.ts rename to packages/web/src/components/EditableTypography/style.js index c4787cd3..8e11fd83 100644 --- a/packages/web/src/components/EditableTypography/style.ts +++ b/packages/web/src/components/EditableTypography/style.js @@ -2,23 +2,17 @@ import { styled } from '@mui/material/styles'; import MuiBox from '@mui/material/Box'; import MuiTextField from '@mui/material/TextField'; import { inputClasses } from '@mui/material/Input'; - -type BoxProps = { - editing?: boolean; -}; - -const boxShouldForwardProp = (prop: string) => !['editing'].includes(prop); +const boxShouldForwardProp = (prop) => !['editing'].includes(prop); export const Box = styled(MuiBox, { shouldForwardProp: boxShouldForwardProp, -})` +})` display: flex; flex: 1; width: 300px; height: 33px; align-items: center; - ${({ editing }) => editing && `border-bottom: 1px dashed #000;`} + ${({ editing }) => editing && 'border-bottom: 1px dashed #000;'} `; - export const TextField = styled(MuiTextField)({ width: '100%', [`.${inputClasses.root}:before, .${inputClasses.root}:after, .${inputClasses.root}:hover`]: diff --git a/packages/web/src/components/Editor/index.tsx b/packages/web/src/components/Editor/index.jsx similarity index 81% rename from packages/web/src/components/Editor/index.tsx rename to packages/web/src/components/Editor/index.jsx index 181ee170..4f9b9e3a 100644 --- a/packages/web/src/components/Editor/index.tsx +++ b/packages/web/src/components/Editor/index.jsx @@ -3,33 +3,24 @@ import { useMutation } from '@apollo/client'; import Box from '@mui/material/Box'; import IconButton from '@mui/material/IconButton'; import AddIcon from '@mui/icons-material/Add'; -import type { IFlow, IStep } from 'types'; - import { GET_FLOW } from 'graphql/queries/get-flow'; import { CREATE_STEP } from 'graphql/mutations/create-step'; import { UPDATE_STEP } from 'graphql/mutations/update-step'; import FlowStep from 'components/FlowStep'; - -type EditorProps = { - flow: IFlow; -}; - -function updateHandlerFactory(flowId: string, previousStepId: string) { - return function createStepUpdateHandler(cache: any, mutationResult: any) { +function updateHandlerFactory(flowId, previousStepId) { + return function createStepUpdateHandler(cache, mutationResult) { const { data } = mutationResult; const { createStep: createdStep } = data; const { getFlow: flow } = cache.readQuery({ query: GET_FLOW, variables: { id: flowId }, }); - const steps = flow.steps.reduce((steps: any[], currentStep: any) => { + const steps = flow.steps.reduce((steps, currentStep) => { if (currentStep.id === previousStepId) { return [...steps, currentStep, createdStep]; } - return [...steps, currentStep]; }, []); - cache.writeQuery({ query: GET_FLOW, variables: { id: flowId }, @@ -37,26 +28,20 @@ function updateHandlerFactory(flowId: string, previousStepId: string) { }); }; } - -export default function Editor(props: EditorProps): React.ReactElement { +export default function Editor(props) { const [updateStep] = useMutation(UPDATE_STEP); const [createStep, { loading: creationInProgress }] = useMutation( CREATE_STEP, { refetchQueries: ['GetFlow'], - } + }, ); - const { flow } = props; const [triggerStep] = flow.steps; - - const [currentStepId, setCurrentStepId] = React.useState( - triggerStep.id - ); - + const [currentStepId, setCurrentStepId] = React.useState(triggerStep.id); const onStepChange = React.useCallback( - (step: any) => { - const mutationInput: Record = { + (step) => { + const mutationInput = { id: step.id, key: step.key, parameters: step.parameters, @@ -67,16 +52,13 @@ export default function Editor(props: EditorProps): React.ReactElement { id: flow.id, }, }; - if (step.appKey) { mutationInput.appKey = step.appKey; } - updateStep({ variables: { input: mutationInput } }); }, - [updateStep, flow.id] + [updateStep, flow.id], ); - const addStep = React.useCallback( async (previousStepId) => { const mutationInput = { @@ -87,24 +69,20 @@ export default function Editor(props: EditorProps): React.ReactElement { id: flow.id, }, }; - const createdStep = await createStep({ variables: { input: mutationInput }, update: updateHandlerFactory(flow.id, previousStepId), }); const createdStepId = createdStep.data.createStep.id; - setCurrentStepId(createdStepId); }, - [createStep, flow.id] + [createStep, flow.id], ); - - const openNextStep = React.useCallback((nextStep: IStep) => { + const openNextStep = React.useCallback((nextStep) => { return () => { setCurrentStepId(nextStep?.id); }; }, []); - return ( { + async (name) => { await updateFlow({ variables: { input: { @@ -46,11 +42,10 @@ export default function EditorLayout(): React.ReactElement { }, }); }, - [flow?.id] + [flow?.id], ); - const onFlowStatusUpdate = React.useCallback( - async (active: boolean) => { + async (active) => { await updateFlowStatus({ variables: { input: { @@ -67,9 +62,8 @@ export default function EditorLayout(): React.ReactElement { }, }); }, - [flow?.id] + [flow?.id], ); - return ( <> diff --git a/packages/web/src/components/ExecutionHeader/index.tsx b/packages/web/src/components/ExecutionHeader/index.jsx similarity index 75% rename from packages/web/src/components/ExecutionHeader/index.tsx rename to packages/web/src/components/ExecutionHeader/index.jsx index 3ce22313..3a45c6be 100644 --- a/packages/web/src/components/ExecutionHeader/index.tsx +++ b/packages/web/src/components/ExecutionHeader/index.jsx @@ -4,31 +4,21 @@ import Stack from '@mui/material/Stack'; import Box from '@mui/material/Box'; import Tooltip from '@mui/material/Tooltip'; import Typography from '@mui/material/Typography'; -import type { IExecution } from 'types'; - import useFormatMessage from 'hooks/useFormatMessage'; - -type ExecutionHeaderProps = { - execution: IExecution; -}; - -function ExecutionName(props: Pick) { +function ExecutionName(props) { return ( {props.name} ); } - -function ExecutionId(props: Pick) { +function ExecutionId(props) { const formatMessage = useFormatMessage(); - const id = ( {props.id} ); - return ( @@ -37,13 +27,9 @@ function ExecutionId(props: Pick) { ); } - -function ExecutionDate(props: Pick) { - const createdAt = DateTime.fromMillis( - parseInt(props.createdAt as string, 10) - ); +function ExecutionDate(props) { + const createdAt = DateTime.fromMillis(parseInt(props.createdAt, 10)); const relativeCreatedAt = createdAt.toRelative(); - return ( ) { ); } - -export default function ExecutionHeader( - props: ExecutionHeaderProps -): React.ReactElement { +export default function ExecutionHeader(props) { const { execution } = props; - if (!execution) return ; - return ( @@ -65,7 +52,7 @@ export default function ExecutionRow( label={formatMessage( execution.status === 'success' ? 'execution.statusSuccess' - : 'execution.statusFailure' + : 'execution.statusFailure', )} /> diff --git a/packages/web/src/components/ExecutionRow/style.ts b/packages/web/src/components/ExecutionRow/style.js similarity index 99% rename from packages/web/src/components/ExecutionRow/style.ts rename to packages/web/src/components/ExecutionRow/style.js index 4f9e0db4..8b3cff9a 100644 --- a/packages/web/src/components/ExecutionRow/style.ts +++ b/packages/web/src/components/ExecutionRow/style.js @@ -3,7 +3,6 @@ import MuiCardContent from '@mui/material/CardContent'; import MuiBox from '@mui/material/Box'; import MuiStack from '@mui/material/Stack'; import MuiTypography from '@mui/material/Typography'; - export const CardContent = styled(MuiCardContent)(({ theme }) => ({ display: 'grid', gridTemplateRows: 'auto', @@ -22,14 +21,12 @@ export const CardContent = styled(MuiCardContent)(({ theme }) => ({ gridTemplateRows: 'auto auto', }, })); - export const Apps = styled(MuiStack)(() => ({ gridArea: 'apps', })); export const Title = styled(MuiStack)(() => ({ gridArea: 'title', })); - export const ArrowContainer = styled(MuiBox)(() => ({ flexDirection: 'row', display: 'flex', @@ -42,7 +39,6 @@ export const Typography = styled(MuiTypography)(() => ({ width: '100%', maxWidth: '85%', })); - export const DesktopOnlyBreakline = styled('br')(({ theme }) => ({ [theme.breakpoints.down('sm')]: { display: 'none', diff --git a/packages/web/src/components/ExecutionStep/index.tsx b/packages/web/src/components/ExecutionStep/index.jsx similarity index 88% rename from packages/web/src/components/ExecutionStep/index.tsx rename to packages/web/src/components/ExecutionStep/index.jsx index eb796205..8aaf8555 100644 --- a/packages/web/src/components/ExecutionStep/index.tsx +++ b/packages/web/src/components/ExecutionStep/index.jsx @@ -8,14 +8,11 @@ import Tab from '@mui/material/Tab'; import Typography from '@mui/material/Typography'; import Tooltip from '@mui/material/Tooltip'; import Box from '@mui/material/Box'; -import type { IApp, IExecutionStep, IStep } from 'types'; - import TabPanel from 'components/TabPanel'; import SearchableJSONViewer from 'components/SearchableJSONViewer'; import AppIcon from 'components/AppIcon'; import useFormatMessage from 'hooks/useFormatMessage'; import useApps from 'hooks/useApps'; - import { AppIconWrapper, AppIconStatusIconWrapper, @@ -24,23 +21,13 @@ import { Metadata, Wrapper, } from './style'; - -type ExecutionStepProps = { - collapsed?: boolean; - step: IStep; - index?: number; - executionStep: IExecutionStep; -}; - -function ExecutionStepId(props: Pick) { +function ExecutionStepId(props) { const formatMessage = useFormatMessage(); - const id = ( {props.id} ); - return ( @@ -49,12 +36,10 @@ function ExecutionStepId(props: Pick) { ); } - -function ExecutionStepDate(props: Pick) { +function ExecutionStepDate(props) { const formatMessage = useFormatMessage(); const createdAt = DateTime.fromMillis(parseInt(props.createdAt, 10)); const relativeCreatedAt = createdAt.toRelative(); - return ( ) { ); } - const validIcon = ; const errorIcon = ; - -export default function ExecutionStep( - props: ExecutionStepProps -): React.ReactElement | null { +export default function ExecutionStep(props) { const { executionStep } = props; const [activeTabIndex, setActiveTabIndex] = React.useState(0); - const step: IStep = executionStep.step; + const step = executionStep.step; const isTrigger = step.type === 'trigger'; const isAction = step.type === 'action'; const formatMessage = useFormatMessage(); @@ -84,14 +65,11 @@ export default function ExecutionStep( onlyWithTriggers: isTrigger, onlyWithActions: isAction, }); - const app = apps?.find((currentApp: IApp) => currentApp.key === step.appKey); - + const app = apps?.find((currentApp) => currentApp.key === step.appKey); if (!apps) return null; - const validationStatusIcon = executionStep.status === 'success' ? validIcon : errorIcon; const hasError = !!executionStep.errorDetails; - return (
diff --git a/packages/web/src/components/ExecutionStep/style.ts b/packages/web/src/components/ExecutionStep/style.js similarity index 89% rename from packages/web/src/components/ExecutionStep/style.ts rename to packages/web/src/components/ExecutionStep/style.js index e1b9007b..378d0296 100644 --- a/packages/web/src/components/ExecutionStep/style.ts +++ b/packages/web/src/components/ExecutionStep/style.js @@ -1,13 +1,10 @@ import { styled, alpha } from '@mui/material/styles'; import Card from '@mui/material/Card'; import Box from '@mui/material/Box'; - export const AppIconWrapper = styled('div')` display: flex; align-items: center; `; - - export const AppIconStatusIconWrapper = styled('span')` display: inline-flex; position: relative; @@ -23,43 +20,35 @@ export const AppIconStatusIconWrapper = styled('span')` overflow: hidden; } `; - export const Wrapper = styled(Card)` width: 100%; overflow: unset; `; - -type HeaderProps = { - collapsed?: boolean; -}; - export const Header = styled('div', { shouldForwardProp: (prop) => prop !== 'collapsed', -}) ` +})` padding: ${({ theme }) => theme.spacing(2)}; cursor: ${({ collapsed }) => (collapsed ? 'pointer' : 'unset')}; `; - export const Content = styled('div')` border: 1px solid ${({ theme }) => alpha(theme.palette.divider, 0.8)}; border-left: none; border-right: none; padding: ${({ theme }) => theme.spacing(2, 0)}; `; - export const Metadata = styled(Box)` display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; grid-template-areas: - "step id" - "step date"; + 'step id' + 'step date'; ${({ theme }) => theme.breakpoints.down('sm')} { grid-template-rows: auto auto auto; grid-template-areas: - "id" - "step" - "date"; + 'id' + 'step' + 'date'; } -` as typeof Box; +`; diff --git a/packages/web/src/components/FlowAppIcons/index.tsx b/packages/web/src/components/FlowAppIcons/index.jsx similarity index 83% rename from packages/web/src/components/FlowAppIcons/index.tsx rename to packages/web/src/components/FlowAppIcons/index.jsx index 8e6783fb..d8b1d9a0 100644 --- a/packages/web/src/components/FlowAppIcons/index.tsx +++ b/packages/web/src/components/FlowAppIcons/index.jsx @@ -1,20 +1,12 @@ import * as React from 'react'; -import type { IStep } from 'types'; - import AppIcon from 'components/AppIcon'; import IntermediateStepCount from 'components/IntermediateStepCount'; - -type FlowAppIconsProps = { - steps: Partial[]; -}; - -export default function FlowAppIcons(props: FlowAppIconsProps) { +export default function FlowAppIcons(props) { const { steps } = props; const stepsCount = steps.length; const firstStep = steps[0]; const lastStep = steps.length > 1 && steps[stepsCount - 1]; const intermeaditeStepCount = stepsCount - 2; - return ( <> void; - anchorEl: PopoverProps['anchorEl']; -}; - -export default function ContextMenu( - props: ContextMenuProps -): React.ReactElement { +export default function ContextMenu(props) { const { flowId, onClose, anchorEl } = props; const enqueueSnackbar = useEnqueueSnackbar(); const [deleteFlow] = useMutation(DELETE_FLOW); @@ -28,22 +17,18 @@ export default function ContextMenu( refetchQueries: ['GetFlows'], }); const formatMessage = useFormatMessage(); - const onFlowDuplicate = React.useCallback(async () => { await duplicateFlow({ variables: { input: { id: flowId } }, }); - enqueueSnackbar(formatMessage('flow.successfullyDuplicated'), { variant: 'success', SnackbarProps: { - 'data-test': 'snackbar-duplicate-flow-success' - } + 'data-test': 'snackbar-duplicate-flow-success', + }, }); - onClose(); }, [flowId, onClose, duplicateFlow]); - const onFlowDelete = React.useCallback(async () => { await deleteFlow({ variables: { input: { id: flowId } }, @@ -52,20 +37,16 @@ export default function ContextMenu( __typename: 'Flow', id: flowId, }); - cache.evict({ id: flowCacheId, }); }, }); - enqueueSnackbar(formatMessage('flow.successfullyDeleted'), { variant: 'success', }); - onClose(); }, [flowId, onClose, deleteFlow]); - return ( (null); - const [anchorEl, setAnchorEl] = React.useState( - null - ); + const contextButtonRef = React.useRef(null); + const [anchorEl, setAnchorEl] = React.useState(null); const { flow } = props; - const handleClose = () => { setAnchorEl(null); }; - const onContextMenuClick = (event: React.MouseEvent) => { + const onContextMenuClick = (event) => { event.preventDefault(); event.stopPropagation(); event.nativeEvent.stopImmediatePropagation(); setAnchorEl(contextButtonRef.current); }; - - const createdAt = DateTime.fromMillis(parseInt(flow.createdAt as string, 10)); - const updatedAt = DateTime.fromMillis(parseInt(flow.updatedAt as string, 10)); + const createdAt = DateTime.fromMillis(parseInt(flow.createdAt, 10)); + const updatedAt = DateTime.fromMillis(parseInt(flow.updatedAt, 10)); const isUpdated = updatedAt > createdAt; const relativeCreatedAt = createdAt.toRelative(); const relativeUpdatedAt = updatedAt.toRelative(); - return ( <> diff --git a/packages/web/src/components/FlowRow/style.ts b/packages/web/src/components/FlowRow/style.js similarity index 99% rename from packages/web/src/components/FlowRow/style.ts rename to packages/web/src/components/FlowRow/style.js index 43a6e3b5..f8d7aa28 100644 --- a/packages/web/src/components/FlowRow/style.ts +++ b/packages/web/src/components/FlowRow/style.js @@ -3,7 +3,6 @@ import MuiStack from '@mui/material/Stack'; import MuiBox from '@mui/material/Box'; import MuiCardContent from '@mui/material/CardContent'; import MuiTypography from '@mui/material/Typography'; - export const CardContent = styled(MuiCardContent)(({ theme }) => ({ display: 'grid', gridTemplateRows: 'auto', @@ -22,14 +21,12 @@ export const CardContent = styled(MuiCardContent)(({ theme }) => ({ gridTemplateRows: 'auto auto', }, })); - export const Apps = styled(MuiStack)(() => ({ gridArea: 'apps', })); export const Title = styled(MuiStack)(() => ({ gridArea: 'title', })); - export const ContextMenu = styled(MuiBox)(({ theme }) => ({ flexDirection: 'row', display: 'flex', @@ -42,7 +39,6 @@ export const Typography = styled(MuiTypography)(() => ({ width: '100%', maxWidth: '85%', })); - export const DesktopOnlyBreakline = styled('br')(({ theme }) => ({ [theme.breakpoints.down('sm')]: { display: 'none', diff --git a/packages/web/src/components/FlowStep/index.tsx b/packages/web/src/components/FlowStep/index.jsx similarity index 85% rename from packages/web/src/components/FlowStep/index.tsx rename to packages/web/src/components/FlowStep/index.jsx index b6e9a2cc..df987e11 100644 --- a/packages/web/src/components/FlowStep/index.tsx +++ b/packages/web/src/components/FlowStep/index.jsx @@ -13,9 +13,6 @@ import CircularProgress from '@mui/material/CircularProgress'; import CheckCircleIcon from '@mui/icons-material/CheckCircle'; import { yupResolver } from '@hookform/resolvers/yup'; import * as yup from 'yup'; -import type { BaseSchema } from 'yup'; -import type { IApp, ITrigger, IAction, IStep, ISubstep } from 'types'; - import { EditorContext } from 'contexts/Editor'; import { StepExecutionsProvider } from 'contexts/StepExecutions'; import TestSubstep from 'components/TestSubstep'; @@ -36,35 +33,19 @@ import { Wrapper, } from './style'; import isEmpty from 'helpers/isEmpty'; - -type FlowStepProps = { - collapsed?: boolean; - step: IStep; - index?: number; - onOpen?: () => void; - onClose?: () => void; - onChange: (step: IStep) => void; - onContinue?: () => void; -}; - const validIcon = ; const errorIcon = ; - -function generateValidationSchema(substeps: ISubstep[]) { +function generateValidationSchema(substeps) { const fieldValidations = substeps?.reduce( (allValidations, { arguments: args }) => { if (!args || !Array.isArray(args)) return allValidations; - - const substepArgumentValidations: Record = {}; - + const substepArgumentValidations = {}; for (const arg of args) { const { key, required } = arg; - // base validation for the field if not exists if (!substepArgumentValidations[key]) { substepArgumentValidations[key] = yup.mixed(); } - if ( typeof substepArgumentValidations[key] === 'object' && (arg.type === 'string' || arg.type === 'dropdown') @@ -76,21 +57,19 @@ function generateValidationSchema(substeps: ISubstep[]) { .test( 'empty-check', `${key} must be not empty`, - (value: any) => !isEmpty(value) + (value) => !isEmpty(value), ); } - // if the field depends on another field, add the dependsOn required validation if (Array.isArray(arg.dependsOn) && arg.dependsOn.length > 0) { for (const dependsOnKey of arg.dependsOn) { const missingDependencyValueMessage = `We're having trouble loading '${key}' data as required field '${dependsOnKey}' is missing.`; - // TODO: make `dependsOnKey` agnostic to the field. However, nested validation schema is not supported. // So the fields under the `parameters` key are subject to their siblings only and thus, `parameters.` is removed. substepArgumentValidations[key] = substepArgumentValidations[ key ].when(`${dependsOnKey.replace('parameters.', '')}`, { - is: (value: string) => Boolean(value) === false, + is: (value) => Boolean(value) === false, then: (schema) => schema .notOneOf([''], missingDependencyValueMessage) @@ -100,37 +79,28 @@ function generateValidationSchema(substeps: ISubstep[]) { } } } - return { ...allValidations, ...substepArgumentValidations, }; }, - {} + {}, ); - const validationSchema = yup.object({ parameters: yup.object(fieldValidations), }); - return yupResolver(validationSchema); } - -export default function FlowStep( - props: FlowStepProps -): React.ReactElement | null { +export default function FlowStep(props) { const { collapsed, onChange, onContinue } = props; const editorContext = React.useContext(EditorContext); - const contextButtonRef = React.useRef(null); - const step: IStep = props.step; - const [anchorEl, setAnchorEl] = React.useState( - null - ); + const contextButtonRef = React.useRef(null); + const step = props.step; + const [anchorEl, setAnchorEl] = React.useState(null); const isTrigger = step.type === 'trigger'; const isAction = step.type === 'action'; const formatMessage = useFormatMessage(); - const [currentSubstep, setCurrentSubstep] = React.useState(0); - + const [currentSubstep, setCurrentSubstep] = React.useState(0); const { apps } = useApps({ onlyWithTriggers: isTrigger, onlyWithActions: isAction, @@ -141,7 +111,6 @@ export default function FlowStep( ] = useLazyQuery(GET_STEP_WITH_TEST_EXECUTIONS, { fetchPolicy: 'network-only', }); - React.useEffect(() => { if (!stepWithTestExecutionsCalled && !collapsed && !isTrigger) { getStepWithTestExecutions({ @@ -157,33 +126,25 @@ export default function FlowStep( step.id, isTrigger, ]); - - const app = apps?.find((currentApp: IApp) => currentApp.key === step.appKey); - - const actionsOrTriggers: Array = - (isTrigger ? app?.triggers : app?.actions) || []; + const app = apps?.find((currentApp) => currentApp.key === step.appKey); + const actionsOrTriggers = (isTrigger ? app?.triggers : app?.actions) || []; const actionOrTrigger = actionsOrTriggers?.find( - ({ key }) => key === step.key + ({ key }) => key === step.key, ); const substeps = actionOrTrigger?.substeps || []; - - const handleChange = React.useCallback(({ step }: { step: IStep }) => { + const handleChange = React.useCallback(({ step }) => { onChange(step); }, []); - const expandNextStep = React.useCallback(() => { setCurrentSubstep((currentSubstep) => (currentSubstep ?? 0) + 1); }, []); - - const handleSubmit = (val: any) => { - handleChange({ step: val as IStep }); + const handleSubmit = (val) => { + handleChange({ step: val }); }; - const stepValidationSchema = React.useMemo( () => generateValidationSchema(substeps), - [substeps] + [substeps], ); - if (!apps) { return ( ); } - - const onContextMenuClose = (event: React.SyntheticEvent) => { + const onContextMenuClose = (event) => { event.stopPropagation(); setAnchorEl(null); }; - const onContextMenuClick = (event: React.SyntheticEvent) => { + const onContextMenuClick = (event) => { event.stopPropagation(); setAnchorEl(contextButtonRef.current); }; const onOpen = () => collapsed && props.onOpen?.(); const onClose = () => props.onClose?.(); - - const toggleSubstep = (substepIndex: number) => + const toggleSubstep = (substepIndex) => setCurrentSubstep((value) => - value !== substepIndex ? substepIndex : null + value !== substepIndex ? substepIndex : null, ); - const validationStatusIcon = step.status === 'completed' ? validIcon : errorIcon; - return (
0 && - substeps.map((substep: ISubstep, index: number) => ( + substeps.map((substep, index) => ( {substep.key === 'chooseConnection' && app && ( prop !== 'collapsed', -})` +})` padding: ${({ theme }) => theme.spacing(2)}; cursor: ${({ collapsed }) => (collapsed ? 'pointer' : 'unset')}; `; - export const Content = styled('div')` border: 1px solid ${({ theme }) => alpha(theme.palette.divider, 0.8)}; border-left: none; diff --git a/packages/web/src/components/FlowStepContextMenu/index.tsx b/packages/web/src/components/FlowStepContextMenu/index.jsx similarity index 73% rename from packages/web/src/components/FlowStepContextMenu/index.tsx rename to packages/web/src/components/FlowStepContextMenu/index.jsx index 8617d030..2f11b577 100644 --- a/packages/web/src/components/FlowStepContextMenu/index.tsx +++ b/packages/web/src/components/FlowStepContextMenu/index.jsx @@ -2,35 +2,21 @@ import * as React from 'react'; import { useMutation } from '@apollo/client'; import Menu from '@mui/material/Menu'; import MenuItem from '@mui/material/MenuItem'; -import type { PopoverProps } from '@mui/material/Popover'; - import { DELETE_STEP } from 'graphql/mutations/delete-step'; import useFormatMessage from 'hooks/useFormatMessage'; - -type FlowStepContextMenuProps = { - stepId: string; - onClose: PopoverProps['onClose']; - anchorEl: HTMLButtonElement; - deletable: boolean; -}; - -function FlowStepContextMenu( - props: FlowStepContextMenuProps -): React.ReactElement { +function FlowStepContextMenu(props) { const { stepId, onClose, anchorEl, deletable } = props; const [deleteStep] = useMutation(DELETE_STEP, { refetchQueries: ['GetFlow', 'GetStepWithTestExecutions'], }); const formatMessage = useFormatMessage(); - const deleteActionHandler = React.useCallback( - async (event: React.SyntheticEvent) => { + async (event) => { event.stopPropagation(); await deleteStep({ variables: { input: { id: stepId } } }); }, - [stepId] + [stepId], ); - return ( ); } - export default FlowStepContextMenu; diff --git a/packages/web/src/components/FlowSubstep/FilterConditions/index.tsx b/packages/web/src/components/FlowSubstep/FilterConditions/index.jsx similarity index 50% rename from packages/web/src/components/FlowSubstep/FilterConditions/index.tsx rename to packages/web/src/components/FlowSubstep/FilterConditions/index.jsx index 2cb9b37f..88e19b96 100644 --- a/packages/web/src/components/FlowSubstep/FilterConditions/index.tsx +++ b/packages/web/src/components/FlowSubstep/FilterConditions/index.jsx @@ -8,32 +8,18 @@ import Divider from '@mui/material/Divider'; import IconButton from '@mui/material/IconButton'; import RemoveIcon from '@mui/icons-material/Remove'; import AddIcon from '@mui/icons-material/Add'; -import type { IField, IFieldText, IFieldDropdown } from 'types'; - import useFormatMessage from 'hooks/useFormatMessage'; import InputCreator from 'components/InputCreator'; import { EditorContext } from 'contexts/Editor'; - -type TGroupItem = { - key: string; - operator: string; - value: string; - id: string; -}; - -type TGroup = Record<'and', TGroupItem[]>; - -const createGroupItem = (): TGroupItem => ({ +const createGroupItem = () => ({ key: '', operator: operators[0].value, value: '', id: uuidv4(), }); - -const createGroup = (): TGroup => ({ +const createGroup = () => ({ and: [createGroupItem()], }); - const operators = [ { label: 'Equal', @@ -68,10 +54,7 @@ const operators = [ value: 'not_contains', }, ]; - -const createStringArgument = ( - argumentOptions: Omit -): IField => { +const createStringArgument = (argumentOptions) => { return { ...argumentOptions, type: 'string', @@ -79,69 +62,52 @@ const createStringArgument = ( variables: true, }; }; - -const createDropdownArgument = ( - argumentOptions: Omit -): IField => { +const createDropdownArgument = (argumentOptions) => { return { ...argumentOptions, required: true, type: 'dropdown', }; }; - -type FilterConditionsProps = { - stepId: string; -}; - -function FilterConditions(props: FilterConditionsProps): React.ReactElement { +function FilterConditions(props) { const { stepId } = props; const formatMessage = useFormatMessage(); const { control, setValue, getValues } = useFormContext(); const groups = useWatch({ control, name: 'parameters.or' }); const editorContext = React.useContext(EditorContext); - React.useEffect(function addInitialGroupWhenEmpty() { const groups = getValues('parameters.or'); - if (!groups) { setValue('parameters.or', [createGroup()]); } }, []); - const appendGroup = React.useCallback(() => { const values = getValues('parameters.or'); - setValue('parameters.or', values.concat(createGroup())); }, []); - const appendGroupItem = React.useCallback((index) => { const group = getValues(`parameters.or.${index}.and`); setValue(`parameters.or.${index}.and`, group.concat(createGroupItem())); }, []); - const removeGroupItem = React.useCallback((groupIndex, groupItemIndex) => { - const group: TGroupItem[] = getValues(`parameters.or.${groupIndex}.and`); - + const group = getValues(`parameters.or.${groupIndex}.and`); if (group.length === 1) { - const groups: TGroup[] = getValues('parameters.or'); - + const groups = getValues('parameters.or'); setValue( 'parameters.or', - groups.filter((group, index) => index !== groupIndex) + groups.filter((group, index) => index !== groupIndex), ); } else { setValue( `parameters.or.${groupIndex}.and`, - group.filter((groupItem, index) => index !== groupItemIndex) + group.filter((groupItem, index) => index !== groupItemIndex), ); } }, []); - return ( - {groups?.map((group: TGroup, groupIndex: number) => ( + {groups?.map((group, groupIndex) => ( <> {groupIndex !== 0 && } @@ -152,81 +118,79 @@ function FilterConditions(props: FilterConditionsProps): React.ReactElement { formatMessage('filterConditions.orContinueIf')} - {group?.and?.map( - (groupItem: TGroupItem, groupItemIndex: number) => ( - - ( + + + - - - + + - - - - - - - - - - removeGroupItem(groupIndex, groupItemIndex)} - sx={{ width: 61, height: 61 }} + - - + + + + + + - ) - )} + + removeGroupItem(groupIndex, groupItemIndex)} + sx={{ width: 61, height: 61 }} + > + + + + ))} ); } - export default FilterConditions; diff --git a/packages/web/src/components/FlowSubstep/index.tsx b/packages/web/src/components/FlowSubstep/index.jsx similarity index 87% rename from packages/web/src/components/FlowSubstep/index.tsx rename to packages/web/src/components/FlowSubstep/index.jsx index 394220f3..50e6225b 100644 --- a/packages/web/src/components/FlowSubstep/index.tsx +++ b/packages/web/src/components/FlowSubstep/index.jsx @@ -4,24 +4,11 @@ import Collapse from '@mui/material/Collapse'; import ListItem from '@mui/material/ListItem'; import Button from '@mui/material/Button'; import Stack from '@mui/material/Stack'; -import type { IStep, ISubstep } from 'types'; - import { EditorContext } from 'contexts/Editor'; import FlowSubstepTitle from 'components/FlowSubstepTitle'; import InputCreator from 'components/InputCreator'; import FilterConditions from './FilterConditions'; - -type FlowSubstepProps = { - substep: ISubstep; - expanded?: boolean; - onExpand: () => void; - onCollapse: () => void; - onChange: ({ step }: { step: IStep }) => void; - onSubmit: () => void; - step: IStep; -}; - -function FlowSubstep(props: FlowSubstepProps): React.ReactElement { +function FlowSubstep(props) { const { substep, expanded = false, @@ -30,15 +17,11 @@ function FlowSubstep(props: FlowSubstepProps): React.ReactElement { onSubmit, step, } = props; - const { name, arguments: args } = substep; - const editorContext = React.useContext(EditorContext); const formContext = useFormContext(); const validationStatus = formContext.formState.isValid; - const onToggle = expanded ? onCollapse : onExpand; - return ( ); } - export default FlowSubstep; diff --git a/packages/web/src/components/FlowSubstepTitle/index.tsx b/packages/web/src/components/FlowSubstepTitle/index.jsx similarity index 81% rename from packages/web/src/components/FlowSubstepTitle/index.tsx rename to packages/web/src/components/FlowSubstepTitle/index.jsx index 66bc5414..08459085 100644 --- a/packages/web/src/components/FlowSubstepTitle/index.tsx +++ b/packages/web/src/components/FlowSubstepTitle/index.jsx @@ -3,25 +3,13 @@ import ExpandLessIcon from '@mui/icons-material/ExpandLess'; import ExpandMoreIcon from '@mui/icons-material/ExpandMore'; import ErrorIcon from '@mui/icons-material/Error'; import CheckCircleIcon from '@mui/icons-material/CheckCircle'; - import { ListItemButton, Typography } from './style'; - -type FlowSubstepTitleProps = { - expanded?: boolean; - onClick: () => void; - title: string; - valid?: boolean | null; -}; - const validIcon = ; const errorIcon = ; - -function FlowSubstepTitle(props: FlowSubstepTitleProps): React.ReactElement { +function FlowSubstepTitle(props) { const { expanded = false, onClick = () => null, valid = null, title } = props; - const hasValidation = valid !== null; const validationStatusIcon = valid ? validIcon : errorIcon; - return ( @@ -33,5 +21,4 @@ function FlowSubstepTitle(props: FlowSubstepTitleProps): React.ReactElement { ); } - export default FlowSubstepTitle; diff --git a/packages/web/src/components/FlowSubstepTitle/style.tsx b/packages/web/src/components/FlowSubstepTitle/style.jsx similarity index 99% rename from packages/web/src/components/FlowSubstepTitle/style.tsx rename to packages/web/src/components/FlowSubstepTitle/style.jsx index b885f6be..c8c0c090 100644 --- a/packages/web/src/components/FlowSubstepTitle/style.tsx +++ b/packages/web/src/components/FlowSubstepTitle/style.jsx @@ -1,11 +1,9 @@ import { styled } from '@mui/material/styles'; import MuiListItemButton from '@mui/material/ListItemButton'; import MuiTypography from '@mui/material/Typography'; - export const ListItemButton = styled(MuiListItemButton)` justify-content: space-between; `; - export const Typography = styled(MuiTypography)` display: flex; align-items: center; diff --git a/packages/web/src/components/ForgotPasswordForm/index.ee.tsx b/packages/web/src/components/ForgotPasswordForm/index.ee.jsx similarity index 85% rename from packages/web/src/components/ForgotPasswordForm/index.ee.tsx rename to packages/web/src/components/ForgotPasswordForm/index.ee.jsx index 69b362d8..6f6a4d78 100644 --- a/packages/web/src/components/ForgotPasswordForm/index.ee.tsx +++ b/packages/web/src/components/ForgotPasswordForm/index.ee.jsx @@ -3,24 +3,20 @@ import { useMutation } from '@apollo/client'; import Paper from '@mui/material/Paper'; import Typography from '@mui/material/Typography'; import LoadingButton from '@mui/lab/LoadingButton'; - import { FORGOT_PASSWORD } from 'graphql/mutations/forgot-password.ee'; import Form from 'components/Form'; import TextField from 'components/TextField'; import useFormatMessage from 'hooks/useFormatMessage'; - export default function ForgotPasswordForm() { const formatMessage = useFormatMessage(); const [forgotPassword, { data, loading }] = useMutation(FORGOT_PASSWORD); - - const handleSubmit = async (values: any) => { + const handleSubmit = async (values) => { await forgotPassword({ variables: { input: values, }, }); }; - return ( - {data && theme.palette.success.main }}> - {formatMessage('forgotPasswordForm.instructionsSent')} - } + {data && ( + theme.palette.success.main }} + > + {formatMessage('forgotPasswordForm.instructionsSent')} + + )} ); diff --git a/packages/web/src/components/Form/index.tsx b/packages/web/src/components/Form/index.jsx similarity index 58% rename from packages/web/src/components/Form/index.tsx rename to packages/web/src/components/Form/index.jsx index 1a1124a1..061e10d8 100644 --- a/packages/web/src/components/Form/index.tsx +++ b/packages/web/src/components/Form/index.jsx @@ -1,26 +1,7 @@ import * as React from 'react'; -import { - FormProvider, - useForm, - useWatch, - FieldValues, - SubmitHandler, - UseFormReturn, -} from 'react-hook-form'; -import type { UseFormProps } from 'react-hook-form'; - -type FormProps = { - children?: React.ReactNode; - defaultValues?: UseFormProps['defaultValues']; - onSubmit?: SubmitHandler; - render?: (props: UseFormReturn) => React.ReactNode; - resolver?: UseFormProps['resolver']; - mode?: UseFormProps['mode']; -}; - +import { FormProvider, useForm, useWatch } from 'react-hook-form'; const noop = () => null; - -export default function Form(props: FormProps): React.ReactElement { +export default function Form(props) { const { children, onSubmit = noop, @@ -30,27 +11,22 @@ export default function Form(props: FormProps): React.ReactElement { mode = 'all', ...formProps } = props; - - const methods: UseFormReturn = useForm({ + const methods = useForm({ defaultValues, reValidateMode: 'onBlur', resolver, mode, }); - const form = useWatch({ control: methods.control }); - /** * For fields having `dependsOn` fields, we need to re-validate the form. */ React.useEffect(() => { methods.trigger(); }, [methods.trigger, form]); - React.useEffect(() => { methods.reset(defaultValues); }, [defaultValues]); - return (
diff --git a/packages/web/src/components/HideOnScroll/index.tsx b/packages/web/src/components/HideOnScroll/index.jsx similarity index 60% rename from packages/web/src/components/HideOnScroll/index.tsx rename to packages/web/src/components/HideOnScroll/index.jsx index 02fb8bad..b93f91da 100644 --- a/packages/web/src/components/HideOnScroll/index.tsx +++ b/packages/web/src/components/HideOnScroll/index.jsx @@ -1,9 +1,7 @@ import * as React from 'react'; -import Slide, { SlideProps } from '@mui/material/Slide'; +import Slide from '@mui/material/Slide'; import useScrollTrigger from '@mui/material/useScrollTrigger'; - -export default function HideOnScroll(props: SlideProps): React.ReactElement { +export default function HideOnScroll(props) { const trigger = useScrollTrigger(); - return ; } diff --git a/packages/web/src/components/InputCreator/index.tsx b/packages/web/src/components/InputCreator/index.jsx similarity index 88% rename from packages/web/src/components/InputCreator/index.tsx rename to packages/web/src/components/InputCreator/index.jsx index 47298fa2..53be9df4 100644 --- a/packages/web/src/components/InputCreator/index.tsx +++ b/packages/web/src/components/InputCreator/index.jsx @@ -1,8 +1,6 @@ import * as React from 'react'; import MuiTextField from '@mui/material/TextField'; import CircularProgress from '@mui/material/CircularProgress'; -import type { IField, IFieldDropdownOption } from 'types'; - import useDynamicFields from 'hooks/useDynamicFields'; import useDynamicData from 'hooks/useDynamicData'; import PowerInput from 'components/PowerInput'; @@ -10,29 +8,9 @@ import TextField from 'components/TextField'; import ControlledAutocomplete from 'components/ControlledAutocomplete'; import ControlledCustomAutocomplete from 'components/ControlledCustomAutocomplete'; import DynamicField from 'components/DynamicField'; - -type InputCreatorProps = { - onChange?: React.ChangeEventHandler; - onBlur?: React.FocusEventHandler; - schema: IField; - namePrefix?: string; - stepId?: string; - disabled?: boolean; - showOptionValue?: boolean; - shouldUnregister?: boolean; -}; - -type RawOption = { - name: string; - value: string; -}; - -const optionGenerator = (options: RawOption[]): IFieldDropdownOption[] => - options?.map(({ name, value }) => ({ label: name as string, value: value })); - -export default function InputCreator( - props: InputCreatorProps -): React.ReactElement { +const optionGenerator = (options) => + options?.map(({ name, value }) => ({ label: name, value: value })); +export default function InputCreator(props) { const { onChange, onBlur, @@ -43,7 +21,6 @@ export default function InputCreator( showOptionValue, shouldUnregister, } = props; - const { key: name, label, @@ -53,13 +30,10 @@ export default function InputCreator( description, type, } = schema; - const { data, loading } = useDynamicData(stepId, schema); - const { data: additionalFields, loading: additionalFieldsLoading } = useDynamicFields(stepId, schema); const computedName = namePrefix ? `${namePrefix}.${name}` : name; - if (type === 'dynamic') { return ( ); } - if (type === 'dropdown') { const preparedOptions = schema.options || optionGenerator(data); - return ( {!schema.variables && ( @@ -92,7 +64,7 @@ export default function InputCreator( disableClearable={required} options={preparedOptions} renderInput={(params) => } - defaultValue={value as string} + defaultValue={value} description={description} loading={loading} disabled={disabled} @@ -112,7 +84,7 @@ export default function InputCreator( disableClearable={required} options={preparedOptions} renderInput={(params) => } - defaultValue={value as string} + defaultValue={value} description={description} loading={loading} disabled={disabled} @@ -141,7 +113,6 @@ export default function InputCreator( ); } - if (type === 'string') { if (schema.variables) { return ( @@ -178,7 +149,6 @@ export default function InputCreator( ); } - return ( ); } - return ; } diff --git a/packages/web/src/components/IntermediateStepCount/index.tsx b/packages/web/src/components/IntermediateStepCount/index.jsx similarity index 65% rename from packages/web/src/components/IntermediateStepCount/index.tsx rename to packages/web/src/components/IntermediateStepCount/index.jsx index b1efeb0e..eae814cb 100644 --- a/packages/web/src/components/IntermediateStepCount/index.tsx +++ b/packages/web/src/components/IntermediateStepCount/index.jsx @@ -1,17 +1,8 @@ import * as React from 'react'; import Typography from '@mui/material/Typography'; - import { Container } from './style'; - -type IntermediateStepCountProps = { - count: number; -}; - -export default function IntermediateStepCount( - props: IntermediateStepCountProps -) { +export default function IntermediateStepCount(props) { const { count } = props; - return ( diff --git a/packages/web/src/components/IntermediateStepCount/style.ts b/packages/web/src/components/IntermediateStepCount/style.js similarity index 99% rename from packages/web/src/components/IntermediateStepCount/style.ts rename to packages/web/src/components/IntermediateStepCount/style.js index b88c286c..f88863bc 100644 --- a/packages/web/src/components/IntermediateStepCount/style.ts +++ b/packages/web/src/components/IntermediateStepCount/style.js @@ -1,5 +1,4 @@ import { styled } from '@mui/material/styles'; - export const Container = styled('div')(({ theme }) => ({ display: 'flex', flexDirection: 'column', diff --git a/packages/web/src/components/IntlProvider/index.tsx b/packages/web/src/components/IntlProvider/index.jsx similarity index 69% rename from packages/web/src/components/IntlProvider/index.tsx rename to packages/web/src/components/IntlProvider/index.jsx index 2643293d..e3a1a35f 100644 --- a/packages/web/src/components/IntlProvider/index.tsx +++ b/packages/web/src/components/IntlProvider/index.jsx @@ -1,11 +1,6 @@ import { IntlProvider as BaseIntlProvider } from 'react-intl'; import englishMessages from 'locales/en.json'; - -type IntlProviderProps = { - children: React.ReactNode; -}; - -const IntlProvider = ({ children }: IntlProviderProps): React.ReactElement => { +const IntlProvider = ({ children }) => { return ( { ); }; - export default IntlProvider; diff --git a/packages/web/src/components/Invoices/index.ee.tsx b/packages/web/src/components/Invoices/index.ee.jsx similarity index 97% rename from packages/web/src/components/Invoices/index.ee.tsx rename to packages/web/src/components/Invoices/index.ee.jsx index 7e9b220a..d4e15654 100644 --- a/packages/web/src/components/Invoices/index.ee.tsx +++ b/packages/web/src/components/Invoices/index.ee.jsx @@ -7,16 +7,12 @@ import CardContent from '@mui/material/CardContent'; import Divider from '@mui/material/Divider'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; - import useInvoices from 'hooks/useInvoices.ee'; import useFormatMessage from 'hooks/useFormatMessage'; - export default function Invoices() { const formatMessage = useFormatMessage(); const { invoices, loading } = useInvoices(); - if (loading || invoices.length === 0) return ; - return ( @@ -69,7 +65,9 @@ export default function Invoices() { fontWeight="500" sx={{ color: 'text.secondary' }} > - {DateTime.fromISO(invoice.payout_date).toFormat('LLL dd, yyyy')} + {DateTime.fromISO(invoice.payout_date).toFormat( + 'LLL dd, yyyy', + )} diff --git a/packages/web/src/components/JSONViewer/index.tsx b/packages/web/src/components/JSONViewer/index.jsx similarity index 90% rename from packages/web/src/components/JSONViewer/index.tsx rename to packages/web/src/components/JSONViewer/index.jsx index 81e43f2a..bde7a28c 100644 --- a/packages/web/src/components/JSONViewer/index.tsx +++ b/packages/web/src/components/JSONViewer/index.jsx @@ -1,11 +1,5 @@ import * as React from 'react'; import { JSONTree } from 'react-json-tree'; -import type { IJSONObject } from 'types'; - -type JSONViewerProps = { - data: IJSONObject; -}; - const theme = { scheme: 'inspector', author: 'Alexander Kuznetsov (alexkuz@gmail.com)', @@ -36,16 +30,14 @@ const theme = { // base0C - Support, Regular Expressions, Escape Characters, Markup Quotes base0C: '#86c1b9', // base0D - Functions, Methods, Attribute IDs, Headings - base0D: '#d73a49', // key + base0D: '#d73a49', // base0E - Keywords, Storage, Selector, Markup Italic, Diff Changed base0E: '#EC31C0', // base0F - Deprecated, Opening/Closing Embedded Language Tags, e.g. base0F: '#a16946', }; - -function JSONViewer(props: JSONViewerProps) { +function JSONViewer(props) { const { data } = props; - return ( ); } - export default JSONViewer; diff --git a/packages/web/src/components/JSONViewer/style.tsx b/packages/web/src/components/JSONViewer/style.jsx similarity index 99% rename from packages/web/src/components/JSONViewer/style.tsx rename to packages/web/src/components/JSONViewer/style.jsx index 1e9244c0..4a61b81c 100644 --- a/packages/web/src/components/JSONViewer/style.tsx +++ b/packages/web/src/components/JSONViewer/style.jsx @@ -1,5 +1,4 @@ import GlobalStyles from '@mui/material/GlobalStyles'; - export const jsonViewerStyles = ( ({ @@ -16,17 +15,14 @@ export const jsonViewerStyles = ( 'var(--indentguide-size) var(--indentguide-style) var(--indentguide-color)', '--indentguide-active': 'var(--indentguide-size) var(--indentguide-style) var(--indentguide-color-active)', - /* Types colors */ '--string-color': theme.palette.text.secondary, '--number-color': theme.palette.text.primary, '--boolean-color': theme.palette.text.primary, '--null-color': theme.palette.text.primary, '--property-color': theme.palette.text.primary, - /* Collapsed node preview */ '--preview-color': theme.palette.text.primary, - /* Search highlight color */ '--highlight-color': '#6fb3d2', }, diff --git a/packages/web/src/components/Layout/index.tsx b/packages/web/src/components/Layout/index.jsx similarity index 80% rename from packages/web/src/components/Layout/index.tsx rename to packages/web/src/components/Layout/index.jsx index 7347d8f6..56410b4c 100644 --- a/packages/web/src/components/Layout/index.tsx +++ b/packages/web/src/components/Layout/index.jsx @@ -9,18 +9,12 @@ import SwapCallsIcon from '@mui/icons-material/SwapCalls'; import HistoryIcon from '@mui/icons-material/History'; import NotificationsIcon from '@mui/icons-material/Notifications'; import ArrowBackIosNew from '@mui/icons-material/ArrowBackIosNew'; - import * as URLS from 'config/urls'; import useFormatMessage from 'hooks/useFormatMessage'; import useVersion from 'hooks/useVersion'; import AppBar from 'components/AppBar'; import Drawer from 'components/Drawer'; import useConfig from 'hooks/useConfig'; - -type PublicLayoutProps = { - children: React.ReactNode; -}; - const drawerLinks = [ { Icon: SwapCallsIcon, @@ -41,64 +35,37 @@ const drawerLinks = [ dataTest: 'executions-page-drawer-link', }, ]; - -type GenerateDrawerBottomLinksOptions = { - disableNotificationsPage: boolean; - notificationBadgeContent: number; - additionalDrawerLink?: string; - additionalDrawerLinkText?: string; - additionalDrawerLinkIcon?: string; - formatMessage: ReturnType; -}; - const generateDrawerBottomLinks = async ({ disableNotificationsPage, notificationBadgeContent = 0, additionalDrawerLink, additionalDrawerLinkText, formatMessage, -}: GenerateDrawerBottomLinksOptions) => { +}) => { const notificationsPageLinkObject = { Icon: NotificationsIcon, primary: formatMessage('settingsDrawer.notifications'), to: URLS.UPDATES, badgeContent: notificationBadgeContent, }; - const hasAdditionalDrawerLink = additionalDrawerLink && additionalDrawerLinkText; - const additionalDrawerLinkObject = { Icon: ArrowBackIosNew, primary: additionalDrawerLinkText || '', to: additionalDrawerLink || '', - target: '_blank' as const, + target: '_blank', }; - const links = []; - if (!disableNotificationsPage) { links.push(notificationsPageLinkObject); } - if (hasAdditionalDrawerLink) { links.push(additionalDrawerLinkObject); } - return links; }; - -type Link = { - Icon: React.ElementType; - primary: string; - target?: '_blank'; - to: string; - badgeContent?: React.ReactNode; -}; - -export default function PublicLayout({ - children, -}: PublicLayoutProps): React.ReactElement { +export default function PublicLayout({ children }) { const version = useVersion(); const { config, loading } = useConfig([ 'disableNotificationsPage', @@ -107,31 +74,25 @@ export default function PublicLayout({ ]); const theme = useTheme(); const formatMessage = useFormatMessage(); - const [bottomLinks, setBottomLinks] = React.useState([]); + const [bottomLinks, setBottomLinks] = React.useState([]); const matchSmallScreens = useMediaQuery(theme.breakpoints.down('lg')); const [isDrawerOpen, setDrawerOpen] = React.useState(!matchSmallScreens); - const openDrawer = () => setDrawerOpen(true); const closeDrawer = () => setDrawerOpen(false); - React.useEffect(() => { async function perform() { const newBottomLinks = await generateDrawerBottomLinks({ notificationBadgeContent: version.newVersionCount, - disableNotificationsPage: config?.disableNotificationsPage as boolean, - additionalDrawerLink: config?.additionalDrawerLink as string, - additionalDrawerLinkText: config?.additionalDrawerLinkText as string, + disableNotificationsPage: config?.disableNotificationsPage, + additionalDrawerLink: config?.additionalDrawerLink, + additionalDrawerLinkText: config?.additionalDrawerLinkText, formatMessage, }); - setBottomLinks(newBottomLinks); } - if (loading) return; - perform(); }, [config, loading, version.newVersionCount]); - return ( <> + React.forwardRef(function InLineLink(linkProps, ref) { + try { + // challenge the link to check if it's absolute URL + new URL(to); // should throw an error if it's not an absolute URL + return ( + + ); + } catch { + return ; + } + }), + [to], + ); + return ( +
  • + + {icon} + + +
  • + ); +} diff --git a/packages/web/src/components/ListItemLink/index.tsx b/packages/web/src/components/ListItemLink/index.tsx deleted file mode 100644 index a6013fb5..00000000 --- a/packages/web/src/components/ListItemLink/index.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import * as React from 'react'; -import { useMatch } from 'react-router-dom'; -import ListItem from '@mui/material/ListItemButton'; -import ListItemIcon from '@mui/material/ListItemIcon'; -import ListItemText from '@mui/material/ListItemText'; -import { Link, LinkProps } from 'react-router-dom'; - -type ListItemLinkProps = { - icon: React.ReactNode; - primary: string; - to: string; - target?: '_blank'; - onClick?: (event: React.SyntheticEvent) => void; - 'data-test'?: string; -}; - -export default function ListItemLink( - props: ListItemLinkProps -): React.ReactElement { - const { icon, primary, to, onClick, 'data-test': dataTest, target } = props; - const selected = useMatch({ path: to, end: true }); - - const CustomLink = React.useMemo( - () => - React.forwardRef>( - function InLineLink(linkProps, ref) { - try { - // challenge the link to check if it's absolute URL - new URL(to); // should throw an error if it's not an absolute URL - - return ( -
    - ); - } catch { - return ; - } - } - ), - [to] - ); - - return ( -
  • - - {icon} - - -
  • - ); -} diff --git a/packages/web/src/components/ListLoader/index.tsx b/packages/web/src/components/ListLoader/index.jsx similarity index 83% rename from packages/web/src/components/ListLoader/index.tsx rename to packages/web/src/components/ListLoader/index.jsx index 017d4bf7..ddc64728 100644 --- a/packages/web/src/components/ListLoader/index.tsx +++ b/packages/web/src/components/ListLoader/index.jsx @@ -7,18 +7,7 @@ import { } from '@mui/material'; import EditIcon from '@mui/icons-material/Edit'; import DeleteIcon from '@mui/icons-material/Delete'; - -type ListLoaderProps = { - rowsNumber: number; - columnsNumber: number; - 'data-test'?: string; -}; - -const ListLoader = ({ - rowsNumber, - columnsNumber, - 'data-test': dataTest, -}: ListLoaderProps) => { +const ListLoader = ({ rowsNumber, columnsNumber, 'data-test': dataTest }) => { return ( <> {[...Array(rowsNumber)].map((row, index) => ( @@ -49,5 +38,4 @@ const ListLoader = ({ ); }; - export default ListLoader; diff --git a/packages/web/src/components/LiveChat/Chatwoot.ee.jsx b/packages/web/src/components/LiveChat/Chatwoot.ee.jsx new file mode 100644 index 00000000..5c8f6c12 --- /dev/null +++ b/packages/web/src/components/LiveChat/Chatwoot.ee.jsx @@ -0,0 +1,45 @@ +import * as React from 'react'; +import { useTheme } from '@mui/material/styles'; +import useMediaQuery from '@mui/material/useMediaQuery'; +import appConfig from 'config/app'; +import useCurrentUser from 'hooks/useCurrentUser'; +const Chatwoot = ({ ready }) => { + const theme = useTheme(); + const currentUser = useCurrentUser(); + const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md')); + React.useEffect(function initiateChatwoot() { + window.chatwootSDK.run({ + websiteToken: 'EFyq5MTsvS7XwUrwSH36VskT', + baseUrl: appConfig.chatwootBaseUrl, + }); + return function removeChatwoot() { + window.$chatwoot.reset(); + window.$chatwoot.toggleBubbleVisibility('hide'); + }; + }, []); + React.useEffect( + function initiateUser() { + if (!currentUser?.id || !ready) return; + window.$chatwoot.setUser(currentUser.id, { + email: currentUser.email, + name: currentUser.fullName, + }); + if (!matchSmallScreens) { + window.$chatwoot.toggleBubbleVisibility('show'); + } + }, + [currentUser, ready, matchSmallScreens], + ); + React.useLayoutEffect( + function hideChatwoot() { + if (matchSmallScreens) { + window.$chatwoot?.toggleBubbleVisibility('hide'); + } else { + window.$chatwoot?.toggleBubbleVisibility('show'); + } + }, + [matchSmallScreens], + ); + return ; +}; +export default Chatwoot; diff --git a/packages/web/src/components/LiveChat/Chatwoot.ee.tsx b/packages/web/src/components/LiveChat/Chatwoot.ee.tsx deleted file mode 100644 index 67182189..00000000 --- a/packages/web/src/components/LiveChat/Chatwoot.ee.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import * as React from 'react'; -import { useTheme } from '@mui/material/styles'; -import useMediaQuery from '@mui/material/useMediaQuery'; - -import appConfig from 'config/app'; -import useCurrentUser from 'hooks/useCurrentUser'; - -type ChatwootProps = { - ready: boolean; -} - -const Chatwoot = ({ ready }: ChatwootProps) => { - const theme = useTheme(); - const currentUser = useCurrentUser(); - const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md')); - - React.useEffect(function initiateChatwoot() { - window.chatwootSDK.run({ - websiteToken: 'EFyq5MTsvS7XwUrwSH36VskT', - baseUrl: appConfig.chatwootBaseUrl, - }); - - return function removeChatwoot() { - window.$chatwoot.reset(); - window.$chatwoot.toggleBubbleVisibility('hide'); - }; - }, []); - - React.useEffect(function initiateUser() { - if (!currentUser?.id || !ready) return; - - window.$chatwoot.setUser(currentUser.id, { - email: currentUser.email, - name: currentUser.fullName, - }); - - if (!matchSmallScreens) { - window.$chatwoot.toggleBubbleVisibility("show"); - } - }, [currentUser, ready, matchSmallScreens]); - - React.useLayoutEffect(function hideChatwoot() { - if (matchSmallScreens) { - window.$chatwoot?.toggleBubbleVisibility('hide'); - } else { - window.$chatwoot?.toggleBubbleVisibility('show'); - } - }, [matchSmallScreens]) - - return ( - - ); -}; - -export default Chatwoot; diff --git a/packages/web/src/components/LiveChat/index.ee.jsx b/packages/web/src/components/LiveChat/index.ee.jsx new file mode 100644 index 00000000..6ff19aed --- /dev/null +++ b/packages/web/src/components/LiveChat/index.ee.jsx @@ -0,0 +1,47 @@ +import * as React from 'react'; +import appConfig from 'config/app'; +import useAuthentication from 'hooks/useAuthentication'; +import useCloud from 'hooks/useCloud'; +import Chatwoot from './Chatwoot.ee'; +const LiveChat = () => { + const isCloud = useCloud(); + const { isAuthenticated } = useAuthentication(); + const [isLoaded, setLoaded] = React.useState(false); + const [isReady, setReady] = React.useState(false); + const shouldShow = isCloud && isAuthenticated; + React.useLayoutEffect(() => { + window.addEventListener( + 'chatwoot:ready', + function () { + setReady(true); + }, + { once: true }, + ); + }, []); + React.useLayoutEffect( + function addChatwootScript() { + if (!shouldShow) return; + window.chatwootSettings = { + hideMessageBubble: true, + position: 'right', + type: 'standard', + launcherTitle: 'Give us feedback', + }; + const g = document.createElement('script'); + const s = document.getElementsByTagName('script')[0]; + g.src = appConfig.chatwootBaseUrl + '/packs/js/sdk.js'; + g.defer = true; + g.async = true; + if (s.parentNode) { + s.parentNode.insertBefore(g, s); + } + g.onload = function () { + setLoaded(true); + }; + }, + [shouldShow], + ); + if (!shouldShow || !isLoaded) return ; + return ; +}; +export default LiveChat; diff --git a/packages/web/src/components/LiveChat/index.ee.tsx b/packages/web/src/components/LiveChat/index.ee.tsx deleted file mode 100644 index 6af0df30..00000000 --- a/packages/web/src/components/LiveChat/index.ee.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import * as React from 'react'; - -import appConfig from 'config/app'; -import useAuthentication from 'hooks/useAuthentication'; -import useCloud from 'hooks/useCloud'; -import Chatwoot from './Chatwoot.ee'; - -declare global { - interface Window { - chatwootSDK: any; - $chatwoot: any; - chatwootSettings: Record; - } -} - -const LiveChat = () => { - const isCloud = useCloud(); - const { isAuthenticated } = useAuthentication(); - const [isLoaded, setLoaded] = React.useState(false); - const [isReady, setReady] = React.useState(false); - - const shouldShow = isCloud && isAuthenticated; - - React.useLayoutEffect(() => { - window.addEventListener("chatwoot:ready", function () { - setReady(true); - }, { once: true }); - }, []); - - React.useLayoutEffect(function addChatwootScript() { - if (!shouldShow) return; - - window.chatwootSettings = { - hideMessageBubble: true, - position: 'right', - type: 'standard', - launcherTitle: 'Give us feedback' - }; - - const g = document.createElement('script') - const s = document.getElementsByTagName('script')[0]; - g.src = appConfig.chatwootBaseUrl + '/packs/js/sdk.js'; - g.defer = true; - g.async = true; - - if (s.parentNode) { - s.parentNode.insertBefore(g, s); - } - - g.onload = function () { - setLoaded(true); - } - }, [shouldShow]); - - if (!shouldShow || !isLoaded) return (); - - return ( - - ); -}; - -export default LiveChat; diff --git a/packages/web/src/components/LoginForm/index.tsx b/packages/web/src/components/LoginForm/index.jsx similarity index 98% rename from packages/web/src/components/LoginForm/index.tsx rename to packages/web/src/components/LoginForm/index.jsx index 22be2469..78ed92ba 100644 --- a/packages/web/src/components/LoginForm/index.tsx +++ b/packages/web/src/components/LoginForm/index.jsx @@ -5,7 +5,6 @@ import Paper from '@mui/material/Paper'; import Link from '@mui/material/Link'; import Typography from '@mui/material/Typography'; import LoadingButton from '@mui/lab/LoadingButton'; - import useAuthentication from 'hooks/useAuthentication'; import useCloud from 'hooks/useCloud'; import * as URLS from 'config/urls'; @@ -13,32 +12,26 @@ import { LOGIN } from 'graphql/mutations/login'; import Form from 'components/Form'; import TextField from 'components/TextField'; import useFormatMessage from 'hooks/useFormatMessage'; - function LoginForm() { const isCloud = useCloud(); const navigate = useNavigate(); const formatMessage = useFormatMessage(); const authentication = useAuthentication(); const [login, { loading }] = useMutation(LOGIN); - React.useEffect(() => { if (authentication.isAuthenticated) { navigate(URLS.DASHBOARD); } }, [authentication.isAuthenticated]); - - const handleSubmit = async (values: any) => { + const handleSubmit = async (values) => { const { data } = await login({ variables: { input: values, }, }); - const { token } = data.login; - authentication.updateToken(token); }; - return ( ); } - export default LoginForm; diff --git a/packages/web/src/components/Logo/index.tsx b/packages/web/src/components/Logo/index.jsx similarity index 86% rename from packages/web/src/components/Logo/index.tsx rename to packages/web/src/components/Logo/index.jsx index 441fb5ee..363d2188 100644 --- a/packages/web/src/components/Logo/index.tsx +++ b/packages/web/src/components/Logo/index.jsx @@ -1,18 +1,12 @@ import * as React from 'react'; - import CustomLogo from 'components/CustomLogo/index.ee'; import DefaultLogo from 'components/DefaultLogo'; import useConfig from 'hooks/useConfig'; - const Logo = () => { const { config, loading } = useConfig(['logo.svgData']); - - const logoSvgData = config?.['logo.svgData'] as string; + const logoSvgData = config?.['logo.svgData']; if (loading && !logoSvgData) return ; - if (logoSvgData) return ; - return ; }; - export default Logo; diff --git a/packages/web/src/components/AppBar/style.ts b/packages/web/src/components/Logo/style.js similarity index 99% rename from packages/web/src/components/AppBar/style.ts rename to packages/web/src/components/Logo/style.js index 5c446842..2d26af6e 100644 --- a/packages/web/src/components/AppBar/style.ts +++ b/packages/web/src/components/Logo/style.js @@ -1,6 +1,5 @@ import { styled } from '@mui/material/styles'; import { Link as RouterLink } from 'react-router-dom'; - export const Link = styled(RouterLink)(() => ({ textDecoration: 'none', color: 'inherit', diff --git a/packages/web/src/components/MationLogo/index.tsx b/packages/web/src/components/MationLogo/index.jsx similarity index 98% rename from packages/web/src/components/MationLogo/index.tsx rename to packages/web/src/components/MationLogo/index.jsx index c83b91a6..34240749 100644 --- a/packages/web/src/components/MationLogo/index.tsx +++ b/packages/web/src/components/MationLogo/index.jsx @@ -1,8 +1,6 @@ import * as React from 'react'; import { ReactComponent as MationLogoSvg } from './assets/mation-logo.svg'; - const MationLogo = () => { return ; }; - export default MationLogo; diff --git a/packages/web/src/components/MetadataProvider/index.tsx b/packages/web/src/components/MetadataProvider/index.jsx similarity index 68% rename from packages/web/src/components/MetadataProvider/index.tsx rename to packages/web/src/components/MetadataProvider/index.jsx index b7aaf140..19a549a4 100644 --- a/packages/web/src/components/MetadataProvider/index.tsx +++ b/packages/web/src/components/MetadataProvider/index.jsx @@ -1,29 +1,15 @@ import * as React from 'react'; - import useConfig from 'hooks/useConfig'; - -type MetadataProviderProps = { - children: React.ReactNode; -}; - -const MetadataProvider = ({ - children, -}: MetadataProviderProps): React.ReactElement => { +const MetadataProvider = ({ children }) => { const { config } = useConfig(); - React.useEffect(() => { - document.title = (config?.title as string) || 'Automatisch'; + document.title = config?.title || 'Automatisch'; }, [config?.title]); - React.useEffect(() => { - const existingFaviconElement = document.querySelector( - "link[rel~='icon']" - ) as HTMLLinkElement | null; - + const existingFaviconElement = document.querySelector("link[rel~='icon']"); if (config?.disableFavicon === true) { existingFaviconElement?.remove(); } - if (config?.disableFavicon === false) { if (existingFaviconElement) { existingFaviconElement.href = '/browser-tab.ico'; @@ -35,8 +21,6 @@ const MetadataProvider = ({ } } }, [config?.disableFavicon]); - return <>{children}; }; - export default MetadataProvider; diff --git a/packages/web/src/components/NoResultFound/index.tsx b/packages/web/src/components/NoResultFound/index.jsx similarity index 59% rename from packages/web/src/components/NoResultFound/index.tsx rename to packages/web/src/components/NoResultFound/index.jsx index 4a3a7100..ecee7a50 100644 --- a/packages/web/src/components/NoResultFound/index.tsx +++ b/packages/web/src/components/NoResultFound/index.jsx @@ -1,34 +1,20 @@ import * as React from 'react'; import { Link } from 'react-router-dom'; -import type { LinkProps } from 'react-router-dom'; import Card from '@mui/material/Card'; import AddCircleIcon from '@mui/icons-material/AddCircle'; import CardActionArea from '@mui/material/CardActionArea'; import Typography from '@mui/material/Typography'; import { CardContent } from './style'; - -type NoResultFoundProps = { - text?: string; - to?: string; -}; - -export default function NoResultFound( - props: NoResultFoundProps -): React.ReactElement { +export default function NoResultFound(props) { const { text, to } = props; - const ActionAreaLink = React.useMemo( () => - React.forwardRef>( - function InlineLink(linkProps, ref) { - if (!to) return
    {linkProps.children}
    ; - - return ; - } - ), - [to] + React.forwardRef(function InlineLink(linkProps, ref) { + if (!to) return
    {linkProps.children}
    ; + return ; + }), + [to], ); - return ( diff --git a/packages/web/src/components/NoResultFound/style.ts b/packages/web/src/components/NoResultFound/style.js similarity index 99% rename from packages/web/src/components/NoResultFound/style.ts rename to packages/web/src/components/NoResultFound/style.js index 9f0f61be..828f1878 100644 --- a/packages/web/src/components/NoResultFound/style.ts +++ b/packages/web/src/components/NoResultFound/style.js @@ -1,6 +1,5 @@ import { styled } from '@mui/material/styles'; import MuiCardContent from '@mui/material/CardContent'; - export const CardContent = styled(MuiCardContent)` display: flex; justify-content: center; diff --git a/packages/web/src/components/NotFound/index.tsx b/packages/web/src/components/NotFound/index.jsx similarity index 94% rename from packages/web/src/components/NotFound/index.tsx rename to packages/web/src/components/NotFound/index.jsx index 8311716f..007d388e 100644 --- a/packages/web/src/components/NotFound/index.tsx +++ b/packages/web/src/components/NotFound/index.jsx @@ -2,17 +2,14 @@ import { Link } from 'react-router-dom'; import Button from '@mui/material/Button'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; - import * as URLS from 'config/urls'; import useFormatMessage from 'hooks/useFormatMessage'; import useAuthentication from 'hooks/useAuthentication'; import Layout from 'components/Layout'; import PublicLayout from 'components/PublicLayout'; - -export default function NoResultFound(): React.ReactElement { +export default function NoResultFound() { const formatMessage = useFormatMessage(); const { isAuthenticated } = useAuthentication(); - const pageContent = ( ); - return isAuthenticated ? ( {pageContent} ) : ( diff --git a/packages/web/src/components/NotificationCard/index.tsx b/packages/web/src/components/NotificationCard/index.jsx similarity index 83% rename from packages/web/src/components/NotificationCard/index.tsx rename to packages/web/src/components/NotificationCard/index.jsx index 51dbeddf..727d80bd 100644 --- a/packages/web/src/components/NotificationCard/index.tsx +++ b/packages/web/src/components/NotificationCard/index.jsx @@ -5,28 +5,16 @@ import CardActionArea from '@mui/material/CardActionArea'; import CardContent from '@mui/material/CardContent'; import Typography from '@mui/material/Typography'; import { DateTime } from 'luxon'; - import useFormatMessage from 'hooks/useFormatMessage'; - -interface NotificationCardProps { - name: string; - createdAt: string; - documentationUrl: string; - description: string; -} - -const getHumanlyDate = (timestamp: number) => +const getHumanlyDate = (timestamp) => DateTime.fromMillis(timestamp).toRelative(); - -export default function NotificationCard(props: NotificationCardProps) { +export default function NotificationCard(props) { const { name, createdAt, documentationUrl, description } = props; - const formatMessage = useFormatMessage(); const relativeCreatedAt = getHumanlyDate(new Date(createdAt).getTime()); const subheader = formatMessage('notification.releasedAt', { relativeDate: relativeCreatedAt, }); - return ( diff --git a/packages/web/src/components/PageTitle/index.jsx b/packages/web/src/components/PageTitle/index.jsx new file mode 100644 index 00000000..ab34a0be --- /dev/null +++ b/packages/web/src/components/PageTitle/index.jsx @@ -0,0 +1,5 @@ +import * as React from 'react'; +import Typography from '@mui/material/Typography'; +export default function PageTitle(props) { + return ; +} diff --git a/packages/web/src/components/PageTitle/index.tsx b/packages/web/src/components/PageTitle/index.tsx deleted file mode 100644 index 164fd8b0..00000000 --- a/packages/web/src/components/PageTitle/index.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import * as React from 'react'; -import Typography, { TypographyProps } from '@mui/material/Typography'; - -type PageTitleProps = TypographyProps; - -export default function PageTitle(props: PageTitleProps): React.ReactElement { - return ; -} diff --git a/packages/web/src/components/PermissionCatalogField/PermissionCatalogFieldLoader/index.tsx b/packages/web/src/components/PermissionCatalogField/PermissionCatalogFieldLoader/index.jsx similarity index 99% rename from packages/web/src/components/PermissionCatalogField/PermissionCatalogFieldLoader/index.tsx rename to packages/web/src/components/PermissionCatalogField/PermissionCatalogFieldLoader/index.jsx index 79bce0b5..1eca4b15 100644 --- a/packages/web/src/components/PermissionCatalogField/PermissionCatalogFieldLoader/index.tsx +++ b/packages/web/src/components/PermissionCatalogField/PermissionCatalogFieldLoader/index.jsx @@ -12,7 +12,6 @@ import { } from '@mui/material'; import SettingsIcon from '@mui/icons-material/Settings'; import ControlledCheckbox from 'components/ControlledCheckbox'; - const PermissionCatalogFieldLoader = () => { return ( @@ -57,5 +56,4 @@ const PermissionCatalogFieldLoader = () => { ); }; - export default PermissionCatalogFieldLoader; diff --git a/packages/web/src/components/PermissionCatalogField/PermissionSettings.ee.tsx b/packages/web/src/components/PermissionCatalogField/PermissionSettings.ee.jsx similarity index 92% rename from packages/web/src/components/PermissionCatalogField/PermissionSettings.ee.tsx rename to packages/web/src/components/PermissionCatalogField/PermissionSettings.ee.jsx index 6948c4cc..7796d344 100644 --- a/packages/web/src/components/PermissionCatalogField/PermissionSettings.ee.tsx +++ b/packages/web/src/components/PermissionCatalogField/PermissionSettings.ee.jsx @@ -13,22 +13,9 @@ import TableRow from '@mui/material/TableRow'; import Typography from '@mui/material/Typography'; import * as React from 'react'; import { useFormContext } from 'react-hook-form'; - -import { IPermissionCatalog } from 'types'; import ControlledCheckbox from 'components/ControlledCheckbox'; import useFormatMessage from 'hooks/useFormatMessage'; - -type PermissionSettingsProps = { - onClose: () => void; - fieldPrefix: string; - subject: string; - open?: boolean; - defaultChecked?: boolean; - actions: IPermissionCatalog['actions']; - conditions: IPermissionCatalog['conditions']; -}; - -export default function PermissionSettings(props: PermissionSettingsProps) { +export default function PermissionSettings(props) { const { onClose, open = false, @@ -38,10 +25,8 @@ export default function PermissionSettings(props: PermissionSettingsProps) { conditions, defaultChecked, } = props; - const formatMessage = useFormatMessage(); const { getValues, resetField } = useFormContext(); - const cancel = () => { for (const action of actions) { for (const condition of conditions) { @@ -49,10 +34,8 @@ export default function PermissionSettings(props: PermissionSettingsProps) { resetField(fieldName); } } - onClose(); }; - const apply = () => { for (const action of actions) { for (const condition of conditions) { @@ -61,10 +44,8 @@ export default function PermissionSettings(props: PermissionSettingsProps) { resetField(fieldName, { defaultValue: value }); } } - onClose(); }; - return ( diff --git a/packages/web/src/components/PermissionCatalogField/index.ee.tsx b/packages/web/src/components/PermissionCatalogField/index.ee.jsx similarity index 94% rename from packages/web/src/components/PermissionCatalogField/index.ee.tsx rename to packages/web/src/components/PermissionCatalogField/index.ee.jsx index 4bb1aa3b..77aa872b 100644 --- a/packages/web/src/components/PermissionCatalogField/index.ee.tsx +++ b/packages/web/src/components/PermissionCatalogField/index.ee.jsx @@ -10,28 +10,18 @@ import TableHead from '@mui/material/TableHead'; import TableRow from '@mui/material/TableRow'; import Typography from '@mui/material/Typography'; import * as React from 'react'; - import ControlledCheckbox from 'components/ControlledCheckbox'; import usePermissionCatalog from 'hooks/usePermissionCatalog.ee'; import PermissionSettings from './PermissionSettings.ee'; import PermissionCatalogFieldLoader from './PermissionCatalogFieldLoader'; - -type PermissionCatalogFieldProps = { - name?: string; - disabled?: boolean; - defaultChecked?: boolean; -}; - const PermissionCatalogField = ({ name = 'permissions', disabled = false, defaultChecked = false, -}: PermissionCatalogFieldProps) => { +}) => { const { permissionCatalog, loading } = usePermissionCatalog(); - const [dialogName, setDialogName] = React.useState(); - + const [dialogName, setDialogName] = React.useState(); if (loading) return ; - return ( @@ -114,5 +104,4 @@ const PermissionCatalogField = ({ ); }; - export default PermissionCatalogField; diff --git a/packages/web/src/components/Portal/index.tsx b/packages/web/src/components/Portal/index.jsx similarity index 53% rename from packages/web/src/components/Portal/index.tsx rename to packages/web/src/components/Portal/index.jsx index 4e792293..f4339748 100644 --- a/packages/web/src/components/Portal/index.tsx +++ b/packages/web/src/components/Portal/index.jsx @@ -1,14 +1,7 @@ -import * as React from 'react'; import ReactDOM from 'react-dom'; - -type PortalProps = { - children: React.ReactElement; -}; - -const Portal = ({ children }: PortalProps) => { +const Portal = ({ children }) => { return typeof document === 'object' ? ReactDOM.createPortal(children, document.body) : null; }; - export default Portal; diff --git a/packages/web/src/components/PowerInput/Popper.tsx b/packages/web/src/components/PowerInput/Popper.jsx similarity index 66% rename from packages/web/src/components/PowerInput/Popper.tsx rename to packages/web/src/components/PowerInput/Popper.jsx index 45285897..3509fe08 100644 --- a/packages/web/src/components/PowerInput/Popper.tsx +++ b/packages/web/src/components/PowerInput/Popper.jsx @@ -2,27 +2,11 @@ import Paper from '@mui/material/Paper'; import MuiPopper from '@mui/material/Popper'; import Tab from '@mui/material/Tab'; import * as React from 'react'; - import Suggestions from 'components/PowerInput/Suggestions'; import TabPanel from 'components/TabPanel'; - import { Tabs } from './style'; - -interface PopperProps { - open: boolean; - anchorEl: any; - data: any; - onSuggestionClick: any; -}; - -const Popper = (props: PopperProps) => { - const { - open, - anchorEl, - data, - onSuggestionClick, - } = props; - +const Popper = (props) => { + const { open, anchorEl, data, onSuggestionClick } = props; return ( { ]} > - + - + ); }; - - export default Popper; diff --git a/packages/web/src/components/PowerInput/Suggestions.tsx b/packages/web/src/components/PowerInput/Suggestions.jsx similarity index 76% rename from packages/web/src/components/PowerInput/Suggestions.tsx rename to packages/web/src/components/PowerInput/Suggestions.jsx index 8ecee9bd..0ea5f280 100644 --- a/packages/web/src/components/PowerInput/Suggestions.tsx +++ b/packages/web/src/components/PowerInput/Suggestions.jsx @@ -1,4 +1,3 @@ -import type { IStep } from 'types'; import ExpandLess from '@mui/icons-material/ExpandLess'; import ExpandMore from '@mui/icons-material/ExpandMore'; import Box from '@mui/material/Box'; @@ -11,39 +10,23 @@ import Paper from '@mui/material/Paper'; import Typography from '@mui/material/Typography'; import throttle from 'lodash/throttle'; import * as React from 'react'; -import { FixedSizeList, ListChildComponentProps } from 'react-window'; - +import { FixedSizeList } from 'react-window'; import SearchInput from 'components/SearchInput'; import useFormatMessage from 'hooks/useFormatMessage'; - -type SuggestionsProps = { - data: { - id: string; - name: string; - output: Record[]; - }[]; - onSuggestionClick: (variable: any) => void; -}; - const SHORT_LIST_LENGTH = 4; const LIST_ITEM_HEIGHT = 64; - -const computeListHeight = (currentLength: number) => { +const computeListHeight = (currentLength) => { const numberOfRenderedItems = Math.min(SHORT_LIST_LENGTH, currentLength); return LIST_ITEM_HEIGHT * numberOfRenderedItems; }; - -const getPartialArray = (array: any[], length = array.length) => { +const getPartialArray = (array, length = array.length) => { return array.slice(0, length); }; - const renderItemFactory = - ({ onSuggestionClick }: Pick) => - (props: ListChildComponentProps) => { + ({ onSuggestionClick }) => + (props) => { const { index, style, data } = props; - const suboption = data[index]; - return ( ); }; - -const Suggestions = (props: SuggestionsProps) => { +const Suggestions = (props) => { const formatMessage = useFormatMessage(); const { data, onSuggestionClick = () => null } = props; - const [current, setCurrent] = React.useState(0); - const [listLength, setListLength] = React.useState(SHORT_LIST_LENGTH); - const [filteredData, setFilteredData] = React.useState(data); - + const [current, setCurrent] = React.useState(0); + const [listLength, setListLength] = React.useState(SHORT_LIST_LENGTH); + const [filteredData, setFilteredData] = React.useState(data); React.useEffect( function syncOptions() { setFilteredData((filteredData) => { if (filteredData.length === 0 && filteredData.length !== data.length) { return data; } - return filteredData; }); }, - [data] + [data], ); - const renderItem = React.useMemo( () => renderItemFactory({ onSuggestionClick, }), - [onSuggestionClick] + [onSuggestionClick], ); - const expandList = () => { setListLength(Infinity); }; - const collapseList = () => { setListLength(SHORT_LIST_LENGTH); }; - React.useEffect(() => { setListLength(SHORT_LIST_LENGTH); }, [current]); - const onSearchChange = React.useMemo( () => - throttle((event: React.ChangeEvent) => { - const search = (event.target as HTMLInputElement).value.toLowerCase(); - + throttle((event) => { + const search = event.target.value.toLowerCase(); if (!search) { setFilteredData(data); return; } - const newFilteredData = data .map((stepWithOutput) => { return { @@ -129,17 +102,15 @@ const Suggestions = (props: SuggestionsProps) => { output: stepWithOutput.output.filter((option) => `${option.label}\n${option.sampleValue}` .toLowerCase() - .includes(search.toLowerCase()) + .includes(search.toLowerCase()), ), }; }) .filter((stepWithOutput) => stepWithOutput.output.length); - setFilteredData(newFilteredData); }, 400), - [data] + [data], ); - return ( @@ -148,13 +119,13 @@ const Suggestions = (props: SuggestionsProps) => { {filteredData.length > 0 && ( - {filteredData.map((option: IStep, index: number) => ( + {filteredData.map((option, index) => ( setCurrent((currentIndex) => - currentIndex === index ? null : index + currentIndex === index ? null : index, ) } sx={{ py: 0.5 }} @@ -172,20 +143,15 @@ const Suggestions = (props: SuggestionsProps) => { > {renderItem} @@ -216,5 +182,4 @@ const Suggestions = (props: SuggestionsProps) => { ); }; - export default Suggestions; diff --git a/packages/web/src/components/PowerInput/data.ts b/packages/web/src/components/PowerInput/data.js similarity index 67% rename from packages/web/src/components/PowerInput/data.ts rename to packages/web/src/components/PowerInput/data.js index ce03ebf9..8657cecb 100644 --- a/packages/web/src/components/PowerInput/data.ts +++ b/packages/web/src/components/PowerInput/data.js @@ -1,21 +1,6 @@ -import type { IStep } from 'types'; - -const joinBy = (delimiter = '.', ...args: string[]) => +const joinBy = (delimiter = '.', ...args) => args.filter(Boolean).join(delimiter); - -type TProcessPayload = { - data: any; - parentKey: string; - index?: number; - parentLabel?: string; -}; - -const process = ({ - data, - parentKey, - index, - parentLabel = '', -}: TProcessPayload): any[] => { +const process = ({ data, parentKey, index, parentLabel = '' }) => { if (typeof data !== 'object') { return [ { @@ -25,14 +10,10 @@ const process = ({ }, ]; } - const entries = Object.entries(data); - return entries.flatMap(([name, sampleValue]) => { - const label = joinBy('.', parentLabel, (index as number)?.toString(), name); - - const value = joinBy('.', parentKey, (index as number)?.toString(), name); - + const label = joinBy('.', parentLabel, index?.toString(), name); + const value = joinBy('.', parentKey, index?.toString(), name); if (Array.isArray(sampleValue)) { return sampleValue.flatMap((item, index) => process({ @@ -43,7 +24,6 @@ const process = ({ }) ); } - if (typeof sampleValue === 'object' && sampleValue !== null) { return process({ data: sampleValue, @@ -51,7 +31,6 @@ const process = ({ parentLabel: label, }); } - return [ { label, @@ -61,17 +40,14 @@ const process = ({ ]; }); }; - -export const processStepWithExecutions = (steps: IStep[]): any[] => { +export const processStepWithExecutions = (steps) => { if (!steps) return []; - return steps - .filter((step: IStep) => { + .filter((step) => { const hasExecutionSteps = !!step.executionSteps?.length; - return hasExecutionSteps; }) - .map((step: IStep, index: number) => ({ + .map((step, index) => ({ id: step.id, // TODO: replace with step.name once introduced name: `${index + 1}. ${ diff --git a/packages/web/src/components/PowerInput/index.tsx b/packages/web/src/components/PowerInput/index.jsx similarity index 85% rename from packages/web/src/components/PowerInput/index.tsx rename to packages/web/src/components/PowerInput/index.jsx index 4ca5c80e..f9d0e186 100644 --- a/packages/web/src/components/PowerInput/index.tsx +++ b/packages/web/src/components/PowerInput/index.jsx @@ -5,10 +5,8 @@ import * as React from 'react'; import { Controller, useFormContext } from 'react-hook-form'; import { createEditor } from 'slate'; import { Editable } from 'slate-react'; - import Slate from 'components/Slate'; import Element from 'components/Slate/Element'; - import { customizeEditor, deserialize, @@ -16,29 +14,10 @@ import { serialize, } from 'components/Slate/utils'; import { StepExecutionsContext } from 'contexts/StepExecutions'; - -import { VariableElement } from 'components/Slate/types'; import Popper from './Popper'; import { processStepWithExecutions } from './data'; import { ChildrenWrapper, FakeInput, InputLabelWrapper } from './style'; - -type PowerInputProps = { - onChange?: (value: string) => void; - onBlur?: (value: string) => void; - defaultValue?: string; - name: string; - label?: string; - type?: string; - required?: boolean; - readOnly?: boolean; - description?: string; - docUrl?: string; - clickToCopy?: boolean; - disabled?: boolean; - shouldUnregister?: boolean; -}; - -const PowerInput = (props: PowerInputProps) => { +const PowerInput = (props) => { const { control } = useFormContext(); const { defaultValue = '', @@ -51,41 +30,34 @@ const PowerInput = (props: PowerInputProps) => { shouldUnregister, } = props; const priorStepsWithExecutions = React.useContext(StepExecutionsContext); - const editorRef = React.useRef(null); + const editorRef = React.useRef(null); const renderElement = React.useCallback( (props) => , - [] + [], ); const [editor] = React.useState(() => customizeEditor(createEditor())); const [showVariableSuggestions, setShowVariableSuggestions] = React.useState(false); - - const disappearSuggestionsOnShift = ( - event: React.KeyboardEvent - ) => { + const disappearSuggestionsOnShift = (event) => { if (event.code === 'Tab') { setShowVariableSuggestions(false); } }; - const stepsWithVariables = React.useMemo(() => { return processStepWithExecutions(priorStepsWithExecutions); }, [priorStepsWithExecutions]); - const handleBlur = React.useCallback( (value) => { onBlur?.(value); }, - [onBlur] + [onBlur], ); - const handleVariableSuggestionClick = React.useCallback( - (variable: Pick) => { + (variable) => { insertVariable(editor, variable, stepsWithVariables); }, - [stepsWithVariables] + [stepsWithVariables], ); - return ( { /> ); }; - export default PowerInput; diff --git a/packages/web/src/components/PowerInput/style.ts b/packages/web/src/components/PowerInput/style.js similarity index 94% rename from packages/web/src/components/PowerInput/style.ts rename to packages/web/src/components/PowerInput/style.js index ac8b78ed..3ec8e474 100644 --- a/packages/web/src/components/PowerInput/style.ts +++ b/packages/web/src/components/PowerInput/style.js @@ -1,23 +1,20 @@ import MuiTabs from '@mui/material/Tabs'; import { styled } from '@mui/material/styles'; - export const ChildrenWrapper = styled('div')` overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; hyphens: auto; `; - export const InputLabelWrapper = styled('div')` position: absolute; left: ${({ theme }) => theme.spacing(1.75)}; inset: 0; left: -6px; `; - export const FakeInput = styled('div', { shouldForwardProp: (prop) => prop !== 'disabled', -}) <{ disabled?: boolean }>` +})` border: 1px solid #eee; min-height: 56px; width: 100%; @@ -28,7 +25,8 @@ export const FakeInput = styled('div', { position: relative; ${({ disabled, theme }) => - !!disabled && ` + !!disabled && + ` color: ${theme.palette.action.disabled}; border-color: ${theme.palette.action.disabled}; `} @@ -37,7 +35,8 @@ export const FakeInput = styled('div', { border-color: ${({ theme }) => theme.palette.text.primary}; } - &:focus-within, &:focus { + &:focus-within, + &:focus { &:before { border-color: ${({ theme }) => theme.palette.primary.main}; border-radius: ${({ theme }) => theme.spacing(0.5)}; @@ -53,7 +52,6 @@ export const FakeInput = styled('div', { } } `; - export const Tabs = styled(MuiTabs)` border-bottom: 1px solid ${({ theme }) => theme.palette.divider}; `; diff --git a/packages/web/src/components/PublicLayout/index.tsx b/packages/web/src/components/PublicLayout/index.jsx similarity index 80% rename from packages/web/src/components/PublicLayout/index.tsx rename to packages/web/src/components/PublicLayout/index.jsx index cb44ba0f..f1634e27 100644 --- a/packages/web/src/components/PublicLayout/index.tsx +++ b/packages/web/src/components/PublicLayout/index.jsx @@ -1,17 +1,10 @@ import * as React from 'react'; - import Toolbar from '@mui/material/Toolbar'; import AppBar from '@mui/material/AppBar'; import Box from '@mui/material/Box'; - import Logo from 'components/Logo'; import Container from 'components/Container'; - -type LayoutProps = { - children: React.ReactNode; -}; - -export default function Layout({ children }: LayoutProps): React.ReactElement { +export default function Layout({ children }) { return ( <> diff --git a/packages/web/src/components/ResetPasswordForm/index.ee.tsx b/packages/web/src/components/ResetPasswordForm/index.ee.jsx similarity index 91% rename from packages/web/src/components/ResetPasswordForm/index.ee.tsx rename to packages/web/src/components/ResetPasswordForm/index.ee.jsx index c2954ba1..f7c874c5 100644 --- a/packages/web/src/components/ResetPasswordForm/index.ee.tsx +++ b/packages/web/src/components/ResetPasswordForm/index.ee.jsx @@ -7,13 +7,11 @@ import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar'; import * as React from 'react'; import { useNavigate, useSearchParams } from 'react-router-dom'; import * as yup from 'yup'; - import Form from 'components/Form'; import TextField from 'components/TextField'; import * as URLS from 'config/urls'; import { RESET_PASSWORD } from 'graphql/mutations/reset-password.ee'; import useFormatMessage from 'hooks/useFormatMessage'; - const validationSchema = yup.object().shape({ password: yup.string().required('resetPasswordForm.mandatoryInput'), confirmPassword: yup @@ -21,17 +19,14 @@ const validationSchema = yup.object().shape({ .required('resetPasswordForm.mandatoryInput') .oneOf([yup.ref('password')], 'resetPasswordForm.passwordsMustMatch'), }); - export default function ResetPasswordForm() { const enqueueSnackbar = useEnqueueSnackbar(); const formatMessage = useFormatMessage(); const navigate = useNavigate(); const [searchParams] = useSearchParams(); const [resetPassword, { data, loading }] = useMutation(RESET_PASSWORD); - const token = searchParams.get('token'); - - const handleSubmit = async (values: any) => { + const handleSubmit = async (values) => { await resetPassword({ variables: { input: { @@ -40,17 +35,14 @@ export default function ResetPasswordForm() { }, }, }); - enqueueSnackbar(formatMessage('resetPasswordForm.passwordUpdated'), { variant: 'success', SnackbarProps: { - 'data-test': 'snackbar-reset-password-success' - } + 'data-test': 'snackbar-reset-password-success', + }, }); - navigate(URLS.LOGIN); }; - return (
    @@ -49,10 +46,13 @@ export default function RoleList(): React.ReactElement { - {loading && } + {loading && ( + + )} {!loading && roles.map((role) => ( - {role.name} + + {role.name} + - {role.description} + + {role.description} + diff --git a/packages/web/src/components/Router/index.tsx b/packages/web/src/components/Router/index.jsx similarity index 98% rename from packages/web/src/components/Router/index.tsx rename to packages/web/src/components/Router/index.jsx index 217af656..4955e5f7 100644 --- a/packages/web/src/components/Router/index.tsx +++ b/packages/web/src/components/Router/index.jsx @@ -1,3 +1,2 @@ import { BrowserRouter as Router } from 'react-router-dom'; - export default Router; diff --git a/packages/web/src/components/SearchInput/index.tsx b/packages/web/src/components/SearchInput/index.jsx similarity index 84% rename from packages/web/src/components/SearchInput/index.tsx rename to packages/web/src/components/SearchInput/index.jsx index 53ffe96a..2fa16917 100644 --- a/packages/web/src/components/SearchInput/index.tsx +++ b/packages/web/src/components/SearchInput/index.jsx @@ -4,18 +4,9 @@ import OutlinedInput from '@mui/material/OutlinedInput'; import InputAdornment from '@mui/material/InputAdornment'; import FormControl from '@mui/material/FormControl'; import SearchIcon from '@mui/icons-material/Search'; - import useFormatMessage from 'hooks/useFormatMessage'; - -type SearchInputProps = { - onChange?: (event: React.ChangeEvent) => void; -}; - -export default function SearchInput({ - onChange, -}: SearchInputProps): React.ReactElement { +export default function SearchInput({ onChange }) { const formatMessage = useFormatMessage(); - return ( diff --git a/packages/web/src/components/SearchableJSONViewer/index.tsx b/packages/web/src/components/SearchableJSONViewer/index.jsx similarity index 73% rename from packages/web/src/components/SearchableJSONViewer/index.tsx rename to packages/web/src/components/SearchableJSONViewer/index.jsx index 20f922b9..5d977f51 100644 --- a/packages/web/src/components/SearchableJSONViewer/index.tsx +++ b/packages/web/src/components/SearchableJSONViewer/index.jsx @@ -2,44 +2,30 @@ import * as React from 'react'; import throttle from 'lodash/throttle'; import isEmpty from 'lodash/isEmpty'; import { Box, Typography } from '@mui/material'; - -import { IJSONObject } from 'types'; import JSONViewer from 'components/JSONViewer'; import SearchInput from 'components/SearchInput'; import useFormatMessage from 'hooks/useFormatMessage'; import filterObject from 'helpers/filterObject'; - -type JSONViewerProps = { - data: IJSONObject; -}; - -const SearchableJSONViewer = ({ data }: JSONViewerProps) => { - const [filteredData, setFilteredData] = React.useState( - data - ); +const SearchableJSONViewer = ({ data }) => { + const [filteredData, setFilteredData] = React.useState(data); const formatMessage = useFormatMessage(); - const onSearchChange = React.useMemo( () => - throttle((event: React.ChangeEvent) => { - const search = (event.target as HTMLInputElement).value.toLowerCase(); - + throttle((event) => { + const search = event.target.value.toLowerCase(); if (!search) { setFilteredData(data); return; } - const newFilteredData = filterObject(data, search); - if (isEmpty(newFilteredData)) { setFilteredData(null); } else { setFilteredData(newFilteredData); } }, 400), - [data] + [data], ); - return ( <> @@ -52,5 +38,4 @@ const SearchableJSONViewer = ({ data }: JSONViewerProps) => { ); }; - export default SearchableJSONViewer; diff --git a/packages/web/src/components/SettingsLayout/index.tsx b/packages/web/src/components/SettingsLayout/index.jsx similarity index 89% rename from packages/web/src/components/SettingsLayout/index.tsx rename to packages/web/src/components/SettingsLayout/index.jsx index bc2e20e2..e27af0de 100644 --- a/packages/web/src/components/SettingsLayout/index.tsx +++ b/packages/web/src/components/SettingsLayout/index.jsx @@ -6,18 +6,12 @@ import useMediaQuery from '@mui/material/useMediaQuery'; import AccountCircleIcon from '@mui/icons-material/AccountCircle'; import ArrowBackIosNewIcon from '@mui/icons-material/ArrowBackIosNew'; import PaymentIcon from '@mui/icons-material/Payment'; - import * as URLS from 'config/urls'; import useAutomatischInfo from 'hooks/useAutomatischInfo'; import useFormatMessage from 'hooks/useFormatMessage'; import AppBar from 'components/AppBar'; import Drawer from 'components/Drawer'; - -type SettingsLayoutProps = { - children: React.ReactNode; -}; - -function createDrawerLinks({ isCloud }: { isCloud: boolean }) { +function createDrawerLinks({ isCloud }) { const items = [ { Icon: AccountCircleIcon, @@ -25,7 +19,6 @@ function createDrawerLinks({ isCloud }: { isCloud: boolean }) { to: URLS.SETTINGS_PROFILE, }, ]; - if (isCloud) { items.push({ Icon: PaymentIcon, @@ -33,23 +26,17 @@ function createDrawerLinks({ isCloud }: { isCloud: boolean }) { to: URLS.SETTINGS_BILLING_AND_USAGE, }); } - return items; } - -export default function SettingsLayout({ - children, -}: SettingsLayoutProps): React.ReactElement { +export default function SettingsLayout({ children }) { const { isCloud } = useAutomatischInfo(); const theme = useTheme(); const formatMessage = useFormatMessage(); const matchSmallScreens = useMediaQuery(theme.breakpoints.down('lg')); const [isDrawerOpen, setDrawerOpen] = React.useState(!matchSmallScreens); - const openDrawer = () => setDrawerOpen(true); const closeDrawer = () => setDrawerOpen(false); const drawerLinks = createDrawerLinks({ isCloud }); - const drawerBottomLinks = [ { Icon: ArrowBackIosNewIcon, @@ -57,7 +44,6 @@ export default function SettingsLayout({ to: '/', }, ]; - return ( <> { if (authentication.isAuthenticated) { navigate(URLS.DASHBOARD); } }, [authentication.isAuthenticated]); - - const handleSubmit = async (values: any) => { + const handleSubmit = async (values) => { const { fullName, email, password } = values; await registerUser({ variables: { input: { fullName, email, password }, }, }); - const { data } = await login({ variables: { input: { email, password }, }, }); - const { token } = data.login; - authentication.updateToken(token); }; - return ( ); } - export default SignUpForm; diff --git a/packages/web/src/components/Slate/Element.tsx b/packages/web/src/components/Slate/Element.jsx similarity index 84% rename from packages/web/src/components/Slate/Element.tsx rename to packages/web/src/components/Slate/Element.jsx index ede69372..f28d9e99 100644 --- a/packages/web/src/components/Slate/Element.tsx +++ b/packages/web/src/components/Slate/Element.jsx @@ -1,8 +1,6 @@ import Variable from './Variable'; - -export default function Element(props: any) { +export default function Element(props) { const { attributes, children, element, disabled } = props; - switch (element.type) { case 'variable': return ; diff --git a/packages/web/src/components/Slate/Variable.tsx b/packages/web/src/components/Slate/Variable.jsx similarity index 77% rename from packages/web/src/components/Slate/Variable.tsx rename to packages/web/src/components/Slate/Variable.jsx index 8ffc16d7..4aff7628 100644 --- a/packages/web/src/components/Slate/Variable.tsx +++ b/packages/web/src/components/Slate/Variable.jsx @@ -1,16 +1,15 @@ import Chip from '@mui/material/Chip'; import { useSelected, useFocused } from 'slate-react'; - -export default function Variable({ attributes, children, element, disabled }: any) { +export default function Variable({ attributes, children, element, disabled }) { const selected = useSelected(); const focused = useFocused(); const label = ( <> - {element.name}: {element.sampleValue} + {element.name}:{' '} + {element.sampleValue} {children} ); - return ( ); -}; - +} diff --git a/packages/web/src/components/Slate/index.tsx b/packages/web/src/components/Slate/index.jsx similarity index 98% rename from packages/web/src/components/Slate/index.tsx rename to packages/web/src/components/Slate/index.jsx index 86c238b9..93d3fdfd 100644 --- a/packages/web/src/components/Slate/index.tsx +++ b/packages/web/src/components/Slate/index.jsx @@ -1,3 +1,2 @@ import { Slate } from 'slate-react'; - export default Slate; diff --git a/packages/web/src/components/Slate/types.js b/packages/web/src/components/Slate/types.js new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/packages/web/src/components/Slate/types.js @@ -0,0 +1 @@ +export {}; diff --git a/packages/web/src/components/Slate/types.ts b/packages/web/src/components/Slate/types.ts deleted file mode 100644 index c315865a..00000000 --- a/packages/web/src/components/Slate/types.ts +++ /dev/null @@ -1,32 +0,0 @@ -import type { BaseEditor, Text, Descendant } from 'slate'; -import type { ReactEditor } from 'slate-react'; - -export type VariableElement = { - type: 'variable'; - value?: unknown; - name?: string; - sampleValue?: unknown; - children: Text[]; -}; - -export type ParagraphElement = { - type: 'paragraph'; - value?: string; - children: Descendant[]; -}; - -export type CustomText = { - text: string; - value: string; -}; - -export type CustomEditor = BaseEditor & ReactEditor; - -export type CustomElement = VariableElement | ParagraphElement; - -declare module 'slate' { - interface CustomTypes { - Editor: CustomEditor; - Element: CustomElement; - } -} diff --git a/packages/web/src/components/Slate/utils.ts b/packages/web/src/components/Slate/utils.js similarity index 68% rename from packages/web/src/components/Slate/utils.ts rename to packages/web/src/components/Slate/utils.js index eaba00d6..bf83c1c5 100644 --- a/packages/web/src/components/Slate/utils.ts +++ b/packages/web/src/components/Slate/utils.js @@ -1,115 +1,65 @@ -import { Text, Descendant } from 'slate'; +import { Text } from 'slate'; import { withHistory } from 'slate-history'; import { ReactEditor, withReact } from 'slate-react'; -import { IFieldDropdownOption } from 'types'; - -import type { - CustomEditor, - CustomElement, - CustomText, - ParagraphElement, - VariableElement, -} from './types'; - -type StepWithVariables = { - id: string; - name: string; - output: { - label: string; - sampleValue: string; - value: string; - }[]; -}; - -type StepsWithVariables = StepWithVariables[]; - -function isCustomText(value: any): value is CustomText { +function isCustomText(value) { const isText = Text.isText(value); const hasValueProperty = 'value' in value; - if (isText && hasValueProperty) return true; - return false; } - -function getStepPosition(id: string, stepsWithVariables: StepsWithVariables) { +function getStepPosition(id, stepsWithVariables) { const stepIndex = stepsWithVariables.findIndex((stepWithVariables) => { return stepWithVariables.id === id; }); - return stepIndex + 1; } - -function getVariableName(variable: string) { +function getVariableName(variable) { return variable.replace(/{{|}}/g, ''); } - -function getVariableStepId(variable: string) { +function getVariableStepId(variable) { const nameWithoutCurlies = getVariableName(variable); const stepId = nameWithoutCurlies.match(stepIdRegExp)?.[1] || ''; - return stepId; } - -function getVariableSampleValue( - variable: string, - stepsWithVariables: StepsWithVariables -) { +function getVariableSampleValue(variable, stepsWithVariables) { const variableStepId = getVariableStepId(variable); const stepWithVariables = stepsWithVariables.find( - ({ id }: { id: string }) => id === variableStepId + ({ id }) => id === variableStepId ); - if (!stepWithVariables) return null; - const variableName = getVariableName(variable); const variableData = stepWithVariables.output.find( ({ value }) => variableName === value ); - if (!variableData) return null; - return variableData.sampleValue; } - -function getVariableDetails( - variable: string, - stepsWithVariables: StepsWithVariables -) { +function getVariableDetails(variable, stepsWithVariables) { const variableName = getVariableName(variable); const stepId = getVariableStepId(variableName); const stepPosition = getStepPosition(stepId, stepsWithVariables); const sampleValue = getVariableSampleValue(variable, stepsWithVariables); const label = variableName.replace(`step.${stepId}.`, `step${stepPosition}.`); - return { sampleValue, label, }; } - const variableRegExp = /({{.*?}})/; const stepIdRegExp = /^step.([\da-zA-Z-]*)/; - -export const deserialize = ( - value: boolean | string | number, - options: readonly IFieldDropdownOption[], - stepsWithVariables: StepsWithVariables -): Descendant[] => { +export const deserialize = (value, options, stepsWithVariables) => { const selectedNativeOption = options?.find( (option) => value === option.value ); - if (selectedNativeOption) { return [ { type: 'paragraph', - value: selectedNativeOption.value as string, + value: selectedNativeOption.value, children: [{ text: selectedNativeOption.label }], }, ]; } - if (value === null || value === undefined || value === '') return [ { @@ -117,13 +67,11 @@ export const deserialize = ( children: [{ text: '' }], }, ]; - return value .toString() .split('\n') .map((line) => { const nodes = line.split(variableRegExp); - if (nodes.length > 1) { return { type: 'paragraph', @@ -133,7 +81,6 @@ export const deserialize = ( node, stepsWithVariables ); - return { type: 'variable', name: variableDetails.label, @@ -142,26 +89,21 @@ export const deserialize = ( children: [{ text: '' }], }; } - return { text: node, }; }), }; } - return { type: 'paragraph', children: [{ text: line }], }; }); }; - -export const serialize = (value: Descendant[]): string | number | null => { +export const serialize = (value) => { const serializedNodes = value.map((node) => serializeNode(node)); - const hasSingleNode = value.length === 1; - /** * return single serialize node alone so that we don't stringify. * booleans stay booleans, numbers stay number @@ -169,28 +111,20 @@ export const serialize = (value: Descendant[]): string | number | null => { if (hasSingleNode) { return serializedNodes[0]; } - const serializedValue = serializedNodes.join('\n'); return serializedValue; }; - -const serializeNode = ( - node: CustomElement | Descendant -): string | number | null => { +const serializeNode = (node) => { if (isCustomText(node)) { return node.value; } - if (Text.isText(node)) { return node.text; } - if (node.type === 'variable') { - return node.value as string; + return node.value; } - const hasSingleChild = node.children.length === 1; - /** * serialize alone so that we don't stringify. * booleans stay booleans, numbers stay number @@ -198,89 +132,62 @@ const serializeNode = ( if (hasSingleChild) { return serializeNode(node.children[0]); } - return node.children.map((n) => serializeNode(n)).join(''); }; - -export const withVariables = (editor: CustomEditor) => { +export const withVariables = (editor) => { const { isInline, isVoid } = editor; - - editor.isInline = (element: CustomElement) => { + editor.isInline = (element) => { return element.type === 'variable' ? true : isInline(element); }; - - editor.isVoid = (element: CustomElement) => { + editor.isVoid = (element) => { return element.type === 'variable' ? true : isVoid(element); }; - return editor; }; - -export const insertVariable = ( - editor: CustomEditor, - variableData: Record, - stepsWithVariables: StepsWithVariables -) => { +export const insertVariable = (editor, variableData, stepsWithVariables) => { const variableDetails = getVariableDetails( `{{${variableData.value}}}`, stepsWithVariables ); - - const variable: VariableElement = { + const variable = { type: 'variable', name: variableDetails.label, sampleValue: variableDetails.sampleValue, value: `{{${variableData.value}}}`, children: [{ text: '' }], }; - editor.insertNodes(variable, { select: false }); - focusEditor(editor); }; - -export const focusEditor = (editor: CustomEditor) => { +export const focusEditor = (editor) => { ReactEditor.focus(editor); editor.move(); }; - -export const resetEditor = ( - editor: CustomEditor, - options?: { focus: boolean } -) => { +export const resetEditor = (editor, options) => { const focus = options?.focus || false; - editor.removeNodes({ at: { anchor: editor.start([]), focus: editor.end([]), }, }); - // `editor.normalize({ force: true })` doesn't add an empty node in the editor editor.insertNode(createTextNode('')); - if (focus) { focusEditor(editor); } }; - -export const overrideEditorValue = ( - editor: CustomEditor, - options: { option: IFieldDropdownOption; focus: boolean } -) => { +export const overrideEditorValue = (editor, options) => { const { option, focus } = options; - - const variable: ParagraphElement = { + const variable = { type: 'paragraph', children: [ { - value: option.value as string, - text: option.label as string, + value: option.value, + text: option.label, }, ], }; - editor.withoutNormalizing(() => { editor.removeNodes({ at: { @@ -288,16 +195,13 @@ export const overrideEditorValue = ( focus: editor.end([]), }, }); - editor.insertNode(variable); - if (focus) { focusEditor(editor); } }); }; - -export const createTextNode = (text: string): ParagraphElement => ({ +export const createTextNode = (text) => ({ type: 'paragraph', children: [ { @@ -305,7 +209,6 @@ export const createTextNode = (text: string): ParagraphElement => ({ }, ], }); - -export const customizeEditor = (editor: CustomEditor): CustomEditor => { +export const customizeEditor = (editor) => { return withVariables(withReact(withHistory(editor))); }; diff --git a/packages/web/src/components/SnackbarProvider/index.tsx b/packages/web/src/components/SnackbarProvider/index.jsx similarity index 56% rename from packages/web/src/components/SnackbarProvider/index.tsx rename to packages/web/src/components/SnackbarProvider/index.jsx index 19fcd70d..ee2a1007 100644 --- a/packages/web/src/components/SnackbarProvider/index.tsx +++ b/packages/web/src/components/SnackbarProvider/index.jsx @@ -1,10 +1,6 @@ import * as React from 'react'; -import { - SnackbarProvider as BaseSnackbarProvider, - SnackbarProviderProps, -} from 'notistack'; - -const SnackbarProvider = (props: SnackbarProviderProps): React.ReactElement => { +import { SnackbarProvider as BaseSnackbarProvider } from 'notistack'; +const SnackbarProvider = (props) => { return ( { /> ); }; - export default SnackbarProvider; diff --git a/packages/web/src/components/SplitButton/index.tsx b/packages/web/src/components/SplitButton/index.jsx similarity index 85% rename from packages/web/src/components/SplitButton/index.tsx rename to packages/web/src/components/SplitButton/index.jsx index 4ce8d806..7fa11a28 100644 --- a/packages/web/src/components/SplitButton/index.tsx +++ b/packages/web/src/components/SplitButton/index.jsx @@ -9,41 +9,21 @@ import Paper from '@mui/material/Paper'; import Popper from '@mui/material/Popper'; import * as React from 'react'; import { Link } from 'react-router-dom'; - -type SplitButtonProps = { - options: { - key: string; - 'data-test'?: string; - label: React.ReactNode; - to: string; - }[]; - disabled?: boolean; - defaultActionIndex?: number; -}; - -export default function SplitButton(props: SplitButtonProps) { +export default function SplitButton(props) { const { options, disabled, defaultActionIndex = 0 } = props; const [open, setOpen] = React.useState(false); - const anchorRef = React.useRef(null); - + const anchorRef = React.useRef(null); const multiOptions = options.length > 1; const selectedOption = options[defaultActionIndex]; - const handleToggle = () => { setOpen((prevOpen) => !prevOpen); }; - - const handleClose = (event: Event) => { - if ( - anchorRef.current && - anchorRef.current.contains(event.target as HTMLElement) - ) { + const handleClose = (event) => { + if (anchorRef.current && anchorRef.current.contains(event.target)) { return; } - setOpen(false); }; - return ( {formatMessage('loginPage.divider')} @@ -36,5 +32,4 @@ function SsoProviders() { ); } - export default SsoProviders; diff --git a/packages/web/src/components/SubscriptionCancelledAlert/index.ee.tsx b/packages/web/src/components/SubscriptionCancelledAlert/index.ee.jsx similarity index 99% rename from packages/web/src/components/SubscriptionCancelledAlert/index.ee.tsx rename to packages/web/src/components/SubscriptionCancelledAlert/index.ee.jsx index e65da282..0a6d304f 100644 --- a/packages/web/src/components/SubscriptionCancelledAlert/index.ee.tsx +++ b/packages/web/src/components/SubscriptionCancelledAlert/index.ee.jsx @@ -1,14 +1,10 @@ import * as React from 'react'; import Alert from '@mui/material/Alert'; import Typography from '@mui/material/Typography'; - import useSubscriptionStatus from 'hooks/useSubscriptionStatus.ee'; - export default function SubscriptionCancelledAlert() { const subscriptionStatus = useSubscriptionStatus(); - if (!subscriptionStatus) return ; - return ( ; -} & MuiSwitchProps; - -export default function Switch(props: SwitchProps): React.ReactElement { +import FormControlLabel from '@mui/material/FormControlLabel'; +import MuiSwitch from '@mui/material/Switch'; +export default function Switch(props) { const { control } = useFormContext(); - const inputRef = React.useRef(null); + const inputRef = React.useRef(null); const { required, name, @@ -28,7 +18,6 @@ export default function Switch(props: SwitchProps): React.ReactElement { className, ...switchProps } = props; - return ( @@ -164,5 +140,4 @@ function TestSubstep(props: TestSubstepProps): React.ReactElement { ); } - export default TestSubstep; diff --git a/packages/web/src/components/TextField/index.tsx b/packages/web/src/components/TextField/index.jsx similarity index 74% rename from packages/web/src/components/TextField/index.tsx rename to packages/web/src/components/TextField/index.jsx index cc17dd8f..cd62889a 100644 --- a/packages/web/src/components/TextField/index.tsx +++ b/packages/web/src/components/TextField/index.jsx @@ -1,40 +1,22 @@ import * as React from 'react'; import { Controller, useFormContext } from 'react-hook-form'; -import MuiTextField, { - TextFieldProps as MuiTextFieldProps, -} from '@mui/material/TextField'; +import MuiTextField from '@mui/material/TextField'; import IconButton from '@mui/material/IconButton'; import InputAdornment from '@mui/material/InputAdornment'; import ContentCopyIcon from '@mui/icons-material/ContentCopy'; - import copyInputValue from 'helpers/copyInputValue'; - -type TextFieldProps = { - shouldUnregister?: boolean; - name: string; - clickToCopy?: boolean; - readOnly?: boolean; - 'data-test'?: string; -} & MuiTextFieldProps; - -const createCopyAdornment = ( - ref: React.RefObject -): React.ReactElement => { +const createCopyAdornment = (ref) => { return ( - copyInputValue(ref.current as HTMLInputElement)} - edge="end" - > + copyInputValue(ref.current)} edge="end"> ); }; - -export default function TextField(props: TextFieldProps): React.ReactElement { +export default function TextField(props) { const { control } = useFormContext(); - const inputRef = React.useRef(null); + const inputRef = React.useRef(null); const { required, name, @@ -48,7 +30,6 @@ export default function TextField(props: TextFieldProps): React.ReactElement { 'data-test': dataTest, ...textFieldProps } = props; - return ( { +const customizeTheme = (theme, config) => { // `clone` is needed so that the new theme reference triggers re-render const shallowDefaultTheme = clone(theme); - for (const key in config) { const value = config[key]; const exists = get(theme, key); - if (exists) { set(shallowDefaultTheme, key, value); } } - return shallowDefaultTheme; }; - -const ThemeProvider = ({ - children, - ...props -}: ThemeProviderProps): React.ReactElement => { +const ThemeProvider = ({ children, ...props }) => { const { isMation, loading: automatischInfoLoading } = useAutomatischInfo(); const { config, loading: configLoading } = useConfig(); - const customTheme = React.useMemo(() => { const installationTheme = isMation ? mationTheme : defaultTheme; - if (configLoading || automatischInfoLoading) return installationTheme; - const customTheme = customizeTheme(installationTheme, config || {}); - return customTheme; }, [configLoading, config, isMation, automatischInfoLoading]); - // TODO: maybe a global loading state for the custom theme? if (automatischInfoLoading || configLoading) return <>; - return ( @@ -58,5 +38,4 @@ const ThemeProvider = ({ ); }; - export default ThemeProvider; diff --git a/packages/web/src/components/TrialOverAlert/index.ee.tsx b/packages/web/src/components/TrialOverAlert/index.ee.jsx similarity index 99% rename from packages/web/src/components/TrialOverAlert/index.ee.tsx rename to packages/web/src/components/TrialOverAlert/index.ee.jsx index 4e1ffa91..8095a2ae 100644 --- a/packages/web/src/components/TrialOverAlert/index.ee.tsx +++ b/packages/web/src/components/TrialOverAlert/index.ee.jsx @@ -1,19 +1,14 @@ import * as React from 'react'; import Alert from '@mui/material/Alert'; import Typography from '@mui/material/Typography'; - import * as URLS from 'config/urls'; import { generateInternalLink } from 'helpers/translationValues'; import useTrialStatus from 'hooks/useTrialStatus.ee'; import useFormatMessage from 'hooks/useFormatMessage'; - - export default function TrialOverAlert() { const formatMessage = useFormatMessage(); const trialStatus = useTrialStatus(); - if (!trialStatus || !trialStatus.over) return ; - return ( {formatMessage('trialOverAlert.text', { - link: generateInternalLink(URLS.SETTINGS_PLAN_UPGRADE) + link: generateInternalLink(URLS.SETTINGS_PLAN_UPGRADE), })} diff --git a/packages/web/src/components/TrialStatusBadge/index.ee.tsx b/packages/web/src/components/TrialStatusBadge/index.ee.jsx similarity index 86% rename from packages/web/src/components/TrialStatusBadge/index.ee.tsx rename to packages/web/src/components/TrialStatusBadge/index.ee.jsx index 8632be77..45274c2b 100644 --- a/packages/web/src/components/TrialStatusBadge/index.ee.tsx +++ b/packages/web/src/components/TrialStatusBadge/index.ee.jsx @@ -1,17 +1,12 @@ import * as React from 'react'; import { Link } from 'react-router-dom'; import { Chip } from './style.ee'; - import * as URLS from 'config/urls'; import useTrialStatus from 'hooks/useTrialStatus.ee'; - -export default function TrialStatusBadge(): React.ReactElement { +export default function TrialStatusBadge() { const data = useTrialStatus(); - if (!data) return ; - const { message, status } = data; - return ( setSelectedIndex(index); - + const updateSelection = (index) => setSelectedIndex(index); const handleCheckout = React.useCallback(() => { window.Paddle.Checkout?.open({ product: selectedPlan.productId, email: currentUser.email, - passthrough: JSON.stringify({ id: currentUser.id, email: currentUser.email }) - }) + passthrough: JSON.stringify({ + id: currentUser.id, + email: currentUser.email, + }), + }); }, [selectedPlan, currentUser]); - if (loading || !plans.length) return null; - return ( @@ -91,15 +88,20 @@ export default function UpgradeFreeTrial() { onClick={() => updateSelection(index)} sx={{ '&:hover': { cursor: 'pointer' }, - backgroundColor: selectedIndex === index ? '#f1f3fa' : 'white', - border: selectedIndex === index ? '2px solid #0059f7' : 'none', + backgroundColor: + selectedIndex === index ? '#f1f3fa' : 'white', + border: + selectedIndex === index + ? '2px solid #0059f7' + : 'none', }} > {plan.limit} @@ -109,7 +111,8 @@ export default function UpgradeFreeTrial() { {plan.price} / month diff --git a/packages/web/src/components/UsageDataInformation/index.ee.tsx b/packages/web/src/components/UsageDataInformation/index.ee.jsx similarity index 94% rename from packages/web/src/components/UsageDataInformation/index.ee.tsx rename to packages/web/src/components/UsageDataInformation/index.ee.jsx index 643d68e8..bbc5995f 100644 --- a/packages/web/src/components/UsageDataInformation/index.ee.tsx +++ b/packages/web/src/components/UsageDataInformation/index.ee.jsx @@ -10,27 +10,15 @@ import CardContent from '@mui/material/CardContent'; import Divider from '@mui/material/Divider'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; - -import { TBillingCardAction } from 'types'; import TrialOverAlert from 'components/TrialOverAlert/index.ee'; import SubscriptionCancelledAlert from 'components/SubscriptionCancelledAlert/index.ee'; import CheckoutCompletedAlert from 'components/CheckoutCompletedAlert/index.ee'; import * as URLS from 'config/urls'; import useBillingAndUsageData from 'hooks/useBillingAndUsageData.ee'; import useFormatMessage from 'hooks/useFormatMessage'; - -const capitalize = (str: string) => - str[0].toUpperCase() + str.slice(1, str.length); - -type BillingCardProps = { - name: string; - title?: string; - action?: TBillingCardAction; -}; - -function BillingCard(props: BillingCardProps) { +const capitalize = (str) => str[0].toUpperCase() + str.slice(1, str.length); +function BillingCard(props) { const { name, title = '', action } = props; - return ( ); } - -function Action(props: { action?: TBillingCardAction }) { +function Action(props) { const { action } = props; if (!action) return ; - const { text, type } = action; - if (type === 'link') { if (action.src.startsWith('http')) { return ( @@ -79,7 +64,6 @@ function Action(props: { action?: TBillingCardAction }) { ); } } - if (type === 'text') { return ( @@ -87,14 +71,11 @@ function Action(props: { action?: TBillingCardAction }) { ); } - return ; } - export default function UsageDataInformation() { const formatMessage = useFormatMessage(); const billingAndUsageData = useBillingAndUsageData(); - return ( diff --git a/packages/web/src/components/UserList/TablePaginationActions/index.tsx b/packages/web/src/components/UserList/TablePaginationActions/index.jsx similarity index 74% rename from packages/web/src/components/UserList/TablePaginationActions/index.tsx rename to packages/web/src/components/UserList/TablePaginationActions/index.jsx index ed9ddf95..c611d005 100644 --- a/packages/web/src/components/UserList/TablePaginationActions/index.tsx +++ b/packages/web/src/components/UserList/TablePaginationActions/index.jsx @@ -5,47 +5,21 @@ import KeyboardArrowLeft from '@mui/icons-material/KeyboardArrowLeft'; import KeyboardArrowRight from '@mui/icons-material/KeyboardArrowRight'; import LastPageIcon from '@mui/icons-material/LastPage'; import Box from '@mui/material/Box'; - -interface TablePaginationActionsProps { - count: number; - page: number; - rowsPerPage: number; - onPageChange: ( - event: React.MouseEvent, - newPage: number - ) => void; -} - -export default function TablePaginationActions( - props: TablePaginationActionsProps -) { +export default function TablePaginationActions(props) { const theme = useTheme(); const { count, page, rowsPerPage, onPageChange } = props; - - const handleFirstPageButtonClick = ( - event: React.MouseEvent - ) => { + const handleFirstPageButtonClick = (event) => { onPageChange(event, 0); }; - - const handleBackButtonClick = ( - event: React.MouseEvent - ) => { + const handleBackButtonClick = (event) => { onPageChange(event, page - 1); }; - - const handleNextButtonClick = ( - event: React.MouseEvent - ) => { + const handleNextButtonClick = (event) => { onPageChange(event, page + 1); }; - - const handleLastPageButtonClick = ( - event: React.MouseEvent - ) => { + const handleLastPageButtonClick = (event) => { onPageChange(event, Math.max(0, Math.ceil(count / rowsPerPage) - 1)); }; - return ( | null, - newPage: number - ) => { + const { users, pageInfo, totalCount, loading } = useUsers(page, rowsPerPage); + const handleChangePage = (event, newPage) => { setPage(newPage); }; - - const handleChangeRowsPerPage = ( - event: React.ChangeEvent - ) => { + const handleChangeRowsPerPage = (event) => { setRowsPerPage(+event.target.value); setPage(0); }; - return ( <> @@ -83,10 +68,13 @@ export default function UserList(): React.ReactElement { - {loading && } + {loading && ( + + )} {!loading && users.map((user) => ( - {user.fullName} + + {user.fullName} + - {user.email} + + {user.email} + - + {user.role.name} @@ -128,7 +113,8 @@ export default function UserList(): React.ReactElement { + userId={user.id} + /> diff --git a/packages/web/src/components/UserList/style.ts b/packages/web/src/components/UserList/style.js similarity index 99% rename from packages/web/src/components/UserList/style.ts rename to packages/web/src/components/UserList/style.js index aa02dabf..d0852182 100644 --- a/packages/web/src/components/UserList/style.ts +++ b/packages/web/src/components/UserList/style.js @@ -2,7 +2,6 @@ import { styled } from '@mui/material/styles'; import MuiTablePagination, { tablePaginationClasses, } from '@mui/material/TablePagination'; - export const TablePagination = styled(MuiTablePagination)(() => ({ [`& .${tablePaginationClasses.selectLabel}, & .${tablePaginationClasses.displayedRows}`]: { diff --git a/packages/web/src/components/WebhookUrlInfo/index.tsx b/packages/web/src/components/WebhookUrlInfo/index.jsx similarity index 84% rename from packages/web/src/components/WebhookUrlInfo/index.tsx rename to packages/web/src/components/WebhookUrlInfo/index.jsx index f510a75c..6cb98b5d 100644 --- a/packages/web/src/components/WebhookUrlInfo/index.tsx +++ b/packages/web/src/components/WebhookUrlInfo/index.jsx @@ -1,20 +1,12 @@ import * as React from 'react'; import { FormattedMessage } from 'react-intl'; import Typography from '@mui/material/Typography'; -import type { AlertProps } from '@mui/material/Alert'; - import { generateExternalLink } from '../../helpers/translationValues'; import { WEBHOOK_DOCS } from '../../config/urls'; import TextField from '../TextField'; import { Alert } from './style'; - -type WebhookUrlInfoProps = { - webhookUrl: string; -} & AlertProps; - -function WebhookUrlInfo(props: WebhookUrlInfoProps): React.ReactElement { +function WebhookUrlInfo(props) { const { webhookUrl, ...alertProps } = props; - return ( @@ -41,5 +33,4 @@ function WebhookUrlInfo(props: WebhookUrlInfoProps): React.ReactElement { ); } - export default WebhookUrlInfo; diff --git a/packages/web/src/components/WebhookUrlInfo/style.ts b/packages/web/src/components/WebhookUrlInfo/style.js similarity index 84% rename from packages/web/src/components/WebhookUrlInfo/style.ts rename to packages/web/src/components/WebhookUrlInfo/style.js index 1396d12b..62466281 100644 --- a/packages/web/src/components/WebhookUrlInfo/style.ts +++ b/packages/web/src/components/WebhookUrlInfo/style.js @@ -1,14 +1,13 @@ import { styled } from '@mui/material/styles'; import MuiAlert, { alertClasses } from '@mui/material/Alert'; - export const Alert = styled(MuiAlert)(() => ({ [`&.${alertClasses.root}`]: { fontWeight: 300, width: '100%', display: 'flex', - flexDirection: 'column' + flexDirection: 'column', }, [`& .${alertClasses.message}`]: { - width: '100%' - } + width: '100%', + }, })); diff --git a/packages/web/src/config/app.js b/packages/web/src/config/app.js new file mode 100644 index 00000000..f3a7ed7c --- /dev/null +++ b/packages/web/src/config/app.js @@ -0,0 +1,7 @@ +const config = { + baseUrl: process.env.REACT_APP_BASE_URL, + graphqlUrl: process.env.REACT_APP_GRAPHQL_URL, + chatwootBaseUrl: 'https://app.chatwoot.com', + supportEmailAddress: 'support@automatisch.io', +}; +export default config; diff --git a/packages/web/src/config/app.ts b/packages/web/src/config/app.ts deleted file mode 100644 index ed6e016c..00000000 --- a/packages/web/src/config/app.ts +++ /dev/null @@ -1,16 +0,0 @@ -type Config = { - [key: string]: string; - baseUrl: string; - graphqlUrl: string; - chatwootBaseUrl: string; - supportEmailAddress: string; -}; - -const config: Config = { - baseUrl: process.env.REACT_APP_BASE_URL as string, - graphqlUrl: process.env.REACT_APP_GRAPHQL_URL as string, - chatwootBaseUrl: 'https://app.chatwoot.com', - supportEmailAddress: 'support@automatisch.io', -}; - -export default config; diff --git a/packages/web/src/config/urls.ts b/packages/web/src/config/urls.js similarity index 69% rename from packages/web/src/config/urls.ts rename to packages/web/src/config/urls.js index 5d6affd5..5012deaf 100644 --- a/packages/web/src/config/urls.ts +++ b/packages/web/src/config/urls.js @@ -1,78 +1,62 @@ export const CONNECTIONS = '/connections'; export const EXECUTIONS = '/executions'; export const EXECUTION_PATTERN = '/executions/:executionId'; -export const EXECUTION = (executionId: string) => `/executions/${executionId}`; - +export const EXECUTION = (executionId) => `/executions/${executionId}`; export const LOGIN = '/login'; export const LOGIN_CALLBACK = `${LOGIN}/callback`; export const SIGNUP = '/sign-up'; export const FORGOT_PASSWORD = '/forgot-password'; export const RESET_PASSWORD = '/reset-password'; - export const APPS = '/apps'; export const NEW_APP_CONNECTION = '/apps/new'; -export const APP = (appKey: string) => `/app/${appKey}`; +export const APP = (appKey) => `/app/${appKey}`; export const APP_PATTERN = '/app/:appKey'; -export const APP_CONNECTIONS = (appKey: string) => `/app/${appKey}/connections`; +export const APP_CONNECTIONS = (appKey) => `/app/${appKey}/connections`; export const APP_CONNECTIONS_PATTERN = '/app/:appKey/connections'; -export const APP_ADD_CONNECTION = (appKey: string, shared = false) => +export const APP_ADD_CONNECTION = (appKey, shared = false) => `/app/${appKey}/connections/add?shared=${shared}`; export const APP_ADD_CONNECTION_WITH_AUTH_CLIENT_ID = ( - appKey: string, - appAuthClientId: string + appKey, + appAuthClientId ) => `/app/${appKey}/connections/add?appAuthClientId=${appAuthClientId}`; export const APP_ADD_CONNECTION_PATTERN = '/app/:appKey/connections/add'; export const APP_RECONNECT_CONNECTION = ( - appKey: string, - connectionId: string, - appAuthClientId?: string + appKey, + connectionId, + appAuthClientId ) => { const path = `/app/${appKey}/connections/${connectionId}/reconnect`; - if (appAuthClientId) { return `${path}?appAuthClientId=${appAuthClientId}`; } - return path; }; export const APP_RECONNECT_CONNECTION_PATTERN = '/app/:appKey/connections/:connectionId/reconnect'; -export const APP_FLOWS = (appKey: string) => `/app/${appKey}/flows`; -export const APP_FLOWS_FOR_CONNECTION = ( - appKey: string, - connectionId: string -) => `/app/${appKey}/flows?connectionId=${connectionId}`; +export const APP_FLOWS = (appKey) => `/app/${appKey}/flows`; +export const APP_FLOWS_FOR_CONNECTION = (appKey, connectionId) => + `/app/${appKey}/flows?connectionId=${connectionId}`; export const APP_FLOWS_PATTERN = '/app/:appKey/flows'; - export const EDITOR = '/editor'; export const CREATE_FLOW = '/editor/create'; -export const CREATE_FLOW_WITH_APP = (appKey: string) => +export const CREATE_FLOW_WITH_APP = (appKey) => `/editor/create?appKey=${appKey}`; -export const CREATE_FLOW_WITH_APP_AND_CONNECTION = ( - appKey?: string, - connectionId?: string -) => { - const params: { appKey?: string; connectionId?: string } = {}; - +export const CREATE_FLOW_WITH_APP_AND_CONNECTION = (appKey, connectionId) => { + const params = {}; if (appKey) { params.appKey = appKey; } - if (connectionId) { params.connectionId = connectionId; } - const searchParams = new URLSearchParams(params).toString(); - return `/editor/create?${searchParams}`; }; -export const FLOW_EDITOR = (flowId: string) => `/editor/${flowId}`; - +export const FLOW_EDITOR = (flowId) => `/editor/${flowId}`; export const FLOWS = '/flows'; // TODO: revert this back to /flows/:flowId once we have a proper single flow page -export const FLOW = (flowId: string) => `/editor/${flowId}`; +export const FLOW = (flowId) => `/editor/${flowId}`; export const FLOW_PATTERN = '/flows/:flowId'; - export const SETTINGS = '/settings'; export const SETTINGS_DASHBOARD = SETTINGS; export const PROFILE = 'profile'; @@ -82,38 +66,35 @@ export const UPDATES = '/updates'; export const SETTINGS_PROFILE = `${SETTINGS}/${PROFILE}`; export const SETTINGS_BILLING_AND_USAGE = `${SETTINGS}/${BILLING_AND_USAGE}`; export const SETTINGS_PLAN_UPGRADE = `${SETTINGS_BILLING_AND_USAGE}/${PLAN_UPGRADE}`; - export const ADMIN_SETTINGS = '/admin-settings'; export const ADMIN_SETTINGS_DASHBOARD = ADMIN_SETTINGS; export const USERS = `${ADMIN_SETTINGS}/users`; -export const USER = (userId: string) => `${USERS}/${userId}`; +export const USER = (userId) => `${USERS}/${userId}`; export const USER_PATTERN = `${USERS}/:userId`; export const CREATE_USER = `${USERS}/create`; export const ROLES = `${ADMIN_SETTINGS}/roles`; -export const ROLE = (roleId: string) => `${ROLES}/${roleId}`; +export const ROLE = (roleId) => `${ROLES}/${roleId}`; export const ROLE_PATTERN = `${ROLES}/:roleId`; export const CREATE_ROLE = `${ROLES}/create`; export const USER_INTERFACE = `${ADMIN_SETTINGS}/user-interface`; export const AUTHENTICATION = `${ADMIN_SETTINGS}/authentication`; export const ADMIN_APPS = `${ADMIN_SETTINGS}/apps`; -export const ADMIN_APP = (appKey: string) => `${ADMIN_SETTINGS}/apps/${appKey}`; +export const ADMIN_APP = (appKey) => `${ADMIN_SETTINGS}/apps/${appKey}`; export const ADMIN_APP_PATTERN = `${ADMIN_SETTINGS}/apps/:appKey`; export const ADMIN_APP_SETTINGS_PATTERN = `${ADMIN_SETTINGS}/apps/:appKey/settings`; export const ADMIN_APP_AUTH_CLIENTS_PATTERN = `${ADMIN_SETTINGS}/apps/:appKey/auth-clients`; export const ADMIN_APP_CONNECTIONS_PATTERN = `${ADMIN_SETTINGS}/apps/:appKey/connections`; -export const ADMIN_APP_CONNECTIONS = (appKey: string) => +export const ADMIN_APP_CONNECTIONS = (appKey) => `${ADMIN_SETTINGS}/apps/${appKey}/connections`; -export const ADMIN_APP_SETTINGS = (appKey: string) => +export const ADMIN_APP_SETTINGS = (appKey) => `${ADMIN_SETTINGS}/apps/${appKey}/settings`; -export const ADMIN_APP_AUTH_CLIENTS = (appKey: string) => +export const ADMIN_APP_AUTH_CLIENTS = (appKey) => `${ADMIN_SETTINGS}/apps/${appKey}/auth-clients`; -export const ADMIN_APP_AUTH_CLIENT = (appKey: string, id: string) => +export const ADMIN_APP_AUTH_CLIENT = (appKey, id) => `${ADMIN_SETTINGS}/apps/${appKey}/auth-clients/${id}`; -export const ADMIN_APP_AUTH_CLIENTS_CREATE = (appKey: string) => +export const ADMIN_APP_AUTH_CLIENTS_CREATE = (appKey) => `${ADMIN_SETTINGS}/apps/${appKey}/auth-clients/create`; - export const DASHBOARD = FLOWS; - // External links export const WEBHOOK_DOCS = 'https://automatisch.io/docs/apps/webhooks/connection'; diff --git a/packages/web/src/contexts/Authentication.jsx b/packages/web/src/contexts/Authentication.jsx new file mode 100644 index 00000000..60e49fa6 --- /dev/null +++ b/packages/web/src/contexts/Authentication.jsx @@ -0,0 +1,24 @@ +import * as React from 'react'; +import { getItem, setItem } from 'helpers/storage'; +export const AuthenticationContext = React.createContext({ + token: null, + updateToken: () => void 0, +}); +export const AuthenticationProvider = (props) => { + const { children } = props; + const [token, setToken] = React.useState(() => getItem('token')); + const value = React.useMemo(() => { + return { + token, + updateToken: (newToken) => { + setToken(newToken); + setItem('token', newToken); + }, + }; + }, [token]); + return ( + + {children} + + ); +}; diff --git a/packages/web/src/contexts/Authentication.tsx b/packages/web/src/contexts/Authentication.tsx deleted file mode 100644 index 93f401aa..00000000 --- a/packages/web/src/contexts/Authentication.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import * as React from 'react'; -import { getItem, setItem } from 'helpers/storage'; - -export type AuthenticationContextParams = { - token: string | null; - updateToken: (token: string) => void; -}; - -export const AuthenticationContext = - React.createContext({ - token: null, - updateToken: () => void 0, - }); - -type AuthenticationProviderProps = { - children: React.ReactNode; -}; - -export const AuthenticationProvider = ( - props: AuthenticationProviderProps -): React.ReactElement => { - const { children } = props; - const [token, setToken] = React.useState(() => getItem('token')); - - const value = React.useMemo(() => { - return { - token, - updateToken: (newToken: string) => { - setToken(newToken); - setItem('token', newToken); - }, - }; - }, [token]); - - return ( - - {children} - - ); -}; diff --git a/packages/web/src/contexts/AutomatischInfo.tsx b/packages/web/src/contexts/AutomatischInfo.jsx similarity index 57% rename from packages/web/src/contexts/AutomatischInfo.tsx rename to packages/web/src/contexts/AutomatischInfo.jsx index 7269bdf3..591e802e 100644 --- a/packages/web/src/contexts/AutomatischInfo.tsx +++ b/packages/web/src/contexts/AutomatischInfo.jsx @@ -1,34 +1,16 @@ import * as React from 'react'; import { useQuery } from '@apollo/client'; - import { GET_AUTOMATISCH_INFO } from 'graphql/queries/get-automatisch-info'; - -export type AutomatischInfoContextParams = { - isCloud: boolean; - isMation: boolean; - loading: boolean; -}; - -export const AutomatischInfoContext = - React.createContext({ - isCloud: false, - isMation: false, - loading: true, - }); - -type AutomatischInfoProviderProps = { - children: React.ReactNode; -}; - -export const AutomatischInfoProvider = ( - props: AutomatischInfoProviderProps -): React.ReactElement => { +export const AutomatischInfoContext = React.createContext({ + isCloud: false, + isMation: false, + loading: true, +}); +export const AutomatischInfoProvider = (props) => { const { children } = props; const { data, loading } = useQuery(GET_AUTOMATISCH_INFO); - const isCloud = data?.getAutomatischInfo?.isCloud; const isMation = data?.getAutomatischInfo?.isMation; - const value = React.useMemo(() => { return { isCloud, @@ -36,7 +18,6 @@ export const AutomatischInfoProvider = ( loading, }; }, [isCloud, isMation, loading]); - return ( {children} diff --git a/packages/web/src/contexts/Editor.jsx b/packages/web/src/contexts/Editor.jsx new file mode 100644 index 00000000..edc600cb --- /dev/null +++ b/packages/web/src/contexts/Editor.jsx @@ -0,0 +1,10 @@ +import * as React from 'react'; +export const EditorContext = React.createContext({ + readOnly: false, +}); +export const EditorProvider = (props) => { + const { children, value } = props; + return ( + {children} + ); +}; diff --git a/packages/web/src/contexts/Editor.tsx b/packages/web/src/contexts/Editor.tsx deleted file mode 100644 index ac551d27..00000000 --- a/packages/web/src/contexts/Editor.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import * as React from 'react'; - -interface IEditorContext { - readOnly: boolean; -} - -export const EditorContext = React.createContext({ - readOnly: false, -}); - -type EditorProviderProps = { - children: React.ReactNode; - value: IEditorContext; -}; - -export const EditorProvider = ( - props: EditorProviderProps -): React.ReactElement => { - const { children, value } = props; - return ( - {children} - ); -}; diff --git a/packages/web/src/contexts/Paddle.ee.jsx b/packages/web/src/contexts/Paddle.ee.jsx new file mode 100644 index 00000000..68e4a954 --- /dev/null +++ b/packages/web/src/contexts/Paddle.ee.jsx @@ -0,0 +1,79 @@ +import * as React from 'react'; +import { useNavigate } from 'react-router-dom'; +import * as URLS from 'config/urls'; +import useCloud from 'hooks/useCloud'; +import usePaddleInfo from 'hooks/usePaddleInfo.ee'; +import apolloClient from 'graphql/client'; +export const PaddleContext = React.createContext({ + loaded: false, +}); +export const PaddleProvider = (props) => { + const { children } = props; + const isCloud = useCloud(); + const navigate = useNavigate(); + const { sandbox, vendorId } = usePaddleInfo(); + const [loaded, setLoaded] = React.useState(false); + const paddleEventHandler = React.useCallback( + async (payload) => { + const { event, eventData } = payload; + if (event === 'Checkout.Close') { + const completed = eventData.checkout?.completed; + if (completed) { + // Paddle has side effects in the background, + // so we need to refetch the relevant queries + await apolloClient.refetchQueries({ + include: ['GetTrialStatus', 'GetBillingAndUsage'], + }); + navigate(URLS.SETTINGS_BILLING_AND_USAGE, { + state: { checkoutCompleted: true }, + }); + } + } + }, + [navigate], + ); + const value = React.useMemo(() => { + return { + loaded, + }; + }, [loaded]); + React.useEffect( + function loadPaddleScript() { + if (!isCloud) return; + const isInjected = document.getElementById('paddle-js'); + if (isInjected) { + setLoaded(true); + return; + } + const g = document.createElement('script'); + const s = document.getElementsByTagName('script')[0]; + g.src = 'https://cdn.paddle.com/paddle/paddle.js'; + g.defer = true; + g.async = true; + g.id = 'paddle-js'; + if (s.parentNode) { + s.parentNode.insertBefore(g, s); + } + g.onload = function () { + setLoaded(true); + }; + }, + [isCloud], + ); + React.useEffect( + function initPaddleScript() { + if (!loaded || !vendorId) return; + if (sandbox) { + window.Paddle.Environment.set('sandbox'); + } + window.Paddle.Setup({ + vendor: vendorId, + eventCallback: paddleEventHandler, + }); + }, + [loaded, sandbox, vendorId, paddleEventHandler], + ); + return ( + {children} + ); +}; diff --git a/packages/web/src/contexts/Paddle.ee.tsx b/packages/web/src/contexts/Paddle.ee.tsx deleted file mode 100644 index 32deb155..00000000 --- a/packages/web/src/contexts/Paddle.ee.tsx +++ /dev/null @@ -1,109 +0,0 @@ -import * as React from 'react'; -import { useNavigate } from 'react-router-dom'; - -import * as URLS from 'config/urls'; -import useCloud from 'hooks/useCloud'; -import usePaddleInfo from 'hooks/usePaddleInfo.ee'; -import apolloClient from 'graphql/client'; - -declare global { - interface Window { - Paddle: any; - } -} - -export type PaddleContextParams = { - loaded: boolean; -}; - -export const PaddleContext = - React.createContext({ - loaded: false, - }); - -type PaddleProviderProps = { - children: React.ReactNode; -}; - -export const PaddleProvider = ( - props: PaddleProviderProps -): React.ReactElement => { - const { children } = props; - const isCloud = useCloud(); - const navigate = useNavigate(); - const { sandbox, vendorId } = usePaddleInfo(); - const [loaded, setLoaded] = React.useState(false); - - const paddleEventHandler = React.useCallback(async (payload) => { - const { event, eventData } = payload; - if (event === 'Checkout.Close') { - const completed = eventData.checkout?.completed; - - if (completed) { - // Paddle has side effects in the background, - // so we need to refetch the relevant queries - await apolloClient.refetchQueries({ - include: ['GetTrialStatus', 'GetBillingAndUsage'], - }); - - navigate( - URLS.SETTINGS_BILLING_AND_USAGE, - { - state: { checkoutCompleted: true } - } - ); - } - } - }, [navigate]); - - const value = React.useMemo(() => { - return { - loaded, - }; - }, [loaded]); - - React.useEffect(function loadPaddleScript() { - if (!isCloud) return; - - const isInjected = document.getElementById('paddle-js'); - - if (isInjected) { - setLoaded(true); - return; - } - - const g = document.createElement('script') - const s = document.getElementsByTagName('script')[0]; - g.src = 'https://cdn.paddle.com/paddle/paddle.js'; - g.defer = true; - g.async = true; - g.id = 'paddle-js'; - - if (s.parentNode) { - s.parentNode.insertBefore(g, s); - } - - g.onload = function () { - setLoaded(true); - } - }, [isCloud]); - - React.useEffect(function initPaddleScript() { - if (!loaded || !vendorId) return; - - if (sandbox) { - window.Paddle.Environment.set('sandbox'); - } - - window.Paddle.Setup({ - vendor: vendorId, - eventCallback: paddleEventHandler, - }); - }, [loaded, sandbox, vendorId, paddleEventHandler]) - - return ( - - {children} - - ); -}; diff --git a/packages/web/src/contexts/StepExecutions.jsx b/packages/web/src/contexts/StepExecutions.jsx new file mode 100644 index 00000000..d8ae1fc2 --- /dev/null +++ b/packages/web/src/contexts/StepExecutions.jsx @@ -0,0 +1,10 @@ +import * as React from 'react'; +export const StepExecutionsContext = React.createContext([]); +export const StepExecutionsProvider = (props) => { + const { children, value } = props; + return ( + + {children} + + ); +}; diff --git a/packages/web/src/contexts/StepExecutions.tsx b/packages/web/src/contexts/StepExecutions.tsx deleted file mode 100644 index 519fa4b6..00000000 --- a/packages/web/src/contexts/StepExecutions.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import * as React from 'react'; -import type { IStep } from 'types'; - -export const StepExecutionsContext = React.createContext([]); - -type StepExecutionsProviderProps = { - children: React.ReactNode; - value: IStep[]; -}; - -export const StepExecutionsProvider = ( - props: StepExecutionsProviderProps -): React.ReactElement => { - const { children, value } = props; - return ( - - {children} - - ); -}; diff --git a/packages/web/src/graphql/cache.ts b/packages/web/src/graphql/cache.js similarity index 93% rename from packages/web/src/graphql/cache.ts rename to packages/web/src/graphql/cache.js index bdb10fa1..cfa5eded 100644 --- a/packages/web/src/graphql/cache.ts +++ b/packages/web/src/graphql/cache.js @@ -1,9 +1,4 @@ import { InMemoryCache } from '@apollo/client'; - -interface IRef { - __ref: string; -} - const cache = new InMemoryCache({ typePolicies: { App: { @@ -19,28 +14,24 @@ const cache = new InMemoryCache({ __typename: 'App', key: appKey, }); - cache.modify({ id: appCacheId, fields: { connections: (existingConnections) => { const existingConnectionIndex = existingConnections.findIndex( - (connection: IRef) => { + (connection) => { return connection.__ref === verifiedConnection.__ref; } ); const connectionExists = existingConnectionIndex !== -1; - // newly created and verified connection if (!connectionExists) { return [verifiedConnection, ...existingConnections]; } - return existingConnections; }, }, }); - return verifiedConnection; }, }, @@ -48,5 +39,4 @@ const cache = new InMemoryCache({ }, }, }); - export default cache; diff --git a/packages/web/src/graphql/client.ts b/packages/web/src/graphql/client.js similarity index 73% rename from packages/web/src/graphql/client.ts rename to packages/web/src/graphql/client.js index d1e19ad9..45a0c356 100644 --- a/packages/web/src/graphql/client.ts +++ b/packages/web/src/graphql/client.js @@ -2,12 +2,6 @@ import { ApolloClient } from '@apollo/client'; import cache from './cache'; import createLink from './link'; import appConfig from 'config/app'; - -type CreateClientOptions = { - onError?: (message: string) => void; - token?: string | null; -}; - const client = new ApolloClient({ cache, link: createLink({ uri: appConfig.graphqlUrl }), @@ -17,16 +11,10 @@ const client = new ApolloClient({ }, }, }); - -export function mutateAndGetClient( - options: CreateClientOptions -): typeof client { +export function mutateAndGetClient(options) { const { onError, token } = options; const link = createLink({ uri: appConfig.graphqlUrl, token, onError }); - client.setLink(link); - return client; } - export default client; diff --git a/packages/web/src/graphql/link.ts b/packages/web/src/graphql/link.js similarity index 71% rename from packages/web/src/graphql/link.ts rename to packages/web/src/graphql/link.js index 73a04269..7e5d3c1d 100644 --- a/packages/web/src/graphql/link.ts +++ b/packages/web/src/graphql/link.js @@ -1,69 +1,46 @@ import { HttpLink, from } from '@apollo/client'; -import type { ApolloLink } from '@apollo/client'; import { onError } from '@apollo/client/link/error'; - import { setItem } from 'helpers/storage'; import * as URLS from 'config/urls'; - -type CreateLinkOptions = { - uri: string; - token?: string | null; - onError?: (message: string) => void; -}; - -const createHttpLink = ( - options: Pick -): ApolloLink => { +const createHttpLink = (options) => { const { uri, token } = options; const headers = { authorization: token, }; return new HttpLink({ uri, headers }); }; - const NOT_AUTHORISED = 'Not Authorised!'; -const createErrorLink = (callback: CreateLinkOptions['onError']): ApolloLink => +const createErrorLink = (callback) => onError(({ graphQLErrors, networkError, operation }) => { const context = operation.getContext(); const autoSnackbar = context.autoSnackbar ?? true; - if (graphQLErrors) graphQLErrors.forEach(({ message, locations, path }) => { if (autoSnackbar) { callback?.(message); } - console.error( - `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}` + `[GraphQL error]: Message: ${message}, Location: ${locations}, Path: ${path}`, ); - if (message === NOT_AUTHORISED) { setItem('token', ''); - if (window.location.pathname !== URLS.LOGIN) { window.location.href = URLS.LOGIN; } } }); - if (networkError) { if (autoSnackbar) { callback?.(networkError.toString()); } - console.error(`[Network error]: ${networkError}`); } }); -// eslint-disable-next-line @typescript-eslint/no-empty-function -const noop = () => { }; - -const createLink = (options: CreateLinkOptions): ApolloLink => { +const noop = () => {}; +const createLink = (options) => { const { uri, onError = noop, token } = options; - const httpOptions = { uri, token }; - return from([createErrorLink(onError), createHttpLink(httpOptions)]); }; - export default createLink; diff --git a/packages/web/src/graphql/mutations/create-app-auth-client.ts b/packages/web/src/graphql/mutations/create-app-auth-client.js similarity index 99% rename from packages/web/src/graphql/mutations/create-app-auth-client.ts rename to packages/web/src/graphql/mutations/create-app-auth-client.js index 1703f075..edcbc1fd 100644 --- a/packages/web/src/graphql/mutations/create-app-auth-client.ts +++ b/packages/web/src/graphql/mutations/create-app-auth-client.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const CREATE_APP_AUTH_CLIENT = gql` mutation CreateAppAuthClient($input: CreateAppAuthClientInput) { createAppAuthClient(input: $input) { diff --git a/packages/web/src/graphql/mutations/create-app-config.ts b/packages/web/src/graphql/mutations/create-app-config.js similarity index 99% rename from packages/web/src/graphql/mutations/create-app-config.ts rename to packages/web/src/graphql/mutations/create-app-config.js index 46c0c742..f895014e 100644 --- a/packages/web/src/graphql/mutations/create-app-config.ts +++ b/packages/web/src/graphql/mutations/create-app-config.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const CREATE_APP_CONFIG = gql` mutation CreateAppConfig($input: CreateAppConfigInput) { createAppConfig(input: $input) { diff --git a/packages/web/src/graphql/mutations/create-connection.ts b/packages/web/src/graphql/mutations/create-connection.js similarity index 99% rename from packages/web/src/graphql/mutations/create-connection.ts rename to packages/web/src/graphql/mutations/create-connection.js index 313c837d..e3fb37c3 100644 --- a/packages/web/src/graphql/mutations/create-connection.ts +++ b/packages/web/src/graphql/mutations/create-connection.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const CREATE_CONNECTION = gql` mutation CreateConnection($input: CreateConnectionInput) { createConnection(input: $input) { diff --git a/packages/web/src/graphql/mutations/create-flow.ts b/packages/web/src/graphql/mutations/create-flow.js similarity index 99% rename from packages/web/src/graphql/mutations/create-flow.ts rename to packages/web/src/graphql/mutations/create-flow.js index befefa3d..912b8f13 100644 --- a/packages/web/src/graphql/mutations/create-flow.ts +++ b/packages/web/src/graphql/mutations/create-flow.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const CREATE_FLOW = gql` mutation CreateFlow($input: CreateFlowInput) { createFlow(input: $input) { diff --git a/packages/web/src/graphql/mutations/create-role.ee.ts b/packages/web/src/graphql/mutations/create-role.ee.js similarity index 99% rename from packages/web/src/graphql/mutations/create-role.ee.ts rename to packages/web/src/graphql/mutations/create-role.ee.js index 51df0d57..be519627 100644 --- a/packages/web/src/graphql/mutations/create-role.ee.ts +++ b/packages/web/src/graphql/mutations/create-role.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const CREATE_ROLE = gql` mutation CreateRole($input: CreateRoleInput) { createRole(input: $input) { diff --git a/packages/web/src/graphql/mutations/create-step.ts b/packages/web/src/graphql/mutations/create-step.js similarity index 99% rename from packages/web/src/graphql/mutations/create-step.ts rename to packages/web/src/graphql/mutations/create-step.js index 4f60ba6c..9b77b3f3 100644 --- a/packages/web/src/graphql/mutations/create-step.ts +++ b/packages/web/src/graphql/mutations/create-step.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const CREATE_STEP = gql` mutation CreateStep($input: CreateStepInput) { createStep(input: $input) { diff --git a/packages/web/src/graphql/mutations/create-user.ee.ts b/packages/web/src/graphql/mutations/create-user.ee.js similarity index 99% rename from packages/web/src/graphql/mutations/create-user.ee.ts rename to packages/web/src/graphql/mutations/create-user.ee.js index 6efc3d88..3945922e 100644 --- a/packages/web/src/graphql/mutations/create-user.ee.ts +++ b/packages/web/src/graphql/mutations/create-user.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const CREATE_USER = gql` mutation CreateUser($input: CreateUserInput) { createUser(input: $input) { diff --git a/packages/web/src/graphql/mutations/delete-connection.ts b/packages/web/src/graphql/mutations/delete-connection.js similarity index 99% rename from packages/web/src/graphql/mutations/delete-connection.ts rename to packages/web/src/graphql/mutations/delete-connection.js index 56e387e2..734240e8 100644 --- a/packages/web/src/graphql/mutations/delete-connection.ts +++ b/packages/web/src/graphql/mutations/delete-connection.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const DELETE_CONNECTION = gql` mutation DeleteConnection($input: DeleteConnectionInput) { deleteConnection(input: $input) diff --git a/packages/web/src/graphql/mutations/delete-current-user.ee.ts b/packages/web/src/graphql/mutations/delete-current-user.ee.js similarity index 99% rename from packages/web/src/graphql/mutations/delete-current-user.ee.ts rename to packages/web/src/graphql/mutations/delete-current-user.ee.js index 9d10258e..da605404 100644 --- a/packages/web/src/graphql/mutations/delete-current-user.ee.ts +++ b/packages/web/src/graphql/mutations/delete-current-user.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const DELETE_CURRENT_USER = gql` mutation DeleteCurrentUser { deleteCurrentUser diff --git a/packages/web/src/graphql/mutations/delete-flow.ts b/packages/web/src/graphql/mutations/delete-flow.js similarity index 99% rename from packages/web/src/graphql/mutations/delete-flow.ts rename to packages/web/src/graphql/mutations/delete-flow.js index f708a5b7..4b7d1c72 100644 --- a/packages/web/src/graphql/mutations/delete-flow.ts +++ b/packages/web/src/graphql/mutations/delete-flow.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const DELETE_FLOW = gql` mutation DeleteFlow($input: DeleteFlowInput) { deleteFlow(input: $input) diff --git a/packages/web/src/graphql/mutations/delete-role.ee.ts b/packages/web/src/graphql/mutations/delete-role.ee.js similarity index 99% rename from packages/web/src/graphql/mutations/delete-role.ee.ts rename to packages/web/src/graphql/mutations/delete-role.ee.js index 9e5bf257..709f3b55 100644 --- a/packages/web/src/graphql/mutations/delete-role.ee.ts +++ b/packages/web/src/graphql/mutations/delete-role.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const DELETE_ROLE = gql` mutation DeleteRole($input: DeleteRoleInput) { deleteRole(input: $input) diff --git a/packages/web/src/graphql/mutations/delete-step.ts b/packages/web/src/graphql/mutations/delete-step.js similarity index 99% rename from packages/web/src/graphql/mutations/delete-step.ts rename to packages/web/src/graphql/mutations/delete-step.js index 5861327b..effb409e 100644 --- a/packages/web/src/graphql/mutations/delete-step.ts +++ b/packages/web/src/graphql/mutations/delete-step.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const DELETE_STEP = gql` mutation DeleteStep($input: DeleteStepInput) { deleteStep(input: $input) { diff --git a/packages/web/src/graphql/mutations/delete-user.ee.ts b/packages/web/src/graphql/mutations/delete-user.ee.js similarity index 99% rename from packages/web/src/graphql/mutations/delete-user.ee.ts rename to packages/web/src/graphql/mutations/delete-user.ee.js index ed187077..c64916c3 100644 --- a/packages/web/src/graphql/mutations/delete-user.ee.ts +++ b/packages/web/src/graphql/mutations/delete-user.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const DELETE_USER = gql` mutation DeleteUser($input: DeleteUserInput) { deleteUser(input: $input) diff --git a/packages/web/src/graphql/mutations/duplicate-flow.ts b/packages/web/src/graphql/mutations/duplicate-flow.js similarity index 99% rename from packages/web/src/graphql/mutations/duplicate-flow.ts rename to packages/web/src/graphql/mutations/duplicate-flow.js index 30cf60c6..6e359ff5 100644 --- a/packages/web/src/graphql/mutations/duplicate-flow.ts +++ b/packages/web/src/graphql/mutations/duplicate-flow.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const DUPLICATE_FLOW = gql` mutation DuplicateFlow($input: DuplicateFlowInput) { duplicateFlow(input: $input) { diff --git a/packages/web/src/graphql/mutations/execute-flow.ts b/packages/web/src/graphql/mutations/execute-flow.js similarity index 99% rename from packages/web/src/graphql/mutations/execute-flow.ts rename to packages/web/src/graphql/mutations/execute-flow.js index 43b7aa46..ba9c40b7 100644 --- a/packages/web/src/graphql/mutations/execute-flow.ts +++ b/packages/web/src/graphql/mutations/execute-flow.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const EXECUTE_FLOW = gql` mutation ExecuteFlow($input: ExecuteFlowInput) { executeFlow(input: $input) { diff --git a/packages/web/src/graphql/mutations/forgot-password.ee.ts b/packages/web/src/graphql/mutations/forgot-password.ee.js similarity index 99% rename from packages/web/src/graphql/mutations/forgot-password.ee.ts rename to packages/web/src/graphql/mutations/forgot-password.ee.js index 9373875e..161a6fd6 100644 --- a/packages/web/src/graphql/mutations/forgot-password.ee.ts +++ b/packages/web/src/graphql/mutations/forgot-password.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const FORGOT_PASSWORD = gql` mutation ForgotPassword($input: ForgotPasswordInput) { forgotPassword(input: $input) diff --git a/packages/web/src/graphql/mutations/generate-auth-url.ts b/packages/web/src/graphql/mutations/generate-auth-url.js similarity index 99% rename from packages/web/src/graphql/mutations/generate-auth-url.ts rename to packages/web/src/graphql/mutations/generate-auth-url.js index 6077710d..44ce0431 100644 --- a/packages/web/src/graphql/mutations/generate-auth-url.ts +++ b/packages/web/src/graphql/mutations/generate-auth-url.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GENERATE_AUTH_URL = gql` mutation generateAuthUrl($input: GenerateAuthUrlInput) { generateAuthUrl(input: $input) { diff --git a/packages/web/src/graphql/mutations/index.ts b/packages/web/src/graphql/mutations/index.js similarity index 88% rename from packages/web/src/graphql/mutations/index.ts rename to packages/web/src/graphql/mutations/index.js index d6340cf2..0033bc86 100644 --- a/packages/web/src/graphql/mutations/index.ts +++ b/packages/web/src/graphql/mutations/index.js @@ -4,12 +4,7 @@ import { VERIFY_CONNECTION } from './verify-connection'; import { RESET_CONNECTION } from './reset-connection'; import { DELETE_CONNECTION } from './delete-connection'; import { GENERATE_AUTH_URL } from './generate-auth-url'; - -type Mutations = { - [key: string]: any; -}; - -const mutations: Mutations = { +const mutations = { createConnection: CREATE_CONNECTION, updateConnection: UPDATE_CONNECTION, verifyConnection: VERIFY_CONNECTION, @@ -17,5 +12,4 @@ const mutations: Mutations = { deleteConnection: DELETE_CONNECTION, generateAuthUrl: GENERATE_AUTH_URL, }; - export default mutations; diff --git a/packages/web/src/graphql/mutations/login.ts b/packages/web/src/graphql/mutations/login.js similarity index 99% rename from packages/web/src/graphql/mutations/login.ts rename to packages/web/src/graphql/mutations/login.js index 426b5d82..c0f632a5 100644 --- a/packages/web/src/graphql/mutations/login.ts +++ b/packages/web/src/graphql/mutations/login.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const LOGIN = gql` mutation Login($input: LoginInput) { login(input: $input) { diff --git a/packages/web/src/graphql/mutations/register-user.ee.ts b/packages/web/src/graphql/mutations/register-user.ee.js similarity index 99% rename from packages/web/src/graphql/mutations/register-user.ee.ts rename to packages/web/src/graphql/mutations/register-user.ee.js index 5f006150..54f852ac 100644 --- a/packages/web/src/graphql/mutations/register-user.ee.ts +++ b/packages/web/src/graphql/mutations/register-user.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const REGISTER_USER = gql` mutation RegisterUser($input: RegisterUserInput) { registerUser(input: $input) { diff --git a/packages/web/src/graphql/mutations/reset-connection.ts b/packages/web/src/graphql/mutations/reset-connection.js similarity index 99% rename from packages/web/src/graphql/mutations/reset-connection.ts rename to packages/web/src/graphql/mutations/reset-connection.js index 35782742..adc02b24 100644 --- a/packages/web/src/graphql/mutations/reset-connection.ts +++ b/packages/web/src/graphql/mutations/reset-connection.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const RESET_CONNECTION = gql` mutation ResetConnection($input: ResetConnectionInput) { resetConnection(input: $input) { diff --git a/packages/web/src/graphql/mutations/reset-password.ee.ts b/packages/web/src/graphql/mutations/reset-password.ee.js similarity index 99% rename from packages/web/src/graphql/mutations/reset-password.ee.ts rename to packages/web/src/graphql/mutations/reset-password.ee.js index aaf991f6..42360bca 100644 --- a/packages/web/src/graphql/mutations/reset-password.ee.ts +++ b/packages/web/src/graphql/mutations/reset-password.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const RESET_PASSWORD = gql` mutation ResetPassword($input: ResetPasswordInput) { resetPassword(input: $input) diff --git a/packages/web/src/graphql/mutations/update-app-auth-client.ts b/packages/web/src/graphql/mutations/update-app-auth-client.js similarity index 99% rename from packages/web/src/graphql/mutations/update-app-auth-client.ts rename to packages/web/src/graphql/mutations/update-app-auth-client.js index 6742bee3..ff387498 100644 --- a/packages/web/src/graphql/mutations/update-app-auth-client.ts +++ b/packages/web/src/graphql/mutations/update-app-auth-client.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const UPDATE_APP_AUTH_CLIENT = gql` mutation UpdateAppAuthClient($input: UpdateAppAuthClientInput) { updateAppAuthClient(input: $input) { diff --git a/packages/web/src/graphql/mutations/update-app-config.ts b/packages/web/src/graphql/mutations/update-app-config.js similarity index 99% rename from packages/web/src/graphql/mutations/update-app-config.ts rename to packages/web/src/graphql/mutations/update-app-config.js index 5bdcbc36..76f5de10 100644 --- a/packages/web/src/graphql/mutations/update-app-config.ts +++ b/packages/web/src/graphql/mutations/update-app-config.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const UPDATE_APP_CONFIG = gql` mutation UpdateAppConfig($input: UpdateAppConfigInput) { updateAppConfig(input: $input) { diff --git a/packages/web/src/graphql/mutations/update-config.ee.ts b/packages/web/src/graphql/mutations/update-config.ee.js similarity index 99% rename from packages/web/src/graphql/mutations/update-config.ee.ts rename to packages/web/src/graphql/mutations/update-config.ee.js index f74e61e3..b916c62f 100644 --- a/packages/web/src/graphql/mutations/update-config.ee.ts +++ b/packages/web/src/graphql/mutations/update-config.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const UPDATE_CONFIG = gql` mutation UpdateConfig($input: JSONObject) { updateConfig(input: $input) diff --git a/packages/web/src/graphql/mutations/update-connection.ts b/packages/web/src/graphql/mutations/update-connection.js similarity index 99% rename from packages/web/src/graphql/mutations/update-connection.ts rename to packages/web/src/graphql/mutations/update-connection.js index 72f2e181..6b70cebe 100644 --- a/packages/web/src/graphql/mutations/update-connection.ts +++ b/packages/web/src/graphql/mutations/update-connection.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const UPDATE_CONNECTION = gql` mutation UpdateConnection($input: UpdateConnectionInput) { updateConnection(input: $input) { diff --git a/packages/web/src/graphql/mutations/update-current-user.ts b/packages/web/src/graphql/mutations/update-current-user.js similarity index 99% rename from packages/web/src/graphql/mutations/update-current-user.ts rename to packages/web/src/graphql/mutations/update-current-user.js index 87ab807f..936d5ee2 100644 --- a/packages/web/src/graphql/mutations/update-current-user.ts +++ b/packages/web/src/graphql/mutations/update-current-user.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const UPDATE_CURRENT_USER = gql` mutation UpdateCurrentUser($input: UpdateCurrentUserInput) { updateCurrentUser(input: $input) { diff --git a/packages/web/src/graphql/mutations/update-flow-status.ts b/packages/web/src/graphql/mutations/update-flow-status.js similarity index 99% rename from packages/web/src/graphql/mutations/update-flow-status.ts rename to packages/web/src/graphql/mutations/update-flow-status.js index 3b0b4313..862a5ad2 100644 --- a/packages/web/src/graphql/mutations/update-flow-status.ts +++ b/packages/web/src/graphql/mutations/update-flow-status.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const UPDATE_FLOW_STATUS = gql` mutation UpdateFlowStatus($input: UpdateFlowStatusInput) { updateFlowStatus(input: $input) { diff --git a/packages/web/src/graphql/mutations/update-flow.ts b/packages/web/src/graphql/mutations/update-flow.js similarity index 99% rename from packages/web/src/graphql/mutations/update-flow.ts rename to packages/web/src/graphql/mutations/update-flow.js index 9988cc91..0ac5909c 100644 --- a/packages/web/src/graphql/mutations/update-flow.ts +++ b/packages/web/src/graphql/mutations/update-flow.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const UPDATE_FLOW = gql` mutation UpdateFlow($input: UpdateFlowInput) { updateFlow(input: $input) { diff --git a/packages/web/src/graphql/mutations/update-role.ee.ts b/packages/web/src/graphql/mutations/update-role.ee.js similarity index 99% rename from packages/web/src/graphql/mutations/update-role.ee.ts rename to packages/web/src/graphql/mutations/update-role.ee.js index fa6ecebf..15f741c6 100644 --- a/packages/web/src/graphql/mutations/update-role.ee.ts +++ b/packages/web/src/graphql/mutations/update-role.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const UPDATE_ROLE = gql` mutation UpdateRole($input: UpdateRoleInput) { updateRole(input: $input) { diff --git a/packages/web/src/graphql/mutations/update-step.ts b/packages/web/src/graphql/mutations/update-step.js similarity index 99% rename from packages/web/src/graphql/mutations/update-step.ts rename to packages/web/src/graphql/mutations/update-step.js index c5eb459a..44d91a2b 100644 --- a/packages/web/src/graphql/mutations/update-step.ts +++ b/packages/web/src/graphql/mutations/update-step.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const UPDATE_STEP = gql` mutation UpdateStep($input: UpdateStepInput) { updateStep(input: $input) { diff --git a/packages/web/src/graphql/mutations/update-user.ee.ts b/packages/web/src/graphql/mutations/update-user.ee.js similarity index 99% rename from packages/web/src/graphql/mutations/update-user.ee.ts rename to packages/web/src/graphql/mutations/update-user.ee.js index 8a943dc5..c73d8f1d 100644 --- a/packages/web/src/graphql/mutations/update-user.ee.ts +++ b/packages/web/src/graphql/mutations/update-user.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const UPDATE_USER = gql` mutation UpdateUser($input: UpdateUserInput) { updateUser(input: $input) { diff --git a/packages/web/src/graphql/mutations/upsert-saml-auth-provider.ts b/packages/web/src/graphql/mutations/upsert-saml-auth-provider.js similarity index 99% rename from packages/web/src/graphql/mutations/upsert-saml-auth-provider.ts rename to packages/web/src/graphql/mutations/upsert-saml-auth-provider.js index cdb46918..575c846d 100644 --- a/packages/web/src/graphql/mutations/upsert-saml-auth-provider.ts +++ b/packages/web/src/graphql/mutations/upsert-saml-auth-provider.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const UPSERT_SAML_AUTH_PROVIDER = gql` mutation UpsertSamlAuthProvider($input: UpsertSamlAuthProviderInput) { upsertSamlAuthProvider(input: $input) { diff --git a/packages/web/src/graphql/mutations/upsert-saml-auth-providers-role-mappings.ts b/packages/web/src/graphql/mutations/upsert-saml-auth-providers-role-mappings.js similarity index 99% rename from packages/web/src/graphql/mutations/upsert-saml-auth-providers-role-mappings.ts rename to packages/web/src/graphql/mutations/upsert-saml-auth-providers-role-mappings.js index a50e31b3..2d9180e0 100644 --- a/packages/web/src/graphql/mutations/upsert-saml-auth-providers-role-mappings.ts +++ b/packages/web/src/graphql/mutations/upsert-saml-auth-providers-role-mappings.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const UPSERT_SAML_AUTH_PROVIDERS_ROLE_MAPPINGS = gql` mutation UpsertSamlAuthProvidersRoleMappings( $input: UpsertSamlAuthProvidersRoleMappingsInput diff --git a/packages/web/src/graphql/mutations/verify-connection.ts b/packages/web/src/graphql/mutations/verify-connection.js similarity index 99% rename from packages/web/src/graphql/mutations/verify-connection.ts rename to packages/web/src/graphql/mutations/verify-connection.js index 0099b9eb..954eed0b 100644 --- a/packages/web/src/graphql/mutations/verify-connection.ts +++ b/packages/web/src/graphql/mutations/verify-connection.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const VERIFY_CONNECTION = gql` mutation VerifyConnection($input: VerifyConnectionInput) { verifyConnection(input: $input) { diff --git a/packages/web/src/graphql/pagination.js b/packages/web/src/graphql/pagination.js new file mode 100644 index 00000000..3dd0a522 --- /dev/null +++ b/packages/web/src/graphql/pagination.js @@ -0,0 +1,32 @@ +const makeEmptyData = () => { + return { + edges: [], + pageInfo: { + currentPage: 1, + totalPages: 1, + }, + }; +}; +function offsetLimitPagination(keyArgs = false) { + return { + keyArgs, + merge(existing, incoming, { args }) { + if (!existing) { + existing = makeEmptyData(); + } + if (!incoming || incoming === null) return existing; + const existingEdges = existing?.edges || []; + const incomingEdges = incoming.edges || []; + if (args) { + const newEdges = [...existingEdges, ...incomingEdges]; + return { + pageInfo: incoming.pageInfo, + edges: newEdges, + }; + } else { + return existing; + } + }, + }; +} +export default offsetLimitPagination; diff --git a/packages/web/src/graphql/pagination.ts b/packages/web/src/graphql/pagination.ts deleted file mode 100644 index f5c02f73..00000000 --- a/packages/web/src/graphql/pagination.ts +++ /dev/null @@ -1,70 +0,0 @@ -import type { FieldPolicy, Reference } from '@apollo/client'; - -type KeyArgs = FieldPolicy['keyArgs']; - -export type TEdge = - | { - node: TNode; - } - | Reference; - -export type TPageInfo = { - currentPage: number; - totalPages: number; -}; - -export type TExisting = Readonly<{ - edges: TEdge[]; - pageInfo: TPageInfo; -}>; - -export type TIncoming = { - edges: TEdge[]; - pageInfo: TPageInfo; -}; - -export type CustomFieldPolicy = FieldPolicy< - TExisting | null, - TIncoming | null, - TIncoming | null ->; - -const makeEmptyData = (): TExisting => { - return { - edges: [], - pageInfo: { - currentPage: 1, - totalPages: 1, - }, - }; -}; - -function offsetLimitPagination( - keyArgs: KeyArgs = false -): CustomFieldPolicy { - return { - keyArgs, - merge(existing, incoming, { args }) { - if (!existing) { - existing = makeEmptyData(); - } - - if (!incoming || incoming === null) return existing; - - const existingEdges = existing?.edges || []; - const incomingEdges = incoming.edges || []; - - if (args) { - const newEdges = [...existingEdges, ...incomingEdges]; - return { - pageInfo: incoming.pageInfo, - edges: newEdges, - }; - } else { - return existing; - } - }, - }; -} - -export default offsetLimitPagination; diff --git a/packages/web/src/graphql/queries/get-app-auth-client.ee.ts b/packages/web/src/graphql/queries/get-app-auth-client.ee.js similarity index 99% rename from packages/web/src/graphql/queries/get-app-auth-client.ee.ts rename to packages/web/src/graphql/queries/get-app-auth-client.ee.js index fecc656e..4783d691 100644 --- a/packages/web/src/graphql/queries/get-app-auth-client.ee.ts +++ b/packages/web/src/graphql/queries/get-app-auth-client.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_APP_AUTH_CLIENT = gql` query GetAppAuthClient($id: String!) { getAppAuthClient(id: $id) { @@ -10,4 +9,3 @@ export const GET_APP_AUTH_CLIENT = gql` } } `; - diff --git a/packages/web/src/graphql/queries/get-app-auth-clients.ee.ts b/packages/web/src/graphql/queries/get-app-auth-clients.ee.js similarity index 99% rename from packages/web/src/graphql/queries/get-app-auth-clients.ee.ts rename to packages/web/src/graphql/queries/get-app-auth-clients.ee.js index e1d71fca..a4303df2 100644 --- a/packages/web/src/graphql/queries/get-app-auth-clients.ee.ts +++ b/packages/web/src/graphql/queries/get-app-auth-clients.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_APP_AUTH_CLIENTS = gql` query GetAppAuthClients($appKey: String!, $active: Boolean) { getAppAuthClients(appKey: $appKey, active: $active) { @@ -10,4 +9,3 @@ export const GET_APP_AUTH_CLIENTS = gql` } } `; - diff --git a/packages/web/src/graphql/queries/get-app-config.ee.ts b/packages/web/src/graphql/queries/get-app-config.ee.js similarity index 99% rename from packages/web/src/graphql/queries/get-app-config.ee.ts rename to packages/web/src/graphql/queries/get-app-config.ee.js index a70e5cff..6576f10b 100644 --- a/packages/web/src/graphql/queries/get-app-config.ee.ts +++ b/packages/web/src/graphql/queries/get-app-config.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_APP_CONFIG = gql` query GetAppConfig($key: String!) { getAppConfig(key: $key) { @@ -13,4 +12,3 @@ export const GET_APP_CONFIG = gql` } } `; - diff --git a/packages/web/src/graphql/queries/get-app-connections.ts b/packages/web/src/graphql/queries/get-app-connections.js similarity index 99% rename from packages/web/src/graphql/queries/get-app-connections.ts rename to packages/web/src/graphql/queries/get-app-connections.js index 89cee2e3..70863b37 100644 --- a/packages/web/src/graphql/queries/get-app-connections.ts +++ b/packages/web/src/graphql/queries/get-app-connections.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_APP_CONNECTIONS = gql` query GetAppConnections($key: String!) { getApp(key: $key) { diff --git a/packages/web/src/graphql/queries/get-app.ts b/packages/web/src/graphql/queries/get-app.js similarity index 99% rename from packages/web/src/graphql/queries/get-app.ts rename to packages/web/src/graphql/queries/get-app.js index 046d596a..edfd362d 100644 --- a/packages/web/src/graphql/queries/get-app.ts +++ b/packages/web/src/graphql/queries/get-app.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_APP = gql` query GetApp($key: String!) { getApp(key: $key) { diff --git a/packages/web/src/graphql/queries/get-apps.ts b/packages/web/src/graphql/queries/get-apps.js similarity index 99% rename from packages/web/src/graphql/queries/get-apps.ts rename to packages/web/src/graphql/queries/get-apps.js index 3cfcdd17..af074431 100644 --- a/packages/web/src/graphql/queries/get-apps.ts +++ b/packages/web/src/graphql/queries/get-apps.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_APPS = gql` query GetApps( $name: String diff --git a/packages/web/src/graphql/queries/get-automatisch-info.ts b/packages/web/src/graphql/queries/get-automatisch-info.js similarity index 98% rename from packages/web/src/graphql/queries/get-automatisch-info.ts rename to packages/web/src/graphql/queries/get-automatisch-info.js index 296986bb..f8cd9b58 100644 --- a/packages/web/src/graphql/queries/get-automatisch-info.ts +++ b/packages/web/src/graphql/queries/get-automatisch-info.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_AUTOMATISCH_INFO = gql` query GetAutomatischInfo { getAutomatischInfo { @@ -8,4 +7,3 @@ export const GET_AUTOMATISCH_INFO = gql` } } `; - diff --git a/packages/web/src/graphql/queries/get-billing-and-usage.ee.ts b/packages/web/src/graphql/queries/get-billing-and-usage.ee.js similarity index 99% rename from packages/web/src/graphql/queries/get-billing-and-usage.ee.ts rename to packages/web/src/graphql/queries/get-billing-and-usage.ee.js index a30d9abd..726b2b8e 100644 --- a/packages/web/src/graphql/queries/get-billing-and-usage.ee.ts +++ b/packages/web/src/graphql/queries/get-billing-and-usage.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_BILLING_AND_USAGE = gql` query GetBillingAndUsage { getBillingAndUsage { @@ -36,4 +35,3 @@ export const GET_BILLING_AND_USAGE = gql` } } `; - diff --git a/packages/web/src/graphql/queries/get-config.ee.ts b/packages/web/src/graphql/queries/get-config.ee.js similarity index 98% rename from packages/web/src/graphql/queries/get-config.ee.ts rename to packages/web/src/graphql/queries/get-config.ee.js index 6204b5a6..02ff1ef9 100644 --- a/packages/web/src/graphql/queries/get-config.ee.ts +++ b/packages/web/src/graphql/queries/get-config.ee.js @@ -1,8 +1,6 @@ import { gql } from '@apollo/client'; - export const GET_CONFIG = gql` query GetConfig($keys: [String]) { getConfig(keys: $keys) } `; - diff --git a/packages/web/src/graphql/queries/get-connected-apps.ts b/packages/web/src/graphql/queries/get-connected-apps.js similarity index 99% rename from packages/web/src/graphql/queries/get-connected-apps.ts rename to packages/web/src/graphql/queries/get-connected-apps.js index 6ef985d7..01cb8aa8 100644 --- a/packages/web/src/graphql/queries/get-connected-apps.ts +++ b/packages/web/src/graphql/queries/get-connected-apps.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_CONNECTED_APPS = gql` query GetConnectedApps($name: String) { getConnectedApps(name: $name) { diff --git a/packages/web/src/graphql/queries/get-current-user.ts b/packages/web/src/graphql/queries/get-current-user.js similarity index 99% rename from packages/web/src/graphql/queries/get-current-user.ts rename to packages/web/src/graphql/queries/get-current-user.js index cf77f9d7..93d0ddcd 100644 --- a/packages/web/src/graphql/queries/get-current-user.ts +++ b/packages/web/src/graphql/queries/get-current-user.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_CURRENT_USER = gql` query GetCurrentUser { getCurrentUser { diff --git a/packages/web/src/graphql/queries/get-dynamic-data.ts b/packages/web/src/graphql/queries/get-dynamic-data.js similarity index 99% rename from packages/web/src/graphql/queries/get-dynamic-data.ts rename to packages/web/src/graphql/queries/get-dynamic-data.js index d3a4715f..f589beee 100644 --- a/packages/web/src/graphql/queries/get-dynamic-data.ts +++ b/packages/web/src/graphql/queries/get-dynamic-data.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_DYNAMIC_DATA = gql` query GetDynamicData( $stepId: String! diff --git a/packages/web/src/graphql/queries/get-dynamic-fields.ts b/packages/web/src/graphql/queries/get-dynamic-fields.js similarity index 99% rename from packages/web/src/graphql/queries/get-dynamic-fields.ts rename to packages/web/src/graphql/queries/get-dynamic-fields.js index 91f538d9..1be20681 100644 --- a/packages/web/src/graphql/queries/get-dynamic-fields.ts +++ b/packages/web/src/graphql/queries/get-dynamic-fields.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_DYNAMIC_FIELDS = gql` query GetDynamicFields( $stepId: String! diff --git a/packages/web/src/graphql/queries/get-execution-steps.ts b/packages/web/src/graphql/queries/get-execution-steps.js similarity index 99% rename from packages/web/src/graphql/queries/get-execution-steps.ts rename to packages/web/src/graphql/queries/get-execution-steps.js index 109d9c2f..833a9b67 100644 --- a/packages/web/src/graphql/queries/get-execution-steps.ts +++ b/packages/web/src/graphql/queries/get-execution-steps.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_EXECUTION_STEPS = gql` query GetExecutionSteps($executionId: String!, $limit: Int!, $offset: Int!) { getExecutionSteps( diff --git a/packages/web/src/graphql/queries/get-execution.ts b/packages/web/src/graphql/queries/get-execution.js similarity index 99% rename from packages/web/src/graphql/queries/get-execution.ts rename to packages/web/src/graphql/queries/get-execution.js index 22303351..5c3f81b7 100644 --- a/packages/web/src/graphql/queries/get-execution.ts +++ b/packages/web/src/graphql/queries/get-execution.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_EXECUTION = gql` query GetExecution($executionId: String!) { getExecution(executionId: $executionId) { diff --git a/packages/web/src/graphql/queries/get-executions.ts b/packages/web/src/graphql/queries/get-executions.js similarity index 99% rename from packages/web/src/graphql/queries/get-executions.ts rename to packages/web/src/graphql/queries/get-executions.js index 653426a9..b4f8a7e9 100644 --- a/packages/web/src/graphql/queries/get-executions.ts +++ b/packages/web/src/graphql/queries/get-executions.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_EXECUTIONS = gql` query GetExecutions($limit: Int!, $offset: Int!) { getExecutions(limit: $limit, offset: $offset) { diff --git a/packages/web/src/graphql/queries/get-flow.ts b/packages/web/src/graphql/queries/get-flow.js similarity index 99% rename from packages/web/src/graphql/queries/get-flow.ts rename to packages/web/src/graphql/queries/get-flow.js index 521dcdab..8ef0bf67 100644 --- a/packages/web/src/graphql/queries/get-flow.ts +++ b/packages/web/src/graphql/queries/get-flow.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_FLOW = gql` query GetFlow($id: String!) { getFlow(id: $id) { diff --git a/packages/web/src/graphql/queries/get-flows.ts b/packages/web/src/graphql/queries/get-flows.js similarity index 99% rename from packages/web/src/graphql/queries/get-flows.ts rename to packages/web/src/graphql/queries/get-flows.js index d2e5d321..e4213d31 100644 --- a/packages/web/src/graphql/queries/get-flows.ts +++ b/packages/web/src/graphql/queries/get-flows.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_FLOWS = gql` query GetFlows( $limit: Int! diff --git a/packages/web/src/graphql/queries/get-invoices.ee.ts b/packages/web/src/graphql/queries/get-invoices.ee.js similarity index 98% rename from packages/web/src/graphql/queries/get-invoices.ee.ts rename to packages/web/src/graphql/queries/get-invoices.ee.js index 1710debf..b412a057 100644 --- a/packages/web/src/graphql/queries/get-invoices.ee.ts +++ b/packages/web/src/graphql/queries/get-invoices.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_INVOICES = gql` query GetInvoices { getInvoices { @@ -11,4 +10,3 @@ export const GET_INVOICES = gql` } } `; - diff --git a/packages/web/src/graphql/queries/get-notifications.ts b/packages/web/src/graphql/queries/get-notifications.js similarity index 99% rename from packages/web/src/graphql/queries/get-notifications.ts rename to packages/web/src/graphql/queries/get-notifications.js index 7057c3db..d020f1ee 100644 --- a/packages/web/src/graphql/queries/get-notifications.ts +++ b/packages/web/src/graphql/queries/get-notifications.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_NOTIFICATIONS = gql` query GetNotifications { getNotifications { diff --git a/packages/web/src/graphql/queries/get-paddle-info.ee.ts b/packages/web/src/graphql/queries/get-paddle-info.ee.js similarity index 99% rename from packages/web/src/graphql/queries/get-paddle-info.ee.ts rename to packages/web/src/graphql/queries/get-paddle-info.ee.js index 4e801865..f307f4ea 100644 --- a/packages/web/src/graphql/queries/get-paddle-info.ee.ts +++ b/packages/web/src/graphql/queries/get-paddle-info.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_PADDLE_INFO = gql` query GetPaddleInfo { getPaddleInfo { diff --git a/packages/web/src/graphql/queries/get-payment-plans.ee.ts b/packages/web/src/graphql/queries/get-payment-plans.ee.js similarity index 99% rename from packages/web/src/graphql/queries/get-payment-plans.ee.ts rename to packages/web/src/graphql/queries/get-payment-plans.ee.js index 1714b108..93fa134f 100644 --- a/packages/web/src/graphql/queries/get-payment-plans.ee.ts +++ b/packages/web/src/graphql/queries/get-payment-plans.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_PAYMENT_PLANS = gql` query GetPaymentPlans { getPaymentPlans { diff --git a/packages/web/src/graphql/queries/get-permission-catalog.ee.ts b/packages/web/src/graphql/queries/get-permission-catalog.ee.js similarity index 99% rename from packages/web/src/graphql/queries/get-permission-catalog.ee.ts rename to packages/web/src/graphql/queries/get-permission-catalog.ee.js index 03ca5db0..0b107738 100644 --- a/packages/web/src/graphql/queries/get-permission-catalog.ee.ts +++ b/packages/web/src/graphql/queries/get-permission-catalog.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_PERMISSION_CATALOG = gql` query GetPermissionCatalog { getPermissionCatalog { diff --git a/packages/web/src/graphql/queries/get-role.ee.ts b/packages/web/src/graphql/queries/get-role.ee.js similarity index 99% rename from packages/web/src/graphql/queries/get-role.ee.ts rename to packages/web/src/graphql/queries/get-role.ee.js index 422d006f..e1cddc61 100644 --- a/packages/web/src/graphql/queries/get-role.ee.ts +++ b/packages/web/src/graphql/queries/get-role.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_ROLE = gql` query GetRole($id: String!) { getRole(id: $id) { diff --git a/packages/web/src/graphql/queries/get-roles.ee.ts b/packages/web/src/graphql/queries/get-roles.ee.js similarity index 99% rename from packages/web/src/graphql/queries/get-roles.ee.ts rename to packages/web/src/graphql/queries/get-roles.ee.js index 66a53180..e6846ea9 100644 --- a/packages/web/src/graphql/queries/get-roles.ee.ts +++ b/packages/web/src/graphql/queries/get-roles.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_ROLES = gql` query GetRoles { getRoles { diff --git a/packages/web/src/graphql/queries/get-saml-auth-provider-role-mappings.ts b/packages/web/src/graphql/queries/get-saml-auth-provider-role-mappings.js similarity index 99% rename from packages/web/src/graphql/queries/get-saml-auth-provider-role-mappings.ts rename to packages/web/src/graphql/queries/get-saml-auth-provider-role-mappings.js index f13b130f..b19492d2 100644 --- a/packages/web/src/graphql/queries/get-saml-auth-provider-role-mappings.ts +++ b/packages/web/src/graphql/queries/get-saml-auth-provider-role-mappings.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_SAML_AUTH_PROVIDER_ROLE_MAPPINGS = gql` query GetSamlAuthProviderRoleMappings($id: String!) { getSamlAuthProviderRoleMappings(id: $id) { diff --git a/packages/web/src/graphql/queries/get-saml-auth-provider.ts b/packages/web/src/graphql/queries/get-saml-auth-provider.js similarity index 99% rename from packages/web/src/graphql/queries/get-saml-auth-provider.ts rename to packages/web/src/graphql/queries/get-saml-auth-provider.js index 26477788..3b59df32 100644 --- a/packages/web/src/graphql/queries/get-saml-auth-provider.ts +++ b/packages/web/src/graphql/queries/get-saml-auth-provider.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_SAML_AUTH_PROVIDER = gql` query GetSamlAuthProvider { getSamlAuthProvider { diff --git a/packages/web/src/graphql/queries/get-step-with-test-executions.ts b/packages/web/src/graphql/queries/get-step-with-test-executions.js similarity index 99% rename from packages/web/src/graphql/queries/get-step-with-test-executions.ts rename to packages/web/src/graphql/queries/get-step-with-test-executions.js index 0c23c0c0..83f65742 100644 --- a/packages/web/src/graphql/queries/get-step-with-test-executions.ts +++ b/packages/web/src/graphql/queries/get-step-with-test-executions.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_STEP_WITH_TEST_EXECUTIONS = gql` query GetStepWithTestExecutions($stepId: String!) { getStepWithTestExecutions(stepId: $stepId) { diff --git a/packages/web/src/graphql/queries/get-subscription-status.ee.ts b/packages/web/src/graphql/queries/get-subscription-status.ee.js similarity index 99% rename from packages/web/src/graphql/queries/get-subscription-status.ee.ts rename to packages/web/src/graphql/queries/get-subscription-status.ee.js index 9b799c8f..3653f542 100644 --- a/packages/web/src/graphql/queries/get-subscription-status.ee.ts +++ b/packages/web/src/graphql/queries/get-subscription-status.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_SUBSCRIPTION_STATUS = gql` query GetSubscriptionStatus { getSubscriptionStatus { diff --git a/packages/web/src/graphql/queries/get-trial-status.ee.ts b/packages/web/src/graphql/queries/get-trial-status.ee.js similarity index 99% rename from packages/web/src/graphql/queries/get-trial-status.ee.ts rename to packages/web/src/graphql/queries/get-trial-status.ee.js index ec41ec20..17a2f808 100644 --- a/packages/web/src/graphql/queries/get-trial-status.ee.ts +++ b/packages/web/src/graphql/queries/get-trial-status.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_TRIAL_STATUS = gql` query GetTrialStatus { getTrialStatus { diff --git a/packages/web/src/graphql/queries/get-user.ts b/packages/web/src/graphql/queries/get-user.js similarity index 99% rename from packages/web/src/graphql/queries/get-user.ts rename to packages/web/src/graphql/queries/get-user.js index f3b5dfad..e4821786 100644 --- a/packages/web/src/graphql/queries/get-user.ts +++ b/packages/web/src/graphql/queries/get-user.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const GET_USER = gql` query GetUser($id: String!) { getUser(id: $id) { diff --git a/packages/web/src/graphql/queries/get-users.ts b/packages/web/src/graphql/queries/get-users.js similarity index 71% rename from packages/web/src/graphql/queries/get-users.ts rename to packages/web/src/graphql/queries/get-users.js index 76a3bac7..e2d8a45f 100644 --- a/packages/web/src/graphql/queries/get-users.ts +++ b/packages/web/src/graphql/queries/get-users.js @@ -1,14 +1,7 @@ import { gql } from '@apollo/client'; - export const GET_USERS = gql` - query GetUsers( - $limit: Int! - $offset: Int! - ) { - getUsers( - limit: $limit - offset: $offset - ) { + query GetUsers($limit: Int!, $offset: Int!) { + getUsers(limit: $limit, offset: $offset) { pageInfo { currentPage totalPages diff --git a/packages/web/src/graphql/queries/healthcheck.ts b/packages/web/src/graphql/queries/healthcheck.js similarity index 99% rename from packages/web/src/graphql/queries/healthcheck.ts rename to packages/web/src/graphql/queries/healthcheck.js index 2fa4536c..0baa613f 100644 --- a/packages/web/src/graphql/queries/healthcheck.ts +++ b/packages/web/src/graphql/queries/healthcheck.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const HEALTHCHECK = gql` query Healthcheck { healthcheck { diff --git a/packages/web/src/graphql/queries/list-saml-auth-providers.ee.ts b/packages/web/src/graphql/queries/list-saml-auth-providers.ee.js similarity index 99% rename from packages/web/src/graphql/queries/list-saml-auth-providers.ee.ts rename to packages/web/src/graphql/queries/list-saml-auth-providers.ee.js index 9f1d9278..c922d604 100644 --- a/packages/web/src/graphql/queries/list-saml-auth-providers.ee.ts +++ b/packages/web/src/graphql/queries/list-saml-auth-providers.ee.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const LIST_SAML_AUTH_PROVIDERS = gql` query ListSamlAuthProviders { listSamlAuthProviders { diff --git a/packages/web/src/graphql/queries/test-connection.ts b/packages/web/src/graphql/queries/test-connection.js similarity index 99% rename from packages/web/src/graphql/queries/test-connection.ts rename to packages/web/src/graphql/queries/test-connection.js index 15ae96b1..15e4b83e 100644 --- a/packages/web/src/graphql/queries/test-connection.ts +++ b/packages/web/src/graphql/queries/test-connection.js @@ -1,5 +1,4 @@ import { gql } from '@apollo/client'; - export const TEST_CONNECTION = gql` query TestConnection($id: String!) { testConnection(id: $id) { diff --git a/packages/web/src/helpers/authenticationSteps.ts b/packages/web/src/helpers/authenticationSteps.js similarity index 70% rename from packages/web/src/helpers/authenticationSteps.ts rename to packages/web/src/helpers/authenticationSteps.js index 9b7b7b16..4e4941b0 100644 --- a/packages/web/src/helpers/authenticationSteps.ts +++ b/packages/web/src/helpers/authenticationSteps.js @@ -1,16 +1,12 @@ -import type { IAuthenticationStep, IJSONObject } from 'types'; import apolloClient from 'graphql/client'; import MUTATIONS from 'graphql/mutations'; +var AuthenticationSteps; +(function (AuthenticationSteps) { + AuthenticationSteps['Mutation'] = 'mutation'; + AuthenticationSteps['OpenWithPopup'] = 'openWithPopup'; +})(AuthenticationSteps || (AuthenticationSteps = {})); -enum AuthenticationSteps { - Mutation = 'mutation', - OpenWithPopup = 'openWithPopup', -} - -const processMutation = async ( - step: IAuthenticationStep, - variables: IJSONObject -) => { +const processMutation = async (step, variables) => { const mutation = MUTATIONS[step.name]; const mutationResponse = await apolloClient.mutate({ mutation, @@ -20,78 +16,52 @@ const processMutation = async ( }, }); const responseData = mutationResponse.data[step.name]; - return responseData; }; - -const parseUrlSearchParams = (event: any) => { +const parseUrlSearchParams = (event) => { const searchParams = new URLSearchParams(event.data.payload.search); const hashParams = new URLSearchParams(event.data.payload.hash.substring(1)); - const searchParamsObject = getObjectOfEntries(searchParams.entries()); const hashParamsObject = getObjectOfEntries(hashParams.entries()); - return { ...hashParamsObject, ...searchParamsObject, }; }; - -function getObjectOfEntries(iterator: any) { - const result: any = {}; - +function getObjectOfEntries(iterator) { + const result = {}; for (const [key, value] of iterator) { result[key] = value; } - return result; } - -const processOpenWithPopup = ( - step: IAuthenticationStep, - variables: IJSONObject -) => { +const processOpenWithPopup = (step, variables) => { return new Promise((resolve, reject) => { const windowFeatures = 'toolbar=no, titlebar=no, menubar=no, width=500, height=700, top=100, left=100'; const url = variables.url; - - const popup = window.open( - url as string, - '_blank', - windowFeatures - ) as WindowProxy; + const popup = window.open(url, '_blank', windowFeatures); popup?.focus(); - const closeCheckIntervalId = setInterval(() => { if (!popup) return; - if (popup?.closed) { clearInterval(closeCheckIntervalId); reject({ message: 'Error occured while verifying credentials!' }); } }, 1000); - - const messageHandler = async (event: MessageEvent) => { + const messageHandler = async (event) => { if (event.data.source !== 'automatisch') { return; } - const data = parseUrlSearchParams(event); window.removeEventListener('message', messageHandler); - clearInterval(closeCheckIntervalId); resolve(data); }; - window.addEventListener('message', messageHandler, false); }); }; - -export const processStep = async ( - step: IAuthenticationStep, - variables: IJSONObject -): Promise => { +export const processStep = async (step, variables) => { if (step.type === AuthenticationSteps.Mutation) { return processMutation(step, variables); } else if (step.type === AuthenticationSteps.OpenWithPopup) { diff --git a/packages/web/src/helpers/computeAuthStepVariables.ts b/packages/web/src/helpers/computeAuthStepVariables.js similarity index 65% rename from packages/web/src/helpers/computeAuthStepVariables.ts rename to packages/web/src/helpers/computeAuthStepVariables.js index f8fd15b4..d49bdb5f 100644 --- a/packages/web/src/helpers/computeAuthStepVariables.ts +++ b/packages/web/src/helpers/computeAuthStepVariables.js @@ -1,48 +1,27 @@ import template from 'lodash/template'; -import type { IAuthenticationStepField, IJSONObject } from 'types'; - const interpolate = /{([\s\S]+?)}/g; - -type Variables = { - [key: string]: any; -}; - -type IVariable = Omit & - Partial>; - -const computeAuthStepVariables = ( - variableSchema: IVariable[], - aggregatedData: IJSONObject -): IJSONObject => { - const variables: Variables = {}; - +const computeAuthStepVariables = (variableSchema, aggregatedData) => { + const variables = {}; for (const variable of variableSchema) { if (variable.properties) { variables[variable.name] = computeAuthStepVariables( variable.properties, aggregatedData ); - continue; } - if (variable.value) { if (variable.value.endsWith('.all}')) { const key = variable.value.replace('{', '').replace('.all}', ''); variables[variable.name] = aggregatedData[key]; - continue; } - const computedVariable = template(variable.value, { interpolate })( aggregatedData ); - variables[variable.name] = computedVariable; } } - return variables; }; - export default computeAuthStepVariables; diff --git a/packages/web/src/helpers/computePermissions.ee.ts b/packages/web/src/helpers/computePermissions.ee.js similarity index 66% rename from packages/web/src/helpers/computePermissions.ee.ts rename to packages/web/src/helpers/computePermissions.ee.js index cda595e9..deded9ff 100644 --- a/packages/web/src/helpers/computePermissions.ee.ts +++ b/packages/web/src/helpers/computePermissions.ee.js @@ -1,20 +1,5 @@ -import { IRole, IPermission } from 'types'; - -type ComputeAction = { - conditions: Record; - value: boolean; -}; -type ComputedActions = Record; -type ComputedPermissions = Record; -export type RoleWithComputedPermissions = IRole & { - computedPermissions: ComputedPermissions; -}; - -export function getRoleWithComputedPermissions( - role?: IRole -): Partial { +export function getRoleWithComputedPermissions(role) { if (!role) return {}; - const computedPermissions = role.permissions.reduce( (computedPermissions, permission) => ({ ...computedPermissions, @@ -28,26 +13,21 @@ export function getRoleWithComputedPermissions( }, }, }), - {} as ComputedPermissions + {} ); - return { ...role, computedPermissions, }; } - -export function getPermissions(computedPermissions?: ComputedPermissions) { +export function getPermissions(computedPermissions) { if (!computedPermissions) return []; - return Object.entries(computedPermissions).reduce( (permissions, computedPermissionEntry) => { const [subject, actionsWithConditions] = computedPermissionEntry; - for (const action in actionsWithConditions) { const { value: permitted, conditions = {} } = actionsWithConditions[action]; - if (permitted) { permissions.push({ action, @@ -58,9 +38,8 @@ export function getPermissions(computedPermissions?: ComputedPermissions) { }); } } - return permissions; }, - [] as Partial[] + [] ); } diff --git a/packages/web/src/helpers/computeVariables.ts b/packages/web/src/helpers/computeVariables.js similarity index 58% rename from packages/web/src/helpers/computeVariables.ts rename to packages/web/src/helpers/computeVariables.js index f953eb1e..a73a65d0 100644 --- a/packages/web/src/helpers/computeVariables.ts +++ b/packages/web/src/helpers/computeVariables.js @@ -1,41 +1,22 @@ import template from 'lodash/template'; -import type { IAuthenticationStepField, IJSONObject } from 'types'; - const interpolate = /{([\s\S]+?)}/g; - -type Variables = { - [key: string]: any; -}; - -type IVariable = Omit & - Partial>; - -const computeAuthStepVariables = ( - variableSchema: IVariable[], - aggregatedData: IJSONObject -): IJSONObject => { - const variables: Variables = {}; - +const computeAuthStepVariables = (variableSchema, aggregatedData) => { + const variables = {}; for (const variable of variableSchema) { if (variable.properties) { variables[variable.name] = computeAuthStepVariables( variable.properties, aggregatedData ); - continue; } - if (variable.value) { const computedVariable = template(variable.value, { interpolate })( aggregatedData ); - variables[variable.name] = computedVariable; } } - return variables; }; - export default computeAuthStepVariables; diff --git a/packages/web/src/helpers/copyInputValue.js b/packages/web/src/helpers/copyInputValue.js new file mode 100644 index 00000000..f2d26956 --- /dev/null +++ b/packages/web/src/helpers/copyInputValue.js @@ -0,0 +1,4 @@ +import copy from 'clipboard-copy'; +export default function copyInputValue(element) { + copy(element.value); +} diff --git a/packages/web/src/helpers/copyInputValue.ts b/packages/web/src/helpers/copyInputValue.ts deleted file mode 100644 index 0afd66db..00000000 --- a/packages/web/src/helpers/copyInputValue.ts +++ /dev/null @@ -1,5 +0,0 @@ -import copy from 'clipboard-copy'; - -export default function copyInputValue(element: HTMLInputElement): void { - copy(element.value); -} diff --git a/packages/web/src/helpers/filterObject.ts b/packages/web/src/helpers/filterObject.js similarity index 93% rename from packages/web/src/helpers/filterObject.ts rename to packages/web/src/helpers/filterObject.js index eb297d78..3e9f9473 100644 --- a/packages/web/src/helpers/filterObject.ts +++ b/packages/web/src/helpers/filterObject.js @@ -2,52 +2,43 @@ import get from 'lodash/get'; import set from 'lodash/set'; import forIn from 'lodash/forIn'; import isPlainObject from 'lodash/isPlainObject'; - export default function filterObject( - data: any, - searchTerm: string, + data, + searchTerm, result = {}, - prefix: string[] = [], + prefix = [], withinArray = false ) { if (withinArray) { const containerValue = get(result, prefix, []); - result = filterObject( data, searchTerm, result, prefix.concat(containerValue.length.toString()) ); - return result; } - if (isPlainObject(data)) { forIn(data, (value, key) => { const fullKey = [...prefix, key]; - if (key.toLowerCase().includes(searchTerm)) { set(result, fullKey, value); return; } - result = filterObject(value, searchTerm, result, fullKey); }); } - if (Array.isArray(data)) { forIn(data, (value) => { result = filterObject(value, searchTerm, result, prefix, true); }); } - if ( ['string', 'number'].includes(typeof data) && String(data).toLowerCase().includes(searchTerm) ) { set(result, prefix, data); } - return result; -}; +} diff --git a/packages/web/src/helpers/isEmpty.ts b/packages/web/src/helpers/isEmpty.js similarity index 86% rename from packages/web/src/helpers/isEmpty.ts rename to packages/web/src/helpers/isEmpty.js index 2365fc09..6d55bc84 100644 --- a/packages/web/src/helpers/isEmpty.ts +++ b/packages/web/src/helpers/isEmpty.js @@ -1,16 +1,12 @@ import lodashIsEmpty from 'lodash/isEmpty'; - -export default function isEmpty(value: any) { +export default function isEmpty(value) { if (value === undefined && value === null) return true; - if (Array.isArray(value) || typeof value === 'string') { return value.length === 0; } - if (!Number.isNaN(value)) { return false; } - // covers objects and anything else possibly return lodashIsEmpty(value); -}; +} diff --git a/packages/web/src/helpers/nestObject.ts b/packages/web/src/helpers/nestObject.js similarity index 64% rename from packages/web/src/helpers/nestObject.ts rename to packages/web/src/helpers/nestObject.js index 3f1b1203..aa23b1e6 100644 --- a/packages/web/src/helpers/nestObject.ts +++ b/packages/web/src/helpers/nestObject.js @@ -1,18 +1,12 @@ -import { IJSONObject } from 'types'; import set from 'lodash/set'; - -export default function nestObject( - config: IJSONObject | undefined -): Partial { +export default function nestObject(config) { if (!config) return {}; const result = {}; - for (const key in config) { if (Object.prototype.hasOwnProperty.call(config, key)) { const value = config[key]; set(result, key, value); } } - return result; } diff --git a/packages/web/src/helpers/storage.js b/packages/web/src/helpers/storage.js new file mode 100644 index 00000000..fb915b37 --- /dev/null +++ b/packages/web/src/helpers/storage.js @@ -0,0 +1,8 @@ +const NAMESPACE = 'automatisch'; +const makeKey = (key) => `${NAMESPACE}.${key}`; +export const setItem = (key, value) => { + return localStorage.setItem(makeKey(key), value); +}; +export const getItem = (key) => { + return localStorage.getItem(makeKey(key)); +}; diff --git a/packages/web/src/helpers/storage.ts b/packages/web/src/helpers/storage.ts deleted file mode 100644 index 3907ce34..00000000 --- a/packages/web/src/helpers/storage.ts +++ /dev/null @@ -1,10 +0,0 @@ -const NAMESPACE = 'automatisch'; -const makeKey = (key: string) => `${NAMESPACE}.${key}`; - -export const setItem = (key: string, value: string) => { - return localStorage.setItem(makeKey(key), value); -}; - -export const getItem = (key: string) => { - return localStorage.getItem(makeKey(key)); -}; diff --git a/packages/web/src/helpers/translationValues.jsx b/packages/web/src/helpers/translationValues.jsx new file mode 100644 index 00000000..f5c9855c --- /dev/null +++ b/packages/web/src/helpers/translationValues.jsx @@ -0,0 +1,12 @@ +import { Link as RouterLink } from 'react-router-dom'; +import Link from '@mui/material/Link'; +export const generateInternalLink = (link) => (str) => ( + + {str} + +); +export const generateExternalLink = (link) => (str) => ( + + {str} + +); diff --git a/packages/web/src/helpers/translationValues.tsx b/packages/web/src/helpers/translationValues.tsx deleted file mode 100644 index 0f64b6c8..00000000 --- a/packages/web/src/helpers/translationValues.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Link as RouterLink } from 'react-router-dom'; -import Link from '@mui/material/Link'; - -export const generateInternalLink = (link: string) => (str: string) => - ( - - {str} - - ); - -export const generateExternalLink = (link: string) => (str: string) => - ( - - {str} - - ); diff --git a/packages/web/src/helpers/userAbility.ts b/packages/web/src/helpers/userAbility.js similarity index 74% rename from packages/web/src/helpers/userAbility.ts rename to packages/web/src/helpers/userAbility.js index 57f82a8a..4114ad25 100644 --- a/packages/web/src/helpers/userAbility.ts +++ b/packages/web/src/helpers/userAbility.js @@ -3,22 +3,17 @@ import { fieldPatternMatcher, mongoQueryMatcher, } from '@casl/ability'; -import { IUser } from 'types'; - // Must be kept in sync with `packages/backend/src/helpers/user-ability.ts`! -export default function userAbility(user: IUser) { +export default function userAbility(user) { const permissions = user?.permissions; const role = user?.role; - // We're not using mongo, but our fields, conditions match const options = { conditionsMatcher: mongoQueryMatcher, fieldMatcher: fieldPatternMatcher, }; - if (!role || !permissions) { return new PureAbility([], options); } - - return new PureAbility<[string, string], string[]>(permissions, options); + return new PureAbility(permissions, options); } diff --git a/packages/web/src/hooks/useApp.ts b/packages/web/src/hooks/useApp.js similarity index 50% rename from packages/web/src/hooks/useApp.ts rename to packages/web/src/hooks/useApp.js index 915d31d6..0fcbc51d 100644 --- a/packages/web/src/hooks/useApp.ts +++ b/packages/web/src/hooks/useApp.js @@ -1,18 +1,10 @@ import { useQuery } from '@apollo/client'; -import { IApp } from 'types'; - import { GET_APP } from 'graphql/queries/get-app'; - -type QueryResponse = { - getApp: IApp; -}; - -export default function useApp(key: string) { - const { data, loading } = useQuery(GET_APP, { +export default function useApp(key) { + const { data, loading } = useQuery(GET_APP, { variables: { key }, }); const app = data?.getApp; - return { app, loading, diff --git a/packages/web/src/hooks/useAppAuthClient.ee.ts b/packages/web/src/hooks/useAppAuthClient.ee.js similarity index 65% rename from packages/web/src/hooks/useAppAuthClient.ee.ts rename to packages/web/src/hooks/useAppAuthClient.ee.js index 5083cc7f..387ea7b5 100644 --- a/packages/web/src/hooks/useAppAuthClient.ee.ts +++ b/packages/web/src/hooks/useAppAuthClient.ee.js @@ -1,27 +1,17 @@ import { useLazyQuery } from '@apollo/client'; -import { AppAuthClient } from 'types'; import * as React from 'react'; - import { GET_APP_AUTH_CLIENT } from 'graphql/queries/get-app-auth-client.ee'; - -type QueryResponse = { - getAppAuthClient: AppAuthClient; -}; - -export default function useAppAuthClient(id?: string) { +export default function useAppAuthClient(id) { const [getAppAuthClient, { data, loading }] = - useLazyQuery(GET_APP_AUTH_CLIENT); + useLazyQuery(GET_APP_AUTH_CLIENT); const appAuthClient = data?.getAppAuthClient; - React.useEffect( function fetchUponId() { if (!id) return; - getAppAuthClient({ variables: { id } }); }, - [id] + [id], ); - return { appAuthClient, loading, diff --git a/packages/web/src/hooks/useAppAuthClients.ee.ts b/packages/web/src/hooks/useAppAuthClients.ee.js similarity index 63% rename from packages/web/src/hooks/useAppAuthClients.ee.ts rename to packages/web/src/hooks/useAppAuthClients.ee.js index a772481c..87ca2d5c 100644 --- a/packages/web/src/hooks/useAppAuthClients.ee.ts +++ b/packages/web/src/hooks/useAppAuthClients.ee.js @@ -1,39 +1,23 @@ import { useLazyQuery } from '@apollo/client'; -import { AppAuthClient } from 'types'; import * as React from 'react'; - import { GET_APP_AUTH_CLIENTS } from 'graphql/queries/get-app-auth-clients.ee'; - -type QueryResponse = { - getAppAuthClients: AppAuthClient[]; -}; - -export default function useAppAuthClient({ - appKey, - active, -}: { - appKey: string; - active?: boolean; -}) { - const [getAppAuthClients, { data, loading }] = useLazyQuery( +export default function useAppAuthClient({ appKey, active }) { + const [getAppAuthClients, { data, loading }] = useLazyQuery( GET_APP_AUTH_CLIENTS, { context: { autoSnackbar: false }, - } + }, ); const appAuthClients = data?.getAppAuthClients; - React.useEffect( function fetchUponAppKey() { if (!appKey) return; - getAppAuthClients({ variables: { appKey, ...(typeof active === 'boolean' && { active }) }, }); }, - [appKey] + [appKey], ); - return { appAuthClients, loading, diff --git a/packages/web/src/hooks/useAppConfig.ee.ts b/packages/web/src/hooks/useAppConfig.ee.js similarity index 55% rename from packages/web/src/hooks/useAppConfig.ee.ts rename to packages/web/src/hooks/useAppConfig.ee.js index 37b1da9e..06d62888 100644 --- a/packages/web/src/hooks/useAppConfig.ee.ts +++ b/packages/web/src/hooks/useAppConfig.ee.js @@ -1,19 +1,11 @@ import { useQuery } from '@apollo/client'; -import { AppConfig } from 'types'; - import { GET_APP_CONFIG } from 'graphql/queries/get-app-config.ee'; - -type QueryResponse = { - getAppConfig: AppConfig; -}; - -export default function useAppConfig(key: string) { - const { data, loading } = useQuery(GET_APP_CONFIG, { +export default function useAppConfig(key) { + const { data, loading } = useQuery(GET_APP_CONFIG, { variables: { key }, context: { autoSnackbar: false }, }); const appConfig = data?.getAppConfig; - return { appConfig, loading, diff --git a/packages/web/src/hooks/useApps.js b/packages/web/src/hooks/useApps.js new file mode 100644 index 00000000..85511ee3 --- /dev/null +++ b/packages/web/src/hooks/useApps.js @@ -0,0 +1,12 @@ +import { useQuery } from '@apollo/client'; +import { GET_APPS } from 'graphql/queries/get-apps'; +export default function useApps(variables) { + const { data, loading } = useQuery(GET_APPS, { + variables, + }); + const apps = data?.getApps; + return { + apps, + loading, + }; +} diff --git a/packages/web/src/hooks/useApps.ts b/packages/web/src/hooks/useApps.ts deleted file mode 100644 index 43ab22ff..00000000 --- a/packages/web/src/hooks/useApps.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { useQuery } from '@apollo/client'; -import { IApp } from 'types'; - -import { GET_APPS } from 'graphql/queries/get-apps'; - -type QueryResponse = { - getApps: IApp[]; -}; - -type UseAppsVariables = { - name?: string; - onlyWithTriggers?: boolean; - onlyWithActions?: boolean; -}; - -export default function useApps(variables?: UseAppsVariables) { - const { data, loading } = useQuery(GET_APPS, { - variables, - }); - const apps = data?.getApps; - - return { - apps, - loading, - }; -} diff --git a/packages/web/src/hooks/useAuthenticateApp.ee.ts b/packages/web/src/hooks/useAuthenticateApp.ee.js similarity index 75% rename from packages/web/src/hooks/useAuthenticateApp.ee.ts rename to packages/web/src/hooks/useAuthenticateApp.ee.js index 8ec620b8..77eb8465 100644 --- a/packages/web/src/hooks/useAuthenticateApp.ee.ts +++ b/packages/web/src/hooks/useAuthenticateApp.ee.js @@ -1,57 +1,31 @@ -import { IApp } from 'types'; import * as React from 'react'; - import { processStep } from 'helpers/authenticationSteps'; import computeAuthStepVariables from 'helpers/computeAuthStepVariables'; import useApp from './useApp'; - -type UseAuthenticateAppParams = { - appKey: string; - appAuthClientId?: string; - useShared?: boolean; - connectionId?: string; -}; - -type AuthenticatePayload = { - fields?: Record; - appAuthClientId?: string; -}; - -function getSteps( - auth: IApp['auth'], - hasConnection: boolean, - useShared: boolean -) { +function getSteps(auth, hasConnection, useShared) { if (hasConnection) { if (useShared) { return auth?.sharedReconnectionSteps; } - return auth?.reconnectionSteps; } - if (useShared) { return auth?.sharedAuthenticationSteps; } - return auth?.authenticationSteps; } - -export default function useAuthenticateApp(payload: UseAuthenticateAppParams) { +export default function useAuthenticateApp(payload) { const { appKey, appAuthClientId, connectionId, useShared = false } = payload; const { app } = useApp(appKey); const [authenticationInProgress, setAuthenticationInProgress] = React.useState(false); const steps = getSteps(app?.auth, !!connectionId, useShared); - const authenticate = React.useMemo(() => { if (!steps?.length) return; - - return async function authenticate(payload: AuthenticatePayload = {}) { + return async function authenticate(payload = {}) { const { fields } = payload; setAuthenticationInProgress(true); - - const response: Record = { + const response = { key: appKey, appAuthClientId: appAuthClientId || payload.appAuthClientId, connection: { @@ -59,35 +33,26 @@ export default function useAuthenticateApp(payload: UseAuthenticateAppParams) { }, fields, }; - let stepIndex = 0; while (stepIndex < steps?.length) { const step = steps[stepIndex]; const variables = computeAuthStepVariables(step.arguments, response); - try { const stepResponse = await processStep(step, variables); - response[step.name] = stepResponse; } catch (err) { console.log(err); - throw err; - setAuthenticationInProgress(false); - break; + throw err; } - stepIndex++; - if (stepIndex === steps.length) { return response; } - setAuthenticationInProgress(false); } }; }, [steps, appKey, appAuthClientId, connectionId]); - return { authenticate, inProgress: authenticationInProgress, diff --git a/packages/web/src/hooks/useAuthentication.ts b/packages/web/src/hooks/useAuthentication.js similarity index 51% rename from packages/web/src/hooks/useAuthentication.ts rename to packages/web/src/hooks/useAuthentication.js index db81449a..f31096f5 100644 --- a/packages/web/src/hooks/useAuthentication.ts +++ b/packages/web/src/hooks/useAuthentication.js @@ -1,16 +1,7 @@ import * as React from 'react'; import { AuthenticationContext } from 'contexts/Authentication'; -import type { AuthenticationContextParams } from 'contexts/Authentication'; - -type UseAuthenticationReturn = { - isAuthenticated: boolean; - token: AuthenticationContextParams['token']; - updateToken: AuthenticationContextParams['updateToken']; -}; - -export default function useAuthentication(): UseAuthenticationReturn { +export default function useAuthentication() { const authenticationContext = React.useContext(AuthenticationContext); - return { token: authenticationContext.token, updateToken: authenticationContext.updateToken, diff --git a/packages/web/src/hooks/useAutomatischInfo.ts b/packages/web/src/hooks/useAutomatischInfo.js similarity index 65% rename from packages/web/src/hooks/useAutomatischInfo.ts rename to packages/web/src/hooks/useAutomatischInfo.js index 483f98ac..b143ad33 100644 --- a/packages/web/src/hooks/useAutomatischInfo.ts +++ b/packages/web/src/hooks/useAutomatischInfo.js @@ -1,15 +1,7 @@ import * as React from 'react'; import { AutomatischInfoContext } from 'contexts/AutomatischInfo'; - -type UseAutomatischInfoReturn = { - isCloud: boolean; - isMation: boolean; - loading: boolean; -}; - -export default function useAutomatischInfo(): UseAutomatischInfoReturn { +export default function useAutomatischInfo() { const automatischInfoContext = React.useContext(AutomatischInfoContext); - return { isCloud: automatischInfoContext.isCloud, isMation: automatischInfoContext.isMation, diff --git a/packages/web/src/hooks/useBillingAndUsageData.ee.ts b/packages/web/src/hooks/useBillingAndUsageData.ee.js similarity index 72% rename from packages/web/src/hooks/useBillingAndUsageData.ee.ts rename to packages/web/src/hooks/useBillingAndUsageData.ee.js index d2bcf48d..999402ff 100644 --- a/packages/web/src/hooks/useBillingAndUsageData.ee.ts +++ b/packages/web/src/hooks/useBillingAndUsageData.ee.js @@ -2,22 +2,16 @@ import * as React from 'react'; import { useQuery } from '@apollo/client'; import { useLocation } from 'react-router-dom'; import { DateTime } from 'luxon'; -import { TSubscription } from 'types'; - import { GET_BILLING_AND_USAGE } from 'graphql/queries/get-billing-and-usage.ee'; - -function transform( - billingAndUsageData: NonNullable -) { +function transform(billingAndUsageData) { const nextBillDate = billingAndUsageData.subscription.nextBillDate; const nextBillDateTitle = nextBillDate.title; const nextBillDateTitleDateObject = DateTime.fromMillis( - Number(nextBillDateTitle) + Number(nextBillDateTitle), ); const formattedNextBillDateTitle = nextBillDateTitleDateObject.isValid ? nextBillDateTitleDateObject.toFormat('LLL dd, yyyy') : nextBillDateTitle; - return { ...billingAndUsageData, subscription: { @@ -29,42 +23,30 @@ function transform( }, }; } - -type UseBillingAndUsageDataReturn = { - subscription: TSubscription; - usage: { - task: number; - }; -} | null; - -export default function useBillingAndUsageData(): UseBillingAndUsageDataReturn { +export default function useBillingAndUsageData() { const location = useLocation(); - const state = location.state as { checkoutCompleted: boolean }; + const state = location.state; const { data, loading, startPolling, stopPolling } = useQuery( - GET_BILLING_AND_USAGE + GET_BILLING_AND_USAGE, ); const checkoutCompleted = state?.checkoutCompleted; const hasSubscription = !!data?.getBillingAndUsage?.subscription?.status; - React.useEffect( function pollDataUntilSubscriptionIsCreated() { if (checkoutCompleted && !hasSubscription) { startPolling(1000); } }, - [checkoutCompleted, hasSubscription, startPolling] + [checkoutCompleted, hasSubscription, startPolling], ); - React.useEffect( function stopPollingWhenSubscriptionIsCreated() { if (checkoutCompleted && hasSubscription) { stopPolling(); } }, - [checkoutCompleted, hasSubscription, stopPolling] + [checkoutCompleted, hasSubscription, stopPolling], ); - if (loading) return null; - return transform(data.getBillingAndUsage); } diff --git a/packages/web/src/hooks/useCloud.ts b/packages/web/src/hooks/useCloud.js similarity index 71% rename from packages/web/src/hooks/useCloud.ts rename to packages/web/src/hooks/useCloud.js index bb0226e7..006f152a 100644 --- a/packages/web/src/hooks/useCloud.ts +++ b/packages/web/src/hooks/useCloud.js @@ -1,20 +1,11 @@ import { useNavigate } from 'react-router-dom'; - import useAutomatischInfo from './useAutomatischInfo'; - -type UseCloudOptions = { - redirect?: boolean; -} - -export default function useCloud(options?: UseCloudOptions): boolean { +export default function useCloud(options) { const redirect = options?.redirect || false; - const { isCloud } = useAutomatischInfo(); const navigate = useNavigate(); - if (isCloud === false && redirect) { navigate('/'); } - return isCloud; } diff --git a/packages/web/src/hooks/useConfig.js b/packages/web/src/hooks/useConfig.js new file mode 100644 index 00000000..72ad0909 --- /dev/null +++ b/packages/web/src/hooks/useConfig.js @@ -0,0 +1,11 @@ +import { useQuery } from '@apollo/client'; +import { GET_CONFIG } from 'graphql/queries/get-config.ee'; +export default function useConfig(keys) { + const { data, loading } = useQuery(GET_CONFIG, { + variables: { keys }, + }); + return { + config: data?.getConfig, + loading, + }; +} diff --git a/packages/web/src/hooks/useConfig.ts b/packages/web/src/hooks/useConfig.ts deleted file mode 100644 index 41fcbcdb..00000000 --- a/packages/web/src/hooks/useConfig.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { useQuery } from '@apollo/client'; -import { IJSONObject } from 'types'; - -import { GET_CONFIG } from 'graphql/queries/get-config.ee'; - -type QueryResponse = { - getConfig: IJSONObject; -}; - -export default function useConfig(keys?: string[]) { - const { data, loading } = useQuery(GET_CONFIG, { - variables: { keys }, - }); - - return { - config: data?.getConfig, - loading, - }; -} diff --git a/packages/web/src/hooks/useCurrentUser.ts b/packages/web/src/hooks/useCurrentUser.js similarity index 69% rename from packages/web/src/hooks/useCurrentUser.ts rename to packages/web/src/hooks/useCurrentUser.js index 024b99b9..33d7b546 100644 --- a/packages/web/src/hooks/useCurrentUser.ts +++ b/packages/web/src/hooks/useCurrentUser.js @@ -1,10 +1,6 @@ import { useQuery } from '@apollo/client'; -import { IUser } from 'types'; - import { GET_CURRENT_USER } from 'graphql/queries/get-current-user'; - -export default function useCurrentUser(): IUser { +export default function useCurrentUser() { const { data } = useQuery(GET_CURRENT_USER); - return data?.getCurrentUser; } diff --git a/packages/web/src/hooks/useCurrentUserAbility.ts b/packages/web/src/hooks/useCurrentUserAbility.js similarity index 99% rename from packages/web/src/hooks/useCurrentUserAbility.ts rename to packages/web/src/hooks/useCurrentUserAbility.js index d27b02a4..7985a67c 100644 --- a/packages/web/src/hooks/useCurrentUserAbility.ts +++ b/packages/web/src/hooks/useCurrentUserAbility.js @@ -1,8 +1,6 @@ import userAbility from 'helpers/userAbility'; import useCurrentUser from 'hooks/useCurrentUser'; - export default function useCurrentUserAbility() { const currentUser = useCurrentUser(); - return userAbility(currentUser); } diff --git a/packages/web/src/hooks/useDynamicData.ts b/packages/web/src/hooks/useDynamicData.js similarity index 88% rename from packages/web/src/hooks/useDynamicData.ts rename to packages/web/src/hooks/useDynamicData.js index dd8b97e6..e6ad5549 100644 --- a/packages/web/src/hooks/useDynamicData.ts +++ b/packages/web/src/hooks/useDynamicData.js @@ -2,40 +2,25 @@ import * as React from 'react'; import { useLazyQuery } from '@apollo/client'; import { useFormContext } from 'react-hook-form'; import set from 'lodash/set'; -import type { UseFormReturn } from 'react-hook-form'; import isEqual from 'lodash/isEqual'; -import type { IField, IFieldDropdownSource, IJSONObject } from 'types'; - import { GET_DYNAMIC_DATA } from 'graphql/queries/get-dynamic-data'; - const variableRegExp = /({.*?})/; - -function computeArguments( - args: IFieldDropdownSource['arguments'], - getValues: UseFormReturn['getValues'] -): IJSONObject { +function computeArguments(args, getValues) { const initialValue = {}; return args.reduce((result, { name, value }) => { const isVariable = variableRegExp.test(value); - if (isVariable) { const sanitizedFieldPath = value.replace(/{|}/g, ''); const computedValue = getValues(sanitizedFieldPath); - if (computedValue === undefined) throw new Error(`The ${sanitizedFieldPath} field is required.`); - set(result, name, computedValue); - return result; } - set(result, name, value); - return result; }, initialValue); } - /** * Fetch the dynamic data for the given step. * This hook must be within a react-hook-form context. @@ -43,13 +28,12 @@ function computeArguments( * @param stepId - the id of the step * @param schema - the field that needs the dynamic data */ -function useDynamicData(stepId: string | undefined, schema: IField) { +function useDynamicData(stepId, schema) { const lastComputedVariables = React.useRef({}); const [getDynamicData, { called, data, loading }] = useLazyQuery(GET_DYNAMIC_DATA); const { getValues } = useFormContext(); const formValues = getValues(); - /** * Return `null` when even a field is missing value. * @@ -60,27 +44,22 @@ function useDynamicData(stepId: string | undefined, schema: IField) { if (schema.type === 'dropdown' && schema.source) { try { const variables = computeArguments(schema.source.arguments, getValues); - // if computed variables are the same, return the last computed variables. if (isEqual(variables, lastComputedVariables.current)) { return lastComputedVariables.current; } - lastComputedVariables.current = variables; - return variables; } catch (err) { return null; } } - return null; /** * `formValues` is to trigger recomputation when form is updated. * `getValues` is for convenience as it supports paths for fields like `getValues('foo.bar.baz')`. */ }, [schema, formValues, getValues]); - React.useEffect(() => { if ( schema.type === 'dropdown' && @@ -96,12 +75,10 @@ function useDynamicData(stepId: string | undefined, schema: IField) { }); } }, [getDynamicData, stepId, schema, computedVariables]); - return { called, data: data?.getDynamicData, loading, }; } - export default useDynamicData; diff --git a/packages/web/src/hooks/useDynamicFields.ts b/packages/web/src/hooks/useDynamicFields.js similarity index 86% rename from packages/web/src/hooks/useDynamicFields.ts rename to packages/web/src/hooks/useDynamicFields.js index 2b022592..dfe2de76 100644 --- a/packages/web/src/hooks/useDynamicFields.ts +++ b/packages/web/src/hooks/useDynamicFields.js @@ -1,46 +1,27 @@ import * as React from 'react'; import { useLazyQuery } from '@apollo/client'; -import type { UseFormReturn } from 'react-hook-form'; import { useFormContext } from 'react-hook-form'; import set from 'lodash/set'; import isEqual from 'lodash/isEqual'; -import type { - IField, - IFieldDropdownAdditionalFields, - IJSONObject, -} from 'types'; - import { GET_DYNAMIC_FIELDS } from 'graphql/queries/get-dynamic-fields'; - const variableRegExp = /({.*?})/; - // TODO: extract this function to a separate file -function computeArguments( - args: IFieldDropdownAdditionalFields['arguments'], - getValues: UseFormReturn['getValues'] -): IJSONObject { +function computeArguments(args, getValues) { const initialValue = {}; return args.reduce((result, { name, value }) => { const isVariable = variableRegExp.test(value); - if (isVariable) { const sanitizedFieldPath = value.replace(/{|}/g, ''); const computedValue = getValues(sanitizedFieldPath); - if (computedValue === undefined || computedValue === '') throw new Error(`The ${sanitizedFieldPath} field is required.`); - set(result, name, computedValue); - return result; } - set(result, name, value); - return result; }, initialValue); } - /** * Fetch the dynamic fields for the given step. * This hook must be within a react-hook-form context. @@ -48,13 +29,12 @@ function computeArguments( * @param stepId - the id of the step * @param schema - the field schema that needs the dynamic fields */ -function useDynamicFields(stepId: string | undefined, schema: IField) { +function useDynamicFields(stepId, schema) { const lastComputedVariables = React.useRef({}); const [getDynamicFields, { called, data, loading }] = useLazyQuery(GET_DYNAMIC_FIELDS); const { getValues } = useFormContext(); const formValues = getValues(); - /** * Return `null` when even a field is missing value. * @@ -66,29 +46,24 @@ function useDynamicFields(stepId: string | undefined, schema: IField) { try { const variables = computeArguments( schema.additionalFields.arguments, - getValues + getValues, ); - // if computed variables are the same, return the last computed variables. if (isEqual(variables, lastComputedVariables.current)) { return lastComputedVariables.current; } - lastComputedVariables.current = variables; - return variables; } catch (err) { return null; } } - return null; /** * `formValues` is to trigger recomputation when form is updated. * `getValues` is for convenience as it supports paths for fields like `getValues('foo.bar.baz')`. */ }, [schema, formValues, getValues]); - React.useEffect(() => { if ( schema.type === 'dropdown' && @@ -104,12 +79,10 @@ function useDynamicFields(stepId: string | undefined, schema: IField) { }); } }, [getDynamicFields, stepId, schema, computedVariables]); - return { called, - data: data?.getDynamicFields as IField[] | undefined, + data: data?.getDynamicFields, loading, }; } - export default useDynamicFields; diff --git a/packages/web/src/hooks/useEnqueueSnackbar.js b/packages/web/src/hooks/useEnqueueSnackbar.js new file mode 100644 index 00000000..5010be90 --- /dev/null +++ b/packages/web/src/hooks/useEnqueueSnackbar.js @@ -0,0 +1,18 @@ +import { useSnackbar } from 'notistack'; +export default function useEnqueueSnackbar() { + const { enqueueSnackbar, closeSnackbar } = useSnackbar(); + return function wrappedEnqueueSnackbar(message, options) { + const key = enqueueSnackbar(message, { + ...(options || {}), + SnackbarProps: { + onClick: () => closeSnackbar(key), + ...{ + 'data-test': 'snackbar', + 'data-snackbar-variant': `${options.variant}` || 'default', + }, + ...(options.SnackbarProps || {}), + }, + }); + return key; + }; +} diff --git a/packages/web/src/hooks/useEnqueueSnackbar.ts b/packages/web/src/hooks/useEnqueueSnackbar.ts deleted file mode 100644 index 356ec8e0..00000000 --- a/packages/web/src/hooks/useEnqueueSnackbar.ts +++ /dev/null @@ -1,34 +0,0 @@ -import type { - OptionsWithExtraProps, - SnackbarMessage, - VariantType, - SnackbarKey -} from 'notistack'; -import { useSnackbar } from 'notistack'; - -type ExtendedOptionsWithExtraProps = OptionsWithExtraProps & { - SnackbarProps?: OptionsWithExtraProps & { 'data-test'?: string; } -} - -export default function useEnqueueSnackbar() { - const { enqueueSnackbar, closeSnackbar } = useSnackbar(); - - return function wrappedEnqueueSnackbar(message: SnackbarMessage, options: ExtendedOptionsWithExtraProps) { - const key: SnackbarKey = enqueueSnackbar( - message, - { - ...(options || {}) as Record, - SnackbarProps: { - onClick: () => closeSnackbar(key), - ...({ - 'data-test': 'snackbar', // keep above options.snackbarProps - 'data-snackbar-variant': `${options.variant}` || 'default', - }) as Record, - ...(options.SnackbarProps || {}) as Record, - } - } - ); - - return key; - }; -} diff --git a/packages/web/src/hooks/useFormatMessage.js b/packages/web/src/hooks/useFormatMessage.js new file mode 100644 index 00000000..ef76fe0c --- /dev/null +++ b/packages/web/src/hooks/useFormatMessage.js @@ -0,0 +1,5 @@ +import { useIntl } from 'react-intl'; +export default function useFormatMessage() { + const { formatMessage } = useIntl(); + return (id, values = {}) => formatMessage({ id }, values); +} diff --git a/packages/web/src/hooks/useFormatMessage.ts b/packages/web/src/hooks/useFormatMessage.ts deleted file mode 100644 index e791d721..00000000 --- a/packages/web/src/hooks/useFormatMessage.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { useIntl } from 'react-intl'; - -type Values = { - [key: string]: any; -}; - -export default function useFormatMessage(): ( - id: string, - values?: Values -) => string { - const { formatMessage } = useIntl(); - - return (id: string, values: Values = {}) => formatMessage({ id }, values); -} diff --git a/packages/web/src/hooks/useInvoices.ee.ts b/packages/web/src/hooks/useInvoices.ee.js similarity index 58% rename from packages/web/src/hooks/useInvoices.ee.ts rename to packages/web/src/hooks/useInvoices.ee.js index 3f76ec0d..fb78a087 100644 --- a/packages/web/src/hooks/useInvoices.ee.ts +++ b/packages/web/src/hooks/useInvoices.ee.js @@ -1,16 +1,7 @@ import { useQuery } from '@apollo/client'; -import { TInvoice } from 'types'; - import { GET_INVOICES } from 'graphql/queries/get-invoices.ee'; - -type UseInvoicesReturn = { - invoices: TInvoice[]; - loading: boolean; -}; - -export default function useInvoices(): UseInvoicesReturn { +export default function useInvoices() { const { data, loading } = useQuery(GET_INVOICES); - return { invoices: data?.getInvoices || [], loading: loading, diff --git a/packages/web/src/hooks/useNotifications.ts b/packages/web/src/hooks/useNotifications.js similarity index 57% rename from packages/web/src/hooks/useNotifications.ts rename to packages/web/src/hooks/useNotifications.js index 37a84f7a..d0477c6d 100644 --- a/packages/web/src/hooks/useNotifications.ts +++ b/packages/web/src/hooks/useNotifications.js @@ -1,18 +1,8 @@ import { useQuery } from '@apollo/client'; -import type { Notification } from 'types'; - import { GET_NOTIFICATIONS } from 'graphql/queries/get-notifications'; - -type UseNotificationsReturn = { - notifications: Notification[]; - loading: boolean; -}; - -export default function useNotifications(): UseNotificationsReturn { +export default function useNotifications() { const { data, loading } = useQuery(GET_NOTIFICATIONS); - const notifications = data?.getNotifications || []; - return { loading, notifications, diff --git a/packages/web/src/hooks/usePaddle.ee.ts b/packages/web/src/hooks/usePaddle.ee.js similarity index 64% rename from packages/web/src/hooks/usePaddle.ee.ts rename to packages/web/src/hooks/usePaddle.ee.js index 747f0661..7a85cc1b 100644 --- a/packages/web/src/hooks/usePaddle.ee.ts +++ b/packages/web/src/hooks/usePaddle.ee.js @@ -1,13 +1,7 @@ import * as React from 'react'; import { PaddleContext } from 'contexts/Paddle.ee'; - -type UsePaddleReturn = { - loaded: boolean; -}; - -export default function usePaddle(): UsePaddleReturn { +export default function usePaddle() { const paddleContext = React.useContext(PaddleContext); - return { loaded: paddleContext.loaded, }; diff --git a/packages/web/src/hooks/usePaddleInfo.ee.ts b/packages/web/src/hooks/usePaddleInfo.ee.js similarity index 61% rename from packages/web/src/hooks/usePaddleInfo.ee.ts rename to packages/web/src/hooks/usePaddleInfo.ee.js index 85ff5905..b0ff9a7c 100644 --- a/packages/web/src/hooks/usePaddleInfo.ee.ts +++ b/packages/web/src/hooks/usePaddleInfo.ee.js @@ -1,19 +1,10 @@ import { useQuery } from '@apollo/client'; - import { GET_PADDLE_INFO } from 'graphql/queries/get-paddle-info.ee'; - -type UsePaddleInfoReturn = { - sandbox: boolean; - vendorId: string; - loading: boolean; -}; - -export default function usePaddleInfo(): UsePaddleInfoReturn { +export default function usePaddleInfo() { const { data, loading } = useQuery(GET_PADDLE_INFO); - return { sandbox: data?.getPaddleInfo?.sandbox, vendorId: data?.getPaddleInfo?.vendorId, - loading + loading, }; } diff --git a/packages/web/src/hooks/usePaymentPlans.ee.ts b/packages/web/src/hooks/usePaymentPlans.ee.js similarity index 56% rename from packages/web/src/hooks/usePaymentPlans.ee.ts rename to packages/web/src/hooks/usePaymentPlans.ee.js index 24f0d90d..c8744364 100644 --- a/packages/web/src/hooks/usePaymentPlans.ee.ts +++ b/packages/web/src/hooks/usePaymentPlans.ee.js @@ -1,16 +1,7 @@ import { useQuery } from '@apollo/client'; - -import { TPaymentPlan } from 'types'; import { GET_PAYMENT_PLANS } from 'graphql/queries/get-payment-plans.ee'; - -type UsePaymentPlansReturn = { - plans: TPaymentPlan[]; - loading: boolean; -}; - -export default function usePaymentPlans(): UsePaymentPlansReturn { +export default function usePaymentPlans() { const { data, loading } = useQuery(GET_PAYMENT_PLANS); - return { plans: data?.getPaymentPlans || [], loading, diff --git a/packages/web/src/hooks/usePermissionCatalog.ee.ts b/packages/web/src/hooks/usePermissionCatalog.ee.js similarity index 53% rename from packages/web/src/hooks/usePermissionCatalog.ee.ts rename to packages/web/src/hooks/usePermissionCatalog.ee.js index 71bacd79..530595f5 100644 --- a/packages/web/src/hooks/usePermissionCatalog.ee.ts +++ b/packages/web/src/hooks/usePermissionCatalog.ee.js @@ -1,15 +1,6 @@ import { useQuery } from '@apollo/client'; -import { IPermissionCatalog } from 'types'; - import { GET_PERMISSION_CATALOG } from 'graphql/queries/get-permission-catalog.ee'; - -type UsePermissionCatalogReturn = { - permissionCatalog: IPermissionCatalog; - loading: boolean; -}; - -export default function usePermissionCatalog(): UsePermissionCatalogReturn { +export default function usePermissionCatalog() { const { data, loading } = useQuery(GET_PERMISSION_CATALOG); - return { permissionCatalog: data?.getPermissionCatalog, loading }; } diff --git a/packages/web/src/hooks/useRole.ee.ts b/packages/web/src/hooks/useRole.ee.js similarity index 61% rename from packages/web/src/hooks/useRole.ee.ts rename to packages/web/src/hooks/useRole.ee.js index 4dea8cf3..1f2d86bf 100644 --- a/packages/web/src/hooks/useRole.ee.ts +++ b/packages/web/src/hooks/useRole.ee.js @@ -1,16 +1,8 @@ import * as React from 'react'; import { useLazyQuery } from '@apollo/client'; -import { IRole } from 'types'; - import { GET_ROLE } from 'graphql/queries/get-role.ee'; - -type QueryResponse = { - getRole: IRole; -}; - -export default function useRole(roleId?: string) { - const [getRole, { data, loading }] = useLazyQuery(GET_ROLE); - +export default function useRole(roleId) { + const [getRole, { data, loading }] = useLazyQuery(GET_ROLE); React.useEffect(() => { if (roleId) { getRole({ @@ -20,7 +12,6 @@ export default function useRole(roleId?: string) { }); } }, [roleId]); - return { role: data?.getRole, loading, diff --git a/packages/web/src/hooks/useRoles.ee.ts b/packages/web/src/hooks/useRoles.ee.js similarity index 62% rename from packages/web/src/hooks/useRoles.ee.ts rename to packages/web/src/hooks/useRoles.ee.js index dc11c7af..7f99bef0 100644 --- a/packages/web/src/hooks/useRoles.ee.ts +++ b/packages/web/src/hooks/useRoles.ee.js @@ -1,17 +1,9 @@ import { useQuery } from '@apollo/client'; -import { IRole } from 'types'; - import { GET_ROLES } from 'graphql/queries/get-roles.ee'; - -type QueryResponse = { - getRoles: IRole[]; -}; - export default function useRoles() { - const { data, loading } = useQuery(GET_ROLES, { + const { data, loading } = useQuery(GET_ROLES, { context: { autoSnackbar: false }, }); - return { roles: data?.getRoles || [], loading, diff --git a/packages/web/src/hooks/useSamlAuthProvider.js b/packages/web/src/hooks/useSamlAuthProvider.js new file mode 100644 index 00000000..58a7a4ce --- /dev/null +++ b/packages/web/src/hooks/useSamlAuthProvider.js @@ -0,0 +1,12 @@ +import { useQuery } from '@apollo/client'; +import { GET_SAML_AUTH_PROVIDER } from 'graphql/queries/get-saml-auth-provider'; +export default function useSamlAuthProvider() { + const { data, loading, refetch } = useQuery(GET_SAML_AUTH_PROVIDER, { + context: { autoSnackbar: false }, + }); + return { + provider: data?.getSamlAuthProvider, + loading, + refetch, + }; +} diff --git a/packages/web/src/hooks/useSamlAuthProvider.ts b/packages/web/src/hooks/useSamlAuthProvider.ts deleted file mode 100644 index 8cc1d5db..00000000 --- a/packages/web/src/hooks/useSamlAuthProvider.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { QueryResult, useQuery } from '@apollo/client'; - -import { TSamlAuthProvider } from 'types'; -import { GET_SAML_AUTH_PROVIDER } from 'graphql/queries/get-saml-auth-provider'; - -type UseSamlAuthProviderReturn = { - provider?: TSamlAuthProvider; - loading: boolean; - refetch: QueryResult['refetch']; -}; - -export default function useSamlAuthProvider(): UseSamlAuthProviderReturn { - const { data, loading, refetch } = useQuery(GET_SAML_AUTH_PROVIDER, { - context: { autoSnackbar: false }, - }); - - return { - provider: data?.getSamlAuthProvider, - loading, - refetch, - }; -} diff --git a/packages/web/src/hooks/useSamlAuthProviderRoleMappings.ts b/packages/web/src/hooks/useSamlAuthProviderRoleMappings.js similarity index 64% rename from packages/web/src/hooks/useSamlAuthProviderRoleMappings.ts rename to packages/web/src/hooks/useSamlAuthProviderRoleMappings.js index e38c5ae1..a76dba4c 100644 --- a/packages/web/src/hooks/useSamlAuthProviderRoleMappings.ts +++ b/packages/web/src/hooks/useSamlAuthProviderRoleMappings.js @@ -1,17 +1,10 @@ import * as React from 'react'; import { useLazyQuery } from '@apollo/client'; -import { TSamlAuthProviderRole } from 'types'; - import { GET_SAML_AUTH_PROVIDER_ROLE_MAPPINGS } from 'graphql/queries/get-saml-auth-provider-role-mappings'; - -type QueryResponse = { - getSamlAuthProviderRoleMappings: TSamlAuthProviderRole[]; -}; - -export default function useSamlAuthProviderRoleMappings(providerId?: string) { - const [getSamlAuthProviderRoleMappings, { data, loading }] = - useLazyQuery(GET_SAML_AUTH_PROVIDER_ROLE_MAPPINGS); - +export default function useSamlAuthProviderRoleMappings(providerId) { + const [getSamlAuthProviderRoleMappings, { data, loading }] = useLazyQuery( + GET_SAML_AUTH_PROVIDER_ROLE_MAPPINGS, + ); React.useEffect(() => { if (providerId) { getSamlAuthProviderRoleMappings({ @@ -21,7 +14,6 @@ export default function useSamlAuthProviderRoleMappings(providerId?: string) { }); } }, [providerId]); - return { roleMappings: data?.getSamlAuthProviderRoleMappings || [], loading, diff --git a/packages/web/src/hooks/useSamlAuthProviders.ee.ts b/packages/web/src/hooks/useSamlAuthProviders.ee.js similarity index 55% rename from packages/web/src/hooks/useSamlAuthProviders.ee.ts rename to packages/web/src/hooks/useSamlAuthProviders.ee.js index 6ad30de6..1bfcedf7 100644 --- a/packages/web/src/hooks/useSamlAuthProviders.ee.ts +++ b/packages/web/src/hooks/useSamlAuthProviders.ee.js @@ -1,16 +1,7 @@ import { useQuery } from '@apollo/client'; - -import { TSamlAuthProvider } from 'types'; import { LIST_SAML_AUTH_PROVIDERS } from 'graphql/queries/list-saml-auth-providers.ee'; - -type UseSamlAuthProvidersReturn = { - providers: TSamlAuthProvider[]; - loading: boolean; -}; - -export default function useSamlAuthProviders(): UseSamlAuthProvidersReturn { +export default function useSamlAuthProviders() { const { data, loading } = useQuery(LIST_SAML_AUTH_PROVIDERS); - return { providers: data?.listSamlAuthProviders || [], loading, diff --git a/packages/web/src/hooks/useSubscriptionStatus.ee.js b/packages/web/src/hooks/useSubscriptionStatus.ee.js new file mode 100644 index 00000000..005e889e --- /dev/null +++ b/packages/web/src/hooks/useSubscriptionStatus.ee.js @@ -0,0 +1,21 @@ +import { useQuery } from '@apollo/client'; +import { DateTime } from 'luxon'; +import { GET_SUBSCRIPTION_STATUS } from 'graphql/queries/get-subscription-status.ee'; +import useFormatMessage from './useFormatMessage'; +export default function useSubscriptionStatus() { + const formatMessage = useFormatMessage(); + const { data, loading } = useQuery(GET_SUBSCRIPTION_STATUS); + const cancellationEffectiveDate = + data?.getSubscriptionStatus?.cancellationEffectiveDate; + const hasCancelled = !!cancellationEffectiveDate; + if (loading || !hasCancelled) return null; + const cancellationEffectiveDateObject = DateTime.fromMillis( + Number(cancellationEffectiveDate), + ).startOf('day'); + return { + message: formatMessage('subscriptionCancelledAlert.text', { + date: cancellationEffectiveDateObject.toFormat('DDD'), + }), + cancellationEffectiveDate: cancellationEffectiveDateObject, + }; +} diff --git a/packages/web/src/hooks/useSubscriptionStatus.ee.ts b/packages/web/src/hooks/useSubscriptionStatus.ee.ts deleted file mode 100644 index 853c6424..00000000 --- a/packages/web/src/hooks/useSubscriptionStatus.ee.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { useQuery } from '@apollo/client'; -import { DateTime } from 'luxon'; - -import { GET_SUBSCRIPTION_STATUS } from 'graphql/queries/get-subscription-status.ee'; -import useFormatMessage from './useFormatMessage'; - -type UseSubscriptionStatusReturn = { - cancellationEffectiveDate: DateTime; - message: string; -} | null; - -export default function useSubscriptionStatus(): UseSubscriptionStatusReturn { - const formatMessage = useFormatMessage(); - const { data, loading, } = useQuery(GET_SUBSCRIPTION_STATUS); - const cancellationEffectiveDate = data?.getSubscriptionStatus?.cancellationEffectiveDate as string; - const hasCancelled = !!cancellationEffectiveDate; - - if (loading || !hasCancelled) return null; - - const cancellationEffectiveDateObject = DateTime.fromMillis(Number(cancellationEffectiveDate)).startOf('day'); - - return { - message: formatMessage( - 'subscriptionCancelledAlert.text', - { - date: cancellationEffectiveDateObject.toFormat('DDD') - } - ), - cancellationEffectiveDate: cancellationEffectiveDateObject, - }; -} diff --git a/packages/web/src/hooks/useTrialStatus.ee.ts b/packages/web/src/hooks/useTrialStatus.ee.js similarity index 51% rename from packages/web/src/hooks/useTrialStatus.ee.ts rename to packages/web/src/hooks/useTrialStatus.ee.js index edf67a96..6b0ddee5 100644 --- a/packages/web/src/hooks/useTrialStatus.ee.ts +++ b/packages/web/src/hooks/useTrialStatus.ee.js @@ -2,87 +2,73 @@ import * as React from 'react'; import { useQuery } from '@apollo/client'; import { useLocation } from 'react-router-dom'; import { DateTime } from 'luxon'; - import { GET_TRIAL_STATUS } from 'graphql/queries/get-trial-status.ee'; import useFormatMessage from './useFormatMessage'; - -type UseTrialStatusReturn = { - expireAt: DateTime; - message: string; - over: boolean; - status: 'error' | 'warning'; -} | null; - -function getDiffInDays(date: DateTime) { +function getDiffInDays(date) { const today = DateTime.now().startOf('day'); const diffInDays = date.diff(today, 'days').days; const roundedDiffInDays = Math.round(diffInDays); - return roundedDiffInDays; } - -function getFeedbackPayload(date: DateTime) { +function getFeedbackPayload(date) { const diffInDays = getDiffInDays(date); - if (diffInDays <= -1) { return { translationEntryId: 'trialBadge.over', - status: 'error' as const, + status: 'error', over: true, }; } else if (diffInDays <= 0) { return { translationEntryId: 'trialBadge.endsToday', - status: 'warning' as const, + status: 'warning', over: false, - } + }; } else { return { translationEntryId: 'trialBadge.xDaysLeft', translationEntryValues: { - remainingDays: diffInDays + remainingDays: diffInDays, }, - status: 'warning' as const, + status: 'warning', over: false, - } + }; } } - -export default function useTrialStatus(): UseTrialStatusReturn { +export default function useTrialStatus() { const formatMessage = useFormatMessage(); const location = useLocation(); - const state = location.state as { checkoutCompleted: boolean }; + const state = location.state; const checkoutCompleted = state?.checkoutCompleted; - const { data, loading, startPolling, stopPolling } = useQuery(GET_TRIAL_STATUS); + const { data, loading, startPolling, stopPolling } = + useQuery(GET_TRIAL_STATUS); const hasTrial = !!data?.getTrialStatus?.expireAt; - - React.useEffect(function pollDataUntilTrialEnds() { - if (checkoutCompleted && hasTrial) { - startPolling(1000); - } - }, [checkoutCompleted, hasTrial, startPolling]); - - React.useEffect(function stopPollingWhenTrialEnds() { - if (checkoutCompleted && !hasTrial) { - stopPolling(); - } - }, [checkoutCompleted, hasTrial, stopPolling]); - + React.useEffect( + function pollDataUntilTrialEnds() { + if (checkoutCompleted && hasTrial) { + startPolling(1000); + } + }, + [checkoutCompleted, hasTrial, startPolling], + ); + React.useEffect( + function stopPollingWhenTrialEnds() { + if (checkoutCompleted && !hasTrial) { + stopPolling(); + } + }, + [checkoutCompleted, hasTrial, stopPolling], + ); if (loading || !data.getTrialStatus) return null; - - const expireAt = DateTime.fromMillis(Number(data.getTrialStatus.expireAt)).startOf('day'); - - const { - translationEntryId, - translationEntryValues, - status, - over, - } = getFeedbackPayload(expireAt); - + const expireAt = DateTime.fromMillis( + Number(data.getTrialStatus.expireAt), + ).startOf('day'); + const { translationEntryId, translationEntryValues, status, over } = + getFeedbackPayload(expireAt); return { message: formatMessage(translationEntryId, translationEntryValues), expireAt, over, - status + status, }; } diff --git a/packages/web/src/hooks/useUser.ts b/packages/web/src/hooks/useUser.js similarity index 61% rename from packages/web/src/hooks/useUser.ts rename to packages/web/src/hooks/useUser.js index c67194b2..df05c73c 100644 --- a/packages/web/src/hooks/useUser.ts +++ b/packages/web/src/hooks/useUser.js @@ -1,16 +1,8 @@ import * as React from 'react'; import { useLazyQuery } from '@apollo/client'; -import { IUser } from 'types'; - import { GET_USER } from 'graphql/queries/get-user'; - -type QueryResponse = { - getUser: IUser; -}; - -export default function useUser(userId?: string) { - const [getUser, { data, loading }] = useLazyQuery(GET_USER); - +export default function useUser(userId) { + const [getUser, { data, loading }] = useLazyQuery(GET_USER); React.useEffect(() => { if (userId) { getUser({ @@ -20,7 +12,6 @@ export default function useUser(userId?: string) { }); } }, [userId]); - return { user: data?.getUser, loading, diff --git a/packages/web/src/hooks/useUsers.ts b/packages/web/src/hooks/useUsers.js similarity index 50% rename from packages/web/src/hooks/useUsers.ts rename to packages/web/src/hooks/useUsers.js index a720d889..8b6c9ba2 100644 --- a/packages/web/src/hooks/useUsers.ts +++ b/packages/web/src/hooks/useUsers.js @@ -1,36 +1,16 @@ import { useQuery } from '@apollo/client'; -import { IUser } from 'types'; - import { GET_USERS } from 'graphql/queries/get-users'; - -type Edge = { - node: IUser; -}; - -type QueryResponse = { - getUsers: { - pageInfo: { - currentPage: number; - totalPages: number; - }; - totalCount: number; - edges: Edge[]; - }; -}; - -const getLimitAndOffset = (page: number, rowsPerPage: number) => ({ +const getLimitAndOffset = (page, rowsPerPage) => ({ limit: rowsPerPage, offset: page * rowsPerPage, }); - -export default function useUsers(page: number, rowsPerPage: number) { - const { data, loading } = useQuery(GET_USERS, { +export default function useUsers(page, rowsPerPage) { + const { data, loading } = useQuery(GET_USERS, { variables: getLimitAndOffset(page, rowsPerPage), }); const users = data?.getUsers.edges.map(({ node }) => node) || []; const pageInfo = data?.getUsers.pageInfo; const totalCount = data?.getUsers.totalCount; - return { users, pageInfo, diff --git a/packages/web/src/hooks/useVersion.ts b/packages/web/src/hooks/useVersion.js similarity index 85% rename from packages/web/src/hooks/useVersion.ts rename to packages/web/src/hooks/useVersion.js index 67fbae9e..475b7d13 100644 --- a/packages/web/src/hooks/useVersion.ts +++ b/packages/web/src/hooks/useVersion.js @@ -1,32 +1,21 @@ import { useQuery } from '@apollo/client'; import { compare } from 'compare-versions'; - import { HEALTHCHECK } from 'graphql/queries/healthcheck'; import useNotifications from 'hooks/useNotifications'; - -type TVersionInfo = { - version: string; - newVersionCount: number; -}; - -export default function useVersion(): TVersionInfo { +export default function useVersion() { const { notifications } = useNotifications(); const { data } = useQuery(HEALTHCHECK, { fetchPolicy: 'cache-and-network' }); const version = data?.healthcheck.version; - const newVersionCount = notifications.reduce((count, notification) => { if (!version) return 0; - // an unexpectedly invalid version would throw and thus, try-catch. try { const isNewer = compare(version, notification.name, '<'); - return isNewer ? count + 1 : count; } catch { return count; } }, 0); - return { version, newVersionCount, diff --git a/packages/web/src/index.tsx b/packages/web/src/index.jsx similarity index 95% rename from packages/web/src/index.tsx rename to packages/web/src/index.jsx index 0ced00a4..dc1c0f21 100644 --- a/packages/web/src/index.tsx +++ b/packages/web/src/index.jsx @@ -1,4 +1,3 @@ -import React from 'react'; import ReactDOM from 'react-dom'; import ThemeProvider from 'components/ThemeProvider'; import IntlProvider from 'components/IntlProvider'; @@ -11,7 +10,6 @@ import Router from 'components/Router'; import LiveChat from 'components/LiveChat/index.ee'; import routes from 'routes'; import reportWebVitals from './reportWebVitals'; - ReactDOM.render( @@ -32,9 +30,8 @@ ReactDOM.render( , - document.getElementById('root') + document.getElementById('root'), ); - // If you want to start measuring performance in your app, pass a function // to log results (for example: reportWebVitals(console.log)) // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals diff --git a/packages/web/src/pages/AdminApplication/index.tsx b/packages/web/src/pages/AdminApplication/index.jsx similarity index 96% rename from packages/web/src/pages/AdminApplication/index.tsx rename to packages/web/src/pages/AdminApplication/index.jsx index 19c6fa1a..b42d3d11 100644 --- a/packages/web/src/pages/AdminApplication/index.tsx +++ b/packages/web/src/pages/AdminApplication/index.jsx @@ -15,11 +15,9 @@ import Box from '@mui/material/Box'; import Grid from '@mui/material/Grid'; import Tabs from '@mui/material/Tabs'; import Tab from '@mui/material/Tab'; - import useFormatMessage from 'hooks/useFormatMessage'; import { GET_APP } from 'graphql/queries/get-app'; import * as URLS from 'config/urls'; - import AppIcon from 'components/AppIcon'; import Container from 'components/Container'; import PageTitle from 'components/PageTitle'; @@ -27,17 +25,11 @@ import AdminApplicationSettings from 'components/AdminApplicationSettings'; import AdminApplicationAuthClients from 'components/AdminApplicationAuthClients'; import AdminApplicationCreateAuthClient from 'components/AdminApplicationCreateAuthClient'; import AdminApplicationUpdateAuthClient from 'components/AdminApplicationUpdateAuthClient'; - -type AdminApplicationParams = { - appKey: string; -}; - -export default function AdminApplication(): React.ReactElement | null { +export default function AdminApplication() { const theme = useTheme(); const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md')); const formatMessage = useFormatMessage(); const navigate = useNavigate(); - const connectionsPathMatch = useMatch({ path: URLS.ADMIN_APP_CONNECTIONS_PATTERN, end: false, @@ -50,16 +42,11 @@ export default function AdminApplication(): React.ReactElement | null { path: URLS.ADMIN_APP_AUTH_CLIENTS_PATTERN, end: false, }); - - const { appKey } = useParams() as AdminApplicationParams; + const { appKey } = useParams(); const { data, loading } = useQuery(GET_APP, { variables: { key: appKey } }); - const app = data?.getApp || {}; - const goToAuthClientsPage = () => navigate('auth-clients'); - if (loading) return null; - return ( <> diff --git a/packages/web/src/pages/AdminApplications/index.tsx b/packages/web/src/pages/AdminApplications/index.jsx similarity index 96% rename from packages/web/src/pages/AdminApplications/index.tsx rename to packages/web/src/pages/AdminApplications/index.jsx index d9b753dd..54e5ce5e 100644 --- a/packages/web/src/pages/AdminApplications/index.tsx +++ b/packages/web/src/pages/AdminApplications/index.jsx @@ -3,17 +3,13 @@ import Grid from '@mui/material/Grid'; import CircularProgress from '@mui/material/CircularProgress'; import Divider from '@mui/material/Divider'; import { useQuery } from '@apollo/client'; -import { IApp } from 'types'; - import PageTitle from 'components/PageTitle'; import Container from 'components/Container'; import SearchInput from 'components/SearchInput'; import AppRow from 'components/AppRow'; - import * as URLS from 'config/urls'; import useFormatMessage from 'hooks/useFormatMessage'; import { GET_APPS } from 'graphql/queries/get-apps'; - function AdminApplications() { const formatMessage = useFormatMessage(); const [appName, setAppName] = React.useState(null); @@ -21,11 +17,9 @@ function AdminApplications() { variables: { name: appName }, }); const apps = data?.getApps; - const onSearchChange = React.useCallback((event) => { setAppName(event.target.value); }, []); - return ( @@ -50,7 +44,7 @@ function AdminApplications() { )} {!appsLoading && - apps?.map((app: IApp) => ( + apps?.map((app) => ( @@ -59,5 +53,4 @@ function AdminApplications() { ); } - export default AdminApplications; diff --git a/packages/web/src/pages/Application/index.tsx b/packages/web/src/pages/Application/index.jsx similarity index 92% rename from packages/web/src/pages/Application/index.tsx rename to packages/web/src/pages/Application/index.jsx index 8db364c6..a7ff4966 100644 --- a/packages/web/src/pages/Application/index.tsx +++ b/packages/web/src/pages/Application/index.jsx @@ -17,12 +17,10 @@ import Grid from '@mui/material/Grid'; import Tabs from '@mui/material/Tabs'; import Tab from '@mui/material/Tab'; import AddIcon from '@mui/icons-material/Add'; - import useFormatMessage from 'hooks/useFormatMessage'; import useAppConfig from 'hooks/useAppConfig.ee'; import { GET_APP } from 'graphql/queries/get-app'; import * as URLS from 'config/urls'; - import SplitButton from 'components/SplitButton'; import ConditionalIconButton from 'components/ConditionalIconButton'; import AppConnections from 'components/AppConnections'; @@ -31,23 +29,9 @@ import AddAppConnection from 'components/AddAppConnection'; import AppIcon from 'components/AppIcon'; import Container from 'components/Container'; import PageTitle from 'components/PageTitle'; - -type ApplicationParams = { - appKey: string; - connectionId?: string; -}; - -type ConnectionOption = { - key: string; - label: string; - 'data-test': string; - to: string; -}; - -const ReconnectConnection = (props: any): React.ReactElement => { +const ReconnectConnection = (props) => { const { application, onClose } = props; - const { connectionId } = useParams() as ApplicationParams; - + const { connectionId } = useParams(); return ( { /> ); }; - -export default function Application(): React.ReactElement | null { +export default function Application() { const theme = useTheme(); const matchSmallScreens = useMediaQuery(theme.breakpoints.down('md')); const formatMessage = useFormatMessage(); @@ -67,19 +50,17 @@ export default function Application(): React.ReactElement | null { }); const flowsPathMatch = useMatch({ path: URLS.APP_FLOWS_PATTERN, end: false }); const [searchParams] = useSearchParams(); - const { appKey } = useParams() as ApplicationParams; + const { appKey } = useParams(); const navigate = useNavigate(); const { data, loading } = useQuery(GET_APP, { variables: { key: appKey } }); const { appConfig } = useAppConfig(appKey); - const connectionId = searchParams.get('connectionId') || undefined; const goToApplicationPage = () => navigate('connections'); const app = data?.getApp || {}; - const connectionOptions = React.useMemo(() => { const shouldHaveCustomConnection = appConfig?.canConnect && appConfig?.canCustomConnect; - const options: ConnectionOption[] = [ + const options = [ { label: formatMessage('app.addConnection'), key: 'addConnection', @@ -87,7 +68,6 @@ export default function Application(): React.ReactElement | null { to: URLS.APP_ADD_CONNECTION(appKey, appConfig?.canConnect), }, ]; - if (shouldHaveCustomConnection) { options.push({ label: formatMessage('app.addCustomConnection'), @@ -96,12 +76,9 @@ export default function Application(): React.ReactElement | null { to: URLS.APP_ADD_CONNECTION(appKey), }); } - return options; }, [appKey, appConfig]); - if (loading) return null; - return ( <> @@ -132,7 +109,7 @@ export default function Application(): React.ReactElement | null { component={Link} to={URLS.CREATE_FLOW_WITH_APP_AND_CONNECTION( appKey, - connectionId + connectionId, )} fullWidth icon={} diff --git a/packages/web/src/pages/Applications/index.tsx b/packages/web/src/pages/Applications/index.jsx similarity index 94% rename from packages/web/src/pages/Applications/index.tsx rename to packages/web/src/pages/Applications/index.jsx index e7310f3f..bd8bb6ae 100644 --- a/packages/web/src/pages/Applications/index.tsx +++ b/packages/web/src/pages/Applications/index.jsx @@ -6,8 +6,6 @@ import Grid from '@mui/material/Grid'; import Divider from '@mui/material/Divider'; import CircularProgress from '@mui/material/CircularProgress'; import AddIcon from '@mui/icons-material/Add'; -import type { IApp } from 'types'; - import Can from 'components/Can'; import NoResultFound from 'components/NoResultFound'; import ConditionalIconButton from 'components/ConditionalIconButton'; @@ -19,26 +17,21 @@ import SearchInput from 'components/SearchInput'; import useFormatMessage from 'hooks/useFormatMessage'; import { GET_CONNECTED_APPS } from 'graphql/queries/get-connected-apps'; import * as URLS from 'config/urls'; - -export default function Applications(): React.ReactElement { +export default function Applications() { const navigate = useNavigate(); const formatMessage = useFormatMessage(); const [appName, setAppName] = React.useState(null); const { data, loading } = useQuery(GET_CONNECTED_APPS, { variables: { name: appName }, }); - - const apps: IApp[] = data?.getConnectedApps; + const apps = data?.getConnectedApps; const hasApps = apps?.length; - const onSearchChange = React.useCallback((event) => { setAppName(event.target.value); }, []); - const goToApps = React.useCallback(() => { navigate(URLS.APPS); }, [navigate]); - return ( @@ -97,7 +90,7 @@ export default function Applications(): React.ReactElement { )} {!loading && - apps?.map((app: IApp) => ( + apps?.map((app) => ( ))} diff --git a/packages/web/src/pages/Authentication/RoleMappings.tsx b/packages/web/src/pages/Authentication/RoleMappings.jsx similarity index 81% rename from packages/web/src/pages/Authentication/RoleMappings.tsx rename to packages/web/src/pages/Authentication/RoleMappings.jsx index ec0837d7..117671b7 100644 --- a/packages/web/src/pages/Authentication/RoleMappings.tsx +++ b/packages/web/src/pages/Authentication/RoleMappings.jsx @@ -1,36 +1,25 @@ import { useMutation } from '@apollo/client'; -import { TSamlAuthProvider, TSamlAuthProviderRole } from 'types'; import LoadingButton from '@mui/lab/LoadingButton'; import Divider from '@mui/material/Divider'; import Stack from '@mui/material/Stack'; import Typography from '@mui/material/Typography'; import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar'; import { useMemo } from 'react'; - import Form from 'components/Form'; import { UPSERT_SAML_AUTH_PROVIDERS_ROLE_MAPPINGS } from 'graphql/mutations/upsert-saml-auth-providers-role-mappings'; import useFormatMessage from 'hooks/useFormatMessage'; import useSamlAuthProviderRoleMappings from 'hooks/useSamlAuthProviderRoleMappings'; - import RoleMappingsFieldArray from './RoleMappingsFieldsArray'; - -type RoleMappingsProps = { - provider?: TSamlAuthProvider; - providerLoading: boolean; -}; - -function generateFormRoleMappings(roleMappings: TSamlAuthProviderRole[]) { +function generateFormRoleMappings(roleMappings) { if (roleMappings.length === 0) { return [{ roleId: '', remoteRoleName: '' }]; } - return roleMappings.map(({ roleId, remoteRoleName }) => ({ roleId, remoteRoleName, })); } - -function RoleMappings({ provider, providerLoading }: RoleMappingsProps) { +function RoleMappings({ provider, providerLoading }) { const formatMessage = useFormatMessage(); const enqueueSnackbar = useEnqueueSnackbar(); const { roleMappings, loading: roleMappingsLoading } = @@ -39,8 +28,7 @@ function RoleMappings({ provider, providerLoading }: RoleMappingsProps) { upsertSamlAuthProvidersRoleMappings, { loading: upsertRoleMappingsLoading }, ] = useMutation(UPSERT_SAML_AUTH_PROVIDERS_ROLE_MAPPINGS); - - const handleRoleMappingsUpdate = async (values: any) => { + const handleRoleMappingsUpdate = async (values) => { try { if (provider?.id) { await upsertSamlAuthProvidersRoleMappings({ @@ -48,16 +36,10 @@ function RoleMappings({ provider, providerLoading }: RoleMappingsProps) { input: { samlAuthProviderId: provider.id, samlAuthProvidersRoleMappings: values.roleMappings.map( - ({ + ({ roleId, remoteRoleName }) => ({ roleId, remoteRoleName, - }: { - roleId: string; - remoteRoleName: string; - }) => ({ - roleId, - remoteRoleName, - }) + }), ), }, }, @@ -73,18 +55,15 @@ function RoleMappings({ provider, providerLoading }: RoleMappingsProps) { throw new Error('Failed while saving!'); } }; - const defaultValues = useMemo( () => ({ roleMappings: generateFormRoleMappings(roleMappings), }), - [roleMappings] + [roleMappings], ); - if (providerLoading || !provider?.id || roleMappingsLoading) { return null; } - return ( <> @@ -108,5 +87,4 @@ function RoleMappings({ provider, providerLoading }: RoleMappingsProps) { ); } - export default RoleMappings; diff --git a/packages/web/src/pages/Authentication/RoleMappingsFieldsArray.tsx b/packages/web/src/pages/Authentication/RoleMappingsFieldsArray.jsx similarity index 94% rename from packages/web/src/pages/Authentication/RoleMappingsFieldsArray.tsx rename to packages/web/src/pages/Authentication/RoleMappingsFieldsArray.jsx index 66c1b814..6eb61dda 100644 --- a/packages/web/src/pages/Authentication/RoleMappingsFieldsArray.tsx +++ b/packages/web/src/pages/Authentication/RoleMappingsFieldsArray.jsx @@ -1,22 +1,17 @@ import { useFieldArray, useFormContext } from 'react-hook-form'; -import { IRole } from 'types'; import MuiTextField from '@mui/material/TextField'; import Stack from '@mui/material/Stack'; import DeleteIcon from '@mui/icons-material/Delete'; import IconButton from '@mui/material/IconButton'; import Button from '@mui/material/Button'; - import useRoles from 'hooks/useRoles.ee'; import useFormatMessage from 'hooks/useFormatMessage'; - import ControlledAutocomplete from 'components/ControlledAutocomplete'; import TextField from 'components/TextField'; import { Divider, Typography } from '@mui/material'; - -function generateRoleOptions(roles: IRole[]) { +function generateRoleOptions(roles) { return roles?.map(({ name: label, id: value }) => ({ label, value })); } - function RoleMappingsFieldArray() { const formatMessage = useFormatMessage(); const { control } = useFormContext(); @@ -25,9 +20,8 @@ function RoleMappingsFieldArray() { control, name: 'roleMappings', }); - const handleAppendMapping = () => append({ roleId: '', remoteRoleName: '' }); - const handleRemoveMapping = (index: number) => () => remove(index); + const handleRemoveMapping = (index) => () => remove(index); return ( <> {fields.length === 0 && ( @@ -89,5 +83,4 @@ function RoleMappingsFieldArray() { ); } - export default RoleMappingsFieldArray; diff --git a/packages/web/src/pages/Authentication/SamlConfiguration.tsx b/packages/web/src/pages/Authentication/SamlConfiguration.jsx similarity index 90% rename from packages/web/src/pages/Authentication/SamlConfiguration.tsx rename to packages/web/src/pages/Authentication/SamlConfiguration.jsx index 5365f464..b187a328 100644 --- a/packages/web/src/pages/Authentication/SamlConfiguration.tsx +++ b/packages/web/src/pages/Authentication/SamlConfiguration.jsx @@ -1,26 +1,16 @@ -import { QueryResult, useMutation } from '@apollo/client'; -import { IRole, TSamlAuthProvider } from 'types'; +import { useMutation } from '@apollo/client'; import LoadingButton from '@mui/lab/LoadingButton'; import Stack from '@mui/material/Stack'; import MuiTextField from '@mui/material/TextField'; import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar'; import * as React from 'react'; - import ControlledAutocomplete from 'components/ControlledAutocomplete'; import Form from 'components/Form'; import Switch from 'components/Switch'; import TextField from 'components/TextField'; - import { UPSERT_SAML_AUTH_PROVIDER } from 'graphql/mutations/upsert-saml-auth-provider'; import useFormatMessage from 'hooks/useFormatMessage'; import useRoles from 'hooks/useRoles.ee'; - -type SamlConfigurationProps = { - provider?: TSamlAuthProvider; - providerLoading: boolean; - refetchProvider: QueryResult['refetch']; -}; - const defaultValues = { active: false, name: '', @@ -34,26 +24,17 @@ const defaultValues = { roleAttributeName: '', defaultRoleId: '', }; - -function generateRoleOptions(roles: IRole[]) { +function generateRoleOptions(roles) { return roles?.map(({ name: label, id: value }) => ({ label, value })); } - -function SamlConfiguration({ - provider, - providerLoading, - refetchProvider, -}: SamlConfigurationProps) { +function SamlConfiguration({ provider, providerLoading, refetchProvider }) { const formatMessage = useFormatMessage(); const { roles, loading: rolesLoading } = useRoles(); const enqueueSnackbar = useEnqueueSnackbar(); const [upsertSamlAuthProvider, { loading }] = useMutation( - UPSERT_SAML_AUTH_PROVIDER + UPSERT_SAML_AUTH_PROVIDER, ); - - const handleProviderUpdate = async ( - providerDataToUpdate: Partial - ) => { + const handleProviderUpdate = async (providerDataToUpdate) => { try { const { name, @@ -68,7 +49,6 @@ function SamlConfiguration({ active, defaultRoleId, } = providerDataToUpdate; - await upsertSamlAuthProvider({ variables: { input: { @@ -86,11 +66,9 @@ function SamlConfiguration({ }, }, }); - if (!provider?.id) { await refetchProvider(); } - enqueueSnackbar(formatMessage('authenticationForm.successfullySaved'), { variant: 'success', SnackbarProps: { @@ -101,11 +79,9 @@ function SamlConfiguration({ throw new Error('Failed while saving!'); } }; - if (providerLoading) { return null; } - return ( ); } - export default SamlConfiguration; diff --git a/packages/web/src/pages/Authentication/index.tsx b/packages/web/src/pages/Authentication/index.jsx similarity index 99% rename from packages/web/src/pages/Authentication/index.tsx rename to packages/web/src/pages/Authentication/index.jsx index 00a9417d..cea3b8a7 100644 --- a/packages/web/src/pages/Authentication/index.tsx +++ b/packages/web/src/pages/Authentication/index.jsx @@ -1,15 +1,11 @@ import Grid from '@mui/material/Grid'; import Stack from '@mui/material/Stack'; - import PageTitle from 'components/PageTitle'; import Container from 'components/Container'; - import useFormatMessage from 'hooks/useFormatMessage'; import useSamlAuthProvider from 'hooks/useSamlAuthProvider'; - import SamlConfiguration from './SamlConfiguration'; import RoleMappings from './RoleMappings'; - function AuthenticationPage() { const formatMessage = useFormatMessage(); const { @@ -17,7 +13,6 @@ function AuthenticationPage() { loading: providerLoading, refetch: refetchProvider, } = useSamlAuthProvider(); - return ( @@ -41,5 +36,4 @@ function AuthenticationPage() { ); } - export default AuthenticationPage; diff --git a/packages/web/src/pages/BillingAndUsageSettings/index.ee.tsx b/packages/web/src/pages/BillingAndUsageSettings/index.ee.jsx similarity index 99% rename from packages/web/src/pages/BillingAndUsageSettings/index.ee.tsx rename to packages/web/src/pages/BillingAndUsageSettings/index.ee.jsx index 73da9c29..98c24e33 100644 --- a/packages/web/src/pages/BillingAndUsageSettings/index.ee.tsx +++ b/packages/web/src/pages/BillingAndUsageSettings/index.ee.jsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { Navigate } from 'react-router-dom'; import Grid from '@mui/material/Grid'; - import * as URLS from 'config/urls'; import UsageDataInformation from 'components/UsageDataInformation/index.ee'; import Invoices from 'components/Invoices/index.ee'; @@ -9,20 +8,16 @@ import PageTitle from 'components/PageTitle'; import Container from 'components/Container'; import useFormatMessage from 'hooks/useFormatMessage'; import useCloud from 'hooks/useCloud'; - function BillingAndUsageSettings() { const isCloud = useCloud(); const formatMessage = useFormatMessage(); - // redirect to the initial settings page if (isCloud === false) { return ; } - // render nothing until we know if it's cloud or not // here, `isCloud` is not `false`, but `undefined` if (!isCloud) return ; - return ( @@ -43,5 +38,4 @@ function BillingAndUsageSettings() { ); } - export default BillingAndUsageSettings; diff --git a/packages/web/src/pages/CreateRole/index.ee.tsx b/packages/web/src/pages/CreateRole/index.ee.jsx similarity index 92% rename from packages/web/src/pages/CreateRole/index.ee.tsx rename to packages/web/src/pages/CreateRole/index.ee.jsx index 3e1ca65f..62e54aff 100644 --- a/packages/web/src/pages/CreateRole/index.ee.tsx +++ b/packages/web/src/pages/CreateRole/index.ee.jsx @@ -6,31 +6,22 @@ import PermissionCatalogField from 'components/PermissionCatalogField/index.ee'; import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar'; import * as React from 'react'; import { useNavigate } from 'react-router-dom'; - import Container from 'components/Container'; import Form from 'components/Form'; import PageTitle from 'components/PageTitle'; import TextField from 'components/TextField'; import * as URLS from 'config/urls'; import { CREATE_ROLE } from 'graphql/mutations/create-role.ee'; -import { - RoleWithComputedPermissions, - getPermissions, -} from 'helpers/computePermissions.ee'; +import { getPermissions } from 'helpers/computePermissions.ee'; import useFormatMessage from 'hooks/useFormatMessage'; - -export default function CreateRole(): React.ReactElement { +export default function CreateRole() { const navigate = useNavigate(); const formatMessage = useFormatMessage(); const [createRole, { loading }] = useMutation(CREATE_ROLE); const enqueueSnackbar = useEnqueueSnackbar(); - - const handleRoleCreation = async ( - roleData: Partial - ) => { + const handleRoleCreation = async (roleData) => { try { const permissions = getPermissions(roleData.computedPermissions); - await createRole({ variables: { input: { @@ -40,20 +31,17 @@ export default function CreateRole(): React.ReactElement { }, }, }); - enqueueSnackbar(formatMessage('createRole.successfullyCreated'), { variant: 'success', SnackbarProps: { 'data-test': 'snackbar-create-role-success', }, }); - navigate(URLS.ROLES); } catch (error) { throw new Error('Failed while creating!'); } }; - return ( diff --git a/packages/web/src/pages/CreateUser/index.tsx b/packages/web/src/pages/CreateUser/index.jsx similarity index 94% rename from packages/web/src/pages/CreateUser/index.tsx rename to packages/web/src/pages/CreateUser/index.jsx index 3055db02..880c0be3 100644 --- a/packages/web/src/pages/CreateUser/index.tsx +++ b/packages/web/src/pages/CreateUser/index.jsx @@ -1,5 +1,4 @@ import { useMutation } from '@apollo/client'; -import { IRole, IUser } from 'types'; import LoadingButton from '@mui/lab/LoadingButton'; import Grid from '@mui/material/Grid'; import Stack from '@mui/material/Stack'; @@ -7,7 +6,6 @@ import MuiTextField from '@mui/material/TextField'; import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar'; import * as React from 'react'; import { useNavigate } from 'react-router-dom'; - import Can from 'components/Can'; import Container from 'components/Container'; import ControlledAutocomplete from 'components/ControlledAutocomplete'; @@ -18,19 +16,16 @@ import * as URLS from 'config/urls'; import { CREATE_USER } from 'graphql/mutations/create-user.ee'; import useFormatMessage from 'hooks/useFormatMessage'; import useRoles from 'hooks/useRoles.ee'; - -function generateRoleOptions(roles: IRole[]) { +function generateRoleOptions(roles) { return roles?.map(({ name: label, id: value }) => ({ label, value })); } - -export default function CreateUser(): React.ReactElement { +export default function CreateUser() { const navigate = useNavigate(); const formatMessage = useFormatMessage(); const [createUser, { loading }] = useMutation(CREATE_USER); const { roles, loading: rolesLoading } = useRoles(); const enqueueSnackbar = useEnqueueSnackbar(); - - const handleUserCreation = async (userData: Partial) => { + const handleUserCreation = async (userData) => { try { await createUser({ variables: { @@ -44,7 +39,6 @@ export default function CreateUser(): React.ReactElement { }, }, }); - enqueueSnackbar(formatMessage('createUser.successfullyCreated'), { variant: 'success', persist: true, @@ -52,13 +46,11 @@ export default function CreateUser(): React.ReactElement { 'data-test': 'snackbar-create-user-success', }, }); - navigate(URLS.USERS); } catch (error) { throw new Error('Failed while creating!'); } }; - return ( diff --git a/packages/web/src/pages/Dashboard/index.tsx b/packages/web/src/pages/Dashboard/index.jsx similarity index 100% rename from packages/web/src/pages/Dashboard/index.tsx rename to packages/web/src/pages/Dashboard/index.jsx diff --git a/packages/web/src/pages/EditRole/index.ee.tsx b/packages/web/src/pages/EditRole/index.ee.jsx similarity index 93% rename from packages/web/src/pages/EditRole/index.ee.tsx rename to packages/web/src/pages/EditRole/index.ee.jsx index 414e8f94..e70cf8d6 100644 --- a/packages/web/src/pages/EditRole/index.ee.tsx +++ b/packages/web/src/pages/EditRole/index.ee.jsx @@ -6,7 +6,6 @@ import Stack from '@mui/material/Stack'; import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar'; import * as React from 'react'; import { useNavigate, useParams } from 'react-router-dom'; - import Container from 'components/Container'; import Form from 'components/Form'; import PageTitle from 'components/PageTitle'; @@ -15,31 +14,21 @@ import TextField from 'components/TextField'; import * as URLS from 'config/urls'; import { UPDATE_ROLE } from 'graphql/mutations/update-role.ee'; import { - RoleWithComputedPermissions, getPermissions, getRoleWithComputedPermissions, } from 'helpers/computePermissions.ee'; import useFormatMessage from 'hooks/useFormatMessage'; import useRole from 'hooks/useRole.ee'; - -type EditRoleParams = { - roleId: string; -}; - -export default function EditRole(): React.ReactElement { +export default function EditRole() { const formatMessage = useFormatMessage(); const [updateRole, { loading }] = useMutation(UPDATE_ROLE); const navigate = useNavigate(); - const { roleId } = useParams(); + const { roleId } = useParams(); const { role, loading: roleLoading } = useRole(roleId); const enqueueSnackbar = useEnqueueSnackbar(); - - const handleRoleUpdate = async ( - roleData: Partial - ) => { + const handleRoleUpdate = async (roleData) => { try { const newPermissions = getPermissions(roleData.computedPermissions); - await updateRole({ variables: { input: { @@ -50,22 +39,18 @@ export default function EditRole(): React.ReactElement { }, }, }); - enqueueSnackbar(formatMessage('editRole.successfullyUpdated'), { variant: 'success', SnackbarProps: { 'data-test': 'snackbar-edit-role-success', }, }); - navigate(URLS.ROLES); } catch (error) { throw new Error('Failed while updating!'); } }; - const roleWithComputedPermissions = getRoleWithComputedPermissions(role); - return ( diff --git a/packages/web/src/pages/EditUser/index.tsx b/packages/web/src/pages/EditUser/index.jsx similarity index 93% rename from packages/web/src/pages/EditUser/index.tsx rename to packages/web/src/pages/EditUser/index.jsx index 68eb4a12..03f3abed 100644 --- a/packages/web/src/pages/EditUser/index.tsx +++ b/packages/web/src/pages/EditUser/index.jsx @@ -1,5 +1,4 @@ import { useMutation } from '@apollo/client'; -import { IRole, IUser } from 'types'; import LoadingButton from '@mui/lab/LoadingButton'; import Grid from '@mui/material/Grid'; import Skeleton from '@mui/material/Skeleton'; @@ -8,7 +7,6 @@ import MuiTextField from '@mui/material/TextField'; import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar'; import * as React from 'react'; import { useNavigate, useParams } from 'react-router-dom'; - import Can from 'components/Can'; import Container from 'components/Container'; import ControlledAutocomplete from 'components/ControlledAutocomplete'; @@ -20,25 +18,18 @@ import { UPDATE_USER } from 'graphql/mutations/update-user.ee'; import useFormatMessage from 'hooks/useFormatMessage'; import useRoles from 'hooks/useRoles.ee'; import useUser from 'hooks/useUser'; - -type EditUserParams = { - userId: string; -}; - -function generateRoleOptions(roles: IRole[]) { +function generateRoleOptions(roles) { return roles?.map(({ name: label, id: value }) => ({ label, value })); } - -export default function EditUser(): React.ReactElement { +export default function EditUser() { const formatMessage = useFormatMessage(); const [updateUser, { loading }] = useMutation(UPDATE_USER); - const { userId } = useParams(); + const { userId } = useParams(); const { user, loading: userLoading } = useUser(userId); const { roles, loading: rolesLoading } = useRoles(); const enqueueSnackbar = useEnqueueSnackbar(); const navigate = useNavigate(); - - const handleUserUpdate = async (userDataToUpdate: Partial) => { + const handleUserUpdate = async (userDataToUpdate) => { try { await updateUser({ variables: { @@ -52,7 +43,6 @@ export default function EditUser(): React.ReactElement { }, }, }); - enqueueSnackbar(formatMessage('editUser.successfullyUpdated'), { variant: 'success', SnackbarProps: { @@ -60,13 +50,11 @@ export default function EditUser(): React.ReactElement { persist: true, }, }); - navigate(URLS.USERS); } catch (error) { throw new Error('Failed while updating!'); } }; - return ( diff --git a/packages/web/src/pages/Editor/create.tsx b/packages/web/src/pages/Editor/create.jsx similarity index 92% rename from packages/web/src/pages/Editor/create.tsx rename to packages/web/src/pages/Editor/create.jsx index 4a09840e..06eeccb6 100644 --- a/packages/web/src/pages/Editor/create.tsx +++ b/packages/web/src/pages/Editor/create.jsx @@ -3,47 +3,36 @@ import { useNavigate, useSearchParams } from 'react-router-dom'; import { useMutation } from '@apollo/client'; import CircularProgress from '@mui/material/CircularProgress'; import Typography from '@mui/material/Typography'; - import * as URLS from 'config/urls'; import useFormatMessage from 'hooks/useFormatMessage'; import { CREATE_FLOW } from 'graphql/mutations/create-flow'; - import Box from '@mui/material/Box'; - -export default function CreateFlow(): React.ReactElement { +export default function CreateFlow() { const [searchParams] = useSearchParams(); const navigate = useNavigate(); const formatMessage = useFormatMessage(); const [createFlow] = useMutation(CREATE_FLOW); - const appKey = searchParams.get('appKey'); const connectionId = searchParams.get('connectionId'); - React.useEffect(() => { async function initiate() { - const variables: { [key: string]: string } = {}; - + const variables = {}; if (appKey) { variables.triggerAppKey = appKey; } - if (connectionId) { variables.connectionId = connectionId; } - const response = await createFlow({ variables: { input: variables, }, }); const flowId = response.data?.createFlow?.id; - navigate(URLS.FLOW_EDITOR(flowId), { replace: true }); } - initiate(); }, [createFlow, navigate, appKey, connectionId]); - return ( ; } diff --git a/packages/web/src/pages/Editor/routes.tsx b/packages/web/src/pages/Editor/routes.jsx similarity index 83% rename from packages/web/src/pages/Editor/routes.tsx rename to packages/web/src/pages/Editor/routes.jsx index 09b1eaff..23c5d3d5 100644 --- a/packages/web/src/pages/Editor/routes.tsx +++ b/packages/web/src/pages/Editor/routes.jsx @@ -2,8 +2,7 @@ import * as React from 'react'; import { Routes, Route } from 'react-router-dom'; import CreateFlowPage from './create'; import EditorPage from './index'; - -export default function EditorRoutes(): React.ReactElement { +export default function EditorRoutes() { return ( } /> diff --git a/packages/web/src/pages/Execution/index.tsx b/packages/web/src/pages/Execution/index.jsx similarity index 83% rename from packages/web/src/pages/Execution/index.tsx rename to packages/web/src/pages/Execution/index.jsx index 18f3feaf..d9625f3c 100644 --- a/packages/web/src/pages/Execution/index.tsx +++ b/packages/web/src/pages/Execution/index.jsx @@ -5,28 +5,19 @@ import Grid from '@mui/material/Grid'; import Box from '@mui/material/Box'; import AlertTitle from '@mui/material/AlertTitle'; import Alert from '@mui/material/Alert'; -import type { IExecutionStep } from 'types'; - import useFormatMessage from 'hooks/useFormatMessage'; import ExecutionHeader from 'components/ExecutionHeader'; import ExecutionStep from 'components/ExecutionStep'; import Container from 'components/Container'; import { GET_EXECUTION } from 'graphql/queries/get-execution'; import { GET_EXECUTION_STEPS } from 'graphql/queries/get-execution-steps'; - -type ExecutionParams = { - executionId: string; -}; - const EXECUTION_PER_PAGE = 100; - -const getLimitAndOffset = (page: number) => ({ +const getLimitAndOffset = (page) => ({ limit: EXECUTION_PER_PAGE, offset: (page - 1) * EXECUTION_PER_PAGE, }); - -export default function Execution(): React.ReactElement { - const { executionId } = useParams() as ExecutionParams; +export default function Execution() { + const { executionId } = useParams(); const formatMessage = useFormatMessage(); const { data: execution } = useQuery(GET_EXECUTION, { variables: { executionId }, @@ -34,12 +25,8 @@ export default function Execution(): React.ReactElement { const { data, loading } = useQuery(GET_EXECUTION_STEPS, { variables: { executionId, ...getLimitAndOffset(1) }, }); - const { edges } = data?.getExecutionSteps || {}; - const executionSteps: IExecutionStep[] = edges?.map( - (edge: { node: IExecutionStep }) => edge.node - ); - + const executionSteps = edges?.map((edge) => edge.node); return ( diff --git a/packages/web/src/pages/Executions/index.tsx b/packages/web/src/pages/Executions/index.jsx similarity index 92% rename from packages/web/src/pages/Executions/index.tsx rename to packages/web/src/pages/Executions/index.jsx index d5c97d2e..b323a0f4 100644 --- a/packages/web/src/pages/Executions/index.tsx +++ b/packages/web/src/pages/Executions/index.jsx @@ -7,27 +7,21 @@ import CircularProgress from '@mui/material/CircularProgress'; import Divider from '@mui/material/Divider'; import Pagination from '@mui/material/Pagination'; import PaginationItem from '@mui/material/PaginationItem'; -import type { IExecution } from 'types'; - import NoResultFound from 'components/NoResultFound'; import ExecutionRow from 'components/ExecutionRow'; import Container from 'components/Container'; import PageTitle from 'components/PageTitle'; import useFormatMessage from 'hooks/useFormatMessage'; import { GET_EXECUTIONS } from 'graphql/queries/get-executions'; - const EXECUTION_PER_PAGE = 10; - -const getLimitAndOffset = (page: number) => ({ +const getLimitAndOffset = (page) => ({ limit: EXECUTION_PER_PAGE, offset: (page - 1) * EXECUTION_PER_PAGE, }); - -export default function Executions(): React.ReactElement { +export default function Executions() { const formatMessage = useFormatMessage(); const [searchParams, setSearchParams] = useSearchParams(); const page = parseInt(searchParams.get('page') || '', 10) || 1; - const { data, refetch, loading } = useQuery(GET_EXECUTIONS, { variables: getLimitAndOffset(page), fetchPolicy: 'cache-and-network', @@ -35,16 +29,11 @@ export default function Executions(): React.ReactElement { }); const getExecutions = data?.getExecutions || {}; const { pageInfo, edges } = getExecutions; - React.useEffect(() => { refetch(getLimitAndOffset(page)); }, [refetch, page]); - - const executions: IExecution[] = edges?.map( - ({ node }: { node: IExecution }) => node - ); + const executions = edges?.map(({ node }) => node); const hasExecutions = executions?.length; - return ( diff --git a/packages/web/src/pages/Flow/index.tsx b/packages/web/src/pages/Flow/index.jsx similarity index 73% rename from packages/web/src/pages/Flow/index.tsx rename to packages/web/src/pages/Flow/index.jsx index 8aec7ea5..922dfe6b 100644 --- a/packages/web/src/pages/Flow/index.tsx +++ b/packages/web/src/pages/Flow/index.jsx @@ -2,16 +2,9 @@ import * as React from 'react'; import { useParams } from 'react-router-dom'; import Box from '@mui/material/Box'; import Grid from '@mui/material/Grid'; - import Container from 'components/Container'; - -type FlowParams = { - flowId: string; -}; - -export default function Flow(): React.ReactElement { - const { flowId } = useParams() as FlowParams; - +export default function Flow() { + const { flowId } = useParams(); return ( diff --git a/packages/web/src/pages/Flows/index.tsx b/packages/web/src/pages/Flows/index.jsx similarity index 93% rename from packages/web/src/pages/Flows/index.tsx rename to packages/web/src/pages/Flows/index.jsx index 1f710622..462a89eb 100644 --- a/packages/web/src/pages/Flows/index.tsx +++ b/packages/web/src/pages/Flows/index.jsx @@ -9,8 +9,6 @@ import CircularProgress from '@mui/material/CircularProgress'; import Divider from '@mui/material/Divider'; import Pagination from '@mui/material/Pagination'; import PaginationItem from '@mui/material/PaginationItem'; -import type { IFlow } from 'types'; - import Can from 'components/Can'; import FlowRow from 'components/FlowRow'; import NoResultFound from 'components/NoResultFound'; @@ -21,15 +19,12 @@ import SearchInput from 'components/SearchInput'; import useFormatMessage from 'hooks/useFormatMessage'; import { GET_FLOWS } from 'graphql/queries/get-flows'; import * as URLS from 'config/urls'; - const FLOW_PER_PAGE = 10; - -const getLimitAndOffset = (page: number) => ({ +const getLimitAndOffset = (page) => ({ limit: FLOW_PER_PAGE, offset: (page - 1) * FLOW_PER_PAGE, }); - -export default function Flows(): React.ReactElement { +export default function Flows() { const formatMessage = useFormatMessage(); const [searchParams, setSearchParams] = useSearchParams(); const page = parseInt(searchParams.get('page') || '', 10) || 1; @@ -40,7 +35,6 @@ export default function Flows(): React.ReactElement { setLoading(false); }, }); - const fetchData = React.useMemo( () => debounce( @@ -51,43 +45,35 @@ export default function Flows(): React.ReactElement { name, }, }), - 300 + 300, ), - [page, getFlows] + [page, getFlows], ); - React.useEffect( function fetchFlowsOnSearch() { setLoading(true); - fetchData(flowName); }, - [fetchData, flowName] + [fetchData, flowName], ); - React.useEffect( function resetPageOnSearch() { // reset search params which only consists of `page` setSearchParams({}); }, - [flowName] + [flowName], ); - React.useEffect(function cancelDebounceOnUnmount() { return () => { fetchData.cancel(); }; }, []); - const { pageInfo, edges } = data?.getFlows || {}; - - const flows: IFlow[] = edges?.map(({ node }: { node: IFlow }) => node); + const flows = edges?.map(({ node }) => node); const hasFlows = flows?.length; - const onSearchChange = React.useCallback((event) => { setFlowName(event.target.value); }, []); - return ( @@ -130,21 +116,17 @@ export default function Flows(): React.ReactElement { - {loading && ( )} - {!loading && flows?.map((flow) => )} - {!loading && !hasFlows && ( )} - {!loading && pageInfo && pageInfo.totalPages > 1 && ( diff --git a/packages/web/src/pages/Login/index.tsx b/packages/web/src/pages/Login/index.jsx similarity index 90% rename from packages/web/src/pages/Login/index.tsx rename to packages/web/src/pages/Login/index.jsx index 3cdee67e..07e9cc44 100644 --- a/packages/web/src/pages/Login/index.tsx +++ b/packages/web/src/pages/Login/index.jsx @@ -4,9 +4,7 @@ import Stack from '@mui/material/Stack'; import Container from 'components/Container'; import LoginForm from 'components/LoginForm'; import SsoProviders from 'components/SsoProviders/index.ee'; - - -export default function Login(): React.ReactElement { +export default function Login() { return ( diff --git a/packages/web/src/pages/LoginCallback/index.tsx b/packages/web/src/pages/LoginCallback/index.jsx similarity index 88% rename from packages/web/src/pages/LoginCallback/index.tsx rename to packages/web/src/pages/LoginCallback/index.jsx index bcc5f29e..e874c537 100644 --- a/packages/web/src/pages/LoginCallback/index.tsx +++ b/packages/web/src/pages/LoginCallback/index.jsx @@ -1,29 +1,22 @@ import * as React from 'react'; import { useNavigate, useSearchParams } from 'react-router-dom'; - import useAuthentication from 'hooks/useAuthentication'; import * as URLS from 'config/urls'; - -export default function LoginCallback(): React.ReactElement { +export default function LoginCallback() { const navigate = useNavigate(); const authentication = useAuthentication(); const [searchParams] = useSearchParams(); - React.useEffect(() => { if (authentication.isAuthenticated) { navigate(URLS.DASHBOARD); } }, [authentication.isAuthenticated]); - React.useEffect(() => { const token = searchParams.get('token'); - if (token) { authentication.updateToken(token); } - // TODO: handle non-existing token scenario }, []); - - return (<>); + return <>; } diff --git a/packages/web/src/pages/Notifications/index.tsx b/packages/web/src/pages/Notifications/index.jsx similarity index 84% rename from packages/web/src/pages/Notifications/index.tsx rename to packages/web/src/pages/Notifications/index.jsx index 8e5c7bff..8448479c 100644 --- a/packages/web/src/pages/Notifications/index.tsx +++ b/packages/web/src/pages/Notifications/index.jsx @@ -2,7 +2,6 @@ import * as React from 'react'; import { useNavigate } from 'react-router-dom'; import Box from '@mui/material/Box'; import Stack from '@mui/material/Stack'; - import useNotifications from 'hooks/useNotifications'; import Container from 'components/Container'; import NotificationCard from 'components/NotificationCard'; @@ -10,29 +9,19 @@ import PageTitle from 'components/PageTitle'; import useFormatMessage from 'hooks/useFormatMessage'; import useAutomatischInfo from 'hooks/useAutomatischInfo'; import * as URLS from 'config/urls'; - -interface INotification { - name: string; - createdAt: string; - documentationUrl: string; - description: string; -} - -export default function Updates(): React.ReactElement { +export default function Updates() { const navigate = useNavigate(); const formatMessage = useFormatMessage(); const { notifications } = useNotifications(); const { isMation, loading } = useAutomatischInfo(); - React.useEffect( function redirectToHomepageInMation() { if (!loading && isMation) { navigate(URLS.DASHBOARD); } }, - [loading, isMation] + [loading, isMation], ); - return ( @@ -41,7 +30,7 @@ export default function Updates(): React.ReactElement { - {notifications.map((notification: INotification) => ( + {notifications.map((notification) => ( ; } - // render nothing until we know if it's cloud or not // here, `isCloud` is not `false`, but `undefined` if (!isCloud) return ; - return ( - - {formatMessage('planUpgrade.title')} - + {formatMessage('planUpgrade.title')} @@ -38,5 +31,4 @@ function PlanUpgrade() { ); } - export default PlanUpgrade; diff --git a/packages/web/src/pages/ProfileSettings/index.tsx b/packages/web/src/pages/ProfileSettings/index.jsx similarity index 95% rename from packages/web/src/pages/ProfileSettings/index.tsx rename to packages/web/src/pages/ProfileSettings/index.jsx index fc4abe7a..305d1584 100644 --- a/packages/web/src/pages/ProfileSettings/index.tsx +++ b/packages/web/src/pages/ProfileSettings/index.jsx @@ -9,7 +9,6 @@ import { styled } from '@mui/material/styles'; import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar'; import * as React from 'react'; import * as yup from 'yup'; - import Container from 'components/Container'; import DeleteAccountDialog from 'components/DeleteAccountDialog/index.ee'; import Form from 'components/Form'; @@ -18,13 +17,6 @@ import TextField from 'components/TextField'; import { UPDATE_CURRENT_USER } from 'graphql/mutations/update-current-user'; import useCurrentUser from 'hooks/useCurrentUser'; import useFormatMessage from 'hooks/useFormatMessage'; - -type TMutationInput = { - fullName: string; - email: string; - password?: string; -}; - const validationSchema = yup .object({ fullName: yup.string().required(), @@ -35,13 +27,11 @@ const validationSchema = yup .oneOf([yup.ref('password')], 'Passwords must match'), }) .required(); - const StyledForm = styled(Form)` display: flex; align-items: end; flex-direction: column; `; - function ProfileSettings() { const [showDeleteAccountConfirmation, setShowDeleteAccountConfirmation] = React.useState(false); @@ -49,19 +39,15 @@ function ProfileSettings() { const currentUser = useCurrentUser(); const formatMessage = useFormatMessage(); const [updateCurrentUser] = useMutation(UPDATE_CURRENT_USER); - - const handleProfileSettingsUpdate = async (data: any) => { + const handleProfileSettingsUpdate = async (data) => { const { fullName, password, email } = data; - - const mutationInput: TMutationInput = { + const mutationInput = { fullName, email, }; - if (password) { mutationInput.password = password; } - await updateCurrentUser({ variables: { input: mutationInput, @@ -75,15 +61,13 @@ function ProfileSettings() { }, }, }); - enqueueSnackbar(formatMessage('profileSettings.updatedProfile'), { variant: 'success', SnackbarProps: { - 'data-test': 'snackbar-update-profile-settings-success' - } + 'data-test': 'snackbar-update-profile-settings-success', + }, }); }; - return ( @@ -209,5 +193,4 @@ function ProfileSettings() { ); } - export default ProfileSettings; diff --git a/packages/web/src/pages/ResetPassword/index.ee.tsx b/packages/web/src/pages/ResetPassword/index.ee.jsx similarity index 86% rename from packages/web/src/pages/ResetPassword/index.ee.tsx rename to packages/web/src/pages/ResetPassword/index.ee.jsx index 8dfb0664..98e9e783 100644 --- a/packages/web/src/pages/ResetPassword/index.ee.tsx +++ b/packages/web/src/pages/ResetPassword/index.ee.jsx @@ -1,13 +1,10 @@ import * as React from 'react'; import Box from '@mui/material/Box'; - import useCloud from 'hooks/useCloud'; import Container from 'components/Container'; import ResetPasswordForm from 'components/ResetPasswordForm/index.ee'; - -export default function ResetPassword(): React.ReactElement { +export default function ResetPassword() { useCloud({ redirect: true }); - return ( diff --git a/packages/web/src/pages/Roles/index.ee.tsx b/packages/web/src/pages/Roles/index.ee.jsx similarity index 99% rename from packages/web/src/pages/Roles/index.ee.tsx rename to packages/web/src/pages/Roles/index.ee.jsx index 1bfea09f..03b21df3 100644 --- a/packages/web/src/pages/Roles/index.ee.tsx +++ b/packages/web/src/pages/Roles/index.ee.jsx @@ -2,17 +2,14 @@ import * as React from 'react'; import { Link } from 'react-router-dom'; import Grid from '@mui/material/Grid'; import AddIcon from '@mui/icons-material/Add'; - import * as URLS from 'config/urls'; import PageTitle from 'components/PageTitle'; import Container from 'components/Container'; import RoleList from 'components/RoleList/index.ee'; import ConditionalIconButton from 'components/ConditionalIconButton'; import useFormatMessage from 'hooks/useFormatMessage'; - function RolesPage() { const formatMessage = useFormatMessage(); - return ( @@ -47,5 +44,4 @@ function RolesPage() { ); } - export default RolesPage; diff --git a/packages/web/src/pages/SignUp/index.ee.tsx b/packages/web/src/pages/SignUp/index.ee.jsx similarity index 87% rename from packages/web/src/pages/SignUp/index.ee.tsx rename to packages/web/src/pages/SignUp/index.ee.jsx index 7d314164..90bd7c9e 100644 --- a/packages/web/src/pages/SignUp/index.ee.tsx +++ b/packages/web/src/pages/SignUp/index.ee.jsx @@ -1,13 +1,10 @@ import * as React from 'react'; import Box from '@mui/material/Box'; - import useCloud from 'hooks/useCloud'; import Container from 'components/Container'; import SignUpForm from 'components/SignUpForm/index.ee'; - -export default function SignUp(): React.ReactElement { +export default function SignUp() { useCloud({ redirect: true }); - return ( diff --git a/packages/web/src/pages/UserInterface/index.tsx b/packages/web/src/pages/UserInterface/index.jsx similarity index 87% rename from packages/web/src/pages/UserInterface/index.tsx rename to packages/web/src/pages/UserInterface/index.jsx index 565882cf..5c2cc0bd 100644 --- a/packages/web/src/pages/UserInterface/index.tsx +++ b/packages/web/src/pages/UserInterface/index.jsx @@ -6,7 +6,6 @@ import Stack from '@mui/material/Stack'; import useEnqueueSnackbar from 'hooks/useEnqueueSnackbar'; import merge from 'lodash/merge'; import * as React from 'react'; - import ColorInput from 'components/ColorInput'; import Container from 'components/Container'; import Form from 'components/Form'; @@ -22,33 +21,16 @@ import { primaryLightColor, primaryMainColor, } from 'styles/theme'; - -type UserInterface = { - palette: { - primary: { - dark: string; - light: string; - main: string; - }; - }; - title: string; - logo: { - svgData: string; - }; -}; - -const getPrimaryMainColor = (color?: string) => color || primaryMainColor; -const getPrimaryDarkColor = (color?: string) => color || primaryDarkColor; -const getPrimaryLightColor = (color?: string) => color || primaryLightColor; - +const getPrimaryMainColor = (color) => color || primaryMainColor; +const getPrimaryDarkColor = (color) => color || primaryDarkColor; +const getPrimaryLightColor = (color) => color || primaryLightColor; const defaultValues = { title: 'Automatisch', 'palette.primary.main': primaryMainColor, 'palette.primary.dark': primaryDarkColor, 'palette.primary.light': primaryLightColor, }; - -export default function UserInterface(): React.ReactElement { +export default function UserInterface() { const formatMessage = useFormatMessage(); const [updateConfig, { loading }] = useMutation(UPDATE_CONFIG); const { config, loading: configLoading } = useConfig([ @@ -59,28 +41,22 @@ export default function UserInterface(): React.ReactElement { 'logo.svgData', ]); const enqueueSnackbar = useEnqueueSnackbar(); - const configWithDefaults = merge( - {}, - defaultValues, - nestObject(config) - ); - - const handleUserInterfaceUpdate = async (uiData: Partial) => { + const configWithDefaults = merge({}, defaultValues, nestObject(config)); + const handleUserInterfaceUpdate = async (uiData) => { try { const input = { title: uiData?.title, 'palette.primary.main': getPrimaryMainColor( - uiData?.palette?.primary.main + uiData?.palette?.primary.main, ), 'palette.primary.dark': getPrimaryDarkColor( - uiData?.palette?.primary.dark + uiData?.palette?.primary.dark, ), 'palette.primary.light': getPrimaryLightColor( - uiData?.palette?.primary.light + uiData?.palette?.primary.light, ), 'logo.svgData': uiData?.logo?.svgData, }; - await updateConfig({ variables: { input, @@ -90,14 +66,12 @@ export default function UserInterface(): React.ReactElement { }, update: async function (cache, { data: { updateConfig } }) { const newConfigWithDefaults = merge({}, defaultValues, updateConfig); - cache.writeQuery({ query: GET_CONFIG, data: { getConfig: newConfigWithDefaults, }, }); - cache.writeQuery({ query: GET_CONFIG, data: { @@ -107,7 +81,6 @@ export default function UserInterface(): React.ReactElement { keys: ['logo.svgData'], }, }); - cache.writeQuery({ query: GET_CONFIG, data: { @@ -125,18 +98,16 @@ export default function UserInterface(): React.ReactElement { }); }, }); - enqueueSnackbar(formatMessage('userInterfacePage.successfullyUpdated'), { variant: 'success', SnackbarProps: { - 'data-test': 'snackbar-update-user-interface-success' - } + 'data-test': 'snackbar-update-user-interface-success', + }, }); } catch (error) { throw new Error('Failed while updating!'); } }; - return ( @@ -169,7 +140,7 @@ export default function UserInterface(): React.ReactElement { @@ -47,5 +44,4 @@ function UsersPage() { ); } - export default UsersPage; diff --git a/packages/web/src/react-app-env.d.ts b/packages/web/src/react-app-env.d.ts deleted file mode 100644 index 9800cde5..00000000 --- a/packages/web/src/react-app-env.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/// - -declare namespace JSX { - interface IntrinsicElements { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - 'json-viewer': any; - } -} diff --git a/packages/web/src/reportWebVitals.ts b/packages/web/src/reportWebVitals.js similarity index 74% rename from packages/web/src/reportWebVitals.ts rename to packages/web/src/reportWebVitals.js index eb4be08f..192e8336 100644 --- a/packages/web/src/reportWebVitals.ts +++ b/packages/web/src/reportWebVitals.js @@ -1,6 +1,4 @@ -import { ReportHandler } from 'web-vitals'; - -const reportWebVitals = (onPerfEntry?: ReportHandler): void => { +const reportWebVitals = (onPerfEntry) => { if (onPerfEntry && onPerfEntry instanceof Function) { import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { getCLS(onPerfEntry); @@ -11,5 +9,4 @@ const reportWebVitals = (onPerfEntry?: ReportHandler): void => { }); } }; - export default reportWebVitals; diff --git a/packages/web/src/routes.tsx b/packages/web/src/routes.jsx similarity index 99% rename from packages/web/src/routes.tsx rename to packages/web/src/routes.jsx index edc88214..1e0dd588 100644 --- a/packages/web/src/routes.tsx +++ b/packages/web/src/routes.jsx @@ -20,11 +20,9 @@ import adminSettingsRoutes from './adminSettingsRoutes'; import Notifications from 'pages/Notifications'; import useConfig from 'hooks/useConfig'; import useAuthentication from 'hooks/useAuthentication'; - function Routes() { const { config } = useConfig(); const { isAuthenticated } = useAuthentication(); - return ( ); } - export default ; diff --git a/packages/web/src/settingsRoutes.tsx b/packages/web/src/settingsRoutes.jsx similarity index 99% rename from packages/web/src/settingsRoutes.tsx rename to packages/web/src/settingsRoutes.jsx index c8f9a11d..2b2ab777 100644 --- a/packages/web/src/settingsRoutes.tsx +++ b/packages/web/src/settingsRoutes.jsx @@ -4,9 +4,7 @@ import { PaddleProvider } from 'contexts/Paddle.ee'; import ProfileSettings from 'pages/ProfileSettings'; import BillingAndUsageSettings from 'pages/BillingAndUsageSettings/index.ee'; import PlanUpgrade from 'pages/PlanUpgrade/index.ee'; - import * as URLS from 'config/urls'; - export default ( <> ({ - zIndex: theme.zIndex.drawer + 1, - }), +export const mationTheme = createTheme( + deepmerge(defaultTheme, { + palette: { + primary: { + main: '#2962FF', + light: '#448AFF', + dark: '#2962FF', + contrastText: '#fff', }, }, - }, -})); - + components: { + MuiAppBar: { + styleOverrides: { + root: ({ theme }) => ({ + zIndex: theme.zIndex.drawer + 1, + }), + }, + }, + }, + }) +); export default defaultTheme; diff --git a/packages/web/src/types/index.d.ts b/packages/web/src/types/index.d.ts deleted file mode 100644 index 3adc8468..00000000 --- a/packages/web/src/types/index.d.ts +++ /dev/null @@ -1,493 +0,0 @@ -import type { AxiosInstance, AxiosRequestConfig } from 'axios'; -export type IHttpClient = AxiosInstance; -import type { Request } from 'express'; - -// Type definitions for automatisch - -export type IJSONValue = - | string - | number - | boolean - | null - | IJSONObject - | IJSONArray; -export type IJSONArray = Array; -export interface IJSONObject { - [x: string]: IJSONValue; -} - -export interface IConnection { - id: string; - key: string; - data: string; - formattedData?: IJSONObject; - userId: string; - verified: boolean; - count?: number; - flowCount?: number; - appData?: IApp; - createdAt: string; - reconnectable?: boolean; - appAuthClientId?: string; -} - -export interface IExecutionStep { - id: string; - executionId: string; - stepId: IStep['id']; - step: IStep; - dataIn: IJSONObject; - dataOut: IJSONObject; - errorDetails: IJSONObject; - status: string; - createdAt: string; - updatedAt: string; -} - -export interface IExecution { - id: string; - flowId: string; - flow: IFlow; - testRun: boolean; - status: 'success' | 'failure'; - executionSteps: IExecutionStep[]; - updatedAt: string | Date; - createdAt: string | Date; -} - -export interface IStep { - id: string; - name?: string; - flowId: string; - key?: string; - appKey?: string; - iconUrl: string; - webhookUrl?: string; - type: 'action' | 'trigger'; - connectionId?: string; - status: string; - position: number; - parameters: IJSONObject; - connection?: Partial; - flow: IFlow; - executionSteps: IExecutionStep[]; - // FIXME: remove this property once execution steps are properly exposed via queries - output?: IJSONObject; - appData?: IApp; -} - -export interface IFlow { - id: string; - name: string; - userId: string; - active: boolean; - status: 'paused' | 'published' | 'draft'; - steps: IStep[]; - createdAt: string | Date; - updatedAt: string | Date; - remoteWebhookId: string; - lastInternalId: () => Promise; -} - -export interface IUser { - id: string; - fullName: string; - email: string; - password: string; - connections: IConnection[]; - flows: IFlow[]; - steps: IStep[]; - role: IRole; - permissions: IPermission[]; - createdAt: string | Date; - updatedAt: string | Date; - trialExpiryDate: string | Date; -} - -export interface IRole { - id: string; - key: string; - name: string; - description: string; - isAdmin: boolean; - permissions: IPermission[]; -} - -export interface IPermission { - id: string; - action: string; - subject: string; - conditions: string[]; -} - -export interface IPermissionCatalog { - actions: { label: string; key: string; subjects: string[] }[]; - subjects: { label: string; key: string }[]; - conditions: { label: string; key: string }[]; -} - -export interface IConfig { - id: string; - key: string; - value: IJSONObject; -} - -export interface IFieldDropdown { - key: string; - label: string; - type: 'dropdown'; - required: boolean; - readOnly?: boolean; - value?: string | boolean; - placeholder?: string | null; - description?: string; - docUrl?: string; - clickToCopy?: boolean; - variables?: boolean; - dependsOn?: string[]; - options?: IFieldDropdownOption[]; - source?: IFieldDropdownSource; - additionalFields?: IFieldDropdownAdditionalFields; -} - -export interface IFieldDropdownSource { - type: string; - name: string; - arguments: { - name: string; - value: string; - }[]; -} -export interface IFieldDropdownAdditionalFields { - type: string; - name: string; - arguments: { - name: string; - value: string; - }[]; -} - -export interface IFieldDropdownOption { - label: string; - value: boolean | string | number; -} - -export interface IFieldText { - key: string; - label: string; - type: 'string'; - required?: boolean; - readOnly?: boolean; - value?: string; - placeholder?: string | null; - description?: string; - docUrl?: string; - clickToCopy?: boolean; - variables?: boolean; - dependsOn?: string[]; -} - -export interface IFieldDynamic { - key: string; - label: string; - type: 'dynamic'; - required?: boolean; - readOnly?: boolean; - description?: string; - value?: Record[]; - fields: (IFieldDropdown | IFieldText)[]; -} - -export type IField = IFieldDropdown | IFieldText | IFieldDynamic; - -export interface IAuthenticationStepField { - name: string; - value: string | null; - properties?: { - name: string; - value: string; - }[]; -} - -export interface IAuthenticationStep { - type: 'mutation' | 'openWithPopup'; - name: string; - arguments: IAuthenticationStepField[]; -} - -export interface IApp { - name: string; - key: string; - iconUrl: string; - docUrl?: string; - authDocUrl: string; - primaryColor: string; - supportsConnections: boolean; - apiBaseUrl: string; - baseUrl: string; - auth?: IAuth; - connectionCount?: number; - flowCount?: number; - beforeRequest?: TBeforeRequest[]; - dynamicData?: IDynamicData; - dynamicFields?: IDynamicFields; - triggers?: ITrigger[]; - actions?: IAction[]; - connections?: IConnection[]; -} - -export type TBeforeRequest = { - ($: IGlobalVariable, requestConfig: AxiosRequestConfig): AxiosRequestConfig; -}; - -export interface IDynamicData { - [index: string]: any; -} - -export interface IDynamicFields { - [index: string]: any; -} - -export interface IAuth { - generateAuthUrl?($: IGlobalVariable): Promise; - verifyCredentials?($: IGlobalVariable): Promise; - isStillVerified?($: IGlobalVariable): Promise; - refreshToken?($: IGlobalVariable): Promise; - verifyWebhook?($: IGlobalVariable): Promise; - isRefreshTokenRequested?: boolean; - fields?: IField[]; - authenticationSteps?: IAuthenticationStep[]; - reconnectionSteps?: IAuthenticationStep[]; - sharedAuthenticationSteps?: IAuthenticationStep[]; - sharedReconnectionSteps?: IAuthenticationStep[]; -} - -export interface ITriggerOutput { - data: ITriggerItem[]; - error?: IJSONObject; -} - -export interface ITriggerItem { - raw: IJSONObject; - meta: { - internalId: string; - }; -} - -export interface IBaseTrigger { - name: string; - key: string; - type?: 'webhook' | 'polling'; - showWebhookUrl?: boolean; - pollInterval?: number; - description: string; - useSingletonWebhook?: boolean; - singletonWebhookRefValueParameter?: string; - getInterval?(parameters: IStep['parameters']): string; - run?($: IGlobalVariable): Promise; - testRun?($: IGlobalVariable): Promise; - registerHook?($: IGlobalVariable): Promise; - unregisterHook?($: IGlobalVariable): Promise; -} - -export interface IRawTrigger extends IBaseTrigger { - arguments?: IField[]; -} - -export interface ITrigger extends IBaseTrigger { - substeps?: ISubstep[]; -} - -export interface IActionOutput { - data: IActionItem; - error?: IJSONObject; -} - -export interface IActionItem { - raw: IJSONObject; -} - -export interface IBaseAction { - name: string; - key: string; - description: string; - run?($: IGlobalVariable): Promise; -} - -export interface IRawAction extends IBaseAction { - arguments?: IField[]; -} - -export interface IAction extends IBaseAction { - substeps?: ISubstep[]; -} - -export interface IAuthentication { - client: unknown; - verifyCredentials(): Promise; - isStillVerified(): Promise; -} - -export interface ISubstep { - key: string; - name: string; - arguments?: IField[]; -} - -export type IHttpClientParams = { - $: IGlobalVariable; - baseURL?: string; - beforeRequest?: TBeforeRequest[]; -}; - -export type IGlobalVariable = { - auth: { - set: (args: IJSONObject) => Promise; - data: IJSONObject; - }; - app?: IApp; - http?: IHttpClient; - request?: IRequest; - flow?: { - id: string; - lastInternalId: string; - isAlreadyProcessed?: (internalId: string) => boolean; - remoteWebhookId?: string; - setRemoteWebhookId?: (remoteWebhookId: string) => Promise; - }; - step?: { - id: string; - appKey: string; - parameters: IJSONObject; - }; - nextStep?: { - id: string; - appKey: string; - parameters: IJSONObject; - }; - execution?: { - id: string; - testRun: boolean; - exit: () => void; - }; - getLastExecutionStep?: () => Promise; - webhookUrl?: string; - singletonWebhookUrl?: string; - triggerOutput?: ITriggerOutput; - actionOutput?: IActionOutput; - pushTriggerItem?: (triggerItem: ITriggerItem) => void; - setActionItem?: (actionItem: IActionItem) => void; -}; - -export type TPaymentPlan = { - price: string; - name: string; - limit: string; - productId: string; -}; - -export type TSubscription = { - status: string; - monthlyQuota: { - title: string; - action: BillingCardAction; - }; - nextBillDate: { - title: string; - action: BillingCardAction; - }; - nextBillAmount: { - title: string; - action: BillingCardAction; - }; -}; - -type TBillingCardAction = TBillingTextCardAction | TBillingLinkCardAction; - -type TBillingTextCardAction = { - type: 'text'; - text: string; -}; - -type TBillingLinkCardAction = { - type: 'link'; - text: string; - src: string; -}; - -type TInvoice = { - id: number; - amount: number; - currency: string; - payout_date: string; - receipt_url: string; -}; - -type TSamlAuthProvider = { - id: string; - name: string; - certificate: string; - signatureAlgorithm: 'sha1' | 'sha256' | 'sha512'; - issuer: string; - entryPoint: string; - firstnameAttributeName: string; - surnameAttributeName: string; - emailAttributeName: string; - roleAttributeName: string; - defaultRoleId: string; - active: boolean; - loginUrl: string; -}; - -type TSamlAuthProviderRole = { - id: string; - samlAuthProviderId: string; - roleId: string; - remoteRoleName: string; -}; - -type AppConfig = { - id: string; - key: string; - allowCustomConnection: boolean; - canConnect: boolean; - canCustomConnect: boolean; - shared: boolean; - disabled: boolean; -}; - -type AppAuthClient = { - id: string; - name: string; - appConfigId: string; - authDefaults: string; - formattedAuthDefaults: IJSONObject; - active: boolean; -}; - -type Notification = { - name: string; - createdAt: string; - documentationUrl: string; - description: string; -}; - -declare module 'axios' { - interface AxiosResponse { - httpError?: IJSONObject; - } - - interface AxiosRequestConfig { - additionalProperties?: Record; - } - - // ref: https://github.com/axios/axios/issues/5095 - interface AxiosInstance { - create(config?: CreateAxiosDefaults): AxiosInstance; - } -} - -export interface IRequest extends Request { - rawBody?: Buffer; - currentUser?: IUser; -} diff --git a/packages/web/tsconfig.json b/packages/web/tsconfig.json deleted file mode 100644 index 9b796702..00000000 --- a/packages/web/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "compilerOptions": { - "target": "es5", - "lib": ["dom", "dom.iterable", "esnext"], - "baseUrl": "src", - "allowJs": true, - "skipLibCheck": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noFallthroughCasesInSwitch": true, - "module": "esnext", - "moduleResolution": "node", - "resolveJsonModule": true, - "isolatedModules": true, - "noEmit": true, - "jsx": "react-jsx" - }, - "include": ["src"] -} diff --git a/yarn.lock b/yarn.lock index eb27a65b..8d36a8da 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1742,13 +1742,6 @@ resolved "https://registry.yarnpkg.com/@esbuild/win32-x64/-/win32-x64-0.19.11.tgz#a5d300008960bb39677c46bf16f53ec70d8dee04" integrity sha512-vfkhltrjCAb603XaFhqhAF4LGDi2M4OrCRrFusyQ+iTLQ/o60QQXxc9cZC/FFpihBI9N1Grn6SMKVJ4KP7Fuiw== -"@eslint-community/eslint-utils@^4.4.0": - version "4.4.0" - resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59" - integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA== - dependencies: - eslint-visitor-keys "^3.3.0" - "@eslint/eslintrc@^1.0.5": version "1.0.5" resolved "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.5.tgz" @@ -3896,24 +3889,11 @@ jest-diff "^27.0.0" pretty-format "^27.0.0" -"@types/jest@^26.0.15": - version "26.0.24" - resolved "https://registry.npmjs.org/@types/jest/-/jest-26.0.24.tgz" - integrity sha512-E/X5Vib8BWqZNRlDxj9vYXhsDwPYbPINqKF9BsnSoon4RQ0D9moEuLD8txgyypFLH7J4+Lho9Nr/c8H0Fi+17w== - dependencies: - jest-diff "^26.0.0" - pretty-format "^26.0.0" - "@types/json-schema@*", "@types/json-schema@^7.0.4", "@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.9" resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz" integrity sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ== -"@types/json-schema@^7.0.12": - version "7.0.15" - resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" - integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== - "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz" @@ -3929,16 +3909,6 @@ resolved "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.181.tgz" integrity sha512-n3tyKthHJbkiWhDZs3DkhkCzt2MexYHXlX0td5iMplyfwketaOeKboEVBqzceH7juqvEg3q5oUoBFxSLu7zFag== -"@types/lodash@^4.14.182": - version "4.14.182" - resolved "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.182.tgz" - integrity sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q== - -"@types/luxon@^2.0.8": - version "2.0.9" - resolved "https://registry.npmjs.org/@types/luxon/-/luxon-2.0.9.tgz" - integrity sha512-ZuzIc7aN+i2ZDMWIiSmMdubR9EMMSTdEzF6R+FckP4p6xdnOYKqknTo/k+xXQvciSXlNGIwA4OPU5X7JIFzYdA== - "@types/mime@^1": version "1.3.2" resolved "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz" @@ -3964,11 +3934,6 @@ resolved "https://registry.npmjs.org/@types/node/-/node-17.0.10.tgz" integrity sha512-S/3xB4KzyFxYGCppyDt68yzBU9ysL88lSdIah4D6cptdcltc4NCPCAMc0+PCpg/lLIyC7IPvj2Z52OJWeIUkog== -"@types/node@^12.0.0": - version "12.20.42" - resolved "https://registry.npmjs.org/@types/node/-/node-12.20.42.tgz" - integrity sha512-aI3/oo5DzyiI5R/xAhxxRzfZlWlsbbqdgxfTPkqu/Zt+23GXiJvMCyPJT4+xKSXOnLqoL8jJYMLTwvK2M3a5hw== - "@types/node@^17.0.5": version "17.0.45" resolved "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz" @@ -4029,13 +3994,6 @@ resolved "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.4.tgz" integrity sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw== -"@types/react-dom@^17.0.0": - version "17.0.11" - resolved "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.11.tgz" - integrity sha512-f96K3k+24RaLGVu/Y2Ng3e1EbZ8/cVJvypZWd7cy0ofCBaf2lcM46xNhycMZ2xGwbBjRql7hOlZ+e2WlJ5MH3Q== - dependencies: - "@types/react" "*" - "@types/react-is@^16.7.1 || ^17.0.0": version "17.0.3" resolved "https://registry.npmjs.org/@types/react-is/-/react-is-17.0.3.tgz" @@ -4050,14 +4008,7 @@ dependencies: "@types/react" "*" -"@types/react-window@^1.8.5": - version "1.8.5" - resolved "https://registry.npmjs.org/@types/react-window/-/react-window-1.8.5.tgz" - integrity sha512-V9q3CvhC9Jk9bWBOysPGaWy/Z0lxYcTXLtLipkt2cnRj1JOSFNF7wqGpkScSXMgBwC+fnVRg/7shwgddBG5ICw== - dependencies: - "@types/react" "*" - -"@types/react@*", "@types/react@16 || 17", "@types/react@^17.0.0": +"@types/react@*", "@types/react@16 || 17": version "17.0.38" resolved "https://registry.npmjs.org/@types/react/-/react-17.0.38.tgz" integrity sha512-SI92X1IA+FMnP3qM5m4QReluXzhcmovhZnLNm3pyeQlooi02qI7sLiepEYqT678uNiyc25XfCqxREFpy3W7YhQ== @@ -4090,11 +4041,6 @@ resolved "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz" integrity sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew== -"@types/semver@^7.5.0": - version "7.5.8" - resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.8.tgz#8268a8c57a3e4abd25c165ecd36237db7948a55e" - integrity sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ== - "@types/send@*": version "0.17.1" resolved "https://registry.npmjs.org/@types/send/-/send-0.17.1.tgz" @@ -4142,11 +4088,6 @@ resolved "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.2.tgz" integrity sha512-F5DIZ36YVLE+PN+Zwws4kJogq47hNgX3Nx6WyDJ3kcplxyke3XIzB8uK5n/Lpm1HBsbGzd6nmGehL8cPekP+Tg== -"@types/uuid@^9.0.0": - version "9.0.0" - resolved "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.0.tgz" - integrity sha512-kr90f+ERiQtKWMz5rP32ltJ/BtULDI5RVO0uavn1HQUOwjx0R1h0rnDYNL0CepF1zL5bSY6FISAfd9tOdDhU5Q== - "@types/web-bluetooth@^0.0.15": version "0.0.15" resolved "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.15.tgz" @@ -4210,7 +4151,7 @@ resolved "https://registry.npmjs.org/@types/zen-observable/-/zen-observable-0.8.3.tgz" integrity sha512-fbF6oTd4sGGy0xjHPKAt+eS2CrxJ3+6gQ3FGcBoIJR2TLAyCkCyI8JqZNy+FeON0AhVgNJoUumVoZQjBFUqHkw== -"@typescript-eslint/eslint-plugin@^5.5.0", "@typescript-eslint/eslint-plugin@^5.9.1": +"@typescript-eslint/eslint-plugin@^5.5.0": version "5.10.0" resolved "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.10.0.tgz" integrity sha512-XXVKnMsq2fuu9K2KsIxPUGqb6xAImz8MEChClbXmE3VbveFtBUU5bzM6IPVWqzyADIgdkS2Ws/6Xo7W2TeZWjQ== @@ -4232,7 +4173,7 @@ dependencies: "@typescript-eslint/utils" "5.10.0" -"@typescript-eslint/parser@^5.5.0", "@typescript-eslint/parser@^5.9.1": +"@typescript-eslint/parser@^5.5.0": version "5.10.0" resolved "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.10.0.tgz" integrity sha512-pJB2CCeHWtwOAeIxv8CHVGJhI5FNyJAIpx5Pt72YkK3QfEzt6qAlXZuyaBmyfOdM62qU0rbxJzNToPTVeJGrQw== @@ -4250,14 +4191,6 @@ "@typescript-eslint/types" "5.10.0" "@typescript-eslint/visitor-keys" "5.10.0" -"@typescript-eslint/scope-manager@7.0.2": - version "7.0.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-7.0.2.tgz#6ec4cc03752758ddd1fdaae6fbd0ed9a2ca4fe63" - integrity sha512-l6sa2jF3h+qgN2qUMjVR3uCNGjWw4ahGfzIYsCtFrQJCjhbrDPdiihYT8FnnqFwsWX+20hK592yX9I2rxKTP4g== - dependencies: - "@typescript-eslint/types" "7.0.2" - "@typescript-eslint/visitor-keys" "7.0.2" - "@typescript-eslint/type-utils@5.10.0": version "5.10.0" resolved "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.10.0.tgz" @@ -4272,11 +4205,6 @@ resolved "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.10.0.tgz" integrity sha512-wUljCgkqHsMZbw60IbOqT/puLfyqqD5PquGiBo1u1IS3PLxdi3RDGlyf032IJyh+eQoGhz9kzhtZa+VC4eWTlQ== -"@typescript-eslint/types@7.0.2": - version "7.0.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-7.0.2.tgz#b6edd108648028194eb213887d8d43ab5750351c" - integrity sha512-ZzcCQHj4JaXFjdOql6adYV4B/oFOFjPOC9XYwCaZFRvqN8Llfvv4gSxrkQkd2u4Ci62i2c6W6gkDwQJDaRc4nA== - "@typescript-eslint/typescript-estree@5.10.0": version "5.10.0" resolved "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.10.0.tgz" @@ -4290,20 +4218,6 @@ semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/typescript-estree@7.0.2": - version "7.0.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-7.0.2.tgz#3c6dc8a3b9799f4ef7eca0d224ded01974e4cb39" - integrity sha512-3AMc8khTcELFWcKcPc0xiLviEvvfzATpdPj/DXuOGIdQIIFybf4DMT1vKRbuAEOFMwhWt7NFLXRkbjsvKZQyvw== - dependencies: - "@typescript-eslint/types" "7.0.2" - "@typescript-eslint/visitor-keys" "7.0.2" - debug "^4.3.4" - globby "^11.1.0" - is-glob "^4.0.3" - minimatch "9.0.3" - semver "^7.5.4" - ts-api-utils "^1.0.1" - "@typescript-eslint/utils@5.10.0": version "5.10.0" resolved "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.10.0.tgz" @@ -4316,19 +4230,6 @@ eslint-scope "^5.1.1" eslint-utils "^3.0.0" -"@typescript-eslint/utils@^7.0.2": - version "7.0.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-7.0.2.tgz#8756123054cd934c8ba7db6a6cffbc654b10b5c4" - integrity sha512-PZPIONBIB/X684bhT1XlrkjNZJIEevwkKDsdwfiu1WeqBxYEEdIgVDgm8/bbKHVu+6YOpeRqcfImTdImx/4Bsw== - dependencies: - "@eslint-community/eslint-utils" "^4.4.0" - "@types/json-schema" "^7.0.12" - "@types/semver" "^7.5.0" - "@typescript-eslint/scope-manager" "7.0.2" - "@typescript-eslint/types" "7.0.2" - "@typescript-eslint/typescript-estree" "7.0.2" - semver "^7.5.4" - "@typescript-eslint/visitor-keys@5.10.0": version "5.10.0" resolved "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.10.0.tgz" @@ -4337,14 +4238,6 @@ "@typescript-eslint/types" "5.10.0" eslint-visitor-keys "^3.0.0" -"@typescript-eslint/visitor-keys@7.0.2": - version "7.0.2" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-7.0.2.tgz#2899b716053ad7094962beb895d11396fc12afc7" - integrity sha512-8Y+YiBmqPighbm5xA2k4wKTxRzx9EkBu7Rlw+WHqMvRJ3RPz/BMBO9b2ru0LUNmXg120PHUXD5+SWFy2R8DqlQ== - dependencies: - "@typescript-eslint/types" "7.0.2" - eslint-visitor-keys "^3.4.1" - "@ucast/core@^1.0.0", "@ucast/core@^1.4.1", "@ucast/core@^1.6.1": version "1.10.2" resolved "https://registry.npmjs.org/@ucast/core/-/core-1.10.2.tgz" @@ -5134,6 +5027,14 @@ aria-query@^5.0.0: resolved "https://registry.npmjs.org/aria-query/-/aria-query-5.0.0.tgz" integrity sha512-V+SM7AbUwJ+EBnB8+DXs0hPZHO0W6pqBcc0dW90OwtVG02PswOu/teuARoLQjdDOH+t9pJgGnW5/Qmouf3gPJg== +array-buffer-byte-length@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz#1e5583ec16763540a27ae52eed99ff899223568f" + integrity sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg== + dependencies: + call-bind "^1.0.5" + is-array-buffer "^3.0.4" + array-differ@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz" @@ -5165,6 +5066,17 @@ array-includes@^3.1.3, array-includes@^3.1.4: get-intrinsic "^1.1.1" is-string "^1.0.7" +array-includes@^3.1.6: + version "3.1.7" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.7.tgz#8cd2e01b26f7a3086cbc87271593fe921c62abda" + integrity sha512-dlcsNBIiWhPkHdOEEKnehA+RNUWDc4UqFtnIXU4uuYDPtA4LDkr7qip2p0VvFAEXNDr0yWZ9PJyIRiGjRLQzwQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + get-intrinsic "^1.2.1" + is-string "^1.0.7" + array-union@^2.1.0: version "2.1.0" resolved "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz" @@ -5188,6 +5100,41 @@ array.prototype.flatmap@^1.2.5: define-properties "^1.1.3" es-abstract "^1.19.0" +array.prototype.flatmap@^1.3.1: + version "1.3.2" + resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz#c9a7c6831db8e719d6ce639190146c24bbd3e527" + integrity sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + es-shim-unscopables "^1.0.0" + +array.prototype.tosorted@^1.1.1: + version "1.1.3" + resolved "https://registry.yarnpkg.com/array.prototype.tosorted/-/array.prototype.tosorted-1.1.3.tgz#c8c89348337e51b8a3c48a9227f9ce93ceedcba8" + integrity sha512-/DdH4TiTmOKzyQbp/eadcCVexiCb36xJg7HshYOYJnNZFDj33GEv0P7GxsynpShhq4OLYJzbGcBDkLsDt7MnNg== + dependencies: + call-bind "^1.0.5" + define-properties "^1.2.1" + es-abstract "^1.22.3" + es-errors "^1.1.0" + es-shim-unscopables "^1.0.2" + +arraybuffer.prototype.slice@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/arraybuffer.prototype.slice/-/arraybuffer.prototype.slice-1.0.3.tgz#097972f4255e41bc3425e37dc3f6421cf9aefde6" + integrity sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A== + dependencies: + array-buffer-byte-length "^1.0.1" + call-bind "^1.0.5" + define-properties "^1.2.1" + es-abstract "^1.22.3" + es-errors "^1.2.1" + get-intrinsic "^1.2.3" + is-array-buffer "^3.0.4" + is-shared-array-buffer "^1.0.2" + arrify@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz" @@ -5242,6 +5189,13 @@ async@^3.2.3: resolved "https://registry.npmjs.org/async/-/async-3.2.3.tgz" integrity sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g== +asynciterator.prototype@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/asynciterator.prototype/-/asynciterator.prototype-1.0.0.tgz#8c5df0514936cdd133604dfcc9d3fb93f09b2b62" + integrity sha512-wwHYEIS0Q80f5mosx3L/dfG5t5rjEa9Ft51GTaNt862EnpyGHpgz2RkZvLPp1oF5TnAiTohkEKVEu8pQPJI7Vg== + dependencies: + has-symbols "^1.0.3" + asynckit@^0.4.0: version "0.4.0" resolved "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz" @@ -5269,6 +5223,13 @@ autoprefixer@^10.4.2: picocolors "^1.0.0" postcss-value-parser "^4.2.0" +available-typed-arrays@^1.0.6, available-typed-arrays@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.7.tgz#a5cc375d6a03c2efc87a553f3e0b1522def14846" + integrity sha512-wvUjBtSGN7+7SjNpq/9M2Tg350UZD3q62IFZLbRAR1bSMlCo1ZaeW+BJ+D090e4hIIZLBcTDWe4Mh4jvUDajzQ== + dependencies: + possible-typed-array-names "^1.0.0" + aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz" @@ -5793,6 +5754,17 @@ call-bind@^1.0.0, call-bind@^1.0.2: function-bind "^1.1.1" get-intrinsic "^1.0.2" +call-bind@^1.0.5, call-bind@^1.0.6, call-bind@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.7.tgz#06016599c40c56498c18769d2730be242b6fa3b9" + integrity sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.4" + set-function-length "^1.2.1" + callsites@^3.0.0: version "3.1.0" resolved "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz" @@ -6915,6 +6887,15 @@ defer-to-connect@^1.0.1: resolved "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz" integrity sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ== +define-data-property@^1.0.1, define-data-property@^1.1.2, define-data-property@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/define-data-property/-/define-data-property-1.1.4.tgz#894dc141bb7d3060ae4366f6a0107e68fbe48c5e" + integrity sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A== + dependencies: + es-define-property "^1.0.0" + es-errors "^1.3.0" + gopd "^1.0.1" + define-lazy-prop@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz" @@ -6927,6 +6908,15 @@ define-properties@^1.1.3: dependencies: object-keys "^1.0.12" +define-properties@^1.2.0, define-properties@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.2.1.tgz#10781cc616eb951a80a034bafcaa7377f6af2b6c" + integrity sha512-8QmQKqEASLd5nx0U1B1okLElbUuuttJ/AnYmRXbbbGDWh6uS208EjD4Xqq/I9wK7u0v6O08XhTWnt5XtEbR6Dg== + dependencies: + define-data-property "^1.0.1" + has-property-descriptors "^1.0.0" + object-keys "^1.1.1" + defined@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz" @@ -7054,11 +7044,6 @@ didyoumean@^1.2.2: resolved "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz" integrity sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw== -diff-sequences@^26.6.2: - version "26.6.2" - resolved "https://registry.npmjs.org/diff-sequences/-/diff-sequences-26.6.2.tgz" - integrity sha512-Mv/TDa3nZ9sbc5soK+OoA74BsS3mL37yixCvUAQkiuA4Wz6YtwP/K47n2rv2ovzHZvoiQeA5FTQOschKkEwB0Q== - diff-sequences@^27.4.0: version "27.4.0" resolved "https://registry.npmjs.org/diff-sequences/-/diff-sequences-27.4.0.tgz" @@ -7424,11 +7409,107 @@ es-abstract@^1.17.2, es-abstract@^1.19.0, es-abstract@^1.19.1: string.prototype.trimstart "^1.0.4" unbox-primitive "^1.0.1" +es-abstract@^1.22.1, es-abstract@^1.22.3, es-abstract@^1.22.4: + version "1.22.4" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.22.4.tgz#26eb2e7538c3271141f5754d31aabfdb215f27bf" + integrity sha512-vZYJlk2u6qHYxBOTjAeg7qUxHdNfih64Uu2J8QqWgXZ2cri0ZpJAkzDUK/q593+mvKwlxyaxr6F1Q+3LKoQRgg== + dependencies: + array-buffer-byte-length "^1.0.1" + arraybuffer.prototype.slice "^1.0.3" + available-typed-arrays "^1.0.6" + call-bind "^1.0.7" + es-define-property "^1.0.0" + es-errors "^1.3.0" + es-set-tostringtag "^2.0.2" + es-to-primitive "^1.2.1" + function.prototype.name "^1.1.6" + get-intrinsic "^1.2.4" + get-symbol-description "^1.0.2" + globalthis "^1.0.3" + gopd "^1.0.1" + has-property-descriptors "^1.0.2" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.1" + internal-slot "^1.0.7" + is-array-buffer "^3.0.4" + is-callable "^1.2.7" + is-negative-zero "^2.0.2" + is-regex "^1.1.4" + is-shared-array-buffer "^1.0.2" + is-string "^1.0.7" + is-typed-array "^1.1.13" + is-weakref "^1.0.2" + object-inspect "^1.13.1" + object-keys "^1.1.1" + object.assign "^4.1.5" + regexp.prototype.flags "^1.5.2" + safe-array-concat "^1.1.0" + safe-regex-test "^1.0.3" + string.prototype.trim "^1.2.8" + string.prototype.trimend "^1.0.7" + string.prototype.trimstart "^1.0.7" + typed-array-buffer "^1.0.1" + typed-array-byte-length "^1.0.0" + typed-array-byte-offset "^1.0.0" + typed-array-length "^1.0.4" + unbox-primitive "^1.0.2" + which-typed-array "^1.1.14" + +es-define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/es-define-property/-/es-define-property-1.0.0.tgz#c7faefbdff8b2696cf5f46921edfb77cc4ba3845" + integrity sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ== + dependencies: + get-intrinsic "^1.2.4" + +es-errors@^1.0.0, es-errors@^1.1.0, es-errors@^1.2.1, es-errors@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/es-errors/-/es-errors-1.3.0.tgz#05f75a25dab98e4fb1dcd5e1472c0546d5057c8f" + integrity sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw== + +es-iterator-helpers@^1.0.12: + version "1.0.17" + resolved "https://registry.yarnpkg.com/es-iterator-helpers/-/es-iterator-helpers-1.0.17.tgz#123d1315780df15b34eb181022da43e734388bb8" + integrity sha512-lh7BsUqelv4KUbR5a/ZTaGGIMLCjPGPqJ6q+Oq24YP0RdyptX1uzm4vvaqzk7Zx3bpl/76YLTTDj9L7uYQ92oQ== + dependencies: + asynciterator.prototype "^1.0.0" + call-bind "^1.0.7" + define-properties "^1.2.1" + es-abstract "^1.22.4" + es-errors "^1.3.0" + es-set-tostringtag "^2.0.2" + function-bind "^1.1.2" + get-intrinsic "^1.2.4" + globalthis "^1.0.3" + has-property-descriptors "^1.0.2" + has-proto "^1.0.1" + has-symbols "^1.0.3" + internal-slot "^1.0.7" + iterator.prototype "^1.1.2" + safe-array-concat "^1.1.0" + es-module-lexer@^0.9.0: version "0.9.3" resolved "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz" integrity sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ== +es-set-tostringtag@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz#8bb60f0a440c2e4281962428438d58545af39777" + integrity sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ== + dependencies: + get-intrinsic "^1.2.4" + has-tostringtag "^1.0.2" + hasown "^2.0.1" + +es-shim-unscopables@^1.0.0, es-shim-unscopables@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz#1f6942e71ecc7835ed1c8a83006d8771a63a3763" + integrity sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw== + dependencies: + hasown "^2.0.0" + es-to-primitive@^1.2.1: version "1.2.1" resolved "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz" @@ -7642,6 +7723,11 @@ eslint-config-prettier@^8.3.0: resolved "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz" integrity sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew== +eslint-config-prettier@^9.1.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz#31af3d94578645966c082fcb71a5846d3c94867f" + integrity sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw== + eslint-config-react-app@^7.0.0: version "7.0.0" resolved "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-7.0.0.tgz" @@ -7662,6 +7748,26 @@ eslint-config-react-app@^7.0.0: eslint-plugin-react-hooks "^4.3.0" eslint-plugin-testing-library "^5.0.1" +eslint-config-react-app@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/eslint-config-react-app/-/eslint-config-react-app-7.0.1.tgz#73ba3929978001c5c86274c017ea57eb5fa644b4" + integrity sha512-K6rNzvkIeHaTd8m/QEh1Zko0KI7BACWkkneSs6s9cKZC/J27X3eZR6Upt1jkmZ/4FK+XUOPPxMEN7+lbUXfSlA== + dependencies: + "@babel/core" "^7.16.0" + "@babel/eslint-parser" "^7.16.3" + "@rushstack/eslint-patch" "^1.1.0" + "@typescript-eslint/eslint-plugin" "^5.5.0" + "@typescript-eslint/parser" "^5.5.0" + babel-preset-react-app "^10.0.1" + confusing-browser-globals "^1.0.11" + eslint-plugin-flowtype "^8.0.3" + eslint-plugin-import "^2.25.3" + eslint-plugin-jest "^25.3.0" + eslint-plugin-jsx-a11y "^6.5.1" + eslint-plugin-react "^7.27.1" + eslint-plugin-react-hooks "^4.3.0" + eslint-plugin-testing-library "^5.0.1" + eslint-import-resolver-node@^0.3.6: version "0.3.6" resolved "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz" @@ -7762,6 +7868,28 @@ eslint-plugin-react@^7.27.1: semver "^6.3.0" string.prototype.matchall "^4.0.6" +eslint-plugin-react@^7.33.2: + version "7.33.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.33.2.tgz#69ee09443ffc583927eafe86ffebb470ee737608" + integrity sha512-73QQMKALArI8/7xGLNI/3LylrEYrlKZSb5C9+q3OtOewTnMQi5cT+aE9E41sLCmli3I9PGGmD1yiZydyo4FEPw== + dependencies: + array-includes "^3.1.6" + array.prototype.flatmap "^1.3.1" + array.prototype.tosorted "^1.1.1" + doctrine "^2.1.0" + es-iterator-helpers "^1.0.12" + estraverse "^5.3.0" + jsx-ast-utils "^2.4.1 || ^3.0.0" + minimatch "^3.1.2" + object.entries "^1.1.6" + object.fromentries "^2.0.6" + object.hasown "^1.1.2" + object.values "^1.1.6" + prop-types "^15.8.1" + resolve "^2.0.0-next.4" + semver "^6.3.1" + string.prototype.matchall "^4.0.8" + eslint-plugin-testing-library@^5.0.1: version "5.0.4" resolved "https://registry.npmjs.org/eslint-plugin-testing-library/-/eslint-plugin-testing-library-5.0.4.tgz" @@ -7815,11 +7943,6 @@ eslint-visitor-keys@^3.3.0: resolved "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz" integrity sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA== -eslint-visitor-keys@^3.4.1: - version "3.4.3" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800" - integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag== - eslint-webpack-plugin@^3.1.1: version "3.1.1" resolved "https://registry.npmjs.org/eslint-webpack-plugin/-/eslint-webpack-plugin-3.1.1.tgz" @@ -8374,6 +8497,13 @@ follow-redirects@^1.0.0, follow-redirects@^1.14.8, follow-redirects@^1.15.0: resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.3.tgz#fe2f3ef2690afce7e82ed0b44db08165b207123a" integrity sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q== +for-each@^0.3.3: + version "0.3.3" + resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" + integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw== + dependencies: + is-callable "^1.1.3" + forever-agent@~0.6.1: version "0.6.1" resolved "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz" @@ -8508,11 +8638,31 @@ function-bind@^1.1.1: resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +function-bind@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.2.tgz#2c02d864d97f3ea6c8830c464cbd11ab6eab7a1c" + integrity sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA== + +function.prototype.name@^1.1.5, function.prototype.name@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.6.tgz#cdf315b7d90ee77a4c6ee216c3c3362da07533fd" + integrity sha512-Z5kx79swU5P27WEayXM1tBi5Ze/lbIyiNgU3qyXUOf9b2rgXYyF9Dy9Cx+IQv/Lc8WCG6L82zwUPpSS9hGehIg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + functions-have-names "^1.2.3" + functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= +functions-have-names@^1.2.3: + version "1.2.3" + resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" + integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== + gauge@^3.0.0: version "3.0.2" resolved "https://registry.npmjs.org/gauge/-/gauge-3.0.2.tgz" @@ -8575,6 +8725,17 @@ get-intrinsic@^1.1.0, get-intrinsic@^1.1.1: has "^1.0.3" has-symbols "^1.0.1" +get-intrinsic@^1.1.3, get-intrinsic@^1.2.1, get-intrinsic@^1.2.2, get-intrinsic@^1.2.3, get-intrinsic@^1.2.4: + version "1.2.4" + resolved "https://registry.yarnpkg.com/get-intrinsic/-/get-intrinsic-1.2.4.tgz#e385f5a4b5227d449c3eabbad05494ef0abbeadd" + integrity sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ== + dependencies: + es-errors "^1.3.0" + function-bind "^1.1.2" + has-proto "^1.0.1" + has-symbols "^1.0.3" + hasown "^2.0.0" + get-own-enumerable-property-symbols@^3.0.0: version "3.0.2" resolved "https://registry.npmjs.org/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.2.tgz" @@ -8632,6 +8793,15 @@ get-symbol-description@^1.0.0: call-bind "^1.0.2" get-intrinsic "^1.1.1" +get-symbol-description@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.2.tgz#533744d5aa20aca4e079c8e5daf7fd44202821f5" + integrity sha512-g0QYk1dZBxGwk+Ngc+ltRH2IBp2f7zBkBMBJZCDerh6EhlhSR6+9irMCuT/09zD6qkarHUSn529sK/yL4S27mg== + dependencies: + call-bind "^1.0.5" + es-errors "^1.3.0" + get-intrinsic "^1.2.4" + getopts@2.3.0: version "2.3.0" resolved "https://registry.npmjs.org/getopts/-/getopts-2.3.0.tgz" @@ -8770,7 +8940,14 @@ globals@^13.6.0, globals@^13.9.0: dependencies: type-fest "^0.20.2" -globby@^11.0.1, globby@^11.0.2, globby@^11.0.3, globby@^11.0.4, globby@^11.1.0: +globalthis@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf" + integrity sha512-sFdI5LyBiNTHjRd7cGPWapiHWMOXKyuBNX/cWJ3NfzrZQVa8GI/8cofCl74AOVqq9W5kNmguTIzJ/1s2gyI9wA== + dependencies: + define-properties "^1.1.3" + +globby@^11.0.1, globby@^11.0.2, globby@^11.0.3, globby@^11.0.4: version "11.1.0" resolved "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz" integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== @@ -8787,6 +8964,13 @@ goober@^2.0.33: resolved "https://registry.yarnpkg.com/goober/-/goober-2.1.13.tgz#e3c06d5578486212a76c9eba860cbc3232ff6d7c" integrity sha512-jFj3BQeleOoy7t93E9rZ2de+ScC4lQICLwiAQmKMg9F6roKGaLSHoCDYKkWlSafg138jejvq/mTdvmnwDQgqoQ== +gopd@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c" + integrity sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA== + dependencies: + get-intrinsic "^1.1.3" + got@^9.6.0: version "9.6.0" resolved "https://registry.npmjs.org/got/-/got-9.6.0.tgz" @@ -8905,6 +9089,11 @@ has-bigints@^1.0.1: resolved "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz" integrity sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA== +has-bigints@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" + integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ== + has-flag@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz" @@ -8915,6 +9104,18 @@ has-flag@^4.0.0: resolved "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz" integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== +has-property-descriptors@^1.0.0, has-property-descriptors@^1.0.1, has-property-descriptors@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz#963ed7d071dc7bf5f084c5bfbe0d1b6222586854" + integrity sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg== + dependencies: + es-define-property "^1.0.0" + +has-proto@^1.0.1, has-proto@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-proto/-/has-proto-1.0.3.tgz#b31ddfe9b0e6e9914536a6ab286426d0214f77fd" + integrity sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q== + has-symbols@^1.0.1, has-symbols@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz" @@ -8932,6 +9133,13 @@ has-tostringtag@^1.0.0: dependencies: has-symbols "^1.0.2" +has-tostringtag@^1.0.1, has-tostringtag@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.2.tgz#2cdc42d40bef2e5b4eeab7c01a73c54ce7ab5abc" + integrity sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw== + dependencies: + has-symbols "^1.0.3" + has-unicode@^2.0.0, has-unicode@^2.0.1: version "2.0.1" resolved "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz" @@ -8949,6 +9157,13 @@ has@^1.0.3: dependencies: function-bind "^1.1.1" +hasown@^2.0.0, hasown@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/hasown/-/hasown-2.0.1.tgz#26f48f039de2c0f8d3356c223fb8d50253519faa" + integrity sha512-1/th4MHjnwncwXsIW6QMzlvYL9kG5e/CpVvLRZe4XPa8TOUNbCELqmvhDmnkNsAjwaG4+I8gJJL0JBvTTLO9qA== + dependencies: + function-bind "^1.1.2" + he@1.2.0, he@^1.2.0: version "1.2.0" resolved "https://registry.npmjs.org/he/-/he-1.2.0.tgz" @@ -9362,6 +9577,15 @@ internal-slot@^1.0.3: has "^1.0.3" side-channel "^1.0.4" +internal-slot@^1.0.5, internal-slot@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.0.7.tgz#c06dcca3ed874249881007b0a5523b172a190802" + integrity sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g== + dependencies: + es-errors "^1.3.0" + hasown "^2.0.0" + side-channel "^1.0.4" + interpret@^2.2.0: version "2.2.0" resolved "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz" @@ -9432,6 +9656,14 @@ is-arguments@^1.0.4: call-bind "^1.0.2" has-tostringtag "^1.0.0" +is-array-buffer@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/is-array-buffer/-/is-array-buffer-3.0.4.tgz#7a1f92b3d61edd2bc65d24f130530ea93d7fae98" + integrity sha512-wcjaerHw0ydZwfhiKbXJWLDY8A7yV7KhjQOpb83hGgGfId/aQa4TOvwyzn2PuswW2gPCYEL/nEAiSVpdOj1lXw== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.2.1" + is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz" @@ -9442,6 +9674,13 @@ is-arrayish@^0.3.1: resolved "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz" integrity sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ== +is-async-function@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-async-function/-/is-async-function-2.0.0.tgz#8e4418efd3e5d3a6ebb0164c05ef5afb69aa9646" + integrity sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA== + dependencies: + has-tostringtag "^1.0.0" + is-bigint@^1.0.1: version "1.0.4" resolved "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz" @@ -9469,6 +9708,11 @@ is-buffer@~1.1.6: resolved "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz" integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== +is-callable@^1.1.3, is-callable@^1.2.7: + version "1.2.7" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.7.tgz#3bc2a85ea742d9e36205dcacdd72ca1fdc51b055" + integrity sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA== + is-callable@^1.1.4, is-callable@^1.2.4: version "1.2.4" resolved "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz" @@ -9481,6 +9725,13 @@ is-ci@^2.0.0: dependencies: ci-info "^2.0.0" +is-core-module@^2.13.0: + version "2.13.1" + resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.13.1.tgz#ad0d7532c6fea9da1ebdc82742d74525c6273384" + integrity sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw== + dependencies: + hasown "^2.0.0" + is-core-module@^2.2.0, is-core-module@^2.5.0, is-core-module@^2.8.0, is-core-module@^2.8.1: version "2.8.1" resolved "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz" @@ -9495,7 +9746,7 @@ is-core-module@^2.9.0: dependencies: has "^1.0.3" -is-date-object@^1.0.1: +is-date-object@^1.0.1, is-date-object@^1.0.5: version "1.0.5" resolved "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz" integrity sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ== @@ -9512,6 +9763,13 @@ is-extglob@^2.1.1: resolved "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz" integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= +is-finalizationregistry@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-finalizationregistry/-/is-finalizationregistry-1.0.2.tgz#c8749b65f17c133313e661b1289b95ad3dbd62e6" + integrity sha512-0by5vtUJs8iFQb5TYUHHPudOR+qXYIMKtiUzvLIZITZUjknFmziyBJuLhVRc+Ds0dREFlskDNJKYIdIzu/9pfw== + dependencies: + call-bind "^1.0.2" + is-fullwidth-code-point@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz" @@ -9529,6 +9787,13 @@ is-generator-fn@^2.0.0: resolved "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz" integrity sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ== +is-generator-function@^1.0.10: + version "1.0.10" + resolved "https://registry.yarnpkg.com/is-generator-function/-/is-generator-function-1.0.10.tgz#f1558baf1ac17e0deea7c0415c438351ff2b3c72" + integrity sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A== + dependencies: + has-tostringtag "^1.0.0" + is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: version "4.0.3" resolved "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz" @@ -9554,6 +9819,11 @@ is-lambda@^1.0.1: resolved "https://registry.npmjs.org/is-lambda/-/is-lambda-1.0.1.tgz" integrity sha1-PZh3iZ5qU+/AFgUEzeFfgubwYdU= +is-map@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.2.tgz#00922db8c9bf73e81b7a335827bc2a43f2b91127" + integrity sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg== + is-module@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz" @@ -9564,6 +9834,11 @@ is-negative-zero@^2.0.1: resolved "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz" integrity sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA== +is-negative-zero@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.3.tgz#ced903a027aca6381b777a5743069d7376a49747" + integrity sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw== + is-npm@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz" @@ -9656,11 +9931,23 @@ is-root@^2.1.0: resolved "https://registry.npmjs.org/is-root/-/is-root-2.1.0.tgz" integrity sha512-AGOriNp96vNBd3HtU+RzFEc75FfR5ymiYv8E553I71SCeXBiMsVDUtdio1OEFvrPyLIQ9tVR5RxXIFe5PUFjMg== +is-set@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/is-set/-/is-set-2.0.2.tgz#90755fa4c2562dc1c5d4024760d6119b94ca18ec" + integrity sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g== + is-shared-array-buffer@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz" integrity sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA== +is-shared-array-buffer@^1.0.2: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz#1237f1cba059cdb62431d378dcc37d9680181688" + integrity sha512-nA2hv5XIhLR3uVzDDfCIknerhx8XUKnstuOERPNNIinXG7v9u+ohXF67vxm4TPTEPU6lm61ZkwP3c9PCB97rhg== + dependencies: + call-bind "^1.0.7" + is-ssh@^1.3.0: version "1.4.0" resolved "https://registry.npmjs.org/is-ssh/-/is-ssh-1.4.0.tgz" @@ -9699,18 +9986,38 @@ is-text-path@^1.0.1: dependencies: text-extensions "^1.0.0" +is-typed-array@^1.1.13: + version "1.1.13" + resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.13.tgz#d6c5ca56df62334959322d7d7dd1cca50debe229" + integrity sha512-uZ25/bUAlUY5fR4OKT4rZQEBrzQWYV9ZJYGGsUmEJ6thodVJ1HX64ePQ6Z0qPWP+m+Uq6e9UugrE38jeYsDSMw== + dependencies: + which-typed-array "^1.1.14" + is-typedarray@^1.0.0, is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz" integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= -is-weakref@^1.0.1: +is-weakmap@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-weakmap/-/is-weakmap-2.0.1.tgz#5008b59bdc43b698201d18f62b37b2ca243e8cf2" + integrity sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA== + +is-weakref@^1.0.1, is-weakref@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz" integrity sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ== dependencies: call-bind "^1.0.2" +is-weakset@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/is-weakset/-/is-weakset-2.0.2.tgz#4569d67a747a1ce5a994dfd4ef6dcea76e7c0a1d" + integrity sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg== + dependencies: + call-bind "^1.0.2" + get-intrinsic "^1.1.1" + is-wsl@^2.2.0: version "2.2.0" resolved "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz" @@ -9723,6 +10030,11 @@ is-yarn-global@^0.3.0: resolved "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz" integrity sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw== +isarray@^2.0.5: + version "2.0.5" + resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" + integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== + isarray@~1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" @@ -9785,6 +10097,17 @@ istanbul-reports@^3.1.3: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" +iterator.prototype@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/iterator.prototype/-/iterator.prototype-1.1.2.tgz#5e29c8924f01916cb9335f1ff80619dcff22b0c0" + integrity sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w== + dependencies: + define-properties "^1.2.1" + get-intrinsic "^1.2.1" + has-symbols "^1.0.3" + reflect.getprototypeof "^1.0.4" + set-function-name "^2.0.1" + jake@^10.6.1: version "10.8.2" resolved "https://registry.npmjs.org/jake/-/jake-10.8.2.tgz" @@ -9875,16 +10198,6 @@ jest-config@^27.4.7: pretty-format "^27.4.6" slash "^3.0.0" -jest-diff@^26.0.0: - version "26.6.2" - resolved "https://registry.npmjs.org/jest-diff/-/jest-diff-26.6.2.tgz" - integrity sha512-6m+9Z3Gv9wN0WFVasqjCL/06+EFCMTqDEUl/b87HYK2rAPTyfz4ZIuSlPhY51PIQRWx5TaxeF1qmXKe9gfN3sA== - dependencies: - chalk "^4.0.0" - diff-sequences "^26.6.2" - jest-get-type "^26.3.0" - pretty-format "^26.6.2" - jest-diff@^27.0.0, jest-diff@^27.4.6: version "27.4.6" resolved "https://registry.npmjs.org/jest-diff/-/jest-diff-27.4.6.tgz" @@ -9938,11 +10251,6 @@ jest-environment-node@^27.4.6: jest-mock "^27.4.6" jest-util "^27.4.2" -jest-get-type@^26.3.0: - version "26.3.0" - resolved "https://registry.npmjs.org/jest-get-type/-/jest-get-type-26.3.0.tgz" - integrity sha512-TpfaviN1R2pQWkIihlfEanwOXK0zcxrKEE4MlU6Tn7keoXdN6/3gK/xl0yEh8DOunn5pOVGKf8hB4R9gVh04ig== - jest-get-type@^27.4.0: version "27.4.0" resolved "https://registry.npmjs.org/jest-get-type/-/jest-get-type-27.4.0.tgz" @@ -11107,12 +11415,12 @@ minimatch@3.0.4, minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimatch@9.0.3: - version "9.0.3" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825" - integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg== +minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== dependencies: - brace-expansion "^2.0.1" + brace-expansion "^1.1.7" minimatch@^5.0.1: version "5.1.0" @@ -11809,6 +12117,11 @@ object-inspect@^1.11.0: resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz" integrity sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g== +object-inspect@^1.13.1: + version "1.13.1" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.13.1.tgz#b96c6109324ccfef6b12216a956ca4dc2ff94bc2" + integrity sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ== + object-inspect@^1.9.0: version "1.12.2" resolved "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz" @@ -11837,6 +12150,16 @@ object.assign@^4.1.0, object.assign@^4.1.2: has-symbols "^1.0.1" object-keys "^1.1.1" +object.assign@^4.1.5: + version "4.1.5" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.5.tgz#3a833f9ab7fdb80fc9e8d2300c803d216d8fdbb0" + integrity sha512-byy+U7gp+FVwmyzKPYhW2h5l3crpmGsxl7X2s8y43IgxvG4g3QZ6CffDtsNQy1WsmZpQbO+ybo0AlW7TY6DcBQ== + dependencies: + call-bind "^1.0.5" + define-properties "^1.2.1" + has-symbols "^1.0.3" + object-keys "^1.1.1" + object.entries@^1.1.5: version "1.1.5" resolved "https://registry.npmjs.org/object.entries/-/object.entries-1.1.5.tgz" @@ -11846,6 +12169,15 @@ object.entries@^1.1.5: define-properties "^1.1.3" es-abstract "^1.19.1" +object.entries@^1.1.6: + version "1.1.7" + resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.7.tgz#2b47760e2a2e3a752f39dd874655c61a7f03c131" + integrity sha512-jCBs/0plmPsOnrKAfFQXRG2NFjlhZgjjcBLSmTnEhU8U6vVTsVe8ANeQJCHTl3gSsI4J+0emOoCgoKlmQPMgmA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + object.fromentries@^2.0.5: version "2.0.5" resolved "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.5.tgz" @@ -11855,6 +12187,15 @@ object.fromentries@^2.0.5: define-properties "^1.1.3" es-abstract "^1.19.1" +object.fromentries@^2.0.6: + version "2.0.7" + resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.7.tgz#71e95f441e9a0ea6baf682ecaaf37fa2a8d7e616" + integrity sha512-UPbPHML6sL8PI/mOqPwsH4G6iyXcCGzLin8KvEPenOZN5lpCNBZZQ+V62vdjB1mQHrmqGQt5/OJzemUA+KJmEA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + object.getownpropertydescriptors@^2.0.3, object.getownpropertydescriptors@^2.1.0: version "2.1.3" resolved "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.3.tgz" @@ -11872,6 +12213,14 @@ object.hasown@^1.1.0: define-properties "^1.1.3" es-abstract "^1.19.1" +object.hasown@^1.1.2: + version "1.1.3" + resolved "https://registry.yarnpkg.com/object.hasown/-/object.hasown-1.1.3.tgz#6a5f2897bb4d3668b8e79364f98ccf971bda55ae" + integrity sha512-fFI4VcYpRHvSLXxP7yiZOMAd331cPfd2p7PFDVbgUsYOfCT3tICVqXWngbjr4m49OvsBwUBQ6O2uQoJvy3RexA== + dependencies: + define-properties "^1.2.0" + es-abstract "^1.22.1" + object.values@^1.1.0, object.values@^1.1.5: version "1.1.5" resolved "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz" @@ -11881,6 +12230,15 @@ object.values@^1.1.0, object.values@^1.1.5: define-properties "^1.1.3" es-abstract "^1.19.1" +object.values@^1.1.6: + version "1.1.7" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.7.tgz#617ed13272e7e1071b43973aa1655d9291b8442a" + integrity sha512-aU6xnDFYT3x17e/f0IiiwlGPTy2jzMySGfUB4fq6z7CV8l85CWHDk5ErhyhpfDHhrOMwGFhSQkhMGHaIotA6Ng== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + objection@^3.0.0: version "3.0.1" resolved "https://registry.npmjs.org/objection/-/objection-3.0.1.tgz" @@ -12463,6 +12821,11 @@ portfinder@^1.0.28: debug "^3.1.1" mkdirp "^0.5.5" +possible-typed-array-names@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz#89bb63c6fada2c3e90adc4a647beeeb39cc7bf8f" + integrity sha512-d7Uw+eZoloe0EHDIYoe+bQ5WXnGMOpmiZFTuMWCwpjzzkL2nTjcKiAk4hh8TjnGye2TwWOk3UXucZ+3rbmBa8Q== + postcss-attribute-case-insensitive@^5.0.0: version "5.0.0" resolved "https://registry.npmjs.org/postcss-attribute-case-insensitive/-/postcss-attribute-case-insensitive-5.0.0.tgz" @@ -13062,6 +13425,11 @@ prettier@^2.5.1: resolved "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz" integrity sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg== +prettier@^3.2.5: + version "3.2.5" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.2.5.tgz#e52bc3090586e824964a8813b09aba6233b28368" + integrity sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A== + pretty-bytes@^5.3.0, pretty-bytes@^5.4.1: version "5.6.0" resolved "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-5.6.0.tgz" @@ -13075,7 +13443,7 @@ pretty-error@^4.0.0: lodash "^4.17.20" renderkid "^3.0.0" -pretty-format@^26.0.0, pretty-format@^26.6.2: +pretty-format@^26.6.2: version "26.6.2" resolved "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz" integrity sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg== @@ -13737,6 +14105,19 @@ redis-parser@^3.0.0: dependencies: redis-errors "^1.0.0" +reflect.getprototypeof@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/reflect.getprototypeof/-/reflect.getprototypeof-1.0.5.tgz#e0bd28b597518f16edaf9c0e292c631eb13e0674" + integrity sha512-62wgfC8dJWrmxv44CA36pLDnP6KKl3Vhxb7PL+8+qrrFMMoJij4vgiMP8zV4O8+CBMXY1mHxI5fITGHXFHVmQQ== + dependencies: + call-bind "^1.0.5" + define-properties "^1.2.1" + es-abstract "^1.22.3" + es-errors "^1.0.0" + get-intrinsic "^1.2.3" + globalthis "^1.0.3" + which-builtin-type "^1.1.3" + regenerate-unicode-properties@^9.0.0: version "9.0.0" resolved "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-9.0.0.tgz" @@ -13779,6 +14160,16 @@ regexp.prototype.flags@^1.2.0, regexp.prototype.flags@^1.3.1: call-bind "^1.0.2" define-properties "^1.1.3" +regexp.prototype.flags@^1.5.0, regexp.prototype.flags@^1.5.2: + version "1.5.2" + resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz#138f644a3350f981a858c44f6bb1a61ff59be334" + integrity sha512-NcDiDkTLuPR+++OCKB0nWafEmhg/Da8aUPLPMQbK+bxKKCm1/S5he+AqYa4PlMCVBalb4/yxIRub6qkEx5yJbw== + dependencies: + call-bind "^1.0.6" + define-properties "^1.2.1" + es-errors "^1.3.0" + set-function-name "^2.0.1" + regexpp@^3.2.0: version "3.2.0" resolved "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz" @@ -13957,6 +14348,15 @@ resolve@^2.0.0-next.3: is-core-module "^2.2.0" path-parse "^1.0.6" +resolve@^2.0.0-next.4: + version "2.0.0-next.5" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-2.0.0-next.5.tgz#6b0ec3107e671e52b68cd068ef327173b90dc03c" + integrity sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA== + dependencies: + is-core-module "^2.13.0" + path-parse "^1.0.7" + supports-preserve-symlinks-flag "^1.0.0" + responselike@^1.0.2: version "1.0.2" resolved "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz" @@ -14066,6 +14466,16 @@ rxjs@^6.6.0: dependencies: tslib "^1.9.0" +safe-array-concat@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/safe-array-concat/-/safe-array-concat-1.1.0.tgz#8d0cae9cb806d6d1c06e08ab13d847293ebe0692" + integrity sha512-ZdQ0Jeb9Ofti4hbt5lX3T2JcAamT9hfzYU1MNB+z/jaEbB6wfFfPIR/zEORmZqobkCCJhSjodobH6WHNmJ97dg== + dependencies: + call-bind "^1.0.5" + get-intrinsic "^1.2.2" + has-symbols "^1.0.3" + isarray "^2.0.5" + safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz" @@ -14076,6 +14486,15 @@ safe-buffer@5.2.1, safe-buffer@>=5.1.0, safe-buffer@^5.0.1, safe-buffer@^5.1.0, resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz" integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ== +safe-regex-test@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.3.tgz#a5b4c0f06e0ab50ea2c395c14d8371232924c377" + integrity sha512-CdASjNJPvRa7roO6Ra/gLYBTzYzzPyyBXxIMdGW3USQLyjWEls2RgW5UBTXaQVp+OrpeCK3bLem8smtmheoRuw== + dependencies: + call-bind "^1.0.6" + es-errors "^1.3.0" + is-regex "^1.1.4" + safe-stable-stringify@^1.1.0: version "1.1.1" resolved "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-1.1.1.tgz" @@ -14197,7 +14616,7 @@ semver@7.0.0: resolved "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz" integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== -semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: +semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0, semver@^6.3.1: version "6.3.1" resolved "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== @@ -14209,13 +14628,6 @@ semver@^7.1.1, semver@^7.1.3, semver@^7.3.2, semver@^7.3.4, semver@^7.3.5, semve dependencies: lru-cache "^6.0.0" -semver@^7.5.4: - version "7.6.0" - resolved "https://registry.yarnpkg.com/semver/-/semver-7.6.0.tgz#1a46a4db4bffcccd97b743b5005c8325f23d4e2d" - integrity sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg== - dependencies: - lru-cache "^6.0.0" - send@0.17.2: version "0.17.2" resolved "https://registry.npmjs.org/send/-/send-0.17.2.tgz" @@ -14306,6 +14718,28 @@ set-blocking@^2.0.0, set-blocking@~2.0.0: resolved "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz" integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= +set-function-length@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.1.tgz#47cc5945f2c771e2cf261c6737cf9684a2a5e425" + integrity sha512-j4t6ccc+VsKwYHso+kElc5neZpjtq9EnRICFZtWyBsLojhmeF/ZBd/elqm22WJh/BziDe/SBiOeAt0m2mfLD0g== + dependencies: + define-data-property "^1.1.2" + es-errors "^1.3.0" + function-bind "^1.1.2" + get-intrinsic "^1.2.3" + gopd "^1.0.1" + has-property-descriptors "^1.0.1" + +set-function-name@^2.0.0, set-function-name@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/set-function-name/-/set-function-name-2.0.2.tgz#16a705c5a0dc2f5e638ca96d8a8cd4e1c2b90985" + integrity sha512-7PGFlmtwsEADb0WYyvCMa1t+yke6daIG4Wirafur5kcf+MhUnPms1UeR0CKQdTZD81yESwMHbtn+TR+dMviakQ== + dependencies: + define-data-property "^1.1.4" + es-errors "^1.3.0" + functions-have-names "^1.2.3" + has-property-descriptors "^1.0.2" + setprototypeof@1.1.0: version "1.1.0" resolved "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.0.tgz" @@ -14784,6 +15218,30 @@ string.prototype.matchall@^4.0.6: regexp.prototype.flags "^1.3.1" side-channel "^1.0.4" +string.prototype.matchall@^4.0.8: + version "4.0.10" + resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.10.tgz#a1553eb532221d4180c51581d6072cd65d1ee100" + integrity sha512-rGXbGmOEosIQi6Qva94HUjgPs9vKW+dkG7Y8Q5O2OYkWL6wFaTRZO8zM4mhP94uX55wgyrXzfS2aGtGzUL7EJQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + get-intrinsic "^1.2.1" + has-symbols "^1.0.3" + internal-slot "^1.0.5" + regexp.prototype.flags "^1.5.0" + set-function-name "^2.0.0" + side-channel "^1.0.4" + +string.prototype.trim@^1.2.8: + version "1.2.8" + resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.8.tgz#f9ac6f8af4bd55ddfa8895e6aea92a96395393bd" + integrity sha512-lfjY4HcixfQXOfaqCvcBuOIapyaroTXhbkfJN3gcB1OtyupngWK4sEET9Knd0cXd28kTUqu/kHoV4HKSJdnjiQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + string.prototype.trimend@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz" @@ -14792,6 +15250,15 @@ string.prototype.trimend@^1.0.4: call-bind "^1.0.2" define-properties "^1.1.3" +string.prototype.trimend@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.7.tgz#1bb3afc5008661d73e2dc015cd4853732d6c471e" + integrity sha512-Ni79DqeB72ZFq1uH/L6zJ+DKZTkOtPIHovb3YZHQViE+HDouuU4mBrLOLDn5Dde3RF8qw5qVETEjhu9locMLvA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + string.prototype.trimstart@^1.0.4: version "1.0.4" resolved "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz" @@ -14800,6 +15267,15 @@ string.prototype.trimstart@^1.0.4: call-bind "^1.0.2" define-properties "^1.1.3" +string.prototype.trimstart@^1.0.7: + version "1.0.7" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.7.tgz#d4cdb44b83a4737ffbac2d406e405d43d0184298" + integrity sha512-NGhtDFu3jCEm7B4Fy0DpLewdJQOZcQ0rGbwQ/+stjnrp2i+rlKeCvos9hOIeCmqwratM47OBxY7uFZzjxHXmrg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.2.0" + es-abstract "^1.22.1" + string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" @@ -15352,11 +15828,6 @@ tryer@^1.0.1: resolved "https://registry.npmjs.org/tryer/-/tryer-1.0.1.tgz" integrity sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA== -ts-api-utils@^1.0.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.2.1.tgz#f716c7e027494629485b21c0df6180f4d08f5e8b" - integrity sha512-RIYA36cJn2WiH9Hy77hdF9r7oEwxAtB/TS9/S4Qd90Ap4z5FSiin5zEiTL44OII1Y3IIlEvxwxFUVgrHSZ/UpA== - ts-invariant@^0.10.3: version "0.10.3" resolved "https://registry.npmjs.org/ts-invariant/-/ts-invariant-0.10.3.tgz" @@ -15472,6 +15943,50 @@ type-is@^1.6.4, type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" +typed-array-buffer@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.2.tgz#1867c5d83b20fcb5ccf32649e5e2fc7424474ff3" + integrity sha512-gEymJYKZtKXzzBzM4jqa9w6Q1Jjm7x2d+sh19AdsD4wqnMPDYyvwpsIc2Q/835kHuo3BEQ7CjelGhfTsoBb2MQ== + dependencies: + call-bind "^1.0.7" + es-errors "^1.3.0" + is-typed-array "^1.1.13" + +typed-array-byte-length@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/typed-array-byte-length/-/typed-array-byte-length-1.0.1.tgz#d92972d3cff99a3fa2e765a28fcdc0f1d89dec67" + integrity sha512-3iMJ9q0ao7WE9tWcaYKIptkNBuOIcZCCT0d4MRvuuH88fEoEH62IuQe0OtraD3ebQEoTRk8XCBoknUNc1Y67pw== + dependencies: + call-bind "^1.0.7" + for-each "^0.3.3" + gopd "^1.0.1" + has-proto "^1.0.3" + is-typed-array "^1.1.13" + +typed-array-byte-offset@^1.0.0: + version "1.0.2" + resolved "https://registry.yarnpkg.com/typed-array-byte-offset/-/typed-array-byte-offset-1.0.2.tgz#f9ec1acb9259f395093e4567eb3c28a580d02063" + integrity sha512-Ous0vodHa56FviZucS2E63zkgtgrACj7omjwd/8lTEMEPFFyjfixMZ1ZXenpgCFBBt4EC1J2XsyVS2gkG0eTFA== + dependencies: + available-typed-arrays "^1.0.7" + call-bind "^1.0.7" + for-each "^0.3.3" + gopd "^1.0.1" + has-proto "^1.0.3" + is-typed-array "^1.1.13" + +typed-array-length@^1.0.4: + version "1.0.5" + resolved "https://registry.yarnpkg.com/typed-array-length/-/typed-array-length-1.0.5.tgz#57d44da160296d8663fd63180a1802ebf25905d5" + integrity sha512-yMi0PlwuznKHxKmcpoOdeLwxBoVPkqZxd7q2FgMkmD3bNwvF5VW0+UlUQ1k1vmktTu4Yu13Q0RIxEP8+B+wloA== + dependencies: + call-bind "^1.0.7" + for-each "^0.3.3" + gopd "^1.0.1" + has-proto "^1.0.3" + is-typed-array "^1.1.13" + possible-typed-array-names "^1.0.0" + typedarray-to-buffer@^3.1.5: version "3.1.5" resolved "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz" @@ -15484,11 +15999,6 @@ typedarray@^0.0.6: resolved "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typescript@^4.6.3: - version "4.6.3" - resolved "https://registry.npmjs.org/typescript/-/typescript-4.6.3.tgz" - integrity sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw== - ufo@^1.3.0: version "1.3.2" resolved "https://registry.yarnpkg.com/ufo/-/ufo-1.3.2.tgz#c7d719d0628a1c80c006d2240e0d169f6e3c0496" @@ -15519,6 +16029,16 @@ unbox-primitive@^1.0.1: has-symbols "^1.0.2" which-boxed-primitive "^1.0.2" +unbox-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" + integrity sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw== + dependencies: + call-bind "^1.0.2" + has-bigints "^1.0.2" + has-symbols "^1.0.3" + which-boxed-primitive "^1.0.2" + undefsafe@^2.0.5: version "2.0.5" resolved "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz" @@ -16093,6 +16613,45 @@ which-boxed-primitive@^1.0.2: is-string "^1.0.5" is-symbol "^1.0.3" +which-builtin-type@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/which-builtin-type/-/which-builtin-type-1.1.3.tgz#b1b8443707cc58b6e9bf98d32110ff0c2cbd029b" + integrity sha512-YmjsSMDBYsM1CaFiayOVT06+KJeXf0o5M/CAd4o1lTadFAtacTUM49zoYxr/oroopFDfhvN6iEcBxUyc3gvKmw== + dependencies: + function.prototype.name "^1.1.5" + has-tostringtag "^1.0.0" + is-async-function "^2.0.0" + is-date-object "^1.0.5" + is-finalizationregistry "^1.0.2" + is-generator-function "^1.0.10" + is-regex "^1.1.4" + is-weakref "^1.0.2" + isarray "^2.0.5" + which-boxed-primitive "^1.0.2" + which-collection "^1.0.1" + which-typed-array "^1.1.9" + +which-collection@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/which-collection/-/which-collection-1.0.1.tgz#70eab71ebbbd2aefaf32f917082fc62cdcb70906" + integrity sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A== + dependencies: + is-map "^2.0.1" + is-set "^2.0.1" + is-weakmap "^2.0.1" + is-weakset "^2.0.1" + +which-typed-array@^1.1.14, which-typed-array@^1.1.9: + version "1.1.14" + resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.14.tgz#1f78a111aee1e131ca66164d8bdc3ab062c95a06" + integrity sha512-VnXFiIW8yNn9kIHN88xvZ4yOWchftKDsRJ8fEPacX/wl1lOvBrhsJ/OeJCXq7B0AaijRuqgzSKalJoPk+D8MPg== + dependencies: + available-typed-arrays "^1.0.6" + call-bind "^1.0.5" + for-each "^0.3.3" + gopd "^1.0.1" + has-tostringtag "^1.0.1" + which@^1.3.1: version "1.3.1" resolved "https://registry.npmjs.org/which/-/which-1.3.1.tgz"