@scaleway/use-analytics
Version:
A small hook to handle events analytics
27 lines (26 loc) • 983 B
TypeScript
import type { SerializeOptions } from 'cookie';
import type { ComponentType, PropsWithChildren } from 'react';
import { CATEGORIES } from '../constants';
import type { Config, Consent, Destinations } from '../types';
type Context = {
destinations: Destinations;
needConsent: boolean;
isDestinationsLoaded: boolean;
categories: typeof CATEGORIES;
categoriesConsent: Partial<Consent>;
allowedConsents: (keyof Consent)[];
deniedConsents: (keyof Consent)[];
saveConsent: (categoriesConsent: Partial<Consent>) => void;
};
export declare const useCookieConsent: () => Context;
type CookieConsentProviderProps = PropsWithChildren<{
isConsentRequired: boolean;
manualDestinations?: Destinations;
config: Config;
cookiePrefix?: string;
consentMaxAge?: number;
consentAdvertisingMaxAge?: number;
cookiesOptions?: SerializeOptions;
}>;
export declare const CookieConsentProvider: ComponentType<CookieConsentProviderProps>;
export {};