UNPKG

@usercentrics/cmp-web-sdk

Version:

Please visit our official [https://usercentrics.com/docs/web/implementation/sdk/][docs] (alpha version, not to be used in production).

1,408 lines 60.8 kB
import { CmpData as _CmpData1, ConsentData, SettingType, ConsentActionType, ConsentType as _ConsentType1, I18nData, CmpDataRequestData, DeviceStorage, SettingsCoreData, AutoBlockerConfiguration, CcpaRegionsType, UsLegislation, TcfPolicyVersion, DpsData, DpsDataServices, Legislation, ValidAcmVendor, CmpTheme, ConsentType, EmbeddingsTheme, LayoutDirection, PrivacyButtonTheme, ScreenType, ThemeData, UiTheme, UiView, ucCmpTheme, ucEmbeddingsTheme, ucPrivacyButtonTheme, GdprConsentData, UsConsentData, UiView as _UiView1, BaseI18nData, ServiceI18n, UsI18nData, ServiceData, GoogleConsentModeData, LanguagesData, SettingData, TemplateData, CmpTheme as _CmpTheme1, CustomCmpTheme, CustomEmbeddingsTheme, CustomPrivacyButtonTheme, EmbeddingsTheme as _EmbeddingsTheme1, LayoutDirection as _LayoutDirection1, PrivacyButtonTheme as _PrivacyButtonTheme1, ScreenType as _ScreenType1, ThemeData as _ThemeData1, UcCmpTheme, UcEmbeddingsTheme, UcPrivacyButtonTheme, UiData as _UiData1, GdprI18nData, TcfI18nData, TcfConsentData, IntegrationsData, IntegrationScript, StoredInfoItem, TcfVendorInfo, IabData, CategoryData, Language, UsCmpData as _UsCmpData1, GdprCmpData as _GdprCmpData1, TcfCmpData as _TcfCmpData1, CmpData, GdprCmpData, UsCmpData, TcfCmpData } from "@usercentrics/cmp-web-api-cmp-server"; import { Vendor, EncodingOptions, TCModel } from "@iabtechlabtcf/core"; import { UsCmpController as _UsCmpController2 } from "controllers/CmpController/UsCmpController"; import { GdprCmpController as _GdprCmpController2 } from "controllers/CmpController/GdprCmpController"; import { TcfCmpController as _TcfCmpController2 } from "controllers/CmpController/TcfCmpController"; interface AnalyticsServiceOptions { euMode: boolean; sandbox: boolean; settingsId: string; abTestVariant?: string; } interface AnalyticsServiceDomains { analytics: string; } interface TagLoggerData { settingsId: string; source: string; entries: string[]; } interface ApiServiceOptions { euMode?: boolean; sandbox?: boolean; cacheVersion?: number; } interface ApiServiceDomains { api: string; consent: string; crossDevice: string; logger: string; } interface ApiSaveConsentData { analyticsEnabled?: boolean; consent: ConsentData; crossDeviceEnabled?: boolean; services: _CmpData1['dps']['services']; settingsType: SettingType; ucString?: string; vendors?: (number | number[])[][]; } interface CrossDomainServiceDomains { cdn: string; } interface UserConsentResponse { action: ConsentActionType; consentId: string; settingsVersion: string; status: boolean; templateId: string; timestamp: string | number; updatedBy: _ConsentType1; } interface StorageTCF { acString: string; tcString: string; timestamp: number; vendors: (number | number[])[][]; vendorsDisclosed?: number[]; } interface StorageCcpa { timestamp: number; ccpaString: string; } interface UserSessionData { consents: UserConsentResponse[]; controllerId: string; language: string; tcf?: StorageTCF; ccpa?: StorageCcpa; } type GcmConsent = 'granted' | 'denied'; interface StorageGcm { analyticsStorage?: GcmConsent; adStorage?: GcmConsent; adPersonalization?: GcmConsent; adUserData?: GcmConsent; adsDataRedaction?: boolean; } interface StorageConsent { services: Record<string, { name: string; consent: boolean; }>; } interface UiData { language: string; } export interface StorageData { gcm: StorageGcm; consent: StorageConsent; } type CmpEventSource = UiView | 'embeddings' | '__ucCmp'; export enum CMP_EVENT_TYPE { CMP_SHOWN = "CMP_SHOWN", ACCEPT_ALL = "ACCEPT_ALL", DENY_ALL = "DENY_ALL", SAVE = "SAVE", COOKIE_POLICY_LINK = "COOKIE_POLICY_LINK", IMPRINT_LINK = "IMPRINT_LINK", MORE_INFORMATION_LINK = "MORE_INFORMATION_LINK", PRIVACY_POLICY_LINK = "PRIVACY_POLICY_LINK", CCPA_TOGGLES_ON = "CCPA_TOGGLES_ON", CCPA_TOGGLES_OFF = "CCPA_TOGGLES_OFF", SAY_MINE_LINK = "SAY_MINE_LINK" } declare class AnalyticsService { constructor({ settingsId, abTestVariant, euMode, sandbox }: AnalyticsServiceOptions); /** * Set analytics pixel (via network call) and dispatch custom events * @param {CMP_EVENT_TYPE} cmpEventType - The event type. * @param {CmpEventSource | undefined} source - The event source. * @returns {void} */ setAnalyticsPixel: (cmpEventType: CMP_EVENT_TYPE, source?: CmpEventSource) => void; } type UetConsent = 'granted' | 'denied'; interface UetData { adStorage: UetConsent; } declare class CustomEventService { constructor(eventNames: string[]); /** * Dispatches UC_CONSENT and custom events with consent details * @param {ConsentDetails} consentDetails - The consent details data. * @returns {void} */ dispatchConsentDetails(consentDetails: ConsentDetails): void; dispatchUcGcmUpdateEvent(detail: StorageGcm): void; dispatchUcUetUpdateEvent(detail: UetData): void; /** * Dispatches events to the window * @param {string} name - The event name. * @param {unknown} data - The event data. * @returns {void} */ dispatch(name: string, data: unknown): void; } declare class DataLayerService { constructor(dataLayers: string[]); /** * Pushes information into the dataLayer window object * @param {unknown} data - The data to be pushed. * @returns {void} */ push(data: unknown): void; } declare class ApiService { constructor(options: ApiServiceOptions); /** * Get CMP Data * @param {CmpDataRequestData} reuqestData - The network request data. * @returns {Promise<CmpData>} - The CMP Data. */ fetchCmpData({ params, query }: CmpDataRequestData): Promise<_CmpData1>; /** * Get Core Data via Ruleset id * @param {string} ruleSetId - The ruleset id. * @param {UserLocation | undefined} location - The user location. * @returns {Promise<CmpData>} - The Core Data. */ fetchRuleSetCoreData(ruleSetId: string, location?: UserLocation): Promise<{ location: UserLocation; ruleSetCoreData: { id: string; version: string; sandbox?: true; abTesting?: { provider: "external" | "internal"; variants: string[]; }; languages: string[]; cmp: { mainDomain?: string; version: string; type: "gdpr" | "tcf" | "us"; }; autoBlockerConfiguration?: AutoBlockerConfiguration; crossDeviceConsentSharingEnabled?: true; crossDomainConsentSharingEnabled?: true; enableBotDetection?: true; ruleSetNoShow: true; ccpa?: { regions: CcpaRegionsType[]; legislation: UsLegislation; }; tcf?: { vendorsListVersion: number; policyVersion: TcfPolicyVersion; }; gpp?: { cmpId: number; cmpVersion: number; }; allowedDomains?: { list: string[]; showErrorCmp?: true; }; cachingPeriod?: "SHORT" | "DEFAULT"; }; }>; /** * Get i18n Data * @param {string} settingsId - The settings id. * @param {SettingType} settingsType - The settings type. * @param {string} settingsVersion - The settings version. * @param {string} language - The chosen language. * @returns {Promise<ApiI18nData | null>} - The i18n Data. */ fetchI18nData({ settingsId, settingsType, settingsVersion, language, activeTcfVendorsListVersion, previousTcfVendorsListVersion, previousTcfPolicyVersion, }: { settingsId: string; settingsType: SettingType; settingsVersion: string; language: string; activeTcfVendorsListVersion?: number; previousTcfVendorsListVersion?: number; previousTcfPolicyVersion?: number; }): Promise<I18nData | null>; /** * Get Settings Core Data * @param {string} settingsId - The settings id. * @param {{ draft?: boolean }} options - Options. * @returns {Promise<{location: UserLocation; settingsCoreData: SettingsCoreData;}>} - The Settings Core Data. */ fetchSettingsCoreData(settingsId: string, options?: { draft?: true; }): Promise<{ location: UserLocation; settingsCoreData: SettingsCoreData; }>; /** * Get Stored Information data via URL * @param {string} url - The stored information url. * @returns {Promise<DeviceStorage | null>} - The Stored Information. */ fetchStoredInfoData(url: string): Promise<DeviceStorage | null>; /** * Get Settings Data via Settings Id * @param {string} settingsId - The settings id. * @param {{ location?: UserLocation; language?: string; draft?: true }} options - Options. * @returns {Promise<{location: UserLocation; settingsCoreData: SettingsCoreData; language: string | undefined;}>} - The Settings Data. */ fetchInitDataBySettingsId(settingsId: string, options?: { location?: UserLocation; language?: string; draft?: true; }): Promise<{ location: UserLocation; settingsCoreData: SettingsCoreData; language: string | undefined; }>; /** * Get Settings Data via Ruleset Id * @param {string} ruleSetId - The ruleset id. * @param {UserLocation | undefined} location - The user location. * @returns {Promise<{location: UserLocation; settingsCoreData: SettingsCoreData;}>} - The Settings Data. */ fetchInitDataByRuleSetId(ruleSetId: string, location?: UserLocation): Promise<{ location: UserLocation; settingsCoreData: { id: string; version: string; sandbox?: true; abTesting?: { provider: "external" | "internal"; variants: string[]; }; languages: string[]; cmp: { mainDomain?: string; version: string; type: "gdpr" | "tcf" | "us"; }; autoBlockerConfiguration?: AutoBlockerConfiguration; crossDeviceConsentSharingEnabled?: true; crossDomainConsentSharingEnabled?: true; enableBotDetection?: true; ruleSetNoShow: true; ccpa?: { regions: CcpaRegionsType[]; legislation: UsLegislation; }; tcf?: { vendorsListVersion: number; policyVersion: TcfPolicyVersion; }; gpp?: { cmpId: number; cmpVersion: number; }; allowedDomains?: { list: string[]; showErrorCmp?: true; }; cachingPeriod?: "SHORT" | "DEFAULT"; }; }>; /** * Save consents data remotely * @param {ApiSaveConsentData} consentData - The consent data. * @returns {Promise<boolean>} - True if request successful. */ saveConsentData({ services, consent, settingsType, vendors, ucString, analyticsEnabled, crossDeviceEnabled, }: ApiSaveConsentData): Promise<boolean>; /** * Get UC String for controller ID consent restoration * @param {string} controllerId - The controller id. * @param {string} settingsId - The settings id. * @returns {Promise<{ucString: string} | null>} - The UC String */ fetchUcStringForRestoration(controllerId: string, settingsId: string): Promise<any>; sendTagLoggerData({ settingsId, source, entries }: TagLoggerData): void; } declare class CrossDomainService { constructor(settingsId: string); /** * Set consent string into the CDCS iframe * @param {string} consentString - Consent string. * @returns {Promise<boolean>} - True if the request is successful. */ setConsentString(consentString: string): Promise<boolean>; /** * Get consent string from the CDCS iframe * @returns {Promise<string | undefined>} - The consent string. */ getConsentString(): Promise<string | undefined>; /** * Clears the local storage of the CDCS iframe * @returns {Promise<boolean>} - True if the request is successful. */ clearStorage(): Promise<boolean>; /** * Creates the CDCS iframe * @returns {Promise<boolean>} - True if the request is successful. */ init(): Promise<boolean>; } enum V2_LOCAL_STORAGE_KEY { CCPA = "uc_usprivacy", CCPA_DATA = "uc_ccpa", CONSENTS_BUFFER = "uc_consents_buffer", CONSENTS_V2_BUFFER = "uc_consents_v2_buffer", GCM_DATA = "uc_gcm", SERVICES = "uc_services", SETTINGS = "uc_settings", TCF = "uc_tcf", USER_INTERACTION = "uc_user_interaction", AB_TEST_VARIANT = "uc_ab_variant", UI_VERSION = "uc_ui_version" } const enum V1_CONSENT_ACTION { BY_SETTINGS_UPDATE = "bySettingsUpdate", ON_INITIAL_PAGE_LOAD = "onInitialPageLoad", ON_DENY_ALL_BTN_CLICK = "onDenyAllBtnClick", ON_ACCEPT_ALL_BTN_CLICK = "onAcceptAllBtnClick", ON_DENY_ALL_ANCHOR_CLICK = "onDenyAllAnchorClick", ON_TOGGLE_SELECT_ALL = "onToggleSelectAll", ON_TOGGLE_CATEGORY = "onToggleCategory", ON_TOGGLE_CONSENT = "onToggleConsent", ON_SPECIAL_FUNCTION_ACCEPT_ALL_CONSENT_TRIGGER = "onSpecialFunctionAcceptAllConsentTrigger", ON_COUNTDOWN_FINISHED = "onCountdownFinished", ON_WINDOW_FUNCTION_UPDATE_CONSENT = "onWindowFunctionUpdateConsent", ON_NON_EU_REGION = "onNonEURegion", ON_SAVE_BTN_CLICK = "onSaveBtnClick" } const enum V1_CONSENT_TYPE { EXPLICIT = "explicit", IMPLICIT = "implicit", UPDATE = "update" } interface V1LocalStorageSettings { ucConsents: { consents: V1LocalStorageService[]; }; usercentrics: { firstUserInteraction: { stateSaved: boolean; }; settings: { language: string; settingsId: string; version: string; }; }; } interface V2LocalStorage { [V2_LOCAL_STORAGE_KEY.SETTINGS]: V2LocalStorageSettings; [V2_LOCAL_STORAGE_KEY.USER_INTERACTION]?: boolean; } interface V1LocalStorageService { consentStatus: boolean; controllerId: string; history: V1LocalStorageConsentHistory[]; processorId: string; templateId: string; } interface V1LocalStorageConsentHistory { action: V1_CONSENT_ACTION; appVersion: string; consentStatus: boolean; consentTemplateVersion: string; language: string; settingsVersion: string; templateId: string; updatedAt: number; updatedBy: V1_CONSENT_TYPE; } interface V2LocalStorageData { settings: V2LocalStorageSettings; tcf?: V2LocalStorageTcf; ccpa?: V2LocalStorageCcpa; gcm?: V2LocalStorageGcm; abVariant?: string; userInteraction?: true; } interface V2LocalStorageTcf { tcString: string; timestamp: number; vendors: (number | number[])[][]; vendorsDisclosed?: number[]; } interface V2LocalStorageCcpa { timestamp: number; ccpaString: string; } interface V2LocalStorageGcm { analyticsStorage?: 'granted' | 'denied'; adStorage?: 'granted' | 'denied'; adsDataRedaction?: boolean; } interface V2LocalStorageSettings { controllerId: string; id: string; language: string; services: V2LocalStorageService[]; version: string; } interface V2LocalStorageService { history: V2LocalStorageConsentHistory[]; id: string; processorId: string; status: boolean; } interface V2LocalStorageConsentHistory extends V2LocalStorageConsent { language: string; timestamp: number; versions: { application: string; service: string; settings: string; }; } interface V2LocalStorageConsent { action: V2_CONSENT_ACTION; status: boolean; type: V2_CONSENT_TYPE; } const enum V2_CONSENT_ACTION { ACCEPT_ALL_SERVICES = "onAcceptAllServices", DENY_ALL_SERVICES = "onDenyAllServices", ESSENTIAL_CHANGE = "onEssentialChange", INITIAL_PAGE_LOAD = "onInitialPageLoad", NON_EU_REGION = "onNonEURegion", SESSION_RESTORED = "onSessionRestored", TCF_STRING_CHANGE = "onTcfStringChange", UPDATE_SERVICES = "onUpdateServices", MOBILE_SESSION_RESTORED = "onMobileSessionRestore" } const enum V2_CONSENT_TYPE { EXPLICIT = "explicit", IMPLICIT = "implicit" } declare class LocalStorageService { constructor(); setConsentString(consentString: string): void; getConsentString(): string | undefined; setUcData(ucData: StorageData): void; getUcData(): any; setGcmData(gcmData: StorageGcm): void; setConsentData(consentData: StorageConsent): void; setUiData(uiDataObject: UiData): void; getGcmData(): any; clearStorage(): void; clearUserSession(): void; getV1Settings(settingsId: string): V1LocalStorageSettings | undefined; setV2LocalStorageRestoredData(data: V2LocalStorageData): void; getV2Data(): V2LocalStorageData | undefined; setV2Data(data: V2LocalStorage): void; } interface ConsentServiceOptions { apiService: ApiService; crossDomainService?: CrossDomainService; localStorageService: LocalStorageService; } declare class ConsentService { constructor({ apiService, crossDomainService, localStorageService }: ConsentServiceOptions); /** * Save consents locally (local storage) * @param {ConsentData} consentData - The consent data. * @returns {Promise<void>} */ saveConsentLocally(consentData: ConsentData, { services }: DpsData): Promise<void>; /** * Save consents remotely (api) * @param {ApiSaveConsentData} apiSaveConsentData - The consent data. * @returns {Promise<void>} */ saveConsentRemotely(apiSaveConsentData: ApiSaveConsentData): Promise<void>; /** * Get consent data * @param {string} settingsId - Settings id. * @param {string | undefined} compressedConsentDataString - Consent data string. * @returns {Promise<ConsentData | undefined>} - The consent data. */ getConsentData(settingsId: string, compressedConsentDataString?: string): Promise<ConsentData | undefined>; /** * Clear consents locally (local storage) * @returns {Promise<void>} */ clearConsentsLocally(): Promise<void>; mapServicesData(services: DpsDataServices): Record<string, { name: string; consent: boolean; }>; } type RUNTIME_EVENTS = 'INIT_ACTION' | 'INIT_COMPLETE' | 'CMP_DATA_COMBINED' | 'LOCALSTORAGE_UPDATE' | 'SCRIPTS_UNBLOCKED'; type CONSENT_EVENTS = 'CONSENTS_APPLIED'; type DEBUG_EVENTS = 'WARN' | 'ERROR'; export type EVENTS = 'ALL' | DEBUG_EVENTS | RUNTIME_EVENTS | CONSENT_EVENTS; type CallbackFunction = (eventName: string, eventData: unknown, timeElapsed: number) => void; declare class WebSdkEvents { subscribe(name: EVENTS, callback: CallbackFunction): void; unsubscribe(name: EVENTS, callback: CallbackFunction): void; emit(name: EVENTS, data?: unknown): void; } export const webSdkEvents: WebSdkEvents; declare class ScriptService { /** * Unblock scripts on the html document * @param {Record<string, ServiceData>} services - List of services with consent granted. * @returns {Promise<string[]>} - A list of all unblocked services. */ unblockScripts(services: DpsData['services']): Promise<string[]>; } interface GppServiceInterface { setCmpSignalReady: () => Promise<void>; setCmpStatusLoaded: () => Promise<void>; setCmpDisplayHidden: () => Promise<void>; setCmpDisplayVisible: () => Promise<void>; } interface GppServiceAttrs { cmpId: number; cmpVersion: number; } type GppLegalFramework = 'tcfeuv2' | 'tcfcav1' | 'uspv1' | 'usnat' | 'usca' | 'usva' | 'usco' | 'usut' | 'usct'; declare class GppService implements GppServiceInterface { constructor({ cmpId, cmpVersion }: GppServiceAttrs); setApplicableSections: (legalFramework: GppLegalFramework) => void; applyApplicableSections(settingsType: SettingType, legislation?: Legislation): void; setCmpSignalReady: () => Promise<void>; setCmpStatusLoaded: () => Promise<void>; setCmpDisplayHidden: () => Promise<void>; setCmpDisplayVisible: () => Promise<void>; setSectionString: (sectionString: string, settingsType: SettingType, legislation?: Legislation) => Promise<void>; resetGpp(): void; } /** * 0 => none or privacy button * 1 => FirstLayer * 2 => SecondLayer * 3 => Embeddings */ type ConsentScreen = 0 | 1 | 2 | 3; interface CmpServices { apiService: ApiService; consentService: ConsentService; localStorageService: LocalStorageService; crossDeviceService?: boolean; gppService?: GppService; analyticsService?: AnalyticsService; } export interface ConsentDetails { consent: ConsentData; services: _CmpData1['dps']['services']; categories: _CmpData1['dps']['categories']; } interface ACM { acString?: string; vendors?: ValidAcmVendor[]; } type SdkErrorName = 'CMP_NOT_ALLOWED' | 'CMP_VERSION_MISMATCH'; interface SdkErrorData extends Error { name: SdkErrorName; } interface CmpNotAllowedErrorData extends SdkErrorData { data: { showNotAllowedInfo: boolean; }; } declare class SdkError implements SdkErrorData { name: SdkErrorName; message: string; constructor(name: SdkErrorName, message?: string); } declare class CmpNotAllowedError extends SdkError implements CmpNotAllowedErrorData { data: CmpNotAllowedErrorData['data']; constructor(showNotAllowedInfo: boolean); } export const isCmpNotAllowedError: (data: unknown) => data is CmpNotAllowedError; export { ConsentType, CmpTheme, EmbeddingsTheme, PrivacyButtonTheme, ThemeData, UiView, LayoutDirection, ScreenType }; export { ucEmbeddingsTheme, ucCmpTheme, ucPrivacyButtonTheme }; export type CategoryConsent = ServiceConsent; export type ServicesConsents = ServiceConsent[]; export type CategoriesConsents = CategoryConsent[]; export type UspApiCallback = (data: unknown, success: boolean) => void; export type UspApiCommand = 'getUSPData'; export type UspApiVersion = number; export interface UcCmpGTMConfig { settingsId?: string; rulesetId?: string; language?: string; disableGcmDefaults?: boolean; advertiserConsentMode?: boolean; } export interface UserLocation { country: string; region?: string; city?: string; } export interface InitOptions { disableTracking?: boolean; draft?: true; euMode?: boolean; language?: string; location?: UserLocation; sandbox?: true; cacheVersion?: number; uiVersion?: string; uiTheme?: UiTheme; userSessionData?: UserSessionData; } export interface ServiceConsent { id: string; consent: boolean; } export interface TcfConsent { vendorId: string; legitimateInterestConsent: boolean; consent: boolean; } export interface UetConfig { disabled: boolean; } export interface UcCmpConfig { ui?: { suppress?: true; }; proxy?: AnalyticsServiceDomains & ApiServiceDomains & CrossDomainServiceDomains; core?: SettingsCoreData; location?: Promise<UserLocation>; autoBlockerConfig?: AutoBlockerConfiguration; uetConfig?: UetConfig; } declare class ConsentModel implements ConsentData { version: ConsentData['version']; uiVersion: ConsentData['uiVersion']; _domains: ConsentData['_domains']; controllerId: ConsentData['controllerId']; language: ConsentData['language']; setting: ConsentData['setting']; updatedAt: ConsentData['updatedAt']; updatedBy: ConsentData['updatedBy']; createdAt: ConsentData['createdAt']; required: ConsentData['required']; status: ConsentData['status']; type: ConsentData['type']; hash: ConsentData['hash']; isBot: ConsentData['isBot']; constructor({ language, setting, updatedAt, updatedBy, createdAt, controllerId, version, uiVersion, required, status, type, hash, isBot, _domains, }: ConsentData, options?: { uiVersion?: string; }); /** * Set setting's data * @param {SettingData} setting - New setting's data. * @returns {void} */ setSetting(setting: ConsentData['setting']): void; getDomains(): string[]; /** * Set language * @param {string} language - New language. * @returns {void} */ setLanguage(language: ConsentData['language']): void; setUiVersion(uiVersion?: ConsentData['uiVersion']): void; /** * Set updatedAt * @param {number} number - New timestamp. * @returns {void} */ setUpdatedAt(updatedAt: ConsentData['updatedAt']): void; /** * Set updatedBy * @param {ConsentActionType} updatedBy - New consent action. * @returns {void} */ setUpdatedBy(updatedBy: ConsentData['updatedBy']): void; /** * Set hash * @param {string} hash - New hash string. * @returns {void} */ setHash(hash: ConsentData['hash']): void; /** * Set required * @param {boolean} isRequired - Is consent required. * @returns {void} */ setRequired(isRequired: ConsentData['required']): void; /** * Set status * @param {string} status - New consent status. * @returns {void} */ setStatus(status: ConsentData['status']): void; /** * Set type * @param {ConsentType} type - New consent type. * @returns {void} */ setType(type: ConsentData['type']): void; } declare class GdprConsentModel extends ConsentModel implements GdprConsentData { serviceIds?: string[]; constructor(gdprConsentData: GdprConsentData, options?: { uiVersion?: string; }); /** * Set list of services ids * @param {string[]} ids - Services ids list. * @returns {void} */ setServiceIds(ids: string[]): void; } declare class UsConsentModel extends GdprConsentModel implements UsConsentData { ccpaString: UsConsentData['ccpaString']; gpcSignal?: UsConsentData['gpcSignal']; legislation: UsConsentData['legislation']; constructor(usConsentData: UsConsentData, options?: { initialView?: _UiView1; uiVersion?: string; }); /** * Get US string * @returns {string} - The US consent string. */ getCcpaString(): string; emitCcpaString(): void; setHasOptedOut(hasOptedOut: boolean): void; getHasOptedOut(): boolean; /** * Set that the user has been notified about the opportunity to opt out * @returns {void} */ setHasBeenNotified(): void; } declare class I18nModel implements BaseI18nData { base: BaseI18nData['base']; categories: BaseI18nData['categories']; services: BaseI18nData['services']; firstLayer: BaseI18nData['firstLayer']; secondLayer: BaseI18nData['secondLayer']; constructor({ base, firstLayer, secondLayer, services, categories }: BaseI18nData); /** * Get i18n service data by id * @param {string} serviceId - Service id. * @returns {ServiceI18n} - The i18n service data */ getService(serviceId: string): ServiceI18n; /** * Determines wether or not a service already has details available * @param {string} serviceId - Service id. * @returns {boolean} - True if service details are available. */ getServiceHasDetails(serviceId: string): boolean; } declare class UsI18nModel extends I18nModel implements UsI18nData { ccpa: UsI18nData['ccpa']; constructor(ccpaI18nData: UsI18nData); } declare class DpsModel implements DpsData { services: DpsData['services']; categories: DpsData['categories']; granularConsentDisabled: DpsData['granularConsentDisabled']; updatedBy?: DpsData['updatedBy']; constructor({ services, categories, granularConsentDisabled }: DpsData); /** * Accept all services consents * @returns {void} */ acceptAll(): void; /** * Deny all services consents * @returns {void} */ denyAll(): void; /** * Accept a set of services consents * @param {ServicesConsents} consents - Set of services to be accepted. * @returns {void} */ acceptSome(consents: ServicesConsents): void; /** * Deny a set of services consents * @param {ServicesConsents} consents - Set of services to be denied. * @returns {void} */ denySome(consents: ServicesConsents): void; /** * Update a set of services consents * @param {ServicesConsents} consents - Set of services to be updated. * @returns {void} */ updateSome(consents: ServicesConsents): void; /** * Update a set of categories' consents * @param {CategoriesConsents} categoriesConsents - Set of categories to be updated. * @returns {void} */ updateCategoriesConsents(categoriesConsents: CategoriesConsents): void; /** * Get all accepted services * @param {string} key - Key that will identify each service on the final result. * @returns {Record<string, ServiceData>} - The set of accepted services. */ getAcceptedServices(key?: 'id' | 'name'): DpsDataServices; /** * Get all services consent state * @param {string} key - Key that will identify each service on the final result. * @returns {Record<string, boolean>} - The set of services with the respective consent state. */ getServicesConsents(key?: 'id' | 'name'): Record<string, boolean>; /** * Get all categories consent state * @returns {Record<string, CategoryData['state']>} - The set of categories with the respective consent state. */ getCategoriesConsents(): Record<string, "ALL_DENIED" | "SOME_ACCEPTED" | "ALL_ACCEPTED">; /** * Get category consent state * @param {string} id - Category Id. * @returns {CategoryData['state']} - The consent state of the category. */ getCategoryConsent(id: string): "ALL_DENIED" | "SOME_ACCEPTED" | "ALL_ACCEPTED" | undefined; /** * Get category id from service id * @param {string} serviceId - Service Id. * @returns {string} - The category Id. */ getCategoryIdFromServiceId(serviceId: string): string; /** * Get global consent status (based on all services) * @returns {ConsentData['status']} - The global consent status. */ getConsentStatus(): ConsentData['status']; /** * Get the list of services ids which belong to the some_accepted or some_denied cases * @returns {string[]} - The list of services ids. */ getConsentServiceIds(): string[]; /** * Get service data by id * @param {string} serviceId - Service id. * @returns {ServiceData | undefined} - The service data. */ getService(serviceId: string): ServiceData | undefined; } declare class GoogleConsentModeModel implements GoogleConsentModeData { developerId: GoogleConsentModeData['developerId']; constructor(gcmData: GoogleConsentModeData, localStorageService: LocalStorageService, customEventService: CustomEventService); /** * Apply GCM data * @param {Record<string, ServiceData>} services - Services list. * @param {ConsentType} consentType - Type of given consent. * @returns {void} */ apply(services: DpsData['services'], consentType: _ConsentType1): void; } declare class LanguagesModel implements LanguagesData { languages: LanguagesData['languages']; constructor({ languages }: LanguagesData); /** * Determines wether or not a language is available * @param {string} language - Language code. * @returns {boolean} - True if language is available. */ getHasLanguage(language: string): boolean; /** * Get the language direction (ltr or rtl) * @param {string} language - Language code. * @returns {string} - The language direction. */ getLanguageScreenDirection(language: string): "ltr" | "rtl"; } declare class SettingModel implements SettingData { type: SettingData['type']; id: SettingData['id']; version: SettingData['version']; abVariant?: SettingData['abVariant']; constructor({ type, id, version, abVariant }: SettingData); /** * Get the settings type (GDPR | TCF | US) * @returns {SettingType} - The settings type. */ getType(): SettingType; /** * Get the settings id * @returns {string} - The settings id. */ getId(): string; /** * Get the settings version * @returns {string} - The settings version. */ getVersion(): string; } declare class TemplateModel implements TemplateData { id: TemplateData['id']; style: TemplateData['style']; html: TemplateData['html']; constructor({ id, style, html }: TemplateData); } export class ThemeModel implements _ThemeData1 { custom: _ThemeData1['custom']; breakPoints: NonNullable<_ThemeData1['breakPoints']>; cmp: _ThemeData1['cmp']; privacyButton: _ThemeData1['privacyButton']; embeddings: _ThemeData1['embeddings']; constructor(themeData: _ThemeData1); /** * Get screen type * @returns {ScreenType} - The screen type ("desktop" | "tablet" | "mobile" | "xs") */ getScreenType: () => _ScreenType1; getCmpTheme: (layer: "base" | "first" | "second", options?: { custom?: CustomCmpTheme; screenType?: _ScreenType1; direction?: _LayoutDirection1; }) => _CmpTheme1; /** * Get the theme for the privacy button view * @returns {PrivacyButtonTheme} - The privacy button theme. */ getPrivacyButtonTheme(options?: { custom?: CustomPrivacyButtonTheme; direction?: _LayoutDirection1; screenType?: _ScreenType1; }): _PrivacyButtonTheme1; getEmbeddingsTheme(options?: { custom?: CustomEmbeddingsTheme; direction?: _LayoutDirection1; screenType?: _ScreenType1; }): _EmbeddingsTheme1; getThemeDefaults(): { privacyButton: UcPrivacyButtonTheme; cmp: UcCmpTheme; embeddings: UcEmbeddingsTheme; }; } declare class UiModel implements _UiData1 { initialView: _UiData1['initialView']; theme: Required<_UiData1['theme']>; closedView: _UiData1['closedView']; language: _UiData1['language']; gpcSignalHonored: _UiData1['gpcSignalHonored']; dpsDisplayFormat: 'ALL' | 'SHORT'; isCmpPreviewPage: boolean; constructor({ initialView, closedView, theme, language, gpcSignalHonored, dpsDisplayFormat }: _UiData1); /** * Get the ui chosen language * @returns {string} - The ui language. */ getLanguage(): string; /** * Set the ui language * @param {string} language - Chosen language. * @returns {void} */ setLanguage(language: string): void; /** * Get the ui initial view * @returns {UiView | undefined} - The initial UI view. */ getInitialView(): _UiView1 | undefined; /** * Determine which view should be shown upon closing the CMP (none | button) * @returns {string} - The UI view to be shown after closing CMP. */ getClosedView(): "none" | "button"; } declare class GdprI18nModel extends I18nModel implements GdprI18nData { gdpr: GdprI18nData['gdpr']; constructor(gdprI18nData: GdprI18nData); } declare class TcfI18nModel extends I18nModel implements TcfI18nData { tcf: TcfI18nData['tcf']; constructor(tcfI18nData: TcfI18nData); } declare class TcfConsentModel extends GdprConsentModel implements TcfConsentData { tcString: TcfConsentData['tcString']; vendorsList: TcfConsentData['vendorsList']; acString: TcfConsentData['acString']; constructor(tcfConsentData: TcfConsentData, options?: { uiVersion?: string; acString?: TcfConsentData['acString']; }); /** * Set TCF consent string * @param {string} tcString - New TCF consentlanguage. * @returns {void} */ setTcString(tcString: string): void; /** * Set Google Additional Consent Mode string * @param {string} acString - New AC string. * @returns {void} */ setAcString(acString: string): void; } declare class IntegrationsModel implements IntegrationsData { scripts: IntegrationsData['scripts']; constructor({ scripts }: IntegrationsData); getScripts(): IntegrationScript[]; } export type TcfVendor = Vendor & TcfVendorInfo & { consent: boolean; legitimateInterestConsent: boolean; }; export interface IabRestrictionsData { purposes: number[]; legIntPurposes: number[]; notAllowedPurposes: number[]; } export type IabStacksData = number[]; export interface TcfLegalInfo { id: number; name: string; description: string; descriptionLegal?: string; illustrations?: string[]; } export interface TcfPurposeConsentInfo extends TcfLegalInfo { numberOfVendors: number; isPartOfStack: boolean; consent: { visible: boolean; given: boolean; }; legitimateInterestConsent: { visible: boolean; given: boolean; }; } export interface TcfSpecialFeatureConsentInfo extends TcfConsentInfo { isPartOfStack: boolean; } export interface TcfConsentInfo extends TcfLegalInfo { consent: boolean; } export interface TcfStack { description: string; name: string; id: number; purposes: number[]; specialFeatures: number[]; state: 'ALL_DENIED' | 'SOME_ACCEPTED' | 'ALL_ACCEPTED'; } export type TcfFeature = TcfLegalInfo; export type TcfSpecialFeature = TcfSpecialFeatureConsentInfo; export type TcfPurpose = TcfPurposeConsentInfo; export type TcfSpecialPurpose = TcfConsentInfo; export type TcfRestrictionsData = IabRestrictionsData; export type TcfDataCategory = { name: string; description: string; }; export type TcfVendors = Record<number, TcfVendor>; export type TcfPurposesData = Record<number, TcfPurpose>; export type TcfSpecialPurposesData = Record<number, TcfSpecialPurpose>; export type TcfFeaturesData = Record<number, TcfFeature>; export type TcfSpecialFeaturesData = Record<number, TcfSpecialFeature>; export type TcfStacksData = Record<number, TcfStack>; export type TcfDataCategories = Record<string, TcfDataCategory>; export interface TcfData { tcString?: string; purposes: TcfPurposesData; specialPurposes: TcfSpecialPurposesData; features: TcfFeaturesData; specialFeatures: TcfSpecialFeaturesData; stacks: TcfStacksData; dataCategories?: TcfDataCategories; vendors: TcfVendors; } export interface TcfVendorDetails { genericContent: { id: string; description?: string; body?: { parentId?: string; title?: string; type: 'list' | 'tag' | 'text' | 'link'; value: string | { parentId?: string; id: string; label: string; }[]; }; }[]; storedInfoContent?: { id: string; title: string; description?: string; disclosures?: StoredInfoItem[]; domains?: StoredInfoItem[]; url?: string; }; vendorsListContent?: { id: string; body: { title: string; value: { id: number; label: string; }[]; }; }; } export interface TcfConsentParams { id: number; consent?: boolean; legitimateInterestConsent?: boolean; } declare class TcfModel implements TcfData { vendors: TcfData['vendors']; purposes: TcfData['purposes']; specialPurposes: TcfData['specialPurposes']; features: TcfData['features']; specialFeatures: TcfData['specialFeatures']; stacks: TcfData['stacks']; dataCategories?: TcfData['dataCategories']; tcString?: TcfData['tcString']; updatedBy?: ConsentActionType; acm?: ACM; constructor(iabData: IabData, tcString: string, options?: { acm?: ACM; gcmEnabled?: boolean; advertiserConsentModeEnabled?: boolean; }); getPolicyVersion(): number; /** * Map IAB and GVL data * @param {IabData} iabData - IAB data. * @returns {void} */ mapIabData(iabData: IabData): void; /** * Get the timestamp of the latest tcString update * @returns {Date} - The timestamp of the latest tcString update */ getTcStringLastUpdate(): Date; /** * Get TCF consent string * @param {EncodingOptions | undefined} encodingOptions - Encoding options. * @returns {string} - The TCF consent string. */ getTcString(encodingOptions?: EncodingOptions): string; /** * Get Disclosed Vendors Segment TCF string * @returns {string} - The TCF consent string sgmented by disclosed vendors. */ getDisclosedVendorsSegmentString(): string; /** * Determine wether or not a purpose belongs to any stack * @param {number} id - Purpose id. * @returns {boolean} - True if the purpose id is present on some stack. */ getPurposeIsPartOfStack(id: number): boolean; /** * Determine wether or not a special feature belongs to any stack * @param {number} id - Special feature id. * @returns {boolean} - True if the special feature id is present on some stack. */ getSpecialFeatureIsPartOfStack(id: number): boolean; /** * Get the consent state of a specific stack * @param {number} id - Stack id. * @returns {string} - The stack consent state ("ALL_DENIED" | "ALL_ACCEPTED" | "SOME_ACCEPTED"). */ getStackState(id: number): "ALL_DENIED" | "SOME_ACCEPTED" | "ALL_ACCEPTED"; /** * Set the consent state of a specific stack * @param {number} id - Stack id. * @param {boolean} consent - Stack consent state. * @returns {void} */ setStackConsent(id: number, consent: boolean): void; /** * Get the consent state of a specific vendor * @param {number} id - Vendor id. * @returns {booelan} - The vendor consent state. */ getVendorConsent(id: number): boolean; /** * Get the legitimate interest consent state of a specific vendor * @param {number} id - Vendor id. * @returns {booelan} - The vendor legitimate interest consent state. */ getVendorLegitimateInterestConsent(id: number): boolean; /** * Get the consent state of a specific purpose * @param {number} id - Purpose id. * @returns {booelan} - The purpose consent state. */ getPurposeConsent(id: number): boolean; /** * Get the legitimate interest consent state of a specific purpose * @param {number} id - Purpose id. * @returns {booelan} - The purpose legitimate interest consent state. */ getPurposeLegitimateInterestConsent(id: number): boolean; /** * Get the consent state of a specific special feature * @param {number} id - Special feature id. * @returns {booelan} - The special feature consent state. */ getSpecialFeatureConsent(id: number): boolean; /** * Set the consent state of a specific purpose * @param {number} id - Purpose id. * @param {boolean} consent - Consent state. * @returns {void} */ setPurposeConsent(id: number, consent: boolean): void; /** * Set the legitimate interest consent state of a specific purpose * @param {number} id - Purpose id. * @param {boolean} consent - Legitimate interest consent state. * @returns {void} * @description It will not set the legitimate interest consent if legitimateInterestDisabled is true or legitimate interest is not visible for the purpose. */ setPurposeLegitimateInterestConsent(id: number, consent: boolean): void; /** * Set the consent state and legitimate interest consent of multiple purposes * @param {{id: number, consent?: boolean, legitimateInterestConsent?: boolean }[]} purposes array of purpose id and consent state * @returns {void} * @description It will not set the legitimate interest consent if legitimateInterestDisabled is true or legitimate interest is not visible for the purpose. */ setPurposesConsent(purposes: { id: number; consent?: boolean; legitimateInterestConsent?: boolean; }[]): void; /** * Set the consent state of multiple special features * @param {{id: number, consent: boolean }[]} features array of special feature id and consent state * @returns {void} */ setSpecialFeaturesConsent(features: { id: number; consent: boolean; }[]): void; /** * Set the consent state of a specific special feature * @param {number} id - Special Feature id. * @param {boolean} consent - Consent state. * @returns {void} */ setSpecialFeatureConsent(id: number, consent: boolean): void; /** * Set the consent state of a specific vendor * @param {number} id - Vendor id. * @param {boolean} consent - Consent state. * @returns {void} */ setVendorConsent(id: number, consent: boolean): void; /** * Set the consent state and legitimate interest consent of multiple vendors * @param {{id: number, consent?: boolean, legitimateInterestConsent?: boolean }[]} vendors array of vendor id and consent state * @returns {void} * @description It will not set the legitimate interest consent if legitimateInterestDisabled is true or vendor does not have any legitimate purpose. */ setVendorsConsent(vendors: TcfConsentParams[]): void; /** * Set the legitimate interest consent state of a specific vendor * @param {number} id - Vendor id. * @param {boolean} consent - Legitimate interest consent state. * @returns {void} * @description It will not set the legitimate interest consent if legitimateInterestDisabled is true or vendor does not have any legitimate purpose. */ setVendorLegitimateInterestConsent(id: number, consent: boolean): void; setAcmVendorConsent(id: number, consent: boolean): void; updateAcmVendorsPurposes(purposes: string[]): void; updateAcmVendorsConsent(consent: boolean): void; /** * Accept all vendors and purposes consents * @returns {void} */ acceptAll(): void; /** * Deny all vendors and purposes consents * @returns {void} */ denyAll(): void; /** * Update TcModel consent screen * @returns {void} */ updateConsentScreen(screen: ConsentScreen): void; /** * Update TcModel consent language * @returns {void} */ updateConsentLanguage(language: string): void; /** * Update TcModel timestamp * @returns {void} */ refreshTimestamp(): void; /** * Update the TCF string remotely * @returns {void} */ emitTcString(): void; /** * Change the TcModel language * @param {string} language - New chosen language. * @param {IabData} iabData - IAB data to be mapped with the new GVL object. * @returns {void} */ changeLanguage(language: string, iabData: IabData): Promise<TCModel>; /** * Determine wether or not are all consents accepted * @returns {boolean} - True if all vendors and purposes consents are accepted. */ areAllConsentsAccepted(): boolean; /** * Determine wether or not are all consents denied * @returns {boolean} - True if all vendors and purposes consents are denied. */ areAllConsentsDenied(): boolean; getACString(): string; setAddtlConsent(value: string): void; setUIOpen(): void; setUIClosed(): void; } declare class UetModel { constructor(customEventService: CustomEventService); apply(services: DpsData['services'], consentType: _ConsentType1): void; } declare class _CmpController1 { protected apiService: ApiService; protected gppService?: GppService; protected consentService: ConsentService; protected scriptService: ScriptService; protected customEventService: CustomEventService; protected localStorageService: LocalStorageService; protected crossDeviceService?: boolean; protected analyticsService?: AnalyticsService; protected dataLayerService?: DataLayerService; protected coreData?: SettingsCoreData; languages: LanguagesModel; ui: UiModel; dps: DpsModel; gcm?: GoogleConsentModeModel; uet?: UetModel; setting: SettingModel; consent?: GdprConsentModel | UsConsentModel | TcfConsentModel; i18n?: GdprI18nModel | UsI18nModel | TcfI18nModel; integrations?: IntegrationsModel; tcf?: TcfModel; template?: TemplateModel; theme: ThemeModel; constructor(cmpData: _CmpData1, { apiService, consentService, localStorageService, analyticsService, crossDeviceService, gppService }: CmpServices, options?: { consentData?: ConsentData; uiVersion?: string; settingsCoreData?: SettingsCoreData; }); /** * Get the consent details * @returns {Promise<ConsentDetails | undefined>} - The consent data used inside our UCstring. */ getConsentDetails(): Promise<ConsentDetails | undefined>; /** * Fetch the translated data from the API and created the respective variant i18n models * @returns {Promise<void>} */ initI18nData(): Promise<void>; /** * Clears the Local Storage including Cross Domain * @returns {Promise<void>} */ clearStorage(): Promise<void>; /** * Unblock the scripts which need consent to be run * @returns {Promise<string[]>} - A list with the services names which were unblocked. */ unblockScriptsWithConsent(): Promise<string[]>; /** * Get the Controller Id * @returns {string | undefined} - The controller id value. */ getC