'use client' /** * CookieDeclarationDiff — „Deklaration vs. Bibliothek". * * Zeigt pro Cookie der GEPRÜFTEN Teilmenge (Library-Treffer) die Feld- * Abweichungen deklariert → Library, plus einen ehrlichen Funnel * (gesamt → geprüft → abweichend). Quelle: cookie-check `declaration_diff`. */ import React from 'react' interface Diff { field: string declared: string expected: string severe?: boolean } interface DiffRow { cookie: string vendor: string severity: string diffs: Diff[] measures: string[] } export interface DeclarationDiffData { coverage: { total: number; checked: number; discrepant: number } rows: DiffRow[] } const SEV_BADGE: Record = { HIGH: 'bg-red-100 text-red-700', MEDIUM: 'bg-amber-100 text-amber-700', LOW: 'bg-gray-100 text-gray-600', } function Funnel({ c }: { c: DeclarationDiffData['coverage'] }) { const pct = c.total > 0 ? Math.round((c.checked / c.total) * 100) : 0 return (
{c.total} Cookies ·{' '} {c.checked} gegen Bibliothek geprüft ({pct}%) · davon{' '} 0 ? 'text-red-700' : 'text-green-700'}`}> {c.discrepant} {' '} mit abweichender Deklaration
Nicht in der Bibliothek enthaltene Cookies sind nicht prüfbar (kein Pass, kein Fail).
) } export function CookieDeclarationDiff({ data }: { data?: DeclarationDiffData }) { if (!data || !data.coverage) return null const { coverage, rows } = data return (

Deklaration vs. Bibliothek

{rows.length === 0 ? (

Keine abweichenden Deklarationen in der geprüften Teilmenge.

) : (
{rows.map((r, i) => (
{r.cookie} {r.vendor && · {r.vendor}} {r.diffs.length} {r.diffs.length === 1 ? 'Abweichung' : 'Abweichungen'}
{r.diffs.map((d, j) => (
{d.field} {d.declared} {d.expected}
))} {r.measures.length > 0 && (
Maßnahme: {r.measures.join(' ')}
)}
))}
)}
) }