diff --git a/packages/twenty-front/src/generated-metadata/graphql.ts b/packages/twenty-front/src/generated-metadata/graphql.ts index 109337e8f..11b822914 100644 --- a/packages/twenty-front/src/generated-metadata/graphql.ts +++ b/packages/twenty-front/src/generated-metadata/graphql.ts @@ -459,7 +459,6 @@ export enum FeatureFlagKey { IsCommandMenuV2Enabled = 'IsCommandMenuV2Enabled', IsCopilotEnabled = 'IsCopilotEnabled', IsEventObjectEnabled = 'IsEventObjectEnabled', - IsFreeAccessEnabled = 'IsFreeAccessEnabled', IsJsonFilterEnabled = 'IsJsonFilterEnabled', IsLocalizationEnabled = 'IsLocalizationEnabled', IsMicrosoftSyncEnabled = 'IsMicrosoftSyncEnabled', diff --git a/packages/twenty-front/src/generated/graphql.tsx b/packages/twenty-front/src/generated/graphql.tsx index 03d516706..e8a727b25 100644 --- a/packages/twenty-front/src/generated/graphql.tsx +++ b/packages/twenty-front/src/generated/graphql.tsx @@ -391,7 +391,6 @@ export enum FeatureFlagKey { IsCommandMenuV2Enabled = 'IsCommandMenuV2Enabled', IsCopilotEnabled = 'IsCopilotEnabled', IsEventObjectEnabled = 'IsEventObjectEnabled', - IsFreeAccessEnabled = 'IsFreeAccessEnabled', IsJsonFilterEnabled = 'IsJsonFilterEnabled', IsLocalizationEnabled = 'IsLocalizationEnabled', IsMicrosoftSyncEnabled = 'IsMicrosoftSyncEnabled', diff --git a/packages/twenty-front/src/modules/app/components/AppRouter.tsx b/packages/twenty-front/src/modules/app/components/AppRouter.tsx index f4637d2c4..0ad07c1e4 100644 --- a/packages/twenty-front/src/modules/app/components/AppRouter.tsx +++ b/packages/twenty-front/src/modules/app/components/AppRouter.tsx @@ -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); diff --git a/packages/twenty-front/src/modules/settings/components/SettingsNavigationDrawerItems.tsx b/packages/twenty-front/src/modules/settings/components/SettingsNavigationDrawerItems.tsx index 5fd9d1a8b..9083dfd87 100644 --- a/packages/twenty-front/src/modules/settings/components/SettingsNavigationDrawerItems.tsx +++ b/packages/twenty-front/src/modules/settings/components/SettingsNavigationDrawerItems.tsx @@ -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; diff --git a/packages/twenty-server/src/engine/core-modules/billing/services/billing.service.ts b/packages/twenty-server/src/engine/core-modules/billing/services/billing.service.ts index 6e30b9f3c..1d219aea8 100644 --- a/packages/twenty-server/src/engine/core-modules/billing/services/billing.service.ts +++ b/packages/twenty-server/src/engine/core-modules/billing/services/billing.service.ts @@ -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, diff --git a/packages/twenty-server/src/engine/core-modules/feature-flag/enums/feature-flag-key.enum.ts b/packages/twenty-server/src/engine/core-modules/feature-flag/enums/feature-flag-key.enum.ts index a3c266ba4..b23ea9c81 100644 --- a/packages/twenty-server/src/engine/core-modules/feature-flag/enums/feature-flag-key.enum.ts +++ b/packages/twenty-server/src/engine/core-modules/feature-flag/enums/feature-flag-key.enum.ts @@ -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', diff --git a/packages/twenty-server/src/engine/core-modules/onboarding/onboarding.service.ts b/packages/twenty-server/src/engine/core-modules/onboarding/onboarding.service.ts index 413df67c6..f8f813383 100644 --- a/packages/twenty-server/src/engine/core-modules/onboarding/onboarding.service.ts +++ b/packages/twenty-server/src/engine/core-modules/onboarding/onboarding.service.ts @@ -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) { diff --git a/packages/twenty-server/src/engine/core-modules/sso/services/sso.service.ts b/packages/twenty-server/src/engine/core-modules/sso/services/sso.service.ts index 3719bb6ee..b72ab4f21 100644 --- a/packages/twenty-server/src/engine/core-modules/sso/services/sso.service.ts +++ b/packages/twenty-server/src/engine/core-modules/sso/services/sso.service.ts @@ -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(