Fix gpc applied from cookie / api consent

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-04-24 13:05:02 +04:00
parent 4f4bb72760
commit f29a2f05cc
2 changed files with 4 additions and 3 deletions

View File

@@ -119,6 +119,7 @@ export class CookieBannerClient {
consent_data: cookie.data, consent_data: cookie.data,
created_at: "", created_at: "",
}; };
this._gpcApplied = cookie.action === "GPC";
this.activate(cookie.data); this.activate(cookie.data);
void flush(this.bannerId); void flush(this.bannerId);
return; return;
@@ -139,6 +140,7 @@ export class CookieBannerClient {
if (apiConsent && apiConsent.version === config.version) { if (apiConsent && apiConsent.version === config.version) {
this.consent = apiConsent; this.consent = apiConsent;
this._gpcApplied = apiConsent.action === "GPC";
setConsentCookie( setConsentCookie(
{ {
v: apiConsent.version, v: apiConsent.version,
@@ -154,7 +156,6 @@ export class CookieBannerClient {
} }
if (!this.consent && this.gpcDetected) { if (!this.consent && this.gpcDetected) {
console.log("GPC")
this.gpc(); this.gpc();
this._gpcApplied = true; this._gpcApplied = true;
} }

View File

@@ -97,7 +97,7 @@ export class ProboSettingsButton extends HTMLElement {
this.root = this.findRoot(); this.root = this.findRoot();
if (this.root) { if (this.root) {
if (this.root.reopenWidget === "custom") { if (this.root.reopenWidget === "custom" && !this.root.gpcApplied) {
return; return;
} }
@@ -142,7 +142,7 @@ export class ProboSettingsButton extends HTMLElement {
private onReopenWidgetChange = (e: Event): void => { private onReopenWidgetChange = (e: Event): void => {
const { value } = (e as CustomEvent).detail; const { value } = (e as CustomEvent).detail;
if (value === "custom") { if (value === "custom" && !this.root?.gpcApplied) {
this.hidden = true; this.hidden = true;
this.root?.removeEventListener("probo-state", this.onStateChange); this.root?.removeEventListener("probo-state", this.onStateChange);
this.root?.removeEventListener("probo-reopen-widget", this.onReopenWidgetChange); this.root?.removeEventListener("probo-reopen-widget", this.onReopenWidgetChange);