Files
ipal-kit/src/modules/consent/texts.ts
T
Radosław SmolińskiandClaude Opus 5.5 99036eb70c Consent compliance: Global Privacy Control honoured, equal choice by default, withdrawal that stops running tools, consent log on by default
- GPC (gpc.ts): read in the browser before the first paint (consentBannerScript) and in the consent store; pages stay
  static. 'honour' (default): no banner, analytics and marketing off, no request to Google or a pixel; an explicit
  choice on the site wins; a grant made without the signal gives way when it appears. 'ask' and false as opt-outs.
- equalChoice defaults to true; a development warning when the banner has no 'reject'.
- Withdrawal: Meta / TikTok / Clarity told at once, listed localStorage / sessionStorage keys removed.
- Clarity gets consentv2 when it loads; ads_data_redaction with the Consent Mode default.
- consentLog on by default (consentLog: false turns it off); SiteProviders posts to it by itself; a missing SQL table
  answers 503 with one log line.
- Default banner text: one sentence on changing the choice and browser settings; the GPC line (PL / EN).
- Doctor: consent-log-migration, consent-banner rules.
- Stats: Sec-GPC over a choice made without it keeps the visitor id out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-26 13:38:39 +01:00

66 lines
2.4 KiB
TypeScript

import type { ConsentCategory } from './categories.js'
/** Where an entry of the cookie list is kept in the browser. */
export type ConsentStorage = 'cookie' | 'localStorage' | 'sessionStorage'
export type ConsentTexts = {
/** Badge next to the necessary category (e.g. "Always active"). Empty = no badge. */
alwaysActiveLabel?: string
buttons: {
acceptAll: string
back: string
/** Accessible label of the ✕ button closing the settings dialog. */
close: string
reject: string
save: string
settings: string
}
categories: Record<ConsentCategory, { description: string; title: string }>
/**
* Cookie Settings → Cookies in this language — listed per category in the
* detailed settings window (<CookieBanner settings="detailed">). Optional so
* hand-built texts keep compiling; getConsentTexts always fills it.
*/
cookies?: CookieTableRow[]
/** Labels of the cookie list in the detailed settings window. No labels = no list. */
details?: {
/** Expander per category, e.g. "Cookies used" — the count is appended. */
cookies: string
duration: string
provider: string
purpose: string
/** Label of the type line, e.g. "Type" — shown for entries that are not cookies. */
storage?: string
/** Names of the types, e.g. { cookie: 'Cookie', localStorage: 'Local storage', … }. */
storageTypes?: Record<ConsentStorage, string>
}
/** Small label above the banner title (e.g. "Privacy & cookies"). Empty = not shown. */
eyebrow?: string
/**
* Shown when the browser's Global Privacy Control is honoured (settings window; banner in `gpc: 'ask'`).
* getConsentTexts fills it in the page's language; empty = not shown.
*/
gpcNotice?: string
message: string
/** null = no privacy-policy link shown */
privacyLink: { href: string; label: string } | null
/** Intro under the settings title. Empty = not shown. */
settingsDescription?: string
settingsTitle: string
/** Banner heading (e.g. "We respect your privacy"). Empty = not shown. */
title?: string
/** Policy version from the panel — a stored consent from another version asks again. */
version?: number
}
/** One row of Cookie Settings → Cookies, resolved to a single language. */
export type CookieTableRow = {
category: ConsentCategory
duration?: string
name: string
provider?: string
purpose?: string
/** Cookie (default) or a browser-storage key. */
storage?: ConsentStorage
}