API Reference
Comprehensive guide to using the c15t package for managing privacy consents.
Core Package API Reference
The core package (c15t
) provides the fundamental functionality for managing privacy consents in your application. This reference documents the main types, interfaces, and functions available in the package.
Store API
The core package implements a robust state management system for handling privacy consents. The store provides methods for:
- Managing consent states
- Persisting consent data
- Validating consent configurations
For detailed implementation examples, refer to the Getting Started guide.
Privacy Consent State
The PrivacyConsentState
type represents the current state of privacy consents in your application. It contains information about user preferences, consent categories, and their respective settings.
Prop | Type | Default |
---|---|---|
consents | ConsentState | - |
consentInfo | { time: number; type: "necessary" | "all" | "custom"; } | - |
showPopup | boolean | - |
isLoadingConsentInfo | boolean | - |
gdprTypes | AllConsentNames[] | - |
isPrivacyDialogOpen | boolean | - |
complianceSettings | Record<ComplianceRegion, ComplianceSettings> | - |
callbacks | Callbacks | - |
detectedCountry | string | - |
locationInfo | LocationInfo | - |
jurisdictionInfo | JurisdictionInfo | - |
privacySettings | PrivacySettings | - |
translationConfig | TranslationConfig | - |
setTranslationConfig | (config: TranslationConfig) => void | - |
includeNonDisplayedConsents | boolean | - |
consentTypes | ConsentType[] | - |
setConsent | (name: AllConsentNames, value: boolean) => void | - |
setShowPopup | (show: boolean, force?: boolean | undefined) => void | - |
setIsPrivacyDialogOpen | (isOpen: boolean) => void | - |
saveConsents | (type: "necessary" | "all" | "custom") => void | - |
resetConsents | () => void | - |
setGdprTypes | (types: AllConsentNames[]) => void | - |
setComplianceSetting | (region: ComplianceRegion, settings: Partial<ComplianceSettings>) => void | - |
resetComplianceSettings | () => void | - |
setCallback | (name: keyof Callbacks, callback: CallbackFunction | undefined) => void | - |
setDetectedCountry | (country: string) => void | - |
setLocationInfo | (location: LocationInfo | null) => void | - |
setJurisdictionInfo | (jurisdiction: JurisdictionInfo | null) => void | - |
fetchConsentBannerInfo | (url?: string | undefined) => Promise<ConsentBannerResponse | undefined> | - |
getDisplayedConsents | () => ConsentType[] | - |
hasConsented | () => boolean | - |
clearAllData | () => void | - |
updateConsentMode | () => void | - |
setPrivacySettings | (settings: Partial<PrivacySettings>) => void | - |
getEffectiveConsents | () => ConsentState | - |
hasConsentFor | (consentType: AllConsentNames) => boolean | - |
setIncludeNonDisplayedConsents | (include: boolean) => void | - |
Consent Types
The ConsentType
type defines the structure of individual consent categories and their properties.
Prop | Type | Default |
---|---|---|
defaultValue | boolean | - |
description | string | - |
disabled? | boolean | - |
display | boolean | - |
gdprType | number | - |
name | AllConsentNames | - |
Translation Configuration
The defaultTranslationConfig
provides the default translation settings for the consent management interface.
Prop | Type | Default |
---|---|---|
translations | Record<string, Partial<Translations>> | - |
defaultLanguage? | string | - |
disableAutoLanguageSwitch? | boolean | - |
Tracking Blocker Configuration
The TrackingBlockerConfig
type defines the configuration options for the tracking blocker functionality.
Prop | Type | Default |
---|---|---|
disableAutomaticBlocking? | boolean | - |
overrideDomainConsentMap? | boolean | - |
domainConsentMap? | Record<string, AllConsentNames> | - |
Additional Types
Consent State
Prop | Type | Default |
---|---|---|
experience | boolean | - |
functionality | boolean | - |
marketing | boolean | - |
measurement | boolean | - |
necessary | boolean | - |
Compliance Settings
Prop | Type | Default |
---|---|---|
enabled | boolean | - |
appliesGlobally | boolean | - |
applies | boolean | - |
Privacy Settings
Prop | Type | Default |
---|---|---|
honorDoNotTrack | boolean | - |
Translation Types
Prop | Type | Default |
---|---|---|
translations | Record<string, Partial<Translations>> | - |
defaultLanguage? | string | - |
disableAutoLanguageSwitch? | boolean | - |
Prop | Type | Default |
---|---|---|
cookieBanner | Partial<CookieBannerTranslations> | - |
consentManagerDialog | Partial<ConsentManagerDialogTranslations> | - |
consentManagerWidget | Partial<ConsentManagerWidgetTranslations> | - |
consentTypes | Partial<ConsentTypesTranslations> | - |