Cleanup - unused files / unused exports / duplicate exports
[ProtonMail-WebClient.git] / packages / components / containers / organization / logoUpload / useShowLightLabellingFeatureModal.tsx
blob8a18e47c608cfc9b4972eeb7c1c846550b28b0b3
1 import { useWelcomeFlags } from '@proton/account';
2 import { useOrganization } from '@proton/account/organization/hooks';
3 import { useUser } from '@proton/account/user/hooks';
4 import useConfig from '@proton/components/hooks/useConfig';
5 import { FeatureCode, useFeature } from '@proton/features';
6 import { APPS } from '@proton/shared/lib/constants';
7 import { hasOrganizationSetupWithKeys } from '@proton/shared/lib/helpers/organization';
8 import { getOrganizationDenomination } from '@proton/shared/lib/organization/helper';
10 import { useOrganizationTheme } from './useOrganizationTheme';
12 export const useShowLightLabellingFeatureModal = () => {
13     const { APP_NAME } = useConfig();
14     const [{ isAdmin }] = useUser();
15     const [organization] = useOrganization();
16     const isPartOfFamily = getOrganizationDenomination(organization) === 'familyGroup';
17     const hasOrganizationKey = hasOrganizationSetupWithKeys(organization);
18     const organizationTheme = useOrganizationTheme();
19     const { welcomeFlags } = useWelcomeFlags();
21     const seenLightLabellingFeatureModal = useFeature<boolean>(FeatureCode.SeenLightLabellingFeatureModal);
23     const hasOrganizationUsage = organization && organization.UsedDomains >= 1 && organization.UsedMembers >= 2;
25     if (
26         ((APP_NAME !== APPS.PROTONACCOUNT && welcomeFlags.isDone) || APP_NAME === APPS.PROTONACCOUNT) &&
27         hasOrganizationKey &&
28         seenLightLabellingFeatureModal.feature?.Value === false &&
29         !isPartOfFamily &&
30         isAdmin &&
31         hasOrganizationUsage &&
32         organizationTheme.access &&
33         !organizationTheme.logoURL
34     ) {
35         return true;
36     }
38     return false;