import type { ConsentCategory, ConsentChoices, ConsentConfigSnapshot, KeksmeisterConfig, KeksmeisterTranslations } from './types.js'; /** * Core consent state manager. * * Framework-agnostic — manages consent state, cookie persistence, * and script blocking. Does not render any UI. * * Usage: * const manager = new ConsentManager(config); * manager.acceptAll(); * manager.isAccepted('analytics'); // true */ export declare class ConsentManager extends EventTarget { private config; private store; private choices; private _hasConsented; private subjectId; private logger; constructor(config: KeksmeisterConfig); /** Whether the user has made any consent choice (accept, reject, or custom). */ get hasConsented(): boolean; /** Whether the stored consent matches the current config revision. */ get isConsentCurrent(): boolean; /** Returns true if the banner should be shown (no consent, outdated revision, or expired). */ get shouldShowBanner(): boolean; /** * Whether the stored consent has exceeded the re-prompt window. * Uses `consentMaxAgeDays` when configured; otherwise falls back to * {@link DEFAULT_CONSENT_MAX_AGE_DAYS} (CNIL six-month guidance). Set * `consentMaxAgeDays: 0` to disable the re-prompt entirely. * * Invariants: * - Only an exact `0` disables expiry. Negative numbers and any * non-finite value (NaN, ±Infinity) fall back to the default — a * misconfigured `NaN` from a runtime cast must not silently turn off * re-prompting. * - A stored timestamp that cannot be parsed is treated as expired so * a corrupted cookie can't suppress the banner. */ get isConsentExpired(): boolean; /** Whether this instance uses opt-out mode (CCPA). */ get isOptOut(): boolean; /** * Check if a specific category is accepted. * - Required categories always return true. * - In opt-out mode, categories default to true until explicitly declined. * - In opt-in mode (default), categories default to false until explicitly accepted. */ isAccepted(categoryId: string): boolean; /** Get a snapshot of all current choices. */ getChoices(): ConsentChoices; /** Accept all categories. */ acceptAll(): void; /** Reject all non-required categories. */ rejectAll(): void; /** Apply custom category choices from the settings modal. */ saveCustom(choices: ConsentChoices): void; /** Programmatically revoke consent and clear the cookie. */ revokeAll(): void; /** Get all configured categories. */ getCategories(): ConsentCategory[]; /** Update the config (e.g. after language change). */ updateConfig(config: Partial): void; /** * Build a snapshot of the banner configuration as currently shown to the * visitor — categories, privacy URL, and (optionally) resolved translations. * Pass the resolved translations explicitly when `config.lang` is a language * code, so the snapshot captures the actual on-screen texts. * * The returned object is decoupled from the live config: callers that * mutate `this.config.categories` or the resolved translations after the * fact cannot retroactively change a snapshot that was already taken. */ getConfigSnapshot(opts?: { translations?: KeksmeisterTranslations; }): ConsentConfigSnapshot; /** * Upload a banner-config snapshot via the configured logger. Idempotent per * revision via the logger's localStorage flag. No-op when no logger is * configured. */ sendConfigSnapshot(snapshot?: ConsentConfigSnapshot): void; private restore; private applyChoices; private autoClear; private updateGoogleConsentMode; private pushToDataLayer; private getRevision; private dispatch; }