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.

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.

PropTypeDefault
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
-

The ConsentType type defines the structure of individual consent categories and their properties.

PropTypeDefault
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.

PropTypeDefault
translations
Record<string, Partial<Translations>>
-
defaultLanguage?
string
-
disableAutoLanguageSwitch?
boolean
-

Tracking Blocker Configuration

The TrackingBlockerConfig type defines the configuration options for the tracking blocker functionality.

PropTypeDefault
disableAutomaticBlocking?
boolean
-
overrideDomainConsentMap?
boolean
-
domainConsentMap?
Record<string, AllConsentNames>
-

Additional Types

PropTypeDefault
experience
boolean
-
functionality
boolean
-
marketing
boolean
-
measurement
boolean
-
necessary
boolean
-

Compliance Settings

PropTypeDefault
enabled
boolean
-
appliesGlobally
boolean
-
applies
boolean
-

Privacy Settings

PropTypeDefault
honorDoNotTrack
boolean
-

Translation Types

PropTypeDefault
translations
Record<string, Partial<Translations>>
-
defaultLanguage?
string
-
disableAutoLanguageSwitch?
boolean
-
PropTypeDefault
cookieBanner
Partial<CookieBannerTranslations>
-
consentManagerDialog
Partial<ConsentManagerDialogTranslations>
-
consentManagerWidget
Partial<ConsentManagerWidgetTranslations>
-
consentTypes
Partial<ConsentTypesTranslations>
-

On this page

c15t.com