diff --git a/bin/index.js b/bin/index.js index 788e381..cef9aa1 100644 --- a/bin/index.js +++ b/bin/index.js @@ -1,15 +1,15 @@ -!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},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 o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},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=18)}([function(e,t,n){"use strict";var o,r;Object.defineProperty(t,"__esModule",{value:!0}),t.SELECT_TAB_SCOPE=t.SELECT_COOKIE_MODAL_DETAIL_CONTENT=t.SELECT_VISIBILITY_SCOPE=t.SELECT_COOKIE_SETTINGS=t.SET_TAB_SCOPE_CONTACT=t.SET_TAB_SCOPE_PRIVACY=t.SET_TAB_SCOPE_PREFERENCES=t.LOAD_COOKIE_VALUE_TO_STATE=t.UPDATE_COOKIE_SETTING_VALUE=t.SET_VISIBILITY_SCOPE_TO_NOTIFICATION=t.SET_VISIBILITY_SCOPE_TO_COOKIE_PAGE_PREFERENCES=t.SET_VISIBILITY_SCOPE_TO_COOKIE_PAGE_PRIVACY=t.SET_VISIBILITY_SCOPE_TO_COOKIE_MODAL_DETAIL=t.SET_VISIBILITY_SCOPE_TO_COOKIE_MODAL_CONTACT=t.SET_VISIBILITY_SCOPE_TO_COOKIE_MODAL_PREFERENCES=t.SET_VISIBILITY_SCOPE_TO_COOKIE_MODAL_PRIVACY=t.SET_VISIBILITY_SCOPE_TO_COOKIE_MODAL=t.SET_VISIBILITY_SCOPE_TO_COOKIE_BAR=t.SET_VISIBILITY_SCOPE_TO_NONE=void 0;var i=Object.assign||function(e){for(var t=1;t=0?(null!==this.previousVisibilityScope&&this.hide(this.previousVisibilityScope),this.show(e)):(this.hide(this.previousVisibilityScope),this.removeAllEventListeners(),this.hasEventsConfigured=!1)),this.hasEventsConfigured||this.addAllEventListeners(),this.previousVisibilityScope=e.visibilityScope}},{key:"addAllEventListeners",value:function(){var e=this;Object.keys(this.boundEventListeners).forEach(function(t){e.vdom.addEventListener(t,e.boundEventListeners[t])}),this.hasEventsConfigured=!0}},{key:"removeAllEventListeners",value:function(){var e=this;Object.keys(this.boundEventListeners).forEach(function(t){e.vdom.removeEventListener(t,e.boundEventListeners[t])})}},{key:"show",value:function(e){var t=this,n=e.visibilityScope,o=this.configuration.visibilityScopes[n];Array.isArray(o)&&o.forEach(function(e){t.vdom.classList.add(e)})}},{key:"hide",value:function(e){var t=this,n=this.configuration.visibilityScopes[e];Array.isArray(n)&&n.length>0&&n.forEach(function(e){t.vdom.classList.remove(e)})}}]),e}();t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.VISIBILITY_SCOPE_NONE="VISIBILITY_SCOPE_NONE",t.COOKIE_BAR_VISIBILITY_SCOPE="COOKIE_BAR_VISIBILITY_SCOPE",t.COOKIE_MODAL_VISIBILITY_SCOPE="COOKIE_MODAL_VISIBILITY_SCOPE",t.NOTIFICATION_VISIBILITY_SCOPE="NOTIFICATION_VISIBILITY_SCOPE",t.TAB_SCOPE_PREFERENCES="legal_cookie_preferences",t.TAB_SCOPE_PRIVACY="legal_privacy_policy",t.TAB_SCOPE_CONTACT="legal_contact",t.COOKIE_MODAL_VISIBILITY_SCOPE_DETAIL="COOKIE_MODAL_VISIBILITY_SCOPE_DETAIL"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],o=!0,r=!1,i=void 0;try{for(var c,a=e[Symbol.iterator]();!(o=(c=a.next()).done)&&(n.push(c.value),!t||n.length!==t);o=!0);}catch(e){r=!0,i=e}finally{try{!o&&a.return&&a.return()}finally{if(r)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var n=0;n0&&(o+="&"),o+=e+"="+n[e]}),(0,c.post)(t,o).then(function(){e.sendActivateCookiesEventToGTM()})}},{key:"sendActivateCookiesEventToGTM",value:function(){var e=_();u.default.sendEnableCookieEvent(e)}}]),e}();function _(){return Object.prototype.hasOwnProperty.call(f.get(),s)?JSON.parse(f.get()[s]).cookies:(0,l.select)(l.SELECT_COOKIE_SETTINGS)}t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(25);Object.defineProperty(t,"querySelectorAllArray",{enumerable:!0,get:function(){return o.querySelectorAllArray}});var r=n(26);Object.defineProperty(t,"getBackToBasicModalVisibilityScope",{enumerable:!0,get:function(){return r.getBackToBasicModalVisibilityScope}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.get=function(e){if(e&&"string"==typeof e&&""!==e)return new o(function(t,n){var o=new XMLHttpRequest;o.onload=function(){return o.status>=200&&o.status<400?t(o):n(Error(o.statusText))},o.onerror=function(e){n(Error("Network Error: "+e))},o.open("GET",e),o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.send()});throw new Error("url parameter cannot be empty and must be of type string")},t.post=function(e,t){if(e&&"string"==typeof e&&""!==e)return new o(function(n,o){var r=new XMLHttpRequest;r.onload=function(){return 200===r.status?n(r):o(Error(r.statusText))},r.onerror=function(e){o(Error("Network Error: "+e))},r.open("POST",e),r.setRequestHeader("X-Requested-With","XMLHttpRequest"),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.send(t)});throw new Error("url parameter cannot be empty and must be of type string")};var o="undefined"==typeof Promise?n(7).Promise:Promise},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.COLLAPSIBLE_CONTENT_IDENTIFIER=".js-kmcc-collapsible-content",t.CONTENT_IDENTIFIER=".js-kmcc-collapsible-content__content",t.TITLE_IDENTIFIER=".js-kmcc-collapsible-content__title",t.CLASSES={OPEN:"open"},t.STATES={STATE_OPEN:"open",STATE_CLOSED:"closed"},t.BREAKPOINT=767},function(e,t,n){(function(t,n){ +!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},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 o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},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=18)}([function(e,t,n){"use strict";var o,r;Object.defineProperty(t,"__esModule",{value:!0}),t.SELECT_TAB_SCOPE=t.SELECT_COOKIE_MODAL_DETAIL_CONTENT=t.SELECT_VISIBILITY_SCOPE=t.SELECT_COOKIE_SETTINGS=t.SET_TAB_SCOPE_CONTACT=t.SET_TAB_SCOPE_PRIVACY=t.SET_TAB_SCOPE_PREFERENCES=t.LOAD_COOKIE_VALUE_TO_STATE=t.UPDATE_COOKIE_SETTING_VALUE=t.SET_VISIBILITY_SCOPE_TO_NOTIFICATION=t.SET_VISIBILITY_SCOPE_TO_COOKIE_PAGE_PREFERENCES=t.SET_VISIBILITY_SCOPE_TO_COOKIE_PAGE_PRIVACY=t.SET_VISIBILITY_SCOPE_TO_COOKIE_MODAL_DETAIL=t.SET_VISIBILITY_SCOPE_TO_COOKIE_MODAL_CONTACT=t.SET_VISIBILITY_SCOPE_TO_COOKIE_MODAL_PREFERENCES=t.SET_VISIBILITY_SCOPE_TO_COOKIE_MODAL_PRIVACY=t.SET_VISIBILITY_SCOPE_TO_COOKIE_MODAL=t.SET_VISIBILITY_SCOPE_TO_COOKIE_BAR=t.SET_VISIBILITY_SCOPE_TO_NONE=void 0;var i=Object.assign||function(e){for(var t=1;t=0?(null!==this.previousVisibilityScope&&this.hide(this.previousVisibilityScope),this.show(e)):(this.hide(this.previousVisibilityScope),this.removeAllEventListeners(),this.hasEventsConfigured=!1)),this.hasEventsConfigured||this.addAllEventListeners(),this.previousVisibilityScope=e.visibilityScope}},{key:"addAllEventListeners",value:function(){var e=this;Object.keys(this.boundEventListeners).forEach(function(t){e.vdom.addEventListener(t,e.boundEventListeners[t])}),this.hasEventsConfigured=!0}},{key:"removeAllEventListeners",value:function(){var e=this;Object.keys(this.boundEventListeners).forEach(function(t){e.vdom.removeEventListener(t,e.boundEventListeners[t])})}},{key:"show",value:function(e){var t=this,n=e.visibilityScope,o=this.configuration.visibilityScopes[n];Array.isArray(o)&&o.forEach(function(e){t.vdom.classList.add(e)})}},{key:"hide",value:function(e){var t=this,n=this.configuration.visibilityScopes[e];Array.isArray(n)&&n.length>0&&n.forEach(function(e){t.vdom.classList.remove(e)})}}]),e}();t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.VISIBILITY_SCOPE_NONE="VISIBILITY_SCOPE_NONE",t.COOKIE_BAR_VISIBILITY_SCOPE="COOKIE_BAR_VISIBILITY_SCOPE",t.COOKIE_MODAL_VISIBILITY_SCOPE="COOKIE_MODAL_VISIBILITY_SCOPE",t.NOTIFICATION_VISIBILITY_SCOPE="NOTIFICATION_VISIBILITY_SCOPE",t.TAB_SCOPE_PREFERENCES="legal_cookie_preferences",t.TAB_SCOPE_PRIVACY="legal_privacy_policy",t.TAB_SCOPE_CONTACT="legal_contact",t.COOKIE_MODAL_VISIBILITY_SCOPE_DETAIL="COOKIE_MODAL_VISIBILITY_SCOPE_DETAIL"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(25);Object.defineProperty(t,"querySelectorAllArray",{enumerable:!0,get:function(){return o.querySelectorAllArray}});var r=n(26);Object.defineProperty(t,"getBackToBasicModalVisibilityScope",{enumerable:!0,get:function(){return r.getBackToBasicModalVisibilityScope}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],o=!0,r=!1,i=void 0;try{for(var c,a=e[Symbol.iterator]();!(o=(c=a.next()).done)&&(n.push(c.value),!t||n.length!==t);o=!0);}catch(e){r=!0,i=e}finally{try{!o&&a.return&&a.return()}finally{if(r)throw i}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var n=0;n0&&(o+="&"),o+=e+"="+n[e]}),(0,c.post)(t,o).then(function(){e.sendActivateCookiesEventToGTM()})}},{key:"sendActivateCookiesEventToGTM",value:function(){var e=_();u.default.sendEnableCookieEvent(e)}}]),e}();function _(){return Object.prototype.hasOwnProperty.call(f.get(),s)?JSON.parse(f.get()[s]).cookies:(0,l.select)(l.SELECT_COOKIE_SETTINGS)}t.default=f},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.get=function(e){if(e&&"string"==typeof e&&""!==e)return new o(function(t,n){var o=new XMLHttpRequest;o.onload=function(){return o.status>=200&&o.status<400?t(o):n(Error(o.statusText))},o.onerror=function(e){n(Error("Network Error: "+e))},o.open("GET",e),o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.send()});throw new Error("url parameter cannot be empty and must be of type string")},t.post=function(e,t){if(e&&"string"==typeof e&&""!==e)return new o(function(n,o){var r=new XMLHttpRequest;r.onload=function(){return 200===r.status?n(r):o(Error(r.statusText))},r.onerror=function(e){o(Error("Network Error: "+e))},r.open("POST",e),r.setRequestHeader("X-Requested-With","XMLHttpRequest"),r.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),r.send(t)});throw new Error("url parameter cannot be empty and must be of type string")};var o="undefined"==typeof Promise?n(8).Promise:Promise},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.COLLAPSIBLE_CONTENT_IDENTIFIER=".js-kmcc-collapsible-content",t.CONTENT_IDENTIFIER=".js-kmcc-collapsible-content__content",t.TITLE_IDENTIFIER=".js-kmcc-collapsible-content__title",t.CLASSES={OPEN:"open"},t.STATES={STATE_OPEN:"open",STATE_CLOSED:"closed"},t.BREAKPOINT=767},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.TOGGLE_BUTTON_CLASS_IDENTIFIER=".js-kmcc-btn-toggle"},function(e,t,n){(function(t,n){ /*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) * @license Licensed under MIT license * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.4+314e4831 - */var o;o=function(){"use strict";function e(e){return"function"==typeof e}var o=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r=0,i=void 0,c=void 0,a=function(e,t){d[r]=e,d[r+1]=t,2===(r+=2)&&(c?c(E):T())},u="undefined"!=typeof window?window:void 0,l=u||{},s=l.MutationObserver||l.WebKitMutationObserver,f="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),_="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var e=setTimeout;return function(){return e(E,1)}}var d=new Array(1e3);function E(){for(var e=0;e1?1:u,n=.5*(1-Math.cos(Math.PI*a)),o=t.startX+(t.x-t.startX)*n,i=t.startY+(t.y-t.startY)*n,t.method.call(t.scrollable,o,i),o===t.x&&i===t.y||e.requestAnimationFrame(p.bind(e,t))}function d(n,o,r){var a,l,s,f,_=c();n===t.body?(a=e,l=e.scrollX||e.pageXOffset,s=e.scrollY||e.pageYOffset,f=i.scroll):(a=n,l=n.scrollLeft,s=n.scrollTop,f=u),p({scrollable:a,method:f,startTime:_,startX:l,startY:s,x:o,y:r})}}}}()},function(e,t){ + */var o;o=function(){"use strict";function e(e){return"function"==typeof e}var o=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},r=0,i=void 0,c=void 0,a=function(e,t){d[r]=e,d[r+1]=t,2===(r+=2)&&(c?c(E):T())},u="undefined"!=typeof window?window:void 0,l=u||{},s=l.MutationObserver||l.WebKitMutationObserver,f="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),_="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function p(){var e=setTimeout;return function(){return e(E,1)}}var d=new Array(1e3);function E(){for(var e=0;e1?1:u,n=.5*(1-Math.cos(Math.PI*a)),o=t.startX+(t.x-t.startX)*n,i=t.startY+(t.y-t.startY)*n,t.method.call(t.scrollable,o,i),o===t.x&&i===t.y||e.requestAnimationFrame(p.bind(e,t))}function d(n,o,r){var a,l,s,f,_=c();n===t.body?(a=e,l=e.scrollX||e.pageXOffset,s=e.scrollY||e.pageYOffset,f=i.scroll):(a=n,l=n.scrollLeft,s=n.scrollTop,f=u),p({scrollable:a,method:f,startTime:_,startX:l,startY:s,x:o,y:r})}}}}()},function(e,t){ /*! * @copyright Copyright (c) 2017 IcoMoon.io * @license Licensed under MIT license * See https://github.com/Keyamoon/svgxuse * @version 1.2.6 */ -!function(){"use strict";if("undefined"!=typeof window&&window.addEventListener){var e,t,n,o=Object.create(null),r=function(){clearTimeout(t),t=setTimeout(e,100)},i=function(){},c=function(){var e;window.addEventListener("resize",r,!1),window.addEventListener("orientationchange",r,!1),window.MutationObserver?((e=new MutationObserver(r)).observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}),i=function(){try{e.disconnect(),window.removeEventListener("resize",r,!1),window.removeEventListener("orientationchange",r,!1)}catch(e){}}):(document.documentElement.addEventListener("DOMSubtreeModified",r,!1),i=function(){document.documentElement.removeEventListener("DOMSubtreeModified",r,!1),window.removeEventListener("resize",r,!1),window.removeEventListener("orientationchange",r,!1)})},a=function(e){function t(e){var t;return void 0!==e.protocol?t=e:(t=document.createElement("a")).href=e,t.protocol.replace(/:/g,"")+t.host}var n,o,r;return window.XMLHttpRequest&&(n=new XMLHttpRequest,o=t(location),r=t(e),n=void 0===n.withCredentials&&""!==r&&r!==o?XDomainRequest||void 0:XMLHttpRequest),n},u="http://www.w3.org/1999/xlink";e=function(){var e,t,n,r,l,s,f,_,p,d,E=0;function O(){0===(E-=1)&&(i(),c())}function I(e){return function(){!0!==o[e.base]&&(e.useEl.setAttributeNS(u,"xlink:href","#"+e.hash),e.useEl.hasAttribute("href")&&e.useEl.setAttribute("href","#"+e.hash))}}function v(e){return function(){var t,n=document.body,o=document.createElement("x");e.onload=null,o.innerHTML=e.responseText,(t=o.getElementsByTagName("svg")[0])&&(t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.width=0,t.style.height=0,t.style.overflow="hidden",n.insertBefore(t,n.firstChild)),O()}}function h(e){return function(){e.onerror=null,e.ontimeout=null,O()}}for(i(),p=document.getElementsByTagName("use"),l=0;l1)for(var n=1;n0)for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{configuration:{modalContent:void 0}}).configuration;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,{identifier:f.COOKIE_MODAL_IDENTIFIER,configuration:r(n,{visibilityScopes:(e={},_(e,s.COOKIE_MODAL_VISIBILITY_SCOPE,[f.CLASSES.VISIBLE]),_(e,s.COOKIE_MODAL_VISIBILITY_SCOPE_DETAIL,[f.CLASSES.VISIBLE,f.CLASSES.DETAIL_OPEN]),e)})}));return o.initializeScrollHandlers(),o.modalDetailContentWrapper=o.collectModalDetailContentWrapper(),o.configuration.isOnCookiePage?o.addPageClasses():(o.modalContentWrapper=o.collectModalContentWrapper(),o.loadContentIntoModal(n.modalContent)),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,u.default),i(t,[{key:"handleComponentState",value:function(e){(function e(t,n,o){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var i=Object.getPrototypeOf(t);return null===i?void 0:e(i,n,o)}if("value"in r)return r.value;var c=r.get;return void 0!==c?c.call(o):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"handleComponentState",this).call(this,e),this.checkIfDetailViewShouldOpen()}},{key:"loadContentIntoModal",value:function(e){this.modalContentWrapper.innerHTML="string"==typeof e?e:e.outerHTML}},{key:"addPageClasses",value:function(){this.vdom.classList.add(f.CLASSES.PAGE)}},{key:"checkIfDetailViewShouldOpen",value:function(){if((0,l.select)(l.SELECT_VISIBILITY_SCOPE).visibilityScope===s.COOKIE_MODAL_VISIBILITY_SCOPE_DETAIL){var e=(0,l.select)(l.SELECT_COOKIE_MODAL_DETAIL_CONTENT).cookieModalDetailPageContent;this.modalDetailContentWrapper.innerHTML=e}}},{key:"collectModalContentWrapper",value:function(){return document.getElementById(f.MODAL_CONTENT_WRAPPER_IDENTIFIER)}},{key:"collectModalDetailContentWrapper",value:function(){return document.getElementById(f.DETAIL_CONTENT_WRAPPER_IDENTIFIER)}},{key:"initializeScrollHandlers",value:function(){var e=this;(0,c.querySelectorAllArray)(f.TOC_IDENTIFIER).forEach(function(t){t.addEventListener("click",e.handleTOCClick)})}},{key:"handleTOCClick",value:function(e){"function"==typeof e.currentTarget.scrollIntoView&&(e.preventDefault(),document.querySelector(e.currentTarget.getAttribute("href")).scrollIntoView({behavior:"smooth",inline:"end",block:"start"}))}}]),t}();t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.COOKIE_MODAL_IDENTIFIER="kmcc-cookie-modal",t.TOC_IDENTIFIER=".js-kmcc-cookie-modal__aside__navigation li a",t.MODAL_CONTENT_WRAPPER_IDENTIFIER="kmcc-modal-content-wrapper",t.DETAIL_CONTENT_WRAPPER_IDENTIFIER="kmcc-detail-content",t.CLASSES={PAGE:"kmcc-cookie-modal--page",VISIBLE:"kmcc-cookie-modal--visible",DETAIL_OPEN:"kmcc-cookie-modal--detail-open"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=Object.assign||function(e){for(var t=1;t=0&&(c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"addAllEventListeners",this).call(this),window.addEventListener("keyup",this.backToBasicModalBound),this.hasEventsConfigured=!0)}},{key:"removeAllEventListeners",value:function(){c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"removeAllEventListeners",this).call(this),window.removeEventListener("keyup",this.backToBasicModalBound),this.hasEventsConfigured=!1}},{key:"backToBasicModal",value:function(e){if("keyup"===e.type&&e.keyCode===l.KEYCODE_ESCAPE||"click"===e.type){var t=this.configuration.isOnCookiePage;(0,f.dispatch)((0,p.getBackToBasicModalVisibilityScope)({isOnCookiePage:t}))}}}]),t}();t.default=E},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.KEYCODE_ESCAPE=27},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.BACKDROP_IDENTIFIER="kmcc-backdrop",t.CLASSES={VISIBLE:"kmcc-backdrop--visible"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n=this.controlledElement.clientHeight/2?this.vdom.classList.add(a.CLASSES.VISIBLE):this.vdom.classList.remove(a.CLASSES.VISIBLE)}},{key:"handleScrollToTop",value:function(e){e.preventDefault(),this.controlledElement.scroll({top:0,left:0,behavior:"smooth"})}}]),t}();t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.TO_TOP_BUTTON_IDENTIFIER="kmcc-to-top-button",t.CLASSES={VISIBLE:"kmcc-to-top-button--shown"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.KMCC_PAGE_IDENTIFIER="kmcc-page",t.KMCC_CONTENT_URL_ITEM_IDENTIFIER="kmcc-modal-content-url"}]); \ No newline at end of file +!function(){"use strict";if("undefined"!=typeof window&&window.addEventListener){var e,t,n,o=Object.create(null),r=function(){clearTimeout(t),t=setTimeout(e,100)},i=function(){},c=function(){var e;window.addEventListener("resize",r,!1),window.addEventListener("orientationchange",r,!1),window.MutationObserver?((e=new MutationObserver(r)).observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0}),i=function(){try{e.disconnect(),window.removeEventListener("resize",r,!1),window.removeEventListener("orientationchange",r,!1)}catch(e){}}):(document.documentElement.addEventListener("DOMSubtreeModified",r,!1),i=function(){document.documentElement.removeEventListener("DOMSubtreeModified",r,!1),window.removeEventListener("resize",r,!1),window.removeEventListener("orientationchange",r,!1)})},a=function(e){function t(e){var t;return void 0!==e.protocol?t=e:(t=document.createElement("a")).href=e,t.protocol.replace(/:/g,"")+t.host}var n,o,r;return window.XMLHttpRequest&&(n=new XMLHttpRequest,o=t(location),r=t(e),n=void 0===n.withCredentials&&""!==r&&r!==o?XDomainRequest||void 0:XMLHttpRequest),n},u="http://www.w3.org/1999/xlink";e=function(){var e,t,n,r,l,s,f,_,p,d,E=0;function O(){0===(E-=1)&&(i(),c())}function I(e){return function(){!0!==o[e.base]&&(e.useEl.setAttributeNS(u,"xlink:href","#"+e.hash),e.useEl.hasAttribute("href")&&e.useEl.setAttribute("href","#"+e.hash))}}function v(e){return function(){var t,n=document.body,o=document.createElement("x");e.onload=null,o.innerHTML=e.responseText,(t=o.getElementsByTagName("svg")[0])&&(t.setAttribute("aria-hidden","true"),t.style.position="absolute",t.style.width=0,t.style.height=0,t.style.overflow="hidden",n.insertBefore(t,n.firstChild)),O()}}function h(e){return function(){e.onerror=null,e.ontimeout=null,O()}}for(i(),p=document.getElementsByTagName("use"),l=0;l1)for(var n=1;n0)for(var r=0;r0&&void 0!==arguments[0]?arguments[0]:{configuration:{modalContent:void 0}}).configuration;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,{identifier:f.COOKIE_MODAL_IDENTIFIER,configuration:r(n,{visibilityScopes:(e={},_(e,s.COOKIE_MODAL_VISIBILITY_SCOPE,[f.CLASSES.VISIBLE]),_(e,s.COOKIE_MODAL_VISIBILITY_SCOPE_DETAIL,[f.CLASSES.VISIBLE,f.CLASSES.DETAIL_OPEN]),e)})}));return o.initializeScrollHandlers(),o.modalDetailContentWrapper=o.collectModalDetailContentWrapper(),o.configuration.isOnCookiePage?o.addPageClasses():(o.modalContentWrapper=o.collectModalContentWrapper(),o.loadContentIntoModal(n.modalContent)),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,u.default),i(t,[{key:"handleComponentState",value:function(e){(function e(t,n,o){null===t&&(t=Function.prototype);var r=Object.getOwnPropertyDescriptor(t,n);if(void 0===r){var i=Object.getPrototypeOf(t);return null===i?void 0:e(i,n,o)}if("value"in r)return r.value;var c=r.get;return void 0!==c?c.call(o):void 0})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"handleComponentState",this).call(this,e),this.checkIfDetailViewShouldOpen()}},{key:"loadContentIntoModal",value:function(e){this.modalContentWrapper.innerHTML="string"==typeof e?e:e.outerHTML}},{key:"addPageClasses",value:function(){this.vdom.classList.add(f.CLASSES.PAGE)}},{key:"checkIfDetailViewShouldOpen",value:function(){if((0,l.select)(l.SELECT_VISIBILITY_SCOPE).visibilityScope===s.COOKIE_MODAL_VISIBILITY_SCOPE_DETAIL){var e=(0,l.select)(l.SELECT_COOKIE_MODAL_DETAIL_CONTENT).cookieModalDetailPageContent;this.modalDetailContentWrapper.innerHTML=e}}},{key:"collectModalContentWrapper",value:function(){return document.getElementById(f.MODAL_CONTENT_WRAPPER_IDENTIFIER)}},{key:"collectModalDetailContentWrapper",value:function(){return document.getElementById(f.DETAIL_CONTENT_WRAPPER_IDENTIFIER)}},{key:"initializeScrollHandlers",value:function(){var e=this;(0,c.querySelectorAllArray)(f.TOC_IDENTIFIER).forEach(function(t){t.addEventListener("click",e.handleTOCClick)})}},{key:"handleTOCClick",value:function(e){"function"==typeof e.currentTarget.scrollIntoView&&(e.preventDefault(),document.querySelector(e.currentTarget.getAttribute("href")).scrollIntoView({behavior:"smooth",inline:"end",block:"start"}))}}]),t}();t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.COOKIE_MODAL_IDENTIFIER="kmcc-cookie-modal",t.TOC_IDENTIFIER=".js-kmcc-cookie-modal__aside__navigation li a",t.MODAL_CONTENT_WRAPPER_IDENTIFIER="kmcc-modal-content-wrapper",t.DETAIL_CONTENT_WRAPPER_IDENTIFIER="kmcc-detail-content",t.CLASSES={PAGE:"kmcc-cookie-modal--page",VISIBLE:"kmcc-cookie-modal--visible",DETAIL_OPEN:"kmcc-cookie-modal--detail-open"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=Object.assign||function(e){for(var t=1;t=0&&(c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"addAllEventListeners",this).call(this),window.addEventListener("keyup",this.backToBasicModalBound),this.hasEventsConfigured=!0)}},{key:"removeAllEventListeners",value:function(){c(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"removeAllEventListeners",this).call(this),window.removeEventListener("keyup",this.backToBasicModalBound),this.hasEventsConfigured=!1}},{key:"backToBasicModal",value:function(e){if("keyup"===e.type&&e.keyCode===l.KEYCODE_ESCAPE||"click"===e.type){var t=this.configuration.isOnCookiePage;(0,f.dispatch)((0,p.getBackToBasicModalVisibilityScope)({isOnCookiePage:t}))}}}]),t}();t.default=E},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.KEYCODE_ESCAPE=27},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.BACKDROP_IDENTIFIER="kmcc-backdrop",t.CLASSES={VISIBLE:"kmcc-backdrop--visible"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n=this.controlledElement.clientHeight/2?this.vdom.classList.add(a.CLASSES.VISIBLE):this.vdom.classList.remove(a.CLASSES.VISIBLE)}},{key:"handleScrollToTop",value:function(e){e.preventDefault(),this.controlledElement.scroll({top:0,left:0,behavior:"smooth"})}}]),t}();t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.TO_TOP_BUTTON_IDENTIFIER="kmcc-to-top-button",t.CLASSES={VISIBLE:"kmcc-to-top-button--shown"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.KMCC_PAGE_IDENTIFIER="kmcc-page",t.KMCC_CONTENT_URL_ITEM_IDENTIFIER="kmcc-modal-content-url"}]); \ No newline at end of file diff --git a/src/Resources/ui/js/components/AcceptAllCookiesButton.js b/src/Resources/ui/js/components/AcceptAllCookiesButton.js index ff612ec..1dd043e 100644 --- a/src/Resources/ui/js/components/AcceptAllCookiesButton.js +++ b/src/Resources/ui/js/components/AcceptAllCookiesButton.js @@ -1,12 +1,14 @@ import Component from './Component'; import { BUTTON_IDENTIFIER } from '../config/acceptAllCookies.config'; +import { TOGGLE_BUTTON_CLASS_IDENTIFIER } from '../config/toggleButton.config'; import { dispatch, SET_VISIBILITY_SCOPE_TO_NOTIFICATION, } from '../state'; import cookies from '../services/cookies'; +import { querySelectorAllArray } from '../utils'; class AcceptAllCookiesButton extends Component { constructor() { @@ -25,6 +27,13 @@ class AcceptAllCookiesButton extends Component { const toggleAllCookiesUrl = this.vdom.getAttribute('data-href'); cookies.toggleAll(toggleAllCookiesUrl); dispatch(SET_VISIBILITY_SCOPE_TO_NOTIFICATION); + + // Check all togglebuttons visually + const allToggleButtons = querySelectorAllArray(TOGGLE_BUTTON_CLASS_IDENTIFIER); + allToggleButtons.forEach((toggleButton) => { + // eslint-disable-next-line no-param-reassign + toggleButton.checked = true; + }); } else { throw new Error('Expected a data-href attribute to be present.'); } diff --git a/src/Twig/CookieTwigExtension.php b/src/Twig/CookieTwigExtension.php index 2e61271..bd67048 100644 --- a/src/Twig/CookieTwigExtension.php +++ b/src/Twig/CookieTwigExtension.php @@ -81,7 +81,9 @@ public function getCookieTypes() */ public function getLegalCookie(Request $request) { - return $this->cookieHelper->getLegalCookie($request)['cookies']; + $legalCookie = $this->cookieHelper->getLegalCookie($request); + + return null !== $legalCookie && isset($legalCookie['cookies']) ? $legalCookie['cookies'] : []; } /**