@usercentrics/cmp-browser-sdk
Version:
Usercentrics CMP Browser SDK
187 lines (186 loc) • 10.8 kB
TypeScript
import { DeviceStorage } from '../../../Api/interfaces';
export declare enum RestrictionType {
/**
* under no circumstances is this purpose allowed.
*/
NOT_ALLOWED = 0,
/**
* if the default declaration is legitimate interest then this flips the purpose to consent in the encoding.
*/
REQUIRE_CONSENT = 1,
/**
* if the default declaration is consent then this flips the purpose to Legitimate Interest in the encoding.
*/
REQUIRE_LI = 2
}
export type TCFVendorRestrictionType = RestrictionType;
/** A TCF feature that needs to be disclosed to the end-user. */
export type TCFFeature = BasePurpose;
/** A TCF purpose that needs to be disclosed to the end-user and requires the end-user's consent and legitimate interest consent. */
export interface TCFPurpose extends BasePurpose {
/** A boolean or null value which indicates whether the user gave (true) or refused (false) consent or did not take action yet (null) for this TCF purpose. */
consent: boolean | null;
/** A boolean value which indicates whether the TCF purpose is part of a selected TCF stack. Stacks can be chosen in the admin interface. */
isPartOfASelectedStack: boolean;
/** A boolean or null value which indicates whether the user gave (true) or refused (false) legitimate interest or did not take action yet (null) for this TCF purpose. */
legitimateInterestConsent: boolean | null;
/** A boolean value which indicates whether the purpose toggle needs to be displayed in the TCF second layer. */
showConsentToggle: boolean;
/** A boolean value which indicates whether the legitimate interest toggle needs to be displayed in the TCF second layer. */
showLegitimateInterestToggle: boolean;
/** The id of the selected TCF stack that this purpose is a part of. Is always null if isPartOfASelectedStack is false and always a number otherwise */
stackId: number | null;
/** Number of vendors that use this purpose */
numberOfVendors: number;
}
/** A TCF special purpose that needs to be disclosed to the end-user. */
export type TCFSpecialPurpose = BasePurpose;
/** A TCF special feature that needs to be disclosed to the end-user and requires the end-user's consent. */
export interface TCFSpecialFeature extends BasePurpose {
/** A boolean or null value which indicates whether the user gave (true) or refused (false) consent or did not take action yet (null) for this TCF special feature. */
consent: boolean | null;
/** A boolean value which indicates whether the TCF special feature is part of a selected TCF stack. Stacks can be chosen in the admin interface. */
isPartOfASelectedStack: boolean;
/** The id of the selected TCF stack that this special feature is a part of. Is always null if isPartOfASelectedStack is false and always a number otherwise */
stackId: number | null;
/** A boolean value which indicates whether the special feature toggle needs to be displayed in the TCF second layer. */
showConsentToggle: boolean;
}
/**
* A TCF stack is a collection of multiple TCF purposes and TCF special features, with one shared description. On the
* first layer of a TCF UI, stacks may be shown as alternative to the included single purposes and special features.
*/
export interface TCFStack {
/** A user-friendly short description that needs to be disclosed to the end-user. It summarizes all comprising purposes' and special features' descriptions. */
description: string;
/** This TCF stack's unique id as defined in the IAB global vendor list. */
id: number;
/** This TCF stack's name as defined in the IAB global vendor list. It summarizes all comprising purposes' and special features' names. */
name: string;
/** All the ids of the TCF purposes that are included in this TCF stack. */
purposeIds: number[];
/** All the ids of the TCF special features that are included in this TCF stack */
specialFeatureIds: number[];
}
export interface TCFVendorCategory {
id: string;
name: string;
description: string;
}
export interface TCFVendorRetention {
id: string;
name: string;
}
/** A wrapper for all the data that needs to be disclosed to the end-user if TCF is enabled */
export interface TCFData {
/** A list of all the TCF features that need to be disclosed to the end-user if TCF is enabled */
features: TCFFeature[];
/** A list of all the TCF purposes that need to be disclosed to the end-user if TCF is enabled */
purposes: TCFPurpose[];
/** A list of all the TCF special features that need to be disclosed to the end-user if TCF is enabled */
specialFeatures: TCFSpecialFeature[];
/** A list of all the TCF special purposes that need to be disclosed to the end-user if TCF is enabled */
specialPurposes: TCFSpecialPurpose[];
/**
* A list of all TCF stacks that need to be disclosed to the end-user if TCF is enabled. On the first layer of a
* TCF UI, stacks may be shown as alternative its comprising purposes and special features. However, on the second
* layer, this is not allowed according to the IAB TCF v.2.0 guidelines. Also on the first layer, a purpose or special
* feature may not be shown if a stack containing this purpose or special feature is already displayed. Note, that all
* purposes and special features that are part of stacks will still be listed in the TCFData purposes and special
* features fields, but they will be flagged with isPartOfASelectedStack = true and include a non-null stackId.
*/
stacks: TCFStack[];
/** A list of all TCF vendors that need to be disclosed to the end-user if TCF is enabled */
vendors: TCFVendor[];
/** A list of all Additional Consent Mode vendors that need to be disclosed to the end-user if ACM is enabled */
acmVendors: ACMVendor[];
}
/**
* A TCF vendor (aka. advertiser, tracking service, third party) that is registered with the IAB global vendor list.
* A TCF vendor needs to be disclosed to the end-user and requires the end-user's consent and legitimate interest consent.
*/
export interface TCFVendor {
/** A boolean or null value which indicates whether the user gave (true) or refused (false) consent or did not decide yet (null) for this TCF vendor. */
consent: boolean | null;
/** A number that determines the max age for the cookie in seconds */
cookieMaxAgeSeconds: number | null;
/** A boolean value which indicates whether any cookies in scope for cookieMaxAgeSeconds are refreshed after being initially set. */
cookieRefresh: boolean | null;
/** An array of retentions (>=TCF22). */
dataRetention?: TCFVendorRetention[];
/** An array of categories (>=TCF22). */
dataCategories?: TCFVendorCategory[];
/** A value which states the URL of storage disclosure */
deviceStorage: DeviceStorage | null;
/** A value which states the URL of storage disclosure */
deviceStorageDisclosureUrl: string | null;
/** A list of both name and id of all TCF features that this TCF vendor uses as defined in the IAB global vendor list. */
features: IdAndName[];
/** A list of both name and id of all TCF flexible purposes for this vendor */
flexiblePurposes: IdAndName[];
/** This TCF vendor's unique id as defined in the IAB global vendor list. */
id: number;
/** A boolean or null value which indicates whether the user gave (true) or refused (false) legitimate interest or did not decide yet (null) for this TCF vendor. */
legitimateInterestConsent: boolean | null;
/** This TCF vendor's link to it's legitimate interest claim website as defined in the IAB global vendor list (>=TCF22). */
legitimateInterestClaimUrl?: string;
/** A list of both name and id of all TCF purposes that this TCF vendor uses by legitimate interest as defined in the IAB global vendor list. */
legitimateInterestPurposes: IdAndName[];
/** This TCF vendor's name as defined in the IAB global vendor list. */
name: string;
/** This TCF vendor's link to it's privacy policy website as defined in the IAB global vendor list (<TCF22). */
policyUrl?: string;
/** This TCF vendor's link to it's privacy policy website as defined in the IAB global vendor list (>=TCF22). */
privacyUrl?: string;
/** A list of both name and id of all TCF purposes that this TCF vendor uses as defined in the IAB global vendor list. */
purposes: IdAndName[];
/** A list of both name and id of all TCF special purposes that this TCF vendor uses as defined in the IAB global vendor list. */
specialFeatures: IdAndName[];
/** A list of both name and id of all TCF special purposes that this TCF vendor uses as defined in the IAB global vendor list. */
specialPurposes: IdAndName[];
showVendorOutsideEU: boolean;
/** A boolean value which indicates whether consent toggle needs to be displayed in the TCF second layer for the vendor. Is true if purposes are processed by consent. */
showConsentToggle: boolean;
/** A boolean value which indicates whether the legitimate interest toggle needs to be displayed in the TCF second layer for the vendor. Is true if purposes are processed by legitimate interest. */
showLegitimateInterestConsentToggle: boolean;
/** A boolean value which indicates whether the vendor uses cookie storage (session or otherwise). */
usesCookies: boolean;
/** A boolean value which indicates whether the vendor uses non cookie access */
usesNonCookieAccess: boolean | null;
}
/** A TCF vendor restriction for a flexible purpose */
export interface TCFVendorRestriction {
/** The purpose id */
purposeId: number;
/** The restriction type */
restrictionType: TCFVendorRestrictionType;
}
/** A generic wrapper for a unique id and a name. Introduced to minimize redundancy. */
export interface IdAndName {
/** A unique id. */
id: number;
/** A name. */
name: string;
}
export interface BasePurpose {
/** A user-friendly short description that needs to be disclosed to the end-user. */
description: string;
/** An official legal description that needs to be disclosed to the end-user (<TCF22). */
descriptionLegal?: string;
/** An official example description that needs to be disclosed to the end-user (>=TCF22). */
illustrations?: string[];
/** The unique id as defined in the IAB global vendor list. */
id: number;
/** The name as defined in the IAB global vendor list. */
name: string;
}
/** Google Additional Consent Mode Vendor */
export interface ACMVendor {
consent: {
status: boolean;
};
id: number;
name: string;
privacyPolicyUrl: string;
purposes: IdAndName[];
}