From 2a6210f9eba5f5a26c81be0285b6ff14815c64b1 Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Wed, 19 Jun 2024 19:59:24 +0300 Subject: [PATCH 01/13] Up version react-router and react-router-dom to 6.23.1 --- packages/shared/package.json | 4 ++-- yarn.lock | 34 +++++++++++++++++----------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/shared/package.json b/packages/shared/package.json index bee05fb2e6..061cda5660 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -57,8 +57,8 @@ "react-lifecycles-compat": "^3.0.4", "react-onclickoutside": "^6.13.0", "react-player": "^1.15.3", - "react-router": "^6.10.0", - "react-router-dom": "^6.10.0", + "react-router": "^6.23.1", + "react-router-dom": "^6.23.1", "react-scrollbars-custom": "^4.1.1", "react-svg": "^16.1.33", "react-text-mask": "^5.5.0", diff --git a/yarn.lock b/yarn.lock index d9004237a9..407f0d3c9e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2866,8 +2866,8 @@ __metadata: react-lifecycles-compat: "npm:^3.0.4" react-onclickoutside: "npm:^6.13.0" react-player: "npm:^1.15.3" - react-router: "npm:^6.10.0" - react-router-dom: "npm:^6.10.0" + react-router: "npm:^6.23.1" + react-router-dom: "npm:^6.23.1" react-scrollbars-custom: "npm:^4.1.1" react-svg: "npm:^16.1.33" react-text-mask: "npm:^5.5.0" @@ -5535,10 +5535,10 @@ __metadata: languageName: node linkType: hard -"@remix-run/router@npm:1.15.3": - version: 1.15.3 - resolution: "@remix-run/router@npm:1.15.3" - checksum: 10/43d402b4ad3dff6dee5c1bc0822aeeb4d885d11c74c45fca7f2f4d7e57853fddbbb813c372919bb3fcc63f95fbcffdd1d4ac1c406857ea07b9d09a09d0562c8e +"@remix-run/router@npm:1.16.1": + version: 1.16.1 + resolution: "@remix-run/router@npm:1.16.1" + checksum: 10/0bfbf2a04707e7f7fde5c76614e7990945a6d854d50c1f9f63cea50208ff864a8920420534ff7ddff6a0bcb584c84456d2f7613d6d6e896db46cafcc70d8fb65 languageName: node linkType: hard @@ -23590,27 +23590,27 @@ __metadata: languageName: node linkType: hard -"react-router-dom@npm:^6.10.0": - version: 6.22.3 - resolution: "react-router-dom@npm:6.22.3" +"react-router-dom@npm:^6.23.1": + version: 6.23.1 + resolution: "react-router-dom@npm:6.23.1" dependencies: - "@remix-run/router": "npm:1.15.3" - react-router: "npm:6.22.3" + "@remix-run/router": "npm:1.16.1" + react-router: "npm:6.23.1" peerDependencies: react: ">=16.8" react-dom: ">=16.8" - checksum: 10/868a530c3167e1903f170818c0162760b8fbe9b10a7a7a79e5998990df341cd7127ba7819af4a9105af72c13453c7c4d76b2b07a70b56fff012fa0508b51940e + checksum: 10/29004176608e879c57830ed02ecd70bf2b54c07acfb050fbbd61c7d28a0c2c8abf1287c2c69222c588afd028763ffe2c61015f03a3360359b250cc019234d76b languageName: node linkType: hard -"react-router@npm:6.22.3, react-router@npm:^6.10.0": - version: 6.22.3 - resolution: "react-router@npm:6.22.3" +"react-router@npm:6.23.1, react-router@npm:^6.23.1": + version: 6.23.1 + resolution: "react-router@npm:6.23.1" dependencies: - "@remix-run/router": "npm:1.15.3" + "@remix-run/router": "npm:1.16.1" peerDependencies: react: ">=16.8" - checksum: 10/df3948afd6500faf4b82a72375b9177536d878d54cad18e20a175efcbfdd0d94852aac59660d786946636ed325284d94a8f46652d898df304d6a29c9a3932afd + checksum: 10/72747878fd851b8fc9a6c2f1ee7a3f3a69f18df0c45d7857851b57930d4f55686190f5df0b8d9064ce9e8594bd9ac6a6f479bd8c91552f0b825beb012fa5a770 languageName: node linkType: hard From b7050a86e2db7fc58dc144e1a314c305be518d76 Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Wed, 19 Jun 2024 19:59:52 +0300 Subject: [PATCH 02/13] Client: move general pages to lazy loading from react-router-dom --- packages/client/src/pages/Profile/index.js | 33 +++++++++++++++----- packages/client/src/routes/general.js | 33 +++----------------- packages/client/src/routes/index.js | 8 ++++- packages/client/src/routes/portalSettings.js | 1 - 4 files changed, 36 insertions(+), 39 deletions(-) diff --git a/packages/client/src/pages/Profile/index.js b/packages/client/src/pages/Profile/index.js index 49c8015fba..a5c9d69d52 100644 --- a/packages/client/src/pages/Profile/index.js +++ b/packages/client/src/pages/Profile/index.js @@ -25,17 +25,20 @@ // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode import React from "react"; +import { useLocation } from "react-router-dom"; import PropTypes from "prop-types"; -import Section from "@docspace/shared/components/section"; -import SectionWrapper from "SRC_DIR/components/Section"; -import { SectionHeaderContent, SectionBodyContent } from "./Section"; - -import Dialogs from "../Home/Section/AccountsBody/Dialogs"; - -import withCultureNames from "SRC_DIR/HOCs/withCultureNames"; import { inject, observer } from "mobx-react"; import { withTranslation } from "react-i18next"; +import Section from "@docspace/shared/components/section"; + +import SectionWrapper from "SRC_DIR/components/Section"; +import PrivateRoute from "SRC_DIR/components/PrivateRouteWrapper"; +import Dialogs from "SRC_DIR/pages/Home/Section/AccountsBody/Dialogs"; +import withCultureNames from "SRC_DIR/HOCs/withCultureNames"; + +import { SectionHeaderContent, SectionBodyContent } from "./Section"; + class Profile extends React.Component { componentDidMount() { const { @@ -137,7 +140,7 @@ Profile.propTypes = { language: PropTypes.string, }; -export default inject( +const ComponentPure = inject( ({ authStore, settingsStore, @@ -194,3 +197,17 @@ export default inject( }; }, )(observer(withTranslation(["Profile", "Common"])(withCultureNames(Profile)))); + +export const Component = () => { + const location = useLocation(); + + const fileManagement = location.pathname.includes("file-management"); + + return ( + + + + ); +}; + +Component.displayName = "Profile"; diff --git a/packages/client/src/routes/general.js b/packages/client/src/routes/general.js index 946291ab4c..d35a8f711d 100644 --- a/packages/client/src/routes/general.js +++ b/packages/client/src/routes/general.js @@ -24,16 +24,7 @@ // content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode -import React from "react"; import { Navigate } from "react-router-dom"; -import loadable from "@loadable/component"; - -import PrivateRoute from "../components/PrivateRouteWrapper"; -import componentLoader from "@docspace/shared/utils/component-loader"; - -const Profile = loadable(() => - componentLoader(() => import("../pages/Profile")), -); const generalRoutes = [ { @@ -51,35 +42,19 @@ const generalRoutes = [ }, { path: "login", - element: ( - - - - ), + lazy: () => import("../pages/Profile"), }, { path: "notifications", - element: ( - - - - ), + lazy: () => import("../pages/Profile"), }, { path: "file-management", - element: ( - - - - ), + lazy: () => import("../pages/Profile"), }, { path: "interface-theme", - element: ( - - - - ), + lazy: () => import("../pages/Profile"), }, ], }, diff --git a/packages/client/src/routes/index.js b/packages/client/src/routes/index.js index 3a1f402997..4aabc7b2af 100644 --- a/packages/client/src/routes/index.js +++ b/packages/client/src/routes/index.js @@ -27,7 +27,13 @@ import PortalSettingsRoutes from "./portalSettings"; import ClientRoutes from "./client"; import ConfirmRoutes from "./confirm"; +import { generalRoutes } from "./general"; -const routes = [...ClientRoutes, PortalSettingsRoutes, ...ConfirmRoutes]; +const routes = [ + ...ClientRoutes, + PortalSettingsRoutes, + ...ConfirmRoutes, + // ...generalRoutes, +]; export default routes; diff --git a/packages/client/src/routes/portalSettings.js b/packages/client/src/routes/portalSettings.js index 6ec84d734d..4ca9b602fb 100644 --- a/packages/client/src/routes/portalSettings.js +++ b/packages/client/src/routes/portalSettings.js @@ -37,7 +37,6 @@ import ErrorBoundary from "../components/ErrorBoundaryWrapper"; import { generalRoutes } from "./general"; import SettingsContainer from "../pages/PortalSettings/categories/integration/LDAP/sub-components/SettingsContainer"; import SyncContainer from "../pages/PortalSettings/categories/integration/LDAP/sub-components/SyncContainer"; -import StyledLdapPage from "../pages/PortalSettings/categories/integration/LDAP/styled-components/StyledLdapPage"; const PortalSettings = loadable(() => componentLoader(() => import("../pages/PortalSettings")), From 5135fd31a3d7dcd2a220d087181906b39d608192 Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Thu, 20 Jun 2024 10:17:09 +0300 Subject: [PATCH 03/13] Client: move portal settings roout layoyt to lazy loading from react-router-dom --- .../client/src/pages/PortalSettings/index.js | 16 +++++++++++++--- packages/client/src/routes/index.js | 8 +------- packages/client/src/routes/portalSettings.js | 16 +--------------- 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/packages/client/src/pages/PortalSettings/index.js b/packages/client/src/pages/PortalSettings/index.js index 7e634e3022..3797889659 100644 --- a/packages/client/src/pages/PortalSettings/index.js +++ b/packages/client/src/pages/PortalSettings/index.js @@ -27,11 +27,13 @@ import React from "react"; import { Outlet, useLocation } from "react-router-dom"; -import Layout from "./Layout"; - import Panels from "SRC_DIR/components/FilesPanels"; +import PrivateRoute from "SRC_DIR/components/PrivateRouteWrapper"; +import ErrorBoundary from "SRC_DIR/components/ErrorBoundaryWrapper"; import { generalRoutes } from "SRC_DIR/routes/general"; +import Layout from "./Layout"; + const Settings = () => { const location = useLocation(); @@ -58,4 +60,12 @@ const Settings = () => { ); }; -export default Settings; +export const Component = () => { + return ( + + + + + + ); +}; diff --git a/packages/client/src/routes/index.js b/packages/client/src/routes/index.js index 4aabc7b2af..3a1f402997 100644 --- a/packages/client/src/routes/index.js +++ b/packages/client/src/routes/index.js @@ -27,13 +27,7 @@ import PortalSettingsRoutes from "./portalSettings"; import ClientRoutes from "./client"; import ConfirmRoutes from "./confirm"; -import { generalRoutes } from "./general"; -const routes = [ - ...ClientRoutes, - PortalSettingsRoutes, - ...ConfirmRoutes, - // ...generalRoutes, -]; +const routes = [...ClientRoutes, PortalSettingsRoutes, ...ConfirmRoutes]; export default routes; diff --git a/packages/client/src/routes/portalSettings.js b/packages/client/src/routes/portalSettings.js index 4ca9b602fb..241f4a7319 100644 --- a/packages/client/src/routes/portalSettings.js +++ b/packages/client/src/routes/portalSettings.js @@ -24,24 +24,16 @@ // content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode -import React from "react"; import { Navigate } from "react-router-dom"; import loadable from "@loadable/component"; import Error404 from "@docspace/shared/components/errors/Error404"; import componentLoader from "@docspace/shared/utils/component-loader"; -import PrivateRoute from "../components/PrivateRouteWrapper"; -import ErrorBoundary from "../components/ErrorBoundaryWrapper"; - import { generalRoutes } from "./general"; import SettingsContainer from "../pages/PortalSettings/categories/integration/LDAP/sub-components/SettingsContainer"; import SyncContainer from "../pages/PortalSettings/categories/integration/LDAP/sub-components/SyncContainer"; -const PortalSettings = loadable(() => - componentLoader(() => import("../pages/PortalSettings")), -); - const CustomizationSettings = loadable(() => componentLoader( () => import("../pages/PortalSettings/categories/common/index.js"), @@ -358,13 +350,7 @@ const Viewer = loadable(() => const PortalSettingsRoutes = { path: "portal-settings/", - element: ( - - - - - - ), + lazy: () => import("../pages/PortalSettings"), errorElement: , children: [ { From efc555652567cb9052c0ee5c83f83f66daa9d8e1 Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Thu, 20 Jun 2024 13:07:03 +0300 Subject: [PATCH 04/13] Remove react-router --- packages/client/src/pages/Home/Hooks/useInsideGroup.js | 2 +- packages/shared/constants/sharedDependencies.js | 5 +---- packages/shared/package.json | 1 - yarn.lock | 3 +-- 4 files changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/client/src/pages/Home/Hooks/useInsideGroup.js b/packages/client/src/pages/Home/Hooks/useInsideGroup.js index 392103cbde..8df2091975 100644 --- a/packages/client/src/pages/Home/Hooks/useInsideGroup.js +++ b/packages/client/src/pages/Home/Hooks/useInsideGroup.js @@ -25,7 +25,7 @@ // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode import React from "react"; -import { matchPath } from "react-router"; +import { matchPath } from "react-router-dom"; import AccountsFilter from "@docspace/shared/api/people/filter"; diff --git a/packages/shared/constants/sharedDependencies.js b/packages/shared/constants/sharedDependencies.js index 10eb101ef2..78c0fe5c00 100644 --- a/packages/shared/constants/sharedDependencies.js +++ b/packages/shared/constants/sharedDependencies.js @@ -42,10 +42,7 @@ module.exports = { singleton: true, requiredVersion: deps["react-dom"], }, - "react-router": { - singleton: true, - requiredVersion: deps["react-router"], - }, + "react-router-dom": { singleton: true, requiredVersion: deps["react-router-dom"], diff --git a/packages/shared/package.json b/packages/shared/package.json index 061cda5660..1075445397 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -57,7 +57,6 @@ "react-lifecycles-compat": "^3.0.4", "react-onclickoutside": "^6.13.0", "react-player": "^1.15.3", - "react-router": "^6.23.1", "react-router-dom": "^6.23.1", "react-scrollbars-custom": "^4.1.1", "react-svg": "^16.1.33", diff --git a/yarn.lock b/yarn.lock index 407f0d3c9e..33a7b30f6e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2866,7 +2866,6 @@ __metadata: react-lifecycles-compat: "npm:^3.0.4" react-onclickoutside: "npm:^6.13.0" react-player: "npm:^1.15.3" - react-router: "npm:^6.23.1" react-router-dom: "npm:^6.23.1" react-scrollbars-custom: "npm:^4.1.1" react-svg: "npm:^16.1.33" @@ -23603,7 +23602,7 @@ __metadata: languageName: node linkType: hard -"react-router@npm:6.23.1, react-router@npm:^6.23.1": +"react-router@npm:6.23.1": version: 6.23.1 resolution: "react-router@npm:6.23.1" dependencies: From 43a8be8bc38bf9e05ea9462a9c29bfcffe30e591 Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Thu, 20 Jun 2024 17:45:57 +0300 Subject: [PATCH 05/13] Client: fix portal settings routes --- packages/client/src/routes/portalSettings.js | 373 +++---------------- 1 file changed, 54 insertions(+), 319 deletions(-) diff --git a/packages/client/src/routes/portalSettings.js b/packages/client/src/routes/portalSettings.js index 241f4a7319..3a916e619c 100644 --- a/packages/client/src/routes/portalSettings.js +++ b/packages/client/src/routes/portalSettings.js @@ -25,332 +25,67 @@ // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode import { Navigate } from "react-router-dom"; -import loadable from "@loadable/component"; import Error404 from "@docspace/shared/components/errors/Error404"; -import componentLoader from "@docspace/shared/utils/component-loader"; + +import CustomizationSettings from "SRC_DIR/pages/PortalSettings/categories/common"; +import LanguageAndTimeZoneSettings from "SRC_DIR/pages/PortalSettings/categories/common/Customization/language-and-time-zone"; +import WelcomePageSettings from "SRC_DIR/pages/PortalSettings/categories/common/Customization/welcome-page-settings"; +import DNSSettings from "SRC_DIR/pages/PortalSettings/categories/common/Customization/dns-settings"; +import PortalRenaming from "SRC_DIR/pages/PortalSettings/categories/common/Customization/portal-renaming"; +import WhiteLabel from "SRC_DIR/pages/PortalSettings/categories/common/Branding/whitelabel"; +import CompanyInfoSettings from "SRC_DIR/pages/PortalSettings/categories/common/Branding/companyInfoSettings"; +import AdditionalResources from "SRC_DIR/pages/PortalSettings/categories/common/Branding/additionalResources"; + +import SecuritySettings from "SRC_DIR/pages/PortalSettings/categories/security"; +import TfaPage from "SRC_DIR/pages/PortalSettings/categories/security/access-portal/tfa"; +import PasswordStrengthPage from "SRC_DIR/pages/PortalSettings/categories/security/access-portal/passwordStrength"; +import TrustedMailPage from "SRC_DIR/pages/PortalSettings/categories/security/access-portal/trustedMail"; +import IpSecurityPage from "SRC_DIR/pages/PortalSettings/categories/security/access-portal/ipSecurity"; +import BruteForceProtectionPage from "SRC_DIR/pages/PortalSettings/categories/security/access-portal/bruteForceProtection"; +import AdminMessagePage from "SRC_DIR/pages/PortalSettings/categories/security/access-portal/adminMessage"; +import SessionLifetimePage from "SRC_DIR/pages/PortalSettings/categories/security/access-portal/sessionLifetime"; + +import Integration from "SRC_DIR/pages/PortalSettings/categories/integration"; +import SPSettings from "SRC_DIR/pages/PortalSettings/categories/integration/SingleSignOn/SPSettings"; +import SPMetadata from "SRC_DIR/pages/PortalSettings/categories/integration/SingleSignOn/ProviderMetadata"; +import SettingsContainer from "SRC_DIR/pages/PortalSettings/categories/integration/LDAP/sub-components/SettingsContainer"; +import SyncContainer from "SRC_DIR/pages/PortalSettings/categories/integration/LDAP/sub-components/SyncContainer"; + +import Statistics from "SRC_DIR/pages/PortalSettings/categories/storage-management"; +import QuotaPerRoom from "SRC_DIR/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerRoom"; +import QuotaPerUser from "SRC_DIR/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerUser"; + +import Payments from "SRC_DIR/pages/PortalSettings/categories/payments"; + +import DeveloperTools from "SRC_DIR/pages/PortalSettings/categories/developer-tools"; +import WebhookHistory from "SRC_DIR/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookHistory"; +import WebhookDetails from "SRC_DIR/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookEventDetails"; +import DocSpace from "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/DocSpace"; +import SimpleRoom from "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/SimpleRoom"; +import Manager from "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Manager"; +import RoomSelector from "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/RoomSelector"; +import FileSelector from "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/FileSelector"; +import Editor from "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Editor"; +import Viewer from "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Viewer"; + +import Backup from "SRC_DIR/pages/PortalSettings/categories/data-management"; +import RestoreBackup from "SRC_DIR/pages/PortalSettings/categories/data-management/backup/restore-backup"; + +import DeleteDataPage from "SRC_DIR/pages/PortalSettings/categories/delete-data"; + +import Bonus from "SRC_DIR/pages/Bonus"; + +import DataImport from "SRC_DIR/pages/PortalSettings/categories/data-import"; +import GoogleDataImport from "SRC_DIR/pages/PortalSettings/categories/data-import/GoogleWorkspace"; +import NextcloudDataImport from "SRC_DIR/pages/PortalSettings/categories/data-import/NextCloudWorkspace"; +import OnlyofficeDataImport from "SRC_DIR/pages/PortalSettings/categories/data-import/OnlyofficeWorkspace"; import { generalRoutes } from "./general"; -import SettingsContainer from "../pages/PortalSettings/categories/integration/LDAP/sub-components/SettingsContainer"; -import SyncContainer from "../pages/PortalSettings/categories/integration/LDAP/sub-components/SyncContainer"; - -const CustomizationSettings = loadable(() => - componentLoader( - () => import("../pages/PortalSettings/categories/common/index.js"), - ), -); -const LanguageAndTimeZoneSettings = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/common/Customization/language-and-time-zone" - ), - ), -); -const WelcomePageSettings = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/common/Customization/welcome-page-settings" - ), - ), -); -const DNSSettings = loadable(() => - componentLoader( - () => () => - import( - "../pages/PortalSettings/categories/common/Customization/dns-settings" - ), - ), -); -const PortalRenaming = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/common/Customization/portal-renaming" - ), - ), -); -const WhiteLabel = loadable(() => - componentLoader( - () => - import("../pages/PortalSettings/categories/common/Branding/whitelabel"), - ), -); -const CompanyInfoSettings = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/common/Branding/companyInfoSettings" - ), - ), -); -const AdditionalResources = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/common/Branding/additionalResources" - ), - ), -); -const SecuritySettings = loadable(() => - componentLoader( - () => import("../pages/PortalSettings/categories/security/index.js"), - ), -); -const TfaPage = loadable(() => - componentLoader( - () => - import("../pages/PortalSettings/categories/security/access-portal/tfa"), - ), -); -const PasswordStrengthPage = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/security/access-portal/passwordStrength" - ), - ), -); -const TrustedMailPage = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/security/access-portal/trustedMail" - ), - ), -); -const IpSecurityPage = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/security/access-portal/ipSecurity" - ), - ), -); -const BruteForceProtectionPage = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/security/access-portal/bruteForceProtection" - ), - ), -); -const AdminMessagePage = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/security/access-portal/adminMessage" - ), - ), -); -const SessionLifetimePage = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/security/access-portal/sessionLifetime" - ), - ), -); -const Integration = loadable(() => - componentLoader( - () => import("../pages/PortalSettings/categories/integration"), - ), -); -const Payments = loadable(() => - componentLoader(() => import("../pages/PortalSettings/categories/payments")), -); -const Statistics = loadable(() => - componentLoader( - () => import("../pages/PortalSettings/categories/storage-management"), - ), -); -const QuotaPerRoom = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/storage-management/sub-components/QuotaPerRoom.js" - ), - ), -); -const QuotaPerUser = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/storage-management/sub-components/QuotaPerUser.js" - ), - ), -); -const ThirdParty = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/integration/ThirdPartyServicesSettings" - ), - ), -); - -const DocumentService = loadable(() => - componentLoader( - () => - import("../pages/PortalSettings/categories/integration/DocumentService"), - ), -); - -const SingleSignOn = loadable(() => - componentLoader( - () => import("../pages/PortalSettings/categories/integration/SingleSignOn"), - ), -); -const SPSettings = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/integration/SingleSignOn/SPSettings" - ), - ), -); -const SPMetadata = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/integration/SingleSignOn/ProviderMetadata" - ), - ), -); - -const DeveloperTools = loadable(() => - componentLoader( - () => import("../pages/PortalSettings/categories/developer-tools/index.js"), - ), -); - -const DataImport = loadable(() => - componentLoader( - () => import("../pages/PortalSettings/categories/data-import/index.js"), - ), -); -const GoogleDataImport = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/data-import/GoogleWorkspace/index.js" - ), - ), -); -const NextcloudDataImport = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/data-import/NextCloudWorkspace/index.js" - ), - ), -); -const OnlyofficeDataImport = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/data-import/OnlyofficeWorkspace/index.js" - ), - ), -); - -const WebhookHistory = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/developer-tools/Webhooks/WebhookHistory" - ), - ), -); -const WebhookDetails = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/developer-tools/Webhooks/WebhookEventDetails" - ), - ), -); -const Backup = loadable(() => - componentLoader( - () => import("../pages/PortalSettings/categories/data-management/index"), - ), -); -const DeleteDataPage = loadable(() => - componentLoader( - () => import("../pages/PortalSettings/categories/delete-data"), - ), -); -const RestoreBackup = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/data-management/backup/restore-backup/index" - ), - ), -); -const Bonus = loadable(() => componentLoader(() => import("../pages/Bonus"))); - -const DocSpace = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/DocSpace" - ), - ), -); -const SimpleRoom = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/SimpleRoom" - ), - ), -); -const Manager = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Manager" - ), - ), -); -const RoomSelector = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/RoomSelector" - ), - ), -); -const FileSelector = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/FileSelector" - ), - ), -); -const Editor = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Editor" - ), - ), -); -const Viewer = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Viewer" - ), - ), -); const PortalSettingsRoutes = { path: "portal-settings/", - lazy: () => import("../pages/PortalSettings"), + lazy: () => import("SRC_DIR/pages/PortalSettings"), errorElement: , children: [ { From 01185d8807ccf2d185c9065ca3c50d44f04dc6f2 Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Fri, 21 Jun 2024 13:10:45 +0300 Subject: [PATCH 06/13] Client: add lazy loading for all confirm pages --- packages/client/src/pages/Confirm/index.js | 13 +- .../Confirm/sub-components/activateEmail.js | 14 +- .../Confirm/sub-components/activateUser.js | 12 +- .../src/pages/Confirm/sub-components/auth.js | 10 +- .../Confirm/sub-components/changeEmail.js | 11 +- .../Confirm/sub-components/changeOwner.js | 11 +- .../Confirm/sub-components/changePassword.js | 11 +- .../Confirm/sub-components/changePhone.js | 11 +- .../Confirm/sub-components/continuePortal.js | 11 +- .../Confirm/sub-components/createUser.js | 12 +- .../sub-components/deactivatePortal.js | 11 +- .../Confirm/sub-components/profileRemove.js | 11 +- .../Confirm/sub-components/removePortal.js | 11 +- .../Confirm/sub-components/tfaActivation.js | 11 +- .../pages/Confirm/sub-components/tfaAuth.js | 11 +- packages/client/src/routes/confirm.js | 257 ++++++++---------- packages/client/src/routes/general.js | 8 +- 17 files changed, 262 insertions(+), 174 deletions(-) diff --git a/packages/client/src/pages/Confirm/index.js b/packages/client/src/pages/Confirm/index.js index 15769ee066..b4e4eb6c84 100644 --- a/packages/client/src/pages/Confirm/index.js +++ b/packages/client/src/pages/Confirm/index.js @@ -24,13 +24,16 @@ // content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode -import React from "react"; import { Outlet } from "react-router-dom"; -const Confirm = () => { +import ErrorBoundaryWrapper from "SRC_DIR/components/ErrorBoundaryWrapper"; + +export const Component = () => { //console.log("Confirm render"); - return ; + return ( + + + + ); }; - -export default Confirm; diff --git a/packages/client/src/pages/Confirm/sub-components/activateEmail.js b/packages/client/src/pages/Confirm/sub-components/activateEmail.js index 3cfde83def..3d37ba3a42 100644 --- a/packages/client/src/pages/Confirm/sub-components/activateEmail.js +++ b/packages/client/src/pages/Confirm/sub-components/activateEmail.js @@ -26,12 +26,14 @@ import React, { useEffect } from "react"; import PropTypes from "prop-types"; +import { inject, observer } from "mobx-react"; + import { Loader } from "@docspace/shared/components/loader"; import Section from "@docspace/shared/components/section"; import { combineUrl } from "@docspace/shared/utils/combineUrl"; import tryRedirectTo from "@docspace/shared/utils/tryRedirectTo"; -import { inject, observer } from "mobx-react"; import { EmployeeActivationStatus } from "@docspace/shared/enums"; +import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; import SectionWrapper from "SRC_DIR/components/Section"; const ActivateEmail = ({ updateEmailActivationStatus, linkData }) => { @@ -89,9 +91,17 @@ const ActivateEmailForm = (props) => ( ); -export default inject(({ userStore }) => { +const ComponentWrapper = inject(({ userStore }) => { const { updateEmailActivationStatus } = userStore; return { updateEmailActivationStatus, }; })(observer(ActivateEmailForm)); + +export const Component = () => { + return ( + + + + ); +}; diff --git a/packages/client/src/pages/Confirm/sub-components/activateUser.js b/packages/client/src/pages/Confirm/sub-components/activateUser.js index dcc4307cdd..ad4a9105c1 100644 --- a/packages/client/src/pages/Confirm/sub-components/activateUser.js +++ b/packages/client/src/pages/Confirm/sub-components/activateUser.js @@ -52,6 +52,8 @@ import { } from "./StyledCreateUser"; import PortalLogo from "@docspace/shared/components/portal-logo/PortalLogo"; import GreetingUserContainer from "./GreetingUserContainer"; +import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; +import { AuthenticatedAction } from "SRC_DIR/helpers/enums"; const ActivateUserForm = (props) => { const { t, settings, linkData, hashSettings, defaultPage, login } = props; @@ -279,7 +281,7 @@ const ActivateUserForm = (props) => { ); }; -export default inject(({ authStore, settingsStore }) => { +const ComponentWrapper = inject(({ authStore, settingsStore }) => { const { greetingSettings, hashSettings, @@ -300,3 +302,11 @@ export default inject(({ authStore, settingsStore }) => { withLoader(observer(ActivateUserForm)), ), ); + +export const Component = () => { + return ( + + + + ); +}; diff --git a/packages/client/src/pages/Confirm/sub-components/auth.js b/packages/client/src/pages/Confirm/sub-components/auth.js index e99665c3d2..e4f12723f3 100644 --- a/packages/client/src/pages/Confirm/sub-components/auth.js +++ b/packages/client/src/pages/Confirm/sub-components/auth.js @@ -33,6 +33,8 @@ import { combineUrl } from "@docspace/shared/utils/combineUrl"; import { toastr } from "@docspace/shared/components/toast"; import { frameCallEvent } from "@docspace/shared/utils/common"; import SectionWrapper from "SRC_DIR/components/Section"; +import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; +import { AuthenticatedAction } from "SRC_DIR/helpers/enums"; const Auth = (props) => { //console.log("Auth render"); const { linkData } = props; @@ -81,4 +83,10 @@ const AuthPage = (props) => ( ); -export default AuthPage; +export const Component = () => { + return ( + + + + ); +}; diff --git a/packages/client/src/pages/Confirm/sub-components/changeEmail.js b/packages/client/src/pages/Confirm/sub-components/changeEmail.js index 7d94e643b9..d73beb5174 100644 --- a/packages/client/src/pages/Confirm/sub-components/changeEmail.js +++ b/packages/client/src/pages/Confirm/sub-components/changeEmail.js @@ -32,6 +32,7 @@ import Section from "@docspace/shared/components/section"; import { combineUrl } from "@docspace/shared/utils/combineUrl"; import tryRedirectTo from "@docspace/shared/utils/tryRedirectTo"; import SectionWrapper from "SRC_DIR/components/Section"; +import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; class ChangeEmail extends React.PureComponent { componentDidMount() { const { changeEmail, isLoaded, linkData } = this.props; @@ -107,7 +108,7 @@ const ChangeEmailForm = (props) => ( ); -export default inject(({ authStore, settingsStore, userStore }) => { +const ComponentWrapper = inject(({ authStore, settingsStore, userStore }) => { const { isLoaded } = authStore; return { isLoaded, @@ -115,3 +116,11 @@ export default inject(({ authStore, settingsStore, userStore }) => { defaultPage: settingsStore.defaultPage, }; })(observer(ChangeEmailForm)); + +export const Component = () => { + return ( + + + + ); +}; diff --git a/packages/client/src/pages/Confirm/sub-components/changeOwner.js b/packages/client/src/pages/Confirm/sub-components/changeOwner.js index 2b522b9fa3..eb5b7a172a 100644 --- a/packages/client/src/pages/Confirm/sub-components/changeOwner.js +++ b/packages/client/src/pages/Confirm/sub-components/changeOwner.js @@ -43,6 +43,7 @@ import PortalLogo from "@docspace/shared/components/portal-logo/PortalLogo"; import { ownerChange } from "@docspace/shared/api/settings"; import { getUserFromConfirm } from "@docspace/shared/api/people"; import { PRODUCT_NAME } from "@docspace/shared/constants"; +import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; const ChangeOwnerForm = (props) => { const { t, greetingTitle, linkData, history } = props; @@ -129,9 +130,17 @@ const ChangeOwnerForm = (props) => { ); }; -export default inject(({ settingsStore }) => ({ +const ComponentWrapper = inject(({ settingsStore }) => ({ greetingTitle: settingsStore.greetingSettings, defaultPage: settingsStore.defaultPage, }))( withTranslation(["Confirm", "Common"])(withLoader(observer(ChangeOwnerForm))), ); + +export const Component = () => { + return ( + + + + ); +}; diff --git a/packages/client/src/pages/Confirm/sub-components/changePassword.js b/packages/client/src/pages/Confirm/sub-components/changePassword.js index f810ed6a70..7fc0341466 100644 --- a/packages/client/src/pages/Confirm/sub-components/changePassword.js +++ b/packages/client/src/pages/Confirm/sub-components/changePassword.js @@ -42,6 +42,7 @@ import { getPasswordErrorMessage } from "@docspace/shared/utils/getPasswordError import PortalLogo from "@docspace/shared/components/portal-logo/PortalLogo"; import withLoader from "../withLoader"; import { StyledPage, StyledBody, StyledContent } from "./StyledConfirm"; +import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; const ChangePasswordForm = (props) => { const { @@ -207,7 +208,7 @@ const ChangePasswordForm = (props) => { ); }; -export default inject(({ authStore, settingsStore, setup }) => { +const ComponentWrapper = inject(({ authStore, settingsStore, setup }) => { const { greetingSettings, hashSettings, @@ -233,3 +234,11 @@ export default inject(({ authStore, settingsStore, setup }) => { withLoader(observer(ChangePasswordForm)), ), ); + +export const Component = () => { + return ( + + + + ); +}; diff --git a/packages/client/src/pages/Confirm/sub-components/changePhone.js b/packages/client/src/pages/Confirm/sub-components/changePhone.js index 036b3a05ee..8ee222a1fc 100644 --- a/packages/client/src/pages/Confirm/sub-components/changePhone.js +++ b/packages/client/src/pages/Confirm/sub-components/changePhone.js @@ -36,6 +36,7 @@ import withLoader from "../withLoader"; import { FormWrapper } from "@docspace/shared/components/form-wrapper"; import PortalLogo from "@docspace/shared/components/portal-logo/PortalLogo"; import { PRODUCT_NAME } from "@docspace/shared/constants"; +import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; const ChangePhoneForm = (props) => { const { t, greetingTitle } = props; @@ -89,6 +90,14 @@ const ChangePhoneForm = (props) => { ); }; -export default inject(({ settingsStore }) => ({ +const ComponentWrapper = inject(({ settingsStore }) => ({ greetingTitle: settingsStore.greetingSettings, }))(withTranslation("Confirm")(withLoader(observer(ChangePhoneForm)))); + +export const Component = () => { + return ( + + + + ); +}; diff --git a/packages/client/src/pages/Confirm/sub-components/continuePortal.js b/packages/client/src/pages/Confirm/sub-components/continuePortal.js index 226bfeb5ef..2a81d5cc6a 100644 --- a/packages/client/src/pages/Confirm/sub-components/continuePortal.js +++ b/packages/client/src/pages/Confirm/sub-components/continuePortal.js @@ -45,6 +45,7 @@ import withLoader from "../withLoader"; import { FormWrapper } from "@docspace/shared/components/form-wrapper"; import PortalLogo from "@docspace/shared/components/portal-logo/PortalLogo"; import { PRODUCT_NAME } from "@docspace/shared/constants"; +import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; const ContinuePortal = (props) => { const { t, greetingTitle, linkData } = props; @@ -117,9 +118,17 @@ const ContinuePortal = (props) => { ); }; -export default inject(({ settingsStore }) => ({ +const ComponentWrapper = inject(({ settingsStore }) => ({ greetingTitle: settingsStore.greetingSettings, theme: settingsStore.theme, }))( withTranslation(["Confirm", "Common"])(withLoader(observer(ContinuePortal))), ); + +export const Component = () => { + return ( + + + + ); +}; diff --git a/packages/client/src/pages/Confirm/sub-components/createUser.js b/packages/client/src/pages/Confirm/sub-components/createUser.js index 5d4804c510..e7422e2287 100644 --- a/packages/client/src/pages/Confirm/sub-components/createUser.js +++ b/packages/client/src/pages/Confirm/sub-components/createUser.js @@ -74,6 +74,8 @@ import LanguageComboboxWrapper from "./LanguageCombobox"; import withCultureNames from "SRC_DIR/HOCs/withCultureNames"; import { setCookie } from "@docspace/shared/utils/cookie"; +import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; +import { AuthenticatedAction } from "SRC_DIR/helpers/enums"; const DEFAULT_ROOM_TEXT = "{{firstName}} {{lastName}} invites you to join the room {{roomName}} for secure document collaboration."; @@ -733,7 +735,7 @@ const CreateUserForm = (props) => { ); }; -export default inject(({ settingsStore, authStore }) => { +const ComponentWrapper = inject(({ settingsStore, authStore }) => { const { providers, thirdPartyLogin, capabilities } = authStore; const { passwordSettings, @@ -766,3 +768,11 @@ export default inject(({ settingsStore, authStore }) => { ), ), ); + +export const Component = () => { + return ( + + + + ); +}; diff --git a/packages/client/src/pages/Confirm/sub-components/deactivatePortal.js b/packages/client/src/pages/Confirm/sub-components/deactivatePortal.js index 2b4a7017fe..ce5331eb2e 100644 --- a/packages/client/src/pages/Confirm/sub-components/deactivatePortal.js +++ b/packages/client/src/pages/Confirm/sub-components/deactivatePortal.js @@ -45,6 +45,7 @@ import withLoader from "../withLoader"; import { FormWrapper } from "@docspace/shared/components/form-wrapper"; import PortalLogo from "@docspace/shared/components/portal-logo/PortalLogo"; import { PRODUCT_NAME } from "@docspace/shared/constants"; +import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; const DeactivatePortal = (props) => { const { t, greetingTitle, linkData, companyInfoSettingsData } = props; @@ -121,7 +122,7 @@ const DeactivatePortal = (props) => { ); }; -export default inject(({ settingsStore }) => ({ +const ComponentWrapper = inject(({ settingsStore }) => ({ greetingTitle: settingsStore.greetingSettings, theme: settingsStore.theme, companyInfoSettingsData: settingsStore.companyInfoSettingsData, @@ -130,3 +131,11 @@ export default inject(({ settingsStore }) => ({ withLoader(observer(DeactivatePortal)), ), ); + +export const Component = () => { + return ( + + + + ); +}; diff --git a/packages/client/src/pages/Confirm/sub-components/profileRemove.js b/packages/client/src/pages/Confirm/sub-components/profileRemove.js index adcc29f2b0..41f5b1e93a 100644 --- a/packages/client/src/pages/Confirm/sub-components/profileRemove.js +++ b/packages/client/src/pages/Confirm/sub-components/profileRemove.js @@ -37,6 +37,7 @@ import { StyledPage, StyledBody, StyledContent } from "./StyledConfirm"; import withLoader from "../withLoader"; import { FormWrapper } from "@docspace/shared/components/form-wrapper"; import PortalLogo from "@docspace/shared/components/portal-logo/PortalLogo"; +import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; const ProfileRemoveForm = (props) => { const { t, greetingTitle, linkData, legalTerms, currentColorScheme } = props; @@ -150,9 +151,17 @@ const ProfileRemoveForm = (props) => { ); }; -export default inject(({ settingsStore }) => ({ +const ComponentWrapper = inject(({ settingsStore }) => ({ greetingTitle: settingsStore.greetingSettings, theme: settingsStore.theme, legalTerms: settingsStore.legalTerms, currentColorScheme: settingsStore.currentColorScheme, }))(withTranslation("Confirm")(withLoader(observer(ProfileRemoveForm)))); + +export const Component = () => { + return ( + + + + ); +}; diff --git a/packages/client/src/pages/Confirm/sub-components/removePortal.js b/packages/client/src/pages/Confirm/sub-components/removePortal.js index c68293c58b..089f54aec2 100644 --- a/packages/client/src/pages/Confirm/sub-components/removePortal.js +++ b/packages/client/src/pages/Confirm/sub-components/removePortal.js @@ -46,6 +46,7 @@ import withLoader from "../withLoader"; import { FormWrapper } from "@docspace/shared/components/form-wrapper"; import PortalLogo from "@docspace/shared/components/portal-logo/PortalLogo"; import { PRODUCT_NAME } from "@docspace/shared/constants"; +import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; const RemovePortal = (props) => { const { t, greetingTitle, linkData, companyInfoSettingsData } = props; @@ -121,8 +122,16 @@ const RemovePortal = (props) => { ); }; -export default inject(({ settingsStore }) => ({ +const ComponentWrapper = inject(({ settingsStore }) => ({ greetingTitle: settingsStore.greetingSettings, theme: settingsStore.theme, companyInfoSettingsData: settingsStore.companyInfoSettingsData, }))(withTranslation(["Confirm", "Common"])(withLoader(observer(RemovePortal)))); + +export const Component = () => { + return ( + + + + ); +}; diff --git a/packages/client/src/pages/Confirm/sub-components/tfaActivation.js b/packages/client/src/pages/Confirm/sub-components/tfaActivation.js index 5a9c5bbd99..3b471d386f 100644 --- a/packages/client/src/pages/Confirm/sub-components/tfaActivation.js +++ b/packages/client/src/pages/Confirm/sub-components/tfaActivation.js @@ -50,6 +50,7 @@ import { import { loginWithTfaCode } from "@docspace/shared/api/user"; import { combineUrl } from "@docspace/shared/utils/combineUrl"; import { PRODUCT_NAME } from "@docspace/shared/constants"; +import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; const StyledForm = styled(Box)` margin: 56px auto; @@ -346,7 +347,7 @@ const TfaActivationWrapper = (props) => { ); }; -export default inject(({ settingsStore, confirm, tfaStore }) => ({ +const ComponentWrapper = inject(({ settingsStore, confirm, tfaStore }) => ({ setIsLoaded: confirm.setIsLoaded, setIsLoading: confirm.setIsLoading, tfaAndroidAppUrl: tfaStore.tfaAndroidAppUrl, @@ -354,3 +355,11 @@ export default inject(({ settingsStore, confirm, tfaStore }) => ({ tfaWinAppUrl: tfaStore.tfaWinAppUrl, currentColorScheme: settingsStore.currentColorScheme, }))(withTranslation(["Confirm", "Common"])(observer(TfaActivationWrapper))); + +export const Component = () => { + return ( + + + + ); +}; diff --git a/packages/client/src/pages/Confirm/sub-components/tfaAuth.js b/packages/client/src/pages/Confirm/sub-components/tfaAuth.js index 1b7e54492e..2d84c1cec8 100644 --- a/packages/client/src/pages/Confirm/sub-components/tfaAuth.js +++ b/packages/client/src/pages/Confirm/sub-components/tfaAuth.js @@ -42,6 +42,7 @@ import PortalLogo from "@docspace/shared/components/portal-logo/PortalLogo"; import { StyledPage, StyledContent } from "./StyledConfirm"; import { validateTfaCode } from "@docspace/shared/api/settings"; import { loginWithTfaCode } from "@docspace/shared/api/user"; +import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; const StyledForm = styled(Box)` margin: 56px auto; @@ -205,9 +206,17 @@ const TfaAuthFormWrapper = (props) => { return ; }; -export default inject(({ settingsStore, confirm }) => ({ +const ComponentWrapper = inject(({ settingsStore, confirm }) => ({ setIsLoaded: confirm.setIsLoaded, setIsLoading: confirm.setIsLoading, defaultPage: settingsStore.defaultPage, }))(withTranslation(["Confirm", "Common"])(observer(TfaAuthFormWrapper))); + +export const Component = () => { + return ( + + + + ); +}; diff --git a/packages/client/src/routes/confirm.js b/packages/client/src/routes/confirm.js index 5b172dab49..1094ca6579 100644 --- a/packages/client/src/routes/confirm.js +++ b/packages/client/src/routes/confirm.js @@ -24,195 +24,160 @@ // content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode -import React from "react"; -import loadable from "@loadable/component"; - -import ConfirmRoute from "../helpers/confirmRoute"; -import ErrorBoundary from "../components/ErrorBoundaryWrapper"; -import componentLoader from "@docspace/shared/utils/component-loader"; - import Error404 from "@docspace/shared/components/errors/Error404"; -import { AuthenticatedAction } from "../helpers/enums"; -const Confirm = loadable(() => - componentLoader(() => import("../pages/Confirm")), -); +import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; -const ActivateUserForm = loadable(() => - componentLoader(() => import("../pages/Confirm/sub-components/activateUser")), -); -const CreateUserForm = loadable(() => - componentLoader(() => import("../pages/Confirm/sub-components/createUser")), -); -const ChangePasswordForm = loadable(() => - componentLoader( - () => import("../pages/Confirm/sub-components/changePassword"), - ), -); -const ActivateEmailForm = loadable(() => - componentLoader( - () => import("../pages/Confirm/sub-components/activateEmail"), - ), -); -const ChangeEmailForm = loadable(() => - componentLoader(() => import("../pages/Confirm/sub-components/changeEmail")), -); -const ChangePhoneForm = loadable(() => - componentLoader(() => import("../pages/Confirm/sub-components/changePhone")), -); -const ProfileRemoveForm = loadable(() => - componentLoader( - () => import("../pages/Confirm/sub-components/profileRemove"), - ), -); -const ChangeOwnerForm = loadable(() => - componentLoader(() => import("../pages/Confirm/sub-components/changeOwner")), -); -const TfaAuthForm = loadable(() => - componentLoader(() => import("../pages/Confirm/sub-components/tfaAuth")), -); -const TfaActivationForm = loadable(() => - componentLoader( - () => import("../pages/Confirm/sub-components/tfaActivation"), - ), -); -const RemovePortal = loadable(() => - componentLoader(() => import("../pages/Confirm/sub-components/removePortal")), -); -const DeactivatePortal = loadable(() => - componentLoader( - () => import("../pages/Confirm/sub-components/deactivatePortal"), - ), -); -const ContinuePortal = loadable(() => - componentLoader( - () => import("../pages/Confirm/sub-components/continuePortal"), - ), -); -const Auth = loadable(() => - componentLoader(() => import("../pages/Confirm/sub-components/auth")), -); +// import ActivateUserForm from "SRC_DIR/pages/Confirm/sub-components/activateUser"; +// import CreateUserForm from "SRC_DIR/pages/Confirm/sub-components/createUser"; +// import ChangePasswordForm from "SRC_DIR/pages/Confirm/sub-components/changePassword"; +// import ActivateEmailForm from "SRC_DIR/pages/Confirm/sub-components/activateEmail"; +// import ChangeEmailForm from "SRC_DIR/pages/Confirm/sub-components/changeEmail"; +// import ChangePhoneForm from "SRC_DIR/pages/Confirm/sub-components/changePhone"; +// import ProfileRemoveForm from "SRC_DIR/pages/Confirm/sub-components/profileRemove"; +// import ChangeOwnerForm from "SRC_DIR/pages/Confirm/sub-components/changeOwner"; +// import TfaAuthForm from "SRC_DIR/pages/Confirm/sub-components/tfaAuth"; +// import TfaActivationForm from "SRC_DIR/pages/Confirm/sub-components/tfaActivation"; +// import RemovePortal from "SRC_DIR/pages/Confirm/sub-components/removePortal"; +// import DeactivatePortal from "SRC_DIR/pages/Confirm/sub-components/deactivatePortal"; +// import ContinuePortal from "SRC_DIR/pages/Confirm/sub-components/continuePortal"; +// import Auth from "SRC_DIR/pages/Confirm/sub-components/auth"; const confirmRoutes = [ { path: "EmpInvite", - element: ( - - - - ), + // element: ( + // + // + // + // ), + lazy: () => import("SRC_DIR/pages/Confirm/sub-components/createUser"), }, { path: "LinkInvite", - element: ( - - - - ), + // element: ( + // + // + // + // ), + lazy: () => import("SRC_DIR/pages/Confirm/sub-components/createUser"), }, { path: "Activation", - element: ( - - - - ), + // element: ( + // + // + // + // ), + lazy: () => import("SRC_DIR/pages/Confirm/sub-components/activateUser"), }, { path: "EmailActivation", - element: ( - - - - ), + // element: ( + // + // + // + // ), + lazy: () => import("SRC_DIR/pages/Confirm/sub-components/activateEmail"), }, { path: "EmailChange", - element: ( - - - - ), + // element: ( + // + // + // + // ), + lazy: () => import("SRC_DIR/pages/Confirm/sub-components/changeEmail"), }, { path: "PasswordChange", - element: ( - - - - ), + // element: ( + // + // + // + // ), + lazy: () => import("SRC_DIR/pages/Confirm/sub-components/changePassword"), }, { path: "ProfileRemove", - element: ( - - - - ), + // element: ( + // + // + // + // ), + lazy: () => import("SRC_DIR/pages/Confirm/sub-components/profileRemove"), }, { path: "PhoneActivation", - element: ( - - - - ), + // element: ( + // + // + // + // ), + lazy: () => import("SRC_DIR/pages/Confirm/sub-components/changePhone"), }, { path: "PortalOwnerChange", - element: ( - - - - ), + // element: ( + // + // + // + // ), + lazy: () => import("SRC_DIR/pages/Confirm/sub-components/changeOwner"), }, { path: "TfaAuth", - element: ( - - - - ), + // element: ( + // + // + // + // ), + lazy: () => import("SRC_DIR/pages/Confirm/sub-components/tfaAuth"), }, { path: "TfaActivation", - element: ( - - - - ), + // element: ( + // + // + // + // ), + lazy: () => import("SRC_DIR/pages/Confirm/sub-components/tfaActivation"), }, { path: "PortalRemove", - element: ( - - - - ), + // element: ( + // + // + // + // ), + lazy: () => import("SRC_DIR/pages/Confirm/sub-components/removePortal"), }, { path: "PortalSuspend", - element: ( - - - - ), + // element: ( + // + // + // + // ), + lazy: () => import("SRC_DIR/pages/Confirm/sub-components/deactivatePortal"), }, { path: "PortalContinue", - element: ( - - - - ), + // element: ( + // + // + // + // ), + lazy: () => import("SRC_DIR/pages/Confirm/sub-components/continuePortal"), }, { path: "Auth", - element: ( - - - - ), + // element: ( + // + // + // + // ), + lazy: () => import("SRC_DIR/pages/Confirm/sub-components/auth"), }, ]; @@ -229,21 +194,13 @@ const ConfirmParentRoutes = [ }, { path: "confirm.aspx", - element: ( - - - - ), + lazy: () => import("SRC_DIR/pages/Confirm"), errorElement: , children: [...confirmRoutes], }, { path: "confirm", - element: ( - - - - ), + lazy: () => import("SRC_DIR/pages/Confirm"), errorElement: , children: [...confirmRoutes], }, diff --git a/packages/client/src/routes/general.js b/packages/client/src/routes/general.js index d35a8f711d..4509feac43 100644 --- a/packages/client/src/routes/general.js +++ b/packages/client/src/routes/general.js @@ -42,19 +42,19 @@ const generalRoutes = [ }, { path: "login", - lazy: () => import("../pages/Profile"), + lazy: () => import("SRC_DIR/pages/Profile"), }, { path: "notifications", - lazy: () => import("../pages/Profile"), + lazy: () => import("SRC_DIR/pages/Profile"), }, { path: "file-management", - lazy: () => import("../pages/Profile"), + lazy: () => import("SRC_DIR/pages/Profile"), }, { path: "interface-theme", - lazy: () => import("../pages/Profile"), + lazy: () => import("SRC_DIR/pages/Profile"), }, ], }, From 6d9c54fba552a7cd6df626a70d1164ff80bb5c8b Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Fri, 21 Jun 2024 16:53:12 +0300 Subject: [PATCH 07/13] Client: add lazy loading for all client pages --- packages/client/src/Client.jsx | 4 +- .../src/components/Error520Wrapper/index.tsx | 28 +- .../ErrorUnavailableWrapper/index.tsx | 2 +- .../client/src/components/System/index.js | 4 +- .../dialogs/PreparationPortalDialog/index.js | 2 +- packages/client/src/pages/About/index.js | 4 +- .../client/src/pages/FormGallery/index.js | 2 +- .../pages/Home/Section/SettingsBody/index.js | 4 +- .../client/src/pages/Home/View/Accounts.js | 4 +- packages/client/src/pages/Home/View/Files.js | 4 +- packages/client/src/pages/Home/index.js | 2 +- .../src/pages/PortalUnavailable/index.js | 2 +- .../src/pages/PublicPreview/PublicPreview.tsx | 15 +- packages/client/src/pages/PublicRoom/index.js | 2 +- packages/client/src/pages/Sdk/index.js | 2 +- packages/client/src/pages/Wizard/index.js | 96 ++- packages/client/src/routes/client.js | 802 +++++++++++------- packages/management/src/App.tsx | 2 +- packages/management/src/router.tsx | 2 +- .../components/errors/AccessRestricted.tsx | 4 +- .../shared/components/errors/Error401.tsx | 4 +- .../shared/components/errors/Error403.tsx | 4 +- .../shared/components/errors/ErrorOffline.tsx | 4 +- .../shared/pages/PreparationPortal/index.tsx | 4 +- 24 files changed, 612 insertions(+), 391 deletions(-) diff --git a/packages/client/src/Client.jsx b/packages/client/src/Client.jsx index fca4c8eff2..b4dd246e87 100644 --- a/packages/client/src/Client.jsx +++ b/packages/client/src/Client.jsx @@ -191,7 +191,7 @@ const ClientContent = (props) => { ); }; -const Client = inject( +export const Client = inject( ({ authStore, clientLoadingStore, @@ -262,5 +262,3 @@ const Client = inject( }; }, )(withTranslation("Common")(observer(ClientContent))); - -export default () => ; diff --git a/packages/client/src/components/Error520Wrapper/index.tsx b/packages/client/src/components/Error520Wrapper/index.tsx index e8616ab957..cb791fb744 100644 --- a/packages/client/src/components/Error520Wrapper/index.tsx +++ b/packages/client/src/components/Error520Wrapper/index.tsx @@ -33,17 +33,19 @@ const Error520Wrapper = (props: Error520Props) => { return ; }; -export default inject(({ authStore, settingsStore, userStore }) => { - const { firebaseHelper, currentDeviceType, currentColorScheme } = - settingsStore; - const { user } = userStore; - const version = authStore.version; +export const Error520Component = inject( + ({ authStore, settingsStore, userStore }) => { + const { firebaseHelper, currentDeviceType, currentColorScheme } = + settingsStore; + const { user } = userStore; + const version = authStore.version; - return { - user, - version, - firebaseHelper, - currentDeviceType, - currentColorScheme, - }; -})(observer(Error520Wrapper)); + return { + user, + version, + firebaseHelper, + currentDeviceType, + currentColorScheme, + }; + }, +)(observer(Error520Wrapper)); diff --git a/packages/client/src/components/ErrorUnavailableWrapper/index.tsx b/packages/client/src/components/ErrorUnavailableWrapper/index.tsx index bb2f976005..7a0cf8958f 100644 --- a/packages/client/src/components/ErrorUnavailableWrapper/index.tsx +++ b/packages/client/src/components/ErrorUnavailableWrapper/index.tsx @@ -33,7 +33,7 @@ const ErrorUnavailableWrapper = (props: ErrorUnavailableProps) => { return ; }; -export default inject(({ settingsStore }) => { +export const Component = inject(({ settingsStore }) => { const { whiteLabelLogoUrls } = settingsStore; return { diff --git a/packages/client/src/components/System/index.js b/packages/client/src/components/System/index.js index 0a47cc4ca3..a34333a9bf 100644 --- a/packages/client/src/components/System/index.js +++ b/packages/client/src/components/System/index.js @@ -29,7 +29,7 @@ import AppLoader from "@docspace/common/components/AppLoader"; import Error404 from "@docspace/shared/components/errors/Error404"; import ErrorBoundary from "../ErrorBoundaryWrapper"; -import Error520 from "../Error520Wrapper"; +import { Error520Component } from "../Error520Wrapper"; function loadComponent(scope, module) { return async () => { @@ -115,7 +115,7 @@ const System = (props) => { if (failed) { console.log(`Failed to load dynamic script: ${props.system.url}`); - return ; + return ; } const Component = React.lazy( diff --git a/packages/client/src/components/dialogs/PreparationPortalDialog/index.js b/packages/client/src/components/dialogs/PreparationPortalDialog/index.js index 01b38af475..be64109899 100644 --- a/packages/client/src/components/dialogs/PreparationPortalDialog/index.js +++ b/packages/client/src/components/dialogs/PreparationPortalDialog/index.js @@ -28,7 +28,7 @@ import React from "react"; import { ModalDialog } from "@docspace/shared/components/modal-dialog"; import { withTranslation } from "react-i18next"; import { inject, observer } from "mobx-react"; -import PreparationPortal from "@docspace/shared/pages/PreparationPortal"; +import { PreparationPortal } from "@docspace/shared/pages/PreparationPortal"; import StyledPreparationPortalDialog from "./StyledPreparationPortalDialog"; import { PRODUCT_NAME } from "@docspace/shared/constants"; diff --git a/packages/client/src/pages/About/index.js b/packages/client/src/pages/About/index.js index 95a94d924d..116d6eb8f6 100644 --- a/packages/client/src/pages/About/index.js +++ b/packages/client/src/pages/About/index.js @@ -49,7 +49,7 @@ const BodyWrapper = inject(({ settingsStore }) => { }; })(withTranslation(["About", "Common"])(observer(Body))); -const About = (props) => { +export const About = (props) => { return ( @@ -61,5 +61,3 @@ const About = (props) => { ); }; - -export default About; diff --git a/packages/client/src/pages/FormGallery/index.js b/packages/client/src/pages/FormGallery/index.js index 6c658a991d..bdbc23f156 100644 --- a/packages/client/src/pages/FormGallery/index.js +++ b/packages/client/src/pages/FormGallery/index.js @@ -127,7 +127,7 @@ const FormGallery = ({ ); }; -export default inject(({ oformsStore }) => ({ +export const WrappedComponent = inject(({ oformsStore }) => ({ oformsLoadError: oformsStore.oformsLoadError, currentCategory: oformsStore.currentCategory, diff --git a/packages/client/src/pages/Home/Section/SettingsBody/index.js b/packages/client/src/pages/Home/Section/SettingsBody/index.js index cbd5c3c4f2..733ee7d45f 100644 --- a/packages/client/src/pages/Home/Section/SettingsBody/index.js +++ b/packages/client/src/pages/Home/Section/SettingsBody/index.js @@ -28,7 +28,7 @@ import React, { useCallback } from "react"; import { useTranslation } from "react-i18next"; import styled, { css } from "styled-components"; -import Error520 from "../../../../components/Error520Wrapper"; +import { Error520Component } from "../../../../components/Error520Wrapper"; import { inject, observer } from "mobx-react"; import { combineUrl } from "@docspace/shared/utils/combineUrl"; import config from "PACKAGE_FILE"; @@ -87,7 +87,7 @@ const SectionBodyContent = ({ isErrorSettings, user }) => { //const showAdminSettings = user.isAdmin || user.isOwner; return isErrorSettings ? ( - + ) : ( { +export const AccountsView = () => { return ( {(context) => ( @@ -40,5 +40,3 @@ const AccountsView = () => { ); }; - -export default AccountsView; diff --git a/packages/client/src/pages/Home/View/Files.js b/packages/client/src/pages/Home/View/Files.js index 07b3240d3b..84278a564a 100644 --- a/packages/client/src/pages/Home/View/Files.js +++ b/packages/client/src/pages/Home/View/Files.js @@ -29,7 +29,7 @@ import { Consumer } from "@docspace/shared/utils"; import { SectionBodyContent } from "../Section"; -const FilesView = () => { +export const FilesView = () => { return ( {(context) => ( @@ -42,5 +42,3 @@ const FilesView = () => { ); }; - -export default FilesView; diff --git a/packages/client/src/pages/Home/index.js b/packages/client/src/pages/Home/index.js index ffea1f5615..252693483f 100644 --- a/packages/client/src/pages/Home/index.js +++ b/packages/client/src/pages/Home/index.js @@ -422,7 +422,7 @@ const PureHome = (props) => { const Home = withTranslation(["Files", "People"])(PureHome); -export default inject( +export const Component = inject( ({ authStore, filesStore, diff --git a/packages/client/src/pages/PortalUnavailable/index.js b/packages/client/src/pages/PortalUnavailable/index.js index 721736b801..1bb6946f3e 100644 --- a/packages/client/src/pages/PortalUnavailable/index.js +++ b/packages/client/src/pages/PortalUnavailable/index.js @@ -123,7 +123,7 @@ const PortalUnavailable = ({ onLogoutClick }) => { ); }; -export default inject(({ profileActionsStore }) => { +export const Component = inject(({ profileActionsStore }) => { const { onLogoutClick } = profileActionsStore; return { onLogoutClick }; diff --git a/packages/client/src/pages/PublicPreview/PublicPreview.tsx b/packages/client/src/pages/PublicPreview/PublicPreview.tsx index 3aac95eb4a..1ff1ed36ed 100644 --- a/packages/client/src/pages/PublicPreview/PublicPreview.tsx +++ b/packages/client/src/pages/PublicPreview/PublicPreview.tsx @@ -8,7 +8,7 @@ import { UrlActionType } from "@docspace/shared/enums"; import { toastr } from "@docspace/shared/components/toast"; import MediaViewer from "@docspace/shared/components/media-viewer/MediaViewer"; import { ViewerLoader } from "@docspace/shared/components/media-viewer/sub-components/ViewerLoader"; -import Error403 from "@docspace/shared/components/errors/Error403"; +import { Error403 } from "@docspace/shared/components/errors/Error403"; import type { TFile } from "@docspace/shared/api/files/types"; import type { @@ -132,9 +132,12 @@ const PublicPreview = ({ ); }; -export default inject(({ filesSettingsStore, settingsStore }) => { - const { getFilesSettings, getIcon, extsImagePreviewed } = filesSettingsStore; - const { openUrl } = settingsStore; +export const WrappedComponent = inject( + ({ filesSettingsStore, settingsStore }) => { + const { getFilesSettings, getIcon, extsImagePreviewed } = + filesSettingsStore; + const { openUrl } = settingsStore; - return { getFilesSettings, getIcon, openUrl, extsImagePreviewed }; -})(observer(PublicPreview)); + return { getFilesSettings, getIcon, openUrl, extsImagePreviewed }; + }, +)(observer(PublicPreview)); diff --git a/packages/client/src/pages/PublicRoom/index.js b/packages/client/src/pages/PublicRoom/index.js index a62d372f29..7516ebc47c 100644 --- a/packages/client/src/pages/PublicRoom/index.js +++ b/packages/client/src/pages/PublicRoom/index.js @@ -127,7 +127,7 @@ const PublicRoom = (props) => { ); }; -export default inject( +export const WrappedComponent = inject( ({ settingsStore, publicRoomStore, diff --git a/packages/client/src/pages/Sdk/index.js b/packages/client/src/pages/Sdk/index.js index aace4bd817..f440e439b8 100644 --- a/packages/client/src/pages/Sdk/index.js +++ b/packages/client/src/pages/Sdk/index.js @@ -307,7 +307,7 @@ const Sdk = ({ return component; }; -export default inject( +export const Component = inject( ({ authStore, settingsStore, diff --git a/packages/client/src/pages/Wizard/index.js b/packages/client/src/pages/Wizard/index.js index 801f581dd5..a659d22432 100644 --- a/packages/client/src/pages/Wizard/index.js +++ b/packages/client/src/pages/Wizard/index.js @@ -525,54 +525,56 @@ const Wizard = (props) => { ); }; -export default inject(({ authStore, settingsStore, wizardStore }) => { - const { - passwordSettings, - wizardToken, - timezone, - urlLicense, - hashSettings, - setWizardComplete, - getPortalTimezones, - getPortalPasswordSettings, - theme, - } = settingsStore; +export const WrappedComponent = inject( + ({ authStore, settingsStore, wizardStore }) => { + const { + passwordSettings, + wizardToken, + timezone, + urlLicense, + hashSettings, + setWizardComplete, + getPortalTimezones, + getPortalPasswordSettings, + theme, + } = settingsStore; - const { language } = authStore; - const { - isWizardLoaded, - machineName, - isLicenseRequired, - licenseUpload, - setIsWizardLoaded, - getMachineName, - getIsRequiredLicense, + const { language } = authStore; + const { + isWizardLoaded, + machineName, + isLicenseRequired, + licenseUpload, + setIsWizardLoaded, + getMachineName, + getIsRequiredLicense, - setLicense, - resetLicenseUploaded, - } = wizardStore; + setLicense, + resetLicenseUploaded, + } = wizardStore; - return { - theme, - isLoaded: authStore.isLoaded, - culture: language, - wizardToken, - passwordSettings, - timezone, - urlLicense, - hashSettings, - isWizardLoaded, - machineName, - isLicenseRequired, - licenseUpload, - setWizardComplete, - getPortalPasswordSettings, - getPortalTimezones, - setIsWizardLoaded, - getMachineName, - getIsRequiredLicense, + return { + theme, + isLoaded: authStore.isLoaded, + culture: language, + wizardToken, + passwordSettings, + timezone, + urlLicense, + hashSettings, + isWizardLoaded, + machineName, + isLicenseRequired, + licenseUpload, + setWizardComplete, + getPortalPasswordSettings, + getPortalTimezones, + setIsWizardLoaded, + getMachineName, + getIsRequiredLicense, - setLicense, - resetLicenseUploaded, - }; -})(withCultureNames(observer(Wizard))); + setLicense, + resetLicenseUploaded, + }; + }, +)(withCultureNames(observer(Wizard))); diff --git a/packages/client/src/routes/client.js b/packages/client/src/routes/client.js index c57849412d..205f179da5 100644 --- a/packages/client/src/routes/client.js +++ b/packages/client/src/routes/client.js @@ -34,78 +34,38 @@ import Error404 from "@docspace/shared/components/errors/Error404"; import componentLoader from "@docspace/shared/utils/component-loader"; import ErrorBoundary from "../components/ErrorBoundaryWrapper"; -import FilesView from "SRC_DIR/pages/Home/View/Files"; -import AccountsView from "SRC_DIR/pages/Home/View/Accounts"; -import SettingsView from "SRC_DIR/pages/Home/View/Settings"; -const PublicPreview = loadable(() => - componentLoader(() => import("../pages/PublicPreview/PublicPreview")), -); - import { generalRoutes } from "./general"; -const Client = loadable(() => componentLoader(() => import("../Client"))); - -const Home = loadable(() => componentLoader(() => import("../pages/Home"))); - -const Sdk = loadable(() => componentLoader(() => import("../pages/Sdk"))); - -const FormGallery = loadable(() => - componentLoader(() => import("../pages/FormGallery")), -); const PublicRoom = loadable(() => componentLoader(() => import("../pages/PublicRoom")), ); -const About = loadable(() => componentLoader(() => import("../pages/About"))); const Wizard = loadable(() => componentLoader(() => import("../pages/Wizard"))); -const PreparationPortal = loadable(() => - componentLoader(() => import("@docspace/shared/pages/PreparationPortal")), -); -const PortalUnavailable = loadable(() => - componentLoader(() => import("../pages/PortalUnavailable")), -); -const ErrorUnavailable = loadable(() => - componentLoader(() => import("../components/ErrorUnavailableWrapper")), -); - -const Error401 = loadable(() => - componentLoader(() => import("@docspace/shared/components/errors/Error401")), -); - -const Error403 = loadable(() => - componentLoader(() => import("@docspace/shared/components/errors/Error403")), -); - -const Error520 = loadable(() => - componentLoader(() => import("../components/Error520Wrapper")), -); - -const ErrorAccessRestricted = loadable(() => - componentLoader( - () => import("@docspace/shared/components/errors/AccessRestricted"), - ), -); - -const ErrorOffline = loadable(() => - componentLoader( - () => import("@docspace/shared/components/errors/ErrorOffline"), - ), -); const ClientRoutes = [ { path: "/", - element: ( - - - - - - ), + async lazy() { + const { Client } = await import("SRC_DIR/Client"); + + const Component = () => ( + + + + + + ); + + return { Component }; + }, errorElement: , children: [ { path: "/", - element: , + async lazy() { + const { Component } = await import("SRC_DIR/pages/Home"); + + return { Component }; + }, children: [ { index: true, @@ -133,107 +93,237 @@ const ClientRoutes = [ }, { path: "rooms/personal", - element: ( - - - - ), + async lazy() { + const { FilesView } = await import( + "SRC_DIR/pages/Home/View/Files" + ); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, { path: "rooms/personal/filter", - element: ( - - - - ), + async lazy() { + const { FilesView } = await import( + "SRC_DIR/pages/Home/View/Files" + ); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, { path: "files/trash", - element: ( - - - - ), + async lazy() { + const { FilesView } = await import( + "SRC_DIR/pages/Home/View/Files" + ); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, { path: "files/trash/filter", - element: ( - - - - ), + async lazy() { + const { FilesView } = await import( + "SRC_DIR/pages/Home/View/Files" + ); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, { path: "rooms/shared", - element: ( - - - - ), + async lazy() { + const { FilesView } = await import( + "SRC_DIR/pages/Home/View/Files" + ); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, { path: "rooms/shared/filter", - element: ( - - - - ), + async lazy() { + const { FilesView } = await import( + "SRC_DIR/pages/Home/View/Files" + ); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, { path: "rooms/shared/:room", - element: ( - - - - ), + async lazy() { + const { FilesView } = await import( + "SRC_DIR/pages/Home/View/Files" + ); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, { path: "rooms/shared/:room/filter", - element: ( - - - - ), + async lazy() { + const { FilesView } = await import( + "SRC_DIR/pages/Home/View/Files" + ); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, { path: "rooms/archived", - element: ( - - - - ), + async lazy() { + const { FilesView } = await import( + "SRC_DIR/pages/Home/View/Files" + ); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, { path: "rooms/archived/filter", - element: ( - - - - ), + async lazy() { + const { FilesView } = await import( + "SRC_DIR/pages/Home/View/Files" + ); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, { path: "rooms/archived/:room", - element: ( - - - - ), + async lazy() { + const { FilesView } = await import( + "SRC_DIR/pages/Home/View/Files" + ); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, { path: "rooms/archived/:room/filter", - element: ( - - - - ), + async lazy() { + const { FilesView } = await import( + "SRC_DIR/pages/Home/View/Files" + ); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, { path: "media/view/:id", - element: ( - - - - ), + async lazy() { + const { FilesView } = await import( + "SRC_DIR/pages/Home/View/Files" + ); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, { path: "accounts", @@ -273,11 +363,21 @@ const ClientRoutes = [ }, { path: "accounts/people/filter", - element: ( - - - - ), + async lazy() { + const { AccountsView } = await import( + "SRC_DIR/pages/Home/View/Accounts" + ); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, { path: "accounts/groups", @@ -289,11 +389,21 @@ const ClientRoutes = [ }, { path: "accounts/groups/filter", - element: ( - - - - ), + async lazy() { + const { AccountsView } = await import( + "SRC_DIR/pages/Home/View/Accounts" + ); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, { path: "accounts/groups/:groupId", @@ -305,36 +415,22 @@ const ClientRoutes = [ }, { path: "accounts/groups/:groupId/filter", - element: ( - - - - ), + async lazy() { + const { AccountsView } = await import( + "SRC_DIR/pages/Home/View/Accounts" + ); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, - /*{ - path: "settings", - element: ( - - - - ), - }, - { - path: "settings/personal", - element: ( - - - - ), - }, - { - path: "settings/general", - element: ( - - - - ), - },*/ ], }, { @@ -355,186 +451,322 @@ const ClientRoutes = [ }, { path: "/form-gallery", - element: ( - - - - - - ), + async lazy() { + const { WrappedComponent } = await import("SRC_DIR/pages/FormGallery"); + + const Component = () => ( + + + + + + ); + + return { Component }; + }, }, { path: "/form-gallery/:fromFolderId", - element: ( - - - - - - ), + async lazy() { + const { WrappedComponent } = await import("SRC_DIR/pages/FormGallery"); + + const Component = () => ( + + + + + + ); + + return { Component }; + }, }, { path: "/form-gallery/:fromFolderId/filter", - element: ( - - - - - - ), + async lazy() { + const { WrappedComponent } = await import("SRC_DIR/pages/FormGallery"); + + const Component = () => ( + + + + + + ); + + return { Component }; + }, }, { path: "/share/preview/:id", - element: ( - - - - - - ), + async lazy() { + const { WrappedComponent } = await import( + "SRC_DIR/pages/PublicPreview/PublicPreview" + ); + + const Component = () => ( + + + + + + ); + + return { Component }; + }, }, { path: "/rooms/share", - element: ( - - - - - - ), + async lazy() { + const { WrappedComponent } = await import("SRC_DIR/pages/PublicRoom"); + + const Component = () => ( + + + + + + ); + + return { Component }; + }, errorElement: , children: [ { index: true, - element: ( - - - - ), + async lazy() { + const { FilesView } = await import("SRC_DIR/pages/Home/View/Files"); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, { path: "media/view/:id", - element: ( - - - - ), + async lazy() { + const { FilesView } = await import("SRC_DIR/pages/Home/View/Files"); + + const Component = () => { + return ( + + + + ); + }; + + return { Component }; + }, }, ], }, { path: "/wizard", - element: ( - - - - - - ), + async lazy() { + const { WrappedComponent } = await import("SRC_DIR/pages/Wizard"); + + const Component = () => ( + + + + + + ); + + return { Component }; + }, }, { path: "/sdk/:mode", - element: , + lazy: () => import("SRC_DIR/pages/Sdk"), }, { path: "/about", - element: ( - - - - - - ), + async lazy() { + const { About } = await import("SRC_DIR/pages/About"); + + const Component = () => ( + + + + + + ); + + return { Component }; + }, }, { path: "/portal-unavailable", - element: ( - - - - - - ), + async lazy() { + const { Component } = await import("SRC_DIR/pages/PortalUnavailable"); + + const WrappedComponent = () => ( + + + + + + ); + + return { Component: WrappedComponent }; + }, }, { path: "/unavailable", - element: ( - - - - - - ), + async lazy() { + const { Component } = await import( + "SRC_DIR/components/ErrorUnavailableWrapper" + ); + + const WrappedComponent = () => ( + + + + + + ); + + return { Component: WrappedComponent }; + }, }, { path: "/access-restricted", - element: ( - - - - - - ), + async lazy() { + const { AccessRestricted } = await import( + "@docspace/shared/components/errors/AccessRestricted" + ); + + const Component = () => ( + + + + + + ); + + return { Component }; + }, }, { path: "/preparation-portal", - element: ( - - - - - - ), + async lazy() { + const { PreparationPortal } = await import( + "@docspace/shared/pages/PreparationPortal" + ); + + const Component = () => ( + + + + + + ); + + return { Component }; + }, }, { path: "/error/401", - element: ( - - - - - - ), + async lazy() { + const { Error401 } = await import( + "@docspace/shared/components/errors/Error401" + ); + + const Component = () => { + return ( + + + + + + ); + }; + + return { Component }; + }, }, { path: "/error/403", - element: ( - - - - - - ), + async lazy() { + const { Error403 } = await import( + "@docspace/shared/components/errors/Error403" + ); + + const Component = () => { + return ( + + + + + + ); + }; + + return { Component }; + }, }, { path: "/error/520", - element: ( - - - - - - ), + async lazy() { + const { Error520Component } = await import( + "SRC_DIR/components/Error520Wrapper" + ); + + const Component = () => { + return ( + + + + + + ); + }; + + return { Component }; + }, }, { path: "/error/access/restricted", - element: ( - - - - - - ), + async lazy() { + const { AccessRestricted } = await import( + "@docspace/shared/components/errors/AccessRestricted" + ); + + const Component = () => ( + + + + + + ); + + return { Component }; + }, }, { path: "/error/offline", - element: ( - - - - - - ), + async lazy() { + const { ErrorOfflineContainer } = await import( + "@docspace/shared/components/errors/ErrorOffline" + ); + + const Component = () => ( + + + + + + ); + + return { Component }; + }, }, ]; diff --git a/packages/management/src/App.tsx b/packages/management/src/App.tsx index dedebe9254..0818b50e32 100644 --- a/packages/management/src/App.tsx +++ b/packages/management/src/App.tsx @@ -33,7 +33,7 @@ import { ThemeKeys } from "@docspace/shared/enums"; import { Toast } from "@docspace/shared/components/toast"; import { Portal } from "@docspace/shared/components/portal"; import AppLoader from "@docspace/shared/components/app-loader"; -import Error403 from "@docspace/shared/components/errors/Error403"; +import { Error403 } from "@docspace/shared/components/errors/Error403"; import tryRedirectTo from "@docspace/shared/utils/tryRedirectTo"; diff --git a/packages/management/src/router.tsx b/packages/management/src/router.tsx index 2b34b66b31..2eb295b260 100644 --- a/packages/management/src/router.tsx +++ b/packages/management/src/router.tsx @@ -41,7 +41,7 @@ import Bonus from "./categories/bonus"; import ErrorBoundary from "./components/ErrorBoundaryWrapper"; import Error404 from "@docspace/shared/components/errors/Error404"; -import PreparationPortal from "@docspace/shared/pages/PreparationPortal"; +import { PreparationPortal } from "@docspace/shared/pages/PreparationPortal"; const routes = [ { diff --git a/packages/shared/components/errors/AccessRestricted.tsx b/packages/shared/components/errors/AccessRestricted.tsx index 5ef89807f9..6d0ef17593 100644 --- a/packages/shared/components/errors/AccessRestricted.tsx +++ b/packages/shared/components/errors/AccessRestricted.tsx @@ -31,7 +31,7 @@ import ErrorContainer from "../error-container/ErrorContainer"; import { AccessRestrictedWrapper } from "./Errors.styled"; import { PRODUCT_NAME } from "../../constants"; -const AccessRestricted = () => { +export const AccessRestricted = () => { const { t, ready } = useTranslation("Common"); useEffect(() => { @@ -49,5 +49,3 @@ const AccessRestricted = () => { ) ); }; - -export default AccessRestricted; diff --git a/packages/shared/components/errors/Error401.tsx b/packages/shared/components/errors/Error401.tsx index a759a102b3..58a0d49c48 100644 --- a/packages/shared/components/errors/Error401.tsx +++ b/packages/shared/components/errors/Error401.tsx @@ -27,10 +27,8 @@ import { useTranslation } from "react-i18next"; import ErrorContainer from "../error-container/ErrorContainer"; -const Error401 = () => { +export const Error401 = () => { const { t } = useTranslation("Common"); return ; }; - -export default Error401; diff --git a/packages/shared/components/errors/Error403.tsx b/packages/shared/components/errors/Error403.tsx index 63993279d6..08a3535a8b 100644 --- a/packages/shared/components/errors/Error403.tsx +++ b/packages/shared/components/errors/Error403.tsx @@ -29,10 +29,8 @@ import { useTranslation } from "react-i18next"; import ErrorContainer from "../error-container/ErrorContainer"; -const Error403 = () => { +export const Error403 = () => { const { t } = useTranslation("Common"); return ; }; - -export default Error403; diff --git a/packages/shared/components/errors/ErrorOffline.tsx b/packages/shared/components/errors/ErrorOffline.tsx index 7f4b387f59..ea7e829f8e 100644 --- a/packages/shared/components/errors/ErrorOffline.tsx +++ b/packages/shared/components/errors/ErrorOffline.tsx @@ -29,10 +29,8 @@ import { useTranslation } from "react-i18next"; import ErrorContainer from "../error-container/ErrorContainer"; -const ErrorOfflineContainer = () => { +export const ErrorOfflineContainer = () => { const { t } = useTranslation("Common"); return ; }; - -export default ErrorOfflineContainer; diff --git a/packages/shared/pages/PreparationPortal/index.tsx b/packages/shared/pages/PreparationPortal/index.tsx index 580cbf6cd5..a916cc6d1a 100644 --- a/packages/shared/pages/PreparationPortal/index.tsx +++ b/packages/shared/pages/PreparationPortal/index.tsx @@ -46,7 +46,7 @@ const secondBound = 63; let timerId: ReturnType | null; let progressTimerId: ReturnType | null; -const PreparationPortal = (props: IPreparationPortal) => { +export const PreparationPortal = (props: IPreparationPortal) => { const { withoutHeader, style, isDialog } = props; const { t } = useTranslation(["PreparationPortal", "Common"]); @@ -127,5 +127,3 @@ const PreparationPortal = (props: IPreparationPortal) => { ); }; - -export default PreparationPortal; From de9949ab5cb5af3801f338285269b701a22fc3e1 Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Mon, 24 Jun 2024 10:38:09 +0300 Subject: [PATCH 08/13] Client: add lazy loading for portal settings pages --- packages/client/src/pages/Bonus/index.js | 2 +- .../common/Branding/additionalResources.js | 48 ++- .../common/Branding/companyInfoSettings.js | 56 +-- .../categories/common/Branding/whitelabel.js | 86 ++-- .../common/Customization/dns-settings.js | 90 +++-- .../Customization/language-and-time-zone.js | 78 ++-- .../common/Customization/portal-renaming.js | 6 +- .../Customization/welcome-page-settings.js | 74 ++-- .../categories/common/branding.js | 8 +- .../categories/common/customization.js | 10 +- .../PortalSettings/categories/common/index.js | 2 +- .../data-import/GoogleWorkspace/index.js | 38 +- .../data-import/NextCloudWorkspace/index.js | 42 +- .../data-import/OnlyofficeWorkspace/index.js | 38 +- .../categories/data-import/index.js | 48 +-- .../backup/restore-backup/index.js | 52 +-- .../categories/data-management/index.js | 2 +- .../categories/delete-data/index.js | 2 +- .../JavascriptSDK/presets/DocSpace.js | 2 +- .../JavascriptSDK/presets/Editor.js | 2 +- .../JavascriptSDK/presets/FileSelector.js | 24 +- .../JavascriptSDK/presets/Manager.js | 24 +- .../JavascriptSDK/presets/RoomSelector.js | 2 +- .../JavascriptSDK/presets/SimpleRoom.js | 24 +- .../JavascriptSDK/presets/Viewer.js | 2 +- .../Webhooks/WebhookEventDetails/index.js | 2 +- .../Webhooks/WebhookHistory/index.js | 2 +- .../categories/developer-tools/index.js | 2 +- .../categories/integration/LDAP/index.js | 8 +- .../LDAP/sub-components/SettingsContainer.js | 34 +- .../LDAP/sub-components/SyncContainer.js | 54 +-- .../SingleSignOn/ProviderMetadata.js | 22 +- .../integration/SingleSignOn/SPSettings.js | 2 +- .../integration/SingleSignOn/index.js | 8 +- .../categories/integration/index.js | 26 +- .../categories/payments/index.js | 2 +- .../security/access-portal/adminMessage.js | 2 +- .../access-portal/bruteForceProtection.js | 48 +-- .../security/access-portal/index.js | 14 +- .../security/access-portal/ipSecurity.js | 2 +- .../access-portal/passwordStrength.js | 2 +- .../security/access-portal/sessionLifetime.js | 2 +- .../categories/security/access-portal/tfa.js | 2 +- .../security/access-portal/trustedMail.js | 2 +- .../categories/security/index.js | 2 +- .../categories/storage-management/Quotas.js | 8 +- .../categories/storage-management/index.js | 2 +- .../sub-components/QuotaPerRoom.js | 2 +- .../sub-components/QuotaPerUser.js | 2 +- packages/client/src/routes/portalSettings.js | 377 ++++++++++++------ 50 files changed, 785 insertions(+), 606 deletions(-) diff --git a/packages/client/src/pages/Bonus/index.js b/packages/client/src/pages/Bonus/index.js index 92d96e504f..a1532d3cd3 100644 --- a/packages/client/src/pages/Bonus/index.js +++ b/packages/client/src/pages/Bonus/index.js @@ -62,7 +62,7 @@ const Bonus = ({ standaloneInit, isInitPaymentPage, organizationName }) => { ); }; -export default inject(({ settingsStore, paymentStore }) => { +export const Component = inject(({ settingsStore, paymentStore }) => { const { standaloneInit, isInitPaymentPage } = paymentStore; const { organizationName } = settingsStore; return { diff --git a/packages/client/src/pages/PortalSettings/categories/common/Branding/additionalResources.js b/packages/client/src/pages/PortalSettings/categories/common/Branding/additionalResources.js index 68f3b686a6..fbecf873a3 100644 --- a/packages/client/src/pages/PortalSettings/categories/common/Branding/additionalResources.js +++ b/packages/client/src/pages/PortalSettings/categories/common/Branding/additionalResources.js @@ -92,7 +92,7 @@ const StyledComponent = styled.div` } `; -const AdditionalResources = (props) => { +const AdditionalResourcesComponent = (props) => { const { t, tReady, @@ -326,32 +326,36 @@ const AdditionalResources = (props) => { ); }; -export default inject(({ settingsStore, common, currentQuotaStore }) => { - const { setIsLoadedAdditionalResources, isLoadedAdditionalResources } = - common; +export const AdditionalResources = inject( + ({ settingsStore, common, currentQuotaStore }) => { + const { setIsLoadedAdditionalResources, isLoadedAdditionalResources } = + common; - const { - getAdditionalResources, + const { + getAdditionalResources, - additionalResourcesData, - additionalResourcesIsDefault, - deviceType, - } = settingsStore; + additionalResourcesData, + additionalResourcesIsDefault, + deviceType, + } = settingsStore; - const { isBrandingAndCustomizationAvailable } = currentQuotaStore; + const { isBrandingAndCustomizationAvailable } = currentQuotaStore; - return { - getAdditionalResources, + return { + getAdditionalResources, - additionalResourcesData, - additionalResourcesIsDefault, - setIsLoadedAdditionalResources, - isLoadedAdditionalResources, - isSettingPaid: isBrandingAndCustomizationAvailable, - deviceType, - }; -})( + additionalResourcesData, + additionalResourcesIsDefault, + setIsLoadedAdditionalResources, + isLoadedAdditionalResources, + isSettingPaid: isBrandingAndCustomizationAvailable, + deviceType, + }; + }, +)( withLoading( - withTranslation(["Settings", "Common"])(observer(AdditionalResources)), + withTranslation(["Settings", "Common"])( + observer(AdditionalResourcesComponent), + ), ), ); diff --git a/packages/client/src/pages/PortalSettings/categories/common/Branding/companyInfoSettings.js b/packages/client/src/pages/PortalSettings/categories/common/Branding/companyInfoSettings.js index 2faac6b5fe..336c5a956e 100644 --- a/packages/client/src/pages/PortalSettings/categories/common/Branding/companyInfoSettings.js +++ b/packages/client/src/pages/PortalSettings/categories/common/Branding/companyInfoSettings.js @@ -78,7 +78,7 @@ const StyledComponent = styled.div` } `; -const CompanyInfoSettings = (props) => { +const CompanyInfoSettingsComponent = (props) => { const { t, isSettingPaid, @@ -495,38 +495,42 @@ const CompanyInfoSettings = (props) => { ); }; -export default inject(({ settingsStore, common, currentQuotaStore }) => { - const { - setIsLoadedCompanyInfoSettingsData, - isLoadedCompanyInfoSettingsData, - } = common; +export const CompanyInfoSettings = inject( + ({ settingsStore, common, currentQuotaStore }) => { + const { + setIsLoadedCompanyInfoSettingsData, + isLoadedCompanyInfoSettingsData, + } = common; - const { - getCompanyInfoSettings, + const { + getCompanyInfoSettings, - companyInfoSettingsIsDefault, + companyInfoSettingsIsDefault, - companyInfoSettingsData, - buildVersionInfo, - deviceType, - } = settingsStore; + companyInfoSettingsData, + buildVersionInfo, + deviceType, + } = settingsStore; - const { isBrandingAndCustomizationAvailable } = currentQuotaStore; + const { isBrandingAndCustomizationAvailable } = currentQuotaStore; - return { - getCompanyInfoSettings, + return { + getCompanyInfoSettings, - companyInfoSettingsIsDefault, + companyInfoSettingsIsDefault, - companyInfoSettingsData, - setIsLoadedCompanyInfoSettingsData, - isLoadedCompanyInfoSettingsData, - buildVersionInfo, - isSettingPaid: isBrandingAndCustomizationAvailable, - deviceType, - }; -})( + companyInfoSettingsData, + setIsLoadedCompanyInfoSettingsData, + isLoadedCompanyInfoSettingsData, + buildVersionInfo, + isSettingPaid: isBrandingAndCustomizationAvailable, + deviceType, + }; + }, +)( withLoading( - withTranslation(["Settings", "Common"])(observer(CompanyInfoSettings)), + withTranslation(["Settings", "Common"])( + observer(CompanyInfoSettingsComponent), + ), ), ); diff --git a/packages/client/src/pages/PortalSettings/categories/common/Branding/whitelabel.js b/packages/client/src/pages/PortalSettings/categories/common/Branding/whitelabel.js index 468e0683d0..bc6753bfb6 100644 --- a/packages/client/src/pages/PortalSettings/categories/common/Branding/whitelabel.js +++ b/packages/client/src/pages/PortalSettings/categories/common/Branding/whitelabel.js @@ -53,7 +53,7 @@ import { import isEqual from "lodash/isEqual"; import { DeviceType, WhiteLabelLogoType } from "@docspace/shared/enums"; -const WhiteLabel = (props) => { +const WhiteLabelComponent = (props) => { const { t, isSettingPaid, @@ -543,45 +543,51 @@ const WhiteLabel = (props) => { ); }; -export default inject(({ settingsStore, common, currentQuotaStore }) => { - const { - setLogoText, - whiteLabelLogoText, - getWhiteLabelLogoText, - restoreWhiteLabelSettings, - initSettings, - saveWhiteLabelSettings, - logoUrlsWhiteLabel, - setLogoUrlsWhiteLabel, - defaultLogoTextWhiteLabel, - enableRestoreButton, - resetIsInit, - } = common; +export const WhiteLabel = inject( + ({ settingsStore, common, currentQuotaStore }) => { + const { + setLogoText, + whiteLabelLogoText, + getWhiteLabelLogoText, + restoreWhiteLabelSettings, + initSettings, + saveWhiteLabelSettings, + logoUrlsWhiteLabel, + setLogoUrlsWhiteLabel, + defaultLogoTextWhiteLabel, + enableRestoreButton, + resetIsInit, + } = common; - const { - whiteLabelLogoUrls: defaultWhiteLabelLogoUrls, - deviceType, - standalone, - } = settingsStore; - const { isBrandingAndCustomizationAvailable } = currentQuotaStore; + const { + whiteLabelLogoUrls: defaultWhiteLabelLogoUrls, + deviceType, + standalone, + } = settingsStore; + const { isBrandingAndCustomizationAvailable } = currentQuotaStore; - return { - setLogoText, - theme: settingsStore.theme, - logoText: whiteLabelLogoText, - getWhiteLabelLogoText, - saveWhiteLabelSettings, - restoreWhiteLabelSettings, - defaultWhiteLabelLogoUrls, - isSettingPaid: isBrandingAndCustomizationAvailable, - initSettings, - logoUrlsWhiteLabel, - setLogoUrlsWhiteLabel, - defaultLogoTextWhiteLabel, - enableRestoreButton, + return { + setLogoText, + theme: settingsStore.theme, + logoText: whiteLabelLogoText, + getWhiteLabelLogoText, + saveWhiteLabelSettings, + restoreWhiteLabelSettings, + defaultWhiteLabelLogoUrls, + isSettingPaid: isBrandingAndCustomizationAvailable, + initSettings, + logoUrlsWhiteLabel, + setLogoUrlsWhiteLabel, + defaultLogoTextWhiteLabel, + enableRestoreButton, - deviceType, - resetIsInit, - standalone, - }; -})(withTranslation(["Settings", "Profile", "Common"])(observer(WhiteLabel))); + deviceType, + resetIsInit, + standalone, + }; + }, +)( + withTranslation(["Settings", "Profile", "Common"])( + observer(WhiteLabelComponent), + ), +); diff --git a/packages/client/src/pages/PortalSettings/categories/common/Customization/dns-settings.js b/packages/client/src/pages/PortalSettings/categories/common/Customization/dns-settings.js index e3d09aa775..ad05a6effe 100644 --- a/packages/client/src/pages/PortalSettings/categories/common/Customization/dns-settings.js +++ b/packages/client/src/pages/PortalSettings/categories/common/Customization/dns-settings.js @@ -65,7 +65,7 @@ const buttonProps = { primary: true, }; let timerId = null; -const DNSSettings = (props) => { +const DNSSettingsComponent = (props) => { const { t, isMobileView, @@ -314,46 +314,52 @@ const DNSSettings = (props) => { ); }; -export default inject(({ settingsStore, common, currentQuotaStore }) => { - const { - helpLink, - currentColorScheme, - standalone, - dnsSettingsUrl, - currentDeviceType, - } = settingsStore; - const { - isLoaded, - setIsLoadedDNSSettings, - initSettings, - setIsLoaded, - dnsSettings, - setIsEnableDNS, - setDNSName, - saveDNSSettings, - isDefaultDNS, - } = common; +export const DNSSettings = inject( + ({ settingsStore, common, currentQuotaStore }) => { + const { + helpLink, + currentColorScheme, + standalone, + dnsSettingsUrl, + currentDeviceType, + } = settingsStore; + const { + isLoaded, + setIsLoadedDNSSettings, + initSettings, + setIsLoaded, + dnsSettings, + setIsEnableDNS, + setDNSName, + saveDNSSettings, + isDefaultDNS, + } = common; - const { isBrandingAndCustomizationAvailable } = currentQuotaStore; - const { customObj } = dnsSettings; - const { dnsName, enable } = customObj; + const { isBrandingAndCustomizationAvailable } = currentQuotaStore; + const { customObj } = dnsSettings; + const { dnsName, enable } = customObj; - return { - isDefaultDNS, - dnsName: dnsName || "", - enable, - setDNSName, - isLoaded, - setIsLoadedDNSSettings, - helpLink, - initSettings, - setIsLoaded, - isSettingPaid: isBrandingAndCustomizationAvailable, - currentColorScheme, - standalone, - setIsEnableDNS, - saveDNSSettings, - dnsSettingsUrl, - currentDeviceType, - }; -})(withLoading(withTranslation(["Settings", "Common"])(observer(DNSSettings)))); + return { + isDefaultDNS, + dnsName: dnsName || "", + enable, + setDNSName, + isLoaded, + setIsLoadedDNSSettings, + helpLink, + initSettings, + setIsLoaded, + isSettingPaid: isBrandingAndCustomizationAvailable, + currentColorScheme, + standalone, + setIsEnableDNS, + saveDNSSettings, + dnsSettingsUrl, + currentDeviceType, + }; + }, +)( + withLoading( + withTranslation(["Settings", "Common"])(observer(DNSSettingsComponent)), + ), +); diff --git a/packages/client/src/pages/PortalSettings/categories/common/Customization/language-and-time-zone.js b/packages/client/src/pages/PortalSettings/categories/common/Customization/language-and-time-zone.js index 10bb06e58f..d8604b570e 100644 --- a/packages/client/src/pages/PortalSettings/categories/common/Customization/language-and-time-zone.js +++ b/packages/client/src/pages/PortalSettings/categories/common/Customization/language-and-time-zone.js @@ -81,7 +81,7 @@ let timezoneDefaultFromSessionStorage = ""; const settingNames = ["language", "timezone"]; -const LanguageAndTimeZone = (props) => { +const LanguageAndTimeZoneComponent = (props) => { const { i18n, language, @@ -558,46 +558,50 @@ const LanguageAndTimeZone = (props) => { ); }; -export default inject(({ settingsStore, setup, common, userStore }) => { - const { - culture, - timezone, - timezones, - nameSchemaId, - greetingSettings, - cultures, - currentColorScheme, - languageAndTimeZoneSettingsUrl, - deviceType, - } = settingsStore; +export const LanguageAndTimeZoneSettings = inject( + ({ settingsStore, setup, common, userStore }) => { + const { + culture, + timezone, + timezones, + nameSchemaId, + greetingSettings, + cultures, + currentColorScheme, + languageAndTimeZoneSettingsUrl, + deviceType, + } = settingsStore; - const { user } = userStore; + const { user } = userStore; - const { setLanguageAndTime } = setup; - const { isLoaded, setIsLoadedLngTZSettings, initSettings, setIsLoaded } = - common; - return { - user, - portalLanguage: culture, - portalTimeZoneId: timezone, - language: culture, - rawTimezones: timezones, - greetingSettings, - nameSchemaId, - setLanguageAndTime, - isLoaded, - setIsLoadedLngTZSettings, - cultures, - initSettings, - setIsLoaded, - currentColorScheme, - languageAndTimeZoneSettingsUrl, - deviceType, - }; -})( + const { setLanguageAndTime } = setup; + const { isLoaded, setIsLoadedLngTZSettings, initSettings, setIsLoaded } = + common; + return { + user, + portalLanguage: culture, + portalTimeZoneId: timezone, + language: culture, + rawTimezones: timezones, + greetingSettings, + nameSchemaId, + setLanguageAndTime, + isLoaded, + setIsLoadedLngTZSettings, + cultures, + initSettings, + setIsLoaded, + currentColorScheme, + languageAndTimeZoneSettingsUrl, + deviceType, + }; + }, +)( withCultureNames( withLoading( - withTranslation(["Settings", "Common"])(observer(LanguageAndTimeZone)), + withTranslation(["Settings", "Common"])( + observer(LanguageAndTimeZoneComponent), + ), ), ), ); diff --git a/packages/client/src/pages/PortalSettings/categories/common/Customization/portal-renaming.js b/packages/client/src/pages/PortalSettings/categories/common/Customization/portal-renaming.js index 83a2355e21..828fe25510 100644 --- a/packages/client/src/pages/PortalSettings/categories/common/Customization/portal-renaming.js +++ b/packages/client/src/pages/PortalSettings/categories/common/Customization/portal-renaming.js @@ -44,7 +44,7 @@ import { Text } from "@docspace/shared/components/text"; import { Link } from "@docspace/shared/components/link"; import { PRODUCT_NAME } from "@docspace/shared/constants"; -const PortalRenaming = (props) => { +const PortalRenamingComponent = (props) => { const { t, setPortalRename, @@ -373,7 +373,7 @@ const PortalRenaming = (props) => { ); }; -export default inject(({ settingsStore, setup, common }) => { +export const PortalRenaming = inject(({ settingsStore, setup, common }) => { const { theme, tenantAlias, @@ -409,6 +409,6 @@ export default inject(({ settingsStore, setup, common }) => { }; })( withLoading( - withTranslation(["Settings", "Common"])(observer(PortalRenaming)), + withTranslation(["Settings", "Common"])(observer(PortalRenamingComponent)), ), ); diff --git a/packages/client/src/pages/PortalSettings/categories/common/Customization/welcome-page-settings.js b/packages/client/src/pages/PortalSettings/categories/common/Customization/welcome-page-settings.js index 74a199720d..57d8f20da9 100644 --- a/packages/client/src/pages/PortalSettings/categories/common/Customization/welcome-page-settings.js +++ b/packages/client/src/pages/PortalSettings/categories/common/Customization/welcome-page-settings.js @@ -47,7 +47,7 @@ let greetingTitleFromSessionStorage = ""; let greetingTitleDefaultFromSessionStorage = ""; const settingNames = ["greetingTitle"]; -const WelcomePageSettings = (props) => { +const WelcomePageSettingsComponent = (props) => { const { t, greetingSettings, @@ -376,41 +376,45 @@ const WelcomePageSettings = (props) => { ); }; -export default inject(({ settingsStore, setup, common }) => { - const { - greetingSettings, - organizationName, - theme, - currentColorScheme, - welcomePageSettingsUrl, - } = settingsStore; - const { setGreetingTitle, restoreGreetingTitle } = setup; - const { - isLoaded, - setIsLoadedWelcomePageSettings, - initSettings, - setIsLoaded, - greetingSettingsIsDefault, - getGreetingSettingsIsDefault, - } = common; +export const WelcomePageSettings = inject( + ({ settingsStore, setup, common }) => { + const { + greetingSettings, + organizationName, + theme, + currentColorScheme, + welcomePageSettingsUrl, + } = settingsStore; + const { setGreetingTitle, restoreGreetingTitle } = setup; + const { + isLoaded, + setIsLoadedWelcomePageSettings, + initSettings, + setIsLoaded, + greetingSettingsIsDefault, + getGreetingSettingsIsDefault, + } = common; - return { - theme, - greetingSettings, - organizationName, - setGreetingTitle, - restoreGreetingTitle, - isLoaded, - setIsLoadedWelcomePageSettings, - greetingSettingsIsDefault, - getGreetingSettingsIsDefault, - initSettings, - setIsLoaded, - currentColorScheme, - welcomePageSettingsUrl, - }; -})( + return { + theme, + greetingSettings, + organizationName, + setGreetingTitle, + restoreGreetingTitle, + isLoaded, + setIsLoadedWelcomePageSettings, + greetingSettingsIsDefault, + getGreetingSettingsIsDefault, + initSettings, + setIsLoaded, + currentColorScheme, + welcomePageSettingsUrl, + }; + }, +)( withLoading( - withTranslation(["Settings", "Common"])(observer(WelcomePageSettings)), + withTranslation(["Settings", "Common"])( + observer(WelcomePageSettingsComponent), + ), ), ); diff --git a/packages/client/src/pages/PortalSettings/categories/common/branding.js b/packages/client/src/pages/PortalSettings/categories/common/branding.js index 210af62ff9..8c04b25546 100644 --- a/packages/client/src/pages/PortalSettings/categories/common/branding.js +++ b/packages/client/src/pages/PortalSettings/categories/common/branding.js @@ -31,10 +31,10 @@ import { inject, observer } from "mobx-react"; import withLoading from "SRC_DIR/HOCs/withLoading"; import { setDocumentTitle } from "SRC_DIR/helpers/utils"; -import Whitelabel from "./Branding/whitelabel"; -import CompanyInfoSettings from "./Branding/companyInfoSettings"; +import { WhiteLabel } from "./Branding/whitelabel"; +import { CompanyInfoSettings } from "./Branding/companyInfoSettings"; import styled from "styled-components"; -import AdditionalResources from "./Branding/additionalResources"; +import { AdditionalResources } from "./Branding/additionalResources"; import { isManagement } from "@docspace/shared/utils/common"; import LoaderBrandingDescription from "./sub-components/loaderBrandingDescription"; @@ -119,7 +119,7 @@ const Branding = ({ return ( - + {showSettings && ( <>
diff --git a/packages/client/src/pages/PortalSettings/categories/common/customization.js b/packages/client/src/pages/PortalSettings/categories/common/customization.js index ddc6df0e20..39d8ad6fc2 100644 --- a/packages/client/src/pages/PortalSettings/categories/common/customization.js +++ b/packages/client/src/pages/PortalSettings/categories/common/customization.js @@ -28,10 +28,10 @@ import React, { useEffect, useState } from "react"; import { withTranslation } from "react-i18next"; import styled, { css } from "styled-components"; import { inject, observer } from "mobx-react"; -import LanguageAndTimeZone from "./Customization/language-and-time-zone"; -import WelcomePageSettings from "./Customization/welcome-page-settings"; -import PortalRenaming from "./Customization/portal-renaming"; -import DNSSettings from "./Customization/dns-settings"; +import { LanguageAndTimeZoneSettings } from "./Customization/language-and-time-zone"; +import { WelcomePageSettings } from "./Customization/welcome-page-settings"; +import { PortalRenaming } from "./Customization/portal-renaming"; +import { DNSSettings } from "./Customization/dns-settings"; import CustomizationNavbar from "./customization-navbar"; import { Base } from "@docspace/shared/themes"; import { setDocumentTitle } from "SRC_DIR/helpers/utils"; @@ -137,7 +137,7 @@ const Customization = (props) => { {t("Settings:CustomizationDescription")} )} - + diff --git a/packages/client/src/pages/PortalSettings/categories/common/index.js b/packages/client/src/pages/PortalSettings/categories/common/index.js index afda2978c2..97638e6591 100644 --- a/packages/client/src/pages/PortalSettings/categories/common/index.js +++ b/packages/client/src/pages/PortalSettings/categories/common/index.js @@ -125,7 +125,7 @@ const TabsCommon = (props) => { ); }; -export default inject(({ settingsStore, common }) => { +export const Component = inject(({ settingsStore, common }) => { const { isLoaded, setIsLoadedSubmenu, diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/index.js index de518248bd..35e715ac93 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/GoogleWorkspace/index.js @@ -269,20 +269,26 @@ const GoogleWorkspace = ({ ); }; -export default inject(({ setup, settingsStore, importAccountsStore }) => { - const { clearCheckedAccounts, getMigrationStatus, setUsers, filteredUsers } = - importAccountsStore; - const { viewAs, setViewAs } = setup; - const { currentDeviceType, organizationName } = settingsStore; +export const Component = inject( + ({ setup, settingsStore, importAccountsStore }) => { + const { + clearCheckedAccounts, + getMigrationStatus, + setUsers, + filteredUsers, + } = importAccountsStore; + const { viewAs, setViewAs } = setup; + const { currentDeviceType, organizationName } = settingsStore; - return { - clearCheckedAccounts, - viewAs, - setViewAs, - currentDeviceType, - getMigrationStatus, - setUsers, - filteredUsers, - organizationName, - }; -})(withTranslation(["Common, Settings"])(observer(GoogleWorkspace))); + return { + clearCheckedAccounts, + viewAs, + setViewAs, + currentDeviceType, + getMigrationStatus, + setUsers, + filteredUsers, + organizationName, + }; + }, +)(withTranslation(["Common, Settings"])(observer(GoogleWorkspace))); diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/NextCloudWorkspace/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/NextCloudWorkspace/index.js index 093257c697..29cdeae608 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/NextCloudWorkspace/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/NextCloudWorkspace/index.js @@ -175,25 +175,31 @@ const NextcloudWorkspace = (props) => { ); }; -export default inject(({ setup, settingsStore, importAccountsStore }) => { - const { clearCheckedAccounts, getMigrationStatus, setUsers, filteredUsers } = - importAccountsStore; - const { initSettings, viewAs, setViewAs } = setup; - const { currentDeviceType, organizationName } = settingsStore; +export const Component = inject( + ({ setup, settingsStore, importAccountsStore }) => { + const { + clearCheckedAccounts, + getMigrationStatus, + setUsers, + filteredUsers, + } = importAccountsStore; + const { initSettings, viewAs, setViewAs } = setup; + const { currentDeviceType, organizationName } = settingsStore; - return { - initSettings, - theme: settingsStore.theme, - clearCheckedAccounts, - viewAs, - setViewAs, - currentDeviceType, - getMigrationStatus, - setUsers, - filteredUsers, - organizationName, - }; -})( + return { + initSettings, + theme: settingsStore.theme, + clearCheckedAccounts, + viewAs, + setViewAs, + currentDeviceType, + getMigrationStatus, + setUsers, + filteredUsers, + organizationName, + }; + }, +)( withTranslation(["Common, SMTPSettings, Settings"])( observer(NextcloudWorkspace), ), diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/OnlyofficeWorkspace/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/OnlyofficeWorkspace/index.js index ff35f92e59..93f1661915 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/OnlyofficeWorkspace/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/OnlyofficeWorkspace/index.js @@ -267,20 +267,26 @@ const OnlyofficeWorkspace = ({ ); }; -export default inject(({ setup, settingsStore, importAccountsStore }) => { - const { clearCheckedAccounts, getMigrationStatus, setUsers, filteredUsers } = - importAccountsStore; - const { viewAs, setViewAs } = setup; - const { currentDeviceType, organizationName } = settingsStore; +export const Component = inject( + ({ setup, settingsStore, importAccountsStore }) => { + const { + clearCheckedAccounts, + getMigrationStatus, + setUsers, + filteredUsers, + } = importAccountsStore; + const { viewAs, setViewAs } = setup; + const { currentDeviceType, organizationName } = settingsStore; - return { - clearCheckedAccounts, - viewAs, - setViewAs, - currentDeviceType, - getMigrationStatus, - setUsers, - filteredUsers, - organizationName, - }; -})(withTranslation(["Common, Settings"])(observer(OnlyofficeWorkspace))); + return { + clearCheckedAccounts, + viewAs, + setViewAs, + currentDeviceType, + getMigrationStatus, + setUsers, + filteredUsers, + organizationName, + }; + }, +)(withTranslation(["Common, Settings"])(observer(OnlyofficeWorkspace))); diff --git a/packages/client/src/pages/PortalSettings/categories/data-import/index.js b/packages/client/src/pages/PortalSettings/categories/data-import/index.js index c1213ee2dc..f79af1ef31 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-import/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-import/index.js @@ -164,29 +164,31 @@ const DataImport = ({ ); }; -export default inject(({ authStore, settingsStore, importAccountsStore }) => { - const { - services, - setServices, - getMigrationList, - getMigrationStatus, - isMigrationInit, - setIsMigrationInit, - } = importAccountsStore; +export const Component = inject( + ({ authStore, settingsStore, importAccountsStore }) => { + const { + services, + setServices, + getMigrationList, + getMigrationStatus, + isMigrationInit, + setIsMigrationInit, + } = importAccountsStore; - const { setDocumentTitle } = authStore; + const { setDocumentTitle } = authStore; - const { organizationName, theme } = settingsStore; + const { organizationName, theme } = settingsStore; - return { - services, - setServices, - getMigrationList, - getMigrationStatus, - theme, - setDocumentTitle, - isMigrationInit, - setIsMigrationInit, - organizationName, - }; -})(withTranslation(["Settings"])(observer(DataImport))); + return { + services, + setServices, + getMigrationList, + getMigrationStatus, + theme, + setDocumentTitle, + isMigrationInit, + setIsMigrationInit, + organizationName, + }; + }, +)(withTranslation(["Settings"])(observer(DataImport))); diff --git a/packages/client/src/pages/PortalSettings/categories/data-management/backup/restore-backup/index.js b/packages/client/src/pages/PortalSettings/categories/data-management/backup/restore-backup/index.js index 300af2239f..31bd8ca125 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-management/backup/restore-backup/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-management/backup/restore-backup/index.js @@ -295,30 +295,32 @@ const RestoreBackup = (props) => { ); }; -export default inject(({ settingsStore, backup, currentQuotaStore }) => { - const { currentDeviceType, standalone } = settingsStore; - const { isRestoreAndAutoBackupAvailable } = currentQuotaStore; - const { - getProgress, - clearProgressInterval, - setStorageRegions, - setThirdPartyStorage, - setConnectedThirdPartyAccount, - setRestoreResource, - } = backup; +export const Component = inject( + ({ settingsStore, backup, currentQuotaStore }) => { + const { currentDeviceType, standalone } = settingsStore; + const { isRestoreAndAutoBackupAvailable } = currentQuotaStore; + const { + getProgress, + clearProgressInterval, + setStorageRegions, + setThirdPartyStorage, + setConnectedThirdPartyAccount, + setRestoreResource, + } = backup; - const buttonSize = - currentDeviceType !== DeviceType.desktop ? "normal" : "small"; + const buttonSize = + currentDeviceType !== DeviceType.desktop ? "normal" : "small"; - return { - standalone, - isEnableRestore: isRestoreAndAutoBackupAvailable, - setStorageRegions, - setThirdPartyStorage, - buttonSize, - setConnectedThirdPartyAccount, - clearProgressInterval, - getProgress, - setRestoreResource, - }; -})(withTranslation(["Settings", "Common"])(observer(RestoreBackup))); + return { + standalone, + isEnableRestore: isRestoreAndAutoBackupAvailable, + setStorageRegions, + setThirdPartyStorage, + buttonSize, + setConnectedThirdPartyAccount, + clearProgressInterval, + getProgress, + setRestoreResource, + }; + }, +)(withTranslation(["Settings", "Common"])(observer(RestoreBackup))); diff --git a/packages/client/src/pages/PortalSettings/categories/data-management/index.js b/packages/client/src/pages/PortalSettings/categories/data-management/index.js index 6eb10b83de..e56bb09a9d 100644 --- a/packages/client/src/pages/PortalSettings/categories/data-management/index.js +++ b/packages/client/src/pages/PortalSettings/categories/data-management/index.js @@ -149,7 +149,7 @@ const DataManagementWrapper = (props) => { ); }; -export default inject( +export const Component = inject( ({ settingsStore, setup, backup, currentTariffStatusStore }) => { const { initSettings } = setup; diff --git a/packages/client/src/pages/PortalSettings/categories/delete-data/index.js b/packages/client/src/pages/PortalSettings/categories/delete-data/index.js index 2eb7509112..e4eb725166 100644 --- a/packages/client/src/pages/PortalSettings/categories/delete-data/index.js +++ b/packages/client/src/pages/PortalSettings/categories/delete-data/index.js @@ -89,7 +89,7 @@ const DeleteData = (props) => { ); }; -export default inject(({ currentTariffStatusStore }) => { +export const Component = inject(({ currentTariffStatusStore }) => { const { isNotPaidPeriod } = currentTariffStatusStore; return { diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/DocSpace.js b/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/DocSpace.js index 0f437e50a2..e1e92912cd 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/DocSpace.js +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/DocSpace.js @@ -156,7 +156,7 @@ const DocSpace = (props) => { ); }; -export default inject(({ authStore, settingsStore }) => { +export const Component = inject(({ authStore, settingsStore }) => { const { setDocumentTitle } = authStore; const { theme } = settingsStore; diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Editor.js b/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Editor.js index 02eb0491b6..f41caa6c37 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Editor.js +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Editor.js @@ -228,7 +228,7 @@ const Editor = (props) => { ); }; -export default inject(({ authStore, settingsStore, filesStore }) => { +export const Component = inject(({ authStore, settingsStore, filesStore }) => { const { setDocumentTitle } = authStore; const { theme } = settingsStore; const { getFilePrimaryLink } = filesStore; diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/FileSelector.js b/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/FileSelector.js index bee80814c7..5667889162 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/FileSelector.js +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/FileSelector.js @@ -440,18 +440,20 @@ const FileSelector = (props) => { ); }; -export default inject(({ authStore, settingsStore, publicRoomStore }) => { - const { setDocumentTitle } = authStore; - const { theme, organizationName } = settingsStore; - const { fetchExternalLinks } = publicRoomStore; +export const Component = inject( + ({ authStore, settingsStore, publicRoomStore }) => { + const { setDocumentTitle } = authStore; + const { theme, organizationName } = settingsStore; + const { fetchExternalLinks } = publicRoomStore; - return { - theme, - setDocumentTitle, - fetchExternalLinks, - organizationName, - }; -})( + return { + theme, + setDocumentTitle, + fetchExternalLinks, + organizationName, + }; + }, +)( withTranslation([ "JavascriptSdk", "Files", diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Manager.js b/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Manager.js index 2a00fe08f1..2aa5b171fa 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Manager.js +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Manager.js @@ -655,18 +655,20 @@ const Manager = (props) => { ); }; -export default inject(({ authStore, settingsStore, publicRoomStore }) => { - const { setDocumentTitle } = authStore; - const { theme, currentColorScheme } = settingsStore; - const { fetchExternalLinks } = publicRoomStore; +export const Component = inject( + ({ authStore, settingsStore, publicRoomStore }) => { + const { setDocumentTitle } = authStore; + const { theme, currentColorScheme } = settingsStore; + const { fetchExternalLinks } = publicRoomStore; - return { - theme, - setDocumentTitle, - fetchExternalLinks, - currentColorScheme, - }; -})( + return { + theme, + setDocumentTitle, + fetchExternalLinks, + currentColorScheme, + }; + }, +)( withTranslation([ "JavascriptSdk", "Files", diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/RoomSelector.js b/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/RoomSelector.js index 411c0ae98d..8a28f4d42d 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/RoomSelector.js +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/RoomSelector.js @@ -253,7 +253,7 @@ const RoomSelector = (props) => { ); }; -export default inject(({ authStore, settingsStore }) => { +export const Component = inject(({ authStore, settingsStore }) => { const { setDocumentTitle } = authStore; const { theme } = settingsStore; diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/SimpleRoom.js b/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/SimpleRoom.js index 89a7a5a66f..84be410eef 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/SimpleRoom.js +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/SimpleRoom.js @@ -385,18 +385,20 @@ const SimpleRoom = (props) => { ); }; -export default inject(({ authStore, settingsStore, publicRoomStore }) => { - const { setDocumentTitle } = authStore; - const { theme, currentColorScheme } = settingsStore; - const { fetchExternalLinks } = publicRoomStore; +export const Component = inject( + ({ authStore, settingsStore, publicRoomStore }) => { + const { setDocumentTitle } = authStore; + const { theme, currentColorScheme } = settingsStore; + const { fetchExternalLinks } = publicRoomStore; - return { - theme, - setDocumentTitle, - fetchExternalLinks, - currentColorScheme, - }; -})( + return { + theme, + setDocumentTitle, + fetchExternalLinks, + currentColorScheme, + }; + }, +)( withTranslation([ "JavascriptSdk", "Files", diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Viewer.js b/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Viewer.js index 65b6915d98..053efb613e 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Viewer.js +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Viewer.js @@ -270,7 +270,7 @@ const Viewer = (props) => { ); }; -export default inject(({ authStore, settingsStore, filesStore }) => { +export const Component = inject(({ authStore, settingsStore, filesStore }) => { const { setDocumentTitle } = authStore; const { theme } = settingsStore; const { getFilePrimaryLink } = filesStore; diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookEventDetails/index.js b/packages/client/src/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookEventDetails/index.js index d534ca70ce..565d624222 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookEventDetails/index.js +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookEventDetails/index.js @@ -76,7 +76,7 @@ const WebhookEventDetails = (props) => { ); }; -export default inject(({ webhooksStore }) => { +export const Component = inject(({ webhooksStore }) => { const { fetchEventData, fetchConfigName, configName } = webhooksStore; return { fetchEventData, fetchConfigName, configName }; diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookHistory/index.js b/packages/client/src/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookHistory/index.js index 9fb21300c6..03bcf61f01 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookHistory/index.js +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookHistory/index.js @@ -125,7 +125,7 @@ const WebhookHistory = (props) => { ); }; -export default inject(({ webhooksStore }) => { +export const Component = inject(({ webhooksStore }) => { const { historyItems, fetchHistoryItems, diff --git a/packages/client/src/pages/PortalSettings/categories/developer-tools/index.js b/packages/client/src/pages/PortalSettings/categories/developer-tools/index.js index 8c68550172..6a35b866ff 100644 --- a/packages/client/src/pages/PortalSettings/categories/developer-tools/index.js +++ b/packages/client/src/pages/PortalSettings/categories/developer-tools/index.js @@ -150,7 +150,7 @@ const DeveloperToolsWrapper = (props) => { ); }; -export default inject(({ setup, settingsStore }) => { +export const Component = inject(({ setup, settingsStore }) => { const { initSettings } = setup; return { diff --git a/packages/client/src/pages/PortalSettings/categories/integration/LDAP/index.js b/packages/client/src/pages/PortalSettings/categories/integration/LDAP/index.js index 5eb0984930..b8f8b2ce7c 100644 --- a/packages/client/src/pages/PortalSettings/categories/integration/LDAP/index.js +++ b/packages/client/src/pages/PortalSettings/categories/integration/LDAP/index.js @@ -38,9 +38,9 @@ import StyledLdapPage from "./styled-components/StyledLdapPage"; import StyledSettingsSeparator from "SRC_DIR/pages/PortalSettings/StyledSettingsSeparator"; import ToggleLDAP from "./sub-components/ToggleLDAP"; -import SyncContainer from "./sub-components/SyncContainer"; +import { SyncContainerSection } from "./sub-components/SyncContainer"; import LdapMobileView from "./sub-components/LdapMobileView"; -import SettingsContainer from "./sub-components/SettingsContainer"; +import { SettingsContainerSection } from "./sub-components/SettingsContainer"; import LdapLoader from "./sub-components/LdapLoader"; import { setDocumentTitle } from "SRC_DIR/helpers/utils"; @@ -102,11 +102,11 @@ const LDAP = ({ <> - + - + )} diff --git a/packages/client/src/pages/PortalSettings/categories/integration/LDAP/sub-components/SettingsContainer.js b/packages/client/src/pages/PortalSettings/categories/integration/LDAP/sub-components/SettingsContainer.js index 6c99ba89fb..054f8dda5a 100644 --- a/packages/client/src/pages/PortalSettings/categories/integration/LDAP/sub-components/SettingsContainer.js +++ b/packages/client/src/pages/PortalSettings/categories/integration/LDAP/sub-components/SettingsContainer.js @@ -130,21 +130,23 @@ const SettingsContainer = ({ return <>{renderBody()}; }; -export default inject(({ settingsStore, currentQuotaStore, ldapStore }) => { - const { isLdapAvailable } = currentQuotaStore; - const { currentDeviceType, theme } = settingsStore; - const { isSettingsShown, isCertificateDialogVisible, isLoaded, load } = - ldapStore; +export const SettingsContainerSection = inject( + ({ settingsStore, currentQuotaStore, ldapStore }) => { + const { isLdapAvailable } = currentQuotaStore; + const { currentDeviceType, theme } = settingsStore; + const { isSettingsShown, isCertificateDialogVisible, isLoaded, load } = + ldapStore; - const isMobileView = currentDeviceType === DeviceType.mobile; + const isMobileView = currentDeviceType === DeviceType.mobile; - return { - isLdapAvailable, - isSettingsShown, - isMobileView, - theme, - isCertificateDialogVisible, - isLoaded, - load, - }; -})(observer(SettingsContainer)); + return { + isLdapAvailable, + isSettingsShown, + isMobileView, + theme, + isCertificateDialogVisible, + isLoaded, + load, + }; + }, +)(observer(SettingsContainer)); diff --git a/packages/client/src/pages/PortalSettings/categories/integration/LDAP/sub-components/SyncContainer.js b/packages/client/src/pages/PortalSettings/categories/integration/LDAP/sub-components/SyncContainer.js index 2140600502..17d707cdb2 100644 --- a/packages/client/src/pages/PortalSettings/categories/integration/LDAP/sub-components/SyncContainer.js +++ b/packages/client/src/pages/PortalSettings/categories/integration/LDAP/sub-components/SyncContainer.js @@ -180,34 +180,36 @@ const SyncContainer = ({ return <>{renderBody()}; }; -export default inject(({ currentQuotaStore, settingsStore, ldapStore }) => { - const { isLdapAvailable } = currentQuotaStore; - const { currentDeviceType, theme } = settingsStore; - const { - syncLdap, - saveCronLdap, - onChangeCron, - cron, - serverCron, +export const SyncContainerSection = inject( + ({ currentQuotaStore, settingsStore, ldapStore }) => { + const { isLdapAvailable } = currentQuotaStore; + const { currentDeviceType, theme } = settingsStore; + const { + syncLdap, + saveCronLdap, + onChangeCron, + cron, + serverCron, - isUIDisabled, + isUIDisabled, - serverSettings, - } = ldapStore; + serverSettings, + } = ldapStore; - const isMobileView = currentDeviceType === DeviceType.mobile; + const isMobileView = currentDeviceType === DeviceType.mobile; - return { - isMobileView, - syncLdap, - saveCronLdap, - onChangeCron, - cron, - serverCron, - theme, + return { + isMobileView, + syncLdap, + saveCronLdap, + onChangeCron, + cron, + serverCron, + theme, - isLdapEnabledOnServer: serverSettings.EnableLdapAuthentication, - isUIDisabled, - isLdapAvailable, - }; -})(observer(SyncContainer)); + isLdapEnabledOnServer: serverSettings.EnableLdapAuthentication, + isUIDisabled, + isLdapAvailable, + }; + }, +)(observer(SyncContainer)); diff --git a/packages/client/src/pages/PortalSettings/categories/integration/SingleSignOn/ProviderMetadata.js b/packages/client/src/pages/PortalSettings/categories/integration/SingleSignOn/ProviderMetadata.js index cb75078bed..e7040701c0 100644 --- a/packages/client/src/pages/PortalSettings/categories/integration/SingleSignOn/ProviderMetadata.js +++ b/packages/client/src/pages/PortalSettings/categories/integration/SingleSignOn/ProviderMetadata.js @@ -122,14 +122,16 @@ const ProviderMetadata = (props) => { ); }; -export default inject(({ ssoStore, settingsStore, currentQuotaStore }) => { - const { downloadMetadata } = ssoStore; - const { currentDeviceType } = settingsStore; - const { isSSOAvailable } = currentQuotaStore; +export const ProviderMetadataSection = inject( + ({ ssoStore, settingsStore, currentQuotaStore }) => { + const { downloadMetadata } = ssoStore; + const { currentDeviceType } = settingsStore; + const { isSSOAvailable } = currentQuotaStore; - return { - downloadMetadata, - currentDeviceType, - isSSOAvailable, - }; -})(observer(ProviderMetadata)); + return { + downloadMetadata, + currentDeviceType, + isSSOAvailable, + }; + }, +)(observer(ProviderMetadata)); diff --git a/packages/client/src/pages/PortalSettings/categories/integration/SingleSignOn/SPSettings.js b/packages/client/src/pages/PortalSettings/categories/integration/SingleSignOn/SPSettings.js index b4bec295f8..27b2030046 100644 --- a/packages/client/src/pages/PortalSettings/categories/integration/SingleSignOn/SPSettings.js +++ b/packages/client/src/pages/PortalSettings/categories/integration/SingleSignOn/SPSettings.js @@ -68,7 +68,7 @@ const SPSettings = ({ currentDeviceType }) => { ); }; -export default inject(({ settingsStore }) => { +export const SPSettingsSection = inject(({ settingsStore }) => { const { currentDeviceType } = settingsStore; return { diff --git a/packages/client/src/pages/PortalSettings/categories/integration/SingleSignOn/index.js b/packages/client/src/pages/PortalSettings/categories/integration/SingleSignOn/index.js index ed4073317e..1aeff9e0ec 100644 --- a/packages/client/src/pages/PortalSettings/categories/integration/SingleSignOn/index.js +++ b/packages/client/src/pages/PortalSettings/categories/integration/SingleSignOn/index.js @@ -32,8 +32,8 @@ import { Box } from "@docspace/shared/components/box"; import { Text } from "@docspace/shared/components/text"; import HideButton from "./sub-components/HideButton"; -import SPSettings from "./SPSettings"; -import ProviderMetadata from "./ProviderMetadata"; +import { SPSettingsSection } from "./SPSettings"; +import { ProviderMetadataSection } from "./ProviderMetadata"; import StyledSsoPage from "./styled-containers/StyledSsoPageContainer"; import StyledSettingsSeparator from "SRC_DIR/pages/PortalSettings/StyledSettingsSeparator"; import ToggleSSO from "./sub-components/ToggleSSO"; @@ -93,7 +93,7 @@ const SingleSignOn = (props) => { isDisabled={!isSSOAvailable} /> - + { /> - + )} diff --git a/packages/client/src/pages/PortalSettings/categories/integration/index.js b/packages/client/src/pages/PortalSettings/categories/integration/index.js index 820efd7d22..c471015a9c 100644 --- a/packages/client/src/pages/PortalSettings/categories/integration/index.js +++ b/packages/client/src/pages/PortalSettings/categories/integration/index.js @@ -147,20 +147,22 @@ const IntegrationWrapper = (props) => { ); }; -export default inject(({ settingsStore, ssoStore, currentQuotaStore }) => { - const { standalone, enablePlugins, currentDeviceType } = settingsStore; - const { load: toDefault } = ssoStore; +export const Component = inject( + ({ settingsStore, ssoStore, currentQuotaStore }) => { + const { standalone, enablePlugins, currentDeviceType } = settingsStore; + const { load: toDefault } = ssoStore; - const { isSSOAvailable } = currentQuotaStore; + const { isSSOAvailable } = currentQuotaStore; - return { - toDefault, - isSSOAvailable, - standalone, - currentDeviceType, - enablePlugins, - }; -})( + return { + toDefault, + isSSOAvailable, + standalone, + currentDeviceType, + enablePlugins, + }; + }, +)( withTranslation([ "Settings", "SingleSignOn", diff --git a/packages/client/src/pages/PortalSettings/categories/payments/index.js b/packages/client/src/pages/PortalSettings/categories/payments/index.js index 9a5ac65ca0..ccd15e3140 100644 --- a/packages/client/src/pages/PortalSettings/categories/payments/index.js +++ b/packages/client/src/pages/PortalSettings/categories/payments/index.js @@ -36,7 +36,7 @@ const PaymentsPage = (props) => { return standalone ? : ; }; -export default inject(({ settingsStore }) => { +export const Component = inject(({ settingsStore }) => { const { standalone } = settingsStore; return { diff --git a/packages/client/src/pages/PortalSettings/categories/security/access-portal/adminMessage.js b/packages/client/src/pages/PortalSettings/categories/security/access-portal/adminMessage.js index a58acfdb02..143437cc1c 100644 --- a/packages/client/src/pages/PortalSettings/categories/security/access-portal/adminMessage.js +++ b/packages/client/src/pages/PortalSettings/categories/security/access-portal/adminMessage.js @@ -233,7 +233,7 @@ const AdminMessage = (props) => { ); }; -export default inject(({ settingsStore, setup }) => { +export const AdminMessageSection = inject(({ settingsStore, setup }) => { const { enableAdmMess, setMessageSettings, diff --git a/packages/client/src/pages/PortalSettings/categories/security/access-portal/bruteForceProtection.js b/packages/client/src/pages/PortalSettings/categories/security/access-portal/bruteForceProtection.js index dcf00b7cfa..619e7b12de 100644 --- a/packages/client/src/pages/PortalSettings/categories/security/access-portal/bruteForceProtection.js +++ b/packages/client/src/pages/PortalSettings/categories/security/access-portal/bruteForceProtection.js @@ -338,30 +338,32 @@ const BruteForceProtection = (props) => { ); }; -export default inject(({ settingsStore, setup }) => { - const { - numberAttempt, - blockingTime, - checkPeriod, +export const BruteForceProtectionSection = inject( + ({ settingsStore, setup }) => { + const { + numberAttempt, + blockingTime, + checkPeriod, - getBruteForceProtection, - bruteForceProtectionUrl, - currentDeviceType, - currentColorScheme, - } = settingsStore; + getBruteForceProtection, + bruteForceProtectionUrl, + currentDeviceType, + currentColorScheme, + } = settingsStore; - const { initSettings, isInit } = setup; + const { initSettings, isInit } = setup; - return { - numberAttempt, - blockingTime, - checkPeriod, + return { + numberAttempt, + blockingTime, + checkPeriod, - getBruteForceProtection, - initSettings, - isInit, - bruteForceProtectionUrl, - currentDeviceType, - currentColorScheme, - }; -})(withTranslation(["Settings", "Common"])(observer(BruteForceProtection))); + getBruteForceProtection, + initSettings, + isInit, + bruteForceProtectionUrl, + currentDeviceType, + currentColorScheme, + }; + }, +)(withTranslation(["Settings", "Common"])(observer(BruteForceProtection))); diff --git a/packages/client/src/pages/PortalSettings/categories/security/access-portal/index.js b/packages/client/src/pages/PortalSettings/categories/security/access-portal/index.js index 5e52a30236..a45314ac85 100644 --- a/packages/client/src/pages/PortalSettings/categories/security/access-portal/index.js +++ b/packages/client/src/pages/PortalSettings/categories/security/access-portal/index.js @@ -29,13 +29,13 @@ import { Trans, withTranslation } from "react-i18next"; import { Text } from "@docspace/shared/components/text"; import { setDocumentTitle } from "SRC_DIR/helpers/utils"; import { MainContainer } from "../StyledSecurity"; -import TfaSection from "./tfa"; -import PasswordStrengthSection from "./passwordStrength"; -import TrustedMailSection from "./trustedMail"; -import IpSecuritySection from "./ipSecurity"; -import AdminMessageSection from "./adminMessage"; -import SessionLifetimeSection from "./sessionLifetime"; -import BruteForceProtectionSection from "./bruteForceProtection"; +import { TfaSection } from "./tfa"; +import { PasswordStrengthSection } from "./passwordStrength"; +import { TrustedMailSection } from "./trustedMail"; +import { IpSecuritySection } from "./ipSecurity"; +import { AdminMessageSection } from "./adminMessage"; +import { SessionLifetimeSection } from "./sessionLifetime"; +import { BruteForceProtectionSection } from "./bruteForceProtection"; import MobileView from "./mobileView"; import StyledSettingsSeparator from "SRC_DIR/pages/PortalSettings/StyledSettingsSeparator"; import { size } from "@docspace/shared/utils"; diff --git a/packages/client/src/pages/PortalSettings/categories/security/access-portal/ipSecurity.js b/packages/client/src/pages/PortalSettings/categories/security/access-portal/ipSecurity.js index 5229698de1..05d2211035 100644 --- a/packages/client/src/pages/PortalSettings/categories/security/access-portal/ipSecurity.js +++ b/packages/client/src/pages/PortalSettings/categories/security/access-portal/ipSecurity.js @@ -319,7 +319,7 @@ const IpSecurity = (props) => { ); }; -export default inject(({ settingsStore, setup }) => { +export const IpSecuritySection = inject(({ settingsStore, setup }) => { const { ipRestrictionEnable, setIpRestrictionsEnable, diff --git a/packages/client/src/pages/PortalSettings/categories/security/access-portal/passwordStrength.js b/packages/client/src/pages/PortalSettings/categories/security/access-portal/passwordStrength.js index f7341f7413..fec90d0641 100644 --- a/packages/client/src/pages/PortalSettings/categories/security/access-portal/passwordStrength.js +++ b/packages/client/src/pages/PortalSettings/categories/security/access-portal/passwordStrength.js @@ -315,7 +315,7 @@ const PasswordStrength = (props) => { ); }; -export default inject(({ settingsStore, setup }) => { +export const PasswordStrengthSection = inject(({ settingsStore, setup }) => { const { setPortalPasswordSettings, passwordSettings, diff --git a/packages/client/src/pages/PortalSettings/categories/security/access-portal/sessionLifetime.js b/packages/client/src/pages/PortalSettings/categories/security/access-portal/sessionLifetime.js index c3941554f0..b7b8eeebd7 100644 --- a/packages/client/src/pages/PortalSettings/categories/security/access-portal/sessionLifetime.js +++ b/packages/client/src/pages/PortalSettings/categories/security/access-portal/sessionLifetime.js @@ -305,7 +305,7 @@ const SessionLifetime = (props) => { ); }; -export default inject(({ settingsStore, setup }) => { +export const SessionLifetimeSection = inject(({ settingsStore, setup }) => { const { sessionLifetime, enabledSessionLifetime, diff --git a/packages/client/src/pages/PortalSettings/categories/security/access-portal/tfa.js b/packages/client/src/pages/PortalSettings/categories/security/access-portal/tfa.js index 0bbb8688ca..3f88c0ce23 100644 --- a/packages/client/src/pages/PortalSettings/categories/security/access-portal/tfa.js +++ b/packages/client/src/pages/PortalSettings/categories/security/access-portal/tfa.js @@ -237,7 +237,7 @@ const TwoFactorAuth = (props) => { ); }; -export default inject(({ settingsStore, setup, tfaStore }) => { +export const TfaSection = inject(({ settingsStore, setup, tfaStore }) => { const { setTfaSettings, diff --git a/packages/client/src/pages/PortalSettings/categories/security/access-portal/trustedMail.js b/packages/client/src/pages/PortalSettings/categories/security/access-portal/trustedMail.js index 68a268f7a9..1151c1183f 100644 --- a/packages/client/src/pages/PortalSettings/categories/security/access-portal/trustedMail.js +++ b/packages/client/src/pages/PortalSettings/categories/security/access-portal/trustedMail.js @@ -292,7 +292,7 @@ const TrustedMail = (props) => { ); }; -export default inject(({ settingsStore }) => { +export const TrustedMailSection = inject(({ settingsStore }) => { const { trustedDomainsType, trustedDomains, diff --git a/packages/client/src/pages/PortalSettings/categories/security/index.js b/packages/client/src/pages/PortalSettings/categories/security/index.js index 457f3da445..cc4801679b 100644 --- a/packages/client/src/pages/PortalSettings/categories/security/index.js +++ b/packages/client/src/pages/PortalSettings/categories/security/index.js @@ -120,7 +120,7 @@ const SecurityWrapper = (props) => { ); }; -export default inject(({ settingsStore, setup }) => { +export const Component = inject(({ settingsStore, setup }) => { const { initSettings, resetIsInit } = setup; return { diff --git a/packages/client/src/pages/PortalSettings/categories/storage-management/Quotas.js b/packages/client/src/pages/PortalSettings/categories/storage-management/Quotas.js index d7ee2a50fc..3e18d9b91e 100644 --- a/packages/client/src/pages/PortalSettings/categories/storage-management/Quotas.js +++ b/packages/client/src/pages/PortalSettings/categories/storage-management/Quotas.js @@ -34,8 +34,8 @@ import { Badge } from "@docspace/shared/components/badge"; import { ColorTheme, ThemeId } from "@docspace/shared/components/color-theme"; import { StyledBaseQuotaComponent, StyledMainTitle } from "./StyledComponent"; -import QuotaPerRoomComponent from "./sub-components/QuotaPerRoom"; -import QuotaPerUserComponent from "./sub-components/QuotaPerUser"; +import { QuotaPerRoomComponentSection } from "./sub-components/QuotaPerRoom"; +import { QuotaPerUserComponentSection } from "./sub-components/QuotaPerUser"; import MobileQuotasComponent from "./sub-components/MobileQuotas"; const helpLink = @@ -47,8 +47,8 @@ const QuotaPerItemsComponent = ({ isStatisticsAvailable }) => { return ( <> - - + + ); }; diff --git a/packages/client/src/pages/PortalSettings/categories/storage-management/index.js b/packages/client/src/pages/PortalSettings/categories/storage-management/index.js index 14d249efa4..57385d78fd 100644 --- a/packages/client/src/pages/PortalSettings/categories/storage-management/index.js +++ b/packages/client/src/pages/PortalSettings/categories/storage-management/index.js @@ -75,7 +75,7 @@ const StorageManagement = ({ ); }; -export default inject(({ authStore, storageManagement }) => { +export const Component = inject(({ authStore, storageManagement }) => { const { language } = authStore; const { init, isInit, clearIntervalCheckRecalculate } = storageManagement; return { diff --git a/packages/client/src/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerRoom.js b/packages/client/src/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerRoom.js index 5b5e0d684a..5f94d18aaf 100644 --- a/packages/client/src/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerRoom.js +++ b/packages/client/src/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerRoom.js @@ -49,7 +49,7 @@ const QuotaPerRoomComponent = (props) => { ); }; -export default inject(({ currentQuotaStore }) => { +export const QuotaPerRoomComponentSection = inject(({ currentQuotaStore }) => { const { setRoomQuota, defaultRoomsQuota, isDefaultRoomsQuotaSet } = currentQuotaStore; diff --git a/packages/client/src/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerUser.js b/packages/client/src/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerUser.js index f7918657d3..41d6ee425a 100644 --- a/packages/client/src/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerUser.js +++ b/packages/client/src/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerUser.js @@ -51,7 +51,7 @@ const QuotaPerUserComponent = (props) => { ); }; -export default inject(({ currentQuotaStore }) => { +export const QuotaPerUserComponentSection = inject(({ currentQuotaStore }) => { const { setUserQuota, defaultUsersQuota, isDefaultUsersQuotaSet } = currentQuotaStore; diff --git a/packages/client/src/routes/portalSettings.js b/packages/client/src/routes/portalSettings.js index 3a916e619c..81838cccda 100644 --- a/packages/client/src/routes/portalSettings.js +++ b/packages/client/src/routes/portalSettings.js @@ -28,59 +28,6 @@ import { Navigate } from "react-router-dom"; import Error404 from "@docspace/shared/components/errors/Error404"; -import CustomizationSettings from "SRC_DIR/pages/PortalSettings/categories/common"; -import LanguageAndTimeZoneSettings from "SRC_DIR/pages/PortalSettings/categories/common/Customization/language-and-time-zone"; -import WelcomePageSettings from "SRC_DIR/pages/PortalSettings/categories/common/Customization/welcome-page-settings"; -import DNSSettings from "SRC_DIR/pages/PortalSettings/categories/common/Customization/dns-settings"; -import PortalRenaming from "SRC_DIR/pages/PortalSettings/categories/common/Customization/portal-renaming"; -import WhiteLabel from "SRC_DIR/pages/PortalSettings/categories/common/Branding/whitelabel"; -import CompanyInfoSettings from "SRC_DIR/pages/PortalSettings/categories/common/Branding/companyInfoSettings"; -import AdditionalResources from "SRC_DIR/pages/PortalSettings/categories/common/Branding/additionalResources"; - -import SecuritySettings from "SRC_DIR/pages/PortalSettings/categories/security"; -import TfaPage from "SRC_DIR/pages/PortalSettings/categories/security/access-portal/tfa"; -import PasswordStrengthPage from "SRC_DIR/pages/PortalSettings/categories/security/access-portal/passwordStrength"; -import TrustedMailPage from "SRC_DIR/pages/PortalSettings/categories/security/access-portal/trustedMail"; -import IpSecurityPage from "SRC_DIR/pages/PortalSettings/categories/security/access-portal/ipSecurity"; -import BruteForceProtectionPage from "SRC_DIR/pages/PortalSettings/categories/security/access-portal/bruteForceProtection"; -import AdminMessagePage from "SRC_DIR/pages/PortalSettings/categories/security/access-portal/adminMessage"; -import SessionLifetimePage from "SRC_DIR/pages/PortalSettings/categories/security/access-portal/sessionLifetime"; - -import Integration from "SRC_DIR/pages/PortalSettings/categories/integration"; -import SPSettings from "SRC_DIR/pages/PortalSettings/categories/integration/SingleSignOn/SPSettings"; -import SPMetadata from "SRC_DIR/pages/PortalSettings/categories/integration/SingleSignOn/ProviderMetadata"; -import SettingsContainer from "SRC_DIR/pages/PortalSettings/categories/integration/LDAP/sub-components/SettingsContainer"; -import SyncContainer from "SRC_DIR/pages/PortalSettings/categories/integration/LDAP/sub-components/SyncContainer"; - -import Statistics from "SRC_DIR/pages/PortalSettings/categories/storage-management"; -import QuotaPerRoom from "SRC_DIR/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerRoom"; -import QuotaPerUser from "SRC_DIR/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerUser"; - -import Payments from "SRC_DIR/pages/PortalSettings/categories/payments"; - -import DeveloperTools from "SRC_DIR/pages/PortalSettings/categories/developer-tools"; -import WebhookHistory from "SRC_DIR/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookHistory"; -import WebhookDetails from "SRC_DIR/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookEventDetails"; -import DocSpace from "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/DocSpace"; -import SimpleRoom from "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/SimpleRoom"; -import Manager from "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Manager"; -import RoomSelector from "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/RoomSelector"; -import FileSelector from "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/FileSelector"; -import Editor from "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Editor"; -import Viewer from "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Viewer"; - -import Backup from "SRC_DIR/pages/PortalSettings/categories/data-management"; -import RestoreBackup from "SRC_DIR/pages/PortalSettings/categories/data-management/backup/restore-backup"; - -import DeleteDataPage from "SRC_DIR/pages/PortalSettings/categories/delete-data"; - -import Bonus from "SRC_DIR/pages/Bonus"; - -import DataImport from "SRC_DIR/pages/PortalSettings/categories/data-import"; -import GoogleDataImport from "SRC_DIR/pages/PortalSettings/categories/data-import/GoogleWorkspace"; -import NextcloudDataImport from "SRC_DIR/pages/PortalSettings/categories/data-import/NextCloudWorkspace"; -import OnlyofficeDataImport from "SRC_DIR/pages/PortalSettings/categories/data-import/OnlyofficeWorkspace"; - import { generalRoutes } from "./general"; const PortalSettingsRoutes = { @@ -98,43 +45,85 @@ const PortalSettingsRoutes = { }, { path: "customization/general", - element: , + lazy: () => import("SRC_DIR/pages/PortalSettings/categories/common"), }, { path: "customization/branding", - element: , - }, - { - path: "customization/branding/white-label", - element: , - }, - { - path: "customization/branding/company-info-settings", - element: , - }, - { - path: "customization/branding/additional-resources", - element: , + lazy: () => import("SRC_DIR/pages/PortalSettings/categories/common"), }, { path: "customization/appearance", - element: , + lazy: () => import("SRC_DIR/pages/PortalSettings/categories/common"), + }, + { + path: "customization/branding/white-label", + async lazy() { + const { WhiteLabel } = await import( + "SRC_DIR/pages/PortalSettings/categories/common/Branding/whitelabel" + ); + + return { Component: WhiteLabel }; + }, + }, + { + path: "customization/branding/company-info-settings", + async lazy() { + const { CompanyInfoSettings } = await import( + "SRC_DIR/pages/PortalSettings/categories/common/Branding/companyInfoSettings" + ); + + return { Component: CompanyInfoSettings }; + }, + }, + { + path: "customization/branding/additional-resources", + async lazy() { + const { AdditionalResources } = await import( + "SRC_DIR/pages/PortalSettings/categories/common/Branding/additionalResources" + ); + + return { Component: AdditionalResources }; + }, }, { path: "customization/general/language-and-time-zone", - element: , + async lazy() { + const { LanguageAndTimeZoneSettings } = await import( + "SRC_DIR/pages/PortalSettings/categories/common/Customization/language-and-time-zone" + ); + + return { Component: LanguageAndTimeZoneSettings }; + }, }, { path: "customization/general/welcome-page-settings", - element: , + async lazy() { + const { WelcomePageSettings } = await import( + "SRC_DIR/pages/PortalSettings/categories/common/Customization/welcome-page-settings" + ); + + return { Component: WelcomePageSettings }; + }, }, { path: "customization/general/dns-settings", - element: , + async lazy() { + const { DNSSettings } = await import( + "SRC_DIR/pages/PortalSettings/categories/common/Customization/dns-settings" + ); + + return { Component: DNSSettings }; + }, }, { path: "customization/general/portal-renaming", - element: , + async lazy() { + const { PortalRenaming } = await import( + "SRC_DIR/pages/PortalSettings/categories/common/Customization/portal-renaming" + ); + + return { Component: PortalRenaming }; + }, }, { path: "security", @@ -142,43 +131,85 @@ const PortalSettingsRoutes = { }, { path: "security/access-portal", - element: , + lazy: () => import("SRC_DIR/pages/PortalSettings/categories/security"), }, { path: "security/login-history", - element: , + lazy: () => import("SRC_DIR/pages/PortalSettings/categories/security"), }, { path: "security/audit-trail", - element: , + lazy: () => import("SRC_DIR/pages/PortalSettings/categories/security"), }, { path: "security/access-portal/tfa", - element: , + async lazy() { + const { TfaSection } = await import( + "SRC_DIR/pages/PortalSettings/categories/security/access-portal/tfa" + ); + + return { Component: TfaSection }; + }, }, { path: "security/access-portal/password", - element: , + async lazy() { + const { PasswordStrengthSection } = await import( + "SRC_DIR/pages/PortalSettings/categories/security/access-portal/passwordStrength" + ); + + return { Component: PasswordStrengthSection }; + }, }, { path: "security/access-portal/trusted-mail", - element: , + async lazy() { + const { TrustedMailSection } = await import( + "SRC_DIR/pages/PortalSettings/categories/security/access-portal/trustedMail" + ); + + return { Component: TrustedMailSection }; + }, }, { path: "security/access-portal/ip", - element: , + async lazy() { + const { IpSecuritySection } = await import( + "SRC_DIR/pages/PortalSettings/categories/security/access-portal/ipSecurity" + ); + + return { Component: IpSecuritySection }; + }, }, { path: "security/access-portal/brute-force-protection", - element: , + async lazy() { + const { BruteForceProtectionSection } = await import( + "SRC_DIR/pages/PortalSettings/categories/security/access-portal/bruteForceProtection" + ); + + return { Component: BruteForceProtectionSection }; + }, }, { path: "security/access-portal/admin-message", - element: , + async lazy() { + const { AdminMessageSection } = await import( + "SRC_DIR/pages/PortalSettings/categories/security/access-portal/adminMessage" + ); + + return { Component: AdminMessageSection }; + }, }, { path: "security/access-portal/lifetime", - element: , + async lazy() { + const { SessionLifetimeSection } = await import( + "SRC_DIR/pages/PortalSettings/categories/security/access-portal/sessionLifetime" + ); + + return { Component: SessionLifetimeSection }; + }, }, { path: "integration", @@ -186,63 +217,100 @@ const PortalSettingsRoutes = { }, { path: "integration/ldap", - element: , - }, - { - path: "integration/ldap/settings", - element: , - }, - { - path: "integration/ldap/sync-data", - element: , + lazy: () => import("SRC_DIR/pages/PortalSettings/categories/integration"), }, { path: "integration/third-party-services", - element: , + lazy: () => import("SRC_DIR/pages/PortalSettings/categories/integration"), }, { path: "integration/sso", - element: , - }, - { - path: "integration/sso/settings", - element: , - }, - { - path: "integration/sso/metadata", - element: , + lazy: () => import("SRC_DIR/pages/PortalSettings/categories/integration"), }, { path: "integration/portal-integration", - element: , + lazy: () => import("SRC_DIR/pages/PortalSettings/categories/integration"), }, { path: "integration/document-service", - element: , + lazy: () => import("SRC_DIR/pages/PortalSettings/categories/integration"), }, { path: "integration/plugins", - element: , + lazy: () => import("SRC_DIR/pages/PortalSettings/categories/integration"), }, { path: "integration/smtp-settings", - element: , + lazy: () => import("SRC_DIR/pages/PortalSettings/categories/integration"), + }, + { + path: "integration/ldap/settings", + async lazy() { + const { SettingsContainerSection } = await import( + "SRC_DIR/pages/PortalSettings/categories/integration/LDAP/sub-components/SettingsContainer" + ); + + return { Component: SettingsContainerSection }; + }, + }, + { + path: "integration/ldap/sync-data", + async lazy() { + const { SyncContainerSection } = await import( + "SRC_DIR/pages/PortalSettings/categories/integration/LDAP/sub-components/SyncContainer" + ); + + return { Component: SyncContainerSection }; + }, + }, + { + path: "integration/sso/settings", + async lazy() { + const { SPSettingsSection } = await import( + "SRC_DIR/pages/PortalSettings/categories/integration/SingleSignOn/SPSettings" + ); + + return { Component: SPSettingsSection }; + }, + }, + { + path: "integration/sso/metadata", + async lazy() { + const { ProviderMetadataSection } = await import( + "SRC_DIR/pages/PortalSettings/categories/integration/SingleSignOn/ProviderMetadata" + ); + + return { Component: ProviderMetadataSection }; + }, }, { path: "payments/portal-payments", - element: , + lazy: () => import("SRC_DIR/pages/PortalSettings/categories/payments"), }, { path: "management/disk-space", - element: , + lazy: () => + import("SRC_DIR/pages/PortalSettings/categories/storage-management"), }, { path: "management/disk-space/quota-per-room", - element: , + async lazy() { + const { QuotaPerRoomComponentSection } = await import( + "SRC_DIR/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerRoom" + ); + + return { Component: QuotaPerRoomComponentSection }; + }, }, { path: "management/disk-space/quota-per-user", - element: , + async lazy() { + const { QuotaPerUserComponentSection } = await import( + "SRC_DIR/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerUser" + ); + + return { Component: QuotaPerUserComponentSection }; + }, }, { path: "developer-tools", @@ -250,71 +318,111 @@ const PortalSettingsRoutes = { }, { path: "developer-tools/api", - element: , + lazy: () => + import("SRC_DIR/pages/PortalSettings/categories/developer-tools"), }, { path: "developer-tools/javascript-sdk", - element: , + lazy: () => + import("SRC_DIR/pages/PortalSettings/categories/developer-tools"), }, { path: "data-import/migration", - element: , + lazy: () => import("SRC_DIR/pages/PortalSettings/categories/data-import"), }, { path: "data-import/migration/google", - element: , + lazy: () => + import( + "SRC_DIR/pages/PortalSettings/categories/data-import/GoogleWorkspace" + ), }, { path: "data-import/migration/nextcloud", - element: , + lazy: () => + import( + "SRC_DIR/pages/PortalSettings/categories/data-import/NextCloudWorkspace" + ), }, { path: "data-import/migration/onlyoffice", - element: , + lazy: () => + import( + "SRC_DIR/pages/PortalSettings/categories/data-import/OnlyofficeWorkspace" + ), }, { path: "developer-tools/javascript-sdk/docspace", - element: , + lazy: () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/DocSpace" + ), }, { path: "developer-tools/javascript-sdk/public-room", - element: , + lazy: () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/SimpleRoom" + ), }, { path: "developer-tools/javascript-sdk/custom", - element: , + lazy: () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Manager" + ), }, { path: "developer-tools/javascript-sdk/room-selector", - element: , + lazy: () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/RoomSelector" + ), }, { path: "developer-tools/javascript-sdk/file-selector", - element: , + lazy: () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/FileSelector" + ), }, { path: "developer-tools/javascript-sdk/editor", - element: , + lazy: () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Editor" + ), }, { path: "developer-tools/javascript-sdk/viewer", - element: , + lazy: () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Viewer" + ), }, { path: "developer-tools/plugin-sdk", - element: , + lazy: () => + import("SRC_DIR/pages/PortalSettings/categories/developer-tools"), }, { path: "developer-tools/webhooks", - element: , + lazy: () => + import("SRC_DIR/pages/PortalSettings/categories/developer-tools"), }, { path: "developer-tools/webhooks/:id", - element: , + lazy: () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookHistory" + ), }, { path: "developer-tools/webhooks/:id/:eventId", - element: , + lazy: () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookEventDetails" + ), }, { path: "backup", @@ -322,11 +430,13 @@ const PortalSettingsRoutes = { }, { path: "backup/data-backup", - element: , + lazy: () => + import("SRC_DIR/pages/PortalSettings/categories/data-management"), }, { path: "backup/auto-backup", - element: , + lazy: () => + import("SRC_DIR/pages/PortalSettings/categories/data-management"), }, { path: "delete-data", @@ -334,11 +444,11 @@ const PortalSettingsRoutes = { }, { path: "delete-data/deletion", - element: , + lazy: () => import("SRC_DIR/pages/PortalSettings/categories/delete-data"), }, { path: "delete-data/deactivation", - element: , + lazy: () => import("SRC_DIR/pages/PortalSettings/categories/delete-data"), }, { path: "restore", @@ -346,11 +456,14 @@ const PortalSettingsRoutes = { }, { path: "restore/restore-backup", - element: , + lazy: () => + import( + "SRC_DIR/pages/PortalSettings/categories/data-management/backup/restore-backup" + ), }, { path: "bonus", - element: , + lazy: () => import("SRC_DIR/pages/Bonus"), }, ...generalRoutes, ], From e6a803320ad4209262845ff07be08947db79eb84 Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Mon, 24 Jun 2024 10:59:27 +0300 Subject: [PATCH 09/13] Management: fix after changes routes --- packages/management/src/categories/backup/index.tsx | 4 ++-- packages/management/src/categories/bonus/index.tsx | 4 ++-- packages/management/src/categories/payments/index.tsx | 4 ++-- packages/management/src/categories/restore/index.tsx | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/management/src/categories/backup/index.tsx b/packages/management/src/categories/backup/index.tsx index cee96e4b78..809178bc72 100644 --- a/packages/management/src/categories/backup/index.tsx +++ b/packages/management/src/categories/backup/index.tsx @@ -28,7 +28,7 @@ import React, { useEffect } from "react"; import { useTranslation } from "react-i18next"; import { useStore } from "SRC_DIR/store"; -import BackupPage from "client/BackupPage"; +import { Component } from "client/BackupPage"; const Backup = () => { const { t } = useTranslation(["Settings"]); @@ -40,7 +40,7 @@ const Backup = () => { setDocumentTitle(t("Backup")); }, []); - return ; + return ; }; export default Backup; diff --git a/packages/management/src/categories/bonus/index.tsx b/packages/management/src/categories/bonus/index.tsx index a75c6359f8..30c14b17df 100644 --- a/packages/management/src/categories/bonus/index.tsx +++ b/packages/management/src/categories/bonus/index.tsx @@ -25,10 +25,10 @@ // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode import React from "react"; -import BonusPage from "client/BonusPage"; +import { Component } from "client/BonusPage"; const Bonus = () => { - return ; + return ; }; export default Bonus; diff --git a/packages/management/src/categories/payments/index.tsx b/packages/management/src/categories/payments/index.tsx index a94c93b289..4a8b7c5260 100644 --- a/packages/management/src/categories/payments/index.tsx +++ b/packages/management/src/categories/payments/index.tsx @@ -25,10 +25,10 @@ // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode import React from "react"; -import PaymentsPage from "client/PaymentsPage"; +import { Component } from "client/PaymentsPage"; const Payments = () => { - return ; + return ; }; export default Payments; diff --git a/packages/management/src/categories/restore/index.tsx b/packages/management/src/categories/restore/index.tsx index a2fbd4247d..75581affe9 100644 --- a/packages/management/src/categories/restore/index.tsx +++ b/packages/management/src/categories/restore/index.tsx @@ -28,7 +28,7 @@ import React, { useEffect } from "react"; import { useTranslation } from "react-i18next"; import { useStore } from "SRC_DIR/store"; -import RestorePage from "client/RestorePage"; +import { Component } from "client/RestorePage"; const Restore = () => { const { t } = useTranslation(["Settings"]); @@ -40,7 +40,7 @@ const Restore = () => { setDocumentTitle(t("RestoreBackup")); }, []); - return ; + return ; }; export default Restore; From 7158be925debd6150088f5149dac012684ac27ff Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Mon, 24 Jun 2024 11:28:24 +0300 Subject: [PATCH 10/13] Client:Routes: add componentLoader --- packages/client/src/routes/client.js | 152 ++++---- packages/client/src/routes/confirm.js | 170 ++++----- packages/client/src/routes/general.js | 10 +- packages/client/src/routes/portalSettings.js | 358 ++++++++++++++----- 4 files changed, 418 insertions(+), 272 deletions(-) diff --git a/packages/client/src/routes/client.js b/packages/client/src/routes/client.js index 205f179da5..f2df914726 100644 --- a/packages/client/src/routes/client.js +++ b/packages/client/src/routes/client.js @@ -24,28 +24,22 @@ // content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode -import React from "react"; import { Navigate } from "react-router-dom"; -import loadable from "@loadable/component"; + +import componentLoader from "@docspace/shared/utils/component-loader"; import PrivateRoute from "../components/PrivateRouteWrapper"; import PublicRoute from "../components/PublicRouteWrapper"; import Error404 from "@docspace/shared/components/errors/Error404"; -import componentLoader from "@docspace/shared/utils/component-loader"; import ErrorBoundary from "../components/ErrorBoundaryWrapper"; import { generalRoutes } from "./general"; -const PublicRoom = loadable(() => - componentLoader(() => import("../pages/PublicRoom")), -); -const Wizard = loadable(() => componentLoader(() => import("../pages/Wizard"))); - const ClientRoutes = [ { path: "/", async lazy() { - const { Client } = await import("SRC_DIR/Client"); + const { Client } = await componentLoader(() => import("SRC_DIR/Client")); const Component = () => ( @@ -62,7 +56,9 @@ const ClientRoutes = [ { path: "/", async lazy() { - const { Component } = await import("SRC_DIR/pages/Home"); + const { Component } = await componentLoader( + () => import("SRC_DIR/pages/Home"), + ); return { Component }; }, @@ -94,8 +90,8 @@ const ClientRoutes = [ { path: "rooms/personal", async lazy() { - const { FilesView } = await import( - "SRC_DIR/pages/Home/View/Files" + const { FilesView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Files"), ); const Component = () => { @@ -112,8 +108,8 @@ const ClientRoutes = [ { path: "rooms/personal/filter", async lazy() { - const { FilesView } = await import( - "SRC_DIR/pages/Home/View/Files" + const { FilesView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Files"), ); const Component = () => { @@ -130,8 +126,8 @@ const ClientRoutes = [ { path: "files/trash", async lazy() { - const { FilesView } = await import( - "SRC_DIR/pages/Home/View/Files" + const { FilesView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Files"), ); const Component = () => { @@ -148,8 +144,8 @@ const ClientRoutes = [ { path: "files/trash/filter", async lazy() { - const { FilesView } = await import( - "SRC_DIR/pages/Home/View/Files" + const { FilesView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Files"), ); const Component = () => { @@ -166,8 +162,8 @@ const ClientRoutes = [ { path: "rooms/shared", async lazy() { - const { FilesView } = await import( - "SRC_DIR/pages/Home/View/Files" + const { FilesView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Files"), ); const Component = () => { @@ -184,8 +180,8 @@ const ClientRoutes = [ { path: "rooms/shared/filter", async lazy() { - const { FilesView } = await import( - "SRC_DIR/pages/Home/View/Files" + const { FilesView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Files"), ); const Component = () => { @@ -202,8 +198,8 @@ const ClientRoutes = [ { path: "rooms/shared/:room", async lazy() { - const { FilesView } = await import( - "SRC_DIR/pages/Home/View/Files" + const { FilesView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Files"), ); const Component = () => { @@ -220,8 +216,8 @@ const ClientRoutes = [ { path: "rooms/shared/:room/filter", async lazy() { - const { FilesView } = await import( - "SRC_DIR/pages/Home/View/Files" + const { FilesView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Files"), ); const Component = () => { @@ -238,8 +234,8 @@ const ClientRoutes = [ { path: "rooms/archived", async lazy() { - const { FilesView } = await import( - "SRC_DIR/pages/Home/View/Files" + const { FilesView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Files"), ); const Component = () => { @@ -256,8 +252,8 @@ const ClientRoutes = [ { path: "rooms/archived/filter", async lazy() { - const { FilesView } = await import( - "SRC_DIR/pages/Home/View/Files" + const { FilesView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Files"), ); const Component = () => { @@ -274,8 +270,8 @@ const ClientRoutes = [ { path: "rooms/archived/:room", async lazy() { - const { FilesView } = await import( - "SRC_DIR/pages/Home/View/Files" + const { FilesView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Files"), ); const Component = () => { @@ -292,8 +288,8 @@ const ClientRoutes = [ { path: "rooms/archived/:room/filter", async lazy() { - const { FilesView } = await import( - "SRC_DIR/pages/Home/View/Files" + const { FilesView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Files"), ); const Component = () => { @@ -310,8 +306,8 @@ const ClientRoutes = [ { path: "media/view/:id", async lazy() { - const { FilesView } = await import( - "SRC_DIR/pages/Home/View/Files" + const { FilesView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Files"), ); const Component = () => { @@ -364,8 +360,8 @@ const ClientRoutes = [ { path: "accounts/people/filter", async lazy() { - const { AccountsView } = await import( - "SRC_DIR/pages/Home/View/Accounts" + const { AccountsView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Accounts"), ); const Component = () => { @@ -390,8 +386,8 @@ const ClientRoutes = [ { path: "accounts/groups/filter", async lazy() { - const { AccountsView } = await import( - "SRC_DIR/pages/Home/View/Accounts" + const { AccountsView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Accounts"), ); const Component = () => { @@ -416,8 +412,8 @@ const ClientRoutes = [ { path: "accounts/groups/:groupId/filter", async lazy() { - const { AccountsView } = await import( - "SRC_DIR/pages/Home/View/Accounts" + const { AccountsView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Accounts"), ); const Component = () => { @@ -452,7 +448,9 @@ const ClientRoutes = [ { path: "/form-gallery", async lazy() { - const { WrappedComponent } = await import("SRC_DIR/pages/FormGallery"); + const { WrappedComponent } = await componentLoader( + () => import("SRC_DIR/pages/FormGallery"), + ); const Component = () => ( @@ -468,7 +466,9 @@ const ClientRoutes = [ { path: "/form-gallery/:fromFolderId", async lazy() { - const { WrappedComponent } = await import("SRC_DIR/pages/FormGallery"); + const { WrappedComponent } = await componentLoader( + () => import("SRC_DIR/pages/FormGallery"), + ); const Component = () => ( @@ -484,7 +484,9 @@ const ClientRoutes = [ { path: "/form-gallery/:fromFolderId/filter", async lazy() { - const { WrappedComponent } = await import("SRC_DIR/pages/FormGallery"); + const { WrappedComponent } = await componentLoader( + () => import("SRC_DIR/pages/FormGallery"), + ); const Component = () => ( @@ -500,8 +502,8 @@ const ClientRoutes = [ { path: "/share/preview/:id", async lazy() { - const { WrappedComponent } = await import( - "SRC_DIR/pages/PublicPreview/PublicPreview" + const { WrappedComponent } = await componentLoader( + () => import("SRC_DIR/pages/PublicPreview/PublicPreview"), ); const Component = () => ( @@ -518,7 +520,9 @@ const ClientRoutes = [ { path: "/rooms/share", async lazy() { - const { WrappedComponent } = await import("SRC_DIR/pages/PublicRoom"); + const { WrappedComponent } = await componentLoader( + () => import("SRC_DIR/pages/PublicRoom"), + ); const Component = () => ( @@ -535,7 +539,9 @@ const ClientRoutes = [ { index: true, async lazy() { - const { FilesView } = await import("SRC_DIR/pages/Home/View/Files"); + const { FilesView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Files"), + ); const Component = () => { return ( @@ -551,7 +557,9 @@ const ClientRoutes = [ { path: "media/view/:id", async lazy() { - const { FilesView } = await import("SRC_DIR/pages/Home/View/Files"); + const { FilesView } = await componentLoader( + () => import("SRC_DIR/pages/Home/View/Files"), + ); const Component = () => { return ( @@ -569,7 +577,9 @@ const ClientRoutes = [ { path: "/wizard", async lazy() { - const { WrappedComponent } = await import("SRC_DIR/pages/Wizard"); + const { WrappedComponent } = await componentLoader( + () => import("SRC_DIR/pages/Wizard"), + ); const Component = () => ( @@ -589,7 +599,9 @@ const ClientRoutes = [ { path: "/about", async lazy() { - const { About } = await import("SRC_DIR/pages/About"); + const { About } = await componentLoader( + () => import("SRC_DIR/pages/About"), + ); const Component = () => ( @@ -605,7 +617,9 @@ const ClientRoutes = [ { path: "/portal-unavailable", async lazy() { - const { Component } = await import("SRC_DIR/pages/PortalUnavailable"); + const { Component } = await componentLoader( + () => import("SRC_DIR/pages/PortalUnavailable"), + ); const WrappedComponent = () => ( @@ -621,8 +635,8 @@ const ClientRoutes = [ { path: "/unavailable", async lazy() { - const { Component } = await import( - "SRC_DIR/components/ErrorUnavailableWrapper" + const { Component } = await componentLoader( + () => import("SRC_DIR/components/ErrorUnavailableWrapper"), ); const WrappedComponent = () => ( @@ -639,8 +653,8 @@ const ClientRoutes = [ { path: "/access-restricted", async lazy() { - const { AccessRestricted } = await import( - "@docspace/shared/components/errors/AccessRestricted" + const { AccessRestricted } = await componentLoader( + () => import("@docspace/shared/components/errors/AccessRestricted"), ); const Component = () => ( @@ -657,8 +671,8 @@ const ClientRoutes = [ { path: "/preparation-portal", async lazy() { - const { PreparationPortal } = await import( - "@docspace/shared/pages/PreparationPortal" + const { PreparationPortal } = await componentLoader( + () => import("@docspace/shared/pages/PreparationPortal"), ); const Component = () => ( @@ -675,8 +689,8 @@ const ClientRoutes = [ { path: "/error/401", async lazy() { - const { Error401 } = await import( - "@docspace/shared/components/errors/Error401" + const { Error401 } = await componentLoader( + () => import("@docspace/shared/components/errors/Error401"), ); const Component = () => { @@ -695,8 +709,8 @@ const ClientRoutes = [ { path: "/error/403", async lazy() { - const { Error403 } = await import( - "@docspace/shared/components/errors/Error403" + const { Error403 } = await componentLoader( + () => import("@docspace/shared/components/errors/Error403"), ); const Component = () => { @@ -715,8 +729,8 @@ const ClientRoutes = [ { path: "/error/520", async lazy() { - const { Error520Component } = await import( - "SRC_DIR/components/Error520Wrapper" + const { Error520Component } = await componentLoader( + () => import("SRC_DIR/components/Error520Wrapper"), ); const Component = () => { @@ -735,8 +749,8 @@ const ClientRoutes = [ { path: "/error/access/restricted", async lazy() { - const { AccessRestricted } = await import( - "@docspace/shared/components/errors/AccessRestricted" + const { AccessRestricted } = await componentLoader( + () => import("@docspace/shared/components/errors/AccessRestricted"), ); const Component = () => ( @@ -753,8 +767,8 @@ const ClientRoutes = [ { path: "/error/offline", async lazy() { - const { ErrorOfflineContainer } = await import( - "@docspace/shared/components/errors/ErrorOffline" + const { ErrorOfflineContainer } = await componentLoader( + () => import("@docspace/shared/components/errors/ErrorOffline"), ); const Component = () => ( diff --git a/packages/client/src/routes/confirm.js b/packages/client/src/routes/confirm.js index 1094ca6579..29b10765c6 100644 --- a/packages/client/src/routes/confirm.js +++ b/packages/client/src/routes/confirm.js @@ -25,159 +25,115 @@ // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode import Error404 from "@docspace/shared/components/errors/Error404"; +import componentLoader from "@docspace/shared/utils/component-loader"; import ConfirmRoute from "SRC_DIR/helpers/confirmRoute"; -// import ActivateUserForm from "SRC_DIR/pages/Confirm/sub-components/activateUser"; -// import CreateUserForm from "SRC_DIR/pages/Confirm/sub-components/createUser"; -// import ChangePasswordForm from "SRC_DIR/pages/Confirm/sub-components/changePassword"; -// import ActivateEmailForm from "SRC_DIR/pages/Confirm/sub-components/activateEmail"; -// import ChangeEmailForm from "SRC_DIR/pages/Confirm/sub-components/changeEmail"; -// import ChangePhoneForm from "SRC_DIR/pages/Confirm/sub-components/changePhone"; -// import ProfileRemoveForm from "SRC_DIR/pages/Confirm/sub-components/profileRemove"; -// import ChangeOwnerForm from "SRC_DIR/pages/Confirm/sub-components/changeOwner"; -// import TfaAuthForm from "SRC_DIR/pages/Confirm/sub-components/tfaAuth"; -// import TfaActivationForm from "SRC_DIR/pages/Confirm/sub-components/tfaActivation"; -// import RemovePortal from "SRC_DIR/pages/Confirm/sub-components/removePortal"; -// import DeactivatePortal from "SRC_DIR/pages/Confirm/sub-components/deactivatePortal"; -// import ContinuePortal from "SRC_DIR/pages/Confirm/sub-components/continuePortal"; -// import Auth from "SRC_DIR/pages/Confirm/sub-components/auth"; - const confirmRoutes = [ { path: "EmpInvite", - // element: ( - // - // - // - // ), - lazy: () => import("SRC_DIR/pages/Confirm/sub-components/createUser"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/Confirm/sub-components/createUser"), + ), }, { path: "LinkInvite", - // element: ( - // - // - // - // ), - lazy: () => import("SRC_DIR/pages/Confirm/sub-components/createUser"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/Confirm/sub-components/createUser"), + ), }, { path: "Activation", - // element: ( - // - // - // - // ), - lazy: () => import("SRC_DIR/pages/Confirm/sub-components/activateUser"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/Confirm/sub-components/activateUser"), + ), }, { path: "EmailActivation", - // element: ( - // - // - // - // ), - lazy: () => import("SRC_DIR/pages/Confirm/sub-components/activateEmail"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/Confirm/sub-components/activateEmail"), + ), }, { path: "EmailChange", - // element: ( - // - // - // - // ), - lazy: () => import("SRC_DIR/pages/Confirm/sub-components/changeEmail"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/Confirm/sub-components/changeEmail"), + ), }, { path: "PasswordChange", - // element: ( - // - // - // - // ), - lazy: () => import("SRC_DIR/pages/Confirm/sub-components/changePassword"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/Confirm/sub-components/changePassword"), + ), }, { path: "ProfileRemove", - // element: ( - // - // - // - // ), - lazy: () => import("SRC_DIR/pages/Confirm/sub-components/profileRemove"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/Confirm/sub-components/profileRemove"), + ), }, { path: "PhoneActivation", - // element: ( - // - // - // - // ), - lazy: () => import("SRC_DIR/pages/Confirm/sub-components/changePhone"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/Confirm/sub-components/changePhone"), + ), }, { path: "PortalOwnerChange", - // element: ( - // - // - // - // ), - lazy: () => import("SRC_DIR/pages/Confirm/sub-components/changeOwner"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/Confirm/sub-components/changeOwner"), + ), }, { path: "TfaAuth", - // element: ( - // - // - // - // ), - lazy: () => import("SRC_DIR/pages/Confirm/sub-components/tfaAuth"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/Confirm/sub-components/tfaAuth"), + ), }, { path: "TfaActivation", - // element: ( - // - // - // - // ), - lazy: () => import("SRC_DIR/pages/Confirm/sub-components/tfaActivation"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/Confirm/sub-components/tfaActivation"), + ), }, { path: "PortalRemove", - // element: ( - // - // - // - // ), - lazy: () => import("SRC_DIR/pages/Confirm/sub-components/removePortal"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/Confirm/sub-components/removePortal"), + ), }, { path: "PortalSuspend", - // element: ( - // - // - // - // ), - lazy: () => import("SRC_DIR/pages/Confirm/sub-components/deactivatePortal"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/Confirm/sub-components/deactivatePortal"), + ), }, { path: "PortalContinue", - // element: ( - // - // - // - // ), - lazy: () => import("SRC_DIR/pages/Confirm/sub-components/continuePortal"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/Confirm/sub-components/continuePortal"), + ), }, { path: "Auth", - // element: ( - // - // - // - // ), - lazy: () => import("SRC_DIR/pages/Confirm/sub-components/auth"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/Confirm/sub-components/auth"), + ), }, ]; @@ -194,13 +150,13 @@ const ConfirmParentRoutes = [ }, { path: "confirm.aspx", - lazy: () => import("SRC_DIR/pages/Confirm"), + lazy: () => componentLoader(() => import("SRC_DIR/pages/Confirm")), errorElement: , children: [...confirmRoutes], }, { path: "confirm", - lazy: () => import("SRC_DIR/pages/Confirm"), + lazy: () => componentLoader(() => import("SRC_DIR/pages/Confirm")), errorElement: , children: [...confirmRoutes], }, diff --git a/packages/client/src/routes/general.js b/packages/client/src/routes/general.js index 4509feac43..0adeffd0e0 100644 --- a/packages/client/src/routes/general.js +++ b/packages/client/src/routes/general.js @@ -26,6 +26,8 @@ import { Navigate } from "react-router-dom"; +import componentLoader from "@docspace/shared/utils/component-loader"; + const generalRoutes = [ { path: "profile/", @@ -42,19 +44,19 @@ const generalRoutes = [ }, { path: "login", - lazy: () => import("SRC_DIR/pages/Profile"), + lazy: () => componentLoader(() => import("SRC_DIR/pages/Profile")), }, { path: "notifications", - lazy: () => import("SRC_DIR/pages/Profile"), + lazy: () => componentLoader(() => import("SRC_DIR/pages/Profile")), }, { path: "file-management", - lazy: () => import("SRC_DIR/pages/Profile"), + lazy: () => componentLoader(() => import("SRC_DIR/pages/Profile")), }, { path: "interface-theme", - lazy: () => import("SRC_DIR/pages/Profile"), + lazy: () => componentLoader(() => import("SRC_DIR/pages/Profile")), }, ], }, diff --git a/packages/client/src/routes/portalSettings.js b/packages/client/src/routes/portalSettings.js index 81838cccda..f89625804c 100644 --- a/packages/client/src/routes/portalSettings.js +++ b/packages/client/src/routes/portalSettings.js @@ -27,12 +27,13 @@ import { Navigate } from "react-router-dom"; import Error404 from "@docspace/shared/components/errors/Error404"; +import componentLoader from "@docspace/shared/utils/component-loader"; import { generalRoutes } from "./general"; const PortalSettingsRoutes = { path: "portal-settings/", - lazy: () => import("SRC_DIR/pages/PortalSettings"), + lazy: () => componentLoader(() => import("SRC_DIR/pages/PortalSettings")), errorElement: , children: [ { @@ -45,21 +46,33 @@ const PortalSettingsRoutes = { }, { path: "customization/general", - lazy: () => import("SRC_DIR/pages/PortalSettings/categories/common"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/PortalSettings/categories/common"), + ), }, { path: "customization/branding", - lazy: () => import("SRC_DIR/pages/PortalSettings/categories/common"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/PortalSettings/categories/common"), + ), }, { path: "customization/appearance", - lazy: () => import("SRC_DIR/pages/PortalSettings/categories/common"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/PortalSettings/categories/common"), + ), }, { path: "customization/branding/white-label", async lazy() { - const { WhiteLabel } = await import( - "SRC_DIR/pages/PortalSettings/categories/common/Branding/whitelabel" + const { WhiteLabel } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/common/Branding/whitelabel" + ), ); return { Component: WhiteLabel }; @@ -68,8 +81,11 @@ const PortalSettingsRoutes = { { path: "customization/branding/company-info-settings", async lazy() { - const { CompanyInfoSettings } = await import( - "SRC_DIR/pages/PortalSettings/categories/common/Branding/companyInfoSettings" + const { CompanyInfoSettings } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/common/Branding/companyInfoSettings" + ), ); return { Component: CompanyInfoSettings }; @@ -78,8 +94,11 @@ const PortalSettingsRoutes = { { path: "customization/branding/additional-resources", async lazy() { - const { AdditionalResources } = await import( - "SRC_DIR/pages/PortalSettings/categories/common/Branding/additionalResources" + const { AdditionalResources } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/common/Branding/additionalResources" + ), ); return { Component: AdditionalResources }; @@ -88,8 +107,11 @@ const PortalSettingsRoutes = { { path: "customization/general/language-and-time-zone", async lazy() { - const { LanguageAndTimeZoneSettings } = await import( - "SRC_DIR/pages/PortalSettings/categories/common/Customization/language-and-time-zone" + const { LanguageAndTimeZoneSettings } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/common/Customization/language-and-time-zone" + ), ); return { Component: LanguageAndTimeZoneSettings }; @@ -98,8 +120,11 @@ const PortalSettingsRoutes = { { path: "customization/general/welcome-page-settings", async lazy() { - const { WelcomePageSettings } = await import( - "SRC_DIR/pages/PortalSettings/categories/common/Customization/welcome-page-settings" + const { WelcomePageSettings } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/common/Customization/welcome-page-settings" + ), ); return { Component: WelcomePageSettings }; @@ -108,8 +133,11 @@ const PortalSettingsRoutes = { { path: "customization/general/dns-settings", async lazy() { - const { DNSSettings } = await import( - "SRC_DIR/pages/PortalSettings/categories/common/Customization/dns-settings" + const { DNSSettings } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/common/Customization/dns-settings" + ), ); return { Component: DNSSettings }; @@ -118,8 +146,11 @@ const PortalSettingsRoutes = { { path: "customization/general/portal-renaming", async lazy() { - const { PortalRenaming } = await import( - "SRC_DIR/pages/PortalSettings/categories/common/Customization/portal-renaming" + const { PortalRenaming } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/common/Customization/portal-renaming" + ), ); return { Component: PortalRenaming }; @@ -131,21 +162,33 @@ const PortalSettingsRoutes = { }, { path: "security/access-portal", - lazy: () => import("SRC_DIR/pages/PortalSettings/categories/security"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/PortalSettings/categories/security"), + ), }, { path: "security/login-history", - lazy: () => import("SRC_DIR/pages/PortalSettings/categories/security"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/PortalSettings/categories/security"), + ), }, { path: "security/audit-trail", - lazy: () => import("SRC_DIR/pages/PortalSettings/categories/security"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/PortalSettings/categories/security"), + ), }, { path: "security/access-portal/tfa", async lazy() { - const { TfaSection } = await import( - "SRC_DIR/pages/PortalSettings/categories/security/access-portal/tfa" + const { TfaSection } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/security/access-portal/tfa" + ), ); return { Component: TfaSection }; @@ -154,8 +197,11 @@ const PortalSettingsRoutes = { { path: "security/access-portal/password", async lazy() { - const { PasswordStrengthSection } = await import( - "SRC_DIR/pages/PortalSettings/categories/security/access-portal/passwordStrength" + const { PasswordStrengthSection } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/security/access-portal/passwordStrength" + ), ); return { Component: PasswordStrengthSection }; @@ -164,8 +210,11 @@ const PortalSettingsRoutes = { { path: "security/access-portal/trusted-mail", async lazy() { - const { TrustedMailSection } = await import( - "SRC_DIR/pages/PortalSettings/categories/security/access-portal/trustedMail" + const { TrustedMailSection } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/security/access-portal/trustedMail" + ), ); return { Component: TrustedMailSection }; @@ -174,8 +223,11 @@ const PortalSettingsRoutes = { { path: "security/access-portal/ip", async lazy() { - const { IpSecuritySection } = await import( - "SRC_DIR/pages/PortalSettings/categories/security/access-portal/ipSecurity" + const { IpSecuritySection } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/security/access-portal/ipSecurity" + ), ); return { Component: IpSecuritySection }; @@ -184,8 +236,11 @@ const PortalSettingsRoutes = { { path: "security/access-portal/brute-force-protection", async lazy() { - const { BruteForceProtectionSection } = await import( - "SRC_DIR/pages/PortalSettings/categories/security/access-portal/bruteForceProtection" + const { BruteForceProtectionSection } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/security/access-portal/bruteForceProtection" + ), ); return { Component: BruteForceProtectionSection }; @@ -194,8 +249,11 @@ const PortalSettingsRoutes = { { path: "security/access-portal/admin-message", async lazy() { - const { AdminMessageSection } = await import( - "SRC_DIR/pages/PortalSettings/categories/security/access-portal/adminMessage" + const { AdminMessageSection } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/security/access-portal/adminMessage" + ), ); return { Component: AdminMessageSection }; @@ -204,8 +262,11 @@ const PortalSettingsRoutes = { { path: "security/access-portal/lifetime", async lazy() { - const { SessionLifetimeSection } = await import( - "SRC_DIR/pages/PortalSettings/categories/security/access-portal/sessionLifetime" + const { SessionLifetimeSection } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/security/access-portal/sessionLifetime" + ), ); return { Component: SessionLifetimeSection }; @@ -217,37 +278,61 @@ const PortalSettingsRoutes = { }, { path: "integration/ldap", - lazy: () => import("SRC_DIR/pages/PortalSettings/categories/integration"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/PortalSettings/categories/integration"), + ), }, { path: "integration/third-party-services", - lazy: () => import("SRC_DIR/pages/PortalSettings/categories/integration"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/PortalSettings/categories/integration"), + ), }, { path: "integration/sso", - lazy: () => import("SRC_DIR/pages/PortalSettings/categories/integration"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/PortalSettings/categories/integration"), + ), }, { path: "integration/portal-integration", - lazy: () => import("SRC_DIR/pages/PortalSettings/categories/integration"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/PortalSettings/categories/integration"), + ), }, { path: "integration/document-service", - lazy: () => import("SRC_DIR/pages/PortalSettings/categories/integration"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/PortalSettings/categories/integration"), + ), }, { path: "integration/plugins", - lazy: () => import("SRC_DIR/pages/PortalSettings/categories/integration"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/PortalSettings/categories/integration"), + ), }, { path: "integration/smtp-settings", - lazy: () => import("SRC_DIR/pages/PortalSettings/categories/integration"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/PortalSettings/categories/integration"), + ), }, { path: "integration/ldap/settings", async lazy() { - const { SettingsContainerSection } = await import( - "SRC_DIR/pages/PortalSettings/categories/integration/LDAP/sub-components/SettingsContainer" + const { SettingsContainerSection } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/integration/LDAP/sub-components/SettingsContainer" + ), ); return { Component: SettingsContainerSection }; @@ -256,8 +341,11 @@ const PortalSettingsRoutes = { { path: "integration/ldap/sync-data", async lazy() { - const { SyncContainerSection } = await import( - "SRC_DIR/pages/PortalSettings/categories/integration/LDAP/sub-components/SyncContainer" + const { SyncContainerSection } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/integration/LDAP/sub-components/SyncContainer" + ), ); return { Component: SyncContainerSection }; @@ -266,8 +354,11 @@ const PortalSettingsRoutes = { { path: "integration/sso/settings", async lazy() { - const { SPSettingsSection } = await import( - "SRC_DIR/pages/PortalSettings/categories/integration/SingleSignOn/SPSettings" + const { SPSettingsSection } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/integration/SingleSignOn/SPSettings" + ), ); return { Component: SPSettingsSection }; @@ -276,8 +367,11 @@ const PortalSettingsRoutes = { { path: "integration/sso/metadata", async lazy() { - const { ProviderMetadataSection } = await import( - "SRC_DIR/pages/PortalSettings/categories/integration/SingleSignOn/ProviderMetadata" + const { ProviderMetadataSection } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/integration/SingleSignOn/ProviderMetadata" + ), ); return { Component: ProviderMetadataSection }; @@ -285,18 +379,29 @@ const PortalSettingsRoutes = { }, { path: "payments/portal-payments", - lazy: () => import("SRC_DIR/pages/PortalSettings/categories/payments"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/PortalSettings/categories/payments"), + ), }, { path: "management/disk-space", lazy: () => - import("SRC_DIR/pages/PortalSettings/categories/storage-management"), + componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/storage-management" + ), + ), }, { path: "management/disk-space/quota-per-room", async lazy() { - const { QuotaPerRoomComponentSection } = await import( - "SRC_DIR/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerRoom" + const { QuotaPerRoomComponentSection } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerRoom" + ), ); return { Component: QuotaPerRoomComponentSection }; @@ -305,8 +410,11 @@ const PortalSettingsRoutes = { { path: "management/disk-space/quota-per-user", async lazy() { - const { QuotaPerUserComponentSection } = await import( - "SRC_DIR/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerUser" + const { QuotaPerUserComponentSection } = await componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/storage-management/sub-components/QuotaPerUser" + ), ); return { Component: QuotaPerUserComponentSection }; @@ -319,109 +427,160 @@ const PortalSettingsRoutes = { { path: "developer-tools/api", lazy: () => - import("SRC_DIR/pages/PortalSettings/categories/developer-tools"), + componentLoader( + () => + import("SRC_DIR/pages/PortalSettings/categories/developer-tools"), + ), }, { path: "developer-tools/javascript-sdk", lazy: () => - import("SRC_DIR/pages/PortalSettings/categories/developer-tools"), + componentLoader( + () => + import("SRC_DIR/pages/PortalSettings/categories/developer-tools"), + ), }, { path: "data-import/migration", - lazy: () => import("SRC_DIR/pages/PortalSettings/categories/data-import"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/PortalSettings/categories/data-import"), + ), }, { path: "data-import/migration/google", lazy: () => - import( - "SRC_DIR/pages/PortalSettings/categories/data-import/GoogleWorkspace" + componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/data-import/GoogleWorkspace" + ), ), }, { path: "data-import/migration/nextcloud", lazy: () => - import( - "SRC_DIR/pages/PortalSettings/categories/data-import/NextCloudWorkspace" + componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/data-import/NextCloudWorkspace" + ), ), }, { path: "data-import/migration/onlyoffice", lazy: () => - import( - "SRC_DIR/pages/PortalSettings/categories/data-import/OnlyofficeWorkspace" + componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/data-import/OnlyofficeWorkspace" + ), ), }, { path: "developer-tools/javascript-sdk/docspace", lazy: () => - import( - "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/DocSpace" + componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/DocSpace" + ), ), }, { path: "developer-tools/javascript-sdk/public-room", lazy: () => - import( - "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/SimpleRoom" + componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/SimpleRoom" + ), ), }, { path: "developer-tools/javascript-sdk/custom", lazy: () => - import( - "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Manager" + componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Manager" + ), ), }, { path: "developer-tools/javascript-sdk/room-selector", lazy: () => - import( - "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/RoomSelector" + componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/RoomSelector" + ), ), }, { path: "developer-tools/javascript-sdk/file-selector", lazy: () => - import( - "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/FileSelector" + componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/FileSelector" + ), ), }, { path: "developer-tools/javascript-sdk/editor", lazy: () => - import( - "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Editor" + componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Editor" + ), ), }, { path: "developer-tools/javascript-sdk/viewer", lazy: () => - import( - "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Viewer" + componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/JavascriptSDK/presets/Viewer" + ), ), }, { path: "developer-tools/plugin-sdk", lazy: () => - import("SRC_DIR/pages/PortalSettings/categories/developer-tools"), + componentLoader( + () => + import("SRC_DIR/pages/PortalSettings/categories/developer-tools"), + ), }, { path: "developer-tools/webhooks", lazy: () => - import("SRC_DIR/pages/PortalSettings/categories/developer-tools"), + componentLoader( + () => + import("SRC_DIR/pages/PortalSettings/categories/developer-tools"), + ), }, { path: "developer-tools/webhooks/:id", lazy: () => - import( - "SRC_DIR/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookHistory" + componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookHistory" + ), ), }, { path: "developer-tools/webhooks/:id/:eventId", lazy: () => - import( - "SRC_DIR/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookEventDetails" + componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/developer-tools/Webhooks/WebhookEventDetails" + ), ), }, { @@ -431,12 +590,18 @@ const PortalSettingsRoutes = { { path: "backup/data-backup", lazy: () => - import("SRC_DIR/pages/PortalSettings/categories/data-management"), + componentLoader( + () => + import("SRC_DIR/pages/PortalSettings/categories/data-management"), + ), }, { path: "backup/auto-backup", lazy: () => - import("SRC_DIR/pages/PortalSettings/categories/data-management"), + componentLoader( + () => + import("SRC_DIR/pages/PortalSettings/categories/data-management"), + ), }, { path: "delete-data", @@ -444,11 +609,17 @@ const PortalSettingsRoutes = { }, { path: "delete-data/deletion", - lazy: () => import("SRC_DIR/pages/PortalSettings/categories/delete-data"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/PortalSettings/categories/delete-data"), + ), }, { path: "delete-data/deactivation", - lazy: () => import("SRC_DIR/pages/PortalSettings/categories/delete-data"), + lazy: () => + componentLoader( + () => import("SRC_DIR/pages/PortalSettings/categories/delete-data"), + ), }, { path: "restore", @@ -457,13 +628,16 @@ const PortalSettingsRoutes = { { path: "restore/restore-backup", lazy: () => - import( - "SRC_DIR/pages/PortalSettings/categories/data-management/backup/restore-backup" + componentLoader( + () => + import( + "SRC_DIR/pages/PortalSettings/categories/data-management/backup/restore-backup" + ), ), }, { path: "bonus", - lazy: () => import("SRC_DIR/pages/Bonus"), + lazy: () => componentLoader(() => import("SRC_DIR/pages/Bonus")), }, ...generalRoutes, ], From 11687a5acb15922f1679bc25c455be7c59019124 Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Mon, 24 Jun 2024 12:17:13 +0300 Subject: [PATCH 11/13] Remove @loadable --- .../shared/constants/sharedDependencies.js | 4 ---- packages/shared/package.json | 1 - yarn.lock | 20 +++---------------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/packages/shared/constants/sharedDependencies.js b/packages/shared/constants/sharedDependencies.js index 78c0fe5c00..1109e821f2 100644 --- a/packages/shared/constants/sharedDependencies.js +++ b/packages/shared/constants/sharedDependencies.js @@ -184,8 +184,4 @@ module.exports = { singleton: true, requiredVersion: deps["query-string"], }, - "@loadable/component": { - singleton: true, - requiredVersion: deps["@loadable/component"], - }, }; diff --git a/packages/shared/package.json b/packages/shared/package.json index 1075445397..ab76f5a309 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -19,7 +19,6 @@ }, "dependencies": { "@babel/runtime": "^7.21.0", - "@loadable/component": "^5.15.3", "@react-spring/web": "^9.7.1", "@use-gesture/react": "^10.2.24", "attr-accept": "^2.2.2", diff --git a/yarn.lock b/yarn.lock index 33a7b30f6e..2e110771b3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2027,7 +2027,7 @@ __metadata: languageName: node linkType: hard -"@babel/runtime@npm:^7.0.0, @babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.10.1, @babel/runtime@npm:^7.11.1, @babel/runtime@npm:^7.12.0, @babel/runtime@npm:^7.12.13, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.13.10, @babel/runtime@npm:^7.17.2, @babel/runtime@npm:^7.17.8, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.18.6, @babel/runtime@npm:^7.20.0, @babel/runtime@npm:^7.20.7, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.22.5, @babel/runtime@npm:^7.23.2, @babel/runtime@npm:^7.23.9, @babel/runtime@npm:^7.3.1, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.7.2, @babel/runtime@npm:^7.7.7, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.8.7, @babel/runtime@npm:^7.9.2": +"@babel/runtime@npm:^7.0.0, @babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.10.1, @babel/runtime@npm:^7.11.1, @babel/runtime@npm:^7.12.0, @babel/runtime@npm:^7.12.13, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.13.10, @babel/runtime@npm:^7.17.2, @babel/runtime@npm:^7.17.8, @babel/runtime@npm:^7.18.3, @babel/runtime@npm:^7.18.6, @babel/runtime@npm:^7.20.0, @babel/runtime@npm:^7.20.7, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.22.5, @babel/runtime@npm:^7.23.2, @babel/runtime@npm:^7.23.9, @babel/runtime@npm:^7.3.1, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.7.2, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.8.7, @babel/runtime@npm:^7.9.2": version: 7.24.0 resolution: "@babel/runtime@npm:7.24.0" dependencies: @@ -2762,7 +2762,6 @@ __metadata: "@babel/runtime": "npm:^7.21.0" "@emotion/babel-preset-css-prop": "npm:^10.2.1" "@emotion/styled": "npm:^10.3.0" - "@loadable/component": "npm:^5.15.3" "@react-spring/web": "npm:^9.7.1" "@react-theming/storybook-addon": "npm:^1.1.10" "@storybook/addon-actions": "npm:7.6.12" @@ -4459,19 +4458,6 @@ __metadata: languageName: node linkType: hard -"@loadable/component@npm:^5.15.3": - version: 5.16.3 - resolution: "@loadable/component@npm:5.16.3" - dependencies: - "@babel/runtime": "npm:^7.7.7" - hoist-non-react-statics: "npm:^3.3.1" - react-is: "npm:^16.12.0" - peerDependencies: - react: ^16.3.0 || ^17.0.0 || ^18.0.0 - checksum: 10/4e176b927c002ad6ec1494f229e822335de48cfe429ddd1e16dfc29e0f1f938c2aad9d187edc14114e29898806583b156ee9923df7b200a9d106fe11b524c024 - languageName: node - linkType: hard - "@mdx-js/react@npm:^2.1.5": version: 2.3.0 resolution: "@mdx-js/react@npm:2.3.0" @@ -15872,7 +15858,7 @@ __metadata: languageName: node linkType: hard -"hoist-non-react-statics@npm:^3.0.0, hoist-non-react-statics@npm:^3.3.0, hoist-non-react-statics@npm:^3.3.1": +"hoist-non-react-statics@npm:^3.0.0, hoist-non-react-statics@npm:^3.3.0": version: 3.3.2 resolution: "hoist-non-react-statics@npm:3.3.2" dependencies: @@ -23440,7 +23426,7 @@ __metadata: languageName: node linkType: hard -"react-is@npm:^16.12.0, react-is@npm:^16.13.1, react-is@npm:^16.7.0": +"react-is@npm:^16.13.1, react-is@npm:^16.7.0": version: 16.13.1 resolution: "react-is@npm:16.13.1" checksum: 10/5aa564a1cde7d391ac980bedee21202fc90bdea3b399952117f54fb71a932af1e5902020144fb354b4690b2414a0c7aafe798eb617b76a3d441d956db7726fdf From 51e4cb24d6bbb63295956041a35c02971f6918b2 Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Fri, 12 Jul 2024 15:06:30 +0300 Subject: [PATCH 12/13] Client:Routes:General: fix after merge --- packages/client/src/routes/general.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/client/src/routes/general.js b/packages/client/src/routes/general.js index 7aacfa9bd7..1193672456 100644 --- a/packages/client/src/routes/general.js +++ b/packages/client/src/routes/general.js @@ -60,11 +60,7 @@ const generalRoutes = [ }, { path: "authorized-apps", - element: ( - - - - ), + lazy: () => componentLoader(() => import("SRC_DIR/pages/Profile")), }, ], }, From c7ddd99186fdd6e64c99a74bbffddb03c3feb76b Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Fri, 12 Jul 2024 15:11:16 +0300 Subject: [PATCH 13/13] Client:Routes:General: fix after merge --- packages/client/src/routes/portalSettings.js | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/packages/client/src/routes/portalSettings.js b/packages/client/src/routes/portalSettings.js index 502954147c..876c3e6294 100644 --- a/packages/client/src/routes/portalSettings.js +++ b/packages/client/src/routes/portalSettings.js @@ -31,24 +31,6 @@ import componentLoader from "@docspace/shared/utils/component-loader"; import { generalRoutes } from "./general"; -const OAuthCreatePage = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/developer-tools/OAuth/OAuthCreatePage" - ), - ), -); - -const OAuthEditPage = loadable(() => - componentLoader( - () => - import( - "../pages/PortalSettings/categories/developer-tools/OAuth/OAuthEditPage" - ), - ), -); - const PortalSettingsRoutes = { path: "portal-settings/", lazy: () => componentLoader(() => import("SRC_DIR/pages/PortalSettings")),