36 lines
1 KiB
TypeScript
36 lines
1 KiB
TypeScript
import { z } from "zod";
|
|
|
|
export const DATA_PRIVACY_NOTICE_VERSION = "2026-06-11";
|
|
|
|
export const dataPrivacyConsentContextValues = [
|
|
"register_account",
|
|
"save_profile",
|
|
"create_request",
|
|
"update_request",
|
|
] as const;
|
|
|
|
export type DataPrivacyConsentContext = (typeof dataPrivacyConsentContextValues)[number];
|
|
|
|
export const dataPrivacyConsentContextLabels: Record<DataPrivacyConsentContext, string> = {
|
|
register_account: "Création de compte",
|
|
save_profile: "Enregistrement de la fiche association",
|
|
create_request: "Création d'une demande",
|
|
update_request: "Mise à jour d'une demande",
|
|
};
|
|
|
|
export const dataPrivacyConsentSchema = z.object({
|
|
accepted: z.literal(true),
|
|
version: z.string().min(1),
|
|
context: z.enum(dataPrivacyConsentContextValues),
|
|
});
|
|
|
|
export type DataPrivacyConsent = z.infer<typeof dataPrivacyConsentSchema>;
|
|
|
|
export function buildDataPrivacyConsent(context: DataPrivacyConsentContext): DataPrivacyConsent {
|
|
return {
|
|
accepted: true,
|
|
version: DATA_PRIVACY_NOTICE_VERSION,
|
|
context,
|
|
};
|
|
}
|
|
|