/** * Plan Feature Value Object * * Defines the features available per subscription plan. * Used by the FeatureFlagGuard to enforce access control. */ export type PlanFeature = | 'dashboard' | 'wiki' | 'user_management' | 'csv_export' | 'api_access' | 'custom_interface' | 'dedicated_kam'; export const ALL_PLAN_FEATURES: readonly PlanFeature[] = [ 'dashboard', 'wiki', 'user_management', 'csv_export', 'api_access', 'custom_interface', 'dedicated_kam', ]; export type SubscriptionPlanTypeForFeatures = 'BRONZE' | 'SILVER' | 'GOLD' | 'PLATINIUM'; export const PLAN_FEATURES: Record = { BRONZE: [], SILVER: ['dashboard', 'wiki', 'user_management', 'csv_export'], GOLD: ['dashboard', 'wiki', 'user_management', 'csv_export', 'api_access'], PLATINIUM: [ 'dashboard', 'wiki', 'user_management', 'csv_export', 'api_access', 'custom_interface', 'dedicated_kam', ], }; export function planHasFeature( plan: SubscriptionPlanTypeForFeatures, feature: PlanFeature ): boolean { return PLAN_FEATURES[plan].includes(feature); } export function planGetFeatures(plan: SubscriptionPlanTypeForFeatures): readonly PlanFeature[] { return PLAN_FEATURES[plan]; }