From e763aacc66b60ef0592fb2a2809fc35e86afcd1a Mon Sep 17 00:00:00 2001 From: Kevin Jennison Date: Tue, 12 Oct 2021 20:38:00 -0500 Subject: [PATCH 1/2] Upgrade CMP --- package.json | 4 ++-- quantcast/qcChoiceOriginal.js | 33 +++++++++++++-------------------- quantcast/qcCmpOriginal.js | 2 +- src/initCMP.js | 11 +++++------ src/qcChoiceModified.js | 23 +++++++++-------------- src/qcCmpModified.js | 2 +- 6 files changed, 31 insertions(+), 44 deletions(-) diff --git a/package.json b/package.json index 01f6770..715f119 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,11 @@ "test:coverage": "yarn run test:run --coverage", "test:watch": "yarn run test:run --watch", "quantcast:update": "npm-run-all -s quantcast:update:info quantcast:choice-js:update quantcast:cmp-js:download", - "quantcast:update:info": "echo \"########## Downloading the original source JS for Quantcast Choice version 22. To use a different version, first update change the version number in the QC portal for the tab.gladly.dev domain, then modify the version number in the cmp2.js URL in the package.json script.##########\"", + "quantcast:update:info": "echo \"########## Downloading the original source JS for Quantcast Choice version 35. To use a different version, first update change the version number in the QC portal for the tab.gladly.dev domain, then modify the version number in the cmp2.js URL in the package.json script.##########\"", "quantcast:choice-js:update": "npm-run-all -s quantcast:choice-js:download quantcast:choice-js:format", "quantcast:choice-js:download": "curl https://quantcast.mgr.consensu.org/choice/FPBLJYpJgR9Zu/tab.gladly.dev/choice.js > ./quantcast/qcChoiceOriginal.js", "quantcast:choice-js:format": "eslint ./quantcast/qcChoiceOriginal.js --fix --no-ignore; exit 0", - "quantcast:cmp-js:download": "curl https://quantcast.mgr.consensu.org/tcfv2/22/cmp2.js > ./quantcast/qcCmpOriginal.js", + "quantcast:cmp-js:download": "curl https://quantcast.mgr.consensu.org/tcfv2/35/cmp2.js > ./quantcast/qcCmpOriginal.js", "quantcast:cmp-js:copy-with-edits": "sed -E 's/SameSite=Lax;secure/SameSite=None;secure/g; s/_isUserInUS=(true|false)/_isUserInUS=window.tabCMP.doesCCPAApply/g; s/_isUserInEU=(true|false)/_isUserInEU=window.tabCMP.doesGDPRApply/g;' ./quantcast/qcCmpOriginal.js > ./src/qcCmpModified.js", "dev:publish": "npm-run-all -s build dev:yalc-publish-push", "dev:yalc-publish-push": "yalc publish --push" diff --git a/quantcast/qcChoiceOriginal.js b/quantcast/qcChoiceOriginal.js index 00a34cd..28243c0 100644 --- a/quantcast/qcChoiceOriginal.js +++ b/quantcast/qcChoiceOriginal.js @@ -1,10 +1,16 @@ ;(function () { + const cmpFile = + 'noModule' in HTMLScriptElement.prototype ? 'cmp2.js' : 'cmp2-polyfilled.js' ;(function () { const cmpScriptElement = document.createElement('script') const firstScript = document.getElementsByTagName('script')[0] cmpScriptElement.async = true cmpScriptElement.type = 'text/javascript' - const cmpVersion = 'https://quantcast.mgr.consensu.org/tcfv2/22/cmp2.js' + const cmpVersion = + 'https://quantcast.mgr.consensu.org/tcfv2/35/CMP_FILE?referer=tab.gladly.dev'.replace( + 'CMP_FILE', + cmpFile + ) cmpScriptElement.src = cmpVersion window._qevents = window._qevents || [] ;(function () { @@ -21,18 +27,6 @@ })() const qcaccount = 'p-' + 'FPBLJYpJgR9Zu' window._qevents.push({ qacct: qcaccount, source: 'choice' }) - const cmpNoScriptElement = document.createElement('noscript') - const div = document.createElement('div') - div.style.display = 'none;' - const img = document.createElement('img') - img.src = '//pixel.quantserve.com/pixel/p-' + 'FPBLJYpJgR9Zu' + '.gif' - img.border = '0' - img.height = '1' - img.width = '1' - img.alt = 'Quantcast' - div.appendChild(img) - cmpNoScriptElement.appendChild(div) - firstScript.parentNode.insertBefore(cmpNoScriptElement, firstScript) firstScript.parentNode.insertBefore(cmpScriptElement, firstScript) })() ;(function () { @@ -120,23 +114,22 @@ autoDetectedLanguage = splitLang(navigator.language) } const choiceMilliSeconds = new Date().getTime() - window.__tcfapi('init', 2, function () {}, { - premiumProperties: {}, + window.__tcfapi('init', 2, () => {}, { + premiumProperties: { googleWhitelist: [1] }, coreUiLabels: {}, premiumUiLabels: { uspDnsText: [ - '

This preference sets whether advertisers can personalize ads to you. Personalized ads can be more interesting and often raise more money for charity. We never sell personal information like email addresses, nor do we collect your browsing history on other sites.


We and our partners use technologies to process personal information, including IP addresses and pseudonymous identifiers associated with cookies. This information is processed to personalize ads based on your interests, run and optimize marketing campaigns, measure the performance of ads and content, and derive insights about the audiences who engage with ads and content. This data is an integral part of how we raise money for non-profit partners, make revenue to support our staff, and generate relevant content for our audience. You can learn more about our data collection and use practices in our Privacy Policy.


If you wish to request that your personal information is not shared with third parties, please click on the below checkbox and confirm your selection. Please note that after your opt out request is processed, we may still collect your information in order to operate our site.

', + '

This preference sets whether advertisers can personalize ads to you. Personalized ads can be more interesting and often raise more money for charity. We never sell personal information like email addresses, nor do we collect your browsing history on other sites.

\n

We and our partners use technologies to process personal information, including IP addresses and pseudonymous identifiers associated with cookies. This information is processed to personalize ads based on your interests, run and optimize marketing campaigns, measure the performance of ads and content, and derive insights about the audiences who engage with ads and content. This data is an integral part of how we raise money for non-profit partners, make revenue to support our staff, and generate relevant content for our audience. You can learn more about our data collection and use practices in our Privacy Policy.

\n

If you wish to request that your personal information is not shared with third parties, please click on the below checkbox and confirm your selection. Please note that after your opt out request is processed, we may still collect your information in order to operate our site.

', ], }, theme: { uxPrimaryButtonColor: '#9d4ba3' }, coreConfig: { consentScope: 'service', thirdPartyStorageType: 'iframe', - consentIdentityEnabled: false, - initScreenBodyTextOption: 1, consentOnSafari: false, lang_: 'en', displayUi: 'inEU', + initScreenBodyTextOption: 1, defaultToggleValue: 'off', initScreenRejectButtonShowing: false, publisherConsentRestrictionIds: [], @@ -148,7 +141,7 @@ uiLayout: 'popup', publisherLogo: 'https://tab.gladly.io/static/logo-with-text-257bbffc6dcac5076e8ac31eed8ff73c.svg', - publisherPurposeIds: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], + publisherPurposeIds: [1, 3, 4, 5, 6, 9], publisherPurposeLegitimateInterestIds: [2, 7, 8, 10], publisherSpecialPurposesIds: [1, 2], publisherFeaturesIds: [], @@ -157,7 +150,7 @@ vendorListUpdateFreq: 90, quantcastAccountId: 'FPBLJYpJgR9Zu', privacyMode: ['GDPR', 'USP'], - hashCode: 'viIA/yKcUUmwj5xfSRz5eQ', + hashCode: 'Qx0fyhosVVgZMRwlCoEJjQ', publisherCountryCode: 'US', publisherName: 'LOCAL - Tab for a Cause', vendorPurposeIds: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], diff --git a/quantcast/qcCmpOriginal.js b/quantcast/qcCmpOriginal.js index 58f0378..99ffdd3 100644 --- a/quantcast/qcCmpOriginal.js +++ b/quantcast/qcCmpOriginal.js @@ -1 +1 @@ -!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=150)}([function(e,t,n){e.exports=n(258)},function(e,t,n){var r=n(6),o=n(35).f,i=n(22),s=n(23),a=n(58),u=n(83),c=n(65);e.exports=function(e,t){var n,f,l,p,d,h=e.target,v=e.global,y=e.stat;if(n=v?r:y?r[h]||a(h,{}):(r[h]||{}).prototype)for(f in t){if(p=t[f],l=e.noTargetGet?(d=o(n,f))&&d.value:n[f],!c(v?f:h+(y?".":"#")+f,e.forced)&&void 0!==l){if(typeof p===typeof l)continue;u(p,l)}(e.sham||l&&l.sham)&&i(p,"sham",!0),s(n,f,p,e)}}},function(e,t,n){var r=n(12);e.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},function(e,t){e.exports=!1},function(e,t,n){var r=n(2),o=n(95),i=n(24),s=n(8),a=n(69),u=n(94),c=function(e,t){this.stopped=e,this.result=t};e.exports=function(e,t,n){var f,l,p,d,h,v,y,g=n&&n.that,m=!(!n||!n.AS_ENTRIES),b=!(!n||!n.IS_ITERATOR),E=!(!n||!n.INTERRUPTED),C=s(t,g,1+m+E),_=function(e){return f&&u(f),new c(!0,e)},S=function(e){return m?(r(e),E?C(e[0],e[1],_):C(e[0],e[1])):E?C(e,_):C(e)};if(b)f=e;else{if("function"!=typeof(l=a(e)))throw TypeError("Target is not iterable");if(o(l)){for(p=0,d=i(e.length);d>p;p++)if((h=S(e[p]))&&h instanceof c)return h;return new c(!1)}f=l.call(e)}for(v=f.next;!(y=v.call(f)).done;){try{h=S(y.value)}catch(w){throw u(f),w}if("object"==typeof h&&h&&h instanceof c)return h}return new c(!1)}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(String(e)+" is not a function");return e}},function(e,t,n){(function(t){var n=function(e){return e&&e.Math==Math&&e};e.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof t&&t)||function(){return this}()||Function("return this")()}).call(this,n(153))},function(e,t,n){var r=n(6),o=n(61),i=n(13),s=n(46),a=n(66),u=n(87),c=o("wks"),f=r.Symbol,l=u?f:f&&f.withoutSetter||s;e.exports=function(e){return i(c,e)||(a&&i(f,e)?c[e]=f[e]:c[e]=l("Symbol."+e)),c[e]}},function(e,t,n){var r=n(5);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 0:return function(){return e.call(t)};case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t,n){var r=n(84),o=n(6),i=function(e){return"function"==typeof e?e:void 0};e.exports=function(e,t){return arguments.length<2?i(r[e])||i(o[e]):r[e]&&r[e][t]||o[e]&&o[e][t]}},function(e,t,n){var r=n(84),o=n(13),i=n(89),s=n(18).f;e.exports=function(e){var t=r.Symbol||(r.Symbol={});o(t,e)||s(t,e,{value:i.f(e)})}},function(e,t){e.exports=function(e){try{return!!e()}catch(t){return!0}}},function(e,t){e.exports=function(e){return"object"===typeof e?null!==e:"function"===typeof e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(270)),r(n(271)),r(n(272)),r(n(273))},function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(119)),r(n(274)),r(n(120)),r(n(121)),r(n(275)),r(n(80)),r(n(122)),r(n(276)),r(n(277))},function(e,t,n){"use strict";var r=n(138),o=Object.prototype.toString;function i(e){return"[object Array]"===o.call(e)}function s(e){return"undefined"===typeof e}function a(e){return null!==e&&"object"===typeof e}function u(e){return"[object Function]"===o.call(e)}function c(e,t){if(null!==e&&"undefined"!==typeof e)if("object"!==typeof e&&(e=[e]),i(e))for(var n=0,r=e.length;n0?o(r(e),9007199254740991):0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(53),o=n(262),i=function(){function e(){}return e.reset=function(){delete this.cmpId,delete this.cmpVersion,delete this.eventStatus,delete this.gdprApplies,delete this.tcModel,delete this.tcString,delete this.tcfPolicyVersion,this.cmpStatus=r.CmpStatus.LOADING,this.disabled=!1,this.displayStatus=r.DisplayStatus.HIDDEN,this.eventQueue.clear()},e.apiVersion="2",e.eventQueue=new o.EventListenerQueue,e.cmpStatus=r.CmpStatus.LOADING,e.disabled=!1,e.displayStatus=r.DisplayStatus.HIDDEN,e}();t.CmpApiModel=i},function(e,t,n){var r=n(56),o=n(33);e.exports=function(e){return r(o(e))}},function(e,t,n){var r=n(33);e.exports=function(e){return Object(r(e))}},function(e,t,n){var r=n(18).f,o=n(13),i=n(7)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){var r=n(3),o=n(77);e.exports=r?o:function(e){return Set.prototype.values.call(e)}},function(e,t,n){"use strict";var r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(){}return e.prototype.clone=function(){var e=this,t=new this.constructor;return Object.keys(this).forEach((function(n){var r=e.deepClone(e[n]);void 0!==r&&(t[n]=r)})),t},e.prototype.deepClone=function(e){var t,n,o=typeof e;if("number"===o||"string"===o||"boolean"===o)return e;if(null!==e&&"object"===o){if("function"==typeof e.clone)return e.clone();if(e instanceof Date)return new Date(e.getTime());if(void 0!==e[Symbol.iterator]){var i=[];try{for(var s=r(e),a=s.next();!a.done;a=s.next()){var u=a.value;i.push(this.deepClone(u))}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return e instanceof Array?i:new e.constructor(i)}var c={};for(var f in e)e.hasOwnProperty(f)&&(c[f]=this.deepClone(e[f]));return c}},e}();t.Cloneable=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(14),o=function(){function e(){}return e.encode=function(e,t){var n;if("string"==typeof e&&(e=parseInt(e,10)),(n=e.toString(2)).length>t||e<0)throw new r.EncodingError(e+" too large to encode into "+t);return n.length0?r:n)(e)}},function(e,t,n){var r,o=n(2),i=n(157),s=n(63),a=n(37),u=n(88),c=n(57),f=n(45),l=f("IE_PROTO"),p=function(){},d=function(e){return"