chefcookie 2.7.8 → 2.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,7 +4,28 @@ All notable changes to this project will be documented in this file. Dates are d
4
4
 
5
5
  Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
6
6
 
7
- #### [2.7.6](https://github.com/vielhuber/chefcookie/compare/2.7.6...2.7.6)
7
+ #### [2.7.9](https://github.com/vielhuber/chefcookie/compare/2.7.9...2.7.9)
8
+
9
+ #### [2.7.9](https://github.com/vielhuber/chefcookie/compare/2.7.8...2.7.9)
10
+
11
+ > 18 January 2023
12
+
13
+ - Add new config attribute lng_fallback. [`d6c0f51`](https://github.com/vielhuber/chefcookie/commit/d6c0f515b63747ad7841a3bc24fb44367964fb87)
14
+ - Update changelog. [`f9a9cbe`](https://github.com/vielhuber/chefcookie/commit/f9a9cbee8045bb0327f230af8586ab3cb4e2dea5)
15
+
16
+ #### [2.7.8](https://github.com/vielhuber/chefcookie/compare/2.7.7...2.7.8)
17
+
18
+ > 16 January 2023
19
+
20
+ - Build minified version. [`8cd4853`](https://github.com/vielhuber/chefcookie/commit/8cd4853c8443efcd535891b870f5e076e31f5463)
21
+
22
+ #### [2.7.7](https://github.com/vielhuber/chefcookie/compare/2.7.6...2.7.7)
23
+
24
+ > 16 January 2023
25
+
26
+ - Improve position of page during open banner, improve cleanup. [`9505cda`](https://github.com/vielhuber/chefcookie/commit/9505cda2394eef379dc576f0c0cb172270531b4f)
27
+ - Update changelog. [`6cab245`](https://github.com/vielhuber/chefcookie/commit/6cab2459c44dd1c1a287a6e760902366791efaa9)
28
+ - Improve position of page during open banner, improve cleanup. [`26890bc`](https://github.com/vielhuber/chefcookie/commit/26890bcfcf9db93e7b23bfa0be687a77f27040a8)
8
29
 
9
30
  #### [2.7.6](https://github.com/vielhuber/chefcookie/compare/2.7.5...2.7.6)
10
31
 
package/README.md CHANGED
@@ -80,9 +80,11 @@ const cc = new chefcookie({
80
80
  scripts_selection: 'collapse', // false|true|'collapse'
81
81
  debug_log: false,
82
82
  consent_tracking: null, // '/wp-json/v1/track-consent.php'
83
+ lng_fallback: null, // lng code used in labels when current lng is not found (e.g. "en")
83
84
  expiration: 7, // in days
84
85
  cookie_prefix: 'cc_', // switch cookie prefix (e.g. for different pages on the same top level domain)
85
- exclude_ua_regex: /(Speed Insights|Chrome-Lighthouse|PSTS[\d\.]+)/,
86
+ exclude_ua_regex:
87
+ /(Mozilla\/5\.0 \(Linux; Android 11; moto g power \(2022\)\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/109\.0.0.0 Mobile Safari\/537\.36)|(Mozilla\/5\.0 \(Macintosh; Intel Mac OS X 10_15_7\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/109\.0\.0\.0 Safari\/537\.36)|(Speed Insights)|(Chrome-Lighthouse)|(PSTS[\d\.]+)/,
86
88
  //domain: undefined,
87
89
  style: {
88
90
  layout: 'overlay', // overlay|bottombar|topbar
@@ -448,7 +450,7 @@ const cc = new chefcookie({
448
450
  });
449
451
  ```
450
452
 
451
- currently the default regex `/(Speed Insights|Chrome-Lighthouse|PSTS[\d\.]+)/` excludes Google PageSpeed Insights, Chrome Lighthouse and WebPageTest.org.
453
+ currently the default regex `/(Mozilla\/5\.0 \(Linux; Android 11; moto g power \(2022\)\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/109\.0.0.0 Mobile Safari\/537\.36)|(Mozilla\/5\.0 \(Macintosh; Intel Mac OS X 10_15_7\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/109\.0\.0\.0 Safari\/537\.36)|(Speed Insights)|(Chrome-Lighthouse)|(PSTS[\d\.]+)/` excludes Google PageSpeed Insights, Chrome Lighthouse and WebPageTest.org.
452
454
 
453
455
  #### consent manager tracking
454
456
 
package/_build/script.js CHANGED
@@ -25,7 +25,7 @@ var chefcookie = /*#__PURE__*/function () {
25
25
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
26
26
  (0, _classCallCheck2.default)(this, chefcookie);
27
27
  var defaults = {
28
- exclude_ua_regex: /(Speed Insights|Chrome-Lighthouse|PSTS[\d\.]+)/,
28
+ exclude_ua_regex: /(Mozilla\/5\.0 \(Linux; Android 11; moto g power \(2022\)\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/109\.0.0.0 Mobile Safari\/537\.36)|(Mozilla\/5\.0 \(Macintosh; Intel Mac OS X 10_15_7\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/109\.0\.0\.0 Safari\/537\.36)|(Speed Insights)|(Chrome-Lighthouse)|(PSTS[\d\.]+)/,
29
29
  domain: _helper.default.urlHostTopLevel()
30
30
  };
31
31
  this.config = _objectSpread(_objectSpread({}, defaults), config);
@@ -59,7 +59,7 @@ var chefcookie = /*#__PURE__*/function () {
59
59
  value: function init() {
60
60
  if (this.config.exclude_google_pagespeed === true) {
61
61
  // deprecated legacy support
62
- this.config.exclude_ua_regex = /(Speed Insights|Chrome-Lighthouse)/;
62
+ this.config.exclude_ua_regex = /(Mozilla\/5\.0 \(Linux; Android 11; moto g power \(2022\)\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/109\.0.0.0 Mobile Safari\/537\.36)|(Mozilla\/5\.0 \(Macintosh; Intel Mac OS X 10_15_7\) AppleWebKit\/537\.36 \(KHTML, like Gecko\) Chrome\/109\.0\.0\.0 Safari\/537\.36)|(Speed Insights)|(Chrome-Lighthouse)|(PSTS[\d\.]+)/;
63
63
  }
64
64
  if (this.config.exclude_ua_regex !== undefined && navigator.userAgent.match(this.config.exclude_ua_regex)) {
65
65
  return;
@@ -1261,6 +1261,9 @@ var chefcookie = /*#__PURE__*/function () {
1261
1261
  }
1262
1262
  var lng = this.lng();
1263
1263
  if (!(lng in obj)) {
1264
+ if ('lng_fallback' in this.config && this.config.lng_fallback !== false && this.config.lng_fallback !== undefined && this.config.lng_fallback !== null && this.config.lng_fallback !== '' && this.config.lng_fallback in obj) {
1265
+ return obj[this.config.lng_fallback];
1266
+ }
1264
1267
  return Object.values(obj)[0];
1265
1268
  }
1266
1269
  return obj[lng];