Merge branch 'sso-paths' into 'main'
[ProtonMail-WebClient.git] / packages / components / containers / app / StandardPrivateApp.tsx
blobc316d4dd87aad872f2bdb619ac727c088bce5d2d
1 import type { ReactNode } from 'react';
3 import EventNotices from '@proton/components/containers/eventManager/EventNotices';
4 import NotificationsChildren from '@proton/components/containers/notifications/Children';
5 import useConfig from '@proton/components/hooks/useConfig';
6 import useIsInboxElectronApp from '@proton/components/hooks/useIsInboxElectronApp';
8 import SessionRecoveryLocalStorageManager from '../account/sessionRecovery/SessionRecoveryLocalStorageManager';
9 import ForceRefreshProvider from '../forceRefresh/Provider';
10 import KeyTransparencyManager from '../keyTransparency/KeyTransparencyManager';
11 import DensityInjector from '../layouts/DensityInjector';
12 import ModalsChildren from '../modals/Children';
13 import PaymentSwitcher from '../payments/PaymentSwitcher';
14 import { ThemeInjector } from '../themes/ThemeInjector';
15 import ElectronBlockedContainer from './ElectronBlockedContainer';
16 import KeyBackgroundManager from './KeyBackgroundManager';
17 import StorageListener from './StorageListener';
19 interface Props {
20     children: ReactNode;
21     noModals?: boolean;
22     hasPrivateMemberKeyGeneration?: boolean;
23     hasReadableMemberKeyActivation?: boolean;
24     hasMemberKeyMigration?: boolean;
27 const StandardPrivateApp = ({
28     children,
29     hasPrivateMemberKeyGeneration,
30     hasMemberKeyMigration,
31     hasReadableMemberKeyActivation,
32     noModals,
33 }: Props) => {
34     const { APP_NAME } = useConfig();
35     const { isElectronDisabled } = useIsInboxElectronApp();
37     if (isElectronDisabled) {
38         return <ElectronBlockedContainer />;
39     }
41     return (
42         <PaymentSwitcher>
43             <KeyTransparencyManager appName={APP_NAME}>
44                 <SessionRecoveryLocalStorageManager>
45                     <EventNotices />
46                     <ThemeInjector />
47                     <DensityInjector />
48                     <NotificationsChildren />
49                     {!noModals && <ModalsChildren />}
50                     <KeyBackgroundManager
51                         hasPrivateMemberKeyGeneration={hasPrivateMemberKeyGeneration}
52                         hasReadableMemberKeyActivation={hasReadableMemberKeyActivation}
53                         hasMemberKeyMigration={hasMemberKeyMigration}
54                     />
55                     <StorageListener />
56                     <ForceRefreshProvider>{children}</ForceRefreshProvider>
57                 </SessionRecoveryLocalStorageManager>
58             </KeyTransparencyManager>
59         </PaymentSwitcher>
60     );
63 export default StandardPrivateApp;