UNPKG

@c15t/react

Version:

Developer-first CMP for React: cookie banner, consent manager, preferences centre. GDPR ready with minimal setup and rich customization

76 lines 3.54 kB
/** * @packageDocumentation * Hook for accessing and managing consent state. */ /** * Hook for accessing and managing consent state. * * @remarks * This hook provides access to the complete consent management API, including: * - Current consent state (what consents are given/required) * - Methods to update consents * - Compliance settings and region detection * - State persistence and retrieval * - The consent manager (if configured) * * The hook must be used within a ConsentManagerProvider component. * * @throws {Error} * Throws if used outside of a ConsentManagerProvider context. * * @returns Combined state and methods for consent management * @public */ export declare function useConsentManager(): { manager?: import("c15t").ConsentManagerInterface | undefined; config: { pkg: string; version: string; mode: string; meta?: Record<string, unknown>; }; branding: import("@c15t/backend/contracts").ContractsOutputs["consent"]["showBanner"]["branding"]; consents: import("c15t").ConsentState; selectedConsents: import("c15t").ConsentState; consentInfo: { time: number; type: "all" | "custom" | "necessary"; } | null; showPopup: boolean; isLoadingConsentInfo: boolean; hasFetchedBanner: boolean; lastBannerFetchData: import("c15t").ConsentBannerResponse | null; gdprTypes: import("c15t").AllConsentNames[]; isPrivacyDialogOpen: boolean; callbacks: import("c15t").Callbacks; locationInfo: import("c15t").LocationInfo | null; translationConfig: import("c15t").TranslationConfig; ignoreGeoLocation: boolean; setTranslationConfig: (config: import("c15t").TranslationConfig) => void; includeNonDisplayedConsents: boolean; consentTypes: import("c15t").ConsentType[]; setSelectedConsent: (name: import("c15t").AllConsentNames, value: boolean) => void; saveConsents: (type: "all" | "custom" | "necessary") => void; setConsent: (name: import("c15t").AllConsentNames, value: boolean) => void; resetConsents: () => void; setShowPopup: (show: boolean, force?: boolean) => void; setIsPrivacyDialogOpen: (isOpen: boolean) => void; setGdprTypes: (types: import("c15t").AllConsentNames[]) => void; setCallback: (name: keyof import("c15t").Callbacks, callback: import("c15t").Callbacks[keyof import("c15t").Callbacks] | undefined) => void; setLocationInfo: (location: import("c15t").LocationInfo | null) => void; fetchConsentBannerInfo: () => Promise<import("c15t").ConsentBannerResponse | undefined>; getDisplayedConsents: () => typeof import("c15t").consentTypes; hasConsented: () => boolean; hasConsentFor: (consentType: import("c15t").AllConsentNames) => boolean; has: <CategoryType extends import("c15t").AllConsentNames>(condition: import("node_modules/c15t/dist/libs/has").HasCondition<CategoryType>) => boolean; isConsentDomain: boolean; detectedCountry: string | null; privacySettings: import("c15t").PrivacySettings; complianceSettings: Record<import("c15t").ComplianceRegion, import("c15t").ComplianceSettings>; jurisdictionInfo: import("c15t").JurisdictionInfo | null; getEffectiveConsents: () => import("c15t").ConsentState; setDetectedCountry: (country: string) => void; resetComplianceSettings: () => void; setComplianceSetting: (region: import("c15t").ComplianceRegion, settings: Partial<import("c15t").ComplianceSettings>) => void; }; //# sourceMappingURL=use-consent-manager.d.ts.map