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"); });