From 7158be925debd6150088f5149dac012684ac27ff Mon Sep 17 00:00:00 2001 From: Timofey Boyko Date: Mon, 24 Jun 2024 11:28:24 +0300 Subject: [PATCH] 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, ],