"use client"; import { Trans } from "@lingui/react/macro"; import { Button } from "@superset/ui/button"; import { AnimatePresence, m } from "framer-motion"; import Link from "next/link"; import { useEffect, useState } from "react"; import { declineAnalytics } from "@/lib/analytics/decline"; import { withPosthog } from "@/lib/analytics/lazy"; import { ANALYTICS_CONSENT_KEY } from "@/lib/constants"; export function CookieConsent() { const [showBanner, setShowBanner] = useState(false); useEffect(() => { const consent = localStorage.getItem(ANALYTICS_CONSENT_KEY); if (consent === null) { setShowBanner(true); } }, []); const handleAccept = () => { localStorage.setItem(ANALYTICS_CONSENT_KEY, "accepted"); setShowBanner(false); withPosthog((posthog) => posthog.opt_in_capturing()); }; const handleOptOut = () => { localStorage.setItem(ANALYTICS_CONSENT_KEY, "declined"); withPosthog(declineAnalytics); setShowBanner(false); }; return ( {showBanner && (

We only collect analytics cookies so we can improve your experience. {" "} Privacy policy

)}
); }