@usercentrics/cmp-browser-sdk
Version:
Usercentrics CMP Browser SDK
106 lines (105 loc) • 4.26 kB
TypeScript
import { UserCountryData, UserSessionData } from './index.legacy';
export interface IntMap<T> {
[id: string]: T;
}
/** All the different UI layers */
export declare const enum UI_LAYER {
FIRST_LAYER = 0,
NONE = 1,
PRIVACY_BUTTON = 2,
SECOND_LAYER = 3
}
/** All the different UI variants */
export declare const enum UI_VARIANT {
CCPA = 0,
DEFAULT = 1,
TCF = 2
}
/** The init() return values, that determine what variant and layer should be shown */
export interface InitialUIValues {
ampEnabled: boolean;
initialLayer: UI_LAYER;
variant: UI_VARIANT;
}
export interface UcDomains {
aggregator: string;
app: string;
cdn: string;
consents: string;
consentsV2: string;
consentsV2Fetch: string;
crossDomainConsentSharingIFrame: string;
graphql: string;
trackingEvent: string;
}
export type RuleSetControllerIds = {
controllerId: string;
settingsId: string;
}[];
export type SettingsControllerId = string;
export interface UCError extends Error {
showErrorCmp?: boolean;
}
/** Additional options you can pass to the constructor */
export interface InitOptions {
/** This option is responsible of enabling AMP */
ampEnabled?: boolean;
/** Block push to the data layer */
blockDataLayerPush?: boolean;
/**
* User's generated controllerId to restore a user session with settingsId
* NOTE: always store the contorllerId with the settingsId
* */
controllerId?: SettingsControllerId;
/**
* User's generated controllerIds to restore a user session with rulesetId
* NOTE: always store the contorllerId with the settingsId
* */
controllerIds?: RuleSetControllerIds;
/**
* Indicate if the TCF stub will be enabled on on load time. We can not wait for this information to come from the
* settings, as by the TCF guidelines the __tcfapi need to be exposed from the very start.
*/
createTcfApiStub?: boolean;
/**
* Indicate if the GPP stub will be enabled on load time. We can not wait for this information to come from the
* settings, as by the GPP guidelines the __gpp needs to be exposed from the very start.
*/
createGppStub?: boolean;
/** When enabled, the CMP will be shown in a dialog */
dialogMode?: boolean;
/** When disabled, analytics will not track ui events */
disableTracking?: boolean;
/** When disabled, Universal Event Tracking will not push consent changes to window.eutq */
disableUet?: boolean;
/** When enabled will additionally save consent to the deprecated V1 consents API */
enableDeprecatedV1ConsentSaving?: boolean;
/** When enabled, only servers with EU IPs are used (including CDN) */
euMode?: boolean;
/** Array to exclude vendors from the Accept All method */
excludeAcceptAllVendors?: number[];
/** Enforce a certain initial language for the user (default: user's browser language) */
language?: string;
/** Enforce consents not being saved on Usercentrics server, only using localstorage for the effect */
disableServerConsents?: boolean;
/** Enforce the preload of the services information on init */
prefetchServices?: boolean;
/** Ruleset id which points to an existing geolocation config settingsIds mapping */
rulesetId?: string;
/** When enable, we use sandbox API only */
sandboxEnv?: boolean;
/** Optional string, which is added to all settings GET requests, allowing instant cache-busting */
settingsCache?: string;
/** Store service id to name mapping */
storeServiceIdToNameMapping?: boolean | false;
/** Optional boolean, this will force InitialUIValues initialLayer to be UI_LAYER.PRIVACY_BUTTON OR UI_LAYER.NONE */
suppressCmpDisplay?: boolean;
/** Optional boolean, if true browser SDK will use the config map Id to fetch the settings id depending on user's geolocation */
useRulesetId?: boolean;
/** Optional userCountry data to simulate user location */
userCountryData?: UserCountryData;
/** Optional User Session data to be restored on init */
userSessionData?: UserSessionData | null;
/** Lock into a specific Usercentrics settings version (default: latest) */
version?: string;
}