From 4f4bb727600d88e371b346cd96fcd8df03ebc80d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Fri, 24 Apr 2026 12:44:44 +0400 Subject: [PATCH] Clear GPC badge when user overrides consent via preference panel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the user explicitly changes consent (accept all, reject all, or customize), clear the gpcApplied flag and remove the gpc-label attribute from the settings button so the "Opt-Out Preference Signal Honored" badge no longer displays. Signed-off-by: Émile Ré --- packages/cookie-banner/src/client.ts | 5 +++++ packages/cookie-banner/src/themed-banner/themed-banner.ts | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/packages/cookie-banner/src/client.ts b/packages/cookie-banner/src/client.ts index 6e66ac15a..85d253cf2 100644 --- a/packages/cookie-banner/src/client.ts +++ b/packages/cookie-banner/src/client.ts @@ -154,6 +154,7 @@ export class CookieBannerClient { } if (!this.consent && this.gpcDetected) { + console.log("GPC") this.gpc(); this._gpcApplied = true; } @@ -233,6 +234,10 @@ export class CookieBannerClient { action: ConsentAction, consentData: Record, ): void { + if (action !== "GPC") { + this._gpcApplied = false; + } + const cfg = this.config; this.consent = { diff --git a/packages/cookie-banner/src/themed-banner/themed-banner.ts b/packages/cookie-banner/src/themed-banner/themed-banner.ts index 3b626b557..e63aaa8b8 100644 --- a/packages/cookie-banner/src/themed-banner/themed-banner.ts +++ b/packages/cookie-banner/src/themed-banner/themed-banner.ts @@ -141,6 +141,14 @@ export class ProboThemedBanner extends HTMLElement { } }); + root.addEventListener("probo-consent", (e: Event) => { + const { action } = (e as CustomEvent).detail; + if (action !== "GPC") { + const settingsBtn = this.shadow.querySelector("probo-settings-button"); + settingsBtn?.removeAttribute("gpc-label"); + } + }); + this.shadow.querySelector("[data-action=back]")?.addEventListener("click", () => { root.setState(root.client.hasConsent ? "hidden" : "banner"); });