Fix gpc applied from cookie / api consent
Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user