import CookieConsent, { CookieConsentConfig, CookieValue } from 'vanilla-cookieconsent'; import { CookieConsentCategory, DisplayMode, KnownCookieName } from '../constants'; export type Values = T[keyof T]; export type CookieConsentCategoryValues = Values; export type CategoriesChangeset = { accepted: CookieConsentCategoryValues[]; rejected: CookieConsentCategoryValues[]; changed: CookieConsentCategoryValues[]; }; export type OnFirstConsentCallback = (param: { cookieConsent: typeof CookieConsent; cookie: CookieValue; }) => void; export type OnConsentCallback = (param: { cookieConsent: typeof CookieConsent; cookie: CookieValue; }) => void; export type OnChangeCallback = (param: { cookieConsent: typeof CookieConsent; cookie: CookieValue; categories: CategoriesChangeset; }) => void; declare const SUPPORTED_LANGUAGES: readonly ["bs", "cs", "de", "en", "es", "et", "fr", "hr", "hu", "lt", "lv", "mk", "pl", "pt", "ro", "ru", "sk", "sl", "sr", "uk"]; export type SupportedLanguage = (typeof SUPPORTED_LANGUAGES)[number]; export declare const isSupportedLanguage: (lang: string) => lang is SupportedLanguage; export type TranslationOverride = { consentTitle?: string; descriptionIntro?: string; preferencesModalMoreInfo?: string; }; export type CookieTableCategories = { [category in CookieConsentCategoryValues]: { [p: string]: string; }[]; }; export type CookieTable = { [language: string]: CookieTableCategories; }; export type Expiration = { years: number; } | { months: number; } | { days: number; } | { hours: number; } | 'Session'; /** * A cookie from the predefined dictionary. Only `name` (one of the known glob patterns) * and `expire` are required — descriptions are resolved internally. */ export type PredefinedCookie = { name: KnownCookieName; expire: Expiration; }; /** * A cookie not in the predefined dictionary. Requires full metadata. */ export type CustomCookie = { name: Exclude; /** Regex pattern used to match the cookie. Defaults to `name` if not specified. */ pattern?: string; provider: string; suggestedCategory: CookieConsentCategoryValues; expire: Expiration; description: Partial>; }; export type CookieTableItem = PredefinedCookie | CustomCookie; /** Builds the internal CookieTable structure from a flat list of cookie items, fetching descriptions for predefined cookies from the API. */ export type CreateCookieTable = (items: CookieTableItem[]) => Promise; export type CookieConsentManagerOptions = { defaultLang: string; autodetectLang: boolean; consentCollectorApiUrl: string; onFirstConsent: OnFirstConsentCallback; onConsent: OnConsentCallback; onChange: OnChangeCallback; companyNames: string[]; displayMode: Values; translationOverrides: Record; /** @deprecated Use `cookieTableItems` instead. Will be removed in the next major version. */ cookieTable: CookieTable; cookieTableItems: CookieTableItem[]; config?: Partial; }; export type CookieConsentManager = (serviceName: string, args?: Partial) => typeof CookieConsent; export {};