UNPKG

@oslokommune/punkt-react

Version:

React komponentbibliotek til Punkt, et designsystem laget av Oslo Origo

52 lines (51 loc) 1.78 kB
import { HTMLAttributes } from 'react'; interface ConsentItem { name: string; consent: boolean; } interface ConsentValue { items: ConsentItem[]; } interface CookieConsentEvent { value: string | ConsentValue; } type ConsentDetailsMap = Record<string, boolean>; type CookieEventHandler = (consent: CookieConsentEvent) => void; interface CookieEvents { on(eventName: string, handler: CookieEventHandler): void; off(eventName: string, handler: CookieEventHandler): void; } interface CookieBannerApi { cookieConsent: { validateConsentCookie(): Promise<boolean>; getConsentCookie(): string | ConsentValue; }; openCookieModal(): void; } declare global { interface Window { cookieBanner_devMode?: boolean; cookieBanner_cookieDomain?: string | null; cookieBanner_cookieSecure?: string | null; cookieBanner_cookieExpiryDays?: string | null; cookieBanner_googleAnalyticsId?: string | null; cookieBanner_hotjarId?: string | null; cookieBanner?: CookieBannerApi; __cookieEvents?: CookieEvents; } } export type TPktConsentTriggerType = 'button' | 'link' | 'footerlink' | 'icon'; export interface IPktConsent extends HTMLAttributes<HTMLElement> { devMode?: boolean; cookieDomain?: string | null; cookieSecure?: string | null; cookieExpiryDays?: string | null; hotjarId?: string | null; googleAnalyticsId?: string | null; i18nLanguage?: string; triggerType?: TPktConsentTriggerType | null; triggerText?: string | null; onToggleConsent?: (e: CustomEvent<ConsentDetailsMap>) => void; } export declare const PktConsent: import('react').ForwardRefExoticComponent<IPktConsent & import('react').RefAttributes<HTMLElement>>; export {};