@bemit/consent-ui-react
Version:
27 lines (26 loc) • 1.16 kB
TypeScript
import React from 'react';
import { ConsentUiStateType } from '@bemit/consent-ui/ConsentUi';
import { ConsentUiInfoDefinition, ConsentUiInfoLocales, ConsentUiPrefersState } from '@bemit/consent-ui/ConsentUiInfo';
export interface ConsentUiStateReactType {
showUi?: boolean;
locale?: string;
ownId?: string;
}
export interface ConsentUiContextType extends ConsentUiStateType {
toggleUi: () => void;
giveConsent: (preferences?: ConsentUiPrefersState) => void;
updateConsent: (type: 'services' | 'groups', id: string, prefer: undefined | 1 | 2) => void;
localeConsent: ConsentUiInfoLocales;
prefersInitial: ConsentUiPrefersState;
prefersDefault: ConsentUiPrefersState;
}
export declare const useConsent: () => ConsentUiContextType & ConsentUiStateReactType;
export interface ConsentUiProviderProps {
Context?: React.Context<ConsentUiContextType & ConsentUiStateReactType>;
locale: string;
onConsent?: () => void;
onDeny?: () => void;
ownId: string;
definition: ConsentUiInfoDefinition;
}
export declare const ConsentUiProvider: React.ComponentType<React.PropsWithChildren<ConsentUiProviderProps>>;