Deprecate dummy enterprise key 1/2 (#20890)
Remove usage of hasValidEnterpriseKey in FE (replaced by hasValidSignedEnterpriseKey) To avoid breaking change at deploy time, we will wait until after this has been deployed in prod, to remove hasValidEnterpriseKey in the BE.
This commit is contained in:
@@ -2,12 +2,12 @@ import { gql, InMemoryCache } from '@apollo/client';
|
||||
import { CombinedGraphQLErrors } from '@apollo/client/errors';
|
||||
import fetchMock, { enableFetchMocks } from 'jest-fetch-mock';
|
||||
|
||||
import { ApolloFactory, type Options } from '@/apollo/services/apollo.factory';
|
||||
import { CUSTOM_WORKSPACE_APPLICATION_MOCK } from '@/object-metadata/hooks/__tests__/constants/CustomWorkspaceApplicationMock.test.constant';
|
||||
import {
|
||||
AUTO_SELECT_FAST_MODEL_ID,
|
||||
AUTO_SELECT_SMART_MODEL_ID,
|
||||
} from 'twenty-shared/constants';
|
||||
import { ApolloFactory, type Options } from '@/apollo/services/apollo.factory';
|
||||
import { CUSTOM_WORKSPACE_APPLICATION_MOCK } from '@/object-metadata/hooks/__tests__/constants/CustomWorkspaceApplicationMock.test.constant';
|
||||
import { WorkspaceActivationStatus } from '~/generated-metadata/graphql';
|
||||
|
||||
enableFetchMocks();
|
||||
@@ -67,7 +67,6 @@ const mockWorkspace = {
|
||||
isGoogleAuthBypassEnabled: false,
|
||||
isPasswordAuthBypassEnabled: false,
|
||||
isMicrosoftAuthBypassEnabled: false,
|
||||
hasValidEnterpriseKey: false,
|
||||
hasActivatedAndValidEnterpriseKey: false,
|
||||
hasValidSignedEnterpriseKey: false,
|
||||
hasValidEnterpriseValidityToken: false,
|
||||
|
||||
@@ -26,7 +26,6 @@ export type CurrentWorkspace = Pick<
|
||||
| 'isPasswordAuthEnabled'
|
||||
| 'isPasswordAuthBypassEnabled'
|
||||
| 'isCustomDomainEnabled'
|
||||
| 'hasValidEnterpriseKey'
|
||||
| 'hasValidSignedEnterpriseKey'
|
||||
| 'hasValidEnterpriseValidityToken'
|
||||
| 'subdomain'
|
||||
|
||||
-2
@@ -6,7 +6,6 @@ import { InformationBannerBillingSubscriptionPaused } from '@/information-banner
|
||||
import { InformationBannerEndTrialPeriod } from '@/information-banner/components/billing/InformationBannerEndTrialPeriod';
|
||||
import { InformationBannerFailPaymentInfo } from '@/information-banner/components/billing/InformationBannerFailPaymentInfo';
|
||||
import { InformationBannerNoBillingSubscription } from '@/information-banner/components/billing/InformationBannerNoBillingSubscription';
|
||||
import { InformationBannerInvalidEnterpriseKey } from '@/information-banner/components/enterprise/InformationBannerInvalidEnterpriseKey';
|
||||
import { InformationBannerMaintenance } from '@/information-banner/components/maintenance/InformationBannerMaintenance';
|
||||
import { InformationBannerReconnectAccountEmailAliases } from '@/information-banner/components/reconnect-account/InformationBannerReconnectAccountEmailAliases';
|
||||
import { InformationBannerReconnectAccountInsufficientPermissions } from '@/information-banner/components/reconnect-account/InformationBannerReconnectAccountInsufficientPermissions';
|
||||
@@ -65,7 +64,6 @@ export const InformationBannerWrapper = () => {
|
||||
return (
|
||||
<StyledInformationBannerWrapper>
|
||||
<InformationBannerMaintenance />
|
||||
<InformationBannerInvalidEnterpriseKey />
|
||||
{isAccountSyncEnabled && (
|
||||
<InformationBannerReconnectAccountInsufficientPermissions />
|
||||
)}
|
||||
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||
import { InformationBanner } from '@/information-banner/components/InformationBanner';
|
||||
import { informationBannerIsOpenComponentState } from '@/information-banner/states/informationBannerIsOpenComponentState';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { useSetAtomComponentState } from '@/ui/utilities/state/jotai/hooks/useSetAtomComponentState';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { SettingsPath } from 'twenty-shared/types';
|
||||
import { getSettingsPath } from 'twenty-shared/utils';
|
||||
import { IconKey } from 'twenty-ui/display';
|
||||
|
||||
const COMPONENT_INSTANCE_ID = 'information-banner-invalid-enterprise-key';
|
||||
|
||||
export const InformationBannerInvalidEnterpriseKey = () => {
|
||||
const { t } = useLingui();
|
||||
const navigate = useNavigate();
|
||||
const currentWorkspace = useAtomStateValue(currentWorkspaceState);
|
||||
|
||||
const setInformationBannerIsOpen = useSetAtomComponentState(
|
||||
informationBannerIsOpenComponentState,
|
||||
COMPONENT_INSTANCE_ID,
|
||||
);
|
||||
|
||||
const hasInvalidKey =
|
||||
currentWorkspace?.hasValidEnterpriseKey === true &&
|
||||
currentWorkspace?.hasValidSignedEnterpriseKey !== true &&
|
||||
currentWorkspace?.hasValidEnterpriseValidityToken !== true;
|
||||
|
||||
if (!hasInvalidKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<InformationBanner
|
||||
componentInstanceId={COMPONENT_INSTANCE_ID}
|
||||
variant="secondary"
|
||||
message={t`Your enterprise key is no longer valid. Activate a new key to continue using enterprise features.`}
|
||||
buttonTitle={t`Activate`}
|
||||
buttonIcon={IconKey}
|
||||
buttonOnClick={() =>
|
||||
navigate(getSettingsPath(SettingsPath.AdminPanelEnterprise))
|
||||
}
|
||||
onClose={() => setInformationBannerIsOpen(false)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
-1
@@ -161,7 +161,6 @@ export const responseData = {
|
||||
allowImpersonation: false,
|
||||
activationStatus: 'active',
|
||||
isPublicInviteLinkEnabled: false,
|
||||
hasValidEnterpriseKey: false,
|
||||
hasValidSignedEnterpriseKey: false,
|
||||
hasValidEnterpriseValidityToken: false,
|
||||
isGoogleAuthEnabled: true,
|
||||
|
||||
+8
-8
@@ -4,19 +4,19 @@ import { Link } from 'react-router-dom';
|
||||
|
||||
import { SettingsPath } from 'twenty-shared/types';
|
||||
|
||||
import { useSnackBarOnQueryError } from '@/apollo/hooks/useSnackBarOnQueryError';
|
||||
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||
import { SettingsCard } from '@/settings/components/SettingsCard';
|
||||
import { SettingsSSOIdentitiesProvidersListCardWrapper } from '@/settings/security/components/SSO/SettingsSSOIdentitiesProvidersListCardWrapper';
|
||||
import { SSOIdentitiesProvidersState } from '@/settings/security/states/SSOIdentitiesProvidersState';
|
||||
import { useSnackBarOnQueryError } from '@/apollo/hooks/useSnackBarOnQueryError';
|
||||
import { styled } from '@linaria/react';
|
||||
import { useEffect } from 'react';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { useQuery } from '@apollo/client/react';
|
||||
import { styled } from '@linaria/react';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { useEffect } from 'react';
|
||||
import { getSettingsPath } from 'twenty-shared/utils';
|
||||
import { IconKey } from 'twenty-ui/display';
|
||||
import { useQuery } from '@apollo/client/react';
|
||||
import { GetSsoIdentityProvidersDocument } from '~/generated-metadata/graphql';
|
||||
|
||||
const StyledLinkContainer = styled.div<{ isDisabled: boolean }>`
|
||||
@@ -42,7 +42,7 @@ export const SettingsSSOIdentitiesProvidersListCard = () => {
|
||||
error: ssoError,
|
||||
} = useQuery(GetSsoIdentityProvidersDocument, {
|
||||
fetchPolicy: 'network-only',
|
||||
skip: currentWorkspace?.hasValidEnterpriseKey === false,
|
||||
skip: currentWorkspace?.hasValidSignedEnterpriseKey === false,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
@@ -55,12 +55,12 @@ export const SettingsSSOIdentitiesProvidersListCard = () => {
|
||||
|
||||
return loading || !SSOIdentitiesProviders.length ? (
|
||||
<StyledLinkContainer
|
||||
isDisabled={currentWorkspace?.hasValidEnterpriseKey !== true}
|
||||
isDisabled={currentWorkspace?.hasValidSignedEnterpriseKey !== true}
|
||||
>
|
||||
<Link to={getSettingsPath(SettingsPath.NewSSOIdentityProvider)}>
|
||||
<SettingsCard
|
||||
title={t`Add SSO Identity Provider`}
|
||||
disabled={currentWorkspace?.hasValidEnterpriseKey !== true}
|
||||
disabled={currentWorkspace?.hasValidSignedEnterpriseKey !== true}
|
||||
Icon={<IconKey />}
|
||||
/>
|
||||
</Link>
|
||||
|
||||
@@ -60,7 +60,6 @@ export const USER_QUERY_FRAGMENT = gql`
|
||||
isPasswordAuthBypassEnabled
|
||||
subdomain
|
||||
customDomain
|
||||
hasValidEnterpriseKey
|
||||
hasValidSignedEnterpriseKey
|
||||
hasValidEnterpriseValidityToken
|
||||
workspaceCustomApplication {
|
||||
|
||||
Reference in New Issue
Block a user