@@ -10,6 +10,7 @@ import { CLEANUP_CONFIG } from '@/lib/billing/cleanup-dispatcher'
1010import { getHighestPrioritySubscription } from '@/lib/billing/core/plan'
1111import { isEnterprisePlan } from '@/lib/billing/core/subscription'
1212import { getPlanType , type PlanCategory } from '@/lib/billing/plan-helpers'
13+ import { isBillingEnabled } from '@/lib/core/config/feature-flags'
1314import { getUserEntityPermissions } from '@/lib/workspaces/permissions/utils'
1415import { getWorkspaceBilledAccountUserId } from '@/lib/workspaces/utils'
1516
@@ -79,7 +80,7 @@ export async function GET(_request: NextRequest, { params }: { params: Promise<{
7980
8081 const plan = await resolveWorkspacePlan ( ws . billedAccountUserId )
8182 const defaults = getPlanDefaults ( plan )
82- const isEnterpriseWorkspace = plan === 'enterprise'
83+ const isEnterpriseWorkspace = ! isBillingEnabled || plan === 'enterprise'
8384
8485 return NextResponse . json ( {
8586 success : true ,
@@ -135,12 +136,14 @@ export async function PUT(request: NextRequest, { params }: { params: Promise<{
135136 return NextResponse . json ( { error : 'Workspace not found' } , { status : 404 } )
136137 }
137138
138- const hasEnterprise = await isEnterprisePlan ( billedAccountUserId )
139- if ( ! hasEnterprise ) {
140- return NextResponse . json (
141- { error : 'Data Retention configuration is available on Enterprise plans only' } ,
142- { status : 403 }
143- )
139+ if ( isBillingEnabled ) {
140+ const hasEnterprise = await isEnterprisePlan ( billedAccountUserId )
141+ if ( ! hasEnterprise ) {
142+ return NextResponse . json (
143+ { error : 'Data Retention configuration is available on Enterprise plans only' } ,
144+ { status : 403 }
145+ )
146+ }
144147 }
145148
146149 const body = await request . json ( )
0 commit comments