From c10ab3597bf58a1a90016e55538f7262774a2668 Mon Sep 17 00:00:00 2001 From: Christian Shum-Harden Date: Tue, 15 Sep 2020 11:22:54 -0700 Subject: [PATCH 1/3] fix (loader: polyfills) add polyfill check for promise.finally / add data for localization error logging --- CHANGELOG.md | 7 +++++++ package.json | 2 +- src/s1/constants.js | 34 ---------------------------------- src/s1/lib/localize.js | 2 +- src/s1/tcf-2.0-loader.js | 6 ++++++ 5 files changed, 15 insertions(+), 36 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8615d3fb..48a93c95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [2.0.3](https://github.com/openmail/system1-cmp/compare/v2.0.2...v2.0.3) (2020-09-15) + +### Fix + +- [x] tcf-2.0-loader add check for Promise finally. +- [x] Add more information on localize fetch error log. + ## [2.0.2](https://github.com/openmail/system1-cmp/compare/v2.0.1...v2.0.2) (2020-09-02) ### Feat diff --git a/package.json b/package.json index 5ac1cae4..fd205f18 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "system1-cmp", - "version": "2.0.2", + "version": "2.0.3", "description": "System1 Consent Management Platform for TCF 1.1 GDPR Compliance", "scripts": { "clean": "rimraf ./dist", diff --git a/src/s1/constants.js b/src/s1/constants.js index bfca6d88..a7ed600f 100644 --- a/src/s1/constants.js +++ b/src/s1/constants.js @@ -61,37 +61,3 @@ export const LANGUAGES = [ ]; export const DEFAULT_LANGUAGE = LANGUAGES[0]; - -export const LANGUAGES_2 = { - en: 'English', - bg: 'Bulgarian', - ca: 'Catalan', - cs: 'Czech', - da: 'Danish', - de: 'German', - el: 'Greek', - es: 'Spanish', - et: 'Estonian', - fi: 'Finnish', - fr: 'French', - hr: 'Croatian', - hu: 'Hungarian', - it: 'Italian', - ja: 'Japanese', - lt: 'Lithuanian', - lv: 'Latvian', - mt: 'Maltese', - nl: 'Dutch', - no: 'Norwegian', - pl: 'Polish', - pt: 'Portuguese', - ro: 'Romanian', - // 'sr-cyrillic': 'Serbian Cryllic', - // 'sr-latin': 'Serbian Latin', - ru: 'Russian', - sk: 'Slovak', - sl: 'Slovenian', - sv: 'Swedish', - tr: 'Turkish', - zh: 'Chinese', -}; diff --git a/src/s1/lib/localize.js b/src/s1/lib/localize.js index 4b49cf05..d90fc7d7 100644 --- a/src/s1/lib/localize.js +++ b/src/s1/lib/localize.js @@ -44,7 +44,7 @@ export const localize = (language) => { .then((json) => flatten(json)) .catch((e) => { logger(LOG_EVENTS.CMPError, { - message: `localizeError: ${e}`, + message: `localizeError: ${e} ${filename}`, }); }); }; diff --git a/src/s1/tcf-2.0-loader.js b/src/s1/tcf-2.0-loader.js index 06996692..54fef5a7 100644 --- a/src/s1/tcf-2.0-loader.js +++ b/src/s1/tcf-2.0-loader.js @@ -16,6 +16,12 @@ polyfillSrc = 'polyfillSrc', shouldPolyfill = !window.Promise || !window.fetch || !window.Symbol; + // more intricate polyfill + if (!shouldPolyfill) { + var promiseTest = new Promise(function () {}); + shouldPolyfill = !promiseTest.finally; + } + function loadScript(src, done) { var js = document.createElement('script'); js.src = src; From a8158dd5d662b6deef56579f0fc0d9db882f370e Mon Sep 17 00:00:00 2001 From: Christian Shum-Harden Date: Tue, 15 Sep 2020 11:28:30 -0700 Subject: [PATCH 2/3] comments --- src/s1/tcf-2.0-loader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s1/tcf-2.0-loader.js b/src/s1/tcf-2.0-loader.js index 54fef5a7..09e135c6 100644 --- a/src/s1/tcf-2.0-loader.js +++ b/src/s1/tcf-2.0-loader.js @@ -16,7 +16,7 @@ polyfillSrc = 'polyfillSrc', shouldPolyfill = !window.Promise || !window.fetch || !window.Symbol; - // more intricate polyfill + // Test for specific functionality for some polyfills if (!shouldPolyfill) { var promiseTest = new Promise(function () {}); shouldPolyfill = !promiseTest.finally; From 4922f68e80fd5e97e509bbdc11a5f5289622aa91 Mon Sep 17 00:00:00 2001 From: Christian Shum-Harden Date: Tue, 15 Sep 2020 11:31:22 -0700 Subject: [PATCH 3/3] use 2.0.3 in readme --- README.md | 8 ++++---- src/s1/reference/tcf-2.0.html | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index c1025e78..ad63e53d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ TCF 2.0 Consent Management Platform (CMP) UI tool. We are in the process of validating this CMP, we will update this repo once it passes TCF 2.0 validation. -[Reference Page and Demo](https://s.flocdn.com/cmp/2.0.0/tcf-2.0.html) +[Reference Page and Demo](https://s.flocdn.com/cmp/2.0.3/tcf-2.0.html) @@ -33,7 +33,7 @@ TCF 2.0 Consent Management Platform (CMP) UI tool. We are in the process of vali API signatures have changed from the CMP TCF 1.1, but we've tried to keep the configuration process very similar. See a [working example in codepen](https://codepen.io/potench/pen/GRZZprw). ```html - +