@usercentrics/cmp-browser-sdk
Version:
Usercentrics CMP Browser SDK
566 lines (565 loc) • 17.1 kB
TypeScript
import { BUTTON_ALIGNMENT, DPS_DISPLAY_FORMAT, FIRST_LAYER_VARIANT, SECOND_LAYER_SIDE, SECOND_LAYER_TRIGGER, SECOND_LAYER_VARIANT } from '../../SettingsV2/enums';
import { CLOSE_OPTION, LEGACY_CCPA_REGION, LEGACY_DATA_EXCHANGE_TYPE, LEGACY_VERSION } from '../enums';
export type ServiceLegalBasis = LegalBasis | LegalBasisId;
export interface CoreCcpa {
iabAgreementExists: boolean;
isActive: boolean;
reshowAfterDays: number;
reshowCMP?: boolean;
region: LEGACY_CCPA_REGION;
showOnPageLoad: boolean;
}
export interface CoreTcf {
resurfaceIABLegalBasisChanged: boolean;
resurfacePeriodEnded: boolean;
resurfacePurposeChanged: boolean;
resurfaceVendorAdded: boolean;
resurfaceATPListChanged: boolean;
}
export interface LegacyTCF2ChangedPurposes {
purposes: number[];
legIntPurposes: number[];
notAllowedPurposes: number[];
}
export interface LegacyTCF2AtpPurposes {
p1: string;
p2: string;
}
export interface LegacyBackgroundOverlay {
darken: number;
target: number[];
}
export interface LegacyBaseService {
description: string;
templateId: string;
version: string;
}
export interface LegacyCategory {
categorySlug: string;
description: string;
isEssential: boolean;
isHidden: boolean;
label: string;
}
export interface LegacyCcpa extends CoreCcpa {
btnSave: string;
btnMoreInfo: string;
firstLayerDescription: string;
firstLayerHideLanguageSwitch: boolean;
firstLayerMobileDescription: string;
firstLayerMobileDescriptionIsActive: boolean;
firstLayerShortMessage?: string;
firstLayerTitle: string;
firstLayerUseShortMessage?: boolean;
firstLayerVariant: FIRST_LAYER_VARIANT;
optOutNoticeLabel: string;
removeDoNotSellToggle: boolean;
reshowCMP: boolean;
secondLayerDescription: string;
secondLayerHideLanguageSwitch: boolean;
secondLayerSide: SECOND_LAYER_SIDE;
secondLayerTitle: string;
secondLayerVariant: SECOND_LAYER_VARIANT;
}
export interface LegacyDataExchangeSetting {
names: string[];
type: LEGACY_DATA_EXCHANGE_TYPE;
}
export type LegalBasis = string;
export type LegalBasisId = string;
export interface LegalBasisTranslation {
[key: string]: string;
}
export interface LegacyAriaLabelsTranslations {
acceptAllButton: string;
ccpaButton: string;
ccpaMoreInformation: string;
closeButton: string;
collapse: string;
cookiePolicyButton: string;
copyControllerId: string;
denyAllButton: string;
expand: string;
fullscreenButton: string;
imprintButton: string;
languageSelector: string;
privacyButton: string;
privacyPolicyButton: string;
saveButton: string;
serviceInCategoryDetails: string;
servicesInCategory: string;
tabButton: string;
usercentricsCMPButtons: string;
usercentricsCMPContent: string;
usercentricsCMPHeader: string;
usercentricsCMPUI: string;
usercentricsCard: string;
usercentricsList: string;
vendorConsentToggle: string;
vendorDetailedStorageInformation: string;
vendorLegIntToggle: string;
}
export type AriaLabelsTranslation = LegacyAriaLabelsTranslations;
export interface LegacyLabelsTranslations {
ALL: string;
BACK: string;
CID_TITLE: string;
CNIL_DENY_LINK_TEXT: string;
COOKIE_REFRESH: string;
COOKIE_STORAGE: string;
DETAILS: string;
GPC_SIGNAL_HONORED: string | null;
LANGUAGE_CHANGE: string | null;
SUB_SERVICE: string;
SUB_SERVICES: string;
SUB_SERVICES_DESCRIPTION: string;
WEB_TCF_MAX_STORAGE_DURATION_TITLE: string;
THIRD_COUNTRY_TRANSFER: string;
VENDORS_OUTSIDE_EU: string;
WEB_TCF_MAX_STORAGE_DURATION_TEXT: string;
WEB_DUTCH_AUTH_TEXT: string;
}
export interface Translations {
labels: LegacyLabelsTranslations;
labelsAria: LegacyAriaLabelsTranslations;
legalBasis: LegalBasisTranslation;
}
export declare enum DisclosureType {
COOKIE = 0,
WEB = 1,
APP = 2
}
export interface Disclosure {
identifier: string;
name: string | null;
description: string | null;
type: DisclosureType;
maxAgeSeconds: number | null;
cookieRefresh: boolean | null;
domain: string | null;
purposes: number[] | null;
}
export interface DeviceStorageDomain {
domain: string;
use: string | null;
}
export interface DeviceStorage {
disclosures: Disclosure[];
domains?: DeviceStorageDomain[];
}
export interface LegacyHashService extends LegacyBaseService {
addressOfProcessingCompany: string;
cookieMaxAgeSeconds: number | null;
cookieRefresh: boolean | null;
cookiePolicyURL: string;
dataCollectedList: string | string[];
dataProtectionOfficer: string;
dataProcessor: string;
dataProcessors: string[];
dataPurposes: string[];
dataPurposesList: string | string[];
dataRecipientsList: string | string[];
descriptionOfService: string;
deviceStorage: DeviceStorage | null;
deviceStorageDisclosureUrl: string | null;
language: string;
languagesAvailable: string[];
legalBasisList: string[];
legalGround: string;
linkToDpa: string;
locationOfProcessing: string;
nameOfProcessingCompany: string;
optOutUrl: string;
policyOfProcessorUrl: string;
privacyPolicyURL: string;
processingCompany: string;
retentionPeriodDescription: string;
retentionPeriodList: string[];
technologyUsed: string | string[];
thirdCountryTransfer: string;
usesCookies: boolean | null;
usesNonCookieAccess: boolean | null;
}
export interface LegacyService extends LegacyBaseService {
_meta?: {
name: string;
};
categorySlug: string;
defaultConsentStatus: boolean;
disableLegalBasis: boolean;
isDeactivated: boolean;
isHidden: boolean;
legalBasisList?: LegalBasisId[];
subConsents?: LegacyService[];
usesThirdCountry: boolean;
}
export interface LegacyCustomizationFont {
family: string;
size: number;
}
export interface CoreColorCustomization {
primary: string;
privacyButtonBackground?: string;
privacyButtonIcon?: string;
}
export interface CoreCustomization {
color: CoreColorCustomization | null;
privacyButtonSizeDesktop?: number;
privacyButtonSizeMobile?: number;
}
export interface LegacyCustomizationColor extends CoreColorCustomization {
ccpaButtonColor: string;
ccpaButtonTextColor: string;
acceptBtnBackground: string;
acceptBtnText: string;
denyBtnBackground: string;
denyBtnText: string;
layerBackground?: string;
linkFont?: string;
linkIcon?: string;
moreBtnBackground: string;
moreBtnText: string;
overlay?: string;
saveBtnBackground: string;
saveBtnText: string;
secondLayerTab: string;
text?: string;
tabsBorderColor?: string;
toggleActiveBackground?: string;
toggleActiveIcon?: string;
toggleDisabledBackground?: string;
toggleDisabledIcon?: string;
toggleInactiveBackground?: string;
toggleInactiveIcon?: string;
}
export interface LegacyCustomizationSettings {
borderRadiusButton?: string | number;
borderRadiusLayer?: string | number;
buttonAlignment: BUTTON_ALIGNMENT;
color: LegacyCustomizationColor | null;
font: LegacyCustomizationFont | null;
logoAltTag: string | null;
logoUrl: string | null;
overlayOpacity?: number;
privacyButtonSizeDesktop?: number;
privacyButtonSizeMobile?: number;
useBackgroundShadow?: boolean;
}
export declare enum FIRST_LAYER_LOGO_POSITION {
LEFT = "LEFT",
CENTER = "CENTER",
RIGHT = "RIGHT"
}
export interface TestVariant {
[key: string]: Record<string, unknown>;
}
export interface LegacyFeatures {
customCss?: boolean;
}
export interface PrivacyButtonURLs {
contains: string[];
containsNot: string[];
isEqualTo: string[];
isNotEqualTo: string[];
regEx: string[];
startsNotWith: string[];
startsWith: string[];
}
export interface Fraud0IntegrationData {
accountId: string;
}
export interface LinkIntegrationData {
privacyCenterLabel: string;
privacyCenterUrl: string;
}
export interface IntegrationData {
mine?: LinkIntegrationData[];
fraud0?: Fraud0IntegrationData[];
}
export interface ScriptIntegrationData {
id: string;
}
export interface CoreJsonResponse {
allowedDomainOptions?: {
list?: string[];
showErrorCmp?: boolean;
};
buttonDisplayLocation: string;
buttonPrivacyCloseIcon?: string | null;
buttonPrivacyOpenIconUrl?: string | null;
ccpa?: CoreCcpa;
consentAnalytics?: boolean;
consentAPIv2?: boolean;
consentXDevice?: boolean;
consentSharingIFrameIsActive: boolean;
customization?: CoreCustomization;
dataExchangeOnPage: LegacyDataExchangeSetting[];
displayOnlyForEU: boolean;
enableBotDetection: boolean;
enablePoweredBy: boolean;
framework: string | null;
googleConsentMode: boolean;
interactionAnalytics: boolean;
integrations?: IntegrationData;
labels: CoreLabels;
languagesAvailable: string[];
partnerPoweredByUrl: string;
pipedaEnabled?: boolean;
privacyButtonIsVisible: boolean;
privacyButtonUrls?: PrivacyButtonURLs;
renewConsentsTimestamp?: number | null;
reshowBanner: number | null;
settingsId: string;
showInitialViewForVersionChange: LEGACY_VERSION[];
tagLoggerIsActive: boolean;
tcf2?: CoreTcf;
tcf2Enabled?: boolean;
variants?: Variants | null;
version: string;
}
export interface DpsJsonResponse {
categories: LegacyCategory[];
consentTemplates: LegacyService[];
}
export interface Variants {
enabled: boolean;
experiments: string;
}
export declare enum SECOND_LAYER_DEFAULT_VIEW {
CAT = "CAT",
SRV = "SRV"
}
export interface LegacySettings extends DpsJsonResponse, CoreJsonResponse {
allowedDomains?: string[];
dpsDisplayFormat: DPS_DISPLAY_FORMAT;
backgroundOverlay: LegacyBackgroundOverlay[];
bannerMessage: string;
bannerMobileDescription: string;
bannerMobileDescriptionIsActive: boolean;
btnDenyIsVisible: boolean;
btnMoreInfoActionSelection: number;
buttonDisplayLocation: string;
ccpa: LegacyCcpa;
consentTemplates: LegacyService[];
consentSharingIFrameIsActive: boolean;
cookiePolicyUrl: string | null;
customization?: LegacyCustomizationSettings;
enableBotDetection: boolean;
features?: LegacyFeatures;
firstLayer: {
closeOption?: CLOSE_OPTION | null;
hideButtonDeny: boolean;
hideLanguageSwitch: boolean;
isCategoryTogglesEnabled: boolean;
isOverlayEnabled: boolean;
logoPosition?: FIRST_LAYER_LOGO_POSITION;
secondLayerTrigger?: SECOND_LAYER_TRIGGER;
variant: FIRST_LAYER_VARIANT;
shortMessage?: string;
useShortMessage?: boolean;
};
gdpr?: {
addVendorCount: boolean;
secondLayerDescription?: string;
};
framework: string | null;
imprintUrl: string;
interactionAnalytics: boolean;
labels: LegacyLabels;
moreInfoButtonUrl: string;
privacyPolicyUrl: string;
secondLayer: {
acceptButtonText: string;
defaultView: SECOND_LAYER_DEFAULT_VIEW;
denyButtonText: string;
hideButtonDeny: boolean;
hideDataProcessingServices: boolean;
hideLanguageSwitch: boolean;
isOverlayEnabled: boolean;
hideTogglesForServices: boolean | null;
side: SECOND_LAYER_SIDE;
tabsCategoriesLabel: string;
tabsCategoriesIsEnabled: boolean;
tabsServicesIsEnabled: boolean;
tabsServicesLabel: string;
variant: SECOND_LAYER_VARIANT;
};
showErrorOnUnallowedDomain?: boolean;
showLanguageDropdown: boolean;
showCookieInformation: boolean;
settingsId: string;
stylesCss?: string | null;
tcf2: LegacyTCF2;
testVariants?: TestVariant;
useUnsafeCustomCss?: boolean;
gpcSignalHonoured?: boolean;
microsoftClarityConsentSignalEnabled: boolean;
}
export interface CoreLabels {
partnerPoweredByLinkText: string;
poweredBy: string;
}
export interface LegacyLabels extends CoreLabels {
accepted: string;
anyDomain: string;
back: string;
btnAcceptAll: string;
btnBannerReadMore: string;
btnChipName: string;
btnClose: string;
btnDeny: string;
btnMore: string;
btnSave: string;
categories: string;
cookiePolicyInfo: string;
cookiePolicyLinkText: string | null;
copy: string;
copied: string;
consentType: string;
dataCollectedInfo: string;
dataCollectedList: string;
dataRecipientsList: string;
dataRecipientsListInfo: string;
dataProtectionOfficer: string;
dataProtectionOfficerInfo: string;
dataPurposes: string;
dataPurposesInfo: string;
date: string;
day: string;
days: string;
decision: string;
denied: string;
descriptionOfService: string;
detailedStorageInformation: string;
details: string;
domain: string;
duration: string;
explicit: string;
firstLayerTitle: string | null;
gpcSignalHonored: string | null;
headerCorner: string;
history: string;
hour: string;
hours: string;
identifier: string;
implicit: string;
imprintLinkText: string;
informationLoadingNotPossible: string;
legalBasisList: string;
legalBasisInfo: string;
loadingStorageInformation: string;
locationOfProcessing: string;
locationofProcessingInfo: string;
maximumAgeCookieStorage: string;
minute: string;
minutes: string;
month: string;
months: string;
multipleDomains: string;
name: string;
no: string;
noImplicit: string;
nonCookieStorage: string;
optOut: string;
policyOf: string;
privacyPolicyLinkText: string;
processingCompany: string;
purposes: string | null;
readLess: string;
retentionPeriod: string;
retentionPeriodInfo: string;
second: string;
seconds: string;
session: string;
showMore: string;
storageInformation: string;
storageInformationDescription: string;
storedInformation: string;
storedInformationDescription: string;
subservice: string;
subservices: string;
languageChange: string;
subservicesDescription: string;
technologiesUsed: string;
technologiesUsedInfo: string;
titleCorner: string;
transferToThirdCountries: string;
transferToThirdCountriesInfo: string;
tryAgain: string;
type: string;
year: string;
years: string;
yes: string;
yesImplicit: string;
}
export interface LegacyTCF2 extends CoreTcf {
acmV2Enabled?: boolean;
advertiserConsentModeEnabled?: boolean;
atpAdditionalInfo: string;
atpListTitle: string;
atpPurposes?: LegacyTCF2AtpPurposes;
buttonsAcceptAllLabel: string;
buttonsDenyAllLabel: string;
buttonsDenyAllIsEnabled: boolean;
buttonsSaveLabel: string;
categoriesOfDataLabel: string;
changedPurposes: LegacyTCF2ChangedPurposes;
cmpId?: number;
cmpVersion?: number;
consensuDomain?: string;
consensuScriptPath?: string;
dataRetentionPeriodLabel: string;
dataSharedOutsideEUText?: string;
disabledSpecialFeatures: number[];
examplesLabel?: string;
enforceAcceptAll: boolean;
firstLayerAdditionalInfo: string | null;
firstLayerDescription: string;
firstLayerHideButtonDeny: boolean | null;
firstLayerHideToggles: boolean;
firstLayerNoteGlobal: string;
firstLayerNoteService: string;
firstLayerNoteResurface: string | null;
firstLayerShowDescriptions: boolean;
firstLayerTitle: string;
gdprApplies: boolean;
hideLegitimateInterestToggles: boolean;
hideNonIabOnFirstLayer: boolean;
labelsActivateAllVendors: string;
labelsDisclaimer: string;
labelsFeatures: string;
labelsIabVendors: string;
labelsNonIabPurposes: string;
labelsNonIabVendors: string;
labelsPurposes: string;
legitimateInterestLabel: string;
linksVendorListLinkLabel: string;
linksManageSettingsLabel: string;
publisherCountryCode: string;
purposeOneTreatment: boolean;
privacyPolicyLinkText: string;
secondLayerDescription: string;
secondLayerHideButtonDeny: boolean | null;
secondLayerTitle: string;
secondLayerHideToggles: boolean;
selectedATPIds?: number[];
selectedVendorIds: number[];
selectedStacks: number[];
showCookieInformation: boolean;
showDataSharedOutsideEUText?: boolean;
tabsPurposeLabel: string;
tabsVendorsLabel: string;
tcfv2HistoryDisabled: boolean;
togglesConsentToggleLabel: string;
togglesLegIntToggleLabel: string;
togglesSpecialFeaturesToggleOff: string;
togglesSpecialFeaturesToggleOn: string;
vendorFeatures: string;
vendorIdsOutsideEUList?: number[];
vendorLegitimateInterestPurposes: string;
vendorPurpose: string;
vendorSpecialFeatures: string;
vendorSpecialPurposes: string;
vendorToggleAll: boolean;
version: '2.0' | '2.1' | '2.2';
}