Opens the contact form through a build switch instead of the TEST ONLY commit; closes the AI-DLC records
Continuous Integration / check (pull_request) Successful in 2m25s
Continuous Integration / build-test (pull_request) Skipped
Continuous Integration / deploy-test (pull_request) Skipped
Continuous Integration / lighthouse (pull_request) Successful in 9m2s
Continuous Integration / deploy-production (pull_request) Skipped

The form is closed unless the build sets VITE_CONTACT_FORM_ENABLED=true (only
the test build does), so d449e76 no longer has to be undone before the merge.
Status files of contact-form-cms, asf-packages-cms, asf-cms-host-injection and
asf-translation-files are closed; Build and Test summary added.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-16 12:01:29 +01:00
co-authored by Claude Sonnet 5.5
parent e7bae5edd7
commit db86332c1f
19 changed files with 209 additions and 45 deletions
+23
View File
@@ -0,0 +1,23 @@
import { afterEach, describe, expect, it, vi } from 'vitest';
import { configuredContactFormEnabled } from './contactFormEnv';
describe('configuredContactFormEnabled', () => {
afterEach(() => {
vi.unstubAllEnvs();
});
it('is closed when nothing is set', () => {
vi.stubEnv('VITE_CONTACT_FORM_ENABLED', undefined as unknown as string);
expect(configuredContactFormEnabled()).toBe(false);
});
it('is open when the build sets it to true', () => {
vi.stubEnv('VITE_CONTACT_FORM_ENABLED', 'true');
expect(configuredContactFormEnabled()).toBe(true);
});
it('is closed for any other value', () => {
vi.stubEnv('VITE_CONTACT_FORM_ENABLED', 'false');
expect(configuredContactFormEnabled()).toBe(false);
});
});
+16
View File
@@ -0,0 +1,16 @@
import { resolveContactFormEnabled } from './lib/contactFormFlag.ts';
// The one place that touches the environment for the contact form switch (see
// lib/contactFormFlag.ts). In the Vite build (client and prerender) the value
// is substituted in `import.meta.env`; scripts that run under plain Node get
// it from the process environment.
export function configuredContactFormEnabled(): boolean {
const fromVite = import.meta.env?.VITE_CONTACT_FORM_ENABLED as unknown;
const configured =
fromVite !== undefined
? fromVite
: typeof process === 'undefined'
? undefined
: process.env.VITE_CONTACT_FORM_ENABLED;
return resolveContactFormEnabled(configured);
}
+7 -2
View File
@@ -1,4 +1,5 @@
import { t } from '../i18n/index.ts';
import { configuredContactFormEnabled } from '../contactFormEnv.ts';
import type { SiteContent } from './types';
// Site-brede content tot de CMS-API er is. Daarna komt dit object uit de API.
@@ -19,8 +20,12 @@ const siteContent: SiteContent = {
},
],
email: { user: 'info', domain: 'andreaslop.nl' },
// Switched on once the API can receive the form
contactForm: { enabled: true, replyTime: t('site.info.replyTime') },
// Closed unless the build sets VITE_CONTACT_FORM_ENABLED=true (the test
// build does; production needs Bryan's explicit go)
contactForm: {
enabled: configuredContactFormEnabled(),
replyTime: t('site.info.replyTime'),
},
// Huizen and the region around it (Bussum, Hilversum, …), as the pages
// say; not the whole country, which would weaken the local signal
serviceArea: [
+23
View File
@@ -0,0 +1,23 @@
import { describe, expect, it } from 'vitest';
import { resolveContactFormEnabled } from './contactFormFlag';
describe('resolveContactFormEnabled', () => {
it('opens the form only for the exact value "true"', () => {
expect(resolveContactFormEnabled('true')).toBe(true);
});
it.each([
'TRUE',
'True',
'1',
'yes',
'false',
'',
' true',
undefined,
null,
true,
])('keeps the form closed for %j', (value) => {
expect(resolveContactFormEnabled(value)).toBe(false);
});
});
+8
View File
@@ -0,0 +1,8 @@
// Whether the contact form is open. The form stays closed unless a build says
// otherwise through VITE_CONTACT_FORM_ENABLED=true (only the test build does;
// read in contactFormEnv.ts). Anything else, or nothing, keeps it closed, so a
// typo can never open the form in production. Opening it there needs Bryan's
// explicit go (see docs/go-live-checklist.md).
export function resolveContactFormEnabled(configured: unknown): boolean {
return configured === 'true';
}