All files / apps/huella-legal/layers/tracking/app/utils consentTranslation.ts

100% Statements 3/3
100% Branches 0/0
100% Functions 2/2
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44          39x       3x                                             2x                      
import type { Translation } from "vanilla-cookieconsent";
import type { ConsentCategory } from "../types/Tracker";
 
type Translate = (key: string) => string;
 
export const consentTranslation = (
    t: Translate,
    categories: ConsentCategory[],
    policyHref: string,
): Translation => ({
    consentModal: {
        label: t("cookieConsent.banner.title"),
        title: t("cookieConsent.banner.title"),
        description: t("cookieConsent.banner.description"),
        acceptAllBtn: t("cookieConsent.actions.acceptAll"),
        acceptNecessaryBtn: t("cookieConsent.actions.reject"),
        showPreferencesBtn: t("cookieConsent.actions.configure"),
        footer: `<a href="${policyHref}">${t("cookieConsent.policy")}</a>`,
    },
    preferencesModal: {
        title: t("cookieConsent.preferences.title"),
        acceptAllBtn: t("cookieConsent.actions.acceptAll"),
        acceptNecessaryBtn: t("cookieConsent.actions.reject"),
        savePreferencesBtn: t("cookieConsent.actions.save"),
        closeIconLabel: t("cookieConsent.actions.close"),
        sections: [
            { description: t("cookieConsent.preferences.intro") },
            {
                title: t("cookieConsent.preferences.categories.necessary.title"),
                description: t("cookieConsent.preferences.categories.necessary.description"),
                linkedCategory: "necessary",
            },
            ...categories.map((category) => ({
                title: t(`cookieConsent.preferences.categories.${category}.title`),
                description: t(`cookieConsent.preferences.categories.${category}.description`),
                linkedCategory: category,
            })),
            {
                description: `${t("cookieConsent.preferences.more")} <a href="${policyHref}">${t("cookieConsent.policy")}</a>.`,
            },
        ],
    },
});