@valu/3rdparty
Advanced tools
Comparing version 1.2.3 to 1.2.4-dev.75288c9263
@@ -45,3 +45,5 @@ import type { TrackingConsent } from "./tracking-consent"; | ||
*/ | ||
cbid: string): void; | ||
cbid: string, options?: { | ||
blockingMode?: "manual" | "auto"; | ||
}): void; | ||
export {}; |
@@ -9,3 +9,3 @@ "use strict"; | ||
*/ | ||
cbid) { | ||
cbid, options) { | ||
if (typeof window === "undefined") { | ||
@@ -24,3 +24,7 @@ return; | ||
mutate: function (el) { | ||
el.dataset.blockingmode = "manual"; | ||
var _a; | ||
if ((options === null || options === void 0 ? void 0 : options.blockingMode) === "auto") { | ||
el.async = false; | ||
} | ||
el.dataset.blockingmode = (_a = options === null || options === void 0 ? void 0 : options.blockingMode) !== null && _a !== void 0 ? _a : "manual"; | ||
el.dataset.cbid = cbid; | ||
@@ -45,22 +49,2 @@ el.id = "Cookiebot"; | ||
case "init": { | ||
/** | ||
* Disable all blocking for the cookiebot crawler so it can see | ||
* the trackers | ||
* | ||
* https://support.cookiebot.com/hc/en-us/community/posts/360010100774-UserAgent-Need-to-know-its-CookieBot-to-avoid-Blocking-unknown-Scanner | ||
* | ||
* 'Yes. Since the last update, you could now identify | ||
* Cookiebot through the user agent string and it will contain | ||
* "Cookiebot".' | ||
* | ||
* User agent seems to be like this: | ||
* | ||
* Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko; compatible; Cookiebot/1.0; +http://cookiebot.com/) Chrome/86.0.4240.183 Safari/537.36 | ||
* | ||
*/ | ||
if (/cookiebot/i.test(window.navigator.userAgent)) { | ||
console.log("CookieBot bot detected! Consenting automatically", window.navigator.userAgent); | ||
trackingConsent.setStatus("consented"); | ||
CookiebotScript.now(); | ||
} | ||
return; | ||
@@ -67,0 +51,0 @@ } |
@@ -1,1 +0,1 @@ | ||
!function(){var t=function(){};function e(t,e){for(var o=0;o<t.length;o++)e(t[o])}function o(t){e(document.getElementsByTagName("iframe"),t)}function n(e){var o=e.getAttribute("data-blocked");o?(t("Unblocking iframe "+o,e),e.setAttribute("src",o)):t("No data-blocked present, nothing to unblock.",e),e.removeAttribute("data-blocked")}function i(t){return t.hasAttribute("data-blocked")}"undefined"!=typeof window&&window.localStorage.valuIFramesDebug&&(t=function(){var t;(t=console).log.apply(t,["[ValuIFrames]"].concat([].slice.call(arguments)))});var a=function(){function a(t){this.monitoring=!1,this.unblock=n,this.isBlocked=i,this.forEachIframe=o,this.disableKey="valuIFramesDisableBlockAll",this.options=t||{}}var l=a.prototype;return l.createPlaceholder=function(t){return this.options.placeholderSrc?this.options.placeholderSrc:"data:text/plain;base64,PGgxPkJsb2NrZWQ8L2gxPgo="},l.unblockAll=function(){this.stopMonitoring(),o(n)},l.isBlockAllDisabled=function(){return Boolean(window.localStorage[this.disableKey])},l.disableBlockAll=function(){window.localStorage[this.disableKey]="1"},l.enableBlockAll=function(){delete window.localStorage[this.disableKey]},l.blockAll=function(){var e=this;this.isBlockAllDisabled()?t("Ingoring blockAll() because localStorage.valuIFramesDisableBlockAll is set"):(this.startMonitoring(),o(function(t){return e.block(t)}))},l.startMonitoring=function(){var o=this;this.isBlockAllDisabled()?t("Ingoring startMonitoring() because localStorage.valuIFramesDisableBlockAll is set"):this.observer||(this.monitoring=!0,this.observer=new MutationObserver(function(n){o.monitoring&&e(n,function(n){e(n.addedNodes,function(e){e instanceof HTMLIFrameElement&&(t("Found new iframe from mutation observer",e.src||e),o.block(e))})})}),this.observer.observe(document.documentElement,{childList:!0,subtree:!0}))},l.stopMonitoring=function(){this.monitoring=!1},l.block=function(e){var o=e.getAttribute("data-blocked");if(o)t("Already blocked",o,e);else{var n=e.src;if(n){t("Blocking "+n,e);try{var a,l;"function"==typeof(null==(a=e.contentWindow)?void 0:a.stop)?e.contentWindow.stop():null==(l=e.contentWindow)||l.document.execCommand("Stop")}catch(t){console.error("[ValuIFrames] Failed to stop iframe for "+n,t,e)}e.addEventListener("load",function(){i(e)&&e.contentWindow&&e.contentWindow.postMessage({valuOriginalSrc:n},"*")}),e.setAttribute("data-blocked",n);var r,s,c=this.createPlaceholder(n);e.src=c,e.setAttribute("src",c),r=function(){e.src+=""},s=String(Math.random()),window.addEventListener("message",function t(e){var o;(null==(o=e.data)?void 0:o.valuSetImmediate)===s&&(window.removeEventListener("message",t),r())}),window.postMessage({valuSetImmediate:s},"*")}else t("No src attribute. Nothing to block",e)}},a}();if("undefined"!=typeof window){var l=document.getElementById("valu-iframes-options"),r={};l&&(r=JSON.parse(l.innerHTML));var s=new a(r);s.blockAll(),window.ValuIFrames=s}}(); | ||
!function(){var e=function(){};function t(e,t){for(var o=0;o<e.length;o++)t(e[o])}function o(e){t(document.getElementsByTagName("iframe"),e)}function n(t){var o=t.getAttribute("data-blocked");o?(e("Unblocking iframe "+o,t),t.setAttribute("src",o)):e("No data-blocked present, nothing to unblock.",t),t.removeAttribute("data-blocked")}function i(e){return e.hasAttribute("data-blocked")}"undefined"!=typeof window&&window.localStorage.valuIFramesDebug&&(e=function(){var e;(e=console).log.apply(e,["[ValuIFrames]"].concat([].slice.call(arguments)))});var l=function(){function l(e){this.monitoring=!1,this.unblock=n,this.isBlocked=i,this.forEachIframe=o,this.disableKey="valuIFramesDisableBlockAll",this.options=e||{}}var a=l.prototype;return a.createPlaceholder=function(e){return this.options.placeholderSrc?this.options.placeholderSrc:"data:text/plain;base64,PGgxPkJsb2NrZWQ8L2gxPgo="},a.unblockAll=function(){this.stopMonitoring(),o(n)},a.isBlockAllDisabled=function(){return Boolean(window.localStorage[this.disableKey])},a.disableBlockAll=function(){window.localStorage[this.disableKey]="1"},a.enableBlockAll=function(){delete window.localStorage[this.disableKey]},a.blockAll=function(){var t=this;this.isBlockAllDisabled()?e("Ingoring blockAll() because localStorage.valuIFramesDisableBlockAll is set"):(this.startMonitoring(),o(function(e){return t.block(e)}))},a.startMonitoring=function(){var o=this;this.isBlockAllDisabled()?e("Ingoring startMonitoring() because localStorage.valuIFramesDisableBlockAll is set"):this.observer||(this.monitoring=!0,this.observer=new MutationObserver(function(n){o.monitoring&&t(n,function(n){t(n.addedNodes,function(n){n instanceof HTMLIFrameElement?(e("Found new iframe from mutation observer",n.src||n),o.block(n)):n instanceof HTMLElement&&t(n.querySelectorAll("iframe"),function(t){e("Found new nested iframe from mutation observer",t.src||t),o.block(t)})})})}),this.observer.observe(document.documentElement,{childList:!0,subtree:!0}))},a.stopMonitoring=function(){this.monitoring=!1},a.block=function(t){var o=t.getAttribute("data-blocked");if(o)e("Already blocked",o,t);else{var n=t.src;if(n){e("Blocking "+n,t);try{var l,a;"function"==typeof(null==(l=t.contentWindow)?void 0:l.stop)?t.contentWindow.stop():null==(a=t.contentWindow)||a.document.execCommand("Stop")}catch(e){console.error("[ValuIFrames] Failed to stop iframe for "+n,e,t)}t.addEventListener("load",function(){i(t)&&t.contentWindow&&t.contentWindow.postMessage({valuOriginalSrc:n},"*")}),t.setAttribute("data-blocked",n);var r,s,c=this.createPlaceholder(n);t.src=c,t.setAttribute("src",c),r=function(){t.src+=""},s=String(Math.random()),window.addEventListener("message",function e(t){var o;(null==(o=t.data)?void 0:o.valuSetImmediate)===s&&(window.removeEventListener("message",e),r())}),window.postMessage({valuSetImmediate:s},"*")}else e("No src attribute. Nothing to block",t)}},l}();if("undefined"!=typeof window){var a=document.getElementById("valu-iframes-options"),r={};a&&(r=JSON.parse(a.innerHTML));var s=new l(r);s.blockAll(),window.ValuIFrames=s}}(); |
@@ -129,2 +129,8 @@ "use strict"; | ||
} | ||
else if (node instanceof HTMLElement) { | ||
forEach(node.querySelectorAll("iframe"), function (iframe) { | ||
debug("Found new nested iframe from mutation observer", iframe.src || iframe); | ||
_this.block(iframe); | ||
}); | ||
} | ||
}); | ||
@@ -131,0 +137,0 @@ }); |
@@ -45,3 +45,5 @@ import type { TrackingConsent } from "./tracking-consent"; | ||
*/ | ||
cbid: string): void; | ||
cbid: string, options?: { | ||
blockingMode?: "manual" | "auto"; | ||
}): void; | ||
export {}; |
108
package.json
{ | ||
"name": "@valu/3rdparty", | ||
"version": "1.2.3", | ||
"description": "Tools for managing 3rd party scripts and tracking consents (aka. cookie prompts) optionally via Google Tag Manager and/or Cookiebot.", | ||
"main": "dist/lazy-script.js", | ||
"homepage": "https://github.com/valu-digital/3rdparty", | ||
"repository": { | ||
"url": "https://github.com/valu-digital/3rdparty" | ||
}, | ||
"scripts": { | ||
"build": "jake build", | ||
"build-pack": "jake build-pack", | ||
"prepublishOnly": "npm test && npm run build", | ||
"test": "jest" | ||
}, | ||
"files": [ | ||
"cookiebot.d.ts", | ||
"cookiebot.js", | ||
"iframes-global.d.ts", | ||
"iframes-global.js", | ||
"iframes-head.d.ts", | ||
"iframes-head.js", | ||
"iframes.d.ts", | ||
"iframes.js", | ||
"lazy-script.d.ts", | ||
"lazy-script.js", | ||
"react-lazy-script.d.ts", | ||
"react-lazy-script.js", | ||
"react-ssr.d.ts", | ||
"react-ssr.js", | ||
"tracking-consent.d.ts", | ||
"tracking-consent.js", | ||
"react-tracking-consent.d.ts", | ||
"react-tracking-consent.js", | ||
"dist" | ||
], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@testing-library/dom": "^7.29.0", | ||
"@types/jest": "^26.0.19", | ||
"@types/node": "^14.14.13", | ||
"@types/react": "^17.0.0", | ||
"@types/react-dom": "^17.0.0", | ||
"jake": "^10.8.2", | ||
"jest": "^26.6.3", | ||
"microbundle": "^0.12.4", | ||
"prettier": "^2.2.1", | ||
"react": "^17.0.1", | ||
"react-dom": "^17.0.1", | ||
"sh-thunk": "^0.3.2", | ||
"ts-jest": "^26.4.4", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.2.3" | ||
} | ||
"name": "@valu/3rdparty", | ||
"version": "1.2.4-dev.75288c9263", | ||
"description": "Tools for managing 3rd party scripts and tracking consents (aka. cookie prompts) optionally via Google Tag Manager and/or Cookiebot.", | ||
"main": "dist/lazy-script.js", | ||
"homepage": "https://github.com/valu-digital/3rdparty", | ||
"repository": { | ||
"url": "https://github.com/valu-digital/3rdparty" | ||
}, | ||
"scripts": { | ||
"build": "jake build", | ||
"build-pack": "jake build-pack", | ||
"prepublishOnly": "npm test && npm run build", | ||
"test": "jest" | ||
}, | ||
"files": [ | ||
"cookiebot.d.ts", | ||
"cookiebot.js", | ||
"iframes-global.d.ts", | ||
"iframes-global.js", | ||
"iframes-head.d.ts", | ||
"iframes-head.js", | ||
"iframes.d.ts", | ||
"iframes.js", | ||
"lazy-script.d.ts", | ||
"lazy-script.js", | ||
"react-lazy-script.d.ts", | ||
"react-lazy-script.js", | ||
"react-ssr.d.ts", | ||
"react-ssr.js", | ||
"tracking-consent.d.ts", | ||
"tracking-consent.js", | ||
"react-tracking-consent.d.ts", | ||
"react-tracking-consent.js", | ||
"dist" | ||
], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@testing-library/dom": "^7.29.0", | ||
"@types/jest": "^26.0.19", | ||
"@types/node": "^14.14.13", | ||
"@types/react": "^17.0.0", | ||
"@types/react-dom": "^17.0.0", | ||
"jake": "^10.8.2", | ||
"jest": "^26.6.3", | ||
"microbundle": "^0.12.4", | ||
"prettier": "^2.2.1", | ||
"react": "^17.0.1", | ||
"react-dom": "^17.0.1", | ||
"sh-thunk": "^0.3.2", | ||
"ts-jest": "^26.4.4", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.2.3" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
59
62394
1138
2