UNPKG

@usercentrics/cmp-browser-sdk

Version:
182 lines (181 loc) 5.61 kB
import { BUTTON_ALIGNMENT, DPS_DISPLAY_FORMAT, FIRST_LAYER_VARIANT, SECOND_LAYER_SIDE, SECOND_LAYER_TRIGGER, SECOND_LAYER_VARIANT, THEME } from '../enums'; import { PrivacyButtonURLs, SECOND_LAYER_DEFAULT_VIEW } from '../../Api/interfaces'; import { CLOSE_OPTION } from '../../Api/enums'; import { CornerPosition } from '../Core/interfaces'; export type SecondLayerUrl = string; export interface ButtonColor { backgroundColor: string | null; textColor: string | null; } export type MaybeButton = ButtonColor | null; export interface SaveButtonCustomization { save: ButtonColor; } export interface CcpaButtonCustomization { ok: ButtonColor; } export interface CommonButtonsCustomization { accept: ButtonColor; deny: ButtonColor; } export interface DefaultButtonsCustomization extends CommonButtonsCustomization, SaveButtonCustomization { more: ButtonColor; } export type TcfButtonsCustomization = CommonButtonsCustomization; export interface ButtonsCustomization { alignment: BUTTON_ALIGNMENT; borderRadius: string; secondLayer: SecondLayerUrl | null; } interface FirstLayerCustomization { secondLayerTrigger: SECOND_LAYER_TRIGGER; } export interface FontCustomization { family: string; size: number; } export interface LayerCustomization { backgroundColor: string; borderRadius: string; } export interface LinkCustomization { fontColor: string; iconColor: string; } type VerticalPosition = 'left' | 'right' | 'center'; export interface LogoCustomization { altTag: string | null; position: VerticalPosition; url: string | null; } export interface OverlayCustomization { backgroundColor: string; opacity: number; } export interface ToggleCustomization { active: { backgroundColor: string; iconColor: string; }; disabled: { backgroundColor: string; iconColor: string; }; inactive: { backgroundColor: string; iconColor: string; }; } export interface CcpaButtonsConfig extends CcpaButtonCustomization, ButtonsCustomization { optOutNotice: { isHidden: boolean; label: string; }; } export type DefaultButtonsConfig = ButtonsCustomization & DefaultButtonsCustomization; export interface TCFButtonsConfig extends ButtonsCustomization, TcfButtonsCustomization { save: MaybeButton; } export interface PoweredBy { partnerUrl: string | null; url: string | null; } interface FirstLayerConfig { isLanguageSelectorEnabled: boolean; isOverlayEnabled: boolean; showShortDescriptionOnMobile: boolean; showShortDescriptionOnDesktop: boolean; variant: FIRST_LAYER_VARIANT; } export interface CcpaFirstLayerConfig extends FirstLayerConfig, FirstLayerCustomization { hideToggles: boolean; } export interface DefaultFirstLayerConfig extends FirstLayerConfig, FirstLayerCustomization { closeOption: CLOSE_OPTION | null; hideButtonDeny: boolean; hideToggles: boolean; isCategoryTogglesEnabled: boolean; } export interface TCFFirstLayerConfig extends FirstLayerCustomization { hideButtonDeny: boolean; hideCustomizationButton: boolean; hideNonIabPurposes: boolean; hideToggles: boolean; isOverlayEnabled: boolean; showDescriptions: boolean; } export interface SecondLayerConfig { defaultView: SECOND_LAYER_DEFAULT_VIEW; hideDataProcessingServices: boolean; isLanguageSelectorEnabled: boolean; isOverlayEnabled: boolean; showCategoriesTab: boolean; showServicesTab: boolean; side: SECOND_LAYER_SIDE; tabColor: string | null; variant: SECOND_LAYER_VARIANT; dpsDisplayFormat: DPS_DISPLAY_FORMAT; } export interface CcpaSecondLayerConfig extends SecondLayerConfig { hideToggles: boolean; } export interface DefaultSecondLayerConfig extends SecondLayerConfig { hideButtonDeny: boolean; hideToggles: boolean; hideTogglesForServices: boolean; } export interface TCFSecondLayerConfig { dpsDisplayFormat: DPS_DISPLAY_FORMAT; hideButtonDeny: boolean; hideLegitimateInterestToggles: boolean; hideToggles: boolean; isOverlayEnabled: boolean; showToggleAllVendors: boolean; tabColor: string | null; } export interface CommonUI { accentColor: string; customCss: string | null; enablePrivacyButton: boolean; font: FontCustomization; layer: LayerCustomization; links: LinkCustomization; logo: LogoCustomization; overlay: OverlayCustomization; primaryColor: string; privacyButtonUrls?: PrivacyButtonURLs; poweredBy: PoweredBy | null; showCookieInformation: boolean; textColor: string; theme: THEME; toggle: ToggleCustomization; useBackgroundShadow: boolean; } export interface CcpaUI extends CommonUI { buttons: CcpaButtonsConfig; firstLayer: CcpaFirstLayerConfig; secondLayer: CcpaSecondLayerConfig; } export interface DefaultUI extends CommonUI { buttons: DefaultButtonsConfig; firstLayer: DefaultFirstLayerConfig; secondLayer: DefaultSecondLayerConfig; } export interface TcfUI extends CommonUI { buttons: TCFButtonsConfig; firstLayer: TCFFirstLayerConfig; secondLayer: TCFSecondLayerConfig; } export interface PrivacyButtonUI { customCss: string | null; hideDataProcessingServices: boolean; defaultView: SECOND_LAYER_DEFAULT_VIEW; backgroundColor: string | null; desktopSize: number | null; iconColor: string | null; iconUrl: string | null; mobileSize: number | null; position: CornerPosition; } export type UI = CcpaUI | DefaultUI | TcfUI | PrivacyButtonUI; export {};