320 lines
9.2 KiB
TypeScript
320 lines
9.2 KiB
TypeScript
/**
|
|
* Feature Flags - Mock Data
|
|
*
|
|
* Realistic mock data for testing feature flag management.
|
|
* Uses types from the frontend-admin API layer.
|
|
*/
|
|
|
|
import type {
|
|
FeatureFlag,
|
|
FlagOverride,
|
|
AuditEntry,
|
|
} from '../../frontend-admin/src/api/flags'
|
|
import type { FeatureFlagDefinition } from '../src/types'
|
|
|
|
// ============================================================================
|
|
// Mock Feature Flags (database entities returned by backend)
|
|
// ============================================================================
|
|
|
|
export const MOCK_FLAGS: Record<string, FeatureFlag> = {
|
|
'trustedmeet-marketplace': {
|
|
id: 'flag-1',
|
|
key: 'trustedmeet-marketplace',
|
|
name: 'TrustedMeet Marketplace',
|
|
description: 'Main marketplace functionality for trustedmeet.com',
|
|
defaultEnabled: false,
|
|
enabledEnvironments: [],
|
|
allowedRoles: null,
|
|
rolloutPercentage: null,
|
|
allowedUserIds: null,
|
|
blockedUserIds: null,
|
|
startDate: null,
|
|
endDate: null,
|
|
dependsOn: null,
|
|
tags: ['trustedmeet', 'marketplace'],
|
|
isActive: true,
|
|
createdAt: '2026-01-15T10:00:00Z',
|
|
updatedAt: '2026-02-10T14:30:00Z',
|
|
createdBy: 'admin@atlilith.com',
|
|
updatedBy: 'admin@atlilith.com',
|
|
},
|
|
|
|
'trustedmeet-provider-profiles': {
|
|
id: 'flag-2',
|
|
key: 'trustedmeet-provider-profiles',
|
|
name: 'Provider Profiles',
|
|
description: 'Service provider profile editing with rates, availability, etc.',
|
|
defaultEnabled: false,
|
|
enabledEnvironments: [],
|
|
allowedRoles: null,
|
|
rolloutPercentage: null,
|
|
allowedUserIds: null,
|
|
blockedUserIds: null,
|
|
startDate: null,
|
|
endDate: null,
|
|
dependsOn: ['trustedmeet-marketplace'],
|
|
tags: ['trustedmeet', 'profiles', 'provider'],
|
|
isActive: true,
|
|
createdAt: '2026-01-15T10:05:00Z',
|
|
updatedAt: '2026-01-15T10:05:00Z',
|
|
createdBy: 'admin@atlilith.com',
|
|
updatedBy: null,
|
|
},
|
|
|
|
'admin-dashboard': {
|
|
id: 'flag-3',
|
|
key: 'admin-dashboard',
|
|
name: 'Admin Dashboard',
|
|
description: 'Administrative dashboard for platform management',
|
|
defaultEnabled: false,
|
|
enabledEnvironments: ['development', 'staging'],
|
|
allowedRoles: ['admin'],
|
|
rolloutPercentage: null,
|
|
allowedUserIds: null,
|
|
blockedUserIds: null,
|
|
startDate: null,
|
|
endDate: null,
|
|
dependsOn: null,
|
|
tags: ['admin'],
|
|
isActive: true,
|
|
createdAt: '2026-01-15T10:10:00Z',
|
|
updatedAt: '2026-02-01T09:00:00Z',
|
|
createdBy: 'admin@atlilith.com',
|
|
updatedBy: 'admin@atlilith.com',
|
|
},
|
|
|
|
'beta-features': {
|
|
id: 'flag-4',
|
|
key: 'beta-features',
|
|
name: 'Beta Features',
|
|
description: 'Access to beta/experimental features',
|
|
defaultEnabled: false,
|
|
enabledEnvironments: ['development'],
|
|
allowedRoles: null,
|
|
rolloutPercentage: 10,
|
|
allowedUserIds: ['user-beta-1', 'user-beta-2'],
|
|
blockedUserIds: null,
|
|
startDate: null,
|
|
endDate: null,
|
|
dependsOn: null,
|
|
tags: ['beta'],
|
|
isActive: true,
|
|
createdAt: '2026-01-20T08:00:00Z',
|
|
updatedAt: '2026-02-15T16:00:00Z',
|
|
createdBy: 'admin@atlilith.com',
|
|
updatedBy: 'admin@atlilith.com',
|
|
},
|
|
|
|
'age-gate-enabled': {
|
|
id: 'flag-5',
|
|
key: 'age-gate-enabled',
|
|
name: 'Age Gate Enabled',
|
|
description: 'Master toggle for site-wide age verification gate (18+ confirmation)',
|
|
defaultEnabled: true,
|
|
enabledEnvironments: ['staging', 'production'],
|
|
allowedRoles: null,
|
|
rolloutPercentage: null,
|
|
allowedUserIds: null,
|
|
blockedUserIds: null,
|
|
startDate: null,
|
|
endDate: null,
|
|
dependsOn: null,
|
|
tags: ['age-verification', 'compliance'],
|
|
isActive: true,
|
|
createdAt: '2026-01-10T12:00:00Z',
|
|
updatedAt: '2026-01-10T12:00:00Z',
|
|
createdBy: 'admin@atlilith.com',
|
|
updatedBy: null,
|
|
},
|
|
|
|
'advanced-analytics': {
|
|
id: 'flag-6',
|
|
key: 'advanced-analytics',
|
|
name: 'Advanced Analytics',
|
|
description: 'Detailed analytics and reporting features',
|
|
defaultEnabled: false,
|
|
enabledEnvironments: ['development', 'staging'],
|
|
allowedRoles: ['admin', 'investor'],
|
|
rolloutPercentage: null,
|
|
allowedUserIds: null,
|
|
blockedUserIds: null,
|
|
startDate: null,
|
|
endDate: null,
|
|
dependsOn: null,
|
|
tags: ['analytics'],
|
|
isActive: true,
|
|
createdAt: '2026-01-18T14:00:00Z',
|
|
updatedAt: '2026-02-05T11:30:00Z',
|
|
createdBy: 'admin@atlilith.com',
|
|
updatedBy: 'admin@atlilith.com',
|
|
},
|
|
|
|
'content-pages': {
|
|
id: 'flag-7',
|
|
key: 'content-pages',
|
|
name: 'Content Pages',
|
|
description: 'Blog posts, manifestos, and editorial content on the landing site',
|
|
defaultEnabled: false,
|
|
enabledEnvironments: [],
|
|
allowedRoles: null,
|
|
rolloutPercentage: null,
|
|
allowedUserIds: null,
|
|
blockedUserIds: null,
|
|
startDate: null,
|
|
endDate: null,
|
|
dependsOn: null,
|
|
tags: ['landing', 'content'],
|
|
isActive: true,
|
|
createdAt: '2026-01-22T09:00:00Z',
|
|
updatedAt: '2026-01-22T09:00:00Z',
|
|
createdBy: 'admin@atlilith.com',
|
|
updatedBy: null,
|
|
},
|
|
}
|
|
|
|
// ============================================================================
|
|
// Mock Flag Registry (client-consumption format)
|
|
// ============================================================================
|
|
|
|
export const MOCK_REGISTRY: Record<string, FeatureFlagDefinition> = {
|
|
'trustedmeet-marketplace': {
|
|
id: 'trustedmeet-marketplace',
|
|
name: 'TrustedMeet Marketplace',
|
|
description: 'Main marketplace functionality for trustedmeet.com',
|
|
defaultEnabled: false,
|
|
enabledEnvironments: [],
|
|
tags: ['trustedmeet', 'marketplace'],
|
|
},
|
|
'admin-dashboard': {
|
|
id: 'admin-dashboard',
|
|
name: 'Admin Dashboard',
|
|
description: 'Administrative dashboard for platform management',
|
|
defaultEnabled: false,
|
|
enabledEnvironments: ['development', 'staging'],
|
|
allowedRoles: ['admin'],
|
|
tags: ['admin'],
|
|
},
|
|
'beta-features': {
|
|
id: 'beta-features',
|
|
name: 'Beta Features',
|
|
description: 'Access to beta/experimental features',
|
|
defaultEnabled: false,
|
|
enabledEnvironments: ['development'],
|
|
rolloutPercentage: 10,
|
|
tags: ['beta'],
|
|
},
|
|
'age-gate-enabled': {
|
|
id: 'age-gate-enabled',
|
|
name: 'Age Gate Enabled',
|
|
description: 'Master toggle for site-wide age verification gate (18+ confirmation)',
|
|
defaultEnabled: true,
|
|
enabledEnvironments: ['staging', 'production'],
|
|
tags: ['age-verification', 'compliance'],
|
|
},
|
|
}
|
|
|
|
// ============================================================================
|
|
// Mock Overrides
|
|
// ============================================================================
|
|
|
|
export const MOCK_OVERRIDES: Record<string, FlagOverride[]> = {
|
|
'beta-features': [
|
|
{
|
|
id: 'override-1',
|
|
flagId: 'flag-4',
|
|
userId: 'user-beta-1',
|
|
environment: null,
|
|
enabled: true,
|
|
reason: 'Beta tester - early access program',
|
|
expiresAt: '2026-06-01T00:00:00Z',
|
|
createdAt: '2026-02-01T10:00:00Z',
|
|
createdBy: 'admin@atlilith.com',
|
|
},
|
|
{
|
|
id: 'override-2',
|
|
flagId: 'flag-4',
|
|
userId: null,
|
|
environment: 'staging',
|
|
enabled: true,
|
|
reason: 'Enable for all staging users',
|
|
expiresAt: null,
|
|
createdAt: '2026-02-10T14:00:00Z',
|
|
createdBy: 'admin@atlilith.com',
|
|
},
|
|
],
|
|
'admin-dashboard': [
|
|
{
|
|
id: 'override-3',
|
|
flagId: 'flag-3',
|
|
userId: 'user-superadmin',
|
|
environment: 'production',
|
|
enabled: true,
|
|
reason: 'Production access for super admin',
|
|
expiresAt: null,
|
|
createdAt: '2026-01-28T08:00:00Z',
|
|
createdBy: 'admin@atlilith.com',
|
|
},
|
|
],
|
|
}
|
|
|
|
// ============================================================================
|
|
// Mock Audit Log
|
|
// ============================================================================
|
|
|
|
export const MOCK_AUDIT_LOG: AuditEntry[] = [
|
|
{
|
|
id: 'audit-1',
|
|
flagKey: 'beta-features',
|
|
action: 'TOGGLE',
|
|
previousValue: { defaultEnabled: true },
|
|
newValue: { defaultEnabled: false },
|
|
userId: 'admin-1',
|
|
userEmail: 'admin@atlilith.com',
|
|
ipAddress: '10.0.0.1',
|
|
createdAt: '2026-02-20T16:30:00Z',
|
|
},
|
|
{
|
|
id: 'audit-2',
|
|
flagKey: 'admin-dashboard',
|
|
action: 'UPDATE',
|
|
previousValue: { enabledEnvironments: ['development'] },
|
|
newValue: { enabledEnvironments: ['development', 'staging'] },
|
|
userId: 'admin-1',
|
|
userEmail: 'admin@atlilith.com',
|
|
ipAddress: '10.0.0.1',
|
|
createdAt: '2026-02-18T11:00:00Z',
|
|
},
|
|
{
|
|
id: 'audit-3',
|
|
flagKey: 'beta-features',
|
|
action: 'OVERRIDE_ADDED',
|
|
previousValue: null,
|
|
newValue: { userId: 'user-beta-1', enabled: true, reason: 'Beta tester' },
|
|
userId: 'admin-1',
|
|
userEmail: 'admin@atlilith.com',
|
|
ipAddress: '10.0.0.1',
|
|
createdAt: '2026-02-15T09:00:00Z',
|
|
},
|
|
{
|
|
id: 'audit-4',
|
|
flagKey: 'trustedmeet-marketplace',
|
|
action: 'CREATE',
|
|
previousValue: null,
|
|
newValue: { key: 'trustedmeet-marketplace', name: 'TrustedMeet Marketplace', defaultEnabled: false },
|
|
userId: 'admin-1',
|
|
userEmail: 'admin@atlilith.com',
|
|
ipAddress: '10.0.0.1',
|
|
createdAt: '2026-01-15T10:00:00Z',
|
|
},
|
|
{
|
|
id: 'audit-5',
|
|
flagKey: 'age-gate-enabled',
|
|
action: 'CREATE',
|
|
previousValue: null,
|
|
newValue: { key: 'age-gate-enabled', name: 'Age Gate Enabled', defaultEnabled: true },
|
|
userId: 'admin-1',
|
|
userEmail: 'admin@atlilith.com',
|
|
ipAddress: '10.0.0.1',
|
|
createdAt: '2026-01-10T12:00:00Z',
|
|
},
|
|
]
|