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;
26 ((APP_NAME !== APPS.PROTONACCOUNT && welcomeFlags.isDone) || APP_NAME === APPS.PROTONACCOUNT) &&
28 seenLightLabellingFeatureModal.feature?.Value === false &&
31 hasOrganizationUsage &&
32 organizationTheme.access &&
33 !organizationTheme.logoURL