remove freeAccess user logic (#9866)
closes #9763 --------- Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
This commit is contained in:
@ -459,7 +459,6 @@ export enum FeatureFlagKey {
|
||||
IsCommandMenuV2Enabled = 'IsCommandMenuV2Enabled',
|
||||
IsCopilotEnabled = 'IsCopilotEnabled',
|
||||
IsEventObjectEnabled = 'IsEventObjectEnabled',
|
||||
IsFreeAccessEnabled = 'IsFreeAccessEnabled',
|
||||
IsJsonFilterEnabled = 'IsJsonFilterEnabled',
|
||||
IsLocalizationEnabled = 'IsLocalizationEnabled',
|
||||
IsMicrosoftSyncEnabled = 'IsMicrosoftSyncEnabled',
|
||||
|
||||
@ -391,7 +391,6 @@ export enum FeatureFlagKey {
|
||||
IsCommandMenuV2Enabled = 'IsCommandMenuV2Enabled',
|
||||
IsCopilotEnabled = 'IsCopilotEnabled',
|
||||
IsEventObjectEnabled = 'IsEventObjectEnabled',
|
||||
IsFreeAccessEnabled = 'IsFreeAccessEnabled',
|
||||
IsJsonFilterEnabled = 'IsJsonFilterEnabled',
|
||||
IsLocalizationEnabled = 'IsLocalizationEnabled',
|
||||
IsMicrosoftSyncEnabled = 'IsMicrosoftSyncEnabled',
|
||||
|
||||
@ -1,22 +1,16 @@
|
||||
import { useCreateAppRouter } from '@/app/hooks/useCreateAppRouter';
|
||||
import { currentUserState } from '@/auth/states/currentUserState';
|
||||
import { billingState } from '@/client-config/states/billingState';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { RouterProvider } from 'react-router-dom';
|
||||
import { useRecoilValue } from 'recoil';
|
||||
import { FeatureFlagKey } from '~/generated/graphql';
|
||||
|
||||
export const AppRouter = () => {
|
||||
const billing = useRecoilValue(billingState);
|
||||
const isFreeAccessEnabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IsFreeAccessEnabled,
|
||||
);
|
||||
|
||||
// We want to disable serverless function settings but keep the code for now
|
||||
const isFunctionSettingsEnabled = false;
|
||||
|
||||
const isBillingPageEnabled =
|
||||
billing?.isBillingEnabled && !isFreeAccessEnabled;
|
||||
const isBillingPageEnabled = billing?.isBillingEnabled;
|
||||
|
||||
const currentUser = useRecoilValue(currentUserState);
|
||||
|
||||
|
||||
@ -35,10 +35,8 @@ import { NavigationDrawerItemGroup } from '@/ui/navigation/navigation-drawer/com
|
||||
import { NavigationDrawerSection } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSection';
|
||||
import { NavigationDrawerSectionTitle } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle';
|
||||
import { getNavigationSubItemLeftAdornment } from '@/ui/navigation/navigation-drawer/utils/getNavigationSubItemLeftAdornment';
|
||||
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||
import { useLingui } from '@lingui/react/macro';
|
||||
import { matchPath, resolvePath, useLocation } from 'react-router-dom';
|
||||
import { FeatureFlagKey } from '~/generated/graphql';
|
||||
import { getSettingsPath } from '~/utils/navigation/getSettingsPath';
|
||||
|
||||
type SettingsNavigationItem = {
|
||||
@ -60,11 +58,7 @@ export const SettingsNavigationDrawerItems = () => {
|
||||
// for now
|
||||
const isFunctionSettingsEnabled = false;
|
||||
|
||||
const isFreeAccessEnabled = useIsFeatureEnabled(
|
||||
FeatureFlagKey.IsFreeAccessEnabled,
|
||||
);
|
||||
const isBillingPageEnabled =
|
||||
billing?.isBillingEnabled && !isFreeAccessEnabled;
|
||||
const isBillingPageEnabled = billing?.isBillingEnabled;
|
||||
|
||||
const currentUser = useRecoilValue(currentUserState);
|
||||
const isAdminPageEnabled = currentUser?.canImpersonate;
|
||||
|
||||
@ -8,7 +8,6 @@ import { BillingSubscription } from 'src/engine/core-modules/billing/entities/bi
|
||||
import { BillingEntitlementKey } from 'src/engine/core-modules/billing/enums/billing-entitlement-key.enum';
|
||||
import { BillingSubscriptionService } from 'src/engine/core-modules/billing/services/billing-subscription.service';
|
||||
import { EnvironmentService } from 'src/engine/core-modules/environment/environment.service';
|
||||
import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum';
|
||||
import { FeatureFlagService } from 'src/engine/core-modules/feature-flag/services/feature-flag.service';
|
||||
|
||||
@Injectable()
|
||||
@ -26,23 +25,13 @@ export class BillingService {
|
||||
return this.environmentService.get('IS_BILLING_ENABLED');
|
||||
}
|
||||
|
||||
async hasWorkspaceSubscriptionOrFreeAccess(workspaceId: string) {
|
||||
async hasWorkspaceAnySubscription(workspaceId: string) {
|
||||
const isBillingEnabled = this.isBillingEnabled();
|
||||
|
||||
if (!isBillingEnabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const isFreeAccessEnabled =
|
||||
await this.isFeatureEnabledService.isFeatureEnabled(
|
||||
FeatureFlagKey.IsFreeAccessEnabled,
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
if (isFreeAccessEnabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const subscription = await this.billingSubscriptionRepository.findOne({
|
||||
where: { workspaceId },
|
||||
});
|
||||
@ -50,7 +39,7 @@ export class BillingService {
|
||||
return isDefined(subscription);
|
||||
}
|
||||
|
||||
async hasFreeAccessOrEntitlement(
|
||||
async hasEntitlement(
|
||||
workspaceId: string,
|
||||
entitlementKey: BillingEntitlementKey,
|
||||
) {
|
||||
@ -60,16 +49,6 @@ export class BillingService {
|
||||
return true;
|
||||
}
|
||||
|
||||
const isFreeAccessEnabled =
|
||||
await this.isFeatureEnabledService.isFeatureEnabled(
|
||||
FeatureFlagKey.IsFreeAccessEnabled,
|
||||
workspaceId,
|
||||
);
|
||||
|
||||
if (isFreeAccessEnabled) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return this.billingSubscriptionService.getWorkspaceEntitlementByKey(
|
||||
workspaceId,
|
||||
entitlementKey,
|
||||
|
||||
@ -4,7 +4,6 @@ export enum FeatureFlagKey {
|
||||
IsPostgreSQLIntegrationEnabled = 'IS_POSTGRESQL_INTEGRATION_ENABLED',
|
||||
IsStripeIntegrationEnabled = 'IS_STRIPE_INTEGRATION_ENABLED',
|
||||
IsCopilotEnabled = 'IS_COPILOT_ENABLED',
|
||||
IsFreeAccessEnabled = 'IS_FREE_ACCESS_ENABLED',
|
||||
IsWorkflowEnabled = 'IS_WORKFLOW_ENABLED',
|
||||
IsAnalyticsV2Enabled = 'IS_ANALYTICS_V2_ENABLED',
|
||||
IsUniqueIndexesEnabled = 'IS_UNIQUE_INDEXES_ENABLED',
|
||||
|
||||
@ -28,12 +28,10 @@ export class OnboardingService {
|
||||
) {}
|
||||
|
||||
private async isSubscriptionIncompleteOnboardingStatus(workspace: Workspace) {
|
||||
const hasSubscription =
|
||||
await this.billingService.hasWorkspaceSubscriptionOrFreeAccess(
|
||||
workspace.id,
|
||||
);
|
||||
const hasAnySubscription =
|
||||
await this.billingService.hasWorkspaceAnySubscription(workspace.id);
|
||||
|
||||
return !hasSubscription;
|
||||
return !hasAnySubscription;
|
||||
}
|
||||
|
||||
private isWorkspaceActivationPending(workspace: Workspace) {
|
||||
|
||||
@ -35,11 +35,10 @@ export class SSOService {
|
||||
) {}
|
||||
|
||||
private async isSSOEnabled(workspaceId: string) {
|
||||
const isSSOBillingEnabled =
|
||||
await this.billingService.hasFreeAccessOrEntitlement(
|
||||
workspaceId,
|
||||
this.featureLookUpKey,
|
||||
);
|
||||
const isSSOBillingEnabled = await this.billingService.hasEntitlement(
|
||||
workspaceId,
|
||||
this.featureLookUpKey,
|
||||
);
|
||||
|
||||
if (!isSSOBillingEnabled) {
|
||||
throw new SSOException(
|
||||
|
||||
Reference in New Issue
Block a user