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

View File

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