From e16ab1f6f661f9fbb94467a3d897c27613b27918 Mon Sep 17 00:00:00 2001 From: Eugene Fox Date: Mon, 1 Sep 2025 19:16:55 +0000 Subject: [PATCH] feat!: remove Clarity implicit consent option (EU compliance) --- .env.development | 1 - app/_components/CookieBanner.module.scss | 24 ++++++++--------------- app/_components/CookieBanner.tsx | 25 ++++++------------------ app/_utils/analytics/client.ts | 8 +------- app/_utils/analytics/server.ts | 10 ---------- app/attribution/page.tsx | 18 ++++++++--------- app/layout.tsx | 4 ++-- 7 files changed, 25 insertions(+), 65 deletions(-) diff --git a/.env.development b/.env.development index cbc28d5..466ca79 100644 --- a/.env.development +++ b/.env.development @@ -15,7 +15,6 @@ ATS_RESUME_URL=URL # Location of the ATS-compatible resume PDF (optional, remo RESUME_HAS_REFS=false # Appends last page of the resume to a result PDF file (only appies to non-ATS version) ALERT_TEXT_URL=URL # URL of a txt file with urgent message to be displayed (see app/_components/AlertMessage.tsx) CLARITY_ID=string # Clarity Analytics ID (optional, remove to disable) -CLARITY_CONSENT=1 # 1 if you need to request explicit consent from user, 0 if not (requires CLARITY_ID) CF_SITEKEY=3x00000000000000000000FF # Cloudflare Turnstile captcha sitekey for contact form (optional, remove to siable) CF_SECRET=1x0000000000000000000000000000000AA # Secret for token validation (requries CF_SITEKEY) diff --git a/app/_components/CookieBanner.module.scss b/app/_components/CookieBanner.module.scss index 5bbc0ea..9a5c1f4 100644 --- a/app/_components/CookieBanner.module.scss +++ b/app/_components/CookieBanner.module.scss @@ -41,11 +41,6 @@ } } - .dismiss - { - border-left: none; - } - .controls { display: grid; @@ -65,19 +60,16 @@ width: 100%; bottom: 0; - &:not(:has(> .dismiss)) + flex-flow: column; + + .learnMore { - flex-flow: column; + border-bottom: none; + } - .learnMore - { - border-bottom: none; - } - - .controls > button:last-child - { - border-left: none; - } + .controls > button:last-child + { + border-left: none; } } } diff --git a/app/_components/CookieBanner.tsx b/app/_components/CookieBanner.tsx index 10a7582..7922024 100644 --- a/app/_components/CookieBanner.tsx +++ b/app/_components/CookieBanner.tsx @@ -1,12 +1,11 @@ "use client"; -import { acceptCookies, dismissCookies, getCookieChoice, rejectCookies } from "@/_utils/analytics/client"; -import { Dismiss24Regular } from "@fluentui/react-icons"; +import { acceptCookies, getCookieChoice, rejectCookies } from "@/_utils/analytics/client"; import React, { useCallback, useEffect, useState } from "react"; import Button from "./Button"; import cls from "./CookieBanner.module.scss"; -const CookieBanner: React.FC<{ askForConsent: boolean; }> = props => +const CookieBanner: React.FC = () => { const [visible, setVisible] = useState(false); @@ -36,12 +35,6 @@ const CookieBanner: React.FC<{ askForConsent: boolean; }> = props => setVisible(false); }, []); - const dismiss = useCallback(() => - { - dismissCookies(); - setVisible(false); - }, []); - if (!visible) return null; @@ -59,16 +52,10 @@ const CookieBanner: React.FC<{ askForConsent: boolean; }> = props =>

- { props.askForConsent ? -
- - -
- : - + + ); diff --git a/app/_utils/analytics/client.ts b/app/_utils/analytics/client.ts index 2491e55..fb2cc53 100644 --- a/app/_utils/analytics/client.ts +++ b/app/_utils/analytics/client.ts @@ -12,18 +12,12 @@ export const rejectCookies = (): void => window.clarity?.("consent", false); }; -export const dismissCookies = (): void => -{ - setCookie("CC", "", 1209600); // 14 days -}; - -export const getCookieChoice = (): "accepted" | "rejected" | "acknowledged" | "none" => +export const getCookieChoice = (): "accepted" | "rejected" | "none" => { switch (getCookie("CC")) { case "1": return "accepted"; case "0": return "rejected"; - case "": return "acknowledged"; default: return "none"; } }; diff --git a/app/_utils/analytics/server.ts b/app/_utils/analytics/server.ts index ec79db2..f7d548b 100644 --- a/app/_utils/analytics/server.ts +++ b/app/_utils/analytics/server.ts @@ -9,13 +9,3 @@ export const analyticsEnabled = (): boolean => unstable_noStore(); return !!process.env.CLARITY_ID; }; - -/** - * Check if Clarity requires explicit consent - * @returns true if Clarity requires explicit consent - */ -export const requireExplicitConsent = (): boolean => -{ - unstable_noStore(); - return process.env.CLARITY_CONSENT === "1"; -}; diff --git a/app/attribution/page.tsx b/app/attribution/page.tsx index bdc71c0..c26814c 100644 --- a/app/attribution/page.tsx +++ b/app/attribution/page.tsx @@ -3,7 +3,7 @@ import Button from "@/_components/Button"; import RevokeConsentButton from "@/_components/RevokeConsentButton"; import { canonicalName, getTitle } from "@/_data/metadata"; import ThirdPartyAttribution from "@/_data/ThirdPartyAttributiont"; -import { analyticsEnabled, requireExplicitConsent } from "@/_utils/analytics/server"; +import { analyticsEnabled } from "@/_utils/analytics/server"; import { ArrowLeft24Regular, ArrowRight24Regular } from "@fluentui/react-icons"; import { Metadata } from "next"; import { unstable_noStore } from "next/cache"; @@ -45,17 +45,15 @@ const AttributionPage: React.FC = () => ( If the "Do Not Track" option is enabled in your browser, the website will not execute any tracking code.

- { requireExplicitConsent() && -

- If you previously gave your consent to use cookies, - you can revoke it by clicking "Revoke my consent" button on this page below - (the button is available only if the consent was given). - Recorded data will be deleted after 30-day retention period. -

- } +

+ If you previously gave your consent to use cookies, + you can revoke it by clicking "Revoke my consent" button on this page below + (the button is available only if the consent was given). + Recorded data will be deleted after 30-day retention period. +

- { requireExplicitConsent() && } +