// ============================================================================ // Stylescape | Cookie Consent Manager // ============================================================================ // GDPR-compliant cookie consent management with granular category control. // Supports data-ss-cookie-consent attributes for declarative configuration. // ============================================================================ /** * Cookie categories for granular consent */ export type CookieCategory = | "necessary" | "analytics" | "marketing" | "preferences"; /** * Consent state for all categories */ export interface ConsentState { necessary: boolean; analytics: boolean; marketing: boolean; preferences: boolean; timestamp?: number; } /** * Configuration options for CookieConsentManager */ export interface CookieConsentOptions { /** Main message text */ message?: string; /** Accept all button text */ acceptAllText?: string; /** Accept necessary only button text */ acceptNecessaryText?: string; /** Settings button text */ settingsText?: string; /** CSS class prefix */ cssClass?: string; /** Storage key */ storageKey?: string; /** Position on screen */ position?: "top" | "bottom" | "center"; /** Cookie categories to show */ categories?: CookieCategory[]; /** Link to privacy policy */ privacyPolicyUrl?: string; /** Days until consent expires */ expirationDays?: number; /** Callback when consent is given */ onAccept?: (consent: ConsentState) => void; /** Callback when consent changes */ onChange?: (consent: ConsentState) => void; /** Auto-show banner if no consent */ autoShow?: boolean; /** Show detailed settings panel */ showSettings?: boolean; } /** * GDPR-compliant cookie consent manager with category support. * * @example JavaScript * ```typescript * const consent = new CookieConsentManager({ * categories: ["necessary", "analytics", "marketing"], * onAccept: (state) => { * if (state.analytics) initAnalytics() * if (state.marketing) initMarketing() * } * }) * ``` * * @example HTML with data-ss * ```html *