UNPKG

react-cookie-manager

Version:

🍪 The ultimate React cookie consent solution. Automatically block trackers, manage consent preferences, and protect user privacy with an elegant UI. Perfect for modern web applications.

42 lines 2.18 kB
import { CategoryDefinition, CookieCategories, DetailedCookieConsent } from '../types/types'; import { TFunction } from './translations'; /** * Resolves category configuration into the list the UI renders and the logic * iterates. The three built-ins always exist (kept for backward compatibility * and type safety); custom categories are appended. See the `categories` prop. */ export interface ResolvedCategory { id: string; title: string; description: string; essential: boolean; defaultConsent: boolean; trackerDomains: string[]; builtin: boolean; } export declare const BUILT_IN_IDS: string[]; /** * Merges the built-in categories with any user-supplied definitions and applies * `cookieCategories` visibility. Built-ins come first (in their canonical * order); custom categories follow in array order. Definitions with a built-in * `id` override that built-in's copy/domains. */ export declare const resolveCategories: (categories: CategoryDefinition[] | undefined, cookieCategories: CookieCategories | undefined, tFunction: TFunction) => ResolvedCategory[]; /** * The consent keys to track: the three built-ins always (type-safe / backward * compatible) plus any visible custom category ids. */ export declare const consentIdsFor: (resolved: ResolvedCategory[]) => string[]; /** Build a CookieCategories with every tracked id set to `consented`. */ export declare const buildPrefs: (ids: string[], consented: boolean) => CookieCategories; /** Initial per-category toggle values from each category's `defaultConsent`. */ export declare const defaultPrefsFor: (resolved: ResolvedCategory[]) => CookieCategories; /** Flatten DetailedCookieConsent into boolean prefs. */ export declare const consentToPrefs: (consent: DetailedCookieConsent) => CookieCategories; /** * Extra hosts/keywords to block: the `trackerDomains` of every non-essential * category that is currently declined. When no preferences exist yet, * everything is treated as declined (block until consent). */ export declare const customBlockedDomainsFor: (resolved: ResolvedCategory[], prefs: CookieCategories | null) => string[]; //# sourceMappingURL=categories.d.ts.map