Consent compliance: docs, agent guide, skills, changelog, shared behaviour spec, browser check, reference e2e

- docs/consent.md: compliance defaults, Global Privacy Control, withdrawal, consent log on by default and the SQL
  migration; no more "UODO requirement" or "GPC not needed". docs/analytics.md: what Consent Mode advanced sends.
- docs/consent-behaviour-spec.md: the behaviour IAPL and IAWL share, with the 13-item test list.
- CHANGELOG 1.17.0: the SQL migration first, a before → after table for an existing site.
- AGENT.md, iapl-setup / iapl-upgrade / iapl-reference / iapl-consent-check, PROGRAMISTA item 78; reference skills copy.
- iapl-consent-check: Global Privacy Control, equal prominence and withdrawal runs; Google asset warnings.
- Reference site uses the new defaults; e2e for GPC, a stale grant, equal prominence, withdrawal; e2e:built runs every
  consent test in both bundlers. YouTubeEmbed warns in development without a poster.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-26 13:48:19 +01:00
co-authored by Claude Opus 5.5
parent 99036eb70c
commit f5c53e4523
33 changed files with 821 additions and 112 deletions
+6 -3
View File
@@ -60,13 +60,16 @@ function listedPerCategory(rows: ConsentTexts['cookies']): { cookies: ConsentCoo
}
export function ConsentProvider({ children, cookieMap, cookieValue, gpc, logEndpoint, maxAgeDays, nonce, texts }: ConsentProviderProps) {
// Keyed by content: the texts and the map are often new objects on every render.
const listKey = JSON.stringify(texts.cookies ?? null)
const listed = useMemo(() => listedPerCategory(texts.cookies), [listKey])
const listed = useMemo(() => listedPerCategory(JSON.parse(listKey) as ConsentTexts['cookies']), [listKey])
const cookieMapKey = JSON.stringify(cookieMap ?? null)
const mergedCookies = useMemo(() => {
const out: ConsentCookieMap = { ...listed.cookies }
for (const [cat, names] of Object.entries(cookieMap ?? {}) as [ConsentCategory, string[]][]) {out[cat] = [...(out[cat] ?? []), ...names]}
const extra = (JSON.parse(cookieMapKey) ?? {}) as ConsentCookieMap
for (const [cat, names] of Object.entries(extra) as [ConsentCategory, string[]][]) {out[cat] = [...(out[cat] ?? []), ...names]}
return out
}, [listed, JSON.stringify(cookieMap ?? null)])
}, [listed, cookieMapKey])
const consent = useConsent({
cookieMap: mergedCookies,
cookieValue,
+1 -1
View File
@@ -1,6 +1,7 @@
'use client'
export { ConsentProvider, useConsentContext } from './ConsentContext.js'
export { ConsentScript } from './ConsentScript.js'
export { readEffectiveConsent } from './consentStore.js'
export { CookieBanner } from './CookieBanner.js'
export type { CookieBannerAction, CookieBannerClassNames, CookieSettingsAction } from './CookieBanner.js'
export { bottomOverlap, COOKIE_BUTTON_AVOID, CookieButton } from './CookieButton.js'
@@ -8,5 +9,4 @@ export type { CookieButtonProps } from './CookieButton.js'
// Client-only consent exports — hook, provider, and UI components.
export { DEFAULT_COOKIE_MAP, useConsent } from './useConsent.js'
export type { ConsentCookieMap } from './useConsent.js'
export { readEffectiveConsent } from './consentStore.js'
export { clarityConsent, signalVendors } from './vendorConsent.js'
+1 -2
View File
@@ -173,7 +173,7 @@ export function useConsent(options: ConsentCookieMap | UseConsentOptions = {}) {
// look like it worked while nothing changed.
updateConsent(next)
try {
onDecision?.({ gpc, id, state: next, version })
onDecision?.({ id, gpc, state: next, version })
} catch {
// a logging hook must never break the banner
}
@@ -199,7 +199,6 @@ export function useConsent(options: ConsentCookieMap | UseConsentOptions = {}) {
rewritten.current = staleKey
write(record.state, resolved.state, record.id ?? newConsentId(), true)
// runs for a stale record only; `write` reads everything else it needs
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [staleKey])
const acceptAll = useCallback(() => persist(ACCEPT_ALL_CONSENT), [persist])