2025-12-22 22:01:36 +00:00
|
|
|
/**
|
|
|
|
|
* Feature Flags Configuration
|
2026-01-13 18:47:57 +00:00
|
|
|
*
|
2025-12-22 22:01:36 +00:00
|
|
|
* Controls which features are enabled/disabled for MVP.
|
|
|
|
|
* Features marked as false are not yet implemented in the backend.
|
2026-01-13 18:47:57 +00:00
|
|
|
*
|
2026-02-11 21:11:38 +00:00
|
|
|
* All flags can be overridden via VITE_FEATURE_* env vars (see .env.example).
|
|
|
|
|
* Ghost features (Studio, Inventory, Education, Gamification, Live) are documented
|
|
|
|
|
* in docs/FEATURE_STATUS.md — UI exists but backend is missing or mock-only.
|
2025-12-22 22:01:36 +00:00
|
|
|
*/
|
|
|
|
|
|
2026-02-11 21:11:38 +00:00
|
|
|
function parseFeatureEnv(value: string | undefined, defaultValue: boolean): boolean {
|
|
|
|
|
if (value === undefined || value === '') return defaultValue;
|
|
|
|
|
const v = value.toLowerCase().trim();
|
|
|
|
|
return v === 'true' || v === '1' || v === 'yes';
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-22 22:01:36 +00:00
|
|
|
export const FEATURES = {
|
|
|
|
|
/**
|
|
|
|
|
* Two-Factor Authentication
|
2025-12-23 00:45:47 +00:00
|
|
|
* Backend endpoints: /auth/2fa/setup, /auth/2fa/verify, /auth/2fa/disable, /auth/2fa/status
|
2025-12-22 22:01:36 +00:00
|
|
|
*/
|
2026-02-11 21:11:38 +00:00
|
|
|
TWO_FACTOR_AUTH: parseFeatureEnv(
|
|
|
|
|
import.meta.env.VITE_FEATURE_TWO_FACTOR_AUTH,
|
|
|
|
|
true,
|
|
|
|
|
),
|
2025-12-22 22:01:36 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Playlist Collaboration Features
|
2025-12-23 00:46:43 +00:00
|
|
|
* Backend endpoints: /playlists/:id/collaborators (GET, POST, PUT, DELETE)
|
2025-12-22 22:01:36 +00:00
|
|
|
*/
|
2026-02-11 21:11:38 +00:00
|
|
|
PLAYLIST_COLLABORATION: parseFeatureEnv(
|
|
|
|
|
import.meta.env.VITE_FEATURE_PLAYLIST_COLLABORATION,
|
|
|
|
|
true,
|
|
|
|
|
),
|
Phase 2 stabilisation: code mort, Modal→Dialog, feature flags, tests, router split, Rust legacy
Bloc A - Code mort:
- Suppression Studio (components, views, features)
- Suppression gamification + services mock (projectService, storageService, gamificationService)
- Mise à jour Sidebar, Navbar, locales
Bloc B - Frontend:
- Suppression modal.tsx deprecated, Modal.stories (doublon Dialog)
- Feature flags: PLAYLIST_SEARCH, PLAYLIST_RECOMMENDATIONS, ROLE_MANAGEMENT = true
- Suppression 19 tests orphelins, retrait exclusions vitest.config
Bloc C - Backend:
- Extraction routes_auth.go depuis router.go
Bloc D - Rust:
- Suppression security_legacy.rs (code mort, patterns déjà dans security/)
2026-02-14 16:23:32 +00:00
|
|
|
PLAYLIST_SEARCH: parseFeatureEnv(
|
|
|
|
|
import.meta.env.VITE_FEATURE_PLAYLIST_SEARCH,
|
|
|
|
|
true,
|
|
|
|
|
),
|
2026-02-11 21:11:38 +00:00
|
|
|
PLAYLIST_SHARE: parseFeatureEnv(
|
|
|
|
|
import.meta.env.VITE_FEATURE_PLAYLIST_SHARE,
|
2026-02-12 21:48:50 +00:00
|
|
|
true,
|
2026-02-11 21:11:38 +00:00
|
|
|
),
|
|
|
|
|
PLAYLIST_RECOMMENDATIONS: parseFeatureEnv(
|
|
|
|
|
import.meta.env.VITE_FEATURE_PLAYLIST_RECOMMENDATIONS,
|
Phase 2 stabilisation: code mort, Modal→Dialog, feature flags, tests, router split, Rust legacy
Bloc A - Code mort:
- Suppression Studio (components, views, features)
- Suppression gamification + services mock (projectService, storageService, gamificationService)
- Mise à jour Sidebar, Navbar, locales
Bloc B - Frontend:
- Suppression modal.tsx deprecated, Modal.stories (doublon Dialog)
- Feature flags: PLAYLIST_SEARCH, PLAYLIST_RECOMMENDATIONS, ROLE_MANAGEMENT = true
- Suppression 19 tests orphelins, retrait exclusions vitest.config
Bloc C - Backend:
- Extraction routes_auth.go depuis router.go
Bloc D - Rust:
- Suppression security_legacy.rs (code mort, patterns déjà dans security/)
2026-02-14 16:23:32 +00:00
|
|
|
true,
|
2026-02-11 21:11:38 +00:00
|
|
|
),
|
2025-12-22 22:01:36 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* HLS Streaming
|
|
|
|
|
* Backend endpoints: /api/v1/tracks/:id/hls/info, /api/v1/tracks/:id/hls/status (NOT IMPLEMENTED)
|
|
|
|
|
*/
|
2026-02-11 21:11:38 +00:00
|
|
|
HLS_STREAMING: parseFeatureEnv(
|
|
|
|
|
import.meta.env.VITE_FEATURE_HLS_STREAMING,
|
|
|
|
|
false,
|
|
|
|
|
),
|
2025-12-22 22:01:36 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Role Management
|
|
|
|
|
* Backend endpoints: /api/v1/users/:userId/roles, /api/v1/roles/* (NOT IMPLEMENTED)
|
|
|
|
|
*/
|
2026-02-11 21:11:38 +00:00
|
|
|
ROLE_MANAGEMENT: parseFeatureEnv(
|
|
|
|
|
import.meta.env.VITE_FEATURE_ROLE_MANAGEMENT,
|
Phase 2 stabilisation: code mort, Modal→Dialog, feature flags, tests, router split, Rust legacy
Bloc A - Code mort:
- Suppression Studio (components, views, features)
- Suppression gamification + services mock (projectService, storageService, gamificationService)
- Mise à jour Sidebar, Navbar, locales
Bloc B - Frontend:
- Suppression modal.tsx deprecated, Modal.stories (doublon Dialog)
- Feature flags: PLAYLIST_SEARCH, PLAYLIST_RECOMMENDATIONS, ROLE_MANAGEMENT = true
- Suppression 19 tests orphelins, retrait exclusions vitest.config
Bloc C - Backend:
- Extraction routes_auth.go depuis router.go
Bloc D - Rust:
- Suppression security_legacy.rs (code mort, patterns déjà dans security/)
2026-02-14 16:23:32 +00:00
|
|
|
true,
|
2026-02-11 21:11:38 +00:00
|
|
|
),
|
2025-12-22 22:01:36 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Notifications API
|
2026-02-12 21:48:50 +00:00
|
|
|
* Backend endpoints: /api/v1/notifications/*
|
2025-12-22 22:01:36 +00:00
|
|
|
*/
|
2026-02-11 21:11:38 +00:00
|
|
|
NOTIFICATIONS: parseFeatureEnv(
|
|
|
|
|
import.meta.env.VITE_FEATURE_NOTIFICATIONS,
|
2026-02-12 21:48:50 +00:00
|
|
|
true,
|
2026-02-11 21:11:38 +00:00
|
|
|
),
|
2025-12-22 22:01:36 +00:00
|
|
|
} as const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Type for feature flags
|
|
|
|
|
*/
|
|
|
|
|
export type FeatureFlag = keyof typeof FEATURES;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Check if a feature is enabled
|
|
|
|
|
*/
|
|
|
|
|
export function isFeatureEnabled(feature: FeatureFlag): boolean {
|
|
|
|
|
return Boolean(FEATURES[feature]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Assert that a feature is enabled, throw error if not
|
|
|
|
|
*/
|
|
|
|
|
export function requireFeature(feature: FeatureFlag): void {
|
|
|
|
|
if (!isFeatureEnabled(feature)) {
|
|
|
|
|
throw new Error(
|
|
|
|
|
`Feature "${feature}" is not enabled. This feature is not available in the MVP.`,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|