import { ComponentDefaultProps } from '@justeattakeaway/pie-webc-core'; import { CSSResult } from 'lit'; import { PieElement } from '@justeattakeaway/pie-webc-core/src/internals/PieElement'; import { PieSwitch } from '@justeattakeaway/pie-switch'; import { PropertyValues } from 'lit'; import { TemplateResult } from 'lit'; import { TemplateResult as TemplateResult_2 } from 'lit-html'; export declare const availableLocales: Set; export declare interface CookieBannerLocale { banner: { title: string; description: string; cta: { managePreferences: string; necessaryOnly: string; acceptAll: string; }; }; preferencesManagement: { title: string; description: string; all: { title: string; }; necessary: { title: string; description: string; }; functional: { title: string; description: string; }; analytical: { title: string; description: string; }; personalized: { title: string; description: string; }; cta: { save: { label: string; ariaLabel: string; }; }; }; } export declare interface CookieBannerProps { /** * When true, sets the variant to "primary" for the button which accepts necessary cookies only. */ hasPrimaryActionsOnly: boolean; /** * The URL of the cookie statement page the banner should link to. */ cookieStatementLink: string; /** * An optional override for the personalised preference label rendered in the * "Manage preferences" modal. When provided, this string replaces the locale-defined * label for the personalised preference. Consumers can include plain text. * When omitted or set to an empty string, the built-in locale string is used. */ personalizedLabel?: string; /** * An optional override for the personalised preference description rendered in the * "Manage preferences" modal. When provided, this string replaces the locale-defined * description for the personalised preference. Consumers can include plain text, * HTML anchor tags (e.g. `Privacy Policy`), or `` tags * to embed a privacy policy link. The HTML is sanitised, so only the allowed link * attributes are preserved and any others are stripped or normalised. When omitted or * set to an empty string, the built-in locale string is used. */ personalizedDescription?: string; /** * The URL for the cookie technology link. */ cookieTechnologiesLink: string; /** * Assigns the country used for dynamically localising the component strings */ country: CountryCode; /** * Assigns the language used for dynamically localising the component strings */ language: LanguageCode; /** * Allows consumers to pass in specific preference(s) to the component which will toggle * the switch to be on by default (if set to `true`). * * e.g. { 'functional': true } * or { 'functional': true, 'personalized': true, 'analytical': true } */ defaultPreferences?: Partial>; /** * When true, external links (Cookie Statement, Cookie Technologies) * will open in the same tab (`target="_self"`). * When false (default), links open in a new browser tab (`target="_blank"`). */ openLinksInSameTab?: boolean; } export declare const Country: { readonly [key: string]: string; }; export declare type CountryCode = typeof Country[keyof typeof Country]; export declare interface CustomTagEnhancers { [key: string]: (tagContent: string) => TemplateResult; } export declare const defaultLocaleForCountry: Map; export declare type DefaultProps = ComponentDefaultProps; export declare const defaultProps: DefaultProps; export declare const Language: { readonly [key: string]: string; }; export declare type LanguageCode = typeof Language[keyof typeof Language]; /** * Event name for when all cookies are accepted. * * @constant */ export declare const ON_COOKIE_BANNER_ACCEPT_ALL = "pie-cookie-banner-accept-all"; /** * Event name for when a user clicks manage preferences. * * @constant */ export declare const ON_COOKIE_BANNER_MANAGE_PREFS = "pie-cookie-banner-manage-prefs"; /** * Event name for when all only necessary cookies are accepted. * * @constant */ export declare const ON_COOKIE_BANNER_NECESSARY_ONLY = "pie-cookie-banner-necessary-only"; /** * Event name for when a user clicks save preferences. * * @constant */ export declare const ON_COOKIE_BANNER_PREFS_SAVED = "pie-cookie-banner-prefs-saved"; /** * @tagname pie-cookie-banner * @event {CustomEvent} pie-cookie-banner-accept-all - when all cookies are accepted. * @event {CustomEvent} pie-cookie-banner-necessary-only - when all only necessary cookies are accepted. * @event {CustomEvent} pie-cookie-banner-manage-prefs - when a user clicks manage preferences. * @event {CustomEvent} pie-cookie-banner-prefs-saved - when a user clicks save preferences. */ export declare class PieCookieBanner extends PieElement implements CookieBannerProps { private _isCookieBannerHidden; private _isModalOpen; private _locale; hasPrimaryActionsOnly: boolean; defaultPreferences: Partial>; cookieStatementLink: string; personalizedLabel: string; personalizedDescription: string; cookieTechnologiesLink: string; country: string; language: string; openLinksInSameTab: boolean; _preferencesNodes: NodeListOf; /** * Returns the target attribute value for external links based on the openLinksInSameTab prop. * - false (default): returns '_blank' (new tab) * - true: returns '_self' (same tab) */ private get _linkTargetAttribute(); updated(changedProperties: PropertyValues): Promise; private _setLocaleBasedOnCountryAndLanguage; /** * Gets the locale string for the requested language and country. * * @param languageCode - The requested language code (e.g., 'es'). * @param countryCode - The requested country code (e.g., 'ch'). * @returns - The best matching/supported locale string". */ private _getLocaleString; private _customTagEnhancers; private _localiseText; private _localiseRichText; /** * Renders a preference label. * For the personalised preference, uses the consumer-supplied `personalizedLabel` * prop when provided as plain text, and falls back to the built-in locale string otherwise. */ private _renderPreferenceLabel; /** * Renders a preference description. * For the personalised preference, uses the consumer-supplied `personalizedDescription` * prop when provided (allowing consumers to embed their own privacy policy link using * plain HTML `` or `` tags), and falls back to the built-in locale string otherwise. * All other preferences use the plain locale text with HTML sanitisation. */ private _renderPreferenceDescription; /** * Handles closing the modal and re-displaying the cookie banner * and making the cookie banner visible */ private _displayCookieBanner; /** * Handles saving the user cookie preferences, closing the modal and the cookie banner * Creates a state object for the save event, indicating the checked status * of each preference except for the `all` preference. * @example { * functional: false, * necessary: true * } */ private _handlePreferencesSaved; /** * Hides the cookie banner and emits the necessary only event */ private _onNecessaryOnly; /** * Hides the cookie banner and emits the accept all event */ private _onAcceptAll; /** * Opens the manage preferences modal and emits an event letting users know */ private _openManagePreferencesModal; /** * Handles the logic of the switch nodes (preferences). * Clicking the “all” switch should turn on all preferences. * When the “all” switch is checked, and one of the other preferences is clicked, * then the “all” switch should be unchecked. * if all switches are checked, the `all` switch should * be turned on automatically */ private _handleSwitchStates; /** * Renders the content of the preference item. * @private */ private renderPreference; /** * Renders the modal content. * @private */ private renderModalContent; render(): TemplateResult_2<1>; static styles: CSSResult; } export declare interface Preference { id: PreferenceIds; checked?: boolean; disabled?: boolean; hasDivider?: boolean; hasDescription?: boolean; } export declare type PreferenceIds = 'all' | 'necessary' | 'functional' | 'analytical' | 'personalized'; export declare const preferences: Preference[]; export { }