/** * @typedef {Object} Category * @property {string} label - Category label displayed to the user * @property {boolean} required - If true, cannot be disabled * @property {boolean} default - Default state (true = enabled, false = disabled) */ export type Category = { /** * - Category label displayed to the user */ label: string; /** * - If true, cannot be disabled */ required: boolean; /** * - Default state (true = enabled, false = disabled) */ default: boolean; }; export type Config = { /** * - Consent message */ message: string; /** * - Text for "Accept All" button */ acceptText: string; /** * - Text for "Reject All" button */ rejectText: string; /** * - Text for "Manage Settings" button */ settingsText: string; /** * - List of cookie categories */ categories: Category[]; /** * - Key used to store preferences */ storageKey: string; /** * - Callback when preferences are saved */ onSave: (preferences: Object) => void; /** * - Animation duration in ms */ animationDuration?: number; /** * - Optional custom HTML renderer for consent bar */ renderBar?: ((config: Config) => string) | null; /** * - Optional custom HTML renderer for modal */ renderModal?: ((config: Config) => string) | null; }; /** * @typedef {Object} Config * @property {string} message - Consent message * @property {string} acceptText - Text for "Accept All" button * @property {string} rejectText - Text for "Reject All" button * @property {string} settingsText - Text for "Manage Settings" button * @property {Category[]} categories - List of cookie categories * @property {string} storageKey - Key used to store preferences * @property {(preferences: Object) => void} onSave - Callback when preferences are saved * @property {number} [animationDuration=400] - Animation duration in ms * @property {((config: Config) => string)|null} [renderBar] - Optional custom HTML renderer for consent bar * @property {((config: Config) => string)|null} [renderModal] - Optional custom HTML renderer for modal */ /** * CookieConsent * * A flexible and customizable cookie consent manager. * Features: * - Displays a consent bar with customizable text and buttons. * - Allows defining multiple cookie categories (required, analytics, ads, etc.). * - Stores user preferences in localStorage. * - Provides callbacks for when user accepts or denies categories. * - Fully customizable via configuration. */ declare class TinyCookieConsent { #private; /** @type {Record} */ get preferences(): Record; /** @type {Config} */ get config(): Config; /** @param {Config} value */ set config(value: Config); /** * @param {Config} config */ constructor(config: Config); /** * Validates config object against jsDoc typedefs * @param {Partial} config */ validateConfig(config: Partial): void; /** * Validates a single category object * @param {Category} cat * @param {number} index */ validateCategory(cat: Category, index: number): void; /** * Loads saved preferences from localStorage * @returns {Record|null} */ loadPreferences(): Record | null; /** * Smoothly removes an element with fade-out/slide-out animation * @param {HTMLElement} el */ removeWithAnimation(el: HTMLElement): void; /** * Saves preferences to localStorage * * @param {Record} prefs */ savePreferences(prefs: Record): void; /** Shows the initial consent bar */ showConsentBar(): void; /** * Shows settings modal for fine-grained control * * @param {HTMLElement} bar */ showSettingsModal(bar: HTMLElement): void; /** * Checks if a category is allowed * @param {string} category * @returns {boolean} */ isAllowed(category: string): boolean; } export default TinyCookieConsent; //# sourceMappingURL=TinyCookieConsent.d.mts.map