Type registrations, email and WhatsApp messaging pages

Adds typed payloads and results for the email/WhatsApp attendee and
broadcast endpoints. The WhatsApp page's messageDirty flag becomes a ref
(it only gated the template effect), and a no-op branch in the email
template effect is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 11:10:01 +02:00
co-authored by Claude Opus 5.5
parent b2439a781e
commit b560d0d340
6 changed files with 196 additions and 174 deletions
@@ -298,8 +298,8 @@ export default function FormsBrowserPage() {
setFormDef({ isRequired: false, fields: [] });
}
setFormLoadedFor(eventId);
} catch (e:any) {
setError(e?.message || 'Failed to load form');
} catch (e) {
setError(errorMessage(e) || 'Failed to load form');
} finally {
setFormLoading(false);
}
@@ -318,8 +318,8 @@ export default function FormsBrowserPage() {
const fields = (formDef.fields || []).filter(f => (f.label || '').trim().length > 0).map((f, i) => ({ type: f.type, label: f.label, isRequired: !!f.isRequired && f.type !== 'statement' && f.type !== 'paragraph', order: i, helpText: f.helpText || null, options: f.type === 'multiple_choice' && Array.isArray(f.options) ? f.options.map((o: any) => String(o).trim()).filter(Boolean) : undefined }));
await apiFetch(`/api/events/${encodeURIComponent(selectedEventId)}`, { method: 'PUT', authToken: token, body: { form: { isRequired: !!formDef.isRequired, fields } } });
setInfo('Form saved');
} catch (e:any) {
setError(e?.message || 'Failed to save form');
} catch (e) {
setError(errorMessage(e) || 'Failed to save form');
}
};
@@ -375,8 +375,8 @@ export default function FormsBrowserPage() {
const resList = await apiFetch<any>(`/api/forms/responses?registrationId=${encodeURIComponent(fillRegistrationId)}`, { authToken: token! });
const items = Array.isArray(resList?.items) ? resList.items : (Array.isArray(resList) ? resList : []);
setExistingResponses(items);
} catch (e:any) {
setError(e?.message || 'Failed to load registration/form');
} catch (e) {
setError(errorMessage(e) || 'Failed to load registration/form');
}
})();
}, [fillRegistrationId, mode]);
@@ -435,8 +435,8 @@ export default function FormsBrowserPage() {
const resList = await apiFetch<any>(`/api/forms/responses?registrationId=${encodeURIComponent(fillRegistrationId)}`, { authToken: token! });
const items = Array.isArray(resList?.items) ? resList.items : (Array.isArray(resList) ? resList : []);
setExistingResponses(items);
} catch (e:any) {
setError(e?.message || 'Failed to save responses');
} catch (e) {
setError(errorMessage(e) || 'Failed to save responses');
} finally {
setSavingFill(false);
}