Fix-issue-370 (#9996)
Fixes the issue from introduced when alowing gmail and outlook. fixes https://github.com/twentyhq/core-team-issues/issues/370
This commit is contained in:
@ -9,6 +9,10 @@ import { isAnalyticsEnabledState } from '@/client-config/states/isAnalyticsEnabl
|
||||
import { isDebugModeState } from '@/client-config/states/isDebugModeState';
|
||||
import { isDeveloperDefaultSignInPrefilledState } from '@/client-config/states/isDeveloperDefaultSignInPrefilledState';
|
||||
import { isEmailVerificationRequiredState } from '@/client-config/states/isEmailVerificationRequiredState';
|
||||
import { isGoogleCalendarEnabledState } from '@/client-config/states/isGoogleCalendarEnabledState';
|
||||
import { isGoogleMessagingEnabledState } from '@/client-config/states/isGoogleMessagingEnabledState';
|
||||
import { isMicrosoftCalendarEnabledState } from '@/client-config/states/isMicrosoftCalendarEnabledState';
|
||||
import { isMicrosoftMessagingEnabledState } from '@/client-config/states/isMicrosoftMessagingEnabledState';
|
||||
import { isMultiWorkspaceEnabledState } from '@/client-config/states/isMultiWorkspaceEnabledState';
|
||||
import { labPublicFeatureFlagsState } from '@/client-config/states/labPublicFeatureFlagsState';
|
||||
import { sentryConfigState } from '@/client-config/states/sentryConfigState';
|
||||
@ -57,6 +61,22 @@ export const ClientConfigProviderEffect = () => {
|
||||
labPublicFeatureFlagsState,
|
||||
);
|
||||
|
||||
const setMicrosoftMessagingEnabled = useSetRecoilState(
|
||||
isMicrosoftMessagingEnabledState,
|
||||
);
|
||||
|
||||
const setMicrosoftCalendarEnabled = useSetRecoilState(
|
||||
isMicrosoftCalendarEnabledState,
|
||||
);
|
||||
|
||||
const setGoogleMessagingEnabled = useSetRecoilState(
|
||||
isGoogleMessagingEnabledState,
|
||||
);
|
||||
|
||||
const setGoogleCalendarEnabled = useSetRecoilState(
|
||||
isGoogleCalendarEnabledState,
|
||||
);
|
||||
|
||||
const { data, loading, error } = useGetClientConfigQuery({
|
||||
skip: clientConfigApiStatus.isLoaded,
|
||||
});
|
||||
@ -123,6 +143,12 @@ export const ClientConfigProviderEffect = () => {
|
||||
});
|
||||
setCanManageFeatureFlags(data?.clientConfig?.canManageFeatureFlags);
|
||||
setLabPublicFeatureFlags(data?.clientConfig?.publicFeatureFlags);
|
||||
setMicrosoftMessagingEnabled(
|
||||
data?.clientConfig?.isMicrosoftMessagingEnabled,
|
||||
);
|
||||
setMicrosoftCalendarEnabled(data?.clientConfig?.isMicrosoftCalendarEnabled);
|
||||
setGoogleMessagingEnabled(data?.clientConfig?.isGoogleMessagingEnabled);
|
||||
setGoogleCalendarEnabled(data?.clientConfig?.isGoogleCalendarEnabled);
|
||||
}, [
|
||||
data,
|
||||
setIsDebugMode,
|
||||
@ -143,6 +169,10 @@ export const ClientConfigProviderEffect = () => {
|
||||
setAuthProviders,
|
||||
setCanManageFeatureFlags,
|
||||
setLabPublicFeatureFlags,
|
||||
setMicrosoftMessagingEnabled,
|
||||
setMicrosoftCalendarEnabled,
|
||||
setGoogleMessagingEnabled,
|
||||
setGoogleCalendarEnabled,
|
||||
]);
|
||||
|
||||
return <></>;
|
||||
|
||||
@ -56,6 +56,10 @@ export const GET_CLIENT_CONFIG = gql`
|
||||
imagePath
|
||||
}
|
||||
}
|
||||
isMicrosoftMessagingEnabled
|
||||
isMicrosoftCalendarEnabled
|
||||
isGoogleMessagingEnabled
|
||||
isGoogleCalendarEnabled
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
import { createState } from '@ui/utilities/state/utils/createState';
|
||||
|
||||
export const isGoogleCalendarEnabledState = createState<boolean>({
|
||||
key: 'isGoogleCalendarEnabled',
|
||||
defaultValue: false,
|
||||
});
|
||||
@ -0,0 +1,6 @@
|
||||
import { createState } from '@ui/utilities/state/utils/createState';
|
||||
|
||||
export const isGoogleMessagingEnabledState = createState<boolean>({
|
||||
key: 'isGoogleMessagingEnabled',
|
||||
defaultValue: false,
|
||||
});
|
||||
@ -0,0 +1,6 @@
|
||||
import { createState } from '@ui/utilities/state/utils/createState';
|
||||
|
||||
export const isMicrosoftCalendarEnabledState = createState<boolean>({
|
||||
key: 'isMicrosoftCalendarEnabled',
|
||||
defaultValue: false,
|
||||
});
|
||||
@ -0,0 +1,6 @@
|
||||
import { createState } from '@ui/utilities/state/utils/createState';
|
||||
|
||||
export const isMicrosoftMessagingEnabledState = createState<boolean>({
|
||||
key: 'isMicrosoftMessagingEnabled',
|
||||
defaultValue: false,
|
||||
});
|
||||
@ -1,6 +1,11 @@
|
||||
import { isGoogleCalendarEnabledState } from '@/client-config/states/isGoogleCalendarEnabledState';
|
||||
import { isGoogleMessagingEnabledState } from '@/client-config/states/isGoogleMessagingEnabledState';
|
||||
import { isMicrosoftCalendarEnabledState } from '@/client-config/states/isMicrosoftCalendarEnabledState';
|
||||
import { isMicrosoftMessagingEnabledState } from '@/client-config/states/isMicrosoftMessagingEnabledState';
|
||||
import { useTriggerApisOAuth } from '@/settings/accounts/hooks/useTriggerApiOAuth';
|
||||
import styled from '@emotion/styled';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import {
|
||||
Button,
|
||||
Card,
|
||||
@ -33,23 +38,40 @@ export const SettingsAccountsListEmptyStateCard = ({
|
||||
|
||||
const { t } = useLingui();
|
||||
|
||||
const isGoogleMessagingEnabled = useRecoilValue(
|
||||
isGoogleMessagingEnabledState,
|
||||
);
|
||||
const isMicrosoftMessagingEnabled = useRecoilValue(
|
||||
isMicrosoftMessagingEnabledState,
|
||||
);
|
||||
|
||||
const isGoogleCalendarEnabled = useRecoilValue(isGoogleCalendarEnabledState);
|
||||
|
||||
const isMicrosoftCalendarEnabled = useRecoilValue(
|
||||
isMicrosoftCalendarEnabledState,
|
||||
);
|
||||
|
||||
return (
|
||||
<Card>
|
||||
<StyledHeader>{label || t`No connected account`}</StyledHeader>
|
||||
<StyledBody>
|
||||
<Button
|
||||
Icon={IconGoogle}
|
||||
title={t`Connect with Google`}
|
||||
variant="secondary"
|
||||
onClick={() => triggerApisOAuth('google')}
|
||||
/>
|
||||
{(isGoogleMessagingEnabled || isGoogleCalendarEnabled) && (
|
||||
<Button
|
||||
Icon={IconGoogle}
|
||||
title={t`Connect with Google`}
|
||||
variant="secondary"
|
||||
onClick={() => triggerApisOAuth('google')}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Button
|
||||
Icon={IconMicrosoft}
|
||||
title={t`Connect with Microsoft`}
|
||||
variant="secondary"
|
||||
onClick={() => triggerApisOAuth('microsoft')}
|
||||
/>
|
||||
{(isMicrosoftMessagingEnabled || isMicrosoftCalendarEnabled) && (
|
||||
<Button
|
||||
Icon={IconMicrosoft}
|
||||
title={t`Connect with Microsoft`}
|
||||
variant="secondary"
|
||||
onClick={() => triggerApisOAuth('microsoft')}
|
||||
/>
|
||||
)}
|
||||
</StyledBody>
|
||||
</Card>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user