Major changes: - Docker Compose: full Supabase stack (11 services) equivalent to supabase CLI - Fischerei module: 16 DB tables, waters/species/stocking/catch books/competitions - Sitzungsprotokolle module: meeting protocols, agenda items, task tracking - Verbandsverwaltung module: federation management, member clubs, contacts, fees - Per-account module activation via Modules page toggle - Site Builder: live CMS data in Puck blocks (courses, events, membership registration) - Public registration APIs: course signup, event registration, membership application - Document generation: PDF member cards, Excel reports, HTML labels - Landing page: real Com.BISS content (no filler text) - UX audit fixes: AccountNotFound component, shared status badges, confirm dialog, pagination, duplicate heading removal, emoji→badge replacement, a11y fixes - QA: healthcheck fix, API auth fix, enum mismatch fix, password required attribute
166 lines
4.9 KiB
TypeScript
166 lines
4.9 KiB
TypeScript
import * as z from 'zod';
|
|
|
|
type LanguagePriority = 'user' | 'application';
|
|
|
|
const FeatureFlagsSchema = z.object({
|
|
enableThemeToggle: z.boolean({
|
|
error: 'Provide the variable NEXT_PUBLIC_ENABLE_THEME_TOGGLE',
|
|
}),
|
|
enableAccountDeletion: z.boolean({
|
|
error: 'Provide the variable NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_DELETION',
|
|
}),
|
|
enableTeamDeletion: z.boolean({
|
|
error: 'Provide the variable NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_DELETION',
|
|
}),
|
|
enableTeamAccounts: z.boolean({
|
|
error: 'Provide the variable NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS',
|
|
}),
|
|
enableTeamCreation: z.boolean({
|
|
error: 'Provide the variable NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_CREATION',
|
|
}),
|
|
enablePersonalAccountBilling: z.boolean({
|
|
error: 'Provide the variable NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_BILLING',
|
|
}),
|
|
enableTeamAccountBilling: z.boolean({
|
|
error: 'Provide the variable NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_BILLING',
|
|
}),
|
|
languagePriority: z
|
|
.enum(['user', 'application'], {
|
|
error: 'Provide the variable NEXT_PUBLIC_LANGUAGE_PRIORITY',
|
|
})
|
|
.default('application'),
|
|
enableNotifications: z.boolean({
|
|
error: 'Provide the variable NEXT_PUBLIC_ENABLE_NOTIFICATIONS',
|
|
}),
|
|
realtimeNotifications: z.boolean({
|
|
error: 'Provide the variable NEXT_PUBLIC_REALTIME_NOTIFICATIONS',
|
|
}),
|
|
enableVersionUpdater: z.boolean({
|
|
error: 'Provide the variable NEXT_PUBLIC_ENABLE_VERSION_UPDATER',
|
|
}),
|
|
enableTeamsOnly: z.boolean({
|
|
error: 'Provide the variable NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_ONLY',
|
|
}),
|
|
// CMS feature flags
|
|
enableModuleBuilder: z.boolean().default(true),
|
|
enableMemberManagement: z.boolean().default(true),
|
|
enableCourseManagement: z.boolean().default(true),
|
|
enableBookingManagement: z.boolean().default(false),
|
|
enableSepaPayments: z.boolean().default(true),
|
|
enableDocumentGeneration: z.boolean().default(true),
|
|
enableNewsletter: z.boolean().default(true),
|
|
enableGdprCompliance: z.boolean().default(true),
|
|
enableSiteBuilder: z.boolean().default(true),
|
|
enableFischerei: z.boolean().default(false),
|
|
enableMeetingProtocols: z.boolean().default(false),
|
|
enableVerbandsverwaltung: z.boolean().default(false),
|
|
});
|
|
|
|
const featuresFlagConfig = FeatureFlagsSchema.parse({
|
|
enableThemeToggle: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_THEME_TOGGLE,
|
|
true,
|
|
),
|
|
enableAccountDeletion: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_DELETION,
|
|
false,
|
|
),
|
|
enableTeamDeletion: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_DELETION,
|
|
false,
|
|
),
|
|
enableTeamAccounts: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS,
|
|
true,
|
|
),
|
|
enableTeamCreation: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_CREATION,
|
|
true,
|
|
),
|
|
enablePersonalAccountBilling: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_PERSONAL_ACCOUNT_BILLING,
|
|
false,
|
|
),
|
|
enableTeamAccountBilling: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_BILLING,
|
|
false,
|
|
),
|
|
languagePriority: process.env
|
|
.NEXT_PUBLIC_LANGUAGE_PRIORITY as LanguagePriority,
|
|
enableNotifications: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_NOTIFICATIONS,
|
|
true,
|
|
),
|
|
realtimeNotifications: getBoolean(
|
|
process.env.NEXT_PUBLIC_REALTIME_NOTIFICATIONS,
|
|
false,
|
|
),
|
|
enableVersionUpdater: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_VERSION_UPDATER,
|
|
false,
|
|
),
|
|
enableTeamsOnly: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_TEAM_ACCOUNTS_ONLY,
|
|
false,
|
|
),
|
|
// CMS feature flags
|
|
enableModuleBuilder: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_MODULE_BUILDER,
|
|
true,
|
|
),
|
|
enableMemberManagement: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_MEMBER_MANAGEMENT,
|
|
true,
|
|
),
|
|
enableCourseManagement: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_COURSE_MANAGEMENT,
|
|
true,
|
|
),
|
|
enableBookingManagement: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_BOOKING_MANAGEMENT,
|
|
false,
|
|
),
|
|
enableSepaPayments: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_SEPA_PAYMENTS,
|
|
true,
|
|
),
|
|
enableDocumentGeneration: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_DOCUMENT_GENERATION,
|
|
true,
|
|
),
|
|
enableNewsletter: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_NEWSLETTER,
|
|
true,
|
|
),
|
|
enableGdprCompliance: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_GDPR_COMPLIANCE,
|
|
true,
|
|
),
|
|
enableSiteBuilder: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_SITE_BUILDER,
|
|
true,
|
|
),
|
|
enableFischerei: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_FISCHEREI,
|
|
false,
|
|
),
|
|
enableMeetingProtocols: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_MEETING_PROTOCOLS,
|
|
false,
|
|
),
|
|
enableVerbandsverwaltung: getBoolean(
|
|
process.env.NEXT_PUBLIC_ENABLE_VERBANDSVERWALTUNG,
|
|
false,
|
|
),
|
|
} satisfies z.output<typeof FeatureFlagsSchema>);
|
|
|
|
export default featuresFlagConfig;
|
|
|
|
function getBoolean(value: unknown, defaultValue: boolean) {
|
|
if (typeof value === 'string') {
|
|
return value === 'true';
|
|
}
|
|
|
|
return defaultValue;
|
|
}
|