chefcookie 2.7.1 → 2.7.3

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/_build/script.js CHANGED
@@ -1,42 +1,25 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
-
12
9
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
-
14
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
-
16
11
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
17
-
18
12
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
19
-
20
13
  require("mdn-polyfills/Object.entries");
21
-
22
14
  require("mdn-polyfills/Object.values");
23
-
24
15
  require("mdn-polyfills/Number.isInteger");
25
-
26
16
  require("mdn-polyfills/Element.prototype.closest");
27
-
28
17
  require("mdn-polyfills/Node.prototype.remove");
29
-
30
18
  require("@babel/polyfill/noConflict");
31
-
32
19
  var _helper = _interopRequireDefault(require("./_helper"));
33
-
34
20
  var _cookie = _interopRequireDefault(require("cookie"));
35
-
36
21
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
37
-
38
22
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
39
-
40
23
  var chefcookie = /*#__PURE__*/function () {
41
24
  function chefcookie() {
42
25
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -45,8 +28,8 @@ var chefcookie = /*#__PURE__*/function () {
45
28
  exclude_ua_regex: /(Speed Insights|Chrome-Lighthouse|PSTS[\d\.]+)/,
46
29
  domain: _helper.default.urlHostTopLevel()
47
30
  };
48
- this.config = _objectSpread(_objectSpread({}, defaults), config); // add dummy entries for empty groups
49
-
31
+ this.config = _objectSpread(_objectSpread({}, defaults), config);
32
+ // add dummy entries for empty groups
50
33
  this.config.settings.forEach(function (group, i) {
51
34
  if (!('scripts' in group) || Object.keys(group.scripts).length === 0) {
52
35
  group.scripts = {};
@@ -55,11 +38,9 @@ var chefcookie = /*#__PURE__*/function () {
55
38
  });
56
39
  this.isDestroyed = false;
57
40
  this.isOpened = false;
58
-
59
41
  if (!('chefcookie_loaded' in window)) {
60
42
  window.chefcookie_loaded = [];
61
43
  }
62
-
63
44
  this.scrollDepthTriggeredOnce = false;
64
45
  this.scrollDepthTriggered = {
65
46
  1: false,
@@ -73,7 +54,6 @@ var chefcookie = /*#__PURE__*/function () {
73
54
  this.animationSpeed = 300;
74
55
  this.scrollPosition = 0;
75
56
  }
76
-
77
57
  (0, _createClass2.default)(chefcookie, [{
78
58
  key: "init",
79
59
  value: function init() {
@@ -81,26 +61,21 @@ var chefcookie = /*#__PURE__*/function () {
81
61
  // deprecated legacy support
82
62
  this.config.exclude_ua_regex = /(Speed Insights|Chrome-Lighthouse)/;
83
63
  }
84
-
85
64
  if (this.config.exclude_ua_regex !== undefined && navigator.userAgent.match(this.config.exclude_ua_regex)) {
86
65
  return;
87
66
  }
88
-
89
- if (document.head === null) {
67
+ if (document.head === null || typeof document.head.insertAdjacentHTML === 'undefined') {
90
68
  return;
91
69
  }
92
-
93
70
  if (this.isExcluded()) {
94
71
  this.bindOptOutOptIn();
95
72
  this.updateOptOutOptIn();
96
73
  return;
97
74
  }
98
-
99
75
  if (this.forceAccept()) {
100
76
  this.autoAcceptAllScripts();
101
77
  this.setCookieToHideOverlay();
102
78
  }
103
-
104
79
  if (this.isCookieSetToHideOverlay()) {
105
80
  this.addEnabledScripts(false);
106
81
  } else {
@@ -108,7 +83,6 @@ var chefcookie = /*#__PURE__*/function () {
108
83
  this.open();
109
84
  this.trackFirstUserInteraction();
110
85
  }
111
-
112
86
  this.bindOptOutOptIn();
113
87
  this.updateOptOutOptIn();
114
88
  }
@@ -118,7 +92,6 @@ var chefcookie = /*#__PURE__*/function () {
118
92
  if (this.isOpened === true) {
119
93
  return;
120
94
  }
121
-
122
95
  this.isOpened = true;
123
96
  this.addStyle();
124
97
  this.buildDom();
@@ -134,38 +107,31 @@ var chefcookie = /*#__PURE__*/function () {
134
107
  if (this.isOpened === false) {
135
108
  return;
136
109
  }
137
-
138
110
  this.isOpened = false;
139
111
  document.documentElement.classList.remove('chefcookie--visible');
140
112
  document.documentElement.classList.remove('chefcookie--fade');
141
- document.documentElement.classList.remove('chefcookie--noscroll'); // reset scroll position
142
-
113
+ document.documentElement.classList.remove('chefcookie--noscroll');
114
+ // reset scroll position
143
115
  if (this.config.style.layout !== 'topbar') {
144
116
  var defaultBodyScrollBehavior = null,
145
- defaultHtmlScrollBehavior = null;
146
-
117
+ defaultHtmlScrollBehavior = null;
147
118
  if (window.getComputedStyle(document.body).scrollBehavior !== 'auto') {
148
119
  defaultBodyScrollBehavior = window.getComputedStyle(document.body).scrollBehavior;
149
120
  document.body.style.scrollBehavior = 'auto';
150
121
  }
151
-
152
122
  if (window.getComputedStyle(document.documentElement).scrollBehavior !== 'auto') {
153
123
  defaultHtmlScrollBehavior = window.getComputedStyle(document.documentElement).scrollBehavior;
154
124
  document.documentElement.style.scrollBehavior = 'auto';
155
125
  }
156
-
157
126
  document.body.style.top = 'auto';
158
127
  window.scrollTo(0, this.scrollPosition);
159
-
160
128
  if (defaultBodyScrollBehavior !== null) {
161
129
  document.body.style.scrollBehavior = defaultBodyScrollBehavior;
162
130
  }
163
-
164
131
  if (defaultHtmlScrollBehavior !== null) {
165
132
  document.documentElement.style.scrollBehavior = defaultHtmlScrollBehavior;
166
133
  }
167
134
  }
168
-
169
135
  document.documentElement.classList.remove('chefcookie--blur');
170
136
  this.animationOut();
171
137
  setTimeout(function () {
@@ -187,39 +153,30 @@ var chefcookie = /*#__PURE__*/function () {
187
153
  key: "animationIn",
188
154
  value: function animationIn() {
189
155
  var _this2 = this;
190
-
191
156
  document.querySelector('.chefcookie__inner').style.overflowY = 'hidden';
192
-
193
157
  if (this.config.style.layout === 'topbar') {
194
158
  document.querySelector('.chefcookie').style.marginTop = -1 * document.querySelector('.chefcookie').offsetHeight + 'px';
195
159
  }
196
-
197
160
  if (this.config.style.layout === 'bottombar') {
198
161
  document.querySelector('.chefcookie').style.marginBottom = -1 * document.querySelector('.chefcookie').offsetHeight + 'px';
199
162
  }
200
-
201
163
  if (this.config.style.layout === 'overlay') {
202
164
  document.querySelector('.chefcookie__box').style.transform = 'scale(0.7)';
203
165
  }
204
-
205
166
  requestAnimationFrame(function () {
206
167
  setTimeout(function () {
207
168
  document.querySelector('.chefcookie').style.transition = 'opacity ' + _this2.animationSpeed / 1000 + 's ease-in-out, margin ' + _this2.animationSpeed / 1000 + 's ease-in-out';
208
169
  document.querySelector('.chefcookie__box').style.transition = 'transform ' + _this2.animationSpeed / 1000 + 's ease-in-out';
209
170
  document.querySelector('.chefcookie').classList.remove('chefcookie--hidden');
210
-
211
171
  if (_this2.config.style.layout === 'topbar') {
212
172
  document.querySelector('.chefcookie').style.marginTop = 0 + 'px';
213
173
  }
214
-
215
174
  if (_this2.config.style.layout === 'bottombar') {
216
175
  document.querySelector('.chefcookie').style.marginBottom = 0 + 'px';
217
176
  }
218
-
219
177
  if (_this2.config.style.layout === 'overlay') {
220
178
  document.querySelector('.chefcookie__box').style.transform = 'none';
221
179
  }
222
-
223
180
  requestAnimationFrame(function () {
224
181
  setTimeout(function () {
225
182
  document.querySelector('.chefcookie__inner').style.overflowY = 'auto';
@@ -233,15 +190,12 @@ var chefcookie = /*#__PURE__*/function () {
233
190
  value: function animationOut() {
234
191
  document.querySelector('.chefcookie__inner').style.overflowY = 'hidden';
235
192
  document.querySelector('.chefcookie').classList.add('chefcookie--hidden');
236
-
237
193
  if (this.config.style.layout === 'topbar') {
238
194
  document.querySelector('.chefcookie').style.marginTop = -1 * document.querySelector('.chefcookie').offsetHeight + 'px';
239
195
  }
240
-
241
196
  if (this.config.style.layout === 'bottombar') {
242
197
  document.querySelector('.chefcookie').style.marginBottom = -1 * document.querySelector('.chefcookie').offsetHeight + 'px';
243
198
  }
244
-
245
199
  if (this.config.style.layout === 'overlay') {
246
200
  document.querySelector('.chefcookie__box').style.transform = 'scale(0.7)';
247
201
  }
@@ -254,13 +208,11 @@ var chefcookie = /*#__PURE__*/function () {
254
208
  this.isDestroyed = true;
255
209
  this.isOpened = false;
256
210
  /* intentionally don't reset loaded scripts */
257
-
258
211
  /*
259
212
  if ('chefcookie_loaded' in window) {
260
213
  delete window.chefcookie_loaded;
261
214
  }
262
215
  */
263
-
264
216
  this.unregisterAllEventListeners();
265
217
  this.eventListeners = [];
266
218
  }
@@ -273,42 +225,36 @@ var chefcookie = /*#__PURE__*/function () {
273
225
  key: "bindOptOutOptIn",
274
226
  value: function bindOptOutOptIn() {
275
227
  var _this3 = this;
276
-
277
228
  // bind opt out
278
229
  this.registerEventListener(document, 'click', function (e) {
279
230
  if (e.target.hasAttribute('data-cc-disable') || e.target.tagName !== 'A' && e.target.closest('[data-cc-disable]')) {
280
231
  var el = e.target.closest('[data-cc-disable]');
281
-
282
232
  if (!_this3.isAccepted(el.getAttribute('data-cc-disable'))) {
283
233
  _this3.accept(el.getAttribute('data-cc-disable'), true);
284
234
  } else {
285
235
  _this3.decline(el.getAttribute('data-cc-disable'), true);
286
236
  }
287
-
288
237
  _this3.updateOptOutOptIn();
289
-
290
238
  e.preventDefault();
291
239
  }
292
- }); // bind opt in
240
+ });
293
241
 
242
+ // bind opt in
294
243
  this.registerEventListener(document, 'click', function (e) {
295
244
  if (e.target.hasAttribute('data-cc-enable') || e.target.tagName !== 'A' && e.target.closest('[data-cc-enable]')) {
296
245
  var el = e.target.closest('[data-cc-enable]');
297
-
298
246
  if (!_this3.isAccepted(el.getAttribute('data-cc-enable'))) {
299
247
  _this3.accept(el.getAttribute('data-cc-enable'), true);
300
248
  }
301
-
302
249
  _this3.updateOptOutOptIn();
303
-
304
250
  e.preventDefault();
305
251
  }
306
- }); // bind open
252
+ });
307
253
 
254
+ // bind open
308
255
  this.registerEventListener(document, 'click', function (e) {
309
256
  if (e.target.hasAttribute('data-cc-open') || e.target.tagName !== 'A' && e.target.closest('[data-cc-open]')) {
310
257
  _this3.open();
311
-
312
258
  e.preventDefault();
313
259
  }
314
260
  });
@@ -317,7 +263,6 @@ var chefcookie = /*#__PURE__*/function () {
317
263
  key: "updateOptOutOptIn",
318
264
  value: function updateOptOutOptIn() {
319
265
  var _this4 = this;
320
-
321
266
  // legacy: support old attribute names
322
267
  if (document.querySelector('[data-disable]') !== null) {
323
268
  [].forEach.call(document.querySelectorAll('[data-disable]'), function (el) {
@@ -326,25 +271,24 @@ var chefcookie = /*#__PURE__*/function () {
326
271
  }
327
272
  });
328
273
  }
329
-
330
274
  if (document.querySelector('[data-message]') !== null) {
331
275
  [].forEach.call(document.querySelectorAll('[data-message]'), function (el) {
332
276
  if (!el.hasAttribute('data-cc-message')) {
333
277
  el.setAttribute('data-cc-message', el.getAttribute('data-message'));
334
278
  }
335
279
  });
336
- } // store original message
337
-
280
+ }
338
281
 
282
+ // store original message
339
283
  if (document.querySelector('[data-cc-disable]') !== null) {
340
284
  [].forEach.call(document.querySelectorAll('[data-cc-disable]'), function (el) {
341
285
  if (!el.hasAttribute('data-cc-message-original')) {
342
286
  el.setAttribute('data-cc-message-original', el.textContent);
343
287
  }
344
288
  });
345
- } // update opt out
346
-
289
+ }
347
290
 
291
+ // update opt out
348
292
  if (document.querySelector('[data-cc-disable]') !== null) {
349
293
  [].forEach.call(document.querySelectorAll('[data-cc-disable]'), function (el) {
350
294
  if (_this4.isAccepted(el.getAttribute('data-cc-disable'))) {
@@ -355,9 +299,9 @@ var chefcookie = /*#__PURE__*/function () {
355
299
  el.classList.add('disabled');
356
300
  }
357
301
  });
358
- } // update opt in
359
-
302
+ }
360
303
 
304
+ // update opt in
361
305
  if (document.querySelector('[data-cc-enable]') !== null) {
362
306
  [].forEach.call(document.querySelectorAll('[data-cc-enable]'), function (el) {
363
307
  if (_this4.isAccepted(el.getAttribute('data-cc-enable'))) {
@@ -372,13 +316,11 @@ var chefcookie = /*#__PURE__*/function () {
372
316
  if (this.config.exclude === undefined) {
373
317
  return false;
374
318
  }
375
-
376
319
  var excluded = false;
377
320
  this.config.exclude.forEach(function (exclude__value) {
378
321
  if (typeof exclude__value === 'function' && exclude__value() === true) {
379
322
  excluded = true;
380
323
  }
381
-
382
324
  if (typeof exclude__value === 'string' && (exclude__value.indexOf('http') === 0 && exclude__value === window.location.protocol + '//' + window.location.host + window.location.pathname || exclude__value.indexOf('http') !== 0 && exclude__value === window.location.pathname || exclude__value.indexOf('http') !== 0 && exclude__value === decodeURI(window.location.pathname) || exclude__value.indexOf('http') !== 0 && exclude__value + '/' === window.location.pathname || exclude__value.indexOf('http') !== 0 && exclude__value + '/' === decodeURI(window.location.pathname))) {
383
325
  excluded = true;
384
326
  }
@@ -389,38 +331,30 @@ var chefcookie = /*#__PURE__*/function () {
389
331
  key: "addStyle",
390
332
  value: function addStyle() {
391
333
  var _this$config$style$co, _this$config$style$co2, _ref, _this$config$style$co3, _this$config$style$co4, _this$config$style$co5, _this$config$style$co6, _this$config$style$co7, _this$config$style$co8, _this$config$style$co9, _this$config$style$co10, _this$config$style$co11, _this$config$style$co12, _this$config$style$co13, _this$config$style$co14, _this$config$style$co15, _this$config$style$co16, _this$config$style$co17, _this$config$style$co18, _this$config$style$co19;
392
-
393
334
  var css = "\n .chefcookie, .chefcookie *\n {\n box-sizing: border-box;\n margin:0;\n padding:0;\n }\n /* try to reset styles */\n .chefcookie h2,\n .chefcookie a:link,\n .chefcookie a:hover,\n .chefcookie a:visited\n {\n color:inherit;\n }\n .chefcookie\n {\n position: fixed;\n z-index: 2147483647;\n left: 0;\n right: 0;\n bottom: 0;\n transform: translateZ(0);\n }\n .chefcookie--hidden\n {\n opacity: 0;\n pointer-events:none;\n }\n .chefcookie__inner\n {\n width:100%;\n height:100%;\n text-align: center;\n white-space: nowrap;\n font-size: 0;\n overflow-y:auto;\n overflow-x:hidden;\n max-height:100vh;\n }\n .chefcookie__box\n {\n font-size: ".concat(15 + (this.config.style.size - 3), "px;\n line-height:1.6;\n color:").concat((_this$config$style$co = this.config.style.color_text) !== null && _this$config$style$co !== void 0 ? _this$config$style$co : '#595f60', ";\n width: 100%;\n margin: 0 auto;\n display: inline-block;\n vertical-align: middle;\n white-space: normal;\n border-radius: 0;\n padding-top: 2em;\n padding-bottom: 2em;\n padding-left: 3em;\n padding-right: 3em;\n text-align: left;\n }\n .chefcookie__message\n {\n margin-bottom:1.5em;\n text-align:justify;\n }\n .chefcookie__message h2\n {\n margin-bottom:0.5em;\n font-size:2em;\n line-height:1.4;\n text-transform:uppercase;\n font-weight:700;\n text-align:left;\n }\n .chefcookie__message p {\n font-size: 1em;\n line-height:1.6;\n }\n .chefcookie__message a,\n .chefcookie__message a:focus\n {\n color:inherit;\n transition: all ").concat(this.animationSpeed / 1000, "s ease-in-out;\n text-decoration:underline;\n font-size: 1em;\n line-height:1.6;\n }\n .chefcookie__message a:focus\n {\n outline:none;\n }\n @media (hover: hover) {\n .chefcookie__message a:hover\n {\n opacity: 0.5;\n color: inherit;\n }\n }\n .chefcookie__message a:active\n {\n opacity: 0.1;\n color: inherit;\n }\n .chefcookie__buttons\n {\n margin-top:0.5em;\n }\n .chefcookie__button,\n .chefcookie__button:focus\n {\n padding: 1em 0.5em;\n border: 2px solid ").concat((_this$config$style$co2 = this.config.style.color_text) !== null && _this$config$style$co2 !== void 0 ? _this$config$style$co2 : '#595f60', ";\n font-weight: bold;\n display: block;\n color: inherit;\n text-decoration: none;\n transition: all ").concat(this.animationSpeed / 1000, "s ease-in-out;\n text-transform: uppercase;\n float: left;\n text-align: center;\n min-width: 21em;\n margin-right:3em;\n }\n .chefcookie__buttons--count-3 .chefcookie__button,\n .chefcookie__buttons--count-3 .chefcookie__button:focus {\n min-width:15em;\n margin-right:1em;\n }\n .chefcookie__button:last-child\n {\n margin-right:0;\n }\n .chefcookie__button:focus\n {\n outline:none;\n }\n @media (hover: hover) {\n .chefcookie__button:hover\n {\n opacity: 0.5;\n text-decoration:none;\n color: inherit;\n }\n }\n .chefcookie__button:active\n {\n opacity: 0.1;\n color: inherit;\n }\n .chefcookie__buttons:after\n {\n clear:both;\n display:table;\n content:\"\";\n }\n ").concat(this.config.style.highlight_accept === undefined || this.config.style.highlight_accept === true ? "\n .chefcookie__button--accept\n {\n background-color:".concat((_ref = (_this$config$style$co3 = this.config.style.color_highlight) !== null && _this$config$style$co3 !== void 0 ? _this$config$style$co3 : this.config.style.color) !== null && _ref !== void 0 ? _ref : '#ff0000', ";\n border-color:transparent;\n }\n .chefcookie__button--accept.chefcookie__button--accept,\n .chefcookie__button--accept.chefcookie__button--accept:hover,\n .chefcookie__button--accept.chefcookie__button--accept:focus,\n .chefcookie__button--accept.chefcookie__button--accept:link,\n .chefcookie__button--accept.chefcookie__button--accept:visited\n {\n color:").concat((_this$config$style$co4 = this.config.style.color_background) !== null && _this$config$style$co4 !== void 0 ? _this$config$style$co4 : '#eeeeee', ";\n }\n ") : "", "\n .chefcookie__settings-container\n {\n height:0;\n overflow:hidden;\n transition: height ").concat(this.animationSpeed / 1000, "s ease-out;\n }\n .chefcookie__groups\n {\n list-style-type:none;\n }\n .chefcookie__groups:after\n {\n clear:both;\n display:table;\n content:\"\";\n }\n .chefcookie__group\n {\n float: left;\n }\n .chefcookie__group:before\n {\n display:none;\n }\n .chefcookie__group-title\n {\n float:left;\n width:70%;\n min-height: 1.66em;\n line-height: 1.66;\n display: block;\n font-weight:bold;\n font-size:1.2em;\n line-height:1.7;\n text-transform:uppercase;\n }\n .chefcookie__group-label\n {\n cursor: pointer;\n display:block;\n width:100%;\n height:100%;\n font-size:1em;\n line-height:1.6;\n }\n .chefcookie__group-label:after\n {\n clear:both;\n display:table;\n content:\"\"\n }\n .chefcookie__group--disabled .chefcookie__group-label\n {\n cursor:default;\n }\n .chefcookie__group-checkbox\n {\n opacity: 0;\n position:absolute;\n display: block;\n pointer-events:none;\n }\n .chefcookie__group--disabled .chefcookie__group-checkbox-icon\n {\n ").concat(this.config.style.show_disabled_checkbox === undefined || this.config.style.show_disabled_checkbox === false ? "display:none;" : "opacity: 0.75 !important;", "\n }\n .chefcookie__group-checkbox-icon\n {\n line-height:2;\n display: block;\n width: 4em;\n height: 2em;\n background-color: ").concat((_this$config$style$co5 = this.config.style.color_background) !== null && _this$config$style$co5 !== void 0 ? _this$config$style$co5 : '#eeeeee', ";\n border: 2px solid ").concat((_this$config$style$co6 = this.config.style.color_text) !== null && _this$config$style$co6 !== void 0 ? _this$config$style$co6 : '#595f60', ";\n margin: 0;\n padding: 0;\n position: relative;\n border-radius: 2em;\n float: right;\n }\n .chefcookie__group-checkbox-icon:before\n {\n content: \"0\";\n position: absolute;\n top: 0;\n left: 45%;\n width: 50%;\n bottom: 0;\n transition: all ").concat(this.animationSpeed / 1000, "s ease-in-out;\n text-align: center;\n font-weight: bold;\n font-size: 1em;\n line-height: 2;\n opacity: 0.25;\n color: ").concat((_this$config$style$co7 = this.config.style.color_text) !== null && _this$config$style$co7 !== void 0 ? _this$config$style$co7 : '#595f60', ";\n }\n .chefcookie__group-checkbox-icon:after\n {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 50%;\n bottom: 0;\n box-shadow: 0 0 0px 1px ").concat((_this$config$style$co8 = this.config.style.color_text) !== null && _this$config$style$co8 !== void 0 ? _this$config$style$co8 : '#595f60', ";\n background-color: ").concat((_this$config$style$co9 = this.config.style.color_text) !== null && _this$config$style$co9 !== void 0 ? _this$config$style$co9 : '#595f60', ";\n transition: all ").concat(this.animationSpeed / 1000, "s ease-in-out;\n border-radius: 50%;\n }\n .chefcookie__group-checkbox ~ *\n {\n transition: all ").concat(this.animationSpeed / 1000, "s ease-in-out;\n }\n .chefcookie__group-checkbox[data-status=\"0\"] ~ *\n {\n opacity: 0.75;\n }\n .chefcookie__group-checkbox[data-status=\"1\"] ~ .chefcookie__group-checkbox-icon\n {\n opacity: 0.85;\n }\n .chefcookie__group-checkbox[data-status=\"1\"] ~ .chefcookie__group-checkbox-icon:after\n {\n left:25%;\n }\n .chefcookie__group-checkbox[data-status=\"2\"] ~ .chefcookie__group-checkbox-icon:after\n {\n left:50%;\n }\n .chefcookie__group-checkbox[data-status=\"1\"] ~ .chefcookie__group-checkbox-icon:before,\n .chefcookie__group-checkbox[data-status=\"2\"] ~ .chefcookie__group-checkbox-icon:before\n {\n content: \"\";\n background-color: ").concat((_this$config$style$co10 = this.config.style.color_text) !== null && _this$config$style$co10 !== void 0 ? _this$config$style$co10 : '#595f60', ";\n top: 30%;\n bottom: 30%;\n left: 27%;\n width: 3px;\n }\n .chefcookie__group-description\n {\n width:100%;\n clear:both;\n padding-top:1em;\n display: block;\n font-size:0.9em;\n line-height:1.5;\n text-align:justify;\n font-weight: normal;\n }\n .chefcookie__group-collapse,\n .chefcookie__group-collapse:focus {\n color:inherit;\n text-decoration:underline;\n padding-top: 0.5em;\n display: block;\n }\n @media (hover: hover) {\n .chefcookie__group-collapse:hover\n {\n opacity: 0.9;\n color: inherit;\n text-decoration:underline;\n }\n }\n .chefcookie__scripts\n {\n list-style-type:none;\n height:0;\n overflow:hidden;\n transition: height ").concat(this.animationSpeed / 1000, "s ease-out;\n }\n .chefcookie__scripts--visible {\n height:auto;\n }\n .chefcookie__script {\n margin-bottom:0.5em;\n }\n .chefcookie__script:before\n {\n display:none;\n }\n .chefcookie__script:first-child {\n margin-top:1em;\n }\n .chefcookie__script:last-child {\n margin-bottom:0;\n }\n .chefcookie__script-title\n {\n float:left;\n width:70%;\n min-height: 1.66em;\n line-height: 1.66;\n display: block;\n }\n .chefcookie__script-label\n {\n cursor: pointer;\n display:block;\n width:100%;\n height:100%;\n }\n .chefcookie__script-label:after\n {\n clear:both;\n display:table;\n content:\"\"\n }\n .chefcookie__script--disabled .chefcookie__script-label\n {\n cursor:default;\n }\n .chefcookie__script-checkbox\n {\n opacity: 0;\n position:absolute;\n display: block;\n pointer-events:none;\n }\n .chefcookie__script--disabled .chefcookie__script-checkbox-icon\n {\n ").concat(this.config.style.show_disabled_checkbox === undefined || this.config.style.show_disabled_checkbox === false ? "display:none;" : "opacity: 0.75 !important;", "\n }\n .chefcookie__script-checkbox-icon\n {\n line-height:1.5;\n display: block;\n width: 3em;\n height: 1.5em;\n background-color: ").concat((_this$config$style$co11 = this.config.style.color_background) !== null && _this$config$style$co11 !== void 0 ? _this$config$style$co11 : '#eeeeee', ";\n border: 1px solid ").concat((_this$config$style$co12 = this.config.style.color_text) !== null && _this$config$style$co12 !== void 0 ? _this$config$style$co12 : '#595f60', ";\n margin: 0;\n padding: 0;\n position: relative;\n border-radius: 2em;\n float: right;\n }\n .chefcookie__script-checkbox-icon:before\n {\n content: \"0\";\n position: absolute;\n top: 0;\n left: 45%;\n width: 50%;\n bottom: 0;\n transition: all ").concat(this.animationSpeed / 1000, "s ease-in-out;\n text-align: center;\n font-size: 0.7em;\n line-height: 2;\n opacity: 0.25;\n color: ").concat((_this$config$style$co13 = this.config.style.color_text) !== null && _this$config$style$co13 !== void 0 ? _this$config$style$co13 : '#595f60', ";\n }\n .chefcookie__script-checkbox-icon:after\n {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 50%;\n bottom: 0;\n box-shadow: 0 0 0px 1px ").concat((_this$config$style$co14 = this.config.style.color_text) !== null && _this$config$style$co14 !== void 0 ? _this$config$style$co14 : '#595f60', ";\n background-color: ").concat((_this$config$style$co15 = this.config.style.color_text) !== null && _this$config$style$co15 !== void 0 ? _this$config$style$co15 : '#595f60', ";\n transition: all ").concat(this.animationSpeed / 1000, "s ease-in-out;\n border-radius: 50%;\n }\n .chefcookie__script-checkbox ~ *\n {\n opacity: 0.75;\n transition: all ").concat(this.animationSpeed / 1000, "s ease-in-out;\n }\n .chefcookie__script-checkbox:checked ~ *\n {\n opacity:1;\n }\n .chefcookie__script-checkbox:checked ~ .chefcookie__script-checkbox-icon:after\n {\n left:50%;\n }\n .chefcookie__script-checkbox:checked ~ .chefcookie__script-checkbox-icon:before\n {\n content: \"\";\n background-color: ").concat((_this$config$style$co16 = this.config.style.color_text) !== null && _this$config$style$co16 !== void 0 ? _this$config$style$co16 : '#595f60', ";\n top: 30%;\n bottom: 30%;\n left: 27%;\n width: 2px;\n }\n\n .chefcookie__script-description\n {\n width: 100%;\n clear: both;\n padding-top: 0.5em;\n padding-bottom: 0.5em;\n display: block;\n font-size: 0.8em;\n line-height:1.4;\n text-align: justify;\n }\n .chefcookie__script-description-collapse,\n .chefcookie__script-description-collapse:focus {\n color:inherit;\n text-decoration:underline;\n padding-top: 0.25em;\n padding-bottom: 0.5em;\n display: block;\n }\n @media (hover: hover) {\n .chefcookie__script-description-collapse:hover\n {\n opacity: 0.9;\n color: inherit;\n text-decoration:underline;\n }\n }\n .chefcookie__script-description-content {\n height:0;\n overflow:hidden;\n transition: height ").concat(this.animationSpeed / 1000, "s ease-out;\n }\n .chefcookie__script-description-content > *:not(:last-child) {\n margin-bottom:0.5em;\n }\n .chefcookie__script-description-content table {\n width:100%;\n border-collapse: collapse;\n table-layout: fixed;\n }\n .chefcookie__script-description-content table td {\n border:1px solid ").concat(this.hexToRgbaStr((_this$config$style$co17 = this.config.style.color_text) !== null && _this$config$style$co17 !== void 0 ? _this$config$style$co17 : '#595f60', 0.1), ";\n padding: 0.3em 0.5em;\n vertical-align:top;\n }\n\n .chefcookie--noscroll body\n {\n position:fixed;\n width: 100%;\n overflow:hidden;\n }\n .chefcookie--fade body:after,\n .chefcookie--blur body:after\n {\n content:\"\";\n position:fixed;\n z-index: 2147483644;\n top:0;\n left:0;\n width:100%;\n height:100%;\n }\n .chefcookie--fade body:after\n {\n background-color: rgba(0, 0, 0, 0.65);\n }\n .chefcookie--blur body:after\n {\n backdrop-filter: grayscale(50%) blur(5px);\n }\n .chefcookie--overlay\n {\n top: 0;\n }\n .chefcookie--overlay .chefcookie__inner:before\n {\n content: '';\n display: inline-block;\n height: 100%;\n vertical-align: middle;\n }\n .chefcookie--overlay .chefcookie__box\n {\n width: 95%;\n max-width: 60em;\n box-shadow: 0 1em 5em -0.5em #000;\n background-color: ").concat((_this$config$style$co18 = this.config.style.color_background) !== null && _this$config$style$co18 !== void 0 ? _this$config$style$co18 : '#eeeeee', ";\n }\n .chefcookie--overlay .chefcookie__group\n {\n height: 13em;\n margin-bottom: 4%;\n background-color: rgba(").concat(this.config.style.color_background != '' && ['#000', '#000000', 'black'].indexOf(this.config.style.color_background) > -1 ? '255, 255, 255' : '0, 0, 0', ", 0.05);\n border: 1px solid rgba(").concat(this.config.style.color_background != '' && ['#000', '#000000', 'black'].indexOf(this.config.style.color_background) > -1 ? '255, 255, 255' : '0, 0, 0', ", 0.01);\n width: 48%;\n margin-right: 4%;\n }\n .chefcookie--overlay .chefcookie__group:nth-child(2n)\n {\n margin-right:0;\n }\n .chefcookie--overlay.chefcookie--has-scripts .chefcookie__group\n {\n height:auto;\n width: 100%;\n margin-right: 0;\n margin-bottom: 1em;\n }\n .chefcookie--overlay .chefcookie__group\n {\n padding: 1em 1.25em;\n }\n .chefcookie--bottombar,\n .chefcookie--topbar\n {\n background-color:").concat((_this$config$style$co19 = this.config.style.color_background) !== null && _this$config$style$co19 !== void 0 ? _this$config$style$co19 : '#eeeeee', ";\n box-shadow: 0 1em 5em -0.5em #000;\n }\n .chefcookie--bottombar\n {\n bottom:0;\n top:auto;\n }\n .chefcookie--topbar\n {\n bottom:auto;\n top:0;\n position:relative;\n }\n .chefcookie--bottombar .chefcookie__box,\n .chefcookie--topbar .chefcookie__box\n {\n max-width: 1280px;\n }\n .chefcookie--bottombar .chefcookie__group,\n .chefcookie--topbar .chefcookie__group\n {\n margin-bottom: 40px;\n margin-top: 40px;\n width: 22%;\n margin-right: 4%;\n }\n .chefcookie--bottombar .chefcookie__group:last-child,\n .chefcookie--topbar .chefcookie__group:last-child\n {\n margin-right:0;\n }\n .chefcookie--bottombar .chefcookie__groups--count-9 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-9 .chefcookie__group { width: 7.55%; }\n .chefcookie--bottombar .chefcookie__groups--count-8 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-8 .chefcookie__group { width: 9.00%; }\n .chefcookie--bottombar .chefcookie__groups--count-7 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-7 .chefcookie__group { width: 10.85%; }\n .chefcookie--bottombar .chefcookie__groups--count-6 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-6 .chefcookie__group { width: 13.33%; }\n .chefcookie--bottombar .chefcookie__groups--count-5 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-5 .chefcookie__group { width: 16.80%; }\n .chefcookie--bottombar .chefcookie__groups--count-4 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-4 .chefcookie__group { width: 22.00%; }\n .chefcookie--bottombar .chefcookie__groups--count-3 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-3 .chefcookie__group { width: 30.66%; }\n .chefcookie--bottombar .chefcookie__groups--count-2 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-2 .chefcookie__group { width: 48%; }\n .chefcookie--bottombar .chefcookie__groups--count-1 .chefcookie__group,\n .chefcookie--topbar .chefcookie__groups--count-1 .chefcookie__group { width: 100%; }\n @media screen and (max-width: 940px)\n {\n .chefcookie__button,\n .chefcookie__button:focus\n {\n float: none;\n margin: 0 0 1em;\n text-align: center;\n width: 100%;\n min-width:0;\n }\n }\n @media screen and (max-width: 840px)\n {\n .chefcookie__box\n {\n padding:1em;\n }\n .chefcookie__message h2\n {\n font-size:1.5em;\n line-height:1.4;\n }\n .chefcookie .chefcookie__group,\n .chefcookie--overlay .chefcookie__group,\n .chefcookie--bottombar .chefcookie__group,\n .chefcookie--topbar .chefcookie__group\n {\n float:none;\n margin-right:0;\n width:100% !important;\n height:auto;\n }\n }\n ");
394
-
395
335
  if ('css_replace' in this.config.style && this.config.style.css_replace !== undefined && this.config.style.css_replace !== null && this.config.style.css_replace !== '') {
396
336
  css = this.config.style.css_replace;
397
337
  }
398
-
399
338
  if ('css_add' in this.config.style && this.config.style.css_add !== undefined && this.config.style.css_add !== null && this.config.style.css_add !== '') {
400
339
  css += this.config.style.css_add;
401
340
  }
402
-
403
341
  document.head.insertAdjacentHTML('beforeend', '<style class="chefcookie-styles">' + css + '</style>');
404
342
  }
405
343
  }, {
406
344
  key: "addHtmlClasses",
407
345
  value: function addHtmlClasses() {
408
346
  document.documentElement.classList.add('chefcookie--visible');
409
-
410
347
  if (this.config.style.noscroll == true) {
411
348
  // preserve scroll position
412
349
  if (this.config.style.layout !== 'topbar') {
413
350
  this.scrollPosition = window.pageYOffset;
414
351
  document.body.style.top = -this.scrollPosition + 'px';
415
352
  }
416
-
417
353
  document.documentElement.classList.add('chefcookie--noscroll');
418
354
  }
419
-
420
355
  if (this.config.style.fade == true) {
421
356
  document.documentElement.classList.add('chefcookie--fade');
422
357
  }
423
-
424
358
  if (this.config.style.blur == true) {
425
359
  document.documentElement.classList.add('chefcookie--blur');
426
360
  }
@@ -429,7 +363,6 @@ var chefcookie = /*#__PURE__*/function () {
429
363
  key: "buildDom",
430
364
  value: function buildDom() {
431
365
  var _this5 = this;
432
-
433
366
  document.body.insertAdjacentHTML('afterbegin', "\n <div class=\"chefcookie chefcookie--".concat(this.config.style.layout, " chefcookie--columns-").concat('columns' in this.config.style ? this.config.style.columns : 'auto').concat('scripts_selection' in this.config && this.config.scripts_selection !== false ? " chefcookie--has-scripts" : "", " chefcookie--hidden\">\n <div class=\"chefcookie__inner\">\n <div class=\"chefcookie__box\">\n <div class=\"chefcookie__message\">").concat(this.translate(this.config.message), "</div>\n <div class=\"chefcookie__settings-container\">\n <ul class=\"chefcookie__groups chefcookie__groups--count-").concat(this.config.settings.length, "\">\n ").concat(this.config.settings.map(function (group, i) {
434
367
  return "\n <li class=\"chefcookie__group".concat(group.cannot_be_modified ? " chefcookie__group--disabled" : "", "\">\n <label class=\"chefcookie__group-label\" for=\"chefcookie_group_").concat(i, "\">\n <input").concat(group.cannot_be_modified ? " disabled=\"disabled\"" : "", " class=\"chefcookie__group-checkbox\" data-status=\"").concat(_this5.isCheckboxActiveForGroup(i), "\" id=\"chefcookie_group_").concat(i, "\" type=\"checkbox\" name=\"chefcookie_group[]\" value=\"").concat(i, "\"").concat(_this5.isCheckboxActiveForGroup(i) === 2 ? " checked=\"checked\"" : "", " />\n <span class=\"chefcookie__group-title\">").concat(_this5.translate(group.title), "</span>\n <span class=\"chefcookie__group-checkbox-icon\"></span>\n ").concat('description' in group && group.description != '' ? "\n <span class=\"chefcookie__group-description\">".concat(_this5.translate(group.description), "</span>\n ") : "", "\n ").concat('scripts_selection' in _this5.config && _this5.config.scripts_selection === 'collapse' && 'scripts' in group && Object.keys(group.scripts).length > 0 && Object.keys(group.scripts)[0].indexOf('dummy_') === -1 ? "\n <a href=\"#\" class=\"chefcookie__group-collapse\">".concat(_this5.getLabel('group_open') != '' ? _this5.getLabel('group_open') : _this5.getLabel('settings_open'), "</a>\n ") : "", "\n </label>\n ").concat('scripts_selection' in _this5.config && _this5.config.scripts_selection !== false && 'scripts' in group && Object.keys(group.scripts).length > 0 && Object.keys(group.scripts)[0].indexOf('dummy_') === -1 ? "\n <ul class=\"chefcookie__scripts chefcookie__scripts--count-".concat(Object.keys(group.scripts).length).concat(_this5.config.scripts_selection !== 'collapse' ? " chefcookie__scripts--visible" : "", "\">\n ").concat(Object.keys(group.scripts).map(function (j) {
435
368
  return "\n <li class=\"chefcookie__script".concat(group.cannot_be_modified ? " chefcookie__script--disabled" : "", "\">\n <label class=\"chefcookie__script-label\" for=\"chefcookie_script_").concat(i, "_").concat(j, "\">\n <input").concat(group.cannot_be_modified ? " disabled=\"disabled\"" : "", " class=\"chefcookie__script-checkbox\" id=\"chefcookie_script_").concat(i, "_").concat(j, "\" type=\"checkbox\" name=\"chefcookie_script[]\" value=\"").concat(i, "|").concat(j, "\"").concat(_this5.isCheckboxActiveForProvider(i, j) ? " checked=\"checked\"" : "", " />\n <span class=\"chefcookie__script-title\">").concat((0, _typeof2.default)(group.scripts[j]) === 'object' && group.scripts[j] !== null && 'title' in group.scripts[j] && group.scripts[j].title != '' ? _this5.translate(group.scripts[j].title) : j, "</span>\n <span class=\"chefcookie__script-checkbox-icon\"></span>\n </label>\n ").concat((0, _typeof2.default)(group.scripts[j]) === 'object' && group.scripts[j] !== null && 'description' in group.scripts[j] && group.scripts[j].description != '' ? '<div class="chefcookie__script-description">' + '<a href="#" class="chefcookie__script-description-collapse">' + _this5.getLabel('details_open') + '</a>' + '<div class="chefcookie__script-description-content">' + _this5.translate(group.scripts[j].description) + '</div>' + '</div>' : '', "\n </li>\n ");
@@ -442,87 +375,65 @@ var chefcookie = /*#__PURE__*/function () {
442
375
  if (this.config.labels[label] === undefined) {
443
376
  return '';
444
377
  }
445
-
446
378
  return this.translate(this.config.labels[label]);
447
379
  }
448
380
  }, {
449
381
  key: "bindButtons",
450
382
  value: function bindButtons() {
451
383
  var _this6 = this;
452
-
453
384
  if (document.querySelector('a[href="#chefcookie__decline"]') !== null) {
454
385
  [].forEach.call(document.querySelectorAll('a[href="#chefcookie__decline"]'), function (el) {
455
386
  _this6.registerEventListener(el, 'click', function (e) {
456
387
  _this6.logTracking('decline');
457
-
458
388
  _this6.uncheckAllOptIns();
459
-
460
389
  _this6.saveInCookie();
461
-
462
390
  _this6.close();
463
-
464
391
  _this6.setCookieToHideOverlay();
465
-
466
392
  _this6.updateOptOutOptIn();
467
-
468
393
  e.preventDefault();
469
394
  });
470
395
  });
471
396
  }
472
-
473
397
  if (document.querySelector('a[href="#chefcookie__accept"]') !== null) {
474
398
  [].forEach.call(document.querySelectorAll('a[href="#chefcookie__accept"]'), function (el) {
475
399
  _this6.registerEventListener(el, 'click', function (e) {
476
400
  if (_this6.isOpened === false) {
477
401
  return;
478
402
  }
479
-
480
403
  if (!('accept_all_if_settings_closed' in _this6.config) || _this6.config.accept_all_if_settings_closed === true) {
481
404
  if (!_this6.settingsVisible()) {
482
405
  _this6.checkAllOptIns();
483
406
  }
484
407
  }
485
-
486
408
  _this6.saveInCookie();
487
-
488
409
  _this6.addEnabledScripts(true);
489
-
490
410
  _this6.close();
491
-
492
411
  _this6.setCookieToHideOverlay();
493
-
494
412
  _this6.updateOptOutOptIn();
495
-
496
413
  e.preventDefault();
497
414
  });
498
415
  });
499
416
  }
500
-
501
417
  if (document.querySelector('a[href="#chefcookie__settings"]') !== null) {
502
418
  [].forEach.call(document.querySelectorAll('a[href="#chefcookie__settings"]'), function (el) {
503
419
  _this6.registerEventListener(el, 'click', function (e) {
504
420
  if (!_this6.settingsVisible()) {
505
421
  _this6.showSettings();
506
-
507
422
  _this6.switchSettingsLabelsOpen();
508
423
  } else {
509
424
  _this6.hideSettings();
510
-
511
425
  _this6.switchSettingsLabelsClose();
512
426
  }
513
-
514
427
  e.preventDefault();
515
428
  });
516
429
  });
517
430
  }
518
-
519
431
  if (document.querySelector('.chefcookie__script-checkbox') !== null) {
520
432
  [].forEach.call(document.querySelectorAll('.chefcookie__script-checkbox'), function (el) {
521
433
  _this6.registerEventListener(el, 'change', function (e) {
522
434
  var group_checkbox = el.closest('.chefcookie__group').querySelector('.chefcookie__group-checkbox'),
523
- c1 = el.closest('.chefcookie__group').querySelectorAll('.chefcookie__script-checkbox:checked').length,
524
- c2 = el.closest('.chefcookie__group').querySelectorAll('.chefcookie__script-checkbox').length;
525
-
435
+ c1 = el.closest('.chefcookie__group').querySelectorAll('.chefcookie__script-checkbox:checked').length,
436
+ c2 = el.closest('.chefcookie__group').querySelectorAll('.chefcookie__script-checkbox').length;
526
437
  if (c1 === c2) {
527
438
  group_checkbox.checked = true;
528
439
  group_checkbox.setAttribute('data-status', 2);
@@ -530,63 +441,49 @@ var chefcookie = /*#__PURE__*/function () {
530
441
  group_checkbox.checked = false;
531
442
  group_checkbox.setAttribute('data-status', c1 > 0 ? 1 : 0);
532
443
  }
533
-
534
444
  e.preventDefault();
535
445
  });
536
446
  });
537
447
  }
538
-
539
448
  if (document.querySelector('.chefcookie__group-checkbox') !== null) {
540
449
  [].forEach.call(document.querySelectorAll('.chefcookie__group-checkbox'), function (el) {
541
450
  _this6.registerEventListener(el, 'change', function (e) {
542
451
  el.setAttribute('data-status', el.checked ? 2 : 0);
543
-
544
452
  if (el.closest('.chefcookie__group').querySelector('.chefcookie__script-checkbox') !== null) {
545
453
  [].forEach.call(el.closest('.chefcookie__group').querySelectorAll('.chefcookie__script-checkbox'), function (el2) {
546
454
  el2.checked = el.checked;
547
455
  });
548
456
  }
549
-
550
457
  e.preventDefault();
551
458
  });
552
459
  });
553
460
  }
554
-
555
461
  if (document.querySelector('.chefcookie__group-collapse') !== null) {
556
462
  [].forEach.call(document.querySelectorAll('.chefcookie__group-collapse'), function (el) {
557
463
  _this6.registerEventListener(el, 'click', function (e) {
558
464
  var group = el.closest('.chefcookie__group');
559
-
560
465
  if (!_this6.scriptsVisible(group)) {
561
466
  _this6.showScripts(group);
562
-
563
467
  _this6.switchScriptsLabelsOpen(group);
564
468
  } else {
565
469
  _this6.hideScripts(group);
566
-
567
470
  _this6.switchScriptsLabelsClose(group);
568
471
  }
569
-
570
472
  e.preventDefault();
571
473
  });
572
474
  });
573
475
  }
574
-
575
476
  if (document.querySelector('.chefcookie__script-description-collapse') !== null) {
576
477
  [].forEach.call(document.querySelectorAll('.chefcookie__script-description-collapse'), function (el) {
577
478
  _this6.registerEventListener(el, 'click', function (e) {
578
479
  var desc = el.closest('.chefcookie__script-description');
579
-
580
480
  if (!_this6.scriptDescriptionVisible(desc)) {
581
481
  _this6.showScriptDescription(desc);
582
-
583
482
  _this6.switchScriptDescriptionLabelsOpen(desc);
584
483
  } else {
585
484
  _this6.hideScriptDescription(desc);
586
-
587
485
  _this6.switchScriptDescriptionLabelsClose(desc);
588
486
  }
589
-
590
487
  e.preventDefault();
591
488
  });
592
489
  });
@@ -596,7 +493,6 @@ var chefcookie = /*#__PURE__*/function () {
596
493
  key: "switchSettingsLabelsOpen",
597
494
  value: function switchSettingsLabelsOpen() {
598
495
  document.querySelector('.chefcookie__button--settings').textContent = this.getLabel('settings_close');
599
-
600
496
  if (this.config.accept_all_if_settings_closed === true) {
601
497
  document.querySelector('.chefcookie__button--accept').textContent = this.getLabel('accept');
602
498
  }
@@ -605,7 +501,6 @@ var chefcookie = /*#__PURE__*/function () {
605
501
  key: "switchSettingsLabelsClose",
606
502
  value: function switchSettingsLabelsClose() {
607
503
  document.querySelector('.chefcookie__button--settings').textContent = this.getLabel('settings_open');
608
-
609
504
  if (this.config.accept_all_if_settings_closed === true) {
610
505
  document.querySelector('.chefcookie__button--accept').textContent = this.getLabel('accept_all');
611
506
  }
@@ -648,11 +543,9 @@ var chefcookie = /*#__PURE__*/function () {
648
543
  key: "getCookieExpiration",
649
544
  value: function getCookieExpiration() {
650
545
  var expiration = 30;
651
-
652
546
  if ('expiration' in this.config && Number.isInteger(this.config.expiration)) {
653
547
  expiration = this.config.expiration;
654
548
  }
655
-
656
549
  return expiration;
657
550
  }
658
551
  }, {
@@ -687,39 +580,32 @@ var chefcookie = /*#__PURE__*/function () {
687
580
  key: "isCheckboxActiveForGroup",
688
581
  value: function isCheckboxActiveForGroup(group_index) {
689
582
  var _this7 = this;
690
-
691
583
  var group;
692
-
693
584
  if (this.config.settings[group_index] !== undefined) {
694
585
  group = this.config.settings[group_index];
695
586
  } else {
696
587
  return 0;
697
588
  }
698
-
699
589
  if ('scripts' in this.config.settings[group_index]) {
700
590
  var group_accepted = true,
701
- group_partly_accepted = false;
591
+ group_partly_accepted = false;
702
592
  Object.keys(group.scripts).forEach(function (provider) {
703
593
  if (!_this7.isAccepted(provider)) {
704
594
  group_accepted = false;
705
595
  }
706
-
707
596
  if (_this7.isAccepted(provider)) {
708
597
  group_partly_accepted = true;
709
598
  }
710
599
  });
711
-
712
600
  if (group_accepted === true) {
713
601
  return 2;
714
- } // if this already was opened (and potentially declined)
715
-
716
-
602
+ }
603
+ // if this already was opened (and potentially declined)
717
604
  if (this.isCookieSetToHideOverlay()) {
718
605
  return group_partly_accepted === true ? 1 : 0;
719
606
  }
720
- } // otherwise use default
721
-
722
-
607
+ }
608
+ // otherwise use default
723
609
  return group.checked_by_default || group.active ? 2 : 0;
724
610
  }
725
611
  }, {
@@ -727,19 +613,16 @@ var chefcookie = /*#__PURE__*/function () {
727
613
  value: function isCheckboxActiveForProvider(group_index, provider) {
728
614
  if (this.isAccepted(provider)) {
729
615
  return true;
730
- } // if this already was opened (and potentially declined)
731
-
732
-
616
+ }
617
+ // if this already was opened (and potentially declined)
733
618
  if (this.isCookieSetToHideOverlay()) {
734
619
  return false;
735
- } // otherwise use default
736
-
737
-
620
+ }
621
+ // otherwise use default
738
622
  if (this.config.settings[group_index] !== undefined) {
739
623
  var group = this.config.settings[group_index];
740
624
  return group.checked_by_default || group.active;
741
625
  }
742
-
743
626
  return false;
744
627
  }
745
628
  }, {
@@ -756,7 +639,6 @@ var chefcookie = /*#__PURE__*/function () {
756
639
  key: "saveInCookie",
757
640
  value: function saveInCookie() {
758
641
  var _this8 = this;
759
-
760
642
  var providers = [];
761
643
  [].forEach.call(document.querySelectorAll('.chefcookie__group-checkbox'), function (el) {
762
644
  if (el.closest('.chefcookie__group').querySelector('.chefcookie__script-checkbox') === null) {
@@ -764,9 +646,8 @@ var chefcookie = /*#__PURE__*/function () {
764
646
  if (_this8.config.settings[el.value].scripts !== undefined) {
765
647
  Object.entries(_this8.config.settings[el.value].scripts).forEach(function (_ref2) {
766
648
  var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
767
- scripts__key = _ref3[0],
768
- scripts__value = _ref3[1];
769
-
649
+ scripts__key = _ref3[0],
650
+ scripts__value = _ref3[1];
770
651
  providers.push(scripts__key);
771
652
  });
772
653
  }
@@ -781,24 +662,20 @@ var chefcookie = /*#__PURE__*/function () {
781
662
  });
782
663
  }
783
664
  });
784
-
785
665
  if (providers.length === 0) {
786
666
  providers.push('null');
787
667
  }
788
-
789
668
  this.setCookie('accepted_providers', providers.join(','));
790
669
  }
791
670
  }, {
792
671
  key: "addToCookie",
793
672
  value: function addToCookie(provider) {
794
673
  var providers;
795
-
796
674
  if (this.getCookie('accepted_providers') === undefined || this.getCookie('accepted_providers') === 'null') {
797
675
  providers = [];
798
676
  } else {
799
677
  providers = this.getCookie('accepted_providers').split(',');
800
678
  }
801
-
802
679
  if (providers.indexOf(provider) === -1) {
803
680
  providers.push(provider);
804
681
  this.setCookie('accepted_providers', providers.join(','));
@@ -810,14 +687,11 @@ var chefcookie = /*#__PURE__*/function () {
810
687
  if (this.getCookie('accepted_providers') === undefined) {
811
688
  return;
812
689
  }
813
-
814
690
  var providers = this.getCookie('accepted_providers').split(',');
815
691
  var index = providers.indexOf(provider);
816
-
817
692
  if (index !== -1) {
818
693
  providers.splice(index, 1);
819
694
  }
820
-
821
695
  if (providers.length > 0) {
822
696
  this.setCookie('accepted_providers', providers.join(','));
823
697
  } else {
@@ -828,37 +702,29 @@ var chefcookie = /*#__PURE__*/function () {
828
702
  key: "addEnabledScripts",
829
703
  value: function addEnabledScripts() {
830
704
  var _this9 = this;
831
-
832
705
  var isInit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
833
-
834
706
  if (this.getCookie('accepted_providers') === undefined) {
835
707
  return;
836
708
  }
837
-
838
709
  var settings = this.getCookie('accepted_providers');
839
-
840
710
  if (settings == 'null') {
841
711
  return;
842
712
  }
843
-
844
713
  var accept_all = true;
845
714
  this.config.settings.forEach(function (settings__value) {
846
715
  if (settings__value.scripts !== undefined) {
847
716
  Object.entries(settings__value.scripts).forEach(function (_ref4) {
848
717
  var _ref5 = (0, _slicedToArray2.default)(_ref4, 2),
849
- scripts__key = _ref5[0],
850
- scripts__value = _ref5[1];
851
-
718
+ scripts__key = _ref5[0],
719
+ scripts__value = _ref5[1];
852
720
  if (settings.split(',').indexOf(scripts__key) === -1) {
853
721
  accept_all = false;
854
722
  return;
855
723
  }
856
-
857
724
  _this9.load(scripts__key, scripts__value, isInit);
858
725
  });
859
726
  }
860
727
  });
861
-
862
728
  if (isInit === true) {
863
729
  this.logTracking(accept_all ? 'accept_all' : 'accept_partially', settings);
864
730
  }
@@ -867,34 +733,26 @@ var chefcookie = /*#__PURE__*/function () {
867
733
  key: "addScript",
868
734
  value: function addScript(provider) {
869
735
  var _this10 = this;
870
-
871
736
  var isInit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
872
-
873
737
  if (this.getCookie('accepted_providers') === undefined) {
874
738
  return;
875
739
  }
876
-
877
740
  var settings = this.getCookie('accepted_providers').split(',');
878
-
879
741
  if (settings === ['null']) {
880
742
  return;
881
743
  }
882
-
883
744
  this.config.settings.forEach(function (settings__value) {
884
745
  if (settings__value.scripts !== undefined) {
885
746
  Object.entries(settings__value.scripts).forEach(function (_ref6) {
886
747
  var _ref7 = (0, _slicedToArray2.default)(_ref6, 2),
887
- scripts__key = _ref7[0],
888
- scripts__value = _ref7[1];
889
-
748
+ scripts__key = _ref7[0],
749
+ scripts__value = _ref7[1];
890
750
  if (scripts__key !== provider) {
891
751
  return;
892
752
  }
893
-
894
753
  if (settings.indexOf(scripts__key) === -1) {
895
754
  return;
896
755
  }
897
-
898
756
  _this10.load(scripts__key, scripts__value, isInit);
899
757
  });
900
758
  }
@@ -904,14 +762,12 @@ var chefcookie = /*#__PURE__*/function () {
904
762
  key: "autoAcceptBasicScripts",
905
763
  value: function autoAcceptBasicScripts() {
906
764
  var _this11 = this;
907
-
908
765
  this.config.settings.forEach(function (settings__value) {
909
766
  if (settings__value.scripts !== undefined && settings__value.initial_tracking === true) {
910
767
  Object.entries(settings__value.scripts).forEach(function (_ref8) {
911
768
  var _ref9 = (0, _slicedToArray2.default)(_ref8, 2),
912
- scripts__key = _ref9[0],
913
- scripts__value = _ref9[1];
914
-
769
+ scripts__key = _ref9[0],
770
+ scripts__value = _ref9[1];
915
771
  _this11.accept(scripts__key, false);
916
772
  });
917
773
  }
@@ -921,15 +777,13 @@ var chefcookie = /*#__PURE__*/function () {
921
777
  key: "autoAcceptAllScripts",
922
778
  value: function autoAcceptAllScripts() {
923
779
  var _this12 = this;
924
-
925
780
  var providers = [];
926
781
  this.config.settings.forEach(function (settings__value) {
927
782
  if (settings__value.scripts !== undefined) {
928
783
  Object.entries(settings__value.scripts).forEach(function (_ref10) {
929
784
  var _ref11 = (0, _slicedToArray2.default)(_ref10, 2),
930
- scripts__key = _ref11[0],
931
- scripts__value = _ref11[1];
932
-
785
+ scripts__key = _ref11[0],
786
+ scripts__value = _ref11[1];
933
787
  _this12.accept(scripts__key, false);
934
788
  });
935
789
  }
@@ -939,13 +793,10 @@ var chefcookie = /*#__PURE__*/function () {
939
793
  key: "load",
940
794
  value: function load(provider, id) {
941
795
  var _this13 = this;
942
-
943
796
  var isInit = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
944
-
945
797
  if (this.isLoaded(provider)) {
946
798
  return;
947
799
  }
948
-
949
800
  if ((0, _typeof2.default)(id) === 'object' && id !== null) {
950
801
  if ('exclude' in id && typeof id.exclude === 'function') {
951
802
  if (id.exclude() === true) {
@@ -953,7 +804,6 @@ var chefcookie = /*#__PURE__*/function () {
953
804
  }
954
805
  }
955
806
  }
956
-
957
807
  if (typeof id === 'string' || id instanceof String) {
958
808
  this.loadAuto(provider, id);
959
809
  } else if ((0, _typeof2.default)(id) === 'object' && id !== null && 'id' in id && !('accept' in id)) {
@@ -967,85 +817,67 @@ var chefcookie = /*#__PURE__*/function () {
967
817
  } else {
968
818
  this.setLoaded(provider);
969
819
  }
970
-
971
820
  this.logDebug('added script ' + provider);
972
821
  }
973
822
  }, {
974
823
  key: "loadAuto",
975
824
  value: function loadAuto(provider, id) {
976
825
  var _this14 = this;
977
-
978
826
  if (provider === 'analytics' || provider === 'google') {
979
827
  var script = document.createElement('script');
980
-
981
828
  script.onload = function () {
982
829
  _this14.setLoaded(provider);
983
830
  };
984
-
985
831
  script.src = 'https://www.googletagmanager.com/gtag/js?id=' + id;
986
832
  document.head.appendChild(script);
987
833
  script = document.createElement('script');
988
834
  script.innerHTML = "window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', '" + id + "', { 'anonymize_ip': true, cookie_flags: 'SameSite=None;Secure' });";
989
835
  document.head.appendChild(script);
990
836
  }
991
-
992
837
  if (provider === 'tagmanager') {
993
838
  var _script = document.createElement('script');
994
-
995
839
  var html = '';
996
- html += "(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','" + id + "');"; // this is not part of the default tagmanager code, because events are tracked via "dataLayer" or directly inside tag manager
840
+ html += "(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','" + id + "');";
841
+ // this is not part of the default tagmanager code, because events are tracked via "dataLayer" or directly inside tag manager
997
842
  // we make this also available here
998
-
999
843
  html += 'function gtag(){dataLayer.push(arguments);}';
1000
844
  _script.innerHTML = html;
1001
845
  document.head.appendChild(_script);
1002
846
  this.setLoaded(provider);
1003
847
  }
1004
-
1005
848
  if (provider === 'facebook') {
1006
849
  var _script2 = document.createElement('script');
1007
-
1008
850
  _script2.innerHTML = "!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,document,'script','https://connect.facebook.net/en_US/fbevents.js');fbq('init', '" + id + "');fbq('track', 'PageView');fbq('track', 'ViewContent');";
1009
851
  document.head.appendChild(_script2);
1010
852
  this.setLoaded(provider);
1011
853
  }
1012
-
1013
854
  if (provider === 'twitter') {
1014
855
  var _script3 = document.createElement('script');
1015
-
1016
856
  _script3.onload = function () {
1017
857
  _this14.setLoaded(provider);
1018
858
  };
1019
-
1020
859
  _script3.src = '//platform.twitter.com/oct.js';
1021
860
  document.head.appendChild(_script3);
1022
861
  }
1023
-
1024
862
  if (provider === 'taboola') {
1025
863
  var _script4 = document.createElement('script');
1026
-
1027
864
  _script4.innerHTML = "window._tfa = window._tfa || [];window._tfa.push({notify: 'event', name: 'page_view'});!function (t, f, a, x) { if (!document.getElementById(x)) { t.async = 1;t.src = a;t.id=x;f.parentNode.insertBefore(t, f); } }(document.createElement('script'), document.getElementsByTagName('script')[0], '//cdn.taboola.com/libtrc/unip/" + id + "/tfa.js', 'tb_tfa_script');";
1028
865
  document.head.appendChild(_script4);
1029
866
  this.setLoaded(provider);
1030
867
  }
1031
-
1032
868
  if (provider === 'match2one') {
1033
869
  var _script5 = document.createElement('script');
1034
-
1035
870
  _script5.onload = function () {
1036
871
  _this14.setLoaded(provider);
1037
872
  };
1038
-
1039
873
  _script5.src = 'https://secure.adnxs.com/seg?add=' + id + '&t=1';
1040
874
  document.head.appendChild(_script5);
1041
875
  _script5 = document.createElement('script');
1042
876
  _script5.innerHTML = 'window.m2o = true;';
1043
877
  document.head.appendChild(_script5);
1044
878
  }
1045
-
1046
879
  if (provider === 'linkedin') {
1047
880
  var _script6 = document.createElement('script');
1048
-
1049
881
  _script6.innerHTML = "\n _linkedin_partner_id = \"".concat(id, "\";\n window._linkedin_data_partner_ids = window._linkedin_data_partner_ids || [];\n window._linkedin_data_partner_ids.push(_linkedin_partner_id);\n ");
1050
882
  document.body.appendChild(_script6);
1051
883
  _script6 = document.createElement('script');
@@ -1056,69 +888,50 @@ var chefcookie = /*#__PURE__*/function () {
1056
888
  document.body.appendChild(_script6);
1057
889
  this.setLoaded(provider);
1058
890
  }
1059
-
1060
891
  if (provider === 'smartlook') {
1061
892
  var _script7 = document.createElement('script');
1062
-
1063
893
  _script7.innerHTML = "window.smartlook||(function(d) {var o=smartlook=function(){ o.api.push(arguments)},h=d.getElementsByTagName('head')[0];var c=d.createElement('script');o.api=new Array();c.async=true;c.type='text/javascript';c.charset='utf-8';c.src='https://web-sdk.smartlook.com/recorder.js';h.appendChild(c);})(document);smartlook('init', '" + id + "', { region: 'eu' });";
1064
894
  document.head.appendChild(_script7);
1065
895
  this.setLoaded(provider);
1066
896
  }
1067
-
1068
897
  if (provider === 'crazyegg') {
1069
898
  var _script8 = document.createElement('script');
1070
-
1071
899
  _script8.onload = function () {
1072
900
  _this14.setLoaded(provider);
1073
901
  };
1074
-
1075
902
  _script8.src = '//script.crazyegg.com/pages/scripts/' + id + '.js';
1076
903
  document.head.appendChild(_script8);
1077
904
  }
1078
-
1079
905
  if (provider === 'google_maps') {
1080
906
  var _script9 = document.createElement('script');
1081
-
1082
907
  _script9.src = 'https://maps.googleapis.com/maps/api/js?key=' + id + '&callback=initMapCC';
1083
908
  _script9.defer = true;
1084
909
  _script9.async = true;
1085
-
1086
910
  window.initMapCC = function () {
1087
911
  _this14.setLoaded(provider);
1088
912
  };
1089
-
1090
913
  document.head.appendChild(_script9);
1091
914
  }
1092
-
1093
915
  if (provider === 'etracker') {
1094
916
  var _script10;
1095
-
1096
917
  _script10 = document.createElement('script');
1097
918
  _script10.innerHTML = "if(window._etr === undefined) { window._etr = {eoBlocked:true}; }";
1098
919
  document.head.appendChild(_script10);
1099
920
  _script10 = document.createElement('script');
1100
-
1101
921
  _script10.onload = function () {
1102
922
  _this14.setLoaded(provider);
1103
923
  };
1104
-
1105
924
  _script10.id = '_etLoader';
1106
925
  _script10.type = 'text/javascript';
1107
926
  _script10.charset = 'UTF-8';
1108
-
1109
927
  _script10.setAttribute('data-block-cookies', 'true');
1110
-
1111
928
  _script10.setAttribute('data-respect-dnt', 'true');
1112
-
1113
929
  _script10.setAttribute('data-secure-code', id);
1114
-
1115
930
  _script10.src = '//static.etracker.com/code/e.js';
1116
931
  document.head.appendChild(_script10);
1117
932
  }
1118
-
1119
933
  if (provider === 'matomo') {
1120
934
  var _script11 = document.createElement('script');
1121
-
1122
935
  _script11.innerHTML = "\n var _paq = window._paq = window._paq || [];\n /* tracker methods like \"setCustomDimension\" should be called before \"trackPageView\" */\n _paq.push(['trackPageView']);\n _paq.push(['enableLinkTracking']);\n (function() {\n var u=\"//".concat(id.split('#')[0], "/\";\n _paq.push(['setTrackerUrl', u+'matomo.php']);\n _paq.push(['setSiteId', '").concat(id.split('#')[1], "']);\n var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];\n g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);\n })();\n ");
1123
936
  document.head.appendChild(_script11);
1124
937
  this.setLoaded(provider);
@@ -1130,7 +943,6 @@ var chefcookie = /*#__PURE__*/function () {
1130
943
  if (this.getCookie('accepted_providers') === undefined) {
1131
944
  return false;
1132
945
  }
1133
-
1134
946
  return this.getCookie('accepted_providers').split(',').indexOf(provider) > -1;
1135
947
  }
1136
948
  }, {
@@ -1240,7 +1052,6 @@ var chefcookie = /*#__PURE__*/function () {
1240
1052
  if (typeof gtag != 'function') {
1241
1053
  return;
1242
1054
  }
1243
-
1244
1055
  if (action === undefined) {
1245
1056
  gtag('event', category);
1246
1057
  this.logDebug('analytics ' + category);
@@ -1262,7 +1073,6 @@ var chefcookie = /*#__PURE__*/function () {
1262
1073
  if (typeof fbq != 'function') {
1263
1074
  return;
1264
1075
  }
1265
-
1266
1076
  fbq('trackCustom', action);
1267
1077
  this.logDebug('facebook ' + action);
1268
1078
  }
@@ -1272,7 +1082,6 @@ var chefcookie = /*#__PURE__*/function () {
1272
1082
  if (typeof twttr == 'undefined' || typeof twttr.conversion == 'undefined' || typeof twttr.conversion.trackPid != 'function') {
1273
1083
  return;
1274
1084
  }
1275
-
1276
1085
  twttr.conversion.trackPid(action);
1277
1086
  this.logDebug('twitter ' + action);
1278
1087
  }
@@ -1282,12 +1091,10 @@ var chefcookie = /*#__PURE__*/function () {
1282
1091
  if ((typeof _tfa === "undefined" ? "undefined" : (0, _typeof2.default)(_tfa)) != 'object') {
1283
1092
  return;
1284
1093
  }
1285
-
1286
1094
  _tfa.push({
1287
1095
  notify: 'event',
1288
1096
  name: event
1289
1097
  });
1290
-
1291
1098
  this.logDebug('taboola ' + event);
1292
1099
  }
1293
1100
  }, {
@@ -1296,7 +1103,6 @@ var chefcookie = /*#__PURE__*/function () {
1296
1103
  if (typeof m2o == 'undefined') {
1297
1104
  return;
1298
1105
  }
1299
-
1300
1106
  var script = document.createElement('script');
1301
1107
  script.src = 'https://secure.adnxs.com/px?' + id + '&t=1';
1302
1108
  document.head.appendChild(script);
@@ -1314,14 +1120,11 @@ var chefcookie = /*#__PURE__*/function () {
1314
1120
  if (typeof _etracker == 'undefined') {
1315
1121
  return;
1316
1122
  }
1317
-
1318
1123
  if (action === undefined) {
1319
1124
  _etracker.sendEvent(new et_UserDefinedEvent(null, null, category, null));
1320
-
1321
1125
  this.logDebug('etracker ' + category);
1322
1126
  } else {
1323
1127
  _etracker.sendEvent(new et_UserDefinedEvent(null, category, action, null));
1324
-
1325
1128
  this.logDebug('etracker ' + category + ' ' + action);
1326
1129
  }
1327
1130
  }
@@ -1329,21 +1132,17 @@ var chefcookie = /*#__PURE__*/function () {
1329
1132
  key: "trackDuration",
1330
1133
  value: function trackDuration() {
1331
1134
  var _this = this,
1332
- timer = 30;
1333
-
1135
+ timer = 30;
1334
1136
  while (timer / 60 <= 8) {
1335
1137
  (function (timer) {
1336
1138
  window.setTimeout(function () {
1337
1139
  if (this.isDestroyed === true) {
1338
1140
  return;
1339
1141
  }
1340
-
1341
1142
  _this.eventAnalytics('duration_time', timer + 's');
1342
-
1343
1143
  _this.eventEtracker('duration_time', timer + 's');
1344
1144
  }, timer * 1000);
1345
1145
  })(timer);
1346
-
1347
1146
  timer += 30;
1348
1147
  }
1349
1148
  }
@@ -1356,18 +1155,14 @@ var chefcookie = /*#__PURE__*/function () {
1356
1155
  key: "trackScrollDepth",
1357
1156
  value: function trackScrollDepth() {
1358
1157
  var _this15 = this;
1359
-
1360
1158
  this.eventAnalytics('scroll_depth', '0%');
1361
1159
  this.eventEtracker('scroll_depth', '0%');
1362
1160
  this.registerEventListener(window, 'scroll', function () {
1363
1161
  var scroll = _this15.scrollPos();
1364
-
1365
1162
  for (var scrollDepthTriggered__key in _this15.scrollDepthTriggered) {
1366
1163
  if (_this15.scrollDepthTriggered[scrollDepthTriggered__key] === false && scroll >= scrollDepthTriggered__key) {
1367
1164
  _this15.scrollDepthTriggered[scrollDepthTriggered__key] = true;
1368
-
1369
1165
  _this15.eventAnalytics('scroll_depth', scrollDepthTriggered__key + '%');
1370
-
1371
1166
  _this15.eventEtracker('scroll_depth', scrollDepthTriggered__key + '%');
1372
1167
  }
1373
1168
  }
@@ -1394,10 +1189,8 @@ var chefcookie = /*#__PURE__*/function () {
1394
1189
  key: "trackScrollDepthCustom",
1395
1190
  value: function trackScrollDepthCustom(percent, callback) {
1396
1191
  var _this16 = this;
1397
-
1398
1192
  this.registerEventListener(window, 'scroll', function () {
1399
1193
  var scroll = _this16.scrollPos();
1400
-
1401
1194
  if (_this16.scrollDepthTriggeredOnce === false && scroll >= percent) {
1402
1195
  _this16.scrollDepthTriggeredOnce = true;
1403
1196
  callback();
@@ -1408,26 +1201,23 @@ var chefcookie = /*#__PURE__*/function () {
1408
1201
  key: "scrollPos",
1409
1202
  value: function scrollPos() {
1410
1203
  var scrollTop = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop,
1411
- documentHeight = Math.max(document.body.offsetHeight, document.body.scrollHeight, document.documentElement.clientHeight, document.documentElement.offsetHeight, document.documentElement.scrollHeight),
1412
- windowHeight = window.innerHeight,
1413
- scroll = Math.round(scrollTop / (documentHeight - windowHeight) * 100);
1204
+ documentHeight = Math.max(document.body.offsetHeight, document.body.scrollHeight, document.documentElement.clientHeight, document.documentElement.offsetHeight, document.documentElement.scrollHeight),
1205
+ windowHeight = window.innerHeight,
1206
+ scroll = Math.round(scrollTop / (documentHeight - windowHeight) * 100);
1414
1207
  return scroll;
1415
1208
  }
1416
1209
  }, {
1417
1210
  key: "waitFor",
1418
1211
  value: function waitFor(provider) {
1419
1212
  var _this17 = this;
1420
-
1421
1213
  var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1422
1214
  return new Promise(function (resolve, reject) {
1423
1215
  var timeout = setInterval(function () {
1424
1216
  if (_this17.isLoaded(provider)) {
1425
1217
  window.clearInterval(timeout);
1426
-
1427
1218
  if (callback !== null && typeof callback === 'function') {
1428
1219
  callback();
1429
1220
  }
1430
-
1431
1221
  resolve();
1432
1222
  }
1433
1223
  }, 1000);
@@ -1437,25 +1227,20 @@ var chefcookie = /*#__PURE__*/function () {
1437
1227
  key: "loadJs",
1438
1228
  value: function loadJs(urls) {
1439
1229
  var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1440
-
1441
1230
  if (typeof urls === 'string' || urls instanceof String) {
1442
1231
  urls = [urls];
1443
1232
  }
1444
-
1445
1233
  var promises = [];
1446
1234
  urls.forEach(function (urls__value) {
1447
1235
  promises.push(new Promise(function (resolve, reject) {
1448
1236
  var script = document.createElement('script');
1449
1237
  script.src = urls__value;
1450
-
1451
1238
  script.onload = function () {
1452
1239
  resolve();
1453
1240
  };
1454
-
1455
1241
  document.head.appendChild(script);
1456
1242
  }));
1457
1243
  });
1458
-
1459
1244
  if (callback !== null && typeof callback === 'function') {
1460
1245
  Promise.all(promises).then(function () {
1461
1246
  callback();
@@ -1470,24 +1255,19 @@ var chefcookie = /*#__PURE__*/function () {
1470
1255
  if (typeof obj === 'string' || obj instanceof String) {
1471
1256
  return obj;
1472
1257
  }
1473
-
1474
1258
  var lng = this.lng();
1475
-
1476
1259
  if (!(lng in obj)) {
1477
1260
  return Object.values(obj)[0];
1478
1261
  }
1479
-
1480
1262
  return obj[lng];
1481
1263
  }
1482
1264
  }, {
1483
1265
  key: "lng",
1484
1266
  value: function lng() {
1485
1267
  var lng = 'en';
1486
-
1487
1268
  if (document.documentElement.hasAttribute('lang')) {
1488
1269
  lng = document.documentElement.getAttribute('lang').substring(0, 2).toLowerCase();
1489
1270
  }
1490
-
1491
1271
  return lng;
1492
1272
  }
1493
1273
  }, {
@@ -1512,29 +1292,23 @@ var chefcookie = /*#__PURE__*/function () {
1512
1292
  var l = 0;
1513
1293
  var i = 0;
1514
1294
  str += '';
1515
-
1516
1295
  if (charlist) {
1517
1296
  whitespace = (charlist + '').replace(/([[\]().?/*{}+$^:])/g, '$1');
1518
1297
  }
1519
-
1520
1298
  l = str.length;
1521
-
1522
1299
  for (i = 0; i < l; i++) {
1523
1300
  if (whitespace.indexOf(str.charAt(i)) === -1) {
1524
1301
  str = str.substring(i);
1525
1302
  break;
1526
1303
  }
1527
1304
  }
1528
-
1529
1305
  l = str.length;
1530
-
1531
1306
  for (i = l - 1; i >= 0; i--) {
1532
1307
  if (whitespace.indexOf(str.charAt(i)) === -1) {
1533
1308
  str = str.substring(0, i + 1);
1534
1309
  break;
1535
1310
  }
1536
1311
  }
1537
-
1538
1312
  return whitespace.indexOf(str.charAt(0)) === -1 ? str : '';
1539
1313
  }
1540
1314
  }, {
@@ -1542,7 +1316,6 @@ var chefcookie = /*#__PURE__*/function () {
1542
1316
  value: function accept(provider) {
1543
1317
  var isInit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
1544
1318
  this.addToCookie(provider);
1545
-
1546
1319
  if (!this.isExcluded()) {
1547
1320
  this.addScript(provider, isInit);
1548
1321
  }
@@ -1558,7 +1331,6 @@ var chefcookie = /*#__PURE__*/function () {
1558
1331
  if (!('debug_log' in this.config) || this.config.debug_log !== true) {
1559
1332
  return;
1560
1333
  }
1561
-
1562
1334
  console.log(msg);
1563
1335
  }
1564
1336
  }, {
@@ -1570,14 +1342,12 @@ var chefcookie = /*#__PURE__*/function () {
1570
1342
  key: "logTracking",
1571
1343
  value: function logTracking(action) {
1572
1344
  var providers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
1573
-
1574
1345
  if (!this.logTrackingActive()) {
1575
1346
  return;
1576
1347
  }
1577
-
1578
1348
  var xhr = new XMLHttpRequest(),
1579
- data = null,
1580
- url = (this.config.consent_tracking.indexOf('//') === -1 ? this.trim(this.urlBase(), '/') : '') + '/' + this.trim(this.config.consent_tracking, '/');
1349
+ data = null,
1350
+ url = (this.config.consent_tracking.indexOf('//') === -1 ? this.trim(this.urlBase(), '/') : '') + '/' + this.trim(this.config.consent_tracking, '/');
1581
1351
  data = {
1582
1352
  action: action,
1583
1353
  date: new Date().getFullYear() + '-' + ('0' + (new Date().getMonth() + 1)).slice(-2) + '-' + ('0' + new Date().getDate()).slice(-2) + ' ' + ('0' + new Date().getHours()).slice(-2) + ':' + ('0' + new Date().getMinutes()).slice(-2) + ':' + ('0' + new Date().getSeconds()).slice(-2),
@@ -1593,19 +1363,15 @@ var chefcookie = /*#__PURE__*/function () {
1593
1363
  key: "trackFirstUserInteraction",
1594
1364
  value: function trackFirstUserInteraction() {
1595
1365
  var _this18 = this;
1596
-
1597
1366
  if (!this.logTrackingActive()) {
1598
1367
  return;
1599
1368
  }
1600
-
1601
1369
  ['mousedown', 'mousemove', 'keydown', 'scroll', 'touchstart', 'click'].forEach(function (eventName) {
1602
1370
  document.addEventListener(eventName, function () {
1603
1371
  if (_this18.first_user_interaction === true) {
1604
1372
  return;
1605
1373
  }
1606
-
1607
1374
  _this18.first_user_interaction = true;
1608
-
1609
1375
  _this18.logTracking('first_user_interaction');
1610
1376
  }, true);
1611
1377
  });
@@ -1628,16 +1394,13 @@ var chefcookie = /*#__PURE__*/function () {
1628
1394
  key: "hexToRgbaStr",
1629
1395
  value: function hexToRgbaStr(hex, opacity) {
1630
1396
  var rgb = this.hexToRgb(hex);
1631
-
1632
1397
  if (rgb === null) {
1633
1398
  return '';
1634
1399
  }
1635
-
1636
1400
  return 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + opacity + ')';
1637
1401
  }
1638
1402
  }]);
1639
1403
  return chefcookie;
1640
1404
  }();
1641
-
1642
1405
  exports.default = chefcookie;
1643
1406
  window.chefcookie = chefcookie;