@valu/3rdparty
Advanced tools
Comparing version 1.3.0 to 1.3.1
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.connectCookieBot = void 0; | ||
var debug_1 = require("./debug"); | ||
var lazy_script_1 = require("./lazy-script"); | ||
@@ -30,2 +31,3 @@ function connectCookieBot(trackingConsent, | ||
} | ||
debug_1.debug("Cookiebot loaded"); | ||
return window.Cookiebot; | ||
@@ -43,5 +45,7 @@ }, | ||
window.addEventListener("CookiebotOnAccept", function () { | ||
debug_1.debug("Cookiebot sent CookiebotOnAccept. Consenting..."); | ||
trackingConsent.consent(); | ||
}, false); | ||
window.addEventListener("CookiebotOnDecline", function () { | ||
debug_1.debug("Cookiebot sent CookiebotOnDecline. Declining..."); | ||
trackingConsent.decline(); | ||
@@ -55,6 +59,4 @@ }, false); | ||
case "forget": { | ||
CookiebotScript.now(); | ||
return CookiebotScript.promise().then(function (cb) { | ||
cb.renew(); | ||
}); | ||
document.cookie = "CookieConsent=; Max-Age=-99999999;"; | ||
return; | ||
} | ||
@@ -61,0 +63,0 @@ case "request-prompt": { |
"use strict"; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TrackingConsent = void 0; | ||
var debug_1 = require("./debug"); | ||
var STATUSES = ["not-given", "declined", "consented"]; | ||
var debug = function () { | ||
var _args = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
_args[_i] = arguments[_i]; | ||
} | ||
}; | ||
if (typeof window !== "undefined" && | ||
window.localStorage.valuTrackingConsentDebug) { | ||
debug = function () { | ||
var args = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
args[_i] = arguments[_i]; | ||
} | ||
console.log.apply(console, __spreadArray(["[ValuTrackingConsent]"], args)); | ||
}; | ||
} | ||
var TrackingConsent = /** @class */ (function () { | ||
@@ -94,3 +74,3 @@ function TrackingConsent(options) { | ||
} | ||
debug("Got tracking consent"); | ||
debug_1.debug("Got tracking consent"); | ||
this.setStatus("consented"); | ||
@@ -104,3 +84,3 @@ this.emit("consented"); | ||
} | ||
debug("Declined consent"); | ||
debug_1.debug("Declined consent"); | ||
this.response = { | ||
@@ -116,3 +96,3 @@ status: "declined", | ||
var _this = this; | ||
debug("Forget consent"); | ||
debug_1.debug("Forget consent"); | ||
this.response = { | ||
@@ -128,3 +108,3 @@ status: "not-given", | ||
TrackingConsent.prototype.emit = function (event) { | ||
debug("Event: " + event); | ||
debug_1.debug("Event: " + event); | ||
void this.emitPromise(event); | ||
@@ -171,2 +151,6 @@ }; | ||
} | ||
if (this.response.status === "not-given") { | ||
window.localStorage.removeItem(this.storeKey); | ||
return; | ||
} | ||
window.localStorage.setItem(this.storeKey, JSON.stringify(this.response)); | ||
@@ -173,0 +157,0 @@ }; |
{ | ||
"name": "@valu/3rdparty", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "Tools for managing 3rd party scripts and tracking consents (aka. cookie prompts) optionally via Google Tag Manager and/or Cookiebot.", | ||
@@ -5,0 +5,0 @@ "main": "dist/lazy-script.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
64548
62
1181